summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--apps/gui/bitmap/list.c8
-rw-r--r--firmware/drivers/lcd-bitmap-common.c11
-rw-r--r--firmware/export/lcd.h3
3 files changed, 12 insertions, 10 deletions
diff --git a/apps/gui/bitmap/list.c b/apps/gui/bitmap/list.c
index 44587cd378..953ce1b1d7 100644
--- a/apps/gui/bitmap/list.c
+++ b/apps/gui/bitmap/list.c
@@ -44,6 +44,10 @@
44 44
45#define ICON_PADDING 1 45#define ICON_PADDING 1
46 46
47#define UPDATE_RTL(vp) \
48 (vp)->flags &= ~VP_IS_RTL; \
49 (vp)->flags |= lang_is_rtl() ? VP_IS_RTL : 0;
50
47/* these are static to make scrolling work */ 51/* these are static to make scrolling work */
48static struct viewport list_text[NB_SCREENS], title_text[NB_SCREENS]; 52static struct viewport list_text[NB_SCREENS], title_text[NB_SCREENS];
49 53
@@ -76,12 +80,14 @@ static bool draw_title(struct screen *display, struct gui_synclist *list)
76 if (!list_display_title(list, screen)) 80 if (!list_display_title(list, screen))
77 return false; 81 return false;
78 *title_text_vp = *(list->parent[screen]); 82 *title_text_vp = *(list->parent[screen]);
83 UPDATE_RTL(title_text_vp);
79 title_text_vp->height = font_get(title_text_vp->font)->height; 84 title_text_vp->height = font_get(title_text_vp->font)->height;
80 85
81 if (list->title_icon != Icon_NOICON && global_settings.show_icons) 86 if (list->title_icon != Icon_NOICON && global_settings.show_icons)
82 { 87 {
83 struct viewport title_icon = *title_text_vp; 88 struct viewport title_icon = *title_text_vp;
84 89
90 UPDATE_RTL(&title_icon);
85 title_icon.width = get_icon_width(screen) + ICON_PADDING * 2; 91 title_icon.width = get_icon_width(screen) + ICON_PADDING * 2;
86 if (lang_is_rtl()) 92 if (lang_is_rtl())
87 { 93 {
@@ -132,6 +138,7 @@ void list_draw(struct screen *display, struct gui_synclist *list)
132 display->clear_viewport(); 138 display->clear_viewport();
133 display->scroll_stop(list_text_vp); 139 display->scroll_stop(list_text_vp);
134 *list_text_vp = *parent; 140 *list_text_vp = *parent;
141 UPDATE_RTL(list_text_vp);
135 if ((show_title = draw_title(display, list))) 142 if ((show_title = draw_title(display, list)))
136 { 143 {
137 list_text_vp->y += line_height; 144 list_text_vp->y += line_height;
@@ -172,6 +179,7 @@ void list_draw(struct screen *display, struct gui_synclist *list)
172 179
173 /* setup icon placement */ 180 /* setup icon placement */
174 list_icons = *list_text_vp; 181 list_icons = *list_text_vp;
182 UPDATE_RTL(&list_icons);
175 int icon_count = global_settings.show_icons && 183 int icon_count = global_settings.show_icons &&
176 (list->callback_get_item_icon != NULL) ? 1 : 0; 184 (list->callback_get_item_icon != NULL) ? 1 : 0;
177 if (show_cursor) 185 if (show_cursor)
diff --git a/firmware/drivers/lcd-bitmap-common.c b/firmware/drivers/lcd-bitmap-common.c
index 1e2765f34f..0dafe092fc 100644
--- a/firmware/drivers/lcd-bitmap-common.c
+++ b/firmware/drivers/lcd-bitmap-common.c
@@ -27,15 +27,6 @@
27 * KIND, either express or implied. 27 * KIND, either express or implied.
28 * 28 *
29 ****************************************************************************/ 29 ****************************************************************************/
30#ifdef BOOTLOADER
31static int lang_is_rtl(void)
32{
33 return 0;
34}
35#else
36#include "language.h"
37#endif
38
39#ifndef LCDFN /* Not compiling for remote - define macros for main LCD. */ 30#ifndef LCDFN /* Not compiling for remote - define macros for main LCD. */
40#define LCDFN(fn) lcd_ ## fn 31#define LCDFN(fn) lcd_ ## fn
41#define FBFN(fn) fb_ ## fn 32#define FBFN(fn) fb_ ## fn
@@ -186,7 +177,7 @@ void LCDFN(puts_style_offset)(int x, int y, const unsigned char *str,
186 chars_in_str = utf8length((char *)str); 177 chars_in_str = utf8length((char *)str);
187 LCDFN(getstringsize)(str, &w, &h); 178 LCDFN(getstringsize)(str, &w, &h);
188 xpos = x * w / chars_in_str; 179 xpos = x * w / chars_in_str;
189 if (lang_is_rtl()) 180 if (current_vp->flags & VP_IS_RTL)
190 xpos = current_vp->width - w - xpos; 181 xpos = current_vp->width - w - xpos;
191 ypos = y * h; 182 ypos = y * h;
192 LCDFN(putsxyofs_style)(xpos, ypos, str, style, w, h, offset); 183 LCDFN(putsxyofs_style)(xpos, ypos, str, style, w, h, offset);
diff --git a/firmware/export/lcd.h b/firmware/export/lcd.h
index a8253db656..ddfba2a8ac 100644
--- a/firmware/export/lcd.h
+++ b/firmware/export/lcd.h
@@ -26,12 +26,15 @@
26#include "cpu.h" 26#include "cpu.h"
27#include "config.h" 27#include "config.h"
28 28
29#define VP_IS_RTL 0x01
30
29struct viewport { 31struct viewport {
30 int x; 32 int x;
31 int y; 33 int y;
32 int width; 34 int width;
33 int height; 35 int height;
34#ifdef HAVE_LCD_BITMAP 36#ifdef HAVE_LCD_BITMAP
37 int flags;
35 int font; 38 int font;
36 int drawmode; 39 int drawmode;
37#endif 40#endif