Changeset 24648f43cf4371f6c6d6d78db2f5ae755f810cc8
- Timestamp:
- 06/04/06 01:57:40 (2 years ago)
- git-parent:
- Files:
-
- doc/skins/skins2-howto.xml (modified) (1 diff)
- modules/gui/skins2/commands/cmd_resize.cpp (modified) (2 diffs)
- modules/gui/skins2/commands/cmd_resize.hpp (modified) (3 diffs)
- modules/gui/skins2/controls/ctrl_resize.cpp (modified) (6 diffs)
- modules/gui/skins2/controls/ctrl_resize.hpp (modified) (4 diffs)
- modules/gui/skins2/controls/ctrl_video.cpp (modified) (2 diffs)
- modules/gui/skins2/parser/builder.cpp (modified) (3 diffs)
- modules/gui/skins2/parser/builder_data.def (modified) (1 diff)
- modules/gui/skins2/parser/builder_data.hpp (modified) (1 diff)
- modules/gui/skins2/parser/skin_parser.cpp (modified) (1 diff)
- modules/gui/skins2/src/anchor.hpp (modified) (4 diffs)
- modules/gui/skins2/src/generic_layout.cpp (modified) (1 diff)
- modules/gui/skins2/src/window_manager.cpp (modified) (4 diffs)
- modules/gui/skins2/src/window_manager.hpp (modified) (5 diffs)
- modules/gui/skins2/utils/position.hpp (modified) (1 diff)
- share/skins2/skin.dtd (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
doc/skins/skins2-howto.xml
r28bd3a4 r24648f4 380 380 <para>Default value: 0</para> 381 381 </sect4> 382 <sect4 id="anchorlefttop"> 383 <title>lefttop</title> 384 <para>Indicate to which corner of the Layout the top-left-hand corner of this anchor is attached, in case of resizing. Possible values are 'lefttop', 'leftbottom', 'righttop' and 'rightbottom'.</para> 385 <para>Note that there is no "rightbottom" attribute for the anchors (contrarily to normal controls), because an anchor is not resizable (even when the anchor is not ponctual and follows a Bezier curve).</para> 386 <para>Default value: lefttop</para> 387 </sect4> 382 388 <sect4 id="anchorpriority"> 383 389 <title>priority</title> modules/gui/skins2/commands/cmd_resize.cpp
radc858d r24648f4 25 25 #include "cmd_resize.hpp" 26 26 #include "../src/generic_layout.hpp" 27 #include "../src/window_manager.hpp" 27 28 #include "../src/vlcproc.hpp" 28 29 29 30 30 CmdResize::CmdResize( intf_thread_t *pIntf, GenericLayout &rLayout, int width,31 int height ):32 CmdGeneric( pIntf ), m_r Layout( rLayout ), m_width( width),33 m_ height( height )31 CmdResize::CmdResize( intf_thread_t *pIntf, const WindowManager &rWindowManager, 32 GenericLayout &rLayout, int width, int height ): 33 CmdGeneric( pIntf ), m_rWindowManager( rWindowManager ), 34 m_rLayout( rLayout ), m_width( width ), m_height( height ) 34 35 { 35 36 } … … 39 40 { 40 41 // Resize the layout 41 m_r Layout.resize(m_width, m_height );42 m_rWindowManager.resize( m_rLayout, m_width, m_height ); 42 43 } 43 44 modules/gui/skins2/commands/cmd_resize.hpp
radc858d r24648f4 28 28 #include "cmd_generic.hpp" 29 29 30 class WindowManager; 30 31 class GenericLayout; 31 32 … … 36 37 public: 37 38 /// Resize the given layout 38 CmdResize( intf_thread_t *pIntf, GenericLayout &rLayout, int width,39 int height );39 CmdResize( intf_thread_t *pIntf, const WindowManager &rWindowManager, 40 GenericLayout &rLayout, int width, int height ); 40 41 virtual ~CmdResize() {} 41 42 … … 47 48 48 49 private: 50 const WindowManager &m_rWindowManager; 49 51 GenericLayout &m_rLayout; 50 52 int m_width, m_height; modules/gui/skins2/controls/ctrl_resize.cpp
radc858d r24648f4 34 34 35 35 36 CtrlResize::CtrlResize( intf_thread_t *pIntf, CtrlFlat &rCtrl, 37 GenericLayout &rLayout, const UString &rHelp, 38 VarBool *pVisible, Direction_t direction ): 39 CtrlFlat( pIntf, rHelp, pVisible ), m_fsm( pIntf ), m_rCtrl( rCtrl ), 36 CtrlResize::CtrlResize( intf_thread_t *pIntf, WindowManager &rWindowManager, 37 CtrlFlat &rCtrl, GenericLayout &rLayout, 38 const UString &rHelp, VarBool *pVisible, 39 WindowManager::Direction_t direction ): 40 CtrlFlat( pIntf, rHelp, pVisible ), m_fsm( pIntf ), 41 m_rWindowManager( rWindowManager ), m_rCtrl( rCtrl ), 40 42 m_rLayout( rLayout ), m_direction( direction ), m_cmdOutStill( this ), 41 43 m_cmdStillOut( this ), … … 104 106 105 107 106 void CtrlResize::changeCursor( Direction_t direction ) const108 void CtrlResize::changeCursor( WindowManager::Direction_t direction ) const 107 109 { 108 110 OSFactory *pOsFactory = OSFactory::instance( getIntf() ); 109 if( direction == kResizeSE )111 if( direction == WindowManager::kResizeSE ) 110 112 pOsFactory->changeCursor( OSFactory::kResizeNWSE ); 111 else if( direction == kResizeS )113 else if( direction == WindowManager::kResizeS ) 112 114 pOsFactory->changeCursor( OSFactory::kResizeNS ); 113 else if( direction == kResizeE )115 else if( direction == WindowManager::kResizeE ) 114 116 pOsFactory->changeCursor( OSFactory::kResizeWE ); 115 else if( direction == kNone )117 else if( direction == WindowManager::kNone ) 116 118 pOsFactory->changeCursor( OSFactory::kDefaultArrow ); 117 119 } … … 126 128 void CtrlResize::CmdStillOut::execute() 127 129 { 128 m_pParent->changeCursor( kNone );130 m_pParent->changeCursor( WindowManager::kNone ); 129 131 } 130 132 … … 150 152 m_pParent->m_width = m_pParent->m_rLayout.getWidth(); 151 153 m_pParent->m_height = m_pParent->m_rLayout.getHeight(); 154 155 m_pParent->m_rWindowManager.startResize( m_pParent->m_rLayout, 156 m_pParent->m_direction); 152 157 } 153 158 … … 159 164 160 165 m_pParent->releaseMouse(); 166 167 m_pParent->m_rWindowManager.stopResize(); 161 168 } 162 169 … … 170 177 171 178 int newWidth = m_pParent->m_width; 179 newWidth += pEvtMotion->getXPos() - m_pParent->m_xPos; 172 180 int newHeight = m_pParent->m_height; 173 if( m_pParent->m_direction != kResizeS ) 174 newWidth += pEvtMotion->getXPos() - m_pParent->m_xPos; 175 if( m_pParent->m_direction != kResizeE ) 176 newHeight += pEvtMotion->getYPos() - m_pParent->m_yPos; 181 newHeight += pEvtMotion->getYPos() - m_pParent->m_yPos; 177 182 178 // Create a resize command 183 // Create a resize command, instead of calling the window manager directly. 184 // Thanks to this trick, the duplicate resizing commands will be trashed 185 // in the asynchronous queue, thus making resizing faster 179 186 CmdGeneric *pCmd = new CmdResize( m_pParent->getIntf(), 187 m_pParent->m_rWindowManager, 180 188 m_pParent->m_rLayout, 181 189 newWidth, newHeight ); 182 190 // Push the command in the asynchronous command queue 183 AsyncQueue *pQueue = AsyncQueue::instance( m_pParent->getIntf() );191 AsyncQueue *pQueue = AsyncQueue::instance( getIntf() ); 184 192 pQueue->push( CmdGenericPtr( pCmd ) ); 185 193 } modules/gui/skins2/controls/ctrl_resize.hpp
radc858d r24648f4 28 28 #include "ctrl_flat.hpp" 29 29 #include "../commands/cmd_generic.hpp" 30 #include "../src/window_manager.hpp" 30 31 #include "../utils/fsm.hpp" 32 33 class WindowManager; 31 34 32 35 … … 35 38 { 36 39 public: 37 enum Direction_t 38 { 39 kResizeE, // East 40 kResizeSE, // South-East 41 kResizeS, // South 42 kNone // Reserved for internal use 43 }; 44 45 CtrlResize( intf_thread_t *pIntf, CtrlFlat &rCtrl, 46 GenericLayout &rLayout, const UString &rHelp, 47 VarBool *pVisible, Direction_t direction ); 40 CtrlResize( intf_thread_t *pIntf, WindowManager &rWindowManager, 41 CtrlFlat &rCtrl, GenericLayout &rLayout, 42 const UString &rHelp, VarBool *pVisible, 43 WindowManager::Direction_t direction ); 48 44 virtual ~CtrlResize() {} 49 45 … … 69 65 private: 70 66 FSM m_fsm; 67 /// Window manager 68 WindowManager &m_rWindowManager; 71 69 /// Decorated CtrlFlat 72 70 CtrlFlat &m_rCtrl; … … 78 76 int m_xPos, m_yPos; 79 77 /// Direction of the resizing 80 Direction_t m_direction;78 WindowManager::Direction_t m_direction; 81 79 82 80 /// Change the cursor, based on the given direction 83 void changeCursor( Direction_t direction ) const;81 void changeCursor( WindowManager::Direction_t direction ) const; 84 82 85 83 /// Callback objects modules/gui/skins2/controls/ctrl_video.cpp
r91e5a90 r24648f4 27 27 #include "../src/os_graphics.hpp" 28 28 #include "../src/vlcproc.hpp" 29 #include "../src/window_manager.hpp" 29 30 #include "../commands/async_queue.hpp" 30 31 #include "../commands/cmd_resize.hpp" … … 107 108 108 109 // Create a resize command 109 CmdGeneric *pCmd = new CmdResize( getIntf(), m_rLayout, newWidth, 110 newHeight ); 110 // FIXME: this way of getting the window manager kind of sucks 111 WindowManager &rWindowManager = 112 getIntf()->p_sys->p_theme->getWindowManager(); 113 rWindowManager.startResize( m_rLayout, WindowManager::kResizeSE ); 114 CmdGeneric *pCmd = new CmdResize( getIntf(), rWindowManager, 115 m_rLayout, newWidth, newHeight ); 111 116 // Push the command in the asynchronous command queue 112 117 AsyncQueue *pQueue = AsyncQueue::instance( getIntf() ); 113 118 pQueue->push( CmdGenericPtr( pCmd ) ); 119 120 // FIXME: this should be a command too 121 rWindowManager.stopResize(); 114 122 } 115 123 modules/gui/skins2/parser/builder.cpp
r1aff501 r24648f4 39 39 #include "../src/popup.hpp" 40 40 #include "../src/theme.hpp" 41 #include "../src/window_manager.hpp" 41 42 #include "../commands/cmd_generic.hpp" 42 43 #include "../controls/ctrl_button.hpp" … … 378 379 m_pTheme->m_curves.push_back( BezierPtr( pCurve ) ); 379 380 380 Anchor *pAnc = new Anchor( getIntf(), rData.m_xPos, rData.m_yPos, 381 rData.m_range, rData.m_priority, 381 // Compute the position of the anchor 382 const Position pos = makePosition( rData.m_leftTop, rData.m_leftTop, 383 rData.m_xPos, rData.m_yPos, 384 pCurve->getWidth(), 385 pCurve->getHeight(), *pLayout ); 386 387 Anchor *pAnc = new Anchor( getIntf(), pos, rData.m_range, rData.m_priority, 382 388 *pCurve, *pLayout ); 383 389 pLayout->addAnchor( pAnc ); … … 560 566 else if( rData.m_actionId == "resizeS" ) 561 567 { 562 CtrlResize *pResize = new CtrlResize( getIntf(), *pImage, *pLayout, 568 CtrlResize *pResize = new CtrlResize( getIntf(), 569 m_pTheme->getWindowManager(), *pImage, *pLayout, 563 570 UString( getIntf(), rData.m_help.c_str() ), pVisible, 564 CtrlResize::kResizeS );571 WindowManager::kResizeS ); 565 572 pLayout->addControl( pResize, pos, rData.m_layer ); 566 573 } 567 574 else if( rData.m_actionId == "resizeE" ) 568 575 { 569 CtrlResize *pResize = new CtrlResize( getIntf(), *pImage, *pLayout, 576 CtrlResize *pResize = new CtrlResize( getIntf(), 577 m_pTheme->getWindowManager(), *pImage, *pLayout, 570 578 UString( getIntf(), rData.m_help.c_str() ), pVisible, 571 CtrlResize::kResizeE );579 WindowManager::kResizeE ); 572 580 pLayout->addControl( pResize, pos, rData.m_layer ); 573 581 } 574 582 else if( rData.m_actionId == "resizeSE" ) 575 583 { 576 CtrlResize *pResize = new CtrlResize( getIntf(), *pImage, *pLayout, 584 CtrlResize *pResize = new CtrlResize( getIntf(), 585 m_pTheme->getWindowManager(), *pImage, *pLayout, 577 586 UString( getIntf(), rData.m_help.c_str() ), pVisible, 578 CtrlResize::kResizeSE );587 WindowManager::kResizeSE ); 579 588 pLayout->addControl( pResize, pos, rData.m_layer ); 580 589 } modules/gui/skins2/parser/builder_data.def
ra5a9346 r24648f4 9 9 Window id:string xPos:int yPos:int visible:bool dragDrop:bool playOnDrop:bool 10 10 Layout id:string width:int height:int minWidth:int maxWidth:int minHeight:int maxHeight:int windowId:string 11 Anchor xPos:int yPos:int range:int priority:int points:string layoutId:string11 Anchor xPos:int yPos:int leftTop:string range:int priority:int points:string layoutId:string 12 12 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 13 13 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 modules/gui/skins2/parser/builder_data.hpp
ra5a9346 r24648f4 187 187 struct Anchor 188 188 { 189 Anchor( int xPos, int yPos, int range, int priority, const string & points, const string & layoutId ): 190 m_xPos( xPos ), m_yPos( yPos ), m_range( range ), m_priority( priority ), m_points( points ), m_layoutId( layoutId ) {} 191 192 int m_xPos; 193 int m_yPos; 189 Anchor( int xPos, int yPos, const string & leftTop, int range, int priority, const string & points, const string & layoutId ): 190 m_xPos( xPos ), m_yPos( yPos ), m_leftTop( leftTop ), m_range( range ), m_priority( priority ), m_points( points ), m_layoutId( layoutId ) {} 191 192 int m_xPos; 193 int m_yPos; 194 string m_leftTop; 194 195 int m_range; 195 196 int m_priority; modules/gui/skins2/parser/skin_parser.cpp
r2a4da6a r24648f4 89 89 CheckDefault( "x", "0" ); 90 90 CheckDefault( "y", "0" ); 91 CheckDefault( "lefttop", "lefttop" ); 91 92 CheckDefault( "points", "(0,0)" ); 92 93 CheckDefault( "range", "10" ); 93 94 94 95 const BuilderData::Anchor anchor( atoi( attr["x"] ) + m_xOffset, 95 atoi( attr["y"] ) + m_yOffset, atoi( attr["range"] ), 96 atoi( attr["priority"] ), attr["points"], m_curLayoutId ); 96 atoi( attr["y"] ) + m_yOffset, attr["lefttop"], 97 atoi( attr["range"] ), atoi( attr["priority"] ), 98 attr["points"], m_curLayoutId ); 97 99 m_pData->m_listAnchor.push_back( anchor ); 98 100 } modules/gui/skins2/src/anchor.hpp
radc858d r24648f4 29 29 #include "generic_layout.hpp" 30 30 #include "../utils/bezier.hpp" 31 #include "../utils/position.hpp" 31 32 32 33 … … 35 36 { 36 37 public: 37 Anchor( intf_thread_t *pIntf, int xPos, int yPos, int range,38 Anchor( intf_thread_t *pIntf, const Position &rPosition, int range, 38 39 int priority, const Bezier &rCurve, GenericLayout &rLayout ): 39 SkinObject( pIntf ), m_ xPos( xPos ), m_yPos( yPos),40 SkinObject( pIntf ), m_position( rPosition ), 40 41 m_rCurve( rCurve ), m_range( range ), m_priority( priority ), 41 42 m_rLayout( rLayout ) {} 42 43 virtual ~Anchor() {} 43 44 44 /// Return true if the given anchor is hanged by this one 45 /// Two conditions are required: 46 /// - the other anchor must be in position of anchoring (as defined 47 /// by canHang()) 48 /// - the priority of the other anchor must be lower than this one's 45 /** 46 * Return true if the given anchor is hanged by this one 47 * Two conditions are required: 48 * - the other anchor must be in position of anchoring (as defined 49 * by canHang()) 50 * - the priority of the other anchor must be lower than this one's 51 */ 49 52 bool isHanging( const Anchor &rOther ) const; 50 53 51 /// Return true if the other anchor, moved by the (xOffset, yOffset) 52 /// vector, is "hangable" by this one (i.e. if it is in its range of 53 /// action), else return false. 54 /// When the function returns true, the xOffset and yOffset parameters 55 /// are modified to indicate the position that the other anchor would 56 /// take if hanged by this one (this position is calculated to minimize 57 /// the difference with the old xOffset and yOffset, so that the window 58 /// doesn't "jump" in a strange way). 54 /** 55 * Return true if the other anchor, moved by the (xOffset, yOffset) 56 * vector, is "hangable" by this one (i.e. if it is in its range of 57 * action), else return false. 58 * When the function returns true, the xOffset and yOffset parameters 59 * are modified to indicate the position that the other anchor would 60 * take if hanged by this one (this position is calculated to minimize 61 * the difference with the old xOffset and yOffset, so that the window 62 * doesn't "jump" in a strange way). 63 */ 59 64 bool canHang( const Anchor &rOther, int &xOffset, int &yOffset ) const; 60 65 … … 63 68 64 69 // Getters 65 int getXPosAbs() const { return (m_xPos + m_rLayout.getLeft()); } 66 int getYPosAbs() const { return (m_yPos + m_rLayout.getTop()); } 70 const Position & getPosition() const { return m_position; } 71 72 int getXPosAbs() const 73 { 74 return (m_position.getLeft() + m_rLayout.getLeft()); 75 } 76 77 int getYPosAbs() const 78 { 79 return (m_position.getTop() + m_rLayout.getTop()); 80 } 67 81 68 82 private: 69 /// Coordinates relative to the window70 int m_xPos, m_yPos;83 /// Position in the layout 84 Position m_position; 71 85 72 86 /// Curve of the anchor … … 79 93 int m_priority; 80 94 81 /// Parent window95 /// Parent layout 82 96 GenericLayout &m_rLayout; 83 97 }; modules/gui/skins2/src/generic_layout.cpp
r28bd3a4 r24648f4 159 159 void GenericLayout::resize( int width, int height ) 160 160 { 161 // Check boundaries162 if( width < m_minWidth )163 {164 width = m_minWidth;165 }166 if( width > m_maxWidth )167 {168 width = m_maxWidth;169 }170 if( height < m_minHeight )171 {172 height = m_minHeight;173 }174 if( height > m_maxHeight )175 {176 height = m_maxHeight;177 }178 179 if( width == m_width && height == m_height )180 {181 return;182 }183 184 161 // Update the window size 185 162 m_width = width; modules/gui/skins2/src/window_manager.cpp
rfb9fadd r24648f4 29 29 #include "anchor.hpp" 30 30 #include "tooltip.hpp" 31 #include "var_manager.hpp" 31 32 #include "../utils/position.hpp" 32 #include "../src/var_manager.hpp"33 33 34 34 35 35 WindowManager::WindowManager( intf_thread_t *pIntf ): 36 SkinObject( pIntf ), m_magnet( 0 ), m_pTooltip( NULL ), m_pPopup( NULL ) 36 SkinObject( pIntf ), m_magnet( 0 ), m_direction( kNone ), 37 m_pTooltip( NULL ), m_pPopup( NULL ) 37 38 { 38 39 // Create and register a variable for the "on top" status … … 171 172 172 173 174 void WindowManager::startResize( GenericLayout &rLayout, Direction_t direction ) 175 { 176 m_direction = direction; 177 178 // Rebuild the set of moving windows. 179 // From the resized window, we only take into account the anchors which 180 // are mobile with the current type of resizing, and that are hanging a 181 // window. The hanged windows will come will all their dependencies. 182 183 m_resizeMovingE.clear(); 184 m_resizeMovingS.clear(); 185 m_resizeMovingSE.clear(); 186 187 WinSet_t::const_iterator itWin; 188 AncList_t::const_iterator itAnc1, itAnc2; 189 // Get the anchors of the layout 190 const AncList_t &ancList1 = rLayout.getAnchorList(); 191 192 // Iterate through all the hanged windows 193 for( itWin = m_dependencies[rLayout.getWindow()].begin(); 194 itWin != m_dependencies[rLayout.getWindow()].end(); itWin++ ) 195 { 196 // Now, check for anchoring between the 2 windows 197 const AncList_t &ancList2 = 198 (*itWin)->getActiveLayout().getAnchorList(); 199 for( itAnc1 = ancList1.begin(); itAnc1 != ancList1.end(); itAnc1++ ) 200 { 201 for( itAnc2 = ancList2.begin(); 202 itAnc2 != ancList2.end(); itAnc2++ ) 203 { 204 if( (*itAnc1)->isHanging( **itAnc2 ) ) 205 { 206 // Add the dependencies of the hanged window to one of the 207 // lists of moving windows 208 Position::Ref_t aRefPos = 209 (*itAnc1)->getPosition().getRefLeftTop(); 210 if( aRefPos == Position::kRightTop ) 211 buildDependSet( m_resizeMovingE, *itWin ); 212 else if( aRefPos == Position::kLeftBottom ) 213 buildDependSet( m_resizeMovingS, *itWin ); 214 else if( aRefPos == Position::kRightBottom ) 215 buildDependSet( m_resizeMovingSE, *itWin ); 216 break; 217 } 218 } 219 } 220 } 221 222 // The checkAnchors() method will need to have m_movingWindows properly set 223 // so let's insert in it the contents of the other sets 224 m_movingWindows.clear(); 225 m_movingWindows.insert( rLayout.getWindow() ); 226 m_movingWindows.insert( m_resizeMovingE.begin(), m_resizeMovingE.end() ); 227 m_movingWindows.insert( m_resizeMovingS.begin(), m_resizeMovingS.end() ); 228 m_movingWindows.insert( m_resizeMovingSE.begin(), m_resizeMovingSE.end() ); 229 } 230 231 232 void WindowManager::stopResize() 233 { 234 // Nothing different from stopMove(), luckily 235 stopMove(); 236 } 237 238 239 void WindowManager::resize( GenericLayout &rLayout, 240 int width, int height ) const 241 { 242 // TODO: handle anchored windows 243 // Compute the real resizing offset 244 int xOffset = width - rLayout.getWidth(); 245 int yOffset = height - rLayout.getHeight(); 246 247 // Check anchoring; this can change the values of xOffset and yOffset 248 checkAnchors( rLayout.getWindow(), xOffset, yOffset ); 249 if( m_direction == kResizeS ) 250 xOffset = 0; 251 if( m_direction == kResizeE ) 252 yOffset = 0; 253 254 int newWidth = rLayout.getWidth() + xOffset; 255 int newHeight = rLayout.getHeight() + yOffset; 256 257 // Check boundaries 258 if( newWidth < rLayout.getMinWidth() ) 259 { 260 newWidth = rLayout.getMinWidth(); 261 } 262 if( newWidth > rLayout.getMaxWidth() ) 263 { 264 newWidth = rLayout.getMaxWidth(); 265 } 266 if( newHeight < rLayout.getMinHeight() ) 267 { 268 newHeight = rLayout.getMinHeight(); 269 } 270 if( newHeight > rLayout.getMaxHeight() ) 271 { 272 newHeight = rLayout.getMaxHeight(); 273 } 274 275 if( newWidth == rLayout.getWidth() && newHeight == rLayout.getHeight() ) 276 { 277 return; 278 } 279 280 // New offset, after the last corrections 281 int xNewOffset = newWidth - rLayout.getWidth(); 282 int yNewOffset = newHeight - rLayout.getHeight(); 283 284 // Do the actual resizing 285 rLayout.resize( newWidth, newHeight ); 286 287 // Move all the anchored windows 288 WinSet_t::const_iterator it; 289 if( m_direction == kResizeE || 290 m_direction == kResizeSE ) 291 { 292 for( it = m_resizeMovingE.begin(); it != m_resizeMovingE.end(); it++ ) 293 { 294 (*it)->move( (*it)->getLeft() + xNewOffset, 295 (*it)->getTop() ); 296 } 297 } 298 if( m_direction == kResizeE || 299 m_direction == kResizeSE ) 300 { 301 for( it = m_resizeMovingS.begin(); it != m_resizeMovingS.end(); it++ ) 302 { 303 (*it)->move( (*it)->getLeft(), 304 (*it)->getTop( )+ yNewOffset ); 305 } 306 } 307 if( m_direction == kResizeE || 308 m_direction == kResizeS || 309 m_direction == kResizeSE ) 310 { 311 for( it = m_resizeMovingSE.begin(); it != m_resizeMovingSE.end(); it++ ) 312 { 313 (*it)->move( (*it)->getLeft() + xNewOffset, 314 (*it)->getTop() + yNewOffset ); 315 } 316 } 317 } 318 319 173 320 void WindowManager::synchVisibility() const 174 321 { … … 204 351 // When the theme is opened for the first time, 205 352 // only show the window if set as visible in the XML 206 if ((*it)->isVisible() || !firstTime)353 if( (*it)->isVisible() || !firstTime ) 207 354 { 208 355 (*it)->show(); … … 382 529 else 383 530 { 384 msg_Warn( getIntf(), "tooltip already created!" );531 msg_Warn( getIntf(), "tooltip already created!" ); 385 532 } 386 533 } modules/gui/skins2/src/window_manager.hpp
radc858d r24648f4 45 45 { 46 46 public: 47 /// Direction of the resizing 48 enum Direction_t 49 { 50 kResizeE, // East 51 kResizeSE, // South-East 52 kResizeS, // South 53 kNone // Reserved for internal use 54 }; 55 47 56 /// Constructor 48 57 WindowManager( intf_thread_t *pIntf); … … 58 67 void unregisterWindow( TopWindow &rWindow ); 59 68 60 /// Tell the window manager that a move is initiated for pWindow.69 /// Tell the window manager that a move is initiated for rWindow 61 70 void startMove( TopWindow &rWindow ); 62 71 63 /// Tell the window manager that the current move ended .72 /// Tell the window manager that the current move ended 64 73 void stopMove(); 65 74 66 /// Move the pWindow window to (left, top), and move all its 67 /// anchored windows. 68 /// If a new anchoring is detected, the windows will move accordingly. 75 /** 76 * Move the rWindow window to (left, top), and move all its 77 * anchored windows. 78 * If a new anchoring is detected, the windows will move accordingly. 79 */ 69 80 void move( TopWindow &rWindow, int left, int top ) const; 81 82 /// Tell the window manager that a resize is initiated for rWindow 83 void startResize( GenericLayout &rLayout, Direction_t direction ); 84 85 /// Tell the window manager that the current resizing ended 86 void stopResize(); 87 88 /** 89 * Resize the rWindow window to (width, height), and move all its 90 * anchored windows, if some anchors are moved during the resizing. 91 * If a new anchoring is detected, the windows will move (or resize) 92 * accordingly. 93 */ 94 void resize( GenericLayout &rLayout, int width, int height ) const; 70 95 71 96 /// Raise all the registered windows … … 73 98 74 99 /// Show all the registered windows 75 void showAll( bool firstTime = false) const;100 void showAll( bool firstTime = false ) const; 76 101 77 102 /// Hide all the registered windows … … 143 168 /// move. 144 169 WinSet_t m_movingWindows; 170 /** 171 * Store the moving windows in the context of resizing 172 * These sets are updated at every start of move 173 */ 174 //@{ 175 WinSet_t m_resizeMovingE; 176 WinSet_t m_resizeMovingS; 177 WinSet_t m_resizeMovingSE; 178 //@} 145 179 /// Indicate whether the windows are currently on top 146 180 VariablePtr m_cVarOnTop; … … 151 185 /// Alpha value of the moving windows 152 186 int m_moveAlpha; 187 /// Direction of the current resizing 188 Direction_t m_direction; 153 189 /// Tooltip 154 190 Tooltip *m_pTooltip; modules/gui/skins2/utils/position.hpp
radc858d r24648f4 96 96 int getWidth() const; 97 97 int getHeight() const; 98 /// Get the reference corners 99 Ref_t getRefLeftTop() const { return m_refLeftTop; } 100 Ref_t getRefRightBottom() const { return m_refRighBottom; } 98 101 99 102 private: share/skins2/skin.dtd
ra5a9346 r24648f4 100 100 x CDATA "0" 101 101 y CDATA "0" 102 lefttop CDATA "lefttop" 102 103 priority CDATA #REQUIRED 103 104 points CDATA "(0,0)"
