Commit 1595dc25 authored by Clément Stenac's avatar Clément Stenac

modules/gui/wxwindows/playlist.cpp

  modules/gui/wxwindows/iteminfo.cpp
        - Show the info as a tree view.
         At the moment, all is shown. We should maybe hide the "Options" tree
         as it rather "internal"
        - Improved a little the layout
        - Added a popup menu to to the playlist
        - Minimize playlist rebuilds
parent aa830d43
......@@ -2,7 +2,7 @@
* dialogs.cpp : wxWindows plugin for vlc
*****************************************************************************
* Copyright (C) 2000-2001 VideoLAN
* $Id: dialogs.cpp,v 1.12 2003/12/11 02:26:03 asmax Exp $
* $Id: dialogs.cpp,v 1.13 2004/01/05 13:00:39 zorglub Exp $
*
* Authors: Gildas Bazin <gbazin@netcourrier.com>
*
......@@ -289,12 +289,13 @@ void DialogsProvider::OnOpenFileSimple( wxCommandEvent& event )
for( size_t i = 0; i < paths.GetCount(); i++ )
if( event.GetInt() )
playlist_Add( p_playlist, (const char *)paths[i].mb_str(),
0, 0,
(const char *)paths[i].mb_str(),
PLAYLIST_APPEND | (i ? 0 : PLAYLIST_GO),
PLAYLIST_END );
else
playlist_Add( p_playlist, (const char *)paths[i].mb_str(),
0, 0, PLAYLIST_APPEND, PLAYLIST_END );
(const char *)paths[i].mb_str(),
PLAYLIST_APPEND, PLAYLIST_END );
}
vlc_object_release( p_playlist );
......
......@@ -2,7 +2,7 @@
* interface.cpp : wxWindows plugin for vlc
*****************************************************************************
* Copyright (C) 2000-2001, 2003 VideoLAN
* $Id: interface.cpp,v 1.82 2004/01/03 10:55:07 gbazin Exp $
* $Id: interface.cpp,v 1.83 2004/01/05 13:00:39 zorglub Exp $
*
* Authors: Gildas Bazin <gbazin@netcourrier.com>
*
......@@ -208,7 +208,7 @@ END_EVENT_TABLE()
*****************************************************************************/
Interface::Interface( intf_thread_t *_p_intf ):
wxFrame( NULL, -1, wxT("VLC media player"),
wxDefaultPosition, wxDefaultSize, wxDEFAULT_FRAME_STYLE )
wxDefaultPosition, wxSize(700,100), wxDEFAULT_FRAME_STYLE )
{
/* Initializations */
p_intf = _p_intf;
......@@ -1174,6 +1174,7 @@ void Interface::OnSliderUpdate( wxScrollEvent& event )
}
#endif
#undef WIN32
vlc_mutex_unlock( &p_intf->change_lock );
}
......@@ -1312,7 +1313,8 @@ bool DragAndDrop::OnDropFiles( wxCoord, wxCoord,
}
for( size_t i = 0; i < filenames.GetCount(); i++ )
playlist_Add( p_playlist, (const char *)filenames[i].mb_str(), 0, 0,
playlist_Add( p_playlist, (const char *)filenames[i].mb_str(),
(const char *)filenames[i].mb_str(),
PLAYLIST_APPEND | ((i | b_enqueue) ? 0 : PLAYLIST_GO),
PLAYLIST_END );
......
......@@ -2,7 +2,7 @@
* iteminfo.cpp : wxWindows plugin for vlc
*****************************************************************************
* Copyright (C) 2000-2001 VideoLAN
* $Id: iteminfo.cpp,v 1.5 2003/12/22 02:24:52 sam Exp $
* $Id: iteminfo.cpp,v 1.6 2004/01/05 13:00:39 zorglub Exp $
*
* Authors: Clment Stenac <zorglub@videolan.org>
*
......@@ -140,74 +140,84 @@ ItemInfoDialog::~ItemInfoDialog()
*****************************************************************************/
wxPanel *ItemInfoDialog::InfoPanel( wxWindow* parent )
{
wxPanel *panel = new wxPanel( parent, -1, wxDefaultPosition,
wxPanel *info_panel = new wxPanel( parent, -1, wxDefaultPosition,
wxDefaultSize );
info_panel->SetAutoLayout( TRUE );
wxBoxSizer *info_sizer = new wxBoxSizer( wxHORIZONTAL );
wxStaticBox *panel_box = new wxStaticBox( panel, -1,
/* Create a box to surround the controls */
wxStaticBox *panel_box = new wxStaticBox( info_panel, -1,
wxU(_("Item informations")) );
wxStaticBoxSizer *panel_sizer = new wxStaticBoxSizer( panel_box,
wxVERTICAL );
info_subpanel = new wxPanel( panel, -1 );
wxFlexGridSizer *subpanel_sizer =
new wxFlexGridSizer( 3, 1 , 0 , 0 );
wxStaticBoxSizer *box_sizer = new wxStaticBoxSizer( panel_box,
wxVERTICAL );
/* URI Textbox */
wxStaticText *uri_label =
new wxStaticText(info_subpanel, -1, wxU(_("URI")) );
new wxStaticText( info_panel, -1, wxU(_("URI")) );
uri_text = new wxTextCtrl( info_subpanel, Uri_Event,
uri_text = new wxTextCtrl( info_panel, Uri_Event,
wxU(p_item->psz_uri),
wxDefaultPosition, wxSize( 300, -1 ),
wxTE_PROCESS_ENTER);
subpanel_sizer->Add( uri_label, 0, wxALIGN_LEFT |
wxALIGN_CENTER_VERTICAL );
subpanel_sizer->Add( uri_text, 0, wxALIGN_RIGHT |
wxALIGN_CENTER_VERTICAL );
wxBoxSizer *uri_sizer = new wxBoxSizer( wxHORIZONTAL );
uri_sizer->Add( uri_label, 0 , wxALIGN_RIGHT |wxALL , 5 );
uri_sizer->Add( uri_text, 1 , wxALIGN_RIGHT | wxALL , 5 );
uri_sizer->Layout();
box_sizer->Add( uri_sizer, 1, wxEXPAND , 5);
/* Name Textbox */
wxStaticText *name_label =
new wxStaticText(info_subpanel, -1, wxU(_("Name")) );
new wxStaticText( info_panel, -1, wxU(_("Name")) );
name_text =
new wxTextCtrl( info_subpanel, Uri_Event,
new wxTextCtrl( info_panel, Uri_Event,
wxU(p_item->psz_name),
wxDefaultPosition, wxSize( 300, -1 ),
wxTE_PROCESS_ENTER);
subpanel_sizer->Add( name_label, 0, wxALIGN_LEFT |
wxALIGN_CENTER_VERTICAL );
subpanel_sizer->Add( name_text, 0, wxALIGN_RIGHT |
wxALIGN_CENTER_VERTICAL );
wxBoxSizer *name_sizer = new wxBoxSizer( wxHORIZONTAL );
name_sizer->Add( name_label, 0 , wxALIGN_RIGHT |wxALL , 5 );
name_sizer->Add( name_text, 1 , wxALIGN_RIGHT | wxALL , 5 );
name_sizer->Layout();
box_sizer->Add( name_sizer, 1 , wxEXPAND, 5 );
/* Author Textbox */
wxStaticText *author_label =
new wxStaticText(info_subpanel, -1, wxU(_("Author")) );
new wxStaticText( info_panel, -1, wxU(_("Author")) );
author_text =
new wxTextCtrl( info_subpanel, Uri_Event,
wxU(p_item->psz_author),
new wxTextCtrl( info_panel, Uri_Event,
wxU( playlist_GetItemInfo( p_item,
_("General"), _("Author") ) ),
wxDefaultPosition, wxSize( 300, -1 ),
wxTE_PROCESS_ENTER);
subpanel_sizer->Add( author_label, 0, wxALIGN_LEFT |
wxALIGN_CENTER_VERTICAL );
subpanel_sizer->Add( author_text, 0, wxALIGN_RIGHT |
wxALIGN_CENTER_VERTICAL );
wxBoxSizer *author_sizer = new wxBoxSizer( wxHORIZONTAL );
author_sizer->Add( author_label, 0 , wxALIGN_RIGHT | wxALL , 5 );
author_sizer->Add( author_text, 1 , wxALIGN_RIGHT | wxALL , 5);
author_sizer->Layout();
box_sizer->Add( author_sizer, 1, wxEXPAND, 5 );
info_subpanel->SetSizerAndFit( subpanel_sizer );
/* Treeview */
info_tree = new wxTreeCtrl( info_panel, -1, wxDefaultPosition,
wxSize(220,200),
wxSUNKEN_BORDER |wxTR_HAS_BUTTONS |
wxTR_HIDE_ROOT );
/* Stuff everything into the main panel */
panel_sizer->Add( info_subpanel, 1,
wxEXPAND | wxALIGN_LEFT |
wxALIGN_CENTER_VERTICAL | wxALL, 5 );
box_sizer->Add( info_tree, 0, wxEXPAND, 5 );
info_sizer->Add( box_sizer, 1, wxBOTTOM, 5 );
panel->SetSizerAndFit( panel_sizer );
info_panel->SetSizer( info_sizer );
info_sizer->Layout();
info_sizer->SetSizeHints( info_panel );
return panel;
UpdateInfo();
return info_panel;
}
wxPanel *ItemInfoDialog::GroupPanel( wxWindow* parent )
......@@ -276,6 +286,33 @@ wxPanel *ItemInfoDialog::GroupPanel( wxWindow* parent )
return panel;
}
void ItemInfoDialog::UpdateInfo()
{
if( !info_root )
{
info_root = info_tree->AddRoot( wxU( p_item->psz_name) );
}
/* Rebuild the tree */
for( int i = 0; i< p_item->i_categories ; i++)
{
if( !strcmp( p_item->pp_categories[i]->psz_name, _("Options") ) )
{
continue;
}
wxTreeItemId cat = info_tree->AppendItem( info_root,
wxU( p_item->pp_categories[i]->psz_name) );
for( int j = 0 ; j < p_item->pp_categories[i]->i_infos ; j++ )
{
info_tree->AppendItem( cat , (wxString)
wxU(p_item->pp_categories[i]->pp_infos[j]->psz_name) +
wxT(": ") +
wxU(p_item->pp_categories[i]->pp_infos[j]->psz_value) );
}
}
}
/*****************************************************************************
* Events methods.
*****************************************************************************/
......@@ -283,7 +320,8 @@ void ItemInfoDialog::OnOk( wxCommandEvent& WXUNUSED(event) )
{
p_item->psz_name = strdup( name_text->GetLineText(0).mb_str() );
p_item->psz_uri = strdup( uri_text->GetLineText(0).mb_str() );
p_item->psz_author = strdup( author_text->GetLineText(0).mb_str() );
playlist_AddItemInfo( p_item,"General","Author",
author_text->GetLineText(0).mb_str() );
vlc_bool_t b_old_enabled = p_item->b_enabled;
playlist_t * p_playlist =
......
......@@ -2,7 +2,7 @@
* open.cpp : wxWindows plugin for vlc
*****************************************************************************
* Copyright (C) 2000, 2001, 2003 VideoLAN
* $Id: open.cpp,v 1.61 2003/12/22 15:42:43 gbazin Exp $
* $Id: open.cpp,v 1.62 2004/01/05 13:00:39 zorglub Exp $
*
* Authors: Gildas Bazin <gbazin@netcourrier.com>
*
......@@ -902,8 +902,12 @@ void OpenDialog::OnOk( wxCommandEvent& WXUNUSED(event) )
for( int i = 0; i < (int)mrl.GetCount(); i++ )
{
int i_options = 0, i_total_options;
char **ppsz_options = NULL;
int i_options = 0;
int i_id = playlist_Add( p_playlist, (const char *)mrl[i].mb_str(),
(const char *)mrl[i].mb_str(),
PLAYLIST_APPEND | (i ? 0 : PLAYLIST_GO), PLAYLIST_END );
int i_pos = playlist_GetPositionById( p_playlist, i_id );
/* Count the input options */
while( i + i_options + 1 < (int)mrl.GetCount() &&
......@@ -912,57 +916,31 @@ void OpenDialog::OnOk( wxCommandEvent& WXUNUSED(event) )
i_options++;
}
/* Allocate ppsz_options */
/* Insert options */
for( int j = 0; j < i_options; j++ )
{
if( !ppsz_options )
ppsz_options = (char **)malloc( sizeof(char *) * i_options );
ppsz_options[j] = strdup( mrl[i + j + 1].mb_str() );
playlist_AddOption( p_playlist, i_pos, mrl[i + j + 1].mb_str() );
}
i_total_options = i_options;
/* Get the options from the subtitles dialog */
if( subsfile_checkbox->IsChecked() && subsfile_mrl.GetCount() )
{
ppsz_options = (char **)realloc( ppsz_options, sizeof(char *) *
(i_total_options + subsfile_mrl.GetCount()) );
for( int j = 0; j < (int)subsfile_mrl.GetCount(); j++ )
{
ppsz_options[i_total_options + j] =
strdup( subsfile_mrl[j].mb_str() );
playlist_AddOption( p_playlist, i_pos ,
subsfile_mrl[j].mb_str() );
}
i_total_options += subsfile_mrl.GetCount();
}
/* Get the options from the stream output dialog */
if( sout_checkbox->IsChecked() && sout_mrl.GetCount() )
{
ppsz_options = (char **)realloc( ppsz_options, sizeof(char *) *
(i_total_options + sout_mrl.GetCount()) );
for( int j = 0; j < (int)sout_mrl.GetCount(); j++ )
{
ppsz_options[i_total_options + j] =
strdup( sout_mrl[j].mb_str() );
playlist_AddOption( p_playlist, i_pos ,
sout_mrl[j].mb_str() );
}
i_total_options += sout_mrl.GetCount();
}
playlist_Add( p_playlist, (const char *)mrl[i].mb_str(),
(const char **)ppsz_options, i_total_options,
PLAYLIST_APPEND | (i ? 0 : PLAYLIST_GO), PLAYLIST_END );
/* clean up */
for( int j = 0; j < i_total_options; j++ )
free( ppsz_options[j] );
if( ppsz_options ) free( ppsz_options );
i += i_options;
}
......
......@@ -2,7 +2,7 @@
* playlist.cpp : wxWindows plugin for vlc
*****************************************************************************
* Copyright (C) 2000-2001, 2003 VideoLAN
* $Id: playlist.cpp,v 1.32 2003/12/22 14:31:01 gbazin Exp $
* $Id: playlist.cpp,v 1.33 2004/01/05 13:00:39 zorglub Exp $
*
* Authors: Olivier Teulire <ipkiss@via.ecp.fr>
*
......@@ -33,6 +33,10 @@
/* Callback prototype */
int PlaylistChanged( vlc_object_t *p_this, const char *psz_variable,
vlc_value_t old_val, vlc_value_t new_val, void *param );
int PlaylistNext( vlc_object_t *p_this, const char *psz_variable,
vlc_value_t old_val, vlc_value_t new_val, void *param );
int ItemChanged( vlc_object_t *p_this, const char *psz_variable,
vlc_value_t old_val, vlc_value_t new_val, void *param );
/*****************************************************************************
* Event Table.
......@@ -73,6 +77,11 @@ enum
Down_Event,
Infos_Event,
PopupPlay_Event,
PopupDel_Event,
PopupEna_Event,
PopupInfo_Event,
SearchText_Event,
Search_Event,
......@@ -114,6 +123,14 @@ BEGIN_EVENT_TABLE(Playlist, wxFrame)
EVT_LIST_ITEM_ACTIVATED(ListView_Event, Playlist::OnActivateItem)
EVT_LIST_COL_CLICK(ListView_Event, Playlist::OnColSelect)
EVT_LIST_KEY_DOWN(ListView_Event, Playlist::OnKeyDown)
EVT_LIST_ITEM_RIGHT_CLICK(ListView_Event, Playlist::OnPopup)
/* Popup events */
EVT_MENU( PopupPlay_Event, Playlist::OnPopupPlay)
EVT_MENU( PopupDel_Event, Playlist::OnPopupDel)
EVT_MENU( PopupEna_Event, Playlist::OnPopupEna)
EVT_MENU( PopupInfo_Event, Playlist::OnPopupInfo)
/* Button events */
EVT_BUTTON( Search_Event, Playlist::OnSearch)
......@@ -214,6 +231,12 @@ Playlist::Playlist( intf_thread_t *_p_intf, wxWindow *p_parent ):
/* Attach the menu bar to the frame */
SetMenuBar( menubar );
/* Create the popup menu */
popup_menu = new wxMenu;
popup_menu->Append( PopupPlay_Event, wxU(_("Play item")) );
popup_menu->Append( PopupDel_Event, wxU(_("Delete item")) );
popup_menu->Append( PopupEna_Event, wxU(_("Toggle enabled")) );
popup_menu->Append( PopupInfo_Event, wxU(_("Info on item")) );
/* Create a panel to put everything in */
wxPanel *playlist_panel = new wxPanel( this, -1 );
......@@ -340,7 +363,17 @@ Playlist::Playlist( intf_thread_t *_p_intf, wxWindow *p_parent ):
}
/* We want to be noticed of playlist changes */
/* Some global changes happened -> Rebuild all */
var_AddCallback( p_playlist, "intf-change", PlaylistChanged, this );
/* We went to the next item */
var_AddCallback( p_playlist, "playlist-current", PlaylistNext, this );
/* One item has been updated */
var_AddCallback( p_playlist, "item-change", ItemChanged, this );
vlc_object_release( p_playlist );
/* Update the playlist */
......@@ -363,6 +396,60 @@ Playlist::~Playlist()
vlc_object_release( p_playlist );
}
/**********************************************************************
* Update one playlist item
**********************************************************************/
void Playlist::UpdateItem( int i )
{
playlist_t *p_playlist =
(playlist_t *)vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
FIND_ANYWHERE );
if( p_playlist == NULL )
{
return;
}
if( i < 0 || i > p_playlist->i_size )
{
vlc_object_release(p_playlist);
return;
}
listview->SetItem( i, 0, wxL2U(p_playlist->pp_items[i]->psz_name) );
listview->SetItem( i, 1, wxL2U( playlist_GetInfo( p_playlist, i,
"General" , "Author" ) ) );
listview->SetItem( i, 2,
wxL2U(playlist_FindGroup(p_playlist,p_playlist->
pp_items[i]->i_group) ) );
if( p_playlist->pp_items[i]->b_enabled == VLC_FALSE )
{
wxListItem listitem;
listitem.m_itemId = i;
listitem.SetTextColour( *wxLIGHT_GREY);
listview->SetItem(listitem);
}
char psz_duration[MSTRTIME_MAX_SIZE];
mtime_t dur = p_playlist->pp_items[i]->i_duration;
if( dur != -1 ) secstotimestr( psz_duration, dur/1000000 );
else memcpy( psz_duration , "-:--:--", sizeof("-:--:--") );
listview->SetItem( i, 3, wxU(psz_duration) );
/* Change the colour for the currenty played stream */
wxListItem listitem;
listitem.m_itemId = i;
if( i == p_playlist->i_index )
{
listitem.SetTextColour( *wxRED );
}
else
{
listitem.SetTextColour( *wxBLACK );
}
listview->SetItem( listitem );
vlc_object_release(p_playlist);
}
/**********************************************************************
* Rebuild the playlist
**********************************************************************/
......@@ -387,32 +474,10 @@ void Playlist::Rebuild()
{
wxString filename = wxL2U(p_playlist->pp_items[i]->psz_name);
listview->InsertItem( i, filename );
listview->SetItem( i, 1, wxL2U(p_playlist->pp_items[i]->psz_author) );
listview->SetItem( i, 2,
wxL2U(playlist_FindGroup( p_playlist,
p_playlist->pp_items[i]->i_group )) );
if( p_playlist->pp_items[i]->b_enabled == VLC_FALSE )
{
wxListItem listitem;
listitem.m_itemId = i;
listitem.SetTextColour( *wxLIGHT_GREY);
listview->SetItem(listitem);
}
char psz_duration[MSTRTIME_MAX_SIZE];
mtime_t dur = p_playlist->pp_items[i]->i_duration;
if( dur != -1 ) secstotimestr( psz_duration, dur/1000000 );
else memcpy( psz_duration , "-:--:--", sizeof("-:--:--") );
listview->SetItem( i, 3, wxU(psz_duration) );
UpdateItem( i );
}
vlc_mutex_unlock( &p_playlist->object_lock );
/* Change the colour for the currenty played stream */
wxListItem listitem;
listitem.m_itemId = p_playlist->i_index;
listitem.SetTextColour( *wxRED );
listview->SetItem( listitem );
if( i_focused )
{
listview->Focus( i_focused );
......@@ -815,10 +880,10 @@ void Playlist::OnEnableSelection( wxCommandEvent& WXUNUSED(event) )
if( listview->IsSelected( item ) )
{
playlist_Enable( p_playlist, item );
UpdateItem( item );
}
}
vlc_object_release( p_playlist);
Rebuild();
}
void Playlist::OnDisableSelection( wxCommandEvent& WXUNUSED(event) )
......@@ -836,10 +901,10 @@ void Playlist::OnDisableSelection( wxCommandEvent& WXUNUSED(event) )
if( listview->IsSelected( item ) )
{
playlist_Disable( p_playlist, item );
UpdateItem( item );
}
}
vlc_object_release( p_playlist);
Rebuild();
}
void Playlist::OnSelectAll( wxCommandEvent& WXUNUSED(event) )
......@@ -912,6 +977,7 @@ void Playlist::OnActivateItem( wxListEvent& event )
vlc_object_release( p_playlist );
}
void Playlist::OnKeyDown( wxListEvent& event )
{
long keycode = event.GetKeyCode();
......@@ -923,7 +989,7 @@ void Playlist::OnKeyDown( wxListEvent& event )
}
}
void Playlist::OnInfos( wxCommandEvent& WXUNUSED(event) )
void Playlist::ShowInfos( int i_item )
{
playlist_t *p_playlist =
(playlist_t *)vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
......@@ -932,18 +998,14 @@ void Playlist::OnInfos( wxCommandEvent& WXUNUSED(event) )
{
return;
}
if( iteminfo_dialog == NULL )
{
/* We use the first selected item, so find it */
long i_item = listview->GetNextItem( i_item, wxLIST_NEXT_ALL,
wxLIST_STATE_SELECTED );
if( i_item >= 0 && i_item < p_playlist->i_size )
{
iteminfo_dialog = new ItemInfoDialog(
p_intf, p_playlist->pp_items[i_item], this );
if( iteminfo_dialog->ShowModal() == wxID_OK )
Rebuild();
UpdateItem( i_item );
delete iteminfo_dialog;
iteminfo_dialog = NULL;
}
......@@ -951,6 +1013,14 @@ void Playlist::OnInfos( wxCommandEvent& WXUNUSED(event) )
vlc_object_release( p_playlist );
}
void Playlist::OnInfos( wxCommandEvent& WXUNUSED(event) )
{
/* We use the first selected item, so find it */
long i_item = listview->GetNextItem( -1 , wxLIST_NEXT_ALL,
wxLIST_STATE_SELECTED );
ShowInfos( i_item );
}
void Playlist::OnEnDis( wxCommandEvent& event )
{
playlist_t *p_playlist =
......@@ -983,6 +1053,65 @@ void Playlist::OnEnDis( wxCommandEvent& event )
vlc_object_release( p_playlist );
}
/*****************************************************************************
* Popup management functions
*****************************************************************************/
void Playlist::OnPopup( wxListEvent& event )
{
i_popup_item = event.GetIndex();
Playlist::PopupMenu( popup_menu , ScreenToClient( wxGetMousePosition() ) );
}
void Playlist::OnPopupPlay( wxMenuEvent& event )
{
playlist_t *p_playlist =
(playlist_t *)vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
FIND_ANYWHERE );
if( p_playlist == NULL )
{
return;
}
if( i_popup_item != -1 )
{
playlist_Goto( p_playlist, i_popup_item );
}
vlc_object_release( p_playlist );
}
void Playlist::OnPopupDel( wxMenuEvent& event )
{
DeleteItem( i_popup_item );
}
void Playlist::OnPopupEna( wxMenuEvent& event )
{
playlist_t *p_playlist =
(playlist_t *)vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
FIND_ANYWHERE );
if( p_playlist == NULL )
{
return;
}
if( p_playlist->pp_items[i_popup_item]->b_enabled )
//playlist_IsEnabled( p_playlist, i_popup_item ) )
{
playlist_Disable( p_playlist, i_popup_item );
}
else
{
playlist_Enable( p_playlist, i_popup_item );
}
vlc_object_release( p_playlist);
UpdateItem( i_popup_item );
}
void Playlist::OnPopupInfo( wxMenuEvent& event )
{
ShowInfos( i_popup_item );
}
/*****************************************************************************
* PlaylistChanged: callback triggered by the intf-change playlist variable
* We don't rebuild the playlist directly here because we don't want the
......@@ -998,6 +1127,29 @@ int PlaylistChanged( vlc_object_t *p_this, const char *psz_variable,
return VLC_SUCCESS;
}
/*****************************************************************************
* Next: callback triggered by the playlist-current playlist variable
*****************************************************************************/
int PlaylistNext( vlc_object_t *p_this, const char *psz_variable,
vlc_value_t old_val, vlc_value_t new_val, void *param )
{
Playlist *p_playlist_dialog = (Playlist *)param;
p_playlist_dialog->UpdateItem( old_val.i_int );
p_playlist_dialog->UpdateItem( new_val.i_int );
return 0;
}
/*****************************************************************************
* ItemChanged: callback triggered by the item-change playlist variable
*****************************************************************************/
int ItemChanged( vlc_object_t *p_this, const char *psz_variable,
vlc_value_t old_val, vlc_value_t new_val, void *param )
{
Playlist *p_playlist_dialog = (Playlist *)param;
p_playlist_dialog->UpdateItem( new_val.i_int );
}
/***************************************************************************
* NewGroup
......
......@@ -2,7 +2,7 @@
* stream.cpp : wxWindows plugin for vlc
*****************************************************************************
* Copyright (C) 2000-2001 VideoLAN
* $Id: streamwizard.cpp,v 1.3 2003/12/22 02:24:52 sam Exp $
* $Id: streamwizard.cpp,v 1.4 2004/01/05 13:00:39 zorglub Exp $
*
* Authors: Clment Stenac <zorglub@videolan.org>
*
......@@ -204,8 +204,12 @@ void StreamDialog::OnStart( wxCommandEvent& event )
for( int i = 0; i < (int)p_open_dialog->mrl.GetCount(); i++ )
{
int i_options = 0, i_total_options;
char **ppsz_options = NULL;
int i_id = playlist_Add( p_playlist,
(const char *)p_open_dialog->mrl[i].mb_str(),
(const char *)p_open_dialog->mrl[i].mb_str(),
PLAYLIST_APPEND | (i ? 0 : PLAYLIST_GO), PLAYLIST_END );
int i_pos = playlist_GetPositionById( p_playlist, i_id );
int i_options = 0;
/* Count the input options */
while( i + i_options + 1 < (int)p_open_dialog->mrl.GetCount() &&
......@@ -215,40 +219,24 @@ void StreamDialog::OnStart( wxCommandEvent& event )
i_options++;
}
/* Allocate ppsz_options */
/* Insert options */
for( int j = 0; j < i_options; j++ )
{
if( !ppsz_options )
ppsz_options = (char **)malloc( sizeof(char *) * i_options );
ppsz_options[j] = strdup( p_open_dialog->mrl[i + j + 1].mb_str() );
playlist_AddOption( p_playlist, i_pos,
p_open_dialog->mrl[i + j + 1].mb_str() );
}
i_total_options = i_options;
/* Get the options from the stream output dialog */
if( sout_mrl.GetCount() )
{
ppsz_options = (char **)realloc( ppsz_options, sizeof(char *) *
(i_total_options + sout_mrl.GetCount()) );
for( int j = 0; j < (int)sout_mrl.GetCount(); j++ )
{
ppsz_options[i_total_options + j] =
strdup( sout_mrl[j].mb_str() );
playlist_AddOption( p_playlist, i_pos ,
sout_mrl[j].mb_str() );
}
i_total_options += sout_mrl.GetCount();
}
msg_Dbg(p_intf,"playings %s",(const char *)p_open_dialog->mrl[i].mb_str());
playlist_Add( p_playlist, (const char *)p_open_dialog->mrl[i].mb_str(),
(const char **)ppsz_options, i_total_options,
PLAYLIST_APPEND | (i ? 0 : PLAYLIST_GO), PLAYLIST_END );
/* clean up */
for( int j = 0; j < i_total_options; j++ )
free( ppsz_options[j] );
if( ppsz_options ) free( ppsz_options );
msg_Dbg(p_intf,"playings %s",
(const char *)p_open_dialog->mrl[i].mb_str());
i += i_options;
}
......
......@@ -2,7 +2,7 @@
* wxwindows.h: private wxWindows interface description
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* $Id: wxwindows.h,v 1.82 2003/12/22 14:31:01 gbazin Exp $
* $Id: wxwindows.h,v 1.83 2004/01/05 13:00:39 zorglub Exp $
*
* Authors: Gildas Bazin <gbazin@netcourrier.com>
*
......@@ -749,12 +749,14 @@ public:
void UpdatePlaylist();
void ShowPlaylist( bool show );
void UpdateItem( int );
bool b_need_update;
vlc_mutex_t lock;
private:
void DeleteItem( int item );
void ShowInfos( int item );
/* Event handlers (these functions should _not_ be virtual) */
void OnAddFile( wxCommandEvent& event );
......@@ -785,12 +787,19 @@ private:
void OnKeyDown( wxListEvent& event );
void OnNewGroup( wxCommandEvent& event );
/* Popup functions */
void OnPopup( wxListEvent& event );
void OnPopupPlay( wxMenuEvent& event );
void OnPopupDel( wxMenuEvent& event );
void OnPopupEna( wxMenuEvent& event );
void OnPopupInfo( wxMenuEvent& event );
void Rebuild();
wxTextCtrl *search_text;
wxButton *search_button;
DECLARE_EVENT_TABLE();
wxMenu *popup_menu;
ItemInfoDialog *iteminfo_dialog;
......@@ -800,6 +809,8 @@ private:
int i_update_counter;
int i_sort_mode;
int i_popup_item;
int i_title_sorted;
int i_author_sorted;
int i_group_sorted;
......@@ -851,6 +862,8 @@ private:
void OnCancel( wxCommandEvent& event );
void OnNewGroup( wxCommandEvent& event );
void UpdateInfo();
DECLARE_EVENT_TABLE();
intf_thread_t *p_intf;
......@@ -868,6 +881,9 @@ private:
wxTextCtrl *name_text;
wxTextCtrl *author_text;
wxTreeCtrl *info_tree;
wxTreeItemId info_root;
wxCheckBox *enabled_checkbox;
wxComboBox *group_combo;
int ids_array[100];
......
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