2 * Copyright (C) 2005-2015 Paul Davis <paul@linuxaudiosystems.com>
3 * Copyright (C) 2005 Taybin Rutkin <taybin@taybin.com>
4 * Copyright (C) 2008-2010 David Robillard <d@drobilla.net>
5 * Copyright (C) 2009 Carl Hetherington <carl@carlh.net>
6 * Copyright (C) 2015-2016 Nick Mainsbridge <mainsbridge@gmail.com>
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License along
19 * with this program; if not, write to the Free Software Foundation, Inc.,
20 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
23 #ifndef __ardour_keyboard_h__
24 #define __ardour_keyboard_h__
29 #include "ardour/types.h"
30 #include "gtkmm2ext/keyboard.h"
32 #include "selection.h"
36 class ArdourKeyboard : public Gtkmm2ext::Keyboard
39 ArdourKeyboard(ARDOUR_UI&);
41 XMLNode& get_state (void);
42 int set_state (const XMLNode&, int version);
44 void setup_keybindings ();
46 static Selection::Operation selection_type (guint state);
50 void reset_relevant_modifier_key_mask ();
52 /** @param state The button state from a GdkEvent.
53 * @return true if the modifier state indicates snap modifier
55 static bool indicates_snap (guint state);
57 /** @param state The button state from a GdkEvent.
58 * @return true if the modifier state indicates snap delta
60 static bool indicates_snap_delta (guint state);
62 /** @param state The button state from a GdkEvent.
63 * @return true if the modifier state indicates copy modifier
65 static bool indicates_copy (guint state);
67 /** @param state The button state from a GdkEvent.
68 * @return true if the modifier state indicates constraint modifier
70 static bool indicates_constraint (guint state);
72 static void set_constraint_modifier (guint);
73 /** @return Modifier mask to constrain drags in a particular direction; */
74 static ModifierMask constraint_modifier () { return ModifierMask (constraint_mod); }
76 static void set_trim_contents_modifier (guint);
77 /** @return Modifier mask to move contents rather than region bounds during trim; */
78 static ModifierMask trim_contents_modifier () { return ModifierMask (trim_contents_mod); }
80 static void set_trim_overlap_modifier (guint);
81 /** @return Modifier mask to remove region overlaps during trim; */
82 static ModifierMask trim_overlap_modifier () { return ModifierMask (trim_overlap_mod); }
84 static void set_trim_anchored_modifier (guint);
85 /** @return Modifier mask to use anchored trim; */
86 static ModifierMask trim_anchored_modifier () { return ModifierMask (trim_anchored_mod); }
88 static void set_fine_adjust_modifier (guint);
89 /** @return Modifier mask to fine adjust (control points only atm); */
90 static ModifierMask fine_adjust_modifier () { return ModifierMask (fine_adjust_mod); }
92 static void set_push_points_modifier (guint);
93 /** @return Modifier mask to push proceeding points; */
94 static ModifierMask push_points_modifier () { return ModifierMask (push_points_mod); }
96 static void set_note_size_relative_modifier (guint);
97 /** @return Modifier mask to resize notes relatively; */
98 static ModifierMask note_size_relative_modifier () { return ModifierMask (note_size_relative_mod); }
100 static guint constraint_mod;
101 static guint trim_contents_mod;
102 static guint trim_overlap_mod;
103 static guint trim_anchored_mod;
104 static guint fine_adjust_mod;
105 static guint push_points_mod;
106 static guint note_size_relative_mod;
108 void find_bindings_files (std::map<std::string,std::string>& files);
111 #endif /* __ardour_keyboard_h__ */