? Makefile
? archos
? boot
? build
? build.lang
? credits.raw
? dep-apps
? lang.c
? lang.h
? linkage.lds
? recorder
? rockbox.map
? apps/common
? apps/dep-firmware
? apps/drivers
? apps/sysfont.c
? apps/plugins/menu.c
? firmware/export/.lcd.h.swp
? tools/mkboot
? uisimulator/Makefile
? uisimulator/archos
? uisimulator/build
? uisimulator/dep-apps
? uisimulator/dep-commonsim
? uisimulator/dep-firmware
? uisimulator/dep-rockboy
? uisimulator/drivers
? uisimulator/sector3D.bin
? uisimulator/sysfont.c
Index: apps/alarm_menu.c
===================================================================
RCS file: /cvsroot/rockbox/apps/alarm_menu.c,v
retrieving revision 1.6
diff -u -r1.6 alarm_menu.c
--- apps/alarm_menu.c	6 Feb 2005 17:21:42 -0000	1.6
+++ apps/alarm_menu.c	4 Mar 2005 08:44:12 -0000
@@ -58,7 +58,7 @@
 
     lcd_clear_display();
     lcd_setfont(FONT_SYSFIXED);
-    lcd_setmargins(0, 0);
+    lcd_setmargins(0, 0, 0, 0);
     lcd_puts(0,1, str(LANG_ALARM_MOD_KEYS));
     
     while(!done) {
Index: apps/bookmark.c
===================================================================
RCS file: /cvsroot/rockbox/apps/bookmark.c,v
retrieving revision 1.32
diff -u -r1.32 bookmark.c
--- apps/bookmark.c	9 Feb 2005 11:18:31 -0000	1.32
+++ apps/bookmark.c	4 Mar 2005 08:44:13 -0000
@@ -243,7 +243,7 @@
     /* Prompting user to confirm bookmark creation */
     lcd_clear_display();
 #ifdef HAVE_LCD_BITMAP
-    lcd_setmargins(0, STATUSBAR_HEIGHT);
+    lcd_setmargins(0, STATUSBAR_HEIGHT, 0, 0);
     lcd_puts(0,0, str(LANG_AUTO_BOOKMARK_QUERY));
     lcd_puts(0,1, str(LANG_CONFIRM_WITH_PLAY_RECORDER));
     lcd_puts(0,2, str(LANG_CANCEL_WITH_ANY_RECORDER));
@@ -486,7 +486,7 @@
         /* Prompting user to confirm bookmark load */
         lcd_clear_display();
 #ifdef HAVE_LCD_BITMAP
-        lcd_setmargins(0, STATUSBAR_HEIGHT);
+        lcd_setmargins(0, STATUSBAR_HEIGHT, 0, 0);
         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));
@@ -615,7 +615,7 @@
     int bookmark_count = 0;
 
 #ifdef HAVE_LCD_BITMAP
-    lcd_setmargins(0, 0);
+    lcd_setmargins(0, 0, 0, 0);
 #endif
 
     button_clear_queue(); /* clear button queue */
@@ -665,9 +665,9 @@
                 /* User wants to use this bookmark */
 #ifdef HAVE_LCD_BITMAP
                 if (global_settings.statusbar)
-                    lcd_setmargins(0, STATUSBAR_HEIGHT);
+                    lcd_setmargins(0, STATUSBAR_HEIGHT, 0, 0);
                 else
-                    lcd_setmargins(0, 0);
+                    lcd_setmargins(0, 0, 0, 0);
 #endif
                 return bookmark;
 
Index: apps/debug_menu.c
===================================================================
RCS file: /cvsroot/rockbox/apps/debug_menu.c,v
retrieving revision 1.107
diff -u -r1.107 debug_menu.c
--- apps/debug_menu.c	3 Mar 2005 07:25:43 -0000	1.107
+++ apps/debug_menu.c	4 Mar 2005 08:44:13 -0000
@@ -76,7 +76,7 @@
     int usage;
 
 #ifdef HAVE_LCD_BITMAP
-    lcd_setmargins(0, 0);
+    lcd_setmargins(0, 0, 0, 0);
 #endif
     lcd_clear_display();
 
