mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-09-02 10:21:10 +02:00
Merge remote-tracking branch 'uncool/cst-next'
This commit is contained in:
@@ -103,7 +103,7 @@ void CComponentsDetailLine::paint(bool do_save_bg)
|
||||
cc_fbdata_t fbdata[] =
|
||||
{
|
||||
/*buffered bg full width and height */
|
||||
{true, CC_FBDATA_TYPE_BGSCREEN, x, y_mark_top, width, y_mark_down-y_mark_top+h_mark_down, 0, 0, 0, 0, NULL, NULL, NULL, false},
|
||||
{true, CC_FBDATA_TYPE_BGSCREEN, x, y_mark_top, width, y_mark_down-y_mark_top+h_mark_down+sw, 0, 0, 0, 0, NULL, NULL, NULL, false},
|
||||
|
||||
/* vertical item mark | */
|
||||
{true, CC_FBDATA_TYPE_BOX, x+width-thickness-sw, y_mark_top, thickness, h_mark_top, col_body, 0, 0, 0, NULL, NULL, NULL, false},
|
||||
|
@@ -50,6 +50,7 @@ CCDraw::CCDraw() : COSDFader(g_settings.theme.menu_Content_alpha)
|
||||
|
||||
shadow = CC_SHADOW_OFF;
|
||||
shadow_w = shadow_w_old = SHADOW_OFFSET;
|
||||
shadow_force = false;
|
||||
|
||||
cc_paint_cache = false;
|
||||
cc_scrdata.pixbuf = NULL;
|
||||
@@ -543,7 +544,7 @@ void CCDraw::paintFbItems(bool do_save_bg)
|
||||
frameBuffer->paintBackgroundBoxRel(x, y, fbdata.dx, fbdata.dy);
|
||||
}
|
||||
}
|
||||
if (fbtype == CC_FBDATA_TYPE_SHADOW_BOX && !is_painted) { //TODO: is_painted is too global here, shadow will not paint on current instance without called kill/hide
|
||||
if (fbtype == CC_FBDATA_TYPE_SHADOW_BOX && (!is_painted || shadow_force)) {
|
||||
if (fbdata.enabled) {
|
||||
/* here we paint the shadow around the body
|
||||
* on 1st step we check for already cached screen buffer, if true
|
||||
@@ -688,12 +689,13 @@ bool CCDraw::doPaintBg(bool do_paint)
|
||||
return true;
|
||||
}
|
||||
|
||||
void CCDraw::enableShadow(int mode, const int& shadow_width)
|
||||
void CCDraw::enableShadow(int mode, const int& shadow_width, bool force_paint)
|
||||
{
|
||||
if (shadow != mode)
|
||||
shadow = mode;
|
||||
if (shadow != CC_SHADOW_OFF)
|
||||
if (shadow_width != -1)
|
||||
setShadowWidth(shadow_width);
|
||||
shadow_force = force_paint;
|
||||
}
|
||||
|
||||
|
@@ -84,6 +84,8 @@ class CCDraw : public COSDFader, public CComponentsSignals
|
||||
int shadow;
|
||||
///property: width of shadow
|
||||
int shadow_w, shadow_w_old;
|
||||
///property: force shadow paint, see enableShadow()
|
||||
bool shadow_force;
|
||||
|
||||
///returns true if internal property was changed
|
||||
virtual bool hasChanges();
|
||||
@@ -245,8 +247,11 @@ class CCDraw : public COSDFader, public CComponentsSignals
|
||||
|
||||
///switch shadow on/off
|
||||
virtual void setShadowWidth(const int& shadow_width){if (shadow_w != shadow_width) shadow_w = shadow_width;}
|
||||
///Note: it's recommended to use #defines: CC_SHADOW_ON=true or CC_SHADOW_OFF=false as parameter, see also cc_types.h
|
||||
virtual void enableShadow(int mode = CC_SHADOW_ON, const int& shadow_width = -1);
|
||||
/**1st parameter requires defines CC_SHADOW_ON (default), CC_SHADOW_OFF, CC_SHADOW_BOTTOM or CC_SHADOW_RIGHT, see also cc_types.h
|
||||
* 2nd parameter defines shadow width, default = defined by system
|
||||
* 3rd parameter forces paint of shadow layer, default = false, Note: default shadow will paint only on first paint, use 3rd parameter=true ignores this
|
||||
*/
|
||||
virtual void enableShadow(int mode = CC_SHADOW_ON, const int& shadow_width = -1, bool force_paint = false);
|
||||
///switch shadow off
|
||||
virtual void disableShadow(){enableShadow(CC_SHADOW_OFF);}
|
||||
|
||||
|
@@ -202,7 +202,7 @@ void CComponentsForm::clear()
|
||||
}
|
||||
|
||||
|
||||
void CComponentsForm::addCCItem(CComponentsItem* cc_Item)
|
||||
int CComponentsForm::addCCItem(CComponentsItem* cc_Item)
|
||||
{
|
||||
if (cc_Item){
|
||||
dprintf(DEBUG_DEBUG, "[CComponentsForm] %s-%d try to add cc_Item [type %d] to form [current index=%d] \n", __func__, __LINE__, cc_Item->getItemType(), cc_item_index);
|
||||
@@ -218,16 +218,18 @@ void CComponentsForm::addCCItem(CComponentsItem* cc_Item)
|
||||
cc_Item->setFocus(true);
|
||||
|
||||
dprintf(DEBUG_DEBUG, "\t%s-%d parent index = %d, assigned index ======> %d\n", __func__, __LINE__, cc_item_index, new_index);
|
||||
|
||||
return getCCItemId(cc_Item);
|
||||
}
|
||||
else
|
||||
dprintf(DEBUG_NORMAL, "[CComponentsForm] %s-%d tried to add an empty or invalide cc_item !!!\n", __func__, __LINE__);
|
||||
return -1;
|
||||
}
|
||||
|
||||
void CComponentsForm::addCCItem(const std::vector<CComponentsItem*> &cc_Items)
|
||||
int CComponentsForm::addCCItem(const std::vector<CComponentsItem*> &cc_Items)
|
||||
{
|
||||
for (size_t i= 0; i< cc_Items.size(); i++)
|
||||
addCCItem(cc_Items[i]);
|
||||
return size();
|
||||
}
|
||||
|
||||
int CComponentsForm::getCCItemId(CComponentsItem* cc_Item)
|
||||
|
@@ -78,8 +78,10 @@ class CComponentsForm : public CComponentsItem
|
||||
///NOTE: Items always have parent bindings to "this" and use the parent background color as default! Set parameter 'ignore_parent=true' to ignore parent background color!
|
||||
virtual void killCCItems(const fb_pixel_t& bg_color, bool ignore_parent);
|
||||
|
||||
virtual void addCCItem(CComponentsItem* cc_Item);
|
||||
virtual void addCCItem(const std::vector<CComponentsItem*> &cc_items);
|
||||
///add an item to form collection, returns id
|
||||
virtual int addCCItem(CComponentsItem* cc_Item);
|
||||
///add items from a vector to form collection, returns size/count of items
|
||||
virtual int addCCItem(const std::vector<CComponentsItem*> &cc_items);
|
||||
virtual void insertCCItem(const uint& cc_item_id, CComponentsItem* cc_Item);
|
||||
|
||||
///removes item object from container and deallocates instance
|
||||
|
@@ -34,6 +34,7 @@
|
||||
#include <sstream>
|
||||
|
||||
#define SB_MIN_HEIGHT 12
|
||||
#define REF_PERCENT_TXT "00% "
|
||||
|
||||
using namespace std;
|
||||
|
||||
@@ -72,11 +73,12 @@ void CSignalBar::initDimensions()
|
||||
|
||||
int dx = 0;
|
||||
int dy = min(sb_item_height, 100);
|
||||
sb_font = *dy_font->getDynFont(dx, dy, "100% "+sb_name);
|
||||
|
||||
sb_font = *dy_font->getDynFont(dx, dy, REF_PERCENT_TXT + sb_name);
|
||||
dx += dx/10;
|
||||
sb_scale_width = width - dx;
|
||||
|
||||
sb_vlbl_width = sb_font->getRenderWidth("100% ") + dx/20;
|
||||
sb_vlbl_width = sb_font->getRenderWidth(REF_PERCENT_TXT) + dx/20;
|
||||
sb_lbl_width = dx - sb_vlbl_width;
|
||||
}
|
||||
|
||||
@@ -145,14 +147,13 @@ void CSignalBar::initSBarValue()
|
||||
sb_vlbl->doPaintBg(false);
|
||||
sb_vlbl->doPaintTextBoxBg(false);
|
||||
sb_vlbl->enableTboxSaveScreen(true);
|
||||
sb_vlbl->setText(" 0%", sb_val_mode, sb_font);
|
||||
sb_vlbl->setText(REF_PERCENT_TXT, sb_val_mode, sb_font);
|
||||
}
|
||||
|
||||
//move and set dimensions
|
||||
int vlbl_x = sb_scale->getXPos() + sb_scale_width + append_y_offset;
|
||||
int vlbl_h = sb_scale->getHeight();
|
||||
int vlbl_y = sb_item_height/2 + sb_item_top - vlbl_h/2 - append_x_offset;
|
||||
sb_vlbl->setDimensionsAll(vlbl_x, vlbl_y, sb_vlbl_width - append_x_offset, vlbl_h);
|
||||
sb_vlbl->setDimensionsAll(vlbl_x, 1, sb_vlbl_width - append_x_offset, vlbl_h);
|
||||
|
||||
//set current text and body color color
|
||||
sb_vlbl->setTextColor(sb_caption_color);
|
||||
@@ -177,8 +178,7 @@ void CSignalBar::initSBarName()
|
||||
//move and set dimensions
|
||||
int lbl_x = sb_vlbl->getXPos()+ sb_vlbl->getWidth();
|
||||
int lbl_h = sb_vlbl->getHeight();
|
||||
int lbl_y = sb_item_height/2 + sb_item_top - lbl_h/2 - append_x_offset;
|
||||
sb_lbl->setDimensionsAll(lbl_x, lbl_y, sb_lbl_width- append_x_offset, lbl_h);
|
||||
sb_lbl->setDimensionsAll(lbl_x, 1, sb_lbl_width- append_x_offset, lbl_h);
|
||||
|
||||
//set current text and body color
|
||||
sb_lbl->setTextColor(sb_caption_color);
|
||||
@@ -252,7 +252,7 @@ void CSignalNoiseRatioBar::Refresh()
|
||||
|
||||
|
||||
//**********************************************************************************************************************
|
||||
CSignalBox::CSignalBox(const int& xpos, const int& ypos, const int& w, const int& h, CFrontend *frontend_ref, const bool vert, CComponentsForm *parent)
|
||||
CSignalBox::CSignalBox(const int& xpos, const int& ypos, const int& w, const int& h, CFrontend *frontend_ref, const bool vert, CComponentsForm *parent, const std::string& sig_name, const std::string& snr_name)
|
||||
{
|
||||
initVarSigBox();
|
||||
vertical = vert;
|
||||
@@ -271,11 +271,11 @@ CSignalBox::CSignalBox(const int& xpos, const int& ypos, const int& w, const int
|
||||
sbx_bar_width = width/2-2*corner_rad;
|
||||
}
|
||||
|
||||
sbar = new CSignalBar(sbx_bar_x, 0, sbx_bar_width, sbx_bar_height, sbx_frontend);
|
||||
sbar = new CSignalBar(sbx_bar_x, 1, sbx_bar_width, sbx_bar_height, sbx_frontend, sig_name);
|
||||
sbar->doPaintBg(false);
|
||||
addCCItem(sbar);
|
||||
|
||||
snrbar = new CSignalNoiseRatioBar(vertical ? sbx_bar_x : CC_APPEND, vertical ? CC_APPEND : 0, sbx_bar_width, sbx_bar_height, sbx_frontend);
|
||||
snrbar = new CSignalNoiseRatioBar(vertical ? sbx_bar_x : CC_APPEND, vertical ? CC_APPEND : 1, sbx_bar_width, sbx_bar_height, sbx_frontend, snr_name);
|
||||
snrbar->doPaintBg(false);
|
||||
addCCItem(snrbar);
|
||||
|
||||
@@ -300,15 +300,10 @@ void CSignalBox::initVarSigBox()
|
||||
void CSignalBox::initSignalItems()
|
||||
{
|
||||
//set current properties for items
|
||||
// int cor_rad = corner_rad/2-fr_thickness;
|
||||
|
||||
// int corr_y = sbx_bar_height%2;
|
||||
// int sb_h = sbx_bar_height - corr_y;
|
||||
|
||||
int sbar_h = sbx_bar_height - fr_thickness - append_y_offset/2;
|
||||
int sbar_w = sbx_bar_width - 2*fr_thickness;
|
||||
int sbar_h = sbx_bar_height - 2*fr_thickness - 2*append_y_offset;
|
||||
int sbar_w = sbx_bar_width - 2*fr_thickness - 2*append_x_offset;
|
||||
int sbar_x = sbx_bar_x + fr_thickness;
|
||||
int scale_h = sbar_h * 76 / 100;
|
||||
int scale_h = sbar_h * 64 / 100;
|
||||
|
||||
int sbar_sw = sbar->getScaleWidth();
|
||||
int snrbar_sw = snrbar->getScaleWidth();
|
||||
@@ -317,12 +312,12 @@ void CSignalBox::initSignalItems()
|
||||
else if (snrbar_sw < sbar_sw)
|
||||
sbar->setScaleWidth(snrbar_sw);
|
||||
|
||||
sbar->setDimensionsAll(sbar_x, fr_thickness, sbar_w, sbar_h);
|
||||
sbar->setDimensionsAll(sbar_x, 1, sbar_w, sbar_h);
|
||||
sbar->setFrontEnd(sbx_frontend);
|
||||
sbar->setCorner(0);
|
||||
sbar->setScaleHeight(scale_h);
|
||||
|
||||
snrbar->setDimensionsAll(vertical ? sbar_x : CC_APPEND, vertical ? CC_APPEND : fr_thickness, sbar_w, sbar_h);
|
||||
snrbar->setDimensionsAll(vertical ? sbar_x : CC_APPEND, vertical ? CC_APPEND : 1, sbar_w, sbar_h);
|
||||
snrbar->setFrontEnd(sbx_frontend);
|
||||
snrbar->setCorner(0);
|
||||
snrbar->setScaleHeight(scale_h);
|
||||
|
@@ -160,8 +160,8 @@ class CSignalNoiseRatioBar : public CSignalBar
|
||||
CSignalNoiseRatioBar(CComponentsForm *parent = NULL)
|
||||
: CSignalBar(parent){};
|
||||
///basic component class constructor for signal noise ratio.
|
||||
CSignalNoiseRatioBar(const int& xpos, const int& ypos, const int& w, const int& h, CFrontend *frontend_ref, CComponentsForm *parent = NULL)
|
||||
: CSignalBar(xpos, ypos, w, h, frontend_ref, "SNR", parent){};
|
||||
CSignalNoiseRatioBar(const int& xpos, const int& ypos, const int& w, const int& h, CFrontend *frontend_ref, const std::string& snr_name = "SNR", CComponentsForm *parent = NULL)
|
||||
: CSignalBar(xpos, ypos, w, h, frontend_ref, snr_name, parent){};
|
||||
};
|
||||
|
||||
/// Class CSignalBox() provides CSignalBar(), CSignalNoiseRatioBar() scales at once.
|
||||
@@ -269,7 +269,7 @@ class CSignalBox : public CComponentsForm
|
||||
|
||||
public:
|
||||
///class constructor for signal noise ratio.
|
||||
CSignalBox(const int& xpos, const int& ypos, const int& w, const int& h, CFrontend *frontend_ref = NULL, const bool vertical = true, CComponentsForm *parent = NULL);
|
||||
CSignalBox(const int& xpos, const int& ypos, const int& w, const int& h, CFrontend *frontend_ref = NULL, const bool vertical = true, CComponentsForm *parent = NULL, const std::string& sig_name = "SIG", const std::string& snr_name = "SNR" );
|
||||
|
||||
///returns the signal object, type = CSignalBar*
|
||||
CSignalBar* getScaleObject(){return sbar;};
|
||||
|
@@ -154,6 +154,7 @@ void CComponentsWindow::initVarWindow( const int& x_pos, const int& y_pos, const
|
||||
ccw_w_sidebar = 40;
|
||||
ccw_col_head = COL_MENUCONTENT_PLUS_0;
|
||||
ccw_col_head_text = COL_MENUHEAD_TEXT;
|
||||
ccw_col_footer = COL_INFOBAR_SHADOW_PLUS_1;
|
||||
|
||||
page_scroll_mode = PG_SCROLL_M_OFF; //permanent disabled here, only in body used!
|
||||
|
||||
@@ -217,6 +218,7 @@ void CComponentsWindow::initFooter()
|
||||
ccw_footer->setWidth(width-2*fr_thickness);
|
||||
ccw_footer->enableShadow(shadow);
|
||||
ccw_footer->setCorner(corner_rad, CORNER_BOTTOM);
|
||||
ccw_footer->setColorBody(ccw_col_footer);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -359,10 +361,11 @@ void CComponentsWindow::enableSidebar(const int& sidbar_type)
|
||||
initCCWItems();
|
||||
}
|
||||
|
||||
void CComponentsWindow::addWindowItem(CComponentsItem* cc_Item)
|
||||
int CComponentsWindow::addWindowItem(CComponentsItem* cc_Item)
|
||||
{
|
||||
if (ccw_body)
|
||||
ccw_body->addCCItem(cc_Item);
|
||||
return ccw_body->addCCItem(cc_Item);
|
||||
return -1;
|
||||
}
|
||||
|
||||
void CComponentsWindow::setCurrentPage(const u_int8_t& current_page)
|
||||
|
@@ -87,6 +87,8 @@ class CComponentsWindow : public CComponentsForm
|
||||
fb_pixel_t ccw_col_head;
|
||||
///header text color
|
||||
fb_pixel_t ccw_col_head_text;
|
||||
///footer bg color
|
||||
fb_pixel_t ccw_col_footer;
|
||||
|
||||
///initialze header object
|
||||
void initHeader();
|
||||
@@ -146,7 +148,7 @@ class CComponentsWindow : public CComponentsForm
|
||||
fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0);
|
||||
|
||||
///add item to body object, also usable is addCCItem() to add items to the windo object
|
||||
void addWindowItem(CComponentsItem* cc_Item);
|
||||
int addWindowItem(CComponentsItem* cc_Item);
|
||||
|
||||
///allow/disallow paint a footer, default true, see also ccw_show_footer, showHeader()
|
||||
void showFooter(bool show = true){ccw_show_footer = show; initCCWItems();};
|
||||
@@ -186,6 +188,9 @@ class CComponentsWindow : public CComponentsForm
|
||||
///returns a pointer to the internal footer object, use this to get access to footer properities
|
||||
CComponentsFooter* getFooterObject(){return ccw_footer;};
|
||||
|
||||
///set background to footer
|
||||
void setWindowFooterColor(const fb_pixel_t& color){ccw_col_footer = color;}
|
||||
|
||||
///returns a pointer to the internal left side bar object, use this to get access to left sidebar properities
|
||||
CComponentsFrmChain* getLeftSidebarObject(){return ccw_left_sidebar;};
|
||||
///returns a pointer to the internal right side bar object, use this to get access to right sidebar properities
|
||||
|
Reference in New Issue
Block a user