forked from len0rd/rockbox
Replaced the common for(i = 0; i < NB_SCREENS; i++) loop with a macro that just expands to i = 0; instead of the for() loop if NB_SCREENS == 1. Reduces binary size on platforms with only one screen.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@7805 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
c83216ad89
commit
edf5a70e27
7 changed files with 36 additions and 30 deletions
|
@ -379,7 +379,7 @@ void gui_synclist_init(
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
for(i = 0;i < NB_SCREENS;i++)
|
FOR_NB_SCREENS(i)
|
||||||
{
|
{
|
||||||
gui_list_init(&(lists->gui_list[i]),
|
gui_list_init(&(lists->gui_list[i]),
|
||||||
callback_get_item_icon,
|
callback_get_item_icon,
|
||||||
|
@ -392,7 +392,7 @@ void gui_synclist_init(
|
||||||
void gui_synclist_set_nb_items(struct gui_synclist * lists, int nb_items)
|
void gui_synclist_set_nb_items(struct gui_synclist * lists, int nb_items)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
for(i = 0;i < NB_SCREENS;i++)
|
FOR_NB_SCREENS(i)
|
||||||
{
|
{
|
||||||
gui_list_set_nb_items(&(lists->gui_list[i]), nb_items);
|
gui_list_set_nb_items(&(lists->gui_list[i]), nb_items);
|
||||||
}
|
}
|
||||||
|
@ -401,28 +401,28 @@ void gui_synclist_set_nb_items(struct gui_synclist * lists, int nb_items)
|
||||||
void gui_synclist_draw(struct gui_synclist * lists)
|
void gui_synclist_draw(struct gui_synclist * lists)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
for(i = 0;i < NB_SCREENS;i++)
|
FOR_NB_SCREENS(i)
|
||||||
gui_list_draw(&(lists->gui_list[i]));
|
gui_list_draw(&(lists->gui_list[i]));
|
||||||
}
|
}
|
||||||
|
|
||||||
void gui_synclist_select_item(struct gui_synclist * lists, int item_number)
|
void gui_synclist_select_item(struct gui_synclist * lists, int item_number)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
for(i = 0;i < NB_SCREENS;i++)
|
FOR_NB_SCREENS(i)
|
||||||
gui_list_select_item(&(lists->gui_list[i]), item_number);
|
gui_list_select_item(&(lists->gui_list[i]), item_number);
|
||||||
}
|
}
|
||||||
|
|
||||||
void gui_synclist_select_next(struct gui_synclist * lists)
|
void gui_synclist_select_next(struct gui_synclist * lists)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
for(i = 0;i < NB_SCREENS;i++)
|
FOR_NB_SCREENS(i)
|
||||||
gui_list_select_next(&(lists->gui_list[i]));
|
gui_list_select_next(&(lists->gui_list[i]));
|
||||||
}
|
}
|
||||||
|
|
||||||
void gui_synclist_select_previous(struct gui_synclist * lists)
|
void gui_synclist_select_previous(struct gui_synclist * lists)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
for(i = 0;i < NB_SCREENS;i++)
|
FOR_NB_SCREENS(i)
|
||||||
gui_list_select_previous(&(lists->gui_list[i]));
|
gui_list_select_previous(&(lists->gui_list[i]));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -430,7 +430,7 @@ void gui_synclist_select_next_page(struct gui_synclist * lists,
|
||||||
enum screen_type screen)
|
enum screen_type screen)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
for(i = 0;i < NB_SCREENS;i++)
|
FOR_NB_SCREENS(i)
|
||||||
gui_list_select_next_page(&(lists->gui_list[i]),
|
gui_list_select_next_page(&(lists->gui_list[i]),
|
||||||
screens[screen].nb_lines);
|
screens[screen].nb_lines);
|
||||||
}
|
}
|
||||||
|
@ -439,7 +439,7 @@ void gui_synclist_select_previous_page(struct gui_synclist * lists,
|
||||||
enum screen_type screen)
|
enum screen_type screen)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
for(i = 0;i < NB_SCREENS;i++)
|
FOR_NB_SCREENS(i)
|
||||||
gui_list_select_previous_page(&(lists->gui_list[i]),
|
gui_list_select_previous_page(&(lists->gui_list[i]),
|
||||||
screens[screen].nb_lines);
|
screens[screen].nb_lines);
|
||||||
}
|
}
|
||||||
|
@ -447,28 +447,28 @@ void gui_synclist_select_previous_page(struct gui_synclist * lists,
|
||||||
void gui_synclist_add_item(struct gui_synclist * lists)
|
void gui_synclist_add_item(struct gui_synclist * lists)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
for(i = 0;i < NB_SCREENS;i++)
|
FOR_NB_SCREENS(i)
|
||||||
gui_list_add_item(&(lists->gui_list[i]));
|
gui_list_add_item(&(lists->gui_list[i]));
|
||||||
}
|
}
|
||||||
|
|
||||||
void gui_synclist_del_item(struct gui_synclist * lists)
|
void gui_synclist_del_item(struct gui_synclist * lists)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
for(i = 0;i < NB_SCREENS;i++)
|
FOR_NB_SCREENS(i)
|
||||||
gui_list_del_item(&(lists->gui_list[i]));
|
gui_list_del_item(&(lists->gui_list[i]));
|
||||||
}
|
}
|
||||||
|
|
||||||
void gui_synclist_limit_scroll(struct gui_synclist * lists, bool scroll)
|
void gui_synclist_limit_scroll(struct gui_synclist * lists, bool scroll)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
for(i = 0;i < NB_SCREENS;i++)
|
FOR_NB_SCREENS(i)
|
||||||
gui_list_limit_scroll(&(lists->gui_list[i]), scroll);
|
gui_list_limit_scroll(&(lists->gui_list[i]), scroll);
|
||||||
}
|
}
|
||||||
|
|
||||||
void gui_synclist_flash(struct gui_synclist * lists)
|
void gui_synclist_flash(struct gui_synclist * lists)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
for(i = 0;i < NB_SCREENS;i++)
|
FOR_NB_SCREENS(i)
|
||||||
gui_list_flash(&(lists->gui_list[i]));
|
gui_list_flash(&(lists->gui_list[i]));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -128,7 +128,7 @@ void gui_select_draw(struct gui_select * select, struct screen * display)
|
||||||
void gui_syncselect_draw(struct gui_select * select)
|
void gui_syncselect_draw(struct gui_select * select)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
for(i=0;i<NB_SCREENS;i++)
|
FOR_NB_SCREENS(i)
|
||||||
gui_select_draw(select, &(screens[i]));
|
gui_select_draw(select, &(screens[i]));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -207,7 +207,7 @@ void gui_syncsplash(int ticks, bool center, const char *fmt, ...)
|
||||||
va_list ap;
|
va_list ap;
|
||||||
int i;
|
int i;
|
||||||
va_start( ap, fmt );
|
va_start( ap, fmt );
|
||||||
for(i=0;i<NB_SCREENS;i++)
|
FOR_NB_SCREENS(i)
|
||||||
internal_splash(&(screens[i]), center, fmt, ap);
|
internal_splash(&(screens[i]), center, fmt, ap);
|
||||||
va_end( ap );
|
va_end( ap );
|
||||||
|
|
||||||
|
|
|
@ -500,7 +500,7 @@ void gui_statusbar_time(struct screen * display, int hour, int minute)
|
||||||
void gui_syncstatusbar_init(struct gui_syncstatusbar * bars)
|
void gui_syncstatusbar_init(struct gui_syncstatusbar * bars)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
for(i = 0;i < NB_SCREENS;i++) {
|
FOR_NB_SCREENS(i) {
|
||||||
gui_statusbar_init( &(bars->statusbars[i]) );
|
gui_statusbar_init( &(bars->statusbars[i]) );
|
||||||
gui_statusbar_set_screen( &(bars->statusbars[i]), &(screens[i]) );
|
gui_statusbar_set_screen( &(bars->statusbars[i]), &(screens[i]) );
|
||||||
}
|
}
|
||||||
|
@ -510,7 +510,7 @@ void gui_syncstatusbar_draw(struct gui_syncstatusbar * bars,
|
||||||
bool force_redraw)
|
bool force_redraw)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
for(i = 0;i < NB_SCREENS;i++) {
|
FOR_NB_SCREENS(i) {
|
||||||
gui_statusbar_draw( &(bars->statusbars[i]), force_redraw );
|
gui_statusbar_draw( &(bars->statusbars[i]), force_redraw );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -153,7 +153,7 @@ void screen_init(struct screen * screen, enum screen_type screen_type)
|
||||||
void screen_access_init(void)
|
void screen_access_init(void)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
for(i=0;i<NB_SCREENS;i++)
|
FOR_NB_SCREENS(i)
|
||||||
screen_init(&screens[i], i);
|
screen_init(&screens[i], i);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -36,6 +36,12 @@ enum screen_type {
|
||||||
#define NB_SCREENS 1
|
#define NB_SCREENS 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if NB_SCREENS == 1
|
||||||
|
#define FOR_NB_SCREENS(i) i = 0;
|
||||||
|
#else
|
||||||
|
#define FOR_NB_SCREENS(i) for(i = 0; i < NB_SCREENS; i++)
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_LCD_CHARCELLS
|
#ifdef HAVE_LCD_CHARCELLS
|
||||||
#define MAX_LINES_ON_SCREEN 2
|
#define MAX_LINES_ON_SCREEN 2
|
||||||
#endif
|
#endif
|
||||||
|
|
26
apps/tree.c
26
apps/tree.c
|
@ -195,10 +195,10 @@ bool check_rockboxdir(void)
|
||||||
if(!dir)
|
if(!dir)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
for(i = 0;i < NB_SCREENS;++i)
|
FOR_NB_SCREENS(i)
|
||||||
screens[i].clear_display();
|
screens[i].clear_display();
|
||||||
gui_syncsplash(HZ*2, true, str(LANG_NO_ROCKBOX_DIR));
|
gui_syncsplash(HZ*2, true, str(LANG_NO_ROCKBOX_DIR));
|
||||||
for(i = 0;i < NB_SCREENS;++i)
|
FOR_NB_SCREENS(i)
|
||||||
screens[i].clear_display();
|
screens[i].clear_display();
|
||||||
gui_syncsplash(HZ*2, true, str(LANG_INSTALLATION_INCOMPLETE));
|
gui_syncsplash(HZ*2, true, str(LANG_INSTALLATION_INCOMPLETE));
|
||||||
return false;
|
return false;
|
||||||
|
@ -219,7 +219,7 @@ void browse_root(void)
|
||||||
|
|
||||||
#ifdef HAVE_LCD_CHARCELLS
|
#ifdef HAVE_LCD_CHARCELLS
|
||||||
int i;
|
int i;
|
||||||
for(i = 0;i < NB_SCREENS;++i)
|
FOR_NB_SCREENS(i)
|
||||||
screens[i].double_height(false);
|
screens[i].double_height(false);
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAS_BUTTONBAR
|
#ifdef HAS_BUTTONBAR
|
||||||
|
@ -320,7 +320,7 @@ static int update_dir(void)
|
||||||
{
|
{
|
||||||
/* dir full */
|
/* dir full */
|
||||||
int i;
|
int i;
|
||||||
for(i = 0;i < NB_SCREENS;++i)
|
FOR_NB_SCREENS(i)
|
||||||
{
|
{
|
||||||
gui_textarea_clear(&screens[i]);
|
gui_textarea_clear(&screens[i]);
|
||||||
#ifdef HAVE_LCD_CHARCELLS
|
#ifdef HAVE_LCD_CHARCELLS
|
||||||
|
@ -332,7 +332,7 @@ static int update_dir(void)
|
||||||
gui_textarea_update(&screens[i]);
|
gui_textarea_update(&screens[i]);
|
||||||
}
|
}
|
||||||
sleep(HZ*2);
|
sleep(HZ*2);
|
||||||
for(i = 0;i < NB_SCREENS;++i)
|
FOR_NB_SCREENS(i)
|
||||||
gui_textarea_clear(&screens[i]);
|
gui_textarea_clear(&screens[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -560,7 +560,7 @@ static bool dirbrowse(void)
|
||||||
bool stop = false;
|
bool stop = false;
|
||||||
unsigned int button;
|
unsigned int button;
|
||||||
int i;
|
int i;
|
||||||
for(i = 0;i < NB_SCREENS;++i)
|
FOR_NB_SCREENS(i)
|
||||||
{
|
{
|
||||||
gui_textarea_clear(&screens[i]);
|
gui_textarea_clear(&screens[i]);
|
||||||
screens[i].puts(0,0,str(LANG_BOOT_CHANGED));
|
screens[i].puts(0,0,str(LANG_BOOT_CHANGED));
|
||||||
|
@ -695,7 +695,7 @@ static bool dirbrowse(void)
|
||||||
if (*tc.dirfilter < NUM_FILTER_MODES)
|
if (*tc.dirfilter < NUM_FILTER_MODES)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
for(i = 0;i < NB_SCREENS;++i)
|
FOR_NB_SCREENS(i)
|
||||||
screens[i].stop_scroll();
|
screens[i].stop_scroll();
|
||||||
if (main_menu())
|
if (main_menu())
|
||||||
reload_dir = true;
|
reload_dir = true;
|
||||||
|
@ -878,7 +878,7 @@ static bool dirbrowse(void)
|
||||||
if (start_wps && audio_status() )
|
if (start_wps && audio_status() )
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
for(i = 0;i < NB_SCREENS;++i)
|
FOR_NB_SCREENS(i)
|
||||||
screens[i].stop_scroll();
|
screens[i].stop_scroll();
|
||||||
if (wps_show() == SYS_USB_CONNECTED)
|
if (wps_show() == SYS_USB_CONNECTED)
|
||||||
reload_dir = true;
|
reload_dir = true;
|
||||||
|
@ -1077,7 +1077,7 @@ static bool add_dir(char* dirname, int len, int fd)
|
||||||
plsize++;
|
plsize++;
|
||||||
snprintf(buf, sizeof buf, "%d", plsize);
|
snprintf(buf, sizeof buf, "%d", plsize);
|
||||||
#ifdef HAVE_LCD_BITMAP
|
#ifdef HAVE_LCD_BITMAP
|
||||||
for(i = 0;i < NB_SCREENS;++i)
|
FOR_NB_SCREENS(i)
|
||||||
{
|
{
|
||||||
gui_textarea_clear(&screens[i]);
|
gui_textarea_clear(&screens[i]);
|
||||||
screens[i].puts(0,4,buf);
|
screens[i].puts(0,4,buf);
|
||||||
|
@ -1094,7 +1094,7 @@ static bool add_dir(char* dirname, int len, int fd)
|
||||||
x=9;
|
x=9;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for(i = 0;i < NB_SCREENS;++i) {
|
FOR_NB_SCREENS(i) {
|
||||||
screens[i].puts(x,0,buf);
|
screens[i].puts(x,0,buf);
|
||||||
gui_textarea_update(&screens[i]);
|
gui_textarea_update(&screens[i]);
|
||||||
}
|
}
|
||||||
|
@ -1119,7 +1119,7 @@ bool create_playlist(void)
|
||||||
|
|
||||||
snprintf(filename, sizeof filename, "%s.m3u",
|
snprintf(filename, sizeof filename, "%s.m3u",
|
||||||
tc.currdir[1] ? tc.currdir : "/root");
|
tc.currdir[1] ? tc.currdir : "/root");
|
||||||
for(i = 0;i < NB_SCREENS;++i)
|
FOR_NB_SCREENS(i)
|
||||||
{
|
{
|
||||||
gui_textarea_clear(&screens[i]);
|
gui_textarea_clear(&screens[i]);
|
||||||
screens[i].puts(0,0,str(LANG_CREATING));
|
screens[i].puts(0,0,str(LANG_CREATING));
|
||||||
|
@ -1357,7 +1357,7 @@ void tree_restore(void)
|
||||||
{
|
{
|
||||||
/* Print "Scanning disk..." to the display. */
|
/* Print "Scanning disk..." to the display. */
|
||||||
int i;
|
int i;
|
||||||
for(i = 0;i < NB_SCREENS;++i)
|
FOR_NB_SCREENS(i)
|
||||||
{
|
{
|
||||||
screens[i].putsxy((LCD_WIDTH/2) -
|
screens[i].putsxy((LCD_WIDTH/2) -
|
||||||
((strlen(str(LANG_DIRCACHE_BUILDING)) *
|
((strlen(str(LANG_DIRCACHE_BUILDING)) *
|
||||||
|
@ -1370,7 +1370,7 @@ void tree_restore(void)
|
||||||
dircache_build(global_settings.dircache_size);
|
dircache_build(global_settings.dircache_size);
|
||||||
|
|
||||||
/* Clean the text when we are done. */
|
/* Clean the text when we are done. */
|
||||||
for(i = 0;i < NB_SCREENS;++i)
|
FOR_NB_SCREENS(i)
|
||||||
{
|
{
|
||||||
gui_textarea_clear(&screens[i]);
|
gui_textarea_clear(&screens[i]);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue