From 6750d65f791f19097ce740cfbe12a873a915a897 Mon Sep 17 00:00:00 2001 From: Thomas Martitz Date: Wed, 4 Nov 2009 06:56:04 +0000 Subject: Reorder a bit in viewport.c so that we don't need stubs for checkwps. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23511 a1c6a512-1295-4272-9138-f99709370657 --- apps/gui/viewport.c | 177 ++++++++++++++++++++++++++-------------------------- 1 file changed, 90 insertions(+), 87 deletions(-) (limited to 'apps/gui') diff --git a/apps/gui/viewport.c b/apps/gui/viewport.c index d9d37f8a6a..b2fed557c0 100644 --- a/apps/gui/viewport.c +++ b/apps/gui/viewport.c @@ -38,6 +38,8 @@ #define BG_FALLBACK LCD_DEFAULT_BG #endif +static void set_default_align_flags(struct viewport *vp); + /* all below isn't needed for pc tools (i.e. checkwps/wps editor) * only viewport_parse_viewport() is */ #ifndef __PCTOOL__ @@ -57,8 +59,6 @@ static int statusbar_enabled = 0; #ifdef HAVE_LCD_BITMAP -static void set_default_align_flags(struct viewport *vp); - static struct { struct viewport* vp; int active[NB_SCREENS]; @@ -98,91 +98,6 @@ static bool showing_bars(enum screen_type screen) return false; } -void viewport_set_fullscreen(struct viewport *vp, - const enum screen_type screen) -{ - vp->x = 0; - vp->y = 0; - vp->width = screens[screen].lcdwidth; - vp->height = screens[screen].lcdheight; - -#ifdef HAVE_LCD_BITMAP - set_default_align_flags(vp); - vp->font = FONT_UI; /* default to UI to discourage SYSFONT use */ - vp->drawmode = DRMODE_SOLID; -#if LCD_DEPTH > 1 -#ifdef HAVE_REMOTE_LCD - /* We only need this test if there is a remote LCD */ - if (screen == SCREEN_MAIN) -#endif - { - vp->fg_pattern = FG_FALLBACK; - vp->bg_pattern = BG_FALLBACK; -#ifdef HAVE_LCD_COLOR - vp->lss_pattern = global_settings.lss_color; - vp->lse_pattern = global_settings.lse_color; - vp->lst_pattern = global_settings.lst_color; -#endif - } -#endif - -#if defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1 - if (screen == SCREEN_REMOTE) - { - vp->fg_pattern = LCD_REMOTE_DEFAULT_FG; - vp->bg_pattern = LCD_REMOTE_DEFAULT_BG; - } -#endif -#endif -} - -void viewport_set_defaults(struct viewport *vp, - const enum screen_type screen) -{ - /* Reposition: - 1) If the "ui viewport" setting is set, and a sbs is loaded which specifies a %Vi - return the intersection of those two viewports - 2) If only one of the "ui viewport" setting, or sbs %Vi is set - return it - 3) No user viewports set - return the full display - */ -#ifdef HAVE_LCD_BITMAP - - struct viewport *sbs_area = NULL, *user_setting = NULL; - /* get the two viewports */ - if (ui_vp_info.active[screen]) - user_setting = &ui_vp_info.vp[screen]; - if (sb_skin_get_state(screen)) - sbs_area = sb_skin_get_info_vp(screen); - /* have both? get their intersection */ - if (sbs_area && user_setting) - { - struct viewport *a = sbs_area, *b = user_setting; - /* make sure they do actually overlap, - * if they dont its user error, so use the full display - * and live with redraw problems */ - if (a->x < b->x + b->width && - a->x + a->width > b->x && - a->y < b->y + b->height && - a->y + a->height > b->y) - { - vp->x = MAX(a->x, b->x); - vp->y = MAX(a->y, b->y); - vp->width = MIN(a->x + a->width, b->x + b->width) - vp->x; - vp->height = MIN(a->y + a->height, b->y + b->height) - vp->y; - } - } - /* only one so use it */ - else if (sbs_area) - *vp = *sbs_area; - else if (user_setting) - *vp = *user_setting; - /* have neither so its fullscreen which was fixed at the beginning */ - else -#endif /* HAVE_LCD_BITMAP */ - viewport_set_fullscreen(vp, screen); -} void viewportmanager_init(void) { @@ -400,6 +315,94 @@ bool viewport_point_within_vp(const struct viewport *vp, #define ARG_STRING(_depth) "dddddgg" #endif + +void viewport_set_fullscreen(struct viewport *vp, + const enum screen_type screen) +{ + vp->x = 0; + vp->y = 0; + vp->width = screens[screen].lcdwidth; + vp->height = screens[screen].lcdheight; + +#ifdef HAVE_LCD_BITMAP + set_default_align_flags(vp); + vp->font = FONT_UI; /* default to UI to discourage SYSFONT use */ + vp->drawmode = DRMODE_SOLID; +#if LCD_DEPTH > 1 +#ifdef HAVE_REMOTE_LCD + /* We only need this test if there is a remote LCD */ + if (screen == SCREEN_MAIN) +#endif + { + vp->fg_pattern = FG_FALLBACK; + vp->bg_pattern = BG_FALLBACK; +#ifdef HAVE_LCD_COLOR + vp->lss_pattern = global_settings.lss_color; + vp->lse_pattern = global_settings.lse_color; + vp->lst_pattern = global_settings.lst_color; +#endif + } +#endif + +#if defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1 + if (screen == SCREEN_REMOTE) + { + vp->fg_pattern = LCD_REMOTE_DEFAULT_FG; + vp->bg_pattern = LCD_REMOTE_DEFAULT_BG; + } +#endif +#endif +} + +void viewport_set_defaults(struct viewport *vp, + const enum screen_type screen) +{ + /* Reposition: + 1) If the "ui viewport" setting is set, and a sbs is loaded which specifies a %Vi + return the intersection of those two viewports + 2) If only one of the "ui viewport" setting, or sbs %Vi is set + return it + 3) No user viewports set + return the full display + */ +#if defined(HAVE_LCD_BITMAP) && !defined(__PCTOOL__) + + struct viewport *sbs_area = NULL, *user_setting = NULL; + /* get the two viewports */ + if (ui_vp_info.active[screen]) + user_setting = &ui_vp_info.vp[screen]; + if (sb_skin_get_state(screen)) + sbs_area = sb_skin_get_info_vp(screen); + /* have both? get their intersection */ + if (sbs_area && user_setting) + { + struct viewport *a = sbs_area, *b = user_setting; + /* make sure they do actually overlap, + * if they dont its user error, so use the full display + * and live with redraw problems */ + if (a->x < b->x + b->width && + a->x + a->width > b->x && + a->y < b->y + b->height && + a->y + a->height > b->y) + { + vp->x = MAX(a->x, b->x); + vp->y = MAX(a->y, b->y); + vp->width = MIN(a->x + a->width, b->x + b->width) - vp->x; + vp->height = MIN(a->y + a->height, b->y + b->height) - vp->y; + } + } + /* only one so use it */ + else if (sbs_area) + *vp = *sbs_area; + else if (user_setting) + *vp = *user_setting; + /* have neither so its fullscreen which was fixed at the beginning */ + else +#endif /* HAVE_LCD_BITMAP */ + viewport_set_fullscreen(vp, screen); +} + + #ifdef HAVE_LCD_BITMAP static void set_default_align_flags(struct viewport *vp) -- cgit v1.2.3