diff --git a/extras/Introjucer/Source/Project/jucer_Module.cpp b/extras/Introjucer/Source/Project/jucer_Module.cpp index 1cc8d3827a..61e832ae3c 100644 --- a/extras/Introjucer/Source/Project/jucer_Module.cpp +++ b/extras/Introjucer/Source/Project/jucer_Module.cpp @@ -472,6 +472,14 @@ void LibraryModule::createLocalHeaderWrapper (ProjectSaver& projectSaver, const } //============================================================================== +File LibraryModule::getLocalFolderFor (Project& project) const +{ + if (project.shouldCopyModuleFilesLocally (getID()).getValue()) + return project.getGeneratedCodeFolder().getChildFile ("modules").getChildFile (getID()); + else + return moduleFolder; +} + void LibraryModule::prepareExporter (ProjectExporter& exporter, ProjectSaver& projectSaver) const { Project& project = exporter.getProject(); @@ -649,7 +657,7 @@ void LibraryModule::findAndAddCompiledCode (ProjectExporter& exporter, ProjectSa } } -void LibraryModule::getLocalCompiledFiles (Array& result) const +void LibraryModule::getLocalCompiledFiles (const File& localModuleFolder, Array& result) const { const var compileArray (moduleInfo ["compile"]); // careful to keep this alive while the array is in use! const Array* const files = compileArray.getArray(); @@ -671,8 +679,7 @@ void LibraryModule::getLocalCompiledFiles (Array& result) const #endif ) { - const File compiledFile (moduleFolder.getChildFile (filename)); - result.add (compiledFile); + result.add (localModuleFolder.getChildFile (filename)); } } } diff --git a/extras/Introjucer/Source/Project/jucer_Module.h b/extras/Introjucer/Source/Project/jucer_Module.h index eedb7a211e..418861db16 100644 --- a/extras/Introjucer/Source/Project/jucer_Module.h +++ b/extras/Introjucer/Source/Project/jucer_Module.h @@ -50,7 +50,8 @@ public: void prepareExporter (ProjectExporter&, ProjectSaver&) const; void createPropertyEditors (ProjectExporter&, PropertyListBuilder&) const; void getConfigFlags (Project&, OwnedArray& flags) const; - void getLocalCompiledFiles (Array& files) const; + void getLocalCompiledFiles (const File& localModuleFolder, Array& files) const; + File getLocalFolderFor (Project&) const; static String getInfoFileName() { return "juce_module_info"; } diff --git a/extras/Introjucer/Source/Utility/jucer_JucerTreeViewBase.cpp b/extras/Introjucer/Source/Utility/jucer_JucerTreeViewBase.cpp index 0b297a83b3..5464d51f79 100644 --- a/extras/Introjucer/Source/Utility/jucer_JucerTreeViewBase.cpp +++ b/extras/Introjucer/Source/Utility/jucer_JucerTreeViewBase.cpp @@ -67,12 +67,16 @@ void TreePanelBase::saveOpenness() } //============================================================================== -JucerTreeViewBase::JucerTreeViewBase() - : textX (0) +JucerTreeViewBase::JucerTreeViewBase() : textX (0) { setLinesDrawnForSubItems (false); } +JucerTreeViewBase::~JucerTreeViewBase() +{ + masterReference.clear(); +} + void JucerTreeViewBase::refreshSubItems() { WholeTreeOpennessRestorer openness (*this); @@ -207,15 +211,16 @@ void JucerTreeViewBase::showDocument() {} void JucerTreeViewBase::showPopupMenu() {} void JucerTreeViewBase::showMultiSelectionPopupMenu() {} -static void treeViewMenuItemChosen (int resultCode, JucerTreeViewBase* item) +static void treeViewMenuItemChosen (int resultCode, WeakReference item) { - item->handlePopupMenuResult (resultCode); + if (item != nullptr) + item->handlePopupMenuResult (resultCode); } void JucerTreeViewBase::launchPopupMenu (PopupMenu& m) { m.showMenuAsync (PopupMenu::Options(), - ModalCallbackFunction::create (treeViewMenuItemChosen, this)); + ModalCallbackFunction::create (treeViewMenuItemChosen, WeakReference (this))); } void JucerTreeViewBase::handlePopupMenuResult (int) @@ -236,7 +241,7 @@ ProjectContentComponent* JucerTreeViewBase::getProjectContentComponent() const c = c->getParentComponent(); } - return 0; + return nullptr; } //============================================================================== diff --git a/extras/Introjucer/Source/Utility/jucer_JucerTreeViewBase.h b/extras/Introjucer/Source/Utility/jucer_JucerTreeViewBase.h index 46388b20ed..97f1a7bc21 100644 --- a/extras/Introjucer/Source/Utility/jucer_JucerTreeViewBase.h +++ b/extras/Introjucer/Source/Utility/jucer_JucerTreeViewBase.h @@ -35,6 +35,7 @@ class JucerTreeViewBase : public TreeViewItem { public: JucerTreeViewBase(); + ~JucerTreeViewBase(); int getItemWidth() const { return -1; } int getItemHeight() const { return 20; } @@ -102,6 +103,9 @@ private: friend class ItemSelectionTimer; ScopedPointer delayedSelectionTimer; + WeakReference::Master masterReference; + friend class WeakReference; + void invokeShowDocument(); };