Merge branch 'master' into pu/mp

This commit is contained in:
Jacek Jendrzej
2017-04-25 13:43:33 +02:00
8 changed files with 52 additions and 25 deletions

View File

@@ -128,7 +128,7 @@ void CComponentsHeader::initVarHeader( const int& x_pos, const int& y_pos, const
cch_logo.Id = 0;
cch_logo.Name = "";
cch_logo.dy_max = -1;
cch_logo.Align = CC_LOGO_RIGHT;
cch_logo.Align = DEFAULT_LOGO_ALIGN;
cch_col_text = COL_MENUHEAD_TEXT;
cch_caption_align = CTextBox::NO_AUTO_LINEBREAK;
cch_items_y = CC_CENTERED;
@@ -281,6 +281,14 @@ void CComponentsHeader::initLogo()
else
cch_logo_obj->setChannel(cch_logo.Id, cch_logo.Name);
//ensure logo is not larger than original size if in auto mode
if (cch_logo.dy_max == -1){
int dx_orig = 0, dy_orig = 0 ;
cch_logo_obj->getRealSize(&dx_orig, &dy_orig);
if (cch_logo.dy_max > dy_orig)
cch_logo.dy_max = dy_orig;
}
if (cch_logo_obj->hasLogo()){
cch_logo_obj->setHeight(cch_logo.dy_max, true);

View File

@@ -32,6 +32,8 @@
#include "cc_frm_clock.h"
#include <driver/colorgradient.h>
#define DEFAULT_LOGO_ALIGN CComponentsHeader::CC_LOGO_CENTER
//! Sub class of CComponentsForm. Shows a header with prepared items.
/*!
CComponentsHeader provides prepared items like icon, caption and context button icons, mostly for usage in menues or simple windows
@@ -317,10 +319,11 @@ class CComponentsHeader : public CComponentsForm, public CCTextScreen
* CC_LOGO_RIGHT \n
* @param[in] dy
* @li optional logo height, default = -1 (auto)
* @note In auto mode, logo use full height minus inner offset but not larger than original logo height.
*/
void setChannelLogo( const uint64_t& channelId,
const std::string& channelName,
cc_logo_alignment_t alignment = CC_LOGO_CENTER,
cc_logo_alignment_t alignment = DEFAULT_LOGO_ALIGN,
const int& dy = -1)
{cch_logo.Id = channelId; cch_logo.Name = channelName, cch_logo.Align = alignment, cch_logo.dy_max = dy; initCCItems();}
/**Methode to get channel logo object for direct access to its properties and methodes

View File

@@ -76,6 +76,7 @@ void CComponentsPicture::init( const int &x_pos, const int &y_pos, const int &w,
y = y_old = y_pos;
width = width_old = dx = dxc = w;
height = height_old = dy = dyc = h;
dx_orig = dy_orig = 0;
pic_name = pic_name_old = image_name;
shadow = shadow_mode;
shadow_w = OFFSET_SHADOW;
@@ -201,6 +202,9 @@ void CComponentsPicture::initCCItem()
if (height == 0)
height = dy_tmp;
}
dx_orig = width;
dy_orig = height;
/* leave init methode here if we in no scale mode
* otherwise goto next step!
*/
@@ -211,8 +215,12 @@ void CComponentsPicture::initCCItem()
* check internal dimension values (dx/dy) and ensure that values are >0
* real image size
*/
if ((dx != width || dy != height) || (dx == 0 || dy == 0))
g_PicViewer->getSize(pic_name.c_str(), &dx, &dy);
g_PicViewer->getSize(pic_name.c_str(), &dx_orig, &dy_orig);
if ((dx != width || dy != height) || (dx == 0 || dy == 0)){
dx = dx_orig;
dy = dy_orig;
//g_PicViewer->getSize(pic_name.c_str(), &dx, &dy);
}
}
/* on next step check item dimensions (width/height) for 0 values
@@ -269,11 +277,11 @@ void CComponentsPicture::initPosition(int *x_position, int *y_position)
}
// void CComponentsPicture::getSize(int* width_image, int *height_image)
// {
// *width_image = width;
// *height_image = height;
// }
void CComponentsPicture::getRealSize(int* dx_original, int *dy_original)
{
*dx_original = dx_orig;
*dy_original = dy_orig;
}
int CComponentsPicture::getWidth()
{

View File

@@ -54,9 +54,10 @@ class CComponentsPicture : public CComponentsItem
///screen cache content for painted image
fb_pixel_t *image_cache;
///current original image dimensions
///current image dimensions
int dx, dy;
///original image dimensions
int dx_orig, dy_orig;
///cached image dimensions
int dxc, dyc;
@@ -146,8 +147,8 @@ class CComponentsPicture : public CComponentsItem
///returns current assigned image name
std::string getPictureName(){return pic_name;}
// ///handle image size
// void getSize(int* width_image, int *height_image);
///get original image size
void getRealSize(int* dx_orig, int *dy_orig);
///return width of item
int getWidth();
///return height of item

View File

@@ -157,6 +157,9 @@ class CProgressBar : public CComponentsItem
//set gradient (overides g_settings.theme.progressbar_gradient)
void setGradient(int &gradient) { pb_gradient = &gradient; }
void setXPos(const int& xpos){CCDraw::setXPos(xpos);}
void setYPos(const int& ypos){CCDraw::setYPos(ypos);}
};
#endif /* __CC_PROGRESSBAR_H__ */