Index: apps/gui/skin_engine/skin_parser.c =================================================================== --- apps/gui/skin_engine/skin_parser.c (revision 24121) +++ apps/gui/skin_engine/skin_parser.c (working copy) @@ -162,6 +162,8 @@ #ifdef HAVE_ALBUMART static int parse_albumart_load(const char *wps_bufptr, struct wps_token *token, struct wps_data *wps_data); +static int parse_albumart_load_rtl(const char *wps_bufptr, + struct wps_token *token, struct wps_data *wps_data); static int parse_albumart_display(const char *wps_bufptr, struct wps_token *token, struct wps_data *wps_data); #endif /* HAVE_ALBUMART */ @@ -349,6 +351,7 @@ { WPS_TOKEN_IMAGE_DISPLAY, "x", 0, parse_image_load }, #ifdef HAVE_ALBUMART { WPS_NO_TOKEN, "Cl", 0, parse_albumart_load }, + { WPS_NO_TOKEN, "CL", 0, parse_albumart_load_rtl }, { WPS_TOKEN_ALBUMART_DISPLAY, "C", WPS_REFRESH_STATIC, parse_albumart_display }, #endif @@ -701,6 +704,7 @@ { (void)token; /* Kill warnings */ const char *ptr = wps_bufptr; + bool lang_dir_aware = false; struct skin_viewport *skin_vp = skin_buffer_alloc(sizeof(struct skin_viewport)); @@ -727,8 +731,10 @@ skin_vp->hidden_flags = VP_NEVER_VISIBLE; ++ptr; } - else if (*ptr == 'l') + else if (*ptr == 'l' || *ptr == 'L') { + lang_dir_aware = (*ptr == 'L'); + if (*(ptr+1) == '|') { char label = *(ptr+2); @@ -749,10 +755,15 @@ struct viewport *vp = &skin_vp->vp; /* format: %V|x|y|width|height|font|fg_pattern|bg_pattern| */ - if (!(ptr = viewport_parse_viewport(vp, curr_screen, ptr, '|'))) + if (!(ptr = viewport_parse_viewport_rtl(vp, curr_screen, ptr, '|', + lang_dir_aware))) + { return WPS_ERROR_INVALID_PARAM; + } - vp->flags &= ~VP_FLAG_ALIGN_RIGHT; /* ignore right-to-left languages */ + if (!lang_dir_aware) + vp->flags &= ~VP_FLAG_ALIGN_RIGHT; /* ignore right-to-left languages */ + /* Check for trailing | */ if (*ptr != '|') return WPS_ERROR_INVALID_PARAM; @@ -1033,16 +1044,19 @@ return (!*_pos || *_pos > newline || **_pos != '|'); } -static int parse_albumart_load(const char *wps_bufptr, +static int parse_albumart_load_lang(const char *wps_bufptr, struct wps_token *token, - struct wps_data *wps_data) + struct wps_data *wps_data, + bool lang_dir_aware) { const char *_pos, *newline; bool parsing; struct dim dimensions; int albumart_slot; struct skin_albumart *aa = skin_buffer_alloc(sizeof(struct skin_albumart)); + bool is_swap_rtl = lang_dir_aware && lang_is_rtl(); (void)token; /* silence warning */ + if (!aa) return skip_end_of_line(wps_bufptr); @@ -1085,7 +1099,8 @@ case 'l': case 'L': case '+': - aa->xalign = WPS_ALBUMART_ALIGN_LEFT; + aa->xalign = (is_swap_rtl ? WPS_ALBUMART_ALIGN_RIGHT : + WPS_ALBUMART_ALIGN_LEFT); break; case 'c': case 'C': @@ -1094,7 +1109,8 @@ case 'r': case 'R': case '-': - aa->xalign = WPS_ALBUMART_ALIGN_RIGHT; + aa->xalign = (is_swap_rtl ? WPS_ALBUMART_ALIGN_LEFT : + WPS_ALBUMART_ALIGN_RIGHT); break; case 'd': case 'D': @@ -1168,6 +1184,8 @@ aa->height = 0; else if (aa->height > LCD_HEIGHT) aa->height = LCD_HEIGHT; + if (is_swap_rtl) + aa->x = LCD_WIDTH - (aa->x + aa->width); aa->state = WPS_ALBUMART_LOAD; aa->draw = false; @@ -1185,6 +1203,20 @@ return skip_end_of_line(wps_bufptr); } +static int parse_albumart_load(const char *wps_bufptr, + struct wps_token *token, + struct wps_data *wps_data) +{ + return parse_albumart_load_lang(wps_bufptr, token, wps_data, 0); +} + +static int parse_albumart_load_rtl(const char *wps_bufptr, + struct wps_token *token, + struct wps_data *wps_data) +{ + return parse_albumart_load_lang(wps_bufptr, token, wps_data, 1); +} + static int parse_albumart_display(const char *wps_bufptr, struct wps_token *token, struct wps_data *wps_data) Index: apps/gui/viewport.c =================================================================== --- apps/gui/viewport.c (revision 24120) +++ apps/gui/viewport.c (working copy) @@ -421,14 +421,16 @@ #ifdef HAVE_LCD_BITMAP -const char* viewport_parse_viewport(struct viewport *vp, +const char* viewport_parse_viewport_rtl(struct viewport *vp, enum screen_type screen, const char *bufptr, - const char separator) + const char separator, + bool lang_dir_aware) { /* parse the list to the viewport struct */ const char *ptr = bufptr; int depth; + bool is_swap_rtl = lang_dir_aware && lang_is_rtl(); uint32_t set = 0; enum { @@ -484,6 +486,8 @@ vp->height = screens[screen].lcdheight - vp->y; else if (vp->height < 0) vp->height = (vp->height + screens[screen].lcdheight) - vp->y; + if (is_swap_rtl) + vp->x = screens[screen].lcdwidth - (vp->x + vp->width); #if (LCD_DEPTH > 1) || (defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1) if (!LIST_VALUE_PARSED(set, PL_FG)) @@ -523,4 +527,12 @@ return ptr; } + +const char* viewport_parse_viewport(struct viewport *vp, + enum screen_type screen, + const char *bufptr, + const char separator) +{ + return viewport_parse_viewport_rtl(vp, screen, bufptr, separator, 0); +} #endif Index: apps/gui/viewport.h =================================================================== --- apps/gui/viewport.h (revision 24120) +++ apps/gui/viewport.h (working copy) @@ -94,5 +94,11 @@ enum screen_type screen, const char *vp_def, const char separator); + +const char* viewport_parse_viewport_rtl(struct viewport *vp, + enum screen_type screen, + const char *vp_def, + const char separator, + bool lang_dir_aware); #endif /* HAVE_LCD_BITMAP */ #endif /* __VIEWPORT_H__ */ Index: apps/filetree.c =================================================================== --- apps/filetree.c (revision 24120) +++ apps/filetree.c (working copy) @@ -548,6 +548,7 @@ MAX_FILENAME); talk_init(); /* use voice of same language */ viewportmanager_theme_changed(THEME_LANGUAGE); + settings_apply_skins(); splash(HZ, ID2P(LANG_LANGUAGE_LOADED)); break; Index: wps/cabbiev2.320x240x16.wps =================================================================== --- wps/cabbiev2.320x240x16.wps (revision 24120) +++ wps/cabbiev2.320x240x16.wps (working copy) @@ -9,7 +9,7 @@ %xl|D|shuffle-320x240x16.bmp|218|211| %xl|E|repeat-320x240x16.bmp|261|207|4| %xl|F|playmode-320x240x16.bmp|286|207|5| -%Cl|16|32|s120|s120| +%CL|16|32|120|120| %pb|pb-320x240x16.bmp|10|162|300|15| %?mh<%xdAa|%xdAb> %?bp<%?bc<%xdBa|%xdBb>|%?bl<|%xdBc|%xdBd|%xdBe|%xdBf|%xdBg|%xdBh|%xdBi|%xdBj>> @@ -21,7 +21,7 @@ %?C<%Vda%C|%Vdb> #NowPlaying -%Vl|a|153|30|-|130|1|-|-| +%VL|a|153|30|-|130|1|-|-| %s%al%?it<%it|%fn> %s%al%?ia<%ia|%?d2<%d2|(root)>> %s%al%?id<%id|%?d1<%d1|(root)>> @@ -31,7 +31,7 @@ %s%al%?It<%It|%Fn> %s%al%Ia -%Vl|b|0|30|-|130|1|-|-| +%VL|b|0|30|-|130|1|-|-| %s%ac%?it<%it|%fn> %s%ac%?ia<%ia|%?d2<%d2|(root)>> %s%ac%?id<%id|%?d1<%d1|(root)>> Index: wps/cabbiev2.176x132x16.wps =================================================================== --- wps/cabbiev2.176x132x16.wps (revision 24120) +++ wps/cabbiev2.176x132x16.wps (working copy) @@ -10,7 +10,7 @@ %xl|D|shuffle-176x132x16.bmp|120|117| %xl|E|repeat-176x132x16.bmp|139|113|4| %xl|F|playmode-176x132x16.bmp|156|115|5| -%Cl|9|16|s65|s65| +%CL|9|16|s65|s65| %pb|pb-176x132x16.bmp|8|86|160|8| %?mh<%xdAa|%xdAb> %?bp<%?bc<%xdBa|%xdBb>|%?bl<|%xdBc|%xdBd|%xdBe|%xdBf|%xdBg|%xdBh|%xdBi|%xdBj>> @@ -21,7 +21,7 @@ %?C<%C%Vda|%Vdb> #NowPlaying -%Vl|a|81|12|-|74|1|-|-| +%VL|a|81|12|-|74|1|-|-| %s%al%?it<%it|%fn> %s%al%?ia<%ia|%?d2<%d2|(root)>> %s%al%?id<%id|%?d1<%d1|(root)>>