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;

View File

@ -123,6 +123,12 @@
talk filetype & off, on & N/A\\
talk menu & off, on & N/A\\
Announce Battery Level & off, on & N/A\\
\opt{hotkey}{
hotkey wps & off, view playlist, show track info,
pitchscreen, open with, delete & N/A\\
hotkey tree & off, open with, delete, insert
& N/A\\
}
sort files & alpha, oldest, newest, type & N/A\\
sort dirs & alpha, oldest, newest & N/A\\
sort interpret number & digits, numbers & N/A\\

View File

@ -3,14 +3,11 @@
\section{\label{ref:HotkeySettings}Hotkey}
\begin{description}
\item[View Hotkey Settings.]
This option brings up a screen listing the current assignment associated
with each hotkey.
\item[Reset Settings.]
This option sets all hotkeys to their default assignments. The default
for the WPS screen is View Playlist. The File Browser hotkey has no
default assignment.
\item[WPS Hotkey.]
\item[File Browser Hotkey.]
These options set the hotkey function for their respective screens
(see \reference{ref:Hotkeys}). The default for the WPS screen is
\setting{View Playlist}. The File Browser default is \setting{Off}.
\end{description}

View File

@ -137,11 +137,6 @@ or directory and access the context menu with \ActionStdContext{}.\\
for files. If the \setting{Context Menu} is invoked on a directory,
it will display options for directories.\\}
\opt{hotkey}{
Some of these options can be set to the \setting{Hotkey} (see \reference{ref:Hotkeys})
for that context by pressing \ActionWpsHotkey.\\
}
The \setting{Context Menu} contains the following options (unless otherwise noted,
each option pertains both to files and directories):
@ -167,11 +162,10 @@ each option pertains both to files and directories):
not to directories. Rockbox will ask for confirmation before deleting a file.
Press \ActionYesNoAccept{}
to confirm deletion or any other key to cancel.
\opt{hotkey}{\setting{Hotkey}able (see \reference{ref:Hotkeys}).}
\item [Delete Directory.]
Deletes the currently selected directory and all of the files and subdirectories
it may contain. Deleted directories cannot be recovered. Use this feature with
caution! \opt{hotkey}{\setting{Hotkey}able (see \reference{ref:Hotkeys}).}
caution!
\opt{lcd_non-mono}{
\item [Set As Backdrop.]
Set the selected \fname{bmp} file as background image. The bitmaps need to meet the
@ -185,7 +179,7 @@ each option pertains both to files and directories):
For example, this function can be used to view a text file
even if the file has a non-standard extension (i.e., the file has an extension
of something other than \fname{.txt}). See \reference{ref:Viewersplugins}
for more details on viewers. \opt{hotkey}{\setting{Hotkey}able (see \reference{ref:Hotkeys}).}
for more details on viewers.
\item [Create Directory.]
Create a new directory in the current directory on the disk.
\item [Properties.]

View File

@ -1,26 +1,18 @@
% $Id$ %
\opt{hotkey}{
\section{\label{ref:Hotkeys}Hotkeys}
Hotkeys are user-assignable shortcut keys to functions within the
\setting{File Browser} and \setting{WPS} context menus. To use one,
press \ActionWpsHotkey{} within the \setting{File Browser} or
\setting{WPS} screens. The assigned function will launch with
reference to the current file or directory, if applicable. Each
screen has its own assignment. If there is no assignment for
a given screen, the message ``No Hotkey Set'' appears briefly.
Hotkeys are shortcut keys for use in the \setting{File Browser}
and \setting{WPS} screens. To use one, press \ActionWpsHotkey{}
within the \setting{File Browser} or \setting{WPS} screens.
The assigned function will launch with reference to the current
file or directory, if applicable. Each screen has its own
assignment. If there is no assignment for a given screen,
the hotkey is ignored.
There is no default assignment for the File Browser hotkey, but the WPS
hotkey defaults to ``View Playlist''.
The default assignment for the File Browser hotkey is
\setting{Off}, but the WPS hotkey defaults to
\setting{View Playlist}.
To change the assignment of a hotkey, go into the associated
context menu from the File Browser or WPS screen by pressing
\ActionWpsContext, then highlighting the function you wish to assign.
Press the hotkey (\ActionWpsHotkey) and if the function you've chosen
is assignable a confirmation dialog screen will appear. Press
\ActionYesNoAccept{} to confirm the assignment or anything else to reject
it. If accepted, you'll see a short message confirming your choice.
You can view the current assignments and reset to the default assignments
from the Hotkey menu under \setting{General Settings}. See
\reference{ref:HotkeySettings} for details.
The hotkey assignments are changed in the Hotkey menu (see
\reference{ref:HotkeySettings}) under \setting{General Settings}.
}

