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));
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<int> 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() << " 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);
presetBar->setVisible(true);
}

View file

@ -253,7 +253,6 @@ private:
int bankStart;
int skinStart;
bool showPresetBar = false;
Array<File> skins;
Array<File> banks;
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.processLock = &configLock;
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";
currentBank = "000 - FMR OB-Xa Patch Book";
@ -93,6 +93,7 @@ ObxdAudioProcessor::ObxdAudioProcessor()
ObxdAudioProcessor::~ObxdAudioProcessor()
{
config->saveIfNeeded();
config = nullptr;
}

View file

@ -201,6 +201,14 @@ public:
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<File> bankFiles;
Array<File> skinFiles;