Commit 9e3441df authored by Nikolai Kosjar's avatar Nikolai Kosjar

{Cpp,Text}Editor: Fix duplicating CppEditorWidget

Fixes local use highlighting and renaming in new split, among others.

Done-with: hjk <hjk121@nokiamail.com>
Change-Id: Ic604d37d2dc0082fa4a75c2af457f60d6d6cfa66
Reviewed-by: default avatarhjk <hjk121@nokiamail.com>
parent b5ecaff3
......@@ -227,12 +227,19 @@ void CppEditorWidget::finalizeInitialization()
connect(d->m_preprocessorButton, SIGNAL(clicked()), this, SLOT(showPreProcessorWidget()));
insertExtraToolBarWidget(TextEditor::BaseTextEditorWidget::Left, d->m_preprocessorButton);
insertExtraToolBarWidget(TextEditor::BaseTextEditorWidget::Left, d->m_cppEditorOutline->widget());
}
void CppEditorWidget::finalizeInitializationAfterDuplication(BaseTextEditorWidget *other)
{
QTC_ASSERT(other, return);
CppEditorWidget *cppEditorWidget = qobject_cast<CppEditorWidget *>(other);
QTC_ASSERT(cppEditorWidget, return);
// updateSemanticInfo(semanticInfo());
// updateFunctionDeclDefLink();
// d->m_cppEditorOutline->update();
// const ExtraSelectionKind selectionKind = CodeWarningsSelection;
// setExtraSelections(selectionKind, extraSelections(selectionKind));
if (cppEditorWidget->isSemanticInfoValidExceptLocalUses())
updateSemanticInfo(cppEditorWidget->semanticInfo());
d->m_cppEditorOutline->update();
const ExtraSelectionKind selectionKind = CodeWarningsSelection;
setExtraSelections(selectionKind, cppEditorWidget->extraSelections(selectionKind));
}
CppEditorWidget::~CppEditorWidget()
......
......@@ -73,8 +73,6 @@ public:
CppEditorWidget();
~CppEditorWidget();
void finalizeInitialization();
CppEditorDocument *cppEditorDocument() const;
CppEditorOutline *outline() const;
......@@ -143,6 +141,9 @@ private slots:
void processKeyNormally(QKeyEvent *e);
private:
void finalizeInitialization() QTC_OVERRIDE;
void finalizeInitializationAfterDuplication(BaseTextEditorWidget *other) QTC_OVERRIDE;
static bool openCppEditorAt(const Link &, bool inNextSplit = false);
unsigned documentRevision() const;
......
......@@ -7284,7 +7284,9 @@ void BaseTextEditorFactory::setEditorActionHandlers(uint optionalActions)
BaseTextEditor *BaseTextEditorFactory::duplicateTextEditor(BaseTextEditor *other)
{
return createEditorHelper(other->editorWidget()->textDocumentPtr());
BaseTextEditor *editor = createEditorHelper(other->editorWidget()->textDocumentPtr());
editor->editorWidget()->finalizeInitializationAfterDuplication(other->editorWidget());
return editor;
}
IEditor *BaseTextEditorFactory::createEditor()
......
......@@ -548,6 +548,7 @@ protected:
void showDefaultContextMenu(QContextMenuEvent *e, Core::Id menuContextId);
virtual void finalizeInitialization() {}
virtual void finalizeInitializationAfterDuplication(BaseTextEditorWidget *) {}
public:
struct Link
......
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