summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
Diffstat (limited to 'apps')
-rw-r--r--apps/gui/icon.h4
-rw-r--r--apps/player/icons.h4
-rw-r--r--apps/player/keyboard.c66
-rw-r--r--apps/plugin.c6
-rw-r--r--apps/plugin.h22
-rw-r--r--apps/plugins/euroconverter.c35
-rw-r--r--apps/plugins/flipit.c2
-rw-r--r--apps/plugins/jackpot.c12
-rw-r--r--apps/plugins/lib/playergfx.c2
-rw-r--r--apps/plugins/nim.c20
-rw-r--r--apps/screen_access.c40
-rw-r--r--apps/screen_access.h21
-rw-r--r--apps/screens.c26
13 files changed, 120 insertions, 140 deletions
diff --git a/apps/gui/icon.h b/apps/gui/icon.h
index e21db7a133..9ceda9e933 100644
--- a/apps/gui/icon.h
+++ b/apps/gui/icon.h
@@ -26,13 +26,13 @@
26typedef const unsigned char * ICON; 26typedef const unsigned char * ICON;
27#define NOICON NULL 27#define NOICON NULL
28#else 28#else
29typedef short ICON; 29typedef long ICON;
30#define NOICON -1 30#define NOICON -1
31#endif 31#endif
32 32
33#define Icon_NOICON -1 33#define Icon_NOICON -1
34 34
35#define CURSOR_CHAR 0x92 35#define CURSOR_CHAR 0xe10c
36#define CURSOR_WIDTH 6 36#define CURSOR_WIDTH 6
37#define CURSOR_HEIGHT 8 37#define CURSOR_HEIGHT 8
38 38
diff --git a/apps/player/icons.h b/apps/player/icons.h
index 32a6adf75a..5df94b09e3 100644
--- a/apps/player/icons.h
+++ b/apps/player/icons.h
@@ -30,8 +30,8 @@
30enum { 30enum {
31 Icon_Queued = 'Q', 31 Icon_Queued = 'Q',
32 Icon_Moving = 'M', 32 Icon_Moving = 'M',
33 Icon_Unknown = 0x90, 33 Icon_Unknown = 0xe100,
34 Icon_Bookmark = 0x16, 34 Icon_Bookmark,
35 Icon_Plugin, 35 Icon_Plugin,
36 Icon_Folder, 36 Icon_Folder,
37 Icon_Firmware, 37 Icon_Firmware,
diff --git a/apps/player/keyboard.c b/apps/player/keyboard.c
index 380edd5e95..791693f9fe 100644
--- a/apps/player/keyboard.c
+++ b/apps/player/keyboard.c
@@ -31,53 +31,46 @@
31#include "misc.h" 31#include "misc.h"
32#include "rbunicode.h" 32#include "rbunicode.h"
33 33
34#define KBD_BUF_SIZE 64
34#define KEYBOARD_PAGES 3 35#define KEYBOARD_PAGES 3
35 36
36extern unsigned short *lcd_ascii; 37static unsigned short *kbd_setupkeys(int page, int* len)
37
38static unsigned char* kbd_setupkeys(int page, int* len)
39{ 38{
40 static unsigned char lines[128]; 39 static unsigned short kbdline[KBD_BUF_SIZE];
41 40 const unsigned char *p;
42 unsigned ch;
43 int i = 0; 41 int i = 0;
44 42
45 switch (page) 43 switch (page)
46 { 44 {
47 case 0: /* Capitals */ 45 case 0: /* Capitals */
48 for (ch = 'A'; ch <= 'Z'; ch++) 46 p = "ABCDEFGHIJKLMNOPQRSTUVWXYZÀÁÂÃÄÅ"
49 lines[i++] = ch; 47 "ÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÝ";
50 for (ch = 0xc0; ch <= 0xdd; ch++)
51 if (lcd_ascii[ch] != NOCHAR_NEW && lcd_ascii[ch] != NOCHAR_OLD)
52 lines[i++] = ch;
53 break; 48 break;
54 49
55 case 1: /* Small */ 50 case 1: /* Small */
56 for (ch = 'a'; ch <= 'z'; ch++) 51 p = "abcdefghijklmnopqrstuvwxyzßàáâãä"
57 lines[i++] = ch; 52 "åçèéêëìíîïñòóôöøùúûüýÿ";
58 for (ch = 0xdf; ch <= 0xff; ch++)
59 if (lcd_ascii[ch] != NOCHAR_NEW && lcd_ascii[ch] != NOCHAR_OLD)
60 lines[i++] = ch;
61 break; 53 break;
62 54
63 case 2: /* Others */ 55 default: /* Others */
64 for (ch = ' '; ch <= '@'; ch++) 56 p = " !\"#$%&'()*+,-./0123456789:;<=>?@[]_{}~";
65 lines[i++] = ch;
66 break; 57 break;
67 } 58 }
68 59
69 lines[i] = 0; 60 while (*p)
61 p = utf8decode(p, &kbdline[i++]);
62
70 *len = i; 63 *len = i;
71 64
72 return lines; 65 return kbdline;
73} 66}
74 67
75/* Delimiters for highlighting the character selected for insertion */ 68/* Delimiters for highlighting the character selected for insertion */
76#define KEYBOARD_INSERT_LEFT 0x81 69#define KEYBOARD_INSERT_LEFT 0xe110
77#define KEYBOARD_INSERT_RIGHT 0x82 70#define KEYBOARD_INSERT_RIGHT 0xe10f
78 71
79#define KEYBOARD_CURSOR 0x7f 72#define KEYBOARD_CURSOR 0x7f
80#define KEYBOARD_ARROW 0x92 73#define KEYBOARD_ARROW 0xe10c
81 74
82/* helper function to spell a char if voice UI is enabled */ 75/* helper function to spell a char if voice UI is enabled */
83static void kbd_spellchar(char c) 76static void kbd_spellchar(char c)
@@ -101,9 +94,8 @@ int kbd_input(char* text, int buflen)
101 94
102 int len, len_utf8, i, j; 95 int len, len_utf8, i, j;
103 int editpos, curpos, leftpos; 96 int editpos, curpos, leftpos;
104 unsigned char *line = kbd_setupkeys(page, &linelen); 97 unsigned short *line = kbd_setupkeys(page, &linelen);
105 unsigned char temptext[36]; 98 unsigned char temptext[36];
106 unsigned char tmp;
107 unsigned char *utf8; 99 unsigned char *utf8;
108 100
109 int button, lastbutton = 0; 101 int button, lastbutton = 0;
@@ -130,20 +122,14 @@ int kbd_input(char* text, int buflen)
130 lcd_putc(0, 0, KEYBOARD_ARROW); 122 lcd_putc(0, 0, KEYBOARD_ARROW);
131 lcd_putc(0, 1, ' '); 123 lcd_putc(0, 1, ' ');
132 } 124 }
133 125
134 /* Draw insert chars */ 126 lcd_putc(1, 0, KEYBOARD_INSERT_LEFT);
135 utf8 = temptext; 127 lcd_putc(2, 0, line[x]);
136 tmp = KEYBOARD_INSERT_LEFT; 128 lcd_putc(3, 0, KEYBOARD_INSERT_RIGHT);
137 utf8 = iso_decode(&tmp, utf8, 0, 1);
138 utf8 = iso_decode(&line[x], utf8, 0, 1);
139 tmp = KEYBOARD_INSERT_RIGHT;
140 utf8 = iso_decode(&tmp, utf8, 0, 1);
141 for (i = 1; i < 8; i++) 129 for (i = 1; i < 8; i++)
142 { 130 {
143 utf8 = iso_decode(&line[(x+i)%linelen], utf8, 0, 1); 131 lcd_putc(i + 3, 0, line[(x+i)%linelen]);
144 } 132 }
145 *utf8 = 0;
146 lcd_puts(1, 0, temptext);
147 133
148 /* write out the text */ 134 /* write out the text */
149 curpos = MIN(MIN(editpos, 10 - MIN(len_utf8 - editpos, 3)), 9); 135 curpos = MIN(MIN(editpos, 10 - MIN(len_utf8 - editpos, 3)), 9);
@@ -175,7 +161,7 @@ int kbd_input(char* text, int buflen)
175 lcd_remove_cursor(); 161 lcd_remove_cursor();
176 lcd_puts(1, 1, temptext); 162 lcd_puts(1, 1, temptext);
177 lcd_put_cursor(curpos + 1, 1, KEYBOARD_CURSOR); 163 lcd_put_cursor(curpos + 1, 1, KEYBOARD_CURSOR);
178 164
179 gui_syncstatusbar_draw(&statusbars, true); 165 gui_syncstatusbar_draw(&statusbars, true);
180 } 166 }
181 167
@@ -270,7 +256,7 @@ int kbd_input(char* text, int buflen)
270 } 256 }
271 else /* inserts the selected char */ 257 else /* inserts the selected char */
272 { 258 {
273 utf8 = iso_decode((unsigned char*)&line[x], temptext, 0, 1); 259 utf8 = utf8encode(line[x], temptext);
274 *utf8 = 0; 260 *utf8 = 0;
275 j = strlen(temptext); 261 j = strlen(temptext);
276 if (len + j < buflen) 262 if (len + j < buflen)
diff --git a/apps/plugin.c b/apps/plugin.c
index 7a2ce00e23..de04269a89 100644
--- a/apps/plugin.c
+++ b/apps/plugin.c
@@ -67,6 +67,9 @@ static const struct plugin_api rockbox_api = {
67 /* lcd */ 67 /* lcd */
68 lcd_set_contrast, 68 lcd_set_contrast,
69 lcd_clear_display, 69 lcd_clear_display,
70 lcd_setmargins,
71 lcd_getstringsize,
72 lcd_putsxy,
70 lcd_puts, 73 lcd_puts,
71 lcd_puts_scroll, 74 lcd_puts_scroll,
72 lcd_stop_scroll, 75 lcd_stop_scroll,
@@ -80,11 +83,9 @@ static const struct plugin_api rockbox_api = {
80 PREFIX(lcd_icon), 83 PREFIX(lcd_icon),
81 lcd_double_height, 84 lcd_double_height,
82#else 85#else
83 lcd_setmargins,
84 lcd_set_drawmode, 86 lcd_set_drawmode,
85 lcd_get_drawmode, 87 lcd_get_drawmode,
86 lcd_setfont, 88 lcd_setfont,
87 lcd_getstringsize,
88 lcd_drawpixel, 89 lcd_drawpixel,
89 lcd_drawline, 90 lcd_drawline,
90 lcd_hline, 91 lcd_hline,
@@ -109,7 +110,6 @@ static const struct plugin_api rockbox_api = {
109 bidi_l2v, 110 bidi_l2v,
110 font_get_bits, 111 font_get_bits,
111 font_load, 112 font_load,
112 lcd_putsxy,
113 lcd_puts_style, 113 lcd_puts_style,
114 lcd_puts_scroll_style, 114 lcd_puts_scroll_style,
115 &lcd_framebuffer[0][0], 115 &lcd_framebuffer[0][0],
diff --git a/apps/plugin.h b/apps/plugin.h
index dbe79368da..7688057d86 100644
--- a/apps/plugin.h
+++ b/apps/plugin.h
@@ -29,7 +29,7 @@
29#define MEM 2 29#define MEM 2
30#endif 30#endif
31 31
32#include <stdbool.h> 32#include <stdbool.h>
33#include <sys/types.h> 33#include <sys/types.h>
34#include <stdarg.h> 34#include <stdarg.h>
35#include <stdio.h> 35#include <stdio.h>
@@ -110,12 +110,12 @@
110#define PLUGIN_MAGIC 0x526F634B /* RocK */ 110#define PLUGIN_MAGIC 0x526F634B /* RocK */
111 111
112/* increase this every time the api struct changes */ 112/* increase this every time the api struct changes */
113#define PLUGIN_API_VERSION 49 113#define PLUGIN_API_VERSION 50
114 114
115/* update this to latest version if a change to the api struct breaks 115/* update this to latest version if a change to the api struct breaks
116 backwards compatibility (and please take the opportunity to sort in any 116 backwards compatibility (and please take the opportunity to sort in any
117 new function which are "waiting" at the end of the function table) */ 117 new function which are "waiting" at the end of the function table) */
118#define PLUGIN_MIN_API_VERSION 47 118#define PLUGIN_MIN_API_VERSION 50
119 119
120/* plugin return codes */ 120/* plugin return codes */
121enum plugin_status { 121enum plugin_status {
@@ -135,24 +135,25 @@ struct plugin_api {
135 /* lcd */ 135 /* lcd */
136 void (*lcd_set_contrast)(int x); 136 void (*lcd_set_contrast)(int x);
137 void (*lcd_clear_display)(void); 137 void (*lcd_clear_display)(void);
138 void (*lcd_setmargins)(int x, int y);
139 int (*lcd_getstringsize)(const unsigned char *str, int *w, int *h);
140 void (*lcd_putsxy)(int x, int y, const unsigned char *string);
138 void (*lcd_puts)(int x, int y, const unsigned char *string); 141 void (*lcd_puts)(int x, int y, const unsigned char *string);
139 void (*lcd_puts_scroll)(int x, int y, const unsigned char* string); 142 void (*lcd_puts_scroll)(int x, int y, const unsigned char* string);
140 void (*lcd_stop_scroll)(void); 143 void (*lcd_stop_scroll)(void);
141#ifdef HAVE_LCD_CHARCELLS 144#ifdef HAVE_LCD_CHARCELLS
142 void (*lcd_define_pattern)(int which,const char *pattern); 145 void (*lcd_define_pattern)(unsigned long ucs, const char *pattern);
143 unsigned char (*lcd_get_locked_pattern)(void); 146 unsigned long (*lcd_get_locked_pattern)(void);
144 void (*lcd_unlock_pattern)(unsigned char pat); 147 void (*lcd_unlock_pattern)(unsigned long ucs);
145 void (*lcd_putc)(int x, int y, unsigned short ch); 148 void (*lcd_putc)(int x, int y, unsigned long ucs);
146 void (*lcd_put_cursor)(int x, int y, char cursor_char); 149 void (*lcd_put_cursor)(int x, int y, unsigned long ucs);
147 void (*lcd_remove_cursor)(void); 150 void (*lcd_remove_cursor)(void);
148 void (*PREFIX(lcd_icon))(int icon, bool enable); 151 void (*PREFIX(lcd_icon))(int icon, bool enable);
149 void (*lcd_double_height)(bool on); 152 void (*lcd_double_height)(bool on);
150#else 153#else
151 void (*lcd_setmargins)(int x, int y);
152 void (*lcd_set_drawmode)(int mode); 154 void (*lcd_set_drawmode)(int mode);
153 int (*lcd_get_drawmode)(void); 155 int (*lcd_get_drawmode)(void);
154 void (*lcd_setfont)(int font); 156 void (*lcd_setfont)(int font);
155 int (*lcd_getstringsize)(const unsigned char *str, int *w, int *h);
156 void (*lcd_drawpixel)(int x, int y); 157 void (*lcd_drawpixel)(int x, int y);
157 void (*lcd_drawline)(int x1, int y1, int x2, int y2); 158 void (*lcd_drawline)(int x1, int y1, int x2, int y2);
158 void (*lcd_hline)(int x1, int x2, int y); 159 void (*lcd_hline)(int x1, int x2, int y);
@@ -184,7 +185,6 @@ struct plugin_api {
184 unsigned short *(*bidi_l2v)( const unsigned char *str, int orientation ); 185 unsigned short *(*bidi_l2v)( const unsigned char *str, int orientation );
185 const unsigned char *(*font_get_bits)( struct font *pf, unsigned short char_code ); 186 const unsigned char *(*font_get_bits)( struct font *pf, unsigned short char_code );
186 struct font* (*font_load)(const char *path); 187 struct font* (*font_load)(const char *path);
187 void (*lcd_putsxy)(int x, int y, const unsigned char *string);
188 void (*lcd_puts_style)(int x, int y, const unsigned char *str, int style); 188 void (*lcd_puts_style)(int x, int y, const unsigned char *str, int style);
189 void (*lcd_puts_scroll_style)(int x, int y, const unsigned char* string, 189 void (*lcd_puts_scroll_style)(int x, int y, const unsigned char* string,
190 int style); 190 int style);
diff --git a/apps/plugins/euroconverter.c b/apps/plugins/euroconverter.c
index 3cf36affea..97ec21dd98 100644
--- a/apps/plugins/euroconverter.c
+++ b/apps/plugins/euroconverter.c
@@ -138,7 +138,7 @@ static unsigned char *abbrev_str[12] = {
138 }; 138 };
139 139
140 140
141static unsigned char heuro,hhome; /*Handles for the new patterns*/ 141static unsigned long heuro,hhome; /*Handles for the new patterns*/
142 142
143static struct plugin_api* rb; 143static struct plugin_api* rb;
144 144
@@ -239,7 +239,6 @@ static void round(longlong_t* i, longlong_t* f, int n)
239*/ 239*/
240static void display(longlong_t euro, longlong_t home, bool pos) 240static void display(longlong_t euro, longlong_t home, bool pos)
241{ 241{
242 char c1,c2;
243 longlong_t i,f; 242 longlong_t i,f;
244 unsigned char str[20]; 243 unsigned char str[20];
245 unsigned char s1[20]; 244 unsigned char s1[20];
@@ -247,52 +246,50 @@ static void display(longlong_t euro, longlong_t home, bool pos)
247 246
248 if (pos) 247 if (pos)
249 { /*Edit the second line*/ 248 { /*Edit the second line*/
250 c1=0x20; 249 rb->strcpy(s1," %6d.%02d");
251 rb->strcpy(s1,"%c%c%6d.%02d");
252 c2=0x81;
253 if (nb_digit[country]==2) 250 if (nb_digit[country]==2)
254 rb->strcpy(s2,"%c%c%06d.%02d"); 251 rb->strcpy(s2,"\xee\x84\x90%06d.%02d");
255 else 252 else
256 rb->strcpy(s2,"%c%c%09d"); 253 rb->strcpy(s2,"\xee\x84\x90%09d");
257 } 254 }
258 else 255 else
259 { 256 {
260 c1=0x81; 257 rb->strcpy(s1,"\xee\x84\x90%06d.%02d");
261 rb->strcpy(s1,"%c%c%06d.%02d");
262 c2=0x20;
263 if (nb_digit[country]==2) 258 if (nb_digit[country]==2)
264 rb->strcpy(s2,"%c%c%6d.%02d"); 259 rb->strcpy(s2," %6d.%02d");
265 else 260 else
266 rb->strcpy(s2,"%c%c%9d"); 261 rb->strcpy(s2," %9d");
267 } 262 }
268 263
269 rb->lcd_remove_cursor(); 264 rb->lcd_remove_cursor();
270 /*First line*/ 265 /*First line*/
266 rb->lcd_putc(0,0,heuro);
271 split(euro,&i,&f); 267 split(euro,&i,&f);
272 if (pos) 268 if (pos)
273 round(&i,&f,2); 269 round(&i,&f,2);
274 rb->snprintf(str,sizeof(str),s1,heuro,c1,(int)i,(int)f); 270 rb->snprintf(str,sizeof(str),s1,(int)i,(int)f);
275 271
276 if (!pos) 272 if (!pos)
277 { 273 {
278 rb->lcd_puts(0,0,str); 274 rb->lcd_puts(1,0,str);
279 rb->lcd_put_cursor(10-cur_pos,0,0x5F); 275 rb->lcd_put_cursor(10-cur_pos,0,0x5F);
280 } 276 }
281 else 277 else
282 rb->lcd_puts_scroll(0,0,str); 278 rb->lcd_puts_scroll(1,0,str);
283 279
284 /*Second line*/ 280 /*Second line*/
281 rb->lcd_putc(0,1,hhome);
285 split(home,&i,&f); 282 split(home,&i,&f);
286 if (!pos) 283 if (!pos)
287 round(&i,&f,nb_digit[country]); 284 round(&i,&f,nb_digit[country]);
288 rb->snprintf(str,sizeof(str),s2,hhome,c2,(int)i,(int)f); 285 rb->snprintf(str,sizeof(str),s2,(int)i,(int)f);
289 if (pos) 286 if (pos)
290 { 287 {
291 rb->lcd_puts(0,1,str); 288 rb->lcd_puts(1,1,str);
292 rb->lcd_put_cursor(10-cur_pos,1,0x5F); 289 rb->lcd_put_cursor(10-cur_pos,1,0x5F);
293 } 290 }
294 else 291 else
295 rb->lcd_puts_scroll(0,1,str); 292 rb->lcd_puts_scroll(1,1,str);
296} 293}
297 294
298 295
@@ -363,7 +360,7 @@ static int euro_menu(void)
363 rb->lcd_clear_display(); 360 rb->lcd_clear_display();
364 rb->lcd_puts(0,0," Currency"); 361 rb->lcd_puts(0,0," Currency");
365 rb->lcd_puts(0,1," Exit"); 362 rb->lcd_puts(0,1," Exit");
366 rb->lcd_putc(0,c,0x81); 363 rb->lcd_putc(0,c,0xe110);
367 364
368 switch (rb->button_get(true)) 365 switch (rb->button_get(true))
369 { 366 {
diff --git a/apps/plugins/flipit.c b/apps/plugins/flipit.c
index fd02bc4789..91afc9eca7 100644
--- a/apps/plugins/flipit.c
+++ b/apps/plugins/flipit.c
@@ -203,7 +203,7 @@ static const unsigned char tk_pat[4][7] = {
203}; 203};
204 204
205static unsigned char cur_pat[7]; 205static unsigned char cur_pat[7];
206static unsigned char gfx_chars[5]; 206static unsigned long gfx_chars[5];
207 207
208static void release_gfx(void) 208static void release_gfx(void)
209{ 209{
diff --git a/apps/plugins/jackpot.c b/apps/plugins/jackpot.c
index a2ebb81f5c..37ee4514e7 100644
--- a/apps/plugins/jackpot.c
+++ b/apps/plugins/jackpot.c
@@ -47,7 +47,7 @@ static unsigned char pattern[]={
47}; 47};
48 48
49static unsigned char str[12]; /*Containt the first line*/ 49static unsigned char str[12]; /*Containt the first line*/
50static unsigned char h1,h2,h3; /*Handle for the pattern*/ 50static unsigned long h1,h2,h3; /*Handle for the pattern*/
51 51
52/* here is a global api struct pointer. while not strictly necessary, 52/* here is a global api struct pointer. while not strictly necessary,
53 it's nice not to have to pass the api pointer in all function calls 53 it's nice not to have to pass the api pointer in all function calls
@@ -109,10 +109,12 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
109 rb->lcd_define_pattern(h1, pattern); 109 rb->lcd_define_pattern(h1, pattern);
110 rb->lcd_define_pattern(h2, pattern+7); 110 rb->lcd_define_pattern(h2, pattern+7);
111 rb->lcd_define_pattern(h3, pattern+28); 111 rb->lcd_define_pattern(h3, pattern+28);
112 rb->snprintf(str,sizeof(str),"%c%cJackpot%c%c",h1,h2,h2,h1); 112
113 rb->lcd_puts(0,0,str); 113 rb->lcd_puts(0,0," Jackpot ");
114 rb->snprintf(str,sizeof(str)," %c V1.1 %c",h3,h3); 114 rb->lcd_putc(0,0,h1); rb->lcd_putc(1,0,h2);
115 rb->lcd_puts(0,1,str); 115 rb->lcd_putc(9,0,h2); rb->lcd_putc(10,0,h1);
116 rb->lcd_puts(0,1," V1.1 ");
117 rb->lcd_putc(1,1,h3); rb->lcd_putc(9,1,h3);
116 rb->sleep(HZ*2); 118 rb->sleep(HZ*2);
117 rb->lcd_clear_display(); 119 rb->lcd_clear_display();
118 120
diff --git a/apps/plugins/lib/playergfx.c b/apps/plugins/lib/playergfx.c
index 1df7a3be4c..0e0a5d3788 100644
--- a/apps/plugins/lib/playergfx.c
+++ b/apps/plugins/lib/playergfx.c
@@ -31,7 +31,7 @@ static int char_width;
31static int char_height; 31static int char_height;
32static int pixel_height; 32static int pixel_height;
33static int pixel_width; 33static int pixel_width;
34static unsigned char gfx_chars[8]; 34static unsigned long gfx_chars[8];
35static unsigned char gfx_buffer[56]; 35static unsigned char gfx_buffer[56];
36static int drawmode = DRMODE_SOLID; 36static int drawmode = DRMODE_SOLID;
37 37
diff --git a/apps/plugins/nim.c b/apps/plugins/nim.c
index b309e296c0..9089cad00a 100644
--- a/apps/plugins/nim.c
+++ b/apps/plugins/nim.c
@@ -56,7 +56,7 @@ static unsigned char pattern2[]={0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14}; /*2
56static unsigned char pattern1[]={0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10}; /*1 part*/ 56static unsigned char pattern1[]={0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10}; /*1 part*/
57 57
58static unsigned char str[12]; /*String use to display the first line*/ 58static unsigned char str[12]; /*String use to display the first line*/
59static unsigned char hsmile,hcry,h1,h2; /*Handle for the new pattern*/ 59static unsigned long hsmile,hcry,h1,h2; /*Handle for the new pattern*/
60 60
61static bool end; /*If true game is finished*/ 61static bool end; /*If true game is finished*/
62static struct plugin_api* rb; 62static struct plugin_api* rb;
@@ -74,8 +74,8 @@ static void impossible(void)
74static void lose(void) 74static void lose(void)
75{ 75{
76 rb->lcd_define_pattern(hsmile,smile); 76 rb->lcd_define_pattern(hsmile,smile);
77 rb->snprintf(str,sizeof(str),"You Win!!%c",hsmile); 77 rb->lcd_puts(0,1,"You Win!!");
78 rb->lcd_puts(0,1,str); 78 rb->lcd_putc(8,1,hsmile);
79 end=true; 79 end=true;
80 rb->sleep(HZ*2); 80 rb->sleep(HZ*2);
81 return; 81 return;
@@ -86,8 +86,8 @@ static void lose(void)
86static void win(void) 86static void win(void)
87{ 87{
88 rb->lcd_define_pattern(hcry,cry); 88 rb->lcd_define_pattern(hcry,cry);
89 rb->snprintf(str,sizeof(str),"You Lose!!%c",hcry); 89 rb->lcd_puts(0,1,"You Lose!!");
90 rb->lcd_puts(0,1,str); 90 rb->lcd_putc(9,1,hcry);
91 end=true; 91 end=true;
92 rb->sleep(HZ*2); 92 rb->sleep(HZ*2);
93 return; 93 return;
@@ -100,22 +100,22 @@ static void display_first_line(int x)
100 int i; 100 int i;
101 101
102 rb->snprintf(str,sizeof(str)," =%d",x); 102 rb->snprintf(str,sizeof(str)," =%d",x);
103 rb->lcd_puts(0,0,str);
103 104
104 rb->lcd_define_pattern(h1,pattern3); 105 rb->lcd_define_pattern(h1,pattern3);
105 for(i=0;i<x/3;i++) 106 for (i=0;i<x/3;i++)
106 str[i]=h1; 107 rb->lcd_putc(i,0,h1);
107 108
108 if (x%3==2) 109 if (x%3==2)
109 { 110 {
110 rb->lcd_define_pattern(h2,pattern2); 111 rb->lcd_define_pattern(h2,pattern2);
111 str[i]=h2; 112 rb->lcd_putc(i,0,h2);
112 } 113 }
113 if (x%3==1) 114 if (x%3==1)
114 { 115 {
115 rb->lcd_define_pattern(h2,pattern1); 116 rb->lcd_define_pattern(h2,pattern1);
116 str[i]=h2; 117 rb->lcd_putc(i,0,h2);
117 } 118 }
118 rb->lcd_puts(0,0,str);
119} 119}
120 120
121/* Call when the program end */ 121/* Call when the program end */
diff --git a/apps/screen_access.c b/apps/screen_access.c
index 00db92769b..6728c4ea2a 100644
--- a/apps/screen_access.c
+++ b/apps/screen_access.c
@@ -41,16 +41,15 @@ void screen_init(struct screen * screen, enum screen_type screen_type)
41 screen->depth=LCD_REMOTE_DEPTH; 41 screen->depth=LCD_REMOTE_DEPTH;
42 screen->has_disk_led=false; 42 screen->has_disk_led=false;
43 43
44#if 1 /* all remote LCDs are bitmapped so far */
45 screen->width=LCD_REMOTE_WIDTH; 44 screen->width=LCD_REMOTE_WIDTH;
46 screen->height=LCD_REMOTE_HEIGHT; 45 screen->height=LCD_REMOTE_HEIGHT;
47 screen->setmargins=&lcd_remote_setmargins; 46 screen->setmargins=&lcd_remote_setmargins;
48 screen->getymargin=&lcd_remote_getymargin; 47 screen->getymargin=&lcd_remote_getymargin;
49 screen->getxmargin=&lcd_remote_getxmargin; 48 screen->getxmargin=&lcd_remote_getxmargin;
49 screen->getstringsize=&lcd_remote_getstringsize;
50#if 1 /* all remote LCDs are bitmapped so far */
50 screen->setfont=&lcd_remote_setfont; 51 screen->setfont=&lcd_remote_setfont;
51 screen->setfont(FONT_UI); 52 screen->setfont(FONT_UI);
52 screen->getstringsize=&lcd_remote_getstringsize;
53 screen->putsxy=&lcd_remote_putsxy;
54 screen->mono_bitmap=&lcd_remote_mono_bitmap; 53 screen->mono_bitmap=&lcd_remote_mono_bitmap;
55 screen->mono_bitmap_part=&lcd_remote_mono_bitmap_part; 54 screen->mono_bitmap_part=&lcd_remote_mono_bitmap_part;
56 screen->set_drawmode=&lcd_remote_set_drawmode; 55 screen->set_drawmode=&lcd_remote_set_drawmode;
@@ -70,20 +69,14 @@ void screen_init(struct screen * screen, enum screen_type screen_type)
70 screen->drawline=&lcd_remote_drawline; 69 screen->drawline=&lcd_remote_drawline;
71 screen->vline=&lcd_remote_vline; 70 screen->vline=&lcd_remote_vline;
72 screen->hline=&lcd_remote_hline; 71 screen->hline=&lcd_remote_hline;
73 screen->scroll_speed=&lcd_remote_scroll_speed;
74 screen->scroll_delay=&lcd_remote_scroll_delay;
75 screen->scroll_step=&lcd_remote_scroll_step; 72 screen->scroll_step=&lcd_remote_scroll_step;
76 screen->invertscroll=&lcd_remote_invertscroll; 73 screen->invertscroll=&lcd_remote_invertscroll;
77#endif /* LCD_REMOTE_DEPTH > 1 */
78 screen->puts_offset=&lcd_remote_puts_offset;
79 screen->puts_style_offset=&lcd_remote_puts_style_offset; 74 screen->puts_style_offset=&lcd_remote_puts_style_offset;
80 screen->puts_scroll_style=&lcd_remote_puts_scroll_style; 75 screen->puts_scroll_style=&lcd_remote_puts_scroll_style;
81 screen->puts_scroll_offset=&lcd_remote_puts_scroll_offset;
82 screen->puts_scroll_style_offset=&lcd_remote_puts_scroll_style_offset; 76 screen->puts_scroll_style_offset=&lcd_remote_puts_scroll_style_offset;
77#endif /* 1 */
83 78
84#if 0 /* no charcell remote LCDs so far */ 79#if 0 /* no charcell remote LCDs so far */
85 screen->width=11;
86 screen->height=2;
87 screen->double_height=&lcd_remote_double_height; 80 screen->double_height=&lcd_remote_double_height;
88 screen->putc=&lcd_remote_putc; 81 screen->putc=&lcd_remote_putc;
89 screen->get_locked_pattern=&lcd_remote_get_locked_pattern; 82 screen->get_locked_pattern=&lcd_remote_get_locked_pattern;
@@ -96,11 +89,16 @@ void screen_init(struct screen * screen, enum screen_type screen_type)
96#endif /* 0 */ 89#endif /* 0 */
97 90
98 screen->init=&lcd_remote_init; 91 screen->init=&lcd_remote_init;
92 screen->putsxy=&lcd_remote_putsxy;
93 screen->puts=&lcd_remote_puts;
94 screen->puts_offset=&lcd_remote_puts_offset;
99 screen->puts_scroll=&lcd_remote_puts_scroll; 95 screen->puts_scroll=&lcd_remote_puts_scroll;
96 screen->puts_scroll_offset=&lcd_remote_puts_scroll_offset;
97 screen->scroll_speed=&lcd_remote_scroll_speed;
98 screen->scroll_delay=&lcd_remote_scroll_delay;
100 screen->stop_scroll=&lcd_remote_stop_scroll; 99 screen->stop_scroll=&lcd_remote_stop_scroll;
101 screen->clear_display=&lcd_remote_clear_display; 100 screen->clear_display=&lcd_remote_clear_display;
102 screen->update=&lcd_remote_update; 101 screen->update=&lcd_remote_update;
103 screen->puts=&lcd_remote_puts;
104 screen->backlight_on=&remote_backlight_on; 102 screen->backlight_on=&remote_backlight_on;
105 screen->backlight_off=&remote_backlight_off; 103 screen->backlight_off=&remote_backlight_off;
106 screen->is_backlight_on=&is_remote_backlight_on; 104 screen->is_backlight_on=&is_remote_backlight_on;
@@ -116,16 +114,15 @@ void screen_init(struct screen * screen, enum screen_type screen_type)
116#elif defined(HAVE_REMOTE_LCD) 114#elif defined(HAVE_REMOTE_LCD)
117 screen->has_disk_led=true; 115 screen->has_disk_led=true;
118#endif 116#endif
119#ifdef HAVE_LCD_BITMAP
120 screen->width=LCD_WIDTH; 117 screen->width=LCD_WIDTH;
121 screen->height=LCD_HEIGHT; 118 screen->height=LCD_HEIGHT;
122 screen->setmargins=&lcd_setmargins; 119 screen->setmargins=&lcd_setmargins;
123 screen->getymargin=&lcd_getymargin; 120 screen->getymargin=&lcd_getymargin;
124 screen->getxmargin=&lcd_getxmargin; 121 screen->getxmargin=&lcd_getxmargin;
122 screen->getstringsize=&lcd_getstringsize;
123#ifdef HAVE_LCD_BITMAP
125 screen->setfont=&lcd_setfont; 124 screen->setfont=&lcd_setfont;
126 screen->setfont(FONT_UI); 125 screen->setfont(FONT_UI);
127 screen->getstringsize=&lcd_getstringsize;
128 screen->putsxy=&lcd_putsxy;
129 screen->mono_bitmap=&lcd_mono_bitmap; 126 screen->mono_bitmap=&lcd_mono_bitmap;
130 screen->mono_bitmap_part=&lcd_mono_bitmap_part; 127 screen->mono_bitmap_part=&lcd_mono_bitmap_part;
131 screen->set_drawmode=&lcd_set_drawmode; 128 screen->set_drawmode=&lcd_set_drawmode;
@@ -147,7 +144,7 @@ void screen_init(struct screen * screen, enum screen_type screen_type)
147 screen->get_foreground=&lcd_get_foreground; 144 screen->get_foreground=&lcd_get_foreground;
148 screen->set_background=&lcd_set_background; 145 screen->set_background=&lcd_set_background;
149 screen->set_foreground=&lcd_set_foreground; 146 screen->set_foreground=&lcd_set_foreground;
150#endif 147#endif /* LCD_DEPTH > 1 */
151 screen->update_rect=&lcd_update_rect; 148 screen->update_rect=&lcd_update_rect;
152 screen->fillrect=&lcd_fillrect; 149 screen->fillrect=&lcd_fillrect;
153 screen->drawrect=&lcd_drawrect; 150 screen->drawrect=&lcd_drawrect;
@@ -155,20 +152,14 @@ void screen_init(struct screen * screen, enum screen_type screen_type)
155 screen->drawline=&lcd_drawline; 152 screen->drawline=&lcd_drawline;
156 screen->vline=&lcd_vline; 153 screen->vline=&lcd_vline;
157 screen->hline=&lcd_hline; 154 screen->hline=&lcd_hline;
158 screen->scroll_speed=&lcd_scroll_speed;
159 screen->scroll_delay=&lcd_scroll_delay;
160 screen->scroll_step=&lcd_scroll_step; 155 screen->scroll_step=&lcd_scroll_step;
161 screen->invertscroll=&lcd_invertscroll; 156 screen->invertscroll=&lcd_invertscroll;
162 screen->puts_offset=&lcd_puts_offset;
163 screen->puts_style_offset=&lcd_puts_style_offset; 157 screen->puts_style_offset=&lcd_puts_style_offset;
164 screen->puts_scroll_style=&lcd_puts_scroll_style; 158 screen->puts_scroll_style=&lcd_puts_scroll_style;
165 screen->puts_scroll_offset=&lcd_puts_scroll_offset;
166 screen->puts_scroll_style_offset=&lcd_puts_scroll_style_offset; 159 screen->puts_scroll_style_offset=&lcd_puts_scroll_style_offset;
167#endif /* HAVE_LCD_BITMAP */ 160#endif /* HAVE_LCD_BITMAP */
168 161
169#ifdef HAVE_LCD_CHARCELLS 162#ifdef HAVE_LCD_CHARCELLS
170 screen->width=11; /* width in characters instead of pixels */
171 screen->height=2;
172 screen->double_height=&lcd_double_height; 163 screen->double_height=&lcd_double_height;
173 screen->putc=&lcd_putc; 164 screen->putc=&lcd_putc;
174 screen->get_locked_pattern=&lcd_get_locked_pattern; 165 screen->get_locked_pattern=&lcd_get_locked_pattern;
@@ -181,13 +172,18 @@ void screen_init(struct screen * screen, enum screen_type screen_type)
181#endif /* HAVE_LCD_CHARCELLS */ 172#endif /* HAVE_LCD_CHARCELLS */
182 173
183 screen->init=&lcd_init; 174 screen->init=&lcd_init;
175 screen->putsxy=&lcd_putsxy;
176 screen->puts=&lcd_puts;
177 screen->puts_offset=&lcd_puts_offset;
184 screen->puts_scroll=&lcd_puts_scroll; 178 screen->puts_scroll=&lcd_puts_scroll;
179 screen->puts_scroll_offset=&lcd_puts_scroll_offset;
180 screen->scroll_speed=&lcd_scroll_speed;
181 screen->scroll_delay=&lcd_scroll_delay;
185 screen->stop_scroll=&lcd_stop_scroll; 182 screen->stop_scroll=&lcd_stop_scroll;
186 screen->clear_display=&lcd_clear_display; 183 screen->clear_display=&lcd_clear_display;
187#if defined(HAVE_LCD_BITMAP) || defined(SIMULATOR) 184#if defined(HAVE_LCD_BITMAP) || defined(SIMULATOR)
188 screen->update=&lcd_update; 185 screen->update=&lcd_update;
189#endif 186#endif
190 screen->puts=&lcd_puts;
191 screen->backlight_on=&backlight_on; 187 screen->backlight_on=&backlight_on;
192 screen->backlight_off=&backlight_off; 188 screen->backlight_off=&backlight_off;
193 screen->is_backlight_on=&is_backlight_on; 189 screen->is_backlight_on=&is_backlight_on;
diff --git a/apps/screen_access.h b/apps/screen_access.h
index 54f2d64fdb..c1d8b5f9b8 100644
--- a/apps/screen_access.h
+++ b/apps/screen_access.h
@@ -60,24 +60,19 @@ struct screen
60#ifdef HAS_BUTTONBAR 60#ifdef HAS_BUTTONBAR
61 bool has_buttonbar; 61 bool has_buttonbar;
62#endif 62#endif
63
64#if defined(HAVE_LCD_BITMAP) || defined(HAVE_REMOTE_LCD) /* always bitmap */
65 void (*setmargins)(int x, int y); 63 void (*setmargins)(int x, int y);
66 int (*getxmargin)(void); 64 int (*getxmargin)(void);
67 int (*getymargin)(void); 65 int (*getymargin)(void);
68 66
69 void (*setfont)(int newfont);
70 int (*getstringsize)(const unsigned char *str, int *w, int *h); 67 int (*getstringsize)(const unsigned char *str, int *w, int *h);
71 void (*putsxy)(int x, int y, const unsigned char *str); 68#if defined(HAVE_LCD_BITMAP) || defined(HAVE_REMOTE_LCD) /* always bitmap */
69 void (*setfont)(int newfont);
72 70
73 void (*scroll_step)(int pixels); 71 void (*scroll_step)(int pixels);
74 void (*puts_offset)(int x, int y, const unsigned char *str, int offset);
75 void (*puts_style_offset)(int x, int y, const unsigned char *str, 72 void (*puts_style_offset)(int x, int y, const unsigned char *str,
76 int style, int offset); 73 int style, int offset);
77 void (*puts_scroll_style)(int x, int y, const unsigned char *string, 74 void (*puts_scroll_style)(int x, int y, const unsigned char *string,
78 int style); 75 int style);
79 void (*puts_scroll_offset)(int x, int y, const unsigned char *string,
80 int offset);
81 void (*puts_scroll_style_offset)(int x, int y, const unsigned char *string, 76 void (*puts_scroll_style_offset)(int x, int y, const unsigned char *string,
82 int style, int offset); 77 int style, int offset);
83 void (*mono_bitmap)(const unsigned char *src, 78 void (*mono_bitmap)(const unsigned char *src,
@@ -114,17 +109,22 @@ struct screen
114 109
115#ifdef HAVE_LCD_CHARCELLS /* no charcell remote LCDs so far */ 110#ifdef HAVE_LCD_CHARCELLS /* no charcell remote LCDs so far */
116 void (*double_height)(bool on); 111 void (*double_height)(bool on);
117 void (*putc)(int x, int y, unsigned short ch); 112 void (*putc)(int x, int y, unsigned long ucs);
118 void (*icon)(int icon, bool enable); 113 void (*icon)(int icon, bool enable);
114 unsigned long (*get_locked_pattern)(void);
115 void (*define_pattern)(unsigned long ucs, const char *pattern);
119#endif 116#endif
120 void (*init)(void); 117 void (*init)(void);
118 void (*putsxy)(int x, int y, const unsigned char *str);
119 void (*puts)(int x, int y, const unsigned char *str);
120 void (*puts_offset)(int x, int y, const unsigned char *str, int offset);
121 void (*puts_scroll)(int x, int y, const unsigned char *string); 121 void (*puts_scroll)(int x, int y, const unsigned char *string);
122 void (*puts_scroll_offset)(int x, int y, const unsigned char *string,
123 int offset);
122 void (*scroll_speed)(int speed); 124 void (*scroll_speed)(int speed);
123 void (*scroll_delay)(int ms); 125 void (*scroll_delay)(int ms);
124 void (*stop_scroll)(void); 126 void (*stop_scroll)(void);
125 void (*clear_display)(void); 127 void (*clear_display)(void);
126 unsigned char (*get_locked_pattern)(void);
127 void (*define_pattern)(int pat, const char *pattern);
128#if defined(HAVE_LCD_BITMAP) || defined(HAVE_REMOTE_LCD) || defined(SIMULATOR) 128#if defined(HAVE_LCD_BITMAP) || defined(HAVE_REMOTE_LCD) || defined(SIMULATOR)
129 void (*update)(void); 129 void (*update)(void);
130#endif 130#endif
@@ -132,7 +132,6 @@ struct screen
132 void (*backlight_off)(void); 132 void (*backlight_off)(void);
133 bool (*is_backlight_on)(void); 133 bool (*is_backlight_on)(void);
134 void (*backlight_set_timeout)(int index); 134 void (*backlight_set_timeout)(int index);
135 void (*puts)(int x, int y, const unsigned char *str);
136}; 135};
137 136
138/* 137/*
diff --git a/apps/screens.c b/apps/screens.c
index df1d59109b..f6def2fd89 100644
--- a/apps/screens.c
+++ b/apps/screens.c
@@ -254,12 +254,12 @@ static void charging_display_info(bool animate)
254} 254}
255#else /* not HAVE_LCD_BITMAP */ 255#else /* not HAVE_LCD_BITMAP */
256 256
257static unsigned char logo_chars[5]; 257static unsigned long logo_chars[4];
258static const unsigned char logo_pattern[] = { 258static const unsigned char logo_pattern[] = {
259 0x07, 0x04, 0x1c, 0x14, 0x1c, 0x04, 0x07, /* char 1 */ 259 0x07, 0x04, 0x1c, 0x14, 0x1c, 0x04, 0x07, 0, /* char 1 */
260 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, /* char 2 */ 260 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0, /* char 2 */
261 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, /* char 3 */ 261 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0, /* char 3 */
262 0x1f, 0x01, 0x01, 0x01, 0x01, 0x01, 0x1f, /* char 4 */ 262 0x1f, 0x01, 0x01, 0x01, 0x01, 0x01, 0x1f, 0, /* char 4 */
263}; 263};
264 264
265static void logo_lock_patterns(bool on) 265static void logo_lock_patterns(bool on)
@@ -270,7 +270,6 @@ static void logo_lock_patterns(bool on)
270 { 270 {
271 for (i = 0; i < 4; i++) 271 for (i = 0; i < 4; i++)
272 logo_chars[i] = lcd_get_locked_pattern(); 272 logo_chars[i] = lcd_get_locked_pattern();
273 logo_chars[4] = '\0';
274 } 273 }
275 else 274 else
276 { 275 {
@@ -284,19 +283,20 @@ static void charging_display_info(bool animate)
284 int battv; 283 int battv;
285 unsigned i, ypos; 284 unsigned i, ypos;
286 static unsigned phase = 3; 285 static unsigned phase = 3;
287 char buf[28]; 286 char buf[32];
288 287
289 battv = battery_voltage(); 288 battv = battery_voltage();
290 snprintf(buf, sizeof(buf), "%s %d.%02dV", logo_chars, 289 snprintf(buf, sizeof(buf), " %d.%02dV", battv / 100, battv % 100);
291 battv / 100, battv % 100); 290 lcd_puts(4, 1, buf);
292 lcd_puts(0, 1, buf);
293 291
294 memcpy(buf, logo_pattern, 28); /* copy logo patterns */ 292 memcpy(buf, logo_pattern, 32); /* copy logo patterns */
295 293
296 if (!animate) /* build the screen */ 294 if (!animate) /* build the screen */
297 { 295 {
298 lcd_double_height(false); 296 lcd_double_height(false);
299 lcd_puts(0, 0, "[Charging]"); 297 lcd_puts(0, 0, "[Charging]");
298 for (i = 0; i < 4; i++)
299 lcd_putc(i, 1, logo_chars[i]);
300 } 300 }
301 else /* animate the logo */ 301 else /* animate the logo */
302 { 302 {
@@ -307,14 +307,14 @@ static void charging_display_info(bool animate)
307 ypos = (phase + i/5) % 9; /* "bounce" effect */ 307 ypos = (phase + i/5) % 9; /* "bounce" effect */
308 if (ypos > 4) 308 if (ypos > 4)
309 ypos = 8 - ypos; 309 ypos = 8 - ypos;
310 buf[5 - ypos + 7 * (i/5)] |= 0x10 >> (i%5); 310 buf[5 - ypos + 8 * (i/5)] |= 0x10 >> (i%5);
311 } 311 }
312 } 312 }
313 phase++; 313 phase++;
314 } 314 }
315 315
316 for (i = 0; i < 4; i++) 316 for (i = 0; i < 4; i++)
317 lcd_define_pattern(logo_chars[i], buf + 7 * i); 317 lcd_define_pattern(logo_chars[i], buf + 8 * i);
318} 318}
319#endif /* (not) HAVE_LCD_BITMAP */ 319#endif /* (not) HAVE_LCD_BITMAP */
320 320