Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-2-2
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-2-2
Commits
bc83704f
Commit
bc83704f
authored
Jan 15, 2011
by
Erwan Tulou
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
skins2: refactor some code
parent
b630fa63
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
25 additions
and
53 deletions
+25
-53
modules/gui/skins2/controls/ctrl_tree.cpp
modules/gui/skins2/controls/ctrl_tree.cpp
+5
-48
modules/gui/skins2/controls/ctrl_tree.hpp
modules/gui/skins2/controls/ctrl_tree.hpp
+0
-5
modules/gui/skins2/utils/var_tree.cpp
modules/gui/skins2/utils/var_tree.cpp
+17
-0
modules/gui/skins2/utils/var_tree.hpp
modules/gui/skins2/utils/var_tree.hpp
+3
-0
No files found.
modules/gui/skins2/controls/ctrl_tree.cpp
View file @
bc83704f
...
@@ -685,43 +685,13 @@ void CtrlTree::draw( OSGraphics &rImage, int xDest, int yDest, int w, int h)
...
@@ -685,43 +685,13 @@ void CtrlTree::draw( OSGraphics &rImage, int xDest, int yDest, int w, int h)
bool
CtrlTree
::
ensureVisible
(
VarTree
::
Iterator
item
)
bool
CtrlTree
::
ensureVisible
(
VarTree
::
Iterator
item
)
{
{
// Find the item to focus
int
focusItemIndex
=
0
;
VarTree
::
Iterator
it
;
m_rTree
.
ensureExpanded
(
item
);
m_rTree
.
ensureExpanded
(
item
);
for
(
it
=
m_flat
?
m_rTree
.
firstLeaf
()
:
m_rTree
.
begin
();
int
firstPosIndex
=
m_rTree
.
getRank
(
m_firstPos
,
m_flat
)
-
1
;
it
!=
m_rTree
.
end
();
int
focusItemIndex
=
m_rTree
.
getRank
(
item
,
m_flat
)
-
1
;
it
=
m_flat
?
m_rTree
.
getNextLeaf
(
it
)
:
m_rTree
.
getNextVisibleItem
(
it
)
)
{
if
(
it
->
getId
()
==
item
->
getId
()
)
break
;
focusItemIndex
++
;
}
return
ensureVisible
(
focusItemIndex
);
}
bool
CtrlTree
::
ensureVisible
(
int
focusItemIndex
)
if
(
focusItemIndex
<
firstPosIndex
||
{
focusItemIndex
>
firstPosIndex
+
maxItems
()
-
1
)
// Find m_firstPos
VarTree
::
Iterator
it
;
int
firstPosIndex
=
0
;
for
(
it
=
m_flat
?
m_rTree
.
firstLeaf
()
:
m_rTree
.
begin
();
it
!=
m_rTree
.
end
();
it
=
m_flat
?
m_rTree
.
getNextLeaf
(
it
)
:
m_rTree
.
getNextVisibleItem
(
it
)
)
{
if
(
it
==
m_firstPos
)
break
;
firstPosIndex
++
;
}
if
(
it
==
m_rTree
.
end
()
)
return
false
;
if
(
it
!=
m_rTree
.
end
()
&&
(
focusItemIndex
<
firstPosIndex
||
focusItemIndex
>
firstPosIndex
+
maxItems
()
-
1
)
)
{
{
// Scroll to have the wanted stream visible
// Scroll to have the wanted stream visible
VarPercent
&
rVarPos
=
m_rTree
.
getPositionVar
();
VarPercent
&
rVarPos
=
m_rTree
.
getPositionVar
();
...
@@ -746,22 +716,9 @@ void CtrlTree::autoScroll()
...
@@ -746,22 +716,9 @@ void CtrlTree::autoScroll()
{
{
if
(
it
->
isPlaying
()
)
if
(
it
->
isPlaying
()
)
{
{
m_rTree
.
ensureExpanded
(
it
);
ensureVisible
(
it
);
break
;
}
}
for
(
it
=
m_flat
?
m_rTree
.
firstLeaf
()
:
m_rTree
.
begin
();
it
!=
m_rTree
.
end
();
it
=
m_flat
?
m_rTree
.
getNextLeaf
(
it
)
:
m_rTree
.
getNextVisibleItem
(
it
)
)
{
if
(
it
->
isPlaying
()
)
{
ensureVisible
(
playIndex
);
break
;
break
;
}
}
playIndex
++
;
}
}
}
}
...
...
modules/gui/skins2/controls/ctrl_tree.hpp
View file @
bc83704f
...
@@ -78,11 +78,6 @@ public:
...
@@ -78,11 +78,6 @@ public:
/// \return true if it changed the position
/// \return true if it changed the position
bool
ensureVisible
(
VarTree
::
Iterator
item
);
bool
ensureVisible
(
VarTree
::
Iterator
item
);
/// Make sure an item is visible
/// \param itemIndex the absolute index in the tree
/// \return true if it changed the position
bool
ensureVisible
(
int
itemIndex
);
private:
private:
/// Tree associated to the control
/// Tree associated to the control
VarTree
&
m_rTree
;
VarTree
&
m_rTree
;
...
...
modules/gui/skins2/utils/var_tree.cpp
View file @
bc83704f
...
@@ -421,3 +421,20 @@ void VarTree::cascadeDelete()
...
@@ -421,3 +421,20 @@ void VarTree::cascadeDelete()
it
->
cascadeDelete
();
it
->
cascadeDelete
();
}
}
}
}
int
VarTree
::
getRank
(
Iterator
item
,
bool
flat
)
{
int
index
=
1
;
Iterator
it
;
for
(
it
=
flat
?
firstLeaf
()
:
begin
();
it
!=
end
();
it
=
flat
?
getNextLeaf
(
it
)
:
getNextVisibleItem
(
it
)
)
{
if
(
it
->
isDeleted
()
)
continue
;
if
(
it
==
item
)
break
;
index
++
;
}
return
(
it
==
item
)
?
index
:
-
1
;
}
modules/gui/skins2/utils/var_tree.hpp
View file @
bc83704f
...
@@ -167,6 +167,9 @@ public:
...
@@ -167,6 +167,9 @@ public:
/// Given an iterator to an item, return the previous leaf
/// Given an iterator to an item, return the previous leaf
Iterator
getPrevLeaf
(
Iterator
it
);
Iterator
getPrevLeaf
(
Iterator
it
);
/// return rank of visible item starting from 1
int
getRank
(
Iterator
it
,
bool
flat
);
/// Find a children node with the given id
/// Find a children node with the given id
Iterator
findById
(
int
id
);
Iterator
findById
(
int
id
);
...
...
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