Commit 49173f5e authored by Stephan Assmus's avatar Stephan Assmus

Changes done since Feb 28 2003:

parent 46e7a04e
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* intf_beos.cpp: beos interface * intf_beos.cpp: beos interface
***************************************************************************** *****************************************************************************
* Copyright (C) 1999, 2000, 2001 VideoLAN * Copyright (C) 1999, 2000, 2001 VideoLAN
* $Id: Interface.cpp,v 1.8 2003/01/25 20:15:41 titer Exp $ * $Id: Interface.cpp,v 1.9 2003/02/01 12:01:10 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>
...@@ -70,14 +70,12 @@ int E_(OpenIntf) ( vlc_object_t *p_this ) ...@@ -70,14 +70,12 @@ int E_(OpenIntf) ( vlc_object_t *p_this )
p_intf->pf_run = Run; p_intf->pf_run = Run;
/* Create the interface window */ /* Create the interface window */
BScreen *screen; BScreen screen(B_MAIN_SCREEN_ID);
screen = new BScreen(); BRect rect = screen.Frame();
BRect rect = screen->Frame();
rect.top = rect.bottom-100; rect.top = rect.bottom-100;
rect.bottom -= 50; rect.bottom -= 50;
rect.left += 50; rect.left += 50;
rect.right = rect.left + 350; rect.right = rect.left + 350;
delete screen;
p_intf->p_sys->p_window = p_intf->p_sys->p_window =
new InterfaceWindow( rect, new InterfaceWindow( rect,
VOUT_TITLE " (BeOS interface)", p_intf ); VOUT_TITLE " (BeOS interface)", p_intf );
......
This diff is collapsed.
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* InterfaceWindow.h: BeOS interface window class prototype * InterfaceWindow.h: BeOS interface window class prototype
***************************************************************************** *****************************************************************************
* Copyright (C) 1999, 2000, 2001 VideoLAN * Copyright (C) 1999, 2000, 2001 VideoLAN
* $Id: InterfaceWindow.h,v 1.10 2003/01/25 20:15:41 titer Exp $ * $Id: InterfaceWindow.h,v 1.11 2003/02/01 12:01:11 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>
...@@ -36,6 +36,7 @@ class PlayListWindow; ...@@ -36,6 +36,7 @@ class PlayListWindow;
class BFilePanel; class BFilePanel;
class PreferencesWindow; class PreferencesWindow;
class MessagesWindow; class MessagesWindow;
class VlcWrapper;
class CDMenu : public BMenu class CDMenu : public BMenu
{ {
...@@ -60,8 +61,6 @@ class LanguageMenu : public BMenu ...@@ -60,8 +61,6 @@ class LanguageMenu : public BMenu
virtual void AttachedToWindow(); virtual void AttachedToWindow();
private: private:
void _GetChannels();
VlcWrapper * p_wrapper; VlcWrapper * p_wrapper;
int kind; int kind;
}; };
...@@ -115,13 +114,16 @@ class InterfaceWindow : public BWindow ...@@ -115,13 +114,16 @@ class InterfaceWindow : public BWindow
bool hasTitles = false ); bool hasTitles = false );
void _UpdateSpeedMenu( int rate ); void _UpdateSpeedMenu( int rate );
void _InputStreamChanged(); void _InputStreamChanged();
void _ShowFilePanel( uint32 command,
const char* windowTitle );
void _RestoreSettings();
void _StoreSettings();
intf_thread_t* p_intf; intf_thread_t* p_intf;
es_descriptor_t* p_spu_es; es_descriptor_t* p_spu_es;
bool fPlaylistIsEmpty; bool fPlaylistIsEmpty;
BFilePanel* fFilePanel; BFilePanel* fFilePanel;
BFilePanel* fSubtitlesPanel;
PlayListWindow* fPlaylistWindow; PlayListWindow* fPlaylistWindow;
PreferencesWindow* fPreferencesWindow; PreferencesWindow* fPreferencesWindow;
MessagesWindow* fMessagesWindow; MessagesWindow* fMessagesWindow;
...@@ -143,8 +145,20 @@ class InterfaceWindow : public BWindow ...@@ -143,8 +145,20 @@ class InterfaceWindow : public BWindow
BMenu* fSpeedMenu; BMenu* fSpeedMenu;
BMenu* fShowMenu; BMenu* fShowMenu;
bigtime_t fLastUpdateTime; bigtime_t fLastUpdateTime;
BMessage* fSettings; // we keep the message arround
VlcWrapper * p_wrapper; // for forward compatibility
VlcWrapper* p_wrapper;
}; };
// some global support functions
status_t load_settings( BMessage* message,
const char* fileName,
const char* folder = NULL );
status_t save_settings( BMessage* message,
const char* fileName,
const char* folder = NULL );
#endif // BEOS_INTERFACE_WINDOW_H #endif // BEOS_INTERFACE_WINDOW_H
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.2 2003/01/22 01:13:22 titer Exp $ * $Id: ListViews.h,v 1.3 2003/02/01 12:01:11 stippi Exp $
* *
* Authors: Stephan Aßmus <stippi@yellowbites.com> * Authors: Stephan Aßmus <stippi@yellowbites.com>
* *
...@@ -73,12 +73,27 @@ class DragSortableListView : public BListView ...@@ -73,12 +73,27 @@ class DragSortableListView : public BListView
bool complete = false); bool complete = false);
// DragSortableListView // DragSortableListView
virtual void ModifiersChanged(); // called by window
virtual void MoveItems( BList& items, int32 toIndex );
virtual void CopyItems( BList& items, int32 toIndex );
virtual void RemoveItemList( BList& indices );
void RemoveSelected(); // uses RemoveItemList()
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,
BRect itemFrame ) const = 0; BRect itemFrame ) const = 0;
virtual void MakeDragMessage( BMessage* message ) const = 0; virtual void MakeDragMessage( BMessage* message ) const = 0;
private: private:
void _SetDropAnticipationRect( BRect r );
void _SetDropIndex( int32 index );
void _RemoveDropAnticipationRect();
BRect fDropRect;
BMessage fDragMessageCopy;
protected:
int32 fDropIndex; int32 fDropIndex;
}; };
...@@ -88,16 +103,23 @@ class PlaylistView : public DragSortableListView ...@@ -88,16 +103,23 @@ class PlaylistView : public DragSortableListView
public: public:
PlaylistView( BRect frame, PlaylistView( BRect frame,
InterfaceWindow* mainWindow, InterfaceWindow* mainWindow,
VlcWrapper * p_wrapper ); VlcWrapper* wrapper,
BMessage* selectionChangeMessage = NULL );
~PlaylistView(); ~PlaylistView();
// BListView // BListView
virtual void AttachedToWindow(); virtual void AttachedToWindow();
virtual void MessageReceived( BMessage* message );
virtual void MouseDown( BPoint where ); virtual void MouseDown( BPoint where );
virtual void KeyDown( const char* bytes, int32 numBytes ); virtual void KeyDown( const char* bytes, int32 numBytes );
virtual void Pulse(); virtual void Pulse();
virtual void SelectionChanged();
// DragSortableListView // DragSortableListView
virtual void MoveItems( BList& items, int32 toIndex );
virtual void CopyItems( BList& items, int32 toIndex );
virtual void RemoveItemList( BList& indices );
virtual BListItem* CloneItem( int32 atIndex ) const; virtual BListItem* CloneItem( int32 atIndex ) const;
virtual void DrawListItem( BView* owner, int32 index, virtual void DrawListItem( BView* owner, int32 index,
BRect itemFrame ) const; BRect itemFrame ) const;
...@@ -106,13 +128,15 @@ class PlaylistView : public DragSortableListView ...@@ -106,13 +128,15 @@ class PlaylistView : public DragSortableListView
// PlaylistView // PlaylistView
void SetCurrent( int32 index ); void SetCurrent( int32 index );
void SetPlaying( bool playing ); void SetPlaying( bool playing );
void RebuildList();
private: private:
int32 fCurrentIndex; int32 fCurrentIndex;
bool fPlaying; bool fPlaying;
InterfaceWindow* fMainWindow; InterfaceWindow* fMainWindow;
BMessage* fSelectionChangeMessage;
VlcWrapper * p_wrapper; VlcWrapper* fVlcWrapper;
}; };
#endif // LIST_VIEWS_H #endif // LIST_VIEWS_H
...@@ -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.13 2003/01/25 01:03:44 titer Exp $ * $Id: MediaControlView.cpp,v 1.14 2003/02/01 12:01:11 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>
...@@ -773,9 +773,11 @@ SeekSlider::ResizeToPreferred() ...@@ -773,9 +773,11 @@ SeekSlider::ResizeToPreferred()
void void
SeekSlider::SetPosition(float position) SeekSlider::SetPosition(float position)
{ {
LockLooper(); if ( LockLooper() )
{
SetValue(fMinValue + (int32)floorf((fMaxValue - fMinValue) * position + 0.5)); SetValue(fMinValue + (int32)floorf((fMaxValue - fMinValue) * position + 0.5));
UnlockLooper(); UnlockLooper();
}
} }
/***************************************************************************** /*****************************************************************************
...@@ -1321,7 +1323,7 @@ PositionInfoView::Pulse() ...@@ -1321,7 +1323,7 @@ PositionInfoView::Pulse()
{ {
int32 index, size; int32 index, size;
p_intf->p_sys->p_wrapper->GetPlaylistInfo( index, size ); p_intf->p_sys->p_wrapper->GetPlaylistInfo( index, size );
SetFile( index, size ); SetFile( index + 1, size );
p_intf->p_sys->p_wrapper->TitleInfo( index, size ); p_intf->p_sys->p_wrapper->TitleInfo( index, size );
SetTitle( index, size ); SetTitle( index, size );
p_intf->p_sys->p_wrapper->ChapterInfo( index, size ); p_intf->p_sys->p_wrapper->ChapterInfo( index, size );
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* MessagesWindow.cpp: beos interface * MessagesWindow.cpp: beos interface
***************************************************************************** *****************************************************************************
* Copyright (C) 1999, 2000, 2001 VideoLAN * Copyright (C) 1999, 2000, 2001 VideoLAN
* $Id: MessagesWindow.cpp,v 1.5 2003/01/31 06:45:00 titer Exp $ * $Id: MessagesWindow.cpp,v 1.6 2003/02/01 12:01:11 stippi Exp $
* *
* Authors: Eric Petit <titer@videolan.org> * Authors: Eric Petit <titer@videolan.org>
* *
...@@ -147,7 +147,8 @@ void MessagesWindow::UpdateMessages() ...@@ -147,7 +147,8 @@ void MessagesWindow::UpdateMessages()
case VLC_OBJECT_SOUT: psz_module_type = "stream output"; break; case VLC_OBJECT_SOUT: psz_module_type = "stream output"; break;
} }
fMessagesView->LockLooper(); if ( fMessagesView->LockLooper() )
{
oldLength = fMessagesView->TextLength(); oldLength = fMessagesView->TextLength();
BString string; BString string;
string << p_sub->p_msg[i_start].psz_module << " " << psz_module_type << " : " << string << p_sub->p_msg[i_start].psz_module << " " << psz_module_type << " : " <<
...@@ -158,6 +159,7 @@ void MessagesWindow::UpdateMessages() ...@@ -158,6 +159,7 @@ void MessagesWindow::UpdateMessages()
NULL, 0, &color ); NULL, 0, &color );
fMessagesView->Draw( fMessagesView->Bounds() ); fMessagesView->Draw( fMessagesView->Bounds() );
fMessagesView->UnlockLooper(); fMessagesView->UnlockLooper();
}
/* Scroll at the end */ /* Scroll at the end */
if( fScrollBar->LockLooper() ) if( fScrollBar->LockLooper() )
......
...@@ -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.6 2003/01/22 01:13:22 titer Exp $ * $Id: PlayListWindow.cpp,v 1.7 2003/02/01 12:01:11 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>
...@@ -50,6 +50,8 @@ enum ...@@ -50,6 +50,8 @@ enum
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',
}; };
...@@ -93,32 +95,33 @@ PlayListWindow::PlayListWindow( BRect frame, const char* name, ...@@ -93,32 +95,33 @@ PlayListWindow::PlayListWindow( BRect frame, const char* name,
// Add the Edit menu // Add the Edit menu
BMenu *editMenu = new BMenu( "Edit" ); BMenu *editMenu = new BMenu( "Edit" );
fMenuBar->AddItem( editMenu ); fMenuBar->AddItem( editMenu );
item = new BMenuItem( "Select All", fSelectAllMI = new BMenuItem( "Select All",
new BMessage( MSG_SELECT_ALL ), 'A' ); new BMessage( MSG_SELECT_ALL ), 'A' );
editMenu->AddItem( item ); editMenu->AddItem( fSelectAllMI );
item = new BMenuItem( "Select None", fSelectNoneMI = new BMenuItem( "Select None",
new BMessage( MSG_SELECT_NONE ), 'A', B_SHIFT_KEY ); new BMessage( MSG_SELECT_NONE ), 'A', B_SHIFT_KEY );
editMenu->AddItem( item ); editMenu->AddItem( fSelectNoneMI );
editMenu->AddSeparatorItem(); editMenu->AddSeparatorItem();
item = new BMenuItem( "Sort by Name", fSortNameMI = new BMenuItem( "Sort by Name",
new BMessage( MSG_SORT_NAME ), 'N' ); new BMessage( MSG_SORT_NAME ), 'N' );
editMenu->AddItem( item ); fSortNameMI->SetEnabled( false );
item = new BMenuItem( "Sort by Path", editMenu->AddItem( fSortNameMI );
fSortPathMI = new BMenuItem( "Sort by Path",
new BMessage( MSG_SORT_PATH ), 'P' ); new BMessage( MSG_SORT_PATH ), 'P' );
editMenu->AddItem( item ); fSortPathMI->SetEnabled( false );
item = new BMenuItem( "Randomize", editMenu->AddItem( fSortPathMI );
fRandomizeMI = new BMenuItem( "Randomize",
new BMessage( MSG_RANDOMIZE ), 'R' ); new BMessage( MSG_RANDOMIZE ), 'R' );
editMenu->AddItem( item ); fRandomizeMI->SetEnabled( false );
editMenu->AddItem( fRandomizeMI );
editMenu->AddSeparatorItem(); editMenu->AddSeparatorItem();
item = new BMenuItem( "Remove", fRemoveMI = new BMenuItem( "Remove",
new BMessage( MSG_REMOVE ) ); new BMessage( MSG_REMOVE ) );
editMenu->AddItem( item ); editMenu->AddItem( fRemoveMI );
item = new BMenuItem( "Remove All", fRemoveAllMI = new BMenuItem( "Remove All",
new BMessage( MSG_REMOVE_ALL ) ); new BMessage( MSG_REMOVE_ALL ) );
editMenu->AddItem( item ); editMenu->AddItem( fRemoveAllMI );
editMenu->SetEnabled( false );
// make menu bar resize to correct height // make menu bar resize to correct height
float menuWidth, menuHeight; float menuWidth, menuHeight;
...@@ -130,7 +133,8 @@ editMenu->SetEnabled( false ); ...@@ -130,7 +133,8 @@ editMenu->SetEnabled( false );
frame.top += fMenuBar->Bounds().IntegerHeight() + 1; frame.top += fMenuBar->Bounds().IntegerHeight() + 1;
frame.right -= B_V_SCROLL_BAR_WIDTH; frame.right -= B_V_SCROLL_BAR_WIDTH;
fListView = new PlaylistView( frame, fMainWindow, p_wrapper ); fListView = new PlaylistView( frame, fMainWindow, p_wrapper,
new BMessage( MSG_SELECTION_CHANGED ) );
fBackgroundView = new BScrollView( "playlist scrollview", fBackgroundView = new BScrollView( "playlist scrollview",
fListView, B_FOLLOW_ALL_SIDES, fListView, B_FOLLOW_ALL_SIDES,
0, false, true, 0, false, true,
...@@ -182,8 +186,10 @@ PlayListWindow::MessageReceived( BMessage * p_message ) ...@@ -182,8 +186,10 @@ PlayListWindow::MessageReceived( BMessage * p_message )
fMainWindow->PostMessage( p_message ); fMainWindow->PostMessage( p_message );
break; break;
case MSG_SELECT_ALL: case MSG_SELECT_ALL:
fListView->Select( 0, fListView->CountItems() - 1 );
break; break;
case MSG_SELECT_NONE: case MSG_SELECT_NONE:
fListView->DeselectAll();
break; break;
case MSG_RANDOMIZE: case MSG_RANDOMIZE:
break; break;
...@@ -192,8 +198,17 @@ PlayListWindow::MessageReceived( BMessage * p_message ) ...@@ -192,8 +198,17 @@ PlayListWindow::MessageReceived( BMessage * p_message )
case MSG_SORT_PATH: case MSG_SORT_PATH:
break; break;
case MSG_REMOVE: case MSG_REMOVE:
fListView->RemoveSelected();
break; break;
case MSG_REMOVE_ALL: case MSG_REMOVE_ALL:
fListView->Select( 0, fListView->CountItems() - 1 );
fListView->RemoveSelected();
break;
case MSG_SELECTION_CHANGED:
_CheckItemsEnableState();
break;
case B_MODIFIERS_CHANGED:
fListView->ModifiersChanged();
break; break;
default: default:
BWindow::MessageReceived( p_message ); BWindow::MessageReceived( p_message );
...@@ -235,16 +250,42 @@ void ...@@ -235,16 +250,42 @@ void
PlayListWindow::UpdatePlaylist( bool rebuild ) PlayListWindow::UpdatePlaylist( bool rebuild )
{ {
if ( rebuild ) if ( rebuild )
{ fListView->RebuildList();
// remove all items
int32 count = fListView->CountItems();
while ( BListItem* item = fListView->RemoveItem( --count ) )
delete item;
// rebuild listview from VLC's playlist
for ( int i = 0; i < p_wrapper->PlaylistSize(); i++ )
fListView->AddItem( new PlaylistItem( p_wrapper->PlaylistItemName( i ) ) );
}
fListView->SetCurrent( p_wrapper->PlaylistCurrent() ); fListView->SetCurrent( p_wrapper->PlaylistCurrent() );
fListView->SetPlaying( p_wrapper->IsPlaying() ); fListView->SetPlaying( p_wrapper->IsPlaying() );
_CheckItemsEnableState();
}
/*****************************************************************************
* PlayListWindow::_CheckItemsEnableState
*****************************************************************************/
void
PlayListWindow::_CheckItemsEnableState() const
{
// check if one item selected
int32 test = fListView->CurrentSelection( 0 );
bool enable1 = test >= 0;
// check if at least two items selected
// test = fListView->CurrentSelection( 1 );
// bool enable2 = test >= 0;
bool notEmpty = fListView->CountItems() > 0;
_SetMenuItemEnabled( fSelectAllMI, notEmpty );
_SetMenuItemEnabled( fSelectNoneMI, enable1 );
// _SetMenuItemEnabled( fSortNameMI, enable2 );
// _SetMenuItemEnabled( fSortPathMI, enable2 );
// _SetMenuItemEnabled( fRandomizeMI, enable2 );
_SetMenuItemEnabled( fRemoveMI, enable1 );
_SetMenuItemEnabled( fRemoveAllMI, notEmpty );
}
/*****************************************************************************
* PlayListWindow::_SetMenuItemEnabled
*****************************************************************************/
void
PlayListWindow::_SetMenuItemEnabled( BMenuItem* item, bool enabled ) const
{
// this check should actally be done in BMenuItem::SetEnabled(), but it is not...
if ( item->IsEnabled() != enabled )
item->SetEnabled( enabled );
} }
...@@ -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.5 2002/11/27 05:36:41 titer Exp $ * $Id: PlayListWindow.h,v 1.6 2003/02/01 12:01:11 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>
...@@ -29,8 +29,7 @@ ...@@ -29,8 +29,7 @@
#include <Window.h> #include <Window.h>
class BListView; class BMenuItem;
class CDMenu;
class InterfaceWindow; class InterfaceWindow;
class PlaylistView; class PlaylistView;
...@@ -53,11 +52,23 @@ class PlayListWindow : public BWindow ...@@ -53,11 +52,23 @@ class PlayListWindow : public BWindow
void UpdatePlaylist( bool rebuild = false ); void UpdatePlaylist( bool rebuild = false );
private: private:
void _CheckItemsEnableState() const;
void _SetMenuItemEnabled( BMenuItem* item,
bool enabled ) const;
PlaylistView * fListView; PlaylistView * fListView;
BView * fBackgroundView; BView * fBackgroundView;
BMenuBar * fMenuBar; BMenuBar * fMenuBar;
InterfaceWindow * fMainWindow; InterfaceWindow * fMainWindow;
BMenuItem* fSelectAllMI;
BMenuItem* fSelectNoneMI;
BMenuItem* fSortNameMI;
BMenuItem* fSortPathMI;
BMenuItem* fRandomizeMI;
BMenuItem* fRemoveMI;
BMenuItem* fRemoveAllMI;
intf_thread_t * p_intf; intf_thread_t * p_intf;
VlcWrapper * p_wrapper; VlcWrapper * p_wrapper;
}; };
......
This diff is collapsed.
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* VideoWindow.h: BeOS video window class prototype * VideoWindow.h: BeOS video window class prototype
***************************************************************************** *****************************************************************************
* Copyright (C) 1999, 2000, 2001 VideoLAN * Copyright (C) 1999, 2000, 2001 VideoLAN
* $Id: VideoWindow.h,v 1.5 2002/12/07 22:00:36 titer Exp $ * $Id: VideoWindow.h,v 1.6 2003/02/01 12:01:11 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>
...@@ -55,6 +55,54 @@ colorcombo colspace[]= ...@@ -55,6 +55,54 @@ colorcombo colspace[]=
#define COLOR_COUNT 5 #define COLOR_COUNT 5
#define DEFAULT_COL 3 #define DEFAULT_COL 3
class VideoSettings
{
public:
VideoSettings( const VideoSettings& clone );
virtual ~VideoSettings();
static VideoSettings* DefaultSettings();
enum
{
SIZE_OTHER = 0,
SIZE_50 = 1,
SIZE_100 = 2,
SIZE_200 = 3,
};
void SetVideoSize( uint32 mode );
inline uint32 VideoSize() const
{ return fVideoSize; }
enum
{
FLAG_CORRECT_RATIO = 0x0001,
FLAG_SYNC_RETRACE = 0x0002,
FLAG_ON_TOP_ALL = 0x0004,
FLAG_FULL_SCREEN = 0x0008,
};
inline void SetFlags( uint32 flags )
{ fFlags = flags; }
inline void AddFlags( uint32 flags )
{ fFlags |= flags; }
inline void ClearFlags( uint32 flags )
{ fFlags &= ~flags; }
inline bool HasFlags( uint32 flags ) const
{ return fFlags & flags; }
inline uint32 Flags() const
{ return fFlags; }
private:
VideoSettings(); // reserved for default settings
static VideoSettings fDefaultSettings;
uint32 fVideoSize;
uint32 fFlags;
BMessage* fSettings;
};
class VLCView : public BView class VLCView : public BView
{ {
...@@ -107,8 +155,14 @@ public: ...@@ -107,8 +155,14 @@ public:
void SetInterfaceShowing(bool showIt); void SetInterfaceShowing(bool showIt);
void SetCorrectAspectRatio(bool doIt); void SetCorrectAspectRatio(bool doIt);
inline bool CorrectAspectRatio() const bool CorrectAspectRatio() const;
{ return fCorrectAspect; } void ToggleFullScreen();
void SetFullScreen(bool doIt);
bool IsFullScreen() const;
void SetOnTop(bool doIt);
bool IsOnTop() const;
void SetSyncToRetrace(bool doIt);
bool IsSyncedToRetrace() const;
inline status_t InitCheck() const inline status_t InitCheck() const
{ return fInitStatus; } { return fInitStatus; }
...@@ -117,9 +171,8 @@ public: ...@@ -117,9 +171,8 @@ public:
int32 i_width; // aspect corrected bitmap size int32 i_width; // aspect corrected bitmap size
int32 i_height; int32 i_height;
BRect winSize; // current window size BRect winSize; // current window size
bool is_zoomed, vsync;
BBitmap *bitmap[3]; BBitmap *bitmap[3];
BBitmap *overlaybitmap; // BBitmap *overlaybitmap;
VLCView *view; VLCView *view;
int i_buffer; int i_buffer;
volatile bool teardownwindow; volatile bool teardownwindow;
...@@ -134,6 +187,7 @@ private: ...@@ -134,6 +187,7 @@ private:
void _FreeBuffers(); void _FreeBuffers();
void _BlankBitmap(BBitmap* bitmap) const; void _BlankBitmap(BBitmap* bitmap) const;
void _SetVideoSize(uint32 mode); void _SetVideoSize(uint32 mode);
void _SetToSettings();
void _SaveScreenShot( BBitmap* bitmap, void _SaveScreenShot( BBitmap* bitmap,
char* path, char* path,
...@@ -153,10 +207,10 @@ private: ...@@ -153,10 +207,10 @@ private:
int32 fTrueWidth; // incomming bitmap size int32 fTrueWidth; // incomming bitmap size
int32 fTrueHeight; int32 fTrueHeight;
bool fCorrectAspect;
window_feel fCachedFeel; window_feel fCachedFeel;
bool fInterfaceShowing; bool fInterfaceShowing;
status_t fInitStatus; status_t fInitStatus;
VideoSettings* fSettings;
}; };
#endif // BEOS_VIDEO_WINDOW_H #endif // BEOS_VIDEO_WINDOW_H
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* VlcWrapper.cpp: BeOS plugin for vlc (derived from MacOS X port) * VlcWrapper.cpp: BeOS plugin for vlc (derived from MacOS X port)
***************************************************************************** *****************************************************************************
* Copyright (C) 2001 VideoLAN * Copyright (C) 2001 VideoLAN
* $Id: VlcWrapper.cpp,v 1.23 2003/01/29 00:02:09 titer Exp $ * $Id: VlcWrapper.cpp,v 1.24 2003/02/01 12:01:11 stippi Exp $
* *
* Authors: Florian G. Pflug <fgp@phlo.org> * Authors: Florian G. Pflug <fgp@phlo.org>
* Jon Lech Johansen <jon-vl@nanocrew.net> * Jon Lech Johansen <jon-vl@nanocrew.net>
...@@ -358,11 +358,15 @@ bool VlcWrapper::IsPlaying() ...@@ -358,11 +358,15 @@ bool VlcWrapper::IsPlaying()
* playlist * * playlist *
************/ ************/
void VlcWrapper::OpenFiles( BList* o_files, bool replace ) void VlcWrapper::OpenFiles( BList* o_files, bool replace, int32 index )
{ {
BString *o_file; if ( o_files && o_files->CountItems() > 0)
{
int size = PlaylistSize(); int size = PlaylistSize();
bool wasEmpty = ( size < 1 ); bool wasEmpty = ( size < 1 );
if ( index == -1 )
index = PLAYLIST_END;
int mode = index == PLAYLIST_END ? PLAYLIST_APPEND : PLAYLIST_INSERT;
/* delete current playlist */ /* delete current playlist */
if( replace ) if( replace )
...@@ -373,20 +377,28 @@ void VlcWrapper::OpenFiles( BList* o_files, bool replace ) ...@@ -373,20 +377,28 @@ void VlcWrapper::OpenFiles( BList* o_files, bool replace )
} }
} }
/* append files */ /* insert files */
while( ( o_file = (BString *)o_files->LastItem() ) ) int32 count = o_files->CountItems();
for ( int32 i = count - 1; i >= 0; i-- )
{
if ( BString* o_file = (BString *)o_files->RemoveItem( i ) )
{ {
playlist_Add( p_playlist, o_file->String(), playlist_Add( p_playlist, o_file->String(),
PLAYLIST_APPEND, PLAYLIST_END ); mode, index );
o_files->RemoveItem(o_files->CountItems() - 1); if ( mode == PLAYLIST_INSERT )
index++;
delete o_file;
} }
}
// TODO: implement a user setting
// if to start automatically
/* eventually restart playing */ /* eventually restart playing */
if( replace || wasEmpty ) if( replace || wasEmpty )
{ {
playlist_Stop( p_playlist ); playlist_Stop( p_playlist );
playlist_Play( p_playlist ); playlist_Play( p_playlist );
} }
}
} }
void VlcWrapper::OpenDisc(BString o_type, BString o_device, int i_title, int i_chapter) void VlcWrapper::OpenDisc(BString o_type, BString o_device, int i_title, int i_chapter)
...@@ -455,11 +467,15 @@ void VlcWrapper::GetPlaylistInfo( int32& currentIndex, int32& maxIndex ) ...@@ -455,11 +467,15 @@ void VlcWrapper::GetPlaylistInfo( int32& currentIndex, int32& maxIndex )
maxIndex = -1; maxIndex = -1;
if ( p_playlist ) if ( p_playlist )
{ {
vlc_mutex_lock( &p_playlist->object_lock );
maxIndex = p_playlist->i_size; maxIndex = p_playlist->i_size;
if ( maxIndex > 0 ) if ( maxIndex > 0 )
currentIndex = p_playlist->i_index + 1; currentIndex = p_playlist->i_index/* + 1 -> why?!?*/;
else else
maxIndex = -1; maxIndex = -1;
vlc_mutex_unlock( &p_playlist->object_lock );
} }
} }
...@@ -611,6 +627,131 @@ void VlcWrapper::NavigateNext() ...@@ -611,6 +627,131 @@ void VlcWrapper::NavigateNext()
PlaylistNext(); PlaylistNext();
} }
/*************************
* Playlist manipulation *
*************************/
// PlaylistLock
bool
VlcWrapper::PlaylistLock() const
{
// TODO: search and destroy -> deadlock!
return true;
if ( p_playlist )
{
vlc_mutex_lock( &p_playlist->object_lock );
return true;
}
return false;
}
// PlaylistUnlock
void
VlcWrapper::PlaylistUnlock() const
{
// TODO: search and destroy -> deadlock!
return;
vlc_mutex_unlock( &p_playlist->object_lock );
}
// PlaylistItemAt
void*
VlcWrapper::PlaylistItemAt( int index ) const
{
playlist_item_t* item = NULL;
if ( index >= 0 && index < p_playlist->i_size )
item = p_playlist->pp_items[index];
return (void*)item;
}
// PlaylistRemoveItem
void*
VlcWrapper::PlaylistRemoveItem( int index ) const
{
playlist_item_t* copy = NULL;
// check if item exists at the provided index
if ( index >= 0 && index < p_playlist->i_size )
{
playlist_item_t* item = p_playlist->pp_items[index];
if ( item )
{
// make a copy of the removed item
copy = (playlist_item_t*)PlaylistCloneItem( (void*)item );
// remove item from playlist (unfortunately, this frees it)
playlist_Delete( p_playlist, index );
}
}
return (void*)copy;
}
// PlaylistRemoveItem
void*
VlcWrapper::PlaylistRemoveItem( void* item ) const
{
playlist_item_t* copy = NULL;
for ( int32 i = 0; i < p_playlist->i_size; i++ )
{
if ( p_playlist->pp_items[i] == item )
{
copy = (playlist_item_t*)PlaylistRemoveItem( i );
break;
}
}
return (void*)copy;
}
// PlaylistAddItem
bool
VlcWrapper::PlaylistAddItem( void* item, int index ) const
{
if ( item )
{
playlist_AddItem( p_playlist, (playlist_item_t*)item,
PLAYLIST_INSERT, index );
}
// TODO: once playlist is returning useful info, return that instead
return true;
}
// PlaylistCloneItem
void*
VlcWrapper::PlaylistCloneItem( void* castToItem ) const
{
playlist_item_t* copy = NULL;
playlist_item_t* item = (playlist_item_t*)castToItem;
if ( item )
{
copy = (playlist_item_t*)malloc( sizeof( playlist_item_t ) );
if ( copy )
{
// make a copy of the item at index
copy->psz_name = strdup( item->psz_name );
copy->psz_uri = strdup( item->psz_uri );
copy->i_type = item->i_type;
copy->i_status = item->i_status;
copy->b_autodeletion = item->b_autodeletion;
}
}
return (void*)copy;
}
// Careful! You need to know what you're doing here!
// The reason for having it, is to be able to deal with
// the rather lame list implementation of the playlist.
// It is meant to help manipulate the playlist with the above
// methods while keeping it valid.
//
// PlaylistSetPlaying
void
VlcWrapper::PlaylistSetPlaying( int index ) const
{
if ( index < 0 )
index = 0;
if ( index >= p_playlist->i_size )
index = p_playlist->i_size - 1;
p_playlist->i_index = index;
}
/********* /*********
* audio * * audio *
...@@ -853,7 +994,7 @@ void VlcWrapper::ChapterInfo( int32 &currentIndex, int32 &maxIndex ) ...@@ -853,7 +994,7 @@ void VlcWrapper::ChapterInfo( int32 &currentIndex, int32 &maxIndex )
* Miscellanous * * Miscellanous *
****************/ ****************/
void VlcWrapper::LoadSubFile( char * psz_file ) void VlcWrapper::LoadSubFile( const char * psz_file )
{ {
config_PutPsz( p_intf, "sub-file", strdup( psz_file ) ); config_PutPsz( p_intf, "sub-file", strdup( psz_file ) );
} }
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* VlcWrapper.h: BeOS plugin for vlc (derived from MacOS X port) * VlcWrapper.h: BeOS plugin for vlc (derived from MacOS X port)
***************************************************************************** *****************************************************************************
* Copyright (C) 2001 VideoLAN * Copyright (C) 2001 VideoLAN
* $Id: VlcWrapper.h,v 1.18 2003/01/29 00:02:09 titer Exp $ * $Id: VlcWrapper.h,v 1.19 2003/02/01 12:01:11 stippi Exp $
* *
* Authors: Florian G. Pflug <fgp@phlo.org> * Authors: Florian G. Pflug <fgp@phlo.org>
* Jon Lech Johansen <jon-vl@nanocrew.net> * Jon Lech Johansen <jon-vl@nanocrew.net>
...@@ -79,7 +79,8 @@ public: ...@@ -79,7 +79,8 @@ public:
bool IsPlaying(); bool IsPlaying();
/* Playlist */ /* Playlist */
void OpenFiles( BList *o_files, bool replace = true ); void OpenFiles( BList *o_files, bool replace = true,
int32 index = -1 );
void OpenDisc( BString o_type, BString o_device, void OpenDisc( BString o_type, BString o_device,
int i_title, int i_chapter ); int i_title, int i_chapter );
int PlaylistSize(); int PlaylistSize();
...@@ -99,6 +100,21 @@ public: ...@@ -99,6 +100,21 @@ public:
void NavigatePrev(); void NavigatePrev();
void NavigateNext(); void NavigateNext();
/* Playlist manipulation */
bool PlaylistLock() const;
void PlaylistUnlock() const;
// playlist must be locked prior to calling all of these!
void* PlaylistItemAt( int index ) const;
// both functions return a copy of the removed item
// so that it can be added at another index
void* PlaylistRemoveItem( int index ) const;
void* PlaylistRemoveItem( void* item ) const;
// uses playlist_AddItem()
bool PlaylistAddItem( void* item, int index ) const;
void* PlaylistCloneItem( void* item ) const;
// only modifies playlist, doesn't effect playback
void PlaylistSetPlaying( int index ) const;
/* Audio */ /* Audio */
bool HasAudio(); bool HasAudio();
unsigned short GetVolume(); unsigned short GetVolume();
...@@ -123,7 +139,7 @@ public: ...@@ -123,7 +139,7 @@ public:
void ChapterInfo( int32& currentIndex, int32& maxIndex ); void ChapterInfo( int32& currentIndex, int32& maxIndex );
/* Miscellanous */ /* Miscellanous */
void LoadSubFile( char * psz_file ); void LoadSubFile( const char * psz_file );
void FilterChange(); void FilterChange();
private: private:
......
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