CComponentsWindow: fix handling of window size

On some several cases it's possible that full resulution is not
visible on SD output or video-out modes like 576i/p.
So it's makes more sense to use current osd-settings for max size and
position.
This fixes also current behavior of Imageinfo.


Origin commit data
------------------
Commit: 9d3febd080
Author: Thilo Graf <dbt@novatux.de>
Date: 2014-01-31 (Fri, 31 Jan 2014)
This commit is contained in:
2014-01-31 17:41:29 +01:00
parent b48decae3a
commit 1cc801f931
2 changed files with 38 additions and 13 deletions

View File

@@ -80,13 +80,14 @@ void CComponentsWindow::initVarWindow( const int& x_pos, const int& y_pos, const
//CComponentsForm //CComponentsForm
cc_item_type = CC_ITEMTYPE_FRM_WINDOW; cc_item_type = CC_ITEMTYPE_FRM_WINDOW;
//using current screen settings for default dimensions, do use full screen if default values for width/height = 0 //using current screen settings for default dimensions,
int w_tmp = frameBuffer->getScreenWidth(w == 0 ? true : false); //do use full screen (from osd-settings) if default values for width/height = 0
int h_tmp = frameBuffer->getScreenHeight(h == 0 ? true : false); x = x_pos;
width = w == 0 ? w_tmp : w; y = y_pos;
height = h == 0 ? h_tmp : h; width = w;
x = x_pos; height = h;
y = y_pos; initWindowSize();
initWindowPos();
ccw_caption = caption; ccw_caption = caption;
ccw_icon_name = iconname; ccw_icon_name = iconname;
@@ -110,9 +111,31 @@ void CComponentsWindow::initVarWindow( const int& x_pos, const int& y_pos, const
initCCWItems(); initCCWItems();
} }
void CComponentsWindow::initWindowSize()
{
if (cc_parent)
return;
if (width == 0)
width = frameBuffer->getScreenWidth();
if (height == 0)
height = frameBuffer->getScreenHeight();
}
void CComponentsWindow::initWindowPos()
{
if (cc_parent)
return;
if (x == 0)
x = frameBuffer->getScreenX();
if (y == 0)
y = frameBuffer->getScreenY();
}
void CComponentsWindow::doCenter(){ void CComponentsWindow::doCenter(){
x = cc_parent ? cc_parent->getWidth() - width/2 : frameBuffer->getScreenWidth(true)/2 - width/2; x = cc_parent ? cc_parent->getWidth() - width/2 : getScreenStartX(width);
y = cc_parent ? cc_parent->getHeight() - height/2 : frameBuffer->getScreenHeight(true)/2 -height/2; y = cc_parent ? cc_parent->getHeight() - height/2 : getScreenStartY(height);
} }
void CComponentsWindow::setWindowCaption(neutrino_locale_t locale_text, const int& align_mode) void CComponentsWindow::setWindowCaption(neutrino_locale_t locale_text, const int& align_mode)

View File

@@ -92,6 +92,10 @@ class CComponentsWindow : public CComponentsForm
fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0); fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0);
///allow centering of window on screen, mostly senseful for window object without parent ///allow centering of window on screen, mostly senseful for window object without parent
void doCenter(); void doCenter();
///initialize width and height
void initWindowSize();
///initialize position
void initWindowPos();
public: public:
enum enum
@@ -159,12 +163,10 @@ class CComponentsWindow : public CComponentsForm
class CComponentsWindowMax : public CComponentsWindow class CComponentsWindowMax : public CComponentsWindow
{ {
public: public:
///simple constructor for CComponentsWindow, provides parameters for caption as string and icon, position of window is general centered and bound ///simple constructor for CComponentsWindow, provides parameters for caption as string and icon, this shows a centered window based up current screen settings
///to current screen settings, this shows a window over full screen
CComponentsWindowMax(const std::string& caption, const std::string& iconname = ""); 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 ///simple constructor for CComponentsWindow, provides parameters for caption from locales and icon, this shows a centered window based up current screen settings
///to current screen settings, this shows a window over full screen
CComponentsWindowMax(neutrino_locale_t locale_caption, const std::string& iconname = ""); CComponentsWindowMax(neutrino_locale_t locale_caption, const std::string& iconname = "");
}; };