summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
authorJeffrey Goode <jeffg7@gmail.com>2010-04-11 00:32:16 +0000
committerJeffrey Goode <jeffg7@gmail.com>2010-04-11 00:32:16 +0000
commitef30d7ef712faf1c98ccc8289dc64854994f0397 (patch)
treec440c6150ebc774b5cbf52540b77905c0bd9b683 /apps
parent66fa12726212c5b597b44bfb5654312f0580953f (diff)
downloadrockbox-ef30d7ef712faf1c98ccc8289dc64854994f0397.tar.gz
rockbox-ef30d7ef712faf1c98ccc8289dc64854994f0397.zip
FS#11195, plus. Simplified hotkey struct, thanks alle!
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@25581 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps')
-rw-r--r--apps/menus/settings_menu.c4
-rw-r--r--apps/onplay.c30
-rw-r--r--apps/onplay.h2
3 files changed, 14 insertions, 22 deletions
diff --git a/apps/menus/settings_menu.c b/apps/menus/settings_menu.c
index 53c5972ee8..db2ad78fdc 100644
--- a/apps/menus/settings_menu.c
+++ b/apps/menus/settings_menu.c
@@ -414,9 +414,9 @@ static void view_hotkey_info(void)
414 info.hide_selection = true; 414 info.hide_selection = true;
415 info.scroll_all = true; 415 info.scroll_all = true;
416 simplelist_addline(SIMPLELIST_ADD_LINE, str(LANG_HOTKEY_VIEW_WPS), 416 simplelist_addline(SIMPLELIST_ADD_LINE, str(LANG_HOTKEY_VIEW_WPS),
417 str(get_hotkey_desc_id(global_settings.hotkey_wps))); 417 get_hotkey_desc(global_settings.hotkey_wps));
418 simplelist_addline(SIMPLELIST_ADD_LINE, str(LANG_HOTKEY_VIEW_FILE_BROWSER), 418 simplelist_addline(SIMPLELIST_ADD_LINE, str(LANG_HOTKEY_VIEW_FILE_BROWSER),
419 str(get_hotkey_desc_id(global_settings.hotkey_tree))); 419 get_hotkey_desc(global_settings.hotkey_tree));
420 simplelist_show_list(&info); 420 simplelist_show_list(&info);
421} 421}
422 422
diff --git a/apps/onplay.c b/apps/onplay.c
index 27a3196e16..87474956c4 100644
--- a/apps/onplay.c
+++ b/apps/onplay.c
@@ -1218,8 +1218,7 @@ struct hotkey_assignment {
1218 int item; /* Bit or'd hotkey_action and HOTKEY_CTX_x */ 1218 int item; /* Bit or'd hotkey_action and HOTKEY_CTX_x */
1219 struct menu_func func; /* Function to run if this entry is selected */ 1219 struct menu_func func; /* Function to run if this entry is selected */
1220 int return_code; /* What to return after the function is run */ 1220 int return_code; /* What to return after the function is run */
1221 const struct menu_item_ex *menu_addr; 1221 const struct menu_item_ex *menu_addr; /* Must be a MENUITEM_FUNCTION */
1222 int lang_id; /* How to present the item to the user */
1223}; 1222};
1224 1223
1225#define HOTKEY_FUNC(func, param) {{(void *)func}, param} 1224#define HOTKEY_FUNC(func, param) {{(void *)func}, param}
@@ -1228,49 +1227,42 @@ struct hotkey_assignment {
1228static struct hotkey_assignment hotkey_items[] = { 1227static struct hotkey_assignment hotkey_items[] = {
1229 { HOTKEY_VIEW_PLAYLIST | HOTKEY_CTX_WPS, 1228 { HOTKEY_VIEW_PLAYLIST | HOTKEY_CTX_WPS,
1230 HOTKEY_FUNC(NULL, NULL), 1229 HOTKEY_FUNC(NULL, NULL),
1231 ONPLAY_PLAYLIST, &view_cur_playlist, 1230 ONPLAY_PLAYLIST, &view_cur_playlist },
1232 LANG_VIEW_DYNAMIC_PLAYLIST },
1233 { HOTKEY_SHOW_TRACK_INFO| HOTKEY_CTX_WPS, 1231 { HOTKEY_SHOW_TRACK_INFO| HOTKEY_CTX_WPS,
1234 HOTKEY_FUNC(browse_id3, NULL), 1232 HOTKEY_FUNC(browse_id3, NULL),
1235 ONPLAY_RELOAD_DIR, &browse_id3_item, 1233 ONPLAY_RELOAD_DIR, &browse_id3_item },
1236 LANG_MENU_SHOW_ID3_INFO },
1237#ifdef HAVE_PITCHSCREEN 1234#ifdef HAVE_PITCHSCREEN
1238 { HOTKEY_PITCHSCREEN | HOTKEY_CTX_WPS, 1235 { HOTKEY_PITCHSCREEN | HOTKEY_CTX_WPS,
1239 HOTKEY_FUNC(gui_syncpitchscreen_run, NULL), 1236 HOTKEY_FUNC(gui_syncpitchscreen_run, NULL),
1240 ONPLAY_RELOAD_DIR, &pitch_screen_item, 1237 ONPLAY_RELOAD_DIR, &pitch_screen_item },
1241 LANG_PITCH },
1242#endif 1238#endif
1243 { HOTKEY_OPEN_WITH | HOTKEY_CTX_WPS | HOTKEY_CTX_TREE, 1239 { HOTKEY_OPEN_WITH | HOTKEY_CTX_WPS | HOTKEY_CTX_TREE,
1244 HOTKEY_FUNC(open_with, NULL), 1240 HOTKEY_FUNC(open_with, NULL),
1245 ONPLAY_RELOAD_DIR, &list_viewers_item, 1241 ONPLAY_RELOAD_DIR, &list_viewers_item },
1246 LANG_ONPLAY_OPEN_WITH },
1247 { HOTKEY_DELETE | HOTKEY_CTX_WPS | HOTKEY_CTX_TREE, 1242 { HOTKEY_DELETE | HOTKEY_CTX_WPS | HOTKEY_CTX_TREE,
1248 HOTKEY_FUNC(delete_item, NULL), 1243 HOTKEY_FUNC(delete_item, NULL),
1249 ONPLAY_RELOAD_DIR, &delete_file_item, 1244 ONPLAY_RELOAD_DIR, &delete_file_item },
1250 LANG_DELETE },
1251 { HOTKEY_DELETE | HOTKEY_CTX_TREE, 1245 { HOTKEY_DELETE | HOTKEY_CTX_TREE,
1252 HOTKEY_FUNC(delete_item, NULL), 1246 HOTKEY_FUNC(delete_item, NULL),
1253 ONPLAY_RELOAD_DIR, &delete_dir_item, 1247 ONPLAY_RELOAD_DIR, &delete_dir_item },
1254 LANG_DELETE },
1255 { HOTKEY_INSERT | HOTKEY_CTX_TREE, 1248 { HOTKEY_INSERT | HOTKEY_CTX_TREE,
1256 HOTKEY_FUNC(playlist_insert_func, (intptr_t*)PLAYLIST_INSERT), 1249 HOTKEY_FUNC(playlist_insert_func, (intptr_t*)PLAYLIST_INSERT),
1257 ONPLAY_START_PLAY, &i_pl_item, 1250 ONPLAY_START_PLAY, &i_pl_item },
1258 LANG_INSERT },
1259}; 1251};
1260 1252
1261static const int num_hotkey_items = sizeof(hotkey_items) / sizeof(hotkey_items[0]); 1253static const int num_hotkey_items = sizeof(hotkey_items) / sizeof(hotkey_items[0]);
1262 1254
1263/* Return the language ID for the input function */ 1255/* Return the language ID for the input function */
1264int get_hotkey_desc_id(int hk_func) 1256char* get_hotkey_desc(int hk_func)
1265{ 1257{
1266 int i; 1258 int i;
1267 for (i = 0; i < num_hotkey_items; i++) 1259 for (i = 0; i < num_hotkey_items; i++)
1268 { 1260 {
1269 if ((hotkey_items[i].item & HOTKEY_ACTION_MASK) == hk_func) 1261 if ((hotkey_items[i].item & HOTKEY_ACTION_MASK) == hk_func)
1270 return hotkey_items[i].lang_id; 1262 return P2STR(hotkey_items[i].menu_addr->callback_and_desc->desc);
1271 } 1263 }
1272 1264
1273 return LANG_HOTKEY_NOT_SET; 1265 return str(LANG_HOTKEY_NOT_SET);
1274} 1266}
1275 1267
1276/* Execute the hotkey function, if listed for this screen */ 1268/* Execute the hotkey function, if listed for this screen */
diff --git a/apps/onplay.h b/apps/onplay.h
index 027ddedc8f..a5a5a5f2fd 100644
--- a/apps/onplay.h
+++ b/apps/onplay.h
@@ -32,7 +32,7 @@ enum {
32}; 32};
33 33
34#ifdef HAVE_HOTKEY 34#ifdef HAVE_HOTKEY
35int get_hotkey_desc_id(int hk_func); 35char* get_hotkey_desc(int hk_func);
36#endif 36#endif
37 37
38#endif 38#endif