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
1163a906
Commit
1163a906
authored
Mar 04, 2006
by
Antoine Cellerier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Drag and Drop support in wx playlist.
TODO: merge this playlist code with the gibalou mini playlist code.
parent
b162c530
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
65 additions
and
0 deletions
+65
-0
modules/gui/wxwidgets/dialogs/playlist.cpp
modules/gui/wxwidgets/dialogs/playlist.cpp
+61
-0
modules/gui/wxwidgets/dialogs/playlist.hpp
modules/gui/wxwidgets/dialogs/playlist.hpp
+4
-0
No files found.
modules/gui/wxwidgets/dialogs/playlist.cpp
View file @
1163a906
...
...
@@ -157,6 +157,8 @@ BEGIN_EVENT_TABLE(Playlist, wxFrame)
/* Tree control events */
EVT_TREE_ITEM_ACTIVATED
(
TreeCtrl_Event
,
Playlist
::
OnActivateItem
)
EVT_TREE_KEY_DOWN
(
-
1
,
Playlist
::
OnKeyDown
)
EVT_TREE_BEGIN_DRAG
(
TreeCtrl_Event
,
Playlist
::
OnDragItemBegin
)
EVT_TREE_END_DRAG
(
TreeCtrl_Event
,
Playlist
::
OnDragItemEnd
)
EVT_CONTEXT_MENU
(
Playlist
::
OnPopup
)
...
...
@@ -1139,6 +1141,65 @@ void Playlist::OnEnDis( wxCommandEvent& event )
msg_Warn
(
p_intf
,
"not implemented"
);
}
void
Playlist
::
OnDragItemBegin
(
wxTreeEvent
&
event
)
{
event
.
Allow
();
draged_tree_item
=
event
.
GetItem
();
}
void
Playlist
::
OnDragItemEnd
(
wxTreeEvent
&
event
)
{
wxTreeItemId
dest_tree_item
=
event
.
GetItem
();
/* check that we're not trying to move a node into one of it's children */
wxTreeItemId
parent
=
dest_tree_item
;
while
(
parent
!=
treectrl
->
GetRootItem
()
)
{
if
(
draged_tree_item
==
parent
)
return
;
parent
=
treectrl
->
GetItemParent
(
parent
);
}
if
(
draged_tree_item
!=
dest_tree_item
)
{
LockPlaylist
(
p_intf
->
p_sys
,
p_playlist
);
PlaylistItem
*
p_wxdrageditem
=
(
PlaylistItem
*
)
treectrl
->
GetItemData
(
draged_tree_item
);
PlaylistItem
*
p_wxdestitem
=
(
PlaylistItem
*
)
treectrl
->
GetItemData
(
dest_tree_item
);
playlist_item_t
*
p_drageditem
=
playlist_ItemGetById
(
p_playlist
,
p_wxdrageditem
->
i_id
);
playlist_item_t
*
p_destitem
=
playlist_ItemGetById
(
p_playlist
,
p_wxdestitem
->
i_id
);
if
(
p_destitem
->
i_children
==
-
1
)
/* this is a leaf */
{
parent
=
treectrl
->
GetItemParent
(
dest_tree_item
);
PlaylistItem
*
p_parent
=
(
PlaylistItem
*
)
treectrl
->
GetItemData
(
parent
);
playlist_item_t
*
p_destitem2
=
playlist_ItemGetById
(
p_playlist
,
p_parent
->
i_id
);
int
i
;
for
(
i
=
0
;
i
<
p_destitem2
->
i_children
;
i
++
)
{
if
(
p_destitem2
->
pp_children
[
i
]
==
p_destitem
)
break
;
}
playlist_TreeMove
(
p_playlist
,
p_drageditem
,
p_destitem2
,
i
,
i_current_view
);
}
else
/* this is a node */
{
playlist_TreeMove
(
p_playlist
,
p_drageditem
,
p_destitem
,
0
,
i_current_view
);
}
UnlockPlaylist
(
p_intf
->
p_sys
,
p_playlist
);
Rebuild
(
VLC_TRUE
);
}
}
/**********************************************************************
* Menu
**********************************************************************/
...
...
modules/gui/wxwidgets/dialogs/playlist.hpp
View file @
1163a906
...
...
@@ -115,6 +115,10 @@ private:
void
OnKeyDown
(
wxTreeEvent
&
event
);
void
OnNewGroup
(
wxCommandEvent
&
event
);
void
OnDragItemBegin
(
wxTreeEvent
&
event
);
void
OnDragItemEnd
(
wxTreeEvent
&
event
);
wxTreeItemId
draged_tree_item
;
/* Popup */
wxMenu
*
item_popup
;
wxMenu
*
node_popup
;
...
...
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