]> git.sesse.net Git - vlc/blobdiff - modules/gui/wxwindows/preferences.cpp
* src/video_output/video_output.c: new "deinterlace" object variable.
[vlc] / modules / gui / wxwindows / preferences.cpp
index 2c5e2c93dffb0804ffafaab816e4b68321d570e6..4ae1f9cbd420254b35a85e161fd4f3fef04b9dde 100644 (file)
@@ -2,7 +2,7 @@
  * preferences.cpp : wxWindows plugin for vlc
  *****************************************************************************
  * Copyright (C) 2000-2001 VideoLAN
- * $Id: preferences.cpp,v 1.11 2003/04/21 00:54:26 ipkiss Exp $
+ * $Id: preferences.cpp,v 1.16 2003/05/22 21:42:43 gbazin Exp $
  *
  * Authors: Gildas Bazin <gbazin@netcourrier.com>
  *
 
 #if defined MODULE_NAME_IS_skins
 #   include "../skins/src/skin_common.h"
-#   include "../skins/src/wxdialogs.h"
-#else
-#   include "wxwindows.h"
 #endif
 
+#include "wxwindows.h"
 
 #ifndef wxRB_SINGLE
 #   define wxRB_SINGLE 0
@@ -78,6 +76,7 @@ public:
     virtual ~PrefsTreeCtrl();
 
     void ApplyChanges();
+    void CleanChanges();
 
 private:
     /* Event handlers (these functions should _not_ be virtual) */
@@ -99,7 +98,7 @@ struct ConfigData
     ConfigData( wxPanel *_panel, int _i_conf_type,
                 vlc_bool_t _b_advanced, char *psz_name )
     { panel = _panel; b_advanced = _b_advanced; b_config_list = VLC_FALSE;
-      i_config_type = _i_conf_type; option_name = psz_name; }
+      i_config_type = _i_conf_type; option_name = wxU(psz_name); }
 
     vlc_bool_t b_advanced;
     int i_config_type;
@@ -127,8 +126,7 @@ public:
 
     PrefsPanel() { }
     PrefsPanel( wxWindow *parent, intf_thread_t *_p_intf,
-                PrefsDialog *_p_prefs_dialog,
-                module_t *p_module, char * );
+                PrefsDialog *_p_prefs_dialog, int i_object_id, char * );
     virtual ~PrefsPanel() {}
 
     void ApplyChanges();
@@ -152,11 +150,13 @@ class ConfigTreeData : public wxTreeItemData
 {
 public:
 
-    ConfigTreeData() { panel == NULL; }
+    ConfigTreeData() { panel = NULL; psz_section = NULL; }
     virtual ~ConfigTreeData() { if( panel ) delete panel; }
 
     PrefsPanel *panel;
     wxBoxSizer *sizer;
+    int i_object_id;
+    char *psz_section;
 };
 
 class ConfigEvtHandler : public wxEvtHandler
@@ -184,7 +184,7 @@ enum
 {
     Notebook_Event = wxID_HIGHEST,
     MRL_Event,
-    Reset_Event,
+    ResetAll_Event,
     Advanced_Event,
 };
 
@@ -193,6 +193,7 @@ BEGIN_EVENT_TABLE(PrefsDialog, wxFrame)
     EVT_BUTTON(wxID_OK, PrefsDialog::OnOk)
     EVT_BUTTON(wxID_CANCEL, PrefsDialog::OnCancel)
     EVT_BUTTON(wxID_SAVE, PrefsDialog::OnSave)
+    EVT_BUTTON(ResetAll_Event, PrefsDialog::OnResetAll)
 
     /* Don't destroy the window when the user closes it */
     EVT_CLOSE(PrefsDialog::OnCancel)
@@ -225,7 +226,7 @@ END_EVENT_TABLE()
  * Constructor.
  *****************************************************************************/
 PrefsDialog::PrefsDialog( intf_thread_t *_p_intf, Interface *_p_main_interface)
