]> git.sesse.net Git - vlc/blobdiff - modules/gui/wxwindows/subtitles.cpp
* added SAP group announcing support in the sout dialog
[vlc] / modules / gui / wxwindows / subtitles.cpp
index b9bc995b45a388ec08b6234d98165d400fbcfd01..0984f4af6663f2ccb8b35e929957c042c5d59a29 100644 (file)
@@ -2,7 +2,7 @@
  * subtitles.cpp : wxWindows plugin for vlc
  *****************************************************************************
  * Copyright (C) 2000-2001 VideoLAN
- * $Id: subtitles.cpp,v 1.7 2003/10/29 12:23:50 gbazin Exp $
+ * $Id$
  *
  * Authors: Gildas Bazin <gbazin@netcourrier.com>
  *
@@ -33,9 +33,7 @@
 #include <vlc/intf.h>
 
 #include "wxwindows.h"
-#include <wx/textctrl.h>
 #include <wx/combobox.h>
-#include <wx/spinctrl.h>
 #include <wx/statline.h>
 
 #ifndef wxRB_SINGLE
@@ -64,7 +62,7 @@ END_EVENT_TABLE()
  * Constructor.
  *****************************************************************************/
 SubsFileDialog::SubsFileDialog( intf_thread_t *_p_intf, wxWindow* _p_parent ):
-    wxDialog( _p_parent, -1, wxU(_("Open Subtitles File")),
+    wxDialog( _p_parent, -1, wxU(_("Subtitle options")),
               wxDefaultPosition, wxDefaultSize, wxDEFAULT_FRAME_STYLE )
 {
     /* Initializations */
@@ -85,8 +83,8 @@ SubsFileDialog::SubsFileDialog( intf_thread_t *_p_intf, wxWindow* _p_parent ):
     wxStaticBoxSizer *file_sizer = new wxStaticBoxSizer( file_box,
                                                         wxHORIZONTAL );
     char *psz_subsfile = config_GetPsz( p_intf, "sub-file" );
-    file_combo = new wxComboBox( panel, -1,
-                                 psz_subsfile ? wxU(psz_subsfile) : wxT(""),
+    if( !psz_subsfile ) psz_subsfile = strdup("");
+    file_combo = new wxComboBox( panel, -1, wxL2U(psz_subsfile),
                                  wxPoint(20,25), wxSize(300, -1), 0, NULL );
     if( psz_subsfile ) free( psz_subsfile );
     wxButton *browse_button = new wxButton( panel, FileBrowse_Event,
@@ -127,8 +125,8 @@ SubsFileDialog::SubsFileDialog( intf_thread_t *_p_intf, wxWindow* _p_parent ):
         encoding_combo->SetValue( wxU(p_item->psz_value) );
         encoding_combo->SetToolTip( wxU(p_item->psz_longtext) );
 
-        enc_sizer->Add( label, 0, wxALL, 5 );
-        enc_sizer->Add( encoding_combo, 0, wxALL, 5 );
+        enc_sizer->Add( label, 0, wxALL | wxALIGN_CENTER, 5 );
+        enc_sizer->Add( encoding_combo, 0, wxEXPAND | wxALL | wxALIGN_CENTER, 5 );
         enc_sizer_sizer->Add( enc_sizer, 1, wxEXPAND | wxALL, 5 );
         panel_sizer->Add( enc_sizer, 0, wxEXPAND | wxALL, 5 );
     }
@@ -137,22 +135,79 @@ SubsFileDialog::SubsFileDialog( intf_thread_t *_p_intf, wxWindow* _p_parent ):
     wxBoxSizer *misc_sizer_sizer = new wxBoxSizer( wxHORIZONTAL );
     wxStaticBox *misc_box = new wxStaticBox( panel, -1,
                                              wxU(_("Subtitles options")) );
+
     wxStaticBoxSizer *misc_sizer = new wxStaticBoxSizer( misc_box,
-                                                         wxHORIZONTAL );
-    wxStaticText *label =
-        new wxStaticText(panel, -1, wxU(_("Delay subtitles (in 1/10s)")));
-    int i_delay = config_GetInt( p_intf, "sub-delay" );
-    /* Outside the new wxSpinCtrl to avoid an internal error in gcc2.95 ! */
-    wxString format_delay(wxString::Format(wxT("%d"), i_delay));
-    delay_spinctrl = new wxSpinCtrl( panel, -1, format_delay,
+                                                         wxVERTICAL );
+
+    wxFlexGridSizer *grid_sizer = new wxFlexGridSizer( 2, 1, 20 );
+
+    /* Font size */
+    p_item =
+        config_FindConfig( VLC_OBJECT(p_intf), "freetype-rel-fontsize" );
+    if( p_item )
+    {
+        wxBoxSizer *size_sizer = new wxBoxSizer( wxHORIZONTAL );
+        wxStaticText *label =
+            new wxStaticText(panel, -1, wxU(p_item->psz_text));
+        size_combo = new wxComboBox( panel, -1, wxT(""),
                                      wxDefaultPosition, wxDefaultSize,
-                                     wxSP_ARROW_KEYS,
-                                     -650000, 650000, i_delay );
+                                     0, NULL, wxCB_READONLY );
 
-    misc_sizer->Add( label, 0, wxALL, 5 );
-    misc_sizer->Add( delay_spinctrl, 0, wxALL, 5 );
+        /* build a list of available options */
+        for( int i_index = 0; i_index < p_item->i_list; i_index++ )
+        {
+            size_combo->Append( wxU(p_item->ppsz_list_text[i_index]),
+                                (void *)p_item->pi_list[i_index] );
+            if( p_item->i_value == p_item->pi_list[i_index] )
+            {
+                size_combo->SetSelection( i_index );
+                size_combo->SetValue(wxU(p_item->ppsz_list_text[i_index]));
+            }
+        }
+
+        size_combo->SetToolTip( wxU(p_item->psz_longtext) );
+
+        size_sizer->Add( label, 0,  wxRIGHT | wxALIGN_CENTER, 5 );
+        size_sizer->Add( size_combo, 0, wxLEFT | wxALIGN_CENTER, 5 );
+        grid_sizer->Add( size_sizer, 1, wxEXPAND | wxALL, 5 );
+    }
 
-    label = new wxStaticText(panel, -1, wxU(_("Frames per second")));
+    p_item =
+        config_FindConfig( VLC_OBJECT(p_intf), "subsdec-align" );
+    if( p_item )
+    {
+        wxBoxSizer *align_sizer = new wxBoxSizer( wxHORIZONTAL );
+        wxStaticText *label =
+            new wxStaticText(panel, -1, wxU(p_item->psz_text));
+        align_combo = new wxComboBox( panel, -1, wxT(""),
+                                     wxDefaultPosition, wxDefaultSize,
+                                     0, NULL, wxCB_READONLY );
+
+        /* build a list of available options */
+        for( int i_index = 0; i_index < p_item->i_list; i_index++ )
+        {
+            align_combo->Append( wxU(p_item->ppsz_list_text[i_index]),
+                                (void *)p_item->pi_list[i_index] );
+            if( p_item->i_value == p_item->pi_list[i_index] )
+            {
+                align_combo->SetSelection( i_index );
+                align_combo->SetValue(wxU(p_item->ppsz_list_text[i_index]));
+            }
+        }
+
+        align_combo->SetToolTip( wxU(p_item->psz_longtext) );
+
+        align_sizer->Add( label, 0,  wxRIGHT | wxALIGN_CENTER, 5 );
+        align_sizer->Add( align_combo, 0, wxLEFT | wxALIGN_CENTER, 5 );
+        grid_sizer->Add( align_sizer, 1, wxEXPAND | wxALL, 5 );
+    }
+
+    misc_sizer->Add( grid_sizer, 1, wxEXPAND | wxALL , 5 );
+
+    grid_sizer = new wxFlexGridSizer( 4, 1, 20 );
+
+    wxStaticText *label =
+        new wxStaticText(panel, -1, wxU(_("Frames per second")));
 
     float f_fps = config_GetFloat( p_intf, "sub-fps" );
     /* Outside the new wxSpinCtrl to avoid an internal error in gcc2.95 ! */
@@ -162,11 +217,30 @@ SubsFileDialog::SubsFileDialog( intf_thread_t *_p_intf, wxWindow* _p_parent ):
                                    wxSP_ARROW_KEYS,
                                    0, 16000, (int)f_fps );
     fps_spinctrl->SetToolTip( wxU(_("Override frames per second. "
-                              "It will only work with MicroDVD subtitles.")) );
-    misc_sizer->Add( label, 0, wxALL, 5 );
-    misc_sizer->Add( fps_spinctrl, 0, wxALL, 5 );
+               "It will only work with MicroDVD and SubRIP subtitles.")) );
+    grid_sizer->Add( label, 0, wxALIGN_CENTER, 5 );
+    grid_sizer->Add( fps_spinctrl, 0,wxALIGN_CENTER, 5 );
+
+
+    wxStaticText *label_delay =
+        new wxStaticText(panel, -1, wxU(_("Delay")));
+
+    int i_delay = config_GetInt( p_intf, "sub-delay" );
+    /* Outside the new wxSpinCtrl to avoid an internal error in gcc2.95 ! */
+    wxString format_delay(wxString::Format(wxT("%i"), i_delay ));
+    delay_spinctrl = new wxSpinCtrl( panel, -1, format_delay,
+                                     wxDefaultPosition, wxDefaultSize,
+                                     wxSP_ARROW_KEYS,
+                                     0, 16000, i_delay );
+    delay_spinctrl->SetToolTip( wxU(_("Set subtitle delay (in 1/10s)" ) ) );
+
+    grid_sizer->Add( label_delay , 0, wxALIGN_CENTER, 5 );
+    grid_sizer->Add( delay_spinctrl, 0, wxALIGN_CENTER, 5 );
+
+    misc_sizer->Add( grid_sizer, 0, wxALL, 5 );
 
     misc_sizer_sizer->Add( misc_sizer, 1, wxEXPAND | wxALL, 5 );
+
     panel_sizer->Add( misc_sizer, 0, wxEXPAND | wxALL, 5 );
 
     /* Separation */