1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
Index: apps/tree.c
===================================================================
--- apps/tree.c	(Revision 19800)
+++ apps/tree.c	(Arbeitskopie)
@@ -632,7 +632,8 @@
         splash(HZ*2, ID2P(LANG_NO_FILES));
         return GO_TO_PREVIOUS;  /* No files found for rockbox_browser() */
     }
-    
+
+    viewportmanager_set_custom_vp(true);
     gui_synclist_draw(&tree_lists);
     while(1) {
         struct entry *dircache = tc.dircache;
Index: apps/settings.c
===================================================================
--- apps/settings.c	(Revision 19800)
+++ apps/settings.c	(Arbeitskopie)
@@ -66,6 +66,7 @@
 #include "filetypes.h"
 #include "option_select.h"
 #include "backdrop.h"
+#include "viewport.h"

 #if CONFIG_TUNER
 #include "radio.h"
@@ -968,7 +969,7 @@
 #if defined(HAVE_RECORDING) && CONFIG_CODEC == SWCODEC
     enc_global_settings_apply();
 #endif
-    list_init_viewports(NULL);
+    viewportmanager_init_custom_vp();
 }


Index: apps/plugins/star.c
===================================================================
--- apps/plugins/star.c	(Revision 19800)
+++ apps/plugins/star.c	(Arbeitskopie)
@@ -1006,6 +1006,7 @@
                         "Information","Keys","Quit");
     FOR_NB_SCREENS(selection)
     {
+        rb->viewportmanager_set_custom_vp(false);
         rb->viewport_set_defaults(&vp[selection], selection);
 #if LCD_DEPTH > 1
         if (rb->screens[selection]->depth > 1)
Index: apps/gui/bitmap/list.c
===================================================================
--- apps/gui/bitmap/list.c	(Revision 19800)
+++ apps/gui/bitmap/list.c	(Arbeitskopie)
@@ -81,7 +81,7 @@
         title_icon.x += ICON_PADDING;

         title_text[screen].width -= title_icon.width + title_icon.x;
-        title_text[screen].x += title_icon.width + title_icon.x;
+        title_text[screen].x = title_icon.width + title_icon.x;

         display->set_viewport(&title_icon);
         screen_put_icon(display, 0, 0, list->title_icon);
Index: apps/gui/statusbar.c
===================================================================
--- apps/gui/statusbar.c	(Revision 19800)
+++ apps/gui/statusbar.c	(Arbeitskopie)
@@ -262,7 +262,7 @@
         memcmp(&(bar->info), &(bar->lastinfo), sizeof(struct status_info)))
     {
         struct viewport vp;
-        viewport_set_defaults(&vp, display->screen_type);
+        viewport_set_fullscreen(&vp, display->screen_type);
         vp.height = STATUSBAR_HEIGHT;
         vp.x = STATUSBAR_X_POS;
         vp.y = STATUSBAR_Y_POS;
Index: apps/gui/list.c
===================================================================
--- apps/gui/list.c	(Revision 19800)
+++ apps/gui/list.c	(Arbeitskopie)
@@ -68,12 +68,10 @@
 void list_init_viewports(struct gui_synclist *list)
 {
     int i;
-    struct viewport *vp;
     FOR_NB_SCREENS(i)
     {
-        vp = &parent[i];
-        if (!list || list->parent[i] == vp)
-            viewport_set_defaults(vp, i);
+        if (&parent[i] == (list->parent[i]))
+            viewport_set_defaults((list->parent[i]), i);
     }
 #ifdef HAVE_BUTTONBAR
     if (list && (list->parent[0] == &parent[0]) && global_settings.buttonbar)
@@ -219,18 +217,6 @@
     static int last_count = -1;
 #ifdef HAVE_BUTTONBAR
     static bool last_buttonbar = false;
-#endif
-    if (force_list_reinit ||
-#ifdef HAVE_BUTTONBAR
-        last_buttonbar != screens[SCREEN_MAIN].has_buttonbar ||
-#endif
-        last_list != gui_list ||
-        gui_list->nb_items != last_count)
-    {
-        list_init_viewports(gui_list);
-        gui_synclist_select_item(gui_list, gui_list->selected_item);
-    }
-#ifdef HAVE_BUTTONBAR
     last_buttonbar = screens[SCREEN_MAIN].has_buttonbar;
 #endif
     last_count = gui_list->nb_items;
Index: apps/gui/viewport.c
===================================================================
--- apps/gui/viewport.c	(Revision 19800)
+++ apps/gui/viewport.c	(Arbeitskopie)
@@ -34,8 +34,26 @@
 #include "statusbar.h"
 #include "screen_access.h"
 #include "appevents.h"
+#include "debug.h"

+#warning REMOVE DEBUG HERE
+void DEBUG_VP(struct viewport vp, char* string)
+{
+    DEBUGF("%s debug:\n.x: %d\t.y: %d\n\r.width: %d\t.height: %d\n\n"\
+            ,string, vp.x,vp.y,vp.width,vp.height);
+}
+void DEBUG_VP_PTR(struct viewport *vp, char* string)
+{
+    DEBUGF("%s debug:\n->x: %d\t\t->y: %d\n\r->width: %d\t->height: %d\n\n",
+            string, vp->x,vp->y,vp->width,vp->height);
+}
+
+
 static bool statusbar_enabled = true;
+#ifdef HAVE_LCD_BITMAP
+static bool custom_vp_enabled = true;
+static struct viewport custom_vp[NB_SCREENS];
+#endif

 int viewport_get_nb_lines(struct viewport *vp)
 {
@@ -47,8 +65,8 @@
 #endif
 }

-
-void viewport_set_defaults(struct viewport *vp, enum screen_type screen)
+/* fullscreen means possibly reduced by the height of the statusbar */
+void viewport_set_fullscreen(struct viewport *vp, enum screen_type screen)
 {
     vp->x = 0;
     vp->width = screens[screen].lcdwidth;
@@ -86,6 +104,23 @@
 #endif
 }

+#ifdef HAVE_LCD_BITMAP
+static void viewport_set_custom_vp(struct viewport *vp, enum screen_type screen)
+{
+    *vp = custom_vp[screen];
+}
+#endif /* HAVE_LCD_BITMAP */
+
+void viewport_set_defaults(struct viewport *vp, enum screen_type screen)
+{
+#ifdef HAVE_LCD_BITMAP
+    if (custom_vp_enabled)
+        viewport_set_custom_vp(vp, screen);
+    else
+#endif
+        viewport_set_fullscreen(vp, screen);
+}
+
 /* returns true if it was enabled BEFORE this call */
 bool viewportmanager_set_statusbar(bool enabled)
 {
@@ -119,3 +154,147 @@
     (void)data;
     viewportmanager_set_statusbar(statusbar_enabled);
 }
+
+void viewportmanager_set_custom_vp(const bool enable)
+{
+    if (!custom_vp_enabled && enable)
+    { /* if leaving a fullscreen screen to a smaller one the screen needs to
+        be cleared so that dead parts are removed */
+        int i;
+        FOR_NB_SCREENS(i)
+        {
+            debugf("cleared\n");
+            screens[i].clear_display();
+            screens[i].update();
+            if (statusbar_enabled)
+                gui_syncstatusbar_draw(&statusbars, true);
+        }
+    }
+    custom_vp_enabled = enable;
+}
+
+#ifdef HAVE_LCD_BITMAP
+
+/* Generic viewport parsing function to parse viewports structures like
+ * the %V tag; basically just a wrapper for parse_list, so improvements
+ * should aim parse_list */
+const char* viewport_parse_viewport(struct viewport *vp,
+        const char *bufptr, const char seperator, enum screen_type screen)
+{
+    /* parse the list to the viewport struct */
+    const char *ptr = bufptr;
+    int depth;
+    uint32_t set = 0;
+
+    enum {
+        PL_X = 0,
+        PL_Y,
+        PL_WIDTH,
+        PL_HEIGHT,
+        PL_FONT,
+        PL_FG,
+        PL_BG,
+    };
+    
+    /* Work out the depth of this display */
+    depth = screens[screen].depth;
+#ifdef HAVE_LCD_COLOR
+    if (depth == 16)
+    {
+        if (!(ptr = parse_list("dddddcc", &set, seperator, ptr, &vp->x, &vp->y, &vp->width,
+                    &vp->height, &vp->font, &vp->fg_pattern,&vp->bg_pattern)))
+            return VP_ERROR;
+    }
+    else 
+#endif
+#if (LCD_DEPTH == 2) || (defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH == 2)
+    if (depth == 2) {
+        if (!(ptr = parse_list("dddddgg", &set, seperator, ptr, &vp->x, &vp->y, &vp->width,
+                    &vp->height, &vp->font, &vp->fg_pattern, &vp->bg_pattern)))
+            return VP_ERROR;
+    }
+    else 
+#endif
+#if (LCD_DEPTH == 1) || (defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH == 1)
+    if (depth == 1)
+    {
+        if (!(ptr = parse_list("ddddd", &set, seperator, ptr, &vp->x, &vp->y, &vp->width,
+                &vp->height, &vp->font)))
+            return VP_ERROR;
+    }
+    else
+#endif
+    {}
+
+    if (!LIST_VALUE_PARSED(set, PL_X) || !LIST_VALUE_PARSED(set, PL_Y))
+        return VP_ERROR;
+    
+    /* fix defaults */
+    if (!LIST_VALUE_PARSED(set, PL_WIDTH))
+        vp->width = screens[screen].lcdwidth - vp->x;
+    if (!LIST_VALUE_PARSED(set, PL_HEIGHT))
+        vp->height = screens[screen].lcdheight - vp->y;
+
+#if (LCD_DEPTH == 16)
+    if (!LIST_VALUE_PARSED(set, PL_FG))
+        vp->fg_pattern = global_settings.fg_color;
+    if (!LIST_VALUE_PARSED(set, PL_BG))
+        vp->bg_pattern = global_settings.bg_color;
+#endif
+    /* Validate the viewport dimensions - we know that the numbers are
+       non-negative integers */
+    if ((vp->x >= screens[screen].lcdwidth) ||
+        ((vp->x + vp->width) > screens[screen].lcdwidth) ||
+        (vp->y >= screens[screen].lcdheight) ||
+        ((vp->y + vp->height) > screens[screen].lcdheight))
+    {
+        return VP_ERROR;
+    }
+
+    /* Default to using the user font if the font was an invalid number */
+    if ((vp->font != FONT_SYSFIXED) && (vp->font != FONT_UI))
+        vp->font = FONT_UI;
+
+    /* Lastly, clip it to the statusbar */
+    if(global_settings.statusbar && vp->y < STATUSBAR_HEIGHT)
+    {
+        int offset = STATUSBAR_HEIGHT - vp->y;
+        vp->y += offset;
+        vp->height -= offset;
+    }
+    return ptr;
+}
+
+/* returns 0 if defaults are used, due to viewport_parse_viewport failure */
+int viewportmanager_init_custom_vp(void)
+{
+    int screen;
+    FOR_NB_SCREENS(screen)
+    {
+#ifdef HAVE_REMOTE_LCD
+        if (screen= SCREEN_REMOTE)
+        {
+            if(!(viewport_parse_viewport(&custom_vp[screen],
+                     global_settings.remote_list_vp_config, ',', screen)))
+            {
+                viewport_set_fullscreen(&custom_vp[screen], screen);
+                return 0;
+            }
+        }
+        else
+#endif
+        {
+            if (!(viewport_parse_viewport(&custom_vp[screen],
+                     global_settings.list_vp_config, ',', screen)))
+            {
+                viewport_set_fullscreen(&custom_vp[screen], screen);
+                return 0;
+            }
+        }
+    }
+    /* shedule a full screen redraw, will be done a bit later */
+    viewportmanager_set_custom_vp(false);
+    return 1;
+}
+
+#endif /* HAVE_LCD_BITMAP */
Index: apps/gui/gwps.c
===================================================================
--- apps/gui/gwps.c	(Revision 19800)
+++ apps/gui/gwps.c	(Arbeitskopie)
@@ -127,7 +127,8 @@
     bool update_track = false;
     int i;
     long last_left = 0, last_right = 0;
-    
+
+    viewportmanager_set_custom_vp(false);
     viewportmanager_set_statusbar(false);
     wps_state_init();

Index: apps/gui/viewport.h
===================================================================
--- apps/gui/viewport.h	(Revision 19800)
+++ apps/gui/viewport.h	(Arbeitskopie)
@@ -27,7 +27,11 @@
 #include "system.h"
 #include "misc.h"
 #include "screen_access.h"
+#include "debug.h"

+void DEBUG_VP(struct viewport vp, char* string);
+void DEBUG_VP_PTR(struct viewport *vp, char* string);
+
 /* return the number of text lines in the vp viewport */
 int viewport_get_nb_lines(struct viewport *vp);

@@ -40,9 +44,14 @@
 int viewport_load_config(const char *config, struct viewport *vp);

 void viewport_set_defaults(struct viewport *vp, enum screen_type screen);
+void viewport_set_fullscreen(struct viewport *vp, enum screen_type screen);

 bool viewportmanager_set_statusbar(bool enabled);
+void viewportmanager_set_custom_vp(const bool enable);
 /* callbacks for GUI_EVENT_* events */
 void viewportmanager_draw_statusbars(void*data);
 void viewportmanager_statusbar_changed(void* data);
+const char* viewport_parse_viewport(struct viewport *vp,
+        const char *ptr, char seperator, enum screen_type screen);
+int viewportmanager_init_custom_vp(void);

Index: apps/gui/wps_parser.c
===================================================================
--- apps/gui/wps_parser.c	(Revision 19800)
+++ apps/gui/wps_parser.c	(Arbeitskopie)
@@ -26,6 +26,7 @@
 #include "file.h"
 #include "misc.h"
 #include "plugin.h"
+#include "viewport.h"

 #ifdef __PCTOOL__
 #ifdef WPSEDITOR
@@ -584,26 +585,6 @@
 {
     (void)token; /* Kill warnings */
     const char *ptr = wps_bufptr;
-    struct viewport* vp;
-    int depth;
-    uint32_t set = 0;
-    enum {
-        PL_X = 0,
-        PL_Y,
-        PL_WIDTH,
-        PL_HEIGHT,
-        PL_FONT,
-        PL_FG,
-        PL_BG,
-    };
-    int lcd_width = LCD_WIDTH, lcd_height = LCD_HEIGHT;
-#ifdef HAVE_REMOTE_LCD
-    if (wps_data->remote_wps)
-    {
-        lcd_width = LCD_REMOTE_WIDTH;
-        lcd_height = LCD_REMOTE_HEIGHT;
-    }
-#endif

     if (wps_data->num_viewports >= WPS_MAX_VIEWPORTS)
         return WPS_ERROR_INVALID_PARAM;
@@ -632,7 +613,7 @@
         return WPS_ERROR_INVALID_PARAM;

     ptr++;
-    vp = &wps_data->viewports[wps_data->num_viewports].vp;
+    struct viewport *vp = &wps_data->viewports[wps_data->num_viewports].vp;
     /* format: %V|x|y|width|height|font|fg_pattern|bg_pattern| */

     /* Set the defaults for fields not user-specified */
@@ -640,80 +621,27 @@

     /* Work out the depth of this display */
 #ifdef HAVE_REMOTE_LCD
-    depth = (wps_data->remote_wps ? LCD_REMOTE_DEPTH : LCD_DEPTH);
-#else
-    depth = LCD_DEPTH;
-#endif
-
-#ifdef HAVE_LCD_COLOR
-    if (depth == 16)
+    if (!(wps_data->remote_wps))
     {
-        if (!(ptr = parse_list("dddddcc", &set, '|', ptr, &vp->x, &vp->y, &vp->width,
-                    &vp->height, &vp->font, &vp->fg_pattern,&vp->bg_pattern)))
-            return WPS_ERROR_INVALID_PARAM;
-    }
-    else 
 #endif
-#if (LCD_DEPTH == 2) || (defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH == 2)
-    if (depth == 2) {
-        /* Default to black on white */
-        vp->fg_pattern = 0;
-        vp->bg_pattern = 3;
-        if (!(ptr = parse_list("dddddgg", &set, '|', ptr, &vp->x, &vp->y, &vp->width,
-                    &vp->height, &vp->font, &vp->fg_pattern, &vp->bg_pattern)))
+        if (!(ptr = viewport_parse_viewport(vp, ptr, '|', SCREEN_MAIN)))
             return WPS_ERROR_INVALID_PARAM;
+#ifdef HAVE_REMOTE_LCD
     }
-    else 
-#endif
-#if (LCD_DEPTH == 1) || (defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH == 1)
-    if (depth == 1)
+    else
     {
-        if (!(ptr = parse_list("ddddd", &set, '|', ptr, &vp->x, &vp->y, 
-                                    &vp->width, &vp->height, &vp->font)))
+        if (!(ptr = viewport_parse_viewport(vp, ptr, '|', SCREEN_REMOTE)))
             return WPS_ERROR_INVALID_PARAM;
     }
-      else
+     
 #endif
-    {}
+  

     /* Check for trailing | */
     if (*ptr != '|')
         return WPS_ERROR_INVALID_PARAM;

-    if (!LIST_VALUE_PARSED(set, PL_X) || !LIST_VALUE_PARSED(set, PL_Y))
-        return WPS_ERROR_INVALID_PARAM;
-    
-    /* fix defaults */
-    if (!LIST_VALUE_PARSED(set, PL_WIDTH))
-        vp->width = lcd_width - vp->x;
-    if (!LIST_VALUE_PARSED(set, PL_HEIGHT))
-        vp->height = lcd_height - vp->y;
-    
-    /* Default to using the user font if the font was an invalid number */
-    if (!LIST_VALUE_PARSED(set, PL_FONT) ||
-         ((vp->font != FONT_SYSFIXED) && (vp->font != FONT_UI)))
-        vp->font = FONT_UI;

-    /* Validate the viewport dimensions - we know that the numbers are
-       non-negative integers */
-    if ((vp->x >= lcd_width) ||
-        ((vp->x + vp->width) > lcd_width) ||
-        (vp->y >= lcd_height) ||
-        ((vp->y + vp->height) > lcd_height))
-    {
-        return WPS_ERROR_INVALID_PARAM;
-    }
-    
-#ifdef HAVE_LCD_COLOR
-    if (depth == 16)
-    {
-        if (!LIST_VALUE_PARSED(set, PL_FG))
-            vp->fg_pattern = global_settings.fg_color;
-        if (!LIST_VALUE_PARSED(set, PL_BG))
-            vp->bg_pattern = global_settings.bg_color;
-    }
-#endif
-
     wps_data->viewports[wps_data->num_viewports-1].last_line = wps_data->num_lines - 1;

     wps_data->viewports[wps_data->num_viewports].first_line = wps_data->num_lines;
Index: apps/menu.c
===================================================================
--- apps/menu.c	(Revision 19800)
+++ apps/menu.c	(Arbeitskopie)
@@ -205,6 +205,7 @@
     }
     current_submenus_menu = (struct menu_item_ex *)menu;

+    viewportmanager_set_custom_vp(true);
     gui_synclist_init(lists,get_menu_item_name,(void*)menu,false,1, parent);
 #ifdef HAVE_LCD_BITMAP
     if (menu->callback_and_desc->icon_id == Icon_NOICON)
@@ -698,6 +699,7 @@
                             gui_synclist_get_sel_pos(&lists), menu);
     }
     viewportmanager_set_statusbar(oldbars);
+    viewportmanager_set_custom_vp(true);
     return ret;
 }

Index: apps/settings.h
===================================================================
--- apps/settings.h	(Revision 19800)
+++ apps/settings.h	(Arbeitskopie)
@@ -741,6 +741,12 @@
     /* If values are just added to the end, no need to bump plugin API
        version. */
     /* new stuff to be added at the end */
+#ifdef HAVE_LCD_BITMAP
+    unsigned char list_vp_config[50]; /* viewport string for the lists */
+#endif
+#ifdef HAVE_REMOTE_LCD
+    unsigned char remote_list_vp_config[50]; /* viewport file for the remote lists */
+#endif
 };

 /** global variables **/
Index: apps/settings_list.c
===================================================================
--- apps/settings_list.c	(Revision 19800)
+++ apps/settings_list.c	(Arbeitskopie)
@@ -177,6 +177,9 @@
                 {.custom = (void*)default}, name, NULL,                 \
             {.custom_setting = (struct custom_setting[]){               \
         {load_from_cfg, write_to_cfg, is_change, set_default}}}}
+#define VIEWPORT_SETTING(var,name,default)      \
+        TEXT_SETTING(0,var,name,default, NULL, NULL)
+
 /* some sets of values which are used more than once, to save memory */
 static const char off_on[] = "off,on";
 static const char off_on_ask[] = "off,on,ask";
@@ -1459,6 +1462,13 @@
                   qs_load_from_cfg, qs_write_to_cfg,
                   qs_is_changed, qs_set_default),
 #endif
+    /* Customizable list */
+#ifdef HAVE_LCD_BITMAP
+    VIEWPORT_SETTING(list_vp_config, "list viewport", ""),
+#endif
+#ifdef HAVE_REMOTE_LCD
+    VIEWPORT_SETTING(remote_list_vp_config, "remote list viewport", ""),
+#endif
 };

 const int nb_settings = sizeof(settings)/sizeof(*settings);
Index: apps/plugin.c
===================================================================
--- apps/plugin.c	(Revision 19800)
+++ apps/plugin.c	(Arbeitskopie)
@@ -627,6 +627,7 @@
     appsversion,
     /* new stuff at the end, sort into place next time
        the API gets incompatible */
+    viewportmanager_set_custom_vp,
 };

 int plugin_load(const char* plugin, const void* parameter)
@@ -742,7 +743,7 @@
     oldbars = viewportmanager_set_statusbar(false);

     rc = hdr->entry_point(parameter);
-    
+
     viewportmanager_set_statusbar(true);

     button_clear_queue();
Index: apps/plugin.h
===================================================================
--- apps/plugin.h	(Revision 19800)
+++ apps/plugin.h	(Arbeitskopie)
@@ -782,6 +782,7 @@
 	const char *appsversion;
     /* new stuff at the end, sort into place next time
        the API gets incompatible */
