summaryrefslogtreecommitdiff
path: root/apps/tree.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/tree.c')
-rw-r--r--apps/tree.c30
1 files changed, 25 insertions, 5 deletions
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;
110 110
111static bool start_wps = false; 111static bool start_wps = false;
112static bool dirbrowse(void); 112static bool dirbrowse(void);
113static int curr_context = false;
113 114
114bool check_rockboxdir(void) 115bool check_rockboxdir(void)
115{ 116{
@@ -625,10 +626,14 @@ static bool check_changed_id3mode(bool currmode)
625 if (currmode != (global_settings.dirfilter == SHOW_ID3DB)) { 626 if (currmode != (global_settings.dirfilter == SHOW_ID3DB)) {
626 currmode = global_settings.dirfilter == SHOW_ID3DB; 627 currmode = global_settings.dirfilter == SHOW_ID3DB;
627 if (currmode) { 628 if (currmode) {
629 curr_context=CONTEXT_ID3DB;
628 db_load(&tc); 630 db_load(&tc);
629 } 631 }
630 else 632 else
633 {
634 curr_context=CONTEXT_TREE;
631 ft_load(&tc, NULL); 635 ft_load(&tc, NULL);
636 }
632 } 637 }
633 return currmode; 638 return currmode;
634} 639}
@@ -660,6 +665,11 @@ static bool dirbrowse(void)
660 char* currdir = tc.currdir; /* just a shortcut */ 665 char* currdir = tc.currdir; /* just a shortcut */
661 bool id3db = *tc.dirfilter == SHOW_ID3DB; 666 bool id3db = *tc.dirfilter == SHOW_ID3DB;
662 667
668 if (id3db)
669 curr_context=CONTEXT_ID3DB;
670 else
671 curr_context=CONTEXT_TREE;
672
663#ifdef HAVE_LCD_BITMAP 673#ifdef HAVE_LCD_BITMAP
664 tree_max_on_screen = recalc_screen_height(); 674 tree_max_on_screen = recalc_screen_height();
665#else 675#else
@@ -1059,7 +1069,7 @@ static bool dirbrowse(void)
1059 /* don't enter f2 from plugin browser */ 1069 /* don't enter f2 from plugin browser */
1060 if (*tc.dirfilter < NUM_FILTER_MODES) 1070 if (*tc.dirfilter < NUM_FILTER_MODES)
1061 { 1071 {
1062 if (quick_screen(CONTEXT_TREE, BUTTON_F2)) 1072 if (quick_screen(curr_context, BUTTON_F2))
1063 reload_dir = true; 1073 reload_dir = true;
1064 restore = true; 1074 restore = true;
1065 1075
@@ -1071,7 +1081,7 @@ static bool dirbrowse(void)
1071 /* don't enter f3 from plugin browser */ 1081 /* don't enter f3 from plugin browser */
1072 if (*tc.dirfilter < NUM_FILTER_MODES) 1082 if (*tc.dirfilter < NUM_FILTER_MODES)
1073 { 1083 {
1074 if (quick_screen(CONTEXT_TREE, BUTTON_F3)) 1084 if (quick_screen(curr_context, BUTTON_F3))
1075 reload_dir = true; 1085 reload_dir = true;
1076 tree_max_on_screen = recalc_screen_height(); 1086 tree_max_on_screen = recalc_screen_height();
1077 restore = true; 1087 restore = true;
@@ -1091,7 +1101,7 @@ static bool dirbrowse(void)
1091 int attr = 0; 1101 int attr = 0;
1092 1102
1093 if(!numentries) 1103 if(!numentries)
1094 onplay_result = onplay(NULL, 0); 1104 onplay_result = onplay(NULL, 0, curr_context);
1095 else { 1105 else {
1096 if (currdir[1]) 1106 if (currdir[1])
1097 snprintf(buf, sizeof buf, "%s/%s", 1107 snprintf(buf, sizeof buf, "%s/%s",
@@ -1099,9 +1109,19 @@ static bool dirbrowse(void)
1099 else 1109 else
1100 snprintf(buf, sizeof buf, "/%s", 1110 snprintf(buf, sizeof buf, "/%s",
1101 dircache[tc.dircursor+tc.dirstart].name); 1111 dircache[tc.dircursor+tc.dirstart].name);
1102 if (!id3db) 1112 if (id3db)
1113 switch (tc.currtable)
1114 {
1115 case allsongs:
1116 case songs4album:
1117 case songs4artist:
1118 case searchsongs:
1119 attr=TREE_ATTR_MPA;
1120 break;
1121 }
1122 else
1103 attr = dircache[tc.dircursor+tc.dirstart].attr; 1123 attr = dircache[tc.dircursor+tc.dirstart].attr;
1104 onplay_result = onplay(buf, attr); 1124 onplay_result = onplay(buf, attr, curr_context);
1105 } 1125 }
1106 1126
1107 switch (onplay_result) 1127 switch (onplay_result)