diff --git a/src/driver/volume.cpp b/src/driver/volume.cpp index c7c6c4a77..80ed35c7d 100644 --- a/src/driver/volume.cpp +++ b/src/driver/volume.cpp @@ -182,7 +182,7 @@ void CVolume::setVolume(const neutrino_msg_t key) if (volscale) { if(vol != g_settings.current_volume) { vol = g_settings.current_volume; - volscale->repaintVolScale(); + volscale->paint(); } } diff --git a/src/gui/components/cc_item_text.cpp b/src/gui/components/cc_item_text.cpp index bd37e0d37..67ee50401 100644 --- a/src/gui/components/cc_item_text.cpp +++ b/src/gui/components/cc_item_text.cpp @@ -285,6 +285,7 @@ void CComponentsText::paintText(bool do_save_bg) void CComponentsText::paint(bool do_save_bg) { + OnBeforePaint(); paintText(do_save_bg); } @@ -298,13 +299,14 @@ void CComponentsText::hide() ct_force_text_paint = true; } -void CComponentsText::kill() +void CComponentsText::kill(const fb_pixel_t& bg_color, const int& corner_radius, const int& fblayer_type) { if (ct_textbox) ct_textbox->hide(); ct_old_text.clear(); - CCDraw::kill(); + force_paint_bg = true; + CCDraw::kill(bg_color, corner_radius, fblayer_type); ct_force_text_paint = true; } diff --git a/src/gui/components/cc_item_text.h b/src/gui/components/cc_item_text.h index f744efba2..1de07d08c 100644 --- a/src/gui/components/cc_item_text.h +++ b/src/gui/components/cc_item_text.h @@ -139,7 +139,7 @@ class CComponentsText : public CCTextScreen, public CComponentsItem ///hide textbox void hide(); ///remove textbox from screen - void kill(); + void kill(const fb_pixel_t& bg_color = COL_BACKGROUND_PLUS_0, const int& corner_radius = -1, const int& fblayer_type = CC_FBDATA_TYPES); ///paint text box, parameter do_save_bg: default = true, causes fill of backckrond pixel buffer void paint(bool do_save_bg = CC_SAVE_SCREEN_YES); diff --git a/src/gui/streaminfo2.cpp b/src/gui/streaminfo2.cpp index da7c21c34..3543bbfb6 100644 --- a/src/gui/streaminfo2.cpp +++ b/src/gui/streaminfo2.cpp @@ -649,13 +649,17 @@ void CStreamInfo2::paint_techinfo(int xpos, int ypos) average_bitrate_pos = ypos += iheight; //AUDIOTYPE ypos += iheight; - int type, layer, freq, mode, lbitrate; - audioDecoder->getAudioInfo(type, layer, freq, lbitrate, mode); -printf("\n**** mode: %d\n\n", mode); snprintf(buf, sizeof(buf), "%s:", g_Locale->getText (LOCALE_STREAMINFO_AUDIOTYPE)); g_Font[font_info]->RenderString (xpos, ypos, box_width, buf, COL_MENUCONTENT_TEXT); + int type, layer, freq, mode, lbitrate; + /* + audioDecoder->getAudioInfo() seems broken in libcoolstream2. + ddmode is always 1 ("CH1/CH2"). + */ + audioDecoder->getAudioInfo(type, layer, freq, lbitrate, mode); + if (type == AUDIO_FMT_MPEG) { const char *mpegmodes[] = diff --git a/src/gui/volumebar.cpp b/src/gui/volumebar.cpp index 4e0386058..89226d195 100644 --- a/src/gui/volumebar.cpp +++ b/src/gui/volumebar.cpp @@ -47,8 +47,8 @@ CVolumeBar::CVolumeBar() void CVolumeBar::initVarVolumeBar() { col_body = COL_MENUCONTENT_PLUS_0; - - vb_item_offset = 4; + corner_rad = CORNER_RADIUS_MID; + vb_item_offset = OFFSET_INNER_SMALL; height = g_settings.volume_size; //default height //assume volume value as pointer to global setting @@ -84,14 +84,14 @@ void CVolumeBar::initVolumeBarSize() cvh->getDimensions(&x, &y, &sw, &sh, &vb_icon_w, &vb_digit_w); cvh->getVolBarDimensions(&y, &height); - vb_digit_w += cornerRad()/2; + //vb_digit_w += corner_rad/2; //scale vb_pbw = 200; vb_pbh = height-4*vb_item_offset; //result for width - width = (vb_icon_w + vb_pbw + vb_digit_w) + 4*vb_item_offset; + width = (vb_icon_w + vb_pbw + vb_digit_w) + 4*vb_item_offset + corner_rad/2; //adapt x-pos vb_pbx = vb_item_offset + vb_icon_w + vb_item_offset; @@ -174,19 +174,25 @@ void CVolumeBar::initVolumeBarItems() //init current icon object void CVolumeBar::initVolumeBarIcon() { - vb_icon = new CComponentsPicture(vb_icon_x, CC_CENTERED, vb_icon_w, height, NEUTRINO_ICON_VOLUME); + if (!vb_icon){ + vb_icon = new CComponentsPicture(vb_icon_x, CC_CENTERED, vb_icon_w, height, NEUTRINO_ICON_VOLUME); + //add icon to container + addCCItem(vb_icon); + } + vb_icon->setDimensionsAll(vb_icon_x, CC_CENTERED, vb_icon_w, height); vb_icon->setColorBody(col_body); - vb_icon->setCorner(cornerRad(), CORNER_LEFT); - - //add icon to container - addCCItem(vb_icon); + vb_icon->setCorner(corner_rad, CORNER_LEFT); } //create new scale void CVolumeBar::initVolumeBarScale() { - vb_pb = new CProgressBar(); + if (!vb_pb){ + vb_pb = new CProgressBar(); + //add progressbar to container + addCCItem(vb_pb); + } vb_pb->setType(CProgressBar::PB_REDRIGHT); vb_pb->setRgb(85, 75, 100); @@ -196,40 +202,30 @@ void CVolumeBar::initVolumeBarScale() //NI if (g_settings.theme.progressbar_design == CProgressBar::PB_GRAPHIC) vb_pb->setGraphic("volumebar"); - - //add progressbar to container - addCCItem(vb_pb); } //set digit text with current volume value void CVolumeBar::initVolumeBarDigitValue() { + vb_digit->kill(col_body); vb_digit->setText(*vb_vol ,vb_digit_mode, *(CVolumeHelper::getInstance()->vb_font)); } //create digit void CVolumeBar::initVolumeBarDigit() { - vb_digit = new CComponentsLabel(); + if (!vb_digit) + vb_digit = new CComponentsLabel(this); vb_digit->setDimensionsAll(vb_digit_x, 0, vb_digit_w, height); vb_digit->setTextColor(COL_MENUCONTENT_TEXT); - vb_digit->setCorner(cornerRad(), CORNER_RIGHT); - vb_digit->doPaintTextBoxBg(true); + vb_digit->setCorner(corner_rad, CORNER_RIGHT); initVolumeBarDigitValue(); - - //add digit label to container - addCCItem(vb_digit); } //refresh and paint digit void CVolumeBar::paintVolumeBarDigit() { - // digits - CTextBox* ctb = vb_digit->getCTextBoxObject(); - if (ctb) - ctb->setFontUseDigitHeight(); - // paint digit vb_digit->paint(CC_SAVE_SCREEN_NO); } @@ -253,6 +249,18 @@ void CVolumeBar::paintVolScale() vb_pb->paint(CC_SAVE_SCREEN_NO); } +void CVolumeBar::paint(bool do_save_bg) +{ + //prepare items + initVolumeBarItems(); + + //paint form contents + if (!is_painted) + CComponentsForm::paint(do_save_bg); + else + repaintVolScale(); +} + // CVolumeHelper #################################################################################################### diff --git a/src/gui/volumebar.h b/src/gui/volumebar.h index 62ce4d90c..cfc201305 100644 --- a/src/gui/volumebar.h +++ b/src/gui/volumebar.h @@ -72,9 +72,6 @@ class CVolumeBar : public CComponentsForm void paintVolScale(); void paintVolumeBarDigit(); -// inline int cornerRad() { return (g_settings.rounded_corners) ? height/2 : 0; } - inline int cornerRad() { return (g_settings.rounded_corners) ? CORNER_RADIUS_SMALL : 0; } - public: enum @@ -92,6 +89,7 @@ class CVolumeBar : public CComponentsForm // ~CVolumeBar(); inherited from CComponentsForm void repaintVolScale(); + void paint(bool do_save_bg = CC_SAVE_SCREEN_YES); }; diff --git a/src/gui/widget/menue.cpp b/src/gui/widget/menue.cpp index 82a5e8e43..c6472598b 100644 --- a/src/gui/widget/menue.cpp +++ b/src/gui/widget/menue.cpp @@ -1092,6 +1092,8 @@ void CMenuWidget::hide() header->kill(); if (info_box) info_box->kill(); + if (details_line) + details_line->hide(); frameBuffer->paintBackgroundBoxRel(x, y, full_width, full_height + fbutton_height); //paintHint(-1); }