From fe49d69dfc9f2cc0755fce34e7b1bc63916f910a Mon Sep 17 00:00:00 2001 From: ed Date: Mon, 5 Nov 2018 16:12:32 +0000 Subject: [PATCH] Projucer: Added a "VST (Legacy) SDK" field to the global paths window and re-factored the global paths window a bit --- .../MacOSX/Projucer.xcodeproj/project.pbxproj | 8 + .../VisualStudio2013/Projucer_App.vcxproj | 1 + .../Projucer_App.vcxproj.filters | 3 + .../VisualStudio2015/Projucer_App.vcxproj | 1 + .../Projucer_App.vcxproj.filters | 3 + .../VisualStudio2017/Projucer_App.vcxproj | 1 + .../Projucer_App.vcxproj.filters | 3 + extras/Projucer/Projucer.jucer | 2 + .../jucer_GlobalPathsWindowComponent.h | 277 +++++++++--------- .../Source/Application/jucer_Application.cpp | 2 +- .../Projucer/Source/Project/jucer_Project.cpp | 6 +- .../ProjectSaving/jucer_ProjectExport_MSVC.h | 16 +- .../ProjectSaving/jucer_ProjectExport_Xcode.h | 14 +- .../ProjectSaving/jucer_ProjectExporter.cpp | 18 ++ .../ProjectSaving/jucer_ProjectExporter.h | 4 +- .../Source/Settings/jucer_StoredSettings.cpp | 6 +- .../Source/Utility/Helpers/jucer_PresetIDs.h | 2 + .../jucer_LabelPropertyComponent.h | 74 +++++ 18 files changed, 287 insertions(+), 154 deletions(-) create mode 100644 extras/Projucer/Source/Utility/UI/PropertyComponents/jucer_LabelPropertyComponent.h diff --git a/extras/Projucer/Builds/MacOSX/Projucer.xcodeproj/project.pbxproj b/extras/Projucer/Builds/MacOSX/Projucer.xcodeproj/project.pbxproj index beded00060..c77b5e00ae 100644 --- a/extras/Projucer/Builds/MacOSX/Projucer.xcodeproj/project.pbxproj +++ b/extras/Projucer/Builds/MacOSX/Projucer.xcodeproj/project.pbxproj @@ -818,6 +818,13 @@ path = "../../Source/Wizards/jucer_ProjectWizard_Animated.h"; sourceTree = "SOURCE_ROOT"; }; + 3D36F0CEB84B27BD02FC461A = { + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + name = "jucer_LabelPropertyComponent.h"; + path = "../../Source/Utility/UI/PropertyComponents/jucer_LabelPropertyComponent.h"; + sourceTree = "SOURCE_ROOT"; + }; 3D6FD9C0065BF16568EC0AB7 = { isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; @@ -3022,6 +3029,7 @@ children = ( 9EB33734D0DBD0370AB1247B, E367FC2BDAF5EBA48D767FBB, + 3D36F0CEB84B27BD02FC461A, 59F8A47C0020D62C8836A1E7, ); name = PropertyComponents; diff --git a/extras/Projucer/Builds/VisualStudio2013/Projucer_App.vcxproj b/extras/Projucer/Builds/VisualStudio2013/Projucer_App.vcxproj index 00f4ae2b0a..19ee89f129 100644 --- a/extras/Projucer/Builds/VisualStudio2013/Projucer_App.vcxproj +++ b/extras/Projucer/Builds/VisualStudio2013/Projucer_App.vcxproj @@ -1619,6 +1619,7 @@ + diff --git a/extras/Projucer/Builds/VisualStudio2013/Projucer_App.vcxproj.filters b/extras/Projucer/Builds/VisualStudio2013/Projucer_App.vcxproj.filters index b83d15f2a0..80e1150c58 100644 --- a/extras/Projucer/Builds/VisualStudio2013/Projucer_App.vcxproj.filters +++ b/extras/Projucer/Builds/VisualStudio2013/Projucer_App.vcxproj.filters @@ -2325,6 +2325,9 @@ Projucer\Utility\UI\PropertyComponents + + Projucer\Utility\UI\PropertyComponents + Projucer\Utility\UI\PropertyComponents diff --git a/extras/Projucer/Builds/VisualStudio2015/Projucer_App.vcxproj b/extras/Projucer/Builds/VisualStudio2015/Projucer_App.vcxproj index 9d247a7b2f..2a963c43cd 100644 --- a/extras/Projucer/Builds/VisualStudio2015/Projucer_App.vcxproj +++ b/extras/Projucer/Builds/VisualStudio2015/Projucer_App.vcxproj @@ -1619,6 +1619,7 @@ + diff --git a/extras/Projucer/Builds/VisualStudio2015/Projucer_App.vcxproj.filters b/extras/Projucer/Builds/VisualStudio2015/Projucer_App.vcxproj.filters index d9c9e4dd18..99cfe492bb 100644 --- a/extras/Projucer/Builds/VisualStudio2015/Projucer_App.vcxproj.filters +++ b/extras/Projucer/Builds/VisualStudio2015/Projucer_App.vcxproj.filters @@ -2325,6 +2325,9 @@ Projucer\Utility\UI\PropertyComponents + + Projucer\Utility\UI\PropertyComponents + Projucer\Utility\UI\PropertyComponents diff --git a/extras/Projucer/Builds/VisualStudio2017/Projucer_App.vcxproj b/extras/Projucer/Builds/VisualStudio2017/Projucer_App.vcxproj index a2d7df4e7f..21002462ca 100644 --- a/extras/Projucer/Builds/VisualStudio2017/Projucer_App.vcxproj +++ b/extras/Projucer/Builds/VisualStudio2017/Projucer_App.vcxproj @@ -1621,6 +1621,7 @@ + diff --git a/extras/Projucer/Builds/VisualStudio2017/Projucer_App.vcxproj.filters b/extras/Projucer/Builds/VisualStudio2017/Projucer_App.vcxproj.filters index 9b37792bf5..db33f63ec5 100644 --- a/extras/Projucer/Builds/VisualStudio2017/Projucer_App.vcxproj.filters +++ b/extras/Projucer/Builds/VisualStudio2017/Projucer_App.vcxproj.filters @@ -2325,6 +2325,9 @@ Projucer\Utility\UI\PropertyComponents + + Projucer\Utility\UI\PropertyComponents + Projucer\Utility\UI\PropertyComponents diff --git a/extras/Projucer/Projucer.jucer b/extras/Projucer/Projucer.jucer index 55909bd625..d9e2cd0cd8 100644 --- a/extras/Projucer/Projucer.jucer +++ b/extras/Projucer/Projucer.jucer @@ -657,6 +657,8 @@ resource="0" file="Source/Utility/UI/PropertyComponents/jucer_ColourPropertyComponent.h"/> + diff --git a/extras/Projucer/Source/Application/Windows/jucer_GlobalPathsWindowComponent.h b/extras/Projucer/Source/Application/Windows/jucer_GlobalPathsWindowComponent.h index 9b5e538f24..29a71d3c14 100644 --- a/extras/Projucer/Source/Application/Windows/jucer_GlobalPathsWindowComponent.h +++ b/extras/Projucer/Source/Application/Windows/jucer_GlobalPathsWindowComponent.h @@ -26,51 +26,63 @@ #pragma once +#include "../../Utility/UI/PropertyComponents/jucer_LabelPropertyComponent.h" //============================================================================== class GlobalPathsWindowComponent : public Component, - private Timer + private Timer, + private Value::Listener { public: GlobalPathsWindowComponent() { - addLabelsAndSetProperties(); - - addAndMakeVisible (info); - info.setInfoToDisplay ("Use this dropdown to set the global paths for different OSes. " - "\nN.B. These paths are stored locally and will only be used when " - "saving a project on this machine. Other machines will have their own " - "locally stored paths."); - - addAndMakeVisible (osSelector); - osSelector.addItem ("OSX", 1); - osSelector.addItem ("Windows", 2); - osSelector.addItem ("Linux", 3); - - osSelector.onChange = [this] + addChildComponent (rescanJUCEPathButton); + rescanJUCEPathButton.onClick = [this] { - addLabelsAndSetProperties(); - updateValues(); - updateFilePathPropertyComponents(); + ProjucerApplication::getApp().rescanJUCEPathModules(); + lastJUCEModulePath = getAppSettings().getStoredPath (Ids::defaultJuceModulePath, TargetOS::getThisOS()).get(); }; - auto os = TargetOS::getThisOS(); - - if (os == TargetOS::osx) osSelector.setSelectedId (1); - else if (os == TargetOS::windows) osSelector.setSelectedId (2); - else if (os == TargetOS::linux) osSelector.setSelectedId (3); - - addChildComponent (rescanJUCEPathButton); - rescanJUCEPathButton.onClick = [] { ProjucerApplication::getApp().rescanJUCEPathModules(); }; - addChildComponent (rescanUserPathButton); - rescanUserPathButton.onClick = [] { ProjucerApplication::getApp().rescanUserPathModules(); }; + rescanUserPathButton.onClick = [this] + { + ProjucerApplication::getApp().rescanUserPathModules(); + lastUserModulePath = getAppSettings().getStoredPath (Ids::defaultUserModulePath, TargetOS::getThisOS()).get(); + }; addAndMakeVisible (resetToDefaultsButton); resetToDefaultsButton.onClick = [this] { resetCurrentOSPathsToDefaults(); }; - updateValues(); - updateFilePathPropertyComponents(); + addAndMakeVisible (propertyViewport); + propertyViewport.setViewedComponent (&propertyGroup, false); + + auto os = TargetOS::getThisOS(); + + if (os == TargetOS::osx) selectedOSValue = "osx"; + else if (os == TargetOS::windows) selectedOSValue = "windows"; + else if (os == TargetOS::linux) selectedOSValue = "linux"; + + selectedOSValue.addListener (this); + + buildProps(); + + lastJUCEModulePath = getAppSettings().getStoredPath (Ids::defaultJuceModulePath, TargetOS::getThisOS()).get(); + lastUserModulePath = getAppSettings().getStoredPath (Ids::defaultUserModulePath, TargetOS::getThisOS()).get(); + } + + ~GlobalPathsWindowComponent() + { + auto juceValue = getAppSettings().getStoredPath (Ids::defaultJuceModulePath, TargetOS::getThisOS()); + auto userValue = getAppSettings().getStoredPath (Ids::defaultUserModulePath, TargetOS::getThisOS()); + + auto jucePathNeedsScanning = (! juceValue.isUsingDefault() && juceValue.get() != lastJUCEModulePath); + auto userPathNeedsScanning = (! userValue.isUsingDefault() && userValue.get() != lastUserModulePath); + + if (jucePathNeedsScanning) + ProjucerApplication::getApp().rescanJUCEPathModules(); + + if (userPathNeedsScanning) + ProjucerApplication::getApp().rescanUserPathModules(); } void paint (Graphics& g) override @@ -88,59 +100,31 @@ public: { auto b = getLocalBounds().reduced (10); - auto topSlice = b.removeFromTop (25); - osSelector.setSize (200, 25); - osSelector.setCentrePosition (topSlice.getCentre()); + auto buttonBounds = b.removeFromBottom (50); - info.setBounds (osSelector.getBounds().withWidth (osSelector.getHeight()).translated ((osSelector.getWidth() + 5), 0).reduced (2)); + rescanJUCEPathButton.setBounds (buttonBounds.removeFromLeft (150).reduced (5, 10)); + rescanUserPathButton.setBounds (buttonBounds.removeFromLeft (150).reduced (5, 10)); - int labelIndex = 0; - bool isFirst = true; - bool showRescanButtons = (rescanJUCEPathButton.isVisible() && rescanUserPathButton.isVisible()); + resetToDefaultsButton.setBounds (buttonBounds.removeFromRight (150).reduced (5, 10)); - for (auto* pathComp : pathPropertyComponents) - { - if (pathComp == nullptr) - { - b.removeFromTop (15); - pathPropertyLabels.getUnchecked (labelIndex++)->setBounds (b.removeFromTop (20)); - b.removeFromTop (20); - } - else - { - if (isFirst) - b.removeFromTop (20); - - auto compBounds = b.removeFromTop (pathComp->getPreferredHeight()); - - if (showRescanButtons) - { - auto propName = pathComp->getName(); - - if (propName == "JUCE Modules") - rescanJUCEPathButton.setBounds (compBounds.removeFromRight (75).reduced (5, 0)); - else if (propName == "User Modules") - rescanUserPathButton.setBounds (compBounds.removeFromRight (75).reduced (5, 0)); - } - - - pathComp->setBounds (compBounds); - b.removeFromTop (5); - } - - isFirst = false; - } - - resetToDefaultsButton.setBounds (b.removeFromBottom (35).reduced (150, 0)); + propertyGroup.updateSize (0, 0, getWidth() - 20 - propertyViewport.getScrollBarThickness()); + propertyViewport.setBounds (b); } void highlightJUCEPath() { - if (! isTimerRunning() && isSelectedOSThisOS()) - { - if (auto* jucePathComp = pathPropertyComponents.getFirst()) - boundsToHighlight = jucePathComp->getBounds(); + if (isTimerRunning() || ! isSelectedOSThisOS()) + return; + PropertyComponent* jucePathPropertyComponent = nullptr; + + for (auto* prop : propertyGroup.properties) + if (prop->getName() == "Path to JUCE") + jucePathPropertyComponent = prop; + + if (jucePathPropertyComponent != nullptr) + { + boundsToHighlight = getLocalArea (&propertyGroup, jucePathPropertyComponent->getBounds()); flashAlpha = 0.0f; hasFlashed = false; @@ -149,22 +133,6 @@ public: } private: - ValueWithDefault jucePathValue, juceModulePathValue, userModulePathValue, vst3PathValue, rtasPathValue, aaxPathValue, - androidSDKPathValue, androidNDKPathValue, clionExePathValue, androidStudioExePathValue; - - OwnedArray