From 5d258a58dded2a131140907bc963693d3b33411f Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Sat, 19 Nov 2016 23:21:06 +0100 Subject: [PATCH 1/7] CSignalBar: remove offset for signal name and remove right allignment Text have more space, otherwise it's possible it can be truncated. Indent from left site of text don't looks not so good. Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/04a75327dd9ad38751b3ced326dd2cd074e803d2 Author: Thilo Graf Date: 2016-11-19 (Sat, 19 Nov 2016) --- src/gui/components/cc_frm_signalbars.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gui/components/cc_frm_signalbars.cpp b/src/gui/components/cc_frm_signalbars.cpp index 8677bf3e3..28728c6bf 100644 --- a/src/gui/components/cc_frm_signalbars.cpp +++ b/src/gui/components/cc_frm_signalbars.cpp @@ -175,12 +175,12 @@ void CSignalBar::initSBarName() sb_lbl->doPaintTextBoxBg(!cc_txt_save_screen); sb_lbl->enableTboxSaveScreen(cc_txt_save_screen); - sb_lbl->setText(sb_name, CTextBox::NO_AUTO_LINEBREAK | CTextBox::RIGHT, sb_font); + sb_lbl->setText(sb_name, CTextBox::NO_AUTO_LINEBREAK, sb_font); //move and set dimensions int lbl_x = sb_vlbl->getXPos()+ sb_vlbl->getWidth(); int lbl_h = sb_vlbl->getHeight(); - sb_lbl->setDimensionsAll(lbl_x, 1, sb_lbl_width- append_x_offset, lbl_h); + sb_lbl->setDimensionsAll(lbl_x, 1, sb_lbl_width/*- append_x_offset*/, lbl_h); //set current text and body color sb_lbl->setTextColor(sb_caption_color); From ae117fae660f29dcacd5ad1aacb1bdd6f260005f Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Sun, 20 Nov 2016 01:08:14 +0100 Subject: [PATCH 2/7] Messages: add option to change size of message text Include default size and localized setup. TODO: localize for nederlands and slovak, current english only. Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/4988df1dd97d2282617a6a553d3464e705fb2596 Author: Thilo Graf Date: 2016-11-20 (Sun, 20 Nov 2016) --- data/locale/deutsch.locale | 3 +++ data/locale/english.locale | 3 +++ data/locale/nederlands.locale | 3 +++ data/locale/slovak.locale | 3 +++ src/gui/osd_setup.cpp | 11 ++++++++++- src/gui/widget/hintbox.cpp | 6 +++--- src/system/locals.h | 3 +++ src/system/locals_intern.h | 3 +++ src/system/settings.h | 1 + 9 files changed, 32 insertions(+), 4 deletions(-) diff --git a/data/locale/deutsch.locale b/data/locale/deutsch.locale index ab0782e9b..c84063a86 100644 --- a/data/locale/deutsch.locale +++ b/data/locale/deutsch.locale @@ -703,6 +703,7 @@ fontmenu.eventlist Event-Liste fontmenu.head Schrift fontmenu.infobar Infobar fontmenu.menu Menü +fontmenu.messages Meldungen fontmenu.moviebrowser Moviebrowser fontmenu.other Andere fontmenu.scaling Schriftgrößenfaktor @@ -736,6 +737,7 @@ fontsize.menu_foot Fußleiste (in allen Fenstern) fontsize.menu_hint Menü-Hilfe fontsize.menu_info Menüinfo fontsize.menu_title Menütitel +fontsize.message_text Meldungstext fontsize.moviebrowser_head Überschriften fontsize.moviebrowser_info Info-Fenster fontsize.moviebrowser_list Listen-Einträge @@ -1183,6 +1185,7 @@ menu.hint_menu_fonts Ändern Sie die Schriftgrößen im Menü menu.hint_menu_hints Zeigt Ihnen Hinweise zu den Menüpunkten an. Sie erreichen das auch jederzeit mit der Taste 'Hilfe' menu.hint_menu_pos Legen Sie die Anzeigeposition der Menüs fest menu.hint_menus Wählen Sie die Anzeigeoptionen für die Menüs +menu.hint_message_fonts Anpassen der Schrift in Meldungsfenstern menu.hint_misc_cec HDMI-CEC Optionen menu.hint_misc_channellist Erweiterte Einstellungen für die Kanallisten und Zapping-Einstellungen menu.hint_misc_energy Energieverbrauchs- und Standby-Optionen, verzögertes Ausschalten, setzen bzw. ändern des Inaktivitätstimers diff --git a/data/locale/english.locale b/data/locale/english.locale index b27c5d3e1..b6b6e62f1 100644 --- a/data/locale/english.locale +++ b/data/locale/english.locale @@ -703,6 +703,7 @@ fontmenu.eventlist Eventlist fontmenu.head Font settings fontmenu.infobar Infobar fontmenu.menu Menu +fontmenu.messages Messages fontmenu.moviebrowser Moviebrowser fontmenu.other Other fontmenu.scaling Global Font Zoom Factor @@ -736,6 +737,7 @@ fontsize.menu_foot Footer (in all GUI elements) fontsize.menu_hint Menu hints fontsize.menu_info Menu Info fontsize.menu_title Menu Title +fontsize.message_text Message Text fontsize.moviebrowser_head Headers fontsize.moviebrowser_info Info window fontsize.moviebrowser_list List items @@ -1183,6 +1185,7 @@ menu.hint_menu_fonts Change menu font sizes menu.hint_menu_hints Show this hints. Also you can switch\nit any time using 'help' button menu.hint_menu_pos Select menu position menu.hint_menus Configure menu options +menu.hint_message_fonts Change message text font sizes menu.hint_misc_cec HDMI-CEC Options menu.hint_misc_channellist HD/New/Removed channel lists\nZap cycle menu.hint_misc_energy Enable soft-standby, delayed shutdown\ninactivity timers diff --git a/data/locale/nederlands.locale b/data/locale/nederlands.locale index 374aa6f8b..2425f75e9 100644 --- a/data/locale/nederlands.locale +++ b/data/locale/nederlands.locale @@ -657,6 +657,7 @@ fontmenu.eventlist Programmalijst fontmenu.head Lettertype instellingen fontmenu.infobar Informatiebalk fontmenu.menu Menu +fontmenu.messages Messages fontmenu.other Andere fontmenu.scaling Globale lettertype Zoom Factor fontmenu.scaling_x Horizontaal (in %) @@ -685,6 +686,7 @@ fontsize.infobar_info Info fontsize.infobar_number Nummer fontsize.infobar_small Klein fontsize.menu Menu tekst +fontsize.message_text Messag Text fontsize.menu_hint Menu hints fontsize.menu_info Menu Info fontsize.menu_title Menu Titel @@ -1095,6 +1097,7 @@ menu.hint_menu_fonts Lettertype grote van menu's aanpassen menu.hint_menu_hints Hints weergeven Show this hints. U kunt tevens gebruik maken van de 'help' toets. menu.hint_menu_pos Selecteer menu positie menu.hint_menus Configureer menu opties +menu.hint_message_fonts Change message text font sizes menu.hint_misc_cec HDMI-CEC Opties menu.hint_misc_channellist HD/Nieuw/Verwijderde kanalen lijst \nZap cyclus menu.hint_misc_energy Softstandby, uitgesteld uitschakelen en inactiviteit timers inschakelen diff --git a/data/locale/slovak.locale b/data/locale/slovak.locale index 1f00f767c..c6c3b1e67 100644 --- a/data/locale/slovak.locale +++ b/data/locale/slovak.locale @@ -703,6 +703,7 @@ fontmenu.eventlist Programový sprievodca fontmenu.head Nastavenie písma fontmenu.infobar Informačná lišta fontmenu.menu Menu +fontmenu.messages Messages fontmenu.moviebrowser Prehliadač filmov fontmenu.other Iné fontmenu.scaling Faktor zoomu globálneho fontu @@ -732,6 +733,7 @@ fontsize.infobar_info Informácia na informačnej lište fontsize.infobar_ng_ecminfo ECM Informácia fontsize.infobar_number Kanál na informačnej lište fontsize.menu Text menu +fontsize.message_text Messagwe Text fontsize.menu_foot Päta (vo všetkých grafických elementoch) fontsize.menu_hint Popis menu fontsize.menu_info Informačné menu @@ -1183,6 +1185,7 @@ menu.hint_menu_fonts Zmena veľkosti písma menu menu.hint_menu_hints Zobrazí túto nápovedu. Taktiež môžno kedykoľvek zmeniť použitím tlačidla ´HELP´. menu.hint_menu_pos Výber umiestnenia menu menu.hint_menus Konfigurácia volieb ponuky +menu.hint_message_fonts Change message text font sizes menu.hint_misc_cec HDMI-CEC voľby menu.hint_misc_channellist HD/Nové/Odstránené zoznamy kanálov, cyklické prepnutie menu.hint_misc_energy Použitie pohotovostného režimu, oneskorené vypnutie\nčasovače neaktivity diff --git a/src/gui/osd_setup.cpp b/src/gui/osd_setup.cpp index 27e492ed3..aa2403342 100644 --- a/src/gui/osd_setup.cpp +++ b/src/gui/osd_setup.cpp @@ -164,6 +164,13 @@ const SNeutrinoSettings::FONT_TYPES other_font_sizes[] = }; size_t other_font_items = sizeof(other_font_sizes)/sizeof(other_font_sizes[0]); +const SNeutrinoSettings::FONT_TYPES msgtext_font_sizes[] = +{ + SNeutrinoSettings::FONT_TYPE_MESSAGE_TEXT +}; +size_t msgtext_font_items = sizeof(msgtext_font_sizes)/sizeof(msgtext_font_sizes[0]); + + font_sizes_groups font_sizes_groups[] = { {LOCALE_FONTMENU_MENU , menu_font_items , menu_font_sizes , "fontsize.dmen", LOCALE_MENU_HINT_MENU_FONTS }, @@ -172,6 +179,7 @@ font_sizes_groups font_sizes_groups[] = {LOCALE_FONTMENU_EPG , epg_font_items , epg_font_sizes , "fontsize.depg", LOCALE_MENU_HINT_EPG_FONTS }, {LOCALE_FONTMENU_INFOBAR , infobar_font_items , infobar_font_sizes , "fontsize.dinf", LOCALE_MENU_HINT_INFOBAR_FONTS }, {LOCALE_FONTMENU_MOVIEBROWSER,moviebrowser_font_items,moviebrowser_font_sizes,"fontsize.dmbr", LOCALE_MENU_HINT_MOVIEBROWSER_FONTS }, + {LOCALE_FONTMENU_MESSAGES , msgtext_font_items , msgtext_font_sizes , "fontsize.msg", LOCALE_MENU_HINT_MESSAGE_FONTS }, {LOCALE_FONTMENU_OTHER , other_font_items , other_font_sizes , "fontsize.doth", LOCALE_MENU_HINT_OTHER_FONTS } }; #define FONT_GROUP_COUNT (sizeof(font_sizes_groups)/sizeof(font_sizes_groups[0])) @@ -205,7 +213,8 @@ font_sizes_struct neutrino_font[SNeutrinoSettings::FONT_TYPE_COUNT] = {LOCALE_FONTSIZE_MOVIEBROWSER_HEAD , 15, CNeutrinoFonts::FONT_STYLE_REGULAR, 2}, {LOCALE_FONTSIZE_MOVIEBROWSER_LIST , 17, CNeutrinoFonts::FONT_STYLE_REGULAR, 0}, {LOCALE_FONTSIZE_MOVIEBROWSER_INFO , 17, CNeutrinoFonts::FONT_STYLE_REGULAR, 0}, - {LOCALE_FONTSIZE_SUBTITLES , 25, CNeutrinoFonts::FONT_STYLE_BOLD , 0} + {LOCALE_FONTSIZE_SUBTITLES , 25, CNeutrinoFonts::FONT_STYLE_BOLD , 0}, + {LOCALE_FONTSIZE_MESSAGE_TEXT , 20, CNeutrinoFonts::FONT_STYLE_REGULAR, 1} }; int COsdSetup::exec(CMenuTarget* parent, const std::string &actionKey) diff --git a/src/gui/widget/hintbox.cpp b/src/gui/widget/hintbox.cpp index eeda08a24..5cc9085b5 100644 --- a/src/gui/widget/hintbox.cpp +++ b/src/gui/widget/hintbox.cpp @@ -36,7 +36,7 @@ #include "hintbox.h" #include - +#define MSG_FONT g_Font[SNeutrinoSettings::FONT_TYPE_MESSAGE_TEXT] /** x width ccw_head [relevant for CHintBox, CMsgBox. not enabled in CHint class] @@ -132,7 +132,7 @@ void CHintBox::init(const std::string& Text, const int& Width, const std::string timeout = HINTBOX_DEFAULT_TIMEOUT; w_indentation = indent; - hb_font = g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_INFO]; + hb_font = MSG_FONT; //enable shadow shadow = true; @@ -321,7 +321,7 @@ void CHintBox::setMsgText(const std::string& Text, const uint& hint_id, const in CComponentsInfoBox *obj_text = static_cast(ccw_body->getCCItem(id)); //set required font and line size - Font* font = font_text == NULL ? g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_INFO] : font_text; + Font* font = font_text == NULL ? MSG_FONT : font_text; if (obj_text) obj_text->setText(Text, mode, font, color_text, style); } diff --git a/src/system/locals.h b/src/system/locals.h index 521bca09c..866567c49 100644 --- a/src/system/locals.h +++ b/src/system/locals.h @@ -730,6 +730,7 @@ typedef enum LOCALE_FONTMENU_HEAD, LOCALE_FONTMENU_INFOBAR, LOCALE_FONTMENU_MENU, + LOCALE_FONTMENU_MESSAGES, LOCALE_FONTMENU_MOVIEBROWSER, LOCALE_FONTMENU_OTHER, LOCALE_FONTMENU_SCALING, @@ -763,6 +764,7 @@ typedef enum LOCALE_FONTSIZE_MENU_HINT, LOCALE_FONTSIZE_MENU_INFO, LOCALE_FONTSIZE_MENU_TITLE, + LOCALE_FONTSIZE_MESSAGE_TEXT, LOCALE_FONTSIZE_MOVIEBROWSER_HEAD, LOCALE_FONTSIZE_MOVIEBROWSER_INFO, LOCALE_FONTSIZE_MOVIEBROWSER_LIST, @@ -1210,6 +1212,7 @@ typedef enum LOCALE_MENU_HINT_MENU_HINTS, LOCALE_MENU_HINT_MENU_POS, LOCALE_MENU_HINT_MENUS, + LOCALE_MENU_HINT_MESSAGE_FONTS, LOCALE_MENU_HINT_MISC_CEC, LOCALE_MENU_HINT_MISC_CHANNELLIST, LOCALE_MENU_HINT_MISC_ENERGY, diff --git a/src/system/locals_intern.h b/src/system/locals_intern.h index 96d6ee949..90954b5c6 100644 --- a/src/system/locals_intern.h +++ b/src/system/locals_intern.h @@ -730,6 +730,7 @@ const char * locale_real_names[] = "fontmenu.head", "fontmenu.infobar", "fontmenu.menu", + "fontmenu.messages", "fontmenu.moviebrowser", "fontmenu.other", "fontmenu.scaling", @@ -763,6 +764,7 @@ const char * locale_real_names[] = "fontsize.menu_hint", "fontsize.menu_info", "fontsize.menu_title", + "fontsize.message_text", "fontsize.moviebrowser_head", "fontsize.moviebrowser_info", "fontsize.moviebrowser_list", @@ -1210,6 +1212,7 @@ const char * locale_real_names[] = "menu.hint_menu_hints", "menu.hint_menu_pos", "menu.hint_menus", + "menu.hint_message_fonts", "menu.hint_misc_cec", "menu.hint_misc_channellist", "menu.hint_misc_energy", diff --git a/src/system/settings.h b/src/system/settings.h index c95d2f25b..f32e10d47 100644 --- a/src/system/settings.h +++ b/src/system/settings.h @@ -683,6 +683,7 @@ struct SNeutrinoSettings FONT_TYPE_MOVIEBROWSER_LIST, FONT_TYPE_MOVIEBROWSER_INFO, FONT_TYPE_SUBTITLES, + FONT_TYPE_MESSAGE_TEXT, FONT_TYPE_COUNT }; From 2b0b1c9f0f70106be07798dc5d4c7a2af1143997 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Sun, 20 Nov 2016 01:33:34 +0100 Subject: [PATCH 3/7] CComponentsFooter: add parameter for frame width for selected buttons Frame width was hard coded. Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/696989dcf1740b606258617195388ee1f22c95da Author: Thilo Graf Date: 2016-11-20 (Sun, 20 Nov 2016) --- src/gui/components/cc_frm_footer.cpp | 9 +++++++-- src/gui/components/cc_frm_footer.h | 8 +++++++- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/src/gui/components/cc_frm_footer.cpp b/src/gui/components/cc_frm_footer.cpp index 8256752cd..4a1cbfc4e 100644 --- a/src/gui/components/cc_frm_footer.cpp +++ b/src/gui/components/cc_frm_footer.cpp @@ -345,7 +345,12 @@ void CComponentsFooter::enableButtonBg(bool enable) } } -void CComponentsFooter::setSelectedButton(size_t item_id, const fb_pixel_t& fr_col, const fb_pixel_t& sel_fr_col, const fb_pixel_t& bg_col, const fb_pixel_t& sel_bg_col, const fb_pixel_t& text_col, const fb_pixel_t& sel_text_col) +void CComponentsFooter::setSelectedButton(size_t item_id, + const fb_pixel_t& fr_col, const fb_pixel_t& sel_fr_col, + const fb_pixel_t& bg_col, const fb_pixel_t& sel_bg_col, + const fb_pixel_t& text_col, const fb_pixel_t& sel_text_col, + const int& frame_width, + const int& sel_frame_width) { if (chain){ for (size_t i= 0; i< chain->size(); i++){ @@ -355,7 +360,7 @@ void CComponentsFooter::setSelectedButton(size_t item_id, const fb_pixel_t& fr_c fb_pixel_t sel_col = fr_col; if (chain->size() > 1) sel_col = sel_fr_col; //TODO: make it configurable - chain->setSelectedItem(item_id, sel_col, fr_col, sel_bg_col, bg_col, 1, 2); + chain->setSelectedItem(item_id, sel_col, fr_col, sel_bg_col, bg_col, frame_width, sel_frame_width); if (chain->size() > 1) getSelectedButtonObject()->setButtonTextColor(sel_text_col); diff --git a/src/gui/components/cc_frm_footer.h b/src/gui/components/cc_frm_footer.h index 7796aac39..49bd3fae6 100644 --- a/src/gui/components/cc_frm_footer.h +++ b/src/gui/components/cc_frm_footer.h @@ -152,6 +152,10 @@ class CComponentsFooter : public CComponentsHeader * @li optional: exepts type fb_pixel_t, as default text color * @param[in] sel_text_col * @li optional: exepts type fb_pixel_t, as selected text color + * @param[in] frame_width + * @li optional: exepts type int, default = 1 + * @param[in] sel_frame_width + * @li optional: exepts type int, default = 2 */ void setSelectedButton(size_t item_id, const fb_pixel_t& fr_col = COL_MENUCONTENTSELECTED_PLUS_2, @@ -159,7 +163,9 @@ class CComponentsFooter : public CComponentsHeader const fb_pixel_t& bg_col = COL_MENUFOOT_PLUS_0, /*TODO disabled at the moment, without effect*/ const fb_pixel_t& sel_bg_col = COL_MENUCONTENTSELECTED_PLUS_2, /*TODO disabled at the moment, without effect*/ const fb_pixel_t& text_col = COL_MENUCONTENTDARK_TEXT_PLUS_2, - const fb_pixel_t& sel_text_col = COL_MENUCONTENT_TEXT); + const fb_pixel_t& sel_text_col = COL_MENUCONTENT_TEXT, + const int& frame_width = 1, + const int& sel_frame_width = 2); ///returns id of select button, return value as int, -1 = nothing is selected int getSelectedButton(); ///returns selected button object, return value as pointer to object, NULL means nothing is selected From c35d8b0c26d374ae73279e72aaba128093ee9421 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Sun, 20 Nov 2016 14:09:19 +0100 Subject: [PATCH 4/7] CCDraw: add function for blink effect for cc items NOTE: experimental, for examples see CTestMenu class Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/717dec02c53bac3f2625de672189a249aa6aab4b Author: Thilo Graf Date: 2016-11-20 (Sun, 20 Nov 2016) --- src/gui/components/cc_draw.cpp | 46 +++++++++ src/gui/components/cc_draw.h | 44 ++++++++- src/gui/components/cc_item.cpp | 2 +- src/gui/components/cc_item_picture.cpp | 9 ++ src/gui/components/cc_item_picture.h | 3 + src/gui/test_menu.cpp | 129 +++++++++++++++++++------ 6 files changed, 201 insertions(+), 32 deletions(-) diff --git a/src/gui/components/cc_draw.cpp b/src/gui/components/cc_draw.cpp index 1e7372974..1e7cd3363 100644 --- a/src/gui/components/cc_draw.cpp +++ b/src/gui/components/cc_draw.cpp @@ -32,6 +32,7 @@ CCDraw::CCDraw() : COSDFader(g_settings.theme.menu_Content_alpha) { frameBuffer = CFrameBuffer::getInstance(); + x = cc_xr = x_old = 0; y = cc_yr = y_old = 0; height = height_old = CC_HEIGHT_MIN; @@ -70,6 +71,9 @@ CCDraw::CCDraw() : COSDFader(g_settings.theme.menu_Content_alpha) cc_body_gradient_saturation = 0xC0; cc_body_gradient_direction = cc_body_gradient_direction_old = CFrameBuffer::gradientVertical; + cc_draw_timer = NULL; + cc_draw_trigger_slot = sigc::mem_fun0(*this, &CCDraw::paintTrigger); + cc_gradient_bg_cleanup = true; v_fbdata.clear(); @@ -77,6 +81,9 @@ CCDraw::CCDraw() : COSDFader(g_settings.theme.menu_Content_alpha) CCDraw::~CCDraw() { + if(cc_draw_timer){ + delete cc_draw_timer; cc_draw_timer = NULL; + } clearFbData(); } @@ -718,3 +725,42 @@ void CCDraw::enableShadow(int mode, const int& shadow_width, bool force_paint) shadow_force = force_paint; } +void CCDraw::paintTrigger() +{ + if (!is_painted) + paint1(); + else + hide(); +} + +bool CCDraw::paintBlink(const int& interval, bool is_nano) +{ + if (cc_draw_timer == NULL){ + cc_draw_timer = new CComponentsTimer(interval, is_nano); + if (cc_draw_timer->OnTimer.empty()){ + cc_draw_timer->OnTimer.connect(cc_draw_trigger_slot); + } + } + if (cc_draw_timer) + return cc_draw_timer->isRun(); + + return false; +} + +bool CCDraw::cancelBlink(bool keep_on_screen) +{ + bool res = false; + + if (cc_draw_timer){ + res = cc_draw_timer->stopTimer(); + delete cc_draw_timer; cc_draw_timer = NULL; + } + + if(keep_on_screen) + paint1(); + else + hide(); + + + return res; +} \ No newline at end of file diff --git a/src/gui/components/cc_draw.h b/src/gui/components/cc_draw.h index d0664b7a4..463dc62e1 100644 --- a/src/gui/components/cc_draw.h +++ b/src/gui/components/cc_draw.h @@ -27,6 +27,7 @@ #include "cc_types.h" #include "cc_signals.h" +#include "cc_timer.h" #include #include #include @@ -47,7 +48,14 @@ class CCDraw : public COSDFader, public CComponentsSignals ///object: framebuffer object, usable in all sub classes CFrameBuffer * frameBuffer; - + + ///internal draw timer, used for effects + CComponentsTimer *cc_draw_timer; + ///slot for timer event, reserved for cc_draw_timer + sigc::slot0 cc_draw_trigger_slot; + ///paint item with trigger effect + virtual void paintTrigger(); + ///property: x-position on screen, to alter with setPos() or setDimensionsAll(), see also defines CC_APPEND, CC_CENTERED int x, x_old; ///property: y-position on screen, to alter setPos() or setDimensionsAll(), see also defines CC_APPEND, CC_CENTERED @@ -299,10 +307,40 @@ class CCDraw : public COSDFader, public CComponentsSignals ///abstract: paint item, arg: do_save_bg see paintInit() above virtual void paint(bool do_save_bg = CC_SAVE_SCREEN_YES) = 0; - ///paint item, same like paint(CC_SAVE_SCREEN_YES) but without any argument - virtual void paint1(){paint(CC_SAVE_SCREEN_YES);} ///paint item, same like paint(CC_SAVE_SCREEN_NO) but without any argument virtual void paint0(){paint(CC_SAVE_SCREEN_NO);} + ///paint item, same like paint(CC_SAVE_SCREEN_YES) but without any argument + virtual void paint1(){paint(CC_SAVE_SCREEN_YES);} + + /**paint item with blink effect + * This should work with all cc item types. + * + * @return bool returns true if effect is successful started + * + * @param[in] interval optional, interval time as int, default = 1 + * @param[in] is_nano optional, time mode as bool, default = false means as seconds, true means nano seconds. + * + * @see take a look into test menu class for examples. + * cancelBlink() + * + * NOTE: If you want to use enbedded items from a cc form (e.g. with gettCCItem(ID)) + * you must cast into current item type. e.g.: + * CComponentsItemBla* item = static_cast(form->getCCItem(2)); + * and it's possible you must remove from screen before e.g.: + * item->kill(); + */ + virtual bool paintBlink(const int& interval = 1, bool is_nano = false); + + /**Cancel blink effect + * + * @return bool returns true if effect was successful canceled + * + * @param[in] keep_on_screen optional, exepts bool, default = false. means: item is not repainted after canceled effect + * + * @see take a look into test menu class for examples + * NOTE: Effect must be started with paintBlink() + */ + bool cancelBlink(bool keep_on_screen = false); ///signal on before paint fb layers, called inside paintFbItems() sigc::signal OnBeforePaintLayers; diff --git a/src/gui/components/cc_item.cpp b/src/gui/components/cc_item.cpp index 35d2ec981..10147f6cf 100644 --- a/src/gui/components/cc_item.cpp +++ b/src/gui/components/cc_item.cpp @@ -3,7 +3,7 @@ Copyright (C) 2001 by Steffen Hehn 'McClean' Classes for generic GUI-related components. - Copyright (C) 2012-2015, Thilo Graf 'dbt' + Copyright (C) 2012-2016, Thilo Graf 'dbt' Copyright (C) 2012, Michael Liebmann 'micha-bbg' License: GPL diff --git a/src/gui/components/cc_item_picture.cpp b/src/gui/components/cc_item_picture.cpp index 8299f2469..c18543611 100644 --- a/src/gui/components/cc_item_picture.cpp +++ b/src/gui/components/cc_item_picture.cpp @@ -349,6 +349,15 @@ bool CComponentsPicture::hasChanges() return ret; } +void CComponentsPicture::paintTrigger() +{ + if (!is_painted && !isPicPainted()) + paint1(); + else + hide(); +} + + CComponentsChannelLogo::CComponentsChannelLogo( const int &x_pos, const int &y_pos, const int &w, const int &h, const std::string& channelName, const uint64_t& channelId, diff --git a/src/gui/components/cc_item_picture.h b/src/gui/components/cc_item_picture.h index 8d39e73d2..435065fc9 100644 --- a/src/gui/components/cc_item_picture.h +++ b/src/gui/components/cc_item_picture.h @@ -81,6 +81,9 @@ class CComponentsPicture : public CComponentsItem ///helper: indicate for reinit bool need_init; + ///paint item with changed paint and hide effect + void paintTrigger(); + void init( const int &x_pos, const int &y_pos, const int &w, const int &h, const std::string& image_name, CComponentsForm *parent, diff --git a/src/gui/test_menu.cpp b/src/gui/test_menu.cpp index b5b1dd772..64035b72c 100644 --- a/src/gui/test_menu.cpp +++ b/src/gui/test_menu.cpp @@ -419,6 +419,32 @@ int CTestMenu::exec(CMenuTarget* parent, const std::string &actionKey) pic->hide(); return res; } + else if (actionKey == "blink"){ + if (sq == NULL) + sq = new CComponentsShapeSquare (0, 0, 100, 100, NULL, CC_SHADOW_ON, COL_OLIVE, COL_LIGHT_GRAY, COL_RED); + + if (sq->paintBlink(500000, true)){ + ShowHint("Testmenu: Blink","Testmenu: Blinking square is running ...", 700, 6); + } + if (sq->cancelBlink()){ + ShowHint("Testmenu: Blink","Testmenu: Blinking square stopped ...", 700, 2); + } + + return res; + } + else if (actionKey == "blink_image"){ + if (pic == NULL) + pic = new CComponentsPicture (100, 100, 200, 100, ICONSDIR "/btn_play.png"); + + if (pic->paintBlink(500000, true)){ + ShowHint("Testmenu: Blink","Testmenu: Blinking image is running ...", 700, 10); + } + if (pic->cancelBlink()){ + ShowHint("Testmenu: Blink","Testmenu: Blinking image stopped ...", 700, 2); + } + + return res; + } else if (actionKey == "channellogo"){ if (chnl_pic == NULL) chnl_pic = new CComponentsChannelLogo(100, 100, "ProSieben", 0); @@ -478,6 +504,23 @@ int CTestMenu::exec(CMenuTarget* parent, const std::string &actionKey) txt->hide(); else txt->paint(); + + return res; + } + else if (actionKey == "blinking_text"){ + if (txt == NULL){ + txt = new CComponentsText(); + txt->setDimensionsAll(100, 100, 250, 100); + txt->setText("This is a text for testing textbox", CTextBox::NO_AUTO_LINEBREAK); + } + + if (txt->paintBlink(500000, true)){ + ShowHint("Testmenu: Blink","Testmenu: Blinking text is running ...", 700, 10); + } + if (txt->cancelBlink()){ + ShowHint("Testmenu: Blink","Testmenu: Blinking text stopped ...", 700, 2); + } + return res; } else if (actionKey == "text_ext"){ @@ -494,6 +537,25 @@ int CTestMenu::exec(CMenuTarget* parent, const std::string &actionKey) text_ext->paint(); return res; } + else if (actionKey == "blinking_text_ext"){ + if (text_ext == NULL){ + text_ext = new CComponentsExtTextForm(); + 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)){ + ShowHint("Testmenu: Blink","Testmenu: Blinking extended text is running ...", 700, 10); + } + if (text_ext->getTextObject()->cancelBlink()){ + ShowHint("Testmenu: Blink","Testmenu: Blinking extended text stopped ...", 700, 2); + } + return res; + } else if (actionKey == "header"){ int hh = 30;//g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]->getHeight(); if (header == NULL){ @@ -599,40 +661,47 @@ int CTestMenu::exec(CMenuTarget* parent, const std::string &actionKey) return res; } else if (actionKey == "iconform"){ - if (iconform == NULL) + if (iconform == NULL){ iconform = new CComponentsIconForm(); - iconform->setColorBody(COL_LIGHT_GRAY); - iconform->setDimensionsAll(100, 100,80/*480*/, 80); - iconform->setFrameThickness(2); - iconform->setColorFrame(COL_WHITE); - iconform->setDirection(CC_DIR_X); - iconform->setAppendOffset(5, 5); + iconform->setColorBody(COL_LIGHT_GRAY); + iconform->setDimensionsAll(100, 100,80/*480*/, 80); + iconform->setFrameThickness(2); + iconform->setColorFrame(COL_WHITE); + iconform->setDirection(CC_DIR_X); + iconform->setAppendOffset(5, 5); - //For existing instances it's recommended - //to remove old items before add new icons, otherwise icons will be appended. - iconform->removeAllIcons(); + //For existing instances it's recommended + //to remove old items before add new icons, otherwise icons will be appended. + iconform->removeAllIcons(); - //you can... - //add icons step by step - iconform->addIcon(NEUTRINO_ICON_INFO); - iconform->addIcon(NEUTRINO_ICON_INFO); - iconform->addIcon(NEUTRINO_ICON_HINT_MEDIA); - //...or - //add icons with vector - std::vector v_icons; - v_icons.push_back(NEUTRINO_ICON_HINT_VIDEO); - v_icons.push_back(NEUTRINO_ICON_HINT_AUDIO); - iconform->addIcon(v_icons); + //you can... + //add icons step by step + iconform->addIcon(NEUTRINO_ICON_INFO); + iconform->addIcon(NEUTRINO_ICON_INFO); + iconform->addIcon(NEUTRINO_ICON_HINT_MEDIA); + //...or + //add icons with vector + std::vector v_icons; + v_icons.push_back(NEUTRINO_ICON_HINT_VIDEO); + v_icons.push_back(NEUTRINO_ICON_HINT_AUDIO); + iconform->addIcon(v_icons); - //insert any icon, here as first (index = 0...n) - iconform->insertIcon(0, NEUTRINO_ICON_HINT_APLAY); -// iconform->setIconAlign(CComponentsIconForm::CC_ICONS_FRM_ALIGN_RIGHT); - - if (iconform->isPainted()) - iconform->hide(); - else{ + //insert any icon, here as first (index = 0...n) + iconform->insertIcon(0, NEUTRINO_ICON_HINT_APLAY); + // iconform->setIconAlign(CComponentsIconForm::CC_ICONS_FRM_ALIGN_RIGHT); iconform->paint(); } + + CComponentsPicture* img = static_cast(iconform->getCCItem(2)); + img->kill(); + + if (img->paintBlink(500000, true)){ + ShowHint("Testmenu: Blink","Testmenu: Blinking image is running ...", 700, 10); + } + if (img->cancelBlink(true)){ + ShowHint("Testmenu: Blink","Testmenu: Blinking image stopped ...", 700, 2); + } + return res; } else if (actionKey == "window"){ @@ -894,15 +963,19 @@ void CTestMenu::showCCTests(CMenuWidget *widget) widget->addItem(new CMenuForwarder("Button", true, NULL, this, "button")); widget->addItem(new CMenuForwarder("Circle", true, NULL, this, "circle")); widget->addItem(new CMenuForwarder("Square", true, NULL, this, "square")); + widget->addItem(new CMenuForwarder("Blinking-Square", true, NULL, this, "blink")); + widget->addItem(new CMenuForwarder("Blinking-Image", true, NULL, this, "blink_image")); widget->addItem(new CMenuForwarder("Picture", true, NULL, this, "picture")); widget->addItem(new CMenuForwarder("Channel-Logo", true, NULL, this, "channellogo")); widget->addItem(new CMenuForwarder("Form", true, NULL, this, "form")); widget->addItem(new CMenuForwarder("Text", true, NULL, this, "text")); + widget->addItem(new CMenuForwarder("Blinking Text", true, NULL, this, "blinking_text")); widget->addItem(new CMenuForwarder("Header", true, NULL, this, "header")); widget->addItem(new CMenuForwarder("Footer", true, NULL, this, "footer")); widget->addItem(new CMenuForwarder("Icon-Form", true, NULL, this, "iconform")); widget->addItem(new CMenuForwarder("Window", true, NULL, this, "window")); widget->addItem(new CMenuForwarder("Text-Extended", true, NULL, this, "text_ext")); + widget->addItem(new CMenuForwarder("Blinking Extended Text", true, NULL, this, "blinking_text_ext")); widget->addItem(new CMenuForwarder("Scrollbar", true, NULL, this, "scrollbar")); } From 33e7afdf8d047daf2f85ad9adb713707e26538fa Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Sun, 20 Nov 2016 15:18:45 +0100 Subject: [PATCH 5/7] CComponentsFooter: use minimal frame width as default for buttons Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/7567f7de00bf8b6ef6d1967819586dfaea2036e4 Author: Thilo Graf Date: 2016-11-20 (Sun, 20 Nov 2016) --- src/gui/components/cc_frm_footer.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/components/cc_frm_footer.h b/src/gui/components/cc_frm_footer.h index 49bd3fae6..0afd82454 100644 --- a/src/gui/components/cc_frm_footer.h +++ b/src/gui/components/cc_frm_footer.h @@ -165,7 +165,7 @@ class CComponentsFooter : public CComponentsHeader const fb_pixel_t& text_col = COL_MENUCONTENTDARK_TEXT_PLUS_2, const fb_pixel_t& sel_text_col = COL_MENUCONTENT_TEXT, const int& frame_width = 1, - const int& sel_frame_width = 2); + const int& sel_frame_width = 1); ///returns id of select button, return value as int, -1 = nothing is selected int getSelectedButton(); ///returns selected button object, return value as pointer to object, NULL means nothing is selected From 8e1bc39318b2fb63e1d3bc498df58bc3c6f0856c Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Sun, 20 Nov 2016 15:44:57 +0100 Subject: [PATCH 6/7] CMsgBox: enable button background as default Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/01893dfefc42ba4d0e841fefe4627b5ea856bd52 Author: Thilo Graf Date: 2016-11-20 (Sun, 20 Nov 2016) --- src/gui/widget/msgbox.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/widget/msgbox.cpp b/src/gui/widget/msgbox.cpp index b9fc55d94..567780794 100644 --- a/src/gui/widget/msgbox.cpp +++ b/src/gui/widget/msgbox.cpp @@ -89,7 +89,7 @@ void CMsgBox::init(const int& Height, const int& ShowButtons, const msg_result_t showFooter(true); ccw_h_footer = ccw_footer->getHeight()+OFFSET_INNER_MID; ccw_footer->setHeight(ccw_h_footer); - btn_enable_bg = false; + btn_enable_bg = true; ccw_col_footer = ccw_body->getColorBody(); ccw_footer->doPaintBg(false); int h_current = height; From af471915c967b64ca719d4f4aaf2b0e9c4a596e4 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Sun, 20 Nov 2016 16:32:37 +0100 Subject: [PATCH 7/7] CComponentsFooter: use select/unselect colors from menues as default Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/4b88a244da967fce1d9ca6219afb5c722e322108 Author: Thilo Graf Date: 2016-11-20 (Sun, 20 Nov 2016) --- src/gui/components/cc_frm_footer.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/gui/components/cc_frm_footer.h b/src/gui/components/cc_frm_footer.h index 0afd82454..4c5239d56 100644 --- a/src/gui/components/cc_frm_footer.h +++ b/src/gui/components/cc_frm_footer.h @@ -160,10 +160,10 @@ class CComponentsFooter : public CComponentsHeader void setSelectedButton(size_t item_id, const fb_pixel_t& fr_col = COL_MENUCONTENTSELECTED_PLUS_2, const fb_pixel_t& sel_fr_col = COL_MENUCONTENTSELECTED_PLUS_0, - const fb_pixel_t& bg_col = COL_MENUFOOT_PLUS_0, /*TODO disabled at the moment, without effect*/ - const fb_pixel_t& sel_bg_col = COL_MENUCONTENTSELECTED_PLUS_2, /*TODO disabled at the moment, without effect*/ - const fb_pixel_t& text_col = COL_MENUCONTENTDARK_TEXT_PLUS_2, - const fb_pixel_t& sel_text_col = COL_MENUCONTENT_TEXT, + const fb_pixel_t& bg_col = COL_MENUCONTENT_PLUS_0, + const fb_pixel_t& sel_bg_col = COL_MENUCONTENTSELECTED_PLUS_0, + const fb_pixel_t& text_col = COL_MENUCONTENT_TEXT, + const fb_pixel_t& sel_text_col = COL_MENUCONTENTSELECTED_TEXT, const int& frame_width = 1, const int& sel_frame_width = 1); ///returns id of select button, return value as int, -1 = nothing is selected