summaryrefslogtreecommitdiff
path: root/apps/plugins
diff options
context:
space:
mode:
authorRobert Hak <adiamas@rockbox.org>2003-07-24 12:22:10 +0000
committerRobert Hak <adiamas@rockbox.org>2003-07-24 12:22:10 +0000
commitfe18ca56a5f63ced7221717c0e4f1805516c4846 (patch)
tree864b8d2cbc9cab5add6d5aaf924bea51dfc4a232 /apps/plugins
parente4e8220906be8ce057c0b9c6b70a97f191692142 (diff)
downloadrockbox-fe18ca56a5f63ced7221717c0e4f1805516c4846.tar.gz
rockbox-fe18ca56a5f63ced7221717c0e4f1805516c4846.zip
correct build errors
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@3880 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/plugins')
-rw-r--r--apps/plugins/calendar.c40
-rw-r--r--apps/plugins/viewer.c3
2 files changed, 24 insertions, 19 deletions
diff --git a/apps/plugins/calendar.c b/apps/plugins/calendar.c
index 448c1a824f..233fc096d1 100644
--- a/apps/plugins/calendar.c
+++ b/apps/plugins/calendar.c
@@ -46,7 +46,6 @@ 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/* leap year -- account for gregorian reformation in 1752 */ 49/* leap year -- account for gregorian reformation in 1752 */
51static int is_leap_year(int yr) 50static int is_leap_year(int yr)
52{ 51{
@@ -54,7 +53,8 @@ static int is_leap_year(int yr)
54 (!((yr) % 4) && ((yr) % 100)) || !((yr) % 400)) ? 1:0 ; 53 (!((yr) % 4) && ((yr) % 100)) || !((yr) % 400)) ? 1:0 ;
55} 54}
56 55
57/* searches the weekday of the first day in month, relative to the given values */ 56/* searches the weekday of the first day in month,
57 * relative to the given values */
58static int calc_weekday( struct shown *shown ) 58static int calc_weekday( struct shown *shown )
59{ 59{
60 return ( shown->wday + 36 - shown->mday ) % 7 ; 60 return ( shown->wday + 36 - shown->mday ) % 7 ;
@@ -64,12 +64,14 @@ static int calc_weekday( struct shown *shown )
64static void calendar_init(struct today *today, struct shown *shown) 64static void calendar_init(struct today *today, struct shown *shown)
65{ 65{
66 int w,h; 66 int w,h;
67#ifdef HAVE_RTC
68 struct tm *tm;
69#endif
67 rb->lcd_getstringsize("A",&w,&h); 70 rb->lcd_getstringsize("A",&w,&h);
68 if ( ((w * 14) > LCD_WIDTH) || ((h * 7) > LCD_HEIGHT) ) 71 if ( ((w * 14) > LCD_WIDTH) || ((h * 7) > LCD_HEIGHT) )
69 rb->lcd_setfont(FONT_SYSFIXED); 72 rb->lcd_setfont(FONT_SYSFIXED);
70 rb->lcd_clear_display(); 73 rb->lcd_clear_display();
71#ifdef HAVE_RTC 74#ifdef HAVE_RTC
72 struct tm *tm;
73 tm = rb->get_time(); 75 tm = rb->get_time();
74 today->mon = tm->tm_mon +1; 76 today->mon = tm->tm_mon +1;
75 today->year = 2000+tm->tm_year%100; 77 today->year = 2000+tm->tm_year%100;
@@ -92,9 +94,9 @@ static int space = LCD_WIDTH / 7;
92static void draw_headers(void) 94static void draw_headers(void)
93{ 95{
94 int i,w,h; 96 int i,w,h;
95 rb->lcd_getstringsize("A",&w,&h);
96 char *Dayname[7] = {"M","T","W","T","F","S","S"}; 97 char *Dayname[7] = {"M","T","W","T","F","S","S"};
97 int ws = 2; 98 int ws = 2;
99 rb->lcd_getstringsize("A",&w,&h);
98 for (i = 0; i < 8;) 100 for (i = 0; i < 8;)
99 { 101 {
100 rb->lcd_putsxy(ws, 0 , Dayname[i++]); 102 rb->lcd_putsxy(ws, 0 , Dayname[i++]);
@@ -108,7 +110,8 @@ static bool wday_has_memo[6];
108static void draw_calendar(struct shown *shown) 110static void draw_calendar(struct shown *shown)
109{ 111{
110 int w,h; 112 int w,h;
111 rb->lcd_getstringsize("A",&w,&h); 113 int ws,row,pos,days_per_month,j;
114 char buffer[7];
112 char *Monthname[] = { 115 char *Monthname[] = {
113 "Jan", 116 "Jan",
114 "Feb", 117 "Feb",
@@ -123,16 +126,15 @@ static void draw_calendar(struct shown *shown)
123 "Nov", 126 "Nov",
124 "Dec" 127 "Dec"
125 }; 128 };
129 rb->lcd_getstringsize("A",&w,&h);
126 rb->lcd_clear_display(); 130 rb->lcd_clear_display();
127 draw_headers(); 131 draw_headers();
128 int row,pos,days_per_month,j;
129 if (shown->firstday > 6) 132 if (shown->firstday > 6)
130 shown->firstday -= 7; 133 shown->firstday -= 7;
131 char buffer[7];
132 row = 1; 134 row = 1;
133 pos = shown->firstday; 135 pos = shown->firstday;
134 days_per_month = days_in_month[leap_year][shown->mon]; 136 days_per_month = days_in_month[leap_year][shown->mon];
135 int ws = 2 + (pos * space); 137 ws = 2 + (pos * space);
136 for (j = 0; j < days_per_month;) 138 for (j = 0; j < days_per_month;)
137 { 139 {
138 if ( (day_has_memo[++j]) || (wday_has_memo[pos]) ) 140 if ( (day_has_memo[++j]) || (wday_has_memo[pos]) )
@@ -494,11 +496,11 @@ static int start = 0;
494 496
495static void show_lines(int selected, struct shown *shown) 497static void show_lines(int selected, struct shown *shown)
496{ 498{
497 int j = 1,w,h,i,k = 0, pos = 1,m = 0; 499 int lines,j = 1,w,h,i,k = 0, pos = 1,m = 0;
498 rb->lcd_getstringsize("A",&w,&h);
499 int lines = (LCD_HEIGHT / h) - 1;
500 char temp[MAX_CHAR_MEMO_LEN + 12]; 500 char temp[MAX_CHAR_MEMO_LEN + 12];
501 501 rb->lcd_getstringsize("A",&w,&h);
502 lines = (LCD_HEIGHT / h) - 1;
503
502 rb->lcd_clear_display(); 504 rb->lcd_clear_display();
503 rb->lcd_puts(0,0,"Events (play : menu)"); 505 rb->lcd_puts(0,0,"Events (play : menu)");
504 506
@@ -532,9 +534,9 @@ static void show_lines(int selected, struct shown *shown)
532 534
533static void update_memos_shown(struct shown *shown) 535static void update_memos_shown(struct shown *shown)
534{ 536{
537 int i;
535 memos_in_shown_memory = 0; 538 memos_in_shown_memory = 0;
536 start = 0; 539 start = 0;
537 int i;
538 for (i = 0; i < memos_in_memory; i++) 540 for (i = 0; i < memos_in_memory; i++)
539 if ( 541 if (
540 (memos[i].day == shown->mday) 542 (memos[i].day == shown->mday)
@@ -550,8 +552,9 @@ static void update_memos_shown(struct shown *shown)
550 552
551static bool any_events(struct shown *shown, bool force) 553static bool any_events(struct shown *shown, bool force)
552{ 554{
553 update_memos_shown(shown);
554 int lines_displayed = 0; 555 int lines_displayed = 0;
556 bool exit=false;
557 update_memos_shown(shown);
555 if (memos_in_shown_memory > 0) 558 if (memos_in_shown_memory > 0)
556 show_lines(lines_displayed,shown); 559 show_lines(lines_displayed,shown);
557 else if (force) 560 else if (force)
@@ -559,7 +562,6 @@ static bool any_events(struct shown *shown, bool force)
559 else 562 else
560 return false; 563 return false;
561 rb->lcd_update(); 564 rb->lcd_update();
562 bool exit = false;
563 while (!exit) 565 while (!exit)
564 { 566 {
565 switch (rb->button_get(true)) 567 switch (rb->button_get(true))
@@ -655,18 +657,18 @@ static void prev_day(struct shown *shown, int step)
655 657
656enum plugin_status plugin_start(struct plugin_api* api, void* parameter) 658enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
657{ 659{
660 struct today today;
661 struct shown shown;
662 bool exit = false;
658 TEST_PLUGIN_API(api); 663 TEST_PLUGIN_API(api);
659 (void)(parameter); 664 (void)(parameter);
665
660 rb = api; 666 rb = api;
661 667
662 struct today today;
663 struct shown shown;
664
665 calendar_init(&today, &shown); 668 calendar_init(&today, &shown);
666 load_memo(&shown); 669 load_memo(&shown);
667 any_events(&shown, false); 670 any_events(&shown, false);
668 draw_calendar(&shown); 671 draw_calendar(&shown);
669 bool exit = false;
670 while (!exit) 672 while (!exit)
671 { 673 {
672 switch (rb->button_get(true)) 674 switch (rb->button_get(true))
diff --git a/apps/plugins/viewer.c b/apps/plugins/viewer.c
index 61469fb7ff..6f2c5840fd 100644
--- a/apps/plugins/viewer.c
+++ b/apps/plugins/viewer.c
@@ -24,7 +24,10 @@
24#endif 24#endif
25 25
26#include <ctype.h> 26#include <ctype.h>
27
28#ifndef SIMULATOR
27#include <ctype.c> 29#include <ctype.c>
30#endif
28 31
29#if PLUGIN_API_VERSION < 3 32#if PLUGIN_API_VERSION < 3
30#error Scrollbar function requires PLUGIN_API_VERSION 3 at least 33#error Scrollbar function requires PLUGIN_API_VERSION 3 at least