Merge branch 'pu/mp' of https://github.com/tuxbox-neutrino/gui-neutrino into ni/mp/tuxbox

Conflicts:
	src/gui/components/cc_frm_footer.cpp
	src/neutrino.cpp


Origin commit data
------------------
Commit: fd25630d53
Author: vanhofen <vanhofen@gmx.de>
Date: 2017-08-30 (Wed, 30 Aug 2017)
This commit is contained in:
vanhofen
2017-08-30 18:11:59 +02:00
22 changed files with 236 additions and 179 deletions

View File

@@ -342,7 +342,7 @@ class CCDraw : public COSDFader, public CComponentsSignals
*
* @return bool returns true if effect was successful canceled
*
* @param[in] keep_on_screen optional, exepts bool, default = false. means: item is not repainted after canceled effect
* @param[in] keep_on_screen optional, expects bool, default = false. means: item is not repainted after canceled effect
*
* @see take a look into test menu class for examples
* NOTE: Effect must be started with paintBlink()

View File

@@ -378,7 +378,7 @@ void CComponentsForm::paintCCItems()
size_t items_count = v_cc_items.size();
//using of real x/y values to paint items if this text object is bound in a parent form
int this_x = x, auto_x = x, this_y = y, auto_y = y, this_w = width;
int this_x = x, auto_x = x, this_y = y, auto_y = y, this_w = 0;
int w_parent_frame = 0;
if (cc_parent){
this_x = auto_x = cc_xr;
@@ -441,7 +441,7 @@ void CComponentsForm::paintCCItems()
}
//move item x-position, if we have a frame on parent, TODO: other constellations not considered at the moment
w_parent_frame = xpos <= fr_thickness ? fr_thickness : 0;
w_parent_frame = xpos <= fr_thickness ? fr_thickness : w_parent_frame;
//set required x-position to item:
//append vertical
@@ -461,7 +461,7 @@ void CComponentsForm::paintCCItems()
}
//move item y-position, if we have a frame on parent, TODO: other constellations not considered at the moment
w_parent_frame = ypos <= fr_thickness ? fr_thickness : 0;
w_parent_frame = ypos <= fr_thickness ? fr_thickness : w_parent_frame;
//set required y-position to item
//append hor

View File

@@ -147,14 +147,15 @@ void CComponentsButton::initIcon()
if (pos == string::npos)
cc_btn_icon = frameBuffer->getIconPath(cc_btn_icon);
int y_icon = 0;
int h_icon = 0;
if (cc_btn_icon_obj == NULL){
cc_btn_icon_obj = new CComponentsPictureScalable(fr_thickness, 0, cc_btn_icon, this);
cc_btn_icon_obj->SetTransparent(CFrameBuffer::TM_BLACK);
cc_btn_icon_obj->doPaintBg(false);
}
int y_icon = cc_btn_icon_obj->getYPos();
int h_icon = cc_btn_icon_obj->getHeight();
h_icon = cc_btn_icon_obj->getHeight();
//get required icon height
int h_max = height-2*fr_thickness;

View File

@@ -211,7 +211,7 @@ class CComponentsButton : public CComponentsFrmChain, public CCTextScreen
* Returns true if filtered event msg value of button object is found in cc_directKeys container.
* @return bool
* @param[in] msg
* @li exepts type neutrino_msg_t as filter for searched message
* @li expects type neutrino_msg_t as filter for searched message
* @see neutrino_msg_t getButtonDirectKey(), driver/rcinput.h for possible values
*/
bool hasButtonDirectKey(const neutrino_msg_t& msg)

View File

@@ -248,7 +248,7 @@ void CComponentsFrmClock::initCCLockItems()
//extract timestring segment (char)
string stmp = s_time.substr(i, 1);
int w_tmp = minSepWidth;
int w_tmp = 0;
//get width of current segment
if (isdigit(stmp.at(0)) ) //check for digits, if true, we use digit width
w_tmp = cl_font->getMaxDigitWidth();

View File

