diff options
author | Jonathan Gordon <rockbox@jdgordon.info> | 2008-04-15 10:35:11 +0000 |
---|---|---|
committer | Jonathan Gordon <rockbox@jdgordon.info> | 2008-04-15 10:35:11 +0000 |
commit | 5b5a626bb6ba54ccdcd90741cea5f9cbd0f79553 (patch) | |
tree | 0bf60b83aad534757330162ad4f683f142955ccb /apps | |
parent | 50851794a6bdd585ce70ecb430b1f798fb90936b (diff) | |
download | rockbox-5b5a626bb6ba54ccdcd90741cea5f9cbd0f79553.tar.gz rockbox-5b5a626bb6ba54ccdcd90741cea5f9cbd0f79553.zip |
Setup the touchpads to have two modes - stylus and button - and set them in button mode by default.
in button mode the touchpad is split into a 3x3 grid for 9 seperate buttons which can be used by the action system like real buttons.
Unify the keymap file for the touchpads in button mode. the target keymap file only needs to worry about real buttons.
(As these ports mature each screen will need to be fixed seperatly to be able to use stylus mode (the lists can already but don't change mode just yet.)
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@17114 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps')
-rw-r--r-- | apps/SOURCES | 3 | ||||
-rw-r--r-- | apps/action.h | 8 | ||||
-rw-r--r-- | apps/keymaps/keymap-cowond2.c | 30 | ||||
-rwxr-xr-x | apps/keymaps/keymap-mr500.c | 5 | ||||
-rw-r--r-- | apps/keymaps/keymap-touchpad.c | 214 | ||||
-rw-r--r-- | apps/main.c | 3 |
6 files changed, 229 insertions, 34 deletions
diff --git a/apps/SOURCES b/apps/SOURCES index b1e5cce75d..40aa022842 100644 --- a/apps/SOURCES +++ b/apps/SOURCES | |||
@@ -138,6 +138,9 @@ metadata/a52.c | |||
138 | #ifdef HAVE_TAGCACHE | 138 | #ifdef HAVE_TAGCACHE |
139 | tagcache.c | 139 | tagcache.c |
140 | #endif | 140 | #endif |
141 | #ifdef HAVE_TOUCHPAD | ||
142 | keymaps/keymap-touchpad.c | ||
143 | #endif | ||
141 | #if (CONFIG_KEYPAD == IRIVER_H100_PAD) \ | 144 | #if (CONFIG_KEYPAD == IRIVER_H100_PAD) \ |
142 | || (CONFIG_KEYPAD == IRIVER_H300_PAD) | 145 | || (CONFIG_KEYPAD == IRIVER_H300_PAD) |
143 | keymaps/keymap-h1x0_h3x0.c | 146 | keymaps/keymap-h1x0_h3x0.c |
diff --git a/apps/action.h b/apps/action.h index c1c60c9b0b..96e8086baa 100644 --- a/apps/action.h +++ b/apps/action.h | |||
@@ -25,14 +25,15 @@ | |||
25 | #define TIMEOUT_NOBLOCK 0 | 25 | #define TIMEOUT_NOBLOCK 0 |
26 | 26 | ||
27 | #define CONTEXT_STOPSEARCHING 0xFFFFFFFF | 27 | #define CONTEXT_STOPSEARCHING 0xFFFFFFFF |
28 | #define CONTEXT_REMOTE 0x80000000 /* | this against another context to get remote buttons for that context */ | 28 | #define CONTEXT_REMOTE 0x80000000 /* | this against another context to get remote buttons for that context */ |
29 | #define CONTEXT_CUSTOM 0x40000000 /* | this against anything to get your context number */ | 29 | #define CONTEXT_CUSTOM 0x40000000 /* | this against anything to get your context number */ |
30 | #define CONTEXT_CUSTOM2 0x20000000 /* as above */ | ||
30 | 31 | ||
31 | #define LAST_ITEM_IN_LIST { CONTEXT_STOPSEARCHING, BUTTON_NONE, BUTTON_NONE } | 32 | #define LAST_ITEM_IN_LIST { CONTEXT_STOPSEARCHING, BUTTON_NONE, BUTTON_NONE } |
32 | #define LAST_ITEM_IN_LIST__NEXTLIST(a) { a, BUTTON_NONE, BUTTON_NONE } | 33 | #define LAST_ITEM_IN_LIST__NEXTLIST(a) { a, BUTTON_NONE, BUTTON_NONE } |
33 | 34 | ||
34 | #ifndef HAS_BUTTON_HOLD | 35 | #ifndef HAS_BUTTON_HOLD |
35 | #define ALLOW_SOFTLOCK 0x20000000 /* will be stripped.. never needed except in calls to get_action() */ | 36 | #define ALLOW_SOFTLOCK 0x10000000 /* will be stripped.. never needed except in calls to get_action() */ |
36 | #else | 37 | #else |
37 | #define ALLOW_SOFTLOCK 0 | 38 | #define ALLOW_SOFTLOCK 0 |
38 | #endif | 39 | #endif |
@@ -79,6 +80,7 @@ enum { | |||
79 | ACTION_UNKNOWN, | 80 | ACTION_UNKNOWN, |
80 | ACTION_REDRAW, /* returned if keys are locked and we splash()'ed */ | 81 | ACTION_REDRAW, /* returned if keys are locked and we splash()'ed */ |
81 | ACTION_TOUCHPAD, | 82 | ACTION_TOUCHPAD, |
83 | ACTION_TOUCHPAD_MODE, /* toggle the touchpad mode */ | ||
82 | 84 | ||
83 | /* standard actions, use these first */ | 85 | /* standard actions, use these first */ |
84 | ACTION_STD_PREV, | 86 | ACTION_STD_PREV, |
diff --git a/apps/keymaps/keymap-cowond2.c b/apps/keymaps/keymap-cowond2.c index ff4fdc5417..59ca7cb123 100644 --- a/apps/keymaps/keymap-cowond2.c +++ b/apps/keymaps/keymap-cowond2.c | |||
@@ -37,48 +37,27 @@ | |||
37 | */ | 37 | */ |
38 | 38 | ||
39 | static const struct button_mapping button_context_standard[] = { | 39 | static const struct button_mapping button_context_standard[] = { |
40 | { ACTION_STD_PREV, BUTTON_UP, BUTTON_NONE }, | ||
41 | { ACTION_STD_PREV, BUTTON_MINUS, BUTTON_NONE }, | 40 | { ACTION_STD_PREV, BUTTON_MINUS, BUTTON_NONE }, |
42 | { ACTION_STD_PREVREPEAT, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE }, | ||
43 | { ACTION_STD_PREVREPEAT, BUTTON_MINUS|BUTTON_REPEAT, BUTTON_NONE }, | 41 | { ACTION_STD_PREVREPEAT, BUTTON_MINUS|BUTTON_REPEAT, BUTTON_NONE }, |
44 | { ACTION_STD_NEXT, BUTTON_DOWN, BUTTON_NONE }, | ||
45 | { ACTION_STD_NEXT, BUTTON_PLUS, BUTTON_NONE }, | 42 | { ACTION_STD_NEXT, BUTTON_PLUS, BUTTON_NONE }, |
46 | { ACTION_STD_NEXTREPEAT, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE }, | ||
47 | { ACTION_STD_NEXTREPEAT, BUTTON_PLUS|BUTTON_REPEAT, BUTTON_NONE }, | 43 | { ACTION_STD_NEXTREPEAT, BUTTON_PLUS|BUTTON_REPEAT, BUTTON_NONE }, |
48 | 44 | ||
49 | { ACTION_STD_OK, BUTTON_MENU|BUTTON_REL, BUTTON_NONE }, | 45 | { ACTION_STD_OK, BUTTON_MENU|BUTTON_REL, BUTTON_NONE }, |
50 | { ACTION_STD_OK, BUTTON_RIGHT|BUTTON_REL, BUTTON_RIGHT }, | ||
51 | |||
52 | { ACTION_STD_MENU, BUTTON_MENU|BUTTON_REPEAT, BUTTON_NONE }, | 46 | { ACTION_STD_MENU, BUTTON_MENU|BUTTON_REPEAT, BUTTON_NONE }, |
53 | // { ACTION_STD_QUICKSCREEN, BUTTON_MENU|BUTTON_REPEAT, BUTTON_NONE }, | 47 | // { ACTION_STD_QUICKSCREEN, BUTTON_MENU|BUTTON_REPEAT, BUTTON_NONE }, |
54 | { ACTION_STD_CONTEXT, BUTTON_PLUS|BUTTON_REPEAT, BUTTON_NONE }, | 48 | { ACTION_STD_CONTEXT, BUTTON_PLUS|BUTTON_REPEAT, BUTTON_NONE }, |
55 | { ACTION_STD_CONTEXT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE }, | ||
56 | { ACTION_STD_CANCEL, BUTTON_POWER, BUTTON_NONE }, | 49 | { ACTION_STD_CANCEL, BUTTON_POWER, BUTTON_NONE }, |
57 | { ACTION_STD_CANCEL, BUTTON_LEFT, BUTTON_NONE }, | ||
58 | { ACTION_STD_CANCEL, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE }, | ||
59 | LAST_ITEM_IN_LIST | 50 | LAST_ITEM_IN_LIST |
60 | }; /* button_context_standard */ | 51 | }; /* button_context_standard */ |
61 | 52 | ||
62 | 53 | ||
63 | static const struct button_mapping button_context_wps[] = { | 54 | static const struct button_mapping button_context_wps[] = { |
64 | { ACTION_WPS_PLAY, BUTTON_SELECT|BUTTON_REL, BUTTON_SELECT }, | ||
65 | { ACTION_WPS_STOP, BUTTON_SELECT|BUTTON_REPEAT, BUTTON_SELECT }, | ||
66 | { ACTION_WPS_SKIPPREV, BUTTON_LEFT|BUTTON_REL, BUTTON_LEFT }, | ||
67 | { ACTION_WPS_SEEKBACK, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE }, | ||
68 | { ACTION_WPS_STOPSEEK, BUTTON_LEFT|BUTTON_REL, BUTTON_LEFT|BUTTON_REPEAT }, | ||
69 | { ACTION_WPS_SKIPNEXT, BUTTON_RIGHT|BUTTON_REL, BUTTON_RIGHT }, | ||
70 | { ACTION_WPS_SEEKFWD, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE }, | ||
71 | { ACTION_WPS_STOPSEEK, BUTTON_RIGHT|BUTTON_REL, BUTTON_RIGHT|BUTTON_REPEAT }, | ||
72 | 55 | ||
73 | { ACTION_WPS_VOLDOWN, BUTTON_MINUS, BUTTON_NONE }, | 56 | { ACTION_WPS_VOLDOWN, BUTTON_MINUS, BUTTON_NONE }, |
74 | { ACTION_WPS_VOLDOWN, BUTTON_MINUS|BUTTON_REPEAT, BUTTON_NONE }, | 57 | { ACTION_WPS_VOLDOWN, BUTTON_MINUS|BUTTON_REPEAT, BUTTON_NONE }, |
75 | { ACTION_WPS_VOLUP, BUTTON_PLUS, BUTTON_NONE }, | 58 | { ACTION_WPS_VOLUP, BUTTON_PLUS, BUTTON_NONE }, |
76 | { ACTION_WPS_VOLUP, BUTTON_PLUS|BUTTON_REPEAT, BUTTON_NONE }, | 59 | { ACTION_WPS_VOLUP, BUTTON_PLUS|BUTTON_REPEAT, BUTTON_NONE }, |
77 | |||
78 | { ACTION_WPS_BROWSE, BUTTON_UP|BUTTON_REL, BUTTON_UP }, | ||
79 | { ACTION_WPS_CONTEXT, BUTTON_UP|BUTTON_REPEAT, BUTTON_UP }, | ||
80 | { ACTION_WPS_MENU, BUTTON_MENU|BUTTON_REL, BUTTON_MENU }, | 60 | { ACTION_WPS_MENU, BUTTON_MENU|BUTTON_REL, BUTTON_MENU }, |
81 | { ACTION_WPS_QUICKSCREEN, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_DOWN }, | ||
82 | LAST_ITEM_IN_LIST | 61 | LAST_ITEM_IN_LIST |
83 | }; /* button_context_wps */ | 62 | }; /* button_context_wps */ |
84 | 63 | ||
@@ -99,13 +78,9 @@ static const struct button_mapping button_context_listtree_scroll_without_combo[ | |||
99 | }; | 78 | }; |
100 | 79 | ||
101 | static const struct button_mapping button_context_settings[] = { | 80 | static const struct button_mapping button_context_settings[] = { |
102 | { ACTION_SETTINGS_INC, BUTTON_UP, BUTTON_NONE }, | ||
103 | { ACTION_SETTINGS_INC, BUTTON_PLUS, BUTTON_NONE }, | 81 | { ACTION_SETTINGS_INC, BUTTON_PLUS, BUTTON_NONE }, |
104 | { ACTION_SETTINGS_INCREPEAT, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE }, | ||
105 | { ACTION_SETTINGS_INCREPEAT, BUTTON_PLUS|BUTTON_REPEAT, BUTTON_NONE }, | 82 | { ACTION_SETTINGS_INCREPEAT, BUTTON_PLUS|BUTTON_REPEAT, BUTTON_NONE }, |
106 | { ACTION_SETTINGS_DEC, BUTTON_DOWN, BUTTON_NONE }, | ||
107 | { ACTION_SETTINGS_DEC, BUTTON_MINUS, BUTTON_NONE }, | 83 | { ACTION_SETTINGS_DEC, BUTTON_MINUS, BUTTON_NONE }, |
108 | { ACTION_SETTINGS_DECREPEAT, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE }, | ||
109 | { ACTION_SETTINGS_DECREPEAT, BUTTON_MINUS|BUTTON_REPEAT, BUTTON_NONE }, | 84 | { ACTION_SETTINGS_DECREPEAT, BUTTON_MINUS|BUTTON_REPEAT, BUTTON_NONE }, |
110 | { ACTION_STD_OK, BUTTON_MENU, BUTTON_NONE }, | 85 | { ACTION_STD_OK, BUTTON_MENU, BUTTON_NONE }, |
111 | { ACTION_STD_CANCEL, BUTTON_POWER, BUTTON_NONE }, | 86 | { ACTION_STD_CANCEL, BUTTON_POWER, BUTTON_NONE }, |
@@ -154,10 +129,9 @@ static const struct button_mapping button_context_keyboard[] = { | |||
154 | //LAST_ITEM_IN_LIST | 129 | //LAST_ITEM_IN_LIST |
155 | }; /* button_context_keyboard */ | 130 | }; /* button_context_keyboard */ |
156 | 131 | ||
157 | extern int current_tick; | 132 | const struct button_mapping* target_get_context_mapping(int context) |
158 | const struct button_mapping* get_context_mapping(int context) | ||
159 | { | 133 | { |
160 | switch (context&(~CONTEXT_REMOTE)) | 134 | switch (context) |
161 | { | 135 | { |
162 | case CONTEXT_STD: | 136 | case CONTEXT_STD: |
163 | return button_context_standard; | 137 | return button_context_standard; |
diff --git a/apps/keymaps/keymap-mr500.c b/apps/keymaps/keymap-mr500.c index b0d75c15bf..c680929efd 100755 --- a/apps/keymaps/keymap-mr500.c +++ b/apps/keymaps/keymap-mr500.c | |||
@@ -17,7 +17,7 @@ | |||
17 | * | 17 | * |
18 | ****************************************************************************/ | 18 | ****************************************************************************/ |
19 | 19 | ||
20 | /* Button Code Definitions for the toshiba gigabeat target */ | 20 | /* Button Code Definitions for the Olympus M:robe 500 target */ |
21 | #include <stdio.h> | 21 | #include <stdio.h> |
22 | #include <string.h> | 22 | #include <string.h> |
23 | #include <stdlib.h> | 23 | #include <stdlib.h> |
@@ -137,8 +137,7 @@ static const struct button_mapping button_context_keyboard[] = { | |||
137 | LAST_ITEM_IN_LIST | 137 | LAST_ITEM_IN_LIST |
138 | }; /* button_context_keyboard */ | 138 | }; /* button_context_keyboard */ |
139 | 139 | ||
140 | extern int current_tick; | 140 | const struct button_mapping* target_get_context_mapping(int context) |
141 | const struct button_mapping* get_context_mapping(int context) | ||
142 | { | 141 | { |
143 | switch (context&(~CONTEXT_REMOTE)) | 142 | switch (context&(~CONTEXT_REMOTE)) |
144 | { | 143 | { |
diff --git a/apps/keymaps/keymap-touchpad.c b/apps/keymaps/keymap-touchpad.c new file mode 100644 index 0000000000..48f1103cd3 --- /dev/null +++ b/apps/keymaps/keymap-touchpad.c | |||
@@ -0,0 +1,214 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id: keymap-mr500.c 16056 2008-01-11 21:48:01Z roolku $ | ||
9 | * | ||
10 | * Copyright (C) 2006 Jonathan Gordon | ||
11 | * | ||
12 | * All files in this archive are subject to the GNU General Public License. | ||
13 | * See the file COPYING in the source tree root for full license agreement. | ||
14 | * | ||
15 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
16 | * KIND, either express or implied. | ||
17 | * | ||
18 | ****************************************************************************/ | ||
19 | |||
20 | /* Button Code Definitions for touchpad targets */ | ||
21 | #include <stdio.h> | ||
22 | #include <string.h> | ||
23 | #include <stdlib.h> | ||
24 | |||
25 | #include "config.h" | ||
26 | #include "action.h" | ||
27 | #include "button.h" | ||
28 | #include "settings.h" | ||
29 | |||
30 | const struct button_mapping* target_get_context_mapping(int context); | ||
31 | /* How this file is used: | ||
32 | get_context_mapping() at the bottom of the file is called by action.c as usual. | ||
33 | if the context is for the remote control its then passed straight to | ||
34 | target_get_context_mapping(). | ||
35 | These tables are only used for the touchpad buttons, so at the end of each | ||
36 | CONTEXT_CUSTOM2 is OR'ed with the context and then sent to target_get_context_mapping() | ||
37 | (NOTE: CONTEXT_CUSTOM2 will be stripped before being sent to make it easier.) | ||
38 | In the target keymap, remember to |CONTEXT_CUSTOM2 in the LAST_ITEM_IN_LIST__NEXTLIST() macro | ||
39 | to speed it up a tiny bit... if you dont it will go through these tables first before going | ||
40 | back to the target file. | ||
41 | */ | ||
42 | |||
43 | |||
44 | /* touchpad "buttons" | ||
45 | screen is split into a 3x3 grid for buttons... | ||
46 | BUTTON_TOPLEFT BUTTON_TOPMIDDLE BUTTON_TOPRIGHT | ||
47 | BUTTON_MIDLEFT BUTTON_CENTER BUTTON_MIDRIGHT | ||
48 | BUTTON_BOTTOMLEFT BUTTON_BOTTOMMIDDLE BUTTON_BOTTOMRIGHT | ||
49 | */ | ||
50 | |||
51 | static const struct button_mapping button_context_standard[] = { | ||
52 | { ACTION_STD_PREV, BUTTON_TOPMIDDLE, BUTTON_NONE }, | ||
53 | { ACTION_STD_PREVREPEAT, BUTTON_TOPMIDDLE|BUTTON_REPEAT, BUTTON_NONE }, | ||
54 | { ACTION_STD_NEXT, BUTTON_BOTTOMMIDDLE, BUTTON_NONE }, | ||
55 | { ACTION_STD_NEXTREPEAT, BUTTON_BOTTOMMIDDLE|BUTTON_REPEAT, BUTTON_NONE }, | ||
56 | |||
57 | { ACTION_STD_OK, BUTTON_CENTER|BUTTON_REL, BUTTON_CENTER }, | ||
58 | { ACTION_STD_OK, BUTTON_MIDRIGHT|BUTTON_REL, BUTTON_MIDRIGHT }, | ||
59 | { ACTION_STD_OK, BUTTON_MIDRIGHT|BUTTON_REPEAT, BUTTON_MIDRIGHT }, | ||
60 | |||
61 | { ACTION_STD_MENU, BUTTON_TOPLEFT, BUTTON_NONE }, | ||
62 | { ACTION_STD_QUICKSCREEN, BUTTON_TOPLEFT|BUTTON_REPEAT, BUTTON_NONE }, | ||
63 | { ACTION_STD_CONTEXT, BUTTON_CENTER|BUTTON_REPEAT, BUTTON_CENTER }, | ||
64 | { ACTION_STD_CANCEL, BUTTON_MIDLEFT, BUTTON_NONE }, | ||
65 | { ACTION_STD_CANCEL, BUTTON_MIDLEFT|BUTTON_REPEAT, BUTTON_NONE }, | ||
66 | LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM2|CONTEXT_STD) | ||
67 | }; /* button_context_standard */ | ||
68 | |||
69 | static const struct button_mapping button_context_wps[] = { | ||
70 | LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM2|CONTEXT_WPS) | ||
71 | }; /* button_context_wps */ | ||
72 | |||
73 | static const struct button_mapping button_context_list[] = { | ||
74 | #if 0 | ||
75 | /* this is all to show how the poor-mans-gestures can be used... */ | ||
76 | { ACTION_LISTTREE_PGUP, BUTTON_TOPRIGHT, BUTTON_NONE}, | ||
77 | { ACTION_LISTTREE_PGUP, BUTTON_TOPRIGHT|BUTTON_REPEAT, BUTTON_TOPRIGHT}, | ||
78 | { ACTION_STD_NEXTREPEAT, BUTTON_CENTER, BUTTON_TOPMIDDLE}, | ||
79 | { ACTION_STD_NEXTREPEAT, BUTTON_BOTTOMMIDDLE, BUTTON_CENTER}, | ||
80 | { ACTION_NONE, BUTTON_TOPMIDDLE, BUTTON_NONE }, | ||
81 | { ACTION_NONE, BUTTON_BOTTOMMIDDLE, BUTTON_NONE }, | ||
82 | { ACTION_STD_PREV, BUTTON_TOPMIDDLE|BUTTON_REL, BUTTON_NONE }, | ||
83 | { ACTION_STD_NEXT, BUTTON_BOTTOMMIDDLE|BUTTON_REL, BUTTON_NONE }, | ||
84 | { ACTION_LISTTREE_PGDOWN, BUTTON_BOTTOMRIGHT, BUTTON_NONE}, | ||
85 | { ACTION_LISTTREE_PGDOWN, BUTTON_BOTTOMRIGHT|BUTTON_REPEAT, BUTTON_BOTTOMRIGHT}, | ||
86 | { ACTION_STD_PREVREPEAT, BUTTON_TOPMIDDLE, BUTTON_CENTER}, | ||
87 | { ACTION_STD_PREVREPEAT, BUTTON_CENTER, BUTTON_BOTTOMMIDDLE}, | ||
88 | #endif | ||
89 | LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM2|CONTEXT_LIST) | ||
90 | }; /* button_context_list */ | ||
91 | |||
92 | static const struct button_mapping button_context_tree[] = { | ||
93 | LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM2|CONTEXT_CUSTOM2|CONTEXT_TREE) | ||
94 | }; /* button_context_tree */ | ||
95 | |||
96 | static const struct button_mapping button_context_listtree_scroll_with_combo[] = { | ||
97 | LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM2|CONTEXT_CUSTOM|CONTEXT_TREE), | ||
98 | }; | ||
99 | |||
100 | static const struct button_mapping button_context_listtree_scroll_without_combo[] = { | ||
101 | LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM2|CONTEXT_CUSTOM|CONTEXT_TREE), | ||
102 | }; | ||
103 | |||
104 | static const struct button_mapping button_context_settings[] = { | ||
105 | { ACTION_SETTINGS_INC, BUTTON_TOPMIDDLE, BUTTON_NONE }, | ||
106 | { ACTION_SETTINGS_INCREPEAT, BUTTON_TOPMIDDLE|BUTTON_REPEAT, BUTTON_NONE }, | ||
107 | { ACTION_SETTINGS_DEC, BUTTON_BOTTOMMIDDLE, BUTTON_NONE }, | ||
108 | { ACTION_SETTINGS_DECREPEAT, BUTTON_BOTTOMMIDDLE|BUTTON_REPEAT, BUTTON_NONE }, | ||
109 | { ACTION_STD_OK, BUTTON_CENTER, BUTTON_NONE }, | ||
110 | { ACTION_STD_CANCEL, BUTTON_MIDLEFT, BUTTON_NONE }, | ||
111 | |||
112 | LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM2|CONTEXT_SETTINGS) | ||
113 | }; /* button_context_settings */ | ||
114 | |||
115 | static const struct button_mapping button_context_settings_right_is_inc[] = { | ||
116 | { ACTION_STD_PREV, BUTTON_TOPMIDDLE, BUTTON_NONE }, | ||
117 | { ACTION_STD_PREVREPEAT, BUTTON_TOPMIDDLE|BUTTON_REPEAT, BUTTON_NONE }, | ||
118 | { ACTION_STD_NEXT, BUTTON_BOTTOMMIDDLE, BUTTON_NONE }, | ||
119 | { ACTION_STD_NEXTREPEAT, BUTTON_BOTTOMMIDDLE|BUTTON_REPEAT, BUTTON_NONE }, | ||
120 | { ACTION_SETTINGS_INC, BUTTON_MIDRIGHT, BUTTON_NONE }, | ||
121 | { ACTION_SETTINGS_INCREPEAT, BUTTON_MIDRIGHT|BUTTON_REPEAT, BUTTON_NONE }, | ||
122 | { ACTION_SETTINGS_DEC, BUTTON_MIDLEFT, BUTTON_NONE }, | ||
123 | { ACTION_SETTINGS_DECREPEAT, BUTTON_MIDLEFT|BUTTON_REPEAT, BUTTON_NONE }, | ||
124 | { ACTION_STD_OK, BUTTON_CENTER, BUTTON_NONE }, | ||
125 | { ACTION_STD_CANCEL, BUTTON_TOPLEFT, BUTTON_NONE }, | ||
126 | LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM2|CONTEXT_CUSTOM|CONTEXT_SETTINGS) | ||
127 | }; /* button_context_settingsgraphical */ | ||
128 | |||
129 | static const struct button_mapping button_context_yesno[] = { | ||
130 | { ACTION_YESNO_ACCEPT, BUTTON_MIDLEFT, BUTTON_NONE }, | ||
131 | LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM2|CONTEXT_YESNOSCREEN) | ||
132 | }; /* button_context_settings_yesno */ | ||
133 | |||
134 | static const struct button_mapping button_context_colorchooser[] = { | ||
135 | LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM2|CONTEXT_SETTINGS_COLOURCHOOSER), | ||
136 | }; /* button_context_colorchooser */ | ||
137 | |||
138 | static const struct button_mapping button_context_eq[] = { | ||
139 | LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM2|CONTEXT_SETTINGS_EQ), | ||
140 | }; /* button_context_eq */ | ||
141 | |||
142 | /* Bookmark Screen */ | ||
143 | static const struct button_mapping button_context_bmark[] = { | ||
144 | LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM2|CONTEXT_BOOKMARKSCREEN), | ||
145 | }; /* button_context_bmark */ | ||
146 | |||
147 | static const struct button_mapping button_context_time[] = { | ||
148 | LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM2|CONTEXT_SETTINGS_TIME), | ||
149 | }; /* button_context_time */ | ||
150 | |||
151 | static const struct button_mapping button_context_quickscreen[] = { | ||
152 | |||
153 | LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM2|CONTEXT_QUICKSCREEN) | ||
154 | }; /* button_context_quickscreen */ | ||
155 | |||
156 | static const struct button_mapping button_context_pitchscreen[] = { | ||
157 | |||
158 | LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM2|CONTEXT_PITCHSCREEN) | ||
159 | }; /* button_context_pitchcreen */ | ||
160 | |||
161 | static const struct button_mapping button_context_keyboard[] = { | ||
162 | |||
163 | LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM2|CONTEXT_KEYBOARD) | ||
164 | }; /* button_context_keyboard */ | ||
165 | |||
166 | const struct button_mapping* get_context_mapping(int context) | ||
167 | { | ||
168 | if ((context&CONTEXT_REMOTE) || (context&CONTEXT_CUSTOM2)) | ||
169 | return target_get_context_mapping(context&(~CONTEXT_CUSTOM2)); | ||
170 | |||
171 | switch (context) | ||
172 | { | ||
173 | case CONTEXT_STD: | ||
174 | return button_context_standard; | ||
175 | case CONTEXT_WPS: | ||
176 | return button_context_wps; | ||
177 | |||
178 | case CONTEXT_LIST: | ||
179 | return button_context_list; | ||
180 | case CONTEXT_MAINMENU: | ||
181 | case CONTEXT_TREE: | ||
182 | if (global_settings.hold_lr_for_scroll_in_list) | ||
183 | return button_context_listtree_scroll_without_combo; | ||
184 | else | ||
185 | return button_context_listtree_scroll_with_combo; | ||
186 | case CONTEXT_CUSTOM|CONTEXT_TREE: | ||
187 | return button_context_tree; | ||
188 | |||
189 | case CONTEXT_SETTINGS: | ||
190 | return button_context_settings; | ||
191 | case CONTEXT_CUSTOM|CONTEXT_SETTINGS: | ||
192 | return button_context_settings_right_is_inc; | ||
193 | |||
194 | case CONTEXT_SETTINGS_COLOURCHOOSER: | ||
195 | return button_context_colorchooser; | ||
196 | case CONTEXT_SETTINGS_EQ: | ||
197 | return button_context_eq; | ||
198 | |||
199 | case CONTEXT_SETTINGS_TIME: | ||
200 | return button_context_time; | ||
201 | |||
202 | case CONTEXT_YESNOSCREEN: | ||
203 | return button_context_yesno; | ||
204 | case CONTEXT_BOOKMARKSCREEN: | ||
205 | return button_context_bmark; | ||
206 | case CONTEXT_QUICKSCREEN: | ||
207 | return button_context_quickscreen; | ||
208 | case CONTEXT_PITCHSCREEN: | ||
209 | return button_context_pitchscreen; | ||
210 | case CONTEXT_KEYBOARD: | ||
211 | return button_context_keyboard; | ||
212 | } | ||
213 | return button_context_standard; | ||
214 | } | ||
diff --git a/apps/main.c b/apps/main.c index 3f83850df7..7309d95df2 100644 --- a/apps/main.c +++ b/apps/main.c | |||
@@ -132,6 +132,9 @@ static void app_main(void) | |||
132 | screens[i].update(); | 132 | screens[i].update(); |
133 | } | 133 | } |
134 | tree_gui_init(); | 134 | tree_gui_init(); |
135 | #ifdef HAVE_TOUCHPAD | ||
136 | touchpad_set_mode(TOUCHPAD_BUTTON); | ||
137 | #endif | ||
135 | root_menu(); | 138 | root_menu(); |
136 | } | 139 | } |
137 | 140 | ||