+    void (*viewportmanager_set_custom_vp)(const bool enable);
 };

 /* plugin header */
Index: apps/root_menu.c
===================================================================
--- apps/root_menu.c	(Revision 19800)
+++ apps/root_menu.c	(Arbeitskopie)
@@ -271,6 +271,7 @@
 #endif
     /* always re-enable the statusbar after the WPS */
     viewportmanager_set_statusbar(true);
+    viewportmanager_set_custom_vp(true);
     return ret_val;
 }
 #if CONFIG_TUNER
Index: wps/WPSLIST
===================================================================
--- wps/WPSLIST	(Revision 19800)
+++ wps/WPSLIST	(Arbeitskopie)
@@ -68,6 +68,8 @@
 iconset:
 viewers iconset:
 selector type: bar (inverse)
+list viewport: -
+remote list viewport: -
 </wps>

 <wps>
@@ -80,6 +82,8 @@
 iconset:
 viewers iconset:
 selector type: bar (inverse)
+list viewport: -
+remote list viewport: -
 </wps>

 <wps>
@@ -92,6 +96,8 @@
 viewers iconset:
 selector type: bar (inverse)
 Statusbar: on
+list viewport: -
+remote list viewport: -
 </wps>

 <wps>
@@ -104,6 +110,8 @@
 iconset:
 viewers iconset:
 selector type: bar (inverse)
