/*****************************************************************************
* wxwindows.cpp : wxWindows plugin for vlc
*****************************************************************************
- * Copyright (C) 2000-2001 VideoLAN
- * $Id: wxwindows.cpp,v 1.31 2003/08/27 11:53:26 gbazin Exp $
+ * Copyright (C) 2000-2004 VideoLAN
+ * $Id$
*
* Authors: Gildas Bazin <gbazin@netcourrier.com>
*
#include <vlc/vlc.h>
#include <vlc/intf.h>
+#ifdef HAVE_LOCALE_H
+# include <locale.h>
+#endif
+
#include "wxwindows.h"
/* Temporary hack */
extern int wxEntry( HINSTANCE hInstance, HINSTANCE hPrevInstance = NULL,
char *pCmdLine = NULL, int nCmdShow = SW_NORMAL );
#endif
-#ifdef __DARWIN__
+#ifdef SYS_DARWIN
int wxEntry( int argc, char *argv[] , bool enterLoop = TRUE );
#endif
Instance( intf_thread_t *_p_intf );
bool OnInit();
+ int OnExit();
private:
intf_thread_t *p_intf;
/*****************************************************************************
* 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;
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 );
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;
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;
}
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 )
{
/* We must destroy the dialogs thread */
* provided facilities (eg. open file dialog) */
locale.Init( wxLANGUAGE_DEFAULT );
+ /* FIXME: The stream output mrl parsing uses ',' already so we want to
+ * keep the default '.' for floating point numbers. */
+ setlocale( LC_NUMERIC, "C" );
+
/* Make an instance of your derived frame. Passing NULL (the default value
* of Frame's constructor is NULL) as the frame doesn't have a parent
* since it is the first window */
/* Show the interface */
MainInterface->Show( TRUE );
-
SetTopWindow( MainInterface );
-
- /* Start timer */
- new Timer( p_intf, MainInterface );
+ MainInterface->Raise();
}
/* 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;
}
+/*****************************************************************************
+ * Instance::OnExit: called when the interface execution stops
+ *****************************************************************************/
+int Instance::OnExit()
+{
+ if( p_intf->pf_show_dialog )
+ {
+ /* We need to manually clean up the dialogs class */
+ if( p_intf->p_sys->p_wxwindow ) delete p_intf->p_sys->p_wxwindow;
+ }
+ return 0;
+}
+
static void ShowDialog( intf_thread_t *p_intf, int i_dialog_event, int i_arg,
intf_dialog_args_t *p_arg )
{
event.SetInt( i_arg );
event.SetClientData( p_arg );
+#ifdef WIN32
+ SendMessage( (HWND)p_intf->p_sys->p_wxwindow->GetHandle(),
+ WM_CANCELMODE, 0, 0 );
+#endif
+ if( i_dialog_event == INTF_DIALOG_POPUPMENU && i_arg == 0 ) return;
+
/* Hack to prevent popup events to be enqueued when
* one is already active */
if( i_dialog_event != INTF_DIALOG_POPUPMENU ||