forked from len0rd/rockbox
Fix a few problems with RTL, statusbar and custom ui viewport.
*text in statusbar jumped around *custom ui vp wasn't refreshed properly on language changing. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23053 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
e1009476ca
commit
80003bc4a4
5 changed files with 25 additions and 5 deletions
|
|
@ -530,6 +530,7 @@ int ft_enter(struct tree_context* c)
|
|||
set_file(buf, (char *)global_settings.lang_file,
|
||||
MAX_FILENAME);
|
||||
talk_init(); /* use voice of same language */
|
||||
viewportmanager_theme_changed(THEME_LANGUAGE);
|
||||
splash(HZ, ID2P(LANG_LANGUAGE_LOADED));
|
||||
}
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -706,6 +706,7 @@ static int parse_viewport(const char *wps_bufptr,
|
|||
if (!(ptr = viewport_parse_viewport(vp, screen, ptr, '|')))
|
||||
return WPS_ERROR_INVALID_PARAM;
|
||||
|
||||
vp->flags &= ~VP_FLAG_IS_RTL; /* ignore rright-to-left languages */
|
||||
/* Check for trailing | */
|
||||
if (*ptr != '|')
|
||||
return WPS_ERROR_INVALID_PARAM;
|
||||
|
|
|
|||
|
|
@ -175,6 +175,7 @@ static void gui_statusbar_init(struct gui_statusbar * bar)
|
|||
|
||||
#define GET_RECT(vp, vals,display) do { \
|
||||
viewport_set_fullscreen(&(vp), (display)->screen_type); \
|
||||
(vp).flags &= ~VP_FLAG_IS_RTL; \
|
||||
(vp).height = STATUSBAR_HEIGHT; \
|
||||
(vp).x = STATUSBAR_X_POS; \
|
||||
if ((vals) != STATUSBAR_BOTTOM) \
|
||||
|
|
|
|||
|
|
@ -60,6 +60,7 @@
|
|||
#endif
|
||||
|
||||
static int statusbar_enabled = 0;
|
||||
static void viewport_rtl_handler(struct viewport *vp);
|
||||
|
||||
#ifdef HAVE_LCD_BITMAP
|
||||
|
||||
|
|
@ -107,6 +108,7 @@ void viewport_set_fullscreen(struct viewport *vp, enum screen_type screen)
|
|||
vp->width = screens[screen].lcdwidth;
|
||||
|
||||
#ifdef HAVE_LCD_BITMAP
|
||||
viewport_rtl_handler(vp);
|
||||
vp->drawmode = DRMODE_SOLID;
|
||||
vp->font = FONT_UI; /* default to UI to discourage SYSFONT use */
|
||||
|
||||
|
|
@ -139,6 +141,7 @@ void viewport_set_fullscreen(struct viewport *vp, enum screen_type screen)
|
|||
vp->bg_pattern = LCD_REMOTE_DEFAULT_BG;
|
||||
}
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
void viewport_set_defaults(struct viewport *vp, enum screen_type screen)
|
||||
|
|
@ -150,10 +153,6 @@ void viewport_set_defaults(struct viewport *vp, enum screen_type screen)
|
|||
#endif
|
||||
viewport_set_fullscreen(vp, screen);
|
||||
|
||||
#ifdef HAVE_LCD_BITMAP
|
||||
vp->flags &= ~VP_FLAG_IS_RTL;
|
||||
vp->flags |= lang_is_rtl() ? VP_FLAG_IS_RTL : 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
void viewportmanager_init(void)
|
||||
|
|
@ -239,6 +238,11 @@ void viewportmanager_theme_changed(int which)
|
|||
/* and point to it */
|
||||
ui_vp_info.vp = custom_vp;
|
||||
}
|
||||
else if (which & THEME_LANGUAGE)
|
||||
{ /* THEME_UI_VIEWPORT handles rtl already */
|
||||
FOR_NB_SCREENS(i)
|
||||
viewport_rtl_handler(&custom_vp[i]);
|
||||
}
|
||||
if (which & THEME_STATUSBAR)
|
||||
{
|
||||
statusbar_enabled = VP_SB_HIDE_ALL;
|
||||
|
|
@ -354,6 +358,17 @@ bool viewport_point_within_vp(const struct viewport *vp, int x, int y)
|
|||
#endif
|
||||
|
||||
#ifdef HAVE_LCD_BITMAP
|
||||
|
||||
static void viewport_rtl_handler(struct viewport *vp)
|
||||
{
|
||||
#ifndef __PCTOOL__
|
||||
if (UNLIKELY(lang_is_rtl()))
|
||||
vp->flags |= VP_FLAG_IS_RTL;
|
||||
else
|
||||
#endif
|
||||
vp->flags &= ~VP_FLAG_IS_RTL;
|
||||
}
|
||||
|
||||
const char* viewport_parse_viewport(struct viewport *vp,
|
||||
enum screen_type screen,
|
||||
const char *bufptr,
|
||||
|
|
@ -436,6 +451,7 @@ const char* viewport_parse_viewport(struct viewport *vp,
|
|||
|
||||
/* Set the defaults for fields not user-specified */
|
||||
vp->drawmode = DRMODE_SOLID;
|
||||
viewport_rtl_handler(vp);
|
||||
|
||||
return ptr;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -59,6 +59,7 @@ void viewport_set_defaults(struct viewport *vp, enum screen_type screen);
|
|||
#define THEME_STATUSBAR (BIT_N(0))
|
||||
#define THEME_UI_VIEWPORT (BIT_N(1))
|
||||
#define THEME_BUTTONBAR (BIT_N(2))
|
||||
#define THEME_LANGUAGE (BIT_N(3))
|
||||
#define THEME_ALL (~(0u))
|
||||
|
||||
#define VP_SB_HIDE_ALL 0
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue