Index: apps/screen_access.c =================================================================== --- apps/screen_access.c (revision 17684) +++ apps/screen_access.c (working copy) @@ -51,11 +51,8 @@ .has_disk_led=true, #endif .set_viewport=&lcd_set_viewport, - .setmargins=&lcd_setmargins, .getwidth=&lcd_getwidth, .getheight=&lcd_getheight, - .getymargin=&lcd_getymargin, - .getxmargin=&lcd_getxmargin, .getstringsize=&lcd_getstringsize, #ifdef HAVE_LCD_BITMAP .setfont=&lcd_setfont, @@ -142,11 +139,8 @@ .pixel_format=LCD_REMOTE_PIXELFORMAT, .has_disk_led=false, .set_viewport=&lcd_remote_set_viewport, - .setmargins=&lcd_remote_setmargins, .getwidth=&lcd_remote_getwidth, .getheight=&lcd_remote_getheight, - .getymargin=&lcd_remote_getymargin, - .getxmargin=&lcd_remote_getxmargin, .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 17684) +++ apps/playlist.c (working copy) @@ -1758,15 +1758,6 @@ } fmt = P2STR(fmt); - lcd_clear_display(); - -#ifdef HAVE_LCD_BITMAP - if(global_settings.statusbar) - lcd_setmargins(0, STATUSBAR_HEIGHT); - else - lcd_setmargins(0, 0); -#endif - gui_syncsplash(0, fmt, count, str(LANG_OFF_ABORT)); } Index: apps/screen_access.h =================================================================== --- apps/screen_access.h (revision 17684) +++ apps/screen_access.h (working copy) @@ -72,11 +72,8 @@ bool has_buttonbar; #endif void (*set_viewport)(struct viewport* vp); - void (*setmargins)(int x, int y); int (*getwidth)(void); int (*getheight)(void); - int (*getxmargin)(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 */ void (*setfont)(int newfont); @@ -155,32 +152,6 @@ void (*backlight_set_timeout)(int index); }; -#ifdef HAVE_BUTTONBAR -/* - * Sets if the given screen has a buttonbar or not - * - screen : the screen structure - * - has : a boolean telling wether the current screen will have a buttonbar or not - */ -#define screen_has_buttonbar(screen, has_btnb) \ - (screen)->has_buttonbar=has_btnb; -#endif - -/* - * 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 - */ -#define screen_set_xmargin(screen, xmargin) \ - (screen)->setmargins(xmargin, (screen)->getymargin()); - -/* - * Sets the y margin in pixels for the given screen - * - screen : the screen structure - * - xmargin : the number of pixels to the top of the screen - */ -#define screen_set_ymargin(screen, ymargin) \ - (screen)->setmargins((screen)->getxmargin(), ymargin); - #if defined(HAVE_LCD_BITMAP) || defined(HAVE_REMOTE_LCD) /* * Clear only a given area of the screen Index: apps/recorder/recording.c =================================================================== --- apps/recorder/recording.c (revision 17684) +++ apps/recorder/recording.c (working copy) @@ -68,6 +68,7 @@ #include "action.h" #include "radio.h" #include "sound_menu.h" +#include "viewport.h" #ifdef HAVE_RECORDING /* This array holds the record timer interval lengths, in seconds */ @@ -882,6 +883,8 @@ int base_style = STYLE_INVERT; int style; + struct viewport vp[NB_SCREENS]; + int ymargin = global_settings.cursor_style?0:10; #ifdef HAVE_LCD_COLOR if (global_settings.cursor_style == 2) { base_style |= STYLE_COLORBAR; @@ -956,11 +959,12 @@ FOR_NB_SCREENS(i) { - screens[i].setfont(FONT_SYSFIXED); + viewport_set_defaults(&vp[i], i); + vp[i].font = FONT_SYSFIXED; + screens[i].set_viewport(&vp[i]); screens[i].getstringsize("M", &w, &h); - screens[i].setmargins(global_settings.cursor_style ? 0 : w, 8); - filename_offset[i] = ((screens[i].height >= 80) ? 1 : 0); - pm_y[i] = 8 + h * (2 + filename_offset[i]); + filename_offset[i] = ((vp[i].height >= 80) ? 1 : 0); + pm_y[i] = h * (2 + filename_offset[i]); } #ifdef HAVE_REMOTE_LCD @@ -968,8 +972,8 @@ { screens[1].clear_display(); snprintf(buf, sizeof(buf), str(LANG_REMOTE_LCD_ON)); - screens[1].puts((screens[1].width/w - strlen(buf))/2 + 1, - screens[1].height/(h*2) + 1, buf); + screens[1].puts((vp[1].width/w - strlen(buf))/2 + 1, + vp[1].height/(h*2) + 1, buf); screens[1].update(); gui_syncsplash(0, str(LANG_REMOTE_LCD_OFF)); } @@ -1363,9 +1367,8 @@ FOR_NB_SCREENS(i) { + screens[i].set_viewport(&vp[i]); screens[i].setfont(FONT_SYSFIXED); - screens[i].setmargins( - global_settings.cursor_style ? 0 : w, 8); } } } @@ -1613,7 +1616,9 @@ else { for(i = 0; i < screen_update; i++) - screens[i].puts(0, filename_offset[i] + PM_HEIGHT + 2, buf); + screens[i].putsxy(ymargin, + SYSFONT_HEIGHT*(filename_offset[i]+ + PM_HEIGHT + 2), buf); } if(global_settings.rec_source == AUDIO_SRC_MIC) @@ -1632,8 +1637,9 @@ else { for(i = 0; i < screen_update; i++) - screens[i].puts(0, filename_offset[i] + - PM_HEIGHT + 3, buf); + screens[i].putsxy(ymargin, + SYSFONT_HEIGHT*(filename_offset[i] + + PM_HEIGHT + 3), buf); } } else if(0 @@ -1664,8 +1670,9 @@ else { for(i = 0; i < screen_update; i++) - screens[i].puts(0, filename_offset[i] + - PM_HEIGHT + 3, buf); + screens[i].putsxy(ymargin, + SYSFONT_HEIGHT*(filename_offset[i] + + PM_HEIGHT + 3), buf); } snprintf(buf, sizeof(buf), "%s:%s", @@ -1688,8 +1695,9 @@ else { for(i = 0; i < screen_update; i++) - screens[i].puts(0, filename_offset[i] + - PM_HEIGHT + 4, buf); + screens[i].putsxy(ymargin, + SYSFONT_HEIGHT*(filename_offset[i] + + PM_HEIGHT + 4), buf); } } #ifdef HAVE_LCD_COLOR @@ -1721,7 +1729,7 @@ break; } /* end switch */ #ifdef HAVE_AGC - if (screens[i].height < h * (2 + filename_offset[i] + + if (vp[i].height < h * (2 + filename_offset[i] + PM_HEIGHT + line[i])) { line[i] -= 1; @@ -1785,8 +1793,9 @@ { for(i = 0; i < screen_update; i++) { if (display_agc[i]) { - screens[i].puts(0, filename_offset[i] + - PM_HEIGHT + line[i], buf); + screens[i].putsxy(ymargin, + SYSFONT_HEIGHT*(filename_offset[i] + + PM_HEIGHT + line[i]), buf); } } } @@ -1859,7 +1868,9 @@ for(i = 0; i < screen_update; i++) { + screens[i].set_viewport(NULL); gui_statusbar_draw(&(statusbars.statusbars[i]), true); + screens[i].set_viewport(&vp[i]); peak_meter_screen(&screens[i], pm_x, pm_y[i], h*PM_HEIGHT); screens[i].update(); } @@ -1867,11 +1878,11 @@ /* draw the trigger status */ FOR_NB_SCREENS(i) { - trig_width[i] = ((screens[i].height < 64) || - ((screens[i].height < 72) && (PM_HEIGHT > 1))) ? + trig_width[i] = ((vp[i].height < 64) || + ((vp[i].height < 72) && (PM_HEIGHT > 1))) ? screens[i].width - 14 * w : screens[i].width; trig_xpos[i] = screens[i].width - trig_width[i]; - trig_ypos[i] = ((screens[i].height < 72) && (PM_HEIGHT > 1)) ? + trig_ypos[i] = ((vp[i].height < 72) && (PM_HEIGHT > 1)) ? h*2 : h*(1 + filename_offset[i] + PM_HEIGHT + line[i] Index: apps/plugins/test_viewports.c =================================================================== --- apps/plugins/test_viewports.c (revision 17684) +++ apps/plugins/test_viewports.c (working copy) @@ -43,8 +43,6 @@ .height = 20, .font = FONT_UI, .drawmode = DRMODE_SOLID, - .xmargin = 0, - .ymargin = 0, #if LCD_DEPTH > 1 .fg_pattern = LCD_DEFAULT_FG, .bg_pattern = BGCOLOR_1, @@ -64,8 +62,6 @@ .height = LCD_HEIGHT / 2, .font = FONT_SYSFIXED, .drawmode = DRMODE_SOLID, - .xmargin = 0, - .ymargin = 0, #if LCD_DEPTH > 1 .fg_pattern = LCD_DEFAULT_FG, .bg_pattern = LCD_DEFAULT_BG, @@ -85,8 +81,6 @@ .height = (LCD_HEIGHT / 2), .font = FONT_UI, .drawmode = DRMODE_SOLID, - .xmargin = 0, - .ymargin = 0, #if LCD_DEPTH > 1 .fg_pattern = FGCOLOR_1, .bg_pattern = BGCOLOR_2, @@ -107,8 +101,6 @@ .height = (LCD_HEIGHT / 4), .font = FONT_SYSFIXED, .drawmode = DRMODE_SOLID, - .xmargin = 0, - .ymargin = 0, #if LCD_DEPTH > 1 .fg_pattern = LCD_BLACK, .bg_pattern = LCD_WHITE, @@ -130,8 +122,6 @@ .height = LCD_REMOTE_HEIGHT - 10, .font = FONT_SYSFIXED, .drawmode = DRMODE_SOLID, - .xmargin = 0, - .ymargin = 0, #if LCD_REMOTE_DEPTH > 1 .fg_pattern = LCD_REMOTE_BLACK, .bg_pattern = LCD_REMOTE_LIGHTGRAY, @@ -146,8 +136,6 @@ .height = LCD_REMOTE_HEIGHT - 10, .font = FONT_SYSFIXED, .drawmode = DRMODE_SOLID, - .xmargin = 0, - .ymargin = 0, #if LCD_REMOTE_DEPTH > 1 .fg_pattern = LCD_REMOTE_DEFAULT_FG, .bg_pattern = LCD_REMOTE_DEFAULT_BG @@ -253,8 +241,6 @@ .y = 0, .width = 5, .height = 1, - .xmargin = 0, - .ymargin = 0, }; static struct viewport vp1 = @@ -263,8 +249,6 @@ .y = 0, .width = 5, .height = 1, - .xmargin = 0, - .ymargin = 0, }; static struct viewport vp2 = @@ -273,8 +257,6 @@ .y = 1, .width = LCD_WIDTH, .height = 1, - .xmargin = 0, - .ymargin = 0, }; Index: apps/plugins/solitaire.c =================================================================== --- apps/plugins/solitaire.c (revision 17684) +++ apps/plugins/solitaire.c (working copy) @@ -744,7 +744,6 @@ break; case 2: - rb->lcd_setmargins(0, 0); if (solitaire_help() == HELP_USB) result = MENU_USB; break; @@ -766,7 +765,6 @@ } } menu_exit(m); - rb->lcd_setmargins(0, 0); return result; } Index: apps/plugins/test_disk.c =================================================================== --- apps/plugins/test_disk.c (revision 17684) +++ apps/plugins/test_disk.c (working copy) @@ -77,7 +77,6 @@ { int h; - rb->lcd_setmargins(0, 0); rb->lcd_getstringsize("A", NULL, &h); max_line = LCD_HEIGHT / h; line = 0; Index: apps/plugins/viewer.c =================================================================== --- apps/plugins/viewer.c (revision 17684) +++ apps/plugins/viewer.c (working copy) @@ -1421,7 +1421,6 @@ result = menu_run(m); menu_exit(m); #ifdef HAVE_LCD_BITMAP - rb->lcd_setmargins(0,0); /* Show-scrollbar mode for current view-width mode */ init_need_scrollbar(); @@ -1459,9 +1458,6 @@ break; } menu_exit(m); -#ifdef HAVE_LCD_BITMAP - rb->lcd_setmargins(0,0); -#endif viewer_draw(col); } Index: apps/plugins/test_codec.c =================================================================== --- apps/plugins/test_codec.c (revision 17684) +++ apps/plugins/test_codec.c (working copy) @@ -44,7 +44,6 @@ { int h; - rb->lcd_setmargins(0, 0); rb->lcd_getstringsize("A", NULL, &h); max_line = LCD_HEIGHT / h; line = 0; Index: apps/plugins/test_fps.c =================================================================== --- apps/plugins/test_fps.c (revision 17684) +++ apps/plugins/test_fps.c (working copy) @@ -57,14 +57,12 @@ { int h; - rb->lcd_setmargins(0, 0); rb->lcd_getstringsize("A", NULL, &h); max_line = LCD_HEIGHT / h; line = 0; rb->lcd_clear_display(); rb->lcd_update(); #ifdef HAVE_REMOTE_LCD - rb->lcd_remote_setmargins(0, 0); rb->lcd_remote_getstringsize("A", NULL, &h); remote_max_line = LCD_REMOTE_HEIGHT / h; remote_line = 0; Index: apps/gui/gwps-common.c =================================================================== --- apps/gui/gwps-common.c (revision 17684) +++ apps/gui/gwps-common.c (working copy) @@ -333,7 +333,6 @@ /* Update the values in the first (default) viewport - in case the user has modified the statusbar or colour settings */ #ifdef HAVE_LCD_BITMAP - gui_wps[i].data->viewports[0].vp.ymargin = gui_wps[i].display->getymargin(); #if LCD_DEPTH > 1 if (gui_wps[i].display->depth > 1) { @@ -503,7 +502,7 @@ int sb_y; if (data->progress_top < 0) - sb_y = line*h + display->getymargin() + + sb_y = line*h + ((h > data->progress_height + 1) ? (h - data->progress_height) / 2 : 1); else @@ -1415,14 +1414,6 @@ else return NULL; #endif - -#ifdef HAVE_LCD_BITMAP - case WPS_TOKEN_LEFTMARGIN: - gwps->display->setmargins(token->value.i, - gwps->display->getymargin()); - return NULL; -#endif - default: return NULL; } @@ -1536,11 +1527,6 @@ align->center = NULL; align->right = NULL; -#ifdef HAVE_LCD_BITMAP - /* Reset margins - only bitmap targets modify them */ - gwps->display->setmargins(0, gwps->display->getymargin()); -#endif - /* 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); @@ -1790,7 +1776,7 @@ ¢er_width, &string_height); } - left_xpos = display->getxmargin(); + left_xpos = 0; right_xpos = (display->getwidth() - right_width); center_xpos = (display->getwidth() + left_xpos - center_width) / 2; @@ -1875,7 +1861,7 @@ right_width = 0; } - ypos = (line * string_height) + display->getymargin(); + ypos = (line * string_height); if (scroll && ((left_width > scroll_width) || @@ -1957,7 +1943,8 @@ /* reset to first subline if refresh all flag is set */ if (refresh_mode == WPS_REFRESH_ALL) { - display->clear_display(); + display->set_viewport(&data->viewports[0].vp); + display->clear_viewport(); for (i = 0; i <= data->num_lines; i++) { @@ -2035,7 +2022,7 @@ update_line = false; int h = font_get(display->getfont())->height; - int peak_meter_y = display->getymargin() + (line - data->viewports[v].first_line)* h; + int peak_meter_y = (line - data->viewports[v].first_line)* h; /* The user might decide to have the peak meter in the last line so that it is only displayed if no status bar is Index: apps/gui/statusbar.h =================================================================== --- apps/gui/statusbar.h (revision 17684) +++ apps/gui/statusbar.h (working copy) @@ -22,11 +22,16 @@ #include "status.h" #include "screen_access.h" +#include "events.h" #define STATUSBAR_X_POS 0 #define STATUSBAR_Y_POS 0 /* MUST be a multiple of 8 */ #define STATUSBAR_HEIGHT 8 +/* possibly a horrible misuse of the event system. + This is triggered when the statusbar setting changes */ +#define STATUSBAR_TOGGLE_EVENT (EVENT_CLASS_GUI|1) + struct status_info { int battlevel; int batt_charge_step; Index: apps/gui/wps_debug.c =================================================================== --- apps/gui/wps_debug.c (revision 17684) +++ apps/gui/wps_debug.c (working copy) @@ -79,11 +79,6 @@ case WPS_TOKEN_ALIGN_RIGHT: snprintf(buf, bufsize, "align right"); break; - - case WPS_TOKEN_LEFTMARGIN: - snprintf(buf, bufsize, "left margin, value: %d", - token->value.i); - break; #endif case WPS_TOKEN_SUBLINE_TIMEOUT: Index: apps/gui/viewport.c =================================================================== --- apps/gui/viewport.c (revision 17684) +++ apps/gui/viewport.c (working copy) @@ -45,8 +45,6 @@ void viewport_set_defaults(struct viewport *vp, enum screen_type screen) { - vp->xmargin = 0; - vp->ymargin = 0; vp->x = 0; vp->width = screens[screen].width; Index: apps/gui/gwps.c =================================================================== --- apps/gui/gwps.c (revision 17684) +++ apps/gui/gwps.c (working copy) @@ -77,19 +77,6 @@ /* connects a wps with a statusbar*/ static void gui_wps_set_statusbar(struct gui_wps *gui_wps, struct gui_statusbar *statusbar); -#ifdef HAVE_LCD_BITMAP -static void gui_wps_set_margin(struct gui_wps *gwps) -{ - int offset = 0; - struct wps_data *data = gwps->data; - if(data->wps_sb_tag && data->show_sb_on_wps) - offset = STATUSBAR_HEIGHT; - else if ( global_settings.statusbar && !data->wps_sb_tag) - offset = STATUSBAR_HEIGHT; - gwps->display->setmargins(0, offset); -} -#endif - static void prev_track(unsigned skip_thresh) { if (!wps_state.id3 || (wps_state.id3->elapsed < skip_thresh*1000)) { @@ -152,10 +139,6 @@ status_set_audio(true); status_set_param(false); #else - FOR_NB_SCREENS(i) - { - gui_wps_set_margin(&gui_wps[i]); - } #if LCD_DEPTH > 1 show_wps_backdrop(); #endif /* LCD_DEPTH > 1 */ @@ -299,12 +282,6 @@ #if defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1 show_remote_wps_backdrop(); #endif -#ifdef HAVE_LCD_BITMAP - FOR_NB_SCREENS(i) - { - gui_wps_set_margin(&gui_wps[i]); - } -#endif restore = true; break; @@ -558,12 +535,6 @@ #if defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1 show_remote_wps_backdrop(); #endif -#ifdef HAVE_LCD_BITMAP - FOR_NB_SCREENS(i) - { - gui_wps_set_margin(&gui_wps[i]); - } -#endif restore = true; break; #endif /* HAVE_QUICKSCREEN */ @@ -579,12 +550,6 @@ #endif if (quick_screen_f3(BUTTON_F3)) return SYS_USB_CONNECTED; -#ifdef HAVE_LCD_BITMAP - FOR_NB_SCREENS(i) - { - gui_wps_set_margin(&gui_wps[i]); - } -#endif restore = true; break; #endif /* BUTTON_F3 */ @@ -643,12 +608,6 @@ #if defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1 show_remote_wps_backdrop(); #endif -#ifdef HAVE_LCD_BITMAP - FOR_NB_SCREENS(i) - { - gui_wps_set_margin(&gui_wps[i]); - } -#endif restore = true; break; @@ -812,7 +771,30 @@ FOR_NB_SCREENS(i) gui_wps_set_disp(&gui_wps[i], &screens[i]); } +static void statusbar_toggle_handler(void *data) +{ + (void)data; + int i; + bool draw = global_settings.statusbar; + FOR_NB_SCREENS(i) + { + struct wps_viewport *vp = &gui_wps[i].data->viewports[0]; + if (gui_wps[i].data->wps_sb_tag) + draw = gui_wps[i].data->show_sb_on_wps; + if (!global_settings.statusbar && !draw) + { + vp->vp.y = 0; + vp->vp.height = screens[i].height; + } + else + { + vp->vp.y = STATUSBAR_HEIGHT; + vp->vp.height = screens[i].height - STATUSBAR_HEIGHT; + } + } +} + void gui_sync_wps_init(void) { int i; @@ -826,6 +808,7 @@ gui_wps_set_data(&gui_wps[i], &wps_datas[i]); gui_wps_set_statusbar(&gui_wps[i], &statusbars.statusbars[i]); } + add_event(STATUSBAR_TOGGLE_EVENT, false, statusbar_toggle_handler); #if LCD_DEPTH > 1 unload_wps_backdrop(); #endif Index: apps/gui/wps_parser.c =================================================================== --- apps/gui/wps_parser.c (revision 17684) +++ apps/gui/wps_parser.c (working copy) @@ -131,8 +131,6 @@ #ifdef HAVE_LCD_BITMAP static int parse_viewport(const char *wps_bufptr, struct wps_token *token, struct wps_data *wps_data); -static int parse_leftmargin(const char *wps_bufptr, - struct wps_token *token, struct wps_data *wps_data); static int parse_image_special(const char *wps_bufptr, struct wps_token *token, struct wps_data *wps_data); static int parse_statusbar_enable(const char *wps_bufptr, @@ -269,10 +267,6 @@ { WPS_TOKEN_PLAYBACK_STATUS, "mp", WPS_REFRESH_DYNAMIC, NULL }, #ifdef HAVE_LCD_BITMAP - { WPS_TOKEN_LEFTMARGIN, "m", 0, parse_leftmargin }, -#endif - -#ifdef HAVE_LCD_BITMAP { WPS_TOKEN_PEAKMETER, "pm", WPS_REFRESH_PEAK_METER, NULL }, #else { WPS_TOKEN_PLAYER_PROGRESSBAR, "pf", @@ -363,6 +357,11 @@ (void)token; /* Kill warnings */ wps_data->wps_sb_tag = true; wps_data->show_sb_on_wps = true; + if (wps_data->viewports[0].vp.y == 0) + { + wps_data->viewports[0].vp.y = STATUSBAR_HEIGHT; + wps_data->viewports[0].vp.height -= STATUSBAR_HEIGHT; + } return skip_end_of_line(wps_bufptr); } @@ -373,6 +372,11 @@ (void)token; /* Kill warnings */ wps_data->wps_sb_tag = true; wps_data->show_sb_on_wps = false; + if (wps_data->viewports[0].vp.y == STATUSBAR_HEIGHT) + { + wps_data->viewports[0].vp.y = 0; + wps_data->viewports[0].vp.height += STATUSBAR_HEIGHT; + } return skip_end_of_line(wps_bufptr); } @@ -560,8 +564,6 @@ /* Set the defaults for fields not user-specified */ vp->drawmode = DRMODE_SOLID; - vp->xmargin = 0; - vp->ymargin = 0; /* Work out the depth of this display */ #ifdef HAVE_REMOTE_LCD @@ -1002,34 +1004,6 @@ }; #endif /* HAVE_ALBUMART */ -#ifdef HAVE_LCD_BITMAP -static int parse_leftmargin(const char *wps_bufptr, struct wps_token *token, - struct wps_data *wps_data) -{ - const char* p; - const char* pend; - const char *newline; - - (void)wps_data; /* Kill the warning */ - - /* valid tag looks like %m|12| */ - if(*wps_bufptr == '|') - { - p = wps_bufptr + 1; - newline = strchr(wps_bufptr, '\n'); - if(isdigit(*p) && (pend = strchr(p, '|')) && pend < newline) - { - token->value.i = atoi(p); - return pend - wps_bufptr + 1; - } - } - - /* invalid tag syntax */ - return WPS_ERROR_INVALID_PARAM; -} -#endif - - /* 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) { @@ -1478,15 +1452,21 @@ /* Initialise the first (default) viewport */ wps_data->viewports[0].vp.x = 0; - wps_data->viewports[0].vp.y = 0; wps_data->viewports[0].vp.width = display->width; - wps_data->viewports[0].vp.height = display->height; + if (!global_settings.statusbar) + { + wps_data->viewports[0].vp.y = 0; + wps_data->viewports[0].vp.height = display->height; + } + else + { + wps_data->viewports[0].vp.y = STATUSBAR_HEIGHT; + wps_data->viewports[0].vp.height = display->height - STATUSBAR_HEIGHT; + } #ifdef HAVE_LCD_BITMAP wps_data->viewports[0].vp.font = FONT_UI; wps_data->viewports[0].vp.drawmode = DRMODE_SOLID; #endif - wps_data->viewports[0].vp.xmargin = display->getxmargin(); - wps_data->viewports[0].vp.ymargin = display->getymargin(); #if LCD_DEPTH > 1 if (display->depth > 1) { Index: apps/gui/icon.c =================================================================== --- apps/gui/icon.c (revision 17684) +++ apps/gui/icon.c (working copy) @@ -103,7 +103,7 @@ int screen = display->screen_type; display->getstringsize((unsigned char *)"M", &width, &height); xpos = x*ICON_WIDTH(screen) + off_x; - ypos = y*height + display->getymargin() + off_y; + ypos = y*height + off_y; if ( height > ICON_HEIGHT(screen) )/* center the cursor */ ypos += (height - ICON_HEIGHT(screen)) / 2; Index: apps/menus/display_menu.c =================================================================== --- apps/menus/display_menu.c (revision 17684) +++ apps/menus/display_menu.c (working copy) @@ -21,6 +21,7 @@ #include #include #include "config.h" +#include "events.h" #include "lang.h" #include "action.h" #include "settings.h" @@ -35,6 +36,7 @@ #include "lcd.h" #include "lcd-remote.h" #include "backdrop.h" +#include "statusbar.h" #ifdef HAVE_BACKLIGHT static int filterfirstkeypress_callback(int action,const struct menu_item_ex *this_item) @@ -300,6 +302,7 @@ switch (action) { case ACTION_EXIT_MENUITEM: + send_event(STATUSBAR_TOGGLE_EVENT, NULL); /* this should be changed so only the viewports are reloaded */ settings_apply(false); break; Index: apps/plugin.c =================================================================== --- apps/plugin.c (revision 17684) +++ apps/plugin.c (working copy) @@ -75,7 +75,6 @@ lcd_set_contrast, lcd_update, lcd_clear_display, - lcd_setmargins, lcd_getstringsize, lcd_putsxy, lcd_puts, @@ -158,7 +157,6 @@ /* remote lcd */ lcd_remote_set_contrast, lcd_remote_clear_display, - lcd_remote_setmargins, lcd_remote_puts, lcd_remote_puts_scroll, lcd_remote_stop_scroll, @@ -620,10 +618,6 @@ unsigned my_core; #endif #endif /* !SIMULATOR */ - int xm, ym; -#ifdef HAVE_REMOTE_LCD - int rxm, rym; -#endif #if LCD_DEPTH > 1 fb_data* old_backdrop; @@ -705,11 +699,8 @@ #endif plugin_loaded = true; + - xm = lcd_getxmargin(); - ym = lcd_getymargin(); - lcd_setmargins(0,0); - #if defined HAVE_LCD_BITMAP && LCD_DEPTH > 1 old_backdrop = lcd_get_backdrop(); #endif @@ -717,9 +708,6 @@ lcd_update(); #ifdef HAVE_REMOTE_LCD - rxm = lcd_remote_getxmargin(); - rym = lcd_remote_getymargin(); - lcd_remote_setmargins(0, 0); lcd_remote_clear_display(); lcd_remote_update(); #endif @@ -744,8 +732,6 @@ #endif /* LCD_DEPTH */ #endif /* HAVE_LCD_BITMAP */ - /* restore margins */ - lcd_setmargins(xm,ym); lcd_clear_display(); lcd_update(); @@ -756,7 +742,6 @@ #else lcd_remote_set_drawmode(DRMODE_SOLID); #endif - lcd_remote_setmargins(rxm, rym); lcd_remote_clear_display(); Index: apps/plugin.h =================================================================== --- apps/plugin.h (revision 17684) +++ apps/plugin.h (working copy) @@ -150,7 +150,6 @@ void (*lcd_set_contrast)(int x); void (*lcd_update)(void); void (*lcd_clear_display)(void); - void (*lcd_setmargins)(int x, int y); 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); @@ -253,7 +252,6 @@ /* remote lcd */ void (*lcd_remote_set_contrast)(int x); void (*lcd_remote_clear_display)(void); - void (*lcd_remote_setmargins)(int x, int y); void (*lcd_remote_puts)(int x, int y, const unsigned char *string); void (*lcd_remote_puts_scroll)(int x, int y, const unsigned char* string); void (*lcd_remote_stop_scroll)(void); Index: apps/logfdisp.c =================================================================== --- apps/logfdisp.c (revision 17684) +++ apps/logfdisp.c (working copy) @@ -66,7 +66,6 @@ if(!lines) return false; - lcd_setmargins(0, 0); lcd_clear_display(); do { Index: apps/debug_menu.c =================================================================== --- apps/debug_menu.c (revision 17684) +++ apps/debug_menu.c (working copy) @@ -226,7 +226,6 @@ char buf[32]; struct audio_debug d; - lcd_setmargins(0, 0); lcd_setfont(FONT_SYSFIXED); while(1) @@ -299,7 +298,6 @@ tick_add_task(dbg_audio_task); - lcd_setmargins(0, 0); lcd_setfont(FONT_SYSFIXED); while(!done) { @@ -521,7 +519,6 @@ system_memory_guard(oldmode); /* re-enable memory guard */ - lcd_setmargins(0, 0); lcd_setfont(FONT_SYSFIXED); lcd_clear_display(); @@ -572,7 +569,6 @@ system_memory_guard(oldmode); /* re-enable memory guard */ - lcd_setmargins(0, 0); lcd_setfont(FONT_SYSFIXED); lcd_clear_display(); @@ -623,7 +619,6 @@ (PP_VER1 >> 24) & 0xff, (PP_VER1 >> 16) & 0xff, (PP_VER1 >> 8) & 0xff, (PP_VER1) & 0xff, '\0' }; - lcd_setmargins(0, 0); lcd_setfont(FONT_SYSFIXED); lcd_clear_display(); @@ -660,7 +655,6 @@ (PP_VER1 >> 8) & 0xff, PP_VER1 & 0xff, '\0' }; - lcd_setmargins(0, 0); lcd_setfont(FONT_SYSFIXED); lcd_clear_display(); @@ -823,7 +817,6 @@ 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_clear_display(); lcd_setfont(FONT_SYSFIXED); @@ -1033,7 +1026,6 @@ int adc_battery_voltage, adc_battery_level; lcd_setfont(FONT_SYSFIXED); - lcd_setmargins(0, 0); lcd_clear_display(); while(1) @@ -1075,7 +1067,6 @@ char buf[128]; int line; - lcd_setmargins(0, 0); lcd_clear_display(); lcd_setfont(FONT_SYSFIXED); @@ -1151,7 +1142,6 @@ char buf[128]; int line; - lcd_setmargins(0, 0); lcd_clear_display(); lcd_setfont(FONT_SYSFIXED); @@ -1248,7 +1238,6 @@ char buf[128]; int line; - lcd_setmargins(0, 0); lcd_clear_display(); lcd_setfont(FONT_SYSFIXED); @@ -1374,7 +1363,6 @@ int line; #ifdef HAVE_LCD_BITMAP - lcd_setmargins(0, 0); lcd_setfont(FONT_SYSFIXED); #endif lcd_clear_display(); @@ -1429,7 +1417,6 @@ int button; #ifdef HAVE_LCD_BITMAP - lcd_setmargins(0, 0); lcd_setfont(FONT_SYSFIXED); #endif lcd_clear_display(); @@ -1559,7 +1546,6 @@ unsigned short maxv, minv; char buf[32]; - lcd_setmargins(0, 0); lcd_setfont(FONT_SYSFIXED); while(1) @@ -2316,7 +2302,6 @@ int lines = LCD_HEIGHT/SYSFONT_HEIGHT; char *str; bool done; - lcd_setmargins(0, 0); lcd_setfont(FONT_SYSFIXED); str = cpu_boost_log_getlog_first(); while (i < count) @@ -2369,7 +2354,6 @@ char buf[64]; unsigned int speed; - lcd_setmargins(0, 0); lcd_setfont(FONT_SYSFIXED); while (1) Index: firmware/export/events.h =================================================================== --- firmware/export/events.h (revision 17684) +++ firmware/export/events.h (working copy) @@ -30,6 +30,7 @@ #define EVENT_CLASS_DISK 0x0100 #define EVENT_CLASS_PLAYBACK 0x0200 #define EVENT_CLASS_BUFFERING 0x0400 +#define EVENT_CLASS_GUI 0x0800 /** * Because same playback events are used in mpeg.c and playback.c, define Index: firmware/export/lcd.h =================================================================== --- firmware/export/lcd.h (revision 17684) +++ firmware/export/lcd.h (working copy) @@ -33,8 +33,6 @@ int font; int drawmode; #endif - int xmargin; /* During the transition only - to be removed */ - int ymargin; /* During the transition only - to be removed */ #if LCD_DEPTH > 1 unsigned fg_pattern; unsigned bg_pattern; @@ -105,9 +103,6 @@ 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 int lcd_getymargin(void); extern int lcd_getwidth(void); extern int lcd_getheight(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 17684) +++ firmware/export/lcd-remote.h (working copy) @@ -144,9 +144,6 @@ 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 int lcd_remote_getymargin(void); extern int lcd_remote_getwidth(void); extern int lcd_remote_getheight(void); extern void lcd_remote_setfont(int font); Index: firmware/logf.c =================================================================== --- firmware/logf.c (revision 17684) +++ firmware/logf.c (working copy) @@ -59,7 +59,6 @@ lcd_remote_getstringsize("A", &w, &h); lines = LCD_REMOTE_HEIGHT/h; columns = LCD_REMOTE_WIDTH/w; - lcd_remote_setmargins(0, 0); lcd_remote_clear_display(); index = logfindex; Index: firmware/target/arm/tcc780x/debug-tcc780x.c =================================================================== --- firmware/target/arm/tcc780x/debug-tcc780x.c (revision 17684) +++ firmware/target/arm/tcc780x/debug-tcc780x.c (working copy) @@ -44,7 +44,6 @@ bool done=false; char buf[100]; - lcd_setmargins(0, 0); lcd_setfont(FONT_SYSFIXED); lcd_clear_display(); Index: firmware/target/arm/tcc77x/debug-tcc77x.c =================================================================== --- firmware/target/arm/tcc77x/debug-tcc77x.c (revision 17684) +++ firmware/target/arm/tcc77x/debug-tcc77x.c (working copy) @@ -40,7 +40,6 @@ bool done=false; char buf[100]; - lcd_setmargins(0, 0); lcd_setfont(FONT_SYSFIXED); lcd_clear_display(); Index: firmware/target/arm/tms320dm320/debug-dm320.c =================================================================== --- firmware/target/arm/tms320dm320/debug-dm320.c (revision 17684) +++ firmware/target/arm/tms320dm320/debug-dm320.c (working copy) @@ -48,7 +48,6 @@ bool done=false; char buf[100]; - lcd_setmargins(0, 0); lcd_setfont(FONT_SYSFIXED); lcd_clear_display(); Index: firmware/target/arm/imx31/debug-imx31.c =================================================================== --- firmware/target/arm/imx31/debug-imx31.c (revision 17684) +++ firmware/target/arm/imx31/debug-imx31.c (working copy) @@ -38,7 +38,6 @@ unsigned int freq; uint32_t regval; - lcd_setmargins(0, 0); lcd_clear_display(); lcd_setfont(FONT_SYSFIXED); @@ -158,7 +157,6 @@ uint32_t pmic_regs[ARRAYLEN(pmic_regset)]; - lcd_setmargins(0, 0); lcd_clear_display(); lcd_setfont(FONT_SYSFIXED); Index: firmware/target/arm/s3c2440/debug-s3c2440.c =================================================================== --- firmware/target/arm/s3c2440/debug-s3c2440.c (revision 17684) +++ firmware/target/arm/s3c2440/debug-s3c2440.c (working copy) @@ -38,7 +38,6 @@ char buf[50]; int line; - lcd_setmargins(0, 0); lcd_clear_display(); lcd_setfont(FONT_SYSFIXED); Index: firmware/drivers/lcd-charcell.c =================================================================== --- firmware/drivers/lcd-charcell.c (revision 17684) +++ firmware/drivers/lcd-charcell.c (working copy) @@ -58,8 +58,6 @@ .y = 0, .width = LCD_WIDTH, .height = LCD_HEIGHT, - .xmargin = 0, - .ymargin = 0, }; static struct viewport* current_vp = &default_vp; @@ -92,22 +90,6 @@ /** parameter handling **/ -void lcd_setmargins(int x, int y) -{ - current_vp->xmargin = x; - current_vp->ymargin = y; -} - -int lcd_getxmargin(void) -{ - return current_vp->xmargin; -} - -int lcd_getymargin(void) -{ - return current_vp->ymargin; -} - int lcd_getwidth(void) { return current_vp->width; @@ -484,7 +466,7 @@ lcd_puts_offset(x, y, string, offset); len = utf8length(string); - if (current_vp->width - x - current_vp->xmargin < len) + if (current_vp->width - x < len) { /* prepare scroll line */ char *end; @@ -498,7 +480,7 @@ /* scroll bidirectional or forward only depending on the string width */ if (lcd_scroll_info.bidir_limit) { - s->bidir = s->len < (current_vp->width - current_vp->xmargin) * + s->bidir = s->len < (current_vp->width) * (100 + lcd_scroll_info.bidir_limit) / 100; } else @@ -517,7 +499,7 @@ s->vp = current_vp; s->y = y; s->offset = offset; - s->startx = current_vp->xmargin + x; + s->startx = x; s->backward = false; lcd_scroll_info.lines++; } @@ -547,7 +529,7 @@ s->offset++; xpos = s->startx; - ypos = current_vp->ymargin + s->y; + ypos = s->y; if (s->bidir) /* scroll bidirectional */ { Index: firmware/drivers/lcd-1bit-vert.c =================================================================== --- firmware/drivers/lcd-1bit-vert.c (revision 17684) +++ firmware/drivers/lcd-1bit-vert.c (working copy) @@ -56,8 +56,6 @@ .height = LCDM(HEIGHT), .font = FONT_SYSFIXED, .drawmode = DRMODE_SOLID, - .xmargin = 0, - .ymargin = 0, }; static struct viewport* current_vp = &default_vp; @@ -107,22 +105,6 @@ return current_vp->drawmode; } -void LCDFN(setmargins)(int x, int y) -{ - current_vp->xmargin = x; - current_vp->ymargin = y; -} - -int LCDFN(getxmargin)(void) -{ - return current_vp->xmargin; -} - -int LCDFN(getymargin)(void) -{ - return current_vp->ymargin; -} - int LCDFN(getwidth)(void) { return current_vp->width; @@ -760,8 +742,8 @@ return; LCDFN(getstringsize)(str, &w, &h); - xpos = current_vp->xmargin + x*w / utf8length(str); - ypos = current_vp->ymargin + y*h; + xpos = x*w / utf8length(str); + ypos = y*h; current_vp->drawmode = (style & STYLE_INVERT) ? (DRMODE_SOLID|DRMODE_INVERSEVID) : DRMODE_SOLID; LCDFN(putsxyofs)(xpos, ypos, offset, str); @@ -816,7 +798,7 @@ LCDFN(getstringsize)(string, &w, &h); - if (current_vp->width - x * 8 - current_vp->xmargin < w) { + if (current_vp->width - x * 8 < w) { /* prepare scroll line */ char *end; @@ -829,7 +811,7 @@ /* scroll bidirectional or forward only depending on the string width */ if ( LCDFN(scroll_info).bidir_limit ) { - s->bidir = s->width < (current_vp->width - current_vp->xmargin) * + s->bidir = s->width < (current_vp->width) * (100 + LCDFN(scroll_info).bidir_limit) / 100; } else @@ -848,7 +830,7 @@ s->y = y; s->len = utf8length(string); s->offset = offset; - s->startx = current_vp->xmargin + x * s->width / s->len;; + s->startx = x * s->width / s->len;; s->backward = false; LCDFN(scroll_info).lines++; @@ -880,7 +862,7 @@ pf = font_get(current_vp->font); xpos = s->startx; - ypos = current_vp->ymargin + s->y * pf->height; + ypos = s->y * pf->height; if (s->bidir) { /* scroll bidirectional */ if (s->offset <= 0) { Index: firmware/drivers/lcd-2bit-vert.c =================================================================== --- firmware/drivers/lcd-2bit-vert.c (revision 17684) +++ firmware/drivers/lcd-2bit-vert.c (working copy) @@ -56,8 +56,6 @@ .height = LCD_HEIGHT, .font = FONT_SYSFIXED, .drawmode = DRMODE_SOLID, - .xmargin = 0, - .ymargin = 0, .fg_pattern = LCD_DEFAULT_FG, .bg_pattern = LCD_DEFAULT_BG }; @@ -144,22 +142,6 @@ lcd_set_background(bg_brightness); } -void lcd_setmargins(int x, int y) -{ - current_vp->xmargin = x; - current_vp->ymargin = y; -} - -int lcd_getxmargin(void) -{ - return current_vp->xmargin; -} - -int lcd_getymargin(void) -{ - return current_vp->ymargin; -} - int lcd_getwidth(void) { return current_vp->width; @@ -1088,8 +1070,8 @@ return; lcd_getstringsize(str, &w, &h); - xpos = current_vp->xmargin + x*w / utf8length((char *)str); - ypos = current_vp->ymargin + y*h; + xpos = x*w / utf8length((char *)str); + ypos = y*h; current_vp->drawmode = (style & STYLE_INVERT) ? (DRMODE_SOLID|DRMODE_INVERSEVID) : DRMODE_SOLID; lcd_putsxyofs(xpos, ypos, offset, str); @@ -1142,7 +1124,7 @@ lcd_getstringsize(string, &w, &h); - if (current_vp->width - x * 8 - current_vp->xmargin < w) { + if (current_vp->width - x * 8< w) { /* prepare scroll line */ char *end; @@ -1155,7 +1137,7 @@ /* scroll bidirectional or forward only depending on the string width */ if ( lcd_scroll_info.bidir_limit ) { - s->bidir = s->width < (current_vp->width - current_vp->xmargin) * + s->bidir = s->width < (current_vp->width) * (100 + lcd_scroll_info.bidir_limit) / 100; } else @@ -1174,7 +1156,7 @@ s->y = y; s->len = utf8length((char *)string); s->offset = offset; - s->startx = current_vp->xmargin + x * s->width / s->len; + s->startx = x * s->width / s->len; s->backward = false; lcd_scroll_info.lines++; @@ -1206,7 +1188,7 @@ pf = font_get(current_vp->font); xpos = s->startx; - ypos = current_vp->ymargin + s->y * pf->height; + ypos = s->y * pf->height; if (s->bidir) { /* scroll bidirectional */ if (s->offset <= 0) { Index: firmware/drivers/lcd-2bit-horz.c =================================================================== --- firmware/drivers/lcd-2bit-horz.c (revision 17684) +++ firmware/drivers/lcd-2bit-horz.c (working copy) @@ -54,8 +54,6 @@ .height = LCD_HEIGHT, .font = FONT_SYSFIXED, .drawmode = DRMODE_SOLID, - .xmargin = 0, - .ymargin = 0, .fg_pattern = LCD_DEFAULT_FG, .bg_pattern = LCD_DEFAULT_BG }; @@ -141,22 +139,6 @@ lcd_set_background(bg_brightness); } -void lcd_setmargins(int x, int y) -{ - current_vp->xmargin = x; - current_vp->ymargin = y; -} - -int lcd_getxmargin(void) -{ - return current_vp->xmargin; -} - -int lcd_getymargin(void) -{ - return current_vp->ymargin; -} - int lcd_getwidth(void) { return current_vp->width; @@ -950,8 +932,8 @@ return; lcd_getstringsize(str, &w, &h); - xpos = current_vp->xmargin + x*w / utf8length((char *)str); - ypos = current_vp->ymargin + y*h; + xpos = x*w / utf8length((char *)str); + ypos = y*h; current_vp->drawmode = (style & STYLE_INVERT) ? (DRMODE_SOLID|DRMODE_INVERSEVID) : DRMODE_SOLID; lcd_putsxyofs(xpos, ypos, offset, str); @@ -1003,7 +985,7 @@ lcd_getstringsize(string, &w, &h); - if (current_vp->width - x * 8 - current_vp->xmargin < w) { + if (current_vp->width - x * 8 < w) { /* prepare scroll line */ char *end; @@ -1016,7 +998,7 @@ /* scroll bidirectional or forward only depending on the string width */ if ( lcd_scroll_info.bidir_limit ) { - s->bidir = s->width < (current_vp->width - current_vp->xmargin) * + s->bidir = s->width < (current_vp->width) * (100 + lcd_scroll_info.bidir_limit) / 100; } else @@ -1035,7 +1017,7 @@ s->y = y; s->len = utf8length((char *)string); s->offset = offset; - s->startx = current_vp->xmargin + x * s->width / s->len;; + s->startx = x * s->width / s->len;; s->backward = false; lcd_scroll_info.lines++; } @@ -1066,7 +1048,7 @@ pf = font_get(current_vp->font); xpos = s->startx; - ypos = current_vp->ymargin + s->y * pf->height; + ypos = s->y * pf->height; if (s->bidir) { /* scroll bidirectional */ if (s->offset <= 0) { Index: firmware/drivers/lcd-2bit-vi.c =================================================================== --- firmware/drivers/lcd-2bit-vi.c (revision 17684) +++ firmware/drivers/lcd-2bit-vi.c (working copy) @@ -60,8 +60,6 @@ .height = LCDM(HEIGHT), .font = FONT_SYSFIXED, .drawmode = DRMODE_SOLID, - .xmargin = 0, - .ymargin = 0, .fg_pattern = LCDM(DEFAULT_FG), .bg_pattern = LCDM(DEFAULT_BG) }; @@ -175,23 +173,6 @@ { return current_vp->height; } - -void LCDFN(setmargins)(int x, int y) -{ - current_vp->xmargin = x; - current_vp->ymargin = y; -} - -int LCDFN(getxmargin)(void) -{ - return current_vp->xmargin; -} - -int LCDFN(getymargin)(void) -{ - return current_vp->ymargin; -} - void LCDFN(setfont)(int newfont) { current_vp->font = newfont; @@ -1105,8 +1086,8 @@ return; LCDFN(getstringsize)(str, &w, &h); - xpos = current_vp->xmargin + x*w / utf8length((char *)str); - ypos = current_vp->ymargin + y*h; + xpos = x*w / utf8length((char *)str); + ypos = y*h; current_vp->drawmode = (style & STYLE_INVERT) ? (DRMODE_SOLID|DRMODE_INVERSEVID) : DRMODE_SOLID; LCDFN(putsxyofs)(xpos, ypos, offset, str); @@ -1158,7 +1139,7 @@ LCDFN(getstringsize)(string, &w, &h); - if (current_vp->width - x * 8 - current_vp->xmargin < w) { + if (current_vp->width - x * 8 < w) { /* prepare scroll line */ char *end; @@ -1171,7 +1152,7 @@ /* scroll bidirectional or forward only depending on the string width */ if ( LCDFN(scroll_info).bidir_limit ) { - s->bidir = s->width < (current_vp->width - current_vp->xmargin) * + s->bidir = s->width < (current_vp->width) * (100 + LCDFN(scroll_info).bidir_limit) / 100; } else @@ -1190,7 +1171,7 @@ s->y = y; s->len = utf8length((char *)string); s->offset = offset; - s->startx = current_vp->xmargin + x * s->width / s->len; + s->startx = x * s->width / s->len; s->backward = false; LCDFN(scroll_info).lines++; @@ -1222,7 +1203,7 @@ pf = font_get(current_vp->font); xpos = s->startx; - ypos = current_vp->ymargin + s->y * pf->height; + ypos = s->y * pf->height; if (s->bidir) { /* scroll bidirectional */ if (s->offset <= 0) { Index: firmware/drivers/lcd-16bit.c =================================================================== --- firmware/drivers/lcd-16bit.c (revision 17684) +++ firmware/drivers/lcd-16bit.c (working copy) @@ -61,8 +61,6 @@ .height = LCD_HEIGHT, .font = FONT_SYSFIXED, .drawmode = DRMODE_SOLID, - .xmargin = 0, - .ymargin = 0, .fg_pattern = LCD_DEFAULT_FG, .bg_pattern = LCD_DEFAULT_BG, .lss_pattern = LCD_DEFAULT_BG, @@ -180,12 +178,6 @@ current_vp->bg_pattern = bg_color; } -void lcd_setmargins(int x, int y) -{ - current_vp->xmargin = x; - current_vp->ymargin = y; -} - int lcd_getwidth(void) { return current_vp->width; @@ -196,16 +188,6 @@ return current_vp->height; } -int lcd_getxmargin(void) -{ - return current_vp->xmargin; -} - -int lcd_getymargin(void) -{ - return current_vp->ymargin; -} - void lcd_setfont(int newfont) { current_vp->font = newfont; @@ -1005,8 +987,8 @@ return; lcd_getstringsize(str, &w, &h); - xpos = current_vp->xmargin + x*w / utf8length(str); - ypos = current_vp->ymargin + y*h; + xpos = x*w / utf8length(str); + ypos = y*h; current_vp->drawmode = (style & STYLE_INVERT) ? (DRMODE_SOLID|DRMODE_INVERSEVID) : DRMODE_SOLID; if (style & STYLE_COLORED) { @@ -1081,7 +1063,7 @@ lcd_getstringsize(string, &w, &h); - if (current_vp->width - x * 8 - current_vp->xmargin < w) { + if (current_vp->width - x * 8 < w) { /* prepare scroll line */ char *end; @@ -1094,7 +1076,7 @@ /* scroll bidirectional or forward only depending on the string width */ if ( lcd_scroll_info.bidir_limit ) { - s->bidir = s->width < (current_vp->width - current_vp->xmargin) * + s->bidir = s->width < (current_vp->width) * (100 + lcd_scroll_info.bidir_limit) / 100; } else @@ -1113,7 +1095,7 @@ s->y = y; s->len = utf8length(string); s->offset = offset; - s->startx = current_vp->xmargin + x * s->width / s->len; + s->startx = x * s->width / s->len; s->backward = false; lcd_scroll_info.lines++; } @@ -1159,7 +1141,7 @@ pf = font_get(current_vp->font); xpos = s->startx; - ypos = current_vp->ymargin + s->y * pf->height; + ypos = s->y * pf->height; if (s->bidir) { /* scroll bidirectional */ if (s->offset <= 0) {