]> git.sesse.net Git - vlc/blobdiff - modules/gui/skins/src/vlcproc.cpp
* ./modules/gui/skins/src/vlcproc.cpp: added the "title" option to the
[vlc] / modules / gui / skins / src / vlcproc.cpp
index 90395850618157408cda625b2fea04196659a3c8..e729e070c5d7c18c0548fe8c109c0833cf1c8bfa 100644 (file)
@@ -2,7 +2,7 @@
  * vlcproc.cpp: VlcProc class
  *****************************************************************************
  * Copyright (C) 2003 VideoLAN
- * $Id: vlcproc.cpp,v 1.16 2003/04/25 12:37:52 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>
  * USA.
  *****************************************************************************/
 
-#include <wx/wx.h>
-
 //--- VLC -------------------------------------------------------------------
 #include <vlc/vlc.h>
 #include <vlc/intf.h>
 #include <vlc/aout.h>
 #include <vlc/vout.h>
 
-extern "C" {
-#include "netutils.h"
-}
-
 //--- SKIN ------------------------------------------------------------------
 #include "../os_api.h"
 #include "event.h"
@@ -45,9 +39,7 @@ extern "C" {
 #include "window.h"
 #include "vlcproc.h"
 #include "skin_common.h"
-#include "wxdialogs.h"
-
-
+#include "dialogs.h"
 
 //---------------------------------------------------------------------------
 // VlcProc
@@ -57,6 +49,10 @@ VlcProc::VlcProc( intf_thread_t *_p_intf )
     p_intf = _p_intf;
 }
 //---------------------------------------------------------------------------
+VlcProc::~VlcProc()
+{
+}
+//---------------------------------------------------------------------------
 bool VlcProc::EventProc( Event *evt )
 {
     switch( evt->GetMessage() )
@@ -96,7 +92,8 @@ bool VlcProc::EventProc( Event *evt )
             return true;
 
         case VLC_OPEN:
-            OpenFile( true );
+            p_intf->p_sys->p_dialogs->ShowOpen( true );
+            InterfaceRefresh();
             return true;
 
         case VLC_LOAD_SKIN:
@@ -128,25 +125,23 @@ bool VlcProc::EventProc( Event *evt )
             return true;
 
         case VLC_PLAYLIST_ADD_FILE:
-            OpenFile( false );
+            p_intf->p_sys->p_dialogs->ShowOpen( false );
+            InterfaceRefresh();
             return true;
 
         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;
 
         case VLC_INTF_REFRESH:
@@ -171,10 +166,6 @@ bool VlcProc::EventProc( Event *evt )
             AddNetworkUDP( (int)evt->GetParam2() );
             return true;
 
-        case VLC_NET_ADDCS:
-            AddNetworkChannelServer( (char *)evt->GetParam1() );
-            return true;
-
         default:
             return true;
     }
@@ -278,12 +269,18 @@ void VlcProc::InterfaceRefresh( bool All )
         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
@@ -322,7 +319,6 @@ void VlcProc::EnabledEvent( string type, bool state )
 //---------------------------------------------------------------------------
 
 
-
 //---------------------------------------------------------------------------
 // Common VLC procedures
 //---------------------------------------------------------------------------
@@ -330,21 +326,7 @@ void VlcProc::LoadSkin()
 {
     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
     {
@@ -384,43 +366,7 @@ void VlcProc::LoadSkin()
     }
 }
 //---------------------------------------------------------------------------
-void VlcProc::OpenFile( bool play )
-{
-    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();
-}
-//---------------------------------------------------------------------------
 void VlcProc::DropFile( unsigned int param )
 {
     // Get pointer to file
@@ -472,8 +418,13 @@ void VlcProc::PlayStream()
 {
     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 );
 
@@ -585,8 +536,6 @@ void VlcProc::ChangeVolume( unsigned int msg, long param )
 //---------------------------------------------------------------------------
 void VlcProc::AddNetworkUDP( int port )
 {
-    config_PutInt( p_intf, "network-channel", VLC_FALSE );
-
     // Build source name
     char *s_port = new char[5];
     sprintf( s_port, "%i", port );
@@ -602,32 +551,3 @@ void VlcProc::AddNetworkUDP( int port )
     InterfaceRefresh();
 }
 //---------------------------------------------------------------------------
-void VlcProc::AddNetworkChannelServer( char *server )
-{
-    char *name = new char[MAX_PARAM_SIZE];
-    int  port = 0;
-
-    // Scan the server address
-    int scan = sscanf( server, "%[^:]:%i", name, &port );
-
-    if( scan != 2)
-    {
-        msg_Err( p_intf, "Invalid channel server: %s", server );
-        delete[] name;
-        return;
-    }
-
-    config_PutInt( p_intf, "network-channel", VLC_TRUE );
-    config_PutPsz( p_intf, "channel-server", name );
-    config_PutInt( p_intf, "channel-port", port );
-
-    if( p_intf->p_vlc->p_channel == NULL )
-    {
-        network_ChannelCreate( p_intf );
-    }
-
-    delete[] name;
-
-}
-//---------------------------------------------------------------------------
-