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;
}
......
This diff is collapsed.
......@@ -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