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 $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)
......@@ -1705,7 +1705,7 @@ dnl
dnl MP4 module
dnl
AC_CHECK_HEADERS(zlib.h, [
AX_ADD_LDFLAGS([mp4 skins basic_skins],[-lz])
AX_ADD_LDFLAGS([mp4 skins],[-lz])
] )
......@@ -1713,7 +1713,7 @@ dnl
dnl skins module
dnl
AC_CHECK_HEADERS(libtar.h, [
AX_ADD_LDFLAGS([skins basic_skins],[-ltar])
AX_ADD_LDFLAGS([skins],[-ltar])
] )
......@@ -2422,72 +2422,25 @@ dnl
AC_ARG_ENABLE(skins,
[ --enable-skins Skins interface module (default enabled on Win32)])
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
AX_ADD_PLUGINS([skins])
AX_ADD_CPPFLAGS([skins],[-U_OFF_T_ -U_off_t -Imodules/gui/skins])
AX_ADD_CXXFLAGS([skins],[-O2 -fno-rtti])
AX_ADD_LDFLAGS([skins],[-loleaut32 -lwinspool -lwinmm -lshell32 -lctl3d32 -ladvapi32 -lwsock32 -lgdi32 -lcomdlg32 -lole32 -luuid -lcomctl32])
else
if test "${enable_skins}" = "yes"; then
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-skins.])
fi
AX_ADD_PLUGINS([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_LDFLAGS([skins],[-L${x_libraries} -lXext -lX11 `${IMLIB2_CONFIG_SKINS} --libs`])
AX_ADD_PLUGINS([skins])
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
else if test "${enable_skins}" = "yes"; then
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.])
AC_MSG_ERROR([Couldn't find the imlib2 package. You can download imlib2 from http://enlightenment.org/, or configure with --disable-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])
AX_ADD_PLUGINS([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_LDFLAGS([skins],[-L${x_libraries} -lXext -lX11 `${IMLIB2_CONFIG_SKINS} --libs`])
fi fi
fi
dnl
......
......@@ -4,7 +4,7 @@
* interface, such as message output.
*****************************************************************************
* 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>
*
......@@ -44,6 +44,9 @@ struct intf_thread_t
module_t * p_module;
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 */
vlc_mutex_t change_lock;
vlc_bool_t b_menu_change;
......@@ -76,3 +79,15 @@ VLC_EXPORT( void, intf_Destroy, ( intf_thread_t * ) );
#else
# define CONSOLE_INTRO_MSG
#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 = \
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_bitmap.h \
os_event.h \
......
This diff is collapsed.
......@@ -2,7 +2,7 @@
* dialogs.h: Dialogs class
*****************************************************************************
* 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>
*
......@@ -32,32 +32,6 @@ using namespace std;
//---------------------------------------------------------------------------
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
{
......@@ -71,6 +45,7 @@ class Dialogs
// Destructor
virtual ~Dialogs();
static void ShowDialog( intf_thread_t *, int, int );
void ShowOpen( bool b_play );
void ShowOpenSkin();
void ShowMessages();
......@@ -80,24 +55,12 @@ class Dialogs
vlc_bool_t b_popup_change;
#if !defined(MODULE_NAME_IS_basic_skins)
// Dialogs
OpenDialog *OpenDlg;
Messages *MessagesDlg;
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
private:
/* Dialogs provider module */
intf_thread_t *p_provider;
module_t *p_module;
};
//---------------------------------------------------------------------------
#endif
......@@ -2,7 +2,7 @@
* skin_common.h: Private Skin interface description
*****************************************************************************
* 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>
* Emmanuel Puig <karibu@via.ecp.fr>
......@@ -75,6 +75,9 @@ struct intf_sys_t
// Interface 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
vlc_bool_t b_popup_change;
#if !defined(MODULE_NAME_IS_basic_skins)
......
......@@ -2,7 +2,7 @@
* skin-main.cpp: skins plugin for VLC
*****************************************************************************
* 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>
* Emmanuel Puig <karibu@via.ecp.fr>
......@@ -28,17 +28,6 @@
#include <vlc/intf.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 ------------------------------------------------------------------
#include "../os_api.h"
#include "event.h"
......@@ -51,10 +40,6 @@
#include "skin_common.h"
#include "dialogs.h"
#if !defined(MODULE_NAME_IS_basic_skins)
#include "../../wxwindows/wxwindows.h"
#endif
#ifdef X11_SKINS
#include <X11/Xlib.h>
#include <Imlib2.h>
......@@ -102,6 +87,7 @@ static int Open ( vlc_object_t *p_this )
};
p_intf->pf_run = Run;
p_intf->p_sys->pf_showdialog = Dialogs::ShowDialog;
// Suscribe to messages bank
......@@ -249,12 +235,9 @@ static void Run( intf_thread_t *p_intf )
int a = OSAPI_GetTime();
#if !defined(MODULE_NAME_IS_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
if( !p_intf->p_sys->p_dialogs ) return;
// Load a theme
char *skin_last = config_GetPsz( p_intf, "skin_last" );
......@@ -286,6 +269,7 @@ static void Run( intf_thread_t *p_intf )
if( !Loader->Load( user_skin ) && !Loader->Load( default_skin ) )
{
#endif
#if 0
#if !defined(MODULE_NAME_IS_basic_skins)
wxMutexGuiEnter();
wxFileDialog dialog( NULL,
......@@ -306,11 +290,14 @@ static void Run( intf_thread_t *p_intf )
wxMutexGuiLeave();
}
else
#endif
#endif
{
delete Loader;
#if 0
#if !defined(MODULE_NAME_IS_basic_skins)
wxMutexGuiLeave();
#endif
#endif
return;
}
......@@ -329,10 +316,8 @@ static void Run( intf_thread_t *p_intf )
OSRun( p_intf );
#if !defined(MODULE_NAME_IS_basic_skins)
// clean up the dialog boxes
delete p_intf->p_sys->p_dialogs;
#endif
}
//---------------------------------------------------------------------------
......@@ -359,9 +344,6 @@ vlc_module_begin();
set_description( _("Skinnable Interface") );
set_capability( "interface", 30 );
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();
......@@ -384,14 +366,6 @@ int SkinManage( intf_thread_t *p_intf )
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 )
{
......
......@@ -2,6 +2,7 @@ SOURCES_wxwindows = \
wxwindows.cpp \
wxwindows.h \
interface.cpp \
dialogs.cpp \
open.cpp \
streamout.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 @@
* interface.cpp : wxWindows plugin for vlc
*****************************************************************************
* 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>
*
......@@ -155,10 +155,11 @@ BEGIN_EVENT_TABLE(Interface, wxFrame)
/* Menu events */
EVT_MENU(Exit_Event, Interface::OnExit)
EVT_MENU(About_Event, Interface::OnAbout)
EVT_MENU(Playlist_Event, Interface::OnPlaylist)
EVT_MENU(Logs_Event, Interface::OnLogs)
EVT_MENU(FileInfo_Event, Interface::OnFileInfo)
EVT_MENU(Prefs_Event, Interface::OnPreferences)
EVT_MENU(Playlist_Event, Interface::OnShowDialog)
EVT_MENU(Logs_Event, Interface::OnShowDialog)
EVT_MENU(FileInfo_Event, Interface::OnShowDialog)
EVT_MENU(Prefs_Event, Interface::OnShowDialog)
EVT_MENU_OPEN(Interface::OnMenuOpen)
......@@ -168,11 +169,11 @@ BEGIN_EVENT_TABLE(Interface, wxFrame)
EVT_RIGHT_UP(Interface::OnContextMenu)
/* Toolbar events */
EVT_MENU(OpenFileSimple_Event, Interface::OnOpenFileSimple)
EVT_MENU(OpenFile_Event, Interface::OnOpenFile)
EVT_MENU(OpenDisc_Event, Interface::OnOpenDisc)
EVT_MENU(OpenNet_Event, Interface::OnOpenNet)
EVT_MENU(OpenSat_Event, Interface::OnOpenSat)
EVT_MENU(OpenFileSimple_Event, Interface::OnShowDialog)
EVT_MENU(OpenFile_Event, Interface::OnShowDialog)
EVT_MENU(OpenDisc_Event, Interface::OnShowDialog)
EVT_MENU(OpenNet_Event, Interface::OnShowDialog)
EVT_MENU(OpenSat_Event, Interface::OnShowDialog)
EVT_MENU(StopStream_Event, Interface::OnStopStream)
EVT_MENU(PlayStream_Event, Interface::OnPlayStream)
EVT_MENU(PrevStream_Event, Interface::OnPrevStream)
......@@ -182,6 +183,7 @@ BEGIN_EVENT_TABLE(Interface, wxFrame)
/* Slider events */
EVT_COMMAND_SCROLL(SliderScroll_Event, Interface::OnSliderUpdate)
END_EVENT_TABLE()
/*****************************************************************************
......@@ -193,14 +195,10 @@ Interface::Interface( intf_thread_t *_p_intf ):
{
/* Initializations */
p_intf = _p_intf;
p_prefs_dialog = NULL;
i_old_playing_status = PAUSE_S;
p_open_dialog = NULL;
p_file_dialog = NULL;
/* Give our interface a nice little icon */
p_intf->p_sys->p_icon = new wxIcon( vlc_xpm );
SetIcon( *p_intf->p_sys->p_icon );
SetIcon( wxIcon( vlc_xpm ) );
/* Create a sizer for the main frame */
frame_sizer = new wxBoxSizer( wxHORIZONTAL );
......@@ -225,7 +223,6 @@ Interface::Interface( intf_thread_t *_p_intf ):
statusbar->SetStatusWidths( 3, i_status_width );
statusbar->SetStatusText( wxString::Format(wxT("x%.2f"), 1.0), 1 );
/* Make sure we've got the right background colour */
SetBackgroundColour( slider_frame->GetBackgroundColour() );
......@@ -243,10 +240,6 @@ Interface::Interface( intf_thread_t *_p_intf ):
Interface::~Interface()
{
/* 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()
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.
*****************************************************************************/
......@@ -607,97 +569,49 @@ void Interface::OnAbout( wxCommandEvent& WXUNUSED(event) )
wxT("VLC media player")), wxOK | wxICON_INFORMATION, this );
}
void Interface::OnPlaylist( wxCommandEvent& WXUNUSED(event) )
void Interface::OnShowDialog( wxCommandEvent& event )
{
/* Show/hide the playlist window */
Playlist *p_playlist_window = p_intf->p_sys->p_playlist_window;
if( p_playlist_window )
if( p_intf->p_sys->pf_show_dialog )
{
p_playlist_window->ShowPlaylist( ! p_playlist_window->IsShown() );
}
}
void Interface::OnLogs( wxCommandEvent& WXUNUSED(event) )
{
/* 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() );
}
}
int i_id;
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) )
{
/* 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;
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;
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;
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 );
p_intf->p_sys->pf_show_dialog( p_intf, i_id, 1 );
}
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) )
......@@ -709,15 +623,12 @@ void Interface::OnPlayStream( wxCommandEvent& WXUNUSED(event) )
if( p_playlist == NULL )
{
/* If the playlist is empty, open a file requester instead */
OnOpenFile( dummy );
OnShowDialog( dummy );
return;
}
vlc_mutex_lock( &p_playlist->object_lock );
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,
VLC_OBJECT_INPUT,
FIND_ANYWHERE );
......@@ -750,7 +661,7 @@ void Interface::OnPlayStream( wxCommandEvent& WXUNUSED(event) )
{
vlc_mutex_unlock( &p_playlist->object_lock );
vlc_object_release( p_playlist );
OnOpenFile( dummy );
OnShowDialog( dummy );
}
}
......
......@@ -2,7 +2,7 @@
* menus.cpp : wxWindows plugin for vlc
*****************************************************************************
* 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>
*
......@@ -79,23 +79,39 @@ private:
enum
{
/* menu items */
FirstAutoGenerated_Event = wxID_HIGHEST + 1000,
MenuDummy_Event,
AudioMenu_Events,
VideoMenu_Events = wxID_HIGHEST + 1100,
NavigMenu_Events = wxID_HIGHEST + 1200,
PopupMenu_Events = wxID_HIGHEST + 1300,
MenuDummy_Event = wxID_HIGHEST + 1000,
OpenFileSimple_Event,
OpenFile_Event,
OpenDisc_Event,
OpenNet_Event,
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)
/* Menu events */
EVT_MENU(MenuDummy_Event, Menu::OnEntrySelected)
END_EVENT_TABLE()
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)
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,
const wxPoint& pos )
{
......@@ -168,14 +184,19 @@ void PopupMenu( intf_thread_t *p_intf, wxWindow *p_parent,
vlc_object_release( p_object );
}
/* Misc stuff */
ppsz_varnames[i++] = NULL; /* Separator */
ppsz_varnames[i++] = _("Close Menu");
/* Build menu */
Menu popupmenu( p_intf, p_parent, i,
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_parent->PopupMenu( &popupmenu, pos.x, pos.y );
p_intf->p_sys->p_popup_menu = NULL;
......@@ -346,10 +367,6 @@ Menu::~Menu()
/*****************************************************************************
* Private methods.
*****************************************************************************/
void Menu::OnEntrySelected( wxCommandEvent& WXUNUSED(event) )
{
}
void Menu::CreateMenuItem( wxMenu *menu, char *psz_var,
vlc_object_t *p_object )
{
......@@ -516,7 +533,8 @@ wxMenu *Menu::CreateChoicesMenu( char *psz_var, vlc_object_t *p_object )
menuitem =
new wxMenuItemExt( menu, ++i_item_id,
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"),
val_list.p_list->p_values[i].i_int),
wxT(""), wxITEM_RADIO, strdup(psz_var),
......@@ -541,6 +559,36 @@ wxMenu *Menu::CreateChoicesMenu( char *psz_var, vlc_object_t *p_object )
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
*****************************************************************************/
......@@ -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 )
{
wxMenuItem *p_menuitem = NULL;
......
......@@ -2,7 +2,7 @@
* open.cpp : wxWindows plugin for vlc
*****************************************************************************
* 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>
*
......@@ -94,7 +94,7 @@ enum
DemuxDumpBrowse_Event,
};
BEGIN_EVENT_TABLE(OpenDialog, wxDialog)
BEGIN_EVENT_TABLE(OpenDialog, wxFrame)
/* Button events */
EVT_BUTTON(wxID_OK, OpenDialog::OnOk)
EVT_BUTTON(wxID_CANCEL, OpenDialog::OnCancel)
......@@ -141,14 +141,17 @@ BEGIN_EVENT_TABLE(OpenDialog, wxDialog)
EVT_TEXT(DemuxDump_Event, OpenDialog::OnDemuxDumpChange)
EVT_BUTTON(DemuxDumpBrowse_Event, OpenDialog::OnDemuxDumpBrowse)
/* Hide the window when the user closes the window */
EVT_CLOSE(OpenDialog::OnCancel)
END_EVENT_TABLE()
/*****************************************************************************
* Constructor.
*****************************************************************************/
OpenDialog::OpenDialog( intf_thread_t *_p_intf, wxWindow *_p_parent,
int i_access_method ):
wxDialog( _p_parent, -1, wxU(_("Open Target")), wxDefaultPosition,
int i_access_method, int i_arg ):
wxFrame( _p_parent, -1, wxU(_("Open Target")), wxDefaultPosition,
wxDefaultSize, wxDEFAULT_FRAME_STYLE )
{
/* Initializations */
......@@ -327,15 +330,23 @@ OpenDialog::~OpenDialog()
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 );
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) )
mrl_combo->Append( mrl_combo->GetValue() );
if( mrl_combo->GetCount() > 10 ) mrl_combo->Delete( 0 );
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) )
{
EndModal( wxID_CANCEL );
Hide();
}
void OpenDialog::OnPageChange( wxNotebookEvent& event )
......@@ -782,7 +813,7 @@ void OpenDialog::OnSubsFileSettings( wxCommandEvent& WXUNUSED(event) )
{
/* Show/hide the open dialog */
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 )
{
......@@ -818,7 +849,7 @@ void OpenDialog::OnSoutSettings( wxCommandEvent& WXUNUSED(event) )
{
/* Show/hide the open dialog */
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 )
{
......
......@@ -2,7 +2,7 @@
* playlist.cpp : wxWindows plugin for vlc
*****************************************************************************
* 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>
*
......@@ -100,13 +100,12 @@ END_EVENT_TABLE()
/*****************************************************************************
* Constructor.
*****************************************************************************/
Playlist::Playlist( intf_thread_t *_p_intf, Interface *_p_main_interface ):
wxFrame( _p_main_interface, -1, wxU(_("Playlist")), wxDefaultPosition,
Playlist::Playlist( intf_thread_t *_p_intf, wxWindow *p_parent ):
wxFrame( p_parent, -1, wxU(_("Playlist")), wxDefaultPosition,
wxDefaultSize, wxDEFAULT_FRAME_STYLE )
{
/* Initializations */
p_intf = _p_intf;
p_main_interface = _p_main_interface;
i_update_counter = 0;
b_need_update = VLC_FALSE;
vlc_mutex_init( p_intf, &lock );
......@@ -364,66 +363,20 @@ void Playlist::OnOpen( wxCommandEvent& WXUNUSED(event) )
void Playlist::OnAddFile( 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_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 );
p_intf->p_sys->pf_show_dialog( p_intf, INTF_DIALOG_FILE_SIMPLE, 0 );
#if 0
Rebuild();
#endif
}
void Playlist::OnAddMRL( wxCommandEvent& WXUNUSED(event) )
{
playlist_t *p_playlist =
(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 );
p_intf->p_sys->pf_show_dialog( p_intf, INTF_DIALOG_FILE, 0 );
#if 0
Rebuild();
#endif
}
void Playlist::OnInvertSelection( wxCommandEvent& WXUNUSED(event) )
......
......@@ -2,7 +2,7 @@
* timer.cpp : wxWindows plugin for vlc
*****************************************************************************
* 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>
*
......@@ -51,8 +51,8 @@
void DisplayStreamDate( wxControl *, intf_thread_t *, int );
/* Callback prototype */
int PopupMenuCB( vlc_object_t *p_this, const char *psz_variable,
vlc_value_t old_val, vlc_value_t new_val, void *param );
static int PopupMenuCB( vlc_object_t *p_this, const char *psz_variable,
vlc_value_t old_val, vlc_value_t new_val, void *param );
/*****************************************************************************
* Constructor.
......@@ -111,15 +111,6 @@ void Timer::Notify()
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 */
if( p_intf->p_sys->p_input == NULL )
{
......@@ -301,8 +292,8 @@ 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
* caller to block for a too long time.
*****************************************************************************/
int PopupMenuCB( vlc_object_t *p_this, const char *psz_variable,
vlc_value_t old_val, vlc_value_t new_val, void *param )
static int PopupMenuCB( vlc_object_t *p_this, const char *psz_variable,
vlc_value_t old_val, vlc_value_t new_val, void *param )
{
intf_thread_t *p_intf = (intf_thread_t *)param;
......
......@@ -2,7 +2,7 @@
* wxwindows.cpp : wxWindows plugin for vlc
*****************************************************************************
* 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>
*
......@@ -56,8 +56,12 @@ int wxEntry( int argc, char *argv[] , bool enterLoop = TRUE );
*****************************************************************************/
static int Open ( vlc_object_t * );
static void Close ( vlc_object_t * );
static int OpenDialogs ( vlc_object_t * );
static void Run ( intf_thread_t * );
static void Init ( intf_thread_t * );
static void ShowDialog ( intf_thread_t *, int, int );
/*****************************************************************************
* Local classes declarations.
......@@ -86,6 +90,12 @@ vlc_module_begin();
add_shortcut( "wxwin" );
add_shortcut( "wx" );
set_program( "wxvlc" );
add_submodule();
set_description( _("wxWindows dialogs provider") );
set_capability( "dialogs provider", 50 );
set_callbacks( OpenDialogs, Close );
#if !defined(WIN32)
linked_with_a_crap_library_which_uses_atexit();
#endif
......@@ -121,9 +131,21 @@ static int Open( vlc_object_t *p_this )
p_intf->p_sys->p_popup_menu = NULL;
p_intf->p_sys->b_popup_change = VLC_FALSE;
p_intf->pf_show_dialog = NULL;
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
*****************************************************************************/
......@@ -156,9 +178,31 @@ DllMain (HANDLE hModule, DWORD fdwReason, LPVOID lpReserved)
#endif
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 )
static char *p_args[] = { "" };
int i_args = 1;
#endif
/* 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 )
#if defined( WIN32 )
#if !defined(__BUILTIN__)
wxEntry( hInstance/*GetModuleHandle(NULL)*/, NULL, NULL, SW_SHOW, TRUE );
wxEntry( hInstance/*GetModuleHandle(NULL)*/, NULL, NULL, SW_SHOW );
#else
wxEntry( GetModuleHandle(NULL), NULL, NULL, SW_SHOW, TRUE );
wxEntry( GetModuleHandle(NULL), NULL, NULL, SW_SHOW );
#endif
#else
wxEntry( 1, p_args );
wxEntry( i_args, p_args );
#endif
}
......@@ -206,27 +250,41 @@ bool Instance::OnInit()
locale.Init( wxLANGUAGE_DEFAULT );
/* 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 */
Interface *MainInterface = new Interface( p_intf );
/* Create the playlist window */
p_intf->p_sys->p_playlist_window = new Playlist( p_intf, MainInterface );
if( !p_intf->pf_show_dialog )
{
/* The module is used in interface mode */
Interface *MainInterface = new Interface( p_intf );
p_intf->p_sys->p_wxwindow = MainInterface;
/* Create the log window */
p_intf->p_sys->p_messages_window = new Messages( p_intf, MainInterface );
/* Show the interface */
MainInterface->Show( TRUE );
/* Create the fileinfo window */
p_intf->p_sys->p_fileinfo_window = new FileInfo ( p_intf, MainInterface );
SetTopWindow( MainInterface );
/* Show the interface */
MainInterface->Show( TRUE );
/* Start timer */
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 );
SetTopWindow( MainInterface );
p_intf->p_sys->pf_show_dialog = ShowDialog;
/* Start timer */
new Timer( p_intf, MainInterface );
/* OK, initialization is over */
vlc_thread_ready( p_intf );
/* Return TRUE to tell program to continue (FALSE would terminate) */
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 @@
* wxwindows.h: private wxWindows interface description
*****************************************************************************
* 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>
*
......@@ -29,6 +29,18 @@
#include <wx/treectrl.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 Messages;
class FileInfo;
......@@ -52,11 +64,6 @@ struct intf_sys_t
wxWindow *p_wxwindow;
wxIcon *p_icon;
/* secondary windows */
Playlist *p_playlist_window;
Messages *p_messages_window;
FileInfo *p_fileinfo_window;
/* special actions */
vlc_bool_t b_playing;
......@@ -74,6 +81,9 @@ struct intf_sys_t
/* Playlist management */
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 */
wxMenu *p_popup_menu;
vlc_bool_t b_popup_change;
......@@ -108,7 +118,6 @@ private:
};
/* Main Interface */
class OpenDialog;
class Interface: public wxFrame
{
public:
......@@ -126,13 +135,6 @@ public:
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:
void CreateOurMenuBar();
void CreateOurToolBar();
......@@ -142,17 +144,8 @@ private:
/* Event handlers (these functions should _not_ be virtual) */
void OnExit( 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 OnOpenFile( wxCommandEvent& event );
void OnOpenDisc( wxCommandEvent& event );
void OnOpenNet( wxCommandEvent& event );
void OnOpenSat( wxCommandEvent& event );
void OnShowDialog( wxCommandEvent& event );
void OnPlayStream( wxCommandEvent& event );
void OnStopStream( wxCommandEvent& event );
......@@ -174,8 +167,7 @@ private:
Timer *timer;
intf_thread_t *p_intf;
wxFrame *p_prefs_dialog;
private:
int i_old_playing_status;
/* For auto-generated menus */
......@@ -187,19 +179,59 @@ private:
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 */
class SoutDialog;
class SubsFileDialog;
class OpenDialog: public wxDialog
class OpenDialog: public wxFrame
{
public:
/* Constructor */
OpenDialog( intf_thread_t *p_intf, wxWindow *p_parent,
int i_access_method );
int i_access_method, int i_arg = 0 );
virtual ~OpenDialog();
int ShowModal();
int ShowModal( int i_access_method );
int Show();
int Show( int i_access_method, int i_arg = 0 );
wxArrayString mrl;
......@@ -288,15 +320,6 @@ private:
wxFileDialog *demuxdump_dialog;
};
enum
{
FILE_ACCESS = 0,
DISC_ACCESS,
NET_ACCESS,
SAT_ACCESS,
FILE_SIMPLE_ACCESS
};
/* Stream output Dialog */
class SoutDialog: public wxDialog
{
......@@ -461,7 +484,7 @@ class Playlist: public wxFrame
{
public:
/* Constructor */
Playlist( intf_thread_t *p_intf, Interface *p_main_interface );
Playlist( intf_thread_t *p_intf, wxWindow *p_parent );
virtual ~Playlist();
void UpdatePlaylist();
......@@ -489,7 +512,6 @@ private:
DECLARE_EVENT_TABLE();
intf_thread_t *p_intf;
Interface *p_main_interface;
wxListView *listview;
int i_update_counter;
};
......@@ -543,7 +565,8 @@ public:
MenuEvtHandler( intf_thread_t *p_intf, Interface *p_main_interface );
virtual ~MenuEvtHandler();
void MenuEvtHandler::OnMenuEvent( wxCommandEvent& event );
void OnMenuEvent( wxCommandEvent& event );
void OnShowDialog( wxCommandEvent& event );
private:
......@@ -564,6 +587,7 @@ public:
private:
/* Event handlers (these functions should _not_ be virtual) */
void OnClose( wxCommandEvent& event );
void OnShowDialog( wxCommandEvent& event );
void OnEntrySelected( wxCommandEvent& event );
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