diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2015-12-01 13:15:38 -0500 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2015-12-01 13:15:38 -0500 |
commit | 37961a6bbe1b5be2df66844a71890ca1d50757dd (patch) | |
tree | 989520e07cbe5ecf50a41155c7b9f83bc3d08913 /libs/surfaces/faderport/faderport.h | |
parent | 03a4926790b04d4f3929e88240fcddca76f24fd4 (diff) |
faderport: switch long-press mechanism to a timeout
This makes the long press action fire after the timeout even if the user is still holding the button,
which feels more satisfactory
Diffstat (limited to 'libs/surfaces/faderport/faderport.h')
-rw-r--r-- | libs/surfaces/faderport/faderport.h | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/libs/surfaces/faderport/faderport.h b/libs/surfaces/faderport/faderport.h index 5b7f471b5a..f2ec81d597 100644 --- a/libs/surfaces/faderport/faderport.h +++ b/libs/surfaces/faderport/faderport.h @@ -22,6 +22,7 @@ #include <list> #include <map> +#include <set> #include <glibmm/threads.h> #define ABSTRACT_UI_EXPORTS @@ -215,8 +216,6 @@ class FaderPort : public ARDOUR::ControlProtocol, public AbstractUI<FaderPortReq , out (o) , led_on (false) , flash (false) - , pressed_at (0) - , long_press (false) {} void set_action (std::string const& action_name, bool on_press, FaderPort::ButtonState = ButtonState (0)); @@ -227,11 +226,12 @@ class FaderPort : public ARDOUR::ControlProtocol, public AbstractUI<FaderPortReq void invoke (ButtonState bs, bool press); bool uses_flash () const { return flash; } void set_flash (bool yn) { flash = yn; } - void do_timing (bool press); XMLNode& get_state () const; int set_state (XMLNode const&); + sigc::connection timeout_connection; + private: FaderPort& fp; std::string name; @@ -239,8 +239,6 @@ class FaderPort : public ARDOUR::ControlProtocol, public AbstractUI<FaderPortReq int out; bool led_on; bool flash; - ARDOUR::microseconds_t pressed_at; - bool long_press; struct ToDo { ActionType type; @@ -261,6 +259,11 @@ class FaderPort : public ARDOUR::ControlProtocol, public AbstractUI<FaderPortReq ButtonMap buttons; Button& get_button (ButtonID) const; + std::set<ButtonID> buttons_down; + + bool button_long_press_timeout (ButtonID id); + void start_press_timeout (Button&, ButtonID); + void all_lights_out (); void close (); void start_midi_handling (); |