2
0
Fork 0

Update PluginGui.cpp

Fixed load/save SBI dialog windows.
This commit is contained in:
George Reales 2020-05-13 21:02:10 +02:00
parent 3cdde1af35
commit 87de633936

View file

@ -2352,6 +2352,11 @@ void PluginGui::resized()
//[UserPreResize] Add your own custom resize code here.. //[UserPreResize] Add your own custom resize code here..
//[/UserPreResize] //[/UserPreResize]
#ifdef JUCE_IOS
auto& desktop = Desktop::getInstance();
desktop.setGlobalScaleFactor(1.185); // scaling factor
#endif
//[UserResized] Add your own custom resize handling here.. //[UserResized] Add your own custom resize handling here..
for (unsigned int i = 0; i < channels.size(); ++i) for (unsigned int i = 0; i < channels.size(); ++i)
channels[i]->setBounds(64+88*i, 30, 28, 28); channels[i]->setBounds(64+88*i, 30, 28, 28);
@ -2680,7 +2685,15 @@ void PluginGui::buttonClicked (Button* buttonThatWasClicked)
else if (buttonThatWasClicked == exportButton.get()) else if (buttonThatWasClicked == exportButton.get())
{ {
//[UserButtonCode_exportButton] -- add your button handler code here.. //[UserButtonCode_exportButton] -- add your button handler code here..
WildcardFileFilter wildcardFilter("*.sbi", String(), "SBI files"); FileChooser browser("Select SBI instrument file",
instrumentLoadDirectory,
"*");//"*.sbi");
if (browser.browseForFileToSave(true)){
File selectedFile = browser.getResult();
instrumentSaveDirectory = selectedFile.getParentDirectory();
processor->saveInstrumentToFile(selectedFile.getFullPathName());
}
/*WildcardFileFilter wildcardFilter("*.sbi", String(), "SBI files");
FileBrowserComponent browser(FileBrowserComponent::saveMode + FileBrowserComponent::canSelectFiles, FileBrowserComponent browser(FileBrowserComponent::saveMode + FileBrowserComponent::canSelectFiles,
instrumentSaveDirectory, instrumentSaveDirectory,
&wildcardFilter, &wildcardFilter,
@ -2689,19 +2702,27 @@ void PluginGui::buttonClicked (Button* buttonThatWasClicked)
"Specify SBI output file", "Specify SBI output file",
browser, browser,
true, true,
Colours::darkgreen); Colours::darkgreen, this);
if (dialogBox.show()) if (dialogBox.show())
{ {
File selectedFile = browser.getSelectedFile(0); File selectedFile = browser.getSelectedFile(0);
instrumentSaveDirectory = browser.getRoot(); instrumentSaveDirectory = browser.getRoot();
processor->saveInstrumentToFile(selectedFile.getFullPathName()); processor->saveInstrumentToFile(selectedFile.getFullPathName());
} }*/
//[/UserButtonCode_exportButton] //[/UserButtonCode_exportButton]
} }
else if (buttonThatWasClicked == loadButton.get()) else if (buttonThatWasClicked == loadButton.get())
{ {
//[UserButtonCode_loadButton] -- add your button handler code here.. //[UserButtonCode_loadButton] -- add your button handler code here..
WildcardFileFilter wildcardFilter("*.sbi", String(), "SBI files"); FileChooser browser("Select SBI instrument file",
instrumentLoadDirectory,
"*");//"*.sbi");
if (browser.browseForFileToOpen()){
File selectedFile = browser.getResult();
instrumentLoadDirectory = selectedFile.getParentDirectory();
processor->loadInstrumentFromFile(selectedFile.getFullPathName());
}
/*WildcardFileFilter wildcardFilter("*.sbi", String(), "SBI files");
FileBrowserComponent browser(FileBrowserComponent::openMode + FileBrowserComponent::canSelectFiles, FileBrowserComponent browser(FileBrowserComponent::openMode + FileBrowserComponent::canSelectFiles,
instrumentLoadDirectory, instrumentLoadDirectory,
&wildcardFilter, &wildcardFilter,
@ -2710,13 +2731,13 @@ void PluginGui::buttonClicked (Button* buttonThatWasClicked)
"Select SBI instrument file", "Select SBI instrument file",
browser, browser,
false, false,
Colours::darkgreen); Colours::darkgreen, this);
if (dialogBox.show()) if (dialogBox.show())
{ {
File selectedFile = browser.getSelectedFile(0); File selectedFile = browser.getSelectedFile(0);
instrumentLoadDirectory = browser.getRoot(); instrumentLoadDirectory = browser.getRoot();
processor->loadInstrumentFromFile(selectedFile.getFullPathName()); processor->loadInstrumentFromFile(selectedFile.getFullPathName());
} }*/
//[/UserButtonCode_loadButton] //[/UserButtonCode_loadButton]
} }
else if (buttonThatWasClicked == ToggleButtonOffExample.get()) else if (buttonThatWasClicked == ToggleButtonOffExample.get())