Commit e446629b authored by Olivier Teulière's avatar Olivier Teulière

* skins2: Text control now accepts lefttop and rightbottom attributes, like

   most other controls. The text is not really resized though (only cropped
   when needed).
   The change in the DTD is backwards-compatible.
parent 34e06122
......@@ -453,10 +453,13 @@ void Builder::addText( const BuilderData::Text &rData )
int height = pFont->getSize();
pLayout->addControl( pText, Position( rData.m_xPos, rData.m_yPos,
rData.m_xPos + rData.m_width,
rData.m_yPos + height, *pLayout ),
rData.m_layer );
// 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 );
pLayout->addControl( pText, pos, rData.m_layer );
m_pTheme->m_controls[rData.m_id] = CtrlGenericPtr( pText );
}
......
......@@ -8,7 +8,7 @@ Anchor xPos:int yPos:int 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 help:string layer:int windowId:string layoutId:string
Text id:string xPos:int yPos:int visible:string fontId:string text:string width:int color:uint32_t 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 color:uint32_t 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 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 fgColor:uint32_t playColor:uint32_t bgColor1:uint32_t bgColor2:uint32_t selColor:uint32_t help:string layer:int windowId:string layoutId:string
......
......@@ -223,8 +223,8 @@ m_id( id ), m_xPos( xPos ), m_yPos( yPos ), m_leftTop( leftTop ), m_rightBottom(
/// Type definition
struct Text
{
Text( const string & id, int xPos, int yPos, const string & visible, const string & fontId, const string & text, int width, uint32_t color, 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_color( color ), 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, uint32_t color, 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_help( help ), m_layer( layer ), m_windowId( windowId ), m_layoutId( layoutId ) {}
const string m_id;
int m_xPos;
......@@ -233,6 +233,8 @@ m_id( id ), m_xPos( xPos ), m_yPos( yPos ), m_visible( visible ), m_fontId( font
const string m_fontId;
const string m_text;
int m_width;
const string m_leftTop;
const string m_rightBottom;
uint32_t m_color;
const string m_help;
int m_layer;
......
......@@ -310,12 +310,15 @@ void SkinParser::handleBeginElement( const string &rName, AttrList_t &attr )
CheckDefault( "text", "" );
CheckDefault( "color", "#000000" );
CheckDefault( "width", "0" );
CheckDefault( "lefttop", "lefttop" );
CheckDefault( "rightbottom", "lefttop" );
CheckDefault( "help", "" );
const BuilderData::Text textData( uniqueId( attr["id"] ),
atoi( attr["x"] ) + m_xOffset, atoi( attr["y"] ) + m_yOffset,
attr["visible"], attr["font"],
attr["text"], atoi( attr["width"] ),
attr["lefttop"], attr["rightbottom"],
convertColor( attr["color"] ), attr["help"], m_curLayer,
m_curWindowId, m_curLayoutId );
m_curLayer++;
......
......@@ -162,10 +162,12 @@
visible CDATA "true"
x CDATA "0"
y CDATA "0"
width CDATA "0"
lefttop CDATA "lefttop"
rightbottom CDATA "lefttop"
text CDATA ""
font CDATA #REQUIRED
color CDATA "#000000"
width CDATA "0"
help CDATA ""
>
<!ELEMENT Playlist (Slider)?>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment