Merge branch 'master' into pu/mp

This commit is contained in:
svenhoefer
2017-04-19 21:35:56 +02:00
26 changed files with 217 additions and 460 deletions

View File

@@ -68,7 +68,7 @@ CComponentsForm::CComponentsForm( const int x_pos, const int y_pos, const int w,
page_count = 1;
cur_page = 0;
sb = NULL;
w_sb = 15;
w_sb = SCROLLBAR_WIDTH;
page_scroll_mode = PG_SCROLL_M_UP_DOWN_KEY;
@@ -375,6 +375,7 @@ void CComponentsForm::paintCCItems()
if (cc_parent){
this_x = auto_x = cc_xr;
this_y = auto_y = cc_yr;
w_parent_frame = cc_parent->getFrameThickness();
}
//init and handle scrollbar
@@ -482,7 +483,7 @@ void CComponentsForm::paintCCItems()
//Is it too wide or too high, it will be shortened and displayed in the log.
//This should be avoid!
//checkwidth and adapt if required
int right_frm = (cc_parent ? cc_xr : x) + this_w - 2*fr_thickness;
int right_frm = (cc_parent ? cc_xr : x) + this_w/* - 2*fr_thickness*/;
int right_item = cc_item->getRealXPos() + w_item;
int w_diff = right_item - right_frm;
int new_w = w_item - w_diff;

View File

@@ -59,8 +59,8 @@ CComponentsFrmClock::CComponentsFrmClock( const int& x_pos,
{
cc_item_type = CC_ITEMTYPE_FRM_CLOCK;
x = x_pos;
y = y_pos;
x = cc_xr = x_old = x_pos;
y = cc_yr = y_old = y_pos;
shadow = shadow_mode;
shadow_w = OFFSET_SHADOW;
@@ -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;
@@ -81,15 +84,12 @@ CComponentsFrmClock::CComponentsFrmClock( const int& x_pos,
initClockFont(0, g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]->getHeight());
//init general clock dimensions
height = cl_font->getHeight();
width = cl_font->getRenderWidth(cl_format_str);
height = height_old= cl_font->getHeight();
width = width_old = cl_font->getRenderWidth(cl_format_str);
//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;
@@ -429,9 +429,9 @@ void CComponentsFrmClock::setHeight(const int& h)
int f_height = cl_font->getHeight();
if (h != f_height){
dprintf(DEBUG_DEBUG, "\033[33m[CComponentsFrmClock]\t[%s - %d], font height is different than current height [%d], using [%d] ...\033[0m\n", __func__, __LINE__, h, f_height);
CCDraw::setHeight(f_height);
CComponentsItem::setHeight(f_height);
}else
CCDraw::setHeight(h);
CComponentsItem::setHeight(h);
initCCLockItems();
}
@@ -443,9 +443,9 @@ void CComponentsFrmClock::setWidth(const int& w)
int f_width = cl_font->getRenderWidth(cl_format_str);
if (w != f_width){
dprintf(DEBUG_NORMAL, "\033[33m[CComponentsFrmClock]\t[%s - %d], font width is different than current width [%d], using [%d] ...\033[0m\n", __func__, __LINE__, w, f_width);
CCDraw::setWidth(f_width);
CComponentsItem::setWidth(f_width);
}else
CCDraw::setWidth(w);
CComponentsItem::setWidth(w);
initCCLockItems();
}

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

@@ -413,7 +413,6 @@ void CComponentsHeader::initClock()
//set clock form properties
if (cch_cl_obj){
cch_cl_obj->setYPos(cch_items_y);
cch_cl_obj->setHeight(height);
//disallow paint of clock, if disabled and exit method
@@ -475,7 +474,7 @@ void CComponentsHeader::initCaption()
int clock_w = cch_cl_enable ? cch_cl_obj->getWidth() : 0;
//set x position of clock
cch_cl_obj->setXPos(width - buttons_w - clock_w - cch_offset);
cch_cl_obj->setXPos(width - buttons_w - clock_w);
//set required width of caption object
cc_text_w -= (clock_w + cch_offset);

View File

@@ -34,7 +34,7 @@
#include <zapit/include/zapit/frontend_c.h>
#include <sstream>
#define SB_MIN_HEIGHT 12
#define SB_MIN_HEIGHT OFFSET_INNER_MID
#define REF_PERCENT_TXT "100% "
using namespace std;
@@ -55,8 +55,8 @@ void CSignalBar::initVarSigBar(const int& xpos, const int& ypos, const int& w, c
corner_rad = 0;
corner_type = 0;
append_x_offset = 2;
append_y_offset = 2;
append_x_offset = OFFSET_INNER_MIN;
append_y_offset = OFFSET_INNER_MIN;
sb_scale_height = -1;
dy_font = CNeutrinoFonts::getInstance();
@@ -330,7 +330,7 @@ void CSignalBox::initSignalItems()
sbar->setScaleHeight(scale_h);
sbar->enableTboxSaveScreen(cc_txt_save_screen);
snrbar->setDimensionsAll(vertical ? sbar_x : CC_APPEND, vertical ? CC_APPEND : 1, sbar_w, sbar_h);
snrbar->setDimensionsAll(vertical ? sbar_x : sbar->getXPos() + sbar->getWidth() + append_x_offset, vertical ? sbar->getYPos() + sbar->getHeight() + append_y_offset : 1, sbar_w, sbar_h);
snrbar->setFrontEnd(sbx_frontend);
snrbar->setTextColor(sbx_caption_color);
snrbar->setActiveColor(sbx_active_color);

View File

@@ -201,7 +201,7 @@ void CComponentsWindow::initHeader()
//set header properties //TODO: assigned properties with internal header objekt have no effect!
if (ccw_head){
ccw_head->setWidth(width-2*fr_thickness);
ccw_head->setPos(0, 0);
ccw_head->setPos(fr_thickness, fr_thickness);
ccw_head->setIcon(ccw_icon_name);
ccw_head->setCaption(ccw_caption, ccw_align_mode, ccw_col_head_text);
ccw_head->setContextButton(ccw_buttons);
@@ -219,8 +219,8 @@ void CComponentsWindow::initFooter()
if (ccw_footer){
if (ccw_h_footer)
ccw_footer->setHeight(ccw_h_footer);
ccw_footer->setPos(0, cc_yr + height - ccw_footer->getHeight()- fr_thickness);
ccw_footer->setWidth(width-2*fr_thickness);
ccw_footer->setPos(cc_xr + fr_thickness, cc_yr + height - ccw_footer->getHeight()- fr_thickness);
ccw_footer->setWidth(width/*-2*fr_thickness*/);
ccw_footer->enableShadow(false/*shadow*/);
ccw_footer->setCorner(corner_rad-fr_thickness, CORNER_BOTTOM);
ccw_footer->setButtonFont(ccw_button_font);

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,