Commit Graph

645 Commits

Author SHA1 Message Date
Eike Ziller
dd43d9908f Rename IDocument::fileName --> filePath
That is what it actually is, wrt how Qt API calls it.

Change-Id: Ied02055debf6aad75556b0d9d22e8ba2f72be555
Reviewed-by: Eike Ziller <eike.ziller@digia.com>
2013-07-09 13:51:42 +02:00
Nikolai Kosjar
10ff6769ac Core: Let IDocument also report failed file reload operations
Change-Id: I8fa02f2398f59306c49481316fdedf50a1c4e32f
Reviewed-by: Daniel Teske <daniel.teske@digia.com>
2013-06-24 11:13:29 +02:00
jkobus
abe3951d67 Take diff colors from color scheme
Change-Id: I706612a8f89917cb57b7d1e9ecebd86b3f4bcc8d
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@digia.com>
Reviewed-by: Eike Ziller <eike.ziller@digia.com>
Reviewed-by: David Schulz <david.schulz@digia.com>
2013-06-12 09:23:50 +02:00
Frank Secilia
84e6ab02ed Mismatched parens background color now dark on dark backgrounds.
The color is not configurable, but on dark backgrounds, the color is now
dark magenta, rather than magenta.

Task-number: QTCREATORBUG-9025

Change-Id: I9925e598b30a13c8b9691d6e0e576c0087df38da
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2013-06-06 10:08:27 +02:00
Eike Ziller
7c8db79817 Switch less often to edit mode
This change
* Removes IMode::type, ModeManager::activateModeType, and
  IEditor::preferredModeType, and adds IEditor::isDesignModePreferred
  instead
* Adapts the mode switching code in EditorManager to handle multiple
  windows, for example switching to edit mode should only happen if
  the editor/view is in the main window. Otherwise the editor window
  should be raised and focused
* Renames EditorManager::NoActivate --> DoNotChangeCurrentEditor
* Reverts the EditorManager::ModeSwitch logic to switch mode or
  make the current editor visible by default, introducing
  DoNotMakeVisible flag instead
* Fixes a few instances where EditorManager::ModeSwitch should have been
  used

One non-trivial problem left: If you open a .ui file and switch to an
external editor window, edit mode is activated, because the current
editor no longer is a .ui file, which means that the design mode gets
deactivated.

Change-Id: I76c5c2391eb4090143b778fb103acff3a5a1ff41
Reviewed-by: David Schulz <david.schulz@digia.com>
2013-06-05 09:43:14 +02:00
Eike Ziller
2125525e77 Move openEditorAt from BaseTextEditorWidget to EditorManager
More sensible place, gotoLine is a method in IEditor anyhow.

Change-Id: I420a6bf17060c16e6f1a4f45e0bef89379fb6bf8
Reviewed-by: David Schulz <david.schulz@digia.com>
2013-06-03 09:33:06 +02:00
Eike Ziller
7d986f0486 Cycle through extra editor windows when cycling through splits
Change-Id: I1bd5654d62b11456c35cc5bf1099e41fb3559bc7
Reviewed-by: David Schulz <david.schulz@digia.com>
2013-05-31 12:27:12 +02:00
hjk
2b93fea580 BaseTextEditor: Style fixes
Whitespace, s/e/m_editorWidget/, remove unneeded struct, remove 'inline'
when not needed...

Change-Id: I1ce76f5c4b1febe45c4a3b6404107fed7d9c6868
Reviewed-by: David Schulz <david.schulz@digia.com>
2013-05-27 09:05:35 +02:00
hjk
4e75fc8c54 TextEditor: Simplify Utils::CommentDefinition structure
Change-Id: I8fc97ed61c47af2c3d9e5cc2bf81e97661204d4f
Reviewed-by: David Schulz <david.schulz@digia.com>
2013-05-27 08:35:46 +02:00
hjk
b8ea4a9bb3 BaseTextEditor: Remove needless indirection for timer members
Change-Id: Iace012eb2fba76438d27d80462e6357cbda73f53
Reviewed-by: David Schulz <david.schulz@digia.com>
2013-05-24 15:38:16 +02:00
Orgad Shaneh
05ef32f242 Remove Nokia leftovers
Mostly internal mimetypes

