From b05eec8b1ea4cbad0b668a8974c87272acc78ed6 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Mon, 5 Dec 2005 23:37:14 +0000 Subject: Big Code Police raid. Pretty pretty please, we do no macrofy simple assignments and things just to make them appear as function calls. That makes code harder to follow. Did some gcc4 warning fixes as well. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@8163 a1c6a512-1295-4272-9138-f99709370657 --- apps/gui/list.c | 2 +- apps/gui/option_select.h | 25 -------------------- apps/gui/quickscreen.c | 29 ++++++++++++++---------- apps/gui/select.c | 20 ++++++++-------- apps/gui/select.h | 59 ------------------------------------------------ 5 files changed, 28 insertions(+), 107 deletions(-) (limited to 'apps/gui') diff --git a/apps/gui/list.c b/apps/gui/list.c index ac084984eb..4e030c0a5f 100644 --- a/apps/gui/list.c +++ b/apps/gui/list.c @@ -166,7 +166,7 @@ void gui_list_draw(struct gui_list * gui_list) for(i = 0;i < display->nb_lines;i++) { char entry_buffer[MAX_PATH]; - char * entry_name; + unsigned char *entry_name; int current_item = gui_list->start_item + i; /* When there are less items to display than the diff --git a/apps/gui/option_select.h b/apps/gui/option_select.h index f667993781..6adbe1e720 100644 --- a/apps/gui/option_select.h +++ b/apps/gui/option_select.h @@ -93,29 +93,4 @@ extern void option_select_next(struct option_select * opt); */ extern void option_select_prev(struct option_select * opt); -/* - * Returns the selected number - * - opt : the option struct - */ -#define option_select_get_selected(_opt) \ - (_opt)->option - -/* - * Returns the title - * - opt : the option struct - */ -#define option_select_get_title(_opt) \ - (_opt)->title - -/* - * Tells the option selector wether it should stop when reaching the min/max value - * or should continue (by going to max/min) - * - opt : the option struct - * - scroll : - * - true : stops when reaching min/max - * - false : continues to go to max/min when reaching min/max - */ -#define option_select_limit_loop(_opt, loop) \ - (_opt)->limit_loop=loop - #endif /* _GUI_OPTION_SELECT_H_ */ diff --git a/apps/gui/quickscreen.c b/apps/gui/quickscreen.c index ecf496241d..8c23de9dce 100644 --- a/apps/gui/quickscreen.c +++ b/apps/gui/quickscreen.c @@ -45,14 +45,14 @@ void gui_quickscreen_draw(struct gui_quickscreen * qs, struct screen * display) { int w,h; char buffer[30]; - const char * option; - const char * title; + const unsigned char *option; + const unsigned char *title; #ifdef HAS_BUTTONBAR display->has_buttonbar=false; #endif gui_textarea_clear(display); display->setfont(FONT_SYSFIXED); - display->getstringsize("M",&w,&h); + display->getstringsize((unsigned char *)"M",&w,&h); /* Displays the icons */ display->mono_bitmap(bitmap_icons_7x8[Icon_FastBackward], display->width/2 - 16, @@ -65,27 +65,32 @@ void gui_quickscreen_draw(struct gui_quickscreen * qs, struct screen * display) display->height/2 - 4, 7, 8); /* Displays the left's text */ - title=option_select_get_title(qs->left_option); - option=option_select_get_text(qs->left_option, buffer, sizeof buffer); + title=(unsigned char *)qs->left_option->title; + option=(unsigned char *)option_select_get_text(qs->left_option, buffer, + sizeof buffer); display->putsxy(0, display->height/2 - h*2, title); - display->putsxy(0, display->height/2 - h, qs->left_right_title); + display->putsxy(0, display->height/2 - h, + (unsigned char *)qs->left_right_title); display->putsxy(0, display->height/2, option); /* Displays the bottom's text */ - title=option_select_get_title(qs->bottom_option); - option=option_select_get_text(qs->bottom_option, buffer, sizeof buffer); + title=(unsigned char *)qs->bottom_option->title; + option=(unsigned char *)option_select_get_text(qs->bottom_option, buffer, + sizeof buffer); display->getstringsize(title, &w, &h); display->putsxy((display->width-w)/2, display->height - h*2, title); display->getstringsize(option, &w, &h); display->putsxy((display->width-w)/2, display->height - h, option); /* Displays the right's text */ - title=option_select_get_title(qs->right_option); - option=option_select_get_text(qs->right_option, buffer, sizeof buffer); + title=(unsigned char *)qs->right_option->title; + option=(unsigned char *)option_select_get_text(qs->right_option, buffer, + sizeof buffer); display->getstringsize(title,&w,&h); display->putsxy(display->width - w, display->height/2 - h*2, title); - display->getstringsize(qs->left_right_title,&w,&h); - display->putsxy(display->width - w, display->height/2 - h, qs->left_right_title); + display->getstringsize((unsigned char *)qs->left_right_title, &w, &h); + display->putsxy(display->width - w, display->height/2 - h, + (unsigned char *)qs->left_right_title); display->getstringsize(option,&w,&h); display->putsxy(display->width - w, display->height/2, option); diff --git a/apps/gui/select.c b/apps/gui/select.c index 2f3bddec68..12b3c91620 100644 --- a/apps/gui/select.c +++ b/apps/gui/select.c @@ -60,11 +60,11 @@ void gui_select_draw(struct gui_select * select, struct screen * display) screen_set_xmargin(display, 0); #endif gui_textarea_clear(display); - display->puts_scroll(0, 0, option_select_get_title(&(select->options))); + display->puts_scroll(0, 0, (unsigned char *)select->options.title); - if(gui_select_is_canceled(select)) + if(select->canceled) display->puts_scroll(0, 0, str(LANG_MENU_SETTING_CANCEL)); - display->puts_scroll(0, 1, selected); + display->puts_scroll(0, 1, (unsigned char *)selected); gui_textarea_update(display); } @@ -77,31 +77,31 @@ void gui_syncselect_draw(struct gui_select * select) bool gui_syncselect_do_button(struct gui_select * select, int button) { - gui_select_limit_loop(select, false); + select->options.limit_loop = false; switch(button) { case SELECT_INC | BUTTON_REPEAT : #ifdef SELECT_RC_INC case SELECT_RC_INC | BUTTON_REPEAT : #endif - gui_select_limit_loop(select, true); + select->options.limit_loop = true; case SELECT_INC : #ifdef SELECT_RC_INC case SELECT_RC_INC : #endif - gui_select_next(select); + option_select_next(&select->options); return(true); case SELECT_DEC | BUTTON_REPEAT : #ifdef SELECT_RC_DEC case SELECT_RC_DEC | BUTTON_REPEAT : #endif - gui_select_limit_loop(select, true); + select->options.limit_loop = true; case SELECT_DEC : #ifdef SELECT_RC_DEC case SELECT_RC_DEC : #endif - gui_select_prev(select); + option_select_prev(&select->options); return(true); case SELECT_OK : @@ -114,7 +114,7 @@ bool gui_syncselect_do_button(struct gui_select * select, int button) #ifdef SELECT_OK2 case SELECT_OK2 : #endif - gui_select_validate(select); + select->validated=true; return(false); case SELECT_CANCEL : @@ -127,7 +127,7 @@ bool gui_syncselect_do_button(struct gui_select * select, int button) #ifdef SELECT_RC_CANCEL2 case SELECT_RC_CANCEL2 : #endif - gui_select_cancel(select); + select->canceled = true; gui_syncselect_draw(select); sleep(HZ/2); return(false); diff --git a/apps/gui/select.h b/apps/gui/select.h index 2799d80043..9bbfddf221 100644 --- a/apps/gui/select.h +++ b/apps/gui/select.h @@ -122,20 +122,6 @@ extern void gui_select_init_items(struct gui_select * select, int nb_items ); -/* - * Selects the next value - * - select : the select struct - */ -#define gui_select_next(select) \ - option_select_next(&(select->options)) - -/* - * Selects the previous value - * - select : the select struct - */ -#define gui_select_prev(select) \ - option_select_prev(&(select->options)) - /* * Draws the select on the given screen * - select : the select struct @@ -143,51 +129,6 @@ extern void gui_select_init_items(struct gui_select * select, */ extern void gui_select_draw(struct gui_select * select, struct screen * display); -/* - * Returns the selected value - * - select : the select struct - */ -#define gui_select_get_selected(_sel_) \ - option_select_get_selected(&((_sel_)->options)) -/* - * Cancels the select - * - select : the select struct - */ -#define gui_select_cancel(select) \ - (select)->canceled=true - -/* - * Tells wether the select has been canceled or not - * - select : the select struct - */ -#define gui_select_is_canceled(select) \ - (select)->canceled - -/* - * Validate the select - * - select : the select struct - */ -#define gui_select_validate(select) \ - (select)->validated=true - -/* - * Tells wether the select is validated or not - * - select : the select struct - */ -#define gui_select_is_validated(select) \ - (select)->validated - -/* - * Tells the select wether it should stop when reaching the min/max value - * or should continue (by going to max/min) - * - select : the select struct - * - scroll : - * - true : stops when reaching min/max - * - false : continues to go to max/min when reaching min/max - */ -#define gui_select_limit_loop(select, loop) \ - option_select_limit_loop(&((select)->options), loop) - /* * Draws the select on all the screens * - select : the select struct -- cgit v1.2.3