+list viewport:
+remote list viewport:
 </wps>

 <rwps>
@@ -151,6 +159,8 @@
 iconset:
 viewers iconset:
 selector type: bar (inverse)
+list viewport: -
+remote list viewport: -
 </wps>

 <rwps>
@@ -158,6 +168,8 @@
 Author: Mike Sobel
 Font: 13-Nimbus.fnt
 Statusbar: on
+list viewport: -
+remote list viewport: -
 </rwps>

 <wps>
@@ -172,6 +184,8 @@
 iconset:
 viewers iconset:
 selector type: bar (inverse)
+list viewport: -
+remote list viewport: -
 </wps>

 <rwps>
@@ -203,6 +217,8 @@
 iconset:
 viewers iconset:
 selector type: bar (inverse)
+list viewport: -
+remote list viewport: -
 </wps>

 <rwps>
@@ -225,6 +241,8 @@
 iconset:
 viewers iconset:
 selector type: bar (inverse)
+list viewport: -
+remote list viewport: -
 </wps>

 <rwps>
@@ -256,6 +274,8 @@
 iconset:
 viewers iconset:
 selector type: bar (inverse)
+list viewport: -
+remote list viewport: -
 </wps>

 <wps>
@@ -341,6 +361,10 @@

 # Whether the WPS is designed to have the statusbar on or off
 Statusbar: on
