From c2a77563c253396692b2b380aaeacf33cf2e7768 Mon Sep 17 00:00:00 2001 From: Nils Wallménius Date: Thu, 24 May 2007 19:03:26 +0000 Subject: Remove dead code. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@13488 a1c6a512-1295-4272-9138-f99709370657 --- apps/gui/option_select.c | 46 +++++++--------------------------------------- apps/gui/option_select.h | 33 +-------------------------------- apps/gui/quickscreen.c | 10 +++------- 3 files changed, 11 insertions(+), 78 deletions(-) diff --git a/apps/gui/option_select.c b/apps/gui/option_select.c index 045f5570c4..d4fb225a59 100644 --- a/apps/gui/option_select.c +++ b/apps/gui/option_select.c @@ -22,26 +22,6 @@ #include "kernel.h" #include "lang.h" -void option_select_init_numeric(struct option_select * opt, - const char * title, - int init_value, - int min_value, - int max_value, - int step, - const char * unit, - option_formatter *formatter) -{ - opt->title=title; - opt->min_value=min_value; - opt->max_value=max_value+1; - opt->option=init_value; - opt->step=step; - opt->extra_string=unit; - opt->formatter=formatter; - opt->items=NULL; - opt->limit_loop=true; -} - void option_select_init_items(struct option_select * opt, const char * title, int selected, @@ -52,31 +32,25 @@ void option_select_init_items(struct option_select * opt, opt->min_value=0; opt->max_value=nb_items; opt->option=selected; - opt->step=1; - opt->formatter=NULL; opt->items=items; - opt->limit_loop=false; } void option_select_next(struct option_select * opt) { - if(opt->option + opt->step >= opt->max_value) + if(opt->option + 1 >= opt->max_value) { - if(!opt->limit_loop) - { if(opt->option==opt->max_value-1) opt->option=opt->min_value; else opt->option=opt->max_value-1; - } } else - opt->option+=opt->step; + opt->option+=1; } void option_select_prev(struct option_select * opt) { - if(opt->option - opt->step < opt->min_value) + if(opt->option - 1 < opt->min_value) { /* the dissimilarity to option_select_next() arises from the * sleep timer problem (bug #5000 and #5001): @@ -85,21 +59,15 @@ void option_select_prev(struct option_select * opt) * We need to be able to set timer to 0 (= Off) nevertheless. */ if(opt->option!=opt->min_value) opt->option=opt->min_value; - else if(!opt->limit_loop) + else opt->option=opt->max_value-1; } else - opt->option-=opt->step; + opt->option-=1; } -const char * option_select_get_text(struct option_select * opt, char * buffer, - int buffersize) +const char * option_select_get_text(struct option_select * opt/*, char * buffer, + int buffersize*/) { - if(opt->items) return(P2STR(opt->items[opt->option].string)); - if(!opt->formatter) - snprintf(buffer, buffersize,"%d %s", opt->option, opt->extra_string); - else - opt->formatter(buffer, buffersize, opt->option, opt->extra_string); - return(buffer); } diff --git a/apps/gui/option_select.h b/apps/gui/option_select.h index 6adbe1e720..e2ae31a848 100644 --- a/apps/gui/option_select.h +++ b/apps/gui/option_select.h @@ -21,43 +21,15 @@ #define _GUI_OPTION_SELECT_H_ #include "settings.h" -typedef void option_formatter(char* dest, int dest_length, - int variable, const char* unit); - struct option_select { const char * title; int min_value; int max_value; - int step; int option; - const char * extra_string; - /* In the case the option is a number */ - option_formatter *formatter; const struct opt_items * items; - bool limit_loop; }; -/* - * Initializes an option containing a numeric values - * - title : the title of the option - * - init_value : the initial value the number will be - * - min_value, max_value : bounds to the value - * - step : the ammount you want to add / withdraw to the initial number - * each time a key is pressed - * - unit : the unit in which the value is (ex "s", "bytes", ...) - * - formatter : a callback function that generates a string - * from the number it gets - */ -extern void option_select_init_numeric(struct option_select * opt, - const char * title, - int init_value, - int min_value, - int max_value, - int step, - const char * unit, - option_formatter *formatter); - /* * Initializes an option containing a list of choices * - title : the title of the option @@ -74,12 +46,9 @@ extern void option_select_init_items(struct option_select * opt, /* * Gets the selected option * - opt : the option struct - * - buffer : a buffer to eventually format the option * Returns the selected option */ -extern const char * option_select_get_text(struct option_select * opt, - char * buffer, - int buffersize); +extern const char * option_select_get_text(struct option_select * opt); /* * Selects the next value diff --git a/apps/gui/quickscreen.c b/apps/gui/quickscreen.c index cda6e7aa51..310d48041f 100644 --- a/apps/gui/quickscreen.c +++ b/apps/gui/quickscreen.c @@ -55,7 +55,6 @@ static void gui_quickscreen_draw(struct gui_quickscreen * qs, struct screen * di #define PUTSXY_CENTER (display->height/2) #define PUTSXY_BOTTOM (display->height) - char buffer[30]; const unsigned char *option; const unsigned char *title; int w, font_h; @@ -71,8 +70,7 @@ static void gui_quickscreen_draw(struct gui_quickscreen * qs, struct screen * di display->getstringsize("A", NULL, &font_h); /* Displays the first line of text */ - option=(unsigned char *)option_select_get_text(qs->left_option, buffer, - sizeof buffer); + option=(unsigned char *)option_select_get_text(qs->left_option); title=(unsigned char *)qs->left_option->title; display->puts_scroll(2, PUTS_CENTER-4+!statusbar, title); display->puts_scroll(2, PUTS_CENTER-3+!statusbar, option); @@ -80,8 +78,7 @@ static void gui_quickscreen_draw(struct gui_quickscreen * qs, struct screen * di PUTSXY_CENTER-(font_h*3), 7, 8); /* Displays the second line of text */ - option=(unsigned char *)option_select_get_text(qs->right_option, buffer, - sizeof buffer); + option=(unsigned char *)option_select_get_text(qs->right_option); title=(unsigned char *)qs->right_option->title; display->getstringsize(title, &w, NULL); if(w > display->width - 8) @@ -103,8 +100,7 @@ static void gui_quickscreen_draw(struct gui_quickscreen * qs, struct screen * di display->putsxy(display->width -w-12, PUTSXY_CENTER, option); /* Displays the third line of text */ - option=(unsigned char *)option_select_get_text(qs->bottom_option, buffer, - sizeof buffer); + option=(unsigned char *)option_select_get_text(qs->bottom_option); title=(unsigned char *)qs->bottom_option->title; display->getstringsize(title, &w, NULL); -- cgit v1.2.3