summaryrefslogtreecommitdiff
path: root/plugingui/slider.cc
diff options
context:
space:
mode:
authorBent Bisballe Nyeng <deva@aasimon.org>2013-03-06 09:30:52 +0100
committerBent Bisballe Nyeng <deva@aasimon.org>2013-03-06 09:30:52 +0100
commita0b7282b31ed31051ee98bf16e8704d5599e5461 (patch)
tree49798ac70adbac0e065781833f045bab8a65bb0b /plugingui/slider.cc
parentdff2ff5b636d9d7007bf8589204e6a7138ee4004 (diff)
Major GUI workover. Hilights: A new filebrowser and new knob widget.
Diffstat (limited to 'plugingui/slider.cc')
-rw-r--r--plugingui/slider.cc14
1 files changed, 13 insertions, 1 deletions
diff --git a/plugingui/slider.cc b/plugingui/slider.cc
index b58bde9..953c8e6 100644
--- a/plugingui/slider.cc
+++ b/plugingui/slider.cc
@@ -66,6 +66,10 @@ void GUI::Slider::mouseMoveEvent(MouseMoveEvent *e)
{
if(state == down) {
val = maximum / (float)width() * (float)e->x;
+
+ if(val < 0) val = 0;
+ if(val > 1) val = 1;
+
if(handler) handler(ptr);
repaintEvent(NULL);
}
@@ -76,12 +80,20 @@ void GUI::Slider::buttonEvent(ButtonEvent *e)
if(e->direction == 1) {
state = down;
val = maximum / (float)width() * (float)e->x;
+
+ if(val < 0) val = 0;
+ if(val > 1) val = 1;
+
if(handler) handler(ptr);
repaintEvent(NULL);
}
if(e->direction == -1) {
state = up;
val = maximum / (float)width() * (float)e->x;
+
+ if(val < 0) val = 0;
+ if(val > 1) val = 1;
+
repaintEvent(NULL);
clicked();
if(handler) handler(ptr);
@@ -90,7 +102,7 @@ void GUI::Slider::buttonEvent(ButtonEvent *e)
void GUI::Slider::repaintEvent(GUI::RepaintEvent *e)
{
- DEBUG(slider, "Slider::repaintEvent (%f)\n", val);
+ //DEBUG(slider, "Slider::repaintEvent (%f)\n", val);
Painter p(this);