--- ./apps/gui/list.c.orig	2006-08-24 09:33:07.000000000 +0200
+++ ./apps/gui/list.c	2006-08-25 08:02:16.000000000 +0200
@@ -93,7 +93,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);
--- ./apps/gui/gwps-common.c.orig	2006-08-20 19:47:54.000000000 +0200
+++ ./apps/gui/gwps-common.c	2006-08-25 08:02:16.000000000 +0200
@@ -21,6 +21,7 @@
 #include <stdio.h>
 #include <string.h>
 #include <stdlib.h>
+#include <ctype.h>
 #include "system.h"
 #include "settings.h"
 #include "rtc.h"
@@ -1295,6 +1296,35 @@
             case 0:
                 *buf++ = '%';
                 break;
+
+            case 'm': /* margins */
+            {
+                int x1=0;
+                int x2=gwps->display->width;
+
+                fmt++;
+                if (*fmt=='|') {
+                    char *p=strchr(fmt, '|');
+                    if (p) {
+                        fmt = ++p;
+                        if (isdigit(*p)) {
+                            x1=atoi(p);
+                            p=strchr(p, '|');
+                            if (p) {
+                                fmt = ++p;
+                                if (isdigit(*p)) {
+                                    x2=atoi(p);
+                                    p=strchr(p, '|');
+                                    if (p)
+                                        fmt = ++p;
+                                }
+                            }
+                        }
+                    }
+                }
+                gwps->display->setmargins( x1, x2, gwps->display->getymargin() );
+            } break;
+
             case 'a':
                 ++fmt;
                 /* remember where the current aligned text started */
@@ -1387,7 +1417,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);
@@ -1839,7 +1869,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]
@@ -1849,7 +1879,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]
@@ -1859,7 +1889,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
@@ -1903,7 +1933,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;
             }
@@ -1915,7 +1945,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;
             }
@@ -1959,7 +1989,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);
@@ -1992,6 +2025,7 @@
                                             (unsigned char *)data->format_align[i]
                                             [data->curr_subline[i]].right);
                         }
+                        
                     }
 #else
                     display->puts_scroll(0, i, buf);
@@ -2037,6 +2071,8 @@
                                         (unsigned char *)data->format_align[i]
                                         [data->curr_subline[i]].right);
                     }
+                    
+                   
 #else
                     update_line = true;
                     display->puts(0, i, buf);
--- ./apps/gui/gwps.c.orig	2006-08-22 11:04:37.000000000 +0200
+++ ./apps/gui/gwps.c	2006-08-25 08:02:16.000000000 +0200
@@ -73,11 +73,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, gwps->display->width, offset);
 }
 #endif
 
--- ./apps/recorder/recording.c.orig	2006-08-21 08:24:48.000000000 +0200
+++ ./apps/recorder/recording.c	2006-08-25 08:02:16.000000000 +0200
@@ -677,7 +677,7 @@
     {
         screens[i].setfont(FONT_SYSFIXED);
         screens[i].getstringsize("M", &w, &h);
-        screens[i].setmargins(global_settings.invert_cursor ? 0 : w, 8);
+        screens[i].setmargins(global_settings.invert_cursor ? 0 : w, screens[i].width, 8);
         filename_offset[i] = ((screens[i].height >= 80) ? 1 : 0);
         pm_y[i] = 8 + h * (2 + filename_offset[i]);
     }
@@ -1051,7 +1051,7 @@
                     FOR_NB_SCREENS(i)
                     {
                         screens[i].setfont(FONT_SYSFIXED);
-                        screens[i].setmargins(global_settings.invert_cursor ? 0 : w, 8);
+                        screens[i].setmargins(global_settings.invert_cursor ? 0 : w, screens[i].width, 8);
                     }
                 }
                 break;
--- ./apps/logfdisp.c.orig	2006-08-20 19:47:51.000000000 +0200
+++ ./apps/logfdisp.c	2006-08-25 08:02:16.000000000 +0200
@@ -64,7 +64,7 @@
     if(!lines)
         return false;
 
