diff options
| author | Jonathan Gordon <rockbox@jdgordon.info> | 2008-05-03 12:30:40 +0000 |
|---|---|---|
| committer | Jonathan Gordon <rockbox@jdgordon.info> | 2008-05-03 12:30:40 +0000 |
| commit | ea664e06476cb572bab2eadbb9c060902a95a34a (patch) | |
| tree | e76c631343fcc744a24f7f244bf3d3bb73c8192c /apps/gui/option_select.c | |
| parent | 6be91cdc8b90184cf6ee623358222c1268f31c25 (diff) | |
| download | rockbox-ea664e06476cb572bab2eadbb9c060902a95a34a.zip rockbox-ea664e06476cb572bab2eadbb9c060902a95a34a.tar.gz rockbox-ea664e06476cb572bab2eadbb9c060902a95a34a.tar.bz2 rockbox-ea664e06476cb572bab2eadbb9c060902a95a34a.tar.xz | |
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.c | 104 |
1 files changed, 53 insertions, 51 deletions
diff --git a/apps/gui/option_select.c b/apps/gui/option_select.c index c6136eb..43b5fa6 100644 --- a/apps/gui/option_select.c +++ b/apps/gui/option_select.c @@ -60,7 +60,7 @@ static const char *unit_strings[] = /* these two vars are needed so arbitrary values can be added to the TABLE_SETTING settings if the F_ALLOW_ARBITRARY_VALS flag is set */ static int table_setting_oldval = 0, table_setting_array_position = 0; -static char *option_get_valuestring(struct settings_list *setting, +char *option_get_valuestring(struct settings_list *setting, char *buffer, int buf_len, intptr_t temp_var) { @@ -210,56 +210,37 @@ static int option_talk(int selected_item, void * data) } return 0; } -#if 0 -int option_select_next_val(struct settings_list *setting, - intptr_t temp_var) -{ - int val = 0; - if ((setting->flags & F_BOOL_SETTING) == F_BOOL_SETTING) - { - val = (bool)temp_var ? 0 : 1; - } - else if ((setting->flags & F_INT_SETTING) == F_INT_SETTING) - { - struct int_setting *info = setting->int_setting; - val = (int)temp_var + info->step; - if (val > info->max) - val = info->min; - } - else if ((setting->flags & F_T_SOUND) == F_T_SOUND) - { - int setting_id = setting->sound_setting->setting; - int steps = sound_steps(setting_id); - int min = sound_min(setting_id); - int max = sound_max(setting_id); - val = (int)temp_var + steps; - if (val > max) - val = min; - } - else if ((setting->flags & F_CHOICE_SETTING) == F_CHOICE_SETTING) - { - struct choice_setting *info = setting->choice_setting; - val = (int)temp_var; - if (val > info->count) - val = 0; - } - return val; -} -int option_select_prev_val(struct settings_list *setting, - intptr_t temp_var) +#ifdef HAVE_QUICKSCREEN /* only the quickscreen uses this so far */ +void option_select_next_val(struct settings_list *setting, + bool previous, bool apply) { int val = 0; + int *value = setting->setting; if ((setting->flags & F_BOOL_SETTING) == F_BOOL_SETTING) { - val = (bool)temp_var ? 0 : 1; + *(bool*)value = !*(bool*)value; + if (apply && setting->bool_setting->option_callback) + setting->bool_setting->option_callback(*(bool*)value); + return; } else if ((setting->flags & F_INT_SETTING) == F_INT_SETTING) { - struct int_setting *info = setting->int_setting; - val = (int)temp_var - info->step; - if (val < info->min) - val = info->max; + struct int_setting *info = (struct int_setting *)setting->int_setting; + if (!previous) + { + val = *value + info->step; + if (val > info->max) + val = info->min; + } + else + { + val = *value - info->step; + if (val < info->min) + val = info->max; + } + if (apply && info->option_callback) + info->option_callback(*(int*)value); } else if ((setting->flags & F_T_SOUND) == F_T_SOUND) { @@ -267,18 +248,39 @@ int option_select_prev_val(struct settings_list *setting, int steps = sound_steps(setting_id); int min = sound_min(setting_id); int max = sound_max(setting_id); - val = (int)temp_var -+ steps; - if (val < min) - val = max; + if (!previous) + { + val = *value + steps; + if (val >= max) + val = min; + } + else + { + val = *value - steps; + if (val < min) + val = max; + } } else if ((setting->flags & F_CHOICE_SETTING) == F_CHOICE_SETTING) { - struct choice_setting *info = setting->choice_setting; - val = (int)temp_var; - if (val < 0) - val = info->count - 1; + struct choice_setting *info = (struct choice_setting *)setting->choice_setting; + val = *value + 1; + if (!previous) + { + val = *value + 1; + if (val >= info->count) + val = 0; + } + else + { + val = *value - 1; + if (val < 0) + val = info->count-1; + } + if (apply && info->option_callback) + info->option_callback(*(int*)value); } - return val; + *value = val; } #endif |