summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
Diffstat (limited to 'apps')
-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
11 files changed, 70 insertions, 41 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,
486 temp_var = oldvalue = *(bool*)setting->setting?1:0; 486 temp_var = oldvalue = *(bool*)setting->setting?1:0;
487 } 487 }
488 else return false; /* only int/bools can go here */ 488 else return false; /* only int/bools can go here */
489 push_current_activity(ACTIVITY_OPTIONSELECT);
489 gui_synclist_init(&lists, value_setting_get_name_cb, 490 gui_synclist_init(&lists, value_setting_get_name_cb,
490 (void*)setting, false, 1, parent); 491 (void*)setting, false, 1, parent);
491 if (setting->lang_id == -1) 492 if (setting->lang_id == -1)
@@ -566,6 +567,7 @@ bool option_screen(const struct settings_list *setting,
566 if (function == sound_get_fn(SOUND_VOLUME)) 567 if (function == sound_get_fn(SOUND_VOLUME))
567 global_status.last_volume_change = current_tick; 568 global_status.last_volume_change = current_tick;
568 } 569 }
570 pop_current_activity();
569 return false; 571 return false;
570} 572}
571 573
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
317 * - an action taken while pressing the enter button, 317 * - an action taken while pressing the enter button,
318 * then release the enter button*/ 318 * then release the enter button*/
319 bool can_quit = false; 319 bool can_quit = false;
320
321 push_current_activity(ACTIVITY_QUICKSCREEN);
322
320 FOR_NB_SCREENS(i) 323 FOR_NB_SCREENS(i)
321 { 324 {
322 screens[i].set_viewport(NULL); 325 screens[i].set_viewport(NULL);
@@ -369,6 +372,7 @@ static bool gui_syncquickscreen_run(struct gui_quickscreen * qs, int button_ente
369 viewportmanager_theme_undo(i, true); 372 viewportmanager_theme_undo(i, true);
370 } 373 }
371 374
375 pop_current_activity();
372 return changed; 376 return changed;
373} 377}
374 378
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
780 int cur_pos, start_item, max; 780 int cur_pos, start_item, max;
781 int nb_lines = viewport_get_nb_lines(viewer->vp); 781 int nb_lines = viewport_get_nb_lines(viewer->vp);
782#if CONFIG_TUNER 782#if CONFIG_TUNER
783 if (current_screen() == GO_TO_FM) 783 if (get_current_activity() == ACTIVITY_FM)
784 { 784 {
785 cur_pos = radio_current_preset(); 785 cur_pos = radio_current_preset();
786 start_item = cur_pos + viewer->start_offset; 786 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,
1730 1730
1731 case SKIN_TOKEN_CURRENT_SCREEN: 1731 case SKIN_TOKEN_CURRENT_SCREEN:
1732 { 1732 {
1733 int curr_screen = current_screen(); 1733 int curr_screen = get_current_activity();
1734
1735#ifdef HAVE_RECORDING
1736 /* override current_screen() for recording screen since it may
1737 * be entered from the radio screen */
1738 if (in_recording_screen())
1739 curr_screen = GO_TO_RECSCREEN;
1740#endif
1741
1742 switch (curr_screen)
1743 {
1744 case GO_TO_WPS:
1745 curr_screen = 2;
1746 break;
1747#ifdef HAVE_RECORDING
1748 case GO_TO_RECSCREEN:
1749 curr_screen = 3;
1750 break;
1751#endif
1752#if CONFIG_TUNER
1753 case GO_TO_FM:
1754 curr_screen = 4;
1755 break;
1756#endif
1757 case GO_TO_PLAYLIST_VIEWER:
1758 curr_screen = 5;
1759 break;
1760 default: /* lists */
1761 curr_screen = 1;
1762 break;
1763 }
1764 if (intval) 1734 if (intval)
1765 { 1735 {
1766 *intval = curr_screen; 1736 *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,
345 gui_buttonbar_set_display(&buttonbar, &(screens[SCREEN_MAIN]) ); 345 gui_buttonbar_set_display(&buttonbar, &(screens[SCREEN_MAIN]) );
346 gui_buttonbar_set(&buttonbar, "<<<", "", ""); 346 gui_buttonbar_set(&buttonbar, "<<<", "", "");
347#endif 347#endif
348
349 menu_callback_type menu_callback = NULL; 348 menu_callback_type menu_callback = NULL;
350 349
351 /* if hide_theme is true, assume parent has been fixed before passed into 350 /* 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)
1021} 1021}
1022#endif 1022#endif
1023#endif 1023#endif
1024#define MAX_ACTIVITY_DEPTH 12
1025static enum current_activity
1026 current_activity[MAX_ACTIVITY_DEPTH] = {ACTIVITY_UNKNOWN};
1027static int current_activity_top = 0;
1028void push_current_activity(enum current_activity screen)
1029{
1030 current_activity[current_activity_top++] = screen;
1031}
1032void pop_current_activity(void)
1033{
1034 current_activity_top--;
1035}
1036enum current_activity get_current_activity(void)
1037{
1038 return current_activity[current_activity_top?current_activity_top-1:0];
1039}
1040
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);
100#endif 100#endif
101#endif 101#endif
102 102
103enum current_activity {
104 ACTIVITY_UNKNOWN = 0,
105 ACTIVITY_MAINMENU,
106 ACTIVITY_WPS,
107 ACTIVITY_RECORDING,
108 ACTIVITY_FM,
109 ACTIVITY_PLAYLISTVIEWER,
110 ACTIVITY_SETTINGS,
111 ACTIVITY_FILEBROWSER,
112 ACTIVITY_DATABASEBROWSER,
113 ACTIVITY_PLUGINBROWSER,
114 ACTIVITY_QUICKSCREEN,
115 ACTIVITY_PITCHSCREEN,
116 ACTIVITY_OPTIONSELECT
117};
118void push_current_activity(enum current_activity screen);
119void pop_current_activity(void);
120enum current_activity get_current_activity(void);
121
122
103#endif /* MISC_H */ 123#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)
403#endif 403#endif
404 404
405 /* change status to "in screen" */ 405 /* change status to "in screen" */
406 push_current_activity(ACTIVITY_FM);
406 in_screen = true; 407 in_screen = true;
407 408
408 if(radio_preset_count() <= 0) 409 if(radio_preset_count() <= 0)
@@ -868,6 +869,7 @@ void radio_screen(void)
868 cpu_idle_mode(false); 869 cpu_idle_mode(false);
869#endif 870#endif
870 fms_fix_displays(FMS_EXIT); 871 fms_fix_displays(FMS_EXIT);
872 pop_current_activity();
871 in_screen = false; 873 in_screen = false;
872} /* radio_screen */ 874} /* radio_screen */
873 875
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)
1108 1108
1109 struct audio_recording_options rec_options; 1109 struct audio_recording_options rec_options;
1110 rec_status = RCSTAT_IN_RECSCREEN; 1110 rec_status = RCSTAT_IN_RECSCREEN;
1111 push_current_activity(ACTIVITY_RECORDING);
1111 1112
1112#if (CONFIG_STORAGE & STORAGE_ATA) && (CONFIG_LED == LED_REAL) \ 1113#if (CONFIG_STORAGE & STORAGE_ATA) && (CONFIG_LED == LED_REAL) \
1113 && !defined(SIMULATOR) 1114 && !defined(SIMULATOR)
@@ -2089,7 +2090,7 @@ rec_abort:
2089#endif 2090#endif
2090 2091
2091 settings_save(); 2092 settings_save();
2092 2093 pop_current_activity();
2093 return (rec_status & RCSTAT_BEEN_IN_USB_MODE) != 0; 2094 return (rec_status & RCSTAT_BEEN_IN_USB_MODE) != 0;
2094} /* recording_screen */ 2095} /* recording_screen */
2095 2096
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)
151#endif 151#endif
152 strcpy(folder, last_folder); 152 strcpy(folder, last_folder);
153 } 153 }
154 push_current_activity(ACTIVITY_FILEBROWSER);
154 break; 155 break;
155#ifdef HAVE_TAGCACHE 156#ifdef HAVE_TAGCACHE
156 case GO_TO_DBBROWSER: 157 case GO_TO_DBBROWSER:
@@ -246,12 +247,14 @@ static int browser(void* param)
246 filter = SHOW_ID3DB; 247 filter = SHOW_ID3DB;
247 tc->dirlevel = last_db_dirlevel; 248 tc->dirlevel = last_db_dirlevel;
248 tc->selected_item = last_db_selection; 249 tc->selected_item = last_db_selection;
250 push_current_activity(ACTIVITY_DATABASEBROWSER);
249 break; 251 break;
250#endif 252#endif
251 } 253 }
252 254
253 browse_context_init(&browse, filter, 0, NULL, NOICON, folder, NULL); 255 browse_context_init(&browse, filter, 0, NULL, NOICON, folder, NULL);
254 ret_val = rockbox_browse(&browse); 256 ret_val = rockbox_browse(&browse);
257 pop_current_activity();
255 switch ((intptr_t)param) 258 switch ((intptr_t)param)
256 { 259 {
257 case GO_TO_FILEBROWSER: 260 case GO_TO_FILEBROWSER:
@@ -285,6 +288,7 @@ static int wpsscrn(void* param)
285{ 288{
286 int ret_val = GO_TO_PREVIOUS; 289 int ret_val = GO_TO_PREVIOUS;
287 (void)param; 290 (void)param;
291 push_current_activity(ACTIVITY_WPS);
288 if (audio_status()) 292 if (audio_status())
289 { 293 {
290 talk_shutup(); 294 talk_shutup();
@@ -306,6 +310,7 @@ static int wpsscrn(void* param)
306 { 310 {
307 splash(HZ*2, ID2P(LANG_NOTHING_TO_RESUME)); 311 splash(HZ*2, ID2P(LANG_NOTHING_TO_RESUME));
308 } 312 }
313 pop_current_activity();
309 return ret_val; 314 return ret_val;
310} 315}
311#if CONFIG_TUNER 316#if CONFIG_TUNER
@@ -511,13 +516,27 @@ static inline int load_screen(int screen)
511 if we dont we will always return to the wrong screen on boot */ 516 if we dont we will always return to the wrong screen on boot */
512 int old_previous = last_screen; 517 int old_previous = last_screen;
513 int ret_val; 518 int ret_val;
519 enum current_activity activity = ACTIVITY_UNKNOWN;
514 if (screen <= GO_TO_ROOT) 520 if (screen <= GO_TO_ROOT)
515 return screen; 521 return screen;
516 if (screen == old_previous) 522 if (screen == old_previous)
517 old_previous = GO_TO_ROOT; 523 old_previous = GO_TO_ROOT;
518 global_status.last_screen = (char)screen; 524 global_status.last_screen = (char)screen;
519 status_save(); 525 status_save();
526
527 if (screen == GO_TO_BROWSEPLUGINS)
528 activity = ACTIVITY_PLUGINBROWSER;
529 else if (screen == GO_TO_MAINMENU)
530 activity = ACTIVITY_SETTINGS;
531
532 if (activity != ACTIVITY_UNKNOWN)
533 push_current_activity(activity);
534
520 ret_val = items[screen].function(items[screen].param); 535 ret_val = items[screen].function(items[screen].param);
536
537 if (activity != ACTIVITY_UNKNOWN)
538 pop_current_activity();
539
521 last_screen = screen; 540 last_screen = screen;
522 if (ret_val == GO_TO_PREVIOUS) 541 if (ret_val == GO_TO_PREVIOUS)
523 last_screen = old_previous; 542 last_screen = old_previous;
@@ -578,15 +597,12 @@ void previous_music_is_wps(void)
578 previous_music = GO_TO_WPS; 597 previous_music = GO_TO_WPS;
579} 598}
580 599
581int current_screen(void)
582{
583 return next_screen;
584}
585
586void root_menu(void) 600void root_menu(void)
587{ 601{
588 int previous_browser = GO_TO_FILEBROWSER; 602 int previous_browser = GO_TO_FILEBROWSER;
589 int selected = 0; 603 int selected = 0;
604
605 push_current_activity(ACTIVITY_MAINMENU);
590 606
591 if (global_settings.start_in_screen == 0) 607 if (global_settings.start_in_screen == 0)
592 next_screen = (int)global_status.last_screen; 608 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_;
64 64
65extern void previous_music_is_wps(void); 65extern void previous_music_is_wps(void);
66 66
67extern int current_screen(void);
68
69#endif /* __ROOT_MENU_H__ */ 67#endif /* __ROOT_MENU_H__ */