Merge branch 'pu/fb-setmode' of https://github.com/tuxbox-neutrino/gui-neutrino into ni/tuxbox

Origin commit data
------------------
Commit: b47a570fd2
Author: vanhofen <vanhofen@gmx.de>
Date: 2017-03-03 (Fri, 03 Mar 2017)
This commit is contained in:
vanhofen
2017-03-03 10:34:35 +01:00
7 changed files with 32 additions and 20 deletions

View File

@@ -35,7 +35,7 @@
using namespace std;
CBuildInfo::CBuildInfo(bool show) : CComponentsWindow(0, 0, 90/*%*/, 90/*%*/, LOCALE_BUILDINFO_MENU, NEUTRINO_ICON_INFO)
CBuildInfo::CBuildInfo(bool show) : CComponentsWindow(0, 0, CCW_PERCENT 90, CCW_PERCENT 90, LOCALE_BUILDINFO_MENU, NEUTRINO_ICON_INFO)
{
initVarBuildInfo();
if (show)

View File

@@ -169,13 +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 && width >= -100) //percentage conversion TODO: behavior inside parent
width = frameBuffer->getScreenWidth()*abs(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 && height >= -100) //percentage conversion TODO: behavior inside parent
height = frameBuffer->getScreenHeight()*abs(height)/100;
if (height == 0 || (unsigned)height > frameBuffer->getScreenHeight())
height = frameBuffer->getScreenHeight();
}

View File

@@ -29,6 +29,8 @@
#include "cc_frm_header.h"
#include "cc_frm_footer.h"
#define CCW_PERCENT - //placeholder for negative sign '-', used for discret dimensions parameters
//! Sub class of CComponentsForm. Shows a window with prepared items.
/*!
CComponentsWindow provides prepared items like header, footer and a container for
@@ -135,6 +137,7 @@ class CComponentsWindow : public CComponentsForm
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
@@ -148,9 +151,9 @@ class CComponentsWindow : public CComponentsForm
* @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
* @li expects type const &int, width of window, Note: value = 0 uses full 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
* @li expects type const &int, height of window, Note: value = 0 uses full screen
* @param[in] caption
* @li optional: expects type const std::string&, defines title of window header
* @param[in] iconname
@@ -158,16 +161,24 @@ class CComponentsWindow : public CComponentsForm
* @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
* @li optional: expects type int as mode, default = CC_SHADOW_OFF \n
* possible values are \n
* CC_SHADOW_ON = (CC_SHADOW_RIGHT | CC_SHADOW_BOTTOM | CC_SHADOW_CORNER_BOTTOM_LEFT | CC_SHADOW_CORNER_BOTTOM_RIGHT | CC_SHADOW_CORNER_TOP_RIGHT) \n
* Take a look into 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
*
* @note Discret dimensions parameters: values < 0 to -100 will be interpreted as percent values related to screen.
* For better readability please use placeholder 'CCW_PERCENT' as negative sign '-' \n
* Example: \n
* this inits a window with position x100 y100 on screen with dimensions 700px x 800px \n
* CComponentsWindow win(100, 100, 700, 800, "Test window");\n
* this inits a window with position x100 y100 on screen with 50% of screen size assigned with discret percental screen dimensions \n
* CComponentsWindow win(100, 100, CCW_PERCENT 50, CCW_PERCENT 50, "Test window");
*/
CComponentsWindow( const int& x_pos, const int& y_pos, const int& w, const int& h,
const std::string& caption = "",

View File

@@ -3223,7 +3223,7 @@ void CMovieBrowser::loadMovies(bool doRefresh)
{
TRACE("[mb] loadMovies: \n");
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);
CProgressWindow loadBox((show_mode == MB_SHOW_YT) ? LOCALE_MOVIEPLAYER_YTPLAYBACK : LOCALE_MOVIEBROWSER_SCAN_FOR_MOVIES, CCW_PERCENT 50, CCW_PERCENT 10, NULL, show_mode == MB_SHOW_YT ? &ytparser.OnLoadVideoInfo : &OnLoadFile, &OnLoadDir);
loadBox.enableShadow();
loadBox.paint();

View File

@@ -861,7 +861,7 @@ int CTestMenu::exec(CMenuTarget* parent, const std::string &actionKey)
//with signals
sigc::signal<void, size_t, size_t, std::string> OnProgress0, OnProgress1;
CProgressWindow pw2("Progress Single Test -> single Signal", 700, 200, &OnProgress0);
CProgressWindow pw2("Progress Single Test -> single Signal", CCW_PERCENT 50, CCW_PERCENT 30, &OnProgress0);
pw2.paint();
for(size_t i = 0; i< max; i++){
@@ -870,7 +870,9 @@ int CTestMenu::exec(CMenuTarget* parent, const std::string &actionKey)
}
pw2.hide();
CProgressWindow pw3("Progress Single Test -> dub Signal", 700, 200, NULL, &OnProgress0, &OnProgress1);
OnProgress0.clear();
OnProgress1.clear();
CProgressWindow pw3("Progress Single Test -> dub Signal", CCW_PERCENT 50, CCW_PERCENT 20, NULL, &OnProgress0, &OnProgress1);
pw3.paint();
for(size_t i = 0; i< max; i++){

View File

@@ -99,8 +99,7 @@ void CProgressWindow::Init( signal<void, size_t, size_t, string> *statusSignal,
//set window height
h_height = ccw_head->getHeight();
ccw_body->setHeight((OFFSET_INNER_MID + g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getHeight())*ccw_body->size());
ccw_body->setHeight(ccw_body->back()->getYPos()+ ccw_body->back()->getHeight()+ OFFSET_INNER_MID);
height = max(height, ccw_body->getHeight() + h_height);
//set position on screen
@@ -112,8 +111,8 @@ CProgressBar* CProgressWindow::getProgressItem()
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();
for(size_t i = ccw_body->size()-1; i< ccw_body->size(); i++){
y_tmp += ccw_body->getCCItem(i)->getYPos() + 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());

View File

@@ -28,8 +28,8 @@
#include <gui/components/cc.h>
#include "menue.h"
#define PW_MIN_WIDTH 50 //%
#define PW_MIN_HEIGHT 25 //%
#define PW_MIN_WIDTH CCW_PERCENT 50
#define PW_MIN_HEIGHT CCW_PERCENT 20
class CProgressWindow : public CComponentsWindow, public CMenuTarget
{