* vlcproc.cpp: VlcProc class
*****************************************************************************
* Copyright (C) 2003 VideoLAN
- * $Id: vlcproc.cpp,v 1.35 2003/06/11 10:42:34 gbazin Exp $
+ * $Id: vlcproc.cpp,v 1.41 2003/07/20 10:38:49 gbazin Exp $
*
* Authors: Olivier Teulière <ipkiss@via.ecp.fr>
* Emmanuel Puig <karibu@via.ecp.fr>
//---------------------------------------------------------------------------
VlcProc::VlcProc( intf_thread_t *_p_intf )
{
- p_intf = _p_intf;
+ p_intf = _p_intf;
+
+ playlist_t *p_playlist = (playlist_t *)vlc_object_find( p_intf,
+ VLC_OBJECT_PLAYLIST, FIND_ANYWHERE );
+ if( p_playlist != NULL )
+ {
+ // We want to be noticed of playlit changes
+ var_AddCallback( p_playlist, "intf-change", RefreshCallback, this );
+
+ // Raise/lower interface with middle click on vout
+ var_AddCallback( p_playlist, "intf-show", IntfShowCallback, this );
+
+ vlc_object_release( p_playlist );
+ }
}
//---------------------------------------------------------------------------
VlcProc::~VlcProc()
{
+ // Remove the refresh callback
+ playlist_t *p_playlist = (playlist_t *)vlc_object_find( p_intf,
+ VLC_OBJECT_PLAYLIST, FIND_ANYWHERE );
+ if( p_playlist != NULL )
+ {
+ var_DelCallback( p_playlist, "intf-change", RefreshCallback, this );
+ vlc_object_release( p_playlist );
+ }
}
//---------------------------------------------------------------------------
bool VlcProc::EventProc( Event *evt )
return true;
case VLC_INTF_REFRESH:
- InterfaceRefresh( (bool)evt->GetParam2() );
+ InterfaceRefresh();
return true;
case VLC_TEST_ALL_CLOSED:
//---------------------------------------------------------------------------
// Private methods
//---------------------------------------------------------------------------
-void VlcProc::InterfaceRefresh( bool All )
+
+// Refresh callback
+int VlcProc::RefreshCallback( vlc_object_t *p_this, const char *psz_variable,
+ vlc_value_t old_val, vlc_value_t new_val, void *param )
+{
+ ( (VlcProc*)param )->InterfaceRefresh();
+ return VLC_SUCCESS;
+}
+
+// Interface show/hide callback
+int VlcProc::IntfShowCallback( vlc_object_t *p_this, const char *psz_variable,
+ vlc_value_t old_val, vlc_value_t new_val, void *param )
+{
+ if( new_val.b_bool == VLC_TRUE )
+ {
+ OSAPI_PostMessage( NULL, VLC_SHOW, 1, 0 );
+ }
+ else
+ {
+ OSAPI_PostMessage( NULL, VLC_HIDE, 1, 0 );
+ }
+ return VLC_SUCCESS;
+}
+
+void VlcProc::InterfaceRefresh()
{
// Shortcut pointers
intf_sys_t *Sys = p_intf->p_sys;
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
Sys->i_size = 0;
}
}
-
}
//---------------------------------------------------------------------------
void VlcProc::EnabledEvent( string type, bool state )
{
if( p_intf->p_sys->p_new_theme_file == NULL )
{
- p_intf->p_sys->p_dialogs->ShowOpenSkin();
+ p_intf->p_sys->p_dialogs->ShowOpenSkin( 0 /*none blocking*/ );
}
else
{
delete Loader;
// Uninitialize new theme
- delete (char *)p_intf->p_sys->p_new_theme_file;
+ delete[] p_intf->p_sys->p_new_theme_file;
p_intf->p_sys->p_new_theme_file = NULL;
}
}