diff --git a/apps/database.c b/apps/database.c index 97fb2d70cc..df069538a2 100644 --- a/apps/database.c +++ b/apps/database.c @@ -78,7 +78,7 @@ struct tagdb_header tagdbheader; int tagdb_init(void) { - unsigned char* ptr = (char*)&tagdbheader.version; + unsigned char* ptr = (unsigned char*)&tagdbheader.version; #ifdef ROCKBOX_LITTLE_ENDIAN int i, *p; #endif @@ -94,7 +94,8 @@ int tagdb_init(void) ptr[1] != 'D' || ptr[2] != 'B') { - gui_syncsplash(HZ,true,"Not a rockbox ID3 database!"); + gui_syncsplash(HZ, true, + (unsigned char *)"Not a rockbox ID3 database!"); return -1; } #ifdef ROCKBOX_LITTLE_ENDIAN @@ -106,8 +107,9 @@ int tagdb_init(void) #endif if ( (tagdbheader.version&0xFF) != TAGDB_VERSION) { - gui_syncsplash(HZ,true,"Unsupported database version %d!", - tagdbheader.version&0xFF); + gui_syncsplash(HZ, true, + (unsigned char *)"Unsupported database version %d!", + tagdbheader.version&0xFF); return -1; } @@ -115,7 +117,7 @@ int tagdb_init(void) tagdbheader.albumstart > tagdbheader.songstart || tagdbheader.artiststart > tagdbheader.albumstart) { - gui_syncsplash(HZ,true,"Corrupt ID3 database!"); + gui_syncsplash(HZ, true, (unsigned char *)"Corrupt ID3 database!"); return -1; } @@ -334,7 +336,7 @@ void rundb_buffer_track(struct mp3entry *id, bool last_track) { int rundb_init(void) { - unsigned char* ptr = (char*)&rundbheader.version; + unsigned char* ptr = (unsigned char*)&rundbheader.version; #ifdef ROCKBOX_LITTLE_ENDIAN int i, *p; #endif @@ -361,7 +363,8 @@ int rundb_init(void) ptr[1] != 'R' || ptr[2] != 'D') { - gui_syncsplash(HZ,true,"Not a rockbox runtime database!"); + gui_syncsplash(HZ, true, + (unsigned char *)"Not a rockbox runtime database!"); return -1; } #ifdef ROCKBOX_LITTLE_ENDIAN @@ -373,8 +376,9 @@ int rundb_init(void) #endif if ( (rundbheader.version&0xFF) != RUNDB_VERSION) { - gui_syncsplash(HZ,true,"Unsupported runtime database version %d!", - rundbheader.version&0xFF); + gui_syncsplash(HZ, true, (unsigned char *) + "Unsupported runtime database version %d!", + rundbheader.version&0xFF); return -1; } 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 diff --git a/apps/screens.c b/apps/screens.c index 6c6c5325be..6f81231091 100644 --- a/apps/screens.c +++ b/apps/screens.c @@ -363,8 +363,8 @@ int pitch_screen(void) while (!exit) { if ( used ) { - char* ptr; - char buf[32]; + unsigned char* ptr; + unsigned char buf[32]; int w, h; lcd_clear_display(); @@ -376,7 +376,8 @@ int pitch_screen(void) lcd_mono_bitmap(bitmap_icons_7x8[Icon_UpArrow], LCD_WIDTH/2 - 3, h*2, 7, 8); - snprintf(buf, sizeof buf, "%d.%d%%", pitch / 10, pitch % 10 ); + snprintf((char *)buf, sizeof buf, "%d.%d%%", + pitch / 10, pitch % 10 ); lcd_getstringsize(buf,&w,&h); lcd_putsxy((LCD_WIDTH-w)/2, h, buf); @@ -487,9 +488,9 @@ int pitch_screen(void) void quick_screen_quick_apply(struct gui_quickscreen *qs) { - global_settings.playlist_shuffle=int_to_bool(option_select_get_selected(qs->left_option)); - global_settings.dirfilter=option_select_get_selected(qs->bottom_option); - global_settings.repeat_mode=option_select_get_selected(qs->right_option); + global_settings.playlist_shuffle=int_to_bool(qs->left_option->option); + global_settings.dirfilter=qs->bottom_option->option; + global_settings.repeat_mode=qs->right_option->option; } bool quick_screen_quick(int button_enter) @@ -619,7 +620,7 @@ bool quick_screen_f3(int button_enter) #if defined(HAVE_CHARGING) || defined(SIMULATOR) void charging_splash(void) { - gui_syncsplash(2*HZ, true, (char *)str(LANG_BATTERY_CHARGE)); + gui_syncsplash(2*HZ, true, (unsigned char *)str(LANG_BATTERY_CHARGE)); button_clear_queue(); } #endif diff --git a/apps/settings.c b/apps/settings.c index ac23cafe96..ae9bd6792a 100644 --- a/apps/settings.c +++ b/apps/settings.c @@ -1520,19 +1520,19 @@ bool set_int(const unsigned char* string, formatter); gui_syncselect_draw(&select); talk_unit(voice_unit, *variable); - while (!gui_select_is_validated(&select)) + while (!select.validated) { button = button_get_w_tmo(HZ/2); if(gui_syncselect_do_button(&select, button)) { - *variable=gui_select_get_selected(&select); + *variable=select.options.option; gui_syncselect_draw(&select); talk_unit(voice_unit, *variable); if ( function ) function(*variable); } gui_syncstatusbar_draw(&statusbars, false); - if(gui_select_is_canceled(&select)) + if(select.canceled) { *variable=oldvalue; if ( function ) @@ -1579,23 +1579,24 @@ bool set_option(const char* string, void* variable, enum optiontype type, gui_select_init_items(&select, string, oldvalue, options, numoptions); gui_syncselect_draw(&select); if (global_settings.talk_menu) - talk_id(options[gui_select_get_selected(&select)].voice_id, true); - while ( !gui_select_is_validated(&select) ) + talk_id(options[select.options.option].voice_id, true); + + while ( !select.validated ) { gui_syncstatusbar_draw(&statusbars, true); button = button_get_w_tmo(HZ/2); if(gui_syncselect_do_button(&select, button)) { /* *variable = gui_select_get_selected(&select) */ - set_type_fromint(type, variable, gui_select_get_selected(&select)); + set_type_fromint(type, variable, select.options.option); gui_syncselect_draw(&select); if (global_settings.talk_menu) - talk_id(options[gui_select_get_selected(&select)].voice_id, false); + talk_id(options[select.options.option].voice_id, false); if ( function ) function(type_fromvoidptr(type, variable)); } gui_syncstatusbar_draw(&statusbars, false); - if(gui_select_is_canceled(&select)) + if(select.canceled) { /* *variable=oldvalue; */ set_type_fromint(type, variable, oldvalue);