X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=gtk2_ardour%2Fkeyboard.h;h=e34c424329f3e0761ffd5325be2d7421b8d86b28;hb=ccf58b8de23619db9983a45f696fd97e13a15cce;hp=de2a0929ed4c50dcb74600cdcde7b526fed9d37c;hpb=997e4b1f9cd7ccfc704b7c035051da7f60d831e7;p=ardour.git diff --git a/gtk2_ardour/keyboard.h b/gtk2_ardour/keyboard.h index de2a0929ed..e34c424329 100644 --- a/gtk2_ardour/keyboard.h +++ b/gtk2_ardour/keyboard.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2001 Paul Davis + Copyright (C) 2001 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -20,20 +20,19 @@ #ifndef __ardour_keyboard_h__ #define __ardour_keyboard_h__ +#include #include #include #include #include +#include -#include -#include +#include "ardour/types.h" +#include "pbd/stateful.h" #include "selection.h" -using std::vector; -using std::string; - class Keyboard : public sigc::trackable, PBD::Stateful { public: @@ -41,9 +40,9 @@ class Keyboard : public sigc::trackable, PBD::Stateful ~Keyboard (); XMLNode& get_state (void); - int set_state (const XMLNode&); + int set_state (const XMLNode&, int version); - typedef vector State; + typedef std::vector State; typedef uint32_t ModifierMask; static uint32_t PrimaryModifier; @@ -91,6 +90,11 @@ class Keyboard : public sigc::trackable, PBD::Stateful static bool no_modifiers_active (guint state); static void set_snap_modifier (guint); + + /** @return Modifier mask to temporarily toggle grid setting; with this modifier + * - magnetic or normal grid should become no grid and + * - no grid should become normal grid + */ static ModifierMask snap_modifier () { return ModifierMask (snap_mod); } static guint edit_button() { return edit_but; } @@ -106,6 +110,7 @@ class Keyboard : public sigc::trackable, PBD::Stateful static bool is_edit_event (GdkEventButton*); static bool is_delete_event (GdkEventButton*); static bool is_context_menu_event (GdkEventButton*); + static bool is_button2_event (GdkEventButton*); static Keyboard& the_keyboard() { return *_the_keyboard; } @@ -114,12 +119,23 @@ class Keyboard : public sigc::trackable, PBD::Stateful static void magic_widget_drop_focus (); static void setup_keybindings (); + 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 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; @@ -131,11 +147,17 @@ class Keyboard : public sigc::trackable, PBD::Stateful static guint delete_but; static guint delete_mod; static guint snap_mod; + static guint button2_modifiers; static Gtk::Window* current_window; static std::string user_keybindings_path; static bool can_save_keybindings; + static bool bindings_changed_after_save_became_legal; static std::string _current_binding_name; + typedef std::pair two_strings; + + static std::map release_keys; + static gint _snooper (GtkWidget*, GdkEventKey*, gpointer); gint snooper (GtkWidget*, GdkEventKey*);