From ecf97e2a0804732eba44e76e8a2a3b3e2c324dfe Mon Sep 17 00:00:00 2001 From: ed Date: Thu, 14 Nov 2019 09:03:20 +0000 Subject: [PATCH] Projucer: Removed some unused code from the FilePathPropertyComponent --- .../jucer_GlobalPathsWindowComponent.h | 2 +- .../jucer_FilePathPropertyComponent.h | 56 +++++++------------ 2 files changed, 22 insertions(+), 36 deletions(-) diff --git a/extras/Projucer/Source/Application/Windows/jucer_GlobalPathsWindowComponent.h b/extras/Projucer/Source/Application/Windows/jucer_GlobalPathsWindowComponent.h index 94505ffd35..4dee4ce789 100644 --- a/extras/Projucer/Source/Application/Windows/jucer_GlobalPathsWindowComponent.h +++ b/extras/Projucer/Source/Application/Windows/jucer_GlobalPathsWindowComponent.h @@ -197,7 +197,7 @@ private: builder.add (new FilePathPropertyComponent (juceModulePathValue, "JUCE Modules", true, isThisOS), String ("This should be the path to the folder containing the JUCE modules that you wish to use, typically the \"modules\" directory of your JUCE folder.") + (isThisOS ? " Use the button below to re-scan a new path." : "")); - builder.add (new FilePathPropertyComponent (userModulePathValue, "User Modules", true, isThisOS, {}, {}, true), + builder.add (new FilePathPropertyComponent (userModulePathValue, "User Modules", true, isThisOS), String ("A path to a folder containing any custom modules that you wish to use.") + (isThisOS ? " Use the button below to re-scan new paths." : "")); diff --git a/extras/Projucer/Source/Utility/UI/PropertyComponents/jucer_FilePathPropertyComponent.h b/extras/Projucer/Source/Utility/UI/PropertyComponents/jucer_FilePathPropertyComponent.h index ed558a21c2..bda4a63a0a 100644 --- a/extras/Projucer/Source/Utility/UI/PropertyComponents/jucer_FilePathPropertyComponent.h +++ b/extras/Projucer/Source/Utility/UI/PropertyComponents/jucer_FilePathPropertyComponent.h @@ -39,25 +39,23 @@ class FilePathPropertyComponent : public PropertyComponent, { public: FilePathPropertyComponent (Value valueToControl, const String& propertyName, bool isDir, bool thisOS = true, - const String& wildcardsToUse = "*", const File& relativeRoot = File(), bool multiPath = false) + const String& wildcardsToUse = "*", const File& relativeRoot = File()) : PropertyComponent (propertyName), text (valueToControl, propertyName, 1024, false), - isDirectory (isDir), isThisOS (thisOS), supportsMultiplePaths (multiPath), wildcards (wildcardsToUse), root (relativeRoot) + isDirectory (isDir), isThisOS (thisOS), wildcards (wildcardsToUse), root (relativeRoot) { textValue.referTo (valueToControl); - init(); } /** Displays a default value when no value is specified by the user. */ FilePathPropertyComponent (ValueWithDefault& valueToControl, const String& propertyName, bool isDir, bool thisOS = true, - const String& wildcardsToUse = "*", const File& relativeRoot = File(), bool multiPath = false) + const String& wildcardsToUse = "*", const File& relativeRoot = File()) : PropertyComponent (propertyName), text (valueToControl, propertyName, 1024, false), - isDirectory (isDir), isThisOS (thisOS), supportsMultiplePaths (multiPath), wildcards (wildcardsToUse), root (relativeRoot) + isDirectory (isDir), isThisOS (thisOS), wildcards (wildcardsToUse), root (relativeRoot) { textValue = valueToControl.getPropertyAsValue(); - init(); } @@ -89,15 +87,8 @@ public: void filesDropped (const StringArray& selectedFiles, int, int) override { - if (supportsMultiplePaths) - { - for (auto& f : selectedFiles) - setTo (f); - } - else - { - setTo (selectedFiles[0]); - } + + setTo (selectedFiles[0]); highlightForDragAndDrop = false; repaint(); @@ -126,11 +117,6 @@ private: auto pathName = (root == File()) ? f.getFullPathName() : f.getRelativePathFrom (root); - auto currentPath = text.getText(); - - if (supportsMultiplePaths && currentPath.isNotEmpty()) - pathName = currentPath.trimCharactersAtEnd (" ;") + "; " + pathName; - text.setText (pathName); updateEditorColour(); } @@ -160,24 +146,24 @@ private: void updateEditorColour() { - if (supportsMultiplePaths || ! isThisOS) - return; - - text.setColour (TextPropertyComponent::textColourId, findColour (widgetTextColourId)); + if (isThisOS) + { + text.setColour (TextPropertyComponent::textColourId, findColour (widgetTextColourId)); - auto pathToCheck = text.getText(); + auto pathToCheck = text.getText(); - if (pathToCheck.isNotEmpty()) - { - pathToCheck.replace ("${user.home}", "~"); + if (pathToCheck.isNotEmpty()) + { + pathToCheck.replace ("${user.home}", "~"); - #if JUCE_WINDOWS - if (pathToCheck.startsWith ("~")) - pathToCheck = pathToCheck.replace ("~", File::getSpecialLocation (File::userHomeDirectory).getFullPathName()); - #endif + #if JUCE_WINDOWS + if (pathToCheck.startsWith ("~")) + pathToCheck = pathToCheck.replace ("~", File::getSpecialLocation (File::userHomeDirectory).getFullPathName()); + #endif - if (! root.getChildFile (pathToCheck).exists()) - text.setColour (TextPropertyComponent::textColourId, Colours::red); + if (! root.getChildFile (pathToCheck).exists()) + text.setColour (TextPropertyComponent::textColourId, Colours::red); + } } } @@ -200,7 +186,7 @@ private: TextPropertyComponent text; TextButton browseButton { "..." }; - bool isDirectory, isThisOS, supportsMultiplePaths, highlightForDragAndDrop = false; + bool isDirectory, isThisOS, highlightForDragAndDrop = false; String wildcards; File root;