-    lcd_setmargins(0, 0);
+    lcd_setmargins(0, LCD_WIDTH, 0);
     lcd_clear_display();
     
     do {
--- ./apps/debug_menu.c.orig	2006-08-22 08:03:05.000000000 +0200
+++ ./apps/debug_menu.c	2006-08-25 08:04:33.000000000 +0200
@@ -91,7 +91,7 @@
     unsigned int core;
     int line;
 
-    lcd_setmargins(0, 0);
+    lcd_setmargins(0, LCD_WIDTH, 0);
     lcd_setfont(FONT_SYSFIXED);
     lcd_clear_display();
 
@@ -167,7 +167,7 @@
     char buf[32];
     struct audio_debug d;
 
-    lcd_setmargins(0, 0);
+    lcd_setmargins(0, LCD_WIDTH, 0);
     lcd_setfont(FONT_SYSFIXED);
 
     while(1)
@@ -237,7 +237,7 @@
 
     tick_add_task(dbg_audio_task);
 
-    lcd_setmargins(0, 0);
+    lcd_setmargins(0, LCD_WIDTH, 0);
     lcd_setfont(FONT_SYSFIXED);
     while(!done)
     {
@@ -449,7 +449,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();
 
@@ -513,7 +513,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();
 
@@ -535,7 +535,7 @@
 #elif CONFIG_CPU == PP5020
     char buf[32];
 
-    lcd_setmargins(0, 0);
+    lcd_setmargins(0, 0, 0);
     lcd_setfont(FONT_SYSFIXED);
     lcd_clear_display();
 
@@ -728,7 +728,7 @@
     bool valnogood, symbolerr, parityerr;
     bool done = false;
 
-    lcd_setmargins(0, 0);
+    lcd_setmargins(0, LCD_WIDTH, 0);
     lcd_clear_display();
     lcd_setfont(FONT_SYSFIXED);
 #ifdef HAVE_SPDIF_POWER
@@ -895,7 +895,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)
@@ -952,7 +952,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);
 
@@ -1031,7 +1031,7 @@
     char buf[128];
     int line;
 
-    lcd_setmargins(0, 0);
+    lcd_setmargins(0, LCD_WIDTH, 0);
     lcd_clear_display();
     lcd_setfont(FONT_SYSFIXED);
 
@@ -1178,7 +1178,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();
@@ -1237,7 +1237,7 @@
     unsigned short maxv, minv;
     char buf[32];
 
-    lcd_setmargins(0, 0);
+    lcd_setmargins(0, LCD_WIDTH, 0);
     lcd_setfont(FONT_SYSFIXED);
 
     while(1)
@@ -1508,7 +1508,7 @@
 
     card_name[6] = '\0';
 
-    lcd_setmargins(0, 0);
+    lcd_setmargins(0, LCD_WIDTH, 0);
     lcd_setfont(FONT_SYSFIXED);
 
     while (!done)
@@ -1611,7 +1611,7 @@
     char pio3[2], pio4[2];
 
 #ifdef HAVE_LCD_BITMAP
-    lcd_setmargins(0, 0);
+    lcd_setmargins(0, LCD_WIDTH, 0);
 #endif
 
     while(!done)
@@ -1766,7 +1766,7 @@
     int line;
     char buf[32];
 
-    lcd_setmargins(0, 0);
+    lcd_setmargins(0, LCD_WIDTH, 0);
     lcd_setfont(FONT_SYSFIXED);
 
     while (!done)
@@ -1820,7 +1820,7 @@
     char buf[32];
     struct tagcache_stat *stat;
 
-    lcd_setmargins(0, 0);
+    lcd_setmargins(0, LCD_WIDTH, 0);
     lcd_setfont(FONT_SYSFIXED);
 
     while (!done)
@@ -1935,7 +1935,7 @@
     bool fm_detected;
 
 #ifdef HAVE_LCD_BITMAP
-    lcd_setmargins(0, 0);
+    lcd_setmargins(0, LCD_WIDTH, 0);
 #endif
 
     while(1)
