@@ -48,7 +48,9 @@ void cat2color(const char* cat, juce::Colour &col)
48
48
49
49
// ==============================================================================
50
50
PluginEditor::PluginEditor (MachineEditor* ed, const char * id, const char * cat, PluginSelector *ps) :
51
- ed(ed), pid(id), ps(ps), cat(cat), lastDirectory(juce::File::getSpecialLocation(juce::File::userMusicDirectory))
51
+ ed(ed), pid(id), ps(ps), cat(cat),
52
+ lastIRDirectory(juce::File::getSpecialLocation(juce::File::userMusicDirectory)),
53
+ lastNAMDirectory(juce::File::getSpecialLocation(juce::File::userMusicDirectory))
52
54
{
53
55
cat2color (cat, col);
54
56
col = col.withAlpha ((uint8)30 );
@@ -402,8 +404,10 @@ void PluginEditor::set_nam_load_button_text(const std::string& attr, bool set)
402
404
403
405
auto set_nam_filename = [=](juce::String s)
404
406
{ button->setButtonText (s); };
405
- set_nam_filename (juce::File (juce::String (
406
- dynamic_cast <gx_engine::StringParameter*>(p)->getString ().get_value ())).getFileNameWithoutExtension ());
407
+ juce::File namFile = juce::File (juce::String (
408
+ dynamic_cast <gx_engine::StringParameter*>(p)->getString ().get_value ()));
409
+ this ->lastNAMDirectory = namFile.getParentDirectory ();
410
+ set_nam_filename (namFile.getFileNameWithoutExtension ());
407
411
408
412
}
409
413
}
@@ -425,7 +429,7 @@ void PluginEditor::set_ir_load_button_text(const std::string& attr, bool set)
425
429
gx_engine::GxJConvSettings j = dynamic_cast <gx_engine::JConvParameter*>(p)->get_value ();
426
430
std::string fdir = j.getIRDir ();
427
431
if (is_factory_IR (fdir)) return ;
428
- if (!fdir.empty ()) lastDirectory = juce::File (fdir);
432
+ if (!fdir.empty ()) lastIRDirectory = juce::File (fdir);
429
433
std::string fname = j.getIRFile ();
430
434
if (!fname.empty ()) button->setButtonText (juce::String (fname));
431
435
juce::Component *c = findChildByID (this , parid.c_str ());
@@ -540,8 +544,8 @@ void PluginEditor::load_NAM(const std::string& attr, juce::Button* button, juce:
540
544
}
541
545
542
546
void PluginEditor::open_nam_file_browser (juce::Button* button, const std::string& id) {
543
- auto fc = new juce::FileChooser (" Choose NAM file to load..." , lastDirectory .isDirectory () ?
544
- lastDirectory : juce::File::getSpecialLocation (juce::File::userMusicDirectory), " *.nam" , false );
547
+ auto fc = new juce::FileChooser (" Choose NAM file to load..." , lastNAMDirectory .isDirectory () ?
548
+ lastNAMDirectory : juce::File::getSpecialLocation (juce::File::userMusicDirectory), " *.nam" , false );
545
549
546
550
fc->launchAsync (juce::FileBrowserComponent::openMode | juce::FileBrowserComponent::canSelectFiles,
547
551
[this , id, button, fc] (const juce::FileChooser& chooser) {
@@ -551,7 +555,7 @@ void PluginEditor::open_nam_file_browser(juce::Button* button, const std::string
551
555
: result.toString (false )) ;
552
556
553
557
if (chosen.isNotEmpty ()) {
554
- this ->lastDirectory = result.getLocalFile ().getParentDirectory ();
558
+ this ->lastNAMDirectory = result.getLocalFile ().getParentDirectory ();
555
559
this ->load_NAM (id, button, chosen);
556
560
}
557
561
button->setToggleState (false , juce::dontSendNotification);
@@ -581,8 +585,8 @@ void PluginEditor::load_IR(const std::string& attr, juce::Button* button, juce::
581
585
}
582
586
583
587
void PluginEditor::open_file_browser (juce::Button* button, const std::string& id) {
584
- auto fc = new juce::FileChooser (" Choose IR file to open..." , lastDirectory .isDirectory () ?
585
- lastDirectory : juce::File::getSpecialLocation (juce::File::userMusicDirectory), " *.wav" , false );
588
+ auto fc = new juce::FileChooser (" Choose IR file to open..." , lastIRDirectory .isDirectory () ?
589
+ lastIRDirectory : juce::File::getSpecialLocation (juce::File::userMusicDirectory), " *.wav" , false );
586
590
587
591
fc->launchAsync (juce::FileBrowserComponent::openMode | juce::FileBrowserComponent::canSelectFiles,
588
592
[this , id, button, fc] (const juce::FileChooser& chooser) {
@@ -592,7 +596,7 @@ void PluginEditor::open_file_browser(juce::Button* button, const std::string& id
592
596
: result.toString (false )) ;
593
597
594
598
if (chosen.isNotEmpty ()) {
595
- this ->lastDirectory = result.getLocalFile ().getParentDirectory ();
599
+ this ->lastIRDirectory = result.getLocalFile ().getParentDirectory ();
596
600
this ->load_IR (id, button, chosen);
597
601
}
598
602
button->setToggleState (false , juce::dontSendNotification);
0 commit comments