diff options
author | Peter D'Hoye <peter.dhoye@gmail.com> | 2006-12-09 12:27:04 +0000 |
---|---|---|
committer | Peter D'Hoye <peter.dhoye@gmail.com> | 2006-12-09 12:27:04 +0000 |
commit | 3e1f837d1108210dcc725725f39dc43e38414c93 (patch) | |
tree | c676d0551d25e07e6695e8f21c8fe4b7b6b0194b | |
parent | 81f76f21d6ec2e49cd4d3e942d72fcab52947185 (diff) | |
download | rockbox-3e1f837d1108210dcc725725f39dc43e38414c93.tar.gz rockbox-3e1f837d1108210dcc725725f39dc43e38414c93.zip |
Turned function back into define as that uses less bytes because gcc inlined the function.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@11699 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r-- | apps/gui/list.c | 26 |
1 files changed, 12 insertions, 14 deletions
diff --git a/apps/gui/list.c b/apps/gui/list.c index 8bb9df0df5..de3e7b2b42 100644 --- a/apps/gui/list.c +++ b/apps/gui/list.c | |||
@@ -45,10 +45,8 @@ static int offset_step = 16; /* pixels per screen scroll step */ | |||
45 | static bool offset_out_of_view = false; | 45 | static bool offset_out_of_view = false; |
46 | #endif | 46 | #endif |
47 | 47 | ||
48 | bool show_list_title(struct gui_list * gui_list) | 48 | #define SHOW_LIST_TITLE ((gui_list->title != NULL) && \ |
49 | { | 49 | (gui_list->display->nb_lines > 1)) |
50 | return ((gui_list->title != NULL) && (gui_list->display->nb_lines > 1)); | ||
51 | } | ||
52 | 50 | ||
53 | void gui_list_init(struct gui_list * gui_list, | 51 | void gui_list_init(struct gui_list * gui_list, |
54 | list_get_name callback_get_item_name, | 52 | list_get_name callback_get_item_name, |
@@ -127,7 +125,7 @@ void gui_list_put_selection_in_screen(struct gui_list * gui_list, | |||
127 | #endif | 125 | #endif |
128 | gui_textarea_update_nblines(gui_list->display); | 126 | gui_textarea_update_nblines(gui_list->display); |
129 | int nb_lines=gui_list->display->nb_lines; | 127 | int nb_lines=gui_list->display->nb_lines; |
130 | if (show_list_title(gui_list)) | 128 | if (SHOW_LIST_TITLE) |
131 | nb_lines--; | 129 | nb_lines--; |
132 | if(put_from_end) | 130 | if(put_from_end) |
133 | { | 131 | { |
@@ -200,7 +198,7 @@ void gui_list_draw(struct gui_list * gui_list) | |||
200 | gui_textarea_clear(display); | 198 | gui_textarea_clear(display); |
201 | 199 | ||
202 | /* position and draw the list title & icon */ | 200 | /* position and draw the list title & icon */ |
203 | if (show_list_title(gui_list)) | 201 | if (SHOW_LIST_TITLE) |
204 | { | 202 | { |
205 | i = 1; | 203 | i = 1; |
206 | lines = display->nb_lines - 1; | 204 | lines = display->nb_lines - 1; |
@@ -248,8 +246,8 @@ void gui_list_draw(struct gui_list * gui_list) | |||
248 | 246 | ||
249 | draw_cursor = !global_settings.invert_cursor; | 247 | draw_cursor = !global_settings.invert_cursor; |
250 | text_pos = 0; /* here it's in pixels */ | 248 | text_pos = 0; /* here it's in pixels */ |
251 | if(draw_scrollbar || show_list_title(gui_list)) /* indent if there's | 249 | if(draw_scrollbar || SHOW_LIST_TITLE) /* indent if there's |
252 | a title */ | 250 | a title */ |
253 | { | 251 | { |
254 | cursor_pos++; | 252 | cursor_pos++; |
255 | icon_pos++; | 253 | icon_pos++; |
@@ -279,7 +277,7 @@ void gui_list_draw(struct gui_list * gui_list) | |||
279 | char entry_buffer[MAX_PATH]; | 277 | char entry_buffer[MAX_PATH]; |
280 | unsigned char *entry_name; | 278 | unsigned char *entry_name; |
281 | int current_item = gui_list->start_item + | 279 | int current_item = gui_list->start_item + |
282 | (show_list_title(gui_list) ? i-1 : i); | 280 | (SHOW_LIST_TITLE ? i-1 : i); |
283 | 281 | ||
284 | /* When there are less items to display than the | 282 | /* When there are less items to display than the |
285 | * current available space on the screen, we stop*/ | 283 | * current available space on the screen, we stop*/ |
@@ -359,7 +357,7 @@ void gui_list_draw(struct gui_list * gui_list) | |||
359 | if(draw_scrollbar) | 357 | if(draw_scrollbar) |
360 | { | 358 | { |
361 | int y_start = gui_textarea_get_ystart(display); | 359 | int y_start = gui_textarea_get_ystart(display); |
362 | if (show_list_title(gui_list)) | 360 | if (SHOW_LIST_TITLE) |
363 | y_start += display->char_height; | 361 | y_start += display->char_height; |
364 | int scrollbar_y_end = display->char_height * | 362 | int scrollbar_y_end = display->char_height * |
365 | lines + y_start; | 363 | lines + y_start; |
@@ -395,7 +393,7 @@ void gui_list_select_next(struct gui_list * gui_list) | |||
395 | { | 393 | { |
396 | gui_list->selected_item+=gui_list->selected_size; | 394 | gui_list->selected_item+=gui_list->selected_size; |
397 | int nb_lines = gui_list->display->nb_lines; | 395 | int nb_lines = gui_list->display->nb_lines; |
398 | if (show_list_title(gui_list)) | 396 | if (SHOW_LIST_TITLE) |
399 | nb_lines--; | 397 | nb_lines--; |
400 | int item_pos = gui_list->selected_item - gui_list->start_item; | 398 | int item_pos = gui_list->selected_item - gui_list->start_item; |
401 | int end_item = gui_list->start_item + nb_lines; | 399 | int end_item = gui_list->start_item + nb_lines; |
@@ -427,7 +425,7 @@ void gui_list_select_next(struct gui_list * gui_list) | |||
427 | void gui_list_select_previous(struct gui_list * gui_list) | 425 | void gui_list_select_previous(struct gui_list * gui_list) |
428 | { | 426 | { |
429 | int nb_lines = gui_list->display->nb_lines; | 427 | int nb_lines = gui_list->display->nb_lines; |
430 | if (show_list_title(gui_list)) | 428 | if (SHOW_LIST_TITLE) |
431 | nb_lines--; | 429 | nb_lines--; |
432 | if( gui_list->selected_item-gui_list->selected_size < 0 ) | 430 | if( gui_list->selected_item-gui_list->selected_size < 0 ) |
433 | { | 431 | { |
@@ -478,7 +476,7 @@ void gui_list_select_next_page(struct gui_list * gui_list, int nb_lines) | |||
478 | } | 476 | } |
479 | else | 477 | else |
480 | { | 478 | { |
481 | if (show_list_title(gui_list)) | 479 | if (SHOW_LIST_TITLE) |
482 | nb_lines--; | 480 | nb_lines--; |
483 | nb_lines-=nb_lines%gui_list->selected_size; | 481 | nb_lines-=nb_lines%gui_list->selected_size; |
484 | gui_list->selected_item += nb_lines; | 482 | gui_list->selected_item += nb_lines; |
@@ -498,7 +496,7 @@ void gui_list_select_previous_page(struct gui_list * gui_list, int nb_lines) | |||
498 | } | 496 | } |
499 | else | 497 | else |
500 | { | 498 | { |
501 | if (show_list_title(gui_list)) | 499 | if (SHOW_LIST_TITLE) |
502 | nb_lines--; | 500 | nb_lines--; |
503 | nb_lines-=nb_lines%gui_list->selected_size; | 501 | nb_lines-=nb_lines%gui_list->selected_size; |
504 | gui_list->selected_item -= nb_lines; | 502 | gui_list->selected_item -= nb_lines; |