summaryrefslogtreecommitdiff
path: root/apps/gui/option_select.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/gui/option_select.c')
-rw-r--r--apps/gui/option_select.c24
1 files changed, 16 insertions, 8 deletions
diff --git a/apps/gui/option_select.c b/apps/gui/option_select.c
index 1ce7fd5026..65f2a0491d 100644
--- a/apps/gui/option_select.c
+++ b/apps/gui/option_select.c
@@ -219,10 +219,15 @@ static int option_talk(int selected_item, void * data)
219void option_select_next_val(const struct settings_list *setting, 219void option_select_next_val(const struct settings_list *setting,
220 bool previous, bool apply) 220 bool previous, bool apply)
221{ 221{
222 bool repeated = get_action_statuscode(NULL) & ACTION_REPEAT;
223
222 int val = 0; 224 int val = 0;
223 int *value = setting->setting; 225 int *value = setting->setting;
224 if (HASFLAG(setting, F_BOOL_SETTING)) 226 if (HASFLAG(setting, F_BOOL_SETTING))
225 { 227 {
228 if (repeated)
229 return;
230
226 *(bool*)value = !*(bool*)value; 231 *(bool*)value = !*(bool*)value;
227 if (apply && setting->bool_setting->option_callback) 232 if (apply && setting->bool_setting->option_callback)
228 setting->bool_setting->option_callback(*(bool*)value); 233 setting->bool_setting->option_callback(*(bool*)value);
@@ -236,13 +241,13 @@ void option_select_next_val(const struct settings_list *setting,
236 { 241 {
237 val = *value + info->step; 242 val = *value + info->step;
238 if (neg_step ? (val < info->max) : (val > info->max)) 243 if (neg_step ? (val < info->max) : (val > info->max))
239 val = info->min; 244 val = repeated ? *value : info->min;
240 } 245 }
241 else 246 else
242 { 247 {
243 val = *value - info->step; 248 val = *value - info->step;
244 if (neg_step ? (val > info->min) : (val < info->min)) 249 if (neg_step ? (val > info->min) : (val < info->min))
245 val = info->max; 250 val = repeated ? *value : info->max;
246 } 251 }
247 *value = val; 252 *value = val;
248 if (apply && info->option_callback) 253 if (apply && info->option_callback)
@@ -258,13 +263,13 @@ void option_select_next_val(const struct settings_list *setting,
258 { 263 {
259 val = *value + steps; 264 val = *value + steps;
260 if (val >= max) 265 if (val >= max)
261 val = min; 266 val = repeated ? *value : min;
262 } 267 }
263 else 268 else
264 { 269 {
265 val = *value - steps; 270 val = *value - steps;
266 if (val < min) 271 if (val < min)
267 val = max; 272 val = repeated ? *value : max;
268 } 273 }
269 *value = val; 274 *value = val;
270 if (apply) 275 if (apply)
@@ -277,13 +282,13 @@ void option_select_next_val(const struct settings_list *setting,
277 { 282 {
278 val = *value + 1; 283 val = *value + 1;
279 if (val >= info->count) 284 if (val >= info->count)
280 val = 0; 285 val = repeated ? *value : 0;
281 } 286 }
282 else 287 else
283 { 288 {
284 val = *value - 1; 289 val = *value - 1;
285 if (val < 0) 290 if (val < 0)
286 val = info->count-1; 291 val = repeated ? *value : info->count-1;
287 } 292 }
288 *value = val; 293 *value = val;
289 if (apply && info->option_callback) 294 if (apply && info->option_callback)
@@ -300,7 +305,11 @@ void option_select_next_val(const struct settings_list *setting,
300 (settings->flags&F_ALLOW_ARBITRARY_VALS && 305 (settings->flags&F_ALLOW_ARBITRARY_VALS &&
301 *value < tbl_info->values[i])) 306 *value < tbl_info->values[i]))
302 { 307 {
303 val = tbl_info->values[(i+add)%tbl_info->count]; 308 int index = (i+add)%tbl_info->count;
309 if (repeated && ((i == 0 && previous) || (!previous && i == tbl_info->count -1)))
310 val = *value;
311 else
312 val = tbl_info->values[index];
304 break; 313 break;
305 } 314 }
306 } 315 }
@@ -504,7 +513,6 @@ bool option_screen(const struct settings_list *setting,
504 title = P2STR(option_title); 513 title = P2STR(option_title);
505 514
506 gui_synclist_set_title(&lists, title, Icon_Questionmark); 515 gui_synclist_set_title(&lists, title, Icon_Questionmark);
507 gui_synclist_set_icon_callback(&lists, NULL);
508 if(global_settings.talk_menu) 516 if(global_settings.talk_menu)
509 gui_synclist_set_voice_callback(&lists, option_talk); 517 gui_synclist_set_voice_callback(&lists, option_talk);
510 518