Commit bf5e43be authored by hjk's avatar hjk
Browse files

TextEditor: Merge ITextEditor and BaseTextEditor



Adjust all callers, de-export BaseTextEditorAnimator

Change-Id: I2329d976c1398e2449844bb480a4d4ed29859506
Reviewed-by: default avatarTobias Hunger <tobias.hunger@digia.com>
parent 15421995
......@@ -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);
};
......
......@@ -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)) {
......
......@@ -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);
......
......@@ -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 "
......
......@@ -108,7 +108,7 @@ private:
void abortDebugger();
void resetLocation();
bool setToolTipExpression(TextEditor::ITextEditor *editor,
bool setToolTipExpression(TextEditor::BaseTextEditor *editor,
const DebuggerToolTipContext &);
void continueInferior();
......
......@@ -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)
......
......@@ -75,7 +75,7 @@ private:
void shutdownInferior();
void shutdownEngine();
bool setToolTipExpression(TextEditor::ITextEditor *editor,
bool setToolTipExpression(TextEditor::BaseTextEditor *editor,
const DebuggerToolTipContext &);
void continueInferior();
......
......@@ -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;
......
......@@ -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);
......
......@@ -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
......
......@@ -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;
......
......@@ -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;
......
......@@ -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);
......
......@@ -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;
......
......@@ -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)
{
......
......@@ -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;
......
......@@ -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())
......
......@@ -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();
};
......
......@@ -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);
}
......
......@@ -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
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment