diff --git a/src/gui/channellist.cpp b/src/gui/channellist.cpp index edc0e8bab..22abc6782 100644 --- a/src/gui/channellist.cpp +++ b/src/gui/channellist.cpp @@ -123,7 +123,6 @@ CChannelList::CChannelList(const char * const pName, bool phistoryMode, bool _vl eventFont = SNeutrinoSettings::FONT_TYPE_CHANNELLIST_EVENT; dline = NULL; cc_minitv = NULL; - logo_off = 0; minitv_is_active = false; headerNew = true; bouquet = NULL; @@ -2129,7 +2128,6 @@ void CChannelList::paintHead() if (!header->getContextBtnObject()->empty()) header->removeContextButtons(); header->enableClock(true, "%H:%M", "%H %M", true); - logo_off = header->getClockObject()->getWidth() + OFFSET_INNER_MID; header->getClockObject()->setCorner(RADIUS_LARGE, CORNER_TOP_RIGHT); }else{ @@ -2139,8 +2137,6 @@ void CChannelList::paintHead() } } } - else - logo_off = OFFSET_INNER_MID; if(g_settings.channellist_show_channellogo){ //ensure to have clean background @@ -2148,6 +2144,8 @@ void CChannelList::paintHead() header->setChannelLogo((*chanlist)[selected]->getChannelID(), (*chanlist)[selected]->getName()); header->getChannelLogoObject()->allowPaint(false); } + else + header->setChannelLogo(0, string()); header->paint(CC_SAVE_SCREEN_NO); showChannelLogo(); } diff --git a/src/gui/channellist.h b/src/gui/channellist.h index 75ac35a63..edde1bbda 100644 --- a/src/gui/channellist.h +++ b/src/gui/channellist.h @@ -112,7 +112,6 @@ private: int info_height; // the infobox below mainbox is handled outside height int x; int y; - int logo_off; int pig_width; int pig_height; int infozone_width; diff --git a/src/gui/components/cc_frm.cpp b/src/gui/components/cc_frm.cpp index c202c6742..bd1f4f555 100644 --- a/src/gui/components/cc_frm.cpp +++ b/src/gui/components/cc_frm.cpp @@ -532,6 +532,12 @@ void CComponentsForm::killCCItems(const fb_pixel_t& bg_color, bool ignore_parent v_cc_items[i]->kill(bg_color, ignore_parent); } +void CComponentsForm::hideCCItems() +{ + for(size_t i=0; ihide(); +} + void CComponentsForm::setPageCount(const u_int8_t& pageCount) { u_int8_t new_val = pageCount; diff --git a/src/gui/components/cc_frm.h b/src/gui/components/cc_frm.h index 3561e495a..59f488fdb 100644 --- a/src/gui/components/cc_frm.h +++ b/src/gui/components/cc_frm.h @@ -81,6 +81,16 @@ class CComponentsForm : public CComponentsItem ///NOTE: Items always have parent bindings to "this" and use the parent background color as default! Set parameter 'ignore_parent=true' to ignore parent background color! virtual void killCCItems(const fb_pixel_t& bg_color, bool ignore_parent); + /** + Removes possible contained items and finally removes + current form from screen and + restores last displayed background before form was painted. + */ + void hide(){hideCCItems(); CCDraw::hide();} + + ///restore background for all items inside form, + void hideCCItems(); + ///add an item to form collection, returns id virtual int addCCItem(CComponentsItem* cc_Item); ///add items from a vector to form collection, returns size/count of items diff --git a/src/gui/components/cc_frm_chain.cpp b/src/gui/components/cc_frm_chain.cpp index 4910e469c..b08343e46 100644 --- a/src/gui/components/cc_frm_chain.cpp +++ b/src/gui/components/cc_frm_chain.cpp @@ -27,6 +27,25 @@ using namespace std; + +/* general chain form shema + + x/y + / + +---------------------------------------width----------------------------------------+ + | chn_t_offset | + | +--------+ +--------+ +--------+ | + |chn_l_offset| item |append_x_offset| item |append_x_offset| item |chn_r_offset| + | +--------+ +--------+ +--------+ | + | append_y_offset |height + | +--------+ +--------+ +--------+ | + | | item | | item | | item | | + | +--------+ +--------+ +--------+ | + | chn_t_offset | + +------------------------------------------------------------------------------------+ +*/ + + //------------------------------------------------------------------------------------------------------- //sub class CComponentsFrmChain CComponentsFrmChain::CComponentsFrmChain( const int& x_pos, const int& y_pos, const int& w, const int& h, @@ -59,11 +78,14 @@ void CComponentsFrmChain::initVarChain( const int& x_pos, const int& y_pos, cons width = w; height = h; + chn_l_offset = chn_r_offset = 0; + chn_t_offset = chn_b_offset = 0; + shadow = shadow_mode; col_frame = color_frame; col_body = color_body; col_shadow = color_shadow; - + chn_direction = direction; if (v_items) @@ -86,23 +108,65 @@ void CComponentsFrmChain::initChainItems() return; //set new values - int w_tmp = append_x_offset; - int h_tmp = append_y_offset; + int w_tmp = 0, h_tmp = 0; + int w_item = 0, h_item = 0; + size_t i_count = v_cc_items.size(); - for (size_t i= 0; i< v_cc_items.size(); i++){ - int x_item = v_cc_items[i]->getXPos(); - int y_item = v_cc_items[i]->getYPos(); + + for (size_t i= 0; i< i_count; i++){ +// x_item = v_cc_items[i]->getXPos(); +// y_item = v_cc_items[i]->getYPos(); + w_item = v_cc_items[i]->getWidth(); + h_item = v_cc_items[i]->getHeight(); if (chn_direction & CC_DIR_X){ - w_tmp += v_cc_items[i]->getWidth(); - w_tmp += append_x_offset; - v_cc_items[i]->setPos(max(CC_APPEND, x_item), max(CC_CENTERED, y_item)); + if (i == 0){ + v_cc_items[i]->setXPos(chn_l_offset); + w_tmp += chn_l_offset; + w_tmp += w_item; + if (i_count == 1) + w_tmp += chn_r_offset; + } + + if (i_count > 1){ + if (i == i_count-1){ + w_tmp += w_item; + w_tmp += append_x_offset; + v_cc_items[i]->setXPos(w_tmp - v_cc_items[i]->getWidth()); + w_tmp += chn_r_offset; + } + } + + if (i != 0 && i != i_count-1){ + w_tmp += w_item; + w_tmp += append_x_offset; + v_cc_items[i]->setXPos(w_tmp - v_cc_items[i]->getWidth()); + } } if (chn_direction & CC_DIR_Y){ - h_tmp += v_cc_items[i]->getHeight(); - h_tmp += append_y_offset; - v_cc_items[i]->setPos(max(CC_CENTERED, x_item), max(CC_APPEND, y_item)); + if (i == 0){ + v_cc_items[i]->setYPos(chn_t_offset); + h_tmp += chn_t_offset; + h_tmp += h_item; + if (i_count == 1) + h_tmp += chn_b_offset; + } + + if (i_count > 1){ + if (i == i_count-1){ + h_tmp += h_item; + h_tmp += append_y_offset; + v_cc_items[i]->setYPos(h_tmp - v_cc_items[i]->getHeight()); + h_tmp += chn_b_offset; + } + } + + if (i != 0 && i != i_count-1){ + h_tmp += h_item; + h_tmp += append_y_offset; + v_cc_items[i]->setYPos(h_tmp - v_cc_items[i]->getHeight()); + } } } width = max (w_tmp, width); diff --git a/src/gui/components/cc_frm_chain.h b/src/gui/components/cc_frm_chain.h index a33f63ed8..560984a5e 100644 --- a/src/gui/components/cc_frm_chain.h +++ b/src/gui/components/cc_frm_chain.h @@ -55,6 +55,10 @@ class CComponentsFrmChain : public CComponentsForm fb_pixel_t& color_frame, fb_pixel_t& color_body, fb_pixel_t& color_shadow); + + int chn_l_offset, chn_r_offset; + int chn_t_offset, chn_b_offset; + protected: ///property: mode for arrangement direction of items, see also setDirection(), getDirection() int chn_direction; @@ -75,7 +79,26 @@ class CComponentsFrmChain : public CComponentsForm ///defines mode for arrangement direction of items, see also chn_direction virtual void setDirection(int direction); ///gets the mode of arrangment direction - virtual int getDirection(){return chn_direction;}; + virtual int getDirection(){return chn_direction;} + + /**Members to set border offsets + * @param[in] offset + * @li expects type int as offset value + * @return + * void + */ + void setLeftOffset(const int& offset){chn_l_offset = offset;} + void setRightOffset(const int& offset){chn_r_offset = offset;} + void setTopOffset(const int& offset){chn_t_offset = offset;} + void setBottomOffset(const int& offset){chn_b_offset = offset;} + + void setBorderOffsets(const int& left_offset, const int& right_offset, const int& top_offset, const int& bottom_offset) + { + setLeftOffset(left_offset); + setRightOffset(right_offset); + setTopOffset(top_offset); + setBottomOffset(bottom_offset); + } }; #endif diff --git a/src/gui/components/cc_frm_header.cpp b/src/gui/components/cc_frm_header.cpp index f4f013203..fff49031a 100644 --- a/src/gui/components/cc_frm_header.cpp +++ b/src/gui/components/cc_frm_header.cpp @@ -274,10 +274,10 @@ void CComponentsHeader::initIcon() void CComponentsHeader::initLogo() { - cch_logo.dy_max = cch_logo.dy_max == -1 ? height - 2*OFFSET_INNER_MIN : cch_logo.dy_max; + int h_logo = cch_logo.dy_max == -1 ? height - 2*OFFSET_INNER_MIN : cch_logo.dy_max; if(!cch_logo_obj) - cch_logo_obj = new CComponentsChannelLogoScalable(width/2, height/2 - cch_logo.dy_max/2, cch_logo.Name, cch_logo.Id, this); + cch_logo_obj = new CComponentsChannelLogoScalable(width/2, height/2 - h_logo/2, cch_logo.Name, cch_logo.Id, this); else cch_logo_obj->setChannel(cch_logo.Id, cch_logo.Name); @@ -285,12 +285,12 @@ void CComponentsHeader::initLogo() if (cch_logo.dy_max == -1){ int dx_orig = 0, dy_orig = 0 ; cch_logo_obj->getRealSize(&dx_orig, &dy_orig); - if (cch_logo.dy_max > dy_orig) - cch_logo.dy_max = dy_orig; + if (h_logo > dy_orig) + h_logo = dy_orig; } if (cch_logo_obj->hasLogo()){ - cch_logo_obj->setHeight(cch_logo.dy_max, true); + cch_logo_obj->setHeight(h_logo, true); // set id of logo item depends of neighbor items int logo_id = getCCItemId(cch_logo_obj); @@ -414,8 +414,9 @@ void CComponentsHeader::initButtons() //set button form properties if (cch_btn_obj){ cch_btn_obj->setYPos(cch_items_y); - cch_btn_obj->doPaintBg(false); + cch_btn_obj->doPaintBg(false);; cch_btn_obj->setAppendOffset(cch_buttons_space, 0); + cch_btn_obj->setRightOffset(cch_buttons_space); cch_btn_obj->removeAllIcons(); cch_btn_obj->addIcon(v_cch_btn); diff --git a/src/gui/components/cc_frm_header.h b/src/gui/components/cc_frm_header.h index 320c59282..9550d1134 100644 --- a/src/gui/components/cc_frm_header.h +++ b/src/gui/components/cc_frm_header.h @@ -299,7 +299,7 @@ class CComponentsHeader : public CComponentsForm, public CCTextScreen virtual void paint(bool do_save_bg = CC_SAVE_SCREEN_YES); ///hides item, arg: no_restore see hideCCItem() - void hide(){disableClock(); CComponents::hide();} + void hide(){disableClock(); CComponentsForm::hide();} ///erase current screen without restore of background, it's similar to paintBackgroundBoxRel() from CFrameBuffer void kill(const fb_pixel_t& bg_color = COL_BACKGROUND_PLUS_0, const int& corner_radius = -1, const int& fblayer_type = CC_FBDATA_TYPES, bool disable_clock = true); diff --git a/src/gui/timerlist.cpp b/src/gui/timerlist.cpp index fa7e7467e..3eda88907 100644 --- a/src/gui/timerlist.cpp +++ b/src/gui/timerlist.cpp @@ -1378,7 +1378,7 @@ void CTimerList::paintItem(int pos) void CTimerList::paintHead() { CComponentsHeaderLocalized header(x, y, width, theight, LOCALE_TIMERLIST_NAME, NEUTRINO_ICON_TIMER, CComponentsHeader::CC_BTN_MENU | CComponentsHeader::CC_BTN_EXIT, NULL, CC_SHADOW_ON); - header.enableClock(true, "%d.%m.%Y %H:%M"); + header.enableClock(true, " %d.%m.%Y %H:%M "); header.paint(CC_SAVE_SCREEN_NO); }