| @@ -94,7 +94,7 @@ struct PropertyListBuilder | |||||
| mainHelpText + " Use semi-colons or new-lines to separate multiple paths."); | mainHelpText + " Use semi-colons or new-lines to separate multiple paths."); | ||||
| } | } | ||||
| void addSearchPathProperty (const ValueWithDefault& value, const String& name, const String& mainHelpText) | |||||
| void addSearchPathProperty (ValueWithDefault& value, const String& name, const String& mainHelpText) | |||||
| { | { | ||||
| add (new TextPropertyComponent (value, name, 16384, true), | add (new TextPropertyComponent (value, name, 16384, true), | ||||
| mainHelpText + " Use semi-colons or new-lines to separate multiple paths."); | mainHelpText + " Use semi-colons or new-lines to separate multiple paths."); | ||||
| @@ -32,7 +32,7 @@ class TextPropertyComponentWithEnablement : public TextPropertyComponent, | |||||
| private Value::Listener | private Value::Listener | ||||
| { | { | ||||
| public: | public: | ||||
| TextPropertyComponentWithEnablement (const ValueWithDefault& valueToControl, | |||||
| TextPropertyComponentWithEnablement (ValueWithDefault& valueToControl, | |||||
| ValueWithDefault valueToListenTo, | ValueWithDefault valueToListenTo, | ||||
| const String& propertyName, | const String& propertyName, | ||||
| int maxNumChars, | int maxNumChars, | ||||
| @@ -59,7 +59,7 @@ class ChoicePropertyComponentWithEnablement : public ChoicePropertyComponent, | |||||
| private Value::Listener | private Value::Listener | ||||
| { | { | ||||
| public: | public: | ||||
| ChoicePropertyComponentWithEnablement (const ValueWithDefault& valueToControl, | |||||
| ChoicePropertyComponentWithEnablement (ValueWithDefault& valueToControl, | |||||
| ValueWithDefault valueToListenTo, | ValueWithDefault valueToListenTo, | ||||
| const String& propertyName, | const String& propertyName, | ||||
| const StringArray& choices, | const StringArray& choices, | ||||
| @@ -73,7 +73,7 @@ class ChoicePropertyComponent::RemapperValueSourceWithDefault : public Value: | |||||
| private Value::Listener | private Value::Listener | ||||
| { | { | ||||
| public: | public: | ||||
| RemapperValueSourceWithDefault (const ValueWithDefault& vwd, const Array<var>& map) | |||||
| RemapperValueSourceWithDefault (ValueWithDefault& vwd, const Array<var>& map) | |||||
| : valueWithDefault (vwd), | : valueWithDefault (vwd), | ||||
| sourceValue (valueWithDefault.getPropertyAsValue()), | sourceValue (valueWithDefault.getPropertyAsValue()), | ||||
| mappings (map) | mappings (map) | ||||
| @@ -113,7 +113,7 @@ public: | |||||
| } | } | ||||
| private: | private: | ||||
| ValueWithDefault valueWithDefault; | |||||
| ValueWithDefault& valueWithDefault; | |||||
| Value sourceValue; | Value sourceValue; | ||||
| Array<var> mappings; | Array<var> mappings; | ||||
| @@ -155,7 +155,7 @@ ChoicePropertyComponent::ChoicePropertyComponent (const Value& valueToControl, | |||||
| correspondingValues))); | correspondingValues))); | ||||
| } | } | ||||
| ChoicePropertyComponent::ChoicePropertyComponent (const ValueWithDefault& valueToControl, | |||||
| ChoicePropertyComponent::ChoicePropertyComponent (ValueWithDefault& valueToControl, | |||||
| const String& name, | const String& name, | ||||
| const StringArray& choiceList, | const StringArray& choiceList, | ||||
| const Array<var>& correspondingValues) | const Array<var>& correspondingValues) | ||||
| @@ -165,9 +165,19 @@ ChoicePropertyComponent::ChoicePropertyComponent (const ValueWithDefault& valueT | |||||
| comboBox.getSelectedIdAsValue().referTo (Value (new RemapperValueSourceWithDefault (valueToControl, | comboBox.getSelectedIdAsValue().referTo (Value (new RemapperValueSourceWithDefault (valueToControl, | ||||
| correspondingValues))); | correspondingValues))); | ||||
| valueToControl.onDefaultChange = [this, &valueToControl, choiceList, correspondingValues] | |||||
| { | |||||
| auto selectedId = comboBox.getSelectedId(); | |||||
| comboBox.clear(); | |||||
| createComboBoxWithDefault (choiceList [correspondingValues.indexOf (valueToControl.getDefault())]); | |||||
| comboBox.setSelectedId (selectedId); | |||||
| }; | |||||
| } | } | ||||
| ChoicePropertyComponent::ChoicePropertyComponent (const ValueWithDefault& valueToControl, | |||||
| ChoicePropertyComponent::ChoicePropertyComponent (ValueWithDefault& valueToControl, | |||||
| const String& name) | const String& name) | ||||
| : PropertyComponent (name), | : PropertyComponent (name), | ||||
| choices ({ "Enabled", "Disabled" }) | choices ({ "Enabled", "Disabled" }) | ||||
| @@ -176,6 +186,16 @@ ChoicePropertyComponent::ChoicePropertyComponent (const ValueWithDefault& valueT | |||||
| comboBox.getSelectedIdAsValue().referTo (Value (new RemapperValueSourceWithDefault (valueToControl, | comboBox.getSelectedIdAsValue().referTo (Value (new RemapperValueSourceWithDefault (valueToControl, | ||||
| { true, false }))); | { true, false }))); | ||||
| valueToControl.onDefaultChange = [this, &valueToControl] | |||||
| { | |||||
| auto selectedId = comboBox.getSelectedId(); | |||||
| comboBox.clear(); | |||||
| createComboBoxWithDefault (valueToControl.getDefault() ? "Enabled" : "Disabled"); | |||||
| comboBox.setSelectedId (selectedId); | |||||
| }; | |||||
| } | } | ||||
| ChoicePropertyComponent::~ChoicePropertyComponent() | ChoicePropertyComponent::~ChoicePropertyComponent() | ||||
| @@ -88,7 +88,7 @@ public: | |||||
| as the choices array | as the choices array | ||||
| */ | */ | ||||
| ChoicePropertyComponent (const ValueWithDefault& valueToControl, | |||||
| ChoicePropertyComponent (ValueWithDefault& valueToControl, | |||||
| const String& propertyName, | const String& propertyName, | ||||
| const StringArray& choices, | const StringArray& choices, | ||||
| const Array<var>& correspondingValues); | const Array<var>& correspondingValues); | ||||
| @@ -98,7 +98,7 @@ public: | |||||
| This is useful for simple on/off choices that also need a default value. | This is useful for simple on/off choices that also need a default value. | ||||
| */ | */ | ||||
| ChoicePropertyComponent (const ValueWithDefault& valueToControl, | |||||
| ChoicePropertyComponent (ValueWithDefault& valueToControl, | |||||
| const String& propertyName); | const String& propertyName); | ||||
| /** Destructor. */ | /** Destructor. */ | ||||
| @@ -169,7 +169,7 @@ TextPropertyComponent::TextPropertyComponent (const Value& valueToControl, | |||||
| textEditor->getTextValue().referTo (valueToControl); | textEditor->getTextValue().referTo (valueToControl); | ||||
| } | } | ||||
| TextPropertyComponent::TextPropertyComponent (const ValueWithDefault& valueToControl, | |||||
| TextPropertyComponent::TextPropertyComponent (ValueWithDefault& valueToControl, | |||||
| const String& name, | const String& name, | ||||
| int maxNumChars, | int maxNumChars, | ||||
| bool isMultiLine, | bool isMultiLine, | ||||
| @@ -178,6 +178,12 @@ TextPropertyComponent::TextPropertyComponent (const ValueWithDefault& valueToCon | |||||
| { | { | ||||
| textEditor->getTextValue().referTo (Value (new RemapperValueSourceWithDefault (valueToControl))); | textEditor->getTextValue().referTo (Value (new RemapperValueSourceWithDefault (valueToControl))); | ||||
| textEditor->setTextToDisplayWhenEmpty (valueToControl.getDefault(), 0.5f); | textEditor->setTextToDisplayWhenEmpty (valueToControl.getDefault(), 0.5f); | ||||
| valueToControl.onDefaultChange = [this, &valueToControl] | |||||
| { | |||||
| textEditor->setTextToDisplayWhenEmpty (valueToControl.getDefault(), 0.5f); | |||||
| repaint(); | |||||
| }; | |||||
| } | } | ||||
| TextPropertyComponent::~TextPropertyComponent() | TextPropertyComponent::~TextPropertyComponent() | ||||
| @@ -83,7 +83,7 @@ public: | |||||
| @see TextEditor, setEditable | @see TextEditor, setEditable | ||||
| */ | */ | ||||
| TextPropertyComponent (const ValueWithDefault& valueToControl, | |||||
| TextPropertyComponent (ValueWithDefault& valueToControl, | |||||
| const String& propertyName, | const String& propertyName, | ||||
| int maxNumChars, | int maxNumChars, | ||||
| bool isMultiLine, | bool isMultiLine, | ||||