mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-10-14 02:27:39 -04:00
Add rtl flagging to viewport_set_defaults(), and ensure that
viewportmanager_theme_changed() is called during font loading git-svn-id: svn://svn.rockbox.org/rockbox/trunk@22971 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
5abd9686f4
commit
b0a9938321
3 changed files with 18 additions and 14 deletions
|
@ -40,13 +40,9 @@
|
||||||
#include "sound.h"
|
#include "sound.h"
|
||||||
#include "misc.h"
|
#include "misc.h"
|
||||||
#include "viewport.h"
|
#include "viewport.h"
|
||||||
#include "language.h"
|
|
||||||
|
|
||||||
#define ICON_PADDING 1
|
#define ICON_PADDING 1
|
||||||
|
#define IS_RTL(vp) (((vp)->flags & VP_IS_RTL) != 0)
|
||||||
#define UPDATE_RTL(vp) \
|
|
||||||
(vp)->flags &= ~VP_IS_RTL; \
|
|
||||||
(vp)->flags |= lang_is_rtl() ? VP_IS_RTL : 0;
|
|
||||||
|
|
||||||
/* these are static to make scrolling work */
|
/* these are static to make scrolling work */
|
||||||
static struct viewport list_text[NB_SCREENS], title_text[NB_SCREENS];
|
static struct viewport list_text[NB_SCREENS], title_text[NB_SCREENS];
|
||||||
|
@ -80,16 +76,14 @@ static bool draw_title(struct screen *display, struct gui_synclist *list)
|
||||||
if (!list_display_title(list, screen))
|
if (!list_display_title(list, screen))
|
||||||
return false;
|
return false;
|
||||||
*title_text_vp = *(list->parent[screen]);
|
*title_text_vp = *(list->parent[screen]);
|
||||||
UPDATE_RTL(title_text_vp);
|
|
||||||
title_text_vp->height = font_get(title_text_vp->font)->height;
|
title_text_vp->height = font_get(title_text_vp->font)->height;
|
||||||
|
|
||||||
if (list->title_icon != Icon_NOICON && global_settings.show_icons)
|
if (list->title_icon != Icon_NOICON && global_settings.show_icons)
|
||||||
{
|
{
|
||||||
struct viewport title_icon = *title_text_vp;
|
struct viewport title_icon = *title_text_vp;
|
||||||
|
|
||||||
UPDATE_RTL(&title_icon);
|
|
||||||
title_icon.width = get_icon_width(screen) + ICON_PADDING * 2;
|
title_icon.width = get_icon_width(screen) + ICON_PADDING * 2;
|
||||||
if (lang_is_rtl())
|
if (IS_RTL(&title_icon))
|
||||||
{
|
{
|
||||||
title_icon.x = title_text_vp->width - ICON_PADDING -
|
title_icon.x = title_text_vp->width - ICON_PADDING -
|
||||||
get_icon_width(screen);
|
get_icon_width(screen);
|
||||||
|
@ -129,7 +123,7 @@ void list_draw(struct screen *display, struct gui_synclist *list)
|
||||||
#ifdef HAVE_LCD_COLOR
|
#ifdef HAVE_LCD_COLOR
|
||||||
unsigned char cur_line = 0;
|
unsigned char cur_line = 0;
|
||||||
#endif
|
#endif
|
||||||
int item_offset, is_rtl = lang_is_rtl();
|
int item_offset;
|
||||||
bool show_title;
|
bool show_title;
|
||||||
struct viewport *list_text_vp = &list_text[screen];
|
struct viewport *list_text_vp = &list_text[screen];
|
||||||
|
|
||||||
|
@ -138,7 +132,6 @@ void list_draw(struct screen *display, struct gui_synclist *list)
|
||||||
display->clear_viewport();
|
display->clear_viewport();
|
||||||
display->scroll_stop(list_text_vp);
|
display->scroll_stop(list_text_vp);
|
||||||
*list_text_vp = *parent;
|
*list_text_vp = *parent;
|
||||||
UPDATE_RTL(list_text_vp);
|
|
||||||
if ((show_title = draw_title(display, list)))
|
if ((show_title = draw_title(display, list)))
|
||||||
{
|
{
|
||||||
list_text_vp->y += line_height;
|
list_text_vp->y += line_height;
|
||||||
|
@ -179,7 +172,6 @@ void list_draw(struct screen *display, struct gui_synclist *list)
|
||||||
|
|
||||||
/* setup icon placement */
|
/* setup icon placement */
|
||||||
list_icons = *list_text_vp;
|
list_icons = *list_text_vp;
|
||||||
UPDATE_RTL(&list_icons);
|
|
||||||
int icon_count = global_settings.show_icons &&
|
int icon_count = global_settings.show_icons &&
|
||||||
(list->callback_get_item_icon != NULL) ? 1 : 0;
|
(list->callback_get_item_icon != NULL) ? 1 : 0;
|
||||||
if (show_cursor)
|
if (show_cursor)
|
||||||
|
@ -188,7 +180,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)
|
if (IS_RTL(&list_icons))
|
||||||
list_icons.x += list_text_vp->width;
|
list_icons.x += list_text_vp->width;
|
||||||
else
|
else
|
||||||
list_text_vp->x += list_icons.width + ICON_PADDING;
|
list_text_vp->x += list_icons.width + ICON_PADDING;
|
||||||
|
|
|
@ -55,7 +55,7 @@
|
||||||
#include "system.h"
|
#include "system.h"
|
||||||
#include "statusbar.h"
|
#include "statusbar.h"
|
||||||
#include "appevents.h"
|
#include "appevents.h"
|
||||||
|
#include "language.h"
|
||||||
|
|
||||||
static int statusbar_enabled = 0;
|
static int statusbar_enabled = 0;
|
||||||
|
|
||||||
|
@ -147,6 +147,9 @@ void viewport_set_defaults(struct viewport *vp, enum screen_type screen)
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
viewport_set_fullscreen(vp, screen);
|
viewport_set_fullscreen(vp, screen);
|
||||||
|
|
||||||
|
vp->flags &= ~VP_IS_RTL;
|
||||||
|
vp->flags |= lang_is_rtl() ? VP_IS_RTL : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void viewportmanager_init(void)
|
void viewportmanager_init(void)
|
||||||
|
|
|
@ -25,6 +25,7 @@
|
||||||
#include "lang.h"
|
#include "lang.h"
|
||||||
#include "debug.h"
|
#include "debug.h"
|
||||||
#include "string.h"
|
#include "string.h"
|
||||||
|
#include "viewport.h"
|
||||||
|
|
||||||
/* The following header is generated by the build system and only defines
|
/* The following header is generated by the build system and only defines
|
||||||
MAX_LANGUAGE_SIZE to be the size of the largest currently available
|
MAX_LANGUAGE_SIZE to be the size of the largest currently available
|
||||||
|
@ -106,7 +107,15 @@ int lang_load(const char *filename)
|
||||||
retcode = 3;
|
retcode = 3;
|
||||||
}
|
}
|
||||||
close(fd);
|
close(fd);
|
||||||
lang_options = (retcode ? 0 : lang_header[3]);
|
if (retcode)
|
||||||
|
{
|
||||||
|
lang_options = 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
lang_options = lang_header[3];
|
||||||
|
viewportmanager_theme_changed(THEME_UI_VIEWPORT);
|
||||||
|
}
|
||||||
return retcode;
|
return retcode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue