mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-08-29 16:31:11 +02:00
CComponents: add members to init inherit variables
This sould enshure, that we have init with basic values in sub classes
This commit is contained in:
@@ -107,10 +107,12 @@ class CComponents
|
|||||||
bool firstPaint, shadow;
|
bool firstPaint, shadow;
|
||||||
BGMODE_TYPES bgMode;
|
BGMODE_TYPES bgMode;
|
||||||
|
|
||||||
|
void initVarBasic();
|
||||||
void paintFbItems(struct comp_fbdata_t * fbdata, const int items_count, bool do_save_bg = true);
|
void paintFbItems(struct comp_fbdata_t * fbdata, const int items_count, bool do_save_bg = true);
|
||||||
fb_pixel_t* getScreen(int ax, int ay, int dx, int dy);
|
fb_pixel_t* getScreen(int ax, int ay, int dx, int dy);
|
||||||
comp_screen_data_t saved_screen;
|
comp_screen_data_t saved_screen;
|
||||||
|
|
||||||
|
void clearSavedScreen();
|
||||||
void clear();
|
void clear();
|
||||||
public:
|
public:
|
||||||
CComponents();
|
CComponents();
|
||||||
@@ -144,6 +146,7 @@ class CComponentsContainer : public CComponents
|
|||||||
int corner_rad, fr_thickness;
|
int corner_rad, fr_thickness;
|
||||||
void hideContainer(bool no_restore = false);
|
void hideContainer(bool no_restore = false);
|
||||||
void paintInit(bool do_save_bg);
|
void paintInit(bool do_save_bg);
|
||||||
|
void initVarContainer();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CComponentsContainer();
|
CComponentsContainer();
|
||||||
@@ -170,7 +173,7 @@ class CComponentsPicture : public CComponentsContainer
|
|||||||
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;
|
||||||
|
|
||||||
void initDimensions();
|
void initVarPicture();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CComponentsPicture( const int x_pos, const int y_pos, const std::string& picture_name, const int alignment = CC_ALIGN_HOR_CENTER | CC_ALIGN_VER_CENTER, bool has_shadow = CC_SHADOW_OFF,
|
CComponentsPicture( const int x_pos, const int y_pos, const std::string& picture_name, const int alignment = CC_ALIGN_HOR_CENTER | CC_ALIGN_VER_CENTER, bool has_shadow = CC_SHADOW_OFF,
|
||||||
@@ -265,7 +268,7 @@ class CComponentsDetailLine : public CComponents
|
|||||||
private:
|
private:
|
||||||
int thickness, y_down, h_mark_top, h_mark_down;
|
int thickness, y_down, h_mark_top, h_mark_down;
|
||||||
|
|
||||||
void initVar();
|
void initVarDline();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CComponentsDetailLine();
|
CComponentsDetailLine();
|
||||||
|
@@ -41,19 +41,36 @@ using namespace std;
|
|||||||
//abstract basic class CComponents
|
//abstract basic class CComponents
|
||||||
CComponents::CComponents()
|
CComponents::CComponents()
|
||||||
{
|
{
|
||||||
//basic CComponents
|
initVarBasic();
|
||||||
|
}
|
||||||
|
|
||||||
|
CComponents::~CComponents()
|
||||||
|
{
|
||||||
|
hide();
|
||||||
|
clearSavedScreen();
|
||||||
|
clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CComponents::clearSavedScreen()
|
||||||
|
{
|
||||||
|
if (saved_screen.pixbuf)
|
||||||
|
delete[] saved_screen.pixbuf;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CComponents::initVarBasic()
|
||||||
|
{
|
||||||
x = saved_screen.x = 0;
|
x = saved_screen.x = 0;
|
||||||
y = saved_screen.y = 0;
|
y = saved_screen.y = 0;
|
||||||
height = saved_screen.dy = CC_HEIGHT_MIN;
|
height = saved_screen.dy = CC_HEIGHT_MIN;
|
||||||
width = saved_screen.dx = CC_WIDTH_MIN;
|
width = saved_screen.dx = CC_WIDTH_MIN;
|
||||||
|
|
||||||
col_body = COL_MENUCONTENT_PLUS_0;
|
col_body = COL_MENUCONTENT_PLUS_0;
|
||||||
col_shadow = COL_MENUCONTENTDARK_PLUS_0;
|
col_shadow = COL_MENUCONTENTDARK_PLUS_0;
|
||||||
col_frame = COL_MENUCONTENT_PLUS_6;
|
col_frame = COL_MENUCONTENT_PLUS_6;
|
||||||
corner_type = CORNER_ALL;
|
corner_type = CORNER_ALL;
|
||||||
shadow = CC_SHADOW_OFF;
|
shadow = CC_SHADOW_OFF;
|
||||||
shadow_w = SHADOW_OFFSET;
|
shadow_w = SHADOW_OFFSET;
|
||||||
|
|
||||||
firstPaint = true;
|
firstPaint = true;
|
||||||
frameBuffer = CFrameBuffer::getInstance();
|
frameBuffer = CFrameBuffer::getInstance();
|
||||||
v_fbdata.clear();
|
v_fbdata.clear();
|
||||||
@@ -61,14 +78,6 @@ CComponents::CComponents()
|
|||||||
saved_screen.pixbuf = NULL;
|
saved_screen.pixbuf = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
CComponents::~CComponents()
|
|
||||||
{
|
|
||||||
hide();
|
|
||||||
if (saved_screen.pixbuf)
|
|
||||||
delete[] saved_screen.pixbuf;
|
|
||||||
clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
//paint framebuffer stuff and fill buffer
|
//paint framebuffer stuff and fill buffer
|
||||||
void CComponents::paintFbItems(struct comp_fbdata_t * fbdata, const int items_count, bool do_save_bg)
|
void CComponents::paintFbItems(struct comp_fbdata_t * fbdata, const int items_count, bool do_save_bg)
|
||||||
{
|
{
|
||||||
@@ -81,8 +90,7 @@ void CComponents::paintFbItems(struct comp_fbdata_t * fbdata, const int items_co
|
|||||||
saved_screen.y = fbdata[i].y;
|
saved_screen.y = fbdata[i].y;
|
||||||
saved_screen.dx = fbdata[i].dx;
|
saved_screen.dx = fbdata[i].dx;
|
||||||
saved_screen.dy = fbdata[i].dy;
|
saved_screen.dy = fbdata[i].dy;
|
||||||
if (saved_screen.pixbuf)
|
clearSavedScreen();
|
||||||
delete[] saved_screen.pixbuf;
|
|
||||||
saved_screen.pixbuf = getScreen(saved_screen.x, saved_screen.y, saved_screen.dx, saved_screen.dy);
|
saved_screen.pixbuf = getScreen(saved_screen.x, saved_screen.y, saved_screen.dx, saved_screen.dy);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -156,8 +164,7 @@ inline void CComponents::clear()
|
|||||||
CComponentsContainer::CComponentsContainer()
|
CComponentsContainer::CComponentsContainer()
|
||||||
{
|
{
|
||||||
//CComponentsContainer
|
//CComponentsContainer
|
||||||
corner_rad = 0;
|
initVarContainer();
|
||||||
fr_thickness = 2;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// y
|
// y
|
||||||
@@ -167,6 +174,15 @@ CComponentsContainer::CComponentsContainer()
|
|||||||
// | |
|
// | |
|
||||||
// +--------width---------+
|
// +--------width---------+
|
||||||
|
|
||||||
|
void CComponentsContainer::initVarContainer()
|
||||||
|
{
|
||||||
|
//CComponents
|
||||||
|
initVarBasic();
|
||||||
|
|
||||||
|
//ComponentsContainer
|
||||||
|
corner_rad = 0;
|
||||||
|
fr_thickness = 0;
|
||||||
|
}
|
||||||
|
|
||||||
void CComponentsContainer::paintInit(bool do_save_bg)
|
void CComponentsContainer::paintInit(bool do_save_bg)
|
||||||
{
|
{
|
||||||
@@ -262,22 +278,15 @@ void CComponentsContainer::syncSysColors()
|
|||||||
//sub class CComponentsInfoBox from CComponentsContainer
|
//sub class CComponentsInfoBox from CComponentsContainer
|
||||||
CComponentsInfoBox::CComponentsInfoBox()
|
CComponentsInfoBox::CComponentsInfoBox()
|
||||||
{
|
{
|
||||||
|
//CComponents, ComponentsContainer
|
||||||
|
initVarContainer();
|
||||||
|
|
||||||
//CComponentsInfoBox
|
//CComponentsInfoBox
|
||||||
initVarInfobox();
|
initVarInfobox();
|
||||||
text = NULL;
|
text = NULL;
|
||||||
text_mode = CTextBox::AUTO_WIDTH;
|
text_mode = CTextBox::AUTO_WIDTH;
|
||||||
font = NULL;
|
font = NULL;
|
||||||
col_text = COL_MENUCONTENT;
|
col_text = COL_MENUCONTENT;
|
||||||
|
|
||||||
//CComponents
|
|
||||||
x = 0;
|
|
||||||
y = 0;
|
|
||||||
width = 120;
|
|
||||||
height = 240;
|
|
||||||
shadow = CC_SHADOW_OFF;
|
|
||||||
col_frame = COL_MENUCONTENT_PLUS_6;
|
|
||||||
col_body = COL_MENUCONTENT_PLUS_0;
|
|
||||||
col_shadow = COL_MENUCONTENTDARK_PLUS_0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CComponentsInfoBox::CComponentsInfoBox(const int x_pos, const int y_pos, const int w, const int h,
|
CComponentsInfoBox::CComponentsInfoBox(const int x_pos, const int y_pos, const int w, const int h,
|
||||||
@@ -285,14 +294,9 @@ CComponentsInfoBox::CComponentsInfoBox(const int x_pos, const int y_pos, const i
|
|||||||
bool has_shadow,
|
bool has_shadow,
|
||||||
fb_pixel_t color_text, fb_pixel_t color_frame, fb_pixel_t color_body, fb_pixel_t color_shadow)
|
fb_pixel_t color_text, fb_pixel_t color_frame, fb_pixel_t color_body, fb_pixel_t color_shadow)
|
||||||
{
|
{
|
||||||
//CComponentsInfoBox
|
//CComponents, ComponentsContainer
|
||||||
initVarInfobox();
|
initVarContainer();
|
||||||
text = info_text;
|
|
||||||
text_mode = mode;
|
|
||||||
font = font_text;
|
|
||||||
col_text = color_text;
|
|
||||||
|
|
||||||
//CComponents
|
|
||||||
x = x_pos;
|
x = x_pos;
|
||||||
y = y_pos;
|
y = y_pos;
|
||||||
width = w;
|
width = w;
|
||||||
@@ -300,15 +304,20 @@ CComponentsInfoBox::CComponentsInfoBox(const int x_pos, const int y_pos, const i
|
|||||||
shadow = has_shadow;
|
shadow = has_shadow;
|
||||||
col_frame = color_frame;
|
col_frame = color_frame;
|
||||||
col_body = color_body;
|
col_body = color_body;
|
||||||
col_shadow = color_shadow;
|
col_shadow = color_shadow;
|
||||||
|
|
||||||
|
//CComponentsInfoBox
|
||||||
|
initVarInfobox();
|
||||||
|
text = info_text;
|
||||||
|
text_mode = mode;
|
||||||
|
font = font_text;
|
||||||
|
col_text = color_text;
|
||||||
}
|
}
|
||||||
|
|
||||||
CComponentsInfoBox::~CComponentsInfoBox()
|
CComponentsInfoBox::~CComponentsInfoBox()
|
||||||
{
|
{
|
||||||
|
|
||||||
hide();
|
hide();
|
||||||
// if (saved_screen.pixbuf)
|
clearSavedScreen();
|
||||||
// delete[] saved_screen.pixbuf;
|
|
||||||
delete textbox;
|
delete textbox;
|
||||||
delete box;
|
delete box;
|
||||||
delete pic;
|
delete pic;
|
||||||
@@ -317,15 +326,8 @@ CComponentsInfoBox::~CComponentsInfoBox()
|
|||||||
|
|
||||||
void CComponentsInfoBox::initVarInfobox()
|
void CComponentsInfoBox::initVarInfobox()
|
||||||
{
|
{
|
||||||
//CComponentsContainer
|
//CComponents, ComponentsContainer
|
||||||
corner_rad = RADIUS_LARGE;
|
initVarContainer();
|
||||||
fr_thickness = 2;
|
|
||||||
|
|
||||||
//CComponents
|
|
||||||
firstPaint = true;
|
|
||||||
v_fbdata.clear();
|
|
||||||
bgMode = CC_BGMODE_PERMANENT;
|
|
||||||
shadow_w = SHADOW_OFFSET;
|
|
||||||
|
|
||||||
//CComponentsInfoBox
|
//CComponentsInfoBox
|
||||||
box = NULL;
|
box = NULL;
|
||||||
@@ -421,7 +423,9 @@ void CComponentsInfoBox::removeLineBreaks(std::string& str)
|
|||||||
//sub class CComponentsShapeSquare from CComponentsContainer
|
//sub class CComponentsShapeSquare from CComponentsContainer
|
||||||
CComponentsShapeSquare::CComponentsShapeSquare(const int x_pos, const int y_pos, const int w, const int h, bool has_shadow, fb_pixel_t color_frame, fb_pixel_t color_body, fb_pixel_t color_shadow)
|
CComponentsShapeSquare::CComponentsShapeSquare(const int x_pos, const int y_pos, const int w, const int h, bool has_shadow, fb_pixel_t color_frame, fb_pixel_t color_body, fb_pixel_t color_shadow)
|
||||||
{
|
{
|
||||||
//CComponents
|
//ComponentsContainer
|
||||||
|
initVarContainer();
|
||||||
|
|
||||||
x = x_pos;
|
x = x_pos;
|
||||||
y = y_pos;
|
y = y_pos;
|
||||||
width = w;
|
width = w;
|
||||||
@@ -435,9 +439,7 @@ CComponentsShapeSquare::CComponentsShapeSquare(const int x_pos, const int y_pos,
|
|||||||
v_fbdata.clear();
|
v_fbdata.clear();
|
||||||
bgMode = CC_BGMODE_PERMANENT;
|
bgMode = CC_BGMODE_PERMANENT;
|
||||||
|
|
||||||
//CComponentsContainer
|
|
||||||
corner_rad = 0;
|
|
||||||
fr_thickness = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//-------------------------------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------------------------------
|
||||||
@@ -445,9 +447,9 @@ CComponentsShapeSquare::CComponentsShapeSquare(const int x_pos, const int y_pos,
|
|||||||
CComponentsShapeCircle::CComponentsShapeCircle( int x_pos, int y_pos, int diam, bool has_shadow,
|
CComponentsShapeCircle::CComponentsShapeCircle( int x_pos, int y_pos, int diam, bool has_shadow,
|
||||||
fb_pixel_t color_frame, fb_pixel_t color_body, fb_pixel_t color_shadow)
|
fb_pixel_t color_frame, fb_pixel_t color_body, fb_pixel_t color_shadow)
|
||||||
{
|
{
|
||||||
//CComponentsShapeCircle
|
//CComponents, CComponentsContainer
|
||||||
d = diam;
|
initVarContainer();
|
||||||
|
|
||||||
//CComponents
|
//CComponents
|
||||||
x = x_pos;
|
x = x_pos;
|
||||||
y = y_pos;
|
y = y_pos;
|
||||||
@@ -461,10 +463,12 @@ CComponentsShapeCircle::CComponentsShapeCircle( int x_pos, int y_pos, int diam,
|
|||||||
firstPaint = true;
|
firstPaint = true;
|
||||||
v_fbdata.clear();
|
v_fbdata.clear();
|
||||||
bgMode = CC_BGMODE_PERMANENT;
|
bgMode = CC_BGMODE_PERMANENT;
|
||||||
|
|
||||||
|
//CComponentsShapeCircle
|
||||||
|
d = diam;
|
||||||
|
|
||||||
//CComponentsContainer
|
//CComponentsContainer
|
||||||
corner_rad = d/2;
|
corner_rad = d/2;
|
||||||
fr_thickness = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// y
|
// y
|
||||||
@@ -483,7 +487,7 @@ CComponentsShapeCircle::CComponentsShapeCircle( int x_pos, int y_pos, int diam,
|
|||||||
//sub class CComponentsDetailLine from CComponents
|
//sub class CComponentsDetailLine from CComponents
|
||||||
CComponentsDetailLine::CComponentsDetailLine()
|
CComponentsDetailLine::CComponentsDetailLine()
|
||||||
{
|
{
|
||||||
initVar();
|
initVarDline();
|
||||||
|
|
||||||
//CComponents
|
//CComponents
|
||||||
x = 0;
|
x = 0;
|
||||||
@@ -499,7 +503,7 @@ CComponentsDetailLine::CComponentsDetailLine()
|
|||||||
|
|
||||||
CComponentsDetailLine::CComponentsDetailLine(const int x_pos, const int y_pos_top, const int y_pos_down, const int h_mark_top_, const int h_mark_down_, fb_pixel_t color_line, fb_pixel_t color_shadow)
|
CComponentsDetailLine::CComponentsDetailLine(const int x_pos, const int y_pos_top, const int y_pos_down, const int h_mark_top_, const int h_mark_down_, fb_pixel_t color_line, fb_pixel_t color_shadow)
|
||||||
{
|
{
|
||||||
initVar();
|
initVarDline();
|
||||||
|
|
||||||
//CComponents
|
//CComponents
|
||||||
x = x_pos;
|
x = x_pos;
|
||||||
@@ -513,13 +517,12 @@ CComponentsDetailLine::CComponentsDetailLine(const int x_pos, const int y_pos_to
|
|||||||
h_mark_down = h_mark_down_;
|
h_mark_down = h_mark_down_;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CComponentsDetailLine::initVar()
|
void CComponentsDetailLine::initVarDline()
|
||||||
{
|
{
|
||||||
//CComponents
|
//CComponents
|
||||||
|
initVarBasic();
|
||||||
|
|
||||||
shadow_w = 1;
|
shadow_w = 1;
|
||||||
firstPaint = true;
|
|
||||||
v_fbdata.clear();
|
|
||||||
width = CC_WIDTH_MIN;
|
|
||||||
|
|
||||||
//CComponentsDetailLine
|
//CComponentsDetailLine
|
||||||
thickness = 4;
|
thickness = 4;
|
||||||
@@ -620,6 +623,9 @@ void CComponentsDetailLine::syncSysColors()
|
|||||||
//sub class CComponentsPIP from CComponentsContainer
|
//sub class CComponentsPIP from CComponentsContainer
|
||||||
CComponentsPIP::CComponentsPIP( const int x_pos, const int y_pos, const int percent, bool has_shadow)
|
CComponentsPIP::CComponentsPIP( const int x_pos, const int y_pos, const int percent, bool has_shadow)
|
||||||
{
|
{
|
||||||
|
//CComponents, CComponentsContainer
|
||||||
|
initVarContainer();
|
||||||
|
|
||||||
//CComponentsPIP
|
//CComponentsPIP
|
||||||
screen_w = frameBuffer->getScreenWidth(true);
|
screen_w = frameBuffer->getScreenWidth(true);
|
||||||
screen_h = frameBuffer->getScreenHeight(true);
|
screen_h = frameBuffer->getScreenHeight(true);
|
||||||
@@ -637,17 +643,12 @@ CComponentsPIP::CComponentsPIP( const int x_pos, const int y_pos, const int perc
|
|||||||
firstPaint = true;
|
firstPaint = true;
|
||||||
v_fbdata.clear();
|
v_fbdata.clear();
|
||||||
bgMode = CC_BGMODE_PERMANENT;
|
bgMode = CC_BGMODE_PERMANENT;
|
||||||
|
|
||||||
//CComponentsContainer
|
|
||||||
corner_rad = 0;
|
|
||||||
fr_thickness = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CComponentsPIP::~CComponentsPIP()
|
CComponentsPIP::~CComponentsPIP()
|
||||||
{
|
{
|
||||||
hide();
|
hide();
|
||||||
// if (saved_screen.pixbuf)
|
clearSavedScreen();
|
||||||
// delete[] saved_screen.pixbuf;
|
|
||||||
clear();
|
clear();
|
||||||
videoDecoder->Pig(-1, -1, -1, -1);
|
videoDecoder->Pig(-1, -1, -1, -1);
|
||||||
}
|
}
|
||||||
@@ -671,6 +672,9 @@ void CComponentsPIP::hide(bool no_restore)
|
|||||||
CComponentsPicture::CComponentsPicture( int x_pos, int y_pos, const string& picture_name, const int alignment, bool has_shadow,
|
CComponentsPicture::CComponentsPicture( int x_pos, int y_pos, const string& picture_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, CComponentsContainer
|
||||||
|
initVarContainer();
|
||||||
|
|
||||||
//CComponentsPicture
|
//CComponentsPicture
|
||||||
pic_name = picture_name;
|
pic_name = picture_name;
|
||||||
pic_align = alignment;
|
pic_align = alignment;
|
||||||
@@ -696,29 +700,25 @@ CComponentsPicture::CComponentsPicture( int x_pos, int y_pos, const string& pict
|
|||||||
v_fbdata.clear();
|
v_fbdata.clear();
|
||||||
bgMode = CC_BGMODE_PERMANENT;
|
bgMode = CC_BGMODE_PERMANENT;
|
||||||
|
|
||||||
//CComponentsContainer
|
initVarPicture();
|
||||||
corner_rad = 0;
|
|
||||||
fr_thickness = 0;
|
|
||||||
|
|
||||||
initDimensions();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void CComponentsPicture::setPicture(const std::string& picture_name)
|
void CComponentsPicture::setPicture(const std::string& picture_name)
|
||||||
{
|
{
|
||||||
pic_name = picture_name;
|
pic_name = picture_name;
|
||||||
initDimensions();
|
initVarPicture();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void CComponentsPicture::setPictureAlign(const int alignment)
|
void CComponentsPicture::setPictureAlign(const int alignment)
|
||||||
{
|
{
|
||||||
pic_align = alignment;
|
pic_align = alignment;
|
||||||
initDimensions();
|
initVarPicture();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void CComponentsPicture::initDimensions()
|
void CComponentsPicture::initVarPicture()
|
||||||
{
|
{
|
||||||
pic_width = pic_height = 0;
|
pic_width = pic_height = 0;
|
||||||
pic_painted = false;
|
pic_painted = false;
|
||||||
@@ -756,7 +756,7 @@ void CComponentsPicture::initDimensions()
|
|||||||
|
|
||||||
void CComponentsPicture::paint(bool do_save_bg)
|
void CComponentsPicture::paint(bool do_save_bg)
|
||||||
{
|
{
|
||||||
initDimensions();
|
initVarPicture();
|
||||||
paintInit(do_save_bg);
|
paintInit(do_save_bg);
|
||||||
|
|
||||||
if (do_paint){
|
if (do_paint){
|
||||||
|
Reference in New Issue
Block a user