diff --git a/apps/gui/skin_engine/skin_display.c b/apps/gui/skin_engine/skin_display.c index c4b1963..fdce37a 100644 --- a/apps/gui/skin_engine/skin_display.c +++ b/apps/gui/skin_engine/skin_display.c @@ -194,6 +194,7 @@ static void draw_playlist_viewer_list(struct gui_wps *gwps, int start_item; int i; struct wps_token token; + int x, length, alignment = WPS_TOKEN_ALIGN_LEFT; struct mp3entry *pid3; #if CONFIG_CODEC == SWCODEC @@ -283,6 +284,14 @@ static void draw_playlist_viewer_list(struct gui_wps *gwps, #endif switch (viewer->lines[line].tokens[j]) { + case WPS_TOKEN_ALIGN_CENTER: + case WPS_TOKEN_ALIGN_LEFT: + case WPS_TOKEN_ALIGN_LEFT_RTL: + case WPS_TOKEN_ALIGN_RIGHT: + case WPS_TOKEN_ALIGN_RIGHT_RTL: + alignment = viewer->lines[line].tokens[j]; + tempbuf[0] = '\0'; + break; case WPS_TOKEN_STRING: case WPS_TOKEN_CHARACTER: snprintf(tempbuf, sizeof(tempbuf), "%s", @@ -309,14 +318,36 @@ static void draw_playlist_viewer_list(struct gui_wps *gwps, } j++; } - - if (viewer->lines[line].scroll) + + int vpwidth = viewer->vp->width; + length = gwps->display->getstringsize(buf, NULL, NULL); + if (viewer->lines[line].scroll && length >= vpwidth) { gwps->display->puts_scroll(0, (i-start_item), buf ); } else - { - gwps->display->putsxy(0, (i-start_item)*line_height, buf ); + { + if (length >= vpwidth) + x = 0; + else + { + switch (alignment) + { + case WPS_TOKEN_ALIGN_CENTER: + x = (vpwidth-length)/2; + break; + case WPS_TOKEN_ALIGN_LEFT: + x = 0; + break; + case WPS_TOKEN_ALIGN_LEFT_RTL: + case WPS_TOKEN_ALIGN_RIGHT: + x = vpwidth-length; + break; + case WPS_TOKEN_ALIGN_RIGHT_RTL: + break; + } + } + gwps->display->putsxy(x, (i-start_item)*line_height, buf ); } } }