summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeffrey Goode <jeffg7@gmail.com>2009-10-03 12:56:16 +0000
committerJeffrey Goode <jeffg7@gmail.com>2009-10-03 12:56:16 +0000
commit22933cc19cdbaf61a037caae4d69699a5b0dc4c2 (patch)
tree1517bf6a9a84f70017e1d746149833a9a0ae0879
parente7df285a85ea0cf5ba42830d4017b29f9c0b1d73 (diff)
downloadrockbox-22933cc19cdbaf61a037caae4d69699a5b0dc4c2.tar.gz
rockbox-22933cc19cdbaf61a037caae4d69699a5b0dc4c2.zip
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
-rw-r--r--apps/gui/option_select.c17
1 files 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,
240 else if ((setting->flags & F_INT_SETTING) == F_INT_SETTING) 240 else if ((setting->flags & F_INT_SETTING) == F_INT_SETTING)
241 { 241 {
242 struct int_setting *info = (struct int_setting *)setting->int_setting; 242 struct int_setting *info = (struct int_setting *)setting->int_setting;
243 int step = info->step; 243 bool neg_step = (info->step < 0);
244 if (step < 0)
245 step = -step;
246 if (!previous) 244 if (!previous)
247 { 245 {
248 val = *value + step; 246 val = *value + info->step;
249 if (val > info->max) 247 if (neg_step ? (val < info->max) : (val > info->max))
250 val = info->min; 248 val = info->min;
251 } 249 }
252 else 250 else
253 { 251 {
254 val = *value - step; 252 val = *value - info->step;
255 if (val < info->min) 253 if (neg_step ? (val > info->min) : (val < info->min))
256 val = info->max; 254 val = info->max;
257 } 255 }
256 *value = val;
258 if (apply && info->option_callback) 257 if (apply && info->option_callback)
259 info->option_callback(val); 258 info->option_callback(val);
260 } 259 }
@@ -276,6 +275,7 @@ void option_select_next_val(const struct settings_list *setting,
276 if (val < min) 275 if (val < min)
277 val = max; 276 val = max;
278 } 277 }
278 *value = val;
279 } 279 }
280 else if ((setting->flags & F_CHOICE_SETTING) == F_CHOICE_SETTING) 280 else if ((setting->flags & F_CHOICE_SETTING) == F_CHOICE_SETTING)
281 { 281 {
@@ -293,6 +293,7 @@ void option_select_next_val(const struct settings_list *setting,
293 if (val < 0) 293 if (val < 0)
294 val = info->count-1; 294 val = info->count-1;
295 } 295 }
296 *value = val;
296 if (apply && info->option_callback) 297 if (apply && info->option_callback)
297 info->option_callback(val); 298 info->option_callback(val);
298 } 299 }
@@ -311,8 +312,8 @@ void option_select_next_val(const struct settings_list *setting,
311 break; 312 break;
312 } 313 }
313 } 314 }
315 *value = val;
314 } 316 }
315 *value = val;
316} 317}
317#endif 318#endif
318 319