Merge branch 'pu/font' of https://github.com/tuxbox-neutrino/gui-neutrino into ni/tuxbox

Conflicts:
	src/gui/volumebar.cpp


Origin commit data
------------------
Branch: ni/coolstream
Commit: cd8b9f9b04
Author: vanhofen <vanhofen@gmx.de>
Date: 2017-01-29 (Sun, 29 Jan 2017)



------------------
This commit was generated by Migit
This commit is contained in:
vanhofen
2017-01-29 22:37:31 +01:00
6 changed files with 41 additions and 31 deletions

View File

@@ -159,7 +159,7 @@ void CVolume::setVolume(const neutrino_msg_t key)
if (volscale) { if (volscale) {
if(vol != g_settings.current_volume) { if(vol != g_settings.current_volume) {
vol = g_settings.current_volume; vol = g_settings.current_volume;
volscale->repaintVolScale(); volscale->paint();
} }
} }

View File

@@ -285,6 +285,7 @@ void CComponentsText::paintText(bool do_save_bg)
void CComponentsText::paint(bool do_save_bg) void CComponentsText::paint(bool do_save_bg)
{ {
OnBeforePaint();
paintText(do_save_bg); paintText(do_save_bg);
} }
@@ -298,13 +299,14 @@ void CComponentsText::hide()
ct_force_text_paint = true; 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) if (ct_textbox)
ct_textbox->hide(); ct_textbox->hide();
ct_old_text.clear(); ct_old_text.clear();
CCDraw::kill(); force_paint_bg = true;
CCDraw::kill(bg_color, corner_radius, fblayer_type);
ct_force_text_paint = true; ct_force_text_paint = true;
} }

View File

@@ -139,7 +139,7 @@ class CComponentsText : public CCTextScreen, public CComponentsItem
///hide textbox ///hide textbox
void hide(); void hide();
///remove textbox from screen ///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 ///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); void paint(bool do_save_bg = CC_SAVE_SCREEN_YES);

View File

@@ -47,8 +47,8 @@ CVolumeBar::CVolumeBar()
void CVolumeBar::initVarVolumeBar() void CVolumeBar::initVarVolumeBar()
{ {
col_body = COL_MENUCONTENT_PLUS_0; col_body = COL_MENUCONTENT_PLUS_0;
corner_rad = CORNER_RADIUS_MID;
vb_item_offset = 4; vb_item_offset = OFFSET_INNER_SMALL;
height = g_settings.volume_size; //default height height = g_settings.volume_size; //default height
//assume volume value as pointer to global setting //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->getDimensions(&x, &y, &sw, &sh, &vb_icon_w, &vb_digit_w);
cvh->getVolBarDimensions(&y, &height); cvh->getVolBarDimensions(&y, &height);
vb_digit_w += cornerRad()/2; //vb_digit_w += corner_rad/2;
//scale //scale
vb_pbw = 200; vb_pbw = 200;
vb_pbh = height-4*vb_item_offset; vb_pbh = height-4*vb_item_offset;
//result for width //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 //adapt x-pos
vb_pbx = vb_item_offset + vb_icon_w + vb_item_offset; vb_pbx = vb_item_offset + vb_icon_w + vb_item_offset;
@@ -174,19 +174,25 @@ void CVolumeBar::initVolumeBarItems()
//init current icon object //init current icon object
void CVolumeBar::initVolumeBarIcon() 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->setColorBody(col_body);
vb_icon->setCorner(cornerRad(), CORNER_LEFT); vb_icon->setCorner(corner_rad, CORNER_LEFT);
//add icon to container
addCCItem(vb_icon);
} }
//create new scale //create new scale
void CVolumeBar::initVolumeBarScale() 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->setType(CProgressBar::PB_REDRIGHT);
vb_pb->setRgb(85, 75, 100); vb_pb->setRgb(85, 75, 100);
@@ -196,40 +202,30 @@ void CVolumeBar::initVolumeBarScale()
//NI //NI
if (g_settings.theme.progressbar_design == CProgressBar::PB_GRAPHIC) if (g_settings.theme.progressbar_design == CProgressBar::PB_GRAPHIC)
vb_pb->setGraphic("volumebar"); vb_pb->setGraphic("volumebar");
//add progressbar to container
addCCItem(vb_pb);
} }
//set digit text with current volume value //set digit text with current volume value
void CVolumeBar::initVolumeBarDigitValue() void CVolumeBar::initVolumeBarDigitValue()
{ {
vb_digit->kill(col_body);
vb_digit->setText(*vb_vol ,vb_digit_mode, *(CVolumeHelper::getInstance()->vb_font)); vb_digit->setText(*vb_vol ,vb_digit_mode, *(CVolumeHelper::getInstance()->vb_font));
} }
//create digit //create digit
void CVolumeBar::initVolumeBarDigit() 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->setDimensionsAll(vb_digit_x, 0, vb_digit_w, height);
vb_digit->setTextColor(COL_MENUCONTENT_TEXT); vb_digit->setTextColor(COL_MENUCONTENT_TEXT);
vb_digit->setCorner(cornerRad(), CORNER_RIGHT); vb_digit->setCorner(corner_rad, CORNER_RIGHT);
vb_digit->doPaintTextBoxBg(true);
initVolumeBarDigitValue(); initVolumeBarDigitValue();
//add digit label to container
addCCItem(vb_digit);
} }
//refresh and paint digit //refresh and paint digit
void CVolumeBar::paintVolumeBarDigit() void CVolumeBar::paintVolumeBarDigit()
{ {
// digits
CTextBox* ctb = vb_digit->getCTextBoxObject();
if (ctb)
ctb->setFontUseDigitHeight();
// paint digit // paint digit
vb_digit->paint(CC_SAVE_SCREEN_NO); vb_digit->paint(CC_SAVE_SCREEN_NO);
} }
@@ -253,6 +249,18 @@ void CVolumeBar::paintVolScale()
vb_pb->paint(CC_SAVE_SCREEN_NO); 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 #################################################################################################### // CVolumeHelper ####################################################################################################

View File

@@ -72,9 +72,6 @@ class CVolumeBar : public CComponentsForm
void paintVolScale(); void paintVolScale();
void paintVolumeBarDigit(); 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: public:
enum enum
@@ -92,6 +89,7 @@ class CVolumeBar : public CComponentsForm
// ~CVolumeBar(); inherited from CComponentsForm // ~CVolumeBar(); inherited from CComponentsForm
void repaintVolScale(); void repaintVolScale();
void paint(bool do_save_bg = CC_SAVE_SCREEN_YES);
}; };

View File

@@ -1093,6 +1093,8 @@ void CMenuWidget::hide()
header->kill(); header->kill();
if (info_box) if (info_box)
info_box->kill(); info_box->kill();
if (details_line)
details_line->hide();
frameBuffer->paintBackgroundBoxRel(x, y, full_width, full_height + fbutton_height); frameBuffer->paintBackgroundBoxRel(x, y, full_width, full_height + fbutton_height);
//paintHint(-1); //paintHint(-1);
} }