Commit Graph

673 Commits

Author SHA1 Message Date
hjk
8d74fdd6d4 TextEditor: C++-ify texteditoractionhandler
Macros are not necessary here.

Change-Id: I19e5c38e64f1b7f254c1fcb33d891e02704e3657
Reviewed-by: Christian Stenger <christian.stenger@digia.com>
2014-08-27 17:06:24 +02:00
hjk
2a5c602341 TextEditor: Introduce some convenience text accessors in the editor
And adjust users.

Change-Id: I9329257cfa5f3298731deb07c2881bc37d9a051d
Reviewed-by: Christian Stenger <christian.stenger@digia.com>
2014-08-27 15:00:36 +02:00
hjk
306ca6fce0 TextEditor: Remove parts of old editor creation sequence
Not used anymore.

Change-Id: Iee0f6340097341bd584ae559e3f40f0c1364cba3
Reviewed-by: Christian Stenger <christian.stenger@digia.com>
2014-08-26 10:18:23 +02:00
Daniel Teske
71c6f32ea4 Editor: Fix one pixel offset for folded block preview
Task-number: QTCREATORBUG-5168
Change-Id: I89a9949227e11053dfa2436ae6b0c017c465906c
Reviewed-by: Eike Ziller <eike.ziller@digia.com>
2014-08-26 10:02:40 +02:00
hjk
f9f5fdcf2b TextEditor: Re-organize Plain text editor setup
Change-Id: I202e66a9cd295a85e3eea31177280e2c5d409ced
Reviewed-by: Christian Stenger <christian.stenger@digia.com>
2014-08-25 15:09:29 +02:00
hjk
4bbf6b63f1 CMakeProjectManager: Use a BaseEditorFactory derived class
Change-Id: Ia5f2b789d82c63552ec7abe5ec22bbc29100a59a
Reviewed-by: Christian Stenger <christian.stenger@digia.com>
2014-08-25 10:09:30 +02:00
hjk
2b5df11cb8 Android: Use a BaseEditorFactory derived class for JavaEditor
Change-Id: Ifc923177744af5058b22fac7fff2f2345cc99135
Reviewed-by: Christian Stenger <christian.stenger@digia.com>
2014-08-22 16:21:32 +02:00
hjk
5d41421533 TextEditor: Introduce a BaseTextEditorFactory
The BaseTextEditorFactory will keep a collection of all
relevant creation functions (document, editor, widget,
indenter, syntax highlighter) and will use them to
create or duplicate base text editors in a uniform way.

Change-Id: I255b519e35cf1c28d5e198242f99316951a0235e
Reviewed-by: Christian Stenger <christian.stenger@digia.com>
2014-08-22 15:17:23 +02:00
hjk
43035981c0 TextEditor: Add a helper function to set up code assistance
This is needed for further refactoring in the cpp and qmljs editors.

Change-Id: Ic25525e5f468e915226e9daa8d118ff76a749e9f
Reviewed-by: Christian Stenger <christian.stenger@digia.com>
2014-08-22 10:03:01 +02:00
hjk
cc351381ae TextEditor: Replace in-class connection by virtual function
Change-Id: Ifb51606f71100223631d086318c230a478d70712
Reviewed-by: Christian Stenger <christian.stenger@digia.com>
2014-08-21 09:37:26 +02:00
hjk
2cf2dadffb TextEditor: Remove some needless indirection in BaseTextEditor
Change-Id: Ibb446fce6365a0c52ad74d366f24a202ea9cc33f
Reviewed-by: Christian Stenger <christian.stenger@digia.com>
2014-08-21 08:58:29 +02:00
hjk
ba51240524 TextEditor: Fix snippet editor crash introduced in d85a4f615
The SnippetEditorWidget setup is unusual as it doesn't have
an associated SnippetEditorFactory/SnippetEditor creation chain
and requires manual intervention. This was lost in the
conversion to the new construction scheme.

Change-Id: I0919295603432e525c2abd0da762acc8207f996c
Reviewed-by: Christian Stenger <christian.stenger@digia.com>
2014-08-21 07:36:17 +02:00
hjk
03eb2f97cf TextEditor: Configure code assistant properly in new scheme
No need for the extra indirection here.

Change-Id: I21a303423ba52724551cca0bc82d4e4b08ab4e52
Reviewed-by: Christian Stenger <christian.stenger@digia.com>
2014-08-20 15:48:19 +02:00
hjk
1dd05a1855 TextEditor: Prepare new editor construction scheme
IEditorFactory knows how to construct an *Editor, the
Editor knows how to construct the Widget.

Change-Id: I2894e6ae622cb43ef6974aac82505c1f9912ff7b
Reviewed-by: Christian Stenger <christian.stenger@digia.com>
2014-08-20 14:13:33 +02:00
hjk
cb35594800 TextEditor: Centralize settings connections setup
All editors did that manually, with varying approaches. Connect once
when the document is made known to the EditorWidget instead.

