mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-08-30 00:41:17 +02:00
Merge branch 'master' into pu/fb-setmode
This commit is contained in:
@@ -49,7 +49,7 @@ CCDraw::CCDraw() : COSDFader(g_settings.theme.menu_Content_alpha)
|
|||||||
|
|
||||||
fr_thickness = fr_thickness_old = 0;
|
fr_thickness = fr_thickness_old = 0;
|
||||||
|
|
||||||
corner_type = corner_type_old = CORNER_ALL;
|
corner_type = corner_type_old = CORNER_NONE;
|
||||||
corner_rad = corner_rad_old = 0;
|
corner_rad = corner_rad_old = 0;
|
||||||
|
|
||||||
shadow = CC_SHADOW_OFF;
|
shadow = CC_SHADOW_OFF;
|
||||||
@@ -497,16 +497,6 @@ void CCDraw::paintFbItems(bool do_save_bg)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
dprintf(DEBUG_DEBUG, "[CCDraw]\n\t[%s - %d] firstPaint->save screen: %d, fbdata_type: %d\n\tx = %d\n\ty = %d\n\tdx = %d\n\tdy = %d\n",
|
|
||||||
__func__,
|
|
||||||
__LINE__,
|
|
||||||
firstPaint,
|
|
||||||
v_fbdata[i].fbdata_type,
|
|
||||||
v_fbdata[i].x,
|
|
||||||
v_fbdata[i].y,
|
|
||||||
v_fbdata[i].dx,
|
|
||||||
v_fbdata[i].dy);
|
|
||||||
|
|
||||||
/* Here we save the background of current box before paint.
|
/* Here we save the background of current box before paint.
|
||||||
* Only the reserved fbdata type CC_FBDATA_TYPE_BGSCREEN is here required and is used for this.
|
* Only the reserved fbdata type CC_FBDATA_TYPE_BGSCREEN is here required and is used for this.
|
||||||
* This pixel buffer is required for the hide() method that will
|
* This pixel buffer is required for the hide() method that will
|
||||||
@@ -524,20 +514,15 @@ void CCDraw::paintFbItems(bool do_save_bg)
|
|||||||
for(size_t i=0; i< v_fbdata.size(); i++){
|
for(size_t i=0; i< v_fbdata.size(); i++){
|
||||||
cc_fbdata_t& fbdata = v_fbdata[i];
|
cc_fbdata_t& fbdata = v_fbdata[i];
|
||||||
|
|
||||||
// Don't paint on dimension or position error dx or dy are 0.
|
|
||||||
if (!CheckFbData(fbdata, __func__, __LINE__)){
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
int fbtype = fbdata.fbdata_type;
|
int fbtype = fbdata.fbdata_type;
|
||||||
|
|
||||||
dprintf(DEBUG_DEBUG, "[CCDraw]\n\t[%s - %d], fbdata_[%d]\n\tx = %d\n\ty = %d\n\tdx = %d\n\tdy = %d\n",
|
//ignore bg screen layer
|
||||||
__func__,
|
if (fbtype == CC_FBDATA_TYPE_BGSCREEN)
|
||||||
__LINE__,
|
continue;
|
||||||
(int)i,
|
|
||||||
fbdata.x,
|
// Don't paint on dimension or position error dx or dy are 0.
|
||||||
fbdata.y,
|
if (!CheckFbData(fbdata, __func__, __LINE__))
|
||||||
fbdata.dx,
|
continue;
|
||||||
fbdata.dy);
|
|
||||||
|
|
||||||
/* Paint all fb relevant basic parts (shadow, frame and body)
|
/* Paint all fb relevant basic parts (shadow, frame and body)
|
||||||
* with all specified properties, paint_bg must be enabled.
|
* with all specified properties, paint_bg must be enabled.
|
||||||
@@ -548,12 +533,14 @@ void CCDraw::paintFbItems(bool do_save_bg)
|
|||||||
frameBuffer->paintBoxFrame(fbdata.x, fbdata.y, fbdata.dx, fbdata.dy, fbdata.frame_thickness, fbdata.color, fbdata.r, fbdata.rtype);
|
frameBuffer->paintBoxFrame(fbdata.x, fbdata.y, fbdata.dx, fbdata.dy, fbdata.frame_thickness, fbdata.color, fbdata.r, fbdata.rtype);
|
||||||
v_fbdata[i].is_painted = true;
|
v_fbdata[i].is_painted = true;
|
||||||
}
|
}
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (paint_bg){
|
if (paint_bg){
|
||||||
if (fbtype == CC_FBDATA_TYPE_BACKGROUND){
|
if (fbtype == CC_FBDATA_TYPE_BACKGROUND){
|
||||||
frameBuffer->paintBackgroundBoxRel(x, y, fbdata.dx, fbdata.dy);
|
frameBuffer->paintBackgroundBoxRel(fbdata.x, fbdata.y, fbdata.dx, fbdata.dy);
|
||||||
v_fbdata[i].is_painted = true;
|
v_fbdata[i].is_painted = true;
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (fbtype == CC_FBDATA_TYPE_SHADOW_BOX && ((!is_painted || !fbdata.is_painted)|| shadow_force || force_paint_bg)) {
|
if (fbtype == CC_FBDATA_TYPE_SHADOW_BOX && ((!is_painted || !fbdata.is_painted)|| shadow_force || force_paint_bg)) {
|
||||||
@@ -575,6 +562,7 @@ void CCDraw::paintFbItems(bool do_save_bg)
|
|||||||
fbdata.pixbuf = getScreen(fbdata.x, fbdata.y, fbdata.dx, fbdata.dy);
|
fbdata.pixbuf = getScreen(fbdata.x, fbdata.y, fbdata.dx, fbdata.dy);
|
||||||
fbdata.is_painted = true;
|
fbdata.is_painted = true;
|
||||||
}
|
}
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (paint_bg){
|
if (paint_bg){
|
||||||
|
@@ -72,8 +72,6 @@ class CComponentsButton : public CComponentsFrmChain, public CCTextScreen
|
|||||||
|
|
||||||
///property: container for all assigned event message values, see driver/rcinput.h for possible values, default value = CRCInput::RC_nokey, see also setButtonDirectKey(), hasButtonDirectKey()
|
///property: container for all assigned event message values, see driver/rcinput.h for possible values, default value = CRCInput::RC_nokey, see also setButtonDirectKey(), hasButtonDirectKey()
|
||||||
std::vector<neutrino_msg_t>cc_directKeys;
|
std::vector<neutrino_msg_t>cc_directKeys;
|
||||||
///property: assigned an alternate event message value, see driver/rcinput.h for possible values, default value = CRCInput::RC_nokey, see also setButtonDirectKeyAlt(), hasButtonDirectKeyAlt()
|
|
||||||
neutrino_msg_t cc_directKeyAlt;
|
|
||||||
///property: assigned return value, see also setButtonResult(), getButtonResult(), default value = -1 (not defined)
|
///property: assigned return value, see also setButtonResult(), getButtonResult(), default value = -1 (not defined)
|
||||||
int cc_btn_result;
|
int cc_btn_result;
|
||||||
///property: assigned alias value, see also setButtonAlias(), getButtonAlias(), default value = -1 (not defined)
|
///property: assigned alias value, see also setButtonAlias(), getButtonAlias(), default value = -1 (not defined)
|
||||||
|
@@ -87,6 +87,9 @@ CComponentsFrmClock::CComponentsFrmClock( const int& x_pos,
|
|||||||
//set default text background behavior
|
//set default text background behavior
|
||||||
cc_txt_save_screen = false;
|
cc_txt_save_screen = false;
|
||||||
|
|
||||||
|
//enable refresh of all segments on each interval as default
|
||||||
|
cl_force_repaint = true;
|
||||||
|
|
||||||
//set default running clock properties
|
//set default running clock properties
|
||||||
cl_interval = interval_seconds;
|
cl_interval = interval_seconds;
|
||||||
cl_timer = NULL;
|
cl_timer = NULL;
|
||||||
@@ -255,7 +258,7 @@ void CComponentsFrmClock::initCCLockItems()
|
|||||||
//set size, text, color of current item
|
//set size, text, color of current item
|
||||||
lbl->setDimensionsAll(x_tmp, y_tmp, w_tmp, h_tmp);
|
lbl->setDimensionsAll(x_tmp, y_tmp, w_tmp, h_tmp);
|
||||||
lbl->setColorAll(col_frame, col_body, col_shadow);
|
lbl->setColorAll(col_frame, col_body, col_shadow);
|
||||||
lbl->forceTextPaint(false);
|
lbl->forceTextPaint(cl_force_repaint);
|
||||||
lbl->setText(stmp, CTextBox::CENTER, cl_font, cl_col_text, cl_font_style);
|
lbl->setText(stmp, CTextBox::CENTER, cl_font, cl_col_text, cl_font_style);
|
||||||
|
|
||||||
//init background behavior of segment
|
//init background behavior of segment
|
||||||
|
@@ -70,6 +70,9 @@ class CComponentsFrmClock : public CComponentsForm, public CCTextScreen
|
|||||||
///text color
|
///text color
|
||||||
int cl_col_text;
|
int cl_col_text;
|
||||||
|
|
||||||
|
///refresh mode
|
||||||
|
bool cl_force_repaint;
|
||||||
|
|
||||||
///current time format
|
///current time format
|
||||||
std::string cl_format;
|
std::string cl_format;
|
||||||
///primary time format
|
///primary time format
|
||||||
@@ -151,7 +154,7 @@ class CComponentsFrmClock : public CComponentsForm, public CCTextScreen
|
|||||||
///returns true, if clock is running
|
///returns true, if clock is running
|
||||||
virtual bool isRun() const {return cl_timer ? true : false;};
|
virtual bool isRun() const {return cl_timer ? true : false;};
|
||||||
///set refresh interval in seconds, default value=1 (=1 sec)
|
///set refresh interval in seconds, default value=1 (=1 sec)
|
||||||
virtual void setClockInterval(const int& seconds){cl_interval = seconds;};
|
virtual void setClockInterval(const int& seconds){cl_interval = seconds;}
|
||||||
|
|
||||||
///show clock on screen
|
///show clock on screen
|
||||||
virtual void paint(bool do_save_bg = CC_SAVE_SCREEN_YES);
|
virtual void paint(bool do_save_bg = CC_SAVE_SCREEN_YES);
|
||||||
@@ -163,6 +166,11 @@ class CComponentsFrmClock : public CComponentsForm, public CCTextScreen
|
|||||||
///reinitialize clock contents
|
///reinitialize clock contents
|
||||||
virtual void refresh() { initCCLockItems(); }
|
virtual void refresh() { initCCLockItems(); }
|
||||||
|
|
||||||
|
///enables force to repaint of all segments on each interval, Note: repaint of all segemts is default enabled.
|
||||||
|
void enableForceSegmentPaint(bool enable = true){cl_force_repaint = enable;}
|
||||||
|
///disables repaint of all segments on each interval, repaint happens only on changed segment value
|
||||||
|
void disableForceSegmentPaint(){enableForceSegmentPaint(false);}
|
||||||
|
|
||||||
/**Member to modify background behavior of embeded segment objects
|
/**Member to modify background behavior of embeded segment objects
|
||||||
* @param[in] mode
|
* @param[in] mode
|
||||||
* @li bool, default = true
|
* @li bool, default = true
|
||||||
|
@@ -63,11 +63,11 @@ void CComponentsFooter::initVarFooter( const int& x_pos, const int& y_pos, const
|
|||||||
{
|
{
|
||||||
cc_item_type = CC_ITEMTYPE_FOOTER;
|
cc_item_type = CC_ITEMTYPE_FOOTER;
|
||||||
|
|
||||||
x = x_pos;
|
x = x_old = x_pos;
|
||||||
y = y_pos;
|
y = y_old = y_pos;
|
||||||
|
|
||||||
//init footer width
|
//init footer width
|
||||||
width = w == 0 ? frameBuffer->getScreenWidth(true) : w;
|
width = width_old = w == 0 ? frameBuffer->getScreenWidth(true) : w;
|
||||||
|
|
||||||
//init default fonts
|
//init default fonts
|
||||||
initDefaultFonts();
|
initDefaultFonts();
|
||||||
@@ -77,15 +77,15 @@ void CComponentsFooter::initVarFooter( const int& x_pos, const int& y_pos, const
|
|||||||
|
|
||||||
//init footer height
|
//init footer height
|
||||||
initCaptionFont();
|
initCaptionFont();
|
||||||
height = max(h, cch_font->getHeight());
|
height = height_old = max(h, cch_font->getHeight());
|
||||||
|
|
||||||
shadow = shadow_mode;
|
shadow = shadow_mode;
|
||||||
ccf_enable_button_shadow = false ;
|
ccf_enable_button_shadow = false ;
|
||||||
ccf_button_shadow_width = shadow ? OFFSET_SHADOW/2 : 0;
|
ccf_button_shadow_width = shadow ? OFFSET_SHADOW/2 : 0;
|
||||||
ccf_button_shadow_force_paint = false;
|
ccf_button_shadow_force_paint = false;
|
||||||
col_frame = color_frame;
|
col_frame = col_frame_old = color_frame;
|
||||||
col_body = color_body;
|
col_body = col_body_old = color_body;
|
||||||
col_shadow = color_shadow;
|
col_shadow = col_shadow_old = color_shadow;
|
||||||
cc_body_gradient_enable = cc_body_gradient_enable_old = CC_COLGRAD_OFF/*g_settings.theme.menu_ButtonBar_gradient*/; //TODO: not complete implemented at the moment
|
cc_body_gradient_enable = cc_body_gradient_enable_old = CC_COLGRAD_OFF/*g_settings.theme.menu_ButtonBar_gradient*/; //TODO: not complete implemented at the moment
|
||||||
cc_body_gradient_direction = CFrameBuffer::gradientVertical;
|
cc_body_gradient_direction = CFrameBuffer::gradientVertical;
|
||||||
cc_body_gradient_mode = CColorGradient::gradientDark2Light;
|
cc_body_gradient_mode = CColorGradient::gradientDark2Light;
|
||||||
@@ -100,6 +100,9 @@ void CComponentsFooter::initVarFooter( const int& x_pos, const int& y_pos, const
|
|||||||
addContextButton(buttons);
|
addContextButton(buttons);
|
||||||
initCCItems();
|
initCCItems();
|
||||||
initParent(parent);
|
initParent(parent);
|
||||||
|
|
||||||
|
//init repaint slot before re paint of body, if paint() is already done
|
||||||
|
initRepaintSlot();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CComponentsFooter::setButtonLabels(const struct button_label_cc * const content, const size_t& label_count, const int& chain_width, const int& label_width)
|
void CComponentsFooter::setButtonLabels(const struct button_label_cc * const content, const size_t& label_count, const int& chain_width, const int& label_width)
|
||||||
|
@@ -136,13 +136,17 @@ void CComponentsHeader::initVarHeader( const int& x_pos, const int& y_pos, const
|
|||||||
cch_cl_sec_format = cch_cl_format;
|
cch_cl_sec_format = cch_cl_format;
|
||||||
cch_cl_enable_run = false;
|
cch_cl_enable_run = false;
|
||||||
|
|
||||||
//init slot before re paint of header, paint() is already done
|
|
||||||
sl_form_repaint = sigc::bind(sigc::mem_fun(*this, &CComponentsHeader::kill), col_body, -1, CC_FBDATA_TYPES, false);
|
|
||||||
OnBeforeRePaint.connect(sl_form_repaint);
|
|
||||||
|
|
||||||
addContextButton(buttons);
|
addContextButton(buttons);
|
||||||
initCCItems();
|
initCCItems();
|
||||||
initParent(parent);
|
initParent(parent);
|
||||||
|
|
||||||
|
//init repaint slot before re paint of body, if paint() is already done
|
||||||
|
initRepaintSlot();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CComponentsHeader::initRepaintSlot(){
|
||||||
|
sl_form_repaint = sigc::bind(sigc::mem_fun(*this, &CComponentsHeader::kill), cc_parent ? col_body : 0, -1, CC_FBDATA_TYPES, false);
|
||||||
|
OnBeforeRePaint.connect(sl_form_repaint);
|
||||||
}
|
}
|
||||||
|
|
||||||
CComponentsHeader::~CComponentsHeader()
|
CComponentsHeader::~CComponentsHeader()
|
||||||
|
@@ -112,6 +112,8 @@ class CComponentsHeader : public CComponentsForm, public CCTextScreen
|
|||||||
void initButtons();
|
void initButtons();
|
||||||
///sub: init clock object
|
///sub: init clock object
|
||||||
void initClock();
|
void initClock();
|
||||||
|
///int repaint slot
|
||||||
|
void initRepaintSlot();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
enum
|
enum
|
||||||
|
@@ -89,11 +89,16 @@ void CComponentsItem::paintInit(bool do_save_bg)
|
|||||||
//set current needed corner main box radius
|
//set current needed corner main box radius
|
||||||
int box_rad = corner_type ? corner_rad : 0;
|
int box_rad = corner_type ? corner_rad : 0;
|
||||||
|
|
||||||
//and ensure max main box radius < dimensions
|
//and ensure max main box radius < dimensions, avoids possible fb artefacts on screen
|
||||||
if (2*box_rad > dy)
|
int box_rad2 = box_rad/2;
|
||||||
box_rad -= max(0, 2*box_rad-dy);
|
if(box_rad2 > dy || box_rad2 > dx){
|
||||||
if (2*box_rad > dx)
|
int tmp_rad = box_rad;
|
||||||
box_rad -= max(0, 2*box_rad-dy);
|
if (box_rad2 > dx)
|
||||||
|
tmp_rad = (box_rad2-dx)*2;
|
||||||
|
if (box_rad2 > dy)
|
||||||
|
tmp_rad = (box_rad2-dy)*2;
|
||||||
|
box_rad = tmp_rad;
|
||||||
|
}
|
||||||
|
|
||||||
//Workaround: ensure radius values >= 0, framebuffer methode paintBoxRel() gets confused
|
//Workaround: ensure radius values >= 0, framebuffer methode paintBoxRel() gets confused
|
||||||
box_rad = max(box_rad, 0);
|
box_rad = max(box_rad, 0);
|
||||||
@@ -113,13 +118,12 @@ void CComponentsItem::paintInit(bool do_save_bg)
|
|||||||
int sh_cdy = box_rad+sw+th; //height
|
int sh_cdy = box_rad+sw+th; //height
|
||||||
|
|
||||||
//adapt shadow corner dimensions if body dimensions are too small, use an offset if required
|
//adapt shadow corner dimensions if body dimensions are too small, use an offset if required
|
||||||
int /*sh_cdx_size_offset,*/ sh_cdy_size_offset = 0;
|
int /*sh_cdx_size_offset = 0,*/ sh_cdy_size_offset = 0;
|
||||||
if (sh_cdy*2 > dy)
|
if (sh_cdy*2 > dy)
|
||||||
sh_cdy_size_offset = sh_cdy*2-dy;
|
sh_cdy_size_offset = sh_cdy*2-dy;
|
||||||
#if 0
|
// if (sh_cdx*2 > dx)
|
||||||
if (sh_cdx*2 > dx)
|
// sh_cdx_size_offset = sh_cdx*2-dx;
|
||||||
sh_cdx_size_offset = sh_cdx*2-dx;
|
|
||||||
#endif
|
|
||||||
//handle shadow positions
|
//handle shadow positions
|
||||||
//...corner bottom right
|
//...corner bottom right
|
||||||
int sh_cbr_x = ix+dx-sh_cdx+sw;
|
int sh_cbr_x = ix+dx-sh_cdx+sw;
|
||||||
|
@@ -74,6 +74,9 @@ CComponentsShapeCircle::CComponentsShapeCircle( int x_pos, int y_pos, int diam,
|
|||||||
//CComponents
|
//CComponents
|
||||||
x = x_pos;
|
x = x_pos;
|
||||||
y = y_pos;
|
y = y_pos;
|
||||||
|
|
||||||
|
corner_type = corner_type_old = CORNER_ALL;
|
||||||
|
|
||||||
//width = height = d = diam;
|
//width = height = d = diam;
|
||||||
shadow = shadow_mode;
|
shadow = shadow_mode;
|
||||||
shadow_w = OFFSET_SHADOW;
|
shadow_w = OFFSET_SHADOW;
|
||||||
|
Reference in New Issue
Block a user