Commit d7b6f7eb authored by Clément Stenac's avatar Clément Stenac

Improve the open box layout

 * Present the simple options first
 * Put the subtitles file option in the main panel
parent 02b1c7e2
...@@ -31,6 +31,8 @@ ...@@ -31,6 +31,8 @@
#include "charset.h" #include "charset.h"
//#undef HAVE_LIBCDIO // Disable-cruft
#ifdef HAVE_LIBCDIO #ifdef HAVE_LIBCDIO
#include <cdio/cdio.h> #include <cdio/cdio.h>
#include <cdio/cd_types.h> #include <cdio/cd_types.h>
...@@ -72,7 +74,9 @@ enum ...@@ -72,7 +74,9 @@ enum
MRL_Event, MRL_Event,
FileBrowse_Event, FileBrowse_Event,
SubFileBrowse_Event,
FileName_Event, FileName_Event,
SubFileName_Event,
DiscType_Event, DiscType_Event,
#ifdef HAVE_LIBCDIO #ifdef HAVE_LIBCDIO
...@@ -114,6 +118,8 @@ BEGIN_EVENT_TABLE(OpenDialog, wxDialog) ...@@ -114,6 +118,8 @@ BEGIN_EVENT_TABLE(OpenDialog, wxDialog)
/* Events generated by the file panel */ /* Events generated by the file panel */
EVT_TEXT(FileName_Event, OpenDialog::OnFilePanelChange) EVT_TEXT(FileName_Event, OpenDialog::OnFilePanelChange)
EVT_BUTTON(FileBrowse_Event, OpenDialog::OnFileBrowse) EVT_BUTTON(FileBrowse_Event, OpenDialog::OnFileBrowse)
EVT_TEXT(SubFileName_Event, OpenDialog::OnSubFileChange)
EVT_BUTTON(SubFileBrowse_Event, OpenDialog::OnSubFileBrowse)
/* Events generated by the disc panel */ /* Events generated by the disc panel */
EVT_RADIOBOX(DiscType_Event, OpenDialog::OnDiscTypeChange) EVT_RADIOBOX(DiscType_Event, OpenDialog::OnDiscTypeChange)
...@@ -165,13 +171,6 @@ BEGIN_EVENT_TABLE(OpenDialog, wxDialog) ...@@ -165,13 +171,6 @@ BEGIN_EVENT_TABLE(OpenDialog, wxDialog)
END_EVENT_TABLE() END_EVENT_TABLE()
#if 0
/* Perhaps someday we'll figure out how to add media information to
"Stream-and-Media info" when no input thread hasn't been initialized.
*/
extern void MediaInsertCDDA( intf_thread_t *_p_intf, CdIo_t *p_cdio,
track_t i_last_track );
#endif
/***************************************************************************** /*****************************************************************************
* AutoBuiltPanel. * AutoBuiltPanel.
...@@ -415,37 +414,20 @@ OpenDialog::OpenDialog( intf_thread_t *_p_intf, wxWindow *_p_parent, ...@@ -415,37 +414,20 @@ OpenDialog::OpenDialog( intf_thread_t *_p_intf, wxWindow *_p_parent,
wxPanel *panel = new wxPanel( this, -1 ); wxPanel *panel = new wxPanel( this, -1 );
panel->SetAutoLayout( TRUE ); panel->SetAutoLayout( TRUE );
/* Create MRL combobox */
wxBoxSizer *mrl_sizer_sizer = new wxBoxSizer( wxHORIZONTAL );
wxStaticBox *mrl_box = new wxStaticBox( panel, -1,
wxU(_("Media Resource Locator (MRL)")) );
wxStaticBoxSizer *mrl_sizer = new wxStaticBoxSizer( mrl_box,
wxHORIZONTAL );
wxStaticText *mrl_label = new wxStaticText( panel, -1,
wxU(_("Open:")) );
mrl_combo = new wxComboBox( panel, MRL_Event, wxT(""),
wxPoint(20,25), wxSize(120, -1) );
mrl_combo->SetToolTip( wxU(_("You can use this field directly by typing "
"the full MRL you want to open.\n""Alternatively, the field will be "
"filled automatically when you use the controls below.")) );
mrl_sizer->Add( mrl_label, 0, wxALL | wxALIGN_CENTER, 5 );
mrl_sizer->Add( mrl_combo, 1, wxALL | wxALIGN_CENTER, 5 );
mrl_sizer_sizer->Add( mrl_sizer, 1, wxEXPAND | wxALL, 5 );
/* Advanced options */
wxStaticBox *adv_box = new wxStaticBox( panel, -1,
wxU(_("Advanced options")) );
wxStaticBoxSizer *adv_sizer = new wxStaticBoxSizer( adv_box,
wxVERTICAL );
/* Create Static Text */
wxStaticText *label = new wxStaticText( panel, -1,
wxU(_("Alternatively, you can build an MRL using one of the "
"following predefined targets:")) );
wxFlexGridSizer *common_opt_sizer = new wxFlexGridSizer( 5, 1, 20 ); wxFlexGridSizer *common_opt_sizer = new wxFlexGridSizer( 5, 1, 20 );
if( i_method == OPEN_NORMAL ) if( i_method == OPEN_NORMAL )
{ {
/* Create Stream Output checkox */ /* Create Stream Output checkox */
sout_checkbox = new wxCheckBox( panel, SoutEnable_Event, sout_checkbox = new wxCheckBox( panel, SoutEnable_Event,
wxU(_("Stream output")) ); wxU(_("Stream/Save")) );
sout_checkbox->SetToolTip( wxU(_("Use VLC as a server of streams")) ); sout_checkbox->SetToolTip( wxU(_("Use VLC as a server of streams")) );
common_opt_sizer->Add( sout_checkbox, 0, common_opt_sizer->Add( sout_checkbox, 0,
wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL ); wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL );
...@@ -483,6 +465,24 @@ OpenDialog::OpenDialog( intf_thread_t *_p_intf, wxWindow *_p_parent, ...@@ -483,6 +465,24 @@ OpenDialog::OpenDialog( intf_thread_t *_p_intf, wxWindow *_p_parent,
common_opt_sizer->Add( caching_value, 0, common_opt_sizer->Add( caching_value, 0,
wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL ); wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL );
wxBoxSizer *mrl_sizer = new wxBoxSizer( wxHORIZONTAL );
wxStaticText *mrl_label = new wxStaticText( panel, -1,
wxU(_("Customize:")) );
mrl_combo = new wxComboBox( panel, MRL_Event, wxT(""),
wxDefaultPosition, wxDefaultSize );
//Point(20,25), wxSize(120, -1) );
mrl_combo->SetToolTip( wxU(_("You can use this field directly by typing "
"the full MRL you want to open.\n""Alternatively, the field will be "
"filled automatically when you use the controls above.")) );
mrl_sizer->Add( mrl_label, 0, wxALL | wxALIGN_CENTER_VERTICAL, 5 );
mrl_sizer->Add( mrl_combo, 1, wxALL | wxEXPAND | wxALIGN_CENTER_VERTICAL,
5 );
adv_sizer->Add( common_opt_sizer, 0, wxTOP | wxLEFT|wxRIGHT | wxEXPAND, 5 );
adv_sizer->Add( mrl_sizer, 0, wxBOTTOM | wxLEFT|wxRIGHT | wxEXPAND, 5 );
/* Separation */ /* Separation */
wxStaticLine *static_line = new wxStaticLine( panel, wxID_OK ); wxStaticLine *static_line = new wxStaticLine( panel, wxID_OK );
...@@ -569,14 +569,12 @@ OpenDialog::OpenDialog( intf_thread_t *_p_intf, wxWindow *_p_parent, ...@@ -569,14 +569,12 @@ OpenDialog::OpenDialog( intf_thread_t *_p_intf, wxWindow *_p_parent,
button_sizer->Layout(); button_sizer->Layout();
wxBoxSizer *main_sizer = new wxBoxSizer( wxVERTICAL ); wxBoxSizer *main_sizer = new wxBoxSizer( wxVERTICAL );
wxBoxSizer *panel_sizer = new wxBoxSizer( wxVERTICAL ); wxBoxSizer *panel_sizer = new wxBoxSizer( wxVERTICAL );
panel_sizer->Add( mrl_sizer_sizer, 0, wxEXPAND, 5 );
panel_sizer->Add( label, 0, wxEXPAND | wxALL, 5 );
#if (!wxCHECK_VERSION(2,5,2)) #if (!wxCHECK_VERSION(2,5,2))
panel_sizer->Add( notebook_sizer, 1, wxEXPAND | wxALL, 5 ); panel_sizer->Add( notebook_sizer, 1, wxEXPAND | wxALL, 5 );
#else #else
panel_sizer->Add( notebook, 1, wxEXPAND | wxALL, 5 ); panel_sizer->Add( notebook, 1, wxEXPAND | wxALL, 5 );
#endif #endif
panel_sizer->Add( common_opt_sizer, 0, wxALIGN_LEFT | wxALL, 5 ); panel_sizer->Add( adv_sizer, 0, wxEXPAND | wxALL, 5 );
panel_sizer->Add( static_line, 0, wxEXPAND | wxALL, 5 ); panel_sizer->Add( static_line, 0, wxEXPAND | wxALL, 5 );
panel_sizer->Add( button_sizer, 0, wxALIGN_LEFT | wxALL, 5 ); panel_sizer->Add( button_sizer, 0, wxALIGN_LEFT | wxALL, 5 );
panel_sizer->Layout(); panel_sizer->Layout();
...@@ -625,23 +623,30 @@ wxPanel *OpenDialog::FilePanel( wxWindow* parent ) ...@@ -625,23 +623,30 @@ wxPanel *OpenDialog::FilePanel( wxWindow* parent )
/* Create browse file line */ /* Create browse file line */
wxBoxSizer *file_sizer = new wxBoxSizer( wxHORIZONTAL ); wxBoxSizer *file_sizer = new wxBoxSizer( wxHORIZONTAL );
file_combo = new wxComboBox( panel, FileName_Event, wxT(""), file_sizer->Add( new wxStaticText( panel, -1, wxU(_("Open:") ) ), 0,
wxPoint(20,25), wxSize(200, -1) ); wxALL | wxALIGN_CENTER_VERTICAL, 5 );
file_combo = new wxComboBox( panel, FileName_Event, wxT("") );
wxButton *browse_button = new wxButton( panel, FileBrowse_Event, wxButton *browse_button = new wxButton( panel, FileBrowse_Event,
wxU(_("Browse...")) ); wxU(_("Browse...")) );
file_sizer->Add( file_combo, 1, wxALL, 5 ); file_sizer->Add( file_combo, 1, wxALL | wxALIGN_CENTER_VERTICAL, 5 );
file_sizer->Add( browse_button, 0, wxALL, 5 ); file_sizer->Add( browse_button, 0, wxALL | wxALIGN_CENTER_VERTICAL, 5 );
/* Create Subtitles File checkox */ /* Create Subtitles File checkox - button */
wxFlexGridSizer *subsfile_sizer = new wxFlexGridSizer( 2, 1, 20 ); wxFlexGridSizer *subtitles_sizer = new wxFlexGridSizer( 2, 1, 20 );
subsfile_checkbox = new wxCheckBox( panel, SubsFileEnable_Event, subsfile_checkbox = new wxCheckBox( panel, SubsFileEnable_Event,
wxU(_("Subtitle options")) ); wxU(_("Use a subtitles file")) );
subsfile_checkbox->SetToolTip( wxU(_("Force options for separate subtitle files.")) ); subsfile_checkbox->SetToolTip( wxU(_("Use an external subtitles file.")) );
subsfile_sizer->Add( subsfile_checkbox, 0, subtitles_sizer->Add( subsfile_checkbox, 0, wxALIGN_CENTER_VERTICAL |
wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL ); wxALL, 5 );
subsfile_button = new wxButton( panel, SubsFileSettings_Event, subsfile_button = new wxButton( panel, SubsFileSettings_Event,
wxU(_("Settings...")) ); wxU(_("Advanced Settings...")) );
subsfile_button->Disable(); subsfile_button->Disable();
subtitles_sizer->Add( subsfile_button, 1, wxALIGN_CENTER_VERTICAL |
wxALL, 5 );
/* Create subtitles file line */
wxBoxSizer *subfile_sizer = new wxBoxSizer( wxHORIZONTAL );
char *psz_subsfile = config_GetPsz( p_intf, "sub-file" ); char *psz_subsfile = config_GetPsz( p_intf, "sub-file" );
if( psz_subsfile && *psz_subsfile ) if( psz_subsfile && *psz_subsfile )
...@@ -650,13 +655,30 @@ wxPanel *OpenDialog::FilePanel( wxWindow* parent ) ...@@ -650,13 +655,30 @@ wxPanel *OpenDialog::FilePanel( wxWindow* parent )
subsfile_button->Enable(); subsfile_button->Enable();
subsfile_mrl.Add( wxString(wxT("sub-file=")) + wxL2U(psz_subsfile) ); subsfile_mrl.Add( wxString(wxT("sub-file=")) + wxL2U(psz_subsfile) );
} }
if( !psz_subsfile ) psz_subsfile = strdup("");
subfile_sizer->Add( new wxStaticText( panel, -1, wxU(_("File:") ) ),
0, wxALIGN_CENTER_VERTICAL | wxALL, 5 );
subfile_combo = new wxComboBox( panel, SubFileName_Event,
wxL2U( psz_subsfile ) );
if( psz_subsfile ) free( psz_subsfile ); if( psz_subsfile ) free( psz_subsfile );
subbrowse_button = new wxButton( panel, SubFileBrowse_Event,
wxU(_("Browse...")) );
subfile_sizer->Add( subfile_combo, 1, wxALL | wxALIGN_CENTER_VERTICAL, 5 );
subfile_sizer->Add( subbrowse_button, 0, wxALL |wxALIGN_CENTER_VERTICAL, 5 );
subsfile_sizer->Add( subsfile_button, 1, subfile_combo->Disable();
wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL ); subbrowse_button->Disable();
psz_subsfile = config_GetPsz( p_intf, "sub-file" );
if( psz_subsfile && *psz_subsfile )
{
subfile_combo->Enable();
subbrowse_button->Enable();
}
sizer->Add( file_sizer, 0, wxEXPAND | wxALL, 5 ); sizer->Add( file_sizer, 0, wxEXPAND | wxALL, 5 );
sizer->Add( subsfile_sizer, 0, wxEXPAND | wxALL, 5 ); sizer->Add( subtitles_sizer, 0, wxLEFT | wxRIGHT | wxTOP, 5 );
sizer->Add( subfile_sizer, 0, wxEXPAND | wxLEFT | wxRIGHT| wxBOTTOM, 5 );
panel->SetSizerAndFit( sizer ); panel->SetSizerAndFit( sizer );
return panel; return panel;
} }
...@@ -1252,6 +1274,31 @@ void OpenDialog::OnFileBrowse( wxCommandEvent& WXUNUSED(event) ) ...@@ -1252,6 +1274,31 @@ void OpenDialog::OnFileBrowse( wxCommandEvent& WXUNUSED(event) )
} }
} }
void OpenDialog::OnSubFileBrowse( wxCommandEvent& WXUNUSED(event) )
{
wxFileDialog dialog( this, wxU(_("Open subtitles file")),
wxT(""), wxT(""), wxT("*"), wxOPEN );
if( dialog.ShowModal() == wxID_OK )
{
subfile_combo->SetValue( dialog.GetPath() );
}
wxCommandEvent event; OnSubFileChange( event );
}
void OpenDialog::OnSubFileChange( wxCommandEvent& WXUNUSED(event) )
{
if( subsfile_mrl.GetCount() != 0 )
{
subsfile_mrl.RemoveAt( 0 );
subsfile_mrl.Insert( wxString(wxT("sub-file=")) + subfile_combo->GetValue() , 0 );
}
else
{
subsfile_mrl.Add( wxString(wxT("sub-file=")) + subfile_combo->GetValue() );
}
}
/***************************************************************************** /*****************************************************************************
* Disc panel event methods. * Disc panel event methods.
*****************************************************************************/ *****************************************************************************/
...@@ -1742,6 +1789,8 @@ void OpenDialog::OnNetTypeChange( wxCommandEvent& event ) ...@@ -1742,6 +1789,8 @@ void OpenDialog::OnNetTypeChange( wxCommandEvent& event )
void OpenDialog::OnSubsFileEnable( wxCommandEvent& event ) void OpenDialog::OnSubsFileEnable( wxCommandEvent& event )
{ {
subsfile_button->Enable( event.GetInt() != 0 ); subsfile_button->Enable( event.GetInt() != 0 );
subbrowse_button->Enable( event.GetInt() != 0 );
subfile_combo->Enable( event.GetInt() != 0 );
} }
void OpenDialog::OnSubsFileSettings( wxCommandEvent& WXUNUSED(event) ) void OpenDialog::OnSubsFileSettings( wxCommandEvent& WXUNUSED(event) )
...@@ -1753,8 +1802,7 @@ void OpenDialog::OnSubsFileSettings( wxCommandEvent& WXUNUSED(event) ) ...@@ -1753,8 +1802,7 @@ void OpenDialog::OnSubsFileSettings( wxCommandEvent& WXUNUSED(event) )
if( subsfile_dialog && subsfile_dialog->ShowModal() == wxID_OK ) if( subsfile_dialog && subsfile_dialog->ShowModal() == wxID_OK )
{ {
subsfile_mrl.Empty(); subsfile_mrl.Empty();
subsfile_mrl.Add( wxString(wxT("sub-file=")) + subsfile_mrl.Add( wxString(wxT("sub-file=")) + subfile_combo->GetValue() );
subsfile_dialog->file_combo->GetValue() );
if( subsfile_dialog->encoding_combo ) if( subsfile_dialog->encoding_combo )
{ {
subsfile_mrl.Add( wxString(wxT("subsdec-encoding=")) + subsfile_mrl.Add( wxString(wxT("subsdec-encoding=")) +
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* open.hpp: Headers for the Open dialog * open.hpp: Headers for the Open dialog
***************************************************************************** *****************************************************************************
* Copyright (C) 1999-2005 the VideoLAN team * Copyright (C) 1999-2005 the VideoLAN team
* $Id: wxwidgets.h 12670 2005-09-25 11:16:31Z zorglub $ * $Id$
* *
* Authors: Gildas Bazin <gbazin@videolan.org> * Authors: Gildas Bazin <gbazin@videolan.org>
* *
...@@ -75,6 +75,8 @@ private: ...@@ -75,6 +75,8 @@ private:
/* Event handlers for the file page */ /* Event handlers for the file page */
void OnFilePanelChange( wxCommandEvent& event ); void OnFilePanelChange( wxCommandEvent& event );
void OnFileBrowse( wxCommandEvent& event ); void OnFileBrowse( wxCommandEvent& event );
void OnSubFileBrowse( wxCommandEvent& event );
void OnSubFileChange( wxCommandEvent& event );
/* Event handlers for the disc page */ /* Event handlers for the disc page */
void OnDiscPanelChangeSpin( wxSpinEvent& event ); void OnDiscPanelChangeSpin( wxSpinEvent& event );
...@@ -118,6 +120,7 @@ private: ...@@ -118,6 +120,7 @@ private:
/* Controls for the file panel */ /* Controls for the file panel */
wxComboBox *file_combo; wxComboBox *file_combo;
wxComboBox *subfile_combo;
wxFileDialog *file_dialog; wxFileDialog *file_dialog;
/* Controls for the disc panel */ /* Controls for the disc panel */
...@@ -152,6 +155,7 @@ private: ...@@ -152,6 +155,7 @@ private:
/* Controls for the subtitles file */ /* Controls for the subtitles file */
wxButton *subsfile_button; wxButton *subsfile_button;
wxButton *subbrowse_button;
wxCheckBox *subsfile_checkbox; wxCheckBox *subsfile_checkbox;
SubsFileDialog *subsfile_dialog; SubsFileDialog *subsfile_dialog;
wxArrayString subsfile_mrl; wxArrayString subsfile_mrl;
......
...@@ -66,6 +66,7 @@ SubsFileDialog::SubsFileDialog( intf_thread_t *_p_intf, wxWindow* _p_parent ): ...@@ -66,6 +66,7 @@ SubsFileDialog::SubsFileDialog( intf_thread_t *_p_intf, wxWindow* _p_parent ):
wxBoxSizer *main_sizer = new wxBoxSizer( wxVERTICAL ); wxBoxSizer *main_sizer = new wxBoxSizer( wxVERTICAL );
wxBoxSizer *panel_sizer = new wxBoxSizer( wxVERTICAL ); wxBoxSizer *panel_sizer = new wxBoxSizer( wxVERTICAL );
#if 0
/* Create the subtitles file textctrl */ /* Create the subtitles file textctrl */
wxBoxSizer *file_sizer_sizer = new wxBoxSizer( wxHORIZONTAL ); wxBoxSizer *file_sizer_sizer = new wxBoxSizer( wxHORIZONTAL );
wxStaticBox *file_box = new wxStaticBox( panel, -1, wxStaticBox *file_box = new wxStaticBox( panel, -1,
...@@ -83,6 +84,7 @@ SubsFileDialog::SubsFileDialog( intf_thread_t *_p_intf, wxWindow* _p_parent ): ...@@ -83,6 +84,7 @@ SubsFileDialog::SubsFileDialog( intf_thread_t *_p_intf, wxWindow* _p_parent ):
file_sizer->Add( browse_button, 0, wxALL, 5 ); file_sizer->Add( browse_button, 0, wxALL, 5 );
file_sizer_sizer->Add( file_sizer, 1, wxEXPAND | wxALL, 5 ); file_sizer_sizer->Add( file_sizer, 1, wxEXPAND | wxALL, 5 );
panel_sizer->Add( file_sizer, 0, wxEXPAND | wxALL, 5 ); panel_sizer->Add( file_sizer, 0, wxEXPAND | wxALL, 5 );
#endif
/* Subtitles encoding */ /* Subtitles encoding */
encoding_combo = NULL; encoding_combo = NULL;
...@@ -281,6 +283,7 @@ void SubsFileDialog::OnCancel( wxCommandEvent& WXUNUSED(event) ) ...@@ -281,6 +283,7 @@ void SubsFileDialog::OnCancel( wxCommandEvent& WXUNUSED(event) )
void SubsFileDialog::OnFileBrowse( wxCommandEvent& WXUNUSED(event) ) void SubsFileDialog::OnFileBrowse( wxCommandEvent& WXUNUSED(event) )
{ {
#if 0
wxFileDialog dialog( this, wxU(_("Open file")), wxFileDialog dialog( this, wxU(_("Open file")),
wxT(""), wxT(""), wxT("*"), wxOPEN ); wxT(""), wxT(""), wxT("*"), wxOPEN );
...@@ -288,4 +291,5 @@ void SubsFileDialog::OnFileBrowse( wxCommandEvent& WXUNUSED(event) ) ...@@ -288,4 +291,5 @@ void SubsFileDialog::OnFileBrowse( wxCommandEvent& WXUNUSED(event) )
{ {
file_combo->SetValue( dialog.GetPath() ); file_combo->SetValue( dialog.GetPath() );
} }
#endif
} }
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