Commit 1e4d2842 authored by Eric Petit's avatar Eric Petit
Browse files

Fixed playlist behaviour (draging a file replaces the playlist, and

 draging a file while pressing the 'Shift' key appends it while the
 current one keeps playing.
parent f557ba54
......@@ -2,7 +2,7 @@
* 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>
......@@ -443,10 +443,13 @@ void InterfaceWindow::MessageReceived( BMessage * p_message )
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;
......@@ -454,8 +457,6 @@ void InterfaceWindow::MessageReceived( BMessage * p_message )
{
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
......
......@@ -2,7 +2,7 @@
* 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>
......@@ -222,13 +222,31 @@ BList * VlcWrapper::InputGetChannels( int i_cat )
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 );
}
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment