mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-10-13 18:17:39 -04:00
Tree / Playlist Viewer / Menu: Fix redraw issues
1) Tree_lists was only initialized when booting the player. In cases where a skin used custom UI viewports of different sizes, when switching between screens, such as between root menu, QuickScreen, and tree browser, this caused list titles to appear with a significant delay, unless a GUI_EVENT_ACTIONUPDATE was sent. Tree_lists is now initialized when entering dirbrowse or when restoring/reloading the list. This eliminates multiple redundant UI refreshes when entering the tree browser, due to gui_synclist_draw not being called twice anymore and by being able to omit GUI_EVENT_ACTIONUPDATE. Separate calls to gui_synclist_init_display_settings have become unnecessary since it is already called by gui_synclist_init. 2) The synclist is also re-initialized when returning from the QuickScreen in the Playlist Viewer or regular menus, or when returning from Settings menus Change-Id: I2884249eda55f782e97abad9dc19b3d9d1267fc9
This commit is contained in:
parent
a9a284c1a0
commit
66a411a1ba
5 changed files with 17 additions and 23 deletions
|
@ -167,7 +167,7 @@ int main(void)
|
||||||
screens[i].update();
|
screens[i].update();
|
||||||
}
|
}
|
||||||
list_init();
|
list_init();
|
||||||
tree_gui_init();
|
tree_init();
|
||||||
/* Keep the order of this 3
|
/* Keep the order of this 3
|
||||||
* Must be done before any code uses the multi-screen API */
|
* Must be done before any code uses the multi-screen API */
|
||||||
#ifdef HAVE_USBSTACK
|
#ifdef HAVE_USBSTACK
|
||||||
|
|
|
@ -466,6 +466,8 @@ int do_menu(const struct menu_item_ex *start_menu, int *start_selected,
|
||||||
done = true;
|
done = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (!done)
|
||||||
|
init_menu_lists(menu, &lists, lists.selected_item, false, vps);
|
||||||
redraw_lists = true;
|
redraw_lists = true;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -670,7 +672,9 @@ int do_menu(const struct menu_item_ex *start_menu, int *start_selected,
|
||||||
case MT_SETTING_W_TEXT:
|
case MT_SETTING_W_TEXT:
|
||||||
{
|
{
|
||||||
do_setting_from_menu(temp, vps);
|
do_setting_from_menu(temp, vps);
|
||||||
send_event(GUI_EVENT_ACTIONUPDATE, (void*)1); /* force a redraw */
|
init_menu_lists(menu, &lists, selected, false, vps);
|
||||||
|
redraw_lists = true;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case MT_RETURN_ID:
|
case MT_RETURN_ID:
|
||||||
|
|
|
@ -1017,7 +1017,7 @@ enum playlist_viewer_result playlist_viewer_ex(const char* filename,
|
||||||
{
|
{
|
||||||
quick_screen_quick(button);
|
quick_screen_quick(button);
|
||||||
update_playlist(true);
|
update_playlist(true);
|
||||||
update_lists(&playlist_lists);
|
prepare_lists(&playlist_lists);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
|
|
27
apps/tree.c
27
apps/tree.c
|
@ -80,7 +80,7 @@
|
||||||
static const struct filetype *filetypes;
|
static const struct filetype *filetypes;
|
||||||
static int filetypes_count;
|
static int filetypes_count;
|
||||||
|
|
||||||
struct gui_synclist tree_lists;
|
static struct gui_synclist tree_lists;
|
||||||
|
|
||||||
/* I put it here because other files doesn't use it yet,
|
/* I put it here because other files doesn't use it yet,
|
||||||
* but should be elsewhere since it will be used mostly everywhere */
|
* but should be elsewhere since it will be used mostly everywhere */
|
||||||
|
@ -301,19 +301,10 @@ bool check_rockboxdir(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* do this really late in the init sequence */
|
/* do this really late in the init sequence */
|
||||||
void tree_gui_init(void)
|
void tree_init(void)
|
||||||
{
|
{
|
||||||
check_rockboxdir();
|
check_rockboxdir();
|
||||||
|
|
||||||
strcpy(tc.currdir, "/");
|
strcpy(tc.currdir, "/");
|
||||||
|
|
||||||
gui_synclist_init(&tree_lists, &tree_get_filename, &tc, false, 1, NULL);
|
|
||||||
gui_synclist_set_voice_callback(&tree_lists, tree_voice_cb);
|
|
||||||
gui_synclist_set_icon_callback(&tree_lists,
|
|
||||||
global_settings.show_icons?&tree_get_fileicon:NULL);
|
|
||||||
#ifdef HAVE_LCD_COLOR
|
|
||||||
gui_synclist_set_color_callback(&tree_lists, &tree_get_filecolor);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -419,6 +410,9 @@ static int update_dir(void)
|
||||||
splash(HZ, ID2P(LANG_SHOWDIR_BUFFER_FULL));
|
splash(HZ, ID2P(LANG_SHOWDIR_BUFFER_FULL));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gui_synclist_init(&tree_lists, &tree_get_filename, &tc, false, 1, NULL);
|
||||||
|
|
||||||
#ifdef HAVE_TAGCACHE
|
#ifdef HAVE_TAGCACHE
|
||||||
if (id3db)
|
if (id3db)
|
||||||
{
|
{
|
||||||
|
@ -472,6 +466,10 @@ static int update_dir(void)
|
||||||
gui_synclist_set_nb_items(&tree_lists, tc.filesindir);
|
gui_synclist_set_nb_items(&tree_lists, tc.filesindir);
|
||||||
gui_synclist_set_icon_callback(&tree_lists,
|
gui_synclist_set_icon_callback(&tree_lists,
|
||||||
global_settings.show_icons?tree_get_fileicon:NULL);
|
global_settings.show_icons?tree_get_fileicon:NULL);
|
||||||
|
gui_synclist_set_voice_callback(&tree_lists, tree_voice_cb);
|
||||||
|
#ifdef HAVE_LCD_COLOR
|
||||||
|
gui_synclist_set_color_callback(&tree_lists, &tree_get_filecolor);
|
||||||
|
#endif
|
||||||
if( tc.selected_item >= tc.filesindir)
|
if( tc.selected_item >= tc.filesindir)
|
||||||
tc.selected_item=tc.filesindir-1;
|
tc.selected_item=tc.filesindir-1;
|
||||||
|
|
||||||
|
@ -657,8 +655,6 @@ static int dirbrowse(void)
|
||||||
return GO_TO_PREVIOUS; /* No files found for rockbox_browse() */
|
return GO_TO_PREVIOUS; /* No files found for rockbox_browse() */
|
||||||
}
|
}
|
||||||
|
|
||||||
send_event(GUI_EVENT_ACTIONUPDATE, (void*)1); /* force a redraw */
|
|
||||||
gui_synclist_draw(&tree_lists);
|
|
||||||
while(1) {
|
while(1) {
|
||||||
bool restore = false;
|
bool restore = false;
|
||||||
if (tc.dirlevel < 0)
|
if (tc.dirlevel < 0)
|
||||||
|
@ -706,9 +702,6 @@ static int dirbrowse(void)
|
||||||
#endif
|
#endif
|
||||||
case GO_TO_ROOT: exit_func = true; break;
|
case GO_TO_ROOT: exit_func = true; break;
|
||||||
default:
|
default:
|
||||||
if (*tc.dirfilter == SHOW_CFG) /* theme changed */
|
|
||||||
gui_synclist_init_display_settings(&tree_lists);
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
restore = true;
|
restore = true;
|
||||||
|
@ -1000,8 +993,6 @@ int rockbox_browse(struct browse_context *browse)
|
||||||
tc.dirfilter = &dirfilter;
|
tc.dirfilter = &dirfilter;
|
||||||
tc.sort_dir = global_settings.sort_dir;
|
tc.sort_dir = global_settings.sort_dir;
|
||||||
|
|
||||||
gui_synclist_init_display_settings(&tree_lists); /* grab updated settings */
|
|
||||||
|
|
||||||
reload_dir = true;
|
reload_dir = true;
|
||||||
if (*tc.dirfilter >= NUM_FILTER_MODES)
|
if (*tc.dirfilter >= NUM_FILTER_MODES)
|
||||||
{
|
{
|
||||||
|
|
|
@ -102,7 +102,7 @@ struct entry* tree_get_entries(struct tree_context *t);
|
||||||
struct entry* tree_get_entry_at(struct tree_context *t, int index);
|
struct entry* tree_get_entry_at(struct tree_context *t, int index);
|
||||||
|
|
||||||
void tree_mem_init(void) INIT_ATTR;
|
void tree_mem_init(void) INIT_ATTR;
|
||||||
void tree_gui_init(void) INIT_ATTR;
|
void tree_init(void) INIT_ATTR;
|
||||||
char* get_current_file(char* buffer, size_t buffer_len);
|
char* get_current_file(char* buffer, size_t buffer_len);
|
||||||
void set_dirfilter(int l_dirfilter);
|
void set_dirfilter(int l_dirfilter);
|
||||||
void set_current_file(const char *path);
|
void set_current_file(const char *path);
|
||||||
|
@ -133,5 +133,4 @@ void tree_restore(void);
|
||||||
bool bookmark_play(char* resume_file, int index, unsigned long elapsed,
|
bool bookmark_play(char* resume_file, int index, unsigned long elapsed,
|
||||||
unsigned long offset, int seed, char *filename);
|
unsigned long offset, int seed, char *filename);
|
||||||
|
|
||||||
extern struct gui_synclist tree_lists;
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue