Skip to content

Commit

Permalink
mod matrix: update display to changed values
Browse files Browse the repository at this point in the history
Also adjust the position if it became invalid after deleting the last
patch cable in the list.

fixes #428
  • Loading branch information
bfredl committed Oct 23, 2023
1 parent 1743f26 commit 1b416b0
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions src/deluge/gui/menu_item/patch_cables.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,22 +18,26 @@ void PatchCables::beginSession(MenuItem* navigatedBackwardFrom) {
currentValue = 0;

if (navigatedBackwardFrom != nullptr) {
PatchCableSet* set = soundEditor.currentParamManager->getPatchCableSet();
currentValue = savedVal;
if (savedVal >= set->numPatchCables) {
currentValue = 0;
}
}

if (display->haveOLED()) {
scrollPos = std::max((int32_t)0, currentValue - 1);
}

renderOptions();
readValueAgain();
}

void PatchCables::readValueAgain() {
PatchCableSet* set = soundEditor.currentParamManager->getPatchCableSet();
if (currentValue >= set->numPatchCables) {
// The last patch cable was deleted and it was selected, need to adjust
currentValue = std::max(0, set->numPatchCables - 1);
scrollPos = std::max((int32_t)0, currentValue - 1);
}

renderOptions();

if (display->haveOLED()) {
renderUIsForOled();
}
Expand Down

0 comments on commit 1b416b0

Please sign in to comment.