X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=modules%2Fgui%2Fwxwidgets%2Fdialogs%2Fvlm%2Fvlm_panel.cpp;h=e67304e22b2d38d4ad25c52b5c1adcf80dbe386e;hb=bea071185469b6536ae344df06f18cd6584bf68d;hp=537eb87ab2d96c835dd5361cd34d054574730c3b;hpb=237f16e4519ff703396fd92b1cb49c7dc26c5bb2;p=vlc diff --git a/modules/gui/wxwidgets/dialogs/vlm/vlm_panel.cpp b/modules/gui/wxwidgets/dialogs/vlm/vlm_panel.cpp index 537eb87ab2..e67304e22b 100644 --- a/modules/gui/wxwidgets/dialogs/vlm/vlm_panel.cpp +++ b/modules/gui/wxwidgets/dialogs/vlm/vlm_panel.cpp @@ -2,9 +2,9 @@ * vlm_panel.cpp: VLM Panel ***************************************************************************** * Copyright (C) 2000-2005 the VideoLAN team - * $Id: playlist.cpp 12582 2005-09-17 14:15:32Z zorglub $ + * $Id$ * - * Authors: Clément Stenac + * Authors: Clément Stenac * * This program is free software; you can redistribute it and/OR MODIFy * it under the terms of the GNU General Public License as published by @@ -18,28 +18,29 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA. + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. *****************************************************************************/ #include "dialogs/vlm/vlm_panel.hpp" #include "dialogs/vlm/vlm_wrapper.hpp" #include "dialogs/vlm/vlm_stream.hpp" #include "dialogs/vlm/vlm_streampanel.hpp" +#include + +#include "charset.h" enum { Notebook_Event, Timer_Event, - Close_Event, Load_Event, - Save_Event, }; BEGIN_EVENT_TABLE( VLMPanel, wxPanel) EVT_TIMER( Timer_Event, VLMPanel::OnTimer ) - EVT_BUTTON( Close_Event, VLMPanel::OnClose ) + EVT_BUTTON( wxID_CLOSE, VLMPanel::OnClose ) EVT_BUTTON( Load_Event, VLMPanel::OnLoad ) - EVT_BUTTON( Save_Event, VLMPanel::OnSave ) + EVT_BUTTON( wxID_SAVE, VLMPanel::OnSave ) END_EVENT_TABLE() @@ -62,7 +63,9 @@ VLMPanel::VLMPanel( intf_thread_t *_p_intf, wxWindow *_p_parent ) : wxNotebookSizer *notebook_sizer = new wxNotebookSizer( p_notebook ); #endif p_notebook->AddPage( BroadcastPanel( p_notebook ), wxU( _("Broadcasts") ) ); +#if 0 p_notebook->AddPage( VODPanel( p_notebook ), wxU( _("VOD") ) ); +#endif #if (!wxCHECK_VERSION(2,5,0)) panel_sizer->Add( notebook_sizer, 1, wxEXPAND | wxALL, 5 ); #else @@ -70,10 +73,10 @@ VLMPanel::VLMPanel( intf_thread_t *_p_intf, wxWindow *_p_parent ) : #endif wxBoxSizer *button_sizer = new wxBoxSizer( wxHORIZONTAL ); - button_sizer->Add( new wxButton( this, Close_Event, wxU(_("Close") ) ) ); + button_sizer->Add( new wxButton( this, wxID_CLOSE, wxU(_("&Close") ) ) ); button_sizer->Add( 0, 0, 1 ); button_sizer->Add( new wxButton( this, Load_Event, wxU(_("Load") ) ), 0, wxRIGHT, 10 ); - button_sizer->Add( new wxButton( this, Save_Event, wxU(_("Save") ) ) ); + button_sizer->Add( new wxButton( this, wxID_SAVE, wxU(_("&Save") ) ) ); panel_sizer->Add( button_sizer, 0 , wxEXPAND | wxALL, 5 ); panel_sizer->Layout(); @@ -211,10 +214,10 @@ void VLMPanel::OnLoad( wxCommandEvent &event ) wxT("*"), wxOPEN | wxMULTIPLE ); if( p_file_dialog == NULL ) return; - p_file_dialog->SetTitle( wxU(_("Load configuration") ) ); + p_file_dialog->SetTitle( wxU(_("Load Configuration") ) ); if( p_file_dialog->ShowModal() == wxID_OK ) { - vlm_Load( p_vlm->GetVLM(), p_file_dialog->GetPath().mb_str() ); + vlm_Load( p_vlm->GetVLM(), p_file_dialog->GetPath().mb_str(wxConvUTF8) ); } Update(); } @@ -225,10 +228,10 @@ void VLMPanel::OnSave( wxCommandEvent &event ) wxT("*"), wxSAVE | wxOVERWRITE_PROMPT ); if( p_file_dialog == NULL ) return; - p_file_dialog->SetTitle( wxU(_("Save configuration") ) ); + p_file_dialog->SetTitle( wxU(_("Save Configuration") ) ); if( p_file_dialog->ShowModal() == wxID_OK ) { - vlm_Save( p_vlm->GetVLM(), p_file_dialog->GetPath().mb_str() ); + vlm_Save( p_vlm->GetVLM(), p_file_dialog->GetPath().mb_str(wxConvUTF8) ); } } @@ -248,6 +251,9 @@ wxPanel * VLMPanel::BroadcastPanel( wxWindow *parent ) broadcasts_sizer->Add( box_sizer, 0, wxEXPAND|wxALL, 5 ); + wxStaticLine *static_line = new wxStaticLine( broadcasts_panel, wxID_ANY ); + broadcasts_sizer->Add( static_line, 0, wxEXPAND | wxALL, 5 ); + scrolled_broadcasts = new wxScrolledWindow( broadcasts_panel, -1, wxDefaultPosition, wxDefaultSize, wxBORDER_NONE | wxVSCROLL ); @@ -347,25 +353,31 @@ VLMAddStreamPanel::VLMAddStreamPanel( intf_thread_t *_p_intf, wxPanel( _p_parent, -1, wxDefaultPosition, wxDefaultSize ) { p_intf = _p_intf; + p_parent = _p_parent; p_vlm = _p_vlm; b_edit = _b_edit; b_broadcast = _b_broadcast; + p_open_dialog = NULL; + p_sout_dialog = NULL; + SetAutoLayout( TRUE ); wxBoxSizer *panel_sizer = new wxBoxSizer( wxVERTICAL ); - wxFlexGridSizer *upper_sizer = new wxFlexGridSizer( 5,2 ); - upper_sizer->AddGrowableCol( 1, 1 ); - upper_sizer->AddGrowableCol( 3, 1 ); + wxFlexGridSizer *upper_sizer = new wxFlexGridSizer( 5, 2 ); + upper_sizer->AddGrowableCol( 1 ); + upper_sizer->AddGrowableCol( 3 ); - upper_sizer->Add( new wxStaticText( this, -1, wxU( _("Name") ) ) ); - name_text = new wxTextCtrl( this, -1, wxU( _("") ), wxDefaultPosition, + upper_sizer->Add( new wxStaticText( this, -1, wxU( _("Name") ) ), 0, + wxALIGN_CENTER_VERTICAL, 0 ); + name_text = new wxTextCtrl( this, -1, wxU( "" ), wxDefaultPosition, wxSize( 150, -1 ) ); upper_sizer->Add( name_text , 1, wxEXPAND | wxLEFT | wxRIGHT, 5 ); - upper_sizer->Add( new wxStaticText( this, -1, wxU( _("Input") ) ) ); - input_text = new wxTextCtrl( this, -1, wxU( _("") ) , + upper_sizer->Add( new wxStaticText( this, -1, wxU( _("Input") ) ), 0, + wxALIGN_CENTER_VERTICAL, 0 ); + input_text = new wxTextCtrl( this, -1, wxU( "" ) , wxDefaultPosition, wxSize( 150, -1 ) ); upper_sizer->Add( input_text , 1, wxEXPAND | wxLEFT | wxRIGHT, 5 ); upper_sizer->Add( new wxButton( this, ChooseInput_Event, wxU( _("Choose") ) ) ); @@ -373,8 +385,9 @@ VLMAddStreamPanel::VLMAddStreamPanel( intf_thread_t *_p_intf, upper_sizer->Add( 0,0 ); upper_sizer->Add( 0,0 ); - upper_sizer->Add( new wxStaticText( this, -1, wxU( _("Output") ) ) ); - output_text = new wxTextCtrl( this, -1, wxU( _("") ) , + upper_sizer->Add( new wxStaticText( this, -1, wxU( _("Output") ) ), 0, + wxALIGN_CENTER_VERTICAL, 0 ); + output_text = new wxTextCtrl( this, -1, wxU( "" ) , wxDefaultPosition, wxSize( 150, -1 ) ); upper_sizer->Add( output_text, 1, wxEXPAND | wxLEFT | wxRIGHT, 5 ); upper_sizer->Add( new wxButton( this, ChooseOutput_Event, @@ -383,12 +396,6 @@ VLMAddStreamPanel::VLMAddStreamPanel( intf_thread_t *_p_intf, panel_sizer->Add( upper_sizer, 0, wxEXPAND | wxALL, 5 ); wxBoxSizer *lower_sizer = new wxBoxSizer( wxHORIZONTAL ); - lower_sizer->Add( new wxButton( this, Create_Event, - wxU( _( b_edit ? "Edit" : "Create" ) ) ), - 0 , wxEXPAND | wxALL , 5 ); - lower_sizer->Add( new wxButton( this, Clear_Event, wxU( _( "Clear" ) ) ), - 0 , wxEXPAND | wxALL , 5 ); - enabled_checkbox = new wxCheckBox( this, -1, wxU( _("Enabled" ) ) ); enabled_checkbox->SetValue( true ); lower_sizer->Add( enabled_checkbox, 1 , wxEXPAND | wxALL , 5 ); @@ -398,6 +405,17 @@ VLMAddStreamPanel::VLMAddStreamPanel( intf_thread_t *_p_intf, lower_sizer->Add( loop_checkbox, 1 , wxEXPAND | wxALL , 5 ); } + if( !b_edit ) + { + lower_sizer->Add( new wxButton( this, wxID_CLEAR, + wxU( _( "&Clear" ) ) ), + 0 , wxEXPAND | wxALL , 5 ); + } + lower_sizer->Add( new wxButton( this, Create_Event, + wxU( _( b_edit ? "OK" : "Create" ) ) ), + 0 , wxEXPAND | wxALL , 5 ); + + panel_sizer->Add( lower_sizer, 0 , wxEXPAND| wxALL, 5 ); panel_sizer->Layout(); SetSizerAndFit( panel_sizer ); @@ -423,9 +441,9 @@ void VLMAddStreamPanel::Load( VLMStream *p_stream ) void VLMAddStreamPanel::OnCreate( wxCommandEvent &event ) { - char *psz_name = FromLocale( name_text->GetValue().mb_str() ); - char *psz_input = FromLocale( input_text->GetValue().mb_str() ); - char *psz_output = FromLocale( output_text->GetValue().mb_str() ); + char *psz_name = wxFromLocale( name_text->GetValue() ); + char *psz_input = wxFromLocale( input_text->GetValue() ); + char *psz_output = wxFromLocale( output_text->GetValue() ); if( b_broadcast && ! b_edit ) { p_vlm->AddBroadcast( psz_name, psz_input, psz_output, @@ -450,10 +468,12 @@ void VLMAddStreamPanel::OnCreate( wxCommandEvent &event ) enabled_checkbox->IsChecked() ? VLC_TRUE: VLC_FALSE, loop_checkbox->IsChecked() ? VLC_TRUE : VLC_FALSE ); } - LocaleFree( psz_name) ; LocaleFree( psz_input ) ; - LocaleFree( psz_output); + wxLocaleFree( psz_name) ; wxLocaleFree( psz_input ) ; + wxLocaleFree( psz_output); if( !b_edit ) OnClear( event ); + if( b_edit ) + p_parent->Hide(); } void VLMAddStreamPanel::OnClear( wxCommandEvent &event ) @@ -481,7 +501,9 @@ void VLMAddStreamPanel::OnChooseOutput( wxCommandEvent &event ) if( p_sout_dialog && p_sout_dialog->ShowModal() == wxID_OK ) { - output_text->SetValue( (p_sout_dialog->GetOptions())[0] ); + wxString sout = (p_sout_dialog->GetOptions())[0] ; + sout = sout.AfterFirst( '=' ); + output_text->SetValue( sout ); } } @@ -497,7 +519,7 @@ BEGIN_EVENT_TABLE( VLMFrame, wxFrame ) END_EVENT_TABLE() VLMFrame::VLMFrame( intf_thread_t *_p_intf, wxWindow *_p_parent ) : - wxFrame( _p_parent, -1, wxU( _("VLM configuration") ), + wxFrame( _p_parent, -1, wxU( _("VLM") ), wxDefaultPosition, wxSize( 640,480 ), wxDEFAULT_FRAME_STYLE ) { SetIcon( *_p_intf->p_sys->p_icon ); @@ -505,7 +527,11 @@ VLMFrame::VLMFrame( intf_thread_t *_p_intf, wxWindow *_p_parent ) : wxBoxSizer *main_sizer = new wxBoxSizer( wxHORIZONTAL ); vlm_panel = new VLMPanel( _p_intf, this ); +#if defined(WIN32) + main_sizer->Add( vlm_panel, 1, wxGROW, 0 ); +#else main_sizer->Add( vlm_panel, 1, wxEXPAND | wxALL, 5 ); +#endif main_sizer->Layout(); SetSizerAndFit( main_sizer ); }