From 92d911d9ed3396bc9bfb08af2840b75dfe944c91 Mon Sep 17 00:00:00 2001 From: jens Date: Fri, 28 Apr 2023 15:38:29 +0200 Subject: [PATCH] Remember directory --- Source/JaySynthAudioProcessorEditor.cpp | 16 +++++++++++----- Source/JaySynthAudioProcessorEditor.h | 1 + 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/Source/JaySynthAudioProcessorEditor.cpp b/Source/JaySynthAudioProcessorEditor.cpp index 074ca4a..c578893 100644 --- a/Source/JaySynthAudioProcessorEditor.cpp +++ b/Source/JaySynthAudioProcessorEditor.cpp @@ -32,6 +32,8 @@ using namespace juce; JaySynthAudioProcessorEditor::JaySynthAudioProcessorEditor (JaySynthAudioProcessor* ownerFilter, bool has_wt) : AudioProcessorEditor (ownerFilter) { + m_fileChooserDirectory = File::getSpecialLocation (File::currentExecutableFile).getParentDirectory(); + addAndMakeVisible (m_label_colon = new Label ("Colon", TRANS(":"))); m_label_colon->setFont (Font ("Times New Roman", 20.00f, Font::plain)); @@ -4932,42 +4934,46 @@ void JaySynthAudioProcessorEditor::buttonClicked (Button* buttonThatWasClicked) if (buttonThatWasClicked == m_button_bank_load) { String filePatterns("*.fxb;*.xml"); - FileChooser fc("Load bank", File::nonexistent, filePatterns, false); + FileChooser fc("Load bank", m_fileChooserDirectory, filePatterns, false); if (fc.browseForFileToOpen()) { File const &file = fc.getResult(); getProcessor()->loadBank(file); + m_fileChooserDirectory = file; } } else if (buttonThatWasClicked == m_button_bank_save) { String filePatterns("*.fxb;*.xml"); - FileChooser fc("Save bank", File::nonexistent, filePatterns, false); + FileChooser fc("Save bank", m_fileChooserDirectory, filePatterns, false); if (fc.browseForFileToSave(true)) { File const &file = fc.getResult(); getProcessor()->saveBank(file); + m_fileChooserDirectory = file; } } else if (buttonThatWasClicked == m_button_patch_load) { String filePatterns("*.fxp;*.xml"); - FileChooser fc("Load patch", File::nonexistent, filePatterns, false); + FileChooser fc("Load patch", m_fileChooserDirectory, filePatterns, false); if (fc.browseForFileToOpen()) { File const &file = fc.getResult(); getProcessor()->loadPatch(file, 0); + m_fileChooserDirectory = file; } } else if (buttonThatWasClicked == m_button_patch_save) { String filePatterns("*.fxp;*.xml"); - FileChooser fc("Save patch", File::nonexistent, filePatterns, false); + FileChooser fc("Save patch", m_fileChooserDirectory, filePatterns, false); if (fc.browseForFileToSave(true)) { File const &file = fc.getResult(); getProcessor()->savePatch(file, 0); - } + m_fileChooserDirectory = file; + } } else if (buttonThatWasClicked == m_button_patch_incr) { diff --git a/Source/JaySynthAudioProcessorEditor.h b/Source/JaySynthAudioProcessorEditor.h index a3cc263..cd41518 100644 --- a/Source/JaySynthAudioProcessorEditor.h +++ b/Source/JaySynthAudioProcessorEditor.h @@ -102,6 +102,7 @@ private: String m_mod_src_op_names[VOICE_NUM_MOD_OPS]; String m_mod_src0_cb_names[VOICE_NUM_MOD_SOURCES_0]; String m_mod_src1_cb_names[(VOICE_NUM_MOD_SOURCES_1-1)*VOICE_NUM_MOD_OPS + 1]; + File m_fileChooserDirectory; //[/UserVariables] //==============================================================================