Commit e7292744 authored by Stephan Assmus's avatar Stephan Assmus

modules/gui/beos/InterfaceWindow.h/.cpp

	- improved file loading:
		- contents of sub folders can optionally be loaded too
		- files are loaded in expected order from filepanel
			_and_ drag'n'drop
		- file panel accepts folders to load
	- saving of playlist's display mode
	- added updating of interface when playlist is modified
		while nothing is playing
	- added compatibility for SoundPlay's drag'n'drop message format


modules/gui/beos/ListViews.h/.cpp

	- implemented reversal of playlist
	- list can display full path or file name only
	- drag'n'drop interaction with SoundPlay


modules/gui/beos/MediaControlView.cpp

	- cosmetic fix


modules/gui/beos/PlayListWindow.h/.cpp

	- added reverse sort command to edit menu
	- added view menu, to allow the user to display paths
		or only names in the list
parent 9578d257
This diff is collapsed.
This diff is collapsed.
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* ListViews.h: BeOS interface list view class prototype * ListViews.h: BeOS interface list view class prototype
***************************************************************************** *****************************************************************************
* Copyright (C) 1999, 2000, 2001 VideoLAN * Copyright (C) 1999, 2000, 2001 VideoLAN
* $Id: ListViews.h,v 1.3 2003/02/01 12:01:11 stippi Exp $ * $Id: ListViews.h,v 1.4 2003/02/03 17:18:48 stippi Exp $
* *
* Authors: Stephan Aßmus <stippi@yellowbites.com> * Authors: Stephan Aßmus <stippi@yellowbites.com>
* *
...@@ -26,6 +26,13 @@ ...@@ -26,6 +26,13 @@
#include <ListItem.h> #include <ListItem.h>
#include <ListView.h> #include <ListView.h>
#include <String.h>
enum
{
DISPLAY_PATH = 0,
DISPLAY_NAME,
};
class InterfaceWindow; class InterfaceWindow;
...@@ -38,9 +45,13 @@ class PlaylistItem : public BStringItem ...@@ -38,9 +45,13 @@ class PlaylistItem : public BStringItem
virtual void Draw( BView* owner, BRect frame, virtual void Draw( BView* owner, BRect frame,
bool tintedLine, bool tintedLine,
uint32 mode,
bool active = false, bool active = false,
bool playing = false ); bool playing = false );
private:
BString fName; // additional to BStringItem::Text()
}; };
// DragSortableListView // DragSortableListView
...@@ -79,6 +90,7 @@ class DragSortableListView : public BListView ...@@ -79,6 +90,7 @@ class DragSortableListView : public BListView
virtual void CopyItems( BList& items, int32 toIndex ); virtual void CopyItems( BList& items, int32 toIndex );
virtual void RemoveItemList( BList& indices ); virtual void RemoveItemList( BList& indices );
void RemoveSelected(); // uses RemoveItemList() void RemoveSelected(); // uses RemoveItemList()
int32 CountSelectedItems() const;
virtual BListItem* CloneItem( int32 atIndex ) const = 0; virtual BListItem* CloneItem( int32 atIndex ) const = 0;
virtual void DrawListItem( BView* owner, int32 index, virtual void DrawListItem( BView* owner, int32 index,
...@@ -130,11 +142,24 @@ class PlaylistView : public DragSortableListView ...@@ -130,11 +142,24 @@ class PlaylistView : public DragSortableListView
void SetPlaying( bool playing ); void SetPlaying( bool playing );
void RebuildList(); void RebuildList();
void SortReverse();
void SortByPath();
void SortByName();
void SetDisplayMode( uint32 mode );
uint32 DisplayMode() const
{ return fDisplayMode; }
private: private:
BListItem* _PlayingItem() const;
void _SetPlayingIndex( BListItem* item );
int32 fCurrentIndex; int32 fCurrentIndex;
bool fPlaying; bool fPlaying;
uint32 fDisplayMode;
InterfaceWindow* fMainWindow; InterfaceWindow* fMainWindow;
BMessage* fSelectionChangeMessage; BMessage* fSelectionChangeMessage;
PlaylistItem* fLastClickedItem;
VlcWrapper* fVlcWrapper; VlcWrapper* fVlcWrapper;
}; };
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* MediaControlView.cpp: beos interface * MediaControlView.cpp: beos interface
***************************************************************************** *****************************************************************************
* Copyright (C) 1999, 2000, 2001 VideoLAN * Copyright (C) 1999, 2000, 2001 VideoLAN
* $Id: MediaControlView.cpp,v 1.14 2003/02/01 12:01:11 stippi Exp $ * $Id: MediaControlView.cpp,v 1.15 2003/02/03 17:18:48 stippi Exp $
* *
* Authors: Tony Castley <tony@castley.net> * Authors: Tony Castley <tony@castley.net>
* Stephan Aßmus <stippi@yellowbites.com> * Stephan Aßmus <stippi@yellowbites.com>
...@@ -1454,12 +1454,12 @@ void ...@@ -1454,12 +1454,12 @@ void
PositionInfoView::_MakeString( BString& into, int32 index, int32 maxIndex ) const PositionInfoView::_MakeString( BString& into, int32 index, int32 maxIndex ) const
{ {
into = ""; into = "";
if ( index >= 0) if ( index >= 0 && maxIndex >= 0 )
into << index; into << index;
else else
into << "-"; into << "-";
into << "/"; into << "/";
if ( maxIndex >= 0) if ( maxIndex >= 0 )
into << maxIndex; into << maxIndex;
else else
into << "-"; into << "-";
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* MsgVals.h * MsgVals.h
***************************************************************************** *****************************************************************************
* Copyright (C) 2001 VideoLAN * Copyright (C) 2001 VideoLAN
* $Id: MsgVals.h,v 1.5 2003/01/25 20:15:41 titer Exp $ * $Id: MsgVals.h,v 1.6 2003/02/03 17:18:48 stippi Exp $
* *
* Authors: Tony Castley <tcastley@mail.powerup.com.au> * Authors: Tony Castley <tcastley@mail.powerup.com.au>
* Stephan Aßmus <stippi@yellowbites.com> * Stephan Aßmus <stippi@yellowbites.com>
...@@ -63,9 +63,11 @@ const uint32 RESIZE_100 = 'rsor'; ...@@ -63,9 +63,11 @@ const uint32 RESIZE_100 = 'rsor';
const uint32 RESIZE_200 = 'rsdb'; const uint32 RESIZE_200 = 'rsdb';
const uint32 RESIZE_TRUE = 'rstr'; const uint32 RESIZE_TRUE = 'rstr';
const uint32 ASPECT_CORRECT = 'asco'; const uint32 ASPECT_CORRECT = 'asco';
const uint32 VERT_SYNC = 'vsyn'; const uint32 VERT_SYNC = 'vsyn';
const uint32 WINDOW_FEEL = 'wfel'; const uint32 WINDOW_FEEL = 'wfel';
const uint32 SCREEN_SHOT = 'scrn'; const uint32 SCREEN_SHOT = 'scrn';
const uint32 MSG_UPDATE = 'updt';
const uint32 MSG_SOUNDPLAY = 'move'; // drag'n'drop from soundplay playlist
const uint32 INTERFACE_CREATED = 'ifcr'; /* see VlcApplication::MessageReceived() const uint32 INTERFACE_CREATED = 'ifcr'; /* see VlcApplication::MessageReceived()
* in src/misc/beos_specific.cpp */ * in src/misc/beos_specific.cpp */
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* PlayListWindow.cpp: beos interface * PlayListWindow.cpp: beos interface
***************************************************************************** *****************************************************************************
* Copyright (C) 1999, 2000, 2001 VideoLAN * Copyright (C) 1999, 2000, 2001 VideoLAN
* $Id: PlayListWindow.cpp,v 1.7 2003/02/01 12:01:11 stippi Exp $ * $Id: PlayListWindow.cpp,v 1.8 2003/02/03 17:18:48 stippi Exp $
* *
* Authors: Jean-Marc Dressler <polux@via.ecp.fr> * Authors: Jean-Marc Dressler <polux@via.ecp.fr>
* Samuel Hocevar <sam@zoy.org> * Samuel Hocevar <sam@zoy.org>
...@@ -46,12 +46,14 @@ enum ...@@ -46,12 +46,14 @@ enum
MSG_SELECT_ALL = 'sall', MSG_SELECT_ALL = 'sall',
MSG_SELECT_NONE = 'none', MSG_SELECT_NONE = 'none',
MSG_RANDOMIZE = 'rndm', MSG_RANDOMIZE = 'rndm',
MSG_SORT_REVERSE = 'srtr',
MSG_SORT_NAME = 'srtn', MSG_SORT_NAME = 'srtn',
MSG_SORT_PATH = 'srtp', MSG_SORT_PATH = 'srtp',
MSG_REMOVE = 'rmov', MSG_REMOVE = 'rmov',
MSG_REMOVE_ALL = 'rmal', MSG_REMOVE_ALL = 'rmal',
MSG_SELECTION_CHANGED = 'slch', MSG_SELECTION_CHANGED = 'slch',
MSG_SET_DISPLAY = 'stds',
}; };
...@@ -103,6 +105,9 @@ PlayListWindow::PlayListWindow( BRect frame, const char* name, ...@@ -103,6 +105,9 @@ PlayListWindow::PlayListWindow( BRect frame, const char* name,
editMenu->AddItem( fSelectNoneMI ); editMenu->AddItem( fSelectNoneMI );
editMenu->AddSeparatorItem(); editMenu->AddSeparatorItem();
fSortReverseMI = new BMenuItem( "Sort Reverse",
new BMessage( MSG_SORT_REVERSE ), 'F' );
editMenu->AddItem( fSortReverseMI );
fSortNameMI = new BMenuItem( "Sort by Name", fSortNameMI = new BMenuItem( "Sort by Name",
new BMessage( MSG_SORT_NAME ), 'N' ); new BMessage( MSG_SORT_NAME ), 'N' );
fSortNameMI->SetEnabled( false ); fSortNameMI->SetEnabled( false );
...@@ -123,6 +128,22 @@ fRandomizeMI->SetEnabled( false ); ...@@ -123,6 +128,22 @@ fRandomizeMI->SetEnabled( false );
new BMessage( MSG_REMOVE_ALL ) ); new BMessage( MSG_REMOVE_ALL ) );
editMenu->AddItem( fRemoveAllMI ); editMenu->AddItem( fRemoveAllMI );
// Add View menu
fViewMenu = new BMenu( "View" );
fMenuBar->AddItem( fViewMenu );
fViewMenu->SetRadioMode( true );
BMessage* message = new BMessage( MSG_SET_DISPLAY );
message->AddInt32( "mode", DISPLAY_PATH );
item = new BMenuItem( "Path", message );
item->SetMarked( true );
fViewMenu->AddItem( item );
message = new BMessage( MSG_SET_DISPLAY );
message->AddInt32( "mode", DISPLAY_NAME );
item = new BMenuItem( "Name", message );
fViewMenu->AddItem( item );
// make menu bar resize to correct height // make menu bar resize to correct height
float menuWidth, menuHeight; float menuWidth, menuHeight;
fMenuBar->GetPreferredSize( &menuWidth, &menuHeight ); fMenuBar->GetPreferredSize( &menuWidth, &menuHeight );
...@@ -145,8 +166,8 @@ fRandomizeMI->SetEnabled( false ); ...@@ -145,8 +166,8 @@ fRandomizeMI->SetEnabled( false );
// be up to date // be up to date
UpdatePlaylist(); UpdatePlaylist();
FrameResized( Bounds().Width(), Bounds().Height() ); FrameResized( Bounds().Width(), Bounds().Height() );
SetSizeLimits( menuWidth * 2.0, menuWidth * 6.0, SetSizeLimits( menuWidth * 1.5, menuWidth * 8.0,
menuHeight * 5.0, menuHeight * 25.0 ); menuHeight * 5.0, menuHeight * 50.0 );
UpdatePlaylist( true ); UpdatePlaylist( true );
// start window thread in hidden state // start window thread in hidden state
...@@ -193,6 +214,9 @@ PlayListWindow::MessageReceived( BMessage * p_message ) ...@@ -193,6 +214,9 @@ PlayListWindow::MessageReceived( BMessage * p_message )
break; break;
case MSG_RANDOMIZE: case MSG_RANDOMIZE:
break; break;
case MSG_SORT_REVERSE:
fListView->SortReverse();
break;
case MSG_SORT_NAME: case MSG_SORT_NAME:
break; break;
case MSG_SORT_PATH: case MSG_SORT_PATH:
...@@ -207,6 +231,13 @@ PlayListWindow::MessageReceived( BMessage * p_message ) ...@@ -207,6 +231,13 @@ PlayListWindow::MessageReceived( BMessage * p_message )
case MSG_SELECTION_CHANGED: case MSG_SELECTION_CHANGED:
_CheckItemsEnableState(); _CheckItemsEnableState();
break; break;
case MSG_SET_DISPLAY:
{
uint32 mode;
if ( p_message->FindInt32( "mode", (int32*)&mode ) == B_OK )
SetDisplayMode( mode );
break;
}
case B_MODIFIERS_CHANGED: case B_MODIFIERS_CHANGED:
fListView->ModifiersChanged(); fListView->ModifiersChanged();
break; break;
...@@ -257,6 +288,42 @@ PlayListWindow::UpdatePlaylist( bool rebuild ) ...@@ -257,6 +288,42 @@ PlayListWindow::UpdatePlaylist( bool rebuild )
_CheckItemsEnableState(); _CheckItemsEnableState();
} }
/*****************************************************************************
* PlayListWindow::SetDisplayMode
*****************************************************************************/
void
PlayListWindow::SetDisplayMode( uint32 mode )
{
if ( Lock() )
{
// propagate to list view
fListView->SetDisplayMode( mode );
// mark correct menu item
for ( int32 i = 0; BMenuItem* item = fViewMenu->ItemAt( i ); i++ )
{
BMessage* message = item->Message();
uint32 itemMode;
if ( message
&& message->FindInt32( "mode", (int32*)&itemMode ) == B_OK
&& itemMode == mode )
{
item->SetMarked( true );
break;
}
}
Unlock();
}
}
/*****************************************************************************
* PlayListWindow::DisplayMode
*****************************************************************************/
uint32
PlayListWindow::DisplayMode() const
{
return fListView->DisplayMode();
}
/***************************************************************************** /*****************************************************************************
* PlayListWindow::_CheckItemsEnableState * PlayListWindow::_CheckItemsEnableState
*****************************************************************************/ *****************************************************************************/
...@@ -267,11 +334,12 @@ PlayListWindow::_CheckItemsEnableState() const ...@@ -267,11 +334,12 @@ PlayListWindow::_CheckItemsEnableState() const
int32 test = fListView->CurrentSelection( 0 ); int32 test = fListView->CurrentSelection( 0 );
bool enable1 = test >= 0; bool enable1 = test >= 0;
// check if at least two items selected // check if at least two items selected
// test = fListView->CurrentSelection( 1 ); test = fListView->CurrentSelection( 1 );
// bool enable2 = test >= 0; bool enable2 = test >= 0;
bool notEmpty = fListView->CountItems() > 0; bool notEmpty = fListView->CountItems() > 0;
_SetMenuItemEnabled( fSelectAllMI, notEmpty ); _SetMenuItemEnabled( fSelectAllMI, notEmpty );
_SetMenuItemEnabled( fSelectNoneMI, enable1 ); _SetMenuItemEnabled( fSelectNoneMI, enable1 );
_SetMenuItemEnabled( fSortReverseMI, enable2 );
// _SetMenuItemEnabled( fSortNameMI, enable2 ); // _SetMenuItemEnabled( fSortNameMI, enable2 );
// _SetMenuItemEnabled( fSortPathMI, enable2 ); // _SetMenuItemEnabled( fSortPathMI, enable2 );
// _SetMenuItemEnabled( fRandomizeMI, enable2 ); // _SetMenuItemEnabled( fRandomizeMI, enable2 );
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* PlayListWindow.h: BeOS interface window class prototype * PlayListWindow.h: BeOS interface window class prototype
***************************************************************************** *****************************************************************************
* Copyright (C) 1999, 2000, 2001 VideoLAN * Copyright (C) 1999, 2000, 2001 VideoLAN
* $Id: PlayListWindow.h,v 1.6 2003/02/01 12:01:11 stippi Exp $ * $Id: PlayListWindow.h,v 1.7 2003/02/03 17:18:48 stippi Exp $
* *
* Authors: Jean-Marc Dressler <polux@via.ecp.fr> * Authors: Jean-Marc Dressler <polux@via.ecp.fr>
* Tony Castley <tcastley@mail.powerup.com.au> * Tony Castley <tcastley@mail.powerup.com.au>
...@@ -51,6 +51,9 @@ class PlayListWindow : public BWindow ...@@ -51,6 +51,9 @@ class PlayListWindow : public BWindow
void ReallyQuit(); void ReallyQuit();
void UpdatePlaylist( bool rebuild = false ); void UpdatePlaylist( bool rebuild = false );
void SetDisplayMode( uint32 mode );
uint32 DisplayMode() const;
private: private:
void _CheckItemsEnableState() const; void _CheckItemsEnableState() const;
void _SetMenuItemEnabled( BMenuItem* item, void _SetMenuItemEnabled( BMenuItem* item,
...@@ -63,11 +66,13 @@ class PlayListWindow : public BWindow ...@@ -63,11 +66,13 @@ class PlayListWindow : public BWindow
BMenuItem* fSelectAllMI; BMenuItem* fSelectAllMI;
BMenuItem* fSelectNoneMI; BMenuItem* fSelectNoneMI;
BMenuItem* fSortReverseMI;
BMenuItem* fSortNameMI; BMenuItem* fSortNameMI;
BMenuItem* fSortPathMI; BMenuItem* fSortPathMI;
BMenuItem* fRandomizeMI; BMenuItem* fRandomizeMI;
BMenuItem* fRemoveMI; BMenuItem* fRemoveMI;
BMenuItem* fRemoveAllMI; BMenuItem* fRemoveAllMI;
BMenu* fViewMenu;
intf_thread_t * p_intf; intf_thread_t * p_intf;
VlcWrapper * p_wrapper; VlcWrapper * p_wrapper;
......
Markdown is supported
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