46 if (map.equalsWithSameType (targetValue))
49 return mappings.indexOf (targetValue) + 1;
54 auto remappedVal =
mappings [
static_cast<int> (newValue) - 1];
85 if (!
value.isUsingDefault())
88 const auto equalsWithSameType = [&target] (
const var& map) {
return map.equalsWithSameType (target); };
90 auto iter = std::find_if (
mappings.begin(),
mappings.end(), equalsWithSameType);
96 return 1 + (
int) std::distance (
mappings.begin(), iter);
104 auto newValueInt =
static_cast<int> (newValue);
106 if (newValueInt == -1)
108 value.resetToDefault();
112 auto remappedVal =
mappings [newValueInt - 1];
114 if (! remappedVal.equalsWithSameType (
sourceValue))
164 value = valueToControl;
166 auto getDefaultString = [
this, correspondingValues] {
return choices [correspondingValues.
indexOf (
value.getDefault())]; };
171 value.onDefaultChange = [
this, getDefaultString]
173 auto selectedId =
comboBox.getSelectedId();
175 comboBox.setSelectedId (selectedId);
182 choices ({
"Enabled",
"Disabled" })
184 value = valueToControl;
186 auto getDefaultString = [
this] {
return value.getDefault() ?
"Enabled" :
"Disabled"; };
188 refreshChoices (getDefaultString());
189 initialiseComboBox (Value (
new ChoiceRemapperValueSourceWithDefault (
value, {
true,
false })));
191 value.onDefaultChange = [
this, getDefaultString]
193 auto selectedId =
comboBox.getSelectedId();
194 refreshChoices (getDefaultString());
195 comboBox.setSelectedId (selectedId);
205 comboBox.getSelectedIdAsValue().referTo (
v);
218 if (choice.isNotEmpty())
228 comboBox.addItem (
"Default" + (defaultString.
isNotEmpty() ?
" (" + defaultString +
")" :
""), -1);
268 auto newIndex =
comboBox.getSelectedId() - 1;
Definition juce_Array.h:56
int size() const noexcept
Definition juce_Array.h:215
int indexOf(ParameterType elementToLookFor) const
Definition juce_Array.h:382
StringArray choices
Definition juce_ChoicePropertyComponent.h:134
virtual int getIndex() const
Definition juce_ChoicePropertyComponent.cpp:237
void refreshChoices()
Definition juce_ChoicePropertyComponent.cpp:210
void refresh() override
Definition juce_ChoicePropertyComponent.cpp:249
bool isCustomClass
Definition juce_ChoicePropertyComponent.h:147
virtual void setIndex(int newIndex)
Definition juce_ChoicePropertyComponent.cpp:232
ValueTreePropertyWithDefault value
Definition juce_ChoicePropertyComponent.h:145
const StringArray & getChoices() const
Definition juce_ChoicePropertyComponent.cpp:243
void initialiseComboBox(const Value &)
Definition juce_ChoicePropertyComponent.cpp:200
void changeIndex()
Definition juce_ChoicePropertyComponent.cpp:264
ComboBox comboBox
Definition juce_ChoicePropertyComponent.h:146
ChoicePropertyComponent(const String &, const StringArray &, const Array< var > &)
Definition juce_ChoicePropertyComponent.cpp:137
Definition juce_ChoicePropertyComponent.cpp:32
Value sourceValue
Definition juce_ChoicePropertyComponent.cpp:61
void setValue(const var &newValue) override
Definition juce_ChoicePropertyComponent.cpp:52
Array< var > mappings
Definition juce_ChoicePropertyComponent.cpp:62
var getValue() const override
Definition juce_ChoicePropertyComponent.cpp:41
ChoiceRemapperValueSource(const Value &source, const Array< var > &map)
Definition juce_ChoicePropertyComponent.cpp:34
void valueChanged(Value &) override
Definition juce_ChoicePropertyComponent.cpp:64
Definition juce_ChoicePropertyComponent.cpp:73
void valueChanged(Value &) override
Definition juce_ChoicePropertyComponent.cpp:120
Array< var > mappings
Definition juce_ChoicePropertyComponent.cpp:124
ValueTreePropertyWithDefault value
Definition juce_ChoicePropertyComponent.cpp:122
ChoiceRemapperValueSourceWithDefault(const ValueTreePropertyWithDefault &v, const Array< var > &map)
Definition juce_ChoicePropertyComponent.cpp:75
var getValue() const override
Definition juce_ChoicePropertyComponent.cpp:83
Value sourceValue
Definition juce_ChoicePropertyComponent.cpp:123
void setValue(const var &newValue) override
Definition juce_ChoicePropertyComponent.cpp:102
void addAndMakeVisible(Component *child, int zOrder=-1)
Definition juce_Component.cpp:1554
PropertyComponent(const String &propertyName, int preferredHeight=25)
Definition juce_PropertyComponent.cpp:29
Definition juce_StringArray.h:35
Definition juce_String.h:53
bool isNotEmpty() const noexcept
Definition juce_String.h:316
Definition juce_Value.h:139
Definition juce_Value.h:180
void sendChangeMessage(bool dispatchSynchronously)
Definition juce_Value.cpp:43
friend class Value
Definition juce_Value.h:203
Definition juce_Value.h:51
Definition juce_ValueTreePropertyWithDefault.h:39
Definition juce_Variant.h:42
unsigned v[N_MAX]
Definition inflate.c:1584
register unsigned i
Definition inflate.c:1575
static PuglViewHint int value
Definition pugl.h:1708
static const char * name
Definition pugl.h:1582
Definition carla_juce.cpp:31
@ dontSendNotification
Definition juce_NotificationType.h:33
@ comboBox
Definition juce_AccessibilityRole.h:41
#define true
Definition ordinals.h:82
typedef int(UZ_EXP MsgFn)()