@@ -111,7 +111,7 @@
     int currval = 0;
 
 #ifdef HAVE_LCD_BITMAP
-    lcd_setmargins(0, 0);
+    lcd_setmargins(0, 0, 0, 0);
 #endif
     lcd_clear_display();
 
@@ -154,7 +154,7 @@
     int button;
     struct mpeg_debug d;
 
-    lcd_setmargins(0, 0);
+    lcd_setmargins(0, 0, 0, 0);
     
     while(1)
     {
@@ -363,7 +363,7 @@
 
     system_memory_guard(oldmode);  /* re-enable memory guard */
 
-    lcd_setmargins(0, 0);
+    lcd_setmargins(0, 0, 0, 0);
     lcd_setfont(FONT_SYSFIXED);
     lcd_clear_display();
 
@@ -580,7 +580,7 @@
     int batt_int, batt_frac;
 
 #ifdef HAVE_LCD_BITMAP
-    lcd_setmargins(0, 0);
+    lcd_setmargins(0, 0, 0, 0);
 #endif
     lcd_clear_display();
 
@@ -640,7 +640,7 @@
     int line;
 
 #ifdef HAVE_LCD_BITMAP
-    lcd_setmargins(0, 0);
+    lcd_setmargins(0, 0, 0, 0);
 #endif
     lcd_clear_display();
     lcd_setfont(FONT_SYSFIXED);
@@ -730,7 +730,7 @@
     int currval = 0;
 
 #ifdef HAVE_LCD_BITMAP
-    lcd_setmargins(0, 0);
+    lcd_setmargins(0, 0, 0, 0);
 #endif
     lcd_clear_display();
 
@@ -821,7 +821,7 @@
     int button;
 
 #ifdef HAVE_LCD_BITMAP
-    lcd_setmargins(0, 0);
+    lcd_setmargins(0, 0, 0, 0);
 #endif
     lcd_clear_display();
     lcd_puts(0, 0, "RTC read:");
@@ -887,7 +887,7 @@
     unsigned int addr = 0, r, i;
 
 #ifdef HAVE_LCD_BITMAP
-    lcd_setmargins(0, 0);
+    lcd_setmargins(0, 0, 0, 0);
 #endif
     lcd_clear_display();
     lcd_puts(0, 0, "MAS register read:");
@@ -928,7 +928,7 @@
     unsigned int addr = 0, r, i;
 
 #ifdef HAVE_LCD_BITMAP
-    lcd_setmargins(0, 0);
+    lcd_setmargins(0, 0, 0, 0);
 #endif
     lcd_clear_display();
     lcd_puts(0, 0, "MAS codec reg read:");
@@ -979,7 +979,7 @@
     char buf[32];
     
 #ifdef HAVE_LCD_BITMAP
-    lcd_setmargins(0, 0);
+    lcd_setmargins(0, 0, 0, 0);
 #endif
     while(1)
     {
@@ -1130,7 +1130,7 @@
     int pll_toggle = 0;
     
 #ifdef HAVE_LCD_BITMAP
-    lcd_setmargins(0, 0);
+    lcd_setmargins(0, 0, 0, 0);
 #endif
     while(1)
     {
@@ -1391,7 +1391,7 @@
     
     card_name[6] = '\0';
 
-    lcd_setmargins(0, 0);
+    lcd_setmargins(0, 0, 0, 0);
     lcd_setfont(FONT_SYSFIXED);
 
     while (!done)
@@ -1493,7 +1493,7 @@
     char pio3[2], pio4[2];
 
 #ifdef HAVE_LCD_BITMAP
-    lcd_setmargins(0, 0);
+    lcd_setmargins(0, 0, 0, 0);
 #endif
     
     while(!done)
@@ -1687,7 +1687,7 @@
     bool fm_detected;
 
 #ifdef HAVE_LCD_BITMAP
-    lcd_setmargins(0, 0);
+    lcd_setmargins(0, 0, 0, 0);
 #endif
 
     while(1)
Index: apps/menu.c
===================================================================
RCS file: /cvsroot/rockbox/apps/menu.c,v
retrieving revision 1.79
diff -u -r1.79 menu.c
--- apps/menu.c	13 Jan 2005 19:37:34 -0000	1.79
+++ apps/menu.c	4 Mar 2005 08:44:14 -0000
@@ -162,7 +162,7 @@
 
     lcd_clear_display();
 #ifdef HAVE_LCD_BITMAP
-    lcd_setmargins(MARGIN_X,MARGIN_Y); /* leave room for cursor and icon */
+    lcd_setmargins(MARGIN_X,MARGIN_Y, 0, 0); /* leave room for cursor and icon */
 #endif
     /* Adjust cursor pos if it's below the screen */
     if (menus[m].cursor - menus[m].top >= menu_lines)
Index: apps/playlist.c
===================================================================
RCS file: /cvsroot/rockbox/apps/playlist.c,v
retrieving revision 1.114
diff -u -r1.114 playlist.c
--- apps/playlist.c	22 Feb 2005 12:19:11 -0000	1.114
+++ apps/playlist.c	4 Mar 2005 08:44:14 -0000
@@ -338,9 +338,9 @@
     
 #ifdef HAVE_LCD_BITMAP
     if(global_settings.statusbar)
-        lcd_setmargins(0, STATUSBAR_HEIGHT);
+        lcd_setmargins(0, STATUSBAR_HEIGHT, 0, 0);
     else
-        lcd_setmargins(0, 0);
+        lcd_setmargins(0, 0, 0, 0);
 #endif
 
     splash(0, true, str(LANG_PLAYLIST_LOAD));
@@ -1058,9 +1058,9 @@
 
 #ifdef HAVE_LCD_BITMAP
     if(global_settings.statusbar)
-        lcd_setmargins(0, STATUSBAR_HEIGHT);
+        lcd_setmargins(0, STATUSBAR_HEIGHT, 0, 0);
     else
-        lcd_setmargins(0, 0);
+        lcd_setmargins(0, 0, 0, 0);
 #endif
 
     splash(0, true, fmt, count,
Index: apps/playlist_viewer.c
===================================================================
RCS file: /cvsroot/rockbox/apps/playlist_viewer.c,v
retrieving revision 1.23
diff -u -r1.23 playlist_viewer.c
--- apps/playlist_viewer.c	17 Nov 2004 13:28:25 -0000	1.23
+++ apps/playlist_viewer.c	4 Mar 2005 08:44:14 -0000
@@ -444,7 +444,7 @@
     lcd_clear_display();
 
 #ifdef HAVE_LCD_BITMAP
-    lcd_setmargins(MARGIN_X, MARGIN_Y);
+    lcd_setmargins(MARGIN_X, MARGIN_Y, 0, 0);
     lcd_setfont(FONT_UI);
 #endif
 
Index: apps/plugin.c
===================================================================
RCS file: /cvsroot/rockbox/apps/plugin.c,v
retrieving revision 1.77
diff -u -r1.77 plugin.c
--- apps/plugin.c	3 Mar 2005 14:10:17 -0000	1.77
+++ apps/plugin.c	4 Mar 2005 08:44:14 -0000
@@ -294,7 +294,7 @@
     lcd_clear_display();
     xm = lcd_getxmargin();
     ym = lcd_getymargin();
-    lcd_setmargins(0,0);
+    lcd_setmargins(0,0, 0, 0);
     lcd_update();
 #else
     lcd_clear_display();
@@ -365,7 +365,7 @@
 
 #ifdef HAVE_LCD_BITMAP
     /* restore margins */
-    lcd_setmargins(xm,ym);
+    lcd_setmargins(xm,ym, 0, 0);
 #endif
 
     return PLUGIN_OK;
Index: apps/screens.c
===================================================================
RCS file: /cvsroot/rockbox/apps/screens.c,v
retrieving revision 1.74
diff -u -r1.74 screens.c
--- apps/screens.c	19 Feb 2005 16:23:30 -0000	1.74
+++ apps/screens.c	4 Mar 2005 08:44:15 -0000
@@ -732,9 +732,9 @@
         case BUTTON_F3:
 
             if (global_settings.statusbar)
-                lcd_setmargins(0, STATUSBAR_HEIGHT);
+                lcd_setmargins(0, STATUSBAR_HEIGHT, 0, 0);
             else
-                lcd_setmargins(0, 0);
+                lcd_setmargins(0, 0, 0, 0);
                 
             break;
     }
@@ -1005,9 +1005,9 @@
 
 #ifdef HAVE_LCD_BITMAP
     if(global_settings.statusbar)
-        lcd_setmargins(0, STATUSBAR_HEIGHT);
+        lcd_setmargins(0, STATUSBAR_HEIGHT, 0, 0);
     else
-        lcd_setmargins(0, 0);
+        lcd_setmargins(0, 0, 0, 0);
 #endif
     lcd_clear_display();
     lcd_puts_scroll(0, 0, string);
Index: apps/settings.c
===================================================================
RCS file: /cvsroot/rockbox/apps/settings.c,v
retrieving revision 1.263
diff -u -r1.263 settings.c
--- apps/settings.c	3 Mar 2005 08:32:54 -0000	1.263
+++ apps/settings.c	4 Mar 2005 08:44:15 -0000
@@ -1330,9 +1330,9 @@
 
 #ifdef HAVE_LCD_BITMAP
     if(global_settings.statusbar)
-        lcd_setmargins(0, STATUSBAR_HEIGHT);
+        lcd_setmargins(0, STATUSBAR_HEIGHT, 0, 0);
     else
-        lcd_setmargins(0, 0);
+        lcd_setmargins(0, 0, 0, 0);
 #endif
 
     lcd_clear_display();
@@ -1438,9 +1438,9 @@
 
 #ifdef HAVE_LCD_BITMAP
     if(global_settings.statusbar)
-        lcd_setmargins(0, STATUSBAR_HEIGHT);
+        lcd_setmargins(0, STATUSBAR_HEIGHT, 0, 0);
     else
-        lcd_setmargins(0, 0);
+        lcd_setmargins(0, 0, 0, 0);
 #endif
 
     lcd_clear_display();
Index: apps/sleeptimer.c
===================================================================
RCS file: /cvsroot/rockbox/apps/sleeptimer.c,v
retrieving revision 1.13
diff -u -r1.13 sleeptimer.c
--- apps/sleeptimer.c	16 Oct 2004 07:52:16 -0000	1.13
+++ apps/sleeptimer.c	4 Mar 2005 08:44:15 -0000
@@ -55,9 +55,9 @@
 
 #ifdef HAVE_LCD_BITMAP
     if (global_settings.statusbar)
-        lcd_setmargins(0, STATUSBAR_HEIGHT);
+        lcd_setmargins(0, STATUSBAR_HEIGHT, 0, 0);
     else
-        lcd_setmargins(0, 0);
+        lcd_setmargins(0, 0, 0, 0);
 #endif
     
     lcd_clear_display();
Index: apps/sound_menu.c
===================================================================
RCS file: /cvsroot/rockbox/apps/sound_menu.c,v
retrieving revision 1.68
diff -u -r1.68 sound_menu.c
--- apps/sound_menu.c	6 Feb 2005 13:47:21 -0000	1.68
+++ apps/sound_menu.c	4 Mar 2005 08:44:15 -0000
@@ -73,9 +73,9 @@
     
 #ifdef HAVE_LCD_BITMAP
     if(global_settings.statusbar)
-        lcd_setmargins(0, STATUSBAR_HEIGHT);
+        lcd_setmargins(0, STATUSBAR_HEIGHT, 0, 0);
     else
-        lcd_setmargins(0, 0);
+        lcd_setmargins(0, 0, 0, 0);
 #endif
     lcd_clear_display();
     lcd_puts_scroll(0,0,string);
Index: apps/tree.c
===================================================================
RCS file: /cvsroot/rockbox/apps/tree.c,v
retrieving revision 1.301
diff -u -r1.301 tree.c
--- apps/tree.c	16 Feb 2005 12:18:16 -0000	1.301
+++ apps/tree.c	4 Mar 2005 08:44:16 -0000
@@ -356,7 +356,7 @@
 #endif
     lcd_clear_display();
 #ifdef HAVE_LCD_BITMAP
-    lcd_setmargins(MARGIN_X,MARGIN_Y); /* leave room for cursor and icon */
+    lcd_setmargins(MARGIN_X,MARGIN_Y, 0, 0); /* leave room for cursor and icon */
     lcd_setfont(FONT_UI);
 #endif
 
@@ -1183,7 +1183,7 @@
             }
 #ifdef HAVE_LCD_BITMAP
             /* the sub-screen might've ruined the margins */
-            lcd_setmargins(MARGIN_X,MARGIN_Y); /* leave room for cursor and
+            lcd_setmargins(MARGIN_X,MARGIN_Y, 0, 0); /* leave room for cursor and
                                                   icon */
             lcd_setfont(FONT_UI);
 #endif
Index: apps/wps-display.c
===================================================================
RCS file: /cvsroot/rockbox/apps/wps-display.c,v
retrieving revision 1.103
diff -u -r1.103 wps-display.c
--- apps/wps-display.c	12 Feb 2005 12:40:35 -0000	1.103
+++ apps/wps-display.c	4 Mar 2005 08:44:16 -0000
@@ -196,7 +196,7 @@
             bool any_defined_line;
             lcd_clear_display();
 #ifdef HAVE_LCD_BITMAP
-            lcd_setmargins(0,0);
+            lcd_setmargins(0,0, 0, 0);
 #endif
             for (s=0; s<MAX_SUBLINES; s++)
             {
Index: apps/wps.c
===================================================================
RCS file: /cvsroot/rockbox/apps/wps.c,v
retrieving revision 1.232
diff -u -r1.232 wps.c
--- apps/wps.c	12 Feb 2005 12:20:10 -0000	1.232
+++ apps/wps.c	4 Mar 2005 08:44:16 -0000
@@ -443,9 +443,9 @@
     status_set_param(false);
 #else
     if(global_settings.statusbar)
-        lcd_setmargins(0, STATUSBAR_HEIGHT);
+        lcd_setmargins(0, STATUSBAR_HEIGHT, 0, 0);
     else
-        lcd_setmargins(0, 0);
+        lcd_setmargins(0, 0, 0, 0);
 #endif
 
     ff_rewind = false;
@@ -698,9 +698,9 @@
                     return true;
 #ifdef HAVE_LCD_BITMAP
                 if (global_settings.statusbar)
-                    lcd_setmargins(0, STATUSBAR_HEIGHT);
+                    lcd_setmargins(0, STATUSBAR_HEIGHT, 0, 0);
                 else
-                    lcd_setmargins(0, 0);
+                    lcd_setmargins(0, 0, 0, 0);
 #endif
                 restore = true;
                 break;
Index: apps/recorder/radio.c
===================================================================
RCS file: /cvsroot/rockbox/apps/recorder/radio.c,v
retrieving revision 1.56
diff -u -r1.56 radio.c
--- apps/recorder/radio.c	22 Feb 2005 12:48:36 -0000	1.56
+++ apps/recorder/radio.c	4 Mar 2005 08:44:17 -0000
@@ -181,7 +181,7 @@
     bool keep_playing = false;
 
     lcd_clear_display();
-    lcd_setmargins(0, 8);
+    lcd_setmargins(0, 8, 0, 0);
     status_draw(true);
     radio_set_status(FMRADIO_PLAYING);
 
@@ -374,7 +374,7 @@
                 radio_menu();
                 curr_preset = find_preset(curr_freq);
                 lcd_clear_display();
-                lcd_setmargins(0, 8);
+                lcd_setmargins(0, 8, 0, 0);
 #if CONFIG_KEYPAD == RECORDER_PAD
                 buttonbar_set(str(LANG_BUTTONBAR_MENU),
                               str(LANG_FM_BUTTONBAR_PRESETS),
@@ -389,7 +389,7 @@
                 handle_radio_presets();
                 curr_preset = find_preset(curr_freq);
                 lcd_clear_display();
-                lcd_setmargins(0, 8);
+                lcd_setmargins(0, 8, 0, 0);
 #if CONFIG_KEYPAD == RECORDER_PAD
                 buttonbar_set(str(LANG_BUTTONBAR_MENU),
                               str(LANG_FM_BUTTONBAR_PRESETS),
@@ -434,7 +434,7 @@
 
         if(!screen_freeze)
         {
-            lcd_setmargins(0, 8);
+            lcd_setmargins(0, 8, 0, 0);
             
             /* Only display the peak meter when not recording */
             if(!mpeg_status())
Index: apps/recorder/recording.c
===================================================================
RCS file: /cvsroot/rockbox/apps/recorder/recording.c,v
retrieving revision 1.73
diff -u -r1.73 recording.c
--- apps/recorder/recording.c	16 Feb 2005 11:04:35 -0000	1.73
+++ apps/recorder/recording.c	4 Mar 2005 08:44:18 -0000
@@ -289,7 +289,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, 8, 0, 0);
 
     if(rec_create_directory() > 0)
         have_recorded = true;
@@ -494,7 +494,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, 8, 0, 0);
                 }
                 break;
 #endif
Index: docs/API
===================================================================
RCS file: /cvsroot/rockbox/docs/API,v
retrieving revision 1.2
diff -u -r1.2 API
--- docs/API	2 Mar 2004 11:32:59 -0000	1.2
+++ docs/API	4 Mar 2005 08:44:18 -0000
@@ -39,7 +39,7 @@
       hardware supports is even 8 pixels. This function will adjust to those.
 
     lcd_setfont(int font) set default font
-    lcd_setmargins(int x, int y) set top/left margins
+    lcd_setmargins(int x, int y, int r, int b) set top/left/right/bottom margins
     lcd_putsxy(x,y,string,font) put a string at given position, using a
                                 specific font
     lcd_bitmap(src,x,y,width,height,clear) put a bitmap at given position
Index: firmware/drivers/lcd-h100.c
===================================================================
RCS file: /cvsroot/rockbox/firmware/drivers/lcd-h100.c,v
retrieving revision 1.9
diff -u -r1.9 lcd-h100.c
--- firmware/drivers/lcd-h100.c	11 Feb 2005 01:06:14 -0000	1.9
+++ firmware/drivers/lcd-h100.c	4 Mar 2005 08:44:19 -0000
@@ -86,6 +86,8 @@
 static struct scrollinfo scroll[SCROLLABLE_LINES];
 static int xmargin = 0;
 static int ymargin = 0;
+static int rmargin = 0;
+static int bmargin = 0;
 static int curfont = FONT_SYSFIXED;
 #ifndef SIMULATOR
 static int xoffset = 0; /* needed for flip */
@@ -296,10 +298,12 @@
     scrolling_lines = 0;
 }
 
-void lcd_setmargins(int x, int y)
+void lcd_setmargins(int x, int y, int r, int b)
 {
     xmargin = x;
     ymargin = y;
+    rmargin = r;
+    bmargin = b;
 }
 
 int lcd_getxmargin(void)
@@ -382,13 +386,17 @@
 #endif
 }
 
-/* put a string at a given pixel position, skipping first ofs pixel columns */
-static void lcd_putsxyofs(int x, int y, int ofs, const unsigned char *str)
+/* put a string at a given pixel position, skipping first ofs pixel columns, 
+ * with a maximum width of sw pixel columns */
+static void lcd_putsxyofs(int x, int y, int ofs, int sw, const unsigned char *str)
 {
     int ch;
     struct font* pf = font_get(curfont);
 
-    while ((ch = *str++) != '\0' && x < LCD_WIDTH)
+    /* convert sw to screen coordinates */
+    sw += x;
+    
+    while ((ch = *str++) != '\0' && x < sw)
     {
         int gwidth, width;
 
@@ -399,7 +407,7 @@
 
         /* get proportional width and glyph bits */
         gwidth = pf->width ? pf->width[ch] : pf->maxwidth;
-        width = MIN (gwidth, LCD_WIDTH - x);
+        width = MIN (gwidth, sw - x);
 
         if (ofs != 0)
         {
@@ -439,7 +447,7 @@
 /* put a string at a given pixel position */
 void lcd_putsxy(int x, int y, const unsigned char *str)
 {
-    lcd_putsxyofs(x, y, 0, str);
+    lcd_putsxyofs(x, y, 0, LCD_WIDTH - x, str);
 }
 
 /*
@@ -937,7 +945,7 @@
             }
 
             lcd_clearrect(xpos, ypos, LCD_WIDTH - xpos, pf->height);
-            lcd_putsxyofs(xpos, ypos, s->offset, s->line);
+            lcd_putsxyofs(xpos, ypos, s->offset, LCD_WIDTH - xpos, s->line);
             if (s->invert)
                 lcd_invertrect(xpos, ypos, LCD_WIDTH - xpos, pf->height);
             lcd_update_rect(xpos, ypos, LCD_WIDTH - xpos, pf->height);
Index: firmware/drivers/lcd-recorder.c
===================================================================
RCS file: /cvsroot/rockbox/firmware/drivers/lcd-recorder.c,v
retrieving revision 1.51
diff -u -r1.51 lcd-recorder.c
--- firmware/drivers/lcd-recorder.c	27 Jan 2005 15:33:49 -0000	1.51
+++ firmware/drivers/lcd-recorder.c	4 Mar 2005 08:44:19 -0000
@@ -101,6 +101,8 @@
 static struct scrollinfo scroll[SCROLLABLE_LINES];
 static int xmargin = 0;
 static int ymargin = 0;
+static int rmargin = 0;
+static int bmargin = 0;
 static int curfont = FONT_SYSFIXED;
 #ifndef SIMULATOR
 static int xoffset; /* needed for flip */
@@ -344,10 +346,12 @@
     scrolling_lines = 0;
 }
 
-void lcd_setmargins(int x, int y)
+void lcd_setmargins(int x, int y, int r, int b)
 {
     xmargin = x;
     ymargin = y;
+    rmargin = r;
+    bmargin = b;
 }
 
 int lcd_getxmargin(void)
@@ -430,13 +434,17 @@
 #endif
 }
 
-/* put a string at a given pixel position, skipping first ofs pixel columns */
-static void lcd_putsxyofs(int x, int y, int ofs, const unsigned char *str)
+/* put a string at a given pixel position, skipping first ofs pixel columns, 
+ * with a maximum width of sw pixel columns */
+static void lcd_putsxyofs(int x, int y, int ofs, int sw, const unsigned char *str)
 {
     int ch;
     struct font* pf = font_get(curfont);
 
-    while ((ch = *str++) != '\0' && x < LCD_WIDTH)
+    /* convert sw to screen coordinates */
+    sw += x;
+    
+    while ((ch = *str++) != '\0' && x < sw)
     {
         int gwidth, width;
 
@@ -447,7 +455,7 @@
 
         /* get proportional width and glyph bits */
         gwidth = pf->width ? pf->width[ch] : pf->maxwidth;
-        width = MIN (gwidth, LCD_WIDTH - x);
+        width = MIN (gwidth, sw - x);
 
         if (ofs != 0)
         {
@@ -487,7 +495,7 @@
 /* put a string at a given pixel position */
 void lcd_putsxy(int x, int y, const unsigned char *str)
 {
-    lcd_putsxyofs(x, y, 0, str);
+    lcd_putsxyofs(x, y, 0, LCD_WIDTH - x, str);
 }
 
 /*
@@ -985,7 +993,7 @@
             }
 
             lcd_clearrect(xpos, ypos, LCD_WIDTH - xpos, pf->height);
-            lcd_putsxyofs(xpos, ypos, s->offset, s->line);
+            lcd_putsxyofs(xpos, ypos, s->offset, LCD_WIDTH - xpos, s->line);
             if (s->invert)
                 lcd_invertrect(xpos, ypos, LCD_WIDTH - xpos, pf->height);
             lcd_update_rect(xpos, ypos, LCD_WIDTH - xpos, pf->height);
Index: firmware/export/lcd.h
===================================================================
RCS file: /cvsroot/rockbox/firmware/export/lcd.h,v
retrieving revision 1.21
diff -u -r1.21 lcd.h
--- firmware/export/lcd.h	22 Feb 2005 12:19:12 -0000	1.21
+++ firmware/export/lcd.h	4 Mar 2005 08:44:19 -0000
@@ -117,7 +117,7 @@
  */
 extern unsigned char lcd_framebuffer[LCD_HEIGHT/8][LCD_WIDTH];
 
-extern void lcd_setmargins(int xmargin, int ymargin);
+extern void lcd_setmargins(int xmargin, int ymargin, int rmargin, int bmargin);
 extern int  lcd_getxmargin(void);
 extern int  lcd_getymargin(void);
 extern void lcd_bitmap (const unsigned char *src, int x, int y, int nx, int ny,
