From 5484126aaaf6dda6812b7f3488ea2d9f26ceb467 Mon Sep 17 00:00:00 2001 From: Andrew Belt Date: Sun, 7 Feb 2021 14:03:10 -0500 Subject: [PATCH] Change `event::Foo` to `FooEvent`. --- include/app/AudioWidget.hpp | 2 +- include/app/Knob.hpp | 14 ++--- include/app/LedDisplay.hpp | 2 +- include/app/MidiWidget.hpp | 2 +- include/app/ModuleLightWidget.hpp | 6 +-- include/app/ModuleWidget.hpp | 10 ++-- include/app/ParamWidget.hpp | 8 +-- include/app/PortWidget.hpp | 16 +++--- include/app/RackScrollWidget.hpp | 6 +-- include/app/RackWidget.hpp | 8 +-- include/app/Scene.hpp | 8 +-- include/app/SliderKnob.hpp | 4 +- include/app/SvgButton.hpp | 6 +-- include/app/SvgKnob.hpp | 2 +- include/app/SvgSlider.hpp | 2 +- include/app/SvgSwitch.hpp | 2 +- include/app/Switch.hpp | 6 +-- include/ui/Button.hpp | 6 +-- include/ui/Menu.hpp | 2 +- include/ui/MenuItem.hpp | 6 +-- include/ui/MenuOverlay.hpp | 6 +-- include/ui/OptionButton.hpp | 2 +- include/ui/RadioButton.hpp | 2 +- include/ui/ScrollWidget.hpp | 10 ++-- include/ui/Scrollbar.hpp | 8 +-- include/ui/Slider.hpp | 8 +-- include/ui/TextField.hpp | 8 +-- include/widget/FramebufferWidget.hpp | 2 +- include/widget/OpaqueWidget.hpp | 14 ++--- include/widget/TransparentWidget.hpp | 14 ++--- include/widget/Widget.hpp | 2 +- include/widget/ZoomWidget.hpp | 28 +++++----- src/app/AudioWidget.cpp | 20 +++---- src/app/Knob.cpp | 14 ++--- src/app/LedDisplay.cpp | 4 +- src/app/MenuBar.cpp | 78 ++++++++++++++-------------- src/app/MidiWidget.cpp | 14 ++--- src/app/ModuleBrowser.cpp | 62 +++++++++++----------- src/app/ModuleLightWidget.cpp | 6 +-- src/app/ModuleWidget.cpp | 40 +++++++------- src/app/ParamWidget.cpp | 18 +++---- src/app/PortWidget.cpp | 16 +++--- src/app/RackScrollWidget.cpp | 6 +-- src/app/RackWidget.cpp | 8 +-- src/app/Scene.cpp | 8 +-- src/app/SliderKnob.cpp | 4 +- src/app/SvgButton.cpp | 8 +-- src/app/SvgKnob.cpp | 2 +- src/app/SvgSlider.cpp | 2 +- src/app/SvgSwitch.cpp | 2 +- src/app/Switch.cpp | 6 +-- src/app/TipWindow.cpp | 8 +-- src/core/AudioInterface.cpp | 4 +- src/core/Blank.cpp | 4 +- src/core/CV_Gate.cpp | 4 +- src/core/CV_MIDI.cpp | 2 +- src/core/MIDI_CC.cpp | 6 +-- src/core/MIDI_CV.cpp | 10 ++-- src/core/MIDI_Gate.cpp | 6 +-- src/core/MIDI_Map.cpp | 8 +-- src/core/Notes.cpp | 2 +- src/core/plugin.hpp | 20 +++---- src/ui/Button.cpp | 8 +-- src/ui/Menu.cpp | 2 +- src/ui/MenuItem.cpp | 8 +-- src/ui/MenuOverlay.cpp | 10 ++-- src/ui/OptionButton.cpp | 4 +- src/ui/RadioButton.cpp | 4 +- src/ui/ScrollWidget.cpp | 10 ++-- src/ui/Scrollbar.cpp | 8 +-- src/ui/Slider.cpp | 8 +-- src/ui/TextField.cpp | 24 ++++----- src/widget/FramebufferWidget.cpp | 2 +- src/widget/Widget.cpp | 18 +++---- src/widget/ZoomWidget.cpp | 2 +- 75 files changed, 361 insertions(+), 361 deletions(-) diff --git a/include/app/AudioWidget.hpp b/include/app/AudioWidget.hpp index abbc6758..6bb2fdf4 100644 --- a/include/app/AudioWidget.hpp +++ b/include/app/AudioWidget.hpp @@ -34,7 +34,7 @@ struct AudioDeviceWidget : LedDisplay { struct AudioButton : SvgButton { audio::Port* port; void setAudioPort(audio::Port* port); - void onAction(const event::Action& e) override; + void onAction(const ActionEvent& e) override; }; diff --git a/include/app/Knob.hpp b/include/app/Knob.hpp index d8396c38..0a03cd8e 100644 --- a/include/app/Knob.hpp +++ b/include/app/Knob.hpp @@ -30,13 +30,13 @@ struct Knob : ParamWidget { Knob(); ~Knob(); void initParamQuantity() override; - void onHover(const event::Hover& e) override; - void onButton(const event::Button& e) override; - void onDragStart(const event::DragStart& e) override; - void onDragEnd(const event::DragEnd& e) override; - void onDragMove(const event::DragMove& e) override; - void onDragLeave(const event::DragLeave& e) override; - void onHoverScroll(const event::HoverScroll& e) override; + void onHover(const HoverEvent& e) override; + void onButton(const ButtonEvent& e) override; + void onDragStart(const DragStartEvent& e) override; + void onDragEnd(const DragEndEvent& e) override; + void onDragMove(const DragMoveEvent& e) override; + void onDragLeave(const DragLeaveEvent& e) override; + void onHoverScroll(const HoverScrollEvent& e) override; }; diff --git a/include/app/LedDisplay.hpp b/include/app/LedDisplay.hpp index 065c3ea7..d6c6f3a3 100644 --- a/include/app/LedDisplay.hpp +++ b/include/app/LedDisplay.hpp @@ -26,7 +26,7 @@ struct LedDisplayChoice : widget::OpaqueWidget { NVGcolor bgColor; LedDisplayChoice(); void draw(const DrawArgs& args) override; - void onButton(const event::Button& e) override; + void onButton(const ButtonEvent& e) override; }; struct LedDisplayTextField : ui::TextField { diff --git a/include/app/MidiWidget.hpp b/include/app/MidiWidget.hpp index da1c2096..90b572fc 100644 --- a/include/app/MidiWidget.hpp +++ b/include/app/MidiWidget.hpp @@ -24,7 +24,7 @@ struct MidiWidget : LedDisplay { struct MidiButton : SvgButton { midi::Port* port; void setMidiPort(midi::Port* port); - void onAction(const event::Action& e) override; + void onAction(const ActionEvent& e) override; }; diff --git a/include/app/ModuleLightWidget.hpp b/include/app/ModuleLightWidget.hpp index 73e19051..2443a759 100644 --- a/include/app/ModuleLightWidget.hpp +++ b/include/app/ModuleLightWidget.hpp @@ -25,9 +25,9 @@ struct ModuleLightWidget : MultiLightWidget { void destroyTooltip(); void step() override; - void onHover(const event::Hover& e) override; - void onEnter(const event::Enter& e) override; - void onLeave(const event::Leave& e) override; + void onHover(const HoverEvent& e) override; + void onEnter(const EnterEvent& e) override; + void onLeave(const LeaveEvent& e) override; }; diff --git a/include/app/ModuleWidget.hpp b/include/app/ModuleWidget.hpp index cf1d8f77..efbce3ec 100644 --- a/include/app/ModuleWidget.hpp +++ b/include/app/ModuleWidget.hpp @@ -30,11 +30,11 @@ struct ModuleWidget : widget::OpaqueWidget { void draw(const DrawArgs& args) override; void drawShadow(const DrawArgs& args); - void onButton(const event::Button& e) override; - void onHoverKey(const event::HoverKey& e) override; - void onDragStart(const event::DragStart& e) override; - void onDragEnd(const event::DragEnd& e) override; - void onDragMove(const event::DragMove& e) override; + void onButton(const ButtonEvent& e) override; + void onHoverKey(const HoverKeyEvent& e) override; + void onDragStart(const DragStartEvent& e) override; + void onDragEnd(const DragEndEvent& e) override; + void onDragMove(const DragMoveEvent& e) override; /** Associates this ModuleWidget with the Module. Transfers ownership. diff --git a/include/app/ParamWidget.hpp b/include/app/ParamWidget.hpp index a7b6afc5..5b8c623e 100644 --- a/include/app/ParamWidget.hpp +++ b/include/app/ParamWidget.hpp @@ -30,10 +30,10 @@ struct ParamWidget : widget::OpaqueWidget { void step() override; void draw(const DrawArgs& args) override; - void onButton(const event::Button& e) override; - void onDoubleClick(const event::DoubleClick& e) override; - void onEnter(const event::Enter& e) override; - void onLeave(const event::Leave& e) override; + void onButton(const ButtonEvent& e) override; + void onDoubleClick(const DoubleClickEvent& e) override; + void onEnter(const EnterEvent& e) override; + void onLeave(const LeaveEvent& e) override; void createContextMenu(); virtual void appendContextMenu(ui::Menu* menu) {} diff --git a/include/app/PortWidget.hpp b/include/app/PortWidget.hpp index ef3e90b7..49fc7612 100644 --- a/include/app/PortWidget.hpp +++ b/include/app/PortWidget.hpp @@ -31,14 +31,14 @@ struct PortWidget : widget::OpaqueWidget { void step() override; void draw(const DrawArgs& args) override; - void onButton(const event::Button& e) override; - void onEnter(const event::Enter& e) override; - void onLeave(const event::Leave& e) override; - void onDragStart(const event::DragStart& e) override; - void onDragEnd(const event::DragEnd& e) override; - void onDragDrop(const event::DragDrop& e) override; - void onDragEnter(const event::DragEnter& e) override; - void onDragLeave(const event::DragLeave& e) override; + void onButton(const ButtonEvent& e) override; + void onEnter(const EnterEvent& e) override; + void onLeave(const LeaveEvent& e) override; + void onDragStart(const DragStartEvent& e) override; + void onDragEnd(const DragEndEvent& e) override; + void onDragDrop(const DragDropEvent& e) override; + void onDragEnter(const DragEnterEvent& e) override; + void onDragLeave(const DragLeaveEvent& e) override; }; diff --git a/include/app/RackScrollWidget.hpp b/include/app/RackScrollWidget.hpp index 58c18e1f..25cc095c 100644 --- a/include/app/RackScrollWidget.hpp +++ b/include/app/RackScrollWidget.hpp @@ -20,9 +20,9 @@ struct RackScrollWidget : ui::ScrollWidget { void reset(); void step() override; void draw(const DrawArgs& args) override; - void onHoverKey(const event::HoverKey& e) override; - void onHoverScroll(const event::HoverScroll& e) override; - void onHover(const event::Hover& e) override; + void onHoverKey(const HoverKeyEvent& e) override; + void onHoverScroll(const HoverScrollEvent& e) override; + void onHover(const HoverEvent& e) override; }; diff --git a/include/app/RackWidget.hpp b/include/app/RackWidget.hpp index 93b6cef3..9c9c5051 100644 --- a/include/app/RackWidget.hpp +++ b/include/app/RackWidget.hpp @@ -32,10 +32,10 @@ struct RackWidget : widget::OpaqueWidget { void step() override; void draw(const DrawArgs& args) override; - void onHover(const event::Hover& e) override; - void onHoverKey(const event::HoverKey& e) override; - void onDragHover(const event::DragHover& e) override; - void onButton(const event::Button& e) override; + void onHover(const HoverEvent& e) override; + void onHoverKey(const HoverKeyEvent& e) override; + void onDragHover(const DragHoverEvent& e) override; + void onButton(const ButtonEvent& e) override; /** Completely clear the rack's modules and cables */ void clear(); diff --git a/include/app/Scene.hpp b/include/app/Scene.hpp index 5389c931..4168a1c1 100644 --- a/include/app/Scene.hpp +++ b/include/app/Scene.hpp @@ -28,10 +28,10 @@ struct Scene : widget::OpaqueWidget { ~Scene(); void step() override; void draw(const DrawArgs& args) override; - void onHover(const event::Hover& e) override; - void onDragHover(const event::DragHover& e) override; - void onHoverKey(const event::HoverKey& e) override; - void onPathDrop(const event::PathDrop& e) override; + void onHover(const HoverEvent& e) override; + void onDragHover(const DragHoverEvent& e) override; + void onHoverKey(const HoverKeyEvent& e) override; + void onPathDrop(const PathDropEvent& e) override; }; diff --git a/include/app/SliderKnob.hpp b/include/app/SliderKnob.hpp index 82b82de7..989f91d1 100644 --- a/include/app/SliderKnob.hpp +++ b/include/app/SliderKnob.hpp @@ -10,8 +10,8 @@ namespace app { struct SliderKnob : Knob { SliderKnob(); - void onHover(const event::Hover& e) override; - void onButton(const event::Button& e) override; + void onHover(const HoverEvent& e) override; + void onButton(const ButtonEvent& e) override; }; diff --git a/include/app/SvgButton.hpp b/include/app/SvgButton.hpp index d0d810dc..45662e4b 100644 --- a/include/app/SvgButton.hpp +++ b/include/app/SvgButton.hpp @@ -18,9 +18,9 @@ struct SvgButton : widget::OpaqueWidget { SvgButton(); void addFrame(std::shared_ptr svg); - void onDragStart(const event::DragStart& e) override; - void onDragEnd(const event::DragEnd& e) override; - void onDragDrop(const event::DragDrop& e) override; + void onDragStart(const DragStartEvent& e) override; + void onDragEnd(const DragEndEvent& e) override; + void onDragDrop(const DragDropEvent& e) override; }; diff --git a/include/app/SvgKnob.hpp b/include/app/SvgKnob.hpp index 7d3fd72b..ebb4e0f1 100644 --- a/include/app/SvgKnob.hpp +++ b/include/app/SvgKnob.hpp @@ -23,7 +23,7 @@ struct SvgKnob : Knob { DEPRECATED void setSVG(std::shared_ptr svg) { setSvg(svg); } - void onChange(const event::Change& e) override; + void onChange(const ChangeEvent& e) override; }; diff --git a/include/app/SvgSlider.hpp b/include/app/SvgSlider.hpp index c61d4ccd..dce80d4a 100644 --- a/include/app/SvgSlider.hpp +++ b/include/app/SvgSlider.hpp @@ -22,7 +22,7 @@ struct SvgSlider : app::SliderKnob { SvgSlider(); void setBackgroundSvg(std::shared_ptr svg); void setHandleSvg(std::shared_ptr svg); - void onChange(const event::Change& e) override; + void onChange(const ChangeEvent& e) override; DEPRECATED void setBackgroundSVG(std::shared_ptr svg) { setBackgroundSvg(svg); diff --git a/include/app/SvgSwitch.hpp b/include/app/SvgSwitch.hpp index b8ca995e..98efc8f7 100644 --- a/include/app/SvgSwitch.hpp +++ b/include/app/SvgSwitch.hpp @@ -20,7 +20,7 @@ struct SvgSwitch : Switch { SvgSwitch(); /** Adds an SVG file to represent the next switch position */ void addFrame(std::shared_ptr svg); - void onChange(const event::Change& e) override; + void onChange(const ChangeEvent& e) override; }; diff --git a/include/app/Switch.hpp b/include/app/Switch.hpp index 7dfb7ae8..e26005f0 100644 --- a/include/app/Switch.hpp +++ b/include/app/Switch.hpp @@ -21,9 +21,9 @@ struct Switch : ParamWidget { void initParamQuantity() override; void step() override; - void onDoubleClick(const event::DoubleClick& e) override; - void onDragStart(const event::DragStart& e) override; - void onDragEnd(const event::DragEnd& e) override; + void onDoubleClick(const DoubleClickEvent& e) override; + void onDragStart(const DragStartEvent& e) override; + void onDragEnd(const DragEndEvent& e) override; }; diff --git a/include/ui/Button.hpp b/include/ui/Button.hpp index ecf9cdb2..7f7c7e61 100644 --- a/include/ui/Button.hpp +++ b/include/ui/Button.hpp @@ -15,9 +15,9 @@ struct Button : widget::OpaqueWidget { Button(); void draw(const DrawArgs& args) override; - void onDragStart(const event::DragStart& e) override; - void onDragEnd(const event::DragEnd& e) override; - void onDragDrop(const event::DragDrop& e) override; + void onDragStart(const DragStartEvent& e) override; + void onDragEnd(const DragEndEvent& e) override; + void onDragDrop(const DragDropEvent& e) override; }; diff --git a/include/ui/Menu.hpp b/include/ui/Menu.hpp index 01e4a3af..a33605d6 100644 --- a/include/ui/Menu.hpp +++ b/include/ui/Menu.hpp @@ -19,7 +19,7 @@ struct Menu : widget::OpaqueWidget { void setChildMenu(Menu* menu); void step() override; void draw(const DrawArgs& args) override; - void onHoverScroll(const event::HoverScroll& e) override; + void onHoverScroll(const HoverScrollEvent& e) override; }; diff --git a/include/ui/MenuItem.hpp b/include/ui/MenuItem.hpp index 02746efc..b496bcbd 100644 --- a/include/ui/MenuItem.hpp +++ b/include/ui/MenuItem.hpp @@ -17,13 +17,13 @@ struct MenuItem : MenuEntry { void draw(const DrawArgs& args) override; void step() override; - void onEnter(const event::Enter& e) override; - void onDragDrop(const event::DragDrop& e) override; + void onEnter(const EnterEvent& e) override; + void onDragDrop(const DragDropEvent& e) override; void doAction(); virtual Menu* createChildMenu() { return NULL; } - void onAction(const event::Action& e) override; + void onAction(const ActionEvent& e) override; }; diff --git a/include/ui/MenuOverlay.hpp b/include/ui/MenuOverlay.hpp index e49ce995..a77a7c24 100644 --- a/include/ui/MenuOverlay.hpp +++ b/include/ui/MenuOverlay.hpp @@ -11,9 +11,9 @@ namespace ui { struct MenuOverlay : widget::OpaqueWidget { void draw(const DrawArgs& args) override; void step() override; - void onButton(const event::Button& e) override; - void onHoverKey(const event::HoverKey& e) override; - void onAction(const event::Action& e) override; + void onButton(const ButtonEvent& e) override; + void onHoverKey(const HoverKeyEvent& e) override; + void onAction(const ActionEvent& e) override; }; diff --git a/include/ui/OptionButton.hpp b/include/ui/OptionButton.hpp index 8331806a..3f541259 100644 --- a/include/ui/OptionButton.hpp +++ b/include/ui/OptionButton.hpp @@ -15,7 +15,7 @@ struct OptionButton : widget::OpaqueWidget { OptionButton(); void draw(const DrawArgs& args) override; - void onDragDrop(const event::DragDrop& e) override; + void onDragDrop(const DragDropEvent& e) override; }; diff --git a/include/ui/RadioButton.hpp b/include/ui/RadioButton.hpp index 4feaa279..21b9a36e 100644 --- a/include/ui/RadioButton.hpp +++ b/include/ui/RadioButton.hpp @@ -15,7 +15,7 @@ struct RadioButton : widget::OpaqueWidget { RadioButton(); void draw(const DrawArgs& args) override; - void onDragDrop(const event::DragDrop& e) override; + void onDragDrop(const DragDropEvent& e) override; }; diff --git a/include/ui/ScrollWidget.hpp b/include/ui/ScrollWidget.hpp index 8095f0a4..e1a26371 100644 --- a/include/ui/ScrollWidget.hpp +++ b/include/ui/ScrollWidget.hpp @@ -31,11 +31,11 @@ struct ScrollWidget : widget::OpaqueWidget { math::Vec getHandleSize(); void draw(const DrawArgs& args) override; void step() override; - void onButton(const event::Button& e) override; - void onDragStart(const event::DragStart& e) override; - void onDragMove(const event::DragMove& e) override; - void onHoverScroll(const event::HoverScroll& e) override; - void onHoverKey(const event::HoverKey& e) override; + void onButton(const ButtonEvent& e) override; + void onDragStart(const DragStartEvent& e) override; + void onDragMove(const DragMoveEvent& e) override; + void onHoverScroll(const HoverScrollEvent& e) override; + void onHoverKey(const HoverKeyEvent& e) override; }; diff --git a/include/ui/Scrollbar.hpp b/include/ui/Scrollbar.hpp index 1a0669c6..e89759c0 100644 --- a/include/ui/Scrollbar.hpp +++ b/include/ui/Scrollbar.hpp @@ -17,10 +17,10 @@ struct Scrollbar : widget::OpaqueWidget { Scrollbar(); ~Scrollbar(); void draw(const DrawArgs& args) override; - void onButton(const event::Button& e) override; - void onDragStart(const event::DragStart& e) override; - void onDragEnd(const event::DragEnd& e) override; - void onDragMove(const event::DragMove& e) override; + void onButton(const ButtonEvent& e) override; + void onDragStart(const DragStartEvent& e) override; + void onDragEnd(const DragEndEvent& e) override; + void onDragMove(const DragMoveEvent& e) override; }; diff --git a/include/ui/Slider.hpp b/include/ui/Slider.hpp index a1eae6b0..9d2cde29 100644 --- a/include/ui/Slider.hpp +++ b/include/ui/Slider.hpp @@ -15,10 +15,10 @@ struct Slider : widget::OpaqueWidget { Slider(); void draw(const DrawArgs& args) override; - void onDragStart(const event::DragStart& e) override; - void onDragMove(const event::DragMove& e) override; - void onDragEnd(const event::DragEnd& e) override; - void onDoubleClick(const event::DoubleClick& e) override; + void onDragStart(const DragStartEvent& e) override; + void onDragMove(const DragMoveEvent& e) override; + void onDragEnd(const DragEndEvent& e) override; + void onDoubleClick(const DoubleClickEvent& e) override; }; diff --git a/include/ui/TextField.hpp b/include/ui/TextField.hpp index 26fb15b0..376d6e15 100644 --- a/include/ui/TextField.hpp +++ b/include/ui/TextField.hpp @@ -21,10 +21,10 @@ struct TextField : widget::OpaqueWidget { TextField(); void draw(const DrawArgs& args) override; - void onDragHover(const event::DragHover& e) override; - void onButton(const event::Button& e) override; - void onSelectText(const event::SelectText& e) override; - void onSelectKey(const event::SelectKey& e) override; + void onDragHover(const DragHoverEvent& e) override; + void onButton(const ButtonEvent& e) override; + void onSelectText(const SelectTextEvent& e) override; + void onSelectKey(const SelectKeyEvent& e) override; virtual int getTextPosition(math::Vec mousePos); std::string getText(); diff --git a/include/widget/FramebufferWidget.hpp b/include/widget/FramebufferWidget.hpp index 4093c910..776bdf03 100644 --- a/include/widget/FramebufferWidget.hpp +++ b/include/widget/FramebufferWidget.hpp @@ -24,7 +24,7 @@ struct FramebufferWidget : Widget { FramebufferWidget(); ~FramebufferWidget(); void setDirty(bool dirty = true); - void onDirty(const event::Dirty& e) override; + void onDirty(const DirtyEvent& e) override; void step() override; void draw(const DrawArgs& args) override; virtual void drawFramebuffer(); diff --git a/include/widget/OpaqueWidget.hpp b/include/widget/OpaqueWidget.hpp index 32f4becd..ce75b729 100644 --- a/include/widget/OpaqueWidget.hpp +++ b/include/widget/OpaqueWidget.hpp @@ -10,14 +10,14 @@ namespace widget { Also consumes Hover and Button for left-clicks. */ struct OpaqueWidget : Widget { - void onHover(const event::Hover& e) override { + void onHover(const HoverEvent& e) override { Widget::onHover(e); e.stopPropagating(); // Consume if not consumed by child if (!e.isConsumed()) e.consume(this); } - void onButton(const event::Button& e) override { + void onButton(const ButtonEvent& e) override { Widget::onButton(e); e.stopPropagating(); if (e.button == GLFW_MOUSE_BUTTON_LEFT) { @@ -26,26 +26,26 @@ struct OpaqueWidget : Widget { e.consume(this); } } - void onHoverKey(const event::HoverKey& e) override { + void onHoverKey(const HoverKeyEvent& e) override { Widget::onHoverKey(e); e.stopPropagating(); } - void onHoverText(const event::HoverText& e) override { + void onHoverText(const HoverTextEvent& e) override { Widget::onHoverText(e); e.stopPropagating(); } - void onHoverScroll(const event::HoverScroll& e) override { + void onHoverScroll(const HoverScrollEvent& e) override { Widget::onHoverScroll(e); e.stopPropagating(); } - void onDragHover(const event::DragHover& e) override { + void onDragHover(const DragHoverEvent& e) override { Widget::onDragHover(e); e.stopPropagating(); // Consume if not consumed by child if (!e.isConsumed()) e.consume(this); } - void onPathDrop(const event::PathDrop& e) override { + void onPathDrop(const PathDropEvent& e) override { Widget::onPathDrop(e); e.stopPropagating(); } diff --git a/include/widget/TransparentWidget.hpp b/include/widget/TransparentWidget.hpp index c30913f6..8b7072c8 100644 --- a/include/widget/TransparentWidget.hpp +++ b/include/widget/TransparentWidget.hpp @@ -9,13 +9,13 @@ namespace widget { /** A Widget that does not respond to events and does not pass events to children */ struct TransparentWidget : Widget { /** Override behavior to do nothing instead. */ - void onHover(const event::Hover& e) override {} - void onButton(const event::Button& e) override {} - void onHoverKey(const event::HoverKey& e) override {} - void onHoverText(const event::HoverText& e) override {} - void onHoverScroll(const event::HoverScroll& e) override {} - void onDragHover(const event::DragHover& e) override {} - void onPathDrop(const event::PathDrop& e) override {} + void onHover(const HoverEvent& e) override {} + void onButton(const ButtonEvent& e) override {} + void onHoverKey(const HoverKeyEvent& e) override {} + void onHoverText(const HoverTextEvent& e) override {} + void onHoverScroll(const HoverScrollEvent& e) override {} + void onDragHover(const DragHoverEvent& e) override {} + void onPathDrop(const PathDropEvent& e) override {} }; diff --git a/include/widget/Widget.hpp b/include/widget/Widget.hpp index db34e20a..ef1fbb49 100644 --- a/include/widget/Widget.hpp +++ b/include/widget/Widget.hpp @@ -458,7 +458,7 @@ struct Widget : WeakBase { } // namespace widget /** Deprecated Rack v1 event namespace. -Use `ExampleWidget` instead of `event::Example` in new code. +Use `FooEvent` instead of `event::Foo` in new code. */ namespace event { using Base = widget::BaseEvent; diff --git a/include/widget/ZoomWidget.hpp b/include/widget/ZoomWidget.hpp index 167b54cd..4cc01a4c 100644 --- a/include/widget/ZoomWidget.hpp +++ b/include/widget/ZoomWidget.hpp @@ -19,38 +19,38 @@ struct ZoomWidget : Widget { } void draw(const DrawArgs& args) override; - void onHover(const event::Hover& e) override { - event::Hover e2 = e; + void onHover(const HoverEvent& e) override { + HoverEvent e2 = e; e2.pos = e.pos.div(zoom); Widget::onHover(e2); } - void onButton(const event::Button& e) override { - event::Button e2 = e; + void onButton(const ButtonEvent& e) override { + ButtonEvent e2 = e; e2.pos = e.pos.div(zoom); Widget::onButton(e2); } - void onHoverKey(const event::HoverKey& e) override { - event::HoverKey e2 = e; + void onHoverKey(const HoverKeyEvent& e) override { + HoverKeyEvent e2 = e; e2.pos = e.pos.div(zoom); Widget::onHoverKey(e2); } - void onHoverText(const event::HoverText& e) override { - event::HoverText e2 = e; + void onHoverText(const HoverTextEvent& e) override { + HoverTextEvent e2 = e; e2.pos = e.pos.div(zoom); Widget::onHoverText(e2); } - void onHoverScroll(const event::HoverScroll& e) override { - event::HoverScroll e2 = e; + void onHoverScroll(const HoverScrollEvent& e) override { + HoverScrollEvent e2 = e; e2.pos = e.pos.div(zoom); Widget::onHoverScroll(e2); } - void onDragHover(const event::DragHover& e) override { - event::DragHover e2 = e; + void onDragHover(const DragHoverEvent& e) override { + DragHoverEvent e2 = e; e2.pos = e.pos.div(zoom); Widget::onDragHover(e2); } - void onPathDrop(const event::PathDrop& e) override { - event::PathDrop e2 = e; + void onPathDrop(const PathDropEvent& e) override { + PathDropEvent e2 = e; e2.pos = e.pos.div(zoom); Widget::onPathDrop(e2); } diff --git a/src/app/AudioWidget.cpp b/src/app/AudioWidget.cpp index 0c894553..cf5910eb 100644 --- a/src/app/AudioWidget.cpp +++ b/src/app/AudioWidget.cpp @@ -28,7 +28,7 @@ static std::string getDetailTemplate(std::string name, int numInputs, int inputO struct AudioDriverValueItem : ui::MenuItem { audio::Port* port; int driverId; - void onAction(const event::Action& e) override { + void onAction(const ActionEvent& e) override { port->setDriverId(driverId); } }; @@ -49,7 +49,7 @@ static void appendAudioDriverMenu(ui::Menu* menu, audio::Port* port) { struct AudioDriverChoice : LedDisplayChoice { audio::Port* port; - void onAction(const event::Action& e) override { + void onAction(const ActionEvent& e) override { ui::Menu* menu = createMenu(); menu->addChild(createMenuLabel("Audio driver")); appendAudioDriverMenu(menu, port); @@ -86,7 +86,7 @@ struct AudioDeviceValueItem : ui::MenuItem { int deviceId; int inputOffset; int outputOffset; - void onAction(const event::Action& e) override { + void onAction(const ActionEvent& e) override { port->setDeviceId(deviceId); port->inputOffset = inputOffset; port->outputOffset = outputOffset; @@ -133,7 +133,7 @@ static void appendAudioDeviceMenu(ui::Menu* menu, audio::Port* port) { struct AudioDeviceChoice : LedDisplayChoice { audio::Port* port; - void onAction(const event::Action& e) override { + void onAction(const ActionEvent& e) override { ui::Menu* menu = createMenu(); menu->addChild(createMenuLabel("Audio device")); appendAudioDeviceMenu(menu, port); @@ -173,7 +173,7 @@ struct AudioDeviceItem : ui::MenuItem { struct AudioSampleRateValueItem : ui::MenuItem { audio::Port* port; float sampleRate; - void onAction(const event::Action& e) override { + void onAction(const ActionEvent& e) override { port->setSampleRate(sampleRate); } }; @@ -203,7 +203,7 @@ static void appendAudioSampleRateMenu(ui::Menu* menu, audio::Port* port) { struct AudioSampleRateChoice : LedDisplayChoice { audio::Port* port; - void onAction(const event::Action& e) override { + void onAction(const ActionEvent& e) override { ui::Menu* menu = createMenu(); menu->addChild(createMenuLabel("Sample rate")); appendAudioSampleRateMenu(menu, port); @@ -238,7 +238,7 @@ struct AudioSampleRateItem : ui::MenuItem { struct AudioBlockSizeValueItem : ui::MenuItem { audio::Port* port; int blockSize; - void onAction(const event::Action& e) override { + void onAction(const ActionEvent& e) override { port->setBlockSize(blockSize); } }; @@ -269,7 +269,7 @@ static void appendAudioBlockSizeMenu(ui::Menu* menu, audio::Port* port) { struct AudioBlockSizeChoice : LedDisplayChoice { audio::Port* port; - void onAction(const event::Action& e) override { + void onAction(const ActionEvent& e) override { ui::Menu* menu = createMenu(); menu->addChild(createMenuLabel("Block size")); appendAudioBlockSizeMenu(menu, port); @@ -348,7 +348,7 @@ void AudioWidget::setAudioPort(audio::Port* port) { struct AudioDeviceMenuChoice : AudioDeviceChoice { - void onAction(const event::Action& e) override { + void onAction(const ActionEvent& e) override { ui::Menu* menu = createMenu(); appendAudioMenu(menu, port); } @@ -370,7 +370,7 @@ void AudioButton::setAudioPort(audio::Port* port) { } -void AudioButton::onAction(const event::Action& e) { +void AudioButton::onAction(const ActionEvent& e) { ui::Menu* menu = createMenu(); appendAudioMenu(menu, port); } diff --git a/src/app/Knob.cpp b/src/app/Knob.cpp index 5daa5eb3..0af91850 100644 --- a/src/app/Knob.cpp +++ b/src/app/Knob.cpp @@ -43,7 +43,7 @@ void Knob::initParamQuantity() { } } -void Knob::onHover(const event::Hover& e) { +void Knob::onHover(const HoverEvent& e) { // Only call super if mouse position is in the circle math::Vec c = box.size.div(2); float dist = e.pos.minus(c).norm(); @@ -52,7 +52,7 @@ void Knob::onHover(const event::Hover& e) { } } -void Knob::onButton(const event::Button& e) { +void Knob::onButton(const ButtonEvent& e) { math::Vec c = box.size.div(2); float dist = e.pos.minus(c).norm(); if (dist <= c.x) { @@ -60,7 +60,7 @@ void Knob::onButton(const event::Button& e) { } } -void Knob::onDragStart(const event::DragStart& e) { +void Knob::onDragStart(const DragStartEvent& e) { if (e.button != GLFW_MOUSE_BUTTON_LEFT) return; @@ -83,7 +83,7 @@ void Knob::onDragStart(const event::DragStart& e) { ParamWidget::onDragStart(e); } -void Knob::onDragEnd(const event::DragEnd& e) { +void Knob::onDragEnd(const DragEndEvent& e) { if (e.button != GLFW_MOUSE_BUTTON_LEFT) return; @@ -124,7 +124,7 @@ static float getModSpeed() { return 1.f; } -void Knob::onDragMove(const event::DragMove& e) { +void Knob::onDragMove(const DragMoveEvent& e) { if (e.button != GLFW_MOUSE_BUTTON_LEFT) return; @@ -215,7 +215,7 @@ void Knob::onDragMove(const event::DragMove& e) { ParamWidget::onDragMove(e); } -void Knob::onDragLeave(const event::DragLeave& e) { +void Knob::onDragLeave(const DragLeaveEvent& e) { if (e.origin == this) { internal->rotaryDragEnabled = true; } @@ -224,7 +224,7 @@ void Knob::onDragLeave(const event::DragLeave& e) { } -void Knob::onHoverScroll(const event::HoverScroll& e) { +void Knob::onHoverScroll(const HoverScrollEvent& e) { ParamWidget::onHoverScroll(e); if (settings::knobScroll) { diff --git a/src/app/LedDisplay.cpp b/src/app/LedDisplay.cpp index 38736846..5d85bc1e 100644 --- a/src/app/LedDisplay.cpp +++ b/src/app/LedDisplay.cpp @@ -62,11 +62,11 @@ void LedDisplayChoice::draw(const DrawArgs& args) { nvgResetScissor(args.vg); } -void LedDisplayChoice::onButton(const event::Button& e) { +void LedDisplayChoice::onButton(const ButtonEvent& e) { OpaqueWidget::onButton(e); if (e.action == GLFW_PRESS && (e.button == GLFW_MOUSE_BUTTON_LEFT || e.button == GLFW_MOUSE_BUTTON_RIGHT)) { - event::Action eAction; + ActionEvent eAction; onAction(eAction); e.consume(this); } diff --git a/src/app/MenuBar.cpp b/src/app/MenuBar.cpp index bfe41be3..d1752216 100644 --- a/src/app/MenuBar.cpp +++ b/src/app/MenuBar.cpp @@ -61,7 +61,7 @@ struct NotificationIcon : widget::Widget { struct UrlItem : ui::MenuItem { std::string url; - void onAction(const event::Action& e) override { + void onAction(const ActionEvent& e) override { std::thread t([=] { system::openBrowser(url); }); @@ -71,7 +71,7 @@ struct UrlItem : ui::MenuItem { struct FolderItem : ui::MenuItem { std::string path; - void onAction(const event::Action& e) override { + void onAction(const ActionEvent& e) override { std::thread t([=] { system::openFolder(path); }); @@ -84,20 +84,20 @@ struct FolderItem : ui::MenuItem { //////////////////// struct NewItem : ui::MenuItem { - void onAction(const event::Action& e) override { + void onAction(const ActionEvent& e) override { APP->patch->loadTemplateDialog(); } }; struct OpenItem : ui::MenuItem { - void onAction(const event::Action& e) override { + void onAction(const ActionEvent& e) override { APP->patch->loadDialog(); } }; struct OpenPathItem : ui::MenuItem { std::string path; - void onAction(const event::Action& e) override { + void onAction(const ActionEvent& e) override { APP->patch->loadPathDialog(path); } }; @@ -118,37 +118,37 @@ struct OpenRecentItem : ui::MenuItem { }; struct SaveItem : ui::MenuItem { - void onAction(const event::Action& e) override { + void onAction(const ActionEvent& e) override { APP->patch->saveDialog(); } }; struct SaveAsItem : ui::MenuItem { - void onAction(const event::Action& e) override { + void onAction(const ActionEvent& e) override { APP->patch->saveAsDialog(); } }; struct SaveTemplateItem : ui::MenuItem { - void onAction(const event::Action& e) override { + void onAction(const ActionEvent& e) override { APP->patch->saveTemplateDialog(); } }; struct RevertItem : ui::MenuItem { - void onAction(const event::Action& e) override { + void onAction(const ActionEvent& e) override { APP->patch->revertDialog(); } }; struct QuitItem : ui::MenuItem { - void onAction(const event::Action& e) override { + void onAction(const ActionEvent& e) override { APP->window->close(); } }; struct FileButton : MenuButton { - void onAction(const event::Action& e) override { + void onAction(const ActionEvent& e) override { ui::Menu* menu = createMenu(); menu->box.pos = getAbsoluteOffset(math::Vec(0, box.size.y)); menu->box.size.x = box.size.x; @@ -201,25 +201,25 @@ struct FileButton : MenuButton { //////////////////// struct UndoItem : ui::MenuItem { - void onAction(const event::Action& e) override { + void onAction(const ActionEvent& e) override { APP->history->undo(); } }; struct RedoItem : ui::MenuItem { - void onAction(const event::Action& e) override { + void onAction(const ActionEvent& e) override { APP->history->redo(); } }; struct DisconnectCablesItem : ui::MenuItem { - void onAction(const event::Action& e) override { + void onAction(const ActionEvent& e) override { APP->patch->disconnectDialog(); } }; struct EditButton : MenuButton { - void onAction(const event::Action& e) override { + void onAction(const ActionEvent& e) override { ui::Menu* menu = createMenu(); menu->box.pos = getAbsoluteOffset(math::Vec(0, box.size.y)); menu->box.size.x = box.size.x; @@ -346,20 +346,20 @@ struct CableTensionSlider : ui::Slider { }; struct TooltipsItem : ui::MenuItem { - void onAction(const event::Action& e) override { + void onAction(const ActionEvent& e) override { settings::tooltips ^= true; } }; struct AllowCursorLockItem : ui::MenuItem { - void onAction(const event::Action& e) override { + void onAction(const ActionEvent& e) override { settings::allowCursorLock ^= true; } }; struct KnobModeValueItem : ui::MenuItem { settings::KnobMode knobMode; - void onAction(const event::Action& e) override { + void onAction(const ActionEvent& e) override { settings::knobMode = knobMode; } }; @@ -386,20 +386,20 @@ struct KnobModeItem : ui::MenuItem { }; struct KnobScrollItem : ui::MenuItem { - void onAction(const event::Action& e) override { + void onAction(const ActionEvent& e) override { settings::knobScroll ^= true; } }; struct LockModulesItem : ui::MenuItem { - void onAction(const event::Action& e) override { + void onAction(const ActionEvent& e) override { settings::lockModules ^= true; } }; struct FrameRateValueItem : ui::MenuItem { int frameSwapInterval; - void onAction(const event::Action& e) override { + void onAction(const ActionEvent& e) override { settings::frameSwapInterval = frameSwapInterval; } }; @@ -422,13 +422,13 @@ struct FrameRateItem : ui::MenuItem { }; struct FullscreenItem : ui::MenuItem { - void onAction(const event::Action& e) override { + void onAction(const ActionEvent& e) override { APP->window->setFullScreen(!APP->window->isFullScreen()); } }; struct ViewButton : MenuButton { - void onAction(const event::Action& e) override { + void onAction(const ActionEvent& e) override { ui::Menu* menu = createMenu(); menu->box.pos = getAbsoluteOffset(math::Vec(0, box.size.y)); menu->box.size.x = box.size.x; @@ -489,14 +489,14 @@ struct ViewButton : MenuButton { //////////////////// struct CpuMeterItem : ui::MenuItem { - void onAction(const event::Action& e) override { + void onAction(const ActionEvent& e) override { settings::cpuMeter ^= true; } }; struct SampleRateValueItem : ui::MenuItem { float sampleRate; - void onAction(const event::Action& e) override { + void onAction(const ActionEvent& e) override { settings::sampleRate = sampleRate; } }; @@ -550,7 +550,7 @@ struct ThreadCountValueItem : ui::MenuItem { text += " (lowest CPU usage)"; rightText = CHECKMARK(settings::threadCount == threadCount); } - void onAction(const event::Action& e) override { + void onAction(const ActionEvent& e) override { settings::threadCount = threadCount; } }; @@ -570,7 +570,7 @@ struct ThreadCountItem : ui::MenuItem { }; struct EngineButton : MenuButton { - void onAction(const event::Action& e) override { + void onAction(const ActionEvent& e) override { ui::Menu* menu = createMenu(); menu->box.pos = getAbsoluteOffset(math::Vec(0, box.size.y)); menu->box.size.x = box.size.x; @@ -602,7 +602,7 @@ static bool isLoggingIn = false; struct AccountEmailField : ui::TextField { ui::TextField* passwordField; - void onSelectKey(const event::SelectKey& e) override { + void onSelectKey(const SelectKeyEvent& e) override { if (e.action == GLFW_PRESS && e.key == GLFW_KEY_TAB) { APP->event->setSelected(passwordField); e.consume(this); @@ -616,7 +616,7 @@ struct AccountEmailField : ui::TextField { struct AccountPasswordField : ui::PasswordField { ui::MenuItem* logInItem; - void onSelectKey(const event::SelectKey& e) override { + void onSelectKey(const SelectKeyEvent& e) override { if (e.action == GLFW_PRESS && (e.key == GLFW_KEY_ENTER || e.key == GLFW_KEY_KP_ENTER)) { logInItem->doAction(); e.consume(this); @@ -631,7 +631,7 @@ struct LogInItem : ui::MenuItem { ui::TextField* emailField; ui::TextField* passwordField; - void onAction(const event::Action& e) override { + void onAction(const ActionEvent& e) override { isLoggingIn = true; std::string email = emailField->text; std::string password = passwordField->text; @@ -670,7 +670,7 @@ struct SyncUpdatesItem : ui::MenuItem { MenuItem::step(); } - void onAction(const event::Action& e) override { + void onAction(const ActionEvent& e) override { std::thread t([=] { library::syncUpdates(); }); @@ -739,7 +739,7 @@ struct SyncUpdateItem : ui::MenuItem { MenuItem::step(); } - void onAction(const event::Action& e) override { + void onAction(const ActionEvent& e) override { std::thread t([=] { library::syncUpdate(slug); }); @@ -750,7 +750,7 @@ struct SyncUpdateItem : ui::MenuItem { struct CheckUpdatesItem : ui::MenuItem { - void onAction(const event::Action& e) override { + void onAction(const ActionEvent& e) override { std::thread t([&] { library::checkUpdates(); }); @@ -760,7 +760,7 @@ struct CheckUpdatesItem : ui::MenuItem { struct LogOutItem : ui::MenuItem { - void onAction(const event::Action& e) override { + void onAction(const ActionEvent& e) override { library::logOut(); } }; @@ -857,7 +857,7 @@ struct LibraryButton : MenuButton { addChild(notification); } - void onAction(const event::Action& e) override { + void onAction(const ActionEvent& e) override { ui::Menu* menu = createMenu(); menu->box.pos = getAbsoluteOffset(math::Vec(0, box.size.y)); menu->box.size.x = box.size.x; @@ -895,7 +895,7 @@ struct AppUpdateItem : ui::MenuItem { return menu; } - void onAction(const event::Action& e) override { + void onAction(const ActionEvent& e) override { system::openBrowser(library::appDownloadUrl); APP->window->close(); } @@ -903,7 +903,7 @@ struct AppUpdateItem : ui::MenuItem { struct CheckAppUpdateItem : ui::MenuItem { - void onAction(const event::Action& e) override { + void onAction(const ActionEvent& e) override { std::thread t([&]() { library::checkAppUpdate(); }); @@ -913,7 +913,7 @@ struct CheckAppUpdateItem : ui::MenuItem { struct TipItem : ui::MenuItem { - void onAction(const event::Action& e) override { + void onAction(const ActionEvent& e) override { APP->scene->addChild(tipWindowCreate()); } }; @@ -927,7 +927,7 @@ struct HelpButton : MenuButton { addChild(notification); } - void onAction(const event::Action& e) override { + void onAction(const ActionEvent& e) override { ui::Menu* menu = createMenu(); menu->box.pos = getAbsoluteOffset(math::Vec(0, box.size.y)); menu->box.size.x = box.size.x; diff --git a/src/app/MidiWidget.cpp b/src/app/MidiWidget.cpp index 5c383bba..29f0645e 100644 --- a/src/app/MidiWidget.cpp +++ b/src/app/MidiWidget.cpp @@ -10,7 +10,7 @@ namespace app { struct MidiDriverValueItem : ui::MenuItem { midi::Port* port; int driverId; - void onAction(const event::Action& e) override { + void onAction(const ActionEvent& e) override { port->setDriverId(driverId); } }; @@ -31,7 +31,7 @@ static void appendMidiDriverMenu(ui::Menu* menu, midi::Port* port) { struct MidiDriverChoice : LedDisplayChoice { midi::Port* port; - void onAction(const event::Action& e) override { + void onAction(const ActionEvent& e) override { ui::Menu* menu = createMenu(); menu->addChild(createMenuLabel("MIDI driver")); appendMidiDriverMenu(menu, port); @@ -61,7 +61,7 @@ struct MidiDriverItem : ui::MenuItem { struct MidiDeviceValueItem : ui::MenuItem { midi::Port* port; int deviceId; - void onAction(const event::Action& e) override { + void onAction(const ActionEvent& e) override { port->setDeviceId(deviceId); } }; @@ -91,7 +91,7 @@ static void appendMidiDeviceMenu(ui::Menu* menu, midi::Port* port) { struct MidiDeviceChoice : LedDisplayChoice { midi::Port* port; - void onAction(const event::Action& e) override { + void onAction(const ActionEvent& e) override { ui::Menu* menu = createMenu(); menu->addChild(createMenuLabel("MIDI device")); appendMidiDeviceMenu(menu, port); @@ -121,7 +121,7 @@ struct MidiDeviceItem : ui::MenuItem { struct MidiChannelValueItem : ui::MenuItem { midi::Port* port; int channel; - void onAction(const event::Action& e) override { + void onAction(const ActionEvent& e) override { port->setChannel(channel); } }; @@ -142,7 +142,7 @@ static void appendMidiChannelMenu(ui::Menu* menu, midi::Port* port) { struct MidiChannelChoice : LedDisplayChoice { midi::Port* port; - void onAction(const event::Action& e) override { + void onAction(const ActionEvent& e) override { ui::Menu* menu = createMenu(); menu->addChild(createMenuLabel("MIDI channel")); appendMidiChannelMenu(menu, port); @@ -202,7 +202,7 @@ void MidiButton::setMidiPort(midi::Port* port) { } -void MidiButton::onAction(const event::Action& e) { +void MidiButton::onAction(const ActionEvent& e) { ui::Menu* menu = createMenu(); appendMidiMenu(menu, port); } diff --git a/src/app/ModuleBrowser.cpp b/src/app/ModuleBrowser.cpp index b6a721e0..49f20bf3 100644 --- a/src/app/ModuleBrowser.cpp +++ b/src/app/ModuleBrowser.cpp @@ -121,7 +121,7 @@ struct BrowserOverlay : ui::MenuOverlay { MenuOverlay::step(); } - void onAction(const event::Action& e) override { + void onAction(const ActionEvent& e) override { hide(); } }; @@ -217,7 +217,7 @@ struct ModelBox : widget::OpaqueWidget { } } - void onButton(const event::Button& e) override { + void onButton(const ButtonEvent& e) override { OpaqueWidget::onButton(e); if (e.getTarget() != this) return; @@ -235,7 +235,7 @@ struct ModelBox : widget::OpaqueWidget { } } - void onEnter(const event::Enter& e) override { + void onEnter(const EnterEvent& e) override { std::string text; text = model->plugin->brand; text += " " + model->name; @@ -256,11 +256,11 @@ struct ModelBox : widget::OpaqueWidget { setTooltip(tooltip); } - void onLeave(const event::Leave& e) override { + void onLeave(const LeaveEvent& e) override { setTooltip(NULL); } - void onHide(const event::Hide& e) override { + void onHide(const HideEvent& e) override { // Hide tooltip setTooltip(NULL); OpaqueWidget::onHide(e); @@ -277,16 +277,16 @@ struct BrowserSearchField : ui::TextField { TextField::step(); } - void onSelectKey(const event::SelectKey& e) override; - void onChange(const event::Change& e) override; - void onAction(const event::Action& e) override; + void onSelectKey(const SelectKeyEvent& e) override; + void onChange(const ChangeEvent& e) override; + void onAction(const ActionEvent& e) override; - void onHide(const event::Hide& e) override { + void onHide(const HideEvent& e) override { APP->event->setSelected(NULL); ui::TextField::onHide(e); } - void onShow(const event::Show& e) override { + void onShow(const ShowEvent& e) override { selectAll(); TextField::onShow(e); } @@ -295,14 +295,14 @@ struct BrowserSearchField : ui::TextField { struct ClearButton : ui::Button { ModuleBrowser* browser; - void onAction(const event::Action& e) override; + void onAction(const ActionEvent& e) override; }; struct BrandItem : ui::MenuItem { ModuleBrowser* browser; std::string brand; - void onAction(const event::Action& e) override; + void onAction(const ActionEvent& e) override; void step() override; }; @@ -310,7 +310,7 @@ struct BrandItem : ui::MenuItem { struct BrandButton : ui::ChoiceButton { ModuleBrowser* browser; - void onAction(const event::Action& e) override; + void onAction(const ActionEvent& e) override; void step() override; }; @@ -318,7 +318,7 @@ struct BrandButton : ui::ChoiceButton { struct TagItem : ui::MenuItem { ModuleBrowser* browser; int tagId; - void onAction(const event::Action& e) override; + void onAction(const ActionEvent& e) override; void step() override; }; @@ -326,7 +326,7 @@ struct TagItem : ui::MenuItem { struct TagButton : ui::ChoiceButton { ModuleBrowser* browser; - void onAction(const event::Action& e) override; + void onAction(const ActionEvent& e) override; void step() override; }; @@ -344,7 +344,7 @@ static const std::string sortNames[] = { struct SortItem : ui::MenuItem { ModuleBrowser* browser; settings::ModuleBrowserSort sort; - void onAction(const event::Action& e) override; + void onAction(const ActionEvent& e) override; void step() override { rightText = CHECKMARK(settings::moduleBrowserSort == sort); MenuItem::step(); @@ -355,7 +355,7 @@ struct SortItem : ui::MenuItem { struct SortButton : ui::ChoiceButton { ModuleBrowser* browser; - void onAction(const event::Action& e) override { + void onAction(const ActionEvent& e) override { ui::Menu* menu = createMenu(); menu->box.pos = getAbsoluteOffset(math::Vec(0, box.size.y)); menu->box.size.x = box.size.x; @@ -380,7 +380,7 @@ struct SortButton : ui::ChoiceButton { struct ZoomItem : ui::MenuItem { ModuleBrowser* browser; float zoom; - void onAction(const event::Action& e) override; + void onAction(const ActionEvent& e) override; void step() override { rightText = CHECKMARK(settings::moduleBrowserZoom == zoom); MenuItem::step(); @@ -391,7 +391,7 @@ struct ZoomItem : ui::MenuItem { struct ZoomButton : ui::ChoiceButton { ModuleBrowser* browser; - void onAction(const event::Action& e) override { + void onAction(const ActionEvent& e) override { ui::Menu* menu = createMenu(); menu->box.pos = getAbsoluteOffset(math::Vec(0, box.size.y)); menu->box.size.x = box.size.x; @@ -415,7 +415,7 @@ struct ZoomButton : ui::ChoiceButton { struct UrlButton : ui::Button { std::string url; - void onAction(const event::Action& e) override { + void onAction(const ActionEvent& e) override { std::thread t([=] { system::openBrowser(url); }); @@ -698,7 +698,7 @@ struct ModuleBrowser : widget::OpaqueWidget { refresh(); } - void onShow(const event::Show& e) override { + void onShow(const ShowEvent& e) override { refresh(); OpaqueWidget::onShow(e); } @@ -708,11 +708,11 @@ struct ModuleBrowser : widget::OpaqueWidget { // Implementations to resolve dependencies -inline void ClearButton::onAction(const event::Action& e) { +inline void ClearButton::onAction(const ActionEvent& e) { browser->clear(); } -inline void BrowserSearchField::onSelectKey(const event::SelectKey& e) { +inline void BrowserSearchField::onSelectKey(const SelectKeyEvent& e) { if (e.action == GLFW_PRESS || e.action == GLFW_REPEAT) { if (e.key == GLFW_KEY_ESCAPE) { BrowserOverlay* overlay = browser->getAncestorOfType(); @@ -732,12 +732,12 @@ inline void BrowserSearchField::onSelectKey(const event::SelectKey& e) { ui::TextField::onSelectKey(e); } -inline void BrowserSearchField::onChange(const event::Change& e) { +inline void BrowserSearchField::onChange(const ChangeEvent& e) { browser->search = string::trim(text); browser->refresh(); } -inline void BrowserSearchField::onAction(const event::Action& e) { +inline void BrowserSearchField::onAction(const ActionEvent& e) { // Get first ModelBox ModelBox* mb = NULL; for (Widget* w : browser->modelContainer->children) { @@ -752,7 +752,7 @@ inline void BrowserSearchField::onAction(const event::Action& e) { } } -inline void BrandItem::onAction(const event::Action& e) { +inline void BrandItem::onAction(const ActionEvent& e) { if (browser->brand == brand) browser->brand = ""; else @@ -765,7 +765,7 @@ inline void BrandItem::step() { MenuItem::step(); } -inline void BrandButton::onAction(const event::Action& e) { +inline void BrandButton::onAction(const ActionEvent& e) { ui::Menu* menu = createMenu(); menu->box.pos = getAbsoluteOffset(math::Vec(0, box.size.y)); menu->box.size.x = box.size.x; @@ -804,7 +804,7 @@ inline void BrandButton::step() { ChoiceButton::step(); } -inline void TagItem::onAction(const event::Action& e) { +inline void TagItem::onAction(const ActionEvent& e) { auto it = browser->tagIds.find(tagId); bool isSelected = (it != browser->tagIds.end()); @@ -849,7 +849,7 @@ inline void TagItem::step() { MenuItem::step(); } -inline void TagButton::onAction(const event::Action& e) { +inline void TagButton::onAction(const ActionEvent& e) { ui::Menu* menu = createMenu(); menu->box.pos = getAbsoluteOffset(math::Vec(0, box.size.y)); menu->box.size.x = box.size.x; @@ -889,12 +889,12 @@ inline void TagButton::step() { ChoiceButton::step(); } -inline void SortItem::onAction(const event::Action& e) { +inline void SortItem::onAction(const ActionEvent& e) { settings::moduleBrowserSort = sort; browser->refresh(); } -inline void ZoomItem::onAction(const event::Action& e) { +inline void ZoomItem::onAction(const ActionEvent& e) { if (zoom != settings::moduleBrowserZoom) { settings::moduleBrowserZoom = zoom; browser->updateZoom(); diff --git a/src/app/ModuleLightWidget.cpp b/src/app/ModuleLightWidget.cpp index 2a99cb59..ed460f91 100644 --- a/src/app/ModuleLightWidget.cpp +++ b/src/app/ModuleLightWidget.cpp @@ -118,7 +118,7 @@ void ModuleLightWidget::step() { } -void ModuleLightWidget::onHover(const event::Hover& e) { +void ModuleLightWidget::onHover(const HoverEvent& e) { // Adapted from OpaqueWidget::onHover() Widget::onHover(e); e.stopPropagating(); @@ -128,12 +128,12 @@ void ModuleLightWidget::onHover(const event::Hover& e) { } -void ModuleLightWidget::onEnter(const event::Enter& e) { +void ModuleLightWidget::onEnter(const EnterEvent& e) { createTooltip(); } -void ModuleLightWidget::onLeave(const event::Leave& e) { +void ModuleLightWidget::onLeave(const LeaveEvent& e) { destroyTooltip(); } diff --git a/src/app/ModuleWidget.cpp b/src/app/ModuleWidget.cpp index 22cc8b01..79e36b6f 100644 --- a/src/app/ModuleWidget.cpp +++ b/src/app/ModuleWidget.cpp @@ -28,7 +28,7 @@ static const char PRESET_FILTERS[] = "VCV Rack module preset (.vcvm):vcvm"; struct ModuleUrlItem : ui::MenuItem { std::string url; - void onAction(const event::Action& e) override { + void onAction(const ActionEvent& e) override { std::thread t(system::openBrowser, url); t.detach(); } @@ -37,7 +37,7 @@ struct ModuleUrlItem : ui::MenuItem { struct ModuleFolderItem : ui::MenuItem { std::string path; - void onAction(const event::Action& e) override { + void onAction(const ActionEvent& e) override { std::thread t(system::openFolder, path); t.detach(); } @@ -160,7 +160,7 @@ struct ModuleInfoItem : ui::MenuItem { struct ModuleDisconnectItem : ui::MenuItem { WeakPtr moduleWidget; - void onAction(const event::Action& e) override { + void onAction(const ActionEvent& e) override { if (!moduleWidget) return; moduleWidget->disconnectAction(); @@ -170,7 +170,7 @@ struct ModuleDisconnectItem : ui::MenuItem { struct ModuleResetItem : ui::MenuItem { WeakPtr moduleWidget; - void onAction(const event::Action& e) override { + void onAction(const ActionEvent& e) override { if (!moduleWidget) return; moduleWidget->resetAction(); @@ -180,7 +180,7 @@ struct ModuleResetItem : ui::MenuItem { struct ModuleRandomizeItem : ui::MenuItem { WeakPtr moduleWidget; - void onAction(const event::Action& e) override { + void onAction(const ActionEvent& e) override { if (!moduleWidget) return; moduleWidget->randomizeAction(); @@ -190,7 +190,7 @@ struct ModuleRandomizeItem : ui::MenuItem { struct ModuleCopyItem : ui::MenuItem { WeakPtr moduleWidget; - void onAction(const event::Action& e) override { + void onAction(const ActionEvent& e) override { if (!moduleWidget) return; moduleWidget->copyClipboard(); @@ -200,7 +200,7 @@ struct ModuleCopyItem : ui::MenuItem { struct ModulePasteItem : ui::MenuItem { WeakPtr moduleWidget; - void onAction(const event::Action& e) override { + void onAction(const ActionEvent& e) override { if (!moduleWidget) return; moduleWidget->pasteClipboardAction(); @@ -210,7 +210,7 @@ struct ModulePasteItem : ui::MenuItem { struct ModuleSaveItem : ui::MenuItem { WeakPtr moduleWidget; - void onAction(const event::Action& e) override { + void onAction(const ActionEvent& e) override { if (!moduleWidget) return; moduleWidget->saveDialog(); @@ -220,7 +220,7 @@ struct ModuleSaveItem : ui::MenuItem { struct ModuleSaveTemplateItem : ui::MenuItem { WeakPtr moduleWidget; - void onAction(const event::Action& e) override { + void onAction(const ActionEvent& e) override { if (!moduleWidget) return; moduleWidget->saveTemplateDialog(); @@ -230,7 +230,7 @@ struct ModuleSaveTemplateItem : ui::MenuItem { struct ModuleClearTemplateItem : ui::MenuItem { WeakPtr moduleWidget; - void onAction(const event::Action& e) override { + void onAction(const ActionEvent& e) override { if (!moduleWidget) return; moduleWidget->clearTemplateDialog(); @@ -240,7 +240,7 @@ struct ModuleClearTemplateItem : ui::MenuItem { struct ModuleLoadItem : ui::MenuItem { WeakPtr moduleWidget; - void onAction(const event::Action& e) override { + void onAction(const ActionEvent& e) override { if (!moduleWidget) return; moduleWidget->loadDialog(); @@ -251,7 +251,7 @@ struct ModuleLoadItem : ui::MenuItem { struct ModulePresetPathItem : ui::MenuItem { WeakPtr moduleWidget; std::string presetPath; - void onAction(const event::Action& e) override { + void onAction(const ActionEvent& e) override { if (!moduleWidget) return; try { @@ -348,7 +348,7 @@ struct ModulePresetItem : ui::MenuItem { struct ModuleCloneItem : ui::MenuItem { WeakPtr moduleWidget; - void onAction(const event::Action& e) override { + void onAction(const ActionEvent& e) override { if (!moduleWidget) return; moduleWidget->cloneAction(); @@ -358,7 +358,7 @@ struct ModuleCloneItem : ui::MenuItem { struct ModuleBypassItem : ui::MenuItem { WeakPtr moduleWidget; - void onAction(const event::Action& e) override { + void onAction(const ActionEvent& e) override { if (!moduleWidget) return; moduleWidget->bypassAction(); @@ -368,7 +368,7 @@ struct ModuleBypassItem : ui::MenuItem { struct ModuleDeleteItem : ui::MenuItem { WeakPtr moduleWidget; - void onAction(const event::Action& e) override { + void onAction(const ActionEvent& e) override { if (!moduleWidget) return; moduleWidget->removeAction(); @@ -500,7 +500,7 @@ void ModuleWidget::drawShadow(const DrawArgs& args) { nvgFill(args.vg); } -void ModuleWidget::onButton(const event::Button& e) { +void ModuleWidget::onButton(const ButtonEvent& e) { // Don't consume left button if `lockModules` is enabled. if (settings::lockModules) Widget::onButton(e); @@ -521,7 +521,7 @@ void ModuleWidget::onButton(const event::Button& e) { } } -void ModuleWidget::onHoverKey(const event::HoverKey& e) { +void ModuleWidget::onHoverKey(const HoverKeyEvent& e) { OpaqueWidget::onHoverKey(e); if (e.isConsumed()) return; @@ -565,7 +565,7 @@ void ModuleWidget::onHoverKey(const event::HoverKey& e) { } } -void ModuleWidget::onDragStart(const event::DragStart& e) { +void ModuleWidget::onDragStart(const DragStartEvent& e) { if (e.button == GLFW_MOUSE_BUTTON_LEFT) { // Clear dragRack so dragging in not enabled until mouse is moved a bit. internal->dragRackPos = math::Vec(NAN, NAN); @@ -575,7 +575,7 @@ void ModuleWidget::onDragStart(const event::DragStart& e) { } } -void ModuleWidget::onDragEnd(const event::DragEnd& e) { +void ModuleWidget::onDragEnd(const DragEndEvent& e) { if (e.button == GLFW_MOUSE_BUTTON_LEFT) { // The next time the module is dragged, it should always move immediately internal->dragEnabled = true; @@ -587,7 +587,7 @@ void ModuleWidget::onDragEnd(const event::DragEnd& e) { } } -void ModuleWidget::onDragMove(const event::DragMove& e) { +void ModuleWidget::onDragMove(const DragMoveEvent& e) { if (e.button == GLFW_MOUSE_BUTTON_LEFT) { if (!settings::lockModules) { math::Vec mousePos = APP->scene->rack->mousePos; diff --git a/src/app/ParamWidget.cpp b/src/app/ParamWidget.cpp index 4dcb5e17..92ab4dea 100644 --- a/src/app/ParamWidget.cpp +++ b/src/app/ParamWidget.cpp @@ -31,7 +31,7 @@ struct ParamField : ui::TextField { selectAll(); } - void onSelectKey(const event::SelectKey& e) override { + void onSelectKey(const SelectKeyEvent& e) override { if (e.action == GLFW_PRESS && (e.key == GLFW_KEY_ENTER || e.key == GLFW_KEY_KP_ENTER)) { engine::ParamQuantity* pq = paramWidget->getParamQuantity(); assert(pq); @@ -65,7 +65,7 @@ struct ParamValueItem : ui::MenuItem { ParamWidget* paramWidget; float value; - void onAction(const event::Action& e) override { + void onAction(const ActionEvent& e) override { engine::ParamQuantity* pq = paramWidget->getParamQuantity(); if (pq) { float oldValue = pq->getValue(); @@ -124,7 +124,7 @@ struct ParamLabel : ui::MenuLabel { struct ParamResetItem : ui::MenuItem { ParamWidget* paramWidget; - void onAction(const event::Action& e) override { + void onAction(const ActionEvent& e) override { paramWidget->resetAction(); } }; @@ -136,7 +136,7 @@ struct ParamFineItem : ui::MenuItem { struct ParamUnmapItem : ui::MenuItem { ParamWidget* paramWidget; - void onAction(const event::Action& e) override { + void onAction(const ActionEvent& e) override { engine::ParamHandle* paramHandle = APP->engine->getParamHandle(paramWidget->module->id, paramWidget->paramId); if (paramHandle) { APP->engine->updateParamHandle(paramHandle, -1, 0); @@ -178,7 +178,7 @@ void ParamWidget::step() { float value = pq->getSmoothValue(); // Trigger change event when the ParamQuantity value changes if (value != lastValue) { - event::Change eChange; + ChangeEvent eChange; onChange(eChange); lastValue = value; } @@ -206,7 +206,7 @@ void ParamWidget::draw(const DrawArgs& args) { } } -void ParamWidget::onButton(const event::Button& e) { +void ParamWidget::onButton(const ButtonEvent& e) { OpaqueWidget::onButton(e); // Touch parameter @@ -225,15 +225,15 @@ void ParamWidget::onButton(const event::Button& e) { } } -void ParamWidget::onDoubleClick(const event::DoubleClick& e) { +void ParamWidget::onDoubleClick(const DoubleClickEvent& e) { resetAction(); } -void ParamWidget::onEnter(const event::Enter& e) { +void ParamWidget::onEnter(const EnterEvent& e) { createTooltip(); } -void ParamWidget::onLeave(const event::Leave& e) { +void ParamWidget::onLeave(const LeaveEvent& e) { destroyTooltip(); } diff --git a/src/app/PortWidget.cpp b/src/app/PortWidget.cpp index 4c880ade..bca02c5d 100644 --- a/src/app/PortWidget.cpp +++ b/src/app/PortWidget.cpp @@ -153,7 +153,7 @@ void PortWidget::draw(const DrawArgs& args) { Widget::draw(args); } -void PortWidget::onButton(const event::Button& e) { +void PortWidget::onButton(const ButtonEvent& e) { OpaqueWidget::onButton(e); if (e.action == GLFW_PRESS && e.button == GLFW_MOUSE_BUTTON_RIGHT) { @@ -172,15 +172,15 @@ void PortWidget::onButton(const event::Button& e) { } } -void PortWidget::onEnter(const event::Enter& e) { +void PortWidget::onEnter(const EnterEvent& e) { createTooltip(); } -void PortWidget::onLeave(const event::Leave& e) { +void PortWidget::onLeave(const LeaveEvent& e) { destroyTooltip(); } -void PortWidget::onDragStart(const event::DragStart& e) { +void PortWidget::onDragStart(const DragStartEvent& e) { if (e.button != GLFW_MOUSE_BUTTON_LEFT) return; @@ -235,7 +235,7 @@ void PortWidget::onDragStart(const event::DragStart& e) { APP->scene->rack->setIncompleteCable(cw); } -void PortWidget::onDragEnd(const event::DragEnd& e) { +void PortWidget::onDragEnd(const DragEndEvent& e) { if (e.button != GLFW_MOUSE_BUTTON_LEFT) return; @@ -256,7 +256,7 @@ void PortWidget::onDragEnd(const event::DragEnd& e) { } } -void PortWidget::onDragDrop(const event::DragDrop& e) { +void PortWidget::onDragDrop(const DragDropEvent& e) { // HACK: Only delete tooltip if we're not (normal) dragging it. if (e.origin == this) createTooltip(); @@ -281,7 +281,7 @@ void PortWidget::onDragDrop(const event::DragDrop& e) { } } -void PortWidget::onDragEnter(const event::DragEnter& e) { +void PortWidget::onDragEnter(const DragEnterEvent& e) { PortWidget* pw = dynamic_cast(e.origin); if (pw) { createTooltip(); @@ -305,7 +305,7 @@ void PortWidget::onDragEnter(const event::DragEnter& e) { } } -void PortWidget::onDragLeave(const event::DragLeave& e) { +void PortWidget::onDragLeave(const DragLeaveEvent& e) { destroyTooltip(); if (e.button != GLFW_MOUSE_BUTTON_LEFT) diff --git a/src/app/RackScrollWidget.cpp b/src/app/RackScrollWidget.cpp index 7837c73b..e4a95c86 100644 --- a/src/app/RackScrollWidget.cpp +++ b/src/app/RackScrollWidget.cpp @@ -91,7 +91,7 @@ void RackScrollWidget::draw(const DrawArgs& args) { } -void RackScrollWidget::onHoverKey(const event::HoverKey& e) { +void RackScrollWidget::onHoverKey(const HoverKeyEvent& e) { ScrollWidget::onHoverKey(e); if (e.isConsumed()) return; @@ -126,7 +126,7 @@ void RackScrollWidget::onHoverKey(const event::HoverKey& e) { } -void RackScrollWidget::onHoverScroll(const event::HoverScroll& e) { +void RackScrollWidget::onHoverScroll(const HoverScrollEvent& e) { ScrollWidget::onHoverScroll(e); if (e.isConsumed()) return; @@ -143,7 +143,7 @@ void RackScrollWidget::onHoverScroll(const event::HoverScroll& e) { } -void RackScrollWidget::onHover(const event::Hover& e) { +void RackScrollWidget::onHover(const HoverEvent& e) { ScrollWidget::onHover(e); // Hide menu bar if fullscreen and moving mouse over the RackScrollWidget diff --git a/src/app/RackWidget.cpp b/src/app/RackWidget.cpp index ca024987..97f13b3a 100644 --- a/src/app/RackWidget.cpp +++ b/src/app/RackWidget.cpp @@ -112,13 +112,13 @@ void RackWidget::draw(const DrawArgs& args) { Widget::draw(args); } -void RackWidget::onHover(const event::Hover& e) { +void RackWidget::onHover(const HoverEvent& e) { // Set before calling children's onHover() mousePos = e.pos; OpaqueWidget::onHover(e); } -void RackWidget::onHoverKey(const event::HoverKey& e) { +void RackWidget::onHoverKey(const HoverKeyEvent& e) { OpaqueWidget::onHoverKey(e); if (e.isConsumed()) return; @@ -131,13 +131,13 @@ void RackWidget::onHoverKey(const event::HoverKey& e) { } } -void RackWidget::onDragHover(const event::DragHover& e) { +void RackWidget::onDragHover(const DragHoverEvent& e) { // Set before calling children's onDragHover() mousePos = e.pos; OpaqueWidget::onDragHover(e); } -void RackWidget::onButton(const event::Button& e) { +void RackWidget::onButton(const ButtonEvent& e) { Widget::onButton(e); e.stopPropagating(); if (e.isConsumed()) diff --git a/src/app/Scene.cpp b/src/app/Scene.cpp index c801b3b4..a32395ee 100644 --- a/src/app/Scene.cpp +++ b/src/app/Scene.cpp @@ -94,7 +94,7 @@ void Scene::draw(const DrawArgs& args) { Widget::draw(args); } -void Scene::onHover(const event::Hover& e) { +void Scene::onHover(const HoverEvent& e) { mousePos = e.pos; if (mousePos.y < menuBar->box.size.y) { menuBar->show(); @@ -102,12 +102,12 @@ void Scene::onHover(const event::Hover& e) { OpaqueWidget::onHover(e); } -void Scene::onDragHover(const event::DragHover& e) { +void Scene::onDragHover(const DragHoverEvent& e) { mousePos = e.pos; OpaqueWidget::onDragHover(e); } -void Scene::onHoverKey(const event::HoverKey& e) { +void Scene::onHoverKey(const HoverKeyEvent& e) { OpaqueWidget::onHoverKey(e); if (e.isConsumed()) return; @@ -197,7 +197,7 @@ void Scene::onHoverKey(const event::HoverKey& e) { } } -void Scene::onPathDrop(const event::PathDrop& e) { +void Scene::onPathDrop(const PathDropEvent& e) { if (e.paths.size() >= 1) { const std::string& path = e.paths[0]; if (system::getExtension(path) == ".vcv") { diff --git a/src/app/SliderKnob.cpp b/src/app/SliderKnob.cpp index eddf48d0..6b2f4d8a 100644 --- a/src/app/SliderKnob.cpp +++ b/src/app/SliderKnob.cpp @@ -9,12 +9,12 @@ SliderKnob::SliderKnob() { forceLinear = true; } -void SliderKnob::onHover(const event::Hover& e) { +void SliderKnob::onHover(const HoverEvent& e) { // Bypass Knob's circular hitbox detection ParamWidget::onHover(e); } -void SliderKnob::onButton(const event::Button& e) { +void SliderKnob::onButton(const ButtonEvent& e) { ParamWidget::onButton(e); } diff --git a/src/app/SvgButton.cpp b/src/app/SvgButton.cpp index 2919d93b..440315d5 100644 --- a/src/app/SvgButton.cpp +++ b/src/app/SvgButton.cpp @@ -30,7 +30,7 @@ void SvgButton::addFrame(std::shared_ptr svg) { } } -void SvgButton::onDragStart(const event::DragStart& e) { +void SvgButton::onDragStart(const DragStartEvent& e) { if (e.button != GLFW_MOUSE_BUTTON_LEFT) return; @@ -40,16 +40,16 @@ void SvgButton::onDragStart(const event::DragStart& e) { } } -void SvgButton::onDragEnd(const event::DragEnd& e) { +void SvgButton::onDragEnd(const DragEndEvent& e) { if (frames.size() >= 1) { sw->setSvg(frames[0]); fb->dirty = true; } } -void SvgButton::onDragDrop(const event::DragDrop& e) { +void SvgButton::onDragDrop(const DragDropEvent& e) { if (e.origin == this) { - event::Action eAction; + ActionEvent eAction; onAction(eAction); } } diff --git a/src/app/SvgKnob.cpp b/src/app/SvgKnob.cpp index 45a68174..72a7073e 100644 --- a/src/app/SvgKnob.cpp +++ b/src/app/SvgKnob.cpp @@ -31,7 +31,7 @@ void SvgKnob::setSvg(std::shared_ptr svg) { // shadow->box = shadow->box.grow(math::Vec(2, 2)); } -void SvgKnob::onChange(const event::Change& e) { +void SvgKnob::onChange(const ChangeEvent& e) { // Re-transform the widget::TransformWidget engine::ParamQuantity* pq = getParamQuantity(); if (pq) { diff --git a/src/app/SvgSlider.cpp b/src/app/SvgSlider.cpp index 5c1930d2..c50d0ac1 100644 --- a/src/app/SvgSlider.cpp +++ b/src/app/SvgSlider.cpp @@ -30,7 +30,7 @@ void SvgSlider::setHandleSvg(std::shared_ptr svg) { fb->dirty = true; } -void SvgSlider::onChange(const event::Change& e) { +void SvgSlider::onChange(const ChangeEvent& e) { engine::ParamQuantity* pq = getParamQuantity(); if (pq) { // Interpolate handle position diff --git a/src/app/SvgSwitch.cpp b/src/app/SvgSwitch.cpp index f0d07129..c1d5c0e4 100644 --- a/src/app/SvgSwitch.cpp +++ b/src/app/SvgSwitch.cpp @@ -30,7 +30,7 @@ void SvgSwitch::addFrame(std::shared_ptr svg) { } } -void SvgSwitch::onChange(const event::Change& e) { +void SvgSwitch::onChange(const ChangeEvent& e) { engine::ParamQuantity* pq = getParamQuantity(); if (!frames.empty() && pq) { int index = (int) std::round(pq->getValue() - pq->getMinValue()); diff --git a/src/app/Switch.cpp b/src/app/Switch.cpp index 961b1439..b6729d00 100644 --- a/src/app/Switch.cpp +++ b/src/app/Switch.cpp @@ -37,11 +37,11 @@ void Switch::step() { ParamWidget::step(); } -void Switch::onDoubleClick(const event::DoubleClick& e) { +void Switch::onDoubleClick(const DoubleClickEvent& e) { // Don't reset parameter on double-click } -void Switch::onDragStart(const event::DragStart& e) { +void Switch::onDragStart(const DragStartEvent& e) { if (e.button != GLFW_MOUSE_BUTTON_LEFT) return; @@ -80,7 +80,7 @@ void Switch::onDragStart(const event::DragStart& e) { } } -void Switch::onDragEnd(const event::DragEnd& e) { +void Switch::onDragEnd(const DragEndEvent& e) { if (e.button != GLFW_MOUSE_BUTTON_LEFT) return; diff --git a/src/app/TipWindow.cpp b/src/app/TipWindow.cpp index 6e96315b..c9756a2b 100644 --- a/src/app/TipWindow.cpp +++ b/src/app/TipWindow.cpp @@ -18,7 +18,7 @@ namespace app { struct UrlButton : ui::Button { std::string url; - void onAction(const event::Action& e) override { + void onAction(const ActionEvent& e) override { std::thread t([=] { system::openBrowser(url); }); @@ -108,7 +108,7 @@ struct TipWindow : widget::OpaqueWidget { struct PreviousButton : ui::Button { TipWindow* tipWindow; - void onAction(const event::Action& e) override { + void onAction(const ActionEvent& e) override { tipWindow->advanceTip(-1); } }; @@ -120,7 +120,7 @@ struct TipWindow : widget::OpaqueWidget { struct NextButton : ui::Button { TipWindow* tipWindow; - void onAction(const event::Action& e) override { + void onAction(const ActionEvent& e) override { tipWindow->advanceTip(); } }; @@ -132,7 +132,7 @@ struct TipWindow : widget::OpaqueWidget { struct CloseButton : ui::Button { TipWindow* tipWindow; - void onAction(const event::Action& e) override { + void onAction(const ActionEvent& e) override { tipWindow->getParent()->requestDelete(); } }; diff --git a/src/core/AudioInterface.cpp b/src/core/AudioInterface.cpp index b59d1b14..57b64e29 100644 --- a/src/core/AudioInterface.cpp +++ b/src/core/AudioInterface.cpp @@ -562,7 +562,7 @@ struct AudioInterfaceWidget : ModuleWidget { struct PrimaryModuleItem : MenuItem { TAudioInterface* module; - void onAction(const event::Action& e) override { + void onAction(const ActionEvent& e) override { module->setPrimary(); } }; @@ -575,7 +575,7 @@ struct AudioInterfaceWidget : ModuleWidget { struct DCFilterItem : MenuItem { TAudioInterface* module; - void onAction(const event::Action& e) override { + void onAction(const ActionEvent& e) override { module->dcFilterEnabled ^= true; } }; diff --git a/src/core/Blank.cpp b/src/core/Blank.cpp index 17c30732..c0d8fe92 100644 --- a/src/core/Blank.cpp +++ b/src/core/Blank.cpp @@ -64,7 +64,7 @@ struct ModuleResizeHandle : OpaqueWidget { box.size = Vec(RACK_GRID_WIDTH * 1, RACK_GRID_HEIGHT); } - void onDragStart(const event::DragStart& e) override { + void onDragStart(const DragStartEvent& e) override { if (e.button != GLFW_MOUSE_BUTTON_LEFT) return; @@ -74,7 +74,7 @@ struct ModuleResizeHandle : OpaqueWidget { originalBox = mw->box; } - void onDragMove(const event::DragMove& e) override { + void onDragMove(const DragMoveEvent& e) override { ModuleWidget* mw = getAncestorOfType(); assert(mw); diff --git a/src/core/CV_Gate.cpp b/src/core/CV_Gate.cpp index c04efcdd..609d5b87 100644 --- a/src/core/CV_Gate.cpp +++ b/src/core/CV_Gate.cpp @@ -164,7 +164,7 @@ struct CV_Gate : Module { struct CV_GateVelocityItem : MenuItem { CV_Gate* module; - void onAction(const event::Action& e) override { + void onAction(const ActionEvent& e) override { module->velocityMode ^= true; } }; @@ -172,7 +172,7 @@ struct CV_GateVelocityItem : MenuItem { struct CV_GatePanicItem : MenuItem { CV_Gate* module; - void onAction(const event::Action& e) override { + void onAction(const ActionEvent& e) override { module->midiOutput.panic(); } }; diff --git a/src/core/CV_MIDI.cpp b/src/core/CV_MIDI.cpp index f7bd0c4d..39e0945d 100644 --- a/src/core/CV_MIDI.cpp +++ b/src/core/CV_MIDI.cpp @@ -140,7 +140,7 @@ struct CV_MIDI : Module { struct CV_MIDIPanicItem : MenuItem { CV_MIDI* module; - void onAction(const event::Action& e) override { + void onAction(const ActionEvent& e) override { module->midiOutput.panic(); } }; diff --git a/src/core/MIDI_CC.cpp b/src/core/MIDI_CC.cpp index 5b9c409a..26911d79 100644 --- a/src/core/MIDI_CC.cpp +++ b/src/core/MIDI_CC.cpp @@ -255,7 +255,7 @@ struct MIDI_CCWidget : ModuleWidget { struct SmoothItem : MenuItem { MIDI_CC* module; - void onAction(const event::Action& e) override { + void onAction(const ActionEvent& e) override { module->smooth ^= true; } }; @@ -268,7 +268,7 @@ struct MIDI_CCWidget : ModuleWidget { struct MpeModeItem : MenuItem { MIDI_CC* module; - void onAction(const event::Action& e) override { + void onAction(const ActionEvent& e) override { module->mpeMode ^= true; } }; @@ -281,7 +281,7 @@ struct MIDI_CCWidget : ModuleWidget { struct LSBItem : MenuItem { MIDI_CC* module; - void onAction(const event::Action& e) override { + void onAction(const ActionEvent& e) override { module->lsbEnabled ^= true; } }; diff --git a/src/core/MIDI_CV.cpp b/src/core/MIDI_CV.cpp index 22372f6e..245408d7 100644 --- a/src/core/MIDI_CV.cpp +++ b/src/core/MIDI_CV.cpp @@ -515,7 +515,7 @@ struct MIDI_CVWidget : ModuleWidget { struct SmoothItem : MenuItem { MIDI_CV* module; - void onAction(const event::Action& e) override { + void onAction(const ActionEvent& e) override { module->smooth ^= true; } }; @@ -529,7 +529,7 @@ struct MIDI_CVWidget : ModuleWidget { struct ClockDivisionValueItem : MenuItem { MIDI_CV* module; int clockDivision; - void onAction(const event::Action& e) override { + void onAction(const ActionEvent& e) override { module->clockDivision = clockDivision; } }; @@ -561,7 +561,7 @@ struct MIDI_CVWidget : ModuleWidget { struct ChannelValueItem : MenuItem { MIDI_CV* module; int channels; - void onAction(const event::Action& e) override { + void onAction(const ActionEvent& e) override { module->setChannels(channels); } }; @@ -594,7 +594,7 @@ struct MIDI_CVWidget : ModuleWidget { struct PolyModeValueItem : MenuItem { MIDI_CV* module; MIDI_CV::PolyMode polyMode; - void onAction(const event::Action& e) override { + void onAction(const ActionEvent& e) override { module->setPolyMode(polyMode); } }; @@ -630,7 +630,7 @@ struct MIDI_CVWidget : ModuleWidget { struct PanicItem : MenuItem { MIDI_CV* module; - void onAction(const event::Action& e) override { + void onAction(const ActionEvent& e) override { module->panic(); } }; diff --git a/src/core/MIDI_Gate.cpp b/src/core/MIDI_Gate.cpp index 50801bd5..31c64c66 100644 --- a/src/core/MIDI_Gate.cpp +++ b/src/core/MIDI_Gate.cpp @@ -183,7 +183,7 @@ struct MIDI_Gate : Module { struct MIDI_GateVelocityItem : MenuItem { MIDI_Gate* module; - void onAction(const event::Action& e) override { + void onAction(const ActionEvent& e) override { module->velocityMode ^= true; } }; @@ -191,7 +191,7 @@ struct MIDI_GateVelocityItem : MenuItem { struct MIDI_GateMpeModeItem : MenuItem { MIDI_Gate* module; - void onAction(const event::Action& e) override { + void onAction(const ActionEvent& e) override { module->mpeMode ^= true; } }; @@ -199,7 +199,7 @@ struct MIDI_GateMpeModeItem : MenuItem { struct MIDI_GatePanicItem : MenuItem { MIDI_Gate* module; - void onAction(const event::Action& e) override { + void onAction(const ActionEvent& e) override { module->panic(); } }; diff --git a/src/core/MIDI_Map.cpp b/src/core/MIDI_Map.cpp index 3ea2cfaf..c3ad9c37 100644 --- a/src/core/MIDI_Map.cpp +++ b/src/core/MIDI_Map.cpp @@ -301,7 +301,7 @@ struct MIDI_MapChoice : LedDisplayChoice { this->module = module; } - void onButton(const event::Button& e) override { + void onButton(const ButtonEvent& e) override { e.stopPropagating(); if (!module) return; @@ -316,7 +316,7 @@ struct MIDI_MapChoice : LedDisplayChoice { } } - void onSelect(const event::Select& e) override { + void onSelect(const SelectEvent& e) override { if (!module) return; @@ -328,7 +328,7 @@ struct MIDI_MapChoice : LedDisplayChoice { module->enableLearn(id); } - void onDeselect(const event::Deselect& e) override { + void onDeselect(const DeselectEvent& e) override { if (!module) return; // Check if a ParamWidget was touched @@ -498,7 +498,7 @@ struct MIDI_MapWidget : ModuleWidget { struct SmoothItem : MenuItem { MIDI_Map* module; - void onAction(const event::Action& e) override { + void onAction(const ActionEvent& e) override { module->smooth ^= true; } }; diff --git a/src/core/Notes.cpp b/src/core/Notes.cpp index e0e20f06..616c43e6 100644 --- a/src/core/Notes.cpp +++ b/src/core/Notes.cpp @@ -48,7 +48,7 @@ struct NotesTextField : LedDisplayTextField { module->dirty = false; } } - void onChange(const event::Change& e) override { + void onChange(const ChangeEvent& e) override { if (module) module->text = text; } diff --git a/src/core/plugin.hpp b/src/core/plugin.hpp index 7a447c09..dbac2b8d 100644 --- a/src/core/plugin.hpp +++ b/src/core/plugin.hpp @@ -101,7 +101,7 @@ struct CcChoice : LedDisplayChoice { text = string::f("%d", cc); } - void onSelect(const event::Select& e) override { + void onSelect(const SelectEvent& e) override { if (!module) return; module->learningId = id; @@ -109,7 +109,7 @@ struct CcChoice : LedDisplayChoice { e.consume(this); } - void onDeselect(const event::Deselect& e) override { + void onDeselect(const DeselectEvent& e) override { if (!module) return; if (module->learningId == id) { @@ -120,7 +120,7 @@ struct CcChoice : LedDisplayChoice { } } - void onSelectText(const event::SelectText& e) override { + void onSelectText(const SelectTextEvent& e) override { int c = e.codepoint; if ('0' <= c && c <= '9') { if (focusCc < 0) @@ -132,9 +132,9 @@ struct CcChoice : LedDisplayChoice { e.consume(this); } - void onSelectKey(const event::SelectKey& e) override { + void onSelectKey(const SelectKeyEvent& e) override { if ((e.key == GLFW_KEY_ENTER || e.key == GLFW_KEY_KP_ENTER) && e.action == GLFW_PRESS && (e.mods & RACK_MOD_MASK) == 0) { - event::Deselect eDeselect; + DeselectEvent eDeselect; onDeselect(eDeselect); APP->event->selectedWidget = NULL; e.consume(this); @@ -193,7 +193,7 @@ struct NoteChoice : LedDisplayChoice { } } - void onSelect(const event::Select& e) override { + void onSelect(const SelectEvent& e) override { if (!module) return; module->learningId = id; @@ -201,7 +201,7 @@ struct NoteChoice : LedDisplayChoice { e.consume(this); } - void onDeselect(const event::Deselect& e) override { + void onDeselect(const DeselectEvent& e) override { if (!module) return; if (module->learningId == id) { @@ -212,7 +212,7 @@ struct NoteChoice : LedDisplayChoice { } } - void onSelectText(const event::SelectText& e) override { + void onSelectText(const SelectTextEvent& e) override { int c = e.codepoint; if ('a' <= c && c <= 'g') { static const int majorNotes[7] = {9, 11, 0, 2, 4, 5, 7}; @@ -234,9 +234,9 @@ struct NoteChoice : LedDisplayChoice { e.consume(this); } - void onSelectKey(const event::SelectKey& e) override { + void onSelectKey(const SelectKeyEvent& e) override { if ((e.key == GLFW_KEY_ENTER || e.key == GLFW_KEY_KP_ENTER) && e.action == GLFW_PRESS && (e.mods & RACK_MOD_MASK) == 0) { - event::Deselect eDeselect; + DeselectEvent eDeselect; onDeselect(eDeselect); APP->event->selectedWidget = NULL; e.consume(this); diff --git a/src/ui/Button.cpp b/src/ui/Button.cpp index 8450aca8..9117ac82 100644 --- a/src/ui/Button.cpp +++ b/src/ui/Button.cpp @@ -19,7 +19,7 @@ void Button::draw(const DrawArgs& args) { bndToolButton(args.vg, 0.0, 0.0, box.size.x, box.size.y, BND_CORNER_NONE, state, -1, text.c_str()); } -void Button::onDragStart(const event::DragStart& e) { +void Button::onDragStart(const DragStartEvent& e) { if (e.button != GLFW_MOUSE_BUTTON_LEFT) return; @@ -27,14 +27,14 @@ void Button::onDragStart(const event::DragStart& e) { quantity->setMax(); } -void Button::onDragEnd(const event::DragEnd& e) { +void Button::onDragEnd(const DragEndEvent& e) { if (quantity) quantity->setMin(); } -void Button::onDragDrop(const event::DragDrop& e) { +void Button::onDragDrop(const DragDropEvent& e) { if (e.origin == this) { - event::Action eAction; + ActionEvent eAction; onAction(eAction); } } diff --git a/src/ui/Menu.cpp b/src/ui/Menu.cpp index 71411a9c..57eeb573 100644 --- a/src/ui/Menu.cpp +++ b/src/ui/Menu.cpp @@ -58,7 +58,7 @@ void Menu::draw(const DrawArgs& args) { Widget::draw(args); } -void Menu::onHoverScroll(const event::HoverScroll& e) { +void Menu::onHoverScroll(const HoverScrollEvent& e) { if (parent && !parent->box.contains(box)) box.pos.y += e.scrollDelta.y; } diff --git a/src/ui/MenuItem.cpp b/src/ui/MenuItem.cpp index 688565d5..36efe52c 100644 --- a/src/ui/MenuItem.cpp +++ b/src/ui/MenuItem.cpp @@ -44,7 +44,7 @@ void MenuItem::step() { Widget::step(); } -void MenuItem::onEnter(const event::Enter& e) { +void MenuItem::onEnter(const EnterEvent& e) { Menu* parentMenu = dynamic_cast(parent); if (!parentMenu) return; @@ -60,7 +60,7 @@ void MenuItem::onEnter(const event::Enter& e) { parentMenu->setChildMenu(childMenu); } -void MenuItem::onDragDrop(const event::DragDrop& e) { +void MenuItem::onDragDrop(const DragDropEvent& e) { if (e.origin != this) return; doAction(); @@ -71,7 +71,7 @@ void MenuItem::doAction() { return; widget::EventContext cAction; - event::Action eAction; + ActionEvent eAction; eAction.context = &cAction; // Consume event by default, but allow action to un-consume it to prevent the menu from being removed. eAction.consume(this); @@ -86,7 +86,7 @@ void MenuItem::doAction() { } -void MenuItem::onAction(const event::Action& e) { +void MenuItem::onAction(const ActionEvent& e) { } diff --git a/src/ui/MenuOverlay.cpp b/src/ui/MenuOverlay.cpp index e6a3e06c..4312c4e2 100644 --- a/src/ui/MenuOverlay.cpp +++ b/src/ui/MenuOverlay.cpp @@ -24,13 +24,13 @@ void MenuOverlay::step() { } -void MenuOverlay::onButton(const event::Button& e) { +void MenuOverlay::onButton(const ButtonEvent& e) { OpaqueWidget::onButton(e); if (e.isConsumed() && e.getTarget() != this) return; if (e.action == GLFW_PRESS) { - event::Action eAction; + ActionEvent eAction; onAction(eAction); } @@ -39,13 +39,13 @@ void MenuOverlay::onButton(const event::Button& e) { } -void MenuOverlay::onHoverKey(const event::HoverKey& e) { +void MenuOverlay::onHoverKey(const HoverKeyEvent& e) { OpaqueWidget::onHoverKey(e); if (e.isConsumed()) return; if (e.action == GLFW_PRESS && e.key == GLFW_KEY_ESCAPE) { - event::Action eAction; + ActionEvent eAction; onAction(eAction); } @@ -55,7 +55,7 @@ void MenuOverlay::onHoverKey(const event::HoverKey& e) { } -void MenuOverlay::onAction(const event::Action& e) { +void MenuOverlay::onAction(const ActionEvent& e) { requestDelete(); } diff --git a/src/ui/OptionButton.cpp b/src/ui/OptionButton.cpp index d90cc49f..9ec8430b 100644 --- a/src/ui/OptionButton.cpp +++ b/src/ui/OptionButton.cpp @@ -18,12 +18,12 @@ void OptionButton::draw(const DrawArgs& args) { } -void OptionButton::onDragDrop(const event::DragDrop& e) { +void OptionButton::onDragDrop(const DragDropEvent& e) { if (e.origin == this) { if (quantity) quantity->toggle(); - event::Action eAction; + ActionEvent eAction; onAction(eAction); } } diff --git a/src/ui/RadioButton.cpp b/src/ui/RadioButton.cpp index c7fcb5b0..cfa6df43 100644 --- a/src/ui/RadioButton.cpp +++ b/src/ui/RadioButton.cpp @@ -23,7 +23,7 @@ void RadioButton::draw(const DrawArgs& args) { bndRadioButton(args.vg, 0.0, 0.0, box.size.x, box.size.y, BND_CORNER_NONE, state, -1, label.c_str()); } -void RadioButton::onDragDrop(const event::DragDrop& e) { +void RadioButton::onDragDrop(const DragDropEvent& e) { if (e.origin == this) { if (quantity) { if (quantity->isMax()) @@ -32,7 +32,7 @@ void RadioButton::onDragDrop(const event::DragDrop& e) { quantity->setMax(); } - event::Action eAction; + ActionEvent eAction; onAction(eAction); } } diff --git a/src/ui/ScrollWidget.cpp b/src/ui/ScrollWidget.cpp index 19e65545..a5baaddd 100644 --- a/src/ui/ScrollWidget.cpp +++ b/src/ui/ScrollWidget.cpp @@ -88,7 +88,7 @@ void ScrollWidget::step() { } -void ScrollWidget::onButton(const event::Button& e) { +void ScrollWidget::onButton(const ButtonEvent& e) { OpaqueWidget::onButton(e); if (e.isConsumed()) return; @@ -104,7 +104,7 @@ void ScrollWidget::onButton(const event::Button& e) { } -void ScrollWidget::onDragStart(const event::DragStart& e) { +void ScrollWidget::onDragStart(const DragStartEvent& e) { // Check if scrollable math::Rect offsetBound = getContainerOffsetBound(); if (offsetBound.size.x <= 0.f && offsetBound.size.y <= 0.f) @@ -116,7 +116,7 @@ void ScrollWidget::onDragStart(const event::DragStart& e) { } -void ScrollWidget::onDragMove(const event::DragMove& e) { +void ScrollWidget::onDragMove(const DragMoveEvent& e) { if (e.button == GLFW_MOUSE_BUTTON_LEFT || e.button == GLFW_MOUSE_BUTTON_MIDDLE) { math::Vec offsetDelta = e.mouseDelta.div(getAbsoluteZoom()); offset = offset.minus(offsetDelta); @@ -124,7 +124,7 @@ void ScrollWidget::onDragMove(const event::DragMove& e) { } -void ScrollWidget::onHoverScroll(const event::HoverScroll& e) { +void ScrollWidget::onHoverScroll(const HoverScrollEvent& e) { OpaqueWidget::onHoverScroll(e); if (e.isConsumed()) return; @@ -152,7 +152,7 @@ void ScrollWidget::onHoverScroll(const event::HoverScroll& e) { } -void ScrollWidget::onHoverKey(const event::HoverKey& e) { +void ScrollWidget::onHoverKey(const HoverKeyEvent& e) { OpaqueWidget::onHoverKey(e); if (e.isConsumed()) return; diff --git a/src/ui/Scrollbar.cpp b/src/ui/Scrollbar.cpp index 39e51d3c..0e6f6ea9 100644 --- a/src/ui/Scrollbar.cpp +++ b/src/ui/Scrollbar.cpp @@ -36,7 +36,7 @@ void Scrollbar::draw(const DrawArgs& args) { } -void Scrollbar::onButton(const event::Button& e) { +void Scrollbar::onButton(const ButtonEvent& e) { if (e.button == GLFW_MOUSE_BUTTON_LEFT && e.action == GLFW_PRESS) { ScrollWidget* sw = dynamic_cast(parent); assert(sw); @@ -58,15 +58,15 @@ void Scrollbar::onButton(const event::Button& e) { } -void Scrollbar::onDragStart(const event::DragStart& e) { +void Scrollbar::onDragStart(const DragStartEvent& e) { } -void Scrollbar::onDragEnd(const event::DragEnd& e) { +void Scrollbar::onDragEnd(const DragEndEvent& e) { } -void Scrollbar::onDragMove(const event::DragMove& e) { +void Scrollbar::onDragMove(const DragMoveEvent& e) { ScrollWidget* sw = dynamic_cast(parent); assert(sw); diff --git a/src/ui/Slider.cpp b/src/ui/Slider.cpp index ee667ccc..32fc09d3 100644 --- a/src/ui/Slider.cpp +++ b/src/ui/Slider.cpp @@ -24,24 +24,24 @@ void Slider::draw(const DrawArgs& args) { bndSlider(args.vg, 0.0, 0.0, box.size.x, box.size.y, BND_CORNER_NONE, state, progress, text.c_str(), NULL); } -void Slider::onDragStart(const event::DragStart& e) { +void Slider::onDragStart(const DragStartEvent& e) { if (e.button != GLFW_MOUSE_BUTTON_LEFT) return; APP->window->cursorLock(); } -void Slider::onDragMove(const event::DragMove& e) { +void Slider::onDragMove(const DragMoveEvent& e) { if (quantity) { quantity->moveScaledValue(SENSITIVITY * e.mouseDelta.x); } } -void Slider::onDragEnd(const event::DragEnd& e) { +void Slider::onDragEnd(const DragEndEvent& e) { APP->window->cursorUnlock(); } -void Slider::onDoubleClick(const event::DoubleClick& e) { +void Slider::onDoubleClick(const DoubleClickEvent& e) { if (quantity) quantity->reset(); } diff --git a/src/ui/TextField.cpp b/src/ui/TextField.cpp index a9ceb914..004c2ce1 100644 --- a/src/ui/TextField.cpp +++ b/src/ui/TextField.cpp @@ -9,7 +9,7 @@ namespace ui { struct TextFieldCopyItem : ui::MenuItem { WeakPtr textField; - void onAction(const event::Action& e) override { + void onAction(const ActionEvent& e) override { if (!textField) return; textField->copyClipboard(); @@ -20,7 +20,7 @@ struct TextFieldCopyItem : ui::MenuItem { struct TextFieldCutItem : ui::MenuItem { WeakPtr textField; - void onAction(const event::Action& e) override { + void onAction(const ActionEvent& e) override { if (!textField) return; textField->cutClipboard(); @@ -31,7 +31,7 @@ struct TextFieldCutItem : ui::MenuItem { struct TextFieldPasteItem : ui::MenuItem { WeakPtr textField; - void onAction(const event::Action& e) override { + void onAction(const ActionEvent& e) override { if (!textField) return; textField->pasteClipboard(); @@ -42,7 +42,7 @@ struct TextFieldPasteItem : ui::MenuItem { struct TextFieldSelectAllItem : ui::MenuItem { WeakPtr textField; - void onAction(const event::Action& e) override { + void onAction(const ActionEvent& e) override { if (!textField) return; textField->selectAll(); @@ -77,7 +77,7 @@ void TextField::draw(const DrawArgs& args) { nvgResetScissor(args.vg); } -void TextField::onDragHover(const event::DragHover& e) { +void TextField::onDragHover(const DragHoverEvent& e) { OpaqueWidget::onDragHover(e); if (e.origin == this) { @@ -86,7 +86,7 @@ void TextField::onDragHover(const event::DragHover& e) { } } -void TextField::onButton(const event::Button& e) { +void TextField::onButton(const ButtonEvent& e) { OpaqueWidget::onButton(e); if (e.action == GLFW_PRESS && e.button == GLFW_MOUSE_BUTTON_LEFT) { @@ -99,7 +99,7 @@ void TextField::onButton(const event::Button& e) { } } -void TextField::onSelectText(const event::SelectText& e) { +void TextField::onSelectText(const SelectTextEvent& e) { if (e.codepoint < 128) { std::string newText(1, (char) e.codepoint); insertText(newText); @@ -107,7 +107,7 @@ void TextField::onSelectText(const event::SelectText& e) { e.consume(this); } -void TextField::onSelectKey(const event::SelectKey& e) { +void TextField::onSelectKey(const SelectKeyEvent& e) { if (e.action == GLFW_PRESS || e.action == GLFW_REPEAT) { // Backspace if (e.key == GLFW_KEY_BACKSPACE && (e.mods & RACK_MOD_MASK) == 0) { @@ -213,7 +213,7 @@ void TextField::onSelectKey(const event::SelectKey& e) { insertText("\n"); } else { - event::Action eAction; + ActionEvent eAction; onAction(eAction); } e.consume(this); @@ -249,8 +249,8 @@ std::string TextField::getText() { void TextField::setText(std::string text) { if (this->text != text) { this->text = text; - // event::Change - event::Change eChange; + // ChangeEvent + ChangeEvent eChange; onChange(eChange); } selection = cursor = text.size(); @@ -284,7 +284,7 @@ void TextField::insertText(std::string text) { changed = true; } if (changed) { - event::Change eChange; + ChangeEvent eChange; onChange(eChange); } } diff --git a/src/widget/FramebufferWidget.cpp b/src/widget/FramebufferWidget.cpp index 945191e9..8ee12946 100644 --- a/src/widget/FramebufferWidget.cpp +++ b/src/widget/FramebufferWidget.cpp @@ -49,7 +49,7 @@ void FramebufferWidget::setDirty(bool dirty) { } -void FramebufferWidget::onDirty(const event::Dirty& e) { +void FramebufferWidget::onDirty(const DirtyEvent& e) { dirty = true; Widget::onDirty(e); } diff --git a/src/widget/Widget.cpp b/src/widget/Widget.cpp index d07caac6..4ab34937 100644 --- a/src/widget/Widget.cpp +++ b/src/widget/Widget.cpp @@ -36,7 +36,7 @@ void Widget::setPosition(math::Vec pos) { return; box.pos = pos; // Trigger Reposition event - event::Reposition eReposition; + RepositionEvent eReposition; onReposition(eReposition); } @@ -51,7 +51,7 @@ void Widget::setSize(math::Vec size) { return; box.size = size; // Trigger Resize event - event::Resize eResize; + ResizeEvent eResize; onResize(eResize); } @@ -72,12 +72,12 @@ void Widget::setVisible(bool visible) { this->visible = visible; if (visible) { // Trigger Show event - event::Show eShow; + ShowEvent eShow; onShow(eShow); } else { // Trigger Hide event - event::Hide eHide; + HideEvent eHide; onHide(eHide); } } @@ -151,7 +151,7 @@ void Widget::addChild(Widget* child) { child->parent = this; children.push_back(child); // Trigger Add event - event::Add eAdd; + AddEvent eAdd; child->onAdd(eAdd); } @@ -162,7 +162,7 @@ void Widget::addChildBottom(Widget* child) { child->parent = this; children.push_front(child); // Trigger Add event - event::Add eAdd; + AddEvent eAdd; child->onAdd(eAdd); } @@ -172,7 +172,7 @@ void Widget::removeChild(Widget* child) { // Make sure `this` is the child's parent assert(child->parent == this); // Trigger Remove event - event::Remove eRemove; + RemoveEvent eRemove; child->onRemove(eRemove); // Prepare to remove widget from the event state APP->event->finalizeWidget(child); @@ -188,7 +188,7 @@ void Widget::removeChild(Widget* child) { void Widget::clearChildren() { for (Widget* child : children) { // Trigger Remove event - event::Remove eRemove; + RemoveEvent eRemove; child->onRemove(eRemove); APP->event->finalizeWidget(child); child->parent = NULL; @@ -204,7 +204,7 @@ void Widget::step() { // Delete children if a delete is requested if (child->requestedDelete) { // Trigger Remove event - event::Remove eRemove; + RemoveEvent eRemove; child->onRemove(eRemove); APP->event->finalizeWidget(child); it = children.erase(it); diff --git a/src/widget/ZoomWidget.cpp b/src/widget/ZoomWidget.cpp index 2491c7e0..317663e1 100644 --- a/src/widget/ZoomWidget.cpp +++ b/src/widget/ZoomWidget.cpp @@ -34,7 +34,7 @@ void ZoomWidget::setZoom(float zoom) { // Trigger Dirty event widget::EventContext cDirty; - event::Dirty eDirty; + DirtyEvent eDirty; eDirty.context = &cDirty; Widget::onDirty(eDirty); }