--- ./apps/screen_access.h.orig	2006-07-01 22:47:24.000000000 +0200
+++ ./apps/screen_access.h	2006-08-25 08:02:16.000000000 +0200
@@ -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);
@@ -152,10 +153,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, (screen)->width, (screen)->getymargin());
 
 /*
  * Sets the y margin in pixels for the given screen
@@ -163,7 +164,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(), (screen)->width, ymargin);
 
 #if defined(HAVE_LCD_BITMAP) || defined(HAVE_REMOTE_LCD)
 /*
--- ./apps/sound_menu.c.orig	2006-08-20 19:47:53.000000000 +0200
+++ ./apps/sound_menu.c	2006-08-25 08:02:16.000000000 +0200
@@ -701,7 +701,7 @@
     int exit_request = false;
     enum trigger_menu_option selected = TRIGGER_MODE;
     bool retval = false;
-    int old_x_margin, old_y_margin;
+    int old_left_margin, old_right_margin, old_y_margin;
 
 #define TRIGGER_MODE_COUNT 3
     static const unsigned char *trigger_modes[] = {
@@ -749,12 +749,13 @@
 
     lcd_clear_display();
 
-    old_x_margin = lcd_getxmargin();
+    old_left_margin = lcd_getleftmargin();
+    old_right_margin = lcd_getrightmargin();
     old_y_margin = lcd_getymargin();
     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);
 
     lcd_getstringsize("M", &w, &h);
 
@@ -999,7 +1000,7 @@
 
     peak_meter_trigger(false);
     lcd_setfont(FONT_UI);
-    lcd_setmargins(old_x_margin, old_y_margin);
+    lcd_setmargins(old_left_margin, old_right_margin, old_y_margin);
     return retval;
 }
 #endif
--- ./apps/playlist.c.orig	2006-08-20 19:47:52.000000000 +0200
+++ ./apps/playlist.c	2006-08-25 08:02:16.000000000 +0200
@@ -473,9 +473,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));
@@ -1549,9 +1549,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,
--- ./apps/screens.c.orig	2006-08-21 09:20:11.000000000 +0200
+++ ./apps/screens.c	2006-08-25 08:02:16.000000000 +0200
@@ -521,7 +521,7 @@
     struct option_select left_option;
     struct option_select bottom_option;
     struct option_select right_option;
-    int oldrepeat, old_x_margin, old_y_margin;
+    int oldrepeat, old_left_margin, old_right_margin, old_y_margin;
 
     static const struct opt_items left_items[] = {
         [0]={ STR(LANG_SYSFONT_OFF) },
@@ -545,9 +545,10 @@
     };
     struct gui_quickscreen qs;
 
-    old_x_margin = lcd_getxmargin();
+    old_left_margin = lcd_getleftmargin();
+    old_right_margin = lcd_getrightmargin();
     old_y_margin = lcd_getymargin();
-    lcd_setmargins(0, 0);
+    lcd_setmargins(0, LCD_WIDTH, 0);
 
     option_select_init_items(&left_option,
                              (char *)str(LANG_SYSFONT_SHUFFLE),
@@ -588,7 +589,7 @@
         }
         settings_save();
     }
-    lcd_setmargins(old_x_margin, old_y_margin);
+    lcd_setmargins(old_left_margin, old_right_margin, old_y_margin);
     return(res);
 }
 
@@ -611,7 +612,7 @@
     struct option_select left_option;
     struct option_select bottom_option;
     struct option_select right_option;
-    int old_x_margin, old_y_margin;
+    int old_left_margin, old_right_margin, old_y_margin;
 
     static const struct opt_items onoff_items[] = {
         [0]={ STR(LANG_SYSFONT_OFF) },
@@ -624,9 +625,10 @@
 
     struct gui_quickscreen qs;
 
-    old_x_margin = lcd_getxmargin();
+    old_left_margin = lcd_getrightmargin();
+    old_right_margin = lcd_getleftmargin();
     old_y_margin = lcd_getymargin();
-    lcd_setmargins(0, 0);
+    lcd_setmargins(0, LCD_WIDTH, 0);
 
     option_select_init_items(&left_option,
                              str(LANG_SYSFONT_SCROLL_BAR),
@@ -648,7 +650,7 @@
     res=gui_syncquickscreen_run(&qs, button_enter);
     if(!res)
         settings_save();
-    lcd_setmargins(old_x_margin, old_y_margin);
+    lcd_setmargins(old_left_margin, old_right_margin, old_y_margin);
     return(res);
 }
 #endif /* BUTTON_F3 */
@@ -755,9 +757,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);
--- ./apps/plugin.c.orig	2006-08-20 19:47:53.000000000 +0200
+++ ./apps/plugin.c	2006-08-25 08:02:16.000000000 +0200
@@ -561,9 +561,9 @@
     plugin_loaded = true;
 
 #ifdef HAVE_LCD_BITMAP
-    xm = lcd_getxmargin();
+    xm = lcd_getleftmargin();
     ym = lcd_getymargin();
-    lcd_setmargins(0,0);
+    lcd_setmargins(0, LCD_WIDTH, 0);
 #ifdef HAVE_LCD_COLOR
     old_backdrop = lcd_get_backdrop();
     lcd_set_backdrop(NULL);
@@ -575,9 +575,9 @@
 #endif
 
 #ifdef HAVE_REMOTE_LCD
-    rxm = lcd_remote_getxmargin();
+    rxm = lcd_remote_getleftmargin();
     rym = lcd_remote_getymargin();
-    lcd_remote_setmargins(0, 0);
+    lcd_remote_setmargins(0, LCD_REMOTE_WIDTH, 0);
     lcd_remote_clear_display();
     lcd_remote_update();
 #endif
@@ -601,7 +601,7 @@
     lcd_set_drawmode(DRMODE_SOLID);
 #endif /* LCD_DEPTH */
     /* restore margins */
-    lcd_setmargins(xm,ym);
+    lcd_setmargins(xm, LCD_WIDTH, ym);
 #ifdef HAVE_LCD_COLOR
     lcd_set_backdrop(old_backdrop);
 #endif
@@ -611,7 +611,7 @@
 
 #ifdef HAVE_REMOTE_LCD
     lcd_remote_set_drawmode(DRMODE_SOLID);
-    lcd_remote_setmargins(rxm, rym);
+    lcd_remote_setmargins(rxm, LCD_REMOTE_WIDTH, rym);
     lcd_remote_clear_display();
     lcd_remote_update();
 #endif
--- ./apps/bookmark.c.orig	2006-08-24 09:32:35.000000000 +0200
+++ ./apps/bookmark.c	2006-08-25 08:02:16.000000000 +0200
@@ -442,7 +442,7 @@
         FOR_NB_SCREENS(i)
         {
 #ifdef HAVE_LCD_BITMAP
-            screens[i].setmargins(0, STATUSBAR_HEIGHT);
+            screens[i].setmargins(0, LCD_WIDTH, STATUSBAR_HEIGHT);
             screens[i].puts_scroll(0,0, str(LANG_BOOKMARK_AUTOLOAD_QUERY));
             screens[i].puts(0,1, str(LANG_CONFIRM_WITH_PLAY_RECORDER));
             screens[i].puts(0,2, str(LANG_BOOKMARK_SELECT_LIST_BOOKMARKS));
@@ -564,10 +564,10 @@
 
 #ifdef HAVE_LCD_BITMAP
     int i;
-    int x = lcd_getxmargin();
+    int x = lcd_getleftmargin();
     int y = lcd_getymargin();
     FOR_NB_SCREENS(i)
-        screens[i].setmargins(0, 0);
+        screens[i].setmargins(0, LCD_WIDTH, 0);
 #endif
 
     bookmark_count = get_bookmark_count(bookmark_file_name);
@@ -618,12 +618,12 @@
                 if (global_settings.statusbar)
                 {
                     FOR_NB_SCREENS(i)
-                        screens[i].setmargins(0, STATUSBAR_HEIGHT);
+                        screens[i].setmargins(0, LCD_WIDTH, STATUSBAR_HEIGHT);
                 }
                 else
                 {
                    FOR_NB_SCREENS(i)
-                        screens[i].setmargins(0, 0);
+                        screens[i].setmargins(0, LCD_WIDTH, 0);
                 }
 #endif
                 action_signalscreenchange();
@@ -651,7 +651,7 @@
             case ACTION_BMS_EXIT:
 #ifdef HAVE_LCD_BITMAP
                 FOR_NB_SCREENS(i)
-                    screens[i].setmargins(x, y);
+                    screens[i].setmargins(x, LCD_WIDTH, y);
 #endif
                 action_signalscreenchange();
                 return NULL;
--- ./apps/onplay.c.orig	2006-08-20 19:47:52.000000000 +0200
+++ ./apps/onplay.c	2006-08-25 08:02:16.000000000 +0200
@@ -992,9 +992,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
     }
 
--- ./apps/screen_access.c.orig	2006-07-01 22:47:24.000000000 +0200
+++ ./apps/screen_access.c	2006-08-25 08:02:16.000000000 +0200
@@ -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;
@@ -118,7 +119,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;
--- ./firmware/drivers/lcd-remote-2bit-vi.c.orig	2006-08-24 09:34:13.000000000 +0200
+++ ./firmware/drivers/lcd-remote-2bit-vi.c	2006-08-25 08:02:16.000000000 +0200
@@ -47,7 +47,8 @@
 static unsigned fg_pattern IDATA_ATTR = 0xFFFF; /* initially black */
 static unsigned bg_pattern IDATA_ATTR = 0x0000; /* initially white */
 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;
 
@@ -115,17 +116,23 @@
     lcd_remote_set_background(bg_brightness);
 }
 
-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)
 {
     return ymargin;
@@ -892,7 +899,7 @@
         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;
@@ -976,7 +983,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;
 
@@ -989,7 +996,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
@@ -1006,7 +1013,7 @@
 
         s->len = utf8length((char *)string);
         s->offset = offset;
-        s->startx = xmargin + x * s->width / s->len;;
+        s->startx = leftmargin + x * s->width / s->len;;
         s->backward = false;
         scrolling_lines |= (1<<y);
     }
--- ./firmware/drivers/lcd-recorder.c.orig	2006-08-24 09:34:13.000000000 +0200
+++ ./firmware/drivers/lcd-recorder.c	2006-08-25 08:02:16.000000000 +0200
@@ -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
@@ -360,15 +361,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)
@@ -947,14 +954,17 @@
         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;
     xrect = xpos + MAX(w - offset, 0);
-    lcd_fillrect(xrect, ypos, LCD_WIDTH - xrect, h);
+    lcd_fillrect(xpos + w, ypos, rightmargin - (xpos + w), h);
+    if (LCD_WIDTH>rightmargin) {
+	lcd_fillrect(rightmargin, ypos, LCD_WIDTH - rightmargin, 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 = xmargin + x * s->width / s->len;;
+        s->startx = leftmargin + x * s->width / s->len;
         s->backward = false;
+        s->left_margin=leftmargin;
+        s->right_margin=rightmargin;
         scrolling_lines |= (1<<y);
     }
     else
@@ -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;
                 }
@@ -1127,8 +1139,12 @@
             drawmode = s->invert ?
                        (DRMODE_SOLID|DRMODE_INVERSEVID) : DRMODE_SOLID;
             lcd_putsxyofs(xpos, ypos, s->offset, s->line);
+            if (LCD_WIDTH>s->right_margin) {
+            drawmode ^= DRMODE_INVERSEVID;
+                lcd_fillrect(s->right_margin, ypos, LCD_WIDTH - s->right_margin, pf->height);
+            }
             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);
--- ./firmware/drivers/lcd-h100-remote.c.orig	2006-08-24 09:34:12.000000000 +0200
+++ ./firmware/drivers/lcd-h100-remote.c	2006-08-25 08:03:11.000000000 +0200
@@ -69,7 +69,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;
 
@@ -682,15 +683,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)
@@ -1274,7 +1281,7 @@
         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;
@@ -1358,7 +1365,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;
 
@@ -1371,7 +1378,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
@@ -1388,7 +1395,7 @@
 
         s->len = utf8length((char *)string);
         s->offset = offset;
-        s->startx = xmargin + x * s->width / s->len;;
+        s->startx = leftmargin + x * s->width / s->len;;
         s->backward = false;
         scrolling_lines |= (1<<y);
     }
--- ./firmware/drivers/lcd-16bit.c.orig	2006-08-24 09:34:12.000000000 +0200
+++ ./firmware/drivers/lcd-16bit.c	2006-08-25 08:02:16.000000000 +0200
@@ -51,7 +51,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;
 
@@ -121,15 +122,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)
@@ -786,14 +793,17 @@
         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;
     xrect = xpos + MAX(w - offset, 0);
-    lcd_fillrect(xrect, ypos, LCD_WIDTH - xrect, h);
+    lcd_fillrect(xpos + w, ypos, rightmargin - (xpos + w), h);
+    if (LCD_WIDTH>rightmargin) {
+	lcd_fillrect(rightmargin, ypos, LCD_WIDTH - rightmargin, h);
+    }
     drawmode = lastmode;
 }
 
@@ -870,7 +880,7 @@
 
     lcd_getstringsize(string, &w, &h);
 
-    if (LCD_WIDTH - x * 8 - xmargin < w) {
+    if (rightmargin - x * 8 - leftmargin < w) {
         /* prepare scroll line */
         char *end;
 
@@ -883,7 +893,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
@@ -896,12 +906,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 = xmargin + x * s->width / s->len;
+        s->startx = leftmargin + x * s->width / s->len;
         s->backward = false;
+        s->left_margin=leftmargin;
+        s->right_margin=rightmargin;
         scrolling_lines |= (1<<y);
     }
     else
@@ -948,9 +960,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;
                 }
