diff --git a/src/gui/channellist.cpp b/src/gui/channellist.cpp index cb1bef808..7a48d4bc7 100644 --- a/src/gui/channellist.cpp +++ b/src/gui/channellist.cpp @@ -1711,6 +1711,7 @@ void CChannelList::showChannelLogo() //TODO: move into an own handler, eg. heade return; if(g_settings.channellist_show_channellogo){ int logo_w_max = full_width / 4; + int logo_h_max = theight - 2*OFFSET_INNER_MIN; if (CChannelLogo) { if (headerNew) CChannelLogo->clearSavedScreen(); @@ -1722,8 +1723,8 @@ void CChannelList::showChannelLogo() //TODO: move into an own handler, eg. heade if (CChannelLogo->hasLogo()){ CChannelLogo->setWidth(min(CChannelLogo->getWidth(), logo_w_max), true); - if (CChannelLogo->getHeight() > theight) //scale image if required - CChannelLogo->setHeight(theight, true); + if (CChannelLogo->getHeight() > logo_h_max) + CChannelLogo->setHeight(logo_h_max, true); CChannelLogo->setXPos(x + full_width - logo_off - CChannelLogo->getWidth()); CChannelLogo->setYPos(y + (theight - CChannelLogo->getHeight()) / 2); CChannelLogo->paint(); diff --git a/src/gui/epgview.cpp b/src/gui/epgview.cpp index 44f75cade..40bb80ade 100644 --- a/src/gui/epgview.cpp +++ b/src/gui/epgview.cpp @@ -199,7 +199,7 @@ void CEpgData::processTextToArray(std::string text, int screening, bool has_cove // check the wordwidth - add to this line if size ok int aktWordWidth = g_Font[SNeutrinoSettings::FONT_TYPE_EPG_INFO2]->getRenderWidth(aktWord); - if ((aktWordWidth+aktWidth)<(ox - 20 - 15 - (has_cover? ((ox/4)+10) :0))) + if ((aktWordWidth+aktWidth)<(ox - 2*OFFSET_INNER_MID - 15 - (has_cover ? ((ox/4)+OFFSET_INNER_MID) : 0))) {//space ok, add aktWidth += aktWordWidth; aktLine += aktWord; @@ -242,7 +242,7 @@ void CEpgData::showText(int startPos, int ypos, bool has_cover, bool fullClear) std::string cover = "/tmp/tmdb.jpg"; //todo: maybe add a getCover()-function to tmdb class int cover_max_width = ox/4; //25% - int cover_max_height = sb-(2*10); + int cover_max_height = sb-(2*OFFSET_INNER_MID); int cover_width = 0; int cover_height = 0; int cover_offset = 0; @@ -257,7 +257,7 @@ void CEpgData::showText(int startPos, int ypos, bool has_cover, bool fullClear) if (cover_width && cover_height) { g_PicViewer->rescaleImageDimensions(&cover_width, &cover_height, cover_max_width, cover_max_height); - cover_offset = cover_width + 10; + cover_offset = cover_width + OFFSET_INNER_MID; } } @@ -278,7 +278,7 @@ void CEpgData::showText(int startPos, int ypos, bool has_cover, bool fullClear) frameBuffer->paintBoxRel(sx+offs, y, ox-15-offs, sb, COL_MENUCONTENT_PLUS_0); // background of the text box if (has_cover) { - if (!g_PicViewer->DisplayImage(cover ,sx+10 ,y+10, cover_width, cover_height, CFrameBuffer::TM_NONE)) { //NI + if (!g_PicViewer->DisplayImage(cover ,sx+OFFSET_INNER_MID ,y+OFFSET_INNER_MID, cover_width, cover_height, CFrameBuffer::TM_NONE)) { //NI cover_offset = 0; frameBuffer->paintBoxRel(sx, y, ox-15, sb, COL_MENUCONTENT_PLUS_0); // background of the text box } @@ -289,8 +289,8 @@ void CEpgData::showText(int startPos, int ypos, bool has_cover, bool fullClear) if (tmdb_active && startPos == 0) { frameBuffer->getIconSize(NEUTRINO_ICON_TMDB, &icon_w, &icon_h); - frameBuffer->paintIcon(NEUTRINO_ICON_TMDB, sx+10+cover_offset, y+(medlineheight-icon_h)/2); - logo_offset = icon_w + 10; + frameBuffer->paintIcon(NEUTRINO_ICON_TMDB, sx+OFFSET_INNER_MID+cover_offset, y+(medlineheight-icon_h)/2); + logo_offset = icon_w + OFFSET_INNER_MID; } //NI if (imdb_active && startPos == 0) @@ -348,7 +348,7 @@ void CEpgData::showText(int startPos, int ypos, bool has_cover, bool fullClear) offset += digi; break; } - g_Font[SNeutrinoSettings::FONT_TYPE_EPG_INFO2]->RenderString(sx+10+offset, y+medlineheight, ox- 15- 15, epgText[i].first.substr(pos1, pos2 - pos1), (epgText[i].second==2)? COL_MENUCONTENTINACTIVE_TEXT: COL_MENUCONTENT_TEXT); + g_Font[SNeutrinoSettings::FONT_TYPE_EPG_INFO2]->RenderString(sx+OFFSET_INNER_MID+offset, y+medlineheight, ox- 15- 15, epgText[i].first.substr(pos1, pos2 - pos1), (epgText[i].second==2)? COL_MENUCONTENTINACTIVE_TEXT: COL_MENUCONTENT_TEXT); count++; pos1 = epgText[i].first.find_first_not_of(tok, pos2); pos2 = epgText[i].first.find_first_of(tok, pos1); @@ -357,7 +357,7 @@ void CEpgData::showText(int startPos, int ypos, bool has_cover, bool fullClear) count = 0; } else{ - g_Font[( i< info1_lines ) ?SNeutrinoSettings::FONT_TYPE_EPG_INFO1:SNeutrinoSettings::FONT_TYPE_EPG_INFO2]->RenderString(sx+10+cover_offset, y+medlineheight, ox-15-15-cover_offset, epgText[i].first, COL_MENUCONTENT_TEXT); + g_Font[( i< info1_lines ) ?SNeutrinoSettings::FONT_TYPE_EPG_INFO1:SNeutrinoSettings::FONT_TYPE_EPG_INFO2]->RenderString(sx+OFFSET_INNER_MID+cover_offset, y+medlineheight, ox-15-15-cover_offset, epgText[i].first, COL_MENUCONTENT_TEXT); } } @@ -748,12 +748,17 @@ int CEpgData::show(const t_channel_id channel_id, uint64_t a_id, time_t* a_start hide(); return res; } + + 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; @@ -761,36 +766,31 @@ int CEpgData::show(const t_channel_id channel_id, uint64_t a_id, time_t* a_start 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 > (toph-4)) || (logo_w > logo_w_max)) - g_PicViewer->rescaleImageDimensions(&logo_w, &logo_h, logo_w_max, toph-4); - pic_offx = logo_w + 10; + 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 - 18) + 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 - 18)); + } 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) ); } - const int pic_h = 39; - if(!topboxheight) + if (!topboxheight) start(); if (!text2.empty()) toph = 2 * topboxheight; - else - toph = topboxheight; - - toph = std::max(toph, pic_h); sb = oy - toph - botboxheight; @@ -922,11 +922,11 @@ int CEpgData::show(const t_channel_id channel_id, uint64_t a_id, time_t* a_start CComponentsPicture* headerPic = NULL; //NOTE: class CComponentsChannelLogo is preferred for channel logos if (pic_offx > 0) { - headerPic = new CComponentsPicture(sx+10, sy + (header_h-logo_h)/2, logo_w, logo_h, lname); + 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+15+pic_offx, sy, ox-15-pic_offx, header_h, textAll, CTextBox::NO_AUTO_LINEBREAK, g_Font[SNeutrinoSettings::FONT_TYPE_EPG_TITLE]); + 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->paint(CC_SAVE_SCREEN_NO); @@ -946,23 +946,23 @@ int CEpgData::show(const t_channel_id channel_id, uint64_t a_id, time_t* a_start if (!iw && !ih) frameBuffer->getIconSize(NEUTRINO_ICON_BUTTON_LEFT, &iw, &ih); if (!io && iw) - io = iw + 10; + io = iw + OFFSET_INNER_MID; 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+10+io, sy+oy-3, widthl, fromto, COL_MENUHEAD_TEXT); + 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-10-io-widthr, sy+oy-3, widthr, epg_date, COL_MENUHEAD_TEXT); + g_Font[SNeutrinoSettings::FONT_TYPE_EPG_DATE]->RenderString(sx+ox-OFFSET_INNER_MID-io-widthr, sy+oy-3, widthr, epg_date, COL_MENUHEAD_TEXT); 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 + 10, iy); + frameBuffer->paintIcon(NEUTRINO_ICON_BUTTON_LEFT, sx + OFFSET_INNER_MID, iy); if (next_id) - frameBuffer->paintIcon(NEUTRINO_ICON_BUTTON_RIGHT, sx + ox - iw - 10, iy); + frameBuffer->paintIcon(NEUTRINO_ICON_BUTTON_RIGHT, sx + ox - iw - OFFSET_INNER_MID, iy); } } showProgressBar(); diff --git a/src/gui/eventlist.cpp b/src/gui/eventlist.cpp index 252d71125..c2bb70512 100644 --- a/src/gui/eventlist.cpp +++ b/src/gui/eventlist.cpp @@ -863,28 +863,23 @@ void CEventList::paintHead(t_channel_id _channel_id, std::string _channelname, s } header->clear(); - int x_off = 10; + 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()) { - //if logo object has found a logo and was ititialized, the hand it's size - int w_logo = midLogo->getWidth(); + if (midLogo->hasLogo()) + { + midLogo->setWidth(min(midLogo->getWidth(), mid_width), true); + if (midLogo->getHeight() > max_height) + midLogo->setHeight(max_height, true); - //scale image if required, TODO: move into an own handler, eg. header, so channel logo should be paint in header object - int h_logo = midLogo->getHeight(); - if (h_logo > theight){ - uint8_t h_ratio = uint8_t(theight*100/h_logo); - midLogo->setHeight(theight); - w_logo = h_ratio*w_logo/100; - midLogo->setWidth(w_logo); - } midLogo->setPos(CC_CENTERED, CC_CENTERED); // recalc widths - side_width = ((full_width - w_logo) / 2) - (4 * x_off); + side_width = ((full_width - midLogo->getWidth()) / 2) - (4 * x_off); } else { header->removeCCItem(midLogo); //remove/destroy logo object, if it is not available diff --git a/src/gui/infoviewer.cpp b/src/gui/infoviewer.cpp index f1ac828a6..0213edc64 100644 --- a/src/gui/infoviewer.cpp +++ b/src/gui/infoviewer.cpp @@ -2347,7 +2347,7 @@ int CInfoViewer::showChannelLogo(const t_channel_id logo_channel_id, const int c else if (g_settings.infobar_show_channellogo == 2 || g_settings.infobar_show_channellogo == 5 || g_settings.infobar_show_channellogo == 6) // paint logo in place of channel name { // check logo dimensions - g_PicViewer->rescaleImageDimensions(&logo_w, &logo_h, chan_w, header_height); + g_PicViewer->rescaleImageDimensions(&logo_w, &logo_h, chan_w, header_height - 2*OFFSET_INNER_MIN); // hide channel name // this is too ugly... ChannelName = ""; // calculate logo position @@ -2363,7 +2363,7 @@ int CInfoViewer::showChannelLogo(const t_channel_id logo_channel_id, const int c { // check logo dimensions int Logo_max_width = chan_w - logo_w - 10; - g_PicViewer->rescaleImageDimensions(&logo_w, &logo_h, Logo_max_width, header_height); + g_PicViewer->rescaleImageDimensions(&logo_w, &logo_h, Logo_max_width, header_height - 2*OFFSET_INNER_MIN); // calculate logo position y_mid = ChanNameY + header_height / 2; logo_x = start_x + 10; diff --git a/src/gui/moviebrowser/mb.cpp b/src/gui/moviebrowser/mb.cpp index 55451e71f..828732685 100644 --- a/src/gui/moviebrowser/mb.cpp +++ b/src/gui/moviebrowser/mb.cpp @@ -1404,13 +1404,10 @@ void CMovieBrowser::refreshChannelLogo(void) if (m_channelLogo && m_channelLogo->hasLogo()) { - // scale image if required, TODO: move into an own handler, eg. header, so channel logo should be paint in header object - int h_logo = m_channelLogo->getHeight(); - if (h_logo > h_logo_max) - { - m_channelLogo->setWidth(0); // force recalculation + // TODO: move into an own handler, eg. header, so channel logo should be paint in header object + m_channelLogo->setWidth(min(m_channelLogo->getWidth(), w_logo_max), true); + if (m_channelLogo->getHeight() > h_logo_max) m_channelLogo->setHeight(h_logo_max, true); - } int x = m_cBoxFrame.iX + m_cBoxFrameTitleRel.iX + m_cBoxFrameTitleRel.iWidth - m_channelLogo->getWidth() - OFFSET_INNER_MID; int y = m_cBoxFrame.iY + m_cBoxFrameTitleRel.iY + (m_cBoxFrameTitleRel.iHeight - m_channelLogo->getHeight())/2;