Blob Blame History Raw
diff -Nru vdr-1.5.17-orig/skinclassic.c vdr-1.5.17-progressbar/skinclassic.c
--- vdr-1.5.17-orig/skinclassic.c
+++ vdr-1.5.17-progressbar/skinclassic.c
@@ -314,8 +314,47 @@
   for (int i = 0; i < MaxTabs; i++) {
       const char *s = GetTabbedText(Text, i);
       if (s) {
-         int xt = x0 + Tab(i);
-         osd->DrawText(xt, y, s, ColorFg, ColorBg, font, x2 - xt);
+         bool isprogressbar = false;
+         int now = 0, total = 0;
+         // check if progress bar: "[|||||||   ]"
+         if ((strlen(s) > 5 && s[0] == '[' && s[strlen(s) - 1] == ']')) {
+            const char *p = s + 1;
+            // update status
+            isprogressbar = true;
+            for (; *p != ']'; ++p) {
+                // check if progressbar characters
+                if (*p == ' ' || *p == '|') {
+                   // update counters
+                   ++total;
+                   if (*p == '|')
+                      ++now;
+                   }
+                else {
+                   // wrong character detected; not a progressbar
+                   isprogressbar = false;
+                   break;
+                   }
+                }
+            }
+         int xt = x0 + Tab(i);
+         if (isprogressbar) {
+            // define x coordinates of progressbar
+            int px0 = xt;
+            int px1 = (Tab(i + 1)?Tab(i+1):x1) - 5;
+            int px = px0 + max((int)((float) now * (float) (px1 - px0) / (float) total), 1);
+            // define y coordinates of progressbar
+            int py0 = y + 4;
+            int py1 = y + lineHeight - 4;
+            // draw background
+            osd->DrawRectangle(px0, y, (Tab(i + 1)?Tab(i+1):x1) - 1, y + lineHeight - 1, ColorBg);
+            // draw progressbar
+            osd->DrawRectangle(px0,    py0, px,  py1, ColorFg);
+            osd->DrawRectangle(px + 1, py0, px1, py0 + 1, ColorFg);
+            osd->DrawRectangle(px + 1, py1 - 1, px1, py1, ColorFg);
+            osd->DrawRectangle(px1 - 1, py0, px1, py1, ColorFg);
+            }
+         else
+            osd->DrawText(xt, y, s, ColorFg, ColorBg, font, x2 - xt);
          }
       if (!Tab(i + 1))
          break;
diff -Nru vdr-1.5.17-orig/skinsttng.c vdr-1.5.17-progressbar/skinsttng.c
--- vdr-1.5.17-orig/skinsttng.c
+++ vdr-1.5.17-progressbar/skinsttng.c
@@ -558,8 +558,47 @@
   for (int i = 0; i < MaxTabs; i++) {
       const char *s = GetTabbedText(Text, i);
       if (s) {
-         int xt = x3 + 5 + Tab(i);
-         osd->DrawText(xt, y, s, ColorFg, ColorBg, font, x4 - xt);
+         bool isprogressbar = false;
+         int now = 0, total = 0;
+         // check if progress bar: "[|||||||   ]"
+         if ((strlen(s) > 5 && s[0] == '[' && s[strlen(s) - 1] == ']')) {
+            const char *p = s + 1;
+            // update status
+            isprogressbar = true;
+            for (; *p != ']'; ++p) {
+                // check if progressbar characters
+                if (*p == ' ' || *p == '|') {
+                   // update counters
+                   ++total;
+                   if (*p == '|')
+                      ++now;
+                   }
+                else {
+                   // wrong character detected; not a progressbar
+                   isprogressbar = false;
+                   break;
+                   }
+                }
+            }
+         int xt = x3 + 5 + Tab(i);
+         if (isprogressbar) {
+            // define x coordinates of progressbar
+            int px0 = xt;
+            int px1 = x3 + (Tab(i + 1)?Tab(i + 1):x4-x3-5) - 1;
+            int px = px0 + max((int)((float) now * (float) (px1 - px0) / (float) total), 1);
+            // define y coordinates of progressbar
+            int py0 = y + 4;
+            int py1 = y + lineHeight - 4;
+            // draw background
+            osd->DrawRectangle(px0, y, (Tab(i + 1)?Tab(i + 1):x4-x3-5) - 1, y + lineHeight - 1, ColorBg);
+            // draw progressbar
+            osd->DrawRectangle(px0,    py0, px,  py1, ColorFg);
+            osd->DrawRectangle(px + 1, py0, px1, py0 + 1, ColorFg);
+            osd->DrawRectangle(px + 1, py1 - 1, px1, py1, ColorFg);
+            osd->DrawRectangle(px1 - 1, py0, px1, py1, ColorFg);
+            }
+         else
+            osd->DrawText(xt, y, s, ColorFg, ColorBg, font, x4 - xt);
          }
       if (!Tab(i + 1))
          break;