@@ -965,8 +977,12 @@
             drawmode = s->invert ? 
                        (DRMODE_SOLID|DRMODE_INVERSEVID) : DRMODE_SOLID;
             lcd_putsxyofs(xpos, ypos, s->offset, s->line);
+            if (LCD_WIDTH>s->right_margin) {
+            drawmode ^= DRMODE_INVERSEVID;
+                lcd_fillrect(s->right_margin, ypos, LCD_WIDTH - s->right_margin, pf->height);
+            }
             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);
--- ./firmware/drivers/lcd-h100.c.orig	2006-08-24 09:34:12.000000000 +0200
+++ ./firmware/drivers/lcd-h100.c	2006-08-25 08:02:16.000000000 +0200
@@ -77,7 +77,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;
 
@@ -327,17 +328,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_getleftmargin(void)
+{
+    return leftmargin;
 }
 
-int lcd_getxmargin(void)
+int lcd_getrightmargin(void)
 {
-    return xmargin;
+    return rightmargin;
 }
 
+
 int lcd_getymargin(void)
 {
     return ymargin;
@@ -1110,14 +1119,17 @@
         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;
     xrect = xpos + MAX(w - offset, 0);
-    lcd_fillrect(xrect, ypos, LCD_WIDTH - xrect, h);
+    lcd_fillrect(xpos + w, ypos, rightmargin - (xpos + w), h);
+    if (LCD_WIDTH>rightmargin) {
+	lcd_fillrect(rightmargin, ypos, LCD_WIDTH - rightmargin, h);
+    }
     drawmode = lastmode;
 }
 
@@ -1194,7 +1206,7 @@
 
     lcd_getstringsize(string, &w, &h);
 
-    if (LCD_WIDTH - x * 8 - xmargin < w) {
+    if (rightmargin - x * 8 - leftmargin < w) {
         /* prepare scroll line */
         char *end;
 
@@ -1207,7 +1219,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
@@ -1220,12 +1232,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 = xmargin + x * s->width / s->len;
+        s->startx = leftmargin + x * s->width / s->len;
         s->backward = false;
+        s->left_margin=leftmargin;
+        s->right_margin=rightmargin;
         scrolling_lines |= (1<<y);
     }
     else
@@ -1272,9 +1286,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;
                 }
@@ -1289,8 +1303,12 @@
             drawmode = s->invert ?
                        (DRMODE_SOLID|DRMODE_INVERSEVID) : DRMODE_SOLID;
             lcd_putsxyofs(xpos, ypos, s->offset, s->line);
+            if (LCD_WIDTH>s->right_margin) {
+            drawmode ^= DRMODE_INVERSEVID;
+                lcd_fillrect(s->right_margin, ypos, LCD_WIDTH - s->right_margin, pf->height);
+            }
             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);
--- ./firmware/drivers/lcd-2bit-horz.c.orig	2006-08-24 09:34:12.000000000 +0200
+++ ./firmware/drivers/lcd-2bit-horz.c	2006-08-25 08:02:16.000000000 +0200
@@ -118,15 +118,21 @@
     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)
--- ./firmware/export/lcd-remote.h.orig	2006-07-28 16:29:47.000000000 +0200
+++ ./firmware/export/lcd-remote.h	2006-08-25 08:02:16.000000000 +0200
@@ -117,8 +117,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);
--- ./firmware/export/lcd.h.orig	2006-08-20 19:48:01.000000000 +0200
+++ ./firmware/export/lcd.h	2006-08-25 08:02:16.000000000 +0200
@@ -265,8 +265,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);
@@ -345,6 +346,8 @@
     bool bidir;
     bool invert; /* invert the scrolled text */
     long start_tick;
+    int left_margin;
+    int right_margin;
 };
 #else /* !HAVE_LCD_BITMAP */
 
--- ./firmware/logf.c.orig	2005-06-30 17:14:33.000000000 +0200
+++ ./firmware/logf.c	2006-08-25 08:02:16.000000000 +0200
@@ -52,7 +52,7 @@
     lcd_remote_getstringsize("A", &w, &h);
     lines = LCD_REMOTE_HEIGHT/h;
     columns = LCD_REMOTE_WIDTH/w;
-    lcd_remote_setmargins(0, 0);
+    lcd_remote_setmargins(0, LCD_REMOTE_WIDTH, 0);
     lcd_remote_clear_display();
     
     index = logfindex;
