diff --git a/include/rack.hpp b/include/rack.hpp index b5233346..3d9a0ab7 100644 --- a/include/rack.hpp +++ b/include/rack.hpp @@ -72,7 +72,6 @@ #include "engine/Module.hpp" #include "engine/Param.hpp" #include "engine/Cable.hpp" -#include "engine/ParamMap.hpp" #include "plugin/Plugin.hpp" #include "plugin/Model.hpp" diff --git a/src/Core/MIDI_Map.cpp b/src/Core/MIDI_Map.cpp index 1dea6cba..6eaa5fcd 100644 --- a/src/Core/MIDI_Map.cpp +++ b/src/Core/MIDI_Map.cpp @@ -105,6 +105,12 @@ struct MIDI_MapChoice : LedDisplayChoice { this->module = module; } + void onAction(const event::Action &e) override { + if (!module) + return; + module->lastLearnedCc = -1; + } + void onSelect(const event::Select &e) override { if (!module) return; @@ -133,15 +139,17 @@ struct MIDI_MapChoice : LedDisplayChoice { if (APP->event->selectedWidget != this) APP->event->setSelected(this); } - else if (module->learnedCcs[id] >= 0) { - text = string::f("CC%d", module->learnedCcs[id]); - color.a = 1.0; - bgColor = nvgRGBA(0, 0, 0, 0); - } else { - text = "Unmapped"; - color.a = 0.5; - bgColor = nvgRGBA(0, 0, 0, 0); + if (module->learnedCcs[id] >= 0) { + text = string::f("CC%d", module->learnedCcs[id]); + color.a = 1.0; + bgColor = nvgRGBA(0, 0, 0, 0); + } + else { + text = "Unmapped"; + color.a = 0.5; + bgColor = nvgRGBA(0, 0, 0, 0); + } // HACK if (APP->event->selectedWidget == this) diff --git a/src/app/RackWidget.cpp b/src/app/RackWidget.cpp index d2890d94..23e812cd 100644 --- a/src/app/RackWidget.cpp +++ b/src/app/RackWidget.cpp @@ -122,27 +122,29 @@ void RackWidget::draw(const widget::DrawContext &ctx) { } void RackWidget::onHover(const event::Hover &e) { - // Scroll with arrow keys - float arrowSpeed = 30.0; - if ((APP->window->getMods() & WINDOW_MOD_MASK) == (WINDOW_MOD_CTRL |GLFW_MOD_SHIFT)) - arrowSpeed /= 16.0; - else if ((APP->window->getMods() & WINDOW_MOD_MASK) == WINDOW_MOD_CTRL) - arrowSpeed *= 4.0; - else if ((APP->window->getMods() & WINDOW_MOD_MASK) == GLFW_MOD_SHIFT) - arrowSpeed /= 4.0; - - ui::ScrollWidget *scrollWidget = APP->scene->scrollWidget; - if (glfwGetKey(APP->window->win, GLFW_KEY_LEFT) == GLFW_PRESS) { - scrollWidget->offset.x -= arrowSpeed; - } - if (glfwGetKey(APP->window->win, GLFW_KEY_RIGHT) == GLFW_PRESS) { - scrollWidget->offset.x += arrowSpeed; - } - if (glfwGetKey(APP->window->win, GLFW_KEY_UP) == GLFW_PRESS) { - scrollWidget->offset.y -= arrowSpeed; - } - if (glfwGetKey(APP->window->win, GLFW_KEY_DOWN) == GLFW_PRESS) { - scrollWidget->offset.y += arrowSpeed; + if (!APP->event->selectedWidget) { + // Scroll with arrow keys + float arrowSpeed = 30.0; + if ((APP->window->getMods() & WINDOW_MOD_MASK) == (WINDOW_MOD_CTRL |GLFW_MOD_SHIFT)) + arrowSpeed /= 16.0; + else if ((APP->window->getMods() & WINDOW_MOD_MASK) == WINDOW_MOD_CTRL) + arrowSpeed *= 4.0; + else if ((APP->window->getMods() & WINDOW_MOD_MASK) == GLFW_MOD_SHIFT) + arrowSpeed /= 4.0; + + ui::ScrollWidget *scrollWidget = APP->scene->scrollWidget; + if (glfwGetKey(APP->window->win, GLFW_KEY_LEFT) == GLFW_PRESS) { + scrollWidget->offset.x -= arrowSpeed; + } + if (glfwGetKey(APP->window->win, GLFW_KEY_RIGHT) == GLFW_PRESS) { + scrollWidget->offset.x += arrowSpeed; + } + if (glfwGetKey(APP->window->win, GLFW_KEY_UP) == GLFW_PRESS) { + scrollWidget->offset.y -= arrowSpeed; + } + if (glfwGetKey(APP->window->win, GLFW_KEY_DOWN) == GLFW_PRESS) { + scrollWidget->offset.y += arrowSpeed; + } } widget::OpaqueWidget::onHover(e);