1
0
Fork 0
forked from len0rd/rockbox

a bit of code cleanup.. use a single function to get the statusbar height (or lack of if its enabled), and remove some gui_textarea stuff which could be done using the splash. (gui_textarea is on the way out)

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@17350 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Jonathan Gordon 2008-05-04 10:58:05 +00:00
parent 977ad4b5a1
commit daa8341a13
7 changed files with 17 additions and 57 deletions

View file

@ -54,7 +54,7 @@ void list_draw(struct screen *display, struct viewport *parent,
display->set_viewport(NULL); display->set_viewport(NULL);
lines = display->nb_lines; lines = display->nb_lines;
gui_textarea_clear(display); display->clear_display();
start = 0; start = 0;
end = display->nb_lines; end = display->nb_lines;
gui_list->last_displayed_start_item[display->screen_type] = gui_list->last_displayed_start_item[display->screen_type] =
@ -126,5 +126,5 @@ void list_draw(struct screen *display, struct viewport *parent,
} }
display->update_viewport(); display->update_viewport();
gui_textarea_update(display); display->update();
} }

View file

@ -76,7 +76,7 @@ void list_init_viewports(struct gui_synclist *list)
else if (list->parent[i] == vp) else if (list->parent[i] == vp)
{ {
viewport_set_defaults(vp, i); viewport_set_defaults(vp, i);
list->parent[i]->y = global_settings.statusbar?STATUSBAR_HEIGHT:0; list->parent[i]->y = gui_statusbar_height();
list->parent[i]->height = screens[i].height - list->parent[i]->y; list->parent[i]->height = screens[i].height - list->parent[i]->y;
} }
} }

View file

@ -797,3 +797,9 @@ void gui_syncstatusbar_draw(struct gui_syncstatusbar * bars,
gui_statusbar_draw( &(bars->statusbars[i]), force_redraw ); gui_statusbar_draw( &(bars->statusbars[i]), force_redraw );
} }
} }
int gui_statusbar_height(void)
{
return global_settings.statusbar ? STATUSBAR_HEIGHT : 0;
}

View file

@ -95,5 +95,5 @@ struct gui_syncstatusbar
extern void gui_syncstatusbar_init(struct gui_syncstatusbar * bars); extern void gui_syncstatusbar_init(struct gui_syncstatusbar * bars);
extern void gui_syncstatusbar_draw(struct gui_syncstatusbar * bars, bool force_redraw); extern void gui_syncstatusbar_draw(struct gui_syncstatusbar * bars, bool force_redraw);
extern int gui_statusbar_height(void);
#endif /*_GUI_STATUSBAR_H_*/ #endif /*_GUI_STATUSBAR_H_*/

View file

@ -50,7 +50,7 @@ void viewport_set_defaults(struct viewport *vp, enum screen_type screen)
vp->x = 0; vp->x = 0;
vp->width = screens[screen].width; vp->width = screens[screen].width;
vp->y = global_settings.statusbar?STATUSBAR_HEIGHT:0; vp->y = gui_statusbar_height();
vp->height = screens[screen].height - vp->y; vp->height = screens[screen].height - vp->y;
#ifdef HAVE_LCD_BITMAP #ifdef HAVE_LCD_BITMAP
vp->drawmode = DRMODE_SOLID; vp->drawmode = DRMODE_SOLID;

View file

@ -487,7 +487,7 @@ bool rectrigger(void)
int offset[NB_SCREENS]; int offset[NB_SCREENS];
int option_lines[NB_SCREENS]; int option_lines[NB_SCREENS];
int w, h, i; int w, h, i;
int stat_height = global_settings.statusbar ? STATUSBAR_HEIGHT : 0; int stat_height = gui_statusbar_height();
int pm_y[NB_SCREENS]; int pm_y[NB_SCREENS];
int trig_xpos[NB_SCREENS]; int trig_xpos[NB_SCREENS];

View file

@ -936,8 +936,6 @@ static bool add_dir(char* dirname, int len, int fd)
for (i=0; i < filetypes_count; i++) { for (i=0; i < filetypes_count; i++) {
if (filetypes[i].tree_attr == FILE_ATTR_AUDIO) { if (filetypes[i].tree_attr == FILE_ATTR_AUDIO) {
if (!strcasecmp(cp, filetypes[i].extension)) { if (!strcasecmp(cp, filetypes[i].extension)) {
char buf[8];
int i;
write(fd, dirname, strlen(dirname)); write(fd, dirname, strlen(dirname));
write(fd, "/", 1); write(fd, "/", 1);
write(fd, entry->d_name, x); write(fd, entry->d_name, x);
@ -946,28 +944,8 @@ static bool add_dir(char* dirname, int len, int fd)
plsize++; plsize++;
if(TIME_AFTER(current_tick, pltick+HZ/4)) { if(TIME_AFTER(current_tick, pltick+HZ/4)) {
pltick = current_tick; pltick = current_tick;
gui_syncsplash(0, "%d %s",
snprintf(buf, sizeof buf, "%d", plsize); plsize, str(LANG_DIR_BROWSER));
#ifdef HAVE_LCD_BITMAP
FOR_NB_SCREENS(i)
{
screens[i].puts(0, 4, (unsigned char *)buf);
gui_textarea_update(&screens[i]);
}
#else
if (plsize > 999)
x=7;
else if (plsize > 99)
x=8;
else if (plsize > 9)
x=9;
else
x = 10;
FOR_NB_SCREENS(i) {
screens[i].puts(x,0,buf);
}
#endif
} }
break; break;
} }
@ -984,22 +962,14 @@ static bool add_dir(char* dirname, int len, int fd)
bool create_playlist(void) bool create_playlist(void)
{ {
int fd; int fd;
int i;
char filename[MAX_PATH]; char filename[MAX_PATH];
pltick = current_tick; pltick = current_tick;
snprintf(filename, sizeof filename, "%s.m3u8", snprintf(filename, sizeof filename, "%s.m3u8",
tc.currdir[1] ? tc.currdir : "/root"); tc.currdir[1] ? tc.currdir : "/root");
FOR_NB_SCREENS(i) gui_syncsplash(0, "%s %s", str(LANG_CREATING), filename);
{
gui_textarea_clear(&screens[i]);
screens[i].puts(0, 0, str(LANG_CREATING));
screens[i].puts_scroll(0, 1, (unsigned char *)filename);
#if defined(HAVE_LCD_BITMAP) || defined(SIMULATOR)
gui_textarea_update(&screens[i]);
#endif
}
fd = creat(filename); fd = creat(filename);
if (fd < 0) if (fd < 0)
return false; return false;
@ -1272,25 +1242,9 @@ void tree_restore(void)
if (global_settings.dircache) if (global_settings.dircache)
{ {
/* Print "Scanning disk..." to the display. */ /* Print "Scanning disk..." to the display. */
int i; gui_syncsplash(0, str(LANG_SCANNING_DISK));
FOR_NB_SCREENS(i)
{
screens[i].putsxy((LCD_WIDTH/2) -
((strlen(str(LANG_SCANNING_DISK)) *
screens[i].char_width)/2),
LCD_HEIGHT-screens[i].char_height*3,
str(LANG_SCANNING_DISK));
gui_textarea_update(&screens[i]);
}
cond_talk_ids_fq(LANG_SCANNING_DISK);
dircache_build(global_status.dircache_size); dircache_build(global_status.dircache_size);
/* Clean the text when we are done. */
FOR_NB_SCREENS(i)
{
gui_textarea_clear(&screens[i]);
}
} }
#endif #endif
#ifdef HAVE_TAGCACHE #ifdef HAVE_TAGCACHE