From 76f9f672a4a725d036d7c9750f4f3dd0be8b07a8 Mon Sep 17 00:00:00 2001 From: Jacek Jendrzej Date: Fri, 30 Dec 2016 17:04:11 +0100 Subject: [PATCH 1/9] supplement to 0bfddb0ffdb32c88529e3a4a5c9f60b495eee09b Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/df89326f60a28e420778ecd22657ebd207def1bf Author: Jacek Jendrzej Date: 2016-12-30 (Fri, 30 Dec 2016) --- src/zapit/src/fastscan.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/zapit/src/fastscan.cpp b/src/zapit/src/fastscan.cpp index 956d294e2..24007310e 100644 --- a/src/zapit/src/fastscan.cpp +++ b/src/zapit/src/fastscan.cpp @@ -77,7 +77,7 @@ diseq_test_param_t diseqc_test[] = { bool CServiceScan::TestDiseqcConfig(int num) { - if(num >= OPERATOR_MAX) { + if(num >= OPERATOR_MAX || num < 0) { INFO("[fast scan] invalid operator %d", num); return false; } @@ -218,7 +218,7 @@ bool CServiceScan::ScanFast() { fast_scan_type_t * fast_type = (fast_scan_type_t *) scan_arg; fs_operator_t num = fast_type->op; - if(num >= OPERATOR_MAX) { + if(num >= OPERATOR_MAX || num < 0) { INFO("[fast scan] invalid operator %d", num); return false; } @@ -231,7 +231,7 @@ bool CServiceScan::ScanFast() bool CServiceScan::ScanFast(int num, bool reload) { fast_scan_operator_t *op; - if(num >= OPERATOR_MAX) { + if(num >= OPERATOR_MAX || num < 0) { INFO("[fast scan] invalid operator %d", num); goto _err; } From de7feba8903bbb41fb9dbceb70e967105ec7aa93 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Thu, 29 Dec 2016 16:45:54 +0100 Subject: [PATCH 2/9] CComponentsButton: rename cc_btn_capt -> cc_btn_text More plausible Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/2889fbd70db1d670b60b7196b2037f3d891860ac Author: Thilo Graf Date: 2016-12-29 (Thu, 29 Dec 2016) --- src/gui/components/cc_frm_button.cpp | 70 ++++++++++++++-------------- src/gui/components/cc_frm_button.h | 16 +++---- 2 files changed, 43 insertions(+), 43 deletions(-) diff --git a/src/gui/components/cc_frm_button.cpp b/src/gui/components/cc_frm_button.cpp index 0331a5a75..00e068293 100644 --- a/src/gui/components/cc_frm_button.cpp +++ b/src/gui/components/cc_frm_button.cpp @@ -44,7 +44,7 @@ CComponentsButton::CComponentsButton( const int& x_pos, const int& y_pos, const int shadow_mode, fb_pixel_t color_frame, fb_pixel_t color_body, fb_pixel_t color_shadow) { - cc_btn_capt_locale = NONEXISTANT_LOCALE; + cc_btn_text_locale = NONEXISTANT_LOCALE; initVarButton(x_pos, y_pos, w, h, caption, icon_name, parent, selected, enabled, shadow_mode, color_frame, color_body, color_shadow); } @@ -56,8 +56,8 @@ CComponentsButton::CComponentsButton( const int& x_pos, const int& y_pos, const int shadow_mode, fb_pixel_t color_frame, fb_pixel_t color_body, fb_pixel_t color_shadow) { - cc_btn_capt_locale = caption_locale; - initVarButton(x_pos, y_pos, w, h, g_Locale->getText(cc_btn_capt_locale), icon_name, parent, selected, enabled, shadow_mode, color_frame, color_body, color_shadow); + cc_btn_text_locale = caption_locale; + initVarButton(x_pos, y_pos, w, h, g_Locale->getText(cc_btn_text_locale), icon_name, parent, selected, enabled, shadow_mode, color_frame, color_body, color_shadow); } CComponentsButton::CComponentsButton( const int& x_pos, const int& y_pos, const int& w, const int& h, @@ -81,8 +81,8 @@ CComponentsButton::CComponentsButton( const int& x_pos, const int& y_pos, const fb_pixel_t color_frame, fb_pixel_t color_body, fb_pixel_t color_shadow) { string _icon_name = icon_name == NULL ? "" : string(icon_name); - cc_btn_capt_locale = caption_locale; - initVarButton(x_pos, y_pos, w, h, g_Locale->getText(cc_btn_capt_locale), _icon_name, parent, selected, enabled, shadow_mode, color_frame, color_body, color_shadow); + cc_btn_text_locale = caption_locale; + initVarButton(x_pos, y_pos, w, h, g_Locale->getText(cc_btn_text_locale), _icon_name, parent, selected, enabled, shadow_mode, color_frame, color_body, color_shadow); } void CComponentsButton::initVarButton( const int& x_pos, const int& y_pos, const int& w, const int& h, @@ -116,14 +116,14 @@ void CComponentsButton::initVarButton( const int& x_pos, const int& y_pos, const append_y_offset = 0; corner_rad = RADIUS_SMALL; - cc_btn_capt_col = cc_body_gradient_enable ? COL_BUTTON_TEXT_ENABLED : COL_MENUFOOT_TEXT; - cc_btn_capt_disable_col = cc_body_gradient_enable ? COL_BUTTON_TEXT_DISABLED : COL_MENUCONTENTINACTIVE_TEXT; + cc_btn_text_col = cc_body_gradient_enable ? COL_BUTTON_TEXT_ENABLED : COL_MENUFOOT_TEXT; + cc_btn_text_disable_col = cc_body_gradient_enable ? COL_BUTTON_TEXT_DISABLED : COL_MENUCONTENTINACTIVE_TEXT; cc_btn_icon_obj = NULL; - cc_btn_capt_obj = NULL; + cc_btn_text_obj = NULL; cc_btn_dy_font = CNeutrinoFonts::getInstance(); cc_btn_font = NULL; cc_btn_icon = icon_name; - cc_btn_capt = caption; + cc_btn_text = caption; cc_directKey = CRCInput::RC_nokey; cc_directKeyAlt = cc_directKey; cc_btn_result = -1; @@ -172,24 +172,24 @@ void CComponentsButton::initIcon() void CComponentsButton::initCaption() { //init label as caption object and add to container - if (!cc_btn_capt.empty()){ - if (cc_btn_capt_obj == NULL){ - cc_btn_capt_obj = new CComponentsLabel(); - cc_btn_capt_obj->doPaintBg(false); - cc_btn_capt_obj->doPaintTextBoxBg(false); - cc_btn_capt_obj->enableTboxSaveScreen(cc_txt_save_screen); - addCCItem(cc_btn_capt_obj); + if (!cc_btn_text.empty()){ + if (cc_btn_text_obj == NULL){ + cc_btn_text_obj = new CComponentsLabel(); + cc_btn_text_obj->doPaintBg(false); + cc_btn_text_obj->doPaintTextBoxBg(false); + cc_btn_text_obj->enableTboxSaveScreen(cc_txt_save_screen); + addCCItem(cc_btn_text_obj); } }else{ - if (cc_btn_capt_obj){ - delete cc_btn_capt_obj; - cc_btn_capt_obj = NULL; + if (cc_btn_text_obj){ + delete cc_btn_text_obj; + cc_btn_text_obj = NULL; } } //set basic properties int w_frame = fr_thickness; - if (cc_btn_capt_obj){ + if (cc_btn_text_obj){ //position and size int x_cap = w_frame; x_cap += cc_btn_icon_obj ? cc_btn_icon_obj->getWidth() : 0; @@ -204,10 +204,10 @@ void CComponentsButton::initCaption() */ int y_cap = height/2 - h_cap/2; - cc_btn_capt_obj->setDimensionsAll(x_cap, y_cap, w_cap, h_cap); + cc_btn_text_obj->setDimensionsAll(x_cap, y_cap, w_cap, h_cap); //text and font - Font* def_font = *cc_btn_dy_font->getDynFont(w_cap, h_cap, cc_btn_capt); + Font* def_font = *cc_btn_dy_font->getDynFont(w_cap, h_cap, cc_btn_text); if (cc_btn_font == NULL){ /* use dynamic font as default font if no font defined */ cc_btn_font = def_font; @@ -220,26 +220,26 @@ void CComponentsButton::initCaption() } } - cc_btn_capt_obj->setText(cc_btn_capt, CTextBox::NO_AUTO_LINEBREAK, cc_btn_font); - cc_btn_capt_obj->forceTextPaint(); //here required; - cc_btn_capt_obj->getCTextBoxObject()->setTextBorderWidth(0,0); + cc_btn_text_obj->setText(cc_btn_text, CTextBox::NO_AUTO_LINEBREAK, cc_btn_font); + cc_btn_text_obj->forceTextPaint(); //here required; + cc_btn_text_obj->getCTextBoxObject()->setTextBorderWidth(0,0); //set color - cc_btn_capt_obj->setTextColor(this->cc_item_enabled ? cc_btn_capt_col : cc_btn_capt_disable_col); + cc_btn_text_obj->setTextColor(this->cc_item_enabled ? cc_btn_text_col : cc_btn_text_disable_col); //corner of text item - cc_btn_capt_obj->setCorner(corner_rad-w_frame, corner_type); + cc_btn_text_obj->setCorner(corner_rad-w_frame, corner_type); } //handle common position of icon and text inside container required for alignment int w_required = w_frame + append_x_offset; w_required += cc_btn_icon_obj ? cc_btn_icon_obj->getWidth() + append_x_offset : 0; - w_required += cc_btn_font ? cc_btn_font->getRenderWidth(cc_btn_capt) : 0; + w_required += cc_btn_font ? cc_btn_font->getRenderWidth(cc_btn_text) : 0; w_required += append_x_offset + w_frame; //dynamic width if (w_required > width){ - dprintf(DEBUG_INFO, "[CComponentsButton] [%s - %d] width of button (%s) will be changed: defined width=%d, required width=%d\n", __func__, __LINE__, cc_btn_capt.c_str(), width, w_required); + dprintf(DEBUG_INFO, "[CComponentsButton] [%s - %d] width of button (%s) will be changed: defined width=%d, required width=%d\n", __func__, __LINE__, cc_btn_text.c_str(), width, w_required); width = max(w_required, width); } @@ -256,22 +256,22 @@ void CComponentsButton::initCaption() int y_icon = height/2 - cc_btn_icon_obj->getHeight()/2; cc_btn_icon_obj->setYPos(y_icon); } - if (cc_btn_capt_obj){ - cc_btn_capt_obj->setXPos(x_icon + w_icon + append_x_offset); - cc_btn_capt_obj->setWidth(width - cc_btn_capt_obj->getXPos()); + if (cc_btn_text_obj){ + cc_btn_text_obj->setXPos(x_icon + w_icon + append_x_offset); + cc_btn_text_obj->setWidth(width - cc_btn_text_obj->getXPos()); } } void CComponentsButton::setCaption(const std::string& text) { - cc_btn_capt = text; + cc_btn_text = text; initCCBtnItems(); } void CComponentsButton::setCaption(const neutrino_locale_t locale_text) { - cc_btn_capt_locale = locale_text; - setCaption(g_Locale->getText(cc_btn_capt_locale)); + cc_btn_text_locale = locale_text; + setCaption(g_Locale->getText(cc_btn_text_locale)); } void CComponentsButton::initCCBtnItems() diff --git a/src/gui/components/cc_frm_button.h b/src/gui/components/cc_frm_button.h index 80653e2be..a0540636b 100644 --- a/src/gui/components/cc_frm_button.h +++ b/src/gui/components/cc_frm_button.h @@ -50,7 +50,7 @@ class CComponentsButton : public CComponentsFrmChain, public CCTextScreen ///object: picture object CComponentsPictureScalable *cc_btn_icon_obj; ///object: label object - CComponentsLabel *cc_btn_capt_obj; + CComponentsLabel *cc_btn_text_obj; ///initialize all required attributes and objects void initVarButton( const int& x_pos, const int& y_pos, const int& w, const int& h, @@ -63,9 +63,9 @@ class CComponentsButton : public CComponentsFrmChain, public CCTextScreen fb_pixel_t color_frame, fb_pixel_t color_body, fb_pixel_t color_shadow); ///property: button text as string, see also setCaption() and getCaptionString() - std::string cc_btn_capt; + std::string cc_btn_text; ///property: button text as locale, see also setCaption() and getCaptionLocale() - neutrino_locale_t cc_btn_capt_locale; + neutrino_locale_t cc_btn_text_locale; ///property: icon name, only icons supported, to find in gui/widget/icons.h std::string cc_btn_icon; @@ -80,9 +80,9 @@ class CComponentsButton : public CComponentsFrmChain, public CCTextScreen int cc_btn_alias; ///property: text color - fb_pixel_t cc_btn_capt_col; + fb_pixel_t cc_btn_text_col; ///property: text color for disabled button - fb_pixel_t cc_btn_capt_disable_col; + fb_pixel_t cc_btn_text_disable_col; ///object: text font Font* cc_btn_font; ///object: dynamic font object handler @@ -135,7 +135,7 @@ class CComponentsButton : public CComponentsFrmChain, public CCTextScreen fb_pixel_t color_frame = COL_SHADOW_PLUS_0, fb_pixel_t color_body = COL_BUTTON_BODY, fb_pixel_t color_shadow = COL_SHADOW_PLUS_0); ///set text color - inline virtual void setButtonTextColor(fb_pixel_t caption_color){cc_btn_capt_col = caption_color;}; + inline virtual void setButtonTextColor(fb_pixel_t caption_color){cc_btn_text_col = caption_color;}; /**Member to modify background behavior of embeded caption object. * @param[in] mode @@ -164,9 +164,9 @@ class CComponentsButton : public CComponentsFrmChain, public CCTextScreen virtual void setCaption(const neutrino_locale_t locale_text); ///get caption, type as std::string - inline virtual std::string getCaptionString(){return cc_btn_capt;}; + inline virtual std::string getCaptionString(){return cc_btn_text;}; ///get loacalized caption id, type = neutrino_locale_t - inline virtual neutrino_locale_t getCaptionLocale(){return cc_btn_capt_locale;}; + inline virtual neutrino_locale_t getCaptionLocale(){return cc_btn_text_locale;}; ///property: set font for label caption, parameter as font object, value NULL causes usaage of dynamic font virtual void setButtonFont(Font* font){cc_btn_font = font; initCCBtnItems();}; From 64e72db3a4f063828374a83055ec259637e5b5bc Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Tue, 27 Dec 2016 21:02:34 +0100 Subject: [PATCH 3/9] CComponentsHeader: declare l_font, s_font as global Useful for init in header sub classes. So its possible to use other prefined size mode fonts Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/4cdae3fdf6eb269a6d2b9413ff7842cf46e04e45 Author: Thilo Graf Date: 2016-12-27 (Tue, 27 Dec 2016) --- src/gui/components/cc_frm_header.cpp | 5 ++--- src/gui/components/cc_frm_header.h | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/gui/components/cc_frm_header.cpp b/src/gui/components/cc_frm_header.cpp index f4f10ba20..f746404d4 100644 --- a/src/gui/components/cc_frm_header.cpp +++ b/src/gui/components/cc_frm_header.cpp @@ -96,6 +96,8 @@ void CComponentsHeader::initVarHeader( const int& x_pos, const int& y_pos, const height = height_old = h; cch_font = NULL; + l_font = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]; + s_font = g_Font[SNeutrinoSettings::FONT_TYPE_MENU]; cch_size_mode = CC_HEADER_SIZE_LARGE; CNeutrinoApp::getInstance()->OnAfterSetupFonts.connect(sigc::mem_fun(this, &CComponentsHeader::resetFont)); @@ -172,9 +174,6 @@ void CComponentsHeader::resetFont() void CComponentsHeader::initCaptionFont() { - Font *l_font = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]; - Font *s_font = g_Font[SNeutrinoSettings::FONT_TYPE_MENU]; - if (cch_font == NULL){ cch_font = (cch_size_mode == CC_HEADER_SIZE_LARGE? l_font : s_font); //select matching height diff --git a/src/gui/components/cc_frm_header.h b/src/gui/components/cc_frm_header.h index 6d3169c12..98ec74125 100644 --- a/src/gui/components/cc_frm_header.h +++ b/src/gui/components/cc_frm_header.h @@ -67,7 +67,7 @@ class CComponentsHeader : public CComponentsForm, public CCTextScreen ///property: caption text color, see also setCaptionColor() fb_pixel_t cch_col_text; ///property: caption font, see also setCaptionFont() - Font* cch_font; + Font* cch_font, *l_font, *s_font; ///reset font void resetFont(); From 4e593fbc799b81e30952b404623e5c6a8eed0b15 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Thu, 29 Dec 2016 23:26:52 +0100 Subject: [PATCH 4/9] settings: add explicit button font Fonts for menu foot and button font are not not necessarily the same thing. TODO: locales Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/65ac231940b75a73d8449ea184d4cf6a97528ae1 Author: Thilo Graf Date: 2016-12-29 (Thu, 29 Dec 2016) --- src/gui/osd_setup.cpp | 6 ++++-- src/system/locals.h | 1 + src/system/locals_intern.h | 1 + src/system/settings.h | 1 + 4 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/gui/osd_setup.cpp b/src/gui/osd_setup.cpp index 73b9e0ad9..698ac5110 100644 --- a/src/gui/osd_setup.cpp +++ b/src/gui/osd_setup.cpp @@ -160,7 +160,8 @@ size_t moviebrowser_font_items = sizeof(moviebrowser_font_sizes)/sizeof(moviebro const SNeutrinoSettings::FONT_TYPES other_font_sizes[] = { SNeutrinoSettings::FONT_TYPE_SUBTITLES, - SNeutrinoSettings::FONT_TYPE_FILEBROWSER_ITEM + SNeutrinoSettings::FONT_TYPE_FILEBROWSER_ITEM, + SNeutrinoSettings::FONT_TYPE_BUTTON_TEXT }; size_t other_font_items = sizeof(other_font_sizes)/sizeof(other_font_sizes[0]); @@ -214,7 +215,8 @@ font_sizes_struct neutrino_font[SNeutrinoSettings::FONT_TYPE_COUNT] = {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_MESSAGE_TEXT , 20, CNeutrinoFonts::FONT_STYLE_REGULAR, 1} + {LOCALE_FONTSIZE_MESSAGE_TEXT , 20, CNeutrinoFonts::FONT_STYLE_REGULAR, 1}, + {LOCALE_FONTSIZE_BUTTON_TEXT , 14, CNeutrinoFonts::FONT_STYLE_REGULAR, 0} }; int COsdSetup::exec(CMenuTarget* parent, const std::string &actionKey) diff --git a/src/system/locals.h b/src/system/locals.h index 4e5548044..9bc970415 100644 --- a/src/system/locals.h +++ b/src/system/locals.h @@ -739,6 +739,7 @@ typedef enum LOCALE_FONTMENU_SCALING_Y, LOCALE_FONTMENU_SCALING_Y_HINT2, LOCALE_FONTMENU_SIZES, + LOCALE_FONTSIZE_BUTTON_TEXT, LOCALE_FONTSIZE_CHANNEL_NUM_ZAP, LOCALE_FONTSIZE_CHANNELLIST, LOCALE_FONTSIZE_CHANNELLIST_DESCR, diff --git a/src/system/locals_intern.h b/src/system/locals_intern.h index bb613b5cb..2ec577772 100644 --- a/src/system/locals_intern.h +++ b/src/system/locals_intern.h @@ -739,6 +739,7 @@ const char * locale_real_names[] = "fontmenu.scaling_y", "fontmenu.scaling_y_hint2", "fontmenu.sizes", + "fontsize.button_text", "fontsize.channel_num_zap", "fontsize.channellist", "fontsize.channellist_descr", diff --git a/src/system/settings.h b/src/system/settings.h index bb82c729a..6d8bb8dc7 100644 --- a/src/system/settings.h +++ b/src/system/settings.h @@ -688,6 +688,7 @@ struct SNeutrinoSettings FONT_TYPE_MOVIEBROWSER_INFO, FONT_TYPE_SUBTITLES, FONT_TYPE_MESSAGE_TEXT, + FONT_TYPE_BUTTON_TEXT, FONT_TYPE_COUNT }; From 1087e8fc7dbda88d5ea4c77cdbf5318fe4a76dc3 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Thu, 29 Dec 2016 21:27:14 +0100 Subject: [PATCH 5/9] locales: add locales for buttontext settings supplement to: 0bf74271652982ff69f378589ee3b8409dce003f Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/4b4c295289c00e1fc10df1ced8efd77d9ce079b4 Author: Thilo Graf Date: 2016-12-29 (Thu, 29 Dec 2016) --- data/locale/deutsch.locale | 1 + data/locale/english.locale | 1 + data/locale/nederlands.locale | 1 + data/locale/slovak.locale | 1 + 4 files changed, 4 insertions(+) diff --git a/data/locale/deutsch.locale b/data/locale/deutsch.locale index 34c4d0964..96b9a5525 100644 --- a/data/locale/deutsch.locale +++ b/data/locale/deutsch.locale @@ -712,6 +712,7 @@ fontmenu.scaling_x_hint2 Horizontal (in %) min 50 / max 200 fontmenu.scaling_y Vertikal (in %) fontmenu.scaling_y_hint2 Vertikal (in %) min 50 / max 200 fontmenu.sizes Schriftgrößen +fontsize.button_text Schaltflächen-Text fontsize.channel_num_zap Direktauswahl fontsize.channellist Kanalliste fontsize.channellist_descr Beschreibung diff --git a/data/locale/english.locale b/data/locale/english.locale index 91d07f067..4ff1c72e3 100644 --- a/data/locale/english.locale +++ b/data/locale/english.locale @@ -712,6 +712,7 @@ fontmenu.scaling_x_hint2 Horizontal (in %) min 50 / max 200 fontmenu.scaling_y Vertical (in %) fontmenu.scaling_y_hint2 Vertical (in %) min 50 / max 200 fontmenu.sizes Font sizes +fontsize.button_text Button text fontsize.channel_num_zap direct selection fontsize.channellist Channellist fontsize.channellist_descr Description diff --git a/data/locale/nederlands.locale b/data/locale/nederlands.locale index dcd277284..b4c78e9e0 100644 --- a/data/locale/nederlands.locale +++ b/data/locale/nederlands.locale @@ -665,6 +665,7 @@ fontmenu.scaling_x_hint2 Horizontaal (in %) min 50 / max 200 fontmenu.scaling_y Verticaal (in %) fontmenu.scaling_y_hint2 Verticaal (in %) min 50 / max 200 fontmenu.sizes Lettertype grootte +fontsize.button_text Button text fontsize.channel_num_zap directe selectie fontsize.channellist Kanalenlijst fontsize.channellist_descr Omschrijving diff --git a/data/locale/slovak.locale b/data/locale/slovak.locale index 1eb61286d..22ca09a52 100644 --- a/data/locale/slovak.locale +++ b/data/locale/slovak.locale @@ -712,6 +712,7 @@ fontmenu.scaling_x_hint2 Vodorovne (v %) min 50 / max 200 fontmenu.scaling_y Zvislo (v %) fontmenu.scaling_y_hint2 Zvislo (v %) min 50 / max 200 fontmenu.sizes Veľkosti písma +fontsize.button_text Button text fontsize.channel_num_zap Priamy výber fontsize.channellist Zoznam kanálov fontsize.channellist_descr Popis From ddb8e2f3976a6c8fceebefe512a30e71c42affe2 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Thu, 29 Dec 2016 21:14:58 +0100 Subject: [PATCH 6/9] CComponentsTimer: try to fix possible uncanceled thread Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/e9122fbc4bddbc828bba0b785c805f212e46ecd9 Author: Thilo Graf Date: 2016-12-29 (Thu, 29 Dec 2016) --- src/gui/components/cc_timer.cpp | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/gui/components/cc_timer.cpp b/src/gui/components/cc_timer.cpp index 566a829e1..11ae9b35e 100644 --- a/src/gui/components/cc_timer.cpp +++ b/src/gui/components/cc_timer.cpp @@ -98,7 +98,8 @@ void CComponentsTimer::initThread() if (res != 0){ dprintf(DEBUG_NORMAL,"\033[33m[CComponentsTimer] [%s - %d] ERROR! pthread_create\033[0m\n", __func__, __LINE__); return; - } + }else + dprintf(DEBUG_DEBUG,"\033[33m[CComponentsTimer] [%s - %d] started thread ID:%ld \033[0m\n", __func__, __LINE__, pthread_self()); if (res == 0) CNeutrinoApp::getInstance()->OnBeforeRestart.connect(sl_stop_timer); @@ -111,17 +112,17 @@ void CComponentsTimer::stopThread() while (!sl_stop_timer.empty()) sl_stop_timer.disconnect(); - if(tm_thread) { + while(tm_thread) { int thres = pthread_cancel(tm_thread); if (thres != 0) - dprintf(DEBUG_NORMAL,"\033[33m[CComponentsTimer] [%s - %d] ERROR! pthread_cancel, [%d]\033[0m\n", __func__, __LINE__, thres); + dprintf(DEBUG_NORMAL,"\033[33m[CComponentsTimer] [%s - %d] ERROR! pthread_cancel, error [%d] %s\033[0m\n", __func__, __LINE__, thres, strerror(thres)); - thres = pthread_join(tm_thread, NULL); + void* res; + thres = pthread_join(tm_thread, &res); - if (thres != 0) - dprintf(DEBUG_NORMAL, "\033[33m[CComponentsTimer] [%s - %d] ERROR! pthread_join, [%d]\033[0m\n", __func__, __LINE__, thres); - - if (thres == 0) + if (res != PTHREAD_CANCELED) + dprintf(DEBUG_NORMAL, "\033[33m[CComponentsTimer] [%s - %d] ERROR! pthread_join, thread ID:%ld, error [%d] %s\033[0m\n", __func__, __LINE__, pthread_self(), thres, strerror(thres)); + else tm_thread = 0; } } From 7072471b760f70fd7b42f9efc2da54be459c3da6 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Thu, 29 Dec 2016 23:38:18 +0100 Subject: [PATCH 7/9] CComponentsWindow: use FONT_TYPE_BUTTON_TEXT instead FONT_TYPE_MENU_FOOT Buttton text is not the same like footer text. Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/6a3b07152f2a1afaffa8d90a374d50ce22821f3b Author: Thilo Graf Date: 2016-12-29 (Thu, 29 Dec 2016) --- src/gui/components/cc_frm_window.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/components/cc_frm_window.cpp b/src/gui/components/cc_frm_window.cpp index 451d74be3..7137f76ab 100644 --- a/src/gui/components/cc_frm_window.cpp +++ b/src/gui/components/cc_frm_window.cpp @@ -145,7 +145,7 @@ void CComponentsWindow::initVarWindow( const int& x_pos, const int& y_pos, const ccw_right_sidebar= NULL; ccw_body = NULL; ccw_footer = NULL; - ccw_button_font = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_FOOT]; + ccw_button_font = g_Font[SNeutrinoSettings::FONT_TYPE_BUTTON_TEXT]; ccw_buttons = 0; //no header buttons ccw_show_footer = true; From 476641a626811b5906c32dae8b12a2734b12711e Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Thu, 29 Dec 2016 23:42:35 +0100 Subject: [PATCH 8/9] CComponentsHeader/CComponentsFooter: prevent crash on changed font settings Default fonts for header and footer must be handled too. After font settings changes these objects could be invalid. Default fonts have invalid pointers after font changes too. Extra reset is required. Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/b98319cb91d9c595c7d43fb1198e0064ffee99c2 Author: Thilo Graf Date: 2016-12-29 (Thu, 29 Dec 2016) --- src/gui/components/cc_frm_footer.cpp | 13 ++++++++++++- src/gui/components/cc_frm_footer.h | 3 +++ src/gui/components/cc_frm_header.cpp | 12 +++++++++--- src/gui/components/cc_frm_header.h | 2 ++ 4 files changed, 26 insertions(+), 4 deletions(-) diff --git a/src/gui/components/cc_frm_footer.cpp b/src/gui/components/cc_frm_footer.cpp index 9874a122b..befc333e8 100644 --- a/src/gui/components/cc_frm_footer.cpp +++ b/src/gui/components/cc_frm_footer.cpp @@ -68,6 +68,12 @@ void CComponentsFooter::initVarFooter( const int& x_pos, const int& y_pos, const //init footer width width = w == 0 ? frameBuffer->getScreenWidth(true) : w; + //init default fonts + initDefaultFonts(); + + //init default button text font + ccf_btn_font = g_Font[SNeutrinoSettings::FONT_TYPE_BUTTON_TEXT]; + //init footer height initCaptionFont(); height = max(h, cch_font->getHeight()); @@ -88,7 +94,6 @@ void CComponentsFooter::initVarFooter( const int& x_pos, const int& y_pos, const corner_type = CORNER_BOTTOM; ccf_enable_button_bg = false /*g_settings.theme.Button_gradient*/; //TODO: not implemented at the moment - ccf_btn_font = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_FOOT]; chain = NULL; addContextButton(buttons); @@ -426,3 +431,9 @@ void CComponentsFooter::enableButtonShadow(int mode, const int& shadow_width, bo } } } + +void CComponentsFooter::initDefaultFonts() +{ + l_font = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]; + s_font = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_FOOT]; +} diff --git a/src/gui/components/cc_frm_footer.h b/src/gui/components/cc_frm_footer.h index 4c5239d56..b70292765 100644 --- a/src/gui/components/cc_frm_footer.h +++ b/src/gui/components/cc_frm_footer.h @@ -84,6 +84,9 @@ class CComponentsFooter : public CComponentsHeader ///property: set font for label caption, see also setButtonFont() Font* ccf_btn_font; + ///init default fonts for size modes + virtual void initDefaultFonts(); + ///container for button objects CComponentsFrmChain *chain; diff --git a/src/gui/components/cc_frm_header.cpp b/src/gui/components/cc_frm_header.cpp index f746404d4..7f36522c4 100644 --- a/src/gui/components/cc_frm_header.cpp +++ b/src/gui/components/cc_frm_header.cpp @@ -96,8 +96,7 @@ void CComponentsHeader::initVarHeader( const int& x_pos, const int& y_pos, const height = height_old = h; cch_font = NULL; - l_font = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]; - s_font = g_Font[SNeutrinoSettings::FONT_TYPE_MENU]; + initDefaultFonts(); cch_size_mode = CC_HEADER_SIZE_LARGE; CNeutrinoApp::getInstance()->OnAfterSetupFonts.connect(sigc::mem_fun(this, &CComponentsHeader::resetFont)); @@ -167,9 +166,16 @@ void CComponentsHeader::setCaptionFont(Font* font) void CComponentsHeader::resetFont() { if (cch_font){ - cch_font = NULL; dprintf(DEBUG_DEBUG, "\033[33m[CComponentsHeader][%s - %d] reset header font \033[0m\n", __func__, __LINE__); + cch_font = NULL; } + initDefaultFonts(); +} + +void CComponentsHeader::initDefaultFonts() +{ + l_font = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]; + s_font = g_Font[SNeutrinoSettings::FONT_TYPE_MENU]; } void CComponentsHeader::initCaptionFont() diff --git a/src/gui/components/cc_frm_header.h b/src/gui/components/cc_frm_header.h index 98ec74125..df444ee7a 100644 --- a/src/gui/components/cc_frm_header.h +++ b/src/gui/components/cc_frm_header.h @@ -102,6 +102,8 @@ class CComponentsHeader : public CComponentsForm, public CCTextScreen ///init font object and recalculates height if required void initCaptionFont(); + ///init default fonts for size modes + virtual void initDefaultFonts(); ///sub: init icon object void initIcon(); ///sub: init caption object From a1356ceff6ff9046637f24c910f8609880b914f9 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Thu, 29 Dec 2016 23:44:56 +0100 Subject: [PATCH 9/9] CComponentsButton: try to fix font size in buttons Some text in button chains had different font sizes. To see in some Messageboxes. Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/b3354089136e6a15d033bf7fd09f707e9b4ad51b Author: Thilo Graf Date: 2016-12-29 (Thu, 29 Dec 2016) --- src/gui/components/cc_frm_button.cpp | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/src/gui/components/cc_frm_button.cpp b/src/gui/components/cc_frm_button.cpp index 00e068293..18b3d31ea 100644 --- a/src/gui/components/cc_frm_button.cpp +++ b/src/gui/components/cc_frm_button.cpp @@ -33,7 +33,6 @@ #include #include "cc_frm_button.h" - using namespace std; CComponentsButton::CComponentsButton( const int& x_pos, const int& y_pos, const int& w, const int& h, @@ -121,7 +120,7 @@ void CComponentsButton::initVarButton( const int& x_pos, const int& y_pos, const cc_btn_icon_obj = NULL; cc_btn_text_obj = NULL; cc_btn_dy_font = CNeutrinoFonts::getInstance(); - cc_btn_font = NULL; + cc_btn_font = g_Font[SNeutrinoSettings::FONT_TYPE_BUTTON_TEXT]; cc_btn_icon = icon_name; cc_btn_text = caption; cc_directKey = CRCInput::RC_nokey; @@ -194,8 +193,12 @@ void CComponentsButton::initCaption() int x_cap = w_frame; x_cap += cc_btn_icon_obj ? cc_btn_icon_obj->getWidth() : 0; + /* use system defined font as default if not defined */ + if (cc_btn_font == NULL) + cc_btn_font = g_Font[SNeutrinoSettings::FONT_TYPE_BUTTON_TEXT]; + int w_cap = width - w_frame - append_x_offset - x_cap - w_frame; - int h_cap = (height*85/100) - 2*w_frame; + int h_cap = min(height - 2*w_frame, cc_btn_font->getHeight()); /*NOTE: paint of centered text in y direction without y_offset looks unlovely displaced in y direction especially besides small icons and inside small areas, @@ -208,17 +211,12 @@ void CComponentsButton::initCaption() //text and font Font* def_font = *cc_btn_dy_font->getDynFont(w_cap, h_cap, cc_btn_text); - if (cc_btn_font == NULL){ - /* use dynamic font as default font if no font defined */ + /* If button dimension too small, use dynamic font, this ignores possible defined font + * Otherwise definied font will be used. Button dimensions are calculated from parent container (e.g. footer...). + * These dimensions must be enough to display complete content like possible icon and without truncated text. + */ + if ((cc_btn_font->getHeight()- 2*w_frame) > h_cap && (cc_btn_font->getRenderWidth(cc_btn_text)- 2*w_frame) > w_cap) cc_btn_font = def_font; - }else{ - /* if button dimension too small, use dynamic font as default font size, this ignores possible defined font - * Otherwise definied font will be used. - */ - if (cc_btn_font->getHeight() > h_cap){ - cc_btn_font = def_font; - } - } cc_btn_text_obj->setText(cc_btn_text, CTextBox::NO_AUTO_LINEBREAK, cc_btn_font); cc_btn_text_obj->forceTextPaint(); //here required;