1 /***************************************************************************
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
10 * Copyright (C) 2003 Zakk Roberts
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
20 ****************************************************************************/
23 #include "clock_bitmaps.h"
24 #include "clock_settings.h"
25 #include "lib/playback_control.h"
27 /* Option structs (possible selections per each option) */
28 static const struct opt_items noyes_text
[] = {
33 static const struct opt_items backlight_settings_text
[] = {
35 { "Use Rockbox Setting", -1 },
39 static const struct opt_items idle_poweroff_text
[] = {
44 static const struct opt_items date_format_text
[] = {
47 { "European (D-M-Y)", -1 },
48 { "Japanese (Y-M-D)", -1 },
51 static const struct opt_items hour_format_text
[] = {
57 * Select a mode, returs true when the mode has been selected
58 * (we go back to clock display then)
60 bool menu_mode_selector(void){
61 MENUITEM_STRINGLIST(menu
,"Mode Selector",NULL
, "Analog",
63 if(rb
->do_menu(&menu
, &clock_settings
.mode
, NULL
, false) >=0)
68 /**********************
69 * Analog settings menu
70 *********************/
71 void menu_analog_settings(void)
73 int selection
=0, result
=0;
75 MENUITEM_STRINGLIST(menu
,"Analog Mode Settings",NULL
,"Show Date",
76 "Show Second Hand","Show Border");
79 result
=rb
->do_menu(&menu
, &selection
, NULL
, false);
82 rb
->set_option("Show Date", &clock_settings
.analog
.show_date
,
83 BOOL
, noyes_text
, 2, NULL
);
86 rb
->set_option("Show Second Hand",
87 &clock_settings
.analog
.show_seconds
,
88 BOOL
, noyes_text
, 2, NULL
);
91 rb
->set_option("Show Border",
92 &clock_settings
.analog
.show_border
,
93 BOOL
, noyes_text
, 2, NULL
);
99 /***********************
100 * Digital settings menu
101 **********************/
102 void menu_digital_settings(void){
103 int selection
=0, result
=0;
105 MENUITEM_STRINGLIST(menu
,"Digital Mode Settings",NULL
,"Show Seconds",
109 result
=rb
->do_menu(&menu
, &selection
, NULL
, false);
112 rb
->set_option("Show Seconds",
113 &clock_settings
.digital
.show_seconds
,
114 BOOL
, noyes_text
, 2, NULL
);
117 rb
->set_option("Blinking Colon",
118 &clock_settings
.digital
.blinkcolon
,
119 BOOL
, noyes_text
, 2, NULL
);
125 /***********************************************************
126 * Confirm resetting of settings, used in general_settings()
127 **********************************************************/
128 void confirm_reset(void){
131 rb
->set_option("Reset all settings?", &result
, INT
, noyes_text
, 2, NULL
);
133 if(result
== 1){ /* reset! */
134 clock_settings_reset(&clock_settings
);
135 rb
->splash(HZ
, "Settings reset!");
138 rb
->splash(HZ
, "Settings NOT reset.");
141 /************************************
142 * General settings. Reset, save, etc
143 ***********************************/
144 void menu_general_settings(void){
145 int selection
=0, result
=0;
147 MENUITEM_STRINGLIST(menu
,"General Settings",NULL
,
148 "Hour Format","Date Format","Show Counter",
149 "Reset Settings","Save Settings Now",
150 "Save On Exit","Backlight Settings",
151 "Idle Poweroff (temporary)");
154 result
=rb
->do_menu(&menu
, &selection
, NULL
, false);
157 rb
->set_option("Hour format",
158 &clock_settings
.general
.hour_format
,
159 INT
, hour_format_text
, 2, NULL
);
162 rb
->set_option("Date format",
163 &clock_settings
.general
.date_format
,
164 INT
, date_format_text
, 4, NULL
);
167 rb
->set_option("Show Counter", &clock_settings
.general
.show_counter
,
168 BOOL
, noyes_text
, 2, NULL
);
175 save_settings_wo_gui();
176 rb
->splash(HZ
, "Settings saved");
180 rb
->set_option("Save On Exit",
181 &clock_settings
.general
.save_settings
,
182 BOOL
, noyes_text
, 2, NULL
);
184 /* if we no longer save on exit,
185 we better save now to remember that */
186 if(!clock_settings
.general
.save_settings
)
187 save_settings_wo_gui();
190 rb
->set_option("Backlight Settings",
191 &clock_settings
.general
.backlight
,
192 INT
, backlight_settings_text
, 3, NULL
);
193 apply_backlight_setting(clock_settings
.general
.backlight
);
197 rb
->set_option("Idle Poweroff (temporary)",
198 &clock_settings
.general
.idle_poweroff
,
199 BOOL
, idle_poweroff_text
, 2, NULL
);
208 bool main_menu(void){
211 bool exit_clock
=false;
213 MENUITEM_STRINGLIST(menu
,"Clock Menu",NULL
,"View Clock","Mode Selector",
214 "Mode Settings","General Settings","Playback Control",
218 switch(rb
->do_menu(&menu
, &selection
, NULL
, false)){
224 done
=menu_mode_selector();
228 switch(clock_settings
.mode
){
229 case ANALOG
: menu_analog_settings();break;
230 case DIGITAL
: menu_digital_settings();break;
231 case BINARY
: /* no settings */;break;
236 menu_general_settings();
240 playback_control(NULL
);