summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--apps/debug_menu.c16
-rw-r--r--apps/gui/gwps-common.c23
-rw-r--r--apps/gui/gwps.c69
-rw-r--r--apps/gui/gwps.h1
-rw-r--r--apps/gui/icon.c2
-rw-r--r--apps/gui/statusbar.h5
-rw-r--r--apps/gui/viewport.c2
-rw-r--r--apps/gui/wps_debug.c5
-rw-r--r--apps/gui/wps_parser.c69
-rw-r--r--apps/logfdisp.c1
-rw-r--r--apps/menus/display_menu.c3
-rw-r--r--apps/playlist.c9
-rw-r--r--apps/plugin.c29
-rw-r--r--apps/plugin.h20
-rw-r--r--apps/plugins/solitaire.c2
-rw-r--r--apps/plugins/test_codec.c1
-rw-r--r--apps/plugins/test_disk.c1
-rw-r--r--apps/plugins/test_fps.c2
-rw-r--r--apps/plugins/test_viewports.c18
-rw-r--r--apps/plugins/viewer.c4
-rw-r--r--apps/recorder/recording.c53
-rw-r--r--apps/screen_access.c6
-rw-r--r--apps/screen_access.h29
-rw-r--r--firmware/drivers/lcd-16bit.c30
-rw-r--r--firmware/drivers/lcd-1bit-vert.c30
-rw-r--r--firmware/drivers/lcd-2bit-horz.c30
-rw-r--r--firmware/drivers/lcd-2bit-vert.c30
-rw-r--r--firmware/drivers/lcd-2bit-vi.c31
-rw-r--r--firmware/drivers/lcd-charcell.c26
-rw-r--r--firmware/export/events.h1
-rw-r--r--firmware/export/lcd-remote.h3
-rw-r--r--firmware/export/lcd.h5
-rw-r--r--firmware/logf.c1
-rw-r--r--firmware/target/arm/imx31/debug-imx31.c2
-rw-r--r--firmware/target/arm/s3c2440/debug-s3c2440.c1
-rw-r--r--firmware/target/arm/tcc77x/debug-tcc77x.c1
-rw-r--r--firmware/target/arm/tcc780x/debug-tcc780x.c1
-rwxr-xr-xfirmware/target/arm/tms320dm320/debug-dm320.c1
38 files changed, 145 insertions, 418 deletions
diff --git a/apps/debug_menu.c b/apps/debug_menu.c
index 479ca34995..ab3075afc1 100644
--- a/apps/debug_menu.c
+++ b/apps/debug_menu.c
@@ -226,7 +226,6 @@ static bool dbg_audio_thread(void)
226 char buf[32]; 226 char buf[32];
227 struct audio_debug d; 227 struct audio_debug d;
228 228
229 lcd_setmargins(0, 0);
230 lcd_setfont(FONT_SYSFIXED); 229 lcd_setfont(FONT_SYSFIXED);
231 230
232 while(1) 231 while(1)
@@ -299,7 +298,6 @@ static bool dbg_buffering_thread(void)
299 298
300 tick_add_task(dbg_audio_task); 299 tick_add_task(dbg_audio_task);
301 300
302 lcd_setmargins(0, 0);
303 lcd_setfont(FONT_SYSFIXED); 301 lcd_setfont(FONT_SYSFIXED);
304 while(!done) 302 while(!done)
305 { 303 {
@@ -521,7 +519,6 @@ static bool dbg_hw_info(void)
521 519
522 system_memory_guard(oldmode); /* re-enable memory guard */ 520 system_memory_guard(oldmode); /* re-enable memory guard */
523 521
524 lcd_setmargins(0, 0);
525 lcd_setfont(FONT_SYSFIXED); 522 lcd_setfont(FONT_SYSFIXED);
526 lcd_clear_display(); 523 lcd_clear_display();
527 524
@@ -572,7 +569,6 @@ static bool dbg_hw_info(void)
572 569
573 system_memory_guard(oldmode); /* re-enable memory guard */ 570 system_memory_guard(oldmode); /* re-enable memory guard */
574 571
575 lcd_setmargins(0, 0);
576 lcd_setfont(FONT_SYSFIXED); 572 lcd_setfont(FONT_SYSFIXED);
577 lcd_clear_display(); 573 lcd_clear_display();
578 574
@@ -623,7 +619,6 @@ static bool dbg_hw_info(void)
623 (PP_VER1 >> 24) & 0xff, (PP_VER1 >> 16) & 0xff, 619 (PP_VER1 >> 24) & 0xff, (PP_VER1 >> 16) & 0xff,
624 (PP_VER1 >> 8) & 0xff, (PP_VER1) & 0xff, '\0' }; 620 (PP_VER1 >> 8) & 0xff, (PP_VER1) & 0xff, '\0' };
625 621
626 lcd_setmargins(0, 0);
627 lcd_setfont(FONT_SYSFIXED); 622 lcd_setfont(FONT_SYSFIXED);
628 lcd_clear_display(); 623 lcd_clear_display();
629 624
@@ -660,7 +655,6 @@ static bool dbg_hw_info(void)
660 (PP_VER1 >> 8) & 0xff, PP_VER1 & 0xff, '\0' }; 655 (PP_VER1 >> 8) & 0xff, PP_VER1 & 0xff, '\0' };
661 656
662 657
663 lcd_setmargins(0, 0);
664 lcd_setfont(FONT_SYSFIXED); 658 lcd_setfont(FONT_SYSFIXED);
665 lcd_clear_display(); 659 lcd_clear_display();
666 660
@@ -823,7 +817,6 @@ static bool dbg_spdif(void)
823 int spdif_source = spdif_get_output_source(&spdif_src_on); 817 int spdif_source = spdif_get_output_source(&spdif_src_on);
824 spdif_set_output_source(AUDIO_SRC_SPDIF IF_SPDIF_POWER_(, true)); 818 spdif_set_output_source(AUDIO_SRC_SPDIF IF_SPDIF_POWER_(, true));
825 819
826 lcd_setmargins(0, 0);
827 lcd_clear_display(); 820 lcd_clear_display();
828 lcd_setfont(FONT_SYSFIXED); 821 lcd_setfont(FONT_SYSFIXED);
829 822
@@ -1033,7 +1026,6 @@ bool dbg_ports(void)
1033 int adc_battery_voltage, adc_battery_level; 1026 int adc_battery_voltage, adc_battery_level;
1034 1027
1035 lcd_setfont(FONT_SYSFIXED); 1028 lcd_setfont(FONT_SYSFIXED);
1036 lcd_setmargins(0, 0);
1037 lcd_clear_display(); 1029 lcd_clear_display();
1038 1030
1039 while(1) 1031 while(1)
@@ -1075,7 +1067,6 @@ bool dbg_ports(void)
1075 char buf[128]; 1067 char buf[128];
1076 int line; 1068 int line;
1077 1069
1078 lcd_setmargins(0, 0);
1079 lcd_clear_display(); 1070 lcd_clear_display();
1080 lcd_setfont(FONT_SYSFIXED); 1071 lcd_setfont(FONT_SYSFIXED);
1081 1072
@@ -1151,7 +1142,6 @@ bool dbg_ports(void)
1151 char buf[128]; 1142 char buf[128];
1152 int line; 1143 int line;
1153 1144
1154 lcd_setmargins(0, 0);
1155 lcd_clear_display(); 1145 lcd_clear_display();
1156 lcd_setfont(FONT_SYSFIXED); 1146 lcd_setfont(FONT_SYSFIXED);
1157 1147
@@ -1248,7 +1238,6 @@ bool dbg_ports(void)
1248 char buf[128]; 1238 char buf[128];
1249 int line; 1239 int line;
1250 1240
1251 lcd_setmargins(0, 0);
1252 lcd_clear_display(); 1241 lcd_clear_display();
1253 lcd_setfont(FONT_SYSFIXED); 1242 lcd_setfont(FONT_SYSFIXED);
1254 1243
@@ -1374,7 +1363,6 @@ static bool dbg_pcf(void)
1374 int line; 1363 int line;
1375 1364
1376#ifdef HAVE_LCD_BITMAP 1365#ifdef HAVE_LCD_BITMAP
1377 lcd_setmargins(0, 0);
1378 lcd_setfont(FONT_SYSFIXED); 1366 lcd_setfont(FONT_SYSFIXED);
1379#endif 1367#endif
1380 lcd_clear_display(); 1368 lcd_clear_display();
@@ -1429,7 +1417,6 @@ static bool dbg_cpufreq(void)
1429 int button; 1417 int button;
1430 1418
1431#ifdef HAVE_LCD_BITMAP 1419#ifdef HAVE_LCD_BITMAP
1432 lcd_setmargins(0, 0);
1433 lcd_setfont(FONT_SYSFIXED); 1420 lcd_setfont(FONT_SYSFIXED);
1434#endif 1421#endif
1435 lcd_clear_display(); 1422 lcd_clear_display();
@@ -1559,7 +1546,6 @@ static bool view_battery(void)
1559 unsigned short maxv, minv; 1546 unsigned short maxv, minv;
1560 char buf[32]; 1547 char buf[32];
1561 1548
1562 lcd_setmargins(0, 0);
1563 lcd_setfont(FONT_SYSFIXED); 1549 lcd_setfont(FONT_SYSFIXED);
1564 1550
1565 while(1) 1551 while(1)
@@ -2316,7 +2302,6 @@ static bool cpu_boost_log(void)
2316 int lines = LCD_HEIGHT/SYSFONT_HEIGHT; 2302 int lines = LCD_HEIGHT/SYSFONT_HEIGHT;
2317 char *str; 2303 char *str;
2318 bool done; 2304 bool done;
2319 lcd_setmargins(0, 0);
2320 lcd_setfont(FONT_SYSFIXED); 2305 lcd_setfont(FONT_SYSFIXED);
2321 str = cpu_boost_log_getlog_first(); 2306 str = cpu_boost_log_getlog_first();
2322 while (i < count) 2307 while (i < count)
@@ -2369,7 +2354,6 @@ static bool dbg_scrollwheel(void)
2369 char buf[64]; 2354 char buf[64];
2370 unsigned int speed; 2355 unsigned int speed;
2371 2356
2372 lcd_setmargins(0, 0);
2373 lcd_setfont(FONT_SYSFIXED); 2357 lcd_setfont(FONT_SYSFIXED);
2374 2358
2375 while (1) 2359 while (1)
diff --git a/apps/gui/gwps-common.c b/apps/gui/gwps-common.c
index 6e159b88b4..b53d68d6ba 100644
--- a/apps/gui/gwps-common.c
+++ b/apps/gui/gwps-common.c
@@ -345,7 +345,6 @@ bool gui_wps_display(void)
345 /* Update the values in the first (default) viewport - in case the user 345 /* Update the values in the first (default) viewport - in case the user
346 has modified the statusbar or colour settings */ 346 has modified the statusbar or colour settings */
347#ifdef HAVE_LCD_BITMAP 347#ifdef HAVE_LCD_BITMAP
348 gui_wps[i].data->viewports[0].vp.ymargin = gui_wps[i].display->getymargin();
349#if LCD_DEPTH > 1 348#if LCD_DEPTH > 1
350 if (gui_wps[i].display->depth > 1) 349 if (gui_wps[i].display->depth > 1)
351 { 350 {
@@ -1408,14 +1407,6 @@ static char *get_token_value(struct gui_wps *gwps,
1408 else 1407 else
1409 return NULL; 1408 return NULL;
1410#endif 1409#endif
1411
1412#ifdef HAVE_LCD_BITMAP
1413 case WPS_TOKEN_LEFTMARGIN:
1414 gwps->display->setmargins(token->value.i,
1415 gwps->display->getymargin());
1416 return NULL;
1417#endif
1418
1419 default: 1410 default:
1420 return NULL; 1411 return NULL;
1421 } 1412 }
@@ -1529,11 +1520,6 @@ static bool get_line(struct gui_wps *gwps,
1529 align->center = NULL; 1520 align->center = NULL;
1530 align->right = NULL; 1521 align->right = NULL;
1531 1522
1532#ifdef HAVE_LCD_BITMAP
1533 /* Reset margins - only bitmap targets modify them */
1534 gwps->display->setmargins(0, gwps->display->getymargin());
1535#endif
1536
1537 /* Process all tokens of the desired subline */ 1523 /* Process all tokens of the desired subline */
1538 last_token_idx = wps_last_token_index(data, line, subline); 1524 last_token_idx = wps_last_token_index(data, line, subline);
1539 for (i = wps_first_token_index(data, line, subline); 1525 for (i = wps_first_token_index(data, line, subline);
@@ -1800,7 +1786,7 @@ static void write_line(struct screen *display,
1800 &center_width, &string_height); 1786 &center_width, &string_height);
1801 } 1787 }
1802 1788
1803 left_xpos = display->getxmargin(); 1789 left_xpos = 0;
1804 right_xpos = (display->getwidth() - right_width); 1790 right_xpos = (display->getwidth() - right_width);
1805 center_xpos = (display->getwidth() + left_xpos - center_width) / 2; 1791 center_xpos = (display->getwidth() + left_xpos - center_width) / 2;
1806 1792
@@ -1885,7 +1871,7 @@ static void write_line(struct screen *display,
1885 right_width = 0; 1871 right_width = 0;
1886 } 1872 }
1887 1873
1888 ypos = (line * string_height) + display->getymargin(); 1874 ypos = (line * string_height);
1889 1875
1890 1876
1891 if (scroll && ((left_width > scroll_width) || 1877 if (scroll && ((left_width > scroll_width) ||
@@ -1968,7 +1954,8 @@ bool gui_wps_refresh(struct gui_wps *gwps,
1968 /* reset to first subline if refresh all flag is set */ 1954 /* reset to first subline if refresh all flag is set */
1969 if (refresh_mode == WPS_REFRESH_ALL) 1955 if (refresh_mode == WPS_REFRESH_ALL)
1970 { 1956 {
1971 display->clear_display(); 1957 display->set_viewport(&data->viewports[0].vp);
1958 display->clear_viewport();
1972 1959
1973 for (i = 0; i <= data->num_lines; i++) 1960 for (i = 0; i <= data->num_lines; i++)
1974 { 1961 {
@@ -2063,7 +2050,7 @@ bool gui_wps_refresh(struct gui_wps *gwps,
2063 update_line = false; 2050 update_line = false;
2064 2051
2065 int h = font_get(data->viewports[v].vp.font)->height; 2052 int h = font_get(data->viewports[v].vp.font)->height;
2066 int peak_meter_y = display->getymargin() + (line - data->viewports[v].first_line)* h; 2053 int peak_meter_y = (line - data->viewports[v].first_line)* h;
2067 2054
2068 /* The user might decide to have the peak meter in the last 2055 /* The user might decide to have the peak meter in the last
2069 line so that it is only displayed if no status bar is 2056 line so that it is only displayed if no status bar is
diff --git a/apps/gui/gwps.c b/apps/gui/gwps.c
index 5426c937c0..31b1989786 100644
--- a/apps/gui/gwps.c
+++ b/apps/gui/gwps.c
@@ -77,19 +77,6 @@ static void gui_wps_set_disp(struct gui_wps *gui_wps, struct screen *display);
77/* connects a wps with a statusbar*/ 77/* connects a wps with a statusbar*/
78static void gui_wps_set_statusbar(struct gui_wps *gui_wps, struct gui_statusbar *statusbar); 78static void gui_wps_set_statusbar(struct gui_wps *gui_wps, struct gui_statusbar *statusbar);
79 79
80#ifdef HAVE_LCD_BITMAP
81static void gui_wps_set_margin(struct gui_wps *gwps)
82{
83 int offset = 0;
84 struct wps_data *data = gwps->data;
85 if(data->wps_sb_tag && data->show_sb_on_wps)
86 offset = STATUSBAR_HEIGHT;
87 else if ( global_settings.statusbar && !data->wps_sb_tag)
88 offset = STATUSBAR_HEIGHT;
89 gwps->display->setmargins(0, offset);
90}
91#endif
92
93static void prev_track(unsigned skip_thresh) 80static void prev_track(unsigned skip_thresh)
94{ 81{
95 if (!wps_state.id3 || (wps_state.id3->elapsed < skip_thresh*1000)) { 82 if (!wps_state.id3 || (wps_state.id3->elapsed < skip_thresh*1000)) {
@@ -152,10 +139,6 @@ long gui_wps_show(void)
152 status_set_audio(true); 139 status_set_audio(true);
153 status_set_param(false); 140 status_set_param(false);
154#else 141#else
155 FOR_NB_SCREENS(i)
156 {
157 gui_wps_set_margin(&gui_wps[i]);
158 }
159#if LCD_DEPTH > 1 142#if LCD_DEPTH > 1
160 show_wps_backdrop(); 143 show_wps_backdrop();
161#endif /* LCD_DEPTH > 1 */ 144#endif /* LCD_DEPTH > 1 */
@@ -299,12 +282,6 @@ long gui_wps_show(void)
299#if defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1 282#if defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1
300 show_remote_wps_backdrop(); 283 show_remote_wps_backdrop();
301#endif 284#endif
302#ifdef HAVE_LCD_BITMAP
303 FOR_NB_SCREENS(i)
304 {
305 gui_wps_set_margin(&gui_wps[i]);
306 }
307#endif
308 restore = true; 285 restore = true;
309 break; 286 break;
310 287
@@ -558,12 +535,6 @@ long gui_wps_show(void)
558#if defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1 535#if defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1
559 show_remote_wps_backdrop(); 536 show_remote_wps_backdrop();
560#endif 537#endif
561#ifdef HAVE_LCD_BITMAP
562 FOR_NB_SCREENS(i)
563 {
564 gui_wps_set_margin(&gui_wps[i]);
565 }
566#endif
567 restore = true; 538 restore = true;
568 break; 539 break;
569#endif /* HAVE_QUICKSCREEN */ 540#endif /* HAVE_QUICKSCREEN */
@@ -579,12 +550,6 @@ long gui_wps_show(void)
579#endif 550#endif
580 if (quick_screen_f3(BUTTON_F3)) 551 if (quick_screen_f3(BUTTON_F3))
581 return SYS_USB_CONNECTED; 552 return SYS_USB_CONNECTED;
582#ifdef HAVE_LCD_BITMAP
583 FOR_NB_SCREENS(i)
584 {
585 gui_wps_set_margin(&gui_wps[i]);
586 }
587#endif
588 restore = true; 553 restore = true;
589 break; 554 break;
590#endif /* BUTTON_F3 */ 555#endif /* BUTTON_F3 */
@@ -643,12 +608,6 @@ long gui_wps_show(void)
643#if defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1 608#if defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1
644 show_remote_wps_backdrop(); 609 show_remote_wps_backdrop();
645#endif 610#endif
646#ifdef HAVE_LCD_BITMAP
647 FOR_NB_SCREENS(i)
648 {
649 gui_wps_set_margin(&gui_wps[i]);
650 }
651#endif
652 restore = true; 611 restore = true;
653 break; 612 break;
654 613
@@ -812,7 +771,32 @@ void gui_sync_wps_screen_init(void)
812 FOR_NB_SCREENS(i) 771 FOR_NB_SCREENS(i)
813 gui_wps_set_disp(&gui_wps[i], &screens[i]); 772 gui_wps_set_disp(&gui_wps[i], &screens[i]);
814} 773}
774#ifdef HAVE_LCD_BITMAP
775static void statusbar_toggle_handler(void *data)
776{
777 (void)data;
778 int i;
779 bool draw = global_settings.statusbar;
815 780
781 FOR_NB_SCREENS(i)
782 {
783 struct wps_viewport *vp = &gui_wps[i].data->viewports[0];
784 if (gui_wps[i].data->wps_sb_tag)
785 draw = gui_wps[i].data->show_sb_on_wps;
786 if (!global_settings.statusbar && !draw)
787 {
788 vp->vp.y = 0;
789 vp->vp.height = screens[i].height;
790 }
791 else
792 {
793 vp->vp.y = STATUSBAR_HEIGHT;
794 vp->vp.height = screens[i].height - STATUSBAR_HEIGHT;
795 }
796 }
797}
798#endif
799
816void gui_sync_wps_init(void) 800void gui_sync_wps_init(void)
817{ 801{
818 int i; 802 int i;
@@ -826,6 +810,9 @@ void gui_sync_wps_init(void)
826 gui_wps_set_data(&gui_wps[i], &wps_datas[i]); 810 gui_wps_set_data(&gui_wps[i], &wps_datas[i]);
827 gui_wps_set_statusbar(&gui_wps[i], &statusbars.statusbars[i]); 811 gui_wps_set_statusbar(&gui_wps[i], &statusbars.statusbars[i]);
828 } 812 }
813#ifdef HAVE_LCD_BITMAP
814 add_event(STATUSBAR_TOGGLE_EVENT, false, statusbar_toggle_handler);
815#endif
829#if LCD_DEPTH > 1 816#if LCD_DEPTH > 1
830 unload_wps_backdrop(); 817 unload_wps_backdrop();
831#endif 818#endif
diff --git a/apps/gui/gwps.h b/apps/gui/gwps.h
index 25cfc08505..ad0c4a53c4 100644
--- a/apps/gui/gwps.h
+++ b/apps/gui/gwps.h
@@ -136,7 +136,6 @@ enum wps_token_type {
136 WPS_TOKEN_ALIGN_LEFT, 136 WPS_TOKEN_ALIGN_LEFT,
137 WPS_TOKEN_ALIGN_CENTER, 137 WPS_TOKEN_ALIGN_CENTER,
138 WPS_TOKEN_ALIGN_RIGHT, 138 WPS_TOKEN_ALIGN_RIGHT,
139 WPS_TOKEN_LEFTMARGIN,
140 139
141 /* Sublines */ 140 /* Sublines */
142 WPS_TOKEN_SUBLINE_TIMEOUT, 141 WPS_TOKEN_SUBLINE_TIMEOUT,
diff --git a/apps/gui/icon.c b/apps/gui/icon.c
index 968d83548f..c8ac48de92 100644
--- a/apps/gui/icon.c
+++ b/apps/gui/icon.c
@@ -103,7 +103,7 @@ void screen_put_icon_with_offset(struct screen * display,
103 int screen = display->screen_type; 103 int screen = display->screen_type;
104 display->getstringsize((unsigned char *)"M", &width, &height); 104 display->getstringsize((unsigned char *)"M", &width, &height);
105 xpos = x*ICON_WIDTH(screen) + off_x; 105 xpos = x*ICON_WIDTH(screen) + off_x;
106 ypos = y*height + display->getymargin() + off_y; 106 ypos = y*height + off_y;
107 107
108 if ( height > ICON_HEIGHT(screen) )/* center the cursor */ 108 if ( height > ICON_HEIGHT(screen) )/* center the cursor */
109 ypos += (height - ICON_HEIGHT(screen)) / 2; 109 ypos += (height - ICON_HEIGHT(screen)) / 2;
diff --git a/apps/gui/statusbar.h b/apps/gui/statusbar.h
index 989d1cbe3c..57be2b1873 100644
--- a/apps/gui/statusbar.h
+++ b/apps/gui/statusbar.h
@@ -22,11 +22,16 @@
22 22
23#include "status.h" 23#include "status.h"
24#include "screen_access.h" 24#include "screen_access.h"
25#include "events.h"
25 26
26#define STATUSBAR_X_POS 0 27#define STATUSBAR_X_POS 0
27#define STATUSBAR_Y_POS 0 /* MUST be a multiple of 8 */ 28#define STATUSBAR_Y_POS 0 /* MUST be a multiple of 8 */
28#define STATUSBAR_HEIGHT 8 29#define STATUSBAR_HEIGHT 8
29 30
31/* possibly a horrible misuse of the event system.
32 This is triggered when the statusbar setting changes */
33#define STATUSBAR_TOGGLE_EVENT (EVENT_CLASS_GUI|1)
34
30struct status_info { 35struct status_info {
31 int battlevel; 36 int battlevel;
32 int batt_charge_step; 37 int batt_charge_step;
diff --git a/apps/gui/viewport.c b/apps/gui/viewport.c
index fbf520eed7..8f9998b2d6 100644
--- a/apps/gui/viewport.c
+++ b/apps/gui/viewport.c
@@ -45,8 +45,6 @@ int viewport_get_nb_lines(struct viewport *vp)
45 45
46void viewport_set_defaults(struct viewport *vp, enum screen_type screen) 46void viewport_set_defaults(struct viewport *vp, enum screen_type screen)
47{ 47{
48 vp->xmargin = 0;
49 vp->ymargin = 0;
50 vp->x = 0; 48 vp->x = 0;
51 vp->width = screens[screen].width; 49 vp->width = screens[screen].width;
52 50
diff --git a/apps/gui/wps_debug.c b/apps/gui/wps_debug.c
index 4fa12167f2..f5ac27ade3 100644
--- a/apps/gui/wps_debug.c
+++ b/apps/gui/wps_debug.c
@@ -79,11 +79,6 @@ static char *get_token_desc(struct wps_token *token, struct wps_data *data,
79 case WPS_TOKEN_ALIGN_RIGHT: 79 case WPS_TOKEN_ALIGN_RIGHT:
80 snprintf(buf, bufsize, "align right"); 80 snprintf(buf, bufsize, "align right");
81 break; 81 break;
82
83 case WPS_TOKEN_LEFTMARGIN:
84 snprintf(buf, bufsize, "left margin, value: %d",
85 token->value.i);
86 break;
87#endif 82#endif
88 83
89 case WPS_TOKEN_SUBLINE_TIMEOUT: 84 case WPS_TOKEN_SUBLINE_TIMEOUT:
diff --git a/apps/gui/wps_parser.c b/apps/gui/wps_parser.c
index c6b0d447e9..805379152f 100644
--- a/apps/gui/wps_parser.c
+++ b/apps/gui/wps_parser.c
@@ -133,8 +133,6 @@ static int parse_viewport_display(const char *wps_bufptr,
133 struct wps_token *token, struct wps_data *wps_data); 133 struct wps_token *token, struct wps_data *wps_data);
134static int parse_viewport(const char *wps_bufptr, 134static int parse_viewport(const char *wps_bufptr,
135 struct wps_token *token, struct wps_data *wps_data); 135 struct wps_token *token, struct wps_data *wps_data);
136static int parse_leftmargin(const char *wps_bufptr,
137 struct wps_token *token, struct wps_data *wps_data);
138static int parse_statusbar_enable(const char *wps_bufptr, 136static int parse_statusbar_enable(const char *wps_bufptr,
139 struct wps_token *token, struct wps_data *wps_data); 137 struct wps_token *token, struct wps_data *wps_data);
140static int parse_statusbar_disable(const char *wps_bufptr, 138static int parse_statusbar_disable(const char *wps_bufptr,
@@ -273,10 +271,6 @@ static const struct wps_tag all_tags[] = {
273 { WPS_TOKEN_PLAYBACK_STATUS, "mp", WPS_REFRESH_DYNAMIC, NULL }, 271 { WPS_TOKEN_PLAYBACK_STATUS, "mp", WPS_REFRESH_DYNAMIC, NULL },
274 272
275#ifdef HAVE_LCD_BITMAP 273#ifdef HAVE_LCD_BITMAP
276 { WPS_TOKEN_LEFTMARGIN, "m", 0, parse_leftmargin },
277#endif
278
279#ifdef HAVE_LCD_BITMAP
280 { WPS_TOKEN_PEAKMETER, "pm", WPS_REFRESH_PEAK_METER, NULL }, 274 { WPS_TOKEN_PEAKMETER, "pm", WPS_REFRESH_PEAK_METER, NULL },
281#else 275#else
282 { WPS_TOKEN_PLAYER_PROGRESSBAR, "pf", 276 { WPS_TOKEN_PLAYER_PROGRESSBAR, "pf",
@@ -368,6 +362,11 @@ static int parse_statusbar_enable(const char *wps_bufptr,
368 (void)token; /* Kill warnings */ 362 (void)token; /* Kill warnings */
369 wps_data->wps_sb_tag = true; 363 wps_data->wps_sb_tag = true;
370 wps_data->show_sb_on_wps = true; 364 wps_data->show_sb_on_wps = true;
365 if (wps_data->viewports[0].vp.y == 0)
366 {
367 wps_data->viewports[0].vp.y = STATUSBAR_HEIGHT;
368 wps_data->viewports[0].vp.height -= STATUSBAR_HEIGHT;
369 }
371 return skip_end_of_line(wps_bufptr); 370 return skip_end_of_line(wps_bufptr);
372} 371}
373 372
@@ -378,6 +377,11 @@ static int parse_statusbar_disable(const char *wps_bufptr,
378 (void)token; /* Kill warnings */ 377 (void)token; /* Kill warnings */
379 wps_data->wps_sb_tag = true; 378 wps_data->wps_sb_tag = true;
380 wps_data->show_sb_on_wps = false; 379 wps_data->show_sb_on_wps = false;
380 if (wps_data->viewports[0].vp.y == STATUSBAR_HEIGHT)
381 {
382 wps_data->viewports[0].vp.y = 0;
383 wps_data->viewports[0].vp.height += STATUSBAR_HEIGHT;
384 }
381 return skip_end_of_line(wps_bufptr); 385 return skip_end_of_line(wps_bufptr);
382} 386}
383 387
@@ -616,8 +620,6 @@ static int parse_viewport(const char *wps_bufptr,
616 620
617 /* Set the defaults for fields not user-specified */ 621 /* Set the defaults for fields not user-specified */
618 vp->drawmode = DRMODE_SOLID; 622 vp->drawmode = DRMODE_SOLID;
619 vp->xmargin = 0;
620 vp->ymargin = 0;
621 623
622 /* Work out the depth of this display */ 624 /* Work out the depth of this display */
623#ifdef HAVE_REMOTE_LCD 625#ifdef HAVE_REMOTE_LCD
@@ -818,16 +820,6 @@ static int parse_progressbar(const char *wps_bufptr,
818 int line_y_pos = font_height*(wps_data->num_lines - 820 int line_y_pos = font_height*(wps_data->num_lines -
819 wps_data->viewports[wps_data->num_viewports].first_line); 821 wps_data->viewports[wps_data->num_viewports].first_line);
820 822
821 /** Remove this bit when the remove lcd margins patch goes in **/
822 bool draw_sb = global_settings.statusbar;
823
824 if (wps_data->wps_sb_tag)
825 draw_sb = wps_data->show_sb_on_wps;
826
827 if (wps_data->num_viewports == 0 && draw_sb)
828 line_y_pos += STATUSBAR_HEIGHT;
829 /** Remove the above bit when the remove lcd margins patch goes in **/
830
831 if (wps_data->progressbar_count +1 >= MAX_PROGRESSBARS) 823 if (wps_data->progressbar_count +1 >= MAX_PROGRESSBARS)
832 return WPS_ERROR_INVALID_PARAM; 824 return WPS_ERROR_INVALID_PARAM;
833 825
@@ -1106,33 +1098,6 @@ static int parse_albumart_conditional(const char *wps_bufptr,
1106}; 1098};
1107#endif /* HAVE_ALBUMART */ 1099#endif /* HAVE_ALBUMART */
1108 1100
1109#ifdef HAVE_LCD_BITMAP
1110static int parse_leftmargin(const char *wps_bufptr, struct wps_token *token,
1111 struct wps_data *wps_data)
1112{
1113 const char* p;
1114 const char* pend;
1115 const char *newline;
1116
1117 (void)wps_data; /* Kill the warning */
1118
1119 /* valid tag looks like %m|12| */
1120 if(*wps_bufptr == '|')
1121 {
1122 p = wps_bufptr + 1;
1123 newline = strchr(wps_bufptr, '\n');
1124 if(isdigit(*p) && (pend = strchr(p, '|')) && pend < newline)
1125 {
1126 token->value.i = atoi(p);
1127 return pend - wps_bufptr + 1;
1128 }
1129 }
1130
1131 /* invalid tag syntax */
1132 return WPS_ERROR_INVALID_PARAM;
1133}
1134#endif
1135
1136 1101
1137/* Parse a generic token from the given string. Return the length read */ 1102/* Parse a generic token from the given string. Return the length read */
1138static int parse_token(const char *wps_bufptr, struct wps_data *wps_data) 1103static int parse_token(const char *wps_bufptr, struct wps_data *wps_data)
@@ -1583,15 +1548,21 @@ bool wps_data_load(struct wps_data *wps_data,
1583 1548
1584 /* Initialise the first (default) viewport */ 1549 /* Initialise the first (default) viewport */
1585 wps_data->viewports[0].vp.x = 0; 1550 wps_data->viewports[0].vp.x = 0;
1586 wps_data->viewports[0].vp.y = 0;
1587 wps_data->viewports[0].vp.width = display->width; 1551 wps_data->viewports[0].vp.width = display->width;
1588 wps_data->viewports[0].vp.height = display->height; 1552 if (!global_settings.statusbar)
1553 {
1554 wps_data->viewports[0].vp.y = 0;
1555 wps_data->viewports[0].vp.height = display->height;
1556 }
1557 else
1558 {
1559 wps_data->viewports[0].vp.y = STATUSBAR_HEIGHT;
1560 wps_data->viewports[0].vp.height = display->height - STATUSBAR_HEIGHT;
1561 }
1589#ifdef HAVE_LCD_BITMAP 1562#ifdef HAVE_LCD_BITMAP
1590 wps_data->viewports[0].vp.font = FONT_UI; 1563 wps_data->viewports[0].vp.font = FONT_UI;
1591 wps_data->viewports[0].vp.drawmode = DRMODE_SOLID; 1564 wps_data->viewports[0].vp.drawmode = DRMODE_SOLID;
1592#endif 1565#endif
1593 wps_data->viewports[0].vp.xmargin = display->getxmargin();
1594 wps_data->viewports[0].vp.ymargin = display->getymargin();
1595#if LCD_DEPTH > 1 1566#if LCD_DEPTH > 1
1596 if (display->depth > 1) 1567 if (display->depth > 1)
1597 { 1568 {
diff --git a/apps/logfdisp.c b/apps/logfdisp.c
index 4a5ab43089..2bdc613136 100644
--- a/apps/logfdisp.c
+++ b/apps/logfdisp.c
@@ -66,7 +66,6 @@ bool logfdisplay(void)
66 if(!lines) 66 if(!lines)
67 return false; 67 return false;
68 68
69 lcd_setmargins(0, 0);
70 lcd_clear_display(); 69 lcd_clear_display();
71 70
72 do { 71 do {
diff --git a/apps/menus/display_menu.c b/apps/menus/display_menu.c
index 5ba8c2ecb1..e52a6c98ad 100644
--- a/apps/menus/display_menu.c
+++ b/apps/menus/display_menu.c
@@ -21,6 +21,7 @@
21#include <stddef.h> 21#include <stddef.h>
22#include <limits.h> 22#include <limits.h>
23#include "config.h" 23#include "config.h"
24#include "events.h"
24#include "lang.h" 25#include "lang.h"
25#include "action.h" 26#include "action.h"
26#include "settings.h" 27#include "settings.h"
@@ -35,6 +36,7 @@
35#include "lcd.h" 36#include "lcd.h"
36#include "lcd-remote.h" 37#include "lcd-remote.h"
37#include "backdrop.h" 38#include "backdrop.h"
39#include "statusbar.h"
38 40
39#ifdef HAVE_BACKLIGHT 41#ifdef HAVE_BACKLIGHT
40static int filterfirstkeypress_callback(int action,const struct menu_item_ex *this_item) 42static int filterfirstkeypress_callback(int action,const struct menu_item_ex *this_item)
@@ -300,6 +302,7 @@ static int statusbar_callback(int action,const struct menu_item_ex *this_item)
300 switch (action) 302 switch (action)
301 { 303 {
302 case ACTION_EXIT_MENUITEM: 304 case ACTION_EXIT_MENUITEM:
305 send_event(STATUSBAR_TOGGLE_EVENT, NULL);
303 /* this should be changed so only the viewports are reloaded */ 306 /* this should be changed so only the viewports are reloaded */
304 settings_apply(false); 307 settings_apply(false);
305 break; 308 break;
diff --git a/apps/playlist.c b/apps/playlist.c
index 30fd0f11e9..83bce9036b 100644
--- a/apps/playlist.c
+++ b/apps/playlist.c
@@ -1758,15 +1758,6 @@ static void display_playlist_count(int count, const unsigned char *fmt,
1758 } 1758 }
1759 fmt = P2STR(fmt); 1759 fmt = P2STR(fmt);
1760 1760
1761 lcd_clear_display();
1762
1763#ifdef HAVE_LCD_BITMAP
1764 if(global_settings.statusbar)
1765 lcd_setmargins(0, STATUSBAR_HEIGHT);
1766 else
1767 lcd_setmargins(0, 0);
1768#endif
1769
1770 gui_syncsplash(0, fmt, count, str(LANG_OFF_ABORT)); 1761 gui_syncsplash(0, fmt, count, str(LANG_OFF_ABORT));
1771} 1762}
1772 1763
diff --git a/apps/plugin.c b/apps/plugin.c
index 9a435b24bc..21f6d178ea 100644
--- a/apps/plugin.c
+++ b/apps/plugin.c
@@ -75,7 +75,6 @@ static const struct plugin_api rockbox_api = {
75 lcd_set_contrast, 75 lcd_set_contrast,
76 lcd_update, 76 lcd_update,
77 lcd_clear_display, 77 lcd_clear_display,
78 lcd_setmargins,
79 lcd_getstringsize, 78 lcd_getstringsize,
80 lcd_putsxy, 79 lcd_putsxy,
81 lcd_puts, 80 lcd_puts,
@@ -131,6 +130,10 @@ static const struct plugin_api rockbox_api = {
131#ifdef HAVE_LCD_INVERT 130#ifdef HAVE_LCD_INVERT
132 lcd_set_invert_display, 131 lcd_set_invert_display,
133#endif /* HAVE_LCD_INVERT */ 132#endif /* HAVE_LCD_INVERT */
133#ifdef HAVE_LCD_ENABLE
134 lcd_set_enable_hook,
135 &button_queue,
136#endif
134 bidi_l2v, 137 bidi_l2v,
135 font_get_bits, 138 font_get_bits,
136 font_load, 139 font_load,
@@ -158,7 +161,6 @@ static const struct plugin_api rockbox_api = {
158 /* remote lcd */ 161 /* remote lcd */
159 lcd_remote_set_contrast, 162 lcd_remote_set_contrast,
160 lcd_remote_clear_display, 163 lcd_remote_clear_display,
161 lcd_remote_setmargins,
162 lcd_remote_puts, 164 lcd_remote_puts,
163 lcd_remote_puts_scroll, 165 lcd_remote_puts_scroll,
164 lcd_remote_stop_scroll, 166 lcd_remote_stop_scroll,
@@ -216,6 +218,8 @@ static const struct plugin_api rockbox_api = {
216 gui_synclist_limit_scroll, 218 gui_synclist_limit_scroll,
217 gui_synclist_do_button, 219 gui_synclist_do_button,
218 gui_synclist_set_title, 220 gui_synclist_set_title,
221 simplelist_info_init,
222 simplelist_show_list,
219 223
220 /* button */ 224 /* button */
221 button_get, 225 button_get,
@@ -598,13 +602,7 @@ static const struct plugin_api rockbox_api = {
598 602
599 /* new stuff at the end, sort into place next time 603 /* new stuff at the end, sort into place next time
600 the API gets incompatible */ 604 the API gets incompatible */
601 simplelist_info_init,
602 simplelist_show_list,
603 605
604#ifdef HAVE_LCD_ENABLE
605 lcd_set_enable_hook,
606 &button_queue,
607#endif
608}; 606};
609 607
610int plugin_load(const char* plugin, const void* parameter) 608int plugin_load(const char* plugin, const void* parameter)
@@ -620,10 +618,6 @@ int plugin_load(const char* plugin, const void* parameter)
620 unsigned my_core; 618 unsigned my_core;
621#endif 619#endif
622#endif /* !SIMULATOR */ 620#endif /* !SIMULATOR */
623 int xm, ym;
624#ifdef HAVE_REMOTE_LCD
625 int rxm, rym;
626#endif
627 621
628#if LCD_DEPTH > 1 622#if LCD_DEPTH > 1
629 fb_data* old_backdrop; 623 fb_data* old_backdrop;
@@ -705,10 +699,7 @@ int plugin_load(const char* plugin, const void* parameter)
705#endif 699#endif
706 700
707 plugin_loaded = true; 701 plugin_loaded = true;
708 702
709 xm = lcd_getxmargin();
710 ym = lcd_getymargin();
711 lcd_setmargins(0,0);
712 703
713#if defined HAVE_LCD_BITMAP && LCD_DEPTH > 1 704#if defined HAVE_LCD_BITMAP && LCD_DEPTH > 1
714 old_backdrop = lcd_get_backdrop(); 705 old_backdrop = lcd_get_backdrop();
@@ -717,9 +708,6 @@ int plugin_load(const char* plugin, const void* parameter)
717 lcd_update(); 708 lcd_update();
718 709
719#ifdef HAVE_REMOTE_LCD 710#ifdef HAVE_REMOTE_LCD
720 rxm = lcd_remote_getxmargin();
721 rym = lcd_remote_getymargin();
722 lcd_remote_setmargins(0, 0);
723 lcd_remote_clear_display(); 711 lcd_remote_clear_display();
724 lcd_remote_update(); 712 lcd_remote_update();
725#endif 713#endif
@@ -744,8 +732,6 @@ int plugin_load(const char* plugin, const void* parameter)
744#endif /* LCD_DEPTH */ 732#endif /* LCD_DEPTH */
745#endif /* HAVE_LCD_BITMAP */ 733#endif /* HAVE_LCD_BITMAP */
746 734
747 /* restore margins */
748 lcd_setmargins(xm,ym);
749 lcd_clear_display(); 735 lcd_clear_display();
750 lcd_update(); 736 lcd_update();
751 737
@@ -756,7 +742,6 @@ int plugin_load(const char* plugin, const void* parameter)
756#else 742#else
757 lcd_remote_set_drawmode(DRMODE_SOLID); 743 lcd_remote_set_drawmode(DRMODE_SOLID);
758#endif 744#endif
759 lcd_remote_setmargins(rxm, rym);
760 lcd_remote_clear_display(); 745 lcd_remote_clear_display();
761 746
762 747
diff --git a/apps/plugin.h b/apps/plugin.h
index edd54989da..4be76adfd1 100644
--- a/apps/plugin.h
+++ b/apps/plugin.h
@@ -124,12 +124,12 @@ void* plugin_get_buffer(size_t *buffer_size);
124#define PLUGIN_MAGIC 0x526F634B /* RocK */ 124#define PLUGIN_MAGIC 0x526F634B /* RocK */
125 125
126/* increase this every time the api struct changes */ 126/* increase this every time the api struct changes */
127#define PLUGIN_API_VERSION 116 127#define PLUGIN_API_VERSION 117
128 128
129/* update this to latest version if a change to the api struct breaks 129/* update this to latest version if a change to the api struct breaks
130 backwards compatibility (and please take the opportunity to sort in any 130 backwards compatibility (and please take the opportunity to sort in any
131 new function which are "waiting" at the end of the function table) */ 131 new function which are "waiting" at the end of the function table) */
132#define PLUGIN_MIN_API_VERSION 114 132#define PLUGIN_MIN_API_VERSION 117
133 133
134/* plugin return codes */ 134/* plugin return codes */
135enum plugin_status { 135enum plugin_status {
@@ -150,7 +150,6 @@ struct plugin_api {
150 void (*lcd_set_contrast)(int x); 150 void (*lcd_set_contrast)(int x);
151 void (*lcd_update)(void); 151 void (*lcd_update)(void);
152 void (*lcd_clear_display)(void); 152 void (*lcd_clear_display)(void);
153 void (*lcd_setmargins)(int x, int y);
154 int (*lcd_getstringsize)(const unsigned char *str, int *w, int *h); 153 int (*lcd_getstringsize)(const unsigned char *str, int *w, int *h);
155 void (*lcd_putsxy)(int x, int y, const unsigned char *string); 154 void (*lcd_putsxy)(int x, int y, const unsigned char *string);
156 void (*lcd_puts)(int x, int y, const unsigned char *string); 155 void (*lcd_puts)(int x, int y, const unsigned char *string);
@@ -220,6 +219,10 @@ struct plugin_api {
220 void (*lcd_set_invert_display)(bool yesno); 219 void (*lcd_set_invert_display)(bool yesno);
221#endif /* HAVE_LCD_INVERT */ 220#endif /* HAVE_LCD_INVERT */
222 221
222#ifdef HAVE_LCD_ENABLE
223 void (*lcd_set_enable_hook)(void (*enable_hook)(void));
224 struct event_queue *button_queue;
225#endif
223 unsigned short *(*bidi_l2v)( const unsigned char *str, int orientation ); 226 unsigned short *(*bidi_l2v)( const unsigned char *str, int orientation );
224 const unsigned char *(*font_get_bits)( struct font *pf, unsigned short char_code ); 227 const unsigned char *(*font_get_bits)( struct font *pf, unsigned short char_code );
225 struct font* (*font_load)(const char *path); 228 struct font* (*font_load)(const char *path);
@@ -253,7 +256,6 @@ struct plugin_api {
253 /* remote lcd */ 256 /* remote lcd */
254 void (*lcd_remote_set_contrast)(int x); 257 void (*lcd_remote_set_contrast)(int x);
255 void (*lcd_remote_clear_display)(void); 258 void (*lcd_remote_clear_display)(void);
256 void (*lcd_remote_setmargins)(int x, int y);
257 void (*lcd_remote_puts)(int x, int y, const unsigned char *string); 259 void (*lcd_remote_puts)(int x, int y, const unsigned char *string);
258 void (*lcd_remote_puts_scroll)(int x, int y, const unsigned char* string); 260 void (*lcd_remote_puts_scroll)(int x, int y, const unsigned char* string);
259 void (*lcd_remote_stop_scroll)(void); 261 void (*lcd_remote_stop_scroll)(void);
@@ -317,6 +319,9 @@ struct plugin_api {
317 bool (*gui_synclist_do_button)(struct gui_synclist * lists, 319 bool (*gui_synclist_do_button)(struct gui_synclist * lists,
318 unsigned *action, enum list_wrap wrap); 320 unsigned *action, enum list_wrap wrap);
319 void (*gui_synclist_set_title)(struct gui_synclist *lists, char* title, int icon); 321 void (*gui_synclist_set_title)(struct gui_synclist *lists, char* title, int icon);
322 void (*simplelist_info_init)(struct simplelist_info *info, char* title,
323 int count, void* data);
324 bool (*simplelist_show_list)(struct simplelist_info *info);
320 325
321 /* button */ 326 /* button */
322 long (*button_get)(bool block); 327 long (*button_get)(bool block);
@@ -748,14 +753,7 @@ struct plugin_api {
748 753
749 /* new stuff at the end, sort into place next time 754 /* new stuff at the end, sort into place next time
750 the API gets incompatible */ 755 the API gets incompatible */
751 void (*simplelist_info_init)(struct simplelist_info *info, char* title,
752 int count, void* data);
753 bool (*simplelist_show_list)(struct simplelist_info *info);
754 756
755#ifdef HAVE_LCD_ENABLE
756 void (*lcd_set_enable_hook)(void (*enable_hook)(void));
757 struct event_queue *button_queue;
758#endif
759}; 757};
760 758
761/* plugin header */ 759/* plugin header */
diff --git a/apps/plugins/solitaire.c b/apps/plugins/solitaire.c
index 94ef282698..e4e2a9ce45 100644
--- a/apps/plugins/solitaire.c
+++ b/apps/plugins/solitaire.c
@@ -744,7 +744,6 @@ int solitaire_menu(bool in_game)
744 break; 744 break;
745 745
746 case 2: 746 case 2:
747 rb->lcd_setmargins(0, 0);
748 if (solitaire_help() == HELP_USB) 747 if (solitaire_help() == HELP_USB)
749 result = MENU_USB; 748 result = MENU_USB;
750 break; 749 break;
@@ -766,7 +765,6 @@ int solitaire_menu(bool in_game)
766 } 765 }
767 } 766 }
768 menu_exit(m); 767 menu_exit(m);
769 rb->lcd_setmargins(0, 0);
770 return result; 768 return result;
771} 769}
772 770
diff --git a/apps/plugins/test_codec.c b/apps/plugins/test_codec.c
index 2379ebb1b7..31e8a319f9 100644
--- a/apps/plugins/test_codec.c
+++ b/apps/plugins/test_codec.c
@@ -44,7 +44,6 @@ static bool log_init(bool use_logfile)
44{ 44{
45 int h; 45 int h;
46 46
47 rb->lcd_setmargins(0, 0);
48 rb->lcd_getstringsize("A", NULL, &h); 47 rb->lcd_getstringsize("A", NULL, &h);
49 max_line = LCD_HEIGHT / h; 48 max_line = LCD_HEIGHT / h;
50 line = 0; 49 line = 0;
diff --git a/apps/plugins/test_disk.c b/apps/plugins/test_disk.c
index 93464807c3..06017a3c5c 100644
--- a/apps/plugins/test_disk.c
+++ b/apps/plugins/test_disk.c
@@ -77,7 +77,6 @@ static bool log_init(void)
77{ 77{
78 int h; 78 int h;
79 79
80 rb->lcd_setmargins(0, 0);
81 rb->lcd_getstringsize("A", NULL, &h); 80 rb->lcd_getstringsize("A", NULL, &h);
82 max_line = LCD_HEIGHT / h; 81 max_line = LCD_HEIGHT / h;
83 line = 0; 82 line = 0;
diff --git a/apps/plugins/test_fps.c b/apps/plugins/test_fps.c
index 0852e0a9fb..d5b34faeb9 100644
--- a/apps/plugins/test_fps.c
+++ b/apps/plugins/test_fps.c
@@ -57,14 +57,12 @@ static void log_init(void)
57{ 57{
58 int h; 58 int h;
59 59
60 rb->lcd_setmargins(0, 0);
61 rb->lcd_getstringsize("A", NULL, &h); 60 rb->lcd_getstringsize("A", NULL, &h);
62 max_line = LCD_HEIGHT / h; 61 max_line = LCD_HEIGHT / h;
63 line = 0; 62 line = 0;
64 rb->lcd_clear_display(); 63 rb->lcd_clear_display();
65 rb->lcd_update(); 64 rb->lcd_update();
66#ifdef HAVE_REMOTE_LCD 65#ifdef HAVE_REMOTE_LCD
67 rb->lcd_remote_setmargins(0, 0);
68 rb->lcd_remote_getstringsize("A", NULL, &h); 66 rb->lcd_remote_getstringsize("A", NULL, &h);
69 remote_max_line = LCD_REMOTE_HEIGHT / h; 67 remote_max_line = LCD_REMOTE_HEIGHT / h;
70 remote_line = 0; 68 remote_line = 0;
diff --git a/apps/plugins/test_viewports.c b/apps/plugins/test_viewports.c
index bb1b4b9af9..874ed6f52c 100644
--- a/apps/plugins/test_viewports.c
+++ b/apps/plugins/test_viewports.c
@@ -43,8 +43,6 @@ static struct viewport vp0 =
43 .height = 20, 43 .height = 20,
44 .font = FONT_UI, 44 .font = FONT_UI,
45 .drawmode = DRMODE_SOLID, 45 .drawmode = DRMODE_SOLID,
46 .xmargin = 0,
47 .ymargin = 0,
48#if LCD_DEPTH > 1 46#if LCD_DEPTH > 1
49 .fg_pattern = LCD_DEFAULT_FG, 47 .fg_pattern = LCD_DEFAULT_FG,
50 .bg_pattern = BGCOLOR_1, 48 .bg_pattern = BGCOLOR_1,
@@ -64,8 +62,6 @@ static struct viewport vp1 =
64 .height = LCD_HEIGHT / 2, 62 .height = LCD_HEIGHT / 2,
65 .font = FONT_SYSFIXED, 63 .font = FONT_SYSFIXED,
66 .drawmode = DRMODE_SOLID, 64 .drawmode = DRMODE_SOLID,
67 .xmargin = 0,
68 .ymargin = 0,
69#if LCD_DEPTH > 1 65#if LCD_DEPTH > 1
70 .fg_pattern = LCD_DEFAULT_FG, 66 .fg_pattern = LCD_DEFAULT_FG,
71 .bg_pattern = LCD_DEFAULT_BG, 67 .bg_pattern = LCD_DEFAULT_BG,
@@ -85,8 +81,6 @@ static struct viewport vp2 =
85 .height = (LCD_HEIGHT / 2), 81 .height = (LCD_HEIGHT / 2),
86 .font = FONT_UI, 82 .font = FONT_UI,
87 .drawmode = DRMODE_SOLID, 83 .drawmode = DRMODE_SOLID,
88 .xmargin = 0,
89 .ymargin = 0,
90#if LCD_DEPTH > 1 84#if LCD_DEPTH > 1
91 .fg_pattern = FGCOLOR_1, 85 .fg_pattern = FGCOLOR_1,
92 .bg_pattern = BGCOLOR_2, 86 .bg_pattern = BGCOLOR_2,
@@ -107,8 +101,6 @@ static struct viewport vp3 =
107 .height = (LCD_HEIGHT / 4), 101 .height = (LCD_HEIGHT / 4),
108 .font = FONT_SYSFIXED, 102 .font = FONT_SYSFIXED,
109 .drawmode = DRMODE_SOLID, 103 .drawmode = DRMODE_SOLID,
110 .xmargin = 0,
111 .ymargin = 0,
112#if LCD_DEPTH > 1 104#if LCD_DEPTH > 1
113 .fg_pattern = LCD_BLACK, 105 .fg_pattern = LCD_BLACK,
114 .bg_pattern = LCD_WHITE, 106 .bg_pattern = LCD_WHITE,
@@ -130,8 +122,6 @@ static struct viewport rvp0 =
130 .height = LCD_REMOTE_HEIGHT - 10, 122 .height = LCD_REMOTE_HEIGHT - 10,
131 .font = FONT_SYSFIXED, 123 .font = FONT_SYSFIXED,
132 .drawmode = DRMODE_SOLID, 124 .drawmode = DRMODE_SOLID,
133 .xmargin = 0,
134 .ymargin = 0,
135#if LCD_REMOTE_DEPTH > 1 125#if LCD_REMOTE_DEPTH > 1
136 .fg_pattern = LCD_REMOTE_BLACK, 126 .fg_pattern = LCD_REMOTE_BLACK,
137 .bg_pattern = LCD_REMOTE_LIGHTGRAY, 127 .bg_pattern = LCD_REMOTE_LIGHTGRAY,
@@ -146,8 +136,6 @@ static struct viewport rvp1 =
146 .height = LCD_REMOTE_HEIGHT - 10, 136 .height = LCD_REMOTE_HEIGHT - 10,
147 .font = FONT_SYSFIXED, 137 .font = FONT_SYSFIXED,
148 .drawmode = DRMODE_SOLID, 138 .drawmode = DRMODE_SOLID,
149 .xmargin = 0,
150 .ymargin = 0,
151#if LCD_REMOTE_DEPTH > 1 139#if LCD_REMOTE_DEPTH > 1
152 .fg_pattern = LCD_REMOTE_DEFAULT_FG, 140 .fg_pattern = LCD_REMOTE_DEFAULT_FG,
153 .bg_pattern = LCD_REMOTE_DEFAULT_BG 141 .bg_pattern = LCD_REMOTE_DEFAULT_BG
@@ -253,8 +241,6 @@ static struct viewport vp0 =
253 .y = 0, 241 .y = 0,
254 .width = 5, 242 .width = 5,
255 .height = 1, 243 .height = 1,
256 .xmargin = 0,
257 .ymargin = 0,
258}; 244};
259 245
260static struct viewport vp1 = 246static struct viewport vp1 =
@@ -263,8 +249,6 @@ static struct viewport vp1 =
263 .y = 0, 249 .y = 0,
264 .width = 5, 250 .width = 5,
265 .height = 1, 251 .height = 1,
266 .xmargin = 0,
267 .ymargin = 0,
268}; 252};
269 253
270static struct viewport vp2 = 254static struct viewport vp2 =
@@ -273,8 +257,6 @@ static struct viewport vp2 =
273 .y = 1, 257 .y = 1,
274 .width = LCD_WIDTH, 258 .width = LCD_WIDTH,
275 .height = 1, 259 .height = 1,
276 .xmargin = 0,
277 .ymargin = 0,
278}; 260};
279 261
280 262
diff --git a/apps/plugins/viewer.c b/apps/plugins/viewer.c
index d596f43b83..507efac6df 100644
--- a/apps/plugins/viewer.c
+++ b/apps/plugins/viewer.c
@@ -1421,7 +1421,6 @@ static bool viewer_options_menu(void)
1421 result = menu_run(m); 1421 result = menu_run(m);
1422 menu_exit(m); 1422 menu_exit(m);
1423#ifdef HAVE_LCD_BITMAP 1423#ifdef HAVE_LCD_BITMAP
1424 rb->lcd_setmargins(0,0);
1425 1424
1426 /* Show-scrollbar mode for current view-width mode */ 1425 /* Show-scrollbar mode for current view-width mode */
1427 init_need_scrollbar(); 1426 init_need_scrollbar();
@@ -1459,9 +1458,6 @@ static void viewer_menu(void)
1459 break; 1458 break;
1460 } 1459 }
1461 menu_exit(m); 1460 menu_exit(m);
1462#ifdef HAVE_LCD_BITMAP
1463 rb->lcd_setmargins(0,0);
1464#endif
1465 viewer_draw(col); 1461 viewer_draw(col);
1466} 1462}
1467 1463
diff --git a/apps/recorder/recording.c b/apps/recorder/recording.c
index 28b3a44b3a..ae2decf3d5 100644
--- a/apps/recorder/recording.c
+++ b/apps/recorder/recording.c
@@ -68,6 +68,7 @@
68#include "action.h" 68#include "action.h"
69#include "radio.h" 69#include "radio.h"
70#include "sound_menu.h" 70#include "sound_menu.h"
71#include "viewport.h"
71 72
72#ifdef HAVE_RECORDING 73#ifdef HAVE_RECORDING
73/* This array holds the record timer interval lengths, in seconds */ 74/* This array holds the record timer interval lengths, in seconds */
@@ -882,6 +883,8 @@ bool recording_screen(bool no_source)
882 883
883 int base_style = STYLE_INVERT; 884 int base_style = STYLE_INVERT;
884 int style; 885 int style;
886 struct viewport vp[NB_SCREENS];
887 int ymargin = global_settings.cursor_style?0:10;
885#ifdef HAVE_LCD_COLOR 888#ifdef HAVE_LCD_COLOR
886 if (global_settings.cursor_style == 2) { 889 if (global_settings.cursor_style == 2) {
887 base_style |= STYLE_COLORBAR; 890 base_style |= STYLE_COLORBAR;
@@ -956,11 +959,12 @@ bool recording_screen(bool no_source)
956 959
957 FOR_NB_SCREENS(i) 960 FOR_NB_SCREENS(i)
958 { 961 {
959 screens[i].setfont(FONT_SYSFIXED); 962 viewport_set_defaults(&vp[i], i);
963 vp[i].font = FONT_SYSFIXED;
964 screens[i].set_viewport(&vp[i]);
960 screens[i].getstringsize("M", &w, &h); 965 screens[i].getstringsize("M", &w, &h);
961 screens[i].setmargins(global_settings.cursor_style ? 0 : w, 8); 966 filename_offset[i] = ((vp[i].height >= 80) ? 1 : 0);
962 filename_offset[i] = ((screens[i].height >= 80) ? 1 : 0); 967 pm_y[i] = h * (2 + filename_offset[i]);
963 pm_y[i] = 8 + h * (2 + filename_offset[i]);
964 } 968 }
965 969
966#ifdef HAVE_REMOTE_LCD 970#ifdef HAVE_REMOTE_LCD
@@ -968,8 +972,8 @@ bool recording_screen(bool no_source)
968 { 972 {
969 screens[1].clear_display(); 973 screens[1].clear_display();
970 snprintf(buf, sizeof(buf), str(LANG_REMOTE_LCD_ON)); 974 snprintf(buf, sizeof(buf), str(LANG_REMOTE_LCD_ON));
971 screens[1].puts((screens[1].width/w - strlen(buf))/2 + 1, 975 screens[1].puts((vp[1].width/w - strlen(buf))/2 + 1,
972 screens[1].height/(h*2) + 1, buf); 976 vp[1].height/(h*2) + 1, buf);
973 screens[1].update(); 977 screens[1].update();
974 gui_syncsplash(0, str(LANG_REMOTE_LCD_OFF)); 978 gui_syncsplash(0, str(LANG_REMOTE_LCD_OFF));
975 } 979 }
@@ -1363,9 +1367,8 @@ bool recording_screen(bool no_source)
1363 1367
1364 FOR_NB_SCREENS(i) 1368 FOR_NB_SCREENS(i)
1365 { 1369 {
1370 screens[i].set_viewport(&vp[i]);
1366 screens[i].setfont(FONT_SYSFIXED); 1371 screens[i].setfont(FONT_SYSFIXED);
1367 screens[i].setmargins(
1368 global_settings.cursor_style ? 0 : w, 8);
1369 } 1372 }
1370 } 1373 }
1371 } 1374 }
@@ -1613,7 +1616,9 @@ bool recording_screen(bool no_source)
1613 else 1616 else
1614 { 1617 {
1615 for(i = 0; i < screen_update; i++) 1618 for(i = 0; i < screen_update; i++)
1616 screens[i].puts(0, filename_offset[i] + PM_HEIGHT + 2, buf); 1619 screens[i].putsxy(ymargin,
1620 SYSFONT_HEIGHT*(filename_offset[i]+
1621 PM_HEIGHT + 2), buf);
1617 } 1622 }
1618 1623
1619 if(global_settings.rec_source == AUDIO_SRC_MIC) 1624 if(global_settings.rec_source == AUDIO_SRC_MIC)
@@ -1632,8 +1637,9 @@ bool recording_screen(bool no_source)
1632 else 1637 else
1633 { 1638 {
1634 for(i = 0; i < screen_update; i++) 1639 for(i = 0; i < screen_update; i++)
1635 screens[i].puts(0, filename_offset[i] + 1640 screens[i].putsxy(ymargin,
1636 PM_HEIGHT + 3, buf); 1641 SYSFONT_HEIGHT*(filename_offset[i] +
1642 PM_HEIGHT + 3), buf);
1637 } 1643 }
1638 } 1644 }
1639 else if(0 1645 else if(0
@@ -1664,8 +1670,9 @@ bool recording_screen(bool no_source)
1664 else 1670 else
1665 { 1671 {
1666 for(i = 0; i < screen_update; i++) 1672 for(i = 0; i < screen_update; i++)
1667 screens[i].puts(0, filename_offset[i] + 1673 screens[i].putsxy(ymargin,
1668 PM_HEIGHT + 3, buf); 1674 SYSFONT_HEIGHT*(filename_offset[i] +
1675 PM_HEIGHT + 3), buf);
1669 } 1676 }
1670 1677
1671 snprintf(buf, sizeof(buf), "%s:%s", 1678 snprintf(buf, sizeof(buf), "%s:%s",
@@ -1688,8 +1695,9 @@ bool recording_screen(bool no_source)
1688 else 1695 else
1689 { 1696 {
1690 for(i = 0; i < screen_update; i++) 1697 for(i = 0; i < screen_update; i++)
1691 screens[i].puts(0, filename_offset[i] + 1698 screens[i].putsxy(ymargin,
1692 PM_HEIGHT + 4, buf); 1699 SYSFONT_HEIGHT*(filename_offset[i] +
1700 PM_HEIGHT + 4), buf);
1693 } 1701 }
1694 } 1702 }
1695#ifdef HAVE_LCD_COLOR 1703#ifdef HAVE_LCD_COLOR
@@ -1721,7 +1729,7 @@ bool recording_screen(bool no_source)
1721 break; 1729 break;
1722 } /* end switch */ 1730 } /* end switch */
1723#ifdef HAVE_AGC 1731#ifdef HAVE_AGC
1724 if (screens[i].height < h * (2 + filename_offset[i] + 1732 if (vp[i].height < h * (2 + filename_offset[i] +
1725 PM_HEIGHT + line[i])) 1733 PM_HEIGHT + line[i]))
1726 { 1734 {
1727 line[i] -= 1; 1735 line[i] -= 1;
@@ -1785,8 +1793,9 @@ bool recording_screen(bool no_source)
1785 { 1793 {
1786 for(i = 0; i < screen_update; i++) { 1794 for(i = 0; i < screen_update; i++) {
1787 if (display_agc[i]) { 1795 if (display_agc[i]) {
1788 screens[i].puts(0, filename_offset[i] + 1796 screens[i].putsxy(ymargin,
1789 PM_HEIGHT + line[i], buf); 1797 SYSFONT_HEIGHT*(filename_offset[i] +
1798 PM_HEIGHT + line[i]), buf);
1790 } 1799 }
1791 } 1800 }
1792 } 1801 }
@@ -1859,7 +1868,9 @@ bool recording_screen(bool no_source)
1859 1868
1860 for(i = 0; i < screen_update; i++) 1869 for(i = 0; i < screen_update; i++)
1861 { 1870 {
1871 screens[i].set_viewport(NULL);
1862 gui_statusbar_draw(&(statusbars.statusbars[i]), true); 1872 gui_statusbar_draw(&(statusbars.statusbars[i]), true);
1873 screens[i].set_viewport(&vp[i]);
1863 peak_meter_screen(&screens[i], pm_x, pm_y[i], h*PM_HEIGHT); 1874 peak_meter_screen(&screens[i], pm_x, pm_y[i], h*PM_HEIGHT);
1864 screens[i].update(); 1875 screens[i].update();
1865 } 1876 }
@@ -1867,11 +1878,11 @@ bool recording_screen(bool no_source)
1867 /* draw the trigger status */ 1878 /* draw the trigger status */
1868 FOR_NB_SCREENS(i) 1879 FOR_NB_SCREENS(i)
1869 { 1880 {
1870 trig_width[i] = ((screens[i].height < 64) || 1881 trig_width[i] = ((vp[i].height < 64) ||
1871 ((screens[i].height < 72) && (PM_HEIGHT > 1))) ? 1882 ((vp[i].height < 72) && (PM_HEIGHT > 1))) ?
1872 screens[i].width - 14 * w : screens[i].width; 1883 screens[i].width - 14 * w : screens[i].width;
1873 trig_xpos[i] = screens[i].width - trig_width[i]; 1884 trig_xpos[i] = screens[i].width - trig_width[i];
1874 trig_ypos[i] = ((screens[i].height < 72) && (PM_HEIGHT > 1)) ? 1885 trig_ypos[i] = ((vp[i].height < 72) && (PM_HEIGHT > 1)) ?
1875 h*2 : 1886 h*2 :
1876 h*(1 + filename_offset[i] + PM_HEIGHT + 1887 h*(1 + filename_offset[i] + PM_HEIGHT +
1877 line[i] 1888 line[i]
diff --git a/apps/screen_access.c b/apps/screen_access.c
index acb376e92a..8dcd091e81 100644
--- a/apps/screen_access.c
+++ b/apps/screen_access.c
@@ -51,11 +51,8 @@ struct screen screens[NB_SCREENS] =
51 .has_disk_led=true, 51 .has_disk_led=true,
52#endif 52#endif
53 .set_viewport=&lcd_set_viewport, 53 .set_viewport=&lcd_set_viewport,
54 .setmargins=&lcd_setmargins,
55 .getwidth=&lcd_getwidth, 54 .getwidth=&lcd_getwidth,
56 .getheight=&lcd_getheight, 55 .getheight=&lcd_getheight,
57 .getymargin=&lcd_getymargin,
58 .getxmargin=&lcd_getxmargin,
59 .getstringsize=&lcd_getstringsize, 56 .getstringsize=&lcd_getstringsize,
60#ifdef HAVE_LCD_BITMAP 57#ifdef HAVE_LCD_BITMAP
61 .setfont=&lcd_setfont, 58 .setfont=&lcd_setfont,
@@ -142,11 +139,8 @@ struct screen screens[NB_SCREENS] =
142 .pixel_format=LCD_REMOTE_PIXELFORMAT, 139 .pixel_format=LCD_REMOTE_PIXELFORMAT,
143 .has_disk_led=false, 140 .has_disk_led=false,
144 .set_viewport=&lcd_remote_set_viewport, 141 .set_viewport=&lcd_remote_set_viewport,
145 .setmargins=&lcd_remote_setmargins,
146 .getwidth=&lcd_remote_getwidth, 142 .getwidth=&lcd_remote_getwidth,
147 .getheight=&lcd_remote_getheight, 143 .getheight=&lcd_remote_getheight,
148 .getymargin=&lcd_remote_getymargin,
149 .getxmargin=&lcd_remote_getxmargin,
150 .getstringsize=&lcd_remote_getstringsize, 144 .getstringsize=&lcd_remote_getstringsize,
151#if 1 /* all remote LCDs are bitmapped so far */ 145#if 1 /* all remote LCDs are bitmapped so far */
152 .setfont=&lcd_remote_setfont, 146 .setfont=&lcd_remote_setfont,
diff --git a/apps/screen_access.h b/apps/screen_access.h
index 07684b0a76..e0237db3b0 100644
--- a/apps/screen_access.h
+++ b/apps/screen_access.h
@@ -72,11 +72,8 @@ struct screen
72 bool has_buttonbar; 72 bool has_buttonbar;
73#endif 73#endif
74 void (*set_viewport)(struct viewport* vp); 74 void (*set_viewport)(struct viewport* vp);
75 void (*setmargins)(int x, int y);
76 int (*getwidth)(void); 75 int (*getwidth)(void);
77 int (*getheight)(void); 76 int (*getheight)(void);
78 int (*getxmargin)(void);
79 int (*getymargin)(void);
80 int (*getstringsize)(const unsigned char *str, int *w, int *h); 77 int (*getstringsize)(const unsigned char *str, int *w, int *h);
81#if defined(HAVE_LCD_BITMAP) || defined(HAVE_REMOTE_LCD) /* always bitmap */ 78#if defined(HAVE_LCD_BITMAP) || defined(HAVE_REMOTE_LCD) /* always bitmap */
82 void (*setfont)(int newfont); 79 void (*setfont)(int newfont);
@@ -155,32 +152,6 @@ struct screen
155 void (*backlight_set_timeout)(int index); 152 void (*backlight_set_timeout)(int index);
156}; 153};
157 154
158#ifdef HAVE_BUTTONBAR
159/*
160 * Sets if the given screen has a buttonbar or not
161 * - screen : the screen structure
162 * - has : a boolean telling wether the current screen will have a buttonbar or not
163 */
164#define screen_has_buttonbar(screen, has_btnb) \
165 (screen)->has_buttonbar=has_btnb;
166#endif
167
168/*
169 * Sets the x margin in pixels for the given screen
170 * - screen : the screen structure
171 * - xmargin : the number of pixels to the left of the screen
172 */
173#define screen_set_xmargin(screen, xmargin) \
174 (screen)->setmargins(xmargin, (screen)->getymargin());
175
176/*
177 * Sets the y margin in pixels for the given screen
178 * - screen : the screen structure
179 * - xmargin : the number of pixels to the top of the screen
180 */
181#define screen_set_ymargin(screen, ymargin) \
182 (screen)->setmargins((screen)->getxmargin(), ymargin);
183
184#if defined(HAVE_LCD_BITMAP) || defined(HAVE_REMOTE_LCD) 155#if defined(HAVE_LCD_BITMAP) || defined(HAVE_REMOTE_LCD)
185/* 156/*
186 * Clear only a given area of the screen 157 * Clear only a given area of the screen
diff --git a/firmware/drivers/lcd-16bit.c b/firmware/drivers/lcd-16bit.c
index 020d6bf63a..a5b7533cc1 100644
--- a/firmware/drivers/lcd-16bit.c
+++ b/firmware/drivers/lcd-16bit.c
@@ -61,8 +61,6 @@ static struct viewport default_vp =
61 .height = LCD_HEIGHT, 61 .height = LCD_HEIGHT,
62 .font = FONT_SYSFIXED, 62 .font = FONT_SYSFIXED,
63 .drawmode = DRMODE_SOLID, 63 .drawmode = DRMODE_SOLID,
64 .xmargin = 0,
65 .ymargin = 0,
66 .fg_pattern = LCD_DEFAULT_FG, 64 .fg_pattern = LCD_DEFAULT_FG,
67 .bg_pattern = LCD_DEFAULT_BG, 65 .bg_pattern = LCD_DEFAULT_BG,
68 .lss_pattern = LCD_DEFAULT_BG, 66 .lss_pattern = LCD_DEFAULT_BG,
@@ -180,12 +178,6 @@ void lcd_set_drawinfo(int mode, unsigned fg_color, unsigned bg_color)
180 current_vp->bg_pattern = bg_color; 178 current_vp->bg_pattern = bg_color;
181} 179}
182 180
183void lcd_setmargins(int x, int y)
184{
185 current_vp->xmargin = x;
186 current_vp->ymargin = y;
187}
188
189int lcd_getwidth(void) 181int lcd_getwidth(void)
190{ 182{
191 return current_vp->width; 183 return current_vp->width;
@@ -196,16 +188,6 @@ int lcd_getheight(void)
196 return current_vp->height; 188 return current_vp->height;
197} 189}
198 190
199int lcd_getxmargin(void)
200{
201 return current_vp->xmargin;
202}
203
204int lcd_getymargin(void)
205{
206 return current_vp->ymargin;
207}
208
209void lcd_setfont(int newfont) 191void lcd_setfont(int newfont)
210{ 192{
211 current_vp->font = newfont; 193 current_vp->font = newfont;
@@ -1005,8 +987,8 @@ void lcd_puts_style_offset(int x, int y, const unsigned char *str, int style,
1005 return; 987 return;
1006 988
1007 lcd_getstringsize(str, &w, &h); 989 lcd_getstringsize(str, &w, &h);
1008 xpos = current_vp->xmargin + x*w / utf8length(str); 990 xpos = x*w / utf8length(str);
1009 ypos = current_vp->ymargin + y*h; 991 ypos = y*h;
1010 current_vp->drawmode = (style & STYLE_INVERT) ? 992 current_vp->drawmode = (style & STYLE_INVERT) ?
1011 (DRMODE_SOLID|DRMODE_INVERSEVID) : DRMODE_SOLID; 993 (DRMODE_SOLID|DRMODE_INVERSEVID) : DRMODE_SOLID;
1012 if (style & STYLE_COLORED) { 994 if (style & STYLE_COLORED) {
@@ -1081,7 +1063,7 @@ void lcd_puts_scroll_style_offset(int x, int y, const unsigned char *string,
1081 1063
1082 lcd_getstringsize(string, &w, &h); 1064 lcd_getstringsize(string, &w, &h);
1083 1065
1084 if (current_vp->width - x * 8 - current_vp->xmargin < w) { 1066 if (current_vp->width - x * 8 < w) {
1085 /* prepare scroll line */ 1067 /* prepare scroll line */
1086 char *end; 1068 char *end;
1087 1069
@@ -1094,7 +1076,7 @@ void lcd_puts_scroll_style_offset(int x, int y, const unsigned char *string,
1094 /* scroll bidirectional or forward only depending on the string 1076 /* scroll bidirectional or forward only depending on the string
1095 width */ 1077 width */
1096 if ( lcd_scroll_info.bidir_limit ) { 1078 if ( lcd_scroll_info.bidir_limit ) {
1097 s->bidir = s->width < (current_vp->width - current_vp->xmargin) * 1079 s->bidir = s->width < (current_vp->width) *
1098 (100 + lcd_scroll_info.bidir_limit) / 100; 1080 (100 + lcd_scroll_info.bidir_limit) / 100;
1099 } 1081 }
1100 else 1082 else
@@ -1113,7 +1095,7 @@ void lcd_puts_scroll_style_offset(int x, int y, const unsigned char *string,
1113 s->y = y; 1095 s->y = y;
1114 s->len = utf8length(string); 1096 s->len = utf8length(string);
1115 s->offset = offset; 1097 s->offset = offset;
1116 s->startx = current_vp->xmargin + x * s->width / s->len; 1098 s->startx = x * s->width / s->len;
1117 s->backward = false; 1099 s->backward = false;
1118 lcd_scroll_info.lines++; 1100 lcd_scroll_info.lines++;
1119 } 1101 }
@@ -1159,7 +1141,7 @@ void lcd_scroll_fn(void)
1159 1141
1160 pf = font_get(current_vp->font); 1142 pf = font_get(current_vp->font);
1161 xpos = s->startx; 1143 xpos = s->startx;
1162 ypos = current_vp->ymargin + s->y * pf->height; 1144 ypos = s->y * pf->height;
1163 1145
1164 if (s->bidir) { /* scroll bidirectional */ 1146 if (s->bidir) { /* scroll bidirectional */
1165 if (s->offset <= 0) { 1147 if (s->offset <= 0) {
diff --git a/firmware/drivers/lcd-1bit-vert.c b/firmware/drivers/lcd-1bit-vert.c
index c6fe40cdb7..ffc78bd53a 100644
--- a/firmware/drivers/lcd-1bit-vert.c
+++ b/firmware/drivers/lcd-1bit-vert.c
@@ -56,8 +56,6 @@ static struct viewport default_vp =
56 .height = LCDM(HEIGHT), 56 .height = LCDM(HEIGHT),
57 .font = FONT_SYSFIXED, 57 .font = FONT_SYSFIXED,
58 .drawmode = DRMODE_SOLID, 58 .drawmode = DRMODE_SOLID,
59 .xmargin = 0,
60 .ymargin = 0,
61}; 59};
62 60
63static struct viewport* current_vp = &default_vp; 61static struct viewport* current_vp = &default_vp;
@@ -107,22 +105,6 @@ int LCDFN(get_drawmode)(void)
107 return current_vp->drawmode; 105 return current_vp->drawmode;
108} 106}
109 107
110void LCDFN(setmargins)(int x, int y)
111{
112 current_vp->xmargin = x;
113 current_vp->ymargin = y;
114}
115
116int LCDFN(getxmargin)(void)
117{
118 return current_vp->xmargin;
119}
120
121int LCDFN(getymargin)(void)
122{
123 return current_vp->ymargin;
124}
125
126int LCDFN(getwidth)(void) 108int LCDFN(getwidth)(void)
127{ 109{
128 return current_vp->width; 110 return current_vp->width;
@@ -760,8 +742,8 @@ void LCDFN(puts_style_offset)(int x, int y, const unsigned char *str,
760 return; 742 return;
761 743
762 LCDFN(getstringsize)(str, &w, &h); 744 LCDFN(getstringsize)(str, &w, &h);
763 xpos = current_vp->xmargin + x*w / utf8length(str); 745 xpos = x*w / utf8length(str);
764 ypos = current_vp->ymargin + y*h; 746 ypos = y*h;
765 current_vp->drawmode = (style & STYLE_INVERT) ? 747 current_vp->drawmode = (style & STYLE_INVERT) ?
766 (DRMODE_SOLID|DRMODE_INVERSEVID) : DRMODE_SOLID; 748 (DRMODE_SOLID|DRMODE_INVERSEVID) : DRMODE_SOLID;
767 LCDFN(putsxyofs)(xpos, ypos, offset, str); 749 LCDFN(putsxyofs)(xpos, ypos, offset, str);
@@ -816,7 +798,7 @@ void LCDFN(puts_scroll_style_offset)(int x, int y, const unsigned char *string,
816 798
817 LCDFN(getstringsize)(string, &w, &h); 799 LCDFN(getstringsize)(string, &w, &h);
818 800
819 if (current_vp->width - x * 8 - current_vp->xmargin < w) { 801 if (current_vp->width - x * 8 < w) {
820 /* prepare scroll line */ 802 /* prepare scroll line */
821 char *end; 803 char *end;
822 804
@@ -829,7 +811,7 @@ void LCDFN(puts_scroll_style_offset)(int x, int y, const unsigned char *string,
829 /* scroll bidirectional or forward only depending on the string 811 /* scroll bidirectional or forward only depending on the string
830 width */ 812 width */
831 if ( LCDFN(scroll_info).bidir_limit ) { 813 if ( LCDFN(scroll_info).bidir_limit ) {
832 s->bidir = s->width < (current_vp->width - current_vp->xmargin) * 814 s->bidir = s->width < (current_vp->width) *
833 (100 + LCDFN(scroll_info).bidir_limit) / 100; 815 (100 + LCDFN(scroll_info).bidir_limit) / 100;
834 } 816 }
835 else 817 else
@@ -848,7 +830,7 @@ void LCDFN(puts_scroll_style_offset)(int x, int y, const unsigned char *string,
848 s->y = y; 830 s->y = y;
849 s->len = utf8length(string); 831 s->len = utf8length(string);
850 s->offset = offset; 832 s->offset = offset;
851 s->startx = current_vp->xmargin + x * s->width / s->len;; 833 s->startx = x * s->width / s->len;;
852 s->backward = false; 834 s->backward = false;
853 835
854 LCDFN(scroll_info).lines++; 836 LCDFN(scroll_info).lines++;
@@ -880,7 +862,7 @@ void LCDFN(scroll_fn)(void)
880 862
881 pf = font_get(current_vp->font); 863 pf = font_get(current_vp->font);
882 xpos = s->startx; 864 xpos = s->startx;
883 ypos = current_vp->ymargin + s->y * pf->height; 865 ypos = s->y * pf->height;
884 866
885 if (s->bidir) { /* scroll bidirectional */ 867 if (s->bidir) { /* scroll bidirectional */
886 if (s->offset <= 0) { 868 if (s->offset <= 0) {
diff --git a/firmware/drivers/lcd-2bit-horz.c b/firmware/drivers/lcd-2bit-horz.c
index 30901efb98..0818c29d47 100644
--- a/firmware/drivers/lcd-2bit-horz.c
+++ b/firmware/drivers/lcd-2bit-horz.c
@@ -54,8 +54,6 @@ static struct viewport default_vp =
54 .height = LCD_HEIGHT, 54 .height = LCD_HEIGHT,
55 .font = FONT_SYSFIXED, 55 .font = FONT_SYSFIXED,
56 .drawmode = DRMODE_SOLID, 56 .drawmode = DRMODE_SOLID,
57 .xmargin = 0,
58 .ymargin = 0,
59 .fg_pattern = LCD_DEFAULT_FG, 57 .fg_pattern = LCD_DEFAULT_FG,
60 .bg_pattern = LCD_DEFAULT_BG 58 .bg_pattern = LCD_DEFAULT_BG
61}; 59};
@@ -141,22 +139,6 @@ void lcd_set_drawinfo(int mode, unsigned fg_brightness, unsigned bg_brightness)
141 lcd_set_background(bg_brightness); 139 lcd_set_background(bg_brightness);
142} 140}
143 141
144void lcd_setmargins(int x, int y)
145{
146 current_vp->xmargin = x;
147 current_vp->ymargin = y;
148}
149
150int lcd_getxmargin(void)
151{
152 return current_vp->xmargin;
153}
154
155int lcd_getymargin(void)
156{
157 return current_vp->ymargin;
158}
159
160int lcd_getwidth(void) 142int lcd_getwidth(void)
161{ 143{
162 return current_vp->width; 144 return current_vp->width;
@@ -950,8 +932,8 @@ void lcd_puts_style_offset(int x, int y, const unsigned char *str,
950 return; 932 return;
951 933
952 lcd_getstringsize(str, &w, &h); 934 lcd_getstringsize(str, &w, &h);
953 xpos = current_vp->xmargin + x*w / utf8length((char *)str); 935 xpos = x*w / utf8length((char *)str);
954 ypos = current_vp->ymargin + y*h; 936 ypos = y*h;
955 current_vp->drawmode = (style & STYLE_INVERT) ? 937 current_vp->drawmode = (style & STYLE_INVERT) ?
956 (DRMODE_SOLID|DRMODE_INVERSEVID) : DRMODE_SOLID; 938 (DRMODE_SOLID|DRMODE_INVERSEVID) : DRMODE_SOLID;
957 lcd_putsxyofs(xpos, ypos, offset, str); 939 lcd_putsxyofs(xpos, ypos, offset, str);
@@ -1003,7 +985,7 @@ void lcd_puts_scroll_style_offset(int x, int y, const unsigned char *string,
1003 985
1004 lcd_getstringsize(string, &w, &h); 986 lcd_getstringsize(string, &w, &h);
1005 987
1006 if (current_vp->width - x * 8 - current_vp->xmargin < w) { 988 if (current_vp->width - x * 8 < w) {
1007 /* prepare scroll line */ 989 /* prepare scroll line */
1008 char *end; 990 char *end;
1009 991
@@ -1016,7 +998,7 @@ void lcd_puts_scroll_style_offset(int x, int y, const unsigned char *string,
1016 /* scroll bidirectional or forward only depending on the string 998 /* scroll bidirectional or forward only depending on the string
1017 width */ 999 width */
1018 if ( lcd_scroll_info.bidir_limit ) { 1000 if ( lcd_scroll_info.bidir_limit ) {
1019 s->bidir = s->width < (current_vp->width - current_vp->xmargin) * 1001 s->bidir = s->width < (current_vp->width) *
1020 (100 + lcd_scroll_info.bidir_limit) / 100; 1002 (100 + lcd_scroll_info.bidir_limit) / 100;
1021 } 1003 }
1022 else 1004 else
@@ -1035,7 +1017,7 @@ void lcd_puts_scroll_style_offset(int x, int y, const unsigned char *string,
1035 s->y = y; 1017 s->y = y;
1036 s->len = utf8length((char *)string); 1018 s->len = utf8length((char *)string);
1037 s->offset = offset; 1019 s->offset = offset;
1038 s->startx = current_vp->xmargin + x * s->width / s->len;; 1020 s->startx = x * s->width / s->len;;
1039 s->backward = false; 1021 s->backward = false;
1040 lcd_scroll_info.lines++; 1022 lcd_scroll_info.lines++;
1041 } 1023 }
@@ -1066,7 +1048,7 @@ void lcd_scroll_fn(void)
1066 1048
1067 pf = font_get(current_vp->font); 1049 pf = font_get(current_vp->font);
1068 xpos = s->startx; 1050 xpos = s->startx;
1069 ypos = current_vp->ymargin + s->y * pf->height; 1051 ypos = s->y * pf->height;
1070 1052
1071 if (s->bidir) { /* scroll bidirectional */ 1053 if (s->bidir) { /* scroll bidirectional */
1072 if (s->offset <= 0) { 1054 if (s->offset <= 0) {
diff --git a/firmware/drivers/lcd-2bit-vert.c b/firmware/drivers/lcd-2bit-vert.c
index d43bf6cc81..285a592893 100644
--- a/firmware/drivers/lcd-2bit-vert.c
+++ b/firmware/drivers/lcd-2bit-vert.c
@@ -56,8 +56,6 @@ static struct viewport default_vp =
56 .height = LCD_HEIGHT, 56 .height = LCD_HEIGHT,
57 .font = FONT_SYSFIXED, 57 .font = FONT_SYSFIXED,
58 .drawmode = DRMODE_SOLID, 58 .drawmode = DRMODE_SOLID,
59 .xmargin = 0,
60 .ymargin = 0,
61 .fg_pattern = LCD_DEFAULT_FG, 59 .fg_pattern = LCD_DEFAULT_FG,
62 .bg_pattern = LCD_DEFAULT_BG 60 .bg_pattern = LCD_DEFAULT_BG
63}; 61};
@@ -144,22 +142,6 @@ void lcd_set_drawinfo(int mode, unsigned fg_brightness, unsigned bg_brightness)
144 lcd_set_background(bg_brightness); 142 lcd_set_background(bg_brightness);
145} 143}
146 144
147void lcd_setmargins(int x, int y)
148{
149 current_vp->xmargin = x;
150 current_vp->ymargin = y;
151}
152
153int lcd_getxmargin(void)
154{
155 return current_vp->xmargin;
156}
157
158int lcd_getymargin(void)
159{
160 return current_vp->ymargin;
161}
162
163int lcd_getwidth(void) 145int lcd_getwidth(void)
164{ 146{
165 return current_vp->width; 147 return current_vp->width;
@@ -1088,8 +1070,8 @@ void lcd_puts_style_offset(int x, int y, const unsigned char *str,
1088 return; 1070 return;
1089 1071
1090 lcd_getstringsize(str, &w, &h); 1072 lcd_getstringsize(str, &w, &h);
1091 xpos = current_vp->xmargin + x*w / utf8length((char *)str); 1073 xpos = x*w / utf8length((char *)str);
1092 ypos = current_vp->ymargin + y*h; 1074 ypos = y*h;
1093 current_vp->drawmode = (style & STYLE_INVERT) ? 1075 current_vp->drawmode = (style & STYLE_INVERT) ?
1094 (DRMODE_SOLID|DRMODE_INVERSEVID) : DRMODE_SOLID; 1076 (DRMODE_SOLID|DRMODE_INVERSEVID) : DRMODE_SOLID;
1095 lcd_putsxyofs(xpos, ypos, offset, str); 1077 lcd_putsxyofs(xpos, ypos, offset, str);
@@ -1142,7 +1124,7 @@ void lcd_puts_scroll_style_offset(int x, int y, const unsigned char *string,
1142 1124
1143 lcd_getstringsize(string, &w, &h); 1125 lcd_getstringsize(string, &w, &h);
1144 1126
1145 if (current_vp->width - x * 8 - current_vp->xmargin < w) { 1127 if (current_vp->width - x * 8< w) {
1146 /* prepare scroll line */ 1128 /* prepare scroll line */
1147 char *end; 1129 char *end;
1148 1130
@@ -1155,7 +1137,7 @@ void lcd_puts_scroll_style_offset(int x, int y, const unsigned char *string,
1155 /* scroll bidirectional or forward only depending on the string 1137 /* scroll bidirectional or forward only depending on the string
1156 width */ 1138 width */
1157 if ( lcd_scroll_info.bidir_limit ) { 1139 if ( lcd_scroll_info.bidir_limit ) {
1158 s->bidir = s->width < (current_vp->width - current_vp->xmargin) * 1140 s->bidir = s->width < (current_vp->width) *
1159 (100 + lcd_scroll_info.bidir_limit) / 100; 1141 (100 + lcd_scroll_info.bidir_limit) / 100;
1160 } 1142 }
1161 else 1143 else
@@ -1174,7 +1156,7 @@ void lcd_puts_scroll_style_offset(int x, int y, const unsigned char *string,
1174 s->y = y; 1156 s->y = y;
1175 s->len = utf8length((char *)string); 1157 s->len = utf8length((char *)string);
1176 s->offset = offset; 1158 s->offset = offset;
1177 s->startx = current_vp->xmargin + x * s->width / s->len; 1159 s->startx = x * s->width / s->len;
1178 s->backward = false; 1160 s->backward = false;
1179 1161
1180 lcd_scroll_info.lines++; 1162 lcd_scroll_info.lines++;
@@ -1206,7 +1188,7 @@ void lcd_scroll_fn(void)
1206 1188
1207 pf = font_get(current_vp->font); 1189 pf = font_get(current_vp->font);
1208 xpos = s->startx; 1190 xpos = s->startx;
1209 ypos = current_vp->ymargin + s->y * pf->height; 1191 ypos = s->y * pf->height;
1210 1192
1211 if (s->bidir) { /* scroll bidirectional */ 1193 if (s->bidir) { /* scroll bidirectional */
1212 if (s->offset <= 0) { 1194 if (s->offset <= 0) {
diff --git a/firmware/drivers/lcd-2bit-vi.c b/firmware/drivers/lcd-2bit-vi.c
index 7d97f19174..9decc0cbab 100644
--- a/firmware/drivers/lcd-2bit-vi.c
+++ b/firmware/drivers/lcd-2bit-vi.c
@@ -60,8 +60,6 @@ static struct viewport default_vp =
60 .height = LCDM(HEIGHT), 60 .height = LCDM(HEIGHT),
61 .font = FONT_SYSFIXED, 61 .font = FONT_SYSFIXED,
62 .drawmode = DRMODE_SOLID, 62 .drawmode = DRMODE_SOLID,
63 .xmargin = 0,
64 .ymargin = 0,
65 .fg_pattern = LCDM(DEFAULT_FG), 63 .fg_pattern = LCDM(DEFAULT_FG),
66 .bg_pattern = LCDM(DEFAULT_BG) 64 .bg_pattern = LCDM(DEFAULT_BG)
67}; 65};
@@ -175,23 +173,6 @@ int LCDFN(getheight)(void)
175{ 173{
176 return current_vp->height; 174 return current_vp->height;
177} 175}
178
179void LCDFN(setmargins)(int x, int y)
180{
181 current_vp->xmargin = x;
182 current_vp->ymargin = y;
183}
184
185int LCDFN(getxmargin)(void)
186{
187 return current_vp->xmargin;
188}
189
190int LCDFN(getymargin)(void)
191{
192 return current_vp->ymargin;
193}
194
195void LCDFN(setfont)(int newfont) 176void LCDFN(setfont)(int newfont)
196{ 177{
197 current_vp->font = newfont; 178 current_vp->font = newfont;
@@ -1105,8 +1086,8 @@ void LCDFN(puts_style_offset)(int x, int y, const unsigned char *str,
1105 return; 1086 return;
1106 1087
1107 LCDFN(getstringsize)(str, &w, &h); 1088 LCDFN(getstringsize)(str, &w, &h);
1108 xpos = current_vp->xmargin + x*w / utf8length((char *)str); 1089 xpos = x*w / utf8length((char *)str);
1109 ypos = current_vp->ymargin + y*h; 1090 ypos = y*h;
1110 current_vp->drawmode = (style & STYLE_INVERT) ? 1091 current_vp->drawmode = (style & STYLE_INVERT) ?
1111 (DRMODE_SOLID|DRMODE_INVERSEVID) : DRMODE_SOLID; 1092 (DRMODE_SOLID|DRMODE_INVERSEVID) : DRMODE_SOLID;
1112 LCDFN(putsxyofs)(xpos, ypos, offset, str); 1093 LCDFN(putsxyofs)(xpos, ypos, offset, str);
@@ -1158,7 +1139,7 @@ void LCDFN(puts_scroll_style_offset)(int x, int y, const unsigned char *string,
1158 1139
1159 LCDFN(getstringsize)(string, &w, &h); 1140 LCDFN(getstringsize)(string, &w, &h);
1160 1141
1161 if (current_vp->width - x * 8 - current_vp->xmargin < w) { 1142 if (current_vp->width - x * 8 < w) {
1162 /* prepare scroll line */ 1143 /* prepare scroll line */
1163 char *end; 1144 char *end;
1164 1145
@@ -1171,7 +1152,7 @@ void LCDFN(puts_scroll_style_offset)(int x, int y, const unsigned char *string,
1171 /* scroll bidirectional or forward only depending on the string 1152 /* scroll bidirectional or forward only depending on the string
1172 width */ 1153 width */
1173 if ( LCDFN(scroll_info).bidir_limit ) { 1154 if ( LCDFN(scroll_info).bidir_limit ) {
1174 s->bidir = s->width < (current_vp->width - current_vp->xmargin) * 1155 s->bidir = s->width < (current_vp->width) *
1175 (100 + LCDFN(scroll_info).bidir_limit) / 100; 1156 (100 + LCDFN(scroll_info).bidir_limit) / 100;
1176 } 1157 }
1177 else 1158 else
@@ -1190,7 +1171,7 @@ void LCDFN(puts_scroll_style_offset)(int x, int y, const unsigned char *string,
1190 s->y = y; 1171 s->y = y;
1191 s->len = utf8length((char *)string); 1172 s->len = utf8length((char *)string);
1192 s->offset = offset; 1173 s->offset = offset;
1193 s->startx = current_vp->xmargin + x * s->width / s->len; 1174 s->startx = x * s->width / s->len;
1194 s->backward = false; 1175 s->backward = false;
1195 1176
1196 LCDFN(scroll_info).lines++; 1177 LCDFN(scroll_info).lines++;
@@ -1222,7 +1203,7 @@ void LCDFN(scroll_fn)(void)
1222 1203
1223 pf = font_get(current_vp->font); 1204 pf = font_get(current_vp->font);
1224 xpos = s->startx; 1205 xpos = s->startx;
1225 ypos = current_vp->ymargin + s->y * pf->height; 1206 ypos = s->y * pf->height;
1226 1207
1227 if (s->bidir) { /* scroll bidirectional */ 1208 if (s->bidir) { /* scroll bidirectional */
1228 if (s->offset <= 0) { 1209 if (s->offset <= 0) {
diff --git a/firmware/drivers/lcd-charcell.c b/firmware/drivers/lcd-charcell.c
index 1bc634cd2f..1c43b83ab1 100644
--- a/firmware/drivers/lcd-charcell.c
+++ b/firmware/drivers/lcd-charcell.c
@@ -58,8 +58,6 @@ static struct viewport default_vp =
58 .y = 0, 58 .y = 0,
59 .width = LCD_WIDTH, 59 .width = LCD_WIDTH,
60 .height = LCD_HEIGHT, 60 .height = LCD_HEIGHT,
61 .xmargin = 0,
62 .ymargin = 0,
63 }; 61 };
64 62
65static struct viewport* current_vp = &default_vp; 63static struct viewport* current_vp = &default_vp;
@@ -92,22 +90,6 @@ void lcd_update_viewport(void)
92 90
93/** parameter handling **/ 91/** parameter handling **/
94 92
95void lcd_setmargins(int x, int y)
96{
97 current_vp->xmargin = x;
98 current_vp->ymargin = y;
99}
100
101int lcd_getxmargin(void)
102{
103 return current_vp->xmargin;
104}
105
106int lcd_getymargin(void)
107{
108 return current_vp->ymargin;
109}
110
111int lcd_getwidth(void) 93int lcd_getwidth(void)
112{ 94{
113 return current_vp->width; 95 return current_vp->width;
@@ -484,7 +466,7 @@ void lcd_puts_scroll_offset(int x, int y, const unsigned char *string,
484 lcd_puts_offset(x, y, string, offset); 466 lcd_puts_offset(x, y, string, offset);
485 len = utf8length(string); 467 len = utf8length(string);
486 468
487 if (current_vp->width - x - current_vp->xmargin < len) 469 if (current_vp->width - x < len)
488 { 470 {
489 /* prepare scroll line */ 471 /* prepare scroll line */
490 char *end; 472 char *end;
@@ -498,7 +480,7 @@ void lcd_puts_scroll_offset(int x, int y, const unsigned char *string,
498 /* scroll bidirectional or forward only depending on the string width */ 480 /* scroll bidirectional or forward only depending on the string width */
499 if (lcd_scroll_info.bidir_limit) 481 if (lcd_scroll_info.bidir_limit)
500 { 482 {
501 s->bidir = s->len < (current_vp->width - current_vp->xmargin) * 483 s->bidir = s->len < (current_vp->width) *
502 (100 + lcd_scroll_info.bidir_limit) / 100; 484 (100 + lcd_scroll_info.bidir_limit) / 100;
503 } 485 }
504 else 486 else
@@ -517,7 +499,7 @@ void lcd_puts_scroll_offset(int x, int y, const unsigned char *string,
517 s->vp = current_vp; 499 s->vp = current_vp;
518 s->y = y; 500 s->y = y;
519 s->offset = offset; 501 s->offset = offset;
520 s->startx = current_vp->xmargin + x; 502 s->startx = x;
521 s->backward = false; 503 s->backward = false;
522 lcd_scroll_info.lines++; 504 lcd_scroll_info.lines++;
523 } 505 }
@@ -547,7 +529,7 @@ void lcd_scroll_fn(void)
547 s->offset++; 529 s->offset++;
548 530
549 xpos = s->startx; 531 xpos = s->startx;
550 ypos = current_vp->ymargin + s->y; 532 ypos = s->y;
551 533
552 if (s->bidir) /* scroll bidirectional */ 534 if (s->bidir) /* scroll bidirectional */
553 { 535 {
diff --git a/firmware/export/events.h b/firmware/export/events.h
index ede21017b0..bf0485b111 100644
--- a/firmware/export/events.h
+++ b/firmware/export/events.h
@@ -30,6 +30,7 @@
30#define EVENT_CLASS_DISK 0x0100 30#define EVENT_CLASS_DISK 0x0100
31#define EVENT_CLASS_PLAYBACK 0x0200 31#define EVENT_CLASS_PLAYBACK 0x0200
32#define EVENT_CLASS_BUFFERING 0x0400 32#define EVENT_CLASS_BUFFERING 0x0400
33#define EVENT_CLASS_GUI 0x0800
33 34
34/** 35/**
35 * Because same playback events are used in mpeg.c and playback.c, define 36 * Because same playback events are used in mpeg.c and playback.c, define
diff --git a/firmware/export/lcd-remote.h b/firmware/export/lcd-remote.h
index bccc1e4b29..6d71834fe7 100644
--- a/firmware/export/lcd-remote.h
+++ b/firmware/export/lcd-remote.h
@@ -144,9 +144,6 @@ extern void lcd_remote_set_flip(bool yesno);
144 144
145extern void lcd_remote_set_drawmode(int mode); 145extern void lcd_remote_set_drawmode(int mode);
146extern int lcd_remote_get_drawmode(void); 146extern int lcd_remote_get_drawmode(void);
147extern void lcd_remote_setmargins(int xmargin, int ymargin);
148extern int lcd_remote_getxmargin(void);
149extern int lcd_remote_getymargin(void);
150extern int lcd_remote_getwidth(void); 147extern int lcd_remote_getwidth(void);
151extern int lcd_remote_getheight(void); 148extern int lcd_remote_getheight(void);
152extern void lcd_remote_setfont(int font); 149extern void lcd_remote_setfont(int font);
diff --git a/firmware/export/lcd.h b/firmware/export/lcd.h
index a7f4d7e471..b68efb1b1c 100644
--- a/firmware/export/lcd.h
+++ b/firmware/export/lcd.h
@@ -33,8 +33,6 @@ struct viewport {
33 int font; 33 int font;
34 int drawmode; 34 int drawmode;
35#endif 35#endif
36 int xmargin; /* During the transition only - to be removed */
37 int ymargin; /* During the transition only - to be removed */
38#if LCD_DEPTH > 1 36#if LCD_DEPTH > 1
39 unsigned fg_pattern; 37 unsigned fg_pattern;
40 unsigned bg_pattern; 38 unsigned bg_pattern;
@@ -105,9 +103,6 @@ extern void lcd_init_device(void);
105extern void lcd_backlight(bool on); 103extern void lcd_backlight(bool on);
106extern int lcd_default_contrast(void); 104extern int lcd_default_contrast(void);
107extern void lcd_set_contrast(int val); 105extern void lcd_set_contrast(int val);
108extern void lcd_setmargins(int xmargin, int ymargin);
109extern int lcd_getxmargin(void);
110extern int lcd_getymargin(void);
111extern int lcd_getwidth(void); 106extern int lcd_getwidth(void);
112extern int lcd_getheight(void); 107extern int lcd_getheight(void);
113extern int lcd_getstringsize(const unsigned char *str, int *w, int *h); 108extern int lcd_getstringsize(const unsigned char *str, int *w, int *h);
diff --git a/firmware/logf.c b/firmware/logf.c
index da05a0a0c7..0d57d45929 100644
--- a/firmware/logf.c
+++ b/firmware/logf.c
@@ -59,7 +59,6 @@ static void displayremote(void)
59 lcd_remote_getstringsize("A", &w, &h); 59 lcd_remote_getstringsize("A", &w, &h);
60 lines = LCD_REMOTE_HEIGHT/h; 60 lines = LCD_REMOTE_HEIGHT/h;
61 columns = LCD_REMOTE_WIDTH/w; 61 columns = LCD_REMOTE_WIDTH/w;
62 lcd_remote_setmargins(0, 0);
63 lcd_remote_clear_display(); 62 lcd_remote_clear_display();
64 63
65 index = logfindex; 64 index = logfindex;
diff --git a/firmware/target/arm/imx31/debug-imx31.c b/firmware/target/arm/imx31/debug-imx31.c
index 614a703836..22293b31d8 100644
--- a/firmware/target/arm/imx31/debug-imx31.c
+++ b/firmware/target/arm/imx31/debug-imx31.c
@@ -38,7 +38,6 @@ bool __dbg_hw_info(void)
38 unsigned int freq; 38 unsigned int freq;
39 uint32_t regval; 39 uint32_t regval;
40 40
41 lcd_setmargins(0, 0);
42 lcd_clear_display(); 41 lcd_clear_display();
43 lcd_setfont(FONT_SYSFIXED); 42 lcd_setfont(FONT_SYSFIXED);
44 43
@@ -158,7 +157,6 @@ bool __dbg_ports(void)
158 157
159 uint32_t pmic_regs[ARRAYLEN(pmic_regset)]; 158 uint32_t pmic_regs[ARRAYLEN(pmic_regset)];
160 159
161 lcd_setmargins(0, 0);
162 lcd_clear_display(); 160 lcd_clear_display();
163 lcd_setfont(FONT_SYSFIXED); 161 lcd_setfont(FONT_SYSFIXED);
164 162
diff --git a/firmware/target/arm/s3c2440/debug-s3c2440.c b/firmware/target/arm/s3c2440/debug-s3c2440.c
index 5a55d462e2..af1d1618b1 100644
--- a/firmware/target/arm/s3c2440/debug-s3c2440.c
+++ b/firmware/target/arm/s3c2440/debug-s3c2440.c
@@ -38,7 +38,6 @@ bool __dbg_ports(void)
38 char buf[50]; 38 char buf[50];
39 int line; 39 int line;
40 40
41 lcd_setmargins(0, 0);
42 lcd_clear_display(); 41 lcd_clear_display();
43 lcd_setfont(FONT_SYSFIXED); 42 lcd_setfont(FONT_SYSFIXED);
44 43
diff --git a/firmware/target/arm/tcc77x/debug-tcc77x.c b/firmware/target/arm/tcc77x/debug-tcc77x.c
index dc3db3926f..aabbebbe41 100644
--- a/firmware/target/arm/tcc77x/debug-tcc77x.c
+++ b/firmware/target/arm/tcc77x/debug-tcc77x.c
@@ -40,7 +40,6 @@ bool __dbg_hw_info(void)
40 bool done=false; 40 bool done=false;
41 char buf[100]; 41 char buf[100];
42 42
43 lcd_setmargins(0, 0);
44 lcd_setfont(FONT_SYSFIXED); 43 lcd_setfont(FONT_SYSFIXED);
45 lcd_clear_display(); 44 lcd_clear_display();
46 45
diff --git a/firmware/target/arm/tcc780x/debug-tcc780x.c b/firmware/target/arm/tcc780x/debug-tcc780x.c
index 14aa8c1c10..a56d29526a 100644
--- a/firmware/target/arm/tcc780x/debug-tcc780x.c
+++ b/firmware/target/arm/tcc780x/debug-tcc780x.c
@@ -44,7 +44,6 @@ bool __dbg_hw_info(void)
44 bool done=false; 44 bool done=false;
45 char buf[100]; 45 char buf[100];
46 46
47 lcd_setmargins(0, 0);
48 lcd_setfont(FONT_SYSFIXED); 47 lcd_setfont(FONT_SYSFIXED);
49 lcd_clear_display(); 48 lcd_clear_display();
50 49
diff --git a/firmware/target/arm/tms320dm320/debug-dm320.c b/firmware/target/arm/tms320dm320/debug-dm320.c
index 894f99c88d..1b3086de9a 100755
--- a/firmware/target/arm/tms320dm320/debug-dm320.c
+++ b/firmware/target/arm/tms320dm320/debug-dm320.c
@@ -48,7 +48,6 @@ bool __dbg_hw_info(void)
48 bool done=false; 48 bool done=false;
49 char buf[100]; 49 char buf[100];
50 50
51 lcd_setmargins(0, 0);
52 lcd_setfont(FONT_SYSFIXED); 51 lcd_setfont(FONT_SYSFIXED);
53 lcd_clear_display(); 52 lcd_clear_display();
54 53