From: Antoine Cellerier Date: Sat, 4 Mar 2006 17:32:35 +0000 (+0000) Subject: add "Add node" function to node contextual menu X-Git-Tag: 0.9.0-test0~12047 X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=6ad64134ee487c80e0542bafd9f9b905c1d13938;p=vlc add "Add node" function to node contextual menu --- diff --git a/modules/gui/wxwidgets/dialogs/playlist.cpp b/modules/gui/wxwidgets/dialogs/playlist.cpp index 158cfc74f9..a232e38329 100644 --- a/modules/gui/wxwidgets/dialogs/playlist.cpp +++ b/modules/gui/wxwidgets/dialogs/playlist.cpp @@ -96,6 +96,7 @@ enum PopupSort_Event, PopupDel_Event, PopupInfo_Event, + PopupAddNode_Event, SearchText_Event, Search_Event, @@ -153,6 +154,7 @@ BEGIN_EVENT_TABLE(Playlist, wxFrame) EVT_MENU( PopupSort_Event, Playlist::OnPopupSort) EVT_MENU( PopupDel_Event, Playlist::OnPopupDel) EVT_MENU( PopupInfo_Event, Playlist::OnPopupInfo) + EVT_MENU( PopupAddNode_Event, Playlist::OnPopupAddNode) /* Tree control events */ EVT_TREE_ITEM_ACTIVATED( TreeCtrl_Event, Playlist::OnActivateItem ) @@ -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( PopupDel_Event, wxU(_("Delete")) ); node_popup->Append( PopupInfo_Event, wxU(_("Info")) ); + node_popup->Append( PopupAddNode_Event, wxU(_("Add node")) ); item_popup = new wxMenu; item_popup->Append( PopupPlay_Event, wxU(_("Play")) ); @@ -1497,6 +1500,31 @@ void Playlist::OnPopupInfo( wxCommandEvent& event ) 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 diff --git a/modules/gui/wxwidgets/dialogs/playlist.hpp b/modules/gui/wxwidgets/dialogs/playlist.hpp index 1354af9789..dcfc24d58f 100644 --- a/modules/gui/wxwidgets/dialogs/playlist.hpp +++ b/modules/gui/wxwidgets/dialogs/playlist.hpp @@ -132,6 +132,7 @@ private: void OnPopupDel( wxCommandEvent& event ); void OnPopupEna( wxCommandEvent& event ); void OnPopupInfo( wxCommandEvent& event ); + void OnPopupAddNode( wxCommandEvent& event ); void Rebuild( vlc_bool_t ); void Preparse();