]> git.sesse.net Git - vlc/blobdiff - modules/gui/wxwindows/wxwindows.cpp
Preferences consistency fixes by Christophe Mutricy <xtophe at nxtelevision d0t com>
[vlc] / modules / gui / wxwindows / wxwindows.cpp
index 2b8808c5ef7995da461f51823a50e73e3fcd07ad..47e6bb93d04a4372cefc6eb36d06e62749b06841 100644 (file)
@@ -2,7 +2,7 @@
  * wxwindows.cpp : wxWindows plugin for vlc
  *****************************************************************************
  * Copyright (C) 2000-2004 VideoLAN
- * $Id: wxwindows.cpp,v 1.38 2004/01/25 03:29:02 hartman Exp $
+ * $Id$
  *
  * Authors: Gildas Bazin <gbazin@netcourrier.com>
  *
 #include <string.h>                                            /* strerror() */
 #include <stdio.h>
 
+#include <vlc/vlc.h>
+#include <vlc/intf.h>
+
 #ifdef HAVE_LOCALE_H
 #   include <locale.h>
 #endif
 
-#include <vlc/vlc.h>
-#include <vlc/intf.h>
-
 #include "wxwindows.h"
 
 /* Temporary hack */
-#if defined(WIN32) && defined(_WX_INIT_H_)
+#if defined(WIN32) && defined(_WX_INIT_H_) 
+#if (wxMAJOR_VERSION <= 2) && (wxMINOR_VERSION <= 5) && (wxRELEASE_NUMBER < 3)
 /* Hack to detect wxWindows 2.5 which has a different wxEntry() prototype */
 extern int wxEntry( HINSTANCE hInstance, HINSTANCE hPrevInstance = NULL,
                     char *pCmdLine = NULL, int nCmdShow = SW_NORMAL );
 #endif
+#endif
+
 #ifdef SYS_DARWIN
 int wxEntry( int argc, char *argv[] , bool enterLoop = TRUE );
 #endif
@@ -80,13 +83,23 @@ private:
 /*****************************************************************************
  * Module descriptor
  *****************************************************************************/
+#define EMBED_TEXT N_("Embed video in interface")
+#define EMBED_LONGTEXT N_("Embed the video inside the interface instead " \
+    "of having it in a separate window.")
+#define BOOKMARKS_TEXT N_("Show bookmarks dialog")
+#define BOOKMARKS_LONGTEXT N_("Show bookmarks dialog when the interface " \
+    "starts.")
+
 vlc_module_begin();
 #ifdef WIN32
     int i_score = 150;
 #else
     int i_score = getenv( "DISPLAY" ) == NULL ? 15 : 150;
 #endif
+    set_shortname( (char*) _("wxWindows"));
     set_description( (char *) _("wxWindows interface module") );
+    set_category( CAT_INTERFACE );
+    set_subcategory( SUBCAT_INTERFACE_GENERAL );
     set_capability( "interface", i_score );
     set_callbacks( Open, Close );
     add_shortcut( "wxwindows" );
@@ -94,6 +107,11 @@ vlc_module_begin();
     add_shortcut( "wx" );
     set_program( "wxvlc" );
 
+    add_bool( "wxwin-embed", 1, NULL,
+              EMBED_TEXT, EMBED_LONGTEXT, VLC_FALSE );
+    add_bool( "wxwin-bookmarks", 0, NULL,
+              BOOKMARKS_TEXT, BOOKMARKS_LONGTEXT, VLC_FALSE );
+
     add_submodule();
     set_description( _("wxWindows dialogs provider") );
     set_capability( "dialogs provider", 50 );
@@ -118,6 +136,7 @@ static int Open( vlc_object_t *p_this )
         msg_Err( p_intf, "out of memory" );
         return VLC_ENOMEM;
     }
+    memset( p_intf->p_sys, 0, sizeof( intf_sys_t ) );
 
     p_intf->pf_run = Run;
 
@@ -132,9 +151,13 @@ static int Open( vlc_object_t *p_this )
     p_intf->p_sys->i_slider_pos = p_intf->p_sys->i_slider_oldpos = 0;
 
     p_intf->p_sys->p_popup_menu = NULL;
+    p_intf->p_sys->p_video_window = NULL;
 
     p_intf->pf_show_dialog = NULL;
 
+    /* We support play on start */
+    p_intf->b_play = VLC_TRUE;
+
     return VLC_SUCCESS;
 }
 
@@ -155,10 +178,9 @@ static void Close( vlc_object_t *p_this )
 {
     intf_thread_t *p_intf = (intf_thread_t *)p_this;
 
-    if( p_intf->p_sys->p_input )
-    {
-        vlc_object_release( p_intf->p_sys->p_input );
-    }
+    vlc_mutex_lock( &p_intf->object_lock );
+    p_intf->b_dead = VLC_TRUE;
+    vlc_mutex_unlock( &p_intf->object_lock );
 
     if( p_intf->pf_show_dialog )
     {
@@ -285,14 +307,27 @@ bool Instance::OnInit()
 
     /* Creates the dialogs provider */
     p_intf->p_sys->p_wxwindow =
-        new DialogsProvider( p_intf, p_intf->pf_show_dialog ?
-                             NULL : p_intf->p_sys->p_wxwindow );
+        CreateDialogsProvider( p_intf, p_intf->pf_show_dialog ?
+                               NULL : p_intf->p_sys->p_wxwindow );
 
     p_intf->p_sys->pf_show_dialog = ShowDialog;
 
     /* OK, initialization is over */
     vlc_thread_ready( p_intf );
 
+    /* Check if we need to start playing */
+    if( !p_intf->pf_show_dialog && p_intf->b_play )
+    {
+        playlist_t *p_playlist =
+            (playlist_t *)vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
+                                           FIND_ANYWHERE );
+        if( p_playlist )
+        {
+            playlist_Play( p_playlist );
+            vlc_object_release( p_playlist );
+        }
+    }
+
     /* Return TRUE to tell program to continue (FALSE would terminate) */
     return TRUE;
 }