mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-10 23:44:24 +00:00
Projucer: Removed some unused code from the FilePathPropertyComponent
This commit is contained in:
parent
966f5f09ec
commit
ecf97e2a08
2 changed files with 23 additions and 37 deletions
|
|
@ -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." : ""));
|
||||
|
||||
|
|
|
|||
|
|
@ -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));
|
||||
|
||||
auto pathToCheck = text.getText();
|
||||
|
||||
if (pathToCheck.isNotEmpty())
|
||||
if (isThisOS)
|
||||
{
|
||||
pathToCheck.replace ("${user.home}", "~");
|
||||
text.setColour (TextPropertyComponent::textColourId, findColour (widgetTextColourId));
|
||||
|
||||
#if JUCE_WINDOWS
|
||||
if (pathToCheck.startsWith ("~"))
|
||||
pathToCheck = pathToCheck.replace ("~", File::getSpecialLocation (File::userHomeDirectory).getFullPathName());
|
||||
#endif
|
||||
auto pathToCheck = text.getText();
|
||||
|
||||
if (! root.getChildFile (pathToCheck).exists())
|
||||
text.setColour (TextPropertyComponent::textColourId, Colours::red);
|
||||
if (pathToCheck.isNotEmpty())
|
||||
{
|
||||
pathToCheck.replace ("${user.home}", "~");
|
||||
|
||||
#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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -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…
Add table
Add a link
Reference in a new issue