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