* InterfaceWindow.cpp: beos interface
*****************************************************************************
* Copyright (C) 1999, 2000, 2001 VideoLAN
- * $Id: InterfaceWindow.cpp,v 1.16 2003/01/14 14:48:55 titer Exp $
+ * $Id: InterfaceWindow.cpp,v 1.17 2003/01/14 22:03:38 titer Exp $
*
* Authors: Jean-Marc Dressler <polux@via.ecp.fr>
* Samuel Hocevar <sam@zoy.org>
case B_REFS_RECEIVED:
case B_SIMPLE_DATA:
{
- // figure out if user wants files replaced or added
+ /* file(s) opened by the File menu -> append to the playlist;
+ * file(s) opened by drag & drop -> replace playlist;
+ * file(s) opened by 'shift' + drag & drop -> append */
bool replace = false;
if ( p_message->WasDropped() )
replace = !( modifiers() & B_SHIFT_KEY );
+
// build list of files to be played from message contents
entry_ref ref;
BList files;
{
BPath path( &ref );
if ( path.InitCheck() == B_OK )
- // the BString objects will be deleted
- // by the wrapper function further down
files.AddItem( new BString( (char*)path.Path() ) );
}
// give the list to VLC
* VlcWrapper.cpp: BeOS plugin for vlc (derived from MacOS X port)
*****************************************************************************
* Copyright (C) 2001 VideoLAN
- * $Id: VlcWrapper.cpp,v 1.18 2003/01/14 14:48:55 titer Exp $
+ * $Id: VlcWrapper.cpp,v 1.19 2003/01/14 22:03:38 titer Exp $
*
* Authors: Florian G. Pflug <fgp@phlo.org>
* Jon Lech Johansen <jon-vl@nanocrew.net>
void VlcWrapper::openFiles( BList* o_files, bool replace )
{
BString *o_file;
+ int size = PlaylistSize();
+ bool wasEmpty = ( size < 1 );
+ /* delete current playlist */
+ if( replace )
+ {
+ for( int i = 0; i < size; i++ )
+ {
+ playlist_Delete( p_playlist, 0 );
+ }
+ }
+
+ /* append files */
while( ( o_file = (BString *)o_files->LastItem() ) )
{
- o_files->RemoveItem(o_files->CountItems() - 1);
playlist_Add( p_playlist, o_file->String(),
- PLAYLIST_APPEND | PLAYLIST_GO, PLAYLIST_END );
- delete o_file;
+ PLAYLIST_APPEND, PLAYLIST_END );
+ o_files->RemoveItem(o_files->CountItems() - 1);
+ }
+
+ /* eventually restart playing */
+ if( replace || wasEmpty )
+ {
+ playlist_Stop( p_playlist );
+ playlist_Play( p_playlist );
}
}