summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--apps/gui/option_select.c2
-rw-r--r--apps/gui/quickscreen.c4
-rw-r--r--apps/gui/skin_engine/skin_render.c2
-rw-r--r--apps/gui/skin_engine/skin_tokens.c32
-rw-r--r--apps/menu.c1
-rw-r--r--apps/misc.c17
-rw-r--r--apps/misc.h20
-rw-r--r--apps/radio/radio.c2
-rw-r--r--apps/recorder/recording.c3
-rw-r--r--apps/root_menu.c26
-rw-r--r--apps/root_menu.h2
-rw-r--r--manual/appendix/wps_tags.tex6
12 files changed, 74 insertions, 43 deletions
diff --git a/apps/gui/option_select.c b/apps/gui/option_select.c
index f954268c18..7f829d26c3 100644
--- a/apps/gui/option_select.c
+++ b/apps/gui/option_select.c
@@ -486,6 +486,7 @@ bool option_screen(const struct settings_list *setting,
temp_var = oldvalue = *(bool*)setting->setting?1:0;
}
else return false; /* only int/bools can go here */
+ push_current_activity(ACTIVITY_OPTIONSELECT);
gui_synclist_init(&lists, value_setting_get_name_cb,
(void*)setting, false, 1, parent);
if (setting->lang_id == -1)
@@ -566,6 +567,7 @@ bool option_screen(const struct settings_list *setting,
if (function == sound_get_fn(SOUND_VOLUME))
global_status.last_volume_change = current_tick;
}
+ pop_current_activity();
return false;
}
diff --git a/apps/gui/quickscreen.c b/apps/gui/quickscreen.c
index f03043d611..3922c94c4b 100644
--- a/apps/gui/quickscreen.c
+++ b/apps/gui/quickscreen.c
@@ -317,6 +317,9 @@ static bool gui_syncquickscreen_run(struct gui_quickscreen * qs, int button_ente
* - an action taken while pressing the enter button,
* then release the enter button*/
bool can_quit = false;
+
+ push_current_activity(ACTIVITY_QUICKSCREEN);
+
FOR_NB_SCREENS(i)
{
screens[i].set_viewport(NULL);
@@ -369,6 +372,7 @@ static bool gui_syncquickscreen_run(struct gui_quickscreen * qs, int button_ente
viewportmanager_theme_undo(i, true);
}
+ pop_current_activity();
return changed;
}
diff --git a/apps/gui/skin_engine/skin_render.c b/apps/gui/skin_engine/skin_render.c
index 3037a955c7..349dc07d0a 100644
--- a/apps/gui/skin_engine/skin_render.c
+++ b/apps/gui/skin_engine/skin_render.c
@@ -780,7 +780,7 @@ static __attribute__((noinline)) void skin_render_playlistviewer(struct playlist
int cur_pos, start_item, max;
int nb_lines = viewport_get_nb_lines(viewer->vp);
#if CONFIG_TUNER
- if (current_screen() == GO_TO_FM)
+ if (get_current_activity() == ACTIVITY_FM)
{
cur_pos = radio_current_preset();
start_item = cur_pos + viewer->start_offset;
diff --git a/apps/gui/skin_engine/skin_tokens.c b/apps/gui/skin_engine/skin_tokens.c
index 3aa7947edc..3c6a817ea8 100644
--- a/apps/gui/skin_engine/skin_tokens.c
+++ b/apps/gui/skin_engine/skin_tokens.c
@@ -1730,37 +1730,7 @@ const char *get_token_value(struct gui_wps *gwps,
case SKIN_TOKEN_CURRENT_SCREEN:
{
- int curr_screen = current_screen();
-
-#ifdef HAVE_RECORDING
- /* override current_screen() for recording screen since it may
- * be entered from the radio screen */
- if (in_recording_screen())
- curr_screen = GO_TO_RECSCREEN;
-#endif
-
- switch (curr_screen)
- {
- case GO_TO_WPS:
- curr_screen = 2;
- break;
-#ifdef HAVE_RECORDING
- case GO_TO_RECSCREEN:
- curr_screen = 3;
- break;
-#endif
-#if CONFIG_TUNER
- case GO_TO_FM:
- curr_screen = 4;
- break;
-#endif
- case GO_TO_PLAYLIST_VIEWER:
- curr_screen = 5;
- break;
- default: /* lists */
- curr_screen = 1;
- break;
- }
+ int curr_screen = get_current_activity();
if (intval)
{
*intval = curr_screen;
diff --git a/apps/menu.c b/apps/menu.c
index 8ea2f0883e..6a28b1de26 100644
--- a/apps/menu.c
+++ b/apps/menu.c
@@ -345,7 +345,6 @@ int do_menu(const struct menu_item_ex *start_menu, int *start_selected,
gui_buttonbar_set_display(&buttonbar, &(screens[SCREEN_MAIN]) );
gui_buttonbar_set(&buttonbar, "<<<", "", "");
#endif
-
menu_callback_type menu_callback = NULL;
/* if hide_theme is true, assume parent has been fixed before passed into
diff --git a/apps/misc.c b/apps/misc.c
index b027215ccc..5a99db2d8b 100644
--- a/apps/misc.c
+++ b/apps/misc.c
@@ -1021,3 +1021,20 @@ int clamp_value_wrap(int value, int max, int min)
}
#endif
#endif
+#define MAX_ACTIVITY_DEPTH 12
+static enum current_activity
+ current_activity[MAX_ACTIVITY_DEPTH] = {ACTIVITY_UNKNOWN};
+static int current_activity_top = 0;
+void push_current_activity(enum current_activity screen)
+{
+ current_activity[current_activity_top++] = screen;
+}
+void pop_current_activity(void)
+{
+ current_activity_top--;
+}
+enum current_activity get_current_activity(void)
+{
+ return current_activity[current_activity_top?current_activity_top-1:0];
+}
+
diff --git a/apps/misc.h b/apps/misc.h
index 1022af4e93..0fd408b941 100644
--- a/apps/misc.h
+++ b/apps/misc.h
@@ -100,4 +100,24 @@ int clamp_value_wrap(int value, int max, int min);
#endif
#endif
+enum current_activity {
+ ACTIVITY_UNKNOWN = 0,
+ ACTIVITY_MAINMENU,
+ ACTIVITY_WPS,
+ ACTIVITY_RECORDING,
+ ACTIVITY_FM,
+ ACTIVITY_PLAYLISTVIEWER,
+ ACTIVITY_SETTINGS,
+ ACTIVITY_FILEBROWSER,
+ ACTIVITY_DATABASEBROWSER,
+ ACTIVITY_PLUGINBROWSER,
+ ACTIVITY_QUICKSCREEN,
+ ACTIVITY_PITCHSCREEN,
+ ACTIVITY_OPTIONSELECT
+};
+void push_current_activity(enum current_activity screen);
+void pop_current_activity(void);
+enum current_activity get_current_activity(void);
+
+
#endif /* MISC_H */
diff --git a/apps/radio/radio.c b/apps/radio/radio.c
index 5c0b884cd1..4da37b2ca5 100644
--- a/apps/radio/radio.c
+++ b/apps/radio/radio.c
@@ -403,6 +403,7 @@ void radio_screen(void)
#endif
/* change status to "in screen" */
+ push_current_activity(ACTIVITY_FM);
in_screen = true;
if(radio_preset_count() <= 0)
@@ -868,6 +869,7 @@ void radio_screen(void)
cpu_idle_mode(false);
#endif
fms_fix_displays(FMS_EXIT);
+ pop_current_activity();
in_screen = false;
} /* radio_screen */
diff --git a/apps/recorder/recording.c b/apps/recorder/recording.c
index b4f7d25cf8..34283b6cb5 100644
--- a/apps/recorder/recording.c
+++ b/apps/recorder/recording.c
@@ -1108,6 +1108,7 @@ bool recording_screen(bool no_source)
struct audio_recording_options rec_options;
rec_status = RCSTAT_IN_RECSCREEN;
+ push_current_activity(ACTIVITY_RECORDING);
#if (CONFIG_STORAGE & STORAGE_ATA) && (CONFIG_LED == LED_REAL) \
&& !defined(SIMULATOR)
@@ -2089,7 +2090,7 @@ rec_abort:
#endif
settings_save();
-
+ pop_current_activity();
return (rec_status & RCSTAT_BEEN_IN_USB_MODE) != 0;
} /* recording_screen */
diff --git a/apps/root_menu.c b/apps/root_menu.c
index 76c081f775..bee1502781 100644
--- a/apps/root_menu.c
+++ b/apps/root_menu.c
@@ -151,6 +151,7 @@ static int browser(void* param)
#endif
strcpy(folder, last_folder);
}
+ push_current_activity(ACTIVITY_FILEBROWSER);
break;
#ifdef HAVE_TAGCACHE
case GO_TO_DBBROWSER:
@@ -246,12 +247,14 @@ static int browser(void* param)
filter = SHOW_ID3DB;
tc->dirlevel = last_db_dirlevel;
tc->selected_item = last_db_selection;
+ push_current_activity(ACTIVITY_DATABASEBROWSER);
break;
#endif
}
browse_context_init(&browse, filter, 0, NULL, NOICON, folder, NULL);
ret_val = rockbox_browse(&browse);
+ pop_current_activity();
switch ((intptr_t)param)
{
case GO_TO_FILEBROWSER:
@@ -285,6 +288,7 @@ static int wpsscrn(void* param)
{
int ret_val = GO_TO_PREVIOUS;
(void)param;
+ push_current_activity(ACTIVITY_WPS);
if (audio_status())
{
talk_shutup();
@@ -306,6 +310,7 @@ static int wpsscrn(void* param)
{
splash(HZ*2, ID2P(LANG_NOTHING_TO_RESUME));
}
+ pop_current_activity();
return ret_val;
}
#if CONFIG_TUNER
@@ -511,13 +516,27 @@ static inline int load_screen(int screen)
if we dont we will always return to the wrong screen on boot */
int old_previous = last_screen;
int ret_val;
+ enum current_activity activity = ACTIVITY_UNKNOWN;
if (screen <= GO_TO_ROOT)
return screen;
if (screen == old_previous)
old_previous = GO_TO_ROOT;
global_status.last_screen = (char)screen;
status_save();
+
+ if (screen == GO_TO_BROWSEPLUGINS)
+ activity = ACTIVITY_PLUGINBROWSER;
+ else if (screen == GO_TO_MAINMENU)
+ activity = ACTIVITY_SETTINGS;
+
+ if (activity != ACTIVITY_UNKNOWN)
+ push_current_activity(activity);
+
ret_val = items[screen].function(items[screen].param);
+
+ if (activity != ACTIVITY_UNKNOWN)
+ pop_current_activity();
+
last_screen = screen;
if (ret_val == GO_TO_PREVIOUS)
last_screen = old_previous;
@@ -578,15 +597,12 @@ void previous_music_is_wps(void)
previous_music = GO_TO_WPS;
}
-int current_screen(void)
-{
- return next_screen;
-}
-
void root_menu(void)
{
int previous_browser = GO_TO_FILEBROWSER;
int selected = 0;
+
+ push_current_activity(ACTIVITY_MAINMENU);
if (global_settings.start_in_screen == 0)
next_screen = (int)global_status.last_screen;
diff --git a/apps/root_menu.h b/apps/root_menu.h
index 3d18d18604..2ffdcedda1 100644
--- a/apps/root_menu.h
+++ b/apps/root_menu.h
@@ -64,6 +64,4 @@ extern const struct menu_item_ex root_menu_;
extern void previous_music_is_wps(void);
-extern int current_screen(void);
-
#endif /* __ROOT_MENU_H__ */
diff --git a/manual/appendix/wps_tags.tex b/manual/appendix/wps_tags.tex
index 46fad0c52e..67f1ff0aa1 100644
--- a/manual/appendix/wps_tags.tex
+++ b/manual/appendix/wps_tags.tex
@@ -266,8 +266,10 @@ Example: \config{\%?mp<Stop|Play|Pause|Ffwd|Rew|Rec|Rec pause|FM|FM pause>}
\section{Current Screen}
\begin{tagmap}
- \config{\%cs} & The current screen, 1-5, in the order:
- Menus, WPS, Recording screen, FM Radio screen, Current Playlist screen\\
+ \config{\%cs} & The current screen, 1-15, in the order:
+ Menus, WPS, Recording screen, FM Radio screen, Current Playlist screen,
+ Settings menus, File browser, Database, Plugins, Quickscreen,
+ Pitchscreen, Setting chooser\\
\end{tagmap}
The tag can also be used as the switch in a conditional tag. For players without
some capabilities (e.g. having no FM radio) some values will be never yielded.