commit 4a028ef056e2b93496bad6b42fd8f43cc0ebcff0
parent 7a9f29e947f62ab17b395e9891b5538927f56173
Author: Steven Atkinson <steven@atkinson.mn>
Date: Sat, 10 Jun 2023 17:54:27 -0700
Select file (model, IR) directory instead of a single file (#286)
* Select file directory instead of file
* Change select text
Diffstat:
2 files changed, 11 insertions(+), 6 deletions(-)
diff --git a/NeuralAmpModeler/NeuralAmpModeler.cpp b/NeuralAmpModeler/NeuralAmpModeler.cpp
@@ -224,11 +224,11 @@ NeuralAmpModeler::NeuralAmpModeler(const InstanceInfo& info)
};
pGraphics->AttachControl(
- new NAMFileBrowserControl(modelArea, kMsgTagClearModel, "Select model...", "nam", loadModelCompletionHandler,
+ new NAMFileBrowserControl(modelArea, kMsgTagClearModel, "Select model directory...", "nam", loadModelCompletionHandler,
style, fileSVG, closeButtonSVG, leftArrowSVG, rightArrowSVG),
kCtrlTagModelFileBrowser);
pGraphics->AttachControl(
- new NAMFileBrowserControl(irArea, kMsgTagClearIR, "Select IR...", "wav", loadIRCompletionHandler, style, fileSVG,
+ new NAMFileBrowserControl(irArea, kMsgTagClearIR, "Select IR directory...", "wav", loadIRCompletionHandler, style, fileSVG,
closeButtonSVG, leftArrowSVG, rightArrowSVG),
kCtrlTagIRFileBrowser);
diff --git a/NeuralAmpModeler/NeuralAmpModelerControls.h b/NeuralAmpModeler/NeuralAmpModelerControls.h
@@ -203,14 +203,14 @@ public:
WDL_String fileName;
WDL_String path;
GetSelectedFileDirectory(path);
- pCaller->GetUI()->PromptForFile(
- fileName, path, EFileAction::Open, mExtension.Get(), [&](const WDL_String& fileName, const WDL_String& path) {
- if (fileName.GetLength())
+ pCaller->GetUI()->PromptForDirectory(
+ path, [&](const WDL_String& fileName, const WDL_String& path) {
+ if (path.GetLength())
{
ClearPathList();
AddPath(path.Get(), "");
SetupMenu();
- SetSelectedFile(fileName.Get());
+ SelectFirstFile();
LoadFileAtCurrentIndex();
}
});
@@ -297,6 +297,11 @@ public:
}
private:
+ void SelectFirstFile()
+ {
+ mSelectedIndex = mFiles.GetSize() ? 0 : -1;
+ }
+
void GetSelectedFileDirectory(WDL_String& path) {
GetSelectedFile(path);
path.remove_filepart();