Merge branch 'master' into pu/fb-setmode

This commit is contained in:
M. Liebmann
2017-04-16 19:42:14 +02:00
16 changed files with 153 additions and 95 deletions

View File

@@ -74,6 +74,9 @@ CComponentsFrmClock::CComponentsFrmClock( const int& x_pos,
setClockFormat(prformat_str, secformat_str);
cl_col_text = COL_MENUCONTENT_TEXT;
//enable refresh of all segments on each interval as default
cl_force_repaint = true;
//init default font
cl_font = font;
cl_font_style = font_style;
@@ -87,9 +90,6 @@ CComponentsFrmClock::CComponentsFrmClock( const int& x_pos,
//set default text background behavior
cc_txt_save_screen = false;
//enable refresh of all segments on each interval as default
cl_force_repaint = true;
//set default running clock properties
cl_interval = interval_seconds;
cl_timer = NULL;

View File

@@ -111,6 +111,9 @@ void CComponentsFooter::setButtonLabels(const struct button_label_cc * const con
if (chain)
chain->clear();
if (label_count == 0)
return;
/* set general available full basic space for button chain,
* in this case this is footer width
*/
@@ -372,7 +375,6 @@ void CComponentsFooter::paintButtons(const int& x_pos,
this->setButtonFont(font);
this->setContextButton(context_buttons);
this->setButtonLabels(content, label_count, 0, label_width);
this->paint(do_save_bg);
}

View File

@@ -261,6 +261,20 @@ bool CComponentsItem::isAdded()
return false;
}
void CComponentsItem::setXPos(const int& xpos)
{
CCDraw::setXPos(xpos);
if (cc_parent)
cc_xr = cc_parent->getXPos() + x;
}
void CComponentsItem::setYPos(const int& ypos)
{
CCDraw::setYPos(ypos);
if (cc_parent)
cc_yr = cc_parent->getYPos() + y;
}
void CComponentsItem::setXPosP(const uint8_t& xpos_percent)
{
int x_tmp = cc_parent ? xpos_percent*cc_parent->getWidth() : xpos_percent*frameBuffer->getScreenWidth();

View File

@@ -134,6 +134,11 @@ class CComponentsItem : public CComponents
///returns current number of page location of current item, see: cc_page_number
virtual u_int8_t getPageNumber(){return cc_page_number;};
///set screen x-position, parameter as int
virtual void setXPos(const int& xpos);
///set screen y-position, parameter as int
virtual void setYPos(const int& ypos);
///set screen x-position, parameter as uint8_t, percent x value related to current width of parent form or screen
virtual void setXPosP(const uint8_t& xpos_percent);
///set screen y-position, parameter as uint8_t, percent y value related to current height of parent form or screen

View File

@@ -74,8 +74,8 @@ void CComponentsPicture::init( const int &x_pos, const int &y_pos, const int &w,
//CComponents
x = x_old = x_pos;
y = y_old = y_pos;
width = dx = dxc = w;
height = dy = dyc = h;
width = width_old = dx = dxc = w;
height = height_old = dy = dyc = h;
pic_name = pic_name_old = image_name;
shadow = shadow_mode;
shadow_w = OFFSET_SHADOW;
@@ -148,6 +148,24 @@ void CComponentsPicture::setHeight(const int& h, bool keep_aspect)
initCCItem();
}
void CComponentsPicture::setXPos(const int& xpos)
{
CComponentsItem::setXPos(xpos);
if (xpos == x)
return;
need_init = true;
initCCItem();
}
void CComponentsPicture::setYPos(const int& ypos)
{
CComponentsItem::setYPos(ypos);
if (ypos == y)
return;
need_init = true;
initCCItem();
}
void CComponentsPicture::initCCItem()
{
if (pic_name.empty() || !need_init){
@@ -385,6 +403,7 @@ CComponentsChannelLogo::CComponentsChannelLogo( const int &x_pos, const int &y_p
void CComponentsChannelLogo::init(const uint64_t& channelId, const std::string& channelName, bool allow_scale)
{
cc_item_type = CC_ITEMTYPE_CHANNEL_LOGO;
channel_name = "";
channel_id = 0;
alt_pic_name = "";
@@ -415,6 +434,8 @@ void CComponentsChannelLogo::setAltLogo(const char* picture_name)
void CComponentsChannelLogo::setChannel(const uint64_t& channelId, const std::string& channelName)
{
need_init = true;
string image = pic_name;
if (channelId || !channelName.empty()){
if ((channel_id == channelId) && (channel_name == channelName))
need_init = false;
@@ -425,16 +446,16 @@ void CComponentsChannelLogo::setChannel(const uint64_t& channelId, const std::st
int dummy;
has_logo = g_PicViewer->GetLogoName(channel_id, channel_name, pic_name, &dummy, &dummy);
has_logo = g_PicViewer->GetLogoName(channel_id, channel_name, image, &dummy, &dummy);
if (!has_logo)//no logo was found, use altrenate icon or logo
pic_name = alt_pic_name;
image = alt_pic_name;
//if logo or alternate image still not available, set has logo to false
has_logo = !pic_name.empty();
has_logo = !image.empty();
//refresh object
initCCItem();
setPicture(image);
//set has_logo to false if no dimensions were detected
if (width && height)

View File

@@ -162,6 +162,11 @@ class CComponentsPicture : public CComponentsItem
///set height of object and image related to current screen size, see also CComponentsItem::setHeightP(), parameter as uint8_t
virtual void setHeightP(const uint8_t& h_percent){CComponentsItem::setHeightP(h_percent), do_scale = true; need_init = hasChanges(); initCCItem();}
///set screen x-position, parameter as int
virtual void setXPos(const int& xpos);
///set screen y-position, parameter as int
virtual void setYPos(const int& ypos);
///return paint mode of internal image, true=image was painted, please do not to confuse with isPainted()! isPainted() is related to item itself.
virtual inline bool isPicPainted(){return is_image_painted;};

View File

@@ -64,7 +64,7 @@ void CComponentsTimer::runSharedTimerAction()
tm_mutex.lock();
OnTimer();
if (!tm_enable_nano)
mySleep(tm_interval);
sleep(tm_interval);
else
usleep((useconds_t)tm_interval);
tm_mutex.unlock();

View File

@@ -41,6 +41,7 @@ typedef enum
CC_ITEMTYPE_GENERIC,
CC_ITEMTYPE_ITEM,
CC_ITEMTYPE_PICTURE,
CC_ITEMTYPE_CHANNEL_LOGO,
CC_ITEMTYPE_TEXT,
CC_ITEMTYPE_TEXT_INFOBOX,
CC_ITEMTYPE_SHAPE_SQUARE,