summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorLinus Nielsen Feltzing <linus@haxx.se>2005-06-23 01:31:26 +0000
committerLinus Nielsen Feltzing <linus@haxx.se>2005-06-23 01:31:26 +0000
commit6e0436f65cd461bb2b21c9a0178dfa6978213d27 (patch)
treefdd57985a0dd04959d3d7e6856a02ddab1b6dc51 /apps
parent8b493fa6c4c2ef8245bf991daf350085d128729e (diff)
downloadrockbox-6e0436f65cd461bb2b21c9a0178dfa6978213d27.tar.gz
rockbox-6e0436f65cd461bb2b21c9a0178dfa6978213d27.zip
Henrik Backes patch for WPS and tag database context menus. Tag database context menus still don't work as expected. Hold Play/Select to pop up the menu.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@6835 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps')
-rw-r--r--apps/action.h1
-rw-r--r--apps/bookmark.c65
-rw-r--r--apps/bookmark.h3
-rw-r--r--apps/main_menu.c7
-rw-r--r--apps/onplay.c266
-rw-r--r--apps/onplay.h2
-rw-r--r--apps/playlist_menu.c24
-rw-r--r--apps/playlist_viewer.c3
-rw-r--r--apps/tree.c30
-rw-r--r--apps/wps.c15
-rw-r--r--apps/wps.h9
11 files changed, 281 insertions, 144 deletions
diff --git a/apps/action.h b/apps/action.h
index ef17185df2..3c3db7d54e 100644
--- a/apps/action.h
+++ b/apps/action.h
@@ -24,5 +24,6 @@
#define CONTEXT_TREE 2
#define CONTEXT_RECORD 3
#define CONTEXT_MAINMENU 4
+#define CONTEXT_ID3DB 5
#endif
diff --git a/apps/bookmark.c b/apps/bookmark.c
index d2911af39d..4afba78d14 100644
--- a/apps/bookmark.c
+++ b/apps/bookmark.c
@@ -53,7 +53,6 @@
#define RECENT_BOOKMARK_FILE ROCKBOX_DIR "/most-recent.bmark"
static bool add_bookmark(const char* bookmark_file_name, const char* bookmark);
-static bool bookmark_load_menu(void);
static bool check_bookmark(const char* bookmark);
static char* create_bookmark(void);
static bool delete_bookmark(const char* bookmark_file_name, int bookmark_id);
@@ -87,38 +86,6 @@ static char global_bookmark[MAX_BOOKMARK_SIZE];
static char global_filename[MAX_PATH];
/* ----------------------------------------------------------------------- */
-/* Displays the bookmark menu options for the user to decide. This is an */
-/* interface function. */
-/* ----------------------------------------------------------------------- */
-bool bookmark_menu(void)
-{
- int m;
- bool result;
-
- static const struct menu_item items[] = {
- { ID2P(LANG_BOOKMARK_MENU_CREATE), bookmark_create_menu},
- { ID2P(LANG_BOOKMARK_MENU_LIST), bookmark_load_menu},
- { ID2P(LANG_BOOKMARK_MENU_RECENT_BOOKMARKS), bookmark_mrb_load},
- };
-
- m=menu_init( items, sizeof items / sizeof(struct menu_item), NULL,
- NULL, NULL, NULL);
-
-#ifdef HAVE_LCD_CHARCELLS
- status_set_param(true);
-#endif
- result = menu_run(m);
-#ifdef HAVE_LCD_CHARCELLS
- status_set_param(false);
-#endif
- menu_exit(m);
-
- settings_save();
-
- return result;
-}
-
-/* ----------------------------------------------------------------------- */
/* This is the interface function from the main menu. */
/* ----------------------------------------------------------------------- */
bool bookmark_create_menu(void)
@@ -133,7 +100,7 @@ bool bookmark_create_menu(void)
/* for the user. The user can then select a bookmark to load. */
/* If no file/directory is currently playing, the menu item does not work. */
/* ----------------------------------------------------------------------- */
-static bool bookmark_load_menu(void)
+bool bookmark_load_menu(void)
{
bool success = true;
int offset;
@@ -628,6 +595,8 @@ static char* select_bookmark(const char* bookmark_file_name)
int bookmark_count = 0;
#ifdef HAVE_LCD_BITMAP
+ int x = lcd_getxmargin();
+ int y = lcd_getymargin();
lcd_setmargins(0, 0);
#endif
@@ -712,6 +681,9 @@ static char* select_bookmark(const char* bookmark_file_name)
#ifdef SETTINGS_OK2
case SETTINGS_OK2:
#endif
+#ifdef HAVE_LCD_BITMAP
+ lcd_setmargins(x, y);
+#endif
return NULL;
default:
@@ -1142,6 +1114,31 @@ static bool generate_bookmark_file_name(const char *in)
}
/* ----------------------------------------------------------------------- */
+/* Returns the bookmark name for the current playlist */
+/* ----------------------------------------------------------------------- */
+bool bookmark_exist(void)
+{
+ bool exist=false;
+
+ if(system_check())
+ {
+ char* name = playlist_get_name(NULL, global_temp_buffer,
+ sizeof(global_temp_buffer));
+ if (generate_bookmark_file_name(name))
+ {
+ int fd=open(global_bookmark_file_name, O_RDONLY);
+ if (fd >=0)
+ {
+ close(fd);
+ exist=true;
+ }
+ }
+ }
+
+ return exist;
+}
+
+/* ----------------------------------------------------------------------- */
/* Checks the current state of the system and returns if it is in a */
/* bookmarkable state. */
/* ----------------------------------------------------------------------- */
diff --git a/apps/bookmark.h b/apps/bookmark.h
index c5fe6fe7ba..16f4e5609f 100644
--- a/apps/bookmark.h
+++ b/apps/bookmark.h
@@ -21,7 +21,7 @@
#include <stdbool.h>
-bool bookmark_menu(void);
+bool bookmark_load_menu(void);
bool bookmark_autobookmark(void);
bool bookmark_create_menu(void);
bool bookmark_mrb_load(void);
@@ -29,6 +29,7 @@ bool bookmark_autoload(const char* file);
bool bookmark_load(const char* file, bool autoload);
void bookmark_play(char* resume_file, int index, int offset, int seed,
char *filename);
+bool bookmark_exist(void);
#endif /* __BOOKMARK_H__ */
diff --git a/apps/main_menu.c b/apps/main_menu.c
index 88599a8705..33e9269a8a 100644
--- a/apps/main_menu.c
+++ b/apps/main_menu.c
@@ -32,7 +32,6 @@
#include "debug_menu.h"
#include "sprintf.h"
#include <string.h>
-#include "playlist.h"
#include "settings.h"
#include "settings_menu.h"
#include "power.h"
@@ -41,7 +40,6 @@
#include "status.h"
#include "fat.h"
#include "bookmark.h"
-#include "wps.h"
#include "buffer.h"
#include "screens.h"
#include "playlist_menu.h"
@@ -342,7 +340,6 @@ bool info_menu(void)
/* info menu */
static const struct menu_item items[] = {
- { ID2P(LANG_MENU_SHOW_ID3_INFO), browse_id3 },
{ ID2P(LANG_INFO_MENU), show_info },
{ ID2P(LANG_VERSION), show_credits },
#ifndef SIMULATOR
@@ -373,8 +370,8 @@ bool main_menu(void)
/* main menu */
struct menu_item items[9];
- items[i].desc = ID2P(LANG_BOOKMARK_MENU);
- items[i++].function = bookmark_menu;
+ items[i].desc = ID2P(LANG_BOOKMARK_MENU_RECENT_BOOKMARKS);
+ items[i++].function = bookmark_mrb_load;
items[i].desc = ID2P(LANG_SOUND_SETTINGS);
items[i++].function = sound_menu;
diff --git a/apps/onplay.c b/apps/onplay.c
index 78562c5bec..f686533324 100644
--- a/apps/onplay.c
+++ b/apps/onplay.c
@@ -45,11 +45,68 @@
#include "onplay.h"
#include "filetypes.h"
#include "plugin.h"
+#include "bookmark.h"
+#include "wps.h"
+#include "action.h"
+#ifdef HAVE_LCD_BITMAP
+#include "icons.h"
+#endif
+#define DEFAULT_PLAYLIST_NAME "/dynamic.m3u"
+
+static int context;
static char* selected_file = NULL;
static int selected_file_attr = 0;
static int onplay_result = ONPLAY_OK;
+/* For playlist options */
+struct playlist_args {
+ int position;
+ bool queue;
+};
+
+/* ----------------------------------------------------------------------- */
+/* Displays the bookmark menu options for the user to decide. This is an */
+/* interface function. */
+/* ----------------------------------------------------------------------- */
+bool bookmark_menu(void)
+{
+ int i,m;
+ bool result;
+ struct menu_item items[3];
+
+ i=0;
+
+ if ((audio_status() & AUDIO_STATUS_PLAY))
+ {
+ items[i].desc = ID2P(LANG_BOOKMARK_MENU_CREATE);
+ items[i].function = bookmark_create_menu;
+ i++;
+
+ if (bookmark_exist())
+ {
+ items[i].desc = ID2P(LANG_BOOKMARK_MENU_LIST);
+ items[i].function = bookmark_load_menu;
+ i++;
+ }
+ }
+
+ m=menu_init( items, i, NULL, NULL, NULL, NULL );
+
+#ifdef HAVE_LCD_CHARCELLS
+ status_set_param(true);
+#endif
+ result = menu_run(m);
+#ifdef HAVE_LCD_CHARCELLS
+ status_set_param(false);
+#endif
+ menu_exit(m);
+
+ settings_save();
+
+ return result;
+}
+
static bool list_viewers(void)
{
struct menu_item menu[16];
@@ -70,17 +127,28 @@ static bool list_viewers(void)
splash(HZ*2, true, "No viewers found");
}
- if(ret == PLUGIN_USB_CONNECTED)
- onplay_result = ONPLAY_RELOAD_DIR;
+ if (ret == PLUGIN_USB_CONNECTED)
+ onplay_result = ONPLAY_RELOAD_DIR;
return false;
}
-/* For playlist options */
-struct playlist_args {
- int position;
- bool queue;
-};
+static bool save_playlist(void)
+{
+ char filename[MAX_PATH+1];
+
+ strncpy(filename, DEFAULT_PLAYLIST_NAME, sizeof(filename));
+
+ if (!kbd_input(filename, sizeof(filename)))
+ {
+ playlist_save(NULL, filename);
+
+ /* reload in case playlist was saved to cwd */
+ onplay_result = ONPLAY_RELOAD_DIR;
+ }
+
+ return false;
+}
static bool add_to_playlist(int position, bool queue)
{
@@ -168,12 +236,13 @@ static bool view_playlist(void)
/* Sub-menu for playlist options */
static bool playlist_options(void)
{
- struct menu_item items[7];
- struct playlist_args args[7]; /* increase these 2 if you add entries! */
+ struct menu_item items[10];
+ struct playlist_args args[10]; /* increase these 2 if you add entries! */
int m, i=0, pstart=0, result;
bool ret = false;
- if ((selected_file_attr & TREE_ATTR_MASK) == TREE_ATTR_M3U)
+ if ((selected_file_attr & TREE_ATTR_MASK) == TREE_ATTR_M3U &&
+ context == CONTEXT_TREE)
{
items[i].desc = ID2P(LANG_VIEW);
items[i].function = view_playlist;
@@ -183,43 +252,64 @@ static bool playlist_options(void)
if (audio_status() & AUDIO_STATUS_PLAY)
{
- items[i].desc = ID2P(LANG_INSERT);
- args[i].position = PLAYLIST_INSERT;
- args[i].queue = false;
- i++;
-
- items[i].desc = ID2P(LANG_INSERT_FIRST);
- args[i].position = PLAYLIST_INSERT_FIRST;
- args[i].queue = false;
- i++;
-
- items[i].desc = ID2P(LANG_INSERT_LAST);
- args[i].position = PLAYLIST_INSERT_LAST;
- args[i].queue = false;
- i++;
-
- items[i].desc = ID2P(LANG_QUEUE);
- args[i].position = PLAYLIST_INSERT;
- args[i].queue = true;
- i++;
-
- items[i].desc = ID2P(LANG_QUEUE_FIRST);
- args[i].position = PLAYLIST_INSERT_FIRST;
- args[i].queue = true;
+ items[i].desc = ID2P(LANG_VIEW_DYNAMIC_PLAYLIST);
+ items[i].function = playlist_viewer;
i++;
+ pstart++;
- items[i].desc = ID2P(LANG_QUEUE_LAST);
- args[i].position = PLAYLIST_INSERT_LAST;
- args[i].queue = true;
+ items[i].desc = ID2P(LANG_SAVE_DYNAMIC_PLAYLIST);
+ items[i].function = save_playlist;
i++;
+ pstart++;
}
- else if (((selected_file_attr & TREE_ATTR_MASK) == TREE_ATTR_MPA) ||
- (selected_file_attr & ATTR_DIRECTORY))
+
+ if (context == CONTEXT_TREE)
{
- items[i].desc = ID2P(LANG_INSERT);
- args[i].position = PLAYLIST_INSERT;
- args[i].queue = false;
+ items[i].desc = ID2P(LANG_CREATE_PLAYLIST);
+ items[i].function = create_playlist;
i++;
+ pstart++;
+
+ if (audio_status() & AUDIO_STATUS_PLAY)
+ {
+ items[i].desc = ID2P(LANG_INSERT);
+ args[i].position = PLAYLIST_INSERT;
+ args[i].queue = false;
+ i++;
+
+ items[i].desc = ID2P(LANG_INSERT_FIRST);
+ args[i].position = PLAYLIST_INSERT_FIRST;
+ args[i].queue = false;
+ i++;
+
+ items[i].desc = ID2P(LANG_INSERT_LAST);
+ args[i].position = PLAYLIST_INSERT_LAST;
+ args[i].queue = false;
+ i++;
+
+ items[i].desc = ID2P(LANG_QUEUE);
+ args[i].position = PLAYLIST_INSERT;
+ args[i].queue = true;
+ i++;
+
+ items[i].desc = ID2P(LANG_QUEUE_FIRST);
+ args[i].position = PLAYLIST_INSERT_FIRST;
+ args[i].queue = true;
+ i++;
+
+ items[i].desc = ID2P(LANG_QUEUE_LAST);
+ args[i].position = PLAYLIST_INSERT_LAST;
+ args[i].queue = true;
+ i++;
+ }
+ else if (((selected_file_attr & TREE_ATTR_MASK) == TREE_ATTR_MPA) ||
+ (selected_file_attr & ATTR_DIRECTORY))
+ {
+ items[i].desc = ID2P(LANG_INSERT);
+ args[i].position = PLAYLIST_INSERT;
+ args[i].queue = false;
+ i++;
+ }
}
m = menu_init( items, i, NULL, NULL, NULL, NULL );
@@ -385,11 +475,11 @@ bool create_dir(void)
pathlen = strlen(dirname);
rc = kbd_input(dirname + pathlen, (sizeof dirname)-pathlen);
- if(rc < 0)
+ if (rc < 0)
return false;
rc = mkdir(dirname, 0);
- if(rc < 0) {
+ if (rc < 0) {
splash(HZ, true, "%s %s", str(LANG_CREATE_DIR), str(LANG_FAILED));
} else {
onplay_result = ONPLAY_RELOAD_DIR;
@@ -398,24 +488,38 @@ bool create_dir(void)
return true;
}
-int onplay(char* file, int attr)
+int onplay(char* file, int attr, int from)
{
- struct menu_item items[6]; /* increase this if you add entries! */
+ struct menu_item items[8]; /* increase this if you add entries! */
int m, i=0, result;
onplay_result = ONPLAY_OK;
+ context=from;
+ selected_file = file;
+ selected_file_attr = attr;
- if(file)
+ if (context == CONTEXT_WPS ||
+ context == CONTEXT_TREE ||
+ context == CONTEXT_ID3DB)
{
- selected_file = file;
- selected_file_attr = attr;
-
- if (((attr & TREE_ATTR_MASK) == TREE_ATTR_MPA) ||
- (attr & ATTR_DIRECTORY) ||
- ((attr & TREE_ATTR_MASK) == TREE_ATTR_M3U))
+ if ((audio_status() & AUDIO_STATUS_PLAY))
+ {
+ items[i].desc = ID2P(LANG_BOOKMARK_MENU);
+ items[i].function = bookmark_menu;
+ i++;
+ }
+
+ items[i].desc = ID2P(LANG_PLAYLIST);
+ items[i].function = playlist_options;
+ i++;
+ }
+
+ if (file)
+ {
+ if (context == CONTEXT_WPS)
{
- items[i].desc = ID2P(LANG_PLAYLIST);
- items[i].function = playlist_options;
+ items[i].desc = ID2P(LANG_MENU_SHOW_ID3_INFO);
+ items[i].function = browse_id3;
i++;
}
@@ -423,11 +527,14 @@ int onplay(char* file, int attr)
if (!(attr & ATTR_VOLUME)) /* no rename+delete for volumes */
#endif
{
- items[i].desc = ID2P(LANG_RENAME);
- items[i].function = rename_file;
- i++;
-
- if (!(attr & ATTR_DIRECTORY))
+ if (context == CONTEXT_TREE)
+ {
+ items[i].desc = ID2P(LANG_RENAME);
+ items[i].function = rename_file;
+ i++;
+ }
+
+ if (!(attr & ATTR_DIRECTORY) && context == CONTEXT_TREE)
{
items[i].desc = ID2P(LANG_DELETE);
items[i].function = delete_file;
@@ -435,13 +542,16 @@ int onplay(char* file, int attr)
}
else
{
- items[i].desc = ID2P(LANG_DELETE_DIR);
- items[i].function = delete_dir;
- i++;
+ if (context == CONTEXT_TREE)
+ {
+ items[i].desc = ID2P(LANG_DELETE_DIR);
+ items[i].function = delete_dir;
+ i++;
+ }
}
}
- if (!(attr & ATTR_DIRECTORY))
+ if (!(attr & ATTR_DIRECTORY) && attr)
{
items[i].desc = ID2P(LANG_ONPLAY_OPEN_WITH);
items[i].function = list_viewers;
@@ -449,16 +559,30 @@ int onplay(char* file, int attr)
}
}
- items[i].desc = ID2P(LANG_CREATE_DIR);
- items[i].function = create_dir;
- i++;
+ if (context == CONTEXT_TREE)
+ {
+ items[i].desc = ID2P(LANG_CREATE_DIR);
+ items[i].function = create_dir;
+ i++;
+ }
/* DIY menu handling, since we want to exit after selection */
- m = menu_init( items, i, NULL, NULL, NULL, NULL );
- result = menu_show(m);
- if (result >= 0)
- items[result].function();
- menu_exit(m);
+ button_clear_queue();
+ if (i)
+ {
+ m = menu_init( items, i, NULL, NULL, NULL, NULL );
+ result = menu_show(m);
+ if (result >= 0)
+ items[result].function();
+ menu_exit(m);
+
+#ifdef HAVE_LCD_BITMAP
+ if (global_settings.statusbar)
+ lcd_setmargins(0, STATUSBAR_HEIGHT);
+ else
+ lcd_setmargins(0, 0);
+#endif
+ }
return onplay_result;
}
diff --git a/apps/onplay.h b/apps/onplay.h
index 7b47479e4b..08737becca 100644
--- a/apps/onplay.h
+++ b/apps/onplay.h
@@ -19,7 +19,7 @@
#ifndef _ONPLAY_H_
#define _ONPLAY_H_
-int onplay(char* file, int attr);
+int onplay(char* file, int attr, int from_screen);
enum {
ONPLAY_OK,
diff --git a/apps/playlist_menu.c b/apps/playlist_menu.c
index 3497b1d54d..444e0ae3d2 100644
--- a/apps/playlist_menu.c
+++ b/apps/playlist_menu.c
@@ -20,34 +20,13 @@
#include <string.h>
#include "menu.h"
-#include "file.h"
#include "keyboard.h"
#include "playlist.h"
#include "tree.h"
#include "settings.h"
-#include "playlist_viewer.h"
#include "talk.h"
#include "lang.h"
-#define DEFAULT_PLAYLIST_NAME "/dynamic.m3u"
-
-static bool save_playlist(void)
-{
- char filename[MAX_PATH+1];
-
- strncpy(filename, DEFAULT_PLAYLIST_NAME, sizeof(filename));
-
- if (!kbd_input(filename, sizeof(filename)))
- {
- playlist_save(NULL, filename);
-
- /* reload in case playlist was saved to cwd */
- reload_directory();
- }
-
- return false;
-}
-
static bool recurse_directory(void)
{
static const struct opt_items names[] = {
@@ -67,9 +46,6 @@ bool playlist_menu(void)
bool result;
static const struct menu_item items[] = {
- { ID2P(LANG_CREATE_PLAYLIST), create_playlist },
- { ID2P(LANG_VIEW_DYNAMIC_PLAYLIST), playlist_viewer },
- { ID2P(LANG_SAVE_DYNAMIC_PLAYLIST), save_playlist },
{ ID2P(LANG_RECURSE_DIRECTORY), recurse_directory },
};
diff --git a/apps/playlist_viewer.c b/apps/playlist_viewer.c
index 64d57d7d2e..8b517b686d 100644
--- a/apps/playlist_viewer.c
+++ b/apps/playlist_viewer.c
@@ -33,6 +33,7 @@
#include "onplay.h"
#include "talk.h"
#include "misc.h"
+#include "action.h"
#ifdef HAVE_LCD_BITMAP
#include "widgets.h"
@@ -728,7 +729,7 @@ static int onplay_menu(int index)
break;
case 2:
{
- onplay(tracks[index].name, TREE_ATTR_MPA);
+ onplay(tracks[index].name, TREE_ATTR_MPA, CONTEXT_TREE);
if (!viewer.playlist)
ret = 1;
diff --git a/apps/tree.c b/apps/tree.c
index 1332fc07ba..344088d12a 100644
--- a/apps/tree.c
+++ b/apps/tree.c
@@ -110,6 +110,7 @@ static bool reload_dir = false;
static bool start_wps = false;
static bool dirbrowse(void);
+static int curr_context = false;
bool check_rockboxdir(void)
{
@@ -625,10 +626,14 @@ static bool check_changed_id3mode(bool currmode)
if (currmode != (global_settings.dirfilter == SHOW_ID3DB)) {
currmode = global_settings.dirfilter == SHOW_ID3DB;
if (currmode) {
+ curr_context=CONTEXT_ID3DB;
db_load(&tc);
}
else
+ {
+ curr_context=CONTEXT_TREE;
ft_load(&tc, NULL);
+ }
}
return currmode;
}
@@ -660,6 +665,11 @@ static bool dirbrowse(void)
char* currdir = tc.currdir; /* just a shortcut */
bool id3db = *tc.dirfilter == SHOW_ID3DB;
+ if (id3db)
+ curr_context=CONTEXT_ID3DB;
+ else
+ curr_context=CONTEXT_TREE;
+
#ifdef HAVE_LCD_BITMAP
tree_max_on_screen = recalc_screen_height();
#else
@@ -1059,7 +1069,7 @@ static bool dirbrowse(void)
/* don't enter f2 from plugin browser */
if (*tc.dirfilter < NUM_FILTER_MODES)
{
- if (quick_screen(CONTEXT_TREE, BUTTON_F2))
+ if (quick_screen(curr_context, BUTTON_F2))
reload_dir = true;
restore = true;
@@ -1071,7 +1081,7 @@ static bool dirbrowse(void)
/* don't enter f3 from plugin browser */
if (*tc.dirfilter < NUM_FILTER_MODES)
{
- if (quick_screen(CONTEXT_TREE, BUTTON_F3))
+ if (quick_screen(curr_context, BUTTON_F3))
reload_dir = true;
tree_max_on_screen = recalc_screen_height();
restore = true;
@@ -1091,7 +1101,7 @@ static bool dirbrowse(void)
int attr = 0;
if(!numentries)
- onplay_result = onplay(NULL, 0);
+ onplay_result = onplay(NULL, 0, curr_context);
else {
if (currdir[1])
snprintf(buf, sizeof buf, "%s/%s",
@@ -1099,9 +1109,19 @@ static bool dirbrowse(void)
else
snprintf(buf, sizeof buf, "/%s",
dircache[tc.dircursor+tc.dirstart].name);
- if (!id3db)
+ if (id3db)
+ switch (tc.currtable)
+ {
+ case allsongs:
+ case songs4album:
+ case songs4artist:
+ case searchsongs:
+ attr=TREE_ATTR_MPA;
+ break;
+ }
+ else
attr = dircache[tc.dircursor+tc.dirstart].attr;
- onplay_result = onplay(buf, attr);
+ onplay_result = onplay(buf, attr, curr_context);
}
switch (onplay_result)
diff --git a/apps/wps.c b/apps/wps.c
index 3934f2483f..d6b068cd58 100644
--- a/apps/wps.c
+++ b/apps/wps.c
@@ -50,6 +50,7 @@
#include "bookmark.h"
#include "misc.h"
#include "sound.h"
+#include "onplay.h"
#define FF_REWIND_MAX_PERCENT 3 /* cap ff/rewind step size at max % of file */
/* 3% of 30min file == 54s step size */
@@ -472,6 +473,12 @@ long wps_show(void)
switch(button)
{
+#ifdef WPS_CONTEXT
+ case WPS_CONTEXT:
+ onplay(id3->path, TREE_ATTR_MPA, CONTEXT_WPS);
+ restore = true;
+ break;
+#endif
#ifdef WPS_RC_BROWSE
case WPS_RC_BROWSE:
#endif
@@ -503,6 +510,14 @@ long wps_show(void)
#ifdef WPS_RC_PAUSE
case WPS_RC_PAUSE:
#endif
+#ifdef WPS_PAUSE_PRE
+ if ((lastbutton != WPS_PAUSE_PRE)
+#ifdef WPS_RC_PAUSE_PRE
+ && (lastbutton != WPS_RC_PAUSE_PRE)
+#endif
+ )
+ break;
+#endif
if ( paused )
{
paused = false;
diff --git a/apps/wps.h b/apps/wps.h
index 2a1826aaa8..2af2c72ef3 100644
--- a/apps/wps.h
+++ b/apps/wps.h
@@ -38,6 +38,7 @@
#define WPS_BROWSE_PRE BUTTON_SELECT
#define WPS_EXIT BUTTON_OFF
#define WPS_ID3 (BUTTON_MODE | BUTTON_ON)
+#define WPS_CONTEXT (BUTTON_SELECT | BUTTON_REPEAT)
#define WPS_RC_NEXT BUTTON_RC_FF
#define WPS_RC_PREV BUTTON_RC_REW
@@ -59,7 +60,8 @@
#define WPS_REW (BUTTON_LEFT | BUTTON_REPEAT)
#define WPS_INCVOL BUTTON_UP
#define WPS_DECVOL BUTTON_DOWN
-#define WPS_PAUSE BUTTON_PLAY
+#define WPS_PAUSE_PRE BUTTON_PLAY
+#define WPS_PAUSE (BUTTON_PLAY | BUTTON_REL)
#define WPS_MENU (BUTTON_F1 | BUTTON_REL)
#define WPS_MENU_PRE BUTTON_F1
#define WPS_BROWSE (BUTTON_ON | BUTTON_REL)
@@ -67,6 +69,7 @@
#define WPS_EXIT BUTTON_OFF
#define WPS_KEYLOCK (BUTTON_F1 | BUTTON_DOWN)
#define WPS_ID3 (BUTTON_F1 | BUTTON_ON)
+#define WPS_CONTEXT (BUTTON_PLAY | BUTTON_REPEAT)
#define WPS_RC_NEXT BUTTON_RC_RIGHT
#define WPS_RC_PREV BUTTON_RC_LEFT
@@ -84,7 +87,8 @@
#define WPS_REW (BUTTON_LEFT | BUTTON_REPEAT)
#define WPS_INCVOL (BUTTON_MENU | BUTTON_RIGHT)
#define WPS_DECVOL (BUTTON_MENU | BUTTON_LEFT)
-#define WPS_PAUSE BUTTON_PLAY
+#define WPS_PAUSE_PRE BUTTON_PLAY
+#define WPS_PAUSE (BUTTON_PLAY | BUTTON_REL)
#define WPS_MENU (BUTTON_MENU | BUTTON_REL)
#define WPS_MENU_PRE BUTTON_MENU
#define WPS_BROWSE (BUTTON_ON | BUTTON_REL)
@@ -92,6 +96,7 @@
#define WPS_EXIT BUTTON_STOP
#define WPS_KEYLOCK (BUTTON_MENU | BUTTON_STOP)
#define WPS_ID3 (BUTTON_MENU | BUTTON_ON)
+#define WPS_CONTEXT (BUTTON_PLAY | BUTTON_REPEAT)
#define WPS_RC_NEXT BUTTON_RC_RIGHT
#define WPS_RC_PREV BUTTON_RC_LEFT