]> git.sesse.net Git - vlc/blobdiff - modules/gui/wxwidgets/dialogs.cpp
One more time removing of some useless tests.
[vlc] / modules / gui / wxwidgets / dialogs.cpp
index 655aa061cdfb3b83754252ce624952a34e33780d..b62632be84e30a9ed40ca592859eed25931973e0 100644 (file)
 /*****************************************************************************
  * Preamble
  *****************************************************************************/
-#include <stdlib.h>                                      /* malloc(), free() */
 #include <errno.h>                                                 /* ENOMEM */
-#include <string.h>                                            /* strerror() */
-#include <stdio.h>
+
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
 
 #include <vlc/vlc.h>
-#include <vlc/aout.h>
-#include <vlc/intf.h>
+#include <vlc_aout.h>
+#include <vlc_interface.h>
 
-#include "charset.h"
+#include "vlc_charset.h"
 
-#include "dialogs/vlm/vlm_panel.hpp"
+//#include "dialogs/vlm/vlm_panel.hpp"
 #include "dialogs/bookmarks.hpp"
 #include "dialogs/wizard.hpp"
 #include "dialogs/playlist.hpp"
@@ -66,8 +67,10 @@ private:
     void Open( int i_access_method, int i_arg );
 
     /* Event handlers (these functions should _not_ be virtual) */
+#ifdef UPDATE_CHECK
     void OnUpdateVLC( wxCommandEvent& event );
-    void OnVLM( wxCommandEvent& event );
+#endif
+    //void OnVLM( wxCommandEvent& event );
     void OnInteraction( wxCommandEvent& event );
     void OnExit( wxCommandEvent& event );
     void OnPlaylist( wxCommandEvent& event );
@@ -111,8 +114,10 @@ public:
     wxFrame             *p_prefs_dialog;
     wxFrame             *p_bookmarks_dialog;
     wxFileDialog        *p_file_generic_dialog;
+#ifdef UPDATE_CHECK
     UpdateVLC           *p_updatevlc_dialog;
-    VLMFrame            *p_vlm_dialog;
+#endif
+    //VLMFrame            *p_vlm_dialog;
 };
 }
 
@@ -159,10 +164,14 @@ BEGIN_EVENT_TABLE(DialogsProvider, wxFrame)
 
     EVT_COMMAND(INTF_DIALOG_EXIT, wxEVT_DIALOG,
                 DialogsProvider::OnExitThread)
+#ifdef UPDATE_CHECK
     EVT_COMMAND(INTF_DIALOG_UPDATEVLC, wxEVT_DIALOG,
                 DialogsProvider::OnUpdateVLC)
+#endif
+#if 0
     EVT_COMMAND(INTF_DIALOG_VLM, wxEVT_DIALOG,
                 DialogsProvider::OnVLM)
+#endif
     EVT_COMMAND( INTF_DIALOG_INTERACTION, wxEVT_DIALOG,
                 DialogsProvider::OnInteraction )
 END_EVENT_TABLE()
@@ -190,11 +199,13 @@ DialogsProvider::DialogsProvider( intf_thread_t *_p_intf, wxWindow *p_parent )
     p_wizard_dialog = NULL;
     p_bookmarks_dialog = NULL;
     p_dir_dialog = NULL;
+#ifdef UPDATE_CHECK
     p_updatevlc_dialog = NULL;
-    p_vlm_dialog = NULL;
+#endif
+    //p_vlm_dialog = NULL;
 
     /* Give our interface a nice little icon */
-    p_intf->p_sys->p_icon = new wxIcon( vlc_xpm );
+    p_intf->p_sys->p_icon = new wxIcon( (const char**) vlc_xpm );
 
     /* Create the messages dialog so it can begin storing logs */
     p_messages_dialog = new Messages( p_intf, p_parent ? p_parent : this );
@@ -262,8 +273,10 @@ DialogsProvider::~DialogsProvider()
     if( p_file_generic_dialog ) delete p_file_generic_dialog;
     if( p_wizard_dialog ) delete p_wizard_dialog;
     if( p_bookmarks_dialog ) delete p_bookmarks_dialog;
+#ifdef UPDATE_CHECK
     if( p_updatevlc_dialog ) delete p_updatevlc_dialog;
-    if( p_vlm_dialog ) delete p_vlm_dialog;
+#endif
+    //if( p_vlm_dialog ) delete p_vlm_dialog;
 
 
     if( p_intf->p_sys->p_icon ) delete p_intf->p_sys->p_icon;
@@ -380,8 +393,8 @@ void DialogsProvider::OnOpenFileGeneric( wxCommandEvent& event )
     {
         p_file_generic_dialog->SetMessage( wxU(p_arg->psz_title) );
         p_file_generic_dialog->SetWildcard( wxU(p_arg->psz_extensions) );
-        p_file_generic_dialog->SetStyle( (p_arg->b_save ? wxSAVE : wxOPEN) |
-                                         (p_arg->b_multiple ? wxMULTIPLE:0) );
+        p_file_generic_dialog->SetWindowStyle( (p_arg->b_save ? wxSAVE : wxOPEN) |
+                                               (p_arg->b_multiple ? wxMULTIPLE:0) );
     }
 
     if( p_file_generic_dialog &&
@@ -396,7 +409,7 @@ void DialogsProvider::OnOpenFileGeneric( wxCommandEvent& event )
                                               sizeof(char *) );
         for( size_t i = 0; i < paths.GetCount(); i++ )
         {
-            p_arg->psz_results[i] = strdup( paths[i].mb_str() );
+            p_arg->psz_results[i] = strdup( paths[i].mb_str(wxConvUTF8) );
         }
     }
 
