summaryrefslogtreecommitdiff
path: root/apps/plugins/clock.c
diff options
context:
space:
mode:
authorNils Wallménius <nils@rockbox.org>2007-07-31 10:53:53 +0000
committerNils Wallménius <nils@rockbox.org>2007-07-31 10:53:53 +0000
commit1dc5435f8ebe067fcd88dea72ba65ea9c186a6a6 (patch)
treed2a30dcec18d871c9d10d3e756bffc5c393865d1 /apps/plugins/clock.c
parentec2d2c47a01e6f244ebba0b945565e0611d71efe (diff)
downloadrockbox-1dc5435f8ebe067fcd88dea72ba65ea9c186a6a6.tar.gz
rockbox-1dc5435f8ebe067fcd88dea72ba65ea9c186a6a6.zip
Fix FS#7311 '64 bit simulator crashes when using the menus in some plugins.' by resolving a naming conflict between the plugins' private settings structs and the global 'settings' struct
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@14095 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/plugins/clock.c')
-rw-r--r--apps/plugins/clock.c192
1 files changed, 96 insertions, 96 deletions
diff --git a/apps/plugins/clock.c b/apps/plugins/clock.c
index 73b21fcddd..71415c03d4 100644
--- a/apps/plugins/clock.c
+++ b/apps/plugins/clock.c
@@ -300,30 +300,30 @@ struct saved_settings
300 int fullscreen[2]; 300 int fullscreen[2];
301 int binary[1]; 301 int binary[1];
302 int plain[4]; 302 int plain[4];
303} settings; 303} clock_settings;
304 304
305/************************ 305/************************
306 * Setting default values 306 * Setting default values
307 ***********************/ 307 ***********************/
308void reset_settings(void) 308void reset_settings(void)
309{ 309{
310 settings.clock = 1; 310 clock_settings.clock = 1;
311 settings.general[general_counter] = 1; 311 clock_settings.general[general_counter] = 1;
312 settings.general[general_savesetting] = 1; 312 clock_settings.general[general_savesetting] = 1;
313 settings.general[general_backlight] = 2; 313 clock_settings.general[general_backlight] = 2;
314 settings.analog[analog_date] = 0; 314 clock_settings.analog[analog_date] = 0;
315 settings.analog[analog_secondhand] = true; 315 clock_settings.analog[analog_secondhand] = true;
316 settings.analog[analog_time] = false; 316 clock_settings.analog[analog_time] = false;
317 settings.digital[digital_seconds] = 1; 317 clock_settings.digital[digital_seconds] = 1;
318 settings.digital[digital_date] = 1; 318 clock_settings.digital[digital_date] = 1;
319 settings.digital[digital_blinkcolon] = false; 319 clock_settings.digital[digital_blinkcolon] = false;
320 settings.digital[digital_format] = true; 320 clock_settings.digital[digital_format] = true;
321 settings.fullscreen[fullscreen_border] = true; 321 clock_settings.fullscreen[fullscreen_border] = true;
322 settings.fullscreen[fullscreen_secondhand] = true; 322 clock_settings.fullscreen[fullscreen_secondhand] = true;
323 settings.plain[plain_format] = true; 323 clock_settings.plain[plain_format] = true;
324 settings.plain[plain_seconds] = true; 324 clock_settings.plain[plain_seconds] = true;
325 settings.plain[plain_date] = 1; 325 clock_settings.plain[plain_date] = 1;
326 settings.plain[plain_blinkcolon] = false; 326 clock_settings.plain[plain_blinkcolon] = false;
327} 327}
328 328
329/************************************************************** 329/**************************************************************
@@ -333,7 +333,7 @@ void reset_settings(void)
333void set_digital_colors(void) 333void set_digital_colors(void)
334{ 334{
335#ifdef HAVE_LCD_COLOR /* color LCDs.. */ 335#ifdef HAVE_LCD_COLOR /* color LCDs.. */
336 if(settings.clock == DIGITAL) 336 if(clock_settings.clock == DIGITAL)
337 { 337 {
338 rb->lcd_set_foreground(LCD_WHITE); 338 rb->lcd_set_foreground(LCD_WHITE);
339 rb->lcd_set_background(LCD_BLACK); 339 rb->lcd_set_background(LCD_BLACK);
@@ -344,7 +344,7 @@ void set_digital_colors(void)
344 rb->lcd_set_background(LCD_RGBPACK(180,200,230)); 344 rb->lcd_set_background(LCD_RGBPACK(180,200,230));
345 } 345 }
346#elif LCD_DEPTH >= 2 346#elif LCD_DEPTH >= 2
347 if(settings.clock == DIGITAL) 347 if(clock_settings.clock == DIGITAL)
348 { 348 {
349 rb->lcd_set_foreground(LCD_WHITE); 349 rb->lcd_set_foreground(LCD_WHITE);
350 rb->lcd_set_background(LCD_BLACK); 350 rb->lcd_set_background(LCD_BLACK);
@@ -378,7 +378,7 @@ void cleanup(void *parameter)
378{ 378{
379 (void)parameter; 379 (void)parameter;
380 380
381 if(settings.general[general_savesetting] == 1) 381 if(clock_settings.general[general_savesetting] == 1)
382 save_settings(true); 382 save_settings(true);
383 383
384 /* restore set backlight timeout */ 384 /* restore set backlight timeout */
@@ -423,7 +423,7 @@ void save_settings(bool interface)
423 423
424 if(fd >= 0) /* file exists, save successful */ 424 if(fd >= 0) /* file exists, save successful */
425 { 425 {
426 rb->write (fd, &settings, sizeof(struct saved_settings)); 426 rb->write (fd, &clock_settings, sizeof(struct saved_settings));
427 rb->close(fd); 427 rb->close(fd);
428 428
429 if(interface) 429 if(interface)
@@ -472,7 +472,7 @@ void load_settings(void)
472 { 472 {
473 if(rb->filesize(fd) == sizeof(struct saved_settings)) /* if so, is it the right size? */ 473 if(rb->filesize(fd) == sizeof(struct saved_settings)) /* if so, is it the right size? */
474 { 474 {
475 rb->read(fd, &settings, sizeof(struct saved_settings)); 475 rb->read(fd, &clock_settings, sizeof(struct saved_settings));
476 rb->close(fd); 476 rb->close(fd);
477 477
478 rb->lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID); 478 rb->lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID);
@@ -572,11 +572,11 @@ void init_clock(void)
572 load_settings(); 572 load_settings();
573 573
574 /* set backlight timeout */ 574 /* set backlight timeout */
575 if(settings.general[general_backlight] == 0) 575 if(clock_settings.general[general_backlight] == 0)
576 rb->backlight_set_timeout(0); 576 rb->backlight_set_timeout(0);
577 else if(settings.general[general_backlight] == 1) 577 else if(clock_settings.general[general_backlight] == 1)
578 rb->backlight_set_timeout(rb->global_settings->backlight_timeout); 578 rb->backlight_set_timeout(rb->global_settings->backlight_timeout);
579 else if(settings.general[general_backlight] == 2) 579 else if(clock_settings.general[general_backlight] == 2)
580 rb->backlight_set_timeout(1); 580 rb->backlight_set_timeout(1);
581 581
582 for(i=0; i<ANALOG_VALUES; i++) 582 for(i=0; i<ANALOG_VALUES; i++)
@@ -616,7 +616,7 @@ void analog_clock(int hour, int minute, int second)
616 rb->lcd_set_foreground(LCD_RGBPACK(100,110,125)); 616 rb->lcd_set_foreground(LCD_RGBPACK(100,110,125));
617 617
618 /* second hand */ 618 /* second hand */
619 if(settings.analog[analog_secondhand]) 619 if(clock_settings.analog[analog_secondhand])
620 { 620 {
621 xlcd_filltriangle(LCD_WIDTH/2, LCD_HEIGHT/2-2, LCD_WIDTH/2, LCD_HEIGHT/2+2, 621 xlcd_filltriangle(LCD_WIDTH/2, LCD_HEIGHT/2-2, LCD_WIDTH/2, LCD_HEIGHT/2+2,
622 xminute[second], yminute[second]); 622 xminute[second], yminute[second]);
@@ -640,7 +640,7 @@ void analog_clock(int hour, int minute, int second)
640#endif 640#endif
641 641
642 /* second hand, if needed */ 642 /* second hand, if needed */
643 if(settings.analog[analog_secondhand]) 643 if(clock_settings.analog[analog_secondhand])
644 { 644 {
645 xlcd_filltriangle(LCD_WIDTH/2, LCD_HEIGHT/2-1, LCD_WIDTH/2, LCD_HEIGHT/2+1, 645 xlcd_filltriangle(LCD_WIDTH/2, LCD_HEIGHT/2-1, LCD_WIDTH/2, LCD_HEIGHT/2+1,
646 xminute[second], yminute[second]); 646 xminute[second], yminute[second]);
@@ -690,14 +690,14 @@ void digital_clock(int hour, int minute, int second, bool colon)
690 690
691 /* this basically detects if we draw an AM or PM bitmap. 691 /* this basically detects if we draw an AM or PM bitmap.
692 * if we don't, we center the hh:mm display. */ 692 * if we don't, we center the hh:mm display. */
693 if(!settings.digital[digital_format]) 693 if(!clock_settings.digital[digital_format])
694 x_ofs=DIGIT_WIDTH/2; 694 x_ofs=DIGIT_WIDTH/2;
695 695
696#if LCD_DEPTH == 1 696#if LCD_DEPTH == 1
697 rb->lcd_fillrect(0,0,112,64); 697 rb->lcd_fillrect(0,0,112,64);
698#endif 698#endif
699 699
700 if(settings.digital[digital_format]) 700 if(clock_settings.digital[digital_format])
701 { 701 {
702 /* draw the AM or PM bitmap */ 702 /* draw the AM or PM bitmap */
703 if(hour<12) 703 if(hour<12)
@@ -723,7 +723,7 @@ void digital_clock(int hour, int minute, int second, bool colon)
723 draw_segment(minute/10, DIGIT_XOFS(6)+3*DIGIT_WIDTH+x_ofs, 0); 723 draw_segment(minute/10, DIGIT_XOFS(6)+3*DIGIT_WIDTH+x_ofs, 0);
724 draw_segment(minute%10, DIGIT_XOFS(6)+4*DIGIT_WIDTH+x_ofs, 0); 724 draw_segment(minute%10, DIGIT_XOFS(6)+4*DIGIT_WIDTH+x_ofs, 0);
725 725
726 if(settings.digital[digital_seconds]) 726 if(clock_settings.digital[digital_seconds])
727 { 727 {
728 draw_segment(second/10, DIGIT_XOFS(2), DIGIT_HEIGHT); 728 draw_segment(second/10, DIGIT_XOFS(2), DIGIT_HEIGHT);
729 draw_segment(second%10, DIGIT_XOFS(2)+DIGIT_WIDTH, DIGIT_HEIGHT); 729 draw_segment(second%10, DIGIT_XOFS(2)+DIGIT_WIDTH, DIGIT_HEIGHT);
@@ -749,7 +749,7 @@ void fullscreen_clock(int hour, int minute, int second)
749 rb->lcd_set_foreground(LCD_RGBPACK(100,110,125)); 749 rb->lcd_set_foreground(LCD_RGBPACK(100,110,125));
750 750
751 /* second hand */ 751 /* second hand */
752 if(settings.analog[analog_secondhand]) 752 if(clock_settings.analog[analog_secondhand])
753 { 753 {
754 xlcd_filltriangle(LCD_WIDTH/2, LCD_HEIGHT/2-2, LCD_WIDTH/2, LCD_HEIGHT/2+2, 754 xlcd_filltriangle(LCD_WIDTH/2, LCD_HEIGHT/2-2, LCD_WIDTH/2, LCD_HEIGHT/2+2,
755 xminute_full[second], yminute_full[second]); 755 xminute_full[second], yminute_full[second]);
@@ -773,7 +773,7 @@ void fullscreen_clock(int hour, int minute, int second)
773#endif 773#endif
774 774
775 /* second hand, if needed */ 775 /* second hand, if needed */
776 if(settings.analog[analog_secondhand]) 776 if(clock_settings.analog[analog_secondhand])
777 { 777 {
778 xlcd_filltriangle(LCD_WIDTH/2, LCD_HEIGHT/2-1, LCD_WIDTH/2, LCD_HEIGHT/2+1, 778 xlcd_filltriangle(LCD_WIDTH/2, LCD_HEIGHT/2-1, LCD_WIDTH/2, LCD_HEIGHT/2+1,
779 xminute_full[second], yminute_full[second]); 779 xminute_full[second], yminute_full[second]);
@@ -833,7 +833,7 @@ void binary_clock(int hour, int minute, int second)
833 { 833 {
834 if(mode_var[mode] >= i) 834 if(mode_var[mode] >= i)
835 { 835 {
836 if(settings.binary[binary_mode]) 836 if(clock_settings.binary[binary_mode])
837 draw_digit(DOT_FILLED, xpos*DIGIT_WIDTH+DIGIT_XOFS(6), DIGIT_HEIGHT*mode+DIGIT_YOFS(3)); 837 draw_digit(DOT_FILLED, xpos*DIGIT_WIDTH+DIGIT_XOFS(6), DIGIT_HEIGHT*mode+DIGIT_YOFS(3));
838 else 838 else
839 draw_digit(1, xpos*DIGIT_WIDTH+DIGIT_XOFS(6), DIGIT_HEIGHT*mode+DIGIT_YOFS(3)); 839 draw_digit(1, xpos*DIGIT_WIDTH+DIGIT_XOFS(6), DIGIT_HEIGHT*mode+DIGIT_YOFS(3));
@@ -841,7 +841,7 @@ void binary_clock(int hour, int minute, int second)
841 } 841 }
842 else 842 else
843 { 843 {
844 if(settings.binary[binary_mode]) 844 if(clock_settings.binary[binary_mode])
845 draw_digit(DOT_EMPTY, xpos*DIGIT_WIDTH+DIGIT_XOFS(6), DIGIT_HEIGHT*mode+DIGIT_YOFS(3)); 845 draw_digit(DOT_EMPTY, xpos*DIGIT_WIDTH+DIGIT_XOFS(6), DIGIT_HEIGHT*mode+DIGIT_YOFS(3));
846 else 846 else
847 draw_digit(0, xpos*DIGIT_WIDTH+DIGIT_XOFS(6), DIGIT_HEIGHT*mode+DIGIT_YOFS(3)); 847 draw_digit(0, xpos*DIGIT_WIDTH+DIGIT_XOFS(6), DIGIT_HEIGHT*mode+DIGIT_YOFS(3));
@@ -864,10 +864,10 @@ void plain_clock(int hour, int minute, int second, bool colon)
864 864
865 /* this basically detects if we draw an AM or PM bitmap. 865 /* this basically detects if we draw an AM or PM bitmap.
866 * if we don't, we center the hh:mm display. */ 866 * if we don't, we center the hh:mm display. */
867 if(!settings.plain[plain_format]) 867 if(!clock_settings.plain[plain_format])
868 x_ofs=DIGIT_WIDTH/2; 868 x_ofs=DIGIT_WIDTH/2;
869 869
870 if(settings.plain[plain_format]) 870 if(clock_settings.plain[plain_format])
871 { 871 {
872 /* draw the AM or PM bitmap */ 872 /* draw the AM or PM bitmap */
873 if(hour<12) 873 if(hour<12)
@@ -891,7 +891,7 @@ void plain_clock(int hour, int minute, int second, bool colon)
891 draw_digit(minute/10, DIGIT_XOFS(6)+(DIGIT_WIDTH*3)+x_ofs, 0); 891 draw_digit(minute/10, DIGIT_XOFS(6)+(DIGIT_WIDTH*3)+x_ofs, 0);
892 draw_digit(minute%10, DIGIT_XOFS(6)+(DIGIT_WIDTH*4)+x_ofs, 0); 892 draw_digit(minute%10, DIGIT_XOFS(6)+(DIGIT_WIDTH*4)+x_ofs, 0);
893 893
894 if(settings.plain[plain_seconds]) 894 if(clock_settings.plain[plain_seconds])
895 { 895 {
896 draw_digit(second/10, DIGIT_XOFS(2), DIGIT_HEIGHT); 896 draw_digit(second/10, DIGIT_XOFS(2), DIGIT_HEIGHT);
897 draw_digit(second%10, DIGIT_XOFS(2)+(DIGIT_WIDTH), DIGIT_HEIGHT); 897 draw_digit(second%10, DIGIT_XOFS(2)+(DIGIT_WIDTH), DIGIT_HEIGHT);
@@ -915,7 +915,7 @@ void draw_extras(int year, int day, int month, int hour, int minute, int second)
915 char tmsec[3]; 915 char tmsec[3];
916 916
917 /* american date readout */ 917 /* american date readout */
918 if(settings.analog[analog_date] == 1) 918 if(clock_settings.analog[analog_date] == 1)
919 rb->snprintf(moday, sizeof(moday), "%02d/%02d", month, day); 919 rb->snprintf(moday, sizeof(moday), "%02d/%02d", month, day);
920 else 920 else
921 rb->snprintf(moday, sizeof(moday), "%02d.%02d", day, month); 921 rb->snprintf(moday, sizeof(moday), "%02d.%02d", day, month);
@@ -924,9 +924,9 @@ void draw_extras(int year, int day, int month, int hour, int minute, int second)
924 rb->snprintf(tmsec, sizeof(tmsec), "%02d", second); 924 rb->snprintf(tmsec, sizeof(tmsec), "%02d", second);
925 925
926 /* Analog Extras */ 926 /* Analog Extras */
927 if(settings.clock == ANALOG) 927 if(clock_settings.clock == ANALOG)
928 { 928 {
929 if(settings.analog[analog_time] != 0) /* Digital readout */ 929 if(clock_settings.analog[analog_time] != 0) /* Digital readout */
930 { 930 {
931 draw_smalldigit(hour/10, SMALLDIGIT_WIDTH*0, 0); 931 draw_smalldigit(hour/10, SMALLDIGIT_WIDTH*0, 0);
932 draw_smalldigit(hour%10, SMALLDIGIT_WIDTH*1, 0); 932 draw_smalldigit(hour%10, SMALLDIGIT_WIDTH*1, 0);
@@ -938,7 +938,7 @@ void draw_extras(int year, int day, int month, int hour, int minute, int second)
938 draw_smalldigit(second%10, SMALLDIGIT_WIDTH*2.5, SMALLDIGIT_HEIGHT); 938 draw_smalldigit(second%10, SMALLDIGIT_WIDTH*2.5, SMALLDIGIT_HEIGHT);
939 939
940 /* AM/PM indicator */ 940 /* AM/PM indicator */
941 if(settings.analog[analog_time] == 2) 941 if(clock_settings.analog[analog_time] == 2)
942 { 942 {
943 if(current_time->tm_hour > 12) /* PM */ 943 if(current_time->tm_hour > 12) /* PM */
944 draw_digit(ICON_PM, LCD_WIDTH-DIGIT_WIDTH, DIGIT_HEIGHT/2-DIGIT_HEIGHT); 944 draw_digit(ICON_PM, LCD_WIDTH-DIGIT_WIDTH, DIGIT_HEIGHT/2-DIGIT_HEIGHT);
@@ -946,9 +946,9 @@ void draw_extras(int year, int day, int month, int hour, int minute, int second)
946 draw_digit(ICON_AM, LCD_WIDTH-DIGIT_WIDTH, DIGIT_HEIGHT/2-DIGIT_HEIGHT); 946 draw_digit(ICON_AM, LCD_WIDTH-DIGIT_WIDTH, DIGIT_HEIGHT/2-DIGIT_HEIGHT);
947 } 947 }
948 } 948 }
949 if(settings.analog[analog_date] != 0) /* Date readout */ 949 if(clock_settings.analog[analog_date] != 0) /* Date readout */
950 { 950 {
951 if(settings.analog[analog_date] == 1) 951 if(clock_settings.analog[analog_date] == 1)
952 { 952 {
953 draw_smalldigit(month/10, SMALLDIGIT_WIDTH*0, 953 draw_smalldigit(month/10, SMALLDIGIT_WIDTH*0,
954 LCD_HEIGHT-SMALLDIGIT_HEIGHT*2); 954 LCD_HEIGHT-SMALLDIGIT_HEIGHT*2);
@@ -969,7 +969,7 @@ void draw_extras(int year, int day, int month, int hour, int minute, int second)
969 draw_smalldigit(year%10, SMALLDIGIT_WIDTH*3.5, 969 draw_smalldigit(year%10, SMALLDIGIT_WIDTH*3.5,
970 LCD_HEIGHT-SMALLDIGIT_HEIGHT); 970 LCD_HEIGHT-SMALLDIGIT_HEIGHT);
971 } 971 }
972 else if(settings.analog[analog_date] == 2) 972 else if(clock_settings.analog[analog_date] == 2)
973 { 973 {
974 974
975 draw_smalldigit(day/10, SMALLDIGIT_WIDTH*0, 975 draw_smalldigit(day/10, SMALLDIGIT_WIDTH*0,
@@ -993,10 +993,10 @@ void draw_extras(int year, int day, int month, int hour, int minute, int second)
993 } 993 }
994 } 994 }
995 } 995 }
996 else if(settings.clock == DIGITAL) 996 else if(clock_settings.clock == DIGITAL)
997 { 997 {
998 /* Date readout */ 998 /* Date readout */
999 if(settings.digital[digital_date] == 1) /* american mode */ 999 if(clock_settings.digital[digital_date] == 1) /* american mode */
1000 { 1000 {
1001 draw_smallsegment(month/10, SMALLSEG_WIDTH*0+SMALLSEG_XOFS(10), 1001 draw_smallsegment(month/10, SMALLSEG_WIDTH*0+SMALLSEG_XOFS(10),
1002 LCD_HEIGHT-SMALLSEG_HEIGHT*LCD_OFFSET*2); 1002 LCD_HEIGHT-SMALLSEG_HEIGHT*LCD_OFFSET*2);
@@ -1019,7 +1019,7 @@ void draw_extras(int year, int day, int month, int hour, int minute, int second)
1019 draw_smallsegment(year%10, SMALLSEG_WIDTH*9+SMALLSEG_XOFS(10), 1019 draw_smallsegment(year%10, SMALLSEG_WIDTH*9+SMALLSEG_XOFS(10),
1020 LCD_HEIGHT-SMALLSEG_HEIGHT*LCD_OFFSET*2); 1020 LCD_HEIGHT-SMALLSEG_HEIGHT*LCD_OFFSET*2);
1021 } 1021 }
1022 else if(settings.digital[digital_date] == 2) /* european mode */ 1022 else if(clock_settings.digital[digital_date] == 2) /* european mode */
1023 { 1023 {
1024 draw_smallsegment(day/10, SMALLSEG_WIDTH*0+SMALLSEG_XOFS(10), 1024 draw_smallsegment(day/10, SMALLSEG_WIDTH*0+SMALLSEG_XOFS(10),
1025 LCD_HEIGHT-SMALLSEG_HEIGHT*LCD_OFFSET*2); 1025 LCD_HEIGHT-SMALLSEG_HEIGHT*LCD_OFFSET*2);
@@ -1043,18 +1043,18 @@ void draw_extras(int year, int day, int month, int hour, int minute, int second)
1043 LCD_HEIGHT-SMALLSEG_HEIGHT*LCD_OFFSET*2); 1043 LCD_HEIGHT-SMALLSEG_HEIGHT*LCD_OFFSET*2);
1044 } 1044 }
1045 } 1045 }
1046 else if(settings.clock == FULLSCREEN) /* Fullscreen mode */ 1046 else if(clock_settings.clock == FULLSCREEN) /* Fullscreen mode */
1047 { 1047 {
1048 if(settings.fullscreen[fullscreen_border]) 1048 if(clock_settings.fullscreen[fullscreen_border])
1049 { 1049 {
1050 for(i=0; i < 60; i+=5) /* Draw the circle */ 1050 for(i=0; i < 60; i+=5) /* Draw the circle */
1051 rb->lcd_fillrect(xminute_full[i]-1, yminute_full[i]-1, 3, 3); 1051 rb->lcd_fillrect(xminute_full[i]-1, yminute_full[i]-1, 3, 3);
1052 } 1052 }
1053 } 1053 }
1054 else if(settings.clock == PLAIN) /* Plain mode */ 1054 else if(clock_settings.clock == PLAIN) /* Plain mode */
1055 { 1055 {
1056 /* Date readout */ 1056 /* Date readout */
1057 if(settings.plain[plain_date] == 1) /* american mode */ 1057 if(clock_settings.plain[plain_date] == 1) /* american mode */
1058 { 1058 {
1059 draw_smalldigit(month/10, SMALLDIGIT_WIDTH*0+SMALLDIGIT_XOFS(10), 1059 draw_smalldigit(month/10, SMALLDIGIT_WIDTH*0+SMALLDIGIT_XOFS(10),
1060 LCD_HEIGHT-SMALLDIGIT_HEIGHT*LCD_OFFSET*2); 1060 LCD_HEIGHT-SMALLDIGIT_HEIGHT*LCD_OFFSET*2);
@@ -1077,7 +1077,7 @@ void draw_extras(int year, int day, int month, int hour, int minute, int second)
1077 draw_smalldigit(year%10, SMALLDIGIT_WIDTH*9+SMALLDIGIT_XOFS(10), 1077 draw_smalldigit(year%10, SMALLDIGIT_WIDTH*9+SMALLDIGIT_XOFS(10),
1078 LCD_HEIGHT-SMALLDIGIT_HEIGHT*LCD_OFFSET*2); 1078 LCD_HEIGHT-SMALLDIGIT_HEIGHT*LCD_OFFSET*2);
1079 } 1079 }
1080 else if(settings.plain[plain_date] == 2) /* european mode */ 1080 else if(clock_settings.plain[plain_date] == 2) /* european mode */
1081 { 1081 {
1082 draw_smalldigit(day/10, SMALLDIGIT_WIDTH*0+SMALLDIGIT_XOFS(10), 1082 draw_smalldigit(day/10, SMALLDIGIT_WIDTH*0+SMALLDIGIT_XOFS(10),
1083 LCD_HEIGHT-SMALLDIGIT_HEIGHT*LCD_OFFSET*2); 1083 LCD_HEIGHT-SMALLDIGIT_HEIGHT*LCD_OFFSET*2);
@@ -1123,9 +1123,9 @@ void show_counter(void)
1123 count_m = displayed_value % 3600 / 60; 1123 count_m = displayed_value % 3600 / 60;
1124 count_h = displayed_value / 3600; 1124 count_h = displayed_value / 3600;
1125 1125
1126 if(settings.general[general_counter]) 1126 if(clock_settings.general[general_counter])
1127 { 1127 {
1128 if(settings.clock == ANALOG) 1128 if(clock_settings.clock == ANALOG)
1129 { 1129 {
1130 draw_smalldigit(count_h/10, LCD_WIDTH-SMALLDIGIT_WIDTH*5, 1130 draw_smalldigit(count_h/10, LCD_WIDTH-SMALLDIGIT_WIDTH*5,
1131 LCD_HEIGHT-SMALLDIGIT_HEIGHT*2); 1131 LCD_HEIGHT-SMALLDIGIT_HEIGHT*2);
@@ -1142,7 +1142,7 @@ void show_counter(void)
1142 draw_smalldigit(count_s%10, LCD_WIDTH-SMALLDIGIT_WIDTH*2.5, 1142 draw_smalldigit(count_s%10, LCD_WIDTH-SMALLDIGIT_WIDTH*2.5,
1143 LCD_HEIGHT-SMALLDIGIT_HEIGHT); 1143 LCD_HEIGHT-SMALLDIGIT_HEIGHT);
1144 } 1144 }
1145 else if(settings.clock == DIGITAL) 1145 else if(clock_settings.clock == DIGITAL)
1146 { 1146 {
1147 draw_smallsegment(count_h/10, SMALLSEG_WIDTH*0+SMALLSEG_XOFS(8), 1147 draw_smallsegment(count_h/10, SMALLSEG_WIDTH*0+SMALLSEG_XOFS(8),
1148 LCD_HEIGHT-SMALLSEG_HEIGHT*LCD_OFFSET); 1148 LCD_HEIGHT-SMALLSEG_HEIGHT*LCD_OFFSET);
@@ -1161,7 +1161,7 @@ void show_counter(void)
1161 draw_smallsegment(count_s%10, SMALLSEG_WIDTH*7+SMALLSEG_XOFS(8), 1161 draw_smallsegment(count_s%10, SMALLSEG_WIDTH*7+SMALLSEG_XOFS(8),
1162 LCD_HEIGHT-SMALLSEG_HEIGHT*LCD_OFFSET); 1162 LCD_HEIGHT-SMALLSEG_HEIGHT*LCD_OFFSET);
1163 } 1163 }
1164 else if(settings.clock == FULLSCREEN) 1164 else if(clock_settings.clock == FULLSCREEN)
1165 { 1165 {
1166 1166
1167 draw_smalldigit(count_h/10, SMALLDIGIT_WIDTH*0+SMALLDIGIT_XOFS(8), 1167 draw_smalldigit(count_h/10, SMALLDIGIT_WIDTH*0+SMALLDIGIT_XOFS(8),
@@ -1181,7 +1181,7 @@ void show_counter(void)
1181 draw_smalldigit(count_s%10, SMALLDIGIT_WIDTH*7+SMALLDIGIT_XOFS(8), 1181 draw_smalldigit(count_s%10, SMALLDIGIT_WIDTH*7+SMALLDIGIT_XOFS(8),
1182 LCD_HEIGHT-SMALLDIGIT_HEIGHT*1.5); 1182 LCD_HEIGHT-SMALLDIGIT_HEIGHT*1.5);
1183 } 1183 }
1184 else if(settings.clock == PLAIN) 1184 else if(clock_settings.clock == PLAIN)
1185 { 1185 {
1186 draw_smalldigit(count_h/10, SMALLDIGIT_WIDTH*0+SMALLDIGIT_XOFS(8), 1186 draw_smalldigit(count_h/10, SMALLDIGIT_WIDTH*0+SMALLDIGIT_XOFS(8),
1187 LCD_HEIGHT-SMALLDIGIT_HEIGHT*LCD_OFFSET); 1187 LCD_HEIGHT-SMALLDIGIT_HEIGHT*LCD_OFFSET);
@@ -1210,7 +1210,7 @@ void show_counter(void)
1210 **************/ 1210 **************/
1211bool menu_mode_selector(void) 1211bool menu_mode_selector(void)
1212{ 1212{
1213 int selection=settings.clock-1; 1213 int selection=clock_settings.clock-1;
1214 1214
1215 set_standard_colors(); 1215 set_standard_colors();
1216 1216
@@ -1220,7 +1220,7 @@ bool menu_mode_selector(void)
1220 /* check for this, so if the user exits the menu without 1220 /* check for this, so if the user exits the menu without
1221 * making a selection, it won't change to some weird value. */ 1221 * making a selection, it won't change to some weird value. */
1222 if(rb->do_menu(&menu, &selection) >=0){ 1222 if(rb->do_menu(&menu, &selection) >=0){
1223 settings.clock = selection+1; 1223 clock_settings.clock = selection+1;
1224 return(true); 1224 return(true);
1225 } 1225 }
1226 return(false); 1226 return(false);
@@ -1242,15 +1242,15 @@ void menu_analog_settings(void)
1242 switch(result) 1242 switch(result)
1243 { 1243 {
1244 case 0: 1244 case 0:
1245 rb->set_option("Show Date", &settings.analog[analog_date], 1245 rb->set_option("Show Date", &clock_settings.analog[analog_date],
1246 INT, date_format_text, 3, NULL); 1246 INT, date_format_text, 3, NULL);
1247 break; 1247 break;
1248 case 1: 1248 case 1:
1249 rb->set_option("Show Second Hand", &settings.analog[analog_secondhand], 1249 rb->set_option("Show Second Hand", &clock_settings.analog[analog_secondhand],
1250 INT, noyes_text, 2, NULL); 1250 INT, noyes_text, 2, NULL);
1251 break; 1251 break;
1252 case 2: 1252 case 2:
1253 rb->set_option("Show Time", &settings.analog[analog_time], 1253 rb->set_option("Show Time", &clock_settings.analog[analog_time],
1254 INT, analog_time_text, 3, NULL); 1254 INT, analog_time_text, 3, NULL);
1255 break; 1255 break;
1256 } 1256 }
@@ -1273,19 +1273,19 @@ void menu_digital_settings(void)
1273 switch(result) 1273 switch(result)
1274 { 1274 {
1275 case 0: 1275 case 0:
1276 rb->set_option("Show Date", &settings.digital[digital_date], 1276 rb->set_option("Show Date", &clock_settings.digital[digital_date],
1277 INT, date_format_text, 3, NULL); 1277 INT, date_format_text, 3, NULL);
1278 break; 1278 break;
1279 case 1: 1279 case 1:
1280 rb->set_option("Show Seconds", &settings.digital[digital_seconds], 1280 rb->set_option("Show Seconds", &clock_settings.digital[digital_seconds],
1281 INT, noyes_text, 2, NULL); 1281 INT, noyes_text, 2, NULL);
1282 break; 1282 break;
1283 case 2: 1283 case 2:
1284 rb->set_option("Blinking Colon", &settings.digital[digital_blinkcolon], 1284 rb->set_option("Blinking Colon", &clock_settings.digital[digital_blinkcolon],
1285 INT, noyes_text, 2, NULL); 1285 INT, noyes_text, 2, NULL);
1286 break; 1286 break;
1287 case 3: 1287 case 3:
1288 rb->set_option("Time Format", &settings.digital[digital_format], 1288 rb->set_option("Time Format", &clock_settings.digital[digital_format],
1289 INT, time_format_text, 2, NULL); 1289 INT, time_format_text, 2, NULL);
1290 break; 1290 break;
1291 } 1291 }
@@ -1308,11 +1308,11 @@ void menu_fullscreen_settings(void)
1308 switch(result) 1308 switch(result)
1309 { 1309 {
1310 case 0: 1310 case 0:
1311 rb->set_option("Show Border", &settings.fullscreen[fullscreen_border], 1311 rb->set_option("Show Border", &clock_settings.fullscreen[fullscreen_border],
1312 INT, noyes_text, 2, NULL); 1312 INT, noyes_text, 2, NULL);
1313 break; 1313 break;
1314 case 1: 1314 case 1:
1315 rb->set_option("Show Second Hand", &settings.fullscreen[fullscreen_secondhand], 1315 rb->set_option("Show Second Hand", &clock_settings.fullscreen[fullscreen_secondhand],
1316 INT, noyes_text, 2, NULL); 1316 INT, noyes_text, 2, NULL);
1317 break; 1317 break;
1318 } 1318 }
@@ -1334,7 +1334,7 @@ void menu_binary_settings(void)
1334 switch(result) 1334 switch(result)
1335 { 1335 {
1336 case 0: 1336 case 0:
1337 rb->set_option("Display Mode", &settings.binary[binary_mode], 1337 rb->set_option("Display Mode", &clock_settings.binary[binary_mode],
1338 INT, binary_mode_text, 2, NULL); 1338 INT, binary_mode_text, 2, NULL);
1339 } 1339 }
1340 1340
@@ -1357,19 +1357,19 @@ void menu_plain_settings(void)
1357 switch(result) 1357 switch(result)
1358 { 1358 {
1359 case 0: 1359 case 0:
1360 rb->set_option("Show Date", &settings.plain[plain_date], 1360 rb->set_option("Show Date", &clock_settings.plain[plain_date],
1361 INT, date_format_text, 3, NULL); 1361 INT, date_format_text, 3, NULL);
1362 break; 1362 break;
1363 case 1: 1363 case 1:
1364 rb->set_option("Show Seconds", &settings.plain[plain_seconds], 1364 rb->set_option("Show Seconds", &clock_settings.plain[plain_seconds],
1365 INT, noyes_text, 2, NULL); 1365 INT, noyes_text, 2, NULL);
1366 break; 1366 break;
1367 case 2: 1367 case 2:
1368 rb->set_option("Blinking Colon", &settings.plain[plain_blinkcolon], 1368 rb->set_option("Blinking Colon", &clock_settings.plain[plain_blinkcolon],
1369 INT, noyes_text, 2, NULL); 1369 INT, noyes_text, 2, NULL);
1370 break; 1370 break;
1371 case 3: 1371 case 3:
1372 rb->set_option("Time Format", &settings.plain[plain_format], 1372 rb->set_option("Time Format", &clock_settings.plain[plain_format],
1373 INT, time_format_text, 2, NULL); 1373 INT, time_format_text, 2, NULL);
1374 break; 1374 break;
1375 } 1375 }
@@ -1420,21 +1420,21 @@ void menu_general_settings(void)
1420 break; 1420 break;
1421 1421
1422 case 2: 1422 case 2:
1423 rb->set_option("Save On Exit", &settings.general[general_savesetting], 1423 rb->set_option("Save On Exit", &clock_settings.general[general_savesetting],
1424 INT, noyes_text, 2, NULL); 1424 INT, noyes_text, 2, NULL);
1425 1425
1426 /* if we no longer save on exit, we better save now to remember that */ 1426 /* if we no longer save on exit, we better save now to remember that */
1427 if(settings.general[general_savesetting] == 0) 1427 if(clock_settings.general[general_savesetting] == 0)
1428 save_settings(false); 1428 save_settings(false);
1429 break; 1429 break;
1430 1430
1431 case 3: 1431 case 3:
1432 rb->set_option("Show Counter", &settings.general[general_counter], 1432 rb->set_option("Show Counter", &clock_settings.general[general_counter],
1433 INT, noyes_text, 2, NULL); 1433 INT, noyes_text, 2, NULL);
1434 break; 1434 break;
1435 1435
1436 case 4: 1436 case 4:
1437 rb->set_option("Backlight Settings", &settings.general[general_backlight], 1437 rb->set_option("Backlight Settings", &clock_settings.general[general_backlight],
1438 INT, backlight_settings_text, 3, NULL); 1438 INT, backlight_settings_text, 3, NULL);
1439 break; 1439 break;
1440 1440
@@ -1474,7 +1474,7 @@ void main_menu(void)
1474 break; 1474 break;
1475 1475
1476 case 2: 1476 case 2:
1477 switch(settings.clock) 1477 switch(clock_settings.clock)
1478 { 1478 {
1479 case ANALOG: menu_analog_settings();break; 1479 case ANALOG: menu_analog_settings();break;
1480 case DIGITAL: menu_digital_settings();break; 1480 case DIGITAL: menu_digital_settings();break;
@@ -1557,26 +1557,26 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
1557 rb->lcd_clear_display(); 1557 rb->lcd_clear_display();
1558 1558
1559 /* Analog mode */ 1559 /* Analog mode */
1560 if(settings.clock == ANALOG) 1560 if(clock_settings.clock == ANALOG)
1561 analog_clock(hour, minute, second); 1561 analog_clock(hour, minute, second);
1562 /* Digital mode */ 1562 /* Digital mode */
1563 else if(settings.clock == DIGITAL) 1563 else if(clock_settings.clock == DIGITAL)
1564 { 1564 {
1565 if(settings.digital[digital_blinkcolon]) 1565 if(clock_settings.digital[digital_blinkcolon])
1566 digital_clock(hour, minute, second, second & 1); 1566 digital_clock(hour, minute, second, second & 1);
1567 else 1567 else
1568 digital_clock(hour, minute, second, true); 1568 digital_clock(hour, minute, second, true);
1569 } 1569 }
1570 /* Fullscreen mode */ 1570 /* Fullscreen mode */
1571 else if(settings.clock == FULLSCREEN) 1571 else if(clock_settings.clock == FULLSCREEN)
1572 fullscreen_clock(hour, minute, second); 1572 fullscreen_clock(hour, minute, second);
1573 /* Binary mode */ 1573 /* Binary mode */
1574 else if(settings.clock == BINARY) 1574 else if(clock_settings.clock == BINARY)
1575 binary_clock(hour, minute, second); 1575 binary_clock(hour, minute, second);
1576 /* Plain mode */ 1576 /* Plain mode */
1577 else if(settings.clock == PLAIN) 1577 else if(clock_settings.clock == PLAIN)
1578 { 1578 {
1579 if(settings.plain[plain_blinkcolon]) 1579 if(clock_settings.plain[plain_blinkcolon])
1580 plain_clock(hour, minute, second, second & 1); 1580 plain_clock(hour, minute, second, second & 1);
1581 else 1581 else
1582 plain_clock(hour, minute, second, true); 1582 plain_clock(hour, minute, second, true);
@@ -1586,9 +1586,9 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
1586 show_counter(); 1586 show_counter();
1587 } 1587 }
1588 1588
1589 if(settings.analog[analog_time] == 2 && temphour == 0) 1589 if(clock_settings.analog[analog_time] == 2 && temphour == 0)
1590 temphour = 12; 1590 temphour = 12;
1591 if(settings.analog[analog_time] == 2 && temphour > 12) 1591 if(clock_settings.analog[analog_time] == 2 && temphour > 12)
1592 temphour -= 12; 1592 temphour -= 12;
1593 1593
1594 /* all the "extras" - readouts/displays */ 1594 /* all the "extras" - readouts/displays */
@@ -1606,7 +1606,7 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
1606 switch (button) 1606 switch (button)
1607 { 1607 {
1608 case ACTION_COUNTER_TOGGLE: /* start/stop counter */ 1608 case ACTION_COUNTER_TOGGLE: /* start/stop counter */
1609 if(settings.general[general_counter]) 1609 if(clock_settings.general[general_counter])
1610 { 1610 {
1611 if(!counter_btn_held) /* Ignore if the counter was reset */ 1611 if(!counter_btn_held) /* Ignore if the counter was reset */
1612 { 1612 {
@@ -1626,7 +1626,7 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
1626 break; 1626 break;
1627 1627
1628 case ACTION_COUNTER_RESET: /* reset counter */ 1628 case ACTION_COUNTER_RESET: /* reset counter */
1629 if(settings.general[general_counter]) 1629 if(clock_settings.general[general_counter])
1630 { 1630 {
1631 counter_btn_held = true; /* Ignore the release event */ 1631 counter_btn_held = true; /* Ignore the release event */
1632 counter = 0; 1632 counter = 0;
@@ -1635,19 +1635,19 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
1635 break; 1635 break;
1636 1636
1637 case ACTION_MODE_NEXT: 1637 case ACTION_MODE_NEXT:
1638 if(settings.clock < CLOCK_MODES) 1638 if(clock_settings.clock < CLOCK_MODES)
1639 settings.clock++; 1639 clock_settings.clock++;
1640 else 1640 else
1641 settings.clock = 1; 1641 clock_settings.clock = 1;
1642 1642
1643 set_digital_colors(); 1643 set_digital_colors();
1644 break; 1644 break;
1645 1645
1646 case ACTION_MODE_PREV: 1646 case ACTION_MODE_PREV:
1647 if(settings.clock > 1) 1647 if(clock_settings.clock > 1)
1648 settings.clock--; 1648 clock_settings.clock--;
1649 else 1649 else
1650 settings.clock = CLOCK_MODES; 1650 clock_settings.clock = CLOCK_MODES;
1651 1651
1652 set_digital_colors(); 1652 set_digital_colors();
1653 break; 1653 break;