@@ -223,7 +223,7 @@ void CComponentsFooter::setButtonLabels(const struct button_label_cc * const con
btn->setButtonFont(NULL);
}
dprintf(DEBUG_INFO, "[CComponentsFooter] [%s - %d] button %s [%zu] btn->getWidth() = %d w_btn = %d, (chain->getWidth() = %d)\n", __func__, __LINE__, txt.c_str(), i, btn->getWidth(), w_btn, btn_container->getWidth());
dprintf(DEBUG_INFO, "[CComponentsFooter] [%s - %d] button %s [%zu] btn->getWidth() = %d w_btn = %d, (chain->getWidth() = %d)\n", __func__, __LINE__, txt.c_str(), (uint32_t)i, btn->getWidth(), w_btn, btn_container->getWidth());
}
/* add generated button objects to chain object.
@@ -251,7 +251,7 @@ void CComponentsFooter::setButtonLabels(const struct button_label_cc * const con
void CComponentsFooter::setButtonLabels(const struct button_label * const content, const size_t& label_count, const int& chain_width, const int& label_width)
{
//conversion for compatibility with older paintButtons() methode, find in /gui/widget/buttons.h
button_label_cc buttons[label_count];
button_label_cc *buttons = new button_label_cc[label_count];
for (size_t i = 0; i< label_count; i++){
buttons[i].button = content[i].button;
buttons[i].locale = content[i].locale;
@@ -262,12 +262,13 @@ void CComponentsFooter::setButtonLabels(const struct button_label * const conten
buttons[i].btn_alias = -1;
}
setButtonLabels(buttons, label_count, chain_width, label_width);
delete[] buttons;
}
void CComponentsFooter::setButtonLabels(const vector<button_label_cc> &v_content, const int& chain_width, const int& label_width)
{
size_t label_count = v_content.size();
button_label_cc buttons[label_count];
button_label_cc *buttons = new button_label_cc[label_count];
for (size_t i= 0; i< label_count; i++){
buttons[i].button = v_content[i].button;
@@ -277,8 +278,8 @@ void CComponentsFooter::setButtonLabels(const vector<button_label_cc> &v_content
buttons[i].btn_result = v_content[i].btn_result;
buttons[i].btn_alias = v_content[i].btn_alias;
}
setButtonLabels(buttons, label_count, chain_width, label_width);
delete[] buttons;
}
void CComponentsFooter::setButtonLabel( const char *button_icon,

View File

@@ -343,14 +343,18 @@ void CComponentsHeader::initLogo()
* with previous or next item.
*/
if (cch_caption_align & CC_TITLE_LEFT){
int left_tag = prev_item->getXPos() + prev_item->getWidth();
if (x_logo <= left_tag)
x_logo = left_tag + logo_space/2 - w_logo/2;
if (prev_item){
int left_tag = prev_item->getXPos() + prev_item->getWidth();
if (x_logo <= left_tag)
x_logo = left_tag + logo_space/2 - w_logo/2;
}
}
if (cch_caption_align & CC_TITLE_RIGHT){
if (x_logo + w_logo >= next_item->getXPos())
x_logo = next_item->getXPos() - logo_space/2 - w_logo/2;
if (next_item){
if (x_logo + w_logo >= next_item->getXPos())
x_logo = next_item->getXPos() - logo_space/2 - w_logo/2;
}
}
}

View File

@@ -204,7 +204,7 @@ class CComponentsHeader : public CComponentsForm, public CCTextScreen, CCHeaderT
* Height can be changed with modes by setSizeMode(), setHeight() or constructor.
* @return void
*
* @param[in] font exepts font object, type Font*
* @param[in] font expects font object, type Font*
* @see getCaptionFont(), setSizeMode(),
* setCaptionColor(),
* setCaptionAlignment(),
@@ -227,7 +227,7 @@ class CComponentsHeader : public CComponentsForm, public CCTextScreen, CCHeaderT
* If other size wanted then use set setCaptionFont() and setHeight()
* @return void
*
* @param[in] size_mode exepts type int (enums)
* @param[in] size_mode expects type int (enums)
* possible modes are:
* CC_HEADER_SIZE_LARGE
* CC_HEADER_SIZE_SMALL

View File

