From c750b4b088b3a4feb3a834f30fbf4a2a132a5d24 Mon Sep 17 00:00:00 2001 From: Eric Petit Date: Tue, 14 Jan 2003 14:48:55 +0000 Subject: [PATCH] * Added a file panel for subtitles file selection. --- modules/gui/beos/InterfaceWindow.cpp | 30 +++++++++++++++++++++++++++- modules/gui/beos/InterfaceWindow.h | 3 ++- modules/gui/beos/MsgVals.h | 4 +++- modules/gui/beos/VlcWrapper.cpp | 7 +++++-- modules/gui/beos/VlcWrapper.h | 3 ++- 5 files changed, 41 insertions(+), 6 deletions(-) diff --git a/modules/gui/beos/InterfaceWindow.cpp b/modules/gui/beos/InterfaceWindow.cpp index 3d066b89f7..c18f111f59 100644 --- a/modules/gui/beos/InterfaceWindow.cpp +++ b/modules/gui/beos/InterfaceWindow.cpp @@ -2,7 +2,7 @@ * InterfaceWindow.cpp: beos interface ***************************************************************************** * Copyright (C) 1999, 2000, 2001 VideoLAN - * $Id: InterfaceWindow.cpp,v 1.15 2003/01/12 02:08:38 titer Exp $ + * $Id: InterfaceWindow.cpp,v 1.16 2003/01/14 14:48:55 titer Exp $ * * Authors: Jean-Marc Dressler * Samuel Hocevar @@ -63,6 +63,7 @@ InterfaceWindow::InterfaceWindow( BRect frame, const char *name, B_NOT_ZOOMABLE | B_WILL_ACCEPT_FIRST_CLICK | B_ASYNCHRONOUS_CONTROLS ), p_intf( p_interface ), fFilePanel( NULL ), + fSubtitlesPanel( NULL ), fLastUpdateTime( system_time() ), fSettings( new BMessage( 'sett' ) ) { @@ -123,6 +124,9 @@ InterfaceWindow::InterfaceWindow( BRect frame, const char *name, new BMessage( OPEN_FILE ), 'O') ); fileMenu->AddItem( new CDMenu( "Open Disc" ) ); + + fileMenu->AddItem( new BMenuItem( "Load a subtitle file" B_UTF8_ELLIPSIS, + new BMessage( LOAD_SUBFILE ) ) ); fileMenu->AddSeparatorItem(); fileMenu->AddItem( new BMenuItem( "Play List" B_UTF8_ELLIPSIS, @@ -260,6 +264,30 @@ void InterfaceWindow::MessageReceived( BMessage * p_message ) _UpdatePlaylist(); } break; + + case LOAD_SUBFILE: + if( fSubtitlesPanel ) + { + fSubtitlesPanel->Show(); + break; + } + fSubtitlesPanel = new BFilePanel(); + fSubtitlesPanel->SetTarget( this ); + fSubtitlesPanel->SetMessage( new BMessage( SUBFILE_RECEIVED ) ); + fSubtitlesPanel->Show(); + break; + + case SUBFILE_RECEIVED: + { + entry_ref ref; + if( p_message->FindRef( "refs", 0, &ref ) == B_OK ) + { + BPath path( &ref ); + if ( path.InitCheck() == B_OK ) + p_wrapper->LoadSubFile( (char*)path.Path() ); + } + break; + } case STOP_PLAYBACK: // this currently stops playback not nicely diff --git a/modules/gui/beos/InterfaceWindow.h b/modules/gui/beos/InterfaceWindow.h index 91d14ce0b4..69a0840321 100644 --- a/modules/gui/beos/InterfaceWindow.h +++ b/modules/gui/beos/InterfaceWindow.h @@ -2,7 +2,7 @@ * InterfaceWindow.h: BeOS interface window class prototype ***************************************************************************** * Copyright (C) 1999, 2000, 2001 VideoLAN - * $Id: InterfaceWindow.h,v 1.7 2003/01/08 02:09:15 titer Exp $ + * $Id: InterfaceWindow.h,v 1.8 2003/01/14 14:48:55 titer Exp $ * * Authors: Jean-Marc Dressler * Tony Castley @@ -128,6 +128,7 @@ class InterfaceWindow : public BWindow bool fPlaylistIsEmpty; BFilePanel* fFilePanel; + BFilePanel* fSubtitlesPanel; PlayListWindow* fPlaylistWindow; PreferencesWindow* fPreferencesWindow; BMenuBar* fMenuBar; diff --git a/modules/gui/beos/MsgVals.h b/modules/gui/beos/MsgVals.h index ebbf9e3f4d..227d0714ce 100644 --- a/modules/gui/beos/MsgVals.h +++ b/modules/gui/beos/MsgVals.h @@ -2,7 +2,7 @@ * MsgVals.h ***************************************************************************** * Copyright (C) 2001 VideoLAN - * $Id: MsgVals.h,v 1.3 2002/10/28 16:55:05 titer Exp $ + * $Id: MsgVals.h,v 1.4 2003/01/14 14:48:55 titer Exp $ * * Authors: Tony Castley * Stephan Aßmus @@ -30,6 +30,8 @@ const uint32 OPEN_FILE = 'opfl'; const uint32 OPEN_DVD = 'opdv'; +const uint32 LOAD_SUBFILE = 'losu'; +const uint32 SUBFILE_RECEIVED = 'sure'; const uint32 OPEN_PLAYLIST = 'oppl'; const uint32 STOP_PLAYBACK = 'stpl'; const uint32 START_PLAYBACK = 'play'; diff --git a/modules/gui/beos/VlcWrapper.cpp b/modules/gui/beos/VlcWrapper.cpp index 71dd44dc1c..172efe18ad 100644 --- a/modules/gui/beos/VlcWrapper.cpp +++ b/modules/gui/beos/VlcWrapper.cpp @@ -2,7 +2,7 @@ * VlcWrapper.cpp: BeOS plugin for vlc (derived from MacOS X port) ***************************************************************************** * Copyright (C) 2001 VideoLAN - * $Id: VlcWrapper.cpp,v 1.17 2003/01/12 02:08:39 titer Exp $ + * $Id: VlcWrapper.cpp,v 1.18 2003/01/14 14:48:55 titer Exp $ * * Authors: Florian G. Pflug * Jon Lech Johansen @@ -241,7 +241,10 @@ void VlcWrapper::openDisc(BString o_type, BString o_device, int i_title, int i_c PLAYLIST_APPEND | PLAYLIST_GO, PLAYLIST_END ); } - +void VlcWrapper::LoadSubFile( char * psz_file ) +{ + config_PutPsz( p_intf, "sub-file", strdup( psz_file ) ); +} void VlcWrapper::ToggleLanguage( int i_language ) { diff --git a/modules/gui/beos/VlcWrapper.h b/modules/gui/beos/VlcWrapper.h index b58bfa8637..36d9aaf1e9 100644 --- a/modules/gui/beos/VlcWrapper.h +++ b/modules/gui/beos/VlcWrapper.h @@ -2,7 +2,7 @@ * VlcWrapper.h: BeOS plugin for vlc (derived from MacOS X port) ***************************************************************************** * Copyright (C) 2001 VideoLAN - * $Id: VlcWrapper.h,v 1.12 2003/01/12 02:08:39 titer Exp $ + * $Id: VlcWrapper.h,v 1.13 2003/01/14 14:48:55 titer Exp $ * * Authors: Florian G. Pflug * Jon Lech Johansen @@ -71,6 +71,7 @@ public: void openFiles( BList *o_files, bool replace = true ); void openDisc( BString o_type, BString o_device, int i_title, int i_chapter ); + void LoadSubFile( char * psz_file ); void ToggleLanguage( int i_language ); void ToggleSubtitle( int i_subtitle ); const char* getTimeAsString(); -- 2.39.2