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