mirror of
https://github.com/tuxbox-fork-migrations/recycled-ni-neutrino.git
synced 2025-08-28 16:01:10 +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;
|
firstPaint = true;
|
||||||
is_painted = false;
|
is_painted = false;
|
||||||
paint_bg = true;
|
paint_bg = true;
|
||||||
|
cc_allow_paint = true;
|
||||||
frameBuffer = CFrameBuffer::getInstance();
|
frameBuffer = CFrameBuffer::getInstance();
|
||||||
v_fbdata.clear();
|
v_fbdata.clear();
|
||||||
saved_screen.pixbuf = NULL;
|
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
|
//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_BGSCREEN && paint_bg){
|
||||||
if (fbtype == CC_FBDATA_TYPE_FRAME) {
|
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);
|
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)
|
else if (fbtype == CC_FBDATA_TYPE_BACKGROUND)
|
||||||
@@ -148,13 +149,16 @@ void CComponents::paintFbItems(bool do_save_bg)
|
|||||||
//calculate current shadow width depends of current corner_rad
|
//calculate current shadow width depends of current corner_rad
|
||||||
sw_cur = max(2*v_fbdata[i].r, sw);
|
sw_cur = max(2*v_fbdata[i].r, sw);
|
||||||
}
|
}
|
||||||
|
if (cc_allow_paint){
|
||||||
// shadow right
|
// 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);
|
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
|
// 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);
|
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
|
else
|
||||||
|
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);
|
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;
|
bool is_painted;
|
||||||
///mode: true=activate rendering of basic elements (frame, shadow and body)
|
///mode: true=activate rendering of basic elements (frame, shadow and body)
|
||||||
bool paint_bg;
|
bool paint_bg;
|
||||||
|
///mode: true=allows painting of item, see also allowPaint()
|
||||||
|
bool cc_allow_paint;
|
||||||
|
|
||||||
///initialize of basic attributes, no parameters required
|
///initialize of basic attributes, no parameters required
|
||||||
void initVarBasic();
|
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
|
///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;};
|
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
|
class CComponentsItem : public CComponents
|
||||||
|
@@ -361,8 +361,17 @@ void CComponentsForm::paintCCItems()
|
|||||||
cc_item->setHeight(new_h);
|
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
|
//finally paint current item
|
||||||
cc_item->paint(CC_SAVE_SCREEN_NO);
|
cc_item->paint(CC_SAVE_SCREEN_NO);
|
||||||
|
|
||||||
|
//restore defined old visibility mode of item after paint
|
||||||
|
cc_item->allowPaint(item_visible);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -107,6 +107,9 @@ void CComponentsInfoBox::paintPicture()
|
|||||||
//fit icon into infobox
|
//fit icon into infobox
|
||||||
pic->setHeight(height-2*fr_thickness);
|
pic->setHeight(height-2*fr_thickness);
|
||||||
pic->setColorBody(col_body);
|
pic->setColorBody(col_body);
|
||||||
|
|
||||||
|
//paint, but set visibility mode
|
||||||
|
pic->allowPaint(cc_allow_paint);
|
||||||
pic->paint(CC_SAVE_SCREEN_NO);
|
pic->paint(CC_SAVE_SCREEN_NO);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -142,6 +145,8 @@ void CComponentsInfoBox::paint(bool do_save_bg)
|
|||||||
int th = height-2*fr_thickness;
|
int th = height-2*fr_thickness;
|
||||||
cctext->setDimensionsAll(tx, y_text, tw, th);
|
cctext->setDimensionsAll(tx, y_text, tw, th);
|
||||||
|
|
||||||
|
//paint, but set visibility mode
|
||||||
|
cctext->allowPaint(cc_allow_paint);
|
||||||
cctext->paint(CC_SAVE_SCREEN_NO);
|
cctext->paint(CC_SAVE_SCREEN_NO);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -180,7 +180,7 @@ void CComponentsPicture::paintPicture()
|
|||||||
{
|
{
|
||||||
pic_painted = false;
|
pic_painted = false;
|
||||||
|
|
||||||
if (do_paint){
|
if (do_paint && cc_allow_paint){
|
||||||
#ifdef DEBUG_CC
|
#ifdef DEBUG_CC
|
||||||
printf(" [CComponentsPicture] %s: paint image: %s (do_paint=%d)\n", __FUNCTION__, pic_name.c_str(), do_paint);
|
printf(" [CComponentsPicture] %s: paint image: %s (do_paint=%d)\n", __FUNCTION__, pic_name.c_str(), do_paint);
|
||||||
#endif
|
#endif
|
||||||
|
@@ -141,6 +141,7 @@ void CProgressBar::paintShapes(int &shx, int ­, int &shw, int &shh, fb_pixel_
|
|||||||
{
|
{
|
||||||
CComponentsShapeSquare shape(shx, shy, shw, shh, false);
|
CComponentsShapeSquare shape(shx, shy, shw, shh, false);
|
||||||
shape.setColorBody(col);
|
shape.setColorBody(col);
|
||||||
|
shape.allowPaint(cc_allow_paint);
|
||||||
shape.paint(false);
|
shape.paint(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -92,7 +92,7 @@ class CProgressBar : public CComponentsItem
|
|||||||
///paint version of progressbar with color and advanced display modifications
|
///paint version of progressbar with color and advanced display modifications
|
||||||
void paintAdvanced();
|
void paintAdvanced();
|
||||||
///painting of activ/passive bars via shape object
|
///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();
|
void initDimensions();
|
||||||
|
|
||||||
|
@@ -248,7 +248,7 @@ void CComponentsText::paintText(bool do_save_bg)
|
|||||||
{
|
{
|
||||||
paintInit(do_save_bg);
|
paintInit(do_save_bg);
|
||||||
initCCText();
|
initCCText();
|
||||||
if (ct_text_sent)
|
if (ct_text_sent && cc_allow_paint)
|
||||||
ct_textbox->paint();
|
ct_textbox->paint();
|
||||||
ct_text_sent = false;
|
ct_text_sent = false;
|
||||||
}
|
}
|
||||||
|
@@ -88,6 +88,9 @@ void CComponentsPIP::paint(bool do_save_bg)
|
|||||||
pig_x += tmpw/2-pig_w/2;
|
pig_x += tmpw/2-pig_w/2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!cc_allow_paint)
|
||||||
|
return;
|
||||||
|
|
||||||
if(CNeutrinoApp::getInstance()->getMode() == NeutrinoMessages::mode_tv){
|
if(CNeutrinoApp::getInstance()->getMode() == NeutrinoMessages::mode_tv){
|
||||||
videoDecoder->Pig(pig_x, pig_y, pig_w, pig_h, screen_w, screen_h);
|
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);
|
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);
|
pic.paint(CC_SAVE_SCREEN_NO);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user