@@ -414,8 +427,8 @@ void DialogsProvider::OnOpenFileGeneric( wxCommandEvent& event )
         }
         free( p_arg->psz_results );
     }
-    if( p_arg->psz_title ) free( p_arg->psz_title );
-    if( p_arg->psz_extensions ) free( p_arg->psz_extensions );
+    free( p_arg->psz_title );
+    free( p_arg->psz_extensions );
 
     free( p_arg );
 }
@@ -434,10 +447,10 @@ void DialogsProvider::OnOpenFileSimple( wxCommandEvent& event )
         p_file_dialog = new wxFileDialog( NULL, wxU(_("Open File")),
             wxT(""), wxT(""), wxT("*"), wxOPEN | wxMULTIPLE );
 
-       p_file_dialog->SetWildcard(wxU(_("All Files (*.*)|*"
-        "|Sound Files (*.mp3, *.ogg, etc.)|" EXTENSIONS_AUDIO 
-        "|Video Files (*.avi, *.mpg, etc.)|" EXTENSIONS_VIDEO 
-        "|Playlist Files (*.m3u, *.pls, etc.)|" EXTENSIONS_PLAYLIST 
+    p_file_dialog->SetWildcard(wxU(_("All Files (*.*)|*"
+        "|Sound Files (*.mp3, *.ogg, etc.)|" EXTENSIONS_AUDIO
+        "|Video Files (*.avi, *.mpg, etc.)|" EXTENSIONS_VIDEO
+        "|Playlist Files (*.m3u, *.pls, etc.)|" EXTENSIONS_PLAYLIST
         "|Subtitle Files (*.srt, *.sub, etc.)|" EXTENSIONS_SUBTITLE)));
 
     if( p_file_dialog && p_file_dialog->ShowModal() == wxID_OK )
@@ -450,13 +463,13 @@ void DialogsProvider::OnOpenFileSimple( wxCommandEvent& event )
         {
             char *psz_utf8 = wxFromLocale( paths[i] );
             if( event.GetInt() )
-                playlist_PlaylistAdd( p_playlist, psz_utf8, NULL,
+                playlist_Add( p_playlist, psz_utf8, NULL,
                               PLAYLIST_APPEND | (i ? 0 : PLAYLIST_GO) |
                               (i ? PLAYLIST_PREPARSE : 0 ),
-                              PLAYLIST_END );
+                              PLAYLIST_END, VLC_TRUE, VLC_FALSE );
             else
-                playlist_PlaylistAdd( p_playlist, psz_utf8, NULL,
-                              PLAYLIST_APPEND | PLAYLIST_PREPARSE , PLAYLIST_END );
+                playlist_Add( p_playlist, psz_utf8, NULL,
+                              PLAYLIST_APPEND | PLAYLIST_PREPARSE , PLAYLIST_END , VLC_TRUE, VLC_FALSE );
             wxLocaleFree( psz_utf8 );
         }
     }
@@ -481,9 +494,9 @@ void DialogsProvider::OnOpenDirectory( wxCommandEvent& event )
     {
         wxString path = p_dir_dialog->GetPath();
         char *psz_utf8 = wxFromLocale( path );
-        playlist_PlaylistAdd( p_playlist, psz_utf8, NULL,
+        playlist_Add( p_playlist, psz_utf8, NULL,
                       PLAYLIST_APPEND | (event.GetInt() ? PLAYLIST_GO : 0),
-                      PLAYLIST_END );
+                      PLAYLIST_END, VLC_TRUE, VLC_FALSE );
         wxLocaleFree( psz_utf8 );
     }
 
@@ -550,6 +563,7 @@ void DialogsProvider::OnExitThread( wxCommandEvent& WXUNUSED(event) )
     wxTheApp->ExitMainLoop();
 }
 
+#ifdef UPDATE_CHECK
 void DialogsProvider::OnUpdateVLC( wxCommandEvent& WXUNUSED(event) )
 {
     /* Show/hide the file info window */
@@ -561,7 +575,9 @@ void DialogsProvider::OnUpdateVLC( wxCommandEvent& WXUNUSED(event) )
         p_updatevlc_dialog->Show( !p_updatevlc_dialog->IsShown() );
     }
 }
+#endif
 
+#if 0
 void DialogsProvider::OnVLM( wxCommandEvent& WXUNUSED(event) )
 {
     /* Show/hide the file info window */
@@ -573,6 +589,7 @@ void DialogsProvider::OnVLM( wxCommandEvent& WXUNUSED(event) )
         p_vlm_dialog->Show( !p_vlm_dialog->IsShown() );
     }
 }
+#endif
 
 void DialogsProvider::OnInteraction( wxCommandEvent& event )
 {