fix_bbtppq: add missing space - no-op
[ardour.git] / gtk2_ardour / keyboard.h
index 1b81f710f8fd8c21b9d1a3785f2db9732f2c362b..f7b52d3ae1f161afc036291806742a9e7bc33801 100644 (file)
@@ -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
     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 <vector>
+#include <map>
 #include <string>
 
-#include <sigc++/signal.h>
-#include <gtk/gtk.h>
+#include "ardour/types.h"
+#include "gtkmm2ext/keyboard.h"
 
-#include <ardour/types.h>
-#include <ardour/stateful.h>
+#include "selection.h"
 
-using std::vector;
-using std::string;
+class ARDOUR_UI;
 
-class KeyboardTarget;
-class ArdourDialog;
-
-class Keyboard : public sigc::trackable, Stateful
+class ArdourKeyboard : public Gtkmm2ext::Keyboard
 {
   public:
-       Keyboard ();
-       ~Keyboard ();
+       ArdourKeyboard(ARDOUR_UI&);
 
        XMLNode& get_state (void);
-       int set_state (const XMLNode&);
-
-       typedef vector<uint32_t> State;
-       
-       void set_target (KeyboardTarget *);
-       void set_default_target (KeyboardTarget *);
-       void allow_focus (bool);
-
-       gint focus_in_handler (GdkEventFocus*);
-       gint focus_out_handler (GdkEventFocus*);
-
-       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);
-
-       void register_target (KeyboardTarget *);
-
-       void set_current_dialog (ArdourDialog*);
-       void close_current_dialog ();
-
-       typedef uint32_t ModifierMask;
-
-       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;
-       }
-
-       static bool modifier_state_contains (guint state, ModifierMask);
-       static bool modifier_state_equals   (guint state, ModifierMask);
-
-       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;
-       guint32 playback_ignore_count;
-
-       guint           snooper_id;
-       State           state;
-       KeyboardTarget* target;
-       KeyboardTarget* default_target;
-       bool            focus_allowed;
-       bool            collecting_prefix;
-       string          current_prefix;
-       int*            modifier_masks;
-       int             modifier_mask;
-       int             min_keycode;
-       int             max_keycode;
-       ArdourDialog*   current_dialog;
-       std::vector<ArdourDialog*> known_dialogs;
-
-       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 maybe_unset_target (KeyboardTarget *);
-       void queue_event (GdkEventKey*);
-       void playback_queue ();
-       void clear_queue ();
-       void get_modifier_masks ();
-       void check_modifier_state ();
-       void clear_modifier_state ();
-       gint enter_window (GdkEventCrossing*, KeyboardTarget*);
-       gint leave_window (GdkEventCrossing*);
-       gint current_dialog_vanished (GdkEventAny*);
-
-       void check_meta_numlock (char keycode, guint mod, string modname);
+       int set_state (const XMLNode&, int version);
+
+       void setup_keybindings ();
+
+       static Selection::Operation selection_type (guint state);
+
+       ARDOUR_UI& ui;
+
+       void reset_relevant_modifier_key_mask ();
+
+       /** @param state The button state from a GdkEvent.
+        *  @return true if the modifier state indicates snap modifier
+        */
+       static bool indicates_snap (guint state);
+
+       /** @param state The button state from a GdkEvent.
+        *  @return true if the modifier state indicates snap delta
+        */
+       static bool indicates_snap_delta (guint state);
+
+       /** @param state The button state from a GdkEvent.
+        *  @return true if the modifier state indicates copy modifier
+        */
+       static bool indicates_copy (guint state);
+
+       /** @param state The button state from a GdkEvent.
+        *  @return true if the modifier state indicates constraint modifier
+        */
+       static bool indicates_constraint (guint state);
+
+       static void set_constraint_modifier (guint);
+       /** @return Modifier mask to constrain drags in a particular direction;
+        */
+       static ModifierMask constraint_modifier () { return ModifierMask (constraint_mod); }
+
+       static void set_trim_contents_modifier (guint);
+       /** @return Modifier mask to move contents rather than region bounds during trim;
+        */
+       static ModifierMask trim_contents_modifier () { return ModifierMask (trim_contents_mod); }
+
+       static void set_trim_overlap_modifier (guint);
+       /** @return Modifier mask to remove region overlaps during trim;
+        */
+       static ModifierMask trim_overlap_modifier () { return ModifierMask (trim_overlap_mod); }
+
+       static void set_trim_anchored_modifier (guint);
+       /** @return Modifier mask to use anchored trim;
+        */
+       static ModifierMask trim_anchored_modifier () { return ModifierMask (trim_anchored_mod); }
+
+       static void set_fine_adjust_modifier (guint);
+       /** @return Modifier mask to fine adjust (control points only atm);
+        */
+       static ModifierMask fine_adjust_modifier () { return ModifierMask (fine_adjust_mod); }
+
+       static void set_push_points_modifier (guint);
+       /** @return Modifier mask to push proceeding points;
+        */
+       static ModifierMask push_points_modifier () { return ModifierMask (push_points_mod); }
+
+       static void set_note_size_relative_modifier (guint);
+       /** @return Modifier mask to resize notes relatively;
+        */
+       static ModifierMask note_size_relative_modifier () { return ModifierMask (note_size_relative_mod); }
+private:
+       static guint     constraint_mod;
+       static guint     trim_contents_mod;
+       static guint     trim_overlap_mod;
+       static guint     trim_anchored_mod;
+       static guint     fine_adjust_mod;
+       static guint     push_points_mod;
+       static guint     note_size_relative_mod;
+
+       void find_bindings_files (std::map<std::string,std::string>& files);
 };
 
 #endif /* __ardour_keyboard_h__ */