]> git.sesse.net Git - vlc/commitdiff
* skins2: Text control now accepts lefttop and rightbottom attributes, like
authorOlivier Teulière <ipkiss@videolan.org>
Sun, 3 Apr 2005 12:56:25 +0000 (12:56 +0000)
committerOlivier Teulière <ipkiss@videolan.org>
Sun, 3 Apr 2005 12:56:25 +0000 (12:56 +0000)
   most other controls. The text is not really resized though (only cropped
   when needed).
   The change in the DTD is backwards-compatible.

modules/gui/skins2/parser/builder.cpp
modules/gui/skins2/parser/builder_data.def
modules/gui/skins2/parser/builder_data.hpp
modules/gui/skins2/parser/skin_parser.cpp
share/skins2/skin.dtd

index bc4996a83032b6518eebed09ecb12883d0f71775..ba1331af8aee6493c7486571f7e71e2c5c36c3e8 100644 (file)
@@ -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 );
 }
index 4d37660b7a0da33be031f2ba97ec00cac24c75e5..f14075b18d310341adcb4f43d340e658bd7b6d76 100644 (file)
@@ -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
index 5a204eccc7fb8c3c763f46fae0d0c547f3d39b09..9f3022a31adcedc2410ad584f71274f0bb3c109e 100644 (file)
@@ -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;
index 4e6a4cba10ef5844f24e8a1514235a95ad3705d2..7f5a7e8c1c2db1df3c23e4fdab1078ff08d35f9b 100644 (file)
@@ -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++;
index 8d28d626fe7627db2cc82eb28432a85aba6fe015..3c8bbf4c9451bc4c0490ea4c7f79a46d29e7ea54 100644 (file)
         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)?>