summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
authorThomas Martitz <kugel@rockbox.org>2009-10-09 18:39:34 +0000
committerThomas Martitz <kugel@rockbox.org>2009-10-09 18:39:34 +0000
commit80003bc4a4c2564c15e202a73bf2f2103e9a6407 (patch)
treee9362aad8197e92cd0a2a90e1484f695f51493ed /apps
parente1009476ca7df7e895199a66aef470f54502641f (diff)
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
Diffstat (limited to 'apps')
-rw-r--r--apps/filetree.c1
-rw-r--r--apps/gui/skin_engine/skin_parser.c1
-rw-r--r--apps/gui/statusbar.c3
-rw-r--r--apps/gui/viewport.c24
-rw-r--r--apps/gui/viewport.h1
5 files changed, 25 insertions, 5 deletions
diff --git a/apps/filetree.c b/apps/filetree.c
index d7e77226e5..8fbc39fa67 100644
--- a/apps/filetree.c
+++ b/apps/filetree.c
@@ -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;
diff --git a/apps/gui/skin_engine/skin_parser.c b/apps/gui/skin_engine/skin_parser.c
index 7e2ceabdb2..e7c9f4fb52 100644
--- a/apps/gui/skin_engine/skin_parser.c
+++ b/apps/gui/skin_engine/skin_parser.c
@@ -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;
diff --git a/apps/gui/statusbar.c b/apps/gui/statusbar.c
index 0a9d539223..8edc824e2e 100644
--- a/apps/gui/statusbar.c
+++ b/apps/gui/statusbar.c
@@ -174,7 +174,8 @@ static void gui_statusbar_init(struct gui_statusbar * bar)
}
#define GET_RECT(vp, vals,display) do { \
- viewport_set_fullscreen(&(vp), (display)->screen_type); \
+ 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) \
diff --git a/apps/gui/viewport.c b/apps/gui/viewport.c
index 6e1541021d..e12157530f 100644
--- a/apps/gui/viewport.c
+++ b/apps/gui/viewport.c
@@ -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;
}
diff --git a/apps/gui/viewport.h b/apps/gui/viewport.h
index 9cabc00468..9ab0a71439 100644
--- a/apps/gui/viewport.h
+++ b/apps/gui/viewport.h
@@ -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