]> 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 f009a0dbc95a3e7931134f1e1d3cbd7c80969ca1..e729e070c5d7c18c0548fe8c109c0833cf1c8bfa 100644 (file)
@@ -2,7 +2,7 @@
  * 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
@@ -63,6 +49,10 @@ VlcProc::VlcProc( intf_thread_t *_p_intf )
     p_intf = _p_intf;
 }
 //---------------------------------------------------------------------------
+VlcProc::~VlcProc()
+{
+}
+//---------------------------------------------------------------------------
 bool VlcProc::EventProc( Event *evt )
 {
     switch( evt->GetMessage() )
@@ -102,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:
@@ -134,28 +125,24 @@ 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;
 
-#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() );
@@ -282,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
@@ -326,30 +319,14 @@ void VlcProc::EnabledEvent( string type, bool state )
 //---------------------------------------------------------------------------
 
 
-
 //---------------------------------------------------------------------------
 // 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
     {
@@ -387,48 +364,9 @@ void VlcProc::LoadSkin()
         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
@@ -480,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 );
 
@@ -608,4 +551,3 @@ void VlcProc::AddNetworkUDP( int port )
     InterfaceRefresh();
 }
 //---------------------------------------------------------------------------
-