diff options
author | Björn Stenberg <bjorn@haxx.se> | 2011-10-15 19:35:02 +0000 |
---|---|---|
committer | Björn Stenberg <bjorn@haxx.se> | 2011-10-15 19:35:02 +0000 |
commit | 0942e2a0f71d809c1d7f2606cbddfa1d4beacb87 (patch) | |
tree | ce2fbdea468cb8223598c546fee765a10660a0b0 /apps/gui/list.c | |
parent | f301ac05f9dd6ace2355fa822bd61d454c2c4f28 (diff) | |
download | rockbox-0942e2a0f71d809c1d7f2606cbddfa1d4beacb87.tar.gz rockbox-0942e2a0f71d809c1d7f2606cbddfa1d4beacb87.zip |
Changed the FOR_NB_SCREENS macro to always be a for loop that declares its own loop variable. This removes the need to declare this variable in the outer scope.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30756 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/gui/list.c')
-rw-r--r-- | apps/gui/list.c | 18 |
1 files changed, 4 insertions, 14 deletions
diff --git a/apps/gui/list.c b/apps/gui/list.c index e42cbb8e64..1a90ff9e40 100644 --- a/apps/gui/list.c +++ b/apps/gui/list.c | |||
@@ -80,7 +80,7 @@ void list_init(void) | |||
80 | 80 | ||
81 | static void list_init_viewports(struct gui_synclist *list) | 81 | static void list_init_viewports(struct gui_synclist *list) |
82 | { | 82 | { |
83 | int i, parent_used; | 83 | int parent_used; |
84 | 84 | ||
85 | parent_used = (*list->parent != &parent[SCREEN_MAIN]); | 85 | parent_used = (*list->parent != &parent[SCREEN_MAIN]); |
86 | 86 | ||
@@ -156,7 +156,6 @@ void gui_synclist_init(struct gui_synclist * gui_list, | |||
156 | int selected_size, struct viewport list_parent[NB_SCREENS] | 156 | int selected_size, struct viewport list_parent[NB_SCREENS] |
157 | ) | 157 | ) |
158 | { | 158 | { |
159 | int i; | ||
160 | gui_list->callback_get_item_icon = NULL; | 159 | gui_list->callback_get_item_icon = NULL; |
161 | gui_list->callback_get_item_name = callback_get_item_name; | 160 | gui_list->callback_get_item_name = callback_get_item_name; |
162 | gui_list->callback_speak_item = NULL; | 161 | gui_list->callback_speak_item = NULL; |
@@ -237,7 +236,6 @@ int gui_list_get_item_offset(struct gui_synclist * gui_list, | |||
237 | */ | 236 | */ |
238 | void gui_synclist_draw(struct gui_synclist *gui_list) | 237 | void gui_synclist_draw(struct gui_synclist *gui_list) |
239 | { | 238 | { |
240 | int i; | ||
241 | if (list_is_dirty(gui_list)) | 239 | if (list_is_dirty(gui_list)) |
242 | { | 240 | { |
243 | list_init_viewports(gui_list); | 241 | list_init_viewports(gui_list); |
@@ -345,7 +343,6 @@ void gui_synclist_speak_item(struct gui_synclist *lists) | |||
345 | */ | 343 | */ |
346 | void gui_synclist_select_item(struct gui_synclist * gui_list, int item_number) | 344 | void gui_synclist_select_item(struct gui_synclist * gui_list, int item_number) |
347 | { | 345 | { |
348 | int i; | ||
349 | if (item_number >= gui_list->nb_items || item_number < 0) | 346 | if (item_number >= gui_list->nb_items || item_number < 0) |
350 | return; | 347 | return; |
351 | if (item_number != gui_list->selected_item) | 348 | if (item_number != gui_list->selected_item) |
@@ -380,13 +377,12 @@ static void gui_list_select_at_offset(struct gui_synclist * gui_list, | |||
380 | } | 377 | } |
381 | else if (gui_list->show_selection_marker == false) | 378 | else if (gui_list->show_selection_marker == false) |
382 | { | 379 | { |
383 | int i, nb_lines, screen_top; | ||
384 | FOR_NB_SCREENS(i) | 380 | FOR_NB_SCREENS(i) |
385 | { | 381 | { |
386 | nb_lines = list_get_nb_lines(gui_list, i); | 382 | int nb_lines = list_get_nb_lines(gui_list, i); |
387 | if (offset > 0) | 383 | if (offset > 0) |
388 | { | 384 | { |
389 | screen_top = MAX(0, gui_list->nb_items - nb_lines); | 385 | int screen_top = MAX(0, gui_list->nb_items - nb_lines); |
390 | gui_list->start_item[i] = MIN(screen_top, gui_list->start_item[i] + | 386 | gui_list->start_item[i] = MIN(screen_top, gui_list->start_item[i] + |
391 | gui_list->selected_size); | 387 | gui_list->selected_size); |
392 | gui_list->selected_item = gui_list->start_item[i]; | 388 | gui_list->selected_item = gui_list->start_item[i]; |
@@ -452,7 +448,6 @@ void gui_synclist_set_title(struct gui_synclist * gui_list, | |||
452 | gui_list->title = title; | 448 | gui_list->title = title; |
453 | gui_list->title_icon = icon; | 449 | gui_list->title_icon = icon; |
454 | #ifdef HAVE_LCD_BITMAP | 450 | #ifdef HAVE_LCD_BITMAP |
455 | int i; | ||
456 | FOR_NB_SCREENS(i) | 451 | FOR_NB_SCREENS(i) |
457 | sb_set_title_text(title, icon, i); | 452 | sb_set_title_text(title, icon, i); |
458 | #endif | 453 | #endif |
@@ -461,9 +456,6 @@ void gui_synclist_set_title(struct gui_synclist * gui_list, | |||
461 | 456 | ||
462 | void gui_synclist_set_nb_items(struct gui_synclist * lists, int nb_items) | 457 | void gui_synclist_set_nb_items(struct gui_synclist * lists, int nb_items) |
463 | { | 458 | { |
464 | #ifdef HAVE_LCD_BITMAP | ||
465 | int i; | ||
466 | #endif | ||
467 | lists->nb_items = nb_items; | 459 | lists->nb_items = nb_items; |
468 | #ifdef HAVE_LCD_BITMAP | 460 | #ifdef HAVE_LCD_BITMAP |
469 | FOR_NB_SCREENS(i) | 461 | FOR_NB_SCREENS(i) |
@@ -531,7 +523,6 @@ void gui_synclist_limit_scroll(struct gui_synclist * lists, bool scroll) | |||
531 | */ | 523 | */ |
532 | static void gui_synclist_scroll_right(struct gui_synclist * lists) | 524 | static void gui_synclist_scroll_right(struct gui_synclist * lists) |
533 | { | 525 | { |
534 | int i; | ||
535 | FOR_NB_SCREENS(i) | 526 | FOR_NB_SCREENS(i) |
536 | { | 527 | { |
537 | /* FIXME: This is a fake right boundry limiter. there should be some | 528 | /* FIXME: This is a fake right boundry limiter. there should be some |
@@ -549,7 +540,6 @@ static void gui_synclist_scroll_right(struct gui_synclist * lists) | |||
549 | */ | 540 | */ |
550 | static void gui_synclist_scroll_left(struct gui_synclist * lists) | 541 | static void gui_synclist_scroll_left(struct gui_synclist * lists) |
551 | { | 542 | { |
552 | int i; | ||
553 | FOR_NB_SCREENS(i) | 543 | FOR_NB_SCREENS(i) |
554 | { | 544 | { |
555 | lists->offset_position[i] -= offset_step; | 545 | lists->offset_position[i] -= offset_step; |
@@ -817,7 +807,7 @@ static const char* simplelist_static_getname(int item, | |||
817 | bool simplelist_show_list(struct simplelist_info *info) | 807 | bool simplelist_show_list(struct simplelist_info *info) |
818 | { | 808 | { |
819 | struct gui_synclist lists; | 809 | struct gui_synclist lists; |
820 | int action, old_line_count = simplelist_line_count, i; | 810 | int action, old_line_count = simplelist_line_count; |
821 | list_get_name *getname; | 811 | list_get_name *getname; |
822 | int wrap = LIST_WRAP_UNLESS_HELD; | 812 | int wrap = LIST_WRAP_UNLESS_HELD; |
823 | if (info->get_name) | 813 | if (info->get_name) |