mirror of
https://code.videolan.org/videolan/vlc
synced 2024-10-07 03:56:28 +02:00
* ./modules/gui/skins/src/theme.cpp: fixed a bug with anchored windows
This commit is contained in:
parent
171966e294
commit
cb0828bde8
@ -2,7 +2,7 @@
|
||||
* anchor.cpp: Anchor class
|
||||
*****************************************************************************
|
||||
* 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>
|
||||
* Emmanuel Puig <karibu@via.ecp.fr>
|
||||
@ -39,9 +39,9 @@
|
||||
// Anchors
|
||||
//---------------------------------------------------------------------------
|
||||
Anchor::Anchor( intf_thread_t *_p_intf, int x, int y, int len, int priority,
|
||||
SkinWindow *parent )
|
||||
SkinWindow *parent )
|
||||
{
|
||||
p_intf = _p_intf;
|
||||
p_intf = _p_intf;
|
||||
Parent = parent;
|
||||
Left = x;
|
||||
Top = y;
|
||||
@ -55,7 +55,7 @@ bool Anchor::IsInList( Anchor *anc )
|
||||
list<Anchor *>::const_iterator elt;
|
||||
|
||||
// Iterate through list
|
||||
for( elt = HangList.begin(); elt != HangList.end(); elt++)
|
||||
for( elt = HangList.begin(); elt != HangList.end(); elt++ )
|
||||
{
|
||||
if( (*elt) == anc )
|
||||
return true;
|
||||
@ -80,16 +80,11 @@ bool Anchor::Hang( Anchor *anc, int mx, int my )
|
||||
int x, y, px, py;
|
||||
Parent->GetPos( px, py );
|
||||
anc->GetPos( x, y );
|
||||
x += mx - px;
|
||||
y += my - py;
|
||||
x += mx - px - Left;
|
||||
y += my - py - Top;
|
||||
|
||||
// Len of 0 is equal to unactivate anchor
|
||||
if( Len > 0 && sqrt( (Left-x)*(Left-x) + (Top-y)*(Top-y) ) <= Len )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
return( Len > 0 && sqrt( x*x + y*y ) <= Len );
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void Anchor::GetPos( int &x, int &y )
|
||||
|
@ -2,7 +2,7 @@
|
||||
* theme.cpp: Theme class
|
||||
*****************************************************************************
|
||||
* 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 Teulière <ipkiss@via.ecp.fr>
|
||||
* Emmanuel Puig <karibu@via.ecp.fr>
|
||||
@ -242,7 +242,7 @@ void Theme::MoveSkin( SkinWindow *wnd, int left, int top )
|
||||
for( anc = wnd->AnchorList.begin(); anc != wnd->AnchorList.end(); anc++ )
|
||||
{
|
||||
for( hang = (*anc)->HangList.begin(); hang != (*anc)->HangList.end();
|
||||
hang++ )
|
||||
hang++ )
|
||||
{
|
||||
win = (*hang)->GetParent();
|
||||
win->GetPos( x, y );
|
||||
@ -339,16 +339,16 @@ void Theme::HangToAnchors( SkinWindow *wnd, int &x, int &y, bool init )
|
||||
{
|
||||
// Parent anchor is win and child is wnd !!!
|
||||
|
||||
|
||||
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) ) )
|
||||
(*win_anchor)->Remove( (*wnd_anchor) );
|
||||
}
|
||||
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) ) )
|
||||
{
|
||||
(*win_anchor)->Add( (*wnd_anchor) );
|
||||
@ -368,13 +368,16 @@ void Theme::HangToAnchors( SkinWindow *wnd, int &x, int &y, bool init )
|
||||
}
|
||||
else if( (*win_anchor)->Hang( (*wnd_anchor), x, y ) )
|
||||
{
|
||||
// Move window to stick anchor
|
||||
(*wnd_anchor)->GetPos( wnd_anchor_x, wnd_anchor_y );
|
||||
(*win_anchor)->GetPos( win_anchor_x, win_anchor_y );
|
||||
(*win)->GetPos( win_x, win_y );
|
||||
if( !(*wnd_anchor)->IsInList( *win_anchor ) )
|
||||
{
|
||||
// Move window to stick anchor
|
||||
(*wnd_anchor)->GetPos( wnd_anchor_x, wnd_anchor_y );
|
||||
(*win_anchor)->GetPos( win_anchor_x, win_anchor_y );
|
||||
(*win)->GetPos( win_x, win_y );
|
||||
|
||||
x = win_x + win_anchor_x - wnd_anchor_x;
|
||||
y = win_y + win_anchor_y - wnd_anchor_y;
|
||||
x = win_x + win_anchor_x - wnd_anchor_x;
|
||||
y = win_y + win_anchor_y - wnd_anchor_y;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user