diff options
-rw-r--r-- | apps/plugins/calendar.c | 34 |
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 { | |||
46 | int firstday; /* first (w)day of month */ | 46 | int firstday; /* first (w)day of month */ |
47 | int lastday; /* last (w)day of month */ | 47 | int lastday; /* last (w)day of month */ |
48 | }; | 48 | }; |
49 | |||
50 | static bool use_system_font = false; | ||
51 | |||
49 | /* leap year -- account for gregorian reformation in 1752 */ | 52 | /* leap year -- account for gregorian reformation in 1752 */ |
50 | static int is_leap_year(int yr) | 53 | static int is_leap_year(int yr) |
51 | { | 54 | { |
@@ -69,7 +72,10 @@ static void calendar_init(struct today *today, struct shown *shown) | |||
69 | #endif | 72 | #endif |
70 | rb->lcd_getstringsize("A",&w,&h); | 73 | rb->lcd_getstringsize("A",&w,&h); |
71 | if ( ((w * 14) > LCD_WIDTH) || ((h * 7) > LCD_HEIGHT) ) | 74 | if ( ((w * 14) > LCD_WIDTH) || ((h * 7) > LCD_HEIGHT) ) |
75 | { | ||
72 | rb->lcd_setfont(FONT_SYSFIXED); | 76 | rb->lcd_setfont(FONT_SYSFIXED); |
77 | use_system_font = true; | ||
78 | } | ||
73 | rb->lcd_clear_display(); | 79 | rb->lcd_clear_display(); |
74 | #ifdef HAVE_RTC | 80 | #ifdef HAVE_RTC |
75 | tm = rb->get_time(); | 81 | tm = rb->get_time(); |
@@ -390,6 +396,8 @@ static void add_memo(struct shown *shown, int type) | |||
390 | } | 396 | } |
391 | } | 397 | } |
392 | rb->lcd_clear_display(); | 398 | rb->lcd_clear_display(); |
399 | if(use_system_font) | ||
400 | rb->lcd_setfont(FONT_SYSFIXED); | ||
393 | if (saved) | 401 | if (saved) |
394 | rb->lcd_puts(0,0,"Event added"); | 402 | rb->lcd_puts(0,0,"Event added"); |
395 | else | 403 | else |
@@ -407,18 +415,18 @@ static bool edit_memo(int change, struct shown *shown) | |||
407 | rb->lcd_puts(0,0,"Remove : Up"); | 415 | rb->lcd_puts(0,0,"Remove : Up"); |
408 | rb->lcd_puts(0,1,"Edit : Down"); | 416 | rb->lcd_puts(0,1,"Edit : Down"); |
409 | rb->lcd_puts(0,2,"New :"); | 417 | rb->lcd_puts(0,2,"New :"); |
410 | rb->lcd_puts(6,3,"weekly : Left"); | 418 | rb->lcd_puts(2,3,"weekly : Left"); |
411 | rb->lcd_puts(6,4,"monthly : Play"); | 419 | rb->lcd_puts(2,4,"monthly : Play"); |
412 | rb->lcd_puts(6,5,"annually : Right"); | 420 | rb->lcd_puts(2,5,"annually : Right"); |
413 | rb->lcd_puts(6,6,"one off : On"); | 421 | rb->lcd_puts(2,6,"one off : On"); |
414 | } | 422 | } |
415 | else | 423 | else |
416 | { | 424 | { |
417 | rb->lcd_puts(0,0,"New :"); | 425 | rb->lcd_puts(0,0,"New :"); |
418 | rb->lcd_puts(6,1,"weekly : Left"); | 426 | rb->lcd_puts(2,1,"weekly : Left"); |
419 | rb->lcd_puts(6,2,"monthly : Play"); | 427 | rb->lcd_puts(2,2,"monthly : Play"); |
420 | rb->lcd_puts(6,3,"anualy : Right"); | 428 | rb->lcd_puts(2,3,"anualy : Right"); |
421 | rb->lcd_puts(6,4,"one off : On"); | 429 | rb->lcd_puts(2,4,"one off : On"); |
422 | } | 430 | } |
423 | rb->lcd_update(); | 431 | rb->lcd_update(); |
424 | while (!exit) | 432 | while (!exit) |
@@ -430,19 +438,19 @@ static bool edit_memo(int change, struct shown *shown) | |||
430 | 438 | ||
431 | case BUTTON_LEFT: | 439 | case BUTTON_LEFT: |
432 | add_memo(shown,0); | 440 | add_memo(shown,0); |
433 | return false; | 441 | return false; |
434 | 442 | ||
435 | case BUTTON_PLAY: | 443 | case BUTTON_PLAY: |
436 | add_memo(shown,1); | 444 | add_memo(shown,1); |
437 | return false; | 445 | return false; |
438 | 446 | ||
439 | case BUTTON_RIGHT: | 447 | case BUTTON_RIGHT: |
440 | add_memo(shown,2); | 448 | add_memo(shown,2); |
441 | return false; | 449 | return false; |
442 | 450 | ||
443 | case BUTTON_ON: | 451 | case BUTTON_ON: |
444 | add_memo(shown,3); | 452 | add_memo(shown,3); |
445 | return false; | 453 | return false; |
446 | 454 | ||
447 | case BUTTON_DOWN: | 455 | case BUTTON_DOWN: |
448 | if (memos_in_shown_memory > 0) | 456 | if (memos_in_shown_memory > 0) |
@@ -450,6 +458,8 @@ static bool edit_memo(int change, struct shown *shown) | |||
450 | if(rb->kbd_input(memos[pointer_array[change]].message, | 458 | if(rb->kbd_input(memos[pointer_array[change]].message, |
451 | sizeof memos[pointer_array[change]].message) != -1) | 459 | sizeof memos[pointer_array[change]].message) != -1) |
452 | save_memo(pointer_array[change],true,shown); | 460 | save_memo(pointer_array[change],true,shown); |
461 | if(use_system_font) | ||
462 | rb->lcd_setfont(FONT_SYSFIXED); | ||
453 | exit = true; | 463 | exit = true; |
454 | } | 464 | } |
455 | break; | 465 | break; |