1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-10 23:44:24 +00:00

Projucer: Open any previous projects in the background

This commit is contained in:
tpoole 2017-10-26 12:19:00 +01:00
parent 98f37e02ae
commit 33845ba917
2 changed files with 8 additions and 3 deletions

View file

@ -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<File> projects (getAppSettings().getLastProjects());
for (int i = 0; i < projects.size(); ++ i)
openFile (projects.getReference(i));
openFile (projects.getReference(i), true);
}
void MainWindowList::sendLookAndFeelChange()

View file

@ -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);