From 33845ba9172c542ac1a6389551b0aa5bf8570579 Mon Sep 17 00:00:00 2001 From: tpoole Date: Thu, 26 Oct 2017 12:19:00 +0100 Subject: [PATCH] Projucer: Open any previous projects in the background --- extras/Projucer/Source/Application/jucer_MainWindow.cpp | 9 +++++++-- extras/Projucer/Source/Application/jucer_MainWindow.h | 2 +- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/extras/Projucer/Source/Application/jucer_MainWindow.cpp b/extras/Projucer/Source/Application/jucer_MainWindow.cpp index 5c0e85b494..6e64bd3ddf 100644 --- a/extras/Projucer/Source/Application/jucer_MainWindow.cpp +++ b/extras/Projucer/Source/Application/jucer_MainWindow.cpp @@ -457,7 +457,7 @@ void MainWindowList::openDocument (OpenDocumentManager::Document* doc, bool grab getFrontmostWindow()->getProjectContentComponent()->showDocument (doc, grabFocus); } -bool MainWindowList::openFile (const File& file) +bool MainWindowList::openFile (const File& file, bool openInBackground) { for (int i = windows.size(); --i >= 0;) { @@ -472,12 +472,17 @@ bool MainWindowList::openFile (const File& file) if (file.hasFileExtension (Project::projectFileExtension)) { + auto previousFrontWindow = getFrontmostWindow(); + MainWindow* const w = getOrCreateEmptyWindow(); bool ok = w->openFile (file); w->makeVisible(); avoidSuperimposedWindows (w); + if (openInBackground && (previousFrontWindow != nullptr)) + previousFrontWindow->toFront (true); + return ok; } @@ -581,7 +586,7 @@ void MainWindowList::reopenLastProjects() Array projects (getAppSettings().getLastProjects()); for (int i = 0; i < projects.size(); ++ i) - openFile (projects.getReference(i)); + openFile (projects.getReference(i), true); } void MainWindowList::sendLookAndFeelChange() diff --git a/extras/Projucer/Source/Application/jucer_MainWindow.h b/extras/Projucer/Source/Application/jucer_MainWindow.h index e01e8ec4bf..b934067c75 100644 --- a/extras/Projucer/Source/Application/jucer_MainWindow.h +++ b/extras/Projucer/Source/Application/jucer_MainWindow.h @@ -98,7 +98,7 @@ public: void createWindowIfNoneAreOpen(); void openDocument (OpenDocumentManager::Document*, bool grabFocus); - bool openFile (const File& file); + bool openFile (const File& file, bool openInBackground = false); MainWindow* createNewMainWindow(); MainWindow* getFrontmostWindow (bool createIfNotFound = true);