Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions NeuralAmpModeler/NeuralAmpModeler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,26 @@ NeuralAmpModeler::NeuralAmpModeler(const InstanceInfo& info)
pControl->SetMouseOverWhenDisabled(true);
});

pGraphics->SetKeyHandlerFunc([pGraphics](const IKeyPress& key, bool isUp) {
if (isUp)
return false;
auto* pBrowser = pGraphics->GetControlWithTag(kCtrlTagModelFileBrowser);
if (pBrowser == nullptr)
return false;
auto* pModelBrowser = static_cast<NAMFileBrowserControl*>(pBrowser);
if (key.utf8[0] == ',')
{
pModelBrowser->SelectPreviousFile();
return true;
}
if (key.utf8[0] == '.')
{
pModelBrowser->SelectNextFile();
return true;
}
return false;
});

// pGraphics->GetControlWithTag(kCtrlTagOutNorm)->SetMouseEventsWhenDisabled(false);
// pGraphics->GetControlWithTag(kCtrlTagCalibrateInput)->SetMouseEventsWhenDisabled(false);
};
Expand Down
43 changes: 24 additions & 19 deletions NeuralAmpModeler/NeuralAmpModelerControls.h
Original file line number Diff line number Diff line change
Expand Up @@ -302,31 +302,36 @@ class NAMFileBrowserControl : public IDirBrowseControlBase
}
}

void OnAttached() override
void SelectPreviousFile()
{
auto prevFileFunc = [&](IControl* pCaller) {
const auto nItems = NItems();
if (nItems == 0)
return;
mSelectedItemIndex--;
const auto nItems = NItems();
if (nItems == 0)
return;
mSelectedItemIndex--;

if (mSelectedItemIndex < 0)
mSelectedItemIndex = nItems - 1;
if (mSelectedItemIndex < 0)
mSelectedItemIndex = nItems - 1;

LoadFileAtCurrentIndex();
};
LoadFileAtCurrentIndex();
}

auto nextFileFunc = [&](IControl* pCaller) {
const auto nItems = NItems();
if (nItems == 0)
return;
mSelectedItemIndex++;
void SelectNextFile()
{
const auto nItems = NItems();
if (nItems == 0)
return;
mSelectedItemIndex++;

if (mSelectedItemIndex >= nItems)
mSelectedItemIndex = 0;
if (mSelectedItemIndex >= nItems)
mSelectedItemIndex = 0;

LoadFileAtCurrentIndex();
};
LoadFileAtCurrentIndex();
}

void OnAttached() override
{
auto prevFileFunc = [&](IControl* pCaller) { SelectPreviousFile(); };
auto nextFileFunc = [&](IControl* pCaller) { SelectNextFile(); };

auto loadFileFunc = [&](IControl* pCaller) {
WDL_String fileName;
Expand Down