* vlcproc.cpp: VlcProc class
*****************************************************************************
* Copyright (C) 2003 VideoLAN
- * $Id: vlcproc.cpp,v 1.22 2003/05/12 17:33:19 gbazin Exp $
+ * $Id: vlcproc.cpp,v 1.36 2003/06/20 19:50:29 ipkiss Exp $
*
* Authors: Olivier Teulière <ipkiss@via.ecp.fr>
* Emmanuel Puig <karibu@via.ecp.fr>
#include <vlc/aout.h>
#include <vlc/vout.h>
-#ifndef 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 "window.h"
#include "vlcproc.h"
#include "skin_common.h"
-
-#ifndef BASIC_SKINS
-#include "../../wxwindows/wxwindows.h"
-#endif
-
+#include "dialogs.h"
//---------------------------------------------------------------------------
// VlcProc
p_intf = _p_intf;
}
//---------------------------------------------------------------------------
+VlcProc::~VlcProc()
+{
+}
+//---------------------------------------------------------------------------
bool VlcProc::EventProc( Event *evt )
{
switch( evt->GetMessage() )
return true;
case VLC_OPEN:
- OpenFile( true );
+ p_intf->p_sys->p_dialogs->ShowOpen( true );
+ InterfaceRefresh();
return true;
case VLC_LOAD_SKIN:
return true;
case VLC_PLAYLIST_ADD_FILE:
- OpenFile( false );
+ p_intf->p_sys->p_dialogs->ShowOpen( false );
+ InterfaceRefresh();
return true;
-#ifndef BASIC_SKINS
case VLC_LOG_SHOW:
- p_intf->p_sys->MessagesDlg->Show(
- !p_intf->p_sys->MessagesDlg->IsShown() );
+ p_intf->p_sys->p_dialogs->ShowMessages();
return true;
case VLC_LOG_CLEAR:
return true;
case VLC_PREFS_SHOW:
- p_intf->p_sys->PrefsDlg->Show(
- !p_intf->p_sys->PrefsDlg->IsShown() );
+ p_intf->p_sys->p_dialogs->ShowPrefs();
return true;
case VLC_INFO_SHOW:
- p_intf->p_sys->InfoDlg->Show(
- !p_intf->p_sys->InfoDlg->IsShown() );
+ p_intf->p_sys->p_dialogs->ShowFileInfo();
return true;
-#endif
case VLC_INTF_REFRESH:
InterfaceRefresh( (bool)evt->GetParam2() );
else
EnabledEvent( "next", true );
-
- // Update file name text
+ // Update file name
if( PlayList->i_index != Sys->i_index )
{
+ string long_name = PlayList->pp_items[PlayList->i_index]->psz_name;
+ int pos = long_name.rfind( DIRECTORY_SEPARATOR, long_name.size() );
+
+ // Complete file name
Thema->EvtBank->Get( "file_name" )->PostTextMessage(
PlayList->pp_items[PlayList->i_index]->psz_name );
+ // File name without path
+ Thema->EvtBank->Get( "title" )->PostTextMessage(
+ PlayList->pp_items[PlayList->i_index]->psz_name + pos + 1 );
}
// Update playlists
//---------------------------------------------------------------------------
-
//---------------------------------------------------------------------------
// Common VLC procedures
//---------------------------------------------------------------------------
void VlcProc::LoadSkin()
{
-#ifndef BASIC_SKINS
if( p_intf->p_sys->p_new_theme_file == NULL )
{
- wxFileDialog dialog( NULL, _("Open a skin file"), "", "",
- "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[dialog.GetPath().Length()];
-
- strcpy( p_intf->p_sys->p_new_theme_file,
- dialog.GetPath().c_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::OpenFile( bool play )
-{
-#ifndef BASIC_SKINS
- if( p_intf->p_sys->OpenDlg->ShowModal() != wxID_OK )
- {
- return;
- }
- // Check if playlist is available
- playlist_t *p_playlist = p_intf->p_sys->p_playlist;
- if( p_playlist == NULL )
- {
- return;
- }
-
- if( play )
- {
- // Append and play
- playlist_Add( p_playlist,
- (char *)p_intf->p_sys->OpenDlg->mrl.c_str(),
- PLAYLIST_APPEND | PLAYLIST_GO, PLAYLIST_END );
-
- p_intf->p_sys->p_theme->EvtBank->Get( "play" )->SendEvent();
- }
- else
- {
- // Append only
- playlist_Add( p_playlist,
- (char *)p_intf->p_sys->OpenDlg->mrl.c_str(),
- PLAYLIST_APPEND, PLAYLIST_END );
- }
-
- // Refresh interface !
- p_intf->p_sys->p_theme->EvtBank->Get( "playlist_refresh" )
- ->PostSynchroMessage();
- InterfaceRefresh();
-#endif
-}
-//---------------------------------------------------------------------------
void VlcProc::DropFile( unsigned int param )
{
// Get pointer to file
{
if( p_intf->p_sys->p_playlist == NULL )
return;
+
if( !p_intf->p_sys->p_playlist->i_size )
+ {
+ p_intf->p_sys->p_dialogs->ShowOpen( true );
+ InterfaceRefresh();
return;
+ }
playlist_Play( p_intf->p_sys->p_playlist );
InterfaceRefresh();
}
//---------------------------------------------------------------------------
-