From 1ad76ff25be3f86b9467fc6f4171dbf6895b419c Mon Sep 17 00:00:00 2001 From: Jeffrey Goode Date: Sun, 9 May 2010 02:02:51 +0000 Subject: FS#11250: Hotkey setting method changed to menu item vs button pres in context menu. Manuals updated to match. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@25905 a1c6a512-1295-4272-9138-f99709370657 --- apps/gui/wps.c | 5 +- apps/lang/czech.lang | 100 ------------------ apps/lang/english.lang | 50 ++++----- apps/lang/italiano.lang | 100 ------------------ apps/lang/slovak.lang | 100 ------------------ apps/menu.c | 22 ---- apps/menu.h | 1 - apps/menus/playlist_menu.c | 2 +- apps/menus/settings_menu.c | 45 +------- apps/onplay.c | 121 ++++------------------ apps/onplay.h | 12 ++- apps/root_menu.h | 1 - apps/settings.h | 2 +- apps/settings_list.c | 49 +++++---- apps/tree.c | 5 +- manual/appendix/config_file_options.tex | 6 ++ manual/configure_rockbox/hotkey_settings.tex | 13 +-- manual/rockbox_interface/browsing_and_playing.tex | 10 +- manual/rockbox_interface/hotkeys.tex | 32 +++--- manual/rockbox_interface/wps.tex | 12 +-- manual/working_with_playlists/main.tex | 1 - 21 files changed, 129 insertions(+), 560 deletions(-) diff --git a/apps/gui/wps.c b/apps/gui/wps.c index 916ca2cbcf..96f66eeb50 100644 --- a/apps/gui/wps.c +++ b/apps/gui/wps.c @@ -886,8 +886,11 @@ long gui_wps_show(void) #endif switch(button) { - case ACTION_WPS_CONTEXT: case ACTION_WPS_HOTKEY: + if (!global_settings.hotkey_wps) + break; + /* fall through */ + case ACTION_WPS_CONTEXT: { bool hotkey = button == ACTION_WPS_HOTKEY; gwps_leave_wps(); diff --git a/apps/lang/czech.lang b/apps/lang/czech.lang index 05e2b75793..4f7253eecd 100644 --- a/apps/lang/czech.lang +++ b/apps/lang/czech.lang @@ -13320,57 +13320,6 @@ lineout_poweroff: "Vnější výstup" - - id: LANG_SET_HOTKEY_QUESTION - desc: hotkey splash - user: core - - *: none - hotkey: "Set Hotkey: %s?" - - - *: none - hotkey: "Nastavit zkratkovou klávesu: %s?" - - - *: none - hotkey: "Nastavit zkratkovou klávesu?" - - - - id: LANG_HOTKEY_ASSIGNED - desc: Confirmation after the hotkey has been assigned - user: core - - *: none - hotkey: "Assigned Hotkey: %s" - - - *: none - hotkey: "Přiřazená zkratková klávesa: %s" - - - *: none - hotkey: "Přiřazená zkratková klávesa" - - - - id: LANG_HOTKEY_NOT_SET - desc: hotkey splash - user: core - - *: none - hotkey: "Hotkey Not Set" - - - *: none - hotkey: "Zkratková klávesa nenastavena" - - - *: none - hotkey: "Zkratková klávesa nenastavena" - - id: LANG_HOTKEY desc: hotkey menu @@ -13388,55 +13337,6 @@ hotkey: "Zkratková klávesa" - - id: LANG_VIEW_HOTKEY - desc: hotkey menu - user: core - - *: none - hotkey: "View Hotkey Settings" - - - *: none - hotkey: "Zobrazit nastavení zkratkové klávesy" - - - *: none - hotkey: "Zobrazit nastavení zkratkové klávesy" - - - - id: LANG_HOTKEY_VIEW_WPS - desc: hotkey info menu - user: core - - *: none - hotkey: "WPS: %s" - - - *: none - hotkey: "Přehrávací obrazovka: %s" - - - *: none - - - - id: LANG_HOTKEY_VIEW_FILE_BROWSER - desc: hotkey info menu - user: core - - *: none - hotkey: "Prohlížeč souborů: %s" - - - *: none - hotkey: "Prohlížeč souborů: %s" - - - *: none - - id: LANG_RESUME_REWIND desc: in playback settings menu diff --git a/apps/lang/english.lang b/apps/lang/english.lang index 64d28422c1..8303586551 100644 --- a/apps/lang/english.lang +++ b/apps/lang/english.lang @@ -13396,53 +13396,53 @@ id: LANG_SET_HOTKEY_QUESTION - desc: hotkey splash + desc: deprecated user: core *: none - hotkey: "Set Hotkey: %s?" + hotkey: "" *: none - hotkey: "Set Hotkey: %s?" + hotkey: "" *: none - hotkey: "Set Hotkey?" + hotkey: "" id: LANG_HOTKEY_ASSIGNED - desc: Confirmation after the hotkey has been assigned + desc: deprecated user: core *: none - hotkey: "Assigned Hotkey: %s" + hotkey: "" *: none - hotkey: "Assigned Hotkey: %s" + hotkey: "" *: none - hotkey: "Assigned Hotkey" + hotkey: "" id: LANG_HOTKEY_NOT_SET - desc: hotkey splash + desc: deprecated user: core *: none - hotkey: "Hotkey Not Set" + hotkey: "" *: none - hotkey: "Hotkey Not Set" + hotkey: "" *: none - hotkey: "Hotkey Not Set" + hotkey: "" @@ -13464,51 +13464,53 @@ id: LANG_VIEW_HOTKEY - desc: hotkey menu + desc: deprecated user: core *: none - hotkey: "View Hotkey Settings" + hotkey: "" *: none - hotkey: "View Hotkey Settings" + hotkey: "" *: none - hotkey: "View Hotkey Settings" + hotkey: "" - id: LANG_HOTKEY_VIEW_WPS - desc: hotkey info menu + id: LANG_HOTKEY_WPS + desc: hotkey menu user: core *: none - hotkey: "WPS: %s" + hotkey: "WPS Hotkey" *: none - hotkey: "WPS: %s" + hotkey: "WPS Hotkey" *: none + hotkey: "WPS Hotkey" - id: LANG_HOTKEY_VIEW_FILE_BROWSER - desc: hotkey info menu + id: LANG_HOTKEY_FILE_BROWSER + desc: hotkey menu user: core *: none - hotkey: "File Browser: %s" + hotkey: "File Browser Hotkey" *: none - hotkey: "File Browser: %s" + hotkey: "File Browser Hotkey" *: none + hotkey: "File Browser Hotkey" diff --git a/apps/lang/italiano.lang b/apps/lang/italiano.lang index d52b6aa13c..65f4e577a7 100644 --- a/apps/lang/italiano.lang +++ b/apps/lang/italiano.lang @@ -13319,57 +13319,6 @@ lineout_poweroff: "Uscita Line" - - id: LANG_SET_HOTKEY_QUESTION - desc: hotkey splash - user: core - - *: none - hotkey: "Set Hotkey: %s?" - - - *: none - hotkey: "Imposta Tasto Rapido: %s?" - - - *: none - hotkey: "Imposta Tasto Rapido?" - - - - id: LANG_HOTKEY_ASSIGNED - desc: Confirmation after the hotkey has been assigned - user: core - - *: none - hotkey: "Assigned Hotkey: %s" - - - *: none - hotkey: "Tasto Rapido Assegnato: %s" - - - *: none - hotkey: "Tasto Rapido Assegnato" - - - - id: LANG_HOTKEY_NOT_SET - desc: hotkey splash - user: core - - *: none - hotkey: "Hotkey Not Set" - - - *: none - hotkey: "Tasto Rapido Non Impostato" - - - *: none - hotkey: "Tasto Rapido Non Impostato" - - id: LANG_HOTKEY desc: hotkey menu @@ -13387,52 +13336,3 @@ hotkey: "Tasto Rapido" - - id: LANG_VIEW_HOTKEY - desc: hotkey menu - user: core - - *: none - hotkey: "View Hotkey Settings" - - - *: none - hotkey: "Visualizza Impostazioni Tasto Rapido" - - - *: none - hotkey: "Visualizza Impostazioni Tasto Rapido" - - - - id: LANG_HOTKEY_VIEW_WPS - desc: hotkey info menu - user: core - - *: none - hotkey: "WPS: %s" - - - *: none - hotkey: "WPS: %s" - - - *: none - - - - id: LANG_HOTKEY_VIEW_FILE_BROWSER - desc: hotkey info menu - user: core - - *: none - hotkey: "File Browser: %s" - - - *: none - hotkey: "Sfoglia File: %s" - - - *: none - - diff --git a/apps/lang/slovak.lang b/apps/lang/slovak.lang index 6bfeef5c11..e2c17f405e 100644 --- a/apps/lang/slovak.lang +++ b/apps/lang/slovak.lang @@ -13318,40 +13318,6 @@ lineout_poweroff: "Linkový výstup" - - id: LANG_VIEW_HOTKEY - desc: hotkey menu - user: core - - *: none - hotkey: "View Hotkey Settings" - - - *: none - hotkey: "Zobraziť Nastavenia Horúceho Klávesu" - - - *: none - hotkey: "Zobraziť nastavenia horúceho klávesu" - - - - id: LANG_HOTKEY_ASSIGNED - desc: Confirmation after the hotkey has been assigned - user: core - - *: none - hotkey: "Assigned Hotkey: %s" - - - *: none - hotkey: "Priradená Skratka: %s" - - - *: none - hotkey: "Priradená skratka" - - id: LANG_HOTKEY desc: hotkey menu @@ -13369,72 +13335,6 @@ hotkey: "Klávesová skratka" - - id: LANG_HOTKEY_NOT_SET - desc: hotkey splash - user: core - - *: none - hotkey: "Hotkey Not Set" - - - *: none - hotkey: "Skratka Nieje Nastavená" - - - *: none - hotkey: "Skratka nieje nastavená" - - - - id: LANG_SET_HOTKEY_QUESTION - desc: hotkey splash - user: core - - *: none - hotkey: "Set Hotkey: %s?" - - - *: none - hotkey: "Nastaviť skratku: %s?" - - - *: none - hotkey: "Nastaviť skratku?" - - - - id: LANG_HOTKEY_VIEW_FILE_BROWSER - desc: hotkey info menu - user: core - - *: none - hotkey: "File Browser: %s" - - - *: none - hotkey: "Prehliadač Súborov: %s" - - - *: none - - - - id: LANG_HOTKEY_VIEW_WPS - desc: hotkey info menu - user: core - - *: none - hotkey: "WPS: %s" - - - *: none - hotkey: "WPS: %s" - - - *: none - - id: LANG_RESUME_REWIND desc: in playback settings menu diff --git a/apps/menu.c b/apps/menu.c index bfad812803..670a235202 100644 --- a/apps/menu.c +++ b/apps/menu.c @@ -61,12 +61,6 @@ #include "list.h" #include "buttonbar.h" -/* hotkey settings */ -#ifdef HAVE_HOTKEY -const struct menu_item_ex *selected_menu_item; -bool hotkey_settable_menu = false; -#endif - #define MAX_MENUS 8 /* used to allow for dynamic menus */ #define MAX_MENU_SUBITEMS 64 @@ -431,22 +425,6 @@ int do_menu(const struct menu_item_ex *start_menu, int *start_selected, ret = GO_TO_RECSCREEN; done = true; } -#endif -#ifdef HAVE_HOTKEY - else if (hotkey_settable_menu && - ((action == ACTION_WPS_HOTKEY) || - (action == ACTION_TREE_HOTKEY))) - { - int this = get_menu_selection(gui_synclist_get_sel_pos(&lists),menu); - temp = menu->submenus[this]; - if (temp->flags&MENU_FUNC_HOTKEYABLE) - { - selected_menu_item = temp; - selected = this; - ret = MENU_SELECTED_HOTKEY; - done = true; - } - } #endif else if (action == ACTION_TREE_WPS) { diff --git a/apps/menu.h b/apps/menu.h index a7bd1c1a73..b5bab90981 100644 --- a/apps/menu.h +++ b/apps/menu.h @@ -61,7 +61,6 @@ struct menu_func { /* Flags for MT_FUNCTION_CALL */ #define MENU_FUNC_USEPARAM 0x80 #define MENU_FUNC_CHECK_RETVAL 0x100 -#define MENU_FUNC_HOTKEYABLE 0x200 #define MENU_COUNT_MASK 0xFFF #define MENU_COUNT_SHIFT 12 diff --git a/apps/menus/playlist_menu.c b/apps/menus/playlist_menu.c index 0d08a4f04f..2237761efd 100644 --- a/apps/menus/playlist_menu.c +++ b/apps/menus/playlist_menu.c @@ -68,7 +68,7 @@ static int playlist_view_(void) MENUITEM_FUNCTION(create_playlist_item, 0, ID2P(LANG_CREATE_PLAYLIST), (int(*)(void))create_playlist, NULL, NULL, Icon_NOICON); -MENUITEM_FUNCTION(view_cur_playlist, MENU_FUNC_CHECK_RETVAL | MENU_FUNC_HOTKEYABLE, +MENUITEM_FUNCTION(view_cur_playlist, MENU_FUNC_CHECK_RETVAL, ID2P(LANG_VIEW_DYNAMIC_PLAYLIST), (int(*)(void))playlist_view_, NULL, NULL, Icon_NOICON); MENUITEM_FUNCTION(save_playlist, MENU_FUNC_USEPARAM, ID2P(LANG_SAVE_DYNAMIC_PLAYLIST), diff --git a/apps/menus/settings_menu.c b/apps/menus/settings_menu.c index 1007d2aeb0..bcd49c942c 100644 --- a/apps/menus/settings_menu.c +++ b/apps/menus/settings_menu.c @@ -46,11 +46,6 @@ #ifdef HAVE_DIRCACHE #include "dircache.h" #endif -#ifdef HAVE_HOTKEY -#include "list.h" -#include "settings_list.h" -#include "onplay.h" -#endif /***********************************/ /* TAGCACHE MENU */ @@ -406,44 +401,10 @@ MAKE_MENU(voice_settings_menu, ID2P(LANG_VOICE), 0, Icon_Voice, /***********************************/ /* HOTKEY MENU */ #ifdef HAVE_HOTKEY -static void view_hotkey_info(void) -{ - struct simplelist_info info; - simplelist_info_init(&info, str(LANG_VIEW_HOTKEY), 0, NULL); - info.hide_selection = true; - info.scroll_all = true; - simplelist_addline(SIMPLELIST_ADD_LINE, str(LANG_HOTKEY_VIEW_WPS), - get_hotkey_desc(global_settings.hotkey_wps)); - simplelist_addline(SIMPLELIST_ADD_LINE, str(LANG_HOTKEY_VIEW_FILE_BROWSER), - get_hotkey_desc(global_settings.hotkey_tree)); - simplelist_show_list(&info); -} - -/* reset hotkey settings to their defaults */ -static void reset_hotkey_settings(void) -{ - { - const struct settings_list *setting = - find_setting(&global_settings.hotkey_wps, NULL); - reset_setting(setting, setting->setting); - } - { - const struct settings_list *setting = - find_setting(&global_settings.hotkey_tree, NULL); - reset_setting(setting, setting->setting); - } - settings_save(); - splash(HZ, str(LANG_RESET_DONE_CLEAR)); -} - -MENUITEM_FUNCTION(hotkey_view, 0, ID2P(LANG_VIEW_HOTKEY), - (int(*)(void))view_hotkey_info, NULL, - NULL, Icon_NOICON); -MENUITEM_FUNCTION(hotkey_reset, 0, ID2P(LANG_RESET), - (int(*)(void))reset_hotkey_settings, NULL, - NULL, Icon_NOICON); +MENUITEM_SETTING(hotkey_wps_item, &global_settings.hotkey_wps, NULL); +MENUITEM_SETTING(hotkey_tree_item, &global_settings.hotkey_tree, NULL); MAKE_MENU(hotkey_menu, ID2P(LANG_HOTKEY), 0, Icon_NOICON, - &hotkey_view, &hotkey_reset); + &hotkey_wps_item, &hotkey_tree_item); #endif /*have_hotkey */ /* HOTKEY MENU */ /***********************************/ diff --git a/apps/onplay.c b/apps/onplay.c index 82a8bddae7..c9ec565a0c 100644 --- a/apps/onplay.c +++ b/apps/onplay.c @@ -270,8 +270,7 @@ static int treeplaylist_callback(int action, const struct menu_item_ex *this_item); /* insert items */ -MENUITEM_FUNCTION(i_pl_item, MENU_FUNC_USEPARAM | MENU_FUNC_HOTKEYABLE, - ID2P(LANG_INSERT), +MENUITEM_FUNCTION(i_pl_item, MENU_FUNC_USEPARAM, ID2P(LANG_INSERT), playlist_insert_func, (intptr_t*)PLAYLIST_INSERT, NULL, Icon_Playlist); MENUITEM_FUNCTION(i_first_pl_item, MENU_FUNC_USEPARAM, ID2P(LANG_INSERT_FIRST), @@ -960,12 +959,10 @@ MENUITEM_FUNCTION(view_cue_item, 0, ID2P(LANG_BROWSE_CUESHEET), view_cue, NULL, view_cue_item_callback, Icon_NOICON); /* CONTEXT_WPS items */ -MENUITEM_FUNCTION(browse_id3_item, MENU_FUNC_HOTKEYABLE, - ID2P(LANG_MENU_SHOW_ID3_INFO), +MENUITEM_FUNCTION(browse_id3_item, 0, ID2P(LANG_MENU_SHOW_ID3_INFO), browse_id3, NULL, NULL, Icon_NOICON); #ifdef HAVE_PITCHSCREEN -MENUITEM_FUNCTION(pitch_screen_item, MENU_FUNC_HOTKEYABLE, - ID2P(LANG_PITCH), +MENUITEM_FUNCTION(pitch_screen_item, 0, ID2P(LANG_PITCH), gui_syncpitchscreen_run, NULL, NULL, Icon_Audio); #endif @@ -979,9 +976,9 @@ MENUITEM_FUNCTION(clipboard_copy_item, 0, ID2P(LANG_COPY), clipboard_copy, NULL, clipboard_callback, Icon_NOICON); MENUITEM_FUNCTION(clipboard_paste_item, 0, ID2P(LANG_PASTE), clipboard_paste, NULL, clipboard_callback, Icon_NOICON); -MENUITEM_FUNCTION(delete_file_item, MENU_FUNC_HOTKEYABLE, ID2P(LANG_DELETE), +MENUITEM_FUNCTION(delete_file_item, 0, ID2P(LANG_DELETE), delete_file_dir, NULL, clipboard_callback, Icon_NOICON); -MENUITEM_FUNCTION(delete_dir_item, MENU_FUNC_HOTKEYABLE, ID2P(LANG_DELETE_DIR), +MENUITEM_FUNCTION(delete_dir_item, 0, ID2P(LANG_DELETE_DIR), delete_file_dir, NULL, clipboard_callback, Icon_NOICON); MENUITEM_FUNCTION(create_dir_item, 0, ID2P(LANG_CREATE_DIR), create_dir, NULL, clipboard_callback, Icon_NOICON); @@ -1003,8 +1000,7 @@ static bool onplay_load_plugin(void *param) return false; } -MENUITEM_FUNCTION(list_viewers_item, MENU_FUNC_HOTKEYABLE, - ID2P(LANG_ONPLAY_OPEN_WITH), +MENUITEM_FUNCTION(list_viewers_item, 0, ID2P(LANG_ONPLAY_OPEN_WITH), list_viewers, NULL, clipboard_callback, Icon_NOICON); MENUITEM_FUNCTION(properties_item, MENU_FUNC_USEPARAM, ID2P(LANG_PROPERTIES), onplay_load_plugin, (void *)"properties", @@ -1199,75 +1195,61 @@ static bool open_with(void) return list_viewers(); } -extern const struct menu_item_ex *selected_menu_item; -extern bool hotkey_settable_menu; - #define HOTKEY_ACTION_MASK 0x0FF /* Mask to apply to get the action (enum) */ #define HOTKEY_CTX_WPS 0x100 /* Mask to apply to check whether it's for WPS */ #define HOTKEY_CTX_TREE 0x200 /* Mask to apply to check whether it's for the tree */ -/* Any desired hotkey functions go here... */ -enum hotkey_action { - HOTKEY_OFF = 0, - HOTKEY_VIEW_PLAYLIST = 1, - HOTKEY_SHOW_TRACK_INFO, - HOTKEY_PITCHSCREEN, - HOTKEY_OPEN_WITH, - HOTKEY_DELETE, - HOTKEY_INSERT, -}; - struct hotkey_assignment { int item; /* Bit or'd hotkey_action and HOTKEY_CTX_x */ struct menu_func func; /* Function to run if this entry is selected */ int return_code; /* What to return after the function is run */ - const struct menu_item_ex *menu_addr; /* Must have non-dynamic text, */ - /* i.e. have the flag MENU_HAS_DESC. E.g. be a MENUITEM_FUNCTION */ - /* For all possibilities see menu.h. */ + int lang_id; /* Language ID */ }; #define HOTKEY_FUNC(func, param) {{(void *)func}, param} -/* ... and here. Order is not important. */ +/* Any desired hotkey functions go here, in the enum in onplay.h, + and in the settings menu in settings_list.c. The order here + is not important. */ static struct hotkey_assignment hotkey_items[] = { { HOTKEY_VIEW_PLAYLIST | HOTKEY_CTX_WPS, HOTKEY_FUNC(NULL, NULL), - ONPLAY_PLAYLIST, &view_cur_playlist }, + ONPLAY_PLAYLIST, LANG_VIEW_DYNAMIC_PLAYLIST }, { HOTKEY_SHOW_TRACK_INFO| HOTKEY_CTX_WPS, HOTKEY_FUNC(browse_id3, NULL), - ONPLAY_RELOAD_DIR, &browse_id3_item }, + ONPLAY_RELOAD_DIR, LANG_MENU_SHOW_ID3_INFO }, #ifdef HAVE_PITCHSCREEN { HOTKEY_PITCHSCREEN | HOTKEY_CTX_WPS, HOTKEY_FUNC(gui_syncpitchscreen_run, NULL), - ONPLAY_RELOAD_DIR, &pitch_screen_item }, + ONPLAY_RELOAD_DIR, LANG_PITCH }, #endif { HOTKEY_OPEN_WITH | HOTKEY_CTX_WPS | HOTKEY_CTX_TREE, HOTKEY_FUNC(open_with, NULL), - ONPLAY_RELOAD_DIR, &list_viewers_item }, + ONPLAY_RELOAD_DIR, LANG_ONPLAY_OPEN_WITH }, { HOTKEY_DELETE | HOTKEY_CTX_WPS | HOTKEY_CTX_TREE, HOTKEY_FUNC(delete_item, NULL), - ONPLAY_RELOAD_DIR, &delete_file_item }, + ONPLAY_RELOAD_DIR, LANG_DELETE }, { HOTKEY_DELETE | HOTKEY_CTX_TREE, HOTKEY_FUNC(delete_item, NULL), - ONPLAY_RELOAD_DIR, &delete_dir_item }, + ONPLAY_RELOAD_DIR, LANG_DELETE }, { HOTKEY_INSERT | HOTKEY_CTX_TREE, HOTKEY_FUNC(playlist_insert_func, (intptr_t*)PLAYLIST_INSERT), - ONPLAY_START_PLAY, &i_pl_item }, + ONPLAY_START_PLAY, LANG_INSERT }, }; static const int num_hotkey_items = sizeof(hotkey_items) / sizeof(hotkey_items[0]); /* Return the language ID for the input function */ -const char* get_hotkey_desc(int hk_func) +int get_hotkey_lang_id(int hk_func) { int i; for (i = 0; i < num_hotkey_items; i++) { if ((hotkey_items[i].item & HOTKEY_ACTION_MASK) == hk_func) - return P2STR(hotkey_items[i].menu_addr->callback_and_desc->desc); + return hotkey_items[i].lang_id; } - return str(LANG_HOTKEY_NOT_SET); + return LANG_OFF; } /* Execute the hotkey function, if listed for this screen */ @@ -1300,60 +1282,9 @@ static int execute_hotkey(bool is_wps) } } - /* no valid hotkey set */ - splash(HZ, ID2P(LANG_HOTKEY_NOT_SET)); + /* no valid hotkey set, ignore hotkey */ return ONPLAY_RELOAD_DIR; } - -/* Set the hotkey to the current context menu function, if listed */ -static void set_hotkey(bool is_wps) -{ - int i; - struct hotkey_assignment *this_item; - const int context = is_wps ? HOTKEY_CTX_WPS : HOTKEY_CTX_TREE; - int *hk_func = is_wps ? &global_settings.hotkey_wps : - &global_settings.hotkey_tree; - int this_hk; - char *this_desc; - bool match_found = false; - - /* search assignment struct for a function that matches the current menu item */ - for (i = 0; i < num_hotkey_items; i++) - { - this_item = &hotkey_items[i]; - if ((this_item->item & context) && - (this_item->menu_addr == selected_menu_item)) - { - this_hk = this_item->item & HOTKEY_ACTION_MASK; - this_desc = P2STR((selected_menu_item->callback_and_desc)->desc); - match_found = true; - break; - } - } - - /* ignore the hotkey if no match found or no change to setting */ - if (!match_found || (this_hk == *hk_func)) return; - - char line1_buf[100], - line2_buf[100]; - char *line1 = line1_buf, - *line2 = line2_buf; - char **line1_ptr = &line1, - **line2_ptr = &line2; - const struct text_message message={(const char **)line1_ptr, 1}; - const struct text_message yes_message={(const char **)line2_ptr, 1}; - - snprintf(line1, sizeof(line1_buf), str(LANG_SET_HOTKEY_QUESTION), this_desc); - snprintf(line2, sizeof(line2_buf), str(LANG_HOTKEY_ASSIGNED), this_desc); - - /* confirm the hotkey setting change */ - if(gui_syncyesno_run(&message, &yes_message, NULL)==YESNO_YES) - { - /* store the hotkey settings */ - *hk_func = this_hk; - settings_save(); - } -} #endif /* HOTKEY */ int onplay(char* file, int attr, int from, bool hotkey) @@ -1367,7 +1298,6 @@ int onplay(char* file, int attr, int from, bool hotkey) #ifdef HAVE_HOTKEY if (hotkey) return execute_hotkey(context == CONTEXT_WPS); - hotkey_settable_menu = true; #else (void)hotkey; #endif @@ -1376,17 +1306,8 @@ int onplay(char* file, int attr, int from, bool hotkey) else menu = &tree_onplay_menu; menu_selection = do_menu(menu, NULL, NULL, false); -#ifdef HAVE_HOTKEY - hotkey_settable_menu = false; - switch (menu_selection) - { - case MENU_SELECTED_HOTKEY: - set_hotkey(context == CONTEXT_WPS); - return ONPLAY_RELOAD_DIR; -#else switch (menu_selection) { -#endif case GO_TO_WPS: return ONPLAY_START_PLAY; case GO_TO_ROOT: diff --git a/apps/onplay.h b/apps/onplay.h index 5a834d5ed1..161366ecc2 100644 --- a/apps/onplay.h +++ b/apps/onplay.h @@ -32,7 +32,17 @@ enum { }; #ifdef HAVE_HOTKEY -const char* get_hotkey_desc(int hk_func); +int get_hotkey_lang_id(int hk_func); + +enum hotkey_action { + HOTKEY_OFF = 0, + HOTKEY_VIEW_PLAYLIST, + HOTKEY_SHOW_TRACK_INFO, + HOTKEY_PITCHSCREEN, + HOTKEY_OPEN_WITH, + HOTKEY_DELETE, + HOTKEY_INSERT, +}; #endif #endif diff --git a/apps/root_menu.h b/apps/root_menu.h index d3ef817d5b..4113b64495 100644 --- a/apps/root_menu.h +++ b/apps/root_menu.h @@ -53,7 +53,6 @@ enum { GO_TO_BROWSEPLUGINS, GO_TO_TIMESCREEN, GO_TO_PLAYLIST_VIEWER, - MENU_SELECTED_HOTKEY, }; extern const struct menu_item_ex root_menu_; diff --git a/apps/settings.h b/apps/settings.h index fc44caae43..cfef6162a8 100644 --- a/apps/settings.h +++ b/apps/settings.h @@ -818,7 +818,7 @@ struct user_settings #ifdef HAVE_HOTKEY /* hotkey assignments - acceptable values are in - hotkey_settings enum in onplay.c */ + hotkey_action enum in onplay.h */ int hotkey_wps; int hotkey_tree; #endif diff --git a/apps/settings_list.c b/apps/settings_list.c index 34d4fc52e0..5a16f09763 100644 --- a/apps/settings_list.c +++ b/apps/settings_list.c @@ -56,6 +56,9 @@ #include "touchscreen.h" #include "ctype.h" /* For isspace() */ #endif +#ifdef HAVE_HOTKEY +#include "onplay.h" +#endif #define NVRAM(bytes) (bytes<