commit 135f4ec8466a49f764f9a45c5e93472dba2330fd
parent f57f7119ff9ad6ce497823d7729c0dc616475984
Author: Matt Demanett <matt@demanett.net>
Date: Fri, 17 May 2019 22:53:09 -0400
v1: events.
Diffstat:
5 files changed, 18 insertions(+), 9 deletions(-)
diff --git a/src/Walk2.cpp b/src/Walk2.cpp
@@ -145,7 +145,11 @@ struct Walk2Display : TransparentWidget {
{
}
- void onMouseDown(EventMouseDown& e) override {
+ void onButton(const event::Button& e) override {
+ if (!(if (e.action == GLFW_PRESS && e.button == GLFW_MOUSE_BUTTON_LEFT && (e.mods & RACK_MOD_MASK) == 0)) {
+ return;
+ }
+
if (
e.pos.x > _insetAround &&
e.pos.x < _size.x - _insetAround &&
diff --git a/src/mixer.cpp b/src/mixer.cpp
@@ -73,7 +73,12 @@ void SoloMuteButton::step() {
FramebufferWidget::step();
}
-void SoloMuteButton::onMouseDown(EventMouseDown& e) {
+void SoloMuteButton::onButton(const event::Button& e) {
+ // FIXME.v1
+ if (!(if (e.action == GLFW_PRESS /*&& e.button == GLFW_MOUSE_BUTTON_LEFT*/ && (e.mods & RACK_MOD_MASK) == 0)) {
+ return;
+ }
+
if (value >= 2.0f) {
setValue(value - 2.0f);
}
@@ -88,7 +93,7 @@ void SoloMuteButton::onMouseDown(EventMouseDown& e) {
e.target = this;
}
-void SoloMuteButton::onChange(EventChange &e) {
+void SoloMuteButton::onChange(const event::Change& e) {
assert(_frames.size() == 4);
assert(value >= 0.0f && value <= 3.0f);
_svgWidget->setSVG(_frames[(int)value]);
diff --git a/src/mixer.hpp b/src/mixer.hpp
@@ -72,8 +72,8 @@ struct SoloMuteButton : ParamWidget, FramebufferWidget {
SoloMuteButton();
void step() override;
- void onMouseDown(EventMouseDown& e) override;
- void onChange(EventChange &e) override;
+ void onButton(const event::Button& e) override;
+ void onChange(const event::Change& e) override;
};
} // namespace bogaudio
diff --git a/src/widgets.cpp b/src/widgets.cpp
@@ -104,7 +104,7 @@ void StatefulButton::step() {
FramebufferWidget::step();
}
-void StatefulButton::onDragStart(EventDragStart& e) {
+void StatefulButton::onDragStart(const event::DragStart& e) {
_svgWidget->setSVG(_frames[1]);
dirty = true;
@@ -116,7 +116,7 @@ void StatefulButton::onDragStart(EventDragStart& e) {
}
}
-void StatefulButton::onDragEnd(EventDragEnd& e) {
+void StatefulButton::onDragEnd(const event::End& e) {
_svgWidget->setSVG(_frames[0]);
dirty = true;
}
diff --git a/src/widgets.hpp b/src/widgets.hpp
@@ -66,8 +66,8 @@ struct StatefulButton : ParamWidget, FramebufferWidget {
StatefulButton(const char* offSVGPath, const char* onSVGPath);
void step() override;
- void onDragStart(EventDragStart& e) override;
- void onDragEnd(EventDragEnd& e) override;
+ void onDragStart(const event::DragStart& e) override;
+ void onDragEnd(const event::DragEnd& e) override;
};
struct StatefulButton9 : StatefulButton {