diff --git a/src/gui/bouquetlist.cpp b/src/gui/bouquetlist.cpp index 4794e2579..4a5b6c9a0 100644 --- a/src/gui/bouquetlist.cpp +++ b/src/gui/bouquetlist.cpp @@ -3,6 +3,7 @@ Copyright (C) 2001 Steffen Hehn 'McClean' Copyright (C) 2009,2011,2013,2015-2017 Stefan Seyfried + Copyright (C) 2017 Sven Hoefer License: GPL @@ -67,7 +68,6 @@ CBouquetList::CBouquetList(const char * const Name) name = g_Locale->getText(LOCALE_BOUQUETLIST_HEAD); else name = Name; - } CBouquetList::~CBouquetList() @@ -411,7 +411,8 @@ int CBouquetList::show(bool bShowChannelList) int h_max_icon = 0; favonly = !bShowChannelList; - for(unsigned int count = 0; count < sizeof(CBouquetListButtons)/sizeof(CBouquetListButtons[0]);count++){ + for (unsigned int count = 0; count < sizeof(CBouquetListButtons)/sizeof(CBouquetListButtons[0]); count++) + { int w_text = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_FOOT]->getRenderWidth(g_Locale->getText(CBouquetListButtons[count].locale)); w_max_text = std::max(w_max_text, w_text); frameBuffer->getIconSize(CBouquetListButtons[count].button, &icol_w, &icol_h); @@ -419,26 +420,32 @@ int CBouquetList::show(bool bShowChannelList) 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); - CVFD::getInstance()->setMode(CVFD::MODE_MENU_UTF8, ""); - fheight = g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST]->getHeight(); + item_height = g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST]->getHeight(); - width = w_max (need_width, 20); - height = h_max (16 * fheight, 40); + /* + We align width to needed footer space, + but this manual calculation isn't a good idea. + It would be better to get the needed width from + CComponententsFooter class. + */ + width = (sizeof(CBouquetListButtons)/sizeof(CBouquetListButtons[0]))*(w_max_icon + w_max_text + 2*OFFSET_INNER_MID); + height = 16*item_height; - footerHeight = std::max(h_max_icon+8, g_Font[SNeutrinoSettings::FONT_TYPE_MENU_FOOT]->getHeight()+8); - theight = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]->getHeight(); - listmaxshow = (height - theight - footerHeight)/fheight; - height = theight + footerHeight + listmaxshow * fheight; // recalc height + header_height = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]->getHeight(); + footer_height = header_height; + listmaxshow = (height - header_height - footer_height)/item_height; + height = header_height + footer_height + listmaxshow*item_height; // recalc height - x = frameBuffer->getScreenX() + (frameBuffer->getScreenWidth() - width) / 2; - y = frameBuffer->getScreenY() + (frameBuffer->getScreenHeight() - height) / 2; + x = getScreenStartX(width); + y = getScreenStartY(height); int lmaxpos= 1; int i= Bouquets.size(); while ((i= i/10)!=0) lmaxpos++; + CVFD::getInstance()->setMode(CVFD::MODE_MENU_UTF8, ""); + COSDFader fader(g_settings.theme.menu_Content_alpha); fader.StartFadeIn(); @@ -471,7 +478,7 @@ int CBouquetList::show(bool bShowChannelList) { selected = oldselected; if(fader.StartFadeOut()) { - timeoutEnd = CRCInput::calcTimeoutEnd( 1 ); + timeoutEnd = CRCInput::calcTimeoutEnd(1); msg = 0; } else loop=false; @@ -563,7 +570,7 @@ int CBouquetList::show(bool bShowChannelList) pos = 1; } } else { - chn = chn * 10 + CRCInput::getNumericValue(msg); + chn = chn*10 + CRCInput::getNumericValue(msg); pos++; } @@ -591,6 +598,7 @@ int CBouquetList::show(bool bShowChannelList) fader.StopFade(); CVFD::getInstance()->setMode(CVFD::MODE_TVRADIO); + if (save_bouquets) { save_bouquets = false; #if 0 @@ -602,7 +610,8 @@ int CBouquetList::show(bool bShowChannelList) if (g_settings.epg_scan == CEpgScan::SCAN_SEL) CEpgScan::getInstance()->Start(); } - if(zapOnExit) + + if (zapOnExit) return (selected); return (res); @@ -610,13 +619,13 @@ int CBouquetList::show(bool bShowChannelList) void CBouquetList::hide() { - frameBuffer->paintBackgroundBoxRel(x,y, width,height+10); + frameBuffer->paintBackgroundBoxRel(x, y, width, height); CInfoClock::getInstance()->enableInfoClock(!CInfoClock::getInstance()->isBlocked()); } void CBouquetList::paintItem(int pos) { - int ypos = y+ theight+0 + pos*fheight; + int ypos = y + header_height + pos*item_height; bool iscurrent = true; int npos = liststart + pos; const char * lname = NULL; @@ -633,8 +642,8 @@ void CBouquetList::paintItem(int pos) i_radius = RADIUS_LARGE; if (i_radius) - frameBuffer->paintBoxRel(x, ypos, width- 15, fheight, COL_MENUCONTENT_PLUS_0); - frameBuffer->paintBoxRel(x, ypos, width- 15, fheight, bgcolor, i_radius); + frameBuffer->paintBoxRel(x, ypos, width - SCROLLBAR_WIDTH, item_height, COL_MENUCONTENT_PLUS_0); + frameBuffer->paintBoxRel(x, ypos, width - SCROLLBAR_WIDTH, item_height, bgcolor, i_radius); if (npos < (int) Bouquets.size()) lname = (Bouquets[npos]->zapitBouquet && Bouquets[npos]->zapitBouquet->bFav) ? g_Locale->getText(LOCALE_FAVORITES_BOUQUETNAME) : Bouquets[npos]->channelList->getName(); @@ -657,33 +666,33 @@ void CBouquetList::paintItem(int pos) } } - if(npos < (int) Bouquets.size()) { - char tmp[10]; - sprintf((char*) tmp, "%d", npos+ 1); + if (npos < (int) Bouquets.size()) { + char num[10]; + sprintf((char*) num, "%d", npos + 1); int iw = 0, ih = 0; if ((g_settings.epg_scan == CEpgScan::SCAN_SEL) && Bouquets[npos]->zapitBouquet && Bouquets[npos]->zapitBouquet->bScanEpg) { frameBuffer->getIconSize(NEUTRINO_ICON_EPG, &iw, &ih); if (iw && ih) { - int icon_x = (x+width-2) - RADIUS_LARGE/2 - iw; - frameBuffer->paintIcon(NEUTRINO_ICON_EPG, icon_x - iw, ypos, fheight); - iw = iw + 4 + RADIUS_LARGE/2; + int icon_x = x + width - SCROLLBAR_WIDTH - OFFSET_INNER_MID - iw; + frameBuffer->paintIcon(NEUTRINO_ICON_EPG, icon_x, ypos, item_height); + iw = iw + OFFSET_INNER_MID; } } if (Bouquets[npos]->zapitBouquet && Bouquets[npos]->zapitBouquet->bUseCI) { - int iw2; - frameBuffer->getIconSize(NEUTRINO_ICON_SCRAMBLED2, &iw2, &ih); + int iw2 = 0; + frameBuffer->getIconSize(NEUTRINO_ICON_SCRAMBLED, &iw2, &ih); if (iw2 && ih) { - int icon_x = (x+width-2) - RADIUS_LARGE/2 - iw - iw2 - 2; - frameBuffer->paintIcon(NEUTRINO_ICON_SCRAMBLED2, icon_x - iw2, ypos, fheight); - iw = iw + iw2 + 4 + RADIUS_LARGE/2; + int icon_x = x + width - SCROLLBAR_WIDTH - OFFSET_INNER_MID - iw - iw2; + frameBuffer->paintIcon(NEUTRINO_ICON_SCRAMBLED, icon_x, ypos, item_height); + iw = iw + iw2 + OFFSET_INNER_MID; } } - int numpos = x+5+numwidth- g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST_NUMBER]->getRenderWidth(tmp); - g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST_NUMBER]->RenderString(numpos,ypos+fheight, numwidth+5, tmp, color, fheight); + int numpos = x + OFFSET_INNER_MID + numwidth - g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST_NUMBER]->getRenderWidth(num); + g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST_NUMBER]->RenderString(numpos, ypos + item_height, numwidth + OFFSET_INNER_SMALL, num, color, item_height); - g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST]->RenderString(x+ 5+ numwidth+ 10, ypos+ fheight, width- numwidth- 20- 15 - iw, lname, color); + g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST]->RenderString(x + OFFSET_INNER_MID + numwidth + OFFSET_INNER_MID, ypos + item_height, width - numwidth - 2*OFFSET_INNER_MID - iw - SCROLLBAR_WIDTH, lname, color); //CVFD::getInstance()->showMenuText(0, bouq->channelList->getName(), -1, true); } } @@ -691,7 +700,7 @@ void CBouquetList::paintItem(int pos) void CBouquetList::paintHead() { std::string icon(""); - CComponentsHeader header(x, y, width, theight, name, icon, CComponentsHeader::CC_BTN_LEFT | CComponentsHeader::CC_BTN_RIGHT | CComponentsHeader::CC_BTN_MENU); + CComponentsHeader header(x, y, width, header_height, name, icon, CComponentsHeader::CC_BTN_LEFT | CComponentsHeader::CC_BTN_RIGHT | CComponentsHeader::CC_BTN_MENU); header.paint(CC_SAVE_SCREEN_NO); } @@ -711,33 +720,32 @@ void CBouquetList::paint() _lastnum /= 10; } - frameBuffer->paintBoxRel(x, y+theight, width, height - theight - footerHeight, COL_MENUCONTENT_PLUS_0); + frameBuffer->paintBoxRel(x, y + header_height, width, height - header_height - footer_height, COL_MENUCONTENT_PLUS_0); - int numbuttons = sizeof(CBouquetListButtons)/sizeof(CBouquetListButtons[0]); -#if 0 - if (favonly) /* this actually shows favorites and providers button, but both are active anyway */ - numbuttons = 2; + int numButtons = sizeof(CBouquetListButtons)/sizeof(CBouquetListButtons[0]); - ::paintButtons(x, y + (height - footerHeight), width, numbuttons, CBouquetListButtons, width, footerHeight); -#endif if (favonly) - frameBuffer->paintBoxRel(x, y + (height - footerHeight), width, footerHeight, COL_MENUFOOT_PLUS_0, RADIUS_LARGE, CORNER_BOTTOM); //round - else - ::paintButtons(x, y + (height - footerHeight), width, numbuttons, CBouquetListButtons, width, footerHeight); - - if(!Bouquets.empty()) { - for(unsigned int count=0;countpaintBoxRel(x, y + height - footer_height, width, footer_height, COL_MENUFOOT_PLUS_0, RADIUS_LARGE, CORNER_BOTTOM); + } + else + { + CComponentsFooter footer; + footer.paintButtons(x, y + height - footer_height, width, footer_height, numButtons, CBouquetListButtons); + } + + if (!Bouquets.empty()) + { + for (unsigned int count = 0; count < listmaxshow; count++) + { paintItem(count); } } - int ypos = y+ theight; - int sb = fheight* listmaxshow; - frameBuffer->paintBoxRel(x+ width- 15,ypos, 15, sb, COL_SCROLLBAR_PASSIVE_PLUS_0); - int listmaxshow_tmp = listmaxshow ? listmaxshow : 1;//avoid division by zero - int sbc= ((bsize - 1)/ listmaxshow_tmp)+ 1; /* bsize is > 0, so sbc is also > 0 */ - int sbs= (selected/listmaxshow_tmp); + int _listmaxshow = listmaxshow ? listmaxshow : 1; //avoid division by zero + int total_pages = ((bsize - 1) / _listmaxshow) + 1; + int current_page = selected / _listmaxshow; - frameBuffer->paintBoxRel(x+ width- 13, ypos+ 2+ sbs * (sb-4)/sbc, 11, (sb-4)/sbc, COL_SCROLLBAR_ACTIVE_PLUS_0); + paintScrollBar(x + width - SCROLLBAR_WIDTH, y + header_height, SCROLLBAR_WIDTH, item_height*listmaxshow, total_pages, current_page); } diff --git a/src/gui/bouquetlist.h b/src/gui/bouquetlist.h index 04043e34e..94c7a617e 100644 --- a/src/gui/bouquetlist.h +++ b/src/gui/bouquetlist.h @@ -87,9 +87,9 @@ class CBouquetList : public CListHelpers unsigned int liststart; unsigned int listmaxshow; unsigned int numwidth; - int fheight; // Fonthoehe Bouquetlist-Inhalt - int theight; // Fonthoehe Bouquetlist-Titel - int footerHeight; + int item_height; + int header_height; + int footer_height; int width; int height; diff --git a/src/gui/channellist.cpp b/src/gui/channellist.cpp index 03057fe87..8499c38c5 100644 --- a/src/gui/channellist.cpp +++ b/src/gui/channellist.cpp @@ -125,7 +125,7 @@ CChannelList::CChannelList(const char * const pName, bool phistoryMode, bool _vl dline = NULL; cc_minitv = NULL; logo_off = 0; - pig_on_win = false; + minitv_is_active = false; CChannelLogo = NULL; headerNew = true; bouquet = NULL; @@ -484,9 +484,9 @@ void CChannelList::calcSize() fheight = 1; /* avoid div-by-zero crash on invalid font */ footerHeight = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_FOOT]->getHeight()+6; - pig_on_win = ( (g_settings.channellist_additional == 2) /* with miniTV */ && (CNeutrinoApp::getInstance()->getMode() != NeutrinoMessages::mode_ts) ); + minitv_is_active = ( (g_settings.channellist_additional == 2) && (CNeutrinoApp::getInstance()->getMode() != NeutrinoMessages::mode_ts) ); // calculate width - full_width = pig_on_win ? (frameBuffer->getScreenWidth()-2*DETAILSLINE_WIDTH) : frameBuffer->getScreenWidthRel(); + full_width = minitv_is_active ? (frameBuffer->getScreenWidth()-2*DETAILSLINE_WIDTH) : frameBuffer->getScreenWidthRel(); if (g_settings.channellist_additional) width = full_width / 3 * 2; @@ -495,10 +495,10 @@ void CChannelList::calcSize() // calculate height (the infobox below mainbox is handled outside height) if (g_settings.channellist_show_infobox) - info_height = 2*fheight + fdescrheight + 10; + info_height = 2*fheight + fdescrheight + 2*OFFSET_INNER_SMALL; else info_height = 0; - height = pig_on_win ? frameBuffer->getScreenHeight(): frameBuffer->getScreenHeightRel(); + height = minitv_is_active ? frameBuffer->getScreenHeight() : frameBuffer->getScreenHeightRel(); height = height - OFFSET_INTER - info_height; // calculate x position @@ -522,7 +522,7 @@ void CChannelList::calcSize() // calculate width/height of right info_zone and pip-box infozone_width = full_width - width; pig_width = infozone_width; - if ( pig_on_win /* with miniTV */ ) + if (minitv_is_active) pig_height = (pig_width * 9) / 16; else pig_height = 0; @@ -1559,8 +1559,8 @@ void CChannelList::paintDetails(int index) std::string text1= p_event->description; std::string text2= p_event->text; - int xstart = 10; - if (g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST]->getRenderWidth(text1) > (full_width - 30 - seit_len) ) + int xstart = OFFSET_INNER_MID; + if (g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST]->getRenderWidth(text1) > (full_width - 3*OFFSET_INNER_MID - seit_len) ) { // zu breit, Umbruch versuchen... int pos; @@ -1568,7 +1568,7 @@ void CChannelList::paintDetails(int index) pos = text1.find_last_of("[ -.]+"); if ( pos!=-1 ) text1 = text1.substr( 0, pos ); - } while ( ( pos != -1 ) && (g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST]->getRenderWidth(text1) > (full_width - 30 - seit_len) ) ); + } while ( ( pos != -1 ) && (g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST]->getRenderWidth(text1) > (full_width - 3*OFFSET_INNER_MID - seit_len) ) ); std::string text3 = ""; /* not perfect, but better than crashing... */ if (p_event->description.length() > text1.length()) @@ -1578,7 +1578,7 @@ void CChannelList::paintDetails(int index) text3= text3+ " - "; xstart += g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST]->getRenderWidth(text3); - g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST]->RenderString(x+ 10, ypos_a + 2*fheight, full_width - 30- noch_len, text3, colored_event_C ? COL_COLORED_EVENTS_TEXT : COL_MENUCONTENTDARK_TEXT); + g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST]->RenderString(x + OFFSET_INNER_MID, ypos_a + 2*fheight, full_width - 3*OFFSET_INNER_MID - noch_len, text3, colored_event_C ? COL_COLORED_EVENTS_TEXT : COL_MENUCONTENTDARK_TEXT); } if (!(text2.empty())) { @@ -1587,7 +1587,7 @@ void CChannelList::paintDetails(int index) text2 = text2.substr( 0, text2.find('\n') ); #if 0 //FIXME: to discuss, eat too much cpu time if string long enough int pos = 0; - while ( ( pos != -1 ) && (g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST]->getRenderWidth(text2) > (full_width - 30 - noch_len) ) ) { + while ( ( pos != -1 ) && (g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST]->getRenderWidth(text2) > (full_width - 3*OFFSET_INNER_MID - noch_len) ) ) { pos = text2.find_last_of(" "); if ( pos!=-1 ) { @@ -1595,18 +1595,18 @@ void CChannelList::paintDetails(int index) } } #endif - g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST_DESCR]->RenderString(x+ xstart, ypos_a + fdescrheight+ fheight, full_width- xstart- 30- noch_len, text2, colored_event_C ? COL_COLORED_EVENTS_TEXT : COL_MENUCONTENTDARK_TEXT); + g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST_DESCR]->RenderString(x + xstart, ypos_a + fdescrheight+ fheight, full_width- xstart- 3*OFFSET_INNER_MID- noch_len, text2, colored_event_C ? COL_COLORED_EVENTS_TEXT : COL_MENUCONTENTDARK_TEXT); } - g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST]->RenderString(x+ 10, ypos_a + fheight, full_width - 30 - seit_len, text1, colored_event_C ? COL_COLORED_EVENTS_TEXT : COL_MENUCONTENTDARK_TEXT); - g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST_DESCR]->RenderString(x+ full_width- 10- seit_len, ypos_a + fheight , seit_len, cSeit, colored_event_C ? COL_COLORED_EVENTS_TEXT : COL_MENUCONTENTDARK_TEXT); - g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST_DESCR]->RenderString(x+ full_width- 10- noch_len, ypos_a + fdescrheight+ fheight, noch_len, cNoch, colored_event_C ? COL_COLORED_EVENTS_TEXT : COL_MENUCONTENTDARK_TEXT); + g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST]->RenderString(x+ OFFSET_INNER_MID, ypos_a + fheight, full_width - 3*OFFSET_INNER_MID - seit_len, text1, colored_event_C ? COL_COLORED_EVENTS_TEXT : COL_MENUCONTENTDARK_TEXT); + g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST_DESCR]->RenderString(x+ full_width- OFFSET_INNER_MID- seit_len, ypos_a + fheight , seit_len, cSeit, colored_event_C ? COL_COLORED_EVENTS_TEXT : COL_MENUCONTENTDARK_TEXT); + g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST_DESCR]->RenderString(x+ full_width- OFFSET_INNER_MID- noch_len, ypos_a + fdescrheight+ fheight, noch_len, cNoch, colored_event_C ? COL_COLORED_EVENTS_TEXT : COL_MENUCONTENTDARK_TEXT); } else if (IS_WEBTV((*chanlist)[index]->getChannelID())) { - g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST]->RenderString(x+ 10, ypos_a + fheight, full_width - 30, (*chanlist)[index]->getDesc(), colored_event_C ? COL_COLORED_EVENTS_TEXT : COL_MENUCONTENTDARK_TEXT, 0, true); + g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST]->RenderString(x+ OFFSET_INNER_MID, ypos_a + fheight, full_width - 3*OFFSET_INNER_MID, (*chanlist)[index]->getDesc(), colored_event_C ? COL_COLORED_EVENTS_TEXT : COL_MENUCONTENTDARK_TEXT, 0, true); } if (g_settings.channellist_foot == 0 && IS_WEBTV((*chanlist)[index]->getChannelID())) { - g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST]->RenderString(x+ 10, ypos_a + 2*fheight + fdescrheight, full_width - 30, (*chanlist)[index]->getUrl(), COL_MENUCONTENTDARK_TEXT, 0, true); + g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST]->RenderString(x+ OFFSET_INNER_MID, ypos_a + 2*fheight + fdescrheight, full_width - 3*OFFSET_INNER_MID, (*chanlist)[index]->getUrl(), COL_MENUCONTENTDARK_TEXT, 0, true); } else if(g_settings.channellist_foot == 0) { transponder t; CServiceManager::getInstance()->GetTransponder((*chanlist)[index]->getTransponderId(), t); @@ -1617,7 +1617,7 @@ void CChannelList::paintDetails(int index) else desc = desc + " (" + CServiceManager::getInstance()->GetSatelliteName((*chanlist)[index]->getSatellitePosition()) + ")"; - g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST]->RenderString(x+ 10, ypos_a + 2*fheight +fdescrheight, full_width - 30, desc.c_str(), COL_MENUCONTENTDARK_TEXT); + g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST]->RenderString(x+ OFFSET_INNER_MID, ypos_a + 2*fheight +fdescrheight, full_width - 3*OFFSET_INNER_MID, desc.c_str(), COL_MENUCONTENTDARK_TEXT); } else if( !displayNext && g_settings.channellist_foot == 1) { // next Event @@ -1631,8 +1631,8 @@ void CChannelList::paintDetails(int index) snprintf(buf, sizeof(buf), "%s", CurrentNext.next_name.c_str()); int from_len = g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST_DESCR]->getRenderWidth(cFrom); - g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST]->RenderString(x+ 10, ypos_a + 2*fheight+ fdescrheight, full_width - 30 - from_len, buf, colored_event_N ? COL_COLORED_EVENTS_TEXT :COL_MENUCONTENTDARK_TEXT); - g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST_DESCR]->RenderString(x+ full_width- 10- from_len, ypos_a + 2*fheight+ fdescrheight, from_len, cFrom, colored_event_N ? COL_COLORED_EVENTS_TEXT : COL_MENUCONTENTDARK_TEXT); + g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST]->RenderString(x+ OFFSET_INNER_MID, ypos_a + 2*fheight+ fdescrheight, full_width - 3*OFFSET_INNER_MID - from_len, buf, colored_event_N ? COL_COLORED_EVENTS_TEXT :COL_MENUCONTENTDARK_TEXT); + g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST_DESCR]->RenderString(x+ full_width- OFFSET_INNER_MID- from_len, ypos_a + 2*fheight+ fdescrheight, from_len, cFrom, colored_event_N ? COL_COLORED_EVENTS_TEXT : COL_MENUCONTENTDARK_TEXT); } } } @@ -2210,7 +2210,7 @@ void CChannelList::paintBody() liststart = (selected/listmaxshow)*listmaxshow; updateEvents(this->historyMode ? 0:liststart, this->historyMode ? 0:(liststart + listmaxshow)); - if (pig_on_win) // with miniTV + if (minitv_is_active) paintPig(x+width, y+theight, pig_width, pig_height); // paint background for main box @@ -2301,7 +2301,7 @@ std::string CChannelList::MaxChanNr() return to_string(n); } -void CChannelList::paintPig (int _x, int _y, int w, int h) +void CChannelList::paintPig(int _x, int _y, int w, int h) { //init minitv object with basic properties if (cc_minitv == NULL){ diff --git a/src/gui/channellist.h b/src/gui/channellist.h index f5addbe68..75ac35a63 100644 --- a/src/gui/channellist.h +++ b/src/gui/channellist.h @@ -131,7 +131,7 @@ private: bool vlist; // "virtual" list, not bouquet bool displayNext; bool displayList; - bool pig_on_win; + bool minitv_is_active; bool headerNew; diff --git a/src/gui/components/cc_frm_clock.cpp b/src/gui/components/cc_frm_clock.cpp index a13193e09..f11a27f18 100644 --- a/src/gui/components/cc_frm_clock.cpp +++ b/src/gui/components/cc_frm_clock.cpp @@ -74,6 +74,9 @@ CComponentsFrmClock::CComponentsFrmClock( const int& x_pos, setClockFormat(prformat_str, secformat_str); cl_col_text = COL_MENUCONTENT_TEXT; + //enable refresh of all segments on each interval as default + cl_force_repaint = true; + //init default font cl_font = font; cl_font_style = font_style; @@ -87,9 +90,6 @@ CComponentsFrmClock::CComponentsFrmClock( const int& x_pos, //set default text background behavior cc_txt_save_screen = false; - //enable refresh of all segments on each interval as default - cl_force_repaint = true; - //set default running clock properties cl_interval = interval_seconds; cl_timer = NULL; diff --git a/src/gui/components/cc_frm_footer.cpp b/src/gui/components/cc_frm_footer.cpp index 853b4465a..3532e05f3 100644 --- a/src/gui/components/cc_frm_footer.cpp +++ b/src/gui/components/cc_frm_footer.cpp @@ -111,6 +111,9 @@ void CComponentsFooter::setButtonLabels(const struct button_label_cc * const con if (chain) chain->clear(); + if (label_count == 0) + return; + /* set general available full basic space for button chain, * in this case this is footer width */ @@ -372,7 +375,6 @@ void CComponentsFooter::paintButtons(const int& x_pos, this->setButtonFont(font); this->setContextButton(context_buttons); this->setButtonLabels(content, label_count, 0, label_width); - this->paint(do_save_bg); } diff --git a/src/gui/components/cc_item.cpp b/src/gui/components/cc_item.cpp index b783f82d8..54c335c9a 100644 --- a/src/gui/components/cc_item.cpp +++ b/src/gui/components/cc_item.cpp @@ -261,6 +261,20 @@ bool CComponentsItem::isAdded() return false; } +void CComponentsItem::setXPos(const int& xpos) +{ + CCDraw::setXPos(xpos); + if (cc_parent) + cc_xr = cc_parent->getXPos() + x; +} + +void CComponentsItem::setYPos(const int& ypos) +{ + CCDraw::setYPos(ypos); + if (cc_parent) + cc_yr = cc_parent->getYPos() + y; +} + void CComponentsItem::setXPosP(const uint8_t& xpos_percent) { int x_tmp = cc_parent ? xpos_percent*cc_parent->getWidth() : xpos_percent*frameBuffer->getScreenWidth(); diff --git a/src/gui/components/cc_item.h b/src/gui/components/cc_item.h index 4f5f42da5..37677a813 100644 --- a/src/gui/components/cc_item.h +++ b/src/gui/components/cc_item.h @@ -134,6 +134,11 @@ class CComponentsItem : public CComponents ///returns current number of page location of current item, see: cc_page_number virtual u_int8_t getPageNumber(){return cc_page_number;}; + ///set screen x-position, parameter as int + virtual void setXPos(const int& xpos); + ///set screen y-position, parameter as int + virtual void setYPos(const int& ypos); + ///set screen x-position, parameter as uint8_t, percent x value related to current width of parent form or screen virtual void setXPosP(const uint8_t& xpos_percent); ///set screen y-position, parameter as uint8_t, percent y value related to current height of parent form or screen diff --git a/src/gui/components/cc_item_picture.cpp b/src/gui/components/cc_item_picture.cpp index 1870092af..4bcbc14a1 100644 --- a/src/gui/components/cc_item_picture.cpp +++ b/src/gui/components/cc_item_picture.cpp @@ -74,8 +74,8 @@ void CComponentsPicture::init( const int &x_pos, const int &y_pos, const int &w, //CComponents x = x_old = x_pos; y = y_old = y_pos; - width = dx = dxc = w; - height = dy = dyc = h; + width = width_old = dx = dxc = w; + height = height_old = dy = dyc = h; pic_name = pic_name_old = image_name; shadow = shadow_mode; shadow_w = OFFSET_SHADOW; @@ -148,6 +148,24 @@ void CComponentsPicture::setHeight(const int& h, bool keep_aspect) initCCItem(); } +void CComponentsPicture::setXPos(const int& xpos) +{ + CComponentsItem::setXPos(xpos); + if (xpos == x) + return; + need_init = true; + initCCItem(); +} + +void CComponentsPicture::setYPos(const int& ypos) +{ + CComponentsItem::setYPos(ypos); + if (ypos == y) + return; + need_init = true; + initCCItem(); +} + void CComponentsPicture::initCCItem() { if (pic_name.empty() || !need_init){ @@ -385,6 +403,7 @@ CComponentsChannelLogo::CComponentsChannelLogo( const int &x_pos, const int &y_p void CComponentsChannelLogo::init(const uint64_t& channelId, const std::string& channelName, bool allow_scale) { + cc_item_type = CC_ITEMTYPE_CHANNEL_LOGO; channel_name = ""; channel_id = 0; alt_pic_name = ""; @@ -415,6 +434,8 @@ void CComponentsChannelLogo::setAltLogo(const char* picture_name) void CComponentsChannelLogo::setChannel(const uint64_t& channelId, const std::string& channelName) { need_init = true; + string image = pic_name; + if (channelId || !channelName.empty()){ if ((channel_id == channelId) && (channel_name == channelName)) need_init = false; @@ -425,16 +446,16 @@ void CComponentsChannelLogo::setChannel(const uint64_t& channelId, const std::st int dummy; - has_logo = g_PicViewer->GetLogoName(channel_id, channel_name, pic_name, &dummy, &dummy); + has_logo = g_PicViewer->GetLogoName(channel_id, channel_name, image, &dummy, &dummy); if (!has_logo)//no logo was found, use altrenate icon or logo - pic_name = alt_pic_name; + image = alt_pic_name; //if logo or alternate image still not available, set has logo to false - has_logo = !pic_name.empty(); + has_logo = !image.empty(); //refresh object - initCCItem(); + setPicture(image); //set has_logo to false if no dimensions were detected if (width && height) diff --git a/src/gui/components/cc_item_picture.h b/src/gui/components/cc_item_picture.h index 0781b446e..7bf8953d0 100644 --- a/src/gui/components/cc_item_picture.h +++ b/src/gui/components/cc_item_picture.h @@ -162,6 +162,11 @@ class CComponentsPicture : public CComponentsItem ///set height of object and image related to current screen size, see also CComponentsItem::setHeightP(), parameter as uint8_t virtual void setHeightP(const uint8_t& h_percent){CComponentsItem::setHeightP(h_percent), do_scale = true; need_init = hasChanges(); initCCItem();} + ///set screen x-position, parameter as int + virtual void setXPos(const int& xpos); + ///set screen y-position, parameter as int + virtual void setYPos(const int& ypos); + ///return paint mode of internal image, true=image was painted, please do not to confuse with isPainted()! isPainted() is related to item itself. virtual inline bool isPicPainted(){return is_image_painted;}; diff --git a/src/gui/components/cc_timer.cpp b/src/gui/components/cc_timer.cpp index a7b7e13ca..ab6523840 100644 --- a/src/gui/components/cc_timer.cpp +++ b/src/gui/components/cc_timer.cpp @@ -64,7 +64,7 @@ void CComponentsTimer::runSharedTimerAction() tm_mutex.lock(); OnTimer(); if (!tm_enable_nano) - mySleep(tm_interval); + sleep(tm_interval); else usleep((useconds_t)tm_interval); tm_mutex.unlock(); diff --git a/src/gui/components/cc_types.h b/src/gui/components/cc_types.h index 2f7643331..c023742a7 100644 --- a/src/gui/components/cc_types.h +++ b/src/gui/components/cc_types.h @@ -41,6 +41,7 @@ typedef enum CC_ITEMTYPE_GENERIC, CC_ITEMTYPE_ITEM, CC_ITEMTYPE_PICTURE, + CC_ITEMTYPE_CHANNEL_LOGO, CC_ITEMTYPE_TEXT, CC_ITEMTYPE_TEXT_INFOBOX, CC_ITEMTYPE_SHAPE_SQUARE, diff --git a/src/gui/epgplus.cpp b/src/gui/epgplus.cpp index 66be1d059..de34c6063 100644 --- a/src/gui/epgplus.cpp +++ b/src/gui/epgplus.cpp @@ -803,6 +803,8 @@ void EpgPlus::init() this->usableScreenHeight = headerHeight + timeLineHeight + this->bodyHeight + buttonHeight + OFFSET_INTER + footerHeight; // recalc deltaY this->usableScreenX = getScreenStartX(this->usableScreenWidth); + if (this->usableScreenX < DETAILSLINE_WIDTH) + this->usableScreenX = DETAILSLINE_WIDTH; this->usableScreenY = getScreenStartY(this->usableScreenHeight); this->headerX = this->usableScreenX; diff --git a/src/gui/eventlist.cpp b/src/gui/eventlist.cpp index 315acf576..f8209f6d5 100644 --- a/src/gui/eventlist.cpp +++ b/src/gui/eventlist.cpp @@ -300,7 +300,7 @@ int CEventList::exec(const t_channel_id channel_id, const std::string& channelna // init right info_zone if ((g_settings.eventlist_additional) && (cc_infozone == NULL)) - cc_infozone = new CComponentsText(x+width+10, y+theight, infozone_width-20, listmaxshow*fheight); + cc_infozone = new CComponentsText(x+width+OFFSET_INNER_MID, y+theight, infozone_width-2*OFFSET_INNER_MID, listmaxshow*fheight); int res = menu_return::RETURN_REPAINT; //printf("CEventList::exec: channel_id %llx\n", channel_id); diff --git a/src/gui/osd_setup.cpp b/src/gui/osd_setup.cpp index 2553cf0c2..c8bb2e6ed 100644 --- a/src/gui/osd_setup.cpp +++ b/src/gui/osd_setup.cpp @@ -199,7 +199,7 @@ font_sizes_struct neutrino_font[SNeutrinoSettings::FONT_TYPE_COUNT] = {LOCALE_FONTSIZE_EPG_INFO1 , 17, CNeutrinoFonts::FONT_STYLE_ITALIC , 2}, {LOCALE_FONTSIZE_EPG_INFO2 , 17, CNeutrinoFonts::FONT_STYLE_REGULAR, 2}, {LOCALE_FONTSIZE_EPG_DATE , 15, CNeutrinoFonts::FONT_STYLE_REGULAR, 2}, - {LOCALE_FONTSIZE_EPGPLUS_ITEM , 18, CNeutrinoFonts::FONT_STYLE_REGULAR, 2}, + {LOCALE_FONTSIZE_EPGPLUS_ITEM , 17, CNeutrinoFonts::FONT_STYLE_REGULAR, 2}, {LOCALE_FONTSIZE_EVENTLIST_TITLE , 30, CNeutrinoFonts::FONT_STYLE_REGULAR, 0}, {LOCALE_FONTSIZE_EVENTLIST_ITEMLARGE, 20, CNeutrinoFonts::FONT_STYLE_BOLD , 1}, {LOCALE_FONTSIZE_EVENTLIST_ITEMSMALL, 14, CNeutrinoFonts::FONT_STYLE_REGULAR, 1}, diff --git a/src/system/settings.h b/src/system/settings.h index 2458bb6ff..16124f4fc 100644 --- a/src/system/settings.h +++ b/src/system/settings.h @@ -929,7 +929,7 @@ const time_settings_struct_t timing_setting[SNeutrinoSettings::TIMING_SETTING_CO #define OFFSET_INNER_MIN CFrameBuffer::getInstance()->scale2Res(2) #define OFFSET_INNER_NONE 0 -#define SCROLLBAR_WIDTH OFFSET_INNER_MID + 2*OFFSET_INNER_MIN +#define SCROLLBAR_WIDTH (OFFSET_INNER_MID + 2*OFFSET_INNER_MIN) #define DETAILSLINE_WIDTH CFrameBuffer::getInstance()->scale2Res(16)