diff options
Diffstat (limited to 'uisimulator/buttonmap')
-rw-r--r-- | uisimulator/buttonmap/SOURCES | 3 | ||||
-rw-r--r-- | uisimulator/buttonmap/buttonmap.h | 42 | ||||
-rw-r--r-- | uisimulator/buttonmap/touchscreen.c | 96 |
3 files changed, 0 insertions, 141 deletions
diff --git a/uisimulator/buttonmap/SOURCES b/uisimulator/buttonmap/SOURCES index f5a409b156..0fc9d16097 100644 --- a/uisimulator/buttonmap/SOURCES +++ b/uisimulator/buttonmap/SOURCES | |||
@@ -1,8 +1,5 @@ | |||
1 | #ifdef SIMULATOR | 1 | #ifdef SIMULATOR |
2 | buttonmaps.c | 2 | buttonmaps.c |
3 | #ifdef HAVE_TOUCHSCREEN | ||
4 | touchscreen.c | ||
5 | #endif | ||
6 | #if CONFIG_KEYPAD == GIGABEAT_PAD | 3 | #if CONFIG_KEYPAD == GIGABEAT_PAD |
7 | gigabeat.c | 4 | gigabeat.c |
8 | #elif CONFIG_KEYPAD == GIGABEAT_S_PAD | 5 | #elif CONFIG_KEYPAD == GIGABEAT_S_PAD |
diff --git a/uisimulator/buttonmap/buttonmap.h b/uisimulator/buttonmap/buttonmap.h deleted file mode 100644 index 2f14cea9c4..0000000000 --- a/uisimulator/buttonmap/buttonmap.h +++ /dev/null | |||
@@ -1,42 +0,0 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2010 by Fred Bauer | ||
11 | * | ||
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. | ||
16 | * | ||
17 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
18 | * KIND, either express or implied. | ||
19 | * | ||
20 | ****************************************************************************/ | ||
21 | |||
22 | #ifndef __BUTTONMAP_H__ | ||
23 | #define __BUTTONMAP_H__ | ||
24 | /* Button maps: simulated key, x, y, radius, name */ | ||
25 | /* Run sim with --mapping to get coordinates */ | ||
26 | /* or --debugbuttons to check */ | ||
27 | /* The First matching button is returned */ | ||
28 | struct button_map { | ||
29 | int button, x, y, radius; | ||
30 | char *description; | ||
31 | }; | ||
32 | |||
33 | extern struct button_map bm[]; | ||
34 | |||
35 | int xy2button( int x, int y); | ||
36 | |||
37 | int key_to_button(int keyboard_button); | ||
38 | #ifdef HAVE_TOUCHSCREEN | ||
39 | int key_to_touch(int keyboard_button, unsigned int mouse_coords); | ||
40 | #endif | ||
41 | |||
42 | #endif /* __BUTTONMAP_H__ */ | ||
diff --git a/uisimulator/buttonmap/touchscreen.c b/uisimulator/buttonmap/touchscreen.c deleted file mode 100644 index 90518c7c7e..0000000000 --- a/uisimulator/buttonmap/touchscreen.c +++ /dev/null | |||
@@ -1,96 +0,0 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2008 Jonathan Gordon | ||
11 | * | ||
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. | ||
16 | * | ||
17 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
18 | * KIND, either express or implied. | ||
19 | * | ||
20 | ****************************************************************************/ | ||
21 | |||
22 | |||
23 | #include <stdio.h> | ||
24 | #include <SDL.h> | ||
25 | #include "button.h" | ||
26 | #include "buttonmap.h" | ||
27 | #include "touchscreen.h" | ||
28 | |||
29 | int key_to_touch(int keyboard_button, unsigned int mouse_coords) | ||
30 | { | ||
31 | int new_btn = BUTTON_NONE; | ||
32 | switch (keyboard_button) | ||
33 | { | ||
34 | case BUTTON_TOUCHSCREEN: | ||
35 | switch (touchscreen_get_mode()) | ||
36 | { | ||
37 | case TOUCHSCREEN_POINT: | ||
38 | new_btn = BUTTON_TOUCHSCREEN; | ||
39 | break; | ||
40 | case TOUCHSCREEN_BUTTON: | ||
41 | { | ||
42 | static const int touchscreen_buttons[3][3] = { | ||
43 | {BUTTON_TOPLEFT, BUTTON_TOPMIDDLE, BUTTON_TOPRIGHT}, | ||
44 | {BUTTON_MIDLEFT, BUTTON_CENTER, BUTTON_MIDRIGHT}, | ||
45 | {BUTTON_BOTTOMLEFT, BUTTON_BOTTOMMIDDLE, BUTTON_BOTTOMRIGHT}, | ||
46 | }; | ||
47 | int px_x = ((mouse_coords&0xffff0000)>>16); | ||
48 | int px_y = ((mouse_coords&0x0000ffff)); | ||
49 | new_btn = touchscreen_buttons[px_y/(LCD_HEIGHT/3)][px_x/(LCD_WIDTH/3)]; | ||
50 | break; | ||
51 | } | ||
52 | } | ||
53 | break; | ||
54 | case SDLK_KP7: | ||
55 | case SDLK_7: | ||
56 | new_btn = BUTTON_TOPLEFT; | ||
57 | break; | ||
58 | case SDLK_KP8: | ||
59 | case SDLK_8: | ||
60 | case SDLK_UP: | ||
61 | new_btn = BUTTON_TOPMIDDLE; | ||
62 | break; | ||
63 | case SDLK_KP9: | ||
64 | case SDLK_9: | ||
65 | new_btn = BUTTON_TOPRIGHT; | ||
66 | break; | ||
67 | case SDLK_KP4: | ||
68 | case SDLK_u: | ||
69 | case SDLK_LEFT: | ||
70 | new_btn = BUTTON_MIDLEFT; | ||
71 | break; | ||
72 | case SDLK_KP5: | ||
73 | case SDLK_i: | ||
74 | new_btn = BUTTON_CENTER; | ||
75 | break; | ||
76 | case SDLK_KP6: | ||
77 | case SDLK_o: | ||
78 | case SDLK_RIGHT: | ||
79 | new_btn = BUTTON_MIDRIGHT; | ||
80 | break; | ||
81 | case SDLK_KP1: | ||
82 | case SDLK_j: | ||
83 | new_btn = BUTTON_BOTTOMLEFT; | ||
84 | break; | ||
85 | case SDLK_KP2: | ||
86 | case SDLK_k: | ||
87 | case SDLK_DOWN: | ||
88 | new_btn = BUTTON_BOTTOMMIDDLE; | ||
89 | break; | ||
90 | case SDLK_KP3: | ||
91 | case SDLK_l: | ||
92 | new_btn = BUTTON_BOTTOMRIGHT; | ||
93 | break; | ||
94 | } | ||
95 | return new_btn; | ||
96 | } | ||