diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2008-05-06 05:38:24 +0000 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2008-05-06 05:38:24 +0000 |
commit | 4728e1ec1f8e118c0e28a2a353e308170d1b6448 (patch) | |
tree | 75f7e23d3491ab39470927f42f7c3f158534b2bf /gtk2_ardour/keyboard.h | |
parent | 734eb6e6eceb7b162e6d420fd4c8ddfe568a9238 (diff) |
now with extra-yummy key-release binding semantics, specially for visual state stuff, but potentially useful for momentary actions etc. Remove ~/.ardour2/ardour.bindings to see the effect for visual-state
git-svn-id: svn://localhost/ardour2/branches/2.0-ongoing@3318 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'gtk2_ardour/keyboard.h')
-rw-r--r-- | gtk2_ardour/keyboard.h | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/gtk2_ardour/keyboard.h b/gtk2_ardour/keyboard.h index 25955935f3..175208a434 100644 --- a/gtk2_ardour/keyboard.h +++ b/gtk2_ardour/keyboard.h @@ -20,19 +20,20 @@ #ifndef __ardour_keyboard_h__ #define __ardour_keyboard_h__ +#include <map> #include <vector> #include <string> #include <sigc++/signal.h> #include <gtk/gtk.h> #include <gtkmm/window.h> +#include <gtkmm/accelkey.h> #include <ardour/types.h> #include <pbd/stateful.h> #include "selection.h" -using std::vector; using std::string; class Keyboard : public sigc::trackable, Stateful @@ -44,7 +45,7 @@ class Keyboard : public sigc::trackable, Stateful XMLNode& get_state (void); int set_state (const XMLNode&); - typedef vector<uint32_t> State; + typedef std::vector<uint32_t> State; typedef uint32_t ModifierMask; static uint32_t PrimaryModifier; @@ -121,6 +122,16 @@ class Keyboard : public sigc::trackable, Stateful static std::string current_binding_name () { return _current_binding_name; } static std::map<std::string,std::string> binding_files; + struct AccelKeyLess { + bool operator() (const Gtk::AccelKey a, const Gtk::AccelKey b) const { + if (a.get_key() != b.get_key()) { + return a.get_key() < b.get_key(); + } else { + return a.get_mod() < b.get_mod(); + } + } + }; + private: static Keyboard* _the_keyboard; @@ -137,6 +148,10 @@ class Keyboard : public sigc::trackable, Stateful static bool can_save_keybindings; static std::string _current_binding_name; + typedef std::pair<std::string,std::string> two_strings; + + static std::map<Gtk::AccelKey,two_strings,AccelKeyLess> release_keys; + static gint _snooper (GtkWidget*, GdkEventKey*, gpointer); gint snooper (GtkWidget*, GdkEventKey*); |