From 143c5948fcba2e50d5ca148fd971b0fb3c7dba8c Mon Sep 17 00:00:00 2001 From: seife Date: Sun, 13 Dec 2009 22:23:32 +0000 Subject: [PATCH] neutrino: add an option to choose the classic progress bar style add a #define NO_BLINKENLIGHTS in scale.h to choose the classic progress bar style instead of the colorful blinkenlights. TODO: make this a configure option. git-svn-id: file:///home/bas/coolstream_public_svn/THIRDPARTY/applications/neutrino-experimental@48 e54a6e83-5905-42d5-8d5c-058d10e6a962 --- src/gui/scale.cpp | 19 +++++++++++++++---- src/gui/scale.h | 15 +++++++++++++-- 2 files changed, 28 insertions(+), 6 deletions(-) diff --git a/src/gui/scale.cpp b/src/gui/scale.cpp index 432de0310..eadca127d 100644 --- a/src/gui/scale.cpp +++ b/src/gui/scale.cpp @@ -39,20 +39,22 @@ inline unsigned int make16color(__u32 rgb) CScale::CScale (int w, int h, int r, int g, int b, bool inv) { - double div; -//printf("new SCALE, w %d h %d size %d\n", w, h, sizeof(CScale)); fflush(stdout); - frameBuffer = CFrameBuffer::getInstance (); width = w; height = h; inverse = inv; - +#ifndef NO_BLINKENLIGHTS + double div; +//printf("new SCALE, w %d h %d size %d\n", w, h, sizeof(CScale)); fflush(stdout); + frameBuffer = CFrameBuffer::getInstance (); div = (double) 100 / (double) width; red = (double) r / (double) div / (double) ITEMW; green = (double) g / (double) div / (double) ITEMW; yellow = (double) b / (double) div / (double) ITEMW; +#endif percent = 255; } +#ifndef NO_BLINKENLIGHTS void CScale::paint (int x, int y, int pcr) { int i, j, siglen; @@ -118,6 +120,15 @@ void CScale::paint (int x, int y, int pcr) percent = pcr; } } +#else +void CScale::paint (int x, int y, int pcr) +{ + if (pcr == percent) + return; + percent = pcr; + pb.paintProgressBar(x, y, width, height, pcr * width / 100, width, COL_INFOBAR_PLUS_3, COL_INFOBAR_PLUS_0, COL_INFOBAR_PLUS_3); +} +#endif void CScale::reset () { diff --git a/src/gui/scale.h b/src/gui/scale.h index 97b4f5dd4..81d68461a 100644 --- a/src/gui/scale.h +++ b/src/gui/scale.h @@ -1,17 +1,28 @@ #ifndef __scale_ #define __scale_ - +/* define this if you do not want colorful blinkenlights + the classical progressbars will be used instead. */ +// #define NO_BLINKENLIGHTS #include +#ifdef NO_BLINKENLIGHTS +#include +#endif + class CScale { private: +#ifdef NO_BLINKENLIGHTS + CProgressBar pb; +#else CFrameBuffer * frameBuffer; + short red, green, yellow; +#endif short width; short height; char percent; - short red, green, yellow; bool inverse; + public: CScale(int w, int h, int r, int g, int b, bool inv = false); void paint(int x, int y, int pcr);