X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=gtk2_ardour%2Fkeyboard.h;h=6a689567e54e67b4b6d8468052f682b91fce00ba;hb=378ea3430ff5cb8131ebbd93c8126ba6c46416f0;hp=c13b06afe50f6dad2ff204fda0926303b713e297;hpb=79986643c0c904f6574bb5323e2233a43a9e622e;p=ardour.git diff --git a/gtk2_ardour/keyboard.h b/gtk2_ardour/keyboard.h index c13b06afe5..6a689567e5 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 @@ -15,119 +15,28 @@ along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - $Id$ */ #ifndef __ardour_keyboard_h__ #define __ardour_keyboard_h__ -#include -#include - -#include -#include - -#include -#include +#include "ardour/types.h" +#include "gtkmm2ext/keyboard.h" #include "selection.h" -using std::vector; -using std::string; +class ARDOUR_UI; -class Keyboard : public sigc::trackable, Stateful +class ArdourKeyboard : public Gtkmm2ext::Keyboard { public: - Keyboard (); - ~Keyboard (); - - XMLNode& get_state (void); - int set_state (const XMLNode&); - - typedef vector State; - - int get_prefix(float&, bool& was_floating); - void start_prefix (); - - static State translate_key_name (const string&); - static string get_real_keyname (const string& name); - - typedef uint32_t ModifierMask; + ArdourKeyboard(ARDOUR_UI& ardour_ui) : ui(ardour_ui) {} - static uint32_t Control; - static uint32_t Shift; - static uint32_t Alt; - static uint32_t Meta; - - bool key_is_down (uint32_t keyval); - - static GdkModifierType RelevantModifierKeyMask; - - static bool no_modifier_keys_pressed(GdkEventButton* ev) { - return (ev->state & RelevantModifierKeyMask) == 0; - } - - bool leave_window (GdkEventCrossing *ev, Gtk::Window*); - bool enter_window (GdkEventCrossing *ev, Gtk::Window*); - - static bool modifier_state_contains (guint state, ModifierMask); - static bool modifier_state_equals (guint state, ModifierMask); + void setup_keybindings (); static Selection::Operation selection_type (guint state); - static bool no_modifiers_active (guint state); - - static void set_meta_modifier (guint); - - static void set_snap_modifier (guint); - static ModifierMask snap_modifier () { return ModifierMask (snap_mod); } - - static guint edit_button() { return edit_but; } - static void set_edit_button (guint); - static guint edit_modifier() { return edit_mod; } - static void set_edit_modifier(guint); - - static guint delete_button() { return delete_but; } - static void set_delete_button(guint); - static guint delete_modifier() { return delete_mod; } - static void set_delete_modifier(guint); - - static bool is_edit_event (GdkEventButton*); - static bool is_delete_event (GdkEventButton*); - static bool is_context_menu_event (GdkEventButton*); - - static Keyboard& the_keyboard() { return *_the_keyboard; } - - private: - static Keyboard* _the_keyboard; - - bool _queue_events; - bool _flush_queue; - - guint snooper_id; - State state; - bool collecting_prefix; - string current_prefix; - int* modifier_masks; - int modifier_mask; - int min_keycode; - int max_keycode; - - static guint edit_but; - static guint edit_mod; - static guint delete_but; - static guint delete_mod; - static guint snap_mod; - - static gint _snooper (GtkWidget*, GdkEventKey*, gpointer); - gint snooper (GtkWidget*, GdkEventKey*); - - void queue_event (GdkEventKey*); - void get_modifier_masks (); - void check_modifier_state (); - void clear_modifier_state (); - - void check_meta_numlock (char keycode, guint mod, string modname); + ARDOUR_UI& ui; }; #endif /* __ardour_keyboard_h__ */