forked from len0rd/rockbox
lcd_puts() now clears to end-of-line
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@2252 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
dad31ea86b
commit
3b97474978
2 changed files with 23 additions and 16 deletions
|
|
@ -81,9 +81,9 @@ struct menu {
|
||||||
#endif /* HAVE_LCD_BITMAP */
|
#endif /* HAVE_LCD_BITMAP */
|
||||||
|
|
||||||
#ifdef HAVE_NEW_CHARCELL_LCD
|
#ifdef HAVE_NEW_CHARCELL_LCD
|
||||||
#define CURSOR_CHAR "\x7e"
|
#define CURSOR_CHAR 0x7e
|
||||||
#else
|
#else
|
||||||
#define CURSOR_CHAR "\x89"
|
#define CURSOR_CHAR 0x89
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static struct menu menus[MAX_MENUS];
|
static struct menu menus[MAX_MENUS];
|
||||||
|
|
@ -112,7 +112,7 @@ void put_cursorxy(int x, int y, bool on)
|
||||||
unsigned char cursor[] = { 0x7f, 0x3e, 0x1c, 0x08 };
|
unsigned char cursor[] = { 0x7f, 0x3e, 0x1c, 0x08 };
|
||||||
lcd_bitmap ( cursor, x*6, 12+y*16, 4, 8, true);
|
lcd_bitmap ( cursor, x*6, 12+y*16, 4, 8, true);
|
||||||
#else
|
#else
|
||||||
lcd_puts(x, y, CURSOR_CHAR);
|
lcd_putc(x, y, CURSOR_CHAR);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
@ -123,7 +123,7 @@ void put_cursorxy(int x, int y, bool on)
|
||||||
/* player simulator in action */
|
/* player simulator in action */
|
||||||
lcd_clearrect (x*6, 12+y*16, 4, 8);
|
lcd_clearrect (x*6, 12+y*16, 4, 8);
|
||||||
#else
|
#else
|
||||||
lcd_puts(x, y, " ");
|
lcd_putc(x, y, ' ');
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -415,9 +415,12 @@ void lcd_clear_display(void)
|
||||||
|
|
||||||
void lcd_puts(int x, int y, unsigned char *string)
|
void lcd_puts(int x, int y, unsigned char *string)
|
||||||
{
|
{
|
||||||
|
int i;
|
||||||
lcd_write(true,LCD_CURSOR(x,y));
|
lcd_write(true,LCD_CURSOR(x,y));
|
||||||
while (*string && x++<11)
|
for (i=0; *string && x++<11; i++)
|
||||||
lcd_write(false,lcd_ascii[*(unsigned char*)string++]);
|
lcd_write(false,lcd_ascii[*(unsigned char*)string++]);
|
||||||
|
for (; x<11; x++)
|
||||||
|
lcd_write(false,lcd_ascii[' ']);
|
||||||
}
|
}
|
||||||
|
|
||||||
void lcd_putc(int x, int y, unsigned char ch)
|
void lcd_putc(int x, int y, unsigned char ch)
|
||||||
|
|
@ -861,6 +864,7 @@ void lcd_putspropxy(int x, int y, unsigned char *str, int thisfont)
|
||||||
*/
|
*/
|
||||||
void lcd_puts(int x, int y, unsigned char *str)
|
void lcd_puts(int x, int y, unsigned char *str)
|
||||||
{
|
{
|
||||||
|
int xpos,ypos,w,h;
|
||||||
#if defined(SIMULATOR) && defined(HAVE_LCD_CHARCELLS)
|
#if defined(SIMULATOR) && defined(HAVE_LCD_CHARCELLS)
|
||||||
/* We make the simulator truncate the string if it reaches the right edge,
|
/* We make the simulator truncate the string if it reaches the right edge,
|
||||||
as otherwise it'll wrap. The real target doesn't wrap. */
|
as otherwise it'll wrap. The real target doesn't wrap. */
|
||||||
|
|
@ -879,20 +883,23 @@ void lcd_puts(int x, int y, unsigned char *str)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
#ifdef LCD_PROPFONTS
|
#ifdef LCD_PROPFONTS
|
||||||
lcd_putspropxy( xmargin + x*fonts[font],
|
lcd_getstringsize(str, font, &w, &h);
|
||||||
ymargin + y*fontheight[font],
|
xpos = xmargin + x * fonts[font];
|
||||||
str, font );
|
ypos = ymargin + y * fontheight[font];
|
||||||
|
lcd_putspropxy(xpos, ypos, str, font);
|
||||||
#elif LOADABLE_FONTS
|
#elif LOADABLE_FONTS
|
||||||
{
|
lcd_getstringsize(str,_font,&w,&h);
|
||||||
int w,h;
|
xpos = xmargin + x * w / strlen(str);
|
||||||
lcd_getstringsize(str,_font,&w,&h);
|
ypos = ymargin + y * h;
|
||||||
lcd_putsldfxy( xmargin + x*w/strlen(str), ymargin + y*h, str );
|
lcd_putsldfxy(xpos, ypos, str);
|
||||||
}
|
|
||||||
#else
|
#else
|
||||||
lcd_putsxy( xmargin + x*fonts[font],
|
xpos = xmargin + x * fonts[font];
|
||||||
ymargin + y*fontheight[font],
|
ypos = ymargin + y * fontheight[font];
|
||||||
str, font );
|
lcd_putsxy(xpos, ypos, str, font);
|
||||||
|
w = strlen(str) * fonts[font];
|
||||||
|
h = fontheight[font];
|
||||||
#endif
|
#endif
|
||||||
|
lcd_clearrect(xpos + w, ypos, LCD_WIDTH - (xpos + w), h);
|
||||||
#if defined(SIMULATOR) && defined(HAVE_LCD_CHARCELLS)
|
#if defined(SIMULATOR) && defined(HAVE_LCD_CHARCELLS)
|
||||||
/* this function is being used when simulating a charcell LCD and
|
/* this function is being used when simulating a charcell LCD and
|
||||||
then we update immediately */
|
then we update immediately */
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue