Meaningful Typo
[vlc.git] / include / vlc_keys.h
blobd7b1d7d0db6d57ca00300ee4121b0ee546c5af8a
1 /*****************************************************************************
2 * vlc_keys.h: keycode defines
3 *****************************************************************************
4 * Copyright (C) 2003 the VideoLAN team
5 * $Id$
7 * Authors: Sigmund Augdal Helberg <dnumgis@videolan.org>
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
22 *****************************************************************************/
24 #if !defined( __LIBVLC__ )
25 #error You are not libvlc or one of its plugins. You cannot include this file
26 #endif
28 #ifndef _VLC_KEYS_H
29 #define _VLC_KEYS_H 1
31 #define KEY_MODIFIER 0xFF000000
32 #define KEY_MODIFIER_ALT 0x01000000
33 #define KEY_MODIFIER_SHIFT 0x02000000
34 #define KEY_MODIFIER_CTRL 0x04000000
35 #define KEY_MODIFIER_META 0x08000000
36 #define KEY_MODIFIER_COMMAND 0x10000000
38 #define KEY_SPECIAL 0x00FF0000
39 #define KEY_LEFT 0x00010000
40 #define KEY_RIGHT 0x00020000
41 #define KEY_UP 0x00030000
42 #define KEY_DOWN 0x00040000
43 #define KEY_SPACE 0x00050000
44 #define KEY_ENTER 0x00060000
45 #define KEY_F1 0x00070000
46 #define KEY_F2 0x00080000
47 #define KEY_F3 0x00090000
48 #define KEY_F4 0x000A0000
49 #define KEY_F5 0x000B0000
50 #define KEY_F6 0x000C0000
51 #define KEY_F7 0x000D0000
52 #define KEY_F8 0x000E0000
53 #define KEY_F9 0x000F0000
54 #define KEY_F10 0x00100000
55 #define KEY_F11 0x00110000
56 #define KEY_F12 0x00120000
57 #define KEY_HOME 0x00130000
58 #define KEY_END 0x00140000
59 #define KEY_INSERT 0x00150000
60 #define KEY_DELETE 0x00160000
61 #define KEY_MENU 0x00170000
62 #define KEY_ESC 0x00180000
63 #define KEY_PAGEUP 0x00190000
64 #define KEY_PAGEDOWN 0x001A0000
65 #define KEY_TAB 0x001B0000
66 #define KEY_BACKSPACE 0x001C0000
67 #define KEY_MOUSEWHEELUP 0x001D0000
68 #define KEY_MOUSEWHEELDOWN 0x001E0000
69 #define KEY_MOUSEWHEELLEFT 0x001F0000
70 #define KEY_MOUSEWHEELRIGHT 0x00200000
72 /* TODO:
73 * The media keys are only used in win32. Support for other OSes needs to
74 * be added */
75 #define KEY_BROWSER_BACK 0x001F0000
76 #define KEY_BROWSER_FORWARD 0x00200000
77 #define KEY_BROWSER_REFRESH 0x00210000
78 #define KEY_BROWSER_STOP 0x00220000
79 #define KEY_BROWSER_SEARCH 0x00230000
80 #define KEY_BROWSER_FAVORITES 0x00240000
81 #define KEY_BROWSER_HOME 0x00250000
82 #define KEY_VOLUME_MUTE 0x00260000
83 #define KEY_VOLUME_DOWN 0x00270000
84 #define KEY_VOLUME_UP 0x00280000
85 #define KEY_MEDIA_NEXT_TRACK 0x00290000
86 #define KEY_MEDIA_PREV_TRACK 0x002a0000
87 #define KEY_MEDIA_STOP 0x002b0000
88 #define KEY_MEDIA_PLAY_PAUSE 0x002c0000
90 #define KEY_ASCII 0x0000007F
91 #define KEY_UNSET 0
93 typedef struct key_descriptor_s
95 const char *psz_key_string;
96 int i_key_code;
97 } key_descriptor_t;
99 #define ADD_KEY(a) { a, *a }
101 static const struct key_descriptor_s vlc_modifiers[] =
103 { "Alt", KEY_MODIFIER_ALT },
104 { "Shift", KEY_MODIFIER_SHIFT },
105 { "Ctrl", KEY_MODIFIER_CTRL },
106 { "Meta", KEY_MODIFIER_META },
107 { "Command", KEY_MODIFIER_COMMAND }
110 static const struct key_descriptor_s vlc_keys[] =
112 { "Unset", KEY_UNSET },
113 { "Left", KEY_LEFT },
114 { "Right", KEY_RIGHT },
115 { "Up", KEY_UP },
116 { "Down", KEY_DOWN },
117 { "Space", KEY_SPACE },
118 { "Enter", KEY_ENTER },
119 { "F1", KEY_F1 },
120 { "F2", KEY_F2 },
121 { "F3", KEY_F3 },
122 { "F4", KEY_F4 },
123 { "F5", KEY_F5 },
124 { "F6", KEY_F6 },
125 { "F7", KEY_F7 },
126 { "F8", KEY_F8 },
127 { "F9", KEY_F9 },
128 { "F10", KEY_F10 },
129 { "F11", KEY_F11 },
130 { "F12", KEY_F12 },
131 { "Home", KEY_HOME },
132 { "End", KEY_END },
133 { "Insert", KEY_INSERT },
134 { "Delete", KEY_DELETE },
135 { "Menu", KEY_MENU },
136 { "Esc", KEY_ESC },
137 { "Page Up", KEY_PAGEUP },
138 { "Page Down", KEY_PAGEDOWN },
139 { "Tab", KEY_TAB },
140 { "Backspace", KEY_BACKSPACE },
141 { "Mouse Wheel Up", KEY_MOUSEWHEELUP },
142 { "Mouse Wheel Down", KEY_MOUSEWHEELDOWN },
143 { "0", '0' },
144 { "1", '1' },
145 { "2", '2' },
146 { "3", '3' },
147 { "4", '4' },
148 { "5", '5' },
149 { "6", '6' },
150 { "7", '7' },
151 { "8", '8' },
152 { "9", '9' },
153 { "a", 'a' },
154 { "b", 'b' },
155 { "c", 'c' },
156 { "d", 'd' },
157 { "e", 'e' },
158 { "f", 'f' },
159 { "g", 'g' },
160 { "h", 'h' },
161 { "i", 'i' },
162 { "j", 'j' },
163 { "k", 'k' },
164 { "l", 'l' },
165 { "m", 'm' },
166 { "n", 'n' },
167 { "o", 'o' },
168 { "p", 'p' },
169 { "q", 'q' },
170 { "r", 'r' },
171 { "s", 's' },
172 { "t", 't' },
173 { "u", 'u' },
174 { "v", 'v' },
175 { "w", 'w' },
176 { "x", 'x' },
177 { "y", 'y' },
178 { "z", 'z' },
179 { "+", '+' },
180 { "=", '=' },
181 { "-", '-' },
182 { ",", ',' },
183 { ".", '.' },
184 { "<", '<' },
185 { ">", '>' },
186 { "`", '`' },
187 { "/", '/' },
188 { ";", ';' },
189 { "'", '\'' },
190 { "\\", '\\' },
191 { "[", '[' },
192 { "]", ']' },
193 { "*", '*' },
194 { "Browser Back", KEY_BROWSER_BACK },
195 { "Browser Forward", KEY_BROWSER_FORWARD },
196 { "Browser Refresh", KEY_BROWSER_REFRESH },
197 { "Browser Stop", KEY_BROWSER_STOP },
198 { "Browser Search", KEY_BROWSER_SEARCH },
199 { "Browser Favorites", KEY_BROWSER_FAVORITES },
200 { "Browser Home", KEY_BROWSER_HOME },
201 { "Volume Mute", KEY_VOLUME_MUTE },
202 { "Volume Down", KEY_VOLUME_DOWN },
203 { "Volume Up", KEY_VOLUME_UP },
204 { "Media Next Track", KEY_MEDIA_NEXT_TRACK },
205 { "Media Prev Track", KEY_MEDIA_PREV_TRACK },
206 { "Media Stop", KEY_MEDIA_STOP },
207 { "Media Play Pause", KEY_MEDIA_PLAY_PAUSE }
210 static inline const char *KeyToString( int i_key )
212 unsigned int i = 0;
213 for ( i = 0; i < sizeof(vlc_keys) / sizeof(key_descriptor_t); i++ )
215 if ( vlc_keys[i].i_key_code == i_key )
217 return vlc_keys[i].psz_key_string;
220 return NULL;
223 static inline int StringToKey( char *psz_key )
225 unsigned int i = 0;
226 for ( i = 0; i < sizeof(vlc_keys) / sizeof(key_descriptor_t); i++ )
228 if ( !strcmp( vlc_keys[i].psz_key_string, psz_key ))
230 return vlc_keys[i].i_key_code;
233 return 0;
236 typedef enum vlc_key {
237 ACTIONID_QUIT = 1,
238 ACTIONID_PLAY_PAUSE,
239 ACTIONID_PLAY,
240 ACTIONID_PAUSE,
241 ACTIONID_STOP,
242 ACTIONID_PREV,
243 ACTIONID_NEXT,
244 ACTIONID_SLOWER,
245 ACTIONID_FASTER,
246 ACTIONID_TOGGLE_FULLSCREEN,
247 ACTIONID_VOL_UP,
248 ACTIONID_VOL_DOWN,
249 ACTIONID_NAV_ACTIVATE,
250 ACTIONID_NAV_UP,
251 ACTIONID_NAV_DOWN,
252 ACTIONID_NAV_LEFT,
253 ACTIONID_NAV_RIGHT,
254 ACTIONID_JUMP_BACKWARD_EXTRASHORT,
255 ACTIONID_JUMP_FORWARD_EXTRASHORT,
256 ACTIONID_JUMP_BACKWARD_SHORT,
257 ACTIONID_JUMP_FORWARD_SHORT,
258 ACTIONID_JUMP_BACKWARD_MEDIUM,
259 ACTIONID_JUMP_FORWARD_MEDIUM,
260 ACTIONID_JUMP_BACKWARD_LONG,
261 ACTIONID_JUMP_FORWARD_LONG,
262 ACTIONID_POSITION,
263 ACTIONID_VOL_MUTE,
264 /* let ACTIONID_SET_BOOMARK* and ACTIONID_PLAY_BOOKMARK* be contiguous */
265 ACTIONID_SET_BOOKMARK1,
266 ACTIONID_SET_BOOKMARK2,
267 ACTIONID_SET_BOOKMARK3,
268 ACTIONID_SET_BOOKMARK4,
269 ACTIONID_SET_BOOKMARK5,
270 ACTIONID_SET_BOOKMARK6,
271 ACTIONID_SET_BOOKMARK7,
272 ACTIONID_SET_BOOKMARK8,
273 ACTIONID_SET_BOOKMARK9,
274 ACTIONID_SET_BOOKMARK10,
275 ACTIONID_PLAY_BOOKMARK1,
276 ACTIONID_PLAY_BOOKMARK2,
277 ACTIONID_PLAY_BOOKMARK3,
278 ACTIONID_PLAY_BOOKMARK4,
279 ACTIONID_PLAY_BOOKMARK5,
280 ACTIONID_PLAY_BOOKMARK6,
281 ACTIONID_PLAY_BOOKMARK7,
282 ACTIONID_PLAY_BOOKMARK8,
283 ACTIONID_PLAY_BOOKMARK9,
284 ACTIONID_PLAY_BOOKMARK10,
285 /* end of contiguous zone */
286 ACTIONID_SUBDELAY_UP,
287 ACTIONID_SUBDELAY_DOWN,
288 ACTIONID_HISTORY_BACK,
289 ACTIONID_HISTORY_FORWARD,
290 ACTIONID_AUDIO_TRACK,
291 ACTIONID_SUBTITLE_TRACK,
292 ACTIONID_CUBESPEED_UP,
293 ACTIONID_CUBESPEED_DOWN,
294 ACTIONID_INTF_SHOW,
295 ACTIONID_INTF_HIDE,
296 /* chapter and title navigation */
297 ACTIONID_TITLE_PREV,
298 ACTIONID_TITLE_NEXT,
299 ACTIONID_CHAPTER_PREV,
300 ACTIONID_CHAPTER_NEXT,
301 /* end of chapter and title navigation */
302 ACTIONID_AUDIODELAY_UP,
303 ACTIONID_AUDIODELAY_DOWN,
304 ACTIONID_SNAPSHOT,
305 ACTIONID_RECORD,
306 ACTIONID_DISC_MENU,
307 ACTIONID_ASPECT_RATIO,
308 ACTIONID_CROP,
309 ACTIONID_DEINTERLACE,
310 ACTIONID_ZOOM,
311 ACTIONID_UNZOOM,
312 ACTIONID_CROP_TOP,
313 ACTIONID_UNCROP_TOP,
314 ACTIONID_CROP_LEFT,
315 ACTIONID_UNCROP_LEFT,
316 ACTIONID_CROP_BOTTOM,
317 ACTIONID_UNCROP_BOTTOM,
318 ACTIONID_CROP_RIGHT,
319 ACTIONID_UNCROP_RIGHT,
320 ACTIONID_DUMP,
321 ACTIONID_RANDOM,
322 ACTIONID_LOOP,
323 ACTIONID_WALLPAPER,
324 ACTIONID_LEAVE_FULLSCREEN,
325 ACTIONID_MENU_ON,
326 ACTIONID_MENU_OFF,
327 ACTIONID_MENU_RIGHT,
328 ACTIONID_MENU_LEFT,
329 ACTIONID_MENU_UP,
330 ACTIONID_MENU_DOWN,
331 ACTIONID_MENU_SELECT,
332 /* Zoom */
333 ACTIONID_ZOOM_QUARTER,
334 ACTIONID_ZOOM_HALF,
335 ACTIONID_ZOOM_ORIGINAL,
336 ACTIONID_ZOOM_DOUBLE,
337 /* Cycle Through Audio Devices */
338 ACTIONID_AUDIODEVICE_CYCLE
339 } vlc_key_t;
340 #endif