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
Index: apps/gui/skin_engine/skin_parser.c
===================================================================
--- apps/gui/skin_engine/skin_parser.c	(revision 28246)
+++ apps/gui/skin_engine/skin_parser.c	(working copy)
@@ -600,6 +600,7 @@
     pb->bm.data = NULL; /* no bitmap specified */
     pb->follow_lang_direction = follow_lang_direction > 0;
     pb->nofill = false;
+    pb->nobar = false;
     pb->slider = NULL;
     pb->invert_fill_direction = false;
     pb->horizontal = true;
@@ -672,6 +673,8 @@
             pb->invert_fill_direction = true;
         else if (!strcmp(param->data.text, "nofill"))
             pb->nofill = true;
+        else if (!strcmp(param->data.text, "nobar"))
+            pb->nobar = true;
         else if (!strcmp(param->data.text, "slider"))
         {
             if (curr_param+1 < element->params_count)
Index: apps/gui/skin_engine/skin_display.c
===================================================================
--- apps/gui/skin_engine/skin_display.c	(revision 28246)
+++ apps/gui/skin_engine/skin_display.c	(working copy)
@@ -131,7 +131,7 @@
     struct viewport *vp = pb->vp;
     struct wps_state *state = skin_get_global_state();
     struct mp3entry *id3 = state->id3;
-    int y = pb->y, height = pb->height;
+    int x = pb->x, y = pb->y, width = pb->width, height = pb->height;
     unsigned long length, end;
     int flags = HORIZONTAL;

@@ -194,29 +194,48 @@
         flags |= INNER_NOFILL;
     }

-    if (pb->have_bitmap_pb)
-        gui_bitmap_scrollbar_draw(display, &pb->bm,
-                                pb->x, y, pb->width, height,
-                                length, 0, end, flags);
-    else
-        gui_scrollbar_draw(display, pb->x, y, pb->width, height,
-                           length, 0, end, flags);
+    if (pb->slider)
+    {
+        struct gui_img *img = pb->slider;
+        /* clear the slider */
+        screen_clear_area(display, x, y, width, height);

+        /* shrink the bar so the slider is inside bounds */
+        if (flags&HORIZONTAL)
+        {
+            width -= img->bm.width;
+            x += img->bm.width / 2;
+        }
+        else
+        {
+            height -= img->bm.height;
+            y += img->bm.height / 2;
+        }
+    }
+    if (!pb->nobar)
+    {
+        if (pb->have_bitmap_pb)
+            gui_bitmap_scrollbar_draw(display, &pb->bm,
+                                    x, y, width, height,
+                                    length, 0, end, flags);
+        else
+            gui_scrollbar_draw(display, x, y, width, height,
+                               length, 0, end, flags);
+    }
+
     if (pb->slider)
     {
         int xoff = 0, yoff = 0;
-        int w = pb->width, h = height;
+        int w = width, h = height;
         struct gui_img *img = pb->slider;

         if (flags&HORIZONTAL)
         {
             w = img->bm.width;
-            xoff = pb->width * end / length;
+            xoff = width * end / length;
             if (flags&INVERTFILL)
-                xoff = pb->width - xoff;
-#if 0 /* maybe add this in later, make the slider bmp overlap abit */
+                xoff = width - xoff;
             xoff -= w / 2;
-#endif
         }
         else
         {
@@ -224,23 +243,21 @@
             yoff = height * end / length;
             if (flags&INVERTFILL)
                 yoff = height - yoff;
-#if 0 /* maybe add this in later, make the slider bmp overlap abit */
             yoff -= h / 2;
-#endif
         }
 #if LCD_DEPTH > 1
         if(img->bm.format == FORMAT_MONO) {
 #endif
             display->mono_bitmap_part(img->bm.data,
                                       0, 0, img->bm.width,
-                                      pb->x + xoff, y + yoff, w, h);
+                                      x + xoff, y + yoff, w, h);
 #if LCD_DEPTH > 1
         } else {
             display->transparent_bitmap_part((fb_data *)img->bm.data,
                                              0, 0,
                                              STRIDE(display->screen_type,
                                              img->bm.width, img->bm.height),
-                                             pb->x + xoff, y + yoff, w, h);
+                                             x + xoff, y + yoff, w, h);
         }
 #endif
     }
@@ -251,18 +268,17 @@
         {
 #ifdef AB_REPEAT_ENABLE
             if (ab_repeat_mode_enabled())
-                ab_draw_markers(display, id3->length,
-                                pb->x, y, pb->width, height);
+                ab_draw_markers(display, id3->length, x, y, width, height);
 #endif

             if (id3->cuesheet)
                 cue_draw_markers(display, id3->cuesheet, id3->length,
-                                 pb->x, y+1, pb->width, height-2);
+                                 x, y+1, width, height-2);
         }
 #if 0 /* disable for now CONFIG_TUNER */
         else if (in_radio_screen() || (get_radio_status() != FMRADIO_OFF))
         {
-            presets_draw_markers(display, pb->x, y, pb->width, height);
+            presets_draw_markers(display, x, y, width, height);
         }
 #endif
     }
Index: apps/gui/skin_engine/wps_internals.h
===================================================================
--- apps/gui/skin_engine/wps_internals.h	(revision 28246)
+++ apps/gui/skin_engine/wps_internals.h	(working copy)
@@ -109,6 +109,7 @@

     bool invert_fill_direction;
     bool nofill;
+    bool nobar;
     struct gui_img *slider;
     bool horizontal;
 };
Index: manual/appendix/wps_tags.tex
===================================================================
--- manual/appendix/wps_tags.tex	(revision 28246)
+++ manual/appendix/wps_tags.tex	(working copy)
@@ -650,16 +650,22 @@
   \item[vertical] -- force the bar to be drawn vertically.
   \item[invert] -- invert the draw direction (i.e. right to left, or top to
     bottom).
-  \item[slider] -- draw an preloaded image over the top of the bar. This must be
+  \item[slider] -- draw an preloaded image over the top of the bar so that
+    the centre of the image matches current position. This must be
     followed by the label of the desired image.
   \item[nofill] -- don't draw the fill bar, only the empty image (for the
     desired effect use with the ``slider'' option).
+  \item[nobar] -- don't draw the bar entirely including frame (for use
+    with the ``slider'' option).
 \end{description}

 Example: \config{\%pb(0,0,-,-,-,nofill, slider, slider\_image, invert)} -- draw
 a horizontal progressbar which doesn't fill and draws the image
 ``slider\_image'' which moves right to left.

+Note: if the slider option is used, the bar will be shrank so that the slider will fit
+ inside the specified width and height.
+
 \section{Other Tags}
 \begin{tagmap}
   \config{\%(}           & The character `('\\