forked from qt-creator/qt-creator
EditorManager: Remove code duplication.
Change-Id: I366852f788c1d28351e9f853b16d180886892c55 Reviewed-by: David Schulz <david.schulz@digia.com>
This commit is contained in:
committed by
David Schulz
parent
b1bb093d15
commit
6a4310a44a
@@ -2176,11 +2176,7 @@ Core::IEditor *EditorManager::duplicateEditor(Core::IEditor *editor)
|
|||||||
|
|
||||||
void EditorManager::split(Qt::Orientation orientation)
|
void EditorManager::split(Qt::Orientation orientation)
|
||||||
{
|
{
|
||||||
SplitterOrView *view = d->m_currentView;
|
SplitterOrView *view = currentSplitterOrView();
|
||||||
|
|
||||||
if (!view)
|
|
||||||
view = d->m_currentEditor ? d->m_splitter->findView(d->m_currentEditor)
|
|
||||||
: d->m_splitter->findFirstView();
|
|
||||||
|
|
||||||
if (view && !view->splitter())
|
if (view && !view->splitter())
|
||||||
view->split(orientation);
|
view->split(orientation);
|
||||||
@@ -2200,9 +2196,7 @@ void EditorManager::splitSideBySide()
|
|||||||
|
|
||||||
void EditorManager::removeCurrentSplit()
|
void EditorManager::removeCurrentSplit()
|
||||||
{
|
{
|
||||||
SplitterOrView *viewToClose = d->m_currentView;
|
SplitterOrView *viewToClose = currentSplitterOrView();
|
||||||
if (!viewToClose && d->m_currentEditor)
|
|
||||||
viewToClose = d->m_splitter->findView(d->m_currentEditor);
|
|
||||||
|
|
||||||
if (!viewToClose || viewToClose->isSplitter() || viewToClose == d->m_splitter)
|
if (!viewToClose || viewToClose->isSplitter() || viewToClose == d->m_splitter)
|
||||||
return;
|
return;
|
||||||
@@ -2231,14 +2225,7 @@ void EditorManager::gotoOtherSplit()
|
|||||||
if (!d->m_splitter->isSplitter())
|
if (!d->m_splitter->isSplitter())
|
||||||
splitSideBySide();
|
splitSideBySide();
|
||||||
|
|
||||||
SplitterOrView *currentView = d->m_currentView;
|
SplitterOrView *view = currentSplitterOrView();
|
||||||
if (!currentView && d->m_currentEditor)
|
|
||||||
currentView = d->m_splitter->findView(d->m_currentEditor);
|
|
||||||
if (!currentView)
|
|
||||||
currentView = d->m_splitter->findFirstView();
|
|
||||||
SplitterOrView *view = d->m_splitter->findNextView(currentView);
|
|
||||||
if (!view)
|
|
||||||
view = d->m_splitter->findFirstView();
|
|
||||||
if (view) {
|
if (view) {
|
||||||
if (IEditor *editor = view->editor()) {
|
if (IEditor *editor = view->editor()) {
|
||||||
setCurrentEditor(editor, true);
|
setCurrentEditor(editor, true);
|
||||||
|
Reference in New Issue
Block a user