mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-08-30 00:41:17 +02:00
CComponentsPicture: rework constructors, clean ups
This commit is contained in:
@@ -40,26 +40,32 @@ using namespace std;
|
|||||||
|
|
||||||
//-------------------------------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------------------------------
|
||||||
//sub class CComponentsPicture from CComponentsItem
|
//sub class CComponentsPicture from CComponentsItem
|
||||||
CComponentsPicture::CComponentsPicture( const int x_pos, const int y_pos, const int w, const int h,
|
CComponentsPicture::CComponentsPicture( const int &x_pos, const int &y_pos, const int &w, const int &h,
|
||||||
const std::string& image_name, const int alignment, bool has_shadow,
|
const std::string& image_name, const int &alignment, bool has_shadow,
|
||||||
fb_pixel_t color_frame, fb_pixel_t color_background, fb_pixel_t color_shadow)
|
fb_pixel_t color_frame, fb_pixel_t color_background, fb_pixel_t color_shadow)
|
||||||
{
|
{
|
||||||
init(x_pos, y_pos, image_name, alignment, has_shadow, color_frame, color_background, color_shadow);
|
init(x_pos, y_pos, w, h, image_name, alignment, has_shadow, color_frame, color_background, color_shadow);
|
||||||
|
|
||||||
width = w;
|
|
||||||
height = h;
|
|
||||||
pic_paint_mode = CC_PIC_IMAGE_MODE_AUTO,
|
|
||||||
|
|
||||||
initVarPicture();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CComponentsPicture::init( int x_pos, int y_pos, const string& image_name, const int alignment, bool has_shadow,
|
void CComponentsPicture::init( const int &x_pos, const int &y_pos, const int &w, const int &h, const string& image_name, const int &alignment, bool has_shadow,
|
||||||
fb_pixel_t color_frame, fb_pixel_t color_background, fb_pixel_t color_shadow)
|
fb_pixel_t color_frame, fb_pixel_t color_background, fb_pixel_t color_shadow)
|
||||||
{
|
{
|
||||||
//CComponents, CComponentsItem
|
//CComponents, CComponentsItem
|
||||||
cc_item_type = CC_ITEMTYPE_PICTURE;
|
cc_item_type = CC_ITEMTYPE_PICTURE;
|
||||||
|
|
||||||
|
//CComponents
|
||||||
|
x = pic_x = x_pos;
|
||||||
|
y = pic_y = y_pos;
|
||||||
|
height = h;
|
||||||
|
width = w;
|
||||||
|
shadow = has_shadow;
|
||||||
|
shadow_w = SHADOW_OFFSET;
|
||||||
|
col_frame = color_frame;
|
||||||
|
col_body = color_background;
|
||||||
|
col_shadow = color_shadow;
|
||||||
|
|
||||||
//CComponentsPicture
|
//CComponentsPicture
|
||||||
|
pic_paint_mode = CC_PIC_IMAGE_MODE_AUTO,
|
||||||
pic_name = image_name;
|
pic_name = image_name;
|
||||||
pic_align = alignment;
|
pic_align = alignment;
|
||||||
pic_offset = 1;
|
pic_offset = 1;
|
||||||
@@ -72,33 +78,24 @@ void CComponentsPicture::init( int x_pos, int y_pos, const string& image_name, c
|
|||||||
if (pic_name.empty())
|
if (pic_name.empty())
|
||||||
pic_width = pic_height = 0;
|
pic_width = pic_height = 0;
|
||||||
|
|
||||||
//CComponents
|
initCCItem();
|
||||||
x = pic_x = x_pos;
|
|
||||||
y = pic_y = y_pos;
|
|
||||||
height = 0;
|
|
||||||
width = 0;
|
|
||||||
shadow = has_shadow;
|
|
||||||
shadow_w = SHADOW_OFFSET;
|
|
||||||
col_frame = color_frame;
|
|
||||||
col_body = color_background;
|
|
||||||
col_shadow = color_shadow;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CComponentsPicture::setPicture(const std::string& picture_name)
|
void CComponentsPicture::setPicture(const std::string& picture_name)
|
||||||
{
|
{
|
||||||
pic_name = picture_name;
|
pic_name = picture_name;
|
||||||
initVarPicture();
|
initCCItem();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void CComponentsPicture::setPictureAlign(const int alignment)
|
void CComponentsPicture::setPictureAlign(const int alignment)
|
||||||
{
|
{
|
||||||
pic_align = alignment;
|
pic_align = alignment;
|
||||||
initVarPicture();
|
initCCItem();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void CComponentsPicture::initVarPicture()
|
void CComponentsPicture::initCCItem()
|
||||||
{
|
{
|
||||||
pic_width = pic_height = 0;
|
pic_width = pic_height = 0;
|
||||||
pic_painted = false;
|
pic_painted = false;
|
||||||
@@ -195,7 +192,7 @@ void CComponentsPicture::paintPicture()
|
|||||||
|
|
||||||
void CComponentsPicture::paint(bool do_save_bg)
|
void CComponentsPicture::paint(bool do_save_bg)
|
||||||
{
|
{
|
||||||
initVarPicture();
|
initCCItem();
|
||||||
paintInit(do_save_bg);
|
paintInit(do_save_bg);
|
||||||
paintPicture();
|
paintPicture();
|
||||||
}
|
}
|
||||||
@@ -207,9 +204,9 @@ void CComponentsPicture::hide(bool no_restore)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
CComponentsChannelLogo::CComponentsChannelLogo( const int x_pos, const int y_pos, const int w, const int h,
|
CComponentsChannelLogo::CComponentsChannelLogo( const int &x_pos, const int &y_pos, const int &w, const int &h,
|
||||||
const uint64_t& channelId, const std::string& channelName,
|
const uint64_t& channelId, const std::string& channelName,
|
||||||
const int alignment, bool has_shadow,
|
const int &alignment, bool has_shadow,
|
||||||
fb_pixel_t color_frame, fb_pixel_t color_background, fb_pixel_t color_shadow)
|
fb_pixel_t color_frame, fb_pixel_t color_background, fb_pixel_t color_shadow)
|
||||||
:CComponentsPicture(x_pos, y_pos, w, h,
|
:CComponentsPicture(x_pos, y_pos, w, h,
|
||||||
"", alignment, has_shadow,
|
"", alignment, has_shadow,
|
||||||
@@ -246,11 +243,11 @@ void CComponentsChannelLogo::initVarPictureChannellLogo()
|
|||||||
if (!has_logo)
|
if (!has_logo)
|
||||||
pic_name = tmp_logo;
|
pic_name = tmp_logo;
|
||||||
|
|
||||||
// #ifdef DEBUG_CC
|
#ifdef DEBUG_CC
|
||||||
printf("\t[CComponentsChannelLogo] %s: init image: %s (has_logo=%d, channel_id=%" PRIu64 ")\n", __func__, pic_name.c_str(), has_logo, channel_id);
|
printf("\t[CComponentsChannelLogo] %s: init image: %s (has_logo=%d, channel_id=%" PRIu64 ")\n", __func__, pic_name.c_str(), has_logo, channel_id);
|
||||||
// #endif
|
#endif
|
||||||
|
|
||||||
initVarPicture();
|
initCCItem();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CComponentsChannelLogo::paint(bool do_save_bg)
|
void CComponentsChannelLogo::paint(bool do_save_bg)
|
||||||
|
@@ -43,9 +43,6 @@ Picture is usable like each other CCItems.
|
|||||||
class CComponentsPicture : public CComponentsItem
|
class CComponentsPicture : public CComponentsItem
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
///initialize all required attributes
|
|
||||||
void initVarPicture();
|
|
||||||
|
|
||||||
///some internal modes for icon and image handling
|
///some internal modes for icon and image handling
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
@@ -62,25 +59,36 @@ class CComponentsPicture : public CComponentsItem
|
|||||||
bool pic_paint, pic_paintBg, pic_painted, do_paint;
|
bool pic_paint, pic_paintBg, pic_painted, do_paint;
|
||||||
int pic_align, pic_x, pic_y, pic_width, pic_height;
|
int pic_align, pic_x, pic_y, pic_width, pic_height;
|
||||||
int pic_max_w, pic_max_h, pic_paint_mode;
|
int pic_max_w, pic_max_h, pic_paint_mode;
|
||||||
|
|
||||||
void init( const int x_pos, const int y_pos, const std::string& image_name, const int alignment, bool has_shadow,
|
void init( const int &x_pos, const int &y_pos, const int &w, const int &h,
|
||||||
fb_pixel_t color_frame, fb_pixel_t color_background, fb_pixel_t color_shadow);
|
const std::string& image_name,
|
||||||
|
const int &alignment,
|
||||||
|
bool has_shadow,
|
||||||
|
fb_pixel_t color_frame,
|
||||||
|
fb_pixel_t color_background,
|
||||||
|
fb_pixel_t color_shadow);
|
||||||
|
|
||||||
|
///initialize all required attributes
|
||||||
|
void initCCItem();
|
||||||
///initialize position of picture object dependendly from settings
|
///initialize position of picture object dependendly from settings
|
||||||
void initPosition();
|
void initPosition();
|
||||||
void paintPicture();
|
void paintPicture();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CComponentsPicture( const int x_pos, const int y_pos, const int w, const int h,
|
CComponentsPicture( const int &x_pos, const int &y_pos, const int &w, const int &h,
|
||||||
const std::string& image_name, const int alignment = CC_ALIGN_HOR_CENTER | CC_ALIGN_VER_CENTER, bool has_shadow = CC_SHADOW_OFF,
|
const std::string& image_name,
|
||||||
fb_pixel_t color_frame = COL_MENUCONTENT_PLUS_6, fb_pixel_t color_background = 0, fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0);
|
const int &alignment = CC_ALIGN_HOR_CENTER | CC_ALIGN_VER_CENTER,
|
||||||
|
bool has_shadow = CC_SHADOW_OFF,
|
||||||
|
fb_pixel_t color_frame = COL_MENUCONTENT_PLUS_6,
|
||||||
|
fb_pixel_t color_background = 0,
|
||||||
|
fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0);
|
||||||
|
|
||||||
virtual inline void setPictureOffset(const unsigned char offset){pic_offset = offset;};
|
virtual inline void setPictureOffset(const unsigned char offset){pic_offset = offset;};
|
||||||
virtual inline void setPicturePaint(bool paint_p){pic_paint = paint_p;};
|
virtual inline void setPicturePaint(bool paint_p){pic_paint = paint_p;};
|
||||||
virtual inline void setPicturePaintBackground(bool paintBg){pic_paintBg = paintBg;};
|
virtual inline void setPicturePaintBackground(bool paintBg){pic_paintBg = paintBg;};
|
||||||
virtual void setPicture(const std::string& picture_name);
|
virtual void setPicture(const std::string& picture_name);
|
||||||
virtual void setPictureAlign(const int alignment);
|
virtual void setPictureAlign(const int alignment);
|
||||||
|
|
||||||
virtual inline bool isPicPainted(){return pic_painted;};
|
virtual inline bool isPicPainted(){return pic_painted;};
|
||||||
virtual void paint(bool do_save_bg = CC_SAVE_SCREEN_YES);
|
virtual void paint(bool do_save_bg = CC_SAVE_SCREEN_YES);
|
||||||
virtual void hide(bool no_restore = false);
|
virtual void hide(bool no_restore = false);
|
||||||
@@ -101,10 +109,14 @@ class CComponentsChannelLogo : public CComponentsPicture, CPictureViewer
|
|||||||
bool has_logo;
|
bool has_logo;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CComponentsChannelLogo( const int x_pos, const int y_pos, const int w, const int h,
|
CComponentsChannelLogo( const int &x_pos, const int &y_pos, const int &w, const int &h,
|
||||||
const uint64_t& channelId =0, const std::string& channelName = "",
|
const uint64_t& channelId =0,
|
||||||
const int alignment = CC_ALIGN_HOR_CENTER | CC_ALIGN_VER_CENTER, bool has_shadow = CC_SHADOW_OFF,
|
const std::string& channelName = "",
|
||||||
fb_pixel_t color_frame = COL_MENUCONTENT_PLUS_6, fb_pixel_t color_background = 0, fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0);
|
const int &alignment = CC_ALIGN_HOR_CENTER | CC_ALIGN_VER_CENTER,
|
||||||
|
bool has_shadow = CC_SHADOW_OFF,
|
||||||
|
fb_pixel_t color_frame = COL_MENUCONTENT_PLUS_6,
|
||||||
|
fb_pixel_t color_background = 0,
|
||||||
|
fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0);
|
||||||
|
|
||||||
void setChannel(const uint64_t& channelId, const std::string& channelName);
|
void setChannel(const uint64_t& channelId, const std::string& channelName);
|
||||||
void setPicture(const std::string& picture_name);
|
void setPicture(const std::string& picture_name);
|
||||||
|
Reference in New Issue
Block a user