Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-gpu
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-gpu
Commits
3785da0d
Commit
3785da0d
authored
Aug 20, 2005
by
Antoine Cellerier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
some more mouse control on playtree display/selection
parent
698c1a3d
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
111 additions
and
20 deletions
+111
-20
modules/gui/skins2/controls/ctrl_tree.cpp
modules/gui/skins2/controls/ctrl_tree.cpp
+105
-20
modules/gui/skins2/controls/ctrl_tree.hpp
modules/gui/skins2/controls/ctrl_tree.hpp
+3
-0
modules/gui/skins2/vars/playtree.cpp
modules/gui/skins2/vars/playtree.cpp
+3
-0
No files found.
modules/gui/skins2/controls/ctrl_tree.cpp
View file @
3785da0d
...
...
@@ -100,6 +100,24 @@ int CtrlTree::itemHeight()
return
itemHeight
;
}
int
CtrlTree
::
itemImageWidth
()
{
int
bitmapWidth
=
5
;
if
(
m_pClosedBitmap
)
{
bitmapWidth
=
__MAX
(
m_pClosedBitmap
->
getWidth
(),
bitmapWidth
);
}
if
(
m_pOpenBitmap
)
{
bitmapWidth
=
__MAX
(
m_pOpenBitmap
->
getWidth
(),
bitmapWidth
);
}
if
(
m_pItemBitmap
)
{
bitmapWidth
=
__MAX
(
m_pItemBitmap
->
getWidth
(),
bitmapWidth
);
}
return
bitmapWidth
+
2
;
}
int
CtrlTree
::
maxItems
()
{
const
Position
*
pPos
=
getPosition
();
...
...
@@ -291,11 +309,84 @@ void CtrlTree::handleEvent( EvtGeneric &rEvent )
EvtMouse
&
rEvtMouse
=
(
EvtMouse
&
)
rEvent
;
const
Position
*
pos
=
getPosition
();
int
yPos
=
(
rEvtMouse
.
getYPos
()
-
pos
->
getTop
()
)
/
itemHeight
();
int
xPos
=
rEvtMouse
.
getXPos
()
-
pos
->
getLeft
();
VarTree
::
Iterator
it
;
int
index
=
0
;
// TODO : add all other mouse controls
/**/
if
(
rEvent
.
getAsString
().
find
(
"mouse:left:down"
)
!=
if
(
rEvent
.
getAsString
().
find
(
"mouse:left:down:ctrl,shift"
)
!=
string
::
npos
)
{
// Flag to know if the currend item must be selected
bool
select
=
false
;
index
=
-
1
;
for
(
it
=
m_rTree
.
begin
();
it
!=
m_rTree
.
end
();
)
{
bool
nextSelect
=
select
;
if
(
it
==
m_lastPos
)
index
=
0
;
if
(
index
==
yPos
||
&*
it
==
m_pLastSelected
)
{
if
(
select
)
{
nextSelect
=
false
;
}
else
{
select
=
true
;
nextSelect
=
true
;
}
}
it
->
m_selected
=
(
*
it
).
m_selected
||
select
;
select
=
nextSelect
;
if
(
index
!=
-
1
)
index
++
;
IT_DISP_LOOP_END
(
it
);
}
}
else
if
(
rEvent
.
getAsString
().
find
(
"mouse:left:down:ctrl"
)
!=
string
::
npos
)
{
for
(
it
=
m_lastPos
;
it
!=
m_rTree
.
end
();
)
{
if
(
index
==
yPos
)
{
it
->
m_selected
=
!
it
->
m_selected
;
m_pLastSelected
=
&*
it
;
break
;
}
index
++
;
IT_DISP_LOOP_END
(
it
);
}
}
else
if
(
rEvent
.
getAsString
().
find
(
"mouse:left:down:shift"
)
!=
string
::
npos
)
{
// Flag to know if the currend item must be selected
bool
select
=
false
;
index
=
-
1
;
for
(
it
=
m_rTree
.
begin
();
it
!=
m_rTree
.
end
();
)
{
bool
nextSelect
=
select
;
if
(
it
==
m_lastPos
)
index
=
0
;
if
(
index
==
yPos
||
&*
it
==
m_pLastSelected
)
{
if
(
select
)
{
nextSelect
=
false
;
}
else
{
select
=
true
;
nextSelect
=
true
;
}
}
it
->
m_selected
=
select
;
select
=
nextSelect
;
if
(
index
!=
-
1
)
index
++
;
IT_DISP_LOOP_END
(
it
);
}
}
else
if
(
rEvent
.
getAsString
().
find
(
"mouse:left:down"
)
!=
string
::
npos
)
{
for
(
it
=
m_lastPos
;
it
!=
m_rTree
.
end
();
)
...
...
@@ -321,10 +412,17 @@ void CtrlTree::handleEvent( EvtGeneric &rEvent )
{
if
(
index
==
yPos
)
{
it
->
m_selected
=
true
;
m_pLastSelected
=
&*
it
;
// Execute the action associated to this item
m_rTree
.
action
(
&*
it
);
if
(
it
->
size
()
&&
xPos
<
it
->
depth
()
*
itemImageWidth
()
)
{
it
->
m_expanded
=
!
it
->
m_expanded
;
}
else
{
it
->
m_selected
=
true
;
m_pLastSelected
=
&*
it
;
// Execute the action associated to this item
m_rTree
.
action
(
&*
it
);
}
}
else
{
...
...
@@ -450,20 +548,7 @@ void CtrlTree::makeImage()
}
// fprintf( stderr, "done\n");
int
bitmapWidth
=
5
;
if
(
m_pClosedBitmap
)
{
bitmapWidth
=
__MAX
(
m_pClosedBitmap
->
getWidth
(),
bitmapWidth
);
}
if
(
m_pOpenBitmap
)
{
bitmapWidth
=
__MAX
(
m_pOpenBitmap
->
getWidth
(),
bitmapWidth
);
}
if
(
m_pItemBitmap
)
{
bitmapWidth
=
__MAX
(
m_pItemBitmap
->
getWidth
(),
bitmapWidth
);
}
bitmapWidth
+=
2
;
int
bitmapWidth
=
itemImageWidth
();
// FIXME : Draw the items
int
yPos
=
0
;
...
...
modules/gui/skins2/controls/ctrl_tree.hpp
View file @
3785da0d
...
...
@@ -116,6 +116,9 @@ class CtrlTree: public CtrlGeneric, public Observer<VarTree>,
/// Compute the item's height (depends on fonts and images used)
int
itemHeight
();
/// Compute the width of an item's bitmap
int
itemImageWidth
();
/// Check if the tree must be scrolled
void
autoScroll
();
...
...
modules/gui/skins2/vars/playtree.cpp
View file @
3785da0d
...
...
@@ -63,6 +63,9 @@ void Playtree::delSelected()
void
Playtree
::
action
(
VarTree
*
pItem
)
{
/* do we really want to call preparse here ? */
playlist_PreparseEnqueueItem
(
m_pPlaylist
,
(
playlist_item_t
*
)
pItem
->
m_pData
);
vlc_mutex_lock
(
&
m_pPlaylist
->
object_lock
);
VarTree
::
Iterator
it
;
if
(
pItem
->
size
()
)
...
...
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