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) @@ -701,6 +701,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 +728,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 +752,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; @@ -1042,7 +1050,9 @@ struct dim dimensions; int albumart_slot; struct skin_albumart *aa = skin_buffer_alloc(sizeof(struct skin_albumart)); + bool is_swap_rtl; (void)token; /* silence warning */ + if (!aa) return skip_end_of_line(wps_bufptr); @@ -1053,6 +1063,8 @@ aa->yalign = WPS_ALBUMART_ALIGN_CENTER; /* default */ aa->vp = &curr_vp->vp; + is_swap_rtl = VP_IS_RTL(aa->vp); + /* format: %Cl|x|y|[[l|c|r]mwidth]|[[t|c|b]mheight]| */ newline = strchr(wps_bufptr, '\n'); @@ -1085,7 +1097,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 +1107,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 +1182,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; Index: apps/gui/viewport.c =================================================================== --- apps/gui/viewport.c (revision 24120) +++ apps/gui/viewport.c (working copy) @@ -64,7 +64,7 @@ #ifdef HAVE_LCD_BITMAP static void viewportmanager_redraw(void* data); - + static int theme_stack_top[NB_SCREENS]; /* the last item added */ static struct viewport_stack_item theme_stack[NB_SCREENS][VPSTACK_DEPTH]; static bool is_theme_enabled(enum screen_type screen); @@ -85,10 +85,10 @@ add_event(LCD_EVENT_ACTIVATION, false, do_sbs_update_callback); #endif add_event(PLAYBACK_EVENT_TRACK_CHANGE, false, - do_sbs_update_callback); + do_sbs_update_callback); add_event(PLAYBACK_EVENT_NEXTTRACKID3_AVAILABLE, false, - do_sbs_update_callback); - + do_sbs_update_callback); + /* remove the left overs from the previous screen. * could cause a tiny flicker. Redo your screen code if that happens */ if (!was_enabled[screen] || force) @@ -157,7 +157,7 @@ } void viewportmanager_theme_enable(enum screen_type screen, bool enable, - struct viewport *viewport) + struct viewport *viewport) { int top = ++theme_stack_top[screen]; if (top >= VPSTACK_DEPTH-1) @@ -175,7 +175,7 @@ int top = --theme_stack_top[screen]; if (top < 0) panicf("Stack underflow... viewportmanager"); - + toggle_theme(screen, force_redraw); } @@ -208,8 +208,8 @@ FOR_NB_SCREENS(i) { #ifdef HAVE_LCD_BITMAP - if (statusbar_position(i) == STATUSBAR_CUSTOM) - sb_skin_update(i, NULL != data); + if (statusbar_position(i) == STATUSBAR_CUSTOM) + sb_skin_update(i, NULL != data); else if (statusbar_position(i) != STATUSBAR_OFF) #endif gui_statusbar_draw(&statusbars.statusbars[i], NULL != data); @@ -281,9 +281,9 @@ else #endif setting = global_settings.ui_vp_config; - + ret = viewport_parse_viewport(&custom_vp[screen], screen, - setting, ','); + setting, ','); custom_vp_loaded_ok[screen] = ret?true:false; } @@ -293,7 +293,7 @@ #ifdef HAVE_TOUCHSCREEN /* check if a point (x and y coordinates) are within a viewport */ bool viewport_point_within_vp(const struct viewport *vp, - const int x, const int y) + const int x, const int y) { bool is_x = (x >= vp->x && x < (vp->x + vp->width)); bool is_y = (y >= vp->y && y < (vp->y + vp->height)); @@ -319,7 +319,7 @@ void viewport_set_fullscreen(struct viewport *vp, - const enum screen_type screen) + const enum screen_type screen) { vp->x = 0; vp->y = 0; @@ -359,39 +359,39 @@ } void viewport_set_defaults(struct viewport *vp, - const enum screen_type screen) + const enum screen_type screen) { /* Reposition: 1) If the "ui viewport" setting is set, and a sbs is loaded which specifies a %Vi - return the intersection of those two viewports + return the intersection of those two viewports 2) If only one of the "ui viewport" setting, or sbs %Vi is set - return it + return it 3) No user viewports set - return the full display - */ + return the full display + */ #if defined(HAVE_LCD_BITMAP) && !defined(__PCTOOL__) - + struct viewport *sbs_area = NULL, *user_setting = NULL; if (!is_theme_enabled(screen)) - { - viewport_set_fullscreen(vp, screen); - return; - } + { + viewport_set_fullscreen(vp, screen); + return; + } /* get the two viewports */ if (custom_vp_loaded_ok[screen]) user_setting = &custom_vp[screen]; if (sb_skin_get_state(screen)) sbs_area = sb_skin_get_info_vp(screen); - + /* have both? get their intersection */ if (sbs_area && user_setting) { struct viewport *a = sbs_area, *b = user_setting; /* if ui vp and info vp overlap, intersect */ if (a->x < b->x + b->width && - a->x + a->width > b->x && - a->y < b->y + b->height && - a->y + a->height > b->y) + a->x + a->width > b->x && + a->y < b->y + b->height && + a->y + a->height > b->y) { /* copy from ui vp first (for other field),fix coordinates after */ *vp = *user_setting; @@ -421,14 +421,16 @@ #ifdef HAVE_LCD_BITMAP -const char* viewport_parse_viewport(struct viewport *vp, - enum screen_type screen, - const char *bufptr, - const char separator) +const char* viewport_parse_viewport_rtl(struct viewport *vp, + enum screen_type screen, + const char *bufptr, + 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.132x80x16.wps =================================================================== --- wps/cabbiev2.132x80x16.wps (revision 24120) +++ wps/cabbiev2.132x80x16.wps (working copy) @@ -21,7 +21,7 @@ %?mp<%xdFa|%xdFb|%xdFc|%xdFd|%xdFe> #NowPlaying - aa -%Vl|a|48|10|-|48|1|-|-| +%VL|a|48|10|-|48|1|-|-| %s%al%?it<%it|%fn> %s%al%?ia<%ia|%?d2<%d2|(root)>> %s%al%?id<%id|%?d1<%d1|(root)>> Index: wps/cabbiev2.320x240x16.wps =================================================================== --- wps/cabbiev2.320x240x16.wps (revision 24120) +++ wps/cabbiev2.320x240x16.wps (working copy) @@ -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.220x176x16.wps =================================================================== --- wps/cabbiev2.220x176x16.wps (revision 24120) +++ wps/cabbiev2.220x176x16.wps (working copy) @@ -21,7 +21,7 @@ #NowPlaying %?C<%Vda%C|%Vdb> -%Vl|a|105|30|-|90|1|-|-| +%VL|a|105|30|-|90|1|-|-| %s%al%?it<%it|%fn> %s%al%?ia<%ia|%?d2<%d2|(root)>> %s%al%?id<%id|%?d1<%d1|(root)>> Index: wps/cabbiev2.138x110x2.wps =================================================================== --- wps/cabbiev2.138x110x2.wps (revision 24120) +++ wps/cabbiev2.138x110x2.wps (working copy) @@ -21,7 +21,7 @@ %?mp<%xdFa|%xdFb|%xdFc|%xdFd|%xdFe> %?C<%C%Vda|%Vdb> -%Vl|a|65|10|-|60|1|-|-| +%VL|a|65|10|-|60|1|-|-| %s%al%?it<%it|%fn> %s%al%?ia<%ia|%?d2<%d2|(root)>> %s%al%?id<%id|%?d1<%d1|(root)>> Index: wps/cabbiev2.160x128x2.wps =================================================================== --- wps/cabbiev2.160x128x2.wps (revision 24120) +++ wps/cabbiev2.160x128x2.wps (working copy) @@ -21,7 +21,7 @@ %?mp<%xdFa|%xdFb|%xdFc|%xdFd|%xdFe> %?C<%C%Vda|%Vdb> -%Vl|a|70|10|-|75|1|-|-| +%VL|a|70|10|-|75|1|-|-| %s%al%?it<%it|%fn> %s%al%?ia<%ia|%?d2<%d2|(root)>> %s%al%?id<%id|%?d1<%d1|(root)>> Index: wps/cabbiev2.160x128x16.wps =================================================================== --- wps/cabbiev2.160x128x16.wps (revision 24120) +++ wps/cabbiev2.160x128x16.wps (working copy) @@ -20,7 +20,7 @@ %?C<%C%Vda|%Vdb> # NowPlaying - AA -%Vl|a|77|10|-|75|1|-|-| +%VL|a|77|10|-|75|1|-|-| %s%al%?it<%it|%fn> %s%al%?ia<%ia|%?d2<%d2|(root)>> %s%al%?id<%id|%?d1<%d1|(root)>> Index: wps/cabbiev2.176x132x16.wps =================================================================== --- wps/cabbiev2.176x132x16.wps (revision 24120) +++ wps/cabbiev2.176x132x16.wps (working copy) @@ -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)>> Index: wps/cabbiev2.128x128x16.wps =================================================================== --- wps/cabbiev2.128x128x16.wps (revision 24120) +++ wps/cabbiev2.128x128x16.wps (working copy) @@ -23,7 +23,7 @@ #NowPlaying - with AA -%Vl|a|70|12|-|50|1|-|-| +%VL|a|70|12|-|50|1|-|-| %s%al%?it<%it|%fn> %s%al%?ia<%ia|%?d2<%d2|(root)>> %s%al%?id<%id|%?d1<%d1|(root)>>