View File

@ -209,9 +209,7 @@ your WPS (While Playing Screen).
}
\subsection{\label{sec:contextmenu}The WPS Context Menu}
Like the context menu for the \setting{File Browser}, the \setting{WPS Context Menu}
allows you quick access to some often used functions. \opt{hotkey}{
Some of these options can be set to the \setting{Hotkey} (see \reference{ref:Hotkeys})
for that context by pressing \ActionWpsHotkey.}
allows you quick access to some often used functions.
\subsubsection{Playlist}
The \setting{Playlist} submenu allows you to view, save, search and
@ -268,8 +266,7 @@ This allows you to create a bookmark in the currently-playing track.
This screen is accessible from the WPS screen, and provides a detailed view of
all the identity information about the current track. This info is known as
meta data and is stored in audio file formats to keep information on artist,
album etc. \opt{hotkey}{\setting{Hotkey}able from the \setting{WPS Context
Menu} (see \reference{ref:Hotkeys}).} To access this screen, %
album etc. To access this screen, %
\opt{RECORDER_PAD,IRIVER_H100_PAD,IRIVER_H300_PAD,IRIVER_H10_PAD,%
SANSA_C200_PAD,SANSA_E200_PAD,SANSA_FUZE_PAD}{
press \ActionWpsIdThreeScreen. }%
@ -283,20 +280,19 @@ Menu} (see \reference{ref:Hotkeys}).} To access this screen, %
\subsubsection{Open With...}
This \setting{Open With} function is the same as the \setting{Open With}
function in the file browser's \setting{Context Menu}.
\opt{hotkey}{\setting{Hotkey}able (see \reference{ref:Hotkeys}).}
\subsubsection{Delete}
Delete the currently playing file. The file will be deleted but the playback
of the file will not stop immediately. Instead, the part of the file that
has already been buffered (i.e. read into the \daps\ memory) will be played.
This may even be the whole track. \opt{hotkey}{\setting{Hotkey}able (see \reference{ref:Hotkeys}).}
This may even be the whole track.
\opt{pitchscreen}{
\subsubsection{\label{sec:pitchscreen}Pitch}
The \setting{Pitch Screen} allows you to change the rate of playback
(i.e. the playback speed and at the same time the pitch) of your
\dap. \opt{hotkey}{\setting{Hotkey}able (see \reference{ref:Hotkeys}).} The rate value can be adjusted
\dap. The rate value can be adjusted
between 50\% and 200\%. 50\% means half the normal playback speed and a
pitch that is an octave lower than the normal pitch. 200\% means double
playback speed and a pitch that is an octave higher than the normal pitch.

View File

@ -93,7 +93,6 @@ options:
\setting{Insert}, new tracks will be added immediately after the current
playing track. If playback is stopped a new dynamic playlist will get
created with the selected tracks.
\opt{hotkey}{\setting{Hotkey}able (see \reference{ref:Hotkeys}).}
\item [Insert Next.] Add track(s) immediately after current playing
track, no matter what else has been inserted.