]> git.sesse.net Git - vlc/blobdiff - modules/gui/skins/src/skin_main.cpp
* fixed a timing issue under windows ?
[vlc] / modules / gui / skins / src / skin_main.cpp
index 529fb467652b5879a4ec1dbdd9635cfe071fb9a8..8e4ad1ec6db5699ba49d482e5cae17c055ba6a52 100644 (file)
@@ -2,7 +2,7 @@
  * skin-main.cpp: skins plugin for VLC
  *****************************************************************************
  * Copyright (C) 2003 VideoLAN
- * $Id: skin_main.cpp,v 1.10 2003/04/16 21:40:07 ipkiss Exp $
+ * $Id: skin_main.cpp,v 1.15 2003/04/21 02:50:49 asmax Exp $
  *
  * Authors: Olivier Teulière <ipkiss@via.ecp.fr>
  *          Emmanuel Puig    <karibu@via.ecp.fr>
@@ -23,6 +23,8 @@
  * USA.
  *****************************************************************************/
 
+//--- GENERAL ---------------------------------------------------------------
+#include <wx/wx.h>
 
 //--- VLC -------------------------------------------------------------------
 #include <vlc/vlc.h>
@@ -32,8 +34,6 @@
 //--- SKIN ------------------------------------------------------------------
 #include "../os_api.h"
 #include "event.h"
-#include "dialog.h"
-#include "../os_dialog.h"
 #include "banks.h"
 #include "window.h"
 #include "theme.h"
@@ -41,6 +41,7 @@
 #include "themeloader.h"
 #include "vlcproc.h"
 #include "skin_common.h"
+#include "wxdialogs.h"
 
 
 //---------------------------------------------------------------------------
@@ -104,6 +105,10 @@ static int Open ( vlc_object_t *p_this )
     p_intf->p_sys->p_playlist = (playlist_t *)vlc_object_find( p_intf,
         VLC_OBJECT_PLAYLIST, FIND_ANYWHERE );
 
+    // Initialize conditions
+    vlc_mutex_init( p_intf, &p_intf->p_sys->init_lock);
+    vlc_cond_init( p_intf, &p_intf->p_sys->init_cond);
+    
     p_intf->p_sys->p_theme = (Theme *)new OSTheme( p_intf );
 
     return( 0 );
@@ -133,8 +138,10 @@ static void Close ( vlc_object_t *p_this )
     // Unsuscribe to messages bank
     msg_Unsubscribe( p_intf, p_intf->p_sys->p_sub );
 
-
-
+    // Destroy conditions
+    vlc_cond_destroy( &p_intf->p_sys->init_cond);
+    vlc_mutex_destroy( &p_intf->p_sys->init_lock);
+    
     // Destroy structure
     free( p_intf->p_sys );
 }
@@ -184,35 +191,25 @@ static void Run( intf_thread_t *p_intf )
 #endif
         {
             // Last chance: the user can  select a new theme file
+            wxFileDialog dialog( NULL, _("Open a skin file"), "", "",
+                "Skin files (*.vlt)|*.vlt|Skin files (*.xml)|*.xml|"
+                    "All files|*.*", wxOPEN );
 
-            // Initialize file structure
-            OpenFileDialog *OpenFile;
-            OpenFile = (OpenFileDialog *)new OSOpenFileDialog( NULL,
-                _("Open skin"), false );
-            OpenFile->AddFilter( _("Skin files"), "*.vlt" );
-            OpenFile->AddFilter( _("Skin files"), "*.xml" );
-            OpenFile->AddFilter( _("All files"), "*.*" );
-
-            // Open dialog box
-            if( OpenFile->Open() )
+            if( dialog.ShowModal() == wxID_OK )
             {
                 // try to load selected file
-                if( ! Loader->Load( OpenFile->FileList.front() ) )
+                if( ! Loader->Load( dialog.GetPath().c_str() ) )
                 {
                     // He, he, what the hell is he doing ?
-                    delete OpenFile;
                     delete Loader;
                     return;
                 }
             }
             else
             {
-                delete OpenFile;
                 delete Loader;
                 return;
             }
-
-            delete OpenFile;
         }
     }
 
@@ -227,7 +224,6 @@ static void Run( intf_thread_t *p_intf )
     // Refresh the whole interface
     OSAPI_PostMessage( NULL, VLC_INTF_REFRESH, 0, (int)true );
 
-    // Run interface message loop
     OSRun( p_intf );
 }
 
@@ -281,7 +277,10 @@ int SkinManage( intf_thread_t *p_intf )
     OSAPI_PostMessage( NULL, VLC_INTF_REFRESH, 0, (long)false );
 
     // Update the log window
-    //p_intf->p_sys->p_theme->UpdateLog( p_intf->p_sys->p_sub );
+    p_intf->p_sys->MessagesDlg->UpdateLog();
+
+    // Update the file info window
+    p_intf->p_sys->InfoDlg->UpdateFileInfo();
 
     //-------------------------------------------------------------------------
     if( p_intf->p_sys->p_input != NULL && !p_intf->p_sys->p_input->b_die )
@@ -304,8 +303,9 @@ int SkinManage( intf_thread_t *p_intf )
 
 
         // Refresh slider
-        //if( p_input->stream.b_seekable && p_intf->p_sys->b_playing )
-        //{
+       // if( p_input->stream.b_seekable && p_intf->p_sys->b_playing )
+        if( p_input->stream.b_seekable )
+        {
 #define p_area p_input->stream.p_selected_area
 
             // Set value of sliders
@@ -341,7 +341,7 @@ int SkinManage( intf_thread_t *p_intf )
             delete[] text;
 
 #undef p_area
-        //}
+        }
         vlc_mutex_unlock( &p_input->stream.stream_lock );
     }
     //-------------------------------------------------------------------------
@@ -349,4 +349,3 @@ int SkinManage( intf_thread_t *p_intf )
 
     return( VLC_TRUE );
 }
-//---------------------------------------------------------------------------