@@ -70,20 +70,20 @@ class CComponentsScrollBar : public CComponentsFrmChain
public:
/**Class constructor to generate individual scrollbar objects
*
* @param[in] x_pos exepts type int, x position on screen
* @param[in] x_pos exepts type int, y position on screen modes are:
* @param[in] w exepts type int, width of scrollbar object
* @param[in] h exepts type int, height of scrollbar object
* @param[in] count optional, exepts type int, count of pages, default 1
* @param[in] x_pos expects type int, x position on screen
* @param[in] x_pos expects type int, y position on screen modes are:
* @param[in] w expects type int, width of scrollbar object
* @param[in] h expects type int, height of scrollbar object
* @param[in] count optional, expects type int, count of pages, default 1
*
* usual paraemters:
* @param[in] parent optional, exepts type pointer to a parent CComponentsForm object, default NULL
* @param[in] shadow_mode optional, exepts type int defined by shadow mode enums, default CC_SHADOW_OFF
* @param[in] color_frame optional, exepts type fb_pixel_t, default COL_SCROLLBAR_PLUS_0
* @param[in] color_body optional, exepts type fb_pixel_t, default COL_SCROLLBAR_PLUS_0
* @param[in] color_shadow optional, exepts type fb_pixel_t, default COL_SHADOW_PLUS_0
* @param[in] color_select optional, exepts type fb_pixel_t, default COL_SCROLLBAR_ACTIVE_PLUS_0
* @param[in] color_passive optional, exepts type fb_pixel_t, default COL_SCROLLBAR_PASSIVE_PLUS_0
* @param[in] parent optional, expects type pointer to a parent CComponentsForm object, default NULL
* @param[in] shadow_mode optional, expects type int defined by shadow mode enums, default CC_SHADOW_OFF
* @param[in] color_frame optional, expects type fb_pixel_t, default COL_SCROLLBAR_PLUS_0
* @param[in] color_body optional, expects type fb_pixel_t, default COL_SCROLLBAR_PLUS_0
* @param[in] color_shadow optional, expects type fb_pixel_t, default COL_SHADOW_PLUS_0
* @param[in] color_select optional, expects type fb_pixel_t, default COL_SCROLLBAR_ACTIVE_PLUS_0
* @param[in] color_passive optional, expects type fb_pixel_t, default COL_SCROLLBAR_PASSIVE_PLUS_0
*/
CComponentsScrollBar( const int &x_pos,
const int &y_pos,
@@ -102,7 +102,7 @@ class CComponentsScrollBar : public CComponentsFrmChain
/**Set current page number
* @return void
*
* @param[in] mark_id exepts type int, this sets the current selected page number.
* @param[in] mark_id expects type int, this sets the current selected page number.
*
* @see getMarkID()
*/
@@ -120,8 +120,8 @@ class CComponentsScrollBar : public CComponentsFrmChain
* Each segment is assigned to a page number. Starting with id 0...n
* @return void
*
* @param[in] segment_count exepts type int, sets the current count of pages.
* @param[in] mark_id optional, exepts type int, sets the current selected page number, default = 0
* @param[in] segment_count expects type int, sets the current count of pages.
* @param[in] mark_id optional, expects type int, sets the current selected page number, default = 0
* @see also setMarkID()
* getMarkID()
*/
@@ -135,7 +135,7 @@ class CComponentsScrollBar : public CComponentsFrmChain
int getSegmentCount(){return sb_segments_count;}
/**Enable/disable vizualized count of possible scroll items
* @param[in] enable optional, exepts type bool.
* @param[in] enable optional, expects type bool.
* @note Default mode is disabled.
*/
void enableVisualize(bool enable = true){sb_visual_enable = enable;}
@@ -150,21 +150,21 @@ void getScrollBarData(int *total_pages, int *current_page, int total_items, int
/**Small and easy to apply scrollbar paint methode without expilcit object declaration
* @return void
*
* @param[in] x_pos exepts type int, x position on screen
* @param[in] x_pos exepts type int, y position on screen modes are:
* @param[in] w exepts type int, width of scrollbar object
* @param[in] h exepts type int, height of scrollbar object
* @param[in] count exepts type int, count of pages, default 1
* @param[in] current_num exepts type int, current selected page, default 0
* @param[in] x_pos expects type int, x position on screen
* @param[in] x_pos expects type int, y position on screen modes are:
* @param[in] w expects type int, width of scrollbar object
* @param[in] h expects type int, height of scrollbar object
* @param[in] count expects type int, count of pages, default 1
* @param[in] current_num expects type int, current selected page, default 0
*
* usual paraemters:
* @param[in] parent optional, exepts type pointer to a parent CComponentsForm object, default NULL
* @param[in] shadow_mode optional, exepts type int defined by shadow mode enums, default CC_SHADOW_OFF
* @param[in] color_frame optional, exepts type fb_pixel_t, default COL_SCROLLBAR_PLUS_0
* @param[in] color_body optional, exepts type fb_pixel_t, default COL_SCROLLBAR_PLUS_0
* @param[in] color_shadow optional, exepts type fb_pixel_t, default COL_SHADOW_PLUS_0
* @param[in] color_select optional, exepts type fb_pixel_t, default COL_SCROLLBAR_ACTIVE_PLUS_0
* @param[in] color_passive optional, exepts type fb_pixel_t, default COL_SCROLLBAR_PASSIVE_PLUS_0
* @param[in] parent optional, expects type pointer to a parent CComponentsForm object, default NULL
* @param[in] shadow_mode optional, expects type int defined by shadow mode enums, default CC_SHADOW_OFF
* @param[in] color_frame optional, expects type fb_pixel_t, default COL_SCROLLBAR_PLUS_0
* @param[in] color_body optional, expects type fb_pixel_t, default COL_SCROLLBAR_PLUS_0
* @param[in] color_shadow optional, expects type fb_pixel_t, default COL_SHADOW_PLUS_0
* @param[in] color_select optional, expects type fb_pixel_t, default COL_SCROLLBAR_ACTIVE_PLUS_0
* @param[in] color_passive optional, expects type fb_pixel_t, default COL_SCROLLBAR_PASSIVE_PLUS_0
*/
void paintScrollBar( const int &x_pos,
const int &y_pos,

View File

@@ -299,10 +299,6 @@ int CComponentsPicture::getHeight()
void CComponentsPicture::paintPicture()
{
struct timeval t1, t2;
if (debug)
gettimeofday(&t1, NULL);
is_image_painted = false;
//initialize image position
int x_pic = x;
@@ -337,14 +333,6 @@ void CComponentsPicture::paintPicture()
frameBuffer->RestoreScreen(x_pic, y_pic, dxc, dyc, image_cache);
}
}
//benchmark
if (debug){
gettimeofday(&t2, NULL);
uint64_t duration = ((t2.tv_sec * 1000000ULL + t2.tv_usec) - (t1.tv_sec * 1000000ULL + t1.tv_usec)) / 1000ULL;
if (duration)
fprintf(stderr, "\033[33m[CComponentsPicture] %s: %" PRIu64 " ms to paint image \033[0m\n", __func__, duration);
}
}
void CComponentsPicture::paint(bool do_save_bg)

View File

@@ -437,10 +437,6 @@ void CProgressBarCache::pbcApplyGradient(fb_pixel_t *b)
void CProgressBar::paintProgress(bool do_save_bg)
{
struct timeval t1, t2;
if (debug)
gettimeofday(&t1, NULL);
if (*pb_design == PB_OFF) {
paintInit(false);
return;
@@ -488,14 +484,6 @@ void CProgressBar::paintProgress(bool do_save_bg)
if (is_painted)
pb_last_width = pb_active_width;
//benchmark
if (debug){
gettimeofday(&t2, NULL);
uint64_t duration = ((t2.tv_sec * 1000000ULL + t2.tv_usec) - (t1.tv_sec * 1000000ULL + t1.tv_usec)) / 1000ULL;
if (duration)
fprintf(stderr, "\033[33m[CProgressBar] %s: %" PRIu64 " ms to paint progress \033[0m\n",__func__, duration);
}
}
//NI starbar

View File

@@ -107,3 +107,12 @@ void CComponentsShapeCircle::paint(bool do_save_bg)
{
paintInit(do_save_bg);
}
bool PaintBoxRel(const int& x, const int& y, const int& dx, const int& dy, const fb_pixel_t& col, int radius, int corner_type, int shadow_mode)
{
CComponentsShapeSquare box(x, y, dx, dy, NULL, shadow_mode, COL_SHADOW_PLUS_0, col);
box.setCorner(radius, corner_type);
box.paint(CC_SAVE_SCREEN_NO);
return box.isPainted();
}

View File

@@ -73,4 +73,28 @@ class CComponentsShapeSquare : public CComponentsItem
void paint(bool do_save_bg = CC_SAVE_SCREEN_YES);
};
/**Small and easy to apply box paint methode without expilcit object declaration
* @return bool, true = painted
*
* @param[in] x expects type int, x position on screen
* @param[in] y expects type int, y position on screen modes are:
* @param[in] dx expects type int, width of scrollbar object
* @param[in] dy expects type int, height of scrollbar object
* @param[in] col expects type fb_pixel_t, as body color
*
* usual paraemters:
* @param[in] radius optional, expects type int as corner radius, default = 0
* @param[in] corner_type optional, expects type int as cornar type, default CORNER_ALL
* @param[in] shadow_mode optional, expects type int defined by shadow mode enums, default CC_SHADOW_OFF
*/
bool PaintBoxRel(const int& x,
const int& y,
const int& dx,
const int& dy,
const fb_pixel_t& col,
int radius = 0,
int corner_type = CORNER_ALL,
int shadow_mode = CC_SHADOW_OFF);
#endif