DefaultAttr( attr, "points", "(0,0)" );
DefaultAttr( attr, "range", "10" );
- int refWidth = getRefWidth( false );
- int refHeight = getRefHeight( false );
+ int refWidth, refHeight;
+ getRefDimensions( refWidth, refHeight, false );
int x = getDimension( attr["x"], refWidth );
int y = getDimension( attr["y"], refHeight );
const BuilderData::Anchor anchor( x + m_xOffset,
DefaultAttr( attr, "tooltiptext", "" );
DefaultAttr( attr, "help", "" );
- int refWidth = getRefWidth( false );
- int refHeight = getRefHeight( false );
+ int refWidth, refHeight;
+ getRefDimensions( refWidth, refHeight, false );
int x = getDimension( attr["x"], refWidth );
int y = getDimension( attr["y"], refHeight );
const BuilderData::Button button( uniqueId( attr["id"] ),
DefaultAttr( attr, "tooltiptext2", "" );
DefaultAttr( attr, "help", "" );
- int refWidth = getRefWidth( false );
- int refHeight = getRefHeight( false );
+ int refWidth, refHeight;
+ getRefDimensions( refWidth, refHeight, false );
int x = getDimension( attr["x"], refWidth );
int y = getDimension( attr["y"], refHeight );
const BuilderData::Checkbox checkbox( uniqueId( attr["id"] ),
DefaultAttr( attr, "help", "" );
DefaultAttr( attr, "art", "false" );
- int refWidth = getRefWidth( false );
- int refHeight = getRefHeight( false );
+ int refWidth, refHeight;
+ getRefDimensions( refWidth, refHeight, false );
int x = getDimension( attr["x"], refWidth );
int y = getDimension( attr["y"], refHeight );
int width = getDimension( attr["width"], refWidth );
DefaultAttr( attr, "minheight", "-1" );
DefaultAttr( attr, "maxheight", "-1" );
- int refWidth = getRefWidth( true );
- int refHeight = getRefHeight( true );
+ int refWidth, refHeight;
+ getRefDimensions( refWidth, refHeight, true );
int width = getDimension( attr["width"], refWidth );
int height = getDimension( attr["height"], refHeight );
DefaultAttr( attr, "xmargin", "0" );
DefaultAttr( attr, "ymargin", "0" );
- int refWidth = getRefWidth( false );
- int refHeight = getRefHeight( false );
-
+ int refWidth, refHeight;
+ getRefDimensions( refWidth, refHeight, false );
int x = getDimension( attr["x"], refWidth );
int y = getDimension( attr["y"], refHeight );
int width = getDimension( attr["width"], refWidth );
DefaultAttr( attr, "selcolor", "#0000FF" );
DefaultAttr( attr, "help", "" );
- int refWidth = getRefWidth( false );
- int refHeight = getRefHeight( false );
-
+ int refWidth, refHeight;
+ getRefDimensions( refWidth, refHeight, false );
int x = getDimension( attr["x"], refWidth );
int y = getDimension( attr["y"], refHeight );
int width = getDimension( attr["width"], refWidth );
DefaultAttr( attr, "selcolor", "#0000FF" );
DefaultAttr( attr, "help", "" );
- int refWidth = getRefWidth( false );
- int refHeight = getRefHeight( false );
-
+ int refWidth, refHeight;
+ getRefDimensions( refWidth, refHeight, false );
int x = getDimension( attr["x"], refWidth );
int y = getDimension( attr["y"], refHeight );
int width = getDimension( attr["width"], refWidth );
DefaultAttr( attr, "tooltiptext", "" );
DefaultAttr( attr, "help", "" );
- int refWidth = getRefWidth( false );
- int refHeight = getRefHeight( false );
+ int refWidth, refHeight;
+ getRefDimensions( refWidth, refHeight, false );
int x = getDimension( attr["x"], refWidth );
int y = getDimension( attr["y"], refHeight );
const BuilderData::RadialSlider radial( uniqueId( attr["id"] ),
newValue = "playtree.slider";
}
- int refWidth = getRefWidth( false );
- int refHeight = getRefHeight( false );
+ int refWidth, refHeight;
+ getRefDimensions( refWidth, refHeight, false );
int x = getDimension( attr["x"], refWidth );
int y = getDimension( attr["y"], refHeight );
const BuilderData::Slider slider( uniqueId( attr["id"] ),
DefaultAttr( attr, "ykeepratio", "false" );
DefaultAttr( attr, "help", "" );
- int refWidth = getRefWidth( false );
- int refHeight = getRefHeight( false );
-
+ int refWidth, refHeight;
+ getRefDimensions( refWidth, refHeight, false );
int x = getDimension( attr["x"], refWidth );
int y = getDimension( attr["y"], refHeight );
int width = getDimension( attr["width"], refWidth );
DefaultAttr( attr, "autoresize", "false" );
DefaultAttr( attr, "help", "" );
- int refWidth = getRefWidth( false );
- int refHeight = getRefHeight( false );
-
+ int refWidth, refHeight;
+ getRefDimensions( refWidth, refHeight, false );
int x = getDimension( attr["x"], refWidth );
int y = getDimension( attr["y"], refHeight );
int width = getDimension( attr["width"], refWidth );
m_curWindowId = uniqueId( attr["id"] );
- int refWidth = getRefWidth( true );
- int refHeight = getRefHeight( true );
+ int refWidth, refHeight;
+ getRefDimensions( refWidth, refHeight, true );
int x = getDimension( attr["x"], refWidth );
int y = getDimension( attr["y"], refHeight );
const BuilderData::Window window( m_curWindowId,
return newId;
}
-int SkinParser::getRefWidth( bool toScreen )
+void SkinParser::getRefDimensions( int &rWidth, int &rHeight, bool toScreen )
{
if( toScreen )
{
OSFactory *pOsFactory = OSFactory::instance( getIntf() );
- return pOsFactory->getScreenWidth();
- }
-
- string panelId = m_panelStack.back();
- if( panelId != "none" )
- {
- const BuilderData::Panel panel = m_pData->m_listPanel.back();
- return panel.m_width;
- }
- else
- {
- const BuilderData::Layout layout = m_pData->m_listLayout.back();
- return layout.m_width;
- }
-}
-
-int SkinParser::getRefHeight( bool toScreen )
-{
- if( toScreen )
- {
- OSFactory *pOsFactory = OSFactory::instance( getIntf() );
- return pOsFactory->getScreenHeight();
+ rWidth = pOsFactory->getScreenWidth();
+ rHeight = pOsFactory->getScreenHeight();
+ return;
}
string panelId = m_panelStack.back();
if( panelId != "none" )
{
- const BuilderData::Panel panel = m_pData->m_listPanel.back();
- return panel.m_height;
+ list<BuilderData::Panel>::const_iterator it;
+ for( it = m_pData->m_listPanel.begin();
+ it != m_pData->m_listPanel.end(); ++it )
+ {
+ if( it->m_id == panelId )
+ {
+ rWidth = it->m_width;
+ rHeight = it->m_height;
+ return;
+ }
+ }
}
else
{
const BuilderData::Layout layout = m_pData->m_listLayout.back();
- return layout.m_height;
+ rWidth = layout.m_width;
+ rHeight = layout.m_height;
+ return;
}
+ msg_Err( getIntf(), "failure to retrieve parent panel or layout" );
}
BuilderData::Window win = m_pData->m_listWindow.back();
m_pData->m_listWindow.pop_back();
- int refWidth = getRefWidth( true );
- int refHeight = getRefHeight( true );
+ int refWidth, refHeight;
+ getRefDimensions( refWidth, refHeight, true );
convertPosition( win.m_position,
win.m_xOffset, win.m_yOffset,
win.m_xMargin, win.m_yMargin,