Index: apps/bookmark.c =================================================================== RCS file: /cvsroot/rockbox/apps/bookmark.c,v retrieving revision 1.47 diff -u -r1.47 bookmark.c --- apps/bookmark.c 21 Jan 2006 23:43:56 -0000 1.47 +++ apps/bookmark.c 6 Feb 2006 18:13:58 -0000 @@ -430,7 +430,7 @@ lcd_clear_display(); gui_syncstatusbar_draw(&statusbars, false); #ifdef HAVE_LCD_BITMAP - lcd_setmargins(0, STATUSBAR_HEIGHT); + lcd_setmargins(0, LCD_WIDTH, STATUSBAR_HEIGHT); lcd_puts_scroll(0,0, str(LANG_BOOKMARK_AUTOLOAD_QUERY)); lcd_puts(0,1, str(LANG_CONFIRM_WITH_PLAY_RECORDER)); lcd_puts(0,2, str(LANG_BOOKMARK_SELECT_LIST_BOOKMARKS)); @@ -556,9 +556,9 @@ int bookmark_count = 0; #ifdef HAVE_LCD_BITMAP - int x = lcd_getxmargin(); + int x = lcd_getleftmargin(); int y = lcd_getymargin(); - lcd_setmargins(0, 0); + lcd_setmargins(0, LCD_WIDTH, 0); #endif bookmark_count = get_bookmark_count(bookmark_file_name); @@ -610,9 +610,9 @@ /* User wants to use this bookmark */ #ifdef HAVE_LCD_BITMAP if (global_settings.statusbar) - lcd_setmargins(0, STATUSBAR_HEIGHT); + lcd_setmargins(0, LCD_WIDTH, STATUSBAR_HEIGHT); else - lcd_setmargins(0, 0); + lcd_setmargins(0, LCD_WIDTH, 0); #endif return bookmark; @@ -643,7 +643,7 @@ case SETTINGS_OK2: #endif #ifdef HAVE_LCD_BITMAP - lcd_setmargins(x, y); + lcd_setmargins(x, LCD_WIDTH, y); #endif return NULL; Index: apps/debug_menu.c =================================================================== RCS file: /cvsroot/rockbox/apps/debug_menu.c,v retrieving revision 1.163 diff -u -r1.163 debug_menu.c --- apps/debug_menu.c 31 Jan 2006 01:50:10 -0000 1.163 +++ apps/debug_menu.c 6 Feb 2006 18:14:07 -0000 @@ -82,7 +82,7 @@ int i; int usage; - lcd_setmargins(0, 0); + lcd_setmargins(0, LCD_WIDTH, 0); lcd_setfont(FONT_SYSFIXED); lcd_clear_display(); @@ -158,7 +158,7 @@ int button; struct audio_debug d; - lcd_setmargins(0, 0); + lcd_setmargins(0, LCD_WIDTH, 0); lcd_setfont(FONT_SYSFIXED); while(1) @@ -231,7 +231,7 @@ tick_add_task(dbg_audio_task); - lcd_setmargins(0, 0); + lcd_setmargins(0, LCD_WIDTH, 0); lcd_setfont(FONT_SYSFIXED); while(!done) @@ -464,7 +464,7 @@ system_memory_guard(oldmode); /* re-enable memory guard */ - lcd_setmargins(0, 0); + lcd_setmargins(0, LCD_WIDTH, 0); lcd_setfont(FONT_SYSFIXED); lcd_clear_display(); @@ -529,7 +529,7 @@ system_memory_guard(oldmode); /* re-enable memory guard */ - lcd_setmargins(0, 0); + lcd_setmargins(0, LCD_WIDTH, 0); lcd_setfont(FONT_SYSFIXED); lcd_clear_display(); @@ -717,7 +717,7 @@ unsigned int interruptstat; bool valnogood, symbolerr, parityerr; - lcd_setmargins(0, 0); + lcd_setmargins(0, LCD_WIDTH, 0); lcd_clear_display(); lcd_setfont(FONT_SYSFIXED); @@ -878,7 +878,7 @@ int batt_int, batt_frac; lcd_setfont(FONT_SYSFIXED); - lcd_setmargins(0, 0); + lcd_setmargins(0, LCD_WIDTH, 0); lcd_clear_display(); while(1) @@ -938,7 +938,7 @@ int battery_voltage; int batt_int, batt_frac; - lcd_setmargins(0, 0); + lcd_setmargins(0, LCD_WIDTH, 0); lcd_clear_display(); lcd_setfont(FONT_SYSFIXED); @@ -1145,7 +1145,7 @@ int button; #ifdef HAVE_LCD_BITMAP - lcd_setmargins(0, 0); + lcd_setmargins(0, LCD_WIDTH, 0); lcd_setfont(FONT_SYSFIXED); #endif lcd_clear_display(); @@ -1210,7 +1210,7 @@ unsigned short maxv, minv; char buf[32]; - lcd_setmargins(0, 0); + lcd_setmargins(0, LCD_WIDTH, 0); lcd_setfont(FONT_SYSFIXED); while(1) @@ -1454,7 +1454,7 @@ card_name[6] = '\0'; - lcd_setmargins(0, 0); + lcd_setmargins(0, LCD_WIDTH, 0); lcd_setfont(FONT_SYSFIXED); while (!done) @@ -1558,7 +1558,7 @@ char pio3[2], pio4[2]; #ifdef HAVE_LCD_BITMAP - lcd_setmargins(0, 0); + lcd_setmargins(0, LCD_WIDTH, 0); #endif while(!done) @@ -1724,7 +1724,7 @@ int line; char buf[32]; - lcd_setmargins(0, 0); + lcd_setmargins(0, LCD_WIDTH, 0); lcd_setfont(FONT_SYSFIXED); while (!done) @@ -1823,7 +1823,7 @@ bool fm_detected; #ifdef HAVE_LCD_BITMAP - lcd_setmargins(0, 0); + lcd_setmargins(0, LCD_WIDTH, 0); #endif while(1) Index: apps/onplay.c =================================================================== RCS file: /cvsroot/rockbox/apps/onplay.c,v retrieving revision 1.69 diff -u -r1.69 onplay.c --- apps/onplay.c 2 Feb 2006 21:46:23 -0000 1.69 +++ apps/onplay.c 6 Feb 2006 18:14:09 -0000 @@ -655,9 +655,9 @@ #ifdef HAVE_LCD_BITMAP if (global_settings.statusbar) - lcd_setmargins(0, STATUSBAR_HEIGHT); + lcd_setmargins(0, LCD_WIDTH, STATUSBAR_HEIGHT); else - lcd_setmargins(0, 0); + lcd_setmargins(0, LCD_WIDTH, 0); #endif } Index: apps/playlist.c =================================================================== RCS file: /cvsroot/rockbox/apps/playlist.c,v retrieving revision 1.141 diff -u -r1.141 playlist.c --- apps/playlist.c 21 Jan 2006 23:43:56 -0000 1.141 +++ apps/playlist.c 6 Feb 2006 18:14:16 -0000 @@ -362,9 +362,9 @@ #ifdef HAVE_LCD_BITMAP if(global_settings.statusbar) - lcd_setmargins(0, STATUSBAR_HEIGHT); + lcd_setmargins(0, LCD_WIDTH, STATUSBAR_HEIGHT); else - lcd_setmargins(0, 0); + lcd_setmargins(0, LCD_WIDTH, 0); #endif gui_syncsplash(0, true, str(LANG_PLAYLIST_LOAD)); @@ -1518,9 +1518,9 @@ #ifdef HAVE_LCD_BITMAP if(global_settings.statusbar) - lcd_setmargins(0, STATUSBAR_HEIGHT); + lcd_setmargins(0, LCD_WIDTH, STATUSBAR_HEIGHT); else - lcd_setmargins(0, 0); + lcd_setmargins(0, LCD_WIDTH, 0); #endif gui_syncsplash(0, true, fmt, count, Index: apps/plugin.c =================================================================== RCS file: /cvsroot/rockbox/apps/plugin.c,v retrieving revision 1.143 diff -u -r1.143 plugin.c --- apps/plugin.c 2 Feb 2006 20:42:55 -0000 1.143 +++ apps/plugin.c 6 Feb 2006 18:14:19 -0000 @@ -413,9 +413,9 @@ #endif lcd_clear_display(); #ifdef HAVE_LCD_BITMAP - xm = lcd_getxmargin(); + xm = lcd_getleftmargin(); ym = lcd_getymargin(); - lcd_setmargins(0,0); + lcd_setmargins(0, LCD_WIDTH, 0); lcd_update(); #endif #ifdef SIMULATOR @@ -486,7 +486,7 @@ lcd_set_drawmode(DRMODE_SOLID); #endif /* LCD_DEPTH */ /* restore margins */ - lcd_setmargins(xm,ym); + lcd_setmargins(xm, LCD_WIDTH,ym); #endif /* HAVE_LCD_BITMAP */ #ifdef HAVE_LCD_COLOR lcd_set_backdrop(old_backdrop); Index: apps/screen_access.c =================================================================== RCS file: /cvsroot/rockbox/apps/screen_access.c,v retrieving revision 1.21 diff -u -r1.21 screen_access.c --- apps/screen_access.c 2 Feb 2006 22:00:55 -0000 1.21 +++ apps/screen_access.c 6 Feb 2006 18:14:19 -0000 @@ -46,7 +46,8 @@ screen->height=LCD_REMOTE_HEIGHT; screen->setmargins=&lcd_remote_setmargins; screen->getymargin=&lcd_remote_getymargin; - screen->getxmargin=&lcd_remote_getxmargin; + screen->getleftmargin=&lcd_remote_getleftmargin; + screen->getrightmargin=&lcd_remote_getrightmargin; screen->setfont=&lcd_remote_setfont; screen->setfont(FONT_UI); screen->getstringsize=&lcd_remote_getstringsize; @@ -115,7 +116,8 @@ screen->height=LCD_HEIGHT; screen->setmargins=&lcd_setmargins; screen->getymargin=&lcd_getymargin; - screen->getxmargin=&lcd_getxmargin; + screen->getleftmargin=&lcd_getleftmargin; + screen->getrightmargin=&lcd_getrightmargin; screen->setfont=&lcd_setfont; screen->setfont(FONT_UI); screen->getstringsize=&lcd_getstringsize; Index: apps/screen_access.h =================================================================== RCS file: /cvsroot/rockbox/apps/screen_access.h,v retrieving revision 1.23 diff -u -r1.23 screen_access.h --- apps/screen_access.h 2 Feb 2006 22:00:55 -0000 1.23 +++ apps/screen_access.h 6 Feb 2006 18:14:19 -0000 @@ -62,8 +62,9 @@ #endif #if defined(HAVE_LCD_BITMAP) || defined(HAVE_REMOTE_LCD) /* always bitmap */ - void (*setmargins)(int x, int y); - int (*getxmargin)(void); + void (*setmargins)(int x1, int x2, int y); + int (*getleftmargin)(void); + int (*getrightmargin)(void); int (*getymargin)(void); void (*setfont)(int newfont); @@ -144,10 +145,10 @@ /* * Sets the x margin in pixels for the given screen * - screen : the screen structure - * - xmargin : the number of pixels to the left of the screen + * - leftmargin : the number of pixels to the left of the screen */ #define screen_set_xmargin(screen, xmargin) \ - (screen)->setmargins(xmargin, (screen)->getymargin()); + (screen)->setmargins(xmargin, LCD_WIDTH, (screen)->getymargin()); /* * Sets the y margin in pixels for the given screen @@ -155,7 +156,7 @@ * - xmargin : the number of pixels to the top of the screen */ #define screen_set_ymargin(screen, ymargin) \ - (screen)->setmargins((screen)->getxmargin(), ymargin); + (screen)->setmargins((screen)->getleftmargin(), LCD_WIDTH, ymargin); #if defined(HAVE_LCD_BITMAP) || defined(HAVE_REMOTE_LCD) /* Index: apps/screens.c =================================================================== RCS file: /cvsroot/rockbox/apps/screens.c,v retrieving revision 1.138 diff -u -r1.138 screens.c --- apps/screens.c 21 Jan 2006 23:43:56 -0000 1.138 +++ apps/screens.c 6 Feb 2006 18:14:25 -0000 @@ -716,9 +716,9 @@ #ifdef HAVE_LCD_BITMAP if(global_settings.statusbar) - lcd_setmargins(0, STATUSBAR_HEIGHT); + lcd_setmargins(0, LCD_WIDTH, STATUSBAR_HEIGHT); else - lcd_setmargins(0, 0); + lcd_setmargins(0, LCD_WIDTH, 0); #endif lcd_clear_display(); lcd_puts_scroll(0, 0, string); @@ -1017,7 +1017,7 @@ } #if defined(HAVE_LCD_BITMAP) - lcd_setmargins(show_scrollbar ? SCROLLBAR_WIDTH : 0, y_margin); + lcd_setmargins(show_scrollbar ? SCROLLBAR_WIDTH : 0, LCD_WIDTH, y_margin); #endif while (!exit) Index: apps/sleeptimer.c =================================================================== RCS file: /cvsroot/rockbox/apps/sleeptimer.c,v retrieving revision 1.15 diff -u -r1.15 sleeptimer.c --- apps/sleeptimer.c 5 Dec 2005 22:44:41 -0000 1.15 +++ apps/sleeptimer.c 6 Feb 2006 18:14:31 -0000 @@ -55,9 +55,9 @@ #ifdef HAVE_LCD_BITMAP if (global_settings.statusbar) - lcd_setmargins(0, STATUSBAR_HEIGHT); + lcd_setmargins(0, LCD_WIDTH, STATUSBAR_HEIGHT); else - lcd_setmargins(0, 0); + lcd_setmargins(0, LCD_WIDTH, 0); #endif lcd_clear_display(); Index: apps/gui/gwps-common.c =================================================================== RCS file: /cvsroot/rockbox/apps/gui/gwps-common.c,v retrieving revision 1.38 diff -u -r1.38 gwps-common.c --- apps/gui/gwps-common.c 2 Feb 2006 21:39:09 -0000 1.38 +++ apps/gui/gwps-common.c 6 Feb 2006 18:14:41 -0000 @@ -1052,6 +1052,27 @@ case 0: *buf++ = '%'; break; + case 'm': + { + int x1=0,x2=LCD_WIDTH; + if (fmt[1]=='|') { + char *p=strchr(fmt, '|'); + if (p) { + x1=atoi(++p); + p=strchr(p, '|'); + if (p) { + x2=atoi(++p); + p=strchr(p, '|'); + } + fmt += (x1 < 10 ? 1 : (x1 < 100 ? 2 : 3)) + + (x2 < 10 ? 1 : (x2 < 100 ? 2 : 3)) + 4; + } + } + else + fmt++; + gwps->display->setmargins(x1,x2,gwps->display->getymargin()); + } + break; case 'a': ++fmt; /* remember where the current aligned text started */ @@ -1144,7 +1165,7 @@ level++; break; - default: + default: value = get_tag(gwps->data, id3, nid3, fmt, temp_buf, sizeof(temp_buf), &tag_length, subline_time_mult, flags,&intval); @@ -1581,7 +1602,7 @@ else { left_width = 0; } - left_xpos = 0; + left_xpos = display->getleftmargin(); if (data->format_align[i][data->curr_subline[i]].center != 0) { display->getstringsize((unsigned char *)data->format_align[i] @@ -1591,7 +1612,7 @@ else { center_width = 0; } - center_xpos=(display->width - center_width) / 2; + center_xpos=(display->getrightmargin()-display->getleftmargin() - center_width) / 2 + display->getleftmargin(); if (data->format_align[i][data->curr_subline[i]].right != 0) { display->getstringsize((unsigned char *)data->format_align[i] @@ -1601,7 +1622,7 @@ else { right_width = 0; } - right_xpos = (display->width - right_width); + right_xpos = (display->getrightmargin() - right_width); /* Checks for overlapping strings. If needed the overlapping strings will be merged, separated by a @@ -1645,7 +1666,7 @@ data->format_align[i][data->curr_subline[i]].center; /* calculate the new width and position of the merged string */ right_width = center_width + space_width + right_width; - right_xpos = (display->width - right_width); + right_xpos = (display->getrightmargin() - right_width); /* there is no centered string anymore */ center_width = 0; } @@ -1657,7 +1678,7 @@ data->format_align[i][data->curr_subline[i]].center; /* calculate the new width and position of the string */ right_width = center_width; - right_xpos = (display->width - right_width); + right_xpos = (display->getrightmargin() - right_width); /* there is no centered string anymore */ center_width = 0; } @@ -1701,7 +1722,10 @@ ypos = (i*string_height)+display->getymargin(); update_line = true; - if (left_width>display->width) { + if ((left_width > display->width) || + (display->getrightmargin()-display->getleftmargin() < left_width) || + (display->getrightmargin()-display->getleftmargin() < center_width) || + (display->getrightmargin()-display->getleftmargin() < right_width)) { display->puts_scroll(0, i, (unsigned char *)data->format_align[i] [data->curr_subline[i]].left); @@ -1734,6 +1758,7 @@ (unsigned char *)data->format_align[i] [data->curr_subline[i]].right); } + } #else display->puts_scroll(0, i, buf); @@ -1779,6 +1804,8 @@ (unsigned char *)data->format_align[i] [data->curr_subline[i]].right); } + + #else update_line = true; display->puts(0, i, buf); Index: apps/gui/gwps.c =================================================================== RCS file: /cvsroot/rockbox/apps/gui/gwps.c,v retrieving revision 1.24 diff -u -r1.24 gwps.c --- apps/gui/gwps.c 2 Feb 2006 21:46:23 -0000 1.24 +++ apps/gui/gwps.c 6 Feb 2006 18:14:44 -0000 @@ -79,11 +79,10 @@ { int offset = 0; struct wps_data *data = gwps->data; - if(data->wps_sb_tag && data->show_sb_on_wps) + if((data->wps_sb_tag && data->show_sb_on_wps) || + (global_settings.statusbar && !data->wps_sb_tag)) offset = STATUSBAR_HEIGHT; - else if ( global_settings.statusbar && !data->wps_sb_tag) - offset = STATUSBAR_HEIGHT; - gwps->display->setmargins(0, offset); + gwps->display->setmargins(0, LCD_WIDTH, offset); } #endif Index: apps/gui/list.c =================================================================== RCS file: /cvsroot/rockbox/apps/gui/list.c,v retrieving revision 1.14 diff -u -r1.14 list.c --- apps/gui/list.c 22 Jan 2006 04:24:25 -0000 1.14 +++ apps/gui/list.c 6 Feb 2006 18:14:45 -0000 @@ -84,7 +84,7 @@ int line_ypos=display->getymargin()+display->char_height*selected_line; if (global_settings.invert_cursor) { - int line_xpos=display->getxmargin(); + int line_xpos=display->getleftmargin(); display->set_drawmode(DRMODE_COMPLEMENT); display->fillrect(line_xpos, line_ypos, display->width, display->char_height); Index: apps/recorder/recording.c =================================================================== RCS file: /cvsroot/rockbox/apps/recorder/recording.c,v retrieving revision 1.100 diff -u -r1.100 recording.c --- apps/recorder/recording.c 18 Dec 2005 10:02:41 -0000 1.100 +++ apps/recorder/recording.c 6 Feb 2006 18:14:59 -0000 @@ -356,7 +356,7 @@ lcd_setfont(FONT_SYSFIXED); lcd_getstringsize("M", &w, &h); - lcd_setmargins(global_settings.invert_cursor ? 0 : w, 8); + lcd_setmargins(global_settings.invert_cursor ? 0 : w, LCD_WIDTH, 8); if(rec_create_directory() > 0) have_recorded = true; @@ -632,7 +632,7 @@ update_countdown = 1; /* Update immediately */ lcd_setfont(FONT_SYSFIXED); - lcd_setmargins(global_settings.invert_cursor ? 0 : w, 8); + lcd_setmargins(global_settings.invert_cursor ? 0 : w, LCD_WIDTH, 8); } break; #endif Index: firmware/drivers/lcd-16bit.c =================================================================== RCS file: /cvsroot/rockbox/firmware/drivers/lcd-16bit.c,v retrieving revision 1.26 diff -u -r1.26 lcd-16bit.c --- firmware/drivers/lcd-16bit.c 3 Feb 2006 21:11:51 -0000 1.26 +++ firmware/drivers/lcd-16bit.c 6 Feb 2006 18:15:02 -0000 @@ -44,7 +44,8 @@ static unsigned fg_pattern IDATA_ATTR = LCD_DEFAULT_FG; static unsigned bg_pattern IDATA_ATTR = LCD_DEFAULT_BG; static int drawmode = DRMODE_SOLID; -static int xmargin = 0; +static int leftmargin = 0; +static int rightmargin = LCD_WIDTH; static int ymargin = 0; static int curfont = FONT_SYSFIXED; @@ -120,15 +121,21 @@ bg_pattern = bg_color; } -void lcd_setmargins(int x, int y) +void lcd_setmargins(int x1, int x2, int y) { - xmargin = x; + leftmargin = x1; + rightmargin = x2; ymargin = y; } -int lcd_getxmargin(void) +int lcd_getleftmargin(void) { - return xmargin; + return leftmargin; +} + +int lcd_getrightmargin(void) +{ + return rightmargin; } int lcd_getymargin(void) @@ -649,7 +656,7 @@ ucs = bidi_l2v(str, 1); - while ((ch = *ucs++) != 0 && x < LCD_WIDTH) + while ((ch = *ucs++) != 0 && x < rightmargin) { int width; const unsigned char *bits; @@ -670,7 +677,10 @@ bits = font_get_bits(pf, ch); - lcd_mono_bitmap_part(bits, ofs, 0, width, x, y, width - ofs, pf->height); + if (width+x< rightmargin) + lcd_mono_bitmap_part(bits, ofs, 0, width, x, y, width - ofs, pf->height); + else + lcd_mono_bitmap_part(bits, ofs, 0, width, x, y, width - ofs-((width+x)-rightmargin), pf->height); x += width - ofs; ofs = 0; @@ -715,13 +725,13 @@ return; lcd_getstringsize(str, &w, &h); - xpos = xmargin + x*w / utf8length(str); + xpos = leftmargin + x*w / utf8length(str); ypos = ymargin + y*h; drawmode = (style & STYLE_INVERT) ? (DRMODE_SOLID|DRMODE_INVERSEVID) : DRMODE_SOLID; lcd_putsxyofs(xpos, ypos, offset, str); drawmode ^= DRMODE_INVERSEVID; - lcd_fillrect(xpos + w, ypos, LCD_WIDTH - (xpos + w), h); + lcd_fillrect(xpos + w, ypos, rightmargin - (xpos + w), h); drawmode = lastmode; } @@ -778,7 +788,7 @@ { lcd_puts_scroll_style_offset(x, y, string, STYLE_DEFAULT, offset); } - + void lcd_puts_scroll_style_offset(int x, int y, const unsigned char *string, int style, int offset) { @@ -798,7 +808,7 @@ lcd_getstringsize(string, &w, &h); - if (LCD_WIDTH - x * 8 - xmargin < w) { + if (rightmargin - x * 8 - leftmargin < w) { /* prepare scroll line */ char *end; @@ -811,7 +821,7 @@ /* scroll bidirectional or forward only depending on the string width */ if ( bidir_limit ) { - s->bidir = s->width < (LCD_WIDTH - xmargin) * + s->bidir = s->width < (rightmargin - leftmargin) * (100 + bidir_limit) / 100; } else @@ -824,12 +834,14 @@ } end = strchr(s->line, '\0'); - strncpy(end, string, LCD_WIDTH/2); + strncpy(end, string, (rightmargin-leftmargin)/2); s->len = utf8length(string); s->offset = offset; s->startx = x; s->backward = false; + s->left_margin=leftmargin; + s->right_margin=rightmargin; scrolling_lines |= (1<offset += scroll_step; pf = font_get(curfont); - xpos = xmargin + s->startx * s->width / s->len; + xpos = s->left_margin + s->startx * s->width / s->len; ypos = ymargin + index * pf->height; if (s->bidir) { /* scroll bidirectional */ @@ -876,9 +888,9 @@ s->backward = false; s->start_tick = current_tick + scroll_delay * 2; } - if (s->offset >= s->width - (LCD_WIDTH - xpos)) { + if (s->offset >= s->width - (s->right_margin - xpos)) { /* at end of line */ - s->offset = s->width - (LCD_WIDTH - xpos); + s->offset = s->width - (s->right_margin - xpos); s->backward = true; s->start_tick = current_tick + scroll_delay * 2; } @@ -892,9 +904,10 @@ lastmode = drawmode; drawmode = s->invert ? (DRMODE_SOLID|DRMODE_INVERSEVID) : DRMODE_SOLID; + lcd_setmargins(s->left_margin, s->right_margin, ymargin); lcd_putsxyofs(xpos, ypos, s->offset, s->line); drawmode = lastmode; - lcd_update_rect(xpos, ypos, LCD_WIDTH - xpos, pf->height); + lcd_update_rect(xpos, ypos, s->right_margin - xpos, pf->height); } sleep(scroll_ticks); Index: firmware/drivers/lcd-h100-remote.c =================================================================== RCS file: /cvsroot/rockbox/firmware/drivers/lcd-h100-remote.c,v retrieving revision 1.42 diff -u -r1.42 lcd-h100-remote.c --- firmware/drivers/lcd-h100-remote.c 2 Feb 2006 19:53:50 -0000 1.42 +++ firmware/drivers/lcd-h100-remote.c 6 Feb 2006 18:15:04 -0000 @@ -80,7 +80,8 @@ IBSS_ATTR; static int drawmode = DRMODE_SOLID; -static int xmargin = 0; +static int leftmargin = 0; +static int rightmargin = LCD_REMOTE_WIDTH; static int ymargin = 0; static int curfont = FONT_SYSFIXED; #ifndef SIMULATOR @@ -586,15 +587,21 @@ return drawmode; } -void lcd_remote_setmargins(int x, int y) +void lcd_remote_setmargins(int x1, int x2, int y) { - xmargin = x; + leftmargin = x1; + rightmargin = x2; ymargin = y; } -int lcd_remote_getxmargin(void) +int lcd_remote_getleftmargin(void) { - return xmargin; + return leftmargin; +} + +int lcd_remote_getrightmargin(void) +{ + return rightmargin; } int lcd_remote_getymargin(void) @@ -1119,8 +1126,10 @@ bits = font_get_bits(pf, ch); - lcd_remote_bitmap_part(bits, ofs, 0, width, x, y, width - ofs, - pf->height); + if (width+x< rightmargin) + lcd_remote_bitmap_part(bits, ofs, 0, width, x, y, width - ofs, pf->height); + else + lcd_remote_bitmap_part(bits, ofs, 0, width, x, y, width - ofs-((width+x)-rightmargin), pf->height); x += width - ofs; ofs = 0; @@ -1165,13 +1174,13 @@ return; lcd_remote_getstringsize(str, &w, &h); - xpos = xmargin + x*w / utf8length((char *)str); + xpos = leftmargin + x*w / utf8length((char *)str); ypos = ymargin + y*h; drawmode = (style & STYLE_INVERT) ? (DRMODE_SOLID|DRMODE_INVERSEVID) : DRMODE_SOLID; lcd_remote_putsxyofs(xpos, ypos, offset, str); drawmode ^= DRMODE_INVERSEVID; - lcd_remote_fillrect(xpos + w, ypos, LCD_REMOTE_WIDTH - (xpos + w), h); + lcd_remote_fillrect(xpos + w, ypos, rightmargin - (xpos + w), h); drawmode = lastmode; } @@ -1248,7 +1257,7 @@ lcd_remote_getstringsize(string, &w, &h); - if (LCD_REMOTE_WIDTH - x * 8 - xmargin < w) { + if (LCD_REMOTE_WIDTH - x * 8 - leftmargin < w) { /* prepare scroll line */ char *end; @@ -1261,7 +1270,7 @@ /* scroll bidirectional or forward only depending on the string width */ if ( bidir_limit ) { - s->bidir = s->width < (LCD_REMOTE_WIDTH - xmargin) * + s->bidir = s->width < (LCD_REMOTE_WIDTH - leftmargin) * (100 + bidir_limit) / 100; } else @@ -1325,7 +1334,7 @@ s->offset += scroll_step; pf = font_get(curfont); - xpos = xmargin + s->startx * s->width / s->len; + xpos = leftmargin + s->startx * s->width / s->len; ypos = ymargin + index * pf->height; if (s->bidir) { /* scroll bidirectional */ @@ -1351,6 +1360,7 @@ lastmode = drawmode; drawmode = s->invert ? (DRMODE_SOLID|DRMODE_INVERSEVID) : DRMODE_SOLID; + lcd_setmargins(s->left_margin, s->right_margin, ymargin); lcd_remote_putsxyofs(xpos, ypos, s->offset, s->line); drawmode = lastmode; lcd_remote_update_rect(xpos, ypos, LCD_REMOTE_WIDTH - xpos, pf->height); Index: firmware/drivers/lcd-h100.c =================================================================== RCS file: /cvsroot/rockbox/firmware/drivers/lcd-h100.c,v retrieving revision 1.41 diff -u -r1.41 lcd-h100.c --- firmware/drivers/lcd-h100.c 2 Feb 2006 19:35:51 -0000 1.41 +++ firmware/drivers/lcd-h100.c 6 Feb 2006 18:15:07 -0000 @@ -72,7 +72,8 @@ static unsigned fg_pattern IDATA_ATTR = 0xFF; /* initially black */ static unsigned bg_pattern IDATA_ATTR = 0x00; /* initially white */ static int drawmode = DRMODE_SOLID; -static int xmargin = 0; +static int leftmargin = 0; +static int rightmargin = 0; static int ymargin = 0; static int curfont = FONT_SYSFIXED; @@ -335,17 +336,25 @@ lcd_set_background(bg_brightness); } -void lcd_setmargins(int x, int y) +void lcd_setmargins(int x1, int x2, int y) { - xmargin = x; + leftmargin = x1; + rightmargin = x2; ymargin = y; + } -int lcd_getxmargin(void) +int lcd_getleftmargin(void) { - return xmargin; + return leftmargin; } +int lcd_getrightmargin(void) +{ + return rightmargin; +} + + int lcd_getymargin(void) { return ymargin; @@ -1021,7 +1030,7 @@ ucs = bidi_l2v(str, 1); - while ((ch = *ucs++) != 0 && x < LCD_WIDTH) + while ((ch = *ucs++) != 0 && x < rightmargin) { int width; const unsigned char *bits; @@ -1042,7 +1051,10 @@ bits = font_get_bits(pf, ch); - lcd_mono_bitmap_part(bits, ofs, 0, width, x, y, width - ofs, pf->height); + if (width+x< rightmargin) + lcd_mono_bitmap_part(bits, ofs, 0, width, x, y, width - ofs, pf->height); + else + lcd_mono_bitmap_part(bits, ofs, 0, width, x, y, width - ofs-((width+x)-rightmargin), pf->height); x += width - ofs; ofs = 0; @@ -1088,13 +1100,13 @@ return; lcd_getstringsize(str, &w, &h); - xpos = xmargin + x*w / utf8length((char *)str); + xpos = leftmargin + x*w / utf8length((char *)str); ypos = ymargin + y*h; drawmode = (style & STYLE_INVERT) ? (DRMODE_SOLID|DRMODE_INVERSEVID) : DRMODE_SOLID; lcd_putsxyofs(xpos, ypos, offset, str); drawmode ^= DRMODE_INVERSEVID; - lcd_fillrect(xpos + w, ypos, LCD_WIDTH - (xpos + w), h); + lcd_fillrect(xpos + w, ypos, rightmargin - (xpos + w), h); drawmode = lastmode; } @@ -1171,7 +1183,7 @@ lcd_getstringsize(string, &w, &h); - if (LCD_WIDTH - x * 8 - xmargin < w) { + if (rightmargin - x * 8 - leftmargin < w) { /* prepare scroll line */ char *end; @@ -1184,7 +1196,7 @@ /* scroll bidirectional or forward only depending on the string width */ if ( bidir_limit ) { - s->bidir = s->width < (LCD_WIDTH - xmargin) * + s->bidir = s->width < (rightmargin - leftmargin) * (100 + bidir_limit) / 100; } else @@ -1197,12 +1209,14 @@ } end = strchr(s->line, '\0'); - strncpy(end, (char *)string, LCD_WIDTH/2); + strncpy(end, (char *)string, rightmargin/2); s->len = utf8length((char *)string); s->offset = offset; s->startx = x; s->backward = false; + s->left_margin=leftmargin; + s->right_margin=rightmargin; scrolling_lines |= (1<offset += scroll_step; pf = font_get(curfont); - xpos = xmargin + s->startx * s->width / s->len; + xpos = s->left_margin + s->startx * s->width / s->len; ypos = ymargin + index * pf->height; if (s->bidir) { /* scroll bidirectional */ @@ -1249,9 +1263,9 @@ s->backward = false; s->start_tick = current_tick + scroll_delay * 2; } - if (s->offset >= s->width - (LCD_WIDTH - xpos)) { + if (s->offset >= s->width - (s->right_margin - xpos)) { /* at end of line */ - s->offset = s->width - (LCD_WIDTH - xpos); + s->offset = s->width - (s->right_margin - xpos); s->backward = true; s->start_tick = current_tick + scroll_delay * 2; } @@ -1265,9 +1279,10 @@ lastmode = drawmode; drawmode = s->invert ? (DRMODE_SOLID|DRMODE_INVERSEVID) : DRMODE_SOLID; + lcd_setmargins(s->left_margin, s->right_margin, ymargin); lcd_putsxyofs(xpos, ypos, s->offset, s->line); drawmode = lastmode; - lcd_update_rect(xpos, ypos, LCD_WIDTH - xpos, pf->height); + lcd_update_rect(xpos, ypos, s->right_margin - xpos, pf->height); } sleep(scroll_ticks); Index: firmware/drivers/lcd-recorder.c =================================================================== RCS file: /cvsroot/rockbox/firmware/drivers/lcd-recorder.c,v retrieving revision 1.77 diff -u -r1.77 lcd-recorder.c --- firmware/drivers/lcd-recorder.c 2 Feb 2006 19:35:51 -0000 1.77 +++ firmware/drivers/lcd-recorder.c 6 Feb 2006 18:15:09 -0000 @@ -80,7 +80,8 @@ unsigned char lcd_framebuffer[LCD_HEIGHT/8][LCD_WIDTH]; static int drawmode = DRMODE_SOLID; -static int xmargin = 0; +static int leftmargin = 0; +static int rightmargin = 0; static int ymargin = 0; static int curfont = FONT_SYSFIXED; #ifndef SIMULATOR @@ -374,15 +375,21 @@ return drawmode; } -void lcd_setmargins(int x, int y) +void lcd_setmargins(int x1, int x2, int y) { - xmargin = x; + leftmargin = x1; + rightmargin = x2; ymargin = y; } -int lcd_getxmargin(void) +int lcd_getleftmargin(void) { - return xmargin; + return leftmargin; +} + +int lcd_getrightmargin(void) +{ + return rightmargin; } int lcd_getymargin(void) @@ -882,7 +889,7 @@ ucs = bidi_l2v(str, 1); - while ((ch = *ucs++) != 0 && x < LCD_WIDTH) + while ((ch = *ucs++) != 0 && x < rightmargin) { int width; const unsigned char *bits; @@ -903,7 +910,10 @@ bits = font_get_bits(pf, ch); - lcd_mono_bitmap_part(bits, ofs, 0, width, x, y, width - ofs, pf->height); + if (width+x< rightmargin) + lcd_mono_bitmap_part(bits, ofs, 0, width, x, y, width - ofs, pf->height); + else + lcd_mono_bitmap_part(bits, ofs, 0, width, x, y, width - ofs-((width+x)-rightmargin), pf->height); x += width - ofs; ofs = 0; @@ -948,13 +958,13 @@ return; lcd_getstringsize(str, &w, &h); - xpos = xmargin + x*w / utf8length(str); + xpos = leftmargin + x*w / utf8length(str); ypos = ymargin + y*h; drawmode = (style & STYLE_INVERT) ? (DRMODE_SOLID|DRMODE_INVERSEVID) : DRMODE_SOLID; lcd_putsxyofs(xpos, ypos, offset, str); drawmode ^= DRMODE_INVERSEVID; - lcd_fillrect(xpos + w, ypos, LCD_WIDTH - (xpos + w), h); + lcd_fillrect(xpos + w, ypos, rightmargin - (xpos + w), h); drawmode = lastmode; } @@ -1032,7 +1042,7 @@ lcd_getstringsize(string, &w, &h); - if (LCD_WIDTH - x * 8 - xmargin < w) { + if (rightmargin - x * 8 - leftmargin < w) { /* prepare scroll line */ char *end; @@ -1045,7 +1055,7 @@ /* scroll bidirectional or forward only depending on the string width */ if ( bidir_limit ) { - s->bidir = s->width < (LCD_WIDTH - xmargin) * + s->bidir = s->width < (rightmargin - leftmargin) * (100 + bidir_limit) / 100; } else @@ -1058,12 +1068,14 @@ } end = strchr(s->line, '\0'); - strncpy(end, string, LCD_WIDTH/2); + strncpy(end, string, rightmargin/2); s->len = utf8length(string); s->offset = offset; s->startx = x; s->backward = false; + s->left_margin=leftmargin; + s->right_margin=rightmargin; scrolling_lines |= (1<offset += scroll_step; pf = font_get(curfont); - xpos = xmargin + s->startx * s->width / s->len; + xpos = s->left_margin + s->startx * s->width / s->len; ypos = ymargin + index * pf->height; if (s->bidir) { /* scroll bidirectional */ @@ -1110,9 +1122,9 @@ s->backward = false; s->start_tick = current_tick + scroll_delay * 2; } - if (s->offset >= s->width - (LCD_WIDTH - xpos)) { + if (s->offset >= s->width - (s->right_margin - xpos)) { /* at end of line */ - s->offset = s->width - (LCD_WIDTH - xpos); + s->offset = s->width - (s->right_margin - xpos); s->backward = true; s->start_tick = current_tick + scroll_delay * 2; } @@ -1126,9 +1138,10 @@ lastmode = drawmode; drawmode = s->invert ? (DRMODE_SOLID|DRMODE_INVERSEVID) : DRMODE_SOLID; + lcd_setmargins(s->left_margin, s->right_margin, ymargin); lcd_putsxyofs(xpos, ypos, s->offset, s->line); drawmode = lastmode; - lcd_update_rect(xpos, ypos, LCD_WIDTH - xpos, pf->height); + lcd_update_rect(xpos, ypos, s->right_margin - xpos, pf->height); } sleep(scroll_ticks); Index: firmware/export/lcd-remote.h =================================================================== RCS file: /cvsroot/rockbox/firmware/export/lcd-remote.h,v retrieving revision 1.17 diff -u -r1.17 lcd-remote.h --- firmware/export/lcd-remote.h 22 Jan 2006 04:24:26 -0000 1.17 +++ firmware/export/lcd-remote.h 6 Feb 2006 18:15:10 -0000 @@ -64,8 +64,9 @@ extern void lcd_remote_set_drawmode(int mode); extern int lcd_remote_get_drawmode(void); -extern void lcd_remote_setmargins(int xmargin, int ymargin); -extern int lcd_remote_getxmargin(void); +extern void lcd_remote_setmargins(int leftmargin, int rightmargin, int ymargin); +extern int lcd_remote_getleftmargin(void); +extern int lcd_remote_getrightmargin(void); extern int lcd_remote_getymargin(void); extern void lcd_remote_setfont(int font); extern int lcd_remote_getstringsize(const unsigned char *str, int *w, int *h); Index: firmware/export/lcd.h =================================================================== RCS file: /cvsroot/rockbox/firmware/export/lcd.h,v retrieving revision 1.55 diff -u -r1.55 lcd.h --- firmware/export/lcd.h 5 Feb 2006 00:17:53 -0000 1.55 +++ firmware/export/lcd.h 6 Feb 2006 18:15:14 -0000 @@ -232,8 +232,9 @@ extern void lcd_set_drawmode(int mode); extern int lcd_get_drawmode(void); -extern void lcd_setmargins(int xmargin, int ymargin); -extern int lcd_getxmargin(void); +extern void lcd_setmargins(int leftmargin, int rightmargin, int ymargin); +extern int lcd_getleftmargin(void); +extern int lcd_getrightmargin(void); extern int lcd_getymargin(void); extern void lcd_setfont(int font); extern int lcd_getstringsize(const unsigned char *str, int *w, int *h); @@ -312,6 +313,8 @@ bool bidir; bool invert; /* invert the scrolled text */ long start_tick; + int left_margin; + int right_margin; }; #else /* !HAVE_LCD_BITMAP */