From 70c0b2ae5e63eebdcdca30f868d8421957297dd1 Mon Sep 17 00:00:00 2001 From: vanhofen Date: Tue, 24 Jan 2017 14:41:30 +0100 Subject: [PATCH 01/32] CTextBox::refreshText: Fix flags for RenderString() v2.0; thx to DboxOldie Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/4cfff44e29fc275fea32e3cb0df3f820df4755fa Author: vanhofen Date: 2017-01-24 (Tue, 24 Jan 2017) --- src/gui/widget/textbox.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/widget/textbox.cpp b/src/gui/widget/textbox.cpp index 4750de544..cb8bbb1e0 100644 --- a/src/gui/widget/textbox.cpp +++ b/src/gui/widget/textbox.cpp @@ -713,7 +713,7 @@ 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_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; y += m_nFontTextHeight; } From eeb63fa6c8fa0b413db83b9fdc66abdaf95e28b8 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Sat, 21 Jan 2017 20:42:58 +0100 Subject: [PATCH 02/32] CComponentsHeader: fix order inside overloaded methode setCaption() Stop() was never touched with string version of setCaption() Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/5b51f2277ba624b62b0c58f4c2ed93ca6c9e39a5 Author: Thilo Graf Date: 2017-01-21 (Sat, 21 Jan 2017) --- src/gui/components/cc_frm_header.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gui/components/cc_frm_header.cpp b/src/gui/components/cc_frm_header.cpp index 7f36522c4..faef78453 100644 --- a/src/gui/components/cc_frm_header.cpp +++ b/src/gui/components/cc_frm_header.cpp @@ -146,6 +146,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 +155,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); } From 35703884e1f689f078279755e09c82ee8163516f Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Mon, 23 Jan 2017 15:54:53 +0100 Subject: [PATCH 03/32] CComponentsText: fix wrong item type Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/e043cfacca447e056e3846e173d036d887fa4e9f Author: Thilo Graf Date: 2017-01-23 (Mon, 23 Jan 2017) --- src/gui/components/cc_item_text.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/components/cc_item_text.cpp b/src/gui/components/cc_item_text.cpp index f56733584..828b0033f 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; From 176174c4e55be33d6740b4ede13daaaa3bba12aa Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Mon, 23 Jan 2017 15:55:38 +0100 Subject: [PATCH 04/32] cc_types.h: remove obsolete type enums Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/1d0ebf239ad2eab1516e4138d7ef4bc6a1a0d75c Author: Thilo Graf Date: 2017-01-23 (Mon, 23 Jan 2017) --- src/gui/components/cc_types.h | 8 -------- 1 file changed, 8 deletions(-) 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; From ec017b0782d7e4cd6c22703c1311c3c2b5710cce Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Mon, 23 Jan 2017 19:24:17 +0100 Subject: [PATCH 05/32] CComponentsLabel: Added missing overloaded counterpart to CComponentsText(parent) constructor. Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/f3d6c3e9641cc345f59968776bdcf467350b79c2 Author: Thilo Graf Date: 2017-01-23 (Mon, 23 Jan 2017) --- src/gui/components/cc_item_text.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/gui/components/cc_item_text.h b/src/gui/components/cc_item_text.h index 7bd5f6372..a8105e1a0 100644 --- a/src/gui/components/cc_item_text.h +++ b/src/gui/components/cc_item_text.h @@ -277,6 +277,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 From 356c6d87496ed1f799d83690a29a3dc8ada4def0 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Mon, 23 Jan 2017 20:34:54 +0100 Subject: [PATCH 06/32] CCDraw: simplified statement for blink init Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/82d39dd09f5640c89e133a94ca4b7e5866ecfffb Author: Thilo Graf Date: 2017-01-23 (Mon, 23 Jan 2017) --- src/gui/components/cc_draw.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/gui/components/cc_draw.cpp b/src/gui/components/cc_draw.cpp index 54acff507..10f00d890 100644 --- a/src/gui/components/cc_draw.cpp +++ b/src/gui/components/cc_draw.cpp @@ -732,10 +732,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) From 07ff5a7e350254122b75082df6544fa72de186f3 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Mon, 23 Jan 2017 21:58:42 +0100 Subject: [PATCH 07/32] CBuildInfo: move InitInfoItems() into exec() ensures paint of data on each repaint. Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/93319f258ec4e1fe5321c9d4c7a7053fe63245d3 Author: Thilo Graf Date: 2017-01-23 (Mon, 23 Jan 2017) --- src/gui/buildinfo.cpp | 11 ++++++++--- src/gui/buildinfo.h | 2 +- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/gui/buildinfo.cpp b/src/gui/buildinfo.cpp index 782edc07e..23f81f85b 100644 --- a/src/gui/buildinfo.cpp +++ b/src/gui/buildinfo.cpp @@ -35,9 +35,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 @@ -47,7 +51,6 @@ void CBuildInfo::initVarBuildInfo() font = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_HINT]; setWindowHeaderButtons(CComponentsHeader::CC_BTN_MENU | CComponentsHeader::CC_BTN_EXIT); - InitInfoItems(); shadow = true; @@ -60,7 +63,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); From 495dcac36613d9ecec521af6dac1c154558fb44f Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Mon, 23 Jan 2017 21:59:29 +0100 Subject: [PATCH 08/32] CTestMenu: fix blink of extended text sample Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/3c9742c8da020f68ad68055efa6f1c90cd3f4855 Author: Thilo Graf Date: 2017-01-23 (Mon, 23 Jan 2017) --- src/gui/test_menu.cpp | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/gui/test_menu.cpp b/src/gui/test_menu.cpp index bdaa04996..7afb93eb4 100644 --- a/src/gui/test_menu.cpp +++ b/src/gui/test_menu.cpp @@ -560,7 +560,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/*%*/); @@ -577,15 +577,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; From 222920f2996c2d72a65726aabd792d2a8b6e8912 Mon Sep 17 00:00:00 2001 From: Michael Liebmann Date: Tue, 24 Jan 2017 22:33:20 +0100 Subject: [PATCH 09/32] fontrenderer: Rework rendering for better font presentation - For the correct use of the changes should be built freetype with the following settings: #define FT_CONFIG_OPTION_SUBPIXEL_RENDERING #define TT_CONFIG_OPTION_SUBPIXEL_HINTING BS-Patch for freetype 2.5-2.7 ----------------------------- ** include/freetype/config/ftoption.h ** -/* #define FT_CONFIG_OPTION_SUBPIXEL_RENDERING */ +#define FT_CONFIG_OPTION_SUBPIXEL_RENDERING -/* #define TT_CONFIG_OPTION_SUBPIXEL_HINTING */ +#define TT_CONFIG_OPTION_SUBPIXEL_HINTING BS-Patch for freetype 2.7.1 --------------------------- ** include/freetype/config/ftoption.h ** -/* #define FT_CONFIG_OPTION_SUBPIXEL_RENDERING */ +#define FT_CONFIG_OPTION_SUBPIXEL_RENDERING Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/39af509f48f6a6df13d6e3ad36a8fe8aa03e7856 Author: Michael Liebmann Date: 2017-01-24 (Tue, 24 Jan 2017) Origin message was: ------------------ fontrenderer: Rework rendering for better font presentation - For the correct use of the changes should be built freetype with the following settings: #define FT_CONFIG_OPTION_SUBPIXEL_RENDERING #define TT_CONFIG_OPTION_SUBPIXEL_HINTING BS-Patch for freetype 2.5-2.7 ----------------------------- ** include/freetype/config/ftoption.h ** -/* #define FT_CONFIG_OPTION_SUBPIXEL_RENDERING */ +#define FT_CONFIG_OPTION_SUBPIXEL_RENDERING -/* #define TT_CONFIG_OPTION_SUBPIXEL_HINTING */ +#define TT_CONFIG_OPTION_SUBPIXEL_HINTING BS-Patch for freetype 2.7.1 --------------------------- ** include/freetype/config/ftoption.h ** -/* #define FT_CONFIG_OPTION_SUBPIXEL_RENDERING */ +#define FT_CONFIG_OPTION_SUBPIXEL_RENDERING --- src/driver/fontrenderer.cpp | 157 +++++++++++++++++------------------- src/driver/fontrenderer.h | 7 +- src/gui/widget/textbox.cpp | 2 +- 3 files changed, 79 insertions(+), 87 deletions(-) diff --git a/src/driver/fontrenderer.cpp b/src/driver/fontrenderer.cpp index d43684626..a9a547cdb 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/gui/widget/textbox.cpp b/src/gui/widget/textbox.cpp index cb8bbb1e0..4750de544 100644 --- a/src/gui/widget/textbox.cpp +++ b/src/gui/widget/textbox.cpp @@ -713,7 +713,7 @@ 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_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; y += m_nFontTextHeight; } From a2f8b4d8f5634c37f2619229615658fbfa3a3a25 Mon Sep 17 00:00:00 2001 From: Michael Liebmann Date: Tue, 24 Jan 2017 22:33:23 +0100 Subject: [PATCH 10/32] screensaver: Use black background for the clock Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/88c38030abc3bebc6f590324a2d4aadd41e2f2fd Author: Michael Liebmann Date: 2017-01-24 (Tue, 24 Jan 2017) --- src/gui/screensaver.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/gui/screensaver.cpp b/src/gui/screensaver.cpp index 1ded487eb..7c3b50b5a 100644 --- a/src/gui/screensaver.cpp +++ b/src/gui/screensaver.cpp @@ -270,10 +270,11 @@ void CScreenSaver::paint() } else{ if (!scr_clock){ - scr_clock = new CComponentsFrmClock(1, 1, NULL, "%H:%M:%S", "%H:%M %S", true); + scr_clock = new CComponentsFrmClock(1, 1, NULL, "%H:%M:%S", "%H:%M %S", true, + 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(); From 5d96f62893d90846bac7999b8aaefbab6c21f434 Mon Sep 17 00:00:00 2001 From: Michael Liebmann Date: Tue, 24 Jan 2017 22:33:27 +0100 Subject: [PATCH 11/32] Remove obsolete 'contrast_fonts' code from osd menu Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/c741d46b63235605b7ce4d4ab4341478ceffcdd5 Author: Michael Liebmann Date: 2017-01-24 (Tue, 24 Jan 2017) --- data/locale/deutsch.locale | 2 -- data/locale/english.locale | 2 -- data/locale/nederlands.locale | 2 -- data/locale/slovak.locale | 2 -- data/locale/unmaintained/czech.locale | 2 -- data/locale/unmaintained/polski.locale | 2 -- src/gui/osd_setup.cpp | 9 +-------- src/neutrino.cpp | 3 --- src/system/locals.h | 2 -- src/system/locals_intern.h | 2 -- src/system/settings.h | 2 -- 11 files changed, 1 insertion(+), 29 deletions(-) diff --git a/data/locale/deutsch.locale b/data/locale/deutsch.locale index ad5fe2adf..a1715b44f 100644 --- a/data/locale/deutsch.locale +++ b/data/locale/deutsch.locale @@ -319,7 +319,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 @@ -1030,7 +1029,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 5b3f6e6e4..4feae3a1e 100644 --- a/data/locale/english.locale +++ b/data/locale/english.locale @@ -319,7 +319,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 @@ -1030,7 +1029,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/src/gui/osd_setup.cpp b/src/gui/osd_setup.cpp index 698ac5110..e45a11730 100644 --- a/src/gui/osd_setup.cpp +++ b/src/gui/osd_setup.cpp @@ -971,11 +971,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 @@ -1323,9 +1318,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/neutrino.cpp b/src/neutrino.cpp index 19593cbdd..5cc589f79 100644 --- a/src/neutrino.cpp +++ b/src/neutrino.cpp @@ -575,8 +575,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)); @@ -1187,7 +1185,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 18546341d..b74b90eb8 100644 --- a/src/system/locals.h +++ b/src/system/locals.h @@ -346,7 +346,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, @@ -1057,7 +1056,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 f2d76e08d..b3b18075b 100644 --- a/src/system/locals_intern.h +++ b/src/system/locals_intern.h @@ -346,7 +346,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", @@ -1057,7 +1056,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/settings.h b/src/system/settings.h index 6d8bb8dc7..8d0e53e71 100644 --- a/src/system/settings.h +++ b/src/system/settings.h @@ -422,8 +422,6 @@ struct SNeutrinoSettings SNeutrinoTheme theme; bool osd_colorsettings_advanced_mode; - int contrast_fonts; - //network #define NETWORK_NFS_NR_OF_ENTRIES 8 struct { From 1a8a2d8157270c4626c1aab9598b2971cc034c2f Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Tue, 10 Jan 2017 23:21:55 +0100 Subject: [PATCH 12/32] CTextBox: paint bg always if pixbuffer exists Should prevent unintended possible overlap on multiple font render. Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/f3aa955de78e86d308b5773f2050fa07768c1aaa Author: Thilo Graf Date: 2017-01-10 (Tue, 10 Jan 2017) --- src/gui/widget/textbox.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/gui/widget/textbox.cpp b/src/gui/widget/textbox.cpp index 4750de544..7550b9ae0 100644 --- a/src/gui/widget/textbox.cpp +++ b/src/gui/widget/textbox.cpp @@ -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(); } From bf40c93ea63df6b9123a5be54534ad987bcf0721 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Mon, 16 Jan 2017 12:10:14 +0100 Subject: [PATCH 13/32] CTextBox: remove text reinit from reInitToCompareVar() Will be already done after each text render. Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/db2157b2e0aac5af6b5afd9a266ec8766642840b Author: Thilo Graf Date: 2017-01-16 (Mon, 16 Jan 2017) --- src/gui/widget/textbox.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/gui/widget/textbox.cpp b/src/gui/widget/textbox.cpp index 7550b9ae0..a8de598e5 100644 --- a/src/gui/widget/textbox.cpp +++ b/src/gui/widget/textbox.cpp @@ -573,7 +573,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) From a5ea68a454ae0446dcb8d44e7ec37f1cda33b4cd Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Tue, 24 Jan 2017 23:14:37 +0100 Subject: [PATCH 14/32] CTextBox: add attribut 'm_bg_painted' Shoul help in together with changed text content to control required text render. Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/f26ac43adeb5cf1343576c2c8cee938d91503d0c Author: Thilo Graf Date: 2017-01-24 (Tue, 24 Jan 2017) --- src/gui/widget/textbox.cpp | 5 ++++- src/gui/widget/textbox.h | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/gui/widget/textbox.cpp b/src/gui/widget/textbox.cpp index a8de598e5..a463812af 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; @@ -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,7 +715,8 @@ 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)); + 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)); m_old_cText = m_cText; y += m_nFontTextHeight; } 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; From bcb9c4945643eb609ad12bd94b79a3537446623d Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Tue, 17 Jan 2017 08:53:12 +0100 Subject: [PATCH 15/32] CTextBox: rework return control of value of setText() function value was not clearly, hope i'ts now Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/3a821a0a74c181eca8ae27e71f165969e00cd38e Author: Thilo Graf Date: 2017-01-17 (Tue, 17 Jan 2017) --- src/gui/widget/textbox.cpp | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/src/gui/widget/textbox.cpp b/src/gui/widget/textbox.cpp index a463812af..72a02bb3a 100644 --- a/src/gui/widget/textbox.cpp +++ b/src/gui/widget/textbox.cpp @@ -786,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) From 12eb2e103231a5ded9cc65c966fffd9e56b2566e Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Wed, 18 Jan 2017 09:45:47 +0100 Subject: [PATCH 16/32] CCDraw: add signal OnAfterPaintBg Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/2c8df11337eacd7ca298433d2a1884d554e874d4 Author: Thilo Graf Date: 2017-01-18 (Wed, 18 Jan 2017) --- src/gui/components/cc_draw.cpp | 1 + src/gui/components/cc_draw.h | 6 ++++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/gui/components/cc_draw.cpp b/src/gui/components/cc_draw.cpp index 10f00d890..eedd3c3f1 100644 --- a/src/gui/components/cc_draw.cpp +++ b/src/gui/components/cc_draw.cpp @@ -630,6 +630,7 @@ void CCDraw::paintFbItems(bool do_save_bg) } } is_painted = v_fbdata[i].is_painted = true; + OnAfterPaintBg(); } } } diff --git a/src/gui/components/cc_draw.h b/src/gui/components/cc_draw.h index dd99986fa..47702562f 100644 --- a/src/gui/components/cc_draw.h +++ b/src/gui/components/cc_draw.h @@ -353,10 +353,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 From 852bcfe5dbf5ae359ffe12e7181cb83e2d7c2a26 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Wed, 18 Jan 2017 11:59:21 +0100 Subject: [PATCH 17/32] CComponentsFrmClock: add slot to handle enforced repaint of segments If clock removed from screen and instance is not destroyed, then we must ensure repaint of segments after painted background. This is required if segments are only will paint if their content was changed and attribut ct_force_text_paint = false. Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/c686e7e53cd64ff054bba819763bf3a8482b2b16 Author: Thilo Graf Date: 2017-01-18 (Wed, 18 Jan 2017) --- src/gui/components/cc_frm_clock.cpp | 25 ++++++++++++++++++------- src/gui/components/cc_frm_clock.h | 7 ++++++- 2 files changed, 24 insertions(+), 8 deletions(-) diff --git a/src/gui/components/cc_frm_clock.cpp b/src/gui/components/cc_frm_clock.cpp index d1a9cbc7a..ff5a7c9be 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 + cl_sl_repaint = sigc::bind<0>(sigc::mem_fun1(*this, &CComponentsFrmClock::forceSegemnentsPaint), 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); } + + //init slot to handle repaint of segments if background was repainted + OnAfterPaintBg.clear(); + if (paint_bg) + OnAfterPaintBg.connect(cl_sl_repaint); } @@ -321,7 +329,7 @@ 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); } } cl_timer->setTimerInterval(cl_interval); @@ -338,6 +346,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; @@ -374,10 +383,6 @@ void CComponentsFrmClock::paint(bool do_save_bg) //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) @@ -450,3 +455,9 @@ bool CComponentsFrmClock::enableColBodyGradient(const int& enable_mode, const fb } return false; } + +void CComponentsFrmClock::forceSegemnentsPaint(bool force) +{ + for (size_t i = 0; i < v_cc_items.size(); i++) + static_cast (v_cc_items[i])->forceTextPaint(force); +} diff --git a/src/gui/components/cc_frm_clock.h b/src/gui/components/cc_frm_clock.h index ddc5abbbb..89ed33e91 100644 --- a/src/gui/components/cc_frm_clock.h +++ b/src/gui/components/cc_frm_clock.h @@ -52,7 +52,10 @@ class CComponentsFrmClock : public CComponentsForm, public CCTextScreen protected: ///slot for timer event, reserved for ShowTime() - sigc::slot0 cl_sl; + sigc::slot0 cl_sl_show; + + ///slot for background paint event, reserved for initCCLockItems() + sigc::slot0 cl_sl_repaint; ///refresh interval in seconds int cl_interval; @@ -90,6 +93,8 @@ class CComponentsFrmClock : public CComponentsForm, public CCTextScreen void toggleFormat(); ///init internal font void initClockFont(int dx, int dy); + ///force repaint of all segments + void forceSegemnentsPaint(bool force); public: From 5db78a62842168c97ef1fcda5f4836acbbf4448a Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Tue, 24 Jan 2017 23:17:59 +0100 Subject: [PATCH 18/32] CTextBox: fix m_old_cText update after text paint refreshText() executes loop also for text with more than one line and m_old_cText attribut should be updated only if loop is ready. Otherwise in text boxes with more than one line, only first line would be painted. Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/0e5cfe4705660cb7c5c833b7dee8e046ccc3bd70 Author: Thilo Graf Date: 2017-01-24 (Tue, 24 Jan 2017) --- src/gui/widget/textbox.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/widget/textbox.cpp b/src/gui/widget/textbox.cpp index 72a02bb3a..05602cbbd 100644 --- a/src/gui/widget/textbox.cpp +++ b/src/gui/widget/textbox.cpp @@ -717,9 +717,9 @@ void CTextBox::refreshText(void) //TRACE("[CTextBox] %s Line %d m_cFrame.iX %d m_cFrameTextRel.iX %d\r\n", __FUNCTION__, __LINE__, m_cFrame.iX, m_cFrameTextRel.iX); 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)); - m_old_cText = m_cText; y += m_nFontTextHeight; } + m_old_cText = m_cText; } void CTextBox::scrollPageDown(const int pages) From 858fdd6320f0bc7c2f7fe6e042dfc1e356ae48cd Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Thu, 19 Jan 2017 09:15:49 +0100 Subject: [PATCH 19/32] Experimental try to rework isPainted() Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/9d3a9685064c199dd7910e9f1dd30f199af052a5 Author: Thilo Graf Date: 2017-01-19 (Thu, 19 Jan 2017) --- src/gui/components/cc_draw.cpp | 22 +++++++++++++++++++--- src/gui/components/cc_draw.h | 4 ++-- src/gui/components/cc_frm.cpp | 3 ++- src/gui/components/cc_frm_header.cpp | 6 ++++-- src/gui/infoclock.cpp | 1 + src/gui/infoviewer.cpp | 1 + 6 files changed, 29 insertions(+), 8 deletions(-) diff --git a/src/gui/components/cc_draw.cpp b/src/gui/components/cc_draw.cpp index eedd3c3f1..87cec83a1 100644 --- a/src/gui/components/cc_draw.cpp +++ b/src/gui/components/cc_draw.cpp @@ -629,16 +629,32 @@ 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; + is_painted = isPainted(); + //pick up signal if filled OnAfterPaintLayers(); } + bool CCDraw::isPainted() + { + if (firstPaint) + return false; + + for(size_t i=0; i< v_fbdata.size(); i++) + if (v_fbdata[i].is_painted) + return true; + + return false; + } + void CCDraw::hide() { OnBeforeHide(); @@ -653,8 +669,8 @@ void CCDraw::hide() } } } - is_painted = false; firstPaint = true; + is_painted = isPainted(); OnAfterHide(); } @@ -700,7 +716,7 @@ void CCDraw::kill(const fb_pixel_t& bg_color, const int& corner_radius, const in if (fblayer_type == CC_FBDATA_TYPES){ firstPaint = true; - is_painted = false; + is_painted = isPainted(); } } diff --git a/src/gui/components/cc_draw.h b/src/gui/components/cc_draw.h index 47702562f..4220ec5a3 100644 --- a/src/gui/components/cc_draw.h +++ b/src/gui/components/cc_draw.h @@ -114,7 +114,7 @@ class CCDraw : public COSDFader, public CComponentsSignals ///status: true=component was painted for 1st time bool firstPaint; ///status: true=component was rendered - bool is_painted; +// bool is_painted; ///mode: true=activate rendering of basic elements (frame, shadow and body) bool paint_bg; ///mode: true=activate rendering of frame @@ -268,7 +268,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 diff --git a/src/gui/components/cc_frm.cpp b/src/gui/components/cc_frm.cpp index 5bba0af59..d8b132529 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) + paintInit(do_save_bg); //paint paintCCItems(); diff --git a/src/gui/components/cc_frm_header.cpp b/src/gui/components/cc_frm_header.cpp index faef78453..28953cc17 100644 --- a/src/gui/components/cc_frm_header.cpp +++ b/src/gui/components/cc_frm_header.cpp @@ -362,10 +362,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); @@ -544,7 +546,7 @@ void CComponentsHeader::paint(bool do_save_bg) initCCItems(); //paint form contents - paintForm(do_save_bg); + CComponentsForm::paint(do_save_bg); //start clock if enabled if (cch_cl_obj){ 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 aac4cdc7e..c40439fbc 100644 --- a/src/gui/infoviewer.cpp +++ b/src/gui/infoviewer.cpp @@ -252,6 +252,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); From f6bd4f70904aaba038d4f502f252bc122699a920 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Tue, 24 Jan 2017 23:21:24 +0100 Subject: [PATCH 20/32] CTestMenu: fix icon container was not removed from screen Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/9266635917858acb1d8cc3d377ec3707eac41795 Author: Thilo Graf Date: 2017-01-24 (Tue, 24 Jan 2017) --- src/gui/test_menu.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/gui/test_menu.cpp b/src/gui/test_menu.cpp index 7afb93eb4..44c9b3722 100644 --- a/src/gui/test_menu.cpp +++ b/src/gui/test_menu.cpp @@ -733,6 +733,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"){ From 0a5c05bf1cc89fe39dc36021893f3ea0827ae73f Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Tue, 24 Jan 2017 23:23:13 +0100 Subject: [PATCH 21/32] CComponentsText: fix order of paint init Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/f4861601fdec55bd631b43945140023ebfc2b0c3 Author: Thilo Graf Date: 2017-01-24 (Tue, 24 Jan 2017) --- src/gui/components/cc_item_text.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/gui/components/cc_item_text.cpp b/src/gui/components/cc_item_text.cpp index 828b0033f..907264dc2 100644 --- a/src/gui/components/cc_item_text.cpp +++ b/src/gui/components/cc_item_text.cpp @@ -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,12 @@ bool CComponentsText::setTextFromFile(const string& path_to_textfile, const int void CComponentsText::paintText(bool do_save_bg) { - paintInit(do_save_bg); initCCText(); + paintInit(do_save_bg); if (ct_text_sent && cc_allow_paint) ct_textbox->paint(); + ct_text_sent = false; } From 3da33900c6ad5aa44979e3471882294a1eb8d3cb Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Tue, 24 Jan 2017 23:25:20 +0100 Subject: [PATCH 22/32] CCDraw: add new attribut force_paint_bg should help for some repaint actions Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/39735dc51b6f4dbfa3ca79706020ae6cc1d97665 Author: Thilo Graf Date: 2017-01-24 (Tue, 24 Jan 2017) --- src/gui/components/cc_draw.cpp | 36 ++++++++++++++++++++-------------- src/gui/components/cc_draw.h | 4 +++- 2 files changed, 24 insertions(+), 16 deletions(-) diff --git a/src/gui/components/cc_draw.cpp b/src/gui/components/cc_draw.cpp index 87cec83a1..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 @@ -637,23 +638,28 @@ void CCDraw::paintFbItems(bool do_save_bg) } //set is_painted attribut. if any layer was painted set it to true; - is_painted = isPainted(); + 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() - { - if (firstPaint) - return false; - - for(size_t i=0; i< v_fbdata.size(); i++) - if (v_fbdata[i].is_painted) - return true; - - return false; - } +bool CCDraw::isPainted() +{ + return is_painted; +} void CCDraw::hide() { @@ -670,7 +676,7 @@ void CCDraw::hide() } } firstPaint = true; - is_painted = isPainted(); + is_painted = false; OnAfterHide(); } @@ -716,7 +722,7 @@ void CCDraw::kill(const fb_pixel_t& bg_color, const int& corner_radius, const in if (fblayer_type == CC_FBDATA_TYPES){ firstPaint = true; - is_painted = isPainted(); + is_painted = false; } } diff --git a/src/gui/components/cc_draw.h b/src/gui/components/cc_draw.h index 4220ec5a3..a7d442e86 100644 --- a/src/gui/components/cc_draw.h +++ b/src/gui/components/cc_draw.h @@ -114,7 +114,9 @@ class CCDraw : public COSDFader, public CComponentsSignals ///status: true=component was painted for 1st time bool firstPaint; ///status: true=component was rendered -// bool is_painted; + 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 From 5c4e0a25e87a692b144f12b45d235a6f7de263c8 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Tue, 24 Jan 2017 23:27:44 +0100 Subject: [PATCH 23/32] CComponentsForm: add some usefull slots/signal to help paint backgrounds Requried to paint form items only on changed contents and on repaint Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/7e6cbe54108e7d7fcbae8ee85125ef8d37a6f3f2 Author: Thilo Graf Date: 2017-01-24 (Tue, 24 Jan 2017) --- src/gui/components/cc_frm.cpp | 36 +++++++++++++++------------- src/gui/components/cc_frm.h | 5 ++++ src/gui/components/cc_frm_clock.cpp | 19 +++++++-------- src/gui/components/cc_frm_clock.h | 5 ---- src/gui/components/cc_frm_header.cpp | 15 ++++++++++-- 5 files changed, 46 insertions(+), 34 deletions(-) diff --git a/src/gui/components/cc_frm.cpp b/src/gui/components/cc_frm.cpp index d8b132529..049f6ca45 100644 --- a/src/gui/components/cc_frm.cpp +++ b/src/gui/components/cc_frm.cpp @@ -335,7 +335,7 @@ void CComponentsForm::exchangeCCItem(CComponentsItem* item_a, CComponentsItem* i void CComponentsForm::paintForm(bool do_save_bg) { //paint body - if (!is_painted) + if (!is_painted || force_paint_bg) paintInit(do_save_bg); //paint @@ -520,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) { @@ -693,3 +677,21 @@ bool CComponentsForm::enableColBodyGradient(const int& enable_mode, const fb_pix } return false; } + +void CComponentsForm::forceItemsPaint(bool force) +{ + dprintf(DEBUG_NORMAL, "\033[33m[CComponentsForm] [%s - %d] try to detect items [%u] with possible required background repaint \033[0m\n", __func__, __LINE__, v_cc_items.size()); + for (size_t i = 0; i < v_cc_items.size(); i++){ + dprintf(DEBUG_NORMAL, "\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_NORMAL, "\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_NORMAL, "\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 ff5a7c9be..c3995318d 100644 --- a/src/gui/components/cc_frm_clock.cpp +++ b/src/gui/components/cc_frm_clock.cpp @@ -101,7 +101,7 @@ CComponentsFrmClock::CComponentsFrmClock( const int& x_pos, cl_sl_show = sigc::mem_fun0(*this, &CComponentsFrmClock::ShowTime); //init slot to ensure paint segments after painted background - cl_sl_repaint = sigc::bind<0>(sigc::mem_fun1(*this, &CComponentsFrmClock::forceSegemnentsPaint), true); + sl_repaint = sigc::bind<0>(sigc::mem_fun1(*this, &CComponentsFrmClock::forceItemsPaint), true); //run clock already if required if (activ) @@ -301,10 +301,10 @@ void CComponentsFrmClock::initCCLockItems() 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.clear(); - if (paint_bg) - OnAfterPaintBg.connect(cl_sl_repaint); + OnAfterPaintBg.connect(sl_repaint); } @@ -330,6 +330,7 @@ bool CComponentsFrmClock::startClock() 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_show); + force_paint_bg = true; } } cl_timer->setTimerInterval(cl_interval); @@ -381,8 +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); + } void CComponentsFrmClock::setClockFont(Font *font, const int& style) @@ -455,9 +460,3 @@ bool CComponentsFrmClock::enableColBodyGradient(const int& enable_mode, const fb } return false; } - -void CComponentsFrmClock::forceSegemnentsPaint(bool force) -{ - for (size_t i = 0; i < v_cc_items.size(); i++) - static_cast (v_cc_items[i])->forceTextPaint(force); -} diff --git a/src/gui/components/cc_frm_clock.h b/src/gui/components/cc_frm_clock.h index 89ed33e91..22da0af26 100644 --- a/src/gui/components/cc_frm_clock.h +++ b/src/gui/components/cc_frm_clock.h @@ -54,9 +54,6 @@ class CComponentsFrmClock : public CComponentsForm, public CCTextScreen ///slot for timer event, reserved for ShowTime() sigc::slot0 cl_sl_show; - ///slot for background paint event, reserved for initCCLockItems() - sigc::slot0 cl_sl_repaint; - ///refresh interval in seconds int cl_interval; @@ -93,8 +90,6 @@ class CComponentsFrmClock : public CComponentsForm, public CCTextScreen void toggleFormat(); ///init internal font void initClockFont(int dx, int dy); - ///force repaint of all segments - void forceSegemnentsPaint(bool force); public: diff --git a/src/gui/components/cc_frm_header.cpp b/src/gui/components/cc_frm_header.cpp index 28953cc17..c4ce04d37 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); @@ -517,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() @@ -539,12 +550,12 @@ void CComponentsHeader::initCCItems() //init text initCaption(); } - + void CComponentsHeader::paint(bool do_save_bg) { //prepare items initCCItems(); - + //paint form contents CComponentsForm::paint(do_save_bg); From 28f372724d309ae72f8918b01148ff4fa52d9d09 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Mon, 23 Jan 2017 20:37:47 +0100 Subject: [PATCH 24/32] CComponentsExtTextForm: init with gradient support and sl_repaint slot Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/40d90e862d2481629376dfa41dbdba5c916af702 Author: Thilo Graf Date: 2017-01-23 (Mon, 23 Jan 2017) --- src/gui/components/cc_frm_ext_text.cpp | 69 +++++++++++++++----------- 1 file changed, 40 insertions(+), 29 deletions(-) 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) From b702e6cb18b089e1e9d3d6ce1ff31b749e9e7321 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Mon, 23 Jan 2017 21:27:10 +0100 Subject: [PATCH 25/32] CComponentsText: add explicit kill methode and add ct_force_text_paint After hide or kill text will does not paint without ct_force_text_paint, so it is required to add this. Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/54e279fddc8c7476bb5336223cbe8871c2085bd6 Author: Thilo Graf Date: 2017-01-23 (Mon, 23 Jan 2017) --- src/gui/components/cc_item_text.cpp | 19 ++++++++++++++++--- src/gui/components/cc_item_text.h | 2 ++ 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/src/gui/components/cc_item_text.cpp b/src/gui/components/cc_item_text.cpp index 907264dc2..bd37e0d37 100644 --- a/src/gui/components/cc_item_text.cpp +++ b/src/gui/components/cc_item_text.cpp @@ -274,7 +274,8 @@ bool CComponentsText::setTextFromFile(const string& path_to_textfile, const int void CComponentsText::paintText(bool do_save_bg) { initCCText(); - paintInit(do_save_bg); + if (!is_painted) + paintInit(do_save_bg); if (ct_text_sent && cc_allow_paint) ct_textbox->paint(); @@ -291,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 a8105e1a0..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); From 22d5fb13d81ea942e201e23f957eb1161487d888 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Mon, 23 Jan 2017 21:28:54 +0100 Subject: [PATCH 26/32] CInfoViewer: enable kill text items after killed title This causes repaint text on next view of infobar. Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/fb541268f5930f9fc7391d95e7cf17529e70e44c Author: Thilo Graf Date: 2017-01-23 (Mon, 23 Jan 2017) --- src/gui/infoviewer.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gui/infoviewer.cpp b/src/gui/infoviewer.cpp index c40439fbc..9ac8c16b8 100644 --- a/src/gui/infoviewer.cpp +++ b/src/gui/infoviewer.cpp @@ -2169,7 +2169,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) @@ -2182,7 +2182,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(); From 0288c5f10b442cde6b72fdf0a3c3707e90c02537 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Mon, 23 Jan 2017 22:52:00 +0100 Subject: [PATCH 27/32] CImageInfo: prevent possible overpainting while switching of sub text caption Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/380b2be67c91f8a71bce3ef4983999d732a3df8b Author: Thilo Graf Date: 2017-01-23 (Mon, 23 Jan 2017) --- src/gui/imageinfo.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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); From 88b4296d56b7826309358481ceafdd2299028cc2 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Tue, 24 Jan 2017 15:57:12 +0100 Subject: [PATCH 28/32] CComponentsForm: remove debug spam Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/b881e27a559026f7f906a95626d115c1bad3f2af Author: Thilo Graf Date: 2017-01-24 (Tue, 24 Jan 2017) --- src/gui/components/cc_frm.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/gui/components/cc_frm.cpp b/src/gui/components/cc_frm.cpp index 049f6ca45..626fdff67 100644 --- a/src/gui/components/cc_frm.cpp +++ b/src/gui/components/cc_frm.cpp @@ -680,18 +680,17 @@ bool CComponentsForm::enableColBodyGradient(const int& enable_mode, const fb_pix void CComponentsForm::forceItemsPaint(bool force) { - dprintf(DEBUG_NORMAL, "\033[33m[CComponentsForm] [%s - %d] try to detect items [%u] with possible required background repaint \033[0m\n", __func__, __LINE__, v_cc_items.size()); for (size_t i = 0; i < v_cc_items.size(); i++){ - dprintf(DEBUG_NORMAL, "\033[33m[CComponentsForm] [%s - %d] found item type = [%d] \033[0m\n", __func__, __LINE__, v_cc_items[i]->getItemType()); + 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_NORMAL, "\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()); + 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_NORMAL, "\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()); + 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()); } } } From a71be1422b2463958106f3e899a783d5539e2f25 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Tue, 24 Jan 2017 22:14:15 +0100 Subject: [PATCH 29/32] CEventList: fix current channel position and ensure clean up header Current channel name was out of center and a clean up of header background was required because texts are only painted with transparent background and old texts are futher visible. Now we have a clean background before repaint logo or new channel names. Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/5e43b1f7e1698a8f0d1985b0b449ad80d9ef835a Author: Thilo Graf Date: 2017-01-24 (Tue, 24 Jan 2017) --- src/gui/eventlist.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/gui/eventlist.cpp b/src/gui/eventlist.cpp index 741ec77fd..76c771559 100644 --- a/src/gui/eventlist.cpp +++ b/src/gui/eventlist.cpp @@ -877,7 +877,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); } @@ -892,6 +894,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); } From 73ae38239cf8f3aa59829fe146cdd2c1db56dc5d Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Tue, 24 Jan 2017 22:56:18 +0100 Subject: [PATCH 30/32] CComponentsHeader: add missing paramters to kill methode Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/00163ba04e5d6a29fc09951e24f82a7ec970f8b9 Author: Thilo Graf Date: 2017-01-24 (Tue, 24 Jan 2017) --- src/gui/components/cc_frm_header.cpp | 11 +++++++++++ src/gui/components/cc_frm_header.h | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/gui/components/cc_frm_header.cpp b/src/gui/components/cc_frm_header.cpp index c4ce04d37..4c21bd560 100644 --- a/src/gui/components/cc_frm_header.cpp +++ b/src/gui/components/cc_frm_header.cpp @@ -577,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); From 627063e84318b67be82295a613599f05060410ed Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Tue, 24 Jan 2017 22:57:54 +0100 Subject: [PATCH 31/32] CChannelList: ensure repaint of new header content Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/2abd60e856a342c1387655e5f492ddfedbb359e5 Author: Thilo Graf Date: 2017-01-24 (Tue, 24 Jan 2017) --- src/gui/channellist.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/gui/channellist.cpp b/src/gui/channellist.cpp index a4d56cb47..8b89f8a85 100644 --- a/src/gui/channellist.cpp +++ b/src/gui/channellist.cpp @@ -2168,7 +2168,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() From 133aef7a2143f8f5ec362ab8d5c2d8b2a191a2c2 Mon Sep 17 00:00:00 2001 From: Michael Liebmann Date: Wed, 25 Jan 2017 08:50:54 +0100 Subject: [PATCH 32/32] CInfoViewer: Use flag Font::FULLBG for RenderString() dependent on g_settings.theme.infobar_gradient_* Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/2b24da376c949db7bd11c31b06b660cef45ad862 Author: Michael Liebmann Date: 2017-01-25 (Wed, 25 Jan 2017) --- src/gui/infoviewer.cpp | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/src/gui/infoviewer.cpp b/src/gui/infoviewer.cpp index 9ac8c16b8..da61e5cea 100644 --- a/src/gui/infoviewer.cpp +++ b/src/gui/infoviewer.cpp @@ -601,11 +601,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) @@ -661,7 +662,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); @@ -706,6 +707,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(); @@ -816,7 +818,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 */ @@ -835,14 +837,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); } } @@ -854,7 +856,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; @@ -871,7 +873,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); } } @@ -1635,6 +1637,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 )) { @@ -1657,7 +1660,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){