summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter D'Hoye <peter.dhoye@gmail.com>2006-12-09 12:27:04 +0000
committerPeter D'Hoye <peter.dhoye@gmail.com>2006-12-09 12:27:04 +0000
commit3e1f837d1108210dcc725725f39dc43e38414c93 (patch)
treec676d0551d25e07e6695e8f21c8fe4b7b6b0194b
parent81f76f21d6ec2e49cd4d3e942d72fcab52947185 (diff)
downloadrockbox-3e1f837d1108210dcc725725f39dc43e38414c93.zip
rockbox-3e1f837d1108210dcc725725f39dc43e38414c93.tar.gz
rockbox-3e1f837d1108210dcc725725f39dc43e38414c93.tar.bz2
rockbox-3e1f837d1108210dcc725725f39dc43e38414c93.tar.xz
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.c26
1 files changed, 12 insertions, 14 deletions
diff --git a/apps/gui/list.c b/apps/gui/list.c
index 8bb9df0..de3e7b2 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 */
static bool offset_out_of_view = false;
#endif
-bool show_list_title(struct gui_list * gui_list)
-{
- return ((gui_list->title != NULL) && (gui_list->display->nb_lines > 1));
-}
+#define SHOW_LIST_TITLE ((gui_list->title != NULL) && \
+ (gui_list->display->nb_lines > 1))
void gui_list_init(struct gui_list * gui_list,
list_get_name callback_get_item_name,
@@ -127,7 +125,7 @@ void gui_list_put_selection_in_screen(struct gui_list * gui_list,
#endif
gui_textarea_update_nblines(gui_list->display);
int nb_lines=gui_list->display->nb_lines;
- if (show_list_title(gui_list))
+ if (SHOW_LIST_TITLE)
nb_lines--;
if(put_from_end)
{
@@ -200,7 +198,7 @@ void gui_list_draw(struct gui_list * gui_list)
gui_textarea_clear(display);
/* position and draw the list title & icon */
- if (show_list_title(gui_list))
+ if (SHOW_LIST_TITLE)
{
i = 1;
lines = display->nb_lines - 1;
@@ -248,8 +246,8 @@ void gui_list_draw(struct gui_list * gui_list)
draw_cursor = !global_settings.invert_cursor;
text_pos = 0; /* here it's in pixels */
- if(draw_scrollbar || show_list_title(gui_list)) /* indent if there's
- a title */
+ if(draw_scrollbar || SHOW_LIST_TITLE) /* indent if there's
+ a title */
{
cursor_pos++;
icon_pos++;
@@ -279,7 +277,7 @@ void gui_list_draw(struct gui_list * gui_list)
char entry_buffer[MAX_PATH];
unsigned char *entry_name;
int current_item = gui_list->start_item +
- (show_list_title(gui_list) ? i-1 : i);
+ (SHOW_LIST_TITLE ? i-1 : i);
/* When there are less items to display than the
* current available space on the screen, we stop*/
@@ -359,7 +357,7 @@ void gui_list_draw(struct gui_list * gui_list)
if(draw_scrollbar)
{
int y_start = gui_textarea_get_ystart(display);
- if (show_list_title(gui_list))
+ if (SHOW_LIST_TITLE)
y_start += display->char_height;
int scrollbar_y_end = display->char_height *
lines + y_start;
@@ -395,7 +393,7 @@ void gui_list_select_next(struct gui_list * gui_list)
{
gui_list->selected_item+=gui_list->selected_size;
int nb_lines = gui_list->display->nb_lines;
- if (show_list_title(gui_list))
+ if (SHOW_LIST_TITLE)
nb_lines--;
int item_pos = gui_list->selected_item - gui_list->start_item;
int end_item = gui_list->start_item + nb_lines;
@@ -427,7 +425,7 @@ void gui_list_select_next(struct gui_list * gui_list)
void gui_list_select_previous(struct gui_list * gui_list)
{
int nb_lines = gui_list->display->nb_lines;
- if (show_list_title(gui_list))
+ if (SHOW_LIST_TITLE)
nb_lines--;
if( gui_list->selected_item-gui_list->selected_size < 0 )
{
@@ -478,7 +476,7 @@ void gui_list_select_next_page(struct gui_list * gui_list, int nb_lines)
}
else
{
- if (show_list_title(gui_list))
+ if (SHOW_LIST_TITLE)
nb_lines--;
nb_lines-=nb_lines%gui_list->selected_size;
gui_list->selected_item += nb_lines;
@@ -498,7 +496,7 @@ void gui_list_select_previous_page(struct gui_list * gui_list, int nb_lines)
}
else
{
- if (show_list_title(gui_list))
+ if (SHOW_LIST_TITLE)
nb_lines--;
nb_lines-=nb_lines%gui_list->selected_size;
gui_list->selected_item -= nb_lines;