diff options
author | Daniel Stenberg <daniel@haxx.se> | 2005-12-05 23:37:14 +0000 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2005-12-05 23:37:14 +0000 |
commit | b05eec8b1ea4cbad0b668a8974c87272acc78ed6 (patch) | |
tree | d3df417790fe731d9ef7f65d01a11cbd374285dc /apps/gui | |
parent | f981ea93fb411019133a022c7dd873166d66b5dd (diff) | |
download | rockbox-b05eec8b1ea4cbad0b668a8974c87272acc78ed6.tar.gz rockbox-b05eec8b1ea4cbad0b668a8974c87272acc78ed6.zip |
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
Diffstat (limited to 'apps/gui')
-rw-r--r-- | apps/gui/list.c | 2 | ||||
-rw-r--r-- | apps/gui/option_select.h | 25 | ||||
-rw-r--r-- | apps/gui/quickscreen.c | 29 | ||||
-rw-r--r-- | apps/gui/select.c | 20 | ||||
-rw-r--r-- | apps/gui/select.h | 59 |
5 files changed, 28 insertions, 107 deletions
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 | */ |
94 | extern void option_select_prev(struct option_select * opt); | 94 | extern 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 | ||
78 | bool gui_syncselect_do_button(struct gui_select * select, int button) | 78 | bool 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, | |||
144 | extern void gui_select_draw(struct gui_select * select, struct screen * display); | 130 | extern 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 | */ |