From 2ca1f2e704a6a7a25f5e6ccc80e66466f0b40966 Mon Sep 17 00:00:00 2001 From: jules Date: Thu, 13 Jun 2013 16:35:23 +0100 Subject: [PATCH] Introjucer module updater fix. --- .../Source/Application/jucer_Application.h | 2 +- .../Source/Application/jucer_MainWindow.cpp | 12 ++++++++++++ .../Introjucer/Source/Application/jucer_MainWindow.h | 2 ++ 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/extras/Introjucer/Source/Application/jucer_Application.h b/extras/Introjucer/Source/Application/jucer_Application.h index c5ff6ba195..23309f277d 100644 --- a/extras/Introjucer/Source/Application/jucer_Application.h +++ b/extras/Introjucer/Source/Application/jucer_Application.h @@ -486,7 +486,7 @@ public: bool runModuleUpdate (const String& message) { ModuleList list; - list.rescan (ModuleList::getDefaultModulesFolder (nullptr)); + list.rescan (ModuleList::getDefaultModulesFolder (mainWindowList.getFrontmostProject())); JuceUpdater::show (list, mainWindowList.windows[0], message); ModuleList::setLocalModulesFolder (list.getModulesFolder()); diff --git a/extras/Introjucer/Source/Application/jucer_MainWindow.cpp b/extras/Introjucer/Source/Application/jucer_MainWindow.cpp index 9d618440b2..51d43a3aa6 100644 --- a/extras/Introjucer/Source/Application/jucer_MainWindow.cpp +++ b/extras/Introjucer/Source/Application/jucer_MainWindow.cpp @@ -528,3 +528,15 @@ void MainWindowList::sendLookAndFeelChange() for (int i = windows.size(); --i >= 0;) windows.getUnchecked(i)->sendLookAndFeelChange(); } + +Project* MainWindowList::getFrontmostProject() +{ + Desktop& desktop = Desktop::getInstance(); + + for (int i = 0; i < desktop.getNumComponents(); ++i) + if (MainWindow* const mw = dynamic_cast (desktop.getComponent(i))) + if (Project* p = mw->getProject()) + return p; + + return nullptr; +} diff --git a/extras/Introjucer/Source/Application/jucer_MainWindow.h b/extras/Introjucer/Source/Application/jucer_MainWindow.h index 8ce115215e..61468a401f 100644 --- a/extras/Introjucer/Source/Application/jucer_MainWindow.h +++ b/extras/Introjucer/Source/Application/jucer_MainWindow.h @@ -102,6 +102,8 @@ public: MainWindow* getOrCreateFrontmostWindow(); MainWindow* getOrCreateEmptyWindow(); + Project* getFrontmostProject(); + void reopenLastProjects(); void saveCurrentlyOpenProjectList();