+
+# list & remote list viewports
+list viewport: -
+remote list viewport: -
 </wps>

 <rwps>
Index: wps/wpsbuild.pl
===================================================================
--- wps/wpsbuild.pl	(Revision 19800)
+++ wps/wpsbuild.pl	(Arbeitskopie)
@@ -51,6 +51,8 @@
 my $viewericon;
 my $lineselecttextcolor;
 my $filetylecolor;
+my $listviewport;
+my $remotelistviewport;

 # LCD sizes
 my ($main_height, $main_width, $main_depth);
@@ -288,6 +290,12 @@
     if($rwps && $has_remote ) {
         push @out, "rwps: /$rbdir/wps/$rwps\n";
     }
+    if(defined($listviewport)) {
+        push @out, "list viewport: $listviewport\n";
+    }
+    if(defined($remotelistviewport) && $has_remote) {
+        push @out, "remote list viewport: $listviewport\n";
+    }
     if(-f "$rbdir/wps/$cfg") {
         print STDERR "wpsbuild warning: wps/$cfg already exists!\n";
     }
@@ -342,6 +350,8 @@
         undef $viewericon;
         undef $lineselecttextcolor;
         undef $filetylecolor;
+        undef $listviewport;
+        undef $remotelistviewport;

         next;
     }
@@ -497,6 +507,12 @@
         elsif($l =~ /^filetype colours: *(.*)/i) {
             $filetylecolor = $1;
         }
+        elsif($l =~ /^list viewport: *(.*)/i) {
+            $listviewport = $1;
+        }
+        elsif($l =~ /^remote list viewport: *(.*)/i) {
+            $remotelistviewport = $1;
+        }
         else{
             #print "Unknown line:  $l!\n";
         }