Change-Id: Ia84206f1334c1f83474cbc307e848719bb98adbc
Reviewed-by: Fawzi Mohamed <fawzi.mohamed@digia.com>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
Reviewed-by: Tobias Hunger <tobias.hunger@digia.com>
2013-05-24 12:29:23 +02:00
jkobus
e844bee1da Add file descriptions, enable file folding
Change-Id: Ie90ac9fb74e9c4b8cfba16d065d1b8751125e83c
Reviewed-by: David Schulz <david.schulz@digia.com>
2013-05-06 10:31:54 +02:00
jkobus
ce0efbda46 Omit separator lines when copying selected text
In addition rename int start -> startPosition and int end -> endPosition
to avoid a name clash with QTextBlock start inside
BaseTextEditorWidget::createMimeDataFromSelection().

Change-Id: I7f54e4046913b5d5d9ddd3c07fd2747b4ca6f3fb
Reviewed-by: hjk <hjk121@nokiamail.com>
Reviewed-by: David Schulz <david.schulz@digia.com>
2013-04-24 13:17:53 +02:00
jkobus
5f5b7fa4c1 Remove unused variables
Remove unused fields and one virtual method,
rename alwaysShows -> contextChunk and revert
its logical value.

Change-Id: I11fd60202aa5b7978b772764a40c99029cac82a3
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
2013-04-23 14:33:33 +02:00
Andrey M. Tokarev
6d65de24b6 CppEditor: small fixes
It's better to initialize m_isSortingAllowed by true
in both constructors (patch to commit where
m_isSortingAllowed appears)

Change-Id: I3d04d4dcd5afdd45a7bc7e05b2de6799d3f5c82d
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com>
2013-04-22 10:53:43 +02:00
Eike Ziller
b450b3071e TextEditors: Separate away methods that actually work on a document
Introduces ITextEditorDocument. This is part of a more general "use
documents instead of editors whereever possible". It will allow to move
to e.g. ITextEditor::openedTextDocumentContents() instead of
ITextEditor::openedTextEditorsContents().

Change-Id: I5ebceaa257a0d2c3e8ac4ac51b9b08b6faa42487
Reviewed-by: David Schulz <david.schulz@digia.com>
2013-04-19 16:21:30 +02:00
Lorenz Haas
7d2a7685aa Editor: Show file encoding in editor toolbar
The file encoding is shown next to the current line in the toolbar. If
the label is clicked a dialog for encoding selection is shown.

Task-number: QTCREATORBUG-8376
Change-Id: I9adee76a31929de5f698d14fe5ca5abce3cc4633
Reviewed-by: David Schulz <david.schulz@digia.com>
2013-04-18 15:53:53 +02:00
Andrey M. Tokarev
72e0ded3c4 CppEditor: add more sections (protected, ...) for declaration (refactoring)
You can write definition of function, type Alt+Enter, as usual,
and select not only public but also other possible sections
like private, public slots and so on.

Change-Id: I2faefc3833c6f05c9e2e5a2a41328bcdbe17ba14
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com>
2013-04-18 15:08:19 +02:00
Lorenz Haas
e89c30feb8 BaseEditor: Open locator "l <line:column>" on toolbar line widget click
Task-number: QTCREATORBUG-8811
Change-Id: Ia3ece9efb7e2c6d227ab3395aca636a27f667f0d
Reviewed-by: David Schulz <david.schulz@digia.com>
2013-04-18 11:23:23 +02:00
jkobus
186c457d6c Implement expanding / shrinking skipped lines
Change-Id: I6921b7a39288f6a9747574b1a8e75d571f4723ce
Reviewed-by: hjk <hjk121@nokiamail.com>
2013-04-15 18:09:35 +02:00
jkobus
77abd02787 Get rid of QChar::LineSeparator
It was causing troubles while scrolling. Replace it with
\n and hack selection. Simplify the code. Now every line
is a separate block. Prepare for expanding skipped lines.

Change-Id: I8d305681c575abdaaf9cdbf26de864dd3a906d3a
Reviewed-by: David Schulz <david.schulz@digia.com>
Reviewed-by: hjk <hjk121@nokiamail.com>
2013-04-12 14:55:08 +02:00
Lorenz Haas
82d6dd6f07 GUI enhancement for line number widget in editors tool bar
The L of "Line ..." and the right frame of the previous combo box are
glued together without any spacing which looks not good. Added half
spacing to save space and make the label good looking.

