Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-1.1
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc-1.1
Commits
b26eed49
Commit
b26eed49
authored
Feb 11, 2006
by
Clément Stenac
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Reposition the slider when expanding/retracting a node (Closes:#477)
parent
0236ff18
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
35 additions
and
3 deletions
+35
-3
modules/gui/skins2/controls/ctrl_tree.cpp
modules/gui/skins2/controls/ctrl_tree.cpp
+32
-3
modules/gui/skins2/controls/ctrl_tree.hpp
modules/gui/skins2/controls/ctrl_tree.hpp
+3
-0
No files found.
modules/gui/skins2/controls/ctrl_tree.cpp
View file @
b26eed49
...
@@ -61,7 +61,7 @@ CtrlTree::CtrlTree( intf_thread_t *pIntf,
...
@@ -61,7 +61,7 @@ CtrlTree::CtrlTree( intf_thread_t *pIntf,
m_pOpenBitmap
(
pOpenBitmap
),
m_pClosedBitmap
(
pClosedBitmap
),
m_pOpenBitmap
(
pOpenBitmap
),
m_pClosedBitmap
(
pClosedBitmap
),
m_fgColor
(
fgColor
),
m_playColor
(
playColor
),
m_bgColor1
(
bgColor1
),
m_fgColor
(
fgColor
),
m_playColor
(
playColor
),
m_bgColor1
(
bgColor1
),
m_bgColor2
(
bgColor2
),
m_selColor
(
selColor
),
m_bgColor2
(
bgColor2
),
m_selColor
(
selColor
),
m_pLastSelected
(
NULL
),
m_pImage
(
NULL
)
m_pLastSelected
(
NULL
),
m_pImage
(
NULL
)
,
m_dontMove
(
false
)
{
{
// Observe the tree and position variables
// Observe the tree and position variables
m_rTree
.
addObserver
(
this
);
m_rTree
.
addObserver
(
this
);
...
@@ -164,6 +164,8 @@ void CtrlTree::onUpdate( Subject<VarPercent, void*> &rPercent, void* arg)
...
@@ -164,6 +164,8 @@ void CtrlTree::onUpdate( Subject<VarPercent, void*> &rPercent, void* arg)
// Determine what is the first item to display
// Determine what is the first item to display
VarTree
::
Iterator
it
=
m_rTree
.
begin
();
VarTree
::
Iterator
it
=
m_rTree
.
begin
();
if
(
m_dontMove
)
return
;
int
excessItems
=
m_rTree
.
visibleItems
()
-
maxItems
();
int
excessItems
=
m_rTree
.
visibleItems
()
-
maxItems
();
if
(
excessItems
>
0
)
if
(
excessItems
>
0
)
...
@@ -214,6 +216,7 @@ void CtrlTree::onPositionChange()
...
@@ -214,6 +216,7 @@ void CtrlTree::onPositionChange()
void
CtrlTree
::
handleEvent
(
EvtGeneric
&
rEvent
)
void
CtrlTree
::
handleEvent
(
EvtGeneric
&
rEvent
)
{
{
bool
bChangedPosition
=
false
;
VarTree
::
Iterator
toShow
;
bool
needShow
=
false
;
VarTree
::
Iterator
toShow
;
bool
needShow
=
false
;
if
(
rEvent
.
getAsString
().
find
(
"key:down"
)
!=
string
::
npos
)
if
(
rEvent
.
getAsString
().
find
(
"key:down"
)
!=
string
::
npos
)
{
{
...
@@ -229,7 +232,7 @@ void CtrlTree::handleEvent( EvtGeneric &rEvent )
...
@@ -229,7 +232,7 @@ void CtrlTree::handleEvent( EvtGeneric &rEvent )
else
if
(
key
==
KEY_PAGEDOWN
)
else
if
(
key
==
KEY_PAGEDOWN
)
{
{
it
=
m_firstPos
;
it
=
m_firstPos
;
int
i
=
maxItems
()
*
1.5
;
int
i
=
(
int
)(
maxItems
()
*
1.5
)
;
while
(
i
>=
0
)
while
(
i
>=
0
)
{
{
VarTree
::
Iterator
it_old
=
it
;
VarTree
::
Iterator
it_old
=
it
;
...
@@ -333,6 +336,7 @@ void CtrlTree::handleEvent( EvtGeneric &rEvent )
...
@@ -333,6 +336,7 @@ void CtrlTree::handleEvent( EvtGeneric &rEvent )
else
else
{
{
it
->
m_expanded
=
true
;
it
->
m_expanded
=
true
;
bChangedPosition
=
true
;
}
}
}
}
}
}
...
@@ -344,6 +348,7 @@ void CtrlTree::handleEvent( EvtGeneric &rEvent )
...
@@ -344,6 +348,7 @@ void CtrlTree::handleEvent( EvtGeneric &rEvent )
if
(
it
->
m_expanded
&&
it
->
size
()
)
if
(
it
->
m_expanded
&&
it
->
size
()
)
{
{
it
->
m_expanded
=
false
;
it
->
m_expanded
=
false
;
bChangedPosition
=
true
;
}
}
else
else
{
{
...
@@ -453,6 +458,7 @@ void CtrlTree::handleEvent( EvtGeneric &rEvent )
...
@@ -453,6 +458,7 @@ void CtrlTree::handleEvent( EvtGeneric &rEvent )
{
{
// Fold/unfold the item
// Fold/unfold the item
it
->
m_expanded
=
!
it
->
m_expanded
;
it
->
m_expanded
=
!
it
->
m_expanded
;
bChangedPosition
=
true
;
}
}
else
else
{
{
...
@@ -503,6 +509,30 @@ void CtrlTree::handleEvent( EvtGeneric &rEvent )
...
@@ -503,6 +509,30 @@ void CtrlTree::handleEvent( EvtGeneric &rEvent )
}
}
m_rTree
.
getPositionVar
().
set
(
percentage
);
m_rTree
.
getPositionVar
().
set
(
percentage
);
}
}
/* We changed the nodes, let's fix teh position var */
if
(
bChangedPosition
)
{
VarTree
::
Iterator
it
;
int
i
=
0
;
int
iFirst
=
0
;
for
(
it
=
m_rTree
.
begin
();
it
!=
m_rTree
.
end
();
it
=
m_rTree
.
getNextVisibleItem
(
it
)
)
{
i
++
;
if
(
it
==
m_firstPos
)
{
iFirst
=
i
;
break
;
}
}
iFirst
+=
maxItems
();
if
(
iFirst
>=
m_rTree
.
visibleItems
()
)
iFirst
=
m_rTree
.
visibleItems
();
float
f_new
=
(
float
)
iFirst
/
(
float
)
m_rTree
.
visibleItems
();
m_dontMove
=
true
;
m_rTree
.
getPositionVar
().
set
(
1.0
-
f_new
);
m_dontMove
=
false
;
}
}
}
bool
CtrlTree
::
mouseOver
(
int
x
,
int
y
)
const
bool
CtrlTree
::
mouseOver
(
int
x
,
int
y
)
const
...
@@ -718,7 +748,6 @@ void CtrlTree::makeImage()
...
@@ -718,7 +748,6 @@ void CtrlTree::makeImage()
}
}
it
=
m_rTree
.
getNextVisibleItem
(
it
);
it
=
m_rTree
.
getNextVisibleItem
(
it
);
}
}
/// \todo Reposition percentage var to accomodate if it's not suitable anymore (if we expanded a node)
}
}
VarTree
::
Iterator
CtrlTree
::
findItemAtPos
(
int
pos
)
VarTree
::
Iterator
CtrlTree
::
findItemAtPos
(
int
pos
)
...
...
modules/gui/skins2/controls/ctrl_tree.hpp
View file @
b26eed49
...
@@ -111,6 +111,9 @@ class CtrlTree: public CtrlGeneric, public Observer<VarTree, tree_update*>,
...
@@ -111,6 +111,9 @@ class CtrlTree: public CtrlGeneric, public Observer<VarTree, tree_update*>,
/// First item in the visible area
/// First item in the visible area
VarTree
::
Iterator
m_firstPos
;
VarTree
::
Iterator
m_firstPos
;
/// Don't move if the position variable is updated
bool
m_dontMove
;
/// Method called when the tree variable is modified
/// Method called when the tree variable is modified
virtual
void
onUpdate
(
Subject
<
VarTree
,
tree_update
*>
&
rTree
,
virtual
void
onUpdate
(
Subject
<
VarTree
,
tree_update
*>
&
rTree
,
tree_update
*
);
tree_update
*
);
...
...
Write
Preview
Markdown
is supported
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