forked from qt-creator/qt-creator
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:
@@ -110,8 +110,7 @@ QList<Locator::FilterEntry> CppCurrentDocumentFilter::matchesFor(QFutureInterfac
|
||||
void CppCurrentDocumentFilter::accept(Locator::FilterEntry selection) const
|
||||
{
|
||||
ModelItemInfo info = qvariant_cast<CppTools::ModelItemInfo>(selection.internalData);
|
||||
Core::EditorManager::openEditorAt(info.fileName, info.line, info.column,
|
||||
Core::Id(), Core::EditorManager::ModeSwitch);
|
||||
Core::EditorManager::openEditorAt(info.fileName, info.line, info.column);
|
||||
}
|
||||
|
||||
void CppCurrentDocumentFilter::refresh(QFutureInterface<void> &future)
|
||||
|
||||
@@ -305,8 +305,7 @@ void CppFileSettingsWidget::slotEdit()
|
||||
setLicenseTemplatePath(path);
|
||||
}
|
||||
// Edit (now) existing file with C++
|
||||
Core::EditorManager::openEditor(path, CppEditor::Constants::CPPEDITOR_ID,
|
||||
Core::EditorManager::ModeSwitch);
|
||||
Core::EditorManager::openEditor(path, CppEditor::Constants::CPPEDITOR_ID);
|
||||
}
|
||||
|
||||
// --------------- CppFileSettingsPage
|
||||
|
||||
@@ -510,12 +510,9 @@ void CppFindReferences::openEditor(const Find::SearchResultItem &item)
|
||||
{
|
||||
if (item.path.size() > 0) {
|
||||
Core::EditorManager::openEditorAt(QDir::fromNativeSeparators(item.path.first()),
|
||||
item.lineNumber, item.textMarkPos,
|
||||
Core::Id(),
|
||||
Core::EditorManager::ModeSwitch);
|
||||
item.lineNumber, item.textMarkPos);
|
||||
} else {
|
||||
Core::EditorManager::openEditor(QDir::fromNativeSeparators(item.text),
|
||||
Core::Id(), Core::EditorManager::ModeSwitch);
|
||||
Core::EditorManager::openEditor(QDir::fromNativeSeparators(item.text));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -177,8 +177,7 @@ QList<Locator::FilterEntry> CppLocatorFilter::matchesFor(QFutureInterface<Locato
|
||||
void CppLocatorFilter::accept(Locator::FilterEntry selection) const
|
||||
{
|
||||
ModelItemInfo info = qvariant_cast<CppTools::ModelItemInfo>(selection.internalData);
|
||||
Core::EditorManager::openEditorAt(info.fileName, info.line, info.column,
|
||||
Core::Id(), Core::EditorManager::ModeSwitch);
|
||||
Core::EditorManager::openEditorAt(info.fileName, info.line, info.column);
|
||||
}
|
||||
|
||||
void CppLocatorFilter::reset()
|
||||
|
||||
@@ -164,8 +164,7 @@ void CppToolsPlugin::switchHeaderSourceInNextSplit()
|
||||
QString otherFile = correspondingHeaderOrSource(
|
||||
Core::EditorManager::currentEditor()->document()->fileName());
|
||||
if (!otherFile.isEmpty())
|
||||
Core::EditorManager::openEditor(otherFile, Core::Id(), Core::EditorManager::OpenInOtherSplit
|
||||
| Core::EditorManager::ModeSwitch);
|
||||
Core::EditorManager::openEditor(otherFile, Core::Id(), Core::EditorManager::OpenInOtherSplit);
|
||||
}
|
||||
|
||||
static QStringList findFilesInProject(const QString &name,
|
||||
|
||||
Reference in New Issue
Block a user