]> git.sesse.net Git - vlc/blobdiff - modules/gui/skins/src/skin_main.cpp
* got rid of this useless error message
[vlc] / modules / gui / skins / src / skin_main.cpp
index a27cd9e6b9ce4ce1a4c0310d30439bb5e04566a0..a90cd8d823e0ddd3922ef84bc355e1c2f0f7d8b0 100644 (file)
@@ -2,7 +2,7 @@
  * skin-main.cpp: skins plugin for VLC
  *****************************************************************************
  * Copyright (C) 2003 VideoLAN
- * $Id: skin_main.cpp,v 1.29 2003/06/01 16:39:49 asmax Exp $
+ * $Id: skin_main.cpp,v 1.33 2003/06/06 23:34:35 asmax Exp $
  *
  * Authors: Olivier Teulière <ipkiss@via.ecp.fr>
  *          Emmanuel Puig    <karibu@via.ecp.fr>
@@ -49,6 +49,8 @@
 #include "themeloader.h"
 #include "vlcproc.h"
 #include "skin_common.h"
+#include "dialogs.h"
+
 #ifndef BASIC_SKINS
 #include "../../wxwindows/wxwindows.h"
 #endif
@@ -128,8 +130,12 @@ static int Open ( vlc_object_t *p_this )
 #elif defined X11_SKINS
     // Initialize X11
     p_intf->p_sys->display = XOpenDisplay( NULL );
+    vlc_mutex_init( p_intf, &p_intf->p_sys->xlock );
 
 #elif defined WIN32
+    // Interface thread id used to post broadcast messages
+    p_intf->p_sys->dwThreadId = GetCurrentThreadId();
+
     // We dynamically load msimg32.dll to get a pointer to TransparentBlt()
     p_intf->p_sys->h_msimg32_dll = LoadLibrary("msimg32.dll");
     if( !p_intf->p_sys->h_msimg32_dll ||
@@ -191,6 +197,8 @@ static void Close ( vlc_object_t *p_this )
         FreeLibrary( p_intf->p_sys->h_msimg32_dll );
     if( p_intf->p_sys->h_user32_dll )
         FreeLibrary( p_intf->p_sys->h_user32_dll );
+#elif defined X11_SKINS
+    vlc_mutex_destroy( &p_intf->p_sys->xlock );
 #endif
 
     // Destroy structure
@@ -206,6 +214,13 @@ static void Run( intf_thread_t *p_intf )
 
     int a = OSAPI_GetTime();
 
+#ifndef BASIC_SKINS
+    // Initialize the dialog boxes
+    p_intf->p_sys->p_dialogs = new Dialogs( p_intf );
+    if( !p_intf->p_sys->p_dialogs ||
+        !p_intf->p_sys->p_dialogs->OpenDlg ) return;
+#endif
+
     // Load a theme
     char *skin_last = config_GetPsz( p_intf, "skin_last" );
     ThemeLoader *Loader = new ThemeLoader( p_intf );
@@ -232,17 +247,16 @@ static void Run( intf_thread_t *p_intf )
 #endif
         {
             // Last chance: the user can  select a new theme file
-// FIXME: wxWindows isn't initialized yet !!!
-#if 0
 #ifndef BASIC_SKINS
-            wxFileDialog dialog( NULL, _("Open a skin file"), "", "",
-                "Skin files (*.vlt)|*.vlt|Skin files (*.xml)|*.xml|"
-                    "All files|*.*", wxOPEN );
+            wxFileDialog dialog( NULL,
+                wxU(_("Open a skin file")), wxT(""), wxT(""),
+                wxT("Skin files (*.vlt)|*.vlt|Skin files (*.xml)|*.xml|"
+                    "All files|*.*"), wxOPEN );
 
             if( dialog.ShowModal() == wxID_OK )
             {
                 // try to load selected file
-                if( ! Loader->Load( dialog.GetPath().c_str() ) )
+                if( ! Loader->Load( (string)dialog.GetPath().mb_str() ) )
                 {
                     // He, he, what the hell is he doing ?
                     delete Loader;
@@ -250,7 +264,6 @@ static void Run( intf_thread_t *p_intf )
                 }
             }
             else
-#endif
 #endif
             {
                 delete Loader;
@@ -265,12 +278,17 @@ static void Run( intf_thread_t *p_intf )
 
     delete Loader;
 
-    msg_Err( p_intf, "Load theme time : %i ms", OSAPI_GetTime() - a );
+    msg_Dbg( p_intf, "Load theme time : %i ms", OSAPI_GetTime() - a );
 
     // Refresh the whole interface
     OSAPI_PostMessage( NULL, VLC_INTF_REFRESH, 0, (int)true );
 
     OSRun( p_intf );
+
+#ifndef BASIC_SKINS
+    // clean up the dialog boxes
+    delete p_intf->p_sys->p_dialogs;
+#endif
 }
 
 //---------------------------------------------------------------------------
@@ -321,12 +339,12 @@ int SkinManage( intf_thread_t *p_intf )
 
     OSAPI_PostMessage( NULL, VLC_INTF_REFRESH, 0, (long)false );
 
-#ifndef BASIC_SKINS
+#ifndef BASIC_SKINS //FIXME
     // Update the log window
-    p_intf->p_sys->MessagesDlg->UpdateLog();
+    p_intf->p_sys->p_dialogs->MessagesDlg->UpdateLog();
 
     // Update the file info window
-    p_intf->p_sys->InfoDlg->UpdateFileInfo();
+    p_intf->p_sys->p_dialogs->FileInfoDlg->UpdateFileInfo();
 #endif
 
     //-------------------------------------------------------------------------