Change-Id: Ib0828b08158539859f6f89c8080435a027aa06ed
Reviewed-by: Christian Stenger <christian.stenger@digia.com>
2014-08-20 13:28:44 +02:00
hjk
0e9b414386 TextEditor: BaseTextEditor code cosmetics
Namespaces, #include order

Change-Id: I6e865821811c0a53e7ebbe321365cffdde7961af
Reviewed-by: Christian Stenger <christian.stenger@digia.com>
2014-08-19 14:48:17 +02:00
hjk
c5fae0e8da TextEditor: Further *Editor/*EditorWidget disentangling
In most cases, the *Editor constructor does not need to
access the *EditorWidget.

Change-Id: I1f5c076a0f723d5d82b398e8c250c7bd1d47eb17
Reviewed-by: Christian Stenger <christian.stenger@digia.com>
2014-08-19 10:32:12 +02:00
hjk
d2ec7d80d9 TextEditor: Merge the two sets of *EditorWidget constructors
Change-Id: I45d87d0be722ac36d64af222f03f8cb76242c9df
Reviewed-by: Christian Stenger <christian.stenger@digia.com>
2014-08-19 09:19:33 +02:00
hjk
2961c1c288 TextEditor: Remove special m_revisionsVisible copying
This does not seem to be necessary at all (it's overwritten on each
and every setDisplaySetting() call) and is the only remaining
difference in the two remaning BaseTextEditorWidget constructor bodies.

Change-Id: I6b8c0a51cf97e12f0dffb0673b680d4bbd2f2b45
Reviewed-by: Christian Stenger <christian.stenger@digia.com>
2014-08-18 16:57:56 +02:00
Eike Ziller
746a0ba208 EditorManager: saveEditor -> saveDocument
Change-Id: I1691b7231080320ff48efbbd7f870658a977ad0d
Reviewed-by: Daniel Teske <daniel.teske@digia.com>
2014-08-18 14:14:10 +02:00
Daniel Teske
60f97524ed Tweak block highlighting drawing
This reverts commit 2fae18d62795303683f5c20290bd2ee88ebc3c2e.

Change-Id: Ie63e7f2a19ce183f29470aec093de04d7a78a719
Reviewed-by: Eike Ziller <eike.ziller@digia.com>
2014-08-12 11:39:37 +02:00
Daniel Teske
89dfb8a656 Fix bloc highlighting drawing in scrolled views
Task-number: QTCREATORBUG-8112
Change-Id: I411e6ce6f5a7d81da9de9541c711d63d6952c623
Reviewed-by: Eike Ziller <eike.ziller@digia.com>
2014-08-12 11:39:30 +02:00
hjk
d7c2b0b681 TextEditor: Consolidate document access functions.
There was document(), textDocument() and baseTextDocument().
Two should be enough...

Change-Id: Id9e41c8d857c5cb3269a9fce5ab594d34448c982
Reviewed-by: Tobias Hunger <tobias.hunger@digia.com>
2014-08-04 10:43:56 +02:00
hjk
a9b7045803 TextEditor: Move toolbar widgets from *Editor to *Widget
Lifetime is coupled to the widgets, not the editor.

Change-Id: I01560bbdd6c399376d3a4184f0eb83e4153f830e
Reviewed-by: Tobias Hunger <tobias.hunger@digia.com>
2014-08-01 17:57:26 +02:00
hjk
14d3206589 TextEditor: Move Find aggregate from Editor to Widget
Its lifetime is connected to the widget.

Change-Id: Iebf1a524511051f40869803426e274e8909c87e4
Reviewed-by: Christian Stenger <christian.stenger@digia.com>
2014-08-01 16:29:30 +02:00
hjk
e947f4ebc2 TextEditor: Move private BaseTextEditor slots to the pimpl
Change-Id: I39ada562d3ef390fee0fee303fb84033c506f41e
Reviewed-by: Christian Stenger <christian.stenger@digia.com>
2014-08-01 15:27:56 +02:00
hjk
f5b0bd32b2 TextEditor: Remove one stack of EditorWidget constructors
There are conceptually only two: one that operates a new document,
and one that shares one. Being explicit makes moving data over to
the Editor hierarchy easier. Convenience can be re-added there,
later.

Change-Id: I9b34ff26628c99ffff01201dcf99332d5e7253e9
Reviewed-by: Christian Stenger <christian.stenger@digia.com>
Reviewed-by: hjk <hjk121@nokiamail.com>
2014-08-01 14:10:23 +02:00
Christian Stenger
73d41589ab Fix missing initializer of auto completer
Change-Id: I38580087c1d8e3419698371970d0e6f9188d284d
Reviewed-by: hjk <hjk121@nokiamail.com>
2014-08-01 13:40:47 +02:00
hjk
98fd59fd09 TextEditor: Start moving data from *EditorWidget to *Editor
Goal is to consolidate "controller" related data in the *Editor hierarchy.
This patch introduces temporary "cross-Private" accessors dd() to
keep the patches small.

First item moved is the AutoCompleter, a glimps at long term benefits
is the simplification in the JavaEditorWidget which is now essentially
a BaseTextEditorWidget, only containing the still-wrong createEditor().
But that can only be move if the *Editors are self-contained, i.e.
keep data themselves, not indirectly through the *EditorWidgets.

Change-Id: Ia0ab90f0322bb17ac20458e6581069eed30acbaf
Reviewed-by: Christian Stenger <christian.stenger@digia.com>
Reviewed-by: hjk <hjk121@nokiamail.com>
2014-07-31 16:45:31 +02:00
hjk
9fd2fe5a9a TextEditor: Make completion assist provider a data member
In case of the CppEditor a direct member is not possible due
to setup restrictions inside the CppEditor machinery. I'd expect
that to be fixable when the editor base system is in good shape.

Change-Id: I184e219ca2dff6f67c9b58c182212eb12972cc84
Reviewed-by: Christian Stenger <christian.stenger@digia.com>
2014-07-31 12:40:52 +02:00
hjk
f6b48950ed TextEditor: Re-work comment definition handling
No need for most of the machinery.

Change-Id: I9078174582d83da94c6c7f20282fd3a5f1742911
Reviewed-by: Christian Stenger <christian.stenger@digia.com>
Reviewed-by: hjk <hjk121@nokiamail.com>
2014-07-31 10:54:49 +02:00
Thiago Macieira
5da75dba06 Replace the PMF to certain QString members with a regular function
Qt 5.4 is adding ref-qualified overloads to toUpper, toLower, trimmed
and some others, so the cast becomes ambiguous or just plain wrong.

Change-Id: Idff0b3e100f075b9b995aeb84d88575afecb2d6f
Reviewed-by: hjk <hjk121@nokiamail.com>
2014-07-31 03:24:02 +02:00
hjk
1924fdb90f TextEditor: Merge PlainTextEditor into Base
Same patter. Plain is fully merged now, so remove the files, too.

Change-Id: Id8c0ba5689ad9980a0db3580cb9833344fd911f3
Reviewed-by: Tobias Hunger <tobias.hunger@digia.com>
Reviewed-by: Christian Stenger <christian.stenger@digia.com>
2014-07-30 15:17:53 +02:00
hjk
faa0e5b96c TextEditor: Replace PlainTextEditorWidget by Base + a setup function
Change-Id: I91a3bfb66a72e9234ca59f97d5260bbfc3ccb0d3
Reviewed-by: Christian Stenger <christian.stenger@digia.com>
Reviewed-by: hjk <hjk121@nokiamail.com>
2014-07-30 14:41:09 +02:00
hjk
ce6f3477b5 TextEditor: Move remaining PlainTextEditorWidget functions to Base
Change-Id: Ib10d938fce352f59bcd40f1c6aa493794fe90f8d
Reviewed-by: Christian Stenger <christian.stenger@digia.com>
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com>
Reviewed-by: hjk <hjk121@nokiamail.com>
2014-07-30 14:21:23 +02:00
hjk
fde176e51c TextEditor: Move highlighting support from Plain to Base
Goal is to squash the 'Plain' layer.

Change-Id: I2513de57fbbc09e9d0d9d4f1eb008dced76038f0
Reviewed-by: Christian Stenger <christian.stenger@digia.com>
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com>
Reviewed-by: hjk <hjk121@nokiamail.com>
2014-07-30 14:19:55 +02:00
hjk
78bb9cd525 TextEditor: Pimpl BaseTextEditor
Change-Id: I876025562678513dd8e8c6537783c81aef7cb2aa
Reviewed-by: Tobias Hunger <tobias.hunger@digia.com>
2014-07-28 13:50:00 +02:00
hjk
5aa1b50617 TextEditor: Slim down BaseTextEditorWidget interface
By moving some private functions to the pimpl.
Also, re-order some member function declarations.

Change-Id: If8a6c7ae1c27386511a5fa0a92c88a13541c2d94
Reviewed-by: Tobias Hunger <tobias.hunger@digia.com>
2014-07-28 12:34:45 +02:00
hjk
adfb30743d TextEditor: Merge BaseTextEditorDocument into BaseTextDocument
That was the only user of that layer of abstraction.

Change-Id: I2bdc4abb8b2b33bfb70398dd11f7ecc4745ddc43
Reviewed-by: Tobias Hunger <tobias.hunger@digia.com>
2014-07-28 12:33:47 +02:00
hjk
96d3449acd TextEditor: Remove itexteditor.{h,cpp}
Move the remaining contents to more appropriate places.

Change-Id: I55eed5c572bd33dafe2187523d9aa381c211fdd6
Reviewed-by: Tobias Hunger <tobias.hunger@digia.com>
2014-07-25 14:53:11 +02:00
hjk
bf5e43be94 TextEditor: Merge ITextEditor and BaseTextEditor
Adjust all callers, de-export BaseTextEditorAnimator

Change-Id: I2329d976c1398e2449844bb480a4d4ed29859506
Reviewed-by: Tobias Hunger <tobias.hunger@digia.com>
2014-07-25 13:45:55 +02:00
Alessandro Portale
dff9a5f4b0 TextEditor: Compile fix for MSVC 2010
MSVC suddenly has this problem when bulding Qt Creator master Qt5 dev.

error C2352: 'TextEditor::BaseTextEditorWidget::extraSelections' :
illegal call of non-static member function
error C2825: 'T': must be a class or namespace when followed by '::'
...

This patch works it around by simply using this->

Change-Id: I8aae3e76f80248e1dd27d87552d14a81eda0d25f
Reviewed-by: hjk <hjk121@nokiamail.com>
2014-07-23 11:22:41 +02:00
hjk
cf8a614419 Merge ITextMark and BaseTextMark
Turns out we don't even need two-phase initialization,
by transparently postponing registration until we get
a non-empty file name, either at constuction, or at
file name change times.

Change-Id: I3e87e47c820066e6707e946fc474ab9c1993e61f
Reviewed-by: Eike Ziller <eike.ziller@digia.com>
2014-07-23 10:38:31 +02:00
Christian Kandeler
93304df038 Always pass Core::Id by value.
Currently we pass in some places by value, elsewhere by const ref and
for some weird reason also by const value in a lot of places. The latter
is particularly annoying, as it is also used in interfaces and therefore
forces all implementors to do the same, since leaving the "const" off is
causing compiler warnings with MSVC.

Change-Id: I65b87dc3cce0986b8a55ff6119cb752361027803
Reviewed-by: hjk <hjk121@nokiamail.com>
2014-07-01 11:52:08 +02:00
David Schulz
6e9b724006 Editor: Blockselection rewrite.
Also adding the possibility to insert text into the blockselection.

Task-number: QTCREATORBUG-7773
Change-Id: I7a47a1d630f769a8253ee1a2f21057820ea170d5
Reviewed-by: Lukas Holecek <hluk@email.cz>
Reviewed-by: Christian Stenger <christian.stenger@digia.com>
Reviewed-by: hjk <hjk121@nokiamail.com>
2014-06-20 13:16:54 +02:00
David Schulz
6144a0b32f Editor: Don't show help popups when alt was part of a shortcut.
Task-number: QTCREATORBUG-12382
Change-Id: I2825f8197dbac1f1ef805892dc1191df86b84dbb
Reviewed-by: Eike Ziller <eike.ziller@digia.com>
2014-06-13 14:40:41 +02:00
Eike Ziller
ade2710725 TextEditors: Keep visible position in editor for 'external' changes
If contents of a text editor change from outside the editor,
the visible portion of the text in the viewport should stay the same.
That is especially apparent when opening a document in a split view, and
adding/removing lines in one of them, above the first visible line in
the other.

Task-number: QTCREATORBUG-11486
Change-Id: I28cde17ecf98cb98c1d6f1259dc66d3671585ee3
Reviewed-by: David Schulz <david.schulz@digia.com>
2014-06-06 13:37:35 +02:00
Eike Ziller
db5f2f1411 Text editors: Do not show tool tip for empty area
The editors were showing tool tips for the last cursor position in a
line, even if the mouse was hovered over the empty space behind the
line.

Task-number: QTCREATORBUG-9437
Change-Id: Ibe3b0140b73c3a15811eeaf50a15d75f378f37f4
Reviewed-by: David Schulz <david.schulz@digia.com>
2014-06-02 15:18:26 +02:00
David Schulz
714d56a381 Editor: Add actions for view page/line up/down.
Task-number: QTCREATORBUG-4994
Change-Id: Ia6ce1a01cd78dd1987404d77f6b0c0da41b4929e
Reviewed-by: Eike Ziller <eike.ziller@digia.com>
2014-06-02 15:07:35 +02:00
David Schulz
9c2852615c Editor: Handle Tab as printable character.
Task-number: QTCREATORBUG-2225
Change-Id: Ia557e0c1d61b61b31b28a1d3e32f846d7efd70f0
Reviewed-by: Eike Ziller <eike.ziller@digia.com>
2014-05-26 13:28:41 +02:00