1 is the correct value here. Not that it makes any difference... :)
[kugel-rb.git] / apps / action.h
blob1bbe6fc6e8c0df73a0755884779c3551c54a4fb6
1 /***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
9 * Copyright (C) 2004 Brent Coutts
11 * All files in this archive are subject to the GNU General Public License.
12 * See the file COPYING in the source tree root for full license agreement.
14 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
15 * KIND, either express or implied.
17 ****************************************************************************/
18 #ifndef __ACTION_H__
19 #define __ACTION_H__
21 #include "stdbool.h"
22 #include "button.h"
24 #define TIMEOUT_BLOCK -1
25 #define TIMEOUT_NOBLOCK 0
27 #define CONTEXT_STOPSEARCHING 0xFFFFFFFF
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 */
31 #define LAST_ITEM_IN_LIST { CONTEXT_STOPSEARCHING, BUTTON_NONE, BUTTON_NONE }
32 #define LAST_ITEM_IN_LIST__NEXTLIST(a) { a, BUTTON_NONE, BUTTON_NONE }
34 #ifndef HAS_BUTTON_HOLD
35 #define ALLOW_SOFTLOCK 0x20000000 /* will be stripped.. never needed except in calls to get_action() */
36 #else
37 #define ALLOW_SOFTLOCK 0
38 #endif
40 enum {
41 CONTEXT_STD = 0,
42 /* These CONTEXT_ values were here before me,
43 there values may have significance, so dont touch! */
44 CONTEXT_WPS = 1,
45 CONTEXT_TREE = 2,
46 CONTEXT_RECORD = 3,
47 CONTEXT_MAINMENU = 4,
48 CONTEXT_ID3DB = 5,
49 /* Add new contexts here, no need to explicitly define a value for them */
50 CONTEXT_LIST,
51 CONTEXT_SETTINGS, /* regular setting screens (and debug screens) */
52 /* bellow are setting screens which may need to redefine the standard
53 setting screen keys, targets should return the CONTEXT_SETTINGS
54 keymap unless they are not adequate for the screen
55 NOTE: uses ACTION_STD_[NEXT|PREV] so make sure they are there also
56 and (possibly) ACTION_SETTINGS_[INC|DEC] */
57 CONTEXT_SETTINGS_EQ,
58 CONTEXT_SETTINGS_COLOURCHOOSER,
59 CONTEXT_SETTINGS_TIME,
61 /* The following contexts should use ACTION_STD_[NEXT|PREV]
62 and (possibly) ACTION_SETTINGS_[INC|DEC]
63 Also add any extra actions they need */
64 CONTEXT_BOOKMARKSCREEN, /* uses ACTION_BMS_ defines */
65 CONTEXT_ALARMSCREEN, /* uses ACTION_AS_ defines */
66 CONTEXT_QUICKSCREEN, /* uses ACTION_QS_ defines below */
67 CONTEXT_PITCHSCREEN, /* uses ACTION_PS_ defines below */
69 CONTEXT_YESNOSCREEN, /*NOTE: make sure your target has this and ACTION_YESNO_ACCEPT */
70 CONTEXT_RECSCREEN,
71 CONTEXT_KEYBOARD,
75 enum {
77 ACTION_NONE = BUTTON_NONE,
78 ACTION_UNKNOWN,
79 ACTION_REDRAW, /* returned if keys are locked and we splash()'ed */
81 /* standard actions, use these first */
82 ACTION_STD_PREV,
83 ACTION_STD_PREVREPEAT,
84 ACTION_STD_NEXT,
85 ACTION_STD_NEXTREPEAT,
87 ACTION_STD_OK,
88 ACTION_STD_CANCEL,
89 ACTION_STD_CONTEXT,
90 ACTION_STD_MENU,
91 ACTION_STD_QUICKSCREEN,
92 ACTION_STD_KEYLOCK,
94 ACTION_F3, /* just so everything works again, possibly change me */
95 /* code context actions */
97 /* WPS codes */
98 ACTION_WPS_BROWSE,
99 ACTION_WPS_PLAY,
100 ACTION_WPS_SEEKBACK,
101 ACTION_WPS_SEEKFWD,
102 ACTION_WPS_STOPSEEK,
103 ACTION_WPS_SKIPNEXT,
104 ACTION_WPS_SKIPPREV,
105 ACTION_WPS_STOP,
106 ACTION_WPS_VOLDOWN,
107 ACTION_WPS_VOLUP,
108 ACTION_WPS_PITCHSCREEN,/* optional */
109 ACTION_WPS_ID3SCREEN,/* optional */
110 ACTION_WPS_CONTEXT,
111 ACTION_WPS_QUICKSCREEN,/* optional */
112 ACTION_WPS_MENU, /*this should be the same as ACTION_STD_MENU */
113 ACTION_WPSAB_SINGLE, /* No targets use this, but leave n just-in-case! */
114 ACTION_WPS_ABSETA_PREVDIR, /* these should be safe to put together seen as */
115 ACTION_WPS_ABSETB_NEXTDIR, /* you shouldnt want to change dir in ab-mode */
116 ACTION_WPSAB_RESET,
118 /* list and tree page up/down */
119 ACTION_LISTTREE_PGUP,/* optional */
120 ACTION_LISTTREE_PGDOWN,/* optional */
121 ACTION_LISTTREE_RC_PGUP,/* optional */
122 ACTION_LISTTREE_RC_PGDOWN,/* optional */
124 /* tree */
125 ACTION_TREE_PGLEFT,/* optional */
126 ACTION_TREE_PGRIGHT,/* optional */
127 ACTION_TREE_STOP,
128 ACTION_TREE_WPS,
130 /* recording screen */
131 ACTION_REC_LCD,
132 ACTION_REC_PAUSE,
133 ACTION_REC_NEWFILE,
134 ACTION_REC_F2,
135 ACTION_REC_F3,
137 /* main menu */
139 /* id3db */
141 /* list */
143 /* settings */
144 ACTION_SETTINGS_INC,
145 ACTION_SETTINGS_INCREPEAT,
146 ACTION_SETTINGS_INCBIGSTEP,
147 ACTION_SETTINGS_DEC,
148 ACTION_SETTINGS_DECREPEAT,
149 ACTION_SETTINGS_DECBIGSTEP,
150 ACTION_SETTINGS_RESET,
152 /* bookmark screen */
153 ACTION_BMS_SELECT,
154 ACTION_BMS_DELETE,
155 ACTION_BMS_EXIT,
157 /* alarm menu screen */
159 /* quickscreen */
160 ACTION_QS_LEFT,
161 ACTION_QS_RIGHT,
162 ACTION_QS_DOWN,
163 ACTION_QS_DOWNINV, /* why is this not called up?? :p */
165 /* pitchscreen */
166 /* obviously ignore if you dont have thise screen */
167 ACTION_PS_INC_SMALL,
168 ACTION_PS_INC_BIG,
169 ACTION_PS_DEC_SMALL,
170 ACTION_PS_DEC_BIG,
171 ACTION_PS_NUDGE_LEFT,
172 ACTION_PS_NUDGE_RIGHT,
173 ACTION_PS_NUDGE_LEFTOFF,
174 ACTION_PS_NUDGE_RIGHTOFF,
175 ACTION_PS_RESET,
176 ACTION_PS_EXIT, /* _STD_* isnt going to work here */
178 /* yesno screen */
179 ACTION_YESNO_ACCEPT,
181 /* keyboard screen */
182 ACTION_KBD_LEFT,
183 ACTION_KBD_RIGHT,
184 ACTION_KBD_CURSOR_LEFT,
185 ACTION_KBD_CURSOR_RIGHT,
186 ACTION_KBD_SELECT,
187 ACTION_KBD_SELECT_REM,
188 ACTION_KBD_PAGE_FLIP,
189 ACTION_KBD_DONE,
190 ACTION_KBD_ABORT,
191 ACTION_KBD_BACKSPACE,
192 ACTION_KBD_UP,
193 ACTION_KBD_DOWN,
194 ACTION_KBD_MORSE_INPUT,
195 ACTION_KBD_MORSE_SELECT,
199 struct button_mapping {
200 int action_code;
201 int button_code;
202 int pre_button_code;
204 /* use if you want to supply your own button mappings, PLUGINS ONLY */
205 /* get_context_map is a function which returns a button_mapping* depedning on the given context */
206 /* custom button_mappings may "chain" to inbuilt CONTEXT's */
207 int get_custom_action(int context,int timeout,
208 const struct button_mapping* (*get_context_map)(int));
209 /* use if one of the standard CONTEXT_ mappings will work (ALL the core should be using this! */
210 int get_action(int context, int timeout);
211 /* call this whenever you leave your button loop */
212 void action_signalscreenchange(void);
214 /* call this if you need to check for ACTION_STD_CANCEL only (i.e user abort! */
215 bool action_userabort(int timeout);
217 /* no other code should need this apart from action.c */
218 const struct button_mapping* get_context_mapping(int context);
219 #ifndef HAS_BUTTON_HOLD
220 bool is_keys_locked(void);
221 #endif
222 #endif