Index: apps/screen_access.c =================================================================== --- apps/screen_access.c (revision 14928) +++ apps/screen_access.c (working copy) @@ -52,7 +52,8 @@ struct screen screens[NB_SCREENS] = #endif .setmargins=&lcd_setmargins, .getymargin=&lcd_getymargin, - .getxmargin=&lcd_getxmargin, + .getleftmargin=&lcd_getleftmargin, + .getrightmargin=&lcd_getrightmargin, .getstringsize=&lcd_getstringsize, #ifdef HAVE_LCD_BITMAP .setfont=&lcd_setfont, @@ -135,7 +136,8 @@ struct screen screens[NB_SCREENS] = .has_disk_led=false, .setmargins=&lcd_remote_setmargins, .getymargin=&lcd_remote_getymargin, - .getxmargin=&lcd_remote_getxmargin, + .getleftmargin=&lcd_remote_getleftmargin, + .getrightmargin=&lcd_remote_getrightmargin, .getstringsize=&lcd_remote_getstringsize, #if 1 /* all remote LCDs are bitmapped so far */ .setfont=&lcd_remote_setfont, Index: apps/playlist.c =================================================================== --- apps/playlist.c (revision 14928) +++ apps/playlist.c (working copy) @@ -481,9 +481,9 @@ static int add_indices_to_playlist(struc #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, ID2P(LANG_WAIT)); @@ -1679,9 +1679,9 @@ static void display_playlist_count(int c #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, fmt, count, str(LANG_OFF_ABORT)); Index: apps/screens.c =================================================================== --- apps/screens.c (revision 14928) +++ apps/screens.c (working copy) @@ -648,7 +648,7 @@ bool quick_screen_quick(int button_enter 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) }, @@ -671,9 +671,10 @@ bool quick_screen_quick(int button_enter }; 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), @@ -714,7 +715,7 @@ bool quick_screen_quick(int button_enter } settings_save(); } - lcd_setmargins(old_x_margin, old_y_margin); + lcd_setmargins(old_left_margin, old_right_margin, old_y_margin); return(res); } @@ -737,7 +738,7 @@ bool quick_screen_f3(int button_enter) 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) }, @@ -750,9 +751,10 @@ bool quick_screen_f3(int button_enter) 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), @@ -774,7 +776,7 @@ bool quick_screen_f3(int button_enter) 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 */ Index: apps/screen_access.h =================================================================== --- apps/screen_access.h (revision 14928) +++ apps/screen_access.h (working copy) @@ -71,8 +71,9 @@ struct screen #ifdef HAS_BUTTONBAR bool has_buttonbar; #endif - 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); int (*getstringsize)(const unsigned char *str, int *w, int *h); #if defined(HAVE_LCD_BITMAP) || defined(HAVE_REMOTE_LCD) /* always bitmap */ @@ -160,10 +161,10 @@ struct screen /* * 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 @@ -171,7 +172,7 @@ struct screen * - 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) /* Index: apps/recorder/recording.c =================================================================== --- apps/recorder/recording.c (revision 14928) +++ apps/recorder/recording.c (working copy) @@ -940,7 +940,7 @@ bool recording_screen(bool no_source) { screens[i].setfont(FONT_SYSFIXED); screens[i].getstringsize("M", &w, &h); - screens[i].setmargins(global_settings.cursor_style ? 0 : w, 8); + screens[i].setmargins(global_settings.cursor_style ? 0 : w, screens[i].width, 8); filename_offset[i] = ((screens[i].height >= 80) ? 1 : 0); pm_y[i] = 8 + h * (2 + filename_offset[i]); } @@ -1341,7 +1341,7 @@ bool recording_screen(bool no_source) { screens[i].setfont(FONT_SYSFIXED); screens[i].setmargins( - global_settings.cursor_style ? 0 : w, 8); + global_settings.cursor_style ? 0 : w, screens[i].width, 8); } } } Index: apps/plugins/solitaire.c =================================================================== --- apps/plugins/solitaire.c (revision 14928) +++ apps/plugins/solitaire.c (working copy) @@ -659,7 +659,7 @@ int solitaire_menu(bool in_game) break; case 3: - rb->lcd_setmargins(0, 0); + rb->lcd_setmargins(0, LCD_WIDTH, 0); if (solitaire_help() == HELP_USB) result = MENU_USB; break; @@ -681,7 +681,7 @@ int solitaire_menu(bool in_game) } } menu_exit(m); - rb->lcd_setmargins(0, 0); + rb->lcd_setmargins(0, LCD_WIDTH, 0); return result; } Index: apps/plugins/viewer.c =================================================================== --- apps/plugins/viewer.c (revision 14928) +++ apps/plugins/viewer.c (working copy) @@ -1306,7 +1306,7 @@ static bool viewer_options_menu(void) result = menu_run(m); menu_exit(m); #ifdef HAVE_LCD_BITMAP - rb->lcd_setmargins(0,0); + rb->lcd_setmargins(0,LCD_WIDTH,0); /* Show-scrollbar mode for current view-width mode */ if (!ONE_SCREEN_FITS_ALL()) @@ -1347,7 +1347,7 @@ static void viewer_menu(void) } menu_exit(m); #ifdef HAVE_LCD_BITMAP - rb->lcd_setmargins(0,0); + rb->lcd_setmargins(0,LCD_WIDTH,0); #endif viewer_draw(col); } Index: apps/gui/gwps-common.c =================================================================== --- apps/gui/gwps-common.c (revision 14928) +++ apps/gui/gwps-common.c (working copy) @@ -21,6 +21,7 @@ #include #include #include +#include #include "system.h" #include "settings.h" #include "rbunicode.h" @@ -1338,6 +1339,14 @@ static char *get_token_value(struct gui_ return NULL; #endif + case WPS_TOKEN_ALIGN_SCROLLMARGIN_LEFT: + gwps->display->setmargins( token->value.i, gwps->display->getrightmargin(), gwps->display->getymargin() ); + return NULL; + + case WPS_TOKEN_ALIGN_SCROLLMARGIN_RIGHT: + gwps->display->setmargins( gwps->display->getleftmargin(), token->value.i, gwps->display->getymargin() ); + return NULL; + default: return NULL; } @@ -1435,6 +1444,7 @@ static bool get_line(struct gui_wps *gwp align->center = NULL; align->right = NULL; + gwps->display->setmargins(0, gwps->display->width, gwps->display->getymargin()); /* reset xpos */ /* Process all tokens of the desired subline */ last_token_idx = wps_last_token_index(data, line, subline); for (i = wps_first_token_index(data, line, subline); @@ -1658,12 +1668,13 @@ static void write_line(struct screen *di bool scroll) { - int left_width = 0; /* left_xpos would always be 0 */ + int left_width = 0, left_xpos; /* left_xpos is still needed for scroll-margins */ int center_width = 0, center_xpos; int right_width = 0, right_xpos; int ypos; int space_width; int string_height; + const int scroll_width = display->getrightmargin()-display->getleftmargin(); /* calculate different string sizes and positions */ display->getstringsize((unsigned char *)" ", &space_width, &string_height); @@ -1671,20 +1682,19 @@ static void write_line(struct screen *di display->getstringsize((unsigned char *)format_align->left, &left_width, &string_height); } + left_xpos = display->getleftmargin(); if (format_align->center != 0) { display->getstringsize((unsigned char *)format_align->center, ¢er_width, &string_height); } - - center_xpos=(display->width - center_width) / 2; + center_xpos=(display->getrightmargin() + display->getleftmargin() - center_width)/2; if (format_align->right != 0) { display->getstringsize((unsigned char *)format_align->right, &right_width, &string_height); } - - 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 @@ -1693,7 +1703,7 @@ static void write_line(struct screen *di /* CASE 1: left and centered string overlap */ /* there is a left string, need to merge left and center */ if ((left_width != 0 && center_width != 0) && - (left_width + space_width > center_xpos)) { + (left_xpos + left_width + space_width > center_xpos)) { /* replace the former separator '\0' of left and center string with a space */ *(--format_align->center) = ' '; @@ -1704,7 +1714,7 @@ static void write_line(struct screen *di } /* there is no left string, move center to left */ if ((left_width == 0 && center_width != 0) && - (left_width > center_xpos)) { + (left_xpos + left_width > center_xpos)) { /* move the center string to the left string */ format_align->left = format_align->center; /* calculate the new width and position of the string */ @@ -1724,7 +1734,7 @@ static void write_line(struct screen *di format_align->right = format_align->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; } @@ -1735,7 +1745,7 @@ static void write_line(struct screen *di format_align->right = format_align->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; } @@ -1745,7 +1755,7 @@ static void write_line(struct screen *di was one or it has been merged in case 1 or 2 */ /* there is a left string, need to merge left and right */ if ((left_width != 0 && center_width == 0 && right_width != 0) && - (left_width + space_width > right_xpos)) { + (left_xpos + left_width + space_width > right_xpos)) { /* replace the former separator '\0' of left and right string with a space */ *(--format_align->right) = ' '; @@ -1756,7 +1766,7 @@ static void write_line(struct screen *di } /* there is no left string, move right to left */ if ((left_width == 0 && center_width == 0 && right_width != 0) && - (left_width > right_xpos)) { + (left_xpos + left_width > right_xpos)) { /* move the right string to the left string */ format_align->left = format_align->right; /* calculate the new width and position of the string */ @@ -1768,7 +1778,7 @@ static void write_line(struct screen *di ypos = (line * string_height) + display->getymargin(); - if (scroll && left_width > display->width) + if (scroll && ( left_width > scroll_width || center_width > scroll_width || right_width > scroll_width ) ) { display->puts_scroll(0, line, (unsigned char *)format_align->left); @@ -1789,7 +1799,7 @@ static void write_line(struct screen *di /* print aligned strings */ if (left_width != 0) { - display->putsxy(0, ypos, + display->putsxy(left_xpos, ypos, (unsigned char *)format_align->left); } if (center_width != 0) Index: apps/gui/list.c =================================================================== --- apps/gui/list.c (revision 14928) +++ apps/gui/list.c (working copy) @@ -143,7 +143,7 @@ static void gui_list_flash(struct gui_li int line_ypos=display->getymargin()+display->char_height*selected_line; if (global_settings.cursor_style) { - 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); @@ -215,7 +215,7 @@ static void gui_list_draw_smart(struct g static int last_lines[NB_SCREENS] = {0}; #ifdef HAVE_LCD_BITMAP int item_offset; - int old_margin = display->getxmargin(); + int old_margin = display->getleftmargin(); #endif int start, end; bool partial_draw = false; Index: apps/gui/gwps.c =================================================================== --- apps/gui/gwps.c (revision 14928) +++ apps/gui/gwps.c (working copy) @@ -84,11 +84,10 @@ static void gui_wps_set_margin(struct gu { 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 Index: apps/gui/gwps.h =================================================================== --- apps/gui/gwps.h (revision 14928) +++ apps/gui/gwps.h (working copy) @@ -107,6 +107,8 @@ enum wps_token_type { WPS_TOKEN_ALIGN_LEFT, WPS_TOKEN_ALIGN_CENTER, WPS_TOKEN_ALIGN_RIGHT, + WPS_TOKEN_ALIGN_SCROLLMARGIN_LEFT, + WPS_TOKEN_ALIGN_SCROLLMARGIN_RIGHT, /* Sublines */ WPS_TOKEN_SUBLINE_TIMEOUT, Index: apps/gui/wps_parser.c =================================================================== --- apps/gui/wps_parser.c (revision 14928) +++ apps/gui/wps_parser.c (working copy) @@ -113,6 +113,8 @@ static int parse_progressbar(const char struct wps_token *token, struct wps_data *wps_data); static int parse_dir_level(const char *wps_bufptr, struct wps_token *token, struct wps_data *wps_data); +static int parse_scrollmargins(const char *wps_bufptr, + struct wps_token *token, struct wps_data *wps_data); #ifdef HAVE_LCD_BITMAP static int parse_image_special(const char *wps_bufptr, struct wps_token *token, struct wps_data *wps_data); @@ -286,6 +288,7 @@ static const struct wps_tag all_tags[] = #if (LCD_DEPTH > 1) || (defined(HAVE_LCD_REMOTE) && (LCD_REMOTE_DEPTH > 1)) { WPS_TOKEN_IMAGE_BACKDROP, "X", 0, parse_image_special }, #endif + { WPS_NO_TOKEN, "m", 0, parse_scrollmargins }, #endif { WPS_TOKEN_UNKNOWN, "", 0, NULL } @@ -606,6 +609,33 @@ static int parse_progressbar(const char #endif } +static int parse_scrollmargins(const char *wps_bufptr, struct wps_token *token, struct wps_data *wps_data) +{ + /* valid tag looks like %m|12|34| */ + if(*wps_bufptr == '|') + { + const char * _pleft = wps_bufptr + 1; + const char * _pright = NULL, * _pend = NULL; + if( isdigit(*_pleft) && ( _pright = strchr( _pleft, '|' ) ) ) + { + _pright++; + if( isdigit(*_pright) && ( _pend = strchr( _pright, '|' ) ) ) + { + wps_data->num_tokens += 2; + token->type = WPS_TOKEN_ALIGN_SCROLLMARGIN_LEFT; + token->value.i = atoi(_pleft); + token++; + token->type = WPS_TOKEN_ALIGN_SCROLLMARGIN_RIGHT; + token->value.i = atoi(_pright); + + return( _pend - wps_bufptr + 1 ); + } + } + } + + return(0); +} + /* Parse a generic token from the given string. Return the length read */ static int parse_token(const char *wps_bufptr, struct wps_data *wps_data) { Index: apps/menus/recording_menu.c =================================================================== --- apps/menus/recording_menu.c (revision 14928) +++ apps/menus/recording_menu.c (working copy) @@ -431,7 +431,7 @@ bool rectrigger(void) int exit_request = false; enum trigger_menu_option selected = TRIGGER_MODE; bool retval = false; - int old_x_margin[NB_SCREENS]; + int old_left_margin[NB_SCREENS], old_right_margin[NB_SCREENS]; int old_y_margin[NB_SCREENS]; #define TRIGGER_MODE_COUNT 3 @@ -503,12 +503,13 @@ bool rectrigger(void) { screens[i].clear_display(); - old_x_margin[i] = screens[i].getxmargin(); + old_left_margin[i] = screens[i].getleftmargin(); + old_right_margin[i] = screens[i].getrightmargin(); old_y_margin[i] = screens[i].getymargin(); if(global_settings.statusbar) - screens[i].setmargins(0, STATUSBAR_HEIGHT); + screens[i].setmargins(0, screens[i].width, STATUSBAR_HEIGHT); else - screens[i].setmargins(0, 0); + screens[i].setmargins(0, screens[i].width, 0); screens[i].getstringsize("M", &w, &h); @@ -789,7 +790,7 @@ bool rectrigger(void) FOR_NB_SCREENS(i) { screens[i].setfont(FONT_UI); - screens[i].setmargins(old_x_margin[i], old_y_margin[i]); + screens[i].setmargins(old_left_margin[i], old_right_margin[i], old_y_margin[i]); } return retval; } Index: apps/menus/main_menu.c =================================================================== --- apps/menus/main_menu.c (revision 14928) +++ apps/menus/main_menu.c (working copy) @@ -155,7 +155,7 @@ static bool show_info(void) }; #if defined(HAVE_LCD_BITMAP) FOR_NB_SCREENS(i) - screens[i].setmargins(0, 0); + screens[i].setmargins(0, screens[i].width, 0); #endif while (!done) { Index: apps/alarm_menu.c =================================================================== --- apps/alarm_menu.c (revision 14928) +++ apps/alarm_menu.c (working copy) @@ -70,7 +70,7 @@ bool alarm_screen(void) { FOR_NB_SCREENS(i) { - screens[i].setmargins(0, 0); + screens[i].setmargins(0, screens[i].width, 0); gui_textarea_clear(&screens[i]); screens[i].puts(0, 3, str(LANG_ALARM_MOD_KEYS)); } Index: apps/plugin.c =================================================================== --- apps/plugin.c (revision 14928) +++ apps/plugin.c (working copy) @@ -526,9 +526,9 @@ int plugin_load(const char* plugin, void int fd; ssize_t readsize; #endif - int xm, ym; + int leftm, rightm, ym; #ifdef HAVE_REMOTE_LCD - int rxm, rym; + int rleftm, rrightm, rym; #endif #if LCD_DEPTH > 1 @@ -606,9 +606,10 @@ int plugin_load(const char* plugin, void plugin_loaded = true; - xm = lcd_getxmargin(); + leftm = lcd_getleftmargin(); + rightm = lcd_getrightmargin(); ym = lcd_getymargin(); - lcd_setmargins(0,0); + lcd_setmargins(0,LCD_WIDTH,0); #if defined HAVE_LCD_BITMAP && LCD_DEPTH > 1 old_backdrop = lcd_get_backdrop(); @@ -617,9 +618,10 @@ int plugin_load(const char* plugin, void lcd_update(); #ifdef HAVE_REMOTE_LCD - rxm = lcd_remote_getxmargin(); + rleftm = lcd_remote_getleftmargin(); + rrightm = lcd_remote_getrightmargin(); 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 @@ -646,7 +648,7 @@ int plugin_load(const char* plugin, void #endif /* HAVE_LCD_BITMAP */ /* restore margins */ - lcd_setmargins(xm,ym); + lcd_setmargins(leftm, rightm, ym); lcd_clear_display(); lcd_update(); @@ -657,7 +659,7 @@ int plugin_load(const char* plugin, void #else lcd_remote_set_drawmode(DRMODE_SOLID); #endif - lcd_remote_setmargins(rxm, rym); + lcd_remote_setmargins(rleftm, rrightm, rym); lcd_remote_clear_display(); lcd_remote_update(); #endif Index: apps/plugin.h =================================================================== --- apps/plugin.h (revision 14928) +++ apps/plugin.h (working copy) @@ -138,7 +138,7 @@ struct plugin_api { void (*lcd_set_contrast)(int x); void (*lcd_update)(void); void (*lcd_clear_display)(void); - void (*lcd_setmargins)(int x, int y); + void (*lcd_setmargins)(int leftmargin, int rightmargin, int ymargin); int (*lcd_getstringsize)(const unsigned char *str, int *w, int *h); void (*lcd_putsxy)(int x, int y, const unsigned char *string); void (*lcd_puts)(int x, int y, const unsigned char *string); Index: apps/logfdisp.c =================================================================== --- apps/logfdisp.c (revision 14928) +++ apps/logfdisp.c (working copy) @@ -65,7 +65,7 @@ bool logfdisplay(void) if(!lines) return false; - lcd_setmargins(0, 0); + lcd_setmargins(0, LCD_WIDTH, 0); lcd_clear_display(); do { Index: apps/debug_menu.c =================================================================== --- apps/debug_menu.c (revision 14928) +++ apps/debug_menu.c (working copy) @@ -278,7 +278,7 @@ static bool dbg_audio_thread(void) char buf[32]; struct audio_debug d; - lcd_setmargins(0, 0); + lcd_setmargins(0, LCD_WIDTH, 0); lcd_setfont(FONT_SYSFIXED); while(1) @@ -350,7 +350,7 @@ static bool dbg_audio_thread(void) tick_add_task(dbg_audio_task); - lcd_setmargins(0, 0); + lcd_setmargins(0, LCD_WIDTH, 0); lcd_setfont(FONT_SYSFIXED); while(!done) { @@ -541,7 +541,7 @@ static bool dbg_hw_info(void) 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(); @@ -592,7 +592,7 @@ static bool dbg_hw_info(void) 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(); @@ -643,7 +643,7 @@ static bool dbg_hw_info(void) (PP_VER1 >> 24) & 0xff, (PP_VER1 >> 16) & 0xff, (PP_VER1 >> 8) & 0xff, (PP_VER1) & 0xff, '\0' }; - lcd_setmargins(0, 0); + lcd_setmargins(0, LCD_WIDTH, 0); lcd_setfont(FONT_SYSFIXED); lcd_clear_display(); @@ -833,7 +833,7 @@ static bool dbg_spdif(void) int spdif_source = spdif_get_output_source(&spdif_src_on); spdif_set_output_source(AUDIO_SRC_SPDIF IF_SPDIF_POWER_(, true)); - lcd_setmargins(0, 0); + lcd_setmargins(0, LCD_WIDTH, 0); lcd_clear_display(); lcd_setfont(FONT_SYSFIXED); @@ -1038,7 +1038,7 @@ bool dbg_ports(void) int adc_battery_voltage, adc_battery_level; lcd_setfont(FONT_SYSFIXED); - lcd_setmargins(0, 0); + lcd_setmargins(0, LCD_WIDTH, 0); lcd_clear_display(); while(1) @@ -1084,7 +1084,7 @@ bool dbg_ports(void) char buf[128]; int line; - lcd_setmargins(0, 0); + lcd_setmargins(0, LCD_WIDTH, 0); lcd_clear_display(); lcd_setfont(FONT_SYSFIXED); @@ -1164,7 +1164,7 @@ bool dbg_ports(void) char buf[128]; int line; - lcd_setmargins(0, 0); + lcd_setmargins(0, LCD_WIDTH, 0); lcd_clear_display(); lcd_setfont(FONT_SYSFIXED); @@ -1263,7 +1263,7 @@ bool dbg_ports(void) char buf[128]; int line; - lcd_setmargins(0, 0); + lcd_setmargins(0, LCD_WIDTH, 0); lcd_clear_display(); lcd_setfont(FONT_SYSFIXED); @@ -1305,7 +1305,7 @@ bool dbg_ports(void) char buf[50]; int line; - lcd_setmargins(0, 0); + lcd_setmargins(0, LCD_WIDTH, 0); lcd_clear_display(); lcd_setfont(FONT_SYSFIXED); @@ -1446,7 +1446,7 @@ static bool dbg_cpufreq(void) int button; #ifdef HAVE_LCD_BITMAP - lcd_setmargins(0, 0); + lcd_setmargins(0, LCD_WIDTH, 0); lcd_setfont(FONT_SYSFIXED); #endif lcd_clear_display(); @@ -1507,7 +1507,7 @@ static bool view_battery(void) unsigned short maxv, minv; char buf[32]; - lcd_setmargins(0, 0); + lcd_setmargins(0, LCD_WIDTH, 0); lcd_setfont(FONT_SYSFIXED); while(1) @@ -2132,7 +2132,7 @@ extern volatile bool lcd_poweroff; static bool dbg_lcd_power_off(void) { - lcd_setmargins(0, 0); + lcd_setmargins(0, LCD_WIDTH, 0); while(1) { @@ -2215,7 +2215,7 @@ static bool cpu_boost_log(void) int lines = LCD_HEIGHT/SYSFONT_HEIGHT; char *str; bool done; - lcd_setmargins(0, 0); + lcd_setmargins(0, LCD_WIDTH, 0); lcd_setfont(FONT_SYSFIXED); str = cpu_boost_log_getlog_first(); while (i < count) Index: firmware/export/scroll_engine.h =================================================================== --- firmware/export/scroll_engine.h (revision 14928) +++ firmware/export/scroll_engine.h (working copy) @@ -52,6 +52,8 @@ struct scrollinfo bool backward; /* scroll presently forward or backward? */ bool bidir; long start_tick; + int left_margin; + int right_margin; }; struct scroll_screen_info Index: firmware/export/lcd.h =================================================================== --- firmware/export/lcd.h (revision 14928) +++ firmware/export/lcd.h (working copy) @@ -65,8 +65,9 @@ extern void lcd_init_device(void); extern void lcd_backlight(bool on); extern int lcd_default_contrast(void); extern void lcd_set_contrast(int val); -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 int lcd_getstringsize(const unsigned char *str, int *w, int *h); Index: firmware/export/lcd-remote.h =================================================================== --- firmware/export/lcd-remote.h (revision 14928) +++ firmware/export/lcd-remote.h (working copy) @@ -138,8 +138,9 @@ extern void lcd_remote_set_flip(bool yes 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/logf.c =================================================================== --- firmware/logf.c (revision 14928) +++ firmware/logf.c (working copy) @@ -54,7 +54,7 @@ static void displayremote(void) 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; Index: firmware/drivers/lcd-1bit-vert.c =================================================================== --- firmware/drivers/lcd-1bit-vert.c (revision 14928) +++ firmware/drivers/lcd-1bit-vert.c (working copy) @@ -36,7 +36,8 @@ unsigned char lcd_framebuffer[LCD_FBHEIGHT][LCD_FBWIDTH]; 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; @@ -61,15 +62,21 @@ int lcd_get_drawmode(void) 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) @@ -470,7 +477,7 @@ void lcd_bitmap_part(const unsigned char lcd_blockfunc_type *bfunc; /* nothing to draw? */ - if ((width <= 0) || (height <= 0) || (x >= LCD_WIDTH) || (y >= LCD_HEIGHT) + if ((width <= 0) || (height <= 0) || (x >= rightmargin) || (y >= LCD_HEIGHT) || (x + width <= 0) || (y + height <= 0)) return; @@ -487,8 +494,8 @@ void lcd_bitmap_part(const unsigned char src_y -= y; y = 0; } - if (x + width > LCD_WIDTH) - width = LCD_WIDTH - x; + if (x + width > rightmargin) + width = rightmargin - x; if (y + height > LCD_HEIGHT) height = LCD_HEIGHT - y; @@ -586,7 +593,7 @@ static void lcd_putsxyofs(int x, int y, ucs = bidi_l2v(str, 1); - while ((ch = *ucs++) != 0 && x < LCD_WIDTH) + while ((ch = *ucs++) != 0 && x < rightmargin) { int width; const unsigned char *bits; @@ -648,14 +655,17 @@ void lcd_puts_style_offset(int x, int y, 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; } @@ -697,7 +707,7 @@ void lcd_puts_scroll_style_offset(int x, lcd_getstringsize(string, &w, &h); - if (LCD_WIDTH - x * 8 - xmargin < w) { + if (rightmargin - x * 8 - leftmargin < w) { /* prepare scroll line */ char *end; @@ -710,7 +720,7 @@ void lcd_puts_scroll_style_offset(int x, /* scroll bidirectional or forward only depending on the string width */ if ( lcd_scroll_info.bidir_limit ) { - s->bidir = s->width < (LCD_WIDTH - xmargin) * + s->bidir = s->width < (rightmargin - leftmargin) * (100 + lcd_scroll_info.bidir_limit) / 100; } else @@ -723,12 +733,14 @@ void lcd_puts_scroll_style_offset(int x, } 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; lcd_scroll_info.lines |= (1<backward = false; s->start_tick = current_tick + lcd_scroll_info.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 + lcd_scroll_info.delay * 2; } @@ -788,7 +800,11 @@ void lcd_scroll_fn(void) 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); } } Index: firmware/drivers/lcd-2bit-vert.c =================================================================== --- firmware/drivers/lcd-2bit-vert.c (revision 14928) +++ firmware/drivers/lcd-2bit-vert.c (working copy) @@ -51,7 +51,8 @@ static long lcd_backdrop_offset IDATA_AT 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; @@ -103,17 +104,25 @@ void lcd_set_drawinfo(int mode, unsigned 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; @@ -807,7 +816,7 @@ void lcd_bitmap_part(const fb_data *src, unsigned mask, mask_bottom; /* nothing to draw? */ - if ((width <= 0) || (height <= 0) || (x >= LCD_WIDTH) || (y >= LCD_HEIGHT) + if ((width <= 0) || (height <= 0) || (x >= rightmargin) || (y >= LCD_HEIGHT) || (x + width <= 0) || (y + height <= 0)) return; @@ -824,8 +833,8 @@ void lcd_bitmap_part(const fb_data *src, src_y -= y; y = 0; } - if (x + width > LCD_WIDTH) - width = LCD_WIDTH - x; + if (x + width > rightmargin) + width = rightmargin - x; if (y + height > LCD_HEIGHT) height = LCD_HEIGHT - y; @@ -920,7 +929,7 @@ static void lcd_putsxyofs(int x, int y, ucs = bidi_l2v(str, 1); - while ((ch = *ucs++) != 0 && x < LCD_WIDTH) + while ((ch = *ucs++) != 0 && x < rightmargin) { int width; const unsigned char *bits; @@ -983,14 +992,17 @@ void lcd_puts_style_offset(int x, int y, 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; } @@ -1032,7 +1044,7 @@ void lcd_puts_scroll_style_offset(int x, 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 +1057,7 @@ void lcd_puts_scroll_style_offset(int x, /* scroll bidirectional or forward only depending on the string width */ if ( lcd_scroll_info.bidir_limit ) { - s->bidir = s->width < (LCD_WIDTH - xmargin) * + s->bidir = s->width < (rightmargin - leftmargin) * (100 + lcd_scroll_info.bidir_limit) / 100; } else @@ -1058,12 +1070,14 @@ void lcd_puts_scroll_style_offset(int x, } 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; lcd_scroll_info.lines |= (1<backward = false; s->start_tick = current_tick + lcd_scroll_info.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 + lcd_scroll_info.delay * 2; } @@ -1123,7 +1137,11 @@ void lcd_scroll_fn(void) 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); } } Index: firmware/drivers/lcd-2bit-horz.c =================================================================== --- firmware/drivers/lcd-2bit-horz.c (revision 14928) +++ firmware/drivers/lcd-2bit-horz.c (working copy) @@ -49,7 +49,8 @@ static long lcd_backdrop_offset IDATA_AT 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; @@ -101,15 +102,21 @@ void lcd_set_drawinfo(int mode, unsigned 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) @@ -704,7 +711,7 @@ void lcd_bitmap_part(const unsigned char unsigned mask, mask_right; /* nothing to draw? */ - if ((width <= 0) || (height <= 0) || (x >= LCD_WIDTH) || (y >= LCD_HEIGHT) + if ((width <= 0) || (height <= 0) || (x >= rightmargin) || (y >= LCD_HEIGHT) || (x + width <= 0) || (y + height <= 0)) return; @@ -721,8 +728,8 @@ void lcd_bitmap_part(const unsigned char src_y -= y; y = 0; } - if (x + width > LCD_WIDTH) - width = LCD_WIDTH - x; + if (x + width > rightmargin) + width = rightmargin - x; if (y + height > LCD_HEIGHT) height = LCD_HEIGHT - y; @@ -785,7 +792,7 @@ static void lcd_putsxyofs(int x, int y, ucs = bidi_l2v(str, 1); - while ((ch = *ucs++) != 0 && x < LCD_WIDTH) + while ((ch = *ucs++) != 0 && x < rightmargin) { int width; const unsigned char *bits; @@ -848,7 +855,7 @@ void lcd_puts_style_offset(int x, int y, 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; @@ -896,7 +903,7 @@ void lcd_puts_scroll_style_offset(int x, lcd_getstringsize(string, &w, &h); - if (LCD_WIDTH - x * 8 - xmargin < w) { + if (LCD_WIDTH - x * 8 - leftmargin < w) { /* prepare scroll line */ char *end; @@ -909,7 +916,7 @@ void lcd_puts_scroll_style_offset(int x, /* scroll bidirectional or forward only depending on the string width */ if ( lcd_scroll_info.bidir_limit ) { - s->bidir = s->width < (LCD_WIDTH - xmargin) * + s->bidir = s->width < (LCD_WIDTH - leftmargin) * (100 + lcd_scroll_info.bidir_limit) / 100; } else @@ -926,7 +933,7 @@ void lcd_puts_scroll_style_offset(int x, 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; lcd_scroll_info.lines |= (1<= LCD_REMOTE_WIDTH) + if ((width <= 0) || (height <= 0) || (x >= rightmargin) || (y >= LCD_REMOTE_HEIGHT) || (x + width <= 0) || (y + height <= 0)) return; @@ -670,8 +677,8 @@ void lcd_remote_mono_bitmap_part(const u src_y -= y; y = 0; } - if (x + width > LCD_REMOTE_WIDTH) - width = LCD_REMOTE_WIDTH - x; + if (x + width > rightmargin) + width = rightmargin - x; if (y + height > LCD_REMOTE_HEIGHT) height = LCD_REMOTE_HEIGHT - y; @@ -921,7 +928,7 @@ void lcd_remote_putsxyofs(int x, int y, ucs = bidi_l2v(str, 1); - while ((ch = *ucs++) != 0 && x < LCD_REMOTE_WIDTH) + while ((ch = *ucs++) != 0 && x < rightmargin) { int width; const unsigned char *bits; @@ -984,7 +991,7 @@ void lcd_remote_puts_style_offset(int x, 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; @@ -1032,7 +1039,7 @@ void lcd_remote_puts_scroll_style_offset 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; @@ -1045,7 +1052,7 @@ void lcd_remote_puts_scroll_style_offset /* scroll bidirectional or forward only depending on the string width */ if ( lcd_remote_scroll_info.bidir_limit ) { - s->bidir = s->width < (LCD_REMOTE_WIDTH - xmargin) * + s->bidir = s->width < (LCD_REMOTE_WIDTH - leftmargin) * (100 + lcd_remote_scroll_info.bidir_limit) / 100; } else @@ -1062,7 +1069,7 @@ void lcd_remote_puts_scroll_style_offset 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; lcd_remote_scroll_info.lines |= (1<= LCD_WIDTH) || (y >= LCD_HEIGHT) + if ((width <= 0) || (height <= 0) || (x >= rightmargin) || (y >= LCD_HEIGHT) || (x + width <= 0) || (y + height <= 0)) return; @@ -592,8 +599,8 @@ void lcd_mono_bitmap_part(const unsigned src_y -= y; y = 0; } - if (x + width > LCD_WIDTH) - width = LCD_WIDTH - x; + if (x + width > rightmargin) + width = rightmargin - x; if (y + height > LCD_HEIGHT) height = LCD_HEIGHT - y; @@ -784,7 +791,7 @@ static void lcd_putsxyofs(int x, int y, ucs = bidi_l2v(str, 1); - while ((ch = *ucs++) != 0 && x < LCD_WIDTH) + while ((ch = *ucs++) != 0 && x < rightmargin) { int width; const unsigned char *bits; @@ -848,7 +855,7 @@ void lcd_puts_style_offset(int x, int y, 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; @@ -873,7 +880,10 @@ void lcd_puts_style_offset(int x, int y, fg_pattern = lst_pattern; } else { - 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 = (style & STYLE_INVERT) ? (DRMODE_SOLID|DRMODE_INVERSEVID) : DRMODE_SOLID; } @@ -915,7 +925,7 @@ void lcd_puts_scroll_style_offset(int x, lcd_getstringsize(string, &w, &h); - if (LCD_WIDTH - x * 8 - xmargin < w) { + if (rightmargin - x * 8 - leftmargin < w) { /* prepare scroll line */ char *end; @@ -928,7 +938,7 @@ void lcd_puts_scroll_style_offset(int x, /* scroll bidirectional or forward only depending on the string width */ if ( lcd_scroll_info.bidir_limit ) { - s->bidir = s->width < (LCD_WIDTH - xmargin) * + s->bidir = s->width < (rightmargin - leftmargin) * (100 + lcd_scroll_info.bidir_limit) / 100; } else @@ -941,12 +951,14 @@ void lcd_puts_scroll_style_offset(int x, } 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; lcd_scroll_info.lines |= (1<backward = false; s->start_tick = current_tick + lcd_scroll_info.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 + lcd_scroll_info.delay * 2; } @@ -1038,8 +1050,12 @@ void lcd_scroll_fn(void) break; } 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); } fg_pattern = old_fgcolor; Index: firmware/drivers/lcd-remote-1bit-v.c =================================================================== --- firmware/drivers/lcd-remote-1bit-v.c (revision 14928) +++ firmware/drivers/lcd-remote-1bit-v.c (working copy) @@ -39,7 +39,8 @@ fb_remote_data lcd_remote_framebuffer[LC IBSS_ATTR; 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; @@ -55,15 +56,21 @@ int lcd_remote_get_drawmode(void) 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) @@ -466,7 +473,7 @@ void lcd_remote_bitmap_part(const unsign lcd_remote_blockfunc_type *bfunc; /* nothing to draw? */ - if ((width <= 0) || (height <= 0) || (x >= LCD_REMOTE_WIDTH) + if ((width <= 0) || (height <= 0) || (x >= rightmargin) || (y >= LCD_REMOTE_HEIGHT) || (x + width <= 0) || (y + height <= 0)) return; @@ -483,8 +490,8 @@ void lcd_remote_bitmap_part(const unsign src_y -= y; y = 0; } - if (x + width > LCD_REMOTE_WIDTH) - width = LCD_REMOTE_WIDTH - x; + if (x + width > rightmargin) + width = rightmargin - x; if (y + height > LCD_REMOTE_HEIGHT) height = LCD_REMOTE_HEIGHT - y; @@ -583,7 +590,7 @@ void lcd_remote_putsxyofs(int x, int y, ucs = bidi_l2v(str, 1); - while ((ch = *ucs++) != 0 && x < LCD_REMOTE_WIDTH) + while ((ch = *ucs++) != 0 && x < rightmargin) { int width; const unsigned char *bits; @@ -636,7 +643,7 @@ void lcd_remote_puts_offset(int x, int y void lcd_remote_puts_style_offset(int x, int y, const unsigned char *str, int style, int offset) { - int xpos,ypos,w,h,xrect; + int xpos,ypos,w,h; int lastmode = drawmode; /* make sure scrolling is turned off on the line we are updating */ @@ -646,14 +653,16 @@ void lcd_remote_puts_style_offset(int x, 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; - xrect = xpos + MAX(w - offset, 0); - lcd_remote_fillrect(xrect, ypos, LCD_REMOTE_WIDTH - xrect, h); + lcd_remote_fillrect(xpos + w, ypos, rightmargin - (xpos + w), h); + if (LCD_REMOTE_WIDTH>rightmargin) { + lcd_remote_fillrect(rightmargin, ypos, LCD_WIDTH - rightmargin, h); + } drawmode = lastmode; } @@ -695,7 +704,7 @@ void lcd_remote_puts_scroll_style_offset lcd_remote_getstringsize(string, &w, &h); - if (LCD_REMOTE_WIDTH - x * 8 - xmargin < w) { + if (rightmargin - x * 8 - leftmargin < w) { /* prepare scroll line */ char *end; @@ -708,7 +717,7 @@ void lcd_remote_puts_scroll_style_offset /* scroll bidirectional or forward only depending on the string width */ if ( lcd_remote_scroll_info.bidir_limit ) { - s->bidir = s->width < (LCD_REMOTE_WIDTH - xmargin) * + s->bidir = s->width < (rightmargin - leftmargin) * (100 + lcd_remote_scroll_info.bidir_limit) / 100; } else @@ -721,12 +730,14 @@ void lcd_remote_puts_scroll_style_offset } end = strchr(s->line, '\0'); - strncpy(end, (char *)string, LCD_REMOTE_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; lcd_remote_scroll_info.lines |= (1<backward = false; s->start_tick = current_tick + lcd_remote_scroll_info.delay*2; } - if (s->offset >= s->width - (LCD_REMOTE_WIDTH - xpos)) { + if (s->offset >= s->width - (s->right_margin - xpos)) { /* at end of line */ - s->offset = s->width - (LCD_REMOTE_WIDTH - xpos); + s->offset = s->width - (s->right_margin - xpos); s->backward = true; s->start_tick = current_tick + lcd_remote_scroll_info.delay*2; } @@ -786,8 +797,12 @@ void lcd_remote_scroll_fn(void) drawmode = s->invert ? (DRMODE_SOLID|DRMODE_INVERSEVID) : DRMODE_SOLID; lcd_remote_putsxyofs(xpos, ypos, s->offset, s->line); + if (LCD_REMOTE_WIDTH > s->right_margin) { + drawmode ^= DRMODE_INVERSEVID; + lcd_remote_fillrect(s->right_margin, ypos, LCD_REMOTE_WIDTH - s->right_margin, pf->height); + } drawmode = lastmode; - lcd_remote_update_rect(xpos, ypos, LCD_REMOTE_WIDTH - xpos, pf->height); + lcd_remote_update_rect(xpos, ypos, s->right_margin - xpos, pf->height); } }