diff options
author | Linus Nielsen Feltzing <linus@haxx.se> | 2006-08-15 12:27:07 +0000 |
---|---|---|
committer | Linus Nielsen Feltzing <linus@haxx.se> | 2006-08-15 12:27:07 +0000 |
commit | 224c0a13ebb5828b9bc06a9c1c23ae17f0ac19f9 (patch) | |
tree | bae2154b272f786983cf8e6de28d33f98f327560 /apps/action.h | |
parent | c0f8b187706364f5e4bda2ac26750d14454c901d (diff) | |
download | rockbox-224c0a13ebb5828b9bc06a9c1c23ae17f0ac19f9.tar.gz rockbox-224c0a13ebb5828b9bc06a9c1c23ae17f0ac19f9.zip |
Finally, the new button action system is here, thanks to Jonathan Gordon. Some button mappings have changed and other things may break. Comments should go to the forum, http://forums.rockbox.org/index.php?topic=5829.0 or the mailing list.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@10582 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/action.h')
-rw-r--r-- | apps/action.h | 146 |
1 files changed, 141 insertions, 5 deletions
diff --git a/apps/action.h b/apps/action.h index 3c3db7d54e..24f3d990f0 100644 --- a/apps/action.h +++ b/apps/action.h | |||
@@ -19,11 +19,147 @@ | |||
19 | #define __ACTION_H__ | 19 | #define __ACTION_H__ |
20 | 20 | ||
21 | #include "stdbool.h" | 21 | #include "stdbool.h" |
22 | #include "button.h" | ||
22 | 23 | ||
23 | #define CONTEXT_WPS 1 | 24 | #define LAST_ITEM_IN_LIST { ACTION_NONE, BUTTON_NONE, BUTTON_NONE } |
24 | #define CONTEXT_TREE 2 | 25 | #define LAST_ITEM_IN_LIST__NEXTLIST(a) { a, BUTTON_NONE, BUTTON_NONE } |
25 | #define CONTEXT_RECORD 3 | 26 | |
26 | #define CONTEXT_MAINMENU 4 | 27 | #define TIMEOUT_BLOCK -1 |
27 | #define CONTEXT_ID3DB 5 | 28 | #define TIMEOUT_NOBLOCK 0 |
29 | #define CONTEXT_REMOTE 0x80000000 /* | this against another context to get remote buttons for that context */ | ||
30 | #define CONTEXT_CUSTOM 0x40000000 /* | this against anything to get your context number */ | ||
31 | |||
32 | enum { | ||
33 | CONTEXT_STD = 0, | ||
34 | /* These CONTEXT_ values were here before me, | ||
35 | there values may have significance, so dont touch! */ | ||
36 | CONTEXT_WPS = 1, | ||
37 | CONTEXT_TREE = 2, | ||
38 | CONTEXT_RECORD = 3, | ||
39 | CONTEXT_MAINMENU = 4, | ||
40 | CONTEXT_ID3DB = 5, | ||
41 | /* Add new contexts here, no need to explicitly define a value for them */ | ||
42 | CONTEXT_LIST, | ||
43 | CONTEXT_SETTINGS, /* options style settings, like from menus */ | ||
44 | CONTEXT_SETTINGSGRAPHICAL, /* screens like eq config and colour chooser */ | ||
45 | |||
46 | CONTEXT_YESNOSCREEN, /*NOTE: make sure your target has this and ACTION_YESNO_ACCEPT */ | ||
47 | CONTEXT_BOOKMARKSCREEN, /*NOTE: requires the action_setting_* mappings also */ | ||
48 | CONTEXT_QUICKSCREEN, /* uses ACTION_QS_ defines below */ | ||
49 | }; | ||
50 | |||
51 | |||
52 | enum { | ||
53 | |||
54 | ACTION_NONE = BUTTON_NONE, | ||
55 | ACTION_UNKNOWN, | ||
56 | |||
57 | /* standard actions, use these first */ | ||
58 | ACTION_STD_PREV, | ||
59 | ACTION_STD_PREVREPEAT, | ||
60 | ACTION_STD_NEXT, | ||
61 | ACTION_STD_NEXTREPEAT, | ||
62 | |||
63 | ACTION_STD_OK, | ||
64 | ACTION_STD_CANCEL, | ||
65 | ACTION_STD_CONTEXT, | ||
66 | ACTION_STD_MENU, | ||
67 | ACTION_STD_QUICKSCREEN, | ||
68 | ACTION_STD_KEYLOCK, /* software keylock in wps screen, very optional | ||
69 | use with action_setsoftwarekeylock */ | ||
70 | |||
71 | |||
72 | /* code context actions */ | ||
73 | |||
74 | /* WPS codes */ | ||
75 | ACTION_WPS_BROWSE, | ||
76 | ACTION_WPS_PLAY, | ||
77 | ACTION_WPS_SEEKBACK, | ||
78 | ACTION_WPS_SEEKFWD, | ||
79 | ACTION_WPS_STOPSEEK, | ||
80 | ACTION_WPS_SKIPNEXT, | ||
81 | ACTION_WPS_SKIPPREV, | ||
82 | ACTION_WPS_STOP, | ||
83 | ACTION_WPS_VOLDOWN, | ||
84 | ACTION_WPS_VOLUP, | ||
85 | ACTION_WPS_NEXTDIR,/* optional */ | ||
86 | ACTION_WPS_PREVDIR,/* optional */ | ||
87 | ACTION_WPS_PITCHSCREEN,/* optional */ | ||
88 | ACTION_WPS_ID3SCREEN,/* optional */ | ||
89 | ACTION_WPS_CONTEXT, | ||
90 | ACTION_WPS_QUICKSCREEN,/* optional */ | ||
91 | ACTION_WPS_MENU, /*this should be the same as ACTION_STD_MENU */ | ||
92 | /* following code are for AB mode in wps, | ||
93 | only needed if defined(AB_REPEAT_ENABLE) */ | ||
94 | ACTION_WPSAB_SINGLE, /* No targets use this, but leave n just-in-case! */ | ||
95 | ACTION_WPSAB_SETA, /* either #define WPS_AB_SHARE_DIR_BUTTONS */ | ||
96 | ACTION_WPSAB_SETB, /* OR implement ACTION_WPSAB_SET[AB] */ | ||
97 | ACTION_WPSAB_RESET, | ||
98 | |||
99 | /* list and tree page up/down */ | ||
100 | ACTION_LISTTREE_PGUP,/* optional */ | ||
101 | ACTION_LISTTREE_PGDOWN,/* optional */ | ||
102 | ACTION_LISTTREE_RC_PGUP,/* optional */ | ||
103 | ACTION_LISTTREE_RC_PGDOWN,/* optional */ | ||
104 | |||
105 | /* tree */ | ||
106 | ACTION_TREE_PGLEFT,/* optional */ | ||
107 | ACTION_TREE_PGRIGHT,/* optional */ | ||
108 | ACTION_TREE_STOP, | ||
109 | ACTION_TREE_WPS, | ||
110 | |||
111 | /* recording screen */ | ||
112 | |||
113 | /* main menu */ | ||
114 | |||
115 | /* id3db */ | ||
116 | |||
117 | /* list */ | ||
118 | |||
119 | /* settings */ | ||
120 | ACTION_SETTINGS_INC, | ||
121 | ACTION_SETTINGS_INCREPEAT, | ||
122 | ACTION_SETTINGS_DEC, | ||
123 | ACTION_SETTINGS_DECREPEAT, | ||
124 | |||
125 | /* yesno screen */ | ||
126 | ACTION_YESNO_ACCEPT, | ||
127 | |||
128 | /* bookmark screen */ | ||
129 | ACTION_BMARK_DELETE, | ||
130 | |||
131 | /* quickscreen */ | ||
132 | ACTION_QS_LEFT, | ||
133 | ACTION_QS_RIGHT, | ||
134 | ACTION_QS_DOWN, | ||
135 | ACTION_QS_DOWNINV, /* why is this not called up?? :p */ | ||
136 | |||
137 | }; | ||
138 | |||
139 | struct button_mapping { | ||
140 | int action_code; | ||
141 | int button_code; | ||
142 | int pre_button_code; | ||
143 | }; | ||
144 | /* use if you want to supply your own button mappings, PLUGINS ONLY */ | ||
145 | /* get_context_map is a function which returns a button_mapping* depedning on the given context */ | ||
146 | /* custom button_mappings may "chain" to inbuilt CONTEXT's */ | ||
147 | int get_custom_action(int context,int timeout, | ||
148 | struct button_mapping* (*get_context_map)(int)); | ||
149 | /* use if one of the standard CONTEXT_ mappings will work (ALL the core should be using this! */ | ||
150 | int get_action(int context, int timeout); | ||
151 | /* call this whenever you leave your button loop */ | ||
152 | void action_signalscreenchange(void); | ||
153 | |||
154 | /* call this if you need to check for ACTION_STD_CANCEL only (i.e user abort! */ | ||
155 | bool action_userabort(int timeout); | ||
156 | |||
157 | /* on targets without hardware keylock, use this to to emulate keylock. | ||
158 | unlock_action is the action which will disaable the keylock | ||
159 | allow_remote should be true if you want the remote buttons to still be usable while locked */ | ||
160 | void action_setsoftwarekeylock(int unlock_action, bool allow_remote); | ||
161 | |||
162 | /* no other code should need this apart from action.c */ | ||
163 | struct button_mapping* get_context_mapping(int context); | ||
28 | 164 | ||
29 | #endif | 165 | #endif |