diff options
52 files changed, 1233 insertions, 2339 deletions
diff --git a/apps/plugins/bitmaps/mono/clock_logo.112x64x1.bmp b/apps/plugins/bitmaps/mono/clock_logo.112x64x1.bmp deleted file mode 100644 index c56f831865..0000000000 --- a/apps/plugins/bitmaps/mono/clock_logo.112x64x1.bmp +++ /dev/null | |||
Binary files differ | |||
diff --git a/apps/plugins/bitmaps/mono/clock_logo.128x128x1.bmp b/apps/plugins/bitmaps/mono/clock_logo.128x128x1.bmp deleted file mode 100644 index 6dc02aa564..0000000000 --- a/apps/plugins/bitmaps/mono/clock_logo.128x128x1.bmp +++ /dev/null | |||
Binary files differ | |||
diff --git a/apps/plugins/bitmaps/mono/clock_logo.138x110x1.bmp b/apps/plugins/bitmaps/mono/clock_logo.138x110x1.bmp deleted file mode 100644 index 95abdbf24b..0000000000 --- a/apps/plugins/bitmaps/mono/clock_logo.138x110x1.bmp +++ /dev/null | |||
Binary files differ | |||
diff --git a/apps/plugins/bitmaps/mono/clock_logo.160x128x1.bmp b/apps/plugins/bitmaps/mono/clock_logo.160x128x1.bmp deleted file mode 100644 index 90c58aae40..0000000000 --- a/apps/plugins/bitmaps/mono/clock_logo.160x128x1.bmp +++ /dev/null | |||
Binary files differ | |||
diff --git a/apps/plugins/bitmaps/mono/clock_logo.176x132x1.bmp b/apps/plugins/bitmaps/mono/clock_logo.176x132x1.bmp deleted file mode 100644 index 9d706be246..0000000000 --- a/apps/plugins/bitmaps/mono/clock_logo.176x132x1.bmp +++ /dev/null | |||
Binary files differ | |||
diff --git a/apps/plugins/bitmaps/mono/clock_logo.220x176x1.bmp b/apps/plugins/bitmaps/mono/clock_logo.220x176x1.bmp deleted file mode 100644 index 6a7861a642..0000000000 --- a/apps/plugins/bitmaps/mono/clock_logo.220x176x1.bmp +++ /dev/null | |||
Binary files differ | |||
diff --git a/apps/plugins/bitmaps/mono/clock_logo.240x320x1.bmp b/apps/plugins/bitmaps/mono/clock_logo.240x320x1.bmp deleted file mode 100644 index e98530a201..0000000000 --- a/apps/plugins/bitmaps/mono/clock_logo.240x320x1.bmp +++ /dev/null | |||
Binary files differ | |||
diff --git a/apps/plugins/bitmaps/mono/clock_logo.320x240x1.bmp b/apps/plugins/bitmaps/mono/clock_logo.320x240x1.bmp deleted file mode 100644 index 960aa320f4..0000000000 --- a/apps/plugins/bitmaps/mono/clock_logo.320x240x1.bmp +++ /dev/null | |||
Binary files differ | |||
diff --git a/apps/plugins/bitmaps/native/SOURCES b/apps/plugins/bitmaps/native/SOURCES index 232b2b90f0..f9f6bfaa2c 100644 --- a/apps/plugins/bitmaps/native/SOURCES +++ b/apps/plugins/bitmaps/native/SOURCES | |||
@@ -107,6 +107,65 @@ chessbox_pieces.80x64x1.bmp | |||
107 | chessbox_pieces.64x64x1.bmp | 107 | chessbox_pieces.64x64x1.bmp |
108 | #endif | 108 | #endif |
109 | 109 | ||
110 | /* Clock */ | ||
111 | #if (LCD_WIDTH >= 320) && (LCD_HEIGHT >= 240) && (LCD_DEPTH >= 16) | ||
112 | clock_digits.320x240x16.bmp | ||
113 | clock_smalldigits.320x240x16.bmp | ||
114 | clock_segments.320x240x16.bmp | ||
115 | clock_smallsegments.320x240x16.bmp | ||
116 | clock_logo.320x240x16.bmp | ||
117 | clock_messages.320x240x16.bmp | ||
118 | #elif (LCD_WIDTH >= 220) && (LCD_HEIGHT >= 176) && (LCD_DEPTH >= 16) | ||
119 | clock_digits.220x176x16.bmp | ||
120 | clock_smalldigits.220x176x16.bmp | ||
121 | clock_segments.220x176x16.bmp | ||
122 | clock_smallsegments.220x176x16.bmp | ||
123 | clock_logo.220x176x16.bmp | ||
124 | clock_messages.220x176x16.bmp | ||
125 | #elif (LCD_WIDTH >= 176) && (LCD_HEIGHT >= 132) && (LCD_DEPTH >= 16) | ||
126 | clock_digits.160x128x16.bmp | ||
127 | clock_smalldigits.160x128x16.bmp | ||
128 | clock_segments.160x128x16.bmp | ||
129 | clock_smallsegments.160x128x16.bmp | ||
130 | clock_logo.176x132x16.bmp | ||
131 | clock_messages.176x132x16.bmp | ||
132 | #elif (LCD_WIDTH >= 160) && (LCD_HEIGHT >= 128) && (LCD_DEPTH >= 16) | ||
133 | clock_digits.160x128x16.bmp | ||
134 | clock_smalldigits.160x128x16.bmp | ||
135 | clock_segments.160x128x16.bmp | ||
136 | clock_smallsegments.160x128x16.bmp | ||
137 | clock_logo.160x128x16.bmp | ||
138 | clock_messages.160x128x16.bmp | ||
139 | #elif (LCD_WIDTH >= 128) && (LCD_HEIGHT >= 128) && (LCD_DEPTH >= 16) | ||
140 | clock_digits.128x128x16.bmp | ||
141 | clock_smalldigits.128x128x16.bmp | ||
142 | clock_segments.128x128x16.bmp | ||
143 | clock_smallsegments.128x128x16.bmp | ||
144 | clock_logo.128x128x16.bmp | ||
145 | clock_messages.128x128x16.bmp | ||
146 | #elif (LCD_WIDTH >= 160) && (LCD_HEIGHT >= 128) && (LCD_DEPTH >= 2) | ||
147 | clock_digits.160x128x2.bmp | ||
148 | clock_smalldigits.160x128x2.bmp | ||
149 | clock_segments.160x128x2.bmp | ||
150 | clock_smallsegments.160x128x2.bmp | ||
151 | clock_logo.160x128x2.bmp | ||
152 | clock_messages.160x128x2.bmp | ||
153 | #elif (LCD_WIDTH >= 138) && (LCD_HEIGHT >= 110) && (LCD_DEPTH >= 2) | ||
154 | clock_digits.138x110x2.bmp | ||
155 | clock_smalldigits.160x128x2.bmp | ||
156 | clock_segments.138x110x2.bmp | ||
157 | clock_smallsegments.160x128x2.bmp | ||
158 | clock_logo.138x110x2.bmp | ||
159 | clock_messages.138x110x2.bmp | ||
160 | #elif (LCD_WIDTH >= 112) && (LCD_HEIGHT >= 64) && (LCD_DEPTH >= 1) | ||
161 | clock_digits.112x64x1.bmp | ||
162 | clock_smalldigits.112x64x1.bmp | ||
163 | clock_segments.112x64x1.bmp | ||
164 | clock_smallsegments.112x64x1.bmp | ||
165 | clock_logo.112x64x1.bmp | ||
166 | clock_messages.112x64x1.bmp | ||
167 | #endif | ||
168 | |||
110 | /* Flipit */ | 169 | /* Flipit */ |
111 | #ifdef HAVE_LCD_COLOR | 170 | #ifdef HAVE_LCD_COLOR |
112 | #if LCD_WIDTH >= 280 && LCD_HEIGHT >= 234 | 171 | #if LCD_WIDTH >= 280 && LCD_HEIGHT >= 234 |
diff --git a/apps/plugins/bitmaps/native/clock_digits.112x64x1.bmp b/apps/plugins/bitmaps/native/clock_digits.112x64x1.bmp new file mode 100644 index 0000000000..c8738029cb --- /dev/null +++ b/apps/plugins/bitmaps/native/clock_digits.112x64x1.bmp | |||
Binary files differ | |||
diff --git a/apps/plugins/bitmaps/native/clock_digits.128x128x16.bmp b/apps/plugins/bitmaps/native/clock_digits.128x128x16.bmp new file mode 100644 index 0000000000..87694982c9 --- /dev/null +++ b/apps/plugins/bitmaps/native/clock_digits.128x128x16.bmp | |||
Binary files differ | |||
diff --git a/apps/plugins/bitmaps/native/clock_digits.138x110x2.bmp b/apps/plugins/bitmaps/native/clock_digits.138x110x2.bmp new file mode 100644 index 0000000000..d3a3ea15a4 --- /dev/null +++ b/apps/plugins/bitmaps/native/clock_digits.138x110x2.bmp | |||
Binary files differ | |||
diff --git a/apps/plugins/bitmaps/native/clock_digits.160x128x16.bmp b/apps/plugins/bitmaps/native/clock_digits.160x128x16.bmp new file mode 100644 index 0000000000..6b2b41c496 --- /dev/null +++ b/apps/plugins/bitmaps/native/clock_digits.160x128x16.bmp | |||
Binary files differ | |||
diff --git a/apps/plugins/bitmaps/native/clock_digits.160x128x2.bmp b/apps/plugins/bitmaps/native/clock_digits.160x128x2.bmp new file mode 100644 index 0000000000..6a82bb05d0 --- /dev/null +++ b/apps/plugins/bitmaps/native/clock_digits.160x128x2.bmp | |||
Binary files differ | |||
diff --git a/apps/plugins/bitmaps/native/clock_digits.220x176x16.bmp b/apps/plugins/bitmaps/native/clock_digits.220x176x16.bmp new file mode 100644 index 0000000000..41fef2bc1e --- /dev/null +++ b/apps/plugins/bitmaps/native/clock_digits.220x176x16.bmp | |||
Binary files differ | |||
diff --git a/apps/plugins/bitmaps/native/clock_digits.320x240x16.bmp b/apps/plugins/bitmaps/native/clock_digits.320x240x16.bmp new file mode 100644 index 0000000000..0da719cd54 --- /dev/null +++ b/apps/plugins/bitmaps/native/clock_digits.320x240x16.bmp | |||
Binary files differ | |||
diff --git a/apps/plugins/bitmaps/native/clock_logo.112x64x1.bmp b/apps/plugins/bitmaps/native/clock_logo.112x64x1.bmp new file mode 100644 index 0000000000..47b6cddf73 --- /dev/null +++ b/apps/plugins/bitmaps/native/clock_logo.112x64x1.bmp | |||
Binary files differ | |||
diff --git a/apps/plugins/bitmaps/native/clock_logo.128x128x16.bmp b/apps/plugins/bitmaps/native/clock_logo.128x128x16.bmp new file mode 100644 index 0000000000..65e16e160a --- /dev/null +++ b/apps/plugins/bitmaps/native/clock_logo.128x128x16.bmp | |||
Binary files differ | |||
diff --git a/apps/plugins/bitmaps/native/clock_logo.138x110x2.bmp b/apps/plugins/bitmaps/native/clock_logo.138x110x2.bmp new file mode 100644 index 0000000000..69a46fdbbb --- /dev/null +++ b/apps/plugins/bitmaps/native/clock_logo.138x110x2.bmp | |||
Binary files differ | |||
diff --git a/apps/plugins/bitmaps/native/clock_logo.160x128x16.bmp b/apps/plugins/bitmaps/native/clock_logo.160x128x16.bmp new file mode 100644 index 0000000000..b854cb6fbd --- /dev/null +++ b/apps/plugins/bitmaps/native/clock_logo.160x128x16.bmp | |||
Binary files differ | |||
diff --git a/apps/plugins/bitmaps/native/clock_logo.160x128x2.bmp b/apps/plugins/bitmaps/native/clock_logo.160x128x2.bmp new file mode 100644 index 0000000000..c69bfba2d7 --- /dev/null +++ b/apps/plugins/bitmaps/native/clock_logo.160x128x2.bmp | |||
Binary files differ | |||
diff --git a/apps/plugins/bitmaps/native/clock_logo.176x132x16.bmp b/apps/plugins/bitmaps/native/clock_logo.176x132x16.bmp new file mode 100644 index 0000000000..7621365295 --- /dev/null +++ b/apps/plugins/bitmaps/native/clock_logo.176x132x16.bmp | |||
Binary files differ | |||
diff --git a/apps/plugins/bitmaps/native/clock_logo.220x176x16.bmp b/apps/plugins/bitmaps/native/clock_logo.220x176x16.bmp new file mode 100644 index 0000000000..1267a392e0 --- /dev/null +++ b/apps/plugins/bitmaps/native/clock_logo.220x176x16.bmp | |||
Binary files differ | |||
diff --git a/apps/plugins/bitmaps/native/clock_logo.320x240x16.bmp b/apps/plugins/bitmaps/native/clock_logo.320x240x16.bmp new file mode 100644 index 0000000000..876543cebf --- /dev/null +++ b/apps/plugins/bitmaps/native/clock_logo.320x240x16.bmp | |||
Binary files differ | |||
diff --git a/apps/plugins/bitmaps/native/clock_messages.112x64x1.bmp b/apps/plugins/bitmaps/native/clock_messages.112x64x1.bmp new file mode 100644 index 0000000000..8cdc43155f --- /dev/null +++ b/apps/plugins/bitmaps/native/clock_messages.112x64x1.bmp | |||
Binary files differ | |||
diff --git a/apps/plugins/bitmaps/native/clock_messages.128x128x16.bmp b/apps/plugins/bitmaps/native/clock_messages.128x128x16.bmp new file mode 100644 index 0000000000..958beaf562 --- /dev/null +++ b/apps/plugins/bitmaps/native/clock_messages.128x128x16.bmp | |||
Binary files differ | |||
diff --git a/apps/plugins/bitmaps/native/clock_messages.138x110x2.bmp b/apps/plugins/bitmaps/native/clock_messages.138x110x2.bmp new file mode 100644 index 0000000000..a35690d535 --- /dev/null +++ b/apps/plugins/bitmaps/native/clock_messages.138x110x2.bmp | |||
Binary files differ | |||
diff --git a/apps/plugins/bitmaps/native/clock_messages.160x128x16.bmp b/apps/plugins/bitmaps/native/clock_messages.160x128x16.bmp new file mode 100644 index 0000000000..2020aea557 --- /dev/null +++ b/apps/plugins/bitmaps/native/clock_messages.160x128x16.bmp | |||
Binary files differ | |||
diff --git a/apps/plugins/bitmaps/native/clock_messages.160x128x2.bmp b/apps/plugins/bitmaps/native/clock_messages.160x128x2.bmp new file mode 100644 index 0000000000..19b12510c2 --- /dev/null +++ b/apps/plugins/bitmaps/native/clock_messages.160x128x2.bmp | |||
Binary files differ | |||
diff --git a/apps/plugins/bitmaps/native/clock_messages.176x132x16.bmp b/apps/plugins/bitmaps/native/clock_messages.176x132x16.bmp new file mode 100644 index 0000000000..ea2f9d9458 --- /dev/null +++ b/apps/plugins/bitmaps/native/clock_messages.176x132x16.bmp | |||
Binary files differ | |||
diff --git a/apps/plugins/bitmaps/native/clock_messages.220x176x16.bmp b/apps/plugins/bitmaps/native/clock_messages.220x176x16.bmp new file mode 100644 index 0000000000..9ca819d7e3 --- /dev/null +++ b/apps/plugins/bitmaps/native/clock_messages.220x176x16.bmp | |||
Binary files differ | |||
diff --git a/apps/plugins/bitmaps/native/clock_messages.320x240x16.bmp b/apps/plugins/bitmaps/native/clock_messages.320x240x16.bmp new file mode 100644 index 0000000000..cd075a9ea8 --- /dev/null +++ b/apps/plugins/bitmaps/native/clock_messages.320x240x16.bmp | |||
Binary files differ | |||
diff --git a/apps/plugins/bitmaps/native/clock_segments.112x64x1.bmp b/apps/plugins/bitmaps/native/clock_segments.112x64x1.bmp new file mode 100644 index 0000000000..15caccec22 --- /dev/null +++ b/apps/plugins/bitmaps/native/clock_segments.112x64x1.bmp | |||
Binary files differ | |||
diff --git a/apps/plugins/bitmaps/native/clock_segments.128x128x16.bmp b/apps/plugins/bitmaps/native/clock_segments.128x128x16.bmp new file mode 100644 index 0000000000..77090ced57 --- /dev/null +++ b/apps/plugins/bitmaps/native/clock_segments.128x128x16.bmp | |||
Binary files differ | |||
diff --git a/apps/plugins/bitmaps/native/clock_segments.138x110x2.bmp b/apps/plugins/bitmaps/native/clock_segments.138x110x2.bmp new file mode 100644 index 0000000000..e4b86e4ae0 --- /dev/null +++ b/apps/plugins/bitmaps/native/clock_segments.138x110x2.bmp | |||
Binary files differ | |||
diff --git a/apps/plugins/bitmaps/native/clock_segments.160x128x16.bmp b/apps/plugins/bitmaps/native/clock_segments.160x128x16.bmp new file mode 100644 index 0000000000..153f59cbb4 --- /dev/null +++ b/apps/plugins/bitmaps/native/clock_segments.160x128x16.bmp | |||
Binary files differ | |||
diff --git a/apps/plugins/bitmaps/native/clock_segments.160x128x2.bmp b/apps/plugins/bitmaps/native/clock_segments.160x128x2.bmp new file mode 100644 index 0000000000..a486a292c7 --- /dev/null +++ b/apps/plugins/bitmaps/native/clock_segments.160x128x2.bmp | |||
Binary files differ | |||
diff --git a/apps/plugins/bitmaps/native/clock_segments.220x176x16.bmp b/apps/plugins/bitmaps/native/clock_segments.220x176x16.bmp new file mode 100644 index 0000000000..e5e04f15a4 --- /dev/null +++ b/apps/plugins/bitmaps/native/clock_segments.220x176x16.bmp | |||
Binary files differ | |||
diff --git a/apps/plugins/bitmaps/native/clock_segments.320x240x16.bmp b/apps/plugins/bitmaps/native/clock_segments.320x240x16.bmp new file mode 100644 index 0000000000..8528a75f7b --- /dev/null +++ b/apps/plugins/bitmaps/native/clock_segments.320x240x16.bmp | |||
Binary files differ | |||
diff --git a/apps/plugins/bitmaps/native/clock_smalldigits.112x64x1.bmp b/apps/plugins/bitmaps/native/clock_smalldigits.112x64x1.bmp new file mode 100644 index 0000000000..54a0802d20 --- /dev/null +++ b/apps/plugins/bitmaps/native/clock_smalldigits.112x64x1.bmp | |||
Binary files differ | |||
diff --git a/apps/plugins/bitmaps/native/clock_smalldigits.128x128x16.bmp b/apps/plugins/bitmaps/native/clock_smalldigits.128x128x16.bmp new file mode 100644 index 0000000000..3e084ab99b --- /dev/null +++ b/apps/plugins/bitmaps/native/clock_smalldigits.128x128x16.bmp | |||
Binary files differ | |||
diff --git a/apps/plugins/bitmaps/native/clock_smalldigits.160x128x16.bmp b/apps/plugins/bitmaps/native/clock_smalldigits.160x128x16.bmp new file mode 100644 index 0000000000..3e084ab99b --- /dev/null +++ b/apps/plugins/bitmaps/native/clock_smalldigits.160x128x16.bmp | |||
Binary files differ | |||
diff --git a/apps/plugins/bitmaps/native/clock_smalldigits.160x128x2.bmp b/apps/plugins/bitmaps/native/clock_smalldigits.160x128x2.bmp new file mode 100644 index 0000000000..7f18582903 --- /dev/null +++ b/apps/plugins/bitmaps/native/clock_smalldigits.160x128x2.bmp | |||
Binary files differ | |||
diff --git a/apps/plugins/bitmaps/native/clock_smalldigits.220x176x16.bmp b/apps/plugins/bitmaps/native/clock_smalldigits.220x176x16.bmp new file mode 100644 index 0000000000..3e084ab99b --- /dev/null +++ b/apps/plugins/bitmaps/native/clock_smalldigits.220x176x16.bmp | |||
Binary files differ | |||
diff --git a/apps/plugins/bitmaps/native/clock_smalldigits.320x240x16.bmp b/apps/plugins/bitmaps/native/clock_smalldigits.320x240x16.bmp new file mode 100644 index 0000000000..c50c6d0a53 --- /dev/null +++ b/apps/plugins/bitmaps/native/clock_smalldigits.320x240x16.bmp | |||
Binary files differ | |||
diff --git a/apps/plugins/bitmaps/native/clock_smallsegments.112x64x1.bmp b/apps/plugins/bitmaps/native/clock_smallsegments.112x64x1.bmp new file mode 100644 index 0000000000..767e25556e --- /dev/null +++ b/apps/plugins/bitmaps/native/clock_smallsegments.112x64x1.bmp | |||
Binary files differ | |||
diff --git a/apps/plugins/bitmaps/native/clock_smallsegments.128x128x16.bmp b/apps/plugins/bitmaps/native/clock_smallsegments.128x128x16.bmp new file mode 100644 index 0000000000..058c3cc98f --- /dev/null +++ b/apps/plugins/bitmaps/native/clock_smallsegments.128x128x16.bmp | |||
Binary files differ | |||
diff --git a/apps/plugins/bitmaps/native/clock_smallsegments.160x128x16.bmp b/apps/plugins/bitmaps/native/clock_smallsegments.160x128x16.bmp new file mode 100644 index 0000000000..52281d29a4 --- /dev/null +++ b/apps/plugins/bitmaps/native/clock_smallsegments.160x128x16.bmp | |||
Binary files differ | |||
diff --git a/apps/plugins/bitmaps/native/clock_smallsegments.160x128x2.bmp b/apps/plugins/bitmaps/native/clock_smallsegments.160x128x2.bmp new file mode 100644 index 0000000000..7d41114935 --- /dev/null +++ b/apps/plugins/bitmaps/native/clock_smallsegments.160x128x2.bmp | |||
Binary files differ | |||
diff --git a/apps/plugins/bitmaps/native/clock_smallsegments.220x176x16.bmp b/apps/plugins/bitmaps/native/clock_smallsegments.220x176x16.bmp new file mode 100644 index 0000000000..058c3cc98f --- /dev/null +++ b/apps/plugins/bitmaps/native/clock_smallsegments.220x176x16.bmp | |||
Binary files differ | |||
diff --git a/apps/plugins/bitmaps/native/clock_smallsegments.320x240x16.bmp b/apps/plugins/bitmaps/native/clock_smallsegments.320x240x16.bmp new file mode 100644 index 0000000000..88366e6de7 --- /dev/null +++ b/apps/plugins/bitmaps/native/clock_smallsegments.320x240x16.bmp | |||
Binary files differ | |||
diff --git a/apps/plugins/clock.c b/apps/plugins/clock.c index 19c7dac4aa..1f710e0983 100644 --- a/apps/plugins/clock.c +++ b/apps/plugins/clock.c | |||
@@ -5,7 +5,7 @@ | |||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | 5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < |
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | 6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ |
7 | * \/ \/ \/ \/ \/ | 7 | * \/ \/ \/ \/ \/ |
8 | * $Id: clock.c,v 3.00 2003/12/8 | 8 | * $Id$ |
9 | * | 9 | * |
10 | * Copyright (C) 2003 Zakk Roberts | 10 | * Copyright (C) 2003 Zakk Roberts |
11 | * | 11 | * |
@@ -26,9 +26,9 @@ and plain mode. The Time's Up logo could also be updated. | |||
26 | 26 | ||
27 | ***** VERSION 3.00 ** | 27 | ***** VERSION 3.00 ** |
28 | New, simpler UI - every screen can be accessed from the new Main Menu. | 28 | New, simpler UI - every screen can be accessed from the new Main Menu. |
29 | Huge code cleanup - many major functions rewritten. Functions optimized, | 29 | Huge code cleanup - many major functions rewritten and optimized, |
30 | targetting scalability. Number of variables reduced majorly. Faster, simpler. | 30 | targeting scalability. Number of variables reduced majorly. |
31 | New clock mode: plain (simple, large text). ON now controls counter | 31 | New clock mode: Plain (simple, large text). ON now controls counter |
32 | (press toggle/hold reset). Fancier credits roll. New logo. iRiver and iPod ports | 32 | (press toggle/hold reset). Fancier credits roll. New logo. iRiver and iPod ports |
33 | are working but not yet scaled to fit their LCDs. | 33 | are working but not yet scaled to fit their LCDs. |
34 | 34 | ||
@@ -37,26 +37,25 @@ Fixed general settings typo, split up settings function, added cursor animations | |||
37 | and updated cursor look (rounded edges). | 37 | and updated cursor look (rounded edges). |
38 | 38 | ||
39 | ***** VERSION 2.51 ** | 39 | ***** VERSION 2.51 ** |
40 | -"Show Counter" option is now saved to disk | 40 | "Show Counter" option is now saved to disk |
41 | 41 | ||
42 | ***** VERSION 2.50 ** | 42 | ***** VERSION 2.50 ** |
43 | -New general settings mode added, -reworked options screen, | 43 | New general settings mode added, reworked options screen, cleaned up a few |
44 | -cleaned up a few things and removed redundant code, -faster | 44 | things and removed redundant code, faster load_settings(), fixed a |
45 | load_settings(), fixed a help-screen bug (thanks to zeekoe) | 45 | help-screen bug (thanks to zeekoe) |
46 | 46 | ||
47 | ***** VERSION 2.40 ** | 47 | ***** VERSION 2.40 ** |
48 | -Cleaned and optimized code, -removed unused code and bitmaps, | 48 | Cleaned and optimized code, removed unused code/bitmaps, credits screen updated, |
49 | -Progressbar and more animations at credits screen, -centered | 49 | centered text all over, general settings added at ON+F3, |
50 | text all over, -general settings added at ON+F3, -new arrow bitmap | 50 | new arrow bitmap for general settings and mode selector, |
51 | for general settings and mode selector, -bugfix: 12:00AM is no longer | 51 | bugfix: 12:00AM is no longer 00:00AM |
52 | 00:00AM | ||
53 | 52 | ||
54 | ***** VERSION 2.31 ** | 53 | ***** VERSION 2.31 ** |
55 | Fixed credits roll - now displays all names. Features | 54 | Fixed credits roll - now displays all names. Features |
56 | improved animations. Also revised release notes. | 55 | improved animations. Also revised release notes. |
57 | 56 | ||
58 | ***** VERSION 2.30 ** | 57 | ***** VERSION 2.30 ** |
59 | Tab indentation removed, and -Counter screen added | 58 | Tab indentation removed, and Counter screen added |
60 | at ON+F2, with countdown options | 59 | at ON+F2, with countdown options |
61 | 60 | ||
62 | ***** VERSION 2.22 ** | 61 | ***** VERSION 2.22 ** |
@@ -68,210 +67,251 @@ Digital settings are now independent of LCD settings | |||
68 | -Changed the behaviour of F2 | 67 | -Changed the behaviour of F2 |
69 | 68 | ||
70 | ***** VERSION 2.20 ** | 69 | ***** VERSION 2.20 ** |
71 | Few small bugs taken care of. New features: -New binary mode, | 70 | Few small bugs taken care of. New features: |
72 | -new mode selector, -new feature, "counter", and -redesigned help screen. | 71 | New binary mode, new mode selector, "counter", and redesigned help screen. |
73 | 72 | ||
74 | ***** VERSION 2.10 ** | 73 | ***** VERSION 2.10 ** |
75 | New bug fixes, and some new features: -an LCD imitation mode, and | 74 | New bug fixes, and some new features: |
76 | -American and European date modes are an option. | 75 | an LCD imitation mode, and American and European date modes. |
77 | 76 | ||
78 | ***** VERSION 2.00 [BETA] ** | 77 | ***** VERSION 2.00 ** |
79 | Major update, lots of bugfixes and new features. | 78 | Major update, lots of bugfixes and new features. |
80 | New Features: -Fullscreen mode introduced, -modes have independent | 79 | Fullscreen mode introduced, modes have independent settings, credit roll |
81 | settings, -credit roll added, -options screen reworked, -logo selector, | 80 | added, options screen reworked, logo selector, and -much- cleaner code. |
82 | and -much- cleaner code. Analog changes include: -removed border option, | ||
83 | and -added both 12/24h time readouts. Digital changes include: -centered | ||
84 | second and date readouts and also -introduced two new additional ways | ||
85 | of graphically conveying second progress: a bar, and a LCD-invert mode. | ||
86 | 81 | ||
87 | ***** VERSION 1.0 ** | 82 | ***** VERSION 1.0 ** |
88 | Original release, featuring analog / digital modes and a few options. | 83 | Original release, featuring analog/digital modes and a few options. |
89 | *****************************/ | 84 | *****************************/ |
90 | #include "plugin.h" | 85 | #include "plugin.h" |
91 | #include "time.h" | 86 | #include "time.h" |
92 | #include "checkbox.h" | 87 | #include "checkbox.h" |
93 | #include <pluginbitmaps/clock_logo.h> | 88 | #include "xlcd.h" |
94 | 89 | ||
95 | PLUGIN_HEADER | 90 | PLUGIN_HEADER |
96 | 91 | ||
97 | #define CLOCK_VERSION "v3.10" | 92 | /* External bitmap references */ |
98 | 93 | extern const fb_data clock_digits[]; | |
99 | #define ANALOG 1 | 94 | extern const fb_data clock_smalldigits[]; |
100 | #define DIGITAL 2 | 95 | extern const fb_data clock_segments[]; |
101 | #define LCD 3 | 96 | extern const fb_data clock_smallsegments[]; |
102 | #define FULLSCREEN 4 | 97 | extern const fb_data clock_logo[]; |
103 | #define BINARY 5 | 98 | extern const fb_data clock_messages[]; |
104 | #define PLAIN 6 | 99 | extern const fb_data clock_timesup[]; |
105 | 100 | ||
106 | #define OFFSET 1 | 101 | /* Bitmap sizes/positions/deltas, per LCD size */ |
107 | 102 | #if (LCD_WIDTH >= 320) && (LCD_HEIGHT >=240) && (LCD_DEPTH >= 16) /* iPod 5G */ | |
108 | #define UP 1 | 103 | #define DIGIT_WIDTH 50 |
109 | #define DOWN -1 | 104 | #define DIGIT_HEIGHT 70 |
110 | 105 | #define SMALLDIGIT_WIDTH 15 | |
111 | /* we need to "fake" the LCD width/height, because this plugin isn't | 106 | #define SMALLDIGIT_HEIGHT 21 |
112 | * yet adapted to other screen sizes */ | 107 | #define SMALLSEG_WIDTH 15 |
113 | #define LCDWIDTH LCD_WIDTH | 108 | #define SMALLSEG_HEIGHT 21 |
114 | #define LCDHEIGHT LCD_HEIGHT | 109 | #define MESSAGE_HEIGHT 40 |
115 | #define CENTERX LCD_WIDTH/2 | 110 | #define MESSAGE_WIDTH 320 |
116 | #define CENTERY LCD_HEIGHT/2 | 111 | #define LOGO_WIDTH 320 |
112 | #define LOGO_HEIGHT 160 | ||
113 | #define LCD_OFFSET 1.5 | ||
114 | #define HAND_W 3 | ||
115 | #elif (LCD_WIDTH >= 220) && (LCD_HEIGHT >= 176) && (LCD_DEPTH >= 16) /* H300 */ | ||
116 | #define DIGIT_WIDTH 35 | ||
117 | #define DIGIT_HEIGHT 49 | ||
118 | #define SMALLDIGIT_WIDTH 10 | ||
119 | #define SMALLDIGIT_HEIGHT 14 | ||
120 | #define SMALLSEG_WIDTH 10 | ||
121 | #define SMALLSEG_HEIGHT 14 | ||
122 | #define MESSAGE_HEIGHT 27 | ||
123 | #define MESSAGE_WIDTH 220 | ||
124 | #define LOGO_WIDTH 220 | ||
125 | #define LOGO_HEIGHT 110 | ||
126 | #define LCD_OFFSET 1.5 | ||
127 | #define HAND_W 3 | ||
128 | #elif (LCD_WIDTH >= 176) && (LCD_HEIGHT >= 132) && (LCD_DEPTH >=16) /* Nano */ | ||
129 | #define DIGIT_WIDTH 25 | ||
130 | #define DIGIT_HEIGHT 35 | ||
131 | #define SMALLDIGIT_WIDTH 10 | ||
132 | #define SMALLDIGIT_HEIGHT 14 | ||
133 | #define SMALLSEG_WIDTH 10 | ||
134 | #define SMALLSEG_HEIGHT 14 | ||
135 | #define MESSAGE_HEIGHT 22 | ||
136 | #define MESSAGE_WIDTH 176 | ||
137 | #define LOGO_WIDTH 176 | ||
138 | #define LOGO_HEIGHT 88 | ||
139 | #define LCD_OFFSET 1.5 | ||
140 | #define HAND_W 3 | ||
141 | #elif (LCD_WIDTH >= 160) && (LCD_HEIGHT >= 128) && (LCD_DEPTH >=16) /* iAudio, H10 */ | ||
142 | #define DIGIT_WIDTH 25 | ||
143 | #define DIGIT_HEIGHT 35 | ||
144 | #define SMALLDIGIT_WIDTH 10 | ||
145 | #define SMALLDIGIT_HEIGHT 14 | ||
146 | #define SMALLSEG_WIDTH 10 | ||
147 | #define SMALLSEG_HEIGHT 14 | ||
148 | #define MESSAGE_HEIGHT 20 | ||
149 | #define MESSAGE_WIDTH 160 | ||
150 | #define LOGO_WIDTH 160 | ||
151 | #define LOGO_HEIGHT 80 | ||
152 | #define LCD_OFFSET 1.5 | ||
153 | #define HAND_W 3 | ||
154 | #elif (LCD_WIDTH >= 128) && (LCD_HEIGHT >= 128) && (LCD_DEPTH >=16) /* H10 5/6GB */ | ||
155 | #define DIGIT_WIDTH 20 | ||
156 | #define DIGIT_HEIGHT 28 | ||
157 | #define SMALLDIGIT_WIDTH 10 | ||
158 | #define SMALLDIGIT_HEIGHT 14 | ||
159 | #define SMALLSEG_WIDTH 10 | ||
160 | #define SMALLSEG_HEIGHT 14 | ||
161 | #define MESSAGE_HEIGHT 16 | ||
162 | #define MESSAGE_WIDTH 128 | ||
163 | #define LOGO_WIDTH 128 | ||
164 | #define LOGO_HEIGHT 64 | ||
165 | #define LCD_OFFSET 1.5 | ||
166 | #define HAND_W 3 | ||
167 | #elif (LCD_WIDTH >= 160) && (LCD_HEIGHT >= 128) && (LCD_DEPTH >=2) /* iPod 3G, 4G */ | ||
168 | #define DIGIT_WIDTH 25 | ||
169 | #define DIGIT_HEIGHT 35 | ||
170 | #define SMALLDIGIT_WIDTH 10 | ||
171 | #define SMALLDIGIT_HEIGHT 14 | ||
172 | #define SMALLSEG_WIDTH 10 | ||
173 | #define SMALLSEG_HEIGHT 14 | ||
174 | #define MESSAGE_HEIGHT 20 | ||
175 | #define MESSAGE_WIDTH 160 | ||
176 | #define LOGO_WIDTH 160 | ||
177 | #define LOGO_HEIGHT 80 | ||
178 | #define LCD_OFFSET 1.5 | ||
179 | #define HAND_W 3 | ||
180 | #elif (LCD_WIDTH >= 138) && (LCD_HEIGHT >= 110) && (LCD_DEPTH >=2) /* iPod mini */ | ||
181 | #define DIGIT_WIDTH 23 | ||
182 | #define DIGIT_HEIGHT 32 | ||
183 | #define SMALLDIGIT_WIDTH 10 | ||
184 | #define SMALLDIGIT_HEIGHT 14 | ||
185 | #define SMALLSEG_WIDTH 10 | ||
186 | #define SMALLSEG_HEIGHT 14 | ||
187 | #define MESSAGE_HEIGHT 17 | ||
188 | #define MESSAGE_WIDTH 138 | ||
189 | #define LOGO_WIDTH 138 | ||
190 | #define LOGO_HEIGHT 69 | ||
191 | #define LCD_OFFSET 1.5 | ||
192 | #define HAND_W 3 | ||
193 | #elif (LCD_WIDTH >= 112) && (LCD_HEIGHT >= 64) && (LCD_DEPTH >= 1) /* Archos */ | ||
194 | #define DIGIT_WIDTH 16 | ||
195 | #define DIGIT_HEIGHT 20 | ||
196 | #define SMALLDIGIT_WIDTH 8 | ||
197 | #define SMALLDIGIT_HEIGHT 10 | ||
198 | #define SMALLSEG_WIDTH 10 | ||
199 | #define SMALLSEG_HEIGHT 12 | ||
200 | #define MESSAGE_HEIGHT 14 | ||
201 | #define MESSAGE_WIDTH 112 | ||
202 | #define LOGO_WIDTH 112 | ||
203 | #define LOGO_HEIGHT 50 | ||
204 | #define LCD_OFFSET 1 | ||
205 | #define HAND_W 2 | ||
206 | #endif | ||
117 | 207 | ||
208 | /* Parts of larger bitmaps */ | ||
209 | #define COLON 10 | ||
210 | #define DOT_FILLED 11 | ||
211 | #define DOT_EMPTY 12 | ||
212 | #define ICON_PM 13 | ||
213 | #define ICON_AM 14 | ||
214 | #define SEGMENT_AM 11 | ||
215 | #define SEGMENT_PM 12 | ||
216 | #define SLASH 11 | ||
217 | #define PERIOD 12 | ||
218 | |||
219 | /* Message names/values */ | ||
220 | #define MESSAGE_LOADING 0 | ||
221 | #define MESSAGE_LOADED 1 | ||
222 | #define MESSAGE_ERRLOAD 2 | ||
223 | #define MESSAGE_SAVING 3 | ||
224 | #define MESSAGE_SAVED 4 | ||
225 | #define MESSAGE_ERRSAVE 5 | ||
226 | |||
227 | /* Some macros to simplify drawing et al */ | ||
228 | #define draw_digit( num, x, y )\ | ||
229 | rb->lcd_bitmap_part( clock_digits, 0, num * DIGIT_HEIGHT, \ | ||
230 | DIGIT_WIDTH, x, y, DIGIT_WIDTH, DIGIT_HEIGHT ) | ||
231 | #define draw_smalldigit( num, x, y )\ | ||
232 | rb->lcd_bitmap_part( clock_smalldigits, 0, num * SMALLDIGIT_HEIGHT, \ | ||
233 | SMALLDIGIT_WIDTH, x, y, SMALLDIGIT_WIDTH, SMALLDIGIT_HEIGHT ) | ||
234 | #define draw_segment( num, x, y )\ | ||
235 | rb->lcd_bitmap_part( clock_segments, 0, num * DIGIT_HEIGHT, \ | ||
236 | DIGIT_WIDTH, x, y, DIGIT_WIDTH, DIGIT_HEIGHT ) | ||
237 | #define draw_smallsegment( num, x, y )\ | ||
238 | rb->lcd_bitmap_part( clock_smallsegments, 0, num * SMALLSEG_HEIGHT, \ | ||
239 | SMALLSEG_WIDTH, x, y, SMALLSEG_WIDTH, SMALLSEG_HEIGHT ) | ||
240 | #define draw_message( msg, ypos )\ | ||
241 | rb->lcd_bitmap_part( clock_messages, 0, msg*MESSAGE_HEIGHT, MESSAGE_WIDTH, \ | ||
242 | 0, LCD_HEIGHT-(MESSAGE_HEIGHT*ypos), MESSAGE_WIDTH, MESSAGE_HEIGHT ) | ||
243 | #define DIGIT_XOFS(x) (LCD_WIDTH-x*DIGIT_WIDTH)/2 | ||
244 | #define DIGIT_YOFS(x) (LCD_HEIGHT-x*DIGIT_HEIGHT)/2 | ||
245 | #define SMALLDIGIT_XOFS(x) (LCD_WIDTH-x*SMALLDIGIT_WIDTH)/2 | ||
246 | #define SMALLDIGIT_YOFS(x) (LCD_HEIGHT-x*SMALLDIGIT_HEIGHT)/2 | ||
247 | #define SMALLSEG_XOFS(x) (LCD_WIDTH-x*SMALLSEG_WIDTH)/2 | ||
248 | #define SMALLSEG_YOFS(x) (LCD_HEIGHT-x*SMALLSEG_HEIGHT)/2 | ||
249 | |||
250 | /* Keymaps */ | ||
118 | #if (CONFIG_KEYPAD == RECORDER_PAD) | 251 | #if (CONFIG_KEYPAD == RECORDER_PAD) |
119 | |||
120 | #define COUNTER_TOGGLE_BUTTON (BUTTON_ON|BUTTON_REL) | 252 | #define COUNTER_TOGGLE_BUTTON (BUTTON_ON|BUTTON_REL) |
121 | #define COUNTER_RESET_BUTTON (BUTTON_ON|BUTTON_REPEAT) | 253 | #define COUNTER_RESET_BUTTON (BUTTON_ON|BUTTON_REPEAT) |
122 | #define MENU_BUTTON BUTTON_PLAY | 254 | #define MENU_BUTTON BUTTON_PLAY |
123 | #define ALT_MENU_BUTTON BUTTON_F1 | 255 | #define ALT_MENU_BUTTON BUTTON_F1 |
124 | #define EXIT_BUTTON BUTTON_OFF | 256 | #define EXIT_BUTTON BUTTON_OFF |
125 | #define MOVE_UP_BUTTON BUTTON_UP | 257 | #define MODE_NEXT_BUTTON BUTTON_RIGHT |
126 | #define MOVE_DOWN_BUTTON BUTTON_DOWN | 258 | #define MODE_PREV_BUTTON BUTTON_LEFT |
127 | #define CHANGE_UP_BUTTON BUTTON_RIGHT | ||
128 | #define CHANGE_DOWN_BUTTON BUTTON_LEFT | ||
129 | |||
130 | #define YESTEXT "Play" | ||
131 | #define NAVI_BUTTON_TEXT_LEFT "LEFT" | ||
132 | #define NAVI_BUTTON_TEXT_RIGHT "RIGHT" | ||
133 | #define EXIT_BUTTON_TEXT "OFF" | ||
134 | #define MENU_BUTTON_TEXT "PLAY" | ||
135 | #define COUNTER_BUTTON_TEXT "ON" | ||
136 | |||
137 | #elif (CONFIG_KEYPAD == ARCHOS_AV300_PAD) | 259 | #elif (CONFIG_KEYPAD == ARCHOS_AV300_PAD) |
138 | |||
139 | #define COUNTER_TOGGLE_BUTTON (BUTTON_ON|BUTTON_REL) | 260 | #define COUNTER_TOGGLE_BUTTON (BUTTON_ON|BUTTON_REL) |
140 | #define COUNTER_RESET_BUTTON (BUTTON_ON|BUTTON_REPEAT) | 261 | #define COUNTER_RESET_BUTTON (BUTTON_ON|BUTTON_REPEAT) |
141 | #define MENU_BUTTON BUTTON_SELECT | 262 | #define MENU_BUTTON BUTTON_SELECT |
142 | #define ALT_MENU_BUTTON BUTTON_F1 | 263 | #define ALT_MENU_BUTTON BUTTON_F1 |
143 | #define EXIT_BUTTON BUTTON_OFF | 264 | #define EXIT_BUTTON BUTTON_OFF |
144 | #define MOVE_UP_BUTTON BUTTON_UP | 265 | #define MODE_NEXT_BUTTON BUTTON_RIGHT |
145 | #define MOVE_DOWN_BUTTON BUTTON_DOWN | 266 | #define MODE_PREV_BUTTON BUTTON_LEFT |
146 | #define CHANGE_UP_BUTTON BUTTON_RIGHT | ||
147 | #define CHANGE_DOWN_BUTTON BUTTON_LEFT | ||
148 | |||
149 | #define YESTEXT "Select" | ||
150 | #define NAVI_BUTTON_TEXT_LEFT "LEFT" | ||
151 | #define NAVI_BUTTON_TEXT_RIGHT "RIGHT" | ||
152 | #define EXIT_BUTTON_TEXT "OFF" | ||
153 | #define MENU_BUTTON_TEXT "SELECT" | ||
154 | #define COUNTER_BUTTON_TEXT "ON" | ||
155 | |||
156 | #elif (CONFIG_KEYPAD == IPOD_4G_PAD) || (CONFIG_KEYPAD == IPOD_3G_PAD) | 267 | #elif (CONFIG_KEYPAD == IPOD_4G_PAD) || (CONFIG_KEYPAD == IPOD_3G_PAD) |
157 | |||
158 | #define COUNTER_TOGGLE_BUTTON (BUTTON_PLAY|BUTTON_REL) | 268 | #define COUNTER_TOGGLE_BUTTON (BUTTON_PLAY|BUTTON_REL) |
159 | #define COUNTER_RESET_BUTTON (BUTTON_PLAY|BUTTON_REPEAT) | 269 | #define COUNTER_RESET_BUTTON (BUTTON_PLAY|BUTTON_REPEAT) |
160 | #define MENU_BUTTON BUTTON_SELECT | 270 | #define MENU_BUTTON BUTTON_SELECT |
161 | #define EXIT_BUTTON BUTTON_MENU | 271 | #define EXIT_BUTTON BUTTON_MENU |
162 | #define MOVE_UP_BUTTON BUTTON_SCROLL_BACK | 272 | #define MODE_NEXT_BUTTON BUTTON_RIGHT |
163 | #define MOVE_DOWN_BUTTON BUTTON_SCROLL_FWD | 273 | #define MODE_PREV_BUTTON BUTTON_LEFT |
164 | #define CHANGE_UP_BUTTON BUTTON_RIGHT | ||
165 | #define CHANGE_DOWN_BUTTON BUTTON_LEFT | ||
166 | |||
167 | #define YESTEXT "Select" | ||
168 | #define NAVI_BUTTON_TEXT_LEFT "LEFT" | ||
169 | #define NAVI_BUTTON_TEXT_RIGHT "RIGHT" | ||
170 | #define EXIT_BUTTON_TEXT "MENU" | ||
171 | #define MENU_BUTTON_TEXT "SELECT" | ||
172 | #define COUNTER_BUTTON_TEXT "PLAY" | ||
173 | |||
174 | #elif (CONFIG_KEYPAD == IRIVER_H300_PAD) | 274 | #elif (CONFIG_KEYPAD == IRIVER_H300_PAD) |
175 | |||
176 | #define COUNTER_TOGGLE_BUTTON (BUTTON_ON|BUTTON_REL) | 275 | #define COUNTER_TOGGLE_BUTTON (BUTTON_ON|BUTTON_REL) |
177 | #define COUNTER_RESET_BUTTON (BUTTON_ON|BUTTON_REPEAT) | 276 | #define COUNTER_RESET_BUTTON (BUTTON_ON|BUTTON_REPEAT) |
178 | #define MENU_BUTTON BUTTON_SELECT | 277 | #define MENU_BUTTON BUTTON_SELECT |
179 | #define EXIT_BUTTON BUTTON_OFF | 278 | #define EXIT_BUTTON BUTTON_OFF |
180 | #define MOVE_UP_BUTTON BUTTON_UP | 279 | #define MODE_NEXT_BUTTON BUTTON_RIGHT |
181 | #define MOVE_DOWN_BUTTON BUTTON_DOWN | 280 | #define MODE_PREV_BUTTON BUTTON_LEFT |
182 | #define CHANGE_UP_BUTTON BUTTON_RIGHT | ||
183 | #define CHANGE_DOWN_BUTTON BUTTON_LEFT | ||
184 | |||
185 | #define EXIT_RC_BUTTON BUTTON_RC_STOP | 281 | #define EXIT_RC_BUTTON BUTTON_RC_STOP |
186 | |||
187 | #define YESTEXT "Select/Navi" | ||
188 | #define NAVI_BUTTON_TEXT_LEFT "LEFT" | ||
189 | #define NAVI_BUTTON_TEXT_RIGHT "RIGHT" | ||
190 | #define EXIT_BUTTON_TEXT "STOP" | ||
191 | #define MENU_BUTTON_TEXT "NAVI" | ||
192 | #define COUNTER_BUTTON_TEXT "PLAY" | ||
193 | |||
194 | #elif (CONFIG_KEYPAD == IAUDIO_X5_PAD) | 282 | #elif (CONFIG_KEYPAD == IAUDIO_X5_PAD) |
195 | |||
196 | #define COUNTER_TOGGLE_BUTTON (BUTTON_PLAY|BUTTON_REL) | 283 | #define COUNTER_TOGGLE_BUTTON (BUTTON_PLAY|BUTTON_REL) |
197 | #define COUNTER_RESET_BUTTON (BUTTON_PLAY|BUTTON_REPEAT) | 284 | #define COUNTER_RESET_BUTTON (BUTTON_PLAY|BUTTON_REPEAT) |
198 | #define MENU_BUTTON BUTTON_SELECT | 285 | #define MENU_BUTTON BUTTON_SELECT |
199 | #define EXIT_BUTTON BUTTON_POWER | 286 | #define EXIT_BUTTON BUTTON_POWER |
200 | #define MOVE_UP_BUTTON BUTTON_UP | 287 | #define MODE_NEXT_BUTTON BUTTON_RIGHT |
201 | #define MOVE_DOWN_BUTTON BUTTON_DOWN | 288 | #define MODE_PREV_BUTTON BUTTON_LEFT |
202 | #define CHANGE_UP_BUTTON BUTTON_RIGHT | ||
203 | #define CHANGE_DOWN_BUTTON BUTTON_LEFT | ||
204 | |||
205 | #define YESTEXT "Select" | ||
206 | #define NAVI_BUTTON_TEXT_LEFT "LEFT" | ||
207 | #define NAVI_BUTTON_TEXT_RIGHT "RIGHT" | ||
208 | #define EXIT_BUTTON_TEXT "POWER" | ||
209 | #define MENU_BUTTON_TEXT "SELECT" | ||
210 | #define COUNTER_BUTTON_TEXT "PLAY" | ||
211 | |||
212 | #elif (CONFIG_KEYPAD == SANSA_E200_PAD) | 289 | #elif (CONFIG_KEYPAD == SANSA_E200_PAD) |
213 | |||
214 | #define COUNTER_TOGGLE_BUTTON BUTTON_UP | 290 | #define COUNTER_TOGGLE_BUTTON BUTTON_UP |
215 | #define COUNTER_RESET_BUTTON BUTTON_DOWN | 291 | #define COUNTER_RESET_BUTTON BUTTON_DOWN |
216 | #define MENU_BUTTON BUTTON_SELECT | 292 | #define MENU_BUTTON BUTTON_SELECT |
217 | #define EXIT_BUTTON BUTTON_POWER | 293 | #define EXIT_BUTTON BUTTON_POWER |
218 | #define MOVE_UP_BUTTON BUTTON_SCROLL_UP | 294 | #define MODE_NEXT_BUTTON BUTTON_RIGHT |
219 | #define MOVE_DOWN_BUTTON BUTTON_SCROLL_DOWN | 295 | #define MODE_PREV_BUTTON BUTTON_LEFT |
220 | #define CHANGE_UP_BUTTON BUTTON_RIGHT | ||
221 | #define CHANGE_DOWN_BUTTON BUTTON_LEFT | ||
222 | |||
223 | #define YESTEXT "Select" | ||
224 | #define NAVI_BUTTON_TEXT_LEFT "LEFT" | ||
225 | #define NAVI_BUTTON_TEXT_RIGHT "RIGHT" | ||
226 | #define EXIT_BUTTON_TEXT "POWER" | ||
227 | #define MENU_BUTTON_TEXT "PLAY" | ||
228 | #define COUNTER_BUTTON_TEXT "PLAY" | ||
229 | |||
230 | |||
231 | |||
232 | #elif (CONFIG_KEYPAD == IRIVER_H10_PAD) | 296 | #elif (CONFIG_KEYPAD == IRIVER_H10_PAD) |
233 | |||
234 | #define COUNTER_TOGGLE_BUTTON (BUTTON_PLAY|BUTTON_REL) | 297 | #define COUNTER_TOGGLE_BUTTON (BUTTON_PLAY|BUTTON_REL) |
235 | #define COUNTER_RESET_BUTTON (BUTTON_PLAY|BUTTON_REPEAT) | 298 | #define COUNTER_RESET_BUTTON (BUTTON_PLAY|BUTTON_REPEAT) |
236 | #define MENU_BUTTON BUTTON_REW | 299 | #define MENU_BUTTON BUTTON_REW |
237 | #define EXIT_BUTTON BUTTON_POWER | 300 | #define EXIT_BUTTON BUTTON_POWER |
238 | #define MOVE_UP_BUTTON BUTTON_SCROLL_UP | 301 | #define MODE_NEXT_BUTTON BUTTON_RIGHT |
239 | #define MOVE_DOWN_BUTTON BUTTON_SCROLL_DOWN | 302 | #define MODE_PREV_BUTTON BUTTON_LEFT |
240 | #define CHANGE_UP_BUTTON BUTTON_RIGHT | ||
241 | #define CHANGE_DOWN_BUTTON BUTTON_LEFT | ||
242 | |||
243 | #define YESTEXT "Select" | ||
244 | #define NAVI_BUTTON_TEXT_LEFT "LEFT" | ||
245 | #define NAVI_BUTTON_TEXT_RIGHT "RIGHT" | ||
246 | #define EXIT_BUTTON_TEXT "POWER" | ||
247 | #define MENU_BUTTON_TEXT "PLAY" | ||
248 | #define COUNTER_BUTTON_TEXT "PLAY" | ||
249 | |||
250 | #elif (CONFIG_KEYPAD == GIGABEAT_PAD) | 303 | #elif (CONFIG_KEYPAD == GIGABEAT_PAD) |
251 | |||
252 | #define COUNTER_TOGGLE_BUTTON (BUTTON_SELECT|BUTTON_REL) | 304 | #define COUNTER_TOGGLE_BUTTON (BUTTON_SELECT|BUTTON_REL) |
253 | #define COUNTER_RESET_BUTTON (BUTTON_SELECT|BUTTON_REPEAT) | 305 | #define COUNTER_RESET_BUTTON (BUTTON_SELECT|BUTTON_REPEAT) |
254 | #define MENU_BUTTON BUTTON_MENU | 306 | #define MENU_BUTTON BUTTON_MENU |
255 | #define EXIT_BUTTON BUTTON_A | 307 | #define EXIT_BUTTON BUTTON_A |
256 | #define MOVE_UP_BUTTON BUTTON_UP | 308 | #define MODE_NEXT_BUTTON BUTTON_RIGHT |
257 | #define MOVE_DOWN_BUTTON BUTTON_DOWN | 309 | #define MODE_PREV_BUTTON BUTTON_LEFT |
258 | #define CHANGE_UP_BUTTON BUTTON_RIGHT | ||
259 | #define CHANGE_DOWN_BUTTON BUTTON_LEFT | ||
260 | |||
261 | #define YESTEXT "Select" | ||
262 | #define NAVI_BUTTON_TEXT_LEFT "LEFT" | ||
263 | #define NAVI_BUTTON_TEXT_RIGHT "RIGHT" | ||
264 | #define EXIT_BUTTON_TEXT "A" | ||
265 | #define MENU_BUTTON_TEXT "CENTER" | ||
266 | #define COUNTER_BUTTON_TEXT "CENTER" | ||
267 | |||
268 | #endif | 310 | #endif |
269 | 311 | ||
270 | /************ | 312 | /************ |
271 | * Prototypes | 313 | * Prototypes |
272 | ***********/ | 314 | ***********/ |
273 | void show_clock_logo(bool animate, bool show_clock_text); | ||
274 | void exit_logo(void); | ||
275 | void save_settings(bool interface); | 315 | void save_settings(bool interface); |
276 | 316 | ||
277 | /******************** | 317 | /******************** |
@@ -282,512 +322,209 @@ int passed_time = 0; | |||
282 | int counter = 0; | 322 | int counter = 0; |
283 | int displayed_value = 0; | 323 | int displayed_value = 0; |
284 | int count_h, count_m, count_s; | 324 | int count_h, count_m, count_s; |
285 | char count_text[8]; | ||
286 | bool counting = false; | 325 | bool counting = false; |
287 | bool counting_up = true; | ||
288 | int target_hour=0, target_minute=0, target_second=0; | ||
289 | int remaining_h=0, remaining_m=0, remaining_s=0; | ||
290 | bool editing_target = false; | ||
291 | |||
292 | /********************* | ||
293 | * Used to center text | ||
294 | ********************/ | ||
295 | char buf[20]; | ||
296 | int buf_w, buf_h; | ||
297 | 326 | ||
298 | /******************** | 327 | /******************** |
299 | * Everything else... | 328 | * Everything else... |
300 | *******************/ | 329 | *******************/ |
301 | int menupos = 1; | ||
302 | bool idle_poweroff = true; /* poweroff activated or not? */ | 330 | bool idle_poweroff = true; /* poweroff activated or not? */ |
303 | 331 | bool done = false; /* used for most of the while loops */ | |
304 | /* This bool is used for most of the while loops */ | 332 | bool exit_clock = false; /* when true, the main plugin loop will exit */ |
305 | bool done = false; | ||
306 | 333 | ||
307 | static struct plugin_api* rb; | 334 | static struct plugin_api* rb; |
308 | 335 | ||
309 | /*********************************************************** | 336 | /*********************************************************************** |
310 | * Used for hands to define lengths at a given time - ANALOG | 337 | * Used for hands to define lengths at a given time, analog + fullscreen |
311 | **********************************************************/ | 338 | **********************************************************************/ |
312 | unsigned int xminute[61]; | 339 | unsigned int xminute[61]; |
313 | unsigned int yminute[61]; | 340 | unsigned int yminute[61]; |
314 | unsigned int yhour[61]; | 341 | unsigned int yhour[61]; |
315 | unsigned int xhour[61]; | 342 | unsigned int xhour[61]; |
316 | 343 | unsigned int xminute_full[61]; | |
317 | /************************************************************** | 344 | unsigned int yminute_full[61]; |
318 | * Used for hands to define lengths at a give time - FULLSCREEN | 345 | unsigned int xhour_full[61]; |
319 | *************************************************************/ | 346 | unsigned int yhour_full[61]; |
320 | unsigned int xminute_full[61] = { | ||
321 | 56,58,61,65,69,74,79,84,91,100,110,110,110,110,110,110,110,110,110,110,110,100, | ||
322 | 91,84,79,74,69,65,61,58,56,54,51,47,43,38,33,28,21,12,1,1,1,1,1,1,1,1,1,1,1,12, | ||
323 | 21,28,33,38,43,47,51,54 }; | ||
324 | unsigned int yminute_full[61] = { | ||
325 | 62,62,62,62,62,62,62,62,62,62,62,53,45,40,36,32,28,24,19,11,1,1,1,1,1,1,1,1,1,1, | ||
326 | 1,1,1,1,1,1,1,1,1,1,1,11,19,24,28,32,36,40,45,53,62,62,62,62,62,62,62,62,62,62 }; | ||
327 | unsigned int xhour_full[61] = { | ||
328 | 56,58,60,63,66,69,73,78,84,91,100,100,100,100,100,100,100,100,100,100,100,91,84, | ||
329 | 78,73,69,66,63,60,58,56,54,52,49,46,43,39,34,28,21,12,12,12,12,12,12,12,12,12, | ||
330 | 12,12,21,28,34,39,43,46,49,52,54 }; | ||
331 | unsigned int yhour_full[61] = { | ||
332 | 52,52,52,52,52,52,52,52,52,52,52,46,41,37,34,32,30,27,23,18,12,12,12,12,12,12, | ||
333 | 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,18,23,27,30,32,34,37,41,46,52,52, | ||
334 | 52,52,52,52,52,52,52,52 }; | ||
335 | |||
336 | /**************************** | ||
337 | * BITMAPS | ||
338 | ****************************/ | ||
339 | /************************* | ||
340 | * "0" bitmap - for binary | ||
341 | ************************/ | ||
342 | static const unsigned char bitmap_0[] = { | ||
343 | 0xc0, 0xf0, 0x3c, 0x0e, 0x06, 0x03, 0x03, 0x03, 0x03, 0x06, 0x0e, 0x3c, 0xf0, | ||
344 | 0xc0, 0x00, 0x1f, 0x7f, 0xe0, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, | ||
345 | 0xe0, 0x7f, 0x1f, 0x00, 0x00, 0x00, 0x01, 0x03, 0x03, 0x06, 0x06, 0x06, 0x06, | ||
346 | 0x03, 0x03, 0x01, 0x00, 0x00, 0x00 }; | ||
347 | /************************* | ||
348 | * "1" bitmap - for binary | ||
349 | ************************/ | ||
350 | static const unsigned char bitmap_1[] = { | ||
351 | 0xe0, 0x70, 0x38, 0x1c, 0x0e, 0x07, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
352 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, | ||
353 | 0x00, 0x00, 0x00, 0x00, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x07, 0x07, 0x06, | ||
354 | 0x06, 0x06, 0x06, 0x06, 0x06, 0x00 }; | ||
355 | /********************************** | ||
356 | * Empty circle bitmap - for binary | ||
357 | *********************************/ | ||
358 | const unsigned char circle_empty[] = { | ||
359 | 0xf0, 0x0c, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x0c, | ||
360 | 0xf0, 0x03, 0x0c, 0x10, 0x10, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x10, 0x10, | ||
361 | 0x0c, 0x03 }; | ||
362 | /********************************* | ||
363 | * Full circle bitmap - for binary | ||
364 | ********************************/ | ||
365 | const unsigned char circle_full[] = { | ||
366 | 0xf0, 0xfc, 0xfe, 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0xfe, 0xfc, | ||
367 | 0xf0, 0x03, 0x0f, 0x1f, 0x1f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x1f, 0x1f, | ||
368 | 0x0f, 0x03 }; | ||
369 | |||
370 | /******************************* | ||
371 | * Colon bitmap - for plain mode | ||
372 | ******************************/ | ||
373 | static const unsigned char plain_colon[] = { | ||
374 | 0x00, 0x00, 0x00, 0x00, 0x00, | ||
375 | 0x1e, 0x3f, 0x3f, 0x3f, 0x1e, | ||
376 | 0x80, 0xc0, 0xc0, 0xc0, 0x80, | ||
377 | 0x07, 0x0f, 0x0f, 0x0f, 0x07 }; | ||
378 | /***************************** | ||
379 | * "0" bitmap - for plain mode | ||
380 | ****************************/ | ||
381 | const unsigned char plain_0[] = { | ||
382 | 0x00, 0xe0, 0xf8, 0xfc, 0xfe, 0x1e, 0x0f, 0x07, 0x07, 0x07, 0x0f, 0x1f, 0x7e, | ||
383 | 0xfc, 0xfc, 0xf0, 0x80, | ||
384 | 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
385 | 0xff, 0xff, 0xff, 0xff, | ||
386 | 0x0f, 0xff, 0xff, 0xff, 0xf0, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xf0, | ||
387 | 0xff, 0xff, 0x7f, 0x0f, | ||
388 | 0x00, 0x00, 0x01, 0x03, 0x07, 0x0f, 0x0f, 0x0e, 0x0e, 0x0e, 0x0f, 0x07, 0x07, | ||
389 | 0x03, 0x01, 0x00, 0x00 }; | ||
390 | /***************************** | ||
391 | * "1" bitmap - for plain mode | ||
392 | ****************************/ | ||
393 | const unsigned char plain_1[] = { | ||
394 | 0x00, 0x00, 0xc0, 0xe0, 0xe0, 0xf0, 0x78, 0xf8, 0xfc, 0xfe, 0xff, 0x00, 0x00, | ||
395 | 0x00, 0x00, 0x00, 0x00, | ||
396 | 0x00, 0x00, 0x03, 0x01, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, | ||
397 | 0x00, 0x00, 0x00, 0x00, | ||
398 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, | ||
399 | 0x00, 0x00, 0x00, 0x00, | ||
400 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x0f, 0x0f, 0x0f, 0x00, 0x00, | ||
401 | 0x00, 0x00, 0x00, 0x00 }; | ||
402 | /***************************** | ||
403 | * "2" bitmap - for plain mode | ||
404 | ****************************/ | ||
405 | const unsigned char plain_2[] = { | ||
406 | 0x18, 0x3c, 0x1e, 0x0e, 0x0f, 0x07, 0x07, 0x07, 0x07, 0x0f, 0x1e, 0xfe, 0xfc, | ||
407 | 0xf8, 0xf0, 0x00, 0x00, | ||
408 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xc0, 0xf0, 0xfc, 0xff, 0x3f, | ||
409 | 0x0f, 0x03, 0x00, 0x00, | ||
410 | 0x00, 0x00, 0x80, 0xc0, 0xf0, 0xf8, 0xfe, 0x7f, 0x1f, 0x07, 0x03, 0x00, 0x00, | ||
411 | 0x00, 0x00, 0x00, 0x00, | ||
412 | 0x0c, 0x0e, 0x0f, 0x0f, 0x0f, 0x0f, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, | ||
413 | 0x0e, 0x0e, 0x0e, 0x0e }; | ||
414 | /***************************** | ||
415 | * "3" bitmap - for plain mode | ||
416 | ****************************/ | ||
417 | const unsigned char plain_3[] = { | ||
418 | 0x00, 0x04, 0x0e, 0x0e, 0x0f, 0x07, 0x07, 0x07, 0x07, 0x07, 0x0f, 0x1e, 0xfe, | ||
419 | 0xfc, 0xf8, 0xf0, 0x00, | ||
420 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x70, 0x70, 0xf8, 0xdc, 0xdf, | ||
421 | 0x8f, 0x87, 0x01, 0x00, | ||
422 | 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x83, | ||
423 | 0xff, 0xff, 0xff, 0x7c, | ||
424 | 0x02, 0x07, 0x07, 0x0f, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0f, 0x07, 0x07, | ||
425 | 0x07, 0x03, 0x01, 0x00 }; | ||
426 | /***************************** | ||
427 | * "4" bitmap - for plain mode | ||
428 | ****************************/ | ||
429 | const unsigned char plain_4[] = { | ||
430 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xc0, 0xf0, 0xf8, 0xfc, 0xfe, | ||
431 | 0xff, 0x00, 0x00, 0x00, | ||
432 | 0x00, 0x80, 0xe0, 0xf0, 0x78, 0x3c, 0x1f, 0x07, 0x03, 0x01, 0xff, 0xff, 0xff, | ||
433 | 0xff, 0x00, 0x00, 0x00, | ||
434 | 0x0f, 0x0f, 0x0f, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0xff, 0xff, 0xff, | ||
435 | 0xff, 0x0e, 0x0e, 0x0e, | ||
436 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x0f, 0x0f, | ||
437 | 0x0f, 0x00, 0x00, 0x00 }; | ||
438 | /***************************** | ||
439 | * "5" bitmap - for plain mode | ||
440 | ****************************/ | ||
441 | const unsigned char plain_5[] = { | ||
442 | 0x00, 0xff, 0xff, 0xff, 0xff, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, | ||
443 | 0x07, 0x07, 0x07, 0x00, | ||
444 | 0x00, 0x1f, 0x3f, 0x1f, 0x1f, 0x0c, 0x0e, 0x0e, 0x0e, 0x0e, 0x1e, 0x1e, 0x7c, | ||
445 | 0xfc, 0xf8, 0xf0, 0xc0, | ||
446 | 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xc0, | ||
447 | 0xff, 0xff, 0xff, 0x3f, | ||
448 | 0x02, 0x07, 0x07, 0x0f, 0x0f, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0f, 0x07, 0x07, | ||
449 | 0x03, 0x01, 0x00, 0x00 }; | ||
450 | /***************************** | ||
451 | * "6" bitmap - for plain mode | ||
452 | ****************************/ | ||
453 | const unsigned char plain_6[] = { | ||
454 | 0x00, 0x00, 0x00, 0xc0, 0xe0, 0xf0, 0xf8, 0x7c, 0x3e, 0x1e, 0x0f, 0x07, 0x02, | ||
455 | 0x00, 0x00, 0x00, 0x00, | ||
456 | 0xf0, 0xfc, 0xff, 0xff, 0xff, 0x73, 0x39, 0x38, 0x38, 0x38, 0x38, 0x78, 0xf0, | ||
457 | 0xf0, 0xe0, 0xc0, 0x00, | ||
458 | 0x1f, 0xff, 0xff, 0xff, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc1, | ||
459 | 0xff, 0xff, 0xff, 0x7f, | ||
460 | 0x00, 0x00, 0x01, 0x03, 0x07, 0x07, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0f, 0x07, | ||
461 | 0x07, 0x03, 0x01, 0x00 }; | ||
462 | /***************************** | ||
463 | * "7" bitmap - for plain mode | ||
464 | ****************************/ | ||
465 | const unsigned char plain_7[] = { | ||
466 | 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0xc7, 0xf7, 0xff, | ||
467 | 0xff, 0x7f, 0x1f, 0x07, | ||
468 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0xf8, 0xff, 0xff, 0x1f, 0x07, | ||
469 | 0x01, 0x00, 0x00, 0x00, | ||
470 | 0x00, 0x00, 0x00, 0x80, 0xe0, 0xfc, 0xff, 0x7f, 0x1f, 0x03, 0x00, 0x00, 0x00, | ||
471 | 0x00, 0x00, 0x00, 0x00, | ||
472 | 0x00, 0x00, 0x0c, 0x0f, 0x0f, 0x0f, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
473 | 0x00, 0x00, 0x00, 0x00 }; | ||
474 | /***************************** | ||
475 | * "8" bitmap - for plain mode | ||
476 | ****************************/ | ||
477 | const unsigned char plain_8[] = { | ||
478 | 0x00, 0xf0, 0xfc, 0xfe, 0xfe, 0x0f, 0x07, 0x07, 0x07, 0x07, 0x0f, 0x0f, 0xfe, | ||
479 | 0xfe, 0xfc, 0xf0, 0x00, | ||
480 | 0x00, 0x81, 0xc3, 0xef, 0xef, 0xff, 0x7e, 0x3c, 0x38, 0x78, 0xfc, 0xfe, 0xff, | ||
481 | 0xcf, 0x87, 0x01, 0x00, | ||
482 | 0x7e, 0xff, 0xff, 0xff, 0x83, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x83, | ||
483 | 0xff, 0xff, 0xff, 0x7e, | ||
484 | 0x00, 0x01, 0x03, 0x07, 0x07, 0x0f, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0f, 0x07, | ||
485 | 0x07, 0x03, 0x01, 0x00 }; | ||
486 | /***************************** | ||
487 | * "9" bitmap - for plain mode | ||
488 | ****************************/ | ||
489 | const unsigned char plain_9[] = { | ||
490 | 0xe0, 0xf8, 0xfc, 0xfe, 0x3e, 0x0f, 0x07, 0x07, 0x07, 0x07, 0x07, 0x0e, 0x3e, | ||
491 | 0xfc, 0xf8, 0xf0, 0x80, | ||
492 | 0x0f, 0x3f, 0x7f, 0xff, 0xf8, 0xe0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xe0, 0xf0, | ||
493 | 0xff, 0xff, 0xff, 0xff, | ||
494 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x81, 0xc1, 0xe1, 0xf9, 0xfc, 0x7f, | ||
495 | 0x3f, 0x0f, 0x03, 0x00, | ||
496 | 0x00, 0x00, 0x00, 0x00, 0x04, 0x0e, 0x0f, 0x07, 0x07, 0x03, 0x01, 0x00, 0x00, | ||
497 | 0x00, 0x00, 0x00, 0x00 }; | ||
498 | |||
499 | /********************** | ||
500 | * Digital colon bitmap | ||
501 | *********************/ | ||
502 | const unsigned char digital_colon[] = { | ||
503 | 0x04, 0x0e, 0x1f, 0x0e, 0x04 }; | ||
504 | |||
505 | /******************************************** | ||
506 | * Used to define current bitmap - PLAIN MODE | ||
507 | *******************************************/ | ||
508 | const char *plain_bitmaps[] = { | ||
509 | plain_0, plain_1, plain_2, plain_3, plain_4, plain_5, plain_6, | ||
510 | plain_7, plain_8, plain_9 }; | ||
511 | |||
512 | /************** | ||
513 | * PM indicator | ||
514 | *************/ | ||
515 | static const unsigned char pm[] = { | ||
516 | 0xFF,0xFF,0x33,0x33,0x33,0x1E,0x0C,0x00,0xFF,0xFF,0x06,0x0C,0x06,0xFF,0xFF }; | ||
517 | /************** | ||
518 | * AM Indicator | ||
519 | *************/ | ||
520 | static const unsigned char am[] = { | ||
521 | 0xFE,0xFF,0x1B,0x1B,0xFF,0xFE,0x00,0x00,0xFF,0xFF,0x06,0x0C,0x06,0xFF,0xFF }; | ||
522 | |||
523 | /************** | ||
524 | * Arrow bitmap | ||
525 | *************/ | ||
526 | static const unsigned char arrow[] = { | ||
527 | 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x3F, 0x1E, 0x0C }; | ||
528 | |||
529 | /*************************** | ||
530 | * Unchecked checkbox bitmap | ||
531 | **************************/ | ||
532 | const unsigned char checkbox_empty[] = { | ||
533 | 0x3F, 0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x3F }; | ||
534 | /***************************** | ||
535 | * 1/3 checked checkbox bitmap | ||
536 | ****************************/ | ||
537 | const unsigned char checkbox_onethird[] = { | ||
538 | 0x3F, 0x2B, 0x35, 0x21, 0x21, 0x21, 0x21, 0x3F }; | ||
539 | /***************************** | ||
540 | * 1/2 checked checkbox bitmap | ||
541 | ****************************/ | ||
542 | const unsigned char checkbox_half[] = { | ||
543 | 0x3F, 0x2B, 0x35, 0x2B, 0x21, 0x21, 0x21, 0x3F }; | ||
544 | /***************************** | ||
545 | * 2/3 checked checkbox bitmap | ||
546 | ****************************/ | ||
547 | const unsigned char checkbox_twothird[] = { | ||
548 | 0x3F, 0x2B, 0x35, 0x2B, 0x35, 0x21, 0x21, 0x3F }; | ||
549 | /************************* | ||
550 | * Checked checkbox bitmap | ||
551 | ************************/ | ||
552 | const unsigned char checkbox_full[] = { | ||
553 | 0x3F, 0x2B, 0x35, 0x2B, 0x35, 0x2B, 0x35, 0x3F }; | ||
554 | |||
555 | /********************* | ||
556 | * Clock logo (112x37) | ||
557 | ********************/ | ||
558 | extern const unsigned char clock_logo[]; // Should be LCD_WIDTH x (LCD_HEIGHT-28) | ||
559 | |||
560 | /****************** | ||
561 | * Time's Up bitmap | ||
562 | *****************/ | ||
563 | const unsigned char timesup[] = { | ||
564 | 0x78, 0x78, 0x78, 0x38, 0x08, 0x08, 0xf8, 0xfc, 0xfc, 0xfc, 0xfc, 0xfc, 0x04, | ||
565 | 0x04, 0x04, 0x0c, 0x3c, 0x3c, 0x3c, 0x04, 0x04, 0x04, 0xfc, 0xfc, 0xfc, 0xfc, | ||
566 | 0xfe, 0xfe, 0x06, 0x03, 0x03, 0x05, 0x05, 0x07, 0xff, 0xff, 0xff, 0xff, 0xff, | ||
567 | 0xfc, 0xfc, 0xf8, 0xf0, 0xc0, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xf0, 0xfc, 0xfc, | ||
568 | 0xfc, 0xfc, 0xfc, 0x20, 0x22, 0x22, 0x22, 0x22, 0x02, 0x02, 0x02, 0x02, 0x0e, | ||
569 | 0xfe, 0xfe, 0xfe, 0xfe, 0x06, 0x06, 0x06, 0x06, 0x06, 0x0e, 0x1c, 0x3c, 0x3c, | ||
570 | 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0xfc, 0xfc, 0xfc, 0xfe, 0x00, | ||
571 | 0x00, 0x00, 0x00, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0xfe, 0xfe, 0xfe, 0xfe, | ||
572 | 0x86, 0x0e, 0x3e, 0xfe, 0xfe, 0xfe, 0xfe, 0x1e, | ||
573 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x40, | ||
574 | 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0xff, 0xff, 0xff, 0xff, | ||
575 | 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, | ||
576 | 0x03, 0x0f, 0x3f, 0xff, 0xff, 0xfc, 0xf0, 0xfc, 0xff, 0x7f, 0x1f, 0x03, 0xff, | ||
577 | 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
578 | 0xff, 0xff, 0xff, 0xff, 0x08, 0x08, 0x08, 0x08, 0x08, 0x0e, 0x0e, 0x0e, 0x00, | ||
579 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x03, 0x03, 0x03, 0x40, | ||
580 | 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0xc0, 0xe0, 0xe0, 0xe3, 0xc7, 0x8f, 0x0f, | ||
581 | 0x1f, 0x1f, 0x3e, 0xfe, 0xfc, 0xf8, 0xf8, 0xf0, | ||
582 | 0x08, 0x08, 0x08, 0x08, 0x18, 0x18, 0x1f, 0x1f, 0x1f, 0x1f, 0x0f, 0x0f, 0x0c, | ||
583 | 0x08, 0x08, 0x00, 0x00, 0x08, 0x08, 0x08, 0x08, 0x0c, 0x0f, 0x0f, 0x0f, 0x0f, | ||
584 | 0x0f, 0x0f, 0x0c, 0x08, 0x08, 0x88, 0x80, 0xc0, 0xff, 0xff, 0xff, 0xff, 0xff, | ||
585 | 0x00, 0x00, 0x00, 0x00, 0x03, 0x0f, 0x0f, 0x07, 0x01, 0x10, 0x18, 0x1c, 0x0f, | ||
586 | 0x0f, 0x0f, 0x0f, 0x00, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x0c, | ||
587 | 0x0f, 0x0f, 0x0f, 0x0f, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x1c, 0x1c, | ||
588 | 0x1c, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
589 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x1f, 0x1f, 0x0f, 0x0f, 0x0f, 0x0f, | ||
590 | 0x0e, 0x0c, 0x0c, 0x0f, 0x0f, 0x0f, 0x0f, 0x03, | ||
591 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
592 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
593 | 0x00, 0x00, 0x00, 0x00, 0x40, 0x40, 0x40, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0x00, | ||
594 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x48, 0xc8, 0xf8, 0xf8, 0xf8, 0x18, 0x08, | ||
595 | 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0xe0, 0xe0, 0x60, 0x60, 0xe0, 0xe0, | ||
596 | 0xe0, 0xe0, 0xa0, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, | ||
597 | 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
598 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
599 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
600 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
601 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
602 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, | ||
603 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0x00, 0x00, | ||
604 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xc0, 0xc0, 0xe0, 0xf1, | ||
605 | 0xff, 0xff, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, | ||
606 | 0xff, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
607 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
608 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
609 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
610 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
611 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x3f, 0x7f, 0xff, 0xff, 0xf0, | ||
612 | 0xe0, 0xc0, 0xc0, 0xc0, 0xe0, 0xf0, 0xf0, 0x7c, 0x7f, 0x3f, 0x07, 0x04, 0x04, | ||
613 | 0x04, 0x04, 0x04, 0x04, 0x04, 0xe4, 0xff, 0xff, 0xff, 0xc0, 0x80, 0x80, 0x00, | ||
614 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc3, | ||
615 | 0xe1, 0xe7, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
616 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
617 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
618 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
619 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
620 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
621 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
622 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x03, 0x03, 0x03, 0x02, 0x00, 0x00, 0x00, | ||
623 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
624 | 0x03, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
625 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
626 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; | ||
627 | 347 | ||
628 | /* settings are saved to this location */ | 348 | /* settings are saved to this location */ |
629 | static const char default_filename[] = "/.rockbox/rocks/.clock_settings"; | 349 | static const char default_filename[] = "/.rockbox/rocks/.clock_settings"; |
630 | 350 | ||
631 | /* names of contributors */ | ||
632 | const char* credits[] = { | ||
633 | "Zakk Roberts", | ||
634 | "Linus Feltzing", | ||
635 | "BlueChip", | ||
636 | "T.P. Diffenbach", | ||
637 | "David McIntyre", | ||
638 | "Justin Young", | ||
639 | "Lee Pilgrim", | ||
640 | "top_bloke", | ||
641 | "Karl Kurbjun", | ||
642 | "Adam Spirer", | ||
643 | "Scott Myran", | ||
644 | "Tony Kirk", | ||
645 | "Jason Tye" }; | ||
646 | |||
647 | /* ...and how they helped */ | ||
648 | const char* jobs[] = { | ||
649 | "Code", | ||
650 | "Code", | ||
651 | "Code", | ||
652 | "Code", | ||
653 | "Code", | ||
654 | "Code", | ||
655 | "Code", | ||
656 | "Code", | ||
657 | "Code", | ||
658 | "Pre-3.0 Logo", | ||
659 | "Design", | ||
660 | "Design", | ||
661 | "Design" }; | ||
662 | |||
663 | /********************************************************* | 351 | /********************************************************* |
664 | * Some arrays/definitions for drawing settings/menu text. | 352 | * Some arrays/definitions for drawing settings/menu text. |
665 | * Modes are abbreviated to one letter i.e. "analog" = "a" | ||
666 | ********************************************************/ | 353 | ********************************************************/ |
667 | #define analog_digits_text "Digits" | 354 | #define ANALOG 1 |
668 | const char* analog_date_text[] = { | 355 | #define DIGITAL 2 |
669 | "Date: Off", | 356 | #define FULLSCREEN 3 |
670 | "Date: American", | 357 | #define BINARY 4 |
671 | "Date: European" }; | 358 | #define PLAIN 5 |
672 | #define analog_secondhand_text "Second Hand" | 359 | #define CLOCK_MODES 5 |
673 | const char* analog_time_text[] = { | 360 | |
674 | "Show Time: Off", | 361 | #define analog_date 0 |
675 | "Show Time: 24hr", | 362 | #define analog_secondhand 1 |
676 | "Show Time: 12hr", }; | 363 | #define analog_time 2 |
677 | const char* digital_seconds_text[] = { | ||
678 | "Seconds: Off", | ||
679 | "Seconds: Digital", | ||
680 | "Seconds: Bar", | ||
681 | "Seconds: Inverse" }; | ||
682 | const char* digital_date_text[] = { | ||
683 | "Date: Off", | ||
684 | "Date: American", | ||
685 | "Date: European" }; | ||
686 | #define digital_blinkcolon_text "Blinking Colon" | ||
687 | #define digital_12h_text "12-Hour Format" | ||
688 | const char* lcd_seconds_text[] = { | ||
689 | "Seconds: Off", | ||
690 | "Seconds: Digital", | ||
691 | "Seconds: Bar", | ||
692 | "Seconds: Inverse" }; | ||
693 | const char* lcd_date_text[] = { | ||
694 | "Date: Off", | ||
695 | "Date: American", | ||
696 | "Date: European" }; | ||
697 | #define lcd_blinkcolon_text "Blinking Colon" | ||
698 | #define lcd_12h_text "12-Hour Format" | ||
699 | #define fullscreen_border_text "Show Border" | ||
700 | #define fullscreen_secondhand_text "Second Hand" | ||
701 | #define fullscreen_invertseconds_text "Invert Seconds" | ||
702 | #define binary_dots_text "Dot Mode" | ||
703 | #define plain_12h_text "12-Hour Format" | ||
704 | const char* plain_date_text[] = { | ||
705 | "Date: Off", | ||
706 | "Date: American", | ||
707 | "Date: European" }; | ||
708 | #define plain_blinkcolon_text "Blinking Colon" | ||
709 | const char* menu_entries[] = { | ||
710 | "View Clock", | ||
711 | "Mode Selector", | ||
712 | "Counter Settings", | ||
713 | "Mode Settings", | ||
714 | "General Settings", | ||
715 | "Help", | ||
716 | "Credits" }; | ||
717 | const char* mode_selector_entries[] = { | ||
718 | "Analog", | ||
719 | "Digital", | ||
720 | "LCD", | ||
721 | "Fullscreen", | ||
722 | "Binary", | ||
723 | "Plain" }; | ||
724 | #define general_reset_text "Reset Settings" | ||
725 | #define general_save_text "Save Settings" | ||
726 | #define general_counter_text "Show Counter" | ||
727 | const char* general_savesetting_text[] = { | ||
728 | "Save: Manually", | ||
729 | "Save: on Exit", | ||
730 | "Save: Automatic" }; | ||
731 | #define general_idle_text "Idle Poweroff" | ||
732 | const char* general_backlight_text[] = { | ||
733 | "Backlight: Off", | ||
734 | "Backlight: RB", | ||
735 | "Backlight: On" }; | ||
736 | |||
737 | #define ANALOG_SETTINGS 4 | ||
738 | #define DIGITAL_SETTINGS 4 | ||
739 | #define LCD_SETTINGS 4 | ||
740 | #define FULLSCREEN_SETTINGS 3 | ||
741 | #define BINARY_SETTINGS 1 | ||
742 | #define PLAIN_SETTINGS 3 | ||
743 | #define GENERAL_SETTINGS 4 | ||
744 | |||
745 | #define analog_digits 0 | ||
746 | #define analog_date 1 | ||
747 | #define analog_secondhand 2 | ||
748 | #define analog_time 3 | ||
749 | #define digital_seconds 0 | 364 | #define digital_seconds 0 |
750 | #define digital_date 1 | 365 | #define digital_date 1 |
751 | #define digital_blinkcolon 2 | 366 | #define digital_blinkcolon 2 |
752 | #define digital_12h 3 | 367 | #define digital_format 3 |
753 | #define lcd_seconds 0 | ||
754 | #define lcd_date 1 | ||
755 | #define lcd_blinkcolon 2 | ||
756 | #define lcd_12h 3 | ||
757 | #define fullscreen_border 0 | 368 | #define fullscreen_border 0 |
758 | #define fullscreen_secondhand 1 | 369 | #define fullscreen_secondhand 1 |
759 | #define fullscreen_invertseconds 2 | 370 | #define binary_mode 0 |
760 | #define binary_dots 0 | 371 | #define plain_format 0 |
761 | #define plain_12h 0 | 372 | #define plain_seconds 1 |
762 | #define plain_date 1 | 373 | #define plain_date 2 |
763 | #define plain_blinkcolon 2 | 374 | #define plain_blinkcolon 3 |
764 | #define general_counter 0 | 375 | #define general_counter 0 |
765 | #define general_savesetting 1 | 376 | #define general_savesetting 1 |
766 | #define general_backlight 2 | 377 | #define general_backlight 2 |
767 | 378 | ||
768 | /*********************************** | 379 | /* Menu structs (lists of menu items) */ |
769 | * This is saved to default_filename | 380 | static const struct menu_item main_menu_items[] = { |
770 | **********************************/ | 381 | { "View Clock", NULL }, |
382 | { "Mode Selector", NULL }, | ||
383 | { "Mode Settings", NULL }, | ||
384 | { "General Settings", NULL }, | ||
385 | { "Exit Plugin", NULL } | ||
386 | }; | ||
387 | static const struct menu_item mode_selector_items[] = { | ||
388 | { "Analog", NULL }, | ||
389 | { "Digital/LCD", NULL }, | ||
390 | { "Full-screen", NULL }, | ||
391 | { "Binary", NULL }, | ||
392 | { "Plain", NULL } | ||
393 | }; | ||
394 | static const struct menu_item general_settings_items[] = { | ||
395 | { "Reset Settings", NULL }, | ||
396 | { "Save Settings Now", NULL }, | ||
397 | { "Save On Exit", NULL }, | ||
398 | { "Show Counter", NULL }, | ||
399 | { "Backlight Settings", NULL }, | ||
400 | { "Idle Poweroff (temporary)", NULL } | ||
401 | }; | ||
402 | static const struct menu_item analog_items[] = { | ||
403 | { "Show Date", NULL }, | ||
404 | { "Show Second Hand", NULL }, | ||
405 | { "Show Time Readout", NULL } | ||
406 | }; | ||
407 | static const struct menu_item digital_items[] = { | ||
408 | { "Show Seconds", NULL }, | ||
409 | { "Show Date", NULL }, | ||
410 | { "Blinking Colon", NULL }, | ||
411 | { "Time Format", NULL } | ||
412 | }; | ||
413 | static const struct menu_item fullscreen_items[] = { | ||
414 | { "Show Border", NULL }, | ||
415 | { "Show Second Hand", NULL } | ||
416 | }; | ||
417 | static const struct menu_item binary_items[] = { | ||
418 | { "Display Mode", NULL } | ||
419 | }; | ||
420 | static const struct menu_item plain_items[] = { | ||
421 | { "Show Date", NULL }, | ||
422 | { "Show Seconds", NULL }, | ||
423 | { "Blinking Colon", NULL }, | ||
424 | { "Time Format", NULL } | ||
425 | }; | ||
426 | |||
427 | /* Option structs (possible selections per each option) */ | ||
428 | static const struct opt_items noyes_text[2] = { | ||
429 | { "No", -1 }, | ||
430 | { "Yes", -1 } | ||
431 | }; | ||
432 | static const struct opt_items saving_options_text[2] = { | ||
433 | { "No", -1 }, | ||
434 | { "Yes", -1 } | ||
435 | }; | ||
436 | static const struct opt_items show_counter_text[2] = { | ||
437 | { "No", -1 }, | ||
438 | { "Yes", -1 } | ||
439 | }; | ||
440 | static const struct opt_items backlight_settings_text[3] = { | ||
441 | { "Always Off", -1 }, | ||
442 | { "Rockbox setting", -1 }, | ||
443 | { "Always On", -1 } | ||
444 | }; | ||
445 | static const struct opt_items idle_poweroff_text[2] = { | ||
446 | { "Disabled", -1 }, | ||
447 | { "Enabled", -1 } | ||
448 | }; | ||
449 | static const struct opt_items counting_direction_text[2] = { | ||
450 | {"Down", -1}, | ||
451 | {"Up", -1} | ||
452 | }; | ||
453 | static const struct opt_items analog_date_text[3] = { | ||
454 | { "No", -1 }, | ||
455 | { "American format", -1 }, | ||
456 | { "European format", -1 } | ||
457 | }; | ||
458 | static const struct opt_items analog_secondhand_text[2] = { | ||
459 | { "No", -1 }, | ||
460 | { "Yes", -1 } | ||
461 | }; | ||
462 | static const struct opt_items analog_time_text[3] = { | ||
463 | { "No", -1 }, | ||
464 | { "24-hour Format", -1 }, | ||
465 | { "12-hour Format", -1 } | ||
466 | }; | ||
467 | static const struct opt_items digital_seconds_text[2] = { | ||
468 | { "No", -1 }, | ||
469 | { "Yes", -1 } | ||
470 | }; | ||
471 | static const struct opt_items digital_date_text[3] = { | ||
472 | { "No", -1 }, | ||
473 | { "American format", -1 }, | ||
474 | { "European format", -1 } | ||
475 | }; | ||
476 | static const struct opt_items digital_blinkcolon_text[2] = { | ||
477 | { "No", -1 }, | ||
478 | { "Yes", -1 } | ||
479 | }; | ||
480 | static const struct opt_items digital_format_text[2] = { | ||
481 | { "24-hour Format", -1 }, | ||
482 | { "12-hour Format", -1 } | ||
483 | }; | ||
484 | static const struct opt_items fullscreen_border_text[2] = { | ||
485 | { "No", -1 }, | ||
486 | { "Yes", -1 } | ||
487 | }; | ||
488 | static const struct opt_items fullscreen_secondhand_text[2] = { | ||
489 | { "No", -1 }, | ||
490 | { "Yes", -1 } | ||
491 | }; | ||
492 | static const struct opt_items binary_mode_text[2] = { | ||
493 | { "Numbers", -1 }, | ||
494 | { "Dots", -1 } | ||
495 | }; | ||
496 | static const struct opt_items plain_date_text[3] = { | ||
497 | { "No", -1 }, | ||
498 | { "American format", -1 }, | ||
499 | { "European format", -1 } | ||
500 | }; | ||
501 | static const struct opt_items plain_seconds_text[3] = { | ||
502 | { "No", -1 }, | ||
503 | { "Yes", -1 } | ||
504 | }; | ||
505 | static const struct opt_items plain_blinkcolon_text[2] = { | ||
506 | { "No", -1 }, | ||
507 | { "Yes", -1 } | ||
508 | }; | ||
509 | static const struct opt_items plain_format_text[3] = { | ||
510 | { "24-hour Format", -1 }, | ||
511 | { "12-hour Format", -1 } | ||
512 | }; | ||
513 | |||
514 | /***************************************** | ||
515 | * All settings, saved to default_filename | ||
516 | ****************************************/ | ||
771 | struct saved_settings | 517 | struct saved_settings |
772 | { | 518 | { |
773 | /* general */ | 519 | int clock; /* clock mode */ |
774 | int clock; /* 1: analog, 2: digital, 3: lcd, 4: full, 5: binary, 6: plain */ | 520 | int general[4]; /* general settings*/ |
775 | int general[GENERAL_SETTINGS]; | 521 | int analog[3]; |
776 | int analog[ANALOG_SETTINGS]; | 522 | int digital[4]; |
777 | int digital[DIGITAL_SETTINGS]; | 523 | int fullscreen[2]; |
778 | int lcd[LCD_SETTINGS]; | 524 | int binary[1]; |
779 | int fullscreen[FULLSCREEN_SETTINGS]; | 525 | int plain[4]; |
780 | int binary[BINARY_SETTINGS]; | ||
781 | int plain[PLAIN_SETTINGS]; | ||
782 | } settings; | 526 | } settings; |
783 | 527 | ||
784 | int analog_max[ANALOG_SETTINGS] = {1, 2, 1, 2}; | ||
785 | int digital_max[DIGITAL_SETTINGS] = {3, 2, 1, 1}; | ||
786 | #define fullscreen_max 1 | ||
787 | #define binary_max 1 | ||
788 | int plain_max[PLAIN_SETTINGS] = {1, 2, 1}; | ||
789 | int general_max[GENERAL_SETTINGS] = {1, 2, 2, 1}; | ||
790 | |||
791 | /************************ | 528 | /************************ |
792 | * Setting default values | 529 | * Setting default values |
793 | ***********************/ | 530 | ***********************/ |
@@ -797,22 +534,17 @@ void reset_settings(void) | |||
797 | settings.general[general_counter] = 1; | 534 | settings.general[general_counter] = 1; |
798 | settings.general[general_savesetting] = 1; | 535 | settings.general[general_savesetting] = 1; |
799 | settings.general[general_backlight] = 2; | 536 | settings.general[general_backlight] = 2; |
800 | settings.analog[analog_digits] = false; | ||
801 | settings.analog[analog_date] = 0; | 537 | settings.analog[analog_date] = 0; |
802 | settings.analog[analog_secondhand] = true; | 538 | settings.analog[analog_secondhand] = true; |
803 | settings.analog[analog_time] = false; | 539 | settings.analog[analog_time] = false; |
804 | settings.digital[digital_seconds] = 1; | 540 | settings.digital[digital_seconds] = 1; |
805 | settings.digital[digital_date] = 1; | 541 | settings.digital[digital_date] = 1; |
806 | settings.digital[digital_blinkcolon] = false; | 542 | settings.digital[digital_blinkcolon] = false; |
807 | settings.digital[digital_12h] = true; | 543 | settings.digital[digital_format] = true; |
808 | settings.lcd[lcd_seconds] = 1; | ||
809 | settings.lcd[lcd_date] = 1; | ||
810 | settings.lcd[lcd_blinkcolon] = false; | ||
811 | settings.lcd[lcd_12h] = true; | ||
812 | settings.fullscreen[fullscreen_border] = true; | 544 | settings.fullscreen[fullscreen_border] = true; |
813 | settings.fullscreen[fullscreen_secondhand] = true; | 545 | settings.fullscreen[fullscreen_secondhand] = true; |
814 | settings.fullscreen[fullscreen_invertseconds] = false; | 546 | settings.plain[plain_format] = true; |
815 | settings.plain[plain_12h] = true; | 547 | settings.plain[plain_seconds] = true; |
816 | settings.plain[plain_date] = 1; | 548 | settings.plain[plain_date] = 1; |
817 | settings.plain[plain_blinkcolon] = false; | 549 | settings.plain[plain_blinkcolon] = false; |
818 | } | 550 | } |
@@ -831,11 +563,12 @@ static const short sin_table[91] = | |||
831 | 14188, 14329, 14466, 14598, 14725, 14848, 14967, 15081, 15190, 15295, | 563 | 14188, 14329, 14466, 14598, 14725, 14848, 14967, 15081, 15190, 15295, |
832 | 15395, 15491, 15582, 15668, 15749, 15825, 15897, 15964, 16025, 16082, | 564 | 15395, 15491, 15582, 15668, 15749, 15825, 15897, 15964, 16025, 16082, |
833 | 16135, 16182, 16224, 16261, 16294, 16321, 16344, 16361, 16374, 16381, | 565 | 16135, 16182, 16224, 16261, 16294, 16321, 16344, 16361, 16374, 16381, |
834 | 16384 }; | 566 | 16384 |
567 | }; | ||
835 | 568 | ||
836 | /****************************** | 569 | /******************************* |
837 | * Sine function (from plasma.c | 570 | * Sine function (from plasma.c) |
838 | *****************************/ | 571 | ******************************/ |
839 | static short sin(int val) | 572 | static short sin(int val) |
840 | { | 573 | { |
841 | /* value should be between 0 and 360 degree for correct lookup*/ | 574 | /* value should be between 0 and 360 degree for correct lookup*/ |
@@ -861,14 +594,49 @@ static short sin(int val) | |||
861 | return 0; | 594 | return 0; |
862 | } | 595 | } |
863 | 596 | ||
864 | /******************************** | 597 | /************************************************************** |
865 | * Simple function to center text | 598 | * Simple function to check if we're switching to digital mode, |
866 | *******************************/ | 599 | * and if so, set bg/fg colors appropriately. |
867 | void center_text(int y, char* text) | 600 | *************************************************************/ |
601 | void set_digital_colors(void) | ||
868 | { | 602 | { |
869 | rb->snprintf(buf, sizeof(buf), "%s", text); | 603 | #ifdef HAVE_LCD_COLOR /* color LCDs.. */ |
870 | rb->lcd_getstringsize(buf, &buf_w, &buf_h); | 604 | if(settings.clock == DIGITAL) |
871 | rb->lcd_putsxy(LCDWIDTH/2 - buf_w/2, y, text); | 605 | { |
606 | rb->lcd_set_foreground(LCD_WHITE); | ||
607 | rb->lcd_set_background(LCD_BLACK); | ||
608 | } | ||
609 | else | ||
610 | { | ||
611 | rb->lcd_set_foreground(LCD_BLACK); | ||
612 | rb->lcd_set_background(LCD_RGBPACK(180,200,230)); | ||
613 | } | ||
614 | #elif LCD_DEPTH >= 2 | ||
615 | if(settings.clock == DIGITAL) | ||
616 | { | ||
617 | rb->lcd_set_foreground(LCD_WHITE); | ||
618 | rb->lcd_set_background(LCD_BLACK); | ||
619 | } | ||
620 | else | ||
621 | { | ||
622 | rb->lcd_set_foreground(LCD_BLACK); | ||
623 | rb->lcd_set_background(LCD_WHITE); | ||
624 | } | ||
625 | #endif | ||
626 | } | ||
627 | |||
628 | /************************************************************* | ||
629 | * Simple function to set standard black-on-light blue colors. | ||
630 | ************************************************************/ | ||
631 | void set_standard_colors(void) | ||
632 | { | ||
633 | #ifdef HAVE_LCD_COLOR /* color LCDs only.. */ | ||
634 | rb->lcd_set_foreground(LCD_BLACK); | ||
635 | rb->lcd_set_background(LCD_RGBPACK(180,200,230)); | ||
636 | #elif LCD_DEPTH >= 2 | ||
637 | rb->lcd_set_foreground(LCD_BLACK); | ||
638 | rb->lcd_set_background(LCD_WHITE); | ||
639 | #endif | ||
872 | } | 640 | } |
873 | 641 | ||
874 | /************************** | 642 | /************************** |
@@ -885,6 +653,23 @@ void cleanup(void *parameter) | |||
885 | rb->backlight_set_timeout(rb->global_settings->backlight_timeout); | 653 | rb->backlight_set_timeout(rb->global_settings->backlight_timeout); |
886 | } | 654 | } |
887 | 655 | ||
656 | /**************** | ||
657 | * Shows the logo | ||
658 | ***************/ | ||
659 | void show_clock_logo(void) | ||
660 | { | ||
661 | #ifdef HAVE_LCD_COLOR | ||
662 | rb->lcd_set_foreground(LCD_BLACK); | ||
663 | rb->lcd_set_background(LCD_RGBPACK(180,200,230)); | ||
664 | #endif | ||
665 | |||
666 | rb->lcd_clear_display();; | ||
667 | |||
668 | rb->lcd_bitmap(clock_logo, 0, 0, LOGO_WIDTH, LOGO_HEIGHT); | ||
669 | |||
670 | rb->lcd_update(); | ||
671 | } | ||
672 | |||
888 | /******************************** | 673 | /******************************** |
889 | * Saves "saved_settings" to disk | 674 | * Saves "saved_settings" to disk |
890 | *******************************/ | 675 | *******************************/ |
@@ -895,10 +680,9 @@ void save_settings(bool interface) | |||
895 | if(interface) | 680 | if(interface) |
896 | { | 681 | { |
897 | rb->lcd_clear_display(); | 682 | rb->lcd_clear_display(); |
683 | show_clock_logo(); | ||
898 | 684 | ||
899 | /* display information */ | 685 | draw_message(MESSAGE_SAVING, 1); |
900 | center_text(56, "Saving Settings"); | ||
901 | show_clock_logo(true, true); | ||
902 | 686 | ||
903 | rb->lcd_update(); | 687 | rb->lcd_update(); |
904 | } | 688 | } |
@@ -913,9 +697,9 @@ void save_settings(bool interface) | |||
913 | if(interface) | 697 | if(interface) |
914 | { | 698 | { |
915 | rb->lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID); | 699 | rb->lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID); |
916 | rb->lcd_fillrect(0, LCD_HEIGHT-8, LCD_WIDTH, 8); | 700 | rb->lcd_fillrect(0, LCD_HEIGHT-MESSAGE_HEIGHT, LCD_WIDTH, MESSAGE_HEIGHT); |
917 | rb->lcd_set_drawmode(DRMODE_SOLID); | 701 | rb->lcd_set_drawmode(DRMODE_SOLID); |
918 | center_text(LCD_HEIGHT-8, "Saved Settings"); | 702 | draw_message(MESSAGE_SAVED, 1); |
919 | } | 703 | } |
920 | } | 704 | } |
921 | else /* couldn't save for some reason */ | 705 | else /* couldn't save for some reason */ |
@@ -923,19 +707,16 @@ void save_settings(bool interface) | |||
923 | if(interface) | 707 | if(interface) |
924 | { | 708 | { |
925 | rb->lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID); | 709 | rb->lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID); |
926 | rb->lcd_fillrect(0, LCD_HEIGHT-8, LCD_WIDTH, 8); | 710 | rb->lcd_fillrect(0, LCD_HEIGHT-MESSAGE_HEIGHT, LCD_WIDTH, MESSAGE_HEIGHT); |
927 | rb->lcd_set_drawmode(DRMODE_SOLID); | 711 | rb->lcd_set_drawmode(DRMODE_SOLID); |
928 | center_text(LCD_HEIGHT-8, "Save Failed!"); | 712 | draw_message(MESSAGE_ERRSAVE, 1); |
929 | } | 713 | } |
930 | } | 714 | } |
931 | 715 | ||
932 | if(interface) | 716 | if(interface) |
933 | { | 717 | { |
934 | rb->lcd_update(); | 718 | rb->lcd_update(); |
935 | |||
936 | rb->sleep(HZ); /* pause a second */ | 719 | rb->sleep(HZ); /* pause a second */ |
937 | |||
938 | exit_logo(); | ||
939 | } | 720 | } |
940 | } | 721 | } |
941 | 722 | ||
@@ -948,10 +729,11 @@ void load_settings(void) | |||
948 | int fd; | 729 | int fd; |
949 | fd = rb->open(default_filename, O_RDONLY); | 730 | fd = rb->open(default_filename, O_RDONLY); |
950 | 731 | ||
951 | center_text(LCD_HEIGHT-16, "Clock " CLOCK_VERSION); | 732 | rb->lcd_clear_display(); |
952 | center_text(LCD_HEIGHT-8, "Loading Settings"); | 733 | show_clock_logo(); |
734 | |||
735 | draw_message(MESSAGE_LOADING, 1); | ||
953 | 736 | ||
954 | show_clock_logo(true, true); | ||
955 | rb->lcd_update(); | 737 | rb->lcd_update(); |
956 | 738 | ||
957 | if(fd >= 0) /* does file exist? */ | 739 | if(fd >= 0) /* does file exist? */ |
@@ -962,27 +744,27 @@ void load_settings(void) | |||
962 | rb->close(fd); | 744 | rb->close(fd); |
963 | 745 | ||
964 | rb->lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID); | 746 | rb->lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID); |
965 | rb->lcd_fillrect(0, LCD_HEIGHT-8, LCD_WIDTH, 8); | 747 | rb->lcd_fillrect(0, LCD_HEIGHT-MESSAGE_HEIGHT, LCD_WIDTH, MESSAGE_HEIGHT); |
966 | rb->lcd_set_drawmode(DRMODE_SOLID); | 748 | rb->lcd_set_drawmode(DRMODE_SOLID); |
967 | center_text(LCD_HEIGHT-8, "Loaded Settings"); | 749 | draw_message(MESSAGE_LOADED, 1); |
968 | } | 750 | } |
969 | else /* must be invalid, bail out */ | 751 | else /* must be invalid, bail out */ |
970 | { | 752 | { |
971 | rb->lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID); | 753 | rb->lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID); |
972 | rb->lcd_fillrect(0, LCD_HEIGHT-8, LCD_WIDTH, 8); | 754 | rb->lcd_fillrect(0, LCD_HEIGHT-MESSAGE_HEIGHT, LCD_WIDTH, MESSAGE_HEIGHT); |
973 | rb->lcd_set_drawmode(DRMODE_SOLID); | 755 | rb->lcd_set_drawmode(DRMODE_SOLID); |
974 | center_text(LCD_HEIGHT-8, "Old Settings File"); | 756 | draw_message(MESSAGE_ERRLOAD, 1); |
757 | |||
975 | reset_settings(); | 758 | reset_settings(); |
976 | } | 759 | } |
977 | } | 760 | } |
978 | else /* must be missing, bail out */ | 761 | else /* must be missing, bail out */ |
979 | { | 762 | { |
980 | rb->lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID); | 763 | rb->lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID); |
981 | rb->lcd_fillrect(0, LCD_HEIGHT-8, LCD_WIDTH, 8); | 764 | rb->lcd_fillrect(0, LCD_HEIGHT-MESSAGE_HEIGHT, LCD_WIDTH, MESSAGE_HEIGHT); |
982 | rb->lcd_set_drawmode(DRMODE_SOLID); | 765 | rb->lcd_set_drawmode(DRMODE_SOLID); |
983 | center_text(LCD_HEIGHT-8, "No Settings File"); | 766 | draw_message(MESSAGE_ERRLOAD, 1); |
984 | 767 | ||
985 | /* use the default in this case */ | ||
986 | reset_settings(); | 768 | reset_settings(); |
987 | } | 769 | } |
988 | 770 | ||
@@ -993,8 +775,6 @@ void load_settings(void) | |||
993 | #endif | 775 | #endif |
994 | 776 | ||
995 | rb->sleep(HZ); | 777 | rb->sleep(HZ); |
996 | |||
997 | exit_logo(); | ||
998 | } | 778 | } |
999 | 779 | ||
1000 | /******************************* | 780 | /******************************* |
@@ -1006,7 +786,7 @@ void init_clock(void) | |||
1006 | #define ANALOG_YCENTER (LCD_HEIGHT/2) | 786 | #define ANALOG_YCENTER (LCD_HEIGHT/2) |
1007 | #define ANALOG_XCENTER (LCD_WIDTH/2) | 787 | #define ANALOG_XCENTER (LCD_WIDTH/2) |
1008 | #define ANALOG_MIN_RADIUS MIN(LCD_HEIGHT/2 -10, LCD_WIDTH/2 -10) | 788 | #define ANALOG_MIN_RADIUS MIN(LCD_HEIGHT/2 -10, LCD_WIDTH/2 -10) |
1009 | #define ANALOG_HR_RADIUS (ANALOG_MIN_RADIUS-8) | 789 | #define ANALOG_HR_RADIUS ((2 * ANALOG_MIN_RADIUS)/3) |
1010 | 790 | ||
1011 | #define PI 3.141592 | 791 | #define PI 3.141592 |
1012 | int i; | 792 | int i; |
@@ -1025,43 +805,53 @@ void init_clock(void) | |||
1025 | 805 | ||
1026 | for(i=0; i<ANALOG_VALUES; i++) | 806 | for(i=0; i<ANALOG_VALUES; i++) |
1027 | { | 807 | { |
1028 | xminute[i] = (sin(360 * i / ANALOG_VALUES) * ANALOG_MIN_RADIUS / 16384) + | 808 | xminute[i] = ((sin(360 * i / ANALOG_VALUES) |
1029 | ANALOG_XCENTER; | 809 | * ANALOG_MIN_RADIUS) >> 14) + ANALOG_XCENTER; |
1030 | yminute[i] = (sin(360*i/ ANALOG_VALUES+90) * ANALOG_MIN_RADIUS / 16384) + | 810 | yminute[i] = ((sin(360*i/ ANALOG_VALUES-90) |
1031 | ANALOG_YCENTER; | 811 | * ANALOG_MIN_RADIUS) >> 14) + ANALOG_YCENTER; |
1032 | xhour[i] = (sin(360 * i / ANALOG_VALUES) * ANALOG_HR_RADIUS / 16384) + | 812 | xhour[i] = ((sin(360 * i / ANALOG_VALUES) |
1033 | ANALOG_XCENTER; | 813 | * ANALOG_HR_RADIUS) >> 14) + ANALOG_XCENTER; |
1034 | yhour[i] = (sin(360 * i / ANALOG_VALUES+90) * ANALOG_HR_RADIUS / 16384) + | 814 | yhour[i] = ((sin(360 * i / ANALOG_VALUES-90) |
1035 | ANALOG_YCENTER; | 815 | * ANALOG_HR_RADIUS) >> 14) + ANALOG_YCENTER; |
1036 | 816 | ||
1037 | /* Fullscreen initialization */ | 817 | /* Fullscreen initialization */ |
1038 | if(i==0) | 818 | if(i==0) |
1039 | { | 819 | { |
1040 | xminute_full[i]=LCD_WIDTH/2; | 820 | xminute_full[i] = LCD_WIDTH/2; |
1041 | yminute_full[i]=1; | 821 | xhour_full[i] = LCD_WIDTH/2; |
822 | yminute_full[i] = 1; | ||
823 | yhour_full[i] = LCD_HEIGHT/6; | ||
1042 | } | 824 | } |
1043 | else if(i<10 || (i>50 && i <60) ) | 825 | else if(i<10 || (i>50 && i <60) ) |
1044 | { | 826 | { |
1045 | xminute_full[i] = xminute_full[i-1]+LCD_WIDTH/20; | 827 | xminute_full[i] = xminute_full[i-1]+LCD_WIDTH/20; |
828 | xhour_full[i] = xhour_full[i-1]+(LCD_WIDTH/30); | ||
1046 | yminute_full[i] = 1; | 829 | yminute_full[i] = 1; |
830 | yhour_full[i] = LCD_HEIGHT/6; | ||
1047 | } | 831 | } |
1048 | 832 | ||
1049 | else if (i>=10 && i < 20) | 833 | else if (i>=10 && i < 20) |
1050 | { | 834 | { |
1051 | xminute_full[i] = LCD_WIDTH-2; | 835 | xminute_full[i] = LCD_WIDTH-2; |
1052 | yminute_full[i] = (i-10)*LCD_HEIGHT/10; | 836 | xhour_full[i] = (5*LCD_WIDTH)/6; |
837 | yminute_full[i] = ((i-10)*LCD_HEIGHT)/10; | ||
838 | yhour_full[i] = (LCD_HEIGHT/6)+((i-10)*(LCD_HEIGHT))/15; | ||
1053 | } | 839 | } |
1054 | 840 | ||
1055 | else if(i>=20&&i<40) | 841 | else if(i>=20&&i<40) |
1056 | { | 842 | { |
1057 | xminute_full[i] = (40-i)*LCD_WIDTH/20; | 843 | xminute_full[i] = ((40-i)*LCD_WIDTH)/20; |
1058 | yminute_full[i] = LCD_HEIGHT- 2; | 844 | xhour_full[i] = (LCD_WIDTH/6)+((40-i)*(LCD_WIDTH))/30; |
1059 | 845 | yminute_full[i] = LCD_HEIGHT-2; | |
846 | yhour_full[i] = (5*LCD_HEIGHT)/6; | ||
847 | |||
1060 | } | 848 | } |
1061 | else | 849 | else |
1062 | { | 850 | { |
1063 | xminute_full[i] = 1; | 851 | xminute_full[i] = 1; |
1064 | yminute_full[i] = (50-i)*LCD_HEIGHT/10; | 852 | xhour_full[i] = LCD_WIDTH/6; |
853 | yminute_full[i] = ((50-i)*LCD_HEIGHT)/10; | ||
854 | yhour_full[i] = LCD_HEIGHT/6 + ((50-i)*LCD_HEIGHT)/15; | ||
1065 | } | 855 | } |
1066 | } | 856 | } |
1067 | } | 857 | } |
@@ -1071,405 +861,216 @@ void init_clock(void) | |||
1071 | ******************/ | 861 | ******************/ |
1072 | void analog_clock(int hour, int minute, int second) | 862 | void analog_clock(int hour, int minute, int second) |
1073 | { | 863 | { |
1074 | int pos, i; | 864 | if(hour > 12) |
865 | hour -= 12; | ||
866 | |||
867 | int i; | ||
868 | int hourpos = (hour*5) + (minute/12); | ||
1075 | 869 | ||
1076 | /* Second hand */ | 870 | /* Crappy fake antialiasing (color LCDs only)! |
871 | * how this works is we draw a large mid-gray hr/min/sec hand, | ||
872 | * then the actual (slightly smaller) hand on top of those. | ||
873 | * End result: mid-gray edges to the black hands, smooths them out. */ | ||
874 | #ifdef HAVE_LCD_COLOR | ||
875 | rb->lcd_set_foreground(LCD_RGBPACK(100,110,125)); | ||
876 | |||
877 | /* second hand */ | ||
1077 | if(settings.analog[analog_secondhand]) | 878 | if(settings.analog[analog_secondhand]) |
1078 | { | 879 | { |
1079 | pos = 90-second; | 880 | xlcd_filltriangle(LCD_WIDTH/2, LCD_HEIGHT/2-2, LCD_WIDTH/2, LCD_HEIGHT/2+2, |
1080 | if(pos >= 60) | 881 | xminute[second], yminute[second]); |
1081 | pos -= 60; | 882 | xlcd_filltriangle(LCD_WIDTH/2-2, LCD_HEIGHT/2, LCD_WIDTH/2+2, LCD_HEIGHT/2, |
1082 | 883 | xminute[second], yminute[second]); | |
1083 | rb->lcd_drawline((LCDWIDTH/2), (LCDHEIGHT/2), | ||
1084 | xminute[pos], yminute[pos]); | ||
1085 | } | 884 | } |
1086 | 885 | ||
1087 | pos = 90-minute; | 886 | /* minute hand */ |
1088 | if(pos >= 60) | 887 | xlcd_filltriangle(LCD_WIDTH/2, LCD_HEIGHT/2-4, LCD_WIDTH/2, LCD_HEIGHT/2+4, |
1089 | pos -= 60; | 888 | xminute[minute], yminute[minute]); |
1090 | 889 | xlcd_filltriangle(LCD_WIDTH/2-4, LCD_HEIGHT/2, LCD_WIDTH/2+4, LCD_HEIGHT/2, | |
1091 | /* Minute hand, thicker than the second hand */ | 890 | xminute[minute], yminute[minute]); |
1092 | rb->lcd_drawline(LCDWIDTH/2, LCDHEIGHT/2, | ||
1093 | xminute[pos], yminute[pos]); | ||
1094 | rb->lcd_drawline(LCDWIDTH/2-1, LCDHEIGHT/2-1, | ||
1095 | xminute[pos], yminute[pos]); | ||
1096 | rb->lcd_drawline(LCDWIDTH/2+1, LCDHEIGHT/2+1, | ||
1097 | xminute[pos], yminute[pos]); | ||
1098 | rb->lcd_drawline(LCDWIDTH/2-1, LCDHEIGHT/2+1, | ||
1099 | xminute[pos], yminute[pos]); | ||
1100 | rb->lcd_drawline(LCDWIDTH/2+1, LCDHEIGHT/2-1, | ||
1101 | xminute[pos], yminute[pos]); | ||
1102 | 891 | ||
1103 | if(hour > 12) | 892 | /* hour hand */ |
1104 | hour -= 12; | 893 | xlcd_filltriangle(LCD_WIDTH/2, LCD_HEIGHT/2-4, LCD_WIDTH/2, LCD_HEIGHT/2+4, |
894 | xhour[hourpos], yhour[hourpos]); | ||
895 | xlcd_filltriangle(LCD_WIDTH/2-4, LCD_HEIGHT/2, LCD_WIDTH/2+4, LCD_HEIGHT/2, | ||
896 | xhour[hourpos], yhour[hourpos]); | ||
897 | |||
898 | rb->lcd_set_foreground(LCD_BLACK); | ||
899 | #endif | ||
900 | |||
901 | /* second hand, if needed */ | ||
902 | if(settings.analog[analog_secondhand]) | ||
903 | { | ||
904 | xlcd_filltriangle(LCD_WIDTH/2, LCD_HEIGHT/2-1, LCD_WIDTH/2, LCD_HEIGHT/2+1, | ||
905 | xminute[second], yminute[second]); | ||
906 | xlcd_filltriangle(LCD_WIDTH/2-1, LCD_HEIGHT/2, LCD_WIDTH/2+1, LCD_HEIGHT/2, | ||
907 | xminute[second], yminute[second]); | ||
908 | } | ||
1105 | 909 | ||
1106 | hour = (hour*5) + (minute/12); | 910 | /* minute hand */ |
1107 | pos = 90-hour; | 911 | xlcd_filltriangle(LCD_WIDTH/2, LCD_HEIGHT/2-HAND_W, LCD_WIDTH/2, |
1108 | if(pos >= 60) | 912 | LCD_HEIGHT/2+HAND_W, xminute[minute], yminute[minute]); |
1109 | pos -= 60; | 913 | xlcd_filltriangle(LCD_WIDTH/2-HAND_W, LCD_HEIGHT/2, LCD_WIDTH/2 |
1110 | 914 | +HAND_W, LCD_HEIGHT/2, xminute[minute], yminute[minute]); | |
1111 | /* Hour hand, thick as the minute hand but shorter */ | 915 | |
1112 | rb->lcd_drawline(LCDWIDTH/2, LCDHEIGHT/2, | 916 | /* hour hand */ |
1113 | xhour[pos], yhour[pos]); | 917 | xlcd_filltriangle(LCD_WIDTH/2, LCD_HEIGHT/2-HAND_W, LCD_WIDTH/2, |
1114 | rb->lcd_drawline(LCDWIDTH/2-1, LCDHEIGHT/2-1, | 918 | LCD_HEIGHT/2+HAND_W, xhour[hourpos], yhour[hourpos]); |
1115 | xhour[pos], yhour[pos]); | 919 | xlcd_filltriangle(LCD_WIDTH/2-HAND_W, LCD_HEIGHT/2, LCD_WIDTH/2 |
1116 | rb->lcd_drawline(LCDWIDTH/2+1, LCDHEIGHT/2+1, | 920 | +HAND_W, LCD_HEIGHT/2, xhour[hourpos], yhour[hourpos]); |
1117 | xhour[pos], yhour[pos]); | ||
1118 | rb->lcd_drawline(LCDWIDTH/2-1, LCDHEIGHT/2+1, | ||
1119 | xhour[pos], yhour[pos]); | ||
1120 | rb->lcd_drawline(LCDWIDTH/2+1, LCDHEIGHT/2-1, | ||
1121 | xhour[pos], yhour[pos]); | ||
1122 | 921 | ||
1123 | /* Draw the circle */ | 922 | /* Draw the circle */ |
1124 | for(i=0; i < 60; i+=5) | 923 | for(i=0; i < 60; i+=5) |
1125 | rb->lcd_fillrect(xminute[i]-1, yminute[i]-1, 3, 3); | 924 | rb->lcd_fillrect(xminute[i]-1, yminute[i]-1, 3, 3); |
1126 | 925 | ||
1127 | /* Draw the cover over the center */ | 926 | /* Draw the cover over the center */ |
1128 | rb->lcd_drawline((LCDWIDTH/2)-1, (LCDHEIGHT/2)+3, | 927 | rb->lcd_drawline((LCD_WIDTH/2)-1, (LCD_HEIGHT/2)+3, |
1129 | (LCDWIDTH/2)+1, (LCDHEIGHT/2)+3); | 928 | (LCD_WIDTH/2)+1, (LCD_HEIGHT/2)+3); |
1130 | rb->lcd_drawline((LCDWIDTH/2)-3, (LCDHEIGHT/2)+2, | 929 | rb->lcd_drawline((LCD_WIDTH/2)-3, (LCD_HEIGHT/2)+2, |
1131 | (LCDWIDTH/2)+3, (LCDHEIGHT/2)+2); | 930 | (LCD_WIDTH/2)+3, (LCD_HEIGHT/2)+2); |
1132 | rb->lcd_drawline((LCDWIDTH/2)-4, (LCDHEIGHT/2)+1, | 931 | rb->lcd_drawline((LCD_WIDTH/2)-4, (LCD_HEIGHT/2)+1, |
1133 | (LCDWIDTH/2)+4, (LCDHEIGHT/2)+1); | 932 | (LCD_WIDTH/2)+4, (LCD_HEIGHT/2)+1); |
1134 | rb->lcd_drawline((LCDWIDTH/2)-4, LCDHEIGHT/2, | 933 | rb->lcd_drawline((LCD_WIDTH/2)-4, LCD_HEIGHT/2, |
1135 | (LCDWIDTH/2)+4, LCDHEIGHT/2); | 934 | (LCD_WIDTH/2)+4, LCD_HEIGHT/2); |
1136 | rb->lcd_drawline((LCDWIDTH/2)-4, (LCDHEIGHT/2)-1, | 935 | rb->lcd_drawline((LCD_WIDTH/2)-4, (LCD_HEIGHT/2)-1, |
1137 | (LCDWIDTH/2)+4, (LCDHEIGHT/2)-1); | 936 | (LCD_WIDTH/2)+4, (LCD_HEIGHT/2)-1); |
1138 | rb->lcd_drawline((LCDWIDTH/2)-3, (LCDHEIGHT/2)-2, | 937 | rb->lcd_drawline((LCD_WIDTH/2)-3, (LCD_HEIGHT/2)-2, |
1139 | (LCDWIDTH/2)+3, (LCDHEIGHT/2)-2); | 938 | (LCD_WIDTH/2)+3, (LCD_HEIGHT/2)-2); |
1140 | rb->lcd_drawline((LCDWIDTH/2)-1, (LCDHEIGHT/2)-3, | 939 | rb->lcd_drawline((LCD_WIDTH/2)-1, (LCD_HEIGHT/2)-3, |
1141 | (LCDWIDTH/2)+1, (LCDHEIGHT/2)-3); | 940 | (LCD_WIDTH/2)+1, (LCD_HEIGHT/2)-3); |
1142 | } | 941 | } |
1143 | 942 | ||
1144 | /************************************************************* | 943 | /******************** |
1145 | * 7-Segment LED/LCD imitation code, by Linus Nielsen Feltzing | 944 | * Digital clock mode |
1146 | ************************************************************/ | 945 | *******************/ |
1147 | /* | 946 | void digital_clock(int hour, int minute, int second, bool colon) |
1148 | a 0 b | ||
1149 | #########c | ||
1150 | # #` | ||
1151 | # # | ||
1152 | 1# #2 | ||
1153 | # # | ||
1154 | # 3 # | ||
1155 | c ######### d | ||
1156 | # # | ||
1157 | # # | ||
1158 | 4# #5 | ||
1159 | # # | ||
1160 | # 6 # | ||
1161 | e ######### f | ||
1162 | */ | ||
1163 | static unsigned int point_coords[6][2] = | ||
1164 | { | 947 | { |
1165 | {0, 0}, /* a */ | 948 | int x_ofs=0; |
1166 | {1, 0}, /* b */ | ||
1167 | {0, 1}, /* c */ | ||
1168 | {1, 1}, /* d */ | ||
1169 | {0, 2}, /* e */ | ||
1170 | {1, 2} /* f */ | ||
1171 | }; | ||
1172 | 949 | ||
1173 | /******************************************** | 950 | /* this basically detects if we draw an AM or PM bitmap. |
1174 | * The end points (a-f) for each segment line | 951 | * if we don't, we center the hh:mm display. */ |
1175 | *******************************************/ | 952 | if(!settings.digital[digital_format]) |
1176 | static unsigned int seg_points[7][2] = | 953 | x_ofs=DIGIT_WIDTH/2; |
1177 | { | ||
1178 | {0,1}, /* a to b */ | ||
1179 | {0,2}, /* a to c */ | ||
1180 | {1,3}, /* b to d */ | ||
1181 | {2,3}, /* c to d */ | ||
1182 | {2,4}, /* c to e */ | ||
1183 | {3,5}, /* d to f */ | ||
1184 | {4,5} /* e to f */ | ||
1185 | }; | ||
1186 | 954 | ||
1187 | /********************************************************************** | 955 | #if LCD_DEPTH == 1 |
1188 | * Lists that tell which segments (0-6) to enable for each digit (0-9), | 956 | rb->lcd_fillrect(0,0,112,64); |
1189 | * the list is terminated with -1 | 957 | #endif |
1190 | *********************************************************************/ | ||
1191 | static int digit_segs[10][8] = | ||
1192 | { | ||
1193 | {0,1,2,4,5,6, -1}, /* 0 */ | ||
1194 | {2,5, -1}, /* 1 */ | ||
1195 | {0,2,3,4,6, -1}, /* 2 */ | ||
1196 | {0,2,3,5,6, -1}, /* 3 */ | ||
1197 | {1,2,3,5, -1}, /* 4 */ | ||
1198 | {0,1,3,5,6, -1}, /* 5 */ | ||
1199 | {0,1,3,4,5,6, -1}, /* 6 */ | ||
1200 | {0,2,5, -1}, /* 7 */ | ||
1201 | {0,1,2,3,4,5,6, -1}, /* 8 */ | ||
1202 | {0,1,2,3,5,6, -1} /* 9 */ | ||
1203 | }; | ||
1204 | 958 | ||
1205 | /*********************************** | 959 | if(settings.digital[digital_format]) |
1206 | * Draws one segment - LED imitation | ||
1207 | **********************************/ | ||
1208 | void draw_seg_led(int seg, int x, int y, int width, int height) | ||
1209 | { | ||
1210 | int p1 = seg_points[seg][0]; | ||
1211 | int p2 = seg_points[seg][1]; | ||
1212 | int x1 = point_coords[p1][0]; | ||
1213 | int y1 = point_coords[p1][1]; | ||
1214 | int x2 = point_coords[p2][0]; | ||
1215 | int y2 = point_coords[p2][1]; | ||
1216 | |||
1217 | /* It draws parallel lines of different lengths for thicker segments */ | ||
1218 | if(seg == 0 || seg == 3 || seg == 6) | ||
1219 | { | ||
1220 | rb->lcd_drawline(x + x1 * width + 1, y + y1 * height / 2, | ||
1221 | x + x2 * width - 1 , y + y2 * height / 2); | ||
1222 | |||
1223 | rb->lcd_drawline(x + x1 * width + 2, y + y1 * height / 2 - 1, | ||
1224 | x + x2 * width - 2, y + y2 * height / 2 - 1); | ||
1225 | rb->lcd_drawline(x + x1 * width + 2, y + y1 * height / 2 + 1, | ||
1226 | x + x2 * width - 2, y + y2 * height / 2 + 1); | ||
1227 | |||
1228 | rb->lcd_drawline(x + x1 * width + 3, y + y1 * height / 2 - 2, | ||
1229 | x + x2 * width - 3, y + y2 * height / 2 - 2); | ||
1230 | rb->lcd_drawline(x + x1 * width + 3, y + y1 * height / 2 + 2, | ||
1231 | x + x2 * width - 3, y + y2 * height / 2 + 2); | ||
1232 | } | ||
1233 | else | ||
1234 | { | 960 | { |
1235 | rb->lcd_drawline(x + x1 * width, y + y1 * height / 2 + 1, | 961 | /* draw the AM or PM bitmap */ |
1236 | x + x2 * width , y + y2 * height / 2 - 1); | 962 | if(hour<12) |
1237 | 963 | draw_segment(SEGMENT_AM,DIGIT_XOFS(6)+DIGIT_WIDTH*5, 0); | |
1238 | rb->lcd_drawline(x + x1 * width - 1, y + y1 * height / 2 + 2, | 964 | else |
1239 | x + x2 * width - 1, y + y2 * height / 2 - 2); | 965 | draw_segment(SEGMENT_PM,DIGIT_XOFS(6)+DIGIT_WIDTH*5, 0); |
1240 | rb->lcd_drawline(x + x1 * width + 1, y + y1 * height / 2 + 2, | ||
1241 | x + x2 * width + 1, y + y2 * height / 2 - 2); | ||
1242 | |||
1243 | rb->lcd_drawline(x + x1 * width - 2, y + y1 * height / 2 + 3, | ||
1244 | x + x2 * width - 2, y + y2 * height / 2 - 3); | ||
1245 | 966 | ||
1246 | rb->lcd_drawline(x + x1 * width + 2, y + y1 * height / 2 + 3, | 967 | /* and then readjust the hour to 12-hour format |
1247 | x + x2 * width + 2, y + y2 * height / 2 - 3); | 968 | * ( 13:00+ -> 1:00+ ) */ |
969 | if(hour>12) | ||
970 | hour -= 12; | ||
1248 | } | 971 | } |
1249 | } | ||
1250 | 972 | ||
1251 | /*********************************** | 973 | /* hour */ |
1252 | * Draws one segment - LCD imitation | 974 | draw_segment(hour/10, DIGIT_XOFS(6)+x_ofs, 0); |
1253 | **********************************/ | 975 | draw_segment(hour%10, DIGIT_XOFS(6)+DIGIT_WIDTH+x_ofs, 0); |
1254 | void draw_seg_lcd(int seg, int x, int y, int width, int height) | ||
1255 | { | ||
1256 | int p1 = seg_points[seg][0]; | ||
1257 | int p2 = seg_points[seg][1]; | ||
1258 | int x1 = point_coords[p1][0]; | ||
1259 | int y1 = point_coords[p1][1]; | ||
1260 | int x2 = point_coords[p2][0]; | ||
1261 | int y2 = point_coords[p2][1]; | ||
1262 | |||
1263 | if(seg == 0) | ||
1264 | { | ||
1265 | rb->lcd_drawline(x + x1 * width, y + y1 * height / 2 - 1, | ||
1266 | x + x2 * width, y + y2 * height / 2 - 1); | ||
1267 | rb->lcd_drawline(x + x1 * width + 1, y + y1 * height / 2, | ||
1268 | x + x2 * width - 1, y + y2 * height / 2); | ||
1269 | rb->lcd_drawline(x + x1 * width + 2, y + y1 * height / 2 + 1, | ||
1270 | x + x2 * width - 2, y + y2 * height / 2 + 1); | ||
1271 | rb->lcd_drawline(x + x1 * width + 3, y + y1 * height / 2 + 2, | ||
1272 | x + x2 * width - 3, y + y2 * height / 2 + 2); | ||
1273 | } | ||
1274 | else if(seg == 3) | ||
1275 | { | ||
1276 | rb->lcd_drawline(x + x1 * width + 1, y + y1 * height / 2, | ||
1277 | x + x2 * width - 1, y + y2 * height / 2); | ||
1278 | rb->lcd_drawline(x + x1 * width + 2, y + y1 * height / 2 - 1, | ||
1279 | x + x2 * width - 2, y + y2 * height / 2 - 1); | ||
1280 | rb->lcd_drawline(x + x1 * width + 2, y + y1 * height / 2 + 1, | ||
1281 | x + x2 * width - 2, y + y2 * height / 2 + 1); | ||
1282 | rb->lcd_drawline(x + x1 * width + 3, y + y1 * height / 2 - 2, | ||
1283 | x + x2 * width - 3, y + y2 * height / 2 - 2); | ||
1284 | rb->lcd_drawline(x + x1 * width + 3, y + y1 * height / 2 + 2, | ||
1285 | x + x2 * width - 3, y + y2 * height / 2 + 2); | ||
1286 | } | ||
1287 | else if(seg == 6) | ||
1288 | { | ||
1289 | rb->lcd_drawline(x + x1 * width, y + y1 * height / 2 + 1, | ||
1290 | x + x2 * width, y + y2 * height / 2 + 1); | ||
1291 | rb->lcd_drawline(x + x1 * width + 1, y + y1 * height / 2, | ||
1292 | x + x2 * width - 1, y + y2 * height / 2); | ||
1293 | rb->lcd_drawline(x + x1 * width + 2, y + y1 * height / 2 - 1, | ||
1294 | x + x2 * width - 2, y + y2 * height / 2 - 1); | ||
1295 | rb->lcd_drawline(x + x1 * width + 3, y + y1 * height / 2 - 2, | ||
1296 | x + x2 * width - 3, y + y2 * height / 2 - 2); | ||
1297 | 976 | ||
1298 | } | 977 | /* colon */ |
1299 | else if(seg == 1 || seg == 4) | 978 | if(colon) |
1300 | { | 979 | draw_segment(COLON, DIGIT_XOFS(6)+2*DIGIT_WIDTH+x_ofs, 0); |
1301 | rb->lcd_drawline(x + x1 * width - 1, y + y1 * height / 2, | ||
1302 | x + x2 * width - 1, y + y2 * height / 2); | ||
1303 | rb->lcd_drawline(x + x1 * width, y + y1 * height / 2 + 1, | ||
1304 | x + x2 * width, y + y2 * height / 2 - 1); | ||
1305 | rb->lcd_drawline(x + x1 * width + 1, y + y1 * height / 2 + 2, | ||
1306 | x + x2 * width + 1, y + y2 * height / 2 - 2); | ||
1307 | rb->lcd_drawline(x + x1 * width + 2, y + y1 * height / 2 + 3, | ||
1308 | x + x2 * width + 2, y + y2 * height / 2 - 3); | ||
1309 | } | ||
1310 | else if(seg == 2 || seg == 5) | ||
1311 | { | ||
1312 | rb->lcd_drawline(x + x1 * width + 1, y + y1 * height / 2, | ||
1313 | x + x2 * width + 1, y + y2 * height / 2); | ||
1314 | rb->lcd_drawline(x + x1 * width, y + y1 * height / 2 + 1, | ||
1315 | x + x2 * width, y + y2 * height / 2 - 1); | ||
1316 | rb->lcd_drawline(x + x1 * width - 1, y + y1 * height / 2 + 2, | ||
1317 | x + x2 * width - 1, y + y2 * height / 2 - 2); | ||
1318 | rb->lcd_drawline(x + x1 * width - 2, y + y1 * height / 2 + 3, | ||
1319 | x + x2 * width - 2, y + y2 * height / 2 - 3); | ||
1320 | } | ||
1321 | } | ||
1322 | 980 | ||
1323 | /***************** | 981 | /* minutes */ |
1324 | * Draws one digit | 982 | draw_segment(minute/10, DIGIT_XOFS(6)+3*DIGIT_WIDTH+x_ofs, 0); |
1325 | ****************/ | 983 | draw_segment(minute%10, DIGIT_XOFS(6)+4*DIGIT_WIDTH+x_ofs, 0); |
1326 | void draw_7seg_digit(int digit, int x, int y, int width, int height, bool lcd_display) | ||
1327 | { | ||
1328 | int i; | ||
1329 | int c; | ||
1330 | 984 | ||
1331 | for(i = 0;digit_segs[digit][i] >= 0;i++) | 985 | if(settings.digital[digital_seconds]) |
1332 | { | 986 | { |
1333 | c = digit_segs[digit][i]; | 987 | draw_segment(second/10, DIGIT_XOFS(2), DIGIT_HEIGHT); |
1334 | 988 | draw_segment(second%10, DIGIT_XOFS(2)+DIGIT_WIDTH, DIGIT_HEIGHT); | |
1335 | if(!lcd_display) | ||
1336 | draw_seg_led(c, x, y, width, height); | ||
1337 | else | ||
1338 | draw_seg_lcd(c, x, y, width, height); | ||
1339 | } | 989 | } |
1340 | } | 990 | } |
1341 | 991 | ||
1342 | /***************************************************** | 992 | /*********************** |
1343 | * Draws the entire 7-segment hour-minute time display | 993 | * Fullscreen clock mode |
1344 | ****************************************************/ | 994 | **********************/ |
1345 | void draw_7seg_time(int hour, int minute, int x, int y, int width, int height, | 995 | void fullscreen_clock(int hour, int minute, int second) |
1346 | bool colon, bool lcd) | ||
1347 | { | 996 | { |
1348 | int xpos = x; | 997 | if(hour > 12) |
1349 | 998 | hour -= 12; | |
1350 | /* Draw AM/PM indicator */ | ||
1351 | if(settings.clock == DIGITAL) | ||
1352 | { | ||
1353 | if(settings.digital[digital_12h]) | ||
1354 | { | ||
1355 | if(hour > 12) | ||
1356 | rb->lcd_mono_bitmap(pm, 97, LCD_HEIGHT-9, 15, 8); | ||
1357 | else | ||
1358 | rb->lcd_mono_bitmap(am, 1, LCD_HEIGHT-9, 15, 8); | ||
1359 | } | ||
1360 | } | ||
1361 | else | ||
1362 | { | ||
1363 | if(settings.lcd[lcd_12h]) | ||
1364 | { | ||
1365 | if(hour > 12) | ||
1366 | rb->lcd_mono_bitmap(pm, 97, LCD_HEIGHT-9, 15, 8); | ||
1367 | else | ||
1368 | rb->lcd_mono_bitmap(am, 1, LCD_HEIGHT-9, 15, 8); | ||
1369 | } | ||
1370 | } | ||
1371 | 999 | ||
1372 | /* Now change to 12H mode if requested */ | 1000 | int i; |
1373 | if(settings.clock == DIGITAL) | 1001 | int hourpos = (hour*5) + (minute/12); |
1374 | { | ||
1375 | if(settings.digital[digital_12h]) | ||
1376 | { | ||
1377 | if(hour >= 12) | ||
1378 | hour -= 12; | ||
1379 | } | ||
1380 | } | ||
1381 | else | ||
1382 | { | ||
1383 | if(settings.lcd[lcd_12h]) | ||
1384 | { | ||
1385 | if(hour >= 12) | ||
1386 | hour -= 12; | ||
1387 | } | ||
1388 | } | ||
1389 | 1002 | ||
1390 | draw_7seg_digit(hour / 10, xpos, y, width, height, lcd); | 1003 | /* Crappy fake antialiasing (color LCDs only)! |
1391 | xpos += width + 6; | 1004 | * how this works is we draw a large mid-gray hr/min/sec hand, |
1392 | draw_7seg_digit(hour % 10, xpos, y, width, height, lcd); | 1005 | * then the actual (slightly smaller) hand on top of those. |
1393 | xpos += width + 6; | 1006 | * End result: mid-gray edges to the black hands, smooths them out. */ |
1007 | #ifdef HAVE_LCD_COLOR | ||
1008 | rb->lcd_set_foreground(LCD_RGBPACK(100,110,125)); | ||
1394 | 1009 | ||
1395 | if(colon) | 1010 | /* second hand */ |
1011 | if(settings.analog[analog_secondhand]) | ||
1396 | { | 1012 | { |
1397 | rb->lcd_mono_bitmap(digital_colon, xpos, y + height-height/3, 5, 5); | 1013 | xlcd_filltriangle(LCD_WIDTH/2, LCD_HEIGHT/2-2, LCD_WIDTH/2, LCD_HEIGHT/2+2, |
1398 | rb->lcd_mono_bitmap(digital_colon, xpos, y + height/3, 5, 5); | 1014 | xminute_full[second], yminute_full[second]); |
1015 | xlcd_filltriangle(LCD_WIDTH/2-2, LCD_HEIGHT/2, LCD_WIDTH/2+2, LCD_HEIGHT/2, | ||
1016 | xminute_full[second], yminute_full[second]); | ||
1399 | } | 1017 | } |
1400 | 1018 | ||
1401 | xpos += 12; | 1019 | /* minute hand */ |
1020 | xlcd_filltriangle(LCD_WIDTH/2, LCD_HEIGHT/2-4, LCD_WIDTH/2, LCD_HEIGHT/2+4, | ||
1021 | xminute_full[minute], yminute_full[minute]); | ||
1022 | xlcd_filltriangle(LCD_WIDTH/2-4, LCD_HEIGHT/2, LCD_WIDTH/2+4, LCD_HEIGHT/2, | ||
1023 | xminute_full[minute], yminute_full[minute]); | ||
1402 | 1024 | ||
1403 | draw_7seg_digit(minute / 10, xpos, y, width, height, lcd); | 1025 | /* hour hand */ |
1404 | xpos += width + 6; | 1026 | xlcd_filltriangle(LCD_WIDTH/2, LCD_HEIGHT/2-4, LCD_WIDTH/2, LCD_HEIGHT/2+4, |
1405 | draw_7seg_digit(minute % 10, xpos, y, width, height, lcd); | 1027 | xhour_full[hourpos], yhour_full[hourpos]); |
1406 | xpos += width + 6; | 1028 | xlcd_filltriangle(LCD_WIDTH/2-4, LCD_HEIGHT/2, LCD_WIDTH/2+4, LCD_HEIGHT/2, |
1407 | } | 1029 | xhour_full[hourpos], yhour_full[hourpos]); |
1408 | 1030 | ||
1409 | /*********************** | 1031 | rb->lcd_set_foreground(LCD_BLACK); |
1410 | * Fullscreen clock mode | 1032 | #endif |
1411 | **********************/ | ||
1412 | void fullscreen_clock(int hour, int minute, int second) | ||
1413 | { | ||
1414 | int pos; | ||
1415 | 1033 | ||
1416 | /* Second hand */ | 1034 | /* second hand, if needed */ |
1417 | if(settings.fullscreen[fullscreen_secondhand]) | 1035 | if(settings.analog[analog_secondhand]) |
1418 | { | 1036 | { |
1419 | pos = second; | 1037 | xlcd_filltriangle(LCD_WIDTH/2, LCD_HEIGHT/2-1, LCD_WIDTH/2, LCD_HEIGHT/2+1, |
1420 | 1038 | xminute_full[second], yminute_full[second]); | |
1421 | rb->lcd_drawline((LCDWIDTH/2), (LCDHEIGHT/2), | 1039 | xlcd_filltriangle(LCD_WIDTH/2-1, LCD_HEIGHT/2, LCD_WIDTH/2+1, LCD_HEIGHT/2, |
1422 | xminute_full[pos], yminute_full[pos]); | 1040 | xminute_full[second], yminute_full[second]); |
1423 | } | 1041 | } |
1424 | 1042 | ||
1425 | pos = minute; | 1043 | /* minute hand */ |
1044 | xlcd_filltriangle(LCD_WIDTH/2, LCD_HEIGHT/2-3, LCD_WIDTH/2, LCD_HEIGHT/2+3, | ||
1045 | xminute_full[minute], yminute_full[minute]); | ||
1046 | xlcd_filltriangle(LCD_WIDTH/2-3, LCD_HEIGHT/2, LCD_WIDTH/2+3, LCD_HEIGHT/2, | ||
1047 | xminute_full[minute], yminute_full[minute]); | ||
1426 | 1048 | ||
1427 | /* Minute hand, thicker than the second hand */ | 1049 | /* hour hand */ |
1428 | rb->lcd_drawline(LCDWIDTH/2, LCDHEIGHT/2, | 1050 | xlcd_filltriangle(LCD_WIDTH/2, LCD_HEIGHT/2-3, LCD_WIDTH/2, LCD_HEIGHT/2+3, |
1429 | xminute_full[pos], yminute_full[pos]); | 1051 | xhour_full[hourpos], yhour_full[hourpos]); |
1430 | rb->lcd_drawline(LCDWIDTH/2-1, LCDHEIGHT/2-1, | 1052 | xlcd_filltriangle(LCD_WIDTH/2-3, LCD_HEIGHT/2, LCD_WIDTH/2+3, LCD_HEIGHT/2, |
1431 | xminute_full[pos], yminute_full[pos]); | 1053 | xhour_full[hourpos], yhour_full[hourpos]); |
1432 | rb->lcd_drawline(LCDWIDTH/2+1, LCDHEIGHT/2+1, | ||
1433 | xminute_full[pos], yminute_full[pos]); | ||
1434 | rb->lcd_drawline(LCDWIDTH/2-1, LCDHEIGHT/2+1, | ||
1435 | xminute_full[pos], yminute_full[pos]); | ||
1436 | rb->lcd_drawline(LCDWIDTH/2+1, LCDHEIGHT/2-1, | ||
1437 | xminute_full[pos], yminute_full[pos]); | ||
1438 | 1054 | ||
1439 | if(hour > 12) | 1055 | /* Draw the circle */ |
1440 | hour -= 12; | 1056 | for(i=0; i < 60; i+=5) |
1441 | 1057 | rb->lcd_fillrect(xminute_full[i]-1, yminute_full[i]-1, 3, 3); | |
1442 | hour = hour*5 + minute/12; | ||
1443 | pos = 90-hour; | ||
1444 | if(pos >= 60) | ||
1445 | pos -= 60; | ||
1446 | |||
1447 | /* Hour hand, thick as the minute hand but shorter */ | ||
1448 | rb->lcd_drawline(LCDWIDTH/2, LCDHEIGHT/2, xhour_full[pos], yhour_full[pos]); | ||
1449 | rb->lcd_drawline(LCDWIDTH/2-1, LCDHEIGHT/2-1, | ||
1450 | xhour_full[pos], yhour_full[pos]); | ||
1451 | rb->lcd_drawline(LCDWIDTH/2+1, LCDHEIGHT/2+1, | ||
1452 | xhour_full[pos], yhour_full[pos]); | ||
1453 | rb->lcd_drawline(LCDWIDTH/2-1, LCDHEIGHT/2+1, | ||
1454 | xhour_full[pos], yhour_full[pos]); | ||
1455 | rb->lcd_drawline(LCDWIDTH/2+1, LCDHEIGHT/2-1, | ||
1456 | xhour_full[pos], yhour_full[pos]); | ||
1457 | 1058 | ||
1458 | /* Draw the cover over the center */ | 1059 | /* Draw the cover over the center */ |
1459 | rb->lcd_drawline((LCDWIDTH/2)-1, (LCDHEIGHT/2)+3, | 1060 | rb->lcd_drawline((LCD_WIDTH/2)-1, (LCD_HEIGHT/2)+3, |
1460 | (LCDWIDTH/2)+1, (LCDHEIGHT/2)+3); | 1061 | (LCD_WIDTH/2)+1, (LCD_HEIGHT/2)+3); |
1461 | rb->lcd_drawline((LCDWIDTH/2)-3, (LCDHEIGHT/2)+2, | 1062 | rb->lcd_drawline((LCD_WIDTH/2)-3, (LCD_HEIGHT/2)+2, |
1462 | (LCDWIDTH/2)+3, (LCDHEIGHT/2)+2); | 1063 | (LCD_WIDTH/2)+3, (LCD_HEIGHT/2)+2); |
1463 | rb->lcd_drawline((LCDWIDTH/2)-4, (LCDHEIGHT/2)+1, | 1064 | rb->lcd_drawline((LCD_WIDTH/2)-4, (LCD_HEIGHT/2)+1, |
1464 | (LCDWIDTH/2)+4, (LCDHEIGHT/2)+1); | 1065 | (LCD_WIDTH/2)+4, (LCD_HEIGHT/2)+1); |
1465 | rb->lcd_drawline((LCDWIDTH/2)-4, LCDHEIGHT/2, | 1066 | rb->lcd_drawline((LCD_WIDTH/2)-4, LCD_HEIGHT/2, |
1466 | (LCDWIDTH/2)+4, LCDHEIGHT/2); | 1067 | (LCD_WIDTH/2)+4, LCD_HEIGHT/2); |
1467 | rb->lcd_drawline((LCDWIDTH/2)-4, (LCDHEIGHT/2)-1, | 1068 | rb->lcd_drawline((LCD_WIDTH/2)-4, (LCD_HEIGHT/2)-1, |
1468 | (LCDWIDTH/2)+4, (LCDHEIGHT/2)-1); | 1069 | (LCD_WIDTH/2)+4, (LCD_HEIGHT/2)-1); |
1469 | rb->lcd_drawline((LCDWIDTH/2)-3, (LCDHEIGHT/2)-2, | 1070 | rb->lcd_drawline((LCD_WIDTH/2)-3, (LCD_HEIGHT/2)-2, |
1470 | (LCDWIDTH/2)+3, (LCDHEIGHT/2)-2); | 1071 | (LCD_WIDTH/2)+3, (LCD_HEIGHT/2)-2); |
1471 | rb->lcd_drawline((LCDWIDTH/2)-1, (LCDHEIGHT/2)-3, | 1072 | rb->lcd_drawline((LCD_WIDTH/2)-1, (LCD_HEIGHT/2)-3, |
1472 | (LCDWIDTH/2)+1, (LCDHEIGHT/2)-3); | 1073 | (LCD_WIDTH/2)+1, (LCD_HEIGHT/2)-3); |
1473 | } | 1074 | } |
1474 | 1075 | ||
1475 | /******************* | 1076 | /******************* |
@@ -1491,18 +1092,18 @@ void binary_clock(int hour, int minute, int second) | |||
1491 | { | 1092 | { |
1492 | if(mode_var[mode] >= i) | 1093 | if(mode_var[mode] >= i) |
1493 | { | 1094 | { |
1494 | if(settings.binary[binary_dots]) | 1095 | if(settings.binary[binary_mode]) |
1495 | rb->lcd_mono_bitmap(circle_full, xpos*19, (20*mode)+1, 14, 14); | 1096 | draw_digit(DOT_FILLED, xpos*DIGIT_WIDTH+DIGIT_XOFS(6), DIGIT_HEIGHT*mode+DIGIT_YOFS(3)); |
1496 | else | 1097 | else |
1497 | rb->lcd_mono_bitmap(bitmap_1, xpos*19, (20*mode)+1, 15, 20); | 1098 | draw_digit(1, xpos*DIGIT_WIDTH+DIGIT_XOFS(6), DIGIT_HEIGHT*mode+DIGIT_YOFS(3)); |
1498 | mode_var[mode] -= i; | 1099 | mode_var[mode] -= i; |
1499 | } | 1100 | } |
1500 | else | 1101 | else |
1501 | { | 1102 | { |
1502 | if(settings.binary[binary_dots]) | 1103 | if(settings.binary[binary_mode]) |
1503 | rb->lcd_mono_bitmap(circle_empty, xpos*19, (20*mode)+1, 14, 14); | 1104 | draw_digit(DOT_EMPTY, xpos*DIGIT_WIDTH+DIGIT_XOFS(6), DIGIT_HEIGHT*mode+DIGIT_YOFS(3)); |
1504 | else | 1105 | else |
1505 | rb->lcd_mono_bitmap(bitmap_0, xpos*19, (20*mode)+1, 15, 20); | 1106 | draw_digit(0, xpos*DIGIT_WIDTH+DIGIT_XOFS(6), DIGIT_HEIGHT*mode+DIGIT_YOFS(3)); |
1506 | } | 1107 | } |
1507 | 1108 | ||
1508 | xpos++; | 1109 | xpos++; |
@@ -1517,679 +1118,304 @@ void binary_clock(int hour, int minute, int second) | |||
1517 | *****************/ | 1118 | *****************/ |
1518 | void plain_clock(int hour, int minute, int second, bool colon) | 1119 | void plain_clock(int hour, int minute, int second, bool colon) |
1519 | { | 1120 | { |
1520 | int x_offset=0; | ||
1521 | 1121 | ||
1522 | if(settings.plain[plain_12h]) | 1122 | int x_ofs=0; |
1123 | |||
1124 | /* this basically detects if we draw an AM or PM bitmap. | ||
1125 | * if we don't, we center the hh:mm display. */ | ||
1126 | if(!settings.plain[plain_format]) | ||
1127 | x_ofs=DIGIT_WIDTH/2; | ||
1128 | |||
1129 | if(settings.plain[plain_format]) | ||
1523 | { | 1130 | { |
1524 | if(hour > 12) | 1131 | /* draw the AM or PM bitmap */ |
1525 | rb->lcd_mono_bitmap(pm, 97, 10, 15, 8); | 1132 | if(hour<12) |
1133 | draw_digit(ICON_AM, DIGIT_XOFS(6)+(DIGIT_WIDTH*5)+x_ofs, 0); | ||
1526 | else | 1134 | else |
1527 | rb->lcd_mono_bitmap(am, 97, 10, 15, 8); | 1135 | draw_digit(ICON_PM, DIGIT_XOFS(6)+(DIGIT_WIDTH*5)+x_ofs, 0); |
1528 | 1136 | ||
1529 | if(hour > 12) | 1137 | /* and then readjust the hour to 12-hour format |
1530 | hour -= 12; | 1138 | * ( 13:00+ -> 1:00+ ) */ |
1531 | if(hour == 0) | 1139 | if(hour>12) |
1532 | hour = 12; | 1140 | hour -= 12; |
1533 | } | 1141 | } |
1534 | 1142 | ||
1535 | if(settings.plain[plain_12h]) /* scoot the display over for the am/pm bitmap */ | ||
1536 | x_offset = -10; | ||
1537 | 1143 | ||
1538 | rb->lcd_mono_bitmap(plain_bitmaps[hour/10], 10+x_offset, 0, 17, 28); | 1144 | draw_digit(hour/10, DIGIT_XOFS(6)+(DIGIT_WIDTH*0)+x_ofs, 0); |
1539 | rb->lcd_mono_bitmap(plain_bitmaps[hour%10], 30+x_offset, 0, 17, 28); | 1145 | draw_digit(hour%10, DIGIT_XOFS(6)+(DIGIT_WIDTH*1)+x_ofs, 0); |
1540 | 1146 | ||
1541 | if(colon) | 1147 | if(colon) |
1542 | rb->lcd_mono_bitmap(plain_colon, 50+x_offset, 0, 5, 28); | 1148 | draw_digit(COLON, DIGIT_XOFS(6)+(DIGIT_WIDTH*2)+x_ofs, 0); |
1543 | |||
1544 | rb->lcd_mono_bitmap(plain_bitmaps[minute/10], 60+x_offset, 0, 17, 28); | ||
1545 | rb->lcd_mono_bitmap(plain_bitmaps[minute%10], 80+x_offset, 0, 17, 28); | ||
1546 | |||
1547 | rb->lcd_mono_bitmap(plain_bitmaps[second/10], 70, 32, 17, 28); | ||
1548 | rb->lcd_mono_bitmap(plain_bitmaps[second%10], 90, 32, 17, 28); | ||
1549 | } | ||
1550 | |||
1551 | /**************** | ||
1552 | * Shows the logo | ||
1553 | ***************/ | ||
1554 | void show_clock_logo(bool animate, bool show_clock_text) | ||
1555 | { | ||
1556 | int y_position; | ||
1557 | 1149 | ||
1558 | if(animate) /* animate logo */ | 1150 | draw_digit(minute/10, DIGIT_XOFS(6)+(DIGIT_WIDTH*3)+x_ofs, 0); |
1559 | { | 1151 | draw_digit(minute%10, DIGIT_XOFS(6)+(DIGIT_WIDTH*4)+x_ofs, 0); |
1560 | /* move down the screen */ | ||
1561 | for(y_position = -74; y_position <= 20; y_position+=(40-y_position)/20) | ||
1562 | { | ||
1563 | rb->lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID); | ||
1564 | rb->lcd_fillrect(0, 0, LCD_WIDTH, LCD_HEIGHT-16); | ||
1565 | rb->lcd_set_drawmode(DRMODE_SOLID); | ||
1566 | rb->lcd_mono_bitmap(clock_logo, 0, y_position/2, BMPWIDTH_clock_logo, BMPHEIGHT_clock_logo); | ||
1567 | if(show_clock_text) | ||
1568 | center_text(LCD_HEIGHT-16, "Clock " CLOCK_VERSION); | ||
1569 | rb->lcd_update(); | ||
1570 | } | ||
1571 | } | ||
1572 | else /* don't animate, just show */ | ||
1573 | { | ||
1574 | rb->lcd_mono_bitmap(clock_logo, 0, 10, BMPWIDTH_clock_logo, BMPHEIGHT_clock_logo); | ||
1575 | if(show_clock_text) | ||
1576 | center_text(LCD_HEIGHT-16, "Clock " CLOCK_VERSION); | ||
1577 | rb->lcd_update(); | ||
1578 | } | ||
1579 | } | ||
1580 | |||
1581 | /******************** | ||
1582 | * Logo flies off lcd | ||
1583 | *******************/ | ||
1584 | void exit_logo() | ||
1585 | { | ||
1586 | int y_position; | ||
1587 | 1152 | ||
1588 | for(y_position = 20; y_position <= LCD_HEIGHT*2; y_position+=y_position/20) | 1153 | if(settings.plain[plain_seconds]) |
1589 | { | 1154 | { |
1590 | rb->lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID); | 1155 | draw_digit(second/10, DIGIT_XOFS(2), DIGIT_HEIGHT); |
1591 | rb->lcd_fillrect(0, 10, LCD_WIDTH, (y_position/2)); | 1156 | draw_digit(second%10, DIGIT_XOFS(2)+(DIGIT_WIDTH), DIGIT_HEIGHT); |
1592 | rb->lcd_set_drawmode(DRMODE_SOLID); | ||
1593 | rb->lcd_mono_bitmap(clock_logo, 0, y_position/2, BMPWIDTH_clock_logo, BMPHEIGHT_clock_logo); | ||
1594 | rb->lcd_update(); | ||
1595 | } | 1157 | } |
1596 | } | 1158 | } |
1597 | 1159 | ||
1598 | /******************* | 1160 | /********************** |
1599 | * Rolls the credits | 1161 | * Analog settings menu |
1600 | ******************/ | 1162 | *********************/ |
1601 | /* The following function is pretty confusing, so it's extra well commented. */ | 1163 | void analog_settings_menu(void) |
1602 | bool roll_credits(void) | ||
1603 | { | 1164 | { |
1604 | int j=0, namepos, jobpos; /* namepos/jobpos are x coords for strings of text */ | 1165 | int m=0, result; |
1605 | int offset_dummy; | ||
1606 | int btn, pause; | ||
1607 | int numnames = 12; /* amount of people in the credits array */ | ||
1608 | |||
1609 | /* used to center the text */ | ||
1610 | char name[20], job[15]; | ||
1611 | int name_w, name_h, job_w, job_h; | ||
1612 | int credits_w, credits_h, credits_pos; | ||
1613 | int name_targetpos, job_targetpos, credits_targetpos; | ||
1614 | |||
1615 | /* shows "[Credits] XX/XX" */ | ||
1616 | char elapsednames[16]; | ||
1617 | |||
1618 | /* put text into variable, and save the width and height of the text */ | ||
1619 | rb->snprintf(elapsednames, sizeof(elapsednames), "[Credits] %02d/%02d", | ||
1620 | j+1, numnames); | ||
1621 | rb->lcd_getstringsize(elapsednames, &credits_w, &credits_h); | ||
1622 | credits_targetpos = (LCDWIDTH/2)-(credits_w/2); | ||
1623 | |||
1624 | /* fly in text from the left */ | ||
1625 | for(credits_pos = 0 - credits_w; credits_pos <= credits_targetpos; | ||
1626 | credits_pos += (credits_targetpos-credits_pos + 14) / 7) | ||
1627 | { | ||
1628 | rb->lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID); | ||
1629 | rb->lcd_fillrect(0, 0, LCD_WIDTH, 8); /* clear any trails left behind */ | ||
1630 | rb->lcd_drawline(credits_pos-1, 0, credits_pos-1, 8); | ||
1631 | rb->lcd_set_drawmode(DRMODE_SOLID); | ||
1632 | rb->lcd_putsxy(credits_pos, 0, elapsednames); | ||
1633 | rb->lcd_update(); /* update the whole lcd to slow down the loop */ | ||
1634 | } | ||
1635 | |||
1636 | /* now roll the credits */ | ||
1637 | for(j=0; j < numnames; j++) | ||
1638 | { | ||
1639 | rb->lcd_clear_display(); | ||
1640 | |||
1641 | show_clock_logo(false, false); | ||
1642 | |||
1643 | rb->snprintf(elapsednames, sizeof(elapsednames), "[Credits] %02d/%02d", | ||
1644 | j+1, numnames); | ||
1645 | rb->lcd_putsxy(credits_pos-1, 0, elapsednames); | ||
1646 | |||
1647 | /* used to center the text */ | ||
1648 | rb->snprintf(name, sizeof(name), "%s", credits[j]); | ||
1649 | rb->snprintf(job, sizeof(job), "%s", jobs[j]); | ||
1650 | rb->lcd_getstringsize(name, &name_w, &name_h); | ||
1651 | rb->lcd_getstringsize(job, &job_w, &job_h); | ||
1652 | |||
1653 | name_targetpos = -10; | ||
1654 | job_targetpos = (LCDWIDTH/2)-(job_w/2)+10; | ||
1655 | |||
1656 | /* line 1 flies in */ | ||
1657 | for(namepos = 0-name_w; namepos <= name_targetpos; | ||
1658 | namepos += (name_targetpos - namepos + 14) / 7) | ||
1659 | { | ||
1660 | rb->lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID); | ||
1661 | rb->lcd_fillrect(0, LCD_HEIGHT-16, LCD_WIDTH, 8); /* clear any trails left behind */ | ||
1662 | rb->lcd_set_drawmode(DRMODE_SOLID); | ||
1663 | rb->lcd_putsxy(namepos, LCD_HEIGHT-16, name); | ||
1664 | rb->lcd_update(); | ||
1665 | |||
1666 | /* exit on keypress */ | ||
1667 | btn = rb->button_get(false); | ||
1668 | if (btn != BUTTON_NONE && !(btn & BUTTON_REL)) | ||
1669 | return false; | ||
1670 | } | ||
1671 | |||
1672 | /* line 2 flies in - we use (job_w+2) to ensure it fits on the LCD */ | ||
1673 | for(jobpos = LCDWIDTH; jobpos >= job_targetpos; | ||
1674 | jobpos -= (jobpos - job_targetpos + 14) / 7, namepos++) | ||
1675 | { | ||
1676 | rb->lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID); | ||
1677 | rb->lcd_fillrect(0, LCD_HEIGHT-16, LCD_WIDTH+job_w, 16); /* clear trails */ | ||
1678 | rb->lcd_set_drawmode(DRMODE_SOLID); | ||
1679 | rb->lcd_putsxy(namepos, LCD_HEIGHT-16, name); | ||
1680 | rb->lcd_putsxy(jobpos, LCD_HEIGHT-8, job); | ||
1681 | rb->lcd_update(); | ||
1682 | |||
1683 | /* exit on keypress */ | ||
1684 | btn = rb->button_get(false); | ||
1685 | if (btn != BUTTON_NONE && !(btn & BUTTON_REL)) | ||
1686 | return false; | ||
1687 | } | ||
1688 | 1166 | ||
1689 | /* pause and scan for button presses */ | 1167 | done = false; |
1690 | for(pause = 0; pause < 30; pause++) | ||
1691 | { | ||
1692 | rb->lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID); | ||
1693 | rb->lcd_fillrect(0, LCD_HEIGHT-16, LCD_WIDTH, 16); | ||
1694 | rb->lcd_set_drawmode(DRMODE_SOLID); | ||
1695 | rb->lcd_putsxy(namepos, LCD_HEIGHT-16, name); | ||
1696 | rb->lcd_putsxy(jobpos, LCD_HEIGHT-8, job); | ||
1697 | rb->lcd_update(); | ||
1698 | 1168 | ||
1699 | btn = rb->button_get(false); | 1169 | #ifdef HAVE_LCD_COLOR |
1700 | if (btn != BUTTON_NONE && !(btn & BUTTON_REL)) | 1170 | rb->lcd_set_background(LCD_RGBPACK(180,200,230)); |
1701 | return false; | 1171 | rb->lcd_set_foreground(LCD_BLACK); |
1172 | #endif | ||
1702 | 1173 | ||
1703 | namepos++; | 1174 | m = rb->menu_init(analog_items, sizeof(analog_items) / sizeof(*analog_items), |
1704 | jobpos--; | 1175 | NULL, NULL, NULL, NULL); |
1705 | 1176 | ||
1706 | rb->sleep(HZ/20); /* slight pause */ | 1177 | while(!done) |
1707 | } | 1178 | { |
1708 | 1179 | result = rb->menu_show(m); | |
1709 | offset_dummy = 1; | ||
1710 | 1180 | ||
1711 | /* fly out both lines at same time */ | 1181 | switch(result) |
1712 | while(namepos<LCDWIDTH+10 || jobpos > 0-job_w) | ||
1713 | { | 1182 | { |
1714 | rb->lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID); | 1183 | case 0: |
1715 | rb->lcd_fillrect(0, LCD_HEIGHT-16, LCD_WIDTH, 16); /* clear trails */ | 1184 | rb->set_option("Show Date", &settings.analog[analog_date], |
1716 | rb->lcd_set_drawmode(DRMODE_SOLID); | 1185 | INT, analog_date_text, 3, NULL); |
1717 | rb->lcd_putsxy(namepos, LCD_HEIGHT-16, name); | 1186 | break; |
1718 | rb->lcd_putsxy(jobpos, LCD_HEIGHT-8, job); | 1187 | case 1: |
1719 | rb->lcd_update(); | 1188 | rb->set_option("Show Second Hand", &settings.analog[analog_secondhand], |
1720 | 1189 | INT, analog_secondhand_text, 2, NULL); | |
1721 | /* exit on keypress */ | 1190 | break; |
1722 | btn = rb->button_get(false); | 1191 | case 2: |
1723 | if (btn != BUTTON_NONE && !(btn & BUTTON_REL)) | 1192 | rb->set_option("Show Time", &settings.analog[analog_time], |
1724 | return false; | 1193 | INT, analog_time_text, 3, NULL); |
1725 | 1194 | break; | |
1726 | namepos += offset_dummy; | ||
1727 | jobpos -= offset_dummy; | ||
1728 | 1195 | ||
1729 | offset_dummy++; | 1196 | default: |
1197 | done = true; | ||
1198 | break; | ||
1730 | } | 1199 | } |
1731 | 1200 | ||
1732 | /* pause (.5s) */ | 1201 | rb->menu_exit(m); |
1733 | rb->sleep(HZ/2); | ||
1734 | |||
1735 | /* and scan for button presses */ | ||
1736 | btn = rb->button_get(false); | ||
1737 | if (btn != BUTTON_NONE && !(btn & BUTTON_REL)) | ||
1738 | return false; | ||
1739 | } | ||
1740 | |||
1741 | offset_dummy = 1; | ||
1742 | |||
1743 | /* now make the text exit to the right */ | ||
1744 | for(credits_pos = (LCDWIDTH/2)-(credits_w/2); credits_pos <= LCD_WIDTH+10; | ||
1745 | credits_pos += offset_dummy, offset_dummy++) | ||
1746 | { | ||
1747 | rb->lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID); | ||
1748 | rb->lcd_fillrect(0, 0, LCD_WIDTH, 8); /* clear any trails left behind */ | ||
1749 | rb->lcd_fillrect(0, 0, LCD_WIDTH, 8); | ||
1750 | rb->lcd_set_drawmode(DRMODE_SOLID); | ||
1751 | rb->lcd_putsxy(credits_pos, 0, elapsednames); | ||
1752 | rb->lcd_update(); | ||
1753 | } | 1202 | } |
1754 | |||
1755 | exit_logo(); | ||
1756 | |||
1757 | return true; | ||
1758 | } | 1203 | } |
1759 | 1204 | ||
1760 | /**************************************** | 1205 | /*********************** |
1761 | * Shows the logo, then rolls the credits | 1206 | * Digital settings menu |
1762 | ***************************************/ | 1207 | **********************/ |
1763 | bool show_credits(void) | 1208 | void digital_settings_menu(void) |
1764 | { | 1209 | { |
1765 | int j = 0; | 1210 | int m=0, result; |
1766 | int btn; | ||
1767 | 1211 | ||
1768 | rb->lcd_clear_display(); | 1212 | done = false; |
1769 | |||
1770 | center_text(LCD_HEIGHT-8, "Credits"); | ||
1771 | 1213 | ||
1772 | /* show the logo with an animation and the clock version text */ | 1214 | #ifdef HAVE_LCD_COLOR |
1773 | show_clock_logo(true, true); | 1215 | rb->lcd_set_background(LCD_RGBPACK(180,200,230)); |
1216 | rb->lcd_set_foreground(LCD_BLACK); | ||
1217 | #endif | ||
1774 | 1218 | ||
1775 | rb->lcd_update(); | 1219 | m = rb->menu_init(digital_items, sizeof(digital_items) / sizeof(*digital_items), |
1220 | NULL, NULL, NULL, NULL); | ||
1776 | 1221 | ||
1777 | /* pause while button scanning */ | 1222 | while(!done) |
1778 | for (j = 0; j < 5; j++) | ||
1779 | { | 1223 | { |
1780 | rb->sleep(HZ/5); | 1224 | result = rb->menu_show(m); |
1781 | 1225 | ||
1782 | btn = rb->button_get(false); | 1226 | switch(result) |
1783 | if (btn != BUTTON_NONE && !(btn & BUTTON_REL)) | 1227 | { |
1784 | return false; | 1228 | case 0: |
1785 | } | 1229 | rb->set_option("Show Seconds", &settings.digital[digital_seconds], |
1230 | INT, digital_seconds_text, 2, NULL); | ||
1231 | break; | ||
1232 | case 1: | ||
1233 | rb->set_option("Show Date", &settings.digital[digital_date], | ||
1234 | INT, digital_date_text, 3, NULL); | ||
1235 | break; | ||
1236 | case 2: | ||
1237 | rb->set_option("Blinking Colon", &settings.digital[digital_blinkcolon], | ||
1238 | INT, digital_blinkcolon_text, 2, NULL); | ||
1239 | break; | ||
1240 | case 3: | ||
1241 | rb->set_option("Time Format", &settings.digital[digital_format], | ||
1242 | INT, digital_format_text, 2, NULL); | ||
1243 | break; | ||
1786 | 1244 | ||
1787 | roll_credits(); /* then roll the credits */ | 1245 | default: |
1246 | done = true; | ||
1247 | break; | ||
1248 | } | ||
1788 | 1249 | ||
1789 | return false; | 1250 | rb->menu_exit(m); |
1251 | } | ||
1790 | } | 1252 | } |
1791 | 1253 | ||
1792 | /************** | 1254 | /************************** |
1793 | * Draws cursor | 1255 | * Fullscreen settings menu |
1794 | *************/ | 1256 | *************************/ |
1795 | void cursor(int x, int y, int w, int h) | 1257 | void fullscreen_settings_menu(void) |
1796 | { | 1258 | { |
1797 | rb->lcd_set_drawmode(DRMODE_COMPLEMENT); | 1259 | int m=0, result; |
1798 | rb->lcd_fillrect(x, y, w, h); | ||
1799 | |||
1800 | rb->lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID); | ||
1801 | rb->lcd_drawpixel(x, y); | ||
1802 | rb->lcd_drawpixel(x+w-1, y); | ||
1803 | rb->lcd_drawpixel(x, y+h-1); | ||
1804 | rb->lcd_drawpixel(x+w-1, y+h-1); | ||
1805 | |||
1806 | rb->lcd_set_drawmode(DRMODE_SOLID); | ||
1807 | } | ||
1808 | 1260 | ||
1809 | /************* | ||
1810 | * Help screen | ||
1811 | ************/ | ||
1812 | bool help_screen(void) | ||
1813 | { | ||
1814 | int screen = 1; | ||
1815 | done = false; | 1261 | done = false; |
1816 | 1262 | ||
1817 | while (!done) | 1263 | #ifdef HAVE_LCD_COLOR |
1818 | { | 1264 | rb->lcd_set_background(LCD_RGBPACK(180,200,230)); |
1819 | rb->lcd_clear_display(); | 1265 | rb->lcd_set_foreground(LCD_BLACK); |
1820 | 1266 | #endif | |
1821 | if(screen == 1) | ||
1822 | center_text(56, "------ 1/2 NEXT>>"); | ||
1823 | else if(screen == 2) | ||
1824 | center_text(56, "<<BACK 2/2 ------"); | ||
1825 | 1267 | ||
1826 | if(screen == 1) /* page one */ | 1268 | m = rb->menu_init(fullscreen_items, sizeof(fullscreen_items) / sizeof(*fullscreen_items), |
1827 | { | 1269 | NULL, NULL, NULL, NULL); |
1828 | rb->lcd_puts(0, 0, "Help - Clock " CLOCK_VERSION ":"); | ||
1829 | rb->lcd_puts(0, 2, "To navigate this"); | ||
1830 | rb->lcd_puts(0, 3, "help, use " NAVI_BUTTON_TEXT_LEFT " and"); | ||
1831 | rb->lcd_puts(0, 4, NAVI_BUTTON_TEXT_RIGHT ". " | ||
1832 | EXIT_BUTTON_TEXT " returns"); | ||
1833 | rb->lcd_puts(0, 5, "you to the clock."); | ||
1834 | rb->lcd_puts(0, 6, "In any mode, " MENU_BUTTON_TEXT); | ||
1835 | } | ||
1836 | else if(screen == 2) /* page two */ | ||
1837 | { | ||
1838 | rb->lcd_puts(0, 0, "will show you the"); | ||
1839 | rb->lcd_puts(0, 1, "main menu. " COUNTER_BUTTON_TEXT " will"); | ||
1840 | rb->lcd_puts(0, 2, "start/stop counter."); | ||
1841 | rb->lcd_puts(0, 3, "Hold " COUNTER_BUTTON_TEXT " to reset"); | ||
1842 | rb->lcd_puts(0, 4, "counter. " EXIT_BUTTON_TEXT " exits"); | ||
1843 | rb->lcd_puts(0, 5, "any screen or the"); | ||
1844 | rb->lcd_puts(0, 6, "clock itself."); | ||
1845 | } | ||
1846 | 1270 | ||
1847 | rb->lcd_update(); | 1271 | while(!done) |
1272 | { | ||
1273 | result = rb->menu_show(m); | ||
1848 | 1274 | ||
1849 | switch(rb->button_get_w_tmo(HZ/4)) | 1275 | switch(result) |
1850 | { | 1276 | { |
1851 | #ifdef EXIT_RC_BUTTON | 1277 | case 0: |
1852 | case EXIT_RC_BUTTON: | 1278 | rb->set_option("Show Border", &settings.fullscreen[fullscreen_border], |
1853 | #endif | 1279 | INT, fullscreen_border_text, 2, NULL); |
1854 | case EXIT_BUTTON: | ||
1855 | done = true; | ||
1856 | break; | 1280 | break; |
1857 | 1281 | case 1: | |
1858 | case CHANGE_DOWN_BUTTON: | 1282 | rb->set_option("Show Second Hand", &settings.fullscreen[fullscreen_secondhand], |
1859 | if(screen > 1) | 1283 | INT, fullscreen_secondhand_text, 2, NULL); |
1860 | screen --; | ||
1861 | break; | 1284 | break; |
1862 | 1285 | ||
1863 | case CHANGE_UP_BUTTON: | 1286 | default: |
1864 | if(screen < 2) | 1287 | done = true; |
1865 | screen++; | ||
1866 | break; | 1288 | break; |
1867 | } | 1289 | } |
1868 | } | ||
1869 | return true; | ||
1870 | } | ||
1871 | |||
1872 | /************************* | ||
1873 | * Draws a checkbox bitmap | ||
1874 | ************************/ | ||
1875 | void draw_checkbox(int setting, int startnum, int numsettings, int x, int y) | ||
1876 | { | ||
1877 | if(setting) /* checkbox is on */ | ||
1878 | rb->lcd_mono_bitmap(checkbox_full, x, y, 8, 6); | ||
1879 | else /* checkbox is off */ | ||
1880 | rb->lcd_mono_bitmap(checkbox_empty, x, y, 8, 6); | ||
1881 | 1290 | ||
1882 | if(numsettings-startnum == 2) | 1291 | rb->menu_exit(m); |
1883 | { | ||
1884 | if(setting == 0+startnum) | ||
1885 | rb->lcd_mono_bitmap(checkbox_empty, x, y, 8, 6); | ||
1886 | else if(setting == 1+startnum) | ||
1887 | rb->lcd_mono_bitmap(checkbox_full, x, y, 8, 6); | ||
1888 | } | ||
1889 | else if(numsettings-startnum == 3) | ||
1890 | { | ||
1891 | if(setting == 0+startnum) | ||
1892 | rb->lcd_mono_bitmap(checkbox_empty, x, y, 8, 6); | ||
1893 | else if(setting == 1+startnum) | ||
1894 | rb->lcd_mono_bitmap(checkbox_half, x, y, 8, 6); | ||
1895 | else if(setting == 2+startnum) | ||
1896 | rb->lcd_mono_bitmap(checkbox_full, x, y, 8, 6); | ||
1897 | } | ||
1898 | else if(numsettings-startnum == 4) | ||
1899 | { | ||
1900 | if(setting == 0+startnum) | ||
1901 | rb->lcd_mono_bitmap(checkbox_empty, x, y, 8, 6); | ||
1902 | else if(setting == 1+startnum) | ||
1903 | rb->lcd_mono_bitmap(checkbox_onethird, x, y, 8, 6); | ||
1904 | else if(setting == 2+startnum) | ||
1905 | rb->lcd_mono_bitmap(checkbox_twothird, x, y, 8, 6); | ||
1906 | else if(setting == 3+startnum) | ||
1907 | rb->lcd_mono_bitmap(checkbox_full, x, y, 8, 6); | ||
1908 | } | 1292 | } |
1909 | } | 1293 | } |
1910 | 1294 | ||
1911 | /************************************** | 1295 | /********************** |
1912 | * Settings screen for the current mode | 1296 | * Binary settings menu |
1913 | *************************************/ | 1297 | *********************/ |
1914 | void draw_settings(void) | 1298 | void binary_settings_menu(void) |
1915 | { | 1299 | { |
1916 | if(settings.clock == ANALOG) | 1300 | int m=0, result; |
1917 | { | ||
1918 | rb->lcd_puts(2, 0, analog_digits_text); | ||
1919 | rb->lcd_puts(2, 1, analog_date_text[settings.analog[analog_date]]); | ||
1920 | rb->lcd_puts(2, 2, analog_secondhand_text); | ||
1921 | rb->lcd_puts(2, 3, analog_time_text[settings.analog[analog_time]]); | ||
1922 | |||
1923 | /* Draw checkboxes */ | ||
1924 | draw_checkbox(settings.analog[analog_digits], 0, 1, 1, 1); | ||
1925 | draw_checkbox(settings.analog[analog_date], 0, 3, 1, 9); | ||
1926 | draw_checkbox(settings.analog[analog_secondhand], 0, 1, 1, 17); | ||
1927 | draw_checkbox(settings.analog[analog_time], 0, 3, 1, 25); | ||
1928 | } | ||
1929 | else if(settings.clock == DIGITAL) | ||
1930 | { | ||
1931 | rb->lcd_puts(2, 0, digital_seconds_text[settings.digital[digital_seconds]]); | ||
1932 | rb->lcd_puts(2, 1, digital_date_text[settings.digital[digital_date]]); | ||
1933 | rb->lcd_puts(2, 2, digital_blinkcolon_text); | ||
1934 | rb->lcd_puts(2, 3, digital_12h_text); | ||
1935 | |||
1936 | draw_checkbox(settings.digital[digital_seconds], 0, 4, 1, 1); | ||
1937 | draw_checkbox(settings.digital[digital_date], 0, 3, 1, 9); | ||
1938 | draw_checkbox(settings.digital[digital_blinkcolon], 0, 1, 1, 17); | ||
1939 | draw_checkbox(settings.digital[digital_12h], 0, 1, 1, 25); | ||
1940 | } | ||
1941 | else if(settings.clock == LCD) | ||
1942 | { | ||
1943 | rb->lcd_puts(2, 0, lcd_seconds_text[settings.lcd[lcd_seconds]]); | ||
1944 | rb->lcd_puts(2, 1, lcd_date_text[settings.lcd[lcd_date]]); | ||
1945 | rb->lcd_puts(2, 2, lcd_blinkcolon_text); | ||
1946 | rb->lcd_puts(2, 3, lcd_12h_text); | ||
1947 | |||
1948 | draw_checkbox(settings.lcd[lcd_seconds], 0, 4, 1, 1); | ||
1949 | draw_checkbox(settings.lcd[lcd_date], 0, 3, 1, 9); | ||
1950 | draw_checkbox(settings.lcd[lcd_blinkcolon], 0, 1, 1, 17); | ||
1951 | draw_checkbox(settings.lcd[lcd_12h], 0, 1, 1, 25); | ||
1952 | } | ||
1953 | else if(settings.clock == FULLSCREEN) | ||
1954 | { | ||
1955 | rb->lcd_puts(2, 0, fullscreen_border_text); | ||
1956 | rb->lcd_puts(2, 1, fullscreen_secondhand_text); | ||
1957 | rb->lcd_puts(2, 2, fullscreen_invertseconds_text); | ||
1958 | 1301 | ||
1959 | draw_checkbox(settings.fullscreen[fullscreen_border], 0, 1, 1, 1); | 1302 | done = false; |
1960 | draw_checkbox(settings.fullscreen[fullscreen_secondhand], 0, 1, 1, 9); | ||
1961 | draw_checkbox(settings.fullscreen[fullscreen_invertseconds], 0, 1, 1, 17); | ||
1962 | } | ||
1963 | else if(settings.clock == BINARY) | ||
1964 | { | ||
1965 | rb->lcd_puts(2, 0, binary_dots_text); | ||
1966 | 1303 | ||
1967 | draw_checkbox(settings.binary[binary_dots], 0, 2, 1, 1); | 1304 | #ifdef HAVE_LCD_COLOR |
1968 | } | 1305 | rb->lcd_set_background(LCD_RGBPACK(180,200,230)); |
1969 | else if(settings.clock == PLAIN) | 1306 | rb->lcd_set_foreground(LCD_BLACK); |
1970 | { | 1307 | #endif |
1971 | rb->lcd_puts(2, 0, plain_12h_text); | ||
1972 | rb->lcd_puts(2, 1, plain_date_text[settings.plain[plain_date]]); | ||
1973 | rb->lcd_puts(2, 2, plain_blinkcolon_text); | ||
1974 | 1308 | ||
1975 | draw_checkbox(settings.plain[plain_12h], 0, 1, 1, 1); | 1309 | m = rb->menu_init(binary_items, sizeof(binary_items) / sizeof(*binary_items), |
1976 | draw_checkbox(settings.plain[plain_date], 0, 3, 1, 9); | 1310 | NULL, NULL, NULL, NULL); |
1977 | draw_checkbox(settings.plain[plain_blinkcolon], 0, 1, 1, 17); | ||
1978 | } | ||
1979 | } | ||
1980 | 1311 | ||
1981 | /*********************************** | 1312 | while(!done) |
1982 | * Change a given setting up or down | ||
1983 | **********************************/ | ||
1984 | void change_setting(int setting, int ofs, bool general_settings) | ||
1985 | { | ||
1986 | if(ofs == 1) | ||
1987 | { | ||
1988 | if(general_settings) | ||
1989 | { | ||
1990 | if(settings.general[setting-3] < general_max[setting-3]) | ||
1991 | settings.general[setting-3]++; | ||
1992 | } | ||
1993 | else | ||
1994 | { | ||
1995 | if(settings.clock == ANALOG) | ||
1996 | { | ||
1997 | if(settings.analog[setting] < analog_max[setting]) | ||
1998 | settings.analog[setting]++; | ||
1999 | } | ||
2000 | else if(settings.clock == DIGITAL) | ||
2001 | { | ||
2002 | if(settings.digital[setting] < digital_max[setting]) | ||
2003 | settings.digital[setting]++; | ||
2004 | } | ||
2005 | else if(settings.clock == LCD) | ||
2006 | { | ||
2007 | if(settings.lcd[setting] < digital_max[setting]) | ||
2008 | settings.lcd[setting]++; | ||
2009 | } | ||
2010 | else if(settings.clock == FULLSCREEN) | ||
2011 | { | ||
2012 | if(settings.fullscreen[setting] < fullscreen_max) | ||
2013 | settings.fullscreen[setting]++; | ||
2014 | } | ||
2015 | else if(settings.clock == BINARY) | ||
2016 | { | ||
2017 | if(settings.binary[setting] < binary_max) | ||
2018 | settings.binary[setting]++; | ||
2019 | } | ||
2020 | else if(settings.clock == PLAIN) | ||
2021 | { | ||
2022 | if(settings.plain[setting] < plain_max[setting]) | ||
2023 | settings.plain[setting]++; | ||
2024 | } | ||
2025 | } | ||
2026 | } | ||
2027 | else if(ofs == -1) | ||
2028 | { | 1313 | { |
2029 | if(general_settings) | 1314 | result = rb->menu_show(m); |
2030 | { | 1315 | |
2031 | if(settings.general[setting-3] > 0) | 1316 | switch(result) |
2032 | settings.general[setting-3]--; | ||
2033 | } | ||
2034 | else | ||
2035 | { | 1317 | { |
2036 | if(settings.clock == ANALOG) | 1318 | case 0: |
2037 | { | 1319 | rb->set_option("Display Mode", &settings.binary[binary_mode], |
2038 | if(settings.analog[setting] > 0) | 1320 | INT, binary_mode_text, 2, NULL); |
2039 | settings.analog[setting]--; | 1321 | break; |
2040 | } | 1322 | |
2041 | else if(settings.clock == DIGITAL) | 1323 | default: |
2042 | { | 1324 | done = true; |
2043 | if(settings.digital[setting] > 0) | 1325 | break; |
2044 | settings.digital[setting]--; | ||
2045 | } | ||
2046 | else if(settings.clock == LCD) | ||
2047 | { | ||
2048 | if(settings.lcd[setting] > 0) | ||
2049 | settings.lcd[setting]--; | ||
2050 | } | ||
2051 | else if(settings.clock == FULLSCREEN) | ||
2052 | { | ||
2053 | if(settings.fullscreen[setting] > 0) | ||
2054 | settings.fullscreen[setting]--; | ||
2055 | } | ||
2056 | else if(settings.clock == BINARY) | ||
2057 | { | ||
2058 | if(settings.binary[setting] > 0) | ||
2059 | settings.binary[setting]--; | ||
2060 | } | ||
2061 | else if(settings.clock == PLAIN) | ||
2062 | { | ||
2063 | if(settings.plain[setting] > 0) | ||
2064 | settings.plain[setting]--; | ||
2065 | } | ||
2066 | } | 1326 | } |
1327 | |||
1328 | rb->menu_exit(m); | ||
2067 | } | 1329 | } |
2068 | } | 1330 | } |
2069 | 1331 | ||
2070 | /************************************** | 1332 | /********************* |
2071 | * Settings screen for the current mode | 1333 | * Plain settings menu |
2072 | *************************************/ | 1334 | ********************/ |
2073 | void settings_screen(void) | 1335 | void plain_settings_menu(void) |
2074 | { | 1336 | { |
2075 | /* cursor positions */ | 1337 | int m=0, result; |
2076 | int cursorpos=1,cursor_y,cursor_dummy; | ||
2077 | |||
2078 | int mode_numsettings[6] = {ANALOG_SETTINGS, DIGITAL_SETTINGS, LCD_SETTINGS, | ||
2079 | FULLSCREEN_SETTINGS, BINARY_SETTINGS, PLAIN_SETTINGS}; | ||
2080 | 1338 | ||
2081 | done = false; | 1339 | done = false; |
2082 | 1340 | ||
2083 | while (!done) | 1341 | #ifdef HAVE_LCD_COLOR |
2084 | { | 1342 | rb->lcd_set_background(LCD_RGBPACK(180,200,230)); |
2085 | rb->lcd_clear_display(); | 1343 | rb->lcd_set_foreground(LCD_BLACK); |
1344 | #endif | ||
2086 | 1345 | ||
2087 | draw_settings(); | 1346 | m = rb->menu_init(plain_items, sizeof(plain_items) / sizeof(*plain_items), |
1347 | NULL, NULL, NULL, NULL); | ||
2088 | 1348 | ||
2089 | cursor(0, 8*(cursorpos-1), 112, 8); | 1349 | while(!done) |
1350 | { | ||
1351 | result = rb->menu_show(m); | ||
2090 | 1352 | ||
2091 | switch(rb->button_get_w_tmo(HZ/8)) | 1353 | switch(result) |
2092 | { | 1354 | { |
2093 | case MOVE_UP_BUTTON: | 1355 | case 0: |
2094 | if(cursorpos > 1) | 1356 | rb->set_option("Show Date", &settings.plain[plain_date], |
2095 | { | 1357 | INT, plain_date_text, 3, NULL); |
2096 | cursor_y = (8*(cursorpos-1)); | ||
2097 | cursor_dummy = cursor_y; | ||
2098 | for(; cursor_y>=cursor_dummy-8; cursor_y-=2) | ||
2099 | { | ||
2100 | rb->lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID); | ||
2101 | rb->lcd_fillrect(0, 8, LCD_WIDTH, LCD_HEIGHT-8); | ||
2102 | rb->lcd_set_drawmode(DRMODE_SOLID); | ||
2103 | draw_settings(); | ||
2104 | cursor(0, cursor_y, LCD_WIDTH, 8); | ||
2105 | rb->lcd_update(); | ||
2106 | } | ||
2107 | cursorpos--; | ||
2108 | } | ||
2109 | break; | 1358 | break; |
2110 | 1359 | case 1: | |
2111 | case MOVE_DOWN_BUTTON: | 1360 | rb->set_option("Show Seconds", &settings.plain[plain_seconds], |
2112 | if(cursorpos < mode_numsettings[settings.clock-1]) | 1361 | INT, plain_seconds_text, 2, NULL); |
2113 | { | ||
2114 | cursor_y = (8*(cursorpos-1)); | ||
2115 | cursor_dummy = cursor_y; | ||
2116 | for(; cursor_y<=cursor_dummy+8; cursor_y+=2) | ||
2117 | { | ||
2118 | rb->lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID); | ||
2119 | rb->lcd_fillrect(0, 8, LCD_WIDTH, LCD_HEIGHT-8); | ||
2120 | rb->lcd_set_drawmode(DRMODE_SOLID); | ||
2121 | draw_settings(); | ||
2122 | cursor(0, cursor_y, LCD_WIDTH, 8); | ||
2123 | rb->lcd_update(); | ||
2124 | } | ||
2125 | cursorpos++; | ||
2126 | } | ||
2127 | break; | 1362 | break; |
2128 | 1363 | case 2: | |
2129 | case CHANGE_DOWN_BUTTON: | 1364 | rb->set_option("Blinking Colon", &settings.plain[plain_blinkcolon], |
2130 | change_setting(cursorpos-1, -1, false); | 1365 | INT, plain_blinkcolon_text, 2, NULL); |
2131 | break; | 1366 | break; |
2132 | 1367 | case 3: | |
2133 | 1368 | rb->set_option("Time Format", &settings.plain[plain_format], | |
2134 | case CHANGE_UP_BUTTON: | 1369 | INT, plain_format_text, 2, NULL); |
2135 | change_setting(cursorpos-1, 1, false); | ||
2136 | break; | 1370 | break; |
2137 | #ifdef EXIT_RC_BUTTON | 1371 | |
2138 | case EXIT_RC_BUTTON: | 1372 | default: |
2139 | #endif | ||
2140 | case EXIT_BUTTON: | ||
2141 | case MENU_BUTTON: | ||
2142 | done = true; | 1373 | done = true; |
2143 | break; | 1374 | break; |
2144 | } | 1375 | } |
2145 | 1376 | ||
2146 | rb->lcd_update(); | 1377 | rb->menu_exit(m); |
2147 | } | 1378 | } |
2148 | } | 1379 | } |
2149 | 1380 | ||
1381 | /************************************** | ||
1382 | * Settings screen for the current mode | ||
1383 | *************************************/ | ||
1384 | void settings_screen(void) | ||
1385 | { | ||
1386 | set_standard_colors(); | ||
1387 | |||
1388 | if(settings.clock == ANALOG) | ||
1389 | analog_settings_menu(); | ||
1390 | else if(settings.clock == DIGITAL) | ||
1391 | digital_settings_menu(); | ||
1392 | else if(settings.clock == FULLSCREEN) | ||
1393 | fullscreen_settings_menu(); | ||
1394 | else if(settings.clock == BINARY) | ||
1395 | binary_settings_menu(); | ||
1396 | else if(settings.clock == PLAIN) | ||
1397 | plain_settings_menu(); | ||
1398 | |||
1399 | set_digital_colors(); | ||
1400 | |||
1401 | } | ||
1402 | |||
2150 | /*********************************************************** | 1403 | /*********************************************************** |
2151 | * Confirm resetting of settings, used in general_settings() | 1404 | * Confirm resetting of settings, used in general_settings() |
2152 | **********************************************************/ | 1405 | **********************************************************/ |
2153 | void confirm_reset(void) | 1406 | void confirm_reset(void) |
2154 | { | 1407 | { |
2155 | bool ask_reset_done = false; | 1408 | int result=0; |
2156 | char play_text[20]; | ||
2157 | 1409 | ||
2158 | rb->snprintf(play_text, sizeof(play_text), "%s = Yes", YESTEXT); | 1410 | rb->set_option("Reset all settings?", &result, INT, noyes_text, 2, NULL); |
2159 | 1411 | ||
2160 | while(!ask_reset_done) | 1412 | if(result == 1) /* reset! */ |
2161 | { | 1413 | { |
2162 | rb->lcd_clear_display(); | 1414 | reset_settings(); |
2163 | 1415 | rb->splash(HZ, true, "Settings reset!"); | |
2164 | center_text(0, "Reset Settings?"); | ||
2165 | rb->lcd_puts(0, 2, play_text); | ||
2166 | rb->lcd_puts(0, 3, "Any Other = No"); | ||
2167 | |||
2168 | rb->lcd_update(); | ||
2169 | |||
2170 | switch(rb->button_get_w_tmo(HZ/4)) | ||
2171 | { | ||
2172 | case MENU_BUTTON: | ||
2173 | reset_settings(); | ||
2174 | rb->splash(HZ*2, true, "Settings Reset!"); | ||
2175 | ask_reset_done = true; | ||
2176 | break; | ||
2177 | |||
2178 | case COUNTER_TOGGLE_BUTTON: | ||
2179 | #if CONFIG_KEYPAD == RECORDER_PAD /* dupes or plain annoying on the ipod touchpad */ | ||
2180 | case MOVE_DOWN_BUTTON: | ||
2181 | case MOVE_UP_BUTTON: | ||
2182 | #endif | ||
2183 | case CHANGE_DOWN_BUTTON: | ||
2184 | case CHANGE_UP_BUTTON: | ||
2185 | #ifdef EXIT_RC_BUTTON | ||
2186 | case EXIT_RC_BUTTON: | ||
2187 | #endif | ||
2188 | case EXIT_BUTTON: | ||
2189 | ask_reset_done = true; | ||
2190 | break; | ||
2191 | } | ||
2192 | } | 1416 | } |
1417 | else | ||
1418 | rb->splash(HZ, true, "Settings NOT reset."); | ||
2193 | } | 1419 | } |
2194 | 1420 | ||
2195 | /************************************ | 1421 | /************************************ |
@@ -2197,149 +1423,62 @@ void confirm_reset(void) | |||
2197 | ***********************************/ | 1423 | ***********************************/ |
2198 | void general_settings(void) | 1424 | void general_settings(void) |
2199 | { | 1425 | { |
2200 | int cursorpos=1,cursor_y,cursor_dummy; | 1426 | int m, result; |
2201 | done = false; | 1427 | done = false; |
2202 | 1428 | ||
2203 | while(!done) | 1429 | set_standard_colors(); |
2204 | { | ||
2205 | rb->lcd_clear_display(); | ||
2206 | 1430 | ||
2207 | center_text(0, "General Settings"); | 1431 | m = rb->menu_init(general_settings_items, sizeof(general_settings_items) / sizeof(*general_settings_items), |
2208 | rb->lcd_puts(2, 1, general_reset_text); | 1432 | NULL, NULL, NULL, NULL); |
2209 | rb->lcd_puts(2, 2, general_save_text); | ||
2210 | rb->lcd_puts(2, 3, general_counter_text); | ||
2211 | rb->lcd_puts(2, 4, general_savesetting_text[settings.general[general_savesetting]]); | ||
2212 | rb->lcd_puts(2, 5, general_backlight_text[settings.general[general_backlight]]); | ||
2213 | rb->lcd_puts(2, 6, general_idle_text); | ||
2214 | 1433 | ||
2215 | rb->lcd_mono_bitmap(arrow, 1, 9, 8, 6); | 1434 | while(!done) |
2216 | rb->lcd_mono_bitmap(arrow, 1, 17, 8, 6); | 1435 | { |
1436 | result = rb->menu_show(m); | ||
2217 | 1437 | ||
2218 | draw_checkbox(settings.general[general_counter], 0, 1, 1, 25); | 1438 | switch(result) |
2219 | draw_checkbox(settings.general[general_savesetting], 0, 3, 1, 33); | 1439 | { |
2220 | draw_checkbox(settings.general[general_backlight], 0, 3, 1, 41); | 1440 | case 0: |
2221 | draw_checkbox(idle_poweroff, 0, 1, 1, 49); | 1441 | confirm_reset(); |
1442 | break; | ||
2222 | 1443 | ||
2223 | cursor(0, cursorpos*8, 112, 8); | 1444 | case 1: |
1445 | save_settings(false); | ||
1446 | rb->splash(HZ, true, "Settings saved"); | ||
1447 | break; | ||
2224 | 1448 | ||
2225 | rb->lcd_update(); | 1449 | case 2: |
1450 | rb->set_option("Save On Exit", &settings.general[general_savesetting], | ||
1451 | INT, saving_options_text, 2, NULL); | ||
2226 | 1452 | ||
2227 | switch(rb->button_get_w_tmo(HZ/4)) | 1453 | /* if we no longer save on exit, we better save now to remember that */ |
2228 | { | 1454 | if(settings.general[general_savesetting] == 0) |
2229 | #ifdef EXIT_RC_BUTTON | ||
2230 | case EXIT_RC_BUTTON: | ||
2231 | #endif | ||
2232 | case EXIT_BUTTON: | ||
2233 | case MENU_BUTTON: | ||
2234 | if(settings.general[general_savesetting] == 2) | ||
2235 | save_settings(false); | 1455 | save_settings(false); |
2236 | |||
2237 | /* set backlight timeout */ | ||
2238 | if(settings.general[general_backlight] == 0) | ||
2239 | rb->backlight_set_timeout(-1); | ||
2240 | else if(settings.general[general_backlight] == 1) | ||
2241 | rb->backlight_set_timeout(rb->global_settings->backlight_timeout); | ||
2242 | else if(settings.general[general_backlight] == 2) | ||
2243 | rb->backlight_set_timeout(1); | ||
2244 | |||
2245 | done = true; | ||
2246 | break; | 1456 | break; |
2247 | 1457 | ||
2248 | case MOVE_UP_BUTTON: | 1458 | case 3: |
2249 | if(cursorpos > 1) | 1459 | rb->set_option("Show Counter", &settings.general[general_counter], |
2250 | { | 1460 | INT, show_counter_text, 2, NULL); |
2251 | cursor_y = 8+(8*(cursorpos-1)); | ||
2252 | cursor_dummy = cursor_y; | ||
2253 | for(; cursor_y>cursor_dummy-8; cursor_y-=2) | ||
2254 | { | ||
2255 | rb->lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID); | ||
2256 | rb->lcd_fillrect(0, 8, LCD_WIDTH, LCD_HEIGHT-8); | ||
2257 | rb->lcd_set_drawmode(DRMODE_SOLID); | ||
2258 | |||
2259 | rb->lcd_puts(2, 1, general_reset_text); | ||
2260 | rb->lcd_puts(2, 2, general_save_text); | ||
2261 | rb->lcd_puts(2, 3, general_counter_text); | ||
2262 | rb->lcd_puts(2, 4, general_savesetting_text[settings.general[general_savesetting]]); | ||
2263 | rb->lcd_puts(2, 5, general_backlight_text[settings.general[general_backlight]]); | ||
2264 | rb->lcd_puts(2, 6, general_idle_text); | ||
2265 | |||
2266 | rb->lcd_mono_bitmap(arrow, 1, 9, 8, 6); | ||
2267 | rb->lcd_mono_bitmap(arrow, 1, 17, 8, 6); | ||
2268 | |||
2269 | draw_checkbox(settings.general[general_counter], 0, 1, 1, 25); | ||
2270 | draw_checkbox(settings.general[general_savesetting], 0, 3, 1, 33); | ||
2271 | draw_checkbox(settings.general[general_backlight], 0, 3, 1, 41); | ||
2272 | draw_checkbox(idle_poweroff, 0, 1, 1, 49); | ||
2273 | |||
2274 | cursor(0, cursor_y, LCD_WIDTH, 8); | ||
2275 | rb->lcd_update(); | ||
2276 | } | ||
2277 | cursorpos--; | ||
2278 | } | ||
2279 | break; | 1461 | break; |
2280 | 1462 | ||
2281 | case MOVE_DOWN_BUTTON: | 1463 | case 4: |
2282 | if(cursorpos < 6) | 1464 | rb->set_option("Backlight Settings", &settings.general[general_backlight], |
2283 | { | 1465 | INT, backlight_settings_text, 3, NULL); |
2284 | cursor_y = 8+(8*(cursorpos-1)); | ||
2285 | cursor_dummy = cursor_y; | ||
2286 | for(; cursor_y<cursor_dummy+8; cursor_y+=2) | ||
2287 | { | ||
2288 | rb->lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID); | ||
2289 | rb->lcd_fillrect(0, 8, LCD_WIDTH, LCD_HEIGHT-8); | ||
2290 | rb->lcd_set_drawmode(DRMODE_SOLID); | ||
2291 | |||
2292 | rb->lcd_puts(2, 1, general_reset_text); | ||
2293 | rb->lcd_puts(2, 2, general_save_text); | ||
2294 | rb->lcd_puts(2, 3, general_counter_text); | ||
2295 | rb->lcd_puts(2, 4, general_savesetting_text[settings.general[general_savesetting]]); | ||
2296 | rb->lcd_puts(2, 5, general_backlight_text[settings.general[general_backlight]]); | ||
2297 | rb->lcd_puts(2, 6, general_idle_text); | ||
2298 | |||
2299 | rb->lcd_mono_bitmap(arrow, 1, 9, 8, 6); | ||
2300 | rb->lcd_mono_bitmap(arrow, 1, 17, 8, 6); | ||
2301 | |||
2302 | draw_checkbox(settings.general[general_counter], 0, 1, 1, 25); | ||
2303 | draw_checkbox(settings.general[general_savesetting], 0, 3, 1, 33); | ||
2304 | draw_checkbox(settings.general[general_backlight], 0, 3, 1, 41); | ||
2305 | draw_checkbox(idle_poweroff, 0, 1, 1, 49); | ||
2306 | |||
2307 | cursor(0, cursor_y, LCD_WIDTH, 8); | ||
2308 | rb->lcd_update(); | ||
2309 | } | ||
2310 | cursorpos++; | ||
2311 | } | ||
2312 | break; | 1466 | break; |
2313 | 1467 | ||
2314 | case CHANGE_DOWN_BUTTON: | 1468 | case 5: |
2315 | if(cursorpos == 1 || cursorpos == 2) | 1469 | rb->set_option("Idle Poweroff (temporary)", &idle_poweroff, |
2316 | done = true; | 1470 | INT, idle_poweroff_text, 2, NULL); |
2317 | if(cursorpos >= 3 && cursorpos <= 5) | ||
2318 | { | ||
2319 | change_setting(cursorpos, -1, true); | ||
2320 | if(cursorpos == 4) | ||
2321 | save_settings(false); | ||
2322 | } | ||
2323 | else if(cursorpos == 6) | ||
2324 | idle_poweroff = false; | ||
2325 | break; | 1471 | break; |
2326 | 1472 | ||
2327 | case CHANGE_UP_BUTTON: | 1473 | default: |
2328 | if(cursorpos == 1) | 1474 | done=true; |
2329 | confirm_reset(); | ||
2330 | else if(cursorpos == 2) | ||
2331 | save_settings(false); | ||
2332 | else if(cursorpos >= 3 && cursorpos <= 5) | ||
2333 | { | ||
2334 | change_setting(cursorpos, 1, true); | ||
2335 | if(cursorpos == 4) | ||
2336 | save_settings(false); | ||
2337 | } | ||
2338 | else if(cursorpos == 6) | ||
2339 | idle_poweroff = true; | ||
2340 | break; | 1475 | break; |
2341 | } | 1476 | } |
1477 | |||
1478 | rb->menu_exit(m); | ||
2342 | } | 1479 | } |
1480 | |||
1481 | set_digital_colors(); | ||
2343 | } | 1482 | } |
2344 | 1483 | ||
2345 | /**************************************** | 1484 | /**************************************** |
@@ -2347,14 +1486,10 @@ void general_settings(void) | |||
2347 | ***************************************/ | 1486 | ***************************************/ |
2348 | void draw_extras(int year, int day, int month, int hour, int minute, int second) | 1487 | void draw_extras(int year, int day, int month, int hour, int minute, int second) |
2349 | { | 1488 | { |
2350 | char buf[11]; | ||
2351 | int w, h; | ||
2352 | int i; | 1489 | int i; |
2353 | 1490 | ||
2354 | struct tm* current_time = rb->get_time(); | 1491 | struct tm* current_time = rb->get_time(); |
2355 | 1492 | ||
2356 | int fill = LCDWIDTH * second/60; | ||
2357 | |||
2358 | char moday[8]; | 1493 | char moday[8]; |
2359 | char dateyr[6]; | 1494 | char dateyr[6]; |
2360 | char tmhrmin[7]; | 1495 | char tmhrmin[7]; |
@@ -2372,96 +1507,121 @@ void draw_extras(int year, int day, int month, int hour, int minute, int second) | |||
2372 | /* Analog Extras */ | 1507 | /* Analog Extras */ |
2373 | if(settings.clock == ANALOG) | 1508 | if(settings.clock == ANALOG) |
2374 | { | 1509 | { |
2375 | if(settings.analog[analog_digits]) /* Digits around the face */ | ||
2376 | { | ||
2377 | rb->lcd_putsxy((LCDWIDTH/2)-6, 0, "12"); | ||
2378 | rb->lcd_putsxy(LCD_WIDTH/2-(ANALOG_MIN_RADIUS+8), (LCDHEIGHT/2)-4, "9"); | ||
2379 | rb->lcd_putsxy((LCDWIDTH/2)-4, LCD_HEIGHT-8, "6"); | ||
2380 | rb->lcd_putsxy(LCD_WIDTH/2+(ANALOG_MIN_RADIUS+2), (LCDHEIGHT/2)-4, "3"); | ||
2381 | } | ||
2382 | if(settings.analog[analog_time] != 0) /* Digital readout */ | 1510 | if(settings.analog[analog_time] != 0) /* Digital readout */ |
2383 | { | 1511 | { |
2384 | /* HH:MM */ | 1512 | draw_smalldigit(hour/10, SMALLDIGIT_WIDTH*0, 0); |
2385 | rb->lcd_putsxy(1, 4, tmhrmin); | 1513 | draw_smalldigit(hour%10, SMALLDIGIT_WIDTH*1, 0); |
2386 | /* SS */ | 1514 | draw_smalldigit(COLON, SMALLDIGIT_WIDTH*2, 0); |
2387 | rb->lcd_putsxy(10, 12, tmsec); | 1515 | draw_smalldigit(minute/10, SMALLDIGIT_WIDTH*3, 0); |
1516 | draw_smalldigit(minute%10, SMALLDIGIT_WIDTH*4, 0); | ||
1517 | |||
1518 | draw_smalldigit(second/10, SMALLDIGIT_WIDTH*1.5, SMALLDIGIT_HEIGHT); | ||
1519 | draw_smalldigit(second%10, SMALLDIGIT_WIDTH*2.5, SMALLDIGIT_HEIGHT); | ||
2388 | 1520 | ||
2389 | /* AM/PM indicator */ | 1521 | /* AM/PM indicator */ |
2390 | if(settings.analog[analog_time] == 2) | 1522 | if(settings.analog[analog_time] == 2) |
2391 | { | 1523 | { |
2392 | if(current_time->tm_hour > 12) /* PM */ | 1524 | if(current_time->tm_hour > 12) /* PM */ |
2393 | rb->lcd_mono_bitmap(pm, LCD_WIDTH-16, 1, 15, 8); | 1525 | draw_digit(ICON_PM, LCD_WIDTH-DIGIT_WIDTH, DIGIT_HEIGHT/2-DIGIT_HEIGHT); |
2394 | else /* AM */ | 1526 | else /* AM */ |
2395 | rb->lcd_mono_bitmap(am, LCD_WIDTH-16, 1, 15, 8); | 1527 | draw_digit(ICON_AM, LCD_WIDTH-DIGIT_WIDTH, DIGIT_HEIGHT/2-DIGIT_HEIGHT); |
2396 | } | 1528 | } |
2397 | } | 1529 | } |
2398 | if(settings.analog[analog_date] != 0) /* Date readout */ | 1530 | if(settings.analog[analog_date] != 0) /* Date readout */ |
2399 | { | 1531 | { |
2400 | /* MM-DD (or DD.MM) */ | 1532 | if(settings.analog[analog_date] == 1) |
2401 | rb->lcd_putsxy(1, LCD_HEIGHT-16, moday); | 1533 | { |
2402 | rb->lcd_putsxy(3, LCD_HEIGHT-8, dateyr); | 1534 | draw_smalldigit(month/10, SMALLDIGIT_WIDTH*0, |
1535 | LCD_HEIGHT-SMALLDIGIT_HEIGHT*2); | ||
1536 | draw_smalldigit(month%10, SMALLDIGIT_WIDTH*1, | ||
1537 | LCD_HEIGHT-SMALLDIGIT_HEIGHT*2); | ||
1538 | draw_smalldigit(SLASH, SMALLDIGIT_WIDTH*2, | ||
1539 | LCD_HEIGHT-SMALLDIGIT_HEIGHT*2); | ||
1540 | draw_smalldigit(day/10, SMALLDIGIT_WIDTH*3, | ||
1541 | LCD_HEIGHT-SMALLDIGIT_HEIGHT*2); | ||
1542 | draw_smalldigit(day%10, SMALLDIGIT_WIDTH*4, | ||
1543 | LCD_HEIGHT-SMALLDIGIT_HEIGHT*2); | ||
1544 | draw_smalldigit(year/1000, SMALLDIGIT_WIDTH*0.5, | ||
1545 | LCD_HEIGHT-SMALLDIGIT_HEIGHT); | ||
1546 | draw_smalldigit(year%1000/100, SMALLDIGIT_WIDTH*1.5, | ||
1547 | LCD_HEIGHT-SMALLDIGIT_HEIGHT); | ||
1548 | draw_smalldigit(year%100/10, SMALLDIGIT_WIDTH*2.5, | ||
1549 | LCD_HEIGHT-SMALLDIGIT_HEIGHT); | ||
1550 | draw_smalldigit(year%10, SMALLDIGIT_WIDTH*3.5, | ||
1551 | LCD_HEIGHT-SMALLDIGIT_HEIGHT); | ||
1552 | } | ||
1553 | else if(settings.analog[analog_date] == 2) | ||
1554 | { | ||
1555 | |||
1556 | draw_smalldigit(day/10, SMALLDIGIT_WIDTH*0, | ||
1557 | LCD_HEIGHT-SMALLDIGIT_HEIGHT*2); | ||
1558 | draw_smalldigit(day%10, SMALLDIGIT_WIDTH*1, | ||
1559 | LCD_HEIGHT-SMALLDIGIT_HEIGHT*2); | ||
1560 | draw_smalldigit(PERIOD, SMALLDIGIT_WIDTH*2, | ||
1561 | LCD_HEIGHT-SMALLDIGIT_HEIGHT*2); | ||
1562 | draw_smalldigit(month/10, SMALLDIGIT_WIDTH*3, | ||
1563 | LCD_HEIGHT-SMALLDIGIT_HEIGHT*2); | ||
1564 | draw_smalldigit(month%10, SMALLDIGIT_WIDTH*4, | ||
1565 | LCD_HEIGHT-SMALLDIGIT_HEIGHT*2); | ||
1566 | draw_smalldigit(year/1000, SMALLDIGIT_WIDTH*0.5, | ||
1567 | LCD_HEIGHT-SMALLDIGIT_HEIGHT); | ||
1568 | draw_smalldigit(year%1000/100, SMALLDIGIT_WIDTH*1.5, | ||
1569 | LCD_HEIGHT-SMALLDIGIT_HEIGHT); | ||
1570 | draw_smalldigit(year%100/10, SMALLDIGIT_WIDTH*2.5, | ||
1571 | LCD_HEIGHT-SMALLDIGIT_HEIGHT); | ||
1572 | draw_smalldigit(year%10, SMALLDIGIT_WIDTH*3.5, | ||
1573 | LCD_HEIGHT-SMALLDIGIT_HEIGHT); | ||
1574 | } | ||
2403 | } | 1575 | } |
2404 | } | 1576 | } |
2405 | else if(settings.clock == DIGITAL) | 1577 | else if(settings.clock == DIGITAL) |
2406 | { | 1578 | { |
2407 | /* Date readout */ | 1579 | /* Date readout */ |
2408 | if(settings.digital[digital_date] == 1) /* American mode */ | 1580 | if(settings.digital[digital_date] == 1) /* american mode */ |
2409 | { | ||
2410 | rb->snprintf(buf, sizeof(buf), "%d/%d/%d", month, day, year); | ||
2411 | rb->lcd_getstringsize(buf, &w, &h); | ||
2412 | rb->lcd_putsxy((LCDWIDTH/2)-(w/2), LCD_HEIGHT-8, buf); | ||
2413 | } | ||
2414 | else if(settings.digital[digital_date] == 2) /* European mode */ | ||
2415 | { | ||
2416 | rb->snprintf(buf, sizeof(buf), "%d.%d.%d", day, month, year); | ||
2417 | rb->lcd_getstringsize(buf, &w, &h); | ||
2418 | rb->lcd_putsxy((LCDWIDTH/2)-(w/2), LCD_HEIGHT-8, buf); | ||
2419 | } | ||
2420 | if(settings.digital[digital_seconds] == 1) /* Second readout */ | ||
2421 | { | ||
2422 | rb->snprintf(buf, sizeof(buf), "%d", second); | ||
2423 | rb->lcd_getstringsize(buf, &w, &h); | ||
2424 | rb->lcd_putsxy((LCDWIDTH/2)-(w/2), 5, buf); | ||
2425 | } | ||
2426 | else if(settings.digital[digital_seconds] == 2) /* Second progressbar */ | ||
2427 | rb->gui_scrollbar_draw(rb->screens[SCREEN_MAIN],0, 0, LCD_WIDTH, 4, 60, 0, second, HORIZONTAL); | ||
2428 | else if(settings.digital[digital_seconds] == 3) /* Invert the LCD as seconds pass */ | ||
2429 | { | ||
2430 | rb->lcd_set_drawmode(DRMODE_COMPLEMENT); | ||
2431 | rb->lcd_fillrect(0, 0, fill, LCD_HEIGHT); | ||
2432 | rb->lcd_set_drawmode(DRMODE_SOLID); | ||
2433 | } | ||
2434 | } | ||
2435 | else if(settings.clock == LCD) /* LCD mode */ | ||
2436 | { | ||
2437 | /* Date readout */ | ||
2438 | if(settings.lcd[lcd_date] == 1) /* american mode */ | ||
2439 | { | ||
2440 | rb->snprintf(buf, sizeof(buf), "%d/%d/%d", month, day, year); | ||
2441 | rb->lcd_getstringsize(buf, &w, &h); | ||
2442 | rb->lcd_putsxy((LCDWIDTH/2)-(w/2), LCD_HEIGHT-8, buf); | ||
2443 | } | ||
2444 | else if(settings.lcd[lcd_date] == 2) /* european mode */ | ||
2445 | { | ||
2446 | rb->snprintf(buf, sizeof(buf), "%d.%d.%d", day, month, year); | ||
2447 | rb->lcd_getstringsize(buf, &w, &h); | ||
2448 | rb->lcd_putsxy((LCDWIDTH/2)-(w/2), LCD_HEIGHT-8, buf); | ||
2449 | } | ||
2450 | if(settings.lcd[lcd_seconds] == 1) /* Second readout */ | ||
2451 | { | ||
2452 | rb->snprintf(buf, sizeof(buf), "%d", second); | ||
2453 | rb->lcd_getstringsize(buf, &w, &h); | ||
2454 | rb->lcd_putsxy((LCDWIDTH/2)-(w/2), 5, buf); | ||
2455 | } | ||
2456 | else if(settings.lcd[lcd_seconds] == 2) /* Second progressbar */ | ||
2457 | { | 1581 | { |
2458 | rb->gui_scrollbar_draw(rb->screens[SCREEN_MAIN],0, 0, LCD_WIDTH, 4, 60, 0, second, HORIZONTAL); | 1582 | draw_smallsegment(month/10, SMALLSEG_WIDTH*0+SMALLSEG_XOFS(10), |
1583 | LCD_HEIGHT-SMALLSEG_HEIGHT*LCD_OFFSET*2); | ||
1584 | draw_smallsegment(month%10, SMALLSEG_WIDTH*1+SMALLSEG_XOFS(10), | ||
1585 | LCD_HEIGHT-SMALLSEG_HEIGHT*LCD_OFFSET*2); | ||
1586 | draw_smallsegment(SLASH, SMALLSEG_WIDTH*2+SMALLSEG_XOFS(10), | ||
1587 | LCD_HEIGHT-SMALLSEG_HEIGHT*LCD_OFFSET*2); | ||
1588 | draw_smallsegment(day/10, SMALLSEG_WIDTH*3+SMALLSEG_XOFS(10), | ||
1589 | LCD_HEIGHT-SMALLSEG_HEIGHT*LCD_OFFSET*2); | ||
1590 | draw_smallsegment(day%10, SMALLSEG_WIDTH*4+SMALLSEG_XOFS(10), | ||
1591 | LCD_HEIGHT-SMALLSEG_HEIGHT*LCD_OFFSET*2); | ||
1592 | draw_smallsegment(SLASH, SMALLSEG_WIDTH*5+SMALLSEG_XOFS(10), | ||
1593 | LCD_HEIGHT-SMALLSEG_HEIGHT*LCD_OFFSET*2); | ||
1594 | draw_smallsegment(year/1000, SMALLSEG_WIDTH*6+SMALLSEG_XOFS(10), | ||
1595 | LCD_HEIGHT-SMALLSEG_HEIGHT*LCD_OFFSET*2); | ||
1596 | draw_smallsegment(year%1000/100, SMALLSEG_WIDTH*7+SMALLSEG_XOFS(10), | ||
1597 | LCD_HEIGHT-SMALLSEG_HEIGHT*LCD_OFFSET*2); | ||
1598 | draw_smallsegment(year%100/10, SMALLSEG_WIDTH*8+SMALLSEG_XOFS(10), | ||
1599 | LCD_HEIGHT-SMALLSEG_HEIGHT*LCD_OFFSET*2); | ||
1600 | draw_smallsegment(year%10, SMALLSEG_WIDTH*9+SMALLSEG_XOFS(10), | ||
1601 | LCD_HEIGHT-SMALLSEG_HEIGHT*LCD_OFFSET*2); | ||
2459 | } | 1602 | } |
2460 | else if(settings.lcd[lcd_seconds] == 3) /* Invert the LCD as seconds pass */ | 1603 | else if(settings.digital[digital_date] == 2) /* european mode */ |
2461 | { | 1604 | { |
2462 | rb->lcd_set_drawmode(DRMODE_COMPLEMENT); | 1605 | draw_smallsegment(day/10, SMALLSEG_WIDTH*0+SMALLSEG_XOFS(10), |
2463 | rb->lcd_fillrect(0, 0, fill, LCD_HEIGHT); | 1606 | LCD_HEIGHT-SMALLSEG_HEIGHT*LCD_OFFSET*2); |
2464 | rb->lcd_set_drawmode(DRMODE_SOLID); | 1607 | draw_smallsegment(day%10, SMALLSEG_WIDTH*1+SMALLSEG_XOFS(10), |
1608 | LCD_HEIGHT-SMALLSEG_HEIGHT*LCD_OFFSET*2); | ||
1609 | draw_smallsegment(PERIOD, SMALLSEG_WIDTH*2+SMALLSEG_XOFS(10), | ||
1610 | LCD_HEIGHT-SMALLSEG_HEIGHT*LCD_OFFSET*2); | ||
1611 | draw_smallsegment(month/10, SMALLSEG_WIDTH*3+SMALLSEG_XOFS(10), | ||
1612 | LCD_HEIGHT-SMALLSEG_HEIGHT*LCD_OFFSET*2); | ||
1613 | draw_smallsegment(month%10, SMALLSEG_WIDTH*4+SMALLSEG_XOFS(10), | ||
1614 | LCD_HEIGHT-SMALLSEG_HEIGHT*LCD_OFFSET*2); | ||
1615 | draw_smallsegment(PERIOD, SMALLSEG_WIDTH*5+SMALLSEG_XOFS(10), | ||
1616 | LCD_HEIGHT-SMALLSEG_HEIGHT*LCD_OFFSET*2); | ||
1617 | draw_smallsegment(year/1000, SMALLSEG_WIDTH*6+SMALLSEG_XOFS(10), | ||
1618 | LCD_HEIGHT-SMALLSEG_HEIGHT*LCD_OFFSET*2); | ||
1619 | draw_smallsegment(year%1000/100, SMALLSEG_WIDTH*7+SMALLSEG_XOFS(10), | ||
1620 | LCD_HEIGHT-SMALLSEG_HEIGHT*LCD_OFFSET*2); | ||
1621 | draw_smallsegment(year%100/10, SMALLSEG_WIDTH*8+SMALLSEG_XOFS(10), | ||
1622 | LCD_HEIGHT-SMALLSEG_HEIGHT*LCD_OFFSET*2); | ||
1623 | draw_smallsegment(year%10, SMALLSEG_WIDTH*9+SMALLSEG_XOFS(10), | ||
1624 | LCD_HEIGHT-SMALLSEG_HEIGHT*LCD_OFFSET*2); | ||
2465 | } | 1625 | } |
2466 | } | 1626 | } |
2467 | else if(settings.clock == FULLSCREEN) /* Fullscreen mode */ | 1627 | else if(settings.clock == FULLSCREEN) /* Fullscreen mode */ |
@@ -2471,25 +1631,55 @@ void draw_extras(int year, int day, int month, int hour, int minute, int second) | |||
2471 | for(i=0; i < 60; i+=5) /* Draw the circle */ | 1631 | for(i=0; i < 60; i+=5) /* Draw the circle */ |
2472 | rb->lcd_fillrect(xminute_full[i]-1, yminute_full[i]-1, 3, 3); | 1632 | rb->lcd_fillrect(xminute_full[i]-1, yminute_full[i]-1, 3, 3); |
2473 | } | 1633 | } |
2474 | if(settings.fullscreen[fullscreen_invertseconds]) /* Invert the LCD as seconds pass */ | ||
2475 | { | ||
2476 | rb->lcd_set_drawmode(DRMODE_COMPLEMENT); | ||
2477 | rb->lcd_fillrect(0, 0, fill, LCD_HEIGHT); | ||
2478 | rb->lcd_set_drawmode(DRMODE_SOLID); | ||
2479 | } | ||
2480 | } | 1634 | } |
2481 | else if(settings.clock == PLAIN) /* Plain mode */ | 1635 | else if(settings.clock == PLAIN) /* Plain mode */ |
2482 | { | 1636 | { |
2483 | /* Date readout */ | 1637 | /* Date readout */ |
2484 | if(settings.plain[plain_date] == 1) /* american mode */ | 1638 | if(settings.plain[plain_date] == 1) /* american mode */ |
2485 | { | 1639 | { |
2486 | rb->snprintf(buf, sizeof(buf), "%d/%d/%d", month, day, year); | 1640 | draw_smalldigit(month/10, SMALLDIGIT_WIDTH*0+SMALLDIGIT_XOFS(10), |
2487 | rb->lcd_putsxy(0, LCD_HEIGHT-28, buf); | 1641 | LCD_HEIGHT-SMALLDIGIT_HEIGHT*LCD_OFFSET*2); |
1642 | draw_smalldigit(month%10, SMALLDIGIT_WIDTH*1+SMALLDIGIT_XOFS(10), | ||
1643 | LCD_HEIGHT-SMALLDIGIT_HEIGHT*LCD_OFFSET*2); | ||
1644 | draw_smalldigit(SLASH, SMALLDIGIT_WIDTH*2+SMALLDIGIT_XOFS(10), | ||
1645 | LCD_HEIGHT-SMALLDIGIT_HEIGHT*LCD_OFFSET*2); | ||
1646 | draw_smalldigit(day/10, SMALLDIGIT_WIDTH*3+SMALLDIGIT_XOFS(10), | ||
1647 | LCD_HEIGHT-SMALLDIGIT_HEIGHT*LCD_OFFSET*2); | ||
1648 | draw_smalldigit(day%10, SMALLDIGIT_WIDTH*4+SMALLDIGIT_XOFS(10), | ||
1649 | LCD_HEIGHT-SMALLDIGIT_HEIGHT*LCD_OFFSET*2); | ||
1650 | draw_smalldigit(SLASH, SMALLDIGIT_WIDTH*5+SMALLDIGIT_XOFS(10), | ||
1651 | LCD_HEIGHT-SMALLDIGIT_HEIGHT*LCD_OFFSET*2); | ||
1652 | draw_smalldigit(year/1000, SMALLDIGIT_WIDTH*6+SMALLDIGIT_XOFS(10), | ||
1653 | LCD_HEIGHT-SMALLDIGIT_HEIGHT*LCD_OFFSET*2); | ||
1654 | draw_smalldigit(year%1000/100, SMALLDIGIT_WIDTH*7+SMALLDIGIT_XOFS(10), | ||
1655 | LCD_HEIGHT-SMALLDIGIT_HEIGHT*LCD_OFFSET*2); | ||
1656 | draw_smalldigit(year%100/10, SMALLDIGIT_WIDTH*8+SMALLDIGIT_XOFS(10), | ||
1657 | LCD_HEIGHT-SMALLDIGIT_HEIGHT*LCD_OFFSET*2); | ||
1658 | draw_smalldigit(year%10, SMALLDIGIT_WIDTH*9+SMALLDIGIT_XOFS(10), | ||
1659 | LCD_HEIGHT-SMALLDIGIT_HEIGHT*LCD_OFFSET*2); | ||
2488 | } | 1660 | } |
2489 | else if(settings.plain[plain_date] == 2) /* european mode */ | 1661 | else if(settings.plain[plain_date] == 2) /* european mode */ |
2490 | { | 1662 | { |
2491 | rb->snprintf(buf, sizeof(buf), "%d.%d.%d", day, month, year); | 1663 | draw_smalldigit(day/10, SMALLDIGIT_WIDTH*0+SMALLDIGIT_XOFS(10), |
2492 | rb->lcd_putsxy(0, LCD_HEIGHT-28, buf); | 1664 | LCD_HEIGHT-SMALLDIGIT_HEIGHT*LCD_OFFSET*2); |
1665 | draw_smalldigit(day%10, SMALLDIGIT_WIDTH*1+SMALLDIGIT_XOFS(10), | ||
1666 | LCD_HEIGHT-SMALLDIGIT_HEIGHT*LCD_OFFSET*2); | ||
1667 | draw_smalldigit(PERIOD, SMALLDIGIT_WIDTH*2+SMALLDIGIT_XOFS(10), | ||
1668 | LCD_HEIGHT-SMALLDIGIT_HEIGHT*LCD_OFFSET*2); | ||
1669 | draw_smalldigit(month/10, SMALLDIGIT_WIDTH*3+SMALLDIGIT_XOFS(10), | ||
1670 | LCD_HEIGHT-SMALLDIGIT_HEIGHT*LCD_OFFSET*2); | ||
1671 | draw_smalldigit(month%10, SMALLDIGIT_WIDTH*4+SMALLDIGIT_XOFS(10), | ||
1672 | LCD_HEIGHT-SMALLDIGIT_HEIGHT*LCD_OFFSET*2); | ||
1673 | draw_smalldigit(PERIOD, SMALLDIGIT_WIDTH*5+SMALLDIGIT_XOFS(10), | ||
1674 | LCD_HEIGHT-SMALLDIGIT_HEIGHT*LCD_OFFSET*2); | ||
1675 | draw_smalldigit(year/1000, SMALLDIGIT_WIDTH*6+SMALLDIGIT_XOFS(10), | ||
1676 | LCD_HEIGHT-SMALLDIGIT_HEIGHT*LCD_OFFSET*2); | ||
1677 | draw_smalldigit(year%1000/100, SMALLDIGIT_WIDTH*7+SMALLDIGIT_XOFS(10), | ||
1678 | LCD_HEIGHT-SMALLDIGIT_HEIGHT*LCD_OFFSET*2); | ||
1679 | draw_smalldigit(year%100/10, SMALLDIGIT_WIDTH*8+SMALLDIGIT_XOFS(10), | ||
1680 | LCD_HEIGHT-SMALLDIGIT_HEIGHT*LCD_OFFSET*2); | ||
1681 | draw_smalldigit(year%10, SMALLDIGIT_WIDTH*9+SMALLDIGIT_XOFS(10), | ||
1682 | LCD_HEIGHT-SMALLDIGIT_HEIGHT*LCD_OFFSET*2); | ||
2493 | } | 1683 | } |
2494 | } | 1684 | } |
2495 | } | 1685 | } |
@@ -2497,169 +1687,31 @@ void draw_extras(int year, int day, int month, int hour, int minute, int second) | |||
2497 | /*************** | 1687 | /*************** |
2498 | * Select a mode | 1688 | * Select a mode |
2499 | **************/ | 1689 | **************/ |
2500 | void select_mode(void) | 1690 | void mode_selector(void) |
2501 | { | 1691 | { |
2502 | int cursorpos = settings.clock; | 1692 | int m, result; |
2503 | int cursor_dummy, cursor_y; | ||
2504 | int i; | ||
2505 | |||
2506 | done = false; | 1693 | done = false; |
2507 | 1694 | ||
2508 | while(!done) | 1695 | set_standard_colors(); |
2509 | { | ||
2510 | rb->lcd_clear_display(); | ||
2511 | |||
2512 | center_text(0, "Mode Selector"); | ||
2513 | for(i=0; i<6; i++) | ||
2514 | { | ||
2515 | rb->lcd_puts(2, i+1, mode_selector_entries[i]); | ||
2516 | rb->lcd_mono_bitmap(arrow, 1, 8*(i+1)+1, 8, 6); | ||
2517 | } | ||
2518 | |||
2519 | cursor(0, 8*cursorpos, LCD_WIDTH, 8); /* draw cursor */ | ||
2520 | |||
2521 | rb->lcd_update(); | ||
2522 | |||
2523 | switch(rb->button_get_w_tmo(HZ/4)) | ||
2524 | { | ||
2525 | case MOVE_UP_BUTTON: | ||
2526 | if(cursorpos > 1) | ||
2527 | { | ||
2528 | cursor_y = 8+(8*(cursorpos-1)); | ||
2529 | cursor_dummy = cursor_y; | ||
2530 | for(; cursor_y>cursor_dummy-8; cursor_y-=2) | ||
2531 | { | ||
2532 | rb->lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID); | ||
2533 | rb->lcd_fillrect(0, 8, LCD_WIDTH, LCD_HEIGHT-8); | ||
2534 | rb->lcd_set_drawmode(DRMODE_SOLID); | ||
2535 | |||
2536 | for(i=0; i<6; i++) | ||
2537 | { | ||
2538 | rb->lcd_puts(2, i+1, mode_selector_entries[i]); | ||
2539 | rb->lcd_mono_bitmap(arrow, 1, 8*(i+1)+1, 8, 6); | ||
2540 | } | ||
2541 | |||
2542 | cursor(0, cursor_y, LCD_WIDTH, 8); | ||
2543 | rb->lcd_update(); | ||
2544 | } | ||
2545 | cursorpos--; | ||
2546 | } | ||
2547 | break; | ||
2548 | |||
2549 | case MOVE_DOWN_BUTTON: | ||
2550 | if(cursorpos < 6) | ||
2551 | { | ||
2552 | cursor_y = 8+(8*(cursorpos-1)); | ||
2553 | cursor_dummy = cursor_y; | ||
2554 | for(; cursor_y<cursor_dummy+8; cursor_y+=2) | ||
2555 | { | ||
2556 | rb->lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID); | ||
2557 | rb->lcd_fillrect(0, 8, LCD_WIDTH, LCD_HEIGHT-8); | ||
2558 | rb->lcd_set_drawmode(DRMODE_SOLID); | ||
2559 | |||
2560 | for(i=0; i<6; i++) | ||
2561 | { | ||
2562 | rb->lcd_puts(2, i+1, mode_selector_entries[i]); | ||
2563 | rb->lcd_mono_bitmap(arrow, 1, 8*(i+1)+1, 8, 6); | ||
2564 | } | ||
2565 | |||
2566 | cursor(0, cursor_y, LCD_WIDTH, 8); | ||
2567 | rb->lcd_update(); | ||
2568 | } | ||
2569 | cursorpos++; | ||
2570 | } | ||
2571 | break; | ||
2572 | 1696 | ||
2573 | case MENU_BUTTON: | 1697 | m = rb->menu_init(mode_selector_items, sizeof(mode_selector_items) / sizeof(*mode_selector_items), |
2574 | case CHANGE_UP_BUTTON: | 1698 | NULL, NULL, NULL, NULL); |
2575 | settings.clock = cursorpos; | ||
2576 | done = true; | ||
2577 | break; | ||
2578 | |||
2579 | #ifdef EXIT_RC_BUTTON | ||
2580 | case EXIT_RC_BUTTON: | ||
2581 | #endif | ||
2582 | case EXIT_BUTTON: | ||
2583 | case CHANGE_DOWN_BUTTON: | ||
2584 | done = true; | ||
2585 | break; | ||
2586 | } | ||
2587 | } | ||
2588 | } | ||
2589 | |||
2590 | /******************** | ||
2591 | * Counter's all done | ||
2592 | *******************/ | ||
2593 | void counter_finished(void) | ||
2594 | { | ||
2595 | int btn; | ||
2596 | int xpos = 0; | ||
2597 | bool bouncing_up = false; | ||
2598 | bool led_on = true; | ||
2599 | unsigned char *times_up = 0; | ||
2600 | times_up = (unsigned char *)timesup; | ||
2601 | |||
2602 | done = false; | ||
2603 | 1699 | ||
2604 | while(!done) | 1700 | while(!done) |
2605 | { | 1701 | { |
2606 | rb->lcd_clear_display(); | 1702 | result = rb->menu_show(m); |
2607 | |||
2608 | /* draw "TIME'S UP" text */ | ||
2609 | rb->lcd_mono_bitmap(times_up, 0, xpos, 112, 50); | ||
2610 | 1703 | ||
2611 | /* invert lcd */ | 1704 | /* check for this, so if the user exits the menu without |
2612 | rb->lcd_set_drawmode(DRMODE_COMPLEMENT); | 1705 | * making a selection, it won't change to some weird value. */ |
2613 | rb->lcd_fillrect(0, 0, LCD_WIDTH, LCD_HEIGHT); | 1706 | if(result >= 0) |
2614 | rb->lcd_set_drawmode(DRMODE_SOLID); | 1707 | settings.clock = result+1; |
2615 | |||
2616 | rb->lcd_update(); | ||
2617 | 1708 | ||
2618 | /* pause */ | 1709 | done = true; |
2619 | rb->sleep(HZ/25); | ||
2620 | 1710 | ||
2621 | /* move bitmap up/down 1px */ | 1711 | rb->menu_exit(m); |
2622 | if(bouncing_up) | ||
2623 | { | ||
2624 | if(xpos > 0) | ||
2625 | xpos--; | ||
2626 | else | ||
2627 | bouncing_up = false; | ||
2628 | |||
2629 | led_on = true; | ||
2630 | } | ||
2631 | else | ||
2632 | { | ||
2633 | if(xpos < 14) | ||
2634 | xpos++; | ||
2635 | else | ||
2636 | bouncing_up = true; | ||
2637 | |||
2638 | led_on = false; | ||
2639 | } | ||
2640 | |||
2641 | /* turn red led on and off */ | ||
2642 | #ifndef SIMULATOR | ||
2643 | #if (CONFIG_KEYPAD == RECORDER_PAD) /* only for recorders */ | ||
2644 | if(led_on) | ||
2645 | or_b(0x40, &PBDRL); | ||
2646 | else | ||
2647 | and_b(~0x40, &PBDRL); | ||
2648 | #endif | ||
2649 | #endif | ||
2650 | |||
2651 | /* exit on keypress */ | ||
2652 | btn = rb->button_get(false); | ||
2653 | if (btn != BUTTON_NONE && !(btn & BUTTON_REL)) | ||
2654 | { | ||
2655 | #ifndef SIMULATOR | ||
2656 | #if (CONFIG_KEYPAD == RECORDER_PAD) /* only for recorders */ | ||
2657 | and_b(~0x40, &PBDRL); /* shut off the red led */ | ||
2658 | #endif | ||
2659 | #endif | ||
2660 | done = true; | ||
2661 | } | ||
2662 | } | 1712 | } |
1713 | |||
1714 | set_digital_colors(); | ||
2663 | } | 1715 | } |
2664 | 1716 | ||
2665 | /********************* | 1717 | /********************* |
@@ -2667,11 +1719,10 @@ void counter_finished(void) | |||
2667 | ********************/ | 1719 | ********************/ |
2668 | void show_counter(void) | 1720 | void show_counter(void) |
2669 | { | 1721 | { |
1722 | |||
2670 | /* increment counter */ | 1723 | /* increment counter */ |
2671 | if(counting) | 1724 | if(counting) |
2672 | { | ||
2673 | passed_time = *rb->current_tick - start_tick; | 1725 | passed_time = *rb->current_tick - start_tick; |
2674 | } | ||
2675 | else | 1726 | else |
2676 | passed_time = 0; | 1727 | passed_time = 0; |
2677 | 1728 | ||
@@ -2683,241 +1734,82 @@ void show_counter(void) | |||
2683 | count_m = displayed_value % 3600 / 60; | 1734 | count_m = displayed_value % 3600 / 60; |
2684 | count_h = displayed_value / 3600; | 1735 | count_h = displayed_value / 3600; |
2685 | 1736 | ||
2686 | /* compute "counting down" displayed value */ | ||
2687 | if(!counting_up) | ||
2688 | { | ||
2689 | remaining_s = target_second - count_s; | ||
2690 | remaining_m = target_minute - count_m; | ||
2691 | remaining_h = target_hour - count_h; | ||
2692 | } | ||
2693 | |||
2694 | if(remaining_s < 0) | ||
2695 | { | ||
2696 | remaining_s += 60; | ||
2697 | remaining_m--; | ||
2698 | } | ||
2699 | if(remaining_m < 0) | ||
2700 | { | ||
2701 | remaining_m += 60; | ||
2702 | remaining_h--; | ||
2703 | } | ||
2704 | if(remaining_h < 0) | ||
2705 | { | ||
2706 | /* reset modes */ | ||
2707 | counting = false; | ||
2708 | counting_up = true; | ||
2709 | |||
2710 | /* all done! */ | ||
2711 | counter_finished(); | ||
2712 | |||
2713 | /* reset all counter values */ | ||
2714 | remaining_h = target_hour = 0; | ||
2715 | remaining_m = target_minute = 0; | ||
2716 | remaining_s = target_second = 0; | ||
2717 | } | ||
2718 | |||
2719 | if(counting_up) | ||
2720 | rb->snprintf(count_text, sizeof(count_text), "%d:%02d:%02d", count_h, count_m, count_s); | ||
2721 | else | ||
2722 | rb->snprintf(count_text, sizeof(count_text), "%d:%02d:%02d", remaining_h, remaining_m, remaining_s); | ||
2723 | |||
2724 | /* allows us to flash the counter if it's paused */ | ||
2725 | if(settings.general[general_counter]) | 1737 | if(settings.general[general_counter]) |
2726 | { | 1738 | { |
2727 | if(settings.clock == ANALOG) | 1739 | if(settings.clock == ANALOG) |
2728 | rb->lcd_putsxy(LCD_WIDTH/2+13, LCD_HEIGHT-8, count_text); | 1740 | { |
1741 | draw_smalldigit(count_h/10, LCD_WIDTH-SMALLDIGIT_WIDTH*5, | ||
1742 | LCD_HEIGHT-SMALLDIGIT_HEIGHT*2); | ||
1743 | draw_smalldigit(count_h%10, LCD_WIDTH-SMALLDIGIT_WIDTH*4, | ||
1744 | LCD_HEIGHT-SMALLDIGIT_HEIGHT*2); | ||
1745 | draw_smalldigit(COLON, LCD_WIDTH-SMALLDIGIT_WIDTH*3, | ||
1746 | LCD_HEIGHT-SMALLDIGIT_HEIGHT*2); | ||
1747 | draw_smalldigit(count_m/10, LCD_WIDTH-SMALLDIGIT_WIDTH*2, | ||
1748 | LCD_HEIGHT-SMALLDIGIT_HEIGHT*2); | ||
1749 | draw_smalldigit(count_m%10, LCD_WIDTH-SMALLDIGIT_WIDTH, | ||
1750 | LCD_HEIGHT-SMALLDIGIT_HEIGHT*2); | ||
1751 | draw_smalldigit(count_s/10, LCD_WIDTH-SMALLDIGIT_WIDTH*3.5, | ||
1752 | LCD_HEIGHT-SMALLDIGIT_HEIGHT); | ||
1753 | draw_smalldigit(count_s%10, LCD_WIDTH-SMALLDIGIT_WIDTH*2.5, | ||
1754 | LCD_HEIGHT-SMALLDIGIT_HEIGHT); | ||
1755 | } | ||
2729 | else if(settings.clock == DIGITAL) | 1756 | else if(settings.clock == DIGITAL) |
2730 | rb->lcd_putsxy(1, 5, count_text); | ||
2731 | else if(settings.clock == LCD) | ||
2732 | rb->lcd_putsxy(1, 5, count_text); | ||
2733 | else if(settings.clock == FULLSCREEN) | ||
2734 | rb->lcd_putsxy(LCD_WIDTH/2-18, LCD_HEIGHT-20, count_text); | ||
2735 | else if(settings.clock == PLAIN) | ||
2736 | rb->lcd_putsxy(0, LCD_HEIGHT-14, count_text); | ||
2737 | } | ||
2738 | } | ||
2739 | |||
2740 | /****************** | ||
2741 | * Counter settings | ||
2742 | *****************/ | ||
2743 | void counter_settings(void) | ||
2744 | { | ||
2745 | int cursorpos = 1; | ||
2746 | char target_time[15]; | ||
2747 | bool original = counting_up; | ||
2748 | bool current = counting_up; | ||
2749 | |||
2750 | done = false; | ||
2751 | |||
2752 | while(!done) | ||
2753 | { | ||
2754 | /* print text to string */ | ||
2755 | rb->snprintf(target_time, sizeof(target_time), "%d:%02d:%02d", target_hour, target_minute, target_second); | ||
2756 | |||
2757 | /* draw text on lcd */ | ||
2758 | rb->lcd_clear_display(); | ||
2759 | |||
2760 | center_text(0, "Counter Settings"); | ||
2761 | rb->lcd_puts(2, 2, "Count UP"); | ||
2762 | rb->lcd_puts(2, 3, "Count DOWN..."); | ||
2763 | rb->lcd_puts(4, 4, "Target Time:"); | ||
2764 | rb->lcd_puts(4, 5, target_time); | ||
2765 | rb->lcd_puts(0, 7, "OFF: Return"); | ||
2766 | |||
2767 | /* tell user what mode is selected */ | ||
2768 | checkbox(rb,1, 17, 8, 6, counting_up); | ||
2769 | checkbox(rb,1, 25, 8, 6, !counting_up); | ||
2770 | |||
2771 | switch(cursorpos) | ||
2772 | { | 1757 | { |
2773 | case 1: case 2: cursor(0, (8*cursorpos)+8, 112, 8); break; | 1758 | draw_smallsegment(count_h/10, SMALLSEG_WIDTH*0+SMALLSEG_XOFS(8), |
2774 | case 3: cursor(24, 40, 06, 8); break; | 1759 | LCD_HEIGHT-SMALLSEG_HEIGHT*LCD_OFFSET); |
2775 | case 4: cursor(36, 40, 12, 8); break; | 1760 | draw_smallsegment(count_h%10, SMALLSEG_WIDTH*1+SMALLSEG_XOFS(8), |
2776 | case 5: cursor(54, 40, 12, 8); break; | 1761 | LCD_HEIGHT-SMALLSEG_HEIGHT*LCD_OFFSET); |
1762 | draw_smallsegment(COLON, SMALLSEG_WIDTH*2+SMALLSEG_XOFS(8), | ||
1763 | LCD_HEIGHT-SMALLSEG_HEIGHT*LCD_OFFSET); | ||
1764 | draw_smallsegment(count_m/10, SMALLSEG_WIDTH*3+SMALLSEG_XOFS(8), | ||
1765 | LCD_HEIGHT-SMALLSEG_HEIGHT*LCD_OFFSET); | ||
1766 | draw_smallsegment(count_m%10, SMALLSEG_WIDTH*4+SMALLSEG_XOFS(8), | ||
1767 | LCD_HEIGHT-SMALLSEG_HEIGHT*LCD_OFFSET); | ||
1768 | draw_smallsegment(COLON, SMALLSEG_WIDTH*5+SMALLSEG_XOFS(8), | ||
1769 | LCD_HEIGHT-SMALLSEG_HEIGHT*LCD_OFFSET); | ||
1770 | draw_smallsegment(count_s/10, SMALLSEG_WIDTH*6+SMALLSEG_XOFS(8), | ||
1771 | LCD_HEIGHT-SMALLSEG_HEIGHT*LCD_OFFSET); | ||
1772 | draw_smallsegment(count_s%10, SMALLSEG_WIDTH*7+SMALLSEG_XOFS(8), | ||
1773 | LCD_HEIGHT-SMALLSEG_HEIGHT*LCD_OFFSET); | ||
2777 | } | 1774 | } |
2778 | 1775 | else if(settings.clock == FULLSCREEN) | |
2779 | if(cursorpos > 2) | ||
2780 | editing_target = true; | ||
2781 | else | ||
2782 | editing_target = false; | ||
2783 | |||
2784 | rb->lcd_update(); | ||
2785 | |||
2786 | /* button scan */ | ||
2787 | switch(rb->button_get_w_tmo(HZ/4)) | ||
2788 | { | 1776 | { |
2789 | case MOVE_UP_BUTTON: /* increase / move cursor */ | ||
2790 | case MOVE_UP_BUTTON | BUTTON_REPEAT: | ||
2791 | if(!editing_target) | ||
2792 | { | ||
2793 | if(cursorpos > 1) | ||
2794 | cursorpos--; | ||
2795 | } | ||
2796 | else | ||
2797 | { | ||
2798 | if(cursorpos == 3) | ||
2799 | #if (CONFIG_KEYPAD != IPOD_3G_PAD) && (CONFIG_KEYPAD != IPOD_4G_PAD) | ||
2800 | if(target_hour < 9) | ||
2801 | target_hour++; | ||
2802 | else | ||
2803 | target_hour = 0; | ||
2804 | #else | ||
2805 | if(target_hour > 0) | ||
2806 | target_hour--; | ||
2807 | else | ||
2808 | target_hour = 9; | ||
2809 | #endif | ||
2810 | else if(cursorpos == 4) | ||
2811 | 1777 | ||
2812 | #if (CONFIG_KEYPAD != IPOD_3G_PAD) && (CONFIG_KEYPAD != IPOD_4G_PAD) | 1778 | draw_smalldigit(count_h/10, SMALLDIGIT_WIDTH*0+SMALLDIGIT_XOFS(8), |
2813 | if(target_minute < 59) | 1779 | LCD_HEIGHT-SMALLDIGIT_HEIGHT*1.5); |
2814 | target_minute++; | 1780 | draw_smalldigit(count_h%10, SMALLDIGIT_WIDTH*1+SMALLDIGIT_XOFS(8), |
2815 | else | 1781 | LCD_HEIGHT-SMALLDIGIT_HEIGHT*1.5); |
2816 | target_minute = 0; | 1782 | draw_smalldigit(COLON, SMALLDIGIT_WIDTH*2+SMALLDIGIT_XOFS(8), |
2817 | #else | 1783 | LCD_HEIGHT-SMALLDIGIT_HEIGHT*1.5); |
2818 | if(target_minute > 0) | 1784 | draw_smalldigit(count_m/10, SMALLDIGIT_WIDTH*3+SMALLDIGIT_XOFS(8), |
2819 | target_minute--; | 1785 | LCD_HEIGHT-SMALLDIGIT_HEIGHT*1.5); |
2820 | else | 1786 | draw_smalldigit(count_m%10, SMALLDIGIT_WIDTH*4+SMALLDIGIT_XOFS(8), |
2821 | target_minute = 59; | 1787 | LCD_HEIGHT-SMALLDIGIT_HEIGHT*1.5); |
2822 | #endif | 1788 | draw_smalldigit(COLON, SMALLDIGIT_WIDTH*5+SMALLDIGIT_XOFS(8), |
2823 | else | 1789 | LCD_HEIGHT-SMALLDIGIT_HEIGHT*1.5); |
2824 | #if (CONFIG_KEYPAD != IPOD_3G_PAD) && (CONFIG_KEYPAD != IPOD_4G_PAD) | 1790 | draw_smalldigit(count_s/10, SMALLDIGIT_WIDTH*6+SMALLDIGIT_XOFS(8), |
2825 | if(target_second < 59) | 1791 | LCD_HEIGHT-SMALLDIGIT_HEIGHT*1.5); |
2826 | target_second++; | 1792 | draw_smalldigit(count_s%10, SMALLDIGIT_WIDTH*7+SMALLDIGIT_XOFS(8), |
2827 | else | 1793 | LCD_HEIGHT-SMALLDIGIT_HEIGHT*1.5); |
2828 | target_second = 0; | 1794 | } |
2829 | #else | 1795 | else if(settings.clock == PLAIN) |
2830 | if(target_second > 0) | 1796 | { |
2831 | target_second--; | 1797 | draw_smalldigit(count_h/10, SMALLDIGIT_WIDTH*0+SMALLDIGIT_XOFS(8), |
2832 | else | 1798 | LCD_HEIGHT-SMALLDIGIT_HEIGHT*LCD_OFFSET); |
2833 | target_second = 59; | 1799 | draw_smalldigit(count_h%10, SMALLDIGIT_WIDTH*1+SMALLDIGIT_XOFS(8), |
2834 | #endif | 1800 | LCD_HEIGHT-SMALLDIGIT_HEIGHT*LCD_OFFSET); |
2835 | } | 1801 | draw_smalldigit(COLON, SMALLDIGIT_WIDTH*2+SMALLDIGIT_XOFS(8), |
2836 | break; | 1802 | LCD_HEIGHT-SMALLDIGIT_HEIGHT*LCD_OFFSET); |
2837 | 1803 | draw_smalldigit(count_m/10, SMALLDIGIT_WIDTH*3+SMALLDIGIT_XOFS(8), | |
2838 | case MOVE_DOWN_BUTTON: /* decrease / move cursor */ | 1804 | LCD_HEIGHT-SMALLDIGIT_HEIGHT*LCD_OFFSET); |
2839 | case MOVE_DOWN_BUTTON | BUTTON_REPEAT: | 1805 | draw_smalldigit(count_m%10, SMALLDIGIT_WIDTH*4+SMALLDIGIT_XOFS(8), |
2840 | if(!editing_target) | 1806 | LCD_HEIGHT-SMALLDIGIT_HEIGHT*LCD_OFFSET); |
2841 | { | 1807 | draw_smalldigit(COLON, SMALLDIGIT_WIDTH*5+SMALLDIGIT_XOFS(8), |
2842 | if(cursorpos < 3) | 1808 | LCD_HEIGHT-SMALLDIGIT_HEIGHT*LCD_OFFSET); |
2843 | cursorpos++; | 1809 | draw_smalldigit(count_s/10, SMALLDIGIT_WIDTH*6+SMALLDIGIT_XOFS(8), |
2844 | } | 1810 | LCD_HEIGHT-SMALLDIGIT_HEIGHT*LCD_OFFSET); |
2845 | else | 1811 | draw_smalldigit(count_s%10, SMALLDIGIT_WIDTH*7+SMALLDIGIT_XOFS(8), |
2846 | { | 1812 | LCD_HEIGHT-SMALLDIGIT_HEIGHT*LCD_OFFSET); |
2847 | if(cursorpos == 3) | ||
2848 | #if (CONFIG_KEYPAD != IPOD_3G_PAD) && (CONFIG_KEYPAD != IPOD_4G_PAD) | ||
2849 | if(target_hour > 0) | ||
2850 | target_hour--; | ||
2851 | else | ||
2852 | target_hour = 9; | ||
2853 | #else | ||
2854 | if(target_hour < 9) | ||
2855 | target_hour++; | ||
2856 | else | ||
2857 | target_hour = 0; | ||
2858 | #endif | ||
2859 | else if(cursorpos == 4) | ||
2860 | #if (CONFIG_KEYPAD != IPOD_3G_PAD) && (CONFIG_KEYPAD != IPOD_4G_PAD) | ||
2861 | if(target_minute > 0) | ||
2862 | target_minute--; | ||
2863 | else | ||
2864 | target_minute = 59; | ||
2865 | #else | ||
2866 | if(target_minute < 59) | ||
2867 | target_minute++; | ||
2868 | else | ||
2869 | target_minute = 0; | ||
2870 | #endif | ||
2871 | else | ||
2872 | #if (CONFIG_KEYPAD != IPOD_3G_PAD) && (CONFIG_KEYPAD != IPOD_4G_PAD) | ||
2873 | if(target_second > 0) | ||
2874 | target_second--; | ||
2875 | else | ||
2876 | target_second = 59; | ||
2877 | #else | ||
2878 | if(target_second < 59) | ||
2879 | target_second++; | ||
2880 | else | ||
2881 | target_second = 0; | ||
2882 | #endif | ||
2883 | } | ||
2884 | break; | ||
2885 | |||
2886 | case CHANGE_DOWN_BUTTON: /* move cursor */ | ||
2887 | if(cursorpos > 3) | ||
2888 | cursorpos--; | ||
2889 | else | ||
2890 | cursorpos = 5; | ||
2891 | break; | ||
2892 | |||
2893 | case CHANGE_UP_BUTTON: /* move cursor */ | ||
2894 | if(cursorpos < 5) | ||
2895 | cursorpos++; | ||
2896 | else | ||
2897 | cursorpos = 3; | ||
2898 | break; | ||
2899 | |||
2900 | case MENU_BUTTON: /* toggle */ | ||
2901 | if(cursorpos == 1) | ||
2902 | counting_up = true; | ||
2903 | if(cursorpos == 2) | ||
2904 | counting_up = false; | ||
2905 | if(cursorpos >= 3 && cursorpos <= 5) | ||
2906 | { | ||
2907 | cursorpos = 2; | ||
2908 | counting_up = false; | ||
2909 | } | ||
2910 | break; | ||
2911 | |||
2912 | #ifdef EXIT_RC_BUTTON | ||
2913 | case EXIT_RC_BUTTON: | ||
2914 | #endif | ||
2915 | case EXIT_BUTTON: | ||
2916 | current = counting_up; | ||
2917 | if(current != original) | ||
2918 | counter = 0; | ||
2919 | done = true; | ||
2920 | break; | ||
2921 | } | 1813 | } |
2922 | } | 1814 | } |
2923 | } | 1815 | } |
@@ -2927,125 +1819,52 @@ void counter_settings(void) | |||
2927 | **********/ | 1819 | **********/ |
2928 | void main_menu(void) | 1820 | void main_menu(void) |
2929 | { | 1821 | { |
2930 | int cursor_dummy, cursor_y; | 1822 | int m, result; |
2931 | int i; | ||
2932 | |||
2933 | done = false; | 1823 | done = false; |
2934 | 1824 | ||
1825 | set_standard_colors(); | ||
1826 | |||
1827 | m = rb->menu_init(main_menu_items, sizeof(main_menu_items) / sizeof(*main_menu_items), | ||
1828 | NULL, NULL, NULL, NULL); | ||
1829 | |||
2935 | while(!done) | 1830 | while(!done) |
2936 | { | 1831 | { |
2937 | rb->lcd_clear_display(); | 1832 | result = rb->menu_show(m); |
2938 | 1833 | ||
2939 | center_text(0, "Main Menu"); | 1834 | switch(result) |
2940 | for(i=0; i<7; i++) /* draw menu items and icons */ | ||
2941 | { | 1835 | { |
2942 | rb->lcd_puts(2, i+1, menu_entries[i]); | 1836 | case 0: |
2943 | rb->lcd_mono_bitmap(arrow, 1, 8*(i+1)+1, 8, 6); | 1837 | rb->lcd_setfont(FONT_SYSFIXED); |
2944 | } | 1838 | done = true; |
2945 | 1839 | break; | |
2946 | cursor(0, 8*menupos, LCD_WIDTH, 8); /* draw cursor */ | ||
2947 | |||
2948 | rb->lcd_update(); | ||
2949 | 1840 | ||
2950 | switch(rb->button_get_w_tmo(HZ/4)) | 1841 | case 1: |
2951 | { | 1842 | mode_selector(); |
2952 | case MOVE_UP_BUTTON: | 1843 | break; |
2953 | if(menupos > 1) | ||
2954 | { | ||
2955 | cursor_y = 8+(8*(menupos-1)); | ||
2956 | for(cursor_dummy = cursor_y; cursor_y>cursor_dummy-8; cursor_y-=2) | ||
2957 | { | ||
2958 | rb->lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID); | ||
2959 | rb->lcd_fillrect(0, 8, LCD_WIDTH, LCD_HEIGHT-8); | ||
2960 | rb->lcd_set_drawmode(DRMODE_SOLID); | ||
2961 | |||
2962 | for(i=0; i<7; i++) /* draw menu items and icons */ | ||
2963 | { | ||
2964 | rb->lcd_puts(2, i+1, menu_entries[i]); | ||
2965 | rb->lcd_mono_bitmap(arrow, 1, 8*(i+1)+1, 8, 6); | ||
2966 | } | ||
2967 | |||
2968 | cursor(0, cursor_y, LCD_WIDTH, 8); /* draw cursor */ | ||
2969 | rb->lcd_update(); | ||
2970 | } | ||
2971 | menupos--; | ||
2972 | } | ||
2973 | else | ||
2974 | menupos = 7; | ||
2975 | break; | ||
2976 | 1844 | ||
2977 | case MOVE_DOWN_BUTTON: | 1845 | case 2: |
2978 | if(menupos < 7) | 1846 | settings_screen(); |
2979 | { | 1847 | break; |
2980 | cursor_y = 8+(8*(menupos-1)); | ||
2981 | for(cursor_dummy = cursor_y; cursor_y<cursor_dummy+8; cursor_y+=2) | ||
2982 | { | ||
2983 | rb->lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID); | ||
2984 | rb->lcd_fillrect(0, 8, LCD_WIDTH, LCD_HEIGHT-8); | ||
2985 | rb->lcd_set_drawmode(DRMODE_SOLID); | ||
2986 | |||
2987 | for(i=0; i<7; i++) /* draw menu items and icons */ | ||
2988 | { | ||
2989 | rb->lcd_puts(2, i+1, menu_entries[i]); | ||
2990 | rb->lcd_mono_bitmap(arrow, 1, 8*(i+1)+1, 8, 6); | ||
2991 | } | ||
2992 | |||
2993 | cursor(0, cursor_y, LCD_WIDTH, 8); /* draw cursor */ | ||
2994 | rb->lcd_update(); | ||
2995 | } | ||
2996 | menupos++; | ||
2997 | } | ||
2998 | else | ||
2999 | menupos=1; | ||
3000 | break; | ||
3001 | 1848 | ||
3002 | case MENU_BUTTON: | 1849 | case 3: |
3003 | case CHANGE_UP_BUTTON: | 1850 | general_settings(); |
3004 | switch(menupos) | ||
3005 | { | ||
3006 | case 1: | ||
3007 | done = true; | ||
3008 | break; | ||
3009 | |||
3010 | case 2: | ||
3011 | select_mode(); | ||
3012 | break; | ||
3013 | |||
3014 | case 3: | ||
3015 | counter_settings(); | ||
3016 | break; | ||
3017 | |||
3018 | case 4: | ||
3019 | settings_screen(); | ||
3020 | break; | ||
3021 | |||
3022 | case 5: | ||
3023 | general_settings(); | ||
3024 | break; | ||
3025 | |||
3026 | case 6: | ||
3027 | help_screen(); | ||
3028 | break; | ||
3029 | |||
3030 | case 7: | ||
3031 | show_credits(); | ||
3032 | done = true; | ||
3033 | break; | ||
3034 | } | ||
3035 | break; | 1851 | break; |
3036 | 1852 | ||
3037 | #ifdef EXIT_RC_BUTTON | 1853 | case 4: |
3038 | case EXIT_RC_BUTTON: | 1854 | exit_clock = true; |
3039 | #endif | ||
3040 | case EXIT_BUTTON: | ||
3041 | case CHANGE_DOWN_BUTTON: | ||
3042 | #ifdef ALT_MENU_BUTTON | ||
3043 | case ALT_MENU_BUTTON: | ||
3044 | #endif | ||
3045 | done = true; | 1855 | done = true; |
3046 | break; | 1856 | break; |
1857 | |||
1858 | default: | ||
1859 | done=true; | ||
1860 | break; | ||
3047 | } | 1861 | } |
1862 | |||
1863 | rb->menu_exit(m); | ||
3048 | } | 1864 | } |
1865 | |||
1866 | rb->lcd_setfont(FONT_SYSFIXED); | ||
1867 | set_digital_colors(); | ||
3049 | } | 1868 | } |
3050 | 1869 | ||
3051 | /********************************************************************** | 1870 | /********************************************************************** |
@@ -3061,16 +1880,25 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter) | |||
3061 | int last_second = -1; | 1880 | int last_second = -1; |
3062 | int year, day, month; | 1881 | int year, day, month; |
3063 | 1882 | ||
3064 | bool f2_held = false; | 1883 | bool counter_btn_held = false; |
3065 | 1884 | ||
3066 | struct tm* current_time; | 1885 | struct tm* current_time; |
3067 | 1886 | ||
3068 | (void)parameter; | 1887 | (void)parameter; |
3069 | rb = api; | 1888 | rb = api; |
3070 | 1889 | ||
1890 | #if LCD_DEPTH > 1 | ||
1891 | rb->lcd_set_backdrop(NULL); | ||
1892 | #endif | ||
1893 | |||
3071 | init_clock(); | 1894 | init_clock(); |
3072 | 1895 | ||
3073 | while (1) | 1896 | /* init xlcd functions */ |
1897 | xlcd_init(rb); | ||
1898 | |||
1899 | set_digital_colors(); | ||
1900 | |||
1901 | while(!exit_clock) | ||
3074 | { | 1902 | { |
3075 | /********************* | 1903 | /********************* |
3076 | * Time info | 1904 | * Time info |
@@ -3094,9 +1922,6 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter) | |||
3094 | { | 1922 | { |
3095 | rb->lcd_clear_display(); | 1923 | rb->lcd_clear_display(); |
3096 | 1924 | ||
3097 | /* show counter */ | ||
3098 | show_counter(); | ||
3099 | |||
3100 | /* Analog mode */ | 1925 | /* Analog mode */ |
3101 | if(settings.clock == ANALOG) | 1926 | if(settings.clock == ANALOG) |
3102 | analog_clock(hour, minute, second); | 1927 | analog_clock(hour, minute, second); |
@@ -3104,17 +1929,9 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter) | |||
3104 | else if(settings.clock == DIGITAL) | 1929 | else if(settings.clock == DIGITAL) |
3105 | { | 1930 | { |
3106 | if(settings.digital[digital_blinkcolon]) | 1931 | if(settings.digital[digital_blinkcolon]) |
3107 | draw_7seg_time(hour, minute, 8, 16, (LCD_WIDTH-48)/4, LCD_HEIGHT-32, second & 1, false); | 1932 | digital_clock(hour, minute, second, second & 1); |
3108 | else | ||
3109 | draw_7seg_time(hour, minute, 8, 16, (LCD_WIDTH-48)/4, LCD_HEIGHT-32, true, false); | ||
3110 | } | ||
3111 | /* LCD mode */ | ||
3112 | else if(settings.clock == LCD) | ||
3113 | { | ||
3114 | if(settings.lcd[lcd_blinkcolon]) | ||
3115 | draw_7seg_time(hour, minute, 8, 16, (LCD_WIDTH-48)/4, LCD_HEIGHT-32, second & 1, true); | ||
3116 | else | 1933 | else |
3117 | draw_7seg_time(hour, minute, 8, 16, (LCD_WIDTH-48)/4, LCD_HEIGHT-32, true, true); | 1934 | digital_clock(hour, minute, second, true); |
3118 | } | 1935 | } |
3119 | /* Fullscreen mode */ | 1936 | /* Fullscreen mode */ |
3120 | else if(settings.clock == FULLSCREEN) | 1937 | else if(settings.clock == FULLSCREEN) |
@@ -3130,6 +1947,9 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter) | |||
3130 | else | 1947 | else |
3131 | plain_clock(hour, minute, second, true); | 1948 | plain_clock(hour, minute, second, true); |
3132 | } | 1949 | } |
1950 | |||
1951 | /* show counter */ | ||
1952 | show_counter(); | ||
3133 | } | 1953 | } |
3134 | 1954 | ||
3135 | if(settings.analog[analog_time] == 2 && temphour == 0) | 1955 | if(settings.analog[analog_time] == 2 && temphour == 0) |
@@ -3137,6 +1957,7 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter) | |||
3137 | if(settings.analog[analog_time] == 2 && temphour > 12) | 1957 | if(settings.analog[analog_time] == 2 && temphour > 12) |
3138 | temphour -= 12; | 1958 | temphour -= 12; |
3139 | 1959 | ||
1960 | /* all the "extras" - readouts/displays */ | ||
3140 | draw_extras(year, day, month, temphour, minute, second); | 1961 | draw_extras(year, day, month, temphour, minute, second); |
3141 | 1962 | ||
3142 | if(!idle_poweroff) | 1963 | if(!idle_poweroff) |
@@ -3150,17 +1971,10 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter) | |||
3150 | button = rb->button_get_w_tmo(HZ/10); | 1971 | button = rb->button_get_w_tmo(HZ/10); |
3151 | switch (button) | 1972 | switch (button) |
3152 | { | 1973 | { |
3153 | #ifdef EXIT_RC_BUTTON | ||
3154 | case EXIT_RC_BUTTON: | ||
3155 | #endif | ||
3156 | case EXIT_BUTTON: /* save and exit */ | ||
3157 | cleanup(NULL); | ||
3158 | return PLUGIN_OK; | ||
3159 | |||
3160 | case COUNTER_TOGGLE_BUTTON: /* start/stop counter */ | 1974 | case COUNTER_TOGGLE_BUTTON: /* start/stop counter */ |
3161 | if(settings.general[general_counter]) | 1975 | if(settings.general[general_counter]) |
3162 | { | 1976 | { |
3163 | if(!f2_held) /* Ignore if the counter was reset */ | 1977 | if(!counter_btn_held) /* Ignore if the counter was reset */ |
3164 | { | 1978 | { |
3165 | if(counting) | 1979 | if(counting) |
3166 | { | 1980 | { |
@@ -3173,19 +1987,37 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter) | |||
3173 | start_tick = *rb->current_tick; | 1987 | start_tick = *rb->current_tick; |
3174 | } | 1988 | } |
3175 | } | 1989 | } |
3176 | f2_held = false; | 1990 | counter_btn_held = false; |
3177 | } | 1991 | } |
3178 | break; | 1992 | break; |
3179 | 1993 | ||
3180 | case COUNTER_RESET_BUTTON: /* reset counter */ | 1994 | case COUNTER_RESET_BUTTON: /* reset counter */ |
3181 | if(settings.general[general_counter]) | 1995 | if(settings.general[general_counter]) |
3182 | { | 1996 | { |
3183 | f2_held = true; /* Ignore the release event */ | 1997 | counter_btn_held = true; /* Ignore the release event */ |
3184 | counter = 0; | 1998 | counter = 0; |
3185 | start_tick = *rb->current_tick; | 1999 | start_tick = *rb->current_tick; |
3186 | } | 2000 | } |
3187 | break; | 2001 | break; |
3188 | 2002 | ||
2003 | case MODE_NEXT_BUTTON: | ||
2004 | if(settings.clock < CLOCK_MODES) | ||
2005 | settings.clock++; | ||
2006 | else | ||
2007 | settings.clock = 1; | ||
2008 | |||
2009 | set_digital_colors(); | ||
2010 | break; | ||
2011 | |||
2012 | case MODE_PREV_BUTTON: | ||
2013 | if(settings.clock > 1) | ||
2014 | settings.clock--; | ||
2015 | else | ||
2016 | settings.clock = CLOCK_MODES; | ||
2017 | |||
2018 | set_digital_colors(); | ||
2019 | break; | ||
2020 | |||
3189 | case MENU_BUTTON: /* main menu */ | 2021 | case MENU_BUTTON: /* main menu */ |
3190 | #ifdef ALT_MENU_BUTTON | 2022 | #ifdef ALT_MENU_BUTTON |
3191 | case ALT_MENU_BUTTON: | 2023 | case ALT_MENU_BUTTON: |
@@ -3200,4 +2032,7 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter) | |||
3200 | break; | 2032 | break; |
3201 | } | 2033 | } |
3202 | } | 2034 | } |
2035 | |||
2036 | cleanup(NULL); | ||
2037 | return PLUGIN_OK; | ||
3203 | } | 2038 | } |