]> git.sesse.net Git - vlc/blobdiff - modules/gui/skins/src/vlcproc.cpp
* modules/gui/skins/*:
[vlc] / modules / gui / skins / src / vlcproc.cpp
index 45e563473261f45bea6c5bc4d122679d48d3929a..3adfc347d7f837b23fb5ec733c9c7203c3e6c7c8 100644 (file)
@@ -2,7 +2,7 @@
  * vlcproc.cpp: VlcProc class
  *****************************************************************************
  * Copyright (C) 2003 VideoLAN
- * $Id: vlcproc.cpp,v 1.45 2003/10/15 12:24:14 gbazin Exp $
+ * $Id: vlcproc.cpp,v 1.54 2004/02/15 18:58:38 ipkiss Exp $
  *
  * Authors: Olivier Teulière <ipkiss@via.ecp.fr>
  *          Emmanuel Puig    <karibu@via.ecp.fr>
@@ -52,7 +52,7 @@ VlcProc::VlcProc( intf_thread_t *_p_intf )
         VLC_OBJECT_PLAYLIST, FIND_ANYWHERE );
     if( p_playlist != NULL )
     {
-        // We want to be notified of playlit changes
+        // We want to be notified of playlist changes
         var_AddCallback( p_playlist, "intf-change", RefreshCallback, this );
 
         // Raise/lower interface with middle click on vout
@@ -127,8 +127,19 @@ bool VlcProc::EventProc( Event *evt )
             LoadSkin();
             return true;
 
+        case VLC_ON_TOP:
+            for( list<SkinWindow *>::const_iterator win =
+                    p_intf->p_sys->p_theme->WindowList.begin();
+                win != p_intf->p_sys->p_theme->WindowList.end(); win++ )
+            {
+                (*win)->ToggleOnTop();
+            }
+            // Set the indicator to the new state
+            p_intf->p_sys->b_on_top = !p_intf->p_sys->b_on_top;
+            return true;
+
         case VLC_DROP:
-            DropFile( evt->GetParam1() );
+            DropFile( evt->GetParam1(), evt->GetParam2() );
             return true;
 
         case VLC_PLAY:
@@ -151,6 +162,14 @@ bool VlcProc::EventProc( Event *evt )
             PrevStream();
             return true;
 
+        case VLC_SLOWER:
+            SlowStream();
+            return true;
+
+        case VLC_FASTER:
+            FastStream();
+            return true;
+
         case VLC_PLAYLIST_ADD_FILE:
             p_intf->p_sys->p_dialogs->ShowOpen( false );
             InterfaceRefresh();
@@ -279,6 +298,8 @@ void VlcProc::InterfaceRefresh()
     // Refresh
     if( PlayList != NULL )
     {
+        vlc_mutex_lock( &PlayList->object_lock );
+
         // Refresh stream control controls ! :)
         switch( PlayList->i_status )
         {
@@ -314,7 +335,7 @@ void VlcProc::InterfaceRefresh()
             EnabledEvent( "next", true );
 
         // Update file name
-        if( PlayList->i_index != Sys->i_index )
+        if( PlayList->i_index >= 0 && 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() );
@@ -335,6 +356,8 @@ void VlcProc::InterfaceRefresh()
             Sys->i_size  = PlayList->i_size;
             Sys->i_index = PlayList->i_index;
         }
+
+        vlc_mutex_unlock( &PlayList->object_lock );
     }
     else
     {
@@ -358,6 +381,12 @@ void VlcProc::EnabledEvent( string type, bool state )
 {
     OSAPI_PostMessage( NULL, CTRL_ENABLED, (unsigned int)
         p_intf->p_sys->p_theme->EvtBank->Get( type ), (int)state );
+
+    if( !state )
+    {
+        OSAPI_PostMessage( NULL, CTRL_SYNCHRO, (unsigned int)
+            p_intf->p_sys->p_theme->EvtBank->Get( type ), (int)false );
+    }
 }
 //---------------------------------------------------------------------------
 
@@ -404,28 +433,32 @@ void VlcProc::LoadSkin()
         delete Loader;
 
         // Uninitialize new theme
-        delete[] p_intf->p_sys->p_new_theme_file;
+        free( p_intf->p_sys->p_new_theme_file );
         p_intf->p_sys->p_new_theme_file = NULL;
+
+        OSAPI_PostMessage( NULL, VLC_INTF_REFRESH, 0, (int)true );
     }
 }
 //---------------------------------------------------------------------------
 
-void VlcProc::DropFile( unsigned int param )
+void VlcProc::DropFile( unsigned int param1, long param2 )
 {
     // Get pointer to file
-    char *FileName = (char *)param;
+    char *FileName = (char *)param1;
 
     // Add the new file to the playlist
     if( p_intf->p_sys->p_playlist != NULL )
     {
-        if( config_GetInt( p_intf, "enqueue" ) )
+        if( param2 == 0 )
         {
-            playlist_Add( p_intf->p_sys->p_playlist, FileName, 0, 0,
+            // Enqueue the item
+            playlist_Add( p_intf->p_sys->p_playlist, FileName, FileName,
                           PLAYLIST_APPEND, PLAYLIST_END );
         }
         else
         {
-            playlist_Add( p_intf->p_sys->p_playlist, FileName, 0, 0,
+            // Enqueue and play the item
+            playlist_Add( p_intf->p_sys->p_playlist, FileName, FileName,
                           PLAYLIST_APPEND | PLAYLIST_GO, PLAYLIST_END );
         }
     }
@@ -437,7 +470,6 @@ void VlcProc::DropFile( unsigned int param )
 
     // Refresh interface
     InterfaceRefresh();
-
 }
 //---------------------------------------------------------------------------
 
@@ -449,9 +481,10 @@ void VlcProc::DropFile( unsigned int param )
 //---------------------------------------------------------------------------
 void VlcProc::PauseStream()
 {
-    if( p_intf->p_sys->p_input == NULL )
+    if( p_intf->p_sys->p_playlist == NULL )
         return;
-    input_SetStatus( p_intf->p_sys->p_input, INPUT_STATUS_PAUSE );
+
+    playlist_Command( p_intf->p_sys->p_playlist, PLAYLIST_PAUSE, 0 );
 
     // Refresh interface
     InterfaceRefresh();
@@ -507,6 +540,34 @@ void VlcProc::PrevStream()
     InterfaceRefresh();
 }
 //---------------------------------------------------------------------------
+void VlcProc::SlowStream()
+{
+    input_thread_t *p_input =
+        (input_thread_t *)vlc_object_find( p_intf, VLC_OBJECT_INPUT,
+                                           FIND_ANYWHERE );
+    if( p_input )
+    {
+        vlc_value_t val; val.b_bool = VLC_TRUE;
+
+        var_Set( p_input, "rate-slower", val );
+        vlc_object_release( p_input );
+    }
+}
+//---------------------------------------------------------------------------
+void VlcProc::FastStream()
+{
+    input_thread_t *p_input =
+        (input_thread_t *)vlc_object_find( p_intf, VLC_OBJECT_INPUT,
+                                           FIND_ANYWHERE );
+    if( p_input )
+    {
+        vlc_value_t val; val.b_bool = VLC_TRUE;
+
+        var_Set( p_input, "rate-faster", val );
+        vlc_object_release( p_input );
+    }
+}
+//---------------------------------------------------------------------------
 void VlcProc::MoveStream( long Pos )
 {
     if( p_intf->p_sys->p_input == NULL )
@@ -565,10 +626,10 @@ void VlcProc::ChangeVolume( unsigned int msg, long param )
             aout_VolumeDown( p_intf, 1, NULL );
             break;
         case VLC_VOLUME_SET:
-            aout_VolumeSet( p_intf, param * AOUT_VOLUME_MAX / SLIDER_RANGE );
+            aout_VolumeSet( p_intf, param * (AOUT_VOLUME_DEFAULT * 2) /
+                            SLIDER_RANGE );
             break;
     }
     aout_VolumeGet( p_intf, &volume );
-
 }
 //---------------------------------------------------------------------------