diff --git a/src/plugins/coreplugin/editormanager/editormanager.cpp b/src/plugins/coreplugin/editormanager/editormanager.cpp index e3f8f164ad5ca63eebbf6554b1bf3d56c84f5601..c596cde02d54dfa89681ba4b2831f89809e33ed8 100644 --- a/src/plugins/coreplugin/editormanager/editormanager.cpp +++ b/src/plugins/coreplugin/editormanager/editormanager.cpp @@ -509,7 +509,7 @@ void EditorManager::setCurrentView(Core::Internal::SplitterOrView *view) view->setFocus(); } -Core::Internal::SplitterOrView *EditorManager::currentView() const +Core::Internal::SplitterOrView *EditorManager::currentSplitterOrView() const { SplitterOrView *view = m_d->m_currentView; if (!view) @@ -521,6 +521,13 @@ Core::Internal::SplitterOrView *EditorManager::currentView() const return view; } +Core::Internal::EditorView *EditorManager::currentEditorView() const +{ + return currentSplitterOrView()->view(); +} + + + QList<IEditor *> EditorManager::editorsForFileName(const QString &filename) const { QList<IEditor *> found; @@ -687,7 +694,7 @@ bool EditorManager::closeEditors(const QList<IEditor*> editorsToClose, bool askA if (editorsToClose.isEmpty()) return true; - SplitterOrView *currentSplitterOrView = currentView(); + SplitterOrView *currentSplitterOrView = this->currentSplitterOrView(); bool closingFailed = false; QList<IEditor*> acceptedEditors; @@ -795,7 +802,7 @@ void EditorManager::closeDuplicate(Core::IEditor *editor) if (original== editor) m_d->m_editorModel->makeOriginal(duplicates.first()); - SplitterOrView *currentSplitterOrView = currentView(); + SplitterOrView *currentSplitterOrView = this->currentSplitterOrView(); emit editorAboutToClose(editor); @@ -883,7 +890,7 @@ Core::IEditor *EditorManager::activateEditor(Core::IEditor *editor, OpenEditorFl Core::IEditor *EditorManager::activateEditor(Core::Internal::EditorView *view, Core::IEditor *editor, OpenEditorFlags flags) { if (!view) - view = currentView()->view(); + view = currentSplitterOrView()->view(); Q_ASSERT(view); @@ -1405,7 +1412,7 @@ void EditorManager::gotoNextDocHistory() if (dialog->isVisible()) { dialog->selectNextEditor(); } else { - EditorView *view = currentView()->view(); + EditorView *view = currentSplitterOrView()->view(); dialog->setEditors(m_d->m_view, view, m_d->m_editorModel); dialog->selectNextEditor(); showWindowPopup(); @@ -1418,7 +1425,7 @@ void EditorManager::gotoPreviousDocHistory() if (dialog->isVisible()) { dialog->selectPreviousEditor(); } else { - EditorView *view = currentView()->view(); + EditorView *view = currentSplitterOrView()->view(); dialog->setEditors(m_d->m_view, view, m_d->m_editorModel); dialog->selectPreviousEditor(); showWindowPopup(); @@ -1500,13 +1507,13 @@ OpenEditorsModel *EditorManager::openedEditorsModel() const void EditorManager::addCurrentPositionToNavigationHistory(IEditor *editor, const QByteArray &saveState) { - currentView()->view()->addCurrentPositionToNavigationHistory(editor, saveState); + currentSplitterOrView()->view()->addCurrentPositionToNavigationHistory(editor, saveState); updateActions(); } void EditorManager::goBackInNavigationHistory() { - currentView()->view()->goBackInNavigationHistory(); + currentSplitterOrView()->view()->goBackInNavigationHistory(); updateActions(); ensureEditorManagerVisible(); return; @@ -1514,7 +1521,7 @@ void EditorManager::goBackInNavigationHistory() void EditorManager::goForwardInNavigationHistory() { - currentView()->view()->goForwardInNavigationHistory(); + currentSplitterOrView()->view()->goForwardInNavigationHistory(); updateActions(); ensureEditorManagerVisible(); } @@ -1609,7 +1616,7 @@ bool EditorManager::restoreState(const QByteArray &state) ensureEditorManagerVisible(); if (m_d->m_currentEditor) { m_d->m_currentEditor->widget()->setFocus(); - } else if (Core::Internal::SplitterOrView *view = currentView()) { + } else if (Core::Internal::SplitterOrView *view = currentSplitterOrView()) { if (IEditor *e = view->editor()) e->widget()->setFocus(); else if (view->view()) @@ -1683,16 +1690,6 @@ void EditorManager::revertToSaved() currEditor->file()->modified(&temp); } -Core::Internal::EditorView *EditorManager::currentEditorView() -{ - if (m_d->m_currentView) - return m_d->m_currentView->view(); - if (m_d->m_currentEditor) - if (SplitterOrView *splitterOrView = m_d->m_splitter->findView(m_d->m_currentEditor)) - return splitterOrView->view(); - return m_d->m_view; -} - void EditorManager::showEditorInfoBar(const QString &kind, const QString &infoText, const QString &buttonText, diff --git a/src/plugins/coreplugin/editormanager/editormanager.h b/src/plugins/coreplugin/editormanager/editormanager.h index c5e45da9ad031fb871e56a9e50c8212befbc1632..9243d7e5e6b947590f6267ab339ecbd4d07f48db 100644 --- a/src/plugins/coreplugin/editormanager/editormanager.h +++ b/src/plugins/coreplugin/editormanager/editormanager.h @@ -244,13 +244,13 @@ private: IEditor *openEditor(Core::Internal::EditorView *view, const QString &fileName, const QString &editorKind = QString(), OpenEditorFlags flags = 0); - Core::Internal::SplitterOrView *currentView() const; + Core::Internal::SplitterOrView *currentSplitterOrView() const; void closeEditor(Core::IEditor *editor); void closeDuplicate(Core::IEditor *editor); void closeView(Core::Internal::EditorView *view); void emptyView(Core::Internal::EditorView *view); - Core::Internal::EditorView *currentEditorView(); + Core::Internal::EditorView *currentEditorView() const; IEditor *pickUnusedEditor() const; diff --git a/src/plugins/coreplugin/editormanager/editorview.cpp b/src/plugins/coreplugin/editormanager/editorview.cpp index 8aaafc61e6e13711a2010c8704effcad7b4e3709..c5a211c6ef58f83b7b24d2cd637dce29d49ca47d 100644 --- a/src/plugins/coreplugin/editormanager/editorview.cpp +++ b/src/plugins/coreplugin/editormanager/editorview.cpp @@ -648,7 +648,7 @@ void SplitterOrView::focusInEvent(QFocusEvent *) void SplitterOrView::paintEvent(QPaintEvent *) { - if (CoreImpl::instance()->editorManager()->currentView() != this) + if (CoreImpl::instance()->editorManager()->currentSplitterOrView() != this) return; QPainter painter(this);