-  :  wxFrame( _p_main_interface, -1, _("Preferences"), wxDefaultPosition,
+  :  wxFrame( _p_main_interface, -1, wxU(_("Preferences")), wxDefaultPosition,
               wxSize(650,450), wxDEFAULT_FRAME_STYLE )
 {
     /* Initializations */
@@ -246,18 +247,20 @@ PrefsDialog::PrefsDialog( intf_thread_t *_p_intf, Interface *_p_main_interface)
     wxStaticLine *static_line = new wxStaticLine( panel, wxID_OK );
 
     /* Create the buttons */
-    wxButton *ok_button = new wxButton( panel, wxID_OK, _("OK") );
+    wxButton *ok_button = new wxButton( panel, wxID_OK, wxU(_("OK")) );
     ok_button->SetDefault();
-    wxButton *cancel_button = new wxButton( panel, wxID_CANCEL, _("Cancel") );
-    wxButton *save_button = new wxButton( panel, wxID_SAVE, _("Save") );
-    //wxButton *reset_button = new wxButton( panel, Reset_Event, _("Reset") );
+    wxButton *cancel_button = new wxButton( panel, wxID_CANCEL,
+                                            wxU(_("Cancel")) );
+    wxButton *save_button = new wxButton( panel, wxID_SAVE, wxU(_("Save")) );
+    wxButton *reset_button = new wxButton( panel, ResetAll_Event,
+                                           wxU(_("Reset All")) );
 
     /* Place everything in sizers */
     wxBoxSizer *button_sizer = new wxBoxSizer( wxHORIZONTAL );
     button_sizer->Add( ok_button, 0, wxALL, 5 );
     button_sizer->Add( cancel_button, 0, wxALL, 5 );
     button_sizer->Add( save_button, 0, wxALL, 5 );
-    //button_sizer->Add( reset_button, 0, wxALL, 5 );
+    button_sizer->Add( reset_button, 0, wxALL, 5 );
     button_sizer->Layout();
 
     wxBoxSizer *main_sizer = new wxBoxSizer( wxVERTICAL );
@@ -288,22 +291,38 @@ PrefsDialog::~PrefsDialog()
 void PrefsDialog::OnOk( wxCommandEvent& WXUNUSED(event) )
 {
     prefs_tree->ApplyChanges();
-
     this->Hide();
+    prefs_tree->CleanChanges();
 }
 
 void PrefsDialog::OnCancel( wxCommandEvent& WXUNUSED(event) )
 {
     this->Hide();
+    prefs_tree->CleanChanges();
 }
 
 void PrefsDialog::OnSave( wxCommandEvent& WXUNUSED(event) )
 {
     prefs_tree->ApplyChanges();
-
     config_SaveConfigFile( p_intf, NULL );
 }
 
+void PrefsDialog::OnResetAll( wxCommandEvent& WXUNUSED(event) )
+{
+    wxMessageDialog dlg( this,
+        wxU(_("Beware this will reset your VLC Media Player config file.\n"
+              "Are you sure you want to continue?")),
+        wxU(_("Reset config file")), wxYES_NO|wxNO_DEFAULT|wxCENTRE );
+
+    if ( dlg.ShowModal() == wxID_YES )
+    {
+        /* TODO: need to reset all the controls */
+        config_ResetAll( p_intf );
+        prefs_tree->CleanChanges();
+        config_SaveConfigFile( p_intf, NULL );
+    }
+}
+
 /*****************************************************************************
  * PrefsTreeCtrl class definition.
  *****************************************************************************/
@@ -326,7 +345,7 @@ PrefsTreeCtrl::PrefsTreeCtrl( wxWindow *_p_parent, intf_thread_t *_p_intf,
     p_sizer = _p_sizer;
     p_parent = _p_parent;
 
-    root_item = AddRoot( "" );
+    root_item = AddRoot( wxT("") );
 
     /* List the plugins */
     p_list = vlc_list_find( p_intf, VLC_OBJECT_MODULE, FIND_ANYWHERE );
@@ -345,7 +364,8 @@ PrefsTreeCtrl::PrefsTreeCtrl( wxWindow *_p_parent, intf_thread_t *_p_intf,
     {
         /* We found the main module */
 
-        /* Enumerate config options and add corresponding config boxes */
+        /* Enumerate config categories and store a reference so we can
+         * generate their config panel them when it is asked by the user. */
         p_item = p_module->p_config;
 
         if( p_item ) do
@@ -354,13 +374,12 @@ PrefsTreeCtrl::PrefsTreeCtrl( wxWindow *_p_parent, intf_thread_t *_p_intf,
             {
             case CONFIG_HINT_CATEGORY:
                 ConfigTreeData *config_data = new ConfigTreeData;
-                config_data->panel =
-                    new PrefsPanel( p_parent, p_intf, p_prefs_dialog,
-                                    p_module, p_item->psz_text );
-                config_data->panel->Hide();
+                config_data->psz_section = strdup(p_item->psz_text);
+                config_data->i_object_id = p_module->i_object_id;
 
                 /* Add the category to the tree */
-                AppendItem( root_item, p_item->psz_text, -1, -1, config_data );
+                AppendItem( root_item, wxU(p_item->psz_text),
+                            -1, -1, config_data );
                 break;
             }
         }
@@ -373,7 +392,7 @@ PrefsTreeCtrl::PrefsTreeCtrl( wxWindow *_p_parent, intf_thread_t *_p_intf,
     /*
      * Build a tree of all the plugins
      */
-    plugins_item = AppendItem( root_item, _("Plugins") );
+    plugins_item = AppendItem( root_item, wxU(_("Plugins")) );
 
     for( i_index = 0; i_index < p_list->i_count; i_index++ )
     {
@@ -401,7 +420,8 @@ PrefsTreeCtrl::PrefsTreeCtrl( wxWindow *_p_parent, intf_thread_t *_p_intf,
              i_child_index < GetChildrenCount( plugins_item, FALSE );
              i_child_index++ )
         {
-            if( !GetItemText(capability_item).Cmp(p_module->psz_capability) )
+            if( !GetItemText(capability_item).Cmp(
+                    wxU(p_module->psz_capability ) ) )
             {
                 break;
             }
@@ -413,15 +433,13 @@ PrefsTreeCtrl::PrefsTreeCtrl( wxWindow *_p_parent, intf_thread_t *_p_intf,
         {
             /* We didn't find it, add it */
             capability_item = AppendItem( plugins_item,
-                                          p_module->psz_capability );
+                                          wxU(p_module->psz_capability) );
         }
 
         /* Add the plugin to the tree */
         ConfigTreeData *config_data = new ConfigTreeData;
-        config_data->panel =
-            new PrefsPanel( p_parent, p_intf, p_prefs_dialog, p_module, NULL );
-        config_data->panel->Hide();
-        AppendItem( capability_item, p_module->psz_object_name, -1, -1,
+        config_data->i_object_id = p_module->i_object_id;
+        AppendItem( capability_item, wxU(p_module->psz_object_name), -1, -1,
                     config_data );
     }
 
@@ -465,7 +483,7 @@ void PrefsTreeCtrl::ApplyChanges()
          i_child_index++ )
     {
         config_data = (ConfigTreeData *)GetItemData( item );
-        if( config_data )
+        if( config_data && config_data->panel )
         {
             config_data->panel->ApplyChanges();
         }
@@ -485,7 +503,7 @@ void PrefsTreeCtrl::ApplyChanges()
              i_child_index++ )
         {
             config_data = (ConfigTreeData *)GetItemData( item2 );
-            if( config_data )
+            if( config_data && config_data->panel )
             {
                 config_data->panel->ApplyChanges();
             }
@@ -497,6 +515,77 @@ void PrefsTreeCtrl::ApplyChanges()
     }
 }
 
+void PrefsTreeCtrl::CleanChanges()
+{
+    long cookie, cookie2;
+    ConfigTreeData *config_data;
+
+    /* Clean changes for the main module */
+    wxTreeItemId item = GetFirstChild( root_item, cookie );
+    for( size_t i_child_index = 0;
+         i_child_index < GetChildrenCount( root_item, FALSE );
+         i_child_index++ )
+    {
+        config_data = (ConfigTreeData *)GetItemData( item );
+        if( config_data && config_data->panel )
+        {
+            if( item == GetSelection() )
+            {
+                config_data->panel->Hide();
+                p_sizer->Remove( config_data->panel );
+            }
+
+            delete config_data->panel;
+            config_data->panel = NULL;
+
+            if( item == GetSelection() )
+            {
+                wxTreeEvent event;
+                OnSelectTreeItem( event );
+            }
+        }
+
+        item = GetNextChild( root_item, cookie );
+    }
+
+    /* Clean changes for the plugins */
+    item = GetFirstChild( plugins_item, cookie );
+    for( size_t i_child_index = 0;
+         i_child_index < GetChildrenCount( plugins_item, FALSE );
+         i_child_index++ )
+    {
+        wxTreeItemId item2 = GetFirstChild( item, cookie2 );
+        for( size_t i_child_index = 0;
+             i_child_index < GetChildrenCount( item, FALSE );
+             i_child_index++ )
+        {
+            config_data = (ConfigTreeData *)GetItemData( item2 );
+
+            if( config_data && config_data->panel )
+            {
+                if( item2 == GetSelection() )
+                {
+                    config_data->panel->Hide();
+                    p_sizer->Remove( config_data->panel );
+                }
+
+                delete config_data->panel;
+                config_data->panel = NULL;
+
+                if( item2 == GetSelection() )
+                {
+                    wxTreeEvent event;
+                    OnSelectTreeItem( event );
+                }
+            }
+
+            item2 = GetNextChild( item, cookie2 );
+        }
+
+        item = GetNextChild( plugins_item, cookie );
+    }
+}
+
 void PrefsTreeCtrl::OnSelectTreeItem( wxTreeEvent& event )
 {
     ConfigTreeData *config_data;
@@ -508,10 +597,23 @@ void PrefsTreeCtrl::OnSelectTreeItem( wxTreeEvent& event )
         p_sizer->Remove( config_data->panel );
     }
 
-    config_data = (ConfigTreeData *)GetItemData( event.GetItem() );
-    if( config_data && config_data->panel )
+    /* Don't use event.GetItem() because we also send fake events */
+    config_data = (ConfigTreeData *)GetItemData( GetSelection() );
+    if( config_data )
     {
-        config_data->panel->Show();
+        if( !config_data->panel )
+        {
+            /* The panel hasn't been created yet. Let's do it. */
+            config_data->panel =
+                new PrefsPanel( p_parent, p_intf, p_prefs_dialog,
+                                config_data->i_object_id,
+                                config_data->psz_section );
+        }
+        else
+        {
+            config_data->panel->Show();
+        }
+
         p_sizer->Add( config_data->panel, 2, wxEXPAND | wxALL, 0 );
         p_sizer->Layout();
     }
@@ -522,7 +624,7 @@ void PrefsTreeCtrl::OnSelectTreeItem( wxTreeEvent& event )
  *****************************************************************************/
 PrefsPanel::PrefsPanel( wxWindow* parent, intf_thread_t *_p_intf,
                         PrefsDialog *_p_prefs_dialog,
-                        module_t *p_module, char *psz_section )
+                        int i_object_id, char *psz_section )
   :  wxPanel( parent, -1, wxDefaultPosition, wxDefaultSize )
 {
     module_config_t *p_item;
@@ -546,6 +648,14 @@ PrefsPanel::PrefsPanel( wxWindow* parent, intf_thread_t *_p_intf,
 
     wxBoxSizer *sizer = new wxBoxSizer( wxVERTICAL );
 
+    /* Get a pointer to the module */
+    module_t *p_module = (module_t *)vlc_object_get( p_intf, i_object_id );
+    if( p_module->i_object_type != VLC_OBJECT_MODULE )
+    {
+        /* 0OOoo something went really bad */
+        return;
+    }
+
     /* Enumerate config options and add corresponding config boxes */
     p_item = p_module->p_config;
 
@@ -562,12 +672,12 @@ PrefsPanel::PrefsPanel( wxWindow* parent, intf_thread_t *_p_intf,
     }
 
     /* Add a head title to the panel */
-    wxStaticBox *static_box = new wxStaticBox( this, -1, "" );
+    wxStaticBox *static_box = new wxStaticBox( this, -1, wxT("") );
     wxStaticBoxSizer *box_sizer = new wxStaticBoxSizer( static_box,
                                                         wxHORIZONTAL );
     label = new wxStaticText( this, -1,
-                              psz_section ? p_item->psz_text :
-                              p_module->psz_longname );
+                              wxU(psz_section ? p_item->psz_text :
+                              p_module->psz_longname) );
 
     box_sizer->Add( label, 1, wxALL, 5 );
     sizer->Add( box_sizer, 0, wxEXPAND | wxALL, 5 );
@@ -575,7 +685,7 @@ PrefsPanel::PrefsPanel( wxWindow* parent, intf_thread_t *_p_intf,
     /* Now put all the config options into a scrolled window */
     config_sizer = new wxBoxSizer( wxVERTICAL );
     config_window = new wxScrolledWindow( this, -1, wxDefaultPosition,
-                                          wxDefaultSize );
+        wxDefaultSize, wxSTATIC_BORDER | wxHSCROLL | wxVSCROLL );
     config_window->SetAutoLayout( TRUE );
     config_window->SetScrollRate( 5, 5 );
 
@@ -598,14 +708,14 @@ PrefsPanel::PrefsPanel( wxWindow* parent, intf_thread_t *_p_intf,
         switch( p_item->i_type )
         {
         case CONFIG_ITEM_MODULE:
-            label = new wxStaticText(panel, -1, p_item->psz_text);
-            combo = new wxComboBox( panel, -1, p_item->psz_value,
+            label = new wxStaticText(panel, -1, wxU(p_item->psz_text));
+            combo = new wxComboBox( panel, -1, wxU(p_item->psz_value),
                                     wxDefaultPosition, wxDefaultSize,
                                     0, NULL, wxCB_READONLY | wxCB_SORT );
 
             /* build a list of available modules */
             p_list = vlc_list_find( p_intf, VLC_OBJECT_MODULE, FIND_ANYWHERE );
-            combo->Append( _("Default"), (void *)NULL );
+            combo->Append( wxU(_("Default")), (void *)NULL );
             combo->SetSelection( 0 );
             for( int i_index = 0; i_index < p_list->i_count; i_index++ )
             {
@@ -614,15 +724,15 @@ PrefsPanel::PrefsPanel( wxWindow* parent, intf_thread_t *_p_intf,
                 if( !strcmp( p_parser->psz_capability,
                              p_item->psz_type ) )
                 {
-                    combo->Append( p_parser->psz_longname,
+                    combo->Append( wxU(p_parser->psz_longname),
                                    p_parser->psz_object_name );
                     if( p_item->psz_value &&
                         !strcmp(p_item->psz_value, p_parser->psz_object_name) )
-                        combo->SetValue( p_parser->psz_longname );
+                        combo->SetValue( wxU(p_parser->psz_longname) );
                 }
             }
 
-            combo->SetToolTip( p_item->psz_longtext );
+            combo->SetToolTip( wxU(p_item->psz_longtext) );
             config_data->control.combobox = combo;
             panel_sizer->Add( label, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5 );
             panel_sizer->Add( combo, 1, wxALIGN_CENTER_VERTICAL | wxALL, 5 );
@@ -631,32 +741,33 @@ PrefsPanel::PrefsPanel( wxWindow* parent, intf_thread_t *_p_intf,
         case CONFIG_ITEM_STRING:
         case CONFIG_ITEM_FILE:
         case CONFIG_ITEM_DIRECTORY:
-            label = new wxStaticText(panel, -1, p_item->psz_text);
+            label = new wxStaticText(panel, -1, wxU(p_item->psz_text));
             panel_sizer->Add( label, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5 );
 
             if( !p_item->ppsz_list )
             {
-                textctrl = new wxTextCtrl( panel, -1, p_item->psz_value,
+                textctrl = new wxTextCtrl( panel, -1, wxU(p_item->psz_value),
                                            wxDefaultPosition, wxDefaultSize,
                                            wxTE_PROCESS_ENTER);
-                textctrl->SetToolTip( p_item->psz_longtext );
+                textctrl->SetToolTip( wxU(p_item->psz_longtext) );
                 config_data->control.textctrl = textctrl;
                 panel_sizer->Add( textctrl, 1, wxALL, 5 );
             }
             else
             {
-                combo = new wxComboBox( panel, -1, p_item->psz_value,
+                combo = new wxComboBox( panel, -1, wxU(p_item->psz_value),
                                         wxDefaultPosition, wxDefaultSize,
                                         0, NULL, wxCB_READONLY | wxCB_SORT );
 
                 /* build a list of available options */
                 for( int i_index = 0; p_item->ppsz_list[i_index]; i_index++ )
                 {
-                    combo->Append( p_item->ppsz_list[i_index] );
+                    combo->Append( wxU(p_item->ppsz_list[i_index]) );
                 }
 
-               if( p_item->psz_value ) combo->SetValue( p_item->psz_value );
-                combo->SetToolTip( p_item->psz_longtext );
+                if( p_item->psz_value )
+                    combo->SetValue( wxU(p_item->psz_value) );
+                combo->SetToolTip( wxU(p_item->psz_longtext) );
                 config_data->control.combobox = combo;
                 config_data->b_config_list = VLC_TRUE;
                 panel_sizer->Add( combo, 1, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
@@ -664,20 +775,20 @@ PrefsPanel::PrefsPanel( wxWindow* parent, intf_thread_t *_p_intf,
 
             if( p_item->i_type == CONFIG_ITEM_FILE )
             {
-                button = new wxButton( panel, -1, _("Browse...") );
+                button = new wxButton( panel, -1, wxU(_("Browse...")) );
                 panel_sizer->Add( button, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
                 button->SetClientData((void *)config_data);
             }
             break;
 
         case CONFIG_ITEM_INTEGER:
-            label = new wxStaticText(panel, -1, p_item->psz_text);
+            label = new wxStaticText(panel, -1, wxU(p_item->psz_text));
             spin = new wxSpinCtrl( panel, -1,
-                                   wxString::Format("%d", p_item->i_value),
+                                   wxString::Format(wxT("%d"),p_item->i_value),
                                    wxDefaultPosition, wxDefaultSize,
                                    wxSP_ARROW_KEYS,
-                                   0, 16000, p_item->i_value);
-            spin->SetToolTip( p_item->psz_longtext );
+                                   -16000, 16000, p_item->i_value);
+            spin->SetToolTip( wxU(p_item->psz_longtext) );
             config_data->control.spinctrl = spin;
             panel_sizer->Add( label, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5 );
             panel_sizer->Add( spin, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5 );
@@ -686,22 +797,22 @@ PrefsPanel::PrefsPanel( wxWindow* parent, intf_thread_t *_p_intf,
             break;
 
         case CONFIG_ITEM_FLOAT:
-            label = new wxStaticText(panel, -1, p_item->psz_text);
+            label = new wxStaticText(panel, -1, wxU(p_item->psz_text));
             spin = new wxSpinCtrl( panel, -1,
-                                   wxString::Format("%f", p_item->f_value),
+                                   wxString::Format(wxT("%f"),p_item->f_value),
                                    wxDefaultPosition, wxDefaultSize,
                                    wxSP_ARROW_KEYS,
-                                   0, 16000, (int)p_item->f_value);
-            spin->SetToolTip( p_item->psz_longtext );
+                                   -16000, 16000, (int)p_item->f_value);
+            spin->SetToolTip( wxU(p_item->psz_longtext) );
             config_data->control.spinctrl = spin;
             panel_sizer->Add( label, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5 );
             panel_sizer->Add( spin, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5 );
             break;
 
         case CONFIG_ITEM_BOOL:
-            checkbox = new wxCheckBox( panel, -1, p_item->psz_text );
+            checkbox = new wxCheckBox( panel, -1, wxU(p_item->psz_text) );
             if( p_item->i_value ) checkbox->SetValue(TRUE);
-            checkbox->SetToolTip( p_item->psz_longtext );
+            checkbox->SetToolTip( wxU(p_item->psz_longtext) );
             config_data->control.checkbox = checkbox;
             panel_sizer->Add( checkbox, 0, wxALL, 5 );
             break;
@@ -730,7 +841,7 @@ PrefsPanel::PrefsPanel( wxWindow* parent, intf_thread_t *_p_intf,
     if( !config_array.GetCount() )
     {
         config_sizer->Add( new wxStaticText( config_window, -1,
-                           _("No configuration options available") ), 1,
+                           wxU(_("No configuration options available")) ), 1,
                            wxALIGN_CENTER_VERTICAL | wxALIGN_CENTER, 2 );
     }
 
@@ -751,7 +862,7 @@ PrefsPanel::PrefsPanel( wxWindow* parent, intf_thread_t *_p_intf,
     if( config_array.GetCount() )
     {
         wxButton *advanced_button = new wxButton( this, Advanced_Event,
-                                                  _("Advanced...") );
+                                                  wxU(_("Advanced...")) );
         sizer->Add( advanced_button, 0, wxALL, 5 );
     }
 
@@ -768,7 +879,7 @@ void PrefsPanel::ApplyChanges()
         switch( config_data->i_config_type )
         {
         case CONFIG_ITEM_MODULE:
-            config_PutPsz( p_intf, config_data->option_name.c_str(), (char *)
+            config_PutPsz( p_intf, config_data->option_name.mb_str(), (char *)
                            config_data->control.combobox->GetClientData(
                            config_data->control.combobox->GetSelection() ) );
             break;
@@ -776,22 +887,22 @@ void PrefsPanel::ApplyChanges()
         case CONFIG_ITEM_FILE:
         case CONFIG_ITEM_DIRECTORY:
             if( !config_data->b_config_list )
-                config_PutPsz( p_intf, config_data->option_name.c_str(),
-                               config_data->control.textctrl->GetValue() );
+                config_PutPsz( p_intf, config_data->option_name.mb_str(),
+                               config_data->control.textctrl->GetValue().mb_str() );
             else
-                config_PutPsz( p_intf, config_data->option_name.c_str(),
-                               config_data->control.combobox->GetValue() );
+                config_PutPsz( p_intf, config_data->option_name.mb_str(),
+                               config_data->control.combobox->GetValue().mb_str() );
             break;
         case CONFIG_ITEM_BOOL:
-            config_PutInt( p_intf, config_data->option_name.c_str(),
+            config_PutInt( p_intf, config_data->option_name.mb_str(),
                            config_data->control.checkbox->IsChecked() );
             break;
         case CONFIG_ITEM_INTEGER:
-            config_PutInt( p_intf, config_data->option_name.c_str(),
+            config_PutInt( p_intf, config_data->option_name.mb_str(),
                            config_data->control.spinctrl->GetValue() );
             break;
         case CONFIG_ITEM_FLOAT:
-            config_PutFloat( p_intf, config_data->option_name.c_str(),
+            config_PutFloat( p_intf, config_data->option_name.mb_str(),
                              config_data->control.spinctrl->GetValue() );
             break;
         }
@@ -814,6 +925,7 @@ void PrefsPanel::OnAdvanced( wxCommandEvent& WXUNUSED(event) )
 
     config_sizer->Layout();
     config_window->FitInside();
+    config_window->Refresh();
 }
 
 /*****************************************************************************
@@ -850,8 +962,8 @@ void ConfigEvtHandler::OnCommandEvent( wxCommandEvent& event )
 
     if( config_data->i_config_type == CONFIG_ITEM_FILE )
     {
-        wxFileDialog dialog( p_prefs_dialog, _("Open file"), "", "", "*.*",
-                             wxOPEN | wxSAVE );
+        wxFileDialog dialog( p_prefs_dialog, wxU(_("Open file")),
+                             wxT(""), wxT(""), wxT("*.*"), wxOPEN | wxSAVE );
 
         if( dialog.ShowModal() == wxID_OK )
         {