diff --git a/src/gui/buildinfo.cpp b/src/gui/buildinfo.cpp index 2d31e834e..41dd40eea 100644 --- a/src/gui/buildinfo.cpp +++ b/src/gui/buildinfo.cpp @@ -37,7 +37,7 @@ using namespace std; -CBuildInfo::CBuildInfo(bool show) : CComponentsWindow(0, 0, 700, 500, LOCALE_BUILDINFO_MENU, NEUTRINO_ICON_INFO) +CBuildInfo::CBuildInfo(bool show) : CComponentsWindow(0, 0, 90/*%*/, 90/*%*/, LOCALE_BUILDINFO_MENU, NEUTRINO_ICON_INFO) { initVarBuildInfo(); if (show) diff --git a/src/gui/channellist.cpp b/src/gui/channellist.cpp index aac0568c5..fc7b977a1 100644 --- a/src/gui/channellist.cpp +++ b/src/gui/channellist.cpp @@ -2116,7 +2116,7 @@ void CChannelList::paintItem(int pos, const bool firstpaint) pb.paint(); } //name - g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST]->RenderString(x+ 5+ numwidth+ 10+prg_offset, ypos+ fheight, width- numwidth- 40- 15-prg_offset, nameAndDescription, color); + g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST]->RenderString(x + OFFSET_INNER_SMALL + numwidth + OFFSET_INNER_MID + prg_offset, ypos + fheight, width - numwidth - 4*OFFSET_INNER_MID - 15 - prg_offset, nameAndDescription, color); } if (!firstpaint && curr == selected) updateVfd(); diff --git a/src/gui/components/cc_frm_window.cpp b/src/gui/components/cc_frm_window.cpp index 80455a5ad..ab0663a2d 100644 --- a/src/gui/components/cc_frm_window.cpp +++ b/src/gui/components/cc_frm_window.cpp @@ -169,9 +169,13 @@ void CComponentsWindow::initWindowSize() if (cc_parent) return; + if (width > 0 && width <= 100) //percentage conversion TODO: behavior inside parent + width = frameBuffer->getScreenWidth()*width/100; if (width == 0 || (unsigned)width > frameBuffer->getScreenWidth()) width = frameBuffer->getScreenWidth(); + if (height > 0 && height <= 100) //percentage conversion TODO: behavior inside parent + height = frameBuffer->getScreenHeight()*height/100; if (height == 0 || (unsigned)height > frameBuffer->getScreenHeight()) height = frameBuffer->getScreenHeight(); } diff --git a/src/gui/components/cc_frm_window.h b/src/gui/components/cc_frm_window.h index 7b2f71796..cb1b5288e 100644 --- a/src/gui/components/cc_frm_window.h +++ b/src/gui/components/cc_frm_window.h @@ -128,10 +128,47 @@ class CComponentsWindow : public CComponentsForm { CC_WINDOW_ITEM_HEADER = 0 }; - ///simple constructor for CComponentsWindow, this shows a window over full screen + + enum + { + CC_WINDOW_LEFT_SIDEBAR = 1, + CC_WINDOW_RIGHT_SIDEBAR = 2 + }; + + /**simple constructor for CComponentsWindow, this shows a window over full screen + * @param[in] parent + * @li optional: expects type CComponentsForm * as possible parent object, default = NULL + */ CComponentsWindow(CComponentsForm *parent = 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 + /** + * advanced constructor for CComponentsWindow, provides parameters for the most required properties, and caption as string, x_pos or y_pos = 0 will center window + * @param[in] x_pos + * @li expects type const &int, defines x position on screen + * @param[in] y_pos + * @li expects type const &int, defines y position on screen + * @param[in] w + * @li expects type const &int, width of window, Note: value = 0 uses full screen, value > 0 to 100 interpreted as percent value of screen, value > 100 use native lines count on screen + * @param[in] h + * @li expects type const &int, height of window, Note: value = 0 uses full screen, value > 0 to 100 interpreted as percent value of screen, value > 100 use native lines count on screen + * @param[in] caption + * @li optional: expects type const std::string&, defines title of window header + * @param[in] iconname + * @li optional: expects type const std::string&, defines icon name of window header + * @param[in] parent + * @li optional: expects type CComponentsForm * as possible parent object, default = NULL + * @param[in] shadow_mode + * @li optional: expects type int as mode, default = CC_SHADOW_OFF + * possible values are + * CC_SHADOW_ON = (CC_SHADOW_RIGHT | CC_SHADOW_BOTTOM | CC_SHADOW_CORNER_BOTTOM_LEFT | CC_SHADOW_CORNER_BOTTOM_RIGHT | CC_SHADOW_CORNER_TOP_RIGHT) + * @see cc_types.h + * @param[in] color_frame + * @li optional: expects type fb_pixel_t, defines frame color, default = COL_FRAME_PLUS_0 + * @param[in] color_body + * @li optional: expects type fb_pixel_t, defines color color, default = COL_MENUCONTENT_PLUS_0 + * @param[in] color_shadow + * @li optional: expects type fb_pixel_t, defines shadow color, default = COL_SHADOW_PLUS_0 + */ CComponentsWindow( const int& x_pos, const int& y_pos, const int& w, const int& h, const std::string& caption = "", const std::string& iconname = "", @@ -141,7 +178,12 @@ class CComponentsWindow : public CComponentsForm fb_pixel_t color_body = COL_MENUCONTENT_PLUS_0, fb_pixel_t color_shadow = COL_SHADOW_PLUS_0); - ///advanced constructor for CComponentsWindow, provides parameters for the most required properties, and caption from locales, x_pos or y_pos = 0 will center window + /** + * advanced constructor for CComponentsWindow, provides parameters for the most required properties + * @param[in] locale_text + * @li optional: expects type neutrino_locale_t, defines title of window header + * @see for other parameters take a look to CComponentsWindow base class above + */ 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 = "", @@ -151,90 +193,249 @@ class CComponentsWindow : public CComponentsForm fb_pixel_t color_body = COL_MENUCONTENT_PLUS_0, fb_pixel_t color_shadow = COL_SHADOW_PLUS_0); - ///add item to body object, also usable is addCCItem() to add items to the windo object + /** + * Add an item to body object, also usable is addCCItem() to add items to the window object + * @param[in] cc_Item + * @li expects type CComponentsItem* , defines a cc item + * @return Returns item ID + * @see Take a look to cc_types.h for possible types. + */ int addWindowItem(CComponentsItem* cc_Item); - ///allow/disallow paint a footer, default true, see also ccw_show_footer, showHeader() - void showFooter(bool show = true){ccw_show_footer = show; initCCWItems();}; - ///allow/disallow paint a header, default true, see also ccw_show_header, showFooter() - void showHeader(bool show = true){ccw_show_header = show; initCCWItems();}; + /** + * enable/disable paint of footer, default true + * @param[in] show + * @li expects type bool, default = true + * @see ccw_show_footer, showHeader() + */ + void showFooter(bool show = true){ccw_show_footer = show; initCCWItems();} - enum - { - CC_WINDOW_LEFT_SIDEBAR = 1, - CC_WINDOW_RIGHT_SIDEBAR = 2 - }; - ///allow/disallow paint a sidebar, default are enabled + /** + * enable/disable paint of header, default true + * @param[in] show + * @li expects type bool, default = true + * @see ccw_show_header, showFooter() + */ + void showHeader(bool show = true){ccw_show_header = show; initCCWItems();} + + /** + * enable/disable paint of sidebar, + * @param[in] show + * @li optional: expects type const int&, default = enabled + */ void enableSidebar(const int& sidbar_type = CC_WINDOW_LEFT_SIDEBAR | CC_WINDOW_RIGHT_SIDEBAR); - ///set caption in header with string, see also getHeaderObject() + /** + * sets title text in header + * @param[in] text + * @li expects type const std::string&, defines title of window header + * @param[in] align_mode + * @li optional: expects type const int&, defines allignment of title text + * @see CTextBox for alignment modes + */ void setWindowCaption(const std::string& text, const int& align_mode = CTextBox::NO_AUTO_LINEBREAK){ccw_caption = text; ccw_align_mode = align_mode;} - ///set header text color - void setWindowHeaderTextColor(const fb_pixel_t& color){ccw_col_head_text = color;} - ///set background to header - void setWindowHeaderColor(const fb_pixel_t& color){ccw_col_head = color;} - ///set caption in header from locales, see also getHeaderObject() + + /** + * sets title text in header + * @param[in] text + * @li expects type neutrino_locale_t + * @param[in] align_mode + * @li optional: expects type const int&, defines allignment of title text + * @see CTextBox for alignment modes + */ void setWindowCaption(neutrino_locale_t locale_text, const int& align_mode = CTextBox::NO_AUTO_LINEBREAK); - ///set caption alignment, see CTextBox for possible modes + + /** + * Sets header text color + * @param[in] const fb_pixel_t& + * @li expects type const fb_pixel_t& + */ + void setWindowHeaderTextColor(const fb_pixel_t& color){ccw_col_head_text = color;} + + /** + * Sets header background color + * @param[in] const fb_pixel_t& + * @li expects type const fb_pixel_t& + */ + void setWindowHeaderColor(const fb_pixel_t& color){ccw_col_head = color;} + + /** + * sets title text alignment + * @param[in] align_mode + * @li expects type const int& + * @see CTextBox for alignment modes + */ void setWindowCaptionAlignment(const int& align_mode){ccw_align_mode = align_mode;}; - ///set icon name in header, see also getHeaderObject() + /** + * Sets icon name of window header. + * @param[in] iconname + * @li expects type const std::string& + */ void setWindowIcon(const std::string& iconname){ccw_icon_name = iconname; initHeader();}; ///set default header icon buttons, see also getHeaderObject() - void setWindowHeaderButtons(const int& buttons){ccw_buttons = buttons;}; + /** + * Sets context buttons in window header. + * @param[in] buttons + * @li expects type const int& + * @note possible types are: + * CC_BTN_HELP, + CC_BTN_INFO, + CC_BTN_MENU, + CC_BTN_EXIT, + CC_BTN_MUTE_ZAP_ACTIVE, + CC_BTN_MUTE_ZAP_INACTIVE, + CC_BTN_OKAY, + CC_BTN_MUTE, + CC_BTN_UP, + CC_BTN_DOWN, + CC_BTN_LEFT, + CC_BTN_RIGHT, + CC_BTN_FORWARD, + CC_BTN_BACKWARD, + CC_BTN_PAUSE, + CC_BTN_PLAY, + CC_BTN_RECORD_ACTIVE, + CC_BTN_RECORD_INACTIVE, + CC_BTN_RECORD_STOP, + * @see cc_frm_header.h for current types + */ + void setWindowHeaderButtons(const int& buttons){ccw_buttons = buttons;} - ///returns a pointer to the internal header object, use this to get access to header properities - CComponentsHeader* getHeaderObject(){return ccw_head;}; + /** + * Gets a pointer to the internal header object, use this to get direct access to header properities + * @return CComponentsHeader* + */ + CComponentsHeader* getHeaderObject(){return ccw_head;} - ///returns a pointer to the internal body object, use this to get access to body properities - CComponentsForm* getBodyObject(){return ccw_body;}; - ///returns a pointer to the internal footer object, use this to get access to footer properities - CComponentsFooter* getFooterObject(){return ccw_footer;}; + /** + * Gets a pointer to the internal body object, use this to get access to body properities + * @return CComponentsForm* + */ + CComponentsForm* getBodyObject(){return ccw_body;} - ///set background to footer + /** + * Gets a pointer to the internal footer object, use this to get access to footer properities + * @return CComponentsFooter* + */ + CComponentsFooter* getFooterObject(){return ccw_footer;} + + /** + * Sets footer background color + * @param[in] color + * @li expects type const fb_pixel_t& + */ void setWindowFooterColor(const fb_pixel_t& color){ccw_col_footer = color;} - ///set font for footer buttons + + /** + * Sets font for footer buttons + * @param[in] font_type + * @li expects type Font* + */ void setWindowFooterFont(Font* font_type){ccw_button_font = font_type;} - ///returns a pointer to the internal left side bar object, use this to get access to left sidebar properities - CComponentsFrmChain* getLeftSidebarObject(){return ccw_left_sidebar;}; - ///returns a pointer to the internal right side bar object, use this to get access to right sidebar properities - CComponentsFrmChain* getRightSidebarObject(){return ccw_right_sidebar;}; - ///sets width of sidebars - void setWidthSidebar(const int& sidebar_width){ccw_w_sidebar = sidebar_width; initCCWItems();}; + /** + * Gets a pointer to the internal left side bar object, use this to get access to left sidebar properities + * @return CComponentsFrmChain* + */ + CComponentsFrmChain* getLeftSidebarObject(){return ccw_left_sidebar;} - ///sets current page, NOTE: this is simliar with setCurrentPage() known from basic class CComponentsForm, but here it is related only for window body object + /** + * Gets a pointer to the internal right side bar object, use this to get access to right sidebar properities + * @return CComponentsFrmChain* + */ + CComponentsFrmChain* getRightSidebarObject(){return ccw_right_sidebar;} + + /** + * Sets width of sidebars + * @param[in] sidebar_width + * @li expects type const int& + */ + void setWidthSidebar(const int& sidebar_width){ccw_w_sidebar = sidebar_width; initCCWItems();} + + /** + * Sets current page number + * @param[in] sidebar_width + * @li expects type const int& + * @note This is simliar to setCurrentPage() known from basic class CComponentsForm, but here it is related only for window body object. + */ void setCurrentPage(const u_int8_t& current_page); - ///get current page, NOTE: this is simliar with getCurrentPage() known from basic class CComponentsForm, but here it is related only for window body object + + /** + * Gets current page number + * @return CComponentsFrmChain* + * @note This simliar to getCurrentPage() known from basic class CComponentsForm, but here it is related only for window body object + */ u_int8_t getCurrentPage(); - ///paint window body items, this paints only the current page, body = page, current page is definied in body object, see setCurrentPage() + /** + * Paints window body items, this paints only the current page, body = page, current page is definied in body object, see setCurrentPage() + * @param[in] do_save_bg + * @li optional: expects type bool, default = CC_SAVE_SCREEN_NO (false), sets background save mode + */ void paintCurPage(bool do_save_bg = CC_SAVE_SCREEN_NO); - ///paint defined page of body, parameter number 0...n + + /** + * Paints defined page of body, parameter number 0...n + * @param[in] page_number + * @li expects type const u_int8_t& as page number + * @param[in] do_save_bg + * @li optional: expects type bool, default = CC_SAVE_SCREEN_NO (false), sets background save mode + */ void paintPage(const u_int8_t& page_number, bool do_save_bg = CC_SAVE_SCREEN_NO); - ///enable/disable page scroll, parameter1 default enabled for up/down keys, only for body! + + /** + * enable/disable page scroll + * @param[in] mode + * @li optional: expects type const int&, default enabled for up/down keys, only for body! + */ void enablePageScroll(const int& mode = PG_SCROLL_M_UP_DOWN_KEY); - ///set width of body scrollbar + /** + * Sets width of body scrollbar + * @param[in] crollbar_width + * @li expects type const int& + */ void setScrollBarWidth(const int& scrollbar_width); - ///refresh position and dimension and reinitialize elemenatary properties + /** + * Reinit position and dimensions and reinitialize mostly elemenatary properties + */ void Refresh(){initCCWItems();}; - ///paint all window items, this overwriting paint() from CComponentsForm + /** + * Paint window + * @param[in] do_save_bg + * @li optional: expects type bool, sets background save mode + */ void paint(bool do_save_bg = CC_SAVE_SCREEN_YES); - ///adds additional exec key to current collection, default exit keys are CRCInput::RC_home and CRCInput::RC_setup + /** + * Adds an additional exec key to current collection, default exit keys are CRCInput::RC_home and CRCInput::RC_setup + * @param[in] key + * @li expects type const neutrino_msg_t& + * @see river/rcinput.h for possible keys + */ virtual void addExitKey(const neutrino_msg_t& key){getBodyObject()->addExitKey(key);} - ///remove all current exec keys from current collection, NOTE: use addExitKey() if new exec key is required + + /** + * Removes all current exec keys from current collection. + * @note use addExitKey() if new exec key is required + */ virtual void removeExitKeys(){getBodyObject()->removeExitKeys();} }; class CComponentsWindowMax : public CComponentsWindow { public: - ///simple constructor for CComponentsWindow, provides parameters for caption as string and icon, this shows a centered window based up current screen settings + /** + * Simple constructor for CComponentsWindow, this shows only a centered window based up current screen settings + * @see for other parameters take a look to CComponentsWindow base class above + * @param[in] caption + * @li expects type const std::string&, defines title of window header + * @see for other parameters take a look to CComponentsWindow base class above + */ CComponentsWindowMax( const std::string& caption, const std::string& iconname = "", CComponentsForm *parent = NULL, int shadow_mode = CC_SHADOW_OFF, @@ -242,7 +443,13 @@ class CComponentsWindowMax : public CComponentsWindow fb_pixel_t color_body = COL_MENUCONTENT_PLUS_0, fb_pixel_t color_shadow = COL_SHADOW_PLUS_0); - ///simple constructor for CComponentsWindow, provides parameters for caption from locales and icon, this shows a centered window based up current screen settings + /** + * Simple constructor for CComponentsWindow, this shows only a centered window based up current screen settings + * @see for other parameters take a look to CComponentsWindow base class above + * @param[in] locale_text + * @li expects type neutrino_locale_t, defines title of window header + * @see for other parameters take a look to CComponentsWindow base class above + */ CComponentsWindowMax( neutrino_locale_t locale_caption, const std::string& iconname = "", CComponentsForm *parent = NULL, int shadow_mode = CC_SHADOW_OFF, diff --git a/src/gui/moviebrowser/mb.cpp b/src/gui/moviebrowser/mb.cpp index 56f0969ee..edc63a0bb 100644 --- a/src/gui/moviebrowser/mb.cpp +++ b/src/gui/moviebrowser/mb.cpp @@ -2851,7 +2851,7 @@ void CMovieBrowser::updateDir(void) void CMovieBrowser::loadAllTsFileNamesFromStorage(void) { //TRACE("[mb]->loadAllTsFileNamesFromStorage \n"); - int i,size; + size_t i,size; m_movieSelectionHandler = NULL; m_dirNames.clear(); @@ -2862,8 +2862,10 @@ void CMovieBrowser::loadAllTsFileNamesFromStorage(void) size = m_dir.size(); for (i=0; i < size;i++) { - if (*m_dir[i].used == true) + if (*m_dir[i].used == true){ + OnLoadDir(i+1, size, m_dir[i].name); loadTsFileNamesFromDir(m_dir[i].name); + } } TRACE("[mb] Dir%d, Files:%d\n", (int)m_dirNames.size(), (int)m_vMovieInfo.size()); @@ -2982,7 +2984,7 @@ bool CMovieBrowser::loadTsFileNamesFromDir(const std::string & dirname) } else { result |= addFile(flist[i], dirItNr); } - OnLoadFile(i, flist.size(), g_Locale->getText(LOCALE_MOVIEBROWSER_SCAN_FOR_MOVIES)); + OnLoadFile(i, flist.size(), dirname ); } //result = true; } @@ -3221,7 +3223,7 @@ void CMovieBrowser::loadMovies(bool doRefresh) { TRACE("[mb] loadMovies: \n"); - CProgressWindow loadBox((show_mode == MB_SHOW_YT) ? LOCALE_MOVIEPLAYER_YTPLAYBACK : LOCALE_MOVIEBROWSER_HEAD, 500, 150, show_mode == MB_SHOW_YT ? &ytparser.OnLoadVideoInfo : &OnLoadFile); + CProgressWindow loadBox((show_mode == MB_SHOW_YT) ? LOCALE_MOVIEPLAYER_YTPLAYBACK : LOCALE_MOVIEBROWSER_SCAN_FOR_MOVIES, 50/*%*/, 25/*%*/, NULL, show_mode == MB_SHOW_YT ? &ytparser.OnLoadVideoInfo : &OnLoadFile, &OnLoadDir); loadBox.enableShadow(); loadBox.paint(); diff --git a/src/gui/moviebrowser/mb.h b/src/gui/moviebrowser/mb.h index ae7c758d9..774372e94 100644 --- a/src/gui/moviebrowser/mb.h +++ b/src/gui/moviebrowser/mb.h @@ -365,6 +365,7 @@ class CMovieBrowser : public CMenuTarget bool supportedExtension(CFile &file); bool addFile(CFile &file, int dirItNr); sigc::signal OnLoadFile; + sigc::signal OnLoadDir; }; // I tried a lot to use the menu.cpp as ListBox selection, and I got three solution which are all garbage. diff --git a/src/gui/movieplayer.cpp b/src/gui/movieplayer.cpp index ece3d8c05..ed0ded0a8 100644 --- a/src/gui/movieplayer.cpp +++ b/src/gui/movieplayer.cpp @@ -1349,9 +1349,12 @@ void CMoviePlayerGui::PlayFileLoop(void) bool first_start = true; bool update_lcd = true; int eof = 0; + int eof2 = 0; + int position_tmp = 0; int lastpos = 0; bool at_eof = !(playstate >= CMoviePlayerGui::PLAY);; keyPressed = CMoviePlayerGui::PLUGIN_PLAYSTATE_NORMAL; + while (playstate >= CMoviePlayerGui::PLAY) { if (update_lcd) { @@ -1388,6 +1391,20 @@ void CMoviePlayerGui::PlayFileLoop(void) } #endif /* in case ffmpeg report incorrect values */ + if((playstate == CMoviePlayerGui::PLAY) && (speed == 1)){ + if(position_tmp != position){ + position_tmp = position ; + eof2 = 0; + }else{ + if (++eof2 > 6) { + at_eof = true; + break; + } + } + } + else{ + eof2 = 0; + } int posdiff = duration - position; if ((posdiff >= 0) && (posdiff < 2000) && timeshift == TSHIFT_MODE_OFF) { diff --git a/src/gui/test_menu.cpp b/src/gui/test_menu.cpp index cee1d8f62..d104d2542 100644 --- a/src/gui/test_menu.cpp +++ b/src/gui/test_menu.cpp @@ -51,6 +51,7 @@ #include #include +#include #include #include #include @@ -841,6 +842,53 @@ int CTestMenu::exec(CMenuTarget* parent, const std::string &actionKey) } return res; } + else if (actionKey == "progress_window"){ + //classical + CProgressWindow pw0("Progress Single Test"); + pw0.paint(); + size_t max = 3; + for(size_t i = 0; i< max; i++){ + pw0.showStatus(i, max, to_string(i)); + sleep(1); + } + pw0.hide(); + + CProgressWindow pw1("Progress Local/Global Test"); + pw1.paint(); + for(size_t i = 0; i< max; i++){ + pw1.showGlobalStatus(i, max, to_string(i)); + for(size_t j = 0; j< max; j++){ + pw1.showLocalStatus(j, max, to_string(j)); + sleep(1); + } + } + pw1.hide(); + + //with signals + sigc::signal OnProgress0, OnProgress1; + CProgressWindow pw2("Progress Single Test -> single Signal", 700, 200, &OnProgress0); + pw2.paint(); + + for(size_t i = 0; i< max; i++){ + OnProgress0(i, max, to_string(i)); + sleep(1); + } + pw2.hide(); + + CProgressWindow pw3("Progress Single Test -> dub Signal", 700, 200, NULL, &OnProgress0, &OnProgress1); + pw3.paint(); + + for(size_t i = 0; i< max; i++){ + OnProgress1(i, max, to_string(i)); + for(size_t j = 0; j< max; j++){ + OnProgress0(j, max, to_string(j)); + sleep(1); + } + } + pw3.hide(); + + return menu_return::RETURN_REPAINT; + } else if (actionKey == "hintbox_test") { ShowHint("Testmenu: Hintbox popup test", "Test for HintBox,\nPlease press any key or wait some seconds! ...", 700, 10, NULL, NEUTRINO_ICON_HINT_IMAGEINFO, CComponentsHeader::CC_BTN_EXIT); @@ -1085,6 +1133,7 @@ int CTestMenu::showTestMenu() void CTestMenu::showCCTests(CMenuWidget *widget) { widget->addIntroItems(); + widget->addItem(new CMenuForwarder("Progress Window", true, NULL, this, "progress_window")); widget->addItem(new CMenuForwarder("Running Clock", true, NULL, this, "running_clock")); widget->addItem(new CMenuForwarder("Clock", true, NULL, this, "clock")); widget->addItem(new CMenuForwarder("Button", true, NULL, this, "button")); diff --git a/src/gui/widget/hintbox.cpp b/src/gui/widget/hintbox.cpp index 45ef2b6ed..ff62b35a7 100644 --- a/src/gui/widget/hintbox.cpp +++ b/src/gui/widget/hintbox.cpp @@ -67,7 +67,7 @@ CHintBox::CHintBox( const neutrino_locale_t Caption, const char * const Picon, const int& header_buttons, const int& text_mode, - const int& indent): CComponentsWindow( 0, 0, width, + const int& indent): CComponentsWindow( 0, 0, Width, HINTBOX_MIN_HEIGHT, Caption, string(Icon == NULL ? "" : Icon), @@ -84,7 +84,7 @@ CHintBox::CHintBox( const char * const Caption, const char * const Picon, const int& header_buttons, const int& text_mode, - const int& indent):CComponentsWindow( 0, 0, width, + const int& indent):CComponentsWindow( 0, 0, Width, HINTBOX_MIN_HEIGHT, Caption, string(Icon == NULL ? "" : Icon), @@ -101,7 +101,7 @@ CHintBox::CHintBox( const neutrino_locale_t Caption, const char * const Picon, const int& header_buttons, const int& text_mode, - const int& indent):CComponentsWindow( 0, 0, width, + const int& indent):CComponentsWindow( 0, 0, Width, HINTBOX_MIN_HEIGHT, Caption, string(Icon == NULL ? "" : Icon), @@ -118,7 +118,7 @@ CHintBox::CHintBox( const char * const Caption, const char * const Picon, const int& header_buttons, const int& text_mode, - const int& indent):CComponentsWindow( 0, 0, width, + const int& indent):CComponentsWindow( 0, 0, Width, HINTBOX_MIN_HEIGHT, Caption, string(Icon == NULL ? "" : Icon), diff --git a/src/gui/widget/hintbox.h b/src/gui/widget/hintbox.h index 187752286..9019228a6 100644 --- a/src/gui/widget/hintbox.h +++ b/src/gui/widget/hintbox.h @@ -32,14 +32,15 @@ #include -#define HINTBOX_MIN_WIDTH 320 -#define HINTBOX_MIN_HEIGHT 125 -#define HINTBOX_MAX_HEIGHT 520 +#define HINTBOX_MIN_WIDTH CFrameBuffer::getInstance()->scale2Res(320) +#define HINTBOX_MIN_HEIGHT CFrameBuffer::getInstance()->scale2Res(125) +#define HINTBOX_MAX_HEIGHT CFrameBuffer::getInstance()->scale2Res(520) + #define HINTBOX_DEFAULT_TIMEOUT g_settings.timing[SNeutrinoSettings::TIMING_POPUP_MESSAGES] #define NO_TIMEOUT 0 #define DEFAULT_TIMEOUT -1 //frame around hint container as indent -#define W_FRAME std::max(HINTBOX_MIN_WIDTH, HINTBOX_MIN_HEIGHT) * 2/100 +#define W_FRAME OFFSET_INNER_MID //frame color around hint/message box #define HINTBOX_DEFAULT_FRAME_COLOR COL_FRAME #define TIMEOUT_BAR_HEIGHT OFFSET_SHADOW/2 diff --git a/src/gui/widget/progresswindow.cpp b/src/gui/widget/progresswindow.cpp index 0fed059cd..e2410dc01 100644 --- a/src/gui/widget/progresswindow.cpp +++ b/src/gui/widget/progresswindow.cpp @@ -59,8 +59,19 @@ CProgressWindow::CProgressWindow(const neutrino_locale_t title, Init(statusSignal, localSignal, globalSignal); } +CProgressWindow::CProgressWindow(const std::string &title, + const int &dx, + const int &dy, + signal *statusSignal, + signal *localSignal, + signal *globalSignal) + : CComponentsWindow(0, 0, dx, dy, title, NEUTRINO_ICON_INFO, NULL, CC_SHADOW_ON) +{ + Init(statusSignal, localSignal, globalSignal); +} + void CProgressWindow::Init( signal *statusSignal, - signal *localSignal, + signal *localSignal, signal *globalSignal) { if (statusSignal) @@ -70,112 +81,75 @@ void CProgressWindow::Init( signal *statusSignal, if (globalSignal) *globalSignal->connect(mem_fun(*this, &CProgressWindow::showGlobalStatus)); - global_progress = local_progress = 100; + global_progress = local_progress = 0; showFooter(false); - shadow = true; - - int x_item = 10; - int y_item = 10; - - int w_item = width-2*x_item; - int h_item = 14; - int h_pbar = 20; - w_bar_frame = 0; //create status text object status_txt = new CComponentsLabel(); - int h_txt = max(g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getHeight(), h_item); - status_txt->setDimensionsAll(x_item, y_item, w_item, h_txt); + status_txt->setDimensionsAll(OFFSET_INNER_MID, OFFSET_INNER_MID, width-2*OFFSET_INNER_MID, g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getHeight()); status_txt->setColorBody(col_body); status_txt->doPaintTextBoxBg(true); status_txt->doPaintBg(false); addWindowItem(status_txt); - y_item += h_txt + 10; //create local_bar object - local_bar = new CProgressBar(); - local_bar->allowPaint(false); - local_bar->setDimensionsAll(x_item, y_item, w_item, h_pbar); - local_bar->setColorBody(col_body); - local_bar->setActiveColor(COL_PROGRESSBAR_ACTIVE_PLUS_0); - local_bar->setFrameThickness(w_bar_frame); - local_bar->setColorFrame(COL_PROGRESSBAR_ACTIVE_PLUS_0); - addWindowItem(local_bar); - y_item += 2*h_pbar; + local_bar = getProgressItem(); //create global_bar object - global_bar = new CProgressBar(); - global_bar->allowPaint(false); - global_bar->setDimensionsAll(x_item, y_item, w_item, h_pbar); - global_bar->setColorBody(col_body); - global_bar->setActiveColor(COL_PROGRESSBAR_ACTIVE_PLUS_0); - global_bar->setFrameThickness(w_bar_frame); - global_bar->setColorFrame(COL_PROGRESSBAR_ACTIVE_PLUS_0); - addWindowItem(global_bar); - y_item += 2*h_pbar; + global_bar = getProgressItem(); + //set window height h_height = ccw_head->getHeight(); - height = max(height, y_item + h_height); + ccw_body->setHeight((OFFSET_INNER_MID + g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getHeight())*ccw_body->size()); + height = max(height, ccw_body->getHeight() + h_height); + + //set position on screen setCenterPos(); } -void CProgressWindow::setTitle(const neutrino_locale_t title) +CProgressBar* CProgressWindow::getProgressItem() { - setWindowCaption(title); - -#ifdef VFD_UPDATE - CVFD::getInstance()->showProgressBar2(-1,NULL,-1,g_Locale->getText(ccw_caption)); // set global text in VFD -#endif // VFD_UPDATE -} - -void CProgressWindow::setTitle(const string & title) -{ - setWindowCaption(title); - -#ifdef VFD_UPDATE - CVFD::getInstance()->showProgressBar2(-1,NULL,-1,g_Locale->getText(ccw_caption)); // set global text in VFD -#endif // VFD_UPDATE -} - -//if header is disabled we need new position for body items -void CProgressWindow::fitItems() -{ - if (ccw_show_header) - return; - - for(size_t i=0; isize() ;i++){ - int y_item = ccw_body->getCCItem(i)->getYPos() + h_height - 10; - ccw_body->getCCItem(i)->setYPos(y_item); + CProgressBar *pBar = new CProgressBar(); + pBar->allowPaint(false); + int y_tmp = 0; + for(size_t i = 0; i< ccw_body->size(); i++){ + y_tmp += ccw_body->getCCItem(i)->getHeight(); + y_tmp += OFFSET_INNER_MID; } + pBar->setDimensionsAll(OFFSET_INNER_MID, y_tmp, width-2*OFFSET_INNER_MID, g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getHeight()); + pBar->setColorBody(col_body); + pBar->setActiveColor(COL_PROGRESSBAR_ACTIVE_PLUS_0); + pBar->setFrameThickness(1); + pBar->setColorFrame(COL_PROGRESSBAR_ACTIVE_PLUS_0); + addWindowItem(pBar); + + return pBar; +} + +void CProgressWindow::initStatus(const unsigned int prog, const unsigned int max, const string &statusText, CProgressBar *pBar) +{ + pBar->allowPaint(true); + pBar->setValues(prog, (int)max); + if (!statusText.empty()) + showStatusMessageUTF(statusText); + pBar->paint(false); } void CProgressWindow::showStatus(const unsigned int prog, const unsigned int max, const string &statusText) { - if (global_progress == prog) - return; - - if (!global_bar->isPainted()){ - int g_height = global_bar->getHeight(); - global_bar->setYPos(local_bar->getYPos() + g_height/2); - global_bar->setHeight(g_height + g_height/2); - } - - showGlobalStatus(prog, max, statusText); + showLocalStatus(prog, max, statusText); } void CProgressWindow::showGlobalStatus(const unsigned int prog, const unsigned int max, const string &statusText) { - if (global_progress == prog) + if (!local_bar->isPainted()) + showLocalStatus(0, 0, statusText); // ensure first paint of local bar on painted global bar at same time + if (global_progress == prog && global_bar->isPainted()) return; - - global_bar->allowPaint(true); global_progress = prog; - global_bar->setValues(prog, (int)max); - if (!statusText.empty()) - showStatusMessageUTF(statusText); - global_bar->paint(false); + initStatus(prog, max, statusText, global_bar); #ifdef VFD_UPDATE CVFD::getInstance()->showProgressBar2(-1,NULL,global_progress); @@ -184,15 +158,10 @@ void CProgressWindow::showGlobalStatus(const unsigned int prog, const unsigned i void CProgressWindow::showLocalStatus(const unsigned int prog, const unsigned int max, const string &statusText) { - if (local_progress == prog) + if (local_progress == prog && local_bar->isPainted()) return; - - local_bar->allowPaint(true); local_progress = prog; - local_bar->setValues(prog, (int)max); - if (!statusText.empty()) - showStatusMessageUTF(statusText); - local_bar->paint(false); + initStatus(prog, max, statusText, local_bar); #ifdef VFD_UPDATE CVFD::getInstance()->showProgressBar2(local_progress); @@ -242,3 +211,33 @@ void CProgressWindow::paint(bool do_save_bg) fitItems(); CComponentsWindow::paint(do_save_bg); } + +void CProgressWindow::setTitle(const neutrino_locale_t title) +{ + setWindowCaption(title); + +#ifdef VFD_UPDATE + CVFD::getInstance()->showProgressBar2(-1,NULL,-1,g_Locale->getText(ccw_caption)); // set global text in VFD +#endif // VFD_UPDATE +} + +void CProgressWindow::setTitle(const string & title) +{ + setWindowCaption(title); + +#ifdef VFD_UPDATE + CVFD::getInstance()->showProgressBar2(-1,NULL,-1,g_Locale->getText(ccw_caption)); // set global text in VFD +#endif // VFD_UPDATE +} + +//if header is disabled we need new position for body items +void CProgressWindow::fitItems() +{ + if (ccw_show_header) + return; + + for(size_t i=0; isize() ;i++){ + int y_item = ccw_body->getCCItem(i)->getYPos() + h_height - OFFSET_INNER_MID; + ccw_body->getCCItem(i)->setYPos(y_item); + } +} \ No newline at end of file diff --git a/src/gui/widget/progresswindow.h b/src/gui/widget/progresswindow.h index 811b5714a..10624dea8 100644 --- a/src/gui/widget/progresswindow.h +++ b/src/gui/widget/progresswindow.h @@ -28,6 +28,9 @@ #include #include "menue.h" +#define PW_MIN_WIDTH 50 //% +#define PW_MIN_HEIGHT 25 //% + class CProgressWindow : public CComponentsWindow, public CMenuTarget { private: @@ -36,11 +39,13 @@ class CProgressWindow : public CComponentsWindow, public CMenuTarget unsigned int global_progress; unsigned int local_progress; - int w_bar_frame; int h_height; void Init( sigc::signal *statusSignal, sigc::signal *localSignal, sigc::signal *globalSignal); + + CProgressBar* getProgressItem(); + void initStatus(const unsigned int prog, const unsigned int max, const std::string &statusText, CProgressBar *pBar); void fitItems(); public: @@ -131,8 +136,8 @@ class CProgressWindow : public CComponentsWindow, public CMenuTarget * Don't use status_Signal at same time with localSignal and globalSignal. In This case please set status_Signal = NULL */ CProgressWindow(CComponentsForm *parent = NULL, - const int &dx = 700, - const int &dy = 200, + const int &dx = PW_MIN_WIDTH, + const int &dy = PW_MIN_HEIGHT, sigc::signal *status_Signal = NULL, sigc::signal *localSignal = NULL, sigc::signal *globalSignal = NULL); @@ -144,8 +149,21 @@ class CProgressWindow : public CComponentsWindow, public CMenuTarget * @see For other arguments and examples, see related constructor(s) */ CProgressWindow(const neutrino_locale_t title, - const int &dx = 700, - const int &dy = 200, + const int &dx = PW_MIN_WIDTH, + const int &dy = PW_MIN_HEIGHT, + sigc::signal *status_Signal = NULL, + sigc::signal *localSignal = NULL, + sigc::signal *globalSignal = NULL); + + /**CProgressWindow Constructor + * @param[in] title + * @li expects type std::string as window title + * + * @see For other arguments and examples, see related constructor(s) + */ + CProgressWindow(const std::string &title, + const int &dx = PW_MIN_WIDTH, + const int &dy = PW_MIN_HEIGHT, sigc::signal *status_Signal = NULL, sigc::signal *localSignal = NULL, sigc::signal *globalSignal = NULL); diff --git a/src/gui/widget/textbox.cpp b/src/gui/widget/textbox.cpp index f8ed60af4..b7fe4eccd 100644 --- a/src/gui/widget/textbox.cpp +++ b/src/gui/widget/textbox.cpp @@ -68,14 +68,14 @@ #endif #include -#define SCROLL_FRAME_WIDTH 10 -#define SCROLL_MARKER_BORDER 2 +#define SCROLL_FRAME_WIDTH SCROLLBAR_WIDTH +#define SCROLL_MARKER_BORDER OFFSET_INNER_MIN -#define MAX_WINDOW_WIDTH (g_settings.screen_EndX - g_settings.screen_StartX - 40) -#define MAX_WINDOW_HEIGHT (g_settings.screen_EndY - g_settings.screen_StartY - 40) +#define MAX_WINDOW_WIDTH (g_settings.screen_EndX - g_settings.screen_StartX - CFrameBuffer::getInstance()->scale2Res(40)) +#define MAX_WINDOW_HEIGHT (g_settings.screen_EndY - g_settings.screen_StartY - CFrameBuffer::getInstance()->scale2Res(40)) #define MIN_WINDOW_WIDTH ((g_settings.screen_EndX - g_settings.screen_StartX)>>1) -#define MIN_WINDOW_HEIGHT 40 +#define MIN_WINDOW_HEIGHT CFrameBuffer::getInstance()->scale2Res(40) CTextBox::CTextBox(const char * text, Font* font_text, const int pmode, const CBox* position, CFBWindow::color_t textBackgroundColor)