1
0
Fork 0
forked from len0rd/rockbox

Fine tuning of gui elements positioning in RTL mode

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@22976 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Tomer Shalev 2009-10-05 23:41:59 +00:00
parent fa69df3324
commit 6a12b82a85
2 changed files with 12 additions and 6 deletions

View file

@ -85,8 +85,7 @@ static bool draw_title(struct screen *display, struct gui_synclist *list)
title_icon.width = get_icon_width(screen) + ICON_PADDING * 2; title_icon.width = get_icon_width(screen) + ICON_PADDING * 2;
if (IS_RTL(&title_icon)) if (IS_RTL(&title_icon))
{ {
title_icon.x = title_text_vp->width - ICON_PADDING - title_icon.x = title_text_vp->width - title_icon.width;
get_icon_width(screen);
} }
else else
{ {
@ -156,18 +155,22 @@ void list_draw(struct screen *display, struct gui_synclist *list)
else else
vp.x += list_text_vp->width; vp.x += list_text_vp->width;
display->set_viewport(&vp); display->set_viewport(&vp);
gui_scrollbar_draw(display, 0, 0, SCROLLBAR_WIDTH-1, vp.height, gui_scrollbar_draw(display, IS_RTL(&vp) ? 1 : 0, 0, SCROLLBAR_WIDTH-1, vp.height,
list->nb_items, list_start_item, list_start_item + end-start, list->nb_items, list_start_item, list_start_item + end-start,
VERTICAL); VERTICAL);
} }
else if (show_title) else if (show_title)
{ {
/* shift everything a bit in relation to the title... */ /* shift everything a bit in relation to the title... */
if (scrollbar_in_left) if (!IS_RTL(list_text_vp) && scrollbar_in_left)
{ {
list_text_vp->width -= SCROLLBAR_WIDTH; list_text_vp->width -= SCROLLBAR_WIDTH;
list_text_vp->x += SCROLLBAR_WIDTH; list_text_vp->x += SCROLLBAR_WIDTH;
} }
else if (IS_RTL(list_text_vp) && !scrollbar_in_left)
{
list_text_vp->width -= SCROLLBAR_WIDTH;
}
} }
/* setup icon placement */ /* setup icon placement */
@ -181,7 +184,7 @@ void list_draw(struct screen *display, struct gui_synclist *list)
list_icons.width = icon_width * icon_count; list_icons.width = icon_width * icon_count;
list_text_vp->width -= list_icons.width + ICON_PADDING; list_text_vp->width -= list_icons.width + ICON_PADDING;
if (IS_RTL(&list_icons)) if (IS_RTL(&list_icons))
list_icons.x += list_text_vp->width; list_icons.x += list_text_vp->width + ICON_PADDING;
else else
list_text_vp->x += list_icons.width + ICON_PADDING; list_text_vp->x += list_icons.width + ICON_PADDING;
} }

View file

@ -125,12 +125,15 @@ void screen_put_iconxy(struct screen * display,
const int screen = display->screen_type; const int screen = display->screen_type;
const int width = ICON_WIDTH(screen); const int width = ICON_WIDTH(screen);
const int height = ICON_HEIGHT(screen); const int height = ICON_HEIGHT(screen);
const int is_rtl = lang_is_rtl();
int stride; int stride;
const struct bitmap *iconset; const struct bitmap *iconset;
screen_bitmap_part_func *draw_func = NULL; screen_bitmap_part_func *draw_func = NULL;
if (icon == Icon_NOICON) if (icon == Icon_NOICON)
{ {
if (is_rtl)
xpos = display->getwidth() - xpos - width;
screen_clear_area(display, xpos, ypos, width, height); screen_clear_area(display, xpos, ypos, width, height);
return; return;
} }
@ -164,7 +167,7 @@ void screen_put_iconxy(struct screen * display,
if (xpos == 0) if (xpos == 0)
xpos++; xpos++;
if (lang_is_rtl()) if (is_rtl)
xpos = display->getwidth() - xpos - width; xpos = display->getwidth() - xpos - width;
#if (LCD_DEPTH == 16) || defined(LCD_REMOTE_DEPTH) && (LCD_REMOTE_DEPTH == 16) #if (LCD_DEPTH == 16) || defined(LCD_REMOTE_DEPTH) && (LCD_REMOTE_DEPTH == 16)