mirror of
https://github.com/tuxbox-fork-migrations/recycled-ni-neutrino.git
synced 2025-08-29 00:11:08 +02:00
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:
@@ -80,13 +80,14 @@ void CComponentsWindow::initVarWindow( const int& x_pos, const int& y_pos, const
|
||||
//CComponentsForm
|
||||
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
|
||||
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;
|
||||
//using current screen settings for default dimensions,
|
||||
//do use full screen (from osd-settings) if default values for width/height = 0
|
||||
x = x_pos;
|
||||
y = y_pos;
|
||||
width = w;
|
||||
height = h;
|
||||
initWindowSize();
|
||||
initWindowPos();
|
||||
|
||||
ccw_caption = caption;
|
||||
ccw_icon_name = iconname;
|
||||
@@ -110,9 +111,31 @@ void CComponentsWindow::initVarWindow( const int& x_pos, const int& y_pos, const
|
||||
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(){
|
||||
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;
|
||||
x = cc_parent ? cc_parent->getWidth() - width/2 : getScreenStartX(width);
|
||||
y = cc_parent ? cc_parent->getHeight() - height/2 : getScreenStartY(height);
|
||||
}
|
||||
|
||||
void CComponentsWindow::setWindowCaption(neutrino_locale_t locale_text, const int& align_mode)
|
||||
|
@@ -92,6 +92,10 @@ class CComponentsWindow : public CComponentsForm
|
||||
fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0);
|
||||
///allow centering of window on screen, mostly senseful for window object without parent
|
||||
void doCenter();
|
||||
///initialize width and height
|
||||
void initWindowSize();
|
||||
///initialize position
|
||||
void initWindowPos();
|
||||
|
||||
public:
|
||||
enum
|
||||
@@ -159,12 +163,10 @@ class CComponentsWindow : public CComponentsForm
|
||||
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
|
||||
///simple constructor for CComponentsWindow, provides parameters for caption as string and icon, this shows a centered window based up current screen settings
|
||||
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
|
||||
///simple constructor for CComponentsWindow, provides parameters for caption from locales and icon, this shows a centered window based up current screen settings
|
||||
CComponentsWindowMax(neutrino_locale_t locale_caption, const std::string& iconname = "");
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user