From adb33c8c2361612ba37210c52d2b918438a8cb1c Mon Sep 17 00:00:00 2001 From: George Reales Date: Tue, 27 Apr 2021 10:17:13 +0200 Subject: [PATCH] Preset bar show hide status --- Source/PluginEditor.cpp | 6 +++--- Source/PluginEditor.h | 1 - Source/PluginProcessor.cpp | 3 ++- Source/PluginProcessor.h | 12 +++++++++++- 4 files changed, 16 insertions(+), 6 deletions(-) mode change 100755 => 100644 Source/PluginEditor.cpp mode change 100755 => 100644 Source/PluginProcessor.cpp diff --git a/Source/PluginEditor.cpp b/Source/PluginEditor.cpp old mode 100755 new mode 100644 index 8e5be25..d0c1483 --- a/Source/PluginEditor.cpp +++ b/Source/PluginEditor.cpp @@ -273,7 +273,7 @@ void ObxdAudioProcessorEditor::loadSkin (ObxdAudioProcessor& ownerFilter) presetBar.reset(new PresetBar(*this)); addAndMakeVisible(*presetBar); - presetBar->setVisible(showPresetBar); + presetBar->setVisible(processor.getShowPresetBar()); presetBar->setBounds( (getWidth() - presetBar->getWidth())/2, getHeight(), presetBar->getWidth(), presetBar->getHeight()); updatePresetBar(); @@ -559,14 +559,14 @@ void ObxdAudioProcessorEditor::resultFromMenu (const Point pos) MenuActionCallback(result); } else if (result == progStart + 1000){ - this->showPresetBar = !this->showPresetBar; + processor.setShowPresetBar(!processor.getShowPresetBar()); updatePresetBar(); } } void ObxdAudioProcessorEditor::updatePresetBar(){ DBG(" H: " << getHeight() <<" W:" <getWidth() << " CH" <getHeight() << " CX:" <getX() << " CY: " <getY()); - if (this->showPresetBar){ + if (processor.getShowPresetBar()){ this->setSize(this->getWidth(), this->getHeight() + 40); presetBar->setVisible(true); } diff --git a/Source/PluginEditor.h b/Source/PluginEditor.h index cab6d9f..5571df5 100755 --- a/Source/PluginEditor.h +++ b/Source/PluginEditor.h @@ -253,7 +253,6 @@ private: int bankStart; int skinStart; - bool showPresetBar = false; Array skins; Array banks; std::unique_ptr setPresetNameWindow; diff --git a/Source/PluginProcessor.cpp b/Source/PluginProcessor.cpp old mode 100755 new mode 100644 index e148c78..18b88cd --- a/Source/PluginProcessor.cpp +++ b/Source/PluginProcessor.cpp @@ -70,7 +70,7 @@ ObxdAudioProcessor::ObxdAudioProcessor() options.millisecondsBeforeSaving = 2500; options.processLock = &configLock; config = std::unique_ptr (new PropertiesFile (getDocumentFolder().getChildFile ("Skin.xml"), options)); - + showPresetBar = config->getBoolValue("presetnavigation"); currentSkin = config->containsKey("skin") ? config->getValue("skin") : "Ilkka Rosma Dark"; currentBank = "000 - FMR OB-Xa Patch Book"; @@ -93,6 +93,7 @@ ObxdAudioProcessor::ObxdAudioProcessor() ObxdAudioProcessor::~ObxdAudioProcessor() { + config->saveIfNeeded(); config = nullptr; } diff --git a/Source/PluginProcessor.h b/Source/PluginProcessor.h index a03a87d..1631a74 100755 --- a/Source/PluginProcessor.h +++ b/Source/PluginProcessor.h @@ -200,7 +200,15 @@ public: void setEngineParameterValue (int, float, bool notifyToHost= false); void parameterChanged (const String&, float) override; AudioProcessorValueTreeState& getPluginState(); - + + bool getShowPresetBar(){ + return this->showPresetBar; + } + + void setShowPresetBar(bool val){ + this->showPresetBar = val; + config->setValue("presetnavigation", this->showPresetBar); + } private: //============================================================================== bool isHostAutomatedChange; @@ -229,6 +237,8 @@ public: String currentPreset; File currentPresetFile; void savePreset(); + + bool showPresetBar = false; private: Array bankFiles; Array skinFiles;