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

* ./modules/gui/skins/src/theme.cpp: fixed a bug with anchored windows

parent 171966e2
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* anchor.cpp: Anchor class * anchor.cpp: Anchor class
***************************************************************************** *****************************************************************************
* Copyright (C) 2003 VideoLAN * Copyright (C) 2003 VideoLAN
* $Id: anchor.cpp,v 1.2 2003/04/21 21:51:16 asmax Exp $ * $Id: anchor.cpp,v 1.3 2003/04/22 22:57:40 ipkiss Exp $
* *
* Authors: Olivier Teulière <ipkiss@via.ecp.fr> * Authors: Olivier Teulière <ipkiss@via.ecp.fr>
* Emmanuel Puig <karibu@via.ecp.fr> * Emmanuel Puig <karibu@via.ecp.fr>
...@@ -55,7 +55,7 @@ bool Anchor::IsInList( Anchor *anc ) ...@@ -55,7 +55,7 @@ bool Anchor::IsInList( Anchor *anc )
list<Anchor *>::const_iterator elt; list<Anchor *>::const_iterator elt;
// Iterate through list // Iterate through list
for( elt = HangList.begin(); elt != HangList.end(); elt++) for( elt = HangList.begin(); elt != HangList.end(); elt++ )
{ {
if( (*elt) == anc ) if( (*elt) == anc )
return true; return true;
...@@ -80,16 +80,11 @@ bool Anchor::Hang( Anchor *anc, int mx, int my ) ...@@ -80,16 +80,11 @@ bool Anchor::Hang( Anchor *anc, int mx, int my )
int x, y, px, py; int x, y, px, py;
Parent->GetPos( px, py ); Parent->GetPos( px, py );
anc->GetPos( x, y ); anc->GetPos( x, y );
x += mx - px; x += mx - px - Left;
y += my - py; y += my - py - Top;
// Len of 0 is equal to unactivate anchor // Len of 0 is equal to unactivate anchor
if( Len > 0 && sqrt( (Left-x)*(Left-x) + (Top-y)*(Top-y) ) <= Len ) return( Len > 0 && sqrt( x*x + y*y ) <= Len );
{
return true;
}
return false;
} }
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
void Anchor::GetPos( int &x, int &y ) void Anchor::GetPos( int &x, int &y )
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* theme.cpp: Theme class * theme.cpp: Theme class
***************************************************************************** *****************************************************************************
* Copyright (C) 2003 VideoLAN * Copyright (C) 2003 VideoLAN
* $Id: theme.cpp,v 1.11 2003/04/21 21:51:16 asmax Exp $ * $Id: theme.cpp,v 1.12 2003/04/22 22:57:40 ipkiss Exp $
* *
* Authors: Olivier Teulire <ipkiss@via.ecp.fr> * Authors: Olivier Teulire <ipkiss@via.ecp.fr>
* Emmanuel Puig <karibu@via.ecp.fr> * Emmanuel Puig <karibu@via.ecp.fr>
...@@ -339,16 +339,16 @@ void Theme::HangToAnchors( SkinWindow *wnd, int &x, int &y, bool init ) ...@@ -339,16 +339,16 @@ void Theme::HangToAnchors( SkinWindow *wnd, int &x, int &y, bool init )
{ {
// Parent anchor is win and child is wnd !!! // Parent anchor is win and child is wnd !!!
if( !(*win_anchor)->Hang( (*wnd_anchor), x, y ) ) if( !(*win_anchor)->Hang( (*wnd_anchor), x, y ) )
{ {
// If child is in parent list and parent doesn't hang ch // If child is in parent list and parent doesn't hang
// child
if( (*win_anchor)->IsInList( (*wnd_anchor) ) ) if( (*win_anchor)->IsInList( (*wnd_anchor) ) )
(*win_anchor)->Remove( (*wnd_anchor) ); (*win_anchor)->Remove( (*wnd_anchor) );
} }
else else
{ {
// If parent hang child and child is not still in list // If parent hangs child and child is not yet in list
if( !(*win_anchor)->IsInList( (*wnd_anchor) ) ) if( !(*win_anchor)->IsInList( (*wnd_anchor) ) )
{ {
(*win_anchor)->Add( (*wnd_anchor) ); (*win_anchor)->Add( (*wnd_anchor) );
...@@ -367,6 +367,8 @@ void Theme::HangToAnchors( SkinWindow *wnd, int &x, int &y, bool init ) ...@@ -367,6 +367,8 @@ void Theme::HangToAnchors( SkinWindow *wnd, int &x, int &y, bool init )
} }
else if( (*win_anchor)->Hang( (*wnd_anchor), x, y ) ) else if( (*win_anchor)->Hang( (*wnd_anchor), x, y ) )
{
if( !(*wnd_anchor)->IsInList( *win_anchor ) )
{ {
// Move window to stick anchor // Move window to stick anchor
(*wnd_anchor)->GetPos( wnd_anchor_x, wnd_anchor_y ); (*wnd_anchor)->GetPos( wnd_anchor_x, wnd_anchor_y );
...@@ -375,6 +377,7 @@ void Theme::HangToAnchors( SkinWindow *wnd, int &x, int &y, bool init ) ...@@ -375,6 +377,7 @@ void Theme::HangToAnchors( SkinWindow *wnd, int &x, int &y, bool init )
x = win_x + win_anchor_x - wnd_anchor_x; x = win_x + win_anchor_x - wnd_anchor_x;
y = win_y + win_anchor_y - wnd_anchor_y; y = win_y + win_anchor_y - wnd_anchor_y;
}
break; break;
} }
......
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