summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
Diffstat (limited to 'apps')
-rw-r--r--apps/gui/bitmap/list.c31
-rw-r--r--apps/gui/icon.c3
-rw-r--r--apps/lang/arabic.lang3
-rw-r--r--apps/lang/english.lang51
-rw-r--r--apps/lang/hebrew.lang4
-rw-r--r--apps/language.c13
-rw-r--r--apps/language.h2
-rw-r--r--apps/settings.h2
-rw-r--r--apps/settings_list.c5
9 files changed, 100 insertions, 14 deletions
diff --git a/apps/gui/bitmap/list.c b/apps/gui/bitmap/list.c
index 94870538d6..ff29397532 100644
--- a/apps/gui/bitmap/list.c
+++ b/apps/gui/bitmap/list.c
@@ -40,6 +40,7 @@
40#include "sound.h" 40#include "sound.h"
41#include "misc.h" 41#include "misc.h"
42#include "viewport.h" 42#include "viewport.h"
43#include "language.h"
43 44
44#define ICON_PADDING 1 45#define ICON_PADDING 1
45 46
@@ -61,6 +62,9 @@ bool list_display_title(struct gui_synclist *list, enum screen_type screen);
61 | | | items | I - icons 62 | | | items | I - icons
62 | | | | 63 | | | |
63 ------------------ 64 ------------------
65
66 Note: This image is flipped horizontally when the language is a
67 right-to-left one (Hebrew, Arabic)
64*/ 68*/
65static bool draw_title(struct screen *display, struct gui_synclist *list) 69static bool draw_title(struct screen *display, struct gui_synclist *list)
66{ 70{
@@ -77,10 +81,17 @@ static bool draw_title(struct screen *display, struct gui_synclist *list)
77 struct viewport title_icon = title_text[screen]; 81 struct viewport title_icon = title_text[screen];
78 title_icon.width = get_icon_width(screen) 82 title_icon.width = get_icon_width(screen)
79 + ICON_PADDING*2; 83 + ICON_PADDING*2;
80 title_icon.x += ICON_PADDING; 84 if (lang_is_rtl())
81 85 {
86 title_icon.x = title_text[screen].width - ICON_PADDING -
87 get_icon_width(screen);
88 }
89 else
90 {
91 title_icon.x = ICON_PADDING;
92 title_text[screen].x += title_icon.width;
93 }
82 title_text[screen].width -= title_icon.width; 94 title_text[screen].width -= title_icon.width;
83 title_text[screen].x += title_icon.width;
84 95
85 display->set_viewport(&title_icon); 96 display->set_viewport(&title_icon);
86 screen_put_icon(display, 0, 0, list->title_icon); 97 screen_put_icon(display, 0, 0, list->title_icon);
@@ -108,7 +119,7 @@ void list_draw(struct screen *display, struct gui_synclist *list)
108#ifdef HAVE_LCD_COLOR 119#ifdef HAVE_LCD_COLOR
109 unsigned char cur_line = 0; 120 unsigned char cur_line = 0;
110#endif 121#endif
111 int item_offset; 122 int item_offset, is_rtl = lang_is_rtl();
112 bool show_title; 123 bool show_title;
113 line_height = font_get(parent->font)->height; 124 line_height = font_get(parent->font)->height;
114 display->set_viewport(parent); 125 display->set_viewport(parent);
@@ -132,12 +143,12 @@ void list_draw(struct screen *display, struct gui_synclist *list)
132 vp = list_text[screen]; 143 vp = list_text[screen];
133 vp.width = SCROLLBAR_WIDTH; 144 vp.width = SCROLLBAR_WIDTH;
134 list_text[screen].width -= SCROLLBAR_WIDTH; 145 list_text[screen].width -= SCROLLBAR_WIDTH;
135 if(global_settings.scrollbar == SCROLLBAR_LEFT) 146 if (global_settings.scrollbar == SCROLLBAR_SHOW)
136 list_text[screen].x += SCROLLBAR_WIDTH; 147 list_text[screen].x += SCROLLBAR_WIDTH;
137 vp.height = line_height * 148 vp.height = line_height *
138 viewport_get_nb_lines(&list_text[screen]); 149 viewport_get_nb_lines(&list_text[screen]);
139 vp.x = parent->x; 150 vp.x = parent->x;
140 if(global_settings.scrollbar == SCROLLBAR_RIGHT) 151 if (global_settings.scrollbar == SCROLLBAR_SHOW_OPPOSITE)
141 vp.x += list_text[screen].width; 152 vp.x += list_text[screen].width;
142 display->set_viewport(&vp); 153 display->set_viewport(&vp);
143 gui_scrollbar_draw(display, 0, 0, SCROLLBAR_WIDTH-1, 154 gui_scrollbar_draw(display, 0, 0, SCROLLBAR_WIDTH-1,
@@ -149,7 +160,7 @@ void list_draw(struct screen *display, struct gui_synclist *list)
149 else if (show_title) 160 else if (show_title)
150 { 161 {
151 /* shift everything right a bit... */ 162 /* shift everything right a bit... */
152 if(global_settings.scrollbar == SCROLLBAR_LEFT) 163 if (global_settings.scrollbar == SCROLLBAR_SHOW)
153 { 164 {
154 list_text[screen].width -= SCROLLBAR_WIDTH; 165 list_text[screen].width -= SCROLLBAR_WIDTH;
155 list_text[screen].x += SCROLLBAR_WIDTH; 166 list_text[screen].x += SCROLLBAR_WIDTH;
@@ -167,8 +178,10 @@ void list_draw(struct screen *display, struct gui_synclist *list)
167 list_icons.width = icon_width * icon_count; 178 list_icons.width = icon_width * icon_count;
168 list_text[screen].width -= 179 list_text[screen].width -=
169 list_icons.width + ICON_PADDING; 180 list_icons.width + ICON_PADDING;
170 list_text[screen].x += 181 if (is_rtl)
171 list_icons.width + ICON_PADDING; 182 list_icons.x += list_text[screen].width;
183 else
184 list_text[screen].x += list_icons.width + ICON_PADDING;
172 } 185 }
173 186
174 for (i=start; i<end && i<list->nb_items; i++) 187 for (i=start; i<end && i<list->nb_items; i++)
diff --git a/apps/gui/icon.c b/apps/gui/icon.c
index 53cfd87774..a473c82872 100644
--- a/apps/gui/icon.c
+++ b/apps/gui/icon.c
@@ -29,6 +29,7 @@
29#include "settings.h" 29#include "settings.h"
30#include "bmp.h" 30#include "bmp.h"
31#include "filetypes.h" 31#include "filetypes.h"
32#include "language.h"
32 33
33#include "bitmaps/default_icons.h" 34#include "bitmaps/default_icons.h"
34#if defined(HAVE_REMOTE_LCD) && (NB_SCREENS > 1) 35#if defined(HAVE_REMOTE_LCD) && (NB_SCREENS > 1)
@@ -170,6 +171,8 @@ void screen_put_iconxy(struct screen * display,
170#endif 171#endif
171 draw_func = display->bitmap_part; 172 draw_func = display->bitmap_part;
172 173
174 if (lang_is_rtl())
175 xpos = display->getwidth() - xpos - width;
173 draw_func(data, 0, height * icon, stride, xpos, ypos, width, height); 176 draw_func(data, 0, height * icon, stride, xpos, ypos, width, height);
174} 177}
175 178
diff --git a/apps/lang/arabic.lang b/apps/lang/arabic.lang
index c06af35560..73a98fe906 100644
--- a/apps/lang/arabic.lang
+++ b/apps/lang/arabic.lang
@@ -17,6 +17,9 @@
17# Arabic language file, translated by: 17# Arabic language file, translated by:
18# - Mohamed Tarek 18# - Mohamed Tarek
19# - Raafat Akkad 19# - Raafat Akkad
20<options>
21 rtl: 1
22</options>
20<phrase> 23<phrase>
21 id: LANG_EQUALIZER_HARDWARE_BANDWIDTH_NARROW 24 id: LANG_EQUALIZER_HARDWARE_BANDWIDTH_NARROW
22 desc: deprecated 25 desc: deprecated
diff --git a/apps/lang/english.lang b/apps/lang/english.lang
index 8be7380225..d34b2e9b32 100644
--- a/apps/lang/english.lang
+++ b/apps/lang/english.lang
@@ -13075,3 +13075,54 @@
13075 swcodec: "Release Time" 13075 swcodec: "Release Time"
13076 </voice> 13076 </voice>
13077</phrase> 13077</phrase>
13078<phrase>
13079 id: LANG_HIDE
13080 desc: in Settings -> General -> Display -> Status-/Scrollbar -> Scrollbar
13081 user: core
13082 <source>
13083 *: none
13084 lcd_bitmap: "Hide"
13085 </source>
13086 <dest>
13087 *: none
13088 lcd_bitmap: "Hide"
13089 </dest>
13090 <voice>
13091 *: none
13092 lcd_bitmap: "Hide"
13093 </voice>
13094</phrase>
13095<phrase>
13096 id: LANG_SHOW
13097 desc: in Settings -> General -> Display -> Status-/Scrollbar -> Scrollbar
13098 user: core
13099 <source>
13100 *: none
13101 lcd_bitmap: "Show"
13102 </source>
13103 <dest>
13104 *: none
13105 lcd_bitmap: "Show"
13106 </dest>
13107 <voice>
13108 *: none
13109 lcd_bitmap: "Show"
13110 </voice>
13111</phrase>
13112<phrase>
13113 id: LANG_SHOW_OPPOSITE
13114 desc: in Settings -> General -> Display -> Status-/Scrollbar -> Scrollbar
13115 user: core
13116 <source>
13117 *: none
13118 lcd_bitmap: "Show Opposite"
13119 </source>
13120 <dest>
13121 *: none
13122 lcd_bitmap: "Show Opposite"
13123 </dest>
13124 <voice>
13125 *: none
13126 lcd_bitmap: "Show Opposite"
13127 </voice>
13128</phrase>
diff --git a/apps/lang/hebrew.lang b/apps/lang/hebrew.lang
index 76deb4d007..449bbfe0a0 100644
--- a/apps/lang/hebrew.lang
+++ b/apps/lang/hebrew.lang
@@ -20,6 +20,10 @@
20# - Rani Hod 20# - Rani Hod
21# - Tomer Shalev 21# - Tomer Shalev
22# - Sasha Khamkov 22# - Sasha Khamkov
23
24<options>
25 rtl: 1
26</options>
23<phrase> 27<phrase>
24 id: LANG_SET_BOOL_YES 28 id: LANG_SET_BOOL_YES
25 desc: bool true representation 29 desc: bool true representation
diff --git a/apps/language.c b/apps/language.c
index bba1359616..0c6245f08c 100644
--- a/apps/language.c
+++ b/apps/language.c
@@ -34,9 +34,10 @@
34/* These defines must match the initial bytes in the binary lang file */ 34/* These defines must match the initial bytes in the binary lang file */
35/* See tools/genlang (TODO: Use common include for both) */ 35/* See tools/genlang (TODO: Use common include for both) */
36#define LANGUAGE_COOKIE 0x1a 36#define LANGUAGE_COOKIE 0x1a
37#define LANGUAGE_VERSION 0x04 37#define LANGUAGE_VERSION 0x05
38#define LANGUAGE_FLAG_RTL 0x01
38 39
39#define HEADER_SIZE 3 40#define HEADER_SIZE 4
40 41
41static unsigned char language_buffer[MAX_LANGUAGE_SIZE]; 42static unsigned char language_buffer[MAX_LANGUAGE_SIZE];
42 43
@@ -51,6 +52,13 @@ void lang_init(void)
51 } 52 }
52} 53}
53 54
55static unsigned char lang_options = 0;
56
57int lang_is_rtl(void)
58{
59 return (lang_options & LANGUAGE_FLAG_RTL) != 0;
60}
61
54int lang_load(const char *filename) 62int lang_load(const char *filename)
55{ 63{
56 int fsize; 64 int fsize;
@@ -98,6 +106,7 @@ int lang_load(const char *filename)
98 retcode = 3; 106 retcode = 3;
99 } 107 }
100 close(fd); 108 close(fd);
109 lang_options = (retcode ? 0 : lang_header[3]);
101 return retcode; 110 return retcode;
102} 111}
103 112
diff --git a/apps/language.h b/apps/language.h
index 06769a3dd9..c2a1b70e18 100644
--- a/apps/language.h
+++ b/apps/language.h
@@ -30,4 +30,6 @@ int lang_load(const char *filename);
30/* get the ID of an english string so it can be localised */ 30/* get the ID of an english string so it can be localised */
31int lang_english_to_id(const char* english); 31int lang_english_to_id(const char* english);
32 32
33/* returns whether the loaded language is a right-to-left language */
34int lang_is_rtl(void);
33#endif 35#endif
diff --git a/apps/settings.h b/apps/settings.h
index b208ee5872..b64fe37c74 100644
--- a/apps/settings.h
+++ b/apps/settings.h
@@ -158,7 +158,7 @@ enum { REPLAYGAIN_TRACK = 0, REPLAYGAIN_ALBUM, REPLAYGAIN_SHUFFLE, REPLAYGAIN_OF
158enum { SHOW_PATH_OFF = 0, SHOW_PATH_CURRENT, SHOW_PATH_FULL }; 158enum { SHOW_PATH_OFF = 0, SHOW_PATH_CURRENT, SHOW_PATH_FULL };
159 159
160/* scrollbar visibility/position */ 160/* scrollbar visibility/position */
161enum { SCROLLBAR_OFF = 0, SCROLLBAR_LEFT, SCROLLBAR_RIGHT }; 161enum { SCROLLBAR_HIDE = 0, SCROLLBAR_SHOW, SCROLLBAR_SHOW_OPPOSITE };
162 162
163/* Alarm settings */ 163/* Alarm settings */
164#ifdef HAVE_RTC_ALARM 164#ifdef HAVE_RTC_ALARM
diff --git a/apps/settings_list.c b/apps/settings_list.c
index 62a9351782..d76c2deb69 100644
--- a/apps/settings_list.c
+++ b/apps/settings_list.c
@@ -641,8 +641,9 @@ const struct settings_list settings[] = {
641 ID2P(LANG_STATUSBAR_BOTTOM)), 641 ID2P(LANG_STATUSBAR_BOTTOM)),
642#endif 642#endif
643 CHOICE_SETTING(F_THEMESETTING|F_TEMPVAR, scrollbar, 643 CHOICE_SETTING(F_THEMESETTING|F_TEMPVAR, scrollbar,
644 LANG_SCROLL_BAR, SCROLLBAR_LEFT, "scrollbar","off,left,right", 644 LANG_SCROLL_BAR, SCROLLBAR_SHOW,
645 NULL, 3, ID2P(LANG_OFF), ID2P(LANG_LEFT), ID2P(LANG_RIGHT)), 645 "scrollbar","hide,show,show_opposite", NULL, 3,
646 ID2P(LANG_HIDE), ID2P(LANG_SHOW), ID2P(LANG_SHOW_OPPOSITE)),
646 INT_SETTING(F_THEMESETTING, scrollbar_width, LANG_SCROLLBAR_WIDTH, 6, 647 INT_SETTING(F_THEMESETTING, scrollbar_width, LANG_SCROLLBAR_WIDTH, 6,
647 "scrollbar width",UNIT_INT, 3, MAX(LCD_WIDTH/10,25), 1, 648 "scrollbar width",UNIT_INT, 3, MAX(LCD_WIDTH/10,25), 1,
648 NULL, NULL, NULL), 649 NULL, NULL, NULL),