summaryrefslogtreecommitdiff
path: root/apps/gui
diff options
context:
space:
mode:
authorTomer Shalev <shalev.tomer@gmail.com>2009-10-05 21:13:55 +0000
committerTomer Shalev <shalev.tomer@gmail.com>2009-10-05 21:13:55 +0000
commitb0a99383211c4d6aaa8558978dc6d617b018a9c7 (patch)
treefa92234c262cd8431c4e2e76511a8fb946273d18 /apps/gui
parent5abd9686f47c4e890677b4c9cb0d8f750642b5da (diff)
Add rtl flagging to viewport_set_defaults(), and ensure that
viewportmanager_theme_changed() is called during font loading git-svn-id: svn://svn.rockbox.org/rockbox/trunk@22971 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/gui')
-rw-r--r--apps/gui/bitmap/list.c16
-rw-r--r--apps/gui/viewport.c5
2 files changed, 8 insertions, 13 deletions
diff --git a/apps/gui/bitmap/list.c b/apps/gui/bitmap/list.c
index 953ce1b1d7..5183880aa8 100644
--- a/apps/gui/bitmap/list.c
+++ b/apps/gui/bitmap/list.c
@@ -40,13 +40,9 @@
#include "sound.h"
#include "misc.h"
#include "viewport.h"
-#include "language.h"
#define ICON_PADDING 1
-
-#define UPDATE_RTL(vp) \
- (vp)->flags &= ~VP_IS_RTL; \
- (vp)->flags |= lang_is_rtl() ? VP_IS_RTL : 0;
+#define IS_RTL(vp) (((vp)->flags & VP_IS_RTL) != 0)
/* these are static to make scrolling work */
static struct viewport list_text[NB_SCREENS], title_text[NB_SCREENS];
@@ -80,16 +76,14 @@ static bool draw_title(struct screen *display, struct gui_synclist *list)
if (!list_display_title(list, screen))
return false;
*title_text_vp = *(list->parent[screen]);
- UPDATE_RTL(title_text_vp);
title_text_vp->height = font_get(title_text_vp->font)->height;
if (list->title_icon != Icon_NOICON && global_settings.show_icons)
{
struct viewport title_icon = *title_text_vp;
- UPDATE_RTL(&title_icon);
title_icon.width = get_icon_width(screen) + ICON_PADDING * 2;
- if (lang_is_rtl())
+ if (IS_RTL(&title_icon))
{
title_icon.x = title_text_vp->width - ICON_PADDING -
get_icon_width(screen);
@@ -129,7 +123,7 @@ void list_draw(struct screen *display, struct gui_synclist *list)
#ifdef HAVE_LCD_COLOR
unsigned char cur_line = 0;
#endif
- int item_offset, is_rtl = lang_is_rtl();
+ int item_offset;
bool show_title;
struct viewport *list_text_vp = &list_text[screen];
@@ -138,7 +132,6 @@ void list_draw(struct screen *display, struct gui_synclist *list)
display->clear_viewport();
display->scroll_stop(list_text_vp);
*list_text_vp = *parent;
- UPDATE_RTL(list_text_vp);
if ((show_title = draw_title(display, list)))
{
list_text_vp->y += line_height;
@@ -179,7 +172,6 @@ void list_draw(struct screen *display, struct gui_synclist *list)
/* setup icon placement */
list_icons = *list_text_vp;
- UPDATE_RTL(&list_icons);
int icon_count = global_settings.show_icons &&
(list->callback_get_item_icon != NULL) ? 1 : 0;
if (show_cursor)
@@ -188,7 +180,7 @@ void list_draw(struct screen *display, struct gui_synclist *list)
{
list_icons.width = icon_width * icon_count;
list_text_vp->width -= list_icons.width + ICON_PADDING;
- if (is_rtl)
+ if (IS_RTL(&list_icons))
list_icons.x += list_text_vp->width;
else
list_text_vp->x += list_icons.width + ICON_PADDING;
diff --git a/apps/gui/viewport.c b/apps/gui/viewport.c
index ff3a110936..bfdd1ce04a 100644
--- a/apps/gui/viewport.c
+++ b/apps/gui/viewport.c
@@ -55,7 +55,7 @@
#include "system.h"
#include "statusbar.h"
#include "appevents.h"
-
+#include "language.h"
static int statusbar_enabled = 0;
@@ -147,6 +147,9 @@ void viewport_set_defaults(struct viewport *vp, enum screen_type screen)
else
#endif
viewport_set_fullscreen(vp, screen);
+
+ vp->flags &= ~VP_IS_RTL;
+ vp->flags |= lang_is_rtl() ? VP_IS_RTL : 0;
}
void viewportmanager_init(void)