Commit 6a4310a4 authored by Eike Ziller's avatar Eike Ziller Committed by David Schulz

EditorManager: Remove code duplication.

Change-Id: I366852f788c1d28351e9f853b16d180886892c55
Reviewed-by: default avatarDavid Schulz <david.schulz@digia.com>
parent b1bb093d
...@@ -2176,11 +2176,7 @@ Core::IEditor *EditorManager::duplicateEditor(Core::IEditor *editor) ...@@ -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() ...@@ -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() ...@@ -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);
......
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