Browse Source

Projucer: Removed some unused code from the FilePathPropertyComponent

tags/2021-05-28
ed 6 years ago
parent
commit
ecf97e2a08
2 changed files with 22 additions and 36 deletions
  1. +1
    -1
      extras/Projucer/Source/Application/Windows/jucer_GlobalPathsWindowComponent.h
  2. +21
    -35
      extras/Projucer/Source/Utility/UI/PropertyComponents/jucer_FilePathPropertyComponent.h

+ 1
- 1
extras/Projucer/Source/Application/Windows/jucer_GlobalPathsWindowComponent.h View File

@@ -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." : ""));


+ 21
- 35
extras/Projucer/Source/Utility/UI/PropertyComponents/jucer_FilePathPropertyComponent.h View File

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


Loading…
Cancel
Save