FS#11081 - Hotkey patch. Many targets supported, but some keymaps need work before they can be switched on

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@25414 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Jeffrey Goode 2010-04-01 03:14:44 +00:00
parent 39e78993f3
commit d5e6bc7a8c
103 changed files with 649 additions and 32 deletions

View File

@ -136,6 +136,7 @@ enum {
ACTION_WPS_ABSETA_PREVDIR, /* these should be safe to put together seen as */
ACTION_WPS_ABSETB_NEXTDIR, /* you shouldnt want to change dir in ab-mode */
ACTION_WPS_ABRESET,
ACTION_WPS_HOTKEY,
/* list and tree page up/down */
ACTION_LISTTREE_PGUP,/* optional */
@ -151,6 +152,7 @@ enum {
ACTION_TREE_PGRIGHT,/* optional */
ACTION_TREE_STOP,
ACTION_TREE_WPS,
ACTION_TREE_HOTKEY,
/* radio */
ACTION_FM_MENU,

View File

@ -70,6 +70,10 @@ hold_button
remote_button_hold
#endif
#if defined(HAVE_HOTKEY)
hotkey
#endif
#if defined(HAVE_LCD_BITMAP)
lcd_bitmap
#endif

View File

@ -888,10 +888,12 @@ long gui_wps_show(void)
switch(button)
{
case ACTION_WPS_CONTEXT:
case ACTION_WPS_HOTKEY:
{
bool hotkey = button == ACTION_WPS_HOTKEY;
gwps_leave_wps();
int retval = onplay(wps_state.id3->path,
FILE_ATTR_AUDIO, CONTEXT_WPS);
FILE_ATTR_AUDIO, CONTEXT_WPS, hotkey);
/* if music is stopped in the context menu we want to exit the wps */
if (retval == ONPLAY_MAINMENU
|| !audio_status())

View File

@ -75,7 +75,7 @@ static const struct button_mapping button_context_wps[] = {
{ ACTION_WPS_MENU, BUTTON_F1|BUTTON_REL, BUTTON_F1 },
{ ACTION_WPS_CONTEXT, BUTTON_SELECT|BUTTON_REPEAT,BUTTON_SELECT },
{ ACTION_WPS_QUICKSCREEN, BUTTON_F2|BUTTON_REPEAT, BUTTON_NONE },
{ ACTION_WPS_VIEW_PLAYLIST, BUTTON_F2|BUTTON_REL, BUTTON_F2 },
{ ACTION_WPS_HOTKEY, BUTTON_F2|BUTTON_REL, BUTTON_F2 },
{ ACTION_WPS_BROWSE, BUTTON_ON|BUTTON_REL, BUTTON_ON },
{ ACTION_WPS_ID3SCREEN, BUTTON_F1|BUTTON_ON, BUTTON_NONE },
{ ACTION_WPS_PITCHSCREEN, BUTTON_ON|BUTTON_UP, BUTTON_ON },
@ -106,6 +106,7 @@ static const struct button_mapping button_context_settings[] = {
static const struct button_mapping button_context_tree[] = {
{ ACTION_TREE_WPS, BUTTON_ON|BUTTON_REL, BUTTON_ON },
{ ACTION_TREE_STOP, BUTTON_OFF, BUTTON_NONE },
{ ACTION_TREE_HOTKEY, BUTTON_F2|BUTTON_REL, BUTTON_F2 },
{ ACTION_NONE, BUTTON_ON, BUTTON_NONE },
{ ACTION_LISTTREE_PGUP, BUTTON_ON|BUTTON_UP, BUTTON_ON },
{ ACTION_LISTTREE_PGUP, BUTTON_UP|BUTTON_REL, BUTTON_ON|BUTTON_UP },

View File

@ -69,7 +69,7 @@ static const struct button_mapping button_context_wps[] = {
{ ACTION_WPS_PITCHSCREEN, BUTTON_SELECT|BUTTON_VOLUP, BUTTON_SELECT },
{ ACTION_WPS_ID3SCREEN, BUTTON_SELECT|BUTTON_VOLDOWN, BUTTON_SELECT },
{ ACTION_WPS_CONTEXT, BUTTON_SELECT|BUTTON_REPEAT, BUTTON_SELECT },
{ ACTION_WPS_VIEW_PLAYLIST, BUTTON_SELECT|BUTTON_DOWN, BUTTON_NONE },
{ ACTION_WPS_HOTKEY, BUTTON_SELECT|BUTTON_DOWN, BUTTON_NONE },
{ ACTION_WPS_QUICKSCREEN, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_DOWN },
LAST_ITEM_IN_LIST
@ -104,6 +104,7 @@ static const struct button_mapping button_context_list[] = {
static const struct button_mapping button_context_tree[] = {
{ ACTION_TREE_WPS, BUTTON_UP|BUTTON_REL, BUTTON_UP },
{ ACTION_TREE_STOP, BUTTON_POWER|BUTTON_REL, BUTTON_POWER },
{ ACTION_TREE_HOTKEY, BUTTON_SELECT|BUTTON_DOWN, BUTTON_NONE },
LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_LIST),
}; /* button_context_tree */

View File

@ -81,7 +81,7 @@ static const struct button_mapping button_context_wps[] = {
{ ACTION_WPS_CONTEXT, BUTTON_SELECT|BUTTON_REPEAT, BUTTON_SELECT },
{ ACTION_WPS_QUICKSCREEN, BUTTON_DOWN, BUTTON_NONE },
{ ACTION_WPS_REC, BUTTON_REC|BUTTON_REPEAT, BUTTON_NONE },
{ ACTION_WPS_VIEW_PLAYLIST, BUTTON_REC|BUTTON_REL, BUTTON_REC },
{ ACTION_WPS_HOTKEY, BUTTON_REC|BUTTON_REL, BUTTON_REC },
LAST_ITEM_IN_LIST
}; /* button_context_wps */
@ -123,6 +123,7 @@ static const struct button_mapping button_context_list[] = {
static const struct button_mapping button_context_tree[] = {
{ ACTION_TREE_WPS, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_RIGHT },
{ ACTION_TREE_HOTKEY, BUTTON_REC|BUTTON_REL, BUTTON_REC },
LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_LIST),
}; /* button_context_tree */

View File

@ -82,7 +82,11 @@ static const struct button_mapping button_context_wps[] = {
{ ACTION_WPS_PITCHSCREEN, BUTTON_SELECT|BUTTON_UP, BUTTON_SELECT },
{ ACTION_WPS_ID3SCREEN, BUTTON_SELECT|BUTTON_DOWN, BUTTON_SELECT },
#ifdef HAVE_HOTKEY
{ ACTION_WPS_HOTKEY, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE },
#else
{ ACTION_WPS_VIEW_PLAYLIST, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE },
#endif
#ifndef HAS_BUTTON_HOLD /* Clip+ */
{ ACTION_STD_KEYLOCK, BUTTON_HOME|BUTTON_SELECT, BUTTON_NONE },
@ -131,6 +135,9 @@ static const struct button_mapping button_context_list[] = {
static const struct button_mapping button_context_tree[] = {
{ ACTION_TREE_WPS, BUTTON_HOME|BUTTON_SELECT, BUTTON_HOME },
{ ACTION_TREE_STOP, BUTTON_POWER|BUTTON_REL, BUTTON_POWER },
#ifdef HAVE_HOTKEY
// { ACTION_TREE_HOTKEY, BUTTON_NONE, BUTTON_NONE },
#endif
LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_LIST),
}; /* button_context_tree */

View File

@ -92,7 +92,11 @@ static const struct button_mapping button_context_wps[] = {
{ ACTION_WPS_QUICKSCREEN, BUTTON_MENU|BUTTON_REPEAT, BUTTON_MENU },
{ ACTION_WPS_MENU, BUTTON_MENU|BUTTON_REL, BUTTON_MENU },
#ifdef HAVE_HOTKEY
{ ACTION_WPS_HOTKEY, BUTTON_POWER, BUTTON_NONE },
#else
{ ACTION_WPS_VIEW_PLAYLIST, BUTTON_POWER, BUTTON_NONE },
#endif
{ ACTION_WPS_CONTEXT, BUTTON_SELECT|BUTTON_REPEAT, BUTTON_SELECT },
{ ACTION_WPS_ID3SCREEN, BUTTON_BACK|BUTTON_REL, BUTTON_NONE },
@ -109,6 +113,9 @@ static const struct button_mapping button_context_tree[] = {
{ ACTION_TREE_STOP, BUTTON_POWER, BUTTON_NONE },
{ ACTION_TREE_STOP, BUTTON_POWER|BUTTON_REL, BUTTON_POWER },
{ ACTION_TREE_STOP, BUTTON_POWER|BUTTON_REPEAT, BUTTON_NONE },
#ifdef HAVE_HOTKEY
// { ACTION_TREE_HOTKEY, BUTTON_NONE, BUTTON_NONE },
#endif
LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_LIST)
}; /* button_context_tree */

View File

@ -91,7 +91,11 @@ static const struct button_mapping button_context_wps[] = {
{ ACTION_WPS_QUICKSCREEN, BUTTON_MENU|BUTTON_REPEAT, BUTTON_MENU },
{ ACTION_WPS_MENU, BUTTON_MENU|BUTTON_REL, BUTTON_MENU },
#ifdef HAVE_HOTKEY
{ ACTION_WPS_HOTKEY, BUTTON_POWER, BUTTON_NONE },
#else
{ ACTION_WPS_VIEW_PLAYLIST, BUTTON_POWER, BUTTON_NONE },
#endif
{ ACTION_WPS_CONTEXT, BUTTON_SELECT|BUTTON_REPEAT, BUTTON_SELECT },
{ ACTION_WPS_ID3SCREEN, BUTTON_BACK|BUTTON_REL, BUTTON_NONE },
@ -108,6 +112,9 @@ static const struct button_mapping button_context_tree[] = {
{ ACTION_TREE_STOP, BUTTON_POWER, BUTTON_NONE },
{ ACTION_TREE_STOP, BUTTON_POWER|BUTTON_REL, BUTTON_POWER },
{ ACTION_TREE_STOP, BUTTON_POWER|BUTTON_REPEAT, BUTTON_NONE },
#ifdef HAVE_HOTKEY
// { ACTION_TREE_HOTKEY, BUTTON_NONE, BUTTON_NONE },
#endif
LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_LIST)
}; /* button_context_tree */

View File

@ -80,7 +80,7 @@ static const struct button_mapping button_context_wps[] = {
{ ACTION_WPS_QUICKSCREEN, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_DOWN },
{ ACTION_WPS_MENU, BUTTON_DOWN|BUTTON_REL, BUTTON_DOWN },
{ ACTION_WPS_VIEW_PLAYLIST, BUTTON_REC|BUTTON_REL, BUTTON_REC },
{ ACTION_WPS_HOTKEY, BUTTON_REC|BUTTON_REL, BUTTON_REC },
{ ACTION_WPS_REC, BUTTON_REC|BUTTON_REPEAT, BUTTON_NONE },
{ ACTION_WPS_PITCHSCREEN, BUTTON_SELECT|BUTTON_UP, BUTTON_SELECT },
@ -115,6 +115,7 @@ static const struct button_mapping button_context_list[] = {
static const struct button_mapping button_context_tree[] = {
{ ACTION_TREE_WPS, BUTTON_UP|BUTTON_REL, BUTTON_UP },
{ ACTION_TREE_STOP, BUTTON_POWER|BUTTON_REL, BUTTON_POWER },
{ ACTION_TREE_HOTKEY, BUTTON_REC|BUTTON_REL, BUTTON_REC },
LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_LIST),
}; /* button_context_tree */

View File

@ -83,7 +83,7 @@ static const struct button_mapping button_context_wps[] = {
{ ACTION_WPS_PITCHSCREEN, BUTTON_SELECT|BUTTON_UP, BUTTON_SELECT },
{ ACTION_WPS_ID3SCREEN, BUTTON_SELECT|BUTTON_DOWN, BUTTON_SELECT },
{ ACTION_WPS_VIEW_PLAYLIST, BUTTON_HOME|BUTTON_REL, BUTTON_HOME },
{ ACTION_WPS_HOTKEY, BUTTON_HOME|BUTTON_REL, BUTTON_HOME },
LAST_ITEM_IN_LIST
}; /* button_context_wps */
@ -114,6 +114,7 @@ static const struct button_mapping button_context_list[] = {
static const struct button_mapping button_context_tree[] = {
{ ACTION_TREE_WPS, BUTTON_UP|BUTTON_REL, BUTTON_UP },
{ ACTION_TREE_STOP, BUTTON_HOME|BUTTON_REPEAT, BUTTON_HOME },
{ ACTION_TREE_HOTKEY, BUTTON_HOME|BUTTON_REL, BUTTON_HOME },
LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_LIST),
}; /* button_context_tree */

View File

@ -100,7 +100,11 @@ static const struct button_mapping button_context_wps[] = {
{ ACTION_WPS_VOLUP, BUTTON_VOL_UP, BUTTON_NONE },
{ ACTION_WPS_PITCHSCREEN, BUTTON_BACK|BUTTON_UP, BUTTON_BACK },
#ifdef HAVE_HOTKEY
{ ACTION_WPS_HOTKEY, BUTTON_BACK|BUTTON_DOWN, BUTTON_NONE },
#else
{ ACTION_WPS_VIEW_PLAYLIST, BUTTON_BACK|BUTTON_DOWN, BUTTON_NONE },
#endif
{ ACTION_WPS_QUICKSCREEN, BUTTON_MENU|BUTTON_REPEAT, BUTTON_MENU },
{ ACTION_WPS_MENU, BUTTON_MENU|BUTTON_REL, BUTTON_MENU },
@ -134,6 +138,9 @@ static const struct button_mapping button_context_tree[] = {
{ ACTION_TREE_STOP, BUTTON_POWER, BUTTON_NONE },
{ ACTION_TREE_STOP, BUTTON_POWER|BUTTON_REL, BUTTON_POWER },
{ ACTION_TREE_STOP, BUTTON_POWER|BUTTON_REPEAT, BUTTON_NONE },
#ifdef HAVE_HOTKEY
// { ACTION_TREE_HOTKEY,BUTTON_NONE, BUTTON_NONE },
#endif
LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_LIST)
}; /* button_context_tree */

View File

@ -93,7 +93,11 @@ static const struct button_mapping button_context_wps[] = {
{ ACTION_WPS_VOLUP, BUTTON_VOL_UP, BUTTON_NONE },
{ ACTION_WPS_PITCHSCREEN, BUTTON_A|BUTTON_UP, BUTTON_A },
#ifdef HAVE_HOTKEY
{ ACTION_WPS_HOTKEY, BUTTON_A|BUTTON_DOWN, BUTTON_NONE },
#else
{ ACTION_WPS_VIEW_PLAYLIST, BUTTON_A|BUTTON_DOWN, BUTTON_NONE },
#endif
{ ACTION_WPS_QUICKSCREEN, BUTTON_MENU|BUTTON_REPEAT, BUTTON_MENU },
{ ACTION_WPS_MENU, BUTTON_MENU|BUTTON_REL, BUTTON_MENU },
@ -127,6 +131,9 @@ static const struct button_mapping button_context_tree[] = {
{ ACTION_TREE_STOP, BUTTON_POWER, BUTTON_NONE },
{ ACTION_TREE_STOP, BUTTON_POWER|BUTTON_REL, BUTTON_POWER },
{ ACTION_TREE_STOP, BUTTON_POWER|BUTTON_REPEAT, BUTTON_NONE },
#ifdef HAVE_HOTKEY
// { ACTION_TREE_HOTKEY, BUTTON_NONE, BUTTON_NONE },
#endif
LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_LIST)
}; /* button_context_tree */

View File

@ -87,7 +87,7 @@ static const struct button_mapping button_context_wps[] = {
{ ACTION_WPS_CONTEXT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_RIGHT },
{ ACTION_WPS_QUICKSCREEN, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_LEFT },
{ ACTION_WPS_MENU, BUTTON_POWER|BUTTON_REL, BUTTON_POWER },
{ ACTION_WPS_VIEW_PLAYLIST, BUTTON_POWER|BUTTON_PLAY, BUTTON_NONE },
{ ACTION_WPS_HOTKEY, BUTTON_POWER|BUTTON_PLAY, BUTTON_NONE },
{ ACTION_WPS_PITCHSCREEN, BUTTON_PLAY|BUTTON_LEFT, BUTTON_PLAY },
{ ACTION_WPS_ID3SCREEN, BUTTON_PLAY|BUTTON_RIGHT, BUTTON_PLAY },
@ -146,6 +146,7 @@ static const struct button_mapping remote_button_context_list[] = {
static const struct button_mapping button_context_tree[] = {
{ ACTION_TREE_WPS, BUTTON_PLAY|BUTTON_REL, BUTTON_PLAY },
{ ACTION_TREE_STOP, BUTTON_PLAY|BUTTON_REPEAT, BUTTON_PLAY },
{ ACTION_TREE_HOTKEY, BUTTON_POWER|BUTTON_PLAY, BUTTON_NONE },
LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_LIST),
}; /* button_context_tree */

View File

@ -92,7 +92,7 @@ static const struct button_mapping button_context_wps[] = {
{ ACTION_WPS_ABRESET, BUTTON_ON|BUTTON_SELECT, BUTTON_ON },
{ ACTION_WPS_ID3SCREEN, BUTTON_ON|BUTTON_MODE, BUTTON_NONE },
{ ACTION_WPS_REC, BUTTON_REC|BUTTON_REPEAT, BUTTON_NONE },
{ ACTION_WPS_VIEW_PLAYLIST, BUTTON_REC|BUTTON_REL, BUTTON_REC },
{ ACTION_WPS_HOTKEY, BUTTON_REC|BUTTON_REL, BUTTON_REC },
LAST_ITEM_IN_LIST
}; /* button_context_wps */
@ -112,6 +112,7 @@ static const struct button_mapping button_context_tree[] = {
{ ACTION_TREE_WPS, BUTTON_ON|BUTTON_REL, BUTTON_ON },
{ ACTION_TREE_STOP, BUTTON_OFF, BUTTON_NONE },
{ ACTION_TREE_STOP, BUTTON_OFF|BUTTON_REPEAT, BUTTON_NONE },
{ ACTION_TREE_HOTKEY, BUTTON_REC|BUTTON_REL, BUTTON_REC },
LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_LIST)
}; /* button_context_tree */

View File

@ -93,7 +93,11 @@ static const struct button_mapping button_context_wps[] = {
{ ACTION_WPS_VOLUP, BUTTON_VOL_UP, BUTTON_NONE },
{ ACTION_WPS_PITCHSCREEN, BUTTON_VIEW|BUTTON_UP, BUTTON_VIEW },
#ifdef HAVE_HOTKEY
{ ACTION_WPS_HOTKEY, BUTTON_VIEW|BUTTON_DOWN, BUTTON_VIEW },
#else
{ ACTION_WPS_VIEW_PLAYLIST, BUTTON_VIEW|BUTTON_DOWN, BUTTON_VIEW },
#endif
{ ACTION_WPS_QUICKSCREEN, BUTTON_MENU|BUTTON_REPEAT, BUTTON_MENU },
{ ACTION_WPS_MENU, BUTTON_MENU|BUTTON_REL, BUTTON_MENU },
@ -127,6 +131,9 @@ static const struct button_mapping button_context_tree[] = {
{ ACTION_TREE_STOP, BUTTON_POWER, BUTTON_NONE },
{ ACTION_TREE_STOP, BUTTON_POWER|BUTTON_REL, BUTTON_POWER },
{ ACTION_TREE_STOP, BUTTON_POWER|BUTTON_REPEAT, BUTTON_NONE },
#ifdef HAVE_HOTKEY
// { ACTION_TREE_HOTKEY, BUTTON_NONE, BUTTON_NONE },
#endif
LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_LIST)
}; /* button_context_tree */

View File

@ -93,7 +93,11 @@ static const struct button_mapping button_context_wps[] = {
{ ACTION_WPS_VOLUP, BUTTON_VOL_UP, BUTTON_NONE },
{ ACTION_WPS_PITCHSCREEN, BUTTON_VIEW|BUTTON_UP, BUTTON_VIEW },
#ifdef HAVE_HOTKEY
{ ACTION_WPS_HOTKEY, BUTTON_VIEW|BUTTON_DOWN, BUTTON_VIEW },
#else
{ ACTION_WPS_VIEW_PLAYLIST, BUTTON_VIEW|BUTTON_DOWN, BUTTON_VIEW },
#endif
{ ACTION_WPS_QUICKSCREEN, BUTTON_MENU|BUTTON_REPEAT, BUTTON_MENU },
{ ACTION_WPS_MENU, BUTTON_MENU|BUTTON_REL, BUTTON_MENU },
@ -127,6 +131,9 @@ static const struct button_mapping button_context_tree[] = {
{ ACTION_TREE_STOP, BUTTON_POWER, BUTTON_NONE },
{ ACTION_TREE_STOP, BUTTON_POWER|BUTTON_REL, BUTTON_POWER },
{ ACTION_TREE_STOP, BUTTON_POWER|BUTTON_REPEAT, BUTTON_NONE },
#ifdef HAVE_HOTKEY
// { ACTION_TREE_HOTKEY, BUTTON_NONE, BUTTON_NONE },
#endif
LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_LIST)
}; /* button_context_tree */

View File

@ -71,7 +71,11 @@ static const struct button_mapping button_context_wps[] = {
{ ACTION_WPS_STOPSEEK, BUTTON_RIGHT|BUTTON_REL, BUTTON_RIGHT|BUTTON_REPEAT },
{ ACTION_WPS_PLAY, BUTTON_PLAY|BUTTON_REL, BUTTON_PLAY },
#ifdef HAVE_HOTKEY
{ ACTION_WPS_HOTKEY, BUTTON_PLAY|BUTTON_REPEAT, BUTTON_NONE },
#else
{ ACTION_WPS_VIEW_PLAYLIST, BUTTON_PLAY|BUTTON_REPEAT, BUTTON_NONE },
#endif
{ ACTION_WPS_STOP, BUTTON_STOP, BUTTON_NONE },
LAST_ITEM_IN_LIST
@ -111,6 +115,9 @@ static const struct button_mapping button_context_list[] = {
static const struct button_mapping button_context_tree[] = {
// { ACTION_TREE_WPS, BUTTON_REC|BUTTON_VOLUP, BUTTON_REC },
// { ACTION_TREE_STOP, BUTTON_REC|BUTTON_VOLUP|BUTTON_REPEAT, BUTTON_REC|BUTTON_VOLUP },
#ifdef HAVE_HOTKEY
// { ACTION_TREE_HOTKEY, BUTTON_NONE, BUTTON_NONE },
#endif
LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_LIST),
}; /* button_context_tree */

View File

@ -59,6 +59,7 @@ static const struct button_mapping button_context_standard[] = {
static const struct button_mapping button_context_tree[] = {
{ ACTION_TREE_WPS, BUTTON_PLAY|BUTTON_REL, BUTTON_PLAY },
{ ACTION_TREE_STOP, BUTTON_PLAY|BUTTON_REPEAT, BUTTON_PLAY },
{ ACTION_TREE_HOTKEY, BUTTON_SELECT|BUTTON_PLAY, BUTTON_NONE },
LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD)
}; /* button_context_tree */
@ -91,7 +92,7 @@ static const struct button_mapping button_context_wps[] = {
{ ACTION_WPS_VOLUP, BUTTON_SCROLL_FWD|BUTTON_REPEAT, BUTTON_NONE },
{ ACTION_WPS_BROWSE, BUTTON_SELECT|BUTTON_REL, BUTTON_SELECT },
{ ACTION_WPS_CONTEXT, BUTTON_SELECT|BUTTON_REPEAT, BUTTON_SELECT },
{ ACTION_WPS_VIEW_PLAYLIST, BUTTON_SELECT|BUTTON_PLAY, BUTTON_NONE },
{ ACTION_WPS_HOTKEY, BUTTON_SELECT|BUTTON_PLAY, BUTTON_NONE },
{ ACTION_WPS_MENU, BUTTON_MENU|BUTTON_REL, BUTTON_MENU },
{ ACTION_WPS_QUICKSCREEN, BUTTON_MENU|BUTTON_REPEAT, BUTTON_MENU },

View File

@ -292,6 +292,7 @@ static const struct button_mapping button_context_tree[] = {
{ ACTION_NONE, BUTTON_PLAY, BUTTON_NONE },
{ ACTION_TREE_WPS, BUTTON_PLAY|BUTTON_REL, BUTTON_PLAY },
{ ACTION_TREE_STOP, BUTTON_PLAY|BUTTON_REPEAT, BUTTON_PLAY },
{ ACTION_TREE_HOTKEY, BUTTON_REC|BUTTON_MODE, BUTTON_REC },
LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD)
}; /* button_context_tree */
@ -352,7 +353,7 @@ static const struct button_mapping button_context_wps[] = {
{ ACTION_WPS_CONTEXT, BUTTON_MODE|BUTTON_REPEAT, BUTTON_MODE },
{ ACTION_WPS_MENU, BUTTON_REC|BUTTON_REL, BUTTON_REC },
{ ACTION_WPS_QUICKSCREEN, BUTTON_REC|BUTTON_REPEAT, BUTTON_REC },
{ ACTION_WPS_VIEW_PLAYLIST,BUTTON_REC|BUTTON_MODE, BUTTON_REC },
{ ACTION_WPS_HOTKEY, BUTTON_REC|BUTTON_MODE, BUTTON_REC },
LAST_ITEM_IN_LIST
}; /* button_context_wps */

View File

@ -88,7 +88,11 @@ static const struct button_mapping button_context_wps[] = {
{ ACTION_WPS_VOLUP, BUTTON_UP, BUTTON_NONE },
{ ACTION_WPS_PITCHSCREEN, BUTTON_PLAY|BUTTON_UP, BUTTON_PLAY },
#ifdef HAVE_HOTKEY
{ ACTION_WPS_HOTKEY, BUTTON_PLAY|BUTTON_DOWN, BUTTON_PLAY },
#else
{ ACTION_WPS_VIEW_PLAYLIST, BUTTON_PLAY|BUTTON_DOWN, BUTTON_PLAY },
#endif
{ ACTION_WPS_QUICKSCREEN, BUTTON_MENU|BUTTON_REPEAT, BUTTON_MENU },
{ ACTION_WPS_MENU, BUTTON_MENU|BUTTON_REL, BUTTON_MENU },
@ -114,6 +118,9 @@ static const struct button_mapping button_context_list[] = {
static const struct button_mapping button_context_tree[] = {
{ ACTION_TREE_WPS, BUTTON_PLAY|BUTTON_REL, BUTTON_PLAY },
{ ACTION_TREE_STOP, BUTTON_PLAY|BUTTON_REPEAT, BUTTON_NONE },
#ifdef HAVE_HOTKEY
// { ACTION_TREE_HOTKEY, BUTTON_NONE, BUTTON_NONE },
#endif
LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_LIST)
}; /* button_context_tree */

View File

@ -95,7 +95,11 @@ static const struct button_mapping button_context_wps[] = {
{ ACTION_WPS_VOLUP, BUTTON_VOL_UP, BUTTON_NONE },
{ ACTION_WPS_PITCHSCREEN, BUTTON_A|BUTTON_UP, BUTTON_A },
#ifdef HAVE_HOTKEY
{ ACTION_WPS_HOTKEY, BUTTON_A|BUTTON_DOWN, BUTTON_NONE },
#else
{ ACTION_WPS_VIEW_PLAYLIST, BUTTON_A|BUTTON_DOWN, BUTTON_NONE },
#endif
{ ACTION_WPS_QUICKSCREEN, BUTTON_MENU|BUTTON_REPEAT, BUTTON_MENU },
{ ACTION_WPS_MENU, BUTTON_MENU|BUTTON_REL, BUTTON_MENU },
@ -129,6 +133,9 @@ static const struct button_mapping button_context_tree[] = {
{ ACTION_TREE_STOP, BUTTON_POWER, BUTTON_NONE },
{ ACTION_TREE_STOP, BUTTON_POWER|BUTTON_REL, BUTTON_POWER },
{ ACTION_TREE_STOP, BUTTON_POWER|BUTTON_REPEAT, BUTTON_NONE },
#ifdef HAVE_HOTKEY
// { ACTION_TREE_HOTKEY, BUTTON_NONE, BUTTON_NONE },
#endif
LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_LIST)
}; /* button_context_tree */

View File

@ -94,7 +94,11 @@ static const struct button_mapping button_context_wps[] = {
{ ACTION_WPS_ABSETA_PREVDIR,BUTTON_DISPLAY|BUTTON_LEFT, BUTTON_NONE },
{ ACTION_WPS_ABRESET, BUTTON_DISPLAY|BUTTON_SELECT, BUTTON_NONE },
{ ACTION_WPS_PITCHSCREEN, BUTTON_DISPLAY|BUTTON_UP, BUTTON_DISPLAY },
#ifdef HAVE_HOTKEY
{ ACTION_WPS_HOTKEY, BUTTON_DISPLAY|BUTTON_DOWN, BUTTON_DISPLAY },
#else
{ ACTION_WPS_VIEW_PLAYLIST, BUTTON_DISPLAY|BUTTON_DOWN, BUTTON_DISPLAY },
#endif
{ ACTION_WPS_ID3SCREEN, BUTTON_DISPLAY|BUTTON_MENU, BUTTON_NONE },
{ ACTION_WPS_CONTEXT, BUTTON_SELECT|BUTTON_REPEAT, BUTTON_SELECT },
@ -119,6 +123,9 @@ static const struct button_mapping button_context_tree[] = {
{ ACTION_TREE_STOP, BUTTON_POWER, BUTTON_NONE },
{ ACTION_TREE_STOP, BUTTON_POWER|BUTTON_REL, BUTTON_POWER },
{ ACTION_TREE_STOP, BUTTON_POWER|BUTTON_REPEAT, BUTTON_NONE },
#ifdef HAVE_HOTKEY
// { ACTION_TREE_HOTKEY, BUTTON_NONE, BUTTON_NONE },
#endif
LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_LIST)
}; /* button_context_tree */

View File

@ -63,7 +63,7 @@ static const struct button_mapping button_context_wps[] = {
{ ACTION_WPS_CONTEXT, BUTTON_PLAY|BUTTON_REPEAT, BUTTON_PLAY },
{ ACTION_WPS_ID3SCREEN, BUTTON_MENU|BUTTON_ON, BUTTON_NONE },
{ ACTION_STD_KEYLOCK, BUTTON_MENU|BUTTON_STOP, BUTTON_NONE },
{ ACTION_WPS_VIEW_PLAYLIST,BUTTON_MENU|BUTTON_ON, BUTTON_NONE },
{ ACTION_WPS_HOTKEY, BUTTON_MENU|BUTTON_ON, BUTTON_NONE },
LAST_ITEM_IN_LIST
};
@ -79,6 +79,7 @@ static const struct button_mapping button_context_settings[] = {
static const struct button_mapping button_context_tree[] = {
{ ACTION_TREE_WPS, BUTTON_ON, BUTTON_NONE },
{ ACTION_TREE_HOTKEY, BUTTON_MENU|BUTTON_ON, BUTTON_NONE },
LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD)
}; /* button_context_listtree */

View File

@ -76,7 +76,7 @@ static const struct button_mapping button_context_wps[] = {
{ ACTION_WPS_MENU, BUTTON_F1|BUTTON_REL, BUTTON_F1 },
{ ACTION_WPS_CONTEXT, BUTTON_PLAY|BUTTON_REPEAT, BUTTON_PLAY },
{ ACTION_WPS_QUICKSCREEN, BUTTON_F2|BUTTON_REPEAT, BUTTON_NONE },
{ ACTION_WPS_VIEW_PLAYLIST,BUTTON_F2|BUTTON_REL, BUTTON_F2 },
{ ACTION_WPS_HOTKEY, BUTTON_F2|BUTTON_REL, BUTTON_F2 },
{ ACTION_WPS_BROWSE, BUTTON_ON|BUTTON_REL, BUTTON_ON },
{ ACTION_WPS_ID3SCREEN, BUTTON_F1|BUTTON_ON, BUTTON_NONE },
{ ACTION_WPS_PITCHSCREEN, BUTTON_ON|BUTTON_UP, BUTTON_ON },
@ -107,6 +107,7 @@ static const struct button_mapping button_context_settings[] = {
static const struct button_mapping button_context_tree[] = {
{ ACTION_TREE_WPS, BUTTON_ON|BUTTON_REL, BUTTON_ON },
{ ACTION_TREE_STOP, BUTTON_OFF, BUTTON_NONE },
{ ACTION_TREE_HOTKEY, BUTTON_F2|BUTTON_REL, BUTTON_F2 },
{ ACTION_NONE, BUTTON_ON, BUTTON_NONE },
{ ACTION_LISTTREE_PGUP, BUTTON_ON|BUTTON_UP, BUTTON_ON },
{ ACTION_LISTTREE_PGUP, BUTTON_UP|BUTTON_REL, BUTTON_ON|BUTTON_UP },

View File

@ -100,7 +100,11 @@ static const struct button_mapping button_context_wps[] = {
{ ACTION_WPS_CONTEXT, BUTTON_PLAY|BUTTON_REPEAT, BUTTON_PLAY },
{ ACTION_WPS_QUICKSCREEN, BUTTON_MENU|BUTTON_REPEAT, BUTTON_MENU },
{ ACTION_WPS_PITCHSCREEN, BUTTON_NEXT|BUTTON_REPEAT, BUTTON_NONE },
#ifdef HAVE_HOTKEY
{ ACTION_WPS_HOTKEY, BUTTON_NEXT|BUTTON_REL, BUTTON_NEXT },
#else
{ ACTION_WPS_VIEW_PLAYLIST, BUTTON_NEXT|BUTTON_REL, BUTTON_NEXT },
#endif
{ ACTION_WPS_ID3SCREEN, BUTTON_PREV|BUTTON_REPEAT, BUTTON_NONE },
LAST_ITEM_IN_LIST
@ -124,6 +128,9 @@ static const struct button_mapping button_context_list[] = {
static const struct button_mapping button_context_tree[] = {
{ ACTION_TREE_WPS, BUTTON_PREV|BUTTON_REPEAT, BUTTON_NONE },
{ ACTION_TREE_STOP, BUTTON_NEXT|BUTTON_REPEAT, BUTTON_NONE },
#ifdef HAVE_HOTKEY
// { ACTION_TREE_HOTKEY, BUTTON_NONE, BUTTON_NONE },
#endif
LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_LIST)
}; /* button_context_tree */

View File

@ -92,7 +92,11 @@ static const struct button_mapping button_context_wps[] = {
{ ACTION_WPS_MENU, BUTTON_TOPLEFT|BUTTON_REL, BUTTON_TOPLEFT },
{ ACTION_WPS_QUICKSCREEN, BUTTON_BOTTOMLEFT|BUTTON_REL, BUTTON_BOTTOMLEFT },
#ifdef HAVE_HOTKEY
{ ACTION_WPS_HOTKEY, BUTTON_BOTTOMRIGHT|BUTTON_REL, BUTTON_BOTTOMRIGHT },
#else
{ ACTION_WPS_VIEW_PLAYLIST, BUTTON_BOTTOMRIGHT|BUTTON_REL, BUTTON_BOTTOMRIGHT },
#endif
{ ACTION_WPS_REC, BUTTON_TOPLEFT|BUTTON_REPEAT, BUTTON_TOPLEFT },
{ ACTION_WPS_PITCHSCREEN, BUTTON_BOTTOMLEFT|BUTTON_REPEAT, BUTTON_BOTTOMLEFT },
{ ACTION_WPS_ID3SCREEN, BUTTON_BOTTOMRIGHT|BUTTON_REPEAT, BUTTON_BOTTOMRIGHT },
@ -122,6 +126,9 @@ static const struct button_mapping button_context_list[] = {
static const struct button_mapping button_context_tree[] = {
{ ACTION_TREE_WPS, BUTTON_TOPRIGHT|BUTTON_REL, BUTTON_TOPRIGHT },
{ ACTION_TREE_STOP, BUTTON_BOTTOMRIGHT|BUTTON_REL, BUTTON_BOTTOMRIGHT },
#ifdef HAVE_HOTKEY
// { ACTION_TREE_HOTKEY, BUTTON_NONE, BUTTON_NONE },
#endif
LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM2|CONTEXT_CUSTOM|CONTEXT_TREE)
}; /* button_context_tree */

View File

@ -66,7 +66,11 @@ static const struct button_mapping button_context_wps[] = {
{ ACTION_WPS_VOLUP, BUTTON_UP, BUTTON_NONE },
{ ACTION_WPS_BROWSE, BUTTON_OK|BUTTON_REL, BUTTON_OK },
{ ACTION_WPS_CONTEXT, BUTTON_MENU|BUTTON_REPEAT, BUTTON_MENU },
#ifdef HAVE_HOTKEY
{ ACTION_WPS_HOTKEY, BUTTON_CANCEL, BUTTON_NONE },
#else
{ ACTION_WPS_VIEW_PLAYLIST, BUTTON_CANCEL, BUTTON_NONE },
#endif
{ ACTION_WPS_MENU, BUTTON_MENU|BUTTON_REL, BUTTON_MENU },
{ ACTION_WPS_QUICKSCREEN, BUTTON_OK|BUTTON_REPEAT, BUTTON_OK },
@ -76,6 +80,9 @@ static const struct button_mapping button_context_wps[] = {
static const struct button_mapping button_context_tree[] = {
{ ACTION_TREE_WPS, BUTTON_PLAY|BUTTON_REL, BUTTON_PLAY },
{ ACTION_TREE_STOP, BUTTON_PLAY|BUTTON_REPEAT, BUTTON_PLAY },
#ifdef HAVE_HOTKEY
// { ACTION_TREE_HOTKEY, BUTTON_NONE, BUTTON_NONE },
#endif
LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD)
}; /* button_context_tree */

View File

@ -96,7 +96,11 @@ static const struct button_mapping button_context_wps[] = {
{ ACTION_WPS_QUICKSCREEN, BUTTON_LEFT|BUTTON_DOWN|BUTTON_REPEAT,
BUTTON_LEFT|BUTTON_DOWN|BUTTON_REPEAT },
#ifdef HAVE_HOTKEY
{ ACTION_WPS_HOTKEY, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_LEFT },
#else
{ ACTION_WPS_VIEW_PLAYLIST, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_LEFT },
#endif
{ ACTION_WPS_REC, BUTTON_REC|BUTTON_REPEAT, BUTTON_NONE },
LAST_ITEM_IN_LIST
@ -117,6 +121,9 @@ static const struct button_mapping button_context_list[] = {
static const struct button_mapping button_context_tree[] = {
{ ACTION_TREE_WPS, BUTTON_PLAY|BUTTON_REL, BUTTON_PLAY },
{ ACTION_TREE_STOP, BUTTON_PLAY|BUTTON_REPEAT, BUTTON_PLAY },
#ifdef HAVE_HOTKEY
// { ACTION_TREE_HOTKEY, BUTTON_NONE, BUTTON_NONE },
#endif
LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_LIST)
}; /* button_context_tree */

View File

@ -13394,3 +13394,71 @@
lineout_poweroff: "Line Out"
</voice>
</phrase>
<phrase>
id: LANG_SET_HOTKEY
desc: hotkey splash
user: core
<source>
*: none
hotkey: "Set Hotkey: %s"
</source>
<dest>
*: none
hotkey: "Set Hotkey: %s"
</dest>
<voice>
*: none
hotkey: "Set Hotkey: %s"
</voice>
</phrase>
<phrase>
id: LANG_HOTKEY_NOT_SET
desc: hotkey splash
user: core
<source>
*: none
hotkey: "Hotkey Not Set"
</source>
<dest>
*: none
hotkey: "Hotkey Not Set"
</dest>
<voice>
*: none
hotkey: "Hotkey Not Set"
</voice>
</phrase>
<phrase>
id: LANG_HOTKEY
desc: hotkey menu
user: core
<source>
*: none
hotkey: "Hotkey"
</source>
<dest>
*: none
hotkey: "Hotkey"
</dest>
<voice>
*: none
hotkey: "Hotkey"
</voice>
</phrase>
<phrase>
id: LANG_VIEW_HOTKEY
desc: hotkey menu
user: core
<source>
*: none
hotkey: "View Hotkey Settings"
</source>
<dest>
*: none
hotkey: "View Hotkey Settings"
</dest>
<voice>
*: none
hotkey: "View Hotkey Settings"
</voice>
</phrase>

View File

@ -61,6 +61,12 @@
#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
@ -425,6 +431,17 @@ 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)))
{
ret = MENU_SELECTED_HOTKEY;
done = true;
selected = get_menu_selection(gui_synclist_get_sel_pos(&lists),menu);
selected_menu_item = menu->submenus[selected];
}
#endif
else if (action == ACTION_TREE_WPS)
{

View File

@ -47,6 +47,10 @@
#ifdef HAVE_DIRCACHE
#include "dircache.h"
#endif
#ifdef HAVE_HOTKEY
#include "list.h"
#include "settings_list.h"
#endif
/***********************************/
/* TAGCACHE MENU */
@ -399,6 +403,58 @@ 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;
simplelist_set_line_count(2);
simplelist_addline(0, "WPS: %s",
str(global_settings.hotkey_wps_desc_id));
simplelist_addline(1, "Tree: %s",
str(global_settings.hotkey_tree_desc_id));
simplelist_show_list(&info);
}
/* reset hotkey settings to their defaults */
static void reset_hotkey_settings(void)
{
void *vars[] = {
&global_settings.hotkey_tree,
&global_settings.hotkey_tree_desc_id,
&global_settings.hotkey_wps,
&global_settings.hotkey_wps_desc_id,
};
const int num_settings = sizeof(vars) / sizeof(vars[0]);
int i;
for (i = 0; i < num_settings; i++)
{
const struct settings_list *setting =
find_setting(vars[i], 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);
MAKE_MENU(hotkey_menu, ID2P(LANG_HOTKEY), 0, Icon_NOICON,
&hotkey_view, &hotkey_reset);
#endif /*have_hotkey */
/* HOTKEY MENU */
/***********************************/
/***********************************/
/* SETTINGS MENU */
static int language_browse(void)
@ -415,7 +471,10 @@ MAKE_MENU(settings_menu_item, ID2P(LANG_GENERAL_SETTINGS), 0,
&tagcache_menu,
#endif
&display_menu, &system_menu,
&bookmark_settings_menu, &browse_langs, &voice_settings_menu
&bookmark_settings_menu, &browse_langs, &voice_settings_menu,
#ifdef HAVE_HOTKEY
&hotkey_menu,
#endif
);
/* SETTINGS MENU */
/***********************************/

View File

@ -528,7 +528,7 @@ static int remove_dir(char* dirname, int len)
/* share code for file and directory deletion, saves space */
static bool delete_handler(bool is_dir)
static bool delete_file_dir(void)
{
char file_to_delete[MAX_PATH];
strcpy(file_to_delete, selected_file);
@ -551,7 +551,7 @@ static bool delete_handler(bool is_dir)
splash(0, str(LANG_DELETING));
int res;
if (is_dir)
if (selected_file_attr & ATTR_DIRECTORY) /* true if directory */
{
char pathname[MAX_PATH]; /* space to go deep */
cpu_boost(true);
@ -568,16 +568,6 @@ static bool delete_handler(bool is_dir)
return (res == 0);
}
static bool delete_file(void)
{
return delete_handler(false);
}
static bool delete_dir(void)
{
return delete_handler(true);
}
static bool rename_file(void)
{
char newname[MAX_PATH];
@ -988,9 +978,9 @@ MENUITEM_FUNCTION(clipboard_copy_item, 0, ID2P(LANG_COPY),
MENUITEM_FUNCTION(clipboard_paste_item, 0, ID2P(LANG_PASTE),
clipboard_paste, NULL, clipboard_callback, Icon_NOICON);
MENUITEM_FUNCTION(delete_file_item, 0, ID2P(LANG_DELETE),
delete_file, NULL, clipboard_callback, Icon_NOICON);
delete_file_dir, NULL, clipboard_callback, Icon_NOICON);
MENUITEM_FUNCTION(delete_dir_item, 0, ID2P(LANG_DELETE_DIR),
delete_dir, NULL, clipboard_callback, Icon_NOICON);
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);
@ -1180,19 +1170,205 @@ static int onplaymenu_callback(int action,const struct menu_item_ex *this_item)
}
return action;
}
int onplay(char* file, int attr, int from)
#ifdef HAVE_HOTKEY
/* direct function calls, no need for menu callbacks */
static bool delete_item(void)
{
#ifdef HAVE_MULTIVOLUME
/* no delete for volumes */
if ((selected_file_attr & FAT_ATTR_VOLUME) ||
(selected_file_attr & ATTR_VOLUME))
return false;
#endif
return delete_file_dir();
}
static bool open_with(void)
{
/* only open files */
if (selected_file_attr & ATTR_DIRECTORY)
return false;
#ifdef HAVE_MULTIVOLUME
if (selected_file_attr & ATTR_VOLUME)
return false;
#endif
return list_viewers();
}
extern const struct menu_item_ex *selected_menu_item;
extern bool hotkey_settable_menu;
#define HOT_MASK 0x0FF
#define HOT_WPS 0x100
#define HOT_TREE 0x200
struct hotkey_assignment {
int item;
struct menu_func func;
int return_code;
const struct menu_item_ex *menu_addr;
};
#define HOTKEY_FUNC(func, param) {{(void *)func}, param}
/* Any desired hotkey functions go here... */
enum hotkey_settings {
HOTKEY_OFF = 0,
HOTKEY_VIEW_PLAYLIST = 1,
HOTKEY_SHOW_TRACK_INFO,
HOTKEY_PITCHSCREEN,
HOTKEY_OPEN_WITH,
HOTKEY_DELETE,
HOTKEY_INSERT,
};
/* ... and here. Order is not important. */
static struct hotkey_assignment hotkey_items[] = {
{ HOTKEY_VIEW_PLAYLIST | HOT_WPS,
HOTKEY_FUNC(NULL, NULL),
ONPLAY_PLAYLIST, &view_cur_playlist },
{ HOTKEY_SHOW_TRACK_INFO| HOT_WPS,
HOTKEY_FUNC(browse_id3, NULL),
ONPLAY_RELOAD_DIR, &browse_id3_item },
#ifdef HAVE_PITCHSCREEN
{ HOTKEY_PITCHSCREEN | HOT_WPS,
HOTKEY_FUNC(gui_syncpitchscreen_run, NULL),
ONPLAY_RELOAD_DIR, &pitch_screen_item },
#endif
{ HOTKEY_OPEN_WITH | HOT_WPS | HOT_TREE,
HOTKEY_FUNC(open_with, NULL),
ONPLAY_RELOAD_DIR, &list_viewers_item },
{ HOTKEY_DELETE | HOT_WPS | HOT_TREE,
HOTKEY_FUNC(delete_item, NULL),
ONPLAY_RELOAD_DIR, &delete_file_item },
{ HOTKEY_DELETE | HOT_TREE,
HOTKEY_FUNC(delete_item, NULL),
ONPLAY_RELOAD_DIR, &delete_dir_item },
{ HOTKEY_INSERT | HOT_TREE,
HOTKEY_FUNC(playlist_insert_func, (intptr_t*)PLAYLIST_INSERT),
ONPLAY_START_PLAY, &i_pl_item },
};
static const int num_hotkey_items = sizeof(hotkey_items) / sizeof(hotkey_items[0]);
/* Execute the hotkey function, if listed for this screen */
static int execute_hotkey(bool is_wps)
{
int i;
struct hotkey_assignment *this_item;
const int context = is_wps ? HOT_WPS : HOT_TREE;
const int this_hotkey = (is_wps ? global_settings.hotkey_wps :
global_settings.hotkey_tree);
/* search assignment struct for a match for the hotkey setting */
for (i = 0; i < num_hotkey_items; i++)
{
this_item = &hotkey_items[i];
if ((this_item->item & context) &&
((this_item->item & HOT_MASK) == this_hotkey))
{
/* run the associated function (with optional param), if any */
const struct menu_func func = this_item->func;
if (func.function != NULL)
{
if (func.param != NULL)
(*(func.function_w_param))(func.param);
else
(*(func.function))();
}
/* return with the associated code */
return this_item->return_code;
}
}
/* no valid hotkey set */
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 ? HOT_WPS : HOT_TREE;
int *hk_func = is_wps ? &global_settings.hotkey_wps :
&global_settings.hotkey_tree,
*hk_desc = is_wps ? &global_settings.hotkey_wps_desc_id :
&global_settings.hotkey_tree_desc_id;
int this_hk,
this_id;
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 & HOT_MASK;
this_id = P2ID((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];
char line2_buf[101];
char *line1 = line1_buf;
char *line2 = line2_buf;
char **line1_ptr = &line1;
char **line2_ptr = &line2;
const struct text_message message={(const char **)line2_ptr, 1};
const struct text_message yes_message={(const char **)line1_ptr, 1};
snprintf(line1, 100, str(LANG_SET_HOTKEY), str(this_id));
strcat(strcpy(line2, line1), "?");
/* confirm the hotkey setting change */
if(gui_syncyesno_run(&message, &yes_message, NULL)==YESNO_YES)
{
/* store the hotkey settings */
*hk_func = this_hk;
*hk_desc = this_id;
settings_save();
splash(HZ*2, line1);
}
}
#endif /* HOTKEY */
int onplay(char* file, int attr, int from, bool hotkey)
{
const struct menu_item_ex *menu;
onplay_result = ONPLAY_OK;
context = from;
selected_file = file;
selected_file_attr = attr;
#ifdef HAVE_HOTKEY
if (hotkey)
return execute_hotkey(context == CONTEXT_WPS);
hotkey_settable_menu = true;
#else
(void)hotkey;
#endif
if (context == CONTEXT_WPS)
menu = &wps_onplay_menu;
else
menu = &tree_onplay_menu;
switch (do_menu(menu, NULL, NULL, false))
{
#ifdef HAVE_HOTKEY
hotkey_settable_menu = false;
case MENU_SELECTED_HOTKEY:
set_hotkey(context == CONTEXT_WPS);
return ONPLAY_RELOAD_DIR;
#endif
case GO_TO_WPS:
return ONPLAY_START_PLAY;
case GO_TO_ROOT:

View File

@ -21,7 +21,7 @@
#ifndef _ONPLAY_H_
#define _ONPLAY_H_
int onplay(char* file, int attr, int from_screen);
int onplay(char* file, int attr, int from_screen, bool hotkey);
enum {
ONPLAY_MAINMENU = -1,

View File

@ -281,7 +281,7 @@ static int display_playlists(char* playlist, bool view)
sel_file);
if (onplay(playlist, FILE_ATTR_M3U,
CONTEXT_TREE) != ONPLAY_OK)
CONTEXT_TREE, false) != ONPLAY_OK)
{
result = 0;
exit = true;

View File

@ -53,6 +53,7 @@ enum {
GO_TO_BROWSEPLUGINS,
GO_TO_TIMESCREEN,
GO_TO_PLAYLIST_VIEWER,
MENU_SELECTED_HOTKEY,
};
extern const struct menu_item_ex root_menu_;

View File

@ -816,6 +816,13 @@ struct user_settings
bool morse_input; /* text input method setting */
#endif
#ifdef HAVE_HOTKEY
int hotkey_wps;
int hotkey_wps_desc_id;
int hotkey_tree;
int hotkey_tree_desc_id;
#endif
};
/** global variables **/

View File

@ -1660,6 +1660,13 @@ const struct settings_list settings[] = {
#ifdef HAVE_MORSE_INPUT
OFFON_SETTING(0, morse_input, LANG_MORSE_INPUT, false, "morse input", NULL),
#endif
#ifdef HAVE_HOTKEY
CHOICE_SETTING(0, hotkey_wps, 0, 1, "hotkey wps", 0, NULL, 0),
CHOICE_SETTING(0, hotkey_wps_desc_id, 0, LANG_VIEW_DYNAMIC_PLAYLIST, "hotkey wps desc id", 0, NULL, 0),
CHOICE_SETTING(0, hotkey_tree, 0, 0, "hotkey tree", 0, NULL, 0),
CHOICE_SETTING(0, hotkey_tree_desc_id, 0, LANG_OFF, "hotkey tree desc id", 0, NULL, 0),
#endif
};
const int nb_settings = sizeof(settings)/sizeof(*settings);

View File

@ -757,12 +757,14 @@ static int dirbrowse()
#endif
case ACTION_STD_CONTEXT:
case ACTION_TREE_HOTKEY:
{
bool hotkey = button == ACTION_TREE_HOTKEY;
int onplay_result;
int attr = 0;
if(!numentries)
onplay_result = onplay(NULL, 0, curr_context);
onplay_result = onplay(NULL, 0, curr_context, hotkey);
else {
#ifdef HAVE_TAGCACHE
if (id3db)
@ -788,7 +790,7 @@ static int dirbrowse()
snprintf(buf, sizeof buf, "/%s",
dircache[tc.selected_item].name);
}
onplay_result = onplay(buf, attr, curr_context);
onplay_result = onplay(buf, attr, curr_context, hotkey);
}
switch (onplay_result)
{

View File

@ -140,3 +140,5 @@
#define MIN_CONTRAST_SETTING 5
#define MAX_CONTRAST_SETTING 63
/* Define this if a programmable hotkey is mapped */
#define HAVE_HOTKEY

View File

@ -140,3 +140,5 @@
#define MIN_CONTRAST_SETTING 5
#define MAX_CONTRAST_SETTING 63
/* Define this if a programmable hotkey is mapped */
//#define HAVE_HOTKEY

View File

@ -124,3 +124,5 @@
#define MIN_CONTRAST_SETTING 5
#define MAX_CONTRAST_SETTING 63
/* Define this if a programmable hotkey is mapped */
//#define HAVE_HOTKEY

View File

@ -103,3 +103,5 @@
#define HAVE_SERIAL
/* Define this if a programmable hotkey is mapped */
#define HAVE_HOTKEY

View File

@ -134,3 +134,5 @@
#define MAX_CONTRAST_SETTING 63
#define HAVE_SERIAL
/* Define this if a programmable hotkey is mapped */
#define HAVE_HOTKEY

View File

@ -140,3 +140,5 @@
#define MIN_CONTRAST_SETTING 5
#define MAX_CONTRAST_SETTING 63
/* Define this if a programmable hotkey is mapped */
#define HAVE_HOTKEY

View File

@ -169,3 +169,5 @@
#define BOOTFILE "rockbox." BOOTFILE_EXT
#define BOOTDIR "/.rockbox"
/* Define this if a programmable hotkey is mapped */
//#define HAVE_HOTKEY

View File

@ -165,3 +165,5 @@
#define USB_PRODUCT_ID 0x4133
#define USB_NUM_ENDPOINTS 7
/* Define this if a programmable hotkey is mapped */
//#define HAVE_HOTKEY

View File

@ -186,3 +186,5 @@
#define BOOTFILE "rockbox." BOOTFILE_EXT
#define BOOTDIR "/.rockbox"
/* Define this if a programmable hotkey is mapped */
//#define HAVE_HOTKEY

View File

@ -214,3 +214,5 @@
#define BOOTFILE "rockbox." BOOTFILE_EXT
#define BOOTDIR "/.rockbox"
/* Define this if a programmable hotkey is mapped */
//#define HAVE_HOTKEY

View File

@ -205,3 +205,6 @@
* writes appear to be ~25% slower.
*/
#define HAVE_ATA_DMA
/* Define this if a programmable hotkey is mapped */
//#define HAVE_HOTKEY

View File

@ -200,3 +200,5 @@
#define ICODE_ATTR_TREMOR_NOT_MDCT
/* Define this if a programmable hotkey is mapped */
//#define HAVE_HOTKEY

View File

@ -194,3 +194,5 @@
#define INCLUDE_TIMEOUT_API
/* Define this if a programmable hotkey is mapped */
//#define HAVE_HOTKEY

View File

@ -160,3 +160,5 @@
#define IRAM_LCDFRAMEBUFFER IBSS_ATTR /* put the lcd frame buffer in IRAM */
/* Define this if a programmable hotkey is mapped */
//#define HAVE_HOTKEY

View File

@ -169,3 +169,6 @@
#define DEFAULT_CONTRAST_SETTING 24
#define IRAM_LCDFRAMEBUFFER IBSS_ATTR /* put the lcd frame buffer in IRAM */
/* Define this if a programmable hotkey is mapped */
#define HAVE_HOTKEY

View File

@ -190,3 +190,6 @@
#define DEFAULT_REMOTE_CONTRAST_SETTING 24 /* Match boot contrast */
#define IRAM_LCDFRAMEBUFFER IBSS_ATTR /* put the lcd frame buffer in IRAM */
/* Define this if a programmable hotkey is mapped */
//#define HAVE_HOTKEY

View File

@ -205,3 +205,6 @@
#define MIN_REMOTE_CONTRAST_SETTING 10
#define MAX_REMOTE_CONTRAST_SETTING 35
#define DEFAULT_REMOTE_CONTRAST_SETTING 24 /* Match boot contrast */
/* Define this if a programmable hotkey is mapped */
//#define HAVE_HOTKEY

View File

@ -169,3 +169,5 @@
#define IRAM_LCDFRAMEBUFFER IBSS_ATTR /* put the lcd frame buffer in IRAM */
/* Define this if a programmable hotkey is mapped */
#define HAVE_HOTKEY

View File

@ -180,3 +180,5 @@
#define IRAM_LCDFRAMEBUFFER IBSS_ATTR /* put the lcd frame buffer in IRAM */
/* Define this if a programmable hotkey is mapped */
#define HAVE_HOTKEY

View File

@ -212,3 +212,6 @@
* writes appear to be ~25% slower.
*/
#define HAVE_ATA_DMA
/* Define this if a programmable hotkey is mapped */
#define HAVE_HOTKEY

View File

@ -194,3 +194,6 @@
* writes appear to be ~25% slower.
*/
#define HAVE_ATA_DMA
/* Define this if a programmable hotkey is mapped */
#define HAVE_HOTKEY

View File

@ -198,3 +198,6 @@
* writes appear to be ~25% slower.
*/
#define HAVE_ATA_DMA
/* Define this if a programmable hotkey is mapped */
#define HAVE_HOTKEY

View File

@ -208,3 +208,6 @@
* writes appear to be ~25% slower.
*/
#define HAVE_ATA_DMA
/* Define this if a programmable hotkey is mapped */
#define HAVE_HOTKEY

View File

@ -197,3 +197,6 @@
* writes appear to be ~25% slower.
*/
#define HAVE_ATA_DMA
/* Define this if a programmable hotkey is mapped */
#define HAVE_HOTKEY

View File

@ -221,3 +221,5 @@
#define USB_WRITE_BUFFER_SIZE (1024*64)
/* Define this if a programmable hotkey is mapped */
#define HAVE_HOTKEY

View File

@ -231,3 +231,6 @@
* writes appear to be ~25% slower.
*/
#define HAVE_ATA_DMA
/* Define this if a programmable hotkey is mapped */
#define HAVE_HOTKEY

View File

@ -191,3 +191,6 @@
* writes appear to be ~25% slower.
*/
#define HAVE_ATA_DMA
/* Define this if a programmable hotkey is mapped */
#define HAVE_HOTKEY

View File

@ -216,3 +216,6 @@
#define DEFAULT_REMOTE_CONTRAST_SETTING 42
#define IRAM_LCDFRAMEBUFFER IBSS_ATTR /* put the lcd frame buffer in IRAM */
/* Define this if a programmable hotkey is mapped */
#define HAVE_HOTKEY

View File

@ -179,3 +179,6 @@
* writes appear to be ~25% slower.
*/
#define HAVE_ATA_DMA
/* Define this if a programmable hotkey is mapped */
#define HAVE_HOTKEY

View File

@ -217,3 +217,6 @@
#define DEFAULT_REMOTE_CONTRAST_SETTING 42
#define IRAM_LCDFRAMEBUFFER IBSS_ATTR /* put the lcd frame buffer in IRAM */
/* Define this if a programmable hotkey is mapped */
#define HAVE_HOTKEY

View File

@ -204,3 +204,6 @@
#define MIN_REMOTE_CONTRAST_SETTING 5
#define MAX_REMOTE_CONTRAST_SETTING 63
#define DEFAULT_REMOTE_CONTRAST_SETTING 42
/* Define this if a programmable hotkey is mapped */
#define HAVE_HOTKEY

View File

@ -122,3 +122,5 @@
#define IRAM_LCDFRAMEBUFFER IBSS_ATTR /* put the lcd frame buffer in IRAM */
/* Define this if a programmable hotkey is mapped */
//#define HAVE_HOTKEY

View File

@ -145,3 +145,5 @@
#define IRAM_LCDFRAMEBUFFER IBSS_ATTR /* put the lcd frame buffer in IRAM */
/* Define this if a programmable hotkey is mapped */
//#define HAVE_HOTKEY

View File

@ -101,3 +101,5 @@
#define BOOTFILE "rockbox." BOOTFILE_EXT
#define BOOTDIR "/.rockbox"
/* Define this if a programmable hotkey is mapped */
//#define HAVE_HOTKEY

View File

@ -178,3 +178,5 @@
#define MAX_BRIGHTNESS_SETTING 15
#define DEFAULT_BRIGHTNESS_SETTING 10
/* Define this if a programmable hotkey is mapped */
#define HAVE_HOTKEY

View File

@ -176,3 +176,5 @@
#define MAX_BRIGHTNESS_SETTING 13 /* 3/16 (18.75%) */
#define DEFAULT_BRIGHTNESS_SETTING 8 /* 8/16 (50.00%) = x5 boot default */
/* Define this if a programmable hotkey is mapped */
//#define HAVE_HOTKEY

View File

@ -185,3 +185,5 @@
#define MAX_BRIGHTNESS_SETTING 13 /* 3/16 (18.75%) */
#define DEFAULT_BRIGHTNESS_SETTING 8 /* 8/16 (50.00%) = x5 boot default */
/* Define this if a programmable hotkey is mapped */
//#define HAVE_HOTKEY

View File

@ -154,3 +154,5 @@
#define BOOTFILE "rockbox." BOOTFILE_EXT
#define BOOTDIR "/.rockbox"
/* Define this if a programmable hotkey is mapped */
//#define HAVE_HOTKEY

View File

@ -205,3 +205,6 @@
* writes appear to be ~25% slower.
*/
#define HAVE_ATA_DMA
/* Define this if a programmable hotkey is mapped */
//#define HAVE_HOTKEY

View File

@ -256,3 +256,5 @@
#define IRAM_LCDFRAMEBUFFER IBSS_ATTR /* put the lcd frame buffer in IRAM */
/* Define this if a programmable hotkey is mapped */
//#define HAVE_HOTKEY

View File

@ -218,3 +218,5 @@ No access to the NAND yet..
#define USB_VENDOR_ID 0x07C4
#define USB_PRODUCT_ID 0xA4A5
/* Define this if a programmable hotkey is mapped */
//#define HAVE_HOTKEY

View File

@ -165,3 +165,5 @@
#define USB_VENDOR_ID 0x07C4
#define USB_PRODUCT_ID 0xA4A5
/* Define this if a programmable hotkey is mapped */
//#define HAVE_HOTKEY

View File

@ -205,3 +205,5 @@ No access to the NAND yet..
#define USB_VENDOR_ID 0x07C4
#define USB_PRODUCT_ID 0xA4A5
/* Define this if a programmable hotkey is mapped */
//#define HAVE_HOTKEY

View File

@ -186,3 +186,6 @@
* writes appear to be ~25% slower.
*/
#define HAVE_ATA_DMA
/* Define this if a programmable hotkey is mapped */
//#define HAVE_HOTKEY

View File

@ -192,3 +192,6 @@
* writes appear to be ~25% slower.
*/
#define HAVE_ATA_DMA
/* Define this if a programmable hotkey is mapped */
//#define HAVE_HOTKEY

View File

@ -190,3 +190,6 @@
* writes appear to be ~25% slower.
*/
#define HAVE_ATA_DMA
/* Define this if a programmable hotkey is mapped */
//#define HAVE_HOTKEY

View File

@ -180,3 +180,5 @@
#define MAX_BRIGHTNESS_SETTING 15
#define DEFAULT_BRIGHTNESS_SETTING 10
/* Define this if a programmable hotkey is mapped */
#define HAVE_HOTKEY

View File

@ -126,3 +126,5 @@
#define IRAM_LCDFRAMEBUFFER IBSS_ATTR /* put the lcd frame buffer in IRAM */
/* Define this if a programmable hotkey is mapped */
#define HAVE_HOTKEY

View File

@ -205,3 +205,6 @@
#define DEFAULT_REC_MIC_GAIN 23
#define DEFAULT_REC_LEFT_GAIN 23
#define DEFAULT_REC_RIGHT_GAIN 23
/* Define this if a programmable hotkey is mapped */
#define HAVE_HOTKEY

View File

@ -201,3 +201,6 @@
#define DEFAULT_REC_MIC_GAIN 23
#define DEFAULT_REC_LEFT_GAIN 23
#define DEFAULT_REC_RIGHT_GAIN 23
/* Define this if a programmable hotkey is mapped */
#define HAVE_HOTKEY

View File

@ -199,3 +199,6 @@
#define DEFAULT_REC_MIC_GAIN 23
#define DEFAULT_REC_LEFT_GAIN 23
#define DEFAULT_REC_RIGHT_GAIN 23
/* Define this if a programmable hotkey is mapped */
//#define HAVE_HOTKEY

View File

@ -211,3 +211,6 @@
#define DEFAULT_REC_MIC_GAIN 23
#define DEFAULT_REC_LEFT_GAIN 23
#define DEFAULT_REC_RIGHT_GAIN 23
/* Define this if a programmable hotkey is mapped */
//#define HAVE_HOTKEY

View File

@ -207,3 +207,6 @@
#define DEFAULT_REC_MIC_GAIN 23
#define DEFAULT_REC_LEFT_GAIN 23
#define DEFAULT_REC_RIGHT_GAIN 23
/* Define this if a programmable hotkey is mapped */
//#define HAVE_HOTKEY

View File

@ -214,3 +214,5 @@
#define IRAMORIG 0x40004000
#endif
/* Define this if a programmable hotkey is mapped */
#define HAVE_HOTKEY

View File

@ -211,3 +211,6 @@
#define DEFAULT_REC_MIC_GAIN 23
#define DEFAULT_REC_LEFT_GAIN 23
#define DEFAULT_REC_RIGHT_GAIN 23
/* Define this if a programmable hotkey is mapped */
#define HAVE_HOTKEY

View File

@ -209,3 +209,5 @@
#define INCLUDE_TIMEOUT_API
/* Define this if a programmable hotkey is mapped */
#define HAVE_HOTKEY

View File

@ -206,3 +206,5 @@
#define INCLUDE_TIMEOUT_API
/* Define this if a programmable hotkey is mapped */
#define HAVE_HOTKEY

View File

@ -134,3 +134,5 @@
#define IRAM_LCDFRAMEBUFFER IBSS_ATTR /* put the lcd frame buffer in IRAM */
/* Define this if a programmable hotkey is mapped */
//#define HAVE_HOTKEY

View File

@ -163,3 +163,5 @@
#define IRAM_LCDFRAMEBUFFER IBSS_ATTR /* put the lcd frame buffer in IRAM */
/* Define this if a programmable hotkey is mapped */
//#define HAVE_HOTKEY

View File

@ -201,3 +201,6 @@
#define DEFAULT_REC_MIC_GAIN 23
#define DEFAULT_REC_LEFT_GAIN 23
#define DEFAULT_REC_RIGHT_GAIN 23
/* Define this if a programmable hotkey is mapped */
#define HAVE_HOTKEY

View File

@ -142,3 +142,6 @@
* writes appear to be ~25% slower.
*/
#define HAVE_ATA_DMA
/* Define this if a programmable hotkey is mapped */
//#define HAVE_HOTKEY

Some files were not shown because too many files have changed in this diff Show More