2
0
Fork 0

Preset bar show hide status

This commit is contained in:
George Reales 2021-04-27 10:17:13 +02:00
parent 65b7e2275f
commit adb33c8c23
4 changed files with 16 additions and 6 deletions

6
Source/PluginEditor.cpp Executable file → Normal file
View file

@ -273,7 +273,7 @@ void ObxdAudioProcessorEditor::loadSkin (ObxdAudioProcessor& ownerFilter)
presetBar.reset(new PresetBar(*this)); presetBar.reset(new PresetBar(*this));
addAndMakeVisible(*presetBar); addAndMakeVisible(*presetBar);
presetBar->setVisible(showPresetBar); presetBar->setVisible(processor.getShowPresetBar());
presetBar->setBounds( presetBar->setBounds(
(getWidth() - presetBar->getWidth())/2, getHeight(), presetBar->getWidth(), presetBar->getHeight()); (getWidth() - presetBar->getWidth())/2, getHeight(), presetBar->getWidth(), presetBar->getHeight());
updatePresetBar(); updatePresetBar();
@ -559,14 +559,14 @@ void ObxdAudioProcessorEditor::resultFromMenu (const Point<int> pos)
MenuActionCallback(result); MenuActionCallback(result);
} }
else if (result == progStart + 1000){ else if (result == progStart + 1000){
this->showPresetBar = !this->showPresetBar; processor.setShowPresetBar(!processor.getShowPresetBar());
updatePresetBar(); updatePresetBar();
} }
} }
void ObxdAudioProcessorEditor::updatePresetBar(){ void ObxdAudioProcessorEditor::updatePresetBar(){
DBG(" H: " << getHeight() <<" W:" <<getWidth() << " CW:"<<presetBar->getWidth() << " CH" <<presetBar->getHeight() << " CX:" <<presetBar->getX() << " CY: " <<presetBar->getY()); DBG(" H: " << getHeight() <<" W:" <<getWidth() << " CW:"<<presetBar->getWidth() << " CH" <<presetBar->getHeight() << " CX:" <<presetBar->getX() << " CY: " <<presetBar->getY());
if (this->showPresetBar){ if (processor.getShowPresetBar()){
this->setSize(this->getWidth(), this->getHeight() + 40); this->setSize(this->getWidth(), this->getHeight() + 40);
presetBar->setVisible(true); presetBar->setVisible(true);
} }

View file

@ -253,7 +253,6 @@ private:
int bankStart; int bankStart;
int skinStart; int skinStart;
bool showPresetBar = false;
Array<File> skins; Array<File> skins;
Array<File> banks; Array<File> banks;
std::unique_ptr<SetPresetNameWindow> setPresetNameWindow; std::unique_ptr<SetPresetNameWindow> setPresetNameWindow;

3
Source/PluginProcessor.cpp Executable file → Normal file
View file

@ -70,7 +70,7 @@ ObxdAudioProcessor::ObxdAudioProcessor()
options.millisecondsBeforeSaving = 2500; options.millisecondsBeforeSaving = 2500;
options.processLock = &configLock; options.processLock = &configLock;
config = std::unique_ptr<PropertiesFile> (new PropertiesFile (getDocumentFolder().getChildFile ("Skin.xml"), options)); config = std::unique_ptr<PropertiesFile> (new PropertiesFile (getDocumentFolder().getChildFile ("Skin.xml"), options));
showPresetBar = config->getBoolValue("presetnavigation");
currentSkin = config->containsKey("skin") ? config->getValue("skin") : "Ilkka Rosma Dark"; currentSkin = config->containsKey("skin") ? config->getValue("skin") : "Ilkka Rosma Dark";
currentBank = "000 - FMR OB-Xa Patch Book"; currentBank = "000 - FMR OB-Xa Patch Book";
@ -93,6 +93,7 @@ ObxdAudioProcessor::ObxdAudioProcessor()
ObxdAudioProcessor::~ObxdAudioProcessor() ObxdAudioProcessor::~ObxdAudioProcessor()
{ {
config->saveIfNeeded(); config->saveIfNeeded();
config = nullptr; config = nullptr;
} }

View file

@ -200,7 +200,15 @@ public:
void setEngineParameterValue (int, float, bool notifyToHost= false); void setEngineParameterValue (int, float, bool notifyToHost= false);
void parameterChanged (const String&, float) override; void parameterChanged (const String&, float) override;
AudioProcessorValueTreeState& getPluginState(); AudioProcessorValueTreeState& getPluginState();
bool getShowPresetBar(){
return this->showPresetBar;
}
void setShowPresetBar(bool val){
this->showPresetBar = val;
config->setValue("presetnavigation", this->showPresetBar);
}
private: private:
//============================================================================== //==============================================================================
bool isHostAutomatedChange; bool isHostAutomatedChange;
@ -229,6 +237,8 @@ public:
String currentPreset; String currentPreset;
File currentPresetFile; File currentPresetFile;
void savePreset(); void savePreset();
bool showPresetBar = false;
private: private:
Array<File> bankFiles; Array<File> bankFiles;
Array<File> skinFiles; Array<File> skinFiles;