From 685876797ff26d4311c7f87381871fdbbfedc155 Mon Sep 17 00:00:00 2001 From: Vincenzo Sicurella Date: Mon, 22 Jan 2024 16:27:10 -0500 Subject: [PATCH] fix some connection state changed callbacks --- Source/GlobalSettingsArea.cpp | 2 ++ Source/LumatoneEditorState.cpp | 5 ++--- Source/Main.cpp | 4 +++- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/Source/GlobalSettingsArea.cpp b/Source/GlobalSettingsArea.cpp index 601836d..573b3be 100644 --- a/Source/GlobalSettingsArea.cpp +++ b/Source/GlobalSettingsArea.cpp @@ -103,6 +103,8 @@ GlobalSettingsArea::GlobalSettingsArea (const LumatoneEditorState& stateIn) settingsButton->setColour(TextButton::ColourIds::buttonColourId, Colour(0xff383b3d)); settingsButton->setColour(TextButton::ColourIds::textColourOffId, Colour(0xffffffff)); + connectionStateChanged(getConnectionState()); + /* We don't want a resize here /* //[/UserPreSize] diff --git a/Source/LumatoneEditorState.cpp b/Source/LumatoneEditorState.cpp index 4a65f8d..e1740dd 100644 --- a/Source/LumatoneEditorState.cpp +++ b/Source/LumatoneEditorState.cpp @@ -345,7 +345,7 @@ bool LumatoneEditorState::Controller::requestCompleteConfigFromDevice() { setHasChangesToSave(false); editorState.undoManager->clearUndoHistory(); - LumatoneApplicationState::Controller::requestCompleteConfigFromDevice(); + return LumatoneApplicationState::Controller::requestCompleteConfigFromDevice(); } bool LumatoneEditorState::Controller::saveMappingToFile(juce::File fileToSave) @@ -357,7 +357,7 @@ bool LumatoneEditorState::Controller::saveMappingToFile(juce::File fileToSave) if (fileToSave.existsAsFile()) success = fileToSave.replaceWithText(fileText, false, false); - + else if (fileToSave.create().ok()) { success = fileToSave.appendText(fileText, false, false); @@ -401,4 +401,3 @@ void LumatoneEditorState::Controller::setDeveloperMode(bool developerModeOn) // writeBoolProperty(LumatoneEditorProperty::DeveloperModeOn, inDeveloperMode, undoManager); editorState.setStateProperty(LumatoneEditorProperty::DeveloperModeOn, editorState.inDeveloperMode); } - diff --git a/Source/Main.cpp b/Source/Main.cpp index 9e79331..960398c 100644 --- a/Source/Main.cpp +++ b/Source/Main.cpp @@ -164,7 +164,7 @@ void TerpstraSysExApplication::anotherInstanceStarted(const String& commandLine) // if (palette.hasBeenModified()) // { // ValueTree paletteNode = palette.toValueTree(); -// +// // // pathToFile is optional - default to path defined in palette // if (pathToFile == File()) // pathToFile = File(palette.getPathToFile()); @@ -272,6 +272,8 @@ void TerpstraSysExApplication::getCommandInfo(CommandID commandID, ApplicationCo case Lumatone::Menu::commandIDs::importSysExMapping: result.setInfo("Import", "Import mapping from device.", "File", 0); result.addDefaultKeypress('i', ModifierKeys::commandModifier); + if (state.getConnectionState() != ConnectionState::ONLINE) + result.setActive(false); break; case Lumatone::Menu::commandIDs::deleteOctaveBoard: