1
0
Fork 0
forked from len0rd/rockbox

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
This commit is contained in:
Jeffrey Goode 2010-05-09 02:02:51 +00:00
parent 8d3553489f
commit 1ad76ff25b
21 changed files with 140 additions and 571 deletions

View file

@ -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();

View file

@ -13320,57 +13320,6 @@
lineout_poweroff: "Vnější výstup"
</voice>
</phrase>
<phrase>
id: LANG_SET_HOTKEY_QUESTION
desc: hotkey splash
user: core
<source>
*: none
hotkey: "Set Hotkey: %s?"
</source>
<dest>
*: none
hotkey: "Nastavit zkratkovou klávesu: %s?"
</dest>
<voice>
*: none
hotkey: "Nastavit zkratkovou klávesu?"
</voice>
</phrase>
<phrase>
id: LANG_HOTKEY_ASSIGNED
desc: Confirmation after the hotkey has been assigned
user: core
<source>
*: none
hotkey: "Assigned Hotkey: %s"
</source>
<dest>
*: none
hotkey: "Přiřazená zkratková klávesa: %s"
</dest>
<voice>
*: none
hotkey: "Přiřazená zkratková klávesa"
</voice>
</phrase>
<phrase>
id: LANG_HOTKEY_NOT_SET
desc: hotkey splash
user: core
<source>
*: none
hotkey: "Hotkey Not Set"
</source>
<dest>
*: none
hotkey: "Zkratková klávesa nenastavena"
</dest>
<voice>
*: none
hotkey: "Zkratková klávesa nenastavena"
</voice>
</phrase>
<phrase>
id: LANG_HOTKEY
desc: hotkey menu
@ -13388,55 +13337,6 @@
hotkey: "Zkratková klávesa"
</voice>
</phrase>
<phrase>
id: LANG_VIEW_HOTKEY
desc: hotkey menu
user: core
<source>
*: none
hotkey: "View Hotkey Settings"
</source>
<dest>
*: none
hotkey: "Zobrazit nastavení zkratkové klávesy"
</dest>
<voice>
*: none
hotkey: "Zobrazit nastavení zkratkové klávesy"
</voice>
</phrase>
<phrase>
id: LANG_HOTKEY_VIEW_WPS
desc: hotkey info menu
user: core
<source>
*: none
hotkey: "WPS: %s"
</source>
<dest>
*: none
hotkey: "Přehrávací obrazovka: %s"
</dest>
<voice>
*: none
</voice>
</phrase>
<phrase>
id: LANG_HOTKEY_VIEW_FILE_BROWSER
desc: hotkey info menu
user: core
<source>
*: none
hotkey: "Prohlížeč souborů: %s"
</source>
<dest>
*: none
hotkey: "Prohlížeč souborů: %s"
</dest>
<voice>
*: none
</voice>
</phrase>
<phrase>
id: LANG_RESUME_REWIND
desc: in playback settings menu

View file

@ -13396,53 +13396,53 @@
</phrase>
<phrase>
id: LANG_SET_HOTKEY_QUESTION
desc: hotkey splash
desc: deprecated
user: core
<source>
*: none
hotkey: "Set Hotkey: %s?"
hotkey: ""
</source>
<dest>
*: none
hotkey: "Set Hotkey: %s?"
hotkey: ""
</dest>
<voice>
*: none
hotkey: "Set Hotkey?"
hotkey: ""
</voice>
</phrase>
<phrase>
id: LANG_HOTKEY_ASSIGNED
desc: Confirmation after the hotkey has been assigned
desc: deprecated
user: core
<source>
*: none
hotkey: "Assigned Hotkey: %s"
hotkey: ""
</source>
<dest>
*: none
hotkey: "Assigned Hotkey: %s"
hotkey: ""
</dest>
<voice>
*: none
hotkey: "Assigned Hotkey"
hotkey: ""
</voice>
</phrase>
<phrase>
id: LANG_HOTKEY_NOT_SET
desc: hotkey splash
desc: deprecated
user: core
<source>
*: none
hotkey: "Hotkey Not Set"
hotkey: ""
</source>
<dest>
*: none
hotkey: "Hotkey Not Set"
hotkey: ""
</dest>
<voice>
*: none
hotkey: "Hotkey Not Set"
hotkey: ""
</voice>
</phrase>
<phrase>
@ -13464,51 +13464,53 @@
</phrase>
<phrase>
id: LANG_VIEW_HOTKEY
desc: deprecated
user: core
<source>
*: none
hotkey: ""
</source>
<dest>
*: none
hotkey: ""
</dest>
<voice>
*: none
hotkey: ""
</voice>
</phrase>
<phrase>
id: LANG_HOTKEY_WPS
desc: hotkey menu
user: core
<source>
*: none
hotkey: "View Hotkey Settings"
hotkey: "WPS Hotkey"
</source>
<dest>
*: none
hotkey: "View Hotkey Settings"
hotkey: "WPS Hotkey"
</dest>
<voice>
*: none
hotkey: "View Hotkey Settings"
hotkey: "WPS Hotkey"
</voice>
</phrase>
<phrase>
id: LANG_HOTKEY_VIEW_WPS
desc: hotkey info menu
id: LANG_HOTKEY_FILE_BROWSER
desc: hotkey menu
user: core
<source>
*: none
hotkey: "WPS: %s"
hotkey: "File Browser Hotkey"
</source>
<dest>
*: none
hotkey: "WPS: %s"
</dest>
<voice>
*: none
</voice>
</phrase>
<phrase>
id: LANG_HOTKEY_VIEW_FILE_BROWSER
desc: hotkey info menu
user: core
<source>
*: none
hotkey: "File Browser: %s"
</source>
<dest>
*: none
hotkey: "File Browser: %s"
hotkey: "File Browser Hotkey"
</dest>
<voice>
*: none
hotkey: "File Browser Hotkey"
</voice>
</phrase>
<phrase>

View file

@ -13319,57 +13319,6 @@
lineout_poweroff: "Uscita Line"
</voice>
</phrase>
<phrase>
id: LANG_SET_HOTKEY_QUESTION
desc: hotkey splash
user: core
<source>
*: none
hotkey: "Set Hotkey: %s?"
</source>
<dest>
*: none
hotkey: "Imposta Tasto Rapido: %s?"
</dest>
<voice>
*: none
hotkey: "Imposta Tasto Rapido?"
</voice>
</phrase>
<phrase>
id: LANG_HOTKEY_ASSIGNED
desc: Confirmation after the hotkey has been assigned
user: core
<source>
*: none
hotkey: "Assigned Hotkey: %s"
</source>
<dest>
*: none
hotkey: "Tasto Rapido Assegnato: %s"
</dest>
<voice>
*: none
hotkey: "Tasto Rapido Assegnato"
</voice>
</phrase>
<phrase>
id: LANG_HOTKEY_NOT_SET
desc: hotkey splash
user: core
<source>
*: none
hotkey: "Hotkey Not Set"
</source>
<dest>
*: none
hotkey: "Tasto Rapido Non Impostato"
</dest>
<voice>
*: none
hotkey: "Tasto Rapido Non Impostato"
</voice>
</phrase>
<phrase>
id: LANG_HOTKEY
desc: hotkey menu
@ -13387,52 +13336,3 @@
hotkey: "Tasto Rapido"
</voice>
</phrase>
<phrase>
id: LANG_VIEW_HOTKEY
desc: hotkey menu
user: core
<source>
*: none
hotkey: "View Hotkey Settings"
</source>
<dest>
*: none
hotkey: "Visualizza Impostazioni Tasto Rapido"
</dest>
<voice>
*: none
hotkey: "Visualizza Impostazioni Tasto Rapido"
</voice>
</phrase>
<phrase>
id: LANG_HOTKEY_VIEW_WPS
desc: hotkey info menu
user: core
<source>
*: none
hotkey: "WPS: %s"
</source>
<dest>
*: none
hotkey: "WPS: %s"
</dest>
<voice>
*: none
</voice>
</phrase>
<phrase>
id: LANG_HOTKEY_VIEW_FILE_BROWSER
desc: hotkey info menu
user: core
<source>
*: none
hotkey: "File Browser: %s"
</source>
<dest>
*: none
hotkey: "Sfoglia File: %s"
</dest>
<voice>
*: none
</voice>
</phrase>

View file

@ -13318,40 +13318,6 @@
lineout_poweroff: "Linkový výstup"
</voice>
</phrase>
<phrase>
id: LANG_VIEW_HOTKEY
desc: hotkey menu
user: core
<source>
*: none
hotkey: "View Hotkey Settings"
</source>
<dest>
*: none
hotkey: "Zobraziť Nastavenia Horúceho Klávesu"
</dest>
<voice>
*: none
hotkey: "Zobraziť nastavenia horúceho klávesu"
</voice>
</phrase>
<phrase>
id: LANG_HOTKEY_ASSIGNED
desc: Confirmation after the hotkey has been assigned
user: core
<source>
*: none
hotkey: "Assigned Hotkey: %s"
</source>
<dest>
*: none
hotkey: "Priradená Skratka: %s"
</dest>
<voice>
*: none
hotkey: "Priradená skratka"
</voice>
</phrase>
<phrase>
id: LANG_HOTKEY
desc: hotkey menu
@ -13369,72 +13335,6 @@
hotkey: "Klávesová skratka"
</voice>
</phrase>
<phrase>
id: LANG_HOTKEY_NOT_SET
desc: hotkey splash
user: core
<source>
*: none
hotkey: "Hotkey Not Set"
</source>
<dest>
*: none
hotkey: "Skratka Nieje Nastavená"
</dest>
<voice>
*: none
hotkey: "Skratka nieje nastavená"
</voice>
</phrase>
<phrase>
id: LANG_SET_HOTKEY_QUESTION
desc: hotkey splash
user: core
<source>
*: none
hotkey: "Set Hotkey: %s?"
</source>
<dest>
*: none
hotkey: "Nastaviť skratku: %s?"
</dest>
<voice>
*: none
hotkey: "Nastaviť skratku?"
</voice>
</phrase>
<phrase>
id: LANG_HOTKEY_VIEW_FILE_BROWSER
desc: hotkey info menu
user: core
<source>
*: none
hotkey: "File Browser: %s"
</source>
<dest>
*: none
hotkey: "Prehliadač Súborov: %s"
</dest>
<voice>
*: none
</voice>
</phrase>
<phrase>
id: LANG_HOTKEY_VIEW_WPS
desc: hotkey info menu
user: core
<source>
*: none
hotkey: "WPS: %s"
</source>
<dest>
*: none
hotkey: "WPS: %s"
</dest>
<voice>
*: none
</voice>
</phrase>
<phrase>
id: LANG_RESUME_REWIND
desc: in playback settings menu

View file

@ -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)
{

View file

@ -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

View file

@ -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),

View file

@ -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 */
/***********************************/

View file

@ -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:

View file

@ -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

View file

@ -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_;

View file

@ -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

View file

@ -56,6 +56,9 @@
#include "touchscreen.h"
#include "ctype.h" /* For isspace() */
#endif
#ifdef HAVE_HOTKEY
#include "onplay.h"
#endif
#define NVRAM(bytes) (bytes<<F_NVRAM_MASK_SHIFT)
/** NOTE: NVRAM_CONFIG_VERSION is in settings_list.h
@ -529,6 +532,21 @@ static void tsc_set_default(void* setting, void* defaultval)
memcpy(setting, defaultval, sizeof(struct touchscreen_parameter));
}
#endif
#ifdef HAVE_HOTKEY
static const char* hotkey_formatter(char* buffer, size_t buffer_size, int value,
const char* unit)
{
(void)buffer;
(void)buffer_size;
(void)unit;
return str(get_hotkey_lang_id(value));
}
static int32_t hotkey_getlang(int value, int unit)
{
(void)unit;
return get_hotkey_lang_id(value);
}
#endif /* HAVE_HOTKEY */
const struct settings_list settings[] = {
/* sound settings */
SOUND_SETTING(F_NO_WRAP,volume, LANG_VOLUME, "volume", SOUND_VOLUME),
@ -1662,26 +1680,17 @@ const struct settings_list settings[] = {
#endif
#ifdef HAVE_HOTKEY
CHOICE_SETTING(0, hotkey_wps, -1, 1, "hotkey wps",
"off,view playlist,show track info,pitchscreen,open with,delete,insert",
NULL, 7, ID2P(LANG_OFF),
ID2P(LANG_VIEW_DYNAMIC_PLAYLIST), ID2P(LANG_MENU_SHOW_ID3_INFO),
#ifdef HAVE_PITCHSCREEN
ID2P(LANG_PITCH),
#else
NULL,
#endif
ID2P(LANG_ONPLAY_OPEN_WITH), ID2P(LANG_DELETE), ID2P(LANG_INSERT)),
CHOICE_SETTING(0, hotkey_tree, -1, 0, "hotkey tree",
"off,view playlist,show track info,pitchscreen,open with,delete,insert",
NULL, 7, ID2P(LANG_OFF),
ID2P(LANG_VIEW_DYNAMIC_PLAYLIST), ID2P(LANG_MENU_SHOW_ID3_INFO),
#ifdef HAVE_PITCHSCREEN
ID2P(LANG_PITCH),
#else
NULL,
#endif
ID2P(LANG_ONPLAY_OPEN_WITH), ID2P(LANG_DELETE), ID2P(LANG_INSERT)),
TABLE_SETTING(F_ALLOW_ARBITRARY_VALS, hotkey_wps,
LANG_HOTKEY_WPS, HOTKEY_VIEW_PLAYLIST, "hotkey wps",
"off,view playlist,show track info,pitchscreen,open with,delete",
UNIT_INT, hotkey_formatter, hotkey_getlang, NULL, 6, HOTKEY_OFF,
HOTKEY_VIEW_PLAYLIST, HOTKEY_SHOW_TRACK_INFO, HOTKEY_PITCHSCREEN,
HOTKEY_OPEN_WITH, HOTKEY_DELETE),
TABLE_SETTING(F_ALLOW_ARBITRARY_VALS, hotkey_tree,
LANG_HOTKEY_FILE_BROWSER, HOTKEY_OFF, "hotkey tree",
"off,open with,delete,insert",
UNIT_INT, hotkey_formatter, hotkey_getlang, NULL, 4, HOTKEY_OFF,
HOTKEY_OPEN_WITH, HOTKEY_DELETE, HOTKEY_INSERT),
#endif
#if CONFIG_CODEC == SWCODEC

View file

@ -755,8 +755,11 @@ static int dirbrowse()
break;
#endif
case ACTION_STD_CONTEXT:
case ACTION_TREE_HOTKEY:
if (!global_settings.hotkey_tree)
break;
/* fall through */
case ACTION_STD_CONTEXT:
{
bool hotkey = button == ACTION_TREE_HOTKEY;
int onplay_result;