clean up a-pong
[ardour.git] / gtk2_ardour / keyboard.h
1 /*
2     Copyright (C) 2001 Paul Davis
3
4     This program is free software; you can redistribute it and/or modify
5     it under the terms of the GNU General Public License as published by
6     the Free Software Foundation; either version 2 of the License, or
7     (at your option) any later version.
8
9     This program is distributed in the hope that it will be useful,
10     but WITHOUT ANY WARRANTY; without even the implied warranty of
11     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12     GNU General Public License for more details.
13
14     You should have received a copy of the GNU General Public License
15     along with this program; if not, write to the Free Software
16     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17
18 */
19
20 #ifndef __ardour_keyboard_h__
21 #define __ardour_keyboard_h__
22
23 #include <map>
24 #include <string>
25
26 #include "ardour/types.h"
27 #include "gtkmm2ext/keyboard.h"
28
29 #include "selection.h"
30
31 class ARDOUR_UI;
32
33 class ArdourKeyboard : public Gtkmm2ext::Keyboard
34 {
35   public:
36         ArdourKeyboard(ARDOUR_UI&);
37
38         XMLNode& get_state (void);
39         int set_state (const XMLNode&, int version);
40
41         void setup_keybindings ();
42
43         static Selection::Operation selection_type (guint state);
44
45         ARDOUR_UI& ui;
46
47         void reset_relevant_modifier_key_mask ();
48
49         /** @param state The button state from a GdkEvent.
50          *  @return true if the modifier state indicates snap modifier
51          */
52         static bool indicates_snap (guint state);
53
54         /** @param state The button state from a GdkEvent.
55          *  @return true if the modifier state indicates snap delta
56          */
57         static bool indicates_snap_delta (guint state);
58
59         /** @param state The button state from a GdkEvent.
60          *  @return true if the modifier state indicates copy modifier
61          */
62         static bool indicates_copy (guint state);
63
64         /** @param state The button state from a GdkEvent.
65          *  @return true if the modifier state indicates constraint modifier
66          */
67         static bool indicates_constraint (guint state);
68
69         static void set_constraint_modifier (guint);
70         /** @return Modifier mask to constrain drags in a particular direction;
71          */
72         static ModifierMask constraint_modifier () { return ModifierMask (constraint_mod); }
73
74         static void set_trim_contents_modifier (guint);
75         /** @return Modifier mask to move contents rather than region bounds during trim;
76          */
77         static ModifierMask trim_contents_modifier () { return ModifierMask (trim_contents_mod); }
78
79         static void set_trim_overlap_modifier (guint);
80         /** @return Modifier mask to remove region overlaps during trim;
81          */
82         static ModifierMask trim_overlap_modifier () { return ModifierMask (trim_overlap_mod); }
83
84         static void set_trim_anchored_modifier (guint);
85         /** @return Modifier mask to use anchored trim;
86          */
87         static ModifierMask trim_anchored_modifier () { return ModifierMask (trim_anchored_mod); }
88
89         static void set_fine_adjust_modifier (guint);
90         /** @return Modifier mask to fine adjust (control points only atm);
91          */
92         static ModifierMask fine_adjust_modifier () { return ModifierMask (fine_adjust_mod); }
93
94         static void set_push_points_modifier (guint);
95         /** @return Modifier mask to push proceeding points;
96          */
97         static ModifierMask push_points_modifier () { return ModifierMask (push_points_mod); }
98
99         static void set_note_size_relative_modifier (guint);
100         /** @return Modifier mask to resize notes relatively;
101          */
102         static ModifierMask note_size_relative_modifier () { return ModifierMask (note_size_relative_mod); }
103 private:
104         static guint     constraint_mod;
105         static guint     trim_contents_mod;
106         static guint     trim_overlap_mod;
107         static guint     trim_anchored_mod;
108         static guint     fine_adjust_mod;
109         static guint     push_points_mod;
110         static guint     note_size_relative_mod;
111
112         void find_bindings_files (std::map<std::string,std::string>& files);
113 };
114
115 #endif /* __ardour_keyboard_h__ */