mirror of
https://github.com/tuxbox-fork-migrations/recycled-ni-neutrino.git
synced 2025-08-28 07:51:11 +02:00
CComponents: add property to allow/disallow paint of items
This causes initialization of all properties, but
affects the behavior of item paint.
This can be understood as a counterpart to isPainted().
Origin commit data
------------------
Branch: ni/coolstream
Commit: 8ae491a994
Author: Thilo Graf <dbt@novatux.de>
Date: 2013-11-08 (Fri, 08 Nov 2013)
------------------
This commit was generated by Migit
This commit is contained in:
@@ -77,6 +77,7 @@ void CComponents::initVarBasic()
|
||||
firstPaint = true;
|
||||
is_painted = false;
|
||||
paint_bg = true;
|
||||
cc_allow_paint = true;
|
||||
frameBuffer = CFrameBuffer::getInstance();
|
||||
v_fbdata.clear();
|
||||
saved_screen.pixbuf = NULL;
|
||||
@@ -130,7 +131,7 @@ void CComponents::paintFbItems(bool do_save_bg)
|
||||
//paint all fb relevant basic parts (frame and body) with all specified properties, paint_bg must be true
|
||||
if (fbtype != CC_FBDATA_TYPE_BGSCREEN && paint_bg){
|
||||
if (fbtype == CC_FBDATA_TYPE_FRAME) {
|
||||
if (v_fbdata[i].frame_thickness > 0)
|
||||
if (v_fbdata[i].frame_thickness > 0 && cc_allow_paint)
|
||||
frameBuffer->paintBoxFrame(v_fbdata[i].x, v_fbdata[i].y, v_fbdata[i].dx, v_fbdata[i].dy, v_fbdata[i].frame_thickness, v_fbdata[i].color, v_fbdata[i].r, corner_type);
|
||||
}
|
||||
else if (fbtype == CC_FBDATA_TYPE_BACKGROUND)
|
||||
@@ -148,14 +149,17 @@ void CComponents::paintFbItems(bool do_save_bg)
|
||||
//calculate current shadow width depends of current corner_rad
|
||||
sw_cur = max(2*v_fbdata[i].r, sw);
|
||||
}
|
||||
// shadow right
|
||||
frameBuffer->paintBoxRel(x_sh, v_fbdata[i].y, sw_cur, v_fbdata[i].dy-sw_cur, v_fbdata[i].color, v_fbdata[i].r, corner_type & CORNER_TOP_RIGHT);
|
||||
// shadow bottom
|
||||
frameBuffer->paintBoxRel(v_fbdata[i].x, y_sh, v_fbdata[i].dx, sw_cur, v_fbdata[i].color, v_fbdata[i].r, corner_type & CORNER_BOTTOM);
|
||||
if (cc_allow_paint){
|
||||
// shadow right
|
||||
frameBuffer->paintBoxRel(x_sh, v_fbdata[i].y, sw_cur, v_fbdata[i].dy-sw_cur, v_fbdata[i].color, v_fbdata[i].r, corner_type & CORNER_TOP_RIGHT);
|
||||
// shadow bottom
|
||||
frameBuffer->paintBoxRel(v_fbdata[i].x, y_sh, v_fbdata[i].dx, sw_cur, v_fbdata[i].color, v_fbdata[i].r, corner_type & CORNER_BOTTOM);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
frameBuffer->paintBoxRel(v_fbdata[i].x, v_fbdata[i].y, v_fbdata[i].dx, v_fbdata[i].dy, v_fbdata[i].color, v_fbdata[i].r, corner_type);
|
||||
if(cc_allow_paint)
|
||||
frameBuffer->paintBoxRel(v_fbdata[i].x, v_fbdata[i].y, v_fbdata[i].dx, v_fbdata[i].dy, v_fbdata[i].color, v_fbdata[i].r, corner_type);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -94,6 +94,8 @@ class CComponents
|
||||
bool is_painted;
|
||||
///mode: true=activate rendering of basic elements (frame, shadow and body)
|
||||
bool paint_bg;
|
||||
///mode: true=allows painting of item, see also allowPaint()
|
||||
bool cc_allow_paint;
|
||||
|
||||
///initialize of basic attributes, no parameters required
|
||||
void initVarBasic();
|
||||
@@ -205,6 +207,11 @@ class CComponents
|
||||
///allows paint of elementary item parts (shadow, frame and body), similar as background, set it usually to false, if item used in a form
|
||||
virtual void doPaintBg(bool do_paint){paint_bg = do_paint;};
|
||||
|
||||
///allow/disalows paint of item and its contents, but initialize of other properties are not touched
|
||||
///this can be understood as a counterpart to isPainted(), but before paint
|
||||
virtual void allowPaint(bool allow){cc_allow_paint = allow;};
|
||||
///returns visibility mode
|
||||
virtual bool paintAllowed(){return cc_allow_paint;};
|
||||
};
|
||||
|
||||
class CComponentsItem : public CComponents
|
||||
|
@@ -361,8 +361,17 @@ void CComponentsForm::paintCCItems()
|
||||
cc_item->setHeight(new_h);
|
||||
}
|
||||
|
||||
//get current visibility mode from item, me must hold it and restore after paint
|
||||
bool item_visible = cc_item->paintAllowed();
|
||||
//set visibility mode
|
||||
if (!this->cc_allow_paint)
|
||||
cc_item->allowPaint(false);
|
||||
|
||||
//finally paint current item
|
||||
cc_item->paint(CC_SAVE_SCREEN_NO);
|
||||
|
||||
//restore defined old visibility mode of item after paint
|
||||
cc_item->allowPaint(item_visible);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -97,16 +97,19 @@ void CComponentsInfoBox::paintPicture()
|
||||
//exit if no image definied
|
||||
if (pic_name == "")
|
||||
return;
|
||||
|
||||
|
||||
//init pic object and set icon paint position
|
||||
pic = new CComponentsPicture(x+fr_thickness+x_offset, y+fr_thickness, 0, 0, "");
|
||||
|
||||
//define icon
|
||||
pic->setPicture(pic_name);
|
||||
|
||||
|
||||
//fit icon into infobox
|
||||
pic->setHeight(height-2*fr_thickness);
|
||||
pic->setColorBody(col_body);
|
||||
|
||||
//paint, but set visibility mode
|
||||
pic->allowPaint(cc_allow_paint);
|
||||
pic->paint(CC_SAVE_SCREEN_NO);
|
||||
}
|
||||
|
||||
@@ -119,7 +122,7 @@ void CComponentsInfoBox::paint(bool do_save_bg)
|
||||
//NOTE: real values are reqiured, if we paint this item within a form as embedded cc-item
|
||||
int x_text = (cc_parent ? cc_xr : x) + fr_thickness;
|
||||
int y_text = (cc_parent ? cc_yr : y) + fr_thickness;
|
||||
|
||||
|
||||
//set text to the left border if picture is not painted
|
||||
int pic_w = 0;
|
||||
if ((pic) && (pic->isPicPainted()))
|
||||
@@ -141,7 +144,9 @@ void CComponentsInfoBox::paint(bool do_save_bg)
|
||||
int tw = width - x_offset - pic_w - 2*fr_thickness;
|
||||
int th = height-2*fr_thickness;
|
||||
cctext->setDimensionsAll(tx, y_text, tw, th);
|
||||
|
||||
cctext->paint(CC_SAVE_SCREEN_NO);
|
||||
|
||||
//paint, but set visibility mode
|
||||
cctext->allowPaint(cc_allow_paint);
|
||||
cctext->paint(CC_SAVE_SCREEN_NO);
|
||||
}
|
||||
}
|
||||
|
@@ -180,7 +180,7 @@ void CComponentsPicture::paintPicture()
|
||||
{
|
||||
pic_painted = false;
|
||||
|
||||
if (do_paint){
|
||||
if (do_paint && cc_allow_paint){
|
||||
#ifdef DEBUG_CC
|
||||
printf(" [CComponentsPicture] %s: paint image: %s (do_paint=%d)\n", __FUNCTION__, pic_name.c_str(), do_paint);
|
||||
#endif
|
||||
|
@@ -141,6 +141,7 @@ void CProgressBar::paintShapes(int &shx, int ­, int &shw, int &shh, fb_pixel_
|
||||
{
|
||||
CComponentsShapeSquare shape(shx, shy, shw, shh, false);
|
||||
shape.setColorBody(col);
|
||||
shape.allowPaint(cc_allow_paint);
|
||||
shape.paint(false);
|
||||
}
|
||||
|
||||
|
@@ -92,7 +92,7 @@ class CProgressBar : public CComponentsItem
|
||||
///paint version of progressbar with color and advanced display modifications
|
||||
void paintAdvanced();
|
||||
///painting of activ/passive bars via shape object
|
||||
static void paintShapes(int &shx, int ­, int &shw, int &shh, fb_pixel_t &col);
|
||||
void paintShapes(int &shx, int ­, int &shw, int &shh, fb_pixel_t &col);
|
||||
|
||||
void initDimensions();
|
||||
|
||||
|
@@ -248,7 +248,7 @@ void CComponentsText::paintText(bool do_save_bg)
|
||||
{
|
||||
paintInit(do_save_bg);
|
||||
initCCText();
|
||||
if (ct_text_sent)
|
||||
if (ct_text_sent && cc_allow_paint)
|
||||
ct_textbox->paint();
|
||||
ct_text_sent = false;
|
||||
}
|
||||
|
@@ -87,6 +87,9 @@ void CComponentsPIP::paint(bool do_save_bg)
|
||||
pig_w -= pig_w*25/100;
|
||||
pig_x += tmpw/2-pig_w/2;
|
||||
}
|
||||
|
||||
if (!cc_allow_paint)
|
||||
return;
|
||||
|
||||
if(CNeutrinoApp::getInstance()->getMode() == NeutrinoMessages::mode_tv){
|
||||
videoDecoder->Pig(pig_x, pig_y, pig_w, pig_h, screen_w, screen_h);
|
||||
@@ -95,7 +98,6 @@ void CComponentsPIP::paint(bool do_save_bg)
|
||||
CComponentsPicture pic = CComponentsPicture (pig_x, pig_y, pig_w, pig_h, pic_name, CC_ALIGN_HOR_CENTER | CC_ALIGN_VER_CENTER);
|
||||
pic.paint(CC_SAVE_SCREEN_NO);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user