summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLinus Nielsen Feltzing <linus@haxx.se>2003-11-20 00:47:16 +0000
committerLinus Nielsen Feltzing <linus@haxx.se>2003-11-20 00:47:16 +0000
commitce69548eee8af7adb17fd9799884ca6e488e4e2e (patch)
tree49332a89d0075a9c04c2c554bf3578dcc031f7c9
parentaaa99e70ba738cd29f9d1b627d8bf47de1160d3b (diff)
The calendar couldn't handle a non-default font in some occasions
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@4047 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--apps/plugins/calendar.c34
1 files changed, 22 insertions, 12 deletions
diff --git a/apps/plugins/calendar.c b/apps/plugins/calendar.c
index 0247870f76..d0fb102f18 100644
--- a/apps/plugins/calendar.c
+++ b/apps/plugins/calendar.c
@@ -46,6 +46,9 @@ struct shown {
int firstday; /* first (w)day of month */
int lastday; /* last (w)day of month */
};
+
+static bool use_system_font = false;
+
/* leap year -- account for gregorian reformation in 1752 */
static int is_leap_year(int yr)
{
@@ -69,7 +72,10 @@ static void calendar_init(struct today *today, struct shown *shown)
#endif
rb->lcd_getstringsize("A",&w,&h);
if ( ((w * 14) > LCD_WIDTH) || ((h * 7) > LCD_HEIGHT) )
+ {
rb->lcd_setfont(FONT_SYSFIXED);
+ use_system_font = true;
+ }
rb->lcd_clear_display();
#ifdef HAVE_RTC
tm = rb->get_time();
@@ -390,6 +396,8 @@ static void add_memo(struct shown *shown, int type)
}
}
rb->lcd_clear_display();
+ if(use_system_font)
+ rb->lcd_setfont(FONT_SYSFIXED);
if (saved)
rb->lcd_puts(0,0,"Event added");
else
@@ -407,18 +415,18 @@ static bool edit_memo(int change, struct shown *shown)
rb->lcd_puts(0,0,"Remove : Up");
rb->lcd_puts(0,1,"Edit : Down");
rb->lcd_puts(0,2,"New :");
- rb->lcd_puts(6,3,"weekly : Left");
- rb->lcd_puts(6,4,"monthly : Play");
- rb->lcd_puts(6,5,"annually : Right");
- rb->lcd_puts(6,6,"one off : On");
+ rb->lcd_puts(2,3,"weekly : Left");
+ rb->lcd_puts(2,4,"monthly : Play");
+ rb->lcd_puts(2,5,"annually : Right");
+ rb->lcd_puts(2,6,"one off : On");
}
else
{
rb->lcd_puts(0,0,"New :");
- rb->lcd_puts(6,1,"weekly : Left");
- rb->lcd_puts(6,2,"monthly : Play");
- rb->lcd_puts(6,3,"anualy : Right");
- rb->lcd_puts(6,4,"one off : On");
+ rb->lcd_puts(2,1,"weekly : Left");
+ rb->lcd_puts(2,2,"monthly : Play");
+ rb->lcd_puts(2,3,"anualy : Right");
+ rb->lcd_puts(2,4,"one off : On");
}
rb->lcd_update();
while (!exit)
@@ -430,19 +438,19 @@ static bool edit_memo(int change, struct shown *shown)
case BUTTON_LEFT:
add_memo(shown,0);
- return false;
+ return false;
case BUTTON_PLAY:
add_memo(shown,1);
- return false;
+ return false;
case BUTTON_RIGHT:
add_memo(shown,2);
- return false;
+ return false;
case BUTTON_ON:
add_memo(shown,3);
- return false;
+ return false;
case BUTTON_DOWN:
if (memos_in_shown_memory > 0)
@@ -450,6 +458,8 @@ static bool edit_memo(int change, struct shown *shown)
if(rb->kbd_input(memos[pointer_array[change]].message,
sizeof memos[pointer_array[change]].message) != -1)
save_memo(pointer_array[change],true,shown);
+ if(use_system_font)
+ rb->lcd_setfont(FONT_SYSFIXED);
exit = true;
}
break;