Index: apps/action.h
===================================================================
--- apps/action.h (revision 25296)
+++ apps/action.h (working copy)
@@ -106,6 +106,7 @@
ACTION_STD_QUICKSCREEN,
ACTION_STD_KEYLOCK,
ACTION_STD_REC,
+ ACTION_STD_HOTKEY,
ACTION_F3, /* just so everything works again, possibly change me */
/* code context actions */
Index: apps/tree.c
===================================================================
--- apps/tree.c (revision 25296)
+++ apps/tree.c (working copy)
@@ -756,13 +756,15 @@
break;
#endif
+ case ACTION_STD_HOTKEY:
case ACTION_STD_CONTEXT:
{
+ bool hotkey = button == ACTION_STD_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 @@
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)
{
Index: apps/lang/english.lang
===================================================================
--- apps/lang/english.lang (revision 25296)
+++ apps/lang/english.lang (working copy)
@@ -13394,3 +13394,37 @@
lineout_poweroff: "Line Out"
+
+ id: LANG_SET_HOTKEY
+ desc: hotkey splash
+ user: core
+
+ *: none
+ hotkey: "Set Hotkey: %s"
+
+
+ *: none
+ hotkey: "Set Hotkey: %s"
+
+
+ *: none
+ hotkey: "Set Hotkey: %s"
+
+
+
+ id: LANG_HOTKEY_NOT_SET
+ desc: hotkey splash
+ user: core
+
+ *: none
+ hotkey: "Hotkey Not Set"
+
+
+ *: none
+ hotkey: "Hotkey Not Set"
+
+
+ *: none
+ hotkey: "Hotkey Not Set"
+
+
Index: apps/onplay.c
===================================================================
--- apps/onplay.c (revision 25296)
+++ apps/onplay.c (working copy)
@@ -73,6 +73,18 @@
static int clipboard_selection_attr = 0;
static bool clipboard_is_copy = false;
+/* hotkey settings */
+#ifdef HOTKEY
+extern const struct menu_item_ex *selected_menu_item;
+extern bool hotkey_settable_menu;
+
+enum {
+ HOTKEY_OFF,
+ HOTKEY_DELETE,
+ HOTKEY_INSERT,
+};
+#endif
+
/* redefine MAKE_MENU so the MENU_EXITAFTERTHISMENU flag can be added easily */
#define MAKE_ONPLAYMENU( name, str, callback, icon, ... ) \
static const struct menu_item_ex *name##_[] = {__VA_ARGS__}; \
@@ -1176,11 +1188,10 @@
break;
case ACTION_EXIT_MENUITEM:
return ACTION_EXIT_AFTER_THIS_MENUITEM;
- break;
}
return action;
}
-int onplay(char* file, int attr, int from)
+int onplay(char* file, int attr, int from, bool hotkey)
{
const struct menu_item_ex *menu;
onplay_result = ONPLAY_OK;
@@ -1190,9 +1201,56 @@
if (context == CONTEXT_WPS)
menu = &wps_onplay_menu;
else
+ {
+#ifdef HOTKEY
+ if (hotkey)
+ {
+ switch (global_settings.hotkey_tree)
+ {
+ case HOTKEY_DELETE:
+ delete_handler(attr & ATTR_DIRECTORY);
+ return ONPLAY_RELOAD_DIR;
+ case HOTKEY_INSERT:
+ playlist_insert_func((intptr_t*)PLAYLIST_INSERT);
+ return ONPLAY_START_PLAY;
+ default:
+ splash(HZ, ID2P(LANG_HOTKEY_NOT_SET));
+ return ONPLAY_RELOAD_DIR;
+ }
+ }
+ hotkey_settable_menu = true;
+#else
+ (void)hotkey;
+#endif
menu = &tree_onplay_menu;
+ }
switch (do_menu(menu, NULL, NULL, false))
{
+#ifdef HOTKEY
+ hotkey_settable_menu = false;
+ case MENU_SELECTED_HOTKEY:
+ {
+ bool hotkey_set = true;
+ if ((selected_menu_item == &delete_file_item) ||
+ (selected_menu_item == &delete_dir_item))
+ global_settings.hotkey_tree = HOTKEY_DELETE;
+ else if (selected_menu_item == &i_pl_item)
+ global_settings.hotkey_tree = HOTKEY_INSERT;
+ else
+ {
+ hotkey_set = false;
+ global_settings.hotkey_tree = HOTKEY_OFF;
+ }
+ settings_save();
+ if (hotkey_set)
+ splashf(HZ*2, str(LANG_SET_HOTKEY),
+ P2STR((selected_menu_item->callback_and_desc)->desc));
+ else
+ splashf(HZ*2, str(LANG_SET_HOTKEY),
+ str(LANG_OFF));
+ return ONPLAY_RELOAD_DIR;
+ }
+#endif
case GO_TO_WPS:
return ONPLAY_START_PLAY;
case GO_TO_ROOT:
Index: apps/gui/wps.c
===================================================================
--- apps/gui/wps.c (revision 25296)
+++ apps/gui/wps.c (working copy)
@@ -891,7 +891,7 @@
{
gwps_leave_wps();
int retval = onplay(wps_state.id3->path,
- FILE_ATTR_AUDIO, CONTEXT_WPS);
+ FILE_ATTR_AUDIO, CONTEXT_WPS, false);
/* if music is stopped in the context menu we want to exit the wps */
if (retval == ONPLAY_MAINMENU
|| !audio_status())
Index: apps/menu.c
===================================================================
--- apps/menu.c (revision 25296)
+++ apps/menu.c (working copy)
@@ -61,6 +61,12 @@
#include "list.h"
#include "buttonbar.h"
+/* hotkey settings */
+#ifdef 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
@@ -426,6 +432,15 @@
done = true;
}
#endif
+#ifdef HOTKEY
+ else if ((action == ACTION_STD_HOTKEY) && hotkey_settable_menu)
+ {
+ 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)
{
ret = GO_TO_PREVIOUS_MUSIC;
Index: apps/settings.h
===================================================================
--- apps/settings.h (revision 25296)
+++ apps/settings.h (working copy)
@@ -816,6 +816,10 @@
bool morse_input; /* text input method setting */
#endif
+#ifdef HOTKEY
+ int hotkey_tree;
+#endif
+
};
/** global variables **/
Index: apps/onplay.h
===================================================================
--- apps/onplay.h (revision 25296)
+++ apps/onplay.h (working copy)
@@ -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,
Index: apps/settings_list.c
===================================================================
--- apps/settings_list.c (revision 25296)
+++ apps/settings_list.c (working copy)
@@ -1660,6 +1660,10 @@
#ifdef HAVE_MORSE_INPUT
OFFON_SETTING(0, morse_input, LANG_MORSE_INPUT, false, "morse input", NULL),
#endif
+
+#ifdef HOTKEY
+ CHOICE_SETTING(0, hotkey_tree, 0, 0, "hotkey tree", 0, NULL, 0),
+#endif
};
const int nb_settings = sizeof(settings)/sizeof(*settings);
Index: apps/features.txt
===================================================================
--- apps/features.txt (revision 25296)
+++ apps/features.txt (working copy)
@@ -70,6 +70,10 @@
remote_button_hold
#endif
+#if defined(HOTKEY)
+hotkey
+#endif
+
#if defined(HAVE_LCD_BITMAP)
lcd_bitmap
#endif
Index: apps/bookmark.c
===================================================================
--- apps/bookmark.c (revision 25296)
+++ apps/bookmark.c (working copy)
@@ -728,7 +728,12 @@
ID2P(LANG_BOOKMARK_CONTEXT_DELETE));
static const int menu_actions[] =
{
- ACTION_STD_OK, ACTION_BMS_DELETE
+ ACTION_STD_OK,
+#ifdef HOTKEY
+ ACTION_STD_HOTKEY
+#else
+ ACTION_BMS_DELETE
+#endif
};
int selection = do_menu(&menu_items, NULL, NULL, false);
@@ -757,7 +762,11 @@
exit = true;
break;
+#ifdef HOTKEY
+ case ACTION_STD_HOTKEY:
+#else
case ACTION_BMS_DELETE:
+#endif
if (item >= 0)
{
const char *lines[]={
Index: apps/root_menu.h
===================================================================
--- apps/root_menu.h (revision 25296)
+++ apps/root_menu.h (working copy)
@@ -53,6 +53,9 @@
GO_TO_BROWSEPLUGINS,
GO_TO_TIMESCREEN,
GO_TO_PLAYLIST_VIEWER,
+#ifdef HOTKEY
+ MENU_SELECTED_HOTKEY,
+#endif
};
extern const struct menu_item_ex root_menu_;
Index: apps/keymaps/keymap-e200.c
===================================================================
--- apps/keymaps/keymap-e200.c (revision 25296)
+++ apps/keymaps/keymap-e200.c (working copy)
@@ -48,6 +48,7 @@
{ ACTION_STD_QUICKSCREEN, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_DOWN },
{ ACTION_STD_CONTEXT, BUTTON_SELECT|BUTTON_REPEAT, BUTTON_SELECT },
+ { ACTION_STD_HOTKEY, BUTTON_REC|BUTTON_REL, BUTTON_REC },
LAST_ITEM_IN_LIST
}; /* button_context_standard */
@@ -272,12 +273,6 @@
LAST_ITEM_IN_LIST
}; /* button_context_keyboard */
-static const struct button_mapping button_context_bmark[] = {
- { ACTION_BMS_DELETE, BUTTON_REC, BUTTON_NONE },
-
- LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_LIST),
-}; /* button_context_bmark */
-
#ifdef USB_ENABLE_HID
static const struct button_mapping button_context_usb_hid[] = {
{ ACTION_USB_HID_MODE_SWITCH_NEXT, BUTTON_REC|BUTTON_REL, BUTTON_REC },
@@ -418,7 +413,7 @@
case CONTEXT_FM:
return button_context_radio;
case CONTEXT_BOOKMARKSCREEN:
- return button_context_bmark;
+ return button_context_list;
case CONTEXT_QUICKSCREEN:
return button_context_quickscreen;
case CONTEXT_PITCHSCREEN:
Index: apps/playlist_catalog.c
===================================================================
--- apps/playlist_catalog.c (revision 25296)
+++ apps/playlist_catalog.c (working copy)
@@ -281,7 +281,7 @@
sel_file);
if (onplay(playlist, FILE_ATTR_M3U,
- CONTEXT_TREE) != ONPLAY_OK)
+ CONTEXT_TREE, false) != ONPLAY_OK)
{
result = 0;
exit = true;
Index: firmware/export/config/sansae200.h
===================================================================
--- firmware/export/config/sansae200.h (revision 25296)
+++ firmware/export/config/sansae200.h (working copy)
@@ -214,3 +214,5 @@
#define IRAMORIG 0x40004000
#endif
+/* Define this if a programmable hotkey is available */
+#define HOTKEY