Switch less often to edit mode

This change
* Removes IMode::type, ModeManager::activateModeType, and
  IEditor::preferredModeType, and adds IEditor::isDesignModePreferred
  instead
* Adapts the mode switching code in EditorManager to handle multiple
  windows, for example switching to edit mode should only happen if
  the editor/view is in the main window. Otherwise the editor window
  should be raised and focused
* Renames EditorManager::NoActivate --> DoNotChangeCurrentEditor
* Reverts the EditorManager::ModeSwitch logic to switch mode or
  make the current editor visible by default, introducing
  DoNotMakeVisible flag instead
* Fixes a few instances where EditorManager::ModeSwitch should have been
  used

One non-trivial problem left: If you open a .ui file and switch to an
external editor window, edit mode is activated, because the current
editor no longer is a .ui file, which means that the design mode gets
deactivated.

Change-Id: I76c5c2391eb4090143b778fb103acff3a5a1ff41
Reviewed-by: David Schulz <david.schulz@digia.com>
This commit is contained in:
Eike Ziller
2013-05-31 12:52:53 +02:00
parent f99ce422b4
commit 7c8db79817
74 changed files with 135 additions and 233 deletions

View File

@@ -816,7 +816,7 @@ VcsBase::VcsBaseEditorWidget *GitClient::findExistingVCSEditor(const char *regis
return 0;
// Exists already
Core::EditorManager::activateEditor(outputEditor, Core::EditorManager::ModeSwitch);
Core::EditorManager::activateEditor(outputEditor);
outputEditor->createNew(m_msgWait);
rc = VcsBase::VcsBaseEditorWidget::getVcsBaseEditor(outputEditor);
@@ -829,7 +829,7 @@ DiffEditor::DiffEditor *GitClient::findExistingOrOpenNewDiffEditor(const char *r
Core::IEditor *outputEditor = locateEditor(registerDynamicProperty, dynamicPropertyValue);
if (outputEditor) {
// Exists already
Core::EditorManager::activateEditor(outputEditor, Core::EditorManager::ModeSwitch);
Core::EditorManager::activateEditor(outputEditor);
outputEditor->createNew(m_msgWait);
}
@@ -840,7 +840,7 @@ DiffEditor::DiffEditor *GitClient::findExistingOrOpenNewDiffEditor(const char *r
editor = qobject_cast<DiffEditor::DiffEditor *>(
Core::EditorManager::openEditorWithContents(editorId, &title, m_msgWait));
editor->document()->setProperty(registerDynamicProperty, dynamicPropertyValue);
Core::EditorManager::activateEditor(editor, Core::EditorManager::ModeSwitch); // should probably go outside this block
Core::EditorManager::activateEditor(editor); // should probably go outside this block
}
return editor;
}
@@ -881,7 +881,7 @@ VcsBase::VcsBaseEditorWidget *GitClient::createVcsEditor(const Core::Id &id,
}
rc->setForceReadOnly(true);
Core::EditorManager::activateEditor(outputEditor, Core::EditorManager::ModeSwitch);
Core::EditorManager::activateEditor(outputEditor);
if (configWidget)
rc->setConfigurationWidget(configWidget);