Commit 035792d5 authored by Gildas Bazin's avatar Gildas Bazin

* modules/gui/wxwindows/*: The wxwindows interface is now a "dialogs provider" module as well as a normal "interface".
   Dialog providers expose an api that allow other modules to use the GUI dialogs the module provides (open dialogs, etc...).
   + misc small enhancements.

* modules/gui/skins/*: completely removed the dependancy on the wxwindows code (which also eliminates the need for the basic_skins module).
   The skins module will now try to load a "dialogs provider" to display the open, messages, file info and preferences dialogs.
parent 5cc5eba2
dnl Autoconf settings for vlc dnl Autoconf settings for vlc
dnl $Id: configure.ac,v 1.33 2003/07/17 14:54:26 sam Exp $ dnl $Id: configure.ac,v 1.34 2003/07/17 17:30:39 gbazin Exp $
AC_INIT(vlc,0.6.0) AC_INIT(vlc,0.6.0)
...@@ -1705,7 +1705,7 @@ dnl ...@@ -1705,7 +1705,7 @@ dnl
dnl MP4 module dnl MP4 module
dnl dnl
AC_CHECK_HEADERS(zlib.h, [ AC_CHECK_HEADERS(zlib.h, [
AX_ADD_LDFLAGS([mp4 skins basic_skins],[-lz]) AX_ADD_LDFLAGS([mp4 skins],[-lz])
] ) ] )
...@@ -1713,7 +1713,7 @@ dnl ...@@ -1713,7 +1713,7 @@ dnl
dnl skins module dnl skins module
dnl dnl
AC_CHECK_HEADERS(libtar.h, [ AC_CHECK_HEADERS(libtar.h, [
AX_ADD_LDFLAGS([skins basic_skins],[-ltar]) AX_ADD_LDFLAGS([skins],[-ltar])
] ) ] )
...@@ -2422,32 +2422,14 @@ dnl ...@@ -2422,32 +2422,14 @@ dnl
AC_ARG_ENABLE(skins, AC_ARG_ENABLE(skins,
[ --enable-skins Skins interface module (default enabled on Win32)]) [ --enable-skins Skins interface module (default enabled on Win32)])
if test "${enable_skins}" != "no"; then if test "${enable_skins}" != "no"; then
WXWINDOWS_PATH="${PATH}"
AC_ARG_WITH(skins-wx-config-path,
[ --with-skins-wx-config-path=PATH wx-config path for the skins plugin (default search in \$PATH)],
[ if test "${with_skins_wx_config_path}" != "no"
then
WXWINDOWS_PATH="${with_skins_wx_config_path}:${PATH}"
fi ])
# look for wx-config
AC_PATH_PROG(WX_CONFIG_SKINS, wx-config, no, ${WXWINDOWS_PATH})
if test "${WX_CONFIG_SKINS}" != "no"
then
if expr 2.3.0 \> `${WX_CONFIG_SKINS} --version` >/dev/null
then
AC_MSG_ERROR([Your development package for wxWindows is too old, you need at least version 2.3.0. Please upgrade and try again. Alternatively you can also configure with --disable-skins.])
fi
AX_ADD_CPPFLAGS([skins],[`${WX_CONFIG_SKINS} --cxxflags` -DWX_SKINS])
AX_ADD_LDFLAGS([skins],[`${WX_CONFIG_SKINS} --libs`])
fi
if test "${SYS}" = "mingw32" -o "${SYS}" = "cygwin"; then if test "${SYS}" = "mingw32" -o "${SYS}" = "cygwin"; then
AX_ADD_PLUGINS([skins]) AX_ADD_PLUGINS([skins])
AX_ADD_CPPFLAGS([skins],[-U_OFF_T_ -U_off_t -Imodules/gui/skins]) AX_ADD_CPPFLAGS([skins],[-U_OFF_T_ -U_off_t -Imodules/gui/skins])
AX_ADD_CXXFLAGS([skins],[-O2 -fno-rtti]) AX_ADD_CXXFLAGS([skins],[-O2 -fno-rtti])
AX_ADD_LDFLAGS([skins],[-loleaut32 -lwinspool -lwinmm -lshell32 -lctl3d32 -ladvapi32 -lwsock32 -lgdi32 -lcomdlg32 -lole32 -luuid -lcomctl32]) AX_ADD_LDFLAGS([skins],[-loleaut32 -lwinspool -lwinmm -lshell32 -lctl3d32 -ladvapi32 -lwsock32 -lgdi32 -lcomdlg32 -lole32 -luuid -lcomctl32])
else
if test "${enable_skins}" = "yes"; then else if test "${enable_skins}" = "yes"; then
IMLIB2_PATH="${PATH}" IMLIB2_PATH="${PATH}"
AC_PATH_PROG(IMLIB2_CONFIG_SKINS, imlib2-config, no, ${IMLIB2_PATH}) AC_PATH_PROG(IMLIB2_CONFIG_SKINS, imlib2-config, no, ${IMLIB2_PATH})
if test "${IMLIB2_CONFIG_SKINS}" = "no"; then if test "${IMLIB2_CONFIG_SKINS}" = "no"; then
...@@ -2458,36 +2440,7 @@ if test "${enable_skins}" != "no"; then ...@@ -2458,36 +2440,7 @@ if test "${enable_skins}" != "no"; then
AX_ADD_CPPFLAGS([skins],[-Imodules/gui/skins -I${x_includes} `${IMLIB2_CONFIG_SKINS} --cflags` -DX11_SKINS]) AX_ADD_CPPFLAGS([skins],[-Imodules/gui/skins -I${x_includes} `${IMLIB2_CONFIG_SKINS} --cflags` -DX11_SKINS])
AX_ADD_CXXFLAGS([skins],[-O2 -fno-rtti]) AX_ADD_CXXFLAGS([skins],[-O2 -fno-rtti])
AX_ADD_LDFLAGS([skins],[-L${x_libraries} -lXext -lX11 `${IMLIB2_CONFIG_SKINS} --libs`]) AX_ADD_LDFLAGS([skins],[-L${x_libraries} -lXext -lX11 `${IMLIB2_CONFIG_SKINS} --libs`])
AX_ADD_PLUGINS([skins]) fi fi
fi
fi
fi
dnl
dnl Basic skins module (i.e. without wxWindows dialogs)
dnl
AC_ARG_ENABLE(basic-skins,
[ --enable-basic-skins Skins interface module without wxWindows dialogs (default disabled)])
if test "${enable_basic_skins}" = "yes"; then
if test "${SYS}" = "mingw32" -o "${SYS}" = "cygwin"; then
AX_ADD_CPPFLAGS([basic_skins],[-U_OFF_T_ -U_off_t -Imodules/gui/skins])
AX_ADD_CXXFLAGS([basic_skins],[-O2 -fno-rtti])
AX_ADD_LDFLAGS([basic_skins],[-loleaut32 -lwinspool -lwinmm -lshell32 -lctl3d32 -ladvapi32 -lwsock32 -lgdi32 -lcomdlg32 -lole32 -luuid -lcomctl32])
else
IMLIB2_PATH="${PATH}"
AC_PATH_PROG(IMLIB2_CONFIG_SKINS, imlib2-config, no, ${IMLIB2_PATH})
if test "${IMLIB2_CONFIG_SKINS}" = "no"; then
AC_MSG_ERROR([Couldn't find the imlib2 package. You can download imlib2 from http://enlightenment.org/, or configure with --disable-basic-skins.])
fi
AX_ADD_CPPFLAGS([basic_skins],[-Imodules/gui/skins -I${x_includes} `${IMLIB2_CONFIG_SKINS} --cflags` -DX11_SKINS])
AX_ADD_CXXFLAGS([basic_skins],[-O2 -fno-rtti])
AX_ADD_LDFLAGS([basic_skins],[-L${x_libraries} -lXext -lX11 `${IMLIB2_CONFIG_SKINS} --libs`])
fi
AX_ADD_PLUGINS([basic_skins])
fi fi
dnl dnl
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
* interface, such as message output. * interface, such as message output.
***************************************************************************** *****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN * Copyright (C) 1999, 2000 VideoLAN
* $Id: vlc_interface.h,v 1.1 2003/06/24 13:33:49 sam Exp $ * $Id: vlc_interface.h,v 1.2 2003/07/17 17:30:40 gbazin Exp $
* *
* Authors: Vincent Seguin <seguin@via.ecp.fr> * Authors: Vincent Seguin <seguin@via.ecp.fr>
* *
...@@ -44,6 +44,9 @@ struct intf_thread_t ...@@ -44,6 +44,9 @@ struct intf_thread_t
module_t * p_module; module_t * p_module;
void ( *pf_run ) ( intf_thread_t * ); void ( *pf_run ) ( intf_thread_t * );
/* Specific for dialogs providers */
void ( *pf_show_dialog ) ( intf_thread_t *, int, int );
/* XXX: new message passing stuff will go here */ /* XXX: new message passing stuff will go here */
vlc_mutex_t change_lock; vlc_mutex_t change_lock;
vlc_bool_t b_menu_change; vlc_bool_t b_menu_change;
...@@ -76,3 +79,15 @@ VLC_EXPORT( void, intf_Destroy, ( intf_thread_t * ) ); ...@@ -76,3 +79,15 @@ VLC_EXPORT( void, intf_Destroy, ( intf_thread_t * ) );
#else #else
# define CONSOLE_INTRO_MSG # define CONSOLE_INTRO_MSG
#endif #endif
/* Interface dialog ids for dialog providers */
#define INTF_DIALOG_FILE_SIMPLE 1
#define INTF_DIALOG_FILE 2
#define INTF_DIALOG_DISC 3
#define INTF_DIALOG_NET 4
#define INTF_DIALOG_SAT 5
#define INTF_DIALOG_PLAYLIST 10
#define INTF_DIALOG_MESSAGES 11
#define INTF_DIALOG_FILEINFO 12
#define INTF_DIALOG_PREFS 13
SOURCES_skins = \ SOURCES_skins = \
os_api.h \
os_bitmap.h \
os_event.h \
os_font.h \
os_graphics.h \
os_theme.h \
os_window.h \
\
controls/controls.h \
controls/button.cpp \
controls/button.h \
controls/checkbox.cpp \
controls/checkbox.h \
controls/generic.cpp \
controls/generic.h \
controls/image.cpp \
controls/image.h \
controls/playlist.cpp \
controls/playlist.h \
controls/rectangle.cpp \
controls/rectangle.h \
controls/slider.cpp \
controls/slider.h \
controls/text.cpp \
controls/text.h \
\
parser/flex.c \
parser/skin.h \
parser/skin.c \
parser/wrappers.h \
parser/wrappers.cpp \
\
src/anchor.cpp \
src/anchor.h \
src/banks.cpp \
src/banks.h \
src/bezier.cpp \
src/bezier.h \
src/bitmap.cpp \
src/bitmap.h \
src/dialogs.cpp \
src/dialogs.h \
src/event.cpp \
src/event.h \
src/font.cpp \
src/font.h \
src/graphics.cpp \
src/graphics.h \
src/skin_main.cpp \
src/skin_common.h \
src/theme.cpp \
src/theme.h \
src/themeloader.cpp \
src/themeloader.h \
src/vlcproc.cpp \
src/vlcproc.h \
src/window.cpp \
src/window.h \
\
win32/win32_api.cpp \
win32/win32_bitmap.cpp \
win32/win32_bitmap.h \
win32/win32_dragdrop.cpp \
win32/win32_dragdrop.h \
win32/win32_event.cpp \
win32/win32_event.h \
win32/win32_font.cpp \
win32/win32_font.h \
win32/win32_graphics.cpp \
win32/win32_graphics.h \
win32/win32_run.cpp \
win32/win32_theme.cpp \
win32/win32_theme.h \
win32/win32_window.cpp \
win32/win32_window.h \
\
x11/x11_api.cpp \
x11/x11_bitmap.cpp \
x11/x11_bitmap.h \
x11/x11_dragdrop.cpp \
x11/x11_dragdrop.h \
x11/x11_event.cpp \
x11/x11_event.h \
x11/x11_font.cpp \
x11/x11_font.h \
x11/x11_graphics.cpp \
x11/x11_graphics.h \
x11/x11_run.cpp \
x11/x11_theme.cpp \
x11/x11_theme.h \
x11/x11_timer.cpp \
x11/x11_timer.h \
x11/x11_window.cpp \
x11/x11_window.h \
\
../wxwindows/wxwindows.h \
../wxwindows/fileinfo.cpp \
../wxwindows/messages.cpp \
../wxwindows/open.cpp \
../wxwindows/preferences.cpp \
../wxwindows/streamout.cpp \
../wxwindows/subtitles.cpp \
../wxwindows/menus.cpp \
$(NULL)
SOURCES_basic_skins = \
os_api.h \ os_api.h \
os_bitmap.h \ os_bitmap.h \
os_event.h \ os_event.h \
......
This diff is collapsed.
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* dialogs.h: Dialogs class * dialogs.h: Dialogs class
***************************************************************************** *****************************************************************************
* Copyright (C) 2003 VideoLAN * Copyright (C) 2003 VideoLAN
* $Id: dialogs.h,v 1.6 2003/06/11 10:42:34 gbazin Exp $ * $Id: dialogs.h,v 1.7 2003/07/17 17:30:40 gbazin Exp $
* *
* Authors: Gildas Bazin <gbazin@netcourrier.com> * Authors: Gildas Bazin <gbazin@netcourrier.com>
* *
...@@ -32,32 +32,6 @@ using namespace std; ...@@ -32,32 +32,6 @@ using namespace std;
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
struct intf_thread_t; struct intf_thread_t;
#if !defined(MODULE_NAME_IS_basic_skins)
#ifdef WIN32 /* mingw32 hack */
# undef Yield
# undef CreateDialog
#endif
/* Let vlc take care of the i18n stuff */
#define WXINTL_NO_GETTEXT_MACRO
#include <wx/wx.h>
class OpenDialog;
class Messages;
class SoutDialog;
class PrefsDialog;
class FileInfo;
class wxIcon;
typedef struct dialogs_thread_t
{
VLC_COMMON_MEMBERS
intf_thread_t * p_intf;
} dialogs_thread_t;
#endif
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
class Dialogs class Dialogs
{ {
...@@ -71,6 +45,7 @@ class Dialogs ...@@ -71,6 +45,7 @@ class Dialogs
// Destructor // Destructor
virtual ~Dialogs(); virtual ~Dialogs();
static void ShowDialog( intf_thread_t *, int, int );
void ShowOpen( bool b_play ); void ShowOpen( bool b_play );
void ShowOpenSkin(); void ShowOpenSkin();
void ShowMessages(); void ShowMessages();
...@@ -80,24 +55,12 @@ class Dialogs ...@@ -80,24 +55,12 @@ class Dialogs
vlc_bool_t b_popup_change; vlc_bool_t b_popup_change;
#if !defined(MODULE_NAME_IS_basic_skins) private:
// Dialogs /* Dialogs provider module */
OpenDialog *OpenDlg; intf_thread_t *p_provider;
Messages *MessagesDlg; module_t *p_module;
PrefsDialog *PrefsDlg;
FileInfo *FileInfoDlg;
dialogs_thread_t *p_thread;
void OnShowOpen( wxCommandEvent& event );
void OnShowOpenSkin( wxCommandEvent& event );
void OnShowMessages( wxCommandEvent& event );
void OnShowPrefs( wxCommandEvent& event );
void OnShowFileInfo( wxCommandEvent& event );
void OnShowPopup( wxCommandEvent& event );
void OnExitThread( wxCommandEvent& event );
#endif
}; };
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
#endif #endif
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* skin_common.h: Private Skin interface description * skin_common.h: Private Skin interface description
***************************************************************************** *****************************************************************************
* Copyright (C) 2003 VideoLAN * Copyright (C) 2003 VideoLAN
* $Id: skin_common.h,v 1.21 2003/06/13 21:18:53 asmax Exp $ * $Id: skin_common.h,v 1.22 2003/07/17 17:30:40 gbazin Exp $
* *
* Authors: Olivier Teulire <ipkiss@via.ecp.fr> * Authors: Olivier Teulire <ipkiss@via.ecp.fr>
* Emmanuel Puig <karibu@via.ecp.fr> * Emmanuel Puig <karibu@via.ecp.fr>
...@@ -75,6 +75,9 @@ struct intf_sys_t ...@@ -75,6 +75,9 @@ struct intf_sys_t
// Interface dialogs // Interface dialogs
Dialogs *p_dialogs; Dialogs *p_dialogs;
// Send an event to show a dialog
void (*pf_showdialog) ( intf_thread_t *p_intf, int i_dialog, int i_arg );
// Popup menu // Popup menu
vlc_bool_t b_popup_change; vlc_bool_t b_popup_change;
#if !defined(MODULE_NAME_IS_basic_skins) #if !defined(MODULE_NAME_IS_basic_skins)
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* skin-main.cpp: skins plugin for VLC * skin-main.cpp: skins plugin for VLC
***************************************************************************** *****************************************************************************
* Copyright (C) 2003 VideoLAN * Copyright (C) 2003 VideoLAN
* $Id: skin_main.cpp,v 1.44 2003/07/13 14:55:17 gbazin Exp $ * $Id: skin_main.cpp,v 1.45 2003/07/17 17:30:40 gbazin Exp $
* *
* Authors: Olivier Teulire <ipkiss@via.ecp.fr> * Authors: Olivier Teulire <ipkiss@via.ecp.fr>
* Emmanuel Puig <karibu@via.ecp.fr> * Emmanuel Puig <karibu@via.ecp.fr>
...@@ -28,17 +28,6 @@ ...@@ -28,17 +28,6 @@
#include <vlc/intf.h> #include <vlc/intf.h>
#include <vlc/aout.h> #include <vlc/aout.h>
//--- GENERAL ---------------------------------------------------------------
#if !defined(MODULE_NAME_IS_basic_skins)
#ifdef WIN32 /* mingw32 hack */
# undef Yield
# undef CreateDialog
#endif
/* Let vlc take care of the i18n stuff */
#define WXINTL_NO_GETTEXT_MACRO
#include <wx/wx.h>
#endif
//--- SKIN ------------------------------------------------------------------ //--- SKIN ------------------------------------------------------------------
#include "../os_api.h" #include "../os_api.h"
#include "event.h" #include "event.h"
...@@ -51,10 +40,6 @@ ...@@ -51,10 +40,6 @@
#include "skin_common.h" #include "skin_common.h"
#include "dialogs.h" #include "dialogs.h"
#if !defined(MODULE_NAME_IS_basic_skins)
#include "../../wxwindows/wxwindows.h"
#endif
#ifdef X11_SKINS #ifdef X11_SKINS
#include <X11/Xlib.h> #include <X11/Xlib.h>
#include <Imlib2.h> #include <Imlib2.h>
...@@ -102,6 +87,7 @@ static int Open ( vlc_object_t *p_this ) ...@@ -102,6 +87,7 @@ static int Open ( vlc_object_t *p_this )
}; };
p_intf->pf_run = Run; p_intf->pf_run = Run;
p_intf->p_sys->pf_showdialog = Dialogs::ShowDialog;
// Suscribe to messages bank // Suscribe to messages bank
...@@ -249,12 +235,9 @@ static void Run( intf_thread_t *p_intf ) ...@@ -249,12 +235,9 @@ static void Run( intf_thread_t *p_intf )
int a = OSAPI_GetTime(); int a = OSAPI_GetTime();
#if !defined(MODULE_NAME_IS_basic_skins)
// Initialize the dialog boxes // Initialize the dialog boxes
p_intf->p_sys->p_dialogs = new Dialogs( p_intf ); p_intf->p_sys->p_dialogs = new Dialogs( p_intf );
if( !p_intf->p_sys->p_dialogs || if( !p_intf->p_sys->p_dialogs ) return;
!p_intf->p_sys->p_dialogs->OpenDlg ) return;
#endif
// Load a theme // Load a theme
char *skin_last = config_GetPsz( p_intf, "skin_last" ); char *skin_last = config_GetPsz( p_intf, "skin_last" );
...@@ -286,6 +269,7 @@ static void Run( intf_thread_t *p_intf ) ...@@ -286,6 +269,7 @@ static void Run( intf_thread_t *p_intf )
if( !Loader->Load( user_skin ) && !Loader->Load( default_skin ) ) if( !Loader->Load( user_skin ) && !Loader->Load( default_skin ) )
{ {
#endif #endif
#if 0
#if !defined(MODULE_NAME_IS_basic_skins) #if !defined(MODULE_NAME_IS_basic_skins)
wxMutexGuiEnter(); wxMutexGuiEnter();
wxFileDialog dialog( NULL, wxFileDialog dialog( NULL,
...@@ -306,11 +290,14 @@ static void Run( intf_thread_t *p_intf ) ...@@ -306,11 +290,14 @@ static void Run( intf_thread_t *p_intf )
wxMutexGuiLeave(); wxMutexGuiLeave();
} }
else else
#endif
#endif #endif
{ {
delete Loader; delete Loader;
#if 0
#if !defined(MODULE_NAME_IS_basic_skins) #if !defined(MODULE_NAME_IS_basic_skins)
wxMutexGuiLeave(); wxMutexGuiLeave();
#endif
#endif #endif
return; return;
} }
...@@ -329,10 +316,8 @@ static void Run( intf_thread_t *p_intf ) ...@@ -329,10 +316,8 @@ static void Run( intf_thread_t *p_intf )
OSRun( p_intf ); OSRun( p_intf );
#if !defined(MODULE_NAME_IS_basic_skins)
// clean up the dialog boxes // clean up the dialog boxes
delete p_intf->p_sys->p_dialogs; delete p_intf->p_sys->p_dialogs;
#endif
} }
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
...@@ -359,9 +344,6 @@ vlc_module_begin(); ...@@ -359,9 +344,6 @@ vlc_module_begin();
set_description( _("Skinnable Interface") ); set_description( _("Skinnable Interface") );
set_capability( "interface", 30 ); set_capability( "interface", 30 );
set_callbacks( Open, Close ); set_callbacks( Open, Close );
#if !defined(WIN32) && !defined(MODULE_NAME_IS_basic_skins)
linked_with_a_crap_library_which_uses_atexit();
#endif
vlc_module_end(); vlc_module_end();
...@@ -384,14 +366,6 @@ int SkinManage( intf_thread_t *p_intf ) ...@@ -384,14 +366,6 @@ int SkinManage( intf_thread_t *p_intf )
p_intf->p_sys->p_input = NULL; p_intf->p_sys->p_input = NULL;
} }
#if !defined(MODULE_NAME_IS_basic_skins) //FIXME
// Update the log window
p_intf->p_sys->p_dialogs->MessagesDlg->UpdateLog();
// Update the file info window
p_intf->p_sys->p_dialogs->FileInfoDlg->UpdateFileInfo();
#endif
//------------------------------------------------------------------------- //-------------------------------------------------------------------------
if( p_intf->p_sys->p_input != NULL && !p_intf->p_sys->p_input->b_die ) if( p_intf->p_sys->p_input != NULL && !p_intf->p_sys->p_input->b_die )
{ {
......
...@@ -2,6 +2,7 @@ SOURCES_wxwindows = \ ...@@ -2,6 +2,7 @@ SOURCES_wxwindows = \
wxwindows.cpp \ wxwindows.cpp \
wxwindows.h \ wxwindows.h \
interface.cpp \ interface.cpp \
dialogs.cpp \
open.cpp \ open.cpp \
streamout.cpp \ streamout.cpp \
messages.cpp \ messages.cpp \
......
/*****************************************************************************
* dialogs.cpp : wxWindows plugin for vlc
*****************************************************************************
* Copyright (C) 2000-2001 VideoLAN
* $Id: dialogs.cpp,v 1.1 2003/07/17 17:30:40 gbazin Exp $
*
* Authors: Gildas Bazin <gbazin@netcourrier.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
/*****************************************************************************
* Preamble
*****************************************************************************/
#include <stdlib.h> /* malloc(), free() */
#include <errno.h> /* ENOMEM */
#include <string.h> /* strerror() */
#include <stdio.h>
#include <vlc/vlc.h>
#include <vlc/aout.h>
#ifdef WIN32 /* mingw32 hack */
#undef Yield
#undef CreateDialog
#endif
/* Let vlc take care of the i18n stuff */
#define WXINTL_NO_GETTEXT_MACRO
#include <wx/wxprec.h>
#include <wx/wx.h>
#include <vlc/intf.h>
#include "stream_control.h"
#include "wxwindows.h"
/* include the icon graphic */
#include "../../../share/vlc32x32.xpm"
DEFINE_LOCAL_EVENT_TYPE( wxEVT_DIALOG );
BEGIN_EVENT_TABLE(DialogsProvider, wxFrame)
/* Idle loop used to update some of the dialogs */
EVT_IDLE(DialogsProvider::OnIdle)
/* Custom wxDialog events */
EVT_COMMAND(INTF_DIALOG_FILE, wxEVT_DIALOG, DialogsProvider::OnOpenFile)
EVT_COMMAND(INTF_DIALOG_DISC, wxEVT_DIALOG, DialogsProvider::OnOpenDisc)
EVT_COMMAND(INTF_DIALOG_NET, wxEVT_DIALOG, DialogsProvider::OnOpenNet)
EVT_COMMAND(INTF_DIALOG_FILE_SIMPLE, wxEVT_DIALOG,
DialogsProvider::OnOpenFileSimple)
EVT_COMMAND(INTF_DIALOG_PLAYLIST, wxEVT_DIALOG,
DialogsProvider::OnPlaylist)
EVT_COMMAND(INTF_DIALOG_MESSAGES, wxEVT_DIALOG,
DialogsProvider::OnMessages)
EVT_COMMAND(INTF_DIALOG_PREFS, wxEVT_DIALOG,
DialogsProvider::OnPreferences)
EVT_COMMAND(INTF_DIALOG_FILEINFO, wxEVT_DIALOG,
DialogsProvider::OnFileInfo)
//EVT_COMMAND(ShowPopup_Event, wxEVT_DIALOG, DialogsProvider::OnShowPopup)
END_EVENT_TABLE()
/*****************************************************************************
* Constructor.
*****************************************************************************/
DialogsProvider::DialogsProvider( intf_thread_t *_p_intf, wxWindow *p_parent )
: wxFrame( p_parent, -1, wxT("") )
{
/* Initializations */
p_intf = _p_intf;
p_open_dialog = NULL;
p_file_dialog = NULL;
p_playlist_dialog = NULL;
p_messages_dialog = NULL;
p_fileinfo_dialog = NULL;
p_prefs_dialog = NULL;
/* Give our interface a nice little icon */
p_intf->p_sys->p_icon = new wxIcon( vlc_xpm );
/* Create the messages dialog so it can begin storing logs */
p_messages_dialog = new Messages( p_intf, p_parent ? p_parent : this );
}
DialogsProvider::~DialogsProvider()
{
/* Clean up */
if( p_open_dialog ) delete p_open_dialog;
if( p_prefs_dialog ) p_prefs_dialog->Destroy();
if( p_file_dialog ) delete p_file_dialog;
if( p_playlist_dialog ) delete p_playlist_dialog;
if( p_messages_dialog ) delete p_messages_dialog;
if( p_fileinfo_dialog ) delete p_fileinfo_dialog;
if( p_intf->p_sys->p_icon ) delete p_intf->p_sys->p_icon;
}
void DialogsProvider::OnIdle( wxIdleEvent& WXUNUSED(event) )
{
/* Update the log window */
if( p_messages_dialog )
p_messages_dialog->UpdateLog();
/* Update the playlist */
if( p_playlist_dialog )
p_playlist_dialog->UpdatePlaylist();
/* Update the fileinfo windows */
if( p_fileinfo_dialog )
p_fileinfo_dialog->UpdateFileInfo();
}
void DialogsProvider::OnPlaylist( wxCommandEvent& WXUNUSED(event) )
{
/* Show/hide the playlist window */
if( !p_playlist_dialog )
p_playlist_dialog = new Playlist( p_intf, this );
if( p_playlist_dialog )
{
p_playlist_dialog->ShowPlaylist( !p_playlist_dialog->IsShown() );
}
}
void DialogsProvider::OnMessages( wxCommandEvent& WXUNUSED(event) )
{
/* Show/hide the log window */
if( !p_messages_dialog )
p_messages_dialog = new Messages( p_intf, this );
if( p_messages_dialog )
{
p_messages_dialog->Show( !p_messages_dialog->IsShown() );
}
}
void DialogsProvider::OnFileInfo( wxCommandEvent& WXUNUSED(event) )
{
/* Show/hide the file info window */
if( !p_fileinfo_dialog )
p_fileinfo_dialog = new FileInfo( p_intf, this );
if( p_fileinfo_dialog )
{
p_fileinfo_dialog->Show( !p_fileinfo_dialog->IsShown() );
}
}
void DialogsProvider::OnPreferences( wxCommandEvent& WXUNUSED(event) )
{
/* Show/hide the open dialog */
if( !p_prefs_dialog )
p_prefs_dialog = new PrefsDialog( p_intf, this );
if( p_prefs_dialog )
{
p_prefs_dialog->Show( !p_prefs_dialog->IsShown() );
}
}
void DialogsProvider::OnOpenFileSimple( wxCommandEvent& event )
{
playlist_t *p_playlist =
(playlist_t *)vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
FIND_ANYWHERE );
if( p_playlist == NULL )
{
return;
}
if( p_file_dialog == NULL )
p_file_dialog = new wxFileDialog( this, wxU(_("Open file")),
wxT(""), wxT(""), wxT("*"), wxOPEN | wxMULTIPLE );
if( p_file_dialog && p_file_dialog->ShowModal() == wxID_OK )
{
wxArrayString paths;
p_file_dialog->GetPaths( paths );
for( size_t i = 0; i < paths.GetCount(); i++ )
if( event.GetInt() )
playlist_Add( p_playlist, (const char *)paths[i].mb_str(),
PLAYLIST_APPEND | (i ? 0 : PLAYLIST_GO),
PLAYLIST_END );
else
playlist_Add( p_playlist, (const char *)paths[i].mb_str(),
PLAYLIST_APPEND, PLAYLIST_END );
}
vlc_object_release( p_playlist );
}
void DialogsProvider::OnOpenFile( wxCommandEvent& event )
{
Open( FILE_ACCESS, event.GetInt() );
}
void DialogsProvider::OnOpenDisc( wxCommandEvent& event )
{
Open( DISC_ACCESS, event.GetInt() );
}
void DialogsProvider::OnOpenNet( wxCommandEvent& event )
{
Open( NET_ACCESS, event.GetInt() );
}
void DialogsProvider::OnOpenSat( wxCommandEvent& event )
{
Open( SAT_ACCESS, event.GetInt() );
}
void DialogsProvider::Open( int i_access_method, int i_arg )
{
/* Show/hide the open dialog */
if( !p_open_dialog )
p_open_dialog = new OpenDialog( p_intf, this, i_access_method, i_arg );
if( p_open_dialog )
{
p_open_dialog->Show( i_access_method, i_arg );
}
}
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* interface.cpp : wxWindows plugin for vlc * interface.cpp : wxWindows plugin for vlc
***************************************************************************** *****************************************************************************
* Copyright (C) 2000-2001 VideoLAN * Copyright (C) 2000-2001 VideoLAN
* $Id: interface.cpp,v 1.45 2003/07/12 13:33:10 gbazin Exp $ * $Id: interface.cpp,v 1.46 2003/07/17 17:30:40 gbazin Exp $
* *
* Authors: Gildas Bazin <gbazin@netcourrier.com> * Authors: Gildas Bazin <gbazin@netcourrier.com>
* *
...@@ -155,10 +155,11 @@ BEGIN_EVENT_TABLE(Interface, wxFrame) ...@@ -155,10 +155,11 @@ BEGIN_EVENT_TABLE(Interface, wxFrame)
/* Menu events */ /* Menu events */
EVT_MENU(Exit_Event, Interface::OnExit) EVT_MENU(Exit_Event, Interface::OnExit)
EVT_MENU(About_Event, Interface::OnAbout) EVT_MENU(About_Event, Interface::OnAbout)
EVT_MENU(Playlist_Event, Interface::OnPlaylist)
EVT_MENU(Logs_Event, Interface::OnLogs) EVT_MENU(Playlist_Event, Interface::OnShowDialog)
EVT_MENU(FileInfo_Event, Interface::OnFileInfo) EVT_MENU(Logs_Event, Interface::OnShowDialog)
EVT_MENU(Prefs_Event, Interface::OnPreferences) EVT_MENU(FileInfo_Event, Interface::OnShowDialog)
EVT_MENU(Prefs_Event, Interface::OnShowDialog)
EVT_MENU_OPEN(Interface::OnMenuOpen) EVT_MENU_OPEN(Interface::OnMenuOpen)
...@@ -168,11 +169,11 @@ BEGIN_EVENT_TABLE(Interface, wxFrame) ...@@ -168,11 +169,11 @@ BEGIN_EVENT_TABLE(Interface, wxFrame)
EVT_RIGHT_UP(Interface::OnContextMenu) EVT_RIGHT_UP(Interface::OnContextMenu)
/* Toolbar events */ /* Toolbar events */
EVT_MENU(OpenFileSimple_Event, Interface::OnOpenFileSimple) EVT_MENU(OpenFileSimple_Event, Interface::OnShowDialog)
EVT_MENU(OpenFile_Event, Interface::OnOpenFile) EVT_MENU(OpenFile_Event, Interface::OnShowDialog)
EVT_MENU(OpenDisc_Event, Interface::OnOpenDisc) EVT_MENU(OpenDisc_Event, Interface::OnShowDialog)
EVT_MENU(OpenNet_Event, Interface::OnOpenNet) EVT_MENU(OpenNet_Event, Interface::OnShowDialog)
EVT_MENU(OpenSat_Event, Interface::OnOpenSat) EVT_MENU(OpenSat_Event, Interface::OnShowDialog)
EVT_MENU(StopStream_Event, Interface::OnStopStream) EVT_MENU(StopStream_Event, Interface::OnStopStream)
EVT_MENU(PlayStream_Event, Interface::OnPlayStream) EVT_MENU(PlayStream_Event, Interface::OnPlayStream)
EVT_MENU(PrevStream_Event, Interface::OnPrevStream) EVT_MENU(PrevStream_Event, Interface::OnPrevStream)
...@@ -182,6 +183,7 @@ BEGIN_EVENT_TABLE(Interface, wxFrame) ...@@ -182,6 +183,7 @@ BEGIN_EVENT_TABLE(Interface, wxFrame)
/* Slider events */ /* Slider events */
EVT_COMMAND_SCROLL(SliderScroll_Event, Interface::OnSliderUpdate) EVT_COMMAND_SCROLL(SliderScroll_Event, Interface::OnSliderUpdate)
END_EVENT_TABLE() END_EVENT_TABLE()
/***************************************************************************** /*****************************************************************************
...@@ -193,14 +195,10 @@ Interface::Interface( intf_thread_t *_p_intf ): ...@@ -193,14 +195,10 @@ Interface::Interface( intf_thread_t *_p_intf ):
{ {
/* Initializations */ /* Initializations */
p_intf = _p_intf; p_intf = _p_intf;
p_prefs_dialog = NULL;
i_old_playing_status = PAUSE_S; i_old_playing_status = PAUSE_S;
p_open_dialog = NULL;
p_file_dialog = NULL;
/* Give our interface a nice little icon */ /* Give our interface a nice little icon */
p_intf->p_sys->p_icon = new wxIcon( vlc_xpm ); SetIcon( wxIcon( vlc_xpm ) );
SetIcon( *p_intf->p_sys->p_icon );
/* Create a sizer for the main frame */ /* Create a sizer for the main frame */
frame_sizer = new wxBoxSizer( wxHORIZONTAL ); frame_sizer = new wxBoxSizer( wxHORIZONTAL );
...@@ -225,7 +223,6 @@ Interface::Interface( intf_thread_t *_p_intf ): ...@@ -225,7 +223,6 @@ Interface::Interface( intf_thread_t *_p_intf ):
statusbar->SetStatusWidths( 3, i_status_width ); statusbar->SetStatusWidths( 3, i_status_width );
statusbar->SetStatusText( wxString::Format(wxT("x%.2f"), 1.0), 1 ); statusbar->SetStatusText( wxString::Format(wxT("x%.2f"), 1.0), 1 );
/* Make sure we've got the right background colour */ /* Make sure we've got the right background colour */
SetBackgroundColour( slider_frame->GetBackgroundColour() ); SetBackgroundColour( slider_frame->GetBackgroundColour() );
...@@ -243,10 +240,6 @@ Interface::Interface( intf_thread_t *_p_intf ): ...@@ -243,10 +240,6 @@ Interface::Interface( intf_thread_t *_p_intf ):
Interface::~Interface() Interface::~Interface()
{ {
/* Clean up */ /* Clean up */
if( p_open_dialog ) delete p_open_dialog;
if( p_prefs_dialog ) p_prefs_dialog->Destroy();
if( p_file_dialog ) delete p_file_dialog;
if( p_intf->p_sys->p_icon ) delete p_intf->p_sys->p_icon;
} }
/***************************************************************************** /*****************************************************************************
...@@ -444,37 +437,6 @@ void Interface::CreateOurSlider() ...@@ -444,37 +437,6 @@ void Interface::CreateOurSlider()
slider_frame->Hide(); slider_frame->Hide();
} }
void Interface::Open( int i_access_method )
{
/* Show/hide the open dialog */
if( p_open_dialog == NULL )
p_open_dialog = new OpenDialog( p_intf, this, i_access_method );
if( p_open_dialog &&
p_open_dialog->ShowModal( i_access_method ) == wxID_OK )
{
/* Update the playlist */
playlist_t *p_playlist =
(playlist_t *)vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
FIND_ANYWHERE );
if( p_playlist == NULL )
{
return;
}
for( size_t i = 0; i < p_open_dialog->mrl.GetCount(); i++ )
{
playlist_Add( p_playlist,
(const char *)p_open_dialog->mrl[i].mb_str(),
PLAYLIST_APPEND | (i ? 0 : PLAYLIST_GO), PLAYLIST_END );
}
TogglePlayButton( PLAYING_S );
vlc_object_release( p_playlist );
}
}
/***************************************************************************** /*****************************************************************************
* Event Handlers. * Event Handlers.
*****************************************************************************/ *****************************************************************************/
...@@ -607,97 +569,49 @@ void Interface::OnAbout( wxCommandEvent& WXUNUSED(event) ) ...@@ -607,97 +569,49 @@ void Interface::OnAbout( wxCommandEvent& WXUNUSED(event) )
wxT("VLC media player")), wxOK | wxICON_INFORMATION, this ); wxT("VLC media player")), wxOK | wxICON_INFORMATION, this );
} }
void Interface::OnPlaylist( wxCommandEvent& WXUNUSED(event) ) void Interface::OnShowDialog( wxCommandEvent& event )
{ {
/* Show/hide the playlist window */ if( p_intf->p_sys->pf_show_dialog )
Playlist *p_playlist_window = p_intf->p_sys->p_playlist_window;
if( p_playlist_window )
{ {
p_playlist_window->ShowPlaylist( ! p_playlist_window->IsShown() ); int i_id;
}
}
void Interface::OnLogs( wxCommandEvent& WXUNUSED(event) ) switch( event.GetId() )
{
/* Show/hide the log window */
wxFrame *p_messages_window = p_intf->p_sys->p_messages_window;
if( p_messages_window )
{ {
p_messages_window->Show( ! p_messages_window->IsShown() ); case OpenFileSimple_Event:
} i_id = INTF_DIALOG_FILE_SIMPLE;
} break;
case OpenFile_Event:
i_id = INTF_DIALOG_FILE;
break;
case OpenDisc_Event:
i_id = INTF_DIALOG_DISC;
break;
case OpenNet_Event:
i_id = INTF_DIALOG_NET;
break;
case OpenSat_Event:
i_id = INTF_DIALOG_SAT;
break;
case Playlist_Event:
i_id = INTF_DIALOG_PLAYLIST;
break;
case Logs_Event:
i_id = INTF_DIALOG_MESSAGES;
break;
case FileInfo_Event:
i_id = INTF_DIALOG_FILEINFO;
break;
case Prefs_Event:
i_id = INTF_DIALOG_PREFS;
break;
default:
i_id = INTF_DIALOG_FILE;
break;
void Interface::OnFileInfo( wxCommandEvent& WXUNUSED(event) )
{
/* Show/hide the file info window */
wxFrame *p_fileinfo_window = p_intf->p_sys->p_fileinfo_window;
if( p_fileinfo_window )
{
p_fileinfo_window->Show( ! p_fileinfo_window->IsShown() );
} }
}
void Interface::OnPreferences( wxCommandEvent& WXUNUSED(event) ) p_intf->p_sys->pf_show_dialog( p_intf, i_id, 1 );
{
/* Show/hide the open dialog */
if( p_prefs_dialog == NULL )
{
p_prefs_dialog = new PrefsDialog( p_intf, this );
} }
if( p_prefs_dialog )
{
p_prefs_dialog->Show( true );
}
}
void Interface::OnOpenFileSimple( wxCommandEvent& WXUNUSED(event) )
{
playlist_t *p_playlist =
(playlist_t *)vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
FIND_ANYWHERE );
if( p_playlist == NULL )
{
return;
}
if( p_file_dialog == NULL )
p_file_dialog = new wxFileDialog( this, wxU(_("Open file")),
wxT(""), wxT(""), wxT("*"), wxOPEN | wxMULTIPLE );
if( p_file_dialog && p_file_dialog->ShowModal() == wxID_OK )
{
wxArrayString paths;
p_file_dialog->GetPaths( paths );
for( size_t i = 0; i < paths.GetCount(); i++ )
playlist_Add( p_playlist, (const char *)paths[i].mb_str(),
PLAYLIST_APPEND | (i ? 0 : PLAYLIST_GO),
PLAYLIST_END );
}
vlc_object_release( p_playlist );
}
void Interface::OnOpenFile( wxCommandEvent& WXUNUSED(event) )
{
Open( FILE_ACCESS );
}
void Interface::OnOpenDisc( wxCommandEvent& WXUNUSED(event) )
{
Open( DISC_ACCESS );
}
void Interface::OnOpenNet( wxCommandEvent& WXUNUSED(event) )
{
Open( NET_ACCESS );
}
void Interface::OnOpenSat( wxCommandEvent& WXUNUSED(event) )
{
Open( SAT_ACCESS );
} }
void Interface::OnPlayStream( wxCommandEvent& WXUNUSED(event) ) void Interface::OnPlayStream( wxCommandEvent& WXUNUSED(event) )
...@@ -709,15 +623,12 @@ void Interface::OnPlayStream( wxCommandEvent& WXUNUSED(event) ) ...@@ -709,15 +623,12 @@ void Interface::OnPlayStream( wxCommandEvent& WXUNUSED(event) )
if( p_playlist == NULL ) if( p_playlist == NULL )
{ {
/* If the playlist is empty, open a file requester instead */ /* If the playlist is empty, open a file requester instead */
OnOpenFile( dummy ); OnShowDialog( dummy );
return; return;
} }
vlc_mutex_lock( &p_playlist->object_lock );
if( p_playlist->i_size ) if( p_playlist->i_size )
{ {
vlc_mutex_unlock( &p_playlist->object_lock );
input_thread_t *p_input = (input_thread_t *)vlc_object_find( p_intf, input_thread_t *p_input = (input_thread_t *)vlc_object_find( p_intf,
VLC_OBJECT_INPUT, VLC_OBJECT_INPUT,
FIND_ANYWHERE ); FIND_ANYWHERE );
...@@ -750,7 +661,7 @@ void Interface::OnPlayStream( wxCommandEvent& WXUNUSED(event) ) ...@@ -750,7 +661,7 @@ void Interface::OnPlayStream( wxCommandEvent& WXUNUSED(event) )
{ {
vlc_mutex_unlock( &p_playlist->object_lock ); vlc_mutex_unlock( &p_playlist->object_lock );
vlc_object_release( p_playlist ); vlc_object_release( p_playlist );
OnOpenFile( dummy ); OnShowDialog( dummy );
} }
} }
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* menus.cpp : wxWindows plugin for vlc * menus.cpp : wxWindows plugin for vlc
***************************************************************************** *****************************************************************************
* Copyright (C) 2000-2001 VideoLAN * Copyright (C) 2000-2001 VideoLAN
* $Id: menus.cpp,v 1.15 2003/06/05 21:22:28 gbazin Exp $ * $Id: menus.cpp,v 1.16 2003/07/17 17:30:40 gbazin Exp $
* *
* Authors: Gildas Bazin <gbazin@netcourrier.com> * Authors: Gildas Bazin <gbazin@netcourrier.com>
* *
...@@ -79,23 +79,39 @@ private: ...@@ -79,23 +79,39 @@ private:
enum enum
{ {
/* menu items */ /* menu items */
FirstAutoGenerated_Event = wxID_HIGHEST + 1000, MenuDummy_Event = wxID_HIGHEST + 1000,
MenuDummy_Event, OpenFileSimple_Event,
AudioMenu_Events, OpenFile_Event,
VideoMenu_Events = wxID_HIGHEST + 1100, OpenDisc_Event,
NavigMenu_Events = wxID_HIGHEST + 1200, OpenNet_Event,
PopupMenu_Events = wxID_HIGHEST + 1300, FirstAutoGenerated_Event = wxID_HIGHEST + 1999,
AudioMenu_Events = wxID_HIGHEST + 2000,
VideoMenu_Events = wxID_HIGHEST + 3000,
NavigMenu_Events = wxID_HIGHEST + 4000,
PopupMenu_Events = wxID_HIGHEST + 5000
}; };
BEGIN_EVENT_TABLE(Menu, wxMenu) BEGIN_EVENT_TABLE(Menu, wxMenu)
/* Menu events */
EVT_MENU(MenuDummy_Event, Menu::OnEntrySelected)
END_EVENT_TABLE() END_EVENT_TABLE()
BEGIN_EVENT_TABLE(MenuEvtHandler, wxEvtHandler) BEGIN_EVENT_TABLE(MenuEvtHandler, wxEvtHandler)
EVT_MENU(OpenFileSimple_Event, MenuEvtHandler::OnShowDialog)
EVT_MENU(OpenFile_Event, MenuEvtHandler::OnShowDialog)
EVT_MENU(OpenDisc_Event, MenuEvtHandler::OnShowDialog)
EVT_MENU(OpenNet_Event, MenuEvtHandler::OnShowDialog)
EVT_MENU(-1, MenuEvtHandler::OnMenuEvent) EVT_MENU(-1, MenuEvtHandler::OnMenuEvent)
END_EVENT_TABLE() END_EVENT_TABLE()
wxMenu *OpenStreamMenu( intf_thread_t *p_intf )
{
wxMenu *menu = new wxMenu;
menu->Append( OpenFileSimple_Event, wxU(_("Simple &Open ...")) );
menu->Append( OpenFile_Event, wxU(_("Open &File...")) );
menu->Append( OpenDisc_Event, wxU(_("Open &Disc...")) );
menu->Append( OpenNet_Event, wxU(_("Open &Network Stream...")) );
return menu;
}
void PopupMenu( intf_thread_t *p_intf, wxWindow *p_parent, void PopupMenu( intf_thread_t *p_intf, wxWindow *p_parent,
const wxPoint& pos ) const wxPoint& pos )
{ {
...@@ -168,14 +184,19 @@ void PopupMenu( intf_thread_t *p_intf, wxWindow *p_parent, ...@@ -168,14 +184,19 @@ void PopupMenu( intf_thread_t *p_intf, wxWindow *p_parent,
vlc_object_release( p_object ); vlc_object_release( p_object );
} }
/* Misc stuff */
ppsz_varnames[i++] = NULL; /* Separator */
ppsz_varnames[i++] = _("Close Menu");
/* Build menu */ /* Build menu */
Menu popupmenu( p_intf, p_parent, i, Menu popupmenu( p_intf, p_parent, i,
ppsz_varnames, pi_objects, PopupMenu_Events ); ppsz_varnames, pi_objects, PopupMenu_Events );
#if 1
/* Add static entries */
popupmenu.AppendSeparator();
popupmenu.Append( MenuDummy_Event, wxU("Open"),
OpenStreamMenu( p_intf ), wxT("") );
popupmenu.AppendSeparator();
popupmenu.Append( MenuDummy_Event, wxU(_("Close Menu")) );
#endif
p_intf->p_sys->p_popup_menu = &popupmenu; p_intf->p_sys->p_popup_menu = &popupmenu;
p_parent->PopupMenu( &popupmenu, pos.x, pos.y ); p_parent->PopupMenu( &popupmenu, pos.x, pos.y );
p_intf->p_sys->p_popup_menu = NULL; p_intf->p_sys->p_popup_menu = NULL;
...@@ -346,10 +367,6 @@ Menu::~Menu() ...@@ -346,10 +367,6 @@ Menu::~Menu()
/***************************************************************************** /*****************************************************************************
* Private methods. * Private methods.
*****************************************************************************/ *****************************************************************************/
void Menu::OnEntrySelected( wxCommandEvent& WXUNUSED(event) )
{
}
void Menu::CreateMenuItem( wxMenu *menu, char *psz_var, void Menu::CreateMenuItem( wxMenu *menu, char *psz_var,
vlc_object_t *p_object ) vlc_object_t *p_object )
{ {
...@@ -516,7 +533,8 @@ wxMenu *Menu::CreateChoicesMenu( char *psz_var, vlc_object_t *p_object ) ...@@ -516,7 +533,8 @@ wxMenu *Menu::CreateChoicesMenu( char *psz_var, vlc_object_t *p_object )
menuitem = menuitem =
new wxMenuItemExt( menu, ++i_item_id, new wxMenuItemExt( menu, ++i_item_id,
text_list.p_list->p_values[i].psz_string ? text_list.p_list->p_values[i].psz_string ?
wxU(text_list.p_list->p_values[i].psz_string): (wxString)wxU(
text_list.p_list->p_values[i].psz_string) :
wxString::Format(wxT("%d"), wxString::Format(wxT("%d"),
val_list.p_list->p_values[i].i_int), val_list.p_list->p_values[i].i_int),
wxT(""), wxITEM_RADIO, strdup(psz_var), wxT(""), wxITEM_RADIO, strdup(psz_var),
...@@ -541,6 +559,36 @@ wxMenu *Menu::CreateChoicesMenu( char *psz_var, vlc_object_t *p_object ) ...@@ -541,6 +559,36 @@ wxMenu *Menu::CreateChoicesMenu( char *psz_var, vlc_object_t *p_object )
return menu; return menu;
} }
void Menu::OnShowDialog( wxCommandEvent& event )
{
if( p_intf->p_sys->pf_show_dialog )
{
int i_id;
switch( event.GetId() )
{
case OpenFileSimple_Event:
i_id = INTF_DIALOG_FILE_SIMPLE;
break;
case OpenFile_Event:
i_id = INTF_DIALOG_FILE;
break;
case OpenDisc_Event:
i_id = INTF_DIALOG_DISC;
break;
case OpenNet_Event:
i_id = INTF_DIALOG_NET;
break;
default:
i_id = INTF_DIALOG_FILE;
break;
}
p_intf->p_sys->pf_show_dialog( p_intf, i_id, 1 );
}
}
/***************************************************************************** /*****************************************************************************
* A small helper class which intercepts all popup menu events * A small helper class which intercepts all popup menu events
*****************************************************************************/ *****************************************************************************/
...@@ -556,6 +604,36 @@ MenuEvtHandler::~MenuEvtHandler() ...@@ -556,6 +604,36 @@ MenuEvtHandler::~MenuEvtHandler()
{ {
} }
void MenuEvtHandler::OnShowDialog( wxCommandEvent& event )
{
if( p_intf->p_sys->pf_show_dialog )
{
int i_id;
switch( event.GetId() )
{
case OpenFileSimple_Event:
i_id = INTF_DIALOG_FILE_SIMPLE;
break;
case OpenFile_Event:
i_id = INTF_DIALOG_FILE;
break;
case OpenDisc_Event:
i_id = INTF_DIALOG_DISC;
break;
case OpenNet_Event:
i_id = INTF_DIALOG_NET;
break;
default:
i_id = INTF_DIALOG_FILE;
break;
}
p_intf->p_sys->pf_show_dialog( p_intf, i_id, 1 );
}
}
void MenuEvtHandler::OnMenuEvent( wxCommandEvent& event ) void MenuEvtHandler::OnMenuEvent( wxCommandEvent& event )
{ {
wxMenuItem *p_menuitem = NULL; wxMenuItem *p_menuitem = NULL;
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* open.cpp : wxWindows plugin for vlc * open.cpp : wxWindows plugin for vlc
***************************************************************************** *****************************************************************************
* Copyright (C) 2000-2001 VideoLAN * Copyright (C) 2000-2001 VideoLAN
* $Id: open.cpp,v 1.27 2003/06/14 21:18:36 gbazin Exp $ * $Id: open.cpp,v 1.28 2003/07/17 17:30:40 gbazin Exp $
* *
* Authors: Gildas Bazin <gbazin@netcourrier.com> * Authors: Gildas Bazin <gbazin@netcourrier.com>
* *
...@@ -94,7 +94,7 @@ enum ...@@ -94,7 +94,7 @@ enum
DemuxDumpBrowse_Event, DemuxDumpBrowse_Event,
}; };
BEGIN_EVENT_TABLE(OpenDialog, wxDialog) BEGIN_EVENT_TABLE(OpenDialog, wxFrame)
/* Button events */ /* Button events */
EVT_BUTTON(wxID_OK, OpenDialog::OnOk) EVT_BUTTON(wxID_OK, OpenDialog::OnOk)
EVT_BUTTON(wxID_CANCEL, OpenDialog::OnCancel) EVT_BUTTON(wxID_CANCEL, OpenDialog::OnCancel)
...@@ -141,14 +141,17 @@ BEGIN_EVENT_TABLE(OpenDialog, wxDialog) ...@@ -141,14 +141,17 @@ BEGIN_EVENT_TABLE(OpenDialog, wxDialog)
EVT_TEXT(DemuxDump_Event, OpenDialog::OnDemuxDumpChange) EVT_TEXT(DemuxDump_Event, OpenDialog::OnDemuxDumpChange)
EVT_BUTTON(DemuxDumpBrowse_Event, OpenDialog::OnDemuxDumpBrowse) EVT_BUTTON(DemuxDumpBrowse_Event, OpenDialog::OnDemuxDumpBrowse)
/* Hide the window when the user closes the window */
EVT_CLOSE(OpenDialog::OnCancel)
END_EVENT_TABLE() END_EVENT_TABLE()
/***************************************************************************** /*****************************************************************************
* Constructor. * Constructor.
*****************************************************************************/ *****************************************************************************/
OpenDialog::OpenDialog( intf_thread_t *_p_intf, wxWindow *_p_parent, OpenDialog::OpenDialog( intf_thread_t *_p_intf, wxWindow *_p_parent,
int i_access_method ): int i_access_method, int i_arg ):
wxDialog( _p_parent, -1, wxU(_("Open Target")), wxDefaultPosition, wxFrame( _p_parent, -1, wxU(_("Open Target")), wxDefaultPosition,
wxDefaultSize, wxDEFAULT_FRAME_STYLE ) wxDefaultSize, wxDEFAULT_FRAME_STYLE )
{ {
/* Initializations */ /* Initializations */
...@@ -327,15 +330,23 @@ OpenDialog::~OpenDialog() ...@@ -327,15 +330,23 @@ OpenDialog::~OpenDialog()
if( demuxdump_dialog ) delete demuxdump_dialog; if( demuxdump_dialog ) delete demuxdump_dialog;
} }
int OpenDialog::ShowModal( int i_access_method ) int OpenDialog::Show( int i_access_method, int i_arg )
{ {
int i_ret;
notebook->SetSelection( i_access_method ); notebook->SetSelection( i_access_method );
return wxDialog::ShowModal(); i_ret = wxFrame::Show();
Raise();
SetFocus();
return i_ret;
} }
int OpenDialog::ShowModal() int OpenDialog::Show()
{ {
return wxDialog::ShowModal(); int i_ret;
i_ret = wxFrame::Show();
Raise();
SetFocus();
return i_ret;
} }
/***************************************************************************** /*****************************************************************************
...@@ -636,12 +647,32 @@ void OpenDialog::OnOk( wxCommandEvent& WXUNUSED(event) ) ...@@ -636,12 +647,32 @@ void OpenDialog::OnOk( wxCommandEvent& WXUNUSED(event) )
mrl_combo->Append( mrl_combo->GetValue() ); mrl_combo->Append( mrl_combo->GetValue() );
if( mrl_combo->GetCount() > 10 ) mrl_combo->Delete( 0 ); if( mrl_combo->GetCount() > 10 ) mrl_combo->Delete( 0 );
mrl_combo->SetSelection( mrl_combo->GetCount() - 1 ); mrl_combo->SetSelection( mrl_combo->GetCount() - 1 );
EndModal( wxID_OK );
/* Update the playlist */
playlist_t *p_playlist =
(playlist_t *)vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
FIND_ANYWHERE );
if( p_playlist == NULL )
{
return;
}
for( size_t i = 0; i < mrl.GetCount(); i++ )
{
playlist_Add( p_playlist, (const char *)mrl[i].mb_str(),
PLAYLIST_APPEND | (i ? 0 : PLAYLIST_GO), PLAYLIST_END );
}
//TogglePlayButton( PLAYING_S );
vlc_object_release( p_playlist );
Hide();
} }
void OpenDialog::OnCancel( wxCommandEvent& WXUNUSED(event) ) void OpenDialog::OnCancel( wxCommandEvent& WXUNUSED(event) )
{ {
EndModal( wxID_CANCEL ); Hide();
} }
void OpenDialog::OnPageChange( wxNotebookEvent& event ) void OpenDialog::OnPageChange( wxNotebookEvent& event )
...@@ -782,7 +813,7 @@ void OpenDialog::OnSubsFileSettings( wxCommandEvent& WXUNUSED(event) ) ...@@ -782,7 +813,7 @@ void OpenDialog::OnSubsFileSettings( wxCommandEvent& WXUNUSED(event) )
{ {
/* Show/hide the open dialog */ /* Show/hide the open dialog */
if( subsfile_dialog == NULL ) if( subsfile_dialog == NULL )
subsfile_dialog = new SubsFileDialog( p_intf, p_parent ); subsfile_dialog = new SubsFileDialog( p_intf, this );
if( subsfile_dialog && subsfile_dialog->ShowModal() == wxID_OK ) if( subsfile_dialog && subsfile_dialog->ShowModal() == wxID_OK )
{ {
...@@ -818,7 +849,7 @@ void OpenDialog::OnSoutSettings( wxCommandEvent& WXUNUSED(event) ) ...@@ -818,7 +849,7 @@ void OpenDialog::OnSoutSettings( wxCommandEvent& WXUNUSED(event) )
{ {
/* Show/hide the open dialog */ /* Show/hide the open dialog */
if( sout_dialog == NULL ) if( sout_dialog == NULL )
sout_dialog = new SoutDialog( p_intf, p_parent ); sout_dialog = new SoutDialog( p_intf, this );
if( sout_dialog && sout_dialog->ShowModal() == wxID_OK ) if( sout_dialog && sout_dialog->ShowModal() == wxID_OK )
{ {
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* playlist.cpp : wxWindows plugin for vlc * playlist.cpp : wxWindows plugin for vlc
***************************************************************************** *****************************************************************************
* Copyright (C) 2000-2001 VideoLAN * Copyright (C) 2000-2001 VideoLAN
* $Id: playlist.cpp,v 1.12 2003/07/12 13:33:10 gbazin Exp $ * $Id: playlist.cpp,v 1.13 2003/07/17 17:30:40 gbazin Exp $
* *
* Authors: Olivier Teulire <ipkiss@via.ecp.fr> * Authors: Olivier Teulire <ipkiss@via.ecp.fr>
* *
...@@ -100,13 +100,12 @@ END_EVENT_TABLE() ...@@ -100,13 +100,12 @@ END_EVENT_TABLE()
/***************************************************************************** /*****************************************************************************
* Constructor. * Constructor.
*****************************************************************************/ *****************************************************************************/
Playlist::Playlist( intf_thread_t *_p_intf, Interface *_p_main_interface ): Playlist::Playlist( intf_thread_t *_p_intf, wxWindow *p_parent ):
wxFrame( _p_main_interface, -1, wxU(_("Playlist")), wxDefaultPosition, wxFrame( p_parent, -1, wxU(_("Playlist")), wxDefaultPosition,
wxDefaultSize, wxDEFAULT_FRAME_STYLE ) wxDefaultSize, wxDEFAULT_FRAME_STYLE )
{ {
/* Initializations */ /* Initializations */
p_intf = _p_intf; p_intf = _p_intf;
p_main_interface = _p_main_interface;
i_update_counter = 0; i_update_counter = 0;
b_need_update = VLC_FALSE; b_need_update = VLC_FALSE;
vlc_mutex_init( p_intf, &lock ); vlc_mutex_init( p_intf, &lock );
...@@ -364,66 +363,20 @@ void Playlist::OnOpen( wxCommandEvent& WXUNUSED(event) ) ...@@ -364,66 +363,20 @@ void Playlist::OnOpen( wxCommandEvent& WXUNUSED(event) )
void Playlist::OnAddFile( wxCommandEvent& WXUNUSED(event) ) void Playlist::OnAddFile( wxCommandEvent& WXUNUSED(event) )
{ {
playlist_t *p_playlist = p_intf->p_sys->pf_show_dialog( p_intf, INTF_DIALOG_FILE_SIMPLE, 0 );
(playlist_t *)vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
FIND_ANYWHERE );
if( p_playlist == NULL )
{
return;
}
if( p_main_interface->p_file_dialog == NULL )
p_main_interface->p_file_dialog =
new wxFileDialog( this, wxU(_("Open file")), wxT(""), wxT(""),
wxT("*"), wxOPEN | wxMULTIPLE );
if( p_main_interface->p_file_dialog &&
p_main_interface->p_file_dialog->ShowModal() == wxID_OK )
{
wxArrayString paths;
p_main_interface->p_file_dialog->GetPaths( paths );
for( size_t i = 0; i < paths.GetCount(); i++ )
playlist_Add( p_playlist, (const char *)paths[i].mb_str(),
PLAYLIST_APPEND, PLAYLIST_END );
}
vlc_object_release( p_playlist );
#if 0
Rebuild(); Rebuild();
#endif
} }
void Playlist::OnAddMRL( wxCommandEvent& WXUNUSED(event) ) void Playlist::OnAddMRL( wxCommandEvent& WXUNUSED(event) )
{ {
playlist_t *p_playlist = p_intf->p_sys->pf_show_dialog( p_intf, INTF_DIALOG_FILE, 0 );
(playlist_t *)vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
FIND_ANYWHERE );
if( p_playlist == NULL )
{
return;
}
/* Show/hide the open dialog */
if( p_main_interface->p_open_dialog == NULL )
p_main_interface->p_open_dialog =
new OpenDialog( p_intf, this, FILE_ACCESS );
if( p_main_interface->p_open_dialog &&
p_main_interface->p_open_dialog->ShowModal() == wxID_OK )
{
for( size_t i = 0;
i < p_main_interface->p_open_dialog->mrl.GetCount(); i++ )
{
playlist_Add( p_playlist,
(const char *)p_main_interface->p_open_dialog->mrl[i].mb_str(),
PLAYLIST_APPEND, PLAYLIST_END );
}
}
vlc_object_release( p_playlist );
#if 0
Rebuild(); Rebuild();
#endif
} }
void Playlist::OnInvertSelection( wxCommandEvent& WXUNUSED(event) ) void Playlist::OnInvertSelection( wxCommandEvent& WXUNUSED(event) )
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* timer.cpp : wxWindows plugin for vlc * timer.cpp : wxWindows plugin for vlc
***************************************************************************** *****************************************************************************
* Copyright (C) 2000-2001 VideoLAN * Copyright (C) 2000-2001 VideoLAN
* $Id: timer.cpp,v 1.25 2003/06/23 16:09:13 gbazin Exp $ * $Id: timer.cpp,v 1.26 2003/07/17 17:30:40 gbazin Exp $
* *
* Authors: Gildas Bazin <gbazin@netcourrier.com> * Authors: Gildas Bazin <gbazin@netcourrier.com>
* *
...@@ -51,7 +51,7 @@ ...@@ -51,7 +51,7 @@
void DisplayStreamDate( wxControl *, intf_thread_t *, int ); void DisplayStreamDate( wxControl *, intf_thread_t *, int );
/* Callback prototype */ /* Callback prototype */
int PopupMenuCB( vlc_object_t *p_this, const char *psz_variable, static int PopupMenuCB( vlc_object_t *p_this, const char *psz_variable,
vlc_value_t old_val, vlc_value_t new_val, void *param ); vlc_value_t old_val, vlc_value_t new_val, void *param );
/***************************************************************************** /*****************************************************************************
...@@ -111,15 +111,6 @@ void Timer::Notify() ...@@ -111,15 +111,6 @@ void Timer::Notify()
p_intf->p_sys->b_popup_change = VLC_FALSE; p_intf->p_sys->b_popup_change = VLC_FALSE;
} }
/* Update the log window */
p_intf->p_sys->p_messages_window->UpdateLog();
/* Update the playlist */
p_intf->p_sys->p_playlist_window->UpdatePlaylist();
/* Update the fileinfo windows */
p_intf->p_sys->p_fileinfo_window->UpdateFileInfo();
/* Update the input */ /* Update the input */
if( p_intf->p_sys->p_input == NULL ) if( p_intf->p_sys->p_input == NULL )
{ {
...@@ -301,7 +292,7 @@ void DisplayStreamDate( wxControl *p_slider_frame, intf_thread_t * p_intf , ...@@ -301,7 +292,7 @@ void DisplayStreamDate( wxControl *p_slider_frame, intf_thread_t * p_intf ,
* We don't show the menu directly here because we don't want the * We don't show the menu directly here because we don't want the
* caller to block for a too long time. * caller to block for a too long time.
*****************************************************************************/ *****************************************************************************/
int PopupMenuCB( vlc_object_t *p_this, const char *psz_variable, static int PopupMenuCB( vlc_object_t *p_this, const char *psz_variable,
vlc_value_t old_val, vlc_value_t new_val, void *param ) vlc_value_t old_val, vlc_value_t new_val, void *param )
{ {
intf_thread_t *p_intf = (intf_thread_t *)param; intf_thread_t *p_intf = (intf_thread_t *)param;
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* wxwindows.cpp : wxWindows plugin for vlc * wxwindows.cpp : wxWindows plugin for vlc
***************************************************************************** *****************************************************************************
* Copyright (C) 2000-2001 VideoLAN * Copyright (C) 2000-2001 VideoLAN
* $Id: wxwindows.cpp,v 1.17 2003/07/05 15:35:28 sam Exp $ * $Id: wxwindows.cpp,v 1.18 2003/07/17 17:30:40 gbazin Exp $
* *
* Authors: Gildas Bazin <gbazin@netcourrier.com> * Authors: Gildas Bazin <gbazin@netcourrier.com>
* *
...@@ -56,8 +56,12 @@ int wxEntry( int argc, char *argv[] , bool enterLoop = TRUE ); ...@@ -56,8 +56,12 @@ int wxEntry( int argc, char *argv[] , bool enterLoop = TRUE );
*****************************************************************************/ *****************************************************************************/
static int Open ( vlc_object_t * ); static int Open ( vlc_object_t * );
static void Close ( vlc_object_t * ); static void Close ( vlc_object_t * );
static int OpenDialogs ( vlc_object_t * );
static void Run ( intf_thread_t * ); static void Run ( intf_thread_t * );
static void Init ( intf_thread_t * );
static void ShowDialog ( intf_thread_t *, int, int );
/***************************************************************************** /*****************************************************************************
* Local classes declarations. * Local classes declarations.
...@@ -86,6 +90,12 @@ vlc_module_begin(); ...@@ -86,6 +90,12 @@ vlc_module_begin();
add_shortcut( "wxwin" ); add_shortcut( "wxwin" );
add_shortcut( "wx" ); add_shortcut( "wx" );
set_program( "wxvlc" ); set_program( "wxvlc" );
add_submodule();
set_description( _("wxWindows dialogs provider") );
set_capability( "dialogs provider", 50 );
set_callbacks( OpenDialogs, Close );
#if !defined(WIN32) #if !defined(WIN32)
linked_with_a_crap_library_which_uses_atexit(); linked_with_a_crap_library_which_uses_atexit();
#endif #endif
...@@ -121,9 +131,21 @@ static int Open( vlc_object_t *p_this ) ...@@ -121,9 +131,21 @@ static int Open( vlc_object_t *p_this )
p_intf->p_sys->p_popup_menu = NULL; p_intf->p_sys->p_popup_menu = NULL;
p_intf->p_sys->b_popup_change = VLC_FALSE; p_intf->p_sys->b_popup_change = VLC_FALSE;
p_intf->pf_show_dialog = NULL;
return VLC_SUCCESS; return VLC_SUCCESS;
} }
static int OpenDialogs( vlc_object_t *p_this )
{
intf_thread_t *p_intf = (intf_thread_t *)p_this;
int i_ret = Open( p_this );
p_intf->pf_show_dialog = ShowDialog;
return i_ret;
}
/***************************************************************************** /*****************************************************************************
* Close: destroy interface window * Close: destroy interface window
*****************************************************************************/ *****************************************************************************/
...@@ -156,9 +178,31 @@ DllMain (HANDLE hModule, DWORD fdwReason, LPVOID lpReserved) ...@@ -156,9 +178,31 @@ DllMain (HANDLE hModule, DWORD fdwReason, LPVOID lpReserved)
#endif #endif
static void Run( intf_thread_t *p_intf ) static void Run( intf_thread_t *p_intf )
{
if( p_intf->pf_show_dialog )
{
/* The module is used in dialog provider mode */
/* Create a new thread for wxWindows */
if( vlc_thread_create( p_intf, "Skins Dialogs Thread",
Init, 0, VLC_TRUE ) )
{
msg_Err( p_intf, "cannot create Skins Dialogs Thread" );
p_intf->pf_show_dialog = NULL;
}
}
else
{
/* The module is used in interface mode */
Init( p_intf );
}
}
static void Init( intf_thread_t *p_intf )
{ {
#if !defined( WIN32 ) #if !defined( WIN32 )
static char *p_args[] = { "" }; static char *p_args[] = { "" };
int i_args = 1;
#endif #endif
/* Hack to pass the p_intf pointer to the new wxWindow Instance object */ /* Hack to pass the p_intf pointer to the new wxWindow Instance object */
...@@ -166,12 +210,12 @@ static void Run( intf_thread_t *p_intf ) ...@@ -166,12 +210,12 @@ static void Run( intf_thread_t *p_intf )
#if defined( WIN32 ) #if defined( WIN32 )
#if !defined(__BUILTIN__) #if !defined(__BUILTIN__)
wxEntry( hInstance/*GetModuleHandle(NULL)*/, NULL, NULL, SW_SHOW, TRUE ); wxEntry( hInstance/*GetModuleHandle(NULL)*/, NULL, NULL, SW_SHOW );
#else #else
wxEntry( GetModuleHandle(NULL), NULL, NULL, SW_SHOW, TRUE ); wxEntry( GetModuleHandle(NULL), NULL, NULL, SW_SHOW );
#endif #endif
#else #else
wxEntry( 1, p_args ); wxEntry( i_args, p_args );
#endif #endif
} }
...@@ -206,18 +250,14 @@ bool Instance::OnInit() ...@@ -206,18 +250,14 @@ bool Instance::OnInit()
locale.Init( wxLANGUAGE_DEFAULT ); locale.Init( wxLANGUAGE_DEFAULT );
/* Make an instance of your derived frame. Passing NULL (the default value /* 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 frame * of Frame's constructor is NULL) as the frame doesn't have a parent
* since it is the first window */ * since it is the first window */
Interface *MainInterface = new Interface( p_intf );
/* Create the playlist window */
p_intf->p_sys->p_playlist_window = new Playlist( p_intf, MainInterface );
/* Create the log window */ if( !p_intf->pf_show_dialog )
p_intf->p_sys->p_messages_window = new Messages( p_intf, MainInterface ); {
/* The module is used in interface mode */
/* Create the fileinfo window */ Interface *MainInterface = new Interface( p_intf );
p_intf->p_sys->p_fileinfo_window = new FileInfo ( p_intf, MainInterface ); p_intf->p_sys->p_wxwindow = MainInterface;
/* Show the interface */ /* Show the interface */
MainInterface->Show( TRUE ); MainInterface->Show( TRUE );
...@@ -226,7 +266,25 @@ bool Instance::OnInit() ...@@ -226,7 +266,25 @@ bool Instance::OnInit()
/* Start timer */ /* Start timer */
new Timer( p_intf, MainInterface ); new Timer( p_intf, MainInterface );
}
/* 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 );
p_intf->p_sys->pf_show_dialog = ShowDialog;
/* OK, initialization is over */
vlc_thread_ready( p_intf );
/* Return TRUE to tell program to continue (FALSE would terminate) */ /* Return TRUE to tell program to continue (FALSE would terminate) */
return TRUE; return TRUE;
} }
static void ShowDialog( intf_thread_t *p_intf, int i_dialog_event, int i_arg )
{
wxCommandEvent event( wxEVT_DIALOG, i_dialog_event );
event.SetInt( i_arg );
p_intf->p_sys->p_wxwindow->AddPendingEvent( event );
}
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* wxwindows.h: private wxWindows interface description * wxwindows.h: private wxWindows interface description
***************************************************************************** *****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN * Copyright (C) 1999, 2000 VideoLAN
* $Id: wxwindows.h,v 1.42 2003/07/12 13:33:10 gbazin Exp $ * $Id: wxwindows.h,v 1.43 2003/07/17 17:30:40 gbazin Exp $
* *
* Authors: Gildas Bazin <gbazin@netcourrier.com> * Authors: Gildas Bazin <gbazin@netcourrier.com>
* *
...@@ -29,6 +29,18 @@ ...@@ -29,6 +29,18 @@
#include <wx/treectrl.h> #include <wx/treectrl.h>
#include <wx/gauge.h> #include <wx/gauge.h>
DECLARE_LOCAL_EVENT_TYPE( wxEVT_DIALOG, 0 );
enum
{
FILE_ACCESS,
DISC_ACCESS,
NET_ACCESS,
SAT_ACCESS,
FILE_SIMPLE_ACCESS
};
class OpenDialog;
class Playlist; class Playlist;
class Messages; class Messages;
class FileInfo; class FileInfo;
...@@ -52,11 +64,6 @@ struct intf_sys_t ...@@ -52,11 +64,6 @@ struct intf_sys_t
wxWindow *p_wxwindow; wxWindow *p_wxwindow;
wxIcon *p_icon; wxIcon *p_icon;
/* secondary windows */
Playlist *p_playlist_window;
Messages *p_messages_window;
FileInfo *p_fileinfo_window;
/* special actions */ /* special actions */
vlc_bool_t b_playing; vlc_bool_t b_playing;
...@@ -74,6 +81,9 @@ struct intf_sys_t ...@@ -74,6 +81,9 @@ struct intf_sys_t
/* Playlist management */ /* Playlist management */
int i_playing; /* playlist selected item */ int i_playing; /* playlist selected item */
/* Send an event to show a dialog */
void (*pf_show_dialog) ( intf_thread_t *p_intf, int i_dialog, int i_arg );
/* Popup menu */ /* Popup menu */
wxMenu *p_popup_menu; wxMenu *p_popup_menu;
vlc_bool_t b_popup_change; vlc_bool_t b_popup_change;
...@@ -108,7 +118,6 @@ private: ...@@ -108,7 +118,6 @@ private:
}; };
/* Main Interface */ /* Main Interface */
class OpenDialog;
class Interface: public wxFrame class Interface: public wxFrame
{ {
public: public:
...@@ -126,13 +135,6 @@ public: ...@@ -126,13 +135,6 @@ public:
wxGauge *volctrl; wxGauge *volctrl;
/* So we don't recreate the open dialog box each time
* (and keep the last settings) */
OpenDialog *p_open_dialog;
/* idem for the simple open file dialog */
wxFileDialog *p_file_dialog;
private: private:
void CreateOurMenuBar(); void CreateOurMenuBar();
void CreateOurToolBar(); void CreateOurToolBar();
...@@ -142,17 +144,8 @@ private: ...@@ -142,17 +144,8 @@ private:
/* Event handlers (these functions should _not_ be virtual) */ /* Event handlers (these functions should _not_ be virtual) */
void OnExit( wxCommandEvent& event ); void OnExit( wxCommandEvent& event );
void OnAbout( wxCommandEvent& event ); void OnAbout( wxCommandEvent& event );
void OnMessages( wxCommandEvent& event );
void OnPlaylist( wxCommandEvent& event );
void OnLogs( wxCommandEvent& event );
void OnFileInfo( wxCommandEvent& event );
void OnPreferences( wxCommandEvent& event );
void OnOpenFileSimple( wxCommandEvent& event ); void OnShowDialog( wxCommandEvent& event );
void OnOpenFile( wxCommandEvent& event );
void OnOpenDisc( wxCommandEvent& event );
void OnOpenNet( wxCommandEvent& event );
void OnOpenSat( wxCommandEvent& event );
void OnPlayStream( wxCommandEvent& event ); void OnPlayStream( wxCommandEvent& event );
void OnStopStream( wxCommandEvent& event ); void OnStopStream( wxCommandEvent& event );
...@@ -174,8 +167,7 @@ private: ...@@ -174,8 +167,7 @@ private:
Timer *timer; Timer *timer;
intf_thread_t *p_intf; intf_thread_t *p_intf;
wxFrame *p_prefs_dialog; private:
int i_old_playing_status; int i_old_playing_status;
/* For auto-generated menus */ /* For auto-generated menus */
...@@ -187,19 +179,59 @@ private: ...@@ -187,19 +179,59 @@ private:
vlc_bool_t b_navig_menu; vlc_bool_t b_navig_menu;
}; };
/* Dialogs Provider */
class DialogsProvider: public wxFrame
{
public:
/* Constructor */
DialogsProvider( intf_thread_t *p_intf, wxWindow *p_parent );
virtual ~DialogsProvider();
private:
void Open( int i_access_method, int i_arg );
/* Event handlers (these functions should _not_ be virtual) */
void OnExit( wxCommandEvent& event );
void OnPlaylist( wxCommandEvent& event );
void OnMessages( wxCommandEvent& event );
void OnFileInfo( wxCommandEvent& event );
void OnPreferences( wxCommandEvent& event );
void OnOpenFileSimple( wxCommandEvent& event );
void OnOpenFile( wxCommandEvent& event );
void OnOpenDisc( wxCommandEvent& event );
void OnOpenNet( wxCommandEvent& event );
void OnOpenSat( wxCommandEvent& event );
void OnIdle( wxIdleEvent& event );
DECLARE_EVENT_TABLE();
intf_thread_t *p_intf;
public:
/* Secondary windows */
OpenDialog *p_open_dialog;
wxFileDialog *p_file_dialog;
Playlist *p_playlist_dialog;
Messages *p_messages_dialog;
FileInfo *p_fileinfo_dialog;
wxFrame *p_prefs_dialog;
};
/* Open Dialog */ /* Open Dialog */
class SoutDialog; class SoutDialog;
class SubsFileDialog; class SubsFileDialog;
class OpenDialog: public wxDialog class OpenDialog: public wxFrame
{ {
public: public:
/* Constructor */ /* Constructor */
OpenDialog( intf_thread_t *p_intf, wxWindow *p_parent, OpenDialog( intf_thread_t *p_intf, wxWindow *p_parent,
int i_access_method ); int i_access_method, int i_arg = 0 );
virtual ~OpenDialog(); virtual ~OpenDialog();
int ShowModal(); int Show();
int ShowModal( int i_access_method ); int Show( int i_access_method, int i_arg = 0 );
wxArrayString mrl; wxArrayString mrl;
...@@ -288,15 +320,6 @@ private: ...@@ -288,15 +320,6 @@ private:
wxFileDialog *demuxdump_dialog; wxFileDialog *demuxdump_dialog;
}; };
enum
{
FILE_ACCESS = 0,
DISC_ACCESS,
NET_ACCESS,
SAT_ACCESS,
FILE_SIMPLE_ACCESS
};
/* Stream output Dialog */ /* Stream output Dialog */
class SoutDialog: public wxDialog class SoutDialog: public wxDialog
{ {
...@@ -461,7 +484,7 @@ class Playlist: public wxFrame ...@@ -461,7 +484,7 @@ class Playlist: public wxFrame
{ {
public: public:
/* Constructor */ /* Constructor */
Playlist( intf_thread_t *p_intf, Interface *p_main_interface ); Playlist( intf_thread_t *p_intf, wxWindow *p_parent );
virtual ~Playlist(); virtual ~Playlist();
void UpdatePlaylist(); void UpdatePlaylist();
...@@ -489,7 +512,6 @@ private: ...@@ -489,7 +512,6 @@ private:
DECLARE_EVENT_TABLE(); DECLARE_EVENT_TABLE();
intf_thread_t *p_intf; intf_thread_t *p_intf;
Interface *p_main_interface;
wxListView *listview; wxListView *listview;
int i_update_counter; int i_update_counter;
}; };
...@@ -543,7 +565,8 @@ public: ...@@ -543,7 +565,8 @@ public:
MenuEvtHandler( intf_thread_t *p_intf, Interface *p_main_interface ); MenuEvtHandler( intf_thread_t *p_intf, Interface *p_main_interface );
virtual ~MenuEvtHandler(); virtual ~MenuEvtHandler();
void MenuEvtHandler::OnMenuEvent( wxCommandEvent& event ); void OnMenuEvent( wxCommandEvent& event );
void OnShowDialog( wxCommandEvent& event );
private: private:
...@@ -564,6 +587,7 @@ public: ...@@ -564,6 +587,7 @@ public:
private: private:
/* Event handlers (these functions should _not_ be virtual) */ /* Event handlers (these functions should _not_ be virtual) */
void OnClose( wxCommandEvent& event ); void OnClose( wxCommandEvent& event );
void OnShowDialog( wxCommandEvent& event );
void OnEntrySelected( wxCommandEvent& event ); void OnEntrySelected( wxCommandEvent& event );
wxMenu *Menu::CreateDummyMenu(); wxMenu *Menu::CreateDummyMenu();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment