diff options
author | André Nusser <andre.nusser@googlemail.com> | 2018-06-08 16:40:01 +0200 |
---|---|---|
committer | André Nusser <andre.nusser@googlemail.com> | 2018-06-08 16:40:01 +0200 |
commit | 42003bd802d868182bf040e86f2cf2773b8ee851 (patch) | |
tree | 86c345b86d0d7567ee1301fb28f20bcc11e80f97 /plugingui/knob.cc | |
parent | c00110f801ae9de05a7f4c250918e4c05588b1d9 (diff) |
Add reset on double click for all the knobs.
Diffstat (limited to 'plugingui/knob.cc')
-rw-r--r-- | plugingui/knob.cc | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/plugingui/knob.cc b/plugingui/knob.cc index 4082aa3..8e60056 100644 --- a/plugingui/knob.cc +++ b/plugingui/knob.cc @@ -61,6 +61,11 @@ void Knob::setValue(float value) internalSetValue(value); } +void Knob::setDefaultValue(float value) +{ + default_value = value; +} + void Knob::setRange(float minimum, float maximum) { this->minimum = minimum; @@ -145,10 +150,16 @@ void Knob::buttonEvent(ButtonEvent* buttonEvent) return; } + if (buttonEvent->doubleClick) { + internalSetValue(default_value); + return; + } + if(buttonEvent->direction == Direction::down) { state = down; mouse_offset_x = buttonEvent->x + (-1 * buttonEvent->y); + return; } if(buttonEvent->direction == Direction::up) @@ -156,6 +167,7 @@ void Knob::buttonEvent(ButtonEvent* buttonEvent) state = up; mouse_offset_x = buttonEvent->x + (-1 * buttonEvent->y); clicked(); + return; } } |