1 
2 /*
3  * The Real SoundTracker - X keyboard handling (header)
4  *
5  * Copyright (C) 1997-2019 Michael Krause
6  *
7  * This program is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 2 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20  */
21 
22 #ifndef _KEYS_H
23 #define _KEYS_H
24 
25 #include <gdk/gdktypes.h>
26 
27 int keys_init(void);
28 
29 guint32
30 keys_get_key_meaning(guint32 keysym,
31     guint modifier, /* modifier is 1 shift, 2 ctrl, 4 meta */
32     gint hwcode);
33 
34 #define KEYS_MEANING_TYPE(x) (x >> 16)
35 #define KEYS_MEANING_TYPE_MAKE(x) (x << 16)
36 #define KEYS_MEANING_VALUE(x) (x & 0xFFFF)
37 
38 #define KEYS_MEANING_NOTE 0
39 #define KEYS_MEANING_KEYOFF 1
40 #define KEYS_MEANING_FUNC 2
41 #define KEYS_MEANING_CH 3
42 
43 #define ENCODE_MODIFIERS(shift, ctrl, alt) (1 * (shift != 0) + 2 * (ctrl != 0) + 4 * (alt != 0))
44 
45 enum {
46     KEY_JMP_PLUS = 0,
47     KEY_JMP_MINUS,
48     KEY_PLAY_SNG,
49     KEY_REC_SNG,
50     KEY_PLAY_PAT,
51     KEY_REC_PAT,
52     KEY_PLAY_CUR,
53     KEY_REC_CUR,
54     KEY_PLAY_ROW,
55     KEY_PLAY_BLK,
56     KEY_SMP_TOGGLE,
57     KEY_LAST /* Must be the last element */
58 };
59 
60 void keys_dialog(void);
61 
62 void keys_save_config(void);
63 
64 gboolean
65 keys_is_key_pressed(guint32 keysym,
66     int modifiers);
67 
68 #endif /* _NOTEKEYS_H */
69