* dialogs.cpp: Handles all the different dialog boxes we provide.\r
*****************************************************************************\r
* Copyright (C) 2003 VideoLAN\r
- * $Id: dialogs.cpp,v 1.1 2003/06/03 22:20:00 gbazin Exp $\r
+ * $Id: dialogs.cpp,v 1.2 2003/06/04 16:03:33 gbazin Exp $\r
*\r
* Authors: Olivier Teulière <ipkiss@via.ecp.fr>\r
* Emmanuel Puig <karibu@via.ecp.fr>\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
#ifdef BASIC_SKINS\r
\r
// Constructor\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
#include "share/vlc32x32.xpm" // include the graphic icon\r
\r
#define ShowOpen_Event 0\r
-#define ShowMessages_Event 1\r
-#define ShowPrefs_Event 2\r
-#define ShowFileInfo_Event 3\r
+#define ShowOpenSkin_Event 1\r
+#define ShowMessages_Event 2\r
+#define ShowPrefs_Event 3\r
+#define ShowFileInfo_Event 4\r
#define ExitThread_Event 99\r
\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
#endif\r
\r
// OK, initialization is over, now the other thread can go on working...\r
- vlc_thread_ready( p_intf );\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
return TRUE;\r
}\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( intf_thread_t *p_intf )\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
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_intf, "Skins Dialogs Thread", SkinsDialogsThread,\r
- 0, VLC_TRUE ) )\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
wxTheApp->AddPendingEvent( event );\r
\r
- vlc_thread_join( p_intf ); //FIXME, use own vlc_object\r
+ vlc_thread_join( p_thread );\r
}\r
\r
void Dialogs::ShowOpen( bool b_play )\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
Dialogs *p_dialogs = (Dialogs *)event.GetClientData();\r
bool b_play = event.GetInt() ? TRUE : FALSE;\r
\r
- //p_dialogs->OpenDlg->Show( !p_dialogs->OpenDlg->IsShown() );\r
+ if( p_dialogs->OpenDlg->IsShown() ) return;\r
\r
if( p_dialogs->OpenDlg->ShowModal() != wxID_OK )\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
wxTheApp->ExitMainLoop();\r
}\r
#endif // 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
+ Dialogs *p_dialogs = (Dialogs *)param;\r
+\r
+ p_dialogs->b_popup_change = VLC_TRUE;\r
+\r
+ return VLC_SUCCESS;\r
+}\r
* vlcproc.cpp: VlcProc class
*****************************************************************************
* Copyright (C) 2003 VideoLAN
- * $Id: vlcproc.cpp,v 1.29 2003/06/03 22:18:58 gbazin Exp $
+ * $Id: vlcproc.cpp,v 1.30 2003/06/04 16:03:33 gbazin Exp $
*
* Authors: Olivier Teulière <ipkiss@via.ecp.fr>
* Emmanuel Puig <karibu@via.ecp.fr>
#include "skin_common.h"
#include "dialogs.h"
-#ifndef BASIC_SKINS
-#include "../../wxwindows/wxwindows.h"
-#endif
-
-
//---------------------------------------------------------------------------
// VlcProc
//---------------------------------------------------------------------------
return true;
case VLC_OPEN:
-#ifndef BASIC_SKINS
p_intf->p_sys->p_dialogs->ShowOpen( TRUE );
InterfaceRefresh();
-#endif
return true;
case VLC_LOAD_SKIN:
return true;
case VLC_PLAYLIST_ADD_FILE:
-#ifndef BASIC_SKINS
p_intf->p_sys->p_dialogs->ShowOpen( FALSE );
InterfaceRefresh();
-#endif
return true;
-#ifndef BASIC_SKINS
case VLC_LOG_SHOW:
p_intf->p_sys->p_dialogs->ShowMessages();
return true;
case VLC_INFO_SHOW:
p_intf->p_sys->p_dialogs->ShowFileInfo();
return true;
-#endif
case VLC_INTF_REFRESH:
InterfaceRefresh( (bool)evt->GetParam2() );
//---------------------------------------------------------------------------
-
//---------------------------------------------------------------------------
// Common VLC procedures
//---------------------------------------------------------------------------
void VlcProc::LoadSkin()
{
-#ifndef BASIC_SKINS
if( p_intf->p_sys->p_new_theme_file == NULL )
{
- wxFileDialog dialog( NULL,
- wxU(_("Open a skin file")), wxT(""), wxT(""),
- wxT("Skin files (*.vlt)|*.vlt|Skin files (*.xml)|*.xml|"
- "All files|*.*"), wxOPEN );
-
- if( dialog.ShowModal() == wxID_OK )
- {
- p_intf->p_sys->p_new_theme_file =
- new char[strlen(dialog.GetPath().mb_str()) + 1];
-
- strcpy( p_intf->p_sys->p_new_theme_file,
- dialog.GetPath().mb_str() );
-
- // Tell vlc to change skin after hiding interface
- OSAPI_PostMessage( NULL, VLC_HIDE, VLC_LOAD_SKIN, 0 );
- }
+ p_intf->p_sys->p_dialogs->ShowOpenSkin();
}
else
{
delete (char *)p_intf->p_sys->p_new_theme_file;
p_intf->p_sys->p_new_theme_file = NULL;
}
-#endif
}
//---------------------------------------------------------------------------
+
void VlcProc::DropFile( unsigned int param )
{
// Get pointer to file