diff --git a/src/gui/channellist.cpp b/src/gui/channellist.cpp index 80660531a..643fec02e 100644 --- a/src/gui/channellist.cpp +++ b/src/gui/channellist.cpp @@ -127,7 +127,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; @@ -137,6 +136,7 @@ CChannelList::CChannelList(const char * const pName, bool phistoryMode, bool _vl channelsChanged = false; paint_events_index = -2; + CFrameBuffer::getInstance()->OnAfterSetPallette.connect(sigc::mem_fun(this, &CChannelList::ResetModules)); } CChannelList::~CChannelList() @@ -443,8 +443,9 @@ int CChannelList::doChannelMenu(void) previous_channellist_additional = g_settings.channellist_additional; COsdSetup osd_setup; osd_setup.showContextChanlistMenu(this); - //FIXME check font/options changed ? hide(); + ResetModules(); + //FIXME check font/options changed ? calcSize(); ret = -1; } @@ -974,7 +975,11 @@ void CChannelList::hide() header->kill(); frameBuffer->paintBackground(); //NI clear whole screen - clearItem2DetailsLine(); + + //remove details line + if (dline) + dline->kill(); + CInfoClock::getInstance()->enableInfoClock(!CInfoClock::getInstance()->isBlocked()); } @@ -1658,12 +1663,6 @@ void CChannelList::clearItem2DetailsLine() void CChannelList::paintItem2DetailsLine (int pos) { - if (dline){ - dline->kill(); //kill details line - delete dline; - dline = NULL; - } - if (!g_settings.channellist_show_infobox) return; @@ -1673,9 +1672,15 @@ void CChannelList::paintItem2DetailsLine (int pos) // paint Line if detail info (and not valid list pos) if (pos >= 0) { - if (dline == NULL) + if (!dline){ dline = new CComponentsDetailsLine(xpos, ypos1, ypos2, fheight/2, info_height-RADIUS_LARGE*2); - dline->paint(false); + }else{ + dline->setPos(xpos, ypos1); + dline->setYPosDown(ypos2); + dline->setHMarkTop(fheight/2); + dline->setHMarkDown(info_height-RADIUS_LARGE*2); + } + dline->paint(); } } @@ -2161,7 +2166,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{ @@ -2171,8 +2175,6 @@ void CChannelList::paintHead() } } } - else - logo_off = OFFSET_INNER_MID; if(g_settings.channellist_show_channellogo){ //ensure to have clean background 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_draw.h b/src/gui/components/cc_draw.h index 26b8875d5..0f23e7eb4 100644 --- a/src/gui/components/cc_draw.h +++ b/src/gui/components/cc_draw.h @@ -284,6 +284,8 @@ class CCDraw : public COSDFader, public CComponentsSignals virtual void enableSaveBg(bool save_bg = true); ///disable background buffering, does the same like enableSaveBg(false), NOTE: cleans existant pixbuffer content! virtual void disableSaveBg(){enableSaveBg(false);} + ///returns background buffering mode. Mode is assigned with paint() or enableSaveBg()/disableSaveBg()) + bool SaveBg(){return cc_save_bg;} ///allow/disalows paint of item and its contents, but initialize of other properties are not touched ///this can be understood as a counterpart to isPainted(), but before paint and value of is_painted is modified temporarily till next paint of item //TODO: is this sufficiently? diff --git a/src/gui/components/cc_frm.cpp b/src/gui/components/cc_frm.cpp index 26e43e085..b93df7c50 100644 --- a/src/gui/components/cc_frm.cpp +++ b/src/gui/components/cc_frm.cpp @@ -185,12 +185,11 @@ void CComponentsForm::clear() return; for(size_t i=0; igetItemType()); - - delete v_cc_items[i]; - v_cc_items[i] = NULL; + CComponentsItem *item = v_cc_items[i]; + if (item){ + dprintf(DEBUG_DEBUG, "[CComponentsForm] %s... delete form cc-item %d of %d (type=%d)\taddress = %p\n", __func__, (int)i+1, (int)v_cc_items.size(), item->getItemType(), item); + delete item; + item = NULL; } } v_cc_items.clear(); @@ -518,7 +517,7 @@ void CComponentsForm::paintCCItems() //finally paint current item, but only required contents of page if (cc_item->getPageNumber() == cur_page) - cc_item->paint(CC_SAVE_SCREEN_NO); + cc_item->paint(cc_item->SaveBg()); //restore defined old visibility mode of item after paint cc_item->allowPaint(item_visible); diff --git a/src/gui/components/cc_frm_chain.cpp b/src/gui/components/cc_frm_chain.cpp index 4910e469c..dcc261265 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_b_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 94f38b825..830533b70 100644 --- a/src/gui/components/cc_frm_header.cpp +++ b/src/gui/components/cc_frm_header.cpp @@ -277,10 +277,13 @@ void CComponentsHeader::initLogo() 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 - h_logo/2, cch_logo.Name, cch_logo.Id, this); + cch_logo_obj = new CComponentsChannelLogoScalable(1, height/2 - h_logo/2, cch_logo.Name, cch_logo.Id, this); else cch_logo_obj->setChannel(cch_logo.Id, cch_logo.Name); + // use value 1 as initial value for logo width, ensures downscale with stupid available logo space + cch_logo_obj->setHeight(1, true); + //ensure logo is not larger than original size if in auto mode if (cch_logo.dy_max == -1){ int dx_orig = 0, dy_orig = 0 ; @@ -289,6 +292,7 @@ void CComponentsHeader::initLogo() h_logo = dy_orig; } + //cch_logo_obj->setWidth(1, true); if (cch_logo_obj->hasLogo()){ cch_logo_obj->setHeight(h_logo, true); @@ -414,8 +418,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); @@ -532,7 +537,7 @@ void CComponentsHeader::initCaption() cch_btn_obj->setXPos(width - buttons_w); //set required width of caption object - cc_text_w -= (buttons_w + cch_offset); + cc_text_w -= buttons_w; } //clock @@ -547,7 +552,7 @@ void CComponentsHeader::initCaption() cch_cl_obj->setXPos(width - buttons_w - clock_w); //set required width of caption object - cc_text_w -= (clock_w + cch_offset); + cc_text_w -= clock_w; //stop clock if disabled or option run is disabled and clock is running if (cch_cl_enable){ diff --git a/src/gui/components/cc_item_picture.h b/src/gui/components/cc_item_picture.h index ef8204d55..fe42604e7 100644 --- a/src/gui/components/cc_item_picture.h +++ b/src/gui/components/cc_item_picture.h @@ -208,7 +208,8 @@ class CComponentsPictureScalable : public CComponentsPicture fb_pixel_t color_background = 0, fb_pixel_t color_shadow = COL_SHADOW_PLUS_0, int transparent = CFrameBuffer::TM_NONE) - : CComponentsPicture(x_pos, y_pos, 0, 0, image_name, parent, shadow_mode, color_frame, color_background, color_shadow, transparent){}; + : CComponentsPicture(x_pos, y_pos, 0, 0, image_name, parent, shadow_mode, color_frame, color_background, color_shadow, transparent) + {cc_item_type = CC_ITEMTYPE_PICTURE_SCALABLE;}; }; class CComponentsChannelLogo : public CComponentsPicture @@ -292,7 +293,8 @@ class CComponentsChannelLogoScalable : public CComponentsChannelLogo fb_pixel_t color_background = 0, fb_pixel_t color_shadow = COL_SHADOW_PLUS_0, int transparent = CFrameBuffer::TM_BLACK) - : CComponentsChannelLogo(x_pos, y_pos, 0, 0, channelName, channelId, parent, shadow_mode, color_frame, color_background, color_shadow, transparent){}; + : CComponentsChannelLogo(x_pos, y_pos, 0, 0, channelName, channelId, parent, shadow_mode, color_frame, color_background, color_shadow, transparent) + {cc_item_type = CC_ITEMTYPE_CHANNEL_LOGO_SCALABLE;}; }; #endif diff --git a/src/gui/components/cc_types.h b/src/gui/components/cc_types.h index c023742a7..1db5ed7aa 100644 --- a/src/gui/components/cc_types.h +++ b/src/gui/components/cc_types.h @@ -41,7 +41,9 @@ typedef enum CC_ITEMTYPE_GENERIC, CC_ITEMTYPE_ITEM, CC_ITEMTYPE_PICTURE, + CC_ITEMTYPE_PICTURE_SCALABLE, CC_ITEMTYPE_CHANNEL_LOGO, + CC_ITEMTYPE_CHANNEL_LOGO_SCALABLE, CC_ITEMTYPE_TEXT, CC_ITEMTYPE_TEXT_INFOBOX, CC_ITEMTYPE_SHAPE_SQUARE, diff --git a/src/gui/epgview.cpp b/src/gui/epgview.cpp index fac773ac1..57003f2aa 100644 --- a/src/gui/epgview.cpp +++ b/src/gui/epgview.cpp @@ -121,11 +121,18 @@ void reformatExtendedEvents(std::string strItem, std::string strLabel, bool bUse CEpgData::CEpgData() { - bigFonts = false; - frameBuffer = CFrameBuffer::getInstance(); - tmdb_active = false; - mp_movie_info = NULL; - header = NULL; + bigFonts = false; + frameBuffer = CFrameBuffer::getInstance(); + tmdb_active = false; + mp_movie_info = NULL; + header = NULL; + Bottombox = NULL; + lpic = NULL; + rpic = NULL; + lText = NULL; + rText = NULL; + pb = NULL; + //NI imdb = CIMDB::getInstance(); imdb_active = false; @@ -134,8 +141,7 @@ CEpgData::CEpgData() CEpgData::~CEpgData() { - delete header; - header = NULL; + ResetModules(); } void CEpgData::start() @@ -753,46 +759,16 @@ int CEpgData::show(const t_channel_id channel_id, uint64_t a_id, time_t* a_start const int pic_h = 39; toph = std::max(toph, pic_h); - // Calculate offset for the title when logo appears. - int pic_offx = 0; std::string lname; - int logo_w = 0; - int logo_h = 0; - int logo_w_max = ox / 4; - int logo_h_max = toph - 2*OFFSET_INNER_MIN; std::string channel_name; if (mp_info) channel_name = mp_movie_info->channelName; else channel_name = g_Zapit->getChannelName(channel_id); - if (g_settings.infobar_show_channellogo && g_PicViewer->GetLogoName(channel_id, channel_name, lname, &logo_w, &logo_h)) - { - if ((logo_h > logo_h_max) || (logo_w > logo_w_max)) - g_PicViewer->rescaleImageDimensions(&logo_w, &logo_h, logo_w_max, logo_h_max); - pic_offx = logo_w + OFFSET_INNER_MID; - } - - int pos; - std::string text1 = epgData.title; - std::string text2 = ""; - if (g_Font[SNeutrinoSettings::FONT_TYPE_EPG_TITLE]->getRenderWidth(text1) > ox - pic_offx - 2*OFFSET_INNER_MID) - { - do - { - pos = text1.find_last_of("[ .]+"); - if (pos != -1) - text1 = text1.substr(0, pos); - } while ((pos != -1) && (g_Font[SNeutrinoSettings::FONT_TYPE_EPG_TITLE]->getRenderWidth(text1) > ox - pic_offx - 2*OFFSET_INNER_MID)); - if (epgData.title.length() > text1.length()) // shold never be false in this place - text2 = epgData.title.substr(text1.length()+ 1, uint(-1) ); - } if (!topboxheight) start(); - if (!text2.empty()) - toph = 2 * topboxheight; - sb = oy - toph - botboxheight; // 21.07.2005 - rainerk @@ -922,62 +898,94 @@ int CEpgData::show(const t_channel_id channel_id, uint64_t a_id, time_t* a_start COSDFader fader(g_settings.theme.menu_Content_alpha); fader.StartFadeIn(); - //show the epg + // show the epg // header + logo - int header_h = std::max(toph, logo_h); if (!header){ - header = new CComponentsShapeSquare(sx, sy, ox, header_h); - header->setCorner(RADIUS_LARGE, CORNER_TOP); - } - header->setDimensionsAll(sx, sy, ox, header_h); - header->setColorBody(COL_MENUHEAD_PLUS_0); - header->enableColBodyGradient(g_settings.theme.menu_Head_gradient, COL_MENUCONTENT_PLUS_0, g_settings.theme.menu_Head_gradient_direction); + header = new CComponentsHeader(sx, sy, ox, toph); + header->setColorBody(COL_MENUHEAD_PLUS_0); + header->enableColBodyGradient(g_settings.theme.menu_Head_gradient, COL_MENUCONTENT_PLUS_0, g_settings.theme.menu_Head_gradient_direction); + header->enableClock(true, "%H:%M", "%H %M", true); + }else + header->setDimensionsAll(sx, sy, ox, toph); - CComponentsPicture* headerPic = NULL; //NOTE: class CComponentsChannelLogo is preferred for channel logos - if (pic_offx > 0) { - headerPic = new CComponentsPicture(sx + OFFSET_INNER_MID, sy + (header_h-logo_h)/2, logo_w, logo_h, lname); - headerPic->doPaintBg(false); - } - std::string textAll = (!text2.empty()) ? text1 + "\n" + text2 : text1; - CComponentsText headerText(sx + OFFSET_INNER_MID + pic_offx, sy, ox - 2*OFFSET_INNER_MID - pic_offx, header_h, textAll, CTextBox::NO_AUTO_LINEBREAK, g_Font[SNeutrinoSettings::FONT_TYPE_EPG_TITLE]); - headerText.doPaintBg(false); - headerText.setTextColor(COL_MENUHEAD_TEXT); + header->setCaption(epgData.title); + + if (header->isPainted()) + header->hideCCItems(); + + // set channel logo + header->setChannelLogo(channel_id, channel_name); + + //paint head header->paint(CC_SAVE_SCREEN_NO); - headerText.paint(CC_SAVE_SCREEN_NO); - if (headerPic) - headerPic->paint(CC_SAVE_SCREEN_NO); int showPos = 0; textCount = epgText.size(); showText(showPos, sy + toph); - // small bottom box - frameBuffer->paintBoxRel(sx, sy+oy-botboxheight, ox, botboxheight, COL_MENUFOOT_PLUS_0); - if (!mp_info) - { - static int iw = 0, ih = 0, io = 0; - if (!iw && !ih) - frameBuffer->getIconSize(NEUTRINO_ICON_BUTTON_LEFT, &iw, &ih); - if (!io && iw) - io = iw + OFFSET_INNER_MID; + // small bottom box with left/right navigation + if (!Bottombox){ + Bottombox = new CComponentsFrmChain(sx, sy+oy-botboxheight, ox, botboxheight); + Bottombox->setColorBody(COL_MENUFOOT_PLUS_0); + Bottombox->setCornerType(CORNER_NONE); + Bottombox->enableColBodyGradient(g_settings.theme.infobar_gradient_bottom,COL_MENUFOOT_PLUS_0,g_settings.theme.infobar_gradient_bottom_direction); + Bottombox->set2ndColor(COL_MENUCONTENT_PLUS_0); + } + if (!mp_info){ std::string fromto = epg_start + " - " + epg_end; - - int widthl = g_Font[SNeutrinoSettings::FONT_TYPE_EPG_DATE]->getRenderWidth(fromto); - g_Font[SNeutrinoSettings::FONT_TYPE_EPG_DATE]->RenderString(sx+OFFSET_INNER_MID+io, sy+oy-3, widthl, fromto, COL_MENUHEAD_TEXT); - int widthr = g_Font[SNeutrinoSettings::FONT_TYPE_EPG_DATE]->getRenderWidth(epg_date); - g_Font[SNeutrinoSettings::FONT_TYPE_EPG_DATE]->RenderString(sx+ox-OFFSET_INNER_MID-io-widthr, sy+oy-3, widthr, epg_date, COL_MENUHEAD_TEXT); + int x_off = OFFSET_INNER_MID; + int mid_width = ox * 40 / 100; // 40% + int side_width = ((ox - mid_width) / 2) - (2 * x_off); GetPrevNextEPGData(epgData.eventID, &epgData.epg_times.startzeit); - if (!call_fromfollowlist) - { - int iy = sy + oy - botboxheight + (botboxheight - iw)/2; - if (prev_id) - frameBuffer->paintIcon(NEUTRINO_ICON_BUTTON_LEFT, sx + OFFSET_INNER_MID, iy); - if (next_id) - frameBuffer->paintIcon(NEUTRINO_ICON_BUTTON_RIGHT, sx + ox - iw - OFFSET_INNER_MID, iy); + + // init left arrow + if (!lpic){ + lpic = new CComponentsPictureScalable(x_off,CC_CENTERED,NEUTRINO_ICON_BUTTON_LEFT); + lpic->doPaintBg(false); + Bottombox->addCCItem(lpic); + lpic->enableSaveBg(); } + lpic->allowPaint(prev_id && !call_fromfollowlist); + + // init right arrow + if (!rpic){ + rpic = new CComponentsPictureScalable(0,CC_CENTERED,NEUTRINO_ICON_BUTTON_RIGHT); + + rpic->doPaintBg(false); + Bottombox->addCCItem(rpic); + rpic->enableSaveBg(); + int x_pos = ox - rpic->getWidth() - x_off; + rpic->setXPos(x_pos); + } + rpic->allowPaint(next_id && !call_fromfollowlist); + + // init text left "from to" + if (!lText){ + lText = new CComponentsText(x_off + lpic->getWidth() + x_off, CC_CENTERED, side_width, toph, "", CTextBox::NO_AUTO_LINEBREAK, g_Font[SNeutrinoSettings::FONT_TYPE_EPG_DATE], CComponentsText::FONT_STYLE_REGULAR, NULL, CC_SHADOW_OFF, COL_MENUHEAD_TEXT); + lText->doPaintBg(false); + Bottombox->addCCItem(lText); + lText->enableSaveBg(); + } + lText->setText(fromto, CTextBox::NO_AUTO_LINEBREAK, g_Font[SNeutrinoSettings::FONT_TYPE_EPG_DATE], COL_MENUHEAD_TEXT, CComponentsText::FONT_STYLE_REGULAR); + + // init text right "follow" + if (!rText){ + rText = new CComponentsText(0, CC_CENTERED, side_width, toph, "", CTextBox::NO_AUTO_LINEBREAK | CTextBox::RIGHT, g_Font[SNeutrinoSettings::FONT_TYPE_EPG_DATE], CComponentsText::FONT_STYLE_REGULAR, Bottombox, CC_SHADOW_OFF, COL_MENUHEAD_TEXT); + rText->doPaintBg(false); + rText->enableSaveBg(); + } + rText->setText(epg_date, CTextBox::NO_AUTO_LINEBREAK | CTextBox::RIGHT, g_Font[SNeutrinoSettings::FONT_TYPE_EPG_DATE]); + rText->setXPos(rpic->getXPos() - x_off - rText->getWidth()); } + + //ensure clean background + if(Bottombox->isPainted()) + Bottombox->hideCCItems(); + + //paint bottombox contents + Bottombox->paint(false); showProgressBar(); // show Timer Event Buttons @@ -1362,6 +1370,7 @@ int CEpgData::show(const t_channel_id channel_id, uint64_t a_id, time_t* a_start } case CRCInput::RC_help: bigFonts = bigFonts ? false : true; + ResetModules(); frameBuffer->paintBackgroundBoxRel(sx, sy, ox, oy); tmdb_active = false; //NI reset tmdb imdb_active = false; //NI reset imdb @@ -1428,8 +1437,6 @@ int CEpgData::show(const t_channel_id channel_id, uint64_t a_id, time_t* a_start if(epgTextSwitchClear) epgTextSwitch.clear(); } - if (headerPic) - delete headerPic; return res; } @@ -1442,6 +1449,8 @@ void CEpgData::hide() g_Font[SNeutrinoSettings::FONT_TYPE_EPG_INFO2]->setSize((int)(g_Font[SNeutrinoSettings::FONT_TYPE_EPG_INFO2]->getSize() / BIGFONT_FACTOR)); } + ResetModules(); + frameBuffer->paintBackgroundBoxRel(sx, sy, ox, oy); showTimerEventBar (false); @@ -1588,18 +1597,21 @@ int CEpgData::FollowScreenings (const t_channel_id /*channel_id*/, const std::st void CEpgData::showProgressBar() { + int w = 104; + int x = sx + (ox - w)/2; + int h = botboxheight - 12; + int y = sy + oy - botboxheight + (botboxheight - h)/2; + if (!pb){ + pb = new CProgressBar(x, y, w, h); + pb->setType(CProgressBar::PB_TIMESCALE); + } //show progressbar if (epg_done != -1) { - int w = 104; - int x = sx + (ox - w)/2; - int h = botboxheight - 12; - int y = sy + oy - botboxheight + (botboxheight - h)/2; - - CProgressBar pb(x, y, w, h); - pb.setType(CProgressBar::PB_TIMESCALE); - pb.setValues(epg_done, 100); - pb.paint(false); + pb->setValues(epg_done, 100); + pb->paint(true); + }else{ + pb->hide(); } } @@ -1739,6 +1751,22 @@ int CEpgData::showIMDb(bool splash) return 0; } +void CEpgData::ResetModules() +{ + if (header){ + delete header; header = NULL; + } + if (Bottombox){ + delete Bottombox; Bottombox = NULL; + // bottom box items are destroyed but explicit reset of bottom box items here required + lpic = rpic = NULL; + lText = rText = NULL; + } + if (pb){ + delete pb; pb = NULL; + } +} + // -- EPG Data Viewer Menu Handler Class // -- to be used for calls from Menue // -- (2004-03-06 rasc) diff --git a/src/gui/epgview.h b/src/gui/epgview.h index 710ed00b1..82ed61d45 100644 --- a/src/gui/epgview.h +++ b/src/gui/epgview.h @@ -51,9 +51,13 @@ class CEpgData CChannelEventList evtlist; CChannelEventList followlist; CEPGData epgData; - CComponentsShapeSquare* header; CIMDB *imdb; //NI + CComponentsHeader *header; + CComponentsFrmChain *Bottombox; + CComponentsPictureScalable *lpic, *rpic; + CComponentsText *lText, *rText; + CProgressBar *pb; std::string epg_date; std::string epg_start; std::string epg_end; @@ -112,6 +116,7 @@ class CEpgData int show(const t_channel_id channel_id, uint64_t id = 0, time_t* startzeit = NULL, bool doLoop = true, bool callFromfollowlist = false, bool mp_info = false ); int show_mp(MI_MOVIE_INFO *mi, int mp_position = 0, int mp_duration = 0, bool doLoop = true); void hide(); + void ResetModules(); }; diff --git a/src/gui/eventlist.cpp b/src/gui/eventlist.cpp index 6718680ed..8b54f8754 100644 --- a/src/gui/eventlist.cpp +++ b/src/gui/eventlist.cpp @@ -120,12 +120,26 @@ CEventList::CEventList() oldEventID = -1; bgRightBoxPaint = false; header = NULL; + pb = NULL; + Bottombox = NULL; } CEventList::~CEventList() { - delete header; - header = NULL; + ResetModules(); +} + +void CEventList::ResetModules() +{ + if (header){ + delete header; header = NULL; + } + if (Bottombox){ + delete Bottombox; Bottombox = NULL; + } + if (pb){ + delete pb; pb = NULL; + } } void CEventList::UpdateTimerList(void) @@ -291,8 +305,10 @@ int CEventList::exec(const t_channel_id channel_id, const std::string& channelna fwidth1 = g_Font[SNeutrinoSettings::FONT_TYPE_EVENTLIST_DATETIME]->getRenderWidth("DDD, :, ") + 4 * g_Font[SNeutrinoSettings::FONT_TYPE_EVENTLIST_DATETIME]->getMaxDigitWidth(); //fwidth2 = g_Font[SNeutrinoSettings::FONT_TYPE_EVENTLIST_ITEMSMALL]->getRenderWidth("[ ] ") + 3 * g_Font[SNeutrinoSettings::FONT_TYPE_EVENTLIST_ITEMSMALL]->getMaxDigitWidth() + g_Font[SNeutrinoSettings::FONT_TYPE_EVENTLIST_ITEMSMALL]->getRenderWidth(unit_short_minute); - listmaxshow = (height-theight-iheight-0)/fheight; - height = theight+iheight+0+listmaxshow*fheight; // recalc height + botboxheight = fheight1+2*OFFSET_INNER_MIN; + + listmaxshow = (height-theight-iheight-botboxheight-0)/fheight; + height = theight+iheight+botboxheight+0+listmaxshow*fheight; // recalc height y = getScreenStartY(height); // calculate width of right info_zone @@ -682,6 +698,7 @@ int CEventList::exec(const t_channel_id channel_id, const std::string& channelna void CEventList::hide() { + ResetModules(); frameBuffer->paintBackgroundBoxRel(x,y, full_width,height); } @@ -804,6 +821,9 @@ void CEventList::paintItem(unsigned int pos, t_channel_id channel_idI) // paint 2nd line text g_Font[SNeutrinoSettings::FONT_TYPE_EVENTLIST_ITEMLARGE]->RenderString(x + iw + OFFSET_INNER_MID, ypos + fheight, width - iw - 2*OFFSET_INNER_MID, evtlist[currpos].description, color); + + if (i_radius) + showProgressBar(currpos); } } @@ -855,57 +875,103 @@ void CEventList::paintDescription(int index) void CEventList::paintHead(t_channel_id _channel_id, std::string _channelname, std::string _channelname_prev, std::string _channelname_next) { - int font_mid = SNeutrinoSettings::FONT_TYPE_EVENTLIST_TITLE; + if (header == NULL){ + header = new CComponentsHeader(); + header->getTextObject()->enableTboxSaveScreen(g_settings.theme.menu_Head_gradient);//enable screen save for title text if color gradient is in use + header->enableClock(true, "%H:%M", "%H %M", true); + header->enableColBodyGradient(g_settings.theme.menu_Head_gradient, COL_MENUCONTENT_PLUS_0, g_settings.theme.menu_Head_gradient_direction); + header->setDimensionsAll(x, y, full_width, theight); + } + //header->getClockObject()->setCorner(RADIUS_LARGE, CORNER_TOP_RIGHT); + + if (header->isPainted()) + header->getChannelLogoObject()->hide(); + header->setChannelLogo(_channel_id,_channelname); + header->setCaption(_channelname,CTextBox::CENTER); + + header->paint(CC_SAVE_SCREEN_NO); + + paintBottomBox(_channelname_prev, _channelname_next); +} + +void CEventList::paintBottomBox(std::string _channelname_prev, std::string _channelname_next) +{ + int by = y + height - iheight - botboxheight; int font_lr = SNeutrinoSettings::FONT_TYPE_EVENTLIST_ITEMLARGE; - - if (!header) - header = new CComponentsFrmChain(); - - header->setDimensionsAll(x, y, full_width, theight); - header->enableColBodyGradient(g_settings.theme.menu_Head_gradient, COL_MENUCONTENT_PLUS_0, g_settings.theme.menu_Head_gradient_direction); - header->setCorner(RADIUS_LARGE, CORNER_TOP); - header->clear(); - int x_off = OFFSET_INNER_MID; int mid_width = full_width * 40 / 100; // 40% - int max_height = theight - 2*OFFSET_INNER_MIN; int side_width = ((full_width - mid_width) / 2) - (2 * x_off); - //create an logo object - CComponentsChannelLogoScalable* midLogo = new CComponentsChannelLogoScalable(0, 0, _channelname, _channel_id, header); - if (midLogo->hasLogo()) - { - midLogo->setWidth(min(midLogo->getWidth(), mid_width), true); - if (midLogo->getHeight() > max_height) - midLogo->setHeight(max_height, true); - - midLogo->setPos(CC_CENTERED, CC_CENTERED); - - // recalc widths - side_width = ((full_width - midLogo->getWidth()) / 2) - (4 * x_off); - } - else { - header->removeCCItem(midLogo); //remove/destroy logo object, if it is not available - int w_midText = g_Font[font_mid]->getRenderWidth(_channelname); - CComponentsText *midText = new CComponentsText(0, CC_CENTERED, w_midText, theight, _channelname, CTextBox::CENTER, g_Font[font_mid], CComponentsText::FONT_STYLE_REGULAR, header, CC_SHADOW_OFF, COL_MENUHEAD_TEXT); - midText->setXPos(full_width/2 - midText->getWidth()/2); - midText->doPaintBg(false); + if (!Bottombox){ + Bottombox = new CComponentsFrmChain(x, by, full_width, botboxheight); + Bottombox->setColorBody(COL_MENUFOOT_PLUS_0); + Bottombox->enableColBodyGradient(g_settings.theme.infobar_gradient_bottom,COL_MENUFOOT_PLUS_0,g_settings.theme.infobar_gradient_bottom_direction); + Bottombox->set2ndColor(COL_MENUCONTENT_PLUS_0); + }else{ + if (Bottombox->isPainted()) + Bottombox->hideCCItems(); + Bottombox->clear(); } if (!_channelname_prev.empty()) { - CComponentsText *lText = new CComponentsText(x_off, CC_CENTERED, side_width, theight, _channelname_prev, CTextBox::NO_AUTO_LINEBREAK, g_Font[font_lr], CComponentsText::FONT_STYLE_REGULAR, header, CC_SHADOW_OFF, COL_MENUHEAD_TEXT); + CComponentsPictureScalable *lpic = new CComponentsPictureScalable(x_off,CC_CENTERED,NEUTRINO_ICON_BUTTON_LEFT,Bottombox); + lpic->doPaintBg(false); + lpic->enableSaveBg(); + + CComponentsText *lText = new CComponentsText(x_off + lpic->getWidth() + OFFSET_INNER_MID, CC_CENTERED, side_width, theight, _channelname_prev, CTextBox::NO_AUTO_LINEBREAK, g_Font[font_lr], CComponentsText::FONT_STYLE_REGULAR, Bottombox, CC_SHADOW_OFF, COL_MENUHEAD_TEXT); lText->doPaintBg(false); + lText->enableSaveBg(); } if (!_channelname_next.empty()) { - int x_pos = full_width - side_width - x_off; - CComponentsText *rText = new CComponentsText(x_pos, CC_CENTERED, side_width, theight, _channelname_next, CTextBox::NO_AUTO_LINEBREAK | CTextBox::RIGHT, g_Font[font_lr], CComponentsText::FONT_STYLE_REGULAR, header, CC_SHADOW_OFF, COL_MENUHEAD_TEXT); + CComponentsPictureScalable *rpic = new CComponentsPictureScalable(0,CC_CENTERED,NEUTRINO_ICON_BUTTON_RIGHT,Bottombox); + int x_pos = full_width - rpic->getWidth() - OFFSET_INNER_MID; + rpic->doPaintBg(false); + rpic->setXPos(x_pos); + rpic->enableSaveBg(); + + CComponentsText *rText = new CComponentsText(0, CC_CENTERED, side_width, theight, _channelname_next, CTextBox::NO_AUTO_LINEBREAK | CTextBox::RIGHT, g_Font[font_lr], CComponentsText::FONT_STYLE_REGULAR, Bottombox, CC_SHADOW_OFF, COL_MENUHEAD_TEXT); + rText->setXPos(x_pos - OFFSET_INNER_MID - rText->getWidth()); rText->doPaintBg(false); + rText->enableSaveBg(); + } + + Bottombox->paint(false); +} + +void CEventList::showProgressBar(int pos) +{ + int epg_done= -1; + if ((( time(NULL)- evtlist[pos].startTime )>= 0 ) && (evtlist[pos].duration > 0)) + { + unsigned nProcentagePassed = ((time(NULL) - evtlist[pos].startTime) * 100 / evtlist[pos].duration); + if (nProcentagePassed<= 100) + epg_done= nProcentagePassed; + } + + if (!pb) + { + int pbw = 104; + int pbx = x + (full_width - pbw)/2; + int pbh = botboxheight - 12; + int pby = y + height -iheight - botboxheight + (botboxheight - pbh)/2; + + pb = new CProgressBar(pbx, pby, pbw, pbh); + pb->setType(CProgressBar::PB_TIMESCALE); + pb->doPaintBg(false); + } + + //show progressbar + if (epg_done > 0) + { + pb->setValues(epg_done, 100); + pb->paint(true); + } + else + { + pb->hide(); } - if (header->isPainted()) //clean up background of header for new captions - header->kill(header->getColorBody()); - header->paint(CC_SAVE_SCREEN_NO); } void CEventList::paint(t_channel_id channel_id) diff --git a/src/gui/eventlist.h b/src/gui/eventlist.h index 90542ba26..8b81aefb5 100644 --- a/src/gui/eventlist.h +++ b/src/gui/eventlist.h @@ -95,6 +95,7 @@ class CEventList : public CListHelpers std::string search_head_name; int full_width, width, infozone_width; + int botboxheight; int height; int x; int y; @@ -102,13 +103,17 @@ class CEventList : public CListHelpers int sort_mode; event_id_t item_event_ID; CComponentsText *cc_infozone; - CComponentsFrmChain *header; + CComponentsHeader *header; + CProgressBar *pb; + CComponentsFrmChain *Bottombox; const char * unit_short_minute; void paintItem(unsigned pos, t_channel_id channel_id = 0); void paintDescription(int index); void paint(t_channel_id channel_id = 0); void paintHead(t_channel_id _channel_id, std::string _channelname, std::string _channelname_prev = "", std::string _channelname_next = ""); + void paintBottomBox(std::string _channelname_prev, std::string _channelname_next); + void showProgressBar(int pos); void hide(); void showFunctionBar(t_channel_id channel_id); @@ -123,6 +128,7 @@ class CEventList : public CListHelpers CEventList(); ~CEventList(); int exec(const t_channel_id channel_id, const std::string& channelname, const std::string& prev = "", const std::string& next = "", const CChannelEventList &followlist = CChannelEventList ()); // UTF-8 + void ResetModules(); }; class CEventListHandler : public CMenuTarget diff --git a/src/gui/moviebrowser/mb.cpp b/src/gui/moviebrowser/mb.cpp index ae2f09f44..14dfe66ca 100644 --- a/src/gui/moviebrowser/mb.cpp +++ b/src/gui/moviebrowser/mb.cpp @@ -2192,6 +2192,7 @@ bool CMovieBrowser::onButtonPressMainFrame(neutrino_msg_t msg) { if (m_movieSelectionHandler != NULL) { + m_header->getClockObject()->kill(); framebuffer->paintBackground(); //clear whole screen g_EpgData->show_mp(m_movieSelectionHandler); refresh(); diff --git a/src/gui/timerlist.cpp b/src/gui/timerlist.cpp index b668ae110..fac258cf6 100644 --- a/src/gui/timerlist.cpp +++ b/src/gui/timerlist.cpp @@ -1386,7 +1386,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); } diff --git a/src/gui/upnpbrowser.cpp b/src/gui/upnpbrowser.cpp index e44245404..1baa208e2 100644 --- a/src/gui/upnpbrowser.cpp +++ b/src/gui/upnpbrowser.cpp @@ -737,7 +737,7 @@ bool CUpnpBrowserGui::selectItem(std::string id) if (!getItems(id, liststart, entries, total)) return endall; - while (loop) { + while (loop && entries!=NULL) { updateTimes(); updateMode();