| @@ -346,14 +346,14 @@ struct State { | |||||
| /** Prepares a widget for deletion */ | /** Prepares a widget for deletion */ | ||||
| void finalizeWidget(widget::Widget *w); | void finalizeWidget(widget::Widget *w); | ||||
| void handleButton(math::Vec pos, int button, int action, int mods); | |||||
| void handleHover(math::Vec pos, math::Vec mouseDelta); | |||||
| void handleLeave(); | |||||
| void handleScroll(math::Vec pos, math::Vec scrollDelta); | |||||
| void handleText(math::Vec pos, int codepoint); | |||||
| void handleKey(math::Vec pos, int key, int scancode, int action, int mods); | |||||
| void handleDrop(math::Vec pos, const std::vector<std::string> &paths); | |||||
| void handleZoom(); | |||||
| bool handleButton(math::Vec pos, int button, int action, int mods); | |||||
| bool handleHover(math::Vec pos, math::Vec mouseDelta); | |||||
| bool handleLeave(); | |||||
| bool handleScroll(math::Vec pos, math::Vec scrollDelta); | |||||
| bool handleText(math::Vec pos, int codepoint); | |||||
| bool handleKey(math::Vec pos, int key, int scancode, int action, int mods); | |||||
| bool handleDrop(math::Vec pos, const std::vector<std::string> &paths); | |||||
| bool handleZoom(); | |||||
| }; | }; | ||||
| @@ -17,7 +17,6 @@ struct MenuItem : MenuEntry { | |||||
| void draw(const DrawArgs &args) override; | void draw(const DrawArgs &args) override; | ||||
| void step() override; | void step() override; | ||||
| void onEnter(const event::Enter &e) override; | void onEnter(const event::Enter &e) override; | ||||
| void onDragStart(const event::DragStart &e) override; | |||||
| void onDragDrop(const event::DragDrop &e) override; | void onDragDrop(const event::DragDrop &e) override; | ||||
| void doAction(); | void doAction(); | ||||
| virtual Menu *createChildMenu() {return NULL;} | virtual Menu *createChildMenu() {return NULL;} | ||||
| @@ -17,7 +17,6 @@ struct RadioButton : widget::OpaqueWidget { | |||||
| void draw(const DrawArgs &args) override; | void draw(const DrawArgs &args) override; | ||||
| void onEnter(const event::Enter &e) override; | void onEnter(const event::Enter &e) override; | ||||
| void onLeave(const event::Leave &e) override; | void onLeave(const event::Leave &e) override; | ||||
| void onDragStart(const event::DragStart &e) override; | |||||
| void onDragDrop(const event::DragDrop &e) override; | void onDragDrop(const event::DragDrop &e) override; | ||||
| }; | }; | ||||
| @@ -23,9 +23,6 @@ struct TextField : widget::OpaqueWidget { | |||||
| void draw(const DrawArgs &args) override; | void draw(const DrawArgs &args) override; | ||||
| void onHover(const event::Hover &e) override; | void onHover(const event::Hover &e) override; | ||||
| void onButton(const event::Button &e) override; | void onButton(const event::Button &e) override; | ||||
| void onDragStart(const event::DragStart &e) override; | |||||
| void onEnter(const event::Enter &e) override; | |||||
| void onSelect(const event::Select &e) override; | |||||
| void onSelectText(const event::SelectText &e) override; | void onSelectText(const event::SelectText &e) override; | ||||
| void onSelectKey(const event::SelectKey &e) override; | void onSelectKey(const event::SelectKey &e) override; | ||||
| @@ -44,7 +44,6 @@ struct ModuleResizeHandle : OpaqueWidget { | |||||
| ModuleWidget *mw = getAncestorOfType<ModuleWidget>(); | ModuleWidget *mw = getAncestorOfType<ModuleWidget>(); | ||||
| assert(mw); | assert(mw); | ||||
| originalBox = mw->box; | originalBox = mw->box; | ||||
| e.consume(this); | |||||
| } | } | ||||
| void onDragMove(const event::DragMove &e) override { | void onDragMove(const event::DragMove &e) override { | ||||
| @@ -271,7 +271,6 @@ struct MIDI_MapChoice : LedDisplayChoice { | |||||
| // Reset touchedParam | // Reset touchedParam | ||||
| APP->scene->rack->touchedParam = NULL; | APP->scene->rack->touchedParam = NULL; | ||||
| module->enableLearn(id); | module->enableLearn(id); | ||||
| e.consume(this); | |||||
| } | } | ||||
| void onDeselect(const event::Deselect &e) override { | void onDeselect(const event::Deselect &e) override { | ||||
| @@ -40,7 +40,6 @@ void Knob::onDragStart(const event::DragStart &e) { | |||||
| } | } | ||||
| APP->window->cursorLock(); | APP->window->cursorLock(); | ||||
| e.consume(this); | |||||
| } | } | ||||
| void Knob::onDragEnd(const event::DragEnd &e) { | void Knob::onDragEnd(const event::DragEnd &e) { | ||||
| @@ -255,7 +255,6 @@ struct ModelBox : widget::OpaqueWidget { | |||||
| void onButton(const event::Button &e) override; | void onButton(const event::Button &e) override; | ||||
| void onEnter(const event::Enter &e) override { | void onEnter(const event::Enter &e) override { | ||||
| e.consume(this); | |||||
| infoBox->show(); | infoBox->show(); | ||||
| } | } | ||||
| @@ -305,15 +305,13 @@ void ModuleWidget::drawShadow(const DrawArgs &args) { | |||||
| } | } | ||||
| void ModuleWidget::onHover(const event::Hover &e) { | void ModuleWidget::onHover(const event::Hover &e) { | ||||
| if (!APP->event->selectedWidget) { | |||||
| // Instead of checking key-down events, delete the module even if key-repeat hasn't fired yet and the cursor is hovering over the widget. | |||||
| if ((glfwGetKey(APP->window->win, GLFW_KEY_DELETE) == GLFW_PRESS | |||||
| || glfwGetKey(APP->window->win, GLFW_KEY_BACKSPACE) == GLFW_PRESS) | |||||
| && (APP->window->getMods() & WINDOW_MOD_MASK) == 0) { | |||||
| removeAction(); | |||||
| e.consume(NULL); | |||||
| return; | |||||
| } | |||||
| // Instead of checking key-down events, delete the module even if key-repeat hasn't fired yet and the cursor is hovering over the widget. | |||||
| if ((glfwGetKey(APP->window->win, GLFW_KEY_DELETE) == GLFW_PRESS | |||||
| || glfwGetKey(APP->window->win, GLFW_KEY_BACKSPACE) == GLFW_PRESS) | |||||
| && (APP->window->getMods() & WINDOW_MOD_MASK) == 0) { | |||||
| removeAction(); | |||||
| e.consume(NULL); | |||||
| return; | |||||
| } | } | ||||
| OpaqueWidget::onHover(e); | OpaqueWidget::onHover(e); | ||||
| @@ -326,7 +324,7 @@ void ModuleWidget::onButton(const event::Button &e) { | |||||
| if (e.action == GLFW_PRESS && e.button == GLFW_MOUSE_BUTTON_RIGHT) { | if (e.action == GLFW_PRESS && e.button == GLFW_MOUSE_BUTTON_RIGHT) { | ||||
| createContextMenu(); | createContextMenu(); | ||||
| e.consume(this); | |||||
| e.consume(NULL); | |||||
| } | } | ||||
| } | } | ||||
| @@ -389,7 +387,6 @@ void ModuleWidget::onDragStart(const event::DragStart &e) { | |||||
| oldPos = box.pos; | oldPos = box.pos; | ||||
| dragPos = APP->scene->rack->mousePos.minus(box.pos); | dragPos = APP->scene->rack->mousePos.minus(box.pos); | ||||
| e.consume(this); | |||||
| } | } | ||||
| void ModuleWidget::onDragEnd(const event::DragEnd &e) { | void ModuleWidget::onDragEnd(const event::DragEnd &e) { | ||||
| @@ -167,7 +167,6 @@ void ParamWidget::onEnter(const event::Enter &e) { | |||||
| paramTooltip->paramWidget = this; | paramTooltip->paramWidget = this; | ||||
| APP->scene->addChild(paramTooltip); | APP->scene->addChild(paramTooltip); | ||||
| tooltip = paramTooltip; | tooltip = paramTooltip; | ||||
| e.consume(this); | |||||
| } | } | ||||
| } | } | ||||
| @@ -74,13 +74,12 @@ void PortWidget::onButton(const event::Button &e) { | |||||
| delete cw; | delete cw; | ||||
| } | } | ||||
| e.consume(this); | |||||
| e.consume(NULL); | |||||
| } | } | ||||
| } | } | ||||
| void PortWidget::onEnter(const event::Enter &e) { | void PortWidget::onEnter(const event::Enter &e) { | ||||
| hovered = true; | hovered = true; | ||||
| e.consume(this); | |||||
| } | } | ||||
| void PortWidget::onLeave(const event::Leave &e) { | void PortWidget::onLeave(const event::Leave &e) { | ||||
| @@ -133,7 +132,6 @@ void PortWidget::onDragStart(const event::DragStart &e) { | |||||
| } | } | ||||
| APP->scene->rack->setIncompleteCable(cw); | APP->scene->rack->setIncompleteCable(cw); | ||||
| e.consume(this); | |||||
| } | } | ||||
| void PortWidget::onDragEnd(const event::DragEnd &e) { | void PortWidget::onDragEnd(const event::DragEnd &e) { | ||||
| @@ -182,7 +180,6 @@ void PortWidget::onDragEnter(const event::DragEnter &e) { | |||||
| else | else | ||||
| cw->hoveredInputPort = this; | cw->hoveredInputPort = this; | ||||
| } | } | ||||
| e.consume(this); | |||||
| } | } | ||||
| void PortWidget::onDragLeave(const event::DragLeave &e) { | void PortWidget::onDragLeave(const event::DragLeave &e) { | ||||
| @@ -75,25 +75,23 @@ void RackScrollWidget::draw(const DrawArgs &args) { | |||||
| } | } | ||||
| void RackScrollWidget::onHover(const event::Hover &e) { | void RackScrollWidget::onHover(const event::Hover &e) { | ||||
| 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; | |||||
| if (glfwGetKey(APP->window->win, GLFW_KEY_LEFT) == GLFW_PRESS) | |||||
| offset.x -= arrowSpeed; | |||||
| if (glfwGetKey(APP->window->win, GLFW_KEY_RIGHT) == GLFW_PRESS) | |||||
| offset.x += arrowSpeed; | |||||
| if (glfwGetKey(APP->window->win, GLFW_KEY_UP) == GLFW_PRESS) | |||||
| offset.y -= arrowSpeed; | |||||
| if (glfwGetKey(APP->window->win, GLFW_KEY_DOWN) == GLFW_PRESS) | |||||
| offset.y += arrowSpeed; | |||||
| } | |||||
| // 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; | |||||
| if (glfwGetKey(APP->window->win, GLFW_KEY_LEFT) == GLFW_PRESS) | |||||
| offset.x -= arrowSpeed; | |||||
| if (glfwGetKey(APP->window->win, GLFW_KEY_RIGHT) == GLFW_PRESS) | |||||
| offset.x += arrowSpeed; | |||||
| if (glfwGetKey(APP->window->win, GLFW_KEY_UP) == GLFW_PRESS) | |||||
| offset.y -= arrowSpeed; | |||||
| if (glfwGetKey(APP->window->win, GLFW_KEY_DOWN) == GLFW_PRESS) | |||||
| offset.y += arrowSpeed; | |||||
| ScrollWidget::onHover(e); | ScrollWidget::onHover(e); | ||||
| } | } | ||||
| @@ -133,8 +133,8 @@ void RackWidget::onHoverKey(const event::HoverKey &e) { | |||||
| case GLFW_KEY_V: { | case GLFW_KEY_V: { | ||||
| if ((e.mods & WINDOW_MOD_MASK) == WINDOW_MOD_CTRL) { | if ((e.mods & WINDOW_MOD_MASK) == WINDOW_MOD_CTRL) { | ||||
| pastePresetClipboardAction(); | pastePresetClipboardAction(); | ||||
| e.consume(this); | |||||
| } | } | ||||
| e.consume(this); | |||||
| } break; | } break; | ||||
| } | } | ||||
| } | } | ||||
| @@ -127,6 +127,7 @@ void Scene::onHoverKey(const event::HoverKey &e) { | |||||
| z = std::ceil(z - 0.01) - 1; | z = std::ceil(z - 0.01) - 1; | ||||
| z /= 2; | z /= 2; | ||||
| settings::zoom = std::pow(2, z); | settings::zoom = std::pow(2, z); | ||||
| e.consume(this); | |||||
| } | } | ||||
| } break; | } break; | ||||
| case GLFW_KEY_EQUAL: { | case GLFW_KEY_EQUAL: { | ||||
| @@ -136,6 +137,7 @@ void Scene::onHoverKey(const event::HoverKey &e) { | |||||
| z = std::floor(z + 0.01) + 1; | z = std::floor(z + 0.01) + 1; | ||||
| z /= 2; | z /= 2; | ||||
| settings::zoom = std::pow(2, z); | settings::zoom = std::pow(2, z); | ||||
| e.consume(this); | |||||
| } | } | ||||
| } break; | } break; | ||||
| case GLFW_KEY_ENTER: | case GLFW_KEY_ENTER: | ||||
| @@ -38,7 +38,6 @@ void SvgButton::onDragStart(const event::DragStart &e) { | |||||
| sw->setSvg(frames[1]); | sw->setSvg(frames[1]); | ||||
| fb->dirty = true; | fb->dirty = true; | ||||
| } | } | ||||
| e.consume(this); | |||||
| } | } | ||||
| void SvgButton::onDragEnd(const event::DragEnd &e) { | void SvgButton::onDragEnd(const event::DragEnd &e) { | ||||
| @@ -64,7 +64,6 @@ void Switch::onDragStart(const event::DragStart &e) { | |||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| e.consume(this); | |||||
| } | } | ||||
| void Switch::onDragEnd(const event::DragEnd &e) { | void Switch::onDragEnd(const event::DragEnd &e) { | ||||
| @@ -110,7 +110,7 @@ void State::finalizeWidget(widget::Widget *w) { | |||||
| if (lastClickedWidget == w) lastClickedWidget = NULL; | if (lastClickedWidget == w) lastClickedWidget = NULL; | ||||
| } | } | ||||
| void State::handleButton(math::Vec pos, int button, int action, int mods) { | |||||
| bool State::handleButton(math::Vec pos, int button, int action, int mods) { | |||||
| // Button | // Button | ||||
| Context cButton; | Context cButton; | ||||
| Button eButton; | Button eButton; | ||||
| @@ -164,9 +164,11 @@ void State::handleButton(math::Vec pos, int button, int action, int mods) { | |||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| return !!clickedWidget; | |||||
| } | } | ||||
| void State::handleHover(math::Vec pos, math::Vec mouseDelta) { | |||||
| bool State::handleHover(math::Vec pos, math::Vec mouseDelta) { | |||||
| if (draggedWidget) { | if (draggedWidget) { | ||||
| // DragMove | // DragMove | ||||
| DragMove eDragMove; | DragMove eDragMove; | ||||
| @@ -185,8 +187,8 @@ void State::handleHover(math::Vec pos, math::Vec mouseDelta) { | |||||
| rootWidget->onDragHover(eDragHover); | rootWidget->onDragHover(eDragHover); | ||||
| setDragHovered(cDragHover.target); | setDragHovered(cDragHover.target); | ||||
| return; | |||||
| if (cDragHover.target) | |||||
| return true; | |||||
| } | } | ||||
| // Hover | // Hover | ||||
| @@ -198,14 +200,16 @@ void State::handleHover(math::Vec pos, math::Vec mouseDelta) { | |||||
| rootWidget->onHover(eHover); | rootWidget->onHover(eHover); | ||||
| setHovered(cHover.target); | setHovered(cHover.target); | ||||
| return !!cHover.target; | |||||
| } | } | ||||
| void State::handleLeave() { | |||||
| bool State::handleLeave() { | |||||
| setDragHovered(NULL); | setDragHovered(NULL); | ||||
| setHovered(NULL); | setHovered(NULL); | ||||
| return true; | |||||
| } | } | ||||
| void State::handleScroll(math::Vec pos, math::Vec scrollDelta) { | |||||
| bool State::handleScroll(math::Vec pos, math::Vec scrollDelta) { | |||||
| // HoverScroll | // HoverScroll | ||||
| Context cHoverScroll; | Context cHoverScroll; | ||||
| HoverScroll eHoverScroll; | HoverScroll eHoverScroll; | ||||
| @@ -213,18 +217,22 @@ void State::handleScroll(math::Vec pos, math::Vec scrollDelta) { | |||||
| eHoverScroll.pos = pos; | eHoverScroll.pos = pos; | ||||
| eHoverScroll.scrollDelta = scrollDelta; | eHoverScroll.scrollDelta = scrollDelta; | ||||
| rootWidget->onHoverScroll(eHoverScroll); | rootWidget->onHoverScroll(eHoverScroll); | ||||
| return !!cHoverScroll.target; | |||||
| } | } | ||||
| void State::handleDrop(math::Vec pos, const std::vector<std::string> &paths) { | |||||
| bool State::handleDrop(math::Vec pos, const std::vector<std::string> &paths) { | |||||
| // PathDrop | // PathDrop | ||||
| Context cPathDrop; | Context cPathDrop; | ||||
| PathDrop ePathDrop(paths); | PathDrop ePathDrop(paths); | ||||
| ePathDrop.context = &cPathDrop; | ePathDrop.context = &cPathDrop; | ||||
| ePathDrop.pos = pos; | ePathDrop.pos = pos; | ||||
| rootWidget->onPathDrop(ePathDrop); | rootWidget->onPathDrop(ePathDrop); | ||||
| return !!cPathDrop.target; | |||||
| } | } | ||||
| void State::handleText(math::Vec pos, int codepoint) { | |||||
| bool State::handleText(math::Vec pos, int codepoint) { | |||||
| if (selectedWidget) { | if (selectedWidget) { | ||||
| // SelectText | // SelectText | ||||
| Context cSelectText; | Context cSelectText; | ||||
| @@ -233,7 +241,7 @@ void State::handleText(math::Vec pos, int codepoint) { | |||||
| eSelectText.codepoint = codepoint; | eSelectText.codepoint = codepoint; | ||||
| selectedWidget->onSelectText(eSelectText); | selectedWidget->onSelectText(eSelectText); | ||||
| if (cSelectText.target) | if (cSelectText.target) | ||||
| return; | |||||
| return true; | |||||
| } | } | ||||
| // HoverText | // HoverText | ||||
| @@ -243,9 +251,11 @@ void State::handleText(math::Vec pos, int codepoint) { | |||||
| eHoverText.pos = pos; | eHoverText.pos = pos; | ||||
| eHoverText.codepoint = codepoint; | eHoverText.codepoint = codepoint; | ||||
| rootWidget->onHoverText(eHoverText); | rootWidget->onHoverText(eHoverText); | ||||
| return !!cHoverText.target; | |||||
| } | } | ||||
| void State::handleKey(math::Vec pos, int key, int scancode, int action, int mods) { | |||||
| bool State::handleKey(math::Vec pos, int key, int scancode, int action, int mods) { | |||||
| if (selectedWidget) { | if (selectedWidget) { | ||||
| // SelectKey | // SelectKey | ||||
| Context cSelectKey; | Context cSelectKey; | ||||
| @@ -257,7 +267,7 @@ void State::handleKey(math::Vec pos, int key, int scancode, int action, int mods | |||||
| eSelectKey.mods = mods; | eSelectKey.mods = mods; | ||||
| selectedWidget->onSelectKey(eSelectKey); | selectedWidget->onSelectKey(eSelectKey); | ||||
| if (cSelectKey.target) | if (cSelectKey.target) | ||||
| return; | |||||
| return true; | |||||
| } | } | ||||
| // HoverKey | // HoverKey | ||||
| @@ -270,14 +280,16 @@ void State::handleKey(math::Vec pos, int key, int scancode, int action, int mods | |||||
| eHoverKey.action = action; | eHoverKey.action = action; | ||||
| eHoverKey.mods = mods; | eHoverKey.mods = mods; | ||||
| rootWidget->onHoverKey(eHoverKey); | rootWidget->onHoverKey(eHoverKey); | ||||
| return !!cHoverKey.target; | |||||
| } | } | ||||
| void State::handleZoom() { | |||||
| bool State::handleZoom() { | |||||
| // Zoom | // Zoom | ||||
| Context cZoom; | Context cZoom; | ||||
| Zoom eZoom; | Zoom eZoom; | ||||
| eZoom.context = &cZoom; | eZoom.context = &cZoom; | ||||
| rootWidget->onZoom(eZoom); | rootWidget->onZoom(eZoom); | ||||
| return true; | |||||
| } | } | ||||
| @@ -15,7 +15,6 @@ void Button::draw(const DrawArgs &args) { | |||||
| void Button::onEnter(const event::Enter &e) { | void Button::onEnter(const event::Enter &e) { | ||||
| state = BND_HOVER; | state = BND_HOVER; | ||||
| e.consume(this); | |||||
| } | } | ||||
| void Button::onLeave(const event::Leave &e) { | void Button::onLeave(const event::Leave &e) { | ||||
| @@ -29,7 +28,6 @@ void Button::onDragStart(const event::DragStart &e) { | |||||
| state = BND_ACTIVE; | state = BND_ACTIVE; | ||||
| if (quantity) | if (quantity) | ||||
| quantity->setMax(); | quantity->setMax(); | ||||
| e.consume(this); | |||||
| } | } | ||||
| void Button::onDragEnd(const event::DragEnd &e) { | void Button::onDragEnd(const event::DragEnd &e) { | ||||
| @@ -42,7 +42,6 @@ void MenuItem::step() { | |||||
| } | } | ||||
| void MenuItem::onEnter(const event::Enter &e) { | void MenuItem::onEnter(const event::Enter &e) { | ||||
| e.consume(this); | |||||
| Menu *parentMenu = dynamic_cast<Menu*>(parent); | Menu *parentMenu = dynamic_cast<Menu*>(parent); | ||||
| if (!parentMenu) | if (!parentMenu) | ||||
| return; | return; | ||||
| @@ -58,13 +57,6 @@ void MenuItem::onEnter(const event::Enter &e) { | |||||
| parentMenu->setChildMenu(childMenu); | parentMenu->setChildMenu(childMenu); | ||||
| } | } | ||||
| void MenuItem::onDragStart(const event::DragStart &e) { | |||||
| if (e.button != GLFW_MOUSE_BUTTON_LEFT) | |||||
| return; | |||||
| e.consume(this); | |||||
| } | |||||
| void MenuItem::onDragDrop(const event::DragDrop &e) { | void MenuItem::onDragDrop(const event::DragDrop &e) { | ||||
| if (e.origin != this) | if (e.origin != this) | ||||
| return; | return; | ||||
| @@ -22,20 +22,12 @@ void RadioButton::draw(const DrawArgs &args) { | |||||
| void RadioButton::onEnter(const event::Enter &e) { | void RadioButton::onEnter(const event::Enter &e) { | ||||
| state = BND_HOVER; | state = BND_HOVER; | ||||
| e.consume(this); | |||||
| } | } | ||||
| void RadioButton::onLeave(const event::Leave &e) { | void RadioButton::onLeave(const event::Leave &e) { | ||||
| state = BND_DEFAULT; | state = BND_DEFAULT; | ||||
| } | } | ||||
| void RadioButton::onDragStart(const event::DragStart &e) { | |||||
| if (e.button != GLFW_MOUSE_BUTTON_LEFT) | |||||
| return; | |||||
| e.consume(this); | |||||
| } | |||||
| void RadioButton::onDragDrop(const event::DragDrop &e) { | void RadioButton::onDragDrop(const event::DragDrop &e) { | ||||
| if (e.origin == this) { | if (e.origin == this) { | ||||
| if (quantity) { | if (quantity) { | ||||
| @@ -22,7 +22,6 @@ void ScrollBar::onDragStart(const event::DragStart &e) { | |||||
| state = BND_ACTIVE; | state = BND_ACTIVE; | ||||
| APP->window->cursorLock(); | APP->window->cursorLock(); | ||||
| e.consume(this); | |||||
| } | } | ||||
| void ScrollBar::onDragMove(const event::DragMove &e) { | void ScrollBar::onDragMove(const event::DragMove &e) { | ||||
| @@ -24,7 +24,6 @@ void Slider::onDragStart(const event::DragStart &e) { | |||||
| state = BND_ACTIVE; | state = BND_ACTIVE; | ||||
| APP->window->cursorLock(); | APP->window->cursorLock(); | ||||
| e.consume(this); | |||||
| } | } | ||||
| void Slider::onDragMove(const event::DragMove &e) { | void Slider::onDragMove(const event::DragMove &e) { | ||||
| @@ -34,7 +34,6 @@ void TextField::onHover(const event::Hover &e) { | |||||
| OpaqueWidget::onHover(e); | OpaqueWidget::onHover(e); | ||||
| if (this == APP->event->draggedWidget) { | if (this == APP->event->draggedWidget) { | ||||
| DEBUG("asdf"); | |||||
| int pos = getTextPosition(e.pos); | int pos = getTextPosition(e.pos); | ||||
| if (pos != selection) { | if (pos != selection) { | ||||
| cursor = pos; | cursor = pos; | ||||
| @@ -50,19 +49,6 @@ void TextField::onButton(const event::Button &e) { | |||||
| } | } | ||||
| } | } | ||||
| void TextField::onDragStart(const event::DragStart &e) { | |||||
| // Enable dragging so onHover can set the cursor position. | |||||
| e.consume(this); | |||||
| } | |||||
| void TextField::onEnter(const event::Enter &e) { | |||||
| e.consume(this); | |||||
| } | |||||
| void TextField::onSelect(const event::Select &e) { | |||||
| e.consume(this); | |||||
| } | |||||
| void TextField::onSelectText(const event::SelectText &e) { | void TextField::onSelectText(const event::SelectText &e) { | ||||
| if (e.codepoint < 128) { | if (e.codepoint < 128) { | ||||
| std::string newText(1, (char) e.codepoint); | std::string newText(1, (char) e.codepoint); | ||||
| @@ -155,10 +155,11 @@ static void charCallback(GLFWwindow *win, unsigned int codepoint) { | |||||
| static void keyCallback(GLFWwindow *win, int key, int scancode, int action, int mods) { | static void keyCallback(GLFWwindow *win, int key, int scancode, int action, int mods) { | ||||
| Window *window = (Window*) glfwGetWindowUserPointer(win); | Window *window = (Window*) glfwGetWindowUserPointer(win); | ||||
| APP->event->handleKey(window->mousePos, key, scancode, action, mods); | |||||
| if (APP->event->handleKey(window->mousePos, key, scancode, action, mods)) | |||||
| return; | |||||
| // Keyboard MIDI driver | // Keyboard MIDI driver | ||||
| if (!APP->event->selectedWidget && (mods & WINDOW_MOD_MASK) == 0) { | |||||
| if ((mods & WINDOW_MOD_MASK) == 0) { | |||||
| if (action == GLFW_PRESS) { | if (action == GLFW_PRESS) { | ||||
| keyboard::press(key); | keyboard::press(key); | ||||
| } | } | ||||