summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
authorJonathan Gordon <rockbox@jdgordon.info>2008-05-04 10:58:05 +0000
committerJonathan Gordon <rockbox@jdgordon.info>2008-05-04 10:58:05 +0000
commitdaa8341a13ddc93981d2c2178b183a13b5e08950 (patch)
tree3a4946cb4b66d0e475aa04bdd8fafc5bd4a5b3e5 /apps
parent977ad4b5a185cede164cfab9b52ba808bd7ed560 (diff)
downloadrockbox-daa8341a13ddc93981d2c2178b183a13b5e08950.tar.gz
rockbox-daa8341a13ddc93981d2c2178b183a13b5e08950.zip
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
Diffstat (limited to 'apps')
-rw-r--r--apps/gui/charcell/list.c4
-rw-r--r--apps/gui/list.c2
-rw-r--r--apps/gui/statusbar.c6
-rw-r--r--apps/gui/statusbar.h2
-rw-r--r--apps/gui/viewport.c2
-rw-r--r--apps/menus/recording_menu.c2
-rw-r--r--apps/tree.c56
7 files changed, 17 insertions, 57 deletions
diff --git a/apps/gui/charcell/list.c b/apps/gui/charcell/list.c
index 64f2fecbbd..bba688d698 100644
--- a/apps/gui/charcell/list.c
+++ b/apps/gui/charcell/list.c
@@ -54,7 +54,7 @@ void list_draw(struct screen *display, struct viewport *parent,
54 display->set_viewport(NULL); 54 display->set_viewport(NULL);
55 lines = display->nb_lines; 55 lines = display->nb_lines;
56 56
57 gui_textarea_clear(display); 57 display->clear_display();
58 start = 0; 58 start = 0;
59 end = display->nb_lines; 59 end = display->nb_lines;
60 gui_list->last_displayed_start_item[display->screen_type] = 60 gui_list->last_displayed_start_item[display->screen_type] =
@@ -126,5 +126,5 @@ void list_draw(struct screen *display, struct viewport *parent,
126 } 126 }
127 127
128 display->update_viewport(); 128 display->update_viewport();
129 gui_textarea_update(display); 129 display->update();
130} 130}
diff --git a/apps/gui/list.c b/apps/gui/list.c
index 6b4229545d..1e2b682e6e 100644
--- a/apps/gui/list.c
+++ b/apps/gui/list.c
@@ -76,7 +76,7 @@ void list_init_viewports(struct gui_synclist *list)
76 else if (list->parent[i] == vp) 76 else if (list->parent[i] == vp)
77 { 77 {
78 viewport_set_defaults(vp, i); 78 viewport_set_defaults(vp, i);
79 list->parent[i]->y = global_settings.statusbar?STATUSBAR_HEIGHT:0; 79 list->parent[i]->y = gui_statusbar_height();
80 list->parent[i]->height = screens[i].height - list->parent[i]->y; 80 list->parent[i]->height = screens[i].height - list->parent[i]->y;
81 } 81 }
82 } 82 }
diff --git a/apps/gui/statusbar.c b/apps/gui/statusbar.c
index 043fbd3e76..436e3d6cca 100644
--- a/apps/gui/statusbar.c
+++ b/apps/gui/statusbar.c
@@ -797,3 +797,9 @@ void gui_syncstatusbar_draw(struct gui_syncstatusbar * bars,
797 gui_statusbar_draw( &(bars->statusbars[i]), force_redraw ); 797 gui_statusbar_draw( &(bars->statusbars[i]), force_redraw );
798 } 798 }
799} 799}
800
801int gui_statusbar_height(void)
802{
803 return global_settings.statusbar ? STATUSBAR_HEIGHT : 0;
804}
805
diff --git a/apps/gui/statusbar.h b/apps/gui/statusbar.h
index 8862620596..989d1cbe3c 100644
--- a/apps/gui/statusbar.h
+++ b/apps/gui/statusbar.h
@@ -95,5 +95,5 @@ struct gui_syncstatusbar
95 95
96extern void gui_syncstatusbar_init(struct gui_syncstatusbar * bars); 96extern void gui_syncstatusbar_init(struct gui_syncstatusbar * bars);
97extern void gui_syncstatusbar_draw(struct gui_syncstatusbar * bars, bool force_redraw); 97extern void gui_syncstatusbar_draw(struct gui_syncstatusbar * bars, bool force_redraw);
98 98extern int gui_statusbar_height(void);
99#endif /*_GUI_STATUSBAR_H_*/ 99#endif /*_GUI_STATUSBAR_H_*/
diff --git a/apps/gui/viewport.c b/apps/gui/viewport.c
index 86ecd995ca..fbf520eed7 100644
--- a/apps/gui/viewport.c
+++ b/apps/gui/viewport.c
@@ -50,7 +50,7 @@ void viewport_set_defaults(struct viewport *vp, enum screen_type screen)
50 vp->x = 0; 50 vp->x = 0;
51 vp->width = screens[screen].width; 51 vp->width = screens[screen].width;
52 52
53 vp->y = global_settings.statusbar?STATUSBAR_HEIGHT:0; 53 vp->y = gui_statusbar_height();
54 vp->height = screens[screen].height - vp->y; 54 vp->height = screens[screen].height - vp->y;
55#ifdef HAVE_LCD_BITMAP 55#ifdef HAVE_LCD_BITMAP
56 vp->drawmode = DRMODE_SOLID; 56 vp->drawmode = DRMODE_SOLID;
diff --git a/apps/menus/recording_menu.c b/apps/menus/recording_menu.c
index 887d89a4c3..8a26be03e9 100644
--- a/apps/menus/recording_menu.c
+++ b/apps/menus/recording_menu.c
@@ -487,7 +487,7 @@ bool rectrigger(void)
487 int offset[NB_SCREENS]; 487 int offset[NB_SCREENS];
488 int option_lines[NB_SCREENS]; 488 int option_lines[NB_SCREENS];
489 int w, h, i; 489 int w, h, i;
490 int stat_height = global_settings.statusbar ? STATUSBAR_HEIGHT : 0; 490 int stat_height = gui_statusbar_height();
491 int pm_y[NB_SCREENS]; 491 int pm_y[NB_SCREENS];
492 492
493 int trig_xpos[NB_SCREENS]; 493 int trig_xpos[NB_SCREENS];
diff --git a/apps/tree.c b/apps/tree.c
index afe76a3dc8..a5741dfc31 100644
--- a/apps/tree.c
+++ b/apps/tree.c
@@ -936,8 +936,6 @@ static bool add_dir(char* dirname, int len, int fd)
936 for (i=0; i < filetypes_count; i++) { 936 for (i=0; i < filetypes_count; i++) {
937 if (filetypes[i].tree_attr == FILE_ATTR_AUDIO) { 937 if (filetypes[i].tree_attr == FILE_ATTR_AUDIO) {
938 if (!strcasecmp(cp, filetypes[i].extension)) { 938 if (!strcasecmp(cp, filetypes[i].extension)) {
939 char buf[8];
940 int i;
941 write(fd, dirname, strlen(dirname)); 939 write(fd, dirname, strlen(dirname));
942 write(fd, "/", 1); 940 write(fd, "/", 1);
943 write(fd, entry->d_name, x); 941 write(fd, entry->d_name, x);
@@ -946,28 +944,8 @@ static bool add_dir(char* dirname, int len, int fd)
946 plsize++; 944 plsize++;
947 if(TIME_AFTER(current_tick, pltick+HZ/4)) { 945 if(TIME_AFTER(current_tick, pltick+HZ/4)) {
948 pltick = current_tick; 946 pltick = current_tick;
949 947 gui_syncsplash(0, "%d %s",
950 snprintf(buf, sizeof buf, "%d", plsize); 948 plsize, str(LANG_DIR_BROWSER));
951#ifdef HAVE_LCD_BITMAP
952 FOR_NB_SCREENS(i)
953 {
954 screens[i].puts(0, 4, (unsigned char *)buf);
955 gui_textarea_update(&screens[i]);
956 }
957#else
958 if (plsize > 999)
959 x=7;
960 else if (plsize > 99)
961 x=8;
962 else if (plsize > 9)
963 x=9;
964 else
965 x = 10;
966
967 FOR_NB_SCREENS(i) {
968 screens[i].puts(x,0,buf);
969 }
970#endif
971 } 949 }
972 break; 950 break;
973 } 951 }
@@ -984,22 +962,14 @@ static bool add_dir(char* dirname, int len, int fd)
984bool create_playlist(void) 962bool create_playlist(void)
985{ 963{
986 int fd; 964 int fd;
987 int i;
988 char filename[MAX_PATH]; 965 char filename[MAX_PATH];
989 966
990 pltick = current_tick; 967 pltick = current_tick;
991 968
992 snprintf(filename, sizeof filename, "%s.m3u8", 969 snprintf(filename, sizeof filename, "%s.m3u8",
993 tc.currdir[1] ? tc.currdir : "/root"); 970 tc.currdir[1] ? tc.currdir : "/root");
994 FOR_NB_SCREENS(i) 971 gui_syncsplash(0, "%s %s", str(LANG_CREATING), filename);
995 { 972
996 gui_textarea_clear(&screens[i]);
997 screens[i].puts(0, 0, str(LANG_CREATING));
998 screens[i].puts_scroll(0, 1, (unsigned char *)filename);
999#if defined(HAVE_LCD_BITMAP) || defined(SIMULATOR)
1000 gui_textarea_update(&screens[i]);
1001#endif
1002 }
1003 fd = creat(filename); 973 fd = creat(filename);
1004 if (fd < 0) 974 if (fd < 0)
1005 return false; 975 return false;
@@ -1272,25 +1242,9 @@ void tree_restore(void)
1272 if (global_settings.dircache) 1242 if (global_settings.dircache)
1273 { 1243 {
1274 /* Print "Scanning disk..." to the display. */ 1244 /* Print "Scanning disk..." to the display. */
1275 int i; 1245 gui_syncsplash(0, str(LANG_SCANNING_DISK));
1276 FOR_NB_SCREENS(i)
1277 {
1278 screens[i].putsxy((LCD_WIDTH/2) -
1279 ((strlen(str(LANG_SCANNING_DISK)) *
1280 screens[i].char_width)/2),
1281 LCD_HEIGHT-screens[i].char_height*3,
1282 str(LANG_SCANNING_DISK));
1283 gui_textarea_update(&screens[i]);
1284 }
1285 cond_talk_ids_fq(LANG_SCANNING_DISK);
1286 1246
1287 dircache_build(global_status.dircache_size); 1247 dircache_build(global_status.dircache_size);
1288
1289 /* Clean the text when we are done. */
1290 FOR_NB_SCREENS(i)
1291 {
1292 gui_textarea_clear(&screens[i]);
1293 }
1294 } 1248 }
1295#endif 1249#endif
1296#ifdef HAVE_TAGCACHE 1250#ifdef HAVE_TAGCACHE