diff options
author | Tomer Shalev <shalev.tomer@gmail.com> | 2009-10-05 11:43:38 +0000 |
---|---|---|
committer | Tomer Shalev <shalev.tomer@gmail.com> | 2009-10-05 11:43:38 +0000 |
commit | 6d80565b1b5277820593de80bf036304be93c8ef (patch) | |
tree | 230b2d57d96190430c757cd98534db290c95bd3e /apps/gui | |
parent | f06c98fec82e8c800e09603f3022676dbbfdd84b (diff) | |
download | rockbox-6d80565b1b5277820593de80bf036304be93c8ef.tar.gz rockbox-6d80565b1b5277820593de80bf036304be93c8ef.zip |
RTL support in menus
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@22945 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/gui')
-rw-r--r-- | apps/gui/bitmap/list.c | 31 | ||||
-rw-r--r-- | apps/gui/icon.c | 3 |
2 files changed, 25 insertions, 9 deletions
diff --git a/apps/gui/bitmap/list.c b/apps/gui/bitmap/list.c index 94870538d6..ff29397532 100644 --- a/apps/gui/bitmap/list.c +++ b/apps/gui/bitmap/list.c | |||
@@ -40,6 +40,7 @@ | |||
40 | #include "sound.h" | 40 | #include "sound.h" |
41 | #include "misc.h" | 41 | #include "misc.h" |
42 | #include "viewport.h" | 42 | #include "viewport.h" |
43 | #include "language.h" | ||
43 | 44 | ||
44 | #define ICON_PADDING 1 | 45 | #define ICON_PADDING 1 |
45 | 46 | ||
@@ -61,6 +62,9 @@ bool list_display_title(struct gui_synclist *list, enum screen_type screen); | |||
61 | | | | items | I - icons | 62 | | | | items | I - icons |
62 | | | | | | 63 | | | | | |
63 | ------------------ | 64 | ------------------ |
65 | |||
66 | Note: This image is flipped horizontally when the language is a | ||
67 | right-to-left one (Hebrew, Arabic) | ||
64 | */ | 68 | */ |
65 | static bool draw_title(struct screen *display, struct gui_synclist *list) | 69 | static bool draw_title(struct screen *display, struct gui_synclist *list) |
66 | { | 70 | { |
@@ -77,10 +81,17 @@ static bool draw_title(struct screen *display, struct gui_synclist *list) | |||
77 | struct viewport title_icon = title_text[screen]; | 81 | struct viewport title_icon = title_text[screen]; |
78 | title_icon.width = get_icon_width(screen) | 82 | title_icon.width = get_icon_width(screen) |
79 | + ICON_PADDING*2; | 83 | + ICON_PADDING*2; |
80 | title_icon.x += ICON_PADDING; | 84 | if (lang_is_rtl()) |
81 | 85 | { | |
86 | title_icon.x = title_text[screen].width - ICON_PADDING - | ||
87 | get_icon_width(screen); | ||
88 | } | ||
89 | else | ||
90 | { | ||
91 | title_icon.x = ICON_PADDING; | ||
92 | title_text[screen].x += title_icon.width; | ||
93 | } | ||
82 | title_text[screen].width -= title_icon.width; | 94 | title_text[screen].width -= title_icon.width; |
83 | title_text[screen].x += title_icon.width; | ||
84 | 95 | ||
85 | display->set_viewport(&title_icon); | 96 | display->set_viewport(&title_icon); |
86 | screen_put_icon(display, 0, 0, list->title_icon); | 97 | screen_put_icon(display, 0, 0, list->title_icon); |
@@ -108,7 +119,7 @@ void list_draw(struct screen *display, struct gui_synclist *list) | |||
108 | #ifdef HAVE_LCD_COLOR | 119 | #ifdef HAVE_LCD_COLOR |
109 | unsigned char cur_line = 0; | 120 | unsigned char cur_line = 0; |
110 | #endif | 121 | #endif |
111 | int item_offset; | 122 | int item_offset, is_rtl = lang_is_rtl(); |
112 | bool show_title; | 123 | bool show_title; |
113 | line_height = font_get(parent->font)->height; | 124 | line_height = font_get(parent->font)->height; |
114 | display->set_viewport(parent); | 125 | display->set_viewport(parent); |
@@ -132,12 +143,12 @@ void list_draw(struct screen *display, struct gui_synclist *list) | |||
132 | vp = list_text[screen]; | 143 | vp = list_text[screen]; |
133 | vp.width = SCROLLBAR_WIDTH; | 144 | vp.width = SCROLLBAR_WIDTH; |
134 | list_text[screen].width -= SCROLLBAR_WIDTH; | 145 | list_text[screen].width -= SCROLLBAR_WIDTH; |
135 | if(global_settings.scrollbar == SCROLLBAR_LEFT) | 146 | if (global_settings.scrollbar == SCROLLBAR_SHOW) |
136 | list_text[screen].x += SCROLLBAR_WIDTH; | 147 | list_text[screen].x += SCROLLBAR_WIDTH; |
137 | vp.height = line_height * | 148 | vp.height = line_height * |
138 | viewport_get_nb_lines(&list_text[screen]); | 149 | viewport_get_nb_lines(&list_text[screen]); |
139 | vp.x = parent->x; | 150 | vp.x = parent->x; |
140 | if(global_settings.scrollbar == SCROLLBAR_RIGHT) | 151 | if (global_settings.scrollbar == SCROLLBAR_SHOW_OPPOSITE) |
141 | vp.x += list_text[screen].width; | 152 | vp.x += list_text[screen].width; |
142 | display->set_viewport(&vp); | 153 | display->set_viewport(&vp); |
143 | gui_scrollbar_draw(display, 0, 0, SCROLLBAR_WIDTH-1, | 154 | gui_scrollbar_draw(display, 0, 0, SCROLLBAR_WIDTH-1, |
@@ -149,7 +160,7 @@ void list_draw(struct screen *display, struct gui_synclist *list) | |||
149 | else if (show_title) | 160 | else if (show_title) |
150 | { | 161 | { |
151 | /* shift everything right a bit... */ | 162 | /* shift everything right a bit... */ |
152 | if(global_settings.scrollbar == SCROLLBAR_LEFT) | 163 | if (global_settings.scrollbar == SCROLLBAR_SHOW) |
153 | { | 164 | { |
154 | list_text[screen].width -= SCROLLBAR_WIDTH; | 165 | list_text[screen].width -= SCROLLBAR_WIDTH; |
155 | list_text[screen].x += SCROLLBAR_WIDTH; | 166 | list_text[screen].x += SCROLLBAR_WIDTH; |
@@ -167,8 +178,10 @@ void list_draw(struct screen *display, struct gui_synclist *list) | |||
167 | list_icons.width = icon_width * icon_count; | 178 | list_icons.width = icon_width * icon_count; |
168 | list_text[screen].width -= | 179 | list_text[screen].width -= |
169 | list_icons.width + ICON_PADDING; | 180 | list_icons.width + ICON_PADDING; |
170 | list_text[screen].x += | 181 | if (is_rtl) |
171 | list_icons.width + ICON_PADDING; | 182 | list_icons.x += list_text[screen].width; |
183 | else | ||
184 | list_text[screen].x += list_icons.width + ICON_PADDING; | ||
172 | } | 185 | } |
173 | 186 | ||
174 | for (i=start; i<end && i<list->nb_items; i++) | 187 | for (i=start; i<end && i<list->nb_items; i++) |
diff --git a/apps/gui/icon.c b/apps/gui/icon.c index 53cfd87774..a473c82872 100644 --- a/apps/gui/icon.c +++ b/apps/gui/icon.c | |||
@@ -29,6 +29,7 @@ | |||
29 | #include "settings.h" | 29 | #include "settings.h" |
30 | #include "bmp.h" | 30 | #include "bmp.h" |
31 | #include "filetypes.h" | 31 | #include "filetypes.h" |
32 | #include "language.h" | ||
32 | 33 | ||
33 | #include "bitmaps/default_icons.h" | 34 | #include "bitmaps/default_icons.h" |
34 | #if defined(HAVE_REMOTE_LCD) && (NB_SCREENS > 1) | 35 | #if defined(HAVE_REMOTE_LCD) && (NB_SCREENS > 1) |
@@ -170,6 +171,8 @@ void screen_put_iconxy(struct screen * display, | |||
170 | #endif | 171 | #endif |
171 | draw_func = display->bitmap_part; | 172 | draw_func = display->bitmap_part; |
172 | 173 | ||
174 | if (lang_is_rtl()) | ||
175 | xpos = display->getwidth() - xpos - width; | ||
173 | draw_func(data, 0, height * icon, stride, xpos, ypos, width, height); | 176 | draw_func(data, 0, height * icon, stride, xpos, ypos, width, height); |
174 | } | 177 | } |
175 | 178 | ||