Change-Id: Id930171be7a2f7885ab633eec8082057bc726227
Reviewed-by: David Schulz <david.schulz@digia.com>
2013-04-09 08:05:07 +02:00
Friedemann Kleint
3a806d4252 Clean headers in TextEditor.
Change-Id: Ie679e7e9d0d20a0f71dcc1fcf0f7d8305eeeeced
Reviewed-by: Fawzi Mohamed <fawzi.mohamed@digia.com>
2013-03-27 07:15:31 +01:00
Nikolai Kosjar
1e59df6fb0 TextEditor: Simplify testing of code assistant
Change-Id: I6f16dd775a7c5d8eaa4944d6050bf979be83a303
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
2013-03-20 13:45:02 +01:00
Erik Verbruggen
f8b9f61718 Editors: do not hide mouse when only a modifier is pressed.
So when doing ctrl-/cmd-click mouse navigation, this will prevent the
mouse cursor from disappearing.

Change-Id: I147332c47a8946ce69ddd719ac73b6132d5816db
Reviewed-by: Eike Ziller <eike.ziller@digia.com>
Reviewed-by: David Schulz <david.schulz@digia.com>
2013-03-20 10:14:30 +01:00
Nikolai Kosjar
947207c802 C++: Fix dangling IDocument* in CppCompletionAssistProcessor
Steps to reproduce the crash:
 1. Open some long file, e.g. botan.cpp
 2. Trigger completion and close editor immediately

The IDocument pointer was only used to reference the file name. Instead
of passing an IDocument* to the IAssistInterface, pass the file name.

Change-Id: Iafce9b818806a77968a10541114bc9b7c8665f11
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
Reviewed-by: David Schulz <david.schulz@digia.com>
2013-03-19 14:12:11 +01:00
Nikolai Kosjar
7a107e7d00 TextEditor: Remove old qDebug()
Change-Id: I30e76c3e0f96e7b70f0c9f70d5c241a41d1c7a5f
Reviewed-by: David Schulz <david.schulz@digia.com>
2013-03-18 07:50:55 +01:00
Friedemann Kleint
781099468e Fix Krazy warnings about includes/header guards in Text Editor.
Change-Id: I5fdea4c3092f5731dc85129dd33bc48c40bcb088
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com>
2013-03-12 16:18:53 +01:00
Mitch Curtis
e53ae81858 CPP, QmlJs editors: don't indent when moving commented lines up/down.
Currently, pressing Ctrl + Shift + Up/Down with a commented block of
text selected will indent that block if the line two lines above the
block is indented. This is undesirable, because the indenting for that
block is incorrect when it is uncommented. See the following example:

Step 1:
void f()
{
    int x;

//    int y;
}

Step 2 - After Ctrl + Shift + Up:
void f()
{
    int x;
    //    int y;

}

Step 3 - After uncommenting the block:
void f()
{
    int x;
        int y;

}

This patch tells the CPP and QmlJs editors not to indent commented
blocks when moving them. Blocks that are not entirely within comments
(excluding whitespace) are not affected.

Tested with (C++ and JavaScript, respectively):
http://paste.kde.org/688778/
http://paste.kde.org/688784/

Change-Id: I35414e6dfd5a1084fd997594e711ea9932231981
Reviewed-by: David Schulz <david.schulz@digia.com>
2013-03-08 15:15:53 +01:00
Fawzi Mohamed
c933d42370 basetexteditor/qmljseditor: fix destructor problem
solve problems depending on the destructor sequence:
- avoid setting code style to a destroyed code style
- avoid hiding a potentially destroyed pane
  (which will be cleared in any case)

Task-number: QTCREATORBUG-8818
Change-Id: Idd7817d99bf4ff04c5e152b00857f6e35825fd37
Reviewed-by: Tobias Hunger <tobias.hunger@digia.com>
2013-03-05 15:30:04 +01:00
David Schulz
6ef0cf1a30 Editor: Refactor Open Link in Next Split.
Cleanup code and added shortcuts and menu entries for
- open header/source in next split
- follow symbol under cursor in next split
- open declaration/definition in next split

Change-Id: I2c4347749d26669d88b7c2968f30f60710f442b1
Reviewed-by: Petar Perisin <petar.perisin@gmail.com>
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
2013-02-14 09:46:16 +01:00
David Schulz
45b021331e Editor: Renaming Link members.
Change-Id: I1ae21152ee7b8e2a9323322575de23d77c260c72
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com>
2013-02-11 16:00:52 +01:00
Oswald Buddenhagen
1fda2111d4 Merge remote-tracking branch 'origin/2.6'
Conflicts:
	src/plugins/autotoolsprojectmanager/AutotoolsProjectManager.pluginspec.in
	src/plugins/debugger/qtmessageloghandler.cpp
	src/plugins/debugger/qtmessagelogwindow.cpp
	src/plugins/madde/maemodeployconfigurationwidget.cpp
	src/plugins/qmldesigner/components/integration/designdocumentcontroller.cpp
	src/plugins/qmldesigner/designercore/include/widgetqueryview.h
	src/plugins/qmldesigner/designercore/metainfo/metainfoparser.cpp
	src/plugins/qmldesigner/designercore/model/modelnodecontextmenu.cpp
	src/plugins/qmldesigner/designercore/model/modelnodecontextmenu.h
	src/plugins/qmlprojectmanager/qmlprojectapplicationwizard.cpp
	src/plugins/qnx/bardescriptormagicmatcher.h
	src/plugins/qt4projectmanager/profilekeywords.cpp
	src/plugins/remotelinux/deployablefilesperprofile.cpp
	src/plugins/remotelinux/deployablefilesperprofile.h
	src/plugins/remotelinux/deploymentinfo.cpp
	src/plugins/remotelinux/deploymentsettingsassistant.cpp
	src/plugins/remotelinux/profilesupdatedialog.cpp
	tests/auto/icheckbuild/ichecklib.cpp
	tests/auto/icheckbuild/parsemanager.cpp
	tests/auto/icheckbuild/parsemanager.h

Change-Id: Ie465a578446a089e1c502d1cb1096e84ca058104
2013-01-31 16:25:33 +01:00
Robert Loehning
298531e370 Incremented year in copyright info
Change-Id: Ic6a9ff0359625021ebc061d22db6811814534205
Reviewed-by: Kai Koehne <kai.koehne@digia.com>
2013-01-29 16:27:03 +01:00
David Schulz
2f9574582d Editor: Disable adding UTF-8 BOM for qmake project files
Removes the "Add/Remove UTF-8 BOM" entry in the context menu
of the project file editor. Also ignores the setting
"Add If Encoding Is UTF-8" under
Options -> Text Editor -> Behavior -> File Encodings.

Task-number: QTCREATORBUG-8501

Change-Id: I368966b5235ee60011f2051ebdb82f9fe09bc4cc
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com>
2013-01-24 15:44:05 +01:00
Jarek Kobus
d3286c2ce0 Add some methods which will be needed by diff editor
Change-Id: Iae85e123a5b72e85b8b55359267bc1b2810a640b
Reviewed-by: David Schulz <david.schulz@digia.com>
2013-01-22 16:05:15 +01:00
Daniel Teske
52dc1c9ec9 Compile fix
Change-Id: I2812a7e59ee20511b9804337d836e1707894a7be
Reviewed-by: Daniel Teske <daniel.teske@digia.com>
2013-01-11 17:54:18 +01:00
Christian Stenger
e2306b0537 Editor: Compile fix
Change-Id: I61ac997547b6cbeec6c4acaa464162237bb56911
Reviewed-by: Daniel Teske <daniel.teske@digia.com>
2013-01-11 16:45:32 +01:00
Daniel Teske
8e75e611a5 Move TextEditor::ToolTip to Utils
To enabled reuse from all plugins.

Change-Id: I1de68c8e6ed017d45f1248b2043f9611becc3b54
Reviewed-by: David Schulz <david.schulz@digia.com>
2013-01-11 15:06:00 +01:00
Petar Perisin
39e9c5ef20 Editor: Allow to open links in a new split.
This changes current behavior while opening links. Link is now opened in
next split by default. If you use CTRL+Click to open links, it will also
open in next split. However, by using CTRL+ALT+click it will open in
current split.

There are two new checkboxes in Tools/Options/Text Editor/Display:
- "Open Links in New Split" - if it is checked, links will not be opened
in current split. However, if document with link is already opened, it
will be used to open the split
- "Force open links in next split" - Links will always open in next
split, even if their document is already opened somewhere else.

Task-number: QTCREATORBUG-8117
Change-Id: Ib99075b55d9e9683ed2c2386767227457de0a3fc
Reviewed-by: David Schulz <david.schulz@digia.com>
2013-01-11 12:48:44 +01:00
Orgad Shaneh
38f6c349e1 TextEditor: Keep cursor in beginning of line on moveLineUpDown
Moving it to line end scrolls right with long lines

Change-Id: I1fb0cb072a6c57b7e7e53b258567f6842b845fb0
Reviewed-by: David Schulz <david.schulz@digia.com>
2013-01-10 12:49:09 +01:00
Debao Zhang
4a32f1d821 use QSharedPointer instead of QRefCountPointer
Change-Id: Ie670448bf924e02720eae6db33f2a346e8ac0001
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
Reviewed-by: David Schulz <david.schulz@digia.com>
2013-01-09 08:59:28 +01:00
Orgad Shaneh
29a93998df Remove braces for single lines of conditions
#!/usr/bin/env ruby

Dir.glob('**/*.cpp') { |file|
  # skip ast (excluding paste, astpath, and canv'ast'imer)
  next if file =~ /ast[^eip]|keywords\.|qualifiers|preprocessor|names.cpp/i
  s = File.read(file)
  next if s.include?('qlalr')
  orig = s.dup
  s.gsub!(/\n *if [^\n]*{\n[^\n]*\n\s+}(\s+else if [^\n]* {\n[^\n]*\n\s+})*(\s+else {\n[^\n]*\n\s+})?\n/m) { |m|
    res = $&
    if res =~ /^\s*(\/\/|[A-Z_]{3,})/ # C++ comment or macro (Q_UNUSED, SDEBUG), do not touch braces
      res
    else
      res.gsub!('} else', 'else')
      res.gsub!(/\n +} *\n/m, "\n")
      res.gsub(/ *{$/, '')
    end
  }
  s.gsub!(/ *$/, '')
  File.open(file, 'wb').write(s) if s != orig
}

Change-Id: I3b30ee60df0986f66c02132c65fc38a3fbb6bbdc
Reviewed-by: hjk <qthjk@ovi.com>
2013-01-08 10:48:18 +01:00
Orgad Shaneh
a44aa55502 Add whitespace after control keywords
find -name \*.cpp -o -name \*.h | \
  xargs sed -Ei 's/ (for|foreach|if|switch|while)\(/ \1 (/g'

Change-Id: I9efdff4bf0c8c01a52baaaeb75198483c77b0390
Reviewed-by: hjk <qthjk@ovi.com>
2012-11-28 20:20:46 +01:00
Mitch Curtis
e237057827 Make insertLineAbove behaviour consistent when at top of document.
Currently, pressing Ctrl+Shift+Enter to insert a line above the current
line does not work consistently when the current line is the first in
the document. For example, if the cursor (|) is not on the first line:

1. #include <QDebug>
2.|#include <QTest>

becomes

1. #include <QDebug>
2.|
3. #include <QTest>

after Ctrl+Shift+Enter. When the cursor is on the first line, however:

1.|#include <QDebug>
2. #include <QTest>

becomes

1. #include <QDebug>
2.|
3. #include <QTest>

after Ctrl+Shift+Enter. This patch corrects the above result:

1. |
2. #include <QDebug>
3. #include <QTest>

This is also in line with Eclipse's behaviour, for example.

Change-Id: I542050b6090ed0cfdf613bf67bbd2651eb99ec9d
Reviewed-by: David Schulz <david.schulz@digia.com>
2012-11-26 15:23:55 +01:00
Orgad Shaneh
65942d2d8d TextEditor: Compile with QT_NO_CAST_FROM_ASCII
Change-Id: If913f595de78dc8bc4eff1a5c3ad7fe8d5a623ae
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
Reviewed-by: David Schulz <david.schulz@digia.com>
2012-11-26 13:29:33 +01:00
Orgad Shaneh
7fa69afa6c Use Core::Id for language
Change-Id: I0077558e9e2cf5aa06ac921cb45224e29aa85c9b
Reviewed-by: hjk <qthjk@ovi.com>
2012-11-22 08:32:44 +01:00
Marcel Krems
e440ec8a62 BaseTextEditor: Fixed dragging of ITextMarks.
Only start dragging, when a draggable marker was clicked.
Reset drag after releasing mouse button.

Change-Id: I2dc275fc108b55d84b9ff5c69847b116c3307c41
Reviewed-by: Daniel Teske <daniel.teske@digia.com>
Reviewed-by: hjk <qthjk@ovi.com>
2012-11-16 10:50:57 +01:00
David Schulz
5aa0412b8e Editor: Fix highlighting issue after code unfold.
Task-number: QTCREATORBUG-8232

Change-Id: I2595855bb7efe669e3c48a16ab162ace54f7015a
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com>
Reviewed-by: David Schulz <david.schulz@digia.com>
2012-11-12 15:22:05 +01:00
David Schulz
f224c68b32 Editor: Fix animate matching parenthesis in folded code
Task-number: QTCREATORBUG-5877

Change-Id: I1012a1f8d8f925ed1a002d457b856df103e9f703
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com>
Reviewed-by: David Schulz <david.schulz@digia.com>
2012-11-12 15:21:45 +01:00