Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Steve Lhomme
VLC
Commits
cb0828bd
Commit
cb0828bd
authored
Apr 22, 2003
by
ipkiss
Browse files
* ./modules/gui/skins/src/theme.cpp: fixed a bug with anchored windows
parent
171966e2
Changes
2
Hide whitespace changes
Inline
Side-by-side
modules/gui/skins/src/anchor.cpp
View file @
cb0828bd
...
...
@@ -2,7 +2,7 @@
* anchor.cpp: Anchor class
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: anchor.cpp,v 1.
2
2003/04/2
1
2
1
:5
1:16 asmax
Exp $
* $Id: anchor.cpp,v 1.
3
2003/04/2
2
2
2
:5
7: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
)
...
...
modules/gui/skins/src/theme.cpp
View file @
cb0828bd
...
...
@@ -2,7 +2,7 @@
* theme.cpp: Theme class
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: theme.cpp,v 1.1
1
2003/04/2
1
2
1
:5
1:16 asmax
Exp $
* $Id: theme.cpp,v 1.1
2
2003/04/2
2
2
2
:5
7:40 ipkiss
Exp $
*
* Authors: Olivier Teulire <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 hang
s
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
;
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment