summaryrefslogtreecommitdiff
path: root/apps/gui/option_select.c
diff options
context:
space:
mode:
authorJonathan Gordon <rockbox@jdgordon.info>2008-05-03 12:30:40 +0000
committerJonathan Gordon <rockbox@jdgordon.info>2008-05-03 12:30:40 +0000
commitea664e06476cb572bab2eadbb9c060902a95a34a (patch)
treee76c631343fcc744a24f7f244bf3d3bb73c8192c /apps/gui/option_select.c
parent6be91cdc8b90184cf6ee623358222c1268f31c25 (diff)
downloadrockbox-ea664e06476cb572bab2eadbb9c060902a95a34a.tar.gz
rockbox-ea664e06476cb572bab2eadbb9c060902a95a34a.zip
Viewported quickscreen (take 2 :D) (FS#8553)
- no customization support - no top item - much better use of the screen - deprecates 20 odd lang strings (the QS can now use the regular lang strings and user font) git-svn-id: svn://svn.rockbox.org/rockbox/trunk@17315 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/gui/option_select.c')
-rw-r--r--apps/gui/option_select.c104
1 files changed, 53 insertions, 51 deletions
diff --git a/apps/gui/option_select.c b/apps/gui/option_select.c
index c6136ebf17..43b5fa6ea1 100644
--- a/apps/gui/option_select.c
+++ b/apps/gui/option_select.c
@@ -60,7 +60,7 @@ static const char *unit_strings[] =
60/* these two vars are needed so arbitrary values can be added to the 60/* these two vars are needed so arbitrary values can be added to the
61 TABLE_SETTING settings if the F_ALLOW_ARBITRARY_VALS flag is set */ 61 TABLE_SETTING settings if the F_ALLOW_ARBITRARY_VALS flag is set */
62static int table_setting_oldval = 0, table_setting_array_position = 0; 62static int table_setting_oldval = 0, table_setting_array_position = 0;
63static char *option_get_valuestring(struct settings_list *setting, 63char *option_get_valuestring(struct settings_list *setting,
64 char *buffer, int buf_len, 64 char *buffer, int buf_len,
65 intptr_t temp_var) 65 intptr_t temp_var)
66{ 66{
@@ -210,56 +210,37 @@ static int option_talk(int selected_item, void * data)
210 } 210 }
211 return 0; 211 return 0;
212} 212}
213#if 0
214int option_select_next_val(struct settings_list *setting,
215 intptr_t temp_var)
216{
217 int val = 0;
218 if ((setting->flags & F_BOOL_SETTING) == F_BOOL_SETTING)
219 {
220 val = (bool)temp_var ? 0 : 1;
221 }
222 else if ((setting->flags & F_INT_SETTING) == F_INT_SETTING)
223 {
224 struct int_setting *info = setting->int_setting;
225 val = (int)temp_var + info->step;
226 if (val > info->max)
227 val = info->min;
228 }
229 else if ((setting->flags & F_T_SOUND) == F_T_SOUND)
230 {
231 int setting_id = setting->sound_setting->setting;
232 int steps = sound_steps(setting_id);
233 int min = sound_min(setting_id);
234 int max = sound_max(setting_id);
235 val = (int)temp_var + steps;
236 if (val > max)
237 val = min;
238 }
239 else if ((setting->flags & F_CHOICE_SETTING) == F_CHOICE_SETTING)
240 {
241 struct choice_setting *info = setting->choice_setting;
242 val = (int)temp_var;
243 if (val > info->count)
244 val = 0;
245 }
246 return val;
247}
248 213
249int option_select_prev_val(struct settings_list *setting, 214#ifdef HAVE_QUICKSCREEN /* only the quickscreen uses this so far */
250 intptr_t temp_var) 215void option_select_next_val(struct settings_list *setting,
216 bool previous, bool apply)
251{ 217{
252 int val = 0; 218 int val = 0;
219 int *value = setting->setting;
253 if ((setting->flags & F_BOOL_SETTING) == F_BOOL_SETTING) 220 if ((setting->flags & F_BOOL_SETTING) == F_BOOL_SETTING)
254 { 221 {
255 val = (bool)temp_var ? 0 : 1; 222 *(bool*)value = !*(bool*)value;
223 if (apply && setting->bool_setting->option_callback)
224 setting->bool_setting->option_callback(*(bool*)value);
225 return;
256 } 226 }
257 else if ((setting->flags & F_INT_SETTING) == F_INT_SETTING) 227 else if ((setting->flags & F_INT_SETTING) == F_INT_SETTING)
258 { 228 {
259 struct int_setting *info = setting->int_setting; 229 struct int_setting *info = (struct int_setting *)setting->int_setting;
260 val = (int)temp_var - info->step; 230 if (!previous)
261 if (val < info->min) 231 {
262 val = info->max; 232 val = *value + info->step;
233 if (val > info->max)
234 val = info->min;
235 }
236 else
237 {
238 val = *value - info->step;
239 if (val < info->min)
240 val = info->max;
241 }
242 if (apply && info->option_callback)
243 info->option_callback(*(int*)value);
263 } 244 }
264 else if ((setting->flags & F_T_SOUND) == F_T_SOUND) 245 else if ((setting->flags & F_T_SOUND) == F_T_SOUND)
265 { 246 {
@@ -267,18 +248,39 @@ int option_select_prev_val(struct settings_list *setting,
267 int steps = sound_steps(setting_id); 248 int steps = sound_steps(setting_id);
268 int min = sound_min(setting_id); 249 int min = sound_min(setting_id);
269 int max = sound_max(setting_id); 250 int max = sound_max(setting_id);
270 val = (int)temp_var -+ steps; 251 if (!previous)
271 if (val < min) 252 {
272 val = max; 253 val = *value + steps;
254 if (val >= max)
255 val = min;
256 }
257 else
258 {
259 val = *value - steps;
260 if (val < min)
261 val = max;
262 }
273 } 263 }
274 else if ((setting->flags & F_CHOICE_SETTING) == F_CHOICE_SETTING) 264 else if ((setting->flags & F_CHOICE_SETTING) == F_CHOICE_SETTING)
275 { 265 {
276 struct choice_setting *info = setting->choice_setting; 266 struct choice_setting *info = (struct choice_setting *)setting->choice_setting;
277 val = (int)temp_var; 267 val = *value + 1;
278 if (val < 0) 268 if (!previous)
279 val = info->count - 1; 269 {
270 val = *value + 1;
271 if (val >= info->count)
272 val = 0;
273 }
274 else
275 {
276 val = *value - 1;
277 if (val < 0)
278 val = info->count-1;
279 }
280 if (apply && info->option_callback)
281 info->option_callback(*(int*)value);
280 } 282 }
281 return val; 283 *value = val;
282} 284}
283#endif 285#endif
284 286