imxtools/nwztools: fix compilation for windows
[maemo-rb.git] / uisimulator / buttonmap / iaudio-m3.c
blob1ab1392f4789d8a05114a2d55952cf8f665ccd19
1 /***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
10 * Copyright (C) 2008 by Jens Arnold
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
20 ****************************************************************************/
23 #include <SDL.h>
24 #include "button.h"
25 #include "buttonmap.h"
27 int key_to_button(int keyboard_button)
29 int new_btn = BUTTON_NONE;
30 switch (keyboard_button)
32 case SDLK_KP4:
33 new_btn = BUTTON_LEFT;
34 break;
35 case SDLK_LEFT:
36 new_btn = BUTTON_RC_REW;
37 break;
38 case SDLK_KP6:
39 new_btn = BUTTON_RIGHT;
40 break;
41 case SDLK_RIGHT:
42 new_btn = BUTTON_RC_FF;
43 break;
44 case SDLK_KP8:
45 new_btn = BUTTON_VOL_UP;
46 break;
47 case SDLK_UP:
48 new_btn = BUTTON_RC_VOL_UP;
49 break;
50 case SDLK_KP2:
51 new_btn = BUTTON_VOL_DOWN;
52 break;
53 case SDLK_DOWN:
54 new_btn = BUTTON_RC_VOL_DOWN;
55 break;
56 case SDLK_KP_PERIOD:
57 new_btn = BUTTON_MODE;
58 break;
59 case SDLK_INSERT:
60 new_btn = BUTTON_RC_MODE;
61 break;
62 case SDLK_KP_DIVIDE:
63 new_btn = BUTTON_REC;
64 break;
65 case SDLK_F1:
66 new_btn = BUTTON_RC_REC;
67 break;
68 case SDLK_KP5:
69 new_btn = BUTTON_PLAY;
70 break;
71 case SDLK_SPACE:
72 new_btn = BUTTON_RC_PLAY;
73 break;
74 case SDLK_KP_ENTER:
75 case SDLK_RETURN:
76 new_btn = BUTTON_RC_MENU;
77 break;
79 return new_btn;
82 struct button_map bm[] = {
83 { SDLK_KP5, 256, 72, 29, "Play" },
84 { SDLK_KP6, 255, 137, 28, "Right" },
85 { SDLK_KP4, 257, 201, 26, "Left" },
86 { SDLK_KP8, 338, 31, 27, "Up" },
87 { SDLK_KP2, 339, 92, 23, "Down" },
88 { SDLK_KP_PERIOD, 336, 50, 23, "Mode" },
89 { SDLK_KP_DIVIDE, 336, 147, 23, "Rec" },
90 { SDLK_h, 336, 212, 30, "Hold" },
91 /* remote */
92 { SDLK_SPACE, 115, 308, 20, "RC Play" },
93 { SDLK_RIGHT, 85, 308, 20, "RC Rew" },
94 { SDLK_LEFT, 143, 308, 20, "RC FF" },
95 { SDLK_UP, 143, 498, 20, "RC Up" },
96 { SDLK_DOWN, 85, 498, 20, "RC Down" },
97 { SDLK_INSERT, 212, 308, 30, "RC Mode" },
98 { SDLK_F1, 275, 308, 25, "RC Rec" },
99 { SDLK_KP_ENTER, 115, 498, 20, "RC Menu" },
100 { 0, 0, 0, 0, "None" }