mirror of
https://github.com/tuxbox-fork-migrations/recycled-ni-neutrino.git
synced 2025-08-28 07:51:11 +02:00
CSignalBar: Fix display "value caption"
Origin commit data
------------------
Branch: ni/coolstream
Commit: 4fa3a245df
Author: Michael Liebmann <tuxcode.bbg@gmail.com>
Date: 2014-01-21 (Tue, 21 Jan 2014)
------------------
No further description and justification available within origin commit message!
------------------
This commit was generated by Migit
This commit is contained in:
@@ -41,6 +41,8 @@ CSignalBar::CSignalBar()
|
||||
{
|
||||
initVarSigBar();
|
||||
sb_name = "SIG";
|
||||
|
||||
initDimensions();
|
||||
initSBItems();
|
||||
}
|
||||
|
||||
@@ -54,6 +56,7 @@ CSignalBar::CSignalBar(const int& xpos, const int& ypos, const int& w, const int
|
||||
height = h;
|
||||
sb_name = sbname;
|
||||
|
||||
initDimensions();
|
||||
initSBItems();
|
||||
}
|
||||
|
||||
@@ -65,15 +68,14 @@ void CSignalBar::initDimensions()
|
||||
if (sb_scale_height == -1)
|
||||
sb_scale_height = sb_item_height;
|
||||
|
||||
//use value in % of signalbox width for scale, rest is reserved for caption
|
||||
sb_scale_width = width*sb_scale_w_percent/100;
|
||||
int dx = 0;
|
||||
int dy = min(sb_item_height, 100);
|
||||
sb_font = *dy_font->getDynFont(dx, dy, "100% "+sb_name);
|
||||
dx += dx/10;
|
||||
sb_scale_width = width - dx;
|
||||
|
||||
int dx = width - sb_scale_width;
|
||||
int dy = sb_item_height;
|
||||
sb_font = *dy_font->getDynFont(dx, dy);
|
||||
|
||||
//use 15% for value and name label
|
||||
sb_vlbl_width = sb_lbl_width = dx /2;
|
||||
sb_vlbl_width = sb_font->getRenderWidth("100% ") + dx/20;
|
||||
sb_lbl_width = dx - sb_vlbl_width;
|
||||
}
|
||||
|
||||
void CSignalBar::initSBItems()
|
||||
@@ -87,9 +89,6 @@ void CSignalBar::initSBItems()
|
||||
sb_caption_color = sbx->getTextColor();
|
||||
}
|
||||
|
||||
//reinit dimensions
|
||||
initDimensions();
|
||||
|
||||
//init items scale, value and name
|
||||
initSBarScale();
|
||||
initSBarValue();
|
||||
@@ -105,7 +104,6 @@ void CSignalBar::initVarSigBar()
|
||||
height = SB_MIN_HEIGHT;
|
||||
|
||||
sb_scale_height = -1;
|
||||
sb_scale_w_percent = 60;
|
||||
dy_font = CNeutrinoFonts::getInstance();
|
||||
|
||||
sb_caption_color= COL_INFOBAR_TEXT;
|
||||
@@ -170,7 +168,7 @@ void CSignalBar::initSBarName()
|
||||
if (sb_lbl == NULL){
|
||||
sb_lbl = new CComponentsLabel();
|
||||
sb_lbl->doPaintBg(false);
|
||||
sb_lbl->setText(sb_name, CTextBox::NO_AUTO_LINEBREAK/* | CTextBox::RIGHT*/, sb_font);
|
||||
sb_lbl->setText(sb_name, CTextBox::NO_AUTO_LINEBREAK | CTextBox::RIGHT, sb_font);
|
||||
sb_lbl->forceTextPaint();
|
||||
sb_lbl->doPaintTextBoxBg(true);
|
||||
}
|
||||
@@ -299,7 +297,6 @@ void CSignalBox::initVarSigBox()
|
||||
sbx_bar_height = height/2;
|
||||
sbx_bar_x = corner_rad;
|
||||
sbx_caption_color = COL_INFOBAR_TEXT;
|
||||
sbx_scale_w_percent = 60;
|
||||
vertical = true;
|
||||
}
|
||||
|
||||
@@ -316,17 +313,22 @@ void CSignalBox::initSignalItems()
|
||||
int sbar_x = sbx_bar_x + fr_thickness;
|
||||
int scale_h = sbar_h * 76 / 100;
|
||||
|
||||
int sbar_sw = sbar->getScaleWidth();
|
||||
int snrbar_sw = snrbar->getScaleWidth();
|
||||
if (sbar_sw < snrbar_sw)
|
||||
snrbar->setScaleWidth(sbar_sw);
|
||||
else if (snrbar_sw < sbar_sw)
|
||||
sbar->setScaleWidth(snrbar_sw);
|
||||
|
||||
sbar->setDimensionsAll(sbar_x, fr_thickness, sbar_w, sbar_h);
|
||||
sbar->setFrontEnd(sbx_frontend);
|
||||
sbar->setCorner(0);
|
||||
sbar->setScaleHeight(scale_h);
|
||||
sbar->setScaleWidth(sbx_scale_w_percent);
|
||||
|
||||
snrbar->setDimensionsAll(vertical ? sbar_x : CC_APPEND, vertical ? CC_APPEND : fr_thickness, sbar_w, sbar_h);
|
||||
snrbar->setFrontEnd(sbx_frontend);
|
||||
snrbar->setCorner(0);
|
||||
snrbar->setScaleHeight(scale_h);
|
||||
snrbar->setScaleWidth(sbx_scale_w_percent);
|
||||
}
|
||||
|
||||
void CSignalBox::paintScale()
|
||||
|
@@ -88,9 +88,6 @@ class CSignalBar : public CComponentsForm
|
||||
int sb_lastsig;
|
||||
///current signal value
|
||||
uint16_t sb_signal;
|
||||
|
||||
///allowed width of scale bar from full width in %, rest used by caption, default value = 60% of width, use setScaleWidth() to set this value
|
||||
short sb_scale_w_percent;
|
||||
|
||||
///initialize all needed basich attributes and objects
|
||||
void initVarSigBar();
|
||||
@@ -126,7 +123,7 @@ class CSignalBar : public CComponentsForm
|
||||
///assigns the height of scale
|
||||
virtual void setScaleHeight(const int& scale_height){sb_scale_height = scale_height;};
|
||||
///assigns the width of scale
|
||||
virtual void setScaleWidth(const short & scale_width_percent){sb_scale_w_percent = scale_width_percent;};
|
||||
virtual void setScaleWidth(const int & scale_width){sb_scale_width = scale_width;};
|
||||
///assigns the name of signal value in the caption object, see also sb_name
|
||||
virtual void setName(const std::string& name){sb_name = name;};
|
||||
|
||||
@@ -136,6 +133,8 @@ class CSignalBar : public CComponentsForm
|
||||
virtual CComponentsLabel* getLabelValObject(){return sb_vlbl;};
|
||||
///returns the name label object, type = CComponentsLabel*
|
||||
virtual CComponentsLabel* getLabelNameObject(){return sb_lbl;};
|
||||
/// return the scale width
|
||||
virtual int getScaleWidth(){ return sb_scale_width;};
|
||||
|
||||
///paint this items
|
||||
virtual void paint(bool do_save_bg);
|
||||
@@ -256,9 +255,6 @@ class CSignalBox : public CComponentsForm
|
||||
///property: text color, see also setTextColor()
|
||||
fb_pixel_t sbx_caption_color;
|
||||
|
||||
///allowed width of scale bar from full width in %, rest used by caption, default value = 60% of width, use setScaleWidth() to set this value
|
||||
short sbx_scale_w_percent;
|
||||
|
||||
// true if vertical arrangement, false if horizontal
|
||||
bool vertical;
|
||||
|
||||
@@ -283,9 +279,6 @@ class CSignalBox : public CComponentsForm
|
||||
void setTextColor(const fb_pixel_t& caption_color){ sbx_caption_color = caption_color;};
|
||||
///get caption color of signalbars, see also property 'sbx_caption_color'
|
||||
fb_pixel_t getTextColor(){return sbx_caption_color;};
|
||||
|
||||
///assigns the width of scale in percent related of full width of signal box, the rest is reserved for text
|
||||
void setScaleWidth(const short & scale_width_percent){sbx_scale_w_percent = scale_width_percent;};
|
||||
|
||||
///paint items
|
||||
void paint(bool do_save_bg);
|
||||
|
@@ -582,7 +582,6 @@ void CMotorControl::showSNR ()
|
||||
if (signalbox == NULL){
|
||||
int xpos1 = x + 10;
|
||||
signalbox = new CSignalBox(xpos1, y + height - mheight - 5, width - 2*(xpos1-x), g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getHeight(), frontend, false);
|
||||
signalbox->setScaleWidth(60); /*%*/
|
||||
signalbox->setColorBody(COL_MENUCONTENT_PLUS_0);
|
||||
signalbox->setTextColor(COL_MENUCONTENT_TEXT);
|
||||
signalbox->doPaintBg(true);
|
||||
|
@@ -552,7 +552,6 @@ void CScanTs::showSNR ()
|
||||
if (signalbox == NULL){
|
||||
CFrontend * frontend = CServiceScan::getInstance()->GetFrontend();
|
||||
signalbox = new CSignalBox(xpos1, y + height - mheight - 5, width - 2*(xpos1-x), g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getHeight(), frontend, false);
|
||||
signalbox->setScaleWidth(60); /*%*/
|
||||
signalbox->setColorBody(COL_MENUCONTENT_PLUS_0);
|
||||
signalbox->setTextColor(COL_MENUCONTENT_TEXT);
|
||||
signalbox->doPaintBg(true);
|
||||
|
@@ -886,7 +886,6 @@ void CStreamInfo2::showSNR ()
|
||||
{
|
||||
if (signalbox == NULL){
|
||||
signalbox = new CSignalBox(x + 10, yypos, 240, 50, frontend);
|
||||
signalbox->setScaleWidth(60); /*%*/
|
||||
signalbox->setColorBody(COL_MENUHEAD_PLUS_0);
|
||||
signalbox->setTextColor(COL_INFOBAR_TEXT);
|
||||
signalbox->doPaintBg(true);
|
||||
|
Reference in New Issue
Block a user