summaryrefslogtreecommitdiff
path: root/apps/settings_menu.c
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2002-08-23 12:32:52 +0000
committerDaniel Stenberg <daniel@haxx.se>2002-08-23 12:32:52 +0000
commitb285076925fed906d95573b64115cb3f6bdafe65 (patch)
tree6d959f585fc210acf39e667991038d21aef48d13 /apps/settings_menu.c
parentad4a92eb87eb98ff316f54f06650f1c5e1dcd7ca (diff)
downloadrockbox-b285076925fed906d95573b64115cb3f6bdafe65.tar.gz
rockbox-b285076925fed906d95573b64115cb3f6bdafe65.zip
Remade the menu system slightly. All functions invoked from menus now use
the Menu typedef as return type, and *ALL* menus that intercept USB connect can then return MENU_REFRESH_DIR so that the parent (any parent really) that do file or dir-accesses knows that and can do the refresh. If no refresh is needed by the parent, MENU_OK is returned. Somewhat biggish commit this close to 1.3, but we need to sort out this refresh-after-usb-connected business. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@1948 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/settings_menu.c')
-rw-r--r--apps/settings_menu.c45
1 files changed, 30 insertions, 15 deletions
diff --git a/apps/settings_menu.c b/apps/settings_menu.c
index 0d88edfff4..2bb4ef4481 100644
--- a/apps/settings_menu.c
+++ b/apps/settings_menu.c
@@ -36,39 +36,45 @@
36#include "powermgmt.h" 36#include "powermgmt.h"
37#include "rtc.h" 37#include "rtc.h"
38 38
39static void show_hidden_files(void) 39static Menu show_hidden_files(void)
40{ 40{
41 set_bool( "[Show hidden files]", &global_settings.show_hidden_files ); 41 set_bool( "[Show hidden files]", &global_settings.show_hidden_files );
42 return MENU_OK;
42} 43}
43 44
44static void contrast(void) 45static Menu contrast(void)
45{ 46{
46 set_int( "[Contrast]", "", &global_settings.contrast, 47 set_int( "[Contrast]", "", &global_settings.contrast,
47 lcd_set_contrast, 1, 0, MAX_CONTRAST_SETTING ); 48 lcd_set_contrast, 1, 0, MAX_CONTRAST_SETTING );
49 return MENU_OK;
48} 50}
49 51
50static void shuffle(void) 52static Menu shuffle(void)
51{ 53{
52 set_bool( "[Shuffle]", &global_settings.playlist_shuffle ); 54 set_bool( "[Shuffle]", &global_settings.playlist_shuffle );
55 return MENU_OK;
53} 56}
54 57
55static void mp3_filter(void) 58static Menu mp3_filter(void)
56{ 59{
57 set_bool( "[MP3/M3U filter]", &global_settings.mp3filter ); 60 set_bool( "[MP3/M3U filter]", &global_settings.mp3filter );
61 return MENU_OK;
58} 62}
59 63
60static void sort_case(void) 64static Menu sort_case(void)
61{ 65{
62 set_bool( "[Sort case sensitive]", &global_settings.sort_case ); 66 set_bool( "[Sort case sensitive]", &global_settings.sort_case );
67 return MENU_OK;
63} 68}
64 69
65static void resume(void) 70static Menu resume(void)
66{ 71{
67 char* names[] = { "off", "ask", "on " }; 72 char* names[] = { "off", "ask", "on " };
68 set_option( "[Resume]", &global_settings.resume, names, 3 ); 73 set_option( "[Resume]", &global_settings.resume, names, 3 );
74 return MENU_OK;
69} 75}
70 76
71static void backlight_timer(void) 77static Menu backlight_timer(void)
72{ 78{
73 char* names[] = { "off", "on ", 79 char* names[] = { "off", "on ",
74 "1s ", "2s ", "3s ", "4s ", "5s ", 80 "1s ", "2s ", "3s ", "4s ", "5s ",
@@ -77,15 +83,17 @@ static void backlight_timer(void)
77 "60s", "90s"}; 83 "60s", "90s"};
78 set_option("[Backlight]", &global_settings.backlight, names, 19 ); 84 set_option("[Backlight]", &global_settings.backlight, names, 19 );
79 backlight_time(global_settings.backlight); 85 backlight_time(global_settings.backlight);
86 return MENU_OK;
80} 87}
81 88
82static void scroll_speed(void) 89static Menu scroll_speed(void)
83{ 90{
84 set_int("Scroll speed indicator...", "", &global_settings.scroll_speed, 91 set_int("Scroll speed indicator...", "", &global_settings.scroll_speed,
85 &lcd_scroll_speed, 1, 1, 20 ); 92 &lcd_scroll_speed, 1, 1, 20 );
93 return MENU_OK;
86} 94}
87 95
88static void wps_set(void) 96static Menu wps_set(void)
89{ 97{
90#ifdef HAVE_LCD_BITMAP 98#ifdef HAVE_LCD_BITMAP
91 char* names[] = { "ID3 Tags", "File ", "Parse " }; 99 char* names[] = { "ID3 Tags", "File ", "Parse " };
@@ -102,18 +110,20 @@ static void wps_set(void)
102#endif 110#endif
103 111
104#endif 112#endif
113 return MENU_OK;
105} 114}
106 115
107#ifdef HAVE_CHARGE_CTRL 116#ifdef HAVE_CHARGE_CTRL
108static void deep_discharge(void) 117static Menu deep_discharge(void)
109{ 118{
110 set_bool( "[Deep discharge]", &global_settings.discharge ); 119 set_bool( "[Deep discharge]", &global_settings.discharge );
111 charge_restart_level = global_settings.discharge ? CHARGE_RESTART_LO : CHARGE_RESTART_HI; 120 charge_restart_level = global_settings.discharge ? CHARGE_RESTART_LO : CHARGE_RESTART_HI;
121 return MENU_OK;
112} 122}
113#endif 123#endif
114 124
115#ifdef HAVE_RTC 125#ifdef HAVE_RTC
116static void timedate_set(void) 126static Menu timedate_set(void)
117{ 127{
118 int timedate[7]; /* hour,minute,second,year,month,day,dayofweek */ 128 int timedate[7]; /* hour,minute,second,year,month,day,dayofweek */
119 129
@@ -150,24 +160,28 @@ static void timedate_set(void)
150 rtc_write(0x04, timedate[6] | (rtc_read(0x04) & 0xf8)); /* dayofweek */ 160 rtc_write(0x04, timedate[6] | (rtc_read(0x04) & 0xf8)); /* dayofweek */
151 rtc_write(0x00, 0x00); /* 0.1 + 0.01 seconds */ 161 rtc_write(0x00, 0x00); /* 0.1 + 0.01 seconds */
152 } 162 }
163 return MENU_OK;
153} 164}
154#endif 165#endif
155 166
156static void ff_rewind(void) 167static Menu ff_rewind(void)
157{ 168{
158 set_int("[FF/Rewind Step Size]", "s", &global_settings.ff_rewind, 169 set_int("[FF/Rewind Step Size]", "s", &global_settings.ff_rewind,
159 NULL, 1, 1, 999 ); 170 NULL, 1, 1, 999 );
171 return MENU_OK;
160} 172}
161 173
162void settings_menu(void) 174Menu settings_menu(void)
163{ 175{
164 int m; 176 int m;
177 Menu result;
178
165 struct menu_items items[] = { 179 struct menu_items items[] = {
166 { "Shuffle", shuffle }, 180 { "Shuffle", shuffle },
167 { "MP3/M3U filter", mp3_filter }, 181 { "MP3/M3U filter", mp3_filter },
168 { "Sort mode", sort_case }, 182 { "Sort mode", sort_case },
169 { "Backlight Timer", backlight_timer }, 183 { "Backlight Timer", backlight_timer },
170 { "Contrast", contrast }, 184 { "Contrast", contrast },
171 { "Scroll speed", scroll_speed }, 185 { "Scroll speed", scroll_speed },
172 { "While Playing", wps_set }, 186 { "While Playing", wps_set },
173#ifdef HAVE_CHARGE_CTRL 187#ifdef HAVE_CHARGE_CTRL
@@ -183,7 +197,7 @@ void settings_menu(void)
183 bool old_shuffle = global_settings.playlist_shuffle; 197 bool old_shuffle = global_settings.playlist_shuffle;
184 198
185 m=menu_init( items, sizeof items / sizeof(struct menu_items) ); 199 m=menu_init( items, sizeof items / sizeof(struct menu_items) );
186 menu_run(m); 200 result = menu_run(m);
187 menu_exit(m); 201 menu_exit(m);
188 202
189 if (old_shuffle != global_settings.playlist_shuffle) 203 if (old_shuffle != global_settings.playlist_shuffle)
@@ -197,4 +211,5 @@ void settings_menu(void)
197 sort_playlist(); 211 sort_playlist();
198 } 212 }
199 } 213 }
214 return result;
200} 215}