1
0
Fork 0
forked from len0rd/rockbox

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
This commit is contained in:
Jeffrey Goode 2009-10-03 12:56:16 +00:00
parent e7df285a85
commit 22933cc19c

View file

@ -240,21 +240,20 @@ void option_select_next_val(const struct settings_list *setting,
else if ((setting->flags & F_INT_SETTING) == F_INT_SETTING) else if ((setting->flags & F_INT_SETTING) == F_INT_SETTING)
{ {
struct int_setting *info = (struct int_setting *)setting->int_setting; struct int_setting *info = (struct int_setting *)setting->int_setting;
int step = info->step; bool neg_step = (info->step < 0);
if (step < 0)
step = -step;
if (!previous) if (!previous)
{ {
val = *value + step; val = *value + info->step;
if (val > info->max) if (neg_step ? (val < info->max) : (val > info->max))
val = info->min; val = info->min;
} }
else else
{ {
val = *value - step; val = *value - info->step;
if (val < info->min) if (neg_step ? (val > info->min) : (val < info->min))
val = info->max; val = info->max;
} }
*value = val;
if (apply && info->option_callback) if (apply && info->option_callback)
info->option_callback(val); info->option_callback(val);
} }
@ -276,6 +275,7 @@ void option_select_next_val(const struct settings_list *setting,
if (val < min) if (val < min)
val = max; val = max;
} }
*value = val;
} }
else if ((setting->flags & F_CHOICE_SETTING) == F_CHOICE_SETTING) 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) if (val < 0)
val = info->count-1; val = info->count-1;
} }
*value = val;
if (apply && info->option_callback) if (apply && info->option_callback)
info->option_callback(val); info->option_callback(val);
} }
@ -311,8 +312,8 @@ void option_select_next_val(const struct settings_list *setting,
break; break;
} }
} }
*value = val;
} }
*value = val;
} }
#endif #endif