From c36053860a8c55919d3bcf93130c1241b5b5527f Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Wed, 14 Dec 2016 16:19:40 +0100 Subject: [PATCH 1/3] CComponentsHeader: fix font and height handling Font was not changeable. setCaptionFont() was without effect. Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/ab8aa776870fb80a9c19ca3a14ef39884906fb2b Author: Thilo Graf Date: 2016-12-14 (Wed, 14 Dec 2016) --- src/gui/components/cc_frm_header.cpp | 24 ++++++-------- src/gui/components/cc_frm_header.h | 49 ++++++++++++++++++++-------- 2 files changed, 46 insertions(+), 27 deletions(-) diff --git a/src/gui/components/cc_frm_header.cpp b/src/gui/components/cc_frm_header.cpp index c7485ec83..5a6e3ec74 100644 --- a/src/gui/components/cc_frm_header.cpp +++ b/src/gui/components/cc_frm_header.cpp @@ -93,12 +93,10 @@ void CComponentsHeader::initVarHeader( const int& x_pos, const int& y_pos, const //init header width width = width_old = w == 0 ? frameBuffer->getScreenWidth(true) : w; + height = height_old = h; - //init header default height - height = height_old = max(h, g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getHeight()); - - cch_size_mode = CC_HEADER_SIZE_LARGE; - initCaptionFont(); //sets cch_font and calculate height if required; + cch_font = NULL; + cch_size_mode = CC_HEADER_SIZE_LARGE; shadow = shadow_mode; col_frame = col_frame_old = color_frame; @@ -160,15 +158,15 @@ void CComponentsHeader::setCaption(neutrino_locale_t caption_locale, const int& void CComponentsHeader::setCaptionFont(Font* font) { - initCaptionFont(font); //cch_font = font + cch_font = font; } -void CComponentsHeader::initCaptionFont(Font* font) +void CComponentsHeader::initCaptionFont() { Font *l_font = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]; Font *s_font = g_Font[SNeutrinoSettings::FONT_TYPE_MENU]; - if (font == NULL){ + if (cch_font == NULL){ cch_font = (cch_size_mode == CC_HEADER_SIZE_LARGE? l_font : s_font); //select matching height @@ -177,10 +175,8 @@ void CComponentsHeader::initCaptionFont(Font* font) else height = std::min(height, s_font->getHeight()); } - else{ - cch_font = font; + else height = std::max(height, cch_font->getHeight()); - } } void CComponentsHeader::setIcon(const char* icon_name) @@ -513,12 +509,12 @@ void CComponentsHeader::initCaption() void CComponentsHeader::initCCItems() { - //set basic properties - Init(x, y, width, height, col_frame, col_body, col_shadow); - //set size initCaptionFont(); + //set basic properties + Init(x, y, width, height, col_frame, col_body, col_shadow); + //init icon initIcon(); diff --git a/src/gui/components/cc_frm_header.h b/src/gui/components/cc_frm_header.h index b3f185e68..d091e800f 100644 --- a/src/gui/components/cc_frm_header.h +++ b/src/gui/components/cc_frm_header.h @@ -99,7 +99,7 @@ class CComponentsHeader : public CComponentsForm, public CCTextScreen bool cch_cl_enable_run; ///init font object and recalculates height if required - void initCaptionFont(Font* font = NULL); + void initCaptionFont(); ///sub: init icon object void initIcon(); ///sub: init caption object @@ -136,13 +136,44 @@ class CComponentsHeader : public CComponentsForm, public CCTextScreen virtual void setCaption(neutrino_locale_t caption_locale, const int& align_mode = CTextBox::NO_AUTO_LINEBREAK, const fb_pixel_t& text_color = COL_MENUHEAD_TEXT); ///set alignment of caption within header, possible paramters are CTextBox::CENTER, CTextBox::NO_AUTO_LINEBREAK - virtual void setCaptionAlignment(const int& align_mode){cch_caption_align = align_mode;}; - ///set text font object for caption + virtual void setCaptionAlignment(const int& align_mode){cch_caption_align = align_mode;} + + /**Set text font for title. + * Internal default font is g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE] and + * default height of header object is calculated from this font type. + * Height can be changed with modes by setSizeMode(), setHeight() or constructor. + * @return void + * + * @param[in] font exepts font object, type Font* + * @see getCaptionFont(), setSizeMode(), + * setCaptionColor(), + * setCaptionAlignment(), + * setCaption() + */ virtual void setCaptionFont(Font* font); ///returns font object of title caption - virtual Font* getCaptionFont(){return cch_font;}; + virtual Font* getCaptionFont(){return cch_font;} ///set text color for caption - virtual void setCaptionColor(fb_pixel_t text_color){cch_col_text = text_color;}; + virtual void setCaptionColor(fb_pixel_t text_color){cch_col_text = text_color;} + + enum + { + CC_HEADER_SIZE_LARGE = 0, + CC_HEADER_SIZE_SMALL = 1 + }; + /**Set size mode of header. + * These modes are using fonts SNeutrinoSettings::FONT_TYPE_MENU_TITLE for large mode (default) + * and SNeutrinoSettings::FONT_TYPE_MENU for small mode to set required height. + * If other size wanted then use set setCaptionFont() and setHeight() + * @return void + * + * @param[in] size_mode exepts type int (enums) + * possible modes are: + * CC_HEADER_SIZE_LARGE + * CC_HEADER_SIZE_SMALL + * @see setCaption(), setHeight() + */ + virtual void setSizeMode(const int& size_mode){cch_size_mode = size_mode; initCCItems();} ///set offset between items virtual void setOffset(const int offset){cch_offset = offset;}; @@ -198,14 +229,6 @@ class CComponentsHeader : public CComponentsForm, public CCTextScreen ///set offset between icons within context button object virtual void setButtonsSpace(const int buttons_space){cch_buttons_space = buttons_space;} - enum - { - CC_HEADER_SIZE_LARGE = 0, - CC_HEADER_SIZE_SMALL = 1 - }; - ///set size of header, possible values are CC_HEADER_SIZE_LARGE, CC_HEADER_SIZE_SMALL - virtual void setSizeMode(const int& size_mode){cch_size_mode = size_mode; initCCItems();} - ///init all items within header object virtual void initCCItems(); ///returns the text object From 9805b1547dba5ecd121088d8525e089dad7f311f Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Wed, 14 Dec 2016 22:40:47 +0100 Subject: [PATCH 2/3] CNeutrinoApp: simplify shutdown message handling Usage of only one cancel button is more plausible. 'cancel' means cancel this action. And not more! Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/c5f1a03a31536d5182c266a45aa5a4c643d2ff32 Author: Thilo Graf Date: 2016-12-14 (Wed, 14 Dec 2016) --- src/neutrino.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/neutrino.cpp b/src/neutrino.cpp index 8f185ce20..d852de5e1 100644 --- a/src/neutrino.cpp +++ b/src/neutrino.cpp @@ -3276,9 +3276,9 @@ int CNeutrinoApp::handleMsg(const neutrino_msg_t _msg, neutrino_msg_data_t data) } else if( msg == NeutrinoMessages::SLEEPTIMER) { if(data) {//INACTIVITY SLEEPTIMER - skipShutdownTimer = - (ShowMsg(LOCALE_MESSAGEBOX_INFO, g_settings.shutdown_real ? LOCALE_SHUTDOWNTIMER_ANNOUNCE:LOCALE_SLEEPTIMERBOX_ANNOUNCE, - CMsgBox::mbrNo, CMsgBox::mbYes | CMsgBox::mbNo, NULL, 450, 30, true) == CMsgBox::mbrYes);//FIXME + int msgbox = ShowMsg(LOCALE_MESSAGEBOX_INFO, g_settings.shutdown_real ? LOCALE_SHUTDOWNTIMER_ANNOUNCE:LOCALE_SLEEPTIMERBOX_ANNOUNCE, + CMsgBox::mbrCancel, CMsgBox::mbCancel, NULL, 450, 60); + skipShutdownTimer = !(msgbox & CMsgBox::mbrTimeout); if(skipShutdownTimer) { printf("NeutrinoMessages::INACTIVITY SLEEPTIMER: skiping\n"); skipShutdownTimer = false; From efaa271c55e638a5a0b736e5ec271c41def634f1 Mon Sep 17 00:00:00 2001 From: vanhofen Date: Thu, 15 Dec 2016 11:37:57 +0100 Subject: [PATCH 3/3] yWeb: fix extentions-url to (still empty) gui-yweb repository Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/fdca96f7db1504d8a18f5334f2e42061810883e2 Author: vanhofen Date: 2016-12-15 (Thu, 15 Dec 2016) Origin message was: ------------------ - yWeb: fix extentions-url to (still empty) gui-yweb repository --- src/nhttpd/web/extentions.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/nhttpd/web/extentions.txt b/src/nhttpd/web/extentions.txt index c0eb6dcae..9df0559ef 100644 --- a/src/nhttpd/web/extentions.txt +++ b/src/nhttpd/web/extentions.txt @@ -1 +1 @@ -type:u,site:CST-git,desc:yWeb extentions,url:http://git.coolstreamtech.de/?p=cst-public-gui-yweb.git;a=blob_plain;hb=refs/heads/master;f=Y_Extentions.txt +type:u,site:Tuxbox-Neutrino,desc:yWeb extentions,url:https://raw.githubusercontent.com/tuxbox-neutrino/gui-yweb/master/Y_Extentions.txt