Browse Source

Change `event::Foo` to `FooEvent`.

tags/v2.0.0
Andrew Belt 3 years ago
parent
commit
5484126aaa
75 changed files with 361 additions and 361 deletions
  1. +1
    -1
      include/app/AudioWidget.hpp
  2. +7
    -7
      include/app/Knob.hpp
  3. +1
    -1
      include/app/LedDisplay.hpp
  4. +1
    -1
      include/app/MidiWidget.hpp
  5. +3
    -3
      include/app/ModuleLightWidget.hpp
  6. +5
    -5
      include/app/ModuleWidget.hpp
  7. +4
    -4
      include/app/ParamWidget.hpp
  8. +8
    -8
      include/app/PortWidget.hpp
  9. +3
    -3
      include/app/RackScrollWidget.hpp
  10. +4
    -4
      include/app/RackWidget.hpp
  11. +4
    -4
      include/app/Scene.hpp
  12. +2
    -2
      include/app/SliderKnob.hpp
  13. +3
    -3
      include/app/SvgButton.hpp
  14. +1
    -1
      include/app/SvgKnob.hpp
  15. +1
    -1
      include/app/SvgSlider.hpp
  16. +1
    -1
      include/app/SvgSwitch.hpp
  17. +3
    -3
      include/app/Switch.hpp
  18. +3
    -3
      include/ui/Button.hpp
  19. +1
    -1
      include/ui/Menu.hpp
  20. +3
    -3
      include/ui/MenuItem.hpp
  21. +3
    -3
      include/ui/MenuOverlay.hpp
  22. +1
    -1
      include/ui/OptionButton.hpp
  23. +1
    -1
      include/ui/RadioButton.hpp
  24. +5
    -5
      include/ui/ScrollWidget.hpp
  25. +4
    -4
      include/ui/Scrollbar.hpp
  26. +4
    -4
      include/ui/Slider.hpp
  27. +4
    -4
      include/ui/TextField.hpp
  28. +1
    -1
      include/widget/FramebufferWidget.hpp
  29. +7
    -7
      include/widget/OpaqueWidget.hpp
  30. +7
    -7
      include/widget/TransparentWidget.hpp
  31. +1
    -1
      include/widget/Widget.hpp
  32. +14
    -14
      include/widget/ZoomWidget.hpp
  33. +10
    -10
      src/app/AudioWidget.cpp
  34. +7
    -7
      src/app/Knob.cpp
  35. +2
    -2
      src/app/LedDisplay.cpp
  36. +39
    -39
      src/app/MenuBar.cpp
  37. +7
    -7
      src/app/MidiWidget.cpp
  38. +31
    -31
      src/app/ModuleBrowser.cpp
  39. +3
    -3
      src/app/ModuleLightWidget.cpp
  40. +20
    -20
      src/app/ModuleWidget.cpp
  41. +9
    -9
      src/app/ParamWidget.cpp
  42. +8
    -8
      src/app/PortWidget.cpp
  43. +3
    -3
      src/app/RackScrollWidget.cpp
  44. +4
    -4
      src/app/RackWidget.cpp
  45. +4
    -4
      src/app/Scene.cpp
  46. +2
    -2
      src/app/SliderKnob.cpp
  47. +4
    -4
      src/app/SvgButton.cpp
  48. +1
    -1
      src/app/SvgKnob.cpp
  49. +1
    -1
      src/app/SvgSlider.cpp
  50. +1
    -1
      src/app/SvgSwitch.cpp
  51. +3
    -3
      src/app/Switch.cpp
  52. +4
    -4
      src/app/TipWindow.cpp
  53. +2
    -2
      src/core/AudioInterface.cpp
  54. +2
    -2
      src/core/Blank.cpp
  55. +2
    -2
      src/core/CV_Gate.cpp
  56. +1
    -1
      src/core/CV_MIDI.cpp
  57. +3
    -3
      src/core/MIDI_CC.cpp
  58. +5
    -5
      src/core/MIDI_CV.cpp
  59. +3
    -3
      src/core/MIDI_Gate.cpp
  60. +4
    -4
      src/core/MIDI_Map.cpp
  61. +1
    -1
      src/core/Notes.cpp
  62. +10
    -10
      src/core/plugin.hpp
  63. +4
    -4
      src/ui/Button.cpp
  64. +1
    -1
      src/ui/Menu.cpp
  65. +4
    -4
      src/ui/MenuItem.cpp
  66. +5
    -5
      src/ui/MenuOverlay.cpp
  67. +2
    -2
      src/ui/OptionButton.cpp
  68. +2
    -2
      src/ui/RadioButton.cpp
  69. +5
    -5
      src/ui/ScrollWidget.cpp
  70. +4
    -4
      src/ui/Scrollbar.cpp
  71. +4
    -4
      src/ui/Slider.cpp
  72. +12
    -12
      src/ui/TextField.cpp
  73. +1
    -1
      src/widget/FramebufferWidget.cpp
  74. +9
    -9
      src/widget/Widget.cpp
  75. +1
    -1
      src/widget/ZoomWidget.cpp

+ 1
- 1
include/app/AudioWidget.hpp View File

@@ -34,7 +34,7 @@ struct AudioDeviceWidget : LedDisplay {
struct AudioButton : SvgButton { struct AudioButton : SvgButton {
audio::Port* port; audio::Port* port;
void setAudioPort(audio::Port* port); void setAudioPort(audio::Port* port);
void onAction(const event::Action& e) override;
void onAction(const ActionEvent& e) override;
}; };






+ 7
- 7
include/app/Knob.hpp View File

@@ -30,13 +30,13 @@ struct Knob : ParamWidget {
Knob(); Knob();
~Knob(); ~Knob();
void initParamQuantity() override; 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;
}; };






+ 1
- 1
include/app/LedDisplay.hpp View File

@@ -26,7 +26,7 @@ struct LedDisplayChoice : widget::OpaqueWidget {
NVGcolor bgColor; NVGcolor bgColor;
LedDisplayChoice(); LedDisplayChoice();
void draw(const DrawArgs& args) override; void draw(const DrawArgs& args) override;
void onButton(const event::Button& e) override;
void onButton(const ButtonEvent& e) override;
}; };


struct LedDisplayTextField : ui::TextField { struct LedDisplayTextField : ui::TextField {


+ 1
- 1
include/app/MidiWidget.hpp View File

@@ -24,7 +24,7 @@ struct MidiWidget : LedDisplay {
struct MidiButton : SvgButton { struct MidiButton : SvgButton {
midi::Port* port; midi::Port* port;
void setMidiPort(midi::Port* port); void setMidiPort(midi::Port* port);
void onAction(const event::Action& e) override;
void onAction(const ActionEvent& e) override;
}; };






+ 3
- 3
include/app/ModuleLightWidget.hpp View File

@@ -25,9 +25,9 @@ struct ModuleLightWidget : MultiLightWidget {
void destroyTooltip(); void destroyTooltip();


void step() override; 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;
}; };






+ 5
- 5
include/app/ModuleWidget.hpp View File

@@ -30,11 +30,11 @@ struct ModuleWidget : widget::OpaqueWidget {
void draw(const DrawArgs& args) override; void draw(const DrawArgs& args) override;
void drawShadow(const DrawArgs& args); 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. /** Associates this ModuleWidget with the Module.
Transfers ownership. Transfers ownership.


+ 4
- 4
include/app/ParamWidget.hpp View File

@@ -30,10 +30,10 @@ struct ParamWidget : widget::OpaqueWidget {
void step() override; void step() override;
void draw(const DrawArgs& args) 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(); void createContextMenu();
virtual void appendContextMenu(ui::Menu* menu) {} virtual void appendContextMenu(ui::Menu* menu) {}


+ 8
- 8
include/app/PortWidget.hpp View File

@@ -31,14 +31,14 @@ struct PortWidget : widget::OpaqueWidget {
void step() override; void step() override;
void draw(const DrawArgs& args) 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;
}; };






+ 3
- 3
include/app/RackScrollWidget.hpp View File

@@ -20,9 +20,9 @@ struct RackScrollWidget : ui::ScrollWidget {
void reset(); void reset();
void step() override; void step() override;
void draw(const DrawArgs& args) 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;
}; };






+ 4
- 4
include/app/RackWidget.hpp View File

@@ -32,10 +32,10 @@ struct RackWidget : widget::OpaqueWidget {
void step() override; void step() override;
void draw(const DrawArgs& args) 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 */ /** Completely clear the rack's modules and cables */
void clear(); void clear();


+ 4
- 4
include/app/Scene.hpp View File

@@ -28,10 +28,10 @@ struct Scene : widget::OpaqueWidget {
~Scene(); ~Scene();
void step() override; void step() override;
void draw(const DrawArgs& args) 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;
}; };






+ 2
- 2
include/app/SliderKnob.hpp View File

@@ -10,8 +10,8 @@ namespace app {
struct SliderKnob : Knob { struct SliderKnob : Knob {
SliderKnob(); 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;
}; };






+ 3
- 3
include/app/SvgButton.hpp View File

@@ -18,9 +18,9 @@ struct SvgButton : widget::OpaqueWidget {


SvgButton(); SvgButton();
void addFrame(std::shared_ptr<Svg> svg); void addFrame(std::shared_ptr<Svg> 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;
}; };






+ 1
- 1
include/app/SvgKnob.hpp View File

@@ -23,7 +23,7 @@ struct SvgKnob : Knob {
DEPRECATED void setSVG(std::shared_ptr<Svg> svg) { DEPRECATED void setSVG(std::shared_ptr<Svg> svg) {
setSvg(svg); setSvg(svg);
} }
void onChange(const event::Change& e) override;
void onChange(const ChangeEvent& e) override;
}; };






+ 1
- 1
include/app/SvgSlider.hpp View File

@@ -22,7 +22,7 @@ struct SvgSlider : app::SliderKnob {
SvgSlider(); SvgSlider();
void setBackgroundSvg(std::shared_ptr<Svg> svg); void setBackgroundSvg(std::shared_ptr<Svg> svg);
void setHandleSvg(std::shared_ptr<Svg> svg); void setHandleSvg(std::shared_ptr<Svg> svg);
void onChange(const event::Change& e) override;
void onChange(const ChangeEvent& e) override;


DEPRECATED void setBackgroundSVG(std::shared_ptr<Svg> svg) { DEPRECATED void setBackgroundSVG(std::shared_ptr<Svg> svg) {
setBackgroundSvg(svg); setBackgroundSvg(svg);


+ 1
- 1
include/app/SvgSwitch.hpp View File

@@ -20,7 +20,7 @@ struct SvgSwitch : Switch {
SvgSwitch(); SvgSwitch();
/** Adds an SVG file to represent the next switch position */ /** Adds an SVG file to represent the next switch position */
void addFrame(std::shared_ptr<Svg> svg); void addFrame(std::shared_ptr<Svg> svg);
void onChange(const event::Change& e) override;
void onChange(const ChangeEvent& e) override;
}; };






+ 3
- 3
include/app/Switch.hpp View File

@@ -21,9 +21,9 @@ struct Switch : ParamWidget {


void initParamQuantity() override; void initParamQuantity() override;
void step() 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;
}; };






+ 3
- 3
include/ui/Button.hpp View File

@@ -15,9 +15,9 @@ struct Button : widget::OpaqueWidget {


Button(); Button();
void draw(const DrawArgs& args) override; 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;
}; };






+ 1
- 1
include/ui/Menu.hpp View File

@@ -19,7 +19,7 @@ struct Menu : widget::OpaqueWidget {
void setChildMenu(Menu* menu); void setChildMenu(Menu* menu);
void step() override; void step() override;
void draw(const DrawArgs& args) override; void draw(const DrawArgs& args) override;
void onHoverScroll(const event::HoverScroll& e) override;
void onHoverScroll(const HoverScrollEvent& e) override;
}; };






+ 3
- 3
include/ui/MenuItem.hpp View File

@@ -17,13 +17,13 @@ struct MenuItem : MenuEntry {


void draw(const DrawArgs& args) override; void draw(const DrawArgs& args) override;
void step() override; void step() override;
void onEnter(const event::Enter& e) override;
void onDragDrop(const event::DragDrop& e) override;
void onEnter(const EnterEvent& e) override;
void onDragDrop(const DragDropEvent& e) override;
void doAction(); void doAction();
virtual Menu* createChildMenu() { virtual Menu* createChildMenu() {
return NULL; return NULL;
} }
void onAction(const event::Action& e) override;
void onAction(const ActionEvent& e) override;
}; };






+ 3
- 3
include/ui/MenuOverlay.hpp View File

@@ -11,9 +11,9 @@ namespace ui {
struct MenuOverlay : widget::OpaqueWidget { struct MenuOverlay : widget::OpaqueWidget {
void draw(const DrawArgs& args) override; void draw(const DrawArgs& args) override;
void step() 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;
}; };






+ 1
- 1
include/ui/OptionButton.hpp View File

@@ -15,7 +15,7 @@ struct OptionButton : widget::OpaqueWidget {


OptionButton(); OptionButton();
void draw(const DrawArgs& args) override; void draw(const DrawArgs& args) override;
void onDragDrop(const event::DragDrop& e) override;
void onDragDrop(const DragDropEvent& e) override;
}; };






