summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Gordon <rockbox@jdgordon.info>2008-05-11 13:59:27 +0000
committerJonathan Gordon <rockbox@jdgordon.info>2008-05-11 13:59:27 +0000
commitaff220c9f50229be955878d603d4c05df65fc605 (patch)
tree547a89a6b10b90081a270ba90e42db7640284f4d
parent10df05438e329c7271c8cc7c4e9cdf2adace52dd (diff)
and the time/date screen...
also change the order the yes/no screen clears the viewport.. stop_scroll should be called before clear or you might get artifacts git-svn-id: svn://svn.rockbox.org/rockbox/trunk@17455 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--apps/gui/yesno.c4
-rw-r--r--apps/screens.c39
2 files changed, 22 insertions, 21 deletions
diff --git a/apps/gui/yesno.c b/apps/gui/yesno.c
index 65dd9651d2..7433e16d71 100644
--- a/apps/gui/yesno.c
+++ b/apps/gui/yesno.c
@@ -60,8 +60,8 @@ static void gui_yesno_draw(struct gui_yesno * yn)
int nb_lines, vp_lines, line_shift=0;
display->set_viewport(vp);
- display->clear_viewport();
display->stop_scroll();
+ display->clear_viewport();
nb_lines = yn->main_message->nb_lines;
vp_lines = viewport_get_nb_lines(vp);
@@ -100,8 +100,8 @@ static bool gui_yesno_draw_result(struct gui_yesno * yn, enum yesno_res result)
if(message==NULL)
return false;
display->set_viewport(vp);
- display->clear_viewport();
display->stop_scroll();
+ display->clear_viewport();
put_message(yn->display, message, 0, viewport_get_nb_lines(vp));
display->update_viewport();
display->set_viewport(NULL);
diff --git a/apps/screens.c b/apps/screens.c
index eb6956ab4e..fc5c0053ec 100644
--- a/apps/screens.c
+++ b/apps/screens.c
@@ -52,7 +52,6 @@
#include "splash.h"
#include "statusbar.h"
#include "screen_access.h"
-#include "quickscreen.h"
#include "pcmbuf.h"
#include "list.h"
#include "yesno.h"
@@ -449,6 +448,8 @@ bool set_time_screen(const char* title, struct tm *tm)
unsigned int prev_line_height;
int daysinmonth[] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
unsigned char buffer[20];
+ struct viewport vp[NB_SCREENS];
+ int nb_lines;
/* 6 possible cursor possitions, 2 values stored for each: x, y */
unsigned int cursor[6][2];
@@ -508,16 +509,18 @@ bool set_time_screen(const char* title, struct tm *tm)
FOR_NB_SCREENS(s)
{
+ viewport_set_defaults(&vp[s], s);
+ nb_lines = viewport_get_nb_lines(&vp[s]);
+
/* minimum lines needed is 2 + title line */
- gui_textarea_update_nblines(&screens[s]);
- if (screens[s].nb_lines < 4)
+ if (nb_lines < 4)
{
- screens[s].setfont(FONT_SYSFIXED);
- gui_textarea_update_nblines(&screens[s]);
+ vp[s].font = FONT_SYSFIXED;
+ nb_lines = viewport_get_nb_lines(&vp[s]);
}
/* recalculate the positions and offsets */
- if (screens[s].nb_lines >= 3)
+ if (nb_lines >= 3)
screens[s].getstringsize(title, NULL, &prev_line_height);
else
prev_line_height = 0;
@@ -542,13 +545,15 @@ bool set_time_screen(const char* title, struct tm *tm)
}
/* draw the screen */
- screens[s].set_drawmode(DRMODE_SOLID);
- gui_textarea_clear(&screens[s]);
+ screens[s].set_viewport(&vp[s]);
+ screens[s].stop_scroll();
+ screens[s].clear_viewport();
/* display the screen title */
screens[s].puts_scroll(0, 0, title);
/* these are not selectable, so we draw them outside the loop */
- screens[s].putsxy(0, cursor[3][INDEX_Y], str(LANG_WEEKDAY_SUNDAY + tm->tm_wday)); /* name of the week day */
+ screens[s].putsxy(0, cursor[3][INDEX_Y],
+ str(LANG_WEEKDAY_SUNDAY + tm->tm_wday)); /* name of the week day */
/* draw the selected item with drawmode set to
DRMODE_SOLID|DRMODE_INVERSEVID, all other selectable
@@ -556,23 +561,24 @@ bool set_time_screen(const char* title, struct tm *tm)
for(i=0; i<6; i++)
{
if (cursorpos == (int)i)
- screens[s].set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID);
+ vp[s].drawmode = (DRMODE_SOLID|DRMODE_INVERSEVID);
screens[s].putsxy(cursor[i][INDEX_X],
cursor[i][INDEX_Y], ptr[i]);
- screens[s].set_drawmode(DRMODE_SOLID);
+ vp[s].drawmode = DRMODE_SOLID;
screens[s].putsxy(cursor[i/4 +1][INDEX_X] - separator_width,
cursor[0][INDEX_Y], SEPARATOR);
}
/* print help text */
- if (screens[s].nb_lines > 4)
+ if (nb_lines > 4)
screens[s].puts(0, 4, str(LANG_TIME_SET_BUTTON));
- if (screens[s].nb_lines > 5)
+ if (nb_lines > 5)
screens[s].puts(0, 5, str(LANG_TIME_REVERT));
- screens[s].update();
+ screens[s].update_viewport();
+ screens[s].set_viewport(NULL);
}
gui_syncstatusbar_draw(&statusbars, true);
@@ -643,11 +649,6 @@ bool set_time_screen(const char* title, struct tm *tm)
break;
}
}
- FOR_NB_SCREENS(i)
- {
- screens[i].setfont(FONT_UI);
- gui_textarea_update_nblines(&screens[i]);
- }
return false;
}
#endif /* defined(HAVE_LCD_BITMAP) && (CONFIG_RTC != 0) */