diff --git a/src/gui/audioplayer.cpp b/src/gui/audioplayer.cpp index 915565a93..823a0ff99 100644 --- a/src/gui/audioplayer.cpp +++ b/src/gui/audioplayer.cpp @@ -1580,7 +1580,7 @@ void CAudioPlayerGui::paintHead() if (!m_show_playlist || m_screensaver) return; - CComponentsHeader header(m_x, m_y + m_title_height, m_width, m_theight, LOCALE_AUDIOPLAYER_HEAD, NEUTRINO_ICON_MP3); + CComponentsHeaderLocalized header(m_x, m_y + m_title_height, m_width, m_theight, LOCALE_AUDIOPLAYER_HEAD, NEUTRINO_ICON_MP3); header.setCorner(RADIUS_MID, CORNER_TOP); if (m_inetmode) diff --git a/src/gui/bedit/bouqueteditor_bouquets.cpp b/src/gui/bedit/bouqueteditor_bouquets.cpp index 4d4093147..98d9d4949 100644 --- a/src/gui/bedit/bouqueteditor_bouquets.cpp +++ b/src/gui/bedit/bouqueteditor_bouquets.cpp @@ -131,7 +131,7 @@ void CBEBouquetWidget::paint() void CBEBouquetWidget::paintHead() { - CComponentsHeader header(x, y, width, theight, LOCALE_BOUQUETLIST_HEAD, NULL /*no header icon*/, CComponentsHeader::CC_BTN_MENU); + CComponentsHeaderLocalized header(x, y, width, theight, LOCALE_BOUQUETLIST_HEAD, "" /*no header icon*/, CComponentsHeaderLocalized::CC_BTN_MENU); header.paint(CC_SAVE_SCREEN_NO); } diff --git a/src/gui/bedit/bouqueteditor_channels.cpp b/src/gui/bedit/bouqueteditor_channels.cpp index 983b53487..484c27958 100644 --- a/src/gui/bedit/bouqueteditor_channels.cpp +++ b/src/gui/bedit/bouqueteditor_channels.cpp @@ -167,7 +167,7 @@ void CBEChannelWidget::paint() void CBEChannelWidget::paintHead() { - CComponentsHeader header(x, y, width, theight, caption.c_str(), NULL /*no header icon*/); + CComponentsHeader header(x, y, width, theight, caption); header.paint(CC_SAVE_SCREEN_NO); } diff --git a/src/gui/bookmarkmanager.cpp b/src/gui/bookmarkmanager.cpp index 1fb407497..672a9bb45 100644 --- a/src/gui/bookmarkmanager.cpp +++ b/src/gui/bookmarkmanager.cpp @@ -405,7 +405,7 @@ void CBookmarkManager::hide() //------------------------------------------------------------------------ void CBookmarkManager::paintHead() { - CComponentsHeader header(x, y, width, theight, LOCALE_BOOKMARKMANAGER_NAME, NEUTRINO_ICON_BOOKMARK_MANAGER, CComponentsHeader::CC_BTN_HELP); + CComponentsHeaderLocalized header(x, y, width, theight, LOCALE_BOOKMARKMANAGER_NAME, NEUTRINO_ICON_BOOKMARK_MANAGER, CComponentsHeaderLocalized::CC_BTN_HELP); header.paint(CC_SAVE_SCREEN_NO); } diff --git a/src/gui/bouquetlist.cpp b/src/gui/bouquetlist.cpp index 421d30f0e..1312d6ec0 100644 --- a/src/gui/bouquetlist.cpp +++ b/src/gui/bouquetlist.cpp @@ -591,7 +591,7 @@ void CBouquetList::paintItem(int pos) void CBouquetList::paintHead() { - CComponentsHeader header(x, y, width, theight, name, NULL /*no header icon*/); + CComponentsHeader header(x, y, width, theight, name); header.paint(CC_SAVE_SCREEN_NO); } diff --git a/src/gui/channellist.cpp b/src/gui/channellist.cpp index 1bbe50a57..40e32cab6 100644 --- a/src/gui/channellist.cpp +++ b/src/gui/channellist.cpp @@ -2125,7 +2125,7 @@ void CChannelList::paintItem(int pos, const bool firstpaint) void CChannelList::paintHead() { - CComponentsHeader header(x, y, full_width, theight, name, NULL /*no header icon*/); + CComponentsHeader header(x, y, full_width, theight, name /*no header icon*/); header.paint(CC_SAVE_SCREEN_NO); if (g_Sectionsd->getIsTimeSet()) { diff --git a/src/gui/components/cc_base.cpp b/src/gui/components/cc_base.cpp index 8b30596b9..a2d688000 100644 --- a/src/gui/components/cc_base.cpp +++ b/src/gui/components/cc_base.cpp @@ -90,8 +90,18 @@ void CComponents::paintFbItems(bool do_save_bg) if (firstPaint && do_save_bg) { for(size_t i=0; isave screen: %d, fbdata_type: %d\n", __func__, __LINE__, firstPaint, v_fbdata[i].fbdata_type); + printf("\t[CComponents]\n\t[%s - %d] firstPaint->save screen: %d, fbdata_type: %d\n\tx = %d\n\ty = %d\n\tdx = %d\n\tdy = %d\n", + __func__, + __LINE__, + firstPaint, + v_fbdata[i].fbdata_type, + v_fbdata[i].x, + v_fbdata[i].y, + v_fbdata[i].dx, + v_fbdata[i].dy); #endif saved_screen.x = v_fbdata[i].x; saved_screen.y = v_fbdata[i].y; @@ -109,18 +119,21 @@ void CComponents::paintFbItems(bool do_save_bg) // Don't paint if dx or dy are 0 if ((v_fbdata[i].dx == 0) || (v_fbdata[i].dy == 0)){ #ifdef DEBUG_CC - printf(" [CComponents] WARNING: [%s - %d], dx = %d dy = %d\n", __func__, __LINE__, v_fbdata[i].dx, v_fbdata[i].dy); + printf("\t[CComponents] WARNING: [%s - %d], dx = %d dy = %d\n", __func__, __LINE__, v_fbdata[i].dx, v_fbdata[i].dy); #endif continue; } - if ((v_fbdata[i].x == 0) || (v_fbdata[i].y == 0)){ - printf(" [CComponents] WARNING: [%s - %d], x = %d y = %d\n", __func__, __LINE__, v_fbdata[i].x, v_fbdata[i].y); - } - int fbtype = v_fbdata[i].fbdata_type; #ifdef DEBUG_CC - printf(" [CComponents]\n [%s - %d], fbdata_[%d] \n x = %d\n y = %d\n dx = %d\n dy = %d\n", __func__, __LINE__, (int)i, v_fbdata[i].x, v_fbdata[i].y, v_fbdata[i].dx, v_fbdata[i].dy); + printf("\t[CComponents]\n\t[%s - %d], fbdata_[%d]\n\tx = %d\n\ty = %d\n\tdx = %d\n\tdy = %d\n", + __func__, + __LINE__, + (int)i, + v_fbdata[i].x, + v_fbdata[i].y, + v_fbdata[i].dx, + v_fbdata[i].dy); #endif //some elements can be assembled from lines and must be handled as one unit (see details line), //so all individual backgrounds of boxes must be saved and painted in "firstpaint mode" diff --git a/src/gui/components/cc_frm_footer.cpp b/src/gui/components/cc_frm_footer.cpp index 8ad8ff113..f03a2f37e 100644 --- a/src/gui/components/cc_frm_footer.cpp +++ b/src/gui/components/cc_frm_footer.cpp @@ -17,10 +17,8 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - You should have received a copy of the GNU General Public - License along with this program; if not, write to the - Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, - Boston, MA 02110-1301, USA. + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ #ifdef HAVE_CONFIG_H @@ -38,34 +36,50 @@ using namespace std; CComponentsFooter::CComponentsFooter() { //CComponentsFooter - initVarFooter(); + initVarFooter(1, 1, 0, 0); } -CComponentsFooter::CComponentsFooter( const int x_pos, const int y_pos, const int w, const int h, const int buttons, bool has_shadow, - fb_pixel_t color_frame, fb_pixel_t color_body, fb_pixel_t color_shadow ) +CComponentsFooter::CComponentsFooter( const int& x_pos, const int& y_pos, const int& w, const int& h, + const int& buttons, + bool has_shadow, + fb_pixel_t color_frame, + fb_pixel_t color_body, + fb_pixel_t color_shadow ) { //CComponentsFooter - initVarFooter(); + initVarFooter(x_pos, y_pos, w, h, buttons, has_shadow, color_frame, color_body, color_shadow); +} - x = x_pos; - y = y_pos; - width = w; - height = h; +void CComponentsFooter::initVarFooter( const int& x_pos, const int& y_pos, const int& w, const int& h, + const int& buttons, + bool has_shadow, + fb_pixel_t color_frame, + fb_pixel_t color_body, + fb_pixel_t color_shadow ) +{ + cc_item_type = CC_ITEMTYPE_FOOTER; + + x = x_pos; + y = y_pos; + + //init footer width + width = w == 0 ? frameBuffer->getScreenWidth(true) : w; + //init header height + cch_font = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]; + if (h > 0) + height = h; + else + height = cch_font->getHeight(); + + cch_buttons = buttons; shadow = has_shadow; col_frame = color_frame; col_body = color_body; col_shadow = color_shadow; - cch_buttons = buttons; + corner_rad = RADIUS_LARGE; + corner_type = CORNER_BOTTOM; initDefaultButtons(); initCCItems(); } - - -void CComponentsFooter::initVarFooter() -{ - cc_item_type = CC_ITEMTYPE_FOOTER; - corner_rad = RADIUS_LARGE; - corner_type = CORNER_BOTTOM; -} diff --git a/src/gui/components/cc_frm_header.cpp b/src/gui/components/cc_frm_header.cpp index d1f14e5fd..4c1cc4c4b 100644 --- a/src/gui/components/cc_frm_header.cpp +++ b/src/gui/components/cc_frm_header.cpp @@ -37,80 +37,73 @@ using namespace std; CComponentsHeader::CComponentsHeader() { //CComponentsHeader - initVarHeader(); + initVarHeader(1, 1, 0, 0, "", "", 0); } -CComponentsHeader::CComponentsHeader( const int x_pos, const int y_pos, const int w, const int h, const std::string& caption, const char* icon_name, const int buttons, bool has_shadow, - fb_pixel_t color_frame, fb_pixel_t color_body, fb_pixel_t color_shadow) +CComponentsHeader::CComponentsHeader( const int& x_pos, const int& y_pos, const int& w, const int& h, + const std::string& caption, + const std::string& icon_name, + const int& buttons, + bool has_shadow, + fb_pixel_t color_frame, + fb_pixel_t color_body, + fb_pixel_t color_shadow) { - //CComponentsHeader - initVarHeader(); + initVarHeader(x_pos, y_pos, w, h, caption, icon_name, buttons, has_shadow, color_frame, color_body, color_shadow); +} + +CComponentsHeaderLocalized::CComponentsHeaderLocalized( const int& x_pos, const int& y_pos, const int& w, const int& h, + neutrino_locale_t caption_locale, + const std::string& icon_name, + const int& buttons, + bool has_shadow, + fb_pixel_t color_frame, + fb_pixel_t color_body, + fb_pixel_t color_shadow) + :CComponentsHeader( x_pos, y_pos, w, h, + g_Locale->getText(caption_locale), + icon_name, buttons, + has_shadow, + color_frame, color_body, color_shadow){}; + +void CComponentsHeader::initVarHeader( const int& x_pos, const int& y_pos, const int& w, const int& h, + const std::string& caption, + const std::string& icon_name, + const int& buttons, + bool has_shadow, + fb_pixel_t color_frame, + fb_pixel_t color_body, + fb_pixel_t color_shadow) +{ + cc_item_type = CC_ITEMTYPE_FRM_HEADER; + + x = x_pos; + y = y_pos; + + //init header width + width = w == 0 ? frameBuffer->getScreenWidth(true) : w; + + //init header default height + height = 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; - x = x_pos; - y = y_pos; - width = w; - if (h > 0) { - userHeight = true; - height = h; - } shadow = has_shadow; col_frame = color_frame; col_body = color_body; col_shadow = color_shadow; - + col_body = COL_MENUHEAD_PLUS_0; cch_text = caption; cch_icon_name = icon_name; cch_buttons = buttons; - - initDefaultButtons(); - initCCItems(); -} -CComponentsHeader::CComponentsHeader( const int x_pos, const int y_pos, const int w, const int h, neutrino_locale_t caption_locale, const char* icon_name, const int buttons, bool has_shadow, - fb_pixel_t color_frame, fb_pixel_t color_body, fb_pixel_t color_shadow) -{ - //CComponentsHeader - initVarHeader(); - - x = x_pos; - y = y_pos; - width = w; - if (h > 0) { - userHeight = true; - height = h; - } - shadow = has_shadow; - col_frame = color_frame; - col_body = color_body; - col_shadow = color_shadow; - - cch_text = g_Locale->getText(caption_locale); - cch_icon_name = icon_name; - cch_buttons = buttons; + corner_rad = RADIUS_LARGE, + corner_type = CORNER_TOP; - initDefaultButtons(); - initCCItems(); -} - -void CComponentsHeader::initVarHeader() -{ - cc_item_type = CC_ITEMTYPE_FRM_HEADER; - col_body = COL_MENUHEAD_PLUS_0; - corner_rad = RADIUS_LARGE, - corner_type = CORNER_TOP; - - //init header height - cch_size_mode = CC_HEADER_SIZE_LARGE; - cch_font = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]; - height = cch_font->getHeight(); - userHeight = false; - - //CComponentsHeader cch_icon_obj = NULL; cch_text_obj = NULL; - cch_icon_name = NULL; cch_btn_obj = NULL; - cch_text = ""; cch_col_text = COL_MENUHEAD_TEXT; cch_caption_align = CTextBox::NO_AUTO_LINEBREAK; cch_items_y = 0; @@ -118,11 +111,12 @@ void CComponentsHeader::initVarHeader() cch_icon_x = cch_offset; cch_icon_w = 0; cch_text_x = cch_offset; - cch_buttons = 0; cch_buttons_w = 0; cch_buttons_h = 0; cch_buttons_space = cch_offset; - v_cch_btn.clear(); + + initDefaultButtons(); + initCCItems(); } CComponentsHeader::~CComponentsHeader() @@ -145,13 +139,42 @@ void CComponentsHeader::setCaption(neutrino_locale_t caption_locale, const int& cch_caption_align = align_mode; } -void CComponentsHeader::setCaptionFont(Font* font_name) +void CComponentsHeader::setCaptionFont(Font* font) { - cch_font = font_name; - height = std::max(height, cch_font->getHeight()); + initCaptionFont(font); //cch_font = font +} + +void CComponentsHeader::initCaptionFont(Font* font) +{ + Font *l_font = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]; + Font *s_font = g_Font[SNeutrinoSettings::FONT_TYPE_MENU]; + + if (font == NULL){ + cch_font = (cch_size_mode == CC_HEADER_SIZE_LARGE? l_font : s_font); + + //select matching height + if (cch_size_mode == CC_HEADER_SIZE_LARGE) + height = std::max(height, l_font->getHeight()); + else + height = std::min(height, s_font->getHeight()); + } + else{ + cch_font = font; + height = std::max(height, cch_font->getHeight()); + } } void CComponentsHeader::setIcon(const char* icon_name) +{ + if (icon_name){ + string s_icon = static_cast(icon_name); + setIcon(s_icon); + } + else + setIcon(""); +} + +void CComponentsHeader::setIcon(const std::string& icon_name) { cch_icon_name = icon_name; } @@ -159,18 +182,19 @@ void CComponentsHeader::setIcon(const char* icon_name) void CComponentsHeader::initIcon() { //init cch_icon_obj only if an icon available - if (cch_icon_name == NULL) { + if (cch_icon_name.empty()) { cch_icon_w = 0; - if (cch_icon_obj) + if (cch_icon_obj){ delete cch_icon_obj; - cch_icon_obj = NULL; + cch_icon_obj = NULL; + } return; } //create instance for cch_icon_obj if (cch_icon_obj == NULL){ #ifdef DEBUG_CC - printf(" [CComponentsHeader]\n [%s - %d] init header icon: %s\n", __func__, __LINE__, cch_icon_name); + printf(" [CComponentsHeader]\n [%s - %d] init header icon: %s\n", __func__, __LINE__, cch_icon_name.c_str()); #endif cch_icon_obj = new CComponentsPicture(cch_icon_x, cch_items_y, 0, 0, cch_icon_name); } @@ -179,12 +203,14 @@ void CComponentsHeader::initIcon() if (!cch_icon_obj->isAdded()) addCCItem(cch_icon_obj); //icon - //get dimensions of header icon - int iw, ih; - frameBuffer->getIconSize(cch_icon_name, &iw, &ih); + //set properties for icon object if (cch_icon_obj){ + //get dimensions of header icon + int iw = 0; + int ih = 0; + cch_icon_obj->getPictureSize(&iw, &ih); cch_icon_obj->setWidth(iw); cch_icon_obj->setHeight(ih); cch_icon_obj->doPaintBg(false); @@ -318,7 +344,7 @@ void CComponentsHeader::initCaption() { //recalc header text position if header icon is defined int cc_text_w = 0; - if (cch_icon_name != NULL){ + if (!cch_icon_name.empty()){ cch_text_x = cch_icon_x+cch_icon_w+cch_offset; } @@ -365,11 +391,8 @@ void CComponentsHeader::initCaption() void CComponentsHeader::initCCItems() { //set size - if (!userHeight) { - cch_font = (cch_size_mode == CC_HEADER_SIZE_LARGE? g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE] : g_Font[SNeutrinoSettings::FONT_TYPE_MENU]); - height = cch_font->getHeight(); - } - + initCaptionFont(); + //init icon initIcon(); diff --git a/src/gui/components/cc_frm_header.h b/src/gui/components/cc_frm_header.h index d681b57b5..96b32f9c4 100644 --- a/src/gui/components/cc_frm_header.h +++ b/src/gui/components/cc_frm_header.h @@ -30,31 +30,122 @@ #include "cc_item_text.h" #include "cc_frm_icons.h" +//! Sub class of CComponentsForm. Shows a header with prepared items. +/*! +CComponentsHeader provides prepared items like icon, caption and context button icons +*/ class CComponentsHeader : public CComponentsForm { private: - void initVarHeader(); - protected: - CComponentsPicture * cch_icon_obj; - CComponentsText * cch_text_obj; - CComponentsIconForm * cch_btn_obj; - std::string cch_text; - const char* cch_icon_name; - fb_pixel_t cch_col_text; - Font* cch_font; - int cch_items_y, cch_icon_x, cch_icon_w, cch_text_x, cch_buttons, cch_buttons_w, cch_buttons_h, cch_buttons_space, cch_offset; - std::vector v_cch_btn; - int cch_size_mode; - int cch_caption_align; - bool userHeight; + ///member: init genaral variables, parameters for mostly used properties + void initVarHeader( const int& x_pos, const int& y_pos, const int& w, const int& h = 0, + const std::string& caption = "header", + const std::string& = "", + const int& buttons = 0, + bool has_shadow = CC_SHADOW_OFF, + fb_pixel_t color_frame = COL_MENUCONTENT_PLUS_6, + fb_pixel_t color_body = COL_MENUHEAD_PLUS_0, + fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0); + protected: + ///object: icon object, see also setIcon() + CComponentsPicture * cch_icon_obj; + ///object: caption object, see also setCaption() + CComponentsText * cch_text_obj; + ///object: context button object, see also addButtonIcon(), removeButtonIcons() + CComponentsIconForm * cch_btn_obj; + + ///property: caption text, see also setCaption() + std::string cch_text; + ///property: icon name, see also setIcon() + std::string cch_icon_name; + ///property: caption text color, see also setCaptionColor() + fb_pixel_t cch_col_text; + ///property: caption font, see also setCaptionFont() + Font* cch_font; + + ///property: internal y-position for all items + int cch_items_y; + ///property: internal x-position for icon object + int cch_icon_x; + ///property: internal width for icon object + int cch_icon_w; + ///property: internal x-position for caption object + int cch_text_x; + ///property: internal context button definition button icons, see modes CC_BTN_HELP, CC_BTN_INFO, CC_BTN_MENU, CC_BTN_EXIT + int cch_buttons; + ///property: internal width for context button object + int cch_buttons_w; + ///property: internal height for context button object + int cch_buttons_h; + ///property: internal offset of context button icons within context button object + int cch_buttons_space; + ///property: internal offset for header items + int cch_offset; + ///property: internal container of icon names for context button object, see also addButtonIcon() + std::vector v_cch_btn; + ///property: size of header, possible values are CC_HEADER_SIZE_LARGE, CC_HEADER_SIZE_SMALL + int cch_size_mode; + ///property: alignment of caption within header, see also setCaptionAlignment(), possible values are CTextBox::CENTER, default = CTextBox::NO_AUTO_LINEBREAK (left) + int cch_caption_align; + + ///init font object and recalculates height if required + void initCaptionFont(Font* font = NULL); + ///sub: init icon object void initIcon(); + ///sub: init caption object void initCaption(); + ///sub: init context button object void initButtons(); + ///sub: init default buttons for context button object void initDefaultButtons(); + ///sub: init default buttons for context button object void initButtonFormSize(); public: + enum + { + CC_HEADER_ITEM_ICON = 0, + CC_HEADER_ITEM_TEXT = 1, + CC_HEADER_ITEM_BUTTONS = 2 + }; + + CComponentsHeader(); + CComponentsHeader( const int& x_pos, const int& y_pos, const int& w, const int& h = 0, + const std::string& caption = "", + const std::string& = "", + const int& buttons = 0, + bool has_shadow = CC_SHADOW_OFF, + fb_pixel_t color_frame = COL_MENUCONTENT_PLUS_6, + fb_pixel_t color_body = COL_MENUHEAD_PLUS_0, + fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0); + + virtual ~CComponentsHeader(); + + ///set caption text, parameters: string, int align_mode (default left) + virtual void setCaption(const std::string& caption, const int& align_mode = CTextBox::NO_AUTO_LINEBREAK); + ///set caption text, parameters: loacle, int align_mode (default left) + virtual void setCaption(neutrino_locale_t caption_locale, const int& align_mode = CTextBox::NO_AUTO_LINEBREAK); + + ///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 setCaptionFont(Font* font); + ///set text color for caption + virtual void setCaptionColor(fb_pixel_t text_color){cch_col_text = text_color;}; + + ///set offset between items + virtual void setOffset(const int offset){cch_offset = offset;}; + ///set name of icon + virtual void setIcon(const char* icon_name); + ///set name of icon + virtual void setIcon(const std::string& icon_name); + + ///add separate button icons to context button object + virtual void addButtonIcon(const std::string& button_name); + ///remove button icons from context button object + virtual void removeButtonIcons(); + enum { CC_BTN_HELP = 0x02, @@ -63,55 +154,68 @@ class CComponentsHeader : public CComponentsForm CC_BTN_EXIT = 0x80 }; - - enum - { - CC_HEADER_ITEM_ICON = 0, - CC_HEADER_ITEM_TEXT = 1, - CC_HEADER_ITEM_BUTTONS = 2 - }; + ///set internal context button icons, possible modes CC_BTN_HELP, CC_BTN_INFO, CC_BTN_MENU, CC_BTN_EXIT + virtual void setDefaultButtons(const int buttons); + ///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 }; - CComponentsHeader(); - CComponentsHeader(const int x_pos, const int y_pos, const int w, const int h = 0, const std::string& caption = "header", const char* icon_name = NULL, const int buttons = 0, bool has_shadow = CC_SHADOW_OFF, - fb_pixel_t color_frame = COL_MENUCONTENT_PLUS_6, fb_pixel_t color_body = COL_MENUHEAD_PLUS_0, fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0); - CComponentsHeader(const int x_pos, const int y_pos, const int w, const int h = 0, neutrino_locale_t caption_locale = NONEXISTANT_LOCALE, const char* icon_name = NULL, const int buttons = 0,bool has_shadow = CC_SHADOW_OFF, - fb_pixel_t color_frame = COL_MENUCONTENT_PLUS_6, fb_pixel_t color_body = COL_MENUHEAD_PLUS_0, fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0); - virtual ~CComponentsHeader(); + ///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();}; - - virtual void setCaption(const std::string& caption, const int& align_mode = CTextBox::NO_AUTO_LINEBREAK); - virtual void setCaption(neutrino_locale_t caption_locale, const int& align_mode = CTextBox::NO_AUTO_LINEBREAK); - virtual void setCaptionAlignment(const int& align_mode){cch_caption_align = align_mode;}; - virtual void setCaptionFont(Font* font_name); - virtual void setCaptionColor(fb_pixel_t text_color){cch_col_text = text_color;}; - virtual void setOffset(const int offset){cch_offset = offset;}; - virtual void setIcon(const char* icon_name); - virtual void addButtonIcon(const std::string& button_name); - virtual void removeButtonIcons(); - virtual void setDefaultButtons(const int buttons); - virtual void setButtonsSpace(const int buttons_space){cch_buttons_space = buttons_space;}; + ///init all items within header object virtual void initCCItems(); - virtual void setSizeMode(const int& size_mode){cch_size_mode = size_mode;}; + ///returns the text object virtual CComponentsText* getTextObject(){return cch_text_obj;}; + + ///paint header virtual void paint(bool do_save_bg = CC_SAVE_SCREEN_YES); }; +//! Sub class of CComponentsHeader. Shows a header with prepared items. +/*! +CComponentsHeaderLocalized provides prepared items like icon, caption and context button icons +Caption is defined with locales. +*/ +class CComponentsHeaderLocalized : public CComponentsHeader +{ + public: + CComponentsHeaderLocalized( const int& x_pos, const int& y_pos, const int& w, const int& h = 0, + neutrino_locale_t caption_locale = NONEXISTANT_LOCALE, + const std::string& = "", + const int& buttons = 0, + bool has_shadow = CC_SHADOW_OFF, + fb_pixel_t color_frame = COL_MENUCONTENT_PLUS_6, + fb_pixel_t color_body = COL_MENUHEAD_PLUS_0, + fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0); +}; + +/*! +CComponentsFooter provides prepared container for footer +Is mostly usable like a header but without caption, and context button icons. +*/ class CComponentsFooter : public CComponentsHeader { protected: - void initVarFooter(); + void initVarFooter( const int& x_pos, const int& y_pos, const int& w, const int& h = 0, + const int& buttons = 0, + bool has_shadow = CC_SHADOW_OFF, + fb_pixel_t color_frame = COL_MENUCONTENT_PLUS_6, + fb_pixel_t color_body = COL_INFOBAR_SHADOW_PLUS_1, + fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0); public: CComponentsFooter(); - CComponentsFooter( const int x_pos, const int y_pos, const int w, const int h = 0, - const int buttons = 0, + CComponentsFooter( const int& x_pos, const int& y_pos, const int& w, const int& h = 0, + const int& buttons = 0, bool has_shadow = CC_SHADOW_OFF, - fb_pixel_t color_frame = COL_MENUCONTENT_PLUS_6, fb_pixel_t color_body = COL_INFOBAR_SHADOW_PLUS_1, fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0); + fb_pixel_t color_frame = COL_MENUCONTENT_PLUS_6, + fb_pixel_t color_body = COL_INFOBAR_SHADOW_PLUS_1, + fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0); }; #endif diff --git a/src/gui/components/cc_frm_window.cpp b/src/gui/components/cc_frm_window.cpp index 8bd6e4c74..cdc596f99 100644 --- a/src/gui/components/cc_frm_window.cpp +++ b/src/gui/components/cc_frm_window.cpp @@ -38,109 +38,81 @@ using namespace std; CComponentsWindow::CComponentsWindow() { initVarWindow(); - - initCCWItems(); } -CComponentsWindow::CComponentsWindow(const std::string& caption, const char* iconname) -{ - initVarWindow(); - - ccw_caption = caption; - ccw_icon_name = iconname; - - initCCWItems(); -} - -CComponentsWindow::CComponentsWindow(neutrino_locale_t locale_caption, const char* iconname) -{ - initVarWindow(); - - ccw_caption = g_Locale->getText(locale_caption); - ccw_icon_name = iconname; - - initCCWItems(); -} - -CComponentsWindow::CComponentsWindow( const int x_pos, const int y_pos, const int w, const int h, +CComponentsWindow::CComponentsWindow( const int& x_pos, const int& y_pos, const int& w, const int& h, neutrino_locale_t locale_caption, - const char* iconname, + const string& iconname, bool has_shadow, fb_pixel_t color_frame, fb_pixel_t color_body, fb_pixel_t color_shadow) { - initVarWindow(); - - x = x_pos; - y = y_pos; - width = w; - height = h; - shadow = has_shadow; - col_frame = color_frame; - col_body = color_body; - col_shadow = color_shadow; - - ccw_caption = g_Locale->getText(locale_caption); - ccw_icon_name = iconname; - - initCCWItems(); + string s_caption = locale_caption != NONEXISTANT_LOCALE ? g_Locale->getText(locale_caption) : ""; + initVarWindow(x_pos, y_pos, w, h, s_caption, iconname, has_shadow, color_frame, color_body, color_shadow); } -CComponentsWindow::CComponentsWindow( const int x_pos, const int y_pos, const int w, const int h, - const std::string& caption, - const char* iconname, +CComponentsWindow::CComponentsWindow( const int& x_pos, const int& y_pos, const int& w, const int& h, + const string& caption, + const string& iconname, bool has_shadow, fb_pixel_t color_frame, fb_pixel_t color_body, fb_pixel_t color_shadow) { - initVarWindow(); - - x = x_pos; - y = y_pos; - width = w; - height = h; - shadow = has_shadow; - col_frame = color_frame; - col_body = color_body; - col_shadow = color_shadow; - - ccw_caption = caption;; - ccw_icon_name = iconname; - - initCCWItems(); + initVarWindow(x_pos, y_pos, w, h, caption, iconname, has_shadow, color_frame, color_body, color_shadow); } -CComponentsWindow::~CComponentsWindow() -{ -#ifdef DEBUG_CC - printf("[~CComponentsWindow] [%s - %d] delete...\n", __func__, __LINE__); -#endif -} +CComponentsWindowMax::CComponentsWindowMax(const string& caption, const string& iconname) + :CComponentsWindow(0, 0, 0, 0, caption, iconname){}; -void CComponentsWindow::initVarWindow() +CComponentsWindowMax::CComponentsWindowMax(neutrino_locale_t locale_caption, const string& iconname) + :CComponentsWindow(0, 0, 0, 0, locale_caption != NONEXISTANT_LOCALE ? g_Locale->getText(locale_caption) : "", iconname){}; + +void CComponentsWindow::initVarWindow( const int& x_pos, const int& y_pos, const int& w, const int& h, + const string& caption, + const string& iconname, + bool has_shadow, + fb_pixel_t color_frame, + fb_pixel_t color_body, + fb_pixel_t color_shadow) { //CComponentsForm cc_item_type = CC_ITEMTYPE_FRM_WINDOW; - //using current screen settings for default dimensions - width = frameBuffer->getScreenWidth(); - height = frameBuffer->getScreenHeight(); - x=getScreenStartX(width); - y=getScreenStartY(height); + //using current screen settings for default dimensions, do use full screen if default values for width/height = 0 + int w_tmp = frameBuffer->getScreenWidth(w == 0 ? true : false); + int h_tmp = frameBuffer->getScreenHeight(h == 0 ? true : false); + width = w == 0 ? w_tmp : w; + height = h == 0 ? h_tmp : h; + x = x_pos; + y = y_pos; + + ccw_caption = caption; + ccw_icon_name = iconname; +#ifdef DEBUG_CC + printf("[CComponentsWindow] [%s - %d] icon name = %s\n", __func__, __LINE__, ccw_icon_name.c_str()); +#endif + shadow = has_shadow; + col_frame = color_frame; + col_body = color_body; + col_shadow = color_shadow; ccw_head = NULL; ccw_body = NULL; ccw_footer = NULL; - ccw_caption = ""; - ccw_icon_name = NULL; + ccw_buttons = 0; //no header buttons ccw_show_footer = true; ccw_show_header = true; ccw_align_mode = CTextBox::NO_AUTO_LINEBREAK; - setShadowOnOff(true); + initCCWItems(); +} + +void CComponentsWindow::doCenter(){ + x = cc_parent ? cc_parent->getWidth() - width/2 : frameBuffer->getScreenWidth(true)/2 - width/2; + y = cc_parent ? cc_parent->getHeight() - height/2 : frameBuffer->getScreenHeight(true)/2 -height/2; } void CComponentsWindow::setWindowCaption(neutrino_locale_t locale_text, const int& align_mode) @@ -151,31 +123,39 @@ void CComponentsWindow::setWindowCaption(neutrino_locale_t locale_text, const in void CComponentsWindow::initHeader() { - if (ccw_head == NULL){ + if (ccw_head == NULL) ccw_head = new CComponentsHeader(); - initHeader(); - //add of header item happens initCCWItems() - } - + //add of header item happens initCCWItems() //set header properties //TODO: assigned properties with internal header objekt have no effect! if (ccw_head){ ccw_head->setWidth(width-2*fr_thickness); // ccw_head->setPos(0, 0); ccw_head->setIcon(ccw_icon_name); ccw_head->setCaption(ccw_caption, ccw_align_mode); - ccw_head->initCCItems(); ccw_head->setDefaultButtons(ccw_buttons); + ccw_head->setCorner(corner_rad, CORNER_TOP); + } +} + +void CComponentsWindow::initFooter() +{ + if (ccw_footer== NULL) + ccw_footer= new CComponentsFooter(); + //add of footer item happens initCCWItems() + //set footer properties + if (ccw_footer){ + ccw_footer->setPos(0, CC_APPEND); + ccw_footer->setWidth(width-2*fr_thickness); + ccw_footer->setShadowOnOff(shadow); + ccw_footer->setCorner(corner_rad, CORNER_BOTTOM); } } void CComponentsWindow::initBody() { - if (ccw_body== NULL){ + if (ccw_body== NULL) ccw_body = new CComponentsForm(); - initBody(); - //add of body item happens initCCWItems() - } - + //add of body item happens initCCWItems() //set body properties if (ccw_body){ ccw_body->setCornerType(0); @@ -191,34 +171,16 @@ void CComponentsWindow::initBody() } } -void CComponentsWindow::initFooter() -{ - if (ccw_footer== NULL){ - ccw_footer= new CComponentsFooter(); - initFooter(); - //add of footer item happens initCCWItems() - } - - //set footer properties - if (ccw_footer){ - ccw_footer->setPos(0, CC_APPEND); - ccw_footer->setWidth(width-2*fr_thickness); - ccw_footer->setShadowOnOff(shadow); - } -} - -void CComponentsWindow::addWindowItem(CComponentsItem* cc_Item) -{ - if (ccw_body) - ccw_body->addCCItem(cc_Item); -} - void CComponentsWindow::initCCWItems() { #ifdef DEBUG_CC printf("[CComponentsWindow] [%s - %d] init items...\n", __func__, __LINE__); #endif - //add header if required + initHeader(); + initFooter(); + initBody(); + + //add/remove header if required if (ccw_show_header){ initHeader(); }else{ @@ -228,7 +190,7 @@ void CComponentsWindow::initCCWItems() } } - //add footer if required + //add/remove footer if required if (ccw_show_footer){ initFooter(); }else{ @@ -237,7 +199,6 @@ void CComponentsWindow::initCCWItems() ccw_footer = NULL; } } - initBody(); //add header, body and footer items only one time if (ccw_head) @@ -250,6 +211,13 @@ void CComponentsWindow::initCCWItems() addCCItem(ccw_footer); } +void CComponentsWindow::addWindowItem(CComponentsItem* cc_Item) +{ + if (ccw_body) + ccw_body->addCCItem(cc_Item); +} + + void CComponentsWindow::paint(bool do_save_bg) { //prepare items before paint diff --git a/src/gui/components/cc_frm_window.h b/src/gui/components/cc_frm_window.h index 80e7e49f3..43e22724f 100644 --- a/src/gui/components/cc_frm_window.h +++ b/src/gui/components/cc_frm_window.h @@ -65,7 +65,7 @@ class CComponentsWindow : public CComponentsForm ///property: alignment mode for header caption int ccw_align_mode; ///property: icon name in header, see also getHeaderObject() - const char* ccw_icon_name; + std::string ccw_icon_name; ///property: assigned default icon buttons in header, see also getHeaderObject() int ccw_buttons; ///property: value = true, let show footer, see showFooter() @@ -82,44 +82,42 @@ class CComponentsWindow : public CComponentsForm ///initialze all window objects at once void initCCWItems(); ///initialize all attributes - void initVarWindow(); + void initVarWindow( const int& x_pos = CC_CENTERED, const int& y_pos = CC_CENTERED, const int& w = 0, const int& h = 0, + const std::string& caption = "", + const std::string& iconname = "", + bool has_shadow = CC_SHADOW_OFF, + fb_pixel_t color_frame = COL_MENUCONTENT_PLUS_6, + fb_pixel_t color_body = COL_MENUCONTENT_PLUS_0, + fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0); + ///allow centering of window on screen, mostly senseful for window object without parent + void doCenter(); public: enum { CC_WINDOW_ITEM_HEADER = 0 }; - ///simple constructor for CComponentsWindow + ///simple constructor for CComponentsWindow, this shows a window over full screen CComponentsWindow(); - ///advanced constructor for CComponentsWindow, provides parameters for the most required properties, and caption as string - CComponentsWindow( const int x_pos, const int y_pos, const int w, const int h, - const std::string& caption, - const char* iconname = NULL, + ///advanced constructor for CComponentsWindow, provides parameters for the most required properties, and caption as string, x_pos or y_pos = 0 will center window + CComponentsWindow( const int& x_pos, const int& y_pos, const int& w, const int& h, + const std::string& caption = "", + const std::string& iconname = "", bool has_shadow = CC_SHADOW_OFF, fb_pixel_t color_frame = COL_MENUCONTENT_PLUS_6, fb_pixel_t color_body = COL_MENUCONTENT_PLUS_0, fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0); - ///advanced constructor for CComponentsWindow, provides parameters for the most required properties, and caption from locales - CComponentsWindow( const int x_pos, const int y_pos, const int w, const int h, - neutrino_locale_t locale_caption, - const char* iconname = NULL, + ///advanced constructor for CComponentsWindow, provides parameters for the most required properties, and caption from locales, x_pos or y_pos = 0 will center window + CComponentsWindow( const int& x_pos, const int& y_pos, const int& w, const int& h, + neutrino_locale_t locale_text = NONEXISTANT_LOCALE, + const std::string& iconname = "", bool has_shadow = CC_SHADOW_OFF, fb_pixel_t color_frame = COL_MENUCONTENT_PLUS_6, fb_pixel_t color_body = COL_MENUCONTENT_PLUS_0, fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0); - ///simple constructor for CComponentsWindow, provides parameters for caption as string and icon, position of window is general centered and bound - ///to current screen settings, this shows a window over full screen - CComponentsWindow(const std::string& caption, const char* iconname = NULL); - - ///simple constructor for CComponentsWindow, provides parameters for caption from locales and icon, position of window is general centered and bound - ///to current screen settings, this shows a window over full screen - CComponentsWindow(neutrino_locale_t locale_caption, const char* iconname = NULL); - - ~CComponentsWindow(); - ///add item to body object, also usable is addCCItem() to add items to the windo object void addWindowItem(CComponentsItem* cc_Item); @@ -137,7 +135,7 @@ class CComponentsWindow : public CComponentsForm void setWindowCaptionAlignment(const int& align_mode){ccw_align_mode = align_mode;}; ///set icon name in header, see also getHeaderObject() - void setWindowIcon(const char* iconname){ccw_icon_name = iconname;}; + void setWindowIcon(const std::string& iconname){ccw_icon_name = iconname;}; ///set default header icon buttons, see also getHeaderObject() void setWindowHeaderButtons(const int& buttons){ccw_buttons = buttons;}; @@ -157,4 +155,16 @@ class CComponentsWindow : public CComponentsForm virtual void paint(bool do_save_bg = CC_SAVE_SCREEN_YES); }; +class CComponentsWindowMax : public CComponentsWindow +{ + public: + ///simple constructor for CComponentsWindow, provides parameters for caption as string and icon, position of window is general centered and bound + ///to current screen settings, this shows a window over full screen + CComponentsWindowMax(const std::string& caption, const std::string& iconname = ""); + + ///simple constructor for CComponentsWindow, provides parameters for caption from locales and icon, position of window is general centered and bound + ///to current screen settings, this shows a window over full screen + CComponentsWindowMax(neutrino_locale_t locale_caption, const std::string& iconname = ""); +}; + #endif diff --git a/src/gui/epgplus.cpp b/src/gui/epgplus.cpp index a6874743c..b1d9db4fd 100644 --- a/src/gui/epgplus.cpp +++ b/src/gui/epgplus.cpp @@ -125,7 +125,7 @@ void EpgPlus::Header::paint(const char * Name) { std::string head = Name ? Name : g_Locale->getText (LOCALE_EPGPLUS_HEAD); - CComponentsHeader header(this->x, this->y, this->width, this->font->getHeight()+4, head, NULL /*no header icon*/); + CComponentsHeader header(this->x, this->y, this->width, this->font->getHeight()+4, head); header.paint(CC_SAVE_SCREEN_NO); } diff --git a/src/gui/eventlist.cpp b/src/gui/eventlist.cpp index 1aaafc16f..5e5cbe1bc 100644 --- a/src/gui/eventlist.cpp +++ b/src/gui/eventlist.cpp @@ -283,7 +283,7 @@ int CNeutrinoEventList::exec(const t_channel_id channel_id, const std::string& c infozone_width = full_width - width; // init right info_zone - if (g_settings.eventlist_additional) + if ((g_settings.eventlist_additional) && (cc_infozone == NULL)) cc_infozone = new CComponentsText(x+width+10, y+theight, infozone_width-20, listmaxshow*fheight); int res = menu_return::RETURN_REPAINT; diff --git a/src/gui/filebrowser.cpp b/src/gui/filebrowser.cpp index 73dbd0b63..0f40264d4 100644 --- a/src/gui/filebrowser.cpp +++ b/src/gui/filebrowser.cpp @@ -1322,7 +1322,7 @@ void CFileBrowser::paintHead() while ((fnt_title->getRenderWidth(&l_name[i]) > width - 20) && (i < l)) i++; - CComponentsHeader header(x, y, width, theight, &l_name[i], NULL /*no header icon*/); + CComponentsHeader header(x, y, width, theight, &l_name[i]); header.paint(CC_SAVE_SCREEN_NO); free(l_name); diff --git a/src/gui/imageinfo.cpp b/src/gui/imageinfo.cpp index ff7c64da0..4d980e519 100644 --- a/src/gui/imageinfo.cpp +++ b/src/gui/imageinfo.cpp @@ -181,7 +181,7 @@ void CImageInfo::ShowWindow() { CComponentsFooter *footer = NULL; if (cc_win == NULL){ - cc_win = new CComponentsWindow(LOCALE_IMAGEINFO_HEAD, NEUTRINO_ICON_INFO); + cc_win = new CComponentsWindowMax(LOCALE_IMAGEINFO_HEAD, NEUTRINO_ICON_INFO); cc_win->setWindowHeaderButtons(CComponentsHeader::CC_BTN_MENU | CComponentsHeader::CC_BTN_EXIT); footer = cc_win->getFooterObject(); footer->setColorBody(COL_INFOBAR_SHADOW_PLUS_1); diff --git a/src/gui/imageinfo.h b/src/gui/imageinfo.h index 81c588bc2..46e7615eb 100644 --- a/src/gui/imageinfo.h +++ b/src/gui/imageinfo.h @@ -64,7 +64,7 @@ class CImageInfo : public CMenuTarget void ShowWindow(); void ScrollLic(bool scrollDown); - CComponentsWindow *cc_win; + CComponentsWindowMax *cc_win; CComponentsForm *cc_info; CComponentsPIP *cc_tv; CComponentsInfoBox *cc_lic; diff --git a/src/gui/luainstance.cpp b/src/gui/luainstance.cpp index b5b0d8ee5..831fc09e2 100644 --- a/src/gui/luainstance.cpp +++ b/src/gui/luainstance.cpp @@ -1333,28 +1333,30 @@ CLuaCWindow *CLuaInstance::CWindowCheck(lua_State *L, int n) int CLuaInstance::CWindowPaint(lua_State *L) { lua_assert(lua_istable(L,1)); - int do_save_bg = 1; - tableLookup(L, "do_save_bg", do_save_bg); + std::string tmp = "true"; + tableLookup(L, "do_save_bg", tmp); + bool do_save_bg = (tmp == "true" || tmp == "1" || tmp == "yes"); CLuaCWindow *m = CWindowCheck(L, 1); if (!m) return 0; - m->w->paint((do_save_bg!=0)?true:false); + m->w->paint(do_save_bg); return 0; } int CLuaInstance::CWindowHide(lua_State *L) { lua_assert(lua_istable(L,1)); - int no_restore = 0; - tableLookup(L, "no_restore", no_restore); + std::string tmp = "false"; + tableLookup(L, "no_restore", tmp); + bool no_restore = (tmp == "true" || tmp == "1" || tmp == "yes"); CLuaCWindow *m = CWindowCheck(L, 1); if (!m) return 0; - m->w->hide((no_restore!=0)?true:false); + m->w->hide(no_restore); return 0; } @@ -1416,14 +1418,15 @@ int CLuaInstance::SignalBoxNew(lua_State *L) int CLuaInstance::SignalBoxPaint(lua_State *L) { lua_assert(lua_istable(L,1)); - int do_save_bg = 1; - tableLookup(L, "do_save_bg", do_save_bg); + std::string tmp = "true"; + tableLookup(L, "do_save_bg", tmp); + bool do_save_bg = (tmp == "true" || tmp == "1" || tmp == "yes"); CLuaSignalBox *m = SignalBoxCheck(L, 1); if (!m) return 0; - m->s->paint((do_save_bg!=0)?true:false); + m->s->paint(do_save_bg); return 0; } diff --git a/src/gui/motorcontrol.cpp b/src/gui/motorcontrol.cpp index 954aad025..1eca47b51 100644 --- a/src/gui/motorcontrol.cpp +++ b/src/gui/motorcontrol.cpp @@ -447,7 +447,7 @@ void CMotorControl::paintStatus() void CMotorControl::paintHead() { - CComponentsHeader header(x, y, width, hheight, LOCALE_MOTORCONTROL_HEAD, NULL /*no header icon*/); + CComponentsHeaderLocalized header(x, y, width, hheight, LOCALE_MOTORCONTROL_HEAD); header.paint(CC_SAVE_SCREEN_NO); } diff --git a/src/gui/nfs.cpp b/src/gui/nfs.cpp index 86e8ccc60..6216884cf 100644 --- a/src/gui/nfs.cpp +++ b/src/gui/nfs.cpp @@ -218,7 +218,7 @@ const CMenuOptionChooser::keyval NFS_TYPE_OPTIONS[NFS_TYPE_OPTION_COUNT] = int CNFSMountGui::menuEntry(int nr) { - int type; + int &type = g_settings.network_nfs[nr].type; char cmd[9]; char cmd2[9]; diff --git a/src/gui/pictureviewer.cpp b/src/gui/pictureviewer.cpp index f52114fe9..254b56f0f 100644 --- a/src/gui/pictureviewer.cpp +++ b/src/gui/pictureviewer.cpp @@ -706,7 +706,7 @@ void CPictureViewerGui::paintItem(int pos) void CPictureViewerGui::paintHead() { - CComponentsHeader header(x, y, width, theight, LOCALE_PICTUREVIEWER_HEAD, NEUTRINO_ICON_MP3, CComponentsHeader::CC_BTN_HELP); + CComponentsHeaderLocalized header(x, y, width, theight, LOCALE_PICTUREVIEWER_HEAD, NEUTRINO_ICON_MP3, CComponentsHeaderLocalized::CC_BTN_HELP); #ifdef ENABLE_GUI_MOUNT header.addButtonIcon(NEUTRINO_ICON_BUTTON_MENU); diff --git a/src/gui/pluginlist.cpp b/src/gui/pluginlist.cpp index 1b3aaf4ae..4d3434d47 100644 --- a/src/gui/pluginlist.cpp +++ b/src/gui/pluginlist.cpp @@ -306,7 +306,7 @@ void CPluginList::paintHead() if (listmaxshow < pluginlist.size()) h_width += 15; - CComponentsHeader header(x, y, h_width, theight, name, NULL /* no header icon */); + CComponentsHeaderLocalized header(x, y, h_width, theight, name); if (pluginlisttype == CPlugins::P_TYPE_GAME) header.setIcon(NEUTRINO_ICON_GAMES); diff --git a/src/gui/scan.cpp b/src/gui/scan.cpp index 3a8cdb338..cfc7bb16c 100644 --- a/src/gui/scan.cpp +++ b/src/gui/scan.cpp @@ -357,7 +357,7 @@ int CScanTs::exec(CMenuTarget* /*parent*/, const std::string & actionKey) g_RCInput->open_click(); } if(!test) { - CComponentsHeader header(x, y, width, hheight, success ? LOCALE_SCANTS_FINISHED : LOCALE_SCANTS_FAILED, NULL /*no header icon*/); + CComponentsHeaderLocalized header(x, y, width, hheight, success ? LOCALE_SCANTS_FINISHED : LOCALE_SCANTS_FAILED); header.paint(CC_SAVE_SCREEN_NO); uint64_t timeoutEnd = CRCInput::calcTimeoutEnd(0xFFFF); do { @@ -524,7 +524,7 @@ void CScanTs::paintLine(int px, int py, int w, const char * const txt) void CScanTs::paint(bool fortest) { - CComponentsHeader header(x, y, width, hheight, fortest ? LOCALE_SCANTS_TEST : LOCALE_SCANTS_HEAD, NULL /*no header icon*/); + CComponentsHeaderLocalized header(x, y, width, hheight, fortest ? LOCALE_SCANTS_TEST : LOCALE_SCANTS_HEAD); header.paint(CC_SAVE_SCREEN_NO); frameBuffer->paintBoxRel(x, y + hheight, width, height - hheight, COL_MENUCONTENT_PLUS_0, RADIUS_LARGE, CORNER_BOTTOM); diff --git a/src/gui/timerlist.cpp b/src/gui/timerlist.cpp index 1df87297c..4016b39f7 100644 --- a/src/gui/timerlist.cpp +++ b/src/gui/timerlist.cpp @@ -287,8 +287,8 @@ int CTimerList::exec(CMenuTarget* parent, const std::string & actionKey) if (timer_apids_dflt) timerlist[selected].apids = TIMERD_APIDS_CONF; else - timerlist[selected].apids = (timer_apids_std * TIMERD_APIDS_STD) | (timer_apids_ac3 * TIMERD_APIDS_AC3) | - (timer_apids_alt * TIMERD_APIDS_ALT); + timerlist[selected].apids = (unsigned char)((timer_apids_std * TIMERD_APIDS_STD) | (timer_apids_ac3 * TIMERD_APIDS_AC3) | + (timer_apids_alt * TIMERD_APIDS_ALT)); Timer->modifyTimerAPid(timerlist[selected].eventID,timerlist[selected].apids); Timer->modifyRecordTimerEvent(timerlist[selected].eventID, timerlist[selected].announceTime, timerlist[selected].alarmTime, @@ -872,7 +872,7 @@ void CTimerList::paintItem(int pos) void CTimerList::paintHead() { - CComponentsHeader header(x, y, width, theight, LOCALE_TIMERLIST_NAME, NEUTRINO_ICON_TIMER); + CComponentsHeaderLocalized header(x, y, width, theight, LOCALE_TIMERLIST_NAME, NEUTRINO_ICON_TIMER); header.setShadowOnOff(CC_SHADOW_ON); header.paint(CC_SAVE_SCREEN_NO); } diff --git a/src/gui/upnpbrowser.cpp b/src/gui/upnpbrowser.cpp index 773b6a3a8..5a06e0953 100644 --- a/src/gui/upnpbrowser.cpp +++ b/src/gui/upnpbrowser.cpp @@ -949,7 +949,7 @@ void CUpnpBrowserGui::paintDevices() CVFD::getInstance()->setMode(CVFD::MODE_MENU_UTF8, "Select UPnP Device"); // Head - CComponentsHeader header(m_x, m_y + m_title_height, m_width, m_theight, LOCALE_UPNPBROWSER_HEAD, NEUTRINO_ICON_UPNP); + CComponentsHeaderLocalized header(m_x, m_y + m_title_height, m_width, m_theight, LOCALE_UPNPBROWSER_HEAD, NEUTRINO_ICON_UPNP); if (CNeutrinoApp::getInstance()->isMuted()) header.addButtonIcon(NEUTRINO_ICON_BUTTON_MUTE_SMALL); header.paint(CC_SAVE_SCREEN_NO); diff --git a/src/gui/widget/menue.cpp b/src/gui/widget/menue.cpp index 2a248fd11..02a15d5c3 100644 --- a/src/gui/widget/menue.cpp +++ b/src/gui/widget/menue.cpp @@ -942,7 +942,7 @@ void CMenuWidget::paint() CVFD::getInstance()->setMode(CVFD::MODE_MENU_UTF8 /*, nameString.c_str()*/); // paint head - CComponentsHeader header(x, y, width + sb_width, hheight, nameString, iconfile.c_str()); + CComponentsHeader header(x, y, width + sb_width, hheight, nameString, iconfile); header.setShadowOnOff(CC_SHADOW_ON); header.setOffset(10); header.paint(CC_SAVE_SCREEN_NO);