radically change Keyboard/Binding API design to disconnect Gtk::Action lookup from...
[ardour.git] / libs / gtkmm2ext / gtkmm2ext / keyboard.h
index 4319c9a4f606acf86854bb4ebb9e02c434ac7ceb..48a1bdcaad2b2817c16cef6b80e658610102c072 100644 (file)
@@ -29,6 +29,7 @@
 #include <gtkmm/accelkey.h>
 
 #include "pbd/stateful.h"
+#include "pbd/signals.h"
 
 #include "gtkmm2ext/visibility.h"
 
@@ -38,6 +39,8 @@ namespace Gtk {
 
 namespace Gtkmm2ext {
 
+class Bindings;
+
 class LIBGTKMM2EXT_API Keyboard : public sigc::trackable, PBD::Stateful
 {
   public:
@@ -161,25 +164,23 @@ class LIBGTKMM2EXT_API Keyboard : public sigc::trackable, PBD::Stateful
 
        static void keybindings_changed ();
        static void save_keybindings ();
-       static bool load_keybindings (std::string path);
        static void set_can_save_keybindings (bool yn);
        static std::string current_binding_name () { return _current_binding_name; }
        static std::map<std::string,std::string> binding_files;
 
-       int reset_bindings ();
+        static bool catch_user_event_for_pre_dialog_focus (GdkEvent* ev, Gtk::Window* w);
 
-       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();
-                   }
-           }
-       };
+       static bool load_keybindings (std::string const& path);
+       static void save_keybindings (std::string const& path);
+
+       int reset_bindings ();
 
        sigc::signal0<void> ZoomVerticalModifierReleased;
 
+       static std::vector<Bindings*> bindings;
+       static Bindings* get_bindings (std::string const& name);
+       static PBD::Signal0<void> BindingsChanged;
+
   protected:
        static Keyboard* _the_keyboard;
 
@@ -203,14 +204,17 @@ class LIBGTKMM2EXT_API Keyboard : public sigc::trackable, PBD::Stateful
 
        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*);
 
        static void set_modifier (uint32_t newval, uint32_t& variable);
 
        static bool _some_magic_widget_has_focus;
+
+        static Gtk::Window* pre_dialog_active_window;
+
+       static int read_keybindings (std::string const& path);
+       static int store_keybindings (std::string const& path);
 };
 
 } /* namespace */