1 /***************************************************************************
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
10 * Copyright (C) 2006 by Barry Wardell
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 ****************************************************************************/
26 #include "buttonmap.h"
28 int key_to_button(int keyboard_button
)
30 int new_btn
= BUTTON_NONE
;
31 switch (keyboard_button
)
35 new_btn
= BUTTON_LEFT
;
39 new_btn
= BUTTON_RIGHT
;
43 new_btn
= BUTTON_SCROLL_BACK
;
47 new_btn
= BUTTON_SCROLL_FWD
;
51 new_btn
= BUTTON_PLAY
;
55 new_btn
= BUTTON_SELECT
;
59 new_btn
= BUTTON_MENU
;
61 case SDL_BUTTON_WHEELUP
:
62 new_btn
= BUTTON_SCROLL_BACK
;
64 case SDL_BUTTON_WHEELDOWN
:
65 new_btn
= BUTTON_SCROLL_FWD
;
71 struct button_map bm
[] = {
72 #if defined (IPOD_VIDEO)
73 { SDLK_KP_PERIOD
, 174, 350, 35, "Menu" },
74 { SDLK_KP8
, 110, 380, 33, "Scroll Back" },
75 { SDLK_KP2
, 234, 377, 34, "Scroll Fwd" },
76 { SDLK_KP4
, 78, 438, 47, "Left" },
77 { SDLK_KP5
, 172, 435, 43, "Select" },
78 { SDLK_KP6
, 262, 438, 52, "Right" },
79 { SDLK_KP_PLUS
, 172, 519, 43, "Play" },
80 #elif defined (IPOD_MINI) || defined(IPOD_MINI2G)
81 { SDLK_KP5
, 92, 267, 29, "Select" },
82 { SDLK_KP4
, 31, 263, 37, "Left" },
83 { SDLK_KP6
, 150, 268, 33, "Right" },
84 { SDLK_KP_PERIOD
, 93, 209, 30, "Menu" },
85 { SDLK_KP_PLUS
, 93, 324, 25, "Play" },
86 { SDLK_KP8
, 53, 220, 29, "Scroll Back" },
87 { SDLK_KP2
, 134, 219, 31, "Scroll Fwd" },
88 #elif defined (IPOD_3G)
89 { SDLK_KP5
, 108, 296, 26, "Select" },
90 { SDLK_KP8
, 70, 255, 26, "Scroll Back" },
91 { SDLK_KP2
, 149, 256, 28, "Scroll Fwd" },
92 { SDLK_KP4
, 27, 186, 22, "Left" },
93 { SDLK_KP_PERIOD
, 82, 185, 22, "Menu" },
94 { SDLK_KP_PERIOD
, 133, 185, 21, "Play" },
95 { SDLK_KP6
, 189, 188, 21, "Right" },
96 #elif defined (IPOD_4G)
97 { SDLK_KP5
, 96, 269, 27, "Select" },
98 { SDLK_KP4
, 39, 267, 30, "Left" },
99 { SDLK_KP6
, 153, 270, 27, "Right" },
100 { SDLK_KP_PERIOD
, 96, 219, 30, "Menu" },
101 { SDLK_KP_PLUS
, 95, 326, 27, "Play" },
102 { SDLK_KP8
, 57, 233, 29, "Scroll Back" },
103 { SDLK_KP2
, 132, 226, 29, "Scroll Fwd" },
104 #elif defined (IPOD_COLOR)
105 { SDLK_KP5
, 128, 362, 35, "Select" },
106 { SDLK_KP4
, 55, 358, 38, "Left" },
107 { SDLK_KP6
, 203, 359, 39, "Right" },
108 { SDLK_KP_PERIOD
, 128, 282, 34, "Menu" },
109 { SDLK_KP_PLUS
, 129, 439, 41, "Play" },
110 { SDLK_KP8
, 76, 309, 34, "Scroll Back" },
111 { SDLK_KP2
, 182, 311, 45, "Scroll Fwd" },
112 #elif defined (IPOD_1G2G)
113 { SDLK_KP5
, 112, 265, 31, "Select" },
114 { SDLK_KP8
, 74, 224, 28, "Scroll Back" },
115 { SDLK_KP2
, 146, 228, 28, "Scroll Fwd" },
116 /* Dummy button to make crescent shape */
117 { SDLK_y
, 112, 265, 76, "None" },
118 { SDLK_KP8
, 74, 224, 28, "Scroll Back" },
119 { SDLK_KP2
, 146, 228, 28, "Scroll Fwd" },
120 { SDLK_KP6
, 159, 268, 64, "Right" },
121 { SDLK_KP4
, 62, 266, 62, "Left" },
122 { SDLK_KP_PERIOD
, 111, 216, 64, "Menu" },
123 { SDLK_KP_PLUS
, 111, 326, 55, "Down" },
124 #elif defined (IPOD_NANO)
125 { SDLK_KP5
, 98, 316, 37, "Select" },
126 { SDLK_KP4
, 37, 312, 28, "Left" },
127 { SDLK_KP6
, 160, 313, 25, "Right" },
128 { SDLK_KP_PERIOD
,102, 256, 23, "Menu" },
129 { SDLK_KP_PLUS
, 99, 378, 28, "Play" },
130 { SDLK_KP8
, 58, 272, 24, "Scroll Back" },
131 { SDLK_KP2
, 141, 274, 22, "Scroll Fwd" },
132 #elif defined (IPOD_NANO2G)
133 { SDLK_KP5
, 118, 346, 37, "Select" },
134 { SDLK_KP4
, 51, 345, 28, "Left" },
135 { SDLK_KP6
, 180, 346, 26, "Right" },
136 { SDLK_KP_PERIOD
, 114, 286, 23, "Menu" },
137 { SDLK_KP_PLUS
, 115, 412, 27, "Down" },
138 { SDLK_KP8
, 67, 303, 28, "Scroll Back" },
139 { SDLK_KP2
, 163, 303, 27, "Scroll Fwd" },
141 { 0, 0, 0 , 0, "None" }