Commit dda858d4 authored by ipkiss's avatar ipkiss
Browse files

* skins2: new "xkeepratio" and "ykeepratio" attributes, common to all the

   controls. When set to "true", the behaviour of the resizing is changed
   (cf. documentation). The main use for these attributes is to keep a
   a control centered in the layout (horizontally, vertically or both) without
   resizing the control.
parent 3d353c9e
......@@ -398,7 +398,7 @@ difficulty to understand how VLC skins work.</para>
</sect4>
<sect4 id="anchorrange">
<title>range</title>
<para>Range of action of the anchor, in pixels. Default is "10".</para>
<para>Range of action of the anchor, in pixels.</para>
<para>Default value: 10</para>
</sect4>
</sect3>
......@@ -406,7 +406,7 @@ difficulty to understand how VLC skins work.</para>
<sect3 id="commattr">
<title>Attributes common to all the controls</title>
<para>The following attributes are common to all the controls (Image, Button, Checkbox, Text, Slider, RadialSlider, Playtree, Video)</para>
<para>The following attributes are common to all the controls (Image, Button, Checkbox, Text, Slider, RadialSlider, Playlist, Playtree, Video)</para>
<sect4 id="attrid">
<title>id</title>
<para>Identifiant of the control. Currently unused.</para>
......@@ -437,6 +437,18 @@ difficulty to understand how VLC skins work.</para>
<para>Indicate to which corner of the Layout the bottom-right-hand corner of this control is attached, in case of resizing.</para>
<para>Default value: lefttop</para>
</sect4>
<sect4 id="xkeepratio">
<title>xkeepratio</title>
<para>When set to true, the behaviour of the horizontal resizing is changed. Instead of taking into account the <link linkend="lefttop">lefttop</link> and <link linkend="rightbottom">rightbottom</link> attributes to determine how the control will be moved/resized, only its initial position inside the <link linkend="Layout">Layout</link> matters. For example, if initially the space to the left of the control is twice as big as the one to its right, this will stay the same during any horizontal resizing. The width of the control stays constant.</para>
<para>This attribute can be particularly useful to keep a control centered in the layout, without resizing it (to resize it, you would rather use the lefttop/rightbottom attributes).</para>
<para>Default value: false</para>
</sect4>
<sect4 id="ykeepratio">
<title>ykeepratio</title>
<para>When set to true, the behaviour of the vertical resizing is changed. Instead of taking into account the <link linkend="lefttop">lefttop</link> and <link linkend="rightbottom">rightbottom</link> attributes to determine how the control will be moved/resized, only its initial position inside the <link linkend="Layout">Layout</link> matters. For example, if initially the space to the top of the control is twice as big as the one to its bottom, this will stay the same during any vertical resizing. The height of the control stays constant.</para>
<para>This attribute can be particularly useful to keep a control centered in the layout, without resizing it (to resize it, you would rather use the lefttop/rightbottom attributes).</para>
<para>Default value: false</para>
</sect4>
<sect4 id="help">
<title>help</title>
<para>Help text for the current control. The variable '$H' will be expanded to this value when the mouse hovers the current control (see <link linkend="textvars">Text variables</link>).</para>
......
......@@ -430,7 +430,8 @@ void Builder::addButton( const BuilderData::Button &rData )
const Position pos = makePosition( rData.m_leftTop, rData.m_rightBottom,
rData.m_xPos, rData.m_yPos,
pBmpUp->getWidth(),
pBmpUp->getHeight(), *pLayout );
pBmpUp->getHeight(), *pLayout,
rData.m_xKeepRatio, rData.m_yKeepRatio );
pLayout->addControl( pButton, pos, rData.m_layer );
......@@ -505,7 +506,8 @@ void Builder::addCheckbox( const BuilderData::Checkbox &rData )
const Position pos = makePosition( rData.m_leftTop, rData.m_rightBottom,
rData.m_xPos, rData.m_yPos,
pBmpUp1->getWidth(),
pBmpUp1->getHeight(), *pLayout );
pBmpUp1->getHeight(), *pLayout,
rData.m_xKeepRatio, rData.m_yKeepRatio );
pLayout->addControl( pCheckbox, pos, rData.m_layer );
......@@ -551,9 +553,10 @@ void Builder::addImage( const BuilderData::Image &rData )
// Compute the position of the control
const Position pos = makePosition( rData.m_leftTop, rData.m_rightBottom,
rData.m_xPos,
rData.m_yPos, pBmp->getWidth(),
pBmp->getHeight(), *pLayout );
rData.m_xPos, rData.m_yPos,
pBmp->getWidth(), pBmp->getHeight(),
*pLayout, rData.m_xKeepRatio,
rData.m_yKeepRatio );
// XXX: test to be changed! XXX
if( rData.m_actionId == "move" )
......@@ -660,8 +663,8 @@ void Builder::addText( const BuilderData::Text &rData )
// Compute the position of the control
const Position pos = makePosition( rData.m_leftTop, rData.m_rightBottom,
rData.m_xPos, rData.m_yPos,
rData.m_width, height,
*pLayout );
rData.m_width, height, *pLayout,
rData.m_xKeepRatio, rData.m_yKeepRatio );
pLayout->addControl( pText, pos, rData.m_layer );
......@@ -708,10 +711,12 @@ void Builder::addRadialSlider( const BuilderData::RadialSlider &rData )
// XXX: resizing is not supported
// Compute the position of the control
const Position pos =
makePosition( rData.m_leftTop, rData.m_rightBottom, rData.m_xPos,
rData.m_yPos, pSeq->getWidth(),
pSeq->getHeight() / rData.m_nbImages, *pLayout );
const Position pos = makePosition( rData.m_leftTop, rData.m_rightBottom,
rData.m_xPos, rData.m_yPos,
pSeq->getWidth(),
pSeq->getHeight() / rData.m_nbImages,
*pLayout,
rData.m_xKeepRatio, rData.m_yKeepRatio );
pLayout->addControl( pRadial, pos, rData.m_layer );
......@@ -772,7 +777,8 @@ void Builder::addSlider( const BuilderData::Slider &rData )
const Position pos = makePosition( rData.m_leftTop, rData.m_rightBottom,
rData.m_xPos, rData.m_yPos,
pCurve->getWidth(), pCurve->getHeight(),
*pLayout );
*pLayout,
rData.m_xKeepRatio, rData.m_yKeepRatio );
pLayout->addControl( pBackground, pos, rData.m_layer );
......@@ -852,7 +858,8 @@ void Builder::addList( const BuilderData::List &rData )
const Position pos = makePosition( rData.m_leftTop, rData.m_rightBottom,
rData.m_xPos, rData.m_yPos,
rData.m_width, rData.m_height,
*pLayout );
*pLayout,
rData.m_xKeepRatio, rData.m_yKeepRatio );
pLayout->addControl( pList, pos, rData.m_layer );
......@@ -916,7 +923,8 @@ void Builder::addTree( const BuilderData::Tree &rData )
const Position pos = makePosition( rData.m_leftTop, rData.m_rightBottom,
rData.m_xPos, rData.m_yPos,
rData.m_width, rData.m_height,
*pLayout );
*pLayout,
rData.m_xKeepRatio, rData.m_yKeepRatio );
pLayout->addControl( pTree, pos, rData.m_layer );
......@@ -945,7 +953,8 @@ void Builder::addVideo( const BuilderData::Video &rData )
const Position pos = makePosition( rData.m_leftTop, rData.m_rightBottom,
rData.m_xPos, rData.m_yPos,
rData.m_width, rData.m_height,
*pLayout );
*pLayout,
rData.m_xKeepRatio, rData.m_yKeepRatio );
pLayout->addControl( pVideo, pos, rData.m_layer );
......@@ -956,7 +965,8 @@ void Builder::addVideo( const BuilderData::Video &rData )
const Position Builder::makePosition( const string &rLeftTop,
const string &rRightBottom,
int xPos, int yPos, int width,
int height, const Box &rBox ) const
int height, const Box &rBox,
bool xKeepRatio, bool yKeepRatio ) const
{
int left = 0, top = 0, right = 0, bottom = 0;
Position::Ref_t refLeftTop = Position::kLeftTop;
......@@ -1018,7 +1028,7 @@ const Position Builder::makePosition( const string &rLeftTop,
}
return Position( left, top, right, bottom, rBox, refLeftTop,
refRightBottom );
refRightBottom, xKeepRatio, yKeepRatio );
}
......
......@@ -90,7 +90,8 @@ class Builder: public SkinObject
const Position makePosition( const string &rLeftTop,
const string &rRightBottom,
int xPos, int yPos, int width, int height,
const Box &rBox ) const;
const Box &rBox, bool xKeepRatio = false,
bool yKeepRatio = false ) const;
// Build the full path of a file
string getFilePath( const string &fileName ) const;
......
......@@ -9,13 +9,13 @@ MenuSeparator pos:int popupId:string
Window id:string xPos:int yPos:int visible:bool dragDrop:bool playOnDrop:bool
Layout id:string width:int height:int minWidth:int maxWidth:int minHeight:int maxHeight:int windowId:string
Anchor xPos:int yPos:int leftTop:string range:int priority:int points:string layoutId:string
Button id:string xPos:int yPos:int leftTop:string rightBottom:string visible:string upId:string downId:string overId:string actionId:string tooltip:string help:string layer:int windowId:string layoutId:string
Checkbox id:string xPos:int yPos:int leftTop:string rightBottom:string visible:string up1Id:string down1Id:string over1Id:string up2Id:string down2Id:string over2Id:string state:string action1:string action2:string tooltip1:string tooltip2:string help:string layer:int windowId:string layoutId:string
Image id:string xPos:int yPos:int leftTop:string rightBottom:string visible:string bmpId:string actionId:string action2Id:string resize:string help:string layer:int windowId:string layoutId:string
Button id:string xPos:int yPos:int leftTop:string rightBottom:string xKeepRatio:bool yKeepRatio:bool visible:string upId:string downId:string overId:string actionId:string tooltip:string help:string layer:int windowId:string layoutId:string
Checkbox id:string xPos:int yPos:int leftTop:string rightBottom:string xKeepRatio:bool yKeepRatio:bool visible:string up1Id:string down1Id:string over1Id:string up2Id:string down2Id:string over2Id:string state:string action1:string action2:string tooltip1:string tooltip2:string help:string layer:int windowId:string layoutId:string
Image id:string xPos:int yPos:int leftTop:string rightBottom:string xKeepRatio:bool yKeepRatio:bool visible:string bmpId:string actionId:string action2Id:string resize:string help:string layer:int windowId:string layoutId:string
IniFile id:string file:string
Text id:string xPos:int yPos:int visible:string fontId:string text:string width:int leftTop:string rightBottom:string color:uint32_t scrolling:string alignment:string help:string layer:int windowId:string layoutId:string
RadialSlider id:string visible:string xPos:int yPos:int leftTop:string rightBottom:string sequence:string nbImages:int minAngle:float maxAngle:float value:string tooltip:string help:string layer:int windowId:string layoutId:string
Slider id:string visible:string xPos:int yPos:int leftTop:string rightBottom:string upId:string downId:string overId:string points:string thickness:int value:string imageId:string nbHoriz:int nbVert:int padHoriz:int padVert:int tooltip:string help:string layer:int windowId:string layoutId:string
List id:string xPos:int yPos:int visible:string width:int height:int leftTop:string rightBottom:string fontId:string var:string bgImageId:string fgColor:string playColor:string bgColor1:string bgColor2:string selColor:string help:string layer:int windowId:string layoutId:string
Tree id:string xPos:int yPos:int visible:string flat:string width:int height:int leftTop:string rightBottom:string fontId:string var:string bgImageId:string itemImageId:string openImageId:string closedImageId:string fgColor:string playColor:string bgColor1:string bgColor2:string selColor:string help:string layer:int windowId:string layoutId:string
Video id:string xPos:int yPos:int width:int height:int leftTop:string rightBottom:string visible:string autoResize:bool help:string layer:int windowId:string layoutId:string
Text id:string xPos:int yPos:int visible:string fontId:string text:string width:int leftTop:string rightBottom:string xKeepRatio:bool yKeepRatio:bool color:uint32_t scrolling:string alignment:string help:string layer:int windowId:string layoutId:string
RadialSlider id:string visible:string xPos:int yPos:int leftTop:string rightBottom:string xKeepRatio:bool yKeepRatio:bool sequence:string nbImages:int minAngle:float maxAngle:float value:string tooltip:string help:string layer:int windowId:string layoutId:string
Slider id:string visible:string xPos:int yPos:int leftTop:string rightBottom:string xKeepRatio:bool yKeepRatio:bool upId:string downId:string overId:string points:string thickness:int value:string imageId:string nbHoriz:int nbVert:int padHoriz:int padVert:int tooltip:string help:string layer:int windowId:string layoutId:string
List id:string xPos:int yPos:int visible:string width:int height:int leftTop:string rightBottom:string xKeepRatio:bool yKeepRatio:bool fontId:string var:string bgImageId:string fgColor:string playColor:string bgColor1:string bgColor2:string selColor:string help:string layer:int windowId:string layoutId:string
Tree id:string xPos:int yPos:int visible:string flat:string width:int height:int leftTop:string rightBottom:string xKeepRatio:bool yKeepRatio:bool fontId:string var:string bgImageId:string itemImageId:string openImageId:string closedImageId:string fgColor:string playColor:string bgColor1:string bgColor2:string selColor:string help:string layer:int windowId:string layoutId:string
Video id:string xPos:int yPos:int width:int height:int leftTop:string rightBottom:string xKeepRatio:bool yKeepRatio:bool visible:string autoResize:bool help:string layer:int windowId:string layoutId:string
......@@ -203,14 +203,16 @@ m_xPos( xPos ), m_yPos( yPos ), m_leftTop( leftTop ), m_range( range ), m_priori
/// Type definition
struct Button
{
Button( const string & id, int xPos, int yPos, const string & leftTop, const string & rightBottom, const string & visible, const string & upId, const string & downId, const string & overId, const string & actionId, const string & tooltip, const string & help, int layer, const string & windowId, const string & layoutId ):
m_id( id ), m_xPos( xPos ), m_yPos( yPos ), m_leftTop( leftTop ), m_rightBottom( rightBottom ), m_visible( visible ), m_upId( upId ), m_downId( downId ), m_overId( overId ), m_actionId( actionId ), m_tooltip( tooltip ), m_help( help ), m_layer( layer ), m_windowId( windowId ), m_layoutId( layoutId ) {}
Button( const string & id, int xPos, int yPos, const string & leftTop, const string & rightBottom, bool xKeepRatio, bool yKeepRatio, const string & visible, const string & upId, const string & downId, const string & overId, const string & actionId, const string & tooltip, const string & help, int layer, const string & windowId, const string & layoutId ):
m_id( id ), m_xPos( xPos ), m_yPos( yPos ), m_leftTop( leftTop ), m_rightBottom( rightBottom ), m_xKeepRatio( xKeepRatio ), m_yKeepRatio( yKeepRatio ), m_visible( visible ), m_upId( upId ), m_downId( downId ), m_overId( overId ), m_actionId( actionId ), m_tooltip( tooltip ), m_help( help ), m_layer( layer ), m_windowId( windowId ), m_layoutId( layoutId ) {}
string m_id;
int m_xPos;
int m_yPos;
string m_leftTop;
string m_rightBottom;
bool m_xKeepRatio;
bool m_yKeepRatio;
string m_visible;
string m_upId;
string m_downId;
......@@ -228,14 +230,16 @@ m_id( id ), m_xPos( xPos ), m_yPos( yPos ), m_leftTop( leftTop ), m_rightBottom(
/// Type definition
struct Checkbox
{
Checkbox( const string & id, int xPos, int yPos, const string & leftTop, const string & rightBottom, const string & visible, const string & up1Id, const string & down1Id, const string & over1Id, const string & up2Id, const string & down2Id, const string & over2Id, const string & state, const string & action1, const string & action2, const string & tooltip1, const string & tooltip2, const string & help, int layer, const string & windowId, const string & layoutId ):
m_id( id ), m_xPos( xPos ), m_yPos( yPos ), m_leftTop( leftTop ), m_rightBottom( rightBottom ), m_visible( visible ), m_up1Id( up1Id ), m_down1Id( down1Id ), m_over1Id( over1Id ), m_up2Id( up2Id ), m_down2Id( down2Id ), m_over2Id( over2Id ), m_state( state ), m_action1( action1 ), m_action2( action2 ), m_tooltip1( tooltip1 ), m_tooltip2( tooltip2 ), m_help( help ), m_layer( layer ), m_windowId( windowId ), m_layoutId( layoutId ) {}
Checkbox( const string & id, int xPos, int yPos, const string & leftTop, const string & rightBottom, bool xKeepRatio, bool yKeepRatio, const string & visible, const string & up1Id, const string & down1Id, const string & over1Id, const string & up2Id, const string & down2Id, const string & over2Id, const string & state, const string & action1, const string & action2, const string & tooltip1, const string & tooltip2, const string & help, int layer, const string & windowId, const string & layoutId ):
m_id( id ), m_xPos( xPos ), m_yPos( yPos ), m_leftTop( leftTop ), m_rightBottom( rightBottom ), m_xKeepRatio( xKeepRatio ), m_yKeepRatio( yKeepRatio ), m_visible( visible ), m_up1Id( up1Id ), m_down1Id( down1Id ), m_over1Id( over1Id ), m_up2Id( up2Id ), m_down2Id( down2Id ), m_over2Id( over2Id ), m_state( state ), m_action1( action1 ), m_action2( action2 ), m_tooltip1( tooltip1 ), m_tooltip2( tooltip2 ), m_help( help ), m_layer( layer ), m_windowId( windowId ), m_layoutId( layoutId ) {}
string m_id;
int m_xPos;
int m_yPos;
string m_leftTop;
string m_rightBottom;
bool m_xKeepRatio;
bool m_yKeepRatio;
string m_visible;
string m_up1Id;
string m_down1Id;
......@@ -259,14 +263,16 @@ m_id( id ), m_xPos( xPos ), m_yPos( yPos ), m_leftTop( leftTop ), m_rightBottom(
/// Type definition
struct Image
{
Image( const string & id, int xPos, int yPos, const string & leftTop, const string & rightBottom, const string & visible, const string & bmpId, const string & actionId, const string & action2Id, const string & resize, const string & help, int layer, const string & windowId, const string & layoutId ):
m_id( id ), m_xPos( xPos ), m_yPos( yPos ), m_leftTop( leftTop ), m_rightBottom( rightBottom ), m_visible( visible ), m_bmpId( bmpId ), m_actionId( actionId ), m_action2Id( action2Id ), m_resize( resize ), m_help( help ), m_layer( layer ), m_windowId( windowId ), m_layoutId( layoutId ) {}
Image( const string & id, int xPos, int yPos, const string & leftTop, const string & rightBottom, bool xKeepRatio, bool yKeepRatio, const string & visible, const string & bmpId, const string & actionId, const string & action2Id, const string & resize, const string & help, int layer, const string & windowId, const string & layoutId ):
m_id( id ), m_xPos( xPos ), m_yPos( yPos ), m_leftTop( leftTop ), m_rightBottom( rightBottom ), m_xKeepRatio( xKeepRatio ), m_yKeepRatio( yKeepRatio ), m_visible( visible ), m_bmpId( bmpId ), m_actionId( actionId ), m_action2Id( action2Id ), m_resize( resize ), m_help( help ), m_layer( layer ), m_windowId( windowId ), m_layoutId( layoutId ) {}
string m_id;
int m_xPos;
int m_yPos;
string m_leftTop;
string m_rightBottom;
bool m_xKeepRatio;
bool m_yKeepRatio;
string m_visible;
string m_bmpId;
string m_actionId;
......@@ -295,8 +301,8 @@ m_id( id ), m_file( file ) {}
/// Type definition
struct Text
{
Text( const string & id, int xPos, int yPos, const string & visible, const string & fontId, const string & text, int width, const string & leftTop, const string & rightBottom, uint32_t color, const string & scrolling, const string & alignment, const string & help, int layer, const string & windowId, const string & layoutId ):
m_id( id ), m_xPos( xPos ), m_yPos( yPos ), m_visible( visible ), m_fontId( fontId ), m_text( text ), m_width( width ), m_leftTop( leftTop ), m_rightBottom( rightBottom ), m_color( color ), m_scrolling( scrolling ), m_alignment( alignment ), m_help( help ), m_layer( layer ), m_windowId( windowId ), m_layoutId( layoutId ) {}
Text( const string & id, int xPos, int yPos, const string & visible, const string & fontId, const string & text, int width, const string & leftTop, const string & rightBottom, bool xKeepRatio, bool yKeepRatio, uint32_t color, const string & scrolling, const string & alignment, const string & help, int layer, const string & windowId, const string & layoutId ):
m_id( id ), m_xPos( xPos ), m_yPos( yPos ), m_visible( visible ), m_fontId( fontId ), m_text( text ), m_width( width ), m_leftTop( leftTop ), m_rightBottom( rightBottom ), m_xKeepRatio( xKeepRatio ), m_yKeepRatio( yKeepRatio ), m_color( color ), m_scrolling( scrolling ), m_alignment( alignment ), m_help( help ), m_layer( layer ), m_windowId( windowId ), m_layoutId( layoutId ) {}
string m_id;
int m_xPos;
......@@ -307,6 +313,8 @@ m_id( id ), m_xPos( xPos ), m_yPos( yPos ), m_visible( visible ), m_fontId( font
int m_width;
string m_leftTop;
string m_rightBottom;
bool m_xKeepRatio;
bool m_yKeepRatio;
uint32_t m_color;
string m_scrolling;
string m_alignment;
......@@ -321,8 +329,8 @@ m_id( id ), m_xPos( xPos ), m_yPos( yPos ), m_visible( visible ), m_fontId( font
/// Type definition
struct RadialSlider
{
RadialSlider( const string & id, const string & visible, int xPos, int yPos, const string & leftTop, const string & rightBottom, const string & sequence, int nbImages, float minAngle, float maxAngle, const string & value, const string & tooltip, const string & help, int layer, const string & windowId, const string & layoutId ):
m_id( id ), m_visible( visible ), m_xPos( xPos ), m_yPos( yPos ), m_leftTop( leftTop ), m_rightBottom( rightBottom ), m_sequence( sequence ), m_nbImages( nbImages ), m_minAngle( minAngle ), m_maxAngle( maxAngle ), m_value( value ), m_tooltip( tooltip ), m_help( help ), m_layer( layer ), m_windowId( windowId ), m_layoutId( layoutId ) {}
RadialSlider( const string & id, const string & visible, int xPos, int yPos, const string & leftTop, const string & rightBottom, bool xKeepRatio, bool yKeepRatio, const string & sequence, int nbImages, float minAngle, float maxAngle, const string & value, const string & tooltip, const string & help, int layer, const string & windowId, const string & layoutId ):
m_id( id ), m_visible( visible ), m_xPos( xPos ), m_yPos( yPos ), m_leftTop( leftTop ), m_rightBottom( rightBottom ), m_xKeepRatio( xKeepRatio ), m_yKeepRatio( yKeepRatio ), m_sequence( sequence ), m_nbImages( nbImages ), m_minAngle( minAngle ), m_maxAngle( maxAngle ), m_value( value ), m_tooltip( tooltip ), m_help( help ), m_layer( layer ), m_windowId( windowId ), m_layoutId( layoutId ) {}
string m_id;
string m_visible;
......@@ -330,6 +338,8 @@ m_id( id ), m_visible( visible ), m_xPos( xPos ), m_yPos( yPos ), m_leftTop( lef
int m_yPos;
string m_leftTop;
string m_rightBottom;
bool m_xKeepRatio;
bool m_yKeepRatio;
string m_sequence;
int m_nbImages;
float m_minAngle;
......@@ -347,8 +357,8 @@ m_id( id ), m_visible( visible ), m_xPos( xPos ), m_yPos( yPos ), m_leftTop( lef
/// Type definition
struct Slider
{
Slider( const string & id, const string & visible, int xPos, int yPos, const string & leftTop, const string & rightBottom, const string & upId, const string & downId, const string & overId, const string & points, int thickness, const string & value, const string & imageId, int nbHoriz, int nbVert, int padHoriz, int padVert, const string & tooltip, const string & help, int layer, const string & windowId, const string & layoutId ):
m_id( id ), m_visible( visible ), m_xPos( xPos ), m_yPos( yPos ), m_leftTop( leftTop ), m_rightBottom( rightBottom ), m_upId( upId ), m_downId( downId ), m_overId( overId ), m_points( points ), m_thickness( thickness ), m_value( value ), m_imageId( imageId ), m_nbHoriz( nbHoriz ), m_nbVert( nbVert ), m_padHoriz( padHoriz ), m_padVert( padVert ), m_tooltip( tooltip ), m_help( help ), m_layer( layer ), m_windowId( windowId ), m_layoutId( layoutId ) {}
Slider( const string & id, const string & visible, int xPos, int yPos, const string & leftTop, const string & rightBottom, bool xKeepRatio, bool yKeepRatio, const string & upId, const string & downId, const string & overId, const string & points, int thickness, const string & value, const string & imageId, int nbHoriz, int nbVert, int padHoriz, int padVert, const string & tooltip, const string & help, int layer, const string & windowId, const string & layoutId ):
m_id( id ), m_visible( visible ), m_xPos( xPos ), m_yPos( yPos ), m_leftTop( leftTop ), m_rightBottom( rightBottom ), m_xKeepRatio( xKeepRatio ), m_yKeepRatio( yKeepRatio ), m_upId( upId ), m_downId( downId ), m_overId( overId ), m_points( points ), m_thickness( thickness ), m_value( value ), m_imageId( imageId ), m_nbHoriz( nbHoriz ), m_nbVert( nbVert ), m_padHoriz( padHoriz ), m_padVert( padVert ), m_tooltip( tooltip ), m_help( help ), m_layer( layer ), m_windowId( windowId ), m_layoutId( layoutId ) {}
string m_id;
string m_visible;
......@@ -356,6 +366,8 @@ m_id( id ), m_visible( visible ), m_xPos( xPos ), m_yPos( yPos ), m_leftTop( lef
int m_yPos;
string m_leftTop;
string m_rightBottom;
bool m_xKeepRatio;
bool m_yKeepRatio;
string m_upId;
string m_downId;
string m_overId;
......@@ -379,8 +391,8 @@ m_id( id ), m_visible( visible ), m_xPos( xPos ), m_yPos( yPos ), m_leftTop( lef
/// Type definition
struct List
{
List( const string & id, int xPos, int yPos, const string & visible, int width, int height, const string & leftTop, const string & rightBottom, const string & fontId, const string & var, const string & bgImageId, const string & fgColor, const string & playColor, const string & bgColor1, const string & bgColor2, const string & selColor, const string & help, int layer, const string & windowId, const string & layoutId ):
m_id( id ), m_xPos( xPos ), m_yPos( yPos ), m_visible( visible ), m_width( width ), m_height( height ), m_leftTop( leftTop ), m_rightBottom( rightBottom ), m_fontId( fontId ), m_var( var ), m_bgImageId( bgImageId ), m_fgColor( fgColor ), m_playColor( playColor ), m_bgColor1( bgColor1 ), m_bgColor2( bgColor2 ), m_selColor( selColor ), m_help( help ), m_layer( layer ), m_windowId( windowId ), m_layoutId( layoutId ) {}
List( const string & id, int xPos, int yPos, const string & visible, int width, int height, const string & leftTop, const string & rightBottom, bool xKeepRatio, bool yKeepRatio, const string & fontId, const string & var, const string & bgImageId, const string & fgColor, const string & playColor, const string & bgColor1, const string & bgColor2, const string & selColor, const string & help, int layer, const string & windowId, const string & layoutId ):
m_id( id ), m_xPos( xPos ), m_yPos( yPos ), m_visible( visible ), m_width( width ), m_height( height ), m_leftTop( leftTop ), m_rightBottom( rightBottom ), m_xKeepRatio( xKeepRatio ), m_yKeepRatio( yKeepRatio ), m_fontId( fontId ), m_var( var ), m_bgImageId( bgImageId ), m_fgColor( fgColor ), m_playColor( playColor ), m_bgColor1( bgColor1 ), m_bgColor2( bgColor2 ), m_selColor( selColor ), m_help( help ), m_layer( layer ), m_windowId( windowId ), m_layoutId( layoutId ) {}
string m_id;
int m_xPos;
......@@ -390,6 +402,8 @@ m_id( id ), m_xPos( xPos ), m_yPos( yPos ), m_visible( visible ), m_width( width
int m_height;
string m_leftTop;
string m_rightBottom;
bool m_xKeepRatio;
bool m_yKeepRatio;
string m_fontId;
string m_var;
string m_bgImageId;
......@@ -409,8 +423,8 @@ m_id( id ), m_xPos( xPos ), m_yPos( yPos ), m_visible( visible ), m_width( width
/// Type definition
struct Tree
{
Tree( const string & id, int xPos, int yPos, const string & visible, const string & flat, int width, int height, const string & leftTop, const string & rightBottom, const string & fontId, const string & var, const string & bgImageId, const string & itemImageId, const string & openImageId, const string & closedImageId, const string & fgColor, const string & playColor, const string & bgColor1, const string & bgColor2, const string & selColor, const string & help, int layer, const string & windowId, const string & layoutId ):
m_id( id ), m_xPos( xPos ), m_yPos( yPos ), m_visible( visible ), m_flat( flat ), m_width( width ), m_height( height ), m_leftTop( leftTop ), m_rightBottom( rightBottom ), m_fontId( fontId ), m_var( var ), m_bgImageId( bgImageId ), m_itemImageId( itemImageId ), m_openImageId( openImageId ), m_closedImageId( closedImageId ), m_fgColor( fgColor ), m_playColor( playColor ), m_bgColor1( bgColor1 ), m_bgColor2( bgColor2 ), m_selColor( selColor ), m_help( help ), m_layer( layer ), m_windowId( windowId ), m_layoutId( layoutId ) {}
Tree( const string & id, int xPos, int yPos, const string & visible, const string & flat, int width, int height, const string & leftTop, const string & rightBottom, bool xKeepRatio, bool yKeepRatio, const string & fontId, const string & var, const string & bgImageId, const string & itemImageId, const string & openImageId, const string & closedImageId, const string & fgColor, const string & playColor, const string & bgColor1, const string & bgColor2, const string & selColor, const string & help, int layer, const string & windowId, const string & layoutId ):
m_id( id ), m_xPos( xPos ), m_yPos( yPos ), m_visible( visible ), m_flat( flat ), m_width( width ), m_height( height ), m_leftTop( leftTop ), m_rightBottom( rightBottom ), m_xKeepRatio( xKeepRatio ), m_yKeepRatio( yKeepRatio ), m_fontId( fontId ), m_var( var ), m_bgImageId( bgImageId ), m_itemImageId( itemImageId ), m_openImageId( openImageId ), m_closedImageId( closedImageId ), m_fgColor( fgColor ), m_playColor( playColor ), m_bgColor1( bgColor1 ), m_bgColor2( bgColor2 ), m_selColor( selColor ), m_help( help ), m_layer( layer ), m_windowId( windowId ), m_layoutId( layoutId ) {}
string m_id;
int m_xPos;
......@@ -421,6 +435,8 @@ m_id( id ), m_xPos( xPos ), m_yPos( yPos ), m_visible( visible ), m_flat( flat )
int m_height;
string m_leftTop;
string m_rightBottom;
bool m_xKeepRatio;
bool m_yKeepRatio;
string m_fontId;
string m_var;
string m_bgImageId;
......@@ -443,8 +459,8 @@ m_id( id ), m_xPos( xPos ), m_yPos( yPos ), m_visible( visible ), m_flat( flat )
/// Type definition
struct Video
{
Video( const string & id, int xPos, int yPos, int width, int height, const string & leftTop, const string & rightBottom, const string & visible, bool autoResize, const string & help, int layer, const string & windowId, const string & layoutId ):
m_id( id ), m_xPos( xPos ), m_yPos( yPos ), m_width( width ), m_height( height ), m_leftTop( leftTop ), m_rightBottom( rightBottom ), m_visible( visible ), m_autoResize( autoResize ), m_help( help ), m_layer( layer ), m_windowId( windowId ), m_layoutId( layoutId ) {}
Video( const string & id, int xPos, int yPos, int width, int height, const string & leftTop, const string & rightBottom, bool xKeepRatio, bool yKeepRatio, const string & visible, bool autoResize, const string & help, int layer, const string & windowId, const string & layoutId ):
m_id( id ), m_xPos( xPos ), m_yPos( yPos ), m_width( width ), m_height( height ), m_leftTop( leftTop ), m_rightBottom( rightBottom ), m_xKeepRatio( xKeepRatio ), m_yKeepRatio( yKeepRatio ), m_visible( visible ), m_autoResize( autoResize ), m_help( help ), m_layer( layer ), m_windowId( windowId ), m_layoutId( layoutId ) {}
string m_id;
int m_xPos;
......@@ -453,6 +469,8 @@ m_id( id ), m_xPos( xPos ), m_yPos( yPos ), m_width( width ), m_height( height )
int m_height;
string m_leftTop;
string m_rightBottom;
bool m_xKeepRatio;
bool m_yKeepRatio;
string m_visible;
bool m_autoResize;
string m_help;
......
......@@ -181,6 +181,8 @@ void SkinParser::handleBeginElement( const string &rName, AttrList_t &attr )
CheckDefault( "y", "0" );
CheckDefault( "lefttop", "lefttop" );
CheckDefault( "rightbottom", "lefttop" );
CheckDefault( "xkeepratio", "false" );
CheckDefault( "ykeepratio", "false" );
CheckDefault( "down", "none" );
CheckDefault( "over", "none" );
CheckDefault( "action", "none" );
......@@ -189,7 +191,9 @@ void SkinParser::handleBeginElement( const string &rName, AttrList_t &attr )
const BuilderData::Button button( uniqueId( attr["id"] ),
atoi( attr["x"] ) + m_xOffset, atoi( attr["y"] ) + m_yOffset,
attr["lefttop"], attr["rightbottom"], attr["visible"],
attr["lefttop"], attr["rightbottom"],
convertBoolean( attr["xkeepratio"] ),
convertBoolean( attr["ykeepratio"] ), attr["visible"],
attr["up"], attr["down"], attr["over"], attr["action"],
attr["tooltiptext"], attr["help"],
m_curLayer, m_curWindowId, m_curLayoutId );
......@@ -208,6 +212,8 @@ void SkinParser::handleBeginElement( const string &rName, AttrList_t &attr )
CheckDefault( "y", "0" );
CheckDefault( "lefttop", "lefttop" );
CheckDefault( "rightbottom", "lefttop" );
CheckDefault( "xkeepratio", "false" );
CheckDefault( "ykeepratio", "false" );
CheckDefault( "down1", "none" );
CheckDefault( "over1", "none" );
CheckDefault( "down2", "none" );
......@@ -220,7 +226,9 @@ void SkinParser::handleBeginElement( const string &rName, AttrList_t &attr )
const BuilderData::Checkbox checkbox( uniqueId( attr["id"] ),
atoi( attr["x"] ) + m_xOffset, atoi( attr["y"] ) + m_yOffset,
attr["lefttop"], attr["rightbottom"], attr["visible"],
attr["lefttop"], attr["rightbottom"],
convertBoolean( attr["xkeepratio"] ),
convertBoolean( attr["ykeepratio"] ), attr["visible"],
attr["up1"], attr["down1"], attr["over1"],
attr["up2"], attr["down2"], attr["over2"], attr["state"],
attr["action1"], attr["action2"], attr["tooltiptext1"],
......@@ -261,6 +269,8 @@ void SkinParser::handleBeginElement( const string &rName, AttrList_t &attr )
CheckDefault( "y", "0" );
CheckDefault( "lefttop", "lefttop" );
CheckDefault( "rightbottom", "lefttop" );
CheckDefault( "xkeepratio", "false" );
CheckDefault( "ykeepratio", "false" );
CheckDefault( "action", "none" );
CheckDefault( "action2", "none" );
CheckDefault( "resize", "mosaic" );
......@@ -268,7 +278,9 @@ void SkinParser::handleBeginElement( const string &rName, AttrList_t &attr )
const BuilderData::Image imageData( uniqueId( attr["id"] ),
atoi( attr["x"] ) + m_xOffset, atoi( attr["y"] ) + m_yOffset,
attr["lefttop"], attr["rightbottom"], attr["visible"],
attr["lefttop"], attr["rightbottom"],
convertBoolean( attr["xkeepratio"] ),
convertBoolean( attr["ykeepratio"] ), attr["visible"],
attr["image"], attr["action"], attr["action2"], attr["resize"],
attr["help"], m_curLayer, m_curWindowId, m_curLayoutId );
m_curLayer++;
......@@ -305,6 +317,8 @@ void SkinParser::handleBeginElement( const string &rName, AttrList_t &attr )
CheckDefault( "height", "0" );
CheckDefault( "lefttop", "lefttop" );
CheckDefault( "rightbottom", "lefttop" );
CheckDefault( "xkeepratio", "false" );
CheckDefault( "ykeepratio", "false" );
CheckDefault( "bgimage", "none" );
CheckDefault( "itemimage", "none" );
CheckDefault( "openimage", "none" );
......@@ -321,6 +335,8 @@ void SkinParser::handleBeginElement( const string &rName, AttrList_t &attr )
attr["flat"],
atoi( attr["width"]), atoi( attr["height"] ),
attr["lefttop"], attr["rightbottom"],
convertBoolean( attr["xkeepratio"] ),
convertBoolean( attr["ykeepratio"] ),
attr["font"], "playtree",
attr["bgimage"], attr["itemimage"],
attr["openimage"], attr["closedimage"],
......@@ -345,6 +361,8 @@ void SkinParser::handleBeginElement( const string &rName, AttrList_t &attr )
CheckDefault( "height", "0" );
CheckDefault( "lefttop", "lefttop" );
CheckDefault( "rightbottom", "lefttop" );
CheckDefault( "xkeepratio", "false" );
CheckDefault( "ykeepratio", "false" );
CheckDefault( "bgimage", "none" );
CheckDefault( "itemimage", "none" );
CheckDefault( "openimage", "none" );
......@@ -362,6 +380,8 @@ void SkinParser::handleBeginElement( const string &rName, AttrList_t &attr )
attr["flat"],
atoi( attr["width"]), atoi( attr["height"] ),
attr["lefttop"], attr["rightbottom"],
convertBoolean( attr["xkeepratio"] ),
convertBoolean( attr["ykeepratio"] ),
attr["font"], "playtree",
attr["bgimage"], attr["itemimage"],
attr["openimage"], attr["closedimage"],
......@@ -383,6 +403,8 @@ void SkinParser::handleBeginElement( const string &rName, AttrList_t &attr )
CheckDefault( "y", "0" );
CheckDefault( "lefttop", "lefttop" );
CheckDefault( "rightbottom", "lefttop" );
CheckDefault( "xkeepratio", "false" );
CheckDefault( "ykeepratio", "false" );
CheckDefault( "minangle", "0" );
CheckDefault( "maxangle", "360" );
CheckDefault( "value", "none" );
......@@ -392,7 +414,9 @@ void SkinParser::handleBeginElement( const string &rName, AttrList_t &attr )
const BuilderData::RadialSlider radial( uniqueId( attr["id"] ),
attr["visible"],
atoi( attr["x"] ) + m_xOffset, atoi( attr["y"] ) + m_yOffset,
attr["lefttop"], attr["rightbottom"], attr["sequence"],
attr["lefttop"], attr["rightbottom"],
convertBoolean( attr["xkeepratio"] ),
convertBoolean( attr["ykeepratio"] ), attr["sequence"],
atoi( attr["nbImages"] ), atof( attr["minAngle"] ) * M_PI /180,
atof( attr["maxAngle"] ) * M_PI / 180, attr["value"],
attr["tooltiptext"], attr["help"], m_curLayer, m_curWindowId,
......@@ -413,6 +437,8 @@ void SkinParser::handleBeginElement( const string &rName, AttrList_t &attr )
CheckDefault( "height", "0" );
CheckDefault( "lefttop", "lefttop" );
CheckDefault( "rightbottom", "lefttop" );
CheckDefault( "xkeepratio", "false" );
CheckDefault( "ykeepratio", "false" );
CheckDefault( "down", "none" );
CheckDefault( "over", "none" );
CheckDefault( "thickness", "10" );
......@@ -429,7 +455,8 @@ void SkinParser::handleBeginElement( const string &rName, AttrList_t &attr )
const BuilderData::Slider slider( uniqueId( attr["id"] ),
attr["visible"], atoi( attr["x"] ) + m_xOffset,
atoi( attr["y"] ) + m_yOffset, attr["lefttop"],
attr["rightbottom"], attr["up"], attr["down"],
attr["rightbottom"], convertBoolean( attr["xkeepratio"] ),
convertBoolean( attr["ykeepratio"] ), attr["up"], attr["down"],
attr["over"], attr["points"], atoi( attr["thickness"] ),
newValue, "none", 0, 0, 0, 0, attr["tooltiptext"],
attr["help"], m_curLayer, m_curWindowId, m_curLayoutId );
......@@ -469,6 +496,8 @@ void SkinParser::handleBeginElement( const string &rName, AttrList_t &attr )
CheckDefault( "width", "0" );
CheckDefault( "lefttop", "lefttop" );
CheckDefault( "rightbottom", "lefttop" );
CheckDefault( "xkeepratio", "false" );
CheckDefault( "ykeepratio", "false" );
CheckDefault( "help", "" );
const BuilderData::Text textData( uniqueId( attr["id"] ),
......@@ -476,6 +505,8 @@ void SkinParser::handleBeginElement( const string &rName, AttrList_t &attr )
attr["visible"], attr["font"],
attr["text"], atoi( attr["width"] ),
attr["lefttop"], attr["rightbottom"],
convertBoolean( attr["xkeepratio"] ),
convertBoolean( attr["ykeepratio"] ),
convertColor( attr["color"] ),
attr["scrolling"], attr["alignment"],
attr["help"], m_curLayer, m_curWindowId, m_curLayoutId );
......@@ -522,6 +553,8 @@ void SkinParser::handleBeginElement( const string &rName, AttrList_t &attr )
CheckDefault( "height", "0" );
CheckDefault( "lefttop", "lefttop" );
CheckDefault( "rightbottom", "lefttop" );
CheckDefault( "xkeepratio", "false" );
CheckDefault( "ykeepratio", "false" );
CheckDefault( "autoresize", "false" );
CheckDefault( "help", "" );
......@@ -529,6 +562,8 @@ void SkinParser::handleBeginElement( const string &rName, AttrList_t &attr )
atoi( attr["x"] ) + m_xOffset, atoi( attr["y"] ) + m_yOffset,
atoi( attr["width"] ), atoi( attr["height" ]),
attr["lefttop"], attr["rightbottom"],
convertBoolean( attr["xkeepratio"] ),
convertBoolean( attr["ykeepratio"] ),
attr["visible"], convertBoolean( attr["autoresize"] ),
attr["help"], m_curLayer, m_curWindowId, m_curLayoutId );
m_curLayer++;
......
......@@ -35,83 +35,186 @@ Rect::Rect( int left, int top, int right, int bottom ):
Position::Position( int left, int top, int right, int bottom, const Box &rBox,
Ref_t refLeftTop, Ref_t refRightBottom ):
Ref_t refLeftTop, Ref_t refRightBottom, bool xKeepRatio,
bool yKeepRatio ):
m_left( left ), m_top( top ), m_right( right ), m_bottom( bottom ),
m_rBox( rBox ), m_refLeftTop( refLeftTop ),
m_refRighBottom( refRightBottom )
m_refRighBottom( refRightBottom ), m_xKeepRatio( xKeepRatio ),
m_yKeepRatio( yKeepRatio )
{
// Here is how the resizing algorithm works:
//
// - if we "keep the ratio" (xkeepratio="true" in the XML), the relative
// position of the control in the layout (i.e. the given rBox) is
// saved, and will be kept constant. The size of the control will not
// be changed, only its position may vary. To do that, we consider the
// part of the layout to the left of the control (for an horizontal
// resizing) and the part of the layout to the right of the control,
// and we make sure that the ratio between their widths is constant.
//
// - if we don't keep the ratio, the resizing algorithm is completely
// different. We consider that the top left hand corner of the control
// ("lefttop" attribute in the XML) is linked to one of the 4 corners
// of the layouts ("lefttop", "leftbottom", "righttop" and
// "rightbottom" values for the attribute). Same thing for the bottom