From 22933cc19cdbaf61a037caae4d69699a5b0dc4c2 Mon Sep 17 00:00:00 2001 From: Jeffrey Goode Date: Sat, 3 Oct 2009 12:56:16 +0000 Subject: FS#10636: Quickscreen incorrect operation when menu has negative step git-svn-id: svn://svn.rockbox.org/rockbox/trunk@22887 a1c6a512-1295-4272-9138-f99709370657 --- apps/gui/option_select.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/apps/gui/option_select.c b/apps/gui/option_select.c index d806a0aa08..97c2b75d1b 100644 --- a/apps/gui/option_select.c +++ b/apps/gui/option_select.c @@ -240,21 +240,20 @@ void option_select_next_val(const struct settings_list *setting, else if ((setting->flags & F_INT_SETTING) == F_INT_SETTING) { struct int_setting *info = (struct int_setting *)setting->int_setting; - int step = info->step; - if (step < 0) - step = -step; + bool neg_step = (info->step < 0); if (!previous) { - val = *value + step; - if (val > info->max) + val = *value + info->step; + if (neg_step ? (val < info->max) : (val > info->max)) val = info->min; } else { - val = *value - step; - if (val < info->min) + val = *value - info->step; + if (neg_step ? (val > info->min) : (val < info->min)) val = info->max; } + *value = val; if (apply && info->option_callback) info->option_callback(val); } @@ -276,6 +275,7 @@ void option_select_next_val(const struct settings_list *setting, if (val < min) val = max; } + *value = val; } else if ((setting->flags & F_CHOICE_SETTING) == F_CHOICE_SETTING) { @@ -293,6 +293,7 @@ void option_select_next_val(const struct settings_list *setting, if (val < 0) val = info->count-1; } + *value = val; if (apply && info->option_callback) info->option_callback(val); } @@ -311,8 +312,8 @@ void option_select_next_val(const struct settings_list *setting, break; } } + *value = val; } - *value = val; } #endif -- cgit v1.2.3