Fix MIDI disk-writer flush
[ardour.git] / gtk2_ardour / keyboard.h
1 /*
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>
7  *
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.
12  *
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.
17  *
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.
21  */
22
23 #ifndef __ardour_keyboard_h__
24 #define __ardour_keyboard_h__
25
26 #include <map>
27 #include <string>
28
29 #include "ardour/types.h"
30 #include "gtkmm2ext/keyboard.h"
31
32 #include "selection.h"
33
34 class ARDOUR_UI;
35
36 class ArdourKeyboard : public Gtkmm2ext::Keyboard
37 {
38 public:
39         ArdourKeyboard(ARDOUR_UI&);
40
41         XMLNode& get_state (void);
42         int set_state (const XMLNode&, int version);
43
44         void setup_keybindings ();
45
46         static Selection::Operation selection_type (guint state);
47
48         ARDOUR_UI& ui;
49
50         void reset_relevant_modifier_key_mask ();
51
52         /** @param state The button state from a GdkEvent.
53          *  @return true if the modifier state indicates snap modifier
54          */
55         static bool indicates_snap (guint state);
56
57         /** @param state The button state from a GdkEvent.
58          *  @return true if the modifier state indicates snap delta
59          */
60         static bool indicates_snap_delta (guint state);
61
62         /** @param state The button state from a GdkEvent.
63          *  @return true if the modifier state indicates copy modifier
64          */
65         static bool indicates_copy (guint state);
66
67         /** @param state The button state from a GdkEvent.
68          *  @return true if the modifier state indicates constraint modifier
69          */
70         static bool indicates_constraint (guint state);
71
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); }
75
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); }
79
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); }
83
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); }
87
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); }
91
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); }
95
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); }
99 private:
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;
107
108         void find_bindings_files (std::map<std::string,std::string>& files);
109 };
110
111 #endif /* __ardour_keyboard_h__ */