From a11aeab0dd3dea911ff419dbd19494f532dfb88b Mon Sep 17 00:00:00 2001 From: Vincenzo Sicurella Date: Sun, 11 Aug 2024 16:48:37 -0400 Subject: [PATCH] reorganize files, start colour dropdown implementation in key editor controls --- Source/LumatoneEditorFonts.h | 12 - Source/LumatoneMenu.cpp | 1 - Source/LumatoneMenu.h | 2 +- Source/Main.cpp | 10 +- Source/Main.h | 4 +- Source/MainWindow.cpp | 7 +- Source/MainWindow.h | 2 +- Source/Settings/CalibrationDlg.cpp | 2 +- Source/Settings/CalibrationDlg.h | 2 +- Source/Settings/FirmwareDlg.cpp | 4 +- Source/Settings/FirmwareDlg.h | 6 +- Source/Settings/MidiSettingsDlg.cpp | 2 +- Source/Settings/MidiSettingsDlg.h | 2 +- Source/Settings/PresetSettingsDlg.h | 2 +- Source/Settings/SettingsContainer.cpp | 2 +- Source/Settings/SettingsContainer.h | 2 +- Source/actions/BatchColourActions.h | 2 +- Source/actions/EditorControlActions.h | 2 +- Source/actions/KeySelectionControlActions.h | 2 +- .../KeyboardClickListener.cpp | 2 +- .../KeyboardClickListener.h | 2 +- .../{ => components}/ColourPaletteWindow.cpp | 8 +- Source/{ => components}/ColourPaletteWindow.h | 6 +- .../{ => components}/GlobalSettingsArea.cpp | 664 +++++----- Source/{ => components}/GlobalSettingsArea.h | 232 ++-- Source/{ => components}/MainComponent.cpp | 920 +++++++------- Source/{ => components}/MainComponent.h | 384 +++--- Source/{ => components}/MidiEditArea.cpp | 6 +- Source/{ => components}/MidiEditArea.h | 6 +- .../mapping}/BatchTools.cpp | 2 +- .../mapping}/BatchTools.h | 2 +- .../mapping}/BatchToolsColourControls.cpp | 6 +- .../mapping}/BatchToolsColourControls.h | 6 +- .../mapping}/KeyEditorControls.cpp | 85 +- .../mapping}/KeyEditorControls.h | 11 +- .../mapping}/KeyEditorPanel.cpp | 2 +- .../mapping}/KeyEditorPanel.h | 2 +- .../{ => components/mapping}/MappingLogic.cpp | 630 +++++----- .../{ => components/mapping}/MappingLogic.h | 346 +++--- .../mapping}/MappingSettingsControls.cpp | 4 +- .../mapping}/MappingSettingsControls.h | 4 +- .../mapping}/MappingSettingsPanel.cpp | 2 +- .../mapping}/MappingSettingsPanel.h | 2 +- .../mapping}/MultiSelectControls.cpp | 21 +- .../mapping}/MultiSelectControls.h | 8 +- Source/{ => components}/palette_edit_panel.h | 6 +- .../palette_selection_panel.h | 2 +- .../scale}/NoteNames.cpp | 0 .../scale}/NoteNames.h | 2 +- .../scale}/ScaleMath.h | 0 .../scale}/ScaleStructure.cpp | 4 +- .../scale}/ScaleStructure.h | 2 +- .../scale}/Symmetry.h | 0 .../scale/circle}/GroupHandle.cpp | 0 .../scale/circle}/GroupHandle.h | 0 .../scale/circle}/GroupingCircle.cpp | 2 +- .../scale/circle}/GroupingCircle.h | 14 +- .../scale/circle}/NumberSelector.cpp | 0 .../scale/circle}/NumberSelector.h | 0 .../scale/circle}/ScaleDesignWindow.cpp | 0 .../scale/circle}/ScaleDesignWindow.h | 0 .../scale/circle}/ScaleStructureComponent.cpp | 2 +- .../scale/circle}/ScaleStructureComponent.h | 7 +- .../scale/circle}/TransparentDropDown.h | 0 .../tables}/CurvesArea.cpp | 6 +- .../tables}/CurvesArea.h | 2 +- .../tables}/NoteOnOffVelocityCurveDialog.cpp | 34 +- .../tables}/NoteOnOffVelocityCurveDialog.h | 84 +- .../tables}/VelocityCurveComponents.cpp | 214 ++-- .../tables}/VelocityCurveComponents.h | 0 .../tables}/VelocityCurveDlgBase.cpp | 854 ++++++------- .../tables}/VelocityCurveDlgBase.h | 232 ++-- .../tables}/VelocityCurveEditStrategy.cpp | 1074 ++++++++--------- .../tables}/VelocityCurveEditStrategy.h | 314 ++--- .../ColourDropdownSelector.cpp | 9 +- .../ColourDropdownSelector.h | 0 Source/{ => controls}/FileBrowserComponent.h | 0 .../RangedControl.cpp | 2 +- .../{components => controls}/RangedControl.h | 0 .../colour_palette_component.cpp | 5 +- .../{ => controls}/colour_palette_component.h | 7 +- .../{ => controls}/colour_view_component.cpp | 2 +- Source/{ => controls}/colour_view_component.h | 2 +- Source/data/LumatoneEditSelectionState.cpp | 2 +- Source/{ => data}/LumatoneEditorState.cpp | 9 +- Source/{ => data}/LumatoneEditorState.h | 8 +- Source/{ => firmware}/FirmwareTransfer.cpp | 2 +- Source/{ => firmware}/FirmwareTransfer.h | 0 Source/{ => style}/LocalisationMap.h | 0 .../{ => style}/LumatoneEditorFontLibrary.h | 0 .../{ => style}/LumatoneEditorLookAndFeel.h | 0 .../{ => style}/LumatoneEditorStyleCommon.h | 6 +- 92 files changed, 3173 insertions(+), 3167 deletions(-) delete mode 100644 Source/LumatoneEditorFonts.h rename Source/{mapping_editors => actions}/KeyboardClickListener.cpp (97%) rename Source/{mapping_editors => actions}/KeyboardClickListener.h (97%) rename Source/{ => components}/ColourPaletteWindow.cpp (97%) rename Source/{ => components}/ColourPaletteWindow.h (95%) rename Source/{ => components}/GlobalSettingsArea.cpp (97%) rename Source/{ => components}/GlobalSettingsArea.h (92%) rename Source/{ => components}/MainComponent.cpp (94%) rename Source/{ => components}/MainComponent.h (92%) rename Source/{ => components}/MidiEditArea.cpp (99%) rename Source/{ => components}/MidiEditArea.h (97%) rename Source/{mapping_editors => components/mapping}/BatchTools.cpp (98%) rename Source/{mapping_editors => components/mapping}/BatchTools.h (95%) rename Source/{mapping_editors => components/mapping}/BatchToolsColourControls.cpp (98%) rename Source/{mapping_editors => components/mapping}/BatchToolsColourControls.h (90%) rename Source/{mapping_editors => components/mapping}/KeyEditorControls.cpp (78%) rename Source/{mapping_editors => components/mapping}/KeyEditorControls.h (89%) rename Source/{mapping_editors => components/mapping}/KeyEditorPanel.cpp (98%) rename Source/{mapping_editors => components/mapping}/KeyEditorPanel.h (97%) rename Source/{ => components/mapping}/MappingLogic.cpp (96%) rename Source/{ => components/mapping}/MappingLogic.h (95%) rename Source/{mapping_editors => components/mapping}/MappingSettingsControls.cpp (98%) rename Source/{mapping_editors => components/mapping}/MappingSettingsControls.h (95%) rename Source/{mapping_editors => components/mapping}/MappingSettingsPanel.cpp (97%) rename Source/{mapping_editors => components/mapping}/MappingSettingsPanel.h (96%) rename Source/{mapping_editors => components/mapping}/MultiSelectControls.cpp (94%) rename Source/{mapping_editors => components/mapping}/MultiSelectControls.h (92%) rename Source/{ => components}/palette_edit_panel.h (98%) rename Source/{ => components}/palette_selection_panel.h (99%) rename Source/{ScaleStructureController => components/scale}/NoteNames.cpp (100%) rename Source/{ScaleStructureController => components/scale}/NoteNames.h (99%) rename Source/{ScaleStructureController => components/scale}/ScaleMath.h (100%) rename Source/{ScaleStructureController => components/scale}/ScaleStructure.cpp (99%) rename Source/{ScaleStructureController => components/scale}/ScaleStructure.h (99%) rename Source/{ScaleStructureController => components/scale}/Symmetry.h (100%) rename Source/{ScaleStructureController => components/scale/circle}/GroupHandle.cpp (100%) rename Source/{ScaleStructureController => components/scale/circle}/GroupHandle.h (100%) rename Source/{ScaleStructureController => components/scale/circle}/GroupingCircle.cpp (99%) rename Source/{ScaleStructureController => components/scale/circle}/GroupingCircle.h (98%) rename Source/{ScaleStructureController => components/scale/circle}/NumberSelector.cpp (100%) rename Source/{ScaleStructureController => components/scale/circle}/NumberSelector.h (100%) rename Source/{ScaleStructureController => components/scale/circle}/ScaleDesignWindow.cpp (100%) rename Source/{ScaleStructureController => components/scale/circle}/ScaleDesignWindow.h (100%) rename Source/{ScaleStructureController => components/scale/circle}/ScaleStructureComponent.cpp (99%) rename Source/{ScaleStructureController => components/scale/circle}/ScaleStructureComponent.h (98%) rename Source/{ScaleStructureController => components/scale/circle}/TransparentDropDown.h (100%) rename Source/{mapping_editors => components/tables}/CurvesArea.cpp (98%) rename Source/{mapping_editors => components/tables}/CurvesArea.h (98%) rename Source/{ => components/tables}/NoteOnOffVelocityCurveDialog.cpp (97%) rename Source/{ => components/tables}/NoteOnOffVelocityCurveDialog.h (96%) rename Source/{ => components/tables}/VelocityCurveComponents.cpp (92%) rename Source/{ => components/tables}/VelocityCurveComponents.h (100%) rename Source/{ => components/tables}/VelocityCurveDlgBase.cpp (95%) rename Source/{ => components/tables}/VelocityCurveDlgBase.h (96%) rename Source/{ => components/tables}/VelocityCurveEditStrategy.cpp (96%) rename Source/{ => components/tables}/VelocityCurveEditStrategy.h (97%) rename Source/{components => controls}/ColourDropdownSelector.cpp (99%) rename Source/{components => controls}/ColourDropdownSelector.h (100%) rename Source/{ => controls}/FileBrowserComponent.h (100%) rename Source/{components => controls}/RangedControl.cpp (98%) rename Source/{components => controls}/RangedControl.h (100%) rename Source/{ => controls}/colour_palette_component.cpp (98%) rename Source/{ => controls}/colour_palette_component.h (91%) rename Source/{ => controls}/colour_view_component.cpp (99%) rename Source/{ => controls}/colour_view_component.h (98%) rename Source/{ => data}/LumatoneEditorState.cpp (98%) rename Source/{ => data}/LumatoneEditorState.h (97%) rename Source/{ => firmware}/FirmwareTransfer.cpp (99%) rename Source/{ => firmware}/FirmwareTransfer.h (100%) rename Source/{ => style}/LocalisationMap.h (100%) rename Source/{ => style}/LumatoneEditorFontLibrary.h (100%) rename Source/{ => style}/LumatoneEditorLookAndFeel.h (100%) rename Source/{ => style}/LumatoneEditorStyleCommon.h (99%) diff --git a/Source/LumatoneEditorFonts.h b/Source/LumatoneEditorFonts.h deleted file mode 100644 index ce213082..00000000 --- a/Source/LumatoneEditorFonts.h +++ /dev/null @@ -1,12 +0,0 @@ -/* - ============================================================================== - - LumatoneEditorFontLibrary.h - Created: 12 Feb 2021 10:52:11pm - Author: Vincenzo - - ============================================================================== -*/ - -#pragma once -#include diff --git a/Source/LumatoneMenu.cpp b/Source/LumatoneMenu.cpp index 8045684a..c6626008 100644 --- a/Source/LumatoneMenu.cpp +++ b/Source/LumatoneMenu.cpp @@ -9,7 +9,6 @@ */ #include "LumatoneMenu.h" -#include "./LumatoneEditorState.h" namespace Lumatone { namespace Menu { diff --git a/Source/LumatoneMenu.h b/Source/LumatoneMenu.h index 78458c6d..19118380 100644 --- a/Source/LumatoneMenu.h +++ b/Source/LumatoneMenu.h @@ -12,7 +12,7 @@ #include -#include "LumatoneEditorState.h" +#include "./data/LumatoneEditorState.h" namespace Lumatone { namespace Menu { diff --git a/Source/Main.cpp b/Source/Main.cpp index dd6ab0d4..5e313861 100644 --- a/Source/Main.cpp +++ b/Source/Main.cpp @@ -12,11 +12,11 @@ #include "Main.h" #include "MainWindow.h" -#include "MainComponent.h" +#include "./components/MainComponent.h" -#include "FirmwareTransfer.h" +#include "./firmware/FirmwareTransfer.h" -#include "LumatoneEditorLookAndFeel.h" +#include "./style/LumatoneEditorLookAndFeel.h" #include "./actions/KeySelectionControlActions.h" @@ -25,8 +25,8 @@ #include "./lumatone_editor_library/graphics/view_constants.h" #include "./lumatone_editor_library/palettes/colour_palette_file.h" -#include "VelocityCurveDlgBase.h" -#include "NoteOnOffVelocityCurveDialog.h" +// #include "VelocityCurveDlgBase.h" +// #include "NoteOnOffVelocityCurveDialog.h" #include "LumatoneMenu.h" //============================================================================== diff --git a/Source/Main.h b/Source/Main.h index 3f7ae1cf..2da2236f 100644 --- a/Source/Main.h +++ b/Source/Main.h @@ -14,9 +14,9 @@ #include "./lumatone_editor_library/lumatone_midi_driver/lumatone_midi_driver.h" -#include "./LumatoneEditorState.h" +#include "./data/LumatoneEditorState.h" -#include "LocalisationMap.h" +#include "./style/LocalisationMap.h" #define CHOOSE_FILE_NOOP [](bool) -> void {} diff --git a/Source/MainWindow.cpp b/Source/MainWindow.cpp index 403123d3..d4bfd4c5 100644 --- a/Source/MainWindow.cpp +++ b/Source/MainWindow.cpp @@ -8,13 +8,12 @@ */ #include "MainWindow.h" -#include "MainComponent.h" - #include "LumatoneMenu.h" -#include "LumatoneEditorLookAndFeel.h" -#include "./lumatone_editor_library/palettes/colour_palette_file.h" +#include "./components/MainComponent.h" +#include "./style/LumatoneEditorLookAndFeel.h" +#include "./lumatone_editor_library/palettes/colour_palette_file.h" #include "./lumatone_editor_library/graphics/view_constants.h" MainWindow::MainWindow(const LumatoneEditorState& stateIn, juce::ApplicationCommandManager* cmdManager) diff --git a/Source/MainWindow.h b/Source/MainWindow.h index 87e777d8..db4309c4 100644 --- a/Source/MainWindow.h +++ b/Source/MainWindow.h @@ -10,7 +10,7 @@ #pragma once #include -#include "LumatoneEditorState.h" +#include "./data/LumatoneEditorState.h" #include "./lumatone_editor_library/listeners/editor_listener.h" diff --git a/Source/Settings/CalibrationDlg.cpp b/Source/Settings/CalibrationDlg.cpp index 300ff198..da39a1db 100644 --- a/Source/Settings/CalibrationDlg.cpp +++ b/Source/Settings/CalibrationDlg.cpp @@ -20,7 +20,7 @@ //[Headers] You can add your own extra header files here... #include "WheelsCalibrationComponent.h" -#include "../LumatoneEditorLookAndFeel.h" +#include "../style/LumatoneEditorLookAndFeel.h" #include "../lumatone_editor_library/graphics/view_constants.h" #include "../lumatone_editor_library/device/lumatone_controller.h" diff --git a/Source/Settings/CalibrationDlg.h b/Source/Settings/CalibrationDlg.h index 9510a5af..14196a30 100644 --- a/Source/Settings/CalibrationDlg.h +++ b/Source/Settings/CalibrationDlg.h @@ -21,7 +21,7 @@ //[Headers] -- You can add your own extra header files here -- -#include "../LumatoneEditorState.h" +#include "../data/LumatoneEditorState.h" #include "../lumatone_editor_library/lumatone_midi_driver/firmware_types.h" #include "../lumatone_editor_library/listeners/firmware_listener.h" diff --git a/Source/Settings/FirmwareDlg.cpp b/Source/Settings/FirmwareDlg.cpp index 74a7c90b..c39f8f73 100644 --- a/Source/Settings/FirmwareDlg.cpp +++ b/Source/Settings/FirmwareDlg.cpp @@ -10,8 +10,8 @@ #include "FirmwareDlg.h" -#include "../LumatoneEditorLookAndFeel.h" -#include "../LumatoneEditorFontLibrary.h" +#include "../style/LumatoneEditorLookAndFeel.h" +#include "../style/LumatoneEditorFontLibrary.h" #include "../lumatone_editor_library/device/lumatone_controller.h" diff --git a/Source/Settings/FirmwareDlg.h b/Source/Settings/FirmwareDlg.h index 34de2e7f..7118cc61 100644 --- a/Source/Settings/FirmwareDlg.h +++ b/Source/Settings/FirmwareDlg.h @@ -10,9 +10,9 @@ #pragma once -#include "../LumatoneEditorState.h" -#include "../FileBrowserComponent.h" -#include "../FirmwareTransfer.h" +#include "../data/LumatoneEditorState.h" +#include "../controls/FileBrowserComponent.h" +#include "../firmware/FirmwareTransfer.h" #include "../lumatone_editor_library/listeners/firmware_listener.h" diff --git a/Source/Settings/MidiSettingsDlg.cpp b/Source/Settings/MidiSettingsDlg.cpp index d02991b9..b8115828 100644 --- a/Source/Settings/MidiSettingsDlg.cpp +++ b/Source/Settings/MidiSettingsDlg.cpp @@ -10,7 +10,7 @@ #include "MidiSettingsDlg.h" -#include "../LumatoneEditorFontLibrary.h" +#include "../style/LumatoneEditorFontLibrary.h" #include "../lumatone_editor_library/device/lumatone_controller.h" diff --git a/Source/Settings/MidiSettingsDlg.h b/Source/Settings/MidiSettingsDlg.h index 45601381..d36dbd43 100644 --- a/Source/Settings/MidiSettingsDlg.h +++ b/Source/Settings/MidiSettingsDlg.h @@ -10,7 +10,7 @@ #pragma once -#include "../LumatoneEditorState.h" +#include "../data/LumatoneEditorState.h" #include "../lumatone_editor_library/listeners/firmware_listener.h" #include "../lumatone_editor_library/lumatone_midi_driver/firmware_types.h" diff --git a/Source/Settings/PresetSettingsDlg.h b/Source/Settings/PresetSettingsDlg.h index 263dcb41..cd1874b3 100644 --- a/Source/Settings/PresetSettingsDlg.h +++ b/Source/Settings/PresetSettingsDlg.h @@ -11,7 +11,7 @@ #pragma once #include -#include "../LumatoneEditorState.h" +#include "../data/LumatoneEditorState.h" #include "../lumatone_editor_library/listeners/firmware_listener.h" #include "../lumatone_editor_library/lumatone_midi_driver/firmware_types.h" diff --git a/Source/Settings/SettingsContainer.cpp b/Source/Settings/SettingsContainer.cpp index 22c91e47..def38268 100644 --- a/Source/Settings/SettingsContainer.cpp +++ b/Source/Settings/SettingsContainer.cpp @@ -10,7 +10,7 @@ #include "SettingsContainer.h" -#include "../LumatoneEditorLookAndFeel.h" +#include "../style/LumatoneEditorLookAndFeel.h" #include "CalibrationDlg.h" #include "FirmwareDlg.h" diff --git a/Source/Settings/SettingsContainer.h b/Source/Settings/SettingsContainer.h index 64df86c4..c631e45f 100644 --- a/Source/Settings/SettingsContainer.h +++ b/Source/Settings/SettingsContainer.h @@ -11,7 +11,7 @@ #pragma once #include -#include "../LumatoneEditorState.h" +#include "../data/LumatoneEditorState.h" typedef enum { Calibration = 0, diff --git a/Source/actions/BatchColourActions.h b/Source/actions/BatchColourActions.h index e76b397c..f9254a6f 100644 --- a/Source/actions/BatchColourActions.h +++ b/Source/actions/BatchColourActions.h @@ -11,7 +11,7 @@ #ifndef LUMATONE_EDITOR_BATCH_COLOUR_ACTIONS_H #define LUMATONE_EDITOR_BATCH_COLOUR_ACTIONS_H -#include "../LumatoneEditorState.h" +#include "../data/LumatoneEditorState.h" #include "../lumatone_editor_library/actions/lumatone_action.h" #include "../data/LumatoneEditorBatchColourState.h" diff --git a/Source/actions/EditorControlActions.h b/Source/actions/EditorControlActions.h index a619aa20..cd802736 100644 --- a/Source/actions/EditorControlActions.h +++ b/Source/actions/EditorControlActions.h @@ -11,7 +11,7 @@ #ifndef LUMATONE_EDITOR_CONTROL_ACTIONS_H #define LUMATONE_EDITOR_CONTROL_ACTIONS_H -#include "../LumatoneEditorState.h" +#include "../data/LumatoneEditorState.h" #include "../lumatone_editor_library/actions/lumatone_action.h" #include "../data/LumatoneEditSelectionState.h" diff --git a/Source/actions/KeySelectionControlActions.h b/Source/actions/KeySelectionControlActions.h index f15fe652..0f9cbbc2 100644 --- a/Source/actions/KeySelectionControlActions.h +++ b/Source/actions/KeySelectionControlActions.h @@ -11,7 +11,7 @@ #ifndef LUMATONE_SELECTION_CONTROL_ACTIONS_H #define LUMATONE_SELECTION_CONTROL_ACTIONS_H -#include "../LumatoneEditorState.h" +#include "../data/LumatoneEditorState.h" #include "../lumatone_editor_library/actions/lumatone_action.h" #include "../data/LumatoneEditSelectionState.h" diff --git a/Source/mapping_editors/KeyboardClickListener.cpp b/Source/actions/KeyboardClickListener.cpp similarity index 97% rename from Source/mapping_editors/KeyboardClickListener.cpp rename to Source/actions/KeyboardClickListener.cpp index b3ed8ed5..99d749a7 100644 --- a/Source/mapping_editors/KeyboardClickListener.cpp +++ b/Source/actions/KeyboardClickListener.cpp @@ -1,6 +1,6 @@ #include "KeyboardClickListener.h" -#include "../actions/KeySelectionControlActions.h" +#include "./KeySelectionControlActions.h" KeyboardClickListener::KeyboardClickListener(const LumatoneEditorState &stateIn, LumatoneKeyboardComponent *keyboardComponentIn) : LumatoneEditorState("LumatoneKeyboardClickListener", stateIn) diff --git a/Source/mapping_editors/KeyboardClickListener.h b/Source/actions/KeyboardClickListener.h similarity index 97% rename from Source/mapping_editors/KeyboardClickListener.h rename to Source/actions/KeyboardClickListener.h index d073330f..035543dd 100644 --- a/Source/mapping_editors/KeyboardClickListener.h +++ b/Source/actions/KeyboardClickListener.h @@ -11,7 +11,7 @@ #ifndef LUMATONE_KEY_SELECTION_CONTROLLER_H #define LUMATONE_KEY_SELECTION_CONTROLLER_H -#include "../LumatoneEditorState.h" +#include "../data/LumatoneEditorState.h" #include "../lumatone_editor_library/ui/keyboard_component.h" #include "../lumatone_editor_library/palettes/colour_selection_broadcaster.h" // Maybe KeyboardComponentSelectionController diff --git a/Source/ColourPaletteWindow.cpp b/Source/components/ColourPaletteWindow.cpp similarity index 97% rename from Source/ColourPaletteWindow.cpp rename to Source/components/ColourPaletteWindow.cpp index 7ab9b530..e36190ec 100644 --- a/Source/ColourPaletteWindow.cpp +++ b/Source/components/ColourPaletteWindow.cpp @@ -10,13 +10,13 @@ #include "ColourPaletteWindow.h" -#include "./lumatone_editor_library/palettes/colour_selection_group.h" -#include "./lumatone_editor_library/palettes/colour_picker_panel.h" +#include "../lumatone_editor_library/palettes/colour_picker_panel.h" +#include "../lumatone_editor_library/palettes/colour_selection_group.h" -#include "./colour_palette_component.h" +#include "../controls/colour_palette_component.h" #include "./palette_edit_panel.h" -#include "./LumatoneEditorLookAndFeel.h" +#include "../style/LumatoneEditorLookAndFeel.h" //============================================================================== diff --git a/Source/ColourPaletteWindow.h b/Source/components/ColourPaletteWindow.h similarity index 95% rename from Source/ColourPaletteWindow.h rename to Source/components/ColourPaletteWindow.h index d864b390..5205085d 100644 --- a/Source/ColourPaletteWindow.h +++ b/Source/components/ColourPaletteWindow.h @@ -10,12 +10,12 @@ #pragma once -#include "./lumatone_editor_library/palettes/colour_selection_group.h" -#include "./lumatone_editor_library/palettes/colour_palette_file.h" +#include "./../lumatone_editor_library/palettes/colour_selection_group.h" +#include "./../lumatone_editor_library/palettes/colour_palette_file.h" #include "./palette_selection_panel.h" -#include "./LumatoneEditorState.h" +#include "../data/LumatoneEditorState.h" class ColourSelectionGroup; class ColourPaletteComponent; diff --git a/Source/GlobalSettingsArea.cpp b/Source/components/GlobalSettingsArea.cpp similarity index 97% rename from Source/GlobalSettingsArea.cpp rename to Source/components/GlobalSettingsArea.cpp index 1c23e13a..9e272bdd 100644 --- a/Source/GlobalSettingsArea.cpp +++ b/Source/components/GlobalSettingsArea.cpp @@ -1,332 +1,332 @@ -/* - ============================================================================== - - This is an automatically generated GUI class created by the Projucer! - - Be careful when adding custom code to these files, as only the code within - the "//[xyz]" and "//[/xyz]" sections will be retained when the file is loaded - and re-saved. - - Created with Projucer version: 6.0.8 - - ------------------------------------------------------------------------------ - - The Projucer is part of the JUCE library. - Copyright (c) 2020 - Raw Material Software Limited. - - ============================================================================== -*/ - -//[Headers] You can add your own extra header files here... -#include "LumatoneEditorLookAndFeel.h" - -#include "./Settings/SettingsContainer.h" - -//[/Headers] - -#include "GlobalSettingsArea.h" - - -//[MiscUserDefs] You can add your own user definitions and misc code here... -//[/MiscUserDefs] - -//============================================================================== -GlobalSettingsArea::GlobalSettingsArea (const LumatoneEditorState& stateIn) - : LumatoneEditorState("GlobalSettingsArea", stateIn) -{ - //[Constructor_pre] You can add your own custom stuff here.. - //[/Constructor_pre] - - lblPresetButtonColours.reset (new juce::Label ("lblPresetButtonColours", - juce::translate("Preset Button Colours:"))); - addAndMakeVisible (lblPresetButtonColours.get()); - lblPresetButtonColours->setFont (juce::Font (15.00f, juce::Font::plain).withTypefaceStyle ("Regular")); - lblPresetButtonColours->setJustificationType (juce::Justification::centredLeft); - lblPresetButtonColours->setEditable (false, false, false); - lblPresetButtonColours->setColour (juce::TextEditor::textColourId, juce::Colours::black); - lblPresetButtonColours->setColour (juce::TextEditor::backgroundColourId, juce::Colour (0x00000000)); - - lblColourInactiveMacroButton.reset (new juce::Label ("lblColourInactiveMacroButton", - juce::translate("inactive"))); - addAndMakeVisible (lblColourInactiveMacroButton.get()); - lblColourInactiveMacroButton->setFont (juce::Font (15.00f, juce::Font::plain).withTypefaceStyle ("Regular")); - lblColourInactiveMacroButton->setJustificationType (juce::Justification::centredLeft); - lblColourInactiveMacroButton->setEditable (false, false, false); - lblColourInactiveMacroButton->setColour (juce::TextEditor::textColourId, juce::Colours::black); - lblColourInactiveMacroButton->setColour (juce::TextEditor::backgroundColourId, juce::Colour (0x00000000)); - - lblColourActiveMacroButton.reset (new juce::Label ("lblColourActiveMacroButton", - juce::translate("active"))); - addAndMakeVisible (lblColourActiveMacroButton.get()); - lblColourActiveMacroButton->setFont (juce::Font (15.00f, juce::Font::plain).withTypefaceStyle ("Regular")); - lblColourActiveMacroButton->setJustificationType (juce::Justification::centredLeft); - lblColourActiveMacroButton->setEditable (false, false, false); - lblColourActiveMacroButton->setColour (juce::TextEditor::textColourId, juce::Colours::black); - lblColourActiveMacroButton->setColour (juce::TextEditor::backgroundColourId, juce::Colour (0x00000000)); - - settingsButton.reset (new juce::TextButton ("buttonCalibrate")); - addAndMakeVisible (settingsButton.get()); - settingsButton->setTooltip (juce::translate("Show controls for calibration, setting controller MIDI channels, and updating firmware")); - settingsButton->setButtonText (juce::translate("Settings")); - settingsButton->addListener (this); - - - //[UserPreSize] - activeMacroButtonColourEdit.reset(new ColourViewComponent()); - addAndMakeVisible(activeMacroButtonColourEdit.get()); - activeMacroButtonColourEdit->addChangeListener(this); - activeMacroButtonColourEdit->setColour(getActiveMacroButtonColour().toString(), false); - - inactiveMacroButtonColourEdit.reset(new ColourViewComponent()); - addAndMakeVisible(inactiveMacroButtonColourEdit.get()); - inactiveMacroButtonColourEdit->addChangeListener(this); - inactiveMacroButtonColourEdit->setColour(getInactiveMacroButtonColour().toString(), false); - - lblDeveloperMode.reset(new juce::Label("DeveloperModeLabel", "Developer Mode")); - addChildComponent(lblDeveloperMode.get()); - setDeveloperMode(getInDeveloperMode()); - - lblPresetButtonColours->setFont(getAppFonts().getFont(LumatoneEditorFont::UniviaProBold)); - lblColourActiveMacroButton->setFont(getAppFonts().getFont(LumatoneEditorFont::GothamNarrowMedium)); - lblPresetButtonColours->setFont(getAppFonts().getFont(LumatoneEditorFont::UniviaProBold)); - - addStatusListener(this); - addEditorListener(this); - - settingsButton->setEnabled(false); - - lblPresetButtonColours->setColour(Label::ColourIds::textColourId, getEditorLookAndFeel().findColour(LumatoneEditorColourIDs::LabelPink)); - - lblColourActiveMacroButton->setColour(Label::ColourIds::textColourId, getEditorLookAndFeel().findColour(LumatoneEditorColourIDs::DescriptionText)); - lblColourInactiveMacroButton->setColour(Label::ColourIds::textColourId, getEditorLookAndFeel().findColour(LumatoneEditorColourIDs::DescriptionText)); - - settingsButton->setColour(TextButton::ColourIds::buttonColourId, Colour(0xff383b3d)); - settingsButton->setColour(TextButton::ColourIds::textColourOffId, Colour(0xffffffff)); - - connectionStateChanged(getConnectionState()); - - /* We don't want a resize here - /* - //[/UserPreSize] - - setSize (456, 64); - - - //[Constructor] You can add your own custom stuff here.. - */ - - - // Set values according to the properties files - // restoreStateFromPropertiesFile(TerpstraSysExApplication::getApp().getPropertiesFile()); - //[/Constructor] -} - -GlobalSettingsArea::~GlobalSettingsArea() -{ - //[Destructor_pre]. You can add your own custom destruction code here.. - inactiveMacroButtonColourEdit = nullptr; - activeMacroButtonColourEdit = nullptr; - //[/Destructor_pre] - - lblPresetButtonColours = nullptr; - lblColourInactiveMacroButton = nullptr; - lblColourActiveMacroButton = nullptr; - settingsButton = nullptr; - - - //[Destructor]. You can add your own custom destruction code here.. - //[/Destructor] -} - -void GlobalSettingsArea::macroButtonInactiveColourChanged(juce::Colour colour) -{ - inactiveMacroButtonColourEdit->setColour(colour.toString(), false); -} - -void GlobalSettingsArea::macroButtonActiveColourChanged(juce::Colour colour) -{ - activeMacroButtonColourEdit->setColour(colour.toString(), false); -} - -//============================================================================== -void GlobalSettingsArea::paint (juce::Graphics& g) -{ - //[UserPrePaint] Add your own custom painting code here.. - //[/UserPrePaint] - - g.setColour(getEditorLookAndFeel().findColour(LumatoneEditorColourIDs::MediumBackground)); - g.fillAll(); - - //[UserPaint] Add your own custom painting code here.. - //[/UserPaint] -} - -void GlobalSettingsArea::resized() -{ - //[UserPreResize] Add your own custom resize code here.. - - // Build right-to-left - - int calbrateBtnHeight = roundToInt(getHeight() * calibrateHeight); - int calibrateWidth = getLookAndFeel().getTextButtonWidthToFitText(*settingsButton, calbrateBtnHeight); - - float controlsMargin = roundToInt(getHeight() * 0.1f); - float colourEditHeight = proportionOfHeight(controlsHeight); - float controlY = proportionOfHeight((1 - controlsHeight) / 2.0f); - float colourButtonWidth = colourEditHeight * colourButtonAspect; - Font colourLabelsFont = getAppFonts().getFont(LumatoneEditorFont::FranklinGothic, colourEditHeight * 1.1f); - - int startMargin = proportionOfWidth(marginXRatio); - settingsButton->setSize(calibrateWidth, calbrateBtnHeight); - settingsButton->setTopRightPosition(getWidth() - startMargin, roundToInt((getHeight() - settingsButton->getHeight()) * 0.5f)); - - lblColourInactiveMacroButton->setFont(colourLabelsFont); - resizeLabelWithHeight(lblColourInactiveMacroButton.get(), colourEditHeight); - lblColourInactiveMacroButton->setTopRightPosition(settingsButton->getX() - controlsMargin, controlY); - - inactiveMacroButtonColourEdit->setSize(colourButtonWidth, colourEditHeight); - inactiveMacroButtonColourEdit->setTopRightPosition(lblColourInactiveMacroButton->getX() - controlsMargin, controlY); - - lblColourActiveMacroButton->setFont(colourLabelsFont); - resizeLabelWithHeight(lblColourActiveMacroButton.get(), colourEditHeight); - lblColourActiveMacroButton->setTopRightPosition(inactiveMacroButtonColourEdit->getX() - controlsMargin, controlY); - - activeMacroButtonColourEdit->setSize(colourButtonWidth, colourEditHeight); - activeMacroButtonColourEdit->setTopRightPosition(lblColourActiveMacroButton->getX() - controlsMargin, controlY); - - resizeLabelWithHeight(lblPresetButtonColours.get(), colourEditHeight); - lblPresetButtonColours->setTopRightPosition(activeMacroButtonColourEdit->getX() - controlsMargin, controlY); - - resizeLabelWithHeight(lblDeveloperMode.get(), getHeight()); - lblDeveloperMode->setCentrePosition(getLocalBounds().getCentre()); - - //[/UserPreResize] - - //[UserResized] Add your own custom resize handling here.. - //[/UserResized] -} - -void GlobalSettingsArea::buttonClicked (juce::Button* buttonThatWasClicked) -{ - //[UserbuttonClicked_Pre] - //[/UserbuttonClicked_Pre] - - if (buttonThatWasClicked == settingsButton.get()) - { - //[UserButtonCode_buttonCalibrate] -- add your button handler code here.. - - auto settingsComponent = new SettingsContainer(*this); - settingsComponent->setLookAndFeel(&getLookAndFeel()); - - DialogWindow::LaunchOptions launchOptions; - launchOptions.content.setOwned(settingsComponent); - launchOptions.content->setSize(480, 240); - - launchOptions.dialogTitle = "Settings"; - launchOptions.escapeKeyTriggersCloseButton = true; - launchOptions.useNativeTitleBar = false; - launchOptions.resizable = false; - - launchOptions.dialogBackgroundColour = Colour(); - - auto settingsDialog = launchOptions.launchAsync(); - settingsDialog->setLookAndFeel(static_cast(&getEditorLookAndFeel().compactWindowStyle)); - settingsDialog->centreWithSize(548, 240); - - // TerpstraSysExApplication::getApp().setOpenDialogWindow(settingsDialog); - - //[/UserButtonCode_buttonCalibrate] - } - - //[UserbuttonClicked_Post] - //[/UserbuttonClicked_Post] -} - - - -//[MiscUserCode] You can add your own definitions of your custom methods or any other code here... - -void GlobalSettingsArea::changeListenerCallback(ChangeBroadcaster *source) -{ - if (source == inactiveMacroButtonColourEdit.get()) - { - setInactiveMacroButtonColour(inactiveMacroButtonColourEdit->getColourAsObject()); - } - else if (source == activeMacroButtonColourEdit.get()) - { - setActiveMacroButtonColour(activeMacroButtonColourEdit->getColourAsObject()); - } -} - -void GlobalSettingsArea::listenToColourEditButtons(Button::Listener* listenerIn) -{ - inactiveMacroButtonColourEdit->addListener(listenerIn); - activeMacroButtonColourEdit->addListener(listenerIn); -} - -void GlobalSettingsArea::setDeveloperMode(bool devModeOn) -{ - showDeveloperMode = devModeOn; - lblDeveloperMode->setVisible(showDeveloperMode); - if (devModeOn) - settingsButton->setEnabled(true); - repaint(); -} - -void GlobalSettingsArea::connectionStateChanged(ConnectionState state) -{ - settingsButton->setEnabled(state == ConnectionState::ONLINE); - inactiveMacroButtonColourEdit->setEnabled(state == ConnectionState::ONLINE); - activeMacroButtonColourEdit->setEnabled(state == ConnectionState::ONLINE); -} - -// void GlobalSettingsArea::connectionFaile() -// { -// settingsButton->setEnabled(false); -// } - -//[/MiscUserCode] - - -//============================================================================== -#if 0 -/* -- Projucer information section -- - - This is where the Projucer stores the metadata that describe this GUI layout, so - make changes in here at your peril! - -BEGIN_JUCER_METADATA - - - - - -END_JUCER_METADATA -*/ -#endif - - -//[EndFile] You can add extra defines here... -//[/EndFile] +/* + ============================================================================== + + This is an automatically generated GUI class created by the Projucer! + + Be careful when adding custom code to these files, as only the code within + the "//[xyz]" and "//[/xyz]" sections will be retained when the file is loaded + and re-saved. + + Created with Projucer version: 6.0.8 + + ------------------------------------------------------------------------------ + + The Projucer is part of the JUCE library. + Copyright (c) 2020 - Raw Material Software Limited. + + ============================================================================== +*/ + +//[Headers] You can add your own extra header files here... +#include "../style/LumatoneEditorLookAndFeel.h" + +#include "../Settings/SettingsContainer.h" + +//[/Headers] + +#include "GlobalSettingsArea.h" + + +//[MiscUserDefs] You can add your own user definitions and misc code here... +//[/MiscUserDefs] + +//============================================================================== +GlobalSettingsArea::GlobalSettingsArea (const LumatoneEditorState& stateIn) + : LumatoneEditorState("GlobalSettingsArea", stateIn) +{ + //[Constructor_pre] You can add your own custom stuff here.. + //[/Constructor_pre] + + lblPresetButtonColours.reset (new juce::Label ("lblPresetButtonColours", + juce::translate("Preset Button Colours:"))); + addAndMakeVisible (lblPresetButtonColours.get()); + lblPresetButtonColours->setFont (juce::Font (15.00f, juce::Font::plain).withTypefaceStyle ("Regular")); + lblPresetButtonColours->setJustificationType (juce::Justification::centredLeft); + lblPresetButtonColours->setEditable (false, false, false); + lblPresetButtonColours->setColour (juce::TextEditor::textColourId, juce::Colours::black); + lblPresetButtonColours->setColour (juce::TextEditor::backgroundColourId, juce::Colour (0x00000000)); + + lblColourInactiveMacroButton.reset (new juce::Label ("lblColourInactiveMacroButton", + juce::translate("inactive"))); + addAndMakeVisible (lblColourInactiveMacroButton.get()); + lblColourInactiveMacroButton->setFont (juce::Font (15.00f, juce::Font::plain).withTypefaceStyle ("Regular")); + lblColourInactiveMacroButton->setJustificationType (juce::Justification::centredLeft); + lblColourInactiveMacroButton->setEditable (false, false, false); + lblColourInactiveMacroButton->setColour (juce::TextEditor::textColourId, juce::Colours::black); + lblColourInactiveMacroButton->setColour (juce::TextEditor::backgroundColourId, juce::Colour (0x00000000)); + + lblColourActiveMacroButton.reset (new juce::Label ("lblColourActiveMacroButton", + juce::translate("active"))); + addAndMakeVisible (lblColourActiveMacroButton.get()); + lblColourActiveMacroButton->setFont (juce::Font (15.00f, juce::Font::plain).withTypefaceStyle ("Regular")); + lblColourActiveMacroButton->setJustificationType (juce::Justification::centredLeft); + lblColourActiveMacroButton->setEditable (false, false, false); + lblColourActiveMacroButton->setColour (juce::TextEditor::textColourId, juce::Colours::black); + lblColourActiveMacroButton->setColour (juce::TextEditor::backgroundColourId, juce::Colour (0x00000000)); + + settingsButton.reset (new juce::TextButton ("buttonCalibrate")); + addAndMakeVisible (settingsButton.get()); + settingsButton->setTooltip (juce::translate("Show controls for calibration, setting controller MIDI channels, and updating firmware")); + settingsButton->setButtonText (juce::translate("Settings")); + settingsButton->addListener (this); + + + //[UserPreSize] + activeMacroButtonColourEdit.reset(new ColourViewComponent()); + addAndMakeVisible(activeMacroButtonColourEdit.get()); + activeMacroButtonColourEdit->addChangeListener(this); + activeMacroButtonColourEdit->setColour(getActiveMacroButtonColour().toString(), false); + + inactiveMacroButtonColourEdit.reset(new ColourViewComponent()); + addAndMakeVisible(inactiveMacroButtonColourEdit.get()); + inactiveMacroButtonColourEdit->addChangeListener(this); + inactiveMacroButtonColourEdit->setColour(getInactiveMacroButtonColour().toString(), false); + + lblDeveloperMode.reset(new juce::Label("DeveloperModeLabel", "Developer Mode")); + addChildComponent(lblDeveloperMode.get()); + setDeveloperMode(getInDeveloperMode()); + + lblPresetButtonColours->setFont(getAppFonts().getFont(LumatoneEditorFont::UniviaProBold)); + lblColourActiveMacroButton->setFont(getAppFonts().getFont(LumatoneEditorFont::GothamNarrowMedium)); + lblPresetButtonColours->setFont(getAppFonts().getFont(LumatoneEditorFont::UniviaProBold)); + + addStatusListener(this); + addEditorListener(this); + + settingsButton->setEnabled(false); + + lblPresetButtonColours->setColour(Label::ColourIds::textColourId, getEditorLookAndFeel().findColour(LumatoneEditorColourIDs::LabelPink)); + + lblColourActiveMacroButton->setColour(Label::ColourIds::textColourId, getEditorLookAndFeel().findColour(LumatoneEditorColourIDs::DescriptionText)); + lblColourInactiveMacroButton->setColour(Label::ColourIds::textColourId, getEditorLookAndFeel().findColour(LumatoneEditorColourIDs::DescriptionText)); + + settingsButton->setColour(TextButton::ColourIds::buttonColourId, Colour(0xff383b3d)); + settingsButton->setColour(TextButton::ColourIds::textColourOffId, Colour(0xffffffff)); + + connectionStateChanged(getConnectionState()); + + /* We don't want a resize here + /* + //[/UserPreSize] + + setSize (456, 64); + + + //[Constructor] You can add your own custom stuff here.. + */ + + + // Set values according to the properties files + // restoreStateFromPropertiesFile(TerpstraSysExApplication::getApp().getPropertiesFile()); + //[/Constructor] +} + +GlobalSettingsArea::~GlobalSettingsArea() +{ + //[Destructor_pre]. You can add your own custom destruction code here.. + inactiveMacroButtonColourEdit = nullptr; + activeMacroButtonColourEdit = nullptr; + //[/Destructor_pre] + + lblPresetButtonColours = nullptr; + lblColourInactiveMacroButton = nullptr; + lblColourActiveMacroButton = nullptr; + settingsButton = nullptr; + + + //[Destructor]. You can add your own custom destruction code here.. + //[/Destructor] +} + +void GlobalSettingsArea::macroButtonInactiveColourChanged(juce::Colour colour) +{ + inactiveMacroButtonColourEdit->setColour(colour.toString(), false); +} + +void GlobalSettingsArea::macroButtonActiveColourChanged(juce::Colour colour) +{ + activeMacroButtonColourEdit->setColour(colour.toString(), false); +} + +//============================================================================== +void GlobalSettingsArea::paint (juce::Graphics& g) +{ + //[UserPrePaint] Add your own custom painting code here.. + //[/UserPrePaint] + + g.setColour(getEditorLookAndFeel().findColour(LumatoneEditorColourIDs::MediumBackground)); + g.fillAll(); + + //[UserPaint] Add your own custom painting code here.. + //[/UserPaint] +} + +void GlobalSettingsArea::resized() +{ + //[UserPreResize] Add your own custom resize code here.. + + // Build right-to-left + + int calbrateBtnHeight = roundToInt(getHeight() * calibrateHeight); + int calibrateWidth = getLookAndFeel().getTextButtonWidthToFitText(*settingsButton, calbrateBtnHeight); + + float controlsMargin = roundToInt(getHeight() * 0.1f); + float colourEditHeight = proportionOfHeight(controlsHeight); + float controlY = proportionOfHeight((1 - controlsHeight) / 2.0f); + float colourButtonWidth = colourEditHeight * colourButtonAspect; + Font colourLabelsFont = getAppFonts().getFont(LumatoneEditorFont::FranklinGothic, colourEditHeight * 1.1f); + + int startMargin = proportionOfWidth(marginXRatio); + settingsButton->setSize(calibrateWidth, calbrateBtnHeight); + settingsButton->setTopRightPosition(getWidth() - startMargin, roundToInt((getHeight() - settingsButton->getHeight()) * 0.5f)); + + lblColourInactiveMacroButton->setFont(colourLabelsFont); + resizeLabelWithHeight(lblColourInactiveMacroButton.get(), colourEditHeight); + lblColourInactiveMacroButton->setTopRightPosition(settingsButton->getX() - controlsMargin, controlY); + + inactiveMacroButtonColourEdit->setSize(colourButtonWidth, colourEditHeight); + inactiveMacroButtonColourEdit->setTopRightPosition(lblColourInactiveMacroButton->getX() - controlsMargin, controlY); + + lblColourActiveMacroButton->setFont(colourLabelsFont); + resizeLabelWithHeight(lblColourActiveMacroButton.get(), colourEditHeight); + lblColourActiveMacroButton->setTopRightPosition(inactiveMacroButtonColourEdit->getX() - controlsMargin, controlY); + + activeMacroButtonColourEdit->setSize(colourButtonWidth, colourEditHeight); + activeMacroButtonColourEdit->setTopRightPosition(lblColourActiveMacroButton->getX() - controlsMargin, controlY); + + resizeLabelWithHeight(lblPresetButtonColours.get(), colourEditHeight); + lblPresetButtonColours->setTopRightPosition(activeMacroButtonColourEdit->getX() - controlsMargin, controlY); + + resizeLabelWithHeight(lblDeveloperMode.get(), getHeight()); + lblDeveloperMode->setCentrePosition(getLocalBounds().getCentre()); + + //[/UserPreResize] + + //[UserResized] Add your own custom resize handling here.. + //[/UserResized] +} + +void GlobalSettingsArea::buttonClicked (juce::Button* buttonThatWasClicked) +{ + //[UserbuttonClicked_Pre] + //[/UserbuttonClicked_Pre] + + if (buttonThatWasClicked == settingsButton.get()) + { + //[UserButtonCode_buttonCalibrate] -- add your button handler code here.. + + auto settingsComponent = new SettingsContainer(*this); + settingsComponent->setLookAndFeel(&getLookAndFeel()); + + DialogWindow::LaunchOptions launchOptions; + launchOptions.content.setOwned(settingsComponent); + launchOptions.content->setSize(480, 240); + + launchOptions.dialogTitle = "Settings"; + launchOptions.escapeKeyTriggersCloseButton = true; + launchOptions.useNativeTitleBar = false; + launchOptions.resizable = false; + + launchOptions.dialogBackgroundColour = Colour(); + + auto settingsDialog = launchOptions.launchAsync(); + settingsDialog->setLookAndFeel(static_cast(&getEditorLookAndFeel().compactWindowStyle)); + settingsDialog->centreWithSize(548, 240); + + // TerpstraSysExApplication::getApp().setOpenDialogWindow(settingsDialog); + + //[/UserButtonCode_buttonCalibrate] + } + + //[UserbuttonClicked_Post] + //[/UserbuttonClicked_Post] +} + + + +//[MiscUserCode] You can add your own definitions of your custom methods or any other code here... + +void GlobalSettingsArea::changeListenerCallback(ChangeBroadcaster *source) +{ + if (source == inactiveMacroButtonColourEdit.get()) + { + setInactiveMacroButtonColour(inactiveMacroButtonColourEdit->getColourAsObject()); + } + else if (source == activeMacroButtonColourEdit.get()) + { + setActiveMacroButtonColour(activeMacroButtonColourEdit->getColourAsObject()); + } +} + +void GlobalSettingsArea::listenToColourEditButtons(Button::Listener* listenerIn) +{ + inactiveMacroButtonColourEdit->addListener(listenerIn); + activeMacroButtonColourEdit->addListener(listenerIn); +} + +void GlobalSettingsArea::setDeveloperMode(bool devModeOn) +{ + showDeveloperMode = devModeOn; + lblDeveloperMode->setVisible(showDeveloperMode); + if (devModeOn) + settingsButton->setEnabled(true); + repaint(); +} + +void GlobalSettingsArea::connectionStateChanged(ConnectionState state) +{ + settingsButton->setEnabled(state == ConnectionState::ONLINE); + inactiveMacroButtonColourEdit->setEnabled(state == ConnectionState::ONLINE); + activeMacroButtonColourEdit->setEnabled(state == ConnectionState::ONLINE); +} + +// void GlobalSettingsArea::connectionFaile() +// { +// settingsButton->setEnabled(false); +// } + +//[/MiscUserCode] + + +//============================================================================== +#if 0 +/* -- Projucer information section -- + + This is where the Projucer stores the metadata that describe this GUI layout, so + make changes in here at your peril! + +BEGIN_JUCER_METADATA + + + + + +END_JUCER_METADATA +*/ +#endif + + +//[EndFile] You can add extra defines here... +//[/EndFile] diff --git a/Source/GlobalSettingsArea.h b/Source/components/GlobalSettingsArea.h similarity index 92% rename from Source/GlobalSettingsArea.h rename to Source/components/GlobalSettingsArea.h index b2162db9..5993a54c 100644 --- a/Source/GlobalSettingsArea.h +++ b/Source/components/GlobalSettingsArea.h @@ -1,116 +1,116 @@ -/* - ============================================================================== - - This is an automatically generated GUI class created by the Projucer! - - Be careful when adding custom code to these files, as only the code within - the "//[xyz]" and "//[/xyz]" sections will be retained when the file is loaded - and re-saved. - - Created with Projucer version: 6.0.8 - - ------------------------------------------------------------------------------ - - The Projucer is part of the JUCE library. - Copyright (c) 2020 - Raw Material Software Limited. - - ============================================================================== -*/ - -#pragma once - -//[Headers] -- You can add your own extra header files here -- -#include - -#include "./LumatoneEditorState.h" - -#include "./lumatone_editor_library/listeners/status_listener.h" -#include "./lumatone_editor_library/listeners/editor_listener.h" -#include "./colour_view_component.h" - -//[/Headers] - - - -//============================================================================== -/** - //[Comments] - An auto-generated component, created by the Projucer. - - Describe your class and how it works here! - //[/Comments] -*/ -class GlobalSettingsArea : public juce::Component, - public LumatoneEditorState, - public ChangeListener, - public LumatoneEditor::StatusListener, - public LumatoneEditor::EditorListener, - public juce::Button::Listener -{ -public: - //============================================================================== - GlobalSettingsArea (const LumatoneEditorState& stateIn); - ~GlobalSettingsArea() override; - - //============================================================================== - //[UserMethods] -- You can add your own custom methods in this section. - void changeListenerCallback(ChangeBroadcaster *source) override; - - void listenToColourEditButtons(Button::Listener* listenerIn); - - void setDeveloperMode(bool devModeOn); - - // LumatoneEditor::StatusListener implementation - void connectionStateChanged(ConnectionState newState) override; - - // LumatoneEditor::EditorListener implementation - void macroButtonInactiveColourChanged(juce::Colour colour) override; - void macroButtonActiveColourChanged(juce::Colour colour) override; - - //[/UserMethods] - - void paint (juce::Graphics& g) override; - void resized() override; - void buttonClicked (juce::Button* buttonThatWasClicked) override; - - -private: - //[UserVariables] -- You can add your own custom variables in this section. - std::unique_ptr inactiveMacroButtonColourEdit; - std::unique_ptr activeMacroButtonColourEdit; - - std::unique_ptr