commit f5587fd81b614d737a93f800a4ba4e85addd8aed
parent 610292f4d73b22c5ec7e8c56ad3e80d1decc1f29
Author: fundamental <[email protected]>
Date: Tue, 6 May 2014 15:43:40 -0400
UI: Add Mousewheel support
Add mouse wheel support for knobs and sliders.
Adapted from a patch by Christopher Oliver
Diffstat:
3 files changed, 19 insertions(+), 4 deletions(-)
diff --git a/AUTHORS.txt b/AUTHORS.txt
@@ -25,7 +25,7 @@ Contributors:
Jonathan Liles (NSM & NTK support)
Johannes Lorenz (Effect Documentation)
Ilario Glasgo (Italian Doc Translation)
- Christopher Oliver (Unison Regrssion Fix, presets fix)
+ Christopher Oliver (Unison + presets fix, mousewheel support)
Filipe Coelho (Globals Cleanup)
Andre Sklenar (UI Pixmaps)
diff --git a/src/UI/SUBnoteUI.fl b/src/UI/SUBnoteUI.fl
@@ -46,7 +46,7 @@ class SUBnoteharmonic {: {public Fl_Group}
} {
Fl_Slider mag {
callback {int x=0;
-if (Fl::event_button1()) x=127-(int)o->value();
+if (Fl::event_button1() || Fl::event() == FL_MOUSEWHEEL) x=127-(int)o->value();
else o->value(127-x);
pars->Phmag[n]=x;
if (pars->Phmag[n]==0) o->selection_color(0);
@@ -57,7 +57,7 @@ if (pars->Phmag[n]==0) o->selection_color(0);
}
Fl_Slider bw {
callback {int x=64;
-if (Fl::event_button1()) x=127-(int)o->value();
+if (Fl::event_button1() || Fl::event() == FL_MOUSEWHEEL) x=127-(int)o->value();
else o->value(x);
pars->Phrelbw[n]=x;}
tooltip {harmonic's bandwidth} xywh {0 135 10 75} type {Vert Knob} box FLAT_BOX selection_color 222 maximum 127 step 1 value 64
diff --git a/src/UI/WidgetPDial.cpp b/src/UI/WidgetPDial.cpp
@@ -126,7 +126,6 @@ int WidgetPDial::handle(int event)
oldvalue = value();
case FL_DRAG:
getPos();
- tipwin->showValue(value());
my = -(Fl::event_y() - y() - h() / 2);
dragsize = 200.0f;
@@ -134,6 +133,22 @@ int WidgetPDial::handle(int event)
dragsize *= 10;
value(limit(oldvalue + my / dragsize * (max - min), min, max));
+ tipwin->showValue(value());
+ value_damage();
+ if(this->when() != 0)
+ do_callback();
+ return 1;
+ case FL_MOUSEWHEEL:
+ if (Fl::belowmouse() != this)
+ return 1;
+ my = - Fl::event_dy();
+
+ dragsize = 200.0f;
+ if(Fl::event_state(FL_CTRL) != 0)
+ dragsize *= 10;
+
+ value(limit(value() + my / dragsize * (max - min), min, max));
+ tipwin->showValue(value());
value_damage();
if(this->when() != 0)
do_callback();