diff options
Diffstat (limited to 'apps/gui/bitmap')
-rw-r--r-- | apps/gui/bitmap/list.c | 16 |
1 files changed, 4 insertions, 12 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 @@ | |||
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" | ||
44 | 43 | ||
45 | #define ICON_PADDING 1 | 44 | #define ICON_PADDING 1 |
46 | 45 | #define IS_RTL(vp) (((vp)->flags & VP_IS_RTL) != 0) | |
47 | #define UPDATE_RTL(vp) \ | ||
48 | (vp)->flags &= ~VP_IS_RTL; \ | ||
49 | (vp)->flags |= lang_is_rtl() ? VP_IS_RTL : 0; | ||
50 | 46 | ||
51 | /* these are static to make scrolling work */ | 47 | /* these are static to make scrolling work */ |
52 | static struct viewport list_text[NB_SCREENS], title_text[NB_SCREENS]; | 48 | 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) | |||
80 | if (!list_display_title(list, screen)) | 76 | if (!list_display_title(list, screen)) |
81 | return false; | 77 | return false; |
82 | *title_text_vp = *(list->parent[screen]); | 78 | *title_text_vp = *(list->parent[screen]); |
83 | UPDATE_RTL(title_text_vp); | ||
84 | title_text_vp->height = font_get(title_text_vp->font)->height; | 79 | title_text_vp->height = font_get(title_text_vp->font)->height; |
85 | 80 | ||
86 | if (list->title_icon != Icon_NOICON && global_settings.show_icons) | 81 | if (list->title_icon != Icon_NOICON && global_settings.show_icons) |
87 | { | 82 | { |
88 | struct viewport title_icon = *title_text_vp; | 83 | struct viewport title_icon = *title_text_vp; |
89 | 84 | ||
90 | UPDATE_RTL(&title_icon); | ||
91 | title_icon.width = get_icon_width(screen) + ICON_PADDING * 2; | 85 | title_icon.width = get_icon_width(screen) + ICON_PADDING * 2; |
92 | if (lang_is_rtl()) | 86 | if (IS_RTL(&title_icon)) |
93 | { | 87 | { |
94 | title_icon.x = title_text_vp->width - ICON_PADDING - | 88 | title_icon.x = title_text_vp->width - ICON_PADDING - |
95 | get_icon_width(screen); | 89 | get_icon_width(screen); |
@@ -129,7 +123,7 @@ void list_draw(struct screen *display, struct gui_synclist *list) | |||
129 | #ifdef HAVE_LCD_COLOR | 123 | #ifdef HAVE_LCD_COLOR |
130 | unsigned char cur_line = 0; | 124 | unsigned char cur_line = 0; |
131 | #endif | 125 | #endif |
132 | int item_offset, is_rtl = lang_is_rtl(); | 126 | int item_offset; |
133 | bool show_title; | 127 | bool show_title; |
134 | struct viewport *list_text_vp = &list_text[screen]; | 128 | struct viewport *list_text_vp = &list_text[screen]; |
135 | 129 | ||
@@ -138,7 +132,6 @@ void list_draw(struct screen *display, struct gui_synclist *list) | |||
138 | display->clear_viewport(); | 132 | display->clear_viewport(); |
139 | display->scroll_stop(list_text_vp); | 133 | display->scroll_stop(list_text_vp); |
140 | *list_text_vp = *parent; | 134 | *list_text_vp = *parent; |
141 | UPDATE_RTL(list_text_vp); | ||
142 | if ((show_title = draw_title(display, list))) | 135 | if ((show_title = draw_title(display, list))) |
143 | { | 136 | { |
144 | list_text_vp->y += line_height; | 137 | list_text_vp->y += line_height; |
@@ -179,7 +172,6 @@ void list_draw(struct screen *display, struct gui_synclist *list) | |||
179 | 172 | ||
180 | /* setup icon placement */ | 173 | /* setup icon placement */ |
181 | list_icons = *list_text_vp; | 174 | list_icons = *list_text_vp; |
182 | UPDATE_RTL(&list_icons); | ||
183 | int icon_count = global_settings.show_icons && | 175 | int icon_count = global_settings.show_icons && |
184 | (list->callback_get_item_icon != NULL) ? 1 : 0; | 176 | (list->callback_get_item_icon != NULL) ? 1 : 0; |
185 | if (show_cursor) | 177 | if (show_cursor) |
@@ -188,7 +180,7 @@ void list_draw(struct screen *display, struct gui_synclist *list) | |||
188 | { | 180 | { |
189 | list_icons.width = icon_width * icon_count; | 181 | list_icons.width = icon_width * icon_count; |
190 | list_text_vp->width -= list_icons.width + ICON_PADDING; | 182 | list_text_vp->width -= list_icons.width + ICON_PADDING; |
191 | if (is_rtl) | 183 | if (IS_RTL(&list_icons)) |
192 | list_icons.x += list_text_vp->width; | 184 | list_icons.x += list_text_vp->width; |
193 | else | 185 | else |
194 | list_text_vp->x += list_icons.width + ICON_PADDING; | 186 | list_text_vp->x += list_icons.width + ICON_PADDING; |