+ 1
- 1
include/ui/RadioButton.hpp View File

@@ -15,7 +15,7 @@ struct RadioButton : widget::OpaqueWidget {


RadioButton(); RadioButton();
void draw(const DrawArgs& args) override; void draw(const DrawArgs& args) override;
void onDragDrop(const event::DragDrop& e) override;
void onDragDrop(const DragDropEvent& e) override;
}; };






+ 5
- 5
include/ui/ScrollWidget.hpp View File

@@ -31,11 +31,11 @@ struct ScrollWidget : widget::OpaqueWidget {
math::Vec getHandleSize(); math::Vec getHandleSize();
void draw(const DrawArgs& args) override; void draw(const DrawArgs& args) override;
void step() 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;
}; };






+ 4
- 4
include/ui/Scrollbar.hpp View File

@@ -17,10 +17,10 @@ struct Scrollbar : widget::OpaqueWidget {
Scrollbar(); Scrollbar();
~Scrollbar(); ~Scrollbar();
void draw(const DrawArgs& args) override; 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;
}; };






+ 4
- 4
include/ui/Slider.hpp View File

@@ -15,10 +15,10 @@ struct Slider : widget::OpaqueWidget {


Slider(); Slider();
void draw(const DrawArgs& args) override; 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;
}; };






+ 4
- 4
include/ui/TextField.hpp View File

@@ -21,10 +21,10 @@ struct TextField : widget::OpaqueWidget {


TextField(); TextField();
void draw(const DrawArgs& args) override; 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); virtual int getTextPosition(math::Vec mousePos);


std::string getText(); std::string getText();


+ 1
- 1
include/widget/FramebufferWidget.hpp View File

@@ -24,7 +24,7 @@ struct FramebufferWidget : Widget {
FramebufferWidget(); FramebufferWidget();
~FramebufferWidget(); ~FramebufferWidget();
void setDirty(bool dirty = true); void setDirty(bool dirty = true);
void onDirty(const event::Dirty& e) override;
void onDirty(const DirtyEvent& e) override;
void step() override; void step() override;
void draw(const DrawArgs& args) override; void draw(const DrawArgs& args) override;
virtual void drawFramebuffer(); virtual void drawFramebuffer();


+ 7
- 7
include/widget/OpaqueWidget.hpp View File

@@ -10,14 +10,14 @@ namespace widget {
Also consumes Hover and Button for left-clicks. Also consumes Hover and Button for left-clicks.
*/ */
struct OpaqueWidget : Widget { struct OpaqueWidget : Widget {
void onHover(const event::Hover& e) override {
void onHover(const HoverEvent& e) override {
Widget::onHover(e); Widget::onHover(e);
e.stopPropagating(); e.stopPropagating();
// Consume if not consumed by child // Consume if not consumed by child
if (!e.isConsumed()) if (!e.isConsumed())
e.consume(this); e.consume(this);
} }
void onButton(const event::Button& e) override {
void onButton(const ButtonEvent& e) override {
Widget::onButton(e); Widget::onButton(e);
e.stopPropagating(); e.stopPropagating();
if (e.button == GLFW_MOUSE_BUTTON_LEFT) { if (e.button == GLFW_MOUSE_BUTTON_LEFT) {
@@ -26,26 +26,26 @@ struct OpaqueWidget : Widget {
e.consume(this); e.consume(this);
} }
} }
void onHoverKey(const event::HoverKey& e) override {
void onHoverKey(const HoverKeyEvent& e) override {
Widget::onHoverKey(e); Widget::onHoverKey(e);
e.stopPropagating(); e.stopPropagating();
} }
void onHoverText(const event::HoverText& e) override {
void onHoverText(const HoverTextEvent& e) override {
Widget::onHoverText(e); Widget::onHoverText(e);
e.stopPropagating(); e.stopPropagating();
} }
void onHoverScroll(const event::HoverScroll& e) override {
void onHoverScroll(const HoverScrollEvent& e) override {
Widget::onHoverScroll(e); Widget::onHoverScroll(e);
e.stopPropagating(); e.stopPropagating();
} }
void onDragHover(const event::DragHover& e) override {
void onDragHover(const DragHoverEvent& e) override {
Widget::onDragHover(e); Widget::onDragHover(e);
e.stopPropagating(); e.stopPropagating();
// Consume if not consumed by child // Consume if not consumed by child
if (!e.isConsumed()) if (!e.isConsumed())
e.consume(this); e.consume(this);
} }
void onPathDrop(const event::PathDrop& e) override {
void onPathDrop(const PathDropEvent& e) override {
Widget::onPathDrop(e); Widget::onPathDrop(e);
e.stopPropagating(); e.stopPropagating();
} }


+ 7
- 7
include/widget/TransparentWidget.hpp View File

@@ -9,13 +9,13 @@ namespace widget {
/** A Widget that does not respond to events and does not pass events to children */ /** A Widget that does not respond to events and does not pass events to children */
struct TransparentWidget : Widget { struct TransparentWidget : Widget {
/** Override behavior to do nothing instead. */ /** 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 {}
}; };






+ 1
- 1
include/widget/Widget.hpp View File

@@ -458,7 +458,7 @@ struct Widget : WeakBase {
} // namespace widget } // namespace widget


/** Deprecated Rack v1 event namespace. /** 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 { namespace event {
using Base = widget::BaseEvent; using Base = widget::BaseEvent;


+ 14
- 14
include/widget/ZoomWidget.hpp View File

@@ -19,38 +19,38 @@ struct ZoomWidget : Widget {
} }
void draw(const DrawArgs& args) override; 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); e2.pos = e.pos.div(zoom);
Widget::onHover(e2); 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); e2.pos = e.pos.div(zoom);
Widget::onButton(e2); 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); e2.pos = e.pos.div(zoom);
Widget::onHoverKey(e2); 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); e2.pos = e.pos.div(zoom);
Widget::onHoverText(e2); 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); e2.pos = e.pos.div(zoom);
Widget::onHoverScroll(e2); 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); e2.pos = e.pos.div(zoom);
Widget::onDragHover(e2); 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); e2.pos = e.pos.div(zoom);
Widget::onPathDrop(e2); Widget::onPathDrop(e2);
} }


+ 10
- 10
src/app/AudioWidget.cpp View File

@@ -28,7 +28,7 @@ static std::string getDetailTemplate(std::string name, int numInputs, int inputO
struct AudioDriverValueItem : ui::MenuItem { struct AudioDriverValueItem : ui::MenuItem {
audio::Port* port; audio::Port* port;
int driverId; int driverId;
void onAction(const event::Action& e) override {
void onAction(const ActionEvent& e) override {
port->setDriverId(driverId); port->setDriverId(driverId);
} }
}; };
@@ -49,7 +49,7 @@ static void appendAudioDriverMenu(ui::Menu* menu, audio::Port* port) {


struct AudioDriverChoice : LedDisplayChoice { struct AudioDriverChoice : LedDisplayChoice {
audio::Port* port; audio::Port* port;
void onAction(const event::Action& e) override {
void onAction(const ActionEvent& e) override {
ui::Menu* menu = createMenu(); ui::Menu* menu = createMenu();
menu->addChild(createMenuLabel("Audio driver")); menu->addChild(createMenuLabel("Audio driver"));
appendAudioDriverMenu(menu, port); appendAudioDriverMenu(menu, port);
@@ -86,7 +86,7 @@ struct AudioDeviceValueItem : ui::MenuItem {
int deviceId; int deviceId;
int inputOffset; int inputOffset;
int outputOffset; int outputOffset;
void onAction(const event::Action& e) override {
void onAction(const ActionEvent& e) override {
port->setDeviceId(deviceId); port->setDeviceId(deviceId);
port->inputOffset = inputOffset; port->inputOffset = inputOffset;
port->outputOffset = outputOffset; port->outputOffset = outputOffset;
@@ -133,7 +133,7 @@ static void appendAudioDeviceMenu(ui::Menu* menu, audio::Port* port) {
struct AudioDeviceChoice : LedDisplayChoice { struct AudioDeviceChoice : LedDisplayChoice {
audio::Port* port; audio::Port* port;


void onAction(const event::Action& e) override {
void onAction(const ActionEvent& e) override {
ui::Menu* menu = createMenu(); ui::Menu* menu = createMenu();
menu->addChild(createMenuLabel("Audio device")); menu->addChild(createMenuLabel("Audio device"));
appendAudioDeviceMenu(menu, port); appendAudioDeviceMenu(menu, port);
@@ -173,7 +173,7 @@ struct AudioDeviceItem : ui::MenuItem {
struct AudioSampleRateValueItem : ui::MenuItem { struct AudioSampleRateValueItem : ui::MenuItem {
audio::Port* port; audio::Port* port;
float sampleRate; float sampleRate;
void onAction(const event::Action& e) override {
void onAction(const ActionEvent& e) override {
port->setSampleRate(sampleRate); port->setSampleRate(sampleRate);
} }
}; };
@@ -203,7 +203,7 @@ static void appendAudioSampleRateMenu(ui::Menu* menu, audio::Port* port) {


struct AudioSampleRateChoice : LedDisplayChoice { struct AudioSampleRateChoice : LedDisplayChoice {
audio::Port* port; audio::Port* port;
void onAction(const event::Action& e) override {
void onAction(const ActionEvent& e) override {
ui::Menu* menu = createMenu(); ui::Menu* menu = createMenu();
menu->addChild(createMenuLabel("Sample rate")); menu->addChild(createMenuLabel("Sample rate"));
appendAudioSampleRateMenu(menu, port); appendAudioSampleRateMenu(menu, port);
@@ -238,7 +238,7 @@ struct AudioSampleRateItem : ui::MenuItem {
struct AudioBlockSizeValueItem : ui::MenuItem { struct AudioBlockSizeValueItem : ui::MenuItem {
audio::Port* port; audio::Port* port;
int blockSize; int blockSize;
void onAction(const event::Action& e) override {
void onAction(const ActionEvent& e) override {
port->setBlockSize(blockSize); port->setBlockSize(blockSize);
} }
}; };
@@ -269,7 +269,7 @@ static void appendAudioBlockSizeMenu(ui::Menu* menu, audio::Port* port) {


struct AudioBlockSizeChoice : LedDisplayChoice { struct AudioBlockSizeChoice : LedDisplayChoice {
audio::Port* port; audio::Port* port;
void onAction(const event::Action& e) override {
void onAction(const ActionEvent& e) override {
ui::Menu* menu = createMenu(); ui::Menu* menu = createMenu();
menu->addChild(createMenuLabel("Block size")); menu->addChild(createMenuLabel("Block size"));
appendAudioBlockSizeMenu(menu, port); appendAudioBlockSizeMenu(menu, port);
@@ -348,7 +348,7 @@ void AudioWidget::setAudioPort(audio::Port* port) {




struct AudioDeviceMenuChoice : AudioDeviceChoice { struct AudioDeviceMenuChoice : AudioDeviceChoice {
void onAction(const event::Action& e) override {
void onAction(const ActionEvent& e) override {
ui::Menu* menu = createMenu(); ui::Menu* menu = createMenu();
appendAudioMenu(menu, port); 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(); ui::Menu* menu = createMenu();
appendAudioMenu(menu, port); appendAudioMenu(menu, port);
} }


+ 7
- 7
src/app/Knob.cpp View File

@@ -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 // Only call super if mouse position is in the circle
math::Vec c = box.size.div(2); math::Vec c = box.size.div(2);
float dist = e.pos.minus(c).norm(); 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); math::Vec c = box.size.div(2);
float dist = e.pos.minus(c).norm(); float dist = e.pos.minus(c).norm();
if (dist <= c.x) { 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) if (e.button != GLFW_MOUSE_BUTTON_LEFT)
return; return;


@@ -83,7 +83,7 @@ void Knob::onDragStart(const event::DragStart& e) {
ParamWidget::onDragStart(e); ParamWidget::onDragStart(e);
} }


void Knob::onDragEnd(const event::DragEnd& e) {
void Knob::onDragEnd(const DragEndEvent& e) {
if (e.button != GLFW_MOUSE_BUTTON_LEFT) if (e.button != GLFW_MOUSE_BUTTON_LEFT)
return; return;


@@ -124,7 +124,7 @@ static float getModSpeed() {
return 1.f; return 1.f;
} }


void Knob::onDragMove(const event::DragMove& e) {
void Knob::onDragMove(const DragMoveEvent& e) {
if (e.button != GLFW_MOUSE_BUTTON_LEFT) if (e.button != GLFW_MOUSE_BUTTON_LEFT)
return; return;


@@ -215,7 +215,7 @@ void Knob::onDragMove(const event::DragMove& e) {
ParamWidget::onDragMove(e); ParamWidget::onDragMove(e);
} }


void Knob::onDragLeave(const event::DragLeave& e) {
void Knob::onDragLeave(const DragLeaveEvent& e) {
if (e.origin == this) { if (e.origin == this) {
internal->rotaryDragEnabled = true; 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); ParamWidget::onHoverScroll(e);


if (settings::knobScroll) { if (settings::knobScroll) {


+ 2
- 2
src/app/LedDisplay.cpp View File

@@ -62,11 +62,11 @@ void LedDisplayChoice::draw(const DrawArgs& args) {
nvgResetScissor(args.vg); nvgResetScissor(args.vg);
} }


void LedDisplayChoice::onButton(const event::Button& e) {
void LedDisplayChoice::onButton(const ButtonEvent& e) {
OpaqueWidget::onButton(e); OpaqueWidget::onButton(e);


if (e.action == GLFW_PRESS && (e.button == GLFW_MOUSE_BUTTON_LEFT || e.button == GLFW_MOUSE_BUTTON_RIGHT)) { if (e.action == GLFW_PRESS && (e.button == GLFW_MOUSE_BUTTON_LEFT || e.button == GLFW_MOUSE_BUTTON_RIGHT)) {
event::Action eAction;
ActionEvent eAction;
onAction(eAction); onAction(eAction);
e.consume(this); e.consume(this);
} }


+ 39
- 39
src/app/MenuBar.cpp View File

@@ -61,7 +61,7 @@ struct NotificationIcon : widget::Widget {


struct UrlItem : ui::MenuItem { struct UrlItem : ui::MenuItem {
std::string url; std::string url;
void onAction(const event::Action& e) override {
void onAction(const ActionEvent& e) override {
std::thread t([=] { std::thread t([=] {
system::openBrowser(url); system::openBrowser(url);
}); });
@@ -71,7 +71,7 @@ struct UrlItem : ui::MenuItem {


struct FolderItem : ui::MenuItem { struct FolderItem : ui::MenuItem {
std::string path; std::string path;
void onAction(const event::Action& e) override {
void onAction(const ActionEvent& e) override {
std::thread t([=] { std::thread t([=] {
system::openFolder(path); system::openFolder(path);
}); });
@@ -84,20 +84,20 @@ struct FolderItem : ui::MenuItem {
//////////////////// ////////////////////


struct NewItem : ui::MenuItem { struct NewItem : ui::MenuItem {
void onAction(const event::Action& e) override {
void onAction(const ActionEvent& e) override {
APP->patch->loadTemplateDialog(); APP->patch->loadTemplateDialog();
} }
}; };


struct OpenItem : ui::MenuItem { struct OpenItem : ui::MenuItem {
void onAction(const event::Action& e) override {
void onAction(const ActionEvent& e) override {
APP->patch->loadDialog(); APP->patch->loadDialog();
} }
}; };


struct OpenPathItem : ui::MenuItem { struct OpenPathItem : ui::MenuItem {
std::string path; std::string path;
void onAction(const event::Action& e) override {
void onAction(const ActionEvent& e) override {
APP->patch->loadPathDialog(path); APP->patch->loadPathDialog(path);
} }
}; };
@@ -118,37 +118,37 @@ struct OpenRecentItem : ui::MenuItem {
}; };


struct SaveItem : ui::MenuItem { struct SaveItem : ui::MenuItem {
void onAction(const event::Action& e) override {
void onAction(const ActionEvent& e) override {
APP->patch->saveDialog(); APP->patch->saveDialog();
} }
}; };


struct SaveAsItem : ui::MenuItem { struct SaveAsItem : ui::MenuItem {
void onAction(const event::Action& e) override {
void onAction(const ActionEvent& e) override {
APP->patch->saveAsDialog(); APP->patch->saveAsDialog();
} }
}; };


struct SaveTemplateItem : ui::MenuItem { struct SaveTemplateItem : ui::MenuItem {
void onAction(const event::Action& e) override {
void onAction(const ActionEvent& e) override {
APP->patch->saveTemplateDialog(); APP->patch->saveTemplateDialog();
} }
}; };


struct RevertItem : ui::MenuItem { struct RevertItem : ui::MenuItem {
void onAction(const event::Action& e) override {
void onAction(const ActionEvent& e) override {
APP->patch->revertDialog(); APP->patch->revertDialog();
} }
}; };


struct QuitItem : ui::MenuItem { struct QuitItem : ui::MenuItem {
void onAction(const event::Action& e) override {
void onAction(const ActionEvent& e) override {
APP->window->close(); APP->window->close();
} }
}; };


struct FileButton : MenuButton { struct FileButton : MenuButton {
void onAction(const event::Action& e) override {
void onAction(const ActionEvent& e) override {
ui::Menu* menu = createMenu(); ui::Menu* menu = createMenu();
menu->box.pos = getAbsoluteOffset(math::Vec(0, box.size.y)); menu->box.pos = getAbsoluteOffset(math::Vec(0, box.size.y));
menu->box.size.x = box.size.x; menu->box.size.x = box.size.x;
@@ -201,25 +201,25 @@ struct FileButton : MenuButton {
//////////////////// ////////////////////


struct UndoItem : ui::MenuItem { struct UndoItem : ui::MenuItem {
void onAction(const event::Action& e) override {
void onAction(const ActionEvent& e) override {
APP->history->undo(); APP->history->undo();
} }
}; };


struct RedoItem : ui::MenuItem { struct RedoItem : ui::MenuItem {
void onAction(const event::Action& e) override {
void onAction(const ActionEvent& e) override {
APP->history->redo(); APP->history->redo();
} }
}; };


struct DisconnectCablesItem : ui::MenuItem { struct DisconnectCablesItem : ui::MenuItem {
void onAction(const event::Action& e) override {
void onAction(const ActionEvent& e) override {
APP->patch->disconnectDialog(); APP->patch->disconnectDialog();
} }
}; };


struct EditButton : MenuButton { struct EditButton : MenuButton {
void onAction(const event::Action& e) override {
void onAction(const ActionEvent& e) override {
ui::Menu* menu = createMenu(); ui::Menu* menu = createMenu();
menu->box.pos = getAbsoluteOffset(math::Vec(0, box.size.y)); menu->box.pos = getAbsoluteOffset(math::Vec(0, box.size.y));
menu->box.size.x = box.size.x; menu->box.size.x = box.size.x;
@@ -346,20 +346,20 @@ struct CableTensionSlider : ui::Slider {
}; };


struct TooltipsItem : ui::MenuItem { struct TooltipsItem : ui::MenuItem {
void onAction(const event::Action& e) override {
void onAction(const ActionEvent& e) override {
settings::tooltips ^= true; settings::tooltips ^= true;
} }
}; };


struct AllowCursorLockItem : ui::MenuItem { struct AllowCursorLockItem : ui::MenuItem {
void onAction(const event::Action& e) override {
void onAction(const ActionEvent& e) override {
settings::allowCursorLock ^= true; settings::allowCursorLock ^= true;
} }
}; };


struct KnobModeValueItem : ui::MenuItem { struct KnobModeValueItem : ui::MenuItem {
settings::KnobMode knobMode; settings::KnobMode knobMode;
void onAction(const event::Action& e) override {
void onAction(const ActionEvent& e) override {
settings::knobMode = knobMode; settings::knobMode = knobMode;
} }
}; };
@@ -386,20 +386,20 @@ struct KnobModeItem : ui::MenuItem {
}; };


struct KnobScrollItem : ui::MenuItem { struct KnobScrollItem : ui::MenuItem {
void onAction(const event::Action& e) override {
void onAction(const ActionEvent& e) override {
settings::knobScroll ^= true; settings::knobScroll ^= true;
} }
}; };


struct LockModulesItem : ui::MenuItem { struct LockModulesItem : ui::MenuItem {
void onAction(const event::Action& e) override {
void onAction(const ActionEvent& e) override {
settings::lockModules ^= true; settings::lockModules ^= true;
} }
}; };


struct FrameRateValueItem : ui::MenuItem { struct FrameRateValueItem : ui::MenuItem {
int frameSwapInterval; int frameSwapInterval;
void onAction(const event::Action& e) override {
void onAction(const ActionEvent& e) override {
settings::frameSwapInterval = frameSwapInterval; settings::frameSwapInterval = frameSwapInterval;
} }
}; };
@@ -422,13 +422,13 @@ struct FrameRateItem : ui::MenuItem {
}; };


struct FullscreenItem : 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()); APP->window->setFullScreen(!APP->window->isFullScreen());
} }
}; };


struct ViewButton : MenuButton { struct ViewButton : MenuButton {
void onAction(const event::Action& e) override {
void onAction(const ActionEvent& e) override {
ui::Menu* menu = createMenu(); ui::Menu* menu = createMenu();
menu->box.pos = getAbsoluteOffset(math::Vec(0, box.size.y)); menu->box.pos = getAbsoluteOffset(math::Vec(0, box.size.y));
menu->box.size.x = box.size.x; menu->box.size.x = box.size.x;
@@ -489,14 +489,14 @@ struct ViewButton : MenuButton {
//////////////////// ////////////////////


struct CpuMeterItem : ui::MenuItem { struct CpuMeterItem : ui::MenuItem {
void onAction(const event::Action& e) override {
void onAction(const ActionEvent& e) override {
settings::cpuMeter ^= true; settings::cpuMeter ^= true;
} }
}; };


struct SampleRateValueItem : ui::MenuItem { struct SampleRateValueItem : ui::MenuItem {
float sampleRate; float sampleRate;
void onAction(const event::Action& e) override {
void onAction(const ActionEvent& e) override {
settings::sampleRate = sampleRate; settings::sampleRate = sampleRate;
} }
}; };
@@ -550,7 +550,7 @@ struct ThreadCountValueItem : ui::MenuItem {
text += " (lowest CPU usage)"; text += " (lowest CPU usage)";
rightText = CHECKMARK(settings::threadCount == threadCount); rightText = CHECKMARK(settings::threadCount == threadCount);
} }
void onAction(const event::Action& e) override {
void onAction(const ActionEvent& e) override {
settings::threadCount = threadCount; settings::threadCount = threadCount;
} }
}; };
@@ -570,7 +570,7 @@ struct ThreadCountItem : ui::MenuItem {
}; };


struct EngineButton : MenuButton { struct EngineButton : MenuButton {
void onAction(const event::Action& e) override {
void onAction(const ActionEvent& e) override {
ui::Menu* menu = createMenu(); ui::Menu* menu = createMenu();
menu->box.pos = getAbsoluteOffset(math::Vec(0, box.size.y)); menu->box.pos = getAbsoluteOffset(math::Vec(0, box.size.y));
menu->box.size.x = box.size.x; menu->box.size.x = box.size.x;
@@ -602,7 +602,7 @@ static bool isLoggingIn = false;
struct AccountEmailField : ui::TextField { struct AccountEmailField : ui::TextField {
ui::TextField* passwordField; 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) { if (e.action == GLFW_PRESS && e.key == GLFW_KEY_TAB) {
APP->event->setSelected(passwordField); APP->event->setSelected(passwordField);
e.consume(this); e.consume(this);
@@ -616,7 +616,7 @@ struct AccountEmailField : ui::TextField {
struct AccountPasswordField : ui::PasswordField { struct AccountPasswordField : ui::PasswordField {
ui::MenuItem* logInItem; 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)) { if (e.action == GLFW_PRESS && (e.key == GLFW_KEY_ENTER || e.key == GLFW_KEY_KP_ENTER)) {
logInItem->doAction(); logInItem->doAction();
e.consume(this); e.consume(this);
@@ -631,7 +631,7 @@ struct LogInItem : ui::MenuItem {
ui::TextField* emailField; ui::TextField* emailField;
ui::TextField* passwordField; ui::TextField* passwordField;


void onAction(const event::Action& e) override {
void onAction(const ActionEvent& e) override {
isLoggingIn = true; isLoggingIn = true;
std::string email = emailField->text; std::string email = emailField->text;
std::string password = passwordField->text; std::string password = passwordField->text;
@@ -670,7 +670,7 @@ struct SyncUpdatesItem : ui::MenuItem {
MenuItem::step(); MenuItem::step();
} }


void onAction(const event::Action& e) override {
void onAction(const ActionEvent& e) override {
std::thread t([=] { std::thread t([=] {
library::syncUpdates(); library::syncUpdates();
}); });
@@ -739,7 +739,7 @@ struct SyncUpdateItem : ui::MenuItem {
MenuItem::step(); MenuItem::step();
} }


void onAction(const event::Action& e) override {
void onAction(const ActionEvent& e) override {
std::thread t([=] { std::thread t([=] {
library::syncUpdate(slug); library::syncUpdate(slug);
}); });
@@ -750,7 +750,7 @@ struct SyncUpdateItem : ui::MenuItem {




struct CheckUpdatesItem : ui::MenuItem { struct CheckUpdatesItem : ui::MenuItem {
void onAction(const event::Action& e) override {
void onAction(const ActionEvent& e) override {
std::thread t([&] { std::thread t([&] {
library::checkUpdates(); library::checkUpdates();
}); });
@@ -760,7 +760,7 @@ struct CheckUpdatesItem : ui::MenuItem {




struct LogOutItem : ui::MenuItem { struct LogOutItem : ui::MenuItem {
void onAction(const event::Action& e) override {
void onAction(const ActionEvent& e) override {
library::logOut(); library::logOut();
} }
}; };
@@ -857,7 +857,7 @@ struct LibraryButton : MenuButton {
addChild(notification); addChild(notification);
} }


void onAction(const event::Action& e) override {
void onAction(const ActionEvent& e) override {
ui::Menu* menu = createMenu<LibraryMenu>(); ui::Menu* menu = createMenu<LibraryMenu>();
menu->box.pos = getAbsoluteOffset(math::Vec(0, box.size.y)); menu->box.pos = getAbsoluteOffset(math::Vec(0, box.size.y));
menu->box.size.x = box.size.x; menu->box.size.x = box.size.x;
@@ -895,7 +895,7 @@ struct AppUpdateItem : ui::MenuItem {
return menu; return menu;
} }


void onAction(const event::Action& e) override {
void onAction(const ActionEvent& e) override {
system::openBrowser(library::appDownloadUrl); system::openBrowser(library::appDownloadUrl);
APP->window->close(); APP->window->close();
} }
@@ -903,7 +903,7 @@ struct AppUpdateItem : ui::MenuItem {




struct CheckAppUpdateItem : ui::MenuItem { struct CheckAppUpdateItem : ui::MenuItem {
void onAction(const event::Action& e) override {
void onAction(const ActionEvent& e) override {
std::thread t([&]() { std::thread t([&]() {
library::checkAppUpdate(); library::checkAppUpdate();
}); });
@@ -913,7 +913,7 @@ struct CheckAppUpdateItem : ui::MenuItem {




struct TipItem : ui::MenuItem { struct TipItem : ui::MenuItem {
void onAction(const event::Action& e) override {
void onAction(const ActionEvent& e) override {
APP->scene->addChild(tipWindowCreate()); APP->scene->addChild(tipWindowCreate());
} }
}; };
@@ -927,7 +927,7 @@ struct HelpButton : MenuButton {
addChild(notification); addChild(notification);
} }


void onAction(const event::Action& e) override {
void onAction(const ActionEvent& e) override {
ui::Menu* menu = createMenu(); ui::Menu* menu = createMenu();
menu->box.pos = getAbsoluteOffset(math::Vec(0, box.size.y)); menu->box.pos = getAbsoluteOffset(math::Vec(0, box.size.y));
menu->box.size.x = box.size.x; menu->box.size.x = box.size.x;


+ 7
- 7
src/app/MidiWidget.cpp View File

@@ -10,7 +10,7 @@ namespace app {
struct MidiDriverValueItem : ui::MenuItem { struct MidiDriverValueItem : ui::MenuItem {
midi::Port* port; midi::Port* port;
int driverId; int driverId;
void onAction(const event::Action& e) override {
void onAction(const ActionEvent& e) override {
port->setDriverId(driverId); port->setDriverId(driverId);
} }
}; };
@@ -31,7 +31,7 @@ static void appendMidiDriverMenu(ui::Menu* menu, midi::Port* port) {


struct MidiDriverChoice : LedDisplayChoice { struct MidiDriverChoice : LedDisplayChoice {
midi::Port* port; midi::Port* port;
void onAction(const event::Action& e) override {
void onAction(const ActionEvent& e) override {
ui::Menu* menu = createMenu(); ui::Menu* menu = createMenu();
menu->addChild(createMenuLabel("MIDI driver")); menu->addChild(createMenuLabel("MIDI driver"));
appendMidiDriverMenu(menu, port); appendMidiDriverMenu(menu, port);
@@ -61,7 +61,7 @@ struct MidiDriverItem : ui::MenuItem {
struct MidiDeviceValueItem : ui::MenuItem { struct MidiDeviceValueItem : ui::MenuItem {
midi::Port* port; midi::Port* port;
int deviceId; int deviceId;
void onAction(const event::Action& e) override {
void onAction(const ActionEvent& e) override {
port->setDeviceId(deviceId); port->setDeviceId(deviceId);
} }
}; };
@@ -91,7 +91,7 @@ static void appendMidiDeviceMenu(ui::Menu* menu, midi::Port* port) {


struct MidiDeviceChoice : LedDisplayChoice { struct MidiDeviceChoice : LedDisplayChoice {
midi::Port* port; midi::Port* port;
void onAction(const event::Action& e) override {
void onAction(const ActionEvent& e) override {
ui::Menu* menu = createMenu(); ui::Menu* menu = createMenu();
menu->addChild(createMenuLabel("MIDI device")); menu->addChild(createMenuLabel("MIDI device"));
appendMidiDeviceMenu(menu, port); appendMidiDeviceMenu(menu, port);
@@ -121,7 +121,7 @@ struct MidiDeviceItem : ui::MenuItem {
struct MidiChannelValueItem : ui::MenuItem { struct MidiChannelValueItem : ui::MenuItem {
midi::Port* port; midi::Port* port;
int channel; int channel;
void onAction(const event::Action& e) override {
void onAction(const ActionEvent& e) override {
port->setChannel(channel); port->setChannel(channel);
} }
}; };
@@ -142,7 +142,7 @@ static void appendMidiChannelMenu(ui::Menu* menu, midi::Port* port) {


struct MidiChannelChoice : LedDisplayChoice { struct MidiChannelChoice : LedDisplayChoice {
midi::Port* port; midi::Port* port;
void onAction(const event::Action& e) override {
void onAction(const ActionEvent& e) override {
ui::Menu* menu = createMenu(); ui::Menu* menu = createMenu();
menu->addChild(createMenuLabel("MIDI channel")); menu->addChild(createMenuLabel("MIDI channel"));
appendMidiChannelMenu(menu, port); 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(); ui::Menu* menu = createMenu();
appendMidiMenu(menu, port); appendMidiMenu(menu, port);
} }


+ 31
- 31
src/app/ModuleBrowser.cpp View File

@@ -121,7 +121,7 @@ struct BrowserOverlay : ui::MenuOverlay {
MenuOverlay::step(); MenuOverlay::step();
} }


void onAction(const event::Action& e) override {
void onAction(const ActionEvent& e) override {
hide(); 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); OpaqueWidget::onButton(e);
if (e.getTarget() != this) if (e.getTarget() != this)
return; 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; std::string text;
text = model->plugin->brand; text = model->plugin->brand;
text += " " + model->name; text += " " + model->name;
@@ -256,11 +256,11 @@ struct ModelBox : widget::OpaqueWidget {
setTooltip(tooltip); setTooltip(tooltip);
} }


void onLeave(const event::Leave& e) override {
void onLeave(const LeaveEvent& e) override {
setTooltip(NULL); setTooltip(NULL);
} }


void onHide(const event::Hide& e) override {
void onHide(const HideEvent& e) override {
// Hide tooltip // Hide tooltip
setTooltip(NULL); setTooltip(NULL);
OpaqueWidget::onHide(e); OpaqueWidget::onHide(e);
@@ -277,16 +277,16 @@ struct BrowserSearchField : ui::TextField {
TextField::step(); 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); APP->event->setSelected(NULL);
ui::TextField::onHide(e); ui::TextField::onHide(e);
} }


void onShow(const event::Show& e) override {
void onShow(const ShowEvent& e) override {
selectAll(); selectAll();
TextField::onShow(e); TextField::onShow(e);
} }
@@ -295,14 +295,14 @@ struct BrowserSearchField : ui::TextField {


struct ClearButton : ui::Button { struct ClearButton : ui::Button {
ModuleBrowser* browser; ModuleBrowser* browser;
void onAction(const event::Action& e) override;
void onAction(const ActionEvent& e) override;
}; };




struct BrandItem : ui::MenuItem { struct BrandItem : ui::MenuItem {
ModuleBrowser* browser; ModuleBrowser* browser;
std::string brand; std::string brand;
void onAction(const event::Action& e) override;
void onAction(const ActionEvent& e) override;
void step() override; void step() override;
}; };


@@ -310,7 +310,7 @@ struct BrandItem : ui::MenuItem {
struct BrandButton : ui::ChoiceButton { struct BrandButton : ui::ChoiceButton {
ModuleBrowser* browser; ModuleBrowser* browser;


void onAction(const event::Action& e) override;
void onAction(const ActionEvent& e) override;
void step() override; void step() override;
}; };


@@ -318,7 +318,7 @@ struct BrandButton : ui::ChoiceButton {
struct TagItem : ui::MenuItem { struct TagItem : ui::MenuItem {
ModuleBrowser* browser; ModuleBrowser* browser;
int tagId; int tagId;
void onAction(const event::Action& e) override;
void onAction(const ActionEvent& e) override;
void step() override; void step() override;
}; };


@@ -326,7 +326,7 @@ struct TagItem : ui::MenuItem {
struct TagButton : ui::ChoiceButton { struct TagButton : ui::ChoiceButton {
ModuleBrowser* browser; ModuleBrowser* browser;


void onAction(const event::Action& e) override;
void onAction(const ActionEvent& e) override;
void step() override; void step() override;
}; };


@@ -344,7 +344,7 @@ static const std::string sortNames[] = {
struct SortItem : ui::MenuItem { struct SortItem : ui::MenuItem {
ModuleBrowser* browser; ModuleBrowser* browser;
settings::ModuleBrowserSort sort; settings::ModuleBrowserSort sort;
void onAction(const event::Action& e) override;
void onAction(const ActionEvent& e) override;
void step() override { void step() override {
rightText = CHECKMARK(settings::moduleBrowserSort == sort); rightText = CHECKMARK(settings::moduleBrowserSort == sort);
MenuItem::step(); MenuItem::step();
@@ -355,7 +355,7 @@ struct SortItem : ui::MenuItem {
struct SortButton : ui::ChoiceButton { struct SortButton : ui::ChoiceButton {
ModuleBrowser* browser; ModuleBrowser* browser;


void onAction(const event::Action& e) override {
void onAction(const ActionEvent& e) override {
ui::Menu* menu = createMenu(); ui::Menu* menu = createMenu();
menu->box.pos = getAbsoluteOffset(math::Vec(0, box.size.y)); menu->box.pos = getAbsoluteOffset(math::Vec(0, box.size.y));
menu->box.size.x = box.size.x; menu->box.size.x = box.size.x;
@@ -380,7 +380,7 @@ struct SortButton : ui::ChoiceButton {
struct ZoomItem : ui::MenuItem { struct ZoomItem : ui::MenuItem {
ModuleBrowser* browser; ModuleBrowser* browser;
float zoom; float zoom;
void onAction(const event::Action& e) override;
void onAction(const ActionEvent& e) override;
void step() override { void step() override {
rightText = CHECKMARK(settings::moduleBrowserZoom == zoom); rightText = CHECKMARK(settings::moduleBrowserZoom == zoom);
MenuItem::step(); MenuItem::step();
@@ -391,7 +391,7 @@ struct ZoomItem : ui::MenuItem {
struct ZoomButton : ui::ChoiceButton { struct ZoomButton : ui::ChoiceButton {
ModuleBrowser* browser; ModuleBrowser* browser;


void onAction(const event::Action& e) override {
void onAction(const ActionEvent& e) override {
ui::Menu* menu = createMenu(); ui::Menu* menu = createMenu();
menu->box.pos = getAbsoluteOffset(math::Vec(0, box.size.y)); menu->box.pos = getAbsoluteOffset(math::Vec(0, box.size.y));
menu->box.size.x = box.size.x; menu->box.size.x = box.size.x;
@@ -415,7 +415,7 @@ struct ZoomButton : ui::ChoiceButton {


struct UrlButton : ui::Button { struct UrlButton : ui::Button {
std::string url; std::string url;
void onAction(const event::Action& e) override {
void onAction(const ActionEvent& e) override {
std::thread t([=] { std::thread t([=] {
system::openBrowser(url); system::openBrowser(url);
}); });
@@ -698,7 +698,7 @@ struct ModuleBrowser : widget::OpaqueWidget {
refresh(); refresh();
} }


void onShow(const event::Show& e) override {
void onShow(const ShowEvent& e) override {
refresh(); refresh();
OpaqueWidget::onShow(e); OpaqueWidget::onShow(e);
} }
@@ -708,11 +708,11 @@ struct ModuleBrowser : widget::OpaqueWidget {
// Implementations to resolve dependencies // Implementations to resolve dependencies




inline void ClearButton::onAction(const event::Action& e) {
inline void ClearButton::onAction(const ActionEvent& e) {
browser->clear(); 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.action == GLFW_PRESS || e.action == GLFW_REPEAT) {
if (e.key == GLFW_KEY_ESCAPE) { if (e.key == GLFW_KEY_ESCAPE) {
BrowserOverlay* overlay = browser->getAncestorOfType<BrowserOverlay>(); BrowserOverlay* overlay = browser->getAncestorOfType<BrowserOverlay>();
@@ -732,12 +732,12 @@ inline void BrowserSearchField::onSelectKey(const event::SelectKey& e) {
ui::TextField::onSelectKey(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->search = string::trim(text);
browser->refresh(); browser->refresh();
} }


inline void BrowserSearchField::onAction(const event::Action& e) {
inline void BrowserSearchField::onAction(const ActionEvent& e) {
// Get first ModelBox // Get first ModelBox
ModelBox* mb = NULL; ModelBox* mb = NULL;
for (Widget* w : browser->modelContainer->children) { 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) if (browser->brand == brand)
browser->brand = ""; browser->brand = "";
else else
@@ -765,7 +765,7 @@ inline void BrandItem::step() {
MenuItem::step(); MenuItem::step();
} }


inline void BrandButton::onAction(const event::Action& e) {
inline void BrandButton::onAction(const ActionEvent& e) {
ui::Menu* menu = createMenu(); ui::Menu* menu = createMenu();
menu->box.pos = getAbsoluteOffset(math::Vec(0, box.size.y)); menu->box.pos = getAbsoluteOffset(math::Vec(0, box.size.y));
menu->box.size.x = box.size.x; menu->box.size.x = box.size.x;
@@ -804,7 +804,7 @@ inline void BrandButton::step() {
ChoiceButton::step(); ChoiceButton::step();
} }


inline void TagItem::onAction(const event::Action& e) {
inline void TagItem::onAction(const ActionEvent& e) {
auto it = browser->tagIds.find(tagId); auto it = browser->tagIds.find(tagId);
bool isSelected = (it != browser->tagIds.end()); bool isSelected = (it != browser->tagIds.end());


@@ -849,7 +849,7 @@ inline void TagItem::step() {
MenuItem::step(); MenuItem::step();
} }


inline void TagButton::onAction(const event::Action& e) {
inline void TagButton::onAction(const ActionEvent& e) {
ui::Menu* menu = createMenu(); ui::Menu* menu = createMenu();
menu->box.pos = getAbsoluteOffset(math::Vec(0, box.size.y)); menu->box.pos = getAbsoluteOffset(math::Vec(0, box.size.y));
menu->box.size.x = box.size.x; menu->box.size.x = box.size.x;
@@ -889,12 +889,12 @@ inline void TagButton::step() {
ChoiceButton::step(); ChoiceButton::step();
} }


inline void SortItem::onAction(const event::Action& e) {
inline void SortItem::onAction(const ActionEvent& e) {
settings::moduleBrowserSort = sort; settings::moduleBrowserSort = sort;
browser->refresh(); browser->refresh();
} }


inline void ZoomItem::onAction(const event::Action& e) {
inline void ZoomItem::onAction(const ActionEvent& e) {
if (zoom != settings::moduleBrowserZoom) { if (zoom != settings::moduleBrowserZoom) {
settings::moduleBrowserZoom = zoom; settings::moduleBrowserZoom = zoom;
browser->updateZoom(); browser->updateZoom();


+ 3
- 3
src/app/ModuleLightWidget.cpp View File

@@ -118,7 +118,7 @@ void ModuleLightWidget::step() {
} }




void ModuleLightWidget::onHover(const event::Hover& e) {
void ModuleLightWidget::onHover(const HoverEvent& e) {
// Adapted from OpaqueWidget::onHover() // Adapted from OpaqueWidget::onHover()
Widget::onHover(e); Widget::onHover(e);
e.stopPropagating(); 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(); createTooltip();
} }




void ModuleLightWidget::onLeave(const event::Leave& e) {
void ModuleLightWidget::onLeave(const LeaveEvent& e) {
destroyTooltip(); destroyTooltip();
} }




+ 20
- 20
src/app/ModuleWidget.cpp View File

@@ -28,7 +28,7 @@ static const char PRESET_FILTERS[] = "VCV Rack module preset (.vcvm):vcvm";


struct ModuleUrlItem : ui::MenuItem { struct ModuleUrlItem : ui::MenuItem {
std::string url; std::string url;
void onAction(const event::Action& e) override {
void onAction(const ActionEvent& e) override {
std::thread t(system::openBrowser, url); std::thread t(system::openBrowser, url);
t.detach(); t.detach();
} }
@@ -37,7 +37,7 @@ struct ModuleUrlItem : ui::MenuItem {


struct ModuleFolderItem : ui::MenuItem { struct ModuleFolderItem : ui::MenuItem {
std::string path; std::string path;
void onAction(const event::Action& e) override {
void onAction(const ActionEvent& e) override {
std::thread t(system::openFolder, path); std::thread t(system::openFolder, path);
t.detach(); t.detach();
} }
@@ -160,7 +160,7 @@ struct ModuleInfoItem : ui::MenuItem {


struct ModuleDisconnectItem : ui::MenuItem { struct ModuleDisconnectItem : ui::MenuItem {
WeakPtr<ModuleWidget> moduleWidget; WeakPtr<ModuleWidget> moduleWidget;
void onAction(const event::Action& e) override {
void onAction(const ActionEvent& e) override {
if (!moduleWidget) if (!moduleWidget)
return; return;
moduleWidget->disconnectAction(); moduleWidget->disconnectAction();
@@ -170,7 +170,7 @@ struct ModuleDisconnectItem : ui::MenuItem {


struct ModuleResetItem : ui::MenuItem { struct ModuleResetItem : ui::MenuItem {
WeakPtr<ModuleWidget> moduleWidget; WeakPtr<ModuleWidget> moduleWidget;
void onAction(const event::Action& e) override {
void onAction(const ActionEvent& e) override {
if (!moduleWidget) if (!moduleWidget)
return; return;
moduleWidget->resetAction(); moduleWidget->resetAction();
@@ -180,7 +180,7 @@ struct ModuleResetItem : ui::MenuItem {


struct ModuleRandomizeItem : ui::MenuItem { struct ModuleRandomizeItem : ui::MenuItem {
WeakPtr<ModuleWidget> moduleWidget; WeakPtr<ModuleWidget> moduleWidget;
void onAction(const event::Action& e) override {
void onAction(const ActionEvent& e) override {
if (!moduleWidget) if (!moduleWidget)
return; return;
moduleWidget->randomizeAction(); moduleWidget->randomizeAction();
@@ -190,7 +190,7 @@ struct ModuleRandomizeItem : ui::MenuItem {


struct ModuleCopyItem : ui::MenuItem { struct ModuleCopyItem : ui::MenuItem {
WeakPtr<ModuleWidget> moduleWidget; WeakPtr<ModuleWidget> moduleWidget;
void onAction(const event::Action& e) override {
void onAction(const ActionEvent& e) override {
if (!moduleWidget) if (!moduleWidget)
return; return;
moduleWidget->copyClipboard(); moduleWidget->copyClipboard();
@@ -200,7 +200,7 @@ struct ModuleCopyItem : ui::MenuItem {


struct ModulePasteItem : ui::MenuItem { struct ModulePasteItem : ui::MenuItem {
WeakPtr<ModuleWidget> moduleWidget; WeakPtr<ModuleWidget> moduleWidget;
void onAction(const event::Action& e) override {
void onAction(const ActionEvent& e) override {
if (!moduleWidget) if (!moduleWidget)
return; return;
moduleWidget->pasteClipboardAction(); moduleWidget->pasteClipboardAction();
@@ -210,7 +210,7 @@ struct ModulePasteItem : ui::MenuItem {


struct ModuleSaveItem : ui::MenuItem { struct ModuleSaveItem : ui::MenuItem {
WeakPtr<ModuleWidget> moduleWidget; WeakPtr<ModuleWidget> moduleWidget;
void onAction(const event::Action& e) override {
void onAction(const ActionEvent& e) override {
if (!moduleWidget) if (!moduleWidget)
return; return;
moduleWidget->saveDialog(); moduleWidget->saveDialog();
@@ -220,7 +220,7 @@ struct ModuleSaveItem : ui::MenuItem {


struct ModuleSaveTemplateItem : ui::MenuItem { struct ModuleSaveTemplateItem : ui::MenuItem {
WeakPtr<ModuleWidget> moduleWidget; WeakPtr<ModuleWidget> moduleWidget;
void onAction(const event::Action& e) override {
void onAction(const ActionEvent& e) override {
if (!moduleWidget) if (!moduleWidget)
return; return;
moduleWidget->saveTemplateDialog(); moduleWidget->saveTemplateDialog();
@@ -230,7 +230,7 @@ struct ModuleSaveTemplateItem : ui::MenuItem {


struct ModuleClearTemplateItem : ui::MenuItem { struct ModuleClearTemplateItem : ui::MenuItem {
WeakPtr<ModuleWidget> moduleWidget; WeakPtr<ModuleWidget> moduleWidget;
void onAction(const event::Action& e) override {
void onAction(const ActionEvent& e) override {
if (!moduleWidget) if (!moduleWidget)
return; return;
moduleWidget->clearTemplateDialog(); moduleWidget->clearTemplateDialog();
@@ -240,7 +240,7 @@ struct ModuleClearTemplateItem : ui::MenuItem {


struct ModuleLoadItem : ui::MenuItem { struct ModuleLoadItem : ui::MenuItem {
WeakPtr<ModuleWidget> moduleWidget; WeakPtr<ModuleWidget> moduleWidget;
void onAction(const event::Action& e) override {
void onAction(const ActionEvent& e) override {
if (!moduleWidget) if (!moduleWidget)
return; return;
moduleWidget->loadDialog(); moduleWidget->loadDialog();
@@ -251,7 +251,7 @@ struct ModuleLoadItem : ui::MenuItem {
struct ModulePresetPathItem : ui::MenuItem { struct ModulePresetPathItem : ui::MenuItem {
WeakPtr<ModuleWidget> moduleWidget; WeakPtr<ModuleWidget> moduleWidget;
std::string presetPath; std::string presetPath;
void onAction(const event::Action& e) override {
void onAction(const ActionEvent& e) override {
if (!moduleWidget) if (!moduleWidget)
return; return;
try { try {
@@ -348,7 +348,7 @@ struct ModulePresetItem : ui::MenuItem {


struct ModuleCloneItem : ui::MenuItem { struct ModuleCloneItem : ui::MenuItem {
WeakPtr<ModuleWidget> moduleWidget; WeakPtr<ModuleWidget> moduleWidget;
void onAction(const event::Action& e) override {
void onAction(const ActionEvent& e) override {
if (!moduleWidget) if (!moduleWidget)
return; return;
moduleWidget->cloneAction(); moduleWidget->cloneAction();
@@ -358,7 +358,7 @@ struct ModuleCloneItem : ui::MenuItem {


struct ModuleBypassItem : ui::MenuItem { struct ModuleBypassItem : ui::MenuItem {
WeakPtr<ModuleWidget> moduleWidget; WeakPtr<ModuleWidget> moduleWidget;
void onAction(const event::Action& e) override {
void onAction(const ActionEvent& e) override {
if (!moduleWidget) if (!moduleWidget)
return; return;
moduleWidget->bypassAction(); moduleWidget->bypassAction();
@@ -368,7 +368,7 @@ struct ModuleBypassItem : ui::MenuItem {


struct ModuleDeleteItem : ui::MenuItem { struct ModuleDeleteItem : ui::MenuItem {
WeakPtr<ModuleWidget> moduleWidget; WeakPtr<ModuleWidget> moduleWidget;
void onAction(const event::Action& e) override {
void onAction(const ActionEvent& e) override {
if (!moduleWidget) if (!moduleWidget)
return; return;
moduleWidget->removeAction(); moduleWidget->removeAction();
@@ -500,7 +500,7 @@ void ModuleWidget::drawShadow(const DrawArgs& args) {
nvgFill(args.vg); 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. // Don't consume left button if `lockModules` is enabled.
if (settings::lockModules) if (settings::lockModules)
Widget::onButton(e); 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); OpaqueWidget::onHoverKey(e);
if (e.isConsumed()) if (e.isConsumed())
return; 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) { if (e.button == GLFW_MOUSE_BUTTON_LEFT) {
// Clear dragRack so dragging in not enabled until mouse is moved a bit. // Clear dragRack so dragging in not enabled until mouse is moved a bit.
internal->dragRackPos = math::Vec(NAN, NAN); 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) { if (e.button == GLFW_MOUSE_BUTTON_LEFT) {
// The next time the module is dragged, it should always move immediately // The next time the module is dragged, it should always move immediately
internal->dragEnabled = true; 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 (e.button == GLFW_MOUSE_BUTTON_LEFT) {
if (!settings::lockModules) { if (!settings::lockModules) {
math::Vec mousePos = APP->scene->rack->mousePos; math::Vec mousePos = APP->scene->rack->mousePos;


+ 9
- 9
src/app/ParamWidget.cpp View File

@@ -31,7 +31,7 @@ struct ParamField : ui::TextField {
selectAll(); 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)) { if (e.action == GLFW_PRESS && (e.key == GLFW_KEY_ENTER || e.key == GLFW_KEY_KP_ENTER)) {
engine::ParamQuantity* pq = paramWidget->getParamQuantity(); engine::ParamQuantity* pq = paramWidget->getParamQuantity();
assert(pq); assert(pq);
@@ -65,7 +65,7 @@ struct ParamValueItem : ui::MenuItem {
ParamWidget* paramWidget; ParamWidget* paramWidget;
float value; float value;


void onAction(const event::Action& e) override {
void onAction(const ActionEvent& e) override {
engine::ParamQuantity* pq = paramWidget->getParamQuantity(); engine::ParamQuantity* pq = paramWidget->getParamQuantity();
if (pq) { if (pq) {
float oldValue = pq->getValue(); float oldValue = pq->getValue();
@@ -124,7 +124,7 @@ struct ParamLabel : ui::MenuLabel {


struct ParamResetItem : ui::MenuItem { struct ParamResetItem : ui::MenuItem {
ParamWidget* paramWidget; ParamWidget* paramWidget;
void onAction(const event::Action& e) override {
void onAction(const ActionEvent& e) override {
paramWidget->resetAction(); paramWidget->resetAction();
} }
}; };
@@ -136,7 +136,7 @@ struct ParamFineItem : ui::MenuItem {


struct ParamUnmapItem : ui::MenuItem { struct ParamUnmapItem : ui::MenuItem {
ParamWidget* paramWidget; 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); engine::ParamHandle* paramHandle = APP->engine->getParamHandle(paramWidget->module->id, paramWidget->paramId);
if (paramHandle) { if (paramHandle) {
APP->engine->updateParamHandle(paramHandle, -1, 0); APP->engine->updateParamHandle(paramHandle, -1, 0);
@@ -178,7 +178,7 @@ void ParamWidget::step() {
float value = pq->getSmoothValue(); float value = pq->getSmoothValue();
// Trigger change event when the ParamQuantity value changes // Trigger change event when the ParamQuantity value changes
if (value != lastValue) { if (value != lastValue) {
event::Change eChange;
ChangeEvent eChange;
onChange(eChange); onChange(eChange);
lastValue = value; 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); OpaqueWidget::onButton(e);


// Touch parameter // 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(); resetAction();
} }


void ParamWidget::onEnter(const event::Enter& e) {
void ParamWidget::onEnter(const EnterEvent& e) {
createTooltip(); createTooltip();
} }


void ParamWidget::onLeave(const event::Leave& e) {
void ParamWidget::onLeave(const LeaveEvent& e) {
destroyTooltip(); destroyTooltip();
} }




+ 8
- 8
src/app/PortWidget.cpp View File

@@ -153,7 +153,7 @@ void PortWidget::draw(const DrawArgs& args) {
Widget::draw(args); Widget::draw(args);
} }


void PortWidget::onButton(const event::Button& e) {
void PortWidget::onButton(const ButtonEvent& e) {
OpaqueWidget::onButton(e); OpaqueWidget::onButton(e);


if (e.action == GLFW_PRESS && e.button == GLFW_MOUSE_BUTTON_RIGHT) { 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(); createTooltip();
} }


void PortWidget::onLeave(const event::Leave& e) {
void PortWidget::onLeave(const LeaveEvent& e) {
destroyTooltip(); destroyTooltip();
} }


void PortWidget::onDragStart(const event::DragStart& e) {
void PortWidget::onDragStart(const DragStartEvent& e) {
if (e.button != GLFW_MOUSE_BUTTON_LEFT) if (e.button != GLFW_MOUSE_BUTTON_LEFT)
return; return;


@@ -235,7 +235,7 @@ void PortWidget::onDragStart(const event::DragStart& e) {
APP->scene->rack->setIncompleteCable(cw); 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) if (e.button != GLFW_MOUSE_BUTTON_LEFT)
return; 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. // HACK: Only delete tooltip if we're not (normal) dragging it.
if (e.origin == this) if (e.origin == this)
createTooltip(); 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<PortWidget*>(e.origin); PortWidget* pw = dynamic_cast<PortWidget*>(e.origin);
if (pw) { if (pw) {
createTooltip(); 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(); destroyTooltip();


if (e.button != GLFW_MOUSE_BUTTON_LEFT) if (e.button != GLFW_MOUSE_BUTTON_LEFT)


+ 3
- 3
src/app/RackScrollWidget.cpp View File

@@ -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); ScrollWidget::onHoverKey(e);
if (e.isConsumed()) if (e.isConsumed())
return; 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); ScrollWidget::onHoverScroll(e);
if (e.isConsumed()) if (e.isConsumed())
return; 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); ScrollWidget::onHover(e);


// Hide menu bar if fullscreen and moving mouse over the RackScrollWidget // Hide menu bar if fullscreen and moving mouse over the RackScrollWidget


+ 4
- 4
src/app/RackWidget.cpp View File

@@ -112,13 +112,13 @@ void RackWidget::draw(const DrawArgs& args) {
Widget::draw(args); Widget::draw(args);
} }


void RackWidget::onHover(const event::Hover& e) {
void RackWidget::onHover(const HoverEvent& e) {
// Set before calling children's onHover() // Set before calling children's onHover()
mousePos = e.pos; mousePos = e.pos;
OpaqueWidget::onHover(e); OpaqueWidget::onHover(e);
} }


void RackWidget::onHoverKey(const event::HoverKey& e) {
void RackWidget::onHoverKey(const HoverKeyEvent& e) {
OpaqueWidget::onHoverKey(e); OpaqueWidget::onHoverKey(e);
if (e.isConsumed()) if (e.isConsumed())
return; 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() // Set before calling children's onDragHover()
mousePos = e.pos; mousePos = e.pos;
OpaqueWidget::onDragHover(e); OpaqueWidget::onDragHover(e);
} }


void RackWidget::onButton(const event::Button& e) {
void RackWidget::onButton(const ButtonEvent& e) {
Widget::onButton(e); Widget::onButton(e);
e.stopPropagating(); e.stopPropagating();
if (e.isConsumed()) if (e.isConsumed())


+ 4
- 4
src/app/Scene.cpp View File

@@ -94,7 +94,7 @@ void Scene::draw(const DrawArgs& args) {
Widget::draw(args); Widget::draw(args);
} }


void Scene::onHover(const event::Hover& e) {
void Scene::onHover(const HoverEvent& e) {
mousePos = e.pos; mousePos = e.pos;
if (mousePos.y < menuBar->box.size.y) { if (mousePos.y < menuBar->box.size.y) {
menuBar->show(); menuBar->show();
@@ -102,12 +102,12 @@ void Scene::onHover(const event::Hover& e) {
OpaqueWidget::onHover(e); OpaqueWidget::onHover(e);
} }


void Scene::onDragHover(const event::DragHover& e) {
void Scene::onDragHover(const DragHoverEvent& e) {
mousePos = e.pos; mousePos = e.pos;
OpaqueWidget::onDragHover(e); OpaqueWidget::onDragHover(e);
} }


void Scene::onHoverKey(const event::HoverKey& e) {
void Scene::onHoverKey(const HoverKeyEvent& e) {
OpaqueWidget::onHoverKey(e); OpaqueWidget::onHoverKey(e);
if (e.isConsumed()) if (e.isConsumed())
return; 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) { if (e.paths.size() >= 1) {
const std::string& path = e.paths[0]; const std::string& path = e.paths[0];
if (system::getExtension(path) == ".vcv") { if (system::getExtension(path) == ".vcv") {


+ 2
- 2
src/app/SliderKnob.cpp View File

@@ -9,12 +9,12 @@ SliderKnob::SliderKnob() {
forceLinear = true; forceLinear = true;
} }


void SliderKnob::onHover(const event::Hover& e) {
void SliderKnob::onHover(const HoverEvent& e) {
// Bypass Knob's circular hitbox detection // Bypass Knob's circular hitbox detection
ParamWidget::onHover(e); ParamWidget::onHover(e);
} }


void SliderKnob::onButton(const event::Button& e) {
void SliderKnob::onButton(const ButtonEvent& e) {
ParamWidget::onButton(e); ParamWidget::onButton(e);
} }




+ 4
- 4
src/app/SvgButton.cpp View File

@@ -30,7 +30,7 @@ void SvgButton::addFrame(std::shared_ptr<Svg> svg) {
} }
} }


void SvgButton::onDragStart(const event::DragStart& e) {
void SvgButton::onDragStart(const DragStartEvent& e) {
if (e.button != GLFW_MOUSE_BUTTON_LEFT) if (e.button != GLFW_MOUSE_BUTTON_LEFT)
return; 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) { if (frames.size() >= 1) {
sw->setSvg(frames[0]); sw->setSvg(frames[0]);
fb->dirty = true; fb->dirty = true;
} }
} }


void SvgButton::onDragDrop(const event::DragDrop& e) {
void SvgButton::onDragDrop(const DragDropEvent& e) {
if (e.origin == this) { if (e.origin == this) {
event::Action eAction;
ActionEvent eAction;
onAction(eAction); onAction(eAction);
} }
} }


+ 1
- 1
src/app/SvgKnob.cpp View File

@@ -31,7 +31,7 @@ void SvgKnob::setSvg(std::shared_ptr<Svg> svg) {
// shadow->box = shadow->box.grow(math::Vec(2, 2)); // 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 // Re-transform the widget::TransformWidget
engine::ParamQuantity* pq = getParamQuantity(); engine::ParamQuantity* pq = getParamQuantity();
if (pq) { if (pq) {


+ 1
- 1
src/app/SvgSlider.cpp View File

@@ -30,7 +30,7 @@ void SvgSlider::setHandleSvg(std::shared_ptr<Svg> svg) {
fb->dirty = true; fb->dirty = true;
} }


void SvgSlider::onChange(const event::Change& e) {
void SvgSlider::onChange(const ChangeEvent& e) {
engine::ParamQuantity* pq = getParamQuantity(); engine::ParamQuantity* pq = getParamQuantity();
if (pq) { if (pq) {
// Interpolate handle position // Interpolate handle position


+ 1
- 1
src/app/SvgSwitch.cpp View File

@@ -30,7 +30,7 @@ void SvgSwitch::addFrame(std::shared_ptr<Svg> svg) {
} }
} }


void SvgSwitch::onChange(const event::Change& e) {
void SvgSwitch::onChange(const ChangeEvent& e) {
engine::ParamQuantity* pq = getParamQuantity(); engine::ParamQuantity* pq = getParamQuantity();
if (!frames.empty() && pq) { if (!frames.empty() && pq) {
int index = (int) std::round(pq->getValue() - pq->getMinValue()); int index = (int) std::round(pq->getValue() - pq->getMinValue());


+ 3
- 3
src/app/Switch.cpp View File

@@ -37,11 +37,11 @@ void Switch::step() {
ParamWidget::step(); ParamWidget::step();
} }


void Switch::onDoubleClick(const event::DoubleClick& e) {
void Switch::onDoubleClick(const DoubleClickEvent& e) {
// Don't reset parameter on double-click // 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) if (e.button != GLFW_MOUSE_BUTTON_LEFT)
return; 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) if (e.button != GLFW_MOUSE_BUTTON_LEFT)
return; return;




+ 4
- 4
src/app/TipWindow.cpp View File

@@ -18,7 +18,7 @@ namespace app {


struct UrlButton : ui::Button { struct UrlButton : ui::Button {
std::string url; std::string url;
void onAction(const event::Action& e) override {
void onAction(const ActionEvent& e) override {
std::thread t([=] { std::thread t([=] {
system::openBrowser(url); system::openBrowser(url);
}); });
@@ -108,7 +108,7 @@ struct TipWindow : widget::OpaqueWidget {


struct PreviousButton : ui::Button { struct PreviousButton : ui::Button {
TipWindow* tipWindow; TipWindow* tipWindow;
void onAction(const event::Action& e) override {
void onAction(const ActionEvent& e) override {
tipWindow->advanceTip(-1); tipWindow->advanceTip(-1);
} }
}; };
@@ -120,7 +120,7 @@ struct TipWindow : widget::OpaqueWidget {


struct NextButton : ui::Button { struct NextButton : ui::Button {
TipWindow* tipWindow; TipWindow* tipWindow;
void onAction(const event::Action& e) override {
void onAction(const ActionEvent& e) override {
tipWindow->advanceTip(); tipWindow->advanceTip();
} }
}; };
@@ -132,7 +132,7 @@ struct TipWindow : widget::OpaqueWidget {


struct CloseButton : ui::Button { struct CloseButton : ui::Button {
TipWindow* tipWindow; TipWindow* tipWindow;
void onAction(const event::Action& e) override {
void onAction(const ActionEvent& e) override {
tipWindow->getParent()->requestDelete(); tipWindow->getParent()->requestDelete();
} }
}; };


+ 2
- 2
src/core/AudioInterface.cpp View File

@@ -562,7 +562,7 @@ struct AudioInterfaceWidget : ModuleWidget {


struct PrimaryModuleItem : MenuItem { struct PrimaryModuleItem : MenuItem {
TAudioInterface* module; TAudioInterface* module;
void onAction(const event::Action& e) override {
void onAction(const ActionEvent& e) override {
module->setPrimary(); module->setPrimary();
} }
}; };
@@ -575,7 +575,7 @@ struct AudioInterfaceWidget : ModuleWidget {


struct DCFilterItem : MenuItem { struct DCFilterItem : MenuItem {
TAudioInterface* module; TAudioInterface* module;
void onAction(const event::Action& e) override {
void onAction(const ActionEvent& e) override {
module->dcFilterEnabled ^= true; module->dcFilterEnabled ^= true;
} }
}; };


+ 2
- 2
src/core/Blank.cpp View File

@@ -64,7 +64,7 @@ struct ModuleResizeHandle : OpaqueWidget {
box.size = Vec(RACK_GRID_WIDTH * 1, RACK_GRID_HEIGHT); 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) if (e.button != GLFW_MOUSE_BUTTON_LEFT)
return; return;


@@ -74,7 +74,7 @@ struct ModuleResizeHandle : OpaqueWidget {
originalBox = mw->box; originalBox = mw->box;
} }


void onDragMove(const event::DragMove& e) override {
void onDragMove(const DragMoveEvent& e) override {
ModuleWidget* mw = getAncestorOfType<ModuleWidget>(); ModuleWidget* mw = getAncestorOfType<ModuleWidget>();
assert(mw); assert(mw);




+ 2
- 2
src/core/CV_Gate.cpp View File

@@ -164,7 +164,7 @@ struct CV_Gate : Module {


struct CV_GateVelocityItem : MenuItem { struct CV_GateVelocityItem : MenuItem {
CV_Gate* module; CV_Gate* module;
void onAction(const event::Action& e) override {
void onAction(const ActionEvent& e) override {
module->velocityMode ^= true; module->velocityMode ^= true;
} }
}; };
@@ -172,7 +172,7 @@ struct CV_GateVelocityItem : MenuItem {


struct CV_GatePanicItem : MenuItem { struct CV_GatePanicItem : MenuItem {
CV_Gate* module; CV_Gate* module;
void onAction(const event::Action& e) override {
void onAction(const ActionEvent& e) override {
module->midiOutput.panic(); module->midiOutput.panic();
} }
}; };


+ 1
- 1
src/core/CV_MIDI.cpp View File

@@ -140,7 +140,7 @@ struct CV_MIDI : Module {


struct CV_MIDIPanicItem : MenuItem { struct CV_MIDIPanicItem : MenuItem {
CV_MIDI* module; CV_MIDI* module;
void onAction(const event::Action& e) override {
void onAction(const ActionEvent& e) override {
module->midiOutput.panic(); module->midiOutput.panic();
} }
}; };


+ 3
- 3
src/core/MIDI_CC.cpp View File

@@ -255,7 +255,7 @@ struct MIDI_CCWidget : ModuleWidget {


struct SmoothItem : MenuItem { struct SmoothItem : MenuItem {
MIDI_CC* module; MIDI_CC* module;
void onAction(const event::Action& e) override {
void onAction(const ActionEvent& e) override {
module->smooth ^= true; module->smooth ^= true;
} }
}; };
@@ -268,7 +268,7 @@ struct MIDI_CCWidget : ModuleWidget {


struct MpeModeItem : MenuItem { struct MpeModeItem : MenuItem {
MIDI_CC* module; MIDI_CC* module;
void onAction(const event::Action& e) override {
void onAction(const ActionEvent& e) override {
module->mpeMode ^= true; module->mpeMode ^= true;
} }
}; };
@@ -281,7 +281,7 @@ struct MIDI_CCWidget : ModuleWidget {


struct LSBItem : MenuItem { struct LSBItem : MenuItem {
MIDI_CC* module; MIDI_CC* module;
void onAction(const event::Action& e) override {
void onAction(const ActionEvent& e) override {
module->lsbEnabled ^= true; module->lsbEnabled ^= true;
} }
}; };


+ 5
- 5
src/core/MIDI_CV.cpp View File

@@ -515,7 +515,7 @@ struct MIDI_CVWidget : ModuleWidget {


struct SmoothItem : MenuItem { struct SmoothItem : MenuItem {
MIDI_CV* module; MIDI_CV* module;
void onAction(const event::Action& e) override {
void onAction(const ActionEvent& e) override {
module->smooth ^= true; module->smooth ^= true;
} }
}; };
@@ -529,7 +529,7 @@ struct MIDI_CVWidget : ModuleWidget {
struct ClockDivisionValueItem : MenuItem { struct ClockDivisionValueItem : MenuItem {
MIDI_CV* module; MIDI_CV* module;
int clockDivision; int clockDivision;
void onAction(const event::Action& e) override {
void onAction(const ActionEvent& e) override {
module->clockDivision = clockDivision; module->clockDivision = clockDivision;
} }
}; };
@@ -561,7 +561,7 @@ struct MIDI_CVWidget : ModuleWidget {
struct ChannelValueItem : MenuItem { struct ChannelValueItem : MenuItem {
MIDI_CV* module; MIDI_CV* module;
int channels; int channels;
void onAction(const event::Action& e) override {
void onAction(const ActionEvent& e) override {
module->setChannels(channels); module->setChannels(channels);
} }
}; };
@@ -594,7 +594,7 @@ struct MIDI_CVWidget : ModuleWidget {
struct PolyModeValueItem : MenuItem { struct PolyModeValueItem : MenuItem {
MIDI_CV* module; MIDI_CV* module;
MIDI_CV::PolyMode polyMode; MIDI_CV::PolyMode polyMode;
void onAction(const event::Action& e) override {
void onAction(const ActionEvent& e) override {
module->setPolyMode(polyMode); module->setPolyMode(polyMode);
} }
}; };
@@ -630,7 +630,7 @@ struct MIDI_CVWidget : ModuleWidget {


struct PanicItem : MenuItem { struct PanicItem : MenuItem {
MIDI_CV* module; MIDI_CV* module;
void onAction(const event::Action& e) override {
void onAction(const ActionEvent& e) override {
module->panic(); module->panic();
} }
}; };


+ 3
- 3
src/core/MIDI_Gate.cpp View File

@@ -183,7 +183,7 @@ struct MIDI_Gate : Module {


struct MIDI_GateVelocityItem : MenuItem { struct MIDI_GateVelocityItem : MenuItem {
MIDI_Gate* module; MIDI_Gate* module;
void onAction(const event::Action& e) override {
void onAction(const ActionEvent& e) override {
module->velocityMode ^= true; module->velocityMode ^= true;
} }
}; };
@@ -191,7 +191,7 @@ struct MIDI_GateVelocityItem : MenuItem {


struct MIDI_GateMpeModeItem : MenuItem { struct MIDI_GateMpeModeItem : MenuItem {
MIDI_Gate* module; MIDI_Gate* module;
void onAction(const event::Action& e) override {
void onAction(const ActionEvent& e) override {
module->mpeMode ^= true; module->mpeMode ^= true;
} }
}; };
@@ -199,7 +199,7 @@ struct MIDI_GateMpeModeItem : MenuItem {


struct MIDI_GatePanicItem : MenuItem { struct MIDI_GatePanicItem : MenuItem {
MIDI_Gate* module; MIDI_Gate* module;
void onAction(const event::Action& e) override {
void onAction(const ActionEvent& e) override {
module->panic(); module->panic();
} }
}; };


+ 4
- 4
src/core/MIDI_Map.cpp View File

@@ -301,7 +301,7 @@ struct MIDI_MapChoice : LedDisplayChoice {
this->module = module; this->module = module;
} }


void onButton(const event::Button& e) override {
void onButton(const ButtonEvent& e) override {
e.stopPropagating(); e.stopPropagating();
if (!module) if (!module)
return; return;
@@ -316,7 +316,7 @@ struct MIDI_MapChoice : LedDisplayChoice {
} }
} }


void onSelect(const event::Select& e) override {
void onSelect(const SelectEvent& e) override {
if (!module) if (!module)
return; return;


@@ -328,7 +328,7 @@ struct MIDI_MapChoice : LedDisplayChoice {
module->enableLearn(id); module->enableLearn(id);
} }


void onDeselect(const event::Deselect& e) override {
void onDeselect(const DeselectEvent& e) override {
if (!module) if (!module)
return; return;
// Check if a ParamWidget was touched // Check if a ParamWidget was touched
@@ -498,7 +498,7 @@ struct MIDI_MapWidget : ModuleWidget {


struct SmoothItem : MenuItem { struct SmoothItem : MenuItem {
MIDI_Map* module; MIDI_Map* module;
void onAction(const event::Action& e) override {
void onAction(const ActionEvent& e) override {
module->smooth ^= true; module->smooth ^= true;
} }
}; };


+ 1
- 1
src/core/Notes.cpp View File

@@ -48,7 +48,7 @@ struct NotesTextField : LedDisplayTextField {
module->dirty = false; module->dirty = false;
} }
} }
void onChange(const event::Change& e) override {
void onChange(const ChangeEvent& e) override {
if (module) if (module)
module->text = text; module->text = text;
} }


+ 10
- 10
src/core/plugin.hpp View File

@@ -101,7 +101,7 @@ struct CcChoice : LedDisplayChoice {
text = string::f("%d", cc); text = string::f("%d", cc);
} }


void onSelect(const event::Select& e) override {
void onSelect(const SelectEvent& e) override {
if (!module) if (!module)
return; return;
module->learningId = id; module->learningId = id;
@@ -109,7 +109,7 @@ struct CcChoice : LedDisplayChoice {
e.consume(this); e.consume(this);
} }


void onDeselect(const event::Deselect& e) override {
void onDeselect(const DeselectEvent& e) override {
if (!module) if (!module)
return; return;
if (module->learningId == id) { 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; int c = e.codepoint;
if ('0' <= c && c <= '9') { if ('0' <= c && c <= '9') {
if (focusCc < 0) if (focusCc < 0)
@@ -132,9 +132,9 @@ struct CcChoice : LedDisplayChoice {
e.consume(this); 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) { 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); onDeselect(eDeselect);
APP->event->selectedWidget = NULL; APP->event->selectedWidget = NULL;
e.consume(this); 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) if (!module)
return; return;
module->learningId = id; module->learningId = id;
@@ -201,7 +201,7 @@ struct NoteChoice : LedDisplayChoice {
e.consume(this); e.consume(this);
} }


void onDeselect(const event::Deselect& e) override {
void onDeselect(const DeselectEvent& e) override {
if (!module) if (!module)
return; return;
if (module->learningId == id) { 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; int c = e.codepoint;
if ('a' <= c && c <= 'g') { if ('a' <= c && c <= 'g') {
static const int majorNotes[7] = {9, 11, 0, 2, 4, 5, 7}; static const int majorNotes[7] = {9, 11, 0, 2, 4, 5, 7};
@@ -234,9 +234,9 @@ struct NoteChoice : LedDisplayChoice {
e.consume(this); 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) { 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); onDeselect(eDeselect);
APP->event->selectedWidget = NULL; APP->event->selectedWidget = NULL;
e.consume(this); e.consume(this);


+ 4
- 4
src/ui/Button.cpp View File

@@ -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()); 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) if (e.button != GLFW_MOUSE_BUTTON_LEFT)
return; return;


@@ -27,14 +27,14 @@ void Button::onDragStart(const event::DragStart& e) {
quantity->setMax(); quantity->setMax();
} }


void Button::onDragEnd(const event::DragEnd& e) {
void Button::onDragEnd(const DragEndEvent& e) {
if (quantity) if (quantity)
quantity->setMin(); quantity->setMin();
} }


void Button::onDragDrop(const event::DragDrop& e) {
void Button::onDragDrop(const DragDropEvent& e) {
if (e.origin == this) { if (e.origin == this) {
event::Action eAction;
ActionEvent eAction;
onAction(eAction); onAction(eAction);
} }
} }


+ 1
- 1
src/ui/Menu.cpp View File

@@ -58,7 +58,7 @@ void Menu::draw(const DrawArgs& args) {
Widget::draw(args); Widget::draw(args);
} }


void Menu::onHoverScroll(const event::HoverScroll& e) {
void Menu::onHoverScroll(const HoverScrollEvent& e) {
if (parent && !parent->box.contains(box)) if (parent && !parent->box.contains(box))
box.pos.y += e.scrollDelta.y; box.pos.y += e.scrollDelta.y;
} }


+ 4
- 4
src/ui/MenuItem.cpp View File

@@ -44,7 +44,7 @@ void MenuItem::step() {
Widget::step(); Widget::step();
} }


void MenuItem::onEnter(const event::Enter& e) {
void MenuItem::onEnter(const EnterEvent& e) {
Menu* parentMenu = dynamic_cast<Menu*>(parent); Menu* parentMenu = dynamic_cast<Menu*>(parent);
if (!parentMenu) if (!parentMenu)
return; return;
@@ -60,7 +60,7 @@ void MenuItem::onEnter(const event::Enter& e) {
parentMenu->setChildMenu(childMenu); parentMenu->setChildMenu(childMenu);
} }


void MenuItem::onDragDrop(const event::DragDrop& e) {
void MenuItem::onDragDrop(const DragDropEvent& e) {
if (e.origin != this) if (e.origin != this)
return; return;
doAction(); doAction();
@@ -71,7 +71,7 @@ void MenuItem::doAction() {
return; return;


widget::EventContext cAction; widget::EventContext cAction;
event::Action eAction;
ActionEvent eAction;
eAction.context = &cAction; eAction.context = &cAction;
// Consume event by default, but allow action to un-consume it to prevent the menu from being removed. // Consume event by default, but allow action to un-consume it to prevent the menu from being removed.
eAction.consume(this); eAction.consume(this);
@@ -86,7 +86,7 @@ void MenuItem::doAction() {
} }




void MenuItem::onAction(const event::Action& e) {
void MenuItem::onAction(const ActionEvent& e) {
} }






+ 5
- 5
src/ui/MenuOverlay.cpp View File

@@ -24,13 +24,13 @@ void MenuOverlay::step() {
} }




void MenuOverlay::onButton(const event::Button& e) {
void MenuOverlay::onButton(const ButtonEvent& e) {
OpaqueWidget::onButton(e); OpaqueWidget::onButton(e);
if (e.isConsumed() && e.getTarget() != this) if (e.isConsumed() && e.getTarget() != this)
return; return;


if (e.action == GLFW_PRESS) { if (e.action == GLFW_PRESS) {
event::Action eAction;
ActionEvent eAction;
onAction(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); OpaqueWidget::onHoverKey(e);
if (e.isConsumed()) if (e.isConsumed())
return; return;


if (e.action == GLFW_PRESS && e.key == GLFW_KEY_ESCAPE) { if (e.action == GLFW_PRESS && e.key == GLFW_KEY_ESCAPE) {
event::Action eAction;
ActionEvent eAction;
onAction(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(); requestDelete();
} }




+ 2
- 2
src/ui/OptionButton.cpp View File

@@ -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 (e.origin == this) {
if (quantity) if (quantity)
quantity->toggle(); quantity->toggle();


event::Action eAction;
ActionEvent eAction;
onAction(eAction); onAction(eAction);
} }
} }


+ 2
- 2
src/ui/RadioButton.cpp View File

@@ -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()); 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 (e.origin == this) {
if (quantity) { if (quantity) {
if (quantity->isMax()) if (quantity->isMax())
@@ -32,7 +32,7 @@ void RadioButton::onDragDrop(const event::DragDrop& e) {
quantity->setMax(); quantity->setMax();
} }


event::Action eAction;
ActionEvent eAction;
onAction(eAction); onAction(eAction);
} }
} }


+ 5
- 5
src/ui/ScrollWidget.cpp View File

@@ -88,7 +88,7 @@ void ScrollWidget::step() {
} }




void ScrollWidget::onButton(const event::Button& e) {
void ScrollWidget::onButton(const ButtonEvent& e) {
OpaqueWidget::onButton(e); OpaqueWidget::onButton(e);
if (e.isConsumed()) if (e.isConsumed())
return; 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 // Check if scrollable
math::Rect offsetBound = getContainerOffsetBound(); math::Rect offsetBound = getContainerOffsetBound();
if (offsetBound.size.x <= 0.f && offsetBound.size.y <= 0.f) 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) { if (e.button == GLFW_MOUSE_BUTTON_LEFT || e.button == GLFW_MOUSE_BUTTON_MIDDLE) {
math::Vec offsetDelta = e.mouseDelta.div(getAbsoluteZoom()); math::Vec offsetDelta = e.mouseDelta.div(getAbsoluteZoom());
offset = offset.minus(offsetDelta); 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); OpaqueWidget::onHoverScroll(e);
if (e.isConsumed()) if (e.isConsumed())
return; 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); OpaqueWidget::onHoverKey(e);
if (e.isConsumed()) if (e.isConsumed())
return; return;


+ 4
- 4
src/ui/Scrollbar.cpp View File

@@ -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) { if (e.button == GLFW_MOUSE_BUTTON_LEFT && e.action == GLFW_PRESS) {
ScrollWidget* sw = dynamic_cast<ScrollWidget*>(parent); ScrollWidget* sw = dynamic_cast<ScrollWidget*>(parent);
assert(sw); 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<ScrollWidget*>(parent); ScrollWidget* sw = dynamic_cast<ScrollWidget*>(parent);
assert(sw); assert(sw);




+ 4
- 4
src/ui/Slider.cpp View File

@@ -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); 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) if (e.button != GLFW_MOUSE_BUTTON_LEFT)
return; return;


APP->window->cursorLock(); APP->window->cursorLock();
} }


void Slider::onDragMove(const event::DragMove& e) {
void Slider::onDragMove(const DragMoveEvent& e) {
if (quantity) { if (quantity) {
quantity->moveScaledValue(SENSITIVITY * e.mouseDelta.x); quantity->moveScaledValue(SENSITIVITY * e.mouseDelta.x);
} }
} }


void Slider::onDragEnd(const event::DragEnd& e) {
void Slider::onDragEnd(const DragEndEvent& e) {
APP->window->cursorUnlock(); APP->window->cursorUnlock();
} }


void Slider::onDoubleClick(const event::DoubleClick& e) {
void Slider::onDoubleClick(const DoubleClickEvent& e) {
if (quantity) if (quantity)
quantity->reset(); quantity->reset();
} }


+ 12
- 12
src/ui/TextField.cpp View File

@@ -9,7 +9,7 @@ namespace ui {


struct TextFieldCopyItem : ui::MenuItem { struct TextFieldCopyItem : ui::MenuItem {
WeakPtr<TextField> textField; WeakPtr<TextField> textField;
void onAction(const event::Action& e) override {
void onAction(const ActionEvent& e) override {
if (!textField) if (!textField)
return; return;
textField->copyClipboard(); textField->copyClipboard();
@@ -20,7 +20,7 @@ struct TextFieldCopyItem : ui::MenuItem {


struct TextFieldCutItem : ui::MenuItem { struct TextFieldCutItem : ui::MenuItem {
WeakPtr<TextField> textField; WeakPtr<TextField> textField;
void onAction(const event::Action& e) override {
void onAction(const ActionEvent& e) override {
if (!textField) if (!textField)
return; return;
textField->cutClipboard(); textField->cutClipboard();
@@ -31,7 +31,7 @@ struct TextFieldCutItem : ui::MenuItem {


struct TextFieldPasteItem : ui::MenuItem { struct TextFieldPasteItem : ui::MenuItem {
WeakPtr<TextField> textField; WeakPtr<TextField> textField;
void onAction(const event::Action& e) override {
void onAction(const ActionEvent& e) override {
if (!textField) if (!textField)
return; return;
textField->pasteClipboard(); textField->pasteClipboard();
@@ -42,7 +42,7 @@ struct TextFieldPasteItem : ui::MenuItem {


struct TextFieldSelectAllItem : ui::MenuItem { struct TextFieldSelectAllItem : ui::MenuItem {
WeakPtr<TextField> textField; WeakPtr<TextField> textField;
void onAction(const event::Action& e) override {
void onAction(const ActionEvent& e) override {
if (!textField) if (!textField)
return; return;
textField->selectAll(); textField->selectAll();
@@ -77,7 +77,7 @@ void TextField::draw(const DrawArgs& args) {
nvgResetScissor(args.vg); nvgResetScissor(args.vg);
} }


void TextField::onDragHover(const event::DragHover& e) {
void TextField::onDragHover(const DragHoverEvent& e) {
OpaqueWidget::onDragHover(e); OpaqueWidget::onDragHover(e);


if (e.origin == this) { 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); OpaqueWidget::onButton(e);


if (e.action == GLFW_PRESS && e.button == GLFW_MOUSE_BUTTON_LEFT) { 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) { if (e.codepoint < 128) {
std::string newText(1, (char) e.codepoint); std::string newText(1, (char) e.codepoint);
insertText(newText); insertText(newText);
@@ -107,7 +107,7 @@ void TextField::onSelectText(const event::SelectText& e) {
e.consume(this); 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) { if (e.action == GLFW_PRESS || e.action == GLFW_REPEAT) {
// Backspace // Backspace
if (e.key == GLFW_KEY_BACKSPACE && (e.mods & RACK_MOD_MASK) == 0) { 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"); insertText("\n");
} }
else { else {
event::Action eAction;
ActionEvent eAction;
onAction(eAction); onAction(eAction);
} }
e.consume(this); e.consume(this);
@@ -249,8 +249,8 @@ std::string TextField::getText() {
void TextField::setText(std::string text) { void TextField::setText(std::string text) {
if (this->text != text) { if (this->text != text) {
this->text = text; this->text = text;
// event::Change
event::Change eChange;
// ChangeEvent
ChangeEvent eChange;
onChange(eChange); onChange(eChange);
} }
selection = cursor = text.size(); selection = cursor = text.size();
@@ -284,7 +284,7 @@ void TextField::insertText(std::string text) {
changed = true; changed = true;
} }
if (changed) { if (changed) {
event::Change eChange;
ChangeEvent eChange;
onChange(eChange); onChange(eChange);
} }
} }


+ 1
- 1
src/widget/FramebufferWidget.cpp View File

@@ -49,7 +49,7 @@ void FramebufferWidget::setDirty(bool dirty) {
} }




void FramebufferWidget::onDirty(const event::Dirty& e) {
void FramebufferWidget::onDirty(const DirtyEvent& e) {
dirty = true; dirty = true;
Widget::onDirty(e); Widget::onDirty(e);
} }


+ 9
- 9
src/widget/Widget.cpp View File

@@ -36,7 +36,7 @@ void Widget::setPosition(math::Vec pos) {
return; return;
box.pos = pos; box.pos = pos;
// Trigger Reposition event // Trigger Reposition event
event::Reposition eReposition;
RepositionEvent eReposition;
onReposition(eReposition); onReposition(eReposition);
} }


@@ -51,7 +51,7 @@ void Widget::setSize(math::Vec size) {
return; return;
box.size = size; box.size = size;
// Trigger Resize event // Trigger Resize event
event::Resize eResize;
ResizeEvent eResize;
onResize(eResize); onResize(eResize);
} }


@@ -72,12 +72,12 @@ void Widget::setVisible(bool visible) {
this->visible = visible; this->visible = visible;
if (visible) { if (visible) {
// Trigger Show event // Trigger Show event
event::Show eShow;
ShowEvent eShow;
onShow(eShow); onShow(eShow);
} }
else { else {
// Trigger Hide event // Trigger Hide event
event::Hide eHide;
HideEvent eHide;
onHide(eHide); onHide(eHide);
} }
} }
@@ -151,7 +151,7 @@ void Widget::addChild(Widget* child) {
child->parent = this; child->parent = this;
children.push_back(child); children.push_back(child);
// Trigger Add event // Trigger Add event
event::Add eAdd;
AddEvent eAdd;
child->onAdd(eAdd); child->onAdd(eAdd);
} }


@@ -162,7 +162,7 @@ void Widget::addChildBottom(Widget* child) {
child->parent = this; child->parent = this;
children.push_front(child); children.push_front(child);
// Trigger Add event // Trigger Add event
event::Add eAdd;
AddEvent eAdd;
child->onAdd(eAdd); child->onAdd(eAdd);
} }


@@ -172,7 +172,7 @@ void Widget::removeChild(Widget* child) {
// Make sure `this` is the child's parent // Make sure `this` is the child's parent
assert(child->parent == this); assert(child->parent == this);
// Trigger Remove event // Trigger Remove event
event::Remove eRemove;
RemoveEvent eRemove;
child->onRemove(eRemove); child->onRemove(eRemove);
// Prepare to remove widget from the event state // Prepare to remove widget from the event state
APP->event->finalizeWidget(child); APP->event->finalizeWidget(child);
@@ -188,7 +188,7 @@ void Widget::removeChild(Widget* child) {
void Widget::clearChildren() { void Widget::clearChildren() {
for (Widget* child : children) { for (Widget* child : children) {
// Trigger Remove event // Trigger Remove event
event::Remove eRemove;
RemoveEvent eRemove;
child->onRemove(eRemove); child->onRemove(eRemove);
APP->event->finalizeWidget(child); APP->event->finalizeWidget(child);
child->parent = NULL; child->parent = NULL;
@@ -204,7 +204,7 @@ void Widget::step() {
// Delete children if a delete is requested // Delete children if a delete is requested
if (child->requestedDelete) { if (child->requestedDelete) {
// Trigger Remove event // Trigger Remove event
event::Remove eRemove;
RemoveEvent eRemove;
child->onRemove(eRemove); child->onRemove(eRemove);
APP->event->finalizeWidget(child); APP->event->finalizeWidget(child);
it = children.erase(it); it = children.erase(it);


+ 1
- 1
src/widget/ZoomWidget.cpp View File

@@ -34,7 +34,7 @@ void ZoomWidget::setZoom(float zoom) {


// Trigger Dirty event // Trigger Dirty event
widget::EventContext cDirty; widget::EventContext cDirty;
event::Dirty eDirty;
DirtyEvent eDirty;
eDirty.context = &cDirty; eDirty.context = &cDirty;
Widget::onDirty(eDirty); Widget::onDirty(eDirty);
} }


Loading…
Cancel
Save