From e642e6f345bdf9a46cdbe0ccd047ecd9ef0e6e8a Mon Sep 17 00:00:00 2001 From: focus Date: Sat, 13 Feb 2010 10:52:19 +0000 Subject: [PATCH] Fix black color corruption after scan; Change progressbar logic to follow progressbar_color setting, if bar created with blink enabled git-svn-id: file:///home/bas/coolstream_public_svn/THIRDPARTY/applications/neutrino-experimental@333 e54a6e83-5905-42d5-8d5c-058d10e6a962 --- src/gui/dboxinfo.cpp | 2 +- src/gui/epgview.cpp | 4 ++-- src/gui/infoviewer.cpp | 18 +++++++++--------- src/gui/motorcontrol.cpp | 6 ++++-- src/gui/moviebrowser.cpp | 2 +- src/gui/scan.cpp | 11 ++++++----- src/gui/streaminfo2.cpp | 4 ++-- src/gui/timeosd.cpp | 2 +- src/gui/widget/progressbar.cpp | 9 +++++++-- src/gui/widget/progressbar.h | 4 ++-- src/neutrino.cpp | 5 +++-- 11 files changed, 38 insertions(+), 29 deletions(-) diff --git a/src/gui/dboxinfo.cpp b/src/gui/dboxinfo.cpp index f65db7a88..60c25d78a 100644 --- a/src/gui/dboxinfo.cpp +++ b/src/gui/dboxinfo.cpp @@ -340,7 +340,7 @@ void CDBoxInfoWidget::paint() //fprintf(stderr, "width: %d offsetw: %d pbw: %d\n", width, offsetw, pbw); if (pbw > 8) /* smaller progressbar is not useful ;) */ { - CProgressBar pb(g_settings.progressbar_color, -1, -1, 30, 100, 70, true); + CProgressBar pb(true, -1, -1, 30, 100, 70, true); pb.paintProgressBarDefault(x+offsetw, ypos+3, pbw, mheight-10, blocks_percent_used, 100); } ypos+= mheight; diff --git a/src/gui/epgview.cpp b/src/gui/epgview.cpp index a739d868d..e1c19477e 100644 --- a/src/gui/epgview.cpp +++ b/src/gui/epgview.cpp @@ -633,7 +633,7 @@ int CEpgData::show(const t_channel_id channel_id, uint64_t a_id, time_t* a_start if ( epg_done!= -1 ) { int pbx = sx + 10 + widthl + 10 + ((ox-104-widthr-widthl-10-10-20)>>1); - CProgressBar pb(g_settings.progressbar_color, -1, -1, 30, 100, 70, true); + CProgressBar pb(true, -1, -1, 30, 100, 70, true); pb.paintProgressBarDefault(pbx, sy+oy-height, 104, height-6, epg_done, 104); } @@ -673,7 +673,7 @@ int CEpgData::show(const t_channel_id channel_id, uint64_t a_id, time_t* a_start if (data == g_InfoViewer->lcdUpdateTimer) { GetEPGData(channel_id, id, &startzeit, false); if ( epg_done!= -1 ) { - CProgressBar pb(g_settings.progressbar_color, -1, -1, 30, 100, 70, true); + CProgressBar pb(true, -1, -1, 30, 100, 70, true); int pbx = sx + 10 + widthl + 10 + ((ox-104-widthr-widthl-10-10-20)>>1); pb.paintProgressBarDefault(pbx, sy+oy-height, 104, height-6, epg_done, 104); } diff --git a/src/gui/infoviewer.cpp b/src/gui/infoviewer.cpp index fb7daf62a..6b3fe0333 100644 --- a/src/gui/infoviewer.cpp +++ b/src/gui/infoviewer.cpp @@ -255,19 +255,19 @@ void CInfoViewer::changePB() { if (sigscale != NULL) delete sigscale; - sigscale = new CProgressBar(g_settings.progressbar_color, BAR_WIDTH, 10, RED_BAR, GREEN_BAR, YELLOW_BAR); + sigscale = new CProgressBar(true, BAR_WIDTH, 10, RED_BAR, GREEN_BAR, YELLOW_BAR); if (snrscale != NULL) delete snrscale; - snrscale = new CProgressBar(g_settings.progressbar_color, BAR_WIDTH, 10, RED_BAR, GREEN_BAR, YELLOW_BAR); + snrscale = new CProgressBar(true, BAR_WIDTH, 10, RED_BAR, GREEN_BAR, YELLOW_BAR); if (hddscale != NULL) delete hddscale; - hddscale = new CProgressBar(g_settings.progressbar_color, 100, 6, 50, GREEN_BAR, 75, true); + hddscale = new CProgressBar(true, 100, 6, 50, GREEN_BAR, 75, true); if (varscale != NULL) delete varscale; - varscale = new CProgressBar(g_settings.progressbar_color, 100, 6, 50, GREEN_BAR, 75, true); + varscale = new CProgressBar(true, 100, 6, 50, GREEN_BAR, 75, true); if (timescale != NULL) delete timescale; - timescale = new CProgressBar(g_settings.progressbar_color, -1, -1, 30, GREEN_BAR, 70, true); + timescale = new CProgressBar(true, -1, -1, 30, GREEN_BAR, 70, true); } void CInfoViewer::paintTime (bool show_dot, bool firstPaint) @@ -381,7 +381,7 @@ void CInfoViewer::showTitle (const int ChanNum, const std::string & Channel, con if(pbBlinkChange != g_settings.progressbar_color){ pbBlinkChange = g_settings.progressbar_color; - changePB(); + //changePB(); } if (casysChange != g_settings.casystem_display || channellogoChange != g_settings.infobar_show_channellogo){ @@ -1810,10 +1810,10 @@ void CInfoViewer::paint_ca_icons(int caid, char * icon) static char * gray = (char *) "white"; //static char * green = (char *) "green"; - static char * white = (char *) "yellow"; - extern int pmt_caids[10]; +static char * white = (char *) "yellow"; +extern int pmt_caids[10]; - void CInfoViewer::showIcon_CA_Status (int notfirst) +void CInfoViewer::showIcon_CA_Status (int notfirst) { #if 0 FILE *f; diff --git a/src/gui/motorcontrol.cpp b/src/gui/motorcontrol.cpp index 208bee4ce..f2ad3f00c 100644 --- a/src/gui/motorcontrol.cpp +++ b/src/gui/motorcontrol.cpp @@ -89,8 +89,8 @@ void CMotorControl::Init(void) motorPosition = 1; satellitePosition = 0; stepDelay = 10; - sigscale = new CProgressBar(g_settings.progressbar_color, BAR_WIDTH, BAR_HEIGHT); - snrscale = new CProgressBar(g_settings.progressbar_color, BAR_WIDTH, BAR_HEIGHT); + sigscale = new CProgressBar(true, BAR_WIDTH, BAR_HEIGHT); + snrscale = new CProgressBar(true, BAR_WIDTH, BAR_HEIGHT); pbBlinkChange = g_settings.progressbar_color; } @@ -107,6 +107,7 @@ int CMotorControl::exec(CMenuTarget* parent, const std::string &) CZapitClient::commandSetScanSatelliteList sat; sat_iterator_t sit; +#if 0 if(pbBlinkChange != g_settings.progressbar_color){ pbBlinkChange = g_settings.progressbar_color; if(sigscale){ @@ -118,6 +119,7 @@ int CMotorControl::exec(CMenuTarget* parent, const std::string &) snrscale = new CProgressBar(g_settings.progressbar_color, BAR_WIDTH, BAR_HEIGHT); } } +#endif sigscale->reset(); snrscale->reset(); lastsnr = lastsig = -1; diff --git a/src/gui/moviebrowser.cpp b/src/gui/moviebrowser.cpp index 324d8742c..9b9039e5e 100644 --- a/src/gui/moviebrowser.cpp +++ b/src/gui/moviebrowser.cpp @@ -4143,7 +4143,7 @@ printf("copy: len %d minute %lld second %lld\n", len, len ? size/len : 511040*60 CFrameBuffer * frameBuffer = CFrameBuffer::getInstance(); if (! timescale) - timescale = new CProgressBar(g_settings.progressbar_color, 200, 15, 0, 100, 0); + timescale = new CProgressBar(true, 200, 15, 0, 100, 0); int dx = 256; int x = (((g_settings.screen_EndX- g_settings.screen_StartX)- dx) / 2) + g_settings.screen_StartX; int y = g_settings.screen_EndY - 50; diff --git a/src/gui/scan.cpp b/src/gui/scan.cpp index e42e8b10d..051a8c6ed 100644 --- a/src/gui/scan.cpp +++ b/src/gui/scan.cpp @@ -79,8 +79,8 @@ CScanTs::CScanTs() total = done = 0; freqready = 0; - sigscale = new CProgressBar(g_settings.progressbar_color, BAR_WIDTH, BAR_HEIGHT); - snrscale = new CProgressBar(g_settings.progressbar_color, BAR_WIDTH, BAR_HEIGHT); + sigscale = new CProgressBar(true, BAR_WIDTH, BAR_HEIGHT); + snrscale = new CProgressBar(true, BAR_WIDTH, BAR_HEIGHT); pbBlinkChange = g_settings.progressbar_color; } @@ -117,6 +117,7 @@ int CScanTs::exec(CMenuTarget* /*parent*/, const std::string & actionKey) if(scan_all) scan_mode |= 0xFF00; +#if 0 if(pbBlinkChange != g_settings.progressbar_color){ pbBlinkChange = g_settings.progressbar_color; if(sigscale){ @@ -128,7 +129,7 @@ int CScanTs::exec(CMenuTarget* /*parent*/, const std::string & actionKey) snrscale = new CProgressBar(g_settings.progressbar_color, BAR_WIDTH, BAR_HEIGHT); } } - +#endif sigscale->reset(); snrscale->reset(); lastsig = lastsnr = -1; @@ -386,7 +387,7 @@ void CScanTs::paintRadar(void) sprintf(filename, "radar%d.raw", radar); radar = (radar + 1) % 10; - frameBuffer->paintIcon8(filename, xpos_radar, ypos_radar, 17); + frameBuffer->paintIcon8(filename, xpos_radar, ypos_radar, 18); } void CScanTs::hide() @@ -423,7 +424,7 @@ void CScanTs::paint(bool fortest) //frameBuffer->paintBoxRel(x, ypos + hheight, width, height - hheight, COL_MENUCONTENT_PLUS_0); frameBuffer->paintBoxRel(x, ypos + hheight, width, height - hheight, COL_MENUCONTENT_PLUS_0, ROUND_RADIUS, CORNER_BOTTOM); - frameBuffer->loadPal("radar.pal", 17, 37); + frameBuffer->loadPal("radar.pal", 18, 38); ypos = y + hheight + (mheight >> 1); diff --git a/src/gui/streaminfo2.cpp b/src/gui/streaminfo2.cpp index 7edccd683..04e740cf8 100644 --- a/src/gui/streaminfo2.cpp +++ b/src/gui/streaminfo2.cpp @@ -137,8 +137,8 @@ int CStreamInfo2::doSignalStrengthLoop () { #define BAR_WIDTH 150 #define BAR_HEIGHT 12 - sigscale = new CProgressBar(g_settings.progressbar_color, BAR_WIDTH, BAR_HEIGHT); - snrscale = new CProgressBar(g_settings.progressbar_color, BAR_WIDTH, BAR_HEIGHT); + sigscale = new CProgressBar(true, BAR_WIDTH, BAR_HEIGHT); + snrscale = new CProgressBar(true, BAR_WIDTH, BAR_HEIGHT); lastsnr = lastsig = -1; neutrino_msg_t msg; diff --git a/src/gui/timeosd.cpp b/src/gui/timeosd.cpp index 771a1e0a1..92cfb78d2 100644 --- a/src/gui/timeosd.cpp +++ b/src/gui/timeosd.cpp @@ -43,7 +43,7 @@ CTimeOSD::CTimeOSD() m_mode=MODE_ASC; GetDimensions(); if (! timescale) - timescale = new CProgressBar(g_settings.progressbar_color, 200, 32, 40, 100, 70, true); + timescale = new CProgressBar(true, 200, 32, 40, 100, 70, true); } CTimeOSD::~CTimeOSD() diff --git a/src/gui/widget/progressbar.cpp b/src/gui/widget/progressbar.cpp index 31df52b2c..3c00008a2 100644 --- a/src/gui/widget/progressbar.cpp +++ b/src/gui/widget/progressbar.cpp @@ -48,6 +48,7 @@ CProgressBar::CProgressBar(const bool bl, const int w, const int h, width = w; height = h; last_width = -1; + bl_changed = g_settings.progressbar_color; } CProgressBar::~CProgressBar() @@ -109,6 +110,10 @@ void CProgressBar::realpaint(const int pos_x, const int pos_y, const char *iconfile, bool paintZero) { + if(bl_changed != g_settings.progressbar_color) { + bl_changed = g_settings.progressbar_color; + reset(); + } // set colors fb_pixel_t active_col = activebar_col != 0 ? activebar_col : COL_INFOBAR_PLUS_7; fb_pixel_t passive_col = passivebar_col != 0 ? passivebar_col : COL_INFOBAR_PLUS_3; @@ -118,7 +123,7 @@ void CProgressBar::realpaint(const int pos_x, const int pos_y, const int c_rad = 0; /* if the bar is too small, do not draw the borders around it */ - if (height / 2 <= frame_widht || blink || backgroundbar_col == 0) + if (height / 2 <= frame_widht || (blink && g_settings.progressbar_color) || backgroundbar_col == 0) frame_widht = 0; // get icon size int icon_w = 0, icon_h = 0; @@ -142,7 +147,7 @@ void CProgressBar::realpaint(const int pos_x, const int pos_y, // max height progressbar bar, if icon height larger than pb_height then get height from icon int pb_max_height = icon_h > height ? icon_h + 2* frame_widht : height; - if (! blink) + if (!blink || !g_settings.progressbar_color) { // max height of active/passive bar int bar_height = pb_max_height - 2*frame_widht; diff --git a/src/gui/widget/progressbar.h b/src/gui/widget/progressbar.h index 113c27ca7..30ca624aa 100644 --- a/src/gui/widget/progressbar.h +++ b/src/gui/widget/progressbar.h @@ -37,7 +37,7 @@ class CProgressBar int frame_widht; int last_width; int red, green, yellow; - bool blink, invert; + bool blink, invert, bl_changed; int width, height; void realpaint(const int pos_x, const int pos_y, const int value, const int max_value, @@ -53,7 +53,7 @@ class CProgressBar public: /* parameters: - blinkenligts: true if you want colored progressbars. needed, no default. + blinkenligts: true if you want code to follow progressbar_color. needed, no default. w, h: width / height of bar. Can later be set with paintProgressbar. paintProgressBar2 can oly be used if w and h are set. r, g, b: percentage of the bar where red/green/yellow is used. diff --git a/src/neutrino.cpp b/src/neutrino.cpp index 84376112c..60567a202 100644 --- a/src/neutrino.cpp +++ b/src/neutrino.cpp @@ -2375,7 +2375,7 @@ int CNeutrinoApp::run(int argc, char **argv) g_EpgData = new CEpgData; g_InfoViewer = new CInfoViewer; g_EventList = new EventList; - g_volscale = new CProgressBar(g_settings.progressbar_color, 200, 15, 50, 100, 80, true); + g_volscale = new CProgressBar(true, 200, 15, 50, 100, 80, true); g_CamHandler = new CCAMMenuHandler(); g_CamHandler->init(); @@ -3690,13 +3690,14 @@ void CNeutrinoApp::setVolume(const neutrino_msg_t key, const bool bDoPaint, bool pixbuf = new fb_pixel_t[dx * dy]; if(pixbuf!= NULL) frameBuffer->SaveScreen(x, y, dx, dy, pixbuf); +#if 0 if(pbBlinkChange != g_settings.progressbar_color){ pbBlinkChange = g_settings.progressbar_color; if(g_volscale) delete g_volscale; g_volscale = new CProgressBar(g_settings.progressbar_color, 200, 15, 50, 100, 80, true); } - +#endif frameBuffer->paintIcon(NEUTRINO_ICON_VOLUME,x,y, 0, COL_INFOBAR); frameBuffer->paintBoxRel (x + 40, y+12, 200, 15, COL_INFOBAR_PLUS_0); g_volscale->reset();