diff --git a/Source/GlobalSettingsArea.cpp b/Source/GlobalSettingsArea.cpp index 4791429..3bb0a76 100644 --- a/Source/GlobalSettingsArea.cpp +++ b/Source/GlobalSettingsArea.cpp @@ -245,13 +245,10 @@ void GlobalSettingsArea::changeListenerCallback(ChangeBroadcaster *source) } } -void GlobalSettingsArea::restoreStateFromPropertiesFile(PropertiesFile* propertiesFile) +void GlobalSettingsArea::restoreStateFromPropertiesFile() { - inactiveMacroButtonColourEdit->setColour( - propertiesFile->getValue(LumatoneEditorProperty::InactiveMacroButtonColour, "000000")); - - activeMacroButtonColourEdit->setColour( - propertiesFile->getValue(LumatoneEditorProperty::ActiveMacroButtonColour, "FFFFFF")); + inactiveMacroButtonColourEdit->setColour(getProperty(LumatoneEditorProperty::InactiveMacroButtonColour, "000000")); + activeMacroButtonColourEdit->setColour(getProperty(LumatoneEditorProperty::ActiveMacroButtonColour, "FFFFFF")); } void GlobalSettingsArea::saveStateToPropertiesFile(PropertiesFile* propertiesFile) @@ -281,6 +278,8 @@ void GlobalSettingsArea::setDeveloperMode(bool devModeOn) void GlobalSettingsArea::connectionStateChanged(ConnectionState state) { settingsButton->setEnabled(state == ConnectionState::ONLINE); + inactiveMacroButtonColourEdit->setEnabled(state == ConnectionState::ONLINE); + activeMacroButtonColourEdit->setEnabled(state == ConnectionState::ONLINE); } // void GlobalSettingsArea::connectionFaile() diff --git a/Source/GlobalSettingsArea.h b/Source/GlobalSettingsArea.h index f2472ed..fbbd918 100644 --- a/Source/GlobalSettingsArea.h +++ b/Source/GlobalSettingsArea.h @@ -54,7 +54,6 @@ class GlobalSettingsArea : public juce::Component, //[UserMethods] -- You can add your own custom methods in this section. void changeListenerCallback(ChangeBroadcaster *source) override; - void restoreStateFromPropertiesFile(PropertiesFile* propertiesFile); void saveStateToPropertiesFile(PropertiesFile* propertiesFile); void listenToColourEditButtons(Button::Listener* listenerIn); @@ -74,7 +73,8 @@ class GlobalSettingsArea : public juce::Component, void resized() override; void buttonClicked (juce::Button* buttonThatWasClicked) override; - +private: + void restoreStateFromPropertiesFile(); private: //[UserVariables] -- You can add your own custom variables in this section. diff --git a/Source/LumatoneEditorState.cpp b/Source/LumatoneEditorState.cpp index daf4d8c..5095921 100644 --- a/Source/LumatoneEditorState.cpp +++ b/Source/LumatoneEditorState.cpp @@ -79,9 +79,9 @@ LumatoneEditorState::~LumatoneEditorState() appFonts = nullptr; } -juce::var LumatoneEditorState::getProperty(juce::Identifier propertyId) const +juce::String LumatoneEditorState::getProperty(juce::Identifier propertyId, juce::String fallbackValue) const { - return propertiesFile->getValue(propertyId.toString()); + return propertiesFile->getValue(propertyId, fallbackValue); } juce::RecentlyOpenedFilesList& LumatoneEditorState::getRecentFiles() diff --git a/Source/LumatoneEditorState.h b/Source/LumatoneEditorState.h index 9438d82..20778e7 100644 --- a/Source/LumatoneEditorState.h +++ b/Source/LumatoneEditorState.h @@ -98,7 +98,7 @@ class LumatoneEditorState : public LumatoneApplicationState const LumatoneEditorFontLibrary& getAppFonts() const { return *appFonts; } - juce::var getProperty(juce::Identifier propertyId) const; + juce::String getProperty(juce::Identifier propertyId, juce::String fallbackValue=juce::String()) const; // juce::PropertiesFile& getPropertiesFile() { return *propertiesFile; } juce::File getCurrentFile() const { return currentFile; } diff --git a/Source/NoteEditArea.cpp b/Source/NoteEditArea.cpp index 5d64e5e..087fbf5 100644 --- a/Source/NoteEditArea.cpp +++ b/Source/NoteEditArea.cpp @@ -110,7 +110,7 @@ NoteEditArea::NoteEditArea (const LumatoneEditorState& stateIn) addEditorListener(this); - showIsomorphicMassAssign = (bool)getProperty(LumatoneEditorProperty::IsomorphicMassAssign); + showIsomorphicMassAssign = getProperty(LumatoneEditorProperty::IsomorphicMassAssign).getIntValue(); updateShowIsomorphicAssign(); refreshKeyFields(); diff --git a/Source/Settings/SettingsContainer.cpp b/Source/Settings/SettingsContainer.cpp index b08b622..22c91e4 100644 --- a/Source/Settings/SettingsContainer.cpp +++ b/Source/Settings/SettingsContainer.cpp @@ -53,7 +53,7 @@ SettingsContainer::SettingsContainer(const LumatoneEditorState& stateIn) addAndMakeVisible(categoryList.get()); model.addChangeListener(this); - auto lastPanelIndex = (int)getProperty(LumatoneEditorProperty::LastSettingsPanel); + auto lastPanelIndex = getProperty(LumatoneEditorProperty::LastSettingsPanel).getIntValue(); categoryList->selectRow(lastPanelIndex); } diff --git a/Source/SingleNoteAssign.cpp b/Source/SingleNoteAssign.cpp index 473c4d9..2947444 100644 --- a/Source/SingleNoteAssign.cpp +++ b/Source/SingleNoteAssign.cpp @@ -181,10 +181,10 @@ SingleNoteAssign::SingleNoteAssign (const LumatoneEditorState& stateIn) //[Constructor] You can add your own custom stuff here.. - setNoteToggleButton->setToggleState(getProperty(LumatoneEditorProperty::SingleNoteNoteSetActive), juce::NotificationType::sendNotification); - setChannelToggleButton->setToggleState(getProperty(LumatoneEditorProperty::SingleNoteChannelSetActive), juce::NotificationType::sendNotification); - setColourToggleButton->setToggleState(getProperty(LumatoneEditorProperty::SingleNoteColourSetActive), juce::NotificationType::sendNotification); - keyTypeToggleButton->setToggleState(getProperty(LumatoneEditorProperty::SingleNoteKeyTypeSetActive),juce::NotificationType::sendNotification); + setNoteToggleButton->setToggleState(getProperty(LumatoneEditorProperty::SingleNoteNoteSetActive).getIntValue(), juce::NotificationType::sendNotification); + setChannelToggleButton->setToggleState(getProperty(LumatoneEditorProperty::SingleNoteChannelSetActive).getIntValue(), juce::NotificationType::sendNotification); + setColourToggleButton->setToggleState(getProperty(LumatoneEditorProperty::SingleNoteColourSetActive).getIntValue(), juce::NotificationType::sendNotification); + keyTypeToggleButton->setToggleState(getProperty(LumatoneEditorProperty::SingleNoteKeyTypeSetActive).getIntValue(), juce::NotificationType::sendNotification); keyTypeCombo->setSelectedId(LumatoneKeyType::noteOnNoteOff); //[/Constructor] } diff --git a/Source/lumatone_editor_library/listeners/firmware_listener.h b/Source/lumatone_editor_library/listeners/firmware_listener.h index 5ef1362..ed8c5ac 100644 --- a/Source/lumatone_editor_library/listeners/firmware_listener.h +++ b/Source/lumatone_editor_library/listeners/firmware_listener.h @@ -51,6 +51,8 @@ class FirmwareListener virtual void presetFlagsReceived(LumatoneFirmware::PresetFlags presetFlags) {}; + virtual void macroButtonColoursReceived(juce::Colour inactiveColour, juce::Colour activeColour) {}; + virtual void expressionPedalSensitivityReceived(int sensitivity) {}; virtual void noAnswerToCommand(int cmd) {};