diff options
-rw-r--r-- | apps/gui/option_select.c | 51 | ||||
-rw-r--r-- | apps/gui/option_select.h | 42 |
2 files changed, 0 insertions, 93 deletions
diff --git a/apps/gui/option_select.c b/apps/gui/option_select.c index 43b5fa6ea1..288bf9098b 100644 --- a/apps/gui/option_select.c +++ b/apps/gui/option_select.c | |||
@@ -554,54 +554,3 @@ bool option_screen(struct settings_list *setting, | |||
554 | 554 | ||
555 | return false; | 555 | return false; |
556 | } | 556 | } |
557 | |||
558 | |||
559 | /* to be replaced */ | ||
560 | void option_select_init_items(struct option_select * opt, | ||
561 | const char * title, | ||
562 | int selected, | ||
563 | const struct opt_items * items, | ||
564 | int nb_items) | ||
565 | { | ||
566 | opt->title=title; | ||
567 | opt->min_value=0; | ||
568 | opt->max_value=nb_items; | ||
569 | opt->option=selected; | ||
570 | opt->items=items; | ||
571 | } | ||
572 | |||
573 | void option_select_next(struct option_select * opt) | ||
574 | { | ||
575 | if(opt->option + 1 >= opt->max_value) | ||
576 | { | ||
577 | if(opt->option==opt->max_value-1) | ||
578 | opt->option=opt->min_value; | ||
579 | else | ||
580 | opt->option=opt->max_value-1; | ||
581 | } | ||
582 | else | ||
583 | opt->option+=1; | ||
584 | } | ||
585 | |||
586 | void option_select_prev(struct option_select * opt) | ||
587 | { | ||
588 | if(opt->option - 1 < opt->min_value) | ||
589 | { | ||
590 | /* the dissimilarity to option_select_next() arises from the | ||
591 | * sleep timer problem (bug #5000 and #5001): | ||
592 | * there we have min=0, step = 5 but the value itself might | ||
593 | * not be a multiple of 5 -- as time elapsed; | ||
594 | * We need to be able to set timer to 0 (= Off) nevertheless. */ | ||
595 | if(opt->option!=opt->min_value) | ||
596 | opt->option=opt->min_value; | ||
597 | else | ||
598 | opt->option=opt->max_value-1; | ||
599 | } | ||
600 | else | ||
601 | opt->option-=1; | ||
602 | } | ||
603 | |||
604 | const char * option_select_get_text(struct option_select * opt) | ||
605 | { | ||
606 | return(P2STR(opt->items[opt->option].string)); | ||
607 | } | ||
diff --git a/apps/gui/option_select.h b/apps/gui/option_select.h index 8b43af1e5a..7c9af4409b 100644 --- a/apps/gui/option_select.h +++ b/apps/gui/option_select.h | |||
@@ -27,48 +27,6 @@ bool option_screen(struct settings_list *setting, | |||
27 | struct viewport parent[NB_SCREENS], | 27 | struct viewport parent[NB_SCREENS], |
28 | bool use_temp_var, unsigned char* option_title); | 28 | bool use_temp_var, unsigned char* option_title); |
29 | 29 | ||
30 | struct option_select | ||
31 | { | ||
32 | const char * title; | ||
33 | int min_value; | ||
34 | int max_value; | ||
35 | int option; | ||
36 | const struct opt_items * items; | ||
37 | }; | ||
38 | |||
39 | /* | ||
40 | * Initializes an option containing a list of choices | ||
41 | * - title : the title of the option | ||
42 | * - selected : the initially selected item | ||
43 | * - items : the list of items, defined in settings.h | ||
44 | * - nb_items : the number of items in the 'items' list | ||
45 | */ | ||
46 | extern void option_select_init_items(struct option_select * opt, | ||
47 | const char * title, | ||
48 | int selected, | ||
49 | const struct opt_items * items, | ||
50 | int nb_items); | ||
51 | |||
52 | /* | ||
53 | * Gets the selected option | ||
54 | * - opt : the option struct | ||
55 | * Returns the selected option | ||
56 | */ | ||
57 | extern const char * option_select_get_text(struct option_select * opt); | ||
58 | |||
59 | /* | ||
60 | * Selects the next value | ||
61 | * - opt : the option struct | ||
62 | */ | ||
63 | extern void option_select_next(struct option_select * opt); | ||
64 | |||
65 | /* | ||
66 | * Selects the previous value | ||
67 | * - opt : the option struct | ||
68 | */ | ||
69 | extern void option_select_prev(struct option_select * opt); | ||
70 | |||
71 | |||
72 | 30 | ||
73 | void option_select_next_val(struct settings_list *setting, | 31 | void option_select_next_val(struct settings_list *setting, |
74 | bool previous, bool apply); | 32 | bool previous, bool apply); |