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.
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)
dnl MP4 module
dnl
AC_CHECK_HEADERS(zlib.h, [
- AX_ADD_LDFLAGS([mp4 skins basic_skins],[-lz])
+ AX_ADD_LDFLAGS([mp4 skins],[-lz])
] )
dnl skins module
dnl
AC_CHECK_HEADERS(libtar.h, [
- AX_ADD_LDFLAGS([skins basic_skins],[-ltar])
+ AX_ADD_LDFLAGS([skins],[-ltar])
] )
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
* 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>
*
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;
#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 \
-/*****************************************************************************\r
- * dialogs.cpp: Handles all the different dialog boxes we provide.\r
- *****************************************************************************\r
- * Copyright (C) 2003 VideoLAN\r
- * $Id: dialogs.cpp,v 1.9 2003/07/13 14:55:17 gbazin Exp $\r
- *\r
- * Authors: Gildas Bazin <gbazin@netcourrier.com>\r
- *\r
- * This program is free software; you can redistribute it and/or modify\r
- * it under the terms of the GNU General Public License as published by\r
- * the Free Software Foundation; either version 2 of the License, or\r
- * (at your option) any later version.\r
- *\r
- * This program is distributed in the hope that it will be useful,\r
- * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
- * GNU General Public License for more details.\r
- *\r
- * You should have received a copy of the GNU General Public License\r
- * along with this program; if not, write to the Free Software\r
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111,\r
- * USA.\r
- *****************************************************************************/\r
-\r
-//--- VLC -------------------------------------------------------------------\r
-#include <vlc/vlc.h>\r
-#include <vlc/intf.h>\r
-\r
-//--- SKIN ------------------------------------------------------------------\r
-#include "../os_api.h"\r
-#include "event.h"\r
-#include "banks.h"\r
-#include "theme.h"\r
-#include "../os_theme.h"\r
-#include "themeloader.h"\r
-#include "window.h"\r
-#include "vlcproc.h"\r
-#include "skin_common.h"\r
-#include "dialogs.h"\r
-\r
-/* Callback prototype */\r
-int PopupMenuCB( vlc_object_t *p_this, const char *psz_variable,\r
- vlc_value_t old_val, vlc_value_t new_val, void *param );\r
-\r
-#if defined(MODULE_NAME_IS_basic_skins)\r
-\r
-// Constructor\r
-Dialogs::Dialogs( intf_thread_t *_p_intf ){}\r
-// Destructor\r
-Dialogs::~Dialogs(){}\r
-\r
-void Dialogs::ShowOpen( bool b_play ){}\r
-void Dialogs::ShowOpenSkin(){}\r
-void Dialogs::ShowMessages(){}\r
-void Dialogs::ShowPrefs(){}\r
-void Dialogs::ShowFileInfo(){}\r
-void Dialogs::ShowPopup(){}\r
-\r
-#else // !MODULE_NAME_IS_basic_skins\r
-\r
-#include "../../wxwindows/wxwindows.h"\r
-#include "../../../../share/vlc32x32.xpm" // include the graphic icon\r
-\r
-#define ShowOpen_Event 0\r
-#define ShowOpenSkin_Event 1\r
-#define ShowMessages_Event 2\r
-#define ShowPrefs_Event 3\r
-#define ShowFileInfo_Event 4\r
-#define ShowPopup_Event 5\r
-#define ExitThread_Event 99\r
-\r
-//---------------------------------------------------------------------------\r
-// Local classes declarations.\r
-//---------------------------------------------------------------------------\r
-\r
-DEFINE_EVENT_TYPE(wxEVT_DIALOG)\r
-\r
-class Instance: public wxApp\r
-{\r
-public:\r
- Instance();\r
- Instance( intf_thread_t *_p_intf );\r
-\r
- bool OnInit();\r
- int OnExit();\r
-\r
-private:\r
- intf_thread_t *p_intf;\r
-\r
- DECLARE_EVENT_TABLE();\r
-};\r
-\r
-BEGIN_EVENT_TABLE(Instance, wxApp)\r
- EVT_COMMAND(ShowOpen_Event, wxEVT_DIALOG, Dialogs::OnShowOpen)\r
- EVT_COMMAND(ShowOpenSkin_Event, wxEVT_DIALOG, Dialogs::OnShowOpenSkin)\r
- EVT_COMMAND(ShowMessages_Event, wxEVT_DIALOG, Dialogs::OnShowMessages)\r
- EVT_COMMAND(ShowPrefs_Event, wxEVT_DIALOG, Dialogs::OnShowPrefs)\r
- EVT_COMMAND(ShowFileInfo_Event, wxEVT_DIALOG, Dialogs::OnShowFileInfo)\r
- EVT_COMMAND(ShowPopup_Event, wxEVT_DIALOG, Dialogs::OnShowPopup)\r
- EVT_COMMAND(ExitThread_Event, wxEVT_DIALOG, Dialogs::OnExitThread)\r
-END_EVENT_TABLE()\r
-\r
-//---------------------------------------------------------------------------\r
-// Implementation of Instance class\r
-//---------------------------------------------------------------------------\r
-Instance::Instance( )\r
-{\r
-}\r
-\r
-Instance::Instance( intf_thread_t *_p_intf )\r
-{\r
- // Initialization\r
- p_intf = _p_intf;\r
-}\r
-\r
-IMPLEMENT_APP_NO_MAIN(Instance)\r
-\r
-bool Instance::OnInit()\r
-{\r
- p_intf->p_sys->p_icon = new wxIcon( vlc_xpm );\r
-\r
- // Create all the dialog boxes\r
- p_intf->p_sys->p_dialogs->OpenDlg =\r
- new OpenDialog( p_intf, NULL, FILE_ACCESS );\r
- p_intf->p_sys->p_dialogs->MessagesDlg = new Messages( p_intf, NULL );\r
- p_intf->p_sys->p_dialogs->PrefsDlg = new PrefsDialog( p_intf, NULL );\r
- p_intf->p_sys->p_dialogs->FileInfoDlg = new FileInfo( p_intf, NULL );\r
-\r
- // OK, initialization is over, now the other thread can go on working...\r
- vlc_thread_ready( p_intf->p_sys->p_dialogs->p_thread );\r
-\r
- /* Register callback for the intf-popupmenu variable */\r
- playlist_t *p_playlist =\r
- (playlist_t *)vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,\r
- FIND_ANYWHERE );\r
- if( p_playlist != NULL )\r
- {\r
- var_AddCallback( p_playlist, "intf-popupmenu", PopupMenuCB,\r
- p_intf->p_sys->p_dialogs );\r
- vlc_object_release( p_playlist );\r
- }\r
-\r
- /* Intercept all menu events in our custom event handler */\r
- p_intf->p_sys->p_dialogs->OpenDlg->PushEventHandler(\r
- new MenuEvtHandler( p_intf, NULL ) );\r
-\r
- return TRUE;\r
-}\r
-\r
-int Instance::OnExit()\r
-{\r
- // Delete evertything\r
- delete p_intf->p_sys->p_dialogs->FileInfoDlg;\r
- delete p_intf->p_sys->p_dialogs->PrefsDlg;\r
- delete p_intf->p_sys->p_dialogs->MessagesDlg;\r
- delete p_intf->p_sys->p_dialogs->OpenDlg;\r
- delete p_intf->p_sys->p_icon;\r
-\r
- return 0;\r
-}\r
-\r
-//---------------------------------------------------------------------------\r
-#if !defined(__BUILTIN__) && defined( WIN32 )\r
-HINSTANCE hInstance = 0;\r
-extern "C" BOOL WINAPI\r
-DllMain (HANDLE hModule, DWORD fdwReason, LPVOID lpReserved)\r
-{\r
- hInstance = (HINSTANCE)hModule;\r
- return TRUE;\r
-}\r
-#endif\r
-\r
-//---------------------------------------------------------------------------\r
-// Thread callback\r
-// We create all wxWindows dialogs in a separate thread because we don't want\r
-// any interaction with our own message loop\r
-//---------------------------------------------------------------------------\r
-void SkinsDialogsThread( dialogs_thread_t *p_thread )\r
-{\r
-#if !defined( WIN32 )\r
- static char *p_args[] = { "" };\r
-#endif\r
- intf_thread_t *p_intf = p_thread->p_intf;\r
-\r
- /* Hack to pass the p_intf pointer to the new wxWindow Instance object */\r
- wxTheApp = new Instance( p_intf );\r
-\r
-#if defined( WIN32 )\r
-#if !defined(__BUILTIN__)\r
- wxEntry( hInstance/*GetModuleHandle(NULL)*/, NULL, NULL, SW_SHOW, TRUE );\r
-#else\r
- wxEntry( GetModuleHandle( NULL ), NULL, NULL, SW_SHOW, TRUE );\r
-#endif\r
-#else\r
- wxEntry( 1, p_args );\r
-#endif\r
-\r
- return;\r
-}\r
-\r
-//---------------------------------------------------------------------------\r
-// Implementation of Dialogs class\r
-//---------------------------------------------------------------------------\r
-Dialogs::Dialogs( intf_thread_t *_p_intf )\r
-{\r
- p_intf = _p_intf;\r
- p_intf->p_sys->p_dialogs = this;\r
- b_popup_change = VLC_FALSE;\r
-\r
- p_thread = (dialogs_thread_t *)vlc_object_create( p_intf,\r
- sizeof(dialogs_thread_t) );\r
- p_thread->p_intf = p_intf;\r
-\r
- // Create a new thread for wxWindows\r
- if( vlc_thread_create( p_thread, "Skins Dialogs Thread",\r
- SkinsDialogsThread, 0, VLC_TRUE ) )\r
- {\r
- OpenDlg = NULL;\r
- msg_Err( p_intf, "cannot create SkinsDialogsThread" );\r
- }\r
-}\r
-\r
-Dialogs::~Dialogs()\r
-{\r
- wxCommandEvent event( wxEVT_DIALOG, ExitThread_Event );\r
- event.SetClientData( this );\r
-\r
- wxTheApp->AddPendingEvent( event );\r
-\r
- vlc_thread_join( p_thread );\r
-}\r
-\r
-void Dialogs::ShowOpen( bool b_play )\r
-{\r
- wxCommandEvent event( wxEVT_DIALOG, ShowOpen_Event );\r
- event.SetClientData( this );\r
- event.SetInt( b_play );\r
-\r
- wxTheApp->AddPendingEvent( event );\r
-}\r
-\r
-void Dialogs::ShowOpenSkin()\r
-{\r
- wxCommandEvent event( wxEVT_DIALOG, ShowOpenSkin_Event );\r
- event.SetClientData( this );\r
-\r
- wxTheApp->AddPendingEvent( event );\r
-}\r
-\r
-void Dialogs::ShowMessages()\r
-{\r
- wxCommandEvent event( wxEVT_DIALOG, ShowMessages_Event );\r
- event.SetClientData( this );\r
-\r
- wxTheApp->AddPendingEvent( event );\r
-}\r
-\r
-void Dialogs::ShowPrefs()\r
-{\r
- wxCommandEvent event( wxEVT_DIALOG, ShowPrefs_Event );\r
- event.SetClientData( this );\r
-\r
- wxTheApp->AddPendingEvent( event );\r
-}\r
-\r
-void Dialogs::ShowFileInfo()\r
-{\r
- wxCommandEvent event( wxEVT_DIALOG, ShowFileInfo_Event );\r
- event.SetClientData( this );\r
-\r
- wxTheApp->AddPendingEvent( event );\r
-}\r
-\r
-void Dialogs::ShowPopup()\r
-{\r
- wxCommandEvent event( wxEVT_DIALOG, ShowPopup_Event );\r
- event.SetClientData( this );\r
-\r
- wxTheApp->AddPendingEvent( event );\r
-}\r
-\r
-void Dialogs::OnShowOpen( wxCommandEvent& event )\r
-{\r
- Dialogs *p_dialogs = (Dialogs *)event.GetClientData();\r
- bool b_play = event.GetInt() ? TRUE : FALSE;\r
-\r
- if( p_dialogs->OpenDlg->IsShown() ) return;\r
- \r
- if( p_dialogs->OpenDlg->ShowModal() != wxID_OK )\r
- {\r
- return;\r
- }\r
-\r
- // Check if playlist is available\r
- playlist_t *p_playlist = p_dialogs->p_intf->p_sys->p_playlist;\r
- if( p_playlist == NULL )\r
- {\r
- return;\r
- }\r
-\r
- if( b_play )\r
- {\r
- // Append and play\r
- for( size_t i = 0; i < p_dialogs->OpenDlg->mrl.GetCount(); i++ )\r
- {\r
- playlist_Add( p_playlist,\r
- (const char *)p_dialogs->OpenDlg->mrl[i].mb_str(),\r
- PLAYLIST_APPEND | (i ? 0 : PLAYLIST_GO), PLAYLIST_END );\r
- }\r
- p_dialogs->p_intf->p_sys->p_theme->EvtBank->Get( "play" )->SendEvent();\r
- }\r
- else\r
- {\r
- // Append only\r
- for( size_t i = 0; i < p_dialogs->OpenDlg->mrl.GetCount(); i++ )\r
- {\r
- playlist_Add( p_playlist,\r
- (const char *)p_dialogs->OpenDlg->mrl[i].mb_str(),\r
- PLAYLIST_APPEND, PLAYLIST_END );\r
- }\r
- }\r
-\r
- // Refresh interface !\r
- p_dialogs->p_intf->p_sys->p_theme->EvtBank->Get( "playlist_refresh" )\r
- ->PostSynchroMessage();\r
-\r
- return;\r
-}\r
-\r
-void Dialogs::OnShowOpenSkin( wxCommandEvent& event )\r
-{\r
- Dialogs *p_dialogs = (Dialogs *)event.GetClientData();\r
- intf_thread_t *p_intf = p_dialogs->p_intf;\r
-\r
- wxFileDialog dialog( NULL,\r
- wxU(_("Open a skin file")), wxT(""), wxT(""),\r
- wxT("Skin files (*.vlt)|*.vlt|Skin files (*.xml)|*.xml|"\r
- "All files|*.*"), wxOPEN );\r
-\r
- if( dialog.ShowModal() == wxID_OK )\r
- {\r
- p_intf->p_sys->p_new_theme_file =\r
- new char[strlen(dialog.GetPath().mb_str()) + 1];\r
-\r
- strcpy( p_intf->p_sys->p_new_theme_file,\r
- dialog.GetPath().mb_str() );\r
-\r
- // Tell vlc to change skin after hiding interface\r
- OSAPI_PostMessage( NULL, VLC_HIDE, VLC_LOAD_SKIN, 0 );\r
- }\r
-}\r
-\r
-void Dialogs::OnShowMessages( wxCommandEvent& event )\r
-{\r
- Dialogs *p_dialogs = (Dialogs *)event.GetClientData();\r
- p_dialogs->MessagesDlg->Show( !p_dialogs->MessagesDlg->IsShown() );\r
-}\r
-\r
-void Dialogs::OnShowPrefs( wxCommandEvent& event )\r
-{\r
- Dialogs *p_dialogs = (Dialogs *)event.GetClientData();\r
- p_dialogs->PrefsDlg->Show( !p_dialogs->PrefsDlg->IsShown() );\r
-}\r
-\r
-void Dialogs::OnShowFileInfo( wxCommandEvent& event )\r
-{\r
- Dialogs *p_dialogs = (Dialogs *)event.GetClientData();\r
- p_dialogs->FileInfoDlg->Show( !p_dialogs->FileInfoDlg->IsShown() );\r
-}\r
-\r
-void Dialogs::OnShowPopup( wxCommandEvent& event )\r
-{\r
- Dialogs *p_dialogs = (Dialogs *)event.GetClientData();\r
-\r
- wxPoint mousepos = wxGetMousePosition();\r
-\r
- wxMouseEvent mouseevent = wxMouseEvent( wxEVT_RIGHT_UP );\r
- mouseevent.m_x = p_dialogs->OpenDlg->ScreenToClient(mousepos).x;\r
- mouseevent.m_y = p_dialogs->OpenDlg->ScreenToClient(mousepos).y;\r
-\r
- ::PopupMenu( p_dialogs->p_intf,\r
- p_dialogs->OpenDlg, mouseevent.GetPosition() );\r
-}\r
-\r
-void Dialogs::OnExitThread( wxCommandEvent& event )\r
-{\r
- wxTheApp->ExitMainLoop();\r
-}\r
-#endif // MODULE_NAME_IS_basic_skins\r
-\r
-/*****************************************************************************\r
- * PopupMenuCB: callback triggered by the intf-popupmenu playlist variable.\r
- * We don't show the menu directly here because we don't want the\r
- * caller to block for a too long time.\r
- *****************************************************************************/\r
-int PopupMenuCB( vlc_object_t *p_this, const char *psz_variable,\r
- vlc_value_t old_val, vlc_value_t new_val, void *param )\r
-{\r
-#if !defined(MODULE_NAME_IS_basic_skins)\r
- Dialogs *p_dialogs = (Dialogs *)param;\r
-\r
- p_dialogs->ShowPopup();\r
-#endif\r
-\r
- return VLC_SUCCESS;\r
-}\r
+/*****************************************************************************
+ * dialogs.cpp: Handles all the different dialog boxes we provide.
+ *****************************************************************************
+ * Copyright (C) 2003 VideoLAN
+ * $Id: dialogs.cpp,v 1.10 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.
+ *****************************************************************************/
+
+//--- VLC -------------------------------------------------------------------
+#include <vlc/vlc.h>
+#include <vlc/intf.h>
+
+//--- SKIN ------------------------------------------------------------------
+#include "../os_api.h"
+#include "event.h"
+#include "banks.h"
+#include "theme.h"
+#include "../os_theme.h"
+#include "themeloader.h"
+#include "window.h"
+#include "vlcproc.h"
+#include "skin_common.h"
+#include "dialogs.h"
+
+/* Callback prototype */
+static int PopupMenuCB( vlc_object_t *p_this, const char *psz_variable,
+ vlc_value_t old_val, vlc_value_t new_val, void *param );
+
+//---------------------------------------------------------------------------
+// Implementation of Dialogs class
+//---------------------------------------------------------------------------
+Dialogs::Dialogs( intf_thread_t *_p_intf )
+{
+ /* Errors while loading the dialogs provider are not fatal.
+ * Dialogs just won't be available. */
+
+ p_intf = _p_intf;
+ p_intf->p_sys->p_dialogs = this;
+ b_popup_change = VLC_FALSE;
+
+ /* Allocate descriptor */
+ p_provider = (intf_thread_t *)vlc_object_create( p_intf, VLC_OBJECT_INTF );
+ if( p_provider == NULL )
+ {
+ msg_Err( p_intf, "out of memory" );
+ return;
+ }
+
+ p_module = module_Need( p_provider, "dialogs provider", NULL );
+ if( p_module == NULL )
+ {
+ msg_Err( p_intf, "no suitable dialogs provider found" );
+ vlc_object_destroy( p_provider );
+ p_provider = NULL;
+ return;
+ }
+
+ /* Initialize dialogs provider
+ * (returns as soon as initialization is done) */
+ if( p_provider->pf_run ) p_provider->pf_run( p_provider );
+}
+
+Dialogs::~Dialogs()
+{
+ if( p_provider && p_module )
+ {
+ module_Unneed( p_provider, p_module );
+ vlc_object_destroy( p_provider );
+ }
+}
+
+void Dialogs::ShowDialog( intf_thread_t *p_intf, int i_dialog_event,
+ int i_arg )
+{
+}
+
+void Dialogs::ShowOpen( bool b_play )
+{
+ if( p_provider && p_provider->pf_show_dialog )
+ p_provider->pf_show_dialog( p_provider, INTF_DIALOG_FILE, b_play );
+}
+
+void Dialogs::ShowOpenSkin()
+{
+ if( p_provider && p_provider->pf_show_dialog )
+ p_provider->pf_show_dialog( p_provider, INTF_DIALOG_FILE, 0 );
+}
+
+void Dialogs::ShowMessages()
+{
+ if( p_provider && p_provider->pf_show_dialog )
+ p_provider->pf_show_dialog( p_provider, INTF_DIALOG_MESSAGES, 0 );
+}
+
+void Dialogs::ShowPrefs()
+{
+ if( p_provider && p_provider->pf_show_dialog )
+ p_provider->pf_show_dialog( p_provider, INTF_DIALOG_PREFS, 0 );
+}
+
+void Dialogs::ShowFileInfo()
+{
+ if( p_provider && p_provider->pf_show_dialog )
+ p_provider->pf_show_dialog( p_provider, INTF_DIALOG_FILEINFO, 0 );
+}
+
+void Dialogs::ShowPopup()
+{
+}
+
+/*****************************************************************************
+ * PopupMenuCB: callback triggered by the intf-popupmenu playlist variable.
+ * We don't show the menu directly here because we don't want the
+ * caller to block for a too long time.
+ *****************************************************************************/
+static int PopupMenuCB( vlc_object_t *p_this, const char *psz_variable,
+ vlc_value_t old_val, vlc_value_t new_val, void *param )
+{
+ Dialogs *p_dialogs = (Dialogs *)param;
+ p_dialogs->ShowPopup();
+
+ return VLC_SUCCESS;
+}
* 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>
*
//---------------------------------------------------------------------------
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
{
// Destructor
virtual ~Dialogs();
+ static void ShowDialog( intf_thread_t *, int, int );
void ShowOpen( bool b_play );
void ShowOpenSkin();
void ShowMessages();
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
* 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 Teulière <ipkiss@via.ecp.fr>
* Emmanuel Puig <karibu@via.ecp.fr>
// 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)
* 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 Teulière <ipkiss@via.ecp.fr>
* Emmanuel Puig <karibu@via.ecp.fr>
#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"
#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>
};
p_intf->pf_run = Run;
+ p_intf->p_sys->pf_showdialog = Dialogs::ShowDialog;
// Suscribe to messages bank
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" );
if( !Loader->Load( user_skin ) && !Loader->Load( default_skin ) )
{
#endif
+#if 0
#if !defined(MODULE_NAME_IS_basic_skins)
wxMutexGuiEnter();
wxFileDialog dialog( NULL,
wxMutexGuiLeave();
}
else
+#endif
#endif
{
delete Loader;
+#if 0
#if !defined(MODULE_NAME_IS_basic_skins)
wxMutexGuiLeave();
+#endif
#endif
return;
}
OSRun( p_intf );
-#if !defined(MODULE_NAME_IS_basic_skins)
// clean up the dialog boxes
delete p_intf->p_sys->p_dialogs;
-#endif
}
//---------------------------------------------------------------------------
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();
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 )
{
wxwindows.cpp \
wxwindows.h \
interface.cpp \
+ dialogs.cpp \
open.cpp \
streamout.cpp \
messages.cpp \
--- /dev/null
+/*****************************************************************************
+ * 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 );
+ }
+}
* 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>
*
/* 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)
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)
/* Slider events */
EVT_COMMAND_SCROLL(SliderScroll_Event, Interface::OnSliderUpdate)
+
END_EVENT_TABLE()
/*****************************************************************************
{
/* 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 );
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() );
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;
}
/*****************************************************************************
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.
*****************************************************************************/
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) )
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 );
{
vlc_mutex_unlock( &p_playlist->object_lock );
vlc_object_release( p_playlist );
- OnOpenFile( dummy );
+ OnShowDialog( dummy );
}
}
* 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>
*
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 )
{
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;
/*****************************************************************************
* Private methods.
*****************************************************************************/
-void Menu::OnEntrySelected( wxCommandEvent& WXUNUSED(event) )
-{
-}
-
void Menu::CreateMenuItem( wxMenu *menu, 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),
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
*****************************************************************************/
{
}
+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;
* 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>
*
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)
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 */
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;
}
/*****************************************************************************
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 )
{
/* 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 )
{
{
/* 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 )
{
* 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 Teulière <ipkiss@via.ecp.fr>
*
/*****************************************************************************
* 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 );
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) )
* 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>
*
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.
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 )
{
* 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;
* 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>
*
*****************************************************************************/
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.
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
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
*****************************************************************************/
#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 */
#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
}
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 );
+}
* 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>
*
#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;
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;
/* 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;
};
/* Main Interface */
-class OpenDialog;
class Interface: public wxFrame
{
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();
/* 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 );
Timer *timer;
intf_thread_t *p_intf;
- wxFrame *p_prefs_dialog;
-
+private:
int i_old_playing_status;
/* For auto-generated menus */
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;
wxFileDialog *demuxdump_dialog;
};
-enum
-{
- FILE_ACCESS = 0,
- DISC_ACCESS,
- NET_ACCESS,
- SAT_ACCESS,
- FILE_SIMPLE_ACCESS
-};
-
/* Stream output Dialog */
class SoutDialog: public wxDialog
{
{
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();
DECLARE_EVENT_TABLE();
intf_thread_t *p_intf;
- Interface *p_main_interface;
wxListView *listview;
int i_update_counter;
};
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:
private:
/* Event handlers (these functions should _not_ be virtual) */
void OnClose( wxCommandEvent& event );
+ void OnShowDialog( wxCommandEvent& event );
void OnEntrySelected( wxCommandEvent& event );
wxMenu *Menu::CreateDummyMenu();