diff --git a/configure.ac b/configure.ac index ab488b2b4..e8b6309e9 100644 --- a/configure.ac +++ b/configure.ac @@ -99,6 +99,18 @@ AM_CONDITIONAL(USE_TREMOR, test "$TREMOR" = "yes") # TUXBOX_APPS_LIB_PKGCONFIG(OPENSSL,openssl) TUXBOX_APPS_LIB_PKGCONFIG(CURL,libcurl) TUXBOX_APPS_LIB_PKGCONFIG(FREETYPE,freetype2) +AC_MSG_CHECKING([whether FreeType version is 2.5.0 or higher]) + AC_TRY_CPP([ + #include + #include FT_FREETYPE_H + #if FREETYPE_MAJOR < 2 || (FREETYPE_MAJOR == 2 && FREETYPE_MINOR < 5) + #error Freetype version too low. + #endif + ], + [AC_MSG_RESULT(yes)], + [AC_MSG_ERROR([Need FreeType library version 2.5.0 or higher]) + ]) + # fallback to curl-config (which is ugly for cross-compilation) if test -z "$CURL_LIBS" -a -z "$CURL_CFLAGS"; then TUXBOX_APPS_LIB_CONFIG(CURL,curl-config) diff --git a/data/locale/deutsch.locale b/data/locale/deutsch.locale index 31be562a0..35efe21fa 100644 --- a/data/locale/deutsch.locale +++ b/data/locale/deutsch.locale @@ -348,7 +348,6 @@ colormenu.advanced_mode_off Standard-Optionen colormenu.advanced_mode_on Erweiterte Optionen colormenu.background Hintergrundfarbe colormenu.clock_textcolor Ziffernfarbe -colormenu.contrast_fonts Schriftkontrast colormenu.fade Ein-/Ausblenden colormenu.font Verwendete Schriftart colormenu.font_ttx Teletext Schriftart @@ -1142,7 +1141,6 @@ menu.hint_colored_events_textcolor Ändern Sie die Farbe für farbige Events in menu.hint_colors Konfigurieren Sie die Menü-Farben menu.hint_content_back Ändern Sie die Hintergrundfarbe für den Fensterinhalt menu.hint_content_textcolor Ändern Sie die Textfarbe für den Fensterinhalt -menu.hint_contrast_fonts Wählen Sie einen höheren Schriftkontrast menu.hint_dboxinfo Informationen über CPU und Arbeitsspeicher der Box menu.hint_delete_channels Löschen aller Kanäle menu.hint_delete_removed Lösche das Bouquet 'Gelöschte Kanäle' diff --git a/data/locale/english.locale b/data/locale/english.locale index 5f1d7d239..f7dabc42b 100644 --- a/data/locale/english.locale +++ b/data/locale/english.locale @@ -348,7 +348,6 @@ colormenu.advanced_mode_off Default options colormenu.advanced_mode_on Advanced options colormenu.background Background colormenu.clock_textcolor Digit color -colormenu.contrast_fonts Contrast fonts colormenu.fade Fade GUI colormenu.font Select GUI font colormenu.font_ttx Select Teletext font @@ -1142,7 +1141,6 @@ menu.hint_colored_events_textcolor Change color for colored events in channellis menu.hint_colors Configure GUI colors menu.hint_content_back Change GUI window background color menu.hint_content_textcolor Change GUI window text color -menu.hint_contrast_fonts Make fonts contrast (do not blend with background) menu.hint_dboxinfo Information about box cpu and storage menu.hint_delete_channels Remove all channels menu.hint_delete_removed Delete the channels in the 'Removed channels' boquet diff --git a/data/locale/nederlands.locale b/data/locale/nederlands.locale index b4c78e9e0..1ec45b998 100644 --- a/data/locale/nederlands.locale +++ b/data/locale/nederlands.locale @@ -289,7 +289,6 @@ colormenu.advanced_mode_off Toon standaard opties colormenu.advanced_mode_on Toon geavanceerde zoekopties colormenu.background Achtergrond colormenu.clock_textcolor Digit kleur -colormenu.contrast_fonts Contrast lettertype colormenu.fade Menu's vervagen colormenu.font Selecteer lettertype gebruikersinterface colormenu.font_ttx Selecteer lettertype teletekst @@ -953,7 +952,6 @@ menu.hint_colored_events_textcolor Wijzig programma kleur voor gekleurde program menu.hint_colors Configureer GUI-kleuren menu.hint_content_back Wijzig venster achtergrond kleur menu.hint_content_textcolor Wijzig venster tekst kleur -menu.hint_contrast_fonts Lettertype contrast (Niet overgaan in achtergrond) menu.hint_dboxinfo Informatie over STB CPU en opslag menu.hint_delete_channels Verplaats alle kanalen menu.hint_delete_removed Verwijder de zenders in de 'Verwijderde zenders' bouquet diff --git a/data/locale/slovak.locale b/data/locale/slovak.locale index c292260db..3ae068e32 100644 --- a/data/locale/slovak.locale +++ b/data/locale/slovak.locale @@ -319,7 +319,6 @@ colormenu.advanced_mode_off Predvolené hodnoty colormenu.advanced_mode_on Rozšírené voľby colormenu.background Pozadie colormenu.clock_textcolor Farba číslic -colormenu.contrast_fonts Kontrast písma colormenu.fade Miznúce menu colormenu.font Výber písma colormenu.font_ttx Výber teletextového písma @@ -1030,7 +1029,6 @@ menu.hint_colored_events_textcolor Zmena farby pre farebné udalosti v zozname k menu.hint_colors Konfigurácia farieb GUI menu.hint_content_back Zmena farby podkladu GUI okna menu.hint_content_textcolor Zmena farby textu GUI okna -menu.hint_contrast_fonts Zvýraznenie kontrastu pisma (neúčinné pri podklade) menu.hint_dboxinfo Informácia o procesore a úložisku menu.hint_delete_channels Odstránenie všetkých kanálov menu.hint_delete_removed Vymazanie kanálov v bukete "Odstránené kanaly" diff --git a/data/locale/unmaintained/czech.locale b/data/locale/unmaintained/czech.locale index e2858c8cf..c4d0063c4 100644 --- a/data/locale/unmaintained/czech.locale +++ b/data/locale/unmaintained/czech.locale @@ -281,7 +281,6 @@ colorchooser.green Zelený colorchooser.red Červený colormenu.background Pozadí colormenu.clock_textcolor Barva číslic -colormenu.contrast_fonts Kontrast písma colormenu.fade Mizící menu colormenu.font Výběr písma colormenu.font_ttx Výběr teletextového písma @@ -946,7 +945,6 @@ menu.hint_color_gradient Přepne barevné přechody pro různé položky nabídk menu.hint_colors Konfigurace barev GUI menu.hint_content_back Změna barvy podkladu GUI okna menu.hint_content_textcolor Změna barvy textu GUI okna -menu.hint_contrast_fonts Zvýraznění kontrastu pisma (neúčinné u podkladu) menu.hint_dboxinfo Informace o procesoru a úložišti menu.hint_delete_channels Odstranění všech kanálů menu.hint_delete_removed Vymazání kanálů v buketu "Odstraněné kanály" diff --git a/data/locale/unmaintained/polski.locale b/data/locale/unmaintained/polski.locale index 305a5b2e1..75b427936 100644 --- a/data/locale/unmaintained/polski.locale +++ b/data/locale/unmaintained/polski.locale @@ -281,7 +281,6 @@ colorchooser.green Zielony colorchooser.red Czerwony colormenu.background Kolor tła colormenu.clock_textcolor Kolor zegara -colormenu.contrast_fonts Kontrast fontów colormenu.fade Zanikanie menu colormenu.font Font OSD colormenu.font_ttx Font teletekstu @@ -946,7 +945,6 @@ menu.hint_color_gradient Switches color gradients for various menu items on/off menu.hint_colors Configure GUI colors menu.hint_content_back Change GUI window background color menu.hint_content_textcolor Change GUI window text color -menu.hint_contrast_fonts Make fonts contrast (do not blend with background) menu.hint_dboxinfo Information about box cpu and storage menu.hint_delete_channels Remove all channels menu.hint_delete_removed Delete the channels in the 'Removed channels' boquet diff --git a/data/y-web/Makefile.am b/data/y-web/Makefile.am index 24bba6cf7..32b1c93ed 100644 --- a/data/y-web/Makefile.am +++ b/data/y-web/Makefile.am @@ -130,6 +130,8 @@ install-data-hook: -e 's|%(PLUGINDIR)|$(PLUGINDIR)|g' \ -e 's|%(PLUGINDIR_VAR)|$(PLUGINDIR_VAR)|g' \ -e 's|%(PLUGINDIR_MNT)|$(PLUGINDIR_MNT)|g' \ + -e 's|%(WEBTVDIR)|$(WEBTVDIR)|g' \ + -e 's|%(WEBTVDIR_VAR)|$(WEBTVDIR_VAR)|g' \ -e 's|%(PRIVATE_HTTPDDIR)|$(PRIVATE_HTTPDDIR)|g' \ -e 's|%(PUBLIC_HTTPDDIR)|$(PUBLIC_HTTPDDIR)|g' \ ; diff --git a/src/driver/fontrenderer.cpp b/src/driver/fontrenderer.cpp index 6592154d6..36f4b1736 100644 --- a/src/driver/fontrenderer.cpp +++ b/src/driver/fontrenderer.cpp @@ -3,6 +3,7 @@ Copyright (C) 2001 Steffen Hehn 'McClean' Copyright (C) 2003 thegoodguy + Copyright (C) 2013-2017 M. Liebmann (micha-bbg) License: GPL @@ -240,6 +241,9 @@ Font::Font(FBFontRenderClass *render, FTC_FaceID faceid, const int isize, const scaler.y_res = render->yres; setSize(isize); + fg_red = 0, fg_green = 0, fg_blue = 0; + memset((void*)colors, '\0', sizeof(colors)); + useFullBG = false; } FT_Error Font::getGlyphBitmap(FT_ULong glyph_index, FTC_SBit *sbit) @@ -383,43 +387,56 @@ int UTF8ToUnicode(const char * &text, const bool utf8_encoded) // returns -1 on return unicode_value; } -#define F_MUL 0x7FFF - -void Font::paintFontPixel(fb_pixel_t *td, uint8_t fg_red, uint8_t fg_green, uint8_t fg_blue, int faktor, uint8_t index) +void Font::paintFontPixel(fb_pixel_t *td, uint8_t src) { - fb_pixel_t bg_col = *td; - if (bg_col == (fb_pixel_t)0) - bg_col = 0xE0808080; - uint8_t bg_trans = (bg_col & 0xFF000000) >> 24; - int korr_r = ((bg_col & 0x00FF0000) >> 16) - fg_red; - int korr_g = ((bg_col & 0x0000FF00) >> 8) - fg_green; - int korr_b = (bg_col & 0x000000FF) - fg_blue; - - *td = ((g_settings.contrast_fonts && (index > 128)) ? 0xFF000000 : (((bg_trans == 0) ? 0xFF : bg_trans) << 24) & 0xFF000000) | - (((fg_red + ((korr_r*faktor)/F_MUL)) << 16) & 0x00FF0000) | - (((fg_green + ((korr_g*faktor)/F_MUL)) << 8) & 0x0000FF00) | - ((fg_blue + ((korr_b*faktor)/F_MUL)) & 0x000000FF); +#define DST_BLUE 0x80 +#define DST_GREEN 0x80 +#define DST_RED 0x80 +#define DST_TRANS 0x80 + if (useFullBG) { + uint8_t *dst = (uint8_t *)td; + if (*td == (fb_pixel_t)0) { + *dst = DST_BLUE + ((fg_blue - DST_BLUE) * src) / 256; + dst++; + *dst = DST_GREEN + ((fg_green - DST_GREEN) * src) / 256; + dst++; + *dst = DST_RED + ((fg_red - DST_RED) * src) / 256; + dst++; + *dst = (uint8_t)int_min(255, DST_TRANS + src); + } + else { + *dst = *dst + ((fg_blue - *dst) * src) / 256; + dst++; + *dst = *dst + ((fg_green - *dst) * src) / 256; + dst++; + *dst = *dst + ((fg_red - *dst) * src) / 256; + dst++; + *dst = (uint8_t)int_min(0xFF, *dst + src); + } + } + else + *td = colors[src]; } void Font::RenderString(int x, int y, const int width, const char *text, const fb_pixel_t color, const int boxheight, const unsigned int flags) { - const bool utf8_encoded = flags & IS_UTF8; - const bool useFullBg = flags & FULLBG; -/* - useFullBg (default = false) - - useFullBg = false - fetch bgcolor from framebuffer, using lower left edge of the font - - useFullBg = true - fetch bgcolor from framebuffer, using the respective real font position - - font rendering slower - - e.g. required for font rendering on images -*/ - if (!frameBuffer->getActive()) return; + const bool utf8_encoded = flags & IS_UTF8; + useFullBG = flags & FULLBG; +/* + useFullBg = false + fetch bgcolor from framebuffer, using lower left edge of the font + - default render mode + - font rendering faster + + useFullBg = true + fetch bgcolor from framebuffer, using the respective real fontpixel position + - better quality at font rendering on images or background with color gradient + - font rendering slower +*/ + frameBuffer->checkFbArea(x, y-height, width, height, true); pthread_mutex_lock( &renderer->render_mutex ); @@ -477,56 +494,34 @@ void Font::RenderString(int x, int y, const int width, const char *text, const f int lastindex=0; // 0 == missing glyph (never has kerning values) FT_Vector kerning; - int pen1=-1; // "pen" positions for kerning, pen2 is "x" - static fb_pixel_t old_bgcolor = 0, old_fgcolor = 0; - static uint8_t bg_trans = 0, fg_red = 0, fg_green = 0, fg_blue = 0; - static bool olduseFullBg = false; - static fb_pixel_t colors[256] = {0}; - static int faktor[256] = {0}; - static bool fontRecsInit = false; - fb_pixel_t bg_color = 1; - fb_pixel_t fg_color = color; + int pen1 = -1; // "pen" positions for kerning, pen2 is "x" - if (!useFullBg) { - /* the GXA seems to do it's job asynchonously, so we need to wait until - it's ready, otherwise the font will sometimes "be overwritten" with - background color or bgcolor will be wrong */ - frameBuffer->waitForIdle("Font::RenderString 1"); + fg_red = (color & 0x00FF0000) >> 16; + fg_green = (color & 0x0000FF00) >> 8; + fg_blue = color & 0x000000FF; + fb_pixel_t bg_color = 0; + + /* the GXA seems to do it's job asynchonously, so we need to wait until + it's ready, otherwise the font will sometimes "be overwritten" with + background color or bgcolor will be wrong */ + frameBuffer->waitForIdle("Font::RenderString 1"); + if (!useFullBG) { /* fetch bgcolor from framebuffer, using lower left edge of the font... */ bg_color = *(frameBuffer->getFrameBufferPointer() + x + y * frameBuffer->getStride() / sizeof(fb_pixel_t)); - } - else - bg_color = 0; - if ((old_fgcolor != fg_color) || (old_bgcolor != bg_color) || (olduseFullBg != useFullBg) || !fontRecsInit) { - old_bgcolor = bg_color; - old_fgcolor = fg_color; - olduseFullBg = useFullBg; - fontRecsInit = true; + if (bg_color == (fb_pixel_t)0) + bg_color = 0x80808080; - bg_trans = (bg_color & 0xFF000000) >> 24; - fg_red = (fg_color & 0x00FF0000) >> 16; - fg_green = (fg_color & 0x0000FF00) >> 8; - fg_blue = fg_color & 0x000000FF; - - int korr_r=0, korr_g=0, korr_b=0; - if (!useFullBg) { - korr_r = ((bg_color & 0x00FF0000) >> 16) - fg_red; - korr_g = ((bg_color & 0x0000FF00) >> 8) - fg_green; - korr_b = (bg_color & 0x000000FF) - fg_blue; - } - - for (int i = 0; i <= 0xFF; i++) { - int _faktor = ((0xFF - i) * F_MUL) / 0xFF; - - if (useFullBg) - faktor[i] = _faktor; - else - colors[i] = ((g_settings.contrast_fonts && (i > 128)) ? 0xFF000000 : (((bg_trans == 0) ? 0xFF : bg_trans) << 24) & 0xFF000000) | - (((fg_red + ((korr_r*_faktor)/F_MUL)) << 16) & 0x00FF0000) | - (((fg_green + ((korr_g*_faktor)/F_MUL)) << 8) & 0x0000FF00) | - ((fg_blue + ((korr_b*_faktor)/F_MUL)) & 0x000000FF); + uint8_t bg_trans = (bg_color & 0xFF000000) >> 24; + uint8_t bg_red = (bg_color & 0x00FF0000) >> 16; + uint8_t bg_green = (bg_color & 0x0000FF00) >> 8; + uint8_t bg_blue = bg_color & 0x000000FF; + for (int i = 0; i < 256; i++) { + colors[i] = (((int_min(0xFF, bg_trans + i)) << 24) & 0xFF000000) | + (((bg_red +((fg_red -bg_red) * i)/256) << 16) & 0x00FF0000) | + (((bg_green+((fg_green-bg_green)* i)/256) << 8) & 0x0000FF00) | + ((bg_blue +((fg_blue -bg_blue) * i)/256) & 0x000000FF); } } @@ -596,12 +591,8 @@ void Font::RenderString(int x, int y, const int width, const char *text, const f for (ax = 0; ax < w + spread_by; ax++) { if (stylemodifier != Font::Embolden) { /* do not paint the backgroundcolor (*s = 0) */ - if(*s != 0) { - if (useFullBg) - paintFontPixel(td, fg_red, fg_green, fg_blue, faktor[*s], *s); - else - *td = colors[*s]; - } + if (*s != 0) + paintFontPixel(td, *s); } else { int lcolor = -1; @@ -611,12 +602,8 @@ void Font::RenderString(int x, int y, const int width, const char *text, const f if (lcolor < *(s - i)) lcolor = *(s - i); /* do not paint the backgroundcolor (lcolor = 0) */ - if(lcolor != 0) { - if (useFullBg) - paintFontPixel(td, fg_red, fg_green, fg_blue, faktor[lcolor], (uint8_t)lcolor); - else - *td = colors[lcolor]; - } + if (lcolor != 0) + paintFontPixel(td, (uint8_t)lcolor); } td++; s++; } diff --git a/src/driver/fontrenderer.h b/src/driver/fontrenderer.h index c061a7934..416ca6da1 100644 --- a/src/driver/fontrenderer.h +++ b/src/driver/fontrenderer.h @@ -3,6 +3,7 @@ Copyright (C) 2001 Steffen Hehn 'McClean' Copyright (C) 2003 thegoodguy + Copyright (C) 2013-2017 M. Liebmann (micha-bbg) License: GPL @@ -54,8 +55,12 @@ class Font int height,DigitHeight,DigitOffset,ascender,descender,upper,lower; int fontwidth; int maxdigitwidth; + uint8_t fg_red, fg_green, fg_blue; + fb_pixel_t colors[256]; + bool useFullBG; - inline void paintFontPixel(fb_pixel_t *td, uint8_t fg_red, uint8_t fg_green, uint8_t fg_blue, int faktor, uint8_t index); + inline int int_min(int a, int b) { return (a < b) ? a : b; } + inline void paintFontPixel(fb_pixel_t *td, uint8_t src); public: enum fontmodifier diff --git a/src/driver/pictureviewer/crw.cpp b/src/driver/pictureviewer/crw.cpp index 83a0c0532..be7c0783c 100644 --- a/src/driver/pictureviewer/crw.cpp +++ b/src/driver/pictureviewer/crw.cpp @@ -9,6 +9,9 @@ #include #include +#if __cplusplus >= 201103 +#include +#endif #include #include "pictureviewer.h" @@ -193,12 +196,21 @@ int fh_crw_load(const char *filename,unsigned char **buffer,int* xp,int* /*yp*/) ciptr->out_color_space=JCS_RGB; if(x==(int)ciptr->image_width) ciptr->scale_denom=1; +#if __cplusplus < 201103 else if(abs(x*2 - ciptr->image_width) < 2) ciptr->scale_denom=2; else if(abs(x*4 - ciptr->image_width) < 4) ciptr->scale_denom=4; else if(abs(x*8 - ciptr->image_width) < 8) ciptr->scale_denom=8; +#else + else if(std::abs(x*2 - ciptr->image_width) < 2) + ciptr->scale_denom=2; + else if(std::abs(x*4 - ciptr->image_width) < 4) + ciptr->scale_denom=4; + else if(std::abs(x*8 - ciptr->image_width) < 8) + ciptr->scale_denom=8; +#endif else ciptr->scale_denom=1; diff --git a/src/driver/pictureviewer/jpeg.cpp b/src/driver/pictureviewer/jpeg.cpp index 3d3898f86..95413f180 100644 --- a/src/driver/pictureviewer/jpeg.cpp +++ b/src/driver/pictureviewer/jpeg.cpp @@ -4,7 +4,7 @@ #include #include "pv_config.h" #ifdef FBV_SUPPORT_JPEG - + #include #include #include @@ -17,7 +17,10 @@ #include #include #include - + +#if __cplusplus >= 201103 +#include +#endif #include #include @@ -94,12 +97,21 @@ int fh_jpeg_load(const char *filename,unsigned char **buffer,int* x,int* y) ciptr->dct_method=JDCT_FASTEST; if(*x==(int)ciptr->image_width) ciptr->scale_denom=1; +#if __cplusplus < 201103 else if(abs(*x*2 - ciptr->image_width) < 2) ciptr->scale_denom=2; else if(abs(*x*4 - ciptr->image_width) < 4) ciptr->scale_denom=4; else if(abs(*x*8 - ciptr->image_width) < 8) ciptr->scale_denom=8; +#else + else if(std::abs(*x*2 - ciptr->image_width) < 2) + ciptr->scale_denom=2; + else if(std::abs(*x*4 - ciptr->image_width) < 4) + ciptr->scale_denom=4; + else if(std::abs(*x*8 - ciptr->image_width) < 8) + ciptr->scale_denom=8; +#endif else ciptr->scale_denom=1; diff --git a/src/driver/record.cpp b/src/driver/record.cpp index 4479999ef..80ec5a489 100644 --- a/src/driver/record.cpp +++ b/src/driver/record.cpp @@ -2176,7 +2176,7 @@ bool CStreamRec::Open(CZapitChannel * channel) return false; std::string pretty_name,headers; - if (!CMoviePlayerGui::getInstance(true).getLiveUrl(channel->getChannelID(), channel->getUrl(), channel->getScriptName(), url, pretty_name, recMovieInfo->epgInfo1, recMovieInfo->epgInfo2,headers)) { + if (!CMoviePlayerGui::getInstance(true).getLiveUrl(channel->getUrl(), channel->getScriptName(), url, pretty_name, recMovieInfo->epgInfo1, recMovieInfo->epgInfo2,headers)) { printf("%s: getLiveUrl() [%s] failed!\n", __FUNCTION__, url.c_str()); return false; } diff --git a/src/driver/streamts.cpp b/src/driver/streamts.cpp index 46745626b..175769d61 100644 --- a/src/driver/streamts.cpp +++ b/src/driver/streamts.cpp @@ -782,7 +782,7 @@ bool CStreamStream::Open() return false; std::string pretty_name, livestreamInfo1, livestreamInfo2, headers; - if (!CMoviePlayerGui::getInstance(true).getLiveUrl(channel->getChannelID(), channel->getUrl(), channel->getScriptName(), url, pretty_name, livestreamInfo1, livestreamInfo2,headers)) { + if (!CMoviePlayerGui::getInstance(true).getLiveUrl(channel->getUrl(), channel->getScriptName(), url, pretty_name, livestreamInfo1, livestreamInfo2,headers)) { printf("%s: getLiveUrl() [%s] failed!\n", __FUNCTION__, url.c_str()); return false; } diff --git a/src/driver/vfd.cpp b/src/driver/vfd.cpp index d5a410bb0..6bdc92e11 100644 --- a/src/driver/vfd.cpp +++ b/src/driver/vfd.cpp @@ -255,8 +255,8 @@ void CVFD::setBacklight(bool on_off) void CVFD::setled(bool on_off) { - if(g_settings.led_rec_mode == 0) - return; + if(g_settings.led_rec_mode == 0) + return; int led1 = -1, led2 = -1; if(on_off){//on diff --git a/src/gui/buildinfo.cpp b/src/gui/buildinfo.cpp index 448bd0077..2d31e834e 100644 --- a/src/gui/buildinfo.cpp +++ b/src/gui/buildinfo.cpp @@ -37,9 +37,13 @@ using namespace std; -CBuildInfo::CBuildInfo() : CComponentsWindow(0, 0, 700, 500, LOCALE_BUILDINFO_MENU, NEUTRINO_ICON_INFO) +CBuildInfo::CBuildInfo(bool show) : CComponentsWindow(0, 0, 700, 500, LOCALE_BUILDINFO_MENU, NEUTRINO_ICON_INFO) { initVarBuildInfo(); + if (show) + exec(NULL, ""); + else + InitInfoItems(); } //init all var members @@ -49,7 +53,6 @@ void CBuildInfo::initVarBuildInfo() font = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_HINT]; setWindowHeaderButtons(CComponentsHeader::CC_BTN_MENU | CComponentsHeader::CC_BTN_EXIT); - InitInfoItems(); shadow = true; @@ -62,7 +65,9 @@ int CBuildInfo::exec(CMenuTarget* parent, const string & /*actionKey*/) if (parent) parent->hide(); - + + InitInfoItems(); + //exit if no informations available if (!HasData()){ return res; diff --git a/src/gui/buildinfo.h b/src/gui/buildinfo.h index 3ef9377dc..154cba8bb 100644 --- a/src/gui/buildinfo.h +++ b/src/gui/buildinfo.h @@ -69,7 +69,7 @@ class CBuildInfo : public CMenuTarget, public CComponentsWindow BI_TYPE_IDS }; - CBuildInfo(); + CBuildInfo(bool show = false); ///assigns text Font type void setFontType(Font* font_text); diff --git a/src/gui/channellist.cpp b/src/gui/channellist.cpp index 27eddc44a..378cc7a0e 100644 --- a/src/gui/channellist.cpp +++ b/src/gui/channellist.cpp @@ -2200,7 +2200,9 @@ void CChannelList::paintHead() else logo_off = 10; - header->paint(CC_SAVE_SCREEN_NO); //TODO: paint title only, currently paint() does paint all enabled header items at once and causes flicker effects in unchanged items (e.g. clock) + if (header->isPainted()) //clean up background of header for new contents + header->kill(header->getColorBody(), -1, CC_FBDATA_TYPES, false); + header->paint0(); } CComponentsHeader* CChannelList::getHeaderObject() diff --git a/src/gui/components/cc_draw.cpp b/src/gui/components/cc_draw.cpp index 54acff507..b9035e8db 100644 --- a/src/gui/components/cc_draw.cpp +++ b/src/gui/components/cc_draw.cpp @@ -57,6 +57,7 @@ CCDraw::CCDraw() : COSDFader(g_settings.theme.menu_Content_alpha) cc_save_bg = false; firstPaint = true; is_painted = false; + force_paint_bg = false; paint_bg = true; cc_allow_paint = true; cc_enable_frame = true; @@ -546,7 +547,7 @@ void CCDraw::paintFbItems(bool do_save_bg) v_fbdata[i].is_painted = true; } } - if (fbtype == CC_FBDATA_TYPE_SHADOW_BOX && ((!is_painted || !fbdata.is_painted)|| shadow_force)) { + if (fbtype == CC_FBDATA_TYPE_SHADOW_BOX && ((!is_painted || !fbdata.is_painted)|| shadow_force || force_paint_bg)) { if (fbdata.enabled) { /* here we paint the shadow around the body * on 1st step we check for already cached screen buffer, if true @@ -629,15 +630,37 @@ void CCDraw::paintFbItems(bool do_save_bg) fbdata.pixbuf = getScreen(fbdata.x, fbdata.y, fbdata.dx, fbdata.dy); } } - is_painted = v_fbdata[i].is_painted = true; + v_fbdata[i].is_painted = true; + OnAfterPaintBg(); } } } } + + //set is_painted attribut. if any layer was painted set it to true; + if (force_paint_bg){ + is_painted = false; + }else{ + for(size_t i=0; i< v_fbdata.size(); i++){ + if (v_fbdata[i].is_painted){ + is_painted = true; + break; + } + } + } + + //reset is painted ignore flag to default value + force_paint_bg = false; + //pick up signal if filled OnAfterPaintLayers(); } +bool CCDraw::isPainted() +{ + return is_painted; +} + void CCDraw::hide() { OnBeforeHide(); @@ -652,8 +675,8 @@ void CCDraw::hide() } } } - is_painted = false; firstPaint = true; + is_painted = false; OnAfterHide(); } @@ -732,10 +755,10 @@ void CCDraw::enableShadow(int mode, const int& shadow_width, bool force_paint) void CCDraw::paintTrigger() { - if (!is_painted) - paint1(); - else + if (is_painted) hide(); + else + paint(); } bool CCDraw::paintBlink(CComponentsTimer* Timer) diff --git a/src/gui/components/cc_draw.h b/src/gui/components/cc_draw.h index dd99986fa..a7d442e86 100644 --- a/src/gui/components/cc_draw.h +++ b/src/gui/components/cc_draw.h @@ -115,6 +115,8 @@ class CCDraw : public COSDFader, public CComponentsSignals bool firstPaint; ///status: true=component was rendered bool is_painted; + ///status: true= value is_painted would be ignored + bool force_paint_bg; ///mode: true=activate rendering of basic elements (frame, shadow and body) bool paint_bg; ///mode: true=activate rendering of frame @@ -268,7 +270,7 @@ class CCDraw : public COSDFader, public CComponentsSignals virtual void disablePaintCache(){enablePaintCache(false);} ///returns paint mode, true=item was painted - virtual bool isPainted(){return is_painted;} + virtual bool isPainted(); ///allows paint of elementary item parts (shadow, frame and body), similar as background, set it usually to false, if item used in a form, returns true, if mode has changed, also cleans screnn buffer virtual bool doPaintBg(bool do_paint); ///allows paint frame around body, default true , NOTE: ignored if frame width = 0 @@ -353,10 +355,12 @@ class CCDraw : public COSDFader, public CComponentsSignals */ bool cancelBlink(bool keep_on_screen = false); - ///signal on before paint fb layers, called inside paintFbItems() + ///signal on before paint fb layers, called before paint fb layers inside paintFbItems() sigc::signal OnBeforePaintLayers; - ///signal on after paint fb layers, called inside paintFbItems() + ///signal on after paint fb layers, called after paint fb layers inside paintFbItems() sigc::signal OnAfterPaintLayers; + ///signal on after paint background, called after paint of background box inside paintFbItems() + sigc::signal OnAfterPaintBg; /*! Removes current item from screen and diff --git a/src/gui/components/cc_frm.cpp b/src/gui/components/cc_frm.cpp index 102daa505..9d3544573 100644 --- a/src/gui/components/cc_frm.cpp +++ b/src/gui/components/cc_frm.cpp @@ -335,7 +335,8 @@ void CComponentsForm::exchangeCCItem(CComponentsItem* item_a, CComponentsItem* i void CComponentsForm::paintForm(bool do_save_bg) { //paint body - paintInit(do_save_bg); + if (!is_painted || force_paint_bg) + paintInit(do_save_bg); //paint paintCCItems(); @@ -519,23 +520,7 @@ void CComponentsForm::paintCCItems() cc_item->allowPaint(item_visible); } } -#if 0 -void CComponentsForm::hide() -{ - // 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() == CC_ITEMTYPE_PIP){ - v_cc_items[i]->kill(); - break; - } - } - //hide body - CComponents::hide(); -} -#endif //erase or paint over rendered objects void CComponentsForm::killCCItems(const fb_pixel_t& bg_color, bool ignore_parent) { @@ -692,3 +677,20 @@ bool CComponentsForm::enableColBodyGradient(const int& enable_mode, const fb_pix } return false; } + +void CComponentsForm::forceItemsPaint(bool force) +{ + for (size_t i = 0; i < v_cc_items.size(); i++){ + dprintf(DEBUG_DEBUG, "\033[33m[CComponentsForm] [%s - %d] found item type = [%d] \033[0m\n", __func__, __LINE__, v_cc_items[i]->getItemType()); + if (v_cc_items[i]->getItemType() == CC_ITEMTYPE_TEXT){ + CComponentsText* text = static_cast (v_cc_items[i]); + text->forceTextPaint(force); + dprintf(DEBUG_DEBUG, "\033[33m[CComponentsForm] [%s - %d] force repaint of item type CC_ITEMTYPE_TEXT [%u] content [%s]\033[0m\n", __func__, __LINE__, i, text->getText().c_str()); + } + if (v_cc_items[i]->getItemType() == CC_ITEMTYPE_LABEL){ + CComponentsLabel* label = static_cast (v_cc_items[i]); + label ->forceTextPaint(force); + dprintf(DEBUG_DEBUG, "\033[33m[CComponentsForm] [%s - %d] force repaint of item type CC_ITEMTYPE_LABEL [%u] content [%s]\033[0m\n", __func__, __LINE__, i, label->getText().c_str()); + } + } +} diff --git a/src/gui/components/cc_frm.h b/src/gui/components/cc_frm.h index 44f6b481e..56ad077c6 100644 --- a/src/gui/components/cc_frm.h +++ b/src/gui/components/cc_frm.h @@ -65,6 +65,11 @@ class CComponentsForm : public CComponentsItem const fb_pixel_t& color_body, const fb_pixel_t& color_shadow); + ///force repaint of all possible text items + void forceItemsPaint(bool force); + ///slot for background paint event, reserved for forceItemsPaint() + sigc::slot0 sl_repaint; + public: CComponentsForm( const int x_pos = 0, const int y_pos = 0, const int w = 800, const int h = 600, CComponentsForm *parent = NULL, diff --git a/src/gui/components/cc_frm_clock.cpp b/src/gui/components/cc_frm_clock.cpp index d1a9cbc7a..c3995318d 100644 --- a/src/gui/components/cc_frm_clock.cpp +++ b/src/gui/components/cc_frm_clock.cpp @@ -30,7 +30,7 @@ #include "cc_frm_clock.h" #include - +#include #include #include #include @@ -98,7 +98,10 @@ CComponentsFrmClock::CComponentsFrmClock( const int& x_pos, initParent(parent); //init slot for running clock - cl_sl = sigc::mem_fun0(*this, &CComponentsFrmClock::ShowTime); + cl_sl_show = sigc::mem_fun0(*this, &CComponentsFrmClock::ShowTime); + + //init slot to ensure paint segments after painted background + sl_repaint = sigc::bind<0>(sigc::mem_fun1(*this, &CComponentsFrmClock::forceItemsPaint), true); //run clock already if required if (activ) @@ -297,6 +300,11 @@ void CComponentsFrmClock::initCCLockItems() x_lbl += v_cc_items[i-1]->getWidth(); v_cc_items[i]->setPos(x_lbl, y_lbl); } + + if(!OnAfterPaintBg.empty()) + OnAfterPaintBg.clear(); + //init slot to handle repaint of segments if background was repainted + OnAfterPaintBg.connect(sl_repaint); } @@ -321,7 +329,8 @@ bool CComponentsFrmClock::startClock() cl_timer = new CComponentsTimer(0); if (cl_timer->OnTimer.empty()){ dprintf(DEBUG_INFO,"\033[33m[CComponentsFrmClock]\t[%s] init slot...\033[0m\n", __func__); - cl_timer->OnTimer.connect(cl_sl); + cl_timer->OnTimer.connect(cl_sl_show); + force_paint_bg = true; } } cl_timer->setTimerInterval(cl_interval); @@ -338,6 +347,7 @@ bool CComponentsFrmClock::stopClock() if (cl_timer){ if (cl_timer->stopTimer()){ dprintf(DEBUG_INFO, "[CComponentsFrmClock] [%s] stopping clock...\n", __func__); + clear(); delete cl_timer; cl_timer = NULL; return true; @@ -372,12 +382,12 @@ void CComponentsFrmClock::paint(bool do_save_bg) //prepare items before paint initCCLockItems(); + if (!is_painted) + force_paint_bg = false; + //paint form contents CComponentsForm::paint(do_save_bg); -#if 0 //has no effect - if (may_blit) - frameBuffer->blit(); -#endif + } void CComponentsFrmClock::setClockFont(Font *font, const int& style) diff --git a/src/gui/components/cc_frm_clock.h b/src/gui/components/cc_frm_clock.h index ddc5abbbb..22da0af26 100644 --- a/src/gui/components/cc_frm_clock.h +++ b/src/gui/components/cc_frm_clock.h @@ -52,7 +52,7 @@ class CComponentsFrmClock : public CComponentsForm, public CCTextScreen protected: ///slot for timer event, reserved for ShowTime() - sigc::slot0 cl_sl; + sigc::slot0 cl_sl_show; ///refresh interval in seconds int cl_interval; diff --git a/src/gui/components/cc_frm_ext_text.cpp b/src/gui/components/cc_frm_ext_text.cpp index 645410ead..3abf816f4 100644 --- a/src/gui/components/cc_frm_ext_text.cpp +++ b/src/gui/components/cc_frm_ext_text.cpp @@ -29,6 +29,8 @@ #include #include "cc_frm_ext_text.h" +#include + #define DEF_HEIGHT 27 #define DEF_LABEL_WIDTH_PERCENT 30 @@ -112,56 +114,60 @@ void CComponentsExtTextForm::initVarExtTextForm(const int& x_pos, const int& y_p } ccx_label_align = ccx_text_align = CTextBox::NO_AUTO_LINEBREAK; + //init slot to ensure paint text items after painted background + sl_repaint = sigc::bind<0>(sigc::mem_fun1(*this, &CComponentsExtTextForm::forceItemsPaint), true); + initParent(parent); } void CComponentsExtTextForm::initLabel() { - //initialize label object if (ccx_label_obj == NULL){ - ccx_label_obj = new CComponentsLabel(); - ccx_label_obj->doPaintBg(!cc_txt_save_screen); - ccx_label_obj->doPaintTextBoxBg(false); - ccx_label_obj->enableTboxSaveScreen(cc_txt_save_screen); - } + //create ccx_label_obj and add to collection + ccx_label_obj = new CComponentsLabel(this); + ccx_label_obj->doPaintBg(false); + } - //add label object - if (!ccx_label_obj->isAdded()) - addCCItem(ccx_label_obj); - - //set properties + //set label properties if (ccx_label_obj){ - ccx_label_width = (ccx_percent_label_w * width/100); + //assign general properties y_text = height/2 - height-2*fr_thickness; - ccx_label_obj->setText(ccx_label_text, ccx_label_align, ccx_font); - ccx_label_obj->setTextColor(ccx_label_color); ccx_label_obj->setDimensionsAll(0, y_text, ccx_label_width-2*fr_thickness, height-2*fr_thickness); - ccx_label_obj->setCorner(this->corner_rad, CORNER_LEFT); + ccx_label_obj->setColorBody(col_body); + if (cc_body_gradient_enable != cc_body_gradient_enable_old) + ccx_label_obj->getCTextBoxObject()->clearScreenBuffer(); + ccx_label_obj->setTextColor(ccx_label_color); + ccx_label_obj->setText(ccx_label_text, ccx_label_align, ccx_font); + ccx_label_obj->enableTboxSaveScreen(cc_body_gradient_enable || cc_txt_save_screen); + + //corner of label item + ccx_label_obj->setCorner(corner_rad-fr_thickness, CORNER_LEFT); } } void CComponentsExtTextForm::initText() { - //initialize text object + //set text properties if (ccx_text_obj == NULL){ - ccx_text_obj = new CComponentsText(); - ccx_text_obj->doPaintBg(!cc_txt_save_screen); - ccx_text_obj->doPaintTextBoxBg(false); - ccx_text_obj->enableTboxSaveScreen(cc_txt_save_screen); + //create ccx_text_obj and add to collection + ccx_text_obj = new CComponentsText(this); + ccx_text_obj->doPaintBg(false); } - //add text object - if (!ccx_text_obj->isAdded()) - addCCItem(ccx_text_obj); - - //set properties if (ccx_text_obj){ - ccx_text_width = width-ccx_label_obj->getWidth(); - ccx_text_obj->setText(ccx_text, ccx_text_align, ccx_font); - ccx_text_obj->setTextColor(ccx_text_color); + //assign general properties + y_text = height/2 - height-2*fr_thickness; ccx_text_obj->setDimensionsAll(ccx_label_obj->getWidth(), y_text, ccx_text_width-2*fr_thickness, height-2*fr_thickness); - ccx_text_obj->setCorner(this->corner_rad, CORNER_RIGHT); + ccx_text_obj->setColorBody(col_body); + if (cc_body_gradient_enable != cc_body_gradient_enable_old) + ccx_text_obj->getCTextBoxObject()->clearScreenBuffer(); + ccx_text_obj->setTextColor(ccx_text_color); + ccx_text_obj->setText(ccx_text, ccx_text_align, ccx_font);; + ccx_text_obj->enableTboxSaveScreen(cc_body_gradient_enable || cc_txt_save_screen); + + //corner of text item + ccx_text_obj->setCorner(corner_rad-fr_thickness, CORNER_RIGHT); } } @@ -216,6 +222,11 @@ void CComponentsExtTextForm::initCCTextItems() { initLabel(); initText(); + + if(!OnAfterPaintBg.empty()) + OnAfterPaintBg.clear(); + //init slot to handle repaint of text if background was repainted + OnAfterPaintBg.connect(sl_repaint); } void CComponentsExtTextForm::setLabelWidthPercent(const uint8_t& percent_val) diff --git a/src/gui/components/cc_frm_header.cpp b/src/gui/components/cc_frm_header.cpp index 032763d16..dcc22dfc2 100644 --- a/src/gui/components/cc_frm_header.cpp +++ b/src/gui/components/cc_frm_header.cpp @@ -30,6 +30,9 @@ #include #include "cc_frm_header.h" #include + +#include + using namespace std; //------------------------------------------------------------------------------------------------------- @@ -133,6 +136,9 @@ void CComponentsHeader::initVarHeader( const int& x_pos, const int& y_pos, const cch_cl_sec_format = cch_cl_format; cch_cl_enable_run = false; + //init slot to ensure paint segments after painted background + sl_repaint = sigc::bind<0>(sigc::mem_fun1(*this, &CComponentsHeader::forceItemsPaint), true); + addContextButton(buttons); initCCItems(); initParent(parent); @@ -146,6 +152,8 @@ CComponentsHeader::~CComponentsHeader() void CComponentsHeader::setCaption(const std::string& caption, const int& align_mode, const fb_pixel_t& text_color) { + if (cch_cl_obj) + cch_cl_obj->Stop(); cch_text = caption; cch_caption_align = align_mode; cch_col_text = text_color; @@ -153,8 +161,6 @@ void CComponentsHeader::setCaption(const std::string& caption, const int& align_ void CComponentsHeader::setCaption(neutrino_locale_t caption_locale, const int& align_mode, const fb_pixel_t& text_color) { - if (cch_cl_obj) - cch_cl_obj->Stop(); setCaption(string(g_Locale->getText(caption_locale)), align_mode, text_color); } @@ -362,10 +368,12 @@ void CComponentsHeader::enableClock(bool enable, const char* format, const char* { cch_cl_enable = enable; cch_cl_format = format; + if (cch_cl_obj && cch_cl_enable) + cch_cl_obj->clear(); if (sec_format_str) cch_cl_sec_format = sec_format_str; cch_cl_enable_run = run; - if (!enable){ + if (!cch_cl_enable){ if (cch_cl_obj){ cch_cl_enable_run = false; removeCCItem(cch_cl_obj); @@ -515,6 +523,11 @@ void CComponentsHeader::initCaption() */ //height = max(height, cch_text_obj->getHeight()); } + + if(!OnAfterPaintBg.empty()) + OnAfterPaintBg.clear(); + //init slot to handle repaint of text if background was repainted + OnAfterPaintBg.connect(sl_repaint); } void CComponentsHeader::initCCItems() @@ -537,14 +550,14 @@ void CComponentsHeader::initCCItems() //init text initCaption(); } - + void CComponentsHeader::paint(bool do_save_bg) { //prepare items initCCItems(); - + //paint form contents - paintForm(do_save_bg); + CComponentsForm::paint(do_save_bg); //start clock if enabled if (cch_cl_obj){ @@ -564,3 +577,14 @@ bool CComponentsHeader::enableColBodyGradient(const int& enable_mode, const fb_p return CComponentsForm::enableColBodyGradient(enable_mode, sec_color, dir); } +void CComponentsHeader::kill(const fb_pixel_t& bg_color, const int& corner_radius, const int& fblayer_type /*fbdata_type*/, bool disable_clock) +{ + if (disable_clock) + disableClock(); + + int rad = corner_radius; + if (corner_radius == -1) + rad = corner_rad; + + CComponentsForm::kill(bg_color, rad, fblayer_type); +} diff --git a/src/gui/components/cc_frm_header.h b/src/gui/components/cc_frm_header.h index df444ee7a..7f75f2fd7 100644 --- a/src/gui/components/cc_frm_header.h +++ b/src/gui/components/cc_frm_header.h @@ -269,7 +269,7 @@ class CComponentsHeader : public CComponentsForm, public CCTextScreen ///hides item, arg: no_restore see hideCCItem() void hide(){disableClock(); CComponents::hide();} ///erase current screen without restore of background, it's similar to paintBackgroundBoxRel() from CFrameBuffer - virtual void kill(){disableClock(); CComponentsForm::kill();} + 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); ///set color gradient on/off, returns true if gradient mode was changed virtual bool enableColBodyGradient(const int& enable_mode, const fb_pixel_t& sec_color = 255 /*=COL_BACKGROUND*/, const int& direction = -1); diff --git a/src/gui/components/cc_item_text.cpp b/src/gui/components/cc_item_text.cpp index f56733584..bd37e0d37 100644 --- a/src/gui/components/cc_item_text.cpp +++ b/src/gui/components/cc_item_text.cpp @@ -78,7 +78,7 @@ void CComponentsText::initVarText( const int x_pos, const int y_pos, const int w int shadow_mode, fb_pixel_t color_text, fb_pixel_t color_frame, fb_pixel_t color_body, fb_pixel_t color_shadow) { - cc_item_type = CC_ITEMBOX_TEXT; + cc_item_type = CC_ITEMTYPE_TEXT; ct_font = font_text; ct_textbox = NULL; ct_text = text; @@ -180,7 +180,7 @@ void CComponentsText::initCCText() //send text to CTextBox object, but force text paint text if force_text_paint option is enabled //this is managed by CTextBox object itself ct_text_sent = ct_textbox->setText(&ct_text, ct_box.iWidth, force_text_paint); - + //set current text status, needed by textChanged() if (ct_text_sent){ ct_old_text = ct_text; @@ -273,11 +273,13 @@ bool CComponentsText::setTextFromFile(const string& path_to_textfile, const int void CComponentsText::paintText(bool do_save_bg) { - paintInit(do_save_bg); initCCText(); + if (!is_painted) + paintInit(do_save_bg); if (ct_text_sent && cc_allow_paint) ct_textbox->paint(); + ct_text_sent = false; } @@ -290,8 +292,20 @@ void CComponentsText::hide() { if (ct_textbox) ct_textbox->hide(); - ct_old_text = ""; - CComponents::hide(); + + ct_old_text.clear(); + CCDraw::hide(); + ct_force_text_paint = true; +} + +void CComponentsText::kill() +{ + if (ct_textbox) + ct_textbox->hide(); + + ct_old_text.clear(); + CCDraw::kill(); + ct_force_text_paint = true; } void CComponentsText::setXPos(const int& xpos) diff --git a/src/gui/components/cc_item_text.h b/src/gui/components/cc_item_text.h index 7bd5f6372..f744efba2 100644 --- a/src/gui/components/cc_item_text.h +++ b/src/gui/components/cc_item_text.h @@ -138,6 +138,8 @@ class CComponentsText : public CCTextScreen, public CComponentsItem ///default members to paint a text box and hide painted text ///hide textbox void hide(); + ///remove textbox from screen + void kill(); ///paint text box, parameter do_save_bg: default = true, causes fill of backckrond pixel buffer void paint(bool do_save_bg = CC_SAVE_SCREEN_YES); @@ -277,6 +279,22 @@ class CComponentsLabel : public CComponentsText { cc_item_type = CC_ITEMTYPE_LABEL; }; + + CComponentsLabel( CComponentsForm *parent, + const int x_pos = 10, const int y_pos = 10, const int w = 150, const int h = 50, + std::string text = "", + const int mode = CTextBox::AUTO_WIDTH, + Font* font_text = NULL, + const int& font_style = CComponentsText::FONT_STYLE_REGULAR, + int shadow_mode = CC_SHADOW_OFF, + fb_pixel_t color_text = COL_MENUCONTENTINACTIVE_TEXT, + fb_pixel_t color_frame = COL_FRAME_PLUS_0, + fb_pixel_t color_body = COL_MENUCONTENT_PLUS_0, + fb_pixel_t color_shadow = COL_SHADOW_PLUS_0) + :CComponentsText(x_pos, y_pos, w, h, text, mode, font_text, font_style, parent, shadow_mode, color_text, color_frame, color_body, color_shadow) + { + cc_item_type = CC_ITEMTYPE_LABEL; + }; }; #endif diff --git a/src/gui/components/cc_types.h b/src/gui/components/cc_types.h index 5fc909f0e..12a42cf7c 100644 --- a/src/gui/components/cc_types.h +++ b/src/gui/components/cc_types.h @@ -147,14 +147,6 @@ enum CC_ALONG_Y = 2 }; -enum -{ - CC_ITEMBOX_ICON, - CC_ITEMBOX_PICTURE, - CC_ITEMBOX_TEXT, - CC_ITEMBOX_CLOCK -}; - typedef struct cc_element_data_t { int type; diff --git a/src/gui/eventlist.cpp b/src/gui/eventlist.cpp index 585d27700..8c88a47cc 100644 --- a/src/gui/eventlist.cpp +++ b/src/gui/eventlist.cpp @@ -885,7 +885,9 @@ void CEventList::paintHead(t_channel_id _channel_id, std::string _channelname, s } else { header->removeCCItem(midLogo); //remove/destroy logo object, if it is not available - CComponentsText *midText = new CComponentsText(CC_CENTERED, CC_CENTERED, mid_width, theight, _channelname, CTextBox::CENTER, g_Font[font_mid], CComponentsText::FONT_STYLE_REGULAR, header, CC_SHADOW_OFF, COL_MENUHEAD_TEXT); + 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); } @@ -900,6 +902,8 @@ void CEventList::paintHead(t_channel_id _channel_id, std::string _channelname, s rText->doPaintBg(false); } + if (header->isPainted()) //clean up background of header for new captions + header->kill(header->getColorBody()); header->paint(CC_SAVE_SCREEN_NO); } diff --git a/src/gui/imageinfo.cpp b/src/gui/imageinfo.cpp index 6f946a3ab..017205bc7 100644 --- a/src/gui/imageinfo.cpp +++ b/src/gui/imageinfo.cpp @@ -169,7 +169,8 @@ int CImageInfo::exec(CMenuTarget* parent, const std::string &) btn_red->setCaption(new_btn_cap); //paint items - cc_sub_caption->paint(false); + cc_sub_caption->hide(); + cc_sub_caption->paint(); cc_lic->paint(false); btn_red->kill(); btn_red->paint(false); diff --git a/src/gui/infoclock.cpp b/src/gui/infoclock.cpp index c0e8ebc58..ac4b5ba2c 100644 --- a/src/gui/infoclock.cpp +++ b/src/gui/infoclock.cpp @@ -105,6 +105,7 @@ bool CInfoClock::StopInfoClock() { bool ret = Stop(); kill(); + clear(); return ret; } diff --git a/src/gui/infoviewer.cpp b/src/gui/infoviewer.cpp index ba1e7621f..03528354b 100644 --- a/src/gui/infoviewer.cpp +++ b/src/gui/infoviewer.cpp @@ -277,6 +277,7 @@ void CInfoViewer::initClock() } CInfoClock::getInstance()->disableInfoClock(); + clock->clear(); clock->enableColBodyGradient(gradient_top, COL_INFOBAR_PLUS_0); clock->doPaintBg(!gradient_top); clock->enableTboxSaveScreen(gradient_top); @@ -629,11 +630,12 @@ void CInfoViewer::showMovieTitle(const int playState, const t_channel_id &Channe if (!zap_mode) infoViewerBB->paintshowButtonBar(); + int renderFlag = ((g_settings.theme.infobar_gradient_top) ? Font::FULLBG : 0) | Font::IS_UTF8; int ChannelLogoMode = 0; if (g_settings.infobar_show_channellogo > 1) ChannelLogoMode = showChannelLogo(current_channel_id, 0); if (ChannelLogoMode == 0 || ChannelLogoMode == 3 || ChannelLogoMode == 4) - g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_CHANNAME]->RenderString(ChanNameX + 10 , ChanNameY + header_height,BoxEndX - (ChanNameX + 20) - time_width - LEFT_OFFSET - 10 ,ChannelName, COL_INFOBAR_TEXT); + g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_CHANNAME]->RenderString(ChanNameX + 10 , ChanNameY + header_height,BoxEndX - (ChanNameX + 20) - time_width - LEFT_OFFSET - 10 ,ChannelName, COL_INFOBAR_TEXT, 0, renderFlag); // show_Data if (CMoviePlayerGui::getInstance().file_prozent > 100) @@ -689,7 +691,7 @@ void CInfoViewer::showMovieTitle(const int playState, const t_channel_id &Channe if (speed) { int sh = g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_INFO]->getHeight(); int sy = BoxStartY + ChanHeight/2 - sh/2 + sh; - g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_INFO]->RenderString(icon_x, sy, ChanHeight, runningRest, COL_INFOBAR_TEXT); + g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_INFO]->RenderString(icon_x, sy, ChanHeight, runningRest, COL_INFOBAR_TEXT, 0, renderFlag); icon_x += speedw; } frameBuffer->paintIcon(playicon, icon_x, icon_y); @@ -734,6 +736,7 @@ void CInfoViewer::showTitle(CZapitChannel * channel, const bool calledFromNumZap { if(!calledFromNumZap && !(zap_mode & IV_MODE_DEFAULT)) resetSwitchMode(); + int renderFlag = ((g_settings.theme.infobar_gradient_top) ? Font::FULLBG : 0) | Font::IS_UTF8; std::string Channel = channel->getName(); t_satellite_position satellitePosition = channel->getSatellitePosition(); @@ -852,7 +855,7 @@ void CInfoViewer::showTitle(CZapitChannel * channel, const bool calledFromNumZap } } int h_sfont = g_SignalFont->getHeight(); - g_SignalFont->RenderString (BoxStartX + numbox_offset + ((ChanWidth - satNameWidth) / 2) , numbox->getYPos() + h_sfont, satNameWidth, satname_tmp, COL_INFOBAR_TEXT); + g_SignalFont->RenderString (BoxStartX + numbox_offset + ((ChanWidth - satNameWidth) / 2) , numbox->getYPos() + h_sfont, satNameWidth, satname_tmp, COL_INFOBAR_TEXT, 0, renderFlag); } /* TODO: the logic will get much easier once we decouple channellogo and signal bars */ @@ -871,14 +874,14 @@ void CInfoViewer::showTitle(CZapitChannel * channel, const bool calledFromNumZap y_tmp, ChanWidth - 2*numbox_offset, strChanNum, - col_NumBoxText); + col_NumBoxText, 0, renderFlag); } if (ChannelLogoMode == 1 || ( g_settings.infobar_show_channellogo == 3 && !logo_ok) || g_settings.infobar_show_channellogo == 6 ) /* channel number besides channel name */ { ChanNumWidth = 5 + g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_CHANNAME]->getRenderWidth (strChanNum); g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_CHANNAME]->RenderString( ChanNameX + 5, ChanNameY + header_height, - ChanNumWidth, strChanNum, col_NumBoxText); + ChanNumWidth, strChanNum, col_NumBoxText, 0, renderFlag); } } @@ -890,7 +893,7 @@ void CInfoViewer::showTitle(CZapitChannel * channel, const bool calledFromNumZap g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_CHANNAME]->RenderString( ChanNameX + 10 + ChanNumWidth, ChanNameY + header_height, BoxEndX - (ChanNameX + 20) - time_width - LEFT_OFFSET - 10 - ChanNumWidth, - ChannelName, color /*COL_INFOBAR_TEXT*/); + ChannelName, color /*COL_INFOBAR_TEXT*/, 0, renderFlag); //provider name if(g_settings.infobar_show_channeldesc && channel->pname){ std::string prov_name = channel->pname; @@ -907,7 +910,7 @@ void CInfoViewer::showTitle(CZapitChannel * channel, const bool calledFromNumZap g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_INFO]->RenderString( ChanNameX + 10 + ChanNumWidth + chname_width, tmpY, BoxEndX - (ChanNameX + 20) - time_width - LEFT_OFFSET - 10 - ChanNumWidth - chname_width, - prov_name, color /*COL_INFOBAR_TEXT*/); + prov_name, color /*COL_INFOBAR_TEXT*/, 0, renderFlag); } } @@ -1712,6 +1715,7 @@ void CInfoViewer::showSNR () { if (! is_visible) return; + int renderFlag = ((g_settings.theme.infobar_gradient_top) ? Font::FULLBG : 0) | Font::IS_UTF8; /* right now, infobar_show_channellogo == 3 is the trigger for signal bars etc. TODO: decouple this */ if (!fileplay && !IS_WEBTV(current_channel_id) && ( g_settings.infobar_show_channellogo == 3 || g_settings.infobar_show_channellogo == 5 || g_settings.infobar_show_channellogo == 6 )) { @@ -1734,7 +1738,7 @@ void CInfoViewer::showSNR () int freqWidth = g_SignalFont->getRenderWidth(freq); if (freqWidth > (ChanWidth - numbox_offset*2)) freqWidth = ChanWidth - numbox_offset*2; - g_SignalFont->RenderString(BoxStartX + numbox_offset + ((ChanWidth - freqWidth) / 2), y_numbox + y_freq - 3, ChanWidth - 2*numbox_offset, freq, SDT_freq_update ? COL_COLORED_EVENTS_TEXT:COL_INFOBAR_TEXT); + g_SignalFont->RenderString(BoxStartX + numbox_offset + ((ChanWidth - freqWidth) / 2), y_numbox + y_freq - 3, ChanWidth - 2*numbox_offset, freq, SDT_freq_update ? COL_COLORED_EVENTS_TEXT:COL_INFOBAR_TEXT, 0, renderFlag); SDT_freq_update = false; } if (sigbox == NULL){ @@ -2253,7 +2257,7 @@ void CInfoViewer::killTitle() clock->kill(); #endif body->kill(); -#if 0 //not really required to kill epg infos, body does this + if (txt_cur_event) txt_cur_event->kill(); if (txt_cur_event_rest) @@ -2266,7 +2270,7 @@ void CInfoViewer::killTitle() txt_next_event->kill(); if (txt_next_in) txt_next_in->kill(); -#endif + if (timescale) if (g_settings.infobar_progressbar == SNeutrinoSettings::INFOBAR_PROGRESSBAR_ARRANGEMENT_DEFAULT) timescale->kill(); diff --git a/src/gui/movieplayer.cpp b/src/gui/movieplayer.cpp index 55b24c5b9..def338fb4 100644 --- a/src/gui/movieplayer.cpp +++ b/src/gui/movieplayer.cpp @@ -982,10 +982,9 @@ bool CMoviePlayerGui::selectLivestream(std::vector &streamLis return false; } -bool CMoviePlayerGui::getLiveUrl(const t_channel_id chan, const std::string &url, const std::string &script, std::string &realUrl, std::string &_pretty_name, std::string &info1, std::string &info2, std::string &header) +bool CMoviePlayerGui::getLiveUrl(const std::string &url, const std::string &script, std::string &realUrl, std::string &_pretty_name, std::string &info1, std::string &info2, std::string &header) { - static t_channel_id oldChan = 0; - static std::vector liveStreamList; + std::vector liveStreamList; livestream_info_t info; if (script.empty()) { @@ -1014,22 +1013,15 @@ bool CMoviePlayerGui::getLiveUrl(const t_channel_id chan, const std::string &url size_t pos = _script.find(".lua"); if (!file_exists(_script.c_str()) || (pos == std::string::npos) || (_script.length()-pos != 4)) { - liveStreamList.clear(); printf(">>>>> [%s:%s:%d] script error\n", __file__, __func__, __LINE__); return false; } - if ((oldChan != chan) || liveStreamList.empty()) { - liveStreamList.clear(); - if (!luaGetUrl(_script, url, liveStreamList)) { - liveStreamList.clear(); - printf(">>>>> [%s:%s:%d] lua script error\n", __file__, __func__, __LINE__); - return false; - } - oldChan = chan; + if (!luaGetUrl(_script, url, liveStreamList)) { + printf(">>>>> [%s:%s:%d] lua script error\n", __file__, __func__, __LINE__); + return false; } if (!selectLivestream(liveStreamList, g_settings.livestreamResolution, &info)) { - liveStreamList.clear(); printf(">>>>> [%s:%s:%d] error selectLivestream\n", __file__, __func__, __LINE__); return false; } @@ -1098,7 +1090,7 @@ bool CMoviePlayerGui::PlayBackgroundStart(const std::string &file, const std::st std::string realUrl; std::string _pretty_name = name; cookie_header.clear(); - if (!getLiveUrl(chan, file, script, realUrl, _pretty_name, livestreamInfo1, livestreamInfo2, cookie_header)) { + if (!getLiveUrl(file, script, realUrl, _pretty_name, livestreamInfo1, livestreamInfo2, cookie_header)) { return false; } diff --git a/src/gui/movieplayer.h b/src/gui/movieplayer.h index 8dfc5b801..d4ac0df4b 100644 --- a/src/gui/movieplayer.h +++ b/src/gui/movieplayer.h @@ -269,7 +269,7 @@ class CMoviePlayerGui : public CMenuTarget bool getBlockedFromPlugin() { return blockedFromPlugin; }; void setLuaInfoFunc(lua_State* L, bool func) { luaState = L; haveLuaInfoFunc = func; }; void getLivestreamInfo(std::string *i1, std::string *i2) { *i1=livestreamInfo1; *i2=livestreamInfo2; }; - bool getLiveUrl(const t_channel_id chan, const std::string &url, const std::string &script, std::string &realUrl, std::string &_pretty_name, std::string &info1, std::string &info2, std::string &header); + bool getLiveUrl(const std::string &url, const std::string &script, std::string &realUrl, std::string &_pretty_name, std::string &info1, std::string &info2, std::string &header); //NI MI_MOVIE_INFO * p_movie_info; diff --git a/src/gui/osd_setup.cpp b/src/gui/osd_setup.cpp index e61edacb7..cb7f68b0e 100644 --- a/src/gui/osd_setup.cpp +++ b/src/gui/osd_setup.cpp @@ -1051,11 +1051,6 @@ void COsdSetup::showOsdFontSizeSetup(CMenuWidget *menu_fonts) mfTtxFontFile->setHint("", LOCALE_MENU_HINT_FONT_TTX); fontSettings->addItem(mfTtxFontFile); - // contrast fonts - CMenuOptionChooser * mc = new CMenuOptionChooser(LOCALE_COLORMENU_CONTRAST_FONTS, &g_settings.contrast_fonts, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true, this, CRCInput::RC_yellow); - mc->setHint("", LOCALE_MENU_HINT_CONTRAST_FONTS); - fontSettings->addItem(mc); - fontSettings->addItem(new CMenuSeparator(CMenuSeparator::LINE | CMenuSeparator::STRING, LOCALE_FONTMENU_SIZES)); //submenu font scaling @@ -1444,9 +1439,7 @@ void COsdSetup::showOsdInfoclockSetup(CMenuWidget *menu_infoclock) bool COsdSetup::changeNotify(const neutrino_locale_t OptionName, void * data) { - if(ARE_LOCALES_EQUAL(OptionName, LOCALE_COLORMENU_CONTRAST_FONTS)) - return true; - else if(ARE_LOCALES_EQUAL(OptionName, LOCALE_SETTINGS_MENU_POS)) { + if (ARE_LOCALES_EQUAL(OptionName, LOCALE_SETTINGS_MENU_POS)) { submenu_menus->hide(); return true; } diff --git a/src/gui/screensaver.cpp b/src/gui/screensaver.cpp index a1856c743..eba44e81a 100644 --- a/src/gui/screensaver.cpp +++ b/src/gui/screensaver.cpp @@ -280,10 +280,11 @@ void CScreenSaver::paint() } else{ if (!scr_clock){ - scr_clock = new CComponentsFrmClock(1, 1, NULL, "%H:%M:%S", "%H:%M.%S", true); //NI + scr_clock = new CComponentsFrmClock(1, 1, NULL, "%H:%M:%S", "%H:%M.%S", true, //NI + 1, NULL, CC_SHADOW_OFF, COL_BLACK, COL_BLACK); scr_clock->setClockFont(g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_NUMBER]); scr_clock->disableSaveBg(); - scr_clock->doPaintBg(false); + scr_clock->doPaintBg(true); } if (scr_clock->isPainted()) scr_clock->Stop(); diff --git a/src/gui/test_menu.cpp b/src/gui/test_menu.cpp index f3bfcb5e6..7bf9a3e9d 100644 --- a/src/gui/test_menu.cpp +++ b/src/gui/test_menu.cpp @@ -565,7 +565,7 @@ int CTestMenu::exec(CMenuTarget* parent, const std::string &actionKey) else if (actionKey == "text_ext"){ if (text_ext == NULL) text_ext = new CComponentsExtTextForm(); - text_ext->setDimensionsAll(10, 20, 300, g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]->getHeight()); + text_ext->setDimensionsAll(10, 20, 300, g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]->getHeight()+2*2); text_ext->setLabelAndText("Label", "Text for demo", g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]); text_ext->setFrameThickness(2); // text_ext->setLabelWidthPercent(15/*%*/); @@ -582,15 +582,12 @@ int CTestMenu::exec(CMenuTarget* parent, const std::string &actionKey) text_ext->setDimensionsAll(10, 20, 300, 48); text_ext->setLabelAndText("Label", "Text for demo", g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]); text_ext->setFrameThickness(2); - // text_ext->setLabelWidthPercent(15/*%*/); - text_ext->paint0(); - static_cast(text_ext->getCCItem(1))->kill(); } - if (static_cast(text_ext->getCCItem(1))-> paintBlink(500000, true)){ + if (text_ext->paintBlink(500000, true)){ ShowHint("Testmenu: Blink","Testmenu: Blinking extended text is running ...", 700, 10); } - if (text_ext->getTextObject()->cancelBlink()){ + if (text_ext->cancelBlink()){ ShowHint("Testmenu: Blink","Testmenu: Blinking extended text stopped ...", 700, 2); } return res; @@ -741,6 +738,9 @@ int CTestMenu::exec(CMenuTarget* parent, const std::string &actionKey) ShowHint("Testmenu: Blink","Testmenu: Blinking image stopped ...", 700, 2); } + iconform->kill(); + delete iconform; + iconform = NULL; return res; } else if (actionKey == "window"){ diff --git a/src/gui/volumebar.cpp b/src/gui/volumebar.cpp index 3ffd1a840..4e0386058 100644 --- a/src/gui/volumebar.cpp +++ b/src/gui/volumebar.cpp @@ -215,6 +215,7 @@ void CVolumeBar::initVolumeBarDigit() vb_digit->setDimensionsAll(vb_digit_x, 0, vb_digit_w, height); vb_digit->setTextColor(COL_MENUCONTENT_TEXT); vb_digit->setCorner(cornerRad(), CORNER_RIGHT); + vb_digit->doPaintTextBoxBg(true); initVolumeBarDigitValue(); //add digit label to container diff --git a/src/gui/widget/textbox.cpp b/src/gui/widget/textbox.cpp index 4750de544..05602cbbd 100644 --- a/src/gui/widget/textbox.cpp +++ b/src/gui/widget/textbox.cpp @@ -159,6 +159,7 @@ void CTextBox::initVar(void) m_pcFontText = g_Font[SNeutrinoSettings::FONT_TYPE_EPG_INFO1]; m_nFontTextHeight = getFontTextHeight(); m_nMaxTextWidth = 0; + m_bg_painted = false; m_nNrOfPages = 1; m_nNrOfLines = 0; @@ -573,7 +574,6 @@ void CTextBox::reInitToCompareVar(int* x, int* y, int* dx, int* dy) m_old_nBgRadius = m_nBgRadius; m_old_nBgRadiusType = m_nBgRadiusType; m_old_nMode = m_nMode; - m_old_cText = m_cText; } void CTextBox::refreshText(void) @@ -601,12 +601,13 @@ void CTextBox::refreshText(void) bool has_changed = hasChanged(&ax, &ay, &dx, &dy); //clean up possible screen on any changes - if (has_changed && m_bgpixbuf){ + if (has_changed || m_bgpixbuf){ /*TODO/FIXME: in some cases could be required, that we must restore old saved screen. eg. if a text without bg was painted * and another text should be painted as next on the same position like current text, but new text will be overpaint and is * not visible. It's currently solvable only with appropriate order of text items */ - frameBuffer->RestoreScreen(m_old_x, m_old_y, m_old_dx, m_old_dy, m_bgpixbuf); + if (m_bgpixbuf) + frameBuffer->RestoreScreen(m_old_x, m_old_y, m_old_dx, m_old_dy, m_bgpixbuf); clearScreenBuffer(); } @@ -648,6 +649,7 @@ void CTextBox::refreshText(void) //TRACE("[CTextBox] %s paint bg %d\r\n", __FUNCTION__, __LINE__); //paint full background only on new text, otherwise paint required background frameBuffer->paintBoxRel(ax, ay, dx, dy, m_textBackgroundColor, m_nBgRadius, BgRadiusType); + m_bg_painted = true; } } else{ @@ -713,10 +715,11 @@ void CTextBox::refreshText(void) frameBuffer->paintBoxRel(tx, ty-th, tw, th, COL_RED, m_nBgRadius, m_nBgRadiusType); #endif //TRACE("[CTextBox] %s Line %d m_cFrame.iX %d m_cFrameTextRel.iX %d\r\n", __FUNCTION__, __LINE__, m_cFrame.iX, m_cFrameTextRel.iX); - m_pcFontText->RenderString(tx, ty, tw, m_cLineArray[i].c_str(), m_textColor, 0, m_renderMode | ((m_utf8_encoded) ? Font::IS_UTF8 : 0)); - m_old_cText = m_cText; + if (m_bg_painted || m_old_cText != m_cText) + m_pcFontText->RenderString(tx, ty, tw, m_cLineArray[i].c_str(), m_textColor, 0, m_renderMode | ((m_utf8_encoded) ? Font::IS_UTF8 : 0)); y += m_nFontTextHeight; } + m_old_cText = m_cText; } void CTextBox::scrollPageDown(const int pages) @@ -783,23 +786,26 @@ void CTextBox::refresh(void) bool CTextBox::setText(const std::string* newText, int max_width, bool force_repaint) { //TRACE("[CTextBox]->SetText \r\n"); - bool result = false; m_nMaxTextWidth = max_width; //reset text to force repaint the text, managed in hasChanged() if (force_repaint) m_old_cText = ""; //printf("setText: _max_width %d max_width %d\n", _max_width, max_width); - if (newText != NULL) - { + if (newText){ m_cText = *newText; - //m_cText = *newText + "\n"; //FIXME test - reSizeMainFrameHeight(m_cFrame.iHeight); - //refresh text line array - refreshTextLineArray(); - refresh(); - result = true; - } - return(result); + if (m_old_cText != m_cText){ + //m_cText = *newText + "\n"; //FIXME test + reSizeMainFrameHeight(m_cFrame.iHeight); + //refresh text line array + refreshTextLineArray(); + refresh(); + return true; + } + return false; + }else + return false; + + return true; } void CTextBox::paint (void) diff --git a/src/gui/widget/textbox.h b/src/gui/widget/textbox.h index c38ea5ef1..afb4e3912 100644 --- a/src/gui/widget/textbox.h +++ b/src/gui/widget/textbox.h @@ -122,6 +122,7 @@ class CTextBox : public sigc::trackable fb_pixel_t m_old_textBackgroundColor, m_old_textColor; bool m_showTextFrame; + bool m_bg_painted; CBox m_cFrame; CBox m_cFrameTextRel; diff --git a/src/neutrino.cpp b/src/neutrino.cpp index ad0b00b53..3bd8d1e02 100644 --- a/src/neutrino.cpp +++ b/src/neutrino.cpp @@ -652,8 +652,6 @@ int CNeutrinoApp::loadSetup(const char * fname) for (int i = 0; i < SNeutrinoSettings::P_SETTINGS_MAX; i++)//settings.h, settings.cpp g_settings.personalize[i] = configfile.getInt32( personalize_settings[i].personalize_settings_name, personalize_settings[i].personalize_default_val ); - g_settings.contrast_fonts = configfile.getInt32("contrast_fonts", 0); - //network for(int i=0 ; i < NETWORK_NFS_NR_OF_ENTRIES ; i++) { std::string i_str(to_string(i)); @@ -1330,7 +1328,6 @@ void CNeutrinoApp::saveSetup(const char * fname) for (int i = 0; i < SNeutrinoSettings::P_SETTINGS_MAX; i++) //settings.h, settings.cpp configfile.setInt32(personalize_settings[i].personalize_settings_name, g_settings.personalize[i]); - configfile.setInt32( "contrast_fonts", g_settings.contrast_fonts ); //network for(int i=0 ; i < NETWORK_NFS_NR_OF_ENTRIES ; i++) { sprintf(cfg_key, "network_nfs_ip_%d", i); diff --git a/src/system/locals.h b/src/system/locals.h index cebda5393..05c523765 100644 --- a/src/system/locals.h +++ b/src/system/locals.h @@ -375,7 +375,6 @@ typedef enum LOCALE_COLORMENU_ADVANCED_MODE_ON, LOCALE_COLORMENU_BACKGROUND, LOCALE_COLORMENU_CLOCK_TEXTCOLOR, - LOCALE_COLORMENU_CONTRAST_FONTS, LOCALE_COLORMENU_FADE, LOCALE_COLORMENU_FONT, LOCALE_COLORMENU_FONT_TTX, @@ -1169,7 +1168,6 @@ typedef enum LOCALE_MENU_HINT_COLORS, LOCALE_MENU_HINT_CONTENT_BACK, LOCALE_MENU_HINT_CONTENT_TEXTCOLOR, - LOCALE_MENU_HINT_CONTRAST_FONTS, LOCALE_MENU_HINT_DBOXINFO, LOCALE_MENU_HINT_DELETE_CHANNELS, LOCALE_MENU_HINT_DELETE_REMOVED, diff --git a/src/system/locals_intern.h b/src/system/locals_intern.h index 0bf865bcd..a899aead7 100644 --- a/src/system/locals_intern.h +++ b/src/system/locals_intern.h @@ -375,7 +375,6 @@ const char * locale_real_names[] = "colormenu.advanced_mode_on", "colormenu.background", "colormenu.clock_textcolor", - "colormenu.contrast_fonts", "colormenu.fade", "colormenu.font", "colormenu.font_ttx", @@ -1169,7 +1168,6 @@ const char * locale_real_names[] = "menu.hint_colors", "menu.hint_content_back", "menu.hint_content_textcolor", - "menu.hint_contrast_fonts", "menu.hint_dboxinfo", "menu.hint_delete_channels", "menu.hint_delete_removed", diff --git a/src/system/mtdutils/compr.cpp b/src/system/mtdutils/compr.cpp index 898d550b6..b1e0d9f15 100644 --- a/src/system/mtdutils/compr.cpp +++ b/src/system/mtdutils/compr.cpp @@ -60,11 +60,17 @@ static inline void list_del(struct list_head *entry) #define list_entry(ptr, type, member) \ ((type *)((char *)(ptr)-(unsigned long)(&((type *)0)->member))) +#if __cplusplus < 201103 #define list_for_each_entry(pos, head, member) \ for (pos = list_entry((head)->next, typeof(*pos), member); \ &pos->member != (head); \ pos = list_entry(pos->member.next, typeof(*pos), member)) - +#else +#define list_for_each_entry(pos, head, member) \ + for (pos = list_entry((head)->next, __typeof__(*pos), member); \ + &pos->member != (head); \ + pos = list_entry(pos->member.next, __typeof__(*pos), member)) +#endif /* Available compressors are on this_ list */ static LIST_HEAD(jffs2_compressor_list); diff --git a/src/system/mtdutils/compr_zlib.cpp b/src/system/mtdutils/compr_zlib.cpp index 717053fc1..0f9598ec5 100644 --- a/src/system/mtdutils/compr_zlib.cpp +++ b/src/system/mtdutils/compr_zlib.cpp @@ -44,6 +44,9 @@ #include "common.h" #include "compr.h" +#if __cplusplus >= 201103 +#include "algorithm" +#endif /* Plan: call deflate() with avail_in == *sourcelen, avail_out = *dstlen - 12 and flush == Z_FINISH. If it doesn't manage to finish, call it again with @@ -76,7 +79,11 @@ static int jffs2_zlib_compress(unsigned char *data_in, unsigned char *cpage_out, while (strm.total_out < *dstlen - STREAM_END_SPACE && strm.total_in < *sourcelen) { strm.avail_out = *dstlen - (strm.total_out + STREAM_END_SPACE); +#if __cplusplus < 201103 strm.avail_in = min((unsigned)(*sourcelen-strm.total_in), strm.avail_out); +#else + strm.avail_in = std::min((unsigned)(*sourcelen-strm.total_in), strm.avail_out); +#endif ret = deflate(&strm, Z_PARTIAL_FLUSH); if (ret != Z_OK) { deflateEnd(&strm); diff --git a/src/system/mtdutils/include/common.h b/src/system/mtdutils/include/common.h index d70f49b02..1825ebc9b 100644 --- a/src/system/mtdutils/include/common.h +++ b/src/system/mtdutils/include/common.h @@ -37,13 +37,15 @@ extern "C" { #endif -#ifndef MIN /* some C lib headers define this for us */ +#if __cplusplus < 201103 +#ifndef MIN /* some C lib headers define this for us */ #define MIN(a, b) ((a) < (b) ? (a) : (b)) #endif #ifndef MAX #define MAX(a, b) ((a) > (b) ? (a) : (b)) #endif #define min(a, b) MIN(a, b) /* glue for linux kernel source */ +#endif #define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0])) #ifndef O_CLOEXEC diff --git a/src/system/mtdutils/mkfs.jffs2.cpp b/src/system/mtdutils/mkfs.jffs2.cpp index d8e1bbaf9..3a5906a58 100644 --- a/src/system/mtdutils/mkfs.jffs2.cpp +++ b/src/system/mtdutils/mkfs.jffs2.cpp @@ -66,6 +66,9 @@ #include #include +#if __cplusplus >= 201103 +#include +#endif #include #ifdef HAVE_CONFIG_H @@ -759,7 +762,11 @@ void CMkfsJFFS2::pad_block_if_less_than(int req) void CMkfsJFFS2::padblock(void) { while (out_ofs % erase_block_size) { +#if __cplusplus < 201103 full_write(out_fd, ffbuf, min(sizeof(ffbuf), +#else + full_write(out_fd, ffbuf, std::min(sizeof(ffbuf), +#endif (size_t)(erase_block_size - (out_ofs % erase_block_size)))); } } @@ -872,7 +879,11 @@ void CMkfsJFFS2::create_target_filesystem(struct filesystem_entry *root) } } else { while (out_ofs < pad_fs_size) { +#if __cplusplus < 201103 full_write(out_fd, ffbuf, min(sizeof(ffbuf), (size_t)(pad_fs_size - out_ofs))); +#else + full_write(out_fd, ffbuf, std::min(sizeof(ffbuf), (size_t)(pad_fs_size - out_ofs))); +#endif } } diff --git a/src/system/mtdutils/rbtree.h b/src/system/mtdutils/rbtree.h index 0c5345b82..6843832a2 100644 --- a/src/system/mtdutils/rbtree.h +++ b/src/system/mtdutils/rbtree.h @@ -136,9 +136,15 @@ static inline void rb_set_color(struct rb_node *rb, int color) #define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER) #endif +#if __cplusplus < 201103 #define container_of(ptr, type, member) ({ \ const typeof( ((type *)0)->member ) *__mptr = (ptr); \ (type *)( (char *)__mptr - offsetof(type,member) );}) +#else +#define container_of(ptr, type, member) ({ \ + const __typeof__( ((type *)0)->member ) *__mptr = (ptr); \ + (type *)( (char *)__mptr - offsetof(type,member) );}) +#endif #define rb_entry(ptr, type, member) container_of(ptr, type, member) diff --git a/src/system/settings.h b/src/system/settings.h index b9800645b..5d73f3e9e 100644 --- a/src/system/settings.h +++ b/src/system/settings.h @@ -442,8 +442,6 @@ struct SNeutrinoSettings SNeutrinoTheme theme; bool osd_colorsettings_advanced_mode; - int contrast_fonts; - //network #define NETWORK_NFS_NR_OF_ENTRIES 8 struct {