Commit 6ad64134 authored by Antoine Cellerier's avatar Antoine Cellerier

add "Add node" function to node contextual menu

parent 1163a906
...@@ -96,6 +96,7 @@ enum ...@@ -96,6 +96,7 @@ enum
PopupSort_Event, PopupSort_Event,
PopupDel_Event, PopupDel_Event,
PopupInfo_Event, PopupInfo_Event,
PopupAddNode_Event,
SearchText_Event, SearchText_Event,
Search_Event, Search_Event,
...@@ -153,6 +154,7 @@ BEGIN_EVENT_TABLE(Playlist, wxFrame) ...@@ -153,6 +154,7 @@ BEGIN_EVENT_TABLE(Playlist, wxFrame)
EVT_MENU( PopupSort_Event, Playlist::OnPopupSort) EVT_MENU( PopupSort_Event, Playlist::OnPopupSort)
EVT_MENU( PopupDel_Event, Playlist::OnPopupDel) EVT_MENU( PopupDel_Event, Playlist::OnPopupDel)
EVT_MENU( PopupInfo_Event, Playlist::OnPopupInfo) EVT_MENU( PopupInfo_Event, Playlist::OnPopupInfo)
EVT_MENU( PopupAddNode_Event, Playlist::OnPopupAddNode)
/* Tree control events */ /* Tree control events */
EVT_TREE_ITEM_ACTIVATED( TreeCtrl_Event, Playlist::OnActivateItem ) EVT_TREE_ITEM_ACTIVATED( TreeCtrl_Event, Playlist::OnActivateItem )
...@@ -274,6 +276,7 @@ Playlist::Playlist( intf_thread_t *_p_intf, wxWindow *p_parent ): ...@@ -274,6 +276,7 @@ Playlist::Playlist( intf_thread_t *_p_intf, wxWindow *p_parent ):
node_popup->Append( PopupSort_Event, wxU(_("Sort this branch")) ); node_popup->Append( PopupSort_Event, wxU(_("Sort this branch")) );
node_popup->Append( PopupDel_Event, wxU(_("Delete")) ); node_popup->Append( PopupDel_Event, wxU(_("Delete")) );
node_popup->Append( PopupInfo_Event, wxU(_("Info")) ); node_popup->Append( PopupInfo_Event, wxU(_("Info")) );
node_popup->Append( PopupAddNode_Event, wxU(_("Add node")) );
item_popup = new wxMenu; item_popup = new wxMenu;
item_popup->Append( PopupPlay_Event, wxU(_("Play")) ); item_popup->Append( PopupPlay_Event, wxU(_("Play")) );
...@@ -1497,6 +1500,31 @@ void Playlist::OnPopupInfo( wxCommandEvent& event ) ...@@ -1497,6 +1500,31 @@ void Playlist::OnPopupInfo( wxCommandEvent& event )
UnlockPlaylist( p_intf->p_sys, p_playlist ); UnlockPlaylist( p_intf->p_sys, p_playlist );
} }
void Playlist::OnPopupAddNode( wxCommandEvent& event )
{
wxTextEntryDialog text( NULL, wxU(_( "Please enter node name" )),
wxU(_( "Add node" )), wxU(_( "New node" )) );
if( text.ShowModal() != wxID_OK ) return;
char *psz_name = wxFromLocale( text.GetValue() );
LockPlaylist( p_intf->p_sys, p_playlist );
PlaylistItem *p_wxitem;
playlist_item_t *p_item;
p_wxitem = (PlaylistItem *)treectrl->GetItemData( i_wx_popup_item );
p_item = playlist_ItemGetById( p_playlist, p_wxitem->i_id );
playlist_NodeCreate( p_playlist, 0, psz_name, p_item );
UnlockPlaylist( p_intf->p_sys, p_playlist );
Rebuild( VLC_TRUE );
wxLocaleFree( psz_name );
}
/***************************************************************************** /*****************************************************************************
* Custom events management * Custom events management
......
...@@ -132,6 +132,7 @@ private: ...@@ -132,6 +132,7 @@ private:
void OnPopupDel( wxCommandEvent& event ); void OnPopupDel( wxCommandEvent& event );
void OnPopupEna( wxCommandEvent& event ); void OnPopupEna( wxCommandEvent& event );
void OnPopupInfo( wxCommandEvent& event ); void OnPopupInfo( wxCommandEvent& event );
void OnPopupAddNode( wxCommandEvent& event );
void Rebuild( vlc_bool_t ); void Rebuild( vlc_bool_t );
void Preparse(); void Preparse();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment