diff options
Diffstat (limited to 'src')
70 files changed, 557 insertions, 556 deletions
diff --git a/src/plugins/analyzerbase/analyzerutils.cpp b/src/plugins/analyzerbase/analyzerutils.cpp index 125829e844..2aa63e184b 100644 --- a/src/plugins/analyzerbase/analyzerutils.cpp +++ b/src/plugins/analyzerbase/analyzerutils.cpp @@ -65,20 +65,16 @@ CPlusPlus::Symbol *AnalyzerUtils::findSymbolUnderCursor() IEditor *editor = EditorManager::currentEditor(); if (!editor) return 0; - TextEditor::ITextEditor *textEditor = qobject_cast<TextEditor::ITextEditor *>(editor); + TextEditor::BaseTextEditor *textEditor = qobject_cast<TextEditor::BaseTextEditor *>(editor); if (!textEditor) return 0; - TextEditor::BaseTextEditorWidget *editorWidget = qobject_cast<TextEditor::BaseTextEditorWidget *>(editor->widget()); + TextEditor::BaseTextEditorWidget *editorWidget = textEditor->editorWidget(); if (!editorWidget) return 0; - QPlainTextEdit *ptEdit = qobject_cast<QPlainTextEdit *>(editor->widget()); - if (!ptEdit) - return 0; - QTextCursor tc; - tc = ptEdit->textCursor(); + tc = editorWidget->textCursor(); int line = 0; int column = 0; const int pos = tc.position(); diff --git a/src/plugins/bookmarks/bookmarkmanager.cpp b/src/plugins/bookmarks/bookmarkmanager.cpp index 1c10d1b8c5..ff8c49d276 100644 --- a/src/plugins/bookmarks/bookmarkmanager.cpp +++ b/src/plugins/bookmarks/bookmarkmanager.cpp @@ -39,7 +39,7 @@ #include <coreplugin/actionmanager/command.h> #include <projectexplorer/projectexplorer.h> #include <projectexplorer/session.h> -#include <texteditor/itexteditor.h> +#include <texteditor/basetexteditor.h> #include <utils/tooltip/tooltip.h> #include <utils/tooltip/tipcontents.h> #include <utils/qtcassert.h> @@ -410,7 +410,7 @@ QVariant BookmarkManager::data(const QModelIndex &index, int role) const void BookmarkManager::toggleBookmark() { - ITextEditor *editor = ITextEditor::currentTextEditor(); + BaseTextEditor *editor = BaseTextEditor::currentTextEditor(); if (!editor) return; @@ -524,7 +524,7 @@ void BookmarkManager::prevInDocument() void BookmarkManager::documentPrevNext(bool next) { - ITextEditor *editor = ITextEditor::currentTextEditor(); + BaseTextEditor *editor = BaseTextEditor::currentTextEditor(); int editorLine = editor->currentLine(); QFileInfo fi(editor->document()->filePath()); if (!m_bookmarksMap.contains(fi.path())) @@ -613,7 +613,7 @@ BookmarkManager::State BookmarkManager::state() const if (m_bookmarksMap.empty()) return NoBookMarks; - ITextEditor *editor = ITextEditor::currentTextEditor(); + BaseTextEditor *editor = BaseTextEditor::currentTextEditor(); if (!editor) return HasBookMarks; @@ -795,7 +795,7 @@ void BookmarkManager::saveBookmarks() SessionManager::setValue(QLatin1String("Bookmarks"), list); } -void BookmarkManager::operateTooltip(ITextEditor *textEditor, const QPoint &pos, Bookmark *mark) +void BookmarkManager::operateTooltip(BaseTextEditor *textEditor, const QPoint &pos, Bookmark *mark) { if (!mark) return; @@ -817,15 +817,15 @@ void BookmarkManager::loadBookmarks() updateActionStatus(); } -void BookmarkManager::handleBookmarkRequest(ITextEditor *textEditor, +void BookmarkManager::handleBookmarkRequest(BaseTextEditor *textEditor, int line, - ITextEditor::MarkRequestKind kind) + BaseTextEditor::MarkRequestKind kind) { - if (kind == ITextEditor::BookmarkRequest && textEditor->document()) + if (kind == BaseTextEditor::BookmarkRequest && textEditor->document()) toggleBookmark(textEditor->document()->filePath(), line); } -void BookmarkManager::handleBookmarkTooltipRequest(ITextEditor *textEditor, const QPoint &pos, +void BookmarkManager::handleBookmarkTooltipRequest(BaseTextEditor *textEditor, const QPoint &pos, int line) { if (textEditor->document()) { diff --git a/src/plugins/bookmarks/bookmarkmanager.h b/src/plugins/bookmarks/bookmarkmanager.h index 71f964c815..0fbd7876da 100644 --- a/src/plugins/bookmarks/bookmarkmanager.h +++ b/src/plugins/bookmarks/bookmarkmanager.h @@ -34,7 +34,7 @@ #include <coreplugin/icontext.h> #include <coreplugin/inavigationwidgetfactory.h> -#include <texteditor/itexteditor.h> +#include <texteditor/basetexteditor.h> #include <QAbstractItemModel> #include <QMultiMap> @@ -108,10 +108,10 @@ signals: private slots: void updateActionStatus(); void loadBookmarks(); - void handleBookmarkRequest(TextEditor::ITextEditor * textEditor, + void handleBookmarkRequest(TextEditor::BaseTextEditor * textEditor, int line, - TextEditor::ITextEditor::MarkRequestKind kind); - void handleBookmarkTooltipRequest(TextEditor::ITextEditor *textEditor, + TextEditor::BaseTextEditor::MarkRequestKind kind); + void handleBookmarkTooltipRequest(TextEditor::BaseTextEditor *textEditor, const QPoint &pos, int line); @@ -123,7 +123,7 @@ private: void addBookmark(const QString &s); static QString bookmarkToString(const Bookmark *b); void saveBookmarks(); - void operateTooltip(TextEditor::ITextEditor *textEditor, const QPoint &pos, Bookmark *mark); + void operateTooltip(TextEditor::BaseTextEditor *textEditor, const QPoint &pos, Bookmark *mark); typedef QMultiMap<QString, Bookmark *> FileNameBookmarksMap; typedef QMap<QString, FileNameBookmarksMap *> DirectoryFileBookmarksMap; diff --git a/src/plugins/bookmarks/bookmarksplugin.cpp b/src/plugins/bookmarks/bookmarksplugin.cpp index c4fc525bdb..d1423a0335 100644 --- a/src/plugins/bookmarks/bookmarksplugin.cpp +++ b/src/plugins/bookmarks/bookmarksplugin.cpp @@ -40,7 +40,7 @@ #include <coreplugin/actionmanager/command.h> #include <coreplugin/id.h> #include <extensionsystem/pluginmanager.h> -#include <texteditor/itexteditor.h> +#include <texteditor/basetexteditor.h> #include <texteditor/texteditorconstants.h> #include <QtPlugin> @@ -152,32 +152,32 @@ void BookmarksPlugin::updateActions(int state) void BookmarksPlugin::editorOpened(Core::IEditor *editor) { - if (qobject_cast<ITextEditor *>(editor)) { - connect(editor, SIGNAL(markContextMenuRequested(TextEditor::ITextEditor*,int,QMenu*)), - this, SLOT(requestContextMenu(TextEditor::ITextEditor*,int,QMenu*))); + if (qobject_cast<BaseTextEditor *>(editor)) { + connect(editor, SIGNAL(markContextMenuRequested(TextEditor::BaseTextEditor*,int,QMenu*)), + this, SLOT(requestContextMenu(TextEditor::BaseTextEditor*,int,QMenu*))); connect(editor, - SIGNAL(markRequested(TextEditor::ITextEditor*,int, - TextEditor::ITextEditor::MarkRequestKind)), + SIGNAL(markRequested(TextEditor::BaseTextEditor*,int, + TextEditor::BaseTextEditor::MarkRequestKind)), m_bookmarkManager, - SLOT(handleBookmarkRequest(TextEditor::ITextEditor*,int, - TextEditor::ITextEditor::MarkRequestKind))); + SLOT(handleBookmarkRequest(TextEditor::BaseTextEditor*,int, + TextEditor::BaseTextEditor::MarkRequestKind))); connect(editor, - SIGNAL(markTooltipRequested(TextEditor::ITextEditor*,QPoint,int)), + SIGNAL(markTooltipRequested(TextEditor::BaseTextEditor*,QPoint,int)), m_bookmarkManager, - SLOT(handleBookmarkTooltipRequest(TextEditor::ITextEditor*,QPoint,int))); + SLOT(handleBookmarkTooltipRequest(TextEditor::BaseTextEditor*,QPoint,int))); } } void BookmarksPlugin::editorAboutToClose(Core::IEditor *editor) { - if (qobject_cast<ITextEditor *>(editor)) { - disconnect(editor, SIGNAL(markContextMenuRequested(TextEditor::ITextEditor*,int,QMenu*)), - this, SLOT(requestContextMenu(TextEditor::ITextEditor*,int,QMenu*))); + if (qobject_cast<BaseTextEditor *>(editor)) { + disconnect(editor, SIGNAL(markContextMenuRequested(TextEditor::BaseTextEditor*,int,QMenu*)), + this, SLOT(requestContextMenu(TextEditor::BaseTextEditor*,int,QMenu*))); } } -void BookmarksPlugin::requestContextMenu(TextEditor::ITextEditor *editor, +void BookmarksPlugin::requestContextMenu(TextEditor::BaseTextEditor *editor, int lineNumber, QMenu *menu) { // Don't set bookmarks in disassembler views. diff --git a/src/plugins/bookmarks/bookmarksplugin.h b/src/plugins/bookmarks/bookmarksplugin.h index 63045c42cc..417b4dc1d6 100644 --- a/src/plugins/bookmarks/bookmarksplugin.h +++ b/src/plugins/bookmarks/bookmarksplugin.h @@ -42,7 +42,7 @@ QT_END_NAMESPACE namespace Core { class IEditor; } -namespace TextEditor { class ITextEditor; } +namespace TextEditor { class BaseTextEditor; } namespace Bookmarks { namespace Internal { @@ -67,7 +67,7 @@ public slots: private slots: void editorOpened(Core::IEditor *editor); void editorAboutToClose(Core::IEditor *editor); - void requestContextMenu(TextEditor::ITextEditor *editor, + void requestContextMenu(TextEditor::BaseTextEditor *editor, int lineNumber, QMenu *menu); void bookmarkMarginActionTriggered(); void editBookmarkActionTriggered(); diff --git a/src/plugins/clangcodemodel/clangcompletion.cpp b/src/plugins/clangcodemodel/clangcompletion.cpp index 90ed1d7794..a15b905e6c 100644 --- a/src/plugins/clangcodemodel/clangcompletion.cpp +++ b/src/plugins/clangcodemodel/clangcompletion.cpp @@ -509,7 +509,7 @@ void ClangAssistProposalItem::applyContextualContent(TextEditor::BaseTextEditor } // Avoid inserting characters that are already there - const int endsPosition = editor->position(TextEditor::ITextEditor::EndOfLine); + const int endsPosition = editor->position(TextEditor::BaseTextEditor::EndOfLine); const QString existingText = editor->textDocument()->textAt(editor->position(), endsPosition - editor->position()); int existLength = 0; diff --git a/src/plugins/classview/classviewmanager.cpp b/src/plugins/classview/classviewmanager.cpp index 877f36dc80..09d7796648 100644 --- a/src/plugins/classview/classviewmanager.cpp +++ b/src/plugins/classview/classviewmanager.cpp @@ -41,7 +41,7 @@ #include <coreplugin/progressmanager/progressmanager.h> #include <coreplugin/editormanager/editormanager.h> #include <coreplugin/editormanager/ieditor.h> -#include <texteditor/itexteditor.h> +#include <texteditor/basetexteditor.h> #include <QThread> #include <QMutex> @@ -458,7 +458,7 @@ void Manager::gotoLocations(const QList<QVariant> &list) fileName = document->filePath(); // if text file - what is current position? - TextEditor::ITextEditor *textEditor = qobject_cast<TextEditor::ITextEditor *>(editor); + TextEditor::BaseTextEditor *textEditor = qobject_cast<TextEditor::BaseTextEditor *>(editor); if (textEditor) { // there is open currently text editor int position = textEditor->position(); diff --git a/src/plugins/cmakeprojectmanager/cmakeeditor.cpp b/src/plugins/cmakeprojectmanager/cmakeeditor.cpp index 46c26cdf35..f03d1f30f2 100644 --- a/src/plugins/cmakeprojectmanager/cmakeeditor.cpp +++ b/src/plugins/cmakeprojectmanager/cmakeeditor.cpp @@ -109,7 +109,7 @@ void CMakeEditor::build() QString CMakeEditor::contextHelpId() const { int pos = position(); - TextEditor::ITextEditorDocument* doc = const_cast<CMakeEditor*>(this)->textDocument(); + TextEditor::BaseTextEditorDocument* doc = const_cast<CMakeEditor*>(this)->textDocument(); QChar chr; do { diff --git a/src/plugins/cpaster/cpasterplugin.cpp b/src/plugins/cpaster/cpasterplugin.cpp index 40e487be1f..0baaed7743 100644 --- a/src/plugins/cpaster/cpasterplugin.cpp +++ b/src/plugins/cpaster/cpasterplugin.cpp @@ -50,7 +50,7 @@ #include <coreplugin/messagemanager.h> #include <utils/qtcassert.h> #include <utils/fileutils.h> -#include <texteditor/itexteditor.h> +#include <texteditor/basetexteditor.h> #include <QtPlugin> #include <QDebug> @@ -211,10 +211,10 @@ void CodepasterPlugin::postEditor() const IDocument *document = editor->document(); const QString mimeType = document->mimeType(); QString data; - if (const ITextEditor *textEditor = qobject_cast<const ITextEditor *>(editor)) + if (const BaseTextEditor *textEditor = qobject_cast<const BaseTextEditor *>(editor)) data = textEditor->selectedText(); if (data.isEmpty()) { - if (const ITextEditorDocument *textDocument = qobject_cast<const ITextEditorDocument *>(document)) + if (const BaseTextEditorDocument *textDocument = qobject_cast<const BaseTextEditorDocument *>(document)) data = textDocument->plainText(); } post(data, mimeType); diff --git a/src/plugins/cppeditor/cppeditor.cpp b/src/plugins/cppeditor/cppeditor.cpp index 6507f6d4be..22b1f6ef83 100644 --- a/src/plugins/cppeditor/cppeditor.cpp +++ b/src/plugins/cppeditor/cppeditor.cpp @@ -1054,7 +1054,7 @@ void CPPEditorWidget::onFunctionDeclDefLinkFound(QSharedPointer<FunctionDeclDefL Core::IDocument *targetDocument = Core::DocumentModel::documentForFilePath( d->m_declDefLink->targetFile->fileName()); if (baseTextDocument() != targetDocument) { - if (TextEditor::ITextEditorDocument *textEditorDocument = qobject_cast<TextEditor::ITextEditorDocument *>(targetDocument)) + if (TextEditor::BaseTextEditorDocument *textEditorDocument = qobject_cast<TextEditor::BaseTextEditorDocument *>(targetDocument)) connect(textEditorDocument, SIGNAL(contentsChanged()), this, SLOT(abortDeclDefLink())); } @@ -1103,7 +1103,7 @@ void CPPEditorWidget::abortDeclDefLink() Core::IDocument *targetDocument = Core::DocumentModel::documentForFilePath(d->m_declDefLink->targetFile->fileName()); if (baseTextDocument() != targetDocument) { - if (TextEditor::ITextEditorDocument *textEditorDocument = qobject_cast<TextEditor::ITextEditorDocument *>(targetDocument)) + if (TextEditor::BaseTextEditorDocument *textEditorDocument = qobject_cast<TextEditor::BaseTextEditorDocument *>(targetDocument)) disconnect(textEditorDocument, SIGNAL(contentsChanged()), this, SLOT(abortDeclDefLink())); } diff --git a/src/plugins/cppeditor/cppeditorplugin.h b/src/plugins/cppeditor/cppeditorplugin.h index ec1f6aa8eb..271b6c76c2 100644 --- a/src/plugins/cppeditor/cppeditorplugin.h +++ b/src/plugins/cppeditor/cppeditorplugin.h @@ -37,7 +37,7 @@ #include <QtPlugin> #include <QAction> -namespace TextEditor { class ITextEditor; } +namespace TextEditor { class BaseTextEditor; } namespace CppEditor { namespace Internal { @@ -243,7 +243,7 @@ private: QPointer<CppCodeModelInspectorDialog> m_cppCodeModelInspectorDialog; - QPointer<TextEditor::ITextEditor> m_currentEditor; + QPointer<TextEditor::BaseTextEditor> m_currentEditor; }; class CppEditorFactory : public Core::IEditorFactory diff --git a/src/plugins/cppeditor/cpphoverhandler.cpp b/src/plugins/cppeditor/cpphoverhandler.cpp index a2f10db8a0..c65f8e5387 100644 --- a/src/plugins/cppeditor/cpphoverhandler.cpp +++ b/src/plugins/cppeditor/cpphoverhandler.cpp @@ -54,7 +54,7 @@ bool CppHoverHandler::acceptEditor(IEditor *editor) return editor->document()->id() == CppEditor::Constants::CPPEDITOR_ID; } -void CppHoverHandler::identifyMatch(TextEditor::ITextEditor *editor, int pos) +void CppHoverHandler::identifyMatch(TextEditor::BaseTextEditor *editor, int pos) { using namespace TextEditor; BaseTextEditorWidget *textEditor = qobject_cast<BaseTextEditorWidget *>(editor->widget()); diff --git a/src/plugins/cppeditor/cpphoverhandler.h b/src/plugins/cppeditor/cpphoverhandler.h index b931f88a58..22a97789a1 100644 --- a/src/plugins/cppeditor/cpphoverhandler.h +++ b/src/plugins/cppeditor/cpphoverhandler.h @@ -36,7 +36,7 @@ namespace Core { class IEditor; } -namespace TextEditor { class ITextEditor; } +namespace TextEditor { class BaseTextEditor; } namespace CppEditor { namespace Internal { @@ -50,7 +50,7 @@ public: private: virtual bool acceptEditor(Core::IEditor *editor); - virtual void identifyMatch(TextEditor::ITextEditor *editor, int pos); + virtual void identifyMatch(TextEditor::BaseTextEditor *editor, int pos); virtual void decorateToolTip(); }; diff --git a/src/plugins/cpptools/cppcompletionassist.cpp b/src/plugins/cpptools/cppcompletionassist.cpp index d1f1322223..ab4f0078fc 100644 --- a/src/plugins/cpptools/cppcompletionassist.cpp +++ b/src/plugins/cpptools/cppcompletionassist.cpp @@ -305,7 +305,7 @@ void CppAssistProposalItem::applyContextualContent(TextEditor::BaseTextEditor *e // Determine the length of characters that should just be kept on the editor, but do // not consider content that ends as an identifier (which could be undesired). - const int lineEnd = editor->position(TextEditor::ITextEditor::EndOfLine); + const int lineEnd = editor->position(TextEditor::BaseTextEditor::EndOfLine); const QString inEditor = editor->textDocument()->textAt(editor->position(), lineEnd - editor->position()); int preserveLength = 0; diff --git a/src/plugins/debugger/cdb/cdbengine.cpp b/src/plugins/debugger/cdb/cdbengine.cpp index 9fcc912688..e08afc4b83 100644 --- a/src/plugins/debugger/cdb/cdbengine.cpp +++ b/src/plugins/debugger/cdb/cdbengine.cpp @@ -55,7 +55,7 @@ #include <coreplugin/icore.h> #include <projectexplorer/taskhub.h> -#include <texteditor/itexteditor.h> +#include <texteditor/basetexteditor.h> #include <utils/synchronousprocess.h> #include <utils/qtcprocess.h> @@ -447,7 +447,7 @@ void CdbEngine::syncVerboseLog(bool verboseLog) postCommand(m_verboseLog ? QByteArray("!sym noisy") : QByteArray("!sym quiet"), 0); } -bool CdbEngine::setToolTipExpression(TextEditor::ITextEditor *editor, +bool CdbEngine::setToolTipExpression(TextEditor::BaseTextEditor *editor, const DebuggerToolTipContext &contextIn) { if (debug) diff --git a/src/plugins/debugger/cdb/cdbengine.h b/src/plugins/debugger/cdb/cdbengine.h index 8aad2eec96..b33a0363f2 100644 --- a/src/plugins/debugger/cdb/cdbengine.h +++ b/src/plugins/debugger/cdb/cdbengine.h @@ -76,7 +76,7 @@ public: // Factory function that returns 0 if the debug engine library cannot be found. - virtual bool setToolTipExpression(TextEditor::ITextEditor *editor, + virtual bool setToolTipExpression(TextEditor::BaseTextEditor *editor, const DebuggerToolTipContext &ctx); virtual void setupEngine(); virtual void setupInferior(); diff --git a/src/plugins/debugger/debuggerengine.cpp b/src/plugins/debugger/debuggerengine.cpp index 500b893f46..98808c173b 100644 --- a/src/plugins/debugger/debuggerengine.cpp +++ b/src/plugins/debugger/debuggerengine.cpp @@ -57,7 +57,7 @@ #include <projectexplorer/projectexplorer.h> #include <projectexplorer/taskhub.h> -#include <texteditor/itexteditor.h> +#include <texteditor/basetexteditor.h> #include <utils/savedaction.h> #include <utils/qtcassert.h> @@ -1360,7 +1360,7 @@ DebuggerRunControl *DebuggerEngine::runControl() const return d->runControl(); } -bool DebuggerEngine::setToolTipExpression(TextEditor::ITextEditor *, +bool DebuggerEngine::setToolTipExpression(TextEditor::BaseTextEditor *, const DebuggerToolTipContext &) { return false; diff --git a/src/plugins/debugger/debuggerengine.h b/src/plugins/debugger/debuggerengine.h index 718df1f198..75f6716bc9 100644 --- a/src/plugins/debugger/debuggerengine.h +++ b/src/plugins/debugger/debuggerengine.h @@ -45,7 +45,7 @@ class QMessageBox; class QAbstractItemModel; QT_END_NAMESPACE -namespace TextEditor { class ITextEditor; } +namespace TextEditor { class BaseTextEditor; } namespace Core { class IOptionsPage; } namespace Debugger { @@ -143,7 +143,7 @@ public: const DebuggerStartParameters &startParameters() const; DebuggerStartParameters &startParameters(); - virtual bool setToolTipExpression(TextEditor::ITextEditor *editor, + virtual bool setToolTipExpression(TextEditor::BaseTextEditor *editor, const Internal::DebuggerToolTipContext &); virtual void updateWatchData(const Internal::WatchData &data, diff --git a/src/plugins/debugger/debuggerplugin.cpp b/src/plugins/debugger/debuggerplugin.cpp index 12517615c0..ccc530295f 100644 --- a/src/plugins/debugger/debuggerplugin.cpp +++ b/src/plugins/debugger/debuggerplugin.cpp @@ -690,7 +690,7 @@ bool fillParameters(DebuggerStartParameters *sp, const Kit *kit, QString *errorM static bool currentTextEditorPosition(ContextData *data) { - ITextEditor *textEditor = ITextEditor::currentTextEditor(); + BaseTextEditor *textEditor = BaseTextEditor::currentTextEditor(); if (!textEditor) return false; const IDocument *document = textEditor->document(); @@ -864,10 +864,10 @@ public slots: void editorOpened(Core::IEditor *editor); void updateBreakMenuItem(Core::IEditor *editor); void setBusyCursor(bool busy); - void requestMark(TextEditor::ITextEditor *editor, + void requestMark(TextEditor::BaseTextEditor *editor, int lineNumber, - TextEditor::ITextEditor::MarkRequestKind kind); - void requestContextMenu(TextEditor::ITextEditor *editor, + TextEditor::BaseTextEditor::MarkRequestKind kind); + void requestContextMenu(TextEditor::BaseTextEditor *editor, int lineNumber, QMenu *menu); void activatePreviousMode(); @@ -1060,11 +1060,10 @@ public slots: void handleExecRunToSelectedFunction() { - ITextEditor *textEditor = ITextEditor::currentTextEditor(); + BaseTextEditor *textEditor = BaseTextEditor::currentTextEditor(); QTC_ASSERT(textEditor, return); - QPlainTextEdit *ed = qobject_cast<QPlainTextEdit*>(textEditor->widget()); - if (!ed) - return; + QPlainTextEdit *ed = textEditor->editorWidget(); + QTC_ASSERT(ed, return); QTextCursor cursor = ed->textCursor(); QString functionName = cursor.selectedText(); if (functionName.isEmpty()) { @@ -1132,15 +1131,10 @@ public slots: { // Requires a selection, but that's the only case we want anyway. IEditor *editor = EditorManager::currentEditor(); - if (!editor) - return; - ITextEditor *textEditor = qobject_cast<ITextEditor*>(editor); + BaseTextEditor *textEditor = qobject_cast<BaseTextEditor*>(editor); if (!textEditor) return; - QTextCursor tc; - QPlainTextEdit *ptEdit = qobject_cast<QPlainTextEdit*>(editor->widget()); - if (ptEdit) - tc = ptEdit->textCursor(); + QTextCursor tc = textEditor->editorWidget()->textCursor(); QString exp; if (tc.hasSelection()) { exp = tc.selectedText(); @@ -1900,24 +1894,24 @@ void DebuggerPluginPrivate::runScheduled() void DebuggerPluginPrivate::editorOpened(IEditor *editor) { - ITextEditor *textEditor = qobject_cast<ITextEditor *>(editor); + BaseTextEditor *textEditor = qobject_cast<BaseTextEditor *>(editor); if (!textEditor) return; connect(textEditor, - SIGNAL(markRequested(TextEditor::ITextEditor*,int,TextEditor::ITextEditor::MarkRequestKind)), - SLOT(requestMark(TextEditor::ITextEditor*,int,TextEditor::ITextEditor::MarkRequestKind))); + SIGNAL(markRequested(TextEditor::BaseTextEditor*,int,TextEditor::BaseTextEditor::MarkRequestKind)), + SLOT(requestMark(TextEditor::BaseTextEditor*,int,TextEditor::BaseTextEditor::MarkRequestKind))); connect(textEditor, - SIGNAL(markContextMenuRequested(TextEditor::ITextEditor*,int,QMenu*)), - SLOT(requestContextMenu(TextEditor::ITextEditor*,int,QMenu*))); + SIGNAL(markContextMenuRequested(TextEditor::BaseTextEditor*,int,QMenu*)), + SLOT(requestContextMenu(TextEditor::BaseTextEditor*,int,QMenu*))); } void DebuggerPluginPrivate::updateBreakMenuItem(IEditor *editor) { - ITextEditor *textEditor = qobject_cast<ITextEditor *>(editor); + BaseTextEditor *textEditor = qobject_cast<BaseTextEditor *>(editor); m_breakAction->setEnabled(textEditor != 0); } -void DebuggerPluginPrivate::requestContextMenu(ITextEditor *editor, +void DebuggerPluginPrivate::requestContextMenu(BaseTextEditor *editor, int lineNumber, QMenu *menu) { BreakpointMenuContextData args; @@ -1925,7 +1919,7 @@ void DebuggerPluginPrivate::requestContextMenu(ITextEditor *editor, bool contextUsable = true; BreakpointModelId id = BreakpointModelId(); - ITextEditorDocument *document = editor->textDocument(); + BaseTextEditorDocument *document = editor->textDocument(); args.fileName = document->filePath(); if (document->property(Constants::OPENED_WITH_DISASSEMBLY).toBool()) { QString line = document->plainText() @@ -2037,7 +2031,7 @@ void DebuggerPluginPrivate::requestContextMenu(ITextEditor *editor, void DebuggerPluginPrivate::toggleBreakpoint() { - ITextEditor *textEditor = ITextEditor::currentTextEditor(); + BaseTextEditor *textEditor = BaseTextEditor::currentTextEditor(); QTC_ASSERT(textEditor, return); const int lineNumber = textEditor->currentLine(); if (textEditor->property(Constants::OPENED_WITH_DISASSEMBLY).toBool()) { @@ -2090,11 +2084,11 @@ void DebuggerPluginPrivate::toggleBreakpointByAddress(quint64 address, } } -void DebuggerPluginPrivate::requestMark(ITextEditor *editor, +void DebuggerPluginPrivate::requestMark(BaseTextEditor *editor, int lineNumber, - ITextEditor::MarkRequestKind kind) + BaseTextEditor::MarkRequestKind kind) { - if (kind != ITextEditor::BreakpointRequest) + if (kind != BaseTextEditor::BreakpointRequest) return; if (IDocument *document = editor->document()) { diff --git a/src/plugins/debugger/debuggertooltipmanager.cpp b/src/plugins/debugger/debuggertooltipmanager.cpp index 2b5afab64a..1253a197b7 100644 --- a/src/plugins/debugger/debuggertooltipmanager.cpp +++ b/src/plugins/debugger/debuggertooltipmanager.cpp @@ -1277,8 +1277,8 @@ void DebuggerToolTipManager::slotEditorOpened(IEditor *e) connect(toolTipEditor.widget->verticalScrollBar(), SIGNAL(valueChanged(int)), this, SLOT(slotUpdateVisibleToolTips())); connect(toolTipEditor.editor, - SIGNAL(tooltipOverrideRequested(TextEditor::ITextEditor*,QPoint,int,bool*)), - SLOT(slotTooltipOverrideRequested(TextEditor::ITextEditor*,QPoint,int,bool*))); + SIGNAL(tooltipOverrideRequested(TextEditor::BaseTextEditor*,QPoint,int,bool*)), + SLOT(slotTooltipOverrideRequested(TextEditor::BaseTextEditor*,QPoint,int,bool*))); } } @@ -1324,7 +1324,7 @@ void DebuggerToolTipManager::leavingDebugMode() } void DebuggerToolTipManager::slotTooltipOverrideRequested - (ITextEditor *editor, const QPoint &point, int pos, bool *handled) + (BaseTextEditor *editor, const QPoint &point, int pos, bool *handled) { QTC_ASSERT(handled, return); QTC_ASSERT(editor, return); @@ -1347,7 +1347,7 @@ void DebuggerToolTipManager::slotTooltipOverrideRequested } } -bool DebuggerToolTipManager::tryHandleToolTipOverride(ITextEditor *editor, const QPoint &point, int pos) +bool DebuggerToolTipManager::tryHandleToolTipOverride(BaseTextEditor *editor, const QPoint &point, int pos) { DebuggerCore *core = debuggerCore(); if (!core->boolSetting(UseToolTipsInMainEditor)) diff --git a/src/plugins/debugger/debuggertooltipmanager.h b/src/plugins/debugger/debuggertooltipmanager.h index 2957c9e633..08ed4764cc 100644 --- a/src/plugins/debugger/debuggertooltipmanager.h +++ b/src/plugins/debugger/debuggertooltipmanager.h @@ -41,7 +41,7 @@ class QDebug; QT_END_NAMESPACE namespace Core { class IEditor; } -namespace TextEditor { class ITextEditor; } +namespace TextEditor { class BaseTextEditor; } namespace Debugger { class DebuggerEngine; @@ -132,11 +132,11 @@ private slots: static void slotUpdateVisibleToolTips(); void slotDebuggerStateChanged(Debugger::DebuggerState); void slotEditorOpened(Core::IEditor *); - void slotTooltipOverrideRequested(TextEditor::ITextEditor *editor, + void slotTooltipOverrideRequested(TextEditor::BaseTextEditor *editor, const QPoint &point, int pos, bool *handled); private: - bool tryHandleToolTipOverride(TextEditor::ITextEditor *editor, + bool tryHandleToolTipOverride(TextEditor::BaseTextEditor *editor, const QPoint &point, int pos); }; diff --git a/src/plugins/debugger/gdb/gdbengine.cpp b/src/plugins/debugger/gdb/gdbengine.cpp index e635cbbd45..6096b09d53 100644 --- a/src/plugins/debugger/gdb/gdbengine.cpp +++ b/src/plugins/debugger/gdb/gdbengine.cpp @@ -67,7 +67,7 @@ #include <projectexplorer/devicesupport/deviceprocess.h> #include <projectexplorer/itaskhandler.h> #include <projectexplorer/taskhub.h> -#include <texteditor/itexteditor.h> +#include <texteditor/basetexteditor.h> #include <utils/algorithm.h> #include <utils/hostosinfo.h> #include <utils/qtcassert.h> @@ -3651,7 +3651,7 @@ void GdbEngine::resetLocation() DebuggerEngine::resetLocation(); } -bool GdbEngine::setToolTipExpression(TextEditor::ITextEditor *editor, +bool GdbEngine::setToolTipExpression(TextEditor::BaseTextEditor *editor, const DebuggerToolTipContext &context) { if (state() != InferiorStopOk || !isCppEditor(editor)) { diff --git a/src/plugins/debugger/gdb/gdbengine.h b/src/plugins/debugger/gdb/gdbengine.h index b30e40d5bf..b03682d2e8 100644 --- a/src/plugins/debugger/gdb/gdbengine.h +++ b/src/plugins/debugger/gdb/gdbengine.h @@ -407,7 +407,7 @@ protected: // // Watch specific stuff // - virtual bool setToolTipExpression(TextEditor::ITextEditor *editor, + virtual bool setToolTipExpression(TextEditor::BaseTextEditor *editor, const DebuggerToolTipContext &); virtual void assignValueInDebugger(const WatchData *data, const QString &expr, const QVariant &value); diff --git a/src/plugins/debugger/lldb/lldbengine.cpp b/src/plugins/debugger/lldb/lldbengine.cpp index a66db55f42..dfd9d40acd 100644 --- a/src/plugins/debugger/lldb/lldbengine.cpp +++ b/src/plugins/debugger/lldb/lldbengine.cpp @@ -54,7 +54,7 @@ #include <utils/savedaction.h> #include <utils/qtcprocess.h> -#include <texteditor/itexteditor.h> +#include <texteditor/basetexteditor.h> #include <coreplugin/idocument.h> #include <coreplugin/icore.h> @@ -837,7 +837,7 @@ void LldbEngine::resetLocation() DebuggerEngine::resetLocation(); } -bool LldbEngine::setToolTipExpression(TextEditor::ITextEditor *editor, const DebuggerToolTipContext &context) +bool LldbEngine::setToolTipExpression(TextEditor::BaseTextEditor *editor, const DebuggerToolTipContext &context) { if (state() != InferiorStopOk || !isCppEditor(editor)) { //qDebug() << "SUPPRESSING DEBUGGER TOOLTIP, INFERIOR NOT STOPPED " diff --git a/src/plugins/debugger/lldb/lldbengine.h b/src/plugins/debugger/lldb/lldbengine.h index 38ff85ba82..57ddf51795 100644 --- a/src/plugins/debugger/lldb/lldbengine.h +++ b/src/plugins/debugger/lldb/lldbengine.h @@ -108,7 +108,7 @@ private: void abortDebugger(); void resetLocation(); - bool setToolTipExpression(TextEditor::ITextEditor *editor, + bool setToolTipExpression(TextEditor::BaseTextEditor *editor, const DebuggerToolTipContext &); void continueInferior(); diff --git a/src/plugins/debugger/pdb/pdbengine.cpp b/src/plugins/debugger/pdb/pdbengine.cpp index ea8e04e8dd..7cd72dd46c 100644 --- a/src/plugins/debugger/pdb/pdbengine.cpp +++ b/src/plugins/debugger/pdb/pdbengine.cpp @@ -48,7 +48,7 @@ #include <utils/qtcassert.h> -#include <texteditor/itexteditor.h> +#include <texteditor/basetexteditor.h> #include <coreplugin/idocument.h> #include <coreplugin/icore.h> @@ -452,7 +452,7 @@ static WatchData m_toolTip; static QPoint m_toolTipPos; static QHash<QString, WatchData> m_toolTipCache; -bool PdbEngine::setToolTipExpression(TextEditor::ITextEditor *editor, +bool PdbEngine::setToolTipExpression(TextEditor::BaseTextEditor *editor, const DebuggerToolTipContext &ctx) { Q_UNUSED(editor) diff --git a/src/plugins/debugger/pdb/pdbengine.h b/src/plugins/debugger/pdb/pdbengine.h index bb91567fdf..eddc04796d 100644 --- a/src/plugins/debugger/pdb/pdbengine.h +++ b/src/plugins/debugger/pdb/pdbengine.h @@ -75,7 +75,7 @@ private: void shutdownInferior(); void shutdownEngine(); - bool setToolTipExpression(TextEditor::ITextEditor *editor, + bool setToolTipExpression(TextEditor::BaseTextEditor *editor, const DebuggerToolTipContext &); void continueInferior(); diff --git a/src/plugins/debugger/qml/qmlcppengine.cpp b/src/plugins/debugger/qml/qmlcppengine.cpp index 8cea03a430..439d4bf31c 100644 --- a/src/plugins/debugger/qml/qmlcppengine.cpp +++ b/src/plugins/debugger/qml/qmlcppengine.cpp @@ -35,7 +35,7 @@ #include <debugger/watchhandler.h> #include <utils/qtcassert.h> -#include <texteditor/itexteditor.h> +#include <texteditor/basetexteditor.h> #include <qmljseditor/qmljseditorconstants.h> #include <cppeditor/cppeditorconstants.h> #include <qmljs/consolemanagerinterface.h> @@ -89,7 +89,7 @@ bool QmlCppEngine::canDisplayTooltip() const return m_cppEngine->canDisplayTooltip() || m_qmlEngine->canDisplayTooltip(); } -bool QmlCppEngine::setToolTipExpression(TextEditor::ITextEditor *editor, const DebuggerToolTipContext &ctx) +bool QmlCppEngine::setToolTipExpression(TextEditor::BaseTextEditor *editor, const DebuggerToolTipContext &ctx) { QTC_ASSERT(editor, return false); bool success = false; diff --git a/src/plugins/debugger/qml/qmlcppengine.h b/src/plugins/debugger/qml/qmlcppengine.h index 5320fe3ed7..10256ff168 100644 --- a/src/plugins/debugger/qml/qmlcppengine.h +++ b/src/plugins/debugger/qml/qmlcppengine.h @@ -46,7 +46,7 @@ public: ~QmlCppEngine(); bool canDisplayTooltip() const; - bool setToolTipExpression(TextEditor::ITextEditor *editor, + bool setToolTipExpression(TextEditor::BaseTextEditor *editor, const DebuggerToolTipContext &); void updateWatchData(const WatchData &data, const WatchUpdateFlags &flags); diff --git a/src/plugins/debugger/qml/qmlengine.cpp b/src/plugins/debugger/qml/qmlengine.cpp index c36ec7cb4a..8356d48c36 100644 --- a/src/plugins/debugger/qml/qmlengine.cpp +++ b/src/plugins/debugger/qml/qmlengine.cpp @@ -54,6 +54,7 @@ #include <utils/qtcassert.h> #include <texteditor/basetextdocument.h> +#include <texteditor/basetexteditor.h> #include <coreplugin/editormanager/editormanager.h> #include <coreplugin/helpmanager.h> #include <coreplugin/icore.h> @@ -341,9 +342,9 @@ QmlEngine::~QmlEngine() { QList<Core::IEditor *> editorsToClose; - QHash<QString, QWeakPointer<TextEditor::ITextEditor> >::iterator iter; + QHash<QString, QWeakPointer<TextEditor::BaseTextEditor> >::iterator iter; for (iter = m_sourceEditors.begin(); iter != m_sourceEditors.end(); ++iter) { - QWeakPointer<TextEditor::ITextEditor> textEditPtr = iter.value(); + QWeakPointer<TextEditor::BaseTextEditor> textEditPtr = iter.value(); if (textEditPtr) editorsToClose << textEditPtr.data(); } @@ -983,7 +984,7 @@ void QmlEngine::requestModuleSymbols(const QString &moduleName) // ////////////////////////////////////////////////////////////////////// -bool QmlEngine::setToolTipExpression(TextEditor::ITextEditor *editor, +bool QmlEngine::setToolTipExpression(TextEditor::BaseTextEditor *editor, const DebuggerToolTipContext &ctx) { // This is processed by QML inspector, which has dependencies to diff --git a/src/plugins/debugger/qml/qmlengine.h b/src/plugins/debugger/qml/qmlengine.h index cb0e9d6a85..c0fbab6740 100644 --- a/src/plugins/debugger/qml/qmlengine.h +++ b/src/plugins/debugger/qml/qmlengine.h @@ -89,7 +89,7 @@ public: signals: void tooltipRequested(const QPoint &mousePos, - TextEditor::ITextEditor *editor, int cursorPos); + TextEditor::BaseTextEditor *editor, int cursorPos); void aboutToNotifyInferiorSetupOk(); private slots: @@ -128,7 +128,7 @@ private: void shutdownInferior(); void shutdownEngine(); - bool setToolTipExpression(TextEditor::ITextEditor *editor, + bool setToolTipExpression(TextEditor::BaseTextEditor *editor, const DebuggerToolTipContext &); void continueInferior(); @@ -190,7 +190,7 @@ private: QTimer m_noDebugOutputTimer; QmlDebug::QmlOutputParser m_outputParser; QHash<QString, QTextDocument*> m_sourceDocuments; - QHash<QString, QWeakPointer<TextEditor::ITextEditor> > m_sourceEditors; + QHash<QString, QWeakPointer<TextEditor::BaseTextEditor> > m_sourceEditors; InteractiveInterpreter m_interpreter; QHash<QString,BreakpointModelId> pendingBreakpoints; QList<quint32> queryIds; diff --git a/src/plugins/debugger/sourceutils.cpp b/src/plugins/debugger/sourceutils.cpp index 5c6bf31860..975ac007a6 100644 --- a/src/plugins/debugger/sourceutils.cpp +++ b/src/plugins/debugger/sourceutils.cpp @@ -323,7 +323,7 @@ bool isCppEditor(Core::IEditor *editor) } // Return the Cpp expression, and, if desired, the function -QString cppExpressionAt(TextEditor::ITextEditor *editor, int pos, +QString cppExpressionAt(TextEditor::BaseTextEditor *editor, int pos, int *line, int *column, QString *function /* = 0 */) { using namespace CppTools; diff --git a/src/plugins/debugger/sourceutils.h b/src/plugins/debugger/sourceutils.h index 6882c6ce99..cce80ac6eb 100644 --- a/src/plugins/debugger/sourceutils.h +++ b/src/plugins/debugger/sourceutils.h @@ -32,7 +32,7 @@ #include <QString> -namespace TextEditor { class ITextEditor; } +namespace TextEditor { class BaseTextEditor; } namespace Core { class IEditor; } namespace CPlusPlus { class Snapshot; } @@ -41,7 +41,7 @@ namespace Internal { // Editor tooltip support bool isCppEditor(Core::IEditor *editor); -QString cppExpressionAt(TextEditor::ITextEditor *editor, int pos, +QString cppExpressionAt(TextEditor::BaseTextEditor *editor, int pos, int *line, int *column, QString *function = 0); QString fixCppExpression(const QString &exp); QString cppFunctionAt(const QString &fileName, int line); diff --git a/src/plugins/designer/qtcreatorintegration.cpp b/src/plugins/designer/qtcreatorintegration.cpp index 7d6809fb55..d5060a8c7f 100644 --- a/src/plugins/designer/qtcreatorintegration.cpp +++ b/src/plugins/designer/qtcreatorintegration.cpp @@ -276,9 +276,9 @@ static Document::Ptr findDefinition(Function *functionDeclaration, int *line) return Document::Ptr(); } -static inline ITextEditor *editableAt(const QString &fileName, int line, int column) +static inline BaseTextEditor *editorAt(const QString &fileName, int line, int column) { - return qobject_cast<ITextEditor *>(Core::EditorManager::openEditorAt(fileName, line, column, + return qobject_cast<BaseTextEditor *>(Core::EditorManager::openEditorAt(fileName, line, column, Core::Id(), Core::EditorManager::DoNotMakeVisible)); } @@ -301,15 +301,15 @@ static void addDeclaration(const Snapshot &snapshot, //! \todo change this to use the Refactoring changes. // - if (ITextEditor *editable = editableAt(fileName, loc.line(), loc.column() - 1)) { - BaseTextEditorWidget *editor = qobject_cast<BaseTextEditorWidget *>(editable->widget()); - if (editor) { - QTextCursor tc = editor->textCursor(); + if (BaseTextEditor *editor = editorAt(fileName, loc.line(), loc.column() - 1)) { + BaseTextEditorWidget *widget = editor->editorWidget(); + if (widget) { + QTextCursor tc = widget->textCursor(); int pos = tc.position(); tc.beginEditBlock(); tc.insertText(loc.prefix() + declaration + loc.suffix()); tc.setPosition(pos, QTextCursor::KeepAnchor); - editor->baseTextDocument()->autoIndent(tc); + widget->baseTextDocument()->autoIndent(tc); tc.endEditBlock(); } } @@ -344,17 +344,17 @@ static Document::Ptr addDefinition(const Snapshot &docTable, //! \todo change this to use the Refactoring changes. // - if (ITextEditor *editable = editableAt(doc->fileName(), 0, 0)) { + if (BaseTextEditor *editor = editorAt(doc->fileName(), 0, 0)) { // //! \todo use the InsertionPointLocator to insert at the correct place. // (we'll have to extend that class first to do definition insertions) - const QString contents = editable->textDocument()->plainText(); + const QString contents = editor->textDocument()->plainText(); int column; - editable->convertPosition(contents.length(), line, &column); - editable->gotoLine(*line, column); - editable->insert(definition); + editor->convertPosition(contents.length(), line, &column); + editor->gotoLine(*line, column); + editor->insert(definition); *line += 1; } return doc; diff --git a/src/plugins/diffeditor/sidebysidediffeditorwidget.cpp b/src/plugins/diffeditor/sidebysidediffeditorwidget.cpp index a8086227f6..5ca731a0df 100644 --- a/src/plugins/diffeditor/sidebysidediffeditorwidget.cpp +++ b/src/plugins/diffeditor/sidebysidediffeditorwidget.cpp @@ -82,12 +82,12 @@ public: : BaseTextEditor(editorWidget) { document()->setId("DiffEditor.SideDiffEditor"); - connect(this, SIGNAL(tooltipRequested(TextEditor::ITextEditor*,QPoint,int)), - this, SLOT(slotTooltipRequested(TextEditor::ITextEditor*,QPoint,int))); + connect(this, SIGNAL(tooltipRequested(TextEditor::BaseTextEditor*,QPoint,int)), + this, SLOT(slotTooltipRequested(TextEditor::BaseTextEditor*,QPoint,int))); } private slots: - void slotTooltipRequested(TextEditor::ITextEditor *editor, + void slotTooltipRequested(TextEditor::BaseTextEditor *editor, const QPoint &globalPoint, int position); @@ -210,7 +210,7 @@ private: //////////////////////// -void SideDiffEditor::slotTooltipRequested(TextEditor::ITextEditor *editor, +void SideDiffEditor::slotTooltipRequested(TextEditor::BaseTextEditor *editor, const QPoint &globalPoint, int position) { diff --git a/src/plugins/glsleditor/glsleditorplugin.cpp b/src/plugins/glsleditor/glsleditorplugin.cpp index a8ecc37659..8dbcf99044 100644 --- a/src/plugins/glsleditor/glsleditorplugin.cpp +++ b/src/plugins/glsleditor/glsleditorplugin.cpp @@ -95,7 +95,7 @@ public: } GLSLEditorFactory *m_editor; - QPointer<TextEditor::ITextEditor> m_currentTextEditable; + QPointer<TextEditor::BaseTextEditor> m_currentTextEditable; GLSLEditorPlugin::InitFile *m_glsl_120_frag; GLSLEditorPlugin::InitFile *m_glsl_120_vert; diff --git a/src/plugins/glsleditor/glslhoverhandler.cpp b/src/plugins/glsleditor/glslhoverhandler.cpp index 6731568b3f..0d66d51fea 100644 --- a/src/plugins/glsleditor/glslhoverhandler.cpp +++ b/src/plugins/glsleditor/glslhoverhandler.cpp @@ -35,7 +35,6 @@ #include <coreplugin/editormanager/editormanager.h> #include <coreplugin/helpmanager.h> #include <extensionsystem/pluginmanager.h> -#include <texteditor/itexteditor.h> #include <texteditor/basetexteditor.h> #include <QTextCursor> @@ -58,7 +57,7 @@ bool GLSLHoverHandler::acceptEditor(IEditor *editor) return false; } -void GLSLHoverHandler::identifyMatch(TextEditor::ITextEditor *editor, int pos) +void GLSLHoverHandler::identifyMatch(TextEditor::BaseTextEditor *editor, int pos) { if (GLSLTextEditorWidget *glslEditor = qobject_cast<GLSLTextEditorWidget *>(editor->widget())) { if (! glslEditor->extraSelectionTooltip(pos).isEmpty()) diff --git a/src/plugins/glsleditor/glslhoverhandler.h b/src/plugins/glsleditor/glslhoverhandler.h index 843d2417c3..dc65a6e147 100644 --- a/src/plugins/glsleditor/glslhoverhandler.h +++ b/src/plugins/glsleditor/glslhoverhandler.h @@ -36,7 +36,7 @@ namespace Core { class IEditor; } -namespace TextEditor { class ITextEditor; } +namespace TextEditor { class BaseTextEditor; } namespace GLSLEditor { namespace Internal { @@ -50,7 +50,7 @@ public: private: virtual bool acceptEditor(Core::IEditor *editor); - virtual void identifyMatch(TextEditor::ITextEditor *editor, int pos); + virtual void identifyMatch(TextEditor::BaseTextEditor *editor, int pos); virtual void decorateToolTip(); }; diff --git a/src/plugins/macros/texteditormacrohandler.cpp b/src/plugins/macros/texteditormacrohandler.cpp index fbbf8eb87f..54b4134df1 100644 --- a/src/plugins/macros/texteditormacrohandler.cpp +++ b/src/plugins/macros/texteditormacrohandler.cpp @@ -31,7 +31,7 @@ #include "macroevent.h" #include "macro.h" -#include <texteditor/itexteditor.h> +#include <texteditor/basetexteditor.h> #include <texteditor/texteditorconstants.h> #include <coreplugin/icore.h> @@ -135,7 +135,7 @@ void TextEditorMacroHandler::changeEditor(Core::IEditor *editor) if (isRecording() && m_currentEditor && m_currentEditor->widget()) m_currentEditor->widget()->removeEventFilter(this); - m_currentEditor = qobject_cast<TextEditor::ITextEditor *>(editor); + m_currentEditor = qobject_cast<TextEditor::BaseTextEditor *>(editor); if (isRecording() && m_currentEditor && m_currentEditor->widget()) m_currentEditor->widget()->installEventFilter(this); } diff --git a/src/plugins/macros/texteditormacrohandler.h b/src/plugins/macros/texteditormacrohandler.h index ec37106a56..e7014fdb1a 100644 --- a/src/plugins/macros/texteditormacrohandler.h +++ b/src/plugins/macros/texteditormacrohandler.h @@ -34,7 +34,7 @@ namespace Core { class IEditor; } -namespace TextEditor { class ITextEditor; } +namespace TextEditor { class BaseTextEditor; } namespace Macros { namespace Internal { @@ -59,7 +59,7 @@ public slots: void closeEditor(Core::IEditor *editor); private: - TextEditor::ITextEditor *m_currentEditor; + TextEditor::BaseTextEditor *m_currentEditor; }; } // namespace Internal diff --git a/src/plugins/projectexplorer/allprojectsfind.cpp b/src/plugins/projectexplorer/allprojectsfind.cpp index f3483e6719..7b8d047354 100644 --- a/src/plugins/projectexplorer/allprojectsfind.cpp +++ b/src/plugins/projectexplorer/allprojectsfind.cpp @@ -34,7 +34,7 @@ #include "projectexplorer.h" #include "editorconfiguration.h" -#include <texteditor/itexteditor.h> +#include <texteditor/basetexteditor.h> #include <utils/filesearch.h> #include <utils/algorithm.h> @@ -84,7 +84,7 @@ Utils::FileIterator *AllProjectsFind::filesForProjects(const QStringList &nameFi filterRegs << QRegExp(filter, Qt::CaseInsensitive, QRegExp::Wildcard); } QMap<QString, QTextCodec *> openEditorEncodings - = TextEditor::ITextEditorDocument::openedTextDocumentEncodings(); + = TextEditor::BaseTextEditorDocument::openedTextDocumentEncodings(); QMap<QString, QTextCodec *> encodings; foreach (const Project *project, projects) { QStringList projectFiles = project->files(Project::AllFiles); diff --git a/src/plugins/projectexplorer/editorconfiguration.cpp b/src/plugins/projectexplorer/editorconfiguration.cpp index eea1b04b19..2358920a2c 100644 --- a/src/plugins/projectexplorer/editorconfiguration.cpp +++ b/src/plugins/projectexplorer/editorconfiguration.cpp @@ -246,23 +246,23 @@ void EditorConfiguration::fromMap(const QVariantMap &map) d->m_marginSettings.fromMap(kPrefix, map); } -void EditorConfiguration::configureEditor(ITextEditor *textEditor) const +void EditorConfiguration::configureEditor(BaseTextEditor *textEditor) const { - BaseTextEditorWidget *baseTextEditor = qobject_cast<BaseTextEditorWidget *>(textEditor->widget()); - if (baseTextEditor) - baseTextEditor->setCodeStyle(codeStyle(baseTextEditor->languageSettingsId())); + BaseTextEditorWidget *widget = textEditor->editorWidget(); + if (widget) + widget->setCodeStyle(codeStyle(widget->languageSettingsId())); if (!d->m_useGlobal) { textEditor->textDocument()->setCodec(d->m_textCodec); - if (baseTextEditor) - switchSettings(baseTextEditor); + if (widget) + switchSettings(widget); } } -void EditorConfiguration::deconfigureEditor(ITextEditor *textEditor) const +void EditorConfiguration::deconfigureEditor(BaseTextEditor *textEditor) const { - BaseTextEditorWidget *baseTextEditor = qobject_cast<BaseTextEditorWidget *>(textEditor->widget()); - if (baseTextEditor) - baseTextEditor->setCodeStyle(TextEditorSettings::codeStyle(baseTextEditor->languageSettingsId())); + BaseTextEditorWidget *widget = textEditor->editorWidget(); + if (widget) + widget->setCodeStyle(TextEditorSettings::codeStyle(widget->languageSettingsId())); // TODO: what about text codec and switching settings? } @@ -273,56 +273,56 @@ void EditorConfiguration::setUseGlobalSettings(bool use) d->m_defaultCodeStyle->setCurrentDelegate(d->m_useGlobal ? TextEditorSettings::codeStyle() : 0); foreach (Core::IEditor *editor, Core::DocumentModel::editorsForOpenedDocuments()) { - if (BaseTextEditorWidget *baseTextEditor = qobject_cast<BaseTextEditorWidget *>(editor->widget())) { + if (BaseTextEditorWidget *widget = qobject_cast<BaseTextEditorWidget *>(editor->widget())) { Project *project = SessionManager::projectForFile(editor->document()->filePath()); if (project && project->editorConfiguration() == this) - switchSettings(baseTextEditor); + switchSettings(widget); } } } static void switchSettings_helper(const QObject *newSender, const QObject *oldSender, - BaseTextEditorWidget *baseTextEditor) + BaseTextEditorWidget *widget) { QObject::disconnect(oldSender, SIGNAL(marginSettingsChanged(TextEditor::MarginSettings)), - baseTextEditor, SLOT(setMarginSettings(TextEditor::MarginSettings))); + widget, SLOT(setMarginSettings(TextEditor::MarginSettings))); QObject::disconnect(oldSender, SIGNAL(typingSettingsChanged(TextEditor::TypingSettings)), - baseTextEditor, SLOT(setTypingSettings(TextEditor::TypingSettings))); + widget, SLOT(setTypingSettings(TextEditor::TypingSettings))); QObject::disconnect(oldSender, SIGNAL(storageSettingsChanged(TextEditor::StorageSettings)), - baseTextEditor, SLOT(setStorageSettings(TextEditor::StorageSettings))); + widget, SLOT(setStorageSettings(TextEditor::StorageSettings))); QObject::disconnect(oldSender, SIGNAL(behaviorSettingsChanged(TextEditor::BehaviorSettings)), - baseTextEditor, SLOT(setBehaviorSettings(TextEditor::BehaviorSettings))); + widget, SLOT(setBehaviorSettings(TextEditor::BehaviorSettings))); QObject::disconnect(oldSender, SIGNAL(extraEncodingSettingsChanged(TextEditor::ExtraEncodingSettings)), - baseTextEditor, SLOT(setExtraEncodingSettings(TextEditor::ExtraEncodingSettings))); + widget, SLOT(setExtraEncodingSettings(TextEditor::ExtraEncodingSettings))); QObject::connect(newSender, SIGNAL(marginSettingsChanged(TextEditor::MarginSettings)), - baseTextEditor, SLOT(setMarginSettings(TextEditor::MarginSettings))); + widget, SLOT(setMarginSettings(TextEditor::MarginSettings))); QObject::connect(newSender, SIGNAL(typingSettingsChanged(TextEditor::TypingSettings)), - baseTextEditor, SLOT(setTypingSettings(TextEditor::TypingSettings))); + widget, SLOT(setTypingSettings(TextEditor::TypingSettings))); QObject::connect(newSender, SIGNAL(storageSettingsChanged(TextEditor::StorageSettings)), - baseTextEditor, SLOT(setStorageSettings(TextEditor::StorageSettings))); + widget, SLOT(setStorageSettings(TextEditor::StorageSettings))); QObject::connect(newSender, SIGNAL(behaviorSettingsChanged(TextEditor::BehaviorSettings)), - baseTextEditor, SLOT(setBehaviorSettings(TextEditor::BehaviorSettings))); + widget, SLOT(setBehaviorSettings(TextEditor::BehaviorSettings))); QObject::connect(newSender, SIGNAL(extraEncodingSettingsChanged(TextEditor::ExtraEncodingSettings)), - baseTextEditor, SLOT(setExtraEncodingSettings(TextEditor::ExtraEncodingSettings))); + widget, SLOT(setExtraEncodingSettings(TextEditor::ExtraEncodingSettings))); } -void EditorConfiguration::switchSettings(BaseTextEditorWidget *baseTextEditor) const +void EditorConfiguration::switchSettings(BaseTextEditorWidget *widget) const { if (d->m_useGlobal) { - baseTextEditor->setMarginSettings(TextEditorSettings::marginSettings()); - baseTextEditor->setTypingSettings(TextEditorSettings::typingSettings()); - baseTextEditor->setStorageSettings(TextEditorSettings::storageSettings()); - baseTextEditor->setBehaviorSettings(TextEditorSettings::behaviorSettings()); - baseTextEditor->setExtraEncodingSettings(TextEditorSettings::extraEncodingSettings()); - switchSettings_helper(TextEditorSettings::instance(), this, baseTextEditor); + widget->setMarginSettings(TextEditorSettings::marginSettings()); + widget->setTypingSettings(TextEditorSettings::typingSettings()); + widget->setStorageSettings(TextEditorSettings::storageSettings()); + widget->setBehaviorSettings(TextEditorSettings::behaviorSettings()); + widget->setExtraEncodingSettings(TextEditorSettings::extraEncodingSettings()); + switchSettings_helper(TextEditorSettings::instance(), this, widget); } else { - baseTextEditor->setMarginSettings(marginSettings()); - baseTextEditor->setTypingSettings(typingSettings()); - baseTextEditor->setStorageSettings(storageSettings()); - baseTextEditor->setBehaviorSettings(behaviorSettings()); - baseTextEditor->setExtraEncodingSettings(extraEncodingSettings()); - switchSettings_helper(this, TextEditorSettings::instance(), baseTextEditor); + widget->setMarginSettings(marginSettings()); + widget->setTypingSettings(typingSettings()); + widget->setStorageSettings(storageSettings()); + widget->setBehaviorSettings(behaviorSettings()); + widget->setExtraEncodingSettings(extraEncodingSettings()); + switchSettings_helper(this, TextEditorSettings::instance(), widget); } } @@ -385,7 +385,7 @@ void EditorConfiguration::slotAboutToRemoveProject(ProjectExplorer::Project *pro return; foreach (Core::IEditor *editor, Core::DocumentModel::editorsForOpenedDocuments()) { - if (TextEditor::ITextEditor *textEditor = qobject_cast<TextEditor::ITextEditor*>(editor)) { + if (TextEditor::BaseTextEditor *textEditor = qobject_cast<TextEditor::BaseTextEditor*>(editor)) { Core::IDocument *document = editor->document(); if (document) { Project *editorProject = SessionManager::projectForFile(document->filePath()); diff --git a/src/plugins/projectexplorer/editorconfiguration.h b/src/plugins/projectexplorer/editorconfiguration.h index ef8b61c272..71e825df16 100644 --- a/src/plugins/projectexplorer/editorconfiguration.h +++ b/src/plugins/projectexplorer/editorconfiguration.h @@ -38,7 +38,7 @@ namespace Core { class Id; } namespace TextEditor { -class ITextEditor; +class BaseTextEditor; class BaseTextEditorWidget; class BaseTextDocument; class TabSettings; @@ -80,8 +80,8 @@ public: TextEditor::ICodeStylePreferences *codeStyle(Core::Id languageId) const; QMap<Core::Id, TextEditor::ICodeStylePreferences *> codeStyles() const; - void configureEditor(TextEditor::ITextEditor *textEditor) const; - void deconfigureEditor(TextEditor::ITextEditor *textEditor) const; + void configureEditor(TextEditor::BaseTextEditor *textEditor) const; + void deconfigureEditor(TextEditor::BaseTextEditor *textEditor) const; QVariantMap toMap() const; void fromMap(const QVariantMap &map); diff --git a/src/plugins/projectexplorer/session.cpp b/src/plugins/projectexplorer/session.cpp index fd7360de42..c69d8cc054 100644 --- a/src/plugins/projectexplorer/session.cpp +++ b/src/plugins/projectexplorer/session.cpp @@ -42,7 +42,7 @@ #include <coreplugin/progressmanager/progressmanager.h> #include <coreplugin/modemanager.h> -#include <texteditor/itexteditor.h> +#include <texteditor/basetexteditor.h> #include <utils/algorithm.h> #include <utils/stylehelper.h> @@ -572,7 +572,7 @@ bool SessionManagerPrivate::projectContainsFile(Project *p, const QString &fileN void SessionManager::configureEditor(Core::IEditor *editor, const QString &fileName) { - if (TextEditor::ITextEditor *textEditor = qobject_cast<TextEditor::ITextEditor*>(editor)) { + if (TextEditor::BaseTextEditor *textEditor = qobject_cast<TextEditor::BaseTextEditor*>(editor)) { Project *project = projectForFile(fileName); // Global settings are the default. if (project) diff --git a/src/plugins/qmakeprojectmanager/profilehoverhandler.cpp b/src/plugins/qmakeprojectmanager/profilehoverhandler.cpp index d4fdac0bcf..ee9a37f502 100644 --- a/src/plugins/qmakeprojectmanager/profilehoverhandler.cpp +++ b/src/plugins/qmakeprojectmanager/profilehoverhandler.cpp @@ -61,7 +61,7 @@ bool ProFileHoverHandler::acceptEditor(IEditor *editor) return false; } -void ProFileHoverHandler::identifyMatch(TextEditor::ITextEditor *editor, int pos) +void ProFileHoverHandler::identifyMatch(TextEditor::BaseTextEditor *editor, int pos) { m_docFragment.clear(); m_manualKind = UnknownManual; diff --git a/src/plugins/qmakeprojectmanager/profilehoverhandler.h b/src/plugins/qmakeprojectmanager/profilehoverhandler.h index 77e05e66ad..547440a5e6 100644 --- a/src/plugins/qmakeprojectmanager/profilehoverhandler.h +++ b/src/plugins/qmakeprojectmanager/profilehoverhandler.h @@ -41,7 +41,7 @@ QT_END_NAMESPACE namespace Core { class IEditor; } -namespace TextEditor { class ITextEditor; } +namespace TextEditor { class BaseTextEditor; } namespace QmakeProjectManager { namespace Internal { @@ -58,7 +58,7 @@ signals: private: virtual bool acceptEditor(Core::IEditor *editor); - virtual void identifyMatch(TextEditor::ITextEditor *editor, int pos); + virtual void identifyMatch(TextEditor::BaseTextEditor *editor, int pos); void identifyQMakeKeyword(const QString &text, int pos); enum ManualKind { diff --git a/src/plugins/qmakeprojectmanager/qmakeprojectmanager.cpp b/src/plugins/qmakeprojectmanager/qmakeprojectmanager.cpp index 3e07a3da32..d6a6b6aa75 100644 --- a/src/plugins/qmakeprojectmanager/qmakeprojectmanager.cpp +++ b/src/plugins/qmakeprojectmanager/qmakeprojectmanager.cpp @@ -157,7 +157,7 @@ void QmakeManager::addLibrary(const QString &fileName, ProFileEditor *editor) if (!editor) return; - const int endOfDoc = editor->position(TextEditor::ITextEditor::EndOfDoc); + const int endOfDoc = editor->position(TextEditor::BaseTextEditor::EndOfDoc); editor->setCursorPosition(endOfDoc); QString snippet = wizard.snippet(); diff --git a/src/plugins/qmldesigner/components/integration/designdocument.cpp b/src/plugins/qmldesigner/components/integration/designdocument.cpp index 737cabc1fc..beee3b46d5 100644 --- a/src/plugins/qmldesigner/components/integration/designdocument.cpp +++ b/src/plugins/qmldesigner/components/integration/designdocument.cpp @@ -590,9 +590,9 @@ Core::IEditor *DesignDocument::editor() const return m_textEditor.data(); } -TextEditor::ITextEditor *DesignDocument::textEditor() const +TextEditor::BaseTextEditor *DesignDocument::textEditor() const { - return qobject_cast<TextEditor::ITextEditor*>(editor()); + return qobject_cast<TextEditor::BaseTextEditor*>(editor()); } QPlainTextEdit *DesignDocument::plainTextEdit() const diff --git a/src/plugins/qmldesigner/components/integration/designdocument.h b/src/plugins/qmldesigner/components/integration/designdocument.h index 4828b79b25..30dfeac1f3 100644 --- a/src/plugins/qmldesigner/components/integration/designdocument.h +++ b/src/plugins/qmldesigner/components/integration/designdocument.h @@ -93,7 +93,7 @@ public: void setEditor(Core::IEditor *editor); Core::IEditor *editor() const; - TextEditor::ITextEditor *textEditor() const; + TextEditor::BaseTextEditor *textEditor() const; QPlainTextEdit *plainTextEdit() const; QString fileName() const; ProjectExplorer::Kit *currentKit() const; diff --git a/src/plugins/qmldesigner/designmodewidget.cpp b/src/plugins/qmldesigner/designmodewidget.cpp index 1e06ca5ad9..342aae4f00 100644 --- a/src/plugins/qmldesigner/designmodewidget.cpp +++ b/src/plugins/qmldesigner/designmodewidget.cpp @@ -288,7 +288,7 @@ void DesignModeWidget::updateErrorStatus(const QList<RewriterView::Error> &error } } -TextEditor::ITextEditor *DesignModeWidget::textEditor() const +TextEditor::BaseTextEditor *DesignModeWidget::textEditor() const { return currentDesignDocument()->textEditor(); } diff --git a/src/plugins/qmldesigner/designmodewidget.h b/src/plugins/qmldesigner/designmodewidget.h index 73d872ce98..3569b541f3 100644 --- a/src/plugins/qmldesigner/designmodewidget.h +++ b/src/plugins/qmldesigner/designmodewidget.h @@ -99,7 +99,7 @@ public: void readSettings(); void saveSettings(); - TextEditor::ITextEditor *textEditor() const; + TextEditor::BaseTextEditor *textEditor() const; DesignDocument *currentDesignDocument() const; ViewManager &viewManager(); diff --git a/src/plugins/qmljseditor/qmljseditorplugin.h b/src/plugins/qmljseditor/qmljseditorplugin.h index 6caebaba77..aac9959e89 100644 --- a/src/plugins/qmljseditor/qmljseditorplugin.h +++ b/src/plugins/qmljseditor/qmljseditorplugin.h @@ -47,7 +47,7 @@ class ActionManager; class IEditor; } -namespace TextEditor { class ITextEditor; } +namespace TextEditor { class BaseTextEditor; } namespace QmlJS { class ModelManagerInterface; } diff --git a/src/plugins/qmljseditor/qmljshoverhandler.cpp b/src/plugins/qmljseditor/qmljshoverhandler.cpp index b632de221e..90333eea2d 100644 --- a/src/plugins/qmljseditor/qmljshoverhandler.cpp +++ b/src/plugins/qmljseditor/qmljshoverhandler.cpp @@ -45,7 +45,6 @@ #include <qmljs/parser/qmljsastfwd_p.h> #include <qmljs/qmljsutils.h> #include <qmljs/qmljsqrcparser.h> -#include <texteditor/itexteditor.h> #include <texteditor/basetexteditor.h> #include <texteditor/helpitem.h> #include <utils/tooltip/tooltip.h> @@ -184,7 +183,7 @@ bool HoverHandler::setQmlTypeHelp(const ScopeChain &scopeChain, const Document:: return true; } -void HoverHandler::identifyMatch(TextEditor::ITextEditor *editor, int pos) +void HoverHandler::identifyMatch(TextEditor::BaseTextEditor *editor, int pos) { reset(); @@ -377,7 +376,7 @@ void HoverHandler::reset() m_colorTip = QColor(); } -void HoverHandler::operateTooltip(TextEditor::ITextEditor *editor, const QPoint &point) +void HoverHandler::operateTooltip(TextEditor::BaseTextEditor *editor, const QPoint &point) { if (toolTip().isEmpty()) Utils::ToolTip::hide(); diff --git a/src/plugins/qmljseditor/qmljshoverhandler.h b/src/plugins/qmljseditor/qmljshoverhandler.h index ced89f1c5b..bbc3cc2d59 100644 --- a/src/plugins/qmljseditor/qmljshoverhandler.h +++ b/src/plugins/qmljseditor/qmljshoverhandler.h @@ -41,7 +41,7 @@ QT_END_NAMESPACE namespace Core { class IEditor; } -namespace TextEditor { class ITextEditor; } +namespace TextEditor { class BaseTextEditor; } namespace QmlJS { class ScopeChain; @@ -67,8 +67,8 @@ private: void reset(); virtual bool acceptEditor(Core::IEditor *editor); - virtual void identifyMatch(TextEditor::ITextEditor *editor, int pos); - virtual void operateTooltip(TextEditor::ITextEditor *editor, const QPoint &point); + virtual void identifyMatch(TextEditor::BaseTextEditor *editor, int pos); + virtual void operateTooltip(TextEditor::BaseTextEditor *editor, const QPoint &point); bool matchDiagnosticMessage(QmlJSTextEditorWidget *qmlEditor, int pos); bool matchColorItem(const QmlJS::ScopeChain &lookupContext, diff --git a/src/plugins/qmlprofiler/qmlprofilertool.cpp b/src/plugins/qmlprofiler/qmlprofilertool.cpp index 0ff0fc9113..5af5ffc07d 100644 --- a/src/plugins/qmlprofiler/qmlprofilertool.cpp +++ b/src/plugins/qmlprofiler/qmlprofilertool.cpp @@ -51,7 +51,7 @@ #include <projectexplorer/session.h> #include <projectexplorer/kitinformation.h> #include <projectexplorer/localapplicationrunconfiguration.h> -#include <texteditor/itexteditor.h> +#include <texteditor/basetexteditor.h> #include <coreplugin/coreconstants.h> #include <coreplugin/editormanager/editormanager.h> @@ -341,7 +341,7 @@ void QmlProfilerTool::gotoSourceLocation(const QString &fileUrl, int lineNumber, return; IEditor *editor = EditorManager::openEditor(projectFileName); - TextEditor::ITextEditor *textEditor = qobject_cast<TextEditor::ITextEditor*>(editor); + TextEditor::BaseTextEditor *textEditor = qobject_cast<TextEditor::BaseTextEditor*>(editor); if (textEditor) { EditorManager::addCurrentPositionToNavigationHistory(); diff --git a/src/plugins/texteditor/basefilefind.cpp b/src/plugins/texteditor/basefilefind.cpp index 91983c9b10..3a9980b2f4 100644 --- a/src/plugins/texteditor/basefilefind.cpp +++ b/src/plugins/texteditor/basefilefind.cpp @@ -37,7 +37,7 @@ #include <coreplugin/dialogs/readonlyfilesdialog.h> #include <coreplugin/documentmanager.h> #include <coreplugin/find/ifindsupport.h> -#include <texteditor/itexteditor.h> +#include <texteditor/basetexteditor.h> #include <texteditor/refactoringchanges.h> #include <utils/stylehelper.h> #include <utils/qtcassert.h> @@ -174,12 +174,12 @@ void BaseFileFind::runSearch(Core::SearchResult *search) watcher->setFuture(Utils::findInFilesRegExp(parameters.text, files(parameters.nameFilters, parameters.additionalParameters), textDocumentFlagsForFindFlags(parameters.flags), - ITextEditorDocument::openedTextDocumentContents())); + BaseTextEditorDocument::openedTextDocumentContents())); } else { watcher->setFuture(Utils::findInFiles(parameters.text, files(parameters.nameFilters, parameters.additionalParameters), textDocumentFlagsForFindFlags(parameters.flags), - ITextEditorDocument::openedTextDocumentContents())); + BaseTextEditorDocument::openedTextDocumentContents())); } FutureProgress *progress = ProgressManager::addTask(watcher->future(), tr("Searching"), Constants::TASK_SEARCH); diff --git a/src/plugins/texteditor/basehoverhandler.cpp b/src/plugins/texteditor/basehoverhandler.cpp index ffee52f447..3b0e5845ab 100644 --- a/src/plugins/texteditor/basehoverhandler.cpp +++ b/src/plugins/texteditor/basehoverhandler.cpp @@ -28,7 +28,6 @@ ****************************************************************************/ #include "basehoverhandler.h" -#include "itexteditor.h" #include "basetexteditor.h" #include <coreplugin/icore.h> @@ -41,7 +40,7 @@ using namespace Core; namespace TextEditor { -static BaseTextEditorWidget *baseTextEditor(ITextEditor *editor) +static BaseTextEditorWidget *baseTextEditor(BaseTextEditor *editor) { if (!editor) return 0; @@ -63,16 +62,16 @@ void BaseHoverHandler::editorOpened(Core::IEditor *editor) if (acceptEditor(editor)) { BaseTextEditor *textEditor = qobject_cast<BaseTextEditor *>(editor); if (textEditor) { - connect(textEditor, SIGNAL(tooltipRequested(TextEditor::ITextEditor*,QPoint,int)), - this, SLOT(showToolTip(TextEditor::ITextEditor*,QPoint,int))); + connect(textEditor, SIGNAL(tooltipRequested(TextEditor::BaseTextEditor*,QPoint,int)), + this, SLOT(showToolTip(TextEditor::BaseTextEditor*,QPoint,int))); - connect(textEditor, SIGNAL(contextHelpIdRequested(TextEditor::ITextEditor*,int)), - this, SLOT(updateContextHelpId(TextEditor::ITextEditor*,int))); + connect(textEditor, SIGNAL(contextHelpIdRequested(TextEditor::BaseTextEditor*,int)), + this, SLOT(updateContextHelpId(TextEditor::BaseTextEditor*,int))); } } } -void BaseHoverHandler::showToolTip(TextEditor::ITextEditor *editor, const QPoint &point, int pos) +void BaseHoverHandler::showToolTip(TextEditor::BaseTextEditor *editor, const QPoint &point, int pos) { BaseTextEditorWidget *baseEditor = baseTextEditor(editor); if (!baseEditor) @@ -84,7 +83,7 @@ void BaseHoverHandler::showToolTip(TextEditor::ITextEditor *editor, const QPoint operateTooltip(editor, point); } -void BaseHoverHandler::updateContextHelpId(TextEditor::ITextEditor *editor, int pos) +void BaseHoverHandler::updateContextHelpId(TextEditor::BaseTextEditor *editor, int pos) { BaseTextEditorWidget *baseEditor = baseTextEditor(editor); if (!baseEditor) @@ -150,7 +149,7 @@ void BaseHoverHandler::clear() m_lastHelpItemIdentified = HelpItem(); } -void BaseHoverHandler::process(ITextEditor *editor, int pos) +void BaseHoverHandler::process(BaseTextEditor *editor, int pos) { clear(); identifyMatch(editor, pos); @@ -172,7 +171,7 @@ void BaseHoverHandler::decorateToolTip() } } -void BaseHoverHandler::operateTooltip(ITextEditor *editor, const QPoint &point) +void BaseHoverHandler::operateTooltip(BaseTextEditor *editor, const QPoint &point) { if (m_toolTip.isEmpty()) Utils::ToolTip::hide(); diff --git a/src/plugins/texteditor/basehoverhandler.h b/src/plugins/texteditor/basehoverhandler.h index ea6c781568..7d487b21b1 100644 --- a/src/plugins/texteditor/basehoverhandler.h +++ b/src/plugins/texteditor/basehoverhandler.h @@ -44,7 +44,7 @@ namespace Core { class IEditor; } namespace TextEditor { -class ITextEditor; +class BaseTextEditor; class BaseTextEditorWidget; class TEXTEDITOR_EXPORT BaseHoverHandler : public QObject @@ -57,8 +57,8 @@ public: private slots: void editorOpened(Core::IEditor *editor); - void showToolTip(TextEditor::ITextEditor *editor, const QPoint &point, int pos); - void updateContextHelpId(TextEditor::ITextEditor *editor, int pos); + void showToolTip(TextEditor::BaseTextEditor *editor, const QPoint &point, int pos); + void updateContextHelpId(TextEditor::BaseTextEditor *editor, int pos); protected: void setToolTip(const QString &tooltip); @@ -75,12 +75,12 @@ protected: private: void clear(); - void process(ITextEditor *editor, int pos); + void process(BaseTextEditor *editor, int pos); virtual bool acceptEditor(Core::IEditor *editor) = 0; - virtual void identifyMatch(ITextEditor *editor, int pos) = 0; + virtual void identifyMatch(BaseTextEditor *editor, int pos) = 0; virtual void decorateToolTip(); - virtual void operateTooltip(ITextEditor *editor, const QPoint &point); + virtual void operateTooltip(BaseTextEditor *editor, const QPoint &point); bool m_diagnosticTooltip; QString m_toolTip; diff --git a/src/plugins/texteditor/basetextdocument.h b/src/plugins/texteditor/basetextdocument.h index c371d145ad..370a24ba9a 100644 --- a/src/plugins/texteditor/basetextdocument.h +++ b/src/plugins/texteditor/basetextdocument.h @@ -33,7 +33,6 @@ #include "texteditor_global.h" #include "itexteditor.h" -#include "itexteditor.h" #include <QList> @@ -56,7 +55,7 @@ class TypingSettings; typedef QList<TextMark *> TextMarks; -class TEXTEDITOR_EXPORT BaseTextDocument : public ITextEditorDocument +class TEXTEDITOR_EXPORT BaseTextDocument : public BaseTextEditorDocument { Q_OBJECT @@ -64,7 +63,7 @@ public: BaseTextDocument(); virtual ~BaseTextDocument(); - // ITextEditorDocument + // BaseTextEditorDocument QString plainText() const; QString textAt(int pos, int length) const; QChar characterAt(int pos) const; diff --git a/src/plugins/texteditor/basetexteditor.cpp b/src/plugins/texteditor/basetexteditor.cpp index 7238d2e795..01a917b4f1 100644 --- a/src/plugins/texteditor/basetexteditor.cpp +++ b/src/plugins/texteditor/basetexteditor.cpp @@ -119,6 +119,176 @@ using namespace Utils; namespace TextEditor { namespace Internal { +class BaseTextEditorAnimator : public QObject +{ + Q_OBJECT + +public: + BaseTextEditorAnimator(QObject *parent); + + inline void setPosition(int position) { m_position = position; } + inline int position() const { return m_position; } + + void setData(const QFont &f, const QPalette &pal, const QString &text); + + void draw(QPainter *p, const QPointF &pos); + QRectF rect() const; + + inline qreal value() const { return m_value; } + inline QPointF lastDrawPos() const { return m_lastDrawPos; } + + void finish(); + + bool isRunning() const; + +signals: + void updateRequest(int position, QPointF lastPos, QRectF rect); + + +private slots: + void step(qreal v); + +private: + QTimeLine *m_timeline; + qreal m_value; + int m_position; + QPointF m_lastDrawPos; + QFont m_font; + QPalette m_palette; + QString m_text; + QSizeF m_size; +}; + +class BaseTextEditorWidgetPrivate +{ + BaseTextEditorWidgetPrivate(const BaseTextEditorWidgetPrivate &); + BaseTextEditorWidgetPrivate &operator=(const BaseTextEditorWidgetPrivate &); + +public: + BaseTextEditorWidgetPrivate(); + ~BaseTextEditorWidgetPrivate(); + + void setupDocumentSignals(); + void updateLineSelectionColor(); + + void print(QPrinter *printer); + + BaseTextEditorWidget *q; + bool m_contentsChanged; + bool m_lastCursorChangeWasInteresting; + + QSharedPointer<BaseTextDocument> m_document; + QByteArray m_tempState; + QByteArray m_tempNavigationState; + + bool m_parenthesesMatchingEnabled; + + // parentheses matcher + bool m_formatRange; + QTextCharFormat m_mismatchFormat; + QTimer m_parenthesesMatchingTimer; + // end parentheses matcher + + QWidget *m_extraArea; + + Core::Id m_tabSettingsId; + ICodeStylePreferences *m_codeStylePreferences; + DisplaySettings m_displaySettings; + MarginSettings m_marginSettings; + bool m_fontSettingsNeedsApply; + BehaviorSettings m_behaviorSettings; + + int extraAreaSelectionAnchorBlockNumber; + int extraAreaToggleMarkBlockNumber; + int extraAreaHighlightFoldedBlockNumber; + + TextEditorOverlay *m_overlay; + TextEditorOverlay *m_snippetOverlay; + TextEditorOverlay *m_searchResultOverlay; + bool snippetCheckCursor(const QTextCursor &cursor); + void snippetTabOrBacktab(bool forward); + + RefactorOverlay *m_refactorOverlay; + + QBasicTimer foldedBlockTimer; + int visibleFoldedBlockNumber; + int suggestedVisibleFoldedBlockNumber; + void clearVisibleFoldedBlock(); + bool m_mouseOnFoldedMarker; + void foldLicenseHeader(); + + QBasicTimer autoScrollTimer; + uint m_marksVisible : 1; + uint m_codeFoldingVisible : 1; + uint m_codeFoldingSupported : 1; + uint m_revisionsVisible : 1; + uint m_lineNumbersVisible : 1; + uint m_highlightCurrentLine : 1; + uint m_requestMarkEnabled : 1; + uint m_lineSeparatorsAllowed : 1; + uint autoParenthesisOverwriteBackup : 1; + uint surroundWithEnabledOverwriteBackup : 1; + uint m_maybeFakeTooltipEvent : 1; + int m_visibleWrapColumn; + + BaseTextEditorWidget::Link m_currentLink; + bool m_linkPressed; + + QRegExp m_searchExpr; + Core::FindFlags m_findFlags; + void highlightSearchResults(const QTextBlock &block, TextEditorOverlay *overlay); + QTimer m_delayedUpdateTimer; + + BaseTextEditor *m_editor; + + QList<QTextEdit::ExtraSelection> m_extraSelections[BaseTextEditorWidget::NExtraSelectionKinds]; + + // block selection mode + bool m_inBlockSelectionMode; + QString copyBlockSelection(); + void insertIntoBlockSelection(const QString &text = QString()); + void setCursorToColumn(QTextCursor &cursor, int column, + QTextCursor::MoveMode moveMode = QTextCursor::MoveAnchor); + void removeBlockSelection(); + void enableBlockSelection(const QTextCursor &cursor); + void enableBlockSelection(int positionBlock, int positionColumn, + int anchorBlock, int anchorColumn); + void disableBlockSelection(bool keepSelection = true); + void resetCursorFlashTimer(); + QBasicTimer m_cursorFlashTimer; + bool m_cursorVisible; + bool m_moveLineUndoHack; + + QTextCursor m_findScopeStart; + QTextCursor m_findScopeEnd; + int m_findScopeVerticalBlockSelectionFirstColumn; + int m_findScopeVerticalBlockSelectionLastColumn; + + QTextCursor m_selectBlockAnchor; + + Internal::BaseTextBlockSelection m_blockSelection; + + void moveCursorVisible(bool ensureVisible = true); + + int visualIndent(const QTextBlock &block) const; + BaseTextEditorPrivateHighlightBlocks m_highlightBlocksInfo; + QTimer m_highlightBlocksTimer; + + QScopedPointer<CodeAssistant> m_codeAssistant; + bool m_assistRelevantContentAdded; + + QPointer<BaseTextEditorAnimator> m_animator; + int m_cursorBlockNumber; + int m_blockCount; + + QPoint m_markDragStart; + bool m_markDragging; + + QScopedPointer<AutoCompleter> m_autoCompleter; + + QScopedPointer<Internal::ClipboardAssistProvider> m_clipboardAssistProvider; +}; + class TextEditExtraArea : public QWidget { public: @@ -2059,28 +2229,28 @@ void BaseTextEditorWidget::gotoLine(int line, int column, bool centerLine) saveCurrentCursorPositionForNavigation(); } -int BaseTextEditorWidget::position(ITextEditor::PositionOperation posOp, int at) const +int BaseTextEditorWidget::position(BaseTextEditor::PositionOperation posOp, int at) const { QTextCursor tc = textCursor(); if (at != -1) tc.setPosition(at); - if (posOp == ITextEditor::Current) + if (posOp == BaseTextEditor::Current) return tc.position(); switch (posOp) { - case ITextEditor::EndOfLine: + case BaseTextEditor::EndOfLine: tc.movePosition(QTextCursor::EndOfLine); return tc.position(); - case ITextEditor::StartOfLine: + case BaseTextEditor::StartOfLine: tc.movePosition(QTextCursor::StartOfLine); return tc.position(); - case ITextEditor::Anchor: + case BaseTextEditor::Anchor: if (tc.hasSelection()) return tc.anchor(); break; - case ITextEditor::EndOfDoc: + case BaseTextEditor::EndOfDoc: tc.movePosition(QTextCursor::End); return tc.position(); default: @@ -4673,11 +4843,11 @@ void BaseTextEditorWidget::extraAreaMouseEvent(QMouseEvent *e) } } int line = n + 1; - ITextEditor::MarkRequestKind kind; + BaseTextEditor::MarkRequestKind kind; if (QApplication::keyboardModifiers() & Qt::ShiftModifier) - kind = ITextEditor::BookmarkRequest; + kind = BaseTextEditor::BookmarkRequest; else - kind = ITextEditor::BreakpointRequest; + kind = BaseTextEditor::BreakpointRequest; emit editor()->markRequested(editor(), line, kind); } @@ -6202,6 +6372,16 @@ BaseTextEditor::~BaseTextEditor() delete m_editorWidget; } +BaseTextDocument *BaseTextEditor::baseTextDocument() +{ + return m_editorWidget->baseTextDocument(); +} + +IDocument *BaseTextEditor::document() +{ + return m_editorWidget->baseTextDocument(); +} + QWidget *BaseTextEditor::toolBar() { return m_toolBar; @@ -6233,6 +6413,11 @@ int BaseTextEditor::currentColumn() const return cursor.position() - cursor.block().position() + 1; } +void BaseTextEditor::gotoLine(int line, int column, bool centerLine) +{ + m_editorWidget->gotoLine(line, column, centerLine); +} + int BaseTextEditor::columnCount() const { return m_editorWidget->columnCount(); @@ -6243,6 +6428,16 @@ int BaseTextEditor::rowCount() const return m_editorWidget->rowCount(); } +int BaseTextEditor::position(BaseTextEditor::PositionOperation posOp, int at) const +{ + return m_editorWidget->position(posOp, at); +} + +void BaseTextEditor::convertPosition(int pos, int *line, int *column) const +{ + m_editorWidget->convertPosition(pos, line, column); +} + QRect BaseTextEditor::cursorRect(int pos) const { QTextCursor tc = m_editorWidget->textCursor(); @@ -6644,4 +6839,16 @@ bool BaseTextEditor::open(QString *errorString, const QString &fileName, const Q return m_editorWidget->open(errorString, fileName, realFileName); } +QByteArray BaseTextEditor::saveState() const +{ + return m_editorWidget->saveState(); +} + +bool BaseTextEditor::restoreState(const QByteArray &state) +{ + return m_editorWidget->restoreState(state); +} + } // namespace TextEditor + +#include "basetexteditor.moc" diff --git a/src/plugins/texteditor/basetexteditor.h b/src/plugins/texteditor/basetexteditor.h index 9d6c1fdd49..38595d56b8 100644 --- a/src/plugins/texteditor/basetexteditor.h +++ b/src/plugins/texteditor/basetexteditor.h @@ -42,15 +42,13 @@ QT_BEGIN_NAMESPACE class QToolBar; -class QTimeLine; class QPrinter; QT_END_NAMESPACE -namespace Utils { - class LineColumnLabel; -} +namespace Utils { class LineColumnLabel; } namespace TextEditor { + class TabSettings; class RefactorOverlay; struct RefactorMarker; @@ -67,7 +65,7 @@ namespace Internal { typedef QString (QString::*TransformationMethod)() const; } -class BaseTextEditor; +class BaseTextEditorWidget; class FontSettings; class BehaviorSettings; class CompletionSettings; @@ -79,44 +77,109 @@ class Indenter; class AutoCompleter; class ExtraEncodingSettings; -class TEXTEDITOR_EXPORT BaseTextEditorAnimator : public QObject +class TEXTEDITOR_EXPORT BaseTextEditor : public Core::IEditor { Q_OBJECT public: - BaseTextEditorAnimator(QObject *parent); + enum PositionOperation { + Current = 1, + EndOfLine = 2, + StartOfLine = 3, + Anchor = 4, + EndOfDoc = 5 + }; - inline void setPosition(int position) { m_position = position; } - inline int position() const { return m_position; } + BaseTextEditor(BaseTextEditorWidget *editorWidget); + ~BaseTextEditor(); - void setData(const QFont &f, const QPalette &pal, const QString &text); + virtual BaseTextEditorDocument *textDocument(); - void draw(QPainter *p, const QPointF &pos); - QRectF rect() const; + enum MarkRequestKind { + BreakpointRequest, + BookmarkRequest, + TaskMarkRequest + }; - inline qreal value() const { return m_value; } - inline QPointF lastDrawPos() const { return m_lastDrawPos; } + static BaseTextEditor *currentTextEditor(); - void finish(); + friend class BaseTextEditorWidget; + BaseTextEditorWidget *editorWidget() const { return m_editorWidget; } + BaseTextDocument *baseTextDocument(); - bool isRunning() const; + // IEditor + Core::IDocument *document(); + bool open(QString *errorString, const QString &fileName, const QString &realFileName); -signals: - void updateRequest(int position, QPointF lastPos, QRectF rect); + QByteArray saveState() const; + bool restoreState(const QByteArray &state); + QWidget *toolBar(); + + enum Side { Left, Right }; + void insertExtraToolBarWidget(Side side, QWidget *widget); + + QString contextHelpId() const; // from IContext + + int currentLine() const; + int currentColumn() const; + void gotoLine(int line, int column = 0, bool centerLine = true); + + /*! Returns the amount of visible columns (in characters) in the editor */ + int columnCount() const; + + /*! Returns the amount of visible lines (in characters) in the editor */ + int rowCount() const; + + /*! Returns the position at \a posOp in characters from the beginning of the document */ + virtual int position(PositionOperation posOp = Current, int at = -1) const; + + /*! Converts the \a pos in characters from beginning of document to \a line and \a column */ + virtual void convertPosition(int pos, int *line, int *column) const; + + /*! Returns the cursor rectangle in pixels at \a pos, or current position if \a pos = -1 */ + virtual QRect cursorRect(int pos = -1) const; + virtual QString selectedText() const; + + /*! Removes \a length characters to the right of the cursor. */ + virtual void remove(int length); + /*! Inserts the given string to the right of the cursor. */ + virtual void insert(const QString &string); + /*! Replaces \a length characters to the right of the cursor with the given string. */ + virtual void replace(int length, const QString &string); + /*! Sets current cursor position to \a pos. */ + virtual void setCursorPosition(int pos); + /*! Selects text between current cursor position and \a toPos. */ + virtual void select(int toPos); + + virtual const Utils::CommentDefinition *commentDefinition() const; + + virtual CompletionAssistProvider *completionAssistProvider(); + +signals: + void markRequested(TextEditor::BaseTextEditor *editor, int line, TextEditor::BaseTextEditor::MarkRequestKind kind); + void markContextMenuRequested(TextEditor::BaseTextEditor *editor, int line, QMenu *menu); + void tooltipOverrideRequested(TextEditor::BaseTextEditor *editor, const QPoint &globalPos, int position, bool *handled); + void tooltipRequested(TextEditor::BaseTextEditor *editor, const QPoint &globalPos, int position); + void markTooltipRequested(TextEditor::BaseTextEditor *editor, const QPoint &globalPos, int line); + void contextHelpIdRequested(TextEditor::BaseTextEditor *editor, int position); private slots: - void step(qreal v); + void updateCursorPosition(); + void openGotoLocator(); + void setFileEncodingLabelVisible(bool visible); + void setFileEncodingLabelText(const QString &text); private: - QTimeLine *m_timeline; - qreal m_value; - int m_position; - QPointF m_lastDrawPos; - QFont m_font; - QPalette m_palette; - QString m_text; - QSizeF m_size; + // Note: This is always a copy of IContext::m_widget. + BaseTextEditorWidget *m_editorWidget; + + QToolBar *m_toolBar; + QWidget *m_stretchWidget; + QAction *m_cursorPositionLabelAction; + Utils::LineColumnLabel *m_cursorPositionLabel; + QAction *m_fileEncodingLabelAction; + Utils::LineColumnLabel *m_fileEncodingLabel; }; @@ -139,7 +202,7 @@ public: QByteArray saveState() const; bool restoreState(const QByteArray &state); void gotoLine(int line, int column = 0, bool centerLine = true); - int position(ITextEditor::PositionOperation posOp = ITextEditor::Current, + int position(BaseTextEditor::PositionOperation posOp = BaseTextEditor::Current, int at = -1) const; void convertPosition(int pos, int *line, int *column) const; @@ -235,7 +298,7 @@ public: static QString msgTextTooLarge(quint64 size); void insertPlainText(const QString &text); - QString selectedText() const; + public slots: virtual void copy(); @@ -482,6 +545,8 @@ public: int targetColumn; }; + QString selectedText() const; + protected: /*! Reimplement this function to enable code navigation. @@ -570,75 +635,6 @@ private slots: void doFoo(); }; - -class TEXTEDITOR_EXPORT BaseTextEditor : public ITextEditor -{ - Q_OBJECT - -public: - BaseTextEditor(BaseTextEditorWidget *editorWidget); - ~BaseTextEditor(); - - friend class BaseTextEditorWidget; - BaseTextEditorWidget *editorWidget() const { return m_editorWidget; } - BaseTextDocument *baseTextDocument() { return m_editorWidget->baseTextDocument(); } - - // IEditor - Core::IDocument *document() { return m_editorWidget->baseTextDocument(); } - bool open(QString *errorString, const QString &fileName, const QString &realFileName); - - QByteArray saveState() const { return m_editorWidget->saveState(); } - bool restoreState(const QByteArray &state) { return m_editorWidget->restoreState(state); } - QWidget *toolBar(); - - enum Side { Left, Right }; - void insertExtraToolBarWidget(Side side, QWidget *widget); - - // ITextEditor - int currentLine() const; - int currentColumn() const; - void gotoLine(int line, int column = 0, bool centerLine = true) { m_editorWidget->gotoLine(line, column, centerLine); } - int columnCount() const; - int rowCount() const; - - int position(PositionOperation posOp = Current, int at = -1) const - { return m_editorWidget->position(posOp, at); } - void convertPosition(int pos, int *line, int *column) const - { m_editorWidget->convertPosition(pos, line, column); } - QRect cursorRect(int pos = -1) const; - - QString selectedText() const; - - QString contextHelpId() const; // from IContext - - // ITextEditor - void remove(int length); - void insert(const QString &string); - void replace(int length, const QString &string); - void setCursorPosition(int pos); - void select(int toPos); - const Utils::CommentDefinition *commentDefinition() const; - - virtual CompletionAssistProvider *completionAssistProvider(); - -private slots: - void updateCursorPosition(); - void openGotoLocator(); - void setFileEncodingLabelVisible(bool visible); - void setFileEncodingLabelText(const QString &text); - -private: - // Note: This is always a copy of IContext::m_widget. - BaseTextEditorWidget *m_editorWidget; - - QToolBar *m_toolBar; - QWidget *m_stretchWidget; - QAction *m_cursorPositionLabelAction; - Utils::LineColumnLabel *m_cursorPositionLabel; - QAction *m_fileEncodingLabelAction; - Utils::LineColumnLabel *m_fileEncodingLabel; -}; - } // namespace TextEditor Q_DECLARE_METATYPE(TextEditor::BaseTextEditorWidget::Link) diff --git a/src/plugins/texteditor/basetexteditor_p.h b/src/plugins/texteditor/basetexteditor_p.h index 1e69b3525e..f5f4fe7f90 100644 --- a/src/plugins/texteditor/basetexteditor_p.h +++ b/src/plugins/texteditor/basetexteditor_p.h @@ -105,136 +105,6 @@ struct BaseTextEditorPrivateHighlightBlocks }; -class BaseTextEditorWidgetPrivate -{ - BaseTextEditorWidgetPrivate(const BaseTextEditorWidgetPrivate &); - BaseTextEditorWidgetPrivate &operator=(const BaseTextEditorWidgetPrivate &); - -public: - BaseTextEditorWidgetPrivate(); - ~BaseTextEditorWidgetPrivate(); - - void setupDocumentSignals(); - void updateLineSelectionColor(); - - void print(QPrinter *printer); - - BaseTextEditorWidget *q; - bool m_contentsChanged; - bool m_lastCursorChangeWasInteresting; - - QSharedPointer<BaseTextDocument> m_document; - QByteArray m_tempState; - QByteArray m_tempNavigationState; - - bool m_parenthesesMatchingEnabled; - - // parentheses matcher - bool m_formatRange; - QTextCharFormat m_mismatchFormat; - QTimer m_parenthesesMatchingTimer; - // end parentheses matcher - - QWidget *m_extraArea; - - Core::Id m_tabSettingsId; - ICodeStylePreferences *m_codeStylePreferences; - DisplaySettings m_displaySettings; - MarginSettings m_marginSettings; - bool m_fontSettingsNeedsApply; - BehaviorSettings m_behaviorSettings; - - int extraAreaSelectionAnchorBlockNumber; - int extraAreaToggleMarkBlockNumber; - int extraAreaHighlightFoldedBlockNumber; - - TextEditorOverlay *m_overlay; - TextEditorOverlay *m_snippetOverlay; - TextEditorOverlay *m_searchResultOverlay; - bool snippetCheckCursor(const QTextCursor &cursor); - void snippetTabOrBacktab(bool forward); - - RefactorOverlay *m_refactorOverlay; - - QBasicTimer foldedBlockTimer; - int visibleFoldedBlockNumber; - int suggestedVisibleFoldedBlockNumber; - void clearVisibleFoldedBlock(); - bool m_mouseOnFoldedMarker; - void foldLicenseHeader(); - - QBasicTimer autoScrollTimer; - uint m_marksVisible : 1; - uint m_codeFoldingVisible : 1; - uint m_codeFoldingSupported : 1; - uint m_revisionsVisible : 1; - uint m_lineNumbersVisible : 1; - uint m_highlightCurrentLine : 1; - uint m_requestMarkEnabled : 1; - uint m_lineSeparatorsAllowed : 1; - uint autoParenthesisOverwriteBackup : 1; - uint surroundWithEnabledOverwriteBackup : 1; - uint m_maybeFakeTooltipEvent : 1; - int m_visibleWrapColumn; - - BaseTextEditorWidget::Link m_currentLink; - bool m_linkPressed; - - QRegExp m_searchExpr; - Core::FindFlags m_findFlags; - void highlightSearchResults(const QTextBlock &block, TextEditorOverlay *overlay); - QTimer m_delayedUpdateTimer; - - BaseTextEditor *m_editor; - - QList<QTextEdit::ExtraSelection> m_extraSelections[BaseTextEditorWidget::NExtraSelectionKinds]; - - // block selection mode - bool m_inBlockSelectionMode; - QString copyBlockSelection(); - void insertIntoBlockSelection(const QString &text = QString()); - void setCursorToColumn(QTextCursor &cursor, int column, - QTextCursor::MoveMode moveMode = QTextCursor::MoveAnchor); - void removeBlockSelection(); - void enableBlockSelection(const QTextCursor &cursor); - void enableBlockSelection(int positionBlock, int positionColumn, - int anchorBlock, int anchorColumn); - void disableBlockSelection(bool keepSelection = true); - void resetCursorFlashTimer(); - QBasicTimer m_cursorFlashTimer; - bool m_cursorVisible; - bool m_moveLineUndoHack; - - QTextCursor m_findScopeStart; - QTextCursor m_findScopeEnd; - int m_findScopeVerticalBlockSelectionFirstColumn; - int m_findScopeVerticalBlockSelectionLastColumn; - - QTextCursor m_selectBlockAnchor; - - Internal::BaseTextBlockSelection m_blockSelection; - - void moveCursorVisible(bool ensureVisible = true); - - int visualIndent(const QTextBlock &block) const; - BaseTextEditorPrivateHighlightBlocks m_highlightBlocksInfo; - QTimer m_highlightBlocksTimer; - - QScopedPointer<CodeAssistant> m_codeAssistant; - bool m_assistRelevantContentAdded; - - QPointer<BaseTextEditorAnimator> m_animator; - int m_cursorBlockNumber; - int m_blockCount; - - QPoint m_markDragStart; - bool m_markDragging; - - QScopedPointer<AutoCompleter> m_autoCompleter; - - QScopedPointer<Internal::ClipboardAssistProvider> m_clipboardAssistProvider; -}; - } // namespace Internal } // namespace TextEditor diff --git a/src/plugins/texteditor/findincurrentfile.cpp b/src/plugins/texteditor/findincurrentfile.cpp index 6a8a3a0716..ffa0068ef1 100644 --- a/src/plugins/texteditor/findincurrentfile.cpp +++ b/src/plugins/texteditor/findincurrentfile.cpp @@ -28,7 +28,7 @@ ****************************************************************************/ #include "findincurrentfile.h" -#include "itexteditor.h" +#include "basetexteditor.h" #include <utils/filesearch.h> #include <coreplugin/icore.h> @@ -64,7 +64,7 @@ Utils::FileIterator *FindInCurrentFile::files(const QStringList &nameFilters, Q_UNUSED(nameFilters) QString fileName = additionalParameters.toString(); QMap<QString, QTextCodec *> openEditorEncodings - = ITextEditorDocument::openedTextDocumentEncodings(); + = BaseTextEditorDocument::openedTextDocumentEncodings(); QTextCodec *codec = openEditorEncodings.value(fileName); if (!codec) codec = Core::EditorManager::defaultTextCodec(); diff --git a/src/plugins/texteditor/findinopenfiles.cpp b/src/plugins/texteditor/findinopenfiles.cpp index c444e8b0e3..9d15c02a7c 100644 --- a/src/plugins/texteditor/findinopenfiles.cpp +++ b/src/plugins/texteditor/findinopenfiles.cpp @@ -64,7 +64,7 @@ Utils::FileIterator *FindInOpenFiles::files(const QStringList &nameFilters, Q_UNUSED(nameFilters) Q_UNUSED(additionalParameters) QMap<QString, QTextCodec *> openEditorEncodings - = ITextEditorDocument::openedTextDocumentEncodings(); + = BaseTextEditorDocument::openedTextDocumentEncodings(); QStringList fileNames; QList<QTextCodec *> codecs; foreach (Core::DocumentModel::Entry *entry, diff --git a/src/plugins/texteditor/itexteditor.cpp b/src/plugins/texteditor/itexteditor.cpp index 51ec0a6b84..2da0838c59 100644 --- a/src/plugins/texteditor/itexteditor.cpp +++ b/src/plugins/texteditor/itexteditor.cpp @@ -27,7 +27,7 @@ ** ****************************************************************************/ -#include "itexteditor.h" +#include "basetexteditor.h" #include <coreplugin/editormanager/editormanager.h> #include <QTextCodec> @@ -35,32 +35,32 @@ namespace TextEditor { /*! - \class TextEditor::ITextEditorDocument - \brief The ITextEditorDocument class is an abstract base for documents of text editors. + \class TextEditor::BaseTextEditorDocument + \brief The BaseTextEditorDocument class is an abstract base for documents of text editors. - It is the base class for documents used by implementations of the ITextEditor class, + It is the base class for documents used by implementations of the BaseTextEditor class, and contains basic functions for retrieving text content and markers (like bookmarks). */ /*! - \class TextEditor::ITextEditor - \brief The ITextEditor class is an abstract base class for text editors. + \class TextEditor::BaseTextEditor + \brief The BaseTextEditor class is an abstract base class for text editors. It contains the basic functions for retrieving and setting cursor position and selections, and operations on them, like removing or inserting. It uses implementations of - ITextEditorDocument as the underlying document. + BaseTextEditorDocument as the underlying document. */ -ITextEditorDocument::ITextEditorDocument(QObject *parent) +BaseTextEditorDocument::BaseTextEditorDocument(QObject *parent) : Core::TextDocument(parent) { } -QMap<QString, QString> ITextEditorDocument::openedTextDocumentContents() +QMap<QString, QString> BaseTextEditorDocument::openedTextDocumentContents() { QMap<QString, QString> workingCopy; foreach (Core::IDocument *document, Core::DocumentModel::openedDocuments()) { - ITextEditorDocument *textEditorDocument = qobject_cast<ITextEditorDocument *>(document); + BaseTextEditorDocument *textEditorDocument = qobject_cast<BaseTextEditorDocument *>(document); if (!textEditorDocument) continue; QString fileName = textEditorDocument->filePath(); @@ -69,11 +69,11 @@ QMap<QString, QString> ITextEditorDocument::openedTextDocumentContents() return workingCopy; } -QMap<QString, QTextCodec *> ITextEditorDocument::openedTextDocumentEncodings() +QMap<QString, QTextCodec *> BaseTextEditorDocument::openedTextDocumentEncodings() { QMap<QString, QTextCodec *> workingCopy; foreach (Core::IDocument *document, Core::DocumentModel::openedDocuments()) { - ITextEditorDocument *textEditorDocument = qobject_cast<ITextEditorDocument *>(document); + BaseTextEditorDocument *textEditorDocument = qobject_cast<BaseTextEditorDocument *>(document); if (!textEditorDocument) continue; QString fileName = textEditorDocument->filePath(); @@ -82,15 +82,15 @@ QMap<QString, QTextCodec *> ITextEditorDocument::openedTextDocumentEncodings() return workingCopy; } -ITextEditorDocument *ITextEditor::textDocument() +BaseTextEditorDocument *BaseTextEditor::textDocument() { - return qobject_cast<ITextEditorDocument *>(document()); + return qobject_cast<BaseTextEditorDocument *>(document()); } -ITextEditor *ITextEditor::currentTextEditor() +BaseTextEditor *BaseTextEditor::currentTextEditor() { - return qobject_cast<ITextEditor *>(Core::EditorManager::currentEditor()); + return qobject_cast<BaseTextEditor *>(Core::EditorManager::currentEditor()); } } // namespace TextEditor diff --git a/src/plugins/texteditor/itexteditor.h b/src/plugins/texteditor/itexteditor.h index 60a10a522b..52b23f79ff 100644 --- a/src/plugins/texteditor/itexteditor.h +++ b/src/plugins/texteditor/itexteditor.h @@ -69,11 +69,11 @@ private: }; -class TEXTEDITOR_EXPORT ITextEditorDocument : public Core::TextDocument +class TEXTEDITOR_EXPORT BaseTextEditorDocument : public Core::TextDocument { Q_OBJECT public: - explicit ITextEditorDocument(QObject *parent = 0); + explicit BaseTextEditorDocument(QObject *parent = 0); virtual QString plainText() const = 0; virtual QString textAt(int pos, int length) const = 0; @@ -86,65 +86,6 @@ signals: void contentsChanged(); }; -class TEXTEDITOR_EXPORT ITextEditor : public Core::IEditor -{ - Q_OBJECT -public: - enum PositionOperation { - Current = 1, - EndOfLine = 2, - StartOfLine = 3, - Anchor = 4, - EndOfDoc = 5 - }; - - ITextEditor() {} - - virtual ITextEditorDocument *textDocument(); - - /*! Returns the position at \a posOp in characters from the beginning of the document */ - virtual int position(PositionOperation posOp = Current, int at = -1) const = 0; - /*! Converts the \a pos in characters from beginning of document to \a line and \a column */ - virtual void convertPosition(int pos, int *line, int *column) const = 0; - /*! Returns the cursor rectangle in pixels at \a pos, or current position if \a pos = -1 */ - virtual QRect cursorRect(int pos = -1) const = 0; - /*! Returns the amount of visible columns (in characters) in the editor */ - virtual int columnCount() const = 0; - /*! Returns the amount of visible lines (in characters) in the editor */ - virtual int rowCount() const = 0; - - virtual QString selectedText() const = 0; - - /*! Removes \a length characters to the right of the cursor. */ - virtual void remove(int length) = 0; - /*! Inserts the given string to the right of the cursor. */ - virtual void insert(const QString &string) = 0; - /*! Replaces \a length characters to the right of the cursor with the given string. */ - virtual void replace(int length, const QString &string) = 0; - /*! Sets current cursor position to \a pos. */ - virtual void setCursorPosition(int pos) = 0; - /*! Selects text between current cursor position and \a toPos. */ - virtual void select(int toPos) = 0; - - virtual const Utils::CommentDefinition* commentDefinition() const = 0; - - enum MarkRequestKind { - BreakpointRequest, - BookmarkRequest, - TaskMarkRequest - }; - - static ITextEditor *currentTextEditor(); - -signals: - void markRequested(TextEditor::ITextEditor *editor, int line, TextEditor::ITextEditor::MarkRequestKind kind); - void markContextMenuRequested(TextEditor::ITextEditor *editor, int line, QMenu *menu); - void tooltipOverrideRequested(TextEditor::ITextEditor *editor, const QPoint &globalPos, int position, bool *handled); - void tooltipRequested(TextEditor::ITextEditor *editor, const QPoint &globalPos, int position); - void markTooltipRequested(TextEditor::ITextEditor *editor, const QPoint &globalPos, int line); - void contextHelpIdRequested(TextEditor::ITextEditor *editor, int position); -}; - } // namespace TextEditor #endif // ITEXTEDITOR_H diff --git a/src/plugins/texteditor/texteditorplugin.cpp b/src/plugins/texteditor/texteditorplugin.cpp index a390183e13..9b83e6b461 100644 --- a/src/plugins/texteditor/texteditorplugin.cpp +++ b/src/plugins/texteditor/texteditorplugin.cpp @@ -214,7 +214,7 @@ void TextEditorPlugin::extensionsInitialized() tr("Selected text within the current document."), []() -> QString { QString value; - if (ITextEditor *editor = ITextEditor::currentTextEditor()) { + if (BaseTextEditor *editor = BaseTextEditor::currentTextEditor()) { value = editor->selectedText(); value.replace(QChar::ParagraphSeparator, QLatin1String("\n")); } @@ -224,35 +224,35 @@ void TextEditorPlugin::extensionsInitialized() Core::VariableManager::registerIntVariable(kCurrentDocumentRow, tr("Line number of the text cursor position in current document (starts with 1)."), []() -> int { - ITextEditor *editor = ITextEditor::currentTextEditor(); + BaseTextEditor *editor = BaseTextEditor::currentTextEditor(); return editor ? editor->currentLine() : 0; }); Core::VariableManager::registerIntVariable(kCurrentDocumentColumn, tr("Column number of the text cursor position in current document (starts with 0)."), []() -> int { - ITextEditor *editor = ITextEditor::currentTextEditor(); + BaseTextEditor *editor = BaseTextEditor::currentTextEditor(); return editor ? editor->currentColumn() : 0; }); Core::VariableManager::registerIntVariable(kCurrentDocumentRowCount, tr("Number of lines visible in current document."), []() -> int { - ITextEditor *editor = ITextEditor::currentTextEditor(); + BaseTextEditor *editor = BaseTextEditor::currentTextEditor(); return editor ? editor->rowCount() : 0; }); Core::VariableManager::registerIntVariable(kCurrentDocumentColumnCount, tr("Number of columns visible in current document."), []() -> int { - ITextEditor *editor = ITextEditor::currentTextEditor(); + BaseTextEditor *editor = BaseTextEditor::currentTextEditor(); return editor ? editor->columnCount() : 0; }); Core::VariableManager::registerIntVariable(kCurrentDocumentFontSize, tr("Current document's font size in points."), []() -> int { - ITextEditor *editor = ITextEditor::currentTextEditor(); + BaseTextEditor *editor = BaseTextEditor::currentTextEditor(); return editor ? editor->widget()->font().pointSize() : 0; }); @@ -304,9 +304,9 @@ void TextEditorPlugin::updateSearchResultsFont(const FontSettings &settings) void TextEditorPlugin::updateCurrentSelection(const QString &text) { - if (ITextEditor *editor = qobject_cast<ITextEditor *>(Core::EditorManager::currentEditor())) { + if (BaseTextEditor *editor = qobject_cast<BaseTextEditor *>(Core::EditorManager::currentEditor())) { const int pos = editor->position(); - int anchor = editor->position(ITextEditor::Anchor); + int anchor = editor->position(BaseTextEditor::Anchor); if (anchor < 0) // no selection anchor = pos; int selectionLength = pos - anchor; diff --git a/src/plugins/texteditor/textmark.h b/src/plugins/texteditor/textmark.h index 60d63fb96f..8532aea82b 100644 --- a/src/plugins/texteditor/textmark.h +++ b/src/plugins/texteditor/textmark.h @@ -43,7 +43,7 @@ QT_END_NAMESPACE namespace TextEditor { -class ITextEditor; +class BaseTextEditor; class BaseTextDocument; namespace Internal { class TextMarkRegistry; } diff --git a/src/plugins/valgrind/callgrindtool.cpp b/src/plugins/valgrind/callgrindtool.cpp index bea2787fa8..5fc046b03e 100644 --- a/src/plugins/valgrind/callgrindtool.cpp +++ b/src/plugins/valgrind/callgrindtool.cpp @@ -57,7 +57,7 @@ #include <cplusplus/LookupContext.h> #include <cplusplus/Overview.h> #include <extensionsystem/iplugin.h> -#include <texteditor/itexteditor.h> +#include <texteditor/basetexteditor.h> #include <utils/qtcassert.h> #include <utils/fancymainwindow.h> @@ -167,7 +167,7 @@ public slots: void engineFinished(); void editorOpened(Core::IEditor *); - void requestContextMenu(TextEditor::ITextEditor *editor, int line, QMenu *menu); + void requestContextMenu(TextEditor::BaseTextEditor *editor, int line, QMenu *menu); public: CallgrindTool *q; @@ -866,16 +866,16 @@ void CallgrindToolPrivate::showParserResults(const ParseData *data) void CallgrindToolPrivate::editorOpened(IEditor *editor) { - TextEditor::ITextEditor *textEditor = qobject_cast<TextEditor::ITextEditor *>(editor); + TextEditor::BaseTextEditor *textEditor = qobject_cast<TextEditor::BaseTextEditor *>(editor); if (!textEditor) return; connect(textEditor, - SIGNAL(markContextMenuRequested(TextEditor::ITextEditor*,int,QMenu*)), - SLOT(requestContextMenu(TextEditor::ITextEditor*,int,QMenu*))); + SIGNAL(markContextMenuRequested(TextEditor::BaseTextEditor*,int,QMenu*)), + SLOT(requestContextMenu(TextEditor::BaseTextEditor*,int,QMenu*))); } -void CallgrindToolPrivate::requestContextMenu(TextEditor::ITextEditor *editor, int line, QMenu *menu) +void CallgrindToolPrivate::requestContextMenu(TextEditor::BaseTextEditor *editor, int line, QMenu *menu) { // find callgrind text mark that corresponds to this editor's file and line number const Function *func = 0; diff --git a/src/plugins/vcsbase/vcsbaseeditor.cpp b/src/plugins/vcsbase/vcsbaseeditor.cpp index 0616329a0e..1aca147ab1 100644 --- a/src/plugins/vcsbase/vcsbaseeditor.cpp +++ b/src/plugins/vcsbase/vcsbaseeditor.cpp @@ -1135,7 +1135,7 @@ void VcsBaseEditorWidget::jumpToChangeFromDiff(QTextCursor cursor) return; Core::IEditor *ed = Core::EditorManager::openEditor(fileName); - if (TextEditor::ITextEditor *editor = qobject_cast<TextEditor::ITextEditor *>(ed)) + if (TextEditor::BaseTextEditor *editor = qobject_cast<TextEditor::BaseTextEditor *>(ed)) editor->gotoLine(chunkStart + lineCount); } |