Index: apps/lang/slovak.lang
===================================================================
--- apps/lang/slovak.lang (revision 25894)
+++ apps/lang/slovak.lang (working copy)
@@ -13320,36 +13320,36 @@
id: LANG_VIEW_HOTKEY
- desc: hotkey menu
+ desc: deprecated
user: core
*: none
- hotkey: "View Hotkey Settings"
+ hotkey: ""
*: none
- hotkey: "Zobraziť Nastavenia Horúceho Klávesu"
+ hotkey: ""
*: none
- hotkey: "Zobraziť nastavenia horúceho klávesu"
+ 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: "Priradená Skratka: %s"
+ hotkey: ""
*: none
- hotkey: "Priradená skratka"
+ hotkey: ""
@@ -13388,18 +13388,18 @@
id: LANG_SET_HOTKEY_QUESTION
- desc: hotkey splash
+ desc: deprecated
user: core
*: none
- hotkey: "Set Hotkey: %s?"
+ hotkey: ""
*: none
- hotkey: "Nastaviť skratku: %s?"
+ hotkey: ""
*: none
- hotkey: "Nastaviť skratku?"
+ hotkey: ""
Index: apps/lang/english.lang
===================================================================
--- apps/lang/english.lang (revision 25894)
+++ apps/lang/english.lang (working copy)
@@ -13396,36 +13396,36 @@
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: ""
@@ -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
+ id: LANG_HOTKEY_WPS
desc: hotkey info 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
+ id: LANG_HOTKEY_FILE_BROWSER
desc: hotkey info 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"
Index: apps/lang/italiano.lang
===================================================================
--- apps/lang/italiano.lang (revision 25894)
+++ apps/lang/italiano.lang (working copy)
@@ -13321,36 +13321,36 @@
id: LANG_SET_HOTKEY_QUESTION
- desc: hotkey splash
+ desc: deprecated
user: core
*: none
- hotkey: "Set Hotkey: %s?"
+ hotkey: ""
*: none
- hotkey: "Imposta Tasto Rapido: %s?"
+ hotkey: ""
*: none
- hotkey: "Imposta Tasto Rapido?"
+ 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: "Tasto Rapido Assegnato: %s"
+ hotkey: ""
*: none
- hotkey: "Tasto Rapido Assegnato"
+ hotkey: ""
@@ -13389,48 +13389,48 @@
id: LANG_VIEW_HOTKEY
- desc: hotkey menu
+ desc: deprecated
user: core
*: none
- hotkey: "View Hotkey Settings"
+ hotkey: ""
*: none
- hotkey: "Visualizza Impostazioni Tasto Rapido"
+ hotkey: ""
*: none
- hotkey: "Visualizza Impostazioni Tasto Rapido"
+ hotkey: ""
- id: LANG_HOTKEY_VIEW_WPS
+ id: LANG_HOTKEY_WPS
desc: hotkey info menu
user: core
*: none
- hotkey: "WPS: %s"
+ hotkey: "WPS Hotkey"
*: none
- hotkey: "WPS: %s"
+ hotkey: "WPS Tasto Rapido"
*: none
- id: LANG_HOTKEY_VIEW_FILE_BROWSER
+ id: LANG_HOTKEY_FILE_BROWSER
desc: hotkey info menu
user: core
*: none
- hotkey: "File Browser: %s"
+ hotkey: "File Browser Hotkey"
*: none
- hotkey: "Sfoglia File: %s"
+ hotkey: "Sfoglia File Tasto Rapido"
*: none
Index: apps/onplay.c
===================================================================
--- apps/onplay.c (revision 25894)
+++ apps/onplay.c (working copy)
@@ -1199,75 +1199,60 @@
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 and in the enum in onplay.h.
+ Order 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 */
@@ -1304,56 +1289,6 @@
splash(HZ, ID2P(LANG_HOTKEY_NOT_SET));
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 +1302,6 @@
#ifdef HAVE_HOTKEY
if (hotkey)
return execute_hotkey(context == CONTEXT_WPS);
- hotkey_settable_menu = true;
#else
(void)hotkey;
#endif
@@ -1376,17 +1310,8 @@
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:
Index: apps/menu.c
===================================================================
--- apps/menu.c (revision 25894)
+++ apps/menu.c (working copy)
@@ -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
@@ -432,22 +426,6 @@
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)
{
ret = GO_TO_PREVIOUS_MUSIC;
Index: apps/settings.h
===================================================================
--- apps/settings.h (revision 25894)
+++ apps/settings.h (working copy)
@@ -818,7 +818,7 @@
#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
Index: apps/menus/settings_menu.c
===================================================================
--- apps/menus/settings_menu.c (revision 25894)
+++ apps/menus/settings_menu.c (working copy)
@@ -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 @@
/***********************************/
/* 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 */
/***********************************/
Index: apps/onplay.h
===================================================================
--- apps/onplay.h (revision 25894)
+++ apps/onplay.h (working copy)
@@ -32,7 +32,17 @@
};
#ifdef HAVE_HOTKEY
-const char* get_hotkey_desc(int hk_func);
+int get_hotkey_lang_id(int hk_func);
+
+enum hotkey_action {
+ HOTKEY_OFF,
+ HOTKEY_VIEW_PLAYLIST,
+ HOTKEY_SHOW_TRACK_INFO,
+ HOTKEY_PITCHSCREEN,
+ HOTKEY_OPEN_WITH,
+ HOTKEY_DELETE,
+ HOTKEY_INSERT,
+};
#endif
#endif
Index: apps/settings_list.c
===================================================================
--- apps/settings_list.c (revision 25894)
+++ apps/settings_list.c (working copy)
@@ -56,6 +56,9 @@
#include "touchscreen.h"
#include "ctype.h" /* For isspace() */
#endif
+#ifdef HAVE_HOTKEY
+#include "onplay.h"
+#endif
#define NVRAM(bytes) (bytes<