From 06ee0c0c1059d9bec0403469154a6147b54a222a Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Mon, 30 Jul 2012 21:02:23 +0200 Subject: [PATCH 001/224] CComponents: add sub class CComponentsContainer and clean up some members - add virtual members to set colors - remove parameters from CComponents constructor and set default values in constructor - v_fbdata becomes a protected member, because old members like v_screen_val and v_infobox_val not needed in sub classes - using sizeof() to get size of fbdata structs in paint() members, so we don't need explizit defines for struct size - new class CComponentsContainer is a basic class for CComponentsInfoBox and other similar coming sub classes - use enums for fbdata types - add function setShadowOnOff() - also add defines for plausible usage of setShadowOnOff(CC_SHADOW_ON/OFF) --- src/gui/components/cc.h | 112 ++++++---- src/gui/components/components.cpp | 357 +++++++++++++++++------------- 2 files changed, 278 insertions(+), 191 deletions(-) diff --git a/src/gui/components/cc.h b/src/gui/components/cc.h index 522146dfc..e88b0e655 100644 --- a/src/gui/components/cc.h +++ b/src/gui/components/cc.h @@ -30,81 +30,119 @@ #include #include #include +#include //required typedefs typedef struct comp_fbdata_t { + int fbdata_type; int x; int y; int dx; int dy; fb_pixel_t color; int r; - void * data; - fb_pixel_t* pixbuf; - bool is_frame; int frame_thickness; + fb_pixel_t* pixbuf; + void * data; } comp_fbdata_struct_t; +//fb data object types +typedef enum +{ + CC_FBDATA_TYPE_BGSCREEN, + CC_FBDATA_TYPE_SHADOW, + CC_FBDATA_TYPE_BOX, + CC_FBDATA_TYPE_FRAME, + CC_FBDATA_TYPE_LINE +} +FBDATA_TYPES; + +#define CC_WIDTH_MIN 16 +#define CC_HEIGHT_MIN 16 +#define CC_SHADOW_ON true +#define CC_SHADOW_OFF false +#define CC_SAVE_SCREEN_YES true +#define CC_SAVE_SCREEN_NO false + class CComponents { protected: - int x, y, height, width, sw; + int x, y, height, width, corner_type, shadow_w; CFrameBuffer * frameBuffer; - std::vector v_screen_val; - + std::vector v_fbdata; + fb_pixel_t col_body, col_shadow, col_frame; + bool firstPaint, shadow; + void paintFbItems(struct comp_fbdata_t * fbdata, const int items_count, bool do_save_bg = true); - fb_pixel_t* saveScreen(int ax, int ay, int dx, int dy); + fb_pixel_t* getScreen(int ax, int ay, int dx, int dy); + fb_pixel_t* saved_screen; void clear(); - + public: - CComponents(const int x_pos = 0, const int y_pos = 0, const int h = 0, const int w = 0); + CComponents(); virtual~CComponents(); - + virtual void setXPos(const int& xpos){x = xpos;}; virtual void setYPos(const int& ypos){y = ypos;}; virtual void setHeight(const int& h){height = h;}; virtual void setWidth(const int& w){width = w;}; - virtual void restore(); + +/// set colors: Possible color values are defined in "gui/color.h" and "gui/customcolor.h" + virtual void setColorFrame(fb_pixel_t color){col_frame = color;}; + virtual void setColorBody(fb_pixel_t color){col_body = color;}; + virtual void setColorShadow(fb_pixel_t color){col_shadow = color;}; + virtual void setColorAll(fb_pixel_t color_frame, fb_pixel_t color_body, fb_pixel_t color_shadow){col_frame = color_frame; col_body = color_body; col_shadow = color_shadow;}; + + virtual void hide(); }; +class CComponentsContainer : public CComponents +{ + protected: + int corner_rad, fr_thickness; + + public: + CComponentsContainer(); + +/// set corner types: Possible corner types are defined in CFrameBuffer (see: driver/framebuffer.h). + virtual void setCornerType(const int& type){corner_type = type;}; + virtual void setCornerRadius(const int& radius){corner_rad = radius;}; + + virtual void setFrameThickness(const int& thickness){fr_thickness = thickness;}; + virtual void setShadowOnOff(bool has_shadow){shadow = has_shadow;}; + + virtual void paint(bool do_save_bg = CC_SAVE_SCREEN_YES); + virtual void hide(bool no_restore = false); + virtual void paintBackground(); +}; + + +#define INFO_BOX_Y_OFFSET 2 +class CComponentsInfoBox : public CComponentsContainer +{ + public: + CComponentsInfoBox( const int x_pos, const int y_pos, const int w, const int h, bool has_shadow = CC_SHADOW_ON, + fb_pixel_t color_frame = COL_MENUCONTENT_PLUS_6, fb_pixel_t color_body = COL_MENUCONTENTDARK_PLUS_0,fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0); +}; + + class CComponentsDetailLine : public CComponents { private: int thickness, y_down, h_mark_top, h_mark_down; - fb_pixel_t col_line, col_shadow; - + public: CComponentsDetailLine( const int x_pos,const int y_pos_top, const int y_pos_down, const int h_mark_up =16 , const int h_mark_down = 16, fb_pixel_t color_line = COL_MENUCONTENT_PLUS_6, fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0); ~CComponentsDetailLine(); - - void paint(bool do_save_bg = false); - void hide(); - void setColor(fb_pixel_t color_line, fb_pixel_t color_shadow){col_line = color_line; col_shadow = color_shadow;}; + + void paint(bool do_save_bg = CC_SAVE_SCREEN_YES); + void paintBackground(); + void setColors(fb_pixel_t color_line, fb_pixel_t color_shadow){col_body = color_line; col_shadow = color_shadow;}; void setYPosDown(const int& y_pos_down){y_down = y_pos_down;}; void setHMarkDown(const int& h_mark_down_){h_mark_down = h_mark_down_;}; }; -#define INFO_BOX_Y_OFFSET 2 -class CComponentsInfoBox : public CComponents -{ - private: - int rad,fr_thickness; - bool shadow; - fb_pixel_t col_frame, col_body, col_shadow; - bool firstPaint; - std::vector v_infobox_val; - - public: - CComponentsInfoBox( const int x_pos, const int y_pos, const int w, const int h, bool has_shadow = true, - fb_pixel_t color_frame = COL_MENUCONTENT_PLUS_6, fb_pixel_t color_body = COL_MENUCONTENTDARK_PLUS_0,fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0); - - void paint(bool do_save_bg = false, bool fullPaint = false); - void hide(); - void restore(bool clear_ = true); - void setColor(fb_pixel_t color_frame, fb_pixel_t color_body, fb_pixel_t color_shadow){col_frame = color_frame; col_body = color_body; col_shadow = color_shadow;}; -}; - #endif diff --git a/src/gui/components/components.cpp b/src/gui/components/components.cpp index 63893826f..3529664a0 100644 --- a/src/gui/components/components.cpp +++ b/src/gui/components/components.cpp @@ -33,19 +33,26 @@ #include "cc.h" +using namespace std; - - -//basic class CComponents -CComponents::CComponents(const int x_pos, const int y_pos, const int h, const int w) +//abstract basic class CComponents +CComponents::CComponents() { - x = x_pos; - y = y_pos; - height = h; - width = w; - sw = 0; //shadow width + //basic CComponents + x = 0; + y = 0; + height = CC_HEIGHT_MIN; + width = CC_WIDTH_MIN; + col_body = COL_MENUCONTENT; + col_shadow = COL_MENUCONTENTDARK_PLUS_0; + col_frame = COL_MENUCONTENT_PLUS_6; + corner_type = CORNER_ALL; + shadow = CC_SHADOW_OFF; + shadow_w = SHADOW_OFFSET; + firstPaint = true; frameBuffer = CFrameBuffer::getInstance(); - v_screen_val.clear(); + v_fbdata.clear(); + saved_screen = NULL; } CComponents::~CComponents() @@ -56,64 +63,189 @@ CComponents::~CComponents() //paint framebuffer stuff and fill buffer void CComponents::paintFbItems(struct comp_fbdata_t * fbdata, const int items_count, bool do_save_bg) { - int i; - for(i=0; i< items_count ;i++){ - if (do_save_bg) - fbdata[i].pixbuf = saveScreen(fbdata[i].x, fbdata[i].y, fbdata[i].dx, fbdata[i].dy); - v_screen_val.push_back(fbdata[i]); - } - - for(i=0; i< items_count ;i++){ - if (fbdata[i].is_frame) - frameBuffer->paintBoxFrame(fbdata[i].x, fbdata[i].y, fbdata[i].dx, fbdata[i].dy, fbdata[i].frame_thickness, fbdata[i].color, fbdata[i].r); - else - frameBuffer->paintBoxRel(fbdata[i].x, fbdata[i].y, fbdata[i].dx, fbdata[i].dy, fbdata[i].color, fbdata[i].r); + for(int i=0; i< items_count ;i++){ + int fbtype = fbdata[i].fbdata_type; + + if (firstPaint){ + + if (do_save_bg && fbtype == CC_FBDATA_TYPE_LINE) + fbdata[i].pixbuf = saved_screen = getScreen(fbdata[i].x, fbdata[i].y, fbdata[i].dx, fbdata[i].dy); + v_fbdata.push_back(fbdata[i]); + + //ensure painting of all line fb items with saved screens + if (fbtype == CC_FBDATA_TYPE_LINE) + firstPaint = true; + else + firstPaint = false; + } + if (fbtype != CC_FBDATA_TYPE_BGSCREEN){ + if (fbtype == CC_FBDATA_TYPE_FRAME && fbdata[i].frame_thickness > 0) + frameBuffer->paintBoxFrame(fbdata[i].x, fbdata[i].y, fbdata[i].dx, fbdata[i].dy, fbdata[i].frame_thickness, fbdata[i].color, fbdata[i].r); + else + frameBuffer->paintBoxRel(fbdata[i].x, fbdata[i].y, fbdata[i].dx, fbdata[i].dy, fbdata[i].color, fbdata[i].r, corner_type); + } } } //screen area save -inline fb_pixel_t* CComponents::saveScreen(int ax, int ay, int dx, int dy) +inline fb_pixel_t* CComponents::getScreen(int ax, int ay, int dx, int dy) { fb_pixel_t* pixbuf = new fb_pixel_t[dx * dy]; frameBuffer->SaveScreen(ax, ay, dx, dy, pixbuf); return pixbuf; } -//restore screen -inline void CComponents::restore() +//restore screen from buffer +inline void CComponents::hide() { - for(size_t i =0; i< v_screen_val.size() ;i++) { - if (v_screen_val[i].pixbuf != NULL){ - frameBuffer->RestoreScreen(v_screen_val[i].x, v_screen_val[i].y, v_screen_val[i].dx, v_screen_val[i].dy, v_screen_val[i].pixbuf); - delete[] v_screen_val[i].pixbuf; + for(size_t i =0; i< v_fbdata.size() ;i++) { + if (v_fbdata[i].pixbuf != NULL){ + frameBuffer->RestoreScreen(v_fbdata[i].x, v_fbdata[i].y, v_fbdata[i].dx, v_fbdata[i].dy, v_fbdata[i].pixbuf); + delete[] v_fbdata[i].pixbuf; + v_fbdata[i].pixbuf = NULL; } } - v_screen_val.clear(); + v_fbdata.clear(); } //clean old screen buffer inline void CComponents::clear() { - for(size_t i =0; i< v_screen_val.size() ;i++) - if (v_screen_val[i].pixbuf != NULL) - delete[] v_screen_val[i].pixbuf; - v_screen_val.clear(); + for(size_t i =0; i< v_fbdata.size() ;i++) + if (v_fbdata[i].pixbuf != NULL) + delete[] v_fbdata[i].pixbuf; + v_fbdata.clear(); +} + + +//------------------------------------------------------------------------------------------------------- +//abstract sub class CComponentsContainer from CComponents +CComponentsContainer::CComponentsContainer() +{ + //CComponentsContainer + corner_rad = 0; + fr_thickness = 2; +} + +// y +// x+------f-r-a-m-e-------+ +// | | +// height body | +// | | +// +--------width---------+ + + +void CComponentsContainer::paint(bool do_save_bg) +{ + int items_cnt = 0; + clear(); + + int sw = shadow ? shadow_w : 0; + int th = fr_thickness; + + comp_fbdata_t fbdata[] = + { + {CC_FBDATA_TYPE_BGSCREEN, x, y, width+sw, height+sw, 0, 0, 0, NULL, NULL}, + {CC_FBDATA_TYPE_SHADOW, x+sw, y+sw, width, height, col_shadow, corner_rad, 0, NULL, NULL}, + {CC_FBDATA_TYPE_FRAME, x, y, width, height, col_frame, corner_rad, th, NULL, NULL}, + {CC_FBDATA_TYPE_BOX, x+th, y+th, width-2*th, height-2*th, col_body, corner_rad-th, 0, NULL, NULL}, + }; + + items_cnt = sizeof(fbdata) / sizeof(fbdata[0]); + + if (firstPaint && do_save_bg) { + for(int i=0; iRestoreScreen(v_fbdata[i].x, v_fbdata[i].y, v_fbdata[i].dx, v_fbdata[i].dy, v_fbdata[i].pixbuf); + delete[] v_fbdata[i].pixbuf; + } + v_fbdata.clear(); + firstPaint = true; +} + +//hide rendered objects +void CComponentsContainer::paintBackground() +{ + //save current colors + fb_pixel_t c_tmp1, c_tmp2, c_tmp3; + c_tmp1 = col_body; + c_tmp2 = col_shadow; + c_tmp3 = col_frame; + + //set background color + col_body = col_frame = col_shadow = COL_BACKGROUND; + + //paint with background and restore last used colors + paint(CC_SAVE_SCREEN_NO); + col_body = c_tmp1; + col_shadow = c_tmp2; + col_frame = c_tmp3; + firstPaint = true; } //------------------------------------------------------------------------------------------------------- -//sub class CComponentsDetailLine +//sub class CComponentsInfoBox from CComponentsContainer +CComponentsInfoBox::CComponentsInfoBox(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 + x = x_pos; + y = y_pos; + width = w; + height = h; + shadow = has_shadow; + shadow_w = SHADOW_OFFSET; + col_frame = color_frame; + col_body = color_body; + col_shadow = color_shadow; + firstPaint = true; + v_fbdata.clear(); + + //CComponentsContainer + corner_rad = RADIUS_LARGE; + fr_thickness = 2; +} + + +//------------------------------------------------------------------------------------------------------- +//sub class CComponentsDetailLine from CComponents 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) { + //CComponents x = x_pos; - width = 16; - thickness = 4; - sw = 1; //shadow width y = y_pos_top; + width = CC_WIDTH_MIN; + col_shadow = color_shadow; + col_body = color_line; +// col_frame = COL_BACKGROUND; // not used in this class +// shadow = CC_SHADOW_OFF; // not used in this class + shadow_w = 1; + firstPaint = true; + v_fbdata.clear(); + + //CComponentsDetailLine y_down = y_pos_down; h_mark_top = h_mark_top_; h_mark_down = h_mark_down_; - col_line = color_line; - col_shadow = color_shadow; + thickness = 4; } CComponentsDetailLine::~CComponentsDetailLine() @@ -136,148 +268,65 @@ CComponentsDetailLine::~CComponentsDetailLine() // y_down -#define DLINE_ITEMS_COUNT 12 -//paint details line with current parameters +//paint details line with current parameters void CComponentsDetailLine::paint(bool do_save_bg) { + int items_cnt = 0; + clear(); - + int y_mark_top = y-h_mark_top/2+thickness/2; int y_mark_down = y_down-h_mark_down/2+thickness/2; + + int sw = shadow_w; - comp_fbdata_t fbdata[DLINE_ITEMS_COUNT] = + comp_fbdata_t fbdata[] = { /* vertical item mark | */ - {x+width-thickness-sw, y_mark_top, thickness, h_mark_top, col_line, 0, NULL, NULL, false, 0}, - {x+width-sw, y_mark_top, sw, h_mark_top, col_shadow, 0, NULL, NULL, false, 0}, - {x+width-thickness-sw, y_mark_top+h_mark_top, thickness+sw, sw , col_shadow, 0, NULL, NULL, false, 0}, + {CC_FBDATA_TYPE_LINE, x+width-thickness-sw, y_mark_top, thickness, h_mark_top, col_body, 0, 0, NULL, NULL}, + {CC_FBDATA_TYPE_LINE, x+width-sw, y_mark_top, sw, h_mark_top, col_shadow, 0, 0, NULL, NULL}, + {CC_FBDATA_TYPE_LINE, x+width-thickness-sw, y_mark_top+h_mark_top, thickness+sw, sw , col_shadow, 0, 0, NULL, NULL}, /* horizontal item line - */ - {x, y, width-thickness-sw, thickness, col_line, 0, NULL, NULL, false, 0}, - {x+thickness, y+thickness, width-2*thickness-sw, sw, col_shadow, 0, NULL, NULL, false, 0}, + {CC_FBDATA_TYPE_LINE, x, y, width-thickness-sw, thickness, col_body, 0, 0, NULL, NULL}, + {CC_FBDATA_TYPE_LINE, x+thickness, y+thickness, width-2*thickness-sw, sw, col_shadow, 0, 0, NULL, NULL}, /* vertical connect line [ */ - {x, y+thickness, thickness, y_down-y-thickness, col_line, 0, NULL, NULL, false, 0}, - {x+thickness, y+thickness+sw, sw, y_down-y-thickness-sw, col_shadow, 0, NULL, NULL, false, 0}, + {CC_FBDATA_TYPE_LINE, x, y+thickness, thickness, y_down-y-thickness, col_body, 0, 0, NULL, NULL}, + {CC_FBDATA_TYPE_LINE, x+thickness, y+thickness+sw, sw, y_down-y-thickness-sw, col_shadow, 0, 0, NULL, NULL}, /* horizontal info line - */ - {x, y_down, width-thickness-sw, thickness, col_line, 0, NULL, NULL, false, 0}, - {x, y_down+thickness, width-thickness-sw, sw, col_shadow, 0, NULL, NULL, false, 0}, + {CC_FBDATA_TYPE_LINE, x, y_down, width-thickness-sw, thickness, col_body, 0, 0, NULL, NULL}, + {CC_FBDATA_TYPE_LINE, x, y_down+thickness, width-thickness-sw, sw, col_shadow, 0, 0, NULL, NULL}, /* vertical info mark | */ - {x+width-thickness-sw, y_mark_down, thickness, h_mark_down, col_line, 0, NULL, NULL, false, 0}, - {x+width-sw, y_mark_down, sw, h_mark_down, col_shadow, 0, NULL, NULL, false, 0}, - {x+width-thickness-sw, y_mark_down+h_mark_down,thickness+sw, sw, col_shadow, 0, NULL, NULL, false, 0}, + {CC_FBDATA_TYPE_LINE, x+width-thickness-sw, y_mark_down, thickness, h_mark_down, col_body, 0, 0, NULL, NULL}, + {CC_FBDATA_TYPE_LINE, x+width-sw, y_mark_down, sw, h_mark_down, col_shadow, 0, 0, NULL, NULL}, + {CC_FBDATA_TYPE_LINE, x+width-thickness-sw, y_mark_down+h_mark_down,thickness+sw, sw, col_shadow, 0, 0, NULL, NULL}, }; - paintFbItems(fbdata, DLINE_ITEMS_COUNT, do_save_bg); + items_cnt = sizeof(fbdata) / sizeof(fbdata[0]); + + paintFbItems(fbdata, items_cnt, do_save_bg); } -//remove painted lines from screen -void CComponentsDetailLine::hide() +//remove painted fb items from screen +void CComponentsDetailLine::paintBackground() { - //caching current colors + //save current colors fb_pixel_t c_tmp1, c_tmp2; - c_tmp1 = col_line; - c_tmp2 = col_shadow; - - //set background color - col_line = col_shadow = COL_BACKGROUND; - - //paint with background and restore, set last used colors - paint(false); - col_line = c_tmp1; - col_shadow = c_tmp2; -} - - -//------------------------------------------------------------------------------------------------------- -//sub class CComponentsInfoBox -CComponentsInfoBox::CComponentsInfoBox(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) -{ - x = x_pos; - y = y_pos; - width = w; - height = h; - rad = 0; - shadow = has_shadow; - col_frame = color_frame; - col_body = color_body; - col_shadow = color_shadow; - fr_thickness = 2; - firstPaint = true; - v_infobox_val.clear(); -} - -#define INFOBOX_ITEMS_COUNT 3 -void CComponentsInfoBox::paint(bool do_save_bg, bool fullPaint) -{ - clear(); - rad = RADIUS_LARGE; - - comp_fbdata_t fbdata[INFOBOX_ITEMS_COUNT] = - { - {x+SHADOW_OFFSET, y+SHADOW_OFFSET, width, height, col_shadow, rad, NULL, NULL, false, 0}, - {x, y, width, height, col_frame, rad, NULL, NULL, false, 0}, - {x+fr_thickness, y+fr_thickness, width-2*fr_thickness, height-2*fr_thickness, col_body, rad, NULL, NULL, false, 0}, - }; - - int start = (shadow) ? 0 : 1; - if (firstPaint) { - if (do_save_bg) { - v_infobox_val.clear(); - for(int i = start; i < INFOBOX_ITEMS_COUNT; i++) { - fbdata[i].pixbuf = saveScreen(fbdata[i].x, fbdata[i].y, fbdata[i].dx, fbdata[i].dy); - v_infobox_val.push_back(fbdata[i]); - fbdata[i].pixbuf = NULL; - } - } - // paint infobox full - paintFbItems((comp_fbdata_t*)&fbdata[start], INFOBOX_ITEMS_COUNT - start, false); - firstPaint = false; - } - else { - if (fullPaint) - // paint infobox full - paintFbItems((comp_fbdata_t*)&fbdata[start], INFOBOX_ITEMS_COUNT - start, false); - else - // paint body only - paintFbItems((comp_fbdata_t*)&fbdata[INFOBOX_ITEMS_COUNT - 1], 1, false); - } -} - -//restore infobox -void CComponentsInfoBox::restore(bool clear_) -{ - if (!v_infobox_val.empty()) { - for(size_t i =0; i< v_infobox_val.size() ;i++) { - if (v_infobox_val[i].pixbuf != NULL) { - frameBuffer->RestoreScreen(v_infobox_val[i].x, v_infobox_val[i].y, v_infobox_val[i].dx, v_infobox_val[i].dy, v_infobox_val[i].pixbuf); - if (clear_) - delete[] v_infobox_val[i].pixbuf; - } - } - if (clear_) { - v_infobox_val.clear(); - firstPaint = true; - } - } -} - -void CComponentsInfoBox::hide() -{ - //caching current colors - fb_pixel_t c_tmp1, c_tmp2, c_tmp3; c_tmp1 = col_body; c_tmp2 = col_shadow; - c_tmp3 = col_frame; //set background color - col_body = col_frame = col_shadow = COL_BACKGROUND; + col_body = col_shadow = COL_BACKGROUND; //paint with background and restore, set last used colors - paint(false, true); + paint(CC_SAVE_SCREEN_NO); col_body = c_tmp1; col_shadow = c_tmp2; - col_frame = c_tmp3; + firstPaint = true; } + + + From ec2c78537c1a2f8bb3825e41c962e742ffec9192 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Wed, 1 Aug 2012 21:44:04 +0200 Subject: [PATCH 002/224] *menu.cpp: refresh radius settings Changed corner settings in osd setup have no effect in unchanged menu widget instances. --- src/gui/widget/menue.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/gui/widget/menue.cpp b/src/gui/widget/menue.cpp index 66b252d8b..4f6225234 100644 --- a/src/gui/widget/menue.cpp +++ b/src/gui/widget/menue.cpp @@ -1145,6 +1145,7 @@ void CMenuWidget::paintHint(int pos) info_box->setYPos(ypos2); info_box->setWidth(iwidth); info_box->setColor(COL_MENUCONTENT_PLUS_6, COL_MENUCONTENTDARK_PLUS_0, COL_MENUCONTENTDARK_PLUS_0); + info_box->setCornerRadius(RADIUS_LARGE); } /* force full paint - menu-over i.e. option chooser with pulldown can overwrite */ info_box->paint(savescreen, true); From 6e58bb595e880f25f9e3f07559d86c3679d00b1e Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Wed, 1 Aug 2012 22:13:07 +0200 Subject: [PATCH 003/224] CBEChannelWidget: remove redundant hide of infobox Infobox uses it's own hide(). --- src/gui/bedit/bouqueteditor_channels.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/bedit/bouqueteditor_channels.cpp b/src/gui/bedit/bouqueteditor_channels.cpp index e951bbed3..23a6f9ca3 100644 --- a/src/gui/bedit/bouqueteditor_channels.cpp +++ b/src/gui/bedit/bouqueteditor_channels.cpp @@ -236,7 +236,7 @@ void CBEChannelWidget::clearItem2DetailsLine() void CBEChannelWidget::hide() { - frameBuffer->paintBackgroundBoxRel(x,y, width,height+footerHeight+info_height); + frameBuffer->paintBackgroundBoxRel(x,y, width,height+footerHeight); clearItem2DetailsLine (); } From 360feb8db9b015a53e33c29c9788c96462e291fa Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Fri, 3 Aug 2012 23:03:34 +0200 Subject: [PATCH 004/224] CAudioPlayerGui: adapt to current CComponentsInfoBox changes --- src/gui/audioplayer.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gui/audioplayer.cpp b/src/gui/audioplayer.cpp index 12644aa42..ebe08b6aa 100644 --- a/src/gui/audioplayer.cpp +++ b/src/gui/audioplayer.cpp @@ -1930,9 +1930,9 @@ void CAudioPlayerGui::paintItemID3DetailsLine (int pos) // paint id3 infobox if (ibox == NULL) - ibox = new CComponentsInfoBox(m_x, ypos2, m_width, m_info_height, false); + ibox = new CComponentsInfoBox(m_x, ypos2, m_width, m_info_height, CC_SHADOW_OFF); ibox->setYPos(ypos2); - ibox->paint(false, true); + ibox->paint(false); g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->RenderString(m_x + 10, ypos2 + 2 + 1*m_fheight, m_width- 80, m_playlist[m_selected].MetaData.title, COL_MENUCONTENTDARK, 0, true); // UTF-8 From daa3ce227682ef864198d4537e99fcb4e0efda4d Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Fri, 3 Aug 2012 23:04:27 +0200 Subject: [PATCH 005/224] Bedit: adapt to current CComponentsInfoBox changes --- src/gui/bedit/bouqueteditor_channels.cpp | 4 ++-- src/gui/bedit/bouqueteditor_chanselect.cpp | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/gui/bedit/bouqueteditor_channels.cpp b/src/gui/bedit/bouqueteditor_channels.cpp index 23a6f9ca3..125704af5 100644 --- a/src/gui/bedit/bouqueteditor_channels.cpp +++ b/src/gui/bedit/bouqueteditor_channels.cpp @@ -229,9 +229,9 @@ void CBEChannelWidget::paintItem2DetailsLine (int pos, int /*ch_index*/) void CBEChannelWidget::clearItem2DetailsLine() { if (dline != NULL) - dline->hide(); + dline->paintBackground(); //kill details line if (ibox != NULL) - ibox->hide(); + ibox->paintBackground(); //kill info box } void CBEChannelWidget::hide() diff --git a/src/gui/bedit/bouqueteditor_chanselect.cpp b/src/gui/bedit/bouqueteditor_chanselect.cpp index 7abb90115..1ba48f5dd 100644 --- a/src/gui/bedit/bouqueteditor_chanselect.cpp +++ b/src/gui/bedit/bouqueteditor_chanselect.cpp @@ -80,11 +80,11 @@ CBEChannelSelectWidget::~CBEChannelSelectWidget() { // clear details line if (dline != NULL) - dline->hide(); + dline->paintBackground(); delete dline; // clear infobox if (ibox != NULL) - ibox->hide(); + ibox->paintBackground(); delete ibox; } @@ -237,7 +237,7 @@ void CBEChannelSelectWidget::paintItem2DetailsLine (int pos, int /*ch_index*/) // clear details line if (dline != NULL) - dline->hide(); + dline->paintBackground(); // clear infobox if (ibox != NULL) From 03d276d90a227b8a171195755c00b88bc2a69334 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Fri, 3 Aug 2012 23:05:24 +0200 Subject: [PATCH 006/224] CMenuWidget: adapt to current CComponentsInfoBox changes --- src/gui/widget/menue.cpp | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/src/gui/widget/menue.cpp b/src/gui/widget/menue.cpp index 4f6225234..ee2e4375c 100644 --- a/src/gui/widget/menue.cpp +++ b/src/gui/widget/menue.cpp @@ -1079,7 +1079,7 @@ void CMenuWidget::paintHint(int pos) int xpos = x - ConnectLineBox_Width; int ypos2 = y + height + rad + SHADOW_OFFSET + INFO_BOX_Y_OFFSET; int iwidth = width+sb_width; - +#if 0 if (hint_painted) { /* clear detailsline line */ // TODO CComponents::hide with param restore ? or auto (if it have saved screens) ? @@ -1099,6 +1099,18 @@ void CMenuWidget::paintHint(int pos) } } hint_painted = false; +#endif + if (hint_painted) { + /* clear detailsline line */ + if (details_line) + details_line->hide(); + /* clear info box */ + if (info_box) + info_box->hide(hint_painted); + hint_painted = false; + } + else if (info_box){ + info_box->hide(hint_painted); } if (pos < 0) return; @@ -1107,12 +1119,18 @@ void CMenuWidget::paintHint(int pos) //printf("paintHint: icon %s text %s\n", item->hintIcon.c_str(), g_Locale->getText(item->hint)); if (item->hintIcon.empty() && item->hint == NONEXISTANT_LOCALE) { +#if 0 if (info_box != NULL) { if (savescreen) +#endif + if (info_box) + info_box->hide(); +#if 0 info_box->restore(); else info_box->hide(); } +#endif return; } From 485dca43e2e25b54ea8507344b12cd8b62692c9b Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Fri, 3 Aug 2012 23:33:00 +0200 Subject: [PATCH 007/224] CComponents: add more basic members and sub classes - change default colors for info box - add member methode to synchronize system colors - add class CComponentsShapeCircle - add class CComponentsShapeSquare - add sub class CComponentsPIP --- src/gui/components/cc.h | 101 +++++++++--- src/gui/components/components.cpp | 254 +++++++++++++++++++++++++----- src/gui/widget/menue.cpp | 9 +- 3 files changed, 301 insertions(+), 63 deletions(-) diff --git a/src/gui/components/cc.h b/src/gui/components/cc.h index e88b0e655..0b9baf7e8 100644 --- a/src/gui/components/cc.h +++ b/src/gui/components/cc.h @@ -54,10 +54,31 @@ typedef enum CC_FBDATA_TYPE_SHADOW, CC_FBDATA_TYPE_BOX, CC_FBDATA_TYPE_FRAME, - CC_FBDATA_TYPE_LINE + CC_FBDATA_TYPE_LINE, + CC_FBDATA_TYPE_BACKGROUND, + + CC_FBDATA_TYPES } FBDATA_TYPES; +typedef struct comp_screen_data_t +{ + int x; + int y; + int dx; + int dy; + fb_pixel_t* pixbuf; +} comp_screen_data_struct_t; + +typedef enum +{ + CC_BGMODE_STANDARD, + CC_BGMODE_PERMANENT, + + CC_BGMODE_TYPES +} +BGMODE_TYPES; + #define CC_WIDTH_MIN 16 #define CC_HEIGHT_MIN 16 #define CC_SHADOW_ON true @@ -65,6 +86,7 @@ FBDATA_TYPES; #define CC_SAVE_SCREEN_YES true #define CC_SAVE_SCREEN_NO false + class CComponents { protected: @@ -73,26 +95,34 @@ class CComponents std::vector v_fbdata; fb_pixel_t col_body, col_shadow, col_frame; bool firstPaint, shadow; + BGMODE_TYPES bgMode; 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* saved_screen; - void clear(); + comp_screen_data_t saved_screen; + void clear(); public: CComponents(); virtual~CComponents(); - virtual void setXPos(const int& xpos){x = xpos;}; - virtual void setYPos(const int& ypos){y = ypos;}; - virtual void setHeight(const int& h){height = h;}; - virtual void setWidth(const int& w){width = w;}; + inline virtual void setXPos(const int& xpos){x = xpos;}; + inline virtual void setYPos(const int& ypos){y = ypos;}; + inline virtual void setHeight(const int& h){height = h;}; + inline virtual void setWidth(const int& w){width = w;}; + inline virtual void setDimensionsAll(const int& xpos, const int& ypos, const int& w, const int& h){x = xpos; y = ypos; width = w; height = h;}; + + inline virtual int getXPos(){return x;}; + inline virtual int getYPos(){return y;}; + inline virtual int getHeight(){return height;}; + inline virtual int getWidth(){return width;}; /// set colors: Possible color values are defined in "gui/color.h" and "gui/customcolor.h" - virtual void setColorFrame(fb_pixel_t color){col_frame = color;}; - virtual void setColorBody(fb_pixel_t color){col_body = color;}; - virtual void setColorShadow(fb_pixel_t color){col_shadow = color;}; - virtual void setColorAll(fb_pixel_t color_frame, fb_pixel_t color_body, fb_pixel_t color_shadow){col_frame = color_frame; col_body = color_body; col_shadow = color_shadow;}; + inline virtual void setColorFrame(fb_pixel_t color){col_frame = color;}; + inline virtual void setColorBody(fb_pixel_t color){col_body = color;}; + inline virtual void setColorShadow(fb_pixel_t color){col_shadow = color;}; + inline virtual void setColorAll(fb_pixel_t color_frame, fb_pixel_t color_body, fb_pixel_t color_shadow){col_frame = color_frame; col_body = color_body; col_shadow = color_shadow;}; + inline virtual void setBgMode(BGMODE_TYPES mode) {bgMode = mode;}; virtual void hide(); }; @@ -101,20 +131,24 @@ class CComponentsContainer : public CComponents { protected: int corner_rad, fr_thickness; + void hideContainer(bool no_restore = false); + void paintInit(bool do_save_bg); public: CComponentsContainer(); /// set corner types: Possible corner types are defined in CFrameBuffer (see: driver/framebuffer.h). - virtual void setCornerType(const int& type){corner_type = type;}; - virtual void setCornerRadius(const int& radius){corner_rad = radius;}; + inline virtual void setCornerType(const int& type){corner_type = type;}; + inline virtual void setCornerRadius(const int& radius){corner_rad = radius;}; - virtual void setFrameThickness(const int& thickness){fr_thickness = thickness;}; - virtual void setShadowOnOff(bool has_shadow){shadow = has_shadow;}; + inline virtual void setFrameThickness(const int& thickness){fr_thickness = thickness;}; + inline virtual void setShadowOnOff(bool has_shadow){shadow = has_shadow;}; virtual void paint(bool do_save_bg = CC_SAVE_SCREEN_YES); virtual void hide(bool no_restore = false); - virtual void paintBackground(); + virtual void kill(); + + virtual void syncSysColors(); }; @@ -123,9 +157,39 @@ class CComponentsInfoBox : public CComponentsContainer { public: CComponentsInfoBox( const int x_pos, const int y_pos, const int w, const int h, bool has_shadow = CC_SHADOW_ON, - fb_pixel_t color_frame = COL_MENUCONTENT_PLUS_6, fb_pixel_t color_body = COL_MENUCONTENTDARK_PLUS_0,fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0); + fb_pixel_t color_frame = COL_MENUCONTENT_PLUS_6, fb_pixel_t color_body = COL_MENUCONTENT_PLUS_0, fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0); }; +class CComponentsShapeCircle : public CComponentsContainer +{ + private: + int d; + public: + CComponentsShapeCircle( const int x_pos, const int y_pos, const int diam, bool has_shadow = CC_SHADOW_ON, + fb_pixel_t color_frame = COL_MENUCONTENT_PLUS_6, fb_pixel_t color_body = COL_MENUCONTENT_PLUS_0, fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0); + + void setDiam(const int& diam){d=width=height=diam, corner_rad=d/2;}; + int getDiam(){return d;}; +}; + +class CComponentsShapeSquare : public CComponentsContainer +{ + public: + CComponentsShapeSquare( const int x_pos, const int y_pos, const int w, const int h, bool has_shadow = CC_SHADOW_ON, + fb_pixel_t color_frame = COL_MENUCONTENT_PLUS_6, fb_pixel_t color_body = COL_MENUCONTENT_PLUS_0, fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0); +}; + +class CComponentsPIP : public CComponentsContainer +{ + private: + int screen_w, screen_h; + public: + CComponentsPIP( const int x_pos, const int y_pos, const int percent, bool has_shadow = CC_SHADOW_OFF); + ~CComponentsPIP(); + + void paint(bool do_save_bg = CC_SAVE_SCREEN_YES); + void hide(bool no_restore = false); +}; class CComponentsDetailLine : public CComponents { @@ -139,8 +203,9 @@ class CComponentsDetailLine : public CComponents ~CComponentsDetailLine(); void paint(bool do_save_bg = CC_SAVE_SCREEN_YES); - void paintBackground(); + void kill(); void setColors(fb_pixel_t color_line, fb_pixel_t color_shadow){col_body = color_line; col_shadow = color_shadow;}; + void syncSysColors(); void setYPosDown(const int& y_pos_down){y_down = y_pos_down;}; void setHMarkDown(const int& h_mark_down_){h_mark_down = h_mark_down_;}; }; diff --git a/src/gui/components/components.cpp b/src/gui/components/components.cpp index 3529664a0..a93dd1e6b 100644 --- a/src/gui/components/components.cpp +++ b/src/gui/components/components.cpp @@ -32,6 +32,9 @@ #include #include "cc.h" +#include + +extern cVideo * videoDecoder; using namespace std; @@ -39,37 +42,65 @@ using namespace std; CComponents::CComponents() { //basic CComponents - x = 0; - y = 0; - height = CC_HEIGHT_MIN; - width = CC_WIDTH_MIN; - col_body = COL_MENUCONTENT; - col_shadow = COL_MENUCONTENTDARK_PLUS_0; - col_frame = COL_MENUCONTENT_PLUS_6; - corner_type = CORNER_ALL; - shadow = CC_SHADOW_OFF; - shadow_w = SHADOW_OFFSET; - firstPaint = true; - frameBuffer = CFrameBuffer::getInstance(); + x = saved_screen.x = 0; + y = saved_screen.y = 0; + height = saved_screen.dy = CC_HEIGHT_MIN; + width = saved_screen.dx = CC_WIDTH_MIN; + + col_body = COL_MENUCONTENT_PLUS_0; + col_shadow = COL_MENUCONTENTDARK_PLUS_0; + col_frame = COL_MENUCONTENT_PLUS_6; + corner_type = CORNER_ALL; + shadow = CC_SHADOW_OFF; + shadow_w = SHADOW_OFFSET; + + firstPaint = true; + frameBuffer = CFrameBuffer::getInstance(); v_fbdata.clear(); - saved_screen = NULL; + bgMode = CC_BGMODE_STANDARD; + saved_screen.pixbuf = NULL; } CComponents::~CComponents() { + hide(); + if (saved_screen.pixbuf) + delete[] saved_screen.pixbuf; clear(); } //paint framebuffer stuff and fill buffer void CComponents::paintFbItems(struct comp_fbdata_t * fbdata, const int items_count, bool do_save_bg) { + if (firstPaint && do_save_bg) { + for(int i=0; i 0) frameBuffer->paintBoxFrame(fbdata[i].x, fbdata[i].y, fbdata[i].dx, fbdata[i].dy, fbdata[i].frame_thickness, fbdata[i].color, fbdata[i].r); + else if (fbtype == CC_FBDATA_TYPE_BACKGROUND) + frameBuffer->paintBackgroundBoxRel(x, y, fbdata[i].dx, fbdata[i].dy); else frameBuffer->paintBoxRel(fbdata[i].x, fbdata[i].y, fbdata[i].dx, fbdata[i].dy, fbdata[i].color, fbdata[i].r, corner_type); } @@ -135,10 +168,9 @@ CComponentsContainer::CComponentsContainer() // +--------width---------+ -void CComponentsContainer::paint(bool do_save_bg) +void CComponentsContainer::paintInit(bool do_save_bg) { - int items_cnt = 0; - clear(); + clear(); int sw = shadow ? shadow_w : 0; int th = fr_thickness; @@ -151,39 +183,53 @@ void CComponentsContainer::paint(bool do_save_bg) {CC_FBDATA_TYPE_BOX, x+th, y+th, width-2*th, height-2*th, col_body, corner_rad-th, 0, NULL, NULL}, }; - items_cnt = sizeof(fbdata) / sizeof(fbdata[0]); - - if (firstPaint && do_save_bg) { - for(int i=0; iRestoreScreen(v_fbdata[i].x, v_fbdata[i].y, v_fbdata[i].dx, v_fbdata[i].dy, v_fbdata[i].pixbuf); - delete[] v_fbdata[i].pixbuf; + if (bgMode == CC_BGMODE_PERMANENT) { + if (saved_screen.pixbuf) { + frameBuffer->RestoreScreen(saved_screen.x, saved_screen.y, saved_screen.dx, saved_screen.dy, saved_screen.pixbuf); + if (no_restore) { + delete[] saved_screen.pixbuf; + saved_screen.pixbuf = NULL; + firstPaint = true; + } + } + } + else { + if (no_restore) + return; + + for(size_t i =0; i< v_fbdata.size() ;i++) { + if (v_fbdata[i].pixbuf != NULL && v_fbdata[i].fbdata_type == CC_FBDATA_TYPE_BGSCREEN) + frameBuffer->RestoreScreen(v_fbdata[i].x, v_fbdata[i].y, v_fbdata[i].dx, v_fbdata[i].dy, v_fbdata[i].pixbuf); + delete[] v_fbdata[i].pixbuf; + } + v_fbdata.clear(); + firstPaint = true; } - v_fbdata.clear(); - firstPaint = true; } +void CComponentsContainer::hide(bool no_restore) +{ + hideContainer(no_restore); +} + + //hide rendered objects -void CComponentsContainer::paintBackground() +void CComponentsContainer::kill() { //save current colors fb_pixel_t c_tmp1, c_tmp2, c_tmp3; @@ -202,6 +248,16 @@ void CComponentsContainer::paintBackground() firstPaint = true; } +//synchronize colors for forms +//This is usefull if the system colors are changed during runtime +//so you can ensure correct applied system colors in relevant objects with unchanged instances. +void CComponentsContainer::syncSysColors() +{ + col_body = COL_MENUCONTENT_PLUS_0; + col_shadow = COL_MENUCONTENTDARK_PLUS_0; + col_frame = COL_MENUCONTENT_PLUS_6; +} + //------------------------------------------------------------------------------------------------------- //sub class CComponentsInfoBox from CComponentsContainer CComponentsInfoBox::CComponentsInfoBox(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) @@ -218,12 +274,74 @@ CComponentsInfoBox::CComponentsInfoBox(const int x_pos, const int y_pos, const i col_shadow = color_shadow; firstPaint = true; v_fbdata.clear(); + bgMode = CC_BGMODE_PERMANENT; //CComponentsContainer corner_rad = RADIUS_LARGE; fr_thickness = 2; } +//------------------------------------------------------------------------------------------------------- +//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) +{ + //CComponents + x = x_pos; + y = y_pos; + width = w; + height = h; + shadow = has_shadow; + shadow_w = SHADOW_OFFSET; + col_frame = color_frame; + col_body = color_body; + col_shadow = color_shadow; + firstPaint = true; + v_fbdata.clear(); + bgMode = CC_BGMODE_PERMANENT; + + //CComponentsContainer + corner_rad = 0; + fr_thickness = 0; +} + +//------------------------------------------------------------------------------------------------------- +//sub class CComponentsShapeCircle from CComponentsContainer +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) +{ + //CComponentsShapeCircle + d = diam; + + //CComponents + x = x_pos; + y = y_pos; + width = d; + height = d; + shadow = has_shadow; + shadow_w = SHADOW_OFFSET; + col_frame = color_frame; + col_body = color_body; + col_shadow = color_shadow; + firstPaint = true; + v_fbdata.clear(); + bgMode = CC_BGMODE_PERMANENT; + + //CComponentsContainer + corner_rad = d/2; + fr_thickness = 0; +} + +// y +// x+ - + +// +// +// +// |----d-i-a-m----| +// +// +// +// + - + + //------------------------------------------------------------------------------------------------------- //sub class CComponentsDetailLine from CComponents @@ -250,6 +368,7 @@ CComponentsDetailLine::CComponentsDetailLine(const int x_pos, const int y_pos_to CComponentsDetailLine::~CComponentsDetailLine() { + hide(); //restore background clear(); } @@ -311,7 +430,7 @@ void CComponentsDetailLine::paint(bool do_save_bg) } //remove painted fb items from screen -void CComponentsDetailLine::paintBackground() +void CComponentsDetailLine::kill() { //save current colors fb_pixel_t c_tmp1, c_tmp2; @@ -328,5 +447,62 @@ void CComponentsDetailLine::paintBackground() firstPaint = true; } +//synchronize colors for details line +//This is usefull if the system colors are changed during runtime +//so you can ensure correct applied system colors in relevant objects with unchanged instances. +void CComponentsDetailLine::syncSysColors() +{ + col_body = COL_MENUCONTENT_PLUS_6; + col_shadow = COL_MENUCONTENTDARK_PLUS_0; +} +//------------------------------------------------------------------------------------------------------- +//sub class CComponentsPIP from CComponentsContainer +CComponentsPIP::CComponentsPIP( const int x_pos, const int y_pos, const int percent, bool has_shadow) +{ + //CComponentsPIP + screen_w = frameBuffer->getScreenWidth(true); + screen_h = frameBuffer->getScreenHeight(true); + + //CComponents + x = x_pos; + y = y_pos; + width = percent*screen_w/100; + height = percent*screen_h/100; + shadow = has_shadow; + shadow_w = SHADOW_OFFSET; + col_frame = COL_BACKGROUND; + col_body = COL_BACKGROUND; + col_shadow = COL_MENUCONTENTDARK_PLUS_0; + firstPaint = true; + v_fbdata.clear(); + bgMode = CC_BGMODE_PERMANENT; + + //CComponentsContainer + corner_rad = 0; + fr_thickness = 0; +} + +CComponentsPIP::~CComponentsPIP() +{ + hide(); +// if (saved_screen.pixbuf) +// delete[] saved_screen.pixbuf; + clear(); + videoDecoder->Pig(-1, -1, -1, -1); +} + +void CComponentsPIP::paint(bool do_save_bg) +{ + paintInit(do_save_bg); + videoDecoder->Pig(x+fr_thickness, y+fr_thickness, width-2*fr_thickness, height-2*fr_thickness, screen_w, screen_h); +} + + +void CComponentsPIP::hide(bool no_restore) +{ + hideContainer(no_restore); + videoDecoder->Pig(-1, -1, -1, -1); +} + diff --git a/src/gui/widget/menue.cpp b/src/gui/widget/menue.cpp index ee2e4375c..86feceebe 100644 --- a/src/gui/widget/menue.cpp +++ b/src/gui/widget/menue.cpp @@ -1105,13 +1105,10 @@ void CMenuWidget::paintHint(int pos) if (details_line) details_line->hide(); /* clear info box */ - if (info_box) - info_box->hide(hint_painted); + if ((info_box) && (pos == -1)) + info_box->hide(true); hint_painted = false; } - else if (info_box){ - info_box->hide(hint_painted); - } if (pos < 0) return; @@ -1124,7 +1121,7 @@ void CMenuWidget::paintHint(int pos) if (savescreen) #endif if (info_box) - info_box->hide(); + info_box->hide(false); #if 0 info_box->restore(); else From 9027ac6fbabeda6ab16f67ad2a2d402af3994b09 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Sat, 4 Aug 2012 01:32:42 +0200 Subject: [PATCH 008/224] CMenuWidget: define system colors during runtime --- src/gui/widget/menue.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/gui/widget/menue.cpp b/src/gui/widget/menue.cpp index 86feceebe..5e370b000 100644 --- a/src/gui/widget/menue.cpp +++ b/src/gui/widget/menue.cpp @@ -1149,9 +1149,13 @@ void CMenuWidget::paintHint(int pos) details_line->setYPos(ypos1a); details_line->setYPosDown(ypos2a); details_line->setHMarkDown(markh); - details_line->setColor(COL_MENUCONTENT_PLUS_6, COL_MENUCONTENTDARK_PLUS_0); + details_line->syncSysColors(); } +#if 0 details_line->paint(savescreen); +#endif + details_line->paint(); + if (info_box == NULL) info_box = new CComponentsInfoBox(x, ypos2, iwidth, hint_height); @@ -1159,11 +1163,15 @@ void CMenuWidget::paintHint(int pos) info_box->setXPos(x); info_box->setYPos(ypos2); info_box->setWidth(iwidth); - info_box->setColor(COL_MENUCONTENT_PLUS_6, COL_MENUCONTENTDARK_PLUS_0, COL_MENUCONTENTDARK_PLUS_0); info_box->setCornerRadius(RADIUS_LARGE); + info_box->syncSysColors(); } +#if 0 /* force full paint - menu-over i.e. option chooser with pulldown can overwrite */ info_box->paint(savescreen, true); +#endif + info_box->paint(); + int offset = 10; if (!item->hintIcon.empty()) { From 55a9b0db75e87679d101a6150bcd07d3282c5e88 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Tue, 7 Aug 2012 19:40:39 +0200 Subject: [PATCH 009/224] Bedit: apply last CComponent changes --- src/gui/bedit/bouqueteditor_channels.cpp | 8 ++++---- src/gui/bedit/bouqueteditor_chanselect.cpp | 14 ++++---------- 2 files changed, 8 insertions(+), 14 deletions(-) diff --git a/src/gui/bedit/bouqueteditor_channels.cpp b/src/gui/bedit/bouqueteditor_channels.cpp index 125704af5..8442a04b0 100644 --- a/src/gui/bedit/bouqueteditor_channels.cpp +++ b/src/gui/bedit/bouqueteditor_channels.cpp @@ -228,10 +228,10 @@ void CBEChannelWidget::paintItem2DetailsLine (int pos, int /*ch_index*/) void CBEChannelWidget::clearItem2DetailsLine() { - if (dline != NULL) - dline->paintBackground(); //kill details line - if (ibox != NULL) - ibox->paintBackground(); //kill info box + if (dline) + dline->kill(); //kill details line + if (ibox) + ibox->kill(); //kill info box } void CBEChannelWidget::hide() diff --git a/src/gui/bedit/bouqueteditor_chanselect.cpp b/src/gui/bedit/bouqueteditor_chanselect.cpp index 1ba48f5dd..b464f1258 100644 --- a/src/gui/bedit/bouqueteditor_chanselect.cpp +++ b/src/gui/bedit/bouqueteditor_chanselect.cpp @@ -78,13 +78,7 @@ CBEChannelSelectWidget::CBEChannelSelectWidget(const std::string & Caption, unsi CBEChannelSelectWidget::~CBEChannelSelectWidget() { - // clear details line - if (dline != NULL) - dline->paintBackground(); delete dline; - // clear infobox - if (ibox != NULL) - ibox->paintBackground(); delete ibox; } @@ -236,11 +230,11 @@ void CBEChannelSelectWidget::paintItem2DetailsLine (int pos, int /*ch_index*/) int ypos2a = ypos2 + (info_height/2)-2; // clear details line - if (dline != NULL) - dline->paintBackground(); + if (dline) + dline->hide(); // clear infobox - if (ibox != NULL) + if (ibox) ibox->hide(); // paint Line if detail info (and not valid list pos) @@ -249,7 +243,7 @@ void CBEChannelSelectWidget::paintItem2DetailsLine (int pos, int /*ch_index*/) if (dline == NULL) dline = new CComponentsDetailLine(xpos, ypos1a, ypos2a, fheight/2+1, info_height-RADIUS_LARGE*2); dline->setYPos(ypos1a); - dline->paint(false); + dline->paint(true); //infobox if (ibox == NULL) From 413e2241284ba7337707e951b1240f4f1b1c2139 Mon Sep 17 00:00:00 2001 From: micha-bbg Date: Wed, 8 Aug 2012 23:56:17 +0200 Subject: [PATCH 010/224] * channellist.cpp: paint details - Rework paintItem2DetailsLine() - Use CComponentsInfoBox for paintDetails() - Set missing height of down mark --- src/gui/channellist.cpp | 28 ++++++++++++++++++---------- src/gui/channellist.h | 2 ++ 2 files changed, 20 insertions(+), 10 deletions(-) diff --git a/src/gui/channellist.cpp b/src/gui/channellist.cpp index f8437f611..a7656fcdb 100644 --- a/src/gui/channellist.cpp +++ b/src/gui/channellist.cpp @@ -115,6 +115,8 @@ CChannelList::CChannelList(const char * const pName, bool phistoryMode, bool _vl theight = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]->getHeight(); previous_channellist_additional = -1; eventFont = SNeutrinoSettings::FONT_TYPE_CHANNELLIST_EVENT; + dline = NULL; + ibox = NULL; //printf("************ NEW LIST %s : %x\n", name.c_str(), (int) this);fflush(stdout); } @@ -122,6 +124,8 @@ CChannelList::~CChannelList() { //printf("************ DELETE LIST %s : %x\n", name.c_str(), this);fflush(stdout); chanlist.clear(); + delete dline; + delete ibox; } void CChannelList::ClearList(void) @@ -1525,7 +1529,11 @@ void CChannelList::paintDetails(int index) p_event = &chanlist[index]->currentEvent; } - frameBuffer->paintBoxRel(x+2, y + height + 2, full_width-4, info_height - 4, COL_MENUCONTENTDARK_PLUS_0, RADIUS_LARGE);//round + //infobox + if (ibox == NULL) + ibox = new CComponentsInfoBox(x, y + height + 2, width, info_height, false); + ibox->setCornerRadius(RADIUS_LARGE); + ibox->paint(false); if (!p_event->description.empty()) { char cNoch[50] = {0}; // UTF-8 @@ -1624,7 +1632,8 @@ void CChannelList::paintDetails(int index) void CChannelList::clearItem2DetailsLine() { - paintItem2DetailsLine (-1); + if (dline) + dline->kill(); //kill details line } void CChannelList::paintItem2DetailsLine (int pos) @@ -1634,20 +1643,19 @@ void CChannelList::paintItem2DetailsLine (int pos) int ypos2 = y + height; int ypos1a = ypos1 + (fheight/2)-2; int ypos2a = ypos2 + (info_height/2)-2; - fb_pixel_t col1 = COL_MENUCONTENT_PLUS_6; // Clear - frameBuffer->paintBackgroundBoxRel(xpos,y, ConnectLineBox_Width, height+info_height + 1); + if (dline) + dline->hide(); // paint Line if detail info (and not valid list pos) if (pos >= 0) { //pos >= 0 && chanlist[ch_index]->currentEvent.description != "") { if(1) // FIXME why -> ? (!g_settings.channellist_extended) { - //details line - CComponentsDetailLine details_line(xpos, ypos1a, ypos2a, fheight/2+1, info_height-RADIUS_LARGE*2); - details_line.paint(); - - //info box frame - frameBuffer->paintBoxFrame(x, ypos2, full_width, info_height, 2, col1, RADIUS_LARGE); + if (dline == NULL) + dline = new CComponentsDetailLine(xpos, ypos1a, ypos2a, fheight/2+1, info_height-RADIUS_LARGE*2); + dline->setYPos(ypos1a); + dline->setHMarkDown(info_height-RADIUS_LARGE*2); //required if user has changed osd-settings (corner mode) + dline->paint(); } } } diff --git a/src/gui/channellist.h b/src/gui/channellist.h index ea9688cec..ed660b77d 100644 --- a/src/gui/channellist.h +++ b/src/gui/channellist.h @@ -95,6 +95,8 @@ private: int info_height; int ChannelList_Rec; + CComponentsDetailLine *dline; + CComponentsInfoBox *ibox; void paintDetails(int index); void clearItem2DetailsLine (); From d5a00cb260799cae85ef79296f6c5d6f9d81ea02 Mon Sep 17 00:00:00 2001 From: micha-bbg Date: Sat, 11 Aug 2012 17:59:54 +0200 Subject: [PATCH 011/224] * Imageinfo/Streaminfo: Use CComponentsPIP for PIP --- src/gui/imageinfo.cpp | 29 +++++++++-------------------- src/gui/imageinfo.h | 4 +++- src/gui/streaminfo2.cpp | 18 +++++++----------- src/gui/streaminfo2.h | 3 ++- 4 files changed, 21 insertions(+), 33 deletions(-) diff --git a/src/gui/imageinfo.cpp b/src/gui/imageinfo.cpp index 9748d3f57..25be21191 100644 --- a/src/gui/imageinfo.cpp +++ b/src/gui/imageinfo.cpp @@ -42,7 +42,6 @@ #include "git_version.h" #define GIT_DESC "GIT Desc.:" #define GIT_REV "GIT Build:" -extern cVideo * videoDecoder; extern CRemoteControl * g_RemoteControl; /* neutrino.cpp */ @@ -66,7 +65,7 @@ static const neutrino_locale_t info_items[8] = void CImageInfo::Init(void) { frameBuffer = CFrameBuffer::getInstance(); - + pip = NULL; font_head = SNeutrinoSettings::FONT_TYPE_INFOBAR_CHANNAME;; font_small = SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL; font_info = SNeutrinoSettings::FONT_TYPE_MENU; @@ -105,7 +104,7 @@ void CImageInfo::Init(void) CImageInfo::~CImageInfo() { - videoDecoder->Pig(-1, -1, -1, -1); + delete pip; } int CImageInfo::exec(CMenuTarget* parent, const std::string &) @@ -121,11 +120,7 @@ int CImageInfo::exec(CMenuTarget* parent, const std::string &) paint(); - //paint_pig( width-170, y, 215, 170); - paint_pig (width - width/3 - 10, y + 10, width/3, height/3); - neutrino_msg_t msg; - while (1) { neutrino_msg_data_t data; @@ -159,16 +154,8 @@ int CImageInfo::exec(CMenuTarget* parent, const std::string &) void CImageInfo::hide() { - //frameBuffer->paintBackgroundBoxRel(0,0, max_width,max_height); + pip->hide(true); frameBuffer->paintBackground(); - videoDecoder->Pig(-1, -1, -1, -1); -} - -void CImageInfo::paint_pig(int px, int py, int w, int h) -{ - //frameBuffer->paintBoxRel(px,py,w,h, COL_BACKGROUND); - frameBuffer->paintBackgroundBoxRel(px,py,w,h); - videoDecoder->Pig(px, py, w, h, frameBuffer->getScreenWidth(true), frameBuffer->getScreenHeight(true)); } void CImageInfo::paintLine(int xpos, int font, const char* text) @@ -189,9 +176,7 @@ void CImageInfo::paint() head_string = g_Locale->getText(LOCALE_IMAGEINFO_HEAD); CVFD::getInstance()->setMode(CVFD::MODE_MENU_UTF8, head_string); - - //frameBuffer->paintBoxRel(0, 0, max_width, max_height, COL_MENUHEAD_PLUS_0); - frameBuffer->paintBoxRel(0, 0, max_width, max_height, COL_INFOBAR_PLUS_0); + frameBuffer->paintBoxRel(0, 0, max_width, max_height, COL_INFOBAR_PLUS_0); g_Font[font_head]->RenderString(xpos, ypos+ hheight+1, width, head_string, COL_MENUHEAD, 0, true); ypos += hheight; @@ -250,7 +235,7 @@ void CImageInfo::paint() paintLine(xpos , font_info, GIT_REV); #endif paintLine(xpos+offset, font_info, builddate ); - + ypos += iheight; paintLine(xpos , font_info, g_Locale->getText(LOCALE_IMAGEINFO_CREATOR)); paintLine(xpos+offset, font_info, creator); @@ -300,4 +285,8 @@ void CImageInfo::paint() ypos+= sheight; paintLine(xpos+offset, font_small, "Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA."); + + if (pip == NULL) + pip = new CComponentsPIP(width-width/3-10, y+10, 30); + pip->paint(); } diff --git a/src/gui/imageinfo.h b/src/gui/imageinfo.h index 8f50abe97..170820f88 100644 --- a/src/gui/imageinfo.h +++ b/src/gui/imageinfo.h @@ -28,6 +28,8 @@ #include #include #include +#include + class CImageInfo : public CMenuTarget { @@ -35,6 +37,7 @@ class CImageInfo : public CMenuTarget void Init(void); CConfigFile * configfile; CFrameBuffer *frameBuffer; + CComponentsPIP * pip; int x; int y; int ypos; @@ -53,7 +56,6 @@ class CImageInfo : public CMenuTarget int font_small; void paint(); - void paint_pig(int x, int y, int w, int h); void paintLine(int xpos, int font, const char* text); public: diff --git a/src/gui/streaminfo2.cpp b/src/gui/streaminfo2.cpp index b9b01188f..8bde0051f 100644 --- a/src/gui/streaminfo2.cpp +++ b/src/gui/streaminfo2.cpp @@ -56,7 +56,7 @@ extern CRemoteControl *g_RemoteControl; /* neutrino.cpp */ CStreamInfo2::CStreamInfo2 () { frameBuffer = CFrameBuffer::getInstance (); - + pip = NULL; font_head = SNeutrinoSettings::FONT_TYPE_MENU_TITLE; font_info = SNeutrinoSettings::FONT_TYPE_MENU; font_small = SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL; @@ -98,7 +98,7 @@ CStreamInfo2::CStreamInfo2 () CStreamInfo2::~CStreamInfo2 () { - videoDecoder->Pig(-1, -1, -1, -1); + delete pip; ts_close(); } @@ -252,17 +252,10 @@ int CStreamInfo2::doSignalStrengthLoop () void CStreamInfo2::hide () { - videoDecoder->Pig(-1, -1, -1, -1); + pip->hide(true); frameBuffer->paintBackgroundBoxRel (0, 0, max_width, max_height); } -void CStreamInfo2::paint_pig (int px, int py, int w, int h) -{ - frameBuffer->paintBackgroundBoxRel (px,py, w, h); - printf("CStreamInfo2::paint_pig x %d y %d w %d h %d\n", px, py, w, h); - videoDecoder->Pig(px, py, w, h, frameBuffer->getScreenWidth(true), frameBuffer->getScreenHeight(true)); -} - void CStreamInfo2::paint_signal_fe_box(int _x, int _y, int w, int h) { int y1; @@ -425,7 +418,10 @@ void CStreamInfo2::paint (int /*mode*/) g_Font[font_head]->RenderString (xpos, ypos + hheight + 1, width, head_string, COL_MENUHEAD, 0, true); // UTF-8 ypos += hheight; - paint_pig (width - width/3 - 10, y + 10, width/3, height/3); + if (pip == NULL) + pip = new CComponentsPIP(width-width/3-10, y+10, 30); + pip->paint(); + paint_techinfo (xpos, ypos); paint_signal_fe_box (width - width/3 - 10, (y + 10 + height/3 + hheight), width/3, height/3 + hheight); } else { diff --git a/src/gui/streaminfo2.h b/src/gui/streaminfo2.h index e24c48ca4..014353695 100644 --- a/src/gui/streaminfo2.h +++ b/src/gui/streaminfo2.h @@ -26,6 +26,7 @@ #include #include +#include #include #include @@ -36,6 +37,7 @@ class CStreamInfo2 : public CMenuTarget CFrameBuffer *frameBuffer; CFrontend *frontend; + CComponentsPIP * pip; int x; int y; int width; @@ -90,7 +92,6 @@ class CStreamInfo2 : public CMenuTarget int ts_close(); void paint(int mode); - void paint_pig(int x, int y, int w, int h); void paint_techinfo(int x, int y); void paintCASystem(int xpos, int ypos); void paint_signal_fe_box(int x, int y, int w, int h); From faca5828076ef34b30111880543ee97b194ac58b Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Mon, 13 Aug 2012 22:54:03 +0200 Subject: [PATCH 012/224] CComponents: add class to place and paint icons and pictures --- src/gui/components/cc.h | 49 ++++++++++++--- src/gui/components/components.cpp | 99 +++++++++++++++++++++++++++++++ 2 files changed, 141 insertions(+), 7 deletions(-) diff --git a/src/gui/components/cc.h b/src/gui/components/cc.h index 0b9baf7e8..49b6027cd 100644 --- a/src/gui/components/cc.h +++ b/src/gui/components/cc.h @@ -58,8 +58,7 @@ typedef enum CC_FBDATA_TYPE_BACKGROUND, CC_FBDATA_TYPES -} -FBDATA_TYPES; +}FBDATA_TYPES; typedef struct comp_screen_data_t { @@ -76,8 +75,18 @@ typedef enum CC_BGMODE_PERMANENT, CC_BGMODE_TYPES -} -BGMODE_TYPES; +}BGMODE_TYPES; + +//align types +enum +{ + CC_ALIGN_RIGHT = 0, + CC_ALIGN_LEFT = 1, + CC_ALIGN_TOP = 2, + CC_ALIGN_BOTTOM = 4, + CC_ALIGN_HOR_CENTER = 8, + CC_ALIGN_VER_CENTER = 16 +}; #define CC_WIDTH_MIN 16 #define CC_HEIGHT_MIN 16 @@ -116,6 +125,7 @@ class CComponents inline virtual int getYPos(){return y;}; inline virtual int getHeight(){return height;}; inline virtual int getWidth(){return width;}; + inline virtual void getDimensions(int* xpos, int* ypos, int* w, int* h){*xpos=x; *ypos=y; *w=width; *h=height;}; /// set colors: Possible color values are defined in "gui/color.h" and "gui/customcolor.h" inline virtual void setColorFrame(fb_pixel_t color){col_frame = color;}; @@ -167,7 +177,7 @@ class CComponentsShapeCircle : public CComponentsContainer public: CComponentsShapeCircle( const int x_pos, const int y_pos, const int diam, bool has_shadow = CC_SHADOW_ON, fb_pixel_t color_frame = COL_MENUCONTENT_PLUS_6, fb_pixel_t color_body = COL_MENUCONTENT_PLUS_0, fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0); - + void setDiam(const int& diam){d=width=height=diam, corner_rad=d/2;}; int getDiam(){return d;}; }; @@ -186,7 +196,7 @@ class CComponentsPIP : public CComponentsContainer public: CComponentsPIP( const int x_pos, const int y_pos, const int percent, bool has_shadow = CC_SHADOW_OFF); ~CComponentsPIP(); - + void paint(bool do_save_bg = CC_SAVE_SCREEN_YES); void hide(bool no_restore = false); }; @@ -203,11 +213,36 @@ class CComponentsDetailLine : public CComponents ~CComponentsDetailLine(); void paint(bool do_save_bg = CC_SAVE_SCREEN_YES); - void kill(); + void kill(); void setColors(fb_pixel_t color_line, fb_pixel_t color_shadow){col_body = color_line; col_shadow = color_shadow;}; void syncSysColors(); void setYPosDown(const int& y_pos_down){y_down = y_pos_down;}; void setHMarkDown(const int& h_mark_down_){h_mark_down = h_mark_down_;}; }; +class CComponentsPicture : public CComponentsContainer +{ + private: + std::string pic_name; + unsigned char pic_offset; + bool pic_paint, pic_paintBg, pic_painted, do_paint; + int pic_align, pic_x, pic_y, pic_width, pic_height; + + void initDimensions(); + + 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, + 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 setPictureOffset(const unsigned char offset){pic_offset = offset;}; + void setPicturePaint(bool paint_p){pic_paint = paint_p;}; + void setPicturePaintBackground(bool paintBg){pic_paintBg = paintBg;}; + void setPicture(const std::string& picture_name); + void setPictureAlign(const int alignment); + + bool isPainted(){return pic_painted;}; + void paint(bool do_save_bg = CC_SAVE_SCREEN_YES); + void getPictureSize(int *pwidth, int *pheight){*pwidth=pic_width; *pheight=pic_height;}; + +}; + #endif diff --git a/src/gui/components/components.cpp b/src/gui/components/components.cpp index a93dd1e6b..0edd246ad 100644 --- a/src/gui/components/components.cpp +++ b/src/gui/components/components.cpp @@ -506,3 +506,102 @@ void CComponentsPIP::hide(bool no_restore) videoDecoder->Pig(-1, -1, -1, -1); } + +//------------------------------------------------------------------------------------------------------- +//sub class CComponentsPicture from CComponentsContainer +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) +{ + //CComponentsPicture + pic_name = picture_name; + pic_align = alignment; + pic_offset = 1; + pic_paint = true; + pic_paintBg = false; + pic_painted = false; + do_paint = false; + if (pic_name.empty()) + pic_width = pic_height = 0; + + //CComponents + 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; + firstPaint = true; + v_fbdata.clear(); + bgMode = CC_BGMODE_PERMANENT; + + //CComponentsContainer + corner_rad = 0; + fr_thickness = 0; + + initDimensions(); +} + + +void CComponentsPicture::setPicture(const std::string& picture_name) +{ + pic_name = picture_name; + initDimensions(); +} + + +void CComponentsPicture::setPictureAlign(const int alignment) +{ + pic_align = alignment; + initDimensions(); +} + + +void CComponentsPicture::initDimensions() +{ + if (pic_name.empty()){ + printf("CComponentsPicture: %s no picture file defined !\n", __FUNCTION__); + pic_width = pic_height = 0; + return; + } + + frameBuffer->getIconSize(pic_name.c_str(), &pic_width, &pic_height); + + pic_x += fr_thickness; + pic_y += fr_thickness; + + if (pic_height>0 && pic_width>0){ + if (pic_align & CC_ALIGN_LEFT) + pic_x = x+fr_thickness; + if (pic_align & CC_ALIGN_RIGHT) + pic_x = x+width-pic_width-fr_thickness; + if (pic_align & CC_ALIGN_TOP) + pic_y = y+fr_thickness; + if (pic_align & CC_ALIGN_BOTTOM) + pic_y = y+height-pic_height-fr_thickness; + if (pic_align & CC_ALIGN_HOR_CENTER) + pic_x = x+width/2-pic_width/2; + if (pic_align & CC_ALIGN_VER_CENTER) + pic_y = y+height/2-pic_height/2; + + do_paint = true; + } + + width = max(pic_width, width); + height = max(pic_height, height); +} + +void CComponentsPicture::paint(bool do_save_bg) +{ + pic_painted = false; + initDimensions(); + + if (do_paint){ + paintInit(do_save_bg); + pic_painted = frameBuffer->paintIcon(pic_name, pic_x, pic_y, 0, pic_offset, pic_paint, pic_paintBg, col_body); + do_paint = false; + } +} + From 2e6ac2420adc06d0c21292e7cac8f7a0650eae41 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Thu, 16 Aug 2012 17:37:29 +0200 Subject: [PATCH 013/224] CComponents: add text functionality into class CComponentsInfoBox() --- src/gui/components/cc.h | 24 +++++++++++- src/gui/components/components.cpp | 63 ++++++++++++++++++++++++++++--- 2 files changed, 81 insertions(+), 6 deletions(-) diff --git a/src/gui/components/cc.h b/src/gui/components/cc.h index 49b6027cd..24c8383d3 100644 --- a/src/gui/components/cc.h +++ b/src/gui/components/cc.h @@ -29,6 +29,7 @@ #include #include #include +#include "textbox.h" #include #include @@ -165,9 +166,30 @@ class CComponentsContainer : public CComponents #define INFO_BOX_Y_OFFSET 2 class CComponentsInfoBox : public CComponentsContainer { + private: + const char* text; + int text_mode; //see textbox.h for possible modes + Font* font; + CBox * box; + CTextBox * textbox; + + void paintText(); + void initVarInfobox(); + public: - CComponentsInfoBox( const int x_pos, const int y_pos, const int w, const int h, bool has_shadow = CC_SHADOW_ON, + CComponentsInfoBox( const int x_pos, const int y_pos, const int w, const int h, + const char* info_text = NULL, const int mode = CTextBox::AUTO_WIDTH, Font* font_text = NULL, + bool has_shadow = CC_SHADOW_OFF, fb_pixel_t color_frame = COL_MENUCONTENT_PLUS_6, fb_pixel_t color_body = COL_MENUCONTENT_PLUS_0, fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0); + + ~CComponentsInfoBox(); + + void setText(const char* info_text, const int mode = CTextBox::AUTO_WIDTH, Font* font_text = NULL){text = info_text; text_mode = mode, font = font_text;}; + void setText(const std::string info_text, const int mode = CTextBox::AUTO_WIDTH, Font* font_text = NULL){text = info_text.c_str(); text_mode = mode, font = font_text;}; + void setText(neutrino_locale_t locale_text, const int mode = CTextBox::AUTO_WIDTH, Font* font_text = NULL); + void setTextMode(const int mode){text_mode = mode;}; + void setTextFont(Font* font_text){font = font_text;}; + void paint(bool do_save_bg = CC_SAVE_SCREEN_YES); }; class CComponentsShapeCircle : public CComponentsContainer diff --git a/src/gui/components/components.cpp b/src/gui/components/components.cpp index 0edd246ad..d632c92bf 100644 --- a/src/gui/components/components.cpp +++ b/src/gui/components/components.cpp @@ -260,25 +260,78 @@ void CComponentsContainer::syncSysColors() //------------------------------------------------------------------------------------------------------- //sub class CComponentsInfoBox from CComponentsContainer -CComponentsInfoBox::CComponentsInfoBox(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) +CComponentsInfoBox::CComponentsInfoBox(const int x_pos, const int y_pos, const int w, const int h, + const char* info_text, const int mode, Font* font_text, + bool has_shadow, + fb_pixel_t color_frame, fb_pixel_t color_body, fb_pixel_t color_shadow) { + //CComponentsInfoBox + text = info_text; + text_mode = mode; + font = font_text; + //CComponents x = x_pos; y = y_pos; width = w; height = h; shadow = has_shadow; - shadow_w = SHADOW_OFFSET; col_frame = color_frame; col_body = color_body; col_shadow = color_shadow; - firstPaint = true; - v_fbdata.clear(); - bgMode = CC_BGMODE_PERMANENT; + initVarInfobox(); +} + +CComponentsInfoBox::~CComponentsInfoBox() +{ + + hide(); +// if (saved_screen.pixbuf) +// delete[] saved_screen.pixbuf; + delete textbox; + delete box; + clear(); +} + +void CComponentsInfoBox::initVarInfobox() +{ //CComponentsContainer corner_rad = RADIUS_LARGE; fr_thickness = 2; + + //CComponents + firstPaint = true; + v_fbdata.clear(); + bgMode = CC_BGMODE_PERMANENT; + shadow_w = SHADOW_OFFSET; + + //CComponentsInfoBox + box = NULL; + textbox = NULL; + +} + +void CComponentsInfoBox::setText(neutrino_locale_t locale_text, int mode, Font* font_text) +{ + text = g_Locale->getText(locale_text); + text_mode = mode; + font = font_text; +} + +void CComponentsInfoBox::paintText() +{ + box = new CBox( x+fr_thickness, y+fr_thickness, width-2*fr_thickness, height-2*fr_thickness); + textbox = new CTextBox(text, font, text_mode, box, col_body); + textbox->enableBackgroundPaint(false); + textbox->paint(); +} + +void CComponentsInfoBox::paint(bool do_save_bg) +{ + paintInit(do_save_bg); + if (text != NULL) + paintText(); } //------------------------------------------------------------------------------------------------------- From b0fc5efe283c7e0c720263757aa506189e83a076 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Thu, 16 Aug 2012 17:39:48 +0200 Subject: [PATCH 014/224] Bedit: adapt for last changes in CComponents --- src/gui/bedit/bouqueteditor_channels.cpp | 2 +- src/gui/bedit/bouqueteditor_chanselect.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gui/bedit/bouqueteditor_channels.cpp b/src/gui/bedit/bouqueteditor_channels.cpp index 8442a04b0..8c55d1a22 100644 --- a/src/gui/bedit/bouqueteditor_channels.cpp +++ b/src/gui/bedit/bouqueteditor_channels.cpp @@ -221,7 +221,7 @@ void CBEChannelWidget::paintItem2DetailsLine (int pos, int /*ch_index*/) //infobox if (ibox == NULL) - ibox = new CComponentsInfoBox(x, ypos2, width, info_height, false); + ibox = new CComponentsInfoBox(x, ypos2, width, info_height); ibox->paint(false,true); } } diff --git a/src/gui/bedit/bouqueteditor_chanselect.cpp b/src/gui/bedit/bouqueteditor_chanselect.cpp index b464f1258..d012fbbe8 100644 --- a/src/gui/bedit/bouqueteditor_chanselect.cpp +++ b/src/gui/bedit/bouqueteditor_chanselect.cpp @@ -247,7 +247,7 @@ void CBEChannelSelectWidget::paintItem2DetailsLine (int pos, int /*ch_index*/) //infobox if (ibox == NULL) - ibox = new CComponentsInfoBox(x, ypos2, width, info_height, false); + ibox = new CComponentsInfoBox(x, ypos2, width, info_height); ibox->paint(false,true); } } From b0f9cde09f967db67b6c70c64f93c1a87fbf29a3 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Thu, 16 Aug 2012 17:40:16 +0200 Subject: [PATCH 015/224] CMenuWidget: adapt for last changes in CComponents --- src/gui/widget/menue.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/gui/widget/menue.cpp b/src/gui/widget/menue.cpp index 5e370b000..e762f4b47 100644 --- a/src/gui/widget/menue.cpp +++ b/src/gui/widget/menue.cpp @@ -1165,6 +1165,7 @@ void CMenuWidget::paintHint(int pos) info_box->setWidth(iwidth); info_box->setCornerRadius(RADIUS_LARGE); info_box->syncSysColors(); + info_box->setShadowOnOff(CC_SHADOW_ON); } #if 0 /* force full paint - menu-over i.e. option chooser with pulldown can overwrite */ From 14f8e63cc924410b422b2f6cb919c5bc6b7b4d65 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Thu, 16 Aug 2012 17:40:48 +0200 Subject: [PATCH 016/224] CAudioPlayer: adapt for last changes in CComponents --- src/gui/audioplayer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/audioplayer.cpp b/src/gui/audioplayer.cpp index ebe08b6aa..e81e4f36f 100644 --- a/src/gui/audioplayer.cpp +++ b/src/gui/audioplayer.cpp @@ -1930,7 +1930,7 @@ void CAudioPlayerGui::paintItemID3DetailsLine (int pos) // paint id3 infobox if (ibox == NULL) - ibox = new CComponentsInfoBox(m_x, ypos2, m_width, m_info_height, CC_SHADOW_OFF); + ibox = new CComponentsInfoBox(m_x, ypos2, m_width, m_info_height); ibox->setYPos(ypos2); ibox->paint(false); From d59eb0542704f28eede86f9b46ad2781b43fa593 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Thu, 16 Aug 2012 17:41:19 +0200 Subject: [PATCH 017/224] CChannelList: adapt for last changes in CComponents --- src/gui/channellist.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/channellist.cpp b/src/gui/channellist.cpp index a7656fcdb..a6ed738c7 100644 --- a/src/gui/channellist.cpp +++ b/src/gui/channellist.cpp @@ -1531,7 +1531,7 @@ void CChannelList::paintDetails(int index) //infobox if (ibox == NULL) - ibox = new CComponentsInfoBox(x, y + height + 2, width, info_height, false); + ibox = new CComponentsInfoBox(x, y + height + 2, width, info_height); ibox->setCornerRadius(RADIUS_LARGE); ibox->paint(false); From aa308c12362ec414f28bd5e5aa739a0b7fbf9596 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Fri, 17 Aug 2012 13:57:52 +0200 Subject: [PATCH 018/224] CComponents: paint picture in Infobox --- src/gui/components/cc.h | 67 +++++++++++++++++-------------- src/gui/components/components.cpp | 22 +++++++++- 2 files changed, 56 insertions(+), 33 deletions(-) diff --git a/src/gui/components/cc.h b/src/gui/components/cc.h index 24c8383d3..b6a2e1b10 100644 --- a/src/gui/components/cc.h +++ b/src/gui/components/cc.h @@ -162,6 +162,30 @@ class CComponentsContainer : public CComponents virtual void syncSysColors(); }; +class CComponentsPicture : public CComponentsContainer +{ + private: + std::string pic_name; + unsigned char pic_offset; + bool pic_paint, pic_paintBg, pic_painted, do_paint; + int pic_align, pic_x, pic_y, pic_width, pic_height; + + void initDimensions(); + + 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, + 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 setPictureOffset(const unsigned char offset){pic_offset = offset;}; + void setPicturePaint(bool paint_p){pic_paint = paint_p;}; + void setPicturePaintBackground(bool paintBg){pic_paintBg = paintBg;}; + void setPicture(const std::string& picture_name); + void setPictureAlign(const int alignment); + + bool isPainted(){return pic_painted;}; + void paint(bool do_save_bg = CC_SAVE_SCREEN_YES); + void getPictureSize(int *pwidth, int *pheight){*pwidth=pic_width; *pheight=pic_height;}; + +}; #define INFO_BOX_Y_OFFSET 2 class CComponentsInfoBox : public CComponentsContainer @@ -169,29 +193,35 @@ class CComponentsInfoBox : public CComponentsContainer private: const char* text; int text_mode; //see textbox.h for possible modes + int x_text; Font* font; CBox * box; CTextBox * textbox; - + CComponentsPicture * pic; + + void paintPicture(); void paintText(); void initVarInfobox(); - + std::string pic_name; + public: CComponentsInfoBox( const int x_pos, const int y_pos, const int w, const int h, - const char* info_text = NULL, const int mode = CTextBox::AUTO_WIDTH, Font* font_text = NULL, + const char* info_text = NULL, const int mode = CTextBox::AUTO_WIDTH | CTextBox::AUTO_HIGH, Font* font_text = NULL, bool has_shadow = CC_SHADOW_OFF, fb_pixel_t color_frame = COL_MENUCONTENT_PLUS_6, fb_pixel_t color_body = COL_MENUCONTENT_PLUS_0, fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0); - + ~CComponentsInfoBox(); - + void setText(const char* info_text, const int mode = CTextBox::AUTO_WIDTH, Font* font_text = NULL){text = info_text; text_mode = mode, font = font_text;}; - void setText(const std::string info_text, const int mode = CTextBox::AUTO_WIDTH, Font* font_text = NULL){text = info_text.c_str(); text_mode = mode, font = font_text;}; + void setText(const std::string& info_text, const int mode = CTextBox::AUTO_WIDTH, Font* font_text = NULL){text = info_text.c_str(); text_mode = mode, font = font_text;}; void setText(neutrino_locale_t locale_text, const int mode = CTextBox::AUTO_WIDTH, Font* font_text = NULL); void setTextMode(const int mode){text_mode = mode;}; void setTextFont(Font* font_text){font = font_text;}; + void setPicture(const std::string& picture_name){pic_name = picture_name;}; void paint(bool do_save_bg = CC_SAVE_SCREEN_YES); }; + class CComponentsShapeCircle : public CComponentsContainer { private: @@ -242,29 +272,4 @@ class CComponentsDetailLine : public CComponents void setHMarkDown(const int& h_mark_down_){h_mark_down = h_mark_down_;}; }; -class CComponentsPicture : public CComponentsContainer -{ - private: - std::string pic_name; - unsigned char pic_offset; - bool pic_paint, pic_paintBg, pic_painted, do_paint; - int pic_align, pic_x, pic_y, pic_width, pic_height; - - void initDimensions(); - - 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, - 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 setPictureOffset(const unsigned char offset){pic_offset = offset;}; - void setPicturePaint(bool paint_p){pic_paint = paint_p;}; - void setPicturePaintBackground(bool paintBg){pic_paintBg = paintBg;}; - void setPicture(const std::string& picture_name); - void setPictureAlign(const int alignment); - - bool isPainted(){return pic_painted;}; - void paint(bool do_save_bg = CC_SAVE_SCREEN_YES); - void getPictureSize(int *pwidth, int *pheight){*pwidth=pic_width; *pheight=pic_height;}; - -}; - #endif diff --git a/src/gui/components/components.cpp b/src/gui/components/components.cpp index d632c92bf..58c828aa5 100644 --- a/src/gui/components/components.cpp +++ b/src/gui/components/components.cpp @@ -291,6 +291,7 @@ CComponentsInfoBox::~CComponentsInfoBox() // delete[] saved_screen.pixbuf; delete textbox; delete box; + delete pic; clear(); } @@ -309,6 +310,9 @@ void CComponentsInfoBox::initVarInfobox() //CComponentsInfoBox box = NULL; textbox = NULL; + pic = NULL; + pic_name = ""; + x_text = x; } @@ -319,9 +323,22 @@ void CComponentsInfoBox::setText(neutrino_locale_t locale_text, int mode, Font* font = font_text; } +void CComponentsInfoBox::paintPicture() +{ + if (pic == NULL) + pic = new CComponentsPicture(x+fr_thickness+corner_rad, y+fr_thickness+corner_rad, ""); + pic->setPicture(pic_name); + int pic_w = pic->getWidth(); + pic->setHeight(height-2*fr_thickness-2*corner_rad); + pic->setColorBody(col_body); + pic->paint(); + if (pic->isPainted()) + x_text = x+fr_thickness+pic_w+corner_rad; +} + void CComponentsInfoBox::paintText() { - box = new CBox( x+fr_thickness, y+fr_thickness, width-2*fr_thickness, height-2*fr_thickness); + box = new CBox( x_text+fr_thickness, y+fr_thickness, width-2*fr_thickness-(x_text-x), height-2*fr_thickness); textbox = new CTextBox(text, font, text_mode, box, col_body); textbox->enableBackgroundPaint(false); textbox->paint(); @@ -330,6 +347,7 @@ void CComponentsInfoBox::paintText() void CComponentsInfoBox::paint(bool do_save_bg) { paintInit(do_save_bg); + paintPicture(); if (text != NULL) paintText(); } @@ -574,7 +592,7 @@ CComponentsPicture::CComponentsPicture( int x_pos, int y_pos, const string& pict pic_painted = false; do_paint = false; if (pic_name.empty()) - pic_width = pic_height = 0; + pic_width = pic_height = 0; //CComponents x = pic_x = x_pos; From 9090e41d5b8ccd36f862cca8237acf7d9569a680 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Sat, 18 Aug 2012 01:14:02 +0200 Subject: [PATCH 019/224] CComponents: Rework some buggy paint methodes --- src/gui/components/cc.h | 20 +++++--- src/gui/components/components.cpp | 82 ++++++++++++++++++++++--------- 2 files changed, 71 insertions(+), 31 deletions(-) diff --git a/src/gui/components/cc.h b/src/gui/components/cc.h index b6a2e1b10..01b84298c 100644 --- a/src/gui/components/cc.h +++ b/src/gui/components/cc.h @@ -180,7 +180,7 @@ class CComponentsPicture : public CComponentsContainer void setPicturePaintBackground(bool paintBg){pic_paintBg = paintBg;}; void setPicture(const std::string& picture_name); void setPictureAlign(const int alignment); - + bool isPainted(){return pic_painted;}; void paint(bool do_save_bg = CC_SAVE_SCREEN_YES); void getPictureSize(int *pwidth, int *pheight){*pwidth=pic_width; *pheight=pic_height;}; @@ -193,31 +193,35 @@ class CComponentsInfoBox : public CComponentsContainer private: const char* text; int text_mode; //see textbox.h for possible modes - int x_text; + int x_text, x_offset; Font* font; CBox * box; CTextBox * textbox; CComponentsPicture * pic; + std::string pic_default_name; void paintPicture(); void paintText(); void initVarInfobox(); std::string pic_name; - + fb_pixel_t col_text; public: CComponentsInfoBox( const int x_pos, const int y_pos, const int w, const int h, const char* info_text = NULL, const int mode = CTextBox::AUTO_WIDTH | CTextBox::AUTO_HIGH, Font* font_text = NULL, bool has_shadow = CC_SHADOW_OFF, - fb_pixel_t color_frame = COL_MENUCONTENT_PLUS_6, fb_pixel_t color_body = COL_MENUCONTENT_PLUS_0, fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0); + fb_pixel_t color_text = COL_MENUCONTENT, fb_pixel_t color_frame = COL_MENUCONTENT_PLUS_6, fb_pixel_t color_body = COL_MENUCONTENT_PLUS_0, fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0); ~CComponentsInfoBox(); - void setText(const char* info_text, const int mode = CTextBox::AUTO_WIDTH, Font* font_text = NULL){text = info_text; text_mode = mode, font = font_text;}; - void setText(const std::string& info_text, const int mode = CTextBox::AUTO_WIDTH, Font* font_text = NULL){text = info_text.c_str(); text_mode = mode, font = font_text;}; - void setText(neutrino_locale_t locale_text, const int mode = CTextBox::AUTO_WIDTH, Font* font_text = NULL); - void setTextMode(const int mode){text_mode = mode;}; + void setText(const char* info_text, const int mode = CTextBox::AUTO_WIDTH | CTextBox::AUTO_HIGH, Font* font_text = NULL){text = info_text; text_mode = mode, font = font_text;}; + void setText(const std::string& info_text, const int mode = CTextBox::AUTO_WIDTH | CTextBox::AUTO_HIGH, Font* font_text = NULL){text = info_text.c_str(); text_mode = mode, font = font_text;}; + void setText(neutrino_locale_t locale_text, const int mode = CTextBox::AUTO_WIDTH | CTextBox::AUTO_HIGH, Font* font_text = NULL); + void setTextMode(const int mode){text_mode = mode;};//see textbox.h for possible modes void setTextFont(Font* font_text){font = font_text;}; + void setTextColor(fb_pixel_t color_text){ col_text = color_text;}; + void setSpaceOffset(const int offset){x_offset = offset;}; void setPicture(const std::string& picture_name){pic_name = picture_name;}; + void paint(bool do_save_bg = CC_SAVE_SCREEN_YES); }; diff --git a/src/gui/components/components.cpp b/src/gui/components/components.cpp index 58c828aa5..73996a151 100644 --- a/src/gui/components/components.cpp +++ b/src/gui/components/components.cpp @@ -263,12 +263,14 @@ void CComponentsContainer::syncSysColors() CComponentsInfoBox::CComponentsInfoBox(const int x_pos, const int y_pos, const int w, const int h, const char* info_text, const int mode, Font* font_text, bool has_shadow, - 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 + initVarInfobox(); text = info_text; text_mode = mode; font = font_text; + col_text = color_text; //CComponents x = x_pos; @@ -280,7 +282,7 @@ CComponentsInfoBox::CComponentsInfoBox(const int x_pos, const int y_pos, const i col_body = color_body; col_shadow = color_shadow; - initVarInfobox(); + } CComponentsInfoBox::~CComponentsInfoBox() @@ -313,6 +315,7 @@ void CComponentsInfoBox::initVarInfobox() pic = NULL; pic_name = ""; x_text = x; + x_offset = 10; } @@ -325,31 +328,63 @@ void CComponentsInfoBox::setText(neutrino_locale_t locale_text, int mode, Font* void CComponentsInfoBox::paintPicture() { + //init and set icon paint position if (pic == NULL) - pic = new CComponentsPicture(x+fr_thickness+corner_rad, y+fr_thickness+corner_rad, ""); + pic = new CComponentsPicture(x+fr_thickness+x_offset, y+fr_thickness/*+y_offset*/, ""); + pic->setXPos(x+fr_thickness+x_offset); + pic->setYPos(y+fr_thickness); + + //define icon pic->setPicture(pic_name); - int pic_w = pic->getWidth(); - pic->setHeight(height-2*fr_thickness-2*corner_rad); + + //fit icon into infobox + pic->setHeight(height-2*fr_thickness); pic->setColorBody(col_body); + pic->paint(); - if (pic->isPainted()) - x_text = x+fr_thickness+pic_w+corner_rad; } void CComponentsInfoBox::paintText() -{ - box = new CBox( x_text+fr_thickness, y+fr_thickness, width-2*fr_thickness-(x_text-x), height-2*fr_thickness); - textbox = new CTextBox(text, font, text_mode, box, col_body); +{ + if (box == NULL) + box = new CBox(); + + //define text x position + x_text = x+fr_thickness+x_offset; + if (pic->isPainted()){ + int pic_w = pic->getWidth(); + x_text += pic_w+x_offset; + } + + box->iX = x_text; + box->iY = y+fr_thickness; + + //text width and height + box->iWidth = width-2*fr_thickness-(x_text-x); + box->iHeight = height-2*fr_thickness; + + //init textbox + if (textbox == NULL) + textbox = new CTextBox(text, font, text_mode, box, col_body); + + //set properties + textbox->movePosition(box->iX, box->iY); + textbox->setTextColor(col_text); textbox->enableBackgroundPaint(false); - textbox->paint(); + + //set text + string new_text = static_cast (text); + if (textbox->setText(&new_text)) + textbox->paint(); } void CComponentsInfoBox::paint(bool do_save_bg) { paintInit(do_save_bg); paintPicture(); - if (text != NULL) + if (text) paintText(); + text = NULL; } //------------------------------------------------------------------------------------------------------- @@ -632,14 +667,15 @@ void CComponentsPicture::setPictureAlign(const int alignment) void CComponentsPicture::initDimensions() { - if (pic_name.empty()){ - printf("CComponentsPicture: %s no picture file defined !\n", __FUNCTION__); - pic_width = pic_height = 0; - return; - } + pic_width = pic_height = 0; + pic_painted = false; + do_paint = false; frameBuffer->getIconSize(pic_name.c_str(), &pic_width, &pic_height); + if (pic_width == 0 || pic_height == 0) + printf("CComponentsPicture: %s file: %s, no icon dimensions found! width = %d, height = %d\n", __FUNCTION__, pic_name.c_str(), pic_width, pic_height); + pic_x += fr_thickness; pic_y += fr_thickness; @@ -659,18 +695,18 @@ void CComponentsPicture::initDimensions() do_paint = true; } - - width = max(pic_width, width); - height = max(pic_height, height); + + int sw = (shadow ? shadow_w :0); + width = max(pic_width, width) + sw ; + height = max(pic_height, height) + sw ; } void CComponentsPicture::paint(bool do_save_bg) { - pic_painted = false; initDimensions(); + paintInit(do_save_bg); - if (do_paint){ - paintInit(do_save_bg); + if (do_paint){ pic_painted = frameBuffer->paintIcon(pic_name, pic_x, pic_y, 0, pic_offset, pic_paint, pic_paintBg, col_body); do_paint = false; } From 53ff9cdddf91982bfdd2f690af2b2d056562526d Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Sun, 19 Aug 2012 13:15:51 +0200 Subject: [PATCH 020/224] CMenuWidget: implement CComponentsInfoBox functionality for text and icon --- src/gui/widget/menue.cpp | 146 ++++++++++----------------------------- src/gui/widget/menue.h | 2 +- 2 files changed, 39 insertions(+), 109 deletions(-) diff --git a/src/gui/widget/menue.cpp b/src/gui/widget/menue.cpp index e762f4b47..93b8f348f 100644 --- a/src/gui/widget/menue.cpp +++ b/src/gui/widget/menue.cpp @@ -326,7 +326,7 @@ void CMenuWidget::Init(const std::string & Icon, const int mwidth, const mn_widg iconfile = Icon; details_line = NULL; info_box = NULL; - + //handle select values if(w_index > MN_WIDGET_ID_MAX){ //error @@ -814,15 +814,15 @@ void CMenuWidget::calcSize() } #endif } - hint_height = 0; + hint_height = 70; //TODO: rework calculation of hint_height if(g_settings.show_menu_hints && has_hints) { int fheight = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_HINT]->getHeight(); - hint_height = 10 + 2*fheight; + int h_tmp = 10 + 2*fheight; /* assuming all hint icons has the same size ! */ int iw, ih; frameBuffer->getIconSize(NEUTRINO_ICON_HINT_TVMODE, &iw, &ih); - if(hint_height < (ih+10)) - hint_height = ih+10; + h_tmp = std::max(h_tmp, ih+10); + hint_height = std::max(h_tmp, hint_height); } /* set the max height to 9/10 of usable screen height debatable, if the callers need a possibility to set this */ @@ -1070,12 +1070,12 @@ void CMenuWidget::paintHint(int pos) { if (!g_settings.show_menu_hints) return; - + if (pos < 0 && !hint_painted) return; - + int rad = RADIUS_LARGE; - + int xpos = x - ConnectLineBox_Width; int ypos2 = y + height + rad + SHADOW_OFFSET + INFO_BOX_Y_OFFSET; int iwidth = width+sb_width; @@ -1111,10 +1111,9 @@ void CMenuWidget::paintHint(int pos) } if (pos < 0) return; - + CMenuItem* item = items[pos]; -//printf("paintHint: icon %s text %s\n", item->hintIcon.c_str(), g_Locale->getText(item->hint)); - + if (item->hintIcon.empty() && item->hint == NONEXISTANT_LOCALE) { #if 0 if (info_box != NULL) { @@ -1130,128 +1129,59 @@ void CMenuWidget::paintHint(int pos) #endif return; } - - hint_painted = true; - + + if (item->hint == NONEXISTANT_LOCALE) + return; + int iheight = item->getHeight(); - - //details line + + //init details line and infobox dimensions int ypos1 = item->getYPosition(); int ypos1a = ypos1 + (iheight/2)-2; int ypos2a = ypos2 + (hint_height/2) - INFO_BOX_Y_OFFSET; int markh = hint_height > rad*2 ? hint_height - rad*2 : hint_height; int imarkh = iheight/2+1; - if (details_line == NULL){ + //init details line + if (details_line == NULL) details_line = new CComponentsDetailLine(xpos, ypos1a, ypos2a, imarkh, markh); - }else{ + else{ details_line->setXPos(xpos); details_line->setYPos(ypos1a); details_line->setYPosDown(ypos2a); - details_line->setHMarkDown(markh); - details_line->syncSysColors(); + details_line->setHMarkDown(markh); } + details_line->syncSysColors(); #if 0 details_line->paint(savescreen); #endif - details_line->paint(); - - + + //init infobox if (info_box == NULL) - info_box = new CComponentsInfoBox(x, ypos2, iwidth, hint_height); - else { + info_box = new CComponentsInfoBox(x, ypos2, iwidth, hint_height, g_Locale->getText(item->hint), CTextBox::AUTO_WIDTH | CTextBox::AUTO_HIGH/*, g_Font[SNeutrinoSettings::FONT_TYPE_MENU_HINT]*/); + else{ info_box->setXPos(x); info_box->setYPos(ypos2); info_box->setWidth(iwidth); - info_box->setCornerRadius(RADIUS_LARGE); - info_box->syncSysColors(); - info_box->setShadowOnOff(CC_SHADOW_ON); + info_box->setText(g_Locale->getText(item->hint)); + } + info_box->setCornerRadius(RADIUS_LARGE); + info_box->syncSysColors(); + info_box->setShadowOnOff(CC_SHADOW_ON); + info_box->setPicture(item->hintIcon); #if 0 /* force full paint - menu-over i.e. option chooser with pulldown can overwrite */ info_box->paint(savescreen, true); #endif + + + //paint result + details_line->paint(); info_box->paint(); - - - int offset = 10; - if (!item->hintIcon.empty()) { - int iw, ih; - frameBuffer->getIconSize(item->hintIcon.c_str(), &iw, &ih); - if (iw && ih) { - int ix = x + offset; - int iy = ypos2 + (hint_height - ih)/2; - frameBuffer->paintIcon(item->hintIcon.c_str(), ix, iy); - offset += iw + 10; - } - } - if (item->hint == NONEXISTANT_LOCALE) - return; - - int HintFont = SNeutrinoSettings::FONT_TYPE_MENU_HINT; - int fheight = g_Font[HintFont]->getHeight(); - - std::string str1, str2; - std::string str = g_Locale->getText(item->hint); - std::string::size_type spos = str.find_first_of("\n"); - if (spos != std::string::npos) { - str1 = str.substr(0, spos); - str2 = str.substr(spos+1); - } - else - str1 = str; - - if ((!str1.empty()) || (!str1.empty())) { - int wBox = iwidth - 6 - offset; - int wStr1 = 0, wStr2 = 0; - if (!str1.empty()) - wStr1 = g_Font[HintFont]->getRenderWidth(str1); - if (!str2.empty()) - wStr2 = g_Font[HintFont]->getRenderWidth(str2); - if ((wStr1 > wBox) || (wStr2 > wBox)) { - str = g_Locale->getText(item->hint); - // replace "\n" with " " - spos = str.find_first_of("\n"); - if (spos != std::string::npos) - str.replace(spos, 1, " "); - spos = str.length(); - if (spos >= 1) { - std::string BreakChars = "+-/"; - str1 = str; - wStr1 = g_Font[HintFont]->getRenderWidth(str1); - int count = 0; - std::string bChar; - while (wStr1 > wBox) { - spos = str1.find_last_of(BreakChars + " "); - if (spos != std::string::npos) { - str1 = str1.substr(0, spos+1); - // Last delimiter remember if it's not a whitespace - size_t len = str1.length(); - size_t spos2 = str1.find_last_of(BreakChars); - if (len == spos2+1) - bChar = str1.substr(spos2, spos2+1); - else - bChar = ""; - // Remove last delimiter - str1 = str1.substr(0, spos); - } - // Width of string with delimiter - wStr1 = g_Font[HintFont]->getRenderWidth(str1 + bChar); - count++; - if (count > 20) - break; - } - // Last delimiter append again - str1 += bChar; - str2 = str.substr(spos+1); - } - } - ypos2 += (hint_height-fheight*2)/2; - if (!str1.empty()) - g_Font[HintFont]->RenderString(x+offset, ypos2+fheight, wBox, str1, COL_MENUCONTENT, 0, true); // UTF-8 - if (!str2.empty()) - g_Font[HintFont]->RenderString(x+offset, ypos2+fheight*2, wBox, str2, COL_MENUCONTENT, 0, true); // UTF-8 - } + + hint_painted = true; + } //------------------------------------------------------------------------------------------------------------------------------- diff --git a/src/gui/widget/menue.h b/src/gui/widget/menue.h index d5d33db33..8e43475f5 100644 --- a/src/gui/widget/menue.h +++ b/src/gui/widget/menue.h @@ -425,6 +425,7 @@ class CMenuWidget : public CMenuTarget CMenuGlobal *mglobal; CComponentsDetailLine *details_line; CComponentsInfoBox *info_box; + int hint_height; protected: std::string nameString; @@ -448,7 +449,6 @@ class CMenuWidget : public CMenuTarget fb_pixel_t *background; int full_width, full_height; bool savescreen; - int hint_height; bool has_hints; // is any items has hints bool hint_painted; // is hint painted From 1ac03645ccec7dd28132f0f92e06af7114879e75 Mon Sep 17 00:00:00 2001 From: micha-bbg Date: Mon, 20 Aug 2012 06:14:40 +0200 Subject: [PATCH 021/224] * CComponentsInfoBox: Add setTextBorderWidth() to paintText() - Add delete textbox to paint() - remove CTextBox::AUTO_HIGH --- src/gui/components/cc.h | 8 ++++---- src/gui/components/components.cpp | 9 +++++++-- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/src/gui/components/cc.h b/src/gui/components/cc.h index 01b84298c..c450635ff 100644 --- a/src/gui/components/cc.h +++ b/src/gui/components/cc.h @@ -207,15 +207,15 @@ class CComponentsInfoBox : public CComponentsContainer fb_pixel_t col_text; public: CComponentsInfoBox( const int x_pos, const int y_pos, const int w, const int h, - const char* info_text = NULL, const int mode = CTextBox::AUTO_WIDTH | CTextBox::AUTO_HIGH, Font* font_text = NULL, + const char* info_text = "", const int mode = CTextBox::AUTO_WIDTH, Font* font_text = NULL, bool has_shadow = CC_SHADOW_OFF, fb_pixel_t color_text = COL_MENUCONTENT, fb_pixel_t color_frame = COL_MENUCONTENT_PLUS_6, fb_pixel_t color_body = COL_MENUCONTENT_PLUS_0, fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0); ~CComponentsInfoBox(); - void setText(const char* info_text, const int mode = CTextBox::AUTO_WIDTH | CTextBox::AUTO_HIGH, Font* font_text = NULL){text = info_text; text_mode = mode, font = font_text;}; - void setText(const std::string& info_text, const int mode = CTextBox::AUTO_WIDTH | CTextBox::AUTO_HIGH, Font* font_text = NULL){text = info_text.c_str(); text_mode = mode, font = font_text;}; - void setText(neutrino_locale_t locale_text, const int mode = CTextBox::AUTO_WIDTH | CTextBox::AUTO_HIGH, Font* font_text = NULL); + void setText(const char* info_text, const int mode = CTextBox::AUTO_WIDTH, Font* font_text = NULL){text = info_text; text_mode = mode, font = font_text;}; + void setText(const std::string& info_text, const int mode = CTextBox::AUTO_WIDTH, Font* font_text = NULL){text = info_text.c_str(); text_mode = mode, font = font_text;}; + void setText(neutrino_locale_t locale_text, const int mode = CTextBox::AUTO_WIDTH, Font* font_text = NULL); void setTextMode(const int mode){text_mode = mode;};//see textbox.h for possible modes void setTextFont(Font* font_text){font = font_text;}; void setTextColor(fb_pixel_t color_text){ col_text = color_text;}; diff --git a/src/gui/components/components.cpp b/src/gui/components/components.cpp index 73996a151..a0e4bacf8 100644 --- a/src/gui/components/components.cpp +++ b/src/gui/components/components.cpp @@ -368,18 +368,23 @@ void CComponentsInfoBox::paintText() textbox = new CTextBox(text, font, text_mode, box, col_body); //set properties + textbox->setTextBorderWidth(0); textbox->movePosition(box->iX, box->iY); textbox->setTextColor(col_text); textbox->enableBackgroundPaint(false); //set text - string new_text = static_cast (text); - if (textbox->setText(&new_text)) +// string new_text = static_cast (text); +// if (textbox->setText(&text)) textbox->paint(); } void CComponentsInfoBox::paint(bool do_save_bg) { + if (textbox) { + delete textbox; + textbox = NULL; + } paintInit(do_save_bg); paintPicture(); if (text) From ff12f2b5b53c185fcc84e8be84e3bf95e7e886af Mon Sep 17 00:00:00 2001 From: micha-bbg Date: Mon, 20 Aug 2012 06:18:17 +0200 Subject: [PATCH 022/224] CMenuWidget: Remove line breaks from hint text - Add font to Constructor & setText() - remove CTextBox::AUTO_HIGH --- src/gui/widget/menue.cpp | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/src/gui/widget/menue.cpp b/src/gui/widget/menue.cpp index 93b8f348f..aa1f328da 100644 --- a/src/gui/widget/menue.cpp +++ b/src/gui/widget/menue.cpp @@ -814,10 +814,11 @@ void CMenuWidget::calcSize() } #endif } - hint_height = 70; //TODO: rework calculation of hint_height + hint_height = 0; if(g_settings.show_menu_hints && has_hints) { + hint_height = 60; //TODO: rework calculation of hint_height int fheight = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_HINT]->getHeight(); - int h_tmp = 10 + 2*fheight; + int h_tmp = 16 + 2*fheight; /* assuming all hint icons has the same size ! */ int iw, ih; frameBuffer->getIconSize(NEUTRINO_ICON_HINT_TVMODE, &iw, &ih); @@ -1075,7 +1076,7 @@ void CMenuWidget::paintHint(int pos) return; int rad = RADIUS_LARGE; - + int xpos = x - ConnectLineBox_Width; int ypos2 = y + height + rad + SHADOW_OFFSET + INFO_BOX_Y_OFFSET; int iwidth = width+sb_width; @@ -1155,15 +1156,23 @@ void CMenuWidget::paintHint(int pos) #if 0 details_line->paint(savescreen); #endif - + + // remove line breaks + std::string str = g_Locale->getText(item->hint); + std::string::size_type spos = str.find_first_of("\n"); + while (spos != std::string::npos) { + str.replace(spos, 1, " "); + spos = str.find_first_of("\n"); + } + //init infobox if (info_box == NULL) - info_box = new CComponentsInfoBox(x, ypos2, iwidth, hint_height, g_Locale->getText(item->hint), CTextBox::AUTO_WIDTH | CTextBox::AUTO_HIGH/*, g_Font[SNeutrinoSettings::FONT_TYPE_MENU_HINT]*/); + info_box = new CComponentsInfoBox(x, ypos2, iwidth, hint_height, str.c_str(), CTextBox::AUTO_WIDTH, g_Font[SNeutrinoSettings::FONT_TYPE_MENU_HINT]); else{ info_box->setXPos(x); info_box->setYPos(ypos2); info_box->setWidth(iwidth); - info_box->setText(g_Locale->getText(item->hint)); + info_box->setText(str, CTextBox::AUTO_WIDTH, g_Font[SNeutrinoSettings::FONT_TYPE_MENU_HINT]); } info_box->setCornerRadius(RADIUS_LARGE); From e233c7467e748c416a2279f67666a60069721ca5 Mon Sep 17 00:00:00 2001 From: micha-bbg Date: Mon, 20 Aug 2012 21:17:09 +0200 Subject: [PATCH 023/224] CComponentsInfoBox: Use setTextFont() in paintText() --- src/gui/components/components.cpp | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/src/gui/components/components.cpp b/src/gui/components/components.cpp index a0e4bacf8..aa406ef01 100644 --- a/src/gui/components/components.cpp +++ b/src/gui/components/components.cpp @@ -364,27 +364,25 @@ void CComponentsInfoBox::paintText() box->iHeight = height-2*fr_thickness; //init textbox - if (textbox == NULL) + if (textbox == NULL) { textbox = new CTextBox(text, font, text_mode, box, col_body); + textbox->setTextBorderWidth(0); + textbox->enableBackgroundPaint(false); + } //set properties - textbox->setTextBorderWidth(0); + textbox->setTextFont(font); textbox->movePosition(box->iX, box->iY); textbox->setTextColor(col_text); - textbox->enableBackgroundPaint(false); //set text -// string new_text = static_cast (text); -// if (textbox->setText(&text)) + string new_text = static_cast (text); + if (textbox->setText(&new_text)) textbox->paint(); } void CComponentsInfoBox::paint(bool do_save_bg) { - if (textbox) { - delete textbox; - textbox = NULL; - } paintInit(do_save_bg); paintPicture(); if (text) From af8c8f2c10113a65e97e73924997a5ea73d53e5c Mon Sep 17 00:00:00 2001 From: micha-bbg Date: Mon, 20 Aug 2012 22:21:28 +0200 Subject: [PATCH 024/224] * CComponentsInfoBox: Add removeLineBreaks() --- src/gui/components/cc.h | 3 ++- src/gui/components/components.cpp | 9 +++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/gui/components/cc.h b/src/gui/components/cc.h index c450635ff..5b964ed2e 100644 --- a/src/gui/components/cc.h +++ b/src/gui/components/cc.h @@ -221,7 +221,8 @@ class CComponentsInfoBox : public CComponentsContainer void setTextColor(fb_pixel_t color_text){ col_text = color_text;}; void setSpaceOffset(const int offset){x_offset = offset;}; void setPicture(const std::string& picture_name){pic_name = picture_name;}; - + void removeLineBreaks(std::string& str); + void paint(bool do_save_bg = CC_SAVE_SCREEN_YES); }; diff --git a/src/gui/components/components.cpp b/src/gui/components/components.cpp index aa406ef01..e95e103aa 100644 --- a/src/gui/components/components.cpp +++ b/src/gui/components/components.cpp @@ -390,6 +390,15 @@ void CComponentsInfoBox::paint(bool do_save_bg) text = NULL; } +void CComponentsInfoBox::removeLineBreaks(std::string& str) +{ + std::string::size_type spos = str.find_first_of("\r\n"); + while (spos != std::string::npos) { + str.replace(spos, 1, " "); + spos = str.find_first_of("\r\n"); + } +} + //------------------------------------------------------------------------------------------------------- //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) From 2101a328623faa659c19019710a47b78bc84cf81 Mon Sep 17 00:00:00 2001 From: micha-bbg Date: Mon, 20 Aug 2012 22:23:18 +0200 Subject: [PATCH 025/224] * CMenuWidget: Use removeLineBreaks() in paintHint() --- src/gui/widget/menue.cpp | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/src/gui/widget/menue.cpp b/src/gui/widget/menue.cpp index aa1f328da..3c2f334bf 100644 --- a/src/gui/widget/menue.cpp +++ b/src/gui/widget/menue.cpp @@ -1157,15 +1157,9 @@ void CMenuWidget::paintHint(int pos) details_line->paint(savescreen); #endif - // remove line breaks - std::string str = g_Locale->getText(item->hint); - std::string::size_type spos = str.find_first_of("\n"); - while (spos != std::string::npos) { - str.replace(spos, 1, " "); - spos = str.find_first_of("\n"); - } - //init infobox + std::string str = g_Locale->getText(item->hint); + info_box->removeLineBreaks(str); if (info_box == NULL) info_box = new CComponentsInfoBox(x, ypos2, iwidth, hint_height, str.c_str(), CTextBox::AUTO_WIDTH, g_Font[SNeutrinoSettings::FONT_TYPE_MENU_HINT]); else{ From 9aa0d14d39cfea41fce31906f8545ea5a305184e Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Wed, 22 Aug 2012 10:42:40 +0200 Subject: [PATCH 026/224] CComponentsInfoBox: add basic constructor without args usefull if dynamic changed properties are needed --- src/gui/components/cc.h | 1 + src/gui/components/components.cpp | 26 ++++++++++++++++++++++---- 2 files changed, 23 insertions(+), 4 deletions(-) diff --git a/src/gui/components/cc.h b/src/gui/components/cc.h index 5b964ed2e..dc31e3bcf 100644 --- a/src/gui/components/cc.h +++ b/src/gui/components/cc.h @@ -206,6 +206,7 @@ class CComponentsInfoBox : public CComponentsContainer std::string pic_name; fb_pixel_t col_text; public: + CComponentsInfoBox(); CComponentsInfoBox( const int x_pos, const int y_pos, const int w, const int h, const char* info_text = "", const int mode = CTextBox::AUTO_WIDTH, Font* font_text = NULL, bool has_shadow = CC_SHADOW_OFF, diff --git a/src/gui/components/components.cpp b/src/gui/components/components.cpp index e95e103aa..23881eda9 100644 --- a/src/gui/components/components.cpp +++ b/src/gui/components/components.cpp @@ -260,6 +260,26 @@ void CComponentsContainer::syncSysColors() //------------------------------------------------------------------------------------------------------- //sub class CComponentsInfoBox from CComponentsContainer +CComponentsInfoBox::CComponentsInfoBox() +{ + //CComponentsInfoBox + initVarInfobox(); + text = NULL; + text_mode = CTextBox::AUTO_WIDTH; + font = NULL; + 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, const char* info_text, const int mode, Font* font_text, bool has_shadow, @@ -271,7 +291,7 @@ CComponentsInfoBox::CComponentsInfoBox(const int x_pos, const int y_pos, const i text_mode = mode; font = font_text; col_text = color_text; - + //CComponents x = x_pos; y = y_pos; @@ -280,9 +300,7 @@ CComponentsInfoBox::CComponentsInfoBox(const int x_pos, const int y_pos, const i shadow = has_shadow; col_frame = color_frame; col_body = color_body; - col_shadow = color_shadow; - - + col_shadow = color_shadow; } CComponentsInfoBox::~CComponentsInfoBox() From 232933f9fcf74a69ca04b92340c6064dae21e703 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Wed, 22 Aug 2012 10:44:29 +0200 Subject: [PATCH 027/224] CComponentsInfoBox: create instance of CComponentsInfoBox in constructor --- src/gui/widget/menue.cpp | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/src/gui/widget/menue.cpp b/src/gui/widget/menue.cpp index 3c2f334bf..37d9028af 100644 --- a/src/gui/widget/menue.cpp +++ b/src/gui/widget/menue.cpp @@ -325,7 +325,7 @@ void CMenuWidget::Init(const std::string & Icon, const int mwidth, const mn_widg frameBuffer = CFrameBuffer::getInstance(); iconfile = Icon; details_line = NULL; - info_box = NULL; + info_box = new CComponentsInfoBox(); //handle select values if(w_index > MN_WIDGET_ID_MAX){ @@ -1159,20 +1159,14 @@ void CMenuWidget::paintHint(int pos) //init infobox std::string str = g_Locale->getText(item->hint); - info_box->removeLineBreaks(str); - if (info_box == NULL) - info_box = new CComponentsInfoBox(x, ypos2, iwidth, hint_height, str.c_str(), CTextBox::AUTO_WIDTH, g_Font[SNeutrinoSettings::FONT_TYPE_MENU_HINT]); - else{ - info_box->setXPos(x); - info_box->setYPos(ypos2); - info_box->setWidth(iwidth); + if (info_box){ + info_box->setDimensionsAll(x, ypos2, iwidth, hint_height); + info_box->removeLineBreaks(str); info_box->setText(str, CTextBox::AUTO_WIDTH, g_Font[SNeutrinoSettings::FONT_TYPE_MENU_HINT]); - - } - info_box->setCornerRadius(RADIUS_LARGE); - info_box->syncSysColors(); - info_box->setShadowOnOff(CC_SHADOW_ON); - info_box->setPicture(item->hintIcon); + info_box->setCornerRadius(RADIUS_LARGE); + info_box->syncSysColors(); + info_box->setShadowOnOff(CC_SHADOW_ON); + info_box->setPicture(item->hintIcon); #if 0 /* force full paint - menu-over i.e. option chooser with pulldown can overwrite */ info_box->paint(savescreen, true); From ee52053f2d2a4cf6630a3bf51294032d4f46cd33 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Wed, 22 Aug 2012 12:40:44 +0200 Subject: [PATCH 028/224] CComponentsDetailsLine: add basic constructor without args --- src/gui/components/cc.h | 7 +++++- src/gui/components/components.cpp | 37 +++++++++++++++++++++++++------ 2 files changed, 36 insertions(+), 8 deletions(-) diff --git a/src/gui/components/cc.h b/src/gui/components/cc.h index dc31e3bcf..e67c53c61 100644 --- a/src/gui/components/cc.h +++ b/src/gui/components/cc.h @@ -259,14 +259,18 @@ class CComponentsPIP : public CComponentsContainer void hide(bool no_restore = false); }; + class CComponentsDetailLine : public CComponents { private: int thickness, y_down, h_mark_top, h_mark_down; + + void initVar(); public: + CComponentsDetailLine(); CComponentsDetailLine( const int x_pos,const int y_pos_top, const int y_pos_down, - const int h_mark_up =16 , const int h_mark_down = 16, + const int h_mark_up = CC_HEIGHT_MIN , const int h_mark_down = CC_HEIGHT_MIN, fb_pixel_t color_line = COL_MENUCONTENT_PLUS_6, fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0); ~CComponentsDetailLine(); @@ -275,6 +279,7 @@ class CComponentsDetailLine : public CComponents void setColors(fb_pixel_t color_line, fb_pixel_t color_shadow){col_body = color_line; col_shadow = color_shadow;}; void syncSysColors(); void setYPosDown(const int& y_pos_down){y_down = y_pos_down;}; + void setHMarkTop(const int& h_mark_top_){h_mark_top = h_mark_top_;}; void setHMarkDown(const int& h_mark_down_){h_mark_down = h_mark_down_;}; }; diff --git a/src/gui/components/components.cpp b/src/gui/components/components.cpp index 23881eda9..40928b9c0 100644 --- a/src/gui/components/components.cpp +++ b/src/gui/components/components.cpp @@ -481,24 +481,47 @@ CComponentsShapeCircle::CComponentsShapeCircle( int x_pos, int y_pos, int diam, //------------------------------------------------------------------------------------------------------- //sub class CComponentsDetailLine from CComponents +CComponentsDetailLine::CComponentsDetailLine() +{ + initVar(); + + //CComponents + x = 0; + y = 0; + col_shadow = COL_MENUCONTENTDARK_PLUS_0; + col_body = COL_MENUCONTENT_PLUS_6; + + //CComponentsDetailLine + y_down = 0; + h_mark_top = CC_HEIGHT_MIN; + h_mark_down = CC_HEIGHT_MIN; +} + 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(); + //CComponents x = x_pos; y = y_pos_top; - width = CC_WIDTH_MIN; col_shadow = color_shadow; col_body = color_line; -// col_frame = COL_BACKGROUND; // not used in this class -// shadow = CC_SHADOW_OFF; // not used in this class - shadow_w = 1; - firstPaint = true; - v_fbdata.clear(); - + //CComponentsDetailLine y_down = y_pos_down; h_mark_top = h_mark_top_; h_mark_down = h_mark_down_; +} + +void CComponentsDetailLine::initVar() +{ + //CComponents + shadow_w = 1; + firstPaint = true; + v_fbdata.clear(); + width = CC_WIDTH_MIN; + + //CComponentsDetailLine thickness = 4; } From 12cb192341787d5af6397a53e73a7a38cb2f417f Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Wed, 22 Aug 2012 12:41:56 +0200 Subject: [PATCH 029/224] CMenuWidget: init instance of CComponentsDetailsLine in constructor --- src/gui/widget/menue.cpp | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/gui/widget/menue.cpp b/src/gui/widget/menue.cpp index 37d9028af..84ffc5a07 100644 --- a/src/gui/widget/menue.cpp +++ b/src/gui/widget/menue.cpp @@ -324,7 +324,7 @@ void CMenuWidget::Init(const std::string & Icon, const int mwidth, const mn_widg mglobal = CMenuGlobal::getInstance(); //create CMenuGlobal instance only here frameBuffer = CFrameBuffer::getInstance(); iconfile = Icon; - details_line = NULL; + details_line = new CComponentsDetailLine(); info_box = new CComponentsInfoBox(); //handle select values @@ -1144,15 +1144,13 @@ void CMenuWidget::paintHint(int pos) int imarkh = iheight/2+1; //init details line - if (details_line == NULL) - details_line = new CComponentsDetailLine(xpos, ypos1a, ypos2a, imarkh, markh); - else{ + if (details_line){ details_line->setXPos(xpos); details_line->setYPos(ypos1a); details_line->setYPosDown(ypos2a); + details_line->setHMarkTop(imarkh); details_line->setHMarkDown(markh); - } - details_line->syncSysColors(); + details_line->syncSysColors(); #if 0 details_line->paint(savescreen); #endif From d521cac9836b88b90f821df14932b74272f15598 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Thu, 23 Aug 2012 10:51:23 +0200 Subject: [PATCH 030/224] CComponents: add members to init inherit variables This sould enshure, that we have init with basic values in sub classes --- src/gui/components/cc.h | 7 +- src/gui/components/components.cpp | 150 +++++++++++++++--------------- 2 files changed, 80 insertions(+), 77 deletions(-) diff --git a/src/gui/components/cc.h b/src/gui/components/cc.h index e67c53c61..cc232047b 100644 --- a/src/gui/components/cc.h +++ b/src/gui/components/cc.h @@ -107,10 +107,12 @@ class CComponents bool firstPaint, shadow; BGMODE_TYPES bgMode; + void initVarBasic(); 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); comp_screen_data_t saved_screen; + void clearSavedScreen(); void clear(); public: CComponents(); @@ -144,6 +146,7 @@ class CComponentsContainer : public CComponents int corner_rad, fr_thickness; void hideContainer(bool no_restore = false); void paintInit(bool do_save_bg); + void initVarContainer(); public: CComponentsContainer(); @@ -170,7 +173,7 @@ class CComponentsPicture : public CComponentsContainer bool pic_paint, pic_paintBg, pic_painted, do_paint; int pic_align, pic_x, pic_y, pic_width, pic_height; - void initDimensions(); + void initVarPicture(); 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, @@ -265,7 +268,7 @@ class CComponentsDetailLine : public CComponents private: int thickness, y_down, h_mark_top, h_mark_down; - void initVar(); + void initVarDline(); public: CComponentsDetailLine(); diff --git a/src/gui/components/components.cpp b/src/gui/components/components.cpp index 40928b9c0..83d71fc56 100644 --- a/src/gui/components/components.cpp +++ b/src/gui/components/components.cpp @@ -41,19 +41,36 @@ using namespace std; //abstract basic class 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; y = saved_screen.y = 0; height = saved_screen.dy = CC_HEIGHT_MIN; width = saved_screen.dx = CC_WIDTH_MIN; - + col_body = COL_MENUCONTENT_PLUS_0; col_shadow = COL_MENUCONTENTDARK_PLUS_0; col_frame = COL_MENUCONTENT_PLUS_6; corner_type = CORNER_ALL; shadow = CC_SHADOW_OFF; shadow_w = SHADOW_OFFSET; - + firstPaint = true; frameBuffer = CFrameBuffer::getInstance(); v_fbdata.clear(); @@ -61,14 +78,6 @@ CComponents::CComponents() saved_screen.pixbuf = NULL; } -CComponents::~CComponents() -{ - hide(); - if (saved_screen.pixbuf) - delete[] saved_screen.pixbuf; - clear(); -} - //paint framebuffer stuff and fill buffer 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.dx = fbdata[i].dx; saved_screen.dy = fbdata[i].dy; - if (saved_screen.pixbuf) - delete[] saved_screen.pixbuf; + clearSavedScreen(); saved_screen.pixbuf = getScreen(saved_screen.x, saved_screen.y, saved_screen.dx, saved_screen.dy); } else { @@ -156,8 +164,7 @@ inline void CComponents::clear() CComponentsContainer::CComponentsContainer() { //CComponentsContainer - corner_rad = 0; - fr_thickness = 2; + initVarContainer(); } // y @@ -167,6 +174,15 @@ CComponentsContainer::CComponentsContainer() // | | // +--------width---------+ +void CComponentsContainer::initVarContainer() +{ + //CComponents + initVarBasic(); + + //ComponentsContainer + corner_rad = 0; + fr_thickness = 0; +} void CComponentsContainer::paintInit(bool do_save_bg) { @@ -262,22 +278,15 @@ void CComponentsContainer::syncSysColors() //sub class CComponentsInfoBox from CComponentsContainer CComponentsInfoBox::CComponentsInfoBox() { + //CComponents, ComponentsContainer + initVarContainer(); + //CComponentsInfoBox initVarInfobox(); text = NULL; text_mode = CTextBox::AUTO_WIDTH; font = NULL; 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, @@ -285,14 +294,9 @@ CComponentsInfoBox::CComponentsInfoBox(const int x_pos, const int y_pos, const i bool has_shadow, fb_pixel_t color_text, fb_pixel_t color_frame, fb_pixel_t color_body, fb_pixel_t color_shadow) { - //CComponentsInfoBox - initVarInfobox(); - text = info_text; - text_mode = mode; - font = font_text; - col_text = color_text; + //CComponents, ComponentsContainer + initVarContainer(); - //CComponents x = x_pos; y = y_pos; width = w; @@ -300,15 +304,20 @@ CComponentsInfoBox::CComponentsInfoBox(const int x_pos, const int y_pos, const i shadow = has_shadow; col_frame = color_frame; 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() { - hide(); -// if (saved_screen.pixbuf) -// delete[] saved_screen.pixbuf; + clearSavedScreen(); delete textbox; delete box; delete pic; @@ -317,15 +326,8 @@ CComponentsInfoBox::~CComponentsInfoBox() void CComponentsInfoBox::initVarInfobox() { - //CComponentsContainer - corner_rad = RADIUS_LARGE; - fr_thickness = 2; - - //CComponents - firstPaint = true; - v_fbdata.clear(); - bgMode = CC_BGMODE_PERMANENT; - shadow_w = SHADOW_OFFSET; + //CComponents, ComponentsContainer + initVarContainer(); //CComponentsInfoBox box = NULL; @@ -421,7 +423,9 @@ void CComponentsInfoBox::removeLineBreaks(std::string& str) //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) { - //CComponents + //ComponentsContainer + initVarContainer(); + x = x_pos; y = y_pos; width = w; @@ -435,9 +439,7 @@ CComponentsShapeSquare::CComponentsShapeSquare(const int x_pos, const int y_pos, v_fbdata.clear(); 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, fb_pixel_t color_frame, fb_pixel_t color_body, fb_pixel_t color_shadow) { - //CComponentsShapeCircle - d = diam; - + //CComponents, CComponentsContainer + initVarContainer(); + //CComponents x = x_pos; y = y_pos; @@ -461,10 +463,12 @@ CComponentsShapeCircle::CComponentsShapeCircle( int x_pos, int y_pos, int diam, firstPaint = true; v_fbdata.clear(); bgMode = CC_BGMODE_PERMANENT; - + + //CComponentsShapeCircle + d = diam; + //CComponentsContainer corner_rad = d/2; - fr_thickness = 0; } // y @@ -483,7 +487,7 @@ CComponentsShapeCircle::CComponentsShapeCircle( int x_pos, int y_pos, int diam, //sub class CComponentsDetailLine from CComponents CComponentsDetailLine::CComponentsDetailLine() { - initVar(); + initVarDline(); //CComponents 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) { - initVar(); + initVarDline(); //CComponents x = x_pos; @@ -513,13 +517,12 @@ CComponentsDetailLine::CComponentsDetailLine(const int x_pos, const int y_pos_to h_mark_down = h_mark_down_; } -void CComponentsDetailLine::initVar() +void CComponentsDetailLine::initVarDline() { //CComponents + initVarBasic(); + shadow_w = 1; - firstPaint = true; - v_fbdata.clear(); - width = CC_WIDTH_MIN; //CComponentsDetailLine thickness = 4; @@ -620,6 +623,9 @@ void CComponentsDetailLine::syncSysColors() //sub class CComponentsPIP from CComponentsContainer CComponentsPIP::CComponentsPIP( const int x_pos, const int y_pos, const int percent, bool has_shadow) { + //CComponents, CComponentsContainer + initVarContainer(); + //CComponentsPIP screen_w = frameBuffer->getScreenWidth(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; v_fbdata.clear(); bgMode = CC_BGMODE_PERMANENT; - - //CComponentsContainer - corner_rad = 0; - fr_thickness = 0; } CComponentsPIP::~CComponentsPIP() { hide(); -// if (saved_screen.pixbuf) -// delete[] saved_screen.pixbuf; + clearSavedScreen(); clear(); 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, fb_pixel_t color_frame, fb_pixel_t color_background, fb_pixel_t color_shadow) { + //CComponents, CComponentsContainer + initVarContainer(); + //CComponentsPicture pic_name = picture_name; pic_align = alignment; @@ -696,29 +700,25 @@ CComponentsPicture::CComponentsPicture( int x_pos, int y_pos, const string& pict v_fbdata.clear(); bgMode = CC_BGMODE_PERMANENT; - //CComponentsContainer - corner_rad = 0; - fr_thickness = 0; - - initDimensions(); + initVarPicture(); } void CComponentsPicture::setPicture(const std::string& picture_name) { pic_name = picture_name; - initDimensions(); + initVarPicture(); } void CComponentsPicture::setPictureAlign(const int alignment) { pic_align = alignment; - initDimensions(); + initVarPicture(); } -void CComponentsPicture::initDimensions() +void CComponentsPicture::initVarPicture() { pic_width = pic_height = 0; pic_painted = false; @@ -756,7 +756,7 @@ void CComponentsPicture::initDimensions() void CComponentsPicture::paint(bool do_save_bg) { - initDimensions(); + initVarPicture(); paintInit(do_save_bg); if (do_paint){ From 7df6748f744c1147a1d548c0dee49a420569fb34 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Thu, 23 Aug 2012 10:53:36 +0200 Subject: [PATCH 031/224] CMenuWidget: set frame thickness default value in CComponentsInfoBox is inherit from CComponentsContainer and =0, baut we need =2 --- src/gui/widget/menue.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/gui/widget/menue.cpp b/src/gui/widget/menue.cpp index 84ffc5a07..d3fa30e38 100644 --- a/src/gui/widget/menue.cpp +++ b/src/gui/widget/menue.cpp @@ -1159,6 +1159,7 @@ void CMenuWidget::paintHint(int pos) std::string str = g_Locale->getText(item->hint); if (info_box){ info_box->setDimensionsAll(x, ypos2, iwidth, hint_height); + info_box->setFrameThickness(2); info_box->removeLineBreaks(str); info_box->setText(str, CTextBox::AUTO_WIDTH, g_Font[SNeutrinoSettings::FONT_TYPE_MENU_HINT]); info_box->setCornerRadius(RADIUS_LARGE); From 200dce89c1c5d011500f4fe9336efb56cc152575 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Fri, 24 Aug 2012 21:44:55 +0200 Subject: [PATCH 032/224] Bedit: adapt to last CComponent changes --- src/gui/bedit/bouqueteditor_channels.cpp | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/src/gui/bedit/bouqueteditor_channels.cpp b/src/gui/bedit/bouqueteditor_channels.cpp index 8c55d1a22..aedcef717 100644 --- a/src/gui/bedit/bouqueteditor_channels.cpp +++ b/src/gui/bedit/bouqueteditor_channels.cpp @@ -84,7 +84,7 @@ CBEChannelWidget::CBEChannelWidget(const std::string & Caption, unsigned int Bou bouquet = Bouquet; mode = CZapitClient::MODE_TV; dline = NULL; - ibox = NULL; + ibox = new CComponentsInfoBox(); Channels = NULL; } @@ -209,7 +209,8 @@ void CBEChannelWidget::paintItem2DetailsLine (int pos, int /*ch_index*/) int ypos1a = ypos1 + (fheight/2)-2; int ypos2a = ypos2 + (info_height/2)-2; - clearItem2DetailsLine(); + if (dline) + dline->kill(); //kill details line // paint Line if detail info (and not valid list pos) if (pos >= 0) @@ -220,9 +221,18 @@ void CBEChannelWidget::paintItem2DetailsLine (int pos, int /*ch_index*/) dline->paint(); //infobox - if (ibox == NULL) - ibox = new CComponentsInfoBox(x, ypos2, width, info_height); + if (ibox){ + ibox->setDimensionsAll(x, ypos2, width, info_height); + ibox->setFrameThickness(2); +#if 0 ibox->paint(false,true); +#endif + ibox->setCornerRadius(RADIUS_LARGE); + ibox->syncSysColors(); + ibox->setShadowOnOff(CC_SHADOW_OFF); + } + + ibox->paint(false); } } @@ -237,7 +247,7 @@ void CBEChannelWidget::clearItem2DetailsLine() void CBEChannelWidget::hide() { frameBuffer->paintBackgroundBoxRel(x,y, width,height+footerHeight); - clearItem2DetailsLine (); + clearItem2DetailsLine (); } void CBEChannelWidget::updateSelection(unsigned int newpos) From e6eb91f706d3d41bda95272d8e886e246fe0cf9c Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Sat, 25 Aug 2012 01:42:48 +0200 Subject: [PATCH 033/224] CBEChannelWidget: use CComponentsInfoBox to paint text into infobox --- src/gui/bedit/bouqueteditor_channels.cpp | 41 +++++++++++++++--------- src/gui/bedit/bouqueteditor_channels.h | 3 +- 2 files changed, 28 insertions(+), 16 deletions(-) diff --git a/src/gui/bedit/bouqueteditor_channels.cpp b/src/gui/bedit/bouqueteditor_channels.cpp index aedcef717..72efda90d 100644 --- a/src/gui/bedit/bouqueteditor_channels.cpp +++ b/src/gui/bedit/bouqueteditor_channels.cpp @@ -106,7 +106,7 @@ void CBEChannelWidget::paintItem(int pos) bgcolor = COL_MENUCONTENTSELECTED_PLUS_0; if(current < Channels->size()) { - paintItem2DetailsLine (pos, current); + initItem2DetailsLine (pos, current); paintDetails(current); } @@ -184,22 +184,37 @@ void CBEChannelWidget::paintFoot() ::paintButtons(x, y + (height-footerHeight), width, 4, CBEChannelWidgetButtons, footerHeight); } -void CBEChannelWidget::paintDetails(int index) +std::string CBEChannelWidget::getInfoText(int index) { + std::string res = ""; + std::string satname = CServiceManager::getInstance()->GetSatelliteName((*Channels)[index]->getSatellitePosition()); transponder t; CServiceManager::getInstance()->GetTransponder((*Channels)[index]->getTransponderId(), t); std::string desc = t.description(); if((*Channels)[index]->pname) desc = desc + " (" + std::string((*Channels)[index]->pname) + ")"; - else + else desc = desc + " (" + satname + ")"; - - g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST]->RenderString(x+ 10, y+ height+ 5+ fheight+INFO_BOX_Y_OFFSET, width - 30, satname.c_str(), COL_MENUCONTENTDARK, 0, true); - g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST]->RenderString(x+ 10, y+ height+ 5+ 2*fheight+INFO_BOX_Y_OFFSET, width - 30, desc.c_str(), COL_MENUCONTENTDARK, 0, true); + + res = satname + "\n" + desc; + + return res; } -void CBEChannelWidget::paintItem2DetailsLine (int pos, int /*ch_index*/) +void CBEChannelWidget::paintDetails(int index) +{ + //details line + dline->paint(); + + std::string str = getInfoText(index); + + //info box + ibox->setText(str, CTextBox::AUTO_WIDTH | CTextBox::NO_AUTO_LINEBREAK, g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST]); + ibox->paint(false); +} + +void CBEChannelWidget::initItem2DetailsLine (int pos, int /*ch_index*/) { #define ConnectLineBox_Width 16 @@ -208,18 +223,17 @@ void CBEChannelWidget::paintItem2DetailsLine (int pos, int /*ch_index*/) int ypos2 = y + height + INFO_BOX_Y_OFFSET; int ypos1a = ypos1 + (fheight/2)-2; int ypos2a = ypos2 + (info_height/2)-2; - + if (dline) dline->kill(); //kill details line - - // paint Line if detail info (and not valid list pos) + + // init Line if detail info (and not valid list pos) if (pos >= 0) { if (dline == NULL) dline = new CComponentsDetailLine(xpos, ypos1a, ypos2a, fheight/2+1, info_height-RADIUS_LARGE*2); dline->setYPos(ypos1a); - dline->paint(); - + //infobox if (ibox){ ibox->setDimensionsAll(x, ypos2, width, info_height); @@ -228,11 +242,8 @@ void CBEChannelWidget::paintItem2DetailsLine (int pos, int /*ch_index*/) ibox->paint(false,true); #endif ibox->setCornerRadius(RADIUS_LARGE); - ibox->syncSysColors(); ibox->setShadowOnOff(CC_SHADOW_OFF); } - - ibox->paint(false); } } diff --git a/src/gui/bedit/bouqueteditor_channels.h b/src/gui/bedit/bouqueteditor_channels.h index d3132af0d..90d4d03d4 100644 --- a/src/gui/bedit/bouqueteditor_channels.h +++ b/src/gui/bedit/bouqueteditor_channels.h @@ -84,7 +84,7 @@ class CBEChannelWidget : public CMenuTarget void paintItem(int pos); void paintDetails(int index); - void paintItem2DetailsLine (int pos, int ch_index); + void initItem2DetailsLine (int pos, int ch_index); void clearItem2DetailsLine (); void paint(); void paintHead(); @@ -99,6 +99,7 @@ class CBEChannelWidget : public CMenuTarget void cancelMoveChannel(); void internalMoveChannel( unsigned int fromPosition, unsigned int toPosition); + std::string getInfoText(int index); public: CBEChannelWidget( const std::string & Caption, unsigned int Bouquet); ~CBEChannelWidget(); From 61ed9d48623382aa0e3b6aad75ee155d02f97263 Mon Sep 17 00:00:00 2001 From: micha-bbg Date: Fri, 24 Aug 2012 18:21:47 +0200 Subject: [PATCH 034/224] * CComponents::CComponentsPicture: Add the processing and scaling images --- src/gui/components/cc.h | 15 ++++++++- src/gui/components/components.cpp | 51 +++++++++++++++++++++++++------ 2 files changed, 56 insertions(+), 10 deletions(-) diff --git a/src/gui/components/cc.h b/src/gui/components/cc.h index cc232047b..c0786d66e 100644 --- a/src/gui/components/cc.h +++ b/src/gui/components/cc.h @@ -89,6 +89,12 @@ enum CC_ALIGN_VER_CENTER = 16 }; +enum +{ + CC_PIC_ICON, + CC_PIC_IMAGE +}; + #define CC_WIDTH_MIN 16 #define CC_HEIGHT_MIN 16 #define CC_SHADOW_ON true @@ -172,11 +178,18 @@ class CComponentsPicture : public CComponentsContainer unsigned char pic_offset; bool pic_paint, pic_paintBg, pic_painted, do_paint; int pic_align, pic_x, pic_y, pic_width, pic_height; + int maxWidth, maxHeight, picMode; void initVarPicture(); + void init( const int x_pos, const int y_pos, const std::string& picture_name, const int alignment, bool has_shadow, + fb_pixel_t color_frame, fb_pixel_t color_background, fb_pixel_t color_shadow); 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, + fb_pixel_t color_frame = COL_MENUCONTENT_PLUS_6, fb_pixel_t color_background = 0, fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0); + CComponentsPicture( const int x_pos, const int y_pos, const int w_max, const int h_max, + const std::string& picture_name, 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 setPictureOffset(const unsigned char offset){pic_offset = offset;}; void setPicturePaint(bool paint_p){pic_paint = paint_p;}; diff --git a/src/gui/components/components.cpp b/src/gui/components/components.cpp index 83d71fc56..9d5d58da9 100644 --- a/src/gui/components/components.cpp +++ b/src/gui/components/components.cpp @@ -31,10 +31,12 @@ #include #include #include "cc.h" +#include #include extern cVideo * videoDecoder; +extern CPictureViewer * g_PicViewer; using namespace std; @@ -669,8 +671,34 @@ void CComponentsPIP::hide(bool no_restore) //------------------------------------------------------------------------------------------------------- //sub class CComponentsPicture from CComponentsContainer -CComponentsPicture::CComponentsPicture( int x_pos, int y_pos, const string& picture_name, const int alignment, bool has_shadow, +CComponentsPicture::CComponentsPicture( const int x_pos, const int y_pos, + const std::string& picture_name, const int alignment, bool has_shadow, fb_pixel_t color_frame, fb_pixel_t color_background, fb_pixel_t color_shadow) +{ + init(x_pos, y_pos, picture_name, alignment, has_shadow, color_frame, color_background, color_shadow); + + maxWidth = 0; + maxHeight = 0; + picMode = CC_PIC_ICON; + + initVarPicture(); +} + +CComponentsPicture::CComponentsPicture( const int x_pos, const int y_pos, const int w_max, const int h_max, + const std::string& picture_name, const int alignment, bool has_shadow, + fb_pixel_t color_frame, fb_pixel_t color_background, fb_pixel_t color_shadow) +{ + init(x_pos, y_pos, picture_name, alignment, has_shadow, color_frame, color_background, color_shadow); + + maxWidth = w_max; + maxHeight = h_max; + picMode = CC_PIC_IMAGE; + + initVarPicture(); +} + +void CComponentsPicture::init( 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) { //CComponents, CComponentsContainer initVarContainer(); @@ -699,11 +727,8 @@ CComponentsPicture::CComponentsPicture( int x_pos, int y_pos, const string& pict firstPaint = true; v_fbdata.clear(); bgMode = CC_BGMODE_PERMANENT; - - initVarPicture(); } - void CComponentsPicture::setPicture(const std::string& picture_name) { pic_name = picture_name; @@ -723,15 +748,21 @@ void CComponentsPicture::initVarPicture() pic_width = pic_height = 0; pic_painted = false; do_paint = false; - - frameBuffer->getIconSize(pic_name.c_str(), &pic_width, &pic_height); + + if (picMode == CC_PIC_ICON) + frameBuffer->getIconSize(pic_name.c_str(), &pic_width, &pic_height); + else { + g_PicViewer->getSize(pic_name.c_str(), &pic_width, &pic_height); + if((pic_width > maxWidth) || (pic_height > maxHeight)) + g_PicViewer->rescaleImageDimensions(&pic_width, &pic_height, maxWidth, maxHeight); + } if (pic_width == 0 || pic_height == 0) printf("CComponentsPicture: %s file: %s, no icon dimensions found! width = %d, height = %d\n", __FUNCTION__, pic_name.c_str(), pic_width, pic_height); pic_x += fr_thickness; pic_y += fr_thickness; - + if (pic_height>0 && pic_width>0){ if (pic_align & CC_ALIGN_LEFT) pic_x = x+fr_thickness; @@ -760,8 +791,10 @@ void CComponentsPicture::paint(bool do_save_bg) paintInit(do_save_bg); if (do_paint){ - pic_painted = frameBuffer->paintIcon(pic_name, pic_x, pic_y, 0, pic_offset, pic_paint, pic_paintBg, col_body); + if (picMode == CC_PIC_ICON) + pic_painted = frameBuffer->paintIcon(pic_name, pic_x, pic_y, 0, pic_offset, pic_paint, pic_paintBg, col_body); + else + pic_painted = g_PicViewer->DisplayImage(pic_name, pic_x, pic_y, pic_width, pic_height); do_paint = false; } } - From 1a09bd719a86ff9563e5a0723c954774b1c236ec Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Sat, 25 Aug 2012 20:42:18 +0200 Subject: [PATCH 035/224] CBEChannelSelectWidget: use CComponentsInfoBox to paint infobox --- src/gui/bedit/bouqueteditor_chanselect.cpp | 48 ++++++++++++++-------- src/gui/bedit/bouqueteditor_chanselect.h | 5 ++- 2 files changed, 33 insertions(+), 20 deletions(-) diff --git a/src/gui/bedit/bouqueteditor_chanselect.cpp b/src/gui/bedit/bouqueteditor_chanselect.cpp index d012fbbe8..79ba2d8c6 100644 --- a/src/gui/bedit/bouqueteditor_chanselect.cpp +++ b/src/gui/bedit/bouqueteditor_chanselect.cpp @@ -73,7 +73,7 @@ CBEChannelSelectWidget::CBEChannelSelectWidget(const std::string & Caption, unsi liststart = 0; bouquetChannels = NULL; dline = NULL; - ibox = NULL; + ibox = new CComponentsInfoBox(); } CBEChannelSelectWidget::~CBEChannelSelectWidget() @@ -114,7 +114,7 @@ void CBEChannelSelectWidget::paintItem(uint32_t itemNr, int paintNr, bool pselec bgcolor = COL_MENUCONTENTSELECTED_PLUS_0; if(itemNr < getItemCount()) { - paintItem2DetailsLine (paintNr, itemNr); + initItem2DetailsLine (paintNr, itemNr); paintDetails(itemNr); } @@ -204,8 +204,10 @@ void CBEChannelSelectWidget::paintFoot() #endif } -void CBEChannelSelectWidget::paintDetails(int index) +std::string CBEChannelSelectWidget::getInfoText(int index) { + std::string res = ""; + std::string satname = CServiceManager::getInstance()->GetSatelliteName(Channels[index]->getSatellitePosition()); transponder t; CServiceManager::getInstance()->GetTransponder(Channels[index]->getTransponderId(), t); @@ -214,12 +216,25 @@ void CBEChannelSelectWidget::paintDetails(int index) desc = desc + " (" + std::string(Channels[index]->pname) + ")"; else desc = desc + " (" + satname + ")"; - - g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST]->RenderString(x+ 10, y+ height+ 5+ fheight+INFO_BOX_Y_OFFSET, width - 30, satname.c_str(), COL_MENUCONTENTDARK, 0, true); - g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST]->RenderString(x+ 10, y+ height+ 5+ 2*fheight+INFO_BOX_Y_OFFSET, width - 30, desc.c_str(), COL_MENUCONTENTDARK, 0, true); + + res = satname + "\n" + desc; + + return res; } -void CBEChannelSelectWidget::paintItem2DetailsLine (int pos, int /*ch_index*/) +void CBEChannelSelectWidget::paintDetails(int index) +{ + //details line + dline->paint(); + + std::string str = getInfoText(index); + + //info box + ibox->setText(str, CTextBox::AUTO_WIDTH | CTextBox::NO_AUTO_LINEBREAK, g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST]); + ibox->paint(false); +} + +void CBEChannelSelectWidget::initItem2DetailsLine (int pos, int /*ch_index*/) { #define ConnectLineBox_Width 16 @@ -229,26 +244,23 @@ void CBEChannelSelectWidget::paintItem2DetailsLine (int pos, int /*ch_index*/) int ypos1a = ypos1 + (fheight/2)-2; int ypos2a = ypos2 + (info_height/2)-2; - // clear details line if (dline) - dline->hide(); + dline->kill(); //kill details line - // clear infobox - if (ibox) - ibox->hide(); - - // paint Line if detail info (and not valid list pos) + // init Line if detail info (and not valid list pos) if (pos >= 0) { if (dline == NULL) dline = new CComponentsDetailLine(xpos, ypos1a, ypos2a, fheight/2+1, info_height-RADIUS_LARGE*2); dline->setYPos(ypos1a); - dline->paint(true); //infobox - if (ibox == NULL) - ibox = new CComponentsInfoBox(x, ypos2, width, info_height); - ibox->paint(false,true); + if (ibox){ + ibox->setDimensionsAll(x, ypos2, width, info_height); + ibox->setFrameThickness(2); + ibox->setCornerRadius(RADIUS_LARGE); + ibox->setShadowOnOff(CC_SHADOW_OFF); + } } } diff --git a/src/gui/bedit/bouqueteditor_chanselect.h b/src/gui/bedit/bouqueteditor_chanselect.h index 58ad2ebf3..729c3d7af 100644 --- a/src/gui/bedit/bouqueteditor_chanselect.h +++ b/src/gui/bedit/bouqueteditor_chanselect.h @@ -54,13 +54,14 @@ class CBEChannelSelectWidget : public CListBox uint getItemCount(); void paintItem(uint32_t itemNr, int paintNr, bool selected); void paintDetails(int index); - void paintItem2DetailsLine (int pos, int ch_index); + void initItem2DetailsLine (int pos, int ch_index); void paintFoot(); void onOkKeyPressed(); int footerHeight; int info_height; - + + std::string getInfoText(int index); public: ZapitChannelList Channels; ZapitChannelList * bouquetChannels; From d87c1c90714623cb630e1ae2140039ff7e925bcd Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Sat, 25 Aug 2012 20:55:07 +0200 Subject: [PATCH 036/224] CComponentsPicture: use DEBUG to show dimensions error --- src/gui/components/components.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/gui/components/components.cpp b/src/gui/components/components.cpp index 9d5d58da9..f75f363eb 100644 --- a/src/gui/components/components.cpp +++ b/src/gui/components/components.cpp @@ -757,12 +757,14 @@ void CComponentsPicture::initVarPicture() g_PicViewer->rescaleImageDimensions(&pic_width, &pic_height, maxWidth, maxHeight); } +#ifdef DEBUG if (pic_width == 0 || pic_height == 0) printf("CComponentsPicture: %s file: %s, no icon dimensions found! width = %d, height = %d\n", __FUNCTION__, pic_name.c_str(), pic_width, pic_height); - +#endif + pic_x += fr_thickness; pic_y += fr_thickness; - + if (pic_height>0 && pic_width>0){ if (pic_align & CC_ALIGN_LEFT) pic_x = x+fr_thickness; From c53a0a7ab4cf795b416a96f4a27b847fb3d94452 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Sat, 25 Aug 2012 21:35:42 +0200 Subject: [PATCH 037/224] CChannelList: adapt for new CComponentsInfoBox functionality TODO: paint text into infobox with CComponentsInfoBox --- src/gui/channellist.cpp | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/src/gui/channellist.cpp b/src/gui/channellist.cpp index a6ed738c7..dfc7a53e2 100644 --- a/src/gui/channellist.cpp +++ b/src/gui/channellist.cpp @@ -116,7 +116,7 @@ CChannelList::CChannelList(const char * const pName, bool phistoryMode, bool _vl previous_channellist_additional = -1; eventFont = SNeutrinoSettings::FONT_TYPE_CHANNELLIST_EVENT; dline = NULL; - ibox = NULL; + ibox = new CComponentsInfoBox(x, y + height + 2, width, info_height); //printf("************ NEW LIST %s : %x\n", name.c_str(), (int) this);fflush(stdout); } @@ -1523,16 +1523,12 @@ void CChannelList::paintDetails(int index) if (g_settings.colored_events_channellist == 2) colored_event_N = true; - if (displayNext) { + if (displayNext) p_event = &chanlist[index]->nextEvent; - } else { + else p_event = &chanlist[index]->currentEvent; - } //infobox - if (ibox == NULL) - ibox = new CComponentsInfoBox(x, y + height + 2, width, info_height); - ibox->setCornerRadius(RADIUS_LARGE); ibox->paint(false); if (!p_event->description.empty()) { @@ -1640,15 +1636,14 @@ void CChannelList::paintItem2DetailsLine (int pos) { int xpos = x - ConnectLineBox_Width; int ypos1 = y + theight+0 + pos*fheight; - int ypos2 = y + height; + int ypos2 = y + height + INFO_BOX_Y_OFFSET; int ypos1a = ypos1 + (fheight/2)-2; int ypos2a = ypos2 + (info_height/2)-2; - // Clear if (dline) - dline->hide(); + dline->kill(); //kill details line - // paint Line if detail info (and not valid list pos) - if (pos >= 0) { //pos >= 0 && chanlist[ch_index]->currentEvent.description != "") { + // init Line if detail info (and not valid list pos) + if (pos >= 0){ //pos >= 0 && chanlist[ch_index]->currentEvent.description != "") { if(1) // FIXME why -> ? (!g_settings.channellist_extended) { if (dline == NULL) @@ -1657,6 +1652,15 @@ void CChannelList::paintItem2DetailsLine (int pos) dline->setHMarkDown(info_height-RADIUS_LARGE*2); //required if user has changed osd-settings (corner mode) dline->paint(); } + + //infobox + if (ibox){ + ibox->setDimensionsAll(x, ypos2, width, info_height); + ibox->setFrameThickness(2); + ibox->setCornerRadius(RADIUS_LARGE); + ibox->setShadowOnOff(CC_SHADOW_OFF); + ibox->syncSysColors(); + } } } From 32f2f8a85d0a53e6e3ce55dd04668a845f7c4c30 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Sat, 25 Aug 2012 22:00:20 +0200 Subject: [PATCH 038/224] CChannelList: use own function to get transponder info --- src/gui/channellist.cpp | 26 ++++++++++++++++---------- src/gui/channellist.h | 1 + 2 files changed, 17 insertions(+), 10 deletions(-) diff --git a/src/gui/channellist.cpp b/src/gui/channellist.cpp index dfc7a53e2..b2e2abe66 100644 --- a/src/gui/channellist.cpp +++ b/src/gui/channellist.cpp @@ -1511,6 +1511,20 @@ void CChannelList::quickZap(int key, bool /* cycle */) g_RCInput->clearRCMsg(); //FIXME test for n.103 } +std::string CChannelList::getInfoTextTransponder(int index) +{ + transponder t; + CServiceManager::getInstance()->GetTransponder(chanlist[index]->getTransponderId(), t); + + std::string desc = t.description(); + if(chanlist[index]->pname) + desc = desc + " (" + std::string(chanlist[index]->pname) + ")"; + else + desc = desc + " (" + CServiceManager::getInstance()->GetSatelliteName(chanlist[index]->getSatellitePosition()) + ")"; + + return desc; +} + void CChannelList::paintDetails(int index) { CChannelEvent *p_event = NULL; @@ -1596,16 +1610,8 @@ void CChannelList::paintDetails(int index) g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST_DESCR]->RenderString(x+ full_width- 10- noch_len, y+ height+ 5+ 2* fheight, noch_len, cNoch, colored_event_C ? COL_COLORED_EVENTS_CHANNELLIST : COL_MENUCONTENTDARK, 0, true); // UTF-8 } if(g_settings.channellist_foot == 0) { - transponder t; - CServiceManager::getInstance()->GetTransponder(chanlist[index]->getTransponderId(), t); - - std::string desc = t.description(); - if(chanlist[index]->pname) - desc = desc + " (" + std::string(chanlist[index]->pname) + ")"; - else - desc = desc + " (" + CServiceManager::getInstance()->GetSatelliteName(chanlist[index]->getSatellitePosition()) + ")"; - - g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST]->RenderString(x+ 10, y+ height+ 5+ 3*fheight, full_width - 30, desc.c_str(), COL_MENUCONTENTDARK, 0, true); + std::string transp_info = getInfoTextTransponder(index); + g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST]->RenderString(x+ 10, y+ height+ 5+ 3*fheight, width - 30, transp_info.c_str(), COL_MENUCONTENTDARK, 0, true); } else if( !displayNext && g_settings.channellist_foot == 1) { // next Event char buf[128] = {0}; diff --git a/src/gui/channellist.h b/src/gui/channellist.h index ed660b77d..6994e6427 100644 --- a/src/gui/channellist.h +++ b/src/gui/channellist.h @@ -110,6 +110,7 @@ private: void showChannelLogo(); void calcSize(); std::string MaxChanNr(); + std::string getInfoTextTransponder(int index); void paint_pig(int x, int y, int w, int h); void paint_events(int index); CChannelEventList evtlist; From 4007cf4a6dc43698acf051c5e1a68e7d94684a67 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Sun, 26 Aug 2012 19:51:46 +0200 Subject: [PATCH 039/224] CTextBox: initialize variables in constructor (style) --- src/gui/widget/textbox.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/widget/textbox.h b/src/gui/widget/textbox.h index b7e8c1166..b3a34971e 100644 --- a/src/gui/widget/textbox.h +++ b/src/gui/widget/textbox.h @@ -72,7 +72,7 @@ class CBox public: /* Constructor */ - inline CBox(){iY = 0; iX = 0; iWidth = 0;iHeight = 0;}; + inline CBox(){iX=0; iY=0; iWidth=0; iHeight=0;}; inline CBox( const int _iX, const int _iY, const int _iWidth, const int _iHeight){iX=_iX; iY=_iY; iWidth=_iWidth; iHeight=_iHeight;}; inline ~CBox(){;}; /* Functions */ From b51ff8401ba40c36835023116e6f83da15b9bd14 Mon Sep 17 00:00:00 2001 From: micha-bbg Date: Fri, 24 Aug 2012 18:24:32 +0200 Subject: [PATCH 040/224] * CComponents: add class to place an paint titlebars --- src/gui/components/cc.h | 53 ++++++ src/gui/components/components.cpp | 292 ++++++++++++++++++++++++++++++ 2 files changed, 345 insertions(+) diff --git a/src/gui/components/cc.h b/src/gui/components/cc.h index c0786d66e..c7f693958 100644 --- a/src/gui/components/cc.h +++ b/src/gui/components/cc.h @@ -95,6 +95,27 @@ enum CC_PIC_IMAGE }; +enum +{ + CC_TITLEBAR_ICON, + CC_TITLEBAR_PICTURE, + CC_TITLEBAR_TEXT, + CC_TITLEBAR_CLOCK +}; + +typedef struct comp_element_data_t +{ + int type; + int align; + std::string element; + int x; + int y; + int width; + int height; + void* handler1; + void* handler2; +}comp_element_data_struct_t; + #define CC_WIDTH_MIN 16 #define CC_HEIGHT_MIN 16 #define CC_SHADOW_ON true @@ -299,4 +320,36 @@ class CComponentsDetailLine : public CComponents void setHMarkDown(const int& h_mark_down_){h_mark_down = h_mark_down_;}; }; +class CComponentsTitlebar : public CComponentsContainer +{ + private: + int hSpacer; + int hOffset; + int vOffset; + int digit_offset, digit_h; + Font* font; + bool paintElements; + fb_pixel_t col_text, col_body; + + void clearElements(); + void paintPic(CComponentsPicture* pic); + public: + CComponentsTitlebar( const int x_pos, const int y_pos, const int w, const int h, + fb_pixel_t color_text = COL_MENUHEAD, fb_pixel_t color_body = COL_MENUHEAD_PLUS_0); + + ~CComponentsTitlebar(); + + std::vector v_element_data; + + void setTextFont(Font* font_text){font = font_text;}; + void setTextColor(fb_pixel_t color_text){ col_text = color_text;}; + + void paint(bool do_save_bg = CC_SAVE_SCREEN_YES); + + size_t addElement(int align, int type, const std::string& element=""); + size_t addLogoOrText(int align, const std::string& logo, const std::string& text); + void calculateElements(); + void clearTitlebar(); +}; + #endif diff --git a/src/gui/components/components.cpp b/src/gui/components/components.cpp index f75f363eb..8c85746b9 100644 --- a/src/gui/components/components.cpp +++ b/src/gui/components/components.cpp @@ -800,3 +800,295 @@ void CComponentsPicture::paint(bool do_save_bg) do_paint = false; } } + +//------------------------------------------------------------------------------------------------------- +//sub class CComponentsTitlebar from CComponentsContainer +CComponentsTitlebar::CComponentsTitlebar( const int x_pos, const int y_pos, const int w, const int h, + fb_pixel_t /*color_text*/, fb_pixel_t /*color_body*/) +{ + //CComponents, CComponentsContainer + initVarContainer(); + + //CComponents + x = x_pos; + y = y_pos; + height = h; + width = w; + shadow = 0; + shadow_w = 0; +// col_body = color_body; + col_body = COL_MENUHEAD_PLUS_0; + firstPaint = true; + v_fbdata.clear(); + bgMode = CC_BGMODE_PERMANENT; + corner_type = CORNER_TOP; + corner_rad = RADIUS_LARGE; + + //CComponentsTitlebar +// col_text = color_text; + col_text = COL_MENUHEAD; + hSpacer = 2; + hOffset = 4; + vOffset = 1; + digit_h = 0; + digit_offset = 0; +// font = NULL; + font = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]; + paintElements = true; + v_element_data.clear(); +} + +CComponentsTitlebar::~CComponentsTitlebar() +{ + clearElements(); +} + +void CComponentsTitlebar::clearElements() +{ + for(size_t i = 0; i < v_element_data.size(); i++) { + switch (v_element_data[i].type) { + case CC_TITLEBAR_ICON: + case CC_TITLEBAR_PICTURE: + if (v_element_data[i].handler1 != NULL) + delete static_cast(v_element_data[i].handler1); + break; + case CC_TITLEBAR_TEXT: + if (v_element_data[i].handler1 != NULL) + delete static_cast(v_element_data[i].handler1); + if (v_element_data[i].handler2 != NULL) + delete static_cast(v_element_data[i].handler2); + break; + default: + break; + } + } + v_element_data.clear(); +} + +size_t CComponentsTitlebar::addLogoOrText(int align, const std::string& logo, const std::string& text) +{ + comp_element_data_t data; + + data.align = align; + data.x = x; + data.y = y; + data.width = 0; + data.height = 0; + data.handler1 = NULL; + data.handler2 = NULL; + + if (access(logo.c_str(), R_OK) == 0) { + // logo OK + g_PicViewer->getSize(logo.c_str(), &data.width, &data.height); + data.type = CC_TITLEBAR_PICTURE; + data.element = logo; + } + else { + // no logo + if (font != NULL) + data.height = font->getHeight(); + data.type = CC_TITLEBAR_TEXT; + data.element = text; + } + v_element_data.push_back(data); + return v_element_data.size()-1; +} + +size_t CComponentsTitlebar::addElement(int align, int type, const std::string& element) +{ + comp_element_data_t data; + + data.type = type; + data.align = align; + data.element = element; + data.x = x; + data.y = y; + data.width = 0; + data.height = 0; + data.handler1 = NULL; + data.handler2 = NULL; + + switch (type) + { + case CC_TITLEBAR_ICON: + frameBuffer->getIconSize(element.c_str(), &data.width, &data.height); + break; + case CC_TITLEBAR_PICTURE: + g_PicViewer->getSize(element.c_str(), &data.width, &data.height); + break; + case CC_TITLEBAR_TEXT: + if (font != NULL) + data.height = font->getHeight(); + break; + case CC_TITLEBAR_CLOCK: { + if (!g_Sectionsd->getIsTimeSet()) + break; + if (font != NULL) { + char timestr[10] = {0}; + time_t now = time(NULL); + struct tm *tm = localtime(&now); + strftime(timestr, sizeof(timestr)-1, "%H:%M", tm); + + digit_h = font->getDigitHeight(); + digit_offset = font->getDigitOffset(); + data.height = digit_h + (int)((float)digit_offset*1.5); +// data.width = font->getRenderWidth(widest_number)*4 + font->getRenderWidth(":"); + data.width = font->getRenderWidth(timestr); + data.element = timestr; + } + } + break; + default: + break; + } + v_element_data.push_back(data); + return v_element_data.size()-1; +} + +void CComponentsTitlebar::calculateElements() +{ +#define FIRST_ELEMENT_INIT 10000 + if (v_element_data.empty()) + return; + + int hMax = 0; + bool has_TextElement = false; + size_t firstElementLeft = FIRST_ELEMENT_INIT; + size_t firstElementRight = FIRST_ELEMENT_INIT; + size_t prevElementLeft = 0; + size_t prevElementRight = 0; + size_t i; + + // Calculate largest height without CC_TITLEBAR_PICTURE + for (i = 0; i < v_element_data.size(); i++) { + if ((firstElementLeft == FIRST_ELEMENT_INIT) && (v_element_data[i].align == CC_ALIGN_LEFT)) + firstElementLeft = i; + if ((firstElementRight == FIRST_ELEMENT_INIT) && (v_element_data[i].align == CC_ALIGN_RIGHT)) + firstElementRight = i; + if (v_element_data[i].type != CC_TITLEBAR_PICTURE) + hMax = max(v_element_data[i].height, hMax); + if (v_element_data[i].type == CC_TITLEBAR_TEXT) + has_TextElement = true; + } + if (!has_TextElement) + hMax = max(font->getHeight(), hMax); + + // Calculate logo + for (i = 0; i < v_element_data.size(); i++) { + if (v_element_data[i].type == CC_TITLEBAR_PICTURE) { + if((v_element_data[i].width > width/4) || (v_element_data[i].height > hMax)) + g_PicViewer->rescaleImageDimensions(&v_element_data[i].width, &v_element_data[i].height, width/4, hMax); + } + } + + // x-positions calculate + for (i = 0; i < v_element_data.size(); i++) { + if (firstElementLeft == i){ + prevElementLeft = i; + v_element_data[i].x += hOffset + corner_rad/2; + } + else if (firstElementRight == i){ + prevElementRight = i; + v_element_data[i].x += width - v_element_data[i].width - hOffset - corner_rad/2; + } + else { + if (v_element_data[i].align == CC_ALIGN_LEFT) { + // left elements + v_element_data[i].x = v_element_data[prevElementLeft].x + v_element_data[prevElementLeft].width + hSpacer; + prevElementLeft = i; + } + else { + // right elements + v_element_data[i].x = v_element_data[prevElementRight].x - v_element_data[i].width - hSpacer; + prevElementRight = i; + } + } + } + + // text width calculate + int allWidth = 0; + for (i = 0; i < v_element_data.size(); i++) { + if (v_element_data[i].type != CC_TITLEBAR_TEXT) + allWidth += v_element_data[i].width + hSpacer; + } + for (i = 0; i < v_element_data.size(); i++) { + if (v_element_data[i].type == CC_TITLEBAR_TEXT) { + v_element_data[i].width = width - (allWidth + 2*hSpacer); + break; + } + } + + // y-positions calculate + height = hMax + 2*vOffset; + for (i = 0; i < v_element_data.size(); i++) { + v_element_data[i].y = y + (height - v_element_data[i].height) / 2; + if (v_element_data[i].type == CC_TITLEBAR_TEXT) + v_element_data[i].y += v_element_data[i].height + v_element_data[i].height/14; + if (v_element_data[i].type == CC_TITLEBAR_CLOCK) + v_element_data[i].y += v_element_data[i].height + digit_offset/4; + } +} + +void CComponentsTitlebar::paint(bool do_save_bg) +{ + // paint background + paintInit(do_save_bg); + + if ((v_element_data.empty()) || (!paintElements)) + return; + + // paint elements + size_t i; + CComponentsPicture* pic = NULL; + for (i = 0; i < v_element_data.size(); i++) { + switch (v_element_data[i].type) { + case CC_TITLEBAR_ICON: + if (v_element_data[i].handler1 == NULL) { + pic = new CComponentsPicture(v_element_data[i].x, v_element_data[i].y, v_element_data[i].element); + v_element_data[i].handler1 = (void*)pic; + } + else + pic = static_cast(v_element_data[i].handler1); + paintPic(pic); + break; + case CC_TITLEBAR_PICTURE: + if (v_element_data[i].handler1 == NULL) { + pic = new CComponentsPicture( v_element_data[i].x, v_element_data[i].y, v_element_data[i].width, + v_element_data[i].height, v_element_data[i].element); + v_element_data[i].handler1 = (void*)pic; + } + else + pic = static_cast(v_element_data[i].handler1); + paintPic(pic); + break; + case CC_TITLEBAR_TEXT: + font->RenderString( v_element_data[i].x, v_element_data[i].y, v_element_data[i].width, + v_element_data[i].element.c_str(), col_text, 0, true); + break; + case CC_TITLEBAR_CLOCK: + font->RenderString( v_element_data[i].x, v_element_data[i].y, v_element_data[i].width, + v_element_data[i].element.c_str(), col_text); + break; + default: + break; + } + } +} + +void CComponentsTitlebar::clearTitlebar() +{ + clearElements(); + paintElements = false; + paint(false); + paintElements = true; +} + +void CComponentsTitlebar::paintPic(CComponentsPicture* pic) +{ + int pw, ph; + pic->getPictureSize(&pw, &ph); + pic->setHeight(ph); + pic->setWidth(pw); + pic->setColorBody(col_body); + pic->paint(); +} From 136885722a1c909535b40564ecb01c8373d42022 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Sun, 26 Aug 2012 11:15:04 +0200 Subject: [PATCH 041/224] CComponentsTitlebar: remove member col_body is allready inherit from basic class CComponents --- src/gui/components/cc.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/components/cc.h b/src/gui/components/cc.h index c7f693958..e735f5aa9 100644 --- a/src/gui/components/cc.h +++ b/src/gui/components/cc.h @@ -329,7 +329,7 @@ class CComponentsTitlebar : public CComponentsContainer int digit_offset, digit_h; Font* font; bool paintElements; - fb_pixel_t col_text, col_body; + fb_pixel_t col_text; void clearElements(); void paintPic(CComponentsPicture* pic); From 354d835156570fe4b116c14c378cbd5bfd465bf8 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Sun, 26 Aug 2012 12:50:13 +0200 Subject: [PATCH 042/224] CComponentsTitlebar: remove init of shadow is allready inititalized in initVarContainer() (initVarBasic()) with default value CC_SHADOW_OFF, --- src/gui/components/components.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/gui/components/components.cpp b/src/gui/components/components.cpp index 8c85746b9..1858be161 100644 --- a/src/gui/components/components.cpp +++ b/src/gui/components/components.cpp @@ -814,7 +814,6 @@ CComponentsTitlebar::CComponentsTitlebar( const int x_pos, const int y_pos, cons y = y_pos; height = h; width = w; - shadow = 0; shadow_w = 0; // col_body = color_body; col_body = COL_MENUHEAD_PLUS_0; From b8c5e2b6da6dee66fdc13a8bec7411760e661f45 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Sun, 26 Aug 2012 15:18:06 +0200 Subject: [PATCH 043/224] CComponents: add CComponentsItemBox as basich Class for CComponentsTitlebar --- src/gui/components/cc.h | 42 +++++++----- src/gui/components/components.cpp | 109 +++++++++++++++++------------- 2 files changed, 88 insertions(+), 63 deletions(-) diff --git a/src/gui/components/cc.h b/src/gui/components/cc.h index e735f5aa9..40ced2127 100644 --- a/src/gui/components/cc.h +++ b/src/gui/components/cc.h @@ -320,36 +320,44 @@ class CComponentsDetailLine : public CComponents void setHMarkDown(const int& h_mark_down_){h_mark_down = h_mark_down_;}; }; -class CComponentsTitlebar : public CComponentsContainer +class CComponentsItemBox : public CComponentsContainer { - private: + protected: int hSpacer; int hOffset; int vOffset; int digit_offset, digit_h; - Font* font; bool paintElements; fb_pixel_t col_text; - - void clearElements(); - void paintPic(CComponentsPicture* pic); - public: - CComponentsTitlebar( const int x_pos, const int y_pos, const int w, const int h, - fb_pixel_t color_text = COL_MENUHEAD, fb_pixel_t color_body = COL_MENUHEAD_PLUS_0); - - ~CComponentsTitlebar(); - + Font* font_text; std::vector v_element_data; - void setTextFont(Font* font_text){font = font_text;}; + void clearElements(); + void paintPic(CComponentsPicture* pic); + void initVarItemBox(); + + public: + CComponentsItemBox(); + virtual ~CComponentsItemBox(); + + void setTextFont(Font* font){font_text = font;}; void setTextColor(fb_pixel_t color_text){ col_text = color_text;}; void paint(bool do_save_bg = CC_SAVE_SCREEN_YES); - size_t addElement(int align, int type, const std::string& element=""); - size_t addLogoOrText(int align, const std::string& logo, const std::string& text); - void calculateElements(); - void clearTitlebar(); + virtual size_t addElement(int align, int type, const std::string& element=""); + virtual size_t addLogoOrText(int align, const std::string& logo, const std::string& text); + virtual void calculateElements(); + virtual void clearTitlebar(); + +}; + +class CComponentsTitleBar : public CComponentsItemBox +{ + public: + CComponentsTitleBar( const int x_pos, const int y_pos, const int w, const int h, + fb_pixel_t color_text = COL_MENUHEAD, fb_pixel_t color_body = COL_MENUHEAD_PLUS_0); + }; #endif diff --git a/src/gui/components/components.cpp b/src/gui/components/components.cpp index 1858be161..0251cf6d0 100644 --- a/src/gui/components/components.cpp +++ b/src/gui/components/components.cpp @@ -802,47 +802,40 @@ void CComponentsPicture::paint(bool do_save_bg) } //------------------------------------------------------------------------------------------------------- -//sub class CComponentsTitlebar from CComponentsContainer -CComponentsTitlebar::CComponentsTitlebar( const int x_pos, const int y_pos, const int w, const int h, - fb_pixel_t /*color_text*/, fb_pixel_t /*color_body*/) +//sub class CComponentsItemBox from CComponentsContainer +CComponentsItemBox::CComponentsItemBox( /*const int x_pos, const int y_pos, const int w, const int h, + fb_pixel_t color_text, fb_pixel_t color_body*/) +{ + //CComponentsItemBox + initVarItemBox(); +} + +CComponentsItemBox::~CComponentsItemBox() +{ + hide(); + clearElements(); + clearSavedScreen(); + clear(); +} + +void CComponentsItemBox::initVarItemBox() { //CComponents, CComponentsContainer initVarContainer(); - //CComponents - x = x_pos; - y = y_pos; - height = h; - width = w; - shadow_w = 0; -// col_body = color_body; - col_body = COL_MENUHEAD_PLUS_0; - firstPaint = true; - v_fbdata.clear(); - bgMode = CC_BGMODE_PERMANENT; - corner_type = CORNER_TOP; - corner_rad = RADIUS_LARGE; - - //CComponentsTitlebar -// col_text = color_text; - col_text = COL_MENUHEAD; + //CComponentsItemBox + col_text = COL_MENUCONTENT; hSpacer = 2; hOffset = 4; vOffset = 1; digit_h = 0; digit_offset = 0; -// font = NULL; - font = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]; + font_text = NULL; paintElements = true; v_element_data.clear(); } -CComponentsTitlebar::~CComponentsTitlebar() -{ - clearElements(); -} - -void CComponentsTitlebar::clearElements() +void CComponentsItemBox::clearElements() { for(size_t i = 0; i < v_element_data.size(); i++) { switch (v_element_data[i].type) { @@ -864,7 +857,7 @@ void CComponentsTitlebar::clearElements() v_element_data.clear(); } -size_t CComponentsTitlebar::addLogoOrText(int align, const std::string& logo, const std::string& text) +size_t CComponentsItemBox::addLogoOrText(int align, const std::string& logo, const std::string& text) { comp_element_data_t data; @@ -884,8 +877,8 @@ size_t CComponentsTitlebar::addLogoOrText(int align, const std::string& logo, co } else { // no logo - if (font != NULL) - data.height = font->getHeight(); + if (font_text != NULL) + data.height = font_text->getHeight(); data.type = CC_TITLEBAR_TEXT; data.element = text; } @@ -893,7 +886,7 @@ size_t CComponentsTitlebar::addLogoOrText(int align, const std::string& logo, co return v_element_data.size()-1; } -size_t CComponentsTitlebar::addElement(int align, int type, const std::string& element) +size_t CComponentsItemBox::addElement(int align, int type, const std::string& element) { comp_element_data_t data; @@ -916,23 +909,23 @@ size_t CComponentsTitlebar::addElement(int align, int type, const std::string& e g_PicViewer->getSize(element.c_str(), &data.width, &data.height); break; case CC_TITLEBAR_TEXT: - if (font != NULL) - data.height = font->getHeight(); + if (font_text != NULL) + data.height = font_text->getHeight(); break; case CC_TITLEBAR_CLOCK: { if (!g_Sectionsd->getIsTimeSet()) break; - if (font != NULL) { + if (font_text != NULL) { char timestr[10] = {0}; time_t now = time(NULL); struct tm *tm = localtime(&now); strftime(timestr, sizeof(timestr)-1, "%H:%M", tm); - digit_h = font->getDigitHeight(); - digit_offset = font->getDigitOffset(); + digit_h = font_text->getDigitHeight(); + digit_offset = font_text->getDigitOffset(); data.height = digit_h + (int)((float)digit_offset*1.5); -// data.width = font->getRenderWidth(widest_number)*4 + font->getRenderWidth(":"); - data.width = font->getRenderWidth(timestr); +// data.width = font_text->getRenderWidth(widest_number)*4 + font_text->getRenderWidth(":"); + data.width = font_text->getRenderWidth(timestr); data.element = timestr; } } @@ -944,7 +937,7 @@ size_t CComponentsTitlebar::addElement(int align, int type, const std::string& e return v_element_data.size()-1; } -void CComponentsTitlebar::calculateElements() +void CComponentsItemBox::calculateElements() { #define FIRST_ELEMENT_INIT 10000 if (v_element_data.empty()) @@ -970,7 +963,7 @@ void CComponentsTitlebar::calculateElements() has_TextElement = true; } if (!has_TextElement) - hMax = max(font->getHeight(), hMax); + hMax = max(font_text->getHeight(), hMax); // Calculate logo for (i = 0; i < v_element_data.size(); i++) { @@ -1028,7 +1021,7 @@ void CComponentsTitlebar::calculateElements() } } -void CComponentsTitlebar::paint(bool do_save_bg) +void CComponentsItemBox::paint(bool do_save_bg) { // paint background paintInit(do_save_bg); @@ -1061,11 +1054,11 @@ void CComponentsTitlebar::paint(bool do_save_bg) paintPic(pic); break; case CC_TITLEBAR_TEXT: - font->RenderString( v_element_data[i].x, v_element_data[i].y, v_element_data[i].width, + font_text->RenderString(v_element_data[i].x, v_element_data[i].y, v_element_data[i].width, v_element_data[i].element.c_str(), col_text, 0, true); break; case CC_TITLEBAR_CLOCK: - font->RenderString( v_element_data[i].x, v_element_data[i].y, v_element_data[i].width, + font_text->RenderString(v_element_data[i].x, v_element_data[i].y, v_element_data[i].width, v_element_data[i].element.c_str(), col_text); break; default: @@ -1074,7 +1067,7 @@ void CComponentsTitlebar::paint(bool do_save_bg) } } -void CComponentsTitlebar::clearTitlebar() +void CComponentsItemBox::clearTitlebar() { clearElements(); paintElements = false; @@ -1082,7 +1075,7 @@ void CComponentsTitlebar::clearTitlebar() paintElements = true; } -void CComponentsTitlebar::paintPic(CComponentsPicture* pic) +void CComponentsItemBox::paintPic(CComponentsPicture* pic) { int pw, ph; pic->getPictureSize(&pw, &ph); @@ -1091,3 +1084,27 @@ void CComponentsTitlebar::paintPic(CComponentsPicture* pic) pic->setColorBody(col_body); pic->paint(); } + +//------------------------------------------------------------------------------------------------------- +//sub class CComponentsTitleBar from CComponentsItemBox +CComponentsTitleBar::CComponentsTitleBar(const int x_pos, const int y_pos, const int w, const int h, + fb_pixel_t color_text, fb_pixel_t color_body) +{ + //CComponentsItemBox + initVarItemBox(); + + //CComponents + x = x_pos; + y = y_pos; + height = h; + width = w; + col_body = color_body; + corner_type = CORNER_TOP; + corner_rad = RADIUS_LARGE; + + //CComponentsTitleBar + font_text = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]; + col_text = color_text; +// col_text = COL_MENUHEAD; +} + From 758fda514a62266522da584981ec9e0adfe1a05e Mon Sep 17 00:00:00 2001 From: micha-bbg Date: Sun, 26 Aug 2012 23:35:34 +0200 Subject: [PATCH 044/224] * CComponents: Adjustments for CComponentsItemBox and CComponentsTitleBar --- src/gui/components/cc.h | 24 ++- src/gui/components/components.cpp | 253 ++++++++++++++++++------------ 2 files changed, 169 insertions(+), 108 deletions(-) diff --git a/src/gui/components/cc.h b/src/gui/components/cc.h index 40ced2127..ee8521506 100644 --- a/src/gui/components/cc.h +++ b/src/gui/components/cc.h @@ -97,10 +97,10 @@ enum enum { - CC_TITLEBAR_ICON, - CC_TITLEBAR_PICTURE, - CC_TITLEBAR_TEXT, - CC_TITLEBAR_CLOCK + CC_ITEMBOX_ICON, + CC_ITEMBOX_PICTURE, + CC_ITEMBOX_TEXT, + CC_ITEMBOX_CLOCK }; typedef struct comp_element_data_t @@ -320,6 +320,7 @@ class CComponentsDetailLine : public CComponents void setHMarkDown(const int& h_mark_down_){h_mark_down = h_mark_down_;}; }; +#define FIRST_ELEMENT_INIT 10000 class CComponentsItemBox : public CComponentsContainer { protected: @@ -328,13 +329,22 @@ class CComponentsItemBox : public CComponentsContainer int vOffset; int digit_offset, digit_h; bool paintElements; + bool onlyOneTextElement; fb_pixel_t col_text; Font* font_text; + int hMax; + bool has_TextElement; + size_t firstElementLeft; + size_t firstElementRight; + size_t prevElementLeft; + size_t prevElementRight; std::vector v_element_data; void clearElements(); void paintPic(CComponentsPicture* pic); void initVarItemBox(); + void calculateElementsInitPart1(); + void calculateElementsInitPart2(); public: CComponentsItemBox(); @@ -345,9 +355,8 @@ class CComponentsItemBox : public CComponentsContainer void paint(bool do_save_bg = CC_SAVE_SCREEN_YES); - virtual size_t addElement(int align, int type, const std::string& element=""); - virtual size_t addLogoOrText(int align, const std::string& logo, const std::string& text); - virtual void calculateElements(); + virtual bool addElement(int align, int type, const std::string& element="", size_t *index=NULL); + virtual bool addLogoOrText(int align, const std::string& logo, const std::string& text, size_t *index=NULL); virtual void clearTitlebar(); }; @@ -357,6 +366,7 @@ class CComponentsTitleBar : public CComponentsItemBox public: CComponentsTitleBar( const int x_pos, const int y_pos, const int w, const int h, fb_pixel_t color_text = COL_MENUHEAD, fb_pixel_t color_body = COL_MENUHEAD_PLUS_0); + void calculateElements(); }; diff --git a/src/gui/components/components.cpp b/src/gui/components/components.cpp index 0251cf6d0..1521310a4 100644 --- a/src/gui/components/components.cpp +++ b/src/gui/components/components.cpp @@ -824,14 +824,21 @@ void CComponentsItemBox::initVarItemBox() initVarContainer(); //CComponentsItemBox - col_text = COL_MENUCONTENT; - hSpacer = 2; - hOffset = 4; - vOffset = 1; - digit_h = 0; - digit_offset = 0; - font_text = NULL; - paintElements = true; + col_text = COL_MENUCONTENT; + hSpacer = 2; + hOffset = 4; + vOffset = 1; + digit_h = 0; + digit_offset = 0; + font_text = NULL; + paintElements = true; + hMax = 0; + has_TextElement = false; + firstElementLeft = FIRST_ELEMENT_INIT; + firstElementRight = FIRST_ELEMENT_INIT; + prevElementLeft = 0; + prevElementRight = 0; + onlyOneTextElement = false; v_element_data.clear(); } @@ -839,12 +846,12 @@ void CComponentsItemBox::clearElements() { for(size_t i = 0; i < v_element_data.size(); i++) { switch (v_element_data[i].type) { - case CC_TITLEBAR_ICON: - case CC_TITLEBAR_PICTURE: + case CC_ITEMBOX_ICON: + case CC_ITEMBOX_PICTURE: if (v_element_data[i].handler1 != NULL) delete static_cast(v_element_data[i].handler1); break; - case CC_TITLEBAR_TEXT: + case CC_ITEMBOX_TEXT: if (v_element_data[i].handler1 != NULL) delete static_cast(v_element_data[i].handler1); if (v_element_data[i].handler2 != NULL) @@ -857,9 +864,10 @@ void CComponentsItemBox::clearElements() v_element_data.clear(); } -size_t CComponentsItemBox::addLogoOrText(int align, const std::string& logo, const std::string& text) +bool CComponentsItemBox::addLogoOrText(int align, const std::string& logo, const std::string& text, size_t *index) { comp_element_data_t data; + int dx=0, dy=0; data.align = align; data.x = x; @@ -869,26 +877,56 @@ size_t CComponentsItemBox::addLogoOrText(int align, const std::string& logo, con data.handler1 = NULL; data.handler2 = NULL; - if (access(logo.c_str(), R_OK) == 0) { + g_PicViewer->getSize(logo.c_str(), &dx, &dy); + if ((dx != 0) && (dy != 0)) { // logo OK - g_PicViewer->getSize(logo.c_str(), &data.width, &data.height); - data.type = CC_TITLEBAR_PICTURE; + data.type = CC_ITEMBOX_PICTURE; data.element = logo; } else { // no logo + if ((text == "") || ((onlyOneTextElement) && (has_TextElement))) + return false; + else + has_TextElement = true; if (font_text != NULL) data.height = font_text->getHeight(); - data.type = CC_TITLEBAR_TEXT; + data.type = CC_ITEMBOX_TEXT; data.element = text; } + v_element_data.push_back(data); - return v_element_data.size()-1; + if (index != NULL) + *index = v_element_data.size()-1; + return true; } -size_t CComponentsItemBox::addElement(int align, int type, const std::string& element) +bool CComponentsItemBox::addElement(int align, int type, const std::string& element, size_t *index) { comp_element_data_t data; + int dx=0, dy=0; + + switch (type) + { + case CC_ITEMBOX_ICON: + frameBuffer->getIconSize(element.c_str(), &dx, &dy); + if ((dx == 0) || (dy == 0)) + return false; + break; + case CC_ITEMBOX_PICTURE: + g_PicViewer->getSize(element.c_str(), &dx, &dy); + if ((dx == 0) || (dy == 0)) + return false; + break; + case CC_ITEMBOX_TEXT: + if ((element == "") || ((onlyOneTextElement) && (has_TextElement))) + return false; + else + has_TextElement = true; + break; + default: + break; + } data.type = type; data.align = align; @@ -900,80 +938,81 @@ size_t CComponentsItemBox::addElement(int align, int type, const std::string& el data.handler1 = NULL; data.handler2 = NULL; - switch (type) - { - case CC_TITLEBAR_ICON: - frameBuffer->getIconSize(element.c_str(), &data.width, &data.height); - break; - case CC_TITLEBAR_PICTURE: - g_PicViewer->getSize(element.c_str(), &data.width, &data.height); - break; - case CC_TITLEBAR_TEXT: - if (font_text != NULL) - data.height = font_text->getHeight(); - break; - case CC_TITLEBAR_CLOCK: { - if (!g_Sectionsd->getIsTimeSet()) - break; - if (font_text != NULL) { - char timestr[10] = {0}; - time_t now = time(NULL); - struct tm *tm = localtime(&now); - strftime(timestr, sizeof(timestr)-1, "%H:%M", tm); - - digit_h = font_text->getDigitHeight(); - digit_offset = font_text->getDigitOffset(); - data.height = digit_h + (int)((float)digit_offset*1.5); -// data.width = font_text->getRenderWidth(widest_number)*4 + font_text->getRenderWidth(":"); - data.width = font_text->getRenderWidth(timestr); - data.element = timestr; - } - } - break; - default: - break; - } v_element_data.push_back(data); - return v_element_data.size()-1; + if (index != NULL) + *index = v_element_data.size()-1; + return true; } -void CComponentsItemBox::calculateElements() +void CComponentsItemBox::calculateElementsInitPart1() { -#define FIRST_ELEMENT_INIT 10000 - if (v_element_data.empty()) - return; - - int hMax = 0; - bool has_TextElement = false; - size_t firstElementLeft = FIRST_ELEMENT_INIT; - size_t firstElementRight = FIRST_ELEMENT_INIT; - size_t prevElementLeft = 0; - size_t prevElementRight = 0; size_t i; - // Calculate largest height without CC_TITLEBAR_PICTURE + // Set element size + for (i = 0; i < v_element_data.size(); i++) { + switch (v_element_data[i].type) + { + case CC_ITEMBOX_ICON: + frameBuffer->getIconSize(v_element_data[i].element.c_str(), &v_element_data[i].width, &v_element_data[i].height); + break; + case CC_ITEMBOX_PICTURE: + g_PicViewer->getSize(v_element_data[i].element.c_str(), &v_element_data[i].width, &v_element_data[i].height); + break; + case CC_ITEMBOX_TEXT: + if (font_text != NULL) + v_element_data[i].height = font_text->getHeight(); + break; + case CC_ITEMBOX_CLOCK: { + if (!g_Sectionsd->getIsTimeSet()) + break; + if (font_text != NULL) { + char timestr[10] = {0}; + time_t now = time(NULL); + struct tm *tm = localtime(&now); + strftime(timestr, sizeof(timestr)-1, "%H:%M", tm); + + digit_h = font_text->getDigitHeight(); + digit_offset = font_text->getDigitOffset(); + v_element_data[i].height = digit_h + (int)((float)digit_offset*1.5); +// v_element_data[i].width = font_text->getRenderWidth(widest_number)*4 + font->getRenderWidth(":"); + v_element_data[i].width = font_text->getRenderWidth(timestr); + v_element_data[i].element = timestr; + } + } + break; + default: + break; + } + } + + // Calculate largest height without CC_ITEMBOX_PICTURE for (i = 0; i < v_element_data.size(); i++) { if ((firstElementLeft == FIRST_ELEMENT_INIT) && (v_element_data[i].align == CC_ALIGN_LEFT)) firstElementLeft = i; if ((firstElementRight == FIRST_ELEMENT_INIT) && (v_element_data[i].align == CC_ALIGN_RIGHT)) firstElementRight = i; - if (v_element_data[i].type != CC_TITLEBAR_PICTURE) + if (v_element_data[i].type != CC_ITEMBOX_PICTURE) hMax = max(v_element_data[i].height, hMax); - if (v_element_data[i].type == CC_TITLEBAR_TEXT) - has_TextElement = true; } if (!has_TextElement) hMax = max(font_text->getHeight(), hMax); +} - // Calculate logo +void CComponentsItemBox::calculateElementsInitPart2() +{ + size_t i; + + // Calculate y-positions + height = hMax + 2*vOffset; for (i = 0; i < v_element_data.size(); i++) { - if (v_element_data[i].type == CC_TITLEBAR_PICTURE) { - if((v_element_data[i].width > width/4) || (v_element_data[i].height > hMax)) - g_PicViewer->rescaleImageDimensions(&v_element_data[i].width, &v_element_data[i].height, width/4, hMax); - } + v_element_data[i].y = y + (height - v_element_data[i].height) / 2; + if (v_element_data[i].type == CC_ITEMBOX_TEXT) + v_element_data[i].y += v_element_data[i].height + v_element_data[i].height/14; + if (v_element_data[i].type == CC_ITEMBOX_CLOCK) + v_element_data[i].y += v_element_data[i].height + digit_offset/4; } - // x-positions calculate + // Calculate x-positions for (i = 0; i < v_element_data.size(); i++) { if (firstElementLeft == i){ prevElementLeft = i; @@ -996,29 +1035,6 @@ void CComponentsItemBox::calculateElements() } } } - - // text width calculate - int allWidth = 0; - for (i = 0; i < v_element_data.size(); i++) { - if (v_element_data[i].type != CC_TITLEBAR_TEXT) - allWidth += v_element_data[i].width + hSpacer; - } - for (i = 0; i < v_element_data.size(); i++) { - if (v_element_data[i].type == CC_TITLEBAR_TEXT) { - v_element_data[i].width = width - (allWidth + 2*hSpacer); - break; - } - } - - // y-positions calculate - height = hMax + 2*vOffset; - for (i = 0; i < v_element_data.size(); i++) { - v_element_data[i].y = y + (height - v_element_data[i].height) / 2; - if (v_element_data[i].type == CC_TITLEBAR_TEXT) - v_element_data[i].y += v_element_data[i].height + v_element_data[i].height/14; - if (v_element_data[i].type == CC_TITLEBAR_CLOCK) - v_element_data[i].y += v_element_data[i].height + digit_offset/4; - } } void CComponentsItemBox::paint(bool do_save_bg) @@ -1034,7 +1050,7 @@ void CComponentsItemBox::paint(bool do_save_bg) CComponentsPicture* pic = NULL; for (i = 0; i < v_element_data.size(); i++) { switch (v_element_data[i].type) { - case CC_TITLEBAR_ICON: + case CC_ITEMBOX_ICON: if (v_element_data[i].handler1 == NULL) { pic = new CComponentsPicture(v_element_data[i].x, v_element_data[i].y, v_element_data[i].element); v_element_data[i].handler1 = (void*)pic; @@ -1043,7 +1059,7 @@ void CComponentsItemBox::paint(bool do_save_bg) pic = static_cast(v_element_data[i].handler1); paintPic(pic); break; - case CC_TITLEBAR_PICTURE: + case CC_ITEMBOX_PICTURE: if (v_element_data[i].handler1 == NULL) { pic = new CComponentsPicture( v_element_data[i].x, v_element_data[i].y, v_element_data[i].width, v_element_data[i].height, v_element_data[i].element); @@ -1053,11 +1069,11 @@ void CComponentsItemBox::paint(bool do_save_bg) pic = static_cast(v_element_data[i].handler1); paintPic(pic); break; - case CC_TITLEBAR_TEXT: + case CC_ITEMBOX_TEXT: font_text->RenderString(v_element_data[i].x, v_element_data[i].y, v_element_data[i].width, v_element_data[i].element.c_str(), col_text, 0, true); break; - case CC_TITLEBAR_CLOCK: + case CC_ITEMBOX_CLOCK: font_text->RenderString(v_element_data[i].x, v_element_data[i].y, v_element_data[i].width, v_element_data[i].element.c_str(), col_text); break; @@ -1092,6 +1108,7 @@ CComponentsTitleBar::CComponentsTitleBar(const int x_pos, const int y_pos, const { //CComponentsItemBox initVarItemBox(); + onlyOneTextElement = true; //CComponents x = x_pos; @@ -1105,6 +1122,40 @@ CComponentsTitleBar::CComponentsTitleBar(const int x_pos, const int y_pos, const //CComponentsTitleBar font_text = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]; col_text = color_text; -// col_text = COL_MENUHEAD; } + +void CComponentsTitleBar::calculateElements() +{ +#define LOGO_MAX_WIDTH width/4 + + if (v_element_data.empty()) + return; + + size_t i; + + calculateElementsInitPart1(); + + // Calculate logo + for (i = 0; i < v_element_data.size(); i++) { + if (v_element_data[i].type == CC_ITEMBOX_PICTURE) { + if((v_element_data[i].width > LOGO_MAX_WIDTH) || (v_element_data[i].height > hMax)) + g_PicViewer->rescaleImageDimensions(&v_element_data[i].width, &v_element_data[i].height, LOGO_MAX_WIDTH, hMax); + } + } + + // Calculate text width + int allWidth = 0; + for (i = 0; i < v_element_data.size(); i++) { + if (v_element_data[i].type != CC_ITEMBOX_TEXT) + allWidth += v_element_data[i].width + hSpacer; + } + for (i = 0; i < v_element_data.size(); i++) { + if (v_element_data[i].type == CC_ITEMBOX_TEXT) { + v_element_data[i].width = width - (allWidth + 2*hSpacer); + break; + } + } + + calculateElementsInitPart2(); +} From b88f73d595fd8bbe9157346d0c0937a6ef04bb5c Mon Sep 17 00:00:00 2001 From: micha-bbg Date: Mon, 27 Aug 2012 02:33:12 +0200 Subject: [PATCH 045/224] * CComponentsItemBox: Use CTextBox for paint text --- src/gui/components/cc.h | 1 + src/gui/components/components.cpp | 34 +++++++++++++++++++++++++++---- 2 files changed, 31 insertions(+), 4 deletions(-) diff --git a/src/gui/components/cc.h b/src/gui/components/cc.h index ee8521506..4d2585fe0 100644 --- a/src/gui/components/cc.h +++ b/src/gui/components/cc.h @@ -366,6 +366,7 @@ class CComponentsTitleBar : public CComponentsItemBox public: CComponentsTitleBar( const int x_pos, const int y_pos, const int w, const int h, fb_pixel_t color_text = COL_MENUHEAD, fb_pixel_t color_body = COL_MENUHEAD_PLUS_0); + void calculateElements(); }; diff --git a/src/gui/components/components.cpp b/src/gui/components/components.cpp index 1521310a4..2a07d4e76 100644 --- a/src/gui/components/components.cpp +++ b/src/gui/components/components.cpp @@ -1006,8 +1006,6 @@ void CComponentsItemBox::calculateElementsInitPart2() height = hMax + 2*vOffset; for (i = 0; i < v_element_data.size(); i++) { v_element_data[i].y = y + (height - v_element_data[i].height) / 2; - if (v_element_data[i].type == CC_ITEMBOX_TEXT) - v_element_data[i].y += v_element_data[i].height + v_element_data[i].height/14; if (v_element_data[i].type == CC_ITEMBOX_CLOCK) v_element_data[i].y += v_element_data[i].height + digit_offset/4; } @@ -1048,6 +1046,8 @@ void CComponentsItemBox::paint(bool do_save_bg) // paint elements size_t i; CComponentsPicture* pic = NULL; + CBox* box = NULL; + CTextBox* textbox = NULL; for (i = 0; i < v_element_data.size(); i++) { switch (v_element_data[i].type) { case CC_ITEMBOX_ICON: @@ -1070,8 +1070,29 @@ void CComponentsItemBox::paint(bool do_save_bg) paintPic(pic); break; case CC_ITEMBOX_TEXT: - font_text->RenderString(v_element_data[i].x, v_element_data[i].y, v_element_data[i].width, - v_element_data[i].element.c_str(), col_text, 0, true); + if (v_element_data[i].handler1 == NULL) { + box = new CBox(); + v_element_data[i].handler1 = (void*)box; + } + else + box = static_cast(v_element_data[i].handler1); + box->iX = v_element_data[i].x; + box->iY = v_element_data[i].y; + box->iWidth = v_element_data[i].width; + box->iHeight = v_element_data[i].height; + if (v_element_data[i].handler2 == NULL) { + textbox = new CTextBox(v_element_data[i].element.c_str(), font_text, CTextBox::AUTO_WIDTH|CTextBox::AUTO_HIGH, box, col_body); + v_element_data[i].handler2 = (void*)textbox; + } + else + textbox = static_cast(v_element_data[i].handler2); + textbox->setTextBorderWidth(0); + textbox->enableBackgroundPaint(false); + textbox->setTextFont(font_text); + textbox->movePosition(box->iX, box->iY); + textbox->setTextColor(col_text); + if (textbox->setText(&v_element_data[i].element)) + textbox->paint(); break; case CC_ITEMBOX_CLOCK: font_text->RenderString(v_element_data[i].x, v_element_data[i].y, v_element_data[i].width, @@ -1153,6 +1174,11 @@ void CComponentsTitleBar::calculateElements() for (i = 0; i < v_element_data.size(); i++) { if (v_element_data[i].type == CC_ITEMBOX_TEXT) { v_element_data[i].width = width - (allWidth + 2*hSpacer); + // If text is too long, number of rows = 2 + if (font_text->getRenderWidth(v_element_data[i].element) > v_element_data[i].width) { + v_element_data[i].height = font_text->getHeight() * 2; + hMax = max(v_element_data[i].height, hMax); + } break; } } From 79c4ad05a262c6ed4e221c7be002a6e7deb2e3e4 Mon Sep 17 00:00:00 2001 From: micha-bbg Date: Mon, 27 Aug 2012 03:18:04 +0200 Subject: [PATCH 046/224] * Move hMax correction from CComponentsItemBox to CComponentsTitleBar --- src/gui/components/components.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/gui/components/components.cpp b/src/gui/components/components.cpp index 2a07d4e76..a861d17e3 100644 --- a/src/gui/components/components.cpp +++ b/src/gui/components/components.cpp @@ -994,8 +994,6 @@ void CComponentsItemBox::calculateElementsInitPart1() if (v_element_data[i].type != CC_ITEMBOX_PICTURE) hMax = max(v_element_data[i].height, hMax); } - if (!has_TextElement) - hMax = max(font_text->getHeight(), hMax); } void CComponentsItemBox::calculateElementsInitPart2() @@ -1157,6 +1155,10 @@ void CComponentsTitleBar::calculateElements() calculateElementsInitPart1(); + // hMax correction if no text element. + if (!has_TextElement) + hMax = max(font_text->getHeight(), hMax); + // Calculate logo for (i = 0; i < v_element_data.size(); i++) { if (v_element_data[i].type == CC_ITEMBOX_PICTURE) { From 6a29d7b83abd3e6cfdc4e575332b9af611e7d593 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Mon, 27 Aug 2012 15:02:46 +0200 Subject: [PATCH 047/224] CComponentsItemBox: remove comment --- src/gui/components/components.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/gui/components/components.cpp b/src/gui/components/components.cpp index a861d17e3..409c5161b 100644 --- a/src/gui/components/components.cpp +++ b/src/gui/components/components.cpp @@ -803,8 +803,7 @@ void CComponentsPicture::paint(bool do_save_bg) //------------------------------------------------------------------------------------------------------- //sub class CComponentsItemBox from CComponentsContainer -CComponentsItemBox::CComponentsItemBox( /*const int x_pos, const int y_pos, const int w, const int h, - fb_pixel_t color_text, fb_pixel_t color_body*/) +CComponentsItemBox::CComponentsItemBox() { //CComponentsItemBox initVarItemBox(); From 19e6866bb87eaed19b36ebca1bf9448f6bd6ecb8 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Mon, 27 Aug 2012 15:27:40 +0200 Subject: [PATCH 048/224] CComponentsItemBox: use plausible member names --- src/gui/components/cc.h | 4 ++-- src/gui/components/components.cpp | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/gui/components/cc.h b/src/gui/components/cc.h index 4d2585fe0..5c071f966 100644 --- a/src/gui/components/cc.h +++ b/src/gui/components/cc.h @@ -343,8 +343,8 @@ class CComponentsItemBox : public CComponentsContainer void clearElements(); void paintPic(CComponentsPicture* pic); void initVarItemBox(); - void calculateElementsInitPart1(); - void calculateElementsInitPart2(); + void calSizeOfElements(); + void calPositionOfElements(); public: CComponentsItemBox(); diff --git a/src/gui/components/components.cpp b/src/gui/components/components.cpp index 409c5161b..9fcce99cc 100644 --- a/src/gui/components/components.cpp +++ b/src/gui/components/components.cpp @@ -943,7 +943,7 @@ bool CComponentsItemBox::addElement(int align, int type, const std::string& elem return true; } -void CComponentsItemBox::calculateElementsInitPart1() +void CComponentsItemBox::calSizeOfElements() { size_t i; @@ -995,7 +995,7 @@ void CComponentsItemBox::calculateElementsInitPart1() } } -void CComponentsItemBox::calculateElementsInitPart2() +void CComponentsItemBox::calPositionOfElements() { size_t i; @@ -1152,7 +1152,7 @@ void CComponentsTitleBar::calculateElements() size_t i; - calculateElementsInitPart1(); + calSizeOfElements(); // hMax correction if no text element. if (!has_TextElement) @@ -1184,5 +1184,5 @@ void CComponentsTitleBar::calculateElements() } } - calculateElementsInitPart2(); + calPositionOfElements(); } From 88e2cb77c20283fdc137ba2326659fb145d90a3e Mon Sep 17 00:00:00 2001 From: micha-bbg Date: Mon, 27 Aug 2012 17:35:27 +0200 Subject: [PATCH 049/224] * CComponentsItemBox: Correction x-position of elements --- src/gui/components/components.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gui/components/components.cpp b/src/gui/components/components.cpp index 9fcce99cc..950b30366 100644 --- a/src/gui/components/components.cpp +++ b/src/gui/components/components.cpp @@ -1011,11 +1011,11 @@ void CComponentsItemBox::calPositionOfElements() for (i = 0; i < v_element_data.size(); i++) { if (firstElementLeft == i){ prevElementLeft = i; - v_element_data[i].x += hOffset + corner_rad/2; + v_element_data[i].x = x + hOffset + corner_rad/2; } else if (firstElementRight == i){ prevElementRight = i; - v_element_data[i].x += width - v_element_data[i].width - hOffset - corner_rad/2; + v_element_data[i].x = x + width - v_element_data[i].width - hOffset - corner_rad/2; } else { if (v_element_data[i].align == CC_ALIGN_LEFT) { From 8cabe408cfeb8ba25c21d856f8cf8f636a1865a0 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Mon, 27 Aug 2012 20:38:08 +0200 Subject: [PATCH 050/224] CComponents: declare small members as inline --- src/gui/components/cc.h | 42 ++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/src/gui/components/cc.h b/src/gui/components/cc.h index 5c071f966..423f5ba6d 100644 --- a/src/gui/components/cc.h +++ b/src/gui/components/cc.h @@ -212,15 +212,15 @@ class CComponentsPicture : public CComponentsContainer CComponentsPicture( const int x_pos, const int y_pos, const int w_max, const int h_max, const std::string& picture_name, 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 setPictureOffset(const unsigned char offset){pic_offset = offset;}; - void setPicturePaint(bool paint_p){pic_paint = paint_p;}; - void setPicturePaintBackground(bool paintBg){pic_paintBg = paintBg;}; - void setPicture(const std::string& picture_name); + inline void setPictureOffset(const unsigned char offset){pic_offset = offset;}; + inline void setPicturePaint(bool paint_p){pic_paint = paint_p;}; + inline void setPicturePaintBackground(bool paintBg){pic_paintBg = paintBg;}; + inline void setPicture(const std::string& picture_name); void setPictureAlign(const int alignment); - bool isPainted(){return pic_painted;}; + inline bool isPainted(){return pic_painted;}; void paint(bool do_save_bg = CC_SAVE_SCREEN_YES); - void getPictureSize(int *pwidth, int *pheight){*pwidth=pic_width; *pheight=pic_height;}; + inline void getPictureSize(int *pwidth, int *pheight){*pwidth=pic_width; *pheight=pic_height;}; }; @@ -251,14 +251,14 @@ class CComponentsInfoBox : public CComponentsContainer ~CComponentsInfoBox(); - void setText(const char* info_text, const int mode = CTextBox::AUTO_WIDTH, Font* font_text = NULL){text = info_text; text_mode = mode, font = font_text;}; - void setText(const std::string& info_text, const int mode = CTextBox::AUTO_WIDTH, Font* font_text = NULL){text = info_text.c_str(); text_mode = mode, font = font_text;}; + inline void setText(const char* info_text, const int mode = CTextBox::AUTO_WIDTH, Font* font_text = NULL){text = info_text; text_mode = mode, font = font_text;}; + inline void setText(const std::string& info_text, const int mode = CTextBox::AUTO_WIDTH, Font* font_text = NULL){text = info_text.c_str(); text_mode = mode, font = font_text;}; void setText(neutrino_locale_t locale_text, const int mode = CTextBox::AUTO_WIDTH, Font* font_text = NULL); - void setTextMode(const int mode){text_mode = mode;};//see textbox.h for possible modes - void setTextFont(Font* font_text){font = font_text;}; - void setTextColor(fb_pixel_t color_text){ col_text = color_text;}; - void setSpaceOffset(const int offset){x_offset = offset;}; - void setPicture(const std::string& picture_name){pic_name = picture_name;}; + inline void setTextMode(const int mode){text_mode = mode;};//see textbox.h for possible modes + inline void setTextFont(Font* font_text){font = font_text;}; + inline void setTextColor(fb_pixel_t color_text){ col_text = color_text;}; + inline void setSpaceOffset(const int offset){x_offset = offset;}; + inline void setPicture(const std::string& picture_name){pic_name = picture_name;}; void removeLineBreaks(std::string& str); void paint(bool do_save_bg = CC_SAVE_SCREEN_YES); @@ -273,8 +273,8 @@ class CComponentsShapeCircle : public CComponentsContainer CComponentsShapeCircle( const int x_pos, const int y_pos, const int diam, bool has_shadow = CC_SHADOW_ON, fb_pixel_t color_frame = COL_MENUCONTENT_PLUS_6, fb_pixel_t color_body = COL_MENUCONTENT_PLUS_0, fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0); - void setDiam(const int& diam){d=width=height=diam, corner_rad=d/2;}; - int getDiam(){return d;}; + inline void setDiam(const int& diam){d=width=height=diam, corner_rad=d/2;}; + inline int getDiam(){return d;}; }; class CComponentsShapeSquare : public CComponentsContainer @@ -313,11 +313,11 @@ class CComponentsDetailLine : public CComponents void paint(bool do_save_bg = CC_SAVE_SCREEN_YES); void kill(); - void setColors(fb_pixel_t color_line, fb_pixel_t color_shadow){col_body = color_line; col_shadow = color_shadow;}; + inline void setColors(fb_pixel_t color_line, fb_pixel_t color_shadow){col_body = color_line; col_shadow = color_shadow;}; void syncSysColors(); - void setYPosDown(const int& y_pos_down){y_down = y_pos_down;}; - void setHMarkTop(const int& h_mark_top_){h_mark_top = h_mark_top_;}; - void setHMarkDown(const int& h_mark_down_){h_mark_down = h_mark_down_;}; + inline void setYPosDown(const int& y_pos_down){y_down = y_pos_down;}; + inline void setHMarkTop(const int& h_mark_top_){h_mark_top = h_mark_top_;}; + inline void setHMarkDown(const int& h_mark_down_){h_mark_down = h_mark_down_;}; }; #define FIRST_ELEMENT_INIT 10000 @@ -350,8 +350,8 @@ class CComponentsItemBox : public CComponentsContainer CComponentsItemBox(); virtual ~CComponentsItemBox(); - void setTextFont(Font* font){font_text = font;}; - void setTextColor(fb_pixel_t color_text){ col_text = color_text;}; + inline virtual void setTextFont(Font* font){font_text = font;}; + inline virtual void setTextColor(fb_pixel_t color_text){ col_text = color_text;}; void paint(bool do_save_bg = CC_SAVE_SCREEN_YES); From edbbfbef8f0f7ab231d9b59cd1c95bc2c2810ff5 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Mon, 27 Aug 2012 22:32:10 +0200 Subject: [PATCH 051/224] CComponentsTitleBar: add blanc constructor --- src/gui/components/cc.h | 6 ++++- src/gui/components/components.cpp | 40 ++++++++++++++++++++++++++----- 2 files changed, 39 insertions(+), 7 deletions(-) diff --git a/src/gui/components/cc.h b/src/gui/components/cc.h index 423f5ba6d..706c50b31 100644 --- a/src/gui/components/cc.h +++ b/src/gui/components/cc.h @@ -363,8 +363,12 @@ class CComponentsItemBox : public CComponentsContainer class CComponentsTitleBar : public CComponentsItemBox { + private: + void initVarTitleBar(); + public: - CComponentsTitleBar( const int x_pos, const int y_pos, const int w, const int h, + CComponentsTitleBar(); + CComponentsTitleBar( const int x_pos, const int y_pos, const int w, const int h, const char* text = NULL, fb_pixel_t color_text = COL_MENUHEAD, fb_pixel_t color_body = COL_MENUHEAD_PLUS_0); void calculateElements(); diff --git a/src/gui/components/components.cpp b/src/gui/components/components.cpp index 950b30366..d77d535bc 100644 --- a/src/gui/components/components.cpp +++ b/src/gui/components/components.cpp @@ -1121,12 +1121,17 @@ void CComponentsItemBox::paintPic(CComponentsPicture* pic) //------------------------------------------------------------------------------------------------------- //sub class CComponentsTitleBar from CComponentsItemBox -CComponentsTitleBar::CComponentsTitleBar(const int x_pos, const int y_pos, const int w, const int h, +CComponentsTitleBar::CComponentsTitleBar() +{ + //CComponentsTitleBar + initVarTitleBar(); +} + +CComponentsTitleBar::CComponentsTitleBar(const int x_pos, const int y_pos, const int w, const int h, const char* text, fb_pixel_t color_text, fb_pixel_t color_body) { //CComponentsItemBox - initVarItemBox(); - onlyOneTextElement = true; + initVarTitleBar(); //CComponents x = x_pos; @@ -1134,12 +1139,35 @@ CComponentsTitleBar::CComponentsTitleBar(const int x_pos, const int y_pos, const height = h; width = w; col_body = color_body; - corner_type = CORNER_TOP; - corner_rad = RADIUS_LARGE; - + //CComponentsTitleBar font_text = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]; col_text = color_text; + + if (text) { + addElement (CC_ALIGN_LEFT, CC_ITEMBOX_TEXT, text); + calculateElements(); + } +} + + +void CComponentsTitleBar::initVarTitleBar() +{ + //CComponentsItemBox + initVarItemBox(); + onlyOneTextElement = true; + + font_text = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]; + col_text = COL_MENUHEAD; + + //CComponents + x = 0; + y = 0; + height = font_text->getHeight() + 2*hSpacer; + width = frameBuffer->getScreenWidth(true);; + col_body = COL_MENUHEAD_PLUS_0; + corner_type = CORNER_TOP; + corner_rad = RADIUS_LARGE; } From c540de4d77532707a31a43f727fb8e41a7942327 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Tue, 28 Aug 2012 16:00:32 +0200 Subject: [PATCH 052/224] CComponentsTitleBar: add overloaded constructors for different text types --- src/gui/components/cc.h | 12 ++++- src/gui/components/components.cpp | 76 +++++++++++++++++++++++++++++-- 2 files changed, 82 insertions(+), 6 deletions(-) diff --git a/src/gui/components/cc.h b/src/gui/components/cc.h index 706c50b31..1cfe3902b 100644 --- a/src/gui/components/cc.h +++ b/src/gui/components/cc.h @@ -364,11 +364,21 @@ class CComponentsItemBox : public CComponentsContainer class CComponentsTitleBar : public CComponentsItemBox { private: + const char* tb_c_text; + std::string tb_s_text; + neutrino_locale_t tb_locale_text; + int tb_text_align; + + bool addText(); void initVarTitleBar(); public: CComponentsTitleBar(); - CComponentsTitleBar( const int x_pos, const int y_pos, const int w, const int h, const char* text = NULL, + CComponentsTitleBar( const int x_pos, const int y_pos, const int w, const int h, const char* c_text = NULL, const int text_alignment = CC_ALIGN_LEFT, + fb_pixel_t color_text = COL_MENUHEAD, fb_pixel_t color_body = COL_MENUHEAD_PLUS_0); + CComponentsTitleBar( const int x_pos, const int y_pos, const int w, const int h, const std::string& s_text ="", const int text_alignment = CC_ALIGN_LEFT, + fb_pixel_t color_text = COL_MENUHEAD, fb_pixel_t color_body = COL_MENUHEAD_PLUS_0); + CComponentsTitleBar( const int x_pos, const int y_pos, const int w, const int h, neutrino_locale_t locale_text = NONEXISTANT_LOCALE, const int text_alignment = CC_ALIGN_LEFT, fb_pixel_t color_text = COL_MENUHEAD, fb_pixel_t color_body = COL_MENUHEAD_PLUS_0); void calculateElements(); diff --git a/src/gui/components/components.cpp b/src/gui/components/components.cpp index d77d535bc..a0c3213cc 100644 --- a/src/gui/components/components.cpp +++ b/src/gui/components/components.cpp @@ -1127,7 +1127,7 @@ CComponentsTitleBar::CComponentsTitleBar() initVarTitleBar(); } -CComponentsTitleBar::CComponentsTitleBar(const int x_pos, const int y_pos, const int w, const int h, const char* text, +CComponentsTitleBar::CComponentsTitleBar(const int x_pos, const int y_pos, const int w, const int h, const char* c_text, const int text_alignment, fb_pixel_t color_text, fb_pixel_t color_body) { //CComponentsItemBox @@ -1141,15 +1141,75 @@ CComponentsTitleBar::CComponentsTitleBar(const int x_pos, const int y_pos, const col_body = color_body; //CComponentsTitleBar - font_text = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]; col_text = color_text; + tb_c_text = c_text; + tb_text_align = text_alignment; - if (text) { - addElement (CC_ALIGN_LEFT, CC_ITEMBOX_TEXT, text); + if (addText()) calculateElements(); - } } +CComponentsTitleBar::CComponentsTitleBar(const int x_pos, const int y_pos, const int w, const int h, const string& s_text, const int text_alignment, + fb_pixel_t color_text, fb_pixel_t color_body) +{ + //CComponentsItemBox + initVarTitleBar(); + + //CComponents + x = x_pos; + y = y_pos; + height = h; + width = w; + col_body = color_body; + + //CComponentsTitleBar + col_text = color_text; + tb_s_text = s_text; + tb_text_align = text_alignment; + + if (addText()) + calculateElements(); +} + +CComponentsTitleBar::CComponentsTitleBar(const int x_pos, const int y_pos, const int w, const int h, neutrino_locale_t locale_text, const int text_alignment, + fb_pixel_t color_text, fb_pixel_t color_body) +{ + //CComponentsItemBox + initVarTitleBar(); + + //CComponents + x = x_pos; + y = y_pos; + height = h; + width = w; + col_body = color_body; + + //CComponentsTitleBar + col_text = color_text; + tb_locale_text = locale_text; + tb_text_align = text_alignment; + + if (addText()) + calculateElements(); +} + +bool CComponentsTitleBar::addText() +{ + if (tb_c_text){ + addElement (tb_text_align, CC_ITEMBOX_TEXT, tb_c_text); + return true; + } + else if (!tb_s_text.empty()){ + addElement (tb_text_align, CC_ITEMBOX_TEXT, tb_s_text); + return true; + } + else if (tb_locale_text != NONEXISTANT_LOCALE){ + addElement (tb_text_align, CC_ITEMBOX_TEXT, g_Locale->getText(tb_locale_text)); + return true; + } + else + return false; +} void CComponentsTitleBar::initVarTitleBar() { @@ -1168,6 +1228,12 @@ void CComponentsTitleBar::initVarTitleBar() col_body = COL_MENUHEAD_PLUS_0; corner_type = CORNER_TOP; corner_rad = RADIUS_LARGE; + + //CComponentsTitleBar + tb_text_align = CC_ALIGN_LEFT; + tb_c_text = NULL; + tb_s_text = ""; + tb_locale_text = NONEXISTANT_LOCALE; } From 8745d69d41b3d3cf1f0ac0faa50f6d9cbf33e906 Mon Sep 17 00:00:00 2001 From: micha-bbg Date: Wed, 29 Aug 2012 07:06:07 +0200 Subject: [PATCH 053/224] CComponentsItemBox: Add refreshElement() & paintElement() - use paintElement() for CComponentsItemBox::paint --- src/gui/components/cc.h | 6 +- src/gui/components/components.cpp | 171 +++++++++++++++++------------- 2 files changed, 99 insertions(+), 78 deletions(-) diff --git a/src/gui/components/cc.h b/src/gui/components/cc.h index 1cfe3902b..58012ebf9 100644 --- a/src/gui/components/cc.h +++ b/src/gui/components/cc.h @@ -321,6 +321,7 @@ class CComponentsDetailLine : public CComponents }; #define FIRST_ELEMENT_INIT 10000 +#define LOGO_MAX_WIDTH width/4 class CComponentsItemBox : public CComponentsContainer { protected: @@ -341,7 +342,6 @@ class CComponentsItemBox : public CComponentsContainer std::vector v_element_data; void clearElements(); - void paintPic(CComponentsPicture* pic); void initVarItemBox(); void calSizeOfElements(); void calPositionOfElements(); @@ -356,6 +356,8 @@ class CComponentsItemBox : public CComponentsContainer void paint(bool do_save_bg = CC_SAVE_SCREEN_YES); virtual bool addElement(int align, int type, const std::string& element="", size_t *index=NULL); + virtual void refreshElement(size_t index, const std::string& element); + virtual void paintElement(size_t index, bool newElement= false); virtual bool addLogoOrText(int align, const std::string& logo, const std::string& text, size_t *index=NULL); virtual void clearTitlebar(); @@ -382,7 +384,7 @@ class CComponentsTitleBar : public CComponentsItemBox fb_pixel_t color_text = COL_MENUHEAD, fb_pixel_t color_body = COL_MENUHEAD_PLUS_0); void calculateElements(); - + }; #endif diff --git a/src/gui/components/components.cpp b/src/gui/components/components.cpp index a0c3213cc..8fac7410f 100644 --- a/src/gui/components/components.cpp +++ b/src/gui/components/components.cpp @@ -912,11 +912,6 @@ bool CComponentsItemBox::addElement(int align, int type, const std::string& elem if ((dx == 0) || (dy == 0)) return false; break; - case CC_ITEMBOX_PICTURE: - g_PicViewer->getSize(element.c_str(), &dx, &dy); - if ((dx == 0) || (dy == 0)) - return false; - break; case CC_ITEMBOX_TEXT: if ((element == "") || ((onlyOneTextElement) && (has_TextElement))) return false; @@ -943,6 +938,96 @@ bool CComponentsItemBox::addElement(int align, int type, const std::string& elem return true; } +void CComponentsItemBox::refreshElement(size_t index, const std::string& element) +{ + CComponentsPicture* pic = NULL; + switch (v_element_data[index].type) { + case CC_ITEMBOX_PICTURE: + pic = static_cast(v_element_data[index].handler1); + if (pic != NULL) { + pic->hide(); + delete pic; + } + v_element_data[index].element = element; + v_element_data[index].x = x; + v_element_data[index].y = y; + v_element_data[index].width = 0; + v_element_data[index].height = 0; + v_element_data[index].handler1 = NULL; + v_element_data[index].handler2 = NULL; + break; + default: + break; + } +} + +void CComponentsItemBox::paintElement(size_t index, bool newElement) +{ + CComponentsPicture* pic = NULL; + CBox* box = NULL; + CTextBox* textbox = NULL; + int pw = 0, ph = 0; + switch (v_element_data[index].type) { + case CC_ITEMBOX_ICON: + case CC_ITEMBOX_PICTURE: + pic = static_cast(v_element_data[index].handler1); + if ((newElement) || (pic == NULL)) { + if (pic != NULL) { + pic->hide(); + delete pic; + } + if ((v_element_data[index].type) == CC_ITEMBOX_PICTURE) + pic = new CComponentsPicture( v_element_data[index].x, v_element_data[index].y, v_element_data[index].width, + v_element_data[index].height, v_element_data[index].element); + else + pic = new CComponentsPicture( v_element_data[index].x, v_element_data[index].y, v_element_data[index].element); + v_element_data[index].handler1 = (void*)pic; + } + pic->getPictureSize(&pw, &ph); + pic->setHeight(ph); + pic->setWidth(pw); + pic->setColorBody(col_body); + pic->paint(); + break; + case CC_ITEMBOX_TEXT: + box = static_cast(v_element_data[index].handler1); + if ((newElement) || (box == NULL)) { + if (box != NULL) { + delete box; + } + box = new CBox(); + v_element_data[index].handler1 = (void*)box; + } + box->iX = v_element_data[index].x; + box->iY = v_element_data[index].y; + box->iWidth = v_element_data[index].width; + box->iHeight = v_element_data[index].height; + textbox = static_cast(v_element_data[index].handler2); + if ((newElement) || (textbox == NULL)) { + if (textbox != NULL) { + textbox->hide(); + delete textbox; + } + textbox = new CTextBox(v_element_data[index].element.c_str(), font_text, CTextBox::AUTO_WIDTH|CTextBox::AUTO_HIGH, box, col_body); + v_element_data[index].handler2 = (void*)textbox; + } + textbox->setTextBorderWidth(0); + textbox->enableBackgroundPaint(false); + textbox->setTextFont(font_text); + textbox->movePosition(box->iX, box->iY); + textbox->setTextColor(col_text); + if (textbox->setText(&v_element_data[index].element)) + textbox->paint(); + break; + case CC_ITEMBOX_CLOCK: + font_text->RenderString(v_element_data[index].x, v_element_data[index].y, v_element_data[index].width, + v_element_data[index].element.c_str(), col_text); + break; + default: + break; + } +} + void CComponentsItemBox::calSizeOfElements() { size_t i; @@ -985,6 +1070,8 @@ void CComponentsItemBox::calSizeOfElements() } // Calculate largest height without CC_ITEMBOX_PICTURE + firstElementLeft = FIRST_ELEMENT_INIT; + firstElementRight = FIRST_ELEMENT_INIT; for (i = 0; i < v_element_data.size(); i++) { if ((firstElementLeft == FIRST_ELEMENT_INIT) && (v_element_data[i].align == CC_ALIGN_LEFT)) firstElementLeft = i; @@ -1041,64 +1128,8 @@ void CComponentsItemBox::paint(bool do_save_bg) return; // paint elements - size_t i; - CComponentsPicture* pic = NULL; - CBox* box = NULL; - CTextBox* textbox = NULL; - for (i = 0; i < v_element_data.size(); i++) { - switch (v_element_data[i].type) { - case CC_ITEMBOX_ICON: - if (v_element_data[i].handler1 == NULL) { - pic = new CComponentsPicture(v_element_data[i].x, v_element_data[i].y, v_element_data[i].element); - v_element_data[i].handler1 = (void*)pic; - } - else - pic = static_cast(v_element_data[i].handler1); - paintPic(pic); - break; - case CC_ITEMBOX_PICTURE: - if (v_element_data[i].handler1 == NULL) { - pic = new CComponentsPicture( v_element_data[i].x, v_element_data[i].y, v_element_data[i].width, - v_element_data[i].height, v_element_data[i].element); - v_element_data[i].handler1 = (void*)pic; - } - else - pic = static_cast(v_element_data[i].handler1); - paintPic(pic); - break; - case CC_ITEMBOX_TEXT: - if (v_element_data[i].handler1 == NULL) { - box = new CBox(); - v_element_data[i].handler1 = (void*)box; - } - else - box = static_cast(v_element_data[i].handler1); - box->iX = v_element_data[i].x; - box->iY = v_element_data[i].y; - box->iWidth = v_element_data[i].width; - box->iHeight = v_element_data[i].height; - if (v_element_data[i].handler2 == NULL) { - textbox = new CTextBox(v_element_data[i].element.c_str(), font_text, CTextBox::AUTO_WIDTH|CTextBox::AUTO_HIGH, box, col_body); - v_element_data[i].handler2 = (void*)textbox; - } - else - textbox = static_cast(v_element_data[i].handler2); - textbox->setTextBorderWidth(0); - textbox->enableBackgroundPaint(false); - textbox->setTextFont(font_text); - textbox->movePosition(box->iX, box->iY); - textbox->setTextColor(col_text); - if (textbox->setText(&v_element_data[i].element)) - textbox->paint(); - break; - case CC_ITEMBOX_CLOCK: - font_text->RenderString(v_element_data[i].x, v_element_data[i].y, v_element_data[i].width, - v_element_data[i].element.c_str(), col_text); - break; - default: - break; - } - } + for (size_t i = 0; i < v_element_data.size(); i++) + paintElement(i); } void CComponentsItemBox::clearTitlebar() @@ -1109,16 +1140,6 @@ void CComponentsItemBox::clearTitlebar() paintElements = true; } -void CComponentsItemBox::paintPic(CComponentsPicture* pic) -{ - int pw, ph; - pic->getPictureSize(&pw, &ph); - pic->setHeight(ph); - pic->setWidth(pw); - pic->setColorBody(col_body); - pic->paint(); -} - //------------------------------------------------------------------------------------------------------- //sub class CComponentsTitleBar from CComponentsItemBox CComponentsTitleBar::CComponentsTitleBar() @@ -1239,8 +1260,6 @@ void CComponentsTitleBar::initVarTitleBar() void CComponentsTitleBar::calculateElements() { -#define LOGO_MAX_WIDTH width/4 - if (v_element_data.empty()) return; @@ -1255,7 +1274,7 @@ void CComponentsTitleBar::calculateElements() // Calculate logo for (i = 0; i < v_element_data.size(); i++) { if (v_element_data[i].type == CC_ITEMBOX_PICTURE) { - if((v_element_data[i].width > LOGO_MAX_WIDTH) || (v_element_data[i].height > hMax)) + if ((v_element_data[i].width > LOGO_MAX_WIDTH) || (v_element_data[i].height > hMax)) g_PicViewer->rescaleImageDimensions(&v_element_data[i].width, &v_element_data[i].height, LOGO_MAX_WIDTH, hMax); } } From cd4cb6645e32ae4cd216a95b37187c0dbdd3043c Mon Sep 17 00:00:00 2001 From: micha-bbg Date: Wed, 29 Aug 2012 00:47:41 +0200 Subject: [PATCH 054/224] Channellist: Use CComponentsTitleBar for paint head --- src/gui/channellist.cpp | 78 ++++++++++++++--------------------------- src/gui/channellist.h | 2 ++ 2 files changed, 29 insertions(+), 51 deletions(-) diff --git a/src/gui/channellist.cpp b/src/gui/channellist.cpp index b2e2abe66..b8c437df2 100644 --- a/src/gui/channellist.cpp +++ b/src/gui/channellist.cpp @@ -117,6 +117,9 @@ CChannelList::CChannelList(const char * const pName, bool phistoryMode, bool _vl eventFont = SNeutrinoSettings::FONT_TYPE_CHANNELLIST_EVENT; dline = NULL; ibox = new CComponentsInfoBox(x, y + height + 2, width, info_height); + clHead = NULL; + indexLogo = 0; + //printf("************ NEW LIST %s : %x\n", name.c_str(), (int) this);fflush(stdout); } @@ -126,6 +129,7 @@ CChannelList::~CChannelList() chanlist.clear(); delete dline; delete ibox; + delete clHead; } void CChannelList::ClearList(void) @@ -1670,23 +1674,6 @@ void CChannelList::paintItem2DetailsLine (int pos) } } -void CChannelList::showChannelLogo() -{ - if(g_settings.infobar_show_channellogo){ - static int logo_w = 0; - static int logo_h = 0; - int logo_w_max = full_width / 4; - frameBuffer->paintBoxRel(x + full_width - logo_off - logo_w, y+(theight-logo_h)/2, logo_w, logo_h, COL_MENUHEAD_PLUS_0); - - std::string lname; - if(g_PicViewer->GetLogoName(chanlist[selected]->channel_id, chanlist[selected]->getName(), lname, &logo_w, &logo_h)) { - if((logo_h > theight) || (logo_w > logo_w_max)) - g_PicViewer->rescaleImageDimensions(&logo_w, &logo_h, logo_w_max, theight); - g_PicViewer->DisplayImage(lname, x + full_width - logo_off - logo_w, y+(theight-logo_h)/2, logo_w, logo_h); - } - } -} - #define NUM_LIST_BUTTONS 4 struct button_label SChannelListButtons[NUM_LIST_BUTTONS] = { @@ -2004,46 +1991,35 @@ void CChannelList::paintItem(int pos) void CChannelList::paintHead() { - int timestr_len = 0; - char timestr[10] = {0}; - time_t now = time(NULL); - struct tm *tm = localtime(&now); + if (clHead == NULL) { + clHead = new CComponentsTitleBar(); + clHead->setDimensionsAll(x, y, width, theight); - bool gotTime = g_Sectionsd->getIsTimeSet(); + clHead->addElement(CC_ALIGN_LEFT, CC_ITEMBOX_TEXT, name); - if(gotTime) { - strftime(timestr, 10, "%H:%M", tm); - timestr_len = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]->getRenderWidth(timestr, true); // UTF-8 + clHead->addElement(CC_ALIGN_RIGHT, CC_ITEMBOX_ICON, NEUTRINO_ICON_BUTTON_INFO); + clHead->addElement(CC_ALIGN_RIGHT, CC_ITEMBOX_ICON, NEUTRINO_ICON_BUTTON_MENU); + if (g_settings.channellist_new_zap_mode) + clHead->addElement(CC_ALIGN_RIGHT, CC_ITEMBOX_ICON, this->new_mode_active ? + NEUTRINO_ICON_BUTTON_MUTE_ZAP_ACTIVE : NEUTRINO_ICON_BUTTON_MUTE_ZAP_INACTIVE); + clHead->addElement(CC_ALIGN_RIGHT, CC_ITEMBOX_CLOCK); + clHead->addElement(CC_ALIGN_RIGHT, CC_ITEMBOX_PICTURE, "", &indexLogo); } - int iw1, iw2, iw3, ih = 0; - frameBuffer->getIconSize(NEUTRINO_ICON_BUTTON_INFO, &iw1, &ih); - frameBuffer->getIconSize(NEUTRINO_ICON_BUTTON_MENU, &iw2, &ih); - if (new_zap_mode) - frameBuffer->getIconSize(NEUTRINO_ICON_BUTTON_MUTE_ZAP_ACTIVE, &iw3, &ih); + clHead->calculateElements(); + clHead->paint(); +} - // head - frameBuffer->paintBoxRel(x,y, full_width,theight+0, COL_MENUHEAD_PLUS_0, RADIUS_LARGE, CORNER_TOP);//round - - frameBuffer->paintIcon(NEUTRINO_ICON_BUTTON_INFO, x + full_width - iw1 - 10, y, theight); //y+ 5 ); - frameBuffer->paintIcon(NEUTRINO_ICON_BUTTON_MENU, x + full_width - iw1 - iw2 - 14, y, theight);//y + 5); // icon for bouquet list button - if (new_zap_mode) - frameBuffer->paintIcon((new_zap_mode == 2 /* active */) ? - NEUTRINO_ICON_BUTTON_MUTE_ZAP_ACTIVE : NEUTRINO_ICON_BUTTON_MUTE_ZAP_INACTIVE, - x + full_width - iw1 - iw2 - iw3 - 18, y, theight); - - if (gotTime) { - int iw3x = (new_zap_mode) ? iw3 : -10; - g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]->RenderString(x + full_width - iw1 - iw2 - iw3x - 28 -timestr_len, - y+theight, timestr_len, timestr, COL_MENUHEAD, 0, true); // UTF-8 - timestr_len += 4; +void CChannelList::showChannelLogo() +{ + if(g_settings.infobar_show_channellogo){ + std::string lname = ""; + int dummy; + g_PicViewer->GetLogoName(chanlist[selected]->channel_id, chanlist[selected]->getName(), lname, &dummy, &dummy); + clHead->refreshElement(indexLogo, lname); + clHead->calculateElements(); + clHead->paintElement(indexLogo, true); } - - timestr_len += iw1 + iw2 + 12; - if (new_zap_mode) - timestr_len += iw3 + 10; - logo_off = timestr_len + 10; - g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]->RenderString(x+10,y+theight+0, full_width - timestr_len, name, COL_MENUHEAD, 0, true); // UTF-8 } void CChannelList::paint() diff --git a/src/gui/channellist.h b/src/gui/channellist.h index 6994e6427..7f0aae007 100644 --- a/src/gui/channellist.h +++ b/src/gui/channellist.h @@ -97,6 +97,8 @@ private: int ChannelList_Rec; CComponentsDetailLine *dline; CComponentsInfoBox *ibox; + CComponentsTitleBar* clHead; + size_t indexLogo; void paintDetails(int index); void clearItem2DetailsLine (); From 806d840c86de70db0be229cbbe7305ed3206ec32 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Thu, 30 Aug 2012 22:03:10 +0200 Subject: [PATCH 055/224] CComponents: rework some members *rename col_text to class relevant names, col_text is already defined in class CComponents InfoBox and its easy to confuse member names *add member printItemBox() and move calculateElements() into CComponentsItemBox and use it in print() and refreshElement() --- src/gui/components/cc.h | 18 +- src/gui/components/components.cpp | 300 +++++++++++++++--------------- 2 files changed, 163 insertions(+), 155 deletions(-) diff --git a/src/gui/components/cc.h b/src/gui/components/cc.h index 58012ebf9..2af658632 100644 --- a/src/gui/components/cc.h +++ b/src/gui/components/cc.h @@ -241,7 +241,7 @@ class CComponentsInfoBox : public CComponentsContainer void paintText(); void initVarInfobox(); std::string pic_name; - fb_pixel_t col_text; + fb_pixel_t ibox_col_text; public: CComponentsInfoBox(); CComponentsInfoBox( const int x_pos, const int y_pos, const int w, const int h, @@ -256,7 +256,7 @@ class CComponentsInfoBox : public CComponentsContainer void setText(neutrino_locale_t locale_text, const int mode = CTextBox::AUTO_WIDTH, Font* font_text = NULL); inline void setTextMode(const int mode){text_mode = mode;};//see textbox.h for possible modes inline void setTextFont(Font* font_text){font = font_text;}; - inline void setTextColor(fb_pixel_t color_text){ col_text = color_text;}; + inline void setTextColor(fb_pixel_t color_text){ ibox_col_text = color_text;}; inline void setSpaceOffset(const int offset){x_offset = offset;}; inline void setPicture(const std::string& picture_name){pic_name = picture_name;}; void removeLineBreaks(std::string& str); @@ -331,7 +331,7 @@ class CComponentsItemBox : public CComponentsContainer int digit_offset, digit_h; bool paintElements; bool onlyOneTextElement; - fb_pixel_t col_text; + fb_pixel_t it_col_text; Font* font_text; int hMax; bool has_TextElement; @@ -345,15 +345,15 @@ class CComponentsItemBox : public CComponentsContainer void initVarItemBox(); void calSizeOfElements(); void calPositionOfElements(); + void paintItemBox(bool do_save_bg = CC_SAVE_SCREEN_YES); + void calculateElements(); public: CComponentsItemBox(); virtual ~CComponentsItemBox(); inline virtual void setTextFont(Font* font){font_text = font;}; - inline virtual void setTextColor(fb_pixel_t color_text){ col_text = color_text;}; - - void paint(bool do_save_bg = CC_SAVE_SCREEN_YES); + inline virtual void setTextColor(fb_pixel_t color_text){ it_col_text = color_text;}; virtual bool addElement(int align, int type, const std::string& element="", size_t *index=NULL); virtual void refreshElement(size_t index, const std::string& element); @@ -370,7 +370,7 @@ class CComponentsTitleBar : public CComponentsItemBox std::string tb_s_text; neutrino_locale_t tb_locale_text; int tb_text_align; - + bool addText(); void initVarTitleBar(); @@ -382,8 +382,8 @@ class CComponentsTitleBar : public CComponentsItemBox fb_pixel_t color_text = COL_MENUHEAD, fb_pixel_t color_body = COL_MENUHEAD_PLUS_0); CComponentsTitleBar( const int x_pos, const int y_pos, const int w, const int h, neutrino_locale_t locale_text = NONEXISTANT_LOCALE, const int text_alignment = CC_ALIGN_LEFT, fb_pixel_t color_text = COL_MENUHEAD, fb_pixel_t color_body = COL_MENUHEAD_PLUS_0); - - void calculateElements(); + + void paint(bool do_save_bg = CC_SAVE_SCREEN_YES); }; diff --git a/src/gui/components/components.cpp b/src/gui/components/components.cpp index 8fac7410f..64bf92a38 100644 --- a/src/gui/components/components.cpp +++ b/src/gui/components/components.cpp @@ -288,7 +288,7 @@ CComponentsInfoBox::CComponentsInfoBox() text = NULL; text_mode = CTextBox::AUTO_WIDTH; font = NULL; - col_text = COL_MENUCONTENT; + ibox_col_text = COL_MENUCONTENT; } CComponentsInfoBox::CComponentsInfoBox(const int x_pos, const int y_pos, const int w, const int h, @@ -313,7 +313,7 @@ CComponentsInfoBox::CComponentsInfoBox(const int x_pos, const int y_pos, const i text = info_text; text_mode = mode; font = font_text; - col_text = color_text; + ibox_col_text = color_text; } CComponentsInfoBox::~CComponentsInfoBox() @@ -395,7 +395,7 @@ void CComponentsInfoBox::paintText() //set properties textbox->setTextFont(font); textbox->movePosition(box->iX, box->iY); - textbox->setTextColor(col_text); + textbox->setTextColor(ibox_col_text); //set text string new_text = static_cast (text); @@ -823,7 +823,7 @@ void CComponentsItemBox::initVarItemBox() initVarContainer(); //CComponentsItemBox - col_text = COL_MENUCONTENT; + it_col_text = COL_MENUCONTENT; hSpacer = 2; hOffset = 4; vOffset = 1; @@ -959,6 +959,7 @@ void CComponentsItemBox::refreshElement(size_t index, const std::string& element default: break; } + calculateElements(); } void CComponentsItemBox::paintElement(size_t index, bool newElement) @@ -1015,13 +1016,13 @@ void CComponentsItemBox::paintElement(size_t index, bool newElement) textbox->enableBackgroundPaint(false); textbox->setTextFont(font_text); textbox->movePosition(box->iX, box->iY); - textbox->setTextColor(col_text); + textbox->setTextColor(it_col_text); if (textbox->setText(&v_element_data[index].element)) textbox->paint(); break; case CC_ITEMBOX_CLOCK: font_text->RenderString(v_element_data[index].x, v_element_data[index].y, v_element_data[index].width, - v_element_data[index].element.c_str(), col_text); + v_element_data[index].element.c_str(), it_col_text); break; default: break; @@ -1119,146 +1120,7 @@ void CComponentsItemBox::calPositionOfElements() } } -void CComponentsItemBox::paint(bool do_save_bg) -{ - // paint background - paintInit(do_save_bg); - - if ((v_element_data.empty()) || (!paintElements)) - return; - - // paint elements - for (size_t i = 0; i < v_element_data.size(); i++) - paintElement(i); -} - -void CComponentsItemBox::clearTitlebar() -{ - clearElements(); - paintElements = false; - paint(false); - paintElements = true; -} - -//------------------------------------------------------------------------------------------------------- -//sub class CComponentsTitleBar from CComponentsItemBox -CComponentsTitleBar::CComponentsTitleBar() -{ - //CComponentsTitleBar - initVarTitleBar(); -} - -CComponentsTitleBar::CComponentsTitleBar(const int x_pos, const int y_pos, const int w, const int h, const char* c_text, const int text_alignment, - fb_pixel_t color_text, fb_pixel_t color_body) -{ - //CComponentsItemBox - initVarTitleBar(); - - //CComponents - x = x_pos; - y = y_pos; - height = h; - width = w; - col_body = color_body; - - //CComponentsTitleBar - col_text = color_text; - tb_c_text = c_text; - tb_text_align = text_alignment; - - if (addText()) - calculateElements(); -} - -CComponentsTitleBar::CComponentsTitleBar(const int x_pos, const int y_pos, const int w, const int h, const string& s_text, const int text_alignment, - fb_pixel_t color_text, fb_pixel_t color_body) -{ - //CComponentsItemBox - initVarTitleBar(); - - //CComponents - x = x_pos; - y = y_pos; - height = h; - width = w; - col_body = color_body; - - //CComponentsTitleBar - col_text = color_text; - tb_s_text = s_text; - tb_text_align = text_alignment; - - if (addText()) - calculateElements(); -} - -CComponentsTitleBar::CComponentsTitleBar(const int x_pos, const int y_pos, const int w, const int h, neutrino_locale_t locale_text, const int text_alignment, - fb_pixel_t color_text, fb_pixel_t color_body) -{ - //CComponentsItemBox - initVarTitleBar(); - - //CComponents - x = x_pos; - y = y_pos; - height = h; - width = w; - col_body = color_body; - - //CComponentsTitleBar - col_text = color_text; - tb_locale_text = locale_text; - tb_text_align = text_alignment; - - if (addText()) - calculateElements(); -} - -bool CComponentsTitleBar::addText() -{ - if (tb_c_text){ - addElement (tb_text_align, CC_ITEMBOX_TEXT, tb_c_text); - return true; - } - else if (!tb_s_text.empty()){ - addElement (tb_text_align, CC_ITEMBOX_TEXT, tb_s_text); - return true; - } - else if (tb_locale_text != NONEXISTANT_LOCALE){ - addElement (tb_text_align, CC_ITEMBOX_TEXT, g_Locale->getText(tb_locale_text)); - return true; - } - else - return false; -} - -void CComponentsTitleBar::initVarTitleBar() -{ - //CComponentsItemBox - initVarItemBox(); - onlyOneTextElement = true; - - font_text = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]; - col_text = COL_MENUHEAD; - - //CComponents - x = 0; - y = 0; - height = font_text->getHeight() + 2*hSpacer; - width = frameBuffer->getScreenWidth(true);; - col_body = COL_MENUHEAD_PLUS_0; - corner_type = CORNER_TOP; - corner_rad = RADIUS_LARGE; - - //CComponentsTitleBar - tb_text_align = CC_ALIGN_LEFT; - tb_c_text = NULL; - tb_s_text = ""; - tb_locale_text = NONEXISTANT_LOCALE; -} - - -void CComponentsTitleBar::calculateElements() +void CComponentsItemBox::calculateElements() { if (v_element_data.empty()) return; @@ -1299,3 +1161,149 @@ void CComponentsTitleBar::calculateElements() calPositionOfElements(); } + +void CComponentsItemBox::paintItemBox(bool do_save_bg) +{ + // paint background + paintInit(do_save_bg); + + if ((v_element_data.empty()) || (!paintElements)) + return; + + // paint elements + for (size_t i = 0; i < v_element_data.size(); i++) + paintElement(i); +} + +void CComponentsItemBox::clearTitlebar() +{ + clearElements(); + paintElements = false; + paint(false); + paintElements = true; +} + +//------------------------------------------------------------------------------------------------------- +//sub class CComponentsTitleBar from CComponentsItemBox +CComponentsTitleBar::CComponentsTitleBar() +{ + //CComponentsTitleBar + initVarTitleBar(); +} + +CComponentsTitleBar::CComponentsTitleBar(const int x_pos, const int y_pos, const int w, const int h, const char* c_text, const int text_alignment, + fb_pixel_t color_text, fb_pixel_t color_body) +{ + //CComponentsItemBox + initVarTitleBar(); + it_col_text = color_text; + + //CComponents + x = x_pos; + y = y_pos; + height = h; + width = w; + col_body = color_body; + + //CComponentsTitleBar + tb_c_text = c_text; + tb_text_align = text_alignment; + + if (addText()) + calculateElements(); +} + +CComponentsTitleBar::CComponentsTitleBar(const int x_pos, const int y_pos, const int w, const int h, const string& s_text, const int text_alignment, + fb_pixel_t color_text, fb_pixel_t color_body) +{ + //CComponentsItemBox + initVarTitleBar(); + it_col_text = color_text; + + //CComponents + x = x_pos; + y = y_pos; + height = h; + width = w; + col_body = color_body; + + //CComponentsTitleBar + tb_s_text = s_text; + tb_text_align = text_alignment; + + if (addText()) + calculateElements(); +} + +CComponentsTitleBar::CComponentsTitleBar(const int x_pos, const int y_pos, const int w, const int h, neutrino_locale_t locale_text, const int text_alignment, + fb_pixel_t color_text, fb_pixel_t color_body) +{ + //CComponentsItemBox + initVarTitleBar(); + it_col_text = color_text; + + //CComponents + x = x_pos; + y = y_pos; + height = h; + width = w; + col_body = color_body; + + //CComponentsTitleBar + tb_locale_text = locale_text; + tb_text_align = text_alignment; + + if (addText()) + calculateElements(); +} + +bool CComponentsTitleBar::addText() +{ + if (tb_c_text){ + addElement (tb_text_align, CC_ITEMBOX_TEXT, tb_c_text); + return true; + } + else if (!tb_s_text.empty()){ + addElement (tb_text_align, CC_ITEMBOX_TEXT, tb_s_text); + return true; + } + else if (tb_locale_text != NONEXISTANT_LOCALE){ + addElement (tb_text_align, CC_ITEMBOX_TEXT, g_Locale->getText(tb_locale_text)); + return true; + } + else + return false; +} + +void CComponentsTitleBar::initVarTitleBar() +{ + //CComponentsItemBox + initVarItemBox(); + onlyOneTextElement = true; + + font_text = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]; + it_col_text = COL_MENUHEAD; + + //CComponents + x = 0; + y = 0; + height = font_text->getHeight() + 2*hSpacer; + width = frameBuffer->getScreenWidth(true);; + col_body = COL_MENUHEAD_PLUS_0; + corner_type = CORNER_TOP; + corner_rad = RADIUS_LARGE; + + //CComponentsTitleBar + tb_text_align = CC_ALIGN_LEFT; + tb_c_text = NULL; + tb_s_text = ""; + tb_locale_text = NONEXISTANT_LOCALE; +} + + +void CComponentsTitleBar::paint(bool do_save_bg) +{ + calculateElements(); + paintItemBox(do_save_bg); +} + From 936e9659094a0605c14a677eba51f826ba4f5ebe Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Thu, 30 Aug 2012 22:05:09 +0200 Subject: [PATCH 056/224] CChannellist: remove calculateElements() is already included in print()clHead->paint() and refreshElement() --- src/gui/channellist.cpp | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/gui/channellist.cpp b/src/gui/channellist.cpp index b8c437df2..9effe9e8b 100644 --- a/src/gui/channellist.cpp +++ b/src/gui/channellist.cpp @@ -2005,8 +2005,6 @@ void CChannelList::paintHead() clHead->addElement(CC_ALIGN_RIGHT, CC_ITEMBOX_CLOCK); clHead->addElement(CC_ALIGN_RIGHT, CC_ITEMBOX_PICTURE, "", &indexLogo); } - - clHead->calculateElements(); clHead->paint(); } @@ -2017,7 +2015,6 @@ void CChannelList::showChannelLogo() int dummy; g_PicViewer->GetLogoName(chanlist[selected]->channel_id, chanlist[selected]->getName(), lname, &dummy, &dummy); clHead->refreshElement(indexLogo, lname); - clHead->calculateElements(); clHead->paintElement(indexLogo, true); } } From f45246caedbf9518ea0284f00f81f5926a0fddbf Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Thu, 30 Aug 2012 22:48:40 +0200 Subject: [PATCH 057/224] CComponentsTitleBar: rename member addText(), convert locale in constructor --- src/gui/components/cc.h | 2 +- src/gui/components/components.cpp | 13 +++++-------- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/src/gui/components/cc.h b/src/gui/components/cc.h index 2af658632..d158a1597 100644 --- a/src/gui/components/cc.h +++ b/src/gui/components/cc.h @@ -371,7 +371,7 @@ class CComponentsTitleBar : public CComponentsItemBox neutrino_locale_t tb_locale_text; int tb_text_align; - bool addText(); + bool initText(); void initVarTitleBar(); public: diff --git a/src/gui/components/components.cpp b/src/gui/components/components.cpp index 64bf92a38..6ed6e9c90 100644 --- a/src/gui/components/components.cpp +++ b/src/gui/components/components.cpp @@ -1209,7 +1209,7 @@ CComponentsTitleBar::CComponentsTitleBar(const int x_pos, const int y_pos, const tb_c_text = c_text; tb_text_align = text_alignment; - if (addText()) + if (initText()) calculateElements(); } @@ -1231,7 +1231,7 @@ CComponentsTitleBar::CComponentsTitleBar(const int x_pos, const int y_pos, const tb_s_text = s_text; tb_text_align = text_alignment; - if (addText()) + if (initText()) calculateElements(); } @@ -1251,13 +1251,14 @@ CComponentsTitleBar::CComponentsTitleBar(const int x_pos, const int y_pos, const //CComponentsTitleBar tb_locale_text = locale_text; + tb_s_text = g_Locale->getText(tb_locale_text); tb_text_align = text_alignment; - if (addText()) + if (initText()) calculateElements(); } -bool CComponentsTitleBar::addText() +bool CComponentsTitleBar::initText() { if (tb_c_text){ addElement (tb_text_align, CC_ITEMBOX_TEXT, tb_c_text); @@ -1267,10 +1268,6 @@ bool CComponentsTitleBar::addText() addElement (tb_text_align, CC_ITEMBOX_TEXT, tb_s_text); return true; } - else if (tb_locale_text != NONEXISTANT_LOCALE){ - addElement (tb_text_align, CC_ITEMBOX_TEXT, g_Locale->getText(tb_locale_text)); - return true; - } else return false; } From efb85b958fff41d6402f293a28e8ef9dd1ab0c18 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Fri, 31 Aug 2012 14:00:45 +0200 Subject: [PATCH 058/224] CComponentsTitleBar: add parameter for default icon ...also removed parameter for text ailgnment, because the most titelbars need only left alignment and if required more elements, we can use the addElement() methode. --- src/gui/components/cc.h | 14 ++-- src/gui/components/components.cpp | 102 ++++++++++++++++-------------- 2 files changed, 64 insertions(+), 52 deletions(-) diff --git a/src/gui/components/cc.h b/src/gui/components/cc.h index d158a1597..fcce4a8db 100644 --- a/src/gui/components/cc.h +++ b/src/gui/components/cc.h @@ -367,20 +367,22 @@ class CComponentsTitleBar : public CComponentsItemBox { private: const char* tb_c_text; - std::string tb_s_text; + std::string tb_s_text, tb_icon_name; neutrino_locale_t tb_locale_text; - int tb_text_align; + int tb_text_align, tb_icon_align; - bool initText(); + void initText(); + void initIcon(); + void initElements(); void initVarTitleBar(); public: CComponentsTitleBar(); - CComponentsTitleBar( const int x_pos, const int y_pos, const int w, const int h, const char* c_text = NULL, const int text_alignment = CC_ALIGN_LEFT, + CComponentsTitleBar( const int x_pos, const int y_pos, const int w, const int h, const char* c_text = NULL, const std::string& s_icon ="", fb_pixel_t color_text = COL_MENUHEAD, fb_pixel_t color_body = COL_MENUHEAD_PLUS_0); - CComponentsTitleBar( const int x_pos, const int y_pos, const int w, const int h, const std::string& s_text ="", const int text_alignment = CC_ALIGN_LEFT, + CComponentsTitleBar( const int x_pos, const int y_pos, const int w, const int h, const std::string& s_text ="", const std::string& s_icon ="", fb_pixel_t color_text = COL_MENUHEAD, fb_pixel_t color_body = COL_MENUHEAD_PLUS_0); - CComponentsTitleBar( const int x_pos, const int y_pos, const int w, const int h, neutrino_locale_t locale_text = NONEXISTANT_LOCALE, const int text_alignment = CC_ALIGN_LEFT, + CComponentsTitleBar( const int x_pos, const int y_pos, const int w, const int h, neutrino_locale_t locale_text = NONEXISTANT_LOCALE, const std::string& s_icon ="", fb_pixel_t color_text = COL_MENUHEAD, fb_pixel_t color_body = COL_MENUHEAD_PLUS_0); void paint(bool do_save_bg = CC_SAVE_SCREEN_YES); diff --git a/src/gui/components/components.cpp b/src/gui/components/components.cpp index 6ed6e9c90..a601eb609 100644 --- a/src/gui/components/components.cpp +++ b/src/gui/components/components.cpp @@ -1191,7 +1191,34 @@ CComponentsTitleBar::CComponentsTitleBar() initVarTitleBar(); } -CComponentsTitleBar::CComponentsTitleBar(const int x_pos, const int y_pos, const int w, const int h, const char* c_text, const int text_alignment, +void CComponentsTitleBar::initVarTitleBar() +{ + //CComponentsItemBox + initVarItemBox(); + onlyOneTextElement = true; + + font_text = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]; + it_col_text = COL_MENUHEAD; + + //CComponents + x = 0; + y = 0; + height = font_text->getHeight() + 2*hSpacer; + width = frameBuffer->getScreenWidth(true);; + col_body = COL_MENUHEAD_PLUS_0; + corner_type = CORNER_TOP; + corner_rad = RADIUS_LARGE; + + //CComponentsTitleBar + tb_text_align = CC_ALIGN_LEFT; + tb_icon_align = CC_ALIGN_LEFT; + tb_c_text = NULL; + tb_s_text = ""; + tb_locale_text = NONEXISTANT_LOCALE; + tb_icon_name = ""; +} + +CComponentsTitleBar::CComponentsTitleBar(const int x_pos, const int y_pos, const int w, const int h, const char* c_text, const std::string& s_icon, fb_pixel_t color_text, fb_pixel_t color_body) { //CComponentsItemBox @@ -1207,96 +1234,79 @@ CComponentsTitleBar::CComponentsTitleBar(const int x_pos, const int y_pos, const //CComponentsTitleBar tb_c_text = c_text; - tb_text_align = text_alignment; + tb_icon_name = s_icon; - if (initText()) - calculateElements(); + initElements(); } -CComponentsTitleBar::CComponentsTitleBar(const int x_pos, const int y_pos, const int w, const int h, const string& s_text, const int text_alignment, +CComponentsTitleBar::CComponentsTitleBar(const int x_pos, const int y_pos, const int w, const int h, const string& s_text, const std::string& s_icon, fb_pixel_t color_text, fb_pixel_t color_body) { //CComponentsItemBox initVarTitleBar(); it_col_text = color_text; - + //CComponents x = x_pos; y = y_pos; height = h; width = w; col_body = color_body; - + //CComponentsTitleBar tb_s_text = s_text; - tb_text_align = text_alignment; - - if (initText()) - calculateElements(); + tb_icon_name = s_icon; + + initElements(); } -CComponentsTitleBar::CComponentsTitleBar(const int x_pos, const int y_pos, const int w, const int h, neutrino_locale_t locale_text, const int text_alignment, +CComponentsTitleBar::CComponentsTitleBar(const int x_pos, const int y_pos, const int w, const int h, neutrino_locale_t locale_text, const std::string& s_icon, fb_pixel_t color_text, fb_pixel_t color_body) { //CComponentsItemBox initVarTitleBar(); it_col_text = color_text; - + //CComponents x = x_pos; y = y_pos; height = h; width = w; col_body = color_body; - + //CComponentsTitleBar tb_locale_text = locale_text; tb_s_text = g_Locale->getText(tb_locale_text); - tb_text_align = text_alignment; - - if (initText()) - calculateElements(); + tb_icon_name = s_icon; + + initElements(); } -bool CComponentsTitleBar::initText() +///basic init methodes for constructors *************************************** +void CComponentsTitleBar::initIcon() +{ + if (!tb_icon_name.empty()) + addElement (tb_icon_align, CC_ITEMBOX_ICON, tb_icon_name); +} + +void CComponentsTitleBar::initText() { if (tb_c_text){ addElement (tb_text_align, CC_ITEMBOX_TEXT, tb_c_text); - return true; + return; } else if (!tb_s_text.empty()){ addElement (tb_text_align, CC_ITEMBOX_TEXT, tb_s_text); - return true; + return; } - else - return false; } -void CComponentsTitleBar::initVarTitleBar() +void CComponentsTitleBar::initElements() { - //CComponentsItemBox - initVarItemBox(); - onlyOneTextElement = true; - - font_text = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]; - it_col_text = COL_MENUHEAD; - - //CComponents - x = 0; - y = 0; - height = font_text->getHeight() + 2*hSpacer; - width = frameBuffer->getScreenWidth(true);; - col_body = COL_MENUHEAD_PLUS_0; - corner_type = CORNER_TOP; - corner_rad = RADIUS_LARGE; - - //CComponentsTitleBar - tb_text_align = CC_ALIGN_LEFT; - tb_c_text = NULL; - tb_s_text = ""; - tb_locale_text = NONEXISTANT_LOCALE; + initIcon(); + initText(); } - +///***************************************************************************** void CComponentsTitleBar::paint(bool do_save_bg) { From 2126bbda8115ebadd94b9cb6cf90d03b285d5e5a Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Sat, 1 Sep 2012 21:41:14 +0200 Subject: [PATCH 059/224] CTestMenu: rework member showTestMenu() It's better to split this member. Newer tests can make it too messy. --- src/gui/test_menu.cpp | 62 ++++++++++++++++++++++++++----------------- src/gui/test_menu.h | 3 ++- 2 files changed, 40 insertions(+), 25 deletions(-) diff --git a/src/gui/test_menu.cpp b/src/gui/test_menu.cpp index d0e3419be..b3e0c2975 100644 --- a/src/gui/test_menu.cpp +++ b/src/gui/test_menu.cpp @@ -322,49 +322,63 @@ int CTestMenu::exec(CMenuTarget* parent, const std::string &actionKey) void CTestMenu::showTestMenu() { unsigned int system_rev = cs_get_revision(); - + //init char rev[255]; sprintf(rev, "Test menu, System revision %d %s", system_rev, system_rev == 0 ? "WARNING - INVALID" : ""); - CMenuWidget * TestMenu = new CMenuWidget(rev /*"Test menu"*/); - TestMenu->setSelected(selected); - TestMenu->addIntroItems(); - TestMenu->addItem(new CMenuForwarderNonLocalized("VFD", true, NULL, this, "vfd")); - TestMenu->addItem(new CMenuForwarderNonLocalized("Network", true, NULL, this, "network")); - TestMenu->addItem(new CMenuForwarderNonLocalized("Smartcard 1", true, NULL, this, "card0")); - TestMenu->addItem(new CMenuForwarderNonLocalized("Smartcard 2", true, NULL, this, "card1")); - TestMenu->addItem(new CMenuForwarderNonLocalized("HDD", true, NULL, this, "hdd")); - TestMenu->addItem(new CMenuForwarderNonLocalized("Buttons", true, NULL, this, "buttons")); + CMenuWidget w_test(rev /*"Test menu"*/, NEUTRINO_ICON_INFO, width); + w_test.addIntroItems(); + + //hardware + CMenuWidget * w_hw = new CMenuWidget("Hardware Test", NEUTRINO_ICON_INFO, width); + w_test.addItem(new CMenuForwarderNonLocalized(w_hw->getName().c_str(), true, NULL, w_hw)); + showHWTests(w_hw); + + //buttons + w_test.addItem(new CMenuForwarderNonLocalized("Buttons", true, NULL, this, "buttons")); + + //exit + w_test.exec(NULL, ""); + selected = w_test.getSelected(); +} + +void CTestMenu::showHWTests(CMenuWidget *widget) +{ + widget->setSelected(selected); + widget->addIntroItems(); + widget->addItem(new CMenuForwarderNonLocalized("VFD", true, NULL, this, "vfd")); + widget->addItem(new CMenuForwarderNonLocalized("Network", true, NULL, this, "network")); + widget->addItem(new CMenuForwarderNonLocalized("Smartcard 1", true, NULL, this, "card0")); + widget->addItem(new CMenuForwarderNonLocalized("Smartcard 2", true, NULL, this, "card1")); + widget->addItem(new CMenuForwarderNonLocalized("HDD", true, NULL, this, "hdd")); + CFEManager::getInstance()->setMode(CFEManager::FE_MODE_ALONE); - + CServiceManager::getInstance()->InitSatPosition(130, NULL, true); CServiceManager::getInstance()->InitSatPosition(192, NULL, true); - + satellite_map_t satmap = CServiceManager::getInstance()->SatelliteList(); satmap[130].configured = 1; - + CFrontend * frontend = CFEManager::getInstance()->getFE(0); frontend->setSatellites(satmap); - + int count = CFEManager::getInstance()->getFrontendCount(); if (frontend->getInfo()->type == FE_QPSK) { - TestMenu->addItem(new CMenuForwarderNonLocalized("Tuner 1: Scan 12538000", true, NULL, this, "scan1")); - TestMenu->addItem(new CMenuForwarderNonLocalized("Tuner 1: 22 Khz ON", true, NULL, this, "22kon1")); - TestMenu->addItem(new CMenuForwarderNonLocalized("Tuner 1: 22 Khz OFF", true, NULL, this, "22koff1")); + widget->addItem(new CMenuForwarderNonLocalized("Tuner 1: Scan 12538000", true, NULL, this, "scan1")); + widget->addItem(new CMenuForwarderNonLocalized("Tuner 1: 22 Khz ON", true, NULL, this, "22kon1")); + widget->addItem(new CMenuForwarderNonLocalized("Tuner 1: 22 Khz OFF", true, NULL, this, "22koff1")); if(count > 1) { satmap = CServiceManager::getInstance()->SatelliteList(); satmap[192].configured = 1; frontend = CFEManager::getInstance()->getFE(1); frontend->setSatellites(satmap); - - TestMenu->addItem(new CMenuForwarderNonLocalized("Tuner 2: Scan 12538000", true, NULL, this, "scan2")); - TestMenu->addItem(new CMenuForwarderNonLocalized("Tuner 2: 22 Khz ON", true, NULL, this, "22kon2")); - TestMenu->addItem(new CMenuForwarderNonLocalized("Tuner 2: 22 Khz OFF", true, NULL, this, "22koff2")); + + widget->addItem(new CMenuForwarderNonLocalized("Tuner 2: Scan 12538000", true, NULL, this, "scan2")); + widget->addItem(new CMenuForwarderNonLocalized("Tuner 2: 22 Khz ON", true, NULL, this, "22kon2")); + widget->addItem(new CMenuForwarderNonLocalized("Tuner 2: 22 Khz OFF", true, NULL, this, "22koff2")); } } - TestMenu->exec(NULL, ""); - selected = TestMenu->getSelected(); - delete TestMenu; } #endif diff --git a/src/gui/test_menu.h b/src/gui/test_menu.h index b7f482bdc..db68e3c3e 100644 --- a/src/gui/test_menu.h +++ b/src/gui/test_menu.h @@ -32,7 +32,7 @@ #include #include -//#define TEST_MENU +// #define TEST_MENU #include @@ -42,6 +42,7 @@ class CTestMenu : public CMenuTarget int width, selected; void showTestMenu(); + void showHWTests(CMenuWidget *widget); public: CTestMenu(); From 4b1d9ca213b3f1b6be75ed774a63c1bc2c7b3162 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Sat, 1 Sep 2012 23:35:17 +0200 Subject: [PATCH 060/224] CComponentsShapeSircle: fix segfault on init --- src/gui/components/cc.h | 12 ++++++++++++ src/gui/components/components.cpp | 19 ++++++++++++++++--- 2 files changed, 28 insertions(+), 3 deletions(-) diff --git a/src/gui/components/cc.h b/src/gui/components/cc.h index fcce4a8db..1cb22eb7b 100644 --- a/src/gui/components/cc.h +++ b/src/gui/components/cc.h @@ -389,4 +389,16 @@ class CComponentsTitleBar : public CComponentsItemBox }; + +class CComponentsForm : public CComponentsContainer +{ + private: + + public: + CComponentsForm(); + + void paint(bool do_save_bg = CC_SAVE_SCREEN_YES); + +}; + #endif diff --git a/src/gui/components/components.cpp b/src/gui/components/components.cpp index a601eb609..b36f62965 100644 --- a/src/gui/components/components.cpp +++ b/src/gui/components/components.cpp @@ -455,8 +455,7 @@ CComponentsShapeCircle::CComponentsShapeCircle( int x_pos, int y_pos, int diam, //CComponents x = x_pos; y = y_pos; - width = d; - height = d; + //width = height = d = diam; shadow = has_shadow; shadow_w = SHADOW_OFFSET; col_frame = color_frame; @@ -467,7 +466,7 @@ CComponentsShapeCircle::CComponentsShapeCircle( int x_pos, int y_pos, int diam, bgMode = CC_BGMODE_PERMANENT; //CComponentsShapeCircle - d = diam; + width = height = d = diam; //CComponentsContainer corner_rad = d/2; @@ -1314,3 +1313,17 @@ void CComponentsTitleBar::paint(bool do_save_bg) paintItemBox(do_save_bg); } + +//------------------------------------------------------------------------------------------------------- +//sub class CComponentsForm from CComponentsItemBox +CComponentsForm::CComponentsForm() +{ + //CComponentsContainer + initVarContainer(); +} + +void CComponentsForm::paint(bool do_save_bg) +{ + paintInit(do_save_bg); +} + From e931bdfd6c5d9de000bb1fdb7cf6765a703fd0ac Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Sun, 2 Sep 2012 00:52:14 +0200 Subject: [PATCH 061/224] CComponents: add member isPainted() Useful for monitoring and evaluation of the state of components, is also inherited to all subclasses --- src/gui/components/cc.h | 5 +++-- src/gui/components/components.cpp | 6 ++++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/gui/components/cc.h b/src/gui/components/cc.h index 1cb22eb7b..88ba5388d 100644 --- a/src/gui/components/cc.h +++ b/src/gui/components/cc.h @@ -131,7 +131,7 @@ class CComponents CFrameBuffer * frameBuffer; std::vector v_fbdata; fb_pixel_t col_body, col_shadow, col_frame; - bool firstPaint, shadow; + bool firstPaint, shadow, is_painted; BGMODE_TYPES bgMode; void initVarBasic(); @@ -165,6 +165,7 @@ class CComponents inline virtual void setBgMode(BGMODE_TYPES mode) {bgMode = mode;}; virtual void hide(); + virtual bool isPainted(){return is_painted;}; }; class CComponentsContainer : public CComponents @@ -218,7 +219,7 @@ class CComponentsPicture : public CComponentsContainer inline void setPicture(const std::string& picture_name); void setPictureAlign(const int alignment); - inline bool isPainted(){return pic_painted;}; + inline bool isPicPainted(){return pic_painted;}; void paint(bool do_save_bg = CC_SAVE_SCREEN_YES); inline void getPictureSize(int *pwidth, int *pheight){*pwidth=pic_width; *pheight=pic_height;}; diff --git a/src/gui/components/components.cpp b/src/gui/components/components.cpp index b36f62965..60c08e81f 100644 --- a/src/gui/components/components.cpp +++ b/src/gui/components/components.cpp @@ -74,6 +74,7 @@ void CComponents::initVarBasic() shadow_w = SHADOW_OFFSET; firstPaint = true; + is_painted = false; frameBuffer = CFrameBuffer::getInstance(); v_fbdata.clear(); bgMode = CC_BGMODE_STANDARD; @@ -128,6 +129,8 @@ void CComponents::paintFbItems(struct comp_fbdata_t * fbdata, const int items_co frameBuffer->paintBoxRel(fbdata[i].x, fbdata[i].y, fbdata[i].dx, fbdata[i].dy, fbdata[i].color, fbdata[i].r, corner_type); } } + + is_painted = true; } //screen area save @@ -149,6 +152,7 @@ inline void CComponents::hide() } } v_fbdata.clear(); + is_painted = false; } //clean old screen buffer @@ -238,6 +242,7 @@ void CComponentsContainer::hideContainer(bool no_restore) v_fbdata.clear(); firstPaint = true; } + is_painted = false; } void CComponentsContainer::hide(bool no_restore) @@ -264,6 +269,7 @@ void CComponentsContainer::kill() col_shadow = c_tmp2; col_frame = c_tmp3; firstPaint = true; + is_painted = false; } //synchronize colors for forms From c0d4c204b2cc149a23c103ebcf9f809cc5260115 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Sun, 2 Sep 2012 01:26:05 +0200 Subject: [PATCH 062/224] CTestMenu: add some demos for CComponents --- src/gui/test_menu.cpp | 62 +++++++++++++++++++++++++++++++++++++++++++ src/gui/test_menu.h | 7 ++++- 2 files changed, 68 insertions(+), 1 deletion(-) diff --git a/src/gui/test_menu.cpp b/src/gui/test_menu.cpp index b3e0c2975..0289d6776 100644 --- a/src/gui/test_menu.cpp +++ b/src/gui/test_menu.cpp @@ -54,6 +54,7 @@ #include #include + extern int cs_test_card(int unit, char * str); #ifdef TEST_MENU @@ -61,10 +62,18 @@ CTestMenu::CTestMenu() { width = w_max (50, 10); selected = -1; + circle = NULL; + sq = NULL; + pic= NULL; + pip = NULL; } CTestMenu::~CTestMenu() { + delete sq; + delete circle; + delete pic; + delete pip; } int CTestMenu::exec(CMenuTarget* parent, const std::string &actionKey) @@ -311,7 +320,46 @@ int CTestMenu::exec(CMenuTarget* parent, const std::string &actionKey) delete scanTs; return res; } + else if (actionKey == "circle"){ + if (circle == NULL) + circle = new CComponentsShapeCircle (100, 100, 100, false); + if (!circle->isPainted()) + circle->paint(); + else + circle->hide(); + return res; + } + else if (actionKey == "square"){ + if (sq == NULL) + sq = new CComponentsShapeSquare (100, 220, 100, 100, false); + + if (!sq->isPainted()) + sq->paint(); + else + sq->hide(); + return res; + } + else if (actionKey == "picture"){ + if (pic == NULL) + pic = new CComponentsPicture (100, 100, 200, 200, "/share/tuxbox/neutrino/icons/mp3-5.jpg"); + + if (!pic->isPainted() && !pic->isPicPainted()) + pic->paint(); + else + pic->hide(); + return res; + } + else if (actionKey == "pip"){ + if (pip == NULL) + pip = new CComponentsPIP (100, 100, 25); + + if (!pip->isPainted()) + pip->paint(); + else + pip->hide(); + return res; + } showTestMenu(); @@ -337,11 +385,25 @@ void CTestMenu::showTestMenu() //buttons w_test.addItem(new CMenuForwarderNonLocalized("Buttons", true, NULL, this, "buttons")); + //components + CMenuWidget * w_cc = new CMenuWidget("OSD-Components Demo", NEUTRINO_ICON_INFO, width); + w_test.addItem(new CMenuForwarderNonLocalized(w_cc->getName().c_str(), true, NULL, w_cc)); + showCCTests(w_cc); + //exit w_test.exec(NULL, ""); selected = w_test.getSelected(); } +void CTestMenu::showCCTests(CMenuWidget *widget) +{ + widget->setSelected(selected); + widget->addIntroItems(); + widget->addItem(new CMenuForwarderNonLocalized("Circle", true, NULL, this, "circle")); + widget->addItem(new CMenuForwarderNonLocalized("Square", true, NULL, this, "square")); + widget->addItem(new CMenuForwarderNonLocalized("Picture", true, NULL, this, "picture")); + widget->addItem(new CMenuForwarderNonLocalized("PiP", true, NULL, this, "pip")); +} void CTestMenu::showHWTests(CMenuWidget *widget) { diff --git a/src/gui/test_menu.h b/src/gui/test_menu.h index db68e3c3e..fc2c651de 100644 --- a/src/gui/test_menu.h +++ b/src/gui/test_menu.h @@ -31,7 +31,7 @@ #include #include - +#include // #define TEST_MENU #include @@ -39,10 +39,15 @@ class CTestMenu : public CMenuTarget { private: + CComponentsShapeCircle * circle; + CComponentsShapeSquare* sq; + CComponentsPicture* pic; + CComponentsPIP* pip; int width, selected; void showTestMenu(); void showHWTests(CMenuWidget *widget); + void showCCTests(CMenuWidget *widget); public: CTestMenu(); From 0d039171c0286b5cecc0c3983a929cbbb10cfba3 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Mon, 3 Sep 2012 08:48:38 +0200 Subject: [PATCH 063/224] CComponentsPicture: fix hide() of picture box After hide of a picture box, no paint was possible, this should fix this. --- src/gui/components/cc.h | 1 + src/gui/components/components.cpp | 10 +++++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/gui/components/cc.h b/src/gui/components/cc.h index 88ba5388d..edce4913f 100644 --- a/src/gui/components/cc.h +++ b/src/gui/components/cc.h @@ -221,6 +221,7 @@ class CComponentsPicture : public CComponentsContainer inline bool isPicPainted(){return pic_painted;}; void paint(bool do_save_bg = CC_SAVE_SCREEN_YES); + void hide(bool no_restore = false); inline void getPictureSize(int *pwidth, int *pheight){*pwidth=pic_width; *pheight=pic_height;}; }; diff --git a/src/gui/components/components.cpp b/src/gui/components/components.cpp index 60c08e81f..b9bf8e782 100644 --- a/src/gui/components/components.cpp +++ b/src/gui/components/components.cpp @@ -220,6 +220,8 @@ void CComponentsContainer::paint(bool do_save_bg) //This could help to avoid ugly flicker efffects if it is necessary e.g. on often repaints, without changed contents. void CComponentsContainer::hideContainer(bool no_restore) { + is_painted = false; + if (bgMode == CC_BGMODE_PERMANENT) { if (saved_screen.pixbuf) { frameBuffer->RestoreScreen(saved_screen.x, saved_screen.y, saved_screen.dx, saved_screen.dy, saved_screen.pixbuf); @@ -242,7 +244,6 @@ void CComponentsContainer::hideContainer(bool no_restore) v_fbdata.clear(); firstPaint = true; } - is_painted = false; } void CComponentsContainer::hide(bool no_restore) @@ -806,6 +807,13 @@ void CComponentsPicture::paint(bool do_save_bg) } } +void CComponentsPicture::hide(bool no_restore) +{ + hideContainer(no_restore); + pic_painted = false; +} + + //------------------------------------------------------------------------------------------------------- //sub class CComponentsItemBox from CComponentsContainer CComponentsItemBox::CComponentsItemBox() From f5b584a925f957a154b6d5af28cd03b0643c09c3 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Mon, 3 Sep 2012 12:11:03 +0200 Subject: [PATCH 064/224] CComponentsItemBox: split addElement() --- src/gui/components/cc.h | 9 ++++++--- src/gui/components/components.cpp | 22 ++++++++++++++++++++++ 2 files changed, 28 insertions(+), 3 deletions(-) diff --git a/src/gui/components/cc.h b/src/gui/components/cc.h index edce4913f..c2da27b2e 100644 --- a/src/gui/components/cc.h +++ b/src/gui/components/cc.h @@ -349,6 +349,7 @@ class CComponentsItemBox : public CComponentsContainer void calPositionOfElements(); void paintItemBox(bool do_save_bg = CC_SAVE_SCREEN_YES); void calculateElements(); + bool addElement(int align, int type, const std::string& element="", size_t *index=NULL); public: CComponentsItemBox(); @@ -356,13 +357,15 @@ class CComponentsItemBox : public CComponentsContainer inline virtual void setTextFont(Font* font){font_text = font;}; inline virtual void setTextColor(fb_pixel_t color_text){ it_col_text = color_text;}; - - virtual bool addElement(int align, int type, const std::string& element="", size_t *index=NULL); + virtual void refreshElement(size_t index, const std::string& element); virtual void paintElement(size_t index, bool newElement= false); virtual bool addLogoOrText(int align, const std::string& logo, const std::string& text, size_t *index=NULL); virtual void clearTitlebar(); - + virtual void addText(const std::string& s_text, const int align=CC_ALIGN_LEFT, size_t *index=NULL); + virtual void addIcon(const std::string& s_icon_name, const int align=CC_ALIGN_LEFT, size_t *index=NULL); + virtual void addPicture(const std::string& s_picture_path, const int align=CC_ALIGN_LEFT, size_t *index=NULL); + virtual void addClock(const int align=CC_ALIGN_RIGHT, size_t *index=NULL); }; class CComponentsTitleBar : public CComponentsItemBox diff --git a/src/gui/components/components.cpp b/src/gui/components/components.cpp index b9bf8e782..d81cd8db6 100644 --- a/src/gui/components/components.cpp +++ b/src/gui/components/components.cpp @@ -913,6 +913,26 @@ bool CComponentsItemBox::addLogoOrText(int align, const std::string& logo, const return true; } +void CComponentsItemBox::addText(const std::string& s_text, const int align, size_t *index) +{ + addElement(align, CC_ITEMBOX_TEXT, s_text, index); +} + +void CComponentsItemBox::addIcon(const std::string& s_icon_name, const int align, size_t *index) +{ + addElement(align, CC_ITEMBOX_ICON, s_icon_name, index); +} + +void CComponentsItemBox::addPicture(const std::string& s_picture_path, const int align, size_t *index) +{ + addElement(align, CC_ITEMBOX_PICTURE, s_picture_path, index); +} + +void CComponentsItemBox::addClock(const int align, size_t *index) +{ + addElement(align, CC_ITEMBOX_CLOCK, "", index); +} + bool CComponentsItemBox::addElement(int align, int type, const std::string& element, size_t *index) { comp_element_data_t data; @@ -1196,6 +1216,8 @@ void CComponentsItemBox::clearTitlebar() paintElements = true; } + + //------------------------------------------------------------------------------------------------------- //sub class CComponentsTitleBar from CComponentsItemBox CComponentsTitleBar::CComponentsTitleBar() From d0af8fb7bff6803dd473ff54d2ca3b678e857ce1 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Mon, 3 Sep 2012 12:12:59 +0200 Subject: [PATCH 065/224] CChannelList: adapt for new functionality in CComponents --- src/gui/channellist.cpp | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/src/gui/channellist.cpp b/src/gui/channellist.cpp index 9effe9e8b..e85277be6 100644 --- a/src/gui/channellist.cpp +++ b/src/gui/channellist.cpp @@ -1994,16 +1994,15 @@ void CChannelList::paintHead() if (clHead == NULL) { clHead = new CComponentsTitleBar(); clHead->setDimensionsAll(x, y, width, theight); - - clHead->addElement(CC_ALIGN_LEFT, CC_ITEMBOX_TEXT, name); - - clHead->addElement(CC_ALIGN_RIGHT, CC_ITEMBOX_ICON, NEUTRINO_ICON_BUTTON_INFO); - clHead->addElement(CC_ALIGN_RIGHT, CC_ITEMBOX_ICON, NEUTRINO_ICON_BUTTON_MENU); + + clHead->addText(name); + + clHead->addIcon(NEUTRINO_ICON_BUTTON_INFO, CC_ALIGN_RIGHT); + clHead->addIcon(NEUTRINO_ICON_BUTTON_MENU, CC_ALIGN_RIGHT); if (g_settings.channellist_new_zap_mode) - clHead->addElement(CC_ALIGN_RIGHT, CC_ITEMBOX_ICON, this->new_mode_active ? - NEUTRINO_ICON_BUTTON_MUTE_ZAP_ACTIVE : NEUTRINO_ICON_BUTTON_MUTE_ZAP_INACTIVE); - clHead->addElement(CC_ALIGN_RIGHT, CC_ITEMBOX_CLOCK); - clHead->addElement(CC_ALIGN_RIGHT, CC_ITEMBOX_PICTURE, "", &indexLogo); + clHead->addIcon(this->new_mode_active ? NEUTRINO_ICON_BUTTON_MUTE_ZAP_ACTIVE : NEUTRINO_ICON_BUTTON_MUTE_ZAP_INACTIVE, CC_ALIGN_RIGHT); + clHead->addClock(); + clHead->addPicture("", CC_ALIGN_RIGHT, &indexLogo); } clHead->paint(); } From 2c5367bc593ea567e038aeed4e5bf0dca559ab07 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Tue, 4 Sep 2012 09:45:32 +0200 Subject: [PATCH 066/224] CComponentsItemBox: use also locales in overloaded methode addText() --- src/gui/components/cc.h | 1 + src/gui/components/components.cpp | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/src/gui/components/cc.h b/src/gui/components/cc.h index c2da27b2e..e1d6cdfee 100644 --- a/src/gui/components/cc.h +++ b/src/gui/components/cc.h @@ -363,6 +363,7 @@ class CComponentsItemBox : public CComponentsContainer virtual bool addLogoOrText(int align, const std::string& logo, const std::string& text, size_t *index=NULL); virtual void clearTitlebar(); virtual void addText(const std::string& s_text, const int align=CC_ALIGN_LEFT, size_t *index=NULL); + virtual void addText(neutrino_locale_t locale_text, const int align=CC_ALIGN_LEFT, size_t *index=NULL); virtual void addIcon(const std::string& s_icon_name, const int align=CC_ALIGN_LEFT, size_t *index=NULL); virtual void addPicture(const std::string& s_picture_path, const int align=CC_ALIGN_LEFT, size_t *index=NULL); virtual void addClock(const int align=CC_ALIGN_RIGHT, size_t *index=NULL); diff --git a/src/gui/components/components.cpp b/src/gui/components/components.cpp index d81cd8db6..5856300e2 100644 --- a/src/gui/components/components.cpp +++ b/src/gui/components/components.cpp @@ -918,6 +918,11 @@ void CComponentsItemBox::addText(const std::string& s_text, const int align, siz addElement(align, CC_ITEMBOX_TEXT, s_text, index); } +void CComponentsItemBox::addText(neutrino_locale_t locale_text, const int align, size_t *index) +{ + addElement(align, CC_ITEMBOX_TEXT, g_Locale->getText(locale_text), index); +} + void CComponentsItemBox::addIcon(const std::string& s_icon_name, const int align, size_t *index) { addElement(align, CC_ITEMBOX_ICON, s_icon_name, index); From 32515da2368d28db025f7fba4e3cde06fbcca05f Mon Sep 17 00:00:00 2001 From: micha-bbg Date: Tue, 4 Sep 2012 20:33:22 +0200 Subject: [PATCH 067/224] CComponentsInfoBox: Add 'bgMode = CC_BGMODE_PERMANENT' to initVarInfobox() --- src/gui/components/components.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/gui/components/components.cpp b/src/gui/components/components.cpp index 5856300e2..4f6f7337e 100644 --- a/src/gui/components/components.cpp +++ b/src/gui/components/components.cpp @@ -337,7 +337,8 @@ void CComponentsInfoBox::initVarInfobox() { //CComponents, ComponentsContainer initVarContainer(); - + bgMode = CC_BGMODE_PERMANENT; + //CComponentsInfoBox box = NULL; textbox = NULL; From 33b4fc4cfa31e06f9aba032a9779ceae92cb0672 Mon Sep 17 00:00:00 2001 From: micha-bbg Date: Tue, 4 Sep 2012 20:31:36 +0200 Subject: [PATCH 068/224] CComponentsItemBox: Add flag 'isCalculated' for control calculateElements() --- src/gui/components/cc.h | 2 ++ src/gui/components/components.cpp | 12 ++++++++++++ 2 files changed, 14 insertions(+) diff --git a/src/gui/components/cc.h b/src/gui/components/cc.h index e1d6cdfee..a08ac4cc6 100644 --- a/src/gui/components/cc.h +++ b/src/gui/components/cc.h @@ -342,6 +342,7 @@ class CComponentsItemBox : public CComponentsContainer size_t prevElementLeft; size_t prevElementRight; std::vector v_element_data; + bool isCalculated; void clearElements(); void initVarItemBox(); @@ -367,6 +368,7 @@ class CComponentsItemBox : public CComponentsContainer virtual void addIcon(const std::string& s_icon_name, const int align=CC_ALIGN_LEFT, size_t *index=NULL); virtual void addPicture(const std::string& s_picture_path, const int align=CC_ALIGN_LEFT, size_t *index=NULL); virtual void addClock(const int align=CC_ALIGN_RIGHT, size_t *index=NULL); + virtual int getHeight(); }; class CComponentsTitleBar : public CComponentsItemBox diff --git a/src/gui/components/components.cpp b/src/gui/components/components.cpp index 4f6f7337e..e8cbaf812 100644 --- a/src/gui/components/components.cpp +++ b/src/gui/components/components.cpp @@ -852,9 +852,17 @@ void CComponentsItemBox::initVarItemBox() prevElementLeft = 0; prevElementRight = 0; onlyOneTextElement = false; + isCalculated = false; v_element_data.clear(); } +int CComponentsItemBox::getHeight() +{ + if (!isCalculated) + calculateElements(); + return height; +} + void CComponentsItemBox::clearElements() { for(size_t i = 0; i < v_element_data.size(); i++) { @@ -874,6 +882,7 @@ void CComponentsItemBox::clearElements() break; } } + isCalculated = false; v_element_data.clear(); } @@ -911,6 +920,7 @@ bool CComponentsItemBox::addLogoOrText(int align, const std::string& logo, const v_element_data.push_back(data); if (index != NULL) *index = v_element_data.size()-1; + isCalculated = false; return true; } @@ -974,6 +984,7 @@ bool CComponentsItemBox::addElement(int align, int type, const std::string& elem v_element_data.push_back(data); if (index != NULL) *index = v_element_data.size()-1; + isCalculated = false; return true; } @@ -1199,6 +1210,7 @@ void CComponentsItemBox::calculateElements() } calPositionOfElements(); + isCalculated = true; } void CComponentsItemBox::paintItemBox(bool do_save_bg) From 16d12b42433ee38aefff5b72a2a06329153c8e13 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Wed, 5 Sep 2012 12:19:52 +0200 Subject: [PATCH 069/224] CComponentsForm: add basics for CComponentsForm --- src/gui/components/cc.h | 7 +++++-- src/gui/components/components.cpp | 33 +++++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+), 2 deletions(-) diff --git a/src/gui/components/cc.h b/src/gui/components/cc.h index a08ac4cc6..a66990056 100644 --- a/src/gui/components/cc.h +++ b/src/gui/components/cc.h @@ -401,12 +401,15 @@ class CComponentsTitleBar : public CComponentsItemBox class CComponentsForm : public CComponentsContainer { private: + CComponentsTitleBar tb; + + void initVarForm(); public: CComponentsForm(); - - void paint(bool do_save_bg = CC_SAVE_SCREEN_YES); + void paint(bool do_save_bg = CC_SAVE_SCREEN_YES); + void hide(bool no_restore = false); }; #endif diff --git a/src/gui/components/components.cpp b/src/gui/components/components.cpp index e8cbaf812..a9986cbe4 100644 --- a/src/gui/components/components.cpp +++ b/src/gui/components/components.cpp @@ -1242,6 +1242,7 @@ CComponentsTitleBar::CComponentsTitleBar() { //CComponentsTitleBar initVarTitleBar(); + bgMode = CC_BGMODE_PERMANENT; } void CComponentsTitleBar::initVarTitleBar() @@ -1371,13 +1372,45 @@ void CComponentsTitleBar::paint(bool do_save_bg) //------------------------------------------------------------------------------------------------------- //sub class CComponentsForm from CComponentsItemBox CComponentsForm::CComponentsForm() +{ + //CComponentsForm + initVarForm(); +} + +void CComponentsForm::initVarForm() { //CComponentsContainer initVarContainer(); + bgMode = CC_BGMODE_PERMANENT; + + //simple default dimensions + width = 150; + height = 150; + setCornerRadius(RADIUS_LARGE); + setCornerType(CORNER_BOTTOM); } void CComponentsForm::paint(bool do_save_bg) { + int ytmp = y; + int htmp = height; + tb.setXPos(x); + tb.setYPos(y); + tb.setWidth(width); + tb.addText("Form"); + tb.addIcon(NEUTRINO_ICON_INFO); + tb.paint(do_save_bg); + + y = height+tb.getHeight(); + height = height-tb.getHeight(); paintInit(do_save_bg); + y = ytmp; + height = htmp; +} + +void CComponentsForm::hide(bool no_restore) +{ + tb.hide(no_restore); + hideContainer(no_restore); } From 458cec23bfa90b92b8cfa991d43bc44e8f6d4dc2 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Fri, 7 Sep 2012 23:15:23 +0200 Subject: [PATCH 070/224] CComponents: remove superfluous calls firstPaint, v_fbdata.clear() already called in initVarBasic() and initVarBasic() is called in all subclass constructors --- src/gui/components/components.cpp | 8 -------- 1 file changed, 8 deletions(-) diff --git a/src/gui/components/components.cpp b/src/gui/components/components.cpp index a9986cbe4..cdcf6635d 100644 --- a/src/gui/components/components.cpp +++ b/src/gui/components/components.cpp @@ -445,8 +445,6 @@ CComponentsShapeSquare::CComponentsShapeSquare(const int x_pos, const int y_pos, col_frame = color_frame; col_body = color_body; col_shadow = color_shadow; - firstPaint = true; - v_fbdata.clear(); bgMode = CC_BGMODE_PERMANENT; @@ -469,8 +467,6 @@ CComponentsShapeCircle::CComponentsShapeCircle( int x_pos, int y_pos, int diam, col_frame = color_frame; col_body = color_body; col_shadow = color_shadow; - firstPaint = true; - v_fbdata.clear(); bgMode = CC_BGMODE_PERMANENT; //CComponentsShapeCircle @@ -649,8 +645,6 @@ CComponentsPIP::CComponentsPIP( const int x_pos, const int y_pos, const int perc col_frame = COL_BACKGROUND; col_body = COL_BACKGROUND; col_shadow = COL_MENUCONTENTDARK_PLUS_0; - firstPaint = true; - v_fbdata.clear(); bgMode = CC_BGMODE_PERMANENT; } @@ -731,8 +725,6 @@ void CComponentsPicture::init( int x_pos, int y_pos, const string& picture_name, col_frame = color_frame; col_body = color_background; col_shadow = color_shadow; - firstPaint = true; - v_fbdata.clear(); bgMode = CC_BGMODE_PERMANENT; } From 09b8b291767854ec565598c8802930919368c3ef Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Sat, 8 Sep 2012 19:39:58 +0200 Subject: [PATCH 071/224] CComponents: reset saved_screen.pixbuf It's safe to work with null pointer --- src/gui/components/components.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/gui/components/components.cpp b/src/gui/components/components.cpp index cdcf6635d..2d09df660 100644 --- a/src/gui/components/components.cpp +++ b/src/gui/components/components.cpp @@ -57,6 +57,7 @@ void CComponents::clearSavedScreen() { if (saved_screen.pixbuf) delete[] saved_screen.pixbuf; + saved_screen.pixbuf = NULL; } void CComponents::initVarBasic() @@ -429,6 +430,7 @@ void CComponentsInfoBox::removeLineBreaks(std::string& str) } } + //------------------------------------------------------------------------------------------------------- //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) From 7bbf0375e1790afc50f54d7fb1bbeff76a2bf4a0 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Sat, 8 Sep 2012 22:03:33 +0200 Subject: [PATCH 072/224] CComponents: remove bgmode handler bg_mode varible was never used --- src/gui/components/cc.h | 10 ------ src/gui/components/components.cpp | 56 ++++++++----------------------- 2 files changed, 14 insertions(+), 52 deletions(-) diff --git a/src/gui/components/cc.h b/src/gui/components/cc.h index a66990056..9b7810c6a 100644 --- a/src/gui/components/cc.h +++ b/src/gui/components/cc.h @@ -70,14 +70,6 @@ typedef struct comp_screen_data_t fb_pixel_t* pixbuf; } comp_screen_data_struct_t; -typedef enum -{ - CC_BGMODE_STANDARD, - CC_BGMODE_PERMANENT, - - CC_BGMODE_TYPES -}BGMODE_TYPES; - //align types enum { @@ -132,7 +124,6 @@ class CComponents std::vector v_fbdata; fb_pixel_t col_body, col_shadow, col_frame; bool firstPaint, shadow, is_painted; - BGMODE_TYPES bgMode; void initVarBasic(); void paintFbItems(struct comp_fbdata_t * fbdata, const int items_count, bool do_save_bg = true); @@ -162,7 +153,6 @@ class CComponents inline virtual void setColorBody(fb_pixel_t color){col_body = color;}; inline virtual void setColorShadow(fb_pixel_t color){col_shadow = color;}; inline virtual void setColorAll(fb_pixel_t color_frame, fb_pixel_t color_body, fb_pixel_t color_shadow){col_frame = color_frame; col_body = color_body; col_shadow = color_shadow;}; - inline virtual void setBgMode(BGMODE_TYPES mode) {bgMode = mode;}; virtual void hide(); virtual bool isPainted(){return is_painted;}; diff --git a/src/gui/components/components.cpp b/src/gui/components/components.cpp index 2d09df660..5c6cfca2a 100644 --- a/src/gui/components/components.cpp +++ b/src/gui/components/components.cpp @@ -78,7 +78,6 @@ void CComponents::initVarBasic() is_painted = false; frameBuffer = CFrameBuffer::getInstance(); v_fbdata.clear(); - bgMode = CC_BGMODE_STANDARD; saved_screen.pixbuf = NULL; } @@ -89,17 +88,13 @@ void CComponents::paintFbItems(struct comp_fbdata_t * fbdata, const int items_co for(int i=0; iRestoreScreen(saved_screen.x, saved_screen.y, saved_screen.dx, saved_screen.dy, saved_screen.pixbuf); - if (no_restore) { - delete[] saved_screen.pixbuf; - saved_screen.pixbuf = NULL; - firstPaint = true; - } + if (saved_screen.pixbuf) { + frameBuffer->RestoreScreen(saved_screen.x, saved_screen.y, saved_screen.dx, saved_screen.dy, saved_screen.pixbuf); + if (no_restore) { + delete[] saved_screen.pixbuf; + saved_screen.pixbuf = NULL; + firstPaint = true; } } - else { - if (no_restore) - return; - - for(size_t i =0; i< v_fbdata.size() ;i++) { - if (v_fbdata[i].pixbuf != NULL && v_fbdata[i].fbdata_type == CC_FBDATA_TYPE_BGSCREEN) - frameBuffer->RestoreScreen(v_fbdata[i].x, v_fbdata[i].y, v_fbdata[i].dx, v_fbdata[i].dy, v_fbdata[i].pixbuf); - delete[] v_fbdata[i].pixbuf; - } - v_fbdata.clear(); - firstPaint = true; - } } void CComponentsContainer::hide(bool no_restore) @@ -338,8 +319,7 @@ void CComponentsInfoBox::initVarInfobox() { //CComponents, ComponentsContainer initVarContainer(); - bgMode = CC_BGMODE_PERMANENT; - + //CComponentsInfoBox box = NULL; textbox = NULL; @@ -447,9 +427,6 @@ CComponentsShapeSquare::CComponentsShapeSquare(const int x_pos, const int y_pos, col_frame = color_frame; col_body = color_body; col_shadow = color_shadow; - bgMode = CC_BGMODE_PERMANENT; - - } //------------------------------------------------------------------------------------------------------- @@ -469,7 +446,6 @@ CComponentsShapeCircle::CComponentsShapeCircle( int x_pos, int y_pos, int diam, col_frame = color_frame; col_body = color_body; col_shadow = color_shadow; - bgMode = CC_BGMODE_PERMANENT; //CComponentsShapeCircle width = height = d = diam; @@ -647,7 +623,6 @@ CComponentsPIP::CComponentsPIP( const int x_pos, const int y_pos, const int perc col_frame = COL_BACKGROUND; col_body = COL_BACKGROUND; col_shadow = COL_MENUCONTENTDARK_PLUS_0; - bgMode = CC_BGMODE_PERMANENT; } CComponentsPIP::~CComponentsPIP() @@ -727,7 +702,6 @@ void CComponentsPicture::init( int x_pos, int y_pos, const string& picture_name, col_frame = color_frame; col_body = color_background; col_shadow = color_shadow; - bgMode = CC_BGMODE_PERMANENT; } void CComponentsPicture::setPicture(const std::string& picture_name) @@ -1236,7 +1210,6 @@ CComponentsTitleBar::CComponentsTitleBar() { //CComponentsTitleBar initVarTitleBar(); - bgMode = CC_BGMODE_PERMANENT; } void CComponentsTitleBar::initVarTitleBar() @@ -1375,7 +1348,6 @@ void CComponentsForm::initVarForm() { //CComponentsContainer initVarContainer(); - bgMode = CC_BGMODE_PERMANENT; //simple default dimensions width = 150; From bc764b46531964519da91d1a24eed95d09c531ff Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Sun, 9 Sep 2012 00:29:58 +0200 Subject: [PATCH 073/224] CComponentsForm: add functionality Now it's possible to paint forms with defined caption and icon --- src/gui/components/cc.h | 8 +++- src/gui/components/components.cpp | 80 ++++++++++++++++++++++++------- 2 files changed, 71 insertions(+), 17 deletions(-) diff --git a/src/gui/components/cc.h b/src/gui/components/cc.h index 9b7810c6a..182c44772 100644 --- a/src/gui/components/cc.h +++ b/src/gui/components/cc.h @@ -391,15 +391,21 @@ class CComponentsTitleBar : public CComponentsItemBox class CComponentsForm : public CComponentsContainer { private: - CComponentsTitleBar tb; + CComponentsTitleBar *tb; + std::string tb_text, tb_icon; void initVarForm(); + void paintHead(); public: CComponentsForm(); + ~CComponentsForm(); void paint(bool do_save_bg = CC_SAVE_SCREEN_YES); void hide(bool no_restore = false); + void setCaption(const std::string& text); + void setCaption(neutrino_locale_t locale_text); + void setIcon(const std::string& icon_name){tb_icon = icon_name;}; }; #endif diff --git a/src/gui/components/components.cpp b/src/gui/components/components.cpp index 5c6cfca2a..964f48f71 100644 --- a/src/gui/components/components.cpp +++ b/src/gui/components/components.cpp @@ -1344,39 +1344,87 @@ CComponentsForm::CComponentsForm() initVarForm(); } +CComponentsForm::~CComponentsForm() +{ + hide(); + clearSavedScreen(); + delete tb; + clear(); +} + void CComponentsForm::initVarForm() { //CComponentsContainer initVarContainer(); //simple default dimensions + x = 0; + y = 0; width = 150; height = 150; - setCornerRadius(RADIUS_LARGE); - setCornerType(CORNER_BOTTOM); + shadow = CC_SHADOW_OFF; + shadow_w = SHADOW_OFFSET; + col_frame = COL_MENUCONTENT_PLUS_6; + col_body = COL_MENUCONTENT_PLUS_0; + col_shadow = COL_MENUCONTENTDARK_PLUS_0; + corner_rad = RADIUS_LARGE; + corner_type = CORNER_ALL; + + //CComponentsForm + tb = NULL; + tb_text = "no caption"; + tb_icon = ""; } void CComponentsForm::paint(bool do_save_bg) { - int ytmp = y; - int htmp = height; - tb.setXPos(x); - tb.setYPos(y); - tb.setWidth(width); - tb.addText("Form"); - tb.addIcon(NEUTRINO_ICON_INFO); - tb.paint(do_save_bg); - - y = height+tb.getHeight(); - height = height-tb.getHeight(); + //paint body paintInit(do_save_bg); - y = ytmp; - height = htmp; + + //paint header + paintHead(); +} + +void CComponentsForm::paintHead() +{ + //init header + if (tb == NULL){ + tb = new CComponentsTitleBar(); + + //init icon + if (!tb_icon.empty()) + tb->addIcon(tb_icon, CC_ALIGN_LEFT); + + //init text + if (!tb_text.empty()) + tb->addText(tb_text, CC_ALIGN_LEFT); + + int tbh = tb->getHeight(); + tb->setDimensionsAll(x, y, width, tbh); + } + + //paint titlebar + tb->paint(CC_SAVE_SCREEN_NO); +} + +void CComponentsForm::setCaption(const string& text) +{ + if (tb){ + delete tb; + tb = NULL; + } + tb_text = text; +} + +void CComponentsForm::setCaption(neutrino_locale_t locale_text) +{ + string tmptxt = g_Locale->getText(locale_text); + setCaption(tmptxt); } void CComponentsForm::hide(bool no_restore) { - tb.hide(no_restore); + //hide body hideContainer(no_restore); } From 7105518423f5fbdda54bb13966fa42e8b6a54d7e Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Sun, 9 Sep 2012 00:31:59 +0200 Subject: [PATCH 074/224] CTestMenu: add tests for form objects --- src/gui/test_menu.cpp | 22 +++++++++++++++++++--- src/gui/test_menu.h | 1 + 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/src/gui/test_menu.cpp b/src/gui/test_menu.cpp index 0289d6776..636b005b7 100644 --- a/src/gui/test_menu.cpp +++ b/src/gui/test_menu.cpp @@ -66,6 +66,7 @@ CTestMenu::CTestMenu() sq = NULL; pic= NULL; pip = NULL; + form = NULL; } CTestMenu::~CTestMenu() @@ -74,6 +75,7 @@ CTestMenu::~CTestMenu() delete circle; delete pic; delete pip; + delete form; } int CTestMenu::exec(CMenuTarget* parent, const std::string &actionKey) @@ -360,9 +362,22 @@ int CTestMenu::exec(CMenuTarget* parent, const std::string &actionKey) pip->hide(); return res; } - + else if (actionKey == "form"){ + if (form == NULL) + form = new CComponentsForm(); + form->setDimensionsAll(100, 100, 250, 300); + form->setCaption(NONEXISTANT_LOCALE); + form->setIcon(NEUTRINO_ICON_INFO); + + if (form->isPainted()) + form->hide(); + else + form->paint(); + return res; + } + showTestMenu(); - + return res; } @@ -402,7 +417,8 @@ void CTestMenu::showCCTests(CMenuWidget *widget) widget->addItem(new CMenuForwarderNonLocalized("Circle", true, NULL, this, "circle")); widget->addItem(new CMenuForwarderNonLocalized("Square", true, NULL, this, "square")); widget->addItem(new CMenuForwarderNonLocalized("Picture", true, NULL, this, "picture")); - widget->addItem(new CMenuForwarderNonLocalized("PiP", true, NULL, this, "pip")); + widget->addItem(new CMenuForwarderNonLocalized("PiP", true, NULL, this, "pip")); + widget->addItem(new CMenuForwarderNonLocalized("Form", true, NULL, this, "form")); } void CTestMenu::showHWTests(CMenuWidget *widget) diff --git a/src/gui/test_menu.h b/src/gui/test_menu.h index fc2c651de..d5abe6a51 100644 --- a/src/gui/test_menu.h +++ b/src/gui/test_menu.h @@ -43,6 +43,7 @@ class CTestMenu : public CMenuTarget CComponentsShapeSquare* sq; CComponentsPicture* pic; CComponentsPIP* pip; + CComponentsForm *form; int width, selected; void showTestMenu(); From 5bbe8e770eaedd24f91bee0301780aa12acf9f9f Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Sun, 9 Sep 2012 12:49:05 +0200 Subject: [PATCH 075/224] CComponentsItemBox: move paint of icons and pictures into it's own member --- src/gui/components/cc.h | 3 +- src/gui/components/components.cpp | 51 +++++++++++++++++++------------ 2 files changed, 33 insertions(+), 21 deletions(-) diff --git a/src/gui/components/cc.h b/src/gui/components/cc.h index 182c44772..9b341c2f3 100644 --- a/src/gui/components/cc.h +++ b/src/gui/components/cc.h @@ -341,6 +341,7 @@ class CComponentsItemBox : public CComponentsContainer void paintItemBox(bool do_save_bg = CC_SAVE_SCREEN_YES); void calculateElements(); bool addElement(int align, int type, const std::string& element="", size_t *index=NULL); + void paintImage(size_t index, bool newElement); public: CComponentsItemBox(); @@ -400,7 +401,7 @@ class CComponentsForm : public CComponentsContainer public: CComponentsForm(); ~CComponentsForm(); - + void paint(bool do_save_bg = CC_SAVE_SCREEN_YES); void hide(bool no_restore = false); void setCaption(const std::string& text); diff --git a/src/gui/components/components.cpp b/src/gui/components/components.cpp index 964f48f71..fa18adb69 100644 --- a/src/gui/components/components.cpp +++ b/src/gui/components/components.cpp @@ -980,33 +980,44 @@ void CComponentsItemBox::refreshElement(size_t index, const std::string& element calculateElements(); } -void CComponentsItemBox::paintElement(size_t index, bool newElement) +//paint image into item box +void CComponentsItemBox::paintImage(size_t index, bool newElement) { CComponentsPicture* pic = NULL; + pic = static_cast(v_element_data[index].handler1); + + int pw = 0, ph = 0; + + if ((newElement) || (pic == NULL)) { + if (pic != NULL) { + pic->hide(); + delete pic; + pic = NULL; + } + if ((v_element_data[index].type) == CC_ITEMBOX_PICTURE) + pic = new CComponentsPicture( v_element_data[index].x, v_element_data[index].y, v_element_data[index].width, + v_element_data[index].height, v_element_data[index].element); + else + pic = new CComponentsPicture( v_element_data[index].x, v_element_data[index].y, v_element_data[index].element); + v_element_data[index].handler1 = (void*)pic; + } + + pic->getPictureSize(&pw, &ph); + pic->setHeight(ph); + pic->setWidth(pw); + pic->setColorBody(col_body); + pic->paint(); +} + +void CComponentsItemBox::paintElement(size_t index, bool newElement) +{ CBox* box = NULL; CTextBox* textbox = NULL; - int pw = 0, ph = 0; + switch (v_element_data[index].type) { case CC_ITEMBOX_ICON: case CC_ITEMBOX_PICTURE: - pic = static_cast(v_element_data[index].handler1); - if ((newElement) || (pic == NULL)) { - if (pic != NULL) { - pic->hide(); - delete pic; - } - if ((v_element_data[index].type) == CC_ITEMBOX_PICTURE) - pic = new CComponentsPicture( v_element_data[index].x, v_element_data[index].y, v_element_data[index].width, - v_element_data[index].height, v_element_data[index].element); - else - pic = new CComponentsPicture( v_element_data[index].x, v_element_data[index].y, v_element_data[index].element); - v_element_data[index].handler1 = (void*)pic; - } - pic->getPictureSize(&pw, &ph); - pic->setHeight(ph); - pic->setWidth(pw); - pic->setColorBody(col_body); - pic->paint(); + paintImage(index,newElement); break; case CC_ITEMBOX_TEXT: box = static_cast(v_element_data[index].handler1); From 2c6a317b4096a1c5652f725b911c254327448b4a Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Sun, 9 Sep 2012 13:32:13 +0200 Subject: [PATCH 076/224] CComponentsItemBox: move paint of text into its own method --- src/gui/components/cc.h | 7 +-- src/gui/components/components.cpp | 80 +++++++++++++++++++------------ 2 files changed, 53 insertions(+), 34 deletions(-) diff --git a/src/gui/components/cc.h b/src/gui/components/cc.h index 9b341c2f3..e7af3d4d3 100644 --- a/src/gui/components/cc.h +++ b/src/gui/components/cc.h @@ -333,7 +333,7 @@ class CComponentsItemBox : public CComponentsContainer size_t prevElementRight; std::vector v_element_data; bool isCalculated; - + void clearElements(); void initVarItemBox(); void calSizeOfElements(); @@ -342,11 +342,12 @@ class CComponentsItemBox : public CComponentsContainer void calculateElements(); bool addElement(int align, int type, const std::string& element="", size_t *index=NULL); void paintImage(size_t index, bool newElement); - + void paintText(size_t index, bool newElement); + public: CComponentsItemBox(); virtual ~CComponentsItemBox(); - + inline virtual void setTextFont(Font* font){font_text = font;}; inline virtual void setTextColor(fb_pixel_t color_text){ it_col_text = color_text;}; diff --git a/src/gui/components/components.cpp b/src/gui/components/components.cpp index fa18adb69..d40e617e1 100644 --- a/src/gui/components/components.cpp +++ b/src/gui/components/components.cpp @@ -1009,45 +1009,63 @@ void CComponentsItemBox::paintImage(size_t index, bool newElement) pic->paint(); } +//paint text into item box +void CComponentsItemBox::paintText(size_t index, bool newElement) +{ + //prepare textbox dimension instances + CBox* box = NULL; + box = static_cast(v_element_data[index].handler1); + + if ((newElement) || (box == NULL)) { + if (box != NULL) { + delete box; + box = NULL; + } + box = new CBox(); + v_element_data[index].handler1 = (void*)box; + } + + box->iX = v_element_data[index].x; + box->iY = v_element_data[index].y; + box->iWidth = v_element_data[index].width; + box->iHeight = v_element_data[index].height; + + + //prepare text + CTextBox* textbox = NULL; + textbox = static_cast(v_element_data[index].handler2); + + if ((newElement) || (textbox == NULL)) { + if (textbox != NULL) { + textbox->hide(); + delete textbox; + textbox = NULL; + } + textbox = new CTextBox(v_element_data[index].element.c_str(), font_text, CTextBox::AUTO_WIDTH|CTextBox::AUTO_HIGH, box, col_body); + v_element_data[index].handler2 = (void*)textbox; + } + + textbox->setTextBorderWidth(0); + textbox->enableBackgroundPaint(false); + textbox->setTextFont(font_text); + textbox->movePosition(box->iX, box->iY); + textbox->setTextColor(it_col_text); + + if (textbox->setText(&v_element_data[index].element)) + textbox->paint(); +} + + +//paint available elements at one task void CComponentsItemBox::paintElement(size_t index, bool newElement) { - CBox* box = NULL; - CTextBox* textbox = NULL; - switch (v_element_data[index].type) { case CC_ITEMBOX_ICON: case CC_ITEMBOX_PICTURE: paintImage(index,newElement); break; case CC_ITEMBOX_TEXT: - box = static_cast(v_element_data[index].handler1); - if ((newElement) || (box == NULL)) { - if (box != NULL) { - delete box; - } - box = new CBox(); - v_element_data[index].handler1 = (void*)box; - } - box->iX = v_element_data[index].x; - box->iY = v_element_data[index].y; - box->iWidth = v_element_data[index].width; - box->iHeight = v_element_data[index].height; - textbox = static_cast(v_element_data[index].handler2); - if ((newElement) || (textbox == NULL)) { - if (textbox != NULL) { - textbox->hide(); - delete textbox; - } - textbox = new CTextBox(v_element_data[index].element.c_str(), font_text, CTextBox::AUTO_WIDTH|CTextBox::AUTO_HIGH, box, col_body); - v_element_data[index].handler2 = (void*)textbox; - } - textbox->setTextBorderWidth(0); - textbox->enableBackgroundPaint(false); - textbox->setTextFont(font_text); - textbox->movePosition(box->iX, box->iY); - textbox->setTextColor(it_col_text); - if (textbox->setText(&v_element_data[index].element)) - textbox->paint(); + paintText(index,newElement); break; case CC_ITEMBOX_CLOCK: font_text->RenderString(v_element_data[index].x, v_element_data[index].y, v_element_data[index].width, From cb8ac750a5c201cb42ceed81af950ade93aa3ee1 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Wed, 12 Sep 2012 21:50:59 +0200 Subject: [PATCH 077/224] CComponents: clean up, don't use fbadata in paintFbItems() Use consistently vector v_fbdata, so we don't need all parameters in paintFbItems() --- src/gui/components/cc.h | 2 +- src/gui/components/components.cpp | 41 +++++++++++++++---------------- 2 files changed, 21 insertions(+), 22 deletions(-) diff --git a/src/gui/components/cc.h b/src/gui/components/cc.h index e7af3d4d3..034709e80 100644 --- a/src/gui/components/cc.h +++ b/src/gui/components/cc.h @@ -126,7 +126,7 @@ class CComponents bool firstPaint, shadow, is_painted; void initVarBasic(); - void paintFbItems(struct comp_fbdata_t * fbdata, const int items_count, bool do_save_bg = true); + void paintFbItems(bool do_save_bg = true); fb_pixel_t* getScreen(int ax, int ay, int dx, int dy); comp_screen_data_t saved_screen; diff --git a/src/gui/components/components.cpp b/src/gui/components/components.cpp index d40e617e1..0322982bb 100644 --- a/src/gui/components/components.cpp +++ b/src/gui/components/components.cpp @@ -82,16 +82,16 @@ void CComponents::initVarBasic() } //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(bool do_save_bg) { if (firstPaint && do_save_bg) { - for(int i=0; i 0) - frameBuffer->paintBoxFrame(fbdata[i].x, fbdata[i].y, fbdata[i].dx, fbdata[i].dy, fbdata[i].frame_thickness, fbdata[i].color, fbdata[i].r); + if (fbtype == CC_FBDATA_TYPE_FRAME && v_fbdata[i].frame_thickness > 0) + frameBuffer->paintBoxFrame(v_fbdata[i].x, v_fbdata[i].y, v_fbdata[i].dx, v_fbdata[i].dy, v_fbdata[i].frame_thickness, v_fbdata[i].color, v_fbdata[i].r); else if (fbtype == CC_FBDATA_TYPE_BACKGROUND) - frameBuffer->paintBackgroundBoxRel(x, y, fbdata[i].dx, fbdata[i].dy); + frameBuffer->paintBackgroundBoxRel(x, y, v_fbdata[i].dx, v_fbdata[i].dy); else - frameBuffer->paintBoxRel(fbdata[i].x, fbdata[i].y, fbdata[i].dx, fbdata[i].dy, fbdata[i].color, fbdata[i].r, corner_type); + frameBuffer->paintBoxRel(v_fbdata[i].x, v_fbdata[i].y, v_fbdata[i].dx, v_fbdata[i].dy, v_fbdata[i].color, v_fbdata[i].r, corner_type); } } @@ -201,9 +200,10 @@ void CComponentsContainer::paintInit(bool do_save_bg) {CC_FBDATA_TYPE_BOX, x+th, y+th, width-2*th, height-2*th, col_body, corner_rad-th, 0, NULL, NULL}, }; - int items_cnt = sizeof(fbdata) / sizeof(fbdata[0]); + for(size_t i =0; i< (sizeof(fbdata) / sizeof(fbdata[0])) ;i++) + v_fbdata.push_back(fbdata[i]); - paintFbItems(fbdata, items_cnt, do_save_bg); + paintFbItems(do_save_bg); } void CComponentsContainer::paint(bool do_save_bg) @@ -535,8 +535,6 @@ CComponentsDetailLine::~CComponentsDetailLine() //paint details line with current parameters void CComponentsDetailLine::paint(bool do_save_bg) { - int items_cnt = 0; - clear(); int y_mark_top = y-h_mark_top/2+thickness/2; @@ -569,9 +567,10 @@ void CComponentsDetailLine::paint(bool do_save_bg) {CC_FBDATA_TYPE_LINE, x+width-thickness-sw, y_mark_down+h_mark_down,thickness+sw, sw, col_shadow, 0, 0, NULL, NULL}, }; - items_cnt = sizeof(fbdata) / sizeof(fbdata[0]); + for(size_t i =0; i< (sizeof(fbdata) / sizeof(fbdata[0])) ;i++) + v_fbdata.push_back(fbdata[i]); - paintFbItems(fbdata, items_cnt, do_save_bg); + paintFbItems(do_save_bg); } //remove painted fb items from screen From 1d6bf7397e9d1cc1d363b6a32300fb4906e73ca4 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Fri, 14 Sep 2012 16:41:31 +0200 Subject: [PATCH 078/224] CTextBox: add methodes setTextMode() and setBackGroundColor() --- src/gui/widget/textbox.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/gui/widget/textbox.h b/src/gui/widget/textbox.h index b3a34971e..358aa878f 100644 --- a/src/gui/widget/textbox.h +++ b/src/gui/widget/textbox.h @@ -152,6 +152,16 @@ class CTextBox int text_border_width; public: + /* Variables */ + typedef enum mode_ + { + AUTO_WIDTH = 0x01, + AUTO_HIGH = 0x02, + SCROLL = 0x04, + CENTER = 0x40, + NO_AUTO_LINEBREAK = 0x80 + } mode; + /* Constructor */ CTextBox(); CTextBox( const char * text); From e1a586a9b1386dd7c216bb0a0d8b39b2428f3b37 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Fri, 14 Sep 2012 20:44:56 +0200 Subject: [PATCH 079/224] CTextBox/CMsgBox: reduce data type conflicts --- src/gui/widget/textbox.h | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/src/gui/widget/textbox.h b/src/gui/widget/textbox.h index 358aa878f..b3a34971e 100644 --- a/src/gui/widget/textbox.h +++ b/src/gui/widget/textbox.h @@ -152,16 +152,6 @@ class CTextBox int text_border_width; public: - /* Variables */ - typedef enum mode_ - { - AUTO_WIDTH = 0x01, - AUTO_HIGH = 0x02, - SCROLL = 0x04, - CENTER = 0x40, - NO_AUTO_LINEBREAK = 0x80 - } mode; - /* Constructor */ CTextBox(); CTextBox( const char * text); From 505d14c0a18e9d9c36831a6c873087a54c2e875f Mon Sep 17 00:00:00 2001 From: micha-bbg Date: Sat, 22 Sep 2012 05:52:24 +0200 Subject: [PATCH 080/224] channellist.cpp: Fix segfault at 'delete Infobox' when changes in bouquet list. --- src/gui/channellist.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/gui/channellist.cpp b/src/gui/channellist.cpp index e85277be6..bb8d820b6 100644 --- a/src/gui/channellist.cpp +++ b/src/gui/channellist.cpp @@ -116,7 +116,7 @@ CChannelList::CChannelList(const char * const pName, bool phistoryMode, bool _vl previous_channellist_additional = -1; eventFont = SNeutrinoSettings::FONT_TYPE_CHANNELLIST_EVENT; dline = NULL; - ibox = new CComponentsInfoBox(x, y + height + 2, width, info_height); + ibox = NULL; clHead = NULL; indexLogo = 0; @@ -1547,7 +1547,8 @@ void CChannelList::paintDetails(int index) p_event = &chanlist[index]->currentEvent; //infobox - ibox->paint(false); + if (ibox) + ibox->paint(false); if (!p_event->description.empty()) { char cNoch[50] = {0}; // UTF-8 @@ -1664,6 +1665,8 @@ void CChannelList::paintItem2DetailsLine (int pos) } //infobox + if (ibox == NULL) + ibox = new CComponentsInfoBox(x, y + height + 2, width, info_height); if (ibox){ ibox->setDimensionsAll(x, ypos2, width, info_height); ibox->setFrameThickness(2); From d8447b91107c83228d18e192b01676798369c568 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Mon, 24 Sep 2012 20:21:11 +0200 Subject: [PATCH 081/224] CComponents: add sub class CComponentsText --- src/gui/components/cc.h | 26 +++++++++ src/gui/components/components.cpp | 87 +++++++++++++++++++++++++++++++ 2 files changed, 113 insertions(+) diff --git a/src/gui/components/cc.h b/src/gui/components/cc.h index 034709e80..980ec66ee 100644 --- a/src/gui/components/cc.h +++ b/src/gui/components/cc.h @@ -410,4 +410,30 @@ class CComponentsForm : public CComponentsContainer void setIcon(const std::string& icon_name){tb_icon = icon_name;}; }; +class CComponentsText : public CComponentsContainer +{ + private: + Font* ct_font; + CBox * ct_box; + CTextBox * ct_textbox; + + const char* ct_text; + int ct_text_mode; //see textbox.h for possible modes + fb_pixel_t ct_col_text; + bool ct_text_sended; + + void initVarText(); + void initText(); + + public: + CComponentsText(); + ~CComponentsText(); + + inline void setText(const char* text, const int text_mode=CTextBox::AUTO_WIDTH, Font* font_text=NULL){ct_text = text; ct_text_mode = text_mode, ct_font = font_text;}; + + void hide(bool no_restore = false); + void paint(bool do_save_bg = CC_SAVE_SCREEN_YES); + void setTextFont(Font* font_text){ct_font = font_text;}; +}; + #endif diff --git a/src/gui/components/components.cpp b/src/gui/components/components.cpp index 0322982bb..f7ed366bb 100644 --- a/src/gui/components/components.cpp +++ b/src/gui/components/components.cpp @@ -1456,3 +1456,90 @@ void CComponentsForm::hide(bool no_restore) hideContainer(no_restore); } + +//sub class CComponentsText from CComponentsContainer +CComponentsText::CComponentsText() +{ + //CComponentsText + initVarText(); +} + + +CComponentsText::~CComponentsText() +{ + hide(); + clearSavedScreen(); + delete ct_font; + delete ct_box; + delete ct_textbox; + clear(); +} + + +void CComponentsText::initVarText() +{ + //CComponents, CComponentsContainer + initVarContainer(); + + //CComponentsText + ct_font = NULL; + ct_box = NULL; + ct_textbox = NULL; + ct_text = NULL; + ct_text_mode = CTextBox::SCROLL; + ct_col_text = COL_MENUCONTENT; + ct_text_sended = false; +} + + +void CComponentsText::initText() +{ + //set default font, if is no font definied + if (ct_font == NULL) + ct_font = g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL]; + + //define height and width from font size + height = max(height, ct_font->getHeight() ); + width = max(width, ct_font->getRenderWidth(ct_text, true) ); + + //text box dimensions + if (ct_box == NULL) + ct_box = new CBox(); + ct_box->iX = x+fr_thickness; + ct_box->iY = y+fr_thickness; + ct_box->iWidth = width-2*fr_thickness; + ct_box->iHeight = height-2*fr_thickness; + + //init textbox + if (ct_textbox == NULL) + ct_textbox = new CTextBox(ct_text); + + //set text box properties + ct_textbox->setTextBorderWidth(0); + ct_textbox->enableBackgroundPaint(true); + ct_textbox->setBackGroundColor(COL_RED); + ct_textbox->setTextFont(ct_font); + ct_textbox->setTextMode(ct_text_mode); + ct_textbox->movePosition(ct_box->iX, ct_box->iY); + ct_textbox->setTextColor(ct_col_text); + + //set text + string new_text = static_cast (ct_text); + ct_text_sended = ct_textbox->setText(&new_text, width); +} + +void CComponentsText::paint(bool do_save_bg) +{ + initText(); + paintInit(do_save_bg); + if (ct_text_sended) + ct_textbox->paint(); + ct_text_sended = false; +} + +void CComponentsText::hide(bool no_restore) +{ + ct_textbox->hide(); + hideContainer(no_restore); +} + From fcf8a018c55766fbeea6ebbda4118986cb546307 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Sat, 22 Sep 2012 13:37:24 +0200 Subject: [PATCH 082/224] CComponentsText: ensure an empty default value for AUTO_WIDTH in setText() AUTO_WIDTH has ugly sideeffects in context with max width --- src/gui/components/cc.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/components/cc.h b/src/gui/components/cc.h index 980ec66ee..24f12959b 100644 --- a/src/gui/components/cc.h +++ b/src/gui/components/cc.h @@ -429,7 +429,7 @@ class CComponentsText : public CComponentsContainer CComponentsText(); ~CComponentsText(); - inline void setText(const char* text, const int text_mode=CTextBox::AUTO_WIDTH, Font* font_text=NULL){ct_text = text; ct_text_mode = text_mode, ct_font = font_text;}; + inline void setText(const char* text, const int text_mode=~CTextBox::AUTO_WIDTH, Font* font_text=NULL){ct_text = text; ct_text_mode = text_mode, ct_font = font_text;}; void hide(bool no_restore = false); void paint(bool do_save_bg = CC_SAVE_SCREEN_YES); From 51891e0ccbd85a66b120a0c19a9bfd9910b90f2a Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Mon, 24 Sep 2012 18:18:57 +0200 Subject: [PATCH 083/224] ComponentsText: remove tests for color and background --- src/gui/components/components.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/gui/components/components.cpp b/src/gui/components/components.cpp index f7ed366bb..a4172cc8b 100644 --- a/src/gui/components/components.cpp +++ b/src/gui/components/components.cpp @@ -1516,8 +1516,7 @@ void CComponentsText::initText() //set text box properties ct_textbox->setTextBorderWidth(0); - ct_textbox->enableBackgroundPaint(true); - ct_textbox->setBackGroundColor(COL_RED); + ct_textbox->enableBackgroundPaint(false); ct_textbox->setTextFont(ct_font); ct_textbox->setTextMode(ct_text_mode); ct_textbox->movePosition(ct_box->iX, ct_box->iY); From 28904b79c742555f34bc2b4ca0ba92b8d96077f3 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Tue, 25 Sep 2012 15:32:33 +0200 Subject: [PATCH 084/224] ComponentsInfoBox: arange text to the left border if no picture is painted changed isPainted() to isPicPainted(), return of isPicPainted() value was not marked-down to false and isPainted() means the container frame and isPicPainted() means the picture itself, so the last state was wrong. Now it should work fine. Btw: scope of x_text reduced, is only required in member paintText() --- src/gui/components/cc.h | 2 +- src/gui/components/components.cpp | 10 ++++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/gui/components/cc.h b/src/gui/components/cc.h index 24f12959b..fff3d4169 100644 --- a/src/gui/components/cc.h +++ b/src/gui/components/cc.h @@ -222,7 +222,7 @@ class CComponentsInfoBox : public CComponentsContainer private: const char* text; int text_mode; //see textbox.h for possible modes - int x_text, x_offset; + int x_offset; Font* font; CBox * box; CTextBox * textbox; diff --git a/src/gui/components/components.cpp b/src/gui/components/components.cpp index a4172cc8b..2e71f29e7 100644 --- a/src/gui/components/components.cpp +++ b/src/gui/components/components.cpp @@ -325,7 +325,6 @@ void CComponentsInfoBox::initVarInfobox() textbox = NULL; pic = NULL; pic_name = ""; - x_text = x; x_offset = 10; } @@ -361,8 +360,10 @@ void CComponentsInfoBox::paintText() box = new CBox(); //define text x position - x_text = x+fr_thickness+x_offset; - if (pic->isPainted()){ + int x_text = x+fr_thickness+x_offset; + + //set text to the left border if picture not painted + if (pic->isPicPainted()){ int pic_w = pic->getWidth(); x_text += pic_w+x_offset; } @@ -383,7 +384,7 @@ void CComponentsInfoBox::paintText() //set properties textbox->setTextFont(font); - textbox->movePosition(box->iX, box->iY); + textbox->setWindowPos(box); textbox->setTextColor(ibox_col_text); //set text @@ -765,6 +766,7 @@ void CComponentsPicture::paint(bool do_save_bg) { initVarPicture(); paintInit(do_save_bg); + pic_painted = false; if (do_paint){ if (picMode == CC_PIC_ICON) From e1c974973057ab87146e8faf39c518766430481d Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Sun, 21 Oct 2012 13:54:33 +0200 Subject: [PATCH 085/224] CComponents: rename Container onto Item, make void paint() abstract CComponentsItem is shorter then CComponentsContainer, but also plausible and appropriately. paint() is required in all sub classes and useful for coming functions. --- src/gui/components/cc.h | 84 +++++----- src/gui/components/components.cpp | 251 +++++++++++++++--------------- 2 files changed, 165 insertions(+), 170 deletions(-) diff --git a/src/gui/components/cc.h b/src/gui/components/cc.h index fff3d4169..93452fb77 100644 --- a/src/gui/components/cc.h +++ b/src/gui/components/cc.h @@ -124,66 +124,66 @@ class CComponents std::vector v_fbdata; fb_pixel_t col_body, col_shadow, col_frame; bool firstPaint, shadow, is_painted; - + void initVarBasic(); void paintFbItems(bool do_save_bg = true); fb_pixel_t* getScreen(int ax, int ay, int dx, int dy); comp_screen_data_t saved_screen; - + void clearSavedScreen(); void clear(); public: CComponents(); virtual~CComponents(); - + inline virtual void setXPos(const int& xpos){x = xpos;}; inline virtual void setYPos(const int& ypos){y = ypos;}; inline virtual void setHeight(const int& h){height = h;}; inline virtual void setWidth(const int& w){width = w;}; inline virtual void setDimensionsAll(const int& xpos, const int& ypos, const int& w, const int& h){x = xpos; y = ypos; width = w; height = h;}; - + inline virtual int getXPos(){return x;}; inline virtual int getYPos(){return y;}; inline virtual int getHeight(){return height;}; inline virtual int getWidth(){return width;}; inline virtual void getDimensions(int* xpos, int* ypos, int* w, int* h){*xpos=x; *ypos=y; *w=width; *h=height;}; - + /// set colors: Possible color values are defined in "gui/color.h" and "gui/customcolor.h" inline virtual void setColorFrame(fb_pixel_t color){col_frame = color;}; inline virtual void setColorBody(fb_pixel_t color){col_body = color;}; inline virtual void setColorShadow(fb_pixel_t color){col_shadow = color;}; inline virtual void setColorAll(fb_pixel_t color_frame, fb_pixel_t color_body, fb_pixel_t color_shadow){col_frame = color_frame; col_body = color_body; col_shadow = color_shadow;}; - + virtual void hide(); virtual bool isPainted(){return is_painted;}; }; -class CComponentsContainer : public CComponents +class CComponentsItem : public CComponents { protected: int corner_rad, fr_thickness; void hideContainer(bool no_restore = false); void paintInit(bool do_save_bg); - void initVarContainer(); - + void initVarItem(); + public: - CComponentsContainer(); - + CComponentsItem(); + /// set corner types: Possible corner types are defined in CFrameBuffer (see: driver/framebuffer.h). inline virtual void setCornerType(const int& type){corner_type = type;}; inline virtual void setCornerRadius(const int& radius){corner_rad = radius;}; - + inline virtual void setFrameThickness(const int& thickness){fr_thickness = thickness;}; inline virtual void setShadowOnOff(bool has_shadow){shadow = has_shadow;}; - - virtual void paint(bool do_save_bg = CC_SAVE_SCREEN_YES); + + virtual void paint(bool do_save_bg = CC_SAVE_SCREEN_YES) = 0; virtual void hide(bool no_restore = false); virtual void kill(); virtual void syncSysColors(); }; -class CComponentsPicture : public CComponentsContainer +class CComponentsPicture : public CComponentsItem { private: std::string pic_name; @@ -208,7 +208,7 @@ class CComponentsPicture : public CComponentsContainer inline void setPicturePaintBackground(bool paintBg){pic_paintBg = paintBg;}; inline void setPicture(const std::string& picture_name); void setPictureAlign(const int alignment); - + inline bool isPicPainted(){return pic_painted;}; void paint(bool do_save_bg = CC_SAVE_SCREEN_YES); void hide(bool no_restore = false); @@ -217,7 +217,7 @@ class CComponentsPicture : public CComponentsContainer }; #define INFO_BOX_Y_OFFSET 2 -class CComponentsInfoBox : public CComponentsContainer +class CComponentsInfoBox : public CComponentsItem { private: const char* text; @@ -257,33 +257,33 @@ class CComponentsInfoBox : public CComponentsContainer }; -class CComponentsShapeCircle : public CComponentsContainer +class CComponentsShapeCircle : public CComponentsItem { private: int d; public: CComponentsShapeCircle( const int x_pos, const int y_pos, const int diam, bool has_shadow = CC_SHADOW_ON, fb_pixel_t color_frame = COL_MENUCONTENT_PLUS_6, fb_pixel_t color_body = COL_MENUCONTENT_PLUS_0, fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0); - + inline void setDiam(const int& diam){d=width=height=diam, corner_rad=d/2;}; inline int getDiam(){return d;}; }; -class CComponentsShapeSquare : public CComponentsContainer +class CComponentsShapeSquare : public CComponentsItem { public: CComponentsShapeSquare( const int x_pos, const int y_pos, const int w, const int h, bool has_shadow = CC_SHADOW_ON, fb_pixel_t color_frame = COL_MENUCONTENT_PLUS_6, fb_pixel_t color_body = COL_MENUCONTENT_PLUS_0, fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0); }; -class CComponentsPIP : public CComponentsContainer +class CComponentsPIP : public CComponentsItem { private: int screen_w, screen_h; public: CComponentsPIP( const int x_pos, const int y_pos, const int percent, bool has_shadow = CC_SHADOW_OFF); ~CComponentsPIP(); - + void paint(bool do_save_bg = CC_SAVE_SCREEN_YES); void hide(bool no_restore = false); }; @@ -295,14 +295,14 @@ class CComponentsDetailLine : public CComponents int thickness, y_down, h_mark_top, h_mark_down; void initVarDline(); - + public: CComponentsDetailLine(); CComponentsDetailLine( const int x_pos,const int y_pos_top, const int y_pos_down, const int h_mark_up = CC_HEIGHT_MIN , const int h_mark_down = CC_HEIGHT_MIN, fb_pixel_t color_line = COL_MENUCONTENT_PLUS_6, fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0); ~CComponentsDetailLine(); - + void paint(bool do_save_bg = CC_SAVE_SCREEN_YES); void kill(); inline void setColors(fb_pixel_t color_line, fb_pixel_t color_shadow){col_body = color_line; col_shadow = color_shadow;}; @@ -314,7 +314,7 @@ class CComponentsDetailLine : public CComponents #define FIRST_ELEMENT_INIT 10000 #define LOGO_MAX_WIDTH width/4 -class CComponentsItemBox : public CComponentsContainer +class CComponentsItemBox : public CComponentsItem { protected: int hSpacer; @@ -333,7 +333,7 @@ class CComponentsItemBox : public CComponentsContainer size_t prevElementRight; std::vector v_element_data; bool isCalculated; - + void clearElements(); void initVarItemBox(); void calSizeOfElements(); @@ -343,14 +343,14 @@ class CComponentsItemBox : public CComponentsContainer bool addElement(int align, int type, const std::string& element="", size_t *index=NULL); void paintImage(size_t index, bool newElement); void paintText(size_t index, bool newElement); - + public: CComponentsItemBox(); virtual ~CComponentsItemBox(); - + inline virtual void setTextFont(Font* font){font_text = font;}; inline virtual void setTextColor(fb_pixel_t color_text){ it_col_text = color_text;}; - + virtual void refreshElement(size_t index, const std::string& element); virtual void paintElement(size_t index, bool newElement= false); virtual bool addLogoOrText(int align, const std::string& logo, const std::string& text, size_t *index=NULL); @@ -370,12 +370,12 @@ class CComponentsTitleBar : public CComponentsItemBox std::string tb_s_text, tb_icon_name; neutrino_locale_t tb_locale_text; int tb_text_align, tb_icon_align; - + void initText(); void initIcon(); void initElements(); void initVarTitleBar(); - + public: CComponentsTitleBar(); CComponentsTitleBar( const int x_pos, const int y_pos, const int w, const int h, const char* c_text = NULL, const std::string& s_icon ="", @@ -384,25 +384,25 @@ class CComponentsTitleBar : public CComponentsItemBox fb_pixel_t color_text = COL_MENUHEAD, fb_pixel_t color_body = COL_MENUHEAD_PLUS_0); CComponentsTitleBar( const int x_pos, const int y_pos, const int w, const int h, neutrino_locale_t locale_text = NONEXISTANT_LOCALE, const std::string& s_icon ="", fb_pixel_t color_text = COL_MENUHEAD, fb_pixel_t color_body = COL_MENUHEAD_PLUS_0); - + void paint(bool do_save_bg = CC_SAVE_SCREEN_YES); }; -class CComponentsForm : public CComponentsContainer +class CComponentsForm : public CComponentsItem { private: CComponentsTitleBar *tb; std::string tb_text, tb_icon; - + void initVarForm(); void paintHead(); - + public: CComponentsForm(); ~CComponentsForm(); - + void paint(bool do_save_bg = CC_SAVE_SCREEN_YES); void hide(bool no_restore = false); void setCaption(const std::string& text); @@ -410,27 +410,27 @@ class CComponentsForm : public CComponentsContainer void setIcon(const std::string& icon_name){tb_icon = icon_name;}; }; -class CComponentsText : public CComponentsContainer +class CComponentsText : public CComponentsItem { private: Font* ct_font; CBox * ct_box; CTextBox * ct_textbox; - + const char* ct_text; int ct_text_mode; //see textbox.h for possible modes fb_pixel_t ct_col_text; bool ct_text_sended; - + void initVarText(); void initText(); - + public: CComponentsText(); ~CComponentsText(); - + inline void setText(const char* text, const int text_mode=~CTextBox::AUTO_WIDTH, Font* font_text=NULL){ct_text = text; ct_text_mode = text_mode, ct_font = font_text;}; - + void hide(bool no_restore = false); void paint(bool do_save_bg = CC_SAVE_SCREEN_YES); void setTextFont(Font* font_text){ct_font = font_text;}; diff --git a/src/gui/components/components.cpp b/src/gui/components/components.cpp index 2e71f29e7..66188348d 100644 --- a/src/gui/components/components.cpp +++ b/src/gui/components/components.cpp @@ -94,21 +94,21 @@ void CComponents::paintFbItems(bool do_save_bg) saved_screen.dy = v_fbdata[i].dy; clearSavedScreen(); saved_screen.pixbuf = getScreen(saved_screen.x, saved_screen.y, saved_screen.dx, saved_screen.dy); - + firstPaint = false; break; } } } - + for(size_t i=0; i< v_fbdata.size() ;i++){ int fbtype = v_fbdata[i].fbdata_type; - + if (firstPaint){ - + if (do_save_bg && fbtype == CC_FBDATA_TYPE_LINE) v_fbdata[i].pixbuf = getScreen(v_fbdata[i].x, v_fbdata[i].y, v_fbdata[i].dx, v_fbdata[i].dy); - + //ensure painting of all line fb items with saved screens if (fbtype == CC_FBDATA_TYPE_LINE) firstPaint = true; @@ -124,7 +124,7 @@ void CComponents::paintFbItems(bool do_save_bg) frameBuffer->paintBoxRel(v_fbdata[i].x, v_fbdata[i].y, v_fbdata[i].dx, v_fbdata[i].dy, v_fbdata[i].color, v_fbdata[i].r, corner_type); } } - + is_painted = true; } @@ -161,11 +161,11 @@ inline void CComponents::clear() //------------------------------------------------------------------------------------------------------- -//abstract sub class CComponentsContainer from CComponents -CComponentsContainer::CComponentsContainer() +//abstract sub class CComponentsItem from CComponents +CComponentsItem::CComponentsItem() { - //CComponentsContainer - initVarContainer(); + //CComponentsItem + initVarItem(); } // y @@ -175,23 +175,23 @@ CComponentsContainer::CComponentsContainer() // | | // +--------width---------+ -void CComponentsContainer::initVarContainer() +void CComponentsItem::initVarItem() { //CComponents initVarBasic(); - - //ComponentsContainer + + //CComponentsItem corner_rad = 0; fr_thickness = 0; } -void CComponentsContainer::paintInit(bool do_save_bg) +void CComponentsItem::paintInit(bool do_save_bg) { clear(); - + int sw = shadow ? shadow_w : 0; int th = fr_thickness; - + comp_fbdata_t fbdata[] = { {CC_FBDATA_TYPE_BGSCREEN, x, y, width+sw, height+sw, 0, 0, 0, NULL, NULL}, @@ -199,25 +199,20 @@ void CComponentsContainer::paintInit(bool do_save_bg) {CC_FBDATA_TYPE_FRAME, x, y, width, height, col_frame, corner_rad, th, NULL, NULL}, {CC_FBDATA_TYPE_BOX, x+th, y+th, width-2*th, height-2*th, col_body, corner_rad-th, 0, NULL, NULL}, }; - + for(size_t i =0; i< (sizeof(fbdata) / sizeof(fbdata[0])) ;i++) v_fbdata.push_back(fbdata[i]); - - paintFbItems(do_save_bg); -} -void CComponentsContainer::paint(bool do_save_bg) -{ - paintInit(do_save_bg); + paintFbItems(do_save_bg); } //restore last saved screen behind form box, //Do use parameter 'no restore' to override temporarly the restore funtionality. //This could help to avoid ugly flicker efffects if it is necessary e.g. on often repaints, without changed contents. -void CComponentsContainer::hideContainer(bool no_restore) +void CComponentsItem::hideContainer(bool no_restore) { is_painted = false; - + if (saved_screen.pixbuf) { frameBuffer->RestoreScreen(saved_screen.x, saved_screen.y, saved_screen.dx, saved_screen.dy, saved_screen.pixbuf); if (no_restore) { @@ -228,14 +223,14 @@ void CComponentsContainer::hideContainer(bool no_restore) } } -void CComponentsContainer::hide(bool no_restore) +void CComponentsItem::hide(bool no_restore) { hideContainer(no_restore); } //hide rendered objects -void CComponentsContainer::kill() +void CComponentsItem::kill() { //save current colors fb_pixel_t c_tmp1, c_tmp2, c_tmp3; @@ -258,7 +253,7 @@ void CComponentsContainer::kill() //synchronize colors for forms //This is usefull if the system colors are changed during runtime //so you can ensure correct applied system colors in relevant objects with unchanged instances. -void CComponentsContainer::syncSysColors() +void CComponentsItem::syncSysColors() { col_body = COL_MENUCONTENT_PLUS_0; col_shadow = COL_MENUCONTENTDARK_PLUS_0; @@ -266,12 +261,12 @@ void CComponentsContainer::syncSysColors() } //------------------------------------------------------------------------------------------------------- -//sub class CComponentsInfoBox from CComponentsContainer +//sub class CComponentsInfoBox from CComponentsItem CComponentsInfoBox::CComponentsInfoBox() { - //CComponents, ComponentsContainer - initVarContainer(); - + //CComponents, CComponentsItem + initVarItem(); + //CComponentsInfoBox initVarInfobox(); text = NULL; @@ -285,9 +280,9 @@ CComponentsInfoBox::CComponentsInfoBox(const int x_pos, const int y_pos, const i bool has_shadow, fb_pixel_t color_text, fb_pixel_t color_frame, fb_pixel_t color_body, fb_pixel_t color_shadow) { - //CComponents, ComponentsContainer - initVarContainer(); - + //CComponents, CComponentsItem + initVarItem(); + x = x_pos; y = y_pos; width = w; @@ -296,7 +291,7 @@ CComponentsInfoBox::CComponentsInfoBox(const int x_pos, const int y_pos, const i col_frame = color_frame; col_body = color_body; col_shadow = color_shadow; - + //CComponentsInfoBox initVarInfobox(); text = info_text; @@ -317,16 +312,16 @@ CComponentsInfoBox::~CComponentsInfoBox() void CComponentsInfoBox::initVarInfobox() { - //CComponents, ComponentsContainer - initVarContainer(); - + //CComponents, CComponentsItem + initVarItem(); + //CComponentsInfoBox box = NULL; textbox = NULL; pic = NULL; pic_name = ""; x_offset = 10; - + } void CComponentsInfoBox::setText(neutrino_locale_t locale_text, int mode, Font* font_text) @@ -350,7 +345,7 @@ void CComponentsInfoBox::paintPicture() //fit icon into infobox pic->setHeight(height-2*fr_thickness); pic->setColorBody(col_body); - + pic->paint(); } @@ -358,15 +353,15 @@ void CComponentsInfoBox::paintText() { if (box == NULL) box = new CBox(); - + //define text x position int x_text = x+fr_thickness+x_offset; - + //set text to the left border if picture not painted if (pic->isPicPainted()){ int pic_w = pic->getWidth(); x_text += pic_w+x_offset; - } + } box->iX = x_text; box->iY = y+fr_thickness; @@ -413,12 +408,12 @@ void CComponentsInfoBox::removeLineBreaks(std::string& str) //------------------------------------------------------------------------------------------------------- -//sub class CComponentsShapeSquare from CComponentsContainer +//sub class CComponentsShapeSquare from CComponentsItem 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) { - //ComponentsContainer - initVarContainer(); - + //CComponentsItem + initVarItem(); + x = x_pos; y = y_pos; width = w; @@ -431,12 +426,12 @@ CComponentsShapeSquare::CComponentsShapeSquare(const int x_pos, const int y_pos, } //------------------------------------------------------------------------------------------------------- -//sub class CComponentsShapeCircle from CComponentsContainer +//sub class CComponentsShapeCircle from CComponentsItem 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) { - //CComponents, CComponentsContainer - initVarContainer(); + //CComponents, CComponentsItem + initVarItem(); //CComponents x = x_pos; @@ -447,23 +442,23 @@ CComponentsShapeCircle::CComponentsShapeCircle( int x_pos, int y_pos, int diam, col_frame = color_frame; col_body = color_body; col_shadow = color_shadow; - + //CComponentsShapeCircle width = height = d = diam; - - //CComponentsContainer + + //CComponentsItem corner_rad = d/2; } // y // x+ - + -// -// -// +// +// +// // |----d-i-a-m----| -// -// -// +// +// +// // + - + @@ -472,13 +467,13 @@ CComponentsShapeCircle::CComponentsShapeCircle( int x_pos, int y_pos, int diam, CComponentsDetailLine::CComponentsDetailLine() { initVarDline(); - + //CComponents x = 0; y = 0; col_shadow = COL_MENUCONTENTDARK_PLUS_0; col_body = COL_MENUCONTENT_PLUS_6; - + //CComponentsDetailLine y_down = 0; h_mark_top = CC_HEIGHT_MIN; @@ -488,13 +483,13 @@ 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) { initVarDline(); - + //CComponents x = x_pos; y = y_pos_top; col_shadow = color_shadow; col_body = color_line; - + //CComponentsDetailLine y_down = y_pos_down; h_mark_top = h_mark_top_; @@ -505,9 +500,9 @@ void CComponentsDetailLine::initVarDline() { //CComponents initVarBasic(); - + shadow_w = 1; - + //CComponentsDetailLine thickness = 4; } @@ -537,40 +532,40 @@ CComponentsDetailLine::~CComponentsDetailLine() void CComponentsDetailLine::paint(bool do_save_bg) { clear(); - + int y_mark_top = y-h_mark_top/2+thickness/2; int y_mark_down = y_down-h_mark_down/2+thickness/2; int sw = shadow_w; - + comp_fbdata_t fbdata[] = { /* vertical item mark | */ {CC_FBDATA_TYPE_LINE, x+width-thickness-sw, y_mark_top, thickness, h_mark_top, col_body, 0, 0, NULL, NULL}, {CC_FBDATA_TYPE_LINE, x+width-sw, y_mark_top, sw, h_mark_top, col_shadow, 0, 0, NULL, NULL}, {CC_FBDATA_TYPE_LINE, x+width-thickness-sw, y_mark_top+h_mark_top, thickness+sw, sw , col_shadow, 0, 0, NULL, NULL}, - + /* horizontal item line - */ {CC_FBDATA_TYPE_LINE, x, y, width-thickness-sw, thickness, col_body, 0, 0, NULL, NULL}, {CC_FBDATA_TYPE_LINE, x+thickness, y+thickness, width-2*thickness-sw, sw, col_shadow, 0, 0, NULL, NULL}, - + /* vertical connect line [ */ {CC_FBDATA_TYPE_LINE, x, y+thickness, thickness, y_down-y-thickness, col_body, 0, 0, NULL, NULL}, {CC_FBDATA_TYPE_LINE, x+thickness, y+thickness+sw, sw, y_down-y-thickness-sw, col_shadow, 0, 0, NULL, NULL}, - + /* horizontal info line - */ {CC_FBDATA_TYPE_LINE, x, y_down, width-thickness-sw, thickness, col_body, 0, 0, NULL, NULL}, {CC_FBDATA_TYPE_LINE, x, y_down+thickness, width-thickness-sw, sw, col_shadow, 0, 0, NULL, NULL}, - + /* vertical info mark | */ {CC_FBDATA_TYPE_LINE, x+width-thickness-sw, y_mark_down, thickness, h_mark_down, col_body, 0, 0, NULL, NULL}, {CC_FBDATA_TYPE_LINE, x+width-sw, y_mark_down, sw, h_mark_down, col_shadow, 0, 0, NULL, NULL}, {CC_FBDATA_TYPE_LINE, x+width-thickness-sw, y_mark_down+h_mark_down,thickness+sw, sw, col_shadow, 0, 0, NULL, NULL}, }; - + for(size_t i =0; i< (sizeof(fbdata) / sizeof(fbdata[0])) ;i++) v_fbdata.push_back(fbdata[i]); - + paintFbItems(do_save_bg); } @@ -603,12 +598,12 @@ void CComponentsDetailLine::syncSysColors() //------------------------------------------------------------------------------------------------------- -//sub class CComponentsPIP from CComponentsContainer +//sub class CComponentsPIP from CComponentsItem CComponentsPIP::CComponentsPIP( const int x_pos, const int y_pos, const int percent, bool has_shadow) { - //CComponents, CComponentsContainer - initVarContainer(); - + //CComponents, CComponentsItem + initVarItem(); + //CComponentsPIP screen_w = frameBuffer->getScreenWidth(true); screen_h = frameBuffer->getScreenHeight(true); @@ -648,7 +643,7 @@ void CComponentsPIP::hide(bool no_restore) //------------------------------------------------------------------------------------------------------- -//sub class CComponentsPicture from CComponentsContainer +//sub class CComponentsPicture from CComponentsItem CComponentsPicture::CComponentsPicture( const int x_pos, const int y_pos, const std::string& picture_name, const int alignment, bool has_shadow, fb_pixel_t color_frame, fb_pixel_t color_background, fb_pixel_t color_shadow) @@ -678,9 +673,9 @@ CComponentsPicture::CComponentsPicture( const int x_pos, const int y_pos, const void CComponentsPicture::init( 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) { - //CComponents, CComponentsContainer - initVarContainer(); - + //CComponents, CComponentsItem + initVarItem(); + //CComponentsPicture pic_name = picture_name; pic_align = alignment; @@ -691,7 +686,7 @@ void CComponentsPicture::init( int x_pos, int y_pos, const string& picture_name, do_paint = false; if (pic_name.empty()) pic_width = pic_height = 0; - + //CComponents x = pic_x = x_pos; y = pic_y = y_pos; @@ -731,15 +726,15 @@ void CComponentsPicture::initVarPicture() if((pic_width > maxWidth) || (pic_height > maxHeight)) g_PicViewer->rescaleImageDimensions(&pic_width, &pic_height, maxWidth, maxHeight); } - -#ifdef DEBUG + +#ifdef DEBUG if (pic_width == 0 || pic_height == 0) printf("CComponentsPicture: %s file: %s, no icon dimensions found! width = %d, height = %d\n", __FUNCTION__, pic_name.c_str(), pic_width, pic_height); #endif pic_x += fr_thickness; pic_y += fr_thickness; - + if (pic_height>0 && pic_width>0){ if (pic_align & CC_ALIGN_LEFT) pic_x = x+fr_thickness; @@ -753,7 +748,7 @@ void CComponentsPicture::initVarPicture() pic_x = x+width/2-pic_width/2; if (pic_align & CC_ALIGN_VER_CENTER) pic_y = y+height/2-pic_height/2; - + do_paint = true; } @@ -767,7 +762,7 @@ void CComponentsPicture::paint(bool do_save_bg) initVarPicture(); paintInit(do_save_bg); pic_painted = false; - + if (do_paint){ if (picMode == CC_PIC_ICON) pic_painted = frameBuffer->paintIcon(pic_name, pic_x, pic_y, 0, pic_offset, pic_paint, pic_paintBg, col_body); @@ -785,7 +780,7 @@ void CComponentsPicture::hide(bool no_restore) //------------------------------------------------------------------------------------------------------- -//sub class CComponentsItemBox from CComponentsContainer +//sub class CComponentsItemBox from CComponentsItem CComponentsItemBox::CComponentsItemBox() { //CComponentsItemBox @@ -802,8 +797,8 @@ CComponentsItemBox::~CComponentsItemBox() void CComponentsItemBox::initVarItemBox() { - //CComponents, CComponentsContainer - initVarContainer(); + //CComponents, CComponentsItem + initVarItem(); //CComponentsItemBox it_col_text = COL_MENUCONTENT; @@ -986,9 +981,9 @@ void CComponentsItemBox::paintImage(size_t index, bool newElement) { CComponentsPicture* pic = NULL; pic = static_cast(v_element_data[index].handler1); - + int pw = 0, ph = 0; - + if ((newElement) || (pic == NULL)) { if (pic != NULL) { pic->hide(); @@ -1002,7 +997,7 @@ void CComponentsItemBox::paintImage(size_t index, bool newElement) pic = new CComponentsPicture( v_element_data[index].x, v_element_data[index].y, v_element_data[index].element); v_element_data[index].handler1 = (void*)pic; } - + pic->getPictureSize(&pw, &ph); pic->setHeight(ph); pic->setWidth(pw); @@ -1016,7 +1011,7 @@ void CComponentsItemBox::paintText(size_t index, bool newElement) //prepare textbox dimension instances CBox* box = NULL; box = static_cast(v_element_data[index].handler1); - + if ((newElement) || (box == NULL)) { if (box != NULL) { delete box; @@ -1025,17 +1020,17 @@ void CComponentsItemBox::paintText(size_t index, bool newElement) box = new CBox(); v_element_data[index].handler1 = (void*)box; } - + box->iX = v_element_data[index].x; box->iY = v_element_data[index].y; box->iWidth = v_element_data[index].width; box->iHeight = v_element_data[index].height; - - + + //prepare text CTextBox* textbox = NULL; textbox = static_cast(v_element_data[index].handler2); - + if ((newElement) || (textbox == NULL)) { if (textbox != NULL) { textbox->hide(); @@ -1045,13 +1040,13 @@ void CComponentsItemBox::paintText(size_t index, bool newElement) textbox = new CTextBox(v_element_data[index].element.c_str(), font_text, CTextBox::AUTO_WIDTH|CTextBox::AUTO_HIGH, box, col_body); v_element_data[index].handler2 = (void*)textbox; } - + textbox->setTextBorderWidth(0); textbox->enableBackgroundPaint(false); textbox->setTextFont(font_text); textbox->movePosition(box->iX, box->iY); textbox->setTextColor(it_col_text); - + if (textbox->setText(&v_element_data[index].element)) textbox->paint(); } @@ -1069,7 +1064,7 @@ void CComponentsItemBox::paintElement(size_t index, bool newElement) paintText(index,newElement); break; case CC_ITEMBOX_CLOCK: - font_text->RenderString(v_element_data[index].x, v_element_data[index].y, v_element_data[index].width, + font_text->RenderString(v_element_data[index].x, v_element_data[index].y, v_element_data[index].width, v_element_data[index].element.c_str(), it_col_text); break; default: @@ -1275,18 +1270,18 @@ CComponentsTitleBar::CComponentsTitleBar(const int x_pos, const int y_pos, const //CComponentsItemBox initVarTitleBar(); it_col_text = color_text; - + //CComponents x = x_pos; y = y_pos; height = h; width = w; col_body = color_body; - + //CComponentsTitleBar tb_c_text = c_text; tb_icon_name = s_icon; - + initElements(); } @@ -1296,18 +1291,18 @@ CComponentsTitleBar::CComponentsTitleBar(const int x_pos, const int y_pos, const //CComponentsItemBox initVarTitleBar(); it_col_text = color_text; - + //CComponents x = x_pos; y = y_pos; height = h; width = w; col_body = color_body; - + //CComponentsTitleBar tb_s_text = s_text; tb_icon_name = s_icon; - + initElements(); } @@ -1317,19 +1312,19 @@ CComponentsTitleBar::CComponentsTitleBar(const int x_pos, const int y_pos, const //CComponentsItemBox initVarTitleBar(); it_col_text = color_text; - + //CComponents x = x_pos; y = y_pos; height = h; width = w; col_body = color_body; - + //CComponentsTitleBar tb_locale_text = locale_text; tb_s_text = g_Locale->getText(tb_locale_text); tb_icon_name = s_icon; - + initElements(); } @@ -1362,7 +1357,7 @@ void CComponentsTitleBar::initElements() void CComponentsTitleBar::paint(bool do_save_bg) { calculateElements(); - paintItemBox(do_save_bg); + paintItemBox(do_save_bg); } @@ -1384,9 +1379,9 @@ CComponentsForm::~CComponentsForm() void CComponentsForm::initVarForm() { - //CComponentsContainer - initVarContainer(); - + //CComponentsItem + initVarItem(); + //simple default dimensions x = 0; y = 0; @@ -1410,7 +1405,7 @@ void CComponentsForm::paint(bool do_save_bg) { //paint body paintInit(do_save_bg); - + //paint header paintHead(); } @@ -1420,7 +1415,7 @@ void CComponentsForm::paintHead() //init header if (tb == NULL){ tb = new CComponentsTitleBar(); - + //init icon if (!tb_icon.empty()) tb->addIcon(tb_icon, CC_ALIGN_LEFT); @@ -1432,7 +1427,7 @@ void CComponentsForm::paintHead() int tbh = tb->getHeight(); tb->setDimensionsAll(x, y, width, tbh); } - + //paint titlebar tb->paint(CC_SAVE_SCREEN_NO); } @@ -1459,7 +1454,7 @@ void CComponentsForm::hide(bool no_restore) } -//sub class CComponentsText from CComponentsContainer +//sub class CComponentsText from CComponentsItem CComponentsText::CComponentsText() { //CComponentsText @@ -1480,9 +1475,9 @@ CComponentsText::~CComponentsText() void CComponentsText::initVarText() { - //CComponents, CComponentsContainer - initVarContainer(); - + //CComponents, CComponentsItem + initVarItem(); + //CComponentsText ct_font = NULL; ct_box = NULL; @@ -1499,11 +1494,11 @@ void CComponentsText::initText() //set default font, if is no font definied if (ct_font == NULL) ct_font = g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL]; - + //define height and width from font size height = max(height, ct_font->getHeight() ); width = max(width, ct_font->getRenderWidth(ct_text, true) ); - + //text box dimensions if (ct_box == NULL) ct_box = new CBox(); @@ -1511,11 +1506,11 @@ void CComponentsText::initText() ct_box->iY = y+fr_thickness; ct_box->iWidth = width-2*fr_thickness; ct_box->iHeight = height-2*fr_thickness; - + //init textbox - if (ct_textbox == NULL) + if (ct_textbox == NULL) ct_textbox = new CTextBox(ct_text); - + //set text box properties ct_textbox->setTextBorderWidth(0); ct_textbox->enableBackgroundPaint(false); @@ -1523,7 +1518,7 @@ void CComponentsText::initText() ct_textbox->setTextMode(ct_text_mode); ct_textbox->movePosition(ct_box->iX, ct_box->iY); ct_textbox->setTextColor(ct_col_text); - + //set text string new_text = static_cast (ct_text); ct_text_sended = ct_textbox->setText(&new_text, width); From 4df7e4d144cb9528593dba3719b79d86f5dfc204 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Tue, 23 Oct 2012 15:08:02 +0200 Subject: [PATCH 086/224] CComponents: move CComponentsText before Infobox --- src/gui/components/cc.h | 50 ++++----- src/gui/components/components.cpp | 172 +++++++++++++++--------------- 2 files changed, 114 insertions(+), 108 deletions(-) diff --git a/src/gui/components/cc.h b/src/gui/components/cc.h index 93452fb77..df6cb21b4 100644 --- a/src/gui/components/cc.h +++ b/src/gui/components/cc.h @@ -216,6 +216,32 @@ class CComponentsPicture : public CComponentsItem }; +class CComponentsText : public CComponentsItem +{ + private: + Font* ct_font; + CBox * ct_box; + CTextBox * ct_textbox; + + const char* ct_text; + int ct_text_mode; //see textbox.h for possible modes + fb_pixel_t ct_col_text; + bool ct_text_sended; + + void initVarText(); + void initText(); + + public: + CComponentsText(); + ~CComponentsText(); + + inline void setText(const char* text, const int text_mode=~CTextBox::AUTO_WIDTH, Font* font_text=NULL){ct_text = text; ct_text_mode = text_mode, ct_font = font_text;}; + + void hide(bool no_restore = false); + void paint(bool do_save_bg = CC_SAVE_SCREEN_YES); + void setTextFont(Font* font_text){ct_font = font_text;}; +}; + #define INFO_BOX_Y_OFFSET 2 class CComponentsInfoBox : public CComponentsItem { @@ -410,30 +436,6 @@ class CComponentsForm : public CComponentsItem void setIcon(const std::string& icon_name){tb_icon = icon_name;}; }; -class CComponentsText : public CComponentsItem -{ - private: - Font* ct_font; - CBox * ct_box; - CTextBox * ct_textbox; - const char* ct_text; - int ct_text_mode; //see textbox.h for possible modes - fb_pixel_t ct_col_text; - bool ct_text_sended; - - void initVarText(); - void initText(); - - public: - CComponentsText(); - ~CComponentsText(); - - inline void setText(const char* text, const int text_mode=~CTextBox::AUTO_WIDTH, Font* font_text=NULL){ct_text = text; ct_text_mode = text_mode, ct_font = font_text;}; - - void hide(bool no_restore = false); - void paint(bool do_save_bg = CC_SAVE_SCREEN_YES); - void setTextFont(Font* font_text){ct_font = font_text;}; -}; #endif diff --git a/src/gui/components/components.cpp b/src/gui/components/components.cpp index 66188348d..67be75ec0 100644 --- a/src/gui/components/components.cpp +++ b/src/gui/components/components.cpp @@ -260,6 +260,94 @@ void CComponentsItem::syncSysColors() col_frame = COL_MENUCONTENT_PLUS_6; } + +//------------------------------------------------------------------------------------------------------- +//sub class CComponentsText from CComponentsItem +CComponentsText::CComponentsText() +{ + //CComponentsText + initVarText(); +} + + +CComponentsText::~CComponentsText() +{ + hide(); + clearSavedScreen(); + delete ct_font; + delete ct_box; + delete ct_textbox; + clear(); +} + + +void CComponentsText::initVarText() +{ + //CComponents, CComponentsItem + initVarItem(); + + //CComponentsText + ct_font = NULL; + ct_box = NULL; + ct_textbox = NULL; + ct_text = NULL; + ct_text_mode = CTextBox::SCROLL; + ct_col_text = COL_MENUCONTENT; + ct_text_sended = false; +} + + +void CComponentsText::initText() +{ + //set default font, if is no font definied + if (ct_font == NULL) + ct_font = g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL]; + + //define height and width from font size + height = max(height, ct_font->getHeight() ); + width = max(width, ct_font->getRenderWidth(ct_text, true) ); + + //text box dimensions + if (ct_box == NULL) + ct_box = new CBox(); + ct_box->iX = x+fr_thickness; + ct_box->iY = y+fr_thickness; + ct_box->iWidth = width-2*fr_thickness; + ct_box->iHeight = height-2*fr_thickness; + + //init textbox + if (ct_textbox == NULL) + ct_textbox = new CTextBox(ct_text); + + //set text box properties + ct_textbox->setTextBorderWidth(0); + ct_textbox->enableBackgroundPaint(false); + ct_textbox->setTextFont(ct_font); + ct_textbox->setTextMode(ct_text_mode); + ct_textbox->movePosition(ct_box->iX, ct_box->iY); + ct_textbox->setTextColor(ct_col_text); + + //set text + string new_text = static_cast (ct_text); + ct_text_sended = ct_textbox->setText(&new_text, width); +} + +void CComponentsText::paint(bool do_save_bg) +{ + initText(); + paintInit(do_save_bg); + if (ct_text_sended) + ct_textbox->paint(); + ct_text_sended = false; +} + +void CComponentsText::hide(bool no_restore) +{ + ct_textbox->hide(); + hideContainer(no_restore); +} + + //------------------------------------------------------------------------------------------------------- //sub class CComponentsInfoBox from CComponentsItem CComponentsInfoBox::CComponentsInfoBox() @@ -1454,88 +1542,4 @@ void CComponentsForm::hide(bool no_restore) } -//sub class CComponentsText from CComponentsItem -CComponentsText::CComponentsText() -{ - //CComponentsText - initVarText(); -} - - -CComponentsText::~CComponentsText() -{ - hide(); - clearSavedScreen(); - delete ct_font; - delete ct_box; - delete ct_textbox; - clear(); -} - - -void CComponentsText::initVarText() -{ - //CComponents, CComponentsItem - initVarItem(); - - //CComponentsText - ct_font = NULL; - ct_box = NULL; - ct_textbox = NULL; - ct_text = NULL; - ct_text_mode = CTextBox::SCROLL; - ct_col_text = COL_MENUCONTENT; - ct_text_sended = false; -} - - -void CComponentsText::initText() -{ - //set default font, if is no font definied - if (ct_font == NULL) - ct_font = g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL]; - - //define height and width from font size - height = max(height, ct_font->getHeight() ); - width = max(width, ct_font->getRenderWidth(ct_text, true) ); - - //text box dimensions - if (ct_box == NULL) - ct_box = new CBox(); - ct_box->iX = x+fr_thickness; - ct_box->iY = y+fr_thickness; - ct_box->iWidth = width-2*fr_thickness; - ct_box->iHeight = height-2*fr_thickness; - - //init textbox - if (ct_textbox == NULL) - ct_textbox = new CTextBox(ct_text); - - //set text box properties - ct_textbox->setTextBorderWidth(0); - ct_textbox->enableBackgroundPaint(false); - ct_textbox->setTextFont(ct_font); - ct_textbox->setTextMode(ct_text_mode); - ct_textbox->movePosition(ct_box->iX, ct_box->iY); - ct_textbox->setTextColor(ct_col_text); - - //set text - string new_text = static_cast (ct_text); - ct_text_sended = ct_textbox->setText(&new_text, width); -} - -void CComponentsText::paint(bool do_save_bg) -{ - initText(); - paintInit(do_save_bg); - if (ct_text_sended) - ct_textbox->paint(); - ct_text_sended = false; -} - -void CComponentsText::hide(bool no_restore) -{ - ct_textbox->hide(); - hideContainer(no_restore); -} From e37b5d86f4fc4b236e9ad7f2f03a9ad6d074ec6b Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Tue, 23 Oct 2012 15:39:04 +0200 Subject: [PATCH 087/224] CComponents: add missing paint-members to circle and square classes paint () ist in CComponentsItem abstrakt, muss definiert werden seine eigene in Unterklassen. --- src/gui/components/cc.h | 3 +++ src/gui/components/components.cpp | 11 +++++++++++ 2 files changed, 14 insertions(+) diff --git a/src/gui/components/cc.h b/src/gui/components/cc.h index df6cb21b4..57e211dbc 100644 --- a/src/gui/components/cc.h +++ b/src/gui/components/cc.h @@ -293,6 +293,7 @@ class CComponentsShapeCircle : public CComponentsItem inline void setDiam(const int& diam){d=width=height=diam, corner_rad=d/2;}; inline int getDiam(){return d;}; + void paint(bool do_save_bg = CC_SAVE_SCREEN_YES); }; class CComponentsShapeSquare : public CComponentsItem @@ -300,6 +301,8 @@ class CComponentsShapeSquare : public CComponentsItem public: CComponentsShapeSquare( const int x_pos, const int y_pos, const int w, const int h, bool has_shadow = CC_SHADOW_ON, fb_pixel_t color_frame = COL_MENUCONTENT_PLUS_6, fb_pixel_t color_body = COL_MENUCONTENT_PLUS_0, fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0); + + void paint(bool do_save_bg = CC_SAVE_SCREEN_YES); }; class CComponentsPIP : public CComponentsItem diff --git a/src/gui/components/components.cpp b/src/gui/components/components.cpp index 67be75ec0..d77ea0d12 100644 --- a/src/gui/components/components.cpp +++ b/src/gui/components/components.cpp @@ -513,6 +513,12 @@ CComponentsShapeSquare::CComponentsShapeSquare(const int x_pos, const int y_pos, col_shadow = color_shadow; } +void CComponentsShapeSquare::paint(bool do_save_bg) +{ + paintInit(do_save_bg); +} + + //------------------------------------------------------------------------------------------------------- //sub class CComponentsShapeCircle from CComponentsItem CComponentsShapeCircle::CComponentsShapeCircle( int x_pos, int y_pos, int diam, bool has_shadow, @@ -549,6 +555,11 @@ CComponentsShapeCircle::CComponentsShapeCircle( int x_pos, int y_pos, int diam, // // + - + +void CComponentsShapeCircle::paint(bool do_save_bg) +{ + paintInit(do_save_bg); +} + //------------------------------------------------------------------------------------------------------- //sub class CComponentsDetailLine from CComponents From e80a254daa1a349c43ab0638e354be98a74a961c Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Tue, 23 Oct 2012 20:53:37 +0200 Subject: [PATCH 088/224] CComponentsInfoBox: move define of x_text onto paint() --- src/gui/components/cc.h | 4 ++-- src/gui/components/components.cpp | 31 +++++++++++++++++-------------- 2 files changed, 19 insertions(+), 16 deletions(-) diff --git a/src/gui/components/cc.h b/src/gui/components/cc.h index 57e211dbc..5ec607958 100644 --- a/src/gui/components/cc.h +++ b/src/gui/components/cc.h @@ -248,7 +248,7 @@ class CComponentsInfoBox : public CComponentsItem private: const char* text; int text_mode; //see textbox.h for possible modes - int x_offset; + int x_text, x_offset; Font* font; CBox * box; CTextBox * textbox; @@ -277,9 +277,9 @@ class CComponentsInfoBox : public CComponentsItem inline void setTextColor(fb_pixel_t color_text){ ibox_col_text = color_text;}; inline void setSpaceOffset(const int offset){x_offset = offset;}; inline void setPicture(const std::string& picture_name){pic_name = picture_name;}; - void removeLineBreaks(std::string& str); void paint(bool do_save_bg = CC_SAVE_SCREEN_YES); + void removeLineBreaks(std::string& str); }; diff --git a/src/gui/components/components.cpp b/src/gui/components/components.cpp index d77ea0d12..07299843c 100644 --- a/src/gui/components/components.cpp +++ b/src/gui/components/components.cpp @@ -347,7 +347,6 @@ void CComponentsText::hide(bool no_restore) hideContainer(no_restore); } - //------------------------------------------------------------------------------------------------------- //sub class CComponentsInfoBox from CComponentsItem CComponentsInfoBox::CComponentsInfoBox() @@ -409,6 +408,7 @@ void CComponentsInfoBox::initVarInfobox() pic = NULL; pic_name = ""; x_offset = 10; + x_text = x+fr_thickness+x_offset;; } @@ -426,15 +426,15 @@ void CComponentsInfoBox::paintPicture() pic = new CComponentsPicture(x+fr_thickness+x_offset, y+fr_thickness/*+y_offset*/, ""); pic->setXPos(x+fr_thickness+x_offset); pic->setYPos(y+fr_thickness); - + //define icon pic->setPicture(pic_name); - + //fit icon into infobox pic->setHeight(height-2*fr_thickness); pic->setColorBody(col_body); - - pic->paint(); + + pic->paint(); } void CComponentsInfoBox::paintText() @@ -442,15 +442,6 @@ void CComponentsInfoBox::paintText() if (box == NULL) box = new CBox(); - //define text x position - int x_text = x+fr_thickness+x_offset; - - //set text to the left border if picture not painted - if (pic->isPicPainted()){ - int pic_w = pic->getWidth(); - x_text += pic_w+x_offset; - } - box->iX = x_text; box->iY = y+fr_thickness; @@ -480,6 +471,16 @@ void CComponentsInfoBox::paint(bool do_save_bg) { paintInit(do_save_bg); paintPicture(); + + //define text x position + x_text = x+fr_thickness+x_offset; + + //set text to the left border if picture is not painted + if (pic->isPicPainted()){ + int pic_w = pic->getWidth(); + x_text += pic_w+x_offset; + } + if (text) paintText(); text = NULL; @@ -495,6 +496,8 @@ void CComponentsInfoBox::removeLineBreaks(std::string& str) } + + //------------------------------------------------------------------------------------------------------- //sub class CComponentsShapeSquare from CComponentsItem 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) From bb39d1f64fd2445dd7c3ada16781461498872321 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Tue, 23 Oct 2012 21:23:23 +0200 Subject: [PATCH 089/224] CComponentsInfoBox:start inherit of CComponentsText onto CComponentsInfoBox --- src/gui/components/cc.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/components/cc.h b/src/gui/components/cc.h index 5ec607958..4fd0c019e 100644 --- a/src/gui/components/cc.h +++ b/src/gui/components/cc.h @@ -243,7 +243,7 @@ class CComponentsText : public CComponentsItem }; #define INFO_BOX_Y_OFFSET 2 -class CComponentsInfoBox : public CComponentsItem +class CComponentsInfoBox : public CComponentsText { private: const char* text; From d970c5303f118d082be707164a25ad32cb35e09b Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Tue, 23 Oct 2012 21:25:20 +0200 Subject: [PATCH 090/224] CComponentsText: fix possible segfault segfault happens on left empty text CComponentsInfoBox: inherit ct_textbox CComponentsInfoBox: inherit ct_box CComponentsInfoBox: inherit ct_box --- src/gui/components/cc.h | 22 +++++----- src/gui/components/components.cpp | 73 ++++++++++++++++++------------- 2 files changed, 53 insertions(+), 42 deletions(-) diff --git a/src/gui/components/cc.h b/src/gui/components/cc.h index 4fd0c019e..88458eb83 100644 --- a/src/gui/components/cc.h +++ b/src/gui/components/cc.h @@ -218,17 +218,19 @@ class CComponentsPicture : public CComponentsItem class CComponentsText : public CComponentsItem { - private: - Font* ct_font; - CBox * ct_box; - CTextBox * ct_textbox; + protected: + CTextBox * ct_textbox; + CBox * ct_box; + Font * ct_font; + void initVarText(); + private: const char* ct_text; int ct_text_mode; //see textbox.h for possible modes fb_pixel_t ct_col_text; bool ct_text_sended; - void initVarText(); + void initText(); public: @@ -249,9 +251,7 @@ class CComponentsInfoBox : public CComponentsText const char* text; int text_mode; //see textbox.h for possible modes int x_text, x_offset; - Font* font; - CBox * box; - CTextBox * textbox; + CComponentsPicture * pic; std::string pic_default_name; @@ -269,11 +269,11 @@ class CComponentsInfoBox : public CComponentsText ~CComponentsInfoBox(); - inline void setText(const char* info_text, const int mode = CTextBox::AUTO_WIDTH, Font* font_text = NULL){text = info_text; text_mode = mode, font = font_text;}; - inline void setText(const std::string& info_text, const int mode = CTextBox::AUTO_WIDTH, Font* font_text = NULL){text = info_text.c_str(); text_mode = mode, font = font_text;}; + inline void setText(const char* info_text, const int mode = CTextBox::AUTO_WIDTH, Font* font_text = NULL){text = info_text; text_mode = mode, ct_font = font_text;}; + inline void setText(const std::string& info_text, const int mode = CTextBox::AUTO_WIDTH, Font* font_text = NULL){text = info_text.c_str(); text_mode = mode, ct_font = font_text;}; void setText(neutrino_locale_t locale_text, const int mode = CTextBox::AUTO_WIDTH, Font* font_text = NULL); inline void setTextMode(const int mode){text_mode = mode;};//see textbox.h for possible modes - inline void setTextFont(Font* font_text){font = font_text;}; + inline void setTextFont(Font* font_text){ct_font = font_text;}; inline void setTextColor(fb_pixel_t color_text){ ibox_col_text = color_text;}; inline void setSpaceOffset(const int offset){x_offset = offset;}; inline void setPicture(const std::string& picture_name){pic_name = picture_name;}; diff --git a/src/gui/components/components.cpp b/src/gui/components/components.cpp index 07299843c..da70b4902 100644 --- a/src/gui/components/components.cpp +++ b/src/gui/components/components.cpp @@ -274,9 +274,15 @@ CComponentsText::~CComponentsText() { hide(); clearSavedScreen(); - delete ct_font; - delete ct_box; - delete ct_textbox; + + if (ct_box) + delete ct_box; + ct_box = NULL; + + if (ct_textbox) + delete ct_textbox; + ct_textbox = NULL; + clear(); } @@ -343,7 +349,8 @@ void CComponentsText::paint(bool do_save_bg) void CComponentsText::hide(bool no_restore) { - ct_textbox->hide(); + if (ct_textbox) + ct_textbox->hide(); hideContainer(no_restore); } @@ -351,14 +358,13 @@ void CComponentsText::hide(bool no_restore) //sub class CComponentsInfoBox from CComponentsItem CComponentsInfoBox::CComponentsInfoBox() { - //CComponents, CComponentsItem - initVarItem(); + //CComponents, CComponentsItem, CComponentsText + initVarText(); //CComponentsInfoBox initVarInfobox(); text = NULL; text_mode = CTextBox::AUTO_WIDTH; - font = NULL; ibox_col_text = COL_MENUCONTENT; } @@ -367,8 +373,8 @@ CComponentsInfoBox::CComponentsInfoBox(const int x_pos, const int y_pos, const i bool has_shadow, fb_pixel_t color_text, fb_pixel_t color_frame, fb_pixel_t color_body, fb_pixel_t color_shadow) { - //CComponents, CComponentsItem - initVarItem(); + //CComponents, CComponentsItem, CComponentsText + initVarText(); x = x_pos; y = y_pos; @@ -383,7 +389,7 @@ CComponentsInfoBox::CComponentsInfoBox(const int x_pos, const int y_pos, const i initVarInfobox(); text = info_text; text_mode = mode; - font = font_text; + ct_font = font_text; ibox_col_text = color_text; } @@ -391,8 +397,15 @@ CComponentsInfoBox::~CComponentsInfoBox() { hide(); clearSavedScreen(); - delete textbox; - delete box; + + if (ct_textbox) + delete ct_textbox; + ct_textbox = NULL; + + if (ct_box) + delete ct_box; + ct_box = NULL; + delete pic; clear(); } @@ -400,11 +413,9 @@ CComponentsInfoBox::~CComponentsInfoBox() void CComponentsInfoBox::initVarInfobox() { //CComponents, CComponentsItem - initVarItem(); + initVarText(); //CComponentsInfoBox - box = NULL; - textbox = NULL; pic = NULL; pic_name = ""; x_offset = 10; @@ -416,7 +427,7 @@ void CComponentsInfoBox::setText(neutrino_locale_t locale_text, int mode, Font* { text = g_Locale->getText(locale_text); text_mode = mode; - font = font_text; + ct_font = font_text; } void CComponentsInfoBox::paintPicture() @@ -439,32 +450,32 @@ void CComponentsInfoBox::paintPicture() void CComponentsInfoBox::paintText() { - if (box == NULL) - box = new CBox(); + if (ct_box == NULL) + ct_box = new CBox(); - box->iX = x_text; - box->iY = y+fr_thickness; + ct_box->iX = x_text; + ct_box->iY = y+fr_thickness; //text width and height - box->iWidth = width-2*fr_thickness-(x_text-x); - box->iHeight = height-2*fr_thickness; + ct_box->iWidth = width-2*fr_thickness-(x_text-x); + ct_box->iHeight = height-2*fr_thickness; //init textbox - if (textbox == NULL) { - textbox = new CTextBox(text, font, text_mode, box, col_body); - textbox->setTextBorderWidth(0); - textbox->enableBackgroundPaint(false); + if (ct_textbox == NULL) { + ct_textbox = new CTextBox(text, ct_font, text_mode, ct_box, col_body); + ct_textbox->setTextBorderWidth(0); + ct_textbox->enableBackgroundPaint(false); } //set properties - textbox->setTextFont(font); - textbox->setWindowPos(box); - textbox->setTextColor(ibox_col_text); + ct_textbox->setTextFont(ct_font); + ct_textbox->setWindowPos(ct_box); + ct_textbox->setTextColor(ibox_col_text); //set text string new_text = static_cast (text); - if (textbox->setText(&new_text)) - textbox->paint(); + if (ct_textbox->setText(&new_text)) + ct_textbox->paint(); } void CComponentsInfoBox::paint(bool do_save_bg) From 5c5805d0eaa189ba304ef77bab231ffca1c72c87 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Wed, 24 Oct 2012 15:31:49 +0200 Subject: [PATCH 091/224] CComponentsText: add member clearCCText() --- src/gui/components/cc.h | 3 ++- src/gui/components/components.cpp | 35 +++++++++++++------------------ 2 files changed, 17 insertions(+), 21 deletions(-) diff --git a/src/gui/components/cc.h b/src/gui/components/cc.h index 88458eb83..91371e9ce 100644 --- a/src/gui/components/cc.h +++ b/src/gui/components/cc.h @@ -224,6 +224,7 @@ class CComponentsText : public CComponentsItem Font * ct_font; void initVarText(); + void clearCCText(); private: const char* ct_text; int ct_text_mode; //see textbox.h for possible modes @@ -231,7 +232,7 @@ class CComponentsText : public CComponentsItem bool ct_text_sended; - void initText(); + void initCCText(); public: CComponentsText(); diff --git a/src/gui/components/components.cpp b/src/gui/components/components.cpp index da70b4902..7ed996d9a 100644 --- a/src/gui/components/components.cpp +++ b/src/gui/components/components.cpp @@ -274,15 +274,7 @@ CComponentsText::~CComponentsText() { hide(); clearSavedScreen(); - - if (ct_box) - delete ct_box; - ct_box = NULL; - - if (ct_textbox) - delete ct_textbox; - ct_textbox = NULL; - + clearCCText(); clear(); } @@ -303,7 +295,7 @@ void CComponentsText::initVarText() } -void CComponentsText::initText() +void CComponentsText::initCCText() { //set default font, if is no font definied if (ct_font == NULL) @@ -338,9 +330,20 @@ void CComponentsText::initText() ct_text_sended = ct_textbox->setText(&new_text, width); } +void CComponentsText::clearCCText() +{ + if (ct_box) + delete ct_box; + ct_box = NULL; + + if (ct_textbox) + delete ct_textbox; + ct_textbox = NULL; +} + void CComponentsText::paint(bool do_save_bg) { - initText(); + initCCText(); paintInit(do_save_bg); if (ct_text_sended) ct_textbox->paint(); @@ -397,15 +400,7 @@ CComponentsInfoBox::~CComponentsInfoBox() { hide(); clearSavedScreen(); - - if (ct_textbox) - delete ct_textbox; - ct_textbox = NULL; - - if (ct_box) - delete ct_box; - ct_box = NULL; - + clearCCText(); delete pic; clear(); } From c4ef839ad4267d0ae741f5a5b2dbb71f66b3abcd Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Wed, 24 Oct 2012 15:50:14 +0200 Subject: [PATCH 092/224] CComponentsInfoBox: inherit setTextColor --- src/gui/components/cc.h | 11 +++++++---- src/gui/components/components.cpp | 5 ++--- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/src/gui/components/cc.h b/src/gui/components/cc.h index 91371e9ce..78cf42000 100644 --- a/src/gui/components/cc.h +++ b/src/gui/components/cc.h @@ -223,12 +223,14 @@ class CComponentsText : public CComponentsItem CBox * ct_box; Font * ct_font; + fb_pixel_t ct_col_text; + void initVarText(); void clearCCText(); private: const char* ct_text; int ct_text_mode; //see textbox.h for possible modes - fb_pixel_t ct_col_text; + bool ct_text_sended; @@ -242,7 +244,8 @@ class CComponentsText : public CComponentsItem void hide(bool no_restore = false); void paint(bool do_save_bg = CC_SAVE_SCREEN_YES); - void setTextFont(Font* font_text){ct_font = font_text;}; + inline void setTextFont(Font* font_text){ct_font = font_text;}; + virtual inline void setTextColor(fb_pixel_t color_text){ ct_col_text = color_text;}; }; #define INFO_BOX_Y_OFFSET 2 @@ -260,7 +263,7 @@ class CComponentsInfoBox : public CComponentsText void paintText(); void initVarInfobox(); std::string pic_name; - fb_pixel_t ibox_col_text; + public: CComponentsInfoBox(); CComponentsInfoBox( const int x_pos, const int y_pos, const int w, const int h, @@ -275,7 +278,7 @@ class CComponentsInfoBox : public CComponentsText void setText(neutrino_locale_t locale_text, const int mode = CTextBox::AUTO_WIDTH, Font* font_text = NULL); inline void setTextMode(const int mode){text_mode = mode;};//see textbox.h for possible modes inline void setTextFont(Font* font_text){ct_font = font_text;}; - inline void setTextColor(fb_pixel_t color_text){ ibox_col_text = color_text;}; +// inline void setTextColor(fb_pixel_t color_text){ ibox_col_text = color_text;}; inline void setSpaceOffset(const int offset){x_offset = offset;}; inline void setPicture(const std::string& picture_name){pic_name = picture_name;}; diff --git a/src/gui/components/components.cpp b/src/gui/components/components.cpp index 7ed996d9a..3dd92255e 100644 --- a/src/gui/components/components.cpp +++ b/src/gui/components/components.cpp @@ -368,7 +368,6 @@ CComponentsInfoBox::CComponentsInfoBox() initVarInfobox(); text = NULL; text_mode = CTextBox::AUTO_WIDTH; - ibox_col_text = COL_MENUCONTENT; } CComponentsInfoBox::CComponentsInfoBox(const int x_pos, const int y_pos, const int w, const int h, @@ -393,7 +392,7 @@ CComponentsInfoBox::CComponentsInfoBox(const int x_pos, const int y_pos, const i text = info_text; text_mode = mode; ct_font = font_text; - ibox_col_text = color_text; + ct_col_text = color_text; } CComponentsInfoBox::~CComponentsInfoBox() @@ -465,7 +464,7 @@ void CComponentsInfoBox::paintText() //set properties ct_textbox->setTextFont(ct_font); ct_textbox->setWindowPos(ct_box); - ct_textbox->setTextColor(ibox_col_text); + ct_textbox->setTextColor(ct_col_text); //set text string new_text = static_cast (text); From ac94ad0d3b40d465251aae62d473d635a05e468d Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Wed, 24 Oct 2012 16:26:54 +0200 Subject: [PATCH 093/224] CComponentsInfoBox: inherit setTextFont and setTextMode --- src/gui/components/cc.h | 15 +++++++-------- src/gui/components/components.cpp | 8 ++++---- 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/src/gui/components/cc.h b/src/gui/components/cc.h index 78cf42000..4d4c4c2c2 100644 --- a/src/gui/components/cc.h +++ b/src/gui/components/cc.h @@ -224,16 +224,15 @@ class CComponentsText : public CComponentsItem Font * ct_font; fb_pixel_t ct_col_text; + int ct_text_mode; //see textbox.h for possible modes void initVarText(); void clearCCText(); private: const char* ct_text; - int ct_text_mode; //see textbox.h for possible modes bool ct_text_sended; - void initCCText(); public: @@ -244,8 +243,9 @@ class CComponentsText : public CComponentsItem void hide(bool no_restore = false); void paint(bool do_save_bg = CC_SAVE_SCREEN_YES); - inline void setTextFont(Font* font_text){ct_font = font_text;}; + virtual inline void setTextFont(Font* font_text){ct_font = font_text;}; virtual inline void setTextColor(fb_pixel_t color_text){ ct_col_text = color_text;}; + virtual inline void setTextMode(const int mode){ct_text_mode = mode;};//see textbox.h for possible modes }; #define INFO_BOX_Y_OFFSET 2 @@ -253,7 +253,6 @@ class CComponentsInfoBox : public CComponentsText { private: const char* text; - int text_mode; //see textbox.h for possible modes int x_text, x_offset; CComponentsPicture * pic; @@ -273,11 +272,11 @@ class CComponentsInfoBox : public CComponentsText ~CComponentsInfoBox(); - inline void setText(const char* info_text, const int mode = CTextBox::AUTO_WIDTH, Font* font_text = NULL){text = info_text; text_mode = mode, ct_font = font_text;}; - inline void setText(const std::string& info_text, const int mode = CTextBox::AUTO_WIDTH, Font* font_text = NULL){text = info_text.c_str(); text_mode = mode, ct_font = font_text;}; + inline void setText(const char* info_text, const int mode = CTextBox::AUTO_WIDTH, Font* font_text = NULL){text = info_text; ct_text_mode = mode, ct_font = font_text;}; + inline void setText(const std::string& info_text, const int mode = CTextBox::AUTO_WIDTH, Font* font_text = NULL){text = info_text.c_str(); ct_text_mode = mode, ct_font = font_text;}; void setText(neutrino_locale_t locale_text, const int mode = CTextBox::AUTO_WIDTH, Font* font_text = NULL); - inline void setTextMode(const int mode){text_mode = mode;};//see textbox.h for possible modes - inline void setTextFont(Font* font_text){ct_font = font_text;}; +// inline void setTextMode(const int mode){text_mode = mode;};//see textbox.h for possible modes +// inline void setTextFont(Font* font_text){ct_font = font_text;}; // inline void setTextColor(fb_pixel_t color_text){ ibox_col_text = color_text;}; inline void setSpaceOffset(const int offset){x_offset = offset;}; inline void setPicture(const std::string& picture_name){pic_name = picture_name;}; diff --git a/src/gui/components/components.cpp b/src/gui/components/components.cpp index 3dd92255e..af001700e 100644 --- a/src/gui/components/components.cpp +++ b/src/gui/components/components.cpp @@ -367,7 +367,7 @@ CComponentsInfoBox::CComponentsInfoBox() //CComponentsInfoBox initVarInfobox(); text = NULL; - text_mode = CTextBox::AUTO_WIDTH; + ct_text_mode = CTextBox::AUTO_WIDTH; } CComponentsInfoBox::CComponentsInfoBox(const int x_pos, const int y_pos, const int w, const int h, @@ -390,7 +390,7 @@ CComponentsInfoBox::CComponentsInfoBox(const int x_pos, const int y_pos, const i //CComponentsInfoBox initVarInfobox(); text = info_text; - text_mode = mode; + ct_text_mode = mode; ct_font = font_text; ct_col_text = color_text; } @@ -420,7 +420,7 @@ void CComponentsInfoBox::initVarInfobox() void CComponentsInfoBox::setText(neutrino_locale_t locale_text, int mode, Font* font_text) { text = g_Locale->getText(locale_text); - text_mode = mode; + ct_text_mode = mode; ct_font = font_text; } @@ -456,7 +456,7 @@ void CComponentsInfoBox::paintText() //init textbox if (ct_textbox == NULL) { - ct_textbox = new CTextBox(text, ct_font, text_mode, ct_box, col_body); + ct_textbox = new CTextBox(text, ct_font, ct_text_mode, ct_box, col_body); ct_textbox->setTextBorderWidth(0); ct_textbox->enableBackgroundPaint(false); } From ed5aac229b40146be1965ea296b646e4f76e05b7 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Wed, 24 Oct 2012 17:12:27 +0200 Subject: [PATCH 094/224] CComponentsInfoBox: inherit setText --- src/gui/components/cc.h | 17 ++++++------- src/gui/components/components.cpp | 40 +++++++++++++------------------ 2 files changed, 26 insertions(+), 31 deletions(-) diff --git a/src/gui/components/cc.h b/src/gui/components/cc.h index 4d4c4c2c2..8204f8c89 100644 --- a/src/gui/components/cc.h +++ b/src/gui/components/cc.h @@ -225,12 +225,11 @@ class CComponentsText : public CComponentsItem fb_pixel_t ct_col_text; int ct_text_mode; //see textbox.h for possible modes + const char* ct_text; void initVarText(); void clearCCText(); - private: - const char* ct_text; - + private: bool ct_text_sended; void initCCText(); @@ -239,20 +238,22 @@ class CComponentsText : public CComponentsItem CComponentsText(); ~CComponentsText(); - inline void setText(const char* text, const int text_mode=~CTextBox::AUTO_WIDTH, Font* font_text=NULL){ct_text = text; ct_text_mode = text_mode, ct_font = font_text;}; +// inline void setText(const char* text, const int text_mode=~CTextBox::AUTO_WIDTH, Font* font_text=NULL){ct_text = text; ct_text_mode = text_mode, ct_font = font_text;}; void hide(bool no_restore = false); void paint(bool do_save_bg = CC_SAVE_SCREEN_YES); virtual inline void setTextFont(Font* font_text){ct_font = font_text;}; virtual inline void setTextColor(fb_pixel_t color_text){ ct_col_text = color_text;}; virtual inline void setTextMode(const int mode){ct_text_mode = mode;};//see textbox.h for possible modes + virtual inline void setText(const char* ctext, const int mode = CTextBox::AUTO_WIDTH, Font* font_text = NULL){ct_text = ctext; ct_text_mode = mode, ct_font = font_text;}; + virtual inline void setText(const std::string& stext, const int mode = CTextBox::AUTO_WIDTH, Font* font_text = NULL){ct_text = stext.c_str(); ct_text_mode = mode, ct_font = font_text;}; + virtual void setText(neutrino_locale_t locale_text, const int mode = CTextBox::AUTO_WIDTH, Font* font_text = NULL); }; #define INFO_BOX_Y_OFFSET 2 class CComponentsInfoBox : public CComponentsText { private: - const char* text; int x_text, x_offset; CComponentsPicture * pic; @@ -272,9 +273,9 @@ class CComponentsInfoBox : public CComponentsText ~CComponentsInfoBox(); - inline void setText(const char* info_text, const int mode = CTextBox::AUTO_WIDTH, Font* font_text = NULL){text = info_text; ct_text_mode = mode, ct_font = font_text;}; - inline void setText(const std::string& info_text, const int mode = CTextBox::AUTO_WIDTH, Font* font_text = NULL){text = info_text.c_str(); ct_text_mode = mode, ct_font = font_text;}; - void setText(neutrino_locale_t locale_text, const int mode = CTextBox::AUTO_WIDTH, Font* font_text = NULL); +// inline void setText(const char* info_text, const int mode = CTextBox::AUTO_WIDTH, Font* font_text = NULL){text = info_text; ct_text_mode = mode, ct_font = font_text;}; +// inline void setText(const std::string& info_text, const int mode = CTextBox::AUTO_WIDTH, Font* font_text = NULL){text = info_text.c_str(); ct_text_mode = mode, ct_font = font_text;}; +// void setText(neutrino_locale_t locale_text, const int mode = CTextBox::AUTO_WIDTH, Font* font_text = NULL); // inline void setTextMode(const int mode){text_mode = mode;};//see textbox.h for possible modes // inline void setTextFont(Font* font_text){ct_font = font_text;}; // inline void setTextColor(fb_pixel_t color_text){ ibox_col_text = color_text;}; diff --git a/src/gui/components/components.cpp b/src/gui/components/components.cpp index af001700e..cfa42d7ca 100644 --- a/src/gui/components/components.cpp +++ b/src/gui/components/components.cpp @@ -341,6 +341,13 @@ void CComponentsText::clearCCText() ct_textbox = NULL; } +void CComponentsText::setText(neutrino_locale_t locale_text, int mode, Font* font_text) +{ + ct_text = g_Locale->getText(locale_text); + ct_text_mode = mode; + ct_font = font_text; +} + void CComponentsText::paint(bool do_save_bg) { initCCText(); @@ -361,13 +368,8 @@ void CComponentsText::hide(bool no_restore) //sub class CComponentsInfoBox from CComponentsItem CComponentsInfoBox::CComponentsInfoBox() { - //CComponents, CComponentsItem, CComponentsText - initVarText(); - //CComponentsInfoBox initVarInfobox(); - text = NULL; - ct_text_mode = CTextBox::AUTO_WIDTH; } CComponentsInfoBox::CComponentsInfoBox(const int x_pos, const int y_pos, const int w, const int h, @@ -375,9 +377,9 @@ CComponentsInfoBox::CComponentsInfoBox(const int x_pos, const int y_pos, const i bool has_shadow, fb_pixel_t color_text, fb_pixel_t color_frame, fb_pixel_t color_body, fb_pixel_t color_shadow) { - //CComponents, CComponentsItem, CComponentsText - initVarText(); - + //CComponentsInfoBox + initVarInfobox(); + x = x_pos; y = y_pos; width = w; @@ -387,9 +389,7 @@ CComponentsInfoBox::CComponentsInfoBox(const int x_pos, const int y_pos, const i col_body = color_body; col_shadow = color_shadow; - //CComponentsInfoBox - initVarInfobox(); - text = info_text; + ct_text = info_text; ct_text_mode = mode; ct_font = font_text; ct_col_text = color_text; @@ -406,8 +406,9 @@ CComponentsInfoBox::~CComponentsInfoBox() void CComponentsInfoBox::initVarInfobox() { - //CComponents, CComponentsItem + //CComponents, CComponentsItem, CComponentsText initVarText(); + ct_text_mode = CTextBox::AUTO_WIDTH; //CComponentsInfoBox pic = NULL; @@ -417,13 +418,6 @@ void CComponentsInfoBox::initVarInfobox() } -void CComponentsInfoBox::setText(neutrino_locale_t locale_text, int mode, Font* font_text) -{ - text = g_Locale->getText(locale_text); - ct_text_mode = mode; - ct_font = font_text; -} - void CComponentsInfoBox::paintPicture() { //init and set icon paint position @@ -456,7 +450,7 @@ void CComponentsInfoBox::paintText() //init textbox if (ct_textbox == NULL) { - ct_textbox = new CTextBox(text, ct_font, ct_text_mode, ct_box, col_body); + ct_textbox = new CTextBox(ct_text, ct_font, ct_text_mode, ct_box, col_body); ct_textbox->setTextBorderWidth(0); ct_textbox->enableBackgroundPaint(false); } @@ -467,7 +461,7 @@ void CComponentsInfoBox::paintText() ct_textbox->setTextColor(ct_col_text); //set text - string new_text = static_cast (text); + string new_text = static_cast (ct_text); if (ct_textbox->setText(&new_text)) ct_textbox->paint(); } @@ -486,9 +480,9 @@ void CComponentsInfoBox::paint(bool do_save_bg) x_text += pic_w+x_offset; } - if (text) + if (ct_text) paintText(); - text = NULL; + ct_text = NULL; } void CComponentsInfoBox::removeLineBreaks(std::string& str) From 80ffab8999e967d40d45658b1636104ffdd9bf40 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Fri, 26 Oct 2012 23:53:05 +0200 Subject: [PATCH 095/224] CComponentsText: fix paint text into Textbox --- src/gui/components/cc.h | 23 ++----- src/gui/components/components.cpp | 102 ++++++++++++++++-------------- 2 files changed, 62 insertions(+), 63 deletions(-) diff --git a/src/gui/components/cc.h b/src/gui/components/cc.h index 8204f8c89..5bf5bbe89 100644 --- a/src/gui/components/cc.h +++ b/src/gui/components/cc.h @@ -226,28 +226,25 @@ class CComponentsText : public CComponentsItem fb_pixel_t ct_col_text; int ct_text_mode; //see textbox.h for possible modes const char* ct_text; + bool ct_text_sent; void initVarText(); void clearCCText(); - private: - bool ct_text_sended; - void initCCText(); - + void paintText(bool do_save_bg = CC_SAVE_SCREEN_YES); public: CComponentsText(); ~CComponentsText(); -// inline void setText(const char* text, const int text_mode=~CTextBox::AUTO_WIDTH, Font* font_text=NULL){ct_text = text; ct_text_mode = text_mode, ct_font = font_text;}; - void hide(bool no_restore = false); void paint(bool do_save_bg = CC_SAVE_SCREEN_YES); + virtual inline void setTextFont(Font* font_text){ct_font = font_text;}; virtual inline void setTextColor(fb_pixel_t color_text){ ct_col_text = color_text;}; virtual inline void setTextMode(const int mode){ct_text_mode = mode;};//see textbox.h for possible modes - virtual inline void setText(const char* ctext, const int mode = CTextBox::AUTO_WIDTH, Font* font_text = NULL){ct_text = ctext; ct_text_mode = mode, ct_font = font_text;}; - virtual inline void setText(const std::string& stext, const int mode = CTextBox::AUTO_WIDTH, Font* font_text = NULL){ct_text = stext.c_str(); ct_text_mode = mode, ct_font = font_text;}; - virtual void setText(neutrino_locale_t locale_text, const int mode = CTextBox::AUTO_WIDTH, Font* font_text = NULL); + virtual inline void setText(const char* ctext, const int mode = ~CTextBox::AUTO_WIDTH, Font* font_text = NULL){ct_text = ctext; ct_text_mode = mode, ct_font = font_text;}; + virtual inline void setText(const std::string& stext, const int mode = ~CTextBox::AUTO_WIDTH, Font* font_text = NULL){ct_text = stext.c_str(); ct_text_mode = mode, ct_font = font_text;}; + virtual void setText(neutrino_locale_t locale_text, const int mode = ~CTextBox::AUTO_WIDTH, Font* font_text = NULL); }; #define INFO_BOX_Y_OFFSET 2 @@ -260,7 +257,7 @@ class CComponentsInfoBox : public CComponentsText std::string pic_default_name; void paintPicture(); - void paintText(); +// void paintText(); void initVarInfobox(); std::string pic_name; @@ -273,12 +270,6 @@ class CComponentsInfoBox : public CComponentsText ~CComponentsInfoBox(); -// inline void setText(const char* info_text, const int mode = CTextBox::AUTO_WIDTH, Font* font_text = NULL){text = info_text; ct_text_mode = mode, ct_font = font_text;}; -// inline void setText(const std::string& info_text, const int mode = CTextBox::AUTO_WIDTH, Font* font_text = NULL){text = info_text.c_str(); ct_text_mode = mode, ct_font = font_text;}; -// void setText(neutrino_locale_t locale_text, const int mode = CTextBox::AUTO_WIDTH, Font* font_text = NULL); -// inline void setTextMode(const int mode){text_mode = mode;};//see textbox.h for possible modes -// inline void setTextFont(Font* font_text){ct_font = font_text;}; -// inline void setTextColor(fb_pixel_t color_text){ ibox_col_text = color_text;}; inline void setSpaceOffset(const int offset){x_offset = offset;}; inline void setPicture(const std::string& picture_name){pic_name = picture_name;}; diff --git a/src/gui/components/components.cpp b/src/gui/components/components.cpp index cfa42d7ca..8e67ec175 100644 --- a/src/gui/components/components.cpp +++ b/src/gui/components/components.cpp @@ -289,9 +289,9 @@ void CComponentsText::initVarText() ct_box = NULL; ct_textbox = NULL; ct_text = NULL; - ct_text_mode = CTextBox::SCROLL; + ct_text_mode = CTextBox::AUTO_WIDTH; ct_col_text = COL_MENUCONTENT; - ct_text_sended = false; + ct_text_sent = false; } @@ -301,9 +301,8 @@ void CComponentsText::initCCText() if (ct_font == NULL) ct_font = g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL]; - //define height and width from font size - height = max(height, ct_font->getHeight() ); - width = max(width, ct_font->getRenderWidth(ct_text, true) ); + //define height from font size + height = max(height, ct_font->getHeight()); //text box dimensions if (ct_box == NULL) @@ -315,19 +314,24 @@ void CComponentsText::initCCText() //init textbox if (ct_textbox == NULL) - ct_textbox = new CTextBox(ct_text); + ct_textbox = new CTextBox(); //set text box properties - ct_textbox->setTextBorderWidth(0); - ct_textbox->enableBackgroundPaint(false); ct_textbox->setTextFont(ct_font); ct_textbox->setTextMode(ct_text_mode); - ct_textbox->movePosition(ct_box->iX, ct_box->iY); + ct_textbox->setWindowPos(ct_box); + ct_textbox->setTextBorderWidth(0); + ct_textbox->enableBackgroundPaint(false); + //ct_textbox->setBackGroundColor(COL_RED); + ct_textbox->setBackGroundRadius(corner_rad-fr_thickness, corner_type); + //ct_textbox->movePosition(ct_box->iX, ct_box->iY); ct_textbox->setTextColor(ct_col_text); + ct_textbox->setWindowMaxDimensions(ct_box->iWidth, ct_box->iHeight); + ct_textbox->setWindowMinDimensions(ct_box->iWidth, ct_box->iHeight); //set text string new_text = static_cast (ct_text); - ct_text_sended = ct_textbox->setText(&new_text, width); + ct_text_sent = ct_textbox->setText(&new_text, ct_box->iWidth); } void CComponentsText::clearCCText() @@ -348,13 +352,18 @@ void CComponentsText::setText(neutrino_locale_t locale_text, int mode, Font* fon ct_font = font_text; } +void CComponentsText::paintText(bool do_save_bg) +{ + paintInit(do_save_bg); + initCCText(); + if (ct_text_sent) + ct_textbox->paint(); + ct_text_sent = false; +} + void CComponentsText::paint(bool do_save_bg) { - initCCText(); - paintInit(do_save_bg); - if (ct_text_sended) - ct_textbox->paint(); - ct_text_sended = false; + paintText(do_save_bg); } void CComponentsText::hide(bool no_restore) @@ -408,7 +417,6 @@ void CComponentsInfoBox::initVarInfobox() { //CComponents, CComponentsItem, CComponentsText initVarText(); - ct_text_mode = CTextBox::AUTO_WIDTH; //CComponentsInfoBox pic = NULL; @@ -433,38 +441,38 @@ void CComponentsInfoBox::paintPicture() pic->setHeight(height-2*fr_thickness); pic->setColorBody(col_body); - pic->paint(); + pic->paint(CC_SAVE_SCREEN_NO); } -void CComponentsInfoBox::paintText() -{ - if (ct_box == NULL) - ct_box = new CBox(); - - ct_box->iX = x_text; - ct_box->iY = y+fr_thickness; - - //text width and height - ct_box->iWidth = width-2*fr_thickness-(x_text-x); - ct_box->iHeight = height-2*fr_thickness; - - //init textbox - if (ct_textbox == NULL) { - ct_textbox = new CTextBox(ct_text, ct_font, ct_text_mode, ct_box, col_body); - ct_textbox->setTextBorderWidth(0); - ct_textbox->enableBackgroundPaint(false); - } - - //set properties - ct_textbox->setTextFont(ct_font); - ct_textbox->setWindowPos(ct_box); - ct_textbox->setTextColor(ct_col_text); - - //set text - string new_text = static_cast (ct_text); - if (ct_textbox->setText(&new_text)) - ct_textbox->paint(); -} +// void CComponentsInfoBox::paintText() +// { +// if (ct_box == NULL) +// ct_box = new CBox(); +// +// ct_box->iX = x_text; +// ct_box->iY = y+fr_thickness; +// +// //text width and height +// ct_box->iWidth = width-2*fr_thickness-(x_text-x); +// ct_box->iHeight = height-2*fr_thickness; +// +// //init textbox +// if (ct_textbox == NULL) { +// ct_textbox = new CTextBox(ct_text, ct_font, ct_text_mode, ct_box, col_body); +// ct_textbox->setTextBorderWidth(0); +// ct_textbox->enableBackgroundPaint(false); +// } +// +// //set properties +// ct_textbox->setTextFont(ct_font); +// ct_textbox->setWindowPos(ct_box); +// ct_textbox->setTextColor(ct_col_text); +// +// //set text +// string new_text = static_cast (ct_text); +// if (ct_textbox->setText(&new_text)) +// ct_textbox->paint(); +// } void CComponentsInfoBox::paint(bool do_save_bg) { @@ -481,7 +489,7 @@ void CComponentsInfoBox::paint(bool do_save_bg) } if (ct_text) - paintText(); + paintText(CC_SAVE_SCREEN_NO); ct_text = NULL; } From ce00b0b4a06bc5776deb6b087d0dc0472f8311dd Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Sat, 27 Oct 2012 16:49:31 +0200 Subject: [PATCH 096/224] CComponentsInfoBox: paint text with innstance of CComponentsText This should be a stable state for painting info boxes in gui parts. This fix also an automaticaly correction of font size changes while runtime. --- src/gui/components/cc.h | 4 +- src/gui/components/components.cpp | 75 +++++++++++-------------------- 2 files changed, 28 insertions(+), 51 deletions(-) diff --git a/src/gui/components/cc.h b/src/gui/components/cc.h index 5bf5bbe89..7b91bcc5d 100644 --- a/src/gui/components/cc.h +++ b/src/gui/components/cc.h @@ -245,6 +245,7 @@ class CComponentsText : public CComponentsItem virtual inline void setText(const char* ctext, const int mode = ~CTextBox::AUTO_WIDTH, Font* font_text = NULL){ct_text = ctext; ct_text_mode = mode, ct_font = font_text;}; virtual inline void setText(const std::string& stext, const int mode = ~CTextBox::AUTO_WIDTH, Font* font_text = NULL){ct_text = stext.c_str(); ct_text_mode = mode, ct_font = font_text;}; virtual void setText(neutrino_locale_t locale_text, const int mode = ~CTextBox::AUTO_WIDTH, Font* font_text = NULL); + virtual void removeLineBreaks(std::string& str); }; #define INFO_BOX_Y_OFFSET 2 @@ -252,7 +253,7 @@ class CComponentsInfoBox : public CComponentsText { private: int x_text, x_offset; - + CComponentsText * cctext; CComponentsPicture * pic; std::string pic_default_name; @@ -274,7 +275,6 @@ class CComponentsInfoBox : public CComponentsText inline void setPicture(const std::string& picture_name){pic_name = picture_name;}; void paint(bool do_save_bg = CC_SAVE_SCREEN_YES); - void removeLineBreaks(std::string& str); }; diff --git a/src/gui/components/components.cpp b/src/gui/components/components.cpp index 8e67ec175..3aa6f28c3 100644 --- a/src/gui/components/components.cpp +++ b/src/gui/components/components.cpp @@ -305,8 +305,12 @@ void CComponentsText::initCCText() height = max(height, ct_font->getHeight()); //text box dimensions - if (ct_box == NULL) - ct_box = new CBox(); + if (ct_box){ + //ensure that we have a new instance + delete ct_box; + ct_box = NULL; + } + ct_box = new CBox(); ct_box->iX = x+fr_thickness; ct_box->iY = y+fr_thickness; ct_box->iWidth = width-2*fr_thickness; @@ -322,9 +326,7 @@ void CComponentsText::initCCText() ct_textbox->setWindowPos(ct_box); ct_textbox->setTextBorderWidth(0); ct_textbox->enableBackgroundPaint(false); - //ct_textbox->setBackGroundColor(COL_RED); ct_textbox->setBackGroundRadius(corner_rad-fr_thickness, corner_type); - //ct_textbox->movePosition(ct_box->iX, ct_box->iY); ct_textbox->setTextColor(ct_col_text); ct_textbox->setWindowMaxDimensions(ct_box->iWidth, ct_box->iHeight); ct_textbox->setWindowMinDimensions(ct_box->iWidth, ct_box->iHeight); @@ -373,6 +375,16 @@ void CComponentsText::hide(bool no_restore) hideContainer(no_restore); } +//small helper to remove excessiv linbreaks +void CComponentsText::removeLineBreaks(std::string& str) +{ + std::string::size_type spos = str.find_first_of("\r\n"); + while (spos != std::string::npos) { + str.replace(spos, 1, " "); + spos = str.find_first_of("\r\n"); + } +} + //------------------------------------------------------------------------------------------------------- //sub class CComponentsInfoBox from CComponentsItem CComponentsInfoBox::CComponentsInfoBox() @@ -410,6 +422,7 @@ CComponentsInfoBox::~CComponentsInfoBox() clearSavedScreen(); clearCCText(); delete pic; + delete cctext; clear(); } @@ -420,6 +433,7 @@ void CComponentsInfoBox::initVarInfobox() //CComponentsInfoBox pic = NULL; + cctext = NULL; pic_name = ""; x_offset = 10; x_text = x+fr_thickness+x_offset;; @@ -444,41 +458,11 @@ void CComponentsInfoBox::paintPicture() pic->paint(CC_SAVE_SCREEN_NO); } -// void CComponentsInfoBox::paintText() -// { -// if (ct_box == NULL) -// ct_box = new CBox(); -// -// ct_box->iX = x_text; -// ct_box->iY = y+fr_thickness; -// -// //text width and height -// ct_box->iWidth = width-2*fr_thickness-(x_text-x); -// ct_box->iHeight = height-2*fr_thickness; -// -// //init textbox -// if (ct_textbox == NULL) { -// ct_textbox = new CTextBox(ct_text, ct_font, ct_text_mode, ct_box, col_body); -// ct_textbox->setTextBorderWidth(0); -// ct_textbox->enableBackgroundPaint(false); -// } -// -// //set properties -// ct_textbox->setTextFont(ct_font); -// ct_textbox->setWindowPos(ct_box); -// ct_textbox->setTextColor(ct_col_text); -// -// //set text -// string new_text = static_cast (ct_text); -// if (ct_textbox->setText(&new_text)) -// ct_textbox->paint(); -// } - void CComponentsInfoBox::paint(bool do_save_bg) { paintInit(do_save_bg); paintPicture(); - + //define text x position x_text = x+fr_thickness+x_offset; @@ -487,24 +471,17 @@ void CComponentsInfoBox::paint(bool do_save_bg) int pic_w = pic->getWidth(); x_text += pic_w+x_offset; } - - if (ct_text) - paintText(CC_SAVE_SCREEN_NO); - ct_text = NULL; -} -void CComponentsInfoBox::removeLineBreaks(std::string& str) -{ - std::string::size_type spos = str.find_first_of("\r\n"); - while (spos != std::string::npos) { - str.replace(spos, 1, " "); - spos = str.find_first_of("\r\n"); + //set text and paint text lines + if (ct_text){ + if (cctext == NULL) + cctext = new CComponentsText(); + cctext->setText(ct_text, ct_text_mode, ct_font); + cctext->setDimensionsAll(x_text, y+fr_thickness, width-(x_text-x+x_offset+fr_thickness), height-2*fr_thickness); + cctext->paint(CC_SAVE_SCREEN_NO); } } - - - //------------------------------------------------------------------------------------------------------- //sub class CComponentsShapeSquare from CComponentsItem 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) From 98b1e38dfa9abb625fc58e2016fd7df94e155d59 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Sat, 27 Oct 2012 16:52:55 +0200 Subject: [PATCH 097/224] CTestMenu: add tests for CComponentsText --- src/gui/test_menu.cpp | 15 +++++++++++++++ src/gui/test_menu.h | 1 + 2 files changed, 16 insertions(+) diff --git a/src/gui/test_menu.cpp b/src/gui/test_menu.cpp index 636b005b7..8533cc18c 100644 --- a/src/gui/test_menu.cpp +++ b/src/gui/test_menu.cpp @@ -67,6 +67,7 @@ CTestMenu::CTestMenu() pic= NULL; pip = NULL; form = NULL; + txt = NULL; } CTestMenu::~CTestMenu() @@ -76,6 +77,7 @@ CTestMenu::~CTestMenu() delete pic; delete pip; delete form; + delete txt; } int CTestMenu::exec(CMenuTarget* parent, const std::string &actionKey) @@ -375,6 +377,18 @@ int CTestMenu::exec(CMenuTarget* parent, const std::string &actionKey) form->paint(); return res; } + else if (actionKey == "text"){ + if (txt == NULL) + txt = new CComponentsText(); + txt->setDimensionsAll(100, 100, 250, 100); + txt->setText("This is a text for testing textbox", CTextBox::NO_AUTO_LINEBREAK); + + if (txt->isPainted()) + txt->hide(); + else + txt->paint(); + return res; + } showTestMenu(); @@ -419,6 +433,7 @@ void CTestMenu::showCCTests(CMenuWidget *widget) widget->addItem(new CMenuForwarderNonLocalized("Picture", true, NULL, this, "picture")); widget->addItem(new CMenuForwarderNonLocalized("PiP", true, NULL, this, "pip")); widget->addItem(new CMenuForwarderNonLocalized("Form", true, NULL, this, "form")); + widget->addItem(new CMenuForwarderNonLocalized("Text", true, NULL, this, "text")); } void CTestMenu::showHWTests(CMenuWidget *widget) diff --git a/src/gui/test_menu.h b/src/gui/test_menu.h index d5abe6a51..5612952d4 100644 --- a/src/gui/test_menu.h +++ b/src/gui/test_menu.h @@ -44,6 +44,7 @@ class CTestMenu : public CMenuTarget CComponentsPicture* pic; CComponentsPIP* pip; CComponentsForm *form; + CComponentsText *txt; int width, selected; void showTestMenu(); From cda02273ea072e08758bde1b63885d87d6fade23 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Thu, 1 Nov 2012 16:46:28 +0100 Subject: [PATCH 098/224] CComponents: add new methodes to create forms Create forms with default constructor and now you can add cc-items into form with new member addCCItem(). The x/y values are valid to inside of form dimensions itself not inside of screen. Addable cc-items are all CComponentItem objects and their inheritances including CComponentsForm itself. So are even nestings possible. Some changes on other cc-item classes were necessary. For example, CComponentsPicture or CComponentsText and it's still much to do. --- src/gui/components/cc.h | 83 +++++++------ src/gui/components/components.cpp | 199 +++++++++++++++++++----------- 2 files changed, 175 insertions(+), 107 deletions(-) diff --git a/src/gui/components/cc.h b/src/gui/components/cc.h index 7b91bcc5d..21e71cc80 100644 --- a/src/gui/components/cc.h +++ b/src/gui/components/cc.h @@ -81,12 +81,6 @@ enum CC_ALIGN_VER_CENTER = 16 }; -enum -{ - CC_PIC_ICON, - CC_PIC_IMAGE -}; - enum { CC_ITEMBOX_ICON, @@ -141,7 +135,7 @@ class CComponents inline virtual void setHeight(const int& h){height = h;}; inline virtual void setWidth(const int& w){width = w;}; inline virtual void setDimensionsAll(const int& xpos, const int& ypos, const int& w, const int& h){x = xpos; y = ypos; width = w; height = h;}; - + inline virtual int getXPos(){return x;}; inline virtual int getYPos(){return y;}; inline virtual int getHeight(){return height;}; @@ -153,6 +147,10 @@ class CComponents inline virtual void setColorBody(fb_pixel_t color){col_body = color;}; inline virtual void setColorShadow(fb_pixel_t color){col_shadow = color;}; inline virtual void setColorAll(fb_pixel_t color_frame, fb_pixel_t color_body, fb_pixel_t color_shadow){col_frame = color_frame; col_body = color_body; col_shadow = color_shadow;}; +/// get colors + inline virtual fb_pixel_t getColorFrame(){return col_frame;}; + inline virtual fb_pixel_t getColorBody(){return col_body;}; + inline virtual fb_pixel_t getColorShadow(){return col_shadow;}; virtual void hide(); virtual bool isPainted(){return is_painted;}; @@ -172,48 +170,55 @@ class CComponentsItem : public CComponents /// set corner types: Possible corner types are defined in CFrameBuffer (see: driver/framebuffer.h). inline virtual void setCornerType(const int& type){corner_type = type;}; inline virtual void setCornerRadius(const int& radius){corner_rad = radius;}; - +/// get corner types: + inline virtual int getCornerType(){return corner_type;}; + inline virtual int getCornerRadius(){return corner_rad;}; + inline virtual void setFrameThickness(const int& thickness){fr_thickness = thickness;}; inline virtual void setShadowOnOff(bool has_shadow){shadow = has_shadow;}; virtual void paint(bool do_save_bg = CC_SAVE_SCREEN_YES) = 0; virtual void hide(bool no_restore = false); virtual void kill(); - + virtual void syncSysColors(); }; class CComponentsPicture : public CComponentsItem { private: + enum + { + CC_PIC_IMAGE_MODE_OFF = 0, //paint pictures in icon mode, mainly not scaled + CC_PIC_IMAGE_MODE_ON = 1, //paint pictures in image mode, paint scaled if required + CC_PIC_IMAGE_MODE_AUTO = 2 + }; + std::string pic_name; unsigned char pic_offset; bool pic_paint, pic_paintBg, pic_painted, do_paint; int pic_align, pic_x, pic_y, pic_width, pic_height; - int maxWidth, maxHeight, picMode; - + int maxWidth, maxHeight, pic_paint_mode; + void initVarPicture(); - void init( const int x_pos, const int y_pos, const std::string& picture_name, const int alignment, bool has_shadow, + void init( const int x_pos, const int y_pos, 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); - + 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, - fb_pixel_t color_frame = COL_MENUCONTENT_PLUS_6, fb_pixel_t color_background = 0, fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0); CComponentsPicture( const int x_pos, const int y_pos, const int w_max, const int h_max, - const std::string& picture_name, const int alignment = CC_ALIGN_HOR_CENTER | CC_ALIGN_VER_CENTER, bool has_shadow = CC_SHADOW_OFF, + const std::string& image_name, 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); + inline void setPictureOffset(const unsigned char offset){pic_offset = offset;}; inline void setPicturePaint(bool paint_p){pic_paint = paint_p;}; inline void setPicturePaintBackground(bool paintBg){pic_paintBg = paintBg;}; inline void setPicture(const std::string& picture_name); void setPictureAlign(const int alignment); - + inline bool isPicPainted(){return pic_painted;}; void paint(bool do_save_bg = CC_SAVE_SCREEN_YES); void hide(bool no_restore = false); inline void getPictureSize(int *pwidth, int *pheight){*pwidth=pic_width; *pheight=pic_height;}; - }; class CComponentsText : public CComponentsItem @@ -234,6 +239,11 @@ class CComponentsText : public CComponentsItem void paintText(bool do_save_bg = CC_SAVE_SCREEN_YES); public: CComponentsText(); + CComponentsText(const char* text, const int mode = CTextBox::AUTO_WIDTH, Font* font_text = NULL); + CComponentsText( const int x_pos, const int y_pos, const int w, const int h, + const char* text = "", const int mode = CTextBox::AUTO_WIDTH, Font* font_text = NULL, + bool has_shadow = CC_SHADOW_OFF, + fb_pixel_t color_text = COL_MENUCONTENT, fb_pixel_t color_frame = COL_MENUCONTENT_PLUS_6, fb_pixel_t color_body = COL_MENUCONTENT_PLUS_0, fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0); ~CComponentsText(); void hide(bool no_restore = false); @@ -256,24 +266,23 @@ class CComponentsInfoBox : public CComponentsText CComponentsText * cctext; CComponentsPicture * pic; std::string pic_default_name; - + void paintPicture(); -// void paintText(); void initVarInfobox(); std::string pic_name; - + public: CComponentsInfoBox(); CComponentsInfoBox( const int x_pos, const int y_pos, const int w, const int h, const char* info_text = "", const int mode = CTextBox::AUTO_WIDTH, Font* font_text = NULL, bool has_shadow = CC_SHADOW_OFF, fb_pixel_t color_text = COL_MENUCONTENT, fb_pixel_t color_frame = COL_MENUCONTENT_PLUS_6, fb_pixel_t color_body = COL_MENUCONTENT_PLUS_0, fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0); - + ~CComponentsInfoBox(); - + inline void setSpaceOffset(const int offset){x_offset = offset;}; inline void setPicture(const std::string& picture_name){pic_name = picture_name;}; - + void paint(bool do_save_bg = CC_SAVE_SCREEN_YES); }; @@ -285,7 +294,7 @@ class CComponentsShapeCircle : public CComponentsItem public: CComponentsShapeCircle( const int x_pos, const int y_pos, const int diam, bool has_shadow = CC_SHADOW_ON, fb_pixel_t color_frame = COL_MENUCONTENT_PLUS_6, fb_pixel_t color_body = COL_MENUCONTENT_PLUS_0, fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0); - + inline void setDiam(const int& diam){d=width=height=diam, corner_rad=d/2;}; inline int getDiam(){return d;}; void paint(bool do_save_bg = CC_SAVE_SCREEN_YES); @@ -296,7 +305,7 @@ class CComponentsShapeSquare : public CComponentsItem public: CComponentsShapeSquare( const int x_pos, const int y_pos, const int w, const int h, bool has_shadow = CC_SHADOW_ON, fb_pixel_t color_frame = COL_MENUCONTENT_PLUS_6, fb_pixel_t color_body = COL_MENUCONTENT_PLUS_0, fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0); - + void paint(bool do_save_bg = CC_SAVE_SCREEN_YES); }; @@ -307,7 +316,7 @@ class CComponentsPIP : public CComponentsItem public: CComponentsPIP( const int x_pos, const int y_pos, const int percent, bool has_shadow = CC_SHADOW_OFF); ~CComponentsPIP(); - + void paint(bool do_save_bg = CC_SAVE_SCREEN_YES); void hide(bool no_restore = false); }; @@ -416,24 +425,22 @@ class CComponentsTitleBar : public CComponentsItemBox class CComponentsForm : public CComponentsItem { + protected: + std::vector v_cc_items; + void paintCCItems(); private: - CComponentsTitleBar *tb; - std::string tb_text, tb_icon; - void initVarForm(); - void paintHead(); - public: + CComponentsForm(); + CComponentsForm(const int x_pos, const int y_pos, const int w, const int h); + CComponentsForm(const int x_pos, const int y_pos, const int w, const int h, bool has_shadow = CC_SHADOW_ON, + fb_pixel_t color_frame = COL_MENUCONTENT_PLUS_6, fb_pixel_t color_body = COL_MENUCONTENT_PLUS_0, fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0); ~CComponentsForm(); void paint(bool do_save_bg = CC_SAVE_SCREEN_YES); void hide(bool no_restore = false); - void setCaption(const std::string& text); - void setCaption(neutrino_locale_t locale_text); - void setIcon(const std::string& icon_name){tb_icon = icon_name;}; + void addCCItem(CComponentsItem* cc_Item); }; - - #endif diff --git a/src/gui/components/components.cpp b/src/gui/components/components.cpp index 3aa6f28c3..ce1a235fd 100644 --- a/src/gui/components/components.cpp +++ b/src/gui/components/components.cpp @@ -269,6 +269,42 @@ CComponentsText::CComponentsText() initVarText(); } +CComponentsText::CComponentsText(const char* text, const int mode, Font* font_text) +{ + //CComponentsText + initVarText(); + + ct_text = text; + ct_text_mode = mode; + ct_font = font_text; +} + +CComponentsText::CComponentsText( const int x_pos, const int y_pos, const int w, const int h, + const char* text, const int mode, Font* font_text, + bool has_shadow, + fb_pixel_t color_text, fb_pixel_t color_frame, fb_pixel_t color_body, fb_pixel_t color_shadow) +{ + //CComponentsText + initVarText(); + + //CComponents + x = x_pos, + y = y_pos, + width = w; + height = h; + + col_frame = color_frame; + col_body = color_body; + col_shadow = color_shadow; + shadow = has_shadow; + + ct_font = font_text; + ct_text = text; + ct_text_mode = mode; + ct_col_text = color_text; +} + + CComponentsText::~CComponentsText() { @@ -444,7 +480,7 @@ void CComponentsInfoBox::paintPicture() { //init and set icon paint position if (pic == NULL) - pic = new CComponentsPicture(x+fr_thickness+x_offset, y+fr_thickness/*+y_offset*/, ""); + pic = new CComponentsPicture(x+fr_thickness+x_offset, y+fr_thickness/*+y_offset*/, 0, 0, ""); pic->setXPos(x+fr_thickness+x_offset); pic->setYPos(y+fr_thickness); @@ -730,40 +766,27 @@ void CComponentsPIP::hide(bool no_restore) //------------------------------------------------------------------------------------------------------- //sub class CComponentsPicture from CComponentsItem -CComponentsPicture::CComponentsPicture( const int x_pos, const int y_pos, - const std::string& picture_name, const int alignment, bool has_shadow, - fb_pixel_t color_frame, fb_pixel_t color_background, fb_pixel_t color_shadow) -{ - init(x_pos, y_pos, picture_name, alignment, has_shadow, color_frame, color_background, color_shadow); - - maxWidth = 0; - maxHeight = 0; - picMode = CC_PIC_ICON; - - initVarPicture(); -} - CComponentsPicture::CComponentsPicture( const int x_pos, const int y_pos, const int w_max, const int h_max, - const std::string& picture_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) { - init(x_pos, y_pos, picture_name, alignment, has_shadow, color_frame, color_background, color_shadow); + init(x_pos, y_pos, image_name, alignment, has_shadow, color_frame, color_background, color_shadow); maxWidth = w_max; maxHeight = h_max; - picMode = CC_PIC_IMAGE; + pic_paint_mode = CC_PIC_IMAGE_MODE_AUTO, initVarPicture(); } -void CComponentsPicture::init( int x_pos, int y_pos, const string& picture_name, const int alignment, bool has_shadow, +void CComponentsPicture::init( int x_pos, int y_pos, 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) { //CComponents, CComponentsItem initVarItem(); //CComponentsPicture - pic_name = picture_name; + pic_name = image_name; pic_align = alignment; pic_offset = 1; pic_paint = true; @@ -805,9 +828,22 @@ void CComponentsPicture::initVarPicture() pic_painted = false; do_paint = false; - if (picMode == CC_PIC_ICON) + //set the image mode depends of name syntax, icon names contains no path, + //so we can detect the required image mode + if (pic_paint_mode == CC_PIC_IMAGE_MODE_AUTO){ + if (!access(pic_name.c_str(), F_OK )) + pic_paint_mode = CC_PIC_IMAGE_MODE_ON; + else + pic_paint_mode = CC_PIC_IMAGE_MODE_OFF; + } + + if (pic_paint_mode == CC_PIC_IMAGE_MODE_OFF){ frameBuffer->getIconSize(pic_name.c_str(), &pic_width, &pic_height); - else { + pic_width = max(pic_width, maxWidth); + pic_height = max(pic_height, maxHeight); + } + + if (pic_paint_mode == CC_PIC_IMAGE_MODE_ON) { g_PicViewer->getSize(pic_name.c_str(), &pic_width, &pic_height); if((pic_width > maxWidth) || (pic_height > maxHeight)) g_PicViewer->rescaleImageDimensions(&pic_width, &pic_height, maxWidth, maxHeight); @@ -850,9 +886,9 @@ void CComponentsPicture::paint(bool do_save_bg) pic_painted = false; if (do_paint){ - if (picMode == CC_PIC_ICON) + if (pic_paint_mode == CC_PIC_IMAGE_MODE_OFF) pic_painted = frameBuffer->paintIcon(pic_name, pic_x, pic_y, 0, pic_offset, pic_paint, pic_paintBg, col_body); - else + else if (pic_paint_mode == CC_PIC_IMAGE_MODE_ON) pic_painted = g_PicViewer->DisplayImage(pic_name, pic_x, pic_y, pic_width, pic_height); do_paint = false; } @@ -1080,7 +1116,7 @@ void CComponentsItemBox::paintImage(size_t index, bool newElement) pic = new CComponentsPicture( v_element_data[index].x, v_element_data[index].y, v_element_data[index].width, v_element_data[index].height, v_element_data[index].element); else - pic = new CComponentsPicture( v_element_data[index].x, v_element_data[index].y, v_element_data[index].element); + pic = new CComponentsPicture( v_element_data[index].x, v_element_data[index].y, 0, 0, v_element_data[index].element); v_element_data[index].handler1 = (void*)pic; } @@ -1448,18 +1484,53 @@ void CComponentsTitleBar::paint(bool do_save_bg) //------------------------------------------------------------------------------------------------------- -//sub class CComponentsForm from CComponentsItemBox +//sub class CComponentsForm from CComponentsItem CComponentsForm::CComponentsForm() { //CComponentsForm initVarForm(); } +CComponentsForm::CComponentsForm(const int x_pos, const int y_pos, const int w, const int h) +{ + //CComponentsForm + initVarForm(); + + //CComponents + x = x_pos; + y = y_pos; + width = w; + height = h; + +} + +CComponentsForm::CComponentsForm(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) +{ + //CComponentsForm + initVarForm(); + + //CComponents + x = x_pos; + y = y_pos; + width = w; + height = h; + + shadow = has_shadow; + col_frame = color_frame; + col_body = color_body; + col_shadow = color_shadow; +} + CComponentsForm::~CComponentsForm() { hide(); clearSavedScreen(); - delete tb; + for(size_t i=0; igetXPos(); + int ccy = v_cc_items[i]->getYPos(); - //init icon - if (!tb_icon.empty()) - tb->addIcon(tb_icon, CC_ALIGN_LEFT); + //set adapted position onto form + v_cc_items[i]->setXPos(x_tmp+ccx); + v_cc_items[i]->setYPos(y_tmp+ccy); - //init text - if (!tb_text.empty()) - tb->addText(tb_text, CC_ALIGN_LEFT); + //paint element without saved screen! + v_cc_items[i]->paint(CC_SAVE_SCREEN_NO); - int tbh = tb->getHeight(); - tb->setDimensionsAll(x, y, width, tbh); + //restore position + v_cc_items[i]->setXPos(ccx); + v_cc_items[i]->setYPos(ccy); } - - //paint titlebar - tb->paint(CC_SAVE_SCREEN_NO); -} - -void CComponentsForm::setCaption(const string& text) -{ - if (tb){ - delete tb; - tb = NULL; - } - tb_text = text; -} - -void CComponentsForm::setCaption(neutrino_locale_t locale_text) -{ - string tmptxt = g_Locale->getText(locale_text); - setCaption(tmptxt); } void CComponentsForm::hide(bool no_restore) @@ -1538,6 +1602,3 @@ void CComponentsForm::hide(bool no_restore) //hide body hideContainer(no_restore); } - - - From 1cbe655513ec2bd3b83cb1c859da5a77882a0668 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Thu, 1 Nov 2012 16:47:25 +0100 Subject: [PATCH 099/224] CTestMenu: add sample code for CComponentsForm --- src/gui/test_menu.cpp | 32 ++++++++++++++++++++++++++------ 1 file changed, 26 insertions(+), 6 deletions(-) diff --git a/src/gui/test_menu.cpp b/src/gui/test_menu.cpp index 8533cc18c..1461b6b69 100644 --- a/src/gui/test_menu.cpp +++ b/src/gui/test_menu.cpp @@ -346,7 +346,7 @@ int CTestMenu::exec(CMenuTarget* parent, const std::string &actionKey) } else if (actionKey == "picture"){ if (pic == NULL) - pic = new CComponentsPicture (100, 100, 200, 200, "/share/tuxbox/neutrino/icons/mp3-5.jpg"); + pic = new CComponentsPicture (100, 100, 200, 200, "/share/tuxbox/neutrino/icons/mp3-5.jpg", CC_PIC_IMAGE_MODE_AUTO); if (!pic->isPainted() && !pic->isPicPainted()) pic->paint(); @@ -367,12 +367,32 @@ int CTestMenu::exec(CMenuTarget* parent, const std::string &actionKey) else if (actionKey == "form"){ if (form == NULL) form = new CComponentsForm(); - form->setDimensionsAll(100, 100, 250, 300); - form->setCaption(NONEXISTANT_LOCALE); - form->setIcon(NEUTRINO_ICON_INFO); + form->setColorBody(COL_LIGHT_GRAY); + form->setDimensionsAll(100, 100, 250, 100); + + CComponentsPicture *ptmp = new CComponentsPicture(0, 0, 0, 0, NEUTRINO_ICON_BUTTON_YELLOW); + ptmp->setWidth(28); + ptmp->setHeight(28); + ptmp->setPictureAlign(CC_ALIGN_HOR_CENTER | CC_ALIGN_VER_CENTER); + ptmp->setColorBody(COL_BLUE); + ptmp->setCornerRadius(RADIUS_MID); + ptmp->setCornerType(CORNER_TOP_LEFT); + form->addCCItem(ptmp); + + CComponentsText *t1 = new CComponentsText(28, 0, 100, 28, "Text1", CTextBox::NO_AUTO_LINEBREAK); - if (form->isPainted()) + CComponentsText *t2 = new CComponentsText(t1->getXPos()+t1->getWidth(), 0, 100, 28, "Text2", CTextBox::NO_AUTO_LINEBREAK | CTextBox::RIGHT); + form->addCCItem(t1); + form->addCCItem(t2); + +// form->setCaption(NONEXISTANT_LOCALE); +// form->setIcon(NEUTRINO_ICON_INFO); + + if (form->isPainted()) { form->hide(); + delete form; + form = NULL; + } else form->paint(); return res; @@ -381,7 +401,7 @@ int CTestMenu::exec(CMenuTarget* parent, const std::string &actionKey) if (txt == NULL) txt = new CComponentsText(); txt->setDimensionsAll(100, 100, 250, 100); - txt->setText("This is a text for testing textbox", CTextBox::NO_AUTO_LINEBREAK); + txt->setText("This is a text for testing textbox", CTextBox::NO_AUTO_LINEBREAK); if (txt->isPainted()) txt->hide(); From de0dd6181208e5844e376ff93733bdb8b83290cb Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Thu, 1 Nov 2012 22:23:25 +0100 Subject: [PATCH 100/224] CComponentsForm: using better variable names in paintCCItems() --- src/gui/components/components.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/gui/components/components.cpp b/src/gui/components/components.cpp index ce1a235fd..86652c94b 100644 --- a/src/gui/components/components.cpp +++ b/src/gui/components/components.cpp @@ -1580,20 +1580,20 @@ void CComponentsForm::paintCCItems() // int h_tmp = (height-2*fr_thickness)/items_count; for(size_t i=0; igetXPos(); - int ccy = v_cc_items[i]->getYPos(); + //cache original item position + int x_item = v_cc_items[i]->getXPos(); + int y_item = v_cc_items[i]->getYPos(); //set adapted position onto form - v_cc_items[i]->setXPos(x_tmp+ccx); - v_cc_items[i]->setYPos(y_tmp+ccy); + v_cc_items[i]->setXPos(x_tmp+x_item); + v_cc_items[i]->setYPos(y_tmp+y_item); //paint element without saved screen! v_cc_items[i]->paint(CC_SAVE_SCREEN_NO); //restore position - v_cc_items[i]->setXPos(ccx); - v_cc_items[i]->setYPos(ccy); + v_cc_items[i]->setXPos(x_item); + v_cc_items[i]->setYPos(y_item); } } From a4cf4800f21d2fcfddaee5f3f614c4bf08ad18f4 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Fri, 2 Nov 2012 00:32:39 +0100 Subject: [PATCH 101/224] CComponents: add automaticaly cut of items with too large dimensions --- src/gui/components/components.cpp | 35 +++++++++++++++++++++---------- 1 file changed, 24 insertions(+), 11 deletions(-) diff --git a/src/gui/components/components.cpp b/src/gui/components/components.cpp index 86652c94b..6ca05080d 100644 --- a/src/gui/components/components.cpp +++ b/src/gui/components/components.cpp @@ -1574,26 +1574,39 @@ void CComponentsForm::paint(bool do_save_bg) void CComponentsForm::paintCCItems() { size_t items_count = v_cc_items.size(); - int x_tmp = x-fr_thickness; - int y_tmp = y-fr_thickness; -// int w_tmp = (width-2*fr_thickness)/items_count; -// int h_tmp = (height-2*fr_thickness)/items_count; + int x_tmp = x+fr_thickness; + int y_tmp = y+fr_thickness; + int xx = x+width-fr_thickness; //right form border + int yy = y+height-fr_thickness; //bottom form border + for(size_t i=0; igetXPos(); - int y_item = v_cc_items[i]->getYPos(); - + //cache original item position and dimensions + int x_item, y_item, w_item, h_item; + v_cc_items[i]->getDimensions(&x_item, &y_item, &w_item, &h_item); + //set adapted position onto form v_cc_items[i]->setXPos(x_tmp+x_item); v_cc_items[i]->setYPos(y_tmp+y_item); + //watch dimensions of items + int xx_item = v_cc_items[i]->getXPos()+w_item; //right item border + if (xx_item > xx){ + v_cc_items[i]->setWidth(w_item-(xx_item-xx)); + printf("[CComponentsForm] %s: item %d too large, definied width=%d, possible width=%d \n", __FUNCTION__, i, w_item, v_cc_items[i]->getWidth()); + } + + int yy_item = v_cc_items[i]->getYPos()+h_item; //bottom item border + if (yy_item > yy){ + v_cc_items[i]->setHeight(h_item-(yy_item-yy)); + printf("[CComponentsForm] %s: item %d too large, definied height=%d, possible height=%d \n", __FUNCTION__, i, h_item, v_cc_items[i]->getHeight()); + } + //paint element without saved screen! v_cc_items[i]->paint(CC_SAVE_SCREEN_NO); - //restore position - v_cc_items[i]->setXPos(x_item); - v_cc_items[i]->setYPos(y_item); + //restore dimensions and position + v_cc_items[i]->setDimensionsAll(x_item, y_item, w_item, h_item); } } From 023fe54841deef00930d9435b3bd19f7e8dbdd11 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Fri, 2 Nov 2012 00:33:47 +0100 Subject: [PATCH 102/224] CTestMenu: add more sample codes for cc-items --- src/gui/test_menu.cpp | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/src/gui/test_menu.cpp b/src/gui/test_menu.cpp index 1461b6b69..eefc2beaf 100644 --- a/src/gui/test_menu.cpp +++ b/src/gui/test_menu.cpp @@ -346,7 +346,7 @@ int CTestMenu::exec(CMenuTarget* parent, const std::string &actionKey) } else if (actionKey == "picture"){ if (pic == NULL) - pic = new CComponentsPicture (100, 100, 200, 200, "/share/tuxbox/neutrino/icons/mp3-5.jpg", CC_PIC_IMAGE_MODE_AUTO); + pic = new CComponentsPicture (100, 100, 200, 200, "/share/tuxbox/neutrino/icons/mp3-5.jpg"); if (!pic->isPainted() && !pic->isPicPainted()) pic->paint(); @@ -369,6 +369,8 @@ int CTestMenu::exec(CMenuTarget* parent, const std::string &actionKey) form = new CComponentsForm(); form->setColorBody(COL_LIGHT_GRAY); form->setDimensionsAll(100, 100, 250, 100); + form->setFrameThickness(2); + form->setColorFrame(COL_WHITE); CComponentsPicture *ptmp = new CComponentsPicture(0, 0, 0, 0, NEUTRINO_ICON_BUTTON_YELLOW); ptmp->setWidth(28); @@ -380,13 +382,16 @@ int CTestMenu::exec(CMenuTarget* parent, const std::string &actionKey) form->addCCItem(ptmp); CComponentsText *t1 = new CComponentsText(28, 0, 100, 28, "Text1", CTextBox::NO_AUTO_LINEBREAK); + form->addCCItem(t1); - CComponentsText *t2 = new CComponentsText(t1->getXPos()+t1->getWidth(), 0, 100, 28, "Text2", CTextBox::NO_AUTO_LINEBREAK | CTextBox::RIGHT); - form->addCCItem(t1); + CComponentsText *t2 = new CComponentsText(t1->getXPos()+t1->getWidth(), 0, 200, 50, "Text2", CTextBox::NO_AUTO_LINEBREAK | CTextBox::RIGHT); + t2->setCornerRadius(RADIUS_MID); + t2->setCornerType(CORNER_TOP_RIGHT); form->addCCItem(t2); - -// form->setCaption(NONEXISTANT_LOCALE); -// form->setIcon(NEUTRINO_ICON_INFO); + + CComponentsShapeCircle *c1 = new CComponentsShapeCircle(28, 40, 28); + c1->setColorBody(COL_RED); + form->addCCItem(c1); if (form->isPainted()) { form->hide(); From d84c968157c068df42b8ddcb49956b29188dc228 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Fri, 2 Nov 2012 00:38:49 +0100 Subject: [PATCH 103/224] CComponents: add define DEBUG_CC and some debug statements --- src/gui/components/components.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/gui/components/components.cpp b/src/gui/components/components.cpp index 6ca05080d..75358745c 100644 --- a/src/gui/components/components.cpp +++ b/src/gui/components/components.cpp @@ -35,6 +35,8 @@ #include +#define DEBUG_CC + extern cVideo * videoDecoder; extern CPictureViewer * g_PicViewer; @@ -849,7 +851,7 @@ void CComponentsPicture::initVarPicture() g_PicViewer->rescaleImageDimensions(&pic_width, &pic_height, maxWidth, maxHeight); } -#ifdef DEBUG +#ifdef DEBUG_CC if (pic_width == 0 || pic_height == 0) printf("CComponentsPicture: %s file: %s, no icon dimensions found! width = %d, height = %d\n", __FUNCTION__, pic_name.c_str(), pic_width, pic_height); #endif @@ -1593,13 +1595,17 @@ void CComponentsForm::paintCCItems() int xx_item = v_cc_items[i]->getXPos()+w_item; //right item border if (xx_item > xx){ v_cc_items[i]->setWidth(w_item-(xx_item-xx)); +#ifdef DEBUG_CC printf("[CComponentsForm] %s: item %d too large, definied width=%d, possible width=%d \n", __FUNCTION__, i, w_item, v_cc_items[i]->getWidth()); +#endif } int yy_item = v_cc_items[i]->getYPos()+h_item; //bottom item border if (yy_item > yy){ v_cc_items[i]->setHeight(h_item-(yy_item-yy)); +#ifdef DEBUG_CC printf("[CComponentsForm] %s: item %d too large, definied height=%d, possible height=%d \n", __FUNCTION__, i, h_item, v_cc_items[i]->getHeight()); +#endif } //paint element without saved screen! From 9601760137a53e7be7553a9a0cfb898d0c1b7300 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Fri, 2 Nov 2012 09:51:40 +0100 Subject: [PATCH 104/224] CComponentsForm: members become virtual Members of CComponentsForm will be used in sub classes. --- src/gui/components/cc.h | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/gui/components/cc.h b/src/gui/components/cc.h index 21e71cc80..5d28a242c 100644 --- a/src/gui/components/cc.h +++ b/src/gui/components/cc.h @@ -428,7 +428,6 @@ class CComponentsForm : public CComponentsItem protected: std::vector v_cc_items; void paintCCItems(); - private: void initVarForm(); public: @@ -438,9 +437,9 @@ class CComponentsForm : public CComponentsItem fb_pixel_t color_frame = COL_MENUCONTENT_PLUS_6, fb_pixel_t color_body = COL_MENUCONTENT_PLUS_0, fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0); ~CComponentsForm(); - void paint(bool do_save_bg = CC_SAVE_SCREEN_YES); - void hide(bool no_restore = false); - void addCCItem(CComponentsItem* cc_Item); + virtual void paint(bool do_save_bg = CC_SAVE_SCREEN_YES); + virtual void hide(bool no_restore = false); + virtual void addCCItem(CComponentsItem* cc_Item); }; #endif From d14b9903f92fc52299faefba88fc8b95cb073764 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Sun, 4 Nov 2012 17:20:48 +0100 Subject: [PATCH 105/224] CComponents: add new sub class CComponentsHeader() This should replace CComponentsTitleBar comming soon. TODO: - add additional icons, - fix frame painting with other corner types , but this is an issue in CFramebuffer. paintBoxFrame provides parameters for corner radius, but no corner types. --- src/gui/components/cc.h | 39 ++++++- src/gui/components/components.cpp | 171 ++++++++++++++++++++++++++++-- 2 files changed, 194 insertions(+), 16 deletions(-) diff --git a/src/gui/components/cc.h b/src/gui/components/cc.h index 5d28a242c..45ffcd599 100644 --- a/src/gui/components/cc.h +++ b/src/gui/components/cc.h @@ -239,7 +239,6 @@ class CComponentsText : public CComponentsItem void paintText(bool do_save_bg = CC_SAVE_SCREEN_YES); public: CComponentsText(); - CComponentsText(const char* text, const int mode = CTextBox::AUTO_WIDTH, Font* font_text = NULL); CComponentsText( const int x_pos, const int y_pos, const int w, const int h, const char* text = "", const int mode = CTextBox::AUTO_WIDTH, Font* font_text = NULL, bool has_shadow = CC_SHADOW_OFF, @@ -429,17 +428,47 @@ class CComponentsForm : public CComponentsItem std::vector v_cc_items; void paintCCItems(); void initVarForm(); + void clearCCForm(); public: CComponentsForm(); CComponentsForm(const int x_pos, const int y_pos, const int w, const int h); - CComponentsForm(const int x_pos, const int y_pos, const int w, const int h, bool has_shadow = CC_SHADOW_ON, + CComponentsForm(const int x_pos, const int y_pos, const int w, const int h, bool has_shadow = CC_SHADOW_OFF, fb_pixel_t color_frame = COL_MENUCONTENT_PLUS_6, fb_pixel_t color_body = COL_MENUCONTENT_PLUS_0, fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0); ~CComponentsForm(); - - virtual void paint(bool do_save_bg = CC_SAVE_SCREEN_YES); - virtual void hide(bool no_restore = false); + + void paint(bool do_save_bg = CC_SAVE_SCREEN_YES); + void hide(bool no_restore = false); virtual void addCCItem(CComponentsItem* cc_Item); }; +class CComponentsHeader : public CComponentsForm +{ + private: + CComponentsPicture * cch_icon_obj; + CComponentsText * cch_text_obj; + std::string cch_text; + const char* cch_icon_name; + neutrino_locale_t cch_locale_text; + fb_pixel_t cch_col_text; + Font* cch_font; + protected: + void initVarHeader(); + public: + + CComponentsHeader(); + CComponentsHeader(const int x_pos, const int y_pos, const int w, const int h = 0, const std::string& caption = "header", const char* icon_name = NULL, bool has_shadow = CC_SHADOW_OFF, + fb_pixel_t color_frame = COL_MENUCONTENT_PLUS_6, fb_pixel_t color_body = COL_MENUHEAD_PLUS_0, fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0); + CComponentsHeader(const int x_pos, const int y_pos, const int w, const int h = 0, neutrino_locale_t caption_locale = NONEXISTANT_LOCALE, const char* icon_name = NULL, bool has_shadow = CC_SHADOW_OFF, + fb_pixel_t color_frame = COL_MENUCONTENT_PLUS_6, fb_pixel_t color_body = COL_MENUHEAD_PLUS_0, fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0); + + ~CComponentsHeader(); + + void paint(bool do_save_bg = CC_SAVE_SCREEN_YES); + void setHeaderText(const std::string& caption); + void setHeaderText(neutrino_locale_t caption_locale); + void setColorHeaderBody(fb_pixel_t text_color){cch_col_text = text_color;}; + void setHeaderIcon(const char* icon_name); +}; + #endif diff --git a/src/gui/components/components.cpp b/src/gui/components/components.cpp index 75358745c..92bacad9e 100644 --- a/src/gui/components/components.cpp +++ b/src/gui/components/components.cpp @@ -271,16 +271,6 @@ CComponentsText::CComponentsText() initVarText(); } -CComponentsText::CComponentsText(const char* text, const int mode, Font* font_text) -{ - //CComponentsText - initVarText(); - - ct_text = text; - ct_text_mode = mode; - ct_font = font_text; -} - CComponentsText::CComponentsText( const int x_pos, const int y_pos, const int w, const int h, const char* text, const int mode, Font* font_text, bool has_shadow, @@ -1528,14 +1518,20 @@ CComponentsForm::~CComponentsForm() { hide(); clearSavedScreen(); + clearCCForm(); + clear(); +} + +void CComponentsForm::clearCCForm() +{ for(size_t i=0; i 0 ? h : g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]->getHeight(); + shadow = has_shadow; + col_frame = color_frame; + col_body = color_body; + col_shadow = color_shadow; + + cch_text = caption; + cch_icon_name = icon_name; +} + +CComponentsHeader::CComponentsHeader( const int x_pos, const int y_pos, const int w, const int h, neutrino_locale_t caption_locale, const char* icon_name, bool has_shadow, + fb_pixel_t color_frame, fb_pixel_t color_body, fb_pixel_t color_shadow) +{ + //CComponentsHeader + initVarHeader(); + + x = x_pos; + y = y_pos; + width = w; + height = h; + shadow = has_shadow; + col_frame = color_frame; + col_body = color_body; + col_shadow = color_shadow; + + cch_locale_text = caption_locale; + cch_icon_name = icon_name; +} + +CComponentsHeader::~CComponentsHeader() +{ + hide(); + clearSavedScreen(); + clearCCForm(); + + delete cch_icon_obj; + cch_icon_obj = NULL; + + delete cch_text_obj; + cch_text_obj = NULL; + + clear(); +} + +void CComponentsHeader::initVarHeader() +{ + //CComponentsHeader + cch_font = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]; + cch_icon_obj = NULL; + cch_text_obj = NULL; + cch_icon_name = NULL; + cch_text = "header"; + cch_locale_text = NONEXISTANT_LOCALE; + cch_col_text = COL_MENUHEAD; + + //CComponentsForm + initVarForm(); + height = cch_font->getHeight(); + + col_body = COL_MENUHEAD_PLUS_0; + corner_rad = RADIUS_LARGE, + corner_type = CORNER_TOP; + + +} + +void CComponentsHeader::setHeaderText(const std::string& caption) +{ + cch_text = caption; +} + +void CComponentsHeader::setHeaderText(neutrino_locale_t caption_locale) +{ + cch_text = g_Locale->getText(caption_locale); +} + +void CComponentsHeader::setHeaderIcon(const char* icon_name) +{ + cch_icon_name = icon_name; +} + +void CComponentsHeader::paint(bool do_save_bg) +{ + //paint body + paintInit(do_save_bg); + + int cch_items_y = 0; + + //init icon + if (cch_icon_obj){ + delete cch_icon_obj; + cch_icon_obj = NULL; + } + int cch_icon_x = 0; + if (cch_icon_name) + cch_icon_obj = new CComponentsPicture(cch_icon_x, cch_items_y, 0, 0, cch_icon_name); + cch_icon_obj->setWidth(48); + cch_icon_obj->setHeight(height); + cch_icon_obj->setPictureAlign(CC_ALIGN_HOR_CENTER | CC_ALIGN_VER_CENTER); + cch_icon_obj->setColorBody(col_body); + + //corner of icon item + cch_icon_obj->setCornerRadius(corner_rad-fr_thickness); + int cc_icon_corner_type = corner_type; + if (corner_type == CORNER_TOP_LEFT || corner_type == CORNER_TOP) + cc_icon_corner_type = CORNER_TOP_LEFT; + else + cc_icon_corner_type = CORNER_LEFT; + cch_icon_obj->setCornerType(cc_icon_corner_type); + + + //init text + if (cch_text_obj){ + delete cch_text_obj; + cch_text_obj = NULL; + } + int cch_text_x = cch_icon_x+cch_icon_obj->getWidth(); + cch_text_obj = new CComponentsText(cch_text_x, cch_items_y, width-cch_icon_obj->getWidth()-fr_thickness, height-2*fr_thickness, cch_text.c_str()); + cch_text_obj->setTextFont(cch_font); + cch_text_obj->setTextColor(cch_col_text); + cch_text_obj->setColorBody(col_body); + + //corner of text item + cch_text_obj->setCornerRadius(corner_rad-fr_thickness); + cch_text_obj->setCornerType(corner_type); + + //add elements + addCCItem(cch_icon_obj); + addCCItem(cch_text_obj); + + //paint + paintCCItems(); +} + + From e4c4a3347727f010581fe750ade40160629a8625 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Sun, 4 Nov 2012 17:21:41 +0100 Subject: [PATCH 106/224] CTextMenu: add sample code for CComponentsHeader --- src/gui/test_menu.cpp | 13 +++++++++++++ src/gui/test_menu.h | 1 + 2 files changed, 14 insertions(+) diff --git a/src/gui/test_menu.cpp b/src/gui/test_menu.cpp index eefc2beaf..b41d64490 100644 --- a/src/gui/test_menu.cpp +++ b/src/gui/test_menu.cpp @@ -68,6 +68,7 @@ CTestMenu::CTestMenu() pip = NULL; form = NULL; txt = NULL; + header = NULL; } CTestMenu::~CTestMenu() @@ -78,6 +79,7 @@ CTestMenu::~CTestMenu() delete pip; delete form; delete txt; + delete header; } int CTestMenu::exec(CMenuTarget* parent, const std::string &actionKey) @@ -414,6 +416,16 @@ int CTestMenu::exec(CMenuTarget* parent, const std::string &actionKey) txt->paint(); return res; } + else if (actionKey == "header"){ + if (header == NULL) + header = new CComponentsHeader (100, 100, 300, g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]->getHeight(), "Test-Header", NEUTRINO_ICON_INFO); + + if (!header->isPainted()) + header->paint(); + else + header->hide(); + return res; + } showTestMenu(); @@ -459,6 +471,7 @@ void CTestMenu::showCCTests(CMenuWidget *widget) widget->addItem(new CMenuForwarderNonLocalized("PiP", true, NULL, this, "pip")); widget->addItem(new CMenuForwarderNonLocalized("Form", true, NULL, this, "form")); widget->addItem(new CMenuForwarderNonLocalized("Text", true, NULL, this, "text")); + widget->addItem(new CMenuForwarderNonLocalized("Header", true, NULL, this, "header")); } void CTestMenu::showHWTests(CMenuWidget *widget) diff --git a/src/gui/test_menu.h b/src/gui/test_menu.h index 5612952d4..5a1b56e43 100644 --- a/src/gui/test_menu.h +++ b/src/gui/test_menu.h @@ -45,6 +45,7 @@ class CTestMenu : public CMenuTarget CComponentsPIP* pip; CComponentsForm *form; CComponentsText *txt; + CComponentsHeader *header; int width, selected; void showTestMenu(); From 1934ceef69766281f8df8bf0baec3590e60be25a Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Wed, 7 Nov 2012 23:17:34 +0100 Subject: [PATCH 107/224] CComponentsHeader: optimize allocations an deallocations for cc-items Bequeath of destructor from CComponentsForm into CCcomponentsHeader. clearCCItems() does already manage deallocations for cc-items, so some 'delete" calls are unnecessary. There was also the danger to overfill the cc-item vector with new added objects, if it is not have been cleaned previously in existing instances. --- src/gui/components/cc.h | 6 +++--- src/gui/components/components.cpp | 34 +++++++++++++------------------ 2 files changed, 17 insertions(+), 23 deletions(-) diff --git a/src/gui/components/cc.h b/src/gui/components/cc.h index 45ffcd599..5c70338a4 100644 --- a/src/gui/components/cc.h +++ b/src/gui/components/cc.h @@ -428,14 +428,14 @@ class CComponentsForm : public CComponentsItem std::vector v_cc_items; void paintCCItems(); void initVarForm(); - void clearCCForm(); + void clearCCItems(); public: CComponentsForm(); CComponentsForm(const int x_pos, const int y_pos, const int w, const int h); CComponentsForm(const int x_pos, const int y_pos, const int w, const int h, bool has_shadow = CC_SHADOW_OFF, fb_pixel_t color_frame = COL_MENUCONTENT_PLUS_6, fb_pixel_t color_body = COL_MENUCONTENT_PLUS_0, fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0); - ~CComponentsForm(); + virtual ~CComponentsForm(); void paint(bool do_save_bg = CC_SAVE_SCREEN_YES); void hide(bool no_restore = false); @@ -462,7 +462,7 @@ class CComponentsHeader : public CComponentsForm CComponentsHeader(const int x_pos, const int y_pos, const int w, const int h = 0, neutrino_locale_t caption_locale = NONEXISTANT_LOCALE, const char* icon_name = NULL, bool has_shadow = CC_SHADOW_OFF, fb_pixel_t color_frame = COL_MENUCONTENT_PLUS_6, fb_pixel_t color_body = COL_MENUHEAD_PLUS_0, fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0); - ~CComponentsHeader(); +// ~CComponentsHeader(); void paint(bool do_save_bg = CC_SAVE_SCREEN_YES); void setHeaderText(const std::string& caption); diff --git a/src/gui/components/components.cpp b/src/gui/components/components.cpp index 92bacad9e..f75bcd9e9 100644 --- a/src/gui/components/components.cpp +++ b/src/gui/components/components.cpp @@ -1516,16 +1516,20 @@ CComponentsForm::CComponentsForm(const int x_pos, const int y_pos, const int w, CComponentsForm::~CComponentsForm() { +#ifdef DEBUG_CC + printf("[CComponents] calling %s...\n", __FUNCTION__); +#endif hide(); clearSavedScreen(); - clearCCForm(); + clearCCItems(); clear(); } -void CComponentsForm::clearCCForm() +void CComponentsForm::clearCCItems() { for(size_t i=0; igetWidth(); cch_text_obj = new CComponentsText(cch_text_x, cch_items_y, width-cch_icon_obj->getWidth()-fr_thickness, height-2*fr_thickness, cch_text.c_str()); cch_text_obj->setTextFont(cch_font); @@ -1760,7 +1754,7 @@ void CComponentsHeader::paint(bool do_save_bg) //corner of text item cch_text_obj->setCornerRadius(corner_rad-fr_thickness); cch_text_obj->setCornerType(corner_type); - + //add elements addCCItem(cch_icon_obj); addCCItem(cch_text_obj); From d538e807d8a9537bf37eda031d25e4f9499bb928 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Fri, 9 Nov 2012 14:26:52 +0100 Subject: [PATCH 108/224] CCompnents: rename hideContainer into hideCCItem() --- src/gui/components/cc.h | 32 +++++++++++++++---------------- src/gui/components/components.cpp | 12 ++++++------ 2 files changed, 22 insertions(+), 22 deletions(-) diff --git a/src/gui/components/cc.h b/src/gui/components/cc.h index 5c70338a4..55fdf6233 100644 --- a/src/gui/components/cc.h +++ b/src/gui/components/cc.h @@ -114,6 +114,7 @@ class CComponents { protected: int x, y, height, width, corner_type, shadow_w; + int corner_rad, fr_thickness; CFrameBuffer * frameBuffer; std::vector v_fbdata; fb_pixel_t col_body, col_shadow, col_frame; @@ -151,22 +152,7 @@ class CComponents inline virtual fb_pixel_t getColorFrame(){return col_frame;}; inline virtual fb_pixel_t getColorBody(){return col_body;}; inline virtual fb_pixel_t getColorShadow(){return col_shadow;}; - - virtual void hide(); - virtual bool isPainted(){return is_painted;}; -}; - -class CComponentsItem : public CComponents -{ - protected: - int corner_rad, fr_thickness; - void hideContainer(bool no_restore = false); - void paintInit(bool do_save_bg); - void initVarItem(); - - public: - CComponentsItem(); - + /// set corner types: Possible corner types are defined in CFrameBuffer (see: driver/framebuffer.h). inline virtual void setCornerType(const int& type){corner_type = type;}; inline virtual void setCornerRadius(const int& radius){corner_rad = radius;}; @@ -176,7 +162,21 @@ class CComponentsItem : public CComponents inline virtual void setFrameThickness(const int& thickness){fr_thickness = thickness;}; inline virtual void setShadowOnOff(bool has_shadow){shadow = has_shadow;}; + + virtual void hide(); + virtual bool isPainted(){return is_painted;}; +}; +class CComponentsItem : public CComponents +{ + protected: + void hideCCItem(bool no_restore = false); + void paintInit(bool do_save_bg); + void initVarItem(); + + public: + CComponentsItem(); + virtual void paint(bool do_save_bg = CC_SAVE_SCREEN_YES) = 0; virtual void hide(bool no_restore = false); virtual void kill(); diff --git a/src/gui/components/components.cpp b/src/gui/components/components.cpp index f75bcd9e9..3d5bdef78 100644 --- a/src/gui/components/components.cpp +++ b/src/gui/components/components.cpp @@ -211,7 +211,7 @@ void CComponentsItem::paintInit(bool do_save_bg) //restore last saved screen behind form box, //Do use parameter 'no restore' to override temporarly the restore funtionality. //This could help to avoid ugly flicker efffects if it is necessary e.g. on often repaints, without changed contents. -void CComponentsItem::hideContainer(bool no_restore) +void CComponentsItem::hideCCItem(bool no_restore) { is_painted = false; @@ -227,7 +227,7 @@ void CComponentsItem::hideContainer(bool no_restore) void CComponentsItem::hide(bool no_restore) { - hideContainer(no_restore); + hideCCItem(no_restore); } @@ -400,7 +400,7 @@ void CComponentsText::hide(bool no_restore) { if (ct_textbox) ct_textbox->hide(); - hideContainer(no_restore); + hideCCItem(no_restore); } //small helper to remove excessiv linbreaks @@ -751,7 +751,7 @@ void CComponentsPIP::paint(bool do_save_bg) void CComponentsPIP::hide(bool no_restore) { - hideContainer(no_restore); + hideCCItem(no_restore); videoDecoder->Pig(-1, -1, -1, -1); } @@ -888,7 +888,7 @@ void CComponentsPicture::paint(bool do_save_bg) void CComponentsPicture::hide(bool no_restore) { - hideContainer(no_restore); + hideCCItem(no_restore); pic_painted = false; } @@ -1619,7 +1619,7 @@ void CComponentsForm::paintCCItems() void CComponentsForm::hide(bool no_restore) { //hide body - hideContainer(no_restore); + hideCCItem(no_restore); } //------------------------------------------------------------------------------------------------------- From 4450984597ff6b40f70e194d55db5c5a27abb876 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Fri, 9 Nov 2012 15:31:17 +0100 Subject: [PATCH 109/224] CComponents: init ccitem vars in initVarBasic() --- src/gui/components/components.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/gui/components/components.cpp b/src/gui/components/components.cpp index 3d5bdef78..d44f0ea5f 100644 --- a/src/gui/components/components.cpp +++ b/src/gui/components/components.cpp @@ -73,9 +73,11 @@ void CComponents::initVarBasic() col_shadow = COL_MENUCONTENTDARK_PLUS_0; col_frame = COL_MENUCONTENT_PLUS_6; corner_type = CORNER_ALL; + corner_rad = 0; shadow = CC_SHADOW_OFF; shadow_w = SHADOW_OFFSET; - + fr_thickness = 0; + firstPaint = true; is_painted = false; frameBuffer = CFrameBuffer::getInstance(); @@ -181,10 +183,6 @@ void CComponentsItem::initVarItem() { //CComponents initVarBasic(); - - //CComponentsItem - corner_rad = 0; - fr_thickness = 0; } void CComponentsItem::paintInit(bool do_save_bg) From 75fbc082694b9a3373e59870b224a116698e784e Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Fri, 9 Nov 2012 23:08:55 +0100 Subject: [PATCH 110/224] CComponents: add option paint_bg and apply in CComponentsHeader --- src/gui/components/cc.h | 11 ++++++----- src/gui/components/components.cpp | 12 ++++++++++-- 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/src/gui/components/cc.h b/src/gui/components/cc.h index 55fdf6233..665149228 100644 --- a/src/gui/components/cc.h +++ b/src/gui/components/cc.h @@ -118,8 +118,8 @@ class CComponents CFrameBuffer * frameBuffer; std::vector v_fbdata; fb_pixel_t col_body, col_shadow, col_frame; - bool firstPaint, shadow, is_painted; - + bool firstPaint, shadow, is_painted, paint_bg; + void initVarBasic(); void paintFbItems(bool do_save_bg = true); fb_pixel_t* getScreen(int ax, int ay, int dx, int dy); @@ -164,16 +164,17 @@ class CComponents inline virtual void setShadowOnOff(bool has_shadow){shadow = has_shadow;}; virtual void hide(); - virtual bool isPainted(){return is_painted;}; + virtual bool isPainted(){return is_painted;} + virtual void doPaintBg(bool do_paint){paint_bg = do_paint;}; }; class CComponentsItem : public CComponents { - protected: + protected: void hideCCItem(bool no_restore = false); void paintInit(bool do_save_bg); void initVarItem(); - + public: CComponentsItem(); diff --git a/src/gui/components/components.cpp b/src/gui/components/components.cpp index d44f0ea5f..126f3cc51 100644 --- a/src/gui/components/components.cpp +++ b/src/gui/components/components.cpp @@ -80,6 +80,7 @@ void CComponents::initVarBasic() firstPaint = true; is_painted = false; + paint_bg = true; frameBuffer = CFrameBuffer::getInstance(); v_fbdata.clear(); saved_screen.pixbuf = NULL; @@ -185,10 +186,16 @@ void CComponentsItem::initVarItem() initVarBasic(); } +// Paint container background in cc-items with shadow, background and frame. +// This member must be called first in all paint() members before paint other items into the container. +// If backround is not required, it's possible to override this with variable paint_bg=false, use doPaintBg(true/false) to set this! void CComponentsItem::paintInit(bool do_save_bg) { clear(); + if(!paint_bg) + return; + int sw = shadow ? shadow_w : 0; int th = fr_thickness; @@ -391,6 +398,7 @@ void CComponentsText::paintText(bool do_save_bg) void CComponentsText::paint(bool do_save_bg) { + paintText(do_save_bg); } @@ -1730,7 +1738,7 @@ void CComponentsHeader::paint(bool do_save_bg) cch_icon_obj->setWidth(48); cch_icon_obj->setHeight(height); cch_icon_obj->setPictureAlign(CC_ALIGN_HOR_CENTER | CC_ALIGN_VER_CENTER); - cch_icon_obj->setColorBody(col_body); + cch_icon_obj->doPaintBg(false); //corner of icon item cch_icon_obj->setCornerRadius(corner_rad-fr_thickness); @@ -1747,7 +1755,7 @@ void CComponentsHeader::paint(bool do_save_bg) cch_text_obj = new CComponentsText(cch_text_x, cch_items_y, width-cch_icon_obj->getWidth()-fr_thickness, height-2*fr_thickness, cch_text.c_str()); cch_text_obj->setTextFont(cch_font); cch_text_obj->setTextColor(cch_col_text); - cch_text_obj->setColorBody(col_body); + cch_text_obj->doPaintBg(false); //corner of text item cch_text_obj->setCornerRadius(corner_rad-fr_thickness); From 4db5c450a4ddc2e95bc1d5f1e9d6d5fe1d5509be Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Fri, 9 Nov 2012 23:16:55 +0100 Subject: [PATCH 111/224] CTextBox: don't hide if m_nPaintBackground is set to false Required in CCompmonentsText. Hide of textbox object is unnecessary in CCompmonentsText objects. --- src/gui/widget/textbox.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/gui/widget/textbox.cpp b/src/gui/widget/textbox.cpp index 47b5d0c4c..ba565c799 100644 --- a/src/gui/widget/textbox.cpp +++ b/src/gui/widget/textbox.cpp @@ -640,6 +640,8 @@ void CTextBox::hide (void) if(frameBuffer == NULL) return; - frameBuffer->paintBackgroundBoxRel(m_cFrame.iX, m_cFrame.iY, m_cFrame.iWidth, m_cFrame.iHeight); + if (m_nPaintBackground) + frameBuffer->paintBackgroundBoxRel(m_cFrame.iX, m_cFrame.iY, m_cFrame.iWidth, m_cFrame.iHeight); + frameBuffer = NULL; } From 6bdd8cd771d293219a0d1fc9b960bd16c1c3b8e9 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Fri, 9 Nov 2012 23:26:39 +0100 Subject: [PATCH 112/224] CComponentsHeader: use height of header as default height for icon space --- src/gui/components/components.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/components/components.cpp b/src/gui/components/components.cpp index 126f3cc51..5bc97c33a 100644 --- a/src/gui/components/components.cpp +++ b/src/gui/components/components.cpp @@ -1735,7 +1735,7 @@ void CComponentsHeader::paint(bool do_save_bg) int cch_icon_x = 0; if (cch_icon_name) cch_icon_obj = new CComponentsPicture(cch_icon_x, cch_items_y, 0, 0, cch_icon_name); - cch_icon_obj->setWidth(48); + cch_icon_obj->setWidth(height-2*fr_thickness); cch_icon_obj->setHeight(height); cch_icon_obj->setPictureAlign(CC_ALIGN_HOR_CENTER | CC_ALIGN_VER_CENTER); cch_icon_obj->doPaintBg(false); From 8061b2938f0c29abbe53f5d2029b1a7d101ebadd Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Fri, 9 Nov 2012 23:53:35 +0100 Subject: [PATCH 113/224] CComponentsHeader: init code for icon and text outsource slim down of paint() --- src/gui/components/cc.h | 6 +++++ src/gui/components/components.cpp | 40 ++++++++++++++++++------------- 2 files changed, 30 insertions(+), 16 deletions(-) diff --git a/src/gui/components/cc.h b/src/gui/components/cc.h index 665149228..7195f3522 100644 --- a/src/gui/components/cc.h +++ b/src/gui/components/cc.h @@ -453,8 +453,14 @@ class CComponentsHeader : public CComponentsForm neutrino_locale_t cch_locale_text; fb_pixel_t cch_col_text; Font* cch_font; + int cch_icon_x, cch_items_y; + + void initCCHeaderIcon(); + void initCCHeaderText(); + protected: void initVarHeader(); + public: CComponentsHeader(); diff --git a/src/gui/components/components.cpp b/src/gui/components/components.cpp index 5bc97c33a..42eebb43c 100644 --- a/src/gui/components/components.cpp +++ b/src/gui/components/components.cpp @@ -1694,6 +1694,8 @@ void CComponentsHeader::initVarHeader() cch_text = "header"; cch_locale_text = NONEXISTANT_LOCALE; cch_col_text = COL_MENUHEAD; + cch_items_y = 0; + cch_icon_x = 0; //CComponentsForm initVarForm(); @@ -1721,25 +1723,15 @@ void CComponentsHeader::setHeaderIcon(const char* icon_name) cch_icon_name = icon_name; } -void CComponentsHeader::paint(bool do_save_bg) +void CComponentsHeader::initCCHeaderIcon() { - //paint body - paintInit(do_save_bg); - - int cch_items_y = 0; - - //clean up first possible old item objects, includes delete and clean up vector - clearCCItems(); - - //init icon - int cch_icon_x = 0; if (cch_icon_name) cch_icon_obj = new CComponentsPicture(cch_icon_x, cch_items_y, 0, 0, cch_icon_name); cch_icon_obj->setWidth(height-2*fr_thickness); cch_icon_obj->setHeight(height); cch_icon_obj->setPictureAlign(CC_ALIGN_HOR_CENTER | CC_ALIGN_VER_CENTER); cch_icon_obj->doPaintBg(false); - + //corner of icon item cch_icon_obj->setCornerRadius(corner_rad-fr_thickness); int cc_icon_corner_type = corner_type; @@ -1748,18 +1740,34 @@ void CComponentsHeader::paint(bool do_save_bg) else cc_icon_corner_type = CORNER_LEFT; cch_icon_obj->setCornerType(cc_icon_corner_type); - - - //init text +} + +void CComponentsHeader::initCCHeaderText() +{ int cch_text_x = cch_icon_x+cch_icon_obj->getWidth(); cch_text_obj = new CComponentsText(cch_text_x, cch_items_y, width-cch_icon_obj->getWidth()-fr_thickness, height-2*fr_thickness, cch_text.c_str()); cch_text_obj->setTextFont(cch_font); cch_text_obj->setTextColor(cch_col_text); cch_text_obj->doPaintBg(false); - + //corner of text item cch_text_obj->setCornerRadius(corner_rad-fr_thickness); cch_text_obj->setCornerType(corner_type); +} + +void CComponentsHeader::paint(bool do_save_bg) +{ + //paint body + paintInit(do_save_bg); + + //clean up first possible old item objects, includes delete and clean up vector + clearCCItems(); + + //init icon + initCCHeaderIcon(); + + //init text + initCCHeaderText(); //add elements addCCItem(cch_icon_obj); From a5adaf854ac324b952a99abf5a39f39f0e77fc26 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Sat, 10 Nov 2012 17:23:50 +0100 Subject: [PATCH 114/224] CComponentsPicture: rework parameter handling Not shure if pic_max_h/w could still make problems in while usage of CComponentsPicture, we will see... --- src/gui/components/cc.h | 6 ++++-- src/gui/components/components.cpp | 26 ++++++++++++++++++-------- 2 files changed, 22 insertions(+), 10 deletions(-) diff --git a/src/gui/components/cc.h b/src/gui/components/cc.h index 7195f3522..d34554f07 100644 --- a/src/gui/components/cc.h +++ b/src/gui/components/cc.h @@ -199,14 +199,14 @@ class CComponentsPicture : public CComponentsItem unsigned char pic_offset; bool pic_paint, pic_paintBg, pic_painted, do_paint; int pic_align, pic_x, pic_y, pic_width, pic_height; - int maxWidth, maxHeight, pic_paint_mode; + int pic_max_w, pic_max_h, pic_paint_mode; void initVarPicture(); void init( const int x_pos, const int y_pos, 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); public: - CComponentsPicture( const int x_pos, const int y_pos, const int w_max, const int h_max, + 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, fb_pixel_t color_frame = COL_MENUCONTENT_PLUS_6, fb_pixel_t color_background = 0, fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0); @@ -220,6 +220,8 @@ class CComponentsPicture : public CComponentsItem void paint(bool do_save_bg = CC_SAVE_SCREEN_YES); void hide(bool no_restore = false); inline void getPictureSize(int *pwidth, int *pheight){*pwidth=pic_width; *pheight=pic_height;}; + void setMaxWidth(const int w_max){pic_max_w = w_max;}; + void setMaxHeight(const int h_max){pic_max_h = h_max;}; }; class CComponentsText : public CComponentsItem diff --git a/src/gui/components/components.cpp b/src/gui/components/components.cpp index 42eebb43c..66ab847bf 100644 --- a/src/gui/components/components.cpp +++ b/src/gui/components/components.cpp @@ -764,14 +764,14 @@ void CComponentsPIP::hide(bool no_restore) //------------------------------------------------------------------------------------------------------- //sub class CComponentsPicture from CComponentsItem -CComponentsPicture::CComponentsPicture( const int x_pos, const int y_pos, const int w_max, const int h_max, +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, 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); - maxWidth = w_max; - maxHeight = h_max; + width = w; + height = h; pic_paint_mode = CC_PIC_IMAGE_MODE_AUTO, initVarPicture(); @@ -791,6 +791,8 @@ void CComponentsPicture::init( int x_pos, int y_pos, const string& image_name, c pic_paintBg = false; pic_painted = false; do_paint = false; + pic_max_w = 0; + pic_max_h = 0; if (pic_name.empty()) pic_width = pic_height = 0; @@ -826,6 +828,12 @@ void CComponentsPicture::initVarPicture() pic_painted = false; do_paint = false; + if (pic_max_w == 0) + pic_max_w = width-2*fr_thickness; + + if (pic_max_h == 0) + pic_max_h = height-2*fr_thickness; + //set the image mode depends of name syntax, icon names contains no path, //so we can detect the required image mode if (pic_paint_mode == CC_PIC_IMAGE_MODE_AUTO){ @@ -837,14 +845,16 @@ void CComponentsPicture::initVarPicture() if (pic_paint_mode == CC_PIC_IMAGE_MODE_OFF){ frameBuffer->getIconSize(pic_name.c_str(), &pic_width, &pic_height); - pic_width = max(pic_width, maxWidth); - pic_height = max(pic_height, maxHeight); +#if 0 + pic_width = max(pic_width, pic_max_w); + pic_height = max(pic_height, pic_max_h); +#endif } if (pic_paint_mode == CC_PIC_IMAGE_MODE_ON) { g_PicViewer->getSize(pic_name.c_str(), &pic_width, &pic_height); - if((pic_width > maxWidth) || (pic_height > maxHeight)) - g_PicViewer->rescaleImageDimensions(&pic_width, &pic_height, maxWidth, maxHeight); + if((pic_width > pic_max_w) || (pic_height > pic_max_h)) + g_PicViewer->rescaleImageDimensions(&pic_width, &pic_height, pic_max_w, pic_max_h); } #ifdef DEBUG_CC @@ -885,7 +895,7 @@ void CComponentsPicture::paint(bool do_save_bg) if (do_paint){ if (pic_paint_mode == CC_PIC_IMAGE_MODE_OFF) - pic_painted = frameBuffer->paintIcon(pic_name, pic_x, pic_y, 0, pic_offset, pic_paint, pic_paintBg, col_body); + pic_painted = frameBuffer->paintIcon(pic_name, pic_x, pic_y, 0 /*pic_max_h*/, pic_offset, pic_paint, pic_paintBg, col_body); else if (pic_paint_mode == CC_PIC_IMAGE_MODE_ON) pic_painted = g_PicViewer->DisplayImage(pic_name, pic_x, pic_y, pic_width, pic_height); do_paint = false; From dd91340a3715270a69fc056a76460ee06c06d916 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Sat, 10 Nov 2012 20:54:24 +0100 Subject: [PATCH 115/224] CComponentsForm: paintCCItems() is needed as public member --- src/gui/components/cc.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gui/components/cc.h b/src/gui/components/cc.h index d34554f07..48cac5c50 100644 --- a/src/gui/components/cc.h +++ b/src/gui/components/cc.h @@ -428,8 +428,7 @@ class CComponentsTitleBar : public CComponentsItemBox class CComponentsForm : public CComponentsItem { protected: - std::vector v_cc_items; - void paintCCItems(); + std::vector v_cc_items; void initVarForm(); void clearCCItems(); public: @@ -443,6 +442,7 @@ class CComponentsForm : public CComponentsItem void paint(bool do_save_bg = CC_SAVE_SCREEN_YES); void hide(bool no_restore = false); virtual void addCCItem(CComponentsItem* cc_Item); + virtual void paintCCItems(); }; class CComponentsHeader : public CComponentsForm From 0dbddbc4832167e2082de558ead9386082411c38 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Sat, 10 Nov 2012 21:06:09 +0100 Subject: [PATCH 116/224] CComponentsForm: remove constructor Call of overloaded 'CComponentsForm(int, int, int, int)' is ambiguous. --- src/gui/components/cc.h | 1 - src/gui/components/components.cpp | 13 ------------- 2 files changed, 14 deletions(-) diff --git a/src/gui/components/cc.h b/src/gui/components/cc.h index 48cac5c50..38ed9c476 100644 --- a/src/gui/components/cc.h +++ b/src/gui/components/cc.h @@ -434,7 +434,6 @@ class CComponentsForm : public CComponentsItem public: CComponentsForm(); - CComponentsForm(const int x_pos, const int y_pos, const int w, const int h); CComponentsForm(const int x_pos, const int y_pos, const int w, const int h, bool has_shadow = CC_SHADOW_OFF, fb_pixel_t color_frame = COL_MENUCONTENT_PLUS_6, fb_pixel_t color_body = COL_MENUCONTENT_PLUS_0, fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0); virtual ~CComponentsForm(); diff --git a/src/gui/components/components.cpp b/src/gui/components/components.cpp index 66ab847bf..04d523215 100644 --- a/src/gui/components/components.cpp +++ b/src/gui/components/components.cpp @@ -1499,19 +1499,6 @@ CComponentsForm::CComponentsForm() initVarForm(); } -CComponentsForm::CComponentsForm(const int x_pos, const int y_pos, const int w, const int h) -{ - //CComponentsForm - initVarForm(); - - //CComponents - x = x_pos; - y = y_pos; - width = w; - height = h; - -} - CComponentsForm::CComponentsForm(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) { From 6ee87b95ec3d7ec1843c889fb744c0a6c06f493c Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Sat, 10 Nov 2012 21:16:08 +0100 Subject: [PATCH 117/224] CComponentsHeader: add private member variable cch_text_x --- src/gui/components/cc.h | 3 +-- src/gui/components/components.cpp | 7 ++++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/gui/components/cc.h b/src/gui/components/cc.h index 38ed9c476..509a16523 100644 --- a/src/gui/components/cc.h +++ b/src/gui/components/cc.h @@ -454,7 +454,7 @@ class CComponentsHeader : public CComponentsForm neutrino_locale_t cch_locale_text; fb_pixel_t cch_col_text; Font* cch_font; - int cch_icon_x, cch_items_y; + int cch_icon_x, cch_items_y, cch_text_x; void initCCHeaderIcon(); void initCCHeaderText(); @@ -463,7 +463,6 @@ class CComponentsHeader : public CComponentsForm void initVarHeader(); public: - CComponentsHeader(); CComponentsHeader(const int x_pos, const int y_pos, const int w, const int h = 0, const std::string& caption = "header", const char* icon_name = NULL, bool has_shadow = CC_SHADOW_OFF, fb_pixel_t color_frame = COL_MENUCONTENT_PLUS_6, fb_pixel_t color_body = COL_MENUHEAD_PLUS_0, fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0); diff --git a/src/gui/components/components.cpp b/src/gui/components/components.cpp index 04d523215..9f76878bb 100644 --- a/src/gui/components/components.cpp +++ b/src/gui/components/components.cpp @@ -1693,6 +1693,7 @@ void CComponentsHeader::initVarHeader() cch_col_text = COL_MENUHEAD; cch_items_y = 0; cch_icon_x = 0; + cch_text_x = 0; //CComponentsForm initVarForm(); @@ -1741,7 +1742,7 @@ void CComponentsHeader::initCCHeaderIcon() void CComponentsHeader::initCCHeaderText() { - int cch_text_x = cch_icon_x+cch_icon_obj->getWidth(); + cch_text_x = cch_icon_x+cch_icon_obj->getWidth(); cch_text_obj = new CComponentsText(cch_text_x, cch_items_y, width-cch_icon_obj->getWidth()-fr_thickness, height-2*fr_thickness, cch_text.c_str()); cch_text_obj->setTextFont(cch_font); cch_text_obj->setTextColor(cch_col_text); @@ -1762,10 +1763,10 @@ void CComponentsHeader::paint(bool do_save_bg) //init icon initCCHeaderIcon(); - + //init text initCCHeaderText(); - + //add elements addCCItem(cch_icon_obj); addCCItem(cch_text_obj); From 84fe7cf1342f3964d1460ab4eba58f1b9deb2d47 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Mon, 12 Nov 2012 10:31:52 +0100 Subject: [PATCH 118/224] CComponents: add sub class CComponentsIconForm based upon CComponentsForm Collects only icons.You can add icons step by step or with a vector and paint the form at once. Width and height are dynamic calculated if parameters width or height are smaller then summary of lenght of all added icons. It's also possible to manipulate the icon array with members: - insertIcon() - removeIcon() - removeAllIcons() TODO: support for resizable images --- src/gui/components/cc.h | 29 ++++++ src/gui/components/components.cpp | 141 +++++++++++++++++++++++++++++- 2 files changed, 167 insertions(+), 3 deletions(-) diff --git a/src/gui/components/cc.h b/src/gui/components/cc.h index 509a16523..282ca76f9 100644 --- a/src/gui/components/cc.h +++ b/src/gui/components/cc.h @@ -102,6 +102,7 @@ typedef struct comp_element_data_t void* handler2; }comp_element_data_struct_t; + #define CC_WIDTH_MIN 16 #define CC_HEIGHT_MIN 16 #define CC_SHADOW_ON true @@ -478,4 +479,32 @@ class CComponentsHeader : public CComponentsForm void setHeaderIcon(const char* icon_name); }; +class CComponentsIconForm : public CComponentsForm +{ + private: + std::vector v_icons; + int ccif_offset; + + protected: + void initVarIconForm(); + + public: + CComponentsIconForm(); + CComponentsIconForm(const int x_pos, const int y_pos, const int w, const int h, const std::vector v_icon_names, bool has_shadow = CC_SHADOW_OFF, + fb_pixel_t color_frame = COL_MENUCONTENT_PLUS_6, fb_pixel_t color_body = COL_MENUHEAD_PLUS_0, fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0); + + void paint(bool do_save_bg = CC_SAVE_SCREEN_YES); + void initCCIcons(); + void addIcon(const std::string& icon_name); + void addIcon(std::vector icon_name); + void removeIcons(){v_icons.clear();}; + void insertIcon(const uint& icon_id, const std::string& icon_name); + void removeIcon(const uint& icon_id); + void removeIcon(const std::string& icon_name); + void removeAllIcons(); + int getIconId(const std::string& icon_name); + + void setIconOffset(const int offset){ccif_offset = offset;}; +}; + #endif diff --git a/src/gui/components/components.cpp b/src/gui/components/components.cpp index 9f76878bb..b8e1143be 100644 --- a/src/gui/components/components.cpp +++ b/src/gui/components/components.cpp @@ -1530,6 +1530,9 @@ CComponentsForm::~CComponentsForm() void CComponentsForm::clearCCItems() { + if (v_cc_items.empty()) + return; + for(size_t i=0; i v_icon_names, bool has_shadow, + fb_pixel_t color_frame, fb_pixel_t color_body, fb_pixel_t color_shadow) +{ + initVarIconForm(); + + x = x_pos; + y = y_pos; + width = w; + height = h; + shadow = has_shadow; + col_frame = color_frame; + col_body = color_body; + col_shadow = color_shadow; + + v_icons = v_icon_names; +} + +void CComponentsIconForm::initVarIconForm() +{ + //CComponentsForm + initVarForm(); + + //set default width and height to 0, this causes a dynamic adaptation of width and height of form + width = 0; + height = 0; + + v_icons.clear(); + ccif_offset = 2; +} + +void CComponentsIconForm::addIcon(const std::string& icon_name) +{ + v_icons.push_back(icon_name); +} + +void CComponentsIconForm::addIcon(std::vector icon_name) +{ + for (size_t i= 0; i< icon_name.size(); i++) + v_icons.push_back(icon_name[i]); +} + +void CComponentsIconForm::insertIcon(const uint& icon_id, const std::string& icon_name) +{ + v_icons.insert(v_icons.begin()+icon_id, icon_name); +} + +void CComponentsIconForm::removeIcon(const uint& icon_id) +{ + v_icons.erase(v_icons.begin()+icon_id); +} + +void CComponentsIconForm::removeIcon(const std::string& icon_name) +{ + int id = getIconId(icon_name); + removeIcon(id); +} + +int CComponentsIconForm::getIconId(const std::string& icon_name) +{ + for (size_t i= 0; i< v_icons.size(); i++) + if (v_icons[i] == icon_name) + return i; + return -1; +} + +//For existing instances it's recommended +//to remove old items before add new icons, otherwise icons will be appended. +void CComponentsIconForm::removeAllIcons() +{ + clearCCItems(); + if (!v_icons.empty()) + v_icons.clear(); +} + +void CComponentsIconForm::initCCIcons() +{ + //clean up first possible old item objects, includes delete and clean up vector and icons + clearCCItems(); + + int ccp_x = 0+fr_thickness; + int ccp_y = 0; + int ccp_w = 0; + int ccp_h = 0; + + //detect maximal form height + int h = height; + for (size_t i= 0; i< v_icons.size(); i++){ + frameBuffer->getIconSize(v_icons[i].c_str(), &ccp_w, &ccp_h); + h = max(ccp_h, h)/*+2*fr_thickness*/; + } + + //init and add item objects + for (size_t i= 0; i< v_icons.size(); i++){ + frameBuffer->getIconSize(v_icons[i].c_str(), &ccp_w, &ccp_h); + + CComponentsPicture *ccp = NULL; + ccp = new CComponentsPicture(ccp_x, ccp_y, ccp_w, h, v_icons[i]); + ccp->setPictureAlign(CC_ALIGN_HOR_CENTER | CC_ALIGN_VER_CENTER); + ccp->doPaintBg(false); + + addCCItem(ccp); + + ccp_x += ccif_offset + ccp_w; + } + + //calculate form width and height + int w_tmp = 0; + int h_tmp = 0; + for (size_t i= 0; i< v_cc_items.size(); i++){ + w_tmp += v_cc_items[i]->getWidth()+ccif_offset+fr_thickness; + h_tmp = max(h_tmp, v_cc_items[i]->getHeight()+2*fr_thickness); + } + width = max(w_tmp, width)-ccif_offset; //terminate last offset + height = max(h_tmp, height); +} + +void CComponentsIconForm::paint(bool do_save_bg) +{ + //init and add icons + initCCIcons(); + + //paint body + paintInit(do_save_bg); + + //paint + paintCCItems(); +} From b251e2a0015dc1a0d5dac76f9166375ad41f95b6 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Mon, 12 Nov 2012 10:33:14 +0100 Subject: [PATCH 119/224] CTestMenu: add sample code for class CComponentsIconForm --- src/gui/test_menu.cpp | 44 ++++++++++++++++++++++++++++++++++++++++++- src/gui/test_menu.h | 3 ++- 2 files changed, 45 insertions(+), 2 deletions(-) diff --git a/src/gui/test_menu.cpp b/src/gui/test_menu.cpp index b41d64490..c9992a55b 100644 --- a/src/gui/test_menu.cpp +++ b/src/gui/test_menu.cpp @@ -69,6 +69,7 @@ CTestMenu::CTestMenu() form = NULL; txt = NULL; header = NULL; + iconform = NULL; } CTestMenu::~CTestMenu() @@ -80,6 +81,7 @@ CTestMenu::~CTestMenu() delete form; delete txt; delete header; + delete iconform; } int CTestMenu::exec(CMenuTarget* parent, const std::string &actionKey) @@ -418,7 +420,10 @@ int CTestMenu::exec(CMenuTarget* parent, const std::string &actionKey) } else if (actionKey == "header"){ if (header == NULL) - header = new CComponentsHeader (100, 100, 300, g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]->getHeight(), "Test-Header", NEUTRINO_ICON_INFO); + header = new CComponentsHeader (100, 50, 480, g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]->getHeight(), "Test-Header", NEUTRINO_ICON_INFO); +// header->setFrameThickness(5); +// header->setColorFrame(COL_WHITE); +// header->setCornerType(CORNER_TOP); if (!header->isPainted()) header->paint(); @@ -426,6 +431,42 @@ int CTestMenu::exec(CMenuTarget* parent, const std::string &actionKey) header->hide(); return res; } + else if (actionKey == "iconform"){ + if (iconform == NULL) + iconform = new CComponentsIconForm(); + iconform->setColorBody(COL_LIGHT_GRAY); + iconform->setDimensionsAll(100, 100, 0, 60); + iconform->setFrameThickness(2); + iconform->setColorFrame(COL_WHITE); + iconform->setIconOffset(5); + //For existing instances it's recommended + //to remove old items before add new icons, otherwise icons will be appended. + iconform->removeAllIcons(); + + //you can... + //add icons step by step + iconform->addIcon(NEUTRINO_ICON_INFO); + iconform->addIcon(NEUTRINO_ICON_INFO); + iconform->addIcon(NEUTRINO_ICON_HINT_MEDIA); + //...or + //add icons with vector + std::vector v_icons; + v_icons.push_back(NEUTRINO_ICON_HINT_VIDEO); + v_icons.push_back(NEUTRINO_ICON_HINT_AUDIO); + iconform->addIcon(v_icons); + + //insert any icon, here as first (index = 0) + iconform->insertIcon(0, NEUTRINO_ICON_HINT_APLAY); + + + if (iconform->isPainted()) + iconform->hide(); + else{ + iconform->paint(); + } + return res; + } + showTestMenu(); @@ -472,6 +513,7 @@ void CTestMenu::showCCTests(CMenuWidget *widget) widget->addItem(new CMenuForwarderNonLocalized("Form", true, NULL, this, "form")); widget->addItem(new CMenuForwarderNonLocalized("Text", true, NULL, this, "text")); widget->addItem(new CMenuForwarderNonLocalized("Header", true, NULL, this, "header")); + widget->addItem(new CMenuForwarderNonLocalized("Icon-Form", true, NULL, this, "iconform")); } void CTestMenu::showHWTests(CMenuWidget *widget) diff --git a/src/gui/test_menu.h b/src/gui/test_menu.h index 5a1b56e43..c6f30a865 100644 --- a/src/gui/test_menu.h +++ b/src/gui/test_menu.h @@ -32,7 +32,7 @@ #include #include #include -// #define TEST_MENU + #define TEST_MENU #include @@ -46,6 +46,7 @@ class CTestMenu : public CMenuTarget CComponentsForm *form; CComponentsText *txt; CComponentsHeader *header; + CComponentsIconForm *iconform; int width, selected; void showTestMenu(); From b330d78ff279f858424af37ae0d5d81438646a36 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Sun, 18 Nov 2012 22:46:54 +0100 Subject: [PATCH 120/224] CComponentsHeader: add header buttons to header form Use addHeaderButton() to add any button icon ont header form. The buttons have a right alignment, this means, the first button is on the right boarder of header. For existing instances it's recommended to remove old button icons before add new buttons, otherwise icons will be append. See also sample code in CTestMenu. --- src/gui/components/cc.h | 87 +++++++++++--------- src/gui/components/components.cpp | 130 +++++++++++++++++++++++++----- src/gui/test_menu.cpp | 19 +++-- 3 files changed, 171 insertions(+), 65 deletions(-) diff --git a/src/gui/components/cc.h b/src/gui/components/cc.h index 282ca76f9..ae4f89db5 100644 --- a/src/gui/components/cc.h +++ b/src/gui/components/cc.h @@ -445,45 +445,11 @@ class CComponentsForm : public CComponentsItem virtual void paintCCItems(); }; -class CComponentsHeader : public CComponentsForm -{ - private: - CComponentsPicture * cch_icon_obj; - CComponentsText * cch_text_obj; - std::string cch_text; - const char* cch_icon_name; - neutrino_locale_t cch_locale_text; - fb_pixel_t cch_col_text; - Font* cch_font; - int cch_icon_x, cch_items_y, cch_text_x; - - void initCCHeaderIcon(); - void initCCHeaderText(); - - protected: - void initVarHeader(); - - public: - CComponentsHeader(); - CComponentsHeader(const int x_pos, const int y_pos, const int w, const int h = 0, const std::string& caption = "header", const char* icon_name = NULL, bool has_shadow = CC_SHADOW_OFF, - fb_pixel_t color_frame = COL_MENUCONTENT_PLUS_6, fb_pixel_t color_body = COL_MENUHEAD_PLUS_0, fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0); - CComponentsHeader(const int x_pos, const int y_pos, const int w, const int h = 0, neutrino_locale_t caption_locale = NONEXISTANT_LOCALE, const char* icon_name = NULL, bool has_shadow = CC_SHADOW_OFF, - fb_pixel_t color_frame = COL_MENUCONTENT_PLUS_6, fb_pixel_t color_body = COL_MENUHEAD_PLUS_0, fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0); - -// ~CComponentsHeader(); - - void paint(bool do_save_bg = CC_SAVE_SCREEN_YES); - void setHeaderText(const std::string& caption); - void setHeaderText(neutrino_locale_t caption_locale); - void setColorHeaderBody(fb_pixel_t text_color){cch_col_text = text_color;}; - void setHeaderIcon(const char* icon_name); -}; - class CComponentsIconForm : public CComponentsForm { private: std::vector v_icons; - int ccif_offset; + int ccif_offset, ccif_icon_align; protected: void initVarIconForm(); @@ -502,9 +468,56 @@ class CComponentsIconForm : public CComponentsForm void removeIcon(const uint& icon_id); void removeIcon(const std::string& icon_name); void removeAllIcons(); - int getIconId(const std::string& icon_name); - void setIconOffset(const int offset){ccif_offset = offset;}; + + enum //alignements + { + CC_ICONS_FRM_ALIGN_RIGHT , + CC_ICONS_FRM_ALIGN_LEFT + }; + void setIconAlign(int alignment){ccif_icon_align = alignment;}; + + int getIconId(const std::string& icon_name); +}; + +class CComponentsHeader : public CComponentsForm +{ + private: + CComponentsPicture * cch_icon_obj; + CComponentsText * cch_text_obj; + CComponentsIconForm * cch_btn_obj; + std::string cch_text; + const char* cch_icon_name; + neutrino_locale_t cch_locale_text; + fb_pixel_t cch_col_text; + Font* cch_font; + int cch_icon_x, cch_items_y, cch_text_x, ccif_width, cch_icon_w; + std::vector v_cch_btn; + + void initCCHeaderIcon(); + void initCCHeaderText(); + void initCCHeaderButtons(); + + protected: + void initVarHeader(); + + public: + CComponentsHeader(); + CComponentsHeader(const int x_pos, const int y_pos, const int w, const int h = 0, const std::string& caption = "header", const char* icon_name = NULL, bool has_shadow = CC_SHADOW_OFF, + fb_pixel_t color_frame = COL_MENUCONTENT_PLUS_6, fb_pixel_t color_body = COL_MENUHEAD_PLUS_0, fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0); + CComponentsHeader(const int x_pos, const int y_pos, const int w, const int h = 0, neutrino_locale_t caption_locale = NONEXISTANT_LOCALE, const char* icon_name = NULL, bool has_shadow = CC_SHADOW_OFF, + fb_pixel_t color_frame = COL_MENUCONTENT_PLUS_6, fb_pixel_t color_body = COL_MENUHEAD_PLUS_0, fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0); + +// ~CComponentsHeader(); + + void paint(bool do_save_bg = CC_SAVE_SCREEN_YES); + void setHeaderText(const std::string& caption); + void setHeaderText(neutrino_locale_t caption_locale); + void setColorHeaderBody(fb_pixel_t text_color){cch_col_text = text_color;}; + void setHeaderIcon(const char* icon_name); + + void addHeaderButton(const std::string& button_name); + void removeHeaderButtons(){v_cch_btn.clear();}; }; #endif diff --git a/src/gui/components/components.cpp b/src/gui/components/components.cpp index b8e1143be..7fc197d88 100644 --- a/src/gui/components/components.cpp +++ b/src/gui/components/components.cpp @@ -1691,12 +1691,16 @@ void CComponentsHeader::initVarHeader() cch_icon_obj = NULL; cch_text_obj = NULL; cch_icon_name = NULL; + cch_btn_obj = NULL; cch_text = "header"; cch_locale_text = NONEXISTANT_LOCALE; cch_col_text = COL_MENUHEAD; cch_items_y = 0; cch_icon_x = 0; + cch_icon_w = 5; cch_text_x = 0; + ccif_width = 5; + v_cch_btn.clear(); //CComponentsForm initVarForm(); @@ -1724,6 +1728,11 @@ void CComponentsHeader::setHeaderIcon(const char* icon_name) void CComponentsHeader::initCCHeaderIcon() { + if (cch_icon_name == NULL) { +// cch_icon_w = 5; + return; + } + if (cch_icon_name) cch_icon_obj = new CComponentsPicture(cch_icon_x, cch_items_y, 0, 0, cch_icon_name); cch_icon_obj->setWidth(height-2*fr_thickness); @@ -1739,12 +1748,50 @@ void CComponentsHeader::initCCHeaderIcon() else cc_icon_corner_type = CORNER_LEFT; cch_icon_obj->setCornerType(cc_icon_corner_type); + + //set width of icon object + cch_icon_w = cch_icon_obj->getWidth(); +} + +void CComponentsHeader::addHeaderButton(const std::string& button_name) +{ + v_cch_btn.push_back(button_name); +} + +void CComponentsHeader::initCCHeaderButtons() +{ + //exit here, if no icons added + if (v_cch_btn.empty()) + return; + + int ccbtn_offset = 8; + int btnw = 0; + + // calculate minimal width of icon form + size_t btncnt = v_cch_btn.size(); + for(size_t i=0; igetIconSize(v_cch_btn[i].c_str(), &bw, &bh); + btnw += bw; + if (i < (btncnt-1)) + btnw += ccbtn_offset; + } + btnw = max(btnw, ccif_width); + + cch_btn_obj = new CComponentsIconForm(); + cch_btn_obj->setDimensionsAll(0+width-btnw, 0, btnw-ccbtn_offset, height); + cch_btn_obj->doPaintBg(false); + cch_btn_obj->setIconOffset(ccbtn_offset); + cch_btn_obj->setIconAlign(CComponentsIconForm::CC_ICONS_FRM_ALIGN_RIGHT); + cch_btn_obj->removeAllIcons(); + cch_btn_obj->addIcon(v_cch_btn); + } void CComponentsHeader::initCCHeaderText() { - cch_text_x = cch_icon_x+cch_icon_obj->getWidth(); - cch_text_obj = new CComponentsText(cch_text_x, cch_items_y, width-cch_icon_obj->getWidth()-fr_thickness, height-2*fr_thickness, cch_text.c_str()); + cch_text_x = cch_icon_x+cch_icon_w; + cch_text_obj = new CComponentsText(cch_text_x, cch_items_y, width-cch_icon_w-fr_thickness, height-2*fr_thickness, cch_text.c_str()); cch_text_obj->setTextFont(cch_font); cch_text_obj->setTextColor(cch_col_text); cch_text_obj->doPaintBg(false); @@ -1752,6 +1799,7 @@ void CComponentsHeader::initCCHeaderText() //corner of text item cch_text_obj->setCornerRadius(corner_rad-fr_thickness); cch_text_obj->setCornerType(corner_type); + } void CComponentsHeader::paint(bool do_save_bg) @@ -1767,10 +1815,17 @@ void CComponentsHeader::paint(bool do_save_bg) //init text initCCHeaderText(); + + //init buttons + initCCHeaderButtons(); //add elements - addCCItem(cch_icon_obj); - addCCItem(cch_text_obj); + if (cch_icon_obj) + addCCItem(cch_icon_obj); //icon + if (cch_text_obj) + addCCItem(cch_text_obj); //text + if (cch_btn_obj) + addCCItem(cch_btn_obj); //buttons //paint paintCCItems(); @@ -1812,6 +1867,7 @@ void CComponentsIconForm::initVarIconForm() v_icons.clear(); ccif_offset = 2; + ccif_icon_align = CC_ICONS_FRM_ALIGN_LEFT; } void CComponentsIconForm::addIcon(const std::string& icon_name) @@ -1862,41 +1918,71 @@ void CComponentsIconForm::initCCIcons() { //clean up first possible old item objects, includes delete and clean up vector and icons clearCCItems(); - - int ccp_x = 0+fr_thickness; - int ccp_y = 0; - int ccp_w = 0; - int ccp_h = 0; - //detect maximal form height + //icon count + size_t i_cnt = v_icons.size(); + + //calculate start pos of first icon + int ccp_x = 0; + if (ccif_icon_align == CC_ICONS_FRM_ALIGN_RIGHT) + ccp_x = width-fr_thickness; + else + ccp_x = 0+fr_thickness; //CC_ICONS_FRM_ALIGN_LEFT + + int ccp_y = 0; + int ccp_h = 0; + int ccp_w = 0; + + //get width of first icon + frameBuffer->getIconSize(v_icons[0].c_str(), &ccp_w, &ccp_h); + + //get maximal form height depends of biggest icon height, but don't touch defined form height int h = height; - for (size_t i= 0; i< v_icons.size(); i++){ - frameBuffer->getIconSize(v_icons[i].c_str(), &ccp_w, &ccp_h); + for (size_t i= 0; i< i_cnt; i++){ + int dummy; + frameBuffer->getIconSize(v_icons[i].c_str(), &dummy, &ccp_h); h = max(ccp_h, h)/*+2*fr_thickness*/; } - //init and add item objects - for (size_t i= 0; i< v_icons.size(); i++){ - frameBuffer->getIconSize(v_icons[i].c_str(), &ccp_w, &ccp_h); + //set xpos of first icon with right alignment, icon must positionized on the right border reduced with icon width + if (ccif_icon_align == CC_ICONS_FRM_ALIGN_RIGHT) + ccp_x -= ccp_w; + //init and add item objects + + for (size_t i= 0; i< i_cnt; i++){ + //create new cc-picture item object CComponentsPicture *ccp = NULL; ccp = new CComponentsPicture(ccp_x, ccp_y, ccp_w, h, v_icons[i]); ccp->setPictureAlign(CC_ALIGN_HOR_CENTER | CC_ALIGN_VER_CENTER); - ccp->doPaintBg(false); - + ccp->doPaintBg(false); + //add item to form addCCItem(ccp); - - ccp_x += ccif_offset + ccp_w; + + //reset current width for next object + ccp_w = 0; + //get next icon size if available + size_t next_i = i+1; + if (next_i < i_cnt) + frameBuffer->getIconSize(v_icons[next_i].c_str(), &ccp_w, &ccp_h); + + //set next icon position + int tmp_offset = ( igetWidth() + tmp_offset); + if (ccif_icon_align == CC_ICONS_FRM_ALIGN_RIGHT) + ccp_x -= (ccp_w + tmp_offset); } - //calculate form width and height + //calculate width and height of form int w_tmp = 0; int h_tmp = 0; - for (size_t i= 0; i< v_cc_items.size(); i++){ + for (size_t i= 0; i< i_cnt; i++){ w_tmp += v_cc_items[i]->getWidth()+ccif_offset+fr_thickness; h_tmp = max(h_tmp, v_cc_items[i]->getHeight()+2*fr_thickness); } - width = max(w_tmp, width)-ccif_offset; //terminate last offset + width = max(w_tmp, width); height = max(h_tmp, height); } diff --git a/src/gui/test_menu.cpp b/src/gui/test_menu.cpp index c9992a55b..5214ffe2a 100644 --- a/src/gui/test_menu.cpp +++ b/src/gui/test_menu.cpp @@ -421,9 +421,15 @@ int CTestMenu::exec(CMenuTarget* parent, const std::string &actionKey) else if (actionKey == "header"){ if (header == NULL) header = new CComponentsHeader (100, 50, 480, g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]->getHeight(), "Test-Header", NEUTRINO_ICON_INFO); -// header->setFrameThickness(5); -// header->setColorFrame(COL_WHITE); -// header->setCornerType(CORNER_TOP); +// header->setFrameThickness(5); +// header->setColorFrame(COL_WHITE); +// header->setCornerType(CORNER_TOP); + //For existing instances it's recommended + //to remove old button icons before add new buttons, otherwise icons will be appended. + header->removeHeaderButtons(); + header->addHeaderButton(NEUTRINO_ICON_BUTTON_RED); + header->addHeaderButton(NEUTRINO_ICON_BUTTON_HELP); + header->addHeaderButton(NEUTRINO_ICON_BUTTON_MENU); if (!header->isPainted()) header->paint(); @@ -435,10 +441,11 @@ int CTestMenu::exec(CMenuTarget* parent, const std::string &actionKey) if (iconform == NULL) iconform = new CComponentsIconForm(); iconform->setColorBody(COL_LIGHT_GRAY); - iconform->setDimensionsAll(100, 100, 0, 60); + iconform->setDimensionsAll(100, 100, 480, 60); iconform->setFrameThickness(2); iconform->setColorFrame(COL_WHITE); iconform->setIconOffset(5); + iconform->setIconAlign(CComponentsIconForm::CC_ICONS_FRM_ALIGN_LEFT); //For existing instances it's recommended //to remove old items before add new icons, otherwise icons will be appended. iconform->removeAllIcons(); @@ -455,9 +462,9 @@ int CTestMenu::exec(CMenuTarget* parent, const std::string &actionKey) v_icons.push_back(NEUTRINO_ICON_HINT_AUDIO); iconform->addIcon(v_icons); - //insert any icon, here as first (index = 0) + //insert any icon, here as first (index = 0...n) iconform->insertIcon(0, NEUTRINO_ICON_HINT_APLAY); - +// iconform->setIconAlign(CComponentsIconForm::CC_ICONS_FRM_ALIGN_RIGHT); if (iconform->isPainted()) iconform->hide(); From 949867e4acba32ecf94b69a9fa81cc75ada5c6d3 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Mon, 19 Nov 2012 15:53:17 +0100 Subject: [PATCH 121/224] CComponentsForm: add virtual members to manipulate ccitems --- src/gui/components/cc.h | 4 ++++ src/gui/components/components.cpp | 30 ++++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+) diff --git a/src/gui/components/cc.h b/src/gui/components/cc.h index ae4f89db5..cbe1cf194 100644 --- a/src/gui/components/cc.h +++ b/src/gui/components/cc.h @@ -442,6 +442,10 @@ class CComponentsForm : public CComponentsItem void paint(bool do_save_bg = CC_SAVE_SCREEN_YES); void hide(bool no_restore = false); virtual void addCCItem(CComponentsItem* cc_Item); + virtual void insertCCItem(const uint& cc_item_id, CComponentsItem* cc_Item); + virtual void removeCCItem(const uint& cc_item_id); + virtual int getCCItemId(CComponentsItem* cc_Item); + virtual CComponentsItem* getCCItem(const uint& cc_item_id); virtual void paintCCItems(); }; diff --git a/src/gui/components/components.cpp b/src/gui/components/components.cpp index 7fc197d88..c3c0e3b5f 100644 --- a/src/gui/components/components.cpp +++ b/src/gui/components/components.cpp @@ -1570,6 +1570,36 @@ void CComponentsForm::addCCItem(CComponentsItem* cc_Item) v_cc_items.push_back(cc_Item); } +void CComponentsForm::insertCCItem(const uint& cc_item_id, CComponentsItem* cc_Item) +{ + v_cc_items.insert(v_cc_items.begin()+cc_item_id, cc_Item); +} + +int CComponentsForm::getCCItemId(CComponentsItem* cc_Item) +{ + for (size_t i= 0; i< v_cc_items.size(); i++) + if (v_cc_items[i] == cc_Item) + return i; + return -1; +} + +CComponentsItem* CComponentsForm::getCCItem(const uint& cc_item_id) +{ + if (v_cc_items[cc_item_id]) + return v_cc_items[cc_item_id]; + return NULL; +} + +void CComponentsForm::removeCCItem(const uint& cc_item_id) +{ + if (v_cc_items[cc_item_id]) { + delete v_cc_items[cc_item_id]; + v_cc_items[cc_item_id] = NULL; + v_cc_items.erase(v_cc_items.begin()+cc_item_id); + } + +} + void CComponentsForm::paint(bool do_save_bg) { //paint body From 562b091e668667d23229f7575fd42276114e14c9 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Mon, 19 Nov 2012 17:12:41 +0100 Subject: [PATCH 122/224] CComponentsHeader: move init members into its own member --- src/gui/components/cc.h | 1 + src/gui/components/components.cpp | 22 ++++++++++++++-------- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/src/gui/components/cc.h b/src/gui/components/cc.h index cbe1cf194..9bc7776d0 100644 --- a/src/gui/components/cc.h +++ b/src/gui/components/cc.h @@ -501,6 +501,7 @@ class CComponentsHeader : public CComponentsForm void initCCHeaderIcon(); void initCCHeaderText(); void initCCHeaderButtons(); + void initCCHItems(); protected: void initVarHeader(); diff --git a/src/gui/components/components.cpp b/src/gui/components/components.cpp index c3c0e3b5f..a1087eb49 100644 --- a/src/gui/components/components.cpp +++ b/src/gui/components/components.cpp @@ -1832,14 +1832,8 @@ void CComponentsHeader::initCCHeaderText() } -void CComponentsHeader::paint(bool do_save_bg) +void CComponentsHeader::initCCHItems() { - //paint body - paintInit(do_save_bg); - - //clean up first possible old item objects, includes delete and clean up vector - clearCCItems(); - //init icon initCCHeaderIcon(); @@ -1848,7 +1842,7 @@ void CComponentsHeader::paint(bool do_save_bg) //init buttons initCCHeaderButtons(); - + //add elements if (cch_icon_obj) addCCItem(cch_icon_obj); //icon @@ -1856,6 +1850,18 @@ void CComponentsHeader::paint(bool do_save_bg) addCCItem(cch_text_obj); //text if (cch_btn_obj) addCCItem(cch_btn_obj); //buttons +} + +void CComponentsHeader::paint(bool do_save_bg) +{ + //paint body + paintInit(do_save_bg); + + //clean up first possible old item objects, includes delete and clean up vector + clearCCItems(); + + //init default header ccitems + initCCHItems(); //paint paintCCItems(); From 3644abec665570009c3bec45efb8de97f49ae275 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Wed, 21 Nov 2012 22:27:24 +0100 Subject: [PATCH 123/224] CComponentsHeader: add parameter buttons onto constructors This adds default buttons to header --- src/gui/components/cc.h | 17 +++++++-- src/gui/components/components.cpp | 62 +++++++++++++++++++++---------- src/gui/test_menu.cpp | 26 +++++++++---- 3 files changed, 75 insertions(+), 30 deletions(-) diff --git a/src/gui/components/cc.h b/src/gui/components/cc.h index 9bc7776d0..9e8b7fa2c 100644 --- a/src/gui/components/cc.h +++ b/src/gui/components/cc.h @@ -484,6 +484,8 @@ class CComponentsIconForm : public CComponentsForm int getIconId(const std::string& icon_name); }; + + class CComponentsHeader : public CComponentsForm { private: @@ -495,7 +497,7 @@ class CComponentsHeader : public CComponentsForm neutrino_locale_t cch_locale_text; fb_pixel_t cch_col_text; Font* cch_font; - int cch_icon_x, cch_items_y, cch_text_x, ccif_width, cch_icon_w; + int cch_icon_x, cch_items_y, cch_text_x, ccif_width, cch_icon_w, cch_buttons; std::vector v_cch_btn; void initCCHeaderIcon(); @@ -507,10 +509,18 @@ class CComponentsHeader : public CComponentsForm void initVarHeader(); public: + enum + { + CC_BTN_HELP = 0x02, + CC_BTN_INFO = 0x04, + CC_BTN_MENU = 0x40, + CC_BTN_EXIT = 0x80 + + }; CComponentsHeader(); - CComponentsHeader(const int x_pos, const int y_pos, const int w, const int h = 0, const std::string& caption = "header", const char* icon_name = NULL, bool has_shadow = CC_SHADOW_OFF, + CComponentsHeader(const int x_pos, const int y_pos, const int w, const int h = 0, const std::string& caption = "header", const char* icon_name = NULL, const int buttons = 0, bool has_shadow = CC_SHADOW_OFF, fb_pixel_t color_frame = COL_MENUCONTENT_PLUS_6, fb_pixel_t color_body = COL_MENUHEAD_PLUS_0, fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0); - CComponentsHeader(const int x_pos, const int y_pos, const int w, const int h = 0, neutrino_locale_t caption_locale = NONEXISTANT_LOCALE, const char* icon_name = NULL, bool has_shadow = CC_SHADOW_OFF, + CComponentsHeader(const int x_pos, const int y_pos, const int w, const int h = 0, neutrino_locale_t caption_locale = NONEXISTANT_LOCALE, const char* icon_name = NULL, const int buttons = 0,bool has_shadow = CC_SHADOW_OFF, fb_pixel_t color_frame = COL_MENUCONTENT_PLUS_6, fb_pixel_t color_body = COL_MENUHEAD_PLUS_0, fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0); // ~CComponentsHeader(); @@ -520,7 +530,6 @@ class CComponentsHeader : public CComponentsForm void setHeaderText(neutrino_locale_t caption_locale); void setColorHeaderBody(fb_pixel_t text_color){cch_col_text = text_color;}; void setHeaderIcon(const char* icon_name); - void addHeaderButton(const std::string& button_name); void removeHeaderButtons(){v_cch_btn.clear();}; }; diff --git a/src/gui/components/components.cpp b/src/gui/components/components.cpp index a1087eb49..ae9745c4d 100644 --- a/src/gui/components/components.cpp +++ b/src/gui/components/components.cpp @@ -1570,11 +1570,6 @@ void CComponentsForm::addCCItem(CComponentsItem* cc_Item) v_cc_items.push_back(cc_Item); } -void CComponentsForm::insertCCItem(const uint& cc_item_id, CComponentsItem* cc_Item) -{ - v_cc_items.insert(v_cc_items.begin()+cc_item_id, cc_Item); -} - int CComponentsForm::getCCItemId(CComponentsItem* cc_Item) { for (size_t i= 0; i< v_cc_items.size(); i++) @@ -1590,6 +1585,17 @@ CComponentsItem* CComponentsForm::getCCItem(const uint& cc_item_id) return NULL; } +void CComponentsForm::insertCCItem(const uint& cc_item_id, CComponentsItem* cc_Item) +{ +#ifdef DEBUG_CC + if (cc_Item == NULL){ + printf("CComponentsForm: %s parameter: cc_Item = %d...\n", __FUNCTION__, (int)cc_Item); + return; + } +#endif + v_cc_items.insert(v_cc_items.begin()+cc_item_id, cc_Item); +} + void CComponentsForm::removeCCItem(const uint& cc_item_id) { if (v_cc_items[cc_item_id]) { @@ -1597,7 +1603,6 @@ void CComponentsForm::removeCCItem(const uint& cc_item_id) v_cc_items[cc_item_id] = NULL; v_cc_items.erase(v_cc_items.begin()+cc_item_id); } - } void CComponentsForm::paint(bool do_save_bg) @@ -1666,7 +1671,7 @@ CComponentsHeader::CComponentsHeader() initVarHeader(); } -CComponentsHeader::CComponentsHeader( const int x_pos, const int y_pos, const int w, const int h, const std::string& caption, const char* icon_name, bool has_shadow, +CComponentsHeader::CComponentsHeader( const int x_pos, const int y_pos, const int w, const int h, const std::string& caption, const char* icon_name, const int buttons, bool has_shadow, fb_pixel_t color_frame, fb_pixel_t color_body, fb_pixel_t color_shadow) { //CComponentsHeader @@ -1683,9 +1688,12 @@ CComponentsHeader::CComponentsHeader( const int x_pos, const int y_pos, const in cch_text = caption; cch_icon_name = icon_name; + cch_buttons = buttons; + + initCCHItems(); } -CComponentsHeader::CComponentsHeader( const int x_pos, const int y_pos, const int w, const int h, neutrino_locale_t caption_locale, const char* icon_name, bool has_shadow, +CComponentsHeader::CComponentsHeader( const int x_pos, const int y_pos, const int w, const int h, neutrino_locale_t caption_locale, const char* icon_name, const int buttons, bool has_shadow, fb_pixel_t color_frame, fb_pixel_t color_body, fb_pixel_t color_shadow) { //CComponentsHeader @@ -1702,6 +1710,9 @@ CComponentsHeader::CComponentsHeader( const int x_pos, const int y_pos, const in cch_locale_text = caption_locale; cch_icon_name = icon_name; + cch_buttons = buttons; + + initCCHItems(); } #if 0 @@ -1730,6 +1741,7 @@ void CComponentsHeader::initVarHeader() cch_icon_w = 5; cch_text_x = 0; ccif_width = 5; + cch_buttons = 0; v_cch_btn.clear(); //CComponentsForm @@ -1739,6 +1751,8 @@ void CComponentsHeader::initVarHeader() col_body = COL_MENUHEAD_PLUS_0; corner_rad = RADIUS_LARGE, corner_type = CORNER_TOP; + + initCCHItems(); } void CComponentsHeader::setHeaderText(const std::string& caption) @@ -1756,6 +1770,8 @@ void CComponentsHeader::setHeaderIcon(const char* icon_name) cch_icon_name = icon_name; } + + void CComponentsHeader::initCCHeaderIcon() { if (cch_icon_name == NULL) { @@ -1790,7 +1806,16 @@ void CComponentsHeader::addHeaderButton(const std::string& button_name) void CComponentsHeader::initCCHeaderButtons() { - //exit here, if no icons added + if (cch_buttons & CC_BTN_EXIT) + addHeaderButton(NEUTRINO_ICON_BUTTON_HOME); + if (cch_buttons & CC_BTN_HELP) + addHeaderButton(NEUTRINO_ICON_BUTTON_HELP); + if (cch_buttons & CC_BTN_INFO) + addHeaderButton(NEUTRINO_ICON_BUTTON_INFO); + if (cch_buttons & CC_BTN_MENU) + addHeaderButton(NEUTRINO_ICON_BUTTON_MENU); + + //exit if no button defined if (v_cch_btn.empty()) return; @@ -1807,7 +1832,7 @@ void CComponentsHeader::initCCHeaderButtons() btnw += ccbtn_offset; } btnw = max(btnw, ccif_width); - + cch_btn_obj = new CComponentsIconForm(); cch_btn_obj->setDimensionsAll(0+width-btnw, 0, btnw-ccbtn_offset, height); cch_btn_obj->doPaintBg(false); @@ -1815,7 +1840,6 @@ void CComponentsHeader::initCCHeaderButtons() cch_btn_obj->setIconAlign(CComponentsIconForm::CC_ICONS_FRM_ALIGN_RIGHT); cch_btn_obj->removeAllIcons(); cch_btn_obj->addIcon(v_cch_btn); - } void CComponentsHeader::initCCHeaderText() @@ -1825,15 +1849,17 @@ void CComponentsHeader::initCCHeaderText() cch_text_obj->setTextFont(cch_font); cch_text_obj->setTextColor(cch_col_text); cch_text_obj->doPaintBg(false); - + //corner of text item cch_text_obj->setCornerRadius(corner_rad-fr_thickness); - cch_text_obj->setCornerType(corner_type); - + cch_text_obj->setCornerType(corner_type); } void CComponentsHeader::initCCHItems() { + //clean up first possible old item objects, includes delete and clean up vector + clearCCItems(); + //init icon initCCHeaderIcon(); @@ -1850,6 +1876,7 @@ void CComponentsHeader::initCCHItems() addCCItem(cch_text_obj); //text if (cch_btn_obj) addCCItem(cch_btn_obj); //buttons + } void CComponentsHeader::paint(bool do_save_bg) @@ -1857,11 +1884,8 @@ void CComponentsHeader::paint(bool do_save_bg) //paint body paintInit(do_save_bg); - //clean up first possible old item objects, includes delete and clean up vector - clearCCItems(); - - //init default header ccitems - initCCHItems(); + /*//init default header ccitems + */initCCHItems(); //paint paintCCItems(); diff --git a/src/gui/test_menu.cpp b/src/gui/test_menu.cpp index 5214ffe2a..f202bf8e2 100644 --- a/src/gui/test_menu.cpp +++ b/src/gui/test_menu.cpp @@ -396,6 +396,10 @@ int CTestMenu::exec(CMenuTarget* parent, const std::string &actionKey) CComponentsShapeCircle *c1 = new CComponentsShapeCircle(28, 40, 28); c1->setColorBody(COL_RED); form->addCCItem(c1); + +// form->removeCCItem(form->getCCItemId(t1)); +// form->insertCCItem(1, new CComponentsPicture(28, 0, 0, 0, NEUTRINO_ICON_BUTTON_RED)); + if (form->isPainted()) { form->hide(); @@ -419,17 +423,25 @@ int CTestMenu::exec(CMenuTarget* parent, const std::string &actionKey) return res; } else if (actionKey == "header"){ + int hh = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]->getHeight(); if (header == NULL) - header = new CComponentsHeader (100, 50, 480, g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]->getHeight(), "Test-Header", NEUTRINO_ICON_INFO); + header = new CComponentsHeader (100, 50, 480, hh, "Test-Header", NEUTRINO_ICON_INFO/*, CComponentsHeader::CC_BTN_HELP | CComponentsHeader::CC_BTN_EXIT */); + else //For existing instances it's recommended + //to remove old button icons before add new buttons, otherwise icons will be appended. + header->removeHeaderButtons(); // header->setFrameThickness(5); // header->setColorFrame(COL_WHITE); // header->setCornerType(CORNER_TOP); - //For existing instances it's recommended - //to remove old button icons before add new buttons, otherwise icons will be appended. - header->removeHeaderButtons(); - header->addHeaderButton(NEUTRINO_ICON_BUTTON_RED); - header->addHeaderButton(NEUTRINO_ICON_BUTTON_HELP); - header->addHeaderButton(NEUTRINO_ICON_BUTTON_MENU); +// header->setHeaderText("Test"); + header->addHeaderButton(NEUTRINO_ICON_BUTTON_RED); +// header->addHeaderButton(NEUTRINO_ICON_BUTTON_HELP); +// header->addHeaderButton(NEUTRINO_ICON_BUTTON_MENU); + +// header->removeCCItem(2); //remove text +// CComponentsPicture *logo = new CComponentsPicture(5, 0, 100, g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]->getHeight(), "/tmp/media/sda1/var/share/tuxbox/neutrino/icons/logo/100850010.png"); +// logo->doPaintBg(false); +// header->insertCCItem(0, logo); //replace text with logo + if (!header->isPainted()) header->paint(); From fb3646c9bed99a1555e6d401b39ea6c5610c25ea Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Fri, 23 Nov 2012 15:13:15 +0100 Subject: [PATCH 124/224] CComponentsForm: do not paint out of form If is x or y position of embedded item out of allowed form dimension, then set a new x or y value to item. Added debug message should help to find issues. --- src/gui/components/components.cpp | 48 ++++++++++++++++++++----------- 1 file changed, 31 insertions(+), 17 deletions(-) diff --git a/src/gui/components/components.cpp b/src/gui/components/components.cpp index ae9745c4d..6f24de49b 100644 --- a/src/gui/components/components.cpp +++ b/src/gui/components/components.cpp @@ -1617,41 +1617,55 @@ void CComponentsForm::paint(bool do_save_bg) void CComponentsForm::paintCCItems() { size_t items_count = v_cc_items.size(); - int x_tmp = x+fr_thickness; - int y_tmp = y+fr_thickness; - - int xx = x+width-fr_thickness; //right form border - int yy = y+height-fr_thickness; //bottom form border + int x_frm_left = x+fr_thickness; //left form border + int y_frm_top = y+fr_thickness; //top form border + int x_frm_right = x+width-fr_thickness; //right form border + int y_frm_bottom = y+height-fr_thickness; //bottom form border for(size_t i=0; igetDimensions(&x_item, &y_item, &w_item, &h_item); + + int xy_ref = 0+fr_thickness; //allowed minimal x and y start position + if (x_item < xy_ref){ +#ifdef DEBUG_CC + printf("[CComponentsForm] %s: item %d position is out of form dimensions\ndefinied x=%d\nallowed x>=%d\n", __FUNCTION__, i, x_item, xy_ref); +#endif + x_item = xy_ref; + } + if (y_item < xy_ref){ +#ifdef DEBUG_CC + printf("[CComponentsForm] %s: item %d position is out of form dimensions\ndefinied y=%d\nallowed y>=%d\n", __FUNCTION__, i, y_item, xy_ref); +#endif + y_item = xy_ref; + } //set adapted position onto form - v_cc_items[i]->setXPos(x_tmp+x_item); - v_cc_items[i]->setYPos(y_tmp+y_item); + v_cc_items[i]->setXPos(x_frm_left+x_item); + v_cc_items[i]->setYPos(y_frm_top+y_item); - //watch dimensions of items - int xx_item = v_cc_items[i]->getXPos()+w_item; //right item border - if (xx_item > xx){ - v_cc_items[i]->setWidth(w_item-(xx_item-xx)); + //watch horizontal x dimensions of items + int x_item_right = v_cc_items[i]->getXPos()+w_item; //right item border + if (x_item_right > x_frm_right){ + v_cc_items[i]->setWidth(w_item-(x_item_right-x_frm_right)); #ifdef DEBUG_CC printf("[CComponentsForm] %s: item %d too large, definied width=%d, possible width=%d \n", __FUNCTION__, i, w_item, v_cc_items[i]->getWidth()); #endif } - - int yy_item = v_cc_items[i]->getYPos()+h_item; //bottom item border - if (yy_item > yy){ - v_cc_items[i]->setHeight(h_item-(yy_item-yy)); + + //watch vertical y dimensions + int y_item_bottom = v_cc_items[i]->getYPos()+h_item; //bottom item border + if (y_item_bottom > y_frm_bottom){ + v_cc_items[i]->setHeight(h_item-(y_item_bottom-y_frm_bottom)); #ifdef DEBUG_CC printf("[CComponentsForm] %s: item %d too large, definied height=%d, possible height=%d \n", __FUNCTION__, i, h_item, v_cc_items[i]->getHeight()); #endif } - + //paint element without saved screen! v_cc_items[i]->paint(CC_SAVE_SCREEN_NO); - + //restore dimensions and position v_cc_items[i]->setDimensionsAll(x_item, y_item, w_item, h_item); } From 4fb3cde45fa933f78e525bfc9fd42e53320e0ebd Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Sat, 24 Nov 2012 22:07:53 +0100 Subject: [PATCH 125/224] CComponentsHeader: fix button display Calculation of button offset was broken. --- src/gui/components/cc.h | 6 +- src/gui/components/components.cpp | 97 +++++++++++++++---------------- 2 files changed, 52 insertions(+), 51 deletions(-) diff --git a/src/gui/components/cc.h b/src/gui/components/cc.h index 9e8b7fa2c..66ec13f13 100644 --- a/src/gui/components/cc.h +++ b/src/gui/components/cc.h @@ -454,6 +454,7 @@ class CComponentsIconForm : public CComponentsForm private: std::vector v_icons; int ccif_offset, ccif_icon_align; + void initMaxHeight(int *pheight); protected: void initVarIconForm(); @@ -497,7 +498,7 @@ class CComponentsHeader : public CComponentsForm neutrino_locale_t cch_locale_text; fb_pixel_t cch_col_text; Font* cch_font; - int cch_icon_x, cch_items_y, cch_text_x, ccif_width, cch_icon_w, cch_buttons; + int cch_icon_x, cch_items_y, cch_text_x, ccif_width, cch_icon_w, cch_buttons, cch_btn_offset; std::vector v_cch_btn; void initCCHeaderIcon(); @@ -529,9 +530,10 @@ class CComponentsHeader : public CComponentsForm void setHeaderText(const std::string& caption); void setHeaderText(neutrino_locale_t caption_locale); void setColorHeaderBody(fb_pixel_t text_color){cch_col_text = text_color;}; + void setHeaderButtonOffset(const int offset){cch_btn_offset = offset;}; void setHeaderIcon(const char* icon_name); void addHeaderButton(const std::string& button_name); - void removeHeaderButtons(){v_cch_btn.clear();}; + void removeHeaderButtons(); }; #endif diff --git a/src/gui/components/components.cpp b/src/gui/components/components.cpp index 6f24de49b..d9da92d01 100644 --- a/src/gui/components/components.cpp +++ b/src/gui/components/components.cpp @@ -1626,6 +1626,7 @@ void CComponentsForm::paintCCItems() //cache original item position and dimensions int x_item, y_item, w_item, h_item; v_cc_items[i]->getDimensions(&x_item, &y_item, &w_item, &h_item); + int xy_ref = 0+fr_thickness; //allowed minimal x and y start position if (x_item < xy_ref){ @@ -1703,8 +1704,6 @@ CComponentsHeader::CComponentsHeader( const int x_pos, const int y_pos, const in cch_text = caption; cch_icon_name = icon_name; cch_buttons = buttons; - - initCCHItems(); } CComponentsHeader::CComponentsHeader( const int x_pos, const int y_pos, const int w, const int h, neutrino_locale_t caption_locale, const char* icon_name, const int buttons, bool has_shadow, @@ -1725,8 +1724,6 @@ CComponentsHeader::CComponentsHeader( const int x_pos, const int y_pos, const in cch_locale_text = caption_locale; cch_icon_name = icon_name; cch_buttons = buttons; - - initCCHItems(); } #if 0 @@ -1754,9 +1751,10 @@ void CComponentsHeader::initVarHeader() cch_icon_x = 0; cch_icon_w = 5; cch_text_x = 0; - ccif_width = 5; + ccif_width = 0; cch_buttons = 0; - v_cch_btn.clear(); + cch_btn_offset = 8; + v_cch_btn.clear(); //CComponentsForm initVarForm(); @@ -1765,8 +1763,6 @@ void CComponentsHeader::initVarHeader() col_body = COL_MENUHEAD_PLUS_0; corner_rad = RADIUS_LARGE, corner_type = CORNER_TOP; - - initCCHItems(); } void CComponentsHeader::setHeaderText(const std::string& caption) @@ -1784,8 +1780,6 @@ void CComponentsHeader::setHeaderIcon(const char* icon_name) cch_icon_name = icon_name; } - - void CComponentsHeader::initCCHeaderIcon() { if (cch_icon_name == NULL) { @@ -1818,39 +1812,41 @@ void CComponentsHeader::addHeaderButton(const std::string& button_name) v_cch_btn.push_back(button_name); } +void CComponentsHeader::removeHeaderButtons() +{ + v_cch_btn.clear(); + if (cch_btn_obj) + cch_btn_obj->removeAllIcons(); +} + void CComponentsHeader::initCCHeaderButtons() { if (cch_buttons & CC_BTN_EXIT) - addHeaderButton(NEUTRINO_ICON_BUTTON_HOME); + v_cch_btn.push_back(NEUTRINO_ICON_BUTTON_HOME); if (cch_buttons & CC_BTN_HELP) - addHeaderButton(NEUTRINO_ICON_BUTTON_HELP); + v_cch_btn.push_back(NEUTRINO_ICON_BUTTON_HELP); if (cch_buttons & CC_BTN_INFO) - addHeaderButton(NEUTRINO_ICON_BUTTON_INFO); + v_cch_btn.push_back(NEUTRINO_ICON_BUTTON_INFO); if (cch_buttons & CC_BTN_MENU) - addHeaderButton(NEUTRINO_ICON_BUTTON_MENU); + v_cch_btn.push_back(NEUTRINO_ICON_BUTTON_MENU); //exit if no button defined if (v_cch_btn.empty()) return; - - int ccbtn_offset = 8; - int btnw = 0; - + // calculate minimal width of icon form size_t btncnt = v_cch_btn.size(); + ccif_width = 0; for(size_t i=0; igetIconSize(v_cch_btn[i].c_str(), &bw, &bh); - btnw += bw; - if (i < (btncnt-1)) - btnw += ccbtn_offset; + ccif_width += (bw + cch_btn_offset); } - btnw = max(btnw, ccif_width); - + cch_btn_obj = new CComponentsIconForm(); - cch_btn_obj->setDimensionsAll(0+width-btnw, 0, btnw-ccbtn_offset, height); + cch_btn_obj->setDimensionsAll(0+width-ccif_width, 0, ccif_width-cch_btn_offset, height); cch_btn_obj->doPaintBg(false); - cch_btn_obj->setIconOffset(ccbtn_offset); + cch_btn_obj->setIconOffset(cch_btn_offset); cch_btn_obj->setIconAlign(CComponentsIconForm::CC_ICONS_FRM_ALIGN_RIGHT); cch_btn_obj->removeAllIcons(); cch_btn_obj->addIcon(v_cch_btn); @@ -1898,8 +1894,8 @@ void CComponentsHeader::paint(bool do_save_bg) //paint body paintInit(do_save_bg); - /*//init default header ccitems - */initCCHItems(); + //init default header ccitems + initCCHItems(); //paint paintCCItems(); @@ -1983,9 +1979,19 @@ int CComponentsIconForm::getIconId(const std::string& icon_name) //to remove old items before add new icons, otherwise icons will be appended. void CComponentsIconForm::removeAllIcons() { - clearCCItems(); if (!v_icons.empty()) v_icons.clear(); + clearCCItems(); +} + +//get maximal form height depends of biggest icon height, but don't touch defined form height +void CComponentsIconForm::initMaxHeight(int *pheight) +{ + for (size_t i= 0; i< v_icons.size(); i++){ + int dummy, htmp; + frameBuffer->getIconSize(v_icons[i].c_str(), &dummy, &htmp); + *pheight = max(htmp, height)/*+2*fr_thickness*/; + } } void CComponentsIconForm::initCCIcons() @@ -1993,37 +1999,29 @@ void CComponentsIconForm::initCCIcons() //clean up first possible old item objects, includes delete and clean up vector and icons clearCCItems(); - //icon count - size_t i_cnt = v_icons.size(); - - //calculate start pos of first icon - int ccp_x = 0; - if (ccif_icon_align == CC_ICONS_FRM_ALIGN_RIGHT) - ccp_x = width-fr_thickness; - else - ccp_x = 0+fr_thickness; //CC_ICONS_FRM_ALIGN_LEFT - int ccp_y = 0; int ccp_h = 0; int ccp_w = 0; + //calculate start pos of first icon + int ccp_x = 0 + fr_thickness; //CC_ICONS_FRM_ALIGN_LEFT; + + if (ccif_icon_align == CC_ICONS_FRM_ALIGN_RIGHT) + ccp_x += (width - fr_thickness); //get width of first icon frameBuffer->getIconSize(v_icons[0].c_str(), &ccp_w, &ccp_h); - - //get maximal form height depends of biggest icon height, but don't touch defined form height - int h = height; - for (size_t i= 0; i< i_cnt; i++){ - int dummy; - frameBuffer->getIconSize(v_icons[i].c_str(), &dummy, &ccp_h); - h = max(ccp_h, h)/*+2*fr_thickness*/; - } + + //get maximal form height + int h = 0; + initMaxHeight(&h); //set xpos of first icon with right alignment, icon must positionized on the right border reduced with icon width if (ccif_icon_align == CC_ICONS_FRM_ALIGN_RIGHT) ccp_x -= ccp_w; //init and add item objects - + size_t i_cnt = v_icons.size(); //icon count + for (size_t i= 0; i< i_cnt; i++){ //create new cc-picture item object CComponentsPicture *ccp = NULL; @@ -2036,8 +2034,8 @@ void CComponentsIconForm::initCCIcons() //reset current width for next object ccp_w = 0; //get next icon size if available - size_t next_i = i+1; - if (next_i < i_cnt) + size_t next_i = i+1; + if (next_i != i_cnt) frameBuffer->getIconSize(v_icons[next_i].c_str(), &ccp_w, &ccp_h); //set next icon position @@ -2055,6 +2053,7 @@ void CComponentsIconForm::initCCIcons() for (size_t i= 0; i< i_cnt; i++){ w_tmp += v_cc_items[i]->getWidth()+ccif_offset+fr_thickness; h_tmp = max(h_tmp, v_cc_items[i]->getHeight()+2*fr_thickness); + } width = max(w_tmp, width); height = max(h_tmp, height); From 189ba5b5e6d1236334c40adc73a21f59bd967a4f Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Sat, 24 Nov 2012 22:09:45 +0100 Subject: [PATCH 126/224] CTestMenu: add sample code CComponentsHeader --- src/gui/test_menu.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/gui/test_menu.cpp b/src/gui/test_menu.cpp index f202bf8e2..f293a8f7d 100644 --- a/src/gui/test_menu.cpp +++ b/src/gui/test_menu.cpp @@ -425,15 +425,15 @@ int CTestMenu::exec(CMenuTarget* parent, const std::string &actionKey) else if (actionKey == "header"){ int hh = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]->getHeight(); if (header == NULL) - header = new CComponentsHeader (100, 50, 480, hh, "Test-Header", NEUTRINO_ICON_INFO/*, CComponentsHeader::CC_BTN_HELP | CComponentsHeader::CC_BTN_EXIT */); + header = new CComponentsHeader (100, 50, 500, hh, "Test-Header", NEUTRINO_ICON_INFO, CComponentsHeader::CC_BTN_HELP | CComponentsHeader::CC_BTN_EXIT | CComponentsHeader::CC_BTN_MENU); else //For existing instances it's recommended //to remove old button icons before add new buttons, otherwise icons will be appended. - header->removeHeaderButtons(); + header->removeHeaderButtons(); // header->setFrameThickness(5); // header->setColorFrame(COL_WHITE); // header->setCornerType(CORNER_TOP); // header->setHeaderText("Test"); - header->addHeaderButton(NEUTRINO_ICON_BUTTON_RED); +// header->addHeaderButton(NEUTRINO_ICON_BUTTON_RED); // header->addHeaderButton(NEUTRINO_ICON_BUTTON_HELP); // header->addHeaderButton(NEUTRINO_ICON_BUTTON_MENU); @@ -457,7 +457,7 @@ int CTestMenu::exec(CMenuTarget* parent, const std::string &actionKey) iconform->setFrameThickness(2); iconform->setColorFrame(COL_WHITE); iconform->setIconOffset(5); - iconform->setIconAlign(CComponentsIconForm::CC_ICONS_FRM_ALIGN_LEFT); + iconform->setIconAlign(CComponentsIconForm::CC_ICONS_FRM_ALIGN_RIGHT); //For existing instances it's recommended //to remove old items before add new icons, otherwise icons will be appended. iconform->removeAllIcons(); From 62f44d7a8c4b8088c8bfcf82d58c798b06e2b836 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Sat, 24 Nov 2012 22:20:37 +0100 Subject: [PATCH 127/224] CComponentsHeader: move int of default buttons into its own member --- src/gui/components/cc.h | 1 + src/gui/components/components.cpp | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/gui/components/cc.h b/src/gui/components/cc.h index 66ec13f13..386c4ef5d 100644 --- a/src/gui/components/cc.h +++ b/src/gui/components/cc.h @@ -505,6 +505,7 @@ class CComponentsHeader : public CComponentsForm void initCCHeaderText(); void initCCHeaderButtons(); void initCCHItems(); + void initCCHDefaultButtons(); protected: void initVarHeader(); diff --git a/src/gui/components/components.cpp b/src/gui/components/components.cpp index d9da92d01..5cce2280f 100644 --- a/src/gui/components/components.cpp +++ b/src/gui/components/components.cpp @@ -1819,7 +1819,7 @@ void CComponentsHeader::removeHeaderButtons() cch_btn_obj->removeAllIcons(); } -void CComponentsHeader::initCCHeaderButtons() +void CComponentsHeader::initCCHDefaultButtons() { if (cch_buttons & CC_BTN_EXIT) v_cch_btn.push_back(NEUTRINO_ICON_BUTTON_HOME); @@ -1829,6 +1829,11 @@ void CComponentsHeader::initCCHeaderButtons() v_cch_btn.push_back(NEUTRINO_ICON_BUTTON_INFO); if (cch_buttons & CC_BTN_MENU) v_cch_btn.push_back(NEUTRINO_ICON_BUTTON_MENU); +} + +void CComponentsHeader::initCCHeaderButtons() +{ + initCCHDefaultButtons(); //exit if no button defined if (v_cch_btn.empty()) From 41165d7cb210c09547777962954d389b45a37f5a Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Sat, 24 Nov 2012 22:31:00 +0100 Subject: [PATCH 128/224] CComponentsHeader: add member initCCButtonFormSize() This moves caclulation from initCCHeaderButtons() to its own member. --- src/gui/components/cc.h | 1 + src/gui/components/components.cpp | 22 +++++++++++++--------- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/src/gui/components/cc.h b/src/gui/components/cc.h index 386c4ef5d..8a2e2d79d 100644 --- a/src/gui/components/cc.h +++ b/src/gui/components/cc.h @@ -506,6 +506,7 @@ class CComponentsHeader : public CComponentsForm void initCCHeaderButtons(); void initCCHItems(); void initCCHDefaultButtons(); + void initCCButtonFormSize(); protected: void initVarHeader(); diff --git a/src/gui/components/components.cpp b/src/gui/components/components.cpp index 5cce2280f..7e6fd6163 100644 --- a/src/gui/components/components.cpp +++ b/src/gui/components/components.cpp @@ -1831,6 +1831,17 @@ void CComponentsHeader::initCCHDefaultButtons() v_cch_btn.push_back(NEUTRINO_ICON_BUTTON_MENU); } +// calculate minimal width of icon form +void CComponentsHeader::initCCButtonFormSize() +{ + ccif_width = 0; + for(size_t i=0; igetIconSize(v_cch_btn[i].c_str(), &bw, &bh); + ccif_width += (bw + cch_btn_offset); + } +} + void CComponentsHeader::initCCHeaderButtons() { initCCHDefaultButtons(); @@ -1838,15 +1849,8 @@ void CComponentsHeader::initCCHeaderButtons() //exit if no button defined if (v_cch_btn.empty()) return; - - // calculate minimal width of icon form - size_t btncnt = v_cch_btn.size(); - ccif_width = 0; - for(size_t i=0; igetIconSize(v_cch_btn[i].c_str(), &bw, &bh); - ccif_width += (bw + cch_btn_offset); - } + + initCCButtonFormSize(); cch_btn_obj = new CComponentsIconForm(); cch_btn_obj->setDimensionsAll(0+width-ccif_width, 0, ccif_width-cch_btn_offset, height); From 2e729ffdb9dca0cd3252cd38af1cf932e633decb Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Sun, 25 Nov 2012 10:00:59 +0100 Subject: [PATCH 129/224] CComponentsForm: prevent crashs, if no item is available in v_cc_items insertCCItem() and removeCCItem() occured crashes, if no items was added. Also added debug messages. --- src/gui/components/components.cpp | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/src/gui/components/components.cpp b/src/gui/components/components.cpp index 7e6fd6163..0988f1286 100644 --- a/src/gui/components/components.cpp +++ b/src/gui/components/components.cpp @@ -1587,22 +1587,36 @@ CComponentsItem* CComponentsForm::getCCItem(const uint& cc_item_id) void CComponentsForm::insertCCItem(const uint& cc_item_id, CComponentsItem* cc_Item) { -#ifdef DEBUG_CC + if (cc_Item == NULL){ +#ifdef DEBUG_CC printf("CComponentsForm: %s parameter: cc_Item = %d...\n", __FUNCTION__, (int)cc_Item); +#endif return; } + + if (v_cc_items.empty()){ + v_cc_items.push_back(cc_Item); +#ifdef DEBUG_CC + printf("CComponentsForm: %s insert cc_Item not possible, v_cc_items is empty, cc_Item added\n", __FUNCTION__); #endif - v_cc_items.insert(v_cc_items.begin()+cc_item_id, cc_Item); + }else + v_cc_items.insert(v_cc_items.begin()+cc_item_id, cc_Item); } void CComponentsForm::removeCCItem(const uint& cc_item_id) { - if (v_cc_items[cc_item_id]) { - delete v_cc_items[cc_item_id]; - v_cc_items[cc_item_id] = NULL; - v_cc_items.erase(v_cc_items.begin()+cc_item_id); + if (!v_cc_items.empty()){ + if (v_cc_items.at(cc_item_id)) { + delete v_cc_items[cc_item_id]; + v_cc_items[cc_item_id] = NULL; + v_cc_items.erase(v_cc_items.begin()+cc_item_id); + } } +#ifdef DEBUG_CC + else + printf("CComponentsForm: %s removing cc_Item not possible, v_cc_items is empty...\n", __FUNCTION__); +#endif } void CComponentsForm::paint(bool do_save_bg) From c039b4ae5cd20d8a469702204bbe7a0e497f8cf2 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Sun, 25 Nov 2012 14:37:36 +0100 Subject: [PATCH 130/224] CComponentsHeader: move init of items ito cobstructors Inherited methodes like insertCCItem, removeCCItem ... don't work nice, if cc-items are ititialized too late. If we init in constructors, we can manipulate header items, otherwise not. clearCCItems() is to find in the destructor, and should be called with delete. Handle with care! --- src/gui/components/components.cpp | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/gui/components/components.cpp b/src/gui/components/components.cpp index 0988f1286..7201a3a60 100644 --- a/src/gui/components/components.cpp +++ b/src/gui/components/components.cpp @@ -1607,7 +1607,7 @@ void CComponentsForm::insertCCItem(const uint& cc_item_id, CComponentsItem* cc_I void CComponentsForm::removeCCItem(const uint& cc_item_id) { if (!v_cc_items.empty()){ - if (v_cc_items.at(cc_item_id)) { + if (v_cc_items[cc_item_id]) { delete v_cc_items[cc_item_id]; v_cc_items[cc_item_id] = NULL; v_cc_items.erase(v_cc_items.begin()+cc_item_id); @@ -1718,6 +1718,8 @@ CComponentsHeader::CComponentsHeader( const int x_pos, const int y_pos, const in cch_text = caption; cch_icon_name = icon_name; cch_buttons = buttons; + initCCHDefaultButtons(); + initCCHItems(); } CComponentsHeader::CComponentsHeader( const int x_pos, const int y_pos, const int w, const int h, neutrino_locale_t caption_locale, const char* icon_name, const int buttons, bool has_shadow, @@ -1738,6 +1740,8 @@ CComponentsHeader::CComponentsHeader( const int x_pos, const int y_pos, const in cch_locale_text = caption_locale; cch_icon_name = icon_name; cch_buttons = buttons; + initCCHDefaultButtons(); + initCCHItems(); } #if 0 @@ -1772,8 +1776,7 @@ void CComponentsHeader::initVarHeader() //CComponentsForm initVarForm(); - height = cch_font->getHeight(); - + height = cch_font->getHeight(); col_body = COL_MENUHEAD_PLUS_0; corner_rad = RADIUS_LARGE, corner_type = CORNER_TOP; @@ -1858,8 +1861,6 @@ void CComponentsHeader::initCCButtonFormSize() void CComponentsHeader::initCCHeaderButtons() { - initCCHDefaultButtons(); - //exit if no button defined if (v_cch_btn.empty()) return; @@ -1890,8 +1891,10 @@ void CComponentsHeader::initCCHeaderText() void CComponentsHeader::initCCHItems() { - //clean up first possible old item objects, includes delete and clean up vector - clearCCItems(); +#if 0 + //clean up first possible old item objects, includes delete and clean up vector + clearCCItems(); +#endif //init icon initCCHeaderIcon(); @@ -1917,9 +1920,6 @@ void CComponentsHeader::paint(bool do_save_bg) //paint body paintInit(do_save_bg); - //init default header ccitems - initCCHItems(); - //paint paintCCItems(); } From 264f4bb9513345454ae2f25c4962180aa0fb6310 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Sun, 25 Nov 2012 14:53:18 +0100 Subject: [PATCH 131/224] CTestMenu: add example to exchange text with an image-item, for header --- src/gui/test_menu.cpp | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/src/gui/test_menu.cpp b/src/gui/test_menu.cpp index f293a8f7d..dd173dd7d 100644 --- a/src/gui/test_menu.cpp +++ b/src/gui/test_menu.cpp @@ -426,9 +426,11 @@ int CTestMenu::exec(CMenuTarget* parent, const std::string &actionKey) int hh = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]->getHeight(); if (header == NULL) header = new CComponentsHeader (100, 50, 500, hh, "Test-Header", NEUTRINO_ICON_INFO, CComponentsHeader::CC_BTN_HELP | CComponentsHeader::CC_BTN_EXIT | CComponentsHeader::CC_BTN_MENU); - else //For existing instances it's recommended - //to remove old button icons before add new buttons, otherwise icons will be appended. - header->removeHeaderButtons(); +// else //For existing instances it's recommended +// //to remove old button icons before add new buttons, otherwise icons will be appended. +// header->removeHeaderButtons(); + +// example to manipulate header items // header->setFrameThickness(5); // header->setColorFrame(COL_WHITE); // header->setCornerType(CORNER_TOP); @@ -436,11 +438,18 @@ int CTestMenu::exec(CMenuTarget* parent, const std::string &actionKey) // header->addHeaderButton(NEUTRINO_ICON_BUTTON_RED); // header->addHeaderButton(NEUTRINO_ICON_BUTTON_HELP); // header->addHeaderButton(NEUTRINO_ICON_BUTTON_MENU); - -// header->removeCCItem(2); //remove text -// CComponentsPicture *logo = new CComponentsPicture(5, 0, 100, g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]->getHeight(), "/tmp/media/sda1/var/share/tuxbox/neutrino/icons/logo/100850010.png"); -// logo->doPaintBg(false); -// header->insertCCItem(0, logo); //replace text with logo + +// example to replace the text item with an image item +// get text x position + int logo_x = header->getCCItem(1)->getXPos(); +// remove text item + header->removeCCItem(1); //then remove text item +// create picture object with the last x position of text + CComponentsPicture *logo = new CComponentsPicture(logo_x, 0, 100, g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]->getHeight(), "/share/tuxbox/neutrino/icons/hint_tvmode.png"); +// set the transparent background for picture item + logo->doPaintBg(false); +// insert the ne object + header->insertCCItem(1, logo); //replace text with logo if (!header->isPainted()) From 79dd6456b099b8e4c5b9d0c6a008eb5907303b9b Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Sun, 25 Nov 2012 15:36:36 +0100 Subject: [PATCH 132/224] CComponentsHeader: add enums for header items --- src/gui/components/cc.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/gui/components/cc.h b/src/gui/components/cc.h index 8a2e2d79d..6f8275629 100644 --- a/src/gui/components/cc.h +++ b/src/gui/components/cc.h @@ -520,6 +520,13 @@ class CComponentsHeader : public CComponentsForm CC_BTN_EXIT = 0x80 }; + + enum + { + CC_HEADER_ITEM_ICON = 0, + CC_HEADER_ITEM_TEXT = 1, + CC_HEADER_ITEM_BUTTONS = 2 + }; CComponentsHeader(); CComponentsHeader(const int x_pos, const int y_pos, const int w, const int h = 0, const std::string& caption = "header", const char* icon_name = NULL, const int buttons = 0, bool has_shadow = CC_SHADOW_OFF, fb_pixel_t color_frame = COL_MENUCONTENT_PLUS_6, fb_pixel_t color_body = COL_MENUHEAD_PLUS_0, fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0); From 9150088088e2780453145da7fb0f1c2f9b918227 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Sun, 25 Nov 2012 15:41:27 +0100 Subject: [PATCH 133/224] CComponentsHeader: fix broken addHeaderButton() and removeHeaderButtons() Simple push_back() has no effect, buttons must be initialized and destroy of cch_btn_obj is an easy way for clean up. --- src/gui/components/components.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/gui/components/components.cpp b/src/gui/components/components.cpp index 7201a3a60..eb445a057 100644 --- a/src/gui/components/components.cpp +++ b/src/gui/components/components.cpp @@ -1826,14 +1826,21 @@ void CComponentsHeader::initCCHeaderIcon() void CComponentsHeader::addHeaderButton(const std::string& button_name) { + if (cch_btn_obj){ + delete cch_btn_obj; + cch_btn_obj = NULL; + } v_cch_btn.push_back(button_name); + initCCHeaderButtons(); } void CComponentsHeader::removeHeaderButtons() { v_cch_btn.clear(); - if (cch_btn_obj) - cch_btn_obj->removeAllIcons(); + if (cch_btn_obj){ + delete cch_btn_obj; + cch_btn_obj = NULL; + } } void CComponentsHeader::initCCHDefaultButtons() From 14393b36d90607c56efac243a727fb7bf0b9f687 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Sun, 25 Nov 2012 15:42:21 +0100 Subject: [PATCH 134/224] CTestMenu: add sample code for removeHeaderButtons() --- src/gui/test_menu.cpp | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/gui/test_menu.cpp b/src/gui/test_menu.cpp index dd173dd7d..b27014f4b 100644 --- a/src/gui/test_menu.cpp +++ b/src/gui/test_menu.cpp @@ -424,8 +424,10 @@ int CTestMenu::exec(CMenuTarget* parent, const std::string &actionKey) } else if (actionKey == "header"){ int hh = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]->getHeight(); - if (header == NULL) + if (header == NULL){ header = new CComponentsHeader (100, 50, 500, hh, "Test-Header", NEUTRINO_ICON_INFO, CComponentsHeader::CC_BTN_HELP | CComponentsHeader::CC_BTN_EXIT | CComponentsHeader::CC_BTN_MENU); +// header->addHeaderButton(NEUTRINO_ICON_BUTTON_RED); + } // else //For existing instances it's recommended // //to remove old button icons before add new buttons, otherwise icons will be appended. // header->removeHeaderButtons(); @@ -434,16 +436,18 @@ int CTestMenu::exec(CMenuTarget* parent, const std::string &actionKey) // header->setFrameThickness(5); // header->setColorFrame(COL_WHITE); // header->setCornerType(CORNER_TOP); + +// change text of header // header->setHeaderText("Test"); + +// add any other button icon // header->addHeaderButton(NEUTRINO_ICON_BUTTON_RED); -// header->addHeaderButton(NEUTRINO_ICON_BUTTON_HELP); -// header->addHeaderButton(NEUTRINO_ICON_BUTTON_MENU); // example to replace the text item with an image item // get text x position - int logo_x = header->getCCItem(1)->getXPos(); + int logo_x = header->getCCItem(CComponentsHeader::CC_HEADER_ITEM_TEXT)->getXPos(); // remove text item - header->removeCCItem(1); //then remove text item + header->removeCCItem(CComponentsHeader::CC_HEADER_ITEM_TEXT); //then remove text item // create picture object with the last x position of text CComponentsPicture *logo = new CComponentsPicture(logo_x, 0, 100, g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]->getHeight(), "/share/tuxbox/neutrino/icons/hint_tvmode.png"); // set the transparent background for picture item From 764dbcd4293dd26f64175c78e8c1a4492c663b36 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Sun, 25 Nov 2012 22:12:02 +0100 Subject: [PATCH 135/224] CComponentsPicture: add missing define of dimensions after init --- src/gui/components/components.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gui/components/components.cpp b/src/gui/components/components.cpp index eb445a057..50019702b 100644 --- a/src/gui/components/components.cpp +++ b/src/gui/components/components.cpp @@ -883,8 +883,8 @@ void CComponentsPicture::initVarPicture() } int sw = (shadow ? shadow_w :0); - width = max(pic_width, width) + sw ; - height = max(pic_height, height) + sw ; + width = max(max(pic_width, pic_max_w), width) + sw ; + height = max(max(pic_height, pic_max_h), height) + sw ; } void CComponentsPicture::paint(bool do_save_bg) From a9caa07318c7d6402fb89a7ff4585d296f5480f2 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Sun, 25 Nov 2012 22:26:27 +0100 Subject: [PATCH 136/224] CComponentsHeader: reset icon width, if no icon is defined --- src/gui/components/components.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/components/components.cpp b/src/gui/components/components.cpp index 50019702b..a6697f328 100644 --- a/src/gui/components/components.cpp +++ b/src/gui/components/components.cpp @@ -1800,7 +1800,7 @@ void CComponentsHeader::setHeaderIcon(const char* icon_name) void CComponentsHeader::initCCHeaderIcon() { if (cch_icon_name == NULL) { -// cch_icon_w = 5; + cch_icon_w = cch_btn_offset; return; } From b9dd3e21bf0b93c3fcd5062355ae78e7c4915471 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Mon, 26 Nov 2012 10:15:24 +0100 Subject: [PATCH 137/224] CComponentsForm: add virtual members to replace cc-item --- src/gui/components/cc.h | 2 ++ src/gui/components/components.cpp | 21 +++++++++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/src/gui/components/cc.h b/src/gui/components/cc.h index 6f8275629..320a6294d 100644 --- a/src/gui/components/cc.h +++ b/src/gui/components/cc.h @@ -444,6 +444,8 @@ class CComponentsForm : public CComponentsItem virtual void addCCItem(CComponentsItem* cc_Item); virtual void insertCCItem(const uint& cc_item_id, CComponentsItem* cc_Item); virtual void removeCCItem(const uint& cc_item_id); + virtual void replaceCCItem(const uint& cc_item_id, CComponentsItem* new_cc_Item); + virtual void replaceCCItem(CComponentsItem* old_cc_Item, CComponentsItem* new_cc_Item); virtual int getCCItemId(CComponentsItem* cc_Item); virtual CComponentsItem* getCCItem(const uint& cc_item_id); virtual void paintCCItems(); diff --git a/src/gui/components/components.cpp b/src/gui/components/components.cpp index a6697f328..b024ac7b3 100644 --- a/src/gui/components/components.cpp +++ b/src/gui/components/components.cpp @@ -1585,6 +1585,27 @@ CComponentsItem* CComponentsForm::getCCItem(const uint& cc_item_id) return NULL; } +void CComponentsForm::replaceCCItem(const uint& cc_item_id, CComponentsItem* new_cc_Item) +{ + if (!v_cc_items.empty()){ + if (v_cc_items[cc_item_id]){ + delete v_cc_items[cc_item_id]; + v_cc_items[cc_item_id] = NULL; + v_cc_items[cc_item_id] = new_cc_Item; + } + } +#ifdef DEBUG_CC + else + printf("CComponentsForm: %s replace cc_Item not possible, v_cc_items is empty\n", __FUNCTION__); +#endif + +} + +void CComponentsForm::replaceCCItem(CComponentsItem* old_cc_Item, CComponentsItem* new_cc_Item) +{ + replaceCCItem(getCCItemId(old_cc_Item), new_cc_Item); +} + void CComponentsForm::insertCCItem(const uint& cc_item_id, CComponentsItem* cc_Item) { From 6cdb948dd4892be0add0391761defc8d7fa70612 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Mon, 26 Nov 2012 10:27:03 +0100 Subject: [PATCH 138/224] CComponents: change of debug marking for better recognition during logging --- src/gui/components/components.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/gui/components/components.cpp b/src/gui/components/components.cpp index b024ac7b3..eebefe7ad 100644 --- a/src/gui/components/components.cpp +++ b/src/gui/components/components.cpp @@ -859,7 +859,7 @@ void CComponentsPicture::initVarPicture() #ifdef DEBUG_CC if (pic_width == 0 || pic_height == 0) - printf("CComponentsPicture: %s file: %s, no icon dimensions found! width = %d, height = %d\n", __FUNCTION__, pic_name.c_str(), pic_width, pic_height); + printf("[CComponentsPicture] %s file: %s, no icon dimensions found! width = %d, height = %d\n", __FUNCTION__, pic_name.c_str(), pic_width, pic_height); #endif pic_x += fr_thickness; @@ -1596,7 +1596,7 @@ void CComponentsForm::replaceCCItem(const uint& cc_item_id, CComponentsItem* new } #ifdef DEBUG_CC else - printf("CComponentsForm: %s replace cc_Item not possible, v_cc_items is empty\n", __FUNCTION__); + printf("[CComponentsForm] %s replace cc_Item not possible, v_cc_items is empty\n", __FUNCTION__); #endif } @@ -1611,7 +1611,7 @@ void CComponentsForm::insertCCItem(const uint& cc_item_id, CComponentsItem* cc_I if (cc_Item == NULL){ #ifdef DEBUG_CC - printf("CComponentsForm: %s parameter: cc_Item = %d...\n", __FUNCTION__, (int)cc_Item); + printf("[CComponentsForm] %s parameter: cc_Item = %d...\n", __FUNCTION__, (int)cc_Item); #endif return; } @@ -1619,7 +1619,7 @@ void CComponentsForm::insertCCItem(const uint& cc_item_id, CComponentsItem* cc_I if (v_cc_items.empty()){ v_cc_items.push_back(cc_Item); #ifdef DEBUG_CC - printf("CComponentsForm: %s insert cc_Item not possible, v_cc_items is empty, cc_Item added\n", __FUNCTION__); + printf("[CComponentsForm] %s insert cc_Item not possible, v_cc_items is empty, cc_Item added\n", __FUNCTION__); #endif }else v_cc_items.insert(v_cc_items.begin()+cc_item_id, cc_Item); @@ -1636,7 +1636,7 @@ void CComponentsForm::removeCCItem(const uint& cc_item_id) } #ifdef DEBUG_CC else - printf("CComponentsForm: %s removing cc_Item not possible, v_cc_items is empty...\n", __FUNCTION__); + printf("[CComponentsForm] %s removing cc_Item not possible, v_cc_items is empty...\n", __FUNCTION__); #endif } From 7ac1550277269fd8ee093c3eb349dd6092b9e8e0 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Sat, 16 Feb 2013 22:18:43 +0100 Subject: [PATCH 139/224] CMenuWidget: branch devel_cc Fix merge errors Some braces were lost during the last merges. --- src/gui/widget/menue.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/gui/widget/menue.cpp b/src/gui/widget/menue.cpp index d3fa30e38..6137caf3f 100644 --- a/src/gui/widget/menue.cpp +++ b/src/gui/widget/menue.cpp @@ -1151,6 +1151,7 @@ void CMenuWidget::paintHint(int pos) details_line->setHMarkTop(imarkh); details_line->setHMarkDown(markh); details_line->syncSysColors(); + } #if 0 details_line->paint(savescreen); #endif @@ -1166,6 +1167,7 @@ void CMenuWidget::paintHint(int pos) info_box->syncSysColors(); info_box->setShadowOnOff(CC_SHADOW_ON); info_box->setPicture(item->hintIcon); + } #if 0 /* force full paint - menu-over i.e. option chooser with pulldown can overwrite */ info_box->paint(savescreen, true); From fa9ffdd46ebdb183c535c0d4739f4907b3595637 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Fri, 30 Nov 2012 22:53:55 +0100 Subject: [PATCH 140/224] CComponentsWindow: add sub class CComponentsWindow --- src/gui/components/cc.h | 27 ++++++++++++ src/gui/components/components.cpp | 69 ++++++++++++++++++++++++++++--- src/gui/test_menu.cpp | 24 +++++++++++ src/gui/test_menu.h | 1 + 4 files changed, 116 insertions(+), 5 deletions(-) diff --git a/src/gui/components/cc.h b/src/gui/components/cc.h index 320a6294d..2be90bf75 100644 --- a/src/gui/components/cc.h +++ b/src/gui/components/cc.h @@ -547,4 +547,31 @@ class CComponentsHeader : public CComponentsForm void removeHeaderButtons(); }; +class CComponentsWindow : public CComponentsForm +{ + private: + CComponentsHeader * ccw_head; + std::string ccw_caption; + const char* ccw_icon_name; + + void initHeader(); + void initCCWItems(); + + protected: + void initVarWindow(); + + public: + enum + { + CC_WINDOW_ITEM_HEADER = 0 + }; + CComponentsWindow(); + ~CComponentsWindow(); + + void paint(bool do_save_bg = CC_SAVE_SCREEN_YES); + void refresh(){initCCWItems();}; + void setWindowCaption(const std::string& text){ccw_caption = text;}; + void setWindowIcon(const char* iconname){ccw_icon_name = iconname;}; +}; + #endif diff --git a/src/gui/components/components.cpp b/src/gui/components/components.cpp index eebefe7ad..03319238e 100644 --- a/src/gui/components/components.cpp +++ b/src/gui/components/components.cpp @@ -359,6 +359,7 @@ void CComponentsText::initCCText() ct_textbox->setWindowPos(ct_box); ct_textbox->setTextBorderWidth(0); ct_textbox->enableBackgroundPaint(false); + ct_textbox->setBackGroundColor(col_body); ct_textbox->setBackGroundRadius(corner_rad-fr_thickness, corner_type); ct_textbox->setTextColor(ct_col_text); ct_textbox->setWindowMaxDimensions(ct_box->iWidth, ct_box->iHeight); @@ -404,6 +405,7 @@ void CComponentsText::paint(bool do_save_bg) void CComponentsText::hide(bool no_restore) { + if (ct_textbox) ct_textbox->hide(); hideCCItem(no_restore); @@ -1532,7 +1534,9 @@ void CComponentsForm::clearCCItems() { if (v_cc_items.empty()) return; - +#ifdef DEBUG_CC + printf("[CComponentsForm] %s... cleanup %d form cc-items\n", __FUNCTION__, v_cc_items.size()); +#endif for(size_t i=0; isetTextFont(cch_font); cch_text_obj->setTextColor(cch_col_text); + cch_text_obj->setColorBody(col_body); cch_text_obj->doPaintBg(false); //corner of text item @@ -1920,10 +1925,10 @@ void CComponentsHeader::initCCHeaderText() void CComponentsHeader::initCCHItems() { #if 0 - //clean up first possible old item objects, includes delete and clean up vector - clearCCItems(); + //clean up first possible old item objects, includes delete and clean up vector + clearCCItems(); #endif - + //init icon initCCHeaderIcon(); @@ -1942,7 +1947,7 @@ void CComponentsHeader::initCCHItems() addCCItem(cch_btn_obj); //buttons } - + void CComponentsHeader::paint(bool do_save_bg) { //paint body @@ -2121,3 +2126,57 @@ void CComponentsIconForm::paint(bool do_save_bg) //paint paintCCItems(); } + +//------------------------------------------------------------------------------------------------------- +//sub class CComponentsWindow inherit from CComponentsForm +CComponentsWindow::CComponentsWindow() +{ + initVarWindow(); +} + +void CComponentsWindow::initVarWindow() +{ + //CComponentsForm + initVarForm(); + + ccw_head = NULL; + ccw_caption = ""; + ccw_icon_name = NULL; + + setShadowOnOff(true); +} + +CComponentsWindow::~CComponentsWindow() +{ + if (ccw_head) + delete ccw_head; +} + +void CComponentsWindow::initHeader() +{ + if (ccw_head == NULL) + ccw_head = new CComponentsHeader(); + + ccw_head->setXPos(0); + ccw_head->setYPos(0); + ccw_head->setWidth(width); + ccw_head->setHeaderIcon(ccw_icon_name); + ccw_head->setHeaderText(ccw_caption); +} + +void CComponentsWindow::initCCWItems() +{ + initHeader(); + + if (ccw_head) + addCCItem(ccw_head); +} + +void CComponentsWindow::paint(bool do_save_bg) +{ + //paint body + paintInit(do_save_bg); + + //paint + paintCCItems(); +} diff --git a/src/gui/test_menu.cpp b/src/gui/test_menu.cpp index b27014f4b..ecdef3651 100644 --- a/src/gui/test_menu.cpp +++ b/src/gui/test_menu.cpp @@ -70,6 +70,7 @@ CTestMenu::CTestMenu() txt = NULL; header = NULL; iconform = NULL; + window = NULL; } CTestMenu::~CTestMenu() @@ -82,6 +83,7 @@ CTestMenu::~CTestMenu() delete txt; delete header; delete iconform; + delete window; } int CTestMenu::exec(CMenuTarget* parent, const std::string &actionKey) @@ -498,6 +500,27 @@ int CTestMenu::exec(CMenuTarget* parent, const std::string &actionKey) } return res; } + else if (actionKey == "window"){ + if (window == NULL){ + window = new CComponentsWindow(); + window->setWindowCaption("|.....................|"); + window->setDimensionsAll(50, 50, 800, 480); + window->setWindowIcon(NEUTRINO_ICON_INFO); + } + else{ +// window->setDimensionsAll(50, 50, 800, 480); + window->setWindowIcon(NEUTRINO_ICON_LOCK); + window->setWindowCaption("Test"); + } + window->refresh(); + + if (!window->isPainted()) + window->paint(); + else + window->hide(); + + return res; + } showTestMenu(); @@ -546,6 +569,7 @@ void CTestMenu::showCCTests(CMenuWidget *widget) widget->addItem(new CMenuForwarderNonLocalized("Text", true, NULL, this, "text")); widget->addItem(new CMenuForwarderNonLocalized("Header", true, NULL, this, "header")); widget->addItem(new CMenuForwarderNonLocalized("Icon-Form", true, NULL, this, "iconform")); + widget->addItem(new CMenuForwarderNonLocalized("Window", true, NULL, this, "window")); } void CTestMenu::showHWTests(CMenuWidget *widget) diff --git a/src/gui/test_menu.h b/src/gui/test_menu.h index c6f30a865..7b582286e 100644 --- a/src/gui/test_menu.h +++ b/src/gui/test_menu.h @@ -47,6 +47,7 @@ class CTestMenu : public CMenuTarget CComponentsText *txt; CComponentsHeader *header; CComponentsIconForm *iconform; + CComponentsWindow *window; int width, selected; void showTestMenu(); From 9605d7438ff0a4788fb516161db3051fce700c69 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Fri, 30 Nov 2012 22:55:04 +0100 Subject: [PATCH 141/224] CComponentsHeader: add member 'setHeaderButtons()' Gives possibility to set default button types, possible parameter types are: CC_BTN_HELP, CC_BTN_INFO, CC_BTN_MENU, CC_BTN_EXIT --- src/gui/components/cc.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/gui/components/cc.h b/src/gui/components/cc.h index 2be90bf75..c6cd59dbc 100644 --- a/src/gui/components/cc.h +++ b/src/gui/components/cc.h @@ -545,6 +545,7 @@ class CComponentsHeader : public CComponentsForm void setHeaderIcon(const char* icon_name); void addHeaderButton(const std::string& button_name); void removeHeaderButtons(); + void setHeaderButtons(const int buttons){cch_buttons = buttons;}; }; class CComponentsWindow : public CComponentsForm From 6175fd989dbd52e5047fa4b6e00e28f8347ab832 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Tue, 4 Dec 2012 19:11:01 +0100 Subject: [PATCH 142/224] CComponentsItem: add members getItemType(), cc_item_type Small helper for detection of item types. This could be useful, if it is necessary, to track these at runtime or debugging, because it's not really detectable, which items just be used. e.g forms could contain very much items, but many of these items are inherited from CComponentsItem and an assignment to a certain subclass. --- src/gui/components/cc.h | 20 +++++++++++++++++++- src/gui/components/components.cpp | 24 ++++++++++++++++++++++++ 2 files changed, 43 insertions(+), 1 deletion(-) diff --git a/src/gui/components/cc.h b/src/gui/components/cc.h index c6cd59dbc..b9239b5ef 100644 --- a/src/gui/components/cc.h +++ b/src/gui/components/cc.h @@ -172,17 +172,35 @@ class CComponents class CComponentsItem : public CComponents { protected: + int cc_item_type; + void hideCCItem(bool no_restore = false); void paintInit(bool do_save_bg); void initVarItem(); public: + enum + { + CC_ITEMTYPE_BASE, + CC_ITEMTYPE_PICTURE, + CC_ITEMTYPE_TEXT, + CC_ITEMTYPE_TEXT_INFOBOX, + CC_ITEMTYPE_SHAPE_SQUARE, + CC_ITEMTYPE_SHAPE_CIRCLE, + CC_ITEMTYPE_PIP, + CC_ITEMTYPE_FRM, + CC_ITEMTYPE_FRM_HERADER, + CC_ITEMTYPE_FRM_ICONFORM, + CC_ITEMTYPE_FRM_WINDOW, + + CC_ITEMTYPES + }; CComponentsItem(); virtual void paint(bool do_save_bg = CC_SAVE_SCREEN_YES) = 0; virtual void hide(bool no_restore = false); virtual void kill(); - + virtual int getItemType(); virtual void syncSysColors(); }; diff --git a/src/gui/components/components.cpp b/src/gui/components/components.cpp index 03319238e..6fe80c807 100644 --- a/src/gui/components/components.cpp +++ b/src/gui/components/components.cpp @@ -171,6 +171,7 @@ CComponentsItem::CComponentsItem() { //CComponentsItem initVarItem(); + cc_item_type = CC_ITEMTYPE_BASE; } // y @@ -267,6 +268,19 @@ void CComponentsItem::syncSysColors() col_frame = COL_MENUCONTENT_PLUS_6; } +//returns current item element type, if no available, return -1 as unknown type +int CComponentsItem::getItemType() +{ + for(int i =0; i< (CC_ITEMTYPES) ;i++){ + if (i == cc_item_type) + return i; + } +#ifdef DEBUG_CC + printf("[CComponentsItem] %s: unknown item type requested...\n", __FUNCTION__); +#endif + return -1; +} + //------------------------------------------------------------------------------------------------------- //sub class CComponentsText from CComponentsItem @@ -316,6 +330,7 @@ void CComponentsText::initVarText() { //CComponents, CComponentsItem initVarItem(); + cc_item_type = CC_ITEMTYPE_TEXT; //CComponentsText ct_font = NULL; @@ -466,6 +481,7 @@ void CComponentsInfoBox::initVarInfobox() { //CComponents, CComponentsItem, CComponentsText initVarText(); + cc_item_type = CC_ITEMTYPE_TEXT_INFOBOX; //CComponentsInfoBox pic = NULL; @@ -524,6 +540,7 @@ CComponentsShapeSquare::CComponentsShapeSquare(const int x_pos, const int y_pos, { //CComponentsItem initVarItem(); + cc_item_type = CC_ITEMTYPE_SHAPE_SQUARE; x = x_pos; y = y_pos; @@ -549,6 +566,7 @@ CComponentsShapeCircle::CComponentsShapeCircle( int x_pos, int y_pos, int diam, { //CComponents, CComponentsItem initVarItem(); + cc_item_type = CC_ITEMTYPE_SHAPE_CIRCLE; //CComponents x = x_pos; @@ -725,6 +743,7 @@ CComponentsPIP::CComponentsPIP( const int x_pos, const int y_pos, const int perc { //CComponents, CComponentsItem initVarItem(); + cc_item_type = CC_ITEMTYPE_PIP; //CComponentsPIP screen_w = frameBuffer->getScreenWidth(true); @@ -784,6 +803,7 @@ void CComponentsPicture::init( int x_pos, int y_pos, const string& image_name, c { //CComponents, CComponentsItem initVarItem(); + cc_item_type = CC_ITEMTYPE_PICTURE; //CComponentsPicture pic_name = image_name; @@ -1550,6 +1570,7 @@ void CComponentsForm::initVarForm() { //CComponentsItem initVarItem(); + //simple default dimensions x = 0; @@ -1801,6 +1822,7 @@ void CComponentsHeader::initVarHeader() //CComponentsForm initVarForm(); + cc_item_type = CC_ITEMTYPE_FRM_HERADER; height = cch_font->getHeight(); col_body = COL_MENUHEAD_PLUS_0; corner_rad = RADIUS_LARGE, @@ -1986,6 +2008,7 @@ void CComponentsIconForm::initVarIconForm() { //CComponentsForm initVarForm(); + cc_item_type = CC_ITEMTYPE_FRM_ICONFORM; //set default width and height to 0, this causes a dynamic adaptation of width and height of form width = 0; @@ -2138,6 +2161,7 @@ void CComponentsWindow::initVarWindow() { //CComponentsForm initVarForm(); + cc_item_type = CC_ITEMTYPE_FRM_WINDOW; ccw_head = NULL; ccw_caption = ""; From ec0a91813a788669a588cb7adf45cdba4d3bce19 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Sun, 17 Feb 2013 00:42:18 +0100 Subject: [PATCH 143/224] CChannelList: devel_cc fix merge errors var full_width was lost during merge, this fixes header and details width --- src/gui/channellist.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gui/channellist.cpp b/src/gui/channellist.cpp index bb8d820b6..2061aa420 100644 --- a/src/gui/channellist.cpp +++ b/src/gui/channellist.cpp @@ -1668,7 +1668,7 @@ void CChannelList::paintItem2DetailsLine (int pos) if (ibox == NULL) ibox = new CComponentsInfoBox(x, y + height + 2, width, info_height); if (ibox){ - ibox->setDimensionsAll(x, ypos2, width, info_height); + ibox->setDimensionsAll(x, ypos2, full_width, info_height); ibox->setFrameThickness(2); ibox->setCornerRadius(RADIUS_LARGE); ibox->setShadowOnOff(CC_SHADOW_OFF); @@ -1996,7 +1996,7 @@ void CChannelList::paintHead() { if (clHead == NULL) { clHead = new CComponentsTitleBar(); - clHead->setDimensionsAll(x, y, width, theight); + clHead->setDimensionsAll(x, y, full_width, theight); clHead->addText(name); From 2940c4e5f63fd8921926774e0916cf84eba1ed4c Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Sun, 17 Feb 2013 16:49:33 +0100 Subject: [PATCH 144/224] CComponents: add more debug output and fix typo in enum CC_ITEMTYPES --- src/gui/components/cc.h | 2 +- src/gui/components/components.cpp | 13 ++++++++++--- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/gui/components/cc.h b/src/gui/components/cc.h index b9239b5ef..ab7e02575 100644 --- a/src/gui/components/cc.h +++ b/src/gui/components/cc.h @@ -189,7 +189,7 @@ class CComponentsItem : public CComponents CC_ITEMTYPE_SHAPE_CIRCLE, CC_ITEMTYPE_PIP, CC_ITEMTYPE_FRM, - CC_ITEMTYPE_FRM_HERADER, + CC_ITEMTYPE_FRM_HEADER, CC_ITEMTYPE_FRM_ICONFORM, CC_ITEMTYPE_FRM_WINDOW, diff --git a/src/gui/components/components.cpp b/src/gui/components/components.cpp index 6fe80c807..37a415e2f 100644 --- a/src/gui/components/components.cpp +++ b/src/gui/components/components.cpp @@ -92,13 +92,18 @@ void CComponents::paintFbItems(bool do_save_bg) if (firstPaint && do_save_bg) { for(size_t i=0; igetHeight(); col_body = COL_MENUHEAD_PLUS_0; corner_rad = RADIUS_LARGE, From 399eb696d67e481037f46d52cfc0678e9b37239e Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Sun, 17 Feb 2013 23:12:42 +0100 Subject: [PATCH 145/224] CComponents: add some new variables and parameters and modifie debug output - add var for object index can be usefull for identifications of objects for focus operations soon - add default value for screen size (30%) to CComponentsPIP constructor most size we mostly use is 30% of size - add setters for screen_w and screen_h also this can be usefull t adapt screen sizes e.g. during runtime operations --- src/gui/components/cc.h | 6 +++++- src/gui/components/components.cpp | 13 ++++++------- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/src/gui/components/cc.h b/src/gui/components/cc.h index ab7e02575..9e4dd3da2 100644 --- a/src/gui/components/cc.h +++ b/src/gui/components/cc.h @@ -110,6 +110,7 @@ typedef struct comp_element_data_t #define CC_SAVE_SCREEN_YES true #define CC_SAVE_SCREEN_NO false +#define CC_NO_INDEX -1 class CComponents { @@ -173,6 +174,7 @@ class CComponentsItem : public CComponents { protected: int cc_item_type; + int cc_item_index; void hideCCItem(bool no_restore = false); void paintInit(bool do_save_bg); @@ -335,11 +337,13 @@ class CComponentsPIP : public CComponentsItem private: int screen_w, screen_h; public: - CComponentsPIP( const int x_pos, const int y_pos, const int percent, bool has_shadow = CC_SHADOW_OFF); + CComponentsPIP( const int x_pos, const int y_pos, const int percent = 30, bool has_shadow = CC_SHADOW_OFF); ~CComponentsPIP(); void paint(bool do_save_bg = CC_SAVE_SCREEN_YES); void hide(bool no_restore = false); + void setScreenWidth(int screen_width){screen_w = screen_width;}; + void setScreenHeight(int screen_heigth){screen_h = screen_heigth;}; }; diff --git a/src/gui/components/components.cpp b/src/gui/components/components.cpp index 37a415e2f..0c5c223aa 100644 --- a/src/gui/components/components.cpp +++ b/src/gui/components/components.cpp @@ -93,7 +93,7 @@ void CComponents::paintFbItems(bool do_save_bg) for(size_t i=0; isave screen: %d, fbdata_type: %d\n", __FUNCTION__, __LINE__, firstPaint, v_fbdata[i].fbdata_type); #endif saved_screen.x = v_fbdata[i].x; saved_screen.y = v_fbdata[i].y; @@ -101,10 +101,6 @@ void CComponents::paintFbItems(bool do_save_bg) saved_screen.dy = v_fbdata[i].dy; clearSavedScreen(); saved_screen.pixbuf = getScreen(saved_screen.x, saved_screen.y, saved_screen.dx, saved_screen.dy); -#ifdef DEBUG_CC - printf("[CComponents]\n#####[%s - %d], fbdata_[%d] \nx = %d\ny = %d\ndx = %d\n dy = %d\n\n", __FUNCTION__, __LINE__, i, v_fbdata[i].x, v_fbdata[i].y, v_fbdata[i].dx, v_fbdata[i].dy); -#endif - firstPaint = false; break; } @@ -113,7 +109,9 @@ void CComponents::paintFbItems(bool do_save_bg) for(size_t i=0; i< v_fbdata.size() ;i++){ int fbtype = v_fbdata[i].fbdata_type; - +#ifdef DEBUG_CC + printf(" [CComponents]\n [%s - %d], fbdata_[%d] \n x = %d\n y = %d\n dx = %d\n dy = %d\n", __FUNCTION__, __LINE__, i, v_fbdata[i].x, v_fbdata[i].y, v_fbdata[i].dx, v_fbdata[i].dy); +#endif if (firstPaint){ if (do_save_bg && fbtype == CC_FBDATA_TYPE_LINE) @@ -190,6 +188,7 @@ void CComponentsItem::initVarItem() { //CComponents initVarBasic(); + cc_item_index = CC_NO_INDEX; } // Paint container background in cc-items with shadow, background and frame. @@ -216,7 +215,7 @@ void CComponentsItem::paintInit(bool do_save_bg) for(size_t i =0; i< (sizeof(fbdata) / sizeof(fbdata[0])) ;i++) v_fbdata.push_back(fbdata[i]); #ifdef DEBUG_CC - printf("[CComponentsItem] %s: init paint cc_item_type: %d\n", __FUNCTION__, cc_item_type); + printf("[CComponentsItem] %s:\ncc_item_type: %d\ncc_item_index = %d\nheight = %d\nwidth = %d\n", __FUNCTION__, cc_item_type, cc_item_index, height, width); #endif paintFbItems(do_save_bg); } From ce2e95cc5a611b5b8ad435a3ea8159ab1e1441e0 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Mon, 18 Feb 2013 08:55:50 +0100 Subject: [PATCH 146/224] CChannelList: revert of some implementations of CComponents classes Current state of CChannelList is mostly not compatible with CC-classes and implementations are to expensive at the moment, because more preparations are necessary. --- src/gui/channellist.cpp | 178 ++++++++++++++++++++++------------------ src/gui/channellist.h | 9 +- 2 files changed, 99 insertions(+), 88 deletions(-) diff --git a/src/gui/channellist.cpp b/src/gui/channellist.cpp index 2061aa420..b5d8795f8 100644 --- a/src/gui/channellist.cpp +++ b/src/gui/channellist.cpp @@ -116,10 +116,6 @@ CChannelList::CChannelList(const char * const pName, bool phistoryMode, bool _vl previous_channellist_additional = -1; eventFont = SNeutrinoSettings::FONT_TYPE_CHANNELLIST_EVENT; dline = NULL; - ibox = NULL; - clHead = NULL; - indexLogo = 0; - //printf("************ NEW LIST %s : %x\n", name.c_str(), (int) this);fflush(stdout); } @@ -128,8 +124,6 @@ CChannelList::~CChannelList() //printf("************ DELETE LIST %s : %x\n", name.c_str(), this);fflush(stdout); chanlist.clear(); delete dline; - delete ibox; - delete clHead; } void CChannelList::ClearList(void) @@ -626,9 +620,9 @@ int CChannelList::show() } else loop=false; } - else if( msg == CRCInput::RC_record) { //start direct recording from channellist + else if( msg == CRCInput::RC_record) { //start direct recording from channellist #if 0 - if(!CRecordManager::getInstance()->RecordingStatus(chanlist[selected]->channel_id)) + if(!CRecordManager::getInstance()->RecordingStatus(chanlist[selected]->channel_id)) { printf("[neutrino channellist] start direct recording...\n"); hide(); @@ -640,10 +634,10 @@ int CChannelList::show() loop=false; } else - DisplayInfoMessage(g_Locale->getText(LOCALE_CHANNELLIST_RECORDING_NOT_POSSIBLE)); // UTF-8 + DisplayInfoMessage(g_Locale->getText(LOCALE_CHANNELLIST_RECORDING_NOT_POSSIBLE)); // UTF-8 } - - } + + } #endif if(SameTP()) { printf("[neutrino channellist] start direct recording...\n"); @@ -653,7 +647,7 @@ int CChannelList::show() paint(); } else loop=false; - + } } else if( msg == CRCInput::RC_stop ) { //stopp recording @@ -809,7 +803,7 @@ int CChannelList::show() zapOnExit = true; loop = false; } - else if(g_settings.sms_channel) { + else if(g_settings.sms_channel) { unsigned char smsKey = 0; SMSKeyInput smsInput; smsInput.setTimeout(CHANNEL_SMSKEY_TIMEOUT); @@ -1408,7 +1402,7 @@ CZapitChannel* CChannelList::getPrevNextChannel(int key, unsigned int &sl) bactive--; bouquetList->activateBouquet(bactive, false); cactive = bouquetList->Bouquets[bactive]->channelList->getSize() - 1; - } else + } else --cactive; } else if ((key == g_settings.key_quickzap_up) || (key == CRCInput::RC_right)) { @@ -1515,20 +1509,6 @@ void CChannelList::quickZap(int key, bool /* cycle */) g_RCInput->clearRCMsg(); //FIXME test for n.103 } -std::string CChannelList::getInfoTextTransponder(int index) -{ - transponder t; - CServiceManager::getInstance()->GetTransponder(chanlist[index]->getTransponderId(), t); - - std::string desc = t.description(); - if(chanlist[index]->pname) - desc = desc + " (" + std::string(chanlist[index]->pname) + ")"; - else - desc = desc + " (" + CServiceManager::getInstance()->GetSatelliteName(chanlist[index]->getSatellitePosition()) + ")"; - - return desc; -} - void CChannelList::paintDetails(int index) { CChannelEvent *p_event = NULL; @@ -1541,14 +1521,13 @@ void CChannelList::paintDetails(int index) if (g_settings.colored_events_channellist == 2) colored_event_N = true; - if (displayNext) + if (displayNext) { p_event = &chanlist[index]->nextEvent; - else + } else { p_event = &chanlist[index]->currentEvent; + } - //infobox - if (ibox) - ibox->paint(false); + frameBuffer->paintBoxRel(x+2, y + height + 2, full_width-4, info_height - 4, COL_MENUCONTENTDARK_PLUS_0, RADIUS_LARGE);//round if (!p_event->description.empty()) { char cNoch[50] = {0}; // UTF-8 @@ -1615,8 +1594,16 @@ void CChannelList::paintDetails(int index) g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST_DESCR]->RenderString(x+ full_width- 10- noch_len, y+ height+ 5+ 2* fheight, noch_len, cNoch, colored_event_C ? COL_COLORED_EVENTS_CHANNELLIST : COL_MENUCONTENTDARK, 0, true); // UTF-8 } if(g_settings.channellist_foot == 0) { - std::string transp_info = getInfoTextTransponder(index); - g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST]->RenderString(x+ 10, y+ height+ 5+ 3*fheight, width - 30, transp_info.c_str(), COL_MENUCONTENTDARK, 0, true); + transponder t; + CServiceManager::getInstance()->GetTransponder(chanlist[index]->getTransponderId(), t); + + std::string desc = t.description(); + if(chanlist[index]->pname) + desc = desc + " (" + std::string(chanlist[index]->pname) + ")"; + else + desc = desc + " (" + CServiceManager::getInstance()->GetSatelliteName(chanlist[index]->getSatellitePosition()) + ")"; + + g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST]->RenderString(x+ 10, y+ height+ 5+ 3*fheight, full_width - 30, desc.c_str(), COL_MENUCONTENTDARK, 0, true); } else if( !displayNext && g_settings.channellist_foot == 1) { // next Event char buf[128] = {0}; @@ -1639,40 +1626,52 @@ void CChannelList::paintDetails(int index) void CChannelList::clearItem2DetailsLine() { - if (dline) - dline->kill(); //kill details line + paintItem2DetailsLine (-1, 0); } void CChannelList::paintItem2DetailsLine (int pos) { int xpos = x - ConnectLineBox_Width; int ypos1 = y + theight+0 + pos*fheight; - int ypos2 = y + height + INFO_BOX_Y_OFFSET; + int ypos2 = y + height; int ypos1a = ypos1 + (fheight/2)-2; int ypos2a = ypos2 + (info_height/2)-2; + fb_pixel_t col1 = COL_MENUCONTENT_PLUS_6; + if (dline) dline->kill(); //kill details line +// // Clear +// frameBuffer->paintBackgroundBoxRel(xpos,y, ConnectLineBox_Width, height+info_height + 1); - // init Line if detail info (and not valid list pos) - if (pos >= 0){ //pos >= 0 && chanlist[ch_index]->currentEvent.description != "") { + // paint Line if detail info (and not valid list pos) + if (pos >= 0) { //pos >= 0 && chanlist[ch_index]->currentEvent.description != "") { if(1) // FIXME why -> ? (!g_settings.channellist_extended) { + //details line if (dline == NULL) dline = new CComponentsDetailLine(xpos, ypos1a, ypos2a, fheight/2+1, info_height-RADIUS_LARGE*2); dline->setYPos(ypos1a); - dline->setHMarkDown(info_height-RADIUS_LARGE*2); //required if user has changed osd-settings (corner mode) dline->paint(); + + //info box frame + frameBuffer->paintBoxFrame(x, ypos2, full_width, info_height, 2, col1, RADIUS_LARGE); } + } +} - //infobox - if (ibox == NULL) - ibox = new CComponentsInfoBox(x, y + height + 2, width, info_height); - if (ibox){ - ibox->setDimensionsAll(x, ypos2, full_width, info_height); - ibox->setFrameThickness(2); - ibox->setCornerRadius(RADIUS_LARGE); - ibox->setShadowOnOff(CC_SHADOW_OFF); - ibox->syncSysColors(); +void CChannelList::showChannelLogo() +{ + if(g_settings.infobar_show_channellogo){ + static int logo_w = 0; + static int logo_h = 0; + int logo_w_max = full_width / 4; + frameBuffer->paintBoxRel(x + full_width - logo_off - logo_w, y+(theight-logo_h)/2, logo_w, logo_h, COL_MENUHEAD_PLUS_0); + + std::string lname; + if(g_PicViewer->GetLogoName(chanlist[selected]->channel_id, chanlist[selected]->getName(), lname, &logo_w, &logo_h)) { + if((logo_h > theight) || (logo_w > logo_w_max)) + g_PicViewer->rescaleImageDimensions(&logo_w, &logo_h, logo_w_max, theight); + g_PicViewer->DisplayImage(lname, x + full_width - logo_off - logo_w, y+(theight-logo_h)/2, logo_w, logo_h); } } } @@ -1735,7 +1734,7 @@ void CChannelList::paintButtonBar(bool is_current) Bindex++; //manage record button bool do_record = CRecordManager::getInstance()->RecordingStatus(getActiveChannel_ChannelID()); - + if (g_settings.recording_type != RECORDING_OFF && !displayNext){ if (is_current && !do_record){ Button[Bindex].locale = LOCALE_MAINMENU_RECORDING; @@ -1862,34 +1861,34 @@ void CChannelList::paintItem(int pos) //record check rec_mode = CRecordManager::getInstance()->GetRecordMode(chanlist[curr]->channel_id); - + //set recording icon const char * rec_icon = ""; if (rec_mode & CRecordManager::RECMODE_REC) rec_icon = NEUTRINO_ICON_REC; else if (rec_mode & CRecordManager::RECMODE_TSHIFT) rec_icon = NEUTRINO_ICON_AUTO_SHIFT; - + //calculating icons int icon_x = (x+width-15-2) - RADIUS_LARGE/2; int r_icon_w=0; int s_icon_h=0; int s_icon_w=0; frameBuffer->getIconSize(NEUTRINO_ICON_SCRAMBLED, &s_icon_w, &s_icon_h); r_icon_w = ChannelList_Rec; int r_icon_x = icon_x; - + //paint scramble icon if(chan->scrambled) if (frameBuffer->paintIcon(NEUTRINO_ICON_SCRAMBLED, icon_x - s_icon_w, ypos, fheight))//ypos + (fheight - 16)/2); r_icon_x = r_icon_x - s_icon_w; - + //paint recording icon if (rec_mode != CRecordManager::RECMODE_OFF) frameBuffer->paintIcon(rec_icon, r_icon_x - r_icon_w, ypos, fheight);//ypos + (fheight - 16)/2); - + //paint buttons if (paintbuttons) paintButtonBar(iscurrent); - + int icon_space = r_icon_w+s_icon_w; //number @@ -1913,7 +1912,7 @@ void CChannelList::paintItem(int pos) int max_desc_len = width - numwidth - prg_offset - ch_name_len - 15 - 20; // 15 = scrollbar, 20 = spaces if (chan->scrambled || (g_settings.channellist_extended ||g_settings.channellist_epgtext_align_right)) max_desc_len -= icon_space; /* do we need space for the lock/rec icon? */ - + if (max_desc_len < 0) max_desc_len = 0; if ((int) ch_desc_len > max_desc_len) @@ -1994,31 +1993,46 @@ void CChannelList::paintItem(int pos) void CChannelList::paintHead() { - if (clHead == NULL) { - clHead = new CComponentsTitleBar(); - clHead->setDimensionsAll(x, y, full_width, theight); - - clHead->addText(name); - - clHead->addIcon(NEUTRINO_ICON_BUTTON_INFO, CC_ALIGN_RIGHT); - clHead->addIcon(NEUTRINO_ICON_BUTTON_MENU, CC_ALIGN_RIGHT); - if (g_settings.channellist_new_zap_mode) - clHead->addIcon(this->new_mode_active ? NEUTRINO_ICON_BUTTON_MUTE_ZAP_ACTIVE : NEUTRINO_ICON_BUTTON_MUTE_ZAP_INACTIVE, CC_ALIGN_RIGHT); - clHead->addClock(); - clHead->addPicture("", CC_ALIGN_RIGHT, &indexLogo); - } - clHead->paint(); -} + int timestr_len = 0; + char timestr[10] = {0}; + time_t now = time(NULL); + struct tm *tm = localtime(&now); -void CChannelList::showChannelLogo() -{ - if(g_settings.infobar_show_channellogo){ - std::string lname = ""; - int dummy; - g_PicViewer->GetLogoName(chanlist[selected]->channel_id, chanlist[selected]->getName(), lname, &dummy, &dummy); - clHead->refreshElement(indexLogo, lname); - clHead->paintElement(indexLogo, true); + bool gotTime = g_Sectionsd->getIsTimeSet(); + + if(gotTime) { + strftime(timestr, 10, "%H:%M", tm); + timestr_len = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]->getRenderWidth(timestr, true); // UTF-8 } + + int iw1, iw2, iw3, ih = 0; + frameBuffer->getIconSize(NEUTRINO_ICON_BUTTON_INFO, &iw1, &ih); + frameBuffer->getIconSize(NEUTRINO_ICON_BUTTON_MENU, &iw2, &ih); + if (new_zap_mode) + frameBuffer->getIconSize(NEUTRINO_ICON_BUTTON_MUTE_ZAP_ACTIVE, &iw3, &ih); + + // head + frameBuffer->paintBoxRel(x,y, full_width,theight+0, COL_MENUHEAD_PLUS_0, RADIUS_LARGE, CORNER_TOP);//round + + frameBuffer->paintIcon(NEUTRINO_ICON_BUTTON_INFO, x + full_width - iw1 - 10, y, theight); //y+ 5 ); + frameBuffer->paintIcon(NEUTRINO_ICON_BUTTON_MENU, x + full_width - iw1 - iw2 - 14, y, theight);//y + 5); // icon for bouquet list button + if (new_zap_mode) + frameBuffer->paintIcon((new_zap_mode == 2 /* active */) ? + NEUTRINO_ICON_BUTTON_MUTE_ZAP_ACTIVE : NEUTRINO_ICON_BUTTON_MUTE_ZAP_INACTIVE, + x + full_width - iw1 - iw2 - iw3 - 18, y, theight); + + if (gotTime) { + int iw3x = (new_zap_mode) ? iw3 : -10; + g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]->RenderString(x + full_width - iw1 - iw2 - iw3x - 28 -timestr_len, + y+theight, timestr_len, timestr, COL_MENUHEAD, 0, true); // UTF-8 + timestr_len += 4; + } + + timestr_len += iw1 + iw2 + 12; + if (new_zap_mode) + timestr_len += iw3 + 10; + logo_off = timestr_len + 10; + g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]->RenderString(x+10,y+theight+0, full_width - timestr_len, name, COL_MENUHEAD, 0, true); // UTF-8 } void CChannelList::paint() @@ -2172,7 +2186,7 @@ void CChannelList::paint_events(int index) } while ( dif > 0 ); } - if (e == evtlist.end()) + if (e == evtlist.end()) break; //Display the remaining events diff --git a/src/gui/channellist.h b/src/gui/channellist.h index 7f0aae007..34e33d7c6 100644 --- a/src/gui/channellist.h +++ b/src/gui/channellist.h @@ -35,6 +35,7 @@ #include #include +#include #include #include @@ -74,7 +75,8 @@ private: std::string name; ZapitChannelList chanlist; CZapProtection* zapProtection; - + CComponentsDetailLine *dline; + int full_width; int width; int height; @@ -95,10 +97,6 @@ private: int info_height; int ChannelList_Rec; - CComponentsDetailLine *dline; - CComponentsInfoBox *ibox; - CComponentsTitleBar* clHead; - size_t indexLogo; void paintDetails(int index); void clearItem2DetailsLine (); @@ -112,7 +110,6 @@ private: void showChannelLogo(); void calcSize(); std::string MaxChanNr(); - std::string getInfoTextTransponder(int index); void paint_pig(int x, int y, int w, int h); void paint_events(int index); CChannelEventList evtlist; From c9eafa208ed793d4e252be4a2ddc232d70f2d409 Mon Sep 17 00:00:00 2001 From: Stefan Seyfried Date: Fri, 28 Dec 2012 13:57:46 +0100 Subject: [PATCH 147/224] pictureviewer: compatibility with giflib-5.x --- src/driver/pictureviewer/gif.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/driver/pictureviewer/gif.cpp b/src/driver/pictureviewer/gif.cpp index a37238772..4b0a3b23e 100644 --- a/src/driver/pictureviewer/gif.cpp +++ b/src/driver/pictureviewer/gif.cpp @@ -59,8 +59,13 @@ int fh_gif_load(const char *name,unsigned char **buffer,int* /*xp*/,int* /*yp*/) GifRecordType rt; ColorMapObject *cmap; int cmaps; +#if GIFLIB_MAJOR >= 5 + int error; + gft=DGifOpenFileName(name, &error); +#else gft=DGifOpenFileName(name); +#endif if(gft==NULL) gflush; do { @@ -128,8 +133,13 @@ int fh_gif_getsize(const char *name,int *x,int *y, int /*wanted_width*/, int /*w GifByteType *extension; int extcode; GifRecordType rt; +#if GIFLIB_MAJOR >= 5 + int error; + gft=DGifOpenFileName(name, &error); +#else gft=DGifOpenFileName(name); +#endif if(gft==NULL) gflush; do { From 44346c64176a2840dcd8115be8c0586c5284b2bc Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Wed, 20 Feb 2013 10:24:37 +0100 Subject: [PATCH 148/224] CComponents: fix some includes Included header files don't fit after move of components. --- src/gui/channellist.h | 2 +- src/gui/components/cc.h | 2 +- src/gui/imageinfo.h | 2 +- src/gui/streaminfo2.h | 2 +- src/gui/test_menu.h | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/gui/channellist.h b/src/gui/channellist.h index 34e33d7c6..31bb61fec 100644 --- a/src/gui/channellist.h +++ b/src/gui/channellist.h @@ -35,7 +35,7 @@ #include #include -#include +#include #include #include diff --git a/src/gui/components/cc.h b/src/gui/components/cc.h index 9e4dd3da2..730f7b8c2 100644 --- a/src/gui/components/cc.h +++ b/src/gui/components/cc.h @@ -29,7 +29,7 @@ #include #include #include -#include "textbox.h" +#include #include #include diff --git a/src/gui/imageinfo.h b/src/gui/imageinfo.h index 170820f88..e4ca0ec92 100644 --- a/src/gui/imageinfo.h +++ b/src/gui/imageinfo.h @@ -28,7 +28,7 @@ #include #include #include -#include +#include class CImageInfo : public CMenuTarget diff --git a/src/gui/streaminfo2.h b/src/gui/streaminfo2.h index 014353695..e6a8f2359 100644 --- a/src/gui/streaminfo2.h +++ b/src/gui/streaminfo2.h @@ -26,7 +26,7 @@ #include #include -#include +#include #include #include diff --git a/src/gui/test_menu.h b/src/gui/test_menu.h index 7b582286e..7e7fa47f9 100644 --- a/src/gui/test_menu.h +++ b/src/gui/test_menu.h @@ -31,7 +31,7 @@ #include #include -#include +#include #define TEST_MENU #include From ba4e026b33501782a50f044e095614b52a4e3aaa Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Fri, 22 Feb 2013 22:49:01 +0100 Subject: [PATCH 149/224] CChannelList: fix compile error clearItem2DetailsLine()candidate expects 1 argument, 2 provided --- src/gui/channellist.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/channellist.cpp b/src/gui/channellist.cpp index b5d8795f8..39254c663 100644 --- a/src/gui/channellist.cpp +++ b/src/gui/channellist.cpp @@ -1626,7 +1626,7 @@ void CChannelList::paintDetails(int index) void CChannelList::clearItem2DetailsLine() { - paintItem2DetailsLine (-1, 0); + paintItem2DetailsLine (-1); } void CChannelList::paintItem2DetailsLine (int pos) From 10f429ee0f51e7d882af090f20142c1d16e5033c Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Sat, 23 Feb 2013 16:17:25 +0100 Subject: [PATCH 150/224] CComponents: move components.cpp to cc_base.cpp, move types to own header --- src/gui/components/Makefile.am | 2 +- src/gui/components/cc.h | 84 +------------ .../{components.cpp => cc_base.cpp} | 2 +- src/gui/components/cc_types.h | 110 ++++++++++++++++++ 4 files changed, 114 insertions(+), 84 deletions(-) rename src/gui/components/{components.cpp => cc_base.cpp} (99%) create mode 100644 src/gui/components/cc_types.h diff --git a/src/gui/components/Makefile.am b/src/gui/components/Makefile.am index 5765a440c..ad5769abf 100644 --- a/src/gui/components/Makefile.am +++ b/src/gui/components/Makefile.am @@ -17,4 +17,4 @@ noinst_LIBRARIES = libneutrino_gui_components.a libneutrino_gui_components_a_SOURCES = \ - components.cpp + cc_base.cpp diff --git a/src/gui/components/cc.h b/src/gui/components/cc.h index 730f7b8c2..1a4ec1e19 100644 --- a/src/gui/components/cc.h +++ b/src/gui/components/cc.h @@ -2,7 +2,7 @@ Based up Neutrino-GUI - Tuxbox-Project Copyright (C) 2001 by Steffen Hehn 'McClean' - Classes for generic for GUI-related components. + Classes for generic GUI-related components. Copyright (C) 2012, 2013, Thilo Graf 'dbt' License: GPL @@ -26,92 +26,12 @@ #ifndef __COMPONENTS__ #define __COMPONENTS__ +#include "cc_types.h" #include -#include -#include #include #include #include -//required typedefs -typedef struct comp_fbdata_t -{ - int fbdata_type; - int x; - int y; - int dx; - int dy; - fb_pixel_t color; - int r; - int frame_thickness; - fb_pixel_t* pixbuf; - void * data; -} comp_fbdata_struct_t; - -//fb data object types -typedef enum -{ - CC_FBDATA_TYPE_BGSCREEN, - CC_FBDATA_TYPE_SHADOW, - CC_FBDATA_TYPE_BOX, - CC_FBDATA_TYPE_FRAME, - CC_FBDATA_TYPE_LINE, - CC_FBDATA_TYPE_BACKGROUND, - - CC_FBDATA_TYPES -}FBDATA_TYPES; - -typedef struct comp_screen_data_t -{ - int x; - int y; - int dx; - int dy; - fb_pixel_t* pixbuf; -} comp_screen_data_struct_t; - -//align types -enum -{ - CC_ALIGN_RIGHT = 0, - CC_ALIGN_LEFT = 1, - CC_ALIGN_TOP = 2, - CC_ALIGN_BOTTOM = 4, - CC_ALIGN_HOR_CENTER = 8, - CC_ALIGN_VER_CENTER = 16 -}; - -enum -{ - CC_ITEMBOX_ICON, - CC_ITEMBOX_PICTURE, - CC_ITEMBOX_TEXT, - CC_ITEMBOX_CLOCK -}; - -typedef struct comp_element_data_t -{ - int type; - int align; - std::string element; - int x; - int y; - int width; - int height; - void* handler1; - void* handler2; -}comp_element_data_struct_t; - - -#define CC_WIDTH_MIN 16 -#define CC_HEIGHT_MIN 16 -#define CC_SHADOW_ON true -#define CC_SHADOW_OFF false -#define CC_SAVE_SCREEN_YES true -#define CC_SAVE_SCREEN_NO false - -#define CC_NO_INDEX -1 - class CComponents { protected: diff --git a/src/gui/components/components.cpp b/src/gui/components/cc_base.cpp similarity index 99% rename from src/gui/components/components.cpp rename to src/gui/components/cc_base.cpp index 0c5c223aa..af5f7fd80 100644 --- a/src/gui/components/components.cpp +++ b/src/gui/components/cc_base.cpp @@ -2,7 +2,7 @@ Based up Neutrino-GUI - Tuxbox-Project Copyright (C) 2001 by Steffen Hehn 'McClean' - Classes for generic for GUI-related components. + Classes for generic GUI-related components. Copyright (C) 2012, 2013, Thilo Graf 'dbt' Copyright (C) 2012, Michael Liebmann 'micha-bbg' diff --git a/src/gui/components/cc_types.h b/src/gui/components/cc_types.h new file mode 100644 index 000000000..df2e53b48 --- /dev/null +++ b/src/gui/components/cc_types.h @@ -0,0 +1,110 @@ +/* + Based up Neutrino-GUI - Tuxbox-Project + Copyright (C) 2001 by Steffen Hehn 'McClean' + + Classes for generic GUI-related components. + Copyright (C) 2012, 2013, Thilo Graf 'dbt' + + License: GPL + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the + Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#ifndef __CC_TYPES__ +#define __CC_TYPES__ + +//required typedefs +typedef struct comp_fbdata_t +{ + int fbdata_type; + int x; + int y; + int dx; + int dy; + fb_pixel_t color; + int r; + int frame_thickness; + fb_pixel_t* pixbuf; + void * data; +} comp_fbdata_struct_t; + +//fb data object types +typedef enum +{ + CC_FBDATA_TYPE_BGSCREEN, + CC_FBDATA_TYPE_SHADOW, + CC_FBDATA_TYPE_BOX, + CC_FBDATA_TYPE_FRAME, + CC_FBDATA_TYPE_LINE, + CC_FBDATA_TYPE_BACKGROUND, + + CC_FBDATA_TYPES +}FBDATA_TYPES; + +typedef struct comp_screen_data_t +{ + int x; + int y; + int dx; + int dy; + fb_pixel_t* pixbuf; +} comp_screen_data_struct_t; + +//align types +enum +{ + CC_ALIGN_RIGHT = 0, + CC_ALIGN_LEFT = 1, + CC_ALIGN_TOP = 2, + CC_ALIGN_BOTTOM = 4, + CC_ALIGN_HOR_CENTER = 8, + CC_ALIGN_VER_CENTER = 16 +}; + +enum +{ + CC_ITEMBOX_ICON, + CC_ITEMBOX_PICTURE, + CC_ITEMBOX_TEXT, + CC_ITEMBOX_CLOCK +}; + +typedef struct comp_element_data_t +{ + int type; + int align; + std::string element; + int x; + int y; + int width; + int height; + void* handler1; + void* handler2; +}comp_element_data_struct_t; + + +#define CC_WIDTH_MIN 16 +#define CC_HEIGHT_MIN 16 +#define CC_SHADOW_ON true +#define CC_SHADOW_OFF false +#define CC_SAVE_SCREEN_YES true +#define CC_SAVE_SCREEN_NO false + +#define CC_NO_INDEX -1 + + + +#endif From 152d40c6cd17d8fd6c8a2586e655a7cde066d455 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Mon, 25 Feb 2013 20:23:10 +0100 Subject: [PATCH 151/224] Bedit: adapt for infobox The combination of infobox handling and screen size management doesn't really fit together. Particular it could be better implemented some inheritance, because incorporated functions and variables are redundant and so the classes can be better coordinated. Moreover, it doesn't seem sensible to use only a part of the display. The use of full screen instead of window could simplify a lot. --- src/gui/bedit/bouqueteditor_bouquets.cpp | 6 +++--- src/gui/bedit/bouqueteditor_channels.cpp | 24 +++++++++++++--------- src/gui/bedit/bouqueteditor_chanselect.cpp | 4 ++-- 3 files changed, 19 insertions(+), 15 deletions(-) diff --git a/src/gui/bedit/bouqueteditor_bouquets.cpp b/src/gui/bedit/bouqueteditor_bouquets.cpp index 157723695..2710eb4f0 100644 --- a/src/gui/bedit/bouqueteditor_bouquets.cpp +++ b/src/gui/bedit/bouqueteditor_bouquets.cpp @@ -123,6 +123,7 @@ void CBEBouquetWidget::paint() float sbh= (sb- 4)/ sbc; int sbs= (selected/listmaxshow); + //scrollbar frameBuffer->paintBoxRel(x+ width- 13, ypos+ 2+ int(sbs* sbh) , 11, int(sbh), COL_MENUCONTENT_PLUS_3); } @@ -226,9 +227,8 @@ int CBEBouquetWidget::exec(CMenuTarget* parent, const std::string & /*actionKey* iconoffset = std::max(iconoffset, icol_w); int fw = g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL]->getWidth(); - int fh = g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL]->getHeight(); - width = w_max (64 * fw, 20); - height = h_max (20 * fh, 50); + width = w_max ((frameBuffer->getScreenWidth() / 20 * (fw+6)), 100); + height = h_max ((frameBuffer->getScreenHeight() / 20 * 18), (frameBuffer->getScreenHeight() / 20 * 2)); listmaxshow = (height-theight-0)/iheight; height = theight+0+listmaxshow*iheight; // recalc height x = frameBuffer->getScreenX() + (frameBuffer->getScreenWidth() - width) / 2; diff --git a/src/gui/bedit/bouqueteditor_channels.cpp b/src/gui/bedit/bouqueteditor_channels.cpp index 72efda90d..14639c2d0 100644 --- a/src/gui/bedit/bouqueteditor_channels.cpp +++ b/src/gui/bedit/bouqueteditor_channels.cpp @@ -84,7 +84,7 @@ CBEChannelWidget::CBEChannelWidget(const std::string & Caption, unsigned int Bou bouquet = Bouquet; mode = CZapitClient::MODE_TV; dline = NULL; - ibox = new CComponentsInfoBox(); + ibox = NULL; Channels = NULL; } @@ -211,7 +211,7 @@ void CBEChannelWidget::paintDetails(int index) //info box ibox->setText(str, CTextBox::AUTO_WIDTH | CTextBox::NO_AUTO_LINEBREAK, g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST]); - ibox->paint(false); + ibox->paint(CC_SAVE_SCREEN_YES); } void CBEChannelWidget::initItem2DetailsLine (int pos, int /*ch_index*/) @@ -235,15 +235,19 @@ void CBEChannelWidget::initItem2DetailsLine (int pos, int /*ch_index*/) dline->setYPos(ypos1a); //infobox - if (ibox){ - ibox->setDimensionsAll(x, ypos2, width, info_height); - ibox->setFrameThickness(2); + if (ibox == NULL) + ibox = new CComponentsInfoBox(); + + if (ibox->isPainted()) + ibox->hide(CC_SAVE_SCREEN_NO); + + ibox->setDimensionsAll(x, ypos2, width, info_height); + ibox->setFrameThickness(2); #if 0 ibox->paint(false,true); #endif - ibox->setCornerRadius(RADIUS_LARGE); - ibox->setShadowOnOff(CC_SHADOW_OFF); - } + ibox->setCornerRadius(RADIUS_LARGE); + ibox->setShadowOnOff(CC_SHADOW_OFF); } } @@ -295,10 +299,10 @@ int CBEChannelWidget::exec(CMenuTarget* parent, const std::string & /*actionKey* int fw = g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL]->getWidth(); width = w_max ((frameBuffer->getScreenWidth() / 20 * (fw+6)), 100); - height = h_max ((frameBuffer->getScreenHeight() / 20 * 17), (frameBuffer->getScreenHeight() / 20 * 2)); + height = h_max ((frameBuffer->getScreenHeight() / 20 * 16), (frameBuffer->getScreenHeight() / 20 * 2)); listmaxshow = (height-theight-footerHeight-0)/iheight; height = theight+footerHeight+listmaxshow*iheight; // recalc height - info_height = 2*iheight + 10; + info_height = 2*iheight + 4; x = frameBuffer->getScreenX() + (frameBuffer->getScreenWidth() - width) / 2; y = frameBuffer->getScreenY() + (frameBuffer->getScreenHeight() - (height + info_height)) / 2; diff --git a/src/gui/bedit/bouqueteditor_chanselect.cpp b/src/gui/bedit/bouqueteditor_chanselect.cpp index 79ba2d8c6..7925ff8d6 100644 --- a/src/gui/bedit/bouqueteditor_chanselect.cpp +++ b/src/gui/bedit/bouqueteditor_chanselect.cpp @@ -164,10 +164,10 @@ int CBEChannelSelectWidget::exec(CMenuTarget* parent, const std::string & action { int fw = g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL]->getWidth(); width = w_max ((frameBuffer->getScreenWidth() / 20 * (fw+6)), 100); - height = h_max ((frameBuffer->getScreenHeight() / 20 * 17), (frameBuffer->getScreenHeight() / 20 * 2)); + height = h_max ((frameBuffer->getScreenHeight() / 20 * 16), (frameBuffer->getScreenHeight() / 20 * 2)); listmaxshow = (height-theight-footerHeight-0)/iheight; height = theight+footerHeight+listmaxshow*iheight; // recalc height - info_height = 2*iheight + 10; + info_height = 2*iheight + 4; x = frameBuffer->getScreenX() + (frameBuffer->getScreenWidth() - width) / 2; y = frameBuffer->getScreenY() + (frameBuffer->getScreenHeight() - (height + info_height)) / 2; From 3ed9af87add169b15dc459cd28c75dd229433f2b Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Tue, 26 Feb 2013 15:58:22 +0100 Subject: [PATCH 152/224] CComponents: split cc_base.cpp It's easier to work with smaller files. Most files contain only one cc-class and their names are derived on the particular class that is contained therein. --- src/Makefile.am | 2 +- src/gui/components/Makefile.am | 14 +- src/gui/components/cc.h | 7 +- src/gui/components/cc_base.cpp | 2052 ------------------------ src/gui/components/cc_detailsline.cpp | 168 ++ src/gui/components/cc_frm.cpp | 260 +++ src/gui/components/cc_frm_header.cpp | 276 ++++ src/gui/components/cc_frm_icons.cpp | 204 +++ src/gui/components/cc_frm_window.cpp | 90 ++ src/gui/components/cc_item.cpp | 153 ++ src/gui/components/cc_item_box.cpp | 615 +++++++ src/gui/components/cc_item_infobox.cpp | 132 ++ src/gui/components/cc_item_picture.cpp | 185 +++ src/gui/components/cc_item_shapes.cpp | 101 ++ src/gui/components/cc_item_text.cpp | 188 +++ src/gui/components/cc_item_tvpig.cpp | 84 + 16 files changed, 2475 insertions(+), 2056 deletions(-) create mode 100644 src/gui/components/cc_detailsline.cpp create mode 100644 src/gui/components/cc_frm.cpp create mode 100644 src/gui/components/cc_frm_header.cpp create mode 100644 src/gui/components/cc_frm_icons.cpp create mode 100644 src/gui/components/cc_frm_window.cpp create mode 100644 src/gui/components/cc_item.cpp create mode 100644 src/gui/components/cc_item_box.cpp create mode 100644 src/gui/components/cc_item_infobox.cpp create mode 100644 src/gui/components/cc_item_picture.cpp create mode 100644 src/gui/components/cc_item_shapes.cpp create mode 100644 src/gui/components/cc_item_text.cpp create mode 100644 src/gui/components/cc_item_tvpig.cpp diff --git a/src/Makefile.am b/src/Makefile.am index 2ddf170c6..eeab45556 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -48,7 +48,6 @@ endif neutrino_LDADD = \ daemonc/libneutrino_daemonc.a \ gui/bedit/libneutrino_gui_bedit.a \ - gui/components/libneutrino_gui_components.a \ gui/libtimerlist.a \ gui/libneutrino_gui.a \ gui/widget/libneutrino_gui_widget.a \ @@ -57,6 +56,7 @@ neutrino_LDADD = \ system/libneutrino_system.a \ gui/movieinfo.o \ gui/libneutrino_gui2.a \ + gui/components/libneutrino_gui_components.a \ eitd/libsectionsd.a \ driver/libneutrino_driver.a \ driver/audiodec/libneutrino_driver_audiodec.a \ diff --git a/src/gui/components/Makefile.am b/src/gui/components/Makefile.am index ad5769abf..a940f62bc 100644 --- a/src/gui/components/Makefile.am +++ b/src/gui/components/Makefile.am @@ -17,4 +17,16 @@ noinst_LIBRARIES = libneutrino_gui_components.a libneutrino_gui_components_a_SOURCES = \ - cc_base.cpp + cc_base.cpp \ + cc_detailsline.cpp \ + cc_frm.cpp \ + cc_frm_header.cpp \ + cc_frm_icons.cpp \ + cc_frm_window.cpp \ + cc_item.cpp \ + cc_item_box.cpp \ + cc_item_infobox.cpp \ + cc_item_picture.cpp \ + cc_item_shapes.cpp \ + cc_item_text.cpp \ + cc_item_tvpig.cpp diff --git a/src/gui/components/cc.h b/src/gui/components/cc.h index 1a4ec1e19..667aeeb9b 100644 --- a/src/gui/components/cc.h +++ b/src/gui/components/cc.h @@ -31,6 +31,9 @@ #include #include #include +#include + +//#define DEBUG_CC class CComponents { @@ -48,7 +51,7 @@ class CComponents comp_screen_data_t saved_screen; void clearSavedScreen(); - void clear(); + virtual void clear(); public: CComponents(); virtual~CComponents(); @@ -154,7 +157,7 @@ class CComponentsPicture : public CComponentsItem inline void setPictureOffset(const unsigned char offset){pic_offset = offset;}; inline void setPicturePaint(bool paint_p){pic_paint = paint_p;}; inline void setPicturePaintBackground(bool paintBg){pic_paintBg = paintBg;}; - inline void setPicture(const std::string& picture_name); + void setPicture(const std::string& picture_name); void setPictureAlign(const int alignment); inline bool isPicPainted(){return pic_painted;}; diff --git a/src/gui/components/cc_base.cpp b/src/gui/components/cc_base.cpp index af5f7fd80..c9f71bb31 100644 --- a/src/gui/components/cc_base.cpp +++ b/src/gui/components/cc_base.cpp @@ -31,14 +31,6 @@ #include #include #include "cc.h" -#include - -#include - -#define DEBUG_CC - -extern cVideo * videoDecoder; -extern CPictureViewer * g_PicViewer; using namespace std; @@ -166,2047 +158,3 @@ inline void CComponents::clear() delete[] v_fbdata[i].pixbuf; v_fbdata.clear(); } - - -//------------------------------------------------------------------------------------------------------- -//abstract sub class CComponentsItem from CComponents -CComponentsItem::CComponentsItem() -{ - //CComponentsItem - initVarItem(); - cc_item_type = CC_ITEMTYPE_BASE; -} - -// y -// x+------f-r-a-m-e-------+ -// | | -// height body | -// | | -// +--------width---------+ - -void CComponentsItem::initVarItem() -{ - //CComponents - initVarBasic(); - cc_item_index = CC_NO_INDEX; -} - -// Paint container background in cc-items with shadow, background and frame. -// This member must be called first in all paint() members before paint other items into the container. -// If backround is not required, it's possible to override this with variable paint_bg=false, use doPaintBg(true/false) to set this! -void CComponentsItem::paintInit(bool do_save_bg) -{ - clear(); - - if(!paint_bg) - return; - - int sw = shadow ? shadow_w : 0; - int th = fr_thickness; - - comp_fbdata_t fbdata[] = - { - {CC_FBDATA_TYPE_BGSCREEN, x, y, width+sw, height+sw, 0, 0, 0, NULL, NULL}, - {CC_FBDATA_TYPE_SHADOW, x+sw, y+sw, width, height, col_shadow, corner_rad, 0, NULL, NULL}, - {CC_FBDATA_TYPE_FRAME, x, y, width, height, col_frame, corner_rad, th, NULL, NULL}, - {CC_FBDATA_TYPE_BOX, x+th, y+th, width-2*th, height-2*th, col_body, corner_rad-th, 0, NULL, NULL}, - }; - - for(size_t i =0; i< (sizeof(fbdata) / sizeof(fbdata[0])) ;i++) - v_fbdata.push_back(fbdata[i]); -#ifdef DEBUG_CC - printf("[CComponentsItem] %s:\ncc_item_type: %d\ncc_item_index = %d\nheight = %d\nwidth = %d\n", __FUNCTION__, cc_item_type, cc_item_index, height, width); -#endif - paintFbItems(do_save_bg); -} - -//restore last saved screen behind form box, -//Do use parameter 'no restore' to override temporarly the restore funtionality. -//This could help to avoid ugly flicker efffects if it is necessary e.g. on often repaints, without changed contents. -void CComponentsItem::hideCCItem(bool no_restore) -{ - is_painted = false; - - if (saved_screen.pixbuf) { - frameBuffer->RestoreScreen(saved_screen.x, saved_screen.y, saved_screen.dx, saved_screen.dy, saved_screen.pixbuf); - if (no_restore) { - delete[] saved_screen.pixbuf; - saved_screen.pixbuf = NULL; - firstPaint = true; - } - } -} - -void CComponentsItem::hide(bool no_restore) -{ - hideCCItem(no_restore); -} - - -//hide rendered objects -void CComponentsItem::kill() -{ - //save current colors - fb_pixel_t c_tmp1, c_tmp2, c_tmp3; - c_tmp1 = col_body; - c_tmp2 = col_shadow; - c_tmp3 = col_frame; - - //set background color - col_body = col_frame = col_shadow = COL_BACKGROUND; - - //paint with background and restore last used colors - paint(CC_SAVE_SCREEN_NO); - col_body = c_tmp1; - col_shadow = c_tmp2; - col_frame = c_tmp3; - firstPaint = true; - is_painted = false; -} - -//synchronize colors for forms -//This is usefull if the system colors are changed during runtime -//so you can ensure correct applied system colors in relevant objects with unchanged instances. -void CComponentsItem::syncSysColors() -{ - col_body = COL_MENUCONTENT_PLUS_0; - col_shadow = COL_MENUCONTENTDARK_PLUS_0; - col_frame = COL_MENUCONTENT_PLUS_6; -} - -//returns current item element type, if no available, return -1 as unknown type -int CComponentsItem::getItemType() -{ - for(int i =0; i< (CC_ITEMTYPES) ;i++){ - if (i == cc_item_type) - return i; - } -#ifdef DEBUG_CC - printf("[CComponentsItem] %s: unknown item type requested...\n", __FUNCTION__); -#endif - return -1; -} - - -//------------------------------------------------------------------------------------------------------- -//sub class CComponentsText from CComponentsItem -CComponentsText::CComponentsText() -{ - //CComponentsText - initVarText(); -} - -CComponentsText::CComponentsText( const int x_pos, const int y_pos, const int w, const int h, - const char* text, const int mode, Font* font_text, - bool has_shadow, - fb_pixel_t color_text, fb_pixel_t color_frame, fb_pixel_t color_body, fb_pixel_t color_shadow) -{ - //CComponentsText - initVarText(); - - //CComponents - x = x_pos, - y = y_pos, - width = w; - height = h; - - col_frame = color_frame; - col_body = color_body; - col_shadow = color_shadow; - shadow = has_shadow; - - ct_font = font_text; - ct_text = text; - ct_text_mode = mode; - ct_col_text = color_text; -} - - - -CComponentsText::~CComponentsText() -{ - hide(); - clearSavedScreen(); - clearCCText(); - clear(); -} - - -void CComponentsText::initVarText() -{ - //CComponents, CComponentsItem - initVarItem(); - cc_item_type = CC_ITEMTYPE_TEXT; - - //CComponentsText - ct_font = NULL; - ct_box = NULL; - ct_textbox = NULL; - ct_text = NULL; - ct_text_mode = CTextBox::AUTO_WIDTH; - ct_col_text = COL_MENUCONTENT; - ct_text_sent = false; -} - - -void CComponentsText::initCCText() -{ - //set default font, if is no font definied - if (ct_font == NULL) - ct_font = g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL]; - - //define height from font size - height = max(height, ct_font->getHeight()); - - //text box dimensions - if (ct_box){ - //ensure that we have a new instance - delete ct_box; - ct_box = NULL; - } - ct_box = new CBox(); - ct_box->iX = x+fr_thickness; - ct_box->iY = y+fr_thickness; - ct_box->iWidth = width-2*fr_thickness; - ct_box->iHeight = height-2*fr_thickness; - - //init textbox - if (ct_textbox == NULL) - ct_textbox = new CTextBox(); - - //set text box properties - ct_textbox->setTextFont(ct_font); - ct_textbox->setTextMode(ct_text_mode); - ct_textbox->setWindowPos(ct_box); - ct_textbox->setTextBorderWidth(0); - ct_textbox->enableBackgroundPaint(false); - ct_textbox->setBackGroundColor(col_body); - ct_textbox->setBackGroundRadius(corner_rad-fr_thickness, corner_type); - ct_textbox->setTextColor(ct_col_text); - ct_textbox->setWindowMaxDimensions(ct_box->iWidth, ct_box->iHeight); - ct_textbox->setWindowMinDimensions(ct_box->iWidth, ct_box->iHeight); - - //set text - string new_text = static_cast (ct_text); - ct_text_sent = ct_textbox->setText(&new_text, ct_box->iWidth); -} - -void CComponentsText::clearCCText() -{ - if (ct_box) - delete ct_box; - ct_box = NULL; - - if (ct_textbox) - delete ct_textbox; - ct_textbox = NULL; -} - -void CComponentsText::setText(neutrino_locale_t locale_text, int mode, Font* font_text) -{ - ct_text = g_Locale->getText(locale_text); - ct_text_mode = mode; - ct_font = font_text; -} - -void CComponentsText::paintText(bool do_save_bg) -{ - paintInit(do_save_bg); - initCCText(); - if (ct_text_sent) - ct_textbox->paint(); - ct_text_sent = false; -} - -void CComponentsText::paint(bool do_save_bg) -{ - - paintText(do_save_bg); -} - -void CComponentsText::hide(bool no_restore) -{ - - if (ct_textbox) - ct_textbox->hide(); - hideCCItem(no_restore); -} - -//small helper to remove excessiv linbreaks -void CComponentsText::removeLineBreaks(std::string& str) -{ - std::string::size_type spos = str.find_first_of("\r\n"); - while (spos != std::string::npos) { - str.replace(spos, 1, " "); - spos = str.find_first_of("\r\n"); - } -} - -//------------------------------------------------------------------------------------------------------- -//sub class CComponentsInfoBox from CComponentsItem -CComponentsInfoBox::CComponentsInfoBox() -{ - //CComponentsInfoBox - initVarInfobox(); -} - -CComponentsInfoBox::CComponentsInfoBox(const int x_pos, const int y_pos, const int w, const int h, - const char* info_text, const int mode, Font* font_text, - bool has_shadow, - fb_pixel_t color_text, fb_pixel_t color_frame, fb_pixel_t color_body, fb_pixel_t color_shadow) -{ - //CComponentsInfoBox - initVarInfobox(); - - x = x_pos; - y = y_pos; - width = w; - height = h; - shadow = has_shadow; - col_frame = color_frame; - col_body = color_body; - col_shadow = color_shadow; - - ct_text = info_text; - ct_text_mode = mode; - ct_font = font_text; - ct_col_text = color_text; -} - -CComponentsInfoBox::~CComponentsInfoBox() -{ - hide(); - clearSavedScreen(); - clearCCText(); - delete pic; - delete cctext; - clear(); -} - -void CComponentsInfoBox::initVarInfobox() -{ - //CComponents, CComponentsItem, CComponentsText - initVarText(); - cc_item_type = CC_ITEMTYPE_TEXT_INFOBOX; - - //CComponentsInfoBox - pic = NULL; - cctext = NULL; - pic_name = ""; - x_offset = 10; - x_text = x+fr_thickness+x_offset;; - -} - -void CComponentsInfoBox::paintPicture() -{ - //init and set icon paint position - if (pic == NULL) - pic = new CComponentsPicture(x+fr_thickness+x_offset, y+fr_thickness/*+y_offset*/, 0, 0, ""); - pic->setXPos(x+fr_thickness+x_offset); - pic->setYPos(y+fr_thickness); - - //define icon - pic->setPicture(pic_name); - - //fit icon into infobox - pic->setHeight(height-2*fr_thickness); - pic->setColorBody(col_body); - - pic->paint(CC_SAVE_SCREEN_NO); -} - -void CComponentsInfoBox::paint(bool do_save_bg) -{ - paintInit(do_save_bg); - paintPicture(); - - //define text x position - x_text = x+fr_thickness+x_offset; - - //set text to the left border if picture is not painted - if (pic->isPicPainted()){ - int pic_w = pic->getWidth(); - x_text += pic_w+x_offset; - } - - //set text and paint text lines - if (ct_text){ - if (cctext == NULL) - cctext = new CComponentsText(); - cctext->setText(ct_text, ct_text_mode, ct_font); - cctext->setDimensionsAll(x_text, y+fr_thickness, width-(x_text-x+x_offset+fr_thickness), height-2*fr_thickness); - cctext->paint(CC_SAVE_SCREEN_NO); - } -} - -//------------------------------------------------------------------------------------------------------- -//sub class CComponentsShapeSquare from CComponentsItem -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) -{ - //CComponentsItem - initVarItem(); - cc_item_type = CC_ITEMTYPE_SHAPE_SQUARE; - - x = x_pos; - y = y_pos; - width = w; - height = h; - shadow = has_shadow; - shadow_w = SHADOW_OFFSET; - col_frame = color_frame; - col_body = color_body; - col_shadow = color_shadow; -} - -void CComponentsShapeSquare::paint(bool do_save_bg) -{ - paintInit(do_save_bg); -} - - -//------------------------------------------------------------------------------------------------------- -//sub class CComponentsShapeCircle from CComponentsItem -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) -{ - //CComponents, CComponentsItem - initVarItem(); - cc_item_type = CC_ITEMTYPE_SHAPE_CIRCLE; - - //CComponents - x = x_pos; - y = y_pos; - //width = height = d = diam; - shadow = has_shadow; - shadow_w = SHADOW_OFFSET; - col_frame = color_frame; - col_body = color_body; - col_shadow = color_shadow; - - //CComponentsShapeCircle - width = height = d = diam; - - //CComponentsItem - corner_rad = d/2; -} - -// y -// x+ - + -// -// -// -// |----d-i-a-m----| -// -// -// -// + - + - -void CComponentsShapeCircle::paint(bool do_save_bg) -{ - paintInit(do_save_bg); -} - - -//------------------------------------------------------------------------------------------------------- -//sub class CComponentsDetailLine from CComponents -CComponentsDetailLine::CComponentsDetailLine() -{ - initVarDline(); - - //CComponents - x = 0; - y = 0; - col_shadow = COL_MENUCONTENTDARK_PLUS_0; - col_body = COL_MENUCONTENT_PLUS_6; - - //CComponentsDetailLine - y_down = 0; - h_mark_top = CC_HEIGHT_MIN; - h_mark_down = CC_HEIGHT_MIN; -} - -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) -{ - initVarDline(); - - //CComponents - x = x_pos; - y = y_pos_top; - col_shadow = color_shadow; - col_body = color_line; - - //CComponentsDetailLine - y_down = y_pos_down; - h_mark_top = h_mark_top_; - h_mark_down = h_mark_down_; -} - -void CComponentsDetailLine::initVarDline() -{ - //CComponents - initVarBasic(); - - shadow_w = 1; - - //CComponentsDetailLine - thickness = 4; -} - -CComponentsDetailLine::~CComponentsDetailLine() -{ - hide(); //restore background - clear(); -} - -// y_top (=y) -// xpos +--|h_mark_up -// | -// | -// | -// | -// | -// | -// | -// | -// | -// +--|h_mark_down -// y_down - - -//paint details line with current parameters -void CComponentsDetailLine::paint(bool do_save_bg) -{ - clear(); - - int y_mark_top = y-h_mark_top/2+thickness/2; - int y_mark_down = y_down-h_mark_down/2+thickness/2; - - int sw = shadow_w; - - comp_fbdata_t fbdata[] = - { - /* vertical item mark | */ - {CC_FBDATA_TYPE_LINE, x+width-thickness-sw, y_mark_top, thickness, h_mark_top, col_body, 0, 0, NULL, NULL}, - {CC_FBDATA_TYPE_LINE, x+width-sw, y_mark_top, sw, h_mark_top, col_shadow, 0, 0, NULL, NULL}, - {CC_FBDATA_TYPE_LINE, x+width-thickness-sw, y_mark_top+h_mark_top, thickness+sw, sw , col_shadow, 0, 0, NULL, NULL}, - - /* horizontal item line - */ - {CC_FBDATA_TYPE_LINE, x, y, width-thickness-sw, thickness, col_body, 0, 0, NULL, NULL}, - {CC_FBDATA_TYPE_LINE, x+thickness, y+thickness, width-2*thickness-sw, sw, col_shadow, 0, 0, NULL, NULL}, - - /* vertical connect line [ */ - {CC_FBDATA_TYPE_LINE, x, y+thickness, thickness, y_down-y-thickness, col_body, 0, 0, NULL, NULL}, - {CC_FBDATA_TYPE_LINE, x+thickness, y+thickness+sw, sw, y_down-y-thickness-sw, col_shadow, 0, 0, NULL, NULL}, - - /* horizontal info line - */ - {CC_FBDATA_TYPE_LINE, x, y_down, width-thickness-sw, thickness, col_body, 0, 0, NULL, NULL}, - {CC_FBDATA_TYPE_LINE, x, y_down+thickness, width-thickness-sw, sw, col_shadow, 0, 0, NULL, NULL}, - - /* vertical info mark | */ - {CC_FBDATA_TYPE_LINE, x+width-thickness-sw, y_mark_down, thickness, h_mark_down, col_body, 0, 0, NULL, NULL}, - {CC_FBDATA_TYPE_LINE, x+width-sw, y_mark_down, sw, h_mark_down, col_shadow, 0, 0, NULL, NULL}, - {CC_FBDATA_TYPE_LINE, x+width-thickness-sw, y_mark_down+h_mark_down,thickness+sw, sw, col_shadow, 0, 0, NULL, NULL}, - }; - - for(size_t i =0; i< (sizeof(fbdata) / sizeof(fbdata[0])) ;i++) - v_fbdata.push_back(fbdata[i]); - - paintFbItems(do_save_bg); -} - -//remove painted fb items from screen -void CComponentsDetailLine::kill() -{ - //save current colors - fb_pixel_t c_tmp1, c_tmp2; - c_tmp1 = col_body; - c_tmp2 = col_shadow; - - //set background color - col_body = col_shadow = COL_BACKGROUND; - - //paint with background and restore, set last used colors - paint(CC_SAVE_SCREEN_NO); - col_body = c_tmp1; - col_shadow = c_tmp2; - firstPaint = true; -} - -//synchronize colors for details line -//This is usefull if the system colors are changed during runtime -//so you can ensure correct applied system colors in relevant objects with unchanged instances. -void CComponentsDetailLine::syncSysColors() -{ - col_body = COL_MENUCONTENT_PLUS_6; - col_shadow = COL_MENUCONTENTDARK_PLUS_0; -} - - -//------------------------------------------------------------------------------------------------------- -//sub class CComponentsPIP from CComponentsItem -CComponentsPIP::CComponentsPIP( const int x_pos, const int y_pos, const int percent, bool has_shadow) -{ - //CComponents, CComponentsItem - initVarItem(); - cc_item_type = CC_ITEMTYPE_PIP; - - //CComponentsPIP - screen_w = frameBuffer->getScreenWidth(true); - screen_h = frameBuffer->getScreenHeight(true); - - //CComponents - x = x_pos; - y = y_pos; - width = percent*screen_w/100; - height = percent*screen_h/100; - shadow = has_shadow; - shadow_w = SHADOW_OFFSET; - col_frame = COL_BACKGROUND; - col_body = COL_BACKGROUND; - col_shadow = COL_MENUCONTENTDARK_PLUS_0; -} - -CComponentsPIP::~CComponentsPIP() -{ - hide(); - clearSavedScreen(); - clear(); - videoDecoder->Pig(-1, -1, -1, -1); -} - -void CComponentsPIP::paint(bool do_save_bg) -{ - paintInit(do_save_bg); - videoDecoder->Pig(x+fr_thickness, y+fr_thickness, width-2*fr_thickness, height-2*fr_thickness, screen_w, screen_h); -} - - -void CComponentsPIP::hide(bool no_restore) -{ - hideCCItem(no_restore); - videoDecoder->Pig(-1, -1, -1, -1); -} - - -//------------------------------------------------------------------------------------------------------- -//sub class CComponentsPicture from CComponentsItem -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, - 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); - - 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, - fb_pixel_t color_frame, fb_pixel_t color_background, fb_pixel_t color_shadow) -{ - //CComponents, CComponentsItem - initVarItem(); - cc_item_type = CC_ITEMTYPE_PICTURE; - - //CComponentsPicture - pic_name = image_name; - pic_align = alignment; - pic_offset = 1; - pic_paint = true; - pic_paintBg = false; - pic_painted = false; - do_paint = false; - pic_max_w = 0; - pic_max_h = 0; - if (pic_name.empty()) - pic_width = pic_height = 0; - - //CComponents - 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) -{ - pic_name = picture_name; - initVarPicture(); -} - - -void CComponentsPicture::setPictureAlign(const int alignment) -{ - pic_align = alignment; - initVarPicture(); -} - - -void CComponentsPicture::initVarPicture() -{ - pic_width = pic_height = 0; - pic_painted = false; - do_paint = false; - - if (pic_max_w == 0) - pic_max_w = width-2*fr_thickness; - - if (pic_max_h == 0) - pic_max_h = height-2*fr_thickness; - - //set the image mode depends of name syntax, icon names contains no path, - //so we can detect the required image mode - if (pic_paint_mode == CC_PIC_IMAGE_MODE_AUTO){ - if (!access(pic_name.c_str(), F_OK )) - pic_paint_mode = CC_PIC_IMAGE_MODE_ON; - else - pic_paint_mode = CC_PIC_IMAGE_MODE_OFF; - } - - if (pic_paint_mode == CC_PIC_IMAGE_MODE_OFF){ - frameBuffer->getIconSize(pic_name.c_str(), &pic_width, &pic_height); -#if 0 - pic_width = max(pic_width, pic_max_w); - pic_height = max(pic_height, pic_max_h); -#endif - } - - if (pic_paint_mode == CC_PIC_IMAGE_MODE_ON) { - g_PicViewer->getSize(pic_name.c_str(), &pic_width, &pic_height); - if((pic_width > pic_max_w) || (pic_height > pic_max_h)) - g_PicViewer->rescaleImageDimensions(&pic_width, &pic_height, pic_max_w, pic_max_h); - } - -#ifdef DEBUG_CC - if (pic_width == 0 || pic_height == 0) - printf("[CComponentsPicture] %s file: %s, no icon dimensions found! width = %d, height = %d\n", __FUNCTION__, pic_name.c_str(), pic_width, pic_height); -#endif - - pic_x += fr_thickness; - pic_y += fr_thickness; - - if (pic_height>0 && pic_width>0){ - if (pic_align & CC_ALIGN_LEFT) - pic_x = x+fr_thickness; - if (pic_align & CC_ALIGN_RIGHT) - pic_x = x+width-pic_width-fr_thickness; - if (pic_align & CC_ALIGN_TOP) - pic_y = y+fr_thickness; - if (pic_align & CC_ALIGN_BOTTOM) - pic_y = y+height-pic_height-fr_thickness; - if (pic_align & CC_ALIGN_HOR_CENTER) - pic_x = x+width/2-pic_width/2; - if (pic_align & CC_ALIGN_VER_CENTER) - pic_y = y+height/2-pic_height/2; - - do_paint = true; - } - - int sw = (shadow ? shadow_w :0); - width = max(max(pic_width, pic_max_w), width) + sw ; - height = max(max(pic_height, pic_max_h), height) + sw ; -} - -void CComponentsPicture::paint(bool do_save_bg) -{ - initVarPicture(); - paintInit(do_save_bg); - pic_painted = false; - - if (do_paint){ - if (pic_paint_mode == CC_PIC_IMAGE_MODE_OFF) - pic_painted = frameBuffer->paintIcon(pic_name, pic_x, pic_y, 0 /*pic_max_h*/, pic_offset, pic_paint, pic_paintBg, col_body); - else if (pic_paint_mode == CC_PIC_IMAGE_MODE_ON) - pic_painted = g_PicViewer->DisplayImage(pic_name, pic_x, pic_y, pic_width, pic_height); - do_paint = false; - } -} - -void CComponentsPicture::hide(bool no_restore) -{ - hideCCItem(no_restore); - pic_painted = false; -} - - -//------------------------------------------------------------------------------------------------------- -//sub class CComponentsItemBox from CComponentsItem -CComponentsItemBox::CComponentsItemBox() -{ - //CComponentsItemBox - initVarItemBox(); -} - -CComponentsItemBox::~CComponentsItemBox() -{ - hide(); - clearElements(); - clearSavedScreen(); - clear(); -} - -void CComponentsItemBox::initVarItemBox() -{ - //CComponents, CComponentsItem - initVarItem(); - - //CComponentsItemBox - it_col_text = COL_MENUCONTENT; - hSpacer = 2; - hOffset = 4; - vOffset = 1; - digit_h = 0; - digit_offset = 0; - font_text = NULL; - paintElements = true; - hMax = 0; - has_TextElement = false; - firstElementLeft = FIRST_ELEMENT_INIT; - firstElementRight = FIRST_ELEMENT_INIT; - prevElementLeft = 0; - prevElementRight = 0; - onlyOneTextElement = false; - isCalculated = false; - v_element_data.clear(); -} - -int CComponentsItemBox::getHeight() -{ - if (!isCalculated) - calculateElements(); - return height; -} - -void CComponentsItemBox::clearElements() -{ - for(size_t i = 0; i < v_element_data.size(); i++) { - switch (v_element_data[i].type) { - case CC_ITEMBOX_ICON: - case CC_ITEMBOX_PICTURE: - if (v_element_data[i].handler1 != NULL) - delete static_cast(v_element_data[i].handler1); - break; - case CC_ITEMBOX_TEXT: - if (v_element_data[i].handler1 != NULL) - delete static_cast(v_element_data[i].handler1); - if (v_element_data[i].handler2 != NULL) - delete static_cast(v_element_data[i].handler2); - break; - default: - break; - } - } - isCalculated = false; - v_element_data.clear(); -} - -bool CComponentsItemBox::addLogoOrText(int align, const std::string& logo, const std::string& text, size_t *index) -{ - comp_element_data_t data; - int dx=0, dy=0; - - data.align = align; - data.x = x; - data.y = y; - data.width = 0; - data.height = 0; - data.handler1 = NULL; - data.handler2 = NULL; - - g_PicViewer->getSize(logo.c_str(), &dx, &dy); - if ((dx != 0) && (dy != 0)) { - // logo OK - data.type = CC_ITEMBOX_PICTURE; - data.element = logo; - } - else { - // no logo - if ((text == "") || ((onlyOneTextElement) && (has_TextElement))) - return false; - else - has_TextElement = true; - if (font_text != NULL) - data.height = font_text->getHeight(); - data.type = CC_ITEMBOX_TEXT; - data.element = text; - } - - v_element_data.push_back(data); - if (index != NULL) - *index = v_element_data.size()-1; - isCalculated = false; - return true; -} - -void CComponentsItemBox::addText(const std::string& s_text, const int align, size_t *index) -{ - addElement(align, CC_ITEMBOX_TEXT, s_text, index); -} - -void CComponentsItemBox::addText(neutrino_locale_t locale_text, const int align, size_t *index) -{ - addElement(align, CC_ITEMBOX_TEXT, g_Locale->getText(locale_text), index); -} - -void CComponentsItemBox::addIcon(const std::string& s_icon_name, const int align, size_t *index) -{ - addElement(align, CC_ITEMBOX_ICON, s_icon_name, index); -} - -void CComponentsItemBox::addPicture(const std::string& s_picture_path, const int align, size_t *index) -{ - addElement(align, CC_ITEMBOX_PICTURE, s_picture_path, index); -} - -void CComponentsItemBox::addClock(const int align, size_t *index) -{ - addElement(align, CC_ITEMBOX_CLOCK, "", index); -} - -bool CComponentsItemBox::addElement(int align, int type, const std::string& element, size_t *index) -{ - comp_element_data_t data; - int dx=0, dy=0; - - switch (type) - { - case CC_ITEMBOX_ICON: - frameBuffer->getIconSize(element.c_str(), &dx, &dy); - if ((dx == 0) || (dy == 0)) - return false; - break; - case CC_ITEMBOX_TEXT: - if ((element == "") || ((onlyOneTextElement) && (has_TextElement))) - return false; - else - has_TextElement = true; - break; - default: - break; - } - - data.type = type; - data.align = align; - data.element = element; - data.x = x; - data.y = y; - data.width = 0; - data.height = 0; - data.handler1 = NULL; - data.handler2 = NULL; - - v_element_data.push_back(data); - if (index != NULL) - *index = v_element_data.size()-1; - isCalculated = false; - return true; -} - -void CComponentsItemBox::refreshElement(size_t index, const std::string& element) -{ - CComponentsPicture* pic = NULL; - switch (v_element_data[index].type) { - case CC_ITEMBOX_PICTURE: - pic = static_cast(v_element_data[index].handler1); - if (pic != NULL) { - pic->hide(); - delete pic; - } - v_element_data[index].element = element; - v_element_data[index].x = x; - v_element_data[index].y = y; - v_element_data[index].width = 0; - v_element_data[index].height = 0; - v_element_data[index].handler1 = NULL; - v_element_data[index].handler2 = NULL; - break; - default: - break; - } - calculateElements(); -} - -//paint image into item box -void CComponentsItemBox::paintImage(size_t index, bool newElement) -{ - CComponentsPicture* pic = NULL; - pic = static_cast(v_element_data[index].handler1); - - int pw = 0, ph = 0; - - if ((newElement) || (pic == NULL)) { - if (pic != NULL) { - pic->hide(); - delete pic; - pic = NULL; - } - if ((v_element_data[index].type) == CC_ITEMBOX_PICTURE) - pic = new CComponentsPicture( v_element_data[index].x, v_element_data[index].y, v_element_data[index].width, - v_element_data[index].height, v_element_data[index].element); - else - pic = new CComponentsPicture( v_element_data[index].x, v_element_data[index].y, 0, 0, v_element_data[index].element); - v_element_data[index].handler1 = (void*)pic; - } - - pic->getPictureSize(&pw, &ph); - pic->setHeight(ph); - pic->setWidth(pw); - pic->setColorBody(col_body); - pic->paint(); -} - -//paint text into item box -void CComponentsItemBox::paintText(size_t index, bool newElement) -{ - //prepare textbox dimension instances - CBox* box = NULL; - box = static_cast(v_element_data[index].handler1); - - if ((newElement) || (box == NULL)) { - if (box != NULL) { - delete box; - box = NULL; - } - box = new CBox(); - v_element_data[index].handler1 = (void*)box; - } - - box->iX = v_element_data[index].x; - box->iY = v_element_data[index].y; - box->iWidth = v_element_data[index].width; - box->iHeight = v_element_data[index].height; - - - //prepare text - CTextBox* textbox = NULL; - textbox = static_cast(v_element_data[index].handler2); - - if ((newElement) || (textbox == NULL)) { - if (textbox != NULL) { - textbox->hide(); - delete textbox; - textbox = NULL; - } - textbox = new CTextBox(v_element_data[index].element.c_str(), font_text, CTextBox::AUTO_WIDTH|CTextBox::AUTO_HIGH, box, col_body); - v_element_data[index].handler2 = (void*)textbox; - } - - textbox->setTextBorderWidth(0); - textbox->enableBackgroundPaint(false); - textbox->setTextFont(font_text); - textbox->movePosition(box->iX, box->iY); - textbox->setTextColor(it_col_text); - - if (textbox->setText(&v_element_data[index].element)) - textbox->paint(); -} - - -//paint available elements at one task -void CComponentsItemBox::paintElement(size_t index, bool newElement) -{ - switch (v_element_data[index].type) { - case CC_ITEMBOX_ICON: - case CC_ITEMBOX_PICTURE: - paintImage(index,newElement); - break; - case CC_ITEMBOX_TEXT: - paintText(index,newElement); - break; - case CC_ITEMBOX_CLOCK: - font_text->RenderString(v_element_data[index].x, v_element_data[index].y, v_element_data[index].width, - v_element_data[index].element.c_str(), it_col_text); - break; - default: - break; - } -} - -void CComponentsItemBox::calSizeOfElements() -{ - size_t i; - - // Set element size - for (i = 0; i < v_element_data.size(); i++) { - switch (v_element_data[i].type) - { - case CC_ITEMBOX_ICON: - frameBuffer->getIconSize(v_element_data[i].element.c_str(), &v_element_data[i].width, &v_element_data[i].height); - break; - case CC_ITEMBOX_PICTURE: - g_PicViewer->getSize(v_element_data[i].element.c_str(), &v_element_data[i].width, &v_element_data[i].height); - break; - case CC_ITEMBOX_TEXT: - if (font_text != NULL) - v_element_data[i].height = font_text->getHeight(); - break; - case CC_ITEMBOX_CLOCK: { - if (!g_Sectionsd->getIsTimeSet()) - break; - if (font_text != NULL) { - char timestr[10] = {0}; - time_t now = time(NULL); - struct tm *tm = localtime(&now); - strftime(timestr, sizeof(timestr)-1, "%H:%M", tm); - - digit_h = font_text->getDigitHeight(); - digit_offset = font_text->getDigitOffset(); - v_element_data[i].height = digit_h + (int)((float)digit_offset*1.5); -// v_element_data[i].width = font_text->getRenderWidth(widest_number)*4 + font->getRenderWidth(":"); - v_element_data[i].width = font_text->getRenderWidth(timestr); - v_element_data[i].element = timestr; - } - } - break; - default: - break; - } - } - - // Calculate largest height without CC_ITEMBOX_PICTURE - firstElementLeft = FIRST_ELEMENT_INIT; - firstElementRight = FIRST_ELEMENT_INIT; - for (i = 0; i < v_element_data.size(); i++) { - if ((firstElementLeft == FIRST_ELEMENT_INIT) && (v_element_data[i].align == CC_ALIGN_LEFT)) - firstElementLeft = i; - if ((firstElementRight == FIRST_ELEMENT_INIT) && (v_element_data[i].align == CC_ALIGN_RIGHT)) - firstElementRight = i; - if (v_element_data[i].type != CC_ITEMBOX_PICTURE) - hMax = max(v_element_data[i].height, hMax); - } -} - -void CComponentsItemBox::calPositionOfElements() -{ - size_t i; - - // Calculate y-positions - height = hMax + 2*vOffset; - for (i = 0; i < v_element_data.size(); i++) { - v_element_data[i].y = y + (height - v_element_data[i].height) / 2; - if (v_element_data[i].type == CC_ITEMBOX_CLOCK) - v_element_data[i].y += v_element_data[i].height + digit_offset/4; - } - - // Calculate x-positions - for (i = 0; i < v_element_data.size(); i++) { - if (firstElementLeft == i){ - prevElementLeft = i; - v_element_data[i].x = x + hOffset + corner_rad/2; - } - else if (firstElementRight == i){ - prevElementRight = i; - v_element_data[i].x = x + width - v_element_data[i].width - hOffset - corner_rad/2; - } - else { - if (v_element_data[i].align == CC_ALIGN_LEFT) { - // left elements - v_element_data[i].x = v_element_data[prevElementLeft].x + v_element_data[prevElementLeft].width + hSpacer; - prevElementLeft = i; - } - else { - // right elements - v_element_data[i].x = v_element_data[prevElementRight].x - v_element_data[i].width - hSpacer; - prevElementRight = i; - } - } - } -} - -void CComponentsItemBox::calculateElements() -{ - if (v_element_data.empty()) - return; - - size_t i; - - calSizeOfElements(); - - // hMax correction if no text element. - if (!has_TextElement) - hMax = max(font_text->getHeight(), hMax); - - // Calculate logo - for (i = 0; i < v_element_data.size(); i++) { - if (v_element_data[i].type == CC_ITEMBOX_PICTURE) { - if ((v_element_data[i].width > LOGO_MAX_WIDTH) || (v_element_data[i].height > hMax)) - g_PicViewer->rescaleImageDimensions(&v_element_data[i].width, &v_element_data[i].height, LOGO_MAX_WIDTH, hMax); - } - } - - // Calculate text width - int allWidth = 0; - for (i = 0; i < v_element_data.size(); i++) { - if (v_element_data[i].type != CC_ITEMBOX_TEXT) - allWidth += v_element_data[i].width + hSpacer; - } - for (i = 0; i < v_element_data.size(); i++) { - if (v_element_data[i].type == CC_ITEMBOX_TEXT) { - v_element_data[i].width = width - (allWidth + 2*hSpacer); - // If text is too long, number of rows = 2 - if (font_text->getRenderWidth(v_element_data[i].element) > v_element_data[i].width) { - v_element_data[i].height = font_text->getHeight() * 2; - hMax = max(v_element_data[i].height, hMax); - } - break; - } - } - - calPositionOfElements(); - isCalculated = true; -} - -void CComponentsItemBox::paintItemBox(bool do_save_bg) -{ - // paint background - paintInit(do_save_bg); - - if ((v_element_data.empty()) || (!paintElements)) - return; - - // paint elements - for (size_t i = 0; i < v_element_data.size(); i++) - paintElement(i); -} - -void CComponentsItemBox::clearTitlebar() -{ - clearElements(); - paintElements = false; - paint(false); - paintElements = true; -} - - - -//------------------------------------------------------------------------------------------------------- -//sub class CComponentsTitleBar from CComponentsItemBox -CComponentsTitleBar::CComponentsTitleBar() -{ - //CComponentsTitleBar - initVarTitleBar(); -} - -void CComponentsTitleBar::initVarTitleBar() -{ - //CComponentsItemBox - initVarItemBox(); - onlyOneTextElement = true; - - font_text = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]; - it_col_text = COL_MENUHEAD; - - //CComponents - x = 0; - y = 0; - height = font_text->getHeight() + 2*hSpacer; - width = frameBuffer->getScreenWidth(true);; - col_body = COL_MENUHEAD_PLUS_0; - corner_type = CORNER_TOP; - corner_rad = RADIUS_LARGE; - - //CComponentsTitleBar - tb_text_align = CC_ALIGN_LEFT; - tb_icon_align = CC_ALIGN_LEFT; - tb_c_text = NULL; - tb_s_text = ""; - tb_locale_text = NONEXISTANT_LOCALE; - tb_icon_name = ""; -} - -CComponentsTitleBar::CComponentsTitleBar(const int x_pos, const int y_pos, const int w, const int h, const char* c_text, const std::string& s_icon, - fb_pixel_t color_text, fb_pixel_t color_body) -{ - //CComponentsItemBox - initVarTitleBar(); - it_col_text = color_text; - - //CComponents - x = x_pos; - y = y_pos; - height = h; - width = w; - col_body = color_body; - - //CComponentsTitleBar - tb_c_text = c_text; - tb_icon_name = s_icon; - - initElements(); -} - -CComponentsTitleBar::CComponentsTitleBar(const int x_pos, const int y_pos, const int w, const int h, const string& s_text, const std::string& s_icon, - fb_pixel_t color_text, fb_pixel_t color_body) -{ - //CComponentsItemBox - initVarTitleBar(); - it_col_text = color_text; - - //CComponents - x = x_pos; - y = y_pos; - height = h; - width = w; - col_body = color_body; - - //CComponentsTitleBar - tb_s_text = s_text; - tb_icon_name = s_icon; - - initElements(); -} - -CComponentsTitleBar::CComponentsTitleBar(const int x_pos, const int y_pos, const int w, const int h, neutrino_locale_t locale_text, const std::string& s_icon, - fb_pixel_t color_text, fb_pixel_t color_body) -{ - //CComponentsItemBox - initVarTitleBar(); - it_col_text = color_text; - - //CComponents - x = x_pos; - y = y_pos; - height = h; - width = w; - col_body = color_body; - - //CComponentsTitleBar - tb_locale_text = locale_text; - tb_s_text = g_Locale->getText(tb_locale_text); - tb_icon_name = s_icon; - - initElements(); -} - -///basic init methodes for constructors *************************************** -void CComponentsTitleBar::initIcon() -{ - if (!tb_icon_name.empty()) - addElement (tb_icon_align, CC_ITEMBOX_ICON, tb_icon_name); -} - -void CComponentsTitleBar::initText() -{ - if (tb_c_text){ - addElement (tb_text_align, CC_ITEMBOX_TEXT, tb_c_text); - return; - } - else if (!tb_s_text.empty()){ - addElement (tb_text_align, CC_ITEMBOX_TEXT, tb_s_text); - return; - } -} - -void CComponentsTitleBar::initElements() -{ - initIcon(); - initText(); -} -///***************************************************************************** - -void CComponentsTitleBar::paint(bool do_save_bg) -{ - calculateElements(); - paintItemBox(do_save_bg); -} - - -//------------------------------------------------------------------------------------------------------- -//sub class CComponentsForm from CComponentsItem -CComponentsForm::CComponentsForm() -{ - //CComponentsForm - initVarForm(); -} - -CComponentsForm::CComponentsForm(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) -{ - //CComponentsForm - initVarForm(); - - //CComponents - x = x_pos; - y = y_pos; - width = w; - height = h; - - shadow = has_shadow; - col_frame = color_frame; - col_body = color_body; - col_shadow = color_shadow; -} - -CComponentsForm::~CComponentsForm() -{ -#ifdef DEBUG_CC - printf("[CComponents] calling %s...\n", __FUNCTION__); -#endif - hide(); - clearSavedScreen(); - clearCCItems(); - clear(); -} - -void CComponentsForm::clearCCItems() -{ - if (v_cc_items.empty()) - return; -#ifdef DEBUG_CC - printf("[CComponentsForm] %s... cleanup %d form cc-items\n", __FUNCTION__, v_cc_items.size()); -#endif - for(size_t i=0; igetDimensions(&x_item, &y_item, &w_item, &h_item); - - - int xy_ref = 0+fr_thickness; //allowed minimal x and y start position - if (x_item < xy_ref){ -#ifdef DEBUG_CC - printf("[CComponentsForm] %s: item %d position is out of form dimensions\ndefinied x=%d\nallowed x>=%d\n", __FUNCTION__, i, x_item, xy_ref); -#endif - x_item = xy_ref; - } - if (y_item < xy_ref){ -#ifdef DEBUG_CC - printf("[CComponentsForm] %s: item %d position is out of form dimensions\ndefinied y=%d\nallowed y>=%d\n", __FUNCTION__, i, y_item, xy_ref); -#endif - y_item = xy_ref; - } - - //set adapted position onto form - v_cc_items[i]->setXPos(x_frm_left+x_item); - v_cc_items[i]->setYPos(y_frm_top+y_item); - - //watch horizontal x dimensions of items - int x_item_right = v_cc_items[i]->getXPos()+w_item; //right item border - if (x_item_right > x_frm_right){ - v_cc_items[i]->setWidth(w_item-(x_item_right-x_frm_right)); -#ifdef DEBUG_CC - printf("[CComponentsForm] %s: item %d too large, definied width=%d, possible width=%d \n", __FUNCTION__, i, w_item, v_cc_items[i]->getWidth()); -#endif - } - - //watch vertical y dimensions - int y_item_bottom = v_cc_items[i]->getYPos()+h_item; //bottom item border - if (y_item_bottom > y_frm_bottom){ - v_cc_items[i]->setHeight(h_item-(y_item_bottom-y_frm_bottom)); -#ifdef DEBUG_CC - printf("[CComponentsForm] %s: item %d too large, definied height=%d, possible height=%d \n", __FUNCTION__, i, h_item, v_cc_items[i]->getHeight()); -#endif - } - - //paint element without saved screen! - v_cc_items[i]->paint(CC_SAVE_SCREEN_NO); - - //restore dimensions and position - v_cc_items[i]->setDimensionsAll(x_item, y_item, w_item, h_item); - } -} - -void CComponentsForm::hide(bool no_restore) -{ - //hide body - hideCCItem(no_restore); -} - -//------------------------------------------------------------------------------------------------------- -//sub class CComponentsHeader inherit from CComponentsForm -CComponentsHeader::CComponentsHeader() -{ - //CComponentsHeader - initVarHeader(); -} - -CComponentsHeader::CComponentsHeader( const int x_pos, const int y_pos, const int w, const int h, const std::string& caption, const char* icon_name, const int buttons, bool has_shadow, - fb_pixel_t color_frame, fb_pixel_t color_body, fb_pixel_t color_shadow) -{ - //CComponentsHeader - initVarHeader(); - - x = x_pos; - y = y_pos; - width = w; - height = h > 0 ? h : g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]->getHeight(); - shadow = has_shadow; - col_frame = color_frame; - col_body = color_body; - col_shadow = color_shadow; - - cch_text = caption; - cch_icon_name = icon_name; - cch_buttons = buttons; - initCCHDefaultButtons(); - initCCHItems(); -} - -CComponentsHeader::CComponentsHeader( const int x_pos, const int y_pos, const int w, const int h, neutrino_locale_t caption_locale, const char* icon_name, const int buttons, bool has_shadow, - fb_pixel_t color_frame, fb_pixel_t color_body, fb_pixel_t color_shadow) -{ - //CComponentsHeader - initVarHeader(); - - x = x_pos; - y = y_pos; - width = w; - height = h; - shadow = has_shadow; - col_frame = color_frame; - col_body = color_body; - col_shadow = color_shadow; - - cch_locale_text = caption_locale; - cch_icon_name = icon_name; - cch_buttons = buttons; - initCCHDefaultButtons(); - initCCHItems(); -} - -#if 0 -CComponentsHeader::~CComponentsHeader() -{ - hide(); - clearSavedScreen(); - clearCCItems(); - clear(); -} -#endif - -void CComponentsHeader::initVarHeader() -{ - //CComponentsHeader - cch_font = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]; - cch_icon_obj = NULL; - cch_text_obj = NULL; - cch_icon_name = NULL; - cch_btn_obj = NULL; - cch_text = "header"; - cch_locale_text = NONEXISTANT_LOCALE; - cch_col_text = COL_MENUHEAD; - cch_items_y = 0; - cch_icon_x = 0; - cch_icon_w = 5; - cch_text_x = 0; - ccif_width = 0; - cch_buttons = 0; - cch_btn_offset = 8; - v_cch_btn.clear(); - - //CComponentsForm - initVarForm(); - cc_item_type = CC_ITEMTYPE_FRM_HEADER; - height = cch_font->getHeight(); - col_body = COL_MENUHEAD_PLUS_0; - corner_rad = RADIUS_LARGE, - corner_type = CORNER_TOP; -} - -void CComponentsHeader::setHeaderText(const std::string& caption) -{ - cch_text = caption; -} - -void CComponentsHeader::setHeaderText(neutrino_locale_t caption_locale) -{ - cch_text = g_Locale->getText(caption_locale); -} - -void CComponentsHeader::setHeaderIcon(const char* icon_name) -{ - cch_icon_name = icon_name; -} - -void CComponentsHeader::initCCHeaderIcon() -{ - if (cch_icon_name == NULL) { - cch_icon_w = cch_btn_offset; - return; - } - - if (cch_icon_name) - cch_icon_obj = new CComponentsPicture(cch_icon_x, cch_items_y, 0, 0, cch_icon_name); - cch_icon_obj->setWidth(height-2*fr_thickness); - cch_icon_obj->setHeight(height); - cch_icon_obj->setPictureAlign(CC_ALIGN_HOR_CENTER | CC_ALIGN_VER_CENTER); - cch_icon_obj->doPaintBg(false); - - //corner of icon item - cch_icon_obj->setCornerRadius(corner_rad-fr_thickness); - int cc_icon_corner_type = corner_type; - if (corner_type == CORNER_TOP_LEFT || corner_type == CORNER_TOP) - cc_icon_corner_type = CORNER_TOP_LEFT; - else - cc_icon_corner_type = CORNER_LEFT; - cch_icon_obj->setCornerType(cc_icon_corner_type); - - //set width of icon object - cch_icon_w = cch_icon_obj->getWidth(); -} - -void CComponentsHeader::addHeaderButton(const std::string& button_name) -{ - if (cch_btn_obj){ - delete cch_btn_obj; - cch_btn_obj = NULL; - } - v_cch_btn.push_back(button_name); - initCCHeaderButtons(); -} - -void CComponentsHeader::removeHeaderButtons() -{ - v_cch_btn.clear(); - if (cch_btn_obj){ - delete cch_btn_obj; - cch_btn_obj = NULL; - } -} - -void CComponentsHeader::initCCHDefaultButtons() -{ - if (cch_buttons & CC_BTN_EXIT) - v_cch_btn.push_back(NEUTRINO_ICON_BUTTON_HOME); - if (cch_buttons & CC_BTN_HELP) - v_cch_btn.push_back(NEUTRINO_ICON_BUTTON_HELP); - if (cch_buttons & CC_BTN_INFO) - v_cch_btn.push_back(NEUTRINO_ICON_BUTTON_INFO); - if (cch_buttons & CC_BTN_MENU) - v_cch_btn.push_back(NEUTRINO_ICON_BUTTON_MENU); -} - -// calculate minimal width of icon form -void CComponentsHeader::initCCButtonFormSize() -{ - ccif_width = 0; - for(size_t i=0; igetIconSize(v_cch_btn[i].c_str(), &bw, &bh); - ccif_width += (bw + cch_btn_offset); - } -} - -void CComponentsHeader::initCCHeaderButtons() -{ - //exit if no button defined - if (v_cch_btn.empty()) - return; - - initCCButtonFormSize(); - - cch_btn_obj = new CComponentsIconForm(); - cch_btn_obj->setDimensionsAll(0+width-ccif_width, 0, ccif_width-cch_btn_offset, height); - cch_btn_obj->doPaintBg(false); - cch_btn_obj->setIconOffset(cch_btn_offset); - cch_btn_obj->setIconAlign(CComponentsIconForm::CC_ICONS_FRM_ALIGN_RIGHT); - cch_btn_obj->removeAllIcons(); - cch_btn_obj->addIcon(v_cch_btn); -} - -void CComponentsHeader::initCCHeaderText() -{ - cch_text_x = cch_icon_x+cch_icon_w; - cch_text_obj = new CComponentsText(cch_text_x, cch_items_y, width-cch_icon_w-fr_thickness, height-2*fr_thickness, cch_text.c_str()); - cch_text_obj->setTextFont(cch_font); - cch_text_obj->setTextColor(cch_col_text); - cch_text_obj->setColorBody(col_body); - cch_text_obj->doPaintBg(false); - - //corner of text item - cch_text_obj->setCornerRadius(corner_rad-fr_thickness); - cch_text_obj->setCornerType(corner_type); -} - -void CComponentsHeader::initCCHItems() -{ -#if 0 - //clean up first possible old item objects, includes delete and clean up vector - clearCCItems(); -#endif - - //init icon - initCCHeaderIcon(); - - //init text - initCCHeaderText(); - - //init buttons - initCCHeaderButtons(); - - //add elements - if (cch_icon_obj) - addCCItem(cch_icon_obj); //icon - if (cch_text_obj) - addCCItem(cch_text_obj); //text - if (cch_btn_obj) - addCCItem(cch_btn_obj); //buttons - -} - -void CComponentsHeader::paint(bool do_save_bg) -{ - //paint body - paintInit(do_save_bg); - - //paint - paintCCItems(); -} - - -//------------------------------------------------------------------------------------------------------- -//sub class CComponentsIconForm inherit from CComponentsForm -CComponentsIconForm::CComponentsIconForm() -{ - initVarIconForm(); -} - -CComponentsIconForm::CComponentsIconForm(const int x_pos, const int y_pos, const int w, const int h, const std::vector v_icon_names, bool has_shadow, - fb_pixel_t color_frame, fb_pixel_t color_body, fb_pixel_t color_shadow) -{ - initVarIconForm(); - - x = x_pos; - y = y_pos; - width = w; - height = h; - shadow = has_shadow; - col_frame = color_frame; - col_body = color_body; - col_shadow = color_shadow; - - v_icons = v_icon_names; -} - -void CComponentsIconForm::initVarIconForm() -{ - //CComponentsForm - initVarForm(); - cc_item_type = CC_ITEMTYPE_FRM_ICONFORM; - - //set default width and height to 0, this causes a dynamic adaptation of width and height of form - width = 0; - height = 0; - - v_icons.clear(); - ccif_offset = 2; - ccif_icon_align = CC_ICONS_FRM_ALIGN_LEFT; -} - -void CComponentsIconForm::addIcon(const std::string& icon_name) -{ - v_icons.push_back(icon_name); -} - -void CComponentsIconForm::addIcon(std::vector icon_name) -{ - for (size_t i= 0; i< icon_name.size(); i++) - v_icons.push_back(icon_name[i]); -} - -void CComponentsIconForm::insertIcon(const uint& icon_id, const std::string& icon_name) -{ - v_icons.insert(v_icons.begin()+icon_id, icon_name); -} - -void CComponentsIconForm::removeIcon(const uint& icon_id) -{ - v_icons.erase(v_icons.begin()+icon_id); -} - -void CComponentsIconForm::removeIcon(const std::string& icon_name) -{ - int id = getIconId(icon_name); - removeIcon(id); -} - -int CComponentsIconForm::getIconId(const std::string& icon_name) -{ - for (size_t i= 0; i< v_icons.size(); i++) - if (v_icons[i] == icon_name) - return i; - return -1; -} - -//For existing instances it's recommended -//to remove old items before add new icons, otherwise icons will be appended. -void CComponentsIconForm::removeAllIcons() -{ - if (!v_icons.empty()) - v_icons.clear(); - clearCCItems(); -} - -//get maximal form height depends of biggest icon height, but don't touch defined form height -void CComponentsIconForm::initMaxHeight(int *pheight) -{ - for (size_t i= 0; i< v_icons.size(); i++){ - int dummy, htmp; - frameBuffer->getIconSize(v_icons[i].c_str(), &dummy, &htmp); - *pheight = max(htmp, height)/*+2*fr_thickness*/; - } -} - -void CComponentsIconForm::initCCIcons() -{ - //clean up first possible old item objects, includes delete and clean up vector and icons - clearCCItems(); - - int ccp_y = 0; - int ccp_h = 0; - int ccp_w = 0; - //calculate start pos of first icon - int ccp_x = 0 + fr_thickness; //CC_ICONS_FRM_ALIGN_LEFT; - - if (ccif_icon_align == CC_ICONS_FRM_ALIGN_RIGHT) - ccp_x += (width - fr_thickness); - - //get width of first icon - frameBuffer->getIconSize(v_icons[0].c_str(), &ccp_w, &ccp_h); - - //get maximal form height - int h = 0; - initMaxHeight(&h); - - //set xpos of first icon with right alignment, icon must positionized on the right border reduced with icon width - if (ccif_icon_align == CC_ICONS_FRM_ALIGN_RIGHT) - ccp_x -= ccp_w; - - //init and add item objects - size_t i_cnt = v_icons.size(); //icon count - - for (size_t i= 0; i< i_cnt; i++){ - //create new cc-picture item object - CComponentsPicture *ccp = NULL; - ccp = new CComponentsPicture(ccp_x, ccp_y, ccp_w, h, v_icons[i]); - ccp->setPictureAlign(CC_ALIGN_HOR_CENTER | CC_ALIGN_VER_CENTER); - ccp->doPaintBg(false); - //add item to form - addCCItem(ccp); - - //reset current width for next object - ccp_w = 0; - //get next icon size if available - size_t next_i = i+1; - if (next_i != i_cnt) - frameBuffer->getIconSize(v_icons[next_i].c_str(), &ccp_w, &ccp_h); - - //set next icon position - int tmp_offset = ( igetWidth() + tmp_offset); - if (ccif_icon_align == CC_ICONS_FRM_ALIGN_RIGHT) - ccp_x -= (ccp_w + tmp_offset); - } - - //calculate width and height of form - int w_tmp = 0; - int h_tmp = 0; - for (size_t i= 0; i< i_cnt; i++){ - w_tmp += v_cc_items[i]->getWidth()+ccif_offset+fr_thickness; - h_tmp = max(h_tmp, v_cc_items[i]->getHeight()+2*fr_thickness); - - } - width = max(w_tmp, width); - height = max(h_tmp, height); -} - -void CComponentsIconForm::paint(bool do_save_bg) -{ - //init and add icons - initCCIcons(); - - //paint body - paintInit(do_save_bg); - - //paint - paintCCItems(); -} - -//------------------------------------------------------------------------------------------------------- -//sub class CComponentsWindow inherit from CComponentsForm -CComponentsWindow::CComponentsWindow() -{ - initVarWindow(); -} - -void CComponentsWindow::initVarWindow() -{ - //CComponentsForm - initVarForm(); - cc_item_type = CC_ITEMTYPE_FRM_WINDOW; - - ccw_head = NULL; - ccw_caption = ""; - ccw_icon_name = NULL; - - setShadowOnOff(true); -} - -CComponentsWindow::~CComponentsWindow() -{ - if (ccw_head) - delete ccw_head; -} - -void CComponentsWindow::initHeader() -{ - if (ccw_head == NULL) - ccw_head = new CComponentsHeader(); - - ccw_head->setXPos(0); - ccw_head->setYPos(0); - ccw_head->setWidth(width); - ccw_head->setHeaderIcon(ccw_icon_name); - ccw_head->setHeaderText(ccw_caption); -} - -void CComponentsWindow::initCCWItems() -{ - initHeader(); - - if (ccw_head) - addCCItem(ccw_head); -} - -void CComponentsWindow::paint(bool do_save_bg) -{ - //paint body - paintInit(do_save_bg); - - //paint - paintCCItems(); -} diff --git a/src/gui/components/cc_detailsline.cpp b/src/gui/components/cc_detailsline.cpp new file mode 100644 index 000000000..e22b89474 --- /dev/null +++ b/src/gui/components/cc_detailsline.cpp @@ -0,0 +1,168 @@ +/* + Based up Neutrino-GUI - Tuxbox-Project + Copyright (C) 2001 by Steffen Hehn 'McClean' + + Classes for generic GUI-related components. + Copyright (C) 2012, 2013, Thilo Graf 'dbt' + Copyright (C) 2012, Michael Liebmann 'micha-bbg' + + License: GPL + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the + Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif + +#include +#include +#include "cc.h" + +using namespace std; + +//sub class CComponentsDetailLine from CComponents +CComponentsDetailLine::CComponentsDetailLine() +{ + initVarDline(); + + //CComponents + x = 0; + y = 0; + col_shadow = COL_MENUCONTENTDARK_PLUS_0; + col_body = COL_MENUCONTENT_PLUS_6; + + //CComponentsDetailLine + y_down = 0; + h_mark_top = CC_HEIGHT_MIN; + h_mark_down = CC_HEIGHT_MIN; +} + +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) +{ + initVarDline(); + + //CComponents + x = x_pos; + y = y_pos_top; + col_shadow = color_shadow; + col_body = color_line; + + //CComponentsDetailLine + y_down = y_pos_down; + h_mark_top = h_mark_top_; + h_mark_down = h_mark_down_; +} + +void CComponentsDetailLine::initVarDline() +{ + //CComponents + initVarBasic(); + + shadow_w = 1; + + //CComponentsDetailLine + thickness = 4; +} + +CComponentsDetailLine::~CComponentsDetailLine() +{ + hide(); //restore background + clear(); +} + +// y_top (=y) +// xpos +--|h_mark_up +// | +// | +// | +// | +// | +// | +// | +// | +// | +// +--|h_mark_down +// y_down + + +//paint details line with current parameters +void CComponentsDetailLine::paint(bool do_save_bg) +{ + clear(); + + int y_mark_top = y-h_mark_top/2+thickness/2; + int y_mark_down = y_down-h_mark_down/2+thickness/2; + + int sw = shadow_w; + + comp_fbdata_t fbdata[] = + { + /* vertical item mark | */ + {CC_FBDATA_TYPE_LINE, x+width-thickness-sw, y_mark_top, thickness, h_mark_top, col_body, 0, 0, NULL, NULL}, + {CC_FBDATA_TYPE_LINE, x+width-sw, y_mark_top, sw, h_mark_top, col_shadow, 0, 0, NULL, NULL}, + {CC_FBDATA_TYPE_LINE, x+width-thickness-sw, y_mark_top+h_mark_top, thickness+sw, sw , col_shadow, 0, 0, NULL, NULL}, + + /* horizontal item line - */ + {CC_FBDATA_TYPE_LINE, x, y, width-thickness-sw, thickness, col_body, 0, 0, NULL, NULL}, + {CC_FBDATA_TYPE_LINE, x+thickness, y+thickness, width-2*thickness-sw, sw, col_shadow, 0, 0, NULL, NULL}, + + /* vertical connect line [ */ + {CC_FBDATA_TYPE_LINE, x, y+thickness, thickness, y_down-y-thickness, col_body, 0, 0, NULL, NULL}, + {CC_FBDATA_TYPE_LINE, x+thickness, y+thickness+sw, sw, y_down-y-thickness-sw, col_shadow, 0, 0, NULL, NULL}, + + /* horizontal info line - */ + {CC_FBDATA_TYPE_LINE, x, y_down, width-thickness-sw, thickness, col_body, 0, 0, NULL, NULL}, + {CC_FBDATA_TYPE_LINE, x, y_down+thickness, width-thickness-sw, sw, col_shadow, 0, 0, NULL, NULL}, + + /* vertical info mark | */ + {CC_FBDATA_TYPE_LINE, x+width-thickness-sw, y_mark_down, thickness, h_mark_down, col_body, 0, 0, NULL, NULL}, + {CC_FBDATA_TYPE_LINE, x+width-sw, y_mark_down, sw, h_mark_down, col_shadow, 0, 0, NULL, NULL}, + {CC_FBDATA_TYPE_LINE, x+width-thickness-sw, y_mark_down+h_mark_down,thickness+sw, sw, col_shadow, 0, 0, NULL, NULL}, + }; + + for(size_t i =0; i< (sizeof(fbdata) / sizeof(fbdata[0])) ;i++) + v_fbdata.push_back(fbdata[i]); + + paintFbItems(do_save_bg); +} + +//remove painted fb items from screen +void CComponentsDetailLine::kill() +{ + //save current colors + fb_pixel_t c_tmp1, c_tmp2; + c_tmp1 = col_body; + c_tmp2 = col_shadow; + + //set background color + col_body = col_shadow = COL_BACKGROUND; + + //paint with background and restore, set last used colors + paint(CC_SAVE_SCREEN_NO); + col_body = c_tmp1; + col_shadow = c_tmp2; + firstPaint = true; +} + +//synchronize colors for details line +//This is usefull if the system colors are changed during runtime +//so you can ensure correct applied system colors in relevant objects with unchanged instances. +void CComponentsDetailLine::syncSysColors() +{ + col_body = COL_MENUCONTENT_PLUS_6; + col_shadow = COL_MENUCONTENTDARK_PLUS_0; +} diff --git a/src/gui/components/cc_frm.cpp b/src/gui/components/cc_frm.cpp new file mode 100644 index 000000000..728fc40bb --- /dev/null +++ b/src/gui/components/cc_frm.cpp @@ -0,0 +1,260 @@ +/* + Based up Neutrino-GUI - Tuxbox-Project + Copyright (C) 2001 by Steffen Hehn 'McClean' + + Classes for generic GUI-related components. + Copyright (C) 2012, 2013, Thilo Graf 'dbt' + Copyright (C) 2012, Michael Liebmann 'micha-bbg' + + License: GPL + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the + Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif + +#include +#include +#include "cc.h" + +using namespace std; + +//------------------------------------------------------------------------------------------------------- +//sub class CComponentsForm from CComponentsItem +CComponentsForm::CComponentsForm() +{ + //CComponentsForm + initVarForm(); +} + +CComponentsForm::CComponentsForm(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) +{ + //CComponentsForm + initVarForm(); + + //CComponents + x = x_pos; + y = y_pos; + width = w; + height = h; + + shadow = has_shadow; + col_frame = color_frame; + col_body = color_body; + col_shadow = color_shadow; +} + +CComponentsForm::~CComponentsForm() +{ +#ifdef DEBUG_CC + printf("[CComponents] calling %s...\n", __FUNCTION__); +#endif + hide(); + clearSavedScreen(); + clearCCItems(); + clear(); +} + +void CComponentsForm::clearCCItems() +{ + if (v_cc_items.empty()) + return; +#ifdef DEBUG_CC + printf("[CComponentsForm] %s... cleanup %d form cc-items\n", __FUNCTION__, v_cc_items.size()); +#endif + for(size_t i=0; igetDimensions(&x_item, &y_item, &w_item, &h_item); + + + int xy_ref = 0+fr_thickness; //allowed minimal x and y start position + if (x_item < xy_ref){ +#ifdef DEBUG_CC + printf("[CComponentsForm] %s: item %d position is out of form dimensions\ndefinied x=%d\nallowed x>=%d\n", __FUNCTION__, i, x_item, xy_ref); +#endif + x_item = xy_ref; + } + if (y_item < xy_ref){ +#ifdef DEBUG_CC + printf("[CComponentsForm] %s: item %d position is out of form dimensions\ndefinied y=%d\nallowed y>=%d\n", __FUNCTION__, i, y_item, xy_ref); +#endif + y_item = xy_ref; + } + + //set adapted position onto form + v_cc_items[i]->setXPos(x_frm_left+x_item); + v_cc_items[i]->setYPos(y_frm_top+y_item); + + //watch horizontal x dimensions of items + int x_item_right = v_cc_items[i]->getXPos()+w_item; //right item border + if (x_item_right > x_frm_right){ + v_cc_items[i]->setWidth(w_item-(x_item_right-x_frm_right)); +#ifdef DEBUG_CC + printf("[CComponentsForm] %s: item %d too large, definied width=%d, possible width=%d \n", __FUNCTION__, i, w_item, v_cc_items[i]->getWidth()); +#endif + } + + //watch vertical y dimensions + int y_item_bottom = v_cc_items[i]->getYPos()+h_item; //bottom item border + if (y_item_bottom > y_frm_bottom){ + v_cc_items[i]->setHeight(h_item-(y_item_bottom-y_frm_bottom)); +#ifdef DEBUG_CC + printf("[CComponentsForm] %s: item %d too large, definied height=%d, possible height=%d \n", __FUNCTION__, i, h_item, v_cc_items[i]->getHeight()); +#endif + } + + //paint element without saved screen! + v_cc_items[i]->paint(CC_SAVE_SCREEN_NO); + + //restore dimensions and position + v_cc_items[i]->setDimensionsAll(x_item, y_item, w_item, h_item); + } +} + +void CComponentsForm::hide(bool no_restore) +{ + //hide body + hideCCItem(no_restore); +} diff --git a/src/gui/components/cc_frm_header.cpp b/src/gui/components/cc_frm_header.cpp new file mode 100644 index 000000000..a67aac746 --- /dev/null +++ b/src/gui/components/cc_frm_header.cpp @@ -0,0 +1,276 @@ +/* + Based up Neutrino-GUI - Tuxbox-Project + Copyright (C) 2001 by Steffen Hehn 'McClean' + + Classes for generic GUI-related components. + Copyright (C) 2012, 2013, Thilo Graf 'dbt' + Copyright (C) 2012, Michael Liebmann 'micha-bbg' + + License: GPL + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the + Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif + +#include +#include +#include "cc.h" + +using namespace std; + +//------------------------------------------------------------------------------------------------------- +//sub class CComponentsHeader inherit from CComponentsForm +CComponentsHeader::CComponentsHeader() +{ + //CComponentsHeader + initVarHeader(); +} + +CComponentsHeader::CComponentsHeader( const int x_pos, const int y_pos, const int w, const int h, const std::string& caption, const char* icon_name, const int buttons, bool has_shadow, + fb_pixel_t color_frame, fb_pixel_t color_body, fb_pixel_t color_shadow) +{ + //CComponentsHeader + initVarHeader(); + + x = x_pos; + y = y_pos; + width = w; + height = h > 0 ? h : g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]->getHeight(); + shadow = has_shadow; + col_frame = color_frame; + col_body = color_body; + col_shadow = color_shadow; + + cch_text = caption; + cch_icon_name = icon_name; + cch_buttons = buttons; + initCCHDefaultButtons(); + initCCHItems(); +} + +CComponentsHeader::CComponentsHeader( const int x_pos, const int y_pos, const int w, const int h, neutrino_locale_t caption_locale, const char* icon_name, const int buttons, bool has_shadow, + fb_pixel_t color_frame, fb_pixel_t color_body, fb_pixel_t color_shadow) +{ + //CComponentsHeader + initVarHeader(); + + x = x_pos; + y = y_pos; + width = w; + height = h; + shadow = has_shadow; + col_frame = color_frame; + col_body = color_body; + col_shadow = color_shadow; + + cch_locale_text = caption_locale; + cch_icon_name = icon_name; + cch_buttons = buttons; + initCCHDefaultButtons(); + initCCHItems(); +} + +#if 0 +CComponentsHeader::~CComponentsHeader() +{ + hide(); + clearSavedScreen(); + clearCCItems(); + clear(); +} +#endif + +void CComponentsHeader::initVarHeader() +{ + //CComponentsHeader + cch_font = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]; + cch_icon_obj = NULL; + cch_text_obj = NULL; + cch_icon_name = NULL; + cch_btn_obj = NULL; + cch_text = "header"; + cch_locale_text = NONEXISTANT_LOCALE; + cch_col_text = COL_MENUHEAD; + cch_items_y = 0; + cch_icon_x = 0; + cch_icon_w = 5; + cch_text_x = 0; + ccif_width = 0; + cch_buttons = 0; + cch_btn_offset = 8; + v_cch_btn.clear(); + + //CComponentsForm + initVarForm(); + cc_item_type = CC_ITEMTYPE_FRM_HEADER; + height = cch_font->getHeight(); + col_body = COL_MENUHEAD_PLUS_0; + corner_rad = RADIUS_LARGE, + corner_type = CORNER_TOP; +} + +void CComponentsHeader::setHeaderText(const std::string& caption) +{ + cch_text = caption; +} + +void CComponentsHeader::setHeaderText(neutrino_locale_t caption_locale) +{ + cch_text = g_Locale->getText(caption_locale); +} + +void CComponentsHeader::setHeaderIcon(const char* icon_name) +{ + cch_icon_name = icon_name; +} + +void CComponentsHeader::initCCHeaderIcon() +{ + if (cch_icon_name == NULL) { + cch_icon_w = cch_btn_offset; + return; + } + + if (cch_icon_name) + cch_icon_obj = new CComponentsPicture(cch_icon_x, cch_items_y, 0, 0, cch_icon_name); + cch_icon_obj->setWidth(height-2*fr_thickness); + cch_icon_obj->setHeight(height); + cch_icon_obj->setPictureAlign(CC_ALIGN_HOR_CENTER | CC_ALIGN_VER_CENTER); + cch_icon_obj->doPaintBg(false); + + //corner of icon item + cch_icon_obj->setCornerRadius(corner_rad-fr_thickness); + int cc_icon_corner_type = corner_type; + if (corner_type == CORNER_TOP_LEFT || corner_type == CORNER_TOP) + cc_icon_corner_type = CORNER_TOP_LEFT; + else + cc_icon_corner_type = CORNER_LEFT; + cch_icon_obj->setCornerType(cc_icon_corner_type); + + //set width of icon object + cch_icon_w = cch_icon_obj->getWidth(); +} + +void CComponentsHeader::addHeaderButton(const std::string& button_name) +{ + if (cch_btn_obj){ + delete cch_btn_obj; + cch_btn_obj = NULL; + } + v_cch_btn.push_back(button_name); + initCCHeaderButtons(); +} + +void CComponentsHeader::removeHeaderButtons() +{ + v_cch_btn.clear(); + if (cch_btn_obj){ + delete cch_btn_obj; + cch_btn_obj = NULL; + } +} + +void CComponentsHeader::initCCHDefaultButtons() +{ + if (cch_buttons & CC_BTN_EXIT) + v_cch_btn.push_back(NEUTRINO_ICON_BUTTON_HOME); + if (cch_buttons & CC_BTN_HELP) + v_cch_btn.push_back(NEUTRINO_ICON_BUTTON_HELP); + if (cch_buttons & CC_BTN_INFO) + v_cch_btn.push_back(NEUTRINO_ICON_BUTTON_INFO); + if (cch_buttons & CC_BTN_MENU) + v_cch_btn.push_back(NEUTRINO_ICON_BUTTON_MENU); +} + +// calculate minimal width of icon form +void CComponentsHeader::initCCButtonFormSize() +{ + ccif_width = 0; + for(size_t i=0; igetIconSize(v_cch_btn[i].c_str(), &bw, &bh); + ccif_width += (bw + cch_btn_offset); + } +} + +void CComponentsHeader::initCCHeaderButtons() +{ + //exit if no button defined + if (v_cch_btn.empty()) + return; + + initCCButtonFormSize(); + + cch_btn_obj = new CComponentsIconForm(); + cch_btn_obj->setDimensionsAll(0+width-ccif_width, 0, ccif_width-cch_btn_offset, height); + cch_btn_obj->doPaintBg(false); + cch_btn_obj->setIconOffset(cch_btn_offset); + cch_btn_obj->setIconAlign(CComponentsIconForm::CC_ICONS_FRM_ALIGN_RIGHT); + cch_btn_obj->removeAllIcons(); + cch_btn_obj->addIcon(v_cch_btn); +} + +void CComponentsHeader::initCCHeaderText() +{ + cch_text_x = cch_icon_x+cch_icon_w; + cch_text_obj = new CComponentsText(cch_text_x, cch_items_y, width-cch_icon_w-fr_thickness, height-2*fr_thickness, cch_text.c_str()); + cch_text_obj->setTextFont(cch_font); + cch_text_obj->setTextColor(cch_col_text); + cch_text_obj->setColorBody(col_body); + cch_text_obj->doPaintBg(false); + + //corner of text item + cch_text_obj->setCornerRadius(corner_rad-fr_thickness); + cch_text_obj->setCornerType(corner_type); +} + +void CComponentsHeader::initCCHItems() +{ +#if 0 + //clean up first possible old item objects, includes delete and clean up vector + clearCCItems(); +#endif + + //init icon + initCCHeaderIcon(); + + //init text + initCCHeaderText(); + + //init buttons + initCCHeaderButtons(); + + //add elements + if (cch_icon_obj) + addCCItem(cch_icon_obj); //icon + if (cch_text_obj) + addCCItem(cch_text_obj); //text + if (cch_btn_obj) + addCCItem(cch_btn_obj); //buttons + +} + +void CComponentsHeader::paint(bool do_save_bg) +{ + //paint body + paintInit(do_save_bg); + + //paint + paintCCItems(); +} diff --git a/src/gui/components/cc_frm_icons.cpp b/src/gui/components/cc_frm_icons.cpp new file mode 100644 index 000000000..503cb57c0 --- /dev/null +++ b/src/gui/components/cc_frm_icons.cpp @@ -0,0 +1,204 @@ +/* + Based up Neutrino-GUI - Tuxbox-Project + Copyright (C) 2001 by Steffen Hehn 'McClean' + + Classes for generic GUI-related components. + Copyright (C) 2012, 2013, Thilo Graf 'dbt' + Copyright (C) 2012, Michael Liebmann 'micha-bbg' + + License: GPL + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the + Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif + +#include +#include +#include "cc.h" + +using namespace std; + +//sub class CComponentsIconForm inherit from CComponentsForm +CComponentsIconForm::CComponentsIconForm() +{ + initVarIconForm(); +} + +CComponentsIconForm::CComponentsIconForm(const int x_pos, const int y_pos, const int w, const int h, const std::vector v_icon_names, bool has_shadow, + fb_pixel_t color_frame, fb_pixel_t color_body, fb_pixel_t color_shadow) +{ + initVarIconForm(); + + x = x_pos; + y = y_pos; + width = w; + height = h; + shadow = has_shadow; + col_frame = color_frame; + col_body = color_body; + col_shadow = color_shadow; + + v_icons = v_icon_names; +} + +void CComponentsIconForm::initVarIconForm() +{ + //CComponentsForm + initVarForm(); + cc_item_type = CC_ITEMTYPE_FRM_ICONFORM; + + //set default width and height to 0, this causes a dynamic adaptation of width and height of form + width = 0; + height = 0; + + v_icons.clear(); + ccif_offset = 2; + ccif_icon_align = CC_ICONS_FRM_ALIGN_LEFT; +} + +void CComponentsIconForm::addIcon(const std::string& icon_name) +{ + v_icons.push_back(icon_name); +} + +void CComponentsIconForm::addIcon(std::vector icon_name) +{ + for (size_t i= 0; i< icon_name.size(); i++) + v_icons.push_back(icon_name[i]); +} + +void CComponentsIconForm::insertIcon(const uint& icon_id, const std::string& icon_name) +{ + v_icons.insert(v_icons.begin()+icon_id, icon_name); +} + +void CComponentsIconForm::removeIcon(const uint& icon_id) +{ + v_icons.erase(v_icons.begin()+icon_id); +} + +void CComponentsIconForm::removeIcon(const std::string& icon_name) +{ + int id = getIconId(icon_name); + removeIcon(id); +} + +int CComponentsIconForm::getIconId(const std::string& icon_name) +{ + for (size_t i= 0; i< v_icons.size(); i++) + if (v_icons[i] == icon_name) + return i; + return -1; +} + +//For existing instances it's recommended +//to remove old items before add new icons, otherwise icons will be appended. +void CComponentsIconForm::removeAllIcons() +{ + if (!v_icons.empty()) + v_icons.clear(); + clearCCItems(); +} + +//get maximal form height depends of biggest icon height, but don't touch defined form height +void CComponentsIconForm::initMaxHeight(int *pheight) +{ + for (size_t i= 0; i< v_icons.size(); i++){ + int dummy, htmp; + frameBuffer->getIconSize(v_icons[i].c_str(), &dummy, &htmp); + *pheight = max(htmp, height)/*+2*fr_thickness*/; + } +} + +void CComponentsIconForm::initCCIcons() +{ + //clean up first possible old item objects, includes delete and clean up vector and icons + clearCCItems(); + + int ccp_y = 0; + int ccp_h = 0; + int ccp_w = 0; + //calculate start pos of first icon + int ccp_x = 0 + fr_thickness; //CC_ICONS_FRM_ALIGN_LEFT; + + if (ccif_icon_align == CC_ICONS_FRM_ALIGN_RIGHT) + ccp_x += (width - fr_thickness); + + //get width of first icon + frameBuffer->getIconSize(v_icons[0].c_str(), &ccp_w, &ccp_h); + + //get maximal form height + int h = 0; + initMaxHeight(&h); + + //set xpos of first icon with right alignment, icon must positionized on the right border reduced with icon width + if (ccif_icon_align == CC_ICONS_FRM_ALIGN_RIGHT) + ccp_x -= ccp_w; + + //init and add item objects + size_t i_cnt = v_icons.size(); //icon count + + for (size_t i= 0; i< i_cnt; i++){ + //create new cc-picture item object + CComponentsPicture *ccp = NULL; + ccp = new CComponentsPicture(ccp_x, ccp_y, ccp_w, h, v_icons[i]); + ccp->setPictureAlign(CC_ALIGN_HOR_CENTER | CC_ALIGN_VER_CENTER); + ccp->doPaintBg(false); + //add item to form + addCCItem(ccp); + + //reset current width for next object + ccp_w = 0; + //get next icon size if available + size_t next_i = i+1; + if (next_i != i_cnt) + frameBuffer->getIconSize(v_icons[next_i].c_str(), &ccp_w, &ccp_h); + + //set next icon position + int tmp_offset = ( igetWidth() + tmp_offset); + if (ccif_icon_align == CC_ICONS_FRM_ALIGN_RIGHT) + ccp_x -= (ccp_w + tmp_offset); + } + + //calculate width and height of form + int w_tmp = 0; + int h_tmp = 0; + for (size_t i= 0; i< i_cnt; i++){ + w_tmp += v_cc_items[i]->getWidth()+ccif_offset+fr_thickness; + h_tmp = max(h_tmp, v_cc_items[i]->getHeight()+2*fr_thickness); + + } + width = max(w_tmp, width); + height = max(h_tmp, height); +} + +void CComponentsIconForm::paint(bool do_save_bg) +{ + //init and add icons + initCCIcons(); + + //paint body + paintInit(do_save_bg); + + //paint + paintCCItems(); +} diff --git a/src/gui/components/cc_frm_window.cpp b/src/gui/components/cc_frm_window.cpp new file mode 100644 index 000000000..82e79ea15 --- /dev/null +++ b/src/gui/components/cc_frm_window.cpp @@ -0,0 +1,90 @@ +/* + Based up Neutrino-GUI - Tuxbox-Project + Copyright (C) 2001 by Steffen Hehn 'McClean' + + Classes for generic GUI-related components. + Copyright (C) 2012, 2013, Thilo Graf 'dbt' + Copyright (C) 2012, Michael Liebmann 'micha-bbg' + + License: GPL + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the + Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif + +#include +#include +#include "cc.h" + +using namespace std; + +//------------------------------------------------------------------------------------------------------- +//sub class CComponentsWindow inherit from CComponentsForm +CComponentsWindow::CComponentsWindow() +{ + initVarWindow(); +} + +void CComponentsWindow::initVarWindow() +{ + //CComponentsForm + initVarForm(); + cc_item_type = CC_ITEMTYPE_FRM_WINDOW; + + ccw_head = NULL; + ccw_caption = ""; + ccw_icon_name = NULL; + + setShadowOnOff(true); +} + +CComponentsWindow::~CComponentsWindow() +{ + if (ccw_head) + delete ccw_head; +} + +void CComponentsWindow::initHeader() +{ + if (ccw_head == NULL) + ccw_head = new CComponentsHeader(); + + ccw_head->setXPos(0); + ccw_head->setYPos(0); + ccw_head->setWidth(width); + ccw_head->setHeaderIcon(ccw_icon_name); + ccw_head->setHeaderText(ccw_caption); +} + +void CComponentsWindow::initCCWItems() +{ + initHeader(); + + if (ccw_head) + addCCItem(ccw_head); +} + +void CComponentsWindow::paint(bool do_save_bg) +{ + //paint body + paintInit(do_save_bg); + + //paint + paintCCItems(); +} diff --git a/src/gui/components/cc_item.cpp b/src/gui/components/cc_item.cpp new file mode 100644 index 000000000..8f60142a5 --- /dev/null +++ b/src/gui/components/cc_item.cpp @@ -0,0 +1,153 @@ +/* + Based up Neutrino-GUI - Tuxbox-Project + Copyright (C) 2001 by Steffen Hehn 'McClean' + + Classes for generic GUI-related components. + Copyright (C) 2012, 2013, Thilo Graf 'dbt' + Copyright (C) 2012, Michael Liebmann 'micha-bbg' + + License: GPL + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the + Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif + +#include +#include +#include "cc.h" + +using namespace std; + +//abstract sub class CComponentsItem from CComponents +CComponentsItem::CComponentsItem() +{ + //CComponentsItem + initVarItem(); + cc_item_type = CC_ITEMTYPE_BASE; +} + +// y +// x+------f-r-a-m-e-------+ +// | | +// height body | +// | | +// +--------width---------+ + +void CComponentsItem::initVarItem() +{ + //CComponents + initVarBasic(); + cc_item_index = CC_NO_INDEX; +} + +// Paint container background in cc-items with shadow, background and frame. +// This member must be called first in all paint() members before paint other items into the container. +// If backround is not required, it's possible to override this with variable paint_bg=false, use doPaintBg(true/false) to set this! +void CComponentsItem::paintInit(bool do_save_bg) +{ + clear(); + + if(!paint_bg) + return; + + int sw = shadow ? shadow_w : 0; + int th = fr_thickness; + + comp_fbdata_t fbdata[] = + { + {CC_FBDATA_TYPE_BGSCREEN, x, y, width+sw, height+sw, 0, 0, 0, NULL, NULL}, + {CC_FBDATA_TYPE_SHADOW, x+sw, y+sw, width, height, col_shadow, corner_rad, 0, NULL, NULL}, + {CC_FBDATA_TYPE_FRAME, x, y, width, height, col_frame, corner_rad, th, NULL, NULL}, + {CC_FBDATA_TYPE_BOX, x+th, y+th, width-2*th, height-2*th, col_body, corner_rad-th, 0, NULL, NULL}, + }; + + for(size_t i =0; i< (sizeof(fbdata) / sizeof(fbdata[0])) ;i++) + v_fbdata.push_back(fbdata[i]); +#ifdef DEBUG_CC + printf("[CComponentsItem] %s:\ncc_item_type: %d\ncc_item_index = %d\nheight = %d\nwidth = %d\n", __FUNCTION__, cc_item_type, cc_item_index, height, width); +#endif + paintFbItems(do_save_bg); +} + +//restore last saved screen behind form box, +//Do use parameter 'no restore' to override temporarly the restore funtionality. +//This could help to avoid ugly flicker efffects if it is necessary e.g. on often repaints, without changed contents. +void CComponentsItem::hideCCItem(bool no_restore) +{ + is_painted = false; + + if (saved_screen.pixbuf) { + frameBuffer->RestoreScreen(saved_screen.x, saved_screen.y, saved_screen.dx, saved_screen.dy, saved_screen.pixbuf); + if (no_restore) { + delete[] saved_screen.pixbuf; + saved_screen.pixbuf = NULL; + firstPaint = true; + } + } +} + +void CComponentsItem::hide(bool no_restore) +{ + hideCCItem(no_restore); +} + + +//hide rendered objects +void CComponentsItem::kill() +{ + //save current colors + fb_pixel_t c_tmp1, c_tmp2, c_tmp3; + c_tmp1 = col_body; + c_tmp2 = col_shadow; + c_tmp3 = col_frame; + + //set background color + col_body = col_frame = col_shadow = COL_BACKGROUND; + + //paint with background and restore last used colors + paint(CC_SAVE_SCREEN_NO); + col_body = c_tmp1; + col_shadow = c_tmp2; + col_frame = c_tmp3; + firstPaint = true; + is_painted = false; +} + +//synchronize colors for forms +//This is usefull if the system colors are changed during runtime +//so you can ensure correct applied system colors in relevant objects with unchanged instances. +void CComponentsItem::syncSysColors() +{ + col_body = COL_MENUCONTENT_PLUS_0; + col_shadow = COL_MENUCONTENTDARK_PLUS_0; + col_frame = COL_MENUCONTENT_PLUS_6; +} + +//returns current item element type, if no available, return -1 as unknown type +int CComponentsItem::getItemType() +{ + for(int i =0; i< (CC_ITEMTYPES) ;i++){ + if (i == cc_item_type) + return i; + } +#ifdef DEBUG_CC + printf("[CComponentsItem] %s: unknown item type requested...\n", __FUNCTION__); +#endif + return -1; +} diff --git a/src/gui/components/cc_item_box.cpp b/src/gui/components/cc_item_box.cpp new file mode 100644 index 000000000..4f80161fd --- /dev/null +++ b/src/gui/components/cc_item_box.cpp @@ -0,0 +1,615 @@ +/* + Based up Neutrino-GUI - Tuxbox-Project + Copyright (C) 2001 by Steffen Hehn 'McClean' + + Classes for generic GUI-related components. + Copyright (C) 2012, 2013, Thilo Graf 'dbt' + Copyright (C) 2012, Michael Liebmann 'micha-bbg' + + License: GPL + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the + Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif + +#include +#include +#include "cc.h" + +using namespace std; + +//sub class CComponentsItemBox from CComponentsItem +CComponentsItemBox::CComponentsItemBox() +{ + //CComponentsItemBox + initVarItemBox(); +} + +CComponentsItemBox::~CComponentsItemBox() +{ + hide(); + clearElements(); + clearSavedScreen(); + clear(); +} + +void CComponentsItemBox::initVarItemBox() +{ + //CComponents, CComponentsItem + initVarItem(); + + //CComponentsItemBox + it_col_text = COL_MENUCONTENT; + hSpacer = 2; + hOffset = 4; + vOffset = 1; + digit_h = 0; + digit_offset = 0; + font_text = NULL; + paintElements = true; + hMax = 0; + has_TextElement = false; + firstElementLeft = FIRST_ELEMENT_INIT; + firstElementRight = FIRST_ELEMENT_INIT; + prevElementLeft = 0; + prevElementRight = 0; + onlyOneTextElement = false; + isCalculated = false; + v_element_data.clear(); +} + +int CComponentsItemBox::getHeight() +{ + if (!isCalculated) + calculateElements(); + return height; +} + +void CComponentsItemBox::clearElements() +{ + for(size_t i = 0; i < v_element_data.size(); i++) { + switch (v_element_data[i].type) { + case CC_ITEMBOX_ICON: + case CC_ITEMBOX_PICTURE: + if (v_element_data[i].handler1 != NULL) + delete static_cast(v_element_data[i].handler1); + break; + case CC_ITEMBOX_TEXT: + if (v_element_data[i].handler1 != NULL) + delete static_cast(v_element_data[i].handler1); + if (v_element_data[i].handler2 != NULL) + delete static_cast(v_element_data[i].handler2); + break; + default: + break; + } + } + isCalculated = false; + v_element_data.clear(); +} +extern CPictureViewer * g_PicViewer; +bool CComponentsItemBox::addLogoOrText(int align, const std::string& logo, const std::string& text, size_t *index) +{ + comp_element_data_t data; + int dx=0, dy=0; + + data.align = align; + data.x = x; + data.y = y; + data.width = 0; + data.height = 0; + data.handler1 = NULL; + data.handler2 = NULL; + + g_PicViewer->getSize(logo.c_str(), &dx, &dy); + if ((dx != 0) && (dy != 0)) { + // logo OK + data.type = CC_ITEMBOX_PICTURE; + data.element = logo; + } + else { + // no logo + if ((text == "") || ((onlyOneTextElement) && (has_TextElement))) + return false; + else + has_TextElement = true; + if (font_text != NULL) + data.height = font_text->getHeight(); + data.type = CC_ITEMBOX_TEXT; + data.element = text; + } + + v_element_data.push_back(data); + if (index != NULL) + *index = v_element_data.size()-1; + isCalculated = false; + return true; +} + +void CComponentsItemBox::addText(const std::string& s_text, const int align, size_t *index) +{ + addElement(align, CC_ITEMBOX_TEXT, s_text, index); +} + +void CComponentsItemBox::addText(neutrino_locale_t locale_text, const int align, size_t *index) +{ + addElement(align, CC_ITEMBOX_TEXT, g_Locale->getText(locale_text), index); +} + +void CComponentsItemBox::addIcon(const std::string& s_icon_name, const int align, size_t *index) +{ + addElement(align, CC_ITEMBOX_ICON, s_icon_name, index); +} + +void CComponentsItemBox::addPicture(const std::string& s_picture_path, const int align, size_t *index) +{ + addElement(align, CC_ITEMBOX_PICTURE, s_picture_path, index); +} + +void CComponentsItemBox::addClock(const int align, size_t *index) +{ + addElement(align, CC_ITEMBOX_CLOCK, "", index); +} + +bool CComponentsItemBox::addElement(int align, int type, const std::string& element, size_t *index) +{ + comp_element_data_t data; + int dx=0, dy=0; + + switch (type) + { + case CC_ITEMBOX_ICON: + frameBuffer->getIconSize(element.c_str(), &dx, &dy); + if ((dx == 0) || (dy == 0)) + return false; + break; + case CC_ITEMBOX_TEXT: + if ((element == "") || ((onlyOneTextElement) && (has_TextElement))) + return false; + else + has_TextElement = true; + break; + default: + break; + } + + data.type = type; + data.align = align; + data.element = element; + data.x = x; + data.y = y; + data.width = 0; + data.height = 0; + data.handler1 = NULL; + data.handler2 = NULL; + + v_element_data.push_back(data); + if (index != NULL) + *index = v_element_data.size()-1; + isCalculated = false; + return true; +} + +void CComponentsItemBox::refreshElement(size_t index, const std::string& element) +{ + CComponentsPicture* pic = NULL; + switch (v_element_data[index].type) { + case CC_ITEMBOX_PICTURE: + pic = static_cast(v_element_data[index].handler1); + if (pic != NULL) { + pic->hide(); + delete pic; + } + v_element_data[index].element = element; + v_element_data[index].x = x; + v_element_data[index].y = y; + v_element_data[index].width = 0; + v_element_data[index].height = 0; + v_element_data[index].handler1 = NULL; + v_element_data[index].handler2 = NULL; + break; + default: + break; + } + calculateElements(); +} + +//paint image into item box +void CComponentsItemBox::paintImage(size_t index, bool newElement) +{ + CComponentsPicture* pic = NULL; + pic = static_cast(v_element_data[index].handler1); + + int pw = 0, ph = 0; + + if ((newElement) || (pic == NULL)) { + if (pic != NULL) { + pic->hide(); + delete pic; + pic = NULL; + } + if ((v_element_data[index].type) == CC_ITEMBOX_PICTURE) + pic = new CComponentsPicture( v_element_data[index].x, v_element_data[index].y, v_element_data[index].width, + v_element_data[index].height, v_element_data[index].element); + else + pic = new CComponentsPicture( v_element_data[index].x, v_element_data[index].y, 0, 0, v_element_data[index].element); + v_element_data[index].handler1 = (void*)pic; + } + + pic->getPictureSize(&pw, &ph); + pic->setHeight(ph); + pic->setWidth(pw); + pic->setColorBody(col_body); + pic->paint(); +} + +//paint text into item box +void CComponentsItemBox::paintText(size_t index, bool newElement) +{ + //prepare textbox dimension instances + CBox* box = NULL; + box = static_cast(v_element_data[index].handler1); + + if ((newElement) || (box == NULL)) { + if (box != NULL) { + delete box; + box = NULL; + } + box = new CBox(); + v_element_data[index].handler1 = (void*)box; + } + + box->iX = v_element_data[index].x; + box->iY = v_element_data[index].y; + box->iWidth = v_element_data[index].width; + box->iHeight = v_element_data[index].height; + + + //prepare text + CTextBox* textbox = NULL; + textbox = static_cast(v_element_data[index].handler2); + + if ((newElement) || (textbox == NULL)) { + if (textbox != NULL) { + textbox->hide(); + delete textbox; + textbox = NULL; + } + textbox = new CTextBox(v_element_data[index].element.c_str(), font_text, CTextBox::AUTO_WIDTH|CTextBox::AUTO_HIGH, box, col_body); + v_element_data[index].handler2 = (void*)textbox; + } + + textbox->setTextBorderWidth(0); + textbox->enableBackgroundPaint(false); + textbox->setTextFont(font_text); + textbox->movePosition(box->iX, box->iY); + textbox->setTextColor(it_col_text); + + if (textbox->setText(&v_element_data[index].element)) + textbox->paint(); +} + + +//paint available elements at one task +void CComponentsItemBox::paintElement(size_t index, bool newElement) +{ + switch (v_element_data[index].type) { + case CC_ITEMBOX_ICON: + case CC_ITEMBOX_PICTURE: + paintImage(index,newElement); + break; + case CC_ITEMBOX_TEXT: + paintText(index,newElement); + break; + case CC_ITEMBOX_CLOCK: + font_text->RenderString(v_element_data[index].x, v_element_data[index].y, v_element_data[index].width, + v_element_data[index].element.c_str(), it_col_text); + break; + default: + break; + } +} + +void CComponentsItemBox::calSizeOfElements() +{ + size_t i; + + // Set element size + for (i = 0; i < v_element_data.size(); i++) { + switch (v_element_data[i].type) + { + case CC_ITEMBOX_ICON: + frameBuffer->getIconSize(v_element_data[i].element.c_str(), &v_element_data[i].width, &v_element_data[i].height); + break; + case CC_ITEMBOX_PICTURE: + g_PicViewer->getSize(v_element_data[i].element.c_str(), &v_element_data[i].width, &v_element_data[i].height); + break; + case CC_ITEMBOX_TEXT: + if (font_text != NULL) + v_element_data[i].height = font_text->getHeight(); + break; + case CC_ITEMBOX_CLOCK: { + if (!g_Sectionsd->getIsTimeSet()) + break; + if (font_text != NULL) { + char timestr[10] = {0}; + time_t now = time(NULL); + struct tm *tm = localtime(&now); + strftime(timestr, sizeof(timestr)-1, "%H:%M", tm); + + digit_h = font_text->getDigitHeight(); + digit_offset = font_text->getDigitOffset(); + v_element_data[i].height = digit_h + (int)((float)digit_offset*1.5); +// v_element_data[i].width = font_text->getRenderWidth(widest_number)*4 + font->getRenderWidth(":"); + v_element_data[i].width = font_text->getRenderWidth(timestr); + v_element_data[i].element = timestr; + } + } + break; + default: + break; + } + } + + // Calculate largest height without CC_ITEMBOX_PICTURE + firstElementLeft = FIRST_ELEMENT_INIT; + firstElementRight = FIRST_ELEMENT_INIT; + for (i = 0; i < v_element_data.size(); i++) { + if ((firstElementLeft == FIRST_ELEMENT_INIT) && (v_element_data[i].align == CC_ALIGN_LEFT)) + firstElementLeft = i; + if ((firstElementRight == FIRST_ELEMENT_INIT) && (v_element_data[i].align == CC_ALIGN_RIGHT)) + firstElementRight = i; + if (v_element_data[i].type != CC_ITEMBOX_PICTURE) + hMax = max(v_element_data[i].height, hMax); + } +} + +void CComponentsItemBox::calPositionOfElements() +{ + size_t i; + + // Calculate y-positions + height = hMax + 2*vOffset; + for (i = 0; i < v_element_data.size(); i++) { + v_element_data[i].y = y + (height - v_element_data[i].height) / 2; + if (v_element_data[i].type == CC_ITEMBOX_CLOCK) + v_element_data[i].y += v_element_data[i].height + digit_offset/4; + } + + // Calculate x-positions + for (i = 0; i < v_element_data.size(); i++) { + if (firstElementLeft == i){ + prevElementLeft = i; + v_element_data[i].x = x + hOffset + corner_rad/2; + } + else if (firstElementRight == i){ + prevElementRight = i; + v_element_data[i].x = x + width - v_element_data[i].width - hOffset - corner_rad/2; + } + else { + if (v_element_data[i].align == CC_ALIGN_LEFT) { + // left elements + v_element_data[i].x = v_element_data[prevElementLeft].x + v_element_data[prevElementLeft].width + hSpacer; + prevElementLeft = i; + } + else { + // right elements + v_element_data[i].x = v_element_data[prevElementRight].x - v_element_data[i].width - hSpacer; + prevElementRight = i; + } + } + } +} + +void CComponentsItemBox::calculateElements() +{ + if (v_element_data.empty()) + return; + + size_t i; + + calSizeOfElements(); + + // hMax correction if no text element. + if (!has_TextElement) + hMax = max(font_text->getHeight(), hMax); + + // Calculate logo + for (i = 0; i < v_element_data.size(); i++) { + if (v_element_data[i].type == CC_ITEMBOX_PICTURE) { + if ((v_element_data[i].width > LOGO_MAX_WIDTH) || (v_element_data[i].height > hMax)) + g_PicViewer->rescaleImageDimensions(&v_element_data[i].width, &v_element_data[i].height, LOGO_MAX_WIDTH, hMax); + } + } + + // Calculate text width + int allWidth = 0; + for (i = 0; i < v_element_data.size(); i++) { + if (v_element_data[i].type != CC_ITEMBOX_TEXT) + allWidth += v_element_data[i].width + hSpacer; + } + for (i = 0; i < v_element_data.size(); i++) { + if (v_element_data[i].type == CC_ITEMBOX_TEXT) { + v_element_data[i].width = width - (allWidth + 2*hSpacer); + // If text is too long, number of rows = 2 + if (font_text->getRenderWidth(v_element_data[i].element) > v_element_data[i].width) { + v_element_data[i].height = font_text->getHeight() * 2; + hMax = max(v_element_data[i].height, hMax); + } + break; + } + } + + calPositionOfElements(); + isCalculated = true; +} + +void CComponentsItemBox::paintItemBox(bool do_save_bg) +{ + // paint background + paintInit(do_save_bg); + + if ((v_element_data.empty()) || (!paintElements)) + return; + + // paint elements + for (size_t i = 0; i < v_element_data.size(); i++) + paintElement(i); +} + +void CComponentsItemBox::clearTitlebar() +{ + clearElements(); + paintElements = false; + paint(false); + paintElements = true; +} + + + +//------------------------------------------------------------------------------------------------------- +//sub class CComponentsTitleBar from CComponentsItemBox +CComponentsTitleBar::CComponentsTitleBar() +{ + //CComponentsTitleBar + initVarTitleBar(); +} + +void CComponentsTitleBar::initVarTitleBar() +{ + //CComponentsItemBox + initVarItemBox(); + onlyOneTextElement = true; + + font_text = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]; + it_col_text = COL_MENUHEAD; + + //CComponents + x = 0; + y = 0; + height = font_text->getHeight() + 2*hSpacer; + width = frameBuffer->getScreenWidth(true);; + col_body = COL_MENUHEAD_PLUS_0; + corner_type = CORNER_TOP; + corner_rad = RADIUS_LARGE; + + //CComponentsTitleBar + tb_text_align = CC_ALIGN_LEFT; + tb_icon_align = CC_ALIGN_LEFT; + tb_c_text = NULL; + tb_s_text = ""; + tb_locale_text = NONEXISTANT_LOCALE; + tb_icon_name = ""; +} + +CComponentsTitleBar::CComponentsTitleBar(const int x_pos, const int y_pos, const int w, const int h, const char* c_text, const std::string& s_icon, + fb_pixel_t color_text, fb_pixel_t color_body) +{ + //CComponentsItemBox + initVarTitleBar(); + it_col_text = color_text; + + //CComponents + x = x_pos; + y = y_pos; + height = h; + width = w; + col_body = color_body; + + //CComponentsTitleBar + tb_c_text = c_text; + tb_icon_name = s_icon; + + initElements(); +} + +CComponentsTitleBar::CComponentsTitleBar(const int x_pos, const int y_pos, const int w, const int h, const string& s_text, const std::string& s_icon, + fb_pixel_t color_text, fb_pixel_t color_body) +{ + //CComponentsItemBox + initVarTitleBar(); + it_col_text = color_text; + + //CComponents + x = x_pos; + y = y_pos; + height = h; + width = w; + col_body = color_body; + + //CComponentsTitleBar + tb_s_text = s_text; + tb_icon_name = s_icon; + + initElements(); +} + +CComponentsTitleBar::CComponentsTitleBar(const int x_pos, const int y_pos, const int w, const int h, neutrino_locale_t locale_text, const std::string& s_icon, + fb_pixel_t color_text, fb_pixel_t color_body) +{ + //CComponentsItemBox + initVarTitleBar(); + it_col_text = color_text; + + //CComponents + x = x_pos; + y = y_pos; + height = h; + width = w; + col_body = color_body; + + //CComponentsTitleBar + tb_locale_text = locale_text; + tb_s_text = g_Locale->getText(tb_locale_text); + tb_icon_name = s_icon; + + initElements(); +} + +///basic init methodes for constructors *************************************** +void CComponentsTitleBar::initIcon() +{ + if (!tb_icon_name.empty()) + addElement (tb_icon_align, CC_ITEMBOX_ICON, tb_icon_name); +} + +void CComponentsTitleBar::initText() +{ + if (tb_c_text){ + addElement (tb_text_align, CC_ITEMBOX_TEXT, tb_c_text); + return; + } + else if (!tb_s_text.empty()){ + addElement (tb_text_align, CC_ITEMBOX_TEXT, tb_s_text); + return; + } +} + +void CComponentsTitleBar::initElements() +{ + initIcon(); + initText(); +} +///***************************************************************************** + +void CComponentsTitleBar::paint(bool do_save_bg) +{ + calculateElements(); + paintItemBox(do_save_bg); +} diff --git a/src/gui/components/cc_item_infobox.cpp b/src/gui/components/cc_item_infobox.cpp new file mode 100644 index 000000000..adc92c5eb --- /dev/null +++ b/src/gui/components/cc_item_infobox.cpp @@ -0,0 +1,132 @@ +/* + Based up Neutrino-GUI - Tuxbox-Project + Copyright (C) 2001 by Steffen Hehn 'McClean' + + Classes for generic GUI-related components. + Copyright (C) 2012, 2013, Thilo Graf 'dbt' + Copyright (C) 2012, Michael Liebmann 'micha-bbg' + + License: GPL + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the + Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif + +#include +#include +#include "cc.h" + +using namespace std; + +//sub class CComponentsInfoBox from CComponentsItem +CComponentsInfoBox::CComponentsInfoBox() +{ + //CComponentsInfoBox + initVarInfobox(); +} + +CComponentsInfoBox::CComponentsInfoBox(const int x_pos, const int y_pos, const int w, const int h, + const char* info_text, const int mode, Font* font_text, + bool has_shadow, + fb_pixel_t color_text, fb_pixel_t color_frame, fb_pixel_t color_body, fb_pixel_t color_shadow) +{ + //CComponentsInfoBox + initVarInfobox(); + + x = x_pos; + y = y_pos; + width = w; + height = h; + shadow = has_shadow; + col_frame = color_frame; + col_body = color_body; + col_shadow = color_shadow; + + ct_text = info_text; + ct_text_mode = mode; + ct_font = font_text; + ct_col_text = color_text; +} + +CComponentsInfoBox::~CComponentsInfoBox() +{ + hide(); + clearSavedScreen(); + clearCCText(); + delete pic; + delete cctext; + clear(); +} + +void CComponentsInfoBox::initVarInfobox() +{ + //CComponents, CComponentsItem, CComponentsText + initVarText(); + cc_item_type = CC_ITEMTYPE_TEXT_INFOBOX; + + //CComponentsInfoBox + pic = NULL; + cctext = NULL; + pic_name = ""; + x_offset = 10; + x_text = x+fr_thickness+x_offset;; + +} + +void CComponentsInfoBox::paintPicture() +{ + //init and set icon paint position + if (pic == NULL) + pic = new CComponentsPicture(x+fr_thickness+x_offset, y+fr_thickness/*+y_offset*/, 0, 0, ""); + pic->setXPos(x+fr_thickness+x_offset); + pic->setYPos(y+fr_thickness); + + //define icon + pic->setPicture(pic_name); + + //fit icon into infobox + pic->setHeight(height-2*fr_thickness); + pic->setColorBody(col_body); + + pic->paint(CC_SAVE_SCREEN_NO); +} + +void CComponentsInfoBox::paint(bool do_save_bg) +{ + paintInit(do_save_bg); + paintPicture(); + + //define text x position + x_text = x+fr_thickness+x_offset; + + //set text to the left border if picture is not painted + if (pic->isPicPainted()){ + int pic_w = pic->getWidth(); + x_text += pic_w+x_offset; + } + + //set text and paint text lines + if (ct_text){ + if (cctext == NULL) + cctext = new CComponentsText(); + cctext->setText(ct_text, ct_text_mode, ct_font); + cctext->setDimensionsAll(x_text, y+fr_thickness, width-(x_text-x+x_offset+fr_thickness), height-2*fr_thickness); + cctext->paint(CC_SAVE_SCREEN_NO); + } +} diff --git a/src/gui/components/cc_item_picture.cpp b/src/gui/components/cc_item_picture.cpp new file mode 100644 index 000000000..64b67df0a --- /dev/null +++ b/src/gui/components/cc_item_picture.cpp @@ -0,0 +1,185 @@ +/* + Based up Neutrino-GUI - Tuxbox-Project + Copyright (C) 2001 by Steffen Hehn 'McClean' + + Classes for generic GUI-related components. + Copyright (C) 2012, 2013, Thilo Graf 'dbt' + Copyright (C) 2012, Michael Liebmann 'micha-bbg' + + License: GPL + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the + Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif + +#include +#include +#include "cc.h" + +extern CPictureViewer * g_PicViewer; + +using namespace std; + + +//------------------------------------------------------------------------------------------------------- +//sub class CComponentsPicture from CComponentsItem +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, + 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); + + 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, + fb_pixel_t color_frame, fb_pixel_t color_background, fb_pixel_t color_shadow) +{ + //CComponents, CComponentsItem + initVarItem(); + cc_item_type = CC_ITEMTYPE_PICTURE; + + //CComponentsPicture + pic_name = image_name; + pic_align = alignment; + pic_offset = 1; + pic_paint = true; + pic_paintBg = false; + pic_painted = false; + do_paint = false; + pic_max_w = 0; + pic_max_h = 0; + if (pic_name.empty()) + pic_width = pic_height = 0; + + //CComponents + 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) +{ + pic_name = picture_name; + initVarPicture(); +} + + +void CComponentsPicture::setPictureAlign(const int alignment) +{ + pic_align = alignment; + initVarPicture(); +} + + +void CComponentsPicture::initVarPicture() +{ + pic_width = pic_height = 0; + pic_painted = false; + do_paint = false; + + if (pic_max_w == 0) + pic_max_w = width-2*fr_thickness; + + if (pic_max_h == 0) + pic_max_h = height-2*fr_thickness; + + //set the image mode depends of name syntax, icon names contains no path, + //so we can detect the required image mode + if (pic_paint_mode == CC_PIC_IMAGE_MODE_AUTO){ + if (!access(pic_name.c_str(), F_OK )) + pic_paint_mode = CC_PIC_IMAGE_MODE_ON; + else + pic_paint_mode = CC_PIC_IMAGE_MODE_OFF; + } + + if (pic_paint_mode == CC_PIC_IMAGE_MODE_OFF){ + frameBuffer->getIconSize(pic_name.c_str(), &pic_width, &pic_height); +#if 0 + pic_width = max(pic_width, pic_max_w); + pic_height = max(pic_height, pic_max_h); +#endif + } + + if (pic_paint_mode == CC_PIC_IMAGE_MODE_ON) { + g_PicViewer->getSize(pic_name.c_str(), &pic_width, &pic_height); + if((pic_width > pic_max_w) || (pic_height > pic_max_h)) + g_PicViewer->rescaleImageDimensions(&pic_width, &pic_height, pic_max_w, pic_max_h); + } + +#ifdef DEBUG_CC + if (pic_width == 0 || pic_height == 0) + printf("[CComponentsPicture] %s file: %s, no icon dimensions found! width = %d, height = %d\n", __FUNCTION__, pic_name.c_str(), pic_width, pic_height); +#endif + + pic_x += fr_thickness; + pic_y += fr_thickness; + + if (pic_height>0 && pic_width>0){ + if (pic_align & CC_ALIGN_LEFT) + pic_x = x+fr_thickness; + if (pic_align & CC_ALIGN_RIGHT) + pic_x = x+width-pic_width-fr_thickness; + if (pic_align & CC_ALIGN_TOP) + pic_y = y+fr_thickness; + if (pic_align & CC_ALIGN_BOTTOM) + pic_y = y+height-pic_height-fr_thickness; + if (pic_align & CC_ALIGN_HOR_CENTER) + pic_x = x+width/2-pic_width/2; + if (pic_align & CC_ALIGN_VER_CENTER) + pic_y = y+height/2-pic_height/2; + + do_paint = true; + } + + int sw = (shadow ? shadow_w :0); + width = max(max(pic_width, pic_max_w), width) + sw ; + height = max(max(pic_height, pic_max_h), height) + sw ; +} + +void CComponentsPicture::paint(bool do_save_bg) +{ + initVarPicture(); + paintInit(do_save_bg); + pic_painted = false; + + if (do_paint){ + if (pic_paint_mode == CC_PIC_IMAGE_MODE_OFF) + pic_painted = frameBuffer->paintIcon(pic_name, pic_x, pic_y, 0 /*pic_max_h*/, pic_offset, pic_paint, pic_paintBg, col_body); + else if (pic_paint_mode == CC_PIC_IMAGE_MODE_ON) + pic_painted = g_PicViewer->DisplayImage(pic_name, pic_x, pic_y, pic_width, pic_height); + do_paint = false; + } +} + +void CComponentsPicture::hide(bool no_restore) +{ + hideCCItem(no_restore); + pic_painted = false; +} diff --git a/src/gui/components/cc_item_shapes.cpp b/src/gui/components/cc_item_shapes.cpp new file mode 100644 index 000000000..4c4a71001 --- /dev/null +++ b/src/gui/components/cc_item_shapes.cpp @@ -0,0 +1,101 @@ +/* + Based up Neutrino-GUI - Tuxbox-Project + Copyright (C) 2001 by Steffen Hehn 'McClean' + + Classes for generic GUI-related components. + Copyright (C) 2012, 2013, Thilo Graf 'dbt' + Copyright (C) 2012, Michael Liebmann 'micha-bbg' + + License: GPL + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the + Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif + +#include +#include +#include "cc.h" + +using namespace std; + +//sub class CComponentsShapeSquare from CComponentsItem +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) +{ + //CComponentsItem + initVarItem(); + cc_item_type = CC_ITEMTYPE_SHAPE_SQUARE; + + x = x_pos; + y = y_pos; + width = w; + height = h; + shadow = has_shadow; + shadow_w = SHADOW_OFFSET; + col_frame = color_frame; + col_body = color_body; + col_shadow = color_shadow; +} + +void CComponentsShapeSquare::paint(bool do_save_bg) +{ + paintInit(do_save_bg); +} + + +//------------------------------------------------------------------------------------------------------- +//sub class CComponentsShapeCircle from CComponentsItem +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) +{ + //CComponents, CComponentsItem + initVarItem(); + cc_item_type = CC_ITEMTYPE_SHAPE_CIRCLE; + + //CComponents + x = x_pos; + y = y_pos; + //width = height = d = diam; + shadow = has_shadow; + shadow_w = SHADOW_OFFSET; + col_frame = color_frame; + col_body = color_body; + col_shadow = color_shadow; + + //CComponentsShapeCircle + width = height = d = diam; + + //CComponentsItem + corner_rad = d/2; +} + +// y +// x+ - + +// +// +// +// |----d-i-a-m----| +// +// +// +// + - + + +void CComponentsShapeCircle::paint(bool do_save_bg) +{ + paintInit(do_save_bg); +} diff --git a/src/gui/components/cc_item_text.cpp b/src/gui/components/cc_item_text.cpp new file mode 100644 index 000000000..c5eff67e1 --- /dev/null +++ b/src/gui/components/cc_item_text.cpp @@ -0,0 +1,188 @@ +/* + Based up Neutrino-GUI - Tuxbox-Project + Copyright (C) 2001 by Steffen Hehn 'McClean' + + Classes for generic GUI-related components. + Copyright (C) 2012, 2013, Thilo Graf 'dbt' + Copyright (C) 2012, Michael Liebmann 'micha-bbg' + + License: GPL + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the + Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif + +#include +#include +#include "cc.h" + +using namespace std; + +//sub class CComponentsText from CComponentsItem +CComponentsText::CComponentsText() +{ + //CComponentsText + initVarText(); +} + +CComponentsText::CComponentsText( const int x_pos, const int y_pos, const int w, const int h, + const char* text, const int mode, Font* font_text, + bool has_shadow, + fb_pixel_t color_text, fb_pixel_t color_frame, fb_pixel_t color_body, fb_pixel_t color_shadow) +{ + //CComponentsText + initVarText(); + + //CComponents + x = x_pos, + y = y_pos, + width = w; + height = h; + + col_frame = color_frame; + col_body = color_body; + col_shadow = color_shadow; + shadow = has_shadow; + + ct_font = font_text; + ct_text = text; + ct_text_mode = mode; + ct_col_text = color_text; +} + + + +CComponentsText::~CComponentsText() +{ + hide(); + clearSavedScreen(); + clearCCText(); + clear(); +} + + +void CComponentsText::initVarText() +{ + //CComponents, CComponentsItem + initVarItem(); + cc_item_type = CC_ITEMTYPE_TEXT; + + //CComponentsText + ct_font = NULL; + ct_box = NULL; + ct_textbox = NULL; + ct_text = NULL; + ct_text_mode = CTextBox::AUTO_WIDTH; + ct_col_text = COL_MENUCONTENT; + ct_text_sent = false; +} + + +void CComponentsText::initCCText() +{ + //set default font, if is no font definied + if (ct_font == NULL) + ct_font = g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL]; + + //define height from font size + height = max(height, ct_font->getHeight()); + + //text box dimensions + if (ct_box){ + //ensure that we have a new instance + delete ct_box; + ct_box = NULL; + } + ct_box = new CBox(); + ct_box->iX = x+fr_thickness; + ct_box->iY = y+fr_thickness; + ct_box->iWidth = width-2*fr_thickness; + ct_box->iHeight = height-2*fr_thickness; + + //init textbox + if (ct_textbox == NULL) + ct_textbox = new CTextBox(); + + //set text box properties + ct_textbox->setTextFont(ct_font); + ct_textbox->setTextMode(ct_text_mode); + ct_textbox->setWindowPos(ct_box); + ct_textbox->setTextBorderWidth(0); + ct_textbox->enableBackgroundPaint(false); + ct_textbox->setBackGroundColor(col_body); + ct_textbox->setBackGroundRadius(corner_rad-fr_thickness, corner_type); + ct_textbox->setTextColor(ct_col_text); + ct_textbox->setWindowMaxDimensions(ct_box->iWidth, ct_box->iHeight); + ct_textbox->setWindowMinDimensions(ct_box->iWidth, ct_box->iHeight); + + //set text + string new_text = static_cast (ct_text); + ct_text_sent = ct_textbox->setText(&new_text, ct_box->iWidth); +} + +void CComponentsText::clearCCText() +{ + if (ct_box) + delete ct_box; + ct_box = NULL; + + if (ct_textbox) + delete ct_textbox; + ct_textbox = NULL; +} + +void CComponentsText::setText(neutrino_locale_t locale_text, int mode, Font* font_text) +{ + ct_text = g_Locale->getText(locale_text); + ct_text_mode = mode; + ct_font = font_text; +} + +void CComponentsText::paintText(bool do_save_bg) +{ + paintInit(do_save_bg); + initCCText(); + if (ct_text_sent) + ct_textbox->paint(); + ct_text_sent = false; +} + +void CComponentsText::paint(bool do_save_bg) +{ + + paintText(do_save_bg); +} + +void CComponentsText::hide(bool no_restore) +{ + + if (ct_textbox) + ct_textbox->hide(); + hideCCItem(no_restore); +} + +//small helper to remove excessiv linbreaks +void CComponentsText::removeLineBreaks(std::string& str) +{ + std::string::size_type spos = str.find_first_of("\r\n"); + while (spos != std::string::npos) { + str.replace(spos, 1, " "); + spos = str.find_first_of("\r\n"); + } +} diff --git a/src/gui/components/cc_item_tvpig.cpp b/src/gui/components/cc_item_tvpig.cpp new file mode 100644 index 000000000..dffd857b3 --- /dev/null +++ b/src/gui/components/cc_item_tvpig.cpp @@ -0,0 +1,84 @@ +/* + Based up Neutrino-GUI - Tuxbox-Project + Copyright (C) 2001 by Steffen Hehn 'McClean' + + Classes for generic GUI-related components. + Copyright (C) 2012, 2013, Thilo Graf 'dbt' + Copyright (C) 2012, Michael Liebmann 'micha-bbg' + + License: GPL + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the + Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif + +#include +#include +#include "cc.h" + +#include + +extern cVideo * videoDecoder; + +using namespace std; + +//------------------------------------------------------------------------------------------------------- +//sub class CComponentsPIP from CComponentsItem +CComponentsPIP::CComponentsPIP( const int x_pos, const int y_pos, const int percent, bool has_shadow) +{ + //CComponents, CComponentsItem + initVarItem(); + cc_item_type = CC_ITEMTYPE_PIP; + + //CComponentsPIP + screen_w = frameBuffer->getScreenWidth(true); + screen_h = frameBuffer->getScreenHeight(true); + + //CComponents + x = x_pos; + y = y_pos; + width = percent*screen_w/100; + height = percent*screen_h/100; + shadow = has_shadow; + shadow_w = SHADOW_OFFSET; + col_frame = COL_BACKGROUND; + col_body = COL_BACKGROUND; + col_shadow = COL_MENUCONTENTDARK_PLUS_0; +} + +CComponentsPIP::~CComponentsPIP() +{ + hide(); + clearSavedScreen(); + clear(); + videoDecoder->Pig(-1, -1, -1, -1); +} + +void CComponentsPIP::paint(bool do_save_bg) +{ + paintInit(do_save_bg); + videoDecoder->Pig(x+fr_thickness, y+fr_thickness, width-2*fr_thickness, height-2*fr_thickness, screen_w, screen_h); +} + + +void CComponentsPIP::hide(bool no_restore) +{ + hideCCItem(no_restore); + videoDecoder->Pig(-1, -1, -1, -1); +} From bdce50780d916598b4a99ce8ff3aa8a943743a2e Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Fri, 1 Mar 2013 17:11:48 +0100 Subject: [PATCH 153/224] CAudioPlayerGui: set missing corner mode for info box --- src/gui/audioplayer.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/gui/audioplayer.cpp b/src/gui/audioplayer.cpp index e81e4f36f..76089d082 100644 --- a/src/gui/audioplayer.cpp +++ b/src/gui/audioplayer.cpp @@ -1931,6 +1931,7 @@ void CAudioPlayerGui::paintItemID3DetailsLine (int pos) // paint id3 infobox if (ibox == NULL) ibox = new CComponentsInfoBox(m_x, ypos2, m_width, m_info_height); + ibox->setCornerRadius(RADIUS_LARGE); ibox->setYPos(ypos2); ibox->paint(false); From 061700a5f85a6b85609d26863cd08e39a9361cd7 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Fri, 8 Mar 2013 08:41:50 +0100 Subject: [PATCH 154/224] CComponentsPicture: fix build Build can be broken with other build environments --- src/gui/components/cc_item_picture.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/gui/components/cc_item_picture.cpp b/src/gui/components/cc_item_picture.cpp index 64b67df0a..d330204be 100644 --- a/src/gui/components/cc_item_picture.cpp +++ b/src/gui/components/cc_item_picture.cpp @@ -31,6 +31,7 @@ #include #include #include "cc.h" +#include extern CPictureViewer * g_PicViewer; From 45d8c176ecd0e66c623359819eb1fda7901ceb95 Mon Sep 17 00:00:00 2001 From: Stefan Seyfried Date: Sat, 9 Mar 2013 17:36:02 +0100 Subject: [PATCH 155/224] CVolume: fix border around volume bar --- src/driver/volume.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/driver/volume.cpp b/src/driver/volume.cpp index c3ccf34c3..60515ee6f 100644 --- a/src/driver/volume.cpp +++ b/src/driver/volume.cpp @@ -251,7 +251,7 @@ void CVolume::setVolume(const neutrino_msg_t key, const bool bDoPaint, bool nowa // volumebar frameBuffer->paintBoxRel(x , y , (paintDigits) ? vbar_w - vbar_h : vbar_w + 1, vbar_h, colBar, ROUNDED, (paintDigits) ? CORNER_TOP_LEFT | CORNER_BOTTOM_LEFT : CORNER_ALL); // frame for progress - frameBuffer->paintBoxRel(progress_x-pB, progress_y-pB, progress_w+pB*1, progress_h+pB*2, colFrame); + frameBuffer->paintBoxRel(progress_x-pB, progress_y-pB, progress_w+pB*2, progress_h+pB*2, colFrame); // volume icon frameBuffer->paintIcon(NEUTRINO_ICON_VOLUME, icon_x, icon_y, 0, colBar); From 119f87f97bcc4d84f78ddd723c1f6d483b3b79b6 Mon Sep 17 00:00:00 2001 From: Stefan Seyfried Date: Sat, 9 Mar 2013 18:08:23 +0100 Subject: [PATCH 156/224] my_system: return errno, silence trivial error message --- src/system/helpers.cpp | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/system/helpers.cpp b/src/system/helpers.cpp index 3fa3c81d7..97671df3c 100644 --- a/src/system/helpers.cpp +++ b/src/system/helpers.cpp @@ -102,7 +102,8 @@ int my_system(int argc, const char *arg, ...) { case -1: /* can't vfork */ perror("vfork"); - return -1; + ret = -errno; + goto out; case 0: /* child process */ for(i = 3; i < maxfd; i++) close(i); @@ -110,17 +111,21 @@ int my_system(int argc, const char *arg, ...) perror("my_system setsid"); if (execvp(argv[0], (char * const *)argv)) { - std::string txt = "ERROR: my_system \"" + (std::string) argv[0] + "\""; - perror(txt.c_str()); - ret = -1; + if (errno != ENOENT) { /* don't complain if argv[0] only does not exist */ + std::string txt = "ERROR: my_system \"" + (std::string) argv[0] + "\""; + perror(txt.c_str()); + } + ret = -errno; } _exit (0); // terminate c h i l d proces s only default: /* parent returns to calling process */ break; } + /* it is probably pure luck that ret gets propagated back from child to parent */ waitpid(pid, &childExit, 0); if(childExit != 0) ret = childExit; + out: va_end(args); return ret; } From 04cd53f45d745b52685dec2d5b19c791e55478c2 Mon Sep 17 00:00:00 2001 From: Stefan Seyfried Date: Sat, 9 Mar 2013 18:21:36 +0100 Subject: [PATCH 157/224] screenshot: fix invalid cast in debug message --- src/driver/screenshot.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/driver/screenshot.cpp b/src/driver/screenshot.cpp index 95a146daf..30b3be620 100644 --- a/src/driver/screenshot.cpp +++ b/src/driver/screenshot.cpp @@ -99,7 +99,7 @@ bool CScreenShot::GetData() return false; } - printf("CScreenShot::GetData: data: %x %d x %d\n", (int) pixel_data, xres, yres); + printf("CScreenShot::GetData: data: %p %d x %d\n", pixel_data, xres, yres); return true; } From 2f677a5ffe92eeb3494d8b3293dbaccfce4d7f18 Mon Sep 17 00:00:00 2001 From: Stefan Seyfried Date: Sat, 9 Mar 2013 23:58:31 +0100 Subject: [PATCH 158/224] bouquetlist: mark autogenerated bouquets as readonly this at least prevents modification from the context menu, needs more work in the service->bouquetmanagement menus --- src/gui/bouquetlist.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/bouquetlist.cpp b/src/gui/bouquetlist.cpp index a3fefe005..135322e39 100644 --- a/src/gui/bouquetlist.cpp +++ b/src/gui/bouquetlist.cpp @@ -88,7 +88,7 @@ CBouquet* CBouquetList::addBouquet(CZapitBouquet * zapitBouquet) else bname = zapitBouquet->Name.c_str(); - CBouquet* tmp = new CBouquet(BouquetKey, bname, zapitBouquet->bLocked); + CBouquet* tmp = new CBouquet(BouquetKey, bname, zapitBouquet->bLocked, !zapitBouquet->bUser); tmp->zapitBouquet = zapitBouquet; Bouquets.push_back(tmp); return tmp; From 0613e4373682d755e44cfb2f080f4ab9c9e26f91 Mon Sep 17 00:00:00 2001 From: Stefan Seyfried Date: Sun, 10 Mar 2013 00:01:04 +0100 Subject: [PATCH 159/224] bouquetlist: fix width calculation --- src/gui/bouquetlist.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/bouquetlist.cpp b/src/gui/bouquetlist.cpp index 135322e39..595ad9b84 100644 --- a/src/gui/bouquetlist.cpp +++ b/src/gui/bouquetlist.cpp @@ -328,7 +328,7 @@ int CBouquetList::show(bool bShowChannelList) for(unsigned int count = 0; count < sizeof(CBouquetListButtons)/sizeof(CBouquetListButtons[0]);count++){ int w_text = g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL]->getRenderWidth(g_Locale->getText (CBouquetListButtons[count].locale),true); - w_max_text = std::max(w_max_icon, w_text); + w_max_text = std::max(w_max_text, w_text); frameBuffer->getIconSize(CBouquetListButtons[count].button, &icol_w, &icol_h); w_max_icon = std::max(w_max_icon, icol_w); } From 5acf5a489b509890c94f54c611fce3f24508fe1d Mon Sep 17 00:00:00 2001 From: Stefan Seyfried Date: Sun, 10 Mar 2013 00:04:23 +0100 Subject: [PATCH 160/224] bouquetlist: only show active buttons --- src/gui/bouquetlist.cpp | 9 ++++++++- src/gui/bouquetlist.h | 2 ++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/gui/bouquetlist.cpp b/src/gui/bouquetlist.cpp index 595ad9b84..17585c33e 100644 --- a/src/gui/bouquetlist.cpp +++ b/src/gui/bouquetlist.cpp @@ -62,6 +62,7 @@ CBouquetList::CBouquetList(const char * const Name) frameBuffer = CFrameBuffer::getInstance(); selected = 0; liststart = 0; + favonly = false; if(Name == NULL) name = g_Locale->getText(LOCALE_BOUQUETLIST_HEAD); else @@ -325,6 +326,7 @@ int CBouquetList::show(bool bShowChannelList) int icol_w, icol_h; int w_max_text = 0; int w_max_icon = 0; + favonly = !bShowChannelList; for(unsigned int count = 0; count < sizeof(CBouquetListButtons)/sizeof(CBouquetListButtons[0]);count++){ int w_text = g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL]->getRenderWidth(g_Locale->getText (CBouquetListButtons[count].locale),true); @@ -596,7 +598,12 @@ void CBouquetList::paint() frameBuffer->paintBoxRel(x, y+theight, width, height - theight - footerHeight, COL_MENUCONTENT_PLUS_0); - ::paintButtons(x, y + (height - footerHeight), width, sizeof(CBouquetListButtons)/sizeof(CBouquetListButtons[0]), CBouquetListButtons, footerHeight); + int numbuttons = sizeof(CBouquetListButtons)/sizeof(CBouquetListButtons[0]); + if (favonly) /* this actually shows favorites and providers button, but both are active anyway */ + numbuttons = 2; + ::paintButtons(x, y + (height - footerHeight), width, numbuttons, CBouquetListButtons, width, footerHeight); + + ::paintButtons(x, y + (height - footerHeight), width, numbuttons, CBouquetListButtons, footerHeight); if(!Bouquets.empty()) { diff --git a/src/gui/bouquetlist.h b/src/gui/bouquetlist.h index 41e76a07b..bad5fd4f2 100644 --- a/src/gui/bouquetlist.h +++ b/src/gui/bouquetlist.h @@ -94,6 +94,8 @@ class CBouquetList int x; int y; + bool favonly; + void paintItem(int pos); void paint(); void paintHead(); From 99e2ff32c92649f04ce7f1979cf225a50ede8028 Mon Sep 17 00:00:00 2001 From: Stefan Seyfried Date: Sun, 10 Mar 2013 00:07:26 +0100 Subject: [PATCH 161/224] channellist: don't change bouquetmode when adding favs when adding a channel to favorites from the channellist contextmenu the favorites bouquet was chosen, which is not helpful if further favorites should be added --- src/gui/channellist.cpp | 9 +++++---- src/neutrino.cpp | 4 +++- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/gui/channellist.cpp b/src/gui/channellist.cpp index 39254c663..69e940966 100644 --- a/src/gui/channellist.cpp +++ b/src/gui/channellist.cpp @@ -427,7 +427,7 @@ int CChannelList::doChannelMenu(void) } if(!g_bouquetManager->existsChannelInBouquet(bouquet_id, channel_id)) { CZapit::getInstance()->addChannelToBouquet(bouquet_id, channel_id); - return 1; + return 2; } break; @@ -685,9 +685,10 @@ int CChannelList::show() else if ( msg == CRCInput::RC_setup) { old_b_id = bouquetList->getActiveBouquetNumber(); fader.Stop(); - CNeutrinoApp::getInstance()->g_channel_list_changed = doChannelMenu(); - if(CNeutrinoApp::getInstance()->g_channel_list_changed) { - res = -4; + int ret = doChannelMenu(); + CNeutrinoApp::getInstance()->g_channel_list_changed = (ret != 0); + if (ret) { + res = -3 - ret; /* -5 == add to fav, -5 == all other change */ loop = false; } else { old_b_id = -1; diff --git a/src/neutrino.cpp b/src/neutrino.cpp index bec73577e..0b713d11b 100644 --- a/src/neutrino.cpp +++ b/src/neutrino.cpp @@ -2377,7 +2377,9 @@ _repeat: //else if(nNewChannel == -4) if(g_channel_list_changed) { - SetChannelMode(old_mode); + /* don't change bouquet after adding a channel to favorites */ + if (nNewChannel != -5) + SetChannelMode(old_mode); g_channel_list_changed = 0; if(old_b_id < 0) old_b_id = old_b; //g_Zapit->saveBouquets(); From f8aacb7a10c5cb1281344cb82d6e902dcc3c1a5f Mon Sep 17 00:00:00 2001 From: Stefan Seyfried Date: Sun, 10 Mar 2013 00:15:46 +0100 Subject: [PATCH 162/224] channellist: preset favorite bouquets when adding channels when adding channels from the channellist context menu, the useful targets are the favorites bouquets, so pre-select them --- src/gui/channellist.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/gui/channellist.cpp b/src/gui/channellist.cpp index 69e940966..a809167e4 100644 --- a/src/gui/channellist.cpp +++ b/src/gui/channellist.cpp @@ -400,6 +400,10 @@ int CChannelList::doChannelMenu(void) break; case 2: // add to + /* default to favorites list, it makes no sense to add to autogenerated bouquets */ + if (CNeutrinoApp::getInstance()->GetChannelMode() != LIST_MODE_FAV) + CNeutrinoApp::getInstance()->SetChannelMode(LIST_MODE_FAV); + do { bouquet_id = bouquetList->exec(false); } while(bouquet_id == -3); From d0f983617392e76e377aff9d8c04fcc2bf36c676 Mon Sep 17 00:00:00 2001 From: Stefan Seyfried Date: Sun, 10 Mar 2013 00:27:13 +0100 Subject: [PATCH 163/224] neutrino: allow empty user bouquets in the bouquetlist --- src/neutrino.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/neutrino.cpp b/src/neutrino.cpp index 0b713d11b..89f3ac823 100644 --- a/src/neutrino.cpp +++ b/src/neutrino.cpp @@ -1307,14 +1307,17 @@ void CNeutrinoApp::channelsInit(bool bOnly) /* Favorites and providers TV bouquets */ bnum = 0; for (i = 0; i < g_bouquetManager->Bouquets.size(); i++) { - if (!g_bouquetManager->Bouquets[i]->bHidden && !g_bouquetManager->Bouquets[i]->tvChannels.empty()) + CZapitBouquet *b = g_bouquetManager->Bouquets[i]; + /* allow empty user bouquets to be added, otherwise they are not + * available from the channellist->add_favorite context menus */ + if (!b->bHidden && (!b->tvChannels.empty() || b->bUser)) { - if(g_bouquetManager->Bouquets[i]->bUser) - tmp = TVfavList->addBouquet(g_bouquetManager->Bouquets[i]); + if (b->bUser) + tmp = TVfavList->addBouquet(b); else - tmp = TVbouquetList->addBouquet(g_bouquetManager->Bouquets[i]); + tmp = TVbouquetList->addBouquet(b); - ZapitChannelList* channels = &(g_bouquetManager->Bouquets[i]->tvChannels); + ZapitChannelList* channels = &(b->tvChannels); tmp->channelList->SetChannelList(channels); bnum++; } From 53dcd77d4a95d4a10d384510c04c85d345893051 Mon Sep 17 00:00:00 2001 From: Stefan Seyfried Date: Sun, 10 Mar 2013 01:44:21 +0100 Subject: [PATCH 164/224] fix exec_prefix for native build --- acinclude.m4 | 3 +++ 1 file changed, 3 insertions(+) diff --git a/acinclude.m4 b/acinclude.m4 index 6d3d2014d..fc6ce1ca5 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -34,6 +34,9 @@ if test "$TARGET" = "native"; then if test "$prefix" = "NONE"; then prefix=/usr/local fi + if test "$exec_prefix" = "NONE"; then + exec_prefix=$prefix + fi targetprefix=$prefix elif test "$TARGET" = "cdk"; then AC_MSG_RESULT(cdk) From f63ddb9cce731febaff1d36297fdd8812ec7769a Mon Sep 17 00:00:00 2001 From: Stefan Seyfried Date: Sun, 10 Mar 2013 02:01:52 +0100 Subject: [PATCH 165/224] neutrino: fix most hardcoded paths --- src/driver/pictureviewer/pictureviewer.cpp | 2 +- src/eitd/SIlanguage.cpp | 3 +-- src/eitd/SIlanguage.hpp | 2 +- src/eitd/edvbstring.cpp | 2 +- src/eitd/sectionsd.cpp | 2 +- src/eitd/xmlutil.cpp | 4 ++-- src/gui/bookmarkmanager.h | 2 +- src/gui/keybind_setup.cpp | 2 +- src/gui/osdlang_setup.cpp | 2 +- src/gui/settings_manager.cpp | 2 +- src/nhttpd/tuxboxapi/coolstream/controlapi.cpp | 4 ++-- src/nhttpd/yconfig.h | 12 ++++++------ src/nhttpd/yhttpd_mods/Makefile.am | 1 + src/nhttpd/yhttpd_mods/mod_yparser.cpp | 2 ++ src/system/localize.cpp | 2 +- src/system/setting_helpers.cpp | 4 ++-- src/zapit/include/zapit/zapit.h | 4 ++-- 17 files changed, 27 insertions(+), 25 deletions(-) diff --git a/src/driver/pictureviewer/pictureviewer.cpp b/src/driver/pictureviewer/pictureviewer.cpp index 3cef358f1..13a61697b 100644 --- a/src/driver/pictureviewer/pictureviewer.cpp +++ b/src/driver/pictureviewer/pictureviewer.cpp @@ -459,7 +459,7 @@ void CPictureViewer::getSize(const char* name, int* width, int *height) } } -#define LOGO_DIR1 "/share/tuxbox/neutrino/icons/logo" +#define LOGO_DIR1 DATADIR "/neutrino/icons/logo" #define LOGO_FMT ".jpg" bool CPictureViewer::GetLogoName(uint64_t channel_id, std::string ChannelName, std::string & name, int *width, int *height) diff --git a/src/eitd/SIlanguage.cpp b/src/eitd/SIlanguage.cpp index e6ec07ae8..4f251710d 100644 --- a/src/eitd/SIlanguage.cpp +++ b/src/eitd/SIlanguage.cpp @@ -22,6 +22,7 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * */ +#include #include #include #include @@ -32,8 +33,6 @@ #include "SIlanguage.hpp" -#define LANGUAGEFILE "/var/tuxbox/config/epglanguages.conf" - std::vector SIlanguage::languages; pthread_mutex_t SIlanguage::languages_lock = PTHREAD_MUTEX_INITIALIZER; diff --git a/src/eitd/SIlanguage.hpp b/src/eitd/SIlanguage.hpp index 133aec0fc..0c3c057bd 100644 --- a/src/eitd/SIlanguage.hpp +++ b/src/eitd/SIlanguage.hpp @@ -29,7 +29,7 @@ #include -#define LANGUAGEFILE "/var/tuxbox/config/epglanguages.conf" +#define LANGUAGEFILE CONFIGDIR "/epglanguages.conf" class SIlanguage { public: diff --git a/src/eitd/edvbstring.cpp b/src/eitd/edvbstring.cpp index 24882425e..010c3eaa3 100644 --- a/src/eitd/edvbstring.cpp +++ b/src/eitd/edvbstring.cpp @@ -17,7 +17,7 @@ std::set TransponderUseTwoCharMapping; int readEncodingFile() { - FILE *f = fopen("/var/tuxbox/config/encoding.conf", "rt"); + FILE *f = fopen(CONFIGDIR "/encoding.conf", "rt"); if (f) { CountryCodeDefaultMapping.clear(); TransponderDefaultMapping.clear(); diff --git a/src/eitd/sectionsd.cpp b/src/eitd/sectionsd.cpp index 0f70a8ca9..cec6bd2a4 100644 --- a/src/eitd/sectionsd.cpp +++ b/src/eitd/sectionsd.cpp @@ -1684,7 +1684,7 @@ void CEitThread::beforeSleep() messaging_zap_detected = false; unlockMessaging(); if(notify_complete) - system("/var/tuxbox/config/epgdone.sh"); + system(CONFIGDIR "/epgdone.sh"); } /********************************************************************************/ diff --git a/src/eitd/xmlutil.cpp b/src/eitd/xmlutil.cpp index 0f3e25e49..ed5fad71e 100644 --- a/src/eitd/xmlutil.cpp +++ b/src/eitd/xmlutil.cpp @@ -47,8 +47,8 @@ extern bool reader_ready; extern pthread_rwlock_t eventsLock; extern bool dvb_time_update; -std::string epg_filter_dir = "/var/tuxbox/config/zapit/epgfilter.xml"; -std::string dvbtime_filter_dir = "/var/tuxbox/config/zapit/dvbtimefilter.xml"; +std::string epg_filter_dir = CONFIGDIR "/zapit/epgfilter.xml"; +std::string dvbtime_filter_dir = CONFIGDIR "/zapit/dvbtimefilter.xml"; bool epg_filter_is_whitelist = false; bool epg_filter_except_current_next = false; diff --git a/src/gui/bookmarkmanager.h b/src/gui/bookmarkmanager.h index e1f88e02a..1e4a921a5 100644 --- a/src/gui/bookmarkmanager.h +++ b/src/gui/bookmarkmanager.h @@ -43,7 +43,7 @@ #include #define MAXBOOKMARKS 10 -#define BOOKMARKFILE "/var/tuxbox/config/bookmarks" +#define BOOKMARKFILE CONFIGDIR "/bookmarks" class CBookmark { diff --git a/src/gui/keybind_setup.cpp b/src/gui/keybind_setup.cpp index 608046f6c..4618bbdde 100644 --- a/src/gui/keybind_setup.cpp +++ b/src/gui/keybind_setup.cpp @@ -92,7 +92,7 @@ int CKeybindSetup::exec(CMenuTarget* parent, const std::string &actionKey) CFileFilter fileFilter; fileFilter.addFilter("conf"); fileBrowser.Filter = &fileFilter; - if (fileBrowser.exec("/var/tuxbox/config") == true) { + if (fileBrowser.exec(CONFIGDIR) == true) { CNeutrinoApp::getInstance()->loadKeys(fileBrowser.getSelectedFile()->Name.c_str()); printf("[neutrino keybind_setup] new keys: %s\n", fileBrowser.getSelectedFile()->Name.c_str()); } diff --git a/src/gui/osdlang_setup.cpp b/src/gui/osdlang_setup.cpp index 7aec3d37d..0266b79dc 100644 --- a/src/gui/osdlang_setup.cpp +++ b/src/gui/osdlang_setup.cpp @@ -163,7 +163,7 @@ void COsdLangSetup::showLanguageSetup(CMenuWidget *osdl_setup) struct dirent **namelist; int n; // printf("scanning locale dir now....(perhaps)\n"); - char *pfad[] = {(char *) DATADIR "/neutrino/locale",(char *) "/var/tuxbox/config/locale"}; + char *pfad[] = {(char *) DATADIR "/neutrino/locale",(char *) CONFIGDIR "/locale"}; osdl_setup->addIntroItems(); diff --git a/src/gui/settings_manager.cpp b/src/gui/settings_manager.cpp index c4aa9f735..3f938dd55 100644 --- a/src/gui/settings_manager.cpp +++ b/src/gui/settings_manager.cpp @@ -71,7 +71,7 @@ int CSettingsManager::exec(CMenuTarget* parent, const std::string &actionKey) { fileFilter.addFilter("conf"); fileBrowser.Filter = &fileFilter; - if (fileBrowser.exec("/var/tuxbox/config") == true) + if (fileBrowser.exec(CONFIGDIR) == true) { CNeutrinoApp::getInstance()->loadSetup(fileBrowser.getSelectedFile()->Name.c_str()); CColorSetupNotifier *colorSetupNotifier = new CColorSetupNotifier; diff --git a/src/nhttpd/tuxboxapi/coolstream/controlapi.cpp b/src/nhttpd/tuxboxapi/coolstream/controlapi.cpp index 8434428db..8957d6d2a 100644 --- a/src/nhttpd/tuxboxapi/coolstream/controlapi.cpp +++ b/src/nhttpd/tuxboxapi/coolstream/controlapi.cpp @@ -514,14 +514,14 @@ void CControlAPI::GetTimeCGI(CyhookHandler *hh) // send services.xml void CControlAPI::GetServicesxmlCGI(CyhookHandler *hh) { - hh->SendFile("/var/tuxbox/config/zapit/services.xml"); + hh->SendFile(CONFIGDIR "/zapit/services.xml"); } //----------------------------------------------------------------------------- // send bouquets.xml void CControlAPI::GetBouquetsxmlCGI(CyhookHandler *hh) { - hh->SendFile("/var/tuxbox/config/zapit/bouquets.xml"); + hh->SendFile(CONFIGDIR "/zapit/bouquets.xml"); } //----------------------------------------------------------------------------- diff --git a/src/nhttpd/yconfig.h b/src/nhttpd/yconfig.h index c248efcd0..7790cea2e 100644 --- a/src/nhttpd/yconfig.h +++ b/src/nhttpd/yconfig.h @@ -101,26 +101,26 @@ #define HTTPD_DEFAULT_LANGUAGE "English" #define AUTHUSER "root" -#define HTTPD_CONFIGDIR "/var/tuxbox/config" +#define HTTPD_CONFIGDIR CONFIGDIR #define HTTPD_CONFIGFILE HTTPD_CONFIGDIR "/nhttpd.conf" #define YWEB_CONFIGFILE HTTPD_CONFIGDIR "/Y-Web.conf" #define PUBLICDOCUMENTROOT "/var/httpd" -#define NEUTRINO_CONFIGFILE "/var/tuxbox/config/neutrino.conf" +#define NEUTRINO_CONFIGFILE CONFIGDIR "/neutrino.conf" #define HOSTEDDOCUMENTROOT "/mnt/hosted" #define EXTRASDOCUMENTROOT "/mnt/hosted/extras" #define EXTRASDOCUMENTURL "/hosted/extras" -#define ZAPITXMLPATH "/var/tuxbox/config/zapit" -#define TUXBOX_LOGOS_URL "/usr/share/tuxbox/neutrino/icons/logos" +#define ZAPITXMLPATH CONFIGDIR "/zapit" +#define TUXBOX_LOGOS_URL DATADIR "/neutrino/icons/logos" // switch for Box differences #ifdef CONFIG_SYSTEM_TUXBOX #define AUTHPASSWORD "dbox2" -#define PRIVATEDOCUMENTROOT "/share/tuxbox/neutrino/httpd-y" +#define PRIVATEDOCUMENTROOT DATADIR "/neutrino/httpd-y" #endif #ifdef CONFIG_SYSTEM_TUXBOX_COOLSTREAM #define AUTHPASSWORD "coolstream" -#define PRIVATEDOCUMENTROOT "/share/tuxbox/neutrino/httpd" +#define PRIVATEDOCUMENTROOT DATADIR "/neutrino/httpd" #undef Y_CONFIG_BUILD_AS_DAEMON // No Daemon #endif //----------------------------------------------------------------------------- diff --git a/src/nhttpd/yhttpd_mods/Makefile.am b/src/nhttpd/yhttpd_mods/Makefile.am index 74d213c4f..6f7f05823 100644 --- a/src/nhttpd/yhttpd_mods/Makefile.am +++ b/src/nhttpd/yhttpd_mods/Makefile.am @@ -1,4 +1,5 @@ INCLUDES = \ + -I$(top_builddir) \ -I$(top_srcdir)/lib \ -I$(top_srcdir)/src/zapit/include \ -I$(top_srcdir)/src \ diff --git a/src/nhttpd/yhttpd_mods/mod_yparser.cpp b/src/nhttpd/yhttpd_mods/mod_yparser.cpp index 3fd7a1c5e..b7995dc23 100644 --- a/src/nhttpd/yhttpd_mods/mod_yparser.cpp +++ b/src/nhttpd/yhttpd_mods/mod_yparser.cpp @@ -3,6 +3,8 @@ // yParser //============================================================================= // C +#include + #include #include #include diff --git a/src/system/localize.cpp b/src/system/localize.cpp index bed4a433a..220f0b3d4 100644 --- a/src/system/localize.cpp +++ b/src/system/localize.cpp @@ -111,7 +111,7 @@ CLocaleManager::~CLocaleManager() delete[] defaultData; } -const char * path[2] = {"/var/tuxbox/config/locale/", DATADIR "/neutrino/locale/"}; +const char * path[2] = { CONFIGDIR "/locale/", DATADIR "/neutrino/locale/"}; CLocaleManager::loadLocale_ret_t CLocaleManager::loadLocale(const char * const locale, bool asdefault) { diff --git a/src/system/setting_helpers.cpp b/src/system/setting_helpers.cpp index 8689d68f9..bf6598c93 100644 --- a/src/system/setting_helpers.cpp +++ b/src/system/setting_helpers.cpp @@ -464,7 +464,7 @@ int CDataResetNotifier::exec(CMenuTarget* /*parent*/, const std::string& actionK return true; if(delete_all) { - my_system(3, "/bin/sh", "-c", "rm -f /var/tuxbox/config/zapit/*.conf"); + my_system(3, "/bin/sh", "-c", "rm -f " CONFIGDIR "/zapit/*.conf"); CServiceManager::getInstance()->SatelliteList().clear(); CZapit::getInstance()->LoadSettings(); CZapit::getInstance()->GetConfig(zapitCfg); @@ -484,7 +484,7 @@ int CDataResetNotifier::exec(CMenuTarget* /*parent*/, const std::string& actionK CFrameBuffer::getInstance()->Clear(); } if(delete_chan) { - my_system(3, "/bin/sh", "-c", "rm -f /var/tuxbox/config/zapit/*.xml"); + my_system(3, "/bin/sh", "-c", "rm -f " CONFIGDIR "/zapit/*.xml"); g_Zapit->reinitChannels(); } return ret; diff --git a/src/zapit/include/zapit/zapit.h b/src/zapit/include/zapit/zapit.h index 7325d8c53..4d28a6e8c 100644 --- a/src/zapit/include/zapit/zapit.h +++ b/src/zapit/include/zapit/zapit.h @@ -21,8 +21,8 @@ #define PAL 0 #define NTSC 1 -#define AUDIO_CONFIG_FILE "/var/tuxbox/config/zapit/audio.conf" -#define VOLUME_CONFIG_FILE "/var/tuxbox/config/zapit/volume.conf" +#define AUDIO_CONFIG_FILE CONFIGDIR "/zapit/audio.conf" +#define VOLUME_CONFIG_FILE CONFIGDIR "/zapit/volume.conf" typedef std::map audio_map_t; typedef audio_map_t::iterator audio_map_iterator_t; From be2966035f3a4e5df49cc7a32495dcfd0205fd01 Mon Sep 17 00:00:00 2001 From: Jacek Jendrzej Date: Mon, 11 Mar 2013 12:18:17 +0100 Subject: [PATCH 166/224] progressbar-menu-tomworld --- data/locale/deutsch.locale | 18 ++++-- data/locale/english.locale | 18 ++++-- src/gui/Makefile.am | 1 + src/gui/osd_setup.cpp | 30 +++------ src/gui/progressbar_setup.cpp | 114 +++++++++++++++++++++++++++++++++ src/gui/progressbar_setup.h | 46 +++++++++++++ src/gui/widget/progressbar.cpp | 66 ++++++++++++------- src/neutrino.cpp | 2 + src/neutrino_menue.h | 3 + src/system/locals.h | 14 ++-- src/system/locals_intern.h | 14 ++-- src/system/settings.h | 1 + 12 files changed, 264 insertions(+), 63 deletions(-) create mode 100644 src/gui/progressbar_setup.cpp create mode 100644 src/gui/progressbar_setup.h diff --git a/data/locale/deutsch.locale b/data/locale/deutsch.locale index 5cf9e0197..51d995ea6 100644 --- a/data/locale/deutsch.locale +++ b/data/locale/deutsch.locale @@ -803,7 +803,9 @@ menu.hint_infobar_fonts Ändern Sie die Schriftgrößen in der Infobar menu.hint_infobar_logo Logo- und Signal-Optionen menu.hint_infobar_logo_dir Wählen Sie das Verzeichnis für die Senderlogos menu.hint_infobar_on_epg Zeigt einen Hinweis bei EPG-Änderungen -menu.hint_infobar_progressbar Wählt die Optionen des Fortschrittsbalken in der Infobar +menu.hint_infobar_position Wählt die Optionen des Fortschrittsbalken in der Infobar +menu.hint_infobar_progressbar Wählen sie die Optionen für die Progressbar-Anzeige +menu.hint_infobar_progressbar_design Stellen Sie das Design des Fortschrittsbalkens ein menu.hint_infobar_radiotext Zeigt Radiotext in einen Fenster, wenn verfügbar menu.hint_infobar_res Zeige die gesendete Auflösung in Symbolen menu.hint_infobar_sat Zeigt die aktuellen Satelliten- oder Kabel-Provider @@ -1133,11 +1135,15 @@ miscsettings.infobar_disp_5 Logo/Signalbalken miscsettings.infobar_disp_6 Logo+Kanalnummer/Signalbalken miscsettings.infobar_disp_log Logo miscsettings.infobar_logo_hdd_dir Logo-Verz. -miscsettings.infobar_progressbar Fortschrittsbalken Opt. -miscsettings.infobar_progressbar_0 Standard -miscsettings.infobar_progressbar_1 unterhalb Kanalname -miscsettings.infobar_progressbar_2 unterhalb Kanalname schmal -miscsettings.infobar_progressbar_3 zwischen EPG-Events schmal +miscsettings.infobar_position Progessbarposition +miscsettings.infobar_position_0 Standard +miscsettings.infobar_position_1 unterhalb Kanalname +miscsettings.infobar_position_2 unterhalb Kanalname (schmal) +miscsettings.infobar_position_3 zwischen EPG-Events (schmal) +miscsettings.infobar_progressbar Fortschrittsbalken +miscsettings.infobar_progressbar_design Progressbar +miscsettings.infobar_progressbar_design_0 Punktdesign +miscsettings.infobar_progressbar_design_1 Balkendesign miscsettings.infobar_sat_display Kabel-/Satellitenanbieter miscsettings.infobar_show Info bei EPG Änderungen miscsettings.infobar_show_dd_available DD-Verfügbarkeit anzeigen diff --git a/data/locale/english.locale b/data/locale/english.locale index 7ffa48af6..34097e1d3 100644 --- a/data/locale/english.locale +++ b/data/locale/english.locale @@ -803,7 +803,9 @@ menu.hint_infobar_fonts Change infobar font sizes menu.hint_infobar_logo Logo / signal options menu.hint_infobar_logo_dir Select directory to search for channels logo menu.hint_infobar_on_epg Show infobar on current EPG event change -menu.hint_infobar_progressbar Selects the options of Progressbar in the Infobar +menu.hint_infobar_position Selects the options of Progressbar in the Infobar +menu.hint_infobar_progressbar Select the options for the Progressbar +menu.hint_infobar_progressbar_design Here you can choose the design of the Progressbar with active color option. menu.hint_infobar_radiotext Show radiotext window menu.hint_infobar_res Show channel resolution icons menu.hint_infobar_sat Show current satellite or cable provider @@ -1133,11 +1135,15 @@ miscsettings.infobar_disp_5 Logo+signal miscsettings.infobar_disp_6 Logo+channel number+signal miscsettings.infobar_disp_log Logo miscsettings.infobar_logo_hdd_dir Logo dir -miscsettings.infobar_progressbar progressbar options -miscsettings.infobar_progressbar_0 standard -miscsettings.infobar_progressbar_1 below channel name -miscsettings.infobar_progressbar_2 small below channel name -miscsettings.infobar_progressbar_3 narrow between EPG-Events +miscsettings.infobar_position Progressbar Position +miscsettings.infobar_position_0 standard +miscsettings.infobar_position_1 below channel name +miscsettings.infobar_position_2 small below channel name +miscsettings.infobar_position_3 narrow between EPG-Events +miscsettings.infobar_progressbar Progressbar +miscsettings.infobar_progressbar_design Progressbar +miscsettings.infobar_progressbar_design_0 point Design +miscsettings.infobar_progressbar_design_1 bar Design miscsettings.infobar_sat_display Satellite display on infobar miscsettings.infobar_show show Info on EPG change miscsettings.infobar_show_dd_available show DD availability diff --git a/src/gui/Makefile.am b/src/gui/Makefile.am index e4b46ab81..814773ccb 100644 --- a/src/gui/Makefile.am +++ b/src/gui/Makefile.am @@ -81,6 +81,7 @@ libneutrino_gui_a_SOURCES = \ pictureviewer_setup.cpp \ pluginlist.cpp \ plugins.cpp \ + progressbar_setup.cpp \ proxyserver_setup.cpp \ rc_lock.cpp \ record_setup.cpp \ diff --git a/src/gui/osd_setup.cpp b/src/gui/osd_setup.cpp index 3774b6054..4893b39c0 100644 --- a/src/gui/osd_setup.cpp +++ b/src/gui/osd_setup.cpp @@ -43,6 +43,7 @@ #include "screensetup.h" #include "osdlang_setup.h" #include "filebrowser.h" +#include "progressbar_setup.h" #include #include @@ -427,24 +428,29 @@ int COsdSetup::showOsdSetup() mf->setHint("", LOCALE_MENU_HINT_SCREEN_SETUP); osd_menu->addItem(mf); + //progressbar + CMenuForwarder * progress = new CMenuForwarder(LOCALE_MISCSETTINGS_INFOBAR_PROGRESSBAR, true, NULL, new CProgressbarSetup(), NULL, CRCInput::RC_1); + progress->setHint("", LOCALE_MENU_HINT_INFOBAR_PROGRESSBAR); + osd_menu->addItem(progress); + //infobar CMenuWidget osd_menu_infobar(LOCALE_MAINMENU_SETTINGS, NEUTRINO_ICON_SETTINGS, width, MN_WIDGET_ID_OSDSETUP_INFOBAR); showOsdInfobarSetup(&osd_menu_infobar); - mf = new CMenuForwarder(LOCALE_MISCSETTINGS_INFOBAR, true, NULL, &osd_menu_infobar, NULL, CRCInput::RC_1); + mf = new CMenuForwarder(LOCALE_MISCSETTINGS_INFOBAR, true, NULL, &osd_menu_infobar, NULL, CRCInput::RC_2); mf->setHint("", LOCALE_MENU_HINT_INFOBAR_SETUP); osd_menu->addItem(mf); //channellist CMenuWidget osd_menu_chanlist(LOCALE_MAINMENU_SETTINGS, NEUTRINO_ICON_SETTINGS, width, MN_WIDGET_ID_OSDSETUP_CHANNELLIST); showOsdChanlistSetup(&osd_menu_chanlist); - mf = new CMenuForwarder(LOCALE_MISCSETTINGS_CHANNELLIST, true, NULL, &osd_menu_chanlist, NULL, CRCInput::RC_2); + mf = new CMenuForwarder(LOCALE_MISCSETTINGS_CHANNELLIST, true, NULL, &osd_menu_chanlist, NULL, CRCInput::RC_3); mf->setHint("", LOCALE_MENU_HINT_CHANNELLIST_SETUP); osd_menu->addItem(mf); //screenshot CMenuWidget osd_menu_screenshot(LOCALE_MAINMENU_SETTINGS, NEUTRINO_ICON_SETTINGS, width, MN_WIDGET_ID_OSDSETUP_SCREENSHOT); showOsdScreenShotSetup(&osd_menu_screenshot); - mf = new CMenuForwarder(LOCALE_SCREENSHOT_MENU, true, NULL, &osd_menu_screenshot, NULL, CRCInput::RC_3); + mf = new CMenuForwarder(LOCALE_SCREENSHOT_MENU, true, NULL, &osd_menu_screenshot, NULL, CRCInput::RC_4); mf->setHint("", LOCALE_MENU_HINT_SCREENSHOT_SETUP); osd_menu->addItem(mf); @@ -506,11 +512,6 @@ int COsdSetup::showOsdSetup() mc->setHint("", LOCALE_MENU_HINT_BIGWINDOWS); osd_menu->addItem(mc); - // color progress bar - mc = new CMenuOptionChooser(LOCALE_PROGRESSBAR_COLOR, &g_settings.progressbar_color, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true); - mc->setHint("", LOCALE_MENU_HINT_PROGRESSBAR_COLOR); - osd_menu->addItem(mc); - int res = osd_menu->exec(NULL, ""); delete osd_menu; @@ -727,14 +728,6 @@ const CMenuOptionChooser::keyval LOCALE_MISCSETTINGS_INFOBAR_DISP_OPTIONS[LOCAL { 5 , LOCALE_MISCSETTINGS_INFOBAR_DISP_5 }, { 6 , LOCALE_MISCSETTINGS_INFOBAR_DISP_6 } }; -#define LOCALE_MISCSETTINGS_INFOBAR_PROGRESSBAR_COUNT 4 -const CMenuOptionChooser::keyval LOCALE_MISCSETTINGS_INFOBAR_PROGRESSBAR_OPTIONS[LOCALE_MISCSETTINGS_INFOBAR_PROGRESSBAR_COUNT]= -{ - { 0 , LOCALE_MISCSETTINGS_INFOBAR_PROGRESSBAR_0 }, - { 1 , LOCALE_MISCSETTINGS_INFOBAR_PROGRESSBAR_1 }, - { 2 , LOCALE_MISCSETTINGS_INFOBAR_PROGRESSBAR_2 }, - { 3 , LOCALE_MISCSETTINGS_INFOBAR_PROGRESSBAR_3 } -}; //infobar void COsdSetup::showOsdInfobarSetup(CMenuWidget *menu_infobar) @@ -763,11 +756,6 @@ void COsdSetup::showOsdInfobarSetup(CMenuWidget *menu_infobar) mc->setHint("", LOCALE_MENU_HINT_INFOBAR_SAT); menu_infobar->addItem(mc); - // infobar progress - mc = new CMenuOptionChooser(LOCALE_MISCSETTINGS_INFOBAR_PROGRESSBAR, &g_settings.infobar_progressbar, LOCALE_MISCSETTINGS_INFOBAR_PROGRESSBAR_OPTIONS, LOCALE_MISCSETTINGS_INFOBAR_PROGRESSBAR_COUNT, true); - mc->setHint("", LOCALE_MENU_HINT_INFOBAR_PROGRESSBAR); - menu_infobar->addItem(mc); - // flash/hdd progress mc = new CMenuOptionChooser(LOCALE_MISCSETTINGS_INFOBAR_SHOW_SYSFS_HDD, &g_settings.infobar_show_sysfs_hdd, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true); mc->setHint("", LOCALE_MENU_HINT_INFOBAR_FILESYS); diff --git a/src/gui/progressbar_setup.cpp b/src/gui/progressbar_setup.cpp new file mode 100644 index 000000000..98d17fa50 --- /dev/null +++ b/src/gui/progressbar_setup.cpp @@ -0,0 +1,114 @@ +/* + Based up Neutrino-GUI - Tuxbox-Project + Copyright (C) 2001 by Steffen Hehn 'McClean' + + progressbar_setup menu + Suggested by tomworld + + License: GPL + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif + +#include "progressbar_setup.h" + +#include +#include +#include +#include + +#include + +#include + +#define LOCALE_MISCSETTINGS_INFOBAR_POSITION_COUNT 4 +const CMenuOptionChooser::keyval LOCALE_MISCSETTINGS_INFOBAR_POSITION_OPTIONS[LOCALE_MISCSETTINGS_INFOBAR_POSITION_COUNT]= +{ + { 0 , LOCALE_MISCSETTINGS_INFOBAR_POSITION_0 }, + { 1 , LOCALE_MISCSETTINGS_INFOBAR_POSITION_1 }, + { 2 , LOCALE_MISCSETTINGS_INFOBAR_POSITION_2 }, + { 3 , LOCALE_MISCSETTINGS_INFOBAR_POSITION_3 } +}; + +#define LOCALE_MISCSETTINGS_INFOBAR_PROGRESSBAR_DESIGN_COUNT 2 +const CMenuOptionChooser::keyval LOCALE_MISCSETTINGS_INFOBAR_PROGRESSBAR_DESIGN_OPTIONS[LOCALE_MISCSETTINGS_INFOBAR_PROGRESSBAR_DESIGN_COUNT]= +{ + { 0 , LOCALE_MISCSETTINGS_INFOBAR_PROGRESSBAR_DESIGN_0 }, + { 1 , LOCALE_MISCSETTINGS_INFOBAR_PROGRESSBAR_DESIGN_1 } +}; + +CProgressbarSetup::CProgressbarSetup() +{ + width = w_max (40, 10); //% +} + +CProgressbarSetup::~CProgressbarSetup() +{ + +} + +int CProgressbarSetup::exec(CMenuTarget* parent, const std::string &) +{ + printf("[neutrino] init progressbar menu setup...\n"); + + if (parent) + parent->hide(); + + return showMenu(); +} + +int CProgressbarSetup::showMenu() +{ + //menue init + CMenuWidget *progress = new CMenuWidget(LOCALE_MAINMENU_SETTINGS, NEUTRINO_ICON_SETTINGS, width, MN_WIDGET_ID_PROGRESSBAR); + + //intros: back ande save + progress->addIntroItems(LOCALE_MISCSETTINGS_INFOBAR_PROGRESSBAR); + + //infobar progresscolor on/off + COnOffNotifier* miscProgressNotifier = new COnOffNotifier(0); + + CMenuOptionChooser *progresscolor; + progresscolor = new CMenuOptionChooser(LOCALE_PROGRESSBAR_COLOR, &g_settings.progressbar_color, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true, miscProgressNotifier); + progresscolor->setHint("", LOCALE_MENU_HINT_PROGRESSBAR_COLOR); + + //infobar design + CMenuOptionChooser *progressdesign = new CMenuOptionChooser(LOCALE_MISCSETTINGS_INFOBAR_PROGRESSBAR_DESIGN, &g_settings.progressbar_design, LOCALE_MISCSETTINGS_INFOBAR_PROGRESSBAR_DESIGN_OPTIONS, LOCALE_MISCSETTINGS_INFOBAR_PROGRESSBAR_DESIGN_COUNT, g_settings.progressbar_color); + progressdesign->setHint("", LOCALE_MENU_HINT_INFOBAR_PROGRESSBAR_DESIGN); + + //infobar progressbarposition + CMenuOptionChooser *progressbarposition; + progressbarposition = new CMenuOptionChooser(LOCALE_MISCSETTINGS_INFOBAR_POSITION, &g_settings.infobar_progressbar, LOCALE_MISCSETTINGS_INFOBAR_POSITION_OPTIONS, LOCALE_MISCSETTINGS_INFOBAR_POSITION_COUNT, true); + progressbarposition->setHint("", LOCALE_MENU_HINT_INFOBAR_POSITION); + + miscProgressNotifier->addItem(progressdesign); + + //paint items + progress->addItem(progresscolor); + progress->addItem(progressdesign); + progress->addItem(new CMenuSeparator(CMenuSeparator::LINE | CMenuSeparator::STRING, LOCALE_MISCSETTINGS_INFOBAR)); + progress->addItem(progressbarposition); + + int res = progress->exec (NULL, ""); + delete miscProgressNotifier; + delete progress; + + return res; +} diff --git a/src/gui/progressbar_setup.h b/src/gui/progressbar_setup.h new file mode 100644 index 000000000..b650e9cb6 --- /dev/null +++ b/src/gui/progressbar_setup.h @@ -0,0 +1,46 @@ +/* + Based up Neutrino-GUI - Tuxbox-Project + Copyright (C) 2001 by Steffen Hehn 'McClean' + + progressbar_setup menu + Suggested by tomworld + + License: GPL + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +*/ + +#ifndef __PROGRESSBAR_SETUP__ +#define __PROGRESSBAR_SETUP__ + + +#include + +#include + +class CProgressbarSetup : public CMenuTarget, CChangeObserver +{ +private: + int width; + int showMenu(); + +public: + CProgressbarSetup(); + ~CProgressbarSetup(); + int exec(CMenuTarget* parent, const std::string &); +}; + +#endif diff --git a/src/gui/widget/progressbar.cpp b/src/gui/widget/progressbar.cpp index e99ad763b..e9bef678e 100644 --- a/src/gui/widget/progressbar.cpp +++ b/src/gui/widget/progressbar.cpp @@ -153,11 +153,11 @@ void CProgressBar::realpaint(const int pos_x, const int pos_y, // max height progressbar bar, if icon height larger than pb_height then get height from icon int pb_max_height = icon_h > height ? icon_h + 2* frame_widht : height; + // max height of active/passive bar + int bar_height = pb_max_height - 2*frame_widht; + if (!blink || !g_settings.progressbar_color) { - // max height of active/passive bar - int bar_height = pb_max_height - 2*frame_widht; - int start_x_passive_bar = start_x + active_pb_width; int width_passive_bar = pb_max_width - active_pb_width; @@ -202,63 +202,85 @@ void CProgressBar::realpaint(const int pos_x, const int pos_y, width, pb_max_height, shadowbar_col, c_rad); // shadow } - if (active_pb_width != last_width) { + if (active_pb_width != last_width) + { int step; int i, j; int b = 0; - if (active_pb_width > last_width) { - for (i = 0; (i < rd) && (i < maxi); i++) { + if (active_pb_width > last_width) + { + for (i = 0; (i < rd) && (i < maxi); i++) + { //green section step = 255 / rd; if (invert) rgb = GREEN + ((unsigned char)(step * i) << 16); // adding red else rgb = RED + ((unsigned char)(step * i) << 8); // adding green color = make16color(rgb); - for(j = 0; j <= hcnt; j++) - frameBuffer->paintBoxRel(pos_x + i * ITEMW, pos_y + j * ITEMW, - POINT, POINT, color); + if (g_settings.progressbar_design == 0) + { + for(j = 0; j <= hcnt; j++) + frameBuffer->paintBoxRel(pos_x + i * ITEMW, pos_y + j * ITEMW, POINT, POINT, color); + } + else + frameBuffer->paintBoxRel(pos_x + i * ITEMW,start_y, POINT, bar_height, color); } - for (; (i < yw) && (i < maxi); i++) { + for (; (i < yw) && (i < maxi); i++) + { //yello section step = 255 / yw / 2; if (invert) rgb = YELLOW - ((unsigned char)(step * (b++)) << 8); // removing green else rgb = YELLOW - ((unsigned char)(step * (b++)) << 16); // removing red color = make16color(rgb); - for(j = 0; j <= hcnt; j++) - frameBuffer->paintBoxRel(pos_x + i * ITEMW, pos_y + j * ITEMW, - POINT, POINT, color); + if (g_settings.progressbar_design == 0) + { + for(j = 0; j <= hcnt; j++) + frameBuffer->paintBoxRel(pos_x + i * ITEMW, pos_y + j * ITEMW, POINT, POINT, color); + } + else + frameBuffer->paintBoxRel(pos_x + i * ITEMW, start_y, POINT, bar_height, color); } - for (; (i < gn) && (i < maxi); i++) { + for (; (i < gn) && (i < maxi); i++) + { //red section step = 255 / gn; if (invert) rgb = YELLOW - ((unsigned char) (step * (b++)) << 8); // removing green else rgb = YELLOW - ((unsigned char) (step * (b++)) << 16); // removing red color = make16color(rgb); - for(j = 0; j <= hcnt; j++) - frameBuffer->paintBoxRel(pos_x + i * ITEMW, pos_y + j * ITEMW, - POINT, POINT, color); + if (g_settings.progressbar_design == 0) + { + for(j = 0; j <= hcnt; j++) + frameBuffer->paintBoxRel(pos_x + i * ITEMW, pos_y + j * ITEMW, POINT, POINT, color); + } + else + frameBuffer->paintBoxRel(pos_x + i * ITEMW, start_y, POINT, bar_height, color); } } - for(i = maxi; i < total; i++) { + for(i = maxi; i < total; i++) + { for(j = 0; j <= hcnt; j++) - frameBuffer->paintBoxRel(pos_x + i * ITEMW, pos_y + j * ITEMW, - POINT, POINT, COL_INFOBAR_PLUS_3);//fill passive + if (g_settings.progressbar_design == 0) + frameBuffer->paintBoxRel(pos_x + i * ITEMW, pos_y + j * ITEMW, POINT, POINT, COL_INFOBAR_PLUS_3);//fill passive + else + frameBuffer->paintBoxRel(pos_x + i * ITEMW, start_y, POINT, bar_height, COL_INFOBAR_PLUS_3);//fill passive } last_width = active_pb_width; } } // paint icon if present - if (iconfile != NULL){ + if (iconfile != NULL) + { int icon_y = pos_y + pb_max_height / 2 - icon_h / 2; frameBuffer->paintIcon(iconfile, pos_x + frame_widht, icon_y); } // upper text int upper_labeltext_y = start_y - frame_widht; - if (upper_labeltext != NULL) { + if (upper_labeltext != NULL) + { g_Font[font_pbar]->RenderString(start_x +2, upper_labeltext_y, width, diff --git a/src/neutrino.cpp b/src/neutrino.cpp index 89f3ac823..42bc68f1e 100644 --- a/src/neutrino.cpp +++ b/src/neutrino.cpp @@ -383,6 +383,7 @@ int CNeutrinoApp::loadSetup(const char * fname) g_settings.infobar_show_channeldesc = configfile.getBool("infobar_show_channeldesc" , false ); g_settings.infobar_subchan_disp_pos = configfile.getInt32("infobar_subchan_disp_pos" , 0 ); g_settings.progressbar_color = configfile.getBool("progressbar_color", true ); + g_settings.progressbar_design = configfile.getInt32("progressbar_design",0); g_settings.infobar_show = configfile.getInt32("infobar_show", 1); g_settings.infobar_show_channellogo = configfile.getInt32("infobar_show_channellogo" , 3 ); g_settings.infobar_progressbar = configfile.getInt32("infobar_progressbar" , 0 ); @@ -841,6 +842,7 @@ void CNeutrinoApp::saveSetup(const char * fname) configfile.setBool("infobar_show_channeldesc" , g_settings.infobar_show_channeldesc ); configfile.setInt32("infobar_subchan_disp_pos" , g_settings.infobar_subchan_disp_pos ); configfile.setBool("progressbar_color" , g_settings.progressbar_color ); + configfile.setInt32("progressbar_design", g_settings.progressbar_design); configfile.setInt32("infobar_show", g_settings.infobar_show); configfile.setInt32("infobar_show_channellogo" , g_settings.infobar_show_channellogo ); configfile.setInt32("infobar_progressbar" , g_settings.infobar_progressbar ); diff --git a/src/neutrino_menue.h b/src/neutrino_menue.h index 6677e080a..179bb84af 100644 --- a/src/neutrino_menue.h +++ b/src/neutrino_menue.h @@ -69,6 +69,9 @@ enum MN_WIDGET_ID MN_WIDGET_ID_OSDSETUP_FONTSIZE_INFOBAR, MN_WIDGET_ID_OSDSETUP_FONTSIZE_GAMELIST, + //progressbar setup + MN_WIDGET_ID_PROGRESSBAR, + //language setup MN_WIDGET_ID_LANGUAGESETUP, MN_WIDGET_ID_LANGUAGESETUP_LOCALE, diff --git a/src/system/locals.h b/src/system/locals.h index 38203a667..2a1459151 100644 --- a/src/system/locals.h +++ b/src/system/locals.h @@ -830,7 +830,9 @@ typedef enum LOCALE_MENU_HINT_INFOBAR_LOGO, LOCALE_MENU_HINT_INFOBAR_LOGO_DIR, LOCALE_MENU_HINT_INFOBAR_ON_EPG, + LOCALE_MENU_HINT_INFOBAR_POSITION, LOCALE_MENU_HINT_INFOBAR_PROGRESSBAR, + LOCALE_MENU_HINT_INFOBAR_PROGRESSBAR_DESIGN, LOCALE_MENU_HINT_INFOBAR_RADIOTEXT, LOCALE_MENU_HINT_INFOBAR_RES, LOCALE_MENU_HINT_INFOBAR_SAT, @@ -1160,11 +1162,15 @@ typedef enum LOCALE_MISCSETTINGS_INFOBAR_DISP_6, LOCALE_MISCSETTINGS_INFOBAR_DISP_LOG, LOCALE_MISCSETTINGS_INFOBAR_LOGO_HDD_DIR, + LOCALE_MISCSETTINGS_INFOBAR_POSITION, + LOCALE_MISCSETTINGS_INFOBAR_POSITION_0, + LOCALE_MISCSETTINGS_INFOBAR_POSITION_1, + LOCALE_MISCSETTINGS_INFOBAR_POSITION_2, + LOCALE_MISCSETTINGS_INFOBAR_POSITION_3, LOCALE_MISCSETTINGS_INFOBAR_PROGRESSBAR, - LOCALE_MISCSETTINGS_INFOBAR_PROGRESSBAR_0, - LOCALE_MISCSETTINGS_INFOBAR_PROGRESSBAR_1, - LOCALE_MISCSETTINGS_INFOBAR_PROGRESSBAR_2, - LOCALE_MISCSETTINGS_INFOBAR_PROGRESSBAR_3, + LOCALE_MISCSETTINGS_INFOBAR_PROGRESSBAR_DESIGN, + LOCALE_MISCSETTINGS_INFOBAR_PROGRESSBAR_DESIGN_0, + LOCALE_MISCSETTINGS_INFOBAR_PROGRESSBAR_DESIGN_1, LOCALE_MISCSETTINGS_INFOBAR_SAT_DISPLAY, LOCALE_MISCSETTINGS_INFOBAR_SHOW, LOCALE_MISCSETTINGS_INFOBAR_SHOW_DD_AVAILABLE, diff --git a/src/system/locals_intern.h b/src/system/locals_intern.h index a712c50d2..34e8b4ea2 100644 --- a/src/system/locals_intern.h +++ b/src/system/locals_intern.h @@ -830,7 +830,9 @@ const char * locale_real_names[] = "menu.hint_infobar_logo", "menu.hint_infobar_logo_dir", "menu.hint_infobar_on_epg", + "menu.hint_infobar_position", "menu.hint_infobar_progressbar", + "menu.hint_infobar_progressbar_design", "menu.hint_infobar_radiotext", "menu.hint_infobar_res", "menu.hint_infobar_sat", @@ -1160,11 +1162,15 @@ const char * locale_real_names[] = "miscsettings.infobar_disp_6", "miscsettings.infobar_disp_log", "miscsettings.infobar_logo_hdd_dir", + "miscsettings.infobar_position", + "miscsettings.infobar_position_0", + "miscsettings.infobar_position_1", + "miscsettings.infobar_position_2", + "miscsettings.infobar_position_3", "miscsettings.infobar_progressbar", - "miscsettings.infobar_progressbar_0", - "miscsettings.infobar_progressbar_1", - "miscsettings.infobar_progressbar_2", - "miscsettings.infobar_progressbar_3", + "miscsettings.infobar_progressbar_design", + "miscsettings.infobar_progressbar_design_0", + "miscsettings.infobar_progressbar_design_1", "miscsettings.infobar_sat_display", "miscsettings.infobar_show", "miscsettings.infobar_show_dd_available", diff --git a/src/system/settings.h b/src/system/settings.h index 713b5161e..c30e3246a 100644 --- a/src/system/settings.h +++ b/src/system/settings.h @@ -70,6 +70,7 @@ struct SNeutrinoSettings int infobar_show_channellogo; int infobar_progressbar; int progressbar_color; + int progressbar_design; int casystem_display; int scrambled_message; int volume_pos; From a501b6efebdc6528ac1af548186018b44a015977 Mon Sep 17 00:00:00 2001 From: Jacek Jendrzej Date: Mon, 11 Mar 2013 12:29:18 +0100 Subject: [PATCH 167/224] progresbar -add colored & vertical design , ported from neutrino-mp --- data/locale/deutsch.locale | 4 +- data/locale/english.locale | 4 +- src/gui/progressbar_setup.cpp | 6 +- src/gui/widget/progressbar.cpp | 148 +++++++++++++++++++-------------- src/gui/widget/progressbar.h | 10 ++- src/system/locals.h | 2 + src/system/locals_intern.h | 2 + 7 files changed, 106 insertions(+), 70 deletions(-) diff --git a/data/locale/deutsch.locale b/data/locale/deutsch.locale index 51d995ea6..1754c7d76 100644 --- a/data/locale/deutsch.locale +++ b/data/locale/deutsch.locale @@ -1143,7 +1143,9 @@ miscsettings.infobar_position_3 zwischen EPG-Events (schmal) miscsettings.infobar_progressbar Fortschrittsbalken miscsettings.infobar_progressbar_design Progressbar miscsettings.infobar_progressbar_design_0 Punktdesign -miscsettings.infobar_progressbar_design_1 Balkendesign +miscsettings.infobar_progressbar_design_1 Balkendesign Vertikal +miscsettings.infobar_progressbar_design_2 Balkendesign Horizontal +miscsettings.infobar_progressbar_design_3 farbig miscsettings.infobar_sat_display Kabel-/Satellitenanbieter miscsettings.infobar_show Info bei EPG Änderungen miscsettings.infobar_show_dd_available DD-Verfügbarkeit anzeigen diff --git a/data/locale/english.locale b/data/locale/english.locale index 34097e1d3..ff10725c5 100644 --- a/data/locale/english.locale +++ b/data/locale/english.locale @@ -1143,7 +1143,9 @@ miscsettings.infobar_position_3 narrow between EPG-Events miscsettings.infobar_progressbar Progressbar miscsettings.infobar_progressbar_design Progressbar miscsettings.infobar_progressbar_design_0 point Design -miscsettings.infobar_progressbar_design_1 bar Design +miscsettings.infobar_progressbar_design_1 bar Design vertical +miscsettings.infobar_progressbar_design_2 bar Design horizontal +miscsettings.infobar_progressbar_design_3 colored miscsettings.infobar_sat_display Satellite display on infobar miscsettings.infobar_show show Info on EPG change miscsettings.infobar_show_dd_available show DD availability diff --git a/src/gui/progressbar_setup.cpp b/src/gui/progressbar_setup.cpp index 98d17fa50..3ca86969e 100644 --- a/src/gui/progressbar_setup.cpp +++ b/src/gui/progressbar_setup.cpp @@ -47,11 +47,13 @@ const CMenuOptionChooser::keyval LOCALE_MISCSETTINGS_INFOBAR_POSITION_OPTIONS[L { 3 , LOCALE_MISCSETTINGS_INFOBAR_POSITION_3 } }; -#define LOCALE_MISCSETTINGS_INFOBAR_PROGRESSBAR_DESIGN_COUNT 2 +#define LOCALE_MISCSETTINGS_INFOBAR_PROGRESSBAR_DESIGN_COUNT 4 const CMenuOptionChooser::keyval LOCALE_MISCSETTINGS_INFOBAR_PROGRESSBAR_DESIGN_OPTIONS[LOCALE_MISCSETTINGS_INFOBAR_PROGRESSBAR_DESIGN_COUNT]= { { 0 , LOCALE_MISCSETTINGS_INFOBAR_PROGRESSBAR_DESIGN_0 }, - { 1 , LOCALE_MISCSETTINGS_INFOBAR_PROGRESSBAR_DESIGN_1 } + { 1 , LOCALE_MISCSETTINGS_INFOBAR_PROGRESSBAR_DESIGN_1 }, + { 2 , LOCALE_MISCSETTINGS_INFOBAR_PROGRESSBAR_DESIGN_2 }, + { 3 , LOCALE_MISCSETTINGS_INFOBAR_PROGRESSBAR_DESIGN_3 } }; CProgressbarSetup::CProgressbarSetup() diff --git a/src/gui/widget/progressbar.cpp b/src/gui/widget/progressbar.cpp index e9bef678e..355eb0fbd 100644 --- a/src/gui/widget/progressbar.cpp +++ b/src/gui/widget/progressbar.cpp @@ -1,5 +1,6 @@ /* * (C) 2008 by dbt + * (C) 2009-2010, 2012-2013 Stefan Seyfried * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -55,7 +56,7 @@ CProgressBar::~CProgressBar() { } -inline unsigned int make16color(__u32 rgb) +static inline unsigned int make16color(__u32 rgb) { return 0xFF000000 | rgb; } @@ -106,7 +107,7 @@ void CProgressBar::paintProgressBar2(const int pos_x, } void CProgressBar::realpaint(const int pos_x, const int pos_y, - const int value, const int max_value, + const int val, const int max_value, const fb_pixel_t activebar_col, const fb_pixel_t passivebar_col, const fb_pixel_t backgroundbar_col, @@ -120,6 +121,14 @@ void CProgressBar::realpaint(const int pos_x, const int pos_y, bl_changed = g_settings.progressbar_color; reset(); } + + /* stupid callers give invalid values like "-1"... */ + int value = val; + if (value < 0) + value = 0; + if (value > max_value) + value = max_value; + // set colors fb_pixel_t active_col = activebar_col != 0 ? activebar_col : COL_INFOBAR_PLUS_7; fb_pixel_t passive_col = passivebar_col != 0 ? passivebar_col : COL_INFOBAR_PLUS_3; @@ -153,11 +162,11 @@ void CProgressBar::realpaint(const int pos_x, const int pos_y, // max height progressbar bar, if icon height larger than pb_height then get height from icon int pb_max_height = icon_h > height ? icon_h + 2* frame_widht : height; - // max height of active/passive bar - int bar_height = pb_max_height - 2*frame_widht; - if (!blink || !g_settings.progressbar_color) { + // max height of active/passive bar + int bar_height = pb_max_height - 2*frame_widht; + int start_x_passive_bar = start_x + active_pb_width; int width_passive_bar = pb_max_width - active_pb_width; @@ -182,14 +191,37 @@ void CProgressBar::realpaint(const int pos_x, const int pos_y, } else { + int itemw = ITEMW, itemh = ITEMW, pointx = POINT, pointy = POINT; + if(g_settings.progressbar_color){ + switch ((pb_color_t)g_settings.progressbar_design){ + default: + case PB_MATRIX: /* matrix */ + break; + case PB_LINES_V: /* vert. lines */ + itemh = height; + pointy = height; + break; + case PB_LINES_H: /* horiz. lines */ + itemw = POINT; + break; + case PB_COLOR: /* filled color */ + itemw = POINT; + itemh = height; + pointy = height; + break; + } + } + const int spc = itemh - pointy; /* space between horizontal lines / points */ + int hcnt = (height + spc) / itemh; /* how many POINTs is the bar high */ + int yoff = (height + spc - itemh * hcnt) / 2; + //printf("height: %d itemh: %d hcnt: %d yoff: %d spc: %d\n", height, itemh, hcnt, yoff, spc); /* red, yellow, green are given in percent */ - int rd = red * width / (100 * ITEMW); /* how many POINTs red */ - int yw = yellow * width / (100 * ITEMW); /* how many POINTs yellow */ - int gn = green * width / (100 * ITEMW); /* how many POINTs green */ + int rd = red * width / (100 * itemw); /* how many POINTs red */ + int yw = yellow * width / (100 * itemw); /* how many POINTs yellow */ + int gn = green * width / (100 * itemw); /* how many POINTs green */ - int hcnt = height / ITEMW; /* how many POINTs is the bar high */ - int maxi = active_pb_width / ITEMW; /* how many POINTs is the active bar */ - int total = width / ITEMW; /* total number of POINTs */ + int maxi = active_pb_width / itemw; /* how many POINTs is the active bar */ + int total = width / itemw; /* total number of POINTs */ uint32_t rgb; fb_pixel_t color; @@ -202,85 +234,73 @@ void CProgressBar::realpaint(const int pos_x, const int pos_y, width, pb_max_height, shadowbar_col, c_rad); // shadow } - if (active_pb_width != last_width) - { - int step; + if (active_pb_width != last_width) { int i, j; - int b = 0; - if (active_pb_width > last_width) - { - for (i = 0; (i < rd) && (i < maxi); i++) - { //green section - step = 255 / rd; + const int py = pos_y + yoff; + if (active_pb_width > last_width) { + int step, off; + int b = 0; + uint8_t diff = 0; + for (i = 0; (i < rd) && (i < maxi); i++) { + diff = i * 255 / rd; if (invert) - rgb = GREEN + ((unsigned char)(step * i) << 16); // adding red + rgb = GREEN + (diff << 16); // adding red else - rgb = RED + ((unsigned char)(step * i) << 8); // adding green + rgb = RED + (diff << 8); // adding green color = make16color(rgb); - if (g_settings.progressbar_design == 0) - { - for(j = 0; j <= hcnt; j++) - frameBuffer->paintBoxRel(pos_x + i * ITEMW, pos_y + j * ITEMW, POINT, POINT, color); - } - else - frameBuffer->paintBoxRel(pos_x + i * ITEMW,start_y, POINT, bar_height, color); + for (j = 0; j < hcnt; j++) + frameBuffer->paintBoxRel(pos_x + i * itemw, py + j * itemh, + pointx, pointy, color); } - for (; (i < yw) && (i < maxi); i++) - { //yello section - step = 255 / yw / 2; + step = yw - rd - 1; + if (step < 1) + step = 1; + for (; (i < yw) && (i < maxi); i++) { + diff = b++ * 255 / step / 2; if (invert) - rgb = YELLOW - ((unsigned char)(step * (b++)) << 8); // removing green + rgb = YELLOW - (diff << 8); // removing green else - rgb = YELLOW - ((unsigned char)(step * (b++)) << 16); // removing red + rgb = YELLOW - (diff << 16); // removing red color = make16color(rgb); - if (g_settings.progressbar_design == 0) - { - for(j = 0; j <= hcnt; j++) - frameBuffer->paintBoxRel(pos_x + i * ITEMW, pos_y + j * ITEMW, POINT, POINT, color); - } - else - frameBuffer->paintBoxRel(pos_x + i * ITEMW, start_y, POINT, bar_height, color); + for (j = 0; j < hcnt; j++) + frameBuffer->paintBoxRel(pos_x + i * itemw, py + j * itemh, + pointx, pointy, color); } - for (; (i < gn) && (i < maxi); i++) - { //red section - step = 255 / gn; + off = diff; + b = 0; + step = gn - yw - 1; + if (step < 1) + step = 1; + for (; (i < gn) && (i < maxi); i++) { + diff = b++ * 255 / step / 2 + off; if (invert) - rgb = YELLOW - ((unsigned char) (step * (b++)) << 8); // removing green + rgb = YELLOW - (diff << 8); // removing green else - rgb = YELLOW - ((unsigned char) (step * (b++)) << 16); // removing red + rgb = YELLOW - (diff << 16); // removing red color = make16color(rgb); - if (g_settings.progressbar_design == 0) - { - for(j = 0; j <= hcnt; j++) - frameBuffer->paintBoxRel(pos_x + i * ITEMW, pos_y + j * ITEMW, POINT, POINT, color); - } - else - frameBuffer->paintBoxRel(pos_x + i * ITEMW, start_y, POINT, bar_height, color); + for (j = 0; j < hcnt; j++) + frameBuffer->paintBoxRel(pos_x + i * itemw, py + j * itemh, + pointx, pointy, color); } } - for(i = maxi; i < total; i++) - { - for(j = 0; j <= hcnt; j++) - if (g_settings.progressbar_design == 0) - frameBuffer->paintBoxRel(pos_x + i * ITEMW, pos_y + j * ITEMW, POINT, POINT, COL_INFOBAR_PLUS_3);//fill passive - else - frameBuffer->paintBoxRel(pos_x + i * ITEMW, start_y, POINT, bar_height, COL_INFOBAR_PLUS_3);//fill passive + for(i = maxi; i < total; i++) { + for (j = 0; j < hcnt; j++) + frameBuffer->paintBoxRel(pos_x + i * itemw, py + j * itemh, + pointx, pointy, COL_INFOBAR_PLUS_3);//fill passive } last_width = active_pb_width; } } // paint icon if present - if (iconfile != NULL) - { + if (iconfile != NULL){ int icon_y = pos_y + pb_max_height / 2 - icon_h / 2; frameBuffer->paintIcon(iconfile, pos_x + frame_widht, icon_y); } // upper text int upper_labeltext_y = start_y - frame_widht; - if (upper_labeltext != NULL) - { + if (upper_labeltext != NULL) { g_Font[font_pbar]->RenderString(start_x +2, upper_labeltext_y, width, diff --git a/src/gui/widget/progressbar.h b/src/gui/widget/progressbar.h index f66cf7e42..1d2b6bf2e 100644 --- a/src/gui/widget/progressbar.h +++ b/src/gui/widget/progressbar.h @@ -1,7 +1,6 @@ /* - * $Id$ - * * (C) 2008 by dbt + * (C) 2009,2010,2013 Stefan Seyfried * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -131,6 +130,13 @@ class CProgressBar void reset() { last_width = -1; } /* force update on next paint */ void hide(); + + enum pb_color_t { + PB_MATRIX = 0, /* 0 */ + PB_LINES_V, /* 1 */ + PB_LINES_H, /* 2 */ + PB_COLOR /* 3 */ + }; }; #endif /* __gui_widget_progressbar_h__ */ diff --git a/src/system/locals.h b/src/system/locals.h index 2a1459151..8fc8c9ee8 100644 --- a/src/system/locals.h +++ b/src/system/locals.h @@ -1171,6 +1171,8 @@ typedef enum LOCALE_MISCSETTINGS_INFOBAR_PROGRESSBAR_DESIGN, LOCALE_MISCSETTINGS_INFOBAR_PROGRESSBAR_DESIGN_0, LOCALE_MISCSETTINGS_INFOBAR_PROGRESSBAR_DESIGN_1, + LOCALE_MISCSETTINGS_INFOBAR_PROGRESSBAR_DESIGN_2, + LOCALE_MISCSETTINGS_INFOBAR_PROGRESSBAR_DESIGN_3, LOCALE_MISCSETTINGS_INFOBAR_SAT_DISPLAY, LOCALE_MISCSETTINGS_INFOBAR_SHOW, LOCALE_MISCSETTINGS_INFOBAR_SHOW_DD_AVAILABLE, diff --git a/src/system/locals_intern.h b/src/system/locals_intern.h index 34e8b4ea2..cef32f0e9 100644 --- a/src/system/locals_intern.h +++ b/src/system/locals_intern.h @@ -1171,6 +1171,8 @@ const char * locale_real_names[] = "miscsettings.infobar_progressbar_design", "miscsettings.infobar_progressbar_design_0", "miscsettings.infobar_progressbar_design_1", + "miscsettings.infobar_progressbar_design_2", + "miscsettings.infobar_progressbar_design_3", "miscsettings.infobar_sat_display", "miscsettings.infobar_show", "miscsettings.infobar_show_dd_available", From 0064c6c70494b149b7aefd8f58a86d4d819c4835 Mon Sep 17 00:00:00 2001 From: svenhoefer Date: Sat, 16 Mar 2013 23:47:23 +0100 Subject: [PATCH 168/224] - channellist: fix dimensions when using very large fonts * paint scrollbar over full height of main box --- src/gui/channellist.cpp | 53 ++++++++++++++++++++--------------------- src/gui/channellist.h | 2 +- 2 files changed, 27 insertions(+), 28 deletions(-) diff --git a/src/gui/channellist.cpp b/src/gui/channellist.cpp index a809167e4..00d69cf77 100644 --- a/src/gui/channellist.cpp +++ b/src/gui/channellist.cpp @@ -113,6 +113,7 @@ CChannelList::CChannelList(const char * const pName, bool phistoryMode, bool _vl selected_chid = 0; footerHeight = g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL]->getHeight()+6; //initial height value for buttonbar theight = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]->getHeight(); + fheight = g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST]->getHeight(); previous_channellist_additional = -1; eventFont = SNeutrinoSettings::FONT_TYPE_CHANNELLIST_EVENT; dline = NULL; @@ -478,31 +479,37 @@ int CChannelList::exec() void CChannelList::calcSize() { - const int pic_h = 39; + CVFD::getInstance()->setMode(CVFD::MODE_MENU_UTF8, name.c_str()); + // recalculate theight, fheight and footerHeight for a possilble change of fontsize factor + theight = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]->getHeight(); + fheight = g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST]->getHeight(); + if (fheight == 0) + fheight = 1; /* avoid div-by-zero crash on invalid font */ + footerHeight = g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL]->getHeight()+6; + + // calculate width full_width = frameBuffer->getScreenWidth() - frameBuffer->getScreenX() - 2*ConnectLineBox_Width; if (g_settings.channellist_additional) width = full_width / 3 * 2; else width = full_width; - height = h_max ((frameBuffer->getScreenHeight() / 20 * 17), 0); + // calculate height (the infobox below mainbox is handled outside height) + info_height = 2*fheight + g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST_DESCR]->getHeight() + 10; + height = h_max ((frameBuffer->getScreenHeight() / 20 * 18) - info_height, 0); - x = frameBuffer->getScreenX() + (frameBuffer->getScreenWidth() - full_width) / 2; + // calculate x/y positions + x = getScreenStartX(full_width); if (x < ConnectLineBox_Width) x = ConnectLineBox_Width; - y = frameBuffer->getScreenY(); - - CVFD::getInstance()->setMode(CVFD::MODE_MENU_UTF8, name.c_str()); - - /* assuming all color icons must have same size */ - int icol_w, icol_h; - frameBuffer->getIconSize(NEUTRINO_ICON_BUTTON_RED, &icol_w, &icol_h); - - theight = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]->getHeight(); + y = getScreenStartY(height + info_height); + // calculate header height + const int pic_h = 39; theight = std::max(theight, pic_h); + int icol_w, icol_h; frameBuffer->getIconSize(NEUTRINO_ICON_BUTTON_HELP, &icol_w, &icol_h); theight = std::max(theight, icol_h); @@ -515,18 +522,10 @@ void CChannelList::calcSize() theight = std::max(theight, icol_h); } - fheight = g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST]->getHeight(); - if (fheight == 0) - fheight = 1; /* avoid crash on invalid font */ - - listmaxshow = (height - theight - footerHeight -0)/fheight; - height = theight + footerHeight + listmaxshow * fheight; - info_height = 2*fheight + g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST_DESCR]->getHeight() + 10; - - int sh = frameBuffer->getScreenHeight(); - int ytmp = (sh - height - info_height) / 2; - y += ytmp; + // calculate max entrys in mainbox + listmaxshow = (height - theight - footerHeight) / fheight; + // calculate width/height of right info_zone and pip-box infozone_width = full_width - width; pig_width = infozone_width; if (g_settings.channellist_additional == 2) // with miniTV @@ -943,7 +942,7 @@ void CChannelList::hide() { videoDecoder->Pig(-1, -1, -1, -1); } - frameBuffer->paintBackgroundBoxRel(x, y, full_width, height+ info_height+ 5); + frameBuffer->paintBackgroundBoxRel(x, y, full_width, height + info_height); clearItem2DetailsLine(); } @@ -1637,7 +1636,7 @@ void CChannelList::clearItem2DetailsLine() void CChannelList::paintItem2DetailsLine (int pos) { int xpos = x - ConnectLineBox_Width; - int ypos1 = y + theight+0 + pos*fheight; + int ypos1 = y + theight + pos*fheight; int ypos2 = y + height; int ypos1a = ypos1 + (fheight/2)-2; int ypos2a = ypos2 + (info_height/2)-2; @@ -1780,7 +1779,7 @@ void CChannelList::paintButtonBar(bool is_current) void CChannelList::paintItem(int pos) { - int ypos = y+ theight+0 + pos*fheight; + int ypos = y+ theight + pos*fheight; uint8_t color; fb_pixel_t bgcolor; bool iscurrent = true; @@ -2057,7 +2056,7 @@ void CChannelList::paint() paintItem(count); } const int ypos = y+ theight; - const int sb = fheight* listmaxshow; + const int sb = height - theight - footerHeight; // paint scrollbar over full height of main box frameBuffer->paintBoxRel(x+ width- 15,ypos, 15, sb, COL_MENUCONTENT_PLUS_1); const int sbc= ((chanlist.size()- 1)/ listmaxshow)+ 1; diff --git a/src/gui/channellist.h b/src/gui/channellist.h index 31bb61fec..1dd633d35 100644 --- a/src/gui/channellist.h +++ b/src/gui/channellist.h @@ -80,6 +80,7 @@ private: int full_width; int width; int height; + int info_height; // the infobox below mainbox is handled outside height int x; int y; int logo_off; @@ -95,7 +96,6 @@ private: bool displayNext; bool displayList; - int info_height; int ChannelList_Rec; void paintDetails(int index); From 3584a11872f59558bc671646cca6bc2c50bee87e Mon Sep 17 00:00:00 2001 From: svenhoefer Date: Sun, 17 Mar 2013 20:15:17 +0100 Subject: [PATCH 169/224] - fix my last commit 0064c6c (recalc height) --- src/gui/channellist.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/gui/channellist.cpp b/src/gui/channellist.cpp index 00d69cf77..54dbc5561 100644 --- a/src/gui/channellist.cpp +++ b/src/gui/channellist.cpp @@ -499,11 +499,10 @@ void CChannelList::calcSize() info_height = 2*fheight + g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST_DESCR]->getHeight() + 10; height = h_max ((frameBuffer->getScreenHeight() / 20 * 18) - info_height, 0); - // calculate x/y positions + // calculate x position x = getScreenStartX(full_width); if (x < ConnectLineBox_Width) x = ConnectLineBox_Width; - y = getScreenStartY(height + info_height); // calculate header height const int pic_h = 39; @@ -525,6 +524,12 @@ void CChannelList::calcSize() // calculate max entrys in mainbox listmaxshow = (height - theight - footerHeight) / fheight; + // recalculate height to avoid spaces between last entry in mainbox and footer + height = theight + listmaxshow*fheight + footerHeight; + + // calculate y position + y = getScreenStartY(height + info_height); + // calculate width/height of right info_zone and pip-box infozone_width = full_width - width; pig_width = infozone_width; From b0469b196e188602a8ed216aa890127c99f7eaa5 Mon Sep 17 00:00:00 2001 From: svenhoefer Date: Sun, 17 Mar 2013 20:19:13 +0100 Subject: [PATCH 170/224] - fix width of pip-boxes in streaminfo and imageinfo --- src/gui/imageinfo.cpp | 2 +- src/gui/streaminfo2.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gui/imageinfo.cpp b/src/gui/imageinfo.cpp index 25be21191..3a68d900f 100644 --- a/src/gui/imageinfo.cpp +++ b/src/gui/imageinfo.cpp @@ -287,6 +287,6 @@ void CImageInfo::paint() paintLine(xpos+offset, font_small, "Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA."); if (pip == NULL) - pip = new CComponentsPIP(width-width/3-10, y+10, 30); + pip = new CComponentsPIP(width-width/3-10, y+10, 33); pip->paint(); } diff --git a/src/gui/streaminfo2.cpp b/src/gui/streaminfo2.cpp index 8bde0051f..242c479d5 100644 --- a/src/gui/streaminfo2.cpp +++ b/src/gui/streaminfo2.cpp @@ -419,7 +419,7 @@ void CStreamInfo2::paint (int /*mode*/) ypos += hheight; if (pip == NULL) - pip = new CComponentsPIP(width-width/3-10, y+10, 30); + pip = new CComponentsPIP(width-width/3-10, y+10, 33); pip->paint(); paint_techinfo (xpos, ypos); From 74b2dde2486bb5a8182a3d1b14ded89a1e857ab4 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Sat, 9 Mar 2013 00:28:49 +0100 Subject: [PATCH 171/224] CComponentsWindow: using current screen settings for default dimensions --- src/gui/components/cc_frm_window.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/gui/components/cc_frm_window.cpp b/src/gui/components/cc_frm_window.cpp index 82e79ea15..69a5dbffb 100644 --- a/src/gui/components/cc_frm_window.cpp +++ b/src/gui/components/cc_frm_window.cpp @@ -31,6 +31,7 @@ #include #include #include "cc.h" +#include using namespace std; @@ -50,6 +51,12 @@ void CComponentsWindow::initVarWindow() ccw_head = NULL; ccw_caption = ""; ccw_icon_name = NULL; + + //using current screen settings for default dimensions + width = frameBuffer->getScreenWidth(); + height = frameBuffer->getScreenHeight(); + x=getScreenStartX(width); + y=getScreenStartY(height); setShadowOnOff(true); } From de330ac39cb69a45a09cd6fde369520055f69ef1 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Sat, 9 Mar 2013 14:05:24 +0100 Subject: [PATCH 172/224] CComponentsWindow: remove refresh() initCCWItems() does the same, but is private --- src/gui/components/cc.h | 4 ++-- src/gui/components/cc_frm_window.cpp | 15 +++++++++++++-- src/gui/test_menu.cpp | 1 - 3 files changed, 15 insertions(+), 5 deletions(-) diff --git a/src/gui/components/cc.h b/src/gui/components/cc.h index 667aeeb9b..0d529f725 100644 --- a/src/gui/components/cc.h +++ b/src/gui/components/cc.h @@ -33,7 +33,7 @@ #include #include -//#define DEBUG_CC +#define DEBUG_CC class CComponents { @@ -515,8 +515,8 @@ class CComponentsWindow : public CComponentsForm ~CComponentsWindow(); void paint(bool do_save_bg = CC_SAVE_SCREEN_YES); - void refresh(){initCCWItems();}; void setWindowCaption(const std::string& text){ccw_caption = text;}; + void setWindowCaption(neutrino_locale_t locale_text); void setWindowIcon(const char* iconname){ccw_icon_name = iconname;}; }; diff --git a/src/gui/components/cc_frm_window.cpp b/src/gui/components/cc_frm_window.cpp index 69a5dbffb..fa2c22634 100644 --- a/src/gui/components/cc_frm_window.cpp +++ b/src/gui/components/cc_frm_window.cpp @@ -67,10 +67,18 @@ CComponentsWindow::~CComponentsWindow() delete ccw_head; } +void CComponentsWindow::setWindowCaption(neutrino_locale_t locale_text) +{ + ccw_caption = g_Locale->getText(locale_text); +} + void CComponentsWindow::initHeader() { - if (ccw_head == NULL) - ccw_head = new CComponentsHeader(); + if (ccw_head){ + delete ccw_head; + ccw_head = NULL; + } + ccw_head = new CComponentsHeader(); ccw_head->setXPos(0); ccw_head->setYPos(0); @@ -89,6 +97,9 @@ void CComponentsWindow::initCCWItems() void CComponentsWindow::paint(bool do_save_bg) { + //prepare items before paint + initCCWItems(); + //paint body paintInit(do_save_bg); diff --git a/src/gui/test_menu.cpp b/src/gui/test_menu.cpp index ecdef3651..dce736483 100644 --- a/src/gui/test_menu.cpp +++ b/src/gui/test_menu.cpp @@ -512,7 +512,6 @@ int CTestMenu::exec(CMenuTarget* parent, const std::string &actionKey) window->setWindowIcon(NEUTRINO_ICON_LOCK); window->setWindowCaption("Test"); } - window->refresh(); if (!window->isPainted()) window->paint(); From da356d94daa01e41619df2b226fc9f93e1f40888 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Sun, 10 Mar 2013 21:22:07 +0100 Subject: [PATCH 173/224] CComponentsHeader/Icon: use inherited destructor Inherited destructor contains identic code. --- src/gui/components/cc.h | 7 ++++--- src/gui/components/cc_frm.cpp | 5 +++++ src/gui/components/cc_frm_header.cpp | 11 +---------- src/gui/components/cc_frm_window.cpp | 13 +++++++------ 4 files changed, 17 insertions(+), 19 deletions(-) diff --git a/src/gui/components/cc.h b/src/gui/components/cc.h index 0d529f725..6bc834ed9 100644 --- a/src/gui/components/cc.h +++ b/src/gui/components/cc.h @@ -394,6 +394,7 @@ class CComponentsForm : public CComponentsItem virtual int getCCItemId(CComponentsItem* cc_Item); virtual CComponentsItem* getCCItem(const uint& cc_item_id); virtual void paintCCItems(); + virtual void cleanCCForm(); }; class CComponentsIconForm : public CComponentsForm @@ -410,6 +411,7 @@ class CComponentsIconForm : public CComponentsForm CComponentsIconForm(); CComponentsIconForm(const int x_pos, const int y_pos, const int w, const int h, const std::vector v_icon_names, bool has_shadow = CC_SHADOW_OFF, fb_pixel_t color_frame = COL_MENUCONTENT_PLUS_6, fb_pixel_t color_body = COL_MENUHEAD_PLUS_0, fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0); +// ~CComponentsIconForm(); //inherited from CComponentsForm void paint(bool do_save_bg = CC_SAVE_SCREEN_YES); void initCCIcons(); @@ -479,8 +481,7 @@ class CComponentsHeader : public CComponentsForm fb_pixel_t color_frame = COL_MENUCONTENT_PLUS_6, fb_pixel_t color_body = COL_MENUHEAD_PLUS_0, fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0); CComponentsHeader(const int x_pos, const int y_pos, const int w, const int h = 0, neutrino_locale_t caption_locale = NONEXISTANT_LOCALE, const char* icon_name = NULL, const int buttons = 0,bool has_shadow = CC_SHADOW_OFF, fb_pixel_t color_frame = COL_MENUCONTENT_PLUS_6, fb_pixel_t color_body = COL_MENUHEAD_PLUS_0, fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0); - -// ~CComponentsHeader(); +// ~CComponentsHeader(); //inherited from CComponentsForm void paint(bool do_save_bg = CC_SAVE_SCREEN_YES); void setHeaderText(const std::string& caption); @@ -512,7 +513,7 @@ class CComponentsWindow : public CComponentsForm CC_WINDOW_ITEM_HEADER = 0 }; CComponentsWindow(); - ~CComponentsWindow(); + ~CComponentsWindow(); void paint(bool do_save_bg = CC_SAVE_SCREEN_YES); void setWindowCaption(const std::string& text){ccw_caption = text;}; diff --git a/src/gui/components/cc_frm.cpp b/src/gui/components/cc_frm.cpp index 728fc40bb..e49772a52 100644 --- a/src/gui/components/cc_frm.cpp +++ b/src/gui/components/cc_frm.cpp @@ -61,6 +61,11 @@ CComponentsForm::CComponentsForm(const int x_pos, const int y_pos, const int w, } CComponentsForm::~CComponentsForm() +{ + cleanCCForm(); +} + +void CComponentsForm::cleanCCForm() { #ifdef DEBUG_CC printf("[CComponents] calling %s...\n", __FUNCTION__); diff --git a/src/gui/components/cc_frm_header.cpp b/src/gui/components/cc_frm_header.cpp index a67aac746..41417d1d0 100644 --- a/src/gui/components/cc_frm_header.cpp +++ b/src/gui/components/cc_frm_header.cpp @@ -86,16 +86,7 @@ CComponentsHeader::CComponentsHeader( const int x_pos, const int y_pos, const in initCCHItems(); } -#if 0 -CComponentsHeader::~CComponentsHeader() -{ - hide(); - clearSavedScreen(); - clearCCItems(); - clear(); -} -#endif - + void CComponentsHeader::initVarHeader() { //CComponentsHeader diff --git a/src/gui/components/cc_frm_window.cpp b/src/gui/components/cc_frm_window.cpp index fa2c22634..1ed996f6d 100644 --- a/src/gui/components/cc_frm_window.cpp +++ b/src/gui/components/cc_frm_window.cpp @@ -42,6 +42,13 @@ CComponentsWindow::CComponentsWindow() initVarWindow(); } +CComponentsWindow::~CComponentsWindow() +{ + if (ccw_head) + delete ccw_head; + cleanCCForm(); +} + void CComponentsWindow::initVarWindow() { //CComponentsForm @@ -61,12 +68,6 @@ void CComponentsWindow::initVarWindow() setShadowOnOff(true); } -CComponentsWindow::~CComponentsWindow() -{ - if (ccw_head) - delete ccw_head; -} - void CComponentsWindow::setWindowCaption(neutrino_locale_t locale_text) { ccw_caption = g_Locale->getText(locale_text); From 4a931af6efb28f36b9de7f89809447198fd25d25 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Wed, 13 Mar 2013 23:23:19 +0100 Subject: [PATCH 174/224] CComponentsForm/Header/Icons/Window: try to fix multiple inits and paints Some items had multiple inits and some calls of clearCCItems() have caused segfaults, hope this fix this. --- src/gui/components/cc.h | 3 +- src/gui/components/cc_frm.cpp | 47 +++++--- src/gui/components/cc_frm_header.cpp | 164 ++++++++++++++++----------- src/gui/components/cc_frm_icons.cpp | 19 +--- src/gui/components/cc_frm_window.cpp | 42 +++---- 5 files changed, 164 insertions(+), 111 deletions(-) diff --git a/src/gui/components/cc.h b/src/gui/components/cc.h index 6bc834ed9..8ba52e366 100644 --- a/src/gui/components/cc.h +++ b/src/gui/components/cc.h @@ -377,6 +377,7 @@ class CComponentsForm : public CComponentsItem std::vector v_cc_items; void initVarForm(); void clearCCItems(); + void paintForm(bool do_save_bg); public: CComponentsForm(); @@ -481,7 +482,7 @@ class CComponentsHeader : public CComponentsForm fb_pixel_t color_frame = COL_MENUCONTENT_PLUS_6, fb_pixel_t color_body = COL_MENUHEAD_PLUS_0, fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0); CComponentsHeader(const int x_pos, const int y_pos, const int w, const int h = 0, neutrino_locale_t caption_locale = NONEXISTANT_LOCALE, const char* icon_name = NULL, const int buttons = 0,bool has_shadow = CC_SHADOW_OFF, fb_pixel_t color_frame = COL_MENUCONTENT_PLUS_6, fb_pixel_t color_body = COL_MENUHEAD_PLUS_0, fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0); -// ~CComponentsHeader(); //inherited from CComponentsForm + ~CComponentsHeader(); void paint(bool do_save_bg = CC_SAVE_SCREEN_YES); void setHeaderText(const std::string& caption); diff --git a/src/gui/components/cc_frm.cpp b/src/gui/components/cc_frm.cpp index e49772a52..9e241cfc6 100644 --- a/src/gui/components/cc_frm.cpp +++ b/src/gui/components/cc_frm.cpp @@ -68,25 +68,32 @@ CComponentsForm::~CComponentsForm() void CComponentsForm::cleanCCForm() { #ifdef DEBUG_CC - printf("[CComponents] calling %s...\n", __FUNCTION__); + printf("[CComponentsForm] [%s - %d] clean up...\n", __FUNCTION__, __LINE__); #endif - hide(); - clearSavedScreen(); +// hide(); clearCCItems(); + clearSavedScreen(); clear(); } + + void CComponentsForm::clearCCItems() { - if (v_cc_items.empty()) + if (v_cc_items.empty()) return; #ifdef DEBUG_CC - printf("[CComponentsForm] %s... cleanup %d form cc-items\n", __FUNCTION__, v_cc_items.size()); + printf(" [CComponentsForm] %s... delete %d cc-item(s) \n", __FUNCTION__, v_cc_items.size()); #endif + for(size_t i=0; igetItemType()); +#endif + delete v_cc_items[i]; + v_cc_items[i] = NULL; + } } v_cc_items.clear(); } @@ -118,7 +125,16 @@ void CComponentsForm::initVarForm() void CComponentsForm::addCCItem(CComponentsItem* cc_Item) { - v_cc_items.push_back(cc_Item); + if (cc_Item){ +#ifdef DEBUG_CC + printf(" [CComponentsForm] %s-%d add cc_Item [type %d] [current count %d] \n", __FUNCTION__, __LINE__, cc_Item->getItemType(), v_cc_items.size()); +#endif + v_cc_items.push_back(cc_Item); + } +#ifdef DEBUG_CC + else + printf(" [CComponentsForm] %s-%d tried to add an empty or invalide cc_item !!!\n", __FUNCTION__, __LINE__); +#endif } int CComponentsForm::getCCItemId(CComponentsItem* cc_Item) @@ -191,13 +207,18 @@ void CComponentsForm::removeCCItem(const uint& cc_item_id) #endif } -void CComponentsForm::paint(bool do_save_bg) +void CComponentsForm::paintForm(bool do_save_bg) { //paint body paintInit(do_save_bg); - - //paint items - paintCCItems(); + + //paint + paintCCItems(); +} + +void CComponentsForm::paint(bool do_save_bg) +{ + paintForm(do_save_bg); } void CComponentsForm::paintCCItems() diff --git a/src/gui/components/cc_frm_header.cpp b/src/gui/components/cc_frm_header.cpp index 41417d1d0..23a3178d5 100644 --- a/src/gui/components/cc_frm_header.cpp +++ b/src/gui/components/cc_frm_header.cpp @@ -82,11 +82,11 @@ CComponentsHeader::CComponentsHeader( const int x_pos, const int y_pos, const in cch_locale_text = caption_locale; cch_icon_name = icon_name; cch_buttons = buttons; + initCCHDefaultButtons(); initCCHItems(); } - void CComponentsHeader::initVarHeader() { //CComponentsHeader @@ -105,7 +105,7 @@ void CComponentsHeader::initVarHeader() ccif_width = 0; cch_buttons = 0; cch_btn_offset = 8; - v_cch_btn.clear(); + v_cch_btn.clear(); //CComponentsForm initVarForm(); @@ -116,6 +116,15 @@ void CComponentsHeader::initVarHeader() corner_type = CORNER_TOP; } +CComponentsHeader::~CComponentsHeader() +{ +#ifdef DEBUG_CC + printf("[~CComponentsHeader] [%s - %d] delete...\n", __FUNCTION__, __LINE__); +#endif + v_cch_btn.clear(); + cleanCCForm(); +} + void CComponentsHeader::setHeaderText(const std::string& caption) { cch_text = caption; @@ -133,37 +142,51 @@ void CComponentsHeader::setHeaderIcon(const char* icon_name) void CComponentsHeader::initCCHeaderIcon() { + //reset cch_icon_w + cch_icon_w = cch_btn_offset; + + //init cch_icon_obj only if an icon available if (cch_icon_name == NULL) { - cch_icon_w = cch_btn_offset; + cch_icon_w = cch_btn_offset; + if (cch_icon_obj) + delete cch_icon_obj; + cch_icon_obj = NULL; return; } - if (cch_icon_name) - cch_icon_obj = new CComponentsPicture(cch_icon_x, cch_items_y, 0, 0, cch_icon_name); - cch_icon_obj->setWidth(height-2*fr_thickness); - cch_icon_obj->setHeight(height); - cch_icon_obj->setPictureAlign(CC_ALIGN_HOR_CENTER | CC_ALIGN_VER_CENTER); - cch_icon_obj->doPaintBg(false); + //create instance for cch_icon_obj + if (cch_icon_obj == NULL){ +#ifdef DEBUG_CC + printf(" [CComponentsHeader]\n [%s - %d] init header icon: %s\n", __FUNCTION__, __LINE__, cch_icon_name); +#endif + cch_icon_obj = new CComponentsPicture(cch_icon_x, cch_items_y, 0, 0, cch_icon_name); + //add item only one time + addCCItem(cch_icon_obj); //icon + } - //corner of icon item - cch_icon_obj->setCornerRadius(corner_rad-fr_thickness); - int cc_icon_corner_type = corner_type; - if (corner_type == CORNER_TOP_LEFT || corner_type == CORNER_TOP) - cc_icon_corner_type = CORNER_TOP_LEFT; - else - cc_icon_corner_type = CORNER_LEFT; - cch_icon_obj->setCornerType(cc_icon_corner_type); + //set properties for icon object + if (cch_icon_obj){ + cch_icon_obj->setWidth(height-2*fr_thickness); + cch_icon_obj->setHeight(height); + cch_icon_obj->setPictureAlign(CC_ALIGN_HOR_CENTER | CC_ALIGN_VER_CENTER); + cch_icon_obj->doPaintBg(false); - //set width of icon object - cch_icon_w = cch_icon_obj->getWidth(); + //set corner mode of icon item + cch_icon_obj->setCornerRadius(corner_rad-fr_thickness); + int cc_icon_corner_type = corner_type; + if (corner_type == CORNER_TOP_LEFT || corner_type == CORNER_TOP) + cc_icon_corner_type = CORNER_TOP_LEFT; + else + cc_icon_corner_type = CORNER_LEFT; + cch_icon_obj->setCornerType(cc_icon_corner_type); + + //set width of icon object + cch_icon_w = cch_icon_obj->getWidth(); + } } void CComponentsHeader::addHeaderButton(const std::string& button_name) { - if (cch_btn_obj){ - delete cch_btn_obj; - cch_btn_obj = NULL; - } v_cch_btn.push_back(button_name); initCCHeaderButtons(); } @@ -171,10 +194,9 @@ void CComponentsHeader::addHeaderButton(const std::string& button_name) void CComponentsHeader::removeHeaderButtons() { v_cch_btn.clear(); - if (cch_btn_obj){ - delete cch_btn_obj; - cch_btn_obj = NULL; - } + cch_btn_obj->removeAllIcons(); + initCCHeaderButtons(); + } void CComponentsHeader::initCCHDefaultButtons() @@ -187,6 +209,9 @@ void CComponentsHeader::initCCHDefaultButtons() v_cch_btn.push_back(NEUTRINO_ICON_BUTTON_INFO); if (cch_buttons & CC_BTN_MENU) v_cch_btn.push_back(NEUTRINO_ICON_BUTTON_MENU); +#ifdef DEBUG_CC + printf("[CComponentsHeader] %s added %d default buttons...\n", __FUNCTION__, v_cch_btn.size()); +#endif } // calculate minimal width of icon form @@ -203,41 +228,61 @@ void CComponentsHeader::initCCButtonFormSize() void CComponentsHeader::initCCHeaderButtons() { //exit if no button defined - if (v_cch_btn.empty()) + if (v_cch_btn.empty()) return; - + initCCButtonFormSize(); - cch_btn_obj = new CComponentsIconForm(); - cch_btn_obj->setDimensionsAll(0+width-ccif_width, 0, ccif_width-cch_btn_offset, height); - cch_btn_obj->doPaintBg(false); - cch_btn_obj->setIconOffset(cch_btn_offset); - cch_btn_obj->setIconAlign(CComponentsIconForm::CC_ICONS_FRM_ALIGN_RIGHT); - cch_btn_obj->removeAllIcons(); - cch_btn_obj->addIcon(v_cch_btn); + if (cch_btn_obj == NULL){ + cch_btn_obj = new CComponentsIconForm(); +#ifdef DEBUG_CC + printf(" [CComponentsHeader]\n [%s - %d] init header buttons...\n", __FUNCTION__, __LINE__); +#endif + //add button form + addCCItem(cch_btn_obj); //buttons + } + + //set button form properties + if (cch_btn_obj){ + cch_btn_obj->setDimensionsAll(0+width-ccif_width, 0, ccif_width-cch_btn_offset, height); + cch_btn_obj->doPaintBg(false); + cch_btn_obj->setIconOffset(cch_btn_offset); + cch_btn_obj->setIconAlign(CComponentsIconForm::CC_ICONS_FRM_ALIGN_RIGHT); + cch_btn_obj->removeAllIcons(); + cch_btn_obj->addIcon(v_cch_btn); + } } void CComponentsHeader::initCCHeaderText() { + //reset header text position first cch_text_x = cch_icon_x+cch_icon_w; - cch_text_obj = new CComponentsText(cch_text_x, cch_items_y, width-cch_icon_w-fr_thickness, height-2*fr_thickness, cch_text.c_str()); - cch_text_obj->setTextFont(cch_font); - cch_text_obj->setTextColor(cch_col_text); - cch_text_obj->setColorBody(col_body); - cch_text_obj->doPaintBg(false); - - //corner of text item - cch_text_obj->setCornerRadius(corner_rad-fr_thickness); - cch_text_obj->setCornerType(corner_type); + + //create cch_text_obj and add to collection + if (cch_text_obj == NULL){ +#ifdef DEBUG_CC + printf(" [CComponentsHeader]\n [%s - %d] init header text: %s\n", __FUNCTION__, __LINE__, cch_text.c_str()); +#endif + cch_text_obj = new CComponentsText(cch_text_x, cch_items_y, width-cch_icon_w-fr_thickness, height-2*fr_thickness, cch_text.c_str()); + //add text item + addCCItem(cch_text_obj); //text + } + + //set header text properties + if (cch_text_obj){ + cch_text_obj->setTextFont(cch_font); + cch_text_obj->setTextColor(cch_col_text); + cch_text_obj->setColorBody(col_body); + cch_text_obj->doPaintBg(false); + + //corner of text item + cch_text_obj->setCornerRadius(corner_rad-fr_thickness); + cch_text_obj->setCornerType(corner_type); + } } void CComponentsHeader::initCCHItems() { -#if 0 - //clean up first possible old item objects, includes delete and clean up vector - clearCCItems(); -#endif - //init icon initCCHeaderIcon(); @@ -246,22 +291,13 @@ void CComponentsHeader::initCCHItems() //init buttons initCCHeaderButtons(); - - //add elements - if (cch_icon_obj) - addCCItem(cch_icon_obj); //icon - if (cch_text_obj) - addCCItem(cch_text_obj); //text - if (cch_btn_obj) - addCCItem(cch_btn_obj); //buttons - } void CComponentsHeader::paint(bool do_save_bg) { - //paint body - paintInit(do_save_bg); - - //paint - paintCCItems(); + //prepare items + initCCHItems(); + + //paint form contents + paintForm(do_save_bg); } diff --git a/src/gui/components/cc_frm_icons.cpp b/src/gui/components/cc_frm_icons.cpp index 503cb57c0..fe79d9495 100644 --- a/src/gui/components/cc_frm_icons.cpp +++ b/src/gui/components/cc_frm_icons.cpp @@ -40,6 +40,7 @@ CComponentsIconForm::CComponentsIconForm() initVarIconForm(); } + CComponentsIconForm::CComponentsIconForm(const int x_pos, const int y_pos, const int w, const int h, const std::vector v_icon_names, bool has_shadow, fb_pixel_t color_frame, fb_pixel_t color_body, fb_pixel_t color_shadow) { @@ -111,9 +112,8 @@ int CComponentsIconForm::getIconId(const std::string& icon_name) //to remove old items before add new icons, otherwise icons will be appended. void CComponentsIconForm::removeAllIcons() { - if (!v_icons.empty()) - v_icons.clear(); clearCCItems(); + v_icons.clear(); } //get maximal form height depends of biggest icon height, but don't touch defined form height @@ -128,9 +128,6 @@ void CComponentsIconForm::initMaxHeight(int *pheight) void CComponentsIconForm::initCCIcons() { - //clean up first possible old item objects, includes delete and clean up vector and icons - clearCCItems(); - int ccp_y = 0; int ccp_h = 0; int ccp_w = 0; @@ -156,8 +153,7 @@ void CComponentsIconForm::initCCIcons() for (size_t i= 0; i< i_cnt; i++){ //create new cc-picture item object - CComponentsPicture *ccp = NULL; - ccp = new CComponentsPicture(ccp_x, ccp_y, ccp_w, h, v_icons[i]); + CComponentsPicture *ccp = new CComponentsPicture(ccp_x, ccp_y, ccp_w, h, v_icons[i]); ccp->setPictureAlign(CC_ALIGN_HOR_CENTER | CC_ALIGN_VER_CENTER); ccp->doPaintBg(false); //add item to form @@ -195,10 +191,7 @@ void CComponentsIconForm::paint(bool do_save_bg) { //init and add icons initCCIcons(); - - //paint body - paintInit(do_save_bg); - - //paint - paintCCItems(); + + //paint form contents + paintForm(do_save_bg); } diff --git a/src/gui/components/cc_frm_window.cpp b/src/gui/components/cc_frm_window.cpp index 1ed996f6d..b5db85d0d 100644 --- a/src/gui/components/cc_frm_window.cpp +++ b/src/gui/components/cc_frm_window.cpp @@ -44,8 +44,9 @@ CComponentsWindow::CComponentsWindow() CComponentsWindow::~CComponentsWindow() { - if (ccw_head) - delete ccw_head; +#ifdef DEBUG_CC + printf("[~CComponentsWindow] [%s - %d] delete...\n", __FUNCTION__, __LINE__); +#endif cleanCCForm(); } @@ -75,25 +76,29 @@ void CComponentsWindow::setWindowCaption(neutrino_locale_t locale_text) void CComponentsWindow::initHeader() { - if (ccw_head){ - delete ccw_head; - ccw_head = NULL; - } - ccw_head = new CComponentsHeader(); + if (ccw_head == NULL){ + ccw_head = new CComponentsHeader(); + initHeader(); + //add header item only one time + addCCItem(ccw_head); + } - ccw_head->setXPos(0); - ccw_head->setYPos(0); - ccw_head->setWidth(width); - ccw_head->setHeaderIcon(ccw_icon_name); - ccw_head->setHeaderText(ccw_caption); + //set header properties + if (ccw_head){ + ccw_head->setXPos(0); + ccw_head->setYPos(0); + ccw_head->setWidth(width); + ccw_head->setHeaderIcon(ccw_icon_name); + ccw_head->setHeaderText(ccw_caption); + } } void CComponentsWindow::initCCWItems() { +#ifdef DEBUG_CC + printf("[CComponentsWindow] [%s - %d] init items...\n", __FUNCTION__, __LINE__); +#endif initHeader(); - - if (ccw_head) - addCCItem(ccw_head); } void CComponentsWindow::paint(bool do_save_bg) @@ -101,9 +106,6 @@ void CComponentsWindow::paint(bool do_save_bg) //prepare items before paint initCCWItems(); - //paint body - paintInit(do_save_bg); - - //paint - paintCCItems(); + //paint form contents + paintForm(do_save_bg); } From 544e3bb8efc461221b96d625e9b7d3ea460d6060 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Thu, 14 Mar 2013 15:24:54 +0100 Subject: [PATCH 175/224] CComponentsHeader: init text always before paint header --- src/gui/components/cc_frm_header.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/gui/components/cc_frm_header.cpp b/src/gui/components/cc_frm_header.cpp index 23a3178d5..4b6460885 100644 --- a/src/gui/components/cc_frm_header.cpp +++ b/src/gui/components/cc_frm_header.cpp @@ -263,13 +263,15 @@ void CComponentsHeader::initCCHeaderText() #ifdef DEBUG_CC printf(" [CComponentsHeader]\n [%s - %d] init header text: %s\n", __FUNCTION__, __LINE__, cch_text.c_str()); #endif - cch_text_obj = new CComponentsText(cch_text_x, cch_items_y, width-cch_icon_w-fr_thickness, height-2*fr_thickness, cch_text.c_str()); + cch_text_obj = new CComponentsText(cch_text_x, cch_items_y, width-cch_icon_w-fr_thickness, height-2*fr_thickness/*, cch_text.c_str()*/); //add text item addCCItem(cch_text_obj); //text } //set header text properties if (cch_text_obj){ + cch_text_obj->setText(cch_text); + cch_text_obj->setTextMode(CTextBox::AUTO_WIDTH); cch_text_obj->setTextFont(cch_font); cch_text_obj->setTextColor(cch_col_text); cch_text_obj->setColorBody(col_body); From 2b41601d112b226c0ca73917818480c49f946152 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Thu, 14 Mar 2013 15:32:20 +0100 Subject: [PATCH 176/224] CTestMenu: modifie some samples to call header --- src/gui/test_menu.cpp | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/src/gui/test_menu.cpp b/src/gui/test_menu.cpp index dce736483..e9c681e1c 100644 --- a/src/gui/test_menu.cpp +++ b/src/gui/test_menu.cpp @@ -428,11 +428,11 @@ int CTestMenu::exec(CMenuTarget* parent, const std::string &actionKey) int hh = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]->getHeight(); if (header == NULL){ header = new CComponentsHeader (100, 50, 500, hh, "Test-Header", NEUTRINO_ICON_INFO, CComponentsHeader::CC_BTN_HELP | CComponentsHeader::CC_BTN_EXIT | CComponentsHeader::CC_BTN_MENU); -// header->addHeaderButton(NEUTRINO_ICON_BUTTON_RED); + header->addHeaderButton(NEUTRINO_ICON_BUTTON_RED); } // else //For existing instances it's recommended // //to remove old button icons before add new buttons, otherwise icons will be appended. -// header->removeHeaderButtons(); +// header->removeHeaderButtons(); // example to manipulate header items // header->setFrameThickness(5); @@ -440,22 +440,23 @@ int CTestMenu::exec(CMenuTarget* parent, const std::string &actionKey) // header->setCornerType(CORNER_TOP); // change text of header -// header->setHeaderText("Test"); + header->setHeaderText("Test"); // add any other button icon -// header->addHeaderButton(NEUTRINO_ICON_BUTTON_RED); +// header->addHeaderButton(NEUTRINO_ICON_BUTTON_BLUE); +// header->addHeaderButton(NEUTRINO_ICON_BUTTON_GREEN); // example to replace the text item with an image item // get text x position - int logo_x = header->getCCItem(CComponentsHeader::CC_HEADER_ITEM_TEXT)->getXPos(); +// int logo_x = header->getCCItem(CComponentsHeader::CC_HEADER_ITEM_TEXT)->getXPos(); // remove text item - header->removeCCItem(CComponentsHeader::CC_HEADER_ITEM_TEXT); //then remove text item +// header->removeCCItem(CComponentsHeader::CC_HEADER_ITEM_TEXT); //then remove text item // create picture object with the last x position of text - CComponentsPicture *logo = new CComponentsPicture(logo_x, 0, 100, g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]->getHeight(), "/share/tuxbox/neutrino/icons/hint_tvmode.png"); +// CComponentsPicture *logo = new CComponentsPicture(logo_x, 0, 100, g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]->getHeight(), "/share/tuxbox/neutrino/icons/hint_tvmode.png"); // set the transparent background for picture item - logo->doPaintBg(false); +// logo->doPaintBg(false); // insert the ne object - header->insertCCItem(1, logo); //replace text with logo +// header->insertCCItem(1, logo); //replace text with logo if (!header->isPainted()) From d87d0754e0cebe343c48df3ce7f28823cb3771d0 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Thu, 14 Mar 2013 16:53:38 +0100 Subject: [PATCH 177/224] CComponentsWindow: add constructors with parameters for caption and icon --- src/gui/components/cc.h | 2 ++ src/gui/components/cc_frm_window.cpp | 16 ++++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/src/gui/components/cc.h b/src/gui/components/cc.h index 8ba52e366..20dee898b 100644 --- a/src/gui/components/cc.h +++ b/src/gui/components/cc.h @@ -514,6 +514,8 @@ class CComponentsWindow : public CComponentsForm CC_WINDOW_ITEM_HEADER = 0 }; CComponentsWindow(); + CComponentsWindow(const std::string& caption, const char* iconname = NULL); + CComponentsWindow(neutrino_locale_t locale_caption, const char* iconname = NULL); ~CComponentsWindow(); void paint(bool do_save_bg = CC_SAVE_SCREEN_YES); diff --git a/src/gui/components/cc_frm_window.cpp b/src/gui/components/cc_frm_window.cpp index b5db85d0d..dad85cff5 100644 --- a/src/gui/components/cc_frm_window.cpp +++ b/src/gui/components/cc_frm_window.cpp @@ -42,6 +42,22 @@ CComponentsWindow::CComponentsWindow() initVarWindow(); } +CComponentsWindow::CComponentsWindow(const std::string& caption, const char* iconname) +{ + initVarWindow(); + + ccw_caption = caption; + ccw_icon_name = iconname; +} + +CComponentsWindow::CComponentsWindow(neutrino_locale_t locale_caption, const char* iconname) +{ + initVarWindow(); + + ccw_caption = g_Locale->getText(locale_caption); + ccw_icon_name = iconname; +} + CComponentsWindow::~CComponentsWindow() { #ifdef DEBUG_CC From 69476903ee126250b4eae7105ad74f40cf0f5285 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Thu, 14 Mar 2013 22:00:29 +0100 Subject: [PATCH 178/224] CComponentsForm/PIP: ensure hiding of minitv during hide of forms Handling of minitv items are different to other item types and need an explizit call of hide(). So it is possible to hide a form- object without a extra call of hide() for minitv objects. --- src/gui/components/cc_frm.cpp | 10 ++++++++++ src/gui/components/cc_item_tvpig.cpp | 10 +++++----- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/src/gui/components/cc_frm.cpp b/src/gui/components/cc_frm.cpp index 9e241cfc6..d6d40efda 100644 --- a/src/gui/components/cc_frm.cpp +++ b/src/gui/components/cc_frm.cpp @@ -281,6 +281,16 @@ void CComponentsForm::paintCCItems() void CComponentsForm::hide(bool no_restore) { + // hack: ensure hiding of minitv during hide of forms and inherited classes, + // because the handling of minitv items are different to other item types + // and need an explizit call of hide() + for(size_t i=0; igetItemType() == CComponentsItem::CC_ITEMTYPE_PIP){ + v_cc_items[i]->hide(); + break; + } + } + //hide body hideCCItem(no_restore); } diff --git a/src/gui/components/cc_item_tvpig.cpp b/src/gui/components/cc_item_tvpig.cpp index dffd857b3..a94e9cd4d 100644 --- a/src/gui/components/cc_item_tvpig.cpp +++ b/src/gui/components/cc_item_tvpig.cpp @@ -64,10 +64,10 @@ CComponentsPIP::CComponentsPIP( const int x_pos, const int y_pos, const int perc CComponentsPIP::~CComponentsPIP() { - hide(); - clearSavedScreen(); - clear(); - videoDecoder->Pig(-1, -1, -1, -1); + hide(); + videoDecoder->Pig(-1, -1, -1, -1); + clearSavedScreen(); + clear(); } void CComponentsPIP::paint(bool do_save_bg) @@ -79,6 +79,6 @@ void CComponentsPIP::paint(bool do_save_bg) void CComponentsPIP::hide(bool no_restore) { - hideCCItem(no_restore); videoDecoder->Pig(-1, -1, -1, -1); + hideCCItem(no_restore); } From c17e2e5d6ca34397d1c7f141e3d5cc8e51f6600a Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Thu, 14 Mar 2013 22:20:47 +0100 Subject: [PATCH 179/224] CTestMenu: remove minitv sample Can not be displayed here nicely. --- src/gui/test_menu.cpp | 13 ------------- src/gui/test_menu.h | 1 - 2 files changed, 14 deletions(-) diff --git a/src/gui/test_menu.cpp b/src/gui/test_menu.cpp index e9c681e1c..b714c5f22 100644 --- a/src/gui/test_menu.cpp +++ b/src/gui/test_menu.cpp @@ -65,7 +65,6 @@ CTestMenu::CTestMenu() circle = NULL; sq = NULL; pic= NULL; - pip = NULL; form = NULL; txt = NULL; header = NULL; @@ -78,7 +77,6 @@ CTestMenu::~CTestMenu() delete sq; delete circle; delete pic; - delete pip; delete form; delete txt; delete header; @@ -360,16 +358,6 @@ int CTestMenu::exec(CMenuTarget* parent, const std::string &actionKey) pic->hide(); return res; } - else if (actionKey == "pip"){ - if (pip == NULL) - pip = new CComponentsPIP (100, 100, 25); - - if (!pip->isPainted()) - pip->paint(); - else - pip->hide(); - return res; - } else if (actionKey == "form"){ if (form == NULL) form = new CComponentsForm(); @@ -564,7 +552,6 @@ void CTestMenu::showCCTests(CMenuWidget *widget) widget->addItem(new CMenuForwarderNonLocalized("Circle", true, NULL, this, "circle")); widget->addItem(new CMenuForwarderNonLocalized("Square", true, NULL, this, "square")); widget->addItem(new CMenuForwarderNonLocalized("Picture", true, NULL, this, "picture")); - widget->addItem(new CMenuForwarderNonLocalized("PiP", true, NULL, this, "pip")); widget->addItem(new CMenuForwarderNonLocalized("Form", true, NULL, this, "form")); widget->addItem(new CMenuForwarderNonLocalized("Text", true, NULL, this, "text")); widget->addItem(new CMenuForwarderNonLocalized("Header", true, NULL, this, "header")); diff --git a/src/gui/test_menu.h b/src/gui/test_menu.h index 7e7fa47f9..9b6bf40f4 100644 --- a/src/gui/test_menu.h +++ b/src/gui/test_menu.h @@ -42,7 +42,6 @@ class CTestMenu : public CMenuTarget CComponentsShapeCircle * circle; CComponentsShapeSquare* sq; CComponentsPicture* pic; - CComponentsPIP* pip; CComponentsForm *form; CComponentsText *txt; CComponentsHeader *header; From ca42d9ba747a79fddaead3ed28f407d84391446d Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Fri, 15 Mar 2013 22:55:45 +0100 Subject: [PATCH 180/224] CComponentsHeader/Window: add possibility to return header height --- src/gui/components/cc.h | 9 ++++-- src/gui/components/cc_frm_header.cpp | 45 ++++++++++++++++++---------- src/gui/components/cc_frm_window.cpp | 17 ++++++++--- 3 files changed, 48 insertions(+), 23 deletions(-) diff --git a/src/gui/components/cc.h b/src/gui/components/cc.h index 20dee898b..595037e5a 100644 --- a/src/gui/components/cc.h +++ b/src/gui/components/cc.h @@ -198,8 +198,8 @@ class CComponentsText : public CComponentsItem virtual inline void setTextFont(Font* font_text){ct_font = font_text;}; virtual inline void setTextColor(fb_pixel_t color_text){ ct_col_text = color_text;}; virtual inline void setTextMode(const int mode){ct_text_mode = mode;};//see textbox.h for possible modes - virtual inline void setText(const char* ctext, const int mode = ~CTextBox::AUTO_WIDTH, Font* font_text = NULL){ct_text = ctext; ct_text_mode = mode, ct_font = font_text;}; - virtual inline void setText(const std::string& stext, const int mode = ~CTextBox::AUTO_WIDTH, Font* font_text = NULL){ct_text = stext.c_str(); ct_text_mode = mode, ct_font = font_text;}; + virtual void setText(const char* ctext, const int mode = ~CTextBox::AUTO_WIDTH, Font* font_text = NULL); + virtual void setText(const std::string& stext, const int mode = ~CTextBox::AUTO_WIDTH, Font* font_text = NULL); virtual void setText(neutrino_locale_t locale_text, const int mode = ~CTextBox::AUTO_WIDTH, Font* font_text = NULL); virtual void removeLineBreaks(std::string& str); }; @@ -454,7 +454,6 @@ class CComponentsHeader : public CComponentsForm void initCCHeaderIcon(); void initCCHeaderText(); void initCCHeaderButtons(); - void initCCHItems(); void initCCHDefaultButtons(); void initCCButtonFormSize(); @@ -493,6 +492,7 @@ class CComponentsHeader : public CComponentsForm void addHeaderButton(const std::string& button_name); void removeHeaderButtons(); void setHeaderButtons(const int buttons){cch_buttons = buttons;}; + void initCCHeaderItems(); }; class CComponentsWindow : public CComponentsForm @@ -501,6 +501,7 @@ class CComponentsWindow : public CComponentsForm CComponentsHeader * ccw_head; std::string ccw_caption; const char* ccw_icon_name; + int ccw_start_y; void initHeader(); void initCCWItems(); @@ -522,6 +523,8 @@ class CComponentsWindow : public CComponentsForm void setWindowCaption(const std::string& text){ccw_caption = text;}; void setWindowCaption(neutrino_locale_t locale_text); void setWindowIcon(const char* iconname){ccw_icon_name = iconname;}; + + int getStartY(); //y value for start of the area below header }; #endif diff --git a/src/gui/components/cc_frm_header.cpp b/src/gui/components/cc_frm_header.cpp index 4b6460885..ef2f38639 100644 --- a/src/gui/components/cc_frm_header.cpp +++ b/src/gui/components/cc_frm_header.cpp @@ -61,7 +61,7 @@ CComponentsHeader::CComponentsHeader( const int x_pos, const int y_pos, const in cch_icon_name = icon_name; cch_buttons = buttons; initCCHDefaultButtons(); - initCCHItems(); + initCCHeaderItems(); } CComponentsHeader::CComponentsHeader( const int x_pos, const int y_pos, const int w, const int h, neutrino_locale_t caption_locale, const char* icon_name, const int buttons, bool has_shadow, @@ -84,13 +84,23 @@ CComponentsHeader::CComponentsHeader( const int x_pos, const int y_pos, const in cch_buttons = buttons; initCCHDefaultButtons(); - initCCHItems(); + initCCHeaderItems(); } void CComponentsHeader::initVarHeader() { - //CComponentsHeader + //CComponentsForm + initVarForm(); + cc_item_type = CC_ITEMTYPE_FRM_HEADER; + col_body = COL_MENUHEAD_PLUS_0; + corner_rad = RADIUS_LARGE, + corner_type = CORNER_TOP; + + //init header height cch_font = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]; + height = cch_font->getHeight(); + + //CComponentsHeader cch_icon_obj = NULL; cch_text_obj = NULL; cch_icon_name = NULL; @@ -107,13 +117,7 @@ void CComponentsHeader::initVarHeader() cch_btn_offset = 8; v_cch_btn.clear(); - //CComponentsForm - initVarForm(); - cc_item_type = CC_ITEMTYPE_FRM_HEADER; - height = cch_font->getHeight(); - col_body = COL_MENUHEAD_PLUS_0; - corner_rad = RADIUS_LARGE, - corner_type = CORNER_TOP; + } CComponentsHeader::~CComponentsHeader() @@ -182,6 +186,9 @@ void CComponentsHeader::initCCHeaderIcon() //set width of icon object cch_icon_w = cch_icon_obj->getWidth(); + + //adapt height + height = max(height, cch_icon_obj->getHeight()); } } @@ -250,6 +257,7 @@ void CComponentsHeader::initCCHeaderButtons() cch_btn_obj->setIconAlign(CComponentsIconForm::CC_ICONS_FRM_ALIGN_RIGHT); cch_btn_obj->removeAllIcons(); cch_btn_obj->addIcon(v_cch_btn); + height = max(height, cch_btn_obj->getHeight()); } } @@ -263,27 +271,32 @@ void CComponentsHeader::initCCHeaderText() #ifdef DEBUG_CC printf(" [CComponentsHeader]\n [%s - %d] init header text: %s\n", __FUNCTION__, __LINE__, cch_text.c_str()); #endif - cch_text_obj = new CComponentsText(cch_text_x, cch_items_y, width-cch_icon_w-fr_thickness, height-2*fr_thickness/*, cch_text.c_str()*/); + cch_text_obj = new CComponentsText(); //add text item addCCItem(cch_text_obj); //text } //set header text properties if (cch_text_obj){ - cch_text_obj->setText(cch_text); - cch_text_obj->setTextMode(CTextBox::AUTO_WIDTH); - cch_text_obj->setTextFont(cch_font); + cch_text_obj->setText(cch_text, CTextBox::AUTO_WIDTH, cch_font); + cch_text_obj->setDimensionsAll(cch_text_x, cch_items_y, width-cch_icon_w-fr_thickness, height-2*fr_thickness); +// cch_text_obj->setTextFont(cch_font) cch_text_obj->setTextColor(cch_col_text); +// cch_text_obj->setTextMode(CTextBox::AUTO_WIDTH); + cch_text_obj->setColorBody(col_body); cch_text_obj->doPaintBg(false); //corner of text item cch_text_obj->setCornerRadius(corner_rad-fr_thickness); cch_text_obj->setCornerType(corner_type); + + //get height + height = max(height, cch_text_obj->getHeight()); } } -void CComponentsHeader::initCCHItems() +void CComponentsHeader::initCCHeaderItems() { //init icon initCCHeaderIcon(); @@ -298,7 +311,7 @@ void CComponentsHeader::initCCHItems() void CComponentsHeader::paint(bool do_save_bg) { //prepare items - initCCHItems(); + initCCHeaderItems(); //paint form contents paintForm(do_save_bg); diff --git a/src/gui/components/cc_frm_window.cpp b/src/gui/components/cc_frm_window.cpp index dad85cff5..d62deecd5 100644 --- a/src/gui/components/cc_frm_window.cpp +++ b/src/gui/components/cc_frm_window.cpp @@ -71,16 +71,17 @@ void CComponentsWindow::initVarWindow() //CComponentsForm initVarForm(); cc_item_type = CC_ITEMTYPE_FRM_WINDOW; - - ccw_head = NULL; - ccw_caption = ""; - ccw_icon_name = NULL; //using current screen settings for default dimensions width = frameBuffer->getScreenWidth(); height = frameBuffer->getScreenHeight(); x=getScreenStartX(width); y=getScreenStartY(height); + + ccw_head = NULL; + ccw_caption = ""; + ccw_icon_name = NULL; + ccw_start_y = 0; setShadowOnOff(true); } @@ -106,9 +107,17 @@ void CComponentsWindow::initHeader() ccw_head->setWidth(width); ccw_head->setHeaderIcon(ccw_icon_name); ccw_head->setHeaderText(ccw_caption); + ccw_head->initCCHeaderItems(); + ccw_start_y = ccw_head->getHeight(); } } +int CComponentsWindow::getStartY() +{ + initHeader(); + return ccw_start_y; +} + void CComponentsWindow::initCCWItems() { #ifdef DEBUG_CC From eee2cd0d41b4df04121913667cca7fd0606b2fc0 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Fri, 15 Mar 2013 22:58:55 +0100 Subject: [PATCH 181/224] CComponentsText: move overloaded setText() from header into main file --- src/gui/components/cc_item_text.cpp | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/src/gui/components/cc_item_text.cpp b/src/gui/components/cc_item_text.cpp index c5eff67e1..74f726976 100644 --- a/src/gui/components/cc_item_text.cpp +++ b/src/gui/components/cc_item_text.cpp @@ -104,7 +104,7 @@ void CComponentsText::initCCText() height = max(height, ct_font->getHeight()); //text box dimensions - if (ct_box){ + if (ct_box== NULL){ //ensure that we have a new instance delete ct_box; ct_box = NULL; @@ -134,6 +134,9 @@ void CComponentsText::initCCText() //set text string new_text = static_cast (ct_text); ct_text_sent = ct_textbox->setText(&new_text, ct_box->iWidth); +#ifdef DEBUG_CC + printf(" [CComponentsText] [%s - %d] init text: %s [x %d, y %d, h %d, w %d]\n", __FUNCTION__, __LINE__, ct_text, ct_box->iX, ct_box->iY, height, width); +#endif } void CComponentsText::clearCCText() @@ -152,6 +155,23 @@ void CComponentsText::setText(neutrino_locale_t locale_text, int mode, Font* fon ct_text = g_Locale->getText(locale_text); ct_text_mode = mode; ct_font = font_text; + +} + +void CComponentsText::setText(const char* ctext, const int mode, Font* font_text) +{ + ct_text = ctext; + ct_text_mode = mode; + ct_font = font_text; + +} + +void CComponentsText::setText(const std::string& stext, const int mode, Font* font_text) +{ + ct_text = stext.c_str(); + ct_text_mode = mode; + ct_font = font_text; + } void CComponentsText::paintText(bool do_save_bg) @@ -165,7 +185,6 @@ void CComponentsText::paintText(bool do_save_bg) void CComponentsText::paint(bool do_save_bg) { - paintText(do_save_bg); } From 824bc8913e71309b28c92ebc5c639bc356a8cdf5 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Fri, 15 Mar 2013 23:00:29 +0100 Subject: [PATCH 182/224] CComponentsHeader: remove unused lines --- src/gui/components/cc_frm_header.cpp | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/gui/components/cc_frm_header.cpp b/src/gui/components/cc_frm_header.cpp index ef2f38639..a189cd055 100644 --- a/src/gui/components/cc_frm_header.cpp +++ b/src/gui/components/cc_frm_header.cpp @@ -280,10 +280,7 @@ void CComponentsHeader::initCCHeaderText() if (cch_text_obj){ cch_text_obj->setText(cch_text, CTextBox::AUTO_WIDTH, cch_font); cch_text_obj->setDimensionsAll(cch_text_x, cch_items_y, width-cch_icon_w-fr_thickness, height-2*fr_thickness); -// cch_text_obj->setTextFont(cch_font) cch_text_obj->setTextColor(cch_col_text); -// cch_text_obj->setTextMode(CTextBox::AUTO_WIDTH); - cch_text_obj->setColorBody(col_body); cch_text_obj->doPaintBg(false); From 2f5404d2fa85dc0493d78c88134470b8c913542a Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Sun, 17 Mar 2013 13:05:11 +0100 Subject: [PATCH 183/224] CComponentsLabel: add new sub class CComponentsLabel --- src/gui/components/cc.h | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/gui/components/cc.h b/src/gui/components/cc.h index 595037e5a..05dbd6249 100644 --- a/src/gui/components/cc.h +++ b/src/gui/components/cc.h @@ -190,7 +190,7 @@ class CComponentsText : public CComponentsItem const char* text = "", const int mode = CTextBox::AUTO_WIDTH, Font* font_text = NULL, bool has_shadow = CC_SHADOW_OFF, fb_pixel_t color_text = COL_MENUCONTENT, fb_pixel_t color_frame = COL_MENUCONTENT_PLUS_6, fb_pixel_t color_body = COL_MENUCONTENT_PLUS_0, fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0); - ~CComponentsText(); + virtual ~CComponentsText(); void hide(bool no_restore = false); void paint(bool do_save_bg = CC_SAVE_SCREEN_YES); @@ -204,6 +204,21 @@ class CComponentsText : public CComponentsItem virtual void removeLineBreaks(std::string& str); }; +class CComponentsLabel : public CComponentsText +{ + public: + CComponentsLabel( const int x_pos, const int y_pos, const int w, const int h, + const char* text = "", const int mode = CTextBox::AUTO_WIDTH, Font* font_text = NULL, + bool has_shadow = CC_SHADOW_OFF, + fb_pixel_t color_text = COL_MENUCONTENTINACTIVE, fb_pixel_t color_frame = COL_MENUCONTENT_PLUS_6, fb_pixel_t color_body = COL_MENUCONTENT_PLUS_0, fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0) + :CComponentsText(x_pos, y_pos, w, h, text, mode, font_text, has_shadow, color_text, color_frame, color_body, color_shadow){}; + CComponentsLabel():CComponentsText() + { + initVarText(); + ct_col_text = COL_MENUCONTENTINACTIVE; + }; +}; + #define INFO_BOX_Y_OFFSET 2 class CComponentsInfoBox : public CComponentsText { From 98b326571905477dc1f703393f9ac1bc784323d4 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Mon, 18 Mar 2013 10:10:02 +0100 Subject: [PATCH 184/224] Data files: add license files Avoids hard coded parts e.g. for use mainly in image info. --- configure.ac | 1 + data/Makefile.am | 2 +- data/license/Makefile.am | 5 +++++ data/license/deutsch.license | 16 ++++++++++++++++ data/license/english.license | 14 ++++++++++++++ 5 files changed, 37 insertions(+), 1 deletion(-) create mode 100644 data/license/Makefile.am create mode 100644 data/license/deutsch.license create mode 100644 data/license/english.license diff --git a/configure.ac b/configure.ac index 0e7a39895..d302b1a16 100644 --- a/configure.ac +++ b/configure.ac @@ -187,6 +187,7 @@ data/iso-codes/Makefile data/lcd/Makefile data/lcd/icons/Makefile data/lcd/clock/Makefile +data/license/Makefile data/locale/Makefile data/scripts/Makefile data/themes/Makefile diff --git a/data/Makefile.am b/data/Makefile.am index 468993836..fd215a996 100644 --- a/data/Makefile.am +++ b/data/Makefile.am @@ -1,4 +1,4 @@ -SUBDIRS = fonts icons inetradio iso-codes locale scripts themes +SUBDIRS = fonts icons inetradio iso-codes license locale scripts themes if BOXTYPE_TRIPLE SUBDIRS += lcd diff --git a/data/license/Makefile.am b/data/license/Makefile.am new file mode 100644 index 000000000..d8d198554 --- /dev/null +++ b/data/license/Makefile.am @@ -0,0 +1,5 @@ +installdir = $(DATADIR)/neutrino/license + +install_DATA = \ + deutsch.license \ + english.license diff --git a/data/license/deutsch.license b/data/license/deutsch.license new file mode 100644 index 000000000..b21882463 --- /dev/null +++ b/data/license/deutsch.license @@ -0,0 +1,16 @@ +Dieses Programm ist freie Software. Sie können es unter den Bedingungen +der GNU General Public License, wie von der Free Software Foundation +veröffentlicht, weitergeben und/oder modifizieren, +entweder gemäß Version 2 der Lizenz +oder (nach Ihrer Option) jeder späteren Version. + +Die Veröffentlichung dieses Programms erfolgt in der Hoffnung, +daß es Ihnen von Nutzen sein wird, aber OHNE IRGENDEINE GARANTIE, +sogar ohne die implizite Garantie der +MARKTREIFE oder der VERWENDBARKEIT FÜR EINEN BESTIMMTEN ZWECK. +Details finden Sie in der GNU General Public License. + +Sie sollten ein Exemplar der GNU General Public License zusammen +mit diesem Programm erhalten haben. Falls nicht, schreiben Sie an +die Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, +Boston, MA 02110, USA. diff --git a/data/license/english.license b/data/license/english.license new file mode 100644 index 000000000..5356a7f4a --- /dev/null +++ b/data/license/english.license @@ -0,0 +1,14 @@ +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +Boston, MA 02110-1301, USA. From 0fa2bbc7c9ed6aed9524d925e6507cb09d578691 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Mon, 18 Mar 2013 10:16:24 +0100 Subject: [PATCH 185/224] CComponentsInfoBox: delete clean textbox object before create new object Ensures a clean environment for changed properties of a textbox in infobox. --- src/gui/components/cc_item_infobox.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/gui/components/cc_item_infobox.cpp b/src/gui/components/cc_item_infobox.cpp index adc92c5eb..d8c248118 100644 --- a/src/gui/components/cc_item_infobox.cpp +++ b/src/gui/components/cc_item_infobox.cpp @@ -123,8 +123,10 @@ void CComponentsInfoBox::paint(bool do_save_bg) //set text and paint text lines if (ct_text){ - if (cctext == NULL) - cctext = new CComponentsText(); + if (cctext) + delete cctext; + + cctext = new CComponentsText(); cctext->setText(ct_text, ct_text_mode, ct_font); cctext->setDimensionsAll(x_text, y+fr_thickness, width-(x_text-x+x_offset+fr_thickness), height-2*fr_thickness); cctext->paint(CC_SAVE_SCREEN_NO); From 259b58c829d1c53f5e455a33821bd1c6bd628131 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Mon, 18 Mar 2013 10:22:26 +0100 Subject: [PATCH 186/224] CComponentsInfoBox: add NULL as default parameter for info_text It's better to handel with NULL. make clearCCItems() public and virtual so it can be used in window objects --- src/gui/components/cc.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/gui/components/cc.h b/src/gui/components/cc.h index 05dbd6249..5f6618d77 100644 --- a/src/gui/components/cc.h +++ b/src/gui/components/cc.h @@ -33,7 +33,7 @@ #include #include -#define DEBUG_CC +// #define DEBUG_CC class CComponents { @@ -235,7 +235,7 @@ class CComponentsInfoBox : public CComponentsText public: CComponentsInfoBox(); CComponentsInfoBox( const int x_pos, const int y_pos, const int w, const int h, - const char* info_text = "", const int mode = CTextBox::AUTO_WIDTH, Font* font_text = NULL, + const char* info_text = NULL, const int mode = CTextBox::AUTO_WIDTH, Font* font_text = NULL, bool has_shadow = CC_SHADOW_OFF, fb_pixel_t color_text = COL_MENUCONTENT, fb_pixel_t color_frame = COL_MENUCONTENT_PLUS_6, fb_pixel_t color_body = COL_MENUCONTENT_PLUS_0, fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0); @@ -391,7 +391,6 @@ class CComponentsForm : public CComponentsItem protected: std::vector v_cc_items; void initVarForm(); - void clearCCItems(); void paintForm(bool do_save_bg); public: @@ -410,6 +409,7 @@ class CComponentsForm : public CComponentsItem virtual int getCCItemId(CComponentsItem* cc_Item); virtual CComponentsItem* getCCItem(const uint& cc_item_id); virtual void paintCCItems(); + virtual void clearCCItems(); virtual void cleanCCForm(); }; From ab00522900f94b7955a6335bf9a3e912ca6a4c2d Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Tue, 19 Mar 2013 07:57:34 +0100 Subject: [PATCH 187/224] CComponents: fix build, fb_pixel_t and neutrino_locale_t was missed --- src/gui/components/cc.h | 1 - src/gui/components/cc_types.h | 3 +++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/gui/components/cc.h b/src/gui/components/cc.h index 5f6618d77..4d49f9cf7 100644 --- a/src/gui/components/cc.h +++ b/src/gui/components/cc.h @@ -27,7 +27,6 @@ #define __COMPONENTS__ #include "cc_types.h" -#include #include #include #include diff --git a/src/gui/components/cc_types.h b/src/gui/components/cc_types.h index df2e53b48..32495657c 100644 --- a/src/gui/components/cc_types.h +++ b/src/gui/components/cc_types.h @@ -26,6 +26,9 @@ #ifndef __CC_TYPES__ #define __CC_TYPES__ +#include +#include + //required typedefs typedef struct comp_fbdata_t { From 7e1ef5d325a727a6bfe8294c194280020623a22f Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Tue, 19 Mar 2013 07:31:39 +0100 Subject: [PATCH 188/224] CProgressbarSetup: using unified 'osd' namespace --- src/gui/Makefile.am | 2 +- src/gui/{progressbar_setup.cpp => osd_progressbar_setup.cpp} | 5 +++-- src/gui/{progressbar_setup.h => osd_progressbar_setup.h} | 3 ++- src/gui/osd_setup.cpp | 2 +- 4 files changed, 7 insertions(+), 5 deletions(-) rename src/gui/{progressbar_setup.cpp => osd_progressbar_setup.cpp} (97%) rename src/gui/{progressbar_setup.h => osd_progressbar_setup.h} (92%) diff --git a/src/gui/Makefile.am b/src/gui/Makefile.am index 814773ccb..ed74a5892 100644 --- a/src/gui/Makefile.am +++ b/src/gui/Makefile.am @@ -73,6 +73,7 @@ libneutrino_gui_a_SOURCES = \ network_service.cpp \ network_setup.cpp \ nfs.cpp \ + osd_progressbar_setup.cpp \ osd_setup.cpp \ osdlang_setup.cpp \ parentallock_setup.cpp \ @@ -81,7 +82,6 @@ libneutrino_gui_a_SOURCES = \ pictureviewer_setup.cpp \ pluginlist.cpp \ plugins.cpp \ - progressbar_setup.cpp \ proxyserver_setup.cpp \ rc_lock.cpp \ record_setup.cpp \ diff --git a/src/gui/progressbar_setup.cpp b/src/gui/osd_progressbar_setup.cpp similarity index 97% rename from src/gui/progressbar_setup.cpp rename to src/gui/osd_progressbar_setup.cpp index 3ca86969e..78591453a 100644 --- a/src/gui/progressbar_setup.cpp +++ b/src/gui/osd_progressbar_setup.cpp @@ -19,7 +19,8 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. */ @@ -27,7 +28,7 @@ #include #endif -#include "progressbar_setup.h" +#include "osd_progressbar_setup.h" #include #include diff --git a/src/gui/progressbar_setup.h b/src/gui/osd_progressbar_setup.h similarity index 92% rename from src/gui/progressbar_setup.h rename to src/gui/osd_progressbar_setup.h index b650e9cb6..30dbe4625 100644 --- a/src/gui/progressbar_setup.h +++ b/src/gui/osd_progressbar_setup.h @@ -19,7 +19,8 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. */ diff --git a/src/gui/osd_setup.cpp b/src/gui/osd_setup.cpp index 4893b39c0..5c05215f3 100644 --- a/src/gui/osd_setup.cpp +++ b/src/gui/osd_setup.cpp @@ -43,7 +43,7 @@ #include "screensetup.h" #include "osdlang_setup.h" #include "filebrowser.h" -#include "progressbar_setup.h" +#include "osd_progressbar_setup.h" #include #include From 2387b27b7385740b5c88e1edf9fd185a50d4220c Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Tue, 19 Mar 2013 08:24:14 +0100 Subject: [PATCH 189/224] CImageInfo: implement CComponents TODO: - format of license text - button bar or header buttons ? --- src/gui/imageinfo.cpp | 339 +++++++++++++++++++++--------------------- src/gui/imageinfo.h | 60 ++++---- 2 files changed, 197 insertions(+), 202 deletions(-) diff --git a/src/gui/imageinfo.cpp b/src/gui/imageinfo.cpp index 3a68d900f..31f0052f2 100644 --- a/src/gui/imageinfo.cpp +++ b/src/gui/imageinfo.cpp @@ -1,6 +1,9 @@ /* - Neutrino-GUI - DBoxII-Project + Based up Neutrino-GUI - Tuxbox-Project + Copyright (C) 2001 by Steffen Hehn 'McClean' + Implementation of component classes + Copyright (C) 2013, Thilo Graf 'dbt' License: GPL @@ -14,9 +17,10 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the + Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, + Boston, MA 02110-1301, USA. */ #ifdef HAVE_CONFIG_H @@ -28,83 +32,45 @@ #include #include -#include #include -#include #include - +#include +#include +#include #include - #include -#include #include "git_version.h" #define GIT_DESC "GIT Desc.:" #define GIT_REV "GIT Build:" +#define LICENSEDIR DATADIR "/neutrino/license/" + +using namespace std; extern CRemoteControl * g_RemoteControl; /* neutrino.cpp */ -CImageInfo::CImageInfo() +CImageInfo::CImageInfo(): config ('\t') { Init(); } -static const neutrino_locale_t info_items[8] = -{ - LOCALE_IMAGEINFO_IMAGE, - LOCALE_IMAGEINFO_DATE, - LOCALE_IMAGEINFO_VERSION, - LOCALE_IMAGEINFO_CREATOR, - LOCALE_IMAGEINFO_HOMEPAGE, - LOCALE_IMAGEINFO_DOKUMENTATION, - LOCALE_IMAGEINFO_FORUM, - LOCALE_IMAGEINFO_LICENSE -}; - +//init all var members void CImageInfo::Init(void) { - frameBuffer = CFrameBuffer::getInstance(); - pip = NULL; - font_head = SNeutrinoSettings::FONT_TYPE_INFOBAR_CHANNAME;; - font_small = SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL; - font_info = SNeutrinoSettings::FONT_TYPE_MENU; - - hheight = g_Font[font_head]->getHeight(); - iheight = g_Font[font_info]->getHeight(); - sheight = g_Font[font_small]->getHeight(); - - max_width = frameBuffer->getScreenWidth(true); - max_height = frameBuffer->getScreenHeight(true); - - width = frameBuffer->getScreenWidth() - 10; - height = frameBuffer->getScreenHeight() - 10; - x=getScreenStartX( width ); - y=getScreenStartY( height ); - - // calculate max width of used LOCALES - offset = 0; - - for (int i = 0; i < 8; i++) { - int tmpoffset = g_Font[font_info]->getRenderWidth(g_Locale->getText (info_items[i])); - if (tmpoffset > offset) { - offset = tmpoffset; - } - } -#ifdef GITVERSION - int off_tmp = g_Font[font_info]->getRenderWidth(GIT_DESC); -#else - int off_tmp = g_Font[font_info]->getRenderWidth(GIT_REV); -#endif - if(off_tmp > offset) - offset = off_tmp; - - offset = offset + 15; + cc_win = NULL; + item_offset = 20; + item_top = item_offset; + license_txt = ""; + v_info.clear(); + v_info_supp.clear(); + config.loadConfig("/.version"); } CImageInfo::~CImageInfo() { - delete pip; + //deallocate window object, deletes also added cc_items + delete cc_win; } int CImageInfo::exec(CMenuTarget* parent, const std::string &) @@ -113,12 +79,8 @@ int CImageInfo::exec(CMenuTarget* parent, const std::string &) if (parent) parent->hide(); - width = frameBuffer->getScreenWidth() - 10; - height = frameBuffer->getScreenHeight() - 10; - x=getScreenStartX( width ); - y=getScreenStartY( height ); - - paint(); + //init window object and add cc_items + ShowWindow(); neutrino_msg_t msg; while (1) @@ -136,70 +98,83 @@ int CImageInfo::exec(CMenuTarget* parent, const std::string &) res = menu_return::RETURN_EXIT_ALL; break; } - else if (msg <= CRCInput::RC_MaxRC) - { + else if (msg <= CRCInput::RC_MaxRC){ break; } - if ( msg > CRCInput::RC_MaxRC && msg != CRCInput::RC_timeout) - { + if ( msg > CRCInput::RC_MaxRC && msg != CRCInput::RC_timeout){ CNeutrinoApp::getInstance()->handleMsg( msg, data ); } } - hide(); + //hide window + cc_win->hide(); + + //deallocate of the window object causes also deallocate added items, + delete cc_win; + //it's important to set here a null pointer + cc_win = NULL; return res; } -void CImageInfo::hide() +//contains all actions to init and add the window object and items +void CImageInfo::ShowWindow() { - pip->hide(true); - frameBuffer->paintBackground(); + if (cc_win == NULL){ + cc_win = new CComponentsWindow(LOCALE_IMAGEINFO_HEAD, NEUTRINO_ICON_INFO); + item_top = cc_win->getStartY() + item_offset; + } + + //prepare minitv: important! init the minitv object as first + InitMinitv(); + + //prepare infos + InitInfos(); + + //add section space + item_top += 5; + + //prepare suppoprt infos + InitSupportInfos(); + + //prepare license text + InitLicenseText(); + + //paint window + cc_win->paint(); } -void CImageInfo::paintLine(int xpos, int font, const char* text) +//prepare minitv +void CImageInfo::InitMinitv() { - char buf[100]; - snprintf((char*) buf,sizeof(buf), "%s", text); - //g_Font[font]->RenderString(xpos, ypos, width-10, buf, COL_MENUCONTENT, 0, true); - g_Font[font]->RenderString(xpos, ypos, width-10, buf, COL_INFOBAR, 0, true); + //init the minitv object + CComponentsPIP *cc_tv = new CComponentsPIP (0, item_top, 33/*%*/); + + //init x pos and use as parameter for setXPos + int cc_tv_x = (cc_win->getWidth() - cc_tv->getWidth()) - item_offset; + cc_tv->setXPos(cc_tv_x); + + //add minitv to container + cc_win->addCCItem(cc_tv); } -void CImageInfo::paint() +//prepare distribution infos +void CImageInfo::InitInfos() { - const char * head_string; - char imagedate[18] = ""; - int xpos = x+10; + v_info.clear(); - ypos = y+5; - - head_string = g_Locale->getText(LOCALE_IMAGEINFO_HEAD); - CVFD::getInstance()->setMode(CVFD::MODE_MENU_UTF8, head_string); - frameBuffer->paintBoxRel(0, 0, max_width, max_height, COL_INFOBAR_PLUS_0); - g_Font[font_head]->RenderString(xpos, ypos+ hheight+1, width, head_string, COL_MENUHEAD, 0, true); - - ypos += hheight; - ypos += (iheight >>1); - - CConfigFile config('\t'); - config.loadConfig("/.version"); - - const char * imagename = config.getString("imagename", "Neutrino-HD").c_str(); - const char * homepage = config.getString("homepage", "n/a").c_str(); - const char * creator = config.getString("creator", "n/a").c_str(); - const char * version = config.getString("version", "no version").c_str(); - const char * docs = config.getString("docs", "http://wiki.neutrino-hd.de").c_str(); - const char * forum = config.getString("forum", "http://forum.tuxbox.org").c_str(); #ifdef GITVERSION const char * builddate = GITVERSION; #else const char * builddate = config.getString("builddate", BUILT_DATE).c_str(); #endif + const char * version = config.getString("version", "no version").c_str(); + config.getString("version", "no version"); static CFlashVersionInfo versionInfo(version); const char * releaseCycle = versionInfo.getReleaseCycle(); - + struct utsname uts_info; std::string Version_Kernel; if( uname(&uts_info) < 0 ) { @@ -214,79 +189,99 @@ void CImageInfo::paint() Version_Kernel += uts_info.release; } - snprintf((char*) imagedate,sizeof(imagedate), "%s %s", versionInfo.getDate(), versionInfo.getTime()); + image_info_t imagename = {LOCALE_IMAGEINFO_IMAGE, config.getString("imagename", "Neutrino-HD")}; + v_info.push_back(imagename); + image_info_t date = {LOCALE_IMAGEINFO_DATE, builddate}; + v_info.push_back(date); + image_info_t kversion = {LOCALE_IMAGEINFO_VERSION, Version_Kernel}; + v_info.push_back(kversion); + image_info_t creator = {LOCALE_IMAGEINFO_CREATOR, config.getString("creator", "n/a")}; + v_info.push_back(creator); - ypos += iheight; - paintLine(xpos , font_info, g_Locale->getText(LOCALE_IMAGEINFO_IMAGE)); - paintLine(xpos+offset, font_info, imagename); + //create label and text items + for (size_t i = 0; i < v_info.size(); i++) { + CComponentsLabel *cc_txt = new CComponentsLabel(); + cc_txt->setDimensionsAll(item_offset, item_top, 200, g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getHeight()); + cc_txt->setText(v_info[i].caption, CTextBox::NO_AUTO_LINEBREAK, g_Font[SNeutrinoSettings::FONT_TYPE_MENU]); - ypos += iheight; - paintLine(xpos , font_info, g_Locale->getText(LOCALE_IMAGEINFO_DATE)); - paintLine(xpos+offset, font_info, imagedate); + //add label to container + cc_win->addCCItem(cc_txt); - ypos += iheight; - paintLine(xpos , font_info, g_Locale->getText(LOCALE_IMAGEINFO_VERSION)); - paintLine(xpos+offset, font_info, Version_Kernel.c_str()); + CComponentsText *cc_info = new CComponentsText(); + cc_info->setDimensionsAll(item_offset+cc_txt->getWidth(), item_top, 450, g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getHeight()); + cc_info->setText(v_info[i].info_text.c_str(), CTextBox::NO_AUTO_LINEBREAK, g_Font[SNeutrinoSettings::FONT_TYPE_MENU]); - ypos += iheight; -#ifdef GITVERSION - paintLine(xpos , font_info, GIT_DESC); -#else - paintLine(xpos , font_info, GIT_REV); -#endif - paintLine(xpos+offset, font_info, builddate ); + //add text to container + cc_win->addCCItem(cc_info); - ypos += iheight; - paintLine(xpos , font_info, g_Locale->getText(LOCALE_IMAGEINFO_CREATOR)); - paintLine(xpos+offset, font_info, creator); - - ypos += iheight+15; - paintLine(xpos , font_info, g_Locale->getText(LOCALE_IMAGEINFO_HOMEPAGE)); - paintLine(xpos+offset, font_info, homepage); - - ypos += iheight; - paintLine(xpos , font_info, g_Locale->getText(LOCALE_IMAGEINFO_DOKUMENTATION)); - paintLine(xpos+offset, font_info, docs); - - ypos += iheight; - paintLine(xpos , font_info, g_Locale->getText(LOCALE_IMAGEINFO_FORUM)); - paintLine(xpos+offset, font_info, forum); - - ypos += iheight+15; - paintLine(xpos, font_info,g_Locale->getText(LOCALE_IMAGEINFO_LICENSE)); - paintLine(xpos+offset, font_small, "This program is free software; you can redistribute it and/or modify"); - - ypos+= sheight; - paintLine(xpos+offset, font_small, "it under the terms of the GNU General Public License as published by"); - - ypos+= sheight; - paintLine(xpos+offset, font_small, "the Free Software Foundation; either version 2 of the License, or"); - - ypos+= sheight; - paintLine(xpos+offset, font_small, "(at your option) any later version."); - - ypos+= sheight+10; - paintLine(xpos+offset, font_small, "This program is distributed in the hope that it will be useful,"); - - ypos+= sheight; - paintLine(xpos+offset, font_small, "but WITHOUT ANY WARRANTY; without even the implied warranty of"); - - ypos+= sheight; - paintLine(xpos+offset, font_small, "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."); - - ypos+= sheight; - paintLine(xpos+offset, font_small, "See the GNU General Public License for more details."); - - ypos+= sheight+10; - paintLine(xpos+offset, font_small, "You should have received a copy of the GNU General Public License"); - - ypos+= sheight; - paintLine(xpos+offset, font_small, "along with this program; if not, write to the Free Software"); - - ypos+= sheight; - paintLine(xpos+offset, font_small, "Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA."); - - if (pip == NULL) - pip = new CComponentsPIP(width-width/3-10, y+10, 33); - pip->paint(); + item_top += item_offset*2-5; + } +} + +//prepare support infos +void CImageInfo::InitSupportInfos() +{ + v_info_supp.clear(); + + image_info_t www = {LOCALE_IMAGEINFO_HOMEPAGE, config.getString("homepage", "n/a")}; + v_info_supp.push_back(www); + image_info_t doc = {LOCALE_IMAGEINFO_DOKUMENTATION, config.getString("docs", "http://wiki.neutrino-hd.de")}; + v_info_supp.push_back(doc); + image_info_t forum = {LOCALE_IMAGEINFO_FORUM, config.getString("forum", "http://forum.tuxbox.org")}; + v_info_supp.push_back(forum); + image_info_t license = {LOCALE_IMAGEINFO_LICENSE, "GPL"}; + v_info_supp.push_back(license); + + //create text an label items + for (size_t i = 0; i < v_info_supp.size(); i++) { + CComponentsLabel *cc_txt = new CComponentsLabel(); + cc_txt->setDimensionsAll(item_offset, item_top, 200, g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getHeight()); + cc_txt->setText(v_info_supp[i].caption, CTextBox::NO_AUTO_LINEBREAK, g_Font[SNeutrinoSettings::FONT_TYPE_MENU]); + + cc_win->addCCItem(cc_txt); + + CComponentsText *cc_info = new CComponentsText(); + cc_info->setDimensionsAll(item_offset+cc_txt->getWidth(), item_top, 450, g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getHeight()); + cc_info->setText(v_info_supp[i].info_text.c_str(), CTextBox::NO_AUTO_LINEBREAK, g_Font[SNeutrinoSettings::FONT_TYPE_MENU]); + + cc_win->addCCItem(cc_info); + + item_top += item_offset*2-5; + } +} + +//prepare license infos +void CImageInfo::InitLicenseText() +{ + license_txt = ""; + char line[256]; + string file = LICENSEDIR; + file += g_settings.language; + file += ".license"; + ifstream in (file.c_str(), ios::in); + + if (!in){ + printf("[CImageInfo] [%s - %d] error while open %s -> %s\n", __FUNCTION__, __LINE__, file.c_str(), strerror(errno)); + return; + } + + while (in.getline (line, 256)){ + string lline = (string)line; + license_txt += lline + '\n'; + } + in.close(); + + CComponentsInfoBox *cc_lic = new CComponentsInfoBox(item_offset, item_top, cc_win->getWidth()-2*item_offset, cc_win->getHeight()-item_top); + cc_lic->removeLineBreaks(license_txt); + cc_lic->setText(license_txt, CTextBox::AUTO_WIDTH, g_Font[SNeutrinoSettings::FONT_TYPE_MENU_HINT]); + + //add text to container + cc_win->addCCItem(cc_lic); +} + + + +void CImageInfo::hide() +{ + cc_win->hide(); } diff --git a/src/gui/imageinfo.h b/src/gui/imageinfo.h index e4ca0ec92..f04a26a58 100644 --- a/src/gui/imageinfo.h +++ b/src/gui/imageinfo.h @@ -1,6 +1,9 @@ /* - Neutrino-GUI - DBoxII-Project + Based up Neutrino-GUI - Tuxbox-Project + Copyright (C) 2001 by Steffen Hehn 'McClean' + Implementation of component classes + Copyright (C) 2013, Thilo Graf 'dbt' License: GPL @@ -14,49 +17,46 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the + Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, + Boston, MA 02110-1301, USA. */ #ifndef __imageinfo__ #define __imageinfo__ +#include +#include #include -#include -#include -#include -#include - +typedef struct image_info_t +{ + neutrino_locale_t caption; + std::string info_text; + +} image_info_struct_t; class CImageInfo : public CMenuTarget { private: - void Init(void); - CConfigFile * configfile; - CFrameBuffer *frameBuffer; - CComponentsPIP * pip; - int x; - int y; - int ypos; - int width; - int height; - int hheight,iheight,sheight; // head/info/small font height + int item_offset; //distance between items and to boarder + int item_top; //start line in y below header + std::string license_txt; - int max_height; // Frambuffer 0.. max - int max_width; + std::vector v_info; + std::vector v_info_supp; - neutrino_locale_t name; - int offset; - - int font_head; - int font_info; - int font_small; - - void paint(); - void paintLine(int xpos, int font, const char* text); + void Init(); + void InitMinitv(); + void InitInfos(); + void InitSupportInfos(); + void ShowWindow(); + void InitLicenseText(); + + CComponentsWindow *cc_win; + CConfigFile config; public: From 9755751217a3377578ac4850c2ddf9469d562c30 Mon Sep 17 00:00:00 2001 From: Michael Liebmann Date: Tue, 19 Mar 2013 10:55:03 +0100 Subject: [PATCH 190/224] * Imageinfo: Format license text --- data/license/deutsch.license | 17 +++-------------- data/license/english.license | 15 +++------------ src/gui/imageinfo.cpp | 5 ++--- 3 files changed, 8 insertions(+), 29 deletions(-) diff --git a/data/license/deutsch.license b/data/license/deutsch.license index b21882463..a1ae108d3 100644 --- a/data/license/deutsch.license +++ b/data/license/deutsch.license @@ -1,16 +1,5 @@ -Dieses Programm ist freie Software. Sie können es unter den Bedingungen -der GNU General Public License, wie von der Free Software Foundation -veröffentlicht, weitergeben und/oder modifizieren, -entweder gemäß Version 2 der Lizenz -oder (nach Ihrer Option) jeder späteren Version. +Dieses Programm ist freie Software. Sie können es unter den Bedingungen der GNU General Public License, wie von der Free Software Foundation veröffentlicht, weitergeben und/oder modifizieren, entweder gemäß Version 2 der Lizenz oder (nach Ihrer Option) jeder späteren Version. -Die Veröffentlichung dieses Programms erfolgt in der Hoffnung, -daß es Ihnen von Nutzen sein wird, aber OHNE IRGENDEINE GARANTIE, -sogar ohne die implizite Garantie der -MARKTREIFE oder der VERWENDBARKEIT FÜR EINEN BESTIMMTEN ZWECK. -Details finden Sie in der GNU General Public License. +Die Veröffentlichung dieses Programms erfolgt in der Hoffnung, daß es Ihnen von Nutzen sein wird, aber OHNE IRGENDEINE GARANTIE, sogar ohne die implizite Garantie der MARKTREIFE oder der VERWENDBARKEIT FÜR EINEN BESTIMMTEN ZWECK. Details finden Sie in der GNU General Public License. -Sie sollten ein Exemplar der GNU General Public License zusammen -mit diesem Programm erhalten haben. Falls nicht, schreiben Sie an -die Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, -Boston, MA 02110, USA. +Sie sollten ein Exemplar der GNU General Public License zusammen mit diesem Programm erhalten haben. Falls nicht, schreiben Sie an die Free Software Foundation, Inc, 51 Franklin St, Fifth Floor, Boston, MA 02110, USA. diff --git a/data/license/english.license b/data/license/english.license index 5356a7f4a..1388ffb16 100644 --- a/data/license/english.license +++ b/data/license/english.license @@ -1,14 +1,5 @@ -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. +This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. +This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. -You should have received a copy of the GNU General Public License -along with this program; if not, write to the -Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, -Boston, MA 02110-1301, USA. +You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc. 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. diff --git a/src/gui/imageinfo.cpp b/src/gui/imageinfo.cpp index 31f0052f2..66ccfdca8 100644 --- a/src/gui/imageinfo.cpp +++ b/src/gui/imageinfo.cpp @@ -254,7 +254,7 @@ void CImageInfo::InitSupportInfos() void CImageInfo::InitLicenseText() { license_txt = ""; - char line[256]; + char line[1024]; string file = LICENSEDIR; file += g_settings.language; file += ".license"; @@ -265,14 +265,13 @@ void CImageInfo::InitLicenseText() return; } - while (in.getline (line, 256)){ + while (in.getline (line, sizeof(line)-1)){ string lline = (string)line; license_txt += lline + '\n'; } in.close(); CComponentsInfoBox *cc_lic = new CComponentsInfoBox(item_offset, item_top, cc_win->getWidth()-2*item_offset, cc_win->getHeight()-item_top); - cc_lic->removeLineBreaks(license_txt); cc_lic->setText(license_txt, CTextBox::AUTO_WIDTH, g_Font[SNeutrinoSettings::FONT_TYPE_MENU_HINT]); //add text to container From d9c7739aa669957fe49e2c8ddb8c4b810044b6d0 Mon Sep 17 00:00:00 2001 From: Jacek Jendrzej Date: Tue, 19 Mar 2013 17:14:04 +0100 Subject: [PATCH 191/224] -add record option for teletext & dvbsub pids --- data/locale/deutsch.locale | 6 +++ data/locale/english.locale | 6 +++ src/driver/genpsi.cpp | 82 +++++++++++++++++++++++++++++++++++++- src/driver/genpsi.h | 9 ++++- src/driver/record.cpp | 27 +++++++++++-- src/driver/record.h | 13 +++--- src/gui/record_setup.cpp | 23 +++++++++++ src/gui/record_setup.h | 2 + src/neutrino.cpp | 14 ++++--- src/neutrino_menue.h | 1 + src/system/locals.h | 6 +++ src/system/locals_intern.h | 6 +++ src/system/settings.h | 9 +++-- 13 files changed, 181 insertions(+), 23 deletions(-) diff --git a/data/locale/deutsch.locale b/data/locale/deutsch.locale index 1754c7d76..002265d2a 100644 --- a/data/locale/deutsch.locale +++ b/data/locale/deutsch.locale @@ -944,6 +944,9 @@ menu.hint_record_apid_std Schließt bei einer Aufnahme die durch den Sender defi menu.hint_record_apids Konfigurieren Sie die Tonspuren für die Aufnahme menu.hint_record_apply Hiermit werden die Aufnahmeoptionen übernommen menu.hint_record_chandir Diese Option speichert Aufnahmen mit dem Namen des Kanals in ein eigenes Verzeichnis +menu.hint_record_data Dataspuren ( Teletext, Untertitel) für die Aufnahme +menu.hint_record_data_dvbsub Untertitel Spur zu Aufnehme Hinzufügen +menu.hint_record_data_vtxt Teletext Spur zu Aufnehme Hinzufügen menu.hint_record_dir Wählen Sie das Aufnahmeverzeichnis menu.hint_record_end Wählen Sie zwischen max. Aufnahmezeit oder einem Aufnahmeende anhand der EPG-Daten menu.hint_record_slow_warn Zeige Warnung, wenn der Aufnahmepuffer zu überlaufen droht @@ -1515,7 +1518,9 @@ recordingmenu.apids Tonspuren recordingmenu.apids_ac3 AC3 Tonspuren aufnehmen recordingmenu.apids_alt Alternative Tonspuren aufn. recordingmenu.apids_std Standard Tonspur aufnehmen +recordingmenu.datapdis Dataspuren recordingmenu.defdir Aufnahmeverzeichnis +recordingmenu.dvbsub_pids Untertitel aufnahmen recordingmenu.end_of_recording_epg EPG aktuelles Event recordingmenu.end_of_recording_max max. Aufnahmezeit recordingmenu.end_of_recording_name Ende der Sofortaufnahme @@ -1537,6 +1542,7 @@ recordingmenu.slow_warn Warnung bei langsamen Aufnahmemedien recordingmenu.timeshift Timeshift recordingmenu.tsdir Timeshift Aufnahmeverzeichnis recordingmenu.vcr Videorekorder +recordingmenu.vtxt_pid Teletext aufnehmen recordingmenu.zap_on_announce Umschalten bei Ankündigung recordtimer.announce Die Aufnahme beginnt in wenigen Minuten. repeatblocker.hint_1 Mindestzeit (in ms) zwischen 2 Tastendrücken diff --git a/data/locale/english.locale b/data/locale/english.locale index ff10725c5..f03ff96f8 100644 --- a/data/locale/english.locale +++ b/data/locale/english.locale @@ -944,6 +944,9 @@ menu.hint_record_apid_std Record first audio pid menu.hint_record_apids Configure audio pids to record menu.hint_record_apply Apply record options menu.hint_record_chandir Create directory with name of channel\nto store recording +menu.hint_record_data Record (VideoText, subtitles) data streams +menu.hint_record_data_dvbsub subtitle stream +menu.hint_record_data_vtxt VideoText stream menu.hint_record_dir Select directory to store recordings menu.hint_record_end Stop direct record after max. time\nor after current event end time menu.hint_record_slow_warn Show warning, when record buffer is close to overflow @@ -1515,7 +1518,9 @@ recordingmenu.apids Audio streams recordingmenu.apids_ac3 record AC3 streams recordingmenu.apids_alt record alternative streams recordingmenu.apids_std record standard stream +recordingmenu.datapdis Data streams recordingmenu.defdir Recording directory +recordingmenu.dvbsub_pids record dvbsub stream recordingmenu.end_of_recording_epg EPG act. Event recordingmenu.end_of_recording_max max. Recordingtime recordingmenu.end_of_recording_name Endtime of Recording @@ -1537,6 +1542,7 @@ recordingmenu.slow_warn Enable slow record warning recordingmenu.timeshift Timeshift recordingmenu.tsdir Timeshift directory recordingmenu.vcr vcr +recordingmenu.vtxt_pid record teletext recordingmenu.zap_on_announce zap on recording announce recordtimer.announce Recording starts in a few minutes repeatblocker.hint_1 Shortest time (in ms) to recognize 2 keystrokes diff --git a/src/driver/genpsi.cpp b/src/driver/genpsi.cpp index 266b727fd..cd350cf22 100644 --- a/src/driver/genpsi.cpp +++ b/src/driver/genpsi.cpp @@ -1,6 +1,7 @@ /* Copyright (c) 2004 gmo18t, Germany. All rights reserved. Copyright (C) 2012 CoolStream International Ltd + Copyright (C) 2013 Jacek Jendrzej This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published @@ -124,8 +125,15 @@ CGenPsi::CGenPsi() nba = 0; vpid = 0; vtype = 0; + + vtxtpid = 0; + vtxtlang[0] = 'g'; + vtxtlang[1] = 'e'; + vtxtlang[2] = 'r'; memset(apid, 0, sizeof(apid)); memset(atypes, 0, sizeof(atypes)); + nsub = 0; + memset(dvbsubpid, 0, sizeof(dvbsubpid)); } uint32_t CGenPsi::calc_crc32psi(uint8_t *dst, const uint8_t *src, uint32_t len) @@ -147,7 +155,7 @@ uint32_t CGenPsi::calc_crc32psi(uint8_t *dst, const uint8_t *src, uint32_t len) return crc; } -void CGenPsi::addPid(uint16_t pid, uint16_t pidtype, short isAC3) +void CGenPsi::addPid(uint16_t pid, uint16_t pidtype, short isAC3, const char *data) { switch(pidtype) { @@ -165,8 +173,22 @@ void CGenPsi::addPid(uint16_t pid, uint16_t pidtype, short isAC3) nba++; break; case EN_TYPE_TELTEX: + vtxtpid = pid; + if(data != NULL){ + vtxtlang[0] = data[0]; + vtxtlang[1] = data[1]; + vtxtlang[2] = data[2]; + } + break; + case EN_TYPE_DVBSUB: + dvbsubpid[nsub] = pid; + if(data != NULL){ + dvbsublang[nsub][0] = data[0]; + dvbsublang[nsub][1] = data[1]; + dvbsublang[nsub][2] = data[2]; + } + nsub++; break; - default: break; } @@ -232,6 +254,8 @@ int CGenPsi::genpsi(int fd) //-- (II) build PAT -- data_len = COPY_TEMPLATE(pkt, pkt_pat); +// pkt[0xf]= 0xE0 | (pmtpid>>8); +// pkt[0x10] = pmtpid & 0xFF; //-- calculate CRC -- calc_crc32psi(&pkt[data_len], &pkt[OFS_HDR_2], data_len-OFS_HDR_2 ); //-- write TS packet -- @@ -241,6 +265,12 @@ int CGenPsi::genpsi(int fd) data_len = COPY_TEMPLATE(pkt, pkt_pmt); //-- adjust len dependent to count of audio streams -- data_len += (SIZE_STREAM_TAB_ROW * (nba-1)); + if(vtxtpid){ + data_len += (SIZE_STREAM_TAB_ROW * (1))+10;//add teletext row length + } + if(nsub){ + data_len += ((SIZE_STREAM_TAB_ROW+10) * nsub);//add dvbsub row length + } patch_len = data_len - OFS_HDR_2 + 1; pkt[OFS_HDR_2+1] |= (patch_len>>8); pkt[OFS_HDR_2+2] = (patch_len & 0xFF); @@ -266,13 +296,61 @@ int CGenPsi::genpsi(int fd) pkt[ofs+3] = 0xF0; pkt[ofs+4] = 0x00; } + + //teletext + if(vtxtpid){ + ofs += SIZE_STREAM_TAB_ROW; + pkt[ofs] = 0x06; //teletext stream type; + pkt[ofs+1] = 0xE0 | vtxtpid>>8; + pkt[ofs+2] = vtxtpid&0xff; + pkt[ofs+3] = 0xf0; + pkt[ofs+4] = 0x0A; // ES_info_length + pkt[ofs+5] = 0x52; //DVB-DescriptorTag: 82 (0x52) [= stream_identifier_descriptor] + pkt[ofs+6] = 0x01; // descriptor_length + pkt[ofs+7] = 0x03; //component_tag + pkt[ofs+8] = 0x56; // DVB teletext tag + pkt[ofs+9] = 0x05; // descriptor length + pkt[ofs+10] = vtxtlang[0]; //language code[0] + pkt[ofs+11] = vtxtlang[1]; //language code[1] + pkt[ofs+12] = vtxtlang[2]; //language code[2] + pkt[ofs+13] = (/*descriptor_magazine_number*/ 0x01 & 0x06) | ((/*descriptor_type*/ 0x01 << 3) & 0xF8); + pkt[ofs+14] = 0x00 ; //Teletext_page_number + } + + //dvbsub + for (i=0; i 0 || vtxtpid) + ofs += 10; + + pkt[ofs] = 0x06;//subtitle stream type; + pkt[ofs+1] = 0xE0 | dvbsubpid[i]>>8; + pkt[ofs+2] = dvbsubpid[i] & 0xFF; + pkt[ofs+3] = 0xF0; + pkt[ofs+4] = 0x0A; // es info length + pkt[ofs+5] = 0x59; // DVB sub tag + pkt[ofs+6] = 0x08; // descriptor length + pkt[ofs+7] = dvbsublang[i][0]; //language code[0] + pkt[ofs+8] = dvbsublang[i][1]; //language code[1] + pkt[ofs+9] = dvbsublang[i][2]; //language code[2] + pkt[ofs+10] = 0x20; //subtitle_stream.subtitling_type + pkt[ofs+11] = 0x01>>8; //composition_page_id + pkt[ofs+12] = 0x01&0xff; //composition_page_id + pkt[ofs+13] = 0x01>>8; //ancillary_page_id + pkt[ofs+14] = 0x01&0xff; //ancillary_page_id + } + //-- calculate CRC -- calc_crc32psi(&pkt[data_len], &pkt[OFS_HDR_2], data_len-OFS_HDR_2 ); //-- write TS packet -- write(fd, pkt, SIZE_TS_PKT); + //-- finish -- vpid=0; nba=0; + nsub = 0; + vtxtpid = 0; fdatasync(fd); return 1; } diff --git a/src/driver/genpsi.h b/src/driver/genpsi.h index 3e5c0a051..1fce949d6 100644 --- a/src/driver/genpsi.h +++ b/src/driver/genpsi.h @@ -28,21 +28,26 @@ #define EN_TYPE_TELTEX 0x02 #define EN_TYPE_PCR 0x03 #define EN_TYPE_AVC 0x04 +#define EN_TYPE_DVBSUB 0x06 class CGenPsi { private: - short nba; + short nba, nsub; uint16_t vpid; uint8_t vtype; + uint16_t vtxtpid; + char vtxtlang[3]; uint16_t apid[10]; short atypes[10]; + uint16_t dvbsubpid[10]; + char dvbsublang[10][3]; static int copy_template(uint8_t *dst, uint8_t *src, int len); uint32_t calc_crc32psi(uint8_t *dst, const uint8_t *src, uint32_t len); public: CGenPsi(); - void addPid(uint16_t pid,uint16_t pidtype, short isAC3); + void addPid(uint16_t pid,uint16_t pidtype, short isAC3, const char *data = NULL); int genpsi(int fd); }; #endif diff --git a/src/driver/record.cpp b/src/driver/record.cpp index b1b2a74ba..d7c0626c6 100644 --- a/src/driver/record.cpp +++ b/src/driver/record.cpp @@ -72,7 +72,7 @@ extern "C" { } //------------------------------------------------------------------------- -CRecordInstance::CRecordInstance(const CTimerd::RecordingInfo * const eventinfo, std::string &dir, bool timeshift, bool stream_vtxt_pid, bool stream_pmt_pid) +CRecordInstance::CRecordInstance(const CTimerd::RecordingInfo * const eventinfo, std::string &dir, bool timeshift, bool stream_vtxt_pid, bool stream_pmt_pid, bool stream_subtitle_pids ) { channel_id = eventinfo->channel_id; epgid = eventinfo->epgID; @@ -86,6 +86,8 @@ CRecordInstance::CRecordInstance(const CTimerd::RecordingInfo * const eventinfo, StreamVTxtPid = stream_vtxt_pid; StreamPmtPid = stream_pmt_pid; + StreamSubtitlePids = stream_subtitle_pids; + Directory = dir; autoshift = timeshift; numpids = 0; @@ -166,10 +168,26 @@ record_error_msg_t CRecordInstance::Start(CZapitChannel * channel) apids[numpids++] = recMovieInfo->audioPids[i].epgAudioPid; psi.addPid(recMovieInfo->audioPids[i].epgAudioPid, EN_TYPE_AUDIO, recMovieInfo->audioPids[i].atype); } + if ((StreamVTxtPid) && (allpids.PIDs.vtxtpid != 0)){ + apids[numpids++] = allpids.PIDs.vtxtpid; + psi.addPid(allpids.PIDs.vtxtpid, EN_TYPE_TELTEX, 0, channel->getTeletextLang()); + } + if (StreamSubtitlePids){ + for (int i = 0 ; i < (int)channel->getSubtitleCount() ; ++i) { + CZapitAbsSub* s = channel->getChannelSub(i); + if (s->thisSubType == CZapitAbsSub::DVB) { + if(i>9)//max sub pids + break; + + CZapitDVBSub* sd = reinterpret_cast(s); + apids[numpids++] = sd->pId; + psi.addPid( sd->pId, EN_TYPE_DVBSUB, 0, sd->ISO639_language_code.c_str() ); + } + } + + } psi.genpsi(fd); - if ((StreamVTxtPid) && (allpids.PIDs.vtxtpid != 0)) - apids[numpids++] = allpids.PIDs.vtxtpid; if ((StreamPmtPid) && (allpids.PIDs.pmtpid != 0)) apids[numpids++] = allpids.PIDs.pmtpid; @@ -666,6 +684,7 @@ CRecordManager::CRecordManager() { StreamVTxtPid = false; StreamPmtPid = false; + StreamSubtitlePids = false; StopSectionsd = false; //recordingstatus = 0; recmap.clear(); @@ -879,7 +898,7 @@ bool CRecordManager::Record(const CTimerd::RecordingInfo * const eventinfo, cons else newdir = Directory; - inst = new CRecordInstance(eventinfo, newdir, timeshift, StreamVTxtPid, StreamPmtPid); + inst = new CRecordInstance(eventinfo, newdir, timeshift, StreamVTxtPid, StreamPmtPid, StreamSubtitlePids); inst->frontend = frontend; error_msg = inst->Record(); diff --git a/src/driver/record.h b/src/driver/record.h index b8ee4be99..b854f8876 100644 --- a/src/driver/record.h +++ b/src/driver/record.h @@ -83,6 +83,7 @@ class CRecordInstance time_t epg_time; time_t start_time; bool StreamVTxtPid; + bool StreamSubtitlePids; bool StreamPmtPid; unsigned short apids[REC_MAX_APIDS]; unsigned int numpids; @@ -107,7 +108,7 @@ class CRecordInstance record_error_msg_t Start(CZapitChannel * channel); void WaitRecMsg(time_t StartTime, time_t WaitTime); public: - CRecordInstance(const CTimerd::RecordingInfo * const eventinfo, std::string &dir, bool timeshift = false, bool stream_vtxt_pid = false, bool stream_pmt_pid = false); + CRecordInstance(const CTimerd::RecordingInfo * const eventinfo, std::string &dir, bool timeshift = false, bool stream_vtxt_pid = false, bool stream_pmt_pid = false, bool stream_subtitle_pids = false); ~CRecordInstance(); record_error_msg_t Record(); @@ -146,6 +147,7 @@ class CRecordManager : public CMenuTarget /*, public CChangeObserver*/ std::string Directory; std::string TimeshiftDirectory; bool StreamVTxtPid; + bool StreamSubtitlePids; bool StreamPmtPid; bool StopSectionsd; int last_mode; @@ -201,11 +203,12 @@ class CRecordManager : public CMenuTarget /*, public CChangeObserver*/ bool RunStartScript(void); bool RunStopScript(void); - void Config(const bool stopsectionsd, const bool stream_vtxt_pid, const bool stream_pmt_pid) + void Config(const bool stopsectionsd, const bool stream_vtxt_pid, const bool stream_pmt_pid, bool stream_subtitle_pids ) { - StopSectionsd = stopsectionsd; - StreamVTxtPid = stream_vtxt_pid; - StreamPmtPid = stream_pmt_pid; + StopSectionsd = stopsectionsd; + StreamVTxtPid = stream_vtxt_pid; + StreamSubtitlePids = stream_subtitle_pids; + StreamPmtPid = stream_pmt_pid; }; void SetDirectory(const char * const directory) { Directory = directory; }; void SetTimeshiftDirectory(const char * const directory) { TimeshiftDirectory = directory; }; diff --git a/src/gui/record_setup.cpp b/src/gui/record_setup.cpp index 599754ece..a31d92f76 100644 --- a/src/gui/record_setup.cpp +++ b/src/gui/record_setup.cpp @@ -229,6 +229,13 @@ int CRecordSetup::showRecordSetup() mf->setHint("", LOCALE_MENU_HINT_RECORD_APIDS); recordingSettings->addItem(mf); + //datasettings + CMenuWidget recordingaDataSettings(LOCALE_MAINSETTINGS_RECORDING, NEUTRINO_ICON_SETTINGS, width, MN_WIDGET_ID_RECORDSETUP_DATASETTINGS); + showRecordDataSetup(&recordingaDataSettings); + mf = new CMenuForwarder(LOCALE_RECORDINGMENU_DATAPIDS, true, NULL, &recordingaDataSettings, NULL, CRCInput::RC_1); + mf->setHint("", LOCALE_MENU_HINT_RECORD_DATA); + recordingSettings->addItem(mf); + int res = recordingSettings->exec(NULL, ""); delete recordingSettings; return res; @@ -291,6 +298,22 @@ void CRecordSetup::showRecordAudioSetup(CMenuWidget *menu_audiosettings) menu_audiosettings->addItem(aoj3); } +void CRecordSetup::showRecordDataSetup(CMenuWidget *menu_datasettings) +{ + //recording data pids + + //teletext pids + CMenuOptionChooser* doj1 = new CMenuOptionChooser(LOCALE_RECORDINGMENU_VTXT_PID, &g_settings.recording_stream_vtxt_pid, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true, this); + CMenuOptionChooser* doj2 = new CMenuOptionChooser(LOCALE_RECORDINGMENU_DVBSUB_PIDS, &g_settings.recording_stream_subtitle_pids, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true, this); + + doj1->setHint("", LOCALE_MENU_HINT_RECORD_DATA_VTXT); + doj2->setHint("", LOCALE_MENU_HINT_RECORD_DATA_DVBSUB); + + menu_datasettings->addIntroItems(LOCALE_RECORDINGMENU_DATAPIDS); + menu_datasettings->addItem(doj1); + menu_datasettings->addItem(doj2); +} + void CRecordSetup::showRecordTimeShiftSetup(CMenuWidget *menu_ts) { menu_ts->addIntroItems(LOCALE_RECORDINGMENU_TIMESHIFT); diff --git a/src/gui/record_setup.h b/src/gui/record_setup.h index d9693e034..996d31a5d 100644 --- a/src/gui/record_setup.h +++ b/src/gui/record_setup.h @@ -44,6 +44,8 @@ class CRecordSetup : public CMenuTarget, public CChangeObserver int showRecordSetup(); void showRecordTimerSetup(CMenuWidget *menu_timersettings); void showRecordAudioSetup(CMenuWidget *menu_audiosettings); + void showRecordDataSetup(CMenuWidget *menu_datasettings); + void showRecordTimeShiftSetup(CMenuWidget *menu_ts); public: diff --git a/src/neutrino.cpp b/src/neutrino.cpp index 42bc68f1e..7be65d004 100644 --- a/src/neutrino.cpp +++ b/src/neutrino.cpp @@ -579,6 +579,7 @@ int CNeutrinoApp::loadSetup(const char * fname) g_settings.shutdown_timer_record_type = configfile.getBool("shutdown_timer_record_type" , false); g_settings.recording_stream_vtxt_pid = configfile.getBool("recordingmenu.stream_vtxt_pid" , false); + g_settings.recording_stream_subtitle_pids = configfile.getBool("recordingmenu.stream_subtitle_pids", false); g_settings.recording_stream_pmt_pid = configfile.getBool("recordingmenu.stream_pmt_pid" , false); g_settings.recording_choose_direct_rec_dir = configfile.getInt32( "recording_choose_direct_rec_dir", 0 ); g_settings.recording_epg_for_filename = configfile.getBool("recording_epg_for_filename" , true); @@ -994,17 +995,18 @@ void CNeutrinoApp::saveSetup(const char * fname) configfile.setInt32 ("recording_type", g_settings.recording_type); configfile.setBool ("recording_stopsectionsd" , g_settings.recording_stopsectionsd ); - configfile.setInt32 ("recording_audio_pids_default" , g_settings.recording_audio_pids_default); + configfile.setInt32 ("recording_audio_pids_default" , g_settings.recording_audio_pids_default ); configfile.setBool ("recording_zap_on_announce" , g_settings.recording_zap_on_announce ); - configfile.setBool ("shutdown_timer_record_type" , g_settings.shutdown_timer_record_type ); + configfile.setBool ("shutdown_timer_record_type" , g_settings.shutdown_timer_record_type ); configfile.setBool ("recordingmenu.stream_vtxt_pid" , g_settings.recording_stream_vtxt_pid ); - configfile.setBool ("recordingmenu.stream_pmt_pid" , g_settings.recording_stream_pmt_pid ); + configfile.setBool ("recordingmenu.stream_subtitle_pids" , g_settings.recording_stream_subtitle_pids ); + configfile.setBool ("recordingmenu.stream_pmt_pid" , g_settings.recording_stream_pmt_pid ); configfile.setInt32 ("recording_choose_direct_rec_dir" , g_settings.recording_choose_direct_rec_dir); configfile.setBool ("recording_epg_for_filename" , g_settings.recording_epg_for_filename ); configfile.setBool ("recording_epg_for_end" , g_settings.recording_epg_for_end ); - configfile.setBool ("recording_save_in_channeldir" , g_settings.recording_save_in_channeldir ); - configfile.setBool ("recording_slow_warning" , g_settings.recording_slow_warning ); + configfile.setBool ("recording_save_in_channeldir" , g_settings.recording_save_in_channeldir ); + configfile.setBool ("recording_slow_warning" , g_settings.recording_slow_warning ); // default plugin for movieplayer configfile.setString ( "movieplayer_plugin", g_settings.movieplayer_plugin ); @@ -1630,7 +1632,7 @@ void CNeutrinoApp::InitZapper() void CNeutrinoApp::setupRecordingDevice(void) { CRecordManager::getInstance()->SetDirectory(g_settings.network_nfs_recordingdir); - CRecordManager::getInstance()->Config(g_settings.recording_stopsectionsd, g_settings.recording_stream_vtxt_pid, g_settings.recording_stream_pmt_pid); + CRecordManager::getInstance()->Config(g_settings.recording_stopsectionsd, g_settings.recording_stream_vtxt_pid, g_settings.recording_stream_pmt_pid, g_settings.recording_stream_subtitle_pids); } static void CSSendMessage(uint32_t msg, uint32_t data) diff --git a/src/neutrino_menue.h b/src/neutrino_menue.h index 179bb84af..3efe11bd3 100644 --- a/src/neutrino_menue.h +++ b/src/neutrino_menue.h @@ -82,6 +82,7 @@ enum MN_WIDGET_ID MN_WIDGET_ID_RECORDSETUP_TIMESHIFT, MN_WIDGET_ID_RECORDSETUP_TIMERSETTINGS, MN_WIDGET_ID_RECORDSETUP_AUDIOSETTINGS, + MN_WIDGET_ID_RECORDSETUP_DATASETTINGS, //vfd setup MN_WIDGET_ID_VFDSETUP, diff --git a/src/system/locals.h b/src/system/locals.h index 8fc8c9ee8..79ced4f47 100644 --- a/src/system/locals.h +++ b/src/system/locals.h @@ -971,6 +971,9 @@ typedef enum LOCALE_MENU_HINT_RECORD_APIDS, LOCALE_MENU_HINT_RECORD_APPLY, LOCALE_MENU_HINT_RECORD_CHANDIR, + LOCALE_MENU_HINT_RECORD_DATA, + LOCALE_MENU_HINT_RECORD_DATA_DVBSUB, + LOCALE_MENU_HINT_RECORD_DATA_VTXT, LOCALE_MENU_HINT_RECORD_DIR, LOCALE_MENU_HINT_RECORD_END, LOCALE_MENU_HINT_RECORD_SLOW_WARN, @@ -1542,6 +1545,8 @@ typedef enum LOCALE_RECORDINGMENU_APIDS_AC3, LOCALE_RECORDINGMENU_APIDS_ALT, LOCALE_RECORDINGMENU_APIDS_STD, + LOCALE_RECORDINGMENU_DATAPIDS, + LOCALE_RECORDINGMENU_DVBSUB_PIDS, LOCALE_RECORDINGMENU_DEFDIR, LOCALE_RECORDINGMENU_END_OF_RECORDING_EPG, LOCALE_RECORDINGMENU_END_OF_RECORDING_MAX, @@ -1564,6 +1569,7 @@ typedef enum LOCALE_RECORDINGMENU_TIMESHIFT, LOCALE_RECORDINGMENU_TSDIR, LOCALE_RECORDINGMENU_VCR, + LOCALE_RECORDINGMENU_VTXT_PID, LOCALE_RECORDINGMENU_ZAP_ON_ANNOUNCE, LOCALE_RECORDTIMER_ANNOUNCE, LOCALE_REPEATBLOCKER_HINT_1, diff --git a/src/system/locals_intern.h b/src/system/locals_intern.h index cef32f0e9..bdeb03bd3 100644 --- a/src/system/locals_intern.h +++ b/src/system/locals_intern.h @@ -971,6 +971,9 @@ const char * locale_real_names[] = "menu.hint_record_apids", "menu.hint_record_apply", "menu.hint_record_chandir", + "menu.hint_record_data", + "menu.hint_record_data_dvbsub", + "menu.hint_record_data_vtxt", "menu.hint_record_dir", "menu.hint_record_end", "menu.hint_record_slow_warn", @@ -1542,6 +1545,8 @@ const char * locale_real_names[] = "recordingmenu.apids_ac3", "recordingmenu.apids_alt", "recordingmenu.apids_std", + "recordingmenu.datapdis", + "recordingmenu.dvbsub_pids", "recordingmenu.defdir", "recordingmenu.end_of_recording_epg", "recordingmenu.end_of_recording_max", @@ -1564,6 +1569,7 @@ const char * locale_real_names[] = "recordingmenu.timeshift", "recordingmenu.tsdir", "recordingmenu.vcr", + "recordingmenu.vtxt_pid", "recordingmenu.zap_on_announce", "recordtimer.announce", "repeatblocker.hint_1", diff --git a/src/system/settings.h b/src/system/settings.h index c30e3246a..e5aced076 100644 --- a/src/system/settings.h +++ b/src/system/settings.h @@ -325,14 +325,15 @@ struct SNeutrinoSettings int recording_audio_pids_std; int recording_audio_pids_alt; int recording_audio_pids_ac3; - int recording_stream_vtxt_pid; - int recording_stream_pmt_pid; + int recording_stream_vtxt_pid; + int recording_stream_subtitle_pids; + int recording_stream_pmt_pid; int recording_choose_direct_rec_dir; int recording_epg_for_filename; int recording_epg_for_end; int recording_save_in_channeldir; - int recording_zap_on_announce; - int recording_slow_warning; + int recording_zap_on_announce; + int recording_slow_warning; int shutdown_timer_record_type; int filesystem_is_utf8; From 9b7c96f07ea6fc540e97a721fa25693d4daba357 Mon Sep 17 00:00:00 2001 From: svenhoefer Date: Wed, 20 Mar 2013 21:41:14 +0100 Subject: [PATCH 192/224] - deutsch.locale: fix typos --- data/locale/deutsch.locale | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/data/locale/deutsch.locale b/data/locale/deutsch.locale index 002265d2a..27cf5943b 100644 --- a/data/locale/deutsch.locale +++ b/data/locale/deutsch.locale @@ -944,9 +944,9 @@ menu.hint_record_apid_std Schließt bei einer Aufnahme die durch den Sender defi menu.hint_record_apids Konfigurieren Sie die Tonspuren für die Aufnahme menu.hint_record_apply Hiermit werden die Aufnahmeoptionen übernommen menu.hint_record_chandir Diese Option speichert Aufnahmen mit dem Namen des Kanals in ein eigenes Verzeichnis -menu.hint_record_data Dataspuren ( Teletext, Untertitel) für die Aufnahme -menu.hint_record_data_dvbsub Untertitel Spur zu Aufnehme Hinzufügen -menu.hint_record_data_vtxt Teletext Spur zu Aufnehme Hinzufügen +menu.hint_record_data Daten-Spuren (Teletext, Untertitel) für die Aufnahme +menu.hint_record_data_dvbsub Untertitel-Spur zu Aufnahme hinzufügen +menu.hint_record_data_vtxt Teletext-Spur zu Aufnahme hinzufügen menu.hint_record_dir Wählen Sie das Aufnahmeverzeichnis menu.hint_record_end Wählen Sie zwischen max. Aufnahmezeit oder einem Aufnahmeende anhand der EPG-Daten menu.hint_record_slow_warn Zeige Warnung, wenn der Aufnahmepuffer zu überlaufen droht @@ -1518,9 +1518,9 @@ recordingmenu.apids Tonspuren recordingmenu.apids_ac3 AC3 Tonspuren aufnehmen recordingmenu.apids_alt Alternative Tonspuren aufn. recordingmenu.apids_std Standard Tonspur aufnehmen -recordingmenu.datapdis Dataspuren +recordingmenu.datapdis Daten-Spuren recordingmenu.defdir Aufnahmeverzeichnis -recordingmenu.dvbsub_pids Untertitel aufnahmen +recordingmenu.dvbsub_pids Untertitel aufnehmen recordingmenu.end_of_recording_epg EPG aktuelles Event recordingmenu.end_of_recording_max max. Aufnahmezeit recordingmenu.end_of_recording_name Ende der Sofortaufnahme From d0164eaaf67b5867836fc889657bbd7ca0b163ac Mon Sep 17 00:00:00 2001 From: svenhoefer Date: Wed, 20 Mar 2013 21:50:16 +0100 Subject: [PATCH 193/224] - fix another typo around DATA_PIDS --- data/locale/deutsch.locale | 2 +- data/locale/english.locale | 2 +- src/gui/record_setup.cpp | 4 ++-- src/system/locals.h | 2 +- src/system/locals_intern.h | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/data/locale/deutsch.locale b/data/locale/deutsch.locale index 27cf5943b..8f52ef935 100644 --- a/data/locale/deutsch.locale +++ b/data/locale/deutsch.locale @@ -1518,7 +1518,7 @@ recordingmenu.apids Tonspuren recordingmenu.apids_ac3 AC3 Tonspuren aufnehmen recordingmenu.apids_alt Alternative Tonspuren aufn. recordingmenu.apids_std Standard Tonspur aufnehmen -recordingmenu.datapdis Daten-Spuren +recordingmenu.data_pids Daten-Spuren recordingmenu.defdir Aufnahmeverzeichnis recordingmenu.dvbsub_pids Untertitel aufnehmen recordingmenu.end_of_recording_epg EPG aktuelles Event diff --git a/data/locale/english.locale b/data/locale/english.locale index f03ff96f8..542766a20 100644 --- a/data/locale/english.locale +++ b/data/locale/english.locale @@ -1518,7 +1518,7 @@ recordingmenu.apids Audio streams recordingmenu.apids_ac3 record AC3 streams recordingmenu.apids_alt record alternative streams recordingmenu.apids_std record standard stream -recordingmenu.datapdis Data streams +recordingmenu.data_pids Data streams recordingmenu.defdir Recording directory recordingmenu.dvbsub_pids record dvbsub stream recordingmenu.end_of_recording_epg EPG act. Event diff --git a/src/gui/record_setup.cpp b/src/gui/record_setup.cpp index a31d92f76..bec04b041 100644 --- a/src/gui/record_setup.cpp +++ b/src/gui/record_setup.cpp @@ -232,7 +232,7 @@ int CRecordSetup::showRecordSetup() //datasettings CMenuWidget recordingaDataSettings(LOCALE_MAINSETTINGS_RECORDING, NEUTRINO_ICON_SETTINGS, width, MN_WIDGET_ID_RECORDSETUP_DATASETTINGS); showRecordDataSetup(&recordingaDataSettings); - mf = new CMenuForwarder(LOCALE_RECORDINGMENU_DATAPIDS, true, NULL, &recordingaDataSettings, NULL, CRCInput::RC_1); + mf = new CMenuForwarder(LOCALE_RECORDINGMENU_DATA_PIDS, true, NULL, &recordingaDataSettings, NULL, CRCInput::RC_1); mf->setHint("", LOCALE_MENU_HINT_RECORD_DATA); recordingSettings->addItem(mf); @@ -309,7 +309,7 @@ void CRecordSetup::showRecordDataSetup(CMenuWidget *menu_datasettings) doj1->setHint("", LOCALE_MENU_HINT_RECORD_DATA_VTXT); doj2->setHint("", LOCALE_MENU_HINT_RECORD_DATA_DVBSUB); - menu_datasettings->addIntroItems(LOCALE_RECORDINGMENU_DATAPIDS); + menu_datasettings->addIntroItems(LOCALE_RECORDINGMENU_DATA_PIDS); menu_datasettings->addItem(doj1); menu_datasettings->addItem(doj2); } diff --git a/src/system/locals.h b/src/system/locals.h index 79ced4f47..df1dda234 100644 --- a/src/system/locals.h +++ b/src/system/locals.h @@ -1545,7 +1545,7 @@ typedef enum LOCALE_RECORDINGMENU_APIDS_AC3, LOCALE_RECORDINGMENU_APIDS_ALT, LOCALE_RECORDINGMENU_APIDS_STD, - LOCALE_RECORDINGMENU_DATAPIDS, + LOCALE_RECORDINGMENU_DATA_PIDS, LOCALE_RECORDINGMENU_DVBSUB_PIDS, LOCALE_RECORDINGMENU_DEFDIR, LOCALE_RECORDINGMENU_END_OF_RECORDING_EPG, diff --git a/src/system/locals_intern.h b/src/system/locals_intern.h index bdeb03bd3..d91a38584 100644 --- a/src/system/locals_intern.h +++ b/src/system/locals_intern.h @@ -1545,7 +1545,7 @@ const char * locale_real_names[] = "recordingmenu.apids_ac3", "recordingmenu.apids_alt", "recordingmenu.apids_std", - "recordingmenu.datapdis", + "recordingmenu.data_pids", "recordingmenu.dvbsub_pids", "recordingmenu.defdir", "recordingmenu.end_of_recording_epg", From c117c8057974e692adcb8f5bd6aac4d0c587b963 Mon Sep 17 00:00:00 2001 From: Michael Liebmann Date: Thu, 21 Mar 2013 06:52:54 +0100 Subject: [PATCH 194/224] * locals.h/locals_intern.h: Fix Sort order --- src/system/locals.h | 2 +- src/system/locals_intern.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/system/locals.h b/src/system/locals.h index df1dda234..9cc9c7bdb 100644 --- a/src/system/locals.h +++ b/src/system/locals.h @@ -1546,8 +1546,8 @@ typedef enum LOCALE_RECORDINGMENU_APIDS_ALT, LOCALE_RECORDINGMENU_APIDS_STD, LOCALE_RECORDINGMENU_DATA_PIDS, - LOCALE_RECORDINGMENU_DVBSUB_PIDS, LOCALE_RECORDINGMENU_DEFDIR, + LOCALE_RECORDINGMENU_DVBSUB_PIDS, LOCALE_RECORDINGMENU_END_OF_RECORDING_EPG, LOCALE_RECORDINGMENU_END_OF_RECORDING_MAX, LOCALE_RECORDINGMENU_END_OF_RECORDING_NAME, diff --git a/src/system/locals_intern.h b/src/system/locals_intern.h index d91a38584..1951c6f08 100644 --- a/src/system/locals_intern.h +++ b/src/system/locals_intern.h @@ -1546,8 +1546,8 @@ const char * locale_real_names[] = "recordingmenu.apids_alt", "recordingmenu.apids_std", "recordingmenu.data_pids", - "recordingmenu.dvbsub_pids", "recordingmenu.defdir", + "recordingmenu.dvbsub_pids", "recordingmenu.end_of_recording_epg", "recordingmenu.end_of_recording_max", "recordingmenu.end_of_recording_name", From c74fb776036fca0dce97518dff17a3d4be8ddf82 Mon Sep 17 00:00:00 2001 From: Michael Liebmann Date: Wed, 20 Mar 2013 21:43:23 +0100 Subject: [PATCH 195/224] * CTextBox::scrollPageUp/Down: Suppress refresh when there is nothing to scroll --- src/gui/widget/textbox.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/gui/widget/textbox.cpp b/src/gui/widget/textbox.cpp index ba565c799..8972e07c6 100644 --- a/src/gui/widget/textbox.cpp +++ b/src/gui/widget/textbox.cpp @@ -554,8 +554,10 @@ void CTextBox::scrollPageDown(const int pages) { m_nCurrentPage = m_nNrOfPages - 1; } + int oldCurrentLine = m_nCurrentLine; m_nCurrentLine = m_nCurrentPage * m_nLinesPerPage; - refresh(); + if (oldCurrentLine != m_nCurrentLine) + refresh(); } void CTextBox::scrollPageUp(const int pages) @@ -575,8 +577,10 @@ void CTextBox::scrollPageUp(const int pages) { m_nCurrentPage = 0; } + int oldCurrentLine = m_nCurrentLine; m_nCurrentLine = m_nCurrentPage * m_nLinesPerPage; - refresh(); + if (oldCurrentLine != m_nCurrentLine) + refresh(); } void CTextBox::refresh(void) From 801a15df7cce49188ebf54e61c5e47e0ed4953cd Mon Sep 17 00:00:00 2001 From: Michael Liebmann Date: Wed, 20 Mar 2013 21:48:51 +0100 Subject: [PATCH 196/224] * CImageInfo: Scroll license text if text box too small --- src/gui/components/cc.h | 5 ++++- src/gui/imageinfo.cpp | 26 ++++++++++++++++++++++++-- src/gui/imageinfo.h | 2 ++ 3 files changed, 30 insertions(+), 3 deletions(-) diff --git a/src/gui/components/cc.h b/src/gui/components/cc.h index 4d49f9cf7..6e6da091a 100644 --- a/src/gui/components/cc.h +++ b/src/gui/components/cc.h @@ -201,6 +201,8 @@ class CComponentsText : public CComponentsItem virtual void setText(const std::string& stext, const int mode = ~CTextBox::AUTO_WIDTH, Font* font_text = NULL); virtual void setText(neutrino_locale_t locale_text, const int mode = ~CTextBox::AUTO_WIDTH, Font* font_text = NULL); virtual void removeLineBreaks(std::string& str); + + CTextBox* getCCItemTextBoxInst() { return ct_textbox; }; }; class CComponentsLabel : public CComponentsText @@ -223,7 +225,6 @@ class CComponentsInfoBox : public CComponentsText { private: int x_text, x_offset; - CComponentsText * cctext; CComponentsPicture * pic; std::string pic_default_name; @@ -232,6 +233,8 @@ class CComponentsInfoBox : public CComponentsText std::string pic_name; public: + CComponentsText * cctext; + CComponentsInfoBox(); CComponentsInfoBox( const int x_pos, const int y_pos, const int w, const int h, const char* info_text = NULL, const int mode = CTextBox::AUTO_WIDTH, Font* font_text = NULL, diff --git a/src/gui/imageinfo.cpp b/src/gui/imageinfo.cpp index 66ccfdca8..366b5cb5b 100644 --- a/src/gui/imageinfo.cpp +++ b/src/gui/imageinfo.cpp @@ -59,6 +59,7 @@ CImageInfo::CImageInfo(): config ('\t') void CImageInfo::Init(void) { cc_win = NULL; + cc_lic = NULL; item_offset = 20; item_top = item_offset; license_txt = ""; @@ -73,6 +74,21 @@ CImageInfo::~CImageInfo() delete cc_win; } +void CImageInfo::ScrollLic(bool scrollDown) +{ + if (cc_lic && (cc_lic->cctext)) { + CTextBox* ctb = cc_lic->cctext->getCCItemTextBoxInst(); + if (ctb) { + ctb->enableBackgroundPaint(true); + if (scrollDown) + ctb->scrollPageDown(1); + else + ctb->scrollPageUp(1); + ctb->enableBackgroundPaint(false); + } + } +} + int CImageInfo::exec(CMenuTarget* parent, const std::string &) { int res = menu_return::RETURN_REPAINT; @@ -98,6 +114,12 @@ int CImageInfo::exec(CMenuTarget* parent, const std::string &) res = menu_return::RETURN_EXIT_ALL; break; } + else if ((msg == CRCInput::RC_up) || (msg == CRCInput::RC_page_up)) { + ScrollLic(false); + } + else if ((msg == CRCInput::RC_down) || (msg == CRCInput::RC_page_down)) { + ScrollLic(true); + } else if (msg <= CRCInput::RC_MaxRC){ break; } @@ -271,8 +293,8 @@ void CImageInfo::InitLicenseText() } in.close(); - CComponentsInfoBox *cc_lic = new CComponentsInfoBox(item_offset, item_top, cc_win->getWidth()-2*item_offset, cc_win->getHeight()-item_top); - cc_lic->setText(license_txt, CTextBox::AUTO_WIDTH, g_Font[SNeutrinoSettings::FONT_TYPE_MENU_HINT]); + cc_lic = new CComponentsInfoBox(item_offset, item_top, cc_win->getWidth()-2*item_offset, cc_win->getHeight()-item_top); + cc_lic->setText(license_txt, CTextBox::AUTO_WIDTH | CTextBox::SCROLL, g_Font[SNeutrinoSettings::FONT_TYPE_MENU_HINT]); //add text to container cc_win->addCCItem(cc_lic); diff --git a/src/gui/imageinfo.h b/src/gui/imageinfo.h index f04a26a58..9591155cc 100644 --- a/src/gui/imageinfo.h +++ b/src/gui/imageinfo.h @@ -54,8 +54,10 @@ class CImageInfo : public CMenuTarget void InitSupportInfos(); void ShowWindow(); void InitLicenseText(); + void ScrollLic(bool scrollDown); CComponentsWindow *cc_win; + CComponentsInfoBox *cc_lic; CConfigFile config; public: From 0dc4686874ddc3ad8a7ed1b08dfc23270ea84979 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Wed, 20 Mar 2013 09:08:22 +0100 Subject: [PATCH 197/224] fix license text, sorry, was a c&p error --- src/gui/components/cc.h | 10 +++++----- src/gui/components/cc_base.cpp | 10 +++++----- src/gui/components/cc_detailsline.cpp | 10 +++++----- src/gui/components/cc_frm.cpp | 10 +++++----- src/gui/components/cc_frm_header.cpp | 10 +++++----- src/gui/components/cc_frm_icons.cpp | 10 +++++----- src/gui/components/cc_frm_window.cpp | 10 +++++----- src/gui/components/cc_item.cpp | 10 +++++----- src/gui/components/cc_item_box.cpp | 10 +++++----- src/gui/components/cc_item_infobox.cpp | 10 +++++----- src/gui/components/cc_item_picture.cpp | 10 +++++----- src/gui/components/cc_item_shapes.cpp | 10 +++++----- src/gui/components/cc_item_text.cpp | 10 +++++----- src/gui/components/cc_item_tvpig.cpp | 10 +++++----- src/gui/components/cc_types.h | 10 +++++----- src/gui/imageinfo.cpp | 4 ++-- src/gui/imageinfo.h | 4 ++-- src/gui/personalize.cpp | 10 +++++----- src/gui/personalize.h | 10 +++++----- src/gui/start_wizard.cpp | 8 ++++---- src/gui/start_wizard.h | 8 ++++---- src/gui/update_ext.cpp | 10 +++++----- src/gui/update_ext.h | 10 +++++----- src/gui/update_menue.cpp | 2 +- src/gui/update_menue.h | 2 +- src/gui/update_settings.cpp | 2 +- src/gui/update_settings.h | 2 +- src/gui/user_menue.cpp | 10 +++++----- src/gui/user_menue.h | 10 +++++----- 29 files changed, 121 insertions(+), 121 deletions(-) diff --git a/src/gui/components/cc.h b/src/gui/components/cc.h index 6e6da091a..9a8f89ddf 100644 --- a/src/gui/components/cc.h +++ b/src/gui/components/cc.h @@ -7,18 +7,18 @@ License: GPL - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. - This library is distributed in the hope that it will be useful, + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. - You should have received a copy of the GNU Library General Public - License along with this library; if not, write to the + You should have received a copy of the GNU General Public + License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ diff --git a/src/gui/components/cc_base.cpp b/src/gui/components/cc_base.cpp index c9f71bb31..7655019b9 100644 --- a/src/gui/components/cc_base.cpp +++ b/src/gui/components/cc_base.cpp @@ -8,18 +8,18 @@ License: GPL - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. - This library is distributed in the hope that it will be useful, + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. - You should have received a copy of the GNU Library General Public - License along with this library; if not, write to the + You should have received a copy of the GNU General Public + License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ diff --git a/src/gui/components/cc_detailsline.cpp b/src/gui/components/cc_detailsline.cpp index e22b89474..bae3e163b 100644 --- a/src/gui/components/cc_detailsline.cpp +++ b/src/gui/components/cc_detailsline.cpp @@ -8,18 +8,18 @@ License: GPL - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. - This library is distributed in the hope that it will be useful, + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. - You should have received a copy of the GNU Library General Public - License along with this library; if not, write to the + You should have received a copy of the GNU General Public + License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ diff --git a/src/gui/components/cc_frm.cpp b/src/gui/components/cc_frm.cpp index d6d40efda..34d38c361 100644 --- a/src/gui/components/cc_frm.cpp +++ b/src/gui/components/cc_frm.cpp @@ -8,18 +8,18 @@ License: GPL - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. - This library is distributed in the hope that it will be useful, + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. - You should have received a copy of the GNU Library General Public - License along with this library; if not, write to the + You should have received a copy of the GNU General Public + License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ diff --git a/src/gui/components/cc_frm_header.cpp b/src/gui/components/cc_frm_header.cpp index a189cd055..440ffba39 100644 --- a/src/gui/components/cc_frm_header.cpp +++ b/src/gui/components/cc_frm_header.cpp @@ -8,18 +8,18 @@ License: GPL - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. - This library is distributed in the hope that it will be useful, + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. - You should have received a copy of the GNU Library General Public - License along with this library; if not, write to the + You should have received a copy of the GNU General Public + License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ diff --git a/src/gui/components/cc_frm_icons.cpp b/src/gui/components/cc_frm_icons.cpp index fe79d9495..5d484a0d7 100644 --- a/src/gui/components/cc_frm_icons.cpp +++ b/src/gui/components/cc_frm_icons.cpp @@ -8,18 +8,18 @@ License: GPL - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. - This library is distributed in the hope that it will be useful, + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. - You should have received a copy of the GNU Library General Public - License along with this library; if not, write to the + You should have received a copy of the GNU General Public + License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ diff --git a/src/gui/components/cc_frm_window.cpp b/src/gui/components/cc_frm_window.cpp index d62deecd5..461847b24 100644 --- a/src/gui/components/cc_frm_window.cpp +++ b/src/gui/components/cc_frm_window.cpp @@ -8,18 +8,18 @@ License: GPL - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. - This library is distributed in the hope that it will be useful, + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. - You should have received a copy of the GNU Library General Public - License along with this library; if not, write to the + You should have received a copy of the GNU General Public + License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ diff --git a/src/gui/components/cc_item.cpp b/src/gui/components/cc_item.cpp index 8f60142a5..92fd55c7c 100644 --- a/src/gui/components/cc_item.cpp +++ b/src/gui/components/cc_item.cpp @@ -8,18 +8,18 @@ License: GPL - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. - This library is distributed in the hope that it will be useful, + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. - You should have received a copy of the GNU Library General Public - License along with this library; if not, write to the + You should have received a copy of the GNU General Public + License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ diff --git a/src/gui/components/cc_item_box.cpp b/src/gui/components/cc_item_box.cpp index 4f80161fd..4c95cb168 100644 --- a/src/gui/components/cc_item_box.cpp +++ b/src/gui/components/cc_item_box.cpp @@ -8,18 +8,18 @@ License: GPL - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. - This library is distributed in the hope that it will be useful, + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. - You should have received a copy of the GNU Library General Public - License along with this library; if not, write to the + You should have received a copy of the GNU General Public + License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ diff --git a/src/gui/components/cc_item_infobox.cpp b/src/gui/components/cc_item_infobox.cpp index d8c248118..c8e5987de 100644 --- a/src/gui/components/cc_item_infobox.cpp +++ b/src/gui/components/cc_item_infobox.cpp @@ -8,18 +8,18 @@ License: GPL - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. - This library is distributed in the hope that it will be useful, + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. - You should have received a copy of the GNU Library General Public - License along with this library; if not, write to the + You should have received a copy of the GNU General Public + License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ diff --git a/src/gui/components/cc_item_picture.cpp b/src/gui/components/cc_item_picture.cpp index d330204be..1857ac0fe 100644 --- a/src/gui/components/cc_item_picture.cpp +++ b/src/gui/components/cc_item_picture.cpp @@ -8,18 +8,18 @@ License: GPL - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. - This library is distributed in the hope that it will be useful, + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. - You should have received a copy of the GNU Library General Public - License along with this library; if not, write to the + You should have received a copy of the GNU General Public + License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ diff --git a/src/gui/components/cc_item_shapes.cpp b/src/gui/components/cc_item_shapes.cpp index 4c4a71001..abe5826d2 100644 --- a/src/gui/components/cc_item_shapes.cpp +++ b/src/gui/components/cc_item_shapes.cpp @@ -8,18 +8,18 @@ License: GPL - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. - This library is distributed in the hope that it will be useful, + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. - You should have received a copy of the GNU Library General Public - License along with this library; if not, write to the + You should have received a copy of the GNU General Public + License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ diff --git a/src/gui/components/cc_item_text.cpp b/src/gui/components/cc_item_text.cpp index 74f726976..432abfda0 100644 --- a/src/gui/components/cc_item_text.cpp +++ b/src/gui/components/cc_item_text.cpp @@ -8,18 +8,18 @@ License: GPL - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. - This library is distributed in the hope that it will be useful, + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. - You should have received a copy of the GNU Library General Public - License along with this library; if not, write to the + You should have received a copy of the GNU General Public + License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ diff --git a/src/gui/components/cc_item_tvpig.cpp b/src/gui/components/cc_item_tvpig.cpp index a94e9cd4d..d14a674cf 100644 --- a/src/gui/components/cc_item_tvpig.cpp +++ b/src/gui/components/cc_item_tvpig.cpp @@ -8,18 +8,18 @@ License: GPL - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. - This library is distributed in the hope that it will be useful, + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. - You should have received a copy of the GNU Library General Public - License along with this library; if not, write to the + You should have received a copy of the GNU General Public + License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ diff --git a/src/gui/components/cc_types.h b/src/gui/components/cc_types.h index 32495657c..4dc39ef2d 100644 --- a/src/gui/components/cc_types.h +++ b/src/gui/components/cc_types.h @@ -7,18 +7,18 @@ License: GPL - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. - This library is distributed in the hope that it will be useful, + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. - You should have received a copy of the GNU Library General Public - License along with this library; if not, write to the + You should have received a copy of the GNU General Public + License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ diff --git a/src/gui/imageinfo.cpp b/src/gui/imageinfo.cpp index 366b5cb5b..0e902092f 100644 --- a/src/gui/imageinfo.cpp +++ b/src/gui/imageinfo.cpp @@ -17,8 +17,8 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - You should have received a copy of the GNU Library General Public - License along with this library; if not, write to the + You should have received a copy of the GNU General Public + License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ diff --git a/src/gui/imageinfo.h b/src/gui/imageinfo.h index 9591155cc..95b0c5c4a 100644 --- a/src/gui/imageinfo.h +++ b/src/gui/imageinfo.h @@ -17,8 +17,8 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - You should have received a copy of the GNU Library General Public - License along with this library; if not, write to the + You should have received a copy of the GNU General Public + License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ diff --git a/src/gui/personalize.cpp b/src/gui/personalize.cpp index d42abf8f9..4cebbb484 100644 --- a/src/gui/personalize.cpp +++ b/src/gui/personalize.cpp @@ -24,18 +24,18 @@ License: GPL - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. - This library is distributed in the hope that it will be useful, + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. - You should have received a copy of the GNU Library General Public - License along with this library; if not, write to the + You should have received a copy of the GNU General Public + License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. diff --git a/src/gui/personalize.h b/src/gui/personalize.h index b3c00ea97..9b6a452c4 100644 --- a/src/gui/personalize.h +++ b/src/gui/personalize.h @@ -24,18 +24,18 @@ License: GPL - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. - This library is distributed in the hope that it will be useful, + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. - You should have received a copy of the GNU Library General Public - License along with this library; if not, write to the + You should have received a copy of the GNU General Public + License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. diff --git a/src/gui/start_wizard.cpp b/src/gui/start_wizard.cpp index 991835987..0f0ccacd0 100644 --- a/src/gui/start_wizard.cpp +++ b/src/gui/start_wizard.cpp @@ -14,17 +14,17 @@ License: GPL This software is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public + modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. - This library is distributed in the hope that it will be useful, + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. - You should have received a copy of the GNU Library General Public - License along with this library; if not, write to the + You should have received a copy of the GNU General Public + License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. diff --git a/src/gui/start_wizard.h b/src/gui/start_wizard.h index 2fbafcb6a..4b8e51641 100644 --- a/src/gui/start_wizard.h +++ b/src/gui/start_wizard.h @@ -14,17 +14,17 @@ License: GPL This software is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public + modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. - This library is distributed in the hope that it will be useful, + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. - You should have received a copy of the GNU Library General Public - License along with this library; if not, write to the + You should have received a copy of the GNU General Public + License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. diff --git a/src/gui/update_ext.cpp b/src/gui/update_ext.cpp index 2b7d67824..cc5920007 100644 --- a/src/gui/update_ext.cpp +++ b/src/gui/update_ext.cpp @@ -9,18 +9,18 @@ License: GPL - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. - This library is distributed in the hope that it will be useful, + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. - You should have received a copy of the GNU Library General Public - License along with this library; if not, write to the + You should have received a copy of the GNU General Public + License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ diff --git a/src/gui/update_ext.h b/src/gui/update_ext.h index d327fab24..fa196f658 100644 --- a/src/gui/update_ext.h +++ b/src/gui/update_ext.h @@ -9,18 +9,18 @@ License: GPL - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. - This library is distributed in the hope that it will be useful, + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. - You should have received a copy of the GNU Library General Public - License along with this library; if not, write to the + You should have received a copy of the GNU General Public + License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ diff --git a/src/gui/update_menue.cpp b/src/gui/update_menue.cpp index c93a40ec5..55fe6ce46 100644 --- a/src/gui/update_menue.cpp +++ b/src/gui/update_menue.cpp @@ -24,7 +24,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - You should have received a copy of the GNU Library General Public + You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. diff --git a/src/gui/update_menue.h b/src/gui/update_menue.h index 8948a49f6..5daf34f38 100644 --- a/src/gui/update_menue.h +++ b/src/gui/update_menue.h @@ -23,7 +23,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - You should have received a copy of the GNU Library General Public + You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. diff --git a/src/gui/update_settings.cpp b/src/gui/update_settings.cpp index fecfa1912..7c7742194 100644 --- a/src/gui/update_settings.cpp +++ b/src/gui/update_settings.cpp @@ -22,7 +22,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - You should have received a copy of the GNU Library General Public + You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. diff --git a/src/gui/update_settings.h b/src/gui/update_settings.h index c58676774..65ffbb9db 100644 --- a/src/gui/update_settings.h +++ b/src/gui/update_settings.h @@ -22,7 +22,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - You should have received a copy of the GNU Library General Public + You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. diff --git a/src/gui/user_menue.cpp b/src/gui/user_menue.cpp index 1318fe662..123066d18 100644 --- a/src/gui/user_menue.cpp +++ b/src/gui/user_menue.cpp @@ -14,18 +14,18 @@ License: GPL - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. - This library is distributed in the hope that it will be useful, + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. - You should have received a copy of the GNU Library General Public - License along with this library; if not, write to the + You should have received a copy of the GNU General Public + License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. diff --git a/src/gui/user_menue.h b/src/gui/user_menue.h index 05bec067e..701a25af7 100644 --- a/src/gui/user_menue.h +++ b/src/gui/user_menue.h @@ -12,18 +12,18 @@ License: GPL - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. - This library is distributed in the hope that it will be useful, + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. - You should have received a copy of the GNU Library General Public - License along with this library; if not, write to the + You should have received a copy of the GNU General Public + License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. From 322de62366c1a89d406c520e54f036dbaa0c01fb Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Thu, 21 Mar 2013 08:12:12 +0100 Subject: [PATCH 198/224] CImageInfo: move ScrollLic() to end of file and add comments --- src/gui/imageinfo.cpp | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/src/gui/imageinfo.cpp b/src/gui/imageinfo.cpp index 0e902092f..5d450cb6f 100644 --- a/src/gui/imageinfo.cpp +++ b/src/gui/imageinfo.cpp @@ -74,21 +74,6 @@ CImageInfo::~CImageInfo() delete cc_win; } -void CImageInfo::ScrollLic(bool scrollDown) -{ - if (cc_lic && (cc_lic->cctext)) { - CTextBox* ctb = cc_lic->cctext->getCCItemTextBoxInst(); - if (ctb) { - ctb->enableBackgroundPaint(true); - if (scrollDown) - ctb->scrollPageDown(1); - else - ctb->scrollPageUp(1); - ctb->enableBackgroundPaint(false); - } - } -} - int CImageInfo::exec(CMenuTarget* parent, const std::string &) { int res = menu_return::RETURN_REPAINT; @@ -300,6 +285,23 @@ void CImageInfo::InitLicenseText() cc_win->addCCItem(cc_lic); } +//scroll licens text +void CImageInfo::ScrollLic(bool scrollDown) +{ + if (cc_lic && (cc_lic->cctext)) { + //get the textbox instance from infobox object and use CTexBbox scroll methods + CTextBox* ctb = cc_lic->cctext->getCCItemTextBoxInst(); + if (ctb) { + ctb->enableBackgroundPaint(true); + if (scrollDown) + ctb->scrollPageDown(1); + else + ctb->scrollPageUp(1); + ctb->enableBackgroundPaint(false); + } + } +} + void CImageInfo::hide() From 6b68259ac65949edb3e1eae32382c991e207d05a Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Thu, 21 Mar 2013 09:54:00 +0100 Subject: [PATCH 199/224] CComponentsText: rename getCCItemTextBoxInst -> getCTextBoxObject This name should be more plausible --- src/gui/components/cc.h | 3 ++- src/gui/imageinfo.cpp | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/gui/components/cc.h b/src/gui/components/cc.h index 9a8f89ddf..8fee53eea 100644 --- a/src/gui/components/cc.h +++ b/src/gui/components/cc.h @@ -202,7 +202,8 @@ class CComponentsText : public CComponentsItem virtual void setText(neutrino_locale_t locale_text, const int mode = ~CTextBox::AUTO_WIDTH, Font* font_text = NULL); virtual void removeLineBreaks(std::string& str); - CTextBox* getCCItemTextBoxInst() { return ct_textbox; }; + //get a Text Box object, so it's possible to get access directly to its methods + CTextBox* getCTextBoxObject() { return ct_textbox; }; }; class CComponentsLabel : public CComponentsText diff --git a/src/gui/imageinfo.cpp b/src/gui/imageinfo.cpp index 5d450cb6f..021539e68 100644 --- a/src/gui/imageinfo.cpp +++ b/src/gui/imageinfo.cpp @@ -290,7 +290,7 @@ void CImageInfo::ScrollLic(bool scrollDown) { if (cc_lic && (cc_lic->cctext)) { //get the textbox instance from infobox object and use CTexBbox scroll methods - CTextBox* ctb = cc_lic->cctext->getCCItemTextBoxInst(); + CTextBox* ctb = cc_lic->cctext->getCTextBoxObject(); if (ctb) { ctb->enableBackgroundPaint(true); if (scrollDown) From 407d9fe800f70b74272a0ddf2a1382e04f5417c8 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Thu, 21 Mar 2013 11:38:40 +0100 Subject: [PATCH 200/224] CChannelList: remove details line on changing pages details line was not completely killed changed page. --- src/gui/channellist.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/gui/channellist.cpp b/src/gui/channellist.cpp index 54dbc5561..f14529d38 100644 --- a/src/gui/channellist.cpp +++ b/src/gui/channellist.cpp @@ -740,6 +740,8 @@ int CChannelList::show() actzap = updateSelection(new_selected); } else if (msg == (neutrino_msg_t)g_settings.key_bouquet_up) { + if (dline) + dline->kill(); //kill details line on change to next page if (!bouquetList->Bouquets.empty()) { bool found = true; uint32_t nNext = (bouquetList->getActiveBouquetNumber()+1) % bouquetList->Bouquets.size(); @@ -762,6 +764,8 @@ int CChannelList::show() } } else if (msg == (neutrino_msg_t)g_settings.key_bouquet_down) { + if (dline) + dline->kill(); //kill details line on change to previous page if (!bouquetList->Bouquets.empty()) { bool found = true; int nNext = (bouquetList->getActiveBouquetNumber()+bouquetList->Bouquets.size()-1) % bouquetList->Bouquets.size(); From d90ae614494fc14f74599c8ef1cb022319dac803 Mon Sep 17 00:00:00 2001 From: svenhoefer Date: Thu, 21 Mar 2013 12:13:16 +0100 Subject: [PATCH 201/224] - bouquetlist.cpp: fix buttonbar --- src/gui/bouquetlist.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/gui/bouquetlist.cpp b/src/gui/bouquetlist.cpp index 17585c33e..396b437cf 100644 --- a/src/gui/bouquetlist.cpp +++ b/src/gui/bouquetlist.cpp @@ -601,8 +601,6 @@ void CBouquetList::paint() int numbuttons = sizeof(CBouquetListButtons)/sizeof(CBouquetListButtons[0]); if (favonly) /* this actually shows favorites and providers button, but both are active anyway */ numbuttons = 2; - ::paintButtons(x, y + (height - footerHeight), width, numbuttons, CBouquetListButtons, width, footerHeight); - ::paintButtons(x, y + (height - footerHeight), width, numbuttons, CBouquetListButtons, footerHeight); if(!Bouquets.empty()) From 92f11c1e62cc40cb7c97edfc462e90da3004406a Mon Sep 17 00:00:00 2001 From: svenhoefer Date: Thu, 21 Mar 2013 12:33:09 +0100 Subject: [PATCH 202/224] - bouquetlist.cpp: use existing loop to calc max height of buttons --- src/gui/bouquetlist.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/gui/bouquetlist.cpp b/src/gui/bouquetlist.cpp index 396b437cf..f92839efe 100644 --- a/src/gui/bouquetlist.cpp +++ b/src/gui/bouquetlist.cpp @@ -326,6 +326,7 @@ int CBouquetList::show(bool bShowChannelList) int icol_w, icol_h; int w_max_text = 0; int w_max_icon = 0; + int h_max_icon = 0; favonly = !bShowChannelList; for(unsigned int count = 0; count < sizeof(CBouquetListButtons)/sizeof(CBouquetListButtons[0]);count++){ @@ -333,6 +334,7 @@ int CBouquetList::show(bool bShowChannelList) w_max_text = std::max(w_max_text, w_text); frameBuffer->getIconSize(CBouquetListButtons[count].button, &icol_w, &icol_h); w_max_icon = std::max(w_max_icon, icol_w); + h_max_icon = std::max(h_max_icon, icol_h); } int need_width = sizeof(CBouquetListButtons)/sizeof(CBouquetListButtons[0])*(w_max_icon + w_max_text + 20); @@ -342,10 +344,7 @@ int CBouquetList::show(bool bShowChannelList) width = w_max (need_width, 20);//500 height = h_max (16 * fheight, 40); - /* assuming all color icons must have same size */ - frameBuffer->getIconSize(NEUTRINO_ICON_BUTTON_RED, &icol_w, &icol_h); - - footerHeight = std::max(icol_h+8, g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL]->getHeight()+8); //TODO get footerHeight from buttons + footerHeight = std::max(h_max_icon+8, g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL]->getHeight()+8); theight = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]->getHeight(); listmaxshow = (height - theight - footerHeight)/fheight; height = theight + footerHeight + listmaxshow * fheight; // recalc height From 8196cf76714afe70c81ba2e7157f8ce21e2e2285 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Fri, 22 Mar 2013 15:27:15 +0100 Subject: [PATCH 203/224] CComponentsPIP: paint alternate picture if no tv mode Use setPicture() to change image on runtime. --- src/gui/components/cc.h | 2 ++ src/gui/components/cc_item_tvpig.cpp | 17 ++++++++++++++++- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/src/gui/components/cc.h b/src/gui/components/cc.h index 8fee53eea..11a1be02a 100644 --- a/src/gui/components/cc.h +++ b/src/gui/components/cc.h @@ -277,6 +277,7 @@ class CComponentsPIP : public CComponentsItem { private: int screen_w, screen_h; + std::string pic_name; //alternate picture if is no tv picture available public: CComponentsPIP( const int x_pos, const int y_pos, const int percent = 30, bool has_shadow = CC_SHADOW_OFF); ~CComponentsPIP(); @@ -285,6 +286,7 @@ class CComponentsPIP : public CComponentsItem void hide(bool no_restore = false); void setScreenWidth(int screen_width){screen_w = screen_width;}; void setScreenHeight(int screen_heigth){screen_h = screen_heigth;}; + void setPicture(const std::string& image){pic_name = image;}; }; diff --git a/src/gui/components/cc_item_tvpig.cpp b/src/gui/components/cc_item_tvpig.cpp index d14a674cf..3544fea58 100644 --- a/src/gui/components/cc_item_tvpig.cpp +++ b/src/gui/components/cc_item_tvpig.cpp @@ -49,6 +49,8 @@ CComponentsPIP::CComponentsPIP( const int x_pos, const int y_pos, const int perc //CComponentsPIP screen_w = frameBuffer->getScreenWidth(true); screen_h = frameBuffer->getScreenHeight(true); + pic_name = DATADIR; + pic_name += "/neutrino/icons/start.jpg"; //CComponents x = x_pos; @@ -72,8 +74,21 @@ CComponentsPIP::~CComponentsPIP() void CComponentsPIP::paint(bool do_save_bg) { + int pig_x = x+fr_thickness; + int pig_y = y+fr_thickness; + int pig_w = width-2*fr_thickness; + int pig_h = height-2*fr_thickness; + paintInit(do_save_bg); - videoDecoder->Pig(x+fr_thickness, y+fr_thickness, width-2*fr_thickness, height-2*fr_thickness, screen_w, screen_h); + + if(CNeutrinoApp::getInstance()->getMode() == NeutrinoMessages::mode_tv){ + videoDecoder->Pig(pig_x, pig_y, pig_w, pig_h, screen_w, screen_h); + } + else{ //paint an alternate image if no tv mode available + CComponentsPicture pic = CComponentsPicture (pig_x, pig_y, pig_w, pig_h, pic_name); + pic.paint(); + } + } From cc31a41f43628e02fc654ed522549ab0eb1de89b Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Fri, 22 Mar 2013 16:58:56 +0100 Subject: [PATCH 204/224] CComponentsWindow/Header: fix add of header buttons setHeaderButtons was without effect --- src/gui/components/cc.h | 4 +++- src/gui/components/cc_frm_header.cpp | 7 +++++++ src/gui/components/cc_frm_window.cpp | 2 ++ 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/gui/components/cc.h b/src/gui/components/cc.h index 11a1be02a..8400f858b 100644 --- a/src/gui/components/cc.h +++ b/src/gui/components/cc.h @@ -511,7 +511,7 @@ class CComponentsHeader : public CComponentsForm void setHeaderIcon(const char* icon_name); void addHeaderButton(const std::string& button_name); void removeHeaderButtons(); - void setHeaderButtons(const int buttons){cch_buttons = buttons;}; + void setHeaderDefaultButtons(const int buttons); void initCCHeaderItems(); }; @@ -522,6 +522,7 @@ class CComponentsWindow : public CComponentsForm std::string ccw_caption; const char* ccw_icon_name; int ccw_start_y; + int ccw_buttons; void initHeader(); void initCCWItems(); @@ -543,6 +544,7 @@ class CComponentsWindow : public CComponentsForm void setWindowCaption(const std::string& text){ccw_caption = text;}; void setWindowCaption(neutrino_locale_t locale_text); void setWindowIcon(const char* iconname){ccw_icon_name = iconname;}; + void setWindowHeaderButtons(const int& buttons){ccw_buttons = buttons;}; int getStartY(); //y value for start of the area below header }; diff --git a/src/gui/components/cc_frm_header.cpp b/src/gui/components/cc_frm_header.cpp index 440ffba39..72d3168c6 100644 --- a/src/gui/components/cc_frm_header.cpp +++ b/src/gui/components/cc_frm_header.cpp @@ -221,6 +221,13 @@ void CComponentsHeader::initCCHDefaultButtons() #endif } +void CComponentsHeader::setHeaderDefaultButtons(const int buttons) +{ + cch_buttons = buttons; + v_cch_btn.clear(); + initCCHDefaultButtons(); +} + // calculate minimal width of icon form void CComponentsHeader::initCCButtonFormSize() { diff --git a/src/gui/components/cc_frm_window.cpp b/src/gui/components/cc_frm_window.cpp index 461847b24..6a46ade97 100644 --- a/src/gui/components/cc_frm_window.cpp +++ b/src/gui/components/cc_frm_window.cpp @@ -82,6 +82,7 @@ void CComponentsWindow::initVarWindow() ccw_caption = ""; ccw_icon_name = NULL; ccw_start_y = 0; + ccw_buttons = 0; //no header buttons setShadowOnOff(true); } @@ -109,6 +110,7 @@ void CComponentsWindow::initHeader() ccw_head->setHeaderText(ccw_caption); ccw_head->initCCHeaderItems(); ccw_start_y = ccw_head->getHeight(); + ccw_head->setHeaderDefaultButtons(ccw_buttons); } } From e7984e6c73a17bfe6febfaf19a03f9e3035d238e Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Fri, 22 Mar 2013 17:13:22 +0100 Subject: [PATCH 205/224] CImageInfo: add header buttons --- src/gui/imageinfo.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/gui/imageinfo.cpp b/src/gui/imageinfo.cpp index 021539e68..e90ab2498 100644 --- a/src/gui/imageinfo.cpp +++ b/src/gui/imageinfo.cpp @@ -131,6 +131,7 @@ void CImageInfo::ShowWindow() if (cc_win == NULL){ cc_win = new CComponentsWindow(LOCALE_IMAGEINFO_HEAD, NEUTRINO_ICON_INFO); item_top = cc_win->getStartY() + item_offset; + cc_win->setWindowHeaderButtons(CComponentsHeader::CC_BTN_MENU | CComponentsHeader::CC_BTN_EXIT); } //prepare minitv: important! init the minitv object as first From b07c4231ef3b1688be2cb64ed73bdec719718de1 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Fri, 22 Mar 2013 23:12:08 +0100 Subject: [PATCH 206/224] CComponentsPIP: apply left align for image, dont' save screen This ensures a clean end on the left edge and save screen is not needed. --- src/gui/components/cc_item_tvpig.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/gui/components/cc_item_tvpig.cpp b/src/gui/components/cc_item_tvpig.cpp index 3544fea58..eedc4e65e 100644 --- a/src/gui/components/cc_item_tvpig.cpp +++ b/src/gui/components/cc_item_tvpig.cpp @@ -82,11 +82,11 @@ void CComponentsPIP::paint(bool do_save_bg) paintInit(do_save_bg); if(CNeutrinoApp::getInstance()->getMode() == NeutrinoMessages::mode_tv){ - videoDecoder->Pig(pig_x, pig_y, pig_w, pig_h, screen_w, screen_h); + videoDecoder->Pig(pig_x+2, pig_y, pig_w, pig_h, screen_w, screen_h); } else{ //paint an alternate image if no tv mode available - CComponentsPicture pic = CComponentsPicture (pig_x, pig_y, pig_w, pig_h, pic_name); - pic.paint(); + CComponentsPicture pic = CComponentsPicture (pig_x, pig_y, pig_w, pig_h, pic_name, CC_ALIGN_LEFT); + pic.paint(CC_SAVE_SCREEN_NO); } } From c99e23289bc291475b075f606dff2001a7624481 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Sun, 24 Mar 2013 16:08:45 +0100 Subject: [PATCH 207/224] CComponentsLabel: add missing item type --- src/gui/components/cc.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/gui/components/cc.h b/src/gui/components/cc.h index 8400f858b..644457254 100644 --- a/src/gui/components/cc.h +++ b/src/gui/components/cc.h @@ -116,6 +116,7 @@ class CComponentsItem : public CComponents CC_ITEMTYPE_FRM_HEADER, CC_ITEMTYPE_FRM_ICONFORM, CC_ITEMTYPE_FRM_WINDOW, + CC_ITEMTYPE_LABEL, CC_ITEMTYPES }; @@ -213,10 +214,14 @@ class CComponentsLabel : public CComponentsText const char* text = "", const int mode = CTextBox::AUTO_WIDTH, Font* font_text = NULL, bool has_shadow = CC_SHADOW_OFF, fb_pixel_t color_text = COL_MENUCONTENTINACTIVE, fb_pixel_t color_frame = COL_MENUCONTENT_PLUS_6, fb_pixel_t color_body = COL_MENUCONTENT_PLUS_0, fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0) - :CComponentsText(x_pos, y_pos, w, h, text, mode, font_text, has_shadow, color_text, color_frame, color_body, color_shadow){}; + :CComponentsText(x_pos, y_pos, w, h, text, mode, font_text, has_shadow, color_text, color_frame, color_body, color_shadow) + { + cc_item_type = CC_ITEMTYPE_LABEL; + }; CComponentsLabel():CComponentsText() { initVarText(); + cc_item_type = CC_ITEMTYPE_LABEL; ct_col_text = COL_MENUCONTENTINACTIVE; }; }; From 3f3a767104e5c440f2d87d7f31a1dd8ef4a27317 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Sun, 24 Mar 2013 16:17:55 +0100 Subject: [PATCH 208/224] CImageInfo: add item_offset also to bottom of license text --- src/gui/imageinfo.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/imageinfo.cpp b/src/gui/imageinfo.cpp index e90ab2498..e53ba955b 100644 --- a/src/gui/imageinfo.cpp +++ b/src/gui/imageinfo.cpp @@ -279,7 +279,7 @@ void CImageInfo::InitLicenseText() } in.close(); - cc_lic = new CComponentsInfoBox(item_offset, item_top, cc_win->getWidth()-2*item_offset, cc_win->getHeight()-item_top); + cc_lic = new CComponentsInfoBox(item_offset, item_top, cc_win->getWidth()-2*item_offset, cc_win->getHeight()-item_top-item_offset); cc_lic->setText(license_txt, CTextBox::AUTO_WIDTH | CTextBox::SCROLL, g_Font[SNeutrinoSettings::FONT_TYPE_MENU_HINT]); //add text to container From deab17dc2507313cda192d89c5872b6c6feb97a0 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Sun, 24 Mar 2013 21:13:00 +0100 Subject: [PATCH 209/224] CChannelList: ensure new init of dline Causes correct paint of details line, if osd settings have been changed. --- src/gui/channellist.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/gui/channellist.cpp b/src/gui/channellist.cpp index f14529d38..d44d0bc4c 100644 --- a/src/gui/channellist.cpp +++ b/src/gui/channellist.cpp @@ -1651,8 +1651,11 @@ void CChannelList::paintItem2DetailsLine (int pos) int ypos2a = ypos2 + (info_height/2)-2; fb_pixel_t col1 = COL_MENUCONTENT_PLUS_6; - if (dline) + if (dline){ dline->kill(); //kill details line + delete dline; + dline = NULL; + } // // Clear // frameBuffer->paintBackgroundBoxRel(xpos,y, ConnectLineBox_Width, height+info_height + 1); @@ -1663,7 +1666,6 @@ void CChannelList::paintItem2DetailsLine (int pos) //details line if (dline == NULL) dline = new CComponentsDetailLine(xpos, ypos1a, ypos2a, fheight/2+1, info_height-RADIUS_LARGE*2); - dline->setYPos(ypos1a); dline->paint(); //info box frame From 759966f9358e66bf65db9139f6f08c90b647bec4 Mon Sep 17 00:00:00 2001 From: svenhoefer Date: Mon, 25 Mar 2013 09:45:22 +0100 Subject: [PATCH 210/224] - strech most windows to full screen * switchable with existing switch for 'big_windows' * 'big_windows' default is on --- data/locale/deutsch.locale | 2 +- data/locale/english.locale | 2 +- src/driver/framebuffer.cpp | 11 +++++++++++ src/driver/framebuffer.h | 5 +++++ src/gui/audioplayer.cpp | 10 +++------- src/gui/bedit/bouqueteditor_bouquets.cpp | 9 ++++----- src/gui/bedit/bouqueteditor_channels.cpp | 15 +++++++-------- src/gui/bedit/bouqueteditor_chanselect.cpp | 14 ++++++-------- src/gui/channellist.cpp | 6 ++---- src/gui/epgview.cpp | 16 +++++----------- src/gui/filebrowser.cpp | 10 +++++----- src/gui/moviebrowser.cpp | 9 +++++---- src/gui/pictureviewer.cpp | 5 +++-- src/gui/upnpbrowser.cpp | 9 ++------- src/gui/widget/menue.cpp | 2 -- src/neutrino.cpp | 2 +- 16 files changed, 61 insertions(+), 66 deletions(-) diff --git a/data/locale/deutsch.locale b/data/locale/deutsch.locale index 8f52ef935..a44a21c5d 100644 --- a/data/locale/deutsch.locale +++ b/data/locale/deutsch.locale @@ -736,7 +736,7 @@ menu.hint_auto_subs Automatische Anzeige der Untertitel in Ihrer bevorzugten Spr menu.hint_back Zurück zum vorherigen Menü.\nDie Taste 'Menü' schließt alle Menüs menu.hint_backup Sichern von Konfigurationen und Kanallisten menu.hint_bedit Bearbeiten ihrer Favoriten und der Bouquets -menu.hint_bigwindows EPG-Informationen werden immer im großen Fenster angezeigt. Dies erreichen Sie auch mit der Taste 'Info' +menu.hint_bigwindows Kanalliste, EPG-Infos, Audioplayer und einige andere Fenster werden bildschirmfüllend angezeigt menu.hint_cache_txt Startet das Zwischenspeichern des Teletextes nach einem Kanalwechsel menu.hint_cec_mode CEC-Modus menu.hint_cec_standby CEC-Standby diff --git a/data/locale/english.locale b/data/locale/english.locale index 542766a20..e89182548 100644 --- a/data/locale/english.locale +++ b/data/locale/english.locale @@ -736,7 +736,7 @@ menu.hint_auto_subs Auto-start subtitles for preferred language menu.hint_back Return to previous menu\nPress menu key to close all menus menu.hint_backup Backup configs and channels to selected dir menu.hint_bedit Edit favorites and bouquets -menu.hint_bigwindows Always show big epg detail window\nelse 'info' button switch big font + window size +menu.hint_bigwindows Channellist, EPG-infos, audioplayer and some other windows are displayed full screen menu.hint_cache_txt Start teletext caching after channel switch menu.hint_cec_mode CEC mode menu.hint_cec_standby CEC standby diff --git a/src/driver/framebuffer.cpp b/src/driver/framebuffer.cpp index 26694221a..f833a3968 100644 --- a/src/driver/framebuffer.cpp +++ b/src/driver/framebuffer.cpp @@ -419,6 +419,17 @@ unsigned int CFrameBuffer::getScreenHeight(bool real) return g_settings.screen_EndY - g_settings.screen_StartY; } +unsigned int CFrameBuffer::getScreenWidthRel() +{ + // always reduce a possible detailline + return (g_settings.screen_EndX - g_settings.screen_StartX - 2*ConnectLineBox_Width) * (g_settings.big_windows ? 100 : NON_BIG_WINDOWS) / 100; +} + +unsigned int CFrameBuffer::getScreenHeightRel() +{ + return (g_settings.screen_EndY - g_settings.screen_StartY) * (g_settings.big_windows ? 100 : NON_BIG_WINDOWS) / 100; +} + unsigned int CFrameBuffer::getScreenX() { return g_settings.screen_StartX; diff --git a/src/driver/framebuffer.h b/src/driver/framebuffer.h index 9028b9d53..ea94c8d82 100644 --- a/src/driver/framebuffer.h +++ b/src/driver/framebuffer.h @@ -53,6 +53,9 @@ typedef struct fb_var_screeninfo t_fb_var_screeninfo; #define FADE_STEP 5 #define FADE_RESET 0xFFFF +#define NON_BIG_WINDOWS 85 // % +#define ConnectLineBox_Width 16 // px + /** Ausfuehrung als Singleton */ class CFrameBuffer { @@ -140,6 +143,8 @@ class CFrameBuffer unsigned int getStride() const; // size of a single line in the framebuffer (in bytes) unsigned int getScreenWidth(bool real = false); unsigned int getScreenHeight(bool real = false); + unsigned int getScreenWidthRel(); + unsigned int getScreenHeightRel(); unsigned int getScreenX(); unsigned int getScreenY(); diff --git a/src/gui/audioplayer.cpp b/src/gui/audioplayer.cpp index 76089d082..9c87241de 100644 --- a/src/gui/audioplayer.cpp +++ b/src/gui/audioplayer.cpp @@ -98,11 +98,6 @@ #include extern cVideo * videoDecoder; -#ifdef ConnectLineBox_Width -#undef ConnectLineBox_Width -#endif -#define ConnectLineBox_Width 16 - #define AUDIOPLAYERGUI_SMSKEY_TIMEOUT 1000 #define SHOW_FILE_LOAD_LIMIT 50 @@ -275,9 +270,10 @@ int CAudioPlayerGui::exec(CMenuTarget* parent, const std::string &actionKey) m_current = 0; m_selected = 0; - m_width=(g_settings.screen_EndX - g_settings.screen_StartX) - 2*ConnectLineBox_Width - 5; - m_height = (g_settings.screen_EndY - g_settings.screen_StartY - 5); + m_width = m_frameBuffer->getScreenWidthRel(); + m_height = m_frameBuffer->getScreenHeightRel(); + m_sheight = g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL]->getHeight(); m_buttonHeight = std::max(25, m_sheight); diff --git a/src/gui/bedit/bouqueteditor_bouquets.cpp b/src/gui/bedit/bouqueteditor_bouquets.cpp index 2710eb4f0..b24bf70b1 100644 --- a/src/gui/bedit/bouqueteditor_bouquets.cpp +++ b/src/gui/bedit/bouqueteditor_bouquets.cpp @@ -226,13 +226,12 @@ int CBEBouquetWidget::exec(CMenuTarget* parent, const std::string & /*actionKey* iheight = std::max(iheight, icol_h+2); iconoffset = std::max(iconoffset, icol_w); - int fw = g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL]->getWidth(); - width = w_max ((frameBuffer->getScreenWidth() / 20 * (fw+6)), 100); - height = h_max ((frameBuffer->getScreenHeight() / 20 * 18), (frameBuffer->getScreenHeight() / 20 * 2)); + width = frameBuffer->getScreenWidthRel(); + height = frameBuffer->getScreenHeightRel() - ButtonHeight; listmaxshow = (height-theight-0)/iheight; height = theight+0+listmaxshow*iheight; // recalc height - x = frameBuffer->getScreenX() + (frameBuffer->getScreenWidth() - width) / 2; - y = frameBuffer->getScreenY() + (frameBuffer->getScreenHeight() - height) / 2; + x = getScreenStartX(width); + y = getScreenStartY(height + ButtonHeight); Bouquets = &g_bouquetManager->Bouquets; paintHead(); diff --git a/src/gui/bedit/bouqueteditor_channels.cpp b/src/gui/bedit/bouqueteditor_channels.cpp index 14639c2d0..18db647a3 100644 --- a/src/gui/bedit/bouqueteditor_channels.cpp +++ b/src/gui/bedit/bouqueteditor_channels.cpp @@ -216,8 +216,6 @@ void CBEChannelWidget::paintDetails(int index) void CBEChannelWidget::initItem2DetailsLine (int pos, int /*ch_index*/) { -#define ConnectLineBox_Width 16 - int xpos = x - ConnectLineBox_Width; int ypos1 = y + theight+0 + pos*fheight; int ypos2 = y + height + INFO_BOX_Y_OFFSET; @@ -297,15 +295,16 @@ int CBEChannelWidget::exec(CMenuTarget* parent, const std::string & /*actionKey* if (parent) parent->hide(); - int fw = g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL]->getWidth(); - width = w_max ((frameBuffer->getScreenWidth() / 20 * (fw+6)), 100); - height = h_max ((frameBuffer->getScreenHeight() / 20 * 16), (frameBuffer->getScreenHeight() / 20 * 2)); + width = frameBuffer->getScreenWidthRel(); + info_height = 2*iheight + 4; + height = frameBuffer->getScreenHeightRel() - info_height; listmaxshow = (height-theight-footerHeight-0)/iheight; height = theight+footerHeight+listmaxshow*iheight; // recalc height - info_height = 2*iheight + 4; - x = frameBuffer->getScreenX() + (frameBuffer->getScreenWidth() - width) / 2; - y = frameBuffer->getScreenY() + (frameBuffer->getScreenHeight() - (height + info_height)) / 2; + x = getScreenStartX(width); + if (x < ConnectLineBox_Width) + x = ConnectLineBox_Width; + y = getScreenStartY(height + info_height); Channels = mode == CZapitClient::MODE_TV ? &(g_bouquetManager->Bouquets[bouquet]->tvChannels) : &(g_bouquetManager->Bouquets[bouquet]->radioChannels); paintHead(); diff --git a/src/gui/bedit/bouqueteditor_chanselect.cpp b/src/gui/bedit/bouqueteditor_chanselect.cpp index 7925ff8d6..586a80749 100644 --- a/src/gui/bedit/bouqueteditor_chanselect.cpp +++ b/src/gui/bedit/bouqueteditor_chanselect.cpp @@ -45,7 +45,6 @@ #include #include - extern CBouquetManager *g_bouquetManager; CBEChannelSelectWidget::CBEChannelSelectWidget(const std::string & Caption, unsigned int Bouquet, CZapitClient::channelsMode Mode) @@ -162,15 +161,16 @@ void CBEChannelSelectWidget::onOkKeyPressed() int CBEChannelSelectWidget::exec(CMenuTarget* parent, const std::string & actionKey) { - int fw = g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL]->getWidth(); - width = w_max ((frameBuffer->getScreenWidth() / 20 * (fw+6)), 100); - height = h_max ((frameBuffer->getScreenHeight() / 20 * 16), (frameBuffer->getScreenHeight() / 20 * 2)); + width = frameBuffer->getScreenWidthRel(); + height = frameBuffer->getScreenHeightRel(); listmaxshow = (height-theight-footerHeight-0)/iheight; height = theight+footerHeight+listmaxshow*iheight; // recalc height info_height = 2*iheight + 4; - x = frameBuffer->getScreenX() + (frameBuffer->getScreenWidth() - width) / 2; - y = frameBuffer->getScreenY() + (frameBuffer->getScreenHeight() - (height + info_height)) / 2; + x = getScreenStartX(width); + if (x < ConnectLineBox_Width) + x = ConnectLineBox_Width; + y = getScreenStartY(height + info_height); bouquetChannels = mode == CZapitClient::MODE_TV ? &(g_bouquetManager->Bouquets[bouquet]->tvChannels) : &(g_bouquetManager->Bouquets[bouquet]->radioChannels); @@ -236,8 +236,6 @@ void CBEChannelSelectWidget::paintDetails(int index) void CBEChannelSelectWidget::initItem2DetailsLine (int pos, int /*ch_index*/) { -#define ConnectLineBox_Width 16 - int xpos = x - ConnectLineBox_Width; int ypos1 = y + theight+0 + pos*fheight; int ypos2 = y + height + INFO_BOX_Y_OFFSET; diff --git a/src/gui/channellist.cpp b/src/gui/channellist.cpp index d44d0bc4c..3906856e9 100644 --- a/src/gui/channellist.cpp +++ b/src/gui/channellist.cpp @@ -94,8 +94,6 @@ extern int old_b_id; extern cVideo * videoDecoder; -#define ConnectLineBox_Width 16 - CChannelList::CChannelList(const char * const pName, bool phistoryMode, bool _vlist) { frameBuffer = CFrameBuffer::getInstance(); @@ -489,7 +487,7 @@ void CChannelList::calcSize() footerHeight = g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL]->getHeight()+6; // calculate width - full_width = frameBuffer->getScreenWidth() - frameBuffer->getScreenX() - 2*ConnectLineBox_Width; + full_width = frameBuffer->getScreenWidthRel(); if (g_settings.channellist_additional) width = full_width / 3 * 2; else @@ -497,7 +495,7 @@ void CChannelList::calcSize() // calculate height (the infobox below mainbox is handled outside height) info_height = 2*fheight + g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST_DESCR]->getHeight() + 10; - height = h_max ((frameBuffer->getScreenHeight() / 20 * 18) - info_height, 0); + height = frameBuffer->getScreenHeightRel() - info_height; // calculate x position x = getScreenStartX(full_width); diff --git a/src/gui/epgview.cpp b/src/gui/epgview.cpp index 1a7eafcd9..16f7dd77e 100644 --- a/src/gui/epgview.cpp +++ b/src/gui/epgview.cpp @@ -117,17 +117,8 @@ CEpgData::CEpgData() void CEpgData::start() { - /* This defines the size of the EPG window. We use 90% of the screen width and - * 90% of the screen height. It adjusts itself to the "visible screen" settings - */ - float epgwin_scale_factor = BIG_FONT_FAKTOR; /* stupid useless use of float */ - if (g_settings.big_windows) - epgwin_scale_factor = 1; - - ox = (frameBuffer->getScreenWidth() / 20 * 18) / (bigFonts ? 1 : epgwin_scale_factor); - oy = (frameBuffer->getScreenHeight() / 20 * 18) / (bigFonts ? 1 : epgwin_scale_factor); - sx = getScreenStartX(ox); - sy = getScreenStartY(oy); + ox = frameBuffer->getScreenWidthRel(); + oy = frameBuffer->getScreenHeightRel(); topheight = g_Font[SNeutrinoSettings::FONT_TYPE_EPG_TITLE]->getHeight(); topboxheight = topheight + 6; @@ -142,6 +133,9 @@ void CEpgData::start() medlineheight = g_Font[SNeutrinoSettings::FONT_TYPE_EPG_INFO1]->getHeight(); medlinecount = sb / medlineheight; toph = topboxheight; + + sx = getScreenStartX(ox); + sy = getScreenStartY(oy + buttonheight/2); /* button box is handled separately (why?) */ } void CEpgData::addTextToArray(const std::string & text, int screening) // UTF-8 diff --git a/src/gui/filebrowser.cpp b/src/gui/filebrowser.cpp index ef4fd9801..9ed1852c1 100644 --- a/src/gui/filebrowser.cpp +++ b/src/gui/filebrowser.cpp @@ -38,6 +38,7 @@ #include #include +#include #include #include @@ -372,11 +373,9 @@ void CFileBrowser::commonInit() selected = 0; selections.clear(); - x = g_settings.screen_StartX + 20; - y = g_settings.screen_StartY + 20; - - width = (g_settings.screen_EndX - g_settings.screen_StartX - 40); - height = (g_settings.screen_EndY - g_settings.screen_StartY - 40); + width = frameBuffer->getScreenWidthRel(); + height = frameBuffer->getScreenHeightRel(); + x = getScreenStartX(width); theight = g_Font[SNeutrinoSettings::FONT_TYPE_EVENTLIST_TITLE]->getHeight(); fheight = g_Font[SNeutrinoSettings::FONT_TYPE_FILEBROWSER_ITEM]->getHeight(); @@ -389,6 +388,7 @@ void CFileBrowser::commonInit() //recalc height height = theight + listmaxshow * fheight + 2 * foheight; + y = getScreenStartY(height); m_SMSKeyInput.setTimeout(SMSKEY_TIMEOUT); diff --git a/src/gui/moviebrowser.cpp b/src/gui/moviebrowser.cpp index 529bf15ca..ccbef2f65 100644 --- a/src/gui/moviebrowser.cpp +++ b/src/gui/moviebrowser.cpp @@ -39,6 +39,7 @@ #endif #include +#include #include #include @@ -602,10 +603,10 @@ void CMovieBrowser::initFrames(void) m_pcFontTitle = TITLE_FONT; //TRACE("[mb]->initFrames\r\n"); - m_cBoxFrame.iX = g_settings.screen_StartX + 10; - m_cBoxFrame.iY = g_settings.screen_StartY + 10; - m_cBoxFrame.iWidth = g_settings.screen_EndX - g_settings.screen_StartX - 20; - m_cBoxFrame.iHeight = g_settings.screen_EndY - g_settings.screen_StartY - 20; + m_cBoxFrame.iWidth = m_pcWindow->getScreenWidthRel(); + m_cBoxFrame.iHeight = m_pcWindow->getScreenHeightRel(); + m_cBoxFrame.iX = getScreenStartX(m_cBoxFrame.iWidth); + m_cBoxFrame.iY = getScreenStartY(m_cBoxFrame.iHeight); m_cBoxFrameTitleRel.iX = 0; m_cBoxFrameTitleRel.iY = 0; diff --git a/src/gui/pictureviewer.cpp b/src/gui/pictureviewer.cpp index 44b4a8bcb..a80532cad 100644 --- a/src/gui/pictureviewer.cpp +++ b/src/gui/pictureviewer.cpp @@ -128,8 +128,9 @@ int CPictureViewerGui::exec(CMenuTarget* parent, const std::string & actionKey) audioplayer = true; selected = 0; - width = w_max (710, 0); - height = h_max (570, 0); + + width = frameBuffer->getScreenWidthRel(); + height = frameBuffer->getScreenHeightRel(); sheight = g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL]->getHeight(); diff --git a/src/gui/upnpbrowser.cpp b/src/gui/upnpbrowser.cpp index be46fe341..b94734237 100644 --- a/src/gui/upnpbrowser.cpp +++ b/src/gui/upnpbrowser.cpp @@ -69,11 +69,6 @@ #include extern cVideo * videoDecoder; -#ifdef ConnectLineBox_Width -#undef ConnectLineBox_Width -#endif -#define ConnectLineBox_Width 15 - const struct button_label RescanButton = {NEUTRINO_ICON_BUTTON_BLUE , LOCALE_UPNPBROWSER_RESCAN}; const struct button_label StopButton = {NEUTRINO_ICON_BUTTON_YELLOW, LOCALE_AUDIOPLAYER_STOP}; const struct button_label PUpButton = {NEUTRINO_ICON_BUTTON_RED , LOCALE_FILEBROWSER_NEXTPAGE}; @@ -127,8 +122,8 @@ int CUpnpBrowserGui::exec(CMenuTarget* parent, const std::string & /*actionKey*/ #endif m_LastMode=(CNeutrinoApp::getInstance()->getLastMode()); - m_width=(g_settings.screen_EndX - g_settings.screen_StartX) - 2*ConnectLineBox_Width; - m_height = (g_settings.screen_EndY - g_settings.screen_StartY); + m_width = m_frameBuffer->getScreenWidthRel(); + m_height = m_frameBuffer->getScreenHeightRel(); m_sheight = g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL]->getHeight(); m_buttonHeight = std::min(25, m_sheight); diff --git a/src/gui/widget/menue.cpp b/src/gui/widget/menue.cpp index 6137caf3f..9b2764a11 100644 --- a/src/gui/widget/menue.cpp +++ b/src/gui/widget/menue.cpp @@ -42,8 +42,6 @@ #include -#define ConnectLineBox_Width 16 - /* the following generic menu items are integrated into multiple menus at the same time */ CMenuSeparator CGenericMenuSeparator; CMenuSeparator CGenericMenuSeparatorLine(CMenuSeparator::LINE); diff --git a/src/neutrino.cpp b/src/neutrino.cpp index 7be65d004..f41464214 100644 --- a/src/neutrino.cpp +++ b/src/neutrino.cpp @@ -639,7 +639,7 @@ int CNeutrinoApp::loadSetup(const char * fname) g_settings.screen_height = configfile.getInt32("screen_height", 0); g_settings.bigFonts = configfile.getInt32("bigFonts", 0); - g_settings.big_windows = configfile.getInt32("big_windows", 0); + g_settings.big_windows = configfile.getInt32("big_windows", 1); g_settings.remote_control_hardware = configfile.getInt32( "remote_control_hardware", CRCInput::RC_HW_COOLSTREAM); g_settings.audiochannel_up_down_enable = configfile.getBool("audiochannel_up_down_enable", false); From 36e95d7fbcd22dfbb94d03867f10634f7a72df63 Mon Sep 17 00:00:00 2001 From: Stefan Seyfried Date: Mon, 25 Mar 2013 14:06:16 +0100 Subject: [PATCH 211/224] channellist: refactor to avoid duplicated code --- src/gui/channellist.cpp | 35 +++++++---------------------------- 1 file changed, 7 insertions(+), 28 deletions(-) diff --git a/src/gui/channellist.cpp b/src/gui/channellist.cpp index 3906856e9..316ae5798 100644 --- a/src/gui/channellist.cpp +++ b/src/gui/channellist.cpp @@ -737,16 +737,19 @@ int CChannelList::show() } actzap = updateSelection(new_selected); } - else if (msg == (neutrino_msg_t)g_settings.key_bouquet_up) { + else if (msg == (neutrino_msg_t)g_settings.key_bouquet_up || + msg == (neutrino_msg_t)g_settings.key_bouquet_down) { if (dline) dline->kill(); //kill details line on change to next page if (!bouquetList->Bouquets.empty()) { bool found = true; - uint32_t nNext = (bouquetList->getActiveBouquetNumber()+1) % bouquetList->Bouquets.size(); + int dir = msg == (neutrino_msg_t)g_settings.key_bouquet_up ? 1 : -1; + int b_size = bouquetList->Bouquets.size(); + int nNext = (bouquetList->getActiveBouquetNumber() + b_size + dir) % b_size; if(bouquetList->Bouquets[nNext]->channelList->isEmpty() ) { found = false; - nNext = nNext < bouquetList->Bouquets.size()-1 ? nNext+1 : 0; - for(uint32_t i = nNext; i < bouquetList->Bouquets.size(); i++) { + nNext = (nNext + b_size + dir) % b_size; + for (int i = nNext; i < b_size; i++) { if( !bouquetList->Bouquets[i]->channelList->isEmpty() ) { found = true; nNext = i; @@ -761,30 +764,6 @@ int CChannelList::show() } } } - else if (msg == (neutrino_msg_t)g_settings.key_bouquet_down) { - if (dline) - dline->kill(); //kill details line on change to previous page - if (!bouquetList->Bouquets.empty()) { - bool found = true; - int nNext = (bouquetList->getActiveBouquetNumber()+bouquetList->Bouquets.size()-1) % bouquetList->Bouquets.size(); - if(bouquetList->Bouquets[nNext]->channelList->isEmpty() ) { - found = false; - nNext = nNext > 0 ? nNext-1 : bouquetList->Bouquets.size()-1; - for(int i = nNext; i > 0; i--) { - if(!bouquetList->Bouquets[i]->channelList->isEmpty()) { - found = true; - nNext = i; - break; - } - } - } - if(found) { - bouquetList->activateBouquet(nNext, false); - res = bouquetList->showChannelList(); - loop = false; - } - } - } else if ( msg == CRCInput::RC_ok ) { if(SameTP()) { zapOnExit = true; From 3a32fab2f0d20576840d26d9ef54039ecf23080a Mon Sep 17 00:00:00 2001 From: Stefan Seyfried Date: Sun, 24 Mar 2013 13:21:51 +0100 Subject: [PATCH 212/224] CVolume: remove duplicate code --- src/driver/volume.cpp | 69 ++++++++++++++++--------------------------- 1 file changed, 26 insertions(+), 43 deletions(-) diff --git a/src/driver/volume.cpp b/src/driver/volume.cpp index 60515ee6f..d2b3e65fa 100644 --- a/src/driver/volume.cpp +++ b/src/driver/volume.cpp @@ -265,12 +265,12 @@ void CVolume::setVolume(const neutrino_msg_t key, const bool bDoPaint, bool nowa do { if (msg <= CRCInput::RC_MaxRC) { - int sub_chan_keybind = 0; - if (g_settings.mode_left_right_key_tv == SNeutrinoSettings::VOLUME && g_RemoteControl->subChannels.size() < 1) - sub_chan_keybind = 1; - - if ((msg == CRCInput::RC_plus) || (sub_chan_keybind == 1 && (msg == CRCInput::RC_right))) { - if(CNeutrinoApp::getInstance()->isMuted()) { + bool sub_chan_keybind = g_settings.mode_left_right_key_tv == SNeutrinoSettings::VOLUME + && g_RemoteControl && g_RemoteControl->subChannels.size() < 1; + if ((msg == CRCInput::RC_plus || msg == CRCInput::RC_minus) || + (sub_chan_keybind && (msg == CRCInput::RC_right || msg == CRCInput::RC_left))) { + int dir = (msg == CRCInput::RC_plus || msg == CRCInput::RC_right) ? 1 : -1; + if (CNeutrinoApp::getInstance()->isMuted() && (dir > 0 || g_settings.current_volume > 0)) { if ((bDoPaint) && (pixbuf!= NULL)) { frameBuffer->RestoreScreen(x, y, vbar_w+ShadowOffset, vbar_h+ShadowOffset, pixbuf); delete [] pixbuf; @@ -281,46 +281,29 @@ void CVolume::setVolume(const neutrino_msg_t key, const bool bDoPaint, bool nowa return; } - if(!CNeutrinoApp::getInstance()->isMuted()) { - if (g_settings.current_volume < 100 - g_settings.current_volume_step) - g_settings.current_volume += g_settings.current_volume_step; - else - g_settings.current_volume = 100; - } - } - else if ((msg == CRCInput::RC_minus) || (sub_chan_keybind == 1 && (msg == CRCInput::RC_left))) { - if(CNeutrinoApp::getInstance()->isMuted() && g_settings.current_volume > 0) { - if ((bDoPaint) && (pixbuf!= NULL)) { - frameBuffer->RestoreScreen(x, y, vbar_w+ShadowOffset, vbar_h+ShadowOffset, pixbuf); - delete [] pixbuf; - } - AudioMute(false, true); - Init(); - setVolume(msg); - return; - } - - if(!CNeutrinoApp::getInstance()->isMuted()) { - if (g_settings.current_volume > g_settings.current_volume_step) - g_settings.current_volume -= g_settings.current_volume_step; - - else if (g_settings.show_mute_icon == 1) { - if ((bDoPaint) && (pixbuf!= NULL)) { - frameBuffer->RestoreScreen(x, y, vbar_w+ShadowOffset, vbar_h+ShadowOffset, pixbuf); - delete [] pixbuf; + if (!CNeutrinoApp::getInstance()->isMuted()) { + /* current_volume is char, we need signed to catch v < 0 */ + int v = g_settings.current_volume; + v += dir * g_settings.current_volume_step; + if (v > 100) + v = 100; + else if (v < 1) { + v = 0; + g_settings.current_volume = 0; + if (g_settings.show_mute_icon) { + if (bDoPaint && pixbuf != NULL) { + frameBuffer->RestoreScreen(x, y, vbar_w+ShadowOffset, vbar_h+ShadowOffset, pixbuf); + delete []pixbuf; + } + AudioMute(true, true); + Init(); + setVolume(msg); + return; } - g_settings.current_volume = 0; - AudioMute( true, true); - Init(); - setVolume(msg); - return; } - - else if (g_settings.show_mute_icon == 0) - g_settings.current_volume = 0; - } + g_settings.current_volume = v; + } } - else if (msg == CRCInput::RC_home) break; else { From adb49dd5b31014be3064213767ca9a8cfddde315 Mon Sep 17 00:00:00 2001 From: Stefan Seyfried Date: Sun, 24 Mar 2013 11:38:09 +0100 Subject: [PATCH 213/224] my_system: cleanup and propagate exitstatus --- src/system/helpers.cpp | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/src/system/helpers.cpp b/src/system/helpers.cpp index 97671df3c..d3957201a 100644 --- a/src/system/helpers.cpp +++ b/src/system/helpers.cpp @@ -103,7 +103,7 @@ int my_system(int argc, const char *arg, ...) case -1: /* can't vfork */ perror("vfork"); ret = -errno; - goto out; + break; case 0: /* child process */ for(i = 3; i < maxfd; i++) close(i); @@ -111,21 +111,17 @@ int my_system(int argc, const char *arg, ...) perror("my_system setsid"); if (execvp(argv[0], (char * const *)argv)) { - if (errno != ENOENT) { /* don't complain if argv[0] only does not exist */ - std::string txt = "ERROR: my_system \"" + (std::string) argv[0] + "\""; - perror(txt.c_str()); - } ret = -errno; + if (errno != ENOENT) /* don't complain if argv[0] only does not exist */ + fprintf(stderr, "ERROR: my_system \"%s\": %m\n", argv[0]); } - _exit (0); // terminate c h i l d proces s only + _exit(ret); // terminate c h i l d proces s only default: /* parent returns to calling process */ + waitpid(pid, &childExit, 0); + if (WEXITSTATUS(childExit) != 0) + ret = (signed char)WEXITSTATUS(childExit); break; } - /* it is probably pure luck that ret gets propagated back from child to parent */ - waitpid(pid, &childExit, 0); - if(childExit != 0) - ret = childExit; - out: va_end(args); return ret; } From eea77b7c8a878bcd8bec7d382e2be52e3f6cdd13 Mon Sep 17 00:00:00 2001 From: Stefan Seyfried Date: Mon, 25 Mar 2013 16:48:25 +0100 Subject: [PATCH 214/224] create zapit config dir on install --- data/Makefile.am | 3 +++ 1 file changed, 3 insertions(+) diff --git a/data/Makefile.am b/data/Makefile.am index fd215a996..062019037 100644 --- a/data/Makefile.am +++ b/data/Makefile.am @@ -6,3 +6,6 @@ endif configdir = $(CONFIGDIR) config_DATA = cables.xml satellites.xml encoding.conf tobackup.conf providermap.xml settingsupdate.conf + +install-data-hook: + $(INSTALL) -d $(DESTDIR)/$(CONFIGDIR)/zapit From 4c3a92a13077d141340d4a49def62aea2c98d8ea Mon Sep 17 00:00:00 2001 From: Stefan Seyfried Date: Mon, 25 Mar 2013 17:35:29 +0100 Subject: [PATCH 215/224] filebrowser: simplify code using font pointers and ... ... make size, time and mode fields scale with fontsize --- src/gui/filebrowser.cpp | 47 ++++++++++++++++++++--------------------- src/gui/filebrowser.h | 3 +++ 2 files changed, 26 insertions(+), 24 deletions(-) diff --git a/src/gui/filebrowser.cpp b/src/gui/filebrowser.cpp index 9ed1852c1..d2d9234af 100644 --- a/src/gui/filebrowser.cpp +++ b/src/gui/filebrowser.cpp @@ -361,6 +361,9 @@ CFileBrowser::CFileBrowser(const char * const _base, const tFileBrowserMode mode void CFileBrowser::commonInit() { frameBuffer = CFrameBuffer::getInstance(); + fnt_title = g_Font[SNeutrinoSettings::FONT_TYPE_EVENTLIST_TITLE]; + fnt_item = g_Font[SNeutrinoSettings::FONT_TYPE_FILEBROWSER_ITEM]; + fnt_small = g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL]; //shoutcast sc_init_dir = "/legacy/genrelist?k=" + g_settings.shoutcast_dev_id; @@ -377,11 +380,11 @@ void CFileBrowser::commonInit() height = frameBuffer->getScreenHeightRel(); x = getScreenStartX(width); - theight = g_Font[SNeutrinoSettings::FONT_TYPE_EVENTLIST_TITLE]->getHeight(); - fheight = g_Font[SNeutrinoSettings::FONT_TYPE_FILEBROWSER_ITEM]->getHeight(); + theight = fnt_title->getHeight(); + fheight = fnt_item->getHeight(); if (fheight == 0) fheight = 1; /* avoid div by zero on invalid font */ - foheight = g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL]->getHeight()+6; //initial height value for buttonbar; TODO get value from buttonbar + foheight = fnt_small->getHeight()+6; //initial height value for buttonbar; TODO get value from buttonbar liststart = 0; listmaxshow = std::max(1,(int)(height - theight - 2 * foheight)/fheight); @@ -1227,7 +1230,7 @@ void CFileBrowser::hide() void CFileBrowser::paintItem(unsigned int pos) { - int colwidth1, colwidth2, colwidth3, colwidth1_dir, colwidth2_dir; + int colwidth1, colwidth2, colwidth3; int c_rad_small; uint8_t color; fb_pixel_t bgcolor; @@ -1235,9 +1238,6 @@ void CFileBrowser::paintItem(unsigned int pos) CFile * actual_file = NULL; std::string fileicon; - colwidth2_dir = 180; - colwidth1_dir = width - 35 - colwidth2_dir - 10; - if (liststart + pos == selected) { color = COL_MENUCONTENTSELECTED; @@ -1265,15 +1265,10 @@ void CFileBrowser::paintItem(unsigned int pos) } if (g_settings.filebrowser_showrights == 0 && S_ISREG(actual_file->Mode)) - { colwidth2 = 0; - colwidth3 = 90; - } else - { - colwidth2 = 90; - colwidth3 = 90; - } + colwidth2 = fnt_item->getRenderWidth("rwxrwxrwx"); + colwidth3 = fnt_item->getRenderWidth("222.222G"); colwidth1 = width - 35 - colwidth2 - colwidth3 - 10; if ( actual_file->Name.length() > 0 ) @@ -1305,7 +1300,7 @@ void CFileBrowser::paintItem(unsigned int pos) } frameBuffer->paintIcon(fileicon, x+5 , ypos + (fheight-16) / 2 ); - g_Font[SNeutrinoSettings::FONT_TYPE_FILEBROWSER_ITEM]->RenderString(x + 35, ypos + fheight, colwidth1 - 10 , FILESYSTEM_ENCODING_TO_UTF8_STRING(actual_file->getFileName()), color, 0, true); // UTF-8 + fnt_item->RenderString(x + 35, ypos + fheight, colwidth1 - 10 , FILESYSTEM_ENCODING_TO_UTF8_STRING(actual_file->getFileName()), color, 0, true); // UTF-8 if( S_ISREG(actual_file->Mode) ) { @@ -1319,7 +1314,7 @@ void CFileBrowser::paintItem(unsigned int pos) } modestring[9] = 0; - g_Font[SNeutrinoSettings::FONT_TYPE_FILEBROWSER_ITEM]->RenderString(x + 35 + colwidth1 , ypos+ fheight, colwidth2 - 10, modestring, color, 0, true); // UTF-8 + fnt_item->RenderString(x + width - 25 - colwidth3 - colwidth2 , ypos+ fheight, colwidth2, modestring, color, 0, true); // UTF-8 } #define GIGABYTE 1073741824LL @@ -1352,18 +1347,20 @@ void CFileBrowser::paintItem(unsigned int pos) else snprintf(tmpstr,sizeof(tmpstr),"%d", (int)actual_file->Size); - g_Font[SNeutrinoSettings::FONT_TYPE_FILEBROWSER_ITEM]->RenderString(x + 35 + colwidth1 + colwidth2, ypos+ fheight, colwidth3 - 10, tmpstr, color); + /* right align file size */ + int sz_w = fnt_item->getRenderWidth(tmpstr); + fnt_item->RenderString(x + width - sz_w - 25, ypos+ fheight, sz_w, tmpstr, color); } if( S_ISDIR(actual_file->Mode) ) { char timestring[18]; time_t rawtime; - rawtime = actual_file->Time; strftime(timestring, 18, "%d-%m-%Y %H:%M", gmtime(&rawtime)); - - g_Font[SNeutrinoSettings::FONT_TYPE_FILEBROWSER_ITEM]->RenderString(x + 35 + colwidth1_dir, ypos+ fheight, colwidth2_dir - 10, timestring, color); + /* right align directory time */ + int time_w = fnt_item->getRenderWidth(timestring); + fnt_item->RenderString(x + width - time_w - 25, ypos+ fheight, time_w, timestring, color); } } } @@ -1394,17 +1391,17 @@ void CFileBrowser::paintHead() /* too long? Leave out the "Filebrowser" or "Shoutcast" prefix * the allocated space is sufficient since it is surely shorter than before */ - if (g_Font[SNeutrinoSettings::FONT_TYPE_EVENTLIST_TITLE]->getRenderWidth(l_name) > width - 11) + if (fnt_title->getRenderWidth(l_name) > width - 11) l = sprintf(l_name, "%s", FILESYSTEM_ENCODING_TO_UTF8_STRING(name).c_str()); if (l_name[l - 1] == '/') l_name[--l] = '\0'; /* still too long? the last part is probably more interesting than the first part... */ - while ((g_Font[SNeutrinoSettings::FONT_TYPE_EVENTLIST_TITLE]->getRenderWidth(&l_name[i]) > width - 11) + while ((fnt_title->getRenderWidth(&l_name[i]) > width - 11) && (i < l)) i++; - g_Font[SNeutrinoSettings::FONT_TYPE_EVENTLIST_TITLE]->RenderString(x+10,y+theight+1, width-11, &l_name[i], COL_MENUHEAD, 0, true); + fnt_title->RenderString(x+10,y+theight+1, width-11, &l_name[i], COL_MENUHEAD, 0, true); free(l_name); } @@ -1495,7 +1492,9 @@ void CFileBrowser::paintFoot() if(m_SMSKeyInput.getOldKey()!=0) { char cKey[2]={m_SMSKeyInput.getOldKey(),0}; - g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL]->RenderString(x + width - 16, by2 , 16, cKey, COL_MENUHEAD, 0, true); // UTF-8 + cKey[0] = toupper(cKey[0]); + int len = fnt_small->getRenderWidth(cKey); + fnt_small->RenderString(x + width - 10 - len, by2 + foheight, len, cKey, COL_MENUHEAD, 0, true); } } } diff --git a/src/gui/filebrowser.h b/src/gui/filebrowser.h index 5cf100bdf..43ecc81ad 100644 --- a/src/gui/filebrowser.h +++ b/src/gui/filebrowser.h @@ -146,6 +146,9 @@ class CFileBrowser { private: CFrameBuffer *frameBuffer; + Font *fnt_title; + Font *fnt_item; + Font *fnt_small; CFileList selected_filelist; bool readDir(const std::string & dirname, CFileList* flist); From 5033a9e4ef127bbe73f57f8ebef4f811c5f4c87c Mon Sep 17 00:00:00 2001 From: Stefan Seyfried Date: Mon, 25 Mar 2013 18:02:46 +0100 Subject: [PATCH 216/224] infoviewer: make oldinfo a member of the class --- src/gui/infoviewer.cpp | 4 ++-- src/gui/infoviewer.h | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/gui/infoviewer.cpp b/src/gui/infoviewer.cpp index d4d1b0b76..de51eddb8 100644 --- a/src/gui/infoviewer.cpp +++ b/src/gui/infoviewer.cpp @@ -110,6 +110,8 @@ CInfoViewer::CInfoViewer () ChanInfoX = 0; Init(); infoViewerBB->Init(); + oldinfo.current_uniqueKey = 0; + oldinfo.next_uniqueKey = 0; } CInfoViewer::~CInfoViewer() @@ -1314,8 +1316,6 @@ int CInfoViewer::handleMsg (const neutrino_msg_t msg, neutrino_msg_data_t data) CSectionsdClient::CurrentNextInfo CInfoViewer::getEPG (const t_channel_id for_channel_id, CSectionsdClient::CurrentNextInfo &info) { - static CSectionsdClient::CurrentNextInfo oldinfo; - CEitManager::getInstance()->getCurrentNextServiceKey(for_channel_id, info); //printf("CInfoViewer::getEPG: old uniqueKey %llx new %llx\n", oldinfo.current_uniqueKey, info.current_uniqueKey); diff --git a/src/gui/infoviewer.h b/src/gui/infoviewer.h index c1860b4d6..9a0831132 100644 --- a/src/gui/infoviewer.h +++ b/src/gui/infoviewer.h @@ -82,6 +82,7 @@ class CInfoViewer int ChanHeight; CSectionsdClient::CurrentNextInfo info_CurrentNext; + CSectionsdClient::CurrentNextInfo oldinfo; t_channel_id channel_id; //uint32_t fadeTimer; From 9af63bdc72b5fb6fea7cbb8ebd2a94b4fa630007 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Mon, 25 Mar 2013 20:23:35 +0100 Subject: [PATCH 217/224] CComponentsInfoBox: ensure new init of picture Delete causes a clean background because it is possible that remnants are left after changed font size. --- src/gui/components/cc_item_infobox.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/gui/components/cc_item_infobox.cpp b/src/gui/components/cc_item_infobox.cpp index c8e5987de..04eac2e54 100644 --- a/src/gui/components/cc_item_infobox.cpp +++ b/src/gui/components/cc_item_infobox.cpp @@ -92,10 +92,9 @@ void CComponentsInfoBox::initVarInfobox() void CComponentsInfoBox::paintPicture() { //init and set icon paint position - if (pic == NULL) - pic = new CComponentsPicture(x+fr_thickness+x_offset, y+fr_thickness/*+y_offset*/, 0, 0, ""); - pic->setXPos(x+fr_thickness+x_offset); - pic->setYPos(y+fr_thickness); + if (pic) + delete pic; + pic = new CComponentsPicture(x+fr_thickness+x_offset, y+fr_thickness/*+y_offset*/, 0, 0, ""); //define icon pic->setPicture(pic_name); From 33c8526673f1f2e741cc12251420b9b2b6fd29e6 Mon Sep 17 00:00:00 2001 From: svenhoefer Date: Tue, 26 Mar 2013 00:48:04 +0100 Subject: [PATCH 218/224] - osd_progressbar_setup: rework locales; marginal changes in code --- data/locale/deutsch.locale | 30 ++++++++-------- data/locale/english.locale | 32 ++++++++--------- src/gui/osd_progressbar_setup.cpp | 57 ++++++++++++++++--------------- src/gui/osd_setup.cpp | 6 ++-- src/system/locals.h | 30 ++++++++-------- src/system/locals_intern.h | 30 ++++++++-------- 6 files changed, 93 insertions(+), 92 deletions(-) diff --git a/data/locale/deutsch.locale b/data/locale/deutsch.locale index a44a21c5d..c2cf6564a 100644 --- a/data/locale/deutsch.locale +++ b/data/locale/deutsch.locale @@ -803,9 +803,6 @@ menu.hint_infobar_fonts Ändern Sie die Schriftgrößen in der Infobar menu.hint_infobar_logo Logo- und Signal-Optionen menu.hint_infobar_logo_dir Wählen Sie das Verzeichnis für die Senderlogos menu.hint_infobar_on_epg Zeigt einen Hinweis bei EPG-Änderungen -menu.hint_infobar_position Wählt die Optionen des Fortschrittsbalken in der Infobar -menu.hint_infobar_progressbar Wählen sie die Optionen für die Progressbar-Anzeige -menu.hint_infobar_progressbar_design Stellen Sie das Design des Fortschrittsbalkens ein menu.hint_infobar_radiotext Zeigt Radiotext in einen Fenster, wenn verfügbar menu.hint_infobar_res Zeige die gesendete Auflösung in Symbolen menu.hint_infobar_sat Zeigt die aktuellen Satelliten- oder Kabel-Provider @@ -934,7 +931,10 @@ menu.hint_plugins_hdd_dir Auswahl des Verzeichnisses zum Laden der Plugins von e menu.hint_power_leds Konfiguriert das Verhalten der LEDs an der Power-Taste menu.hint_pref_lang Wählen Sie ihre bevorzugte Tonspur und EPG-Sprache,\ndie Einstellung 'none' deaktiviert diese Option menu.hint_pref_subs Wählen Sie ihre bevorzugte Untertitel-Sprache,\ndie Einstellung 'none' deaktiviert diese Option +menu.hint_progressbar Wählen Sie die Optionen für die Fortschrittsbalken-Anzeige menu.hint_progressbar_color Bei aktivierter Option werden alle Fortschrittsbalken in Farbe und nicht im klassischen Weiß angezeigt +menu.hint_progressbar_design Stellen Sie das Design des Fortschrittsbalkens ein +menu.hint_progressbar_infobar_position Wählt die Optionen des Fortschrittsbalkens in der Infobar menu.hint_protection Schützen Sie Inhalte per PIN-Code\nStandard-PIN ist 0000 menu.hint_radiomode Schaltet zum Radio-Modus menu.hint_reboot Startet die Box neu\nDer Neustart erfolgt ohne Bestätigung! @@ -1138,17 +1138,18 @@ miscsettings.infobar_disp_5 Logo/Signalbalken miscsettings.infobar_disp_6 Logo+Kanalnummer/Signalbalken miscsettings.infobar_disp_log Logo miscsettings.infobar_logo_hdd_dir Logo-Verz. -miscsettings.infobar_position Progessbarposition -miscsettings.infobar_position_0 Standard -miscsettings.infobar_position_1 unterhalb Kanalname -miscsettings.infobar_position_2 unterhalb Kanalname (schmal) -miscsettings.infobar_position_3 zwischen EPG-Events (schmal) -miscsettings.infobar_progressbar Fortschrittsbalken -miscsettings.infobar_progressbar_design Progressbar -miscsettings.infobar_progressbar_design_0 Punktdesign -miscsettings.infobar_progressbar_design_1 Balkendesign Vertikal -miscsettings.infobar_progressbar_design_2 Balkendesign Horizontal -miscsettings.infobar_progressbar_design_3 farbig +miscsettings.progressbar Fortschrittsbalken +miscsettings.progressbar_color Farbe +miscsettings.progressbar_design Design +miscsettings.progressbar_design_0 Punkte +miscsettings.progressbar_design_1 vertikale Balken +miscsettings.progressbar_design_2 horizontale Balken +miscsettings.progressbar_design_3 Farbverlauf +miscsettings.progressbar_infobar_position Position +miscsettings.progressbar_infobar_position_0 Standard +miscsettings.progressbar_infobar_position_1 unterhalb Kanalname +miscsettings.progressbar_infobar_position_2 unterhalb Kanalname (schmal) +miscsettings.progressbar_infobar_position_3 zwischen EPG-Events (schmal) miscsettings.infobar_sat_display Kabel-/Satellitenanbieter miscsettings.infobar_show Info bei EPG Änderungen miscsettings.infobar_show_dd_available DD-Verfügbarkeit anzeigen @@ -1506,7 +1507,6 @@ pinprotection.head PIN-Abfrage pinprotection.wrongcode Geben Sie den Code nocheinmal ein! plugins.hdd_dir Externes Plugin-Verz. plugins.result Pluginausgabe -progressbar.color Fortschrittsbalken Farbe rclock.lockmsg Die Fernbedienung der Coolstream wird gesperrt.\n Um die Sperre aufzuheben, bitte\n und auf der Fernbedienung\n drücken. rclock.menueadd FB sperren rclock.title Fernbedienung sperren diff --git a/data/locale/english.locale b/data/locale/english.locale index e89182548..ef133967c 100644 --- a/data/locale/english.locale +++ b/data/locale/english.locale @@ -803,9 +803,6 @@ menu.hint_infobar_fonts Change infobar font sizes menu.hint_infobar_logo Logo / signal options menu.hint_infobar_logo_dir Select directory to search for channels logo menu.hint_infobar_on_epg Show infobar on current EPG event change -menu.hint_infobar_position Selects the options of Progressbar in the Infobar -menu.hint_infobar_progressbar Select the options for the Progressbar -menu.hint_infobar_progressbar_design Here you can choose the design of the Progressbar with active color option. menu.hint_infobar_radiotext Show radiotext window menu.hint_infobar_res Show channel resolution icons menu.hint_infobar_sat Show current satellite or cable provider @@ -934,7 +931,10 @@ menu.hint_plugins_hdd_dir Select directory to load\nplugins from menu.hint_power_leds Configure power-button LEDs behavior menu.hint_pref_lang Select preferred audio and EPG language\nselect 'none' to disable menu.hint_pref_subs Select preferred subtitle language\nselect 'none' to disable -menu.hint_progressbar_color Show colored progress bars +menu.hint_progressbar Select the options for the progressbar +menu.hint_progressbar_color Show colored progressbar +menu.hint_progressbar_design Here you can choose the design of progressbar with active color option +menu.hint_progressbar_infobar_position Selects the options of progressbar in the infobar menu.hint_protection Protect content by PIN code\nDefault PIN 0000 menu.hint_radiomode Switch box to radio mode menu.hint_reboot Reboot box\nNo confirmation @@ -1138,17 +1138,18 @@ miscsettings.infobar_disp_5 Logo+signal miscsettings.infobar_disp_6 Logo+channel number+signal miscsettings.infobar_disp_log Logo miscsettings.infobar_logo_hdd_dir Logo dir -miscsettings.infobar_position Progressbar Position -miscsettings.infobar_position_0 standard -miscsettings.infobar_position_1 below channel name -miscsettings.infobar_position_2 small below channel name -miscsettings.infobar_position_3 narrow between EPG-Events -miscsettings.infobar_progressbar Progressbar -miscsettings.infobar_progressbar_design Progressbar -miscsettings.infobar_progressbar_design_0 point Design -miscsettings.infobar_progressbar_design_1 bar Design vertical -miscsettings.infobar_progressbar_design_2 bar Design horizontal -miscsettings.infobar_progressbar_design_3 colored +miscsettings.progressbar Progressbar +miscsettings.progressbar_color Color +miscsettings.progressbar_design Design +miscsettings.progressbar_design_0 points +miscsettings.progressbar_design_1 vertical bars +miscsettings.progressbar_design_2 horizontal bars +miscsettings.progressbar_design_3 colored +miscsettings.progressbar_infobar_position Position +miscsettings.progressbar_infobar_position_0 standard +miscsettings.progressbar_infobar_position_1 below channel name +miscsettings.progressbar_infobar_position_2 small below channel name +miscsettings.progressbar_infobar_position_3 narrow between EPG-Events miscsettings.infobar_sat_display Satellite display on infobar miscsettings.infobar_show show Info on EPG change miscsettings.infobar_show_dd_available show DD availability @@ -1506,7 +1507,6 @@ pinprotection.head Enter PIN code pinprotection.wrongcode PIN-Code was wrong! Try again. plugins.hdd_dir Plugin HDD dir. plugins.result plugin output -progressbar.color Progressbar Color rclock.lockmsg Your box remote control will be locked.\n To unlock it, press \n and on your remote control. rclock.menueadd Lock RC rclock.title Lock Remote Control diff --git a/src/gui/osd_progressbar_setup.cpp b/src/gui/osd_progressbar_setup.cpp index 78591453a..7ac692717 100644 --- a/src/gui/osd_progressbar_setup.cpp +++ b/src/gui/osd_progressbar_setup.cpp @@ -39,22 +39,22 @@ #include -#define LOCALE_MISCSETTINGS_INFOBAR_POSITION_COUNT 4 -const CMenuOptionChooser::keyval LOCALE_MISCSETTINGS_INFOBAR_POSITION_OPTIONS[LOCALE_MISCSETTINGS_INFOBAR_POSITION_COUNT]= +#define PROGRESSBAR_INFOBAR_POSITION_COUNT 4 +const CMenuOptionChooser::keyval PROGRESSBAR_INFOBAR_POSITION_OPTIONS[PROGRESSBAR_INFOBAR_POSITION_COUNT]= { - { 0 , LOCALE_MISCSETTINGS_INFOBAR_POSITION_0 }, - { 1 , LOCALE_MISCSETTINGS_INFOBAR_POSITION_1 }, - { 2 , LOCALE_MISCSETTINGS_INFOBAR_POSITION_2 }, - { 3 , LOCALE_MISCSETTINGS_INFOBAR_POSITION_3 } + { 0 , LOCALE_MISCSETTINGS_PROGRESSBAR_INFOBAR_POSITION_0 }, + { 1 , LOCALE_MISCSETTINGS_PROGRESSBAR_INFOBAR_POSITION_1 }, + { 2 , LOCALE_MISCSETTINGS_PROGRESSBAR_INFOBAR_POSITION_2 }, + { 3 , LOCALE_MISCSETTINGS_PROGRESSBAR_INFOBAR_POSITION_3 } }; -#define LOCALE_MISCSETTINGS_INFOBAR_PROGRESSBAR_DESIGN_COUNT 4 -const CMenuOptionChooser::keyval LOCALE_MISCSETTINGS_INFOBAR_PROGRESSBAR_DESIGN_OPTIONS[LOCALE_MISCSETTINGS_INFOBAR_PROGRESSBAR_DESIGN_COUNT]= +#define PROGRESSBAR_DESIGN_COUNT 4 +const CMenuOptionChooser::keyval PROGRESSBAR_DESIGN_OPTIONS[PROGRESSBAR_DESIGN_COUNT]= { - { 0 , LOCALE_MISCSETTINGS_INFOBAR_PROGRESSBAR_DESIGN_0 }, - { 1 , LOCALE_MISCSETTINGS_INFOBAR_PROGRESSBAR_DESIGN_1 }, - { 2 , LOCALE_MISCSETTINGS_INFOBAR_PROGRESSBAR_DESIGN_2 }, - { 3 , LOCALE_MISCSETTINGS_INFOBAR_PROGRESSBAR_DESIGN_3 } + { 0 , LOCALE_MISCSETTINGS_PROGRESSBAR_DESIGN_0 }, + { 1 , LOCALE_MISCSETTINGS_PROGRESSBAR_DESIGN_1 }, + { 2 , LOCALE_MISCSETTINGS_PROGRESSBAR_DESIGN_2 }, + { 3 , LOCALE_MISCSETTINGS_PROGRESSBAR_DESIGN_3 } }; CProgressbarSetup::CProgressbarSetup() @@ -83,31 +83,32 @@ int CProgressbarSetup::showMenu() CMenuWidget *progress = new CMenuWidget(LOCALE_MAINMENU_SETTINGS, NEUTRINO_ICON_SETTINGS, width, MN_WIDGET_ID_PROGRESSBAR); //intros: back ande save - progress->addIntroItems(LOCALE_MISCSETTINGS_INFOBAR_PROGRESSBAR); + progress->addIntroItems(LOCALE_MISCSETTINGS_PROGRESSBAR); - //infobar progresscolor on/off COnOffNotifier* miscProgressNotifier = new COnOffNotifier(0); - CMenuOptionChooser *progresscolor; - progresscolor = new CMenuOptionChooser(LOCALE_PROGRESSBAR_COLOR, &g_settings.progressbar_color, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true, miscProgressNotifier); - progresscolor->setHint("", LOCALE_MENU_HINT_PROGRESSBAR_COLOR); + //color on/off + CMenuOptionChooser *color; + color = new CMenuOptionChooser(LOCALE_MISCSETTINGS_PROGRESSBAR_COLOR, &g_settings.progressbar_color, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true, miscProgressNotifier); + color->setHint("", LOCALE_MENU_HINT_PROGRESSBAR_COLOR); - //infobar design - CMenuOptionChooser *progressdesign = new CMenuOptionChooser(LOCALE_MISCSETTINGS_INFOBAR_PROGRESSBAR_DESIGN, &g_settings.progressbar_design, LOCALE_MISCSETTINGS_INFOBAR_PROGRESSBAR_DESIGN_OPTIONS, LOCALE_MISCSETTINGS_INFOBAR_PROGRESSBAR_DESIGN_COUNT, g_settings.progressbar_color); - progressdesign->setHint("", LOCALE_MENU_HINT_INFOBAR_PROGRESSBAR_DESIGN); + //design + CMenuOptionChooser *design; + design = new CMenuOptionChooser(LOCALE_MISCSETTINGS_PROGRESSBAR_DESIGN, &g_settings.progressbar_design, PROGRESSBAR_DESIGN_OPTIONS, PROGRESSBAR_DESIGN_COUNT, g_settings.progressbar_color); + design->setHint("", LOCALE_MENU_HINT_PROGRESSBAR_DESIGN); - //infobar progressbarposition - CMenuOptionChooser *progressbarposition; - progressbarposition = new CMenuOptionChooser(LOCALE_MISCSETTINGS_INFOBAR_POSITION, &g_settings.infobar_progressbar, LOCALE_MISCSETTINGS_INFOBAR_POSITION_OPTIONS, LOCALE_MISCSETTINGS_INFOBAR_POSITION_COUNT, true); - progressbarposition->setHint("", LOCALE_MENU_HINT_INFOBAR_POSITION); + //infobar position + CMenuOptionChooser *infobar_position; + infobar_position = new CMenuOptionChooser(LOCALE_MISCSETTINGS_PROGRESSBAR_INFOBAR_POSITION, &g_settings.infobar_progressbar, PROGRESSBAR_INFOBAR_POSITION_OPTIONS, PROGRESSBAR_INFOBAR_POSITION_COUNT, true); + infobar_position->setHint("", LOCALE_MENU_HINT_PROGRESSBAR_INFOBAR_POSITION); - miscProgressNotifier->addItem(progressdesign); + miscProgressNotifier->addItem(design); //paint items - progress->addItem(progresscolor); - progress->addItem(progressdesign); + progress->addItem(color); + progress->addItem(design); progress->addItem(new CMenuSeparator(CMenuSeparator::LINE | CMenuSeparator::STRING, LOCALE_MISCSETTINGS_INFOBAR)); - progress->addItem(progressbarposition); + progress->addItem(infobar_position); int res = progress->exec (NULL, ""); delete miscProgressNotifier; diff --git a/src/gui/osd_setup.cpp b/src/gui/osd_setup.cpp index 5c05215f3..ee7a147e6 100644 --- a/src/gui/osd_setup.cpp +++ b/src/gui/osd_setup.cpp @@ -429,9 +429,9 @@ int COsdSetup::showOsdSetup() osd_menu->addItem(mf); //progressbar - CMenuForwarder * progress = new CMenuForwarder(LOCALE_MISCSETTINGS_INFOBAR_PROGRESSBAR, true, NULL, new CProgressbarSetup(), NULL, CRCInput::RC_1); - progress->setHint("", LOCALE_MENU_HINT_INFOBAR_PROGRESSBAR); - osd_menu->addItem(progress); + mf = new CMenuForwarder(LOCALE_MISCSETTINGS_PROGRESSBAR, true, NULL, new CProgressbarSetup(), NULL, CRCInput::RC_1); + mf->setHint("", LOCALE_MENU_HINT_PROGRESSBAR); + osd_menu->addItem(mf); //infobar CMenuWidget osd_menu_infobar(LOCALE_MAINMENU_SETTINGS, NEUTRINO_ICON_SETTINGS, width, MN_WIDGET_ID_OSDSETUP_INFOBAR); diff --git a/src/system/locals.h b/src/system/locals.h index 9cc9c7bdb..b3d852207 100644 --- a/src/system/locals.h +++ b/src/system/locals.h @@ -830,9 +830,6 @@ typedef enum LOCALE_MENU_HINT_INFOBAR_LOGO, LOCALE_MENU_HINT_INFOBAR_LOGO_DIR, LOCALE_MENU_HINT_INFOBAR_ON_EPG, - LOCALE_MENU_HINT_INFOBAR_POSITION, - LOCALE_MENU_HINT_INFOBAR_PROGRESSBAR, - LOCALE_MENU_HINT_INFOBAR_PROGRESSBAR_DESIGN, LOCALE_MENU_HINT_INFOBAR_RADIOTEXT, LOCALE_MENU_HINT_INFOBAR_RES, LOCALE_MENU_HINT_INFOBAR_SAT, @@ -961,7 +958,10 @@ typedef enum LOCALE_MENU_HINT_POWER_LEDS, LOCALE_MENU_HINT_PREF_LANG, LOCALE_MENU_HINT_PREF_SUBS, + LOCALE_MENU_HINT_PROGRESSBAR, LOCALE_MENU_HINT_PROGRESSBAR_COLOR, + LOCALE_MENU_HINT_PROGRESSBAR_DESIGN, + LOCALE_MENU_HINT_PROGRESSBAR_INFOBAR_POSITION, LOCALE_MENU_HINT_PROTECTION, LOCALE_MENU_HINT_RADIOMODE, LOCALE_MENU_HINT_REBOOT, @@ -1165,17 +1165,6 @@ typedef enum LOCALE_MISCSETTINGS_INFOBAR_DISP_6, LOCALE_MISCSETTINGS_INFOBAR_DISP_LOG, LOCALE_MISCSETTINGS_INFOBAR_LOGO_HDD_DIR, - LOCALE_MISCSETTINGS_INFOBAR_POSITION, - LOCALE_MISCSETTINGS_INFOBAR_POSITION_0, - LOCALE_MISCSETTINGS_INFOBAR_POSITION_1, - LOCALE_MISCSETTINGS_INFOBAR_POSITION_2, - LOCALE_MISCSETTINGS_INFOBAR_POSITION_3, - LOCALE_MISCSETTINGS_INFOBAR_PROGRESSBAR, - LOCALE_MISCSETTINGS_INFOBAR_PROGRESSBAR_DESIGN, - LOCALE_MISCSETTINGS_INFOBAR_PROGRESSBAR_DESIGN_0, - LOCALE_MISCSETTINGS_INFOBAR_PROGRESSBAR_DESIGN_1, - LOCALE_MISCSETTINGS_INFOBAR_PROGRESSBAR_DESIGN_2, - LOCALE_MISCSETTINGS_INFOBAR_PROGRESSBAR_DESIGN_3, LOCALE_MISCSETTINGS_INFOBAR_SAT_DISPLAY, LOCALE_MISCSETTINGS_INFOBAR_SHOW, LOCALE_MISCSETTINGS_INFOBAR_SHOW_DD_AVAILABLE, @@ -1183,6 +1172,18 @@ typedef enum LOCALE_MISCSETTINGS_INFOBAR_SHOW_RES_SIMPLE, LOCALE_MISCSETTINGS_INFOBAR_SHOW_SYSFS_HDD, LOCALE_MISCSETTINGS_INFOBAR_SHOW_TUNER, + LOCALE_MISCSETTINGS_PROGRESSBAR, + LOCALE_MISCSETTINGS_PROGRESSBAR_COLOR, + LOCALE_MISCSETTINGS_PROGRESSBAR_DESIGN, + LOCALE_MISCSETTINGS_PROGRESSBAR_DESIGN_0, + LOCALE_MISCSETTINGS_PROGRESSBAR_DESIGN_1, + LOCALE_MISCSETTINGS_PROGRESSBAR_DESIGN_2, + LOCALE_MISCSETTINGS_PROGRESSBAR_DESIGN_3, + LOCALE_MISCSETTINGS_PROGRESSBAR_INFOBAR_POSITION, + LOCALE_MISCSETTINGS_PROGRESSBAR_INFOBAR_POSITION_0, + LOCALE_MISCSETTINGS_PROGRESSBAR_INFOBAR_POSITION_1, + LOCALE_MISCSETTINGS_PROGRESSBAR_INFOBAR_POSITION_2, + LOCALE_MISCSETTINGS_PROGRESSBAR_INFOBAR_POSITION_3, LOCALE_MISCSETTINGS_RADIOTEXT, LOCALE_MISCSETTINGS_SHUTDOWN_COUNT, LOCALE_MISCSETTINGS_SHUTDOWN_COUNT_HINT1, @@ -1533,7 +1534,6 @@ typedef enum LOCALE_PINPROTECTION_WRONGCODE, LOCALE_PLUGINS_HDD_DIR, LOCALE_PLUGINS_RESULT, - LOCALE_PROGRESSBAR_COLOR, LOCALE_RCLOCK_LOCKMSG, LOCALE_RCLOCK_MENUEADD, LOCALE_RCLOCK_TITLE, diff --git a/src/system/locals_intern.h b/src/system/locals_intern.h index 1951c6f08..08277139a 100644 --- a/src/system/locals_intern.h +++ b/src/system/locals_intern.h @@ -830,9 +830,6 @@ const char * locale_real_names[] = "menu.hint_infobar_logo", "menu.hint_infobar_logo_dir", "menu.hint_infobar_on_epg", - "menu.hint_infobar_position", - "menu.hint_infobar_progressbar", - "menu.hint_infobar_progressbar_design", "menu.hint_infobar_radiotext", "menu.hint_infobar_res", "menu.hint_infobar_sat", @@ -961,7 +958,10 @@ const char * locale_real_names[] = "menu.hint_power_leds", "menu.hint_pref_lang", "menu.hint_pref_subs", + "menu.hint_progressbar", "menu.hint_progressbar_color", + "menu.hint_progressbar_design", + "menu.hint_progressbar_infobar_position", "menu.hint_protection", "menu.hint_radiomode", "menu.hint_reboot", @@ -1165,17 +1165,6 @@ const char * locale_real_names[] = "miscsettings.infobar_disp_6", "miscsettings.infobar_disp_log", "miscsettings.infobar_logo_hdd_dir", - "miscsettings.infobar_position", - "miscsettings.infobar_position_0", - "miscsettings.infobar_position_1", - "miscsettings.infobar_position_2", - "miscsettings.infobar_position_3", - "miscsettings.infobar_progressbar", - "miscsettings.infobar_progressbar_design", - "miscsettings.infobar_progressbar_design_0", - "miscsettings.infobar_progressbar_design_1", - "miscsettings.infobar_progressbar_design_2", - "miscsettings.infobar_progressbar_design_3", "miscsettings.infobar_sat_display", "miscsettings.infobar_show", "miscsettings.infobar_show_dd_available", @@ -1183,6 +1172,18 @@ const char * locale_real_names[] = "miscsettings.infobar_show_res_simple", "miscsettings.infobar_show_sysfs_hdd", "miscsettings.infobar_show_tuner", + "miscsettings.progressbar", + "miscsettings.progressbar_color", + "miscsettings.progressbar_design", + "miscsettings.progressbar_design_0", + "miscsettings.progressbar_design_1", + "miscsettings.progressbar_design_2", + "miscsettings.progressbar_design_3", + "miscsettings.progressbar_infobar_position", + "miscsettings.progressbar_infobar_position_0", + "miscsettings.progressbar_infobar_position_1", + "miscsettings.progressbar_infobar_position_2", + "miscsettings.progressbar_infobar_position_3", "miscsettings.radiotext", "miscsettings.shutdown_count", "miscsettings.shutdown_count_hint1", @@ -1533,7 +1534,6 @@ const char * locale_real_names[] = "pinprotection.wrongcode", "plugins.hdd_dir", "plugins.result", - "progressbar.color", "rclock.lockmsg", "rclock.menueadd", "rclock.title", From 745104571fade1986544554d590b1d207b9512e0 Mon Sep 17 00:00:00 2001 From: svenhoefer Date: Tue, 26 Mar 2013 01:14:39 +0100 Subject: [PATCH 219/224] - epgplus.cpp: use getScreen{Width/Height}Rel() --- src/gui/epgplus.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/gui/epgplus.cpp b/src/gui/epgplus.cpp index 0aed608ff..030ef4be6 100644 --- a/src/gui/epgplus.cpp +++ b/src/gui/epgplus.cpp @@ -647,8 +647,8 @@ void EpgPlus::init() currentViewMode = ViewMode_Scroll; currentSwapMode = SwapMode_ByPage; #endif - usableScreenWidth = w_max (g_settings.screen_EndX, 0); - usableScreenHeight = h_max (g_settings.screen_EndY, 0); + usableScreenWidth = frameBuffer->getScreenWidthRel(); + usableScreenHeight = frameBuffer->getScreenHeightRel(); std::string FileName = std::string (g_settings.font_file); for (size_t i = 0; i < NumberOfFontSettings; ++i) { int size = fontSettingTable[i].size; @@ -703,8 +703,8 @@ void EpgPlus::init() this->maxNumberOfDisplayableEntries = (this->usableScreenHeight - headerHeight - timeLineHeight - horGap1Height - horGap2Height - footerHeight) / this->entryHeight; this->usableScreenHeight = headerHeight + timeLineHeight + horGap1Height + this->maxNumberOfDisplayableEntries * this->entryHeight + horGap2Height + footerHeight; // recalc deltaY - this->usableScreenX = (((g_settings.screen_EndX - g_settings.screen_StartX) - this->usableScreenWidth) / 2) + g_settings.screen_StartX; - this->usableScreenY = (((g_settings.screen_EndY - g_settings.screen_StartY) - this->usableScreenHeight) / 2) + g_settings.screen_StartY; + this->usableScreenX = getScreenStartX(this->usableScreenWidth); + this->usableScreenY = getScreenStartY(this->usableScreenHeight); this->headerX = this->usableScreenX; this->headerY = this->usableScreenY; From 3a68a4bf190914d4189c44ff33b04163224669ce Mon Sep 17 00:00:00 2001 From: Jacek Jendrzej Date: Tue, 26 Mar 2013 11:52:21 +0100 Subject: [PATCH 220/224] data/satellites.xml: update Eurobird 9A (9.0E) --- data/satellites.xml | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/data/satellites.xml b/data/satellites.xml index 3c9add451..c2ec02bce 100755 --- a/data/satellites.xml +++ b/data/satellites.xml @@ -1179,33 +1179,43 @@ + - + - + - + + - + + + + + - - - - + + + + + + + + From b367b0f5e9c5ac230c38183b854a0ae0843cca36 Mon Sep 17 00:00:00 2001 From: Stefan Seyfried Date: Tue, 26 Mar 2013 19:15:04 +0100 Subject: [PATCH 221/224] Revert "- osd_progressbar_setup: rework locales; marginal changes in code" This reverts commit 33c8526673f1f2e741cc12251420b9b2b6fd29e6. A better and simpler solution for progressbar setup is already in place. --- data/locale/deutsch.locale | 30 ++++++++-------- data/locale/english.locale | 32 ++++++++--------- src/gui/osd_progressbar_setup.cpp | 57 +++++++++++++++---------------- src/gui/osd_setup.cpp | 6 ++-- src/system/locals.h | 30 ++++++++-------- src/system/locals_intern.h | 30 ++++++++-------- 6 files changed, 92 insertions(+), 93 deletions(-) diff --git a/data/locale/deutsch.locale b/data/locale/deutsch.locale index c2cf6564a..a44a21c5d 100644 --- a/data/locale/deutsch.locale +++ b/data/locale/deutsch.locale @@ -803,6 +803,9 @@ menu.hint_infobar_fonts Ändern Sie die Schriftgrößen in der Infobar menu.hint_infobar_logo Logo- und Signal-Optionen menu.hint_infobar_logo_dir Wählen Sie das Verzeichnis für die Senderlogos menu.hint_infobar_on_epg Zeigt einen Hinweis bei EPG-Änderungen +menu.hint_infobar_position Wählt die Optionen des Fortschrittsbalken in der Infobar +menu.hint_infobar_progressbar Wählen sie die Optionen für die Progressbar-Anzeige +menu.hint_infobar_progressbar_design Stellen Sie das Design des Fortschrittsbalkens ein menu.hint_infobar_radiotext Zeigt Radiotext in einen Fenster, wenn verfügbar menu.hint_infobar_res Zeige die gesendete Auflösung in Symbolen menu.hint_infobar_sat Zeigt die aktuellen Satelliten- oder Kabel-Provider @@ -931,10 +934,7 @@ menu.hint_plugins_hdd_dir Auswahl des Verzeichnisses zum Laden der Plugins von e menu.hint_power_leds Konfiguriert das Verhalten der LEDs an der Power-Taste menu.hint_pref_lang Wählen Sie ihre bevorzugte Tonspur und EPG-Sprache,\ndie Einstellung 'none' deaktiviert diese Option menu.hint_pref_subs Wählen Sie ihre bevorzugte Untertitel-Sprache,\ndie Einstellung 'none' deaktiviert diese Option -menu.hint_progressbar Wählen Sie die Optionen für die Fortschrittsbalken-Anzeige menu.hint_progressbar_color Bei aktivierter Option werden alle Fortschrittsbalken in Farbe und nicht im klassischen Weiß angezeigt -menu.hint_progressbar_design Stellen Sie das Design des Fortschrittsbalkens ein -menu.hint_progressbar_infobar_position Wählt die Optionen des Fortschrittsbalkens in der Infobar menu.hint_protection Schützen Sie Inhalte per PIN-Code\nStandard-PIN ist 0000 menu.hint_radiomode Schaltet zum Radio-Modus menu.hint_reboot Startet die Box neu\nDer Neustart erfolgt ohne Bestätigung! @@ -1138,18 +1138,17 @@ miscsettings.infobar_disp_5 Logo/Signalbalken miscsettings.infobar_disp_6 Logo+Kanalnummer/Signalbalken miscsettings.infobar_disp_log Logo miscsettings.infobar_logo_hdd_dir Logo-Verz. -miscsettings.progressbar Fortschrittsbalken -miscsettings.progressbar_color Farbe -miscsettings.progressbar_design Design -miscsettings.progressbar_design_0 Punkte -miscsettings.progressbar_design_1 vertikale Balken -miscsettings.progressbar_design_2 horizontale Balken -miscsettings.progressbar_design_3 Farbverlauf -miscsettings.progressbar_infobar_position Position -miscsettings.progressbar_infobar_position_0 Standard -miscsettings.progressbar_infobar_position_1 unterhalb Kanalname -miscsettings.progressbar_infobar_position_2 unterhalb Kanalname (schmal) -miscsettings.progressbar_infobar_position_3 zwischen EPG-Events (schmal) +miscsettings.infobar_position Progessbarposition +miscsettings.infobar_position_0 Standard +miscsettings.infobar_position_1 unterhalb Kanalname +miscsettings.infobar_position_2 unterhalb Kanalname (schmal) +miscsettings.infobar_position_3 zwischen EPG-Events (schmal) +miscsettings.infobar_progressbar Fortschrittsbalken +miscsettings.infobar_progressbar_design Progressbar +miscsettings.infobar_progressbar_design_0 Punktdesign +miscsettings.infobar_progressbar_design_1 Balkendesign Vertikal +miscsettings.infobar_progressbar_design_2 Balkendesign Horizontal +miscsettings.infobar_progressbar_design_3 farbig miscsettings.infobar_sat_display Kabel-/Satellitenanbieter miscsettings.infobar_show Info bei EPG Änderungen miscsettings.infobar_show_dd_available DD-Verfügbarkeit anzeigen @@ -1507,6 +1506,7 @@ pinprotection.head PIN-Abfrage pinprotection.wrongcode Geben Sie den Code nocheinmal ein! plugins.hdd_dir Externes Plugin-Verz. plugins.result Pluginausgabe +progressbar.color Fortschrittsbalken Farbe rclock.lockmsg Die Fernbedienung der Coolstream wird gesperrt.\n Um die Sperre aufzuheben, bitte\n und auf der Fernbedienung\n drücken. rclock.menueadd FB sperren rclock.title Fernbedienung sperren diff --git a/data/locale/english.locale b/data/locale/english.locale index ef133967c..e89182548 100644 --- a/data/locale/english.locale +++ b/data/locale/english.locale @@ -803,6 +803,9 @@ menu.hint_infobar_fonts Change infobar font sizes menu.hint_infobar_logo Logo / signal options menu.hint_infobar_logo_dir Select directory to search for channels logo menu.hint_infobar_on_epg Show infobar on current EPG event change +menu.hint_infobar_position Selects the options of Progressbar in the Infobar +menu.hint_infobar_progressbar Select the options for the Progressbar +menu.hint_infobar_progressbar_design Here you can choose the design of the Progressbar with active color option. menu.hint_infobar_radiotext Show radiotext window menu.hint_infobar_res Show channel resolution icons menu.hint_infobar_sat Show current satellite or cable provider @@ -931,10 +934,7 @@ menu.hint_plugins_hdd_dir Select directory to load\nplugins from menu.hint_power_leds Configure power-button LEDs behavior menu.hint_pref_lang Select preferred audio and EPG language\nselect 'none' to disable menu.hint_pref_subs Select preferred subtitle language\nselect 'none' to disable -menu.hint_progressbar Select the options for the progressbar -menu.hint_progressbar_color Show colored progressbar -menu.hint_progressbar_design Here you can choose the design of progressbar with active color option -menu.hint_progressbar_infobar_position Selects the options of progressbar in the infobar +menu.hint_progressbar_color Show colored progress bars menu.hint_protection Protect content by PIN code\nDefault PIN 0000 menu.hint_radiomode Switch box to radio mode menu.hint_reboot Reboot box\nNo confirmation @@ -1138,18 +1138,17 @@ miscsettings.infobar_disp_5 Logo+signal miscsettings.infobar_disp_6 Logo+channel number+signal miscsettings.infobar_disp_log Logo miscsettings.infobar_logo_hdd_dir Logo dir -miscsettings.progressbar Progressbar -miscsettings.progressbar_color Color -miscsettings.progressbar_design Design -miscsettings.progressbar_design_0 points -miscsettings.progressbar_design_1 vertical bars -miscsettings.progressbar_design_2 horizontal bars -miscsettings.progressbar_design_3 colored -miscsettings.progressbar_infobar_position Position -miscsettings.progressbar_infobar_position_0 standard -miscsettings.progressbar_infobar_position_1 below channel name -miscsettings.progressbar_infobar_position_2 small below channel name -miscsettings.progressbar_infobar_position_3 narrow between EPG-Events +miscsettings.infobar_position Progressbar Position +miscsettings.infobar_position_0 standard +miscsettings.infobar_position_1 below channel name +miscsettings.infobar_position_2 small below channel name +miscsettings.infobar_position_3 narrow between EPG-Events +miscsettings.infobar_progressbar Progressbar +miscsettings.infobar_progressbar_design Progressbar +miscsettings.infobar_progressbar_design_0 point Design +miscsettings.infobar_progressbar_design_1 bar Design vertical +miscsettings.infobar_progressbar_design_2 bar Design horizontal +miscsettings.infobar_progressbar_design_3 colored miscsettings.infobar_sat_display Satellite display on infobar miscsettings.infobar_show show Info on EPG change miscsettings.infobar_show_dd_available show DD availability @@ -1507,6 +1506,7 @@ pinprotection.head Enter PIN code pinprotection.wrongcode PIN-Code was wrong! Try again. plugins.hdd_dir Plugin HDD dir. plugins.result plugin output +progressbar.color Progressbar Color rclock.lockmsg Your box remote control will be locked.\n To unlock it, press \n and on your remote control. rclock.menueadd Lock RC rclock.title Lock Remote Control diff --git a/src/gui/osd_progressbar_setup.cpp b/src/gui/osd_progressbar_setup.cpp index 7ac692717..78591453a 100644 --- a/src/gui/osd_progressbar_setup.cpp +++ b/src/gui/osd_progressbar_setup.cpp @@ -39,22 +39,22 @@ #include -#define PROGRESSBAR_INFOBAR_POSITION_COUNT 4 -const CMenuOptionChooser::keyval PROGRESSBAR_INFOBAR_POSITION_OPTIONS[PROGRESSBAR_INFOBAR_POSITION_COUNT]= +#define LOCALE_MISCSETTINGS_INFOBAR_POSITION_COUNT 4 +const CMenuOptionChooser::keyval LOCALE_MISCSETTINGS_INFOBAR_POSITION_OPTIONS[LOCALE_MISCSETTINGS_INFOBAR_POSITION_COUNT]= { - { 0 , LOCALE_MISCSETTINGS_PROGRESSBAR_INFOBAR_POSITION_0 }, - { 1 , LOCALE_MISCSETTINGS_PROGRESSBAR_INFOBAR_POSITION_1 }, - { 2 , LOCALE_MISCSETTINGS_PROGRESSBAR_INFOBAR_POSITION_2 }, - { 3 , LOCALE_MISCSETTINGS_PROGRESSBAR_INFOBAR_POSITION_3 } + { 0 , LOCALE_MISCSETTINGS_INFOBAR_POSITION_0 }, + { 1 , LOCALE_MISCSETTINGS_INFOBAR_POSITION_1 }, + { 2 , LOCALE_MISCSETTINGS_INFOBAR_POSITION_2 }, + { 3 , LOCALE_MISCSETTINGS_INFOBAR_POSITION_3 } }; -#define PROGRESSBAR_DESIGN_COUNT 4 -const CMenuOptionChooser::keyval PROGRESSBAR_DESIGN_OPTIONS[PROGRESSBAR_DESIGN_COUNT]= +#define LOCALE_MISCSETTINGS_INFOBAR_PROGRESSBAR_DESIGN_COUNT 4 +const CMenuOptionChooser::keyval LOCALE_MISCSETTINGS_INFOBAR_PROGRESSBAR_DESIGN_OPTIONS[LOCALE_MISCSETTINGS_INFOBAR_PROGRESSBAR_DESIGN_COUNT]= { - { 0 , LOCALE_MISCSETTINGS_PROGRESSBAR_DESIGN_0 }, - { 1 , LOCALE_MISCSETTINGS_PROGRESSBAR_DESIGN_1 }, - { 2 , LOCALE_MISCSETTINGS_PROGRESSBAR_DESIGN_2 }, - { 3 , LOCALE_MISCSETTINGS_PROGRESSBAR_DESIGN_3 } + { 0 , LOCALE_MISCSETTINGS_INFOBAR_PROGRESSBAR_DESIGN_0 }, + { 1 , LOCALE_MISCSETTINGS_INFOBAR_PROGRESSBAR_DESIGN_1 }, + { 2 , LOCALE_MISCSETTINGS_INFOBAR_PROGRESSBAR_DESIGN_2 }, + { 3 , LOCALE_MISCSETTINGS_INFOBAR_PROGRESSBAR_DESIGN_3 } }; CProgressbarSetup::CProgressbarSetup() @@ -83,32 +83,31 @@ int CProgressbarSetup::showMenu() CMenuWidget *progress = new CMenuWidget(LOCALE_MAINMENU_SETTINGS, NEUTRINO_ICON_SETTINGS, width, MN_WIDGET_ID_PROGRESSBAR); //intros: back ande save - progress->addIntroItems(LOCALE_MISCSETTINGS_PROGRESSBAR); + progress->addIntroItems(LOCALE_MISCSETTINGS_INFOBAR_PROGRESSBAR); + //infobar progresscolor on/off COnOffNotifier* miscProgressNotifier = new COnOffNotifier(0); - //color on/off - CMenuOptionChooser *color; - color = new CMenuOptionChooser(LOCALE_MISCSETTINGS_PROGRESSBAR_COLOR, &g_settings.progressbar_color, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true, miscProgressNotifier); - color->setHint("", LOCALE_MENU_HINT_PROGRESSBAR_COLOR); + CMenuOptionChooser *progresscolor; + progresscolor = new CMenuOptionChooser(LOCALE_PROGRESSBAR_COLOR, &g_settings.progressbar_color, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true, miscProgressNotifier); + progresscolor->setHint("", LOCALE_MENU_HINT_PROGRESSBAR_COLOR); - //design - CMenuOptionChooser *design; - design = new CMenuOptionChooser(LOCALE_MISCSETTINGS_PROGRESSBAR_DESIGN, &g_settings.progressbar_design, PROGRESSBAR_DESIGN_OPTIONS, PROGRESSBAR_DESIGN_COUNT, g_settings.progressbar_color); - design->setHint("", LOCALE_MENU_HINT_PROGRESSBAR_DESIGN); + //infobar design + CMenuOptionChooser *progressdesign = new CMenuOptionChooser(LOCALE_MISCSETTINGS_INFOBAR_PROGRESSBAR_DESIGN, &g_settings.progressbar_design, LOCALE_MISCSETTINGS_INFOBAR_PROGRESSBAR_DESIGN_OPTIONS, LOCALE_MISCSETTINGS_INFOBAR_PROGRESSBAR_DESIGN_COUNT, g_settings.progressbar_color); + progressdesign->setHint("", LOCALE_MENU_HINT_INFOBAR_PROGRESSBAR_DESIGN); - //infobar position - CMenuOptionChooser *infobar_position; - infobar_position = new CMenuOptionChooser(LOCALE_MISCSETTINGS_PROGRESSBAR_INFOBAR_POSITION, &g_settings.infobar_progressbar, PROGRESSBAR_INFOBAR_POSITION_OPTIONS, PROGRESSBAR_INFOBAR_POSITION_COUNT, true); - infobar_position->setHint("", LOCALE_MENU_HINT_PROGRESSBAR_INFOBAR_POSITION); + //infobar progressbarposition + CMenuOptionChooser *progressbarposition; + progressbarposition = new CMenuOptionChooser(LOCALE_MISCSETTINGS_INFOBAR_POSITION, &g_settings.infobar_progressbar, LOCALE_MISCSETTINGS_INFOBAR_POSITION_OPTIONS, LOCALE_MISCSETTINGS_INFOBAR_POSITION_COUNT, true); + progressbarposition->setHint("", LOCALE_MENU_HINT_INFOBAR_POSITION); - miscProgressNotifier->addItem(design); + miscProgressNotifier->addItem(progressdesign); //paint items - progress->addItem(color); - progress->addItem(design); + progress->addItem(progresscolor); + progress->addItem(progressdesign); progress->addItem(new CMenuSeparator(CMenuSeparator::LINE | CMenuSeparator::STRING, LOCALE_MISCSETTINGS_INFOBAR)); - progress->addItem(infobar_position); + progress->addItem(progressbarposition); int res = progress->exec (NULL, ""); delete miscProgressNotifier; diff --git a/src/gui/osd_setup.cpp b/src/gui/osd_setup.cpp index ee7a147e6..5c05215f3 100644 --- a/src/gui/osd_setup.cpp +++ b/src/gui/osd_setup.cpp @@ -429,9 +429,9 @@ int COsdSetup::showOsdSetup() osd_menu->addItem(mf); //progressbar - mf = new CMenuForwarder(LOCALE_MISCSETTINGS_PROGRESSBAR, true, NULL, new CProgressbarSetup(), NULL, CRCInput::RC_1); - mf->setHint("", LOCALE_MENU_HINT_PROGRESSBAR); - osd_menu->addItem(mf); + CMenuForwarder * progress = new CMenuForwarder(LOCALE_MISCSETTINGS_INFOBAR_PROGRESSBAR, true, NULL, new CProgressbarSetup(), NULL, CRCInput::RC_1); + progress->setHint("", LOCALE_MENU_HINT_INFOBAR_PROGRESSBAR); + osd_menu->addItem(progress); //infobar CMenuWidget osd_menu_infobar(LOCALE_MAINMENU_SETTINGS, NEUTRINO_ICON_SETTINGS, width, MN_WIDGET_ID_OSDSETUP_INFOBAR); diff --git a/src/system/locals.h b/src/system/locals.h index b3d852207..9cc9c7bdb 100644 --- a/src/system/locals.h +++ b/src/system/locals.h @@ -830,6 +830,9 @@ typedef enum LOCALE_MENU_HINT_INFOBAR_LOGO, LOCALE_MENU_HINT_INFOBAR_LOGO_DIR, LOCALE_MENU_HINT_INFOBAR_ON_EPG, + LOCALE_MENU_HINT_INFOBAR_POSITION, + LOCALE_MENU_HINT_INFOBAR_PROGRESSBAR, + LOCALE_MENU_HINT_INFOBAR_PROGRESSBAR_DESIGN, LOCALE_MENU_HINT_INFOBAR_RADIOTEXT, LOCALE_MENU_HINT_INFOBAR_RES, LOCALE_MENU_HINT_INFOBAR_SAT, @@ -958,10 +961,7 @@ typedef enum LOCALE_MENU_HINT_POWER_LEDS, LOCALE_MENU_HINT_PREF_LANG, LOCALE_MENU_HINT_PREF_SUBS, - LOCALE_MENU_HINT_PROGRESSBAR, LOCALE_MENU_HINT_PROGRESSBAR_COLOR, - LOCALE_MENU_HINT_PROGRESSBAR_DESIGN, - LOCALE_MENU_HINT_PROGRESSBAR_INFOBAR_POSITION, LOCALE_MENU_HINT_PROTECTION, LOCALE_MENU_HINT_RADIOMODE, LOCALE_MENU_HINT_REBOOT, @@ -1165,6 +1165,17 @@ typedef enum LOCALE_MISCSETTINGS_INFOBAR_DISP_6, LOCALE_MISCSETTINGS_INFOBAR_DISP_LOG, LOCALE_MISCSETTINGS_INFOBAR_LOGO_HDD_DIR, + LOCALE_MISCSETTINGS_INFOBAR_POSITION, + LOCALE_MISCSETTINGS_INFOBAR_POSITION_0, + LOCALE_MISCSETTINGS_INFOBAR_POSITION_1, + LOCALE_MISCSETTINGS_INFOBAR_POSITION_2, + LOCALE_MISCSETTINGS_INFOBAR_POSITION_3, + LOCALE_MISCSETTINGS_INFOBAR_PROGRESSBAR, + LOCALE_MISCSETTINGS_INFOBAR_PROGRESSBAR_DESIGN, + LOCALE_MISCSETTINGS_INFOBAR_PROGRESSBAR_DESIGN_0, + LOCALE_MISCSETTINGS_INFOBAR_PROGRESSBAR_DESIGN_1, + LOCALE_MISCSETTINGS_INFOBAR_PROGRESSBAR_DESIGN_2, + LOCALE_MISCSETTINGS_INFOBAR_PROGRESSBAR_DESIGN_3, LOCALE_MISCSETTINGS_INFOBAR_SAT_DISPLAY, LOCALE_MISCSETTINGS_INFOBAR_SHOW, LOCALE_MISCSETTINGS_INFOBAR_SHOW_DD_AVAILABLE, @@ -1172,18 +1183,6 @@ typedef enum LOCALE_MISCSETTINGS_INFOBAR_SHOW_RES_SIMPLE, LOCALE_MISCSETTINGS_INFOBAR_SHOW_SYSFS_HDD, LOCALE_MISCSETTINGS_INFOBAR_SHOW_TUNER, - LOCALE_MISCSETTINGS_PROGRESSBAR, - LOCALE_MISCSETTINGS_PROGRESSBAR_COLOR, - LOCALE_MISCSETTINGS_PROGRESSBAR_DESIGN, - LOCALE_MISCSETTINGS_PROGRESSBAR_DESIGN_0, - LOCALE_MISCSETTINGS_PROGRESSBAR_DESIGN_1, - LOCALE_MISCSETTINGS_PROGRESSBAR_DESIGN_2, - LOCALE_MISCSETTINGS_PROGRESSBAR_DESIGN_3, - LOCALE_MISCSETTINGS_PROGRESSBAR_INFOBAR_POSITION, - LOCALE_MISCSETTINGS_PROGRESSBAR_INFOBAR_POSITION_0, - LOCALE_MISCSETTINGS_PROGRESSBAR_INFOBAR_POSITION_1, - LOCALE_MISCSETTINGS_PROGRESSBAR_INFOBAR_POSITION_2, - LOCALE_MISCSETTINGS_PROGRESSBAR_INFOBAR_POSITION_3, LOCALE_MISCSETTINGS_RADIOTEXT, LOCALE_MISCSETTINGS_SHUTDOWN_COUNT, LOCALE_MISCSETTINGS_SHUTDOWN_COUNT_HINT1, @@ -1534,6 +1533,7 @@ typedef enum LOCALE_PINPROTECTION_WRONGCODE, LOCALE_PLUGINS_HDD_DIR, LOCALE_PLUGINS_RESULT, + LOCALE_PROGRESSBAR_COLOR, LOCALE_RCLOCK_LOCKMSG, LOCALE_RCLOCK_MENUEADD, LOCALE_RCLOCK_TITLE, diff --git a/src/system/locals_intern.h b/src/system/locals_intern.h index 08277139a..1951c6f08 100644 --- a/src/system/locals_intern.h +++ b/src/system/locals_intern.h @@ -830,6 +830,9 @@ const char * locale_real_names[] = "menu.hint_infobar_logo", "menu.hint_infobar_logo_dir", "menu.hint_infobar_on_epg", + "menu.hint_infobar_position", + "menu.hint_infobar_progressbar", + "menu.hint_infobar_progressbar_design", "menu.hint_infobar_radiotext", "menu.hint_infobar_res", "menu.hint_infobar_sat", @@ -958,10 +961,7 @@ const char * locale_real_names[] = "menu.hint_power_leds", "menu.hint_pref_lang", "menu.hint_pref_subs", - "menu.hint_progressbar", "menu.hint_progressbar_color", - "menu.hint_progressbar_design", - "menu.hint_progressbar_infobar_position", "menu.hint_protection", "menu.hint_radiomode", "menu.hint_reboot", @@ -1165,6 +1165,17 @@ const char * locale_real_names[] = "miscsettings.infobar_disp_6", "miscsettings.infobar_disp_log", "miscsettings.infobar_logo_hdd_dir", + "miscsettings.infobar_position", + "miscsettings.infobar_position_0", + "miscsettings.infobar_position_1", + "miscsettings.infobar_position_2", + "miscsettings.infobar_position_3", + "miscsettings.infobar_progressbar", + "miscsettings.infobar_progressbar_design", + "miscsettings.infobar_progressbar_design_0", + "miscsettings.infobar_progressbar_design_1", + "miscsettings.infobar_progressbar_design_2", + "miscsettings.infobar_progressbar_design_3", "miscsettings.infobar_sat_display", "miscsettings.infobar_show", "miscsettings.infobar_show_dd_available", @@ -1172,18 +1183,6 @@ const char * locale_real_names[] = "miscsettings.infobar_show_res_simple", "miscsettings.infobar_show_sysfs_hdd", "miscsettings.infobar_show_tuner", - "miscsettings.progressbar", - "miscsettings.progressbar_color", - "miscsettings.progressbar_design", - "miscsettings.progressbar_design_0", - "miscsettings.progressbar_design_1", - "miscsettings.progressbar_design_2", - "miscsettings.progressbar_design_3", - "miscsettings.progressbar_infobar_position", - "miscsettings.progressbar_infobar_position_0", - "miscsettings.progressbar_infobar_position_1", - "miscsettings.progressbar_infobar_position_2", - "miscsettings.progressbar_infobar_position_3", "miscsettings.radiotext", "miscsettings.shutdown_count", "miscsettings.shutdown_count_hint1", @@ -1534,6 +1533,7 @@ const char * locale_real_names[] = "pinprotection.wrongcode", "plugins.hdd_dir", "plugins.result", + "progressbar.color", "rclock.lockmsg", "rclock.menueadd", "rclock.title", From f6abb909ae63e8be79382377d68ab784d9f0ce88 Mon Sep 17 00:00:00 2001 From: Stefan Seyfried Date: Tue, 26 Mar 2013 19:16:39 +0100 Subject: [PATCH 222/224] Revert "CProgressbarSetup: using unified 'osd' namespace" This reverts commit 7e1ef5d325a727a6bfe8294c194280020623a22f. A better and simpler solution for progressbar setup is already in place. --- src/gui/Makefile.am | 2 +- src/gui/osd_setup.cpp | 2 +- src/gui/{osd_progressbar_setup.cpp => progressbar_setup.cpp} | 5 ++--- src/gui/{osd_progressbar_setup.h => progressbar_setup.h} | 3 +-- 4 files changed, 5 insertions(+), 7 deletions(-) rename src/gui/{osd_progressbar_setup.cpp => progressbar_setup.cpp} (97%) rename src/gui/{osd_progressbar_setup.h => progressbar_setup.h} (92%) diff --git a/src/gui/Makefile.am b/src/gui/Makefile.am index ed74a5892..814773ccb 100644 --- a/src/gui/Makefile.am +++ b/src/gui/Makefile.am @@ -73,7 +73,6 @@ libneutrino_gui_a_SOURCES = \ network_service.cpp \ network_setup.cpp \ nfs.cpp \ - osd_progressbar_setup.cpp \ osd_setup.cpp \ osdlang_setup.cpp \ parentallock_setup.cpp \ @@ -82,6 +81,7 @@ libneutrino_gui_a_SOURCES = \ pictureviewer_setup.cpp \ pluginlist.cpp \ plugins.cpp \ + progressbar_setup.cpp \ proxyserver_setup.cpp \ rc_lock.cpp \ record_setup.cpp \ diff --git a/src/gui/osd_setup.cpp b/src/gui/osd_setup.cpp index 5c05215f3..4893b39c0 100644 --- a/src/gui/osd_setup.cpp +++ b/src/gui/osd_setup.cpp @@ -43,7 +43,7 @@ #include "screensetup.h" #include "osdlang_setup.h" #include "filebrowser.h" -#include "osd_progressbar_setup.h" +#include "progressbar_setup.h" #include #include diff --git a/src/gui/osd_progressbar_setup.cpp b/src/gui/progressbar_setup.cpp similarity index 97% rename from src/gui/osd_progressbar_setup.cpp rename to src/gui/progressbar_setup.cpp index 78591453a..3ca86969e 100644 --- a/src/gui/osd_progressbar_setup.cpp +++ b/src/gui/progressbar_setup.cpp @@ -19,8 +19,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ @@ -28,7 +27,7 @@ #include #endif -#include "osd_progressbar_setup.h" +#include "progressbar_setup.h" #include #include diff --git a/src/gui/osd_progressbar_setup.h b/src/gui/progressbar_setup.h similarity index 92% rename from src/gui/osd_progressbar_setup.h rename to src/gui/progressbar_setup.h index 30dbe4625..b650e9cb6 100644 --- a/src/gui/osd_progressbar_setup.h +++ b/src/gui/progressbar_setup.h @@ -19,8 +19,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ From 3ab1cd74dae7f187d847fe94d620ab7ab6db652a Mon Sep 17 00:00:00 2001 From: Stefan Seyfried Date: Tue, 26 Mar 2013 19:17:06 +0100 Subject: [PATCH 223/224] Revert "progresbar -add colored & vertical design , ported from neutrino-mp" This reverts commit a501b6efebdc6528ac1af548186018b44a015977. A better and simpler solution for progressbar setup is already in place. --- data/locale/deutsch.locale | 4 +- data/locale/english.locale | 4 +- src/gui/progressbar_setup.cpp | 6 +- src/gui/widget/progressbar.cpp | 148 ++++++++++++++------------------- src/gui/widget/progressbar.h | 10 +-- src/system/locals.h | 2 - src/system/locals_intern.h | 2 - 7 files changed, 70 insertions(+), 106 deletions(-) diff --git a/data/locale/deutsch.locale b/data/locale/deutsch.locale index a44a21c5d..43c124e45 100644 --- a/data/locale/deutsch.locale +++ b/data/locale/deutsch.locale @@ -1146,9 +1146,7 @@ miscsettings.infobar_position_3 zwischen EPG-Events (schmal) miscsettings.infobar_progressbar Fortschrittsbalken miscsettings.infobar_progressbar_design Progressbar miscsettings.infobar_progressbar_design_0 Punktdesign -miscsettings.infobar_progressbar_design_1 Balkendesign Vertikal -miscsettings.infobar_progressbar_design_2 Balkendesign Horizontal -miscsettings.infobar_progressbar_design_3 farbig +miscsettings.infobar_progressbar_design_1 Balkendesign miscsettings.infobar_sat_display Kabel-/Satellitenanbieter miscsettings.infobar_show Info bei EPG Änderungen miscsettings.infobar_show_dd_available DD-Verfügbarkeit anzeigen diff --git a/data/locale/english.locale b/data/locale/english.locale index e89182548..18a0610f4 100644 --- a/data/locale/english.locale +++ b/data/locale/english.locale @@ -1146,9 +1146,7 @@ miscsettings.infobar_position_3 narrow between EPG-Events miscsettings.infobar_progressbar Progressbar miscsettings.infobar_progressbar_design Progressbar miscsettings.infobar_progressbar_design_0 point Design -miscsettings.infobar_progressbar_design_1 bar Design vertical -miscsettings.infobar_progressbar_design_2 bar Design horizontal -miscsettings.infobar_progressbar_design_3 colored +miscsettings.infobar_progressbar_design_1 bar Design miscsettings.infobar_sat_display Satellite display on infobar miscsettings.infobar_show show Info on EPG change miscsettings.infobar_show_dd_available show DD availability diff --git a/src/gui/progressbar_setup.cpp b/src/gui/progressbar_setup.cpp index 3ca86969e..98d17fa50 100644 --- a/src/gui/progressbar_setup.cpp +++ b/src/gui/progressbar_setup.cpp @@ -47,13 +47,11 @@ const CMenuOptionChooser::keyval LOCALE_MISCSETTINGS_INFOBAR_POSITION_OPTIONS[L { 3 , LOCALE_MISCSETTINGS_INFOBAR_POSITION_3 } }; -#define LOCALE_MISCSETTINGS_INFOBAR_PROGRESSBAR_DESIGN_COUNT 4 +#define LOCALE_MISCSETTINGS_INFOBAR_PROGRESSBAR_DESIGN_COUNT 2 const CMenuOptionChooser::keyval LOCALE_MISCSETTINGS_INFOBAR_PROGRESSBAR_DESIGN_OPTIONS[LOCALE_MISCSETTINGS_INFOBAR_PROGRESSBAR_DESIGN_COUNT]= { { 0 , LOCALE_MISCSETTINGS_INFOBAR_PROGRESSBAR_DESIGN_0 }, - { 1 , LOCALE_MISCSETTINGS_INFOBAR_PROGRESSBAR_DESIGN_1 }, - { 2 , LOCALE_MISCSETTINGS_INFOBAR_PROGRESSBAR_DESIGN_2 }, - { 3 , LOCALE_MISCSETTINGS_INFOBAR_PROGRESSBAR_DESIGN_3 } + { 1 , LOCALE_MISCSETTINGS_INFOBAR_PROGRESSBAR_DESIGN_1 } }; CProgressbarSetup::CProgressbarSetup() diff --git a/src/gui/widget/progressbar.cpp b/src/gui/widget/progressbar.cpp index 355eb0fbd..e9bef678e 100644 --- a/src/gui/widget/progressbar.cpp +++ b/src/gui/widget/progressbar.cpp @@ -1,6 +1,5 @@ /* * (C) 2008 by dbt - * (C) 2009-2010, 2012-2013 Stefan Seyfried * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -56,7 +55,7 @@ CProgressBar::~CProgressBar() { } -static inline unsigned int make16color(__u32 rgb) +inline unsigned int make16color(__u32 rgb) { return 0xFF000000 | rgb; } @@ -107,7 +106,7 @@ void CProgressBar::paintProgressBar2(const int pos_x, } void CProgressBar::realpaint(const int pos_x, const int pos_y, - const int val, const int max_value, + const int value, const int max_value, const fb_pixel_t activebar_col, const fb_pixel_t passivebar_col, const fb_pixel_t backgroundbar_col, @@ -121,14 +120,6 @@ void CProgressBar::realpaint(const int pos_x, const int pos_y, bl_changed = g_settings.progressbar_color; reset(); } - - /* stupid callers give invalid values like "-1"... */ - int value = val; - if (value < 0) - value = 0; - if (value > max_value) - value = max_value; - // set colors fb_pixel_t active_col = activebar_col != 0 ? activebar_col : COL_INFOBAR_PLUS_7; fb_pixel_t passive_col = passivebar_col != 0 ? passivebar_col : COL_INFOBAR_PLUS_3; @@ -162,11 +153,11 @@ void CProgressBar::realpaint(const int pos_x, const int pos_y, // max height progressbar bar, if icon height larger than pb_height then get height from icon int pb_max_height = icon_h > height ? icon_h + 2* frame_widht : height; + // max height of active/passive bar + int bar_height = pb_max_height - 2*frame_widht; + if (!blink || !g_settings.progressbar_color) { - // max height of active/passive bar - int bar_height = pb_max_height - 2*frame_widht; - int start_x_passive_bar = start_x + active_pb_width; int width_passive_bar = pb_max_width - active_pb_width; @@ -191,37 +182,14 @@ void CProgressBar::realpaint(const int pos_x, const int pos_y, } else { - int itemw = ITEMW, itemh = ITEMW, pointx = POINT, pointy = POINT; - if(g_settings.progressbar_color){ - switch ((pb_color_t)g_settings.progressbar_design){ - default: - case PB_MATRIX: /* matrix */ - break; - case PB_LINES_V: /* vert. lines */ - itemh = height; - pointy = height; - break; - case PB_LINES_H: /* horiz. lines */ - itemw = POINT; - break; - case PB_COLOR: /* filled color */ - itemw = POINT; - itemh = height; - pointy = height; - break; - } - } - const int spc = itemh - pointy; /* space between horizontal lines / points */ - int hcnt = (height + spc) / itemh; /* how many POINTs is the bar high */ - int yoff = (height + spc - itemh * hcnt) / 2; - //printf("height: %d itemh: %d hcnt: %d yoff: %d spc: %d\n", height, itemh, hcnt, yoff, spc); /* red, yellow, green are given in percent */ - int rd = red * width / (100 * itemw); /* how many POINTs red */ - int yw = yellow * width / (100 * itemw); /* how many POINTs yellow */ - int gn = green * width / (100 * itemw); /* how many POINTs green */ + int rd = red * width / (100 * ITEMW); /* how many POINTs red */ + int yw = yellow * width / (100 * ITEMW); /* how many POINTs yellow */ + int gn = green * width / (100 * ITEMW); /* how many POINTs green */ - int maxi = active_pb_width / itemw; /* how many POINTs is the active bar */ - int total = width / itemw; /* total number of POINTs */ + int hcnt = height / ITEMW; /* how many POINTs is the bar high */ + int maxi = active_pb_width / ITEMW; /* how many POINTs is the active bar */ + int total = width / ITEMW; /* total number of POINTs */ uint32_t rgb; fb_pixel_t color; @@ -234,73 +202,85 @@ void CProgressBar::realpaint(const int pos_x, const int pos_y, width, pb_max_height, shadowbar_col, c_rad); // shadow } - if (active_pb_width != last_width) { + if (active_pb_width != last_width) + { + int step; int i, j; - const int py = pos_y + yoff; - if (active_pb_width > last_width) { - int step, off; - int b = 0; - uint8_t diff = 0; - for (i = 0; (i < rd) && (i < maxi); i++) { - diff = i * 255 / rd; + int b = 0; + if (active_pb_width > last_width) + { + for (i = 0; (i < rd) && (i < maxi); i++) + { //green section + step = 255 / rd; if (invert) - rgb = GREEN + (diff << 16); // adding red + rgb = GREEN + ((unsigned char)(step * i) << 16); // adding red else - rgb = RED + (diff << 8); // adding green + rgb = RED + ((unsigned char)(step * i) << 8); // adding green color = make16color(rgb); - for (j = 0; j < hcnt; j++) - frameBuffer->paintBoxRel(pos_x + i * itemw, py + j * itemh, - pointx, pointy, color); + if (g_settings.progressbar_design == 0) + { + for(j = 0; j <= hcnt; j++) + frameBuffer->paintBoxRel(pos_x + i * ITEMW, pos_y + j * ITEMW, POINT, POINT, color); + } + else + frameBuffer->paintBoxRel(pos_x + i * ITEMW,start_y, POINT, bar_height, color); } - step = yw - rd - 1; - if (step < 1) - step = 1; - for (; (i < yw) && (i < maxi); i++) { - diff = b++ * 255 / step / 2; + for (; (i < yw) && (i < maxi); i++) + { //yello section + step = 255 / yw / 2; if (invert) - rgb = YELLOW - (diff << 8); // removing green + rgb = YELLOW - ((unsigned char)(step * (b++)) << 8); // removing green else - rgb = YELLOW - (diff << 16); // removing red + rgb = YELLOW - ((unsigned char)(step * (b++)) << 16); // removing red color = make16color(rgb); - for (j = 0; j < hcnt; j++) - frameBuffer->paintBoxRel(pos_x + i * itemw, py + j * itemh, - pointx, pointy, color); + if (g_settings.progressbar_design == 0) + { + for(j = 0; j <= hcnt; j++) + frameBuffer->paintBoxRel(pos_x + i * ITEMW, pos_y + j * ITEMW, POINT, POINT, color); + } + else + frameBuffer->paintBoxRel(pos_x + i * ITEMW, start_y, POINT, bar_height, color); } - off = diff; - b = 0; - step = gn - yw - 1; - if (step < 1) - step = 1; - for (; (i < gn) && (i < maxi); i++) { - diff = b++ * 255 / step / 2 + off; + for (; (i < gn) && (i < maxi); i++) + { //red section + step = 255 / gn; if (invert) - rgb = YELLOW - (diff << 8); // removing green + rgb = YELLOW - ((unsigned char) (step * (b++)) << 8); // removing green else - rgb = YELLOW - (diff << 16); // removing red + rgb = YELLOW - ((unsigned char) (step * (b++)) << 16); // removing red color = make16color(rgb); - for (j = 0; j < hcnt; j++) - frameBuffer->paintBoxRel(pos_x + i * itemw, py + j * itemh, - pointx, pointy, color); + if (g_settings.progressbar_design == 0) + { + for(j = 0; j <= hcnt; j++) + frameBuffer->paintBoxRel(pos_x + i * ITEMW, pos_y + j * ITEMW, POINT, POINT, color); + } + else + frameBuffer->paintBoxRel(pos_x + i * ITEMW, start_y, POINT, bar_height, color); } } - for(i = maxi; i < total; i++) { - for (j = 0; j < hcnt; j++) - frameBuffer->paintBoxRel(pos_x + i * itemw, py + j * itemh, - pointx, pointy, COL_INFOBAR_PLUS_3);//fill passive + for(i = maxi; i < total; i++) + { + for(j = 0; j <= hcnt; j++) + if (g_settings.progressbar_design == 0) + frameBuffer->paintBoxRel(pos_x + i * ITEMW, pos_y + j * ITEMW, POINT, POINT, COL_INFOBAR_PLUS_3);//fill passive + else + frameBuffer->paintBoxRel(pos_x + i * ITEMW, start_y, POINT, bar_height, COL_INFOBAR_PLUS_3);//fill passive } last_width = active_pb_width; } } // paint icon if present - if (iconfile != NULL){ + if (iconfile != NULL) + { int icon_y = pos_y + pb_max_height / 2 - icon_h / 2; frameBuffer->paintIcon(iconfile, pos_x + frame_widht, icon_y); } // upper text int upper_labeltext_y = start_y - frame_widht; - if (upper_labeltext != NULL) { + if (upper_labeltext != NULL) + { g_Font[font_pbar]->RenderString(start_x +2, upper_labeltext_y, width, diff --git a/src/gui/widget/progressbar.h b/src/gui/widget/progressbar.h index 1d2b6bf2e..f66cf7e42 100644 --- a/src/gui/widget/progressbar.h +++ b/src/gui/widget/progressbar.h @@ -1,6 +1,7 @@ /* + * $Id$ + * * (C) 2008 by dbt - * (C) 2009,2010,2013 Stefan Seyfried * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -130,13 +131,6 @@ class CProgressBar void reset() { last_width = -1; } /* force update on next paint */ void hide(); - - enum pb_color_t { - PB_MATRIX = 0, /* 0 */ - PB_LINES_V, /* 1 */ - PB_LINES_H, /* 2 */ - PB_COLOR /* 3 */ - }; }; #endif /* __gui_widget_progressbar_h__ */ diff --git a/src/system/locals.h b/src/system/locals.h index 9cc9c7bdb..dc5fe0a70 100644 --- a/src/system/locals.h +++ b/src/system/locals.h @@ -1174,8 +1174,6 @@ typedef enum LOCALE_MISCSETTINGS_INFOBAR_PROGRESSBAR_DESIGN, LOCALE_MISCSETTINGS_INFOBAR_PROGRESSBAR_DESIGN_0, LOCALE_MISCSETTINGS_INFOBAR_PROGRESSBAR_DESIGN_1, - LOCALE_MISCSETTINGS_INFOBAR_PROGRESSBAR_DESIGN_2, - LOCALE_MISCSETTINGS_INFOBAR_PROGRESSBAR_DESIGN_3, LOCALE_MISCSETTINGS_INFOBAR_SAT_DISPLAY, LOCALE_MISCSETTINGS_INFOBAR_SHOW, LOCALE_MISCSETTINGS_INFOBAR_SHOW_DD_AVAILABLE, diff --git a/src/system/locals_intern.h b/src/system/locals_intern.h index 1951c6f08..900aa02fc 100644 --- a/src/system/locals_intern.h +++ b/src/system/locals_intern.h @@ -1174,8 +1174,6 @@ const char * locale_real_names[] = "miscsettings.infobar_progressbar_design", "miscsettings.infobar_progressbar_design_0", "miscsettings.infobar_progressbar_design_1", - "miscsettings.infobar_progressbar_design_2", - "miscsettings.infobar_progressbar_design_3", "miscsettings.infobar_sat_display", "miscsettings.infobar_show", "miscsettings.infobar_show_dd_available", From 8835f4a0c7833528f07edff5b0c24f84d319c240 Mon Sep 17 00:00:00 2001 From: Stefan Seyfried Date: Tue, 26 Mar 2013 19:17:29 +0100 Subject: [PATCH 224/224] Revert "progressbar-menu-tomworld" This reverts commit be2966035f3a4e5df49cc7a32495dcfd0205fd01. A better and simpler solution for progressbar setup is already in place. --- data/locale/deutsch.locale | 18 ++---- data/locale/english.locale | 18 ++---- src/gui/Makefile.am | 1 - src/gui/osd_setup.cpp | 30 ++++++--- src/gui/progressbar_setup.cpp | 114 --------------------------------- src/gui/progressbar_setup.h | 46 ------------- src/gui/widget/progressbar.cpp | 66 +++++++------------ src/neutrino.cpp | 2 - src/neutrino_menue.h | 3 - src/system/locals.h | 14 ++-- src/system/locals_intern.h | 14 ++-- src/system/settings.h | 1 - 12 files changed, 63 insertions(+), 264 deletions(-) delete mode 100644 src/gui/progressbar_setup.cpp delete mode 100644 src/gui/progressbar_setup.h diff --git a/data/locale/deutsch.locale b/data/locale/deutsch.locale index 43c124e45..eb391e8fb 100644 --- a/data/locale/deutsch.locale +++ b/data/locale/deutsch.locale @@ -803,9 +803,7 @@ menu.hint_infobar_fonts Ändern Sie die Schriftgrößen in der Infobar menu.hint_infobar_logo Logo- und Signal-Optionen menu.hint_infobar_logo_dir Wählen Sie das Verzeichnis für die Senderlogos menu.hint_infobar_on_epg Zeigt einen Hinweis bei EPG-Änderungen -menu.hint_infobar_position Wählt die Optionen des Fortschrittsbalken in der Infobar -menu.hint_infobar_progressbar Wählen sie die Optionen für die Progressbar-Anzeige -menu.hint_infobar_progressbar_design Stellen Sie das Design des Fortschrittsbalkens ein +menu.hint_infobar_progressbar Wählt die Optionen des Fortschrittsbalken in der Infobar menu.hint_infobar_radiotext Zeigt Radiotext in einen Fenster, wenn verfügbar menu.hint_infobar_res Zeige die gesendete Auflösung in Symbolen menu.hint_infobar_sat Zeigt die aktuellen Satelliten- oder Kabel-Provider @@ -1138,15 +1136,11 @@ miscsettings.infobar_disp_5 Logo/Signalbalken miscsettings.infobar_disp_6 Logo+Kanalnummer/Signalbalken miscsettings.infobar_disp_log Logo miscsettings.infobar_logo_hdd_dir Logo-Verz. -miscsettings.infobar_position Progessbarposition -miscsettings.infobar_position_0 Standard -miscsettings.infobar_position_1 unterhalb Kanalname -miscsettings.infobar_position_2 unterhalb Kanalname (schmal) -miscsettings.infobar_position_3 zwischen EPG-Events (schmal) -miscsettings.infobar_progressbar Fortschrittsbalken -miscsettings.infobar_progressbar_design Progressbar -miscsettings.infobar_progressbar_design_0 Punktdesign -miscsettings.infobar_progressbar_design_1 Balkendesign +miscsettings.infobar_progressbar Fortschrittsbalken Opt. +miscsettings.infobar_progressbar_0 Standard +miscsettings.infobar_progressbar_1 unterhalb Kanalname +miscsettings.infobar_progressbar_2 unterhalb Kanalname schmal +miscsettings.infobar_progressbar_3 zwischen EPG-Events schmal miscsettings.infobar_sat_display Kabel-/Satellitenanbieter miscsettings.infobar_show Info bei EPG Änderungen miscsettings.infobar_show_dd_available DD-Verfügbarkeit anzeigen diff --git a/data/locale/english.locale b/data/locale/english.locale index 18a0610f4..701c9a98f 100644 --- a/data/locale/english.locale +++ b/data/locale/english.locale @@ -803,9 +803,7 @@ menu.hint_infobar_fonts Change infobar font sizes menu.hint_infobar_logo Logo / signal options menu.hint_infobar_logo_dir Select directory to search for channels logo menu.hint_infobar_on_epg Show infobar on current EPG event change -menu.hint_infobar_position Selects the options of Progressbar in the Infobar -menu.hint_infobar_progressbar Select the options for the Progressbar -menu.hint_infobar_progressbar_design Here you can choose the design of the Progressbar with active color option. +menu.hint_infobar_progressbar Selects the options of Progressbar in the Infobar menu.hint_infobar_radiotext Show radiotext window menu.hint_infobar_res Show channel resolution icons menu.hint_infobar_sat Show current satellite or cable provider @@ -1138,15 +1136,11 @@ miscsettings.infobar_disp_5 Logo+signal miscsettings.infobar_disp_6 Logo+channel number+signal miscsettings.infobar_disp_log Logo miscsettings.infobar_logo_hdd_dir Logo dir -miscsettings.infobar_position Progressbar Position -miscsettings.infobar_position_0 standard -miscsettings.infobar_position_1 below channel name -miscsettings.infobar_position_2 small below channel name -miscsettings.infobar_position_3 narrow between EPG-Events -miscsettings.infobar_progressbar Progressbar -miscsettings.infobar_progressbar_design Progressbar -miscsettings.infobar_progressbar_design_0 point Design -miscsettings.infobar_progressbar_design_1 bar Design +miscsettings.infobar_progressbar progressbar options +miscsettings.infobar_progressbar_0 standard +miscsettings.infobar_progressbar_1 below channel name +miscsettings.infobar_progressbar_2 small below channel name +miscsettings.infobar_progressbar_3 narrow between EPG-Events miscsettings.infobar_sat_display Satellite display on infobar miscsettings.infobar_show show Info on EPG change miscsettings.infobar_show_dd_available show DD availability diff --git a/src/gui/Makefile.am b/src/gui/Makefile.am index 814773ccb..e4b46ab81 100644 --- a/src/gui/Makefile.am +++ b/src/gui/Makefile.am @@ -81,7 +81,6 @@ libneutrino_gui_a_SOURCES = \ pictureviewer_setup.cpp \ pluginlist.cpp \ plugins.cpp \ - progressbar_setup.cpp \ proxyserver_setup.cpp \ rc_lock.cpp \ record_setup.cpp \ diff --git a/src/gui/osd_setup.cpp b/src/gui/osd_setup.cpp index 4893b39c0..3774b6054 100644 --- a/src/gui/osd_setup.cpp +++ b/src/gui/osd_setup.cpp @@ -43,7 +43,6 @@ #include "screensetup.h" #include "osdlang_setup.h" #include "filebrowser.h" -#include "progressbar_setup.h" #include #include @@ -428,29 +427,24 @@ int COsdSetup::showOsdSetup() mf->setHint("", LOCALE_MENU_HINT_SCREEN_SETUP); osd_menu->addItem(mf); - //progressbar - CMenuForwarder * progress = new CMenuForwarder(LOCALE_MISCSETTINGS_INFOBAR_PROGRESSBAR, true, NULL, new CProgressbarSetup(), NULL, CRCInput::RC_1); - progress->setHint("", LOCALE_MENU_HINT_INFOBAR_PROGRESSBAR); - osd_menu->addItem(progress); - //infobar CMenuWidget osd_menu_infobar(LOCALE_MAINMENU_SETTINGS, NEUTRINO_ICON_SETTINGS, width, MN_WIDGET_ID_OSDSETUP_INFOBAR); showOsdInfobarSetup(&osd_menu_infobar); - mf = new CMenuForwarder(LOCALE_MISCSETTINGS_INFOBAR, true, NULL, &osd_menu_infobar, NULL, CRCInput::RC_2); + mf = new CMenuForwarder(LOCALE_MISCSETTINGS_INFOBAR, true, NULL, &osd_menu_infobar, NULL, CRCInput::RC_1); mf->setHint("", LOCALE_MENU_HINT_INFOBAR_SETUP); osd_menu->addItem(mf); //channellist CMenuWidget osd_menu_chanlist(LOCALE_MAINMENU_SETTINGS, NEUTRINO_ICON_SETTINGS, width, MN_WIDGET_ID_OSDSETUP_CHANNELLIST); showOsdChanlistSetup(&osd_menu_chanlist); - mf = new CMenuForwarder(LOCALE_MISCSETTINGS_CHANNELLIST, true, NULL, &osd_menu_chanlist, NULL, CRCInput::RC_3); + mf = new CMenuForwarder(LOCALE_MISCSETTINGS_CHANNELLIST, true, NULL, &osd_menu_chanlist, NULL, CRCInput::RC_2); mf->setHint("", LOCALE_MENU_HINT_CHANNELLIST_SETUP); osd_menu->addItem(mf); //screenshot CMenuWidget osd_menu_screenshot(LOCALE_MAINMENU_SETTINGS, NEUTRINO_ICON_SETTINGS, width, MN_WIDGET_ID_OSDSETUP_SCREENSHOT); showOsdScreenShotSetup(&osd_menu_screenshot); - mf = new CMenuForwarder(LOCALE_SCREENSHOT_MENU, true, NULL, &osd_menu_screenshot, NULL, CRCInput::RC_4); + mf = new CMenuForwarder(LOCALE_SCREENSHOT_MENU, true, NULL, &osd_menu_screenshot, NULL, CRCInput::RC_3); mf->setHint("", LOCALE_MENU_HINT_SCREENSHOT_SETUP); osd_menu->addItem(mf); @@ -512,6 +506,11 @@ int COsdSetup::showOsdSetup() mc->setHint("", LOCALE_MENU_HINT_BIGWINDOWS); osd_menu->addItem(mc); + // color progress bar + mc = new CMenuOptionChooser(LOCALE_PROGRESSBAR_COLOR, &g_settings.progressbar_color, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true); + mc->setHint("", LOCALE_MENU_HINT_PROGRESSBAR_COLOR); + osd_menu->addItem(mc); + int res = osd_menu->exec(NULL, ""); delete osd_menu; @@ -728,6 +727,14 @@ const CMenuOptionChooser::keyval LOCALE_MISCSETTINGS_INFOBAR_DISP_OPTIONS[LOCAL { 5 , LOCALE_MISCSETTINGS_INFOBAR_DISP_5 }, { 6 , LOCALE_MISCSETTINGS_INFOBAR_DISP_6 } }; +#define LOCALE_MISCSETTINGS_INFOBAR_PROGRESSBAR_COUNT 4 +const CMenuOptionChooser::keyval LOCALE_MISCSETTINGS_INFOBAR_PROGRESSBAR_OPTIONS[LOCALE_MISCSETTINGS_INFOBAR_PROGRESSBAR_COUNT]= +{ + { 0 , LOCALE_MISCSETTINGS_INFOBAR_PROGRESSBAR_0 }, + { 1 , LOCALE_MISCSETTINGS_INFOBAR_PROGRESSBAR_1 }, + { 2 , LOCALE_MISCSETTINGS_INFOBAR_PROGRESSBAR_2 }, + { 3 , LOCALE_MISCSETTINGS_INFOBAR_PROGRESSBAR_3 } +}; //infobar void COsdSetup::showOsdInfobarSetup(CMenuWidget *menu_infobar) @@ -756,6 +763,11 @@ void COsdSetup::showOsdInfobarSetup(CMenuWidget *menu_infobar) mc->setHint("", LOCALE_MENU_HINT_INFOBAR_SAT); menu_infobar->addItem(mc); + // infobar progress + mc = new CMenuOptionChooser(LOCALE_MISCSETTINGS_INFOBAR_PROGRESSBAR, &g_settings.infobar_progressbar, LOCALE_MISCSETTINGS_INFOBAR_PROGRESSBAR_OPTIONS, LOCALE_MISCSETTINGS_INFOBAR_PROGRESSBAR_COUNT, true); + mc->setHint("", LOCALE_MENU_HINT_INFOBAR_PROGRESSBAR); + menu_infobar->addItem(mc); + // flash/hdd progress mc = new CMenuOptionChooser(LOCALE_MISCSETTINGS_INFOBAR_SHOW_SYSFS_HDD, &g_settings.infobar_show_sysfs_hdd, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true); mc->setHint("", LOCALE_MENU_HINT_INFOBAR_FILESYS); diff --git a/src/gui/progressbar_setup.cpp b/src/gui/progressbar_setup.cpp deleted file mode 100644 index 98d17fa50..000000000 --- a/src/gui/progressbar_setup.cpp +++ /dev/null @@ -1,114 +0,0 @@ -/* - Based up Neutrino-GUI - Tuxbox-Project - Copyright (C) 2001 by Steffen Hehn 'McClean' - - progressbar_setup menu - Suggested by tomworld - - License: GPL - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif - -#include "progressbar_setup.h" - -#include -#include -#include -#include - -#include - -#include - -#define LOCALE_MISCSETTINGS_INFOBAR_POSITION_COUNT 4 -const CMenuOptionChooser::keyval LOCALE_MISCSETTINGS_INFOBAR_POSITION_OPTIONS[LOCALE_MISCSETTINGS_INFOBAR_POSITION_COUNT]= -{ - { 0 , LOCALE_MISCSETTINGS_INFOBAR_POSITION_0 }, - { 1 , LOCALE_MISCSETTINGS_INFOBAR_POSITION_1 }, - { 2 , LOCALE_MISCSETTINGS_INFOBAR_POSITION_2 }, - { 3 , LOCALE_MISCSETTINGS_INFOBAR_POSITION_3 } -}; - -#define LOCALE_MISCSETTINGS_INFOBAR_PROGRESSBAR_DESIGN_COUNT 2 -const CMenuOptionChooser::keyval LOCALE_MISCSETTINGS_INFOBAR_PROGRESSBAR_DESIGN_OPTIONS[LOCALE_MISCSETTINGS_INFOBAR_PROGRESSBAR_DESIGN_COUNT]= -{ - { 0 , LOCALE_MISCSETTINGS_INFOBAR_PROGRESSBAR_DESIGN_0 }, - { 1 , LOCALE_MISCSETTINGS_INFOBAR_PROGRESSBAR_DESIGN_1 } -}; - -CProgressbarSetup::CProgressbarSetup() -{ - width = w_max (40, 10); //% -} - -CProgressbarSetup::~CProgressbarSetup() -{ - -} - -int CProgressbarSetup::exec(CMenuTarget* parent, const std::string &) -{ - printf("[neutrino] init progressbar menu setup...\n"); - - if (parent) - parent->hide(); - - return showMenu(); -} - -int CProgressbarSetup::showMenu() -{ - //menue init - CMenuWidget *progress = new CMenuWidget(LOCALE_MAINMENU_SETTINGS, NEUTRINO_ICON_SETTINGS, width, MN_WIDGET_ID_PROGRESSBAR); - - //intros: back ande save - progress->addIntroItems(LOCALE_MISCSETTINGS_INFOBAR_PROGRESSBAR); - - //infobar progresscolor on/off - COnOffNotifier* miscProgressNotifier = new COnOffNotifier(0); - - CMenuOptionChooser *progresscolor; - progresscolor = new CMenuOptionChooser(LOCALE_PROGRESSBAR_COLOR, &g_settings.progressbar_color, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true, miscProgressNotifier); - progresscolor->setHint("", LOCALE_MENU_HINT_PROGRESSBAR_COLOR); - - //infobar design - CMenuOptionChooser *progressdesign = new CMenuOptionChooser(LOCALE_MISCSETTINGS_INFOBAR_PROGRESSBAR_DESIGN, &g_settings.progressbar_design, LOCALE_MISCSETTINGS_INFOBAR_PROGRESSBAR_DESIGN_OPTIONS, LOCALE_MISCSETTINGS_INFOBAR_PROGRESSBAR_DESIGN_COUNT, g_settings.progressbar_color); - progressdesign->setHint("", LOCALE_MENU_HINT_INFOBAR_PROGRESSBAR_DESIGN); - - //infobar progressbarposition - CMenuOptionChooser *progressbarposition; - progressbarposition = new CMenuOptionChooser(LOCALE_MISCSETTINGS_INFOBAR_POSITION, &g_settings.infobar_progressbar, LOCALE_MISCSETTINGS_INFOBAR_POSITION_OPTIONS, LOCALE_MISCSETTINGS_INFOBAR_POSITION_COUNT, true); - progressbarposition->setHint("", LOCALE_MENU_HINT_INFOBAR_POSITION); - - miscProgressNotifier->addItem(progressdesign); - - //paint items - progress->addItem(progresscolor); - progress->addItem(progressdesign); - progress->addItem(new CMenuSeparator(CMenuSeparator::LINE | CMenuSeparator::STRING, LOCALE_MISCSETTINGS_INFOBAR)); - progress->addItem(progressbarposition); - - int res = progress->exec (NULL, ""); - delete miscProgressNotifier; - delete progress; - - return res; -} diff --git a/src/gui/progressbar_setup.h b/src/gui/progressbar_setup.h deleted file mode 100644 index b650e9cb6..000000000 --- a/src/gui/progressbar_setup.h +++ /dev/null @@ -1,46 +0,0 @@ -/* - Based up Neutrino-GUI - Tuxbox-Project - Copyright (C) 2001 by Steffen Hehn 'McClean' - - progressbar_setup menu - Suggested by tomworld - - License: GPL - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - -*/ - -#ifndef __PROGRESSBAR_SETUP__ -#define __PROGRESSBAR_SETUP__ - - -#include - -#include - -class CProgressbarSetup : public CMenuTarget, CChangeObserver -{ -private: - int width; - int showMenu(); - -public: - CProgressbarSetup(); - ~CProgressbarSetup(); - int exec(CMenuTarget* parent, const std::string &); -}; - -#endif diff --git a/src/gui/widget/progressbar.cpp b/src/gui/widget/progressbar.cpp index e9bef678e..e99ad763b 100644 --- a/src/gui/widget/progressbar.cpp +++ b/src/gui/widget/progressbar.cpp @@ -153,11 +153,11 @@ void CProgressBar::realpaint(const int pos_x, const int pos_y, // max height progressbar bar, if icon height larger than pb_height then get height from icon int pb_max_height = icon_h > height ? icon_h + 2* frame_widht : height; - // max height of active/passive bar - int bar_height = pb_max_height - 2*frame_widht; - if (!blink || !g_settings.progressbar_color) { + // max height of active/passive bar + int bar_height = pb_max_height - 2*frame_widht; + int start_x_passive_bar = start_x + active_pb_width; int width_passive_bar = pb_max_width - active_pb_width; @@ -202,85 +202,63 @@ void CProgressBar::realpaint(const int pos_x, const int pos_y, width, pb_max_height, shadowbar_col, c_rad); // shadow } - if (active_pb_width != last_width) - { + if (active_pb_width != last_width) { int step; int i, j; int b = 0; - if (active_pb_width > last_width) - { - for (i = 0; (i < rd) && (i < maxi); i++) - { //green section + if (active_pb_width > last_width) { + for (i = 0; (i < rd) && (i < maxi); i++) { step = 255 / rd; if (invert) rgb = GREEN + ((unsigned char)(step * i) << 16); // adding red else rgb = RED + ((unsigned char)(step * i) << 8); // adding green color = make16color(rgb); - if (g_settings.progressbar_design == 0) - { - for(j = 0; j <= hcnt; j++) - frameBuffer->paintBoxRel(pos_x + i * ITEMW, pos_y + j * ITEMW, POINT, POINT, color); - } - else - frameBuffer->paintBoxRel(pos_x + i * ITEMW,start_y, POINT, bar_height, color); + for(j = 0; j <= hcnt; j++) + frameBuffer->paintBoxRel(pos_x + i * ITEMW, pos_y + j * ITEMW, + POINT, POINT, color); } - for (; (i < yw) && (i < maxi); i++) - { //yello section + for (; (i < yw) && (i < maxi); i++) { step = 255 / yw / 2; if (invert) rgb = YELLOW - ((unsigned char)(step * (b++)) << 8); // removing green else rgb = YELLOW - ((unsigned char)(step * (b++)) << 16); // removing red color = make16color(rgb); - if (g_settings.progressbar_design == 0) - { - for(j = 0; j <= hcnt; j++) - frameBuffer->paintBoxRel(pos_x + i * ITEMW, pos_y + j * ITEMW, POINT, POINT, color); - } - else - frameBuffer->paintBoxRel(pos_x + i * ITEMW, start_y, POINT, bar_height, color); + for(j = 0; j <= hcnt; j++) + frameBuffer->paintBoxRel(pos_x + i * ITEMW, pos_y + j * ITEMW, + POINT, POINT, color); } - for (; (i < gn) && (i < maxi); i++) - { //red section + for (; (i < gn) && (i < maxi); i++) { step = 255 / gn; if (invert) rgb = YELLOW - ((unsigned char) (step * (b++)) << 8); // removing green else rgb = YELLOW - ((unsigned char) (step * (b++)) << 16); // removing red color = make16color(rgb); - if (g_settings.progressbar_design == 0) - { - for(j = 0; j <= hcnt; j++) - frameBuffer->paintBoxRel(pos_x + i * ITEMW, pos_y + j * ITEMW, POINT, POINT, color); - } - else - frameBuffer->paintBoxRel(pos_x + i * ITEMW, start_y, POINT, bar_height, color); + for(j = 0; j <= hcnt; j++) + frameBuffer->paintBoxRel(pos_x + i * ITEMW, pos_y + j * ITEMW, + POINT, POINT, color); } } - for(i = maxi; i < total; i++) - { + for(i = maxi; i < total; i++) { for(j = 0; j <= hcnt; j++) - if (g_settings.progressbar_design == 0) - frameBuffer->paintBoxRel(pos_x + i * ITEMW, pos_y + j * ITEMW, POINT, POINT, COL_INFOBAR_PLUS_3);//fill passive - else - frameBuffer->paintBoxRel(pos_x + i * ITEMW, start_y, POINT, bar_height, COL_INFOBAR_PLUS_3);//fill passive + frameBuffer->paintBoxRel(pos_x + i * ITEMW, pos_y + j * ITEMW, + POINT, POINT, COL_INFOBAR_PLUS_3);//fill passive } last_width = active_pb_width; } } // paint icon if present - if (iconfile != NULL) - { + if (iconfile != NULL){ int icon_y = pos_y + pb_max_height / 2 - icon_h / 2; frameBuffer->paintIcon(iconfile, pos_x + frame_widht, icon_y); } // upper text int upper_labeltext_y = start_y - frame_widht; - if (upper_labeltext != NULL) - { + if (upper_labeltext != NULL) { g_Font[font_pbar]->RenderString(start_x +2, upper_labeltext_y, width, diff --git a/src/neutrino.cpp b/src/neutrino.cpp index f41464214..5bc5812b3 100644 --- a/src/neutrino.cpp +++ b/src/neutrino.cpp @@ -383,7 +383,6 @@ int CNeutrinoApp::loadSetup(const char * fname) g_settings.infobar_show_channeldesc = configfile.getBool("infobar_show_channeldesc" , false ); g_settings.infobar_subchan_disp_pos = configfile.getInt32("infobar_subchan_disp_pos" , 0 ); g_settings.progressbar_color = configfile.getBool("progressbar_color", true ); - g_settings.progressbar_design = configfile.getInt32("progressbar_design",0); g_settings.infobar_show = configfile.getInt32("infobar_show", 1); g_settings.infobar_show_channellogo = configfile.getInt32("infobar_show_channellogo" , 3 ); g_settings.infobar_progressbar = configfile.getInt32("infobar_progressbar" , 0 ); @@ -843,7 +842,6 @@ void CNeutrinoApp::saveSetup(const char * fname) configfile.setBool("infobar_show_channeldesc" , g_settings.infobar_show_channeldesc ); configfile.setInt32("infobar_subchan_disp_pos" , g_settings.infobar_subchan_disp_pos ); configfile.setBool("progressbar_color" , g_settings.progressbar_color ); - configfile.setInt32("progressbar_design", g_settings.progressbar_design); configfile.setInt32("infobar_show", g_settings.infobar_show); configfile.setInt32("infobar_show_channellogo" , g_settings.infobar_show_channellogo ); configfile.setInt32("infobar_progressbar" , g_settings.infobar_progressbar ); diff --git a/src/neutrino_menue.h b/src/neutrino_menue.h index 3efe11bd3..2f516cdf7 100644 --- a/src/neutrino_menue.h +++ b/src/neutrino_menue.h @@ -69,9 +69,6 @@ enum MN_WIDGET_ID MN_WIDGET_ID_OSDSETUP_FONTSIZE_INFOBAR, MN_WIDGET_ID_OSDSETUP_FONTSIZE_GAMELIST, - //progressbar setup - MN_WIDGET_ID_PROGRESSBAR, - //language setup MN_WIDGET_ID_LANGUAGESETUP, MN_WIDGET_ID_LANGUAGESETUP_LOCALE, diff --git a/src/system/locals.h b/src/system/locals.h index dc5fe0a70..45fa68253 100644 --- a/src/system/locals.h +++ b/src/system/locals.h @@ -830,9 +830,7 @@ typedef enum LOCALE_MENU_HINT_INFOBAR_LOGO, LOCALE_MENU_HINT_INFOBAR_LOGO_DIR, LOCALE_MENU_HINT_INFOBAR_ON_EPG, - LOCALE_MENU_HINT_INFOBAR_POSITION, LOCALE_MENU_HINT_INFOBAR_PROGRESSBAR, - LOCALE_MENU_HINT_INFOBAR_PROGRESSBAR_DESIGN, LOCALE_MENU_HINT_INFOBAR_RADIOTEXT, LOCALE_MENU_HINT_INFOBAR_RES, LOCALE_MENU_HINT_INFOBAR_SAT, @@ -1165,15 +1163,11 @@ typedef enum LOCALE_MISCSETTINGS_INFOBAR_DISP_6, LOCALE_MISCSETTINGS_INFOBAR_DISP_LOG, LOCALE_MISCSETTINGS_INFOBAR_LOGO_HDD_DIR, - LOCALE_MISCSETTINGS_INFOBAR_POSITION, - LOCALE_MISCSETTINGS_INFOBAR_POSITION_0, - LOCALE_MISCSETTINGS_INFOBAR_POSITION_1, - LOCALE_MISCSETTINGS_INFOBAR_POSITION_2, - LOCALE_MISCSETTINGS_INFOBAR_POSITION_3, LOCALE_MISCSETTINGS_INFOBAR_PROGRESSBAR, - LOCALE_MISCSETTINGS_INFOBAR_PROGRESSBAR_DESIGN, - LOCALE_MISCSETTINGS_INFOBAR_PROGRESSBAR_DESIGN_0, - LOCALE_MISCSETTINGS_INFOBAR_PROGRESSBAR_DESIGN_1, + LOCALE_MISCSETTINGS_INFOBAR_PROGRESSBAR_0, + LOCALE_MISCSETTINGS_INFOBAR_PROGRESSBAR_1, + LOCALE_MISCSETTINGS_INFOBAR_PROGRESSBAR_2, + LOCALE_MISCSETTINGS_INFOBAR_PROGRESSBAR_3, LOCALE_MISCSETTINGS_INFOBAR_SAT_DISPLAY, LOCALE_MISCSETTINGS_INFOBAR_SHOW, LOCALE_MISCSETTINGS_INFOBAR_SHOW_DD_AVAILABLE, diff --git a/src/system/locals_intern.h b/src/system/locals_intern.h index 900aa02fc..1b07c1d77 100644 --- a/src/system/locals_intern.h +++ b/src/system/locals_intern.h @@ -830,9 +830,7 @@ const char * locale_real_names[] = "menu.hint_infobar_logo", "menu.hint_infobar_logo_dir", "menu.hint_infobar_on_epg", - "menu.hint_infobar_position", "menu.hint_infobar_progressbar", - "menu.hint_infobar_progressbar_design", "menu.hint_infobar_radiotext", "menu.hint_infobar_res", "menu.hint_infobar_sat", @@ -1165,15 +1163,11 @@ const char * locale_real_names[] = "miscsettings.infobar_disp_6", "miscsettings.infobar_disp_log", "miscsettings.infobar_logo_hdd_dir", - "miscsettings.infobar_position", - "miscsettings.infobar_position_0", - "miscsettings.infobar_position_1", - "miscsettings.infobar_position_2", - "miscsettings.infobar_position_3", "miscsettings.infobar_progressbar", - "miscsettings.infobar_progressbar_design", - "miscsettings.infobar_progressbar_design_0", - "miscsettings.infobar_progressbar_design_1", + "miscsettings.infobar_progressbar_0", + "miscsettings.infobar_progressbar_1", + "miscsettings.infobar_progressbar_2", + "miscsettings.infobar_progressbar_3", "miscsettings.infobar_sat_display", "miscsettings.infobar_show", "miscsettings.infobar_show_dd_available", diff --git a/src/system/settings.h b/src/system/settings.h index e5aced076..08a09449d 100644 --- a/src/system/settings.h +++ b/src/system/settings.h @@ -70,7 +70,6 @@ struct SNeutrinoSettings int infobar_show_channellogo; int infobar_progressbar; int progressbar_color; - int progressbar_design; int casystem_display; int scrambled_message; int volume_pos;