summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
Diffstat (limited to 'apps')
-rw-r--r--apps/database.c22
-rw-r--r--apps/gui/list.c2
-rw-r--r--apps/gui/option_select.h25
-rw-r--r--apps/gui/quickscreen.c29
-rw-r--r--apps/gui/select.c20
-rw-r--r--apps/gui/select.h59
-rw-r--r--apps/screens.c15
-rw-r--r--apps/settings.c17
8 files changed, 58 insertions, 131 deletions
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;
78 78
79int tagdb_init(void) 79int tagdb_init(void)
80{ 80{
81 unsigned char* ptr = (char*)&tagdbheader.version; 81 unsigned char* ptr = (unsigned char*)&tagdbheader.version;
82#ifdef ROCKBOX_LITTLE_ENDIAN 82#ifdef ROCKBOX_LITTLE_ENDIAN
83 int i, *p; 83 int i, *p;
84#endif 84#endif
@@ -94,7 +94,8 @@ int tagdb_init(void)
94 ptr[1] != 'D' || 94 ptr[1] != 'D' ||
95 ptr[2] != 'B') 95 ptr[2] != 'B')
96 { 96 {
97 gui_syncsplash(HZ,true,"Not a rockbox ID3 database!"); 97 gui_syncsplash(HZ, true,
98 (unsigned char *)"Not a rockbox ID3 database!");
98 return -1; 99 return -1;
99 } 100 }
100#ifdef ROCKBOX_LITTLE_ENDIAN 101#ifdef ROCKBOX_LITTLE_ENDIAN
@@ -106,8 +107,9 @@ int tagdb_init(void)
106#endif 107#endif
107 if ( (tagdbheader.version&0xFF) != TAGDB_VERSION) 108 if ( (tagdbheader.version&0xFF) != TAGDB_VERSION)
108 { 109 {
109 gui_syncsplash(HZ,true,"Unsupported database version %d!", 110 gui_syncsplash(HZ, true,
110 tagdbheader.version&0xFF); 111 (unsigned char *)"Unsupported database version %d!",
112 tagdbheader.version&0xFF);
111 return -1; 113 return -1;
112 } 114 }
113 115
@@ -115,7 +117,7 @@ int tagdb_init(void)
115 tagdbheader.albumstart > tagdbheader.songstart || 117 tagdbheader.albumstart > tagdbheader.songstart ||
116 tagdbheader.artiststart > tagdbheader.albumstart) 118 tagdbheader.artiststart > tagdbheader.albumstart)
117 { 119 {
118 gui_syncsplash(HZ,true,"Corrupt ID3 database!"); 120 gui_syncsplash(HZ, true, (unsigned char *)"Corrupt ID3 database!");
119 return -1; 121 return -1;
120 } 122 }
121 123
@@ -334,7 +336,7 @@ void rundb_buffer_track(struct mp3entry *id, bool last_track) {
334 336
335int rundb_init(void) 337int rundb_init(void)
336{ 338{
337 unsigned char* ptr = (char*)&rundbheader.version; 339 unsigned char* ptr = (unsigned char*)&rundbheader.version;
338#ifdef ROCKBOX_LITTLE_ENDIAN 340#ifdef ROCKBOX_LITTLE_ENDIAN
339 int i, *p; 341 int i, *p;
340#endif 342#endif
@@ -361,7 +363,8 @@ int rundb_init(void)
361 ptr[1] != 'R' || 363 ptr[1] != 'R' ||
362 ptr[2] != 'D') 364 ptr[2] != 'D')
363 { 365 {
364 gui_syncsplash(HZ,true,"Not a rockbox runtime database!"); 366 gui_syncsplash(HZ, true,
367 (unsigned char *)"Not a rockbox runtime database!");
365 return -1; 368 return -1;
366 } 369 }
367#ifdef ROCKBOX_LITTLE_ENDIAN 370#ifdef ROCKBOX_LITTLE_ENDIAN
@@ -373,8 +376,9 @@ int rundb_init(void)
373#endif 376#endif
374 if ( (rundbheader.version&0xFF) != RUNDB_VERSION) 377 if ( (rundbheader.version&0xFF) != RUNDB_VERSION)
375 { 378 {
376 gui_syncsplash(HZ,true,"Unsupported runtime database version %d!", 379 gui_syncsplash(HZ, true, (unsigned char *)
377 rundbheader.version&0xFF); 380 "Unsupported runtime database version %d!",
381 rundbheader.version&0xFF);
378 return -1; 382 return -1;
379 } 383 }
380 384
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)
166 for(i = 0;i < display->nb_lines;i++) 166 for(i = 0;i < display->nb_lines;i++)
167 { 167 {
168 char entry_buffer[MAX_PATH]; 168 char entry_buffer[MAX_PATH];
169 char * entry_name; 169 unsigned char *entry_name;
170 int current_item = gui_list->start_item + i; 170 int current_item = gui_list->start_item + i;
171 171
172 /* When there are less items to display than the 172 /* 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);
93 */ 93 */
94extern void option_select_prev(struct option_select * opt); 94extern void option_select_prev(struct option_select * opt);
95 95
96/*
97 * Returns the selected number
98 * - opt : the option struct
99 */
100#define option_select_get_selected(_opt) \
101 (_opt)->option
102
103/*
104 * Returns the title
105 * - opt : the option struct
106 */
107#define option_select_get_title(_opt) \
108 (_opt)->title
109
110/*
111 * Tells the option selector wether it should stop when reaching the min/max value
112 * or should continue (by going to max/min)
113 * - opt : the option struct
114 * - scroll :
115 * - true : stops when reaching min/max
116 * - false : continues to go to max/min when reaching min/max
117 */
118#define option_select_limit_loop(_opt, loop) \
119 (_opt)->limit_loop=loop
120
121#endif /* _GUI_OPTION_SELECT_H_ */ 96#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)
45{ 45{
46 int w,h; 46 int w,h;
47 char buffer[30]; 47 char buffer[30];
48 const char * option; 48 const unsigned char *option;
49 const char * title; 49 const unsigned char *title;
50#ifdef HAS_BUTTONBAR 50#ifdef HAS_BUTTONBAR
51 display->has_buttonbar=false; 51 display->has_buttonbar=false;
52#endif 52#endif
53 gui_textarea_clear(display); 53 gui_textarea_clear(display);
54 display->setfont(FONT_SYSFIXED); 54 display->setfont(FONT_SYSFIXED);
55 display->getstringsize("M",&w,&h); 55 display->getstringsize((unsigned char *)"M",&w,&h);
56 /* Displays the icons */ 56 /* Displays the icons */
57 display->mono_bitmap(bitmap_icons_7x8[Icon_FastBackward], 57 display->mono_bitmap(bitmap_icons_7x8[Icon_FastBackward],
58 display->width/2 - 16, 58 display->width/2 - 16,
@@ -65,27 +65,32 @@ void gui_quickscreen_draw(struct gui_quickscreen * qs, struct screen * display)
65 display->height/2 - 4, 7, 8); 65 display->height/2 - 4, 7, 8);
66 66
67 /* Displays the left's text */ 67 /* Displays the left's text */
68 title=option_select_get_title(qs->left_option); 68 title=(unsigned char *)qs->left_option->title;
69 option=option_select_get_text(qs->left_option, buffer, sizeof buffer); 69 option=(unsigned char *)option_select_get_text(qs->left_option, buffer,
70 sizeof buffer);
70 display->putsxy(0, display->height/2 - h*2, title); 71 display->putsxy(0, display->height/2 - h*2, title);
71 display->putsxy(0, display->height/2 - h, qs->left_right_title); 72 display->putsxy(0, display->height/2 - h,
73 (unsigned char *)qs->left_right_title);
72 display->putsxy(0, display->height/2, option); 74 display->putsxy(0, display->height/2, option);
73 75
74 /* Displays the bottom's text */ 76 /* Displays the bottom's text */
75 title=option_select_get_title(qs->bottom_option); 77 title=(unsigned char *)qs->bottom_option->title;
76 option=option_select_get_text(qs->bottom_option, buffer, sizeof buffer); 78 option=(unsigned char *)option_select_get_text(qs->bottom_option, buffer,
79 sizeof buffer);
77 display->getstringsize(title, &w, &h); 80 display->getstringsize(title, &w, &h);
78 display->putsxy((display->width-w)/2, display->height - h*2, title); 81 display->putsxy((display->width-w)/2, display->height - h*2, title);
79 display->getstringsize(option, &w, &h); 82 display->getstringsize(option, &w, &h);
80 display->putsxy((display->width-w)/2, display->height - h, option); 83 display->putsxy((display->width-w)/2, display->height - h, option);
81 84
82 /* Displays the right's text */ 85 /* Displays the right's text */
83 title=option_select_get_title(qs->right_option); 86 title=(unsigned char *)qs->right_option->title;
84 option=option_select_get_text(qs->right_option, buffer, sizeof buffer); 87 option=(unsigned char *)option_select_get_text(qs->right_option, buffer,
88 sizeof buffer);
85 display->getstringsize(title,&w,&h); 89 display->getstringsize(title,&w,&h);
86 display->putsxy(display->width - w, display->height/2 - h*2, title); 90 display->putsxy(display->width - w, display->height/2 - h*2, title);
87 display->getstringsize(qs->left_right_title,&w,&h); 91 display->getstringsize((unsigned char *)qs->left_right_title, &w, &h);
88 display->putsxy(display->width - w, display->height/2 - h, qs->left_right_title); 92 display->putsxy(display->width - w, display->height/2 - h,
93 (unsigned char *)qs->left_right_title);
89 display->getstringsize(option,&w,&h); 94 display->getstringsize(option,&w,&h);
90 display->putsxy(display->width - w, display->height/2, option); 95 display->putsxy(display->width - w, display->height/2, option);
91 96
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)
60 screen_set_xmargin(display, 0); 60 screen_set_xmargin(display, 0);
61#endif 61#endif
62 gui_textarea_clear(display); 62 gui_textarea_clear(display);
63 display->puts_scroll(0, 0, option_select_get_title(&(select->options))); 63 display->puts_scroll(0, 0, (unsigned char *)select->options.title);
64 64
65 if(gui_select_is_canceled(select)) 65 if(select->canceled)
66 display->puts_scroll(0, 0, str(LANG_MENU_SETTING_CANCEL)); 66 display->puts_scroll(0, 0, str(LANG_MENU_SETTING_CANCEL));
67 display->puts_scroll(0, 1, selected); 67 display->puts_scroll(0, 1, (unsigned char *)selected);
68 gui_textarea_update(display); 68 gui_textarea_update(display);
69} 69}
70 70
@@ -77,31 +77,31 @@ void gui_syncselect_draw(struct gui_select * select)
77 77
78bool gui_syncselect_do_button(struct gui_select * select, int button) 78bool gui_syncselect_do_button(struct gui_select * select, int button)
79{ 79{
80 gui_select_limit_loop(select, false); 80 select->options.limit_loop = false;
81 switch(button) 81 switch(button)
82 { 82 {
83 case SELECT_INC | BUTTON_REPEAT : 83 case SELECT_INC | BUTTON_REPEAT :
84#ifdef SELECT_RC_INC 84#ifdef SELECT_RC_INC
85 case SELECT_RC_INC | BUTTON_REPEAT : 85 case SELECT_RC_INC | BUTTON_REPEAT :
86#endif 86#endif
87 gui_select_limit_loop(select, true); 87 select->options.limit_loop = true;
88 case SELECT_INC : 88 case SELECT_INC :
89#ifdef SELECT_RC_INC 89#ifdef SELECT_RC_INC
90 case SELECT_RC_INC : 90 case SELECT_RC_INC :
91#endif 91#endif
92 gui_select_next(select); 92 option_select_next(&select->options);
93 return(true); 93 return(true);
94 94
95 case SELECT_DEC | BUTTON_REPEAT : 95 case SELECT_DEC | BUTTON_REPEAT :
96#ifdef SELECT_RC_DEC 96#ifdef SELECT_RC_DEC
97 case SELECT_RC_DEC | BUTTON_REPEAT : 97 case SELECT_RC_DEC | BUTTON_REPEAT :
98#endif 98#endif
99 gui_select_limit_loop(select, true); 99 select->options.limit_loop = true;
100 case SELECT_DEC : 100 case SELECT_DEC :
101#ifdef SELECT_RC_DEC 101#ifdef SELECT_RC_DEC
102 case SELECT_RC_DEC : 102 case SELECT_RC_DEC :
103#endif 103#endif
104 gui_select_prev(select); 104 option_select_prev(&select->options);
105 return(true); 105 return(true);
106 106
107 case SELECT_OK : 107 case SELECT_OK :
@@ -114,7 +114,7 @@ bool gui_syncselect_do_button(struct gui_select * select, int button)
114#ifdef SELECT_OK2 114#ifdef SELECT_OK2
115 case SELECT_OK2 : 115 case SELECT_OK2 :
116#endif 116#endif
117 gui_select_validate(select); 117 select->validated=true;
118 return(false); 118 return(false);
119 119
120 case SELECT_CANCEL : 120 case SELECT_CANCEL :
@@ -127,7 +127,7 @@ bool gui_syncselect_do_button(struct gui_select * select, int button)
127#ifdef SELECT_RC_CANCEL2 127#ifdef SELECT_RC_CANCEL2
128 case SELECT_RC_CANCEL2 : 128 case SELECT_RC_CANCEL2 :
129#endif 129#endif
130 gui_select_cancel(select); 130 select->canceled = true;
131 gui_syncselect_draw(select); 131 gui_syncselect_draw(select);
132 sleep(HZ/2); 132 sleep(HZ/2);
133 return(false); 133 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
@@ -123,20 +123,6 @@ extern void gui_select_init_items(struct gui_select * select,
123 ); 123 );
124 124
125/* 125/*
126 * Selects the next value
127 * - select : the select struct
128 */
129#define gui_select_next(select) \
130 option_select_next(&(select->options))
131
132/*
133 * Selects the previous value
134 * - select : the select struct
135 */
136#define gui_select_prev(select) \
137 option_select_prev(&(select->options))
138
139/*
140 * Draws the select on the given screen 126 * Draws the select on the given screen
141 * - select : the select struct 127 * - select : the select struct
142 * - display : the display on which you want to output 128 * - display : the display on which you want to output
@@ -144,51 +130,6 @@ extern void gui_select_init_items(struct gui_select * select,
144extern void gui_select_draw(struct gui_select * select, struct screen * display); 130extern void gui_select_draw(struct gui_select * select, struct screen * display);
145 131
146/* 132/*
147 * Returns the selected value
148 * - select : the select struct
149 */
150#define gui_select_get_selected(_sel_) \
151 option_select_get_selected(&((_sel_)->options))
152/*
153 * Cancels the select
154 * - select : the select struct
155 */
156#define gui_select_cancel(select) \
157 (select)->canceled=true
158
159/*
160 * Tells wether the select has been canceled or not
161 * - select : the select struct
162 */
163#define gui_select_is_canceled(select) \
164 (select)->canceled
165
166/*
167 * Validate the select
168 * - select : the select struct
169 */
170#define gui_select_validate(select) \
171 (select)->validated=true
172
173/*
174 * Tells wether the select is validated or not
175 * - select : the select struct
176 */
177#define gui_select_is_validated(select) \
178 (select)->validated
179
180/*
181 * Tells the select wether it should stop when reaching the min/max value
182 * or should continue (by going to max/min)
183 * - select : the select struct
184 * - scroll :
185 * - true : stops when reaching min/max
186 * - false : continues to go to max/min when reaching min/max
187 */
188#define gui_select_limit_loop(select, loop) \
189 option_select_limit_loop(&((select)->options), loop)
190
191/*
192 * Draws the select on all the screens 133 * Draws the select on all the screens
193 * - select : the select struct 134 * - select : the select struct
194 */ 135 */
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)
363 while (!exit) { 363 while (!exit) {
364 364
365 if ( used ) { 365 if ( used ) {
366 char* ptr; 366 unsigned char* ptr;
367 char buf[32]; 367 unsigned char buf[32];
368 int w, h; 368 int w, h;
369 369
370 lcd_clear_display(); 370 lcd_clear_display();
@@ -376,7 +376,8 @@ int pitch_screen(void)
376 lcd_mono_bitmap(bitmap_icons_7x8[Icon_UpArrow], 376 lcd_mono_bitmap(bitmap_icons_7x8[Icon_UpArrow],
377 LCD_WIDTH/2 - 3, h*2, 7, 8); 377 LCD_WIDTH/2 - 3, h*2, 7, 8);
378 378
379 snprintf(buf, sizeof buf, "%d.%d%%", pitch / 10, pitch % 10 ); 379 snprintf((char *)buf, sizeof buf, "%d.%d%%",
380 pitch / 10, pitch % 10 );
380 lcd_getstringsize(buf,&w,&h); 381 lcd_getstringsize(buf,&w,&h);
381 lcd_putsxy((LCD_WIDTH-w)/2, h, buf); 382 lcd_putsxy((LCD_WIDTH-w)/2, h, buf);
382 383
@@ -487,9 +488,9 @@ int pitch_screen(void)
487 488
488void quick_screen_quick_apply(struct gui_quickscreen *qs) 489void quick_screen_quick_apply(struct gui_quickscreen *qs)
489{ 490{
490 global_settings.playlist_shuffle=int_to_bool(option_select_get_selected(qs->left_option)); 491 global_settings.playlist_shuffle=int_to_bool(qs->left_option->option);
491 global_settings.dirfilter=option_select_get_selected(qs->bottom_option); 492 global_settings.dirfilter=qs->bottom_option->option;
492 global_settings.repeat_mode=option_select_get_selected(qs->right_option); 493 global_settings.repeat_mode=qs->right_option->option;
493} 494}
494 495
495bool quick_screen_quick(int button_enter) 496bool quick_screen_quick(int button_enter)
@@ -619,7 +620,7 @@ bool quick_screen_f3(int button_enter)
619#if defined(HAVE_CHARGING) || defined(SIMULATOR) 620#if defined(HAVE_CHARGING) || defined(SIMULATOR)
620void charging_splash(void) 621void charging_splash(void)
621{ 622{
622 gui_syncsplash(2*HZ, true, (char *)str(LANG_BATTERY_CHARGE)); 623 gui_syncsplash(2*HZ, true, (unsigned char *)str(LANG_BATTERY_CHARGE));
623 button_clear_queue(); 624 button_clear_queue();
624} 625}
625#endif 626#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,
1520 formatter); 1520 formatter);
1521 gui_syncselect_draw(&select); 1521 gui_syncselect_draw(&select);
1522 talk_unit(voice_unit, *variable); 1522 talk_unit(voice_unit, *variable);
1523 while (!gui_select_is_validated(&select)) 1523 while (!select.validated)
1524 { 1524 {
1525 button = button_get_w_tmo(HZ/2); 1525 button = button_get_w_tmo(HZ/2);
1526 if(gui_syncselect_do_button(&select, button)) 1526 if(gui_syncselect_do_button(&select, button))
1527 { 1527 {
1528 *variable=gui_select_get_selected(&select); 1528 *variable=select.options.option;
1529 gui_syncselect_draw(&select); 1529 gui_syncselect_draw(&select);
1530 talk_unit(voice_unit, *variable); 1530 talk_unit(voice_unit, *variable);
1531 if ( function ) 1531 if ( function )
1532 function(*variable); 1532 function(*variable);
1533 } 1533 }
1534 gui_syncstatusbar_draw(&statusbars, false); 1534 gui_syncstatusbar_draw(&statusbars, false);
1535 if(gui_select_is_canceled(&select)) 1535 if(select.canceled)
1536 { 1536 {
1537 *variable=oldvalue; 1537 *variable=oldvalue;
1538 if ( function ) 1538 if ( function )
@@ -1579,23 +1579,24 @@ bool set_option(const char* string, void* variable, enum optiontype type,
1579 gui_select_init_items(&select, string, oldvalue, options, numoptions); 1579 gui_select_init_items(&select, string, oldvalue, options, numoptions);
1580 gui_syncselect_draw(&select); 1580 gui_syncselect_draw(&select);
1581 if (global_settings.talk_menu) 1581 if (global_settings.talk_menu)
1582 talk_id(options[gui_select_get_selected(&select)].voice_id, true); 1582 talk_id(options[select.options.option].voice_id, true);
1583 while ( !gui_select_is_validated(&select) ) 1583
1584 while ( !select.validated )
1584 { 1585 {
1585 gui_syncstatusbar_draw(&statusbars, true); 1586 gui_syncstatusbar_draw(&statusbars, true);
1586 button = button_get_w_tmo(HZ/2); 1587 button = button_get_w_tmo(HZ/2);
1587 if(gui_syncselect_do_button(&select, button)) 1588 if(gui_syncselect_do_button(&select, button))
1588 { 1589 {
1589 /* *variable = gui_select_get_selected(&select) */ 1590 /* *variable = gui_select_get_selected(&select) */
1590 set_type_fromint(type, variable, gui_select_get_selected(&select)); 1591 set_type_fromint(type, variable, select.options.option);
1591 gui_syncselect_draw(&select); 1592 gui_syncselect_draw(&select);
1592 if (global_settings.talk_menu) 1593 if (global_settings.talk_menu)
1593 talk_id(options[gui_select_get_selected(&select)].voice_id, false); 1594 talk_id(options[select.options.option].voice_id, false);
1594 if ( function ) 1595 if ( function )
1595 function(type_fromvoidptr(type, variable)); 1596 function(type_fromvoidptr(type, variable));
1596 } 1597 }
1597 gui_syncstatusbar_draw(&statusbars, false); 1598 gui_syncstatusbar_draw(&statusbars, false);
1598 if(gui_select_is_canceled(&select)) 1599 if(select.canceled)
1599 { 1600 {
1600 /* *variable=oldvalue; */ 1601 /* *variable=oldvalue; */
1601 set_type_fromint(type, variable, oldvalue); 1602 set_type_fromint(type, variable, oldvalue);