Commit 02d360bd authored by Eric Petit's avatar Eric Petit

Added a window to see vlc messages.

parent 160a693d
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* beos.cpp : BeOS plugin for vlc * beos.cpp : BeOS plugin for vlc
***************************************************************************** *****************************************************************************
* Copyright (C) 2000, 2001 VideoLAN * Copyright (C) 2000, 2001 VideoLAN
* $Id: BeOS.cpp,v 1.3 2003/01/25 01:03:44 titer Exp $ * $Id: BeOS.cpp,v 1.4 2003/01/25 20:15:41 titer 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>
...@@ -59,6 +59,7 @@ vlc_module_begin(); ...@@ -59,6 +59,7 @@ vlc_module_begin();
add_integer( "beos-playlist-xpos", 0, NULL, "", "" ); add_integer( "beos-playlist-xpos", 0, NULL, "", "" );
add_integer( "beos-playlist-ypos", 0, NULL, "", "" ); add_integer( "beos-playlist-ypos", 0, NULL, "", "" );
add_bool( "beos-playlist-show", 0, NULL, "", "" ); add_bool( "beos-playlist-show", 0, NULL, "", "" );
add_bool( "beos-messages-show", 0, NULL, "", "" );
add_submodule(); add_submodule();
set_capability( "video output", 100 ); set_capability( "video output", 100 );
set_callbacks( E_(OpenVideo), E_(CloseVideo) ); set_callbacks( E_(OpenVideo), E_(CloseVideo) );
......
...@@ -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.7 2002/12/09 13:37:38 titer Exp $ * $Id: Interface.cpp,v 1.8 2003/01/25 20:15:41 titer 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>
...@@ -55,15 +55,7 @@ static void Run ( intf_thread_t *p_intf ); ...@@ -55,15 +55,7 @@ static void Run ( intf_thread_t *p_intf );
*****************************************************************************/ *****************************************************************************/
int E_(OpenIntf) ( vlc_object_t *p_this ) int E_(OpenIntf) ( vlc_object_t *p_this )
{ {
intf_thread_t *p_intf = (intf_thread_t*) p_this; intf_thread_t * p_intf = (intf_thread_t*) p_this;
BScreen *screen;
screen = new BScreen();
BRect rect = screen->Frame();
rect.top = rect.bottom-100;
rect.bottom -= 50;
rect.left += 50;
rect.right = rect.left + 350;
delete screen;
/* Allocate instance and initialize some members */ /* Allocate instance and initialize some members */
p_intf->p_sys = (intf_sys_t*) malloc( sizeof( intf_sys_t ) ); p_intf->p_sys = (intf_sys_t*) malloc( sizeof( intf_sys_t ) );
...@@ -73,11 +65,19 @@ int E_(OpenIntf) ( vlc_object_t *p_this ) ...@@ -73,11 +65,19 @@ int E_(OpenIntf) ( vlc_object_t *p_this )
return( 1 ); return( 1 );
} }
p_intf->p_sys->p_sub = msg_Subscribe( p_intf );
p_intf->p_sys->p_wrapper = new VlcWrapper( p_intf ); p_intf->p_sys->p_wrapper = new VlcWrapper( p_intf );
p_intf->pf_run = Run; p_intf->pf_run = Run;
/* Create the interface window */ /* Create the interface window */
BScreen *screen;
screen = new BScreen();
BRect rect = screen->Frame();
rect.top = rect.bottom-100;
rect.bottom -= 50;
rect.left += 50;
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 );
...@@ -87,9 +87,9 @@ int E_(OpenIntf) ( vlc_object_t *p_this ) ...@@ -87,9 +87,9 @@ int E_(OpenIntf) ( vlc_object_t *p_this )
msg_Err( p_intf, "cannot allocate InterfaceWindow" ); msg_Err( p_intf, "cannot allocate InterfaceWindow" );
return( 1 ); return( 1 );
} else { } else {
BMessage message(INTERFACE_CREATED); BMessage message(INTERFACE_CREATED);
message.AddPointer("window", p_intf->p_sys->p_window); message.AddPointer("window", p_intf->p_sys->p_window);
be_app->PostMessage(&message); be_app->PostMessage(&message);
} }
p_intf->p_sys->i_saved_volume = AOUT_VOLUME_DEFAULT; p_intf->p_sys->i_saved_volume = AOUT_VOLUME_DEFAULT;
p_intf->p_sys->b_loop = 0; p_intf->p_sys->b_loop = 0;
...@@ -104,6 +104,8 @@ int E_(OpenIntf) ( vlc_object_t *p_this ) ...@@ -104,6 +104,8 @@ int E_(OpenIntf) ( vlc_object_t *p_this )
void E_(CloseIntf) ( vlc_object_t *p_this ) void E_(CloseIntf) ( vlc_object_t *p_this )
{ {
intf_thread_t *p_intf = (intf_thread_t*) p_this; intf_thread_t *p_intf = (intf_thread_t*) p_this;
msg_Unsubscribe( p_intf, p_intf->p_sys->p_sub );
/* Destroy the interface window */ /* Destroy the interface window */
p_intf->p_sys->p_window->Lock(); p_intf->p_sys->p_window->Lock();
...@@ -125,7 +127,7 @@ static void Run( intf_thread_t *p_intf ) ...@@ -125,7 +127,7 @@ static void Run( intf_thread_t *p_intf )
if( p_intf->p_sys->p_wrapper->UpdateInputAndAOut() ) if( p_intf->p_sys->p_wrapper->UpdateInputAndAOut() )
{ {
/* Manage the slider */ /* Manage the slider */
p_intf->p_sys->p_window->updateInterface(); p_intf->p_sys->p_window->UpdateInterface();
} }
/* Wait a bit */ /* Wait a bit */
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* InterfaceWindow.cpp: beos interface * InterfaceWindow.cpp: beos interface
***************************************************************************** *****************************************************************************
* Copyright (C) 1999, 2000, 2001 VideoLAN * Copyright (C) 1999, 2000, 2001 VideoLAN
* $Id: InterfaceWindow.cpp,v 1.21 2003/01/25 01:03:44 titer Exp $ * $Id: InterfaceWindow.cpp,v 1.22 2003/01/25 20:15:41 titer 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>
...@@ -48,6 +48,7 @@ ...@@ -48,6 +48,7 @@
#include "MediaControlView.h" #include "MediaControlView.h"
#include "PlayListWindow.h" #include "PlayListWindow.h"
#include "PreferencesWindow.h" #include "PreferencesWindow.h"
#include "MessagesWindow.h"
#include "InterfaceWindow.h" #include "InterfaceWindow.h"
#define INTERFACE_UPDATE_TIMEOUT 80000 // 2 frames if at 25 fps #define INTERFACE_UPDATE_TIMEOUT 80000 // 2 frames if at 25 fps
...@@ -58,13 +59,13 @@ ...@@ -58,13 +59,13 @@
*****************************************************************************/ *****************************************************************************/
InterfaceWindow::InterfaceWindow( BRect frame, const char *name, InterfaceWindow::InterfaceWindow( BRect frame, const char *name,
intf_thread_t *p_interface ) intf_thread_t *p_interface )
: BWindow( frame, name, B_TITLED_WINDOW_LOOK, B_NORMAL_WINDOW_FEEL, : BWindow( frame, name, B_TITLED_WINDOW_LOOK, B_NORMAL_WINDOW_FEEL,
B_NOT_ZOOMABLE | B_WILL_ACCEPT_FIRST_CLICK | B_ASYNCHRONOUS_CONTROLS ), B_NOT_ZOOMABLE | B_WILL_ACCEPT_FIRST_CLICK | B_ASYNCHRONOUS_CONTROLS ),
p_intf( p_interface ), p_intf( p_interface ),
fFilePanel( NULL ), fFilePanel( NULL ),
fSubtitlesPanel( NULL ), fSubtitlesPanel( NULL ),
fLastUpdateTime( system_time() ) fLastUpdateTime( system_time() )
{ {
p_intf = p_interface; p_intf = p_interface;
p_wrapper = p_intf->p_sys->p_wrapper; p_wrapper = p_intf->p_sys->p_wrapper;
...@@ -72,10 +73,6 @@ InterfaceWindow::InterfaceWindow( BRect frame, const char *name, ...@@ -72,10 +73,6 @@ InterfaceWindow::InterfaceWindow( BRect frame, const char *name,
fPlaylistIsEmpty = !( p_wrapper->PlaylistSize() > 0 ); fPlaylistIsEmpty = !( p_wrapper->PlaylistSize() > 0 );
fPlaylistWindow = new PlayListWindow( BRect( 100.0, 100.0, 400.0, 350.0 ),
"Playlist",
this,
p_intf );
BScreen *p_screen = new BScreen(); BScreen *p_screen = new BScreen();
BRect screen_rect = p_screen->Frame(); BRect screen_rect = p_screen->Frame();
delete p_screen; delete p_screen;
...@@ -84,106 +81,114 @@ InterfaceWindow::InterfaceWindow( BRect frame, const char *name, ...@@ -84,106 +81,114 @@ InterfaceWindow::InterfaceWindow( BRect frame, const char *name,
( screen_rect.bottom - PREFS_WINDOW_HEIGHT ) / 2, ( screen_rect.bottom - PREFS_WINDOW_HEIGHT ) / 2,
( screen_rect.right + PREFS_WINDOW_WIDTH ) / 2, ( screen_rect.right + PREFS_WINDOW_WIDTH ) / 2,
( screen_rect.bottom + PREFS_WINDOW_HEIGHT ) / 2 ); ( screen_rect.bottom + PREFS_WINDOW_HEIGHT ) / 2 );
fPreferencesWindow = new PreferencesWindow( window_rect, fPreferencesWindow = new PreferencesWindow( p_intf, window_rect, "Preferences" );
"Preferences", window_rect.Set( screen_rect.right - 500,
p_intf ); screen_rect.top + 50,
screen_rect.right - 150,
screen_rect.top + 250 );
fPlaylistWindow = new PlayListWindow( window_rect, "Playlist", this, p_intf );
window_rect.Set( screen_rect.right - 500,
screen_rect.top + 300,
screen_rect.right - 150,
screen_rect.top + 600 );
fMessagesWindow = new MessagesWindow( p_intf, window_rect, "Messages" );
// set the title bar
SetName( "interface" );
SetTitle( VOUT_TITLE );
// the media control view
p_mediaControl = new MediaControlView( BRect( 0.0, 0.0, 250.0, 50.0 ),
p_intf );
p_mediaControl->SetViewColor( ui_color( B_PANEL_BACKGROUND_COLOR ) );
float width, height;
p_mediaControl->GetPreferredSize( &width, &height );
// set up the main menu
fMenuBar = new BMenuBar( BRect(0.0, 0.0, width, 15.0), "main menu",
B_FOLLOW_NONE, B_ITEMS_IN_ROW, false );
// make menu bar resize to correct height
float menuWidth, menuHeight;
fMenuBar->GetPreferredSize( &menuWidth, &menuHeight );
fMenuBar->ResizeTo( width, menuHeight ); // don't change! it's a workarround!
// take care of proper size for ourself
height += fMenuBar->Bounds().Height();
ResizeTo( width, height );
p_mediaControl->MoveTo( fMenuBar->Bounds().LeftBottom() + BPoint(0.0, 1.0) );
AddChild( fMenuBar );
AddChild( p_mediaControl );
// Add the file Menu
BMenu* fileMenu = new BMenu( "File" );
fMenuBar->AddItem( fileMenu );
fileMenu->AddItem( new BMenuItem( "Open File" B_UTF8_ELLIPSIS,
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();
BMenuItem* item = new BMenuItem( "About" B_UTF8_ELLIPSIS,
new BMessage( B_ABOUT_REQUESTED ), 'A');
item->SetTarget( be_app );
fileMenu->AddItem( item );
fileMenu->AddItem( new BMenuItem( "Quit", new BMessage( B_QUIT_REQUESTED ), 'Q') );
fLanguageMenu = new LanguageMenu("Language", AUDIO_ES, p_wrapper);
fSubtitlesMenu = new LanguageMenu("Subtitles", SPU_ES, p_wrapper);
/* Add the Audio menu */
fAudioMenu = new BMenu( "Audio" );
fMenuBar->AddItem ( fAudioMenu );
fAudioMenu->AddItem( fLanguageMenu );
fAudioMenu->AddItem( fSubtitlesMenu );
fPrevTitleMI = new BMenuItem( "Prev Title", new BMessage( PREV_TITLE ) );
fNextTitleMI = new BMenuItem( "Next Title", new BMessage( NEXT_TITLE ) );
fPrevChapterMI = new BMenuItem( "Prev Chapter", new BMessage( PREV_CHAPTER ) );
fNextChapterMI = new BMenuItem( "Next Chapter", new BMessage( NEXT_CHAPTER ) );
/* Add the Navigation menu */
fNavigationMenu = new BMenu( "Navigation" );
fMenuBar->AddItem( fNavigationMenu );
fNavigationMenu->AddItem( fPrevTitleMI );
fNavigationMenu->AddItem( fNextTitleMI );
fNavigationMenu->AddItem( fTitleMenu = new TitleMenu( "Go to Title", p_intf ) );
fNavigationMenu->AddSeparatorItem();
fNavigationMenu->AddItem( fPrevChapterMI );
fNavigationMenu->AddItem( fNextChapterMI );
fNavigationMenu->AddItem( fChapterMenu = new ChapterMenu( "Go to Chapter", p_intf ) );
/* Add the Speed menu */
fSpeedMenu = new BMenu( "Speed" );
fSpeedMenu->SetRadioMode( true );
fSpeedMenu->AddItem( fSlowerMI = new BMenuItem( "Slower", new BMessage( SLOWER_PLAY ) ) );
fNormalMI = new BMenuItem( "Normal", new BMessage( NORMAL_PLAY ) );
fNormalMI->SetMarked(true); // default to normal speed
fSpeedMenu->AddItem( fNormalMI );
fSpeedMenu->AddItem( fFasterMI = new BMenuItem( "Faster", new BMessage( FASTER_PLAY) ) );
fSpeedMenu->SetTargetForItems( this );
fMenuBar->AddItem( fSpeedMenu );
/* Add the Show menu */
fShowMenu = new BMenu( "Show" );
fShowMenu->AddItem( new BMenuItem( "Play List" B_UTF8_ELLIPSIS,
new BMessage( OPEN_PLAYLIST ), 'P') );
fShowMenu->AddItem( new BMenuItem( "Messages" B_UTF8_ELLIPSIS,
new BMessage( OPEN_MESSAGES ), 'M' ) );
fShowMenu->AddItem( new BMenuItem( "Settings" B_UTF8_ELLIPSIS,
new BMessage( OPEN_PREFERENCES ), 'S' ) );
fMenuBar->AddItem( fShowMenu );
/* Prepare fow showing */
_SetMenusEnabled( false );
p_mediaControl->SetEnabled( false );
// set the title bar
SetName( "interface" );
SetTitle( VOUT_TITLE );
// the media control view
p_mediaControl = new MediaControlView( BRect( 0.0, 0.0, 250.0, 50.0 ),
p_intf );
p_mediaControl->SetViewColor( ui_color( B_PANEL_BACKGROUND_COLOR ) );
float width, height;
p_mediaControl->GetPreferredSize( &width, &height );
// set up the main menu
fMenuBar = new BMenuBar( BRect(0.0, 0.0, width, 15.0), "main menu",
B_FOLLOW_NONE, B_ITEMS_IN_ROW, false );
// make menu bar resize to correct height
float menuWidth, menuHeight;
fMenuBar->GetPreferredSize( &menuWidth, &menuHeight );
fMenuBar->ResizeTo( width, menuHeight ); // don't change! it's a workarround!
// take care of proper size for ourself
height += fMenuBar->Bounds().Height();
ResizeTo( width, height );
p_mediaControl->MoveTo( fMenuBar->Bounds().LeftBottom() + BPoint(0.0, 1.0) );
AddChild( fMenuBar );
AddChild( p_mediaControl );
// Add the file Menu
BMenu* fileMenu = new BMenu( "File" );
fMenuBar->AddItem( fileMenu );
fileMenu->AddItem( new BMenuItem( "Open File" B_UTF8_ELLIPSIS,
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,
new BMessage( OPEN_PLAYLIST ), 'P') );
fileMenu->AddSeparatorItem();
BMenuItem* item = new BMenuItem( "About" B_UTF8_ELLIPSIS,
new BMessage( B_ABOUT_REQUESTED ), 'A');
item->SetTarget( be_app );
fileMenu->AddItem( item );
fileMenu->AddItem( new BMenuItem( "Quit", new BMessage( B_QUIT_REQUESTED ), 'Q') );
fLanguageMenu = new LanguageMenu("Language", AUDIO_ES, p_wrapper);
fSubtitlesMenu = new LanguageMenu("Subtitles", SPU_ES, p_wrapper);
/* Add the Audio menu */
fAudioMenu = new BMenu( "Audio" );
fMenuBar->AddItem ( fAudioMenu );
fAudioMenu->AddItem( fLanguageMenu );
fAudioMenu->AddItem( fSubtitlesMenu );
fPrevTitleMI = new BMenuItem( "Prev Title", new BMessage( PREV_TITLE ) );
fNextTitleMI = new BMenuItem( "Next Title", new BMessage( NEXT_TITLE ) );
fPrevChapterMI = new BMenuItem( "Prev Chapter", new BMessage( PREV_CHAPTER ) );
fNextChapterMI = new BMenuItem( "Next Chapter", new BMessage( NEXT_CHAPTER ) );
/* Add the Navigation menu */
fNavigationMenu = new BMenu( "Navigation" );
fMenuBar->AddItem( fNavigationMenu );
fNavigationMenu->AddItem( fPrevTitleMI );
fNavigationMenu->AddItem( fNextTitleMI );
fNavigationMenu->AddItem( fTitleMenu = new TitleMenu( "Go to Title", p_intf ) );
fNavigationMenu->AddSeparatorItem();
fNavigationMenu->AddItem( fPrevChapterMI );
fNavigationMenu->AddItem( fNextChapterMI );
fNavigationMenu->AddItem( fChapterMenu = new ChapterMenu( "Go to Chapter", p_intf ) );
/* Add the Speed menu */
fSpeedMenu = new BMenu( "Speed" );
fSpeedMenu->SetRadioMode( true );
fSpeedMenu->AddItem( fSlowerMI = new BMenuItem( "Slower", new BMessage( SLOWER_PLAY ) ) );
fNormalMI = new BMenuItem( "Normal", new BMessage( NORMAL_PLAY ) );
fNormalMI->SetMarked(true); // default to normal speed
fSpeedMenu->AddItem( fNormalMI );
fSpeedMenu->AddItem( fFasterMI = new BMenuItem( "Faster", new BMessage( FASTER_PLAY) ) );
fSpeedMenu->SetTargetForItems( this );
fMenuBar->AddItem( fSpeedMenu );
/* Add the Settings menu */
fSettingsMenu = new BMenu( "Settings" );
fSettingsMenu->AddItem( fPreferencesMI =
new BMenuItem( "Preferences", new BMessage( OPEN_PREFERENCES ) ) );
fMenuBar->AddItem( fSettingsMenu );
/* Prepare fow showing */
_SetMenusEnabled( false );
p_mediaControl->SetEnabled( false );
/* Restore interface settings */ /* Restore interface settings */
int i_width = config_GetInt( p_intf, "beos-intf-width" ), int i_width = config_GetInt( p_intf, "beos-intf-width" ),
i_height = config_GetInt( p_intf, "beos-intf-height" ), i_height = config_GetInt( p_intf, "beos-intf-height" ),
...@@ -214,14 +219,23 @@ InterfaceWindow::InterfaceWindow( BRect frame, const char *name, ...@@ -214,14 +219,23 @@ InterfaceWindow::InterfaceWindow( BRect frame, const char *name,
fPlaylistWindow->Unlock(); fPlaylistWindow->Unlock();
} }
} }
if( config_GetInt( p_intf, "beos-messages-show" ) )
Show(); {
/* messages showing */
if( fMessagesWindow->Lock() )
{
fMessagesWindow->Show();
fMessagesWindow->Unlock();
}
}
Show();
} }
InterfaceWindow::~InterfaceWindow() InterfaceWindow::~InterfaceWindow()
{ {
if (fPlaylistWindow) if (fPlaylistWindow)
fPlaylistWindow->ReallyQuit(); fPlaylistWindow->ReallyQuit();
} }
/***************************************************************************** /*****************************************************************************
...@@ -230,12 +244,12 @@ InterfaceWindow::~InterfaceWindow() ...@@ -230,12 +244,12 @@ InterfaceWindow::~InterfaceWindow()
void void
InterfaceWindow::FrameResized(float width, float height) InterfaceWindow::FrameResized(float width, float height)
{ {
BRect r(Bounds()); BRect r(Bounds());
fMenuBar->MoveTo(r.LeftTop()); fMenuBar->MoveTo(r.LeftTop());
fMenuBar->ResizeTo(r.Width(), fMenuBar->Bounds().Height()); fMenuBar->ResizeTo(r.Width(), fMenuBar->Bounds().Height());
r.top += fMenuBar->Bounds().Height() + 1.0; r.top += fMenuBar->Bounds().Height() + 1.0;
p_mediaControl->MoveTo(r.LeftTop()); p_mediaControl->MoveTo(r.LeftTop());
p_mediaControl->ResizeTo(r.Width(), r.Height()); p_mediaControl->ResizeTo(r.Width(), r.Height());
} }
/***************************************************************************** /*****************************************************************************
...@@ -243,335 +257,350 @@ InterfaceWindow::FrameResized(float width, float height) ...@@ -243,335 +257,350 @@ InterfaceWindow::FrameResized(float width, float height)
*****************************************************************************/ *****************************************************************************/
void InterfaceWindow::MessageReceived( BMessage * p_message ) void InterfaceWindow::MessageReceived( BMessage * p_message )
{ {
int playback_status; // remember playback state int playback_status; // remember playback state
playback_status = p_wrapper->InputStatus(); playback_status = p_wrapper->InputStatus();
switch( p_message->what ) switch( p_message->what )
{ {
case B_ABOUT_REQUESTED: case B_ABOUT_REQUESTED:
{ {
BAlert* alert = new BAlert( VOUT_TITLE, BAlert* alert = new BAlert( VOUT_TITLE,
"BeOS " VOUT_TITLE "\n\n<www.videolan.org>", "Ok"); "BeOS " VOUT_TITLE "\n\n<www.videolan.org>", "Ok");
alert->Go(); alert->Go();
break; break;
} }
case TOGGLE_ON_TOP: case TOGGLE_ON_TOP:
break; break;
case OPEN_FILE: case OPEN_FILE:
if( fFilePanel ) if( fFilePanel )
{ {
fFilePanel->Show(); fFilePanel->Show();
break; break;
} }
fFilePanel = new BFilePanel(); fFilePanel = new BFilePanel();
fFilePanel->SetTarget( this ); fFilePanel->SetTarget( this );
fFilePanel->Show(); fFilePanel->Show();
break; break;
case OPEN_PLAYLIST: case OPEN_PLAYLIST:
if (fPlaylistWindow->Lock()) if (fPlaylistWindow->Lock())
{ {
if (fPlaylistWindow->IsHidden()) if (fPlaylistWindow->IsHidden())
fPlaylistWindow->Show(); fPlaylistWindow->Show();
else else
fPlaylistWindow->Activate(); fPlaylistWindow->Activate();
fPlaylistWindow->Unlock(); fPlaylistWindow->Unlock();
} }
break; break;
case OPEN_DVD: case OPEN_DVD:
{ {
const char *psz_device; const char *psz_device;
BString type( "dvd" ); BString type( "dvd" );
if( p_message->FindString( "device", &psz_device ) == B_OK ) if( p_message->FindString( "device", &psz_device ) == B_OK )
{ {
BString device( psz_device ); BString device( psz_device );
p_wrapper->OpenDisc( type, device, 0, 0 ); p_wrapper->OpenDisc( type, device, 0, 0 );
} }
_UpdatePlaylist(); _UpdatePlaylist();
} }
break; break;
case LOAD_SUBFILE: case LOAD_SUBFILE:
if( fSubtitlesPanel ) if( fSubtitlesPanel )
{ {
fSubtitlesPanel->Show(); fSubtitlesPanel->Show();
break; break;
} }
fSubtitlesPanel = new BFilePanel(); fSubtitlesPanel = new BFilePanel();
fSubtitlesPanel->SetTarget( this ); fSubtitlesPanel->SetTarget( this );
fSubtitlesPanel->SetMessage( new BMessage( SUBFILE_RECEIVED ) ); fSubtitlesPanel->SetMessage( new BMessage( SUBFILE_RECEIVED ) );
fSubtitlesPanel->Show(); fSubtitlesPanel->Show();
break; break;
case SUBFILE_RECEIVED: case SUBFILE_RECEIVED:
{ {
entry_ref ref; entry_ref ref;
if( p_message->FindRef( "refs", 0, &ref ) == B_OK ) if( p_message->FindRef( "refs", 0, &ref ) == B_OK )
{ {
BPath path( &ref ); BPath path( &ref );
if ( path.InitCheck() == B_OK ) if ( path.InitCheck() == B_OK )
p_wrapper->LoadSubFile( (char*)path.Path() ); p_wrapper->LoadSubFile( (char*)path.Path() );
} }
break; break;
} }
case STOP_PLAYBACK: case STOP_PLAYBACK:
// this currently stops playback not nicely // this currently stops playback not nicely
if (playback_status > UNDEF_S) if (playback_status > UNDEF_S)
{ {
snooze( 400000 ); snooze( 400000 );
p_wrapper->PlaylistStop(); p_wrapper->PlaylistStop();
p_mediaControl->SetStatus(NOT_STARTED_S, DEFAULT_RATE); p_mediaControl->SetStatus(NOT_STARTED_S, DEFAULT_RATE);
} }
break; break;
case START_PLAYBACK: case START_PLAYBACK:
/* starts playing in normal mode */ /* starts playing in normal mode */
case PAUSE_PLAYBACK: case PAUSE_PLAYBACK:
/* toggle between pause and play */ /* toggle between pause and play */
if (playback_status > UNDEF_S) if (playback_status > UNDEF_S)
{ {
/* pause if currently playing */ /* pause if currently playing */
if ( playback_status == PLAYING_S ) if ( playback_status == PLAYING_S )
{ {
p_wrapper->PlaylistPause(); p_wrapper->PlaylistPause();
} }
else else
{ {
p_wrapper->PlaylistPlay(); p_wrapper->PlaylistPlay();
} }
} }
else else
{ {
/* Play a new file */ /* Play a new file */
p_wrapper->PlaylistPlay(); p_wrapper->PlaylistPlay();
} }
break; break;
case FASTER_PLAY: case FASTER_PLAY:
/* cycle the fast playback modes */ /* cycle the fast playback modes */
if (playback_status > UNDEF_S) if (playback_status > UNDEF_S)
{ {
p_wrapper->InputFaster(); p_wrapper->InputFaster();
} }
break; break;
case SLOWER_PLAY: case SLOWER_PLAY:
/* cycle the slow playback modes */ /* cycle the slow playback modes */
if (playback_status > UNDEF_S) if (playback_status > UNDEF_S)
{ {
p_wrapper->InputSlower(); p_wrapper->InputSlower();
} }
break; break;
case NORMAL_PLAY: case NORMAL_PLAY:
/* restore speed to normal if already playing */ /* restore speed to normal if already playing */
if (playback_status > UNDEF_S) if (playback_status > UNDEF_S)
{ {
p_wrapper->PlaylistPlay(); p_wrapper->PlaylistPlay();
} }
break; break;
case SEEK_PLAYBACK: case SEEK_PLAYBACK:
/* handled by semaphores */ /* handled by semaphores */
break; break;
// volume related messages // volume related messages
case VOLUME_CHG: case VOLUME_CHG:
/* adjust the volume */ /* adjust the volume */
if (playback_status > UNDEF_S) if (playback_status > UNDEF_S)
{ {
p_wrapper->SetVolume( p_mediaControl->GetVolume() ); p_wrapper->SetVolume( p_mediaControl->GetVolume() );
p_mediaControl->SetMuted( p_wrapper->IsMuted() ); p_mediaControl->SetMuted( p_wrapper->IsMuted() );
} }
break; break;
case VOLUME_MUTE: case VOLUME_MUTE:
// toggle muting // toggle muting
if( p_wrapper->IsMuted() ) if( p_wrapper->IsMuted() )
p_wrapper->VolumeRestore(); p_wrapper->VolumeRestore();
else else
p_wrapper->VolumeMute(); p_wrapper->VolumeMute();
p_mediaControl->SetMuted( p_wrapper->IsMuted() ); p_mediaControl->SetMuted( p_wrapper->IsMuted() );
break; break;
case SELECT_CHANNEL: case SELECT_CHANNEL:
if ( playback_status > UNDEF_S ) if ( playback_status > UNDEF_S )
{ {
int32 channel; int32 channel;
if ( p_message->FindInt32( "channel", &channel ) == B_OK ) if ( p_message->FindInt32( "channel", &channel ) == B_OK )
{ {
p_wrapper->ToggleLanguage( channel ); p_wrapper->ToggleLanguage( channel );
} }
} }
break; break;
case SELECT_SUBTITLE: case SELECT_SUBTITLE:
if ( playback_status > UNDEF_S ) if ( playback_status > UNDEF_S )
{ {
int32 subtitle; int32 subtitle;
if ( p_message->FindInt32( "subtitle", &subtitle ) == B_OK ) if ( p_message->FindInt32( "subtitle", &subtitle ) == B_OK )
p_wrapper->ToggleSubtitle( subtitle ); p_wrapper->ToggleSubtitle( subtitle );
} }
break; break;
// specific navigation messages // specific navigation messages
case PREV_TITLE: case PREV_TITLE:
{ {
p_wrapper->PrevTitle(); p_wrapper->PrevTitle();
break; break;
} }
case NEXT_TITLE: case NEXT_TITLE:
{ {
p_wrapper->NextTitle(); p_wrapper->NextTitle();
break; break;
} }
case TOGGLE_TITLE: case TOGGLE_TITLE:
if ( playback_status > UNDEF_S ) if ( playback_status > UNDEF_S )
{ {
int32 index; int32 index;
if( p_message->FindInt32( "index", &index ) == B_OK ) if( p_message->FindInt32( "index", &index ) == B_OK )
p_wrapper->ToggleTitle( index ); p_wrapper->ToggleTitle( index );
} }
break; break;
case PREV_CHAPTER: case PREV_CHAPTER:
{ {
p_wrapper->PrevChapter(); p_wrapper->PrevChapter();
break; break;
} }
case NEXT_CHAPTER: case NEXT_CHAPTER:
{ {
p_wrapper->NextChapter(); p_wrapper->NextChapter();
break; break;
} }
case TOGGLE_CHAPTER: case TOGGLE_CHAPTER:
if ( playback_status > UNDEF_S ) if ( playback_status > UNDEF_S )
{ {
int32 index; int32 index;
if( p_message->FindInt32( "index", &index ) == B_OK ) if( p_message->FindInt32( "index", &index ) == B_OK )
p_wrapper->ToggleChapter( index ); p_wrapper->ToggleChapter( index );
} }
break; break;
case PREV_FILE: case PREV_FILE:
p_wrapper->PlaylistPrev(); p_wrapper->PlaylistPrev();
break; break;
case NEXT_FILE: case NEXT_FILE:
p_wrapper->PlaylistNext(); p_wrapper->PlaylistNext();
break; break;
// general next/prev functionality (skips to whatever makes most sense) // general next/prev functionality (skips to whatever makes most sense)
case NAVIGATE_PREV: case NAVIGATE_PREV:
p_wrapper->NavigatePrev(); p_wrapper->NavigatePrev();
break; break;
case NAVIGATE_NEXT: case NAVIGATE_NEXT:
p_wrapper->NavigateNext(); p_wrapper->NavigateNext();
break; break;
// drag'n'drop and system messages // drag'n'drop and system messages
case B_REFS_RECEIVED: case B_REFS_RECEIVED:
case B_SIMPLE_DATA: case B_SIMPLE_DATA:
{ {
/* file(s) opened by the File menu -> append to the playlist; /* file(s) opened by the File menu -> append to the playlist;
* file(s) opened by drag & drop -> replace playlist; * file(s) opened by drag & drop -> replace playlist;
* file(s) opened by 'shift' + drag & drop -> append */ * file(s) opened by 'shift' + drag & drop -> append */
bool replace = false; bool replace = false;
if ( p_message->WasDropped() ) if ( p_message->WasDropped() )
replace = !( modifiers() & B_SHIFT_KEY ); replace = !( modifiers() & B_SHIFT_KEY );
// build list of files to be played from message contents // build list of files to be played from message contents
entry_ref ref; entry_ref ref;
BList files; BList files;
for ( int i = 0; p_message->FindRef( "refs", i, &ref ) == B_OK; i++ ) for ( int i = 0; p_message->FindRef( "refs", i, &ref ) == B_OK; i++ )
{ {
BPath path( &ref ); BPath path( &ref );
if ( path.InitCheck() == B_OK ) if ( path.InitCheck() == B_OK )
{ {
bool add = true; bool add = true;
// has the user dropped a dvd disk icon? // has the user dropped a dvd disk icon?
BDirectory dir( &ref ); BDirectory dir( &ref );
if ( dir.InitCheck() == B_OK && dir.IsRootDirectory() ) if ( dir.InitCheck() == B_OK && dir.IsRootDirectory() )
{ {
BVolumeRoster volRoster; BVolumeRoster volRoster;
BVolume vol; BVolume vol;
BDirectory volumeRoot; BDirectory volumeRoot;
status_t status = volRoster.GetNextVolume( &vol ); status_t status = volRoster.GetNextVolume( &vol );
while( status == B_NO_ERROR ) while( status == B_NO_ERROR )
{ {
if( vol.GetRootDirectory( &volumeRoot ) == B_OK if( vol.GetRootDirectory( &volumeRoot ) == B_OK
&& dir == volumeRoot ) && dir == volumeRoot )
{ {
BString volumeName; BString volumeName;
BString deviceName; BString deviceName;
bool isCDROM = false; bool isCDROM = false;
bool success = false; bool success = false;
deviceName = ""; deviceName = "";
volumeName = ""; volumeName = "";
char name[B_FILE_NAME_LENGTH]; char name[B_FILE_NAME_LENGTH];
if ( vol.GetName( name ) >= B_OK ) // disk is currently mounted if ( vol.GetName( name ) >= B_OK ) // disk is currently mounted
{ {
volumeName = name; volumeName = name;
dev_t dev = vol.Device(); dev_t dev = vol.Device();
fs_info info; fs_info info;
if ( fs_stat_dev( dev, &info ) == B_OK ) if ( fs_stat_dev( dev, &info ) == B_OK )
{ {
success = true; success = true;
deviceName = info.device_name; deviceName = info.device_name;
if ( vol.IsReadOnly() ) if ( vol.IsReadOnly() )
{ {
int i_dev = open( info.device_name, O_RDONLY ); int i_dev = open( info.device_name, O_RDONLY );
if ( i_dev >= 0 ) if ( i_dev >= 0 )
{ {
device_geometry g; device_geometry g;
if ( ioctl( i_dev, B_GET_GEOMETRY, &g, sizeof( g ) ) >= 0 ) if ( ioctl( i_dev, B_GET_GEOMETRY, &g, sizeof( g ) ) >= 0 )
isCDROM = ( g.device_type == B_CD ); isCDROM = ( g.device_type == B_CD );
close( i_dev ); close( i_dev );
} }
} }
} }
} }
if( success && isCDROM ) if( success && isCDROM )
{ {
BMessage msg( OPEN_DVD ); BMessage msg( OPEN_DVD );
msg.AddString( "device", deviceName.String() ); msg.AddString( "device", deviceName.String() );
PostMessage( &msg ); PostMessage( &msg );
add = false; add = false;
} }
break; break;
} }
else else
{ {
vol.Unset(); vol.Unset();
status = volRoster.GetNextVolume( &vol ); status = volRoster.GetNextVolume( &vol );
} }
} }
} }
if( add ) if( add )
{ {
files.AddItem( new BString( (char*)path.Path() ) ); files.AddItem( new BString( (char*)path.Path() ) );
} }
} }
} }
// give the list to VLC // give the list to VLC
p_wrapper->OpenFiles(&files, replace); p_wrapper->OpenFiles(&files, replace);
_UpdatePlaylist(); _UpdatePlaylist();
} }
break; break;
case OPEN_PREFERENCES: case OPEN_PREFERENCES:
if( fPreferencesWindow->Lock() ) {
{ if( fPreferencesWindow->Lock() )
if (fPreferencesWindow->IsHidden()) {
fPreferencesWindow->Show(); if (fPreferencesWindow->IsHidden())
else fPreferencesWindow->Show();
fPreferencesWindow->Activate(); else
fPreferencesWindow->Unlock(); fPreferencesWindow->Activate();
} fPreferencesWindow->Unlock();
break; }
break;
default: }
BWindow::MessageReceived( p_message );
break; case OPEN_MESSAGES:
} {
if( fMessagesWindow->Lock() )
{
if (fMessagesWindow->IsHidden())
fMessagesWindow->Show();
else
fMessagesWindow->Activate();
fMessagesWindow->Unlock();
}
break;
}
default:
BWindow::MessageReceived( p_message );
break;
}
} }
...@@ -580,8 +609,8 @@ void InterfaceWindow::MessageReceived( BMessage * p_message ) ...@@ -580,8 +609,8 @@ void InterfaceWindow::MessageReceived( BMessage * p_message )
*****************************************************************************/ *****************************************************************************/
bool InterfaceWindow::QuitRequested() bool InterfaceWindow::QuitRequested()
{ {
p_wrapper->PlaylistStop(); p_wrapper->PlaylistStop();
p_mediaControl->SetStatus(NOT_STARTED_S, DEFAULT_RATE); p_mediaControl->SetStatus(NOT_STARTED_S, DEFAULT_RATE);
/* Save interface settings */ /* Save interface settings */
BRect frame = Frame(); BRect frame = Frame();
...@@ -599,65 +628,70 @@ bool InterfaceWindow::QuitRequested() ...@@ -599,65 +628,70 @@ bool InterfaceWindow::QuitRequested()
config_PutInt( p_intf, "beos-playlist-show", !fPlaylistWindow->IsHidden() ); config_PutInt( p_intf, "beos-playlist-show", !fPlaylistWindow->IsHidden() );
fPlaylistWindow->Unlock(); fPlaylistWindow->Unlock();
} }
if( fMessagesWindow->Lock() )
{
config_PutInt( p_intf, "beos-messages-show", !fMessagesWindow->IsHidden() );
fMessagesWindow->Unlock();
}
config_SaveConfigFile( p_intf, "beos" ); config_SaveConfigFile( p_intf, "beos" );
p_intf->b_die = 1; p_intf->b_die = 1;
return( true ); return( true );
} }
/***************************************************************************** /*****************************************************************************
* InterfaceWindow::updateInterface * InterfaceWindow::UpdateInterface
*****************************************************************************/ *****************************************************************************/
void InterfaceWindow::updateInterface() void InterfaceWindow::UpdateInterface()
{ {
if( p_wrapper->HasInput() ) if( p_wrapper->HasInput() )
{ {
if ( acquire_sem( p_mediaControl->fScrubSem ) == B_OK ) if ( acquire_sem( p_mediaControl->fScrubSem ) == B_OK )
{ {
p_wrapper->SetTimeAsFloat(p_mediaControl->GetSeekTo()); p_wrapper->SetTimeAsFloat(p_mediaControl->GetSeekTo());
} }
else if ( Lock() ) else if ( Lock() )
{ {
p_mediaControl->SetEnabled( true ); p_mediaControl->SetEnabled( true );
bool hasTitles = p_wrapper->HasTitles(); bool hasTitles = p_wrapper->HasTitles();
bool hasChapters = p_wrapper->HasChapters(); bool hasChapters = p_wrapper->HasChapters();
p_mediaControl->SetStatus( p_wrapper->InputStatus(), p_mediaControl->SetStatus( p_wrapper->InputStatus(),
p_wrapper->InputRate() ); p_wrapper->InputRate() );
p_mediaControl->SetProgress( p_wrapper->GetTimeAsFloat() ); p_mediaControl->SetProgress( p_wrapper->GetTimeAsFloat() );
_SetMenusEnabled( true, hasChapters, hasTitles ); _SetMenusEnabled( true, hasChapters, hasTitles );
_UpdateSpeedMenu( p_wrapper->InputRate() ); _UpdateSpeedMenu( p_wrapper->InputRate() );
// enable/disable skip buttons // enable/disable skip buttons
bool canSkipPrev; bool canSkipPrev;
bool canSkipNext; bool canSkipNext;
p_wrapper->GetNavCapabilities( &canSkipPrev, &canSkipNext ); p_wrapper->GetNavCapabilities( &canSkipPrev, &canSkipNext );
p_mediaControl->SetSkippable( canSkipPrev, canSkipNext ); p_mediaControl->SetSkippable( canSkipPrev, canSkipNext );
if ( p_wrapper->HasAudio() ) if ( p_wrapper->HasAudio() )
{ {
p_mediaControl->SetAudioEnabled( true ); p_mediaControl->SetAudioEnabled( true );
p_mediaControl->SetMuted( p_wrapper->IsMuted() ); p_mediaControl->SetMuted( p_wrapper->IsMuted() );
} else } else
p_mediaControl->SetAudioEnabled( false ); p_mediaControl->SetAudioEnabled( false );
Unlock(); Unlock();
} }
// update playlist as well // update playlist as well
if ( fPlaylistWindow->Lock() ) if ( fPlaylistWindow->Lock() )
{ {
fPlaylistWindow->UpdatePlaylist(); fPlaylistWindow->UpdatePlaylist();
fPlaylistWindow->Unlock(); fPlaylistWindow->Unlock();
} }
} }
else else
{ {
_SetMenusEnabled( false ); _SetMenusEnabled( false );
if( !( p_wrapper->PlaylistSize() > 0 ) ) if( !( p_wrapper->PlaylistSize() > 0 ) )
p_mediaControl->SetEnabled( false ); p_mediaControl->SetEnabled( false );
else else
p_mediaControl->SetProgress( 0 ); p_mediaControl->SetProgress( 0 );
} }
/* always force the user-specified volume */ /* always force the user-specified volume */
...@@ -667,8 +701,10 @@ void InterfaceWindow::updateInterface() ...@@ -667,8 +701,10 @@ void InterfaceWindow::updateInterface()
{ {
p_wrapper->SetVolume( i_volume ); p_wrapper->SetVolume( i_volume );
} }
fMessagesWindow->UpdateMessages();
fLastUpdateTime = system_time(); fLastUpdateTime = system_time();
} }
/***************************************************************************** /*****************************************************************************
...@@ -677,7 +713,7 @@ void InterfaceWindow::updateInterface() ...@@ -677,7 +713,7 @@ void InterfaceWindow::updateInterface()
bool bool
InterfaceWindow::IsStopped() const InterfaceWindow::IsStopped() const
{ {
return (system_time() - fLastUpdateTime > INTERFACE_UPDATE_TIMEOUT); return (system_time() - fLastUpdateTime > INTERFACE_UPDATE_TIMEOUT);
} }
/***************************************************************************** /*****************************************************************************
...@@ -686,12 +722,12 @@ InterfaceWindow::IsStopped() const ...@@ -686,12 +722,12 @@ InterfaceWindow::IsStopped() const
void void
InterfaceWindow::_UpdatePlaylist() InterfaceWindow::_UpdatePlaylist()
{ {
if ( fPlaylistWindow->Lock() ) if ( fPlaylistWindow->Lock() )
{ {
fPlaylistWindow->UpdatePlaylist( true ); fPlaylistWindow->UpdatePlaylist( true );
fPlaylistWindow->Unlock(); fPlaylistWindow->Unlock();
p_mediaControl->SetEnabled( p_wrapper->PlaylistSize() ); p_mediaControl->SetEnabled( p_wrapper->PlaylistSize() );
} }
} }
/***************************************************************************** /*****************************************************************************
...@@ -700,37 +736,37 @@ InterfaceWindow::_UpdatePlaylist() ...@@ -700,37 +736,37 @@ InterfaceWindow::_UpdatePlaylist()
void void
InterfaceWindow::_SetMenusEnabled(bool hasFile, bool hasChapters, bool hasTitles) InterfaceWindow::_SetMenusEnabled(bool hasFile, bool hasChapters, bool hasTitles)
{ {
if (!hasFile) if (!hasFile)
{ {
hasChapters = false; hasChapters = false;
hasTitles = false; hasTitles = false;
} }
if (Lock()) if (Lock())
{ {
if (fNextChapterMI->IsEnabled() != hasChapters) if (fNextChapterMI->IsEnabled() != hasChapters)
fNextChapterMI->SetEnabled(hasChapters); fNextChapterMI->SetEnabled(hasChapters);
if (fPrevChapterMI->IsEnabled() != hasChapters) if (fPrevChapterMI->IsEnabled() != hasChapters)
fPrevChapterMI->SetEnabled(hasChapters); fPrevChapterMI->SetEnabled(hasChapters);
if (fChapterMenu->IsEnabled() != hasChapters) if (fChapterMenu->IsEnabled() != hasChapters)
fChapterMenu->SetEnabled(hasChapters); fChapterMenu->SetEnabled(hasChapters);
if (fNextTitleMI->IsEnabled() != hasTitles) if (fNextTitleMI->IsEnabled() != hasTitles)
fNextTitleMI->SetEnabled(hasTitles); fNextTitleMI->SetEnabled(hasTitles);
if (fPrevTitleMI->IsEnabled() != hasTitles) if (fPrevTitleMI->IsEnabled() != hasTitles)
fPrevTitleMI->SetEnabled(hasTitles); fPrevTitleMI->SetEnabled(hasTitles);
if (fTitleMenu->IsEnabled() != hasTitles) if (fTitleMenu->IsEnabled() != hasTitles)
fTitleMenu->SetEnabled(hasTitles); fTitleMenu->SetEnabled(hasTitles);
if (fAudioMenu->IsEnabled() != hasFile) if (fAudioMenu->IsEnabled() != hasFile)
fAudioMenu->SetEnabled(hasFile); fAudioMenu->SetEnabled(hasFile);
if (fNavigationMenu->IsEnabled() != hasFile) if (fNavigationMenu->IsEnabled() != hasFile)
fNavigationMenu->SetEnabled(hasFile); fNavigationMenu->SetEnabled(hasFile);
if (fLanguageMenu->IsEnabled() != hasFile) if (fLanguageMenu->IsEnabled() != hasFile)
fLanguageMenu->SetEnabled(hasFile); fLanguageMenu->SetEnabled(hasFile);
if (fSubtitlesMenu->IsEnabled() != hasFile) if (fSubtitlesMenu->IsEnabled() != hasFile)
fSubtitlesMenu->SetEnabled(hasFile); fSubtitlesMenu->SetEnabled(hasFile);
if (fSpeedMenu->IsEnabled() != hasFile) if (fSpeedMenu->IsEnabled() != hasFile)
fSpeedMenu->SetEnabled(hasFile); fSpeedMenu->SetEnabled(hasFile);
Unlock(); Unlock();
} }
} }
/***************************************************************************** /*****************************************************************************
...@@ -739,21 +775,21 @@ InterfaceWindow::_SetMenusEnabled(bool hasFile, bool hasChapters, bool hasTitles ...@@ -739,21 +775,21 @@ InterfaceWindow::_SetMenusEnabled(bool hasFile, bool hasChapters, bool hasTitles
void void
InterfaceWindow::_UpdateSpeedMenu( int rate ) InterfaceWindow::_UpdateSpeedMenu( int rate )
{ {
if ( rate == DEFAULT_RATE ) if ( rate == DEFAULT_RATE )
{ {
if ( !fNormalMI->IsMarked() ) if ( !fNormalMI->IsMarked() )
fNormalMI->SetMarked( true ); fNormalMI->SetMarked( true );
} }
else if ( rate < DEFAULT_RATE ) else if ( rate < DEFAULT_RATE )
{ {
if ( !fFasterMI->IsMarked() ) if ( !fFasterMI->IsMarked() )
fFasterMI->SetMarked( true ); fFasterMI->SetMarked( true );
} }
else else
{ {
if ( !fSlowerMI->IsMarked() ) if ( !fSlowerMI->IsMarked() )
fSlowerMI->SetMarked( true ); fSlowerMI->SetMarked( true );
} }
} }
/***************************************************************************** /*****************************************************************************
...@@ -762,30 +798,30 @@ InterfaceWindow::_UpdateSpeedMenu( int rate ) ...@@ -762,30 +798,30 @@ InterfaceWindow::_UpdateSpeedMenu( int rate )
void void
InterfaceWindow::_InputStreamChanged() InterfaceWindow::_InputStreamChanged()
{ {
// TODO: move more stuff from updateInterface() here! // TODO: move more stuff from updateInterface() here!
snooze( 400000 ); snooze( 400000 );
p_wrapper->SetVolume( p_mediaControl->GetVolume() ); p_wrapper->SetVolume( p_mediaControl->GetVolume() );
} }
void void
make_sure_frame_is_within_limits( BRect& frame, float minWidth, float minHeight, make_sure_frame_is_within_limits( BRect& frame, float minWidth, float minHeight,
float maxWidth, float maxHeight ) float maxWidth, float maxHeight )
{ {
if ( frame.Width() < minWidth ) if ( frame.Width() < minWidth )
frame.right = frame.left + minWidth; frame.right = frame.left + minWidth;
if ( frame.Height() < minHeight ) if ( frame.Height() < minHeight )
frame.bottom = frame.top + minHeight; frame.bottom = frame.top + minHeight;
if ( frame.Width() > maxWidth ) if ( frame.Width() > maxWidth )
frame.right = frame.left + maxWidth; frame.right = frame.left + maxWidth;
if ( frame.Height() > maxHeight ) if ( frame.Height() > maxHeight )
frame.bottom = frame.top + maxHeight; frame.bottom = frame.top + maxHeight;
} }
/***************************************************************************** /*****************************************************************************
* CDMenu::CDMenu * CDMenu::CDMenu
*****************************************************************************/ *****************************************************************************/
CDMenu::CDMenu(const char *name) CDMenu::CDMenu(const char *name)
: BMenu(name) : BMenu(name)
{ {
} }
...@@ -801,11 +837,11 @@ CDMenu::~CDMenu() ...@@ -801,11 +837,11 @@ CDMenu::~CDMenu()
*****************************************************************************/ *****************************************************************************/
void CDMenu::AttachedToWindow(void) void CDMenu::AttachedToWindow(void)
{ {
// remove all items // remove all items
while (BMenuItem* item = RemoveItem(0L)) while (BMenuItem* item = RemoveItem(0L))
delete item; delete item;
GetCD("/dev/disk"); GetCD("/dev/disk");
BMenu::AttachedToWindow(); BMenu::AttachedToWindow();
} }
/***************************************************************************** /*****************************************************************************
...@@ -813,65 +849,65 @@ void CDMenu::AttachedToWindow(void) ...@@ -813,65 +849,65 @@ void CDMenu::AttachedToWindow(void)
*****************************************************************************/ *****************************************************************************/
int CDMenu::GetCD( const char *directory ) int CDMenu::GetCD( const char *directory )
{ {
BVolumeRoster *volRoster; BVolumeRoster *volRoster;
BVolume *vol; BVolume *vol;
BDirectory *dir; BDirectory *dir;
int status; int status;
int mounted; int mounted;
char name[B_FILE_NAME_LENGTH]; char name[B_FILE_NAME_LENGTH];
fs_info info; fs_info info;
dev_t dev; dev_t dev;
volRoster = new BVolumeRoster(); volRoster = new BVolumeRoster();
vol = new BVolume(); vol = new BVolume();
dir = new BDirectory(); dir = new BDirectory();
status = volRoster->GetNextVolume(vol); status = volRoster->GetNextVolume(vol);
status = vol->GetRootDirectory(dir); status = vol->GetRootDirectory(dir);
while (status == B_NO_ERROR) while (status == B_NO_ERROR)
{ {
mounted = vol->GetName(name); mounted = vol->GetName(name);
if ((mounted == B_OK) && /* Disk is currently Mounted */ if ((mounted == B_OK) && /* Disk is currently Mounted */
(vol->IsReadOnly()) ) /* Disk is read-only */ (vol->IsReadOnly()) ) /* Disk is read-only */
{ {
dev = vol->Device(); dev = vol->Device();
fs_stat_dev(dev, &info); fs_stat_dev(dev, &info);
device_geometry g; device_geometry g;
int i_dev; int i_dev;
i_dev = open( info.device_name, O_RDONLY ); i_dev = open( info.device_name, O_RDONLY );
if( i_dev >= 0 ) if( i_dev >= 0 )
{ {
if( ioctl(i_dev, B_GET_GEOMETRY, &g, sizeof(g)) >= 0 ) if( ioctl(i_dev, B_GET_GEOMETRY, &g, sizeof(g)) >= 0 )
{ {
if( g.device_type == B_CD ) //ensure the drive is a CD-ROM if( g.device_type == B_CD ) //ensure the drive is a CD-ROM
{ {
BMessage *msg; BMessage *msg;
msg = new BMessage( OPEN_DVD ); msg = new BMessage( OPEN_DVD );
msg->AddString( "device", info.device_name ); msg->AddString( "device", info.device_name );
BMenuItem *menu_item; BMenuItem *menu_item;
menu_item = new BMenuItem( name, msg ); menu_item = new BMenuItem( name, msg );
AddItem( menu_item ); AddItem( menu_item );
} }
close(i_dev); close(i_dev);
} }
} }
} }
vol->Unset(); vol->Unset();
status = volRoster->GetNextVolume(vol); status = volRoster->GetNextVolume(vol);
} }
return 0; return 0;
} }
/***************************************************************************** /*****************************************************************************
* LanguageMenu::LanguageMenu * LanguageMenu::LanguageMenu
*****************************************************************************/ *****************************************************************************/
LanguageMenu::LanguageMenu( const char *name, int menu_kind, LanguageMenu::LanguageMenu( const char *name, int menu_kind,
VlcWrapper *p_wrapper ) VlcWrapper *p_wrapper )
:BMenu(name) :BMenu(name)
{ {
kind = menu_kind; kind = menu_kind;
this->p_wrapper = p_wrapper; this->p_wrapper = p_wrapper;
} }
/***************************************************************************** /*****************************************************************************
...@@ -886,13 +922,13 @@ LanguageMenu::~LanguageMenu() ...@@ -886,13 +922,13 @@ LanguageMenu::~LanguageMenu()
*****************************************************************************/ *****************************************************************************/
void LanguageMenu::AttachedToWindow() void LanguageMenu::AttachedToWindow()
{ {
// remove all items // remove all items
while ( BMenuItem* item = RemoveItem( 0L ) ) while ( BMenuItem* item = RemoveItem( 0L ) )
delete item; delete item;
SetRadioMode( true ); SetRadioMode( true );
_GetChannels(); _GetChannels();
BMenu::AttachedToWindow(); BMenu::AttachedToWindow();
} }
/***************************************************************************** /*****************************************************************************
...@@ -921,8 +957,8 @@ void LanguageMenu::_GetChannels() ...@@ -921,8 +957,8 @@ void LanguageMenu::_GetChannels()
* TitleMenu::TitleMenu * TitleMenu::TitleMenu
*****************************************************************************/ *****************************************************************************/
TitleMenu::TitleMenu( const char *name, intf_thread_t *p_interface ) TitleMenu::TitleMenu( const char *name, intf_thread_t *p_interface )
: BMenu(name), : BMenu(name),
p_intf( p_interface ) p_intf( p_interface )
{ {
} }
...@@ -941,8 +977,8 @@ void TitleMenu::AttachedToWindow() ...@@ -941,8 +977,8 @@ void TitleMenu::AttachedToWindow()
BMenuItem *item; BMenuItem *item;
BList *list; BList *list;
while( ( item = RemoveItem( 0L ) ) ) while( ( item = RemoveItem( 0L ) ) )
delete item; delete item;
if( ( list = p_intf->p_sys->p_wrapper->GetTitles() ) == NULL ) if( ( list = p_intf->p_sys->p_wrapper->GetTitles() ) == NULL )
return; return;
...@@ -953,7 +989,7 @@ void TitleMenu::AttachedToWindow() ...@@ -953,7 +989,7 @@ void TitleMenu::AttachedToWindow()
AddItem( item ); AddItem( item );
} }
BMenu::AttachedToWindow(); BMenu::AttachedToWindow();
} }
...@@ -961,8 +997,8 @@ void TitleMenu::AttachedToWindow() ...@@ -961,8 +997,8 @@ void TitleMenu::AttachedToWindow()
* ChapterMenu::ChapterMenu * ChapterMenu::ChapterMenu
*****************************************************************************/ *****************************************************************************/
ChapterMenu::ChapterMenu( const char *name, intf_thread_t *p_interface ) ChapterMenu::ChapterMenu( const char *name, intf_thread_t *p_interface )
: BMenu(name), : BMenu(name),
p_intf( p_interface ) p_intf( p_interface )
{ {
} }
...@@ -981,8 +1017,8 @@ void ChapterMenu::AttachedToWindow() ...@@ -981,8 +1017,8 @@ void ChapterMenu::AttachedToWindow()
BMenuItem *item; BMenuItem *item;
BList *list; BList *list;
while( ( item = RemoveItem( 0L ) ) ) while( ( item = RemoveItem( 0L ) ) )
delete item; delete item;
if( ( list = p_intf->p_sys->p_wrapper->GetChapters() ) == NULL ) if( ( list = p_intf->p_sys->p_wrapper->GetChapters() ) == NULL )
return; return;
...@@ -993,6 +1029,6 @@ void ChapterMenu::AttachedToWindow() ...@@ -993,6 +1029,6 @@ void ChapterMenu::AttachedToWindow()
AddItem( item ); AddItem( item );
} }
BMenu::AttachedToWindow(); BMenu::AttachedToWindow();
} }
...@@ -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.9 2003/01/22 01:13:22 titer Exp $ * $Id: InterfaceWindow.h,v 1.10 2003/01/25 20:15:41 titer 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>
...@@ -35,115 +35,116 @@ class MediaControlView; ...@@ -35,115 +35,116 @@ class MediaControlView;
class PlayListWindow; class PlayListWindow;
class BFilePanel; class BFilePanel;
class PreferencesWindow; class PreferencesWindow;
class MessagesWindow;
class CDMenu : public BMenu class CDMenu : public BMenu
{ {
public: public:
CDMenu( const char* name ); CDMenu( const char* name );
virtual ~CDMenu(); virtual ~CDMenu();
virtual void AttachedToWindow(); virtual void AttachedToWindow();
private: private:
int GetCD( const char* directory ); int GetCD( const char* directory );
}; };
class LanguageMenu : public BMenu class LanguageMenu : public BMenu
{ {
public: public:
LanguageMenu( const char* name, LanguageMenu( const char* name,
int menu_kind, int menu_kind,
VlcWrapper *p_wrapper ); VlcWrapper *p_wrapper );
virtual ~LanguageMenu(); virtual ~LanguageMenu();
virtual void AttachedToWindow(); virtual void AttachedToWindow();
private: private:
void _GetChannels(); void _GetChannels();
VlcWrapper * p_wrapper; VlcWrapper * p_wrapper;
int kind; int kind;
}; };
class TitleMenu : public BMenu class TitleMenu : public BMenu
{ {
public: public:
TitleMenu( const char* name, intf_thread_t *p_interface ); TitleMenu( const char* name, intf_thread_t *p_interface );
virtual ~TitleMenu(); virtual ~TitleMenu();
virtual void AttachedToWindow(); virtual void AttachedToWindow();
intf_thread_t *p_intf; intf_thread_t *p_intf;
}; };
class ChapterMenu : public BMenu class ChapterMenu : public BMenu
{ {
public: public:
ChapterMenu( const char* name, intf_thread_t *p_interface ); ChapterMenu( const char* name, intf_thread_t *p_interface );
virtual ~ChapterMenu(); virtual ~ChapterMenu();
virtual void AttachedToWindow(); virtual void AttachedToWindow();
intf_thread_t *p_intf; intf_thread_t *p_intf;
}; };
class InterfaceWindow : public BWindow class InterfaceWindow : public BWindow
{ {
public: public:
InterfaceWindow( BRect frame, InterfaceWindow( BRect frame,
const char* name, const char* name,
intf_thread_t* p_interface ); intf_thread_t* p_interface );
virtual ~InterfaceWindow(); virtual ~InterfaceWindow();
// BWindow // BWindow
virtual void FrameResized( float width, float height ); virtual void FrameResized( float width, float height );
virtual void MessageReceived( BMessage* message ); virtual void MessageReceived( BMessage* message );
virtual bool QuitRequested(); virtual bool QuitRequested();
// InterfaceWindow // InterfaceWindow
void updateInterface(); void UpdateInterface();
bool IsStopped() const; bool IsStopped() const;
MediaControlView* p_mediaControl; MediaControlView* p_mediaControl;
private: private:
void _UpdatePlaylist(); void _UpdatePlaylist();
void _SetMenusEnabled( bool hasFile, void _SetMenusEnabled( bool hasFile,
bool hasChapters = false, bool hasChapters = false,
bool hasTitles = false ); bool hasTitles = false );
void _UpdateSpeedMenu( int rate ); void _UpdateSpeedMenu( int rate );
void _InputStreamChanged(); void _InputStreamChanged();
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; BFilePanel* fSubtitlesPanel;
PlayListWindow* fPlaylistWindow; PlayListWindow* fPlaylistWindow;
PreferencesWindow* fPreferencesWindow; PreferencesWindow* fPreferencesWindow;
BMenuBar* fMenuBar; MessagesWindow* fMessagesWindow;
BMenuItem* fNextTitleMI; BMenuBar* fMenuBar;
BMenuItem* fPrevTitleMI; BMenuItem* fNextTitleMI;
BMenuItem* fNextChapterMI; BMenuItem* fPrevTitleMI;
BMenuItem* fPrevChapterMI; BMenuItem* fNextChapterMI;
BMenuItem* fOnTopMI; BMenuItem* fPrevChapterMI;
BMenuItem* fSlowerMI; BMenuItem* fOnTopMI;
BMenuItem* fNormalMI; BMenuItem* fSlowerMI;
BMenuItem* fFasterMI; BMenuItem* fNormalMI;
BMenuItem* fPreferencesMI; BMenuItem* fFasterMI;
BMenu* fAudioMenu; BMenu* fAudioMenu;
BMenu* fNavigationMenu; BMenu* fNavigationMenu;
BMenu* fTitleMenu; BMenu* fTitleMenu;
BMenu* fChapterMenu; BMenu* fChapterMenu;
BMenu* fLanguageMenu; BMenu* fLanguageMenu;
BMenu* fSubtitlesMenu; BMenu* fSubtitlesMenu;
BMenu* fSpeedMenu; BMenu* fSpeedMenu;
BMenu* fSettingsMenu; BMenu* fShowMenu;
bigtime_t fLastUpdateTime; bigtime_t fLastUpdateTime;
VlcWrapper * p_wrapper; VlcWrapper * p_wrapper;
}; };
#endif // BEOS_INTERFACE_WINDOW_H #endif // BEOS_INTERFACE_WINDOW_H
/*****************************************************************************
* MessagesWindow.cpp: beos interface
*****************************************************************************
* Copyright (C) 1999, 2000, 2001 VideoLAN
* $Id: MessagesWindow.cpp,v 1.1 2003/01/25 20:15:41 titer Exp $
*
* Authors: Eric Petit <titer@videolan.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
/* BeOS headers */
#include <InterfaceKit.h>
/* VLC headers */
#include <vlc/vlc.h>
#include <vlc/intf.h>
/* BeOS module headers */
#include "VlcWrapper.h"
#include "MessagesWindow.h"
/*****************************************************************************
* MessagesWindow::MessagesWindow
*****************************************************************************/
MessagesWindow::MessagesWindow( intf_thread_t * p_intf,
BRect frame, const char * name )
: BWindow( frame, name, B_FLOATING_WINDOW_LOOK, B_NORMAL_WINDOW_FEEL,
B_NOT_ZOOMABLE )
{
this->p_intf = p_intf;
p_sub = p_intf->p_sys->p_sub;
BRect rect, rect2;
rect = Bounds();
rect.right -= B_V_SCROLL_BAR_WIDTH;
rect.bottom -= B_H_SCROLL_BAR_HEIGHT;
rect2 = rect;
rect2.InsetBy( 5, 5 );
fMessagesView = new BTextView( rect, "messages", rect2,
B_FOLLOW_ALL, B_WILL_DRAW );
fMessagesView->MakeEditable( false );
fScrollView = new BScrollView( "scrollview", fMessagesView, B_WILL_DRAW,
B_FOLLOW_ALL, true, true );
fScrollBar = fScrollView->ScrollBar( B_VERTICAL );
AddChild( fScrollView );
/* start window thread in hidden state */
Hide();
Show();
}
/*****************************************************************************
* MessagesWindow::~MessagesWindow
*****************************************************************************/
MessagesWindow::~MessagesWindow()
{
}
/*****************************************************************************
* MessagesWindow::QuitRequested
*****************************************************************************/
bool MessagesWindow::QuitRequested()
{
Hide();
return false;
}
/*****************************************************************************
* MessagesWindow::ReallyQuit
*****************************************************************************/
void MessagesWindow::ReallyQuit()
{
Hide();
Quit();
}
/*****************************************************************************
* MessagesWindow::UpdateMessages
*****************************************************************************/
void MessagesWindow::UpdateMessages()
{
int i_start;
vlc_mutex_lock( p_sub->p_lock );
int i_stop = *p_sub->pi_stop;
vlc_mutex_unlock( p_sub->p_lock );
if( p_sub->i_start != i_stop )
{
for( i_start = p_sub->i_start;
i_start != i_stop;
i_start = (i_start+1) % VLC_MSG_QSIZE )
{
/* Append all messages to log window */
/* textctrl->SetDefaultStyle( *dbg_attr );
(*textctrl) << p_sub->p_msg[i_start].psz_module; */
/* switch( p_sub->p_msg[i_start].i_type )
{
case VLC_MSG_INFO:
(*textctrl) << ": ";
textctrl->SetDefaultStyle( *info_attr );
break;
case VLC_MSG_ERR:
(*textctrl) << " error: ";
textctrl->SetDefaultStyle( *err_attr );
break;
case VLC_MSG_WARN:
(*textctrl) << " warning: ";
textctrl->SetDefaultStyle( *warn_attr );
break;
case VLC_MSG_DBG:
default:
(*textctrl) << " debug: ";
break;
} */
/* Add message */
fMessagesView->LockLooper();
fMessagesView->Insert( p_sub->p_msg[i_start].psz_msg );
fMessagesView->Insert( "\n" );
fMessagesView->UnlockLooper();
/* Scroll at the end */
fScrollBar->LockLooper();
float min, max;
fScrollBar->GetRange( &min, &max );
fScrollBar->SetValue( max );
fScrollBar->UnlockLooper();
}
vlc_mutex_lock( p_sub->p_lock );
p_sub->i_start = i_start;
vlc_mutex_unlock( p_sub->p_lock );
}
}
/*****************************************************************************
* MessagesWindow.h
*****************************************************************************
* Copyright (C) 1999, 2000, 2001 VideoLAN
* $Id: MessagesWindow.h,v 1.1 2003/01/25 20:15:41 titer Exp $
*
* Authors: Eric Petit <titer@videolan.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
#ifndef BEOS_MESSAGES_WINDOW_H
#define BEOS_MESSAGES_WINDOW_H
#include <Window.h>
class MessagesWindow : public BWindow
{
public:
MessagesWindow( intf_thread_t * p_intf,
BRect frame, const char * name );
virtual ~MessagesWindow();
virtual bool QuitRequested();
void ReallyQuit();
void UpdateMessages();
private:
intf_thread_t * p_intf;
msg_subscription_t * p_sub;
BView * fBackgroundView;
BTextView * fMessagesView;
BScrollView * fScrollView;
BScrollBar * fScrollBar;
};
#endif // BEOS_PREFERENCES_WINDOW_H
...@@ -15,6 +15,8 @@ SOURCES_beos = \ ...@@ -15,6 +15,8 @@ SOURCES_beos = \
modules/gui/beos/PlayListWindow.h \ modules/gui/beos/PlayListWindow.h \
modules/gui/beos/PreferencesWindow.cpp \ modules/gui/beos/PreferencesWindow.cpp \
modules/gui/beos/PreferencesWindow.h \ modules/gui/beos/PreferencesWindow.h \
modules/gui/beos/MessagesWindow.cpp \
modules/gui/beos/MessagesWindow.h \
modules/gui/beos/MediaControlView.cpp \ modules/gui/beos/MediaControlView.cpp \
modules/gui/beos/MediaControlView.h \ modules/gui/beos/MediaControlView.h \
modules/gui/beos/VlcWrapper.cpp \ modules/gui/beos/VlcWrapper.cpp \
......
...@@ -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.4 2003/01/14 14:48:55 titer Exp $ * $Id: MsgVals.h,v 1.5 2003/01/25 20:15:41 titer 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>
...@@ -25,47 +25,48 @@ ...@@ -25,47 +25,48 @@
#ifndef BEOS_MESSAGE_VALUES_H #ifndef BEOS_MESSAGE_VALUES_H
#define BEOS_MESSAGE_VALUES_H #define BEOS_MESSAGE_VALUES_H
#define PLAYING 0 #define PLAYING 0
#define PAUSED 1 #define PAUSED 1
const uint32 OPEN_FILE = 'opfl'; const uint32 OPEN_FILE = 'opfl';
const uint32 OPEN_DVD = 'opdv'; const uint32 OPEN_DVD = 'opdv';
const uint32 LOAD_SUBFILE = 'losu'; const uint32 LOAD_SUBFILE = 'losu';
const uint32 SUBFILE_RECEIVED = 'sure'; const uint32 SUBFILE_RECEIVED = 'sure';
const uint32 OPEN_PLAYLIST = 'oppl'; const uint32 OPEN_PLAYLIST = 'oppl';
const uint32 STOP_PLAYBACK = 'stpl'; const uint32 STOP_PLAYBACK = 'stpl';
const uint32 START_PLAYBACK = 'play'; const uint32 START_PLAYBACK = 'play';
const uint32 PAUSE_PLAYBACK = 'papl'; const uint32 PAUSE_PLAYBACK = 'papl';
const uint32 FASTER_PLAY = 'fapl'; const uint32 FASTER_PLAY = 'fapl';
const uint32 SLOWER_PLAY = 'slpl'; const uint32 SLOWER_PLAY = 'slpl';
const uint32 NORMAL_PLAY = 'nrpl'; const uint32 NORMAL_PLAY = 'nrpl';
const uint32 SEEK_PLAYBACK = 'seek'; const uint32 SEEK_PLAYBACK = 'seek';
const uint32 VOLUME_CHG = 'voch'; const uint32 VOLUME_CHG = 'voch';
const uint32 VOLUME_MUTE = 'mute'; const uint32 VOLUME_MUTE = 'mute';
const uint32 SELECT_CHANNEL = 'chan'; const uint32 SELECT_CHANNEL = 'chan';
const uint32 SELECT_SUBTITLE = 'subt'; const uint32 SELECT_SUBTITLE = 'subt';
const uint32 PREV_TITLE = 'prti'; const uint32 PREV_TITLE = 'prti';
const uint32 NEXT_TITLE = 'nxti'; const uint32 NEXT_TITLE = 'nxti';
const uint32 TOGGLE_TITLE = 'tgti'; const uint32 TOGGLE_TITLE = 'tgti';
const uint32 PREV_CHAPTER = 'prch'; const uint32 PREV_CHAPTER = 'prch';
const uint32 NEXT_CHAPTER = 'nxch'; const uint32 NEXT_CHAPTER = 'nxch';
const uint32 TOGGLE_CHAPTER = 'tgch'; const uint32 TOGGLE_CHAPTER = 'tgch';
const uint32 PREV_FILE = 'prfl'; const uint32 PREV_FILE = 'prfl';
const uint32 NEXT_FILE = 'nxfl'; const uint32 NEXT_FILE = 'nxfl';
const uint32 NAVIGATE_PREV = 'navp'; // could be chapter, title or file const uint32 NAVIGATE_PREV = 'navp'; // could be chapter, title or file
const uint32 NAVIGATE_NEXT = 'navn'; // could be chapter, title or file const uint32 NAVIGATE_NEXT = 'navn'; // could be chapter, title or file
const uint32 OPEN_PREFERENCES = 'pref'; const uint32 OPEN_PREFERENCES = 'pref';
const uint32 TOGGLE_ON_TOP = 'ontp'; const uint32 OPEN_MESSAGES = 'mess';
const uint32 TOGGLE_FULL_SCREEN = 'tgfs'; const uint32 TOGGLE_ON_TOP = 'ontp';
const uint32 RESIZE_50 = 'rshl'; const uint32 TOGGLE_FULL_SCREEN = 'tgfs';
const uint32 RESIZE_100 = 'rsor'; const uint32 RESIZE_50 = 'rshl';
const uint32 RESIZE_200 = 'rsdb'; const uint32 RESIZE_100 = 'rsor';
const uint32 RESIZE_TRUE = 'rstr'; const uint32 RESIZE_200 = 'rsdb';
const uint32 ASPECT_CORRECT = 'asco'; const uint32 RESIZE_TRUE = 'rstr';
const uint32 VERT_SYNC = 'vsyn'; const uint32 ASPECT_CORRECT = 'asco';
const uint32 WINDOW_FEEL = 'wfel'; const uint32 VERT_SYNC = 'vsyn';
const uint32 SCREEN_SHOT = 'scrn'; const uint32 WINDOW_FEEL = 'wfel';
const uint32 INTERFACE_CREATED = 'ifcr'; /* see VlcApplication::MessageReceived() const uint32 SCREEN_SHOT = 'scrn';
const uint32 INTERFACE_CREATED = 'ifcr'; /* see VlcApplication::MessageReceived()
* in src/misc/beos_specific.cpp */ * in src/misc/beos_specific.cpp */
#endif // BEOS_MESSAGE_VALUES_H #endif // BEOS_MESSAGE_VALUES_H
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* PreferencesWindow.cpp: beos interface * PreferencesWindow.cpp: beos interface
***************************************************************************** *****************************************************************************
* Copyright (C) 1999, 2000, 2001 VideoLAN * Copyright (C) 1999, 2000, 2001 VideoLAN
* $Id: PreferencesWindow.cpp,v 1.8 2003/01/17 18:19:43 titer Exp $ * $Id: PreferencesWindow.cpp,v 1.9 2003/01/25 20:15:41 titer Exp $
* *
* Authors: Eric Petit <titer@videolan.org> * Authors: Eric Petit <titer@videolan.org>
* *
...@@ -37,12 +37,12 @@ ...@@ -37,12 +37,12 @@
/***************************************************************************** /*****************************************************************************
* Preferences::PreferencesWindow * Preferences::PreferencesWindow
*****************************************************************************/ *****************************************************************************/
PreferencesWindow::PreferencesWindow( BRect frame, const char* name, PreferencesWindow::PreferencesWindow( intf_thread_t * p_intf,
intf_thread_t *p_interface ) BRect frame, const char * name )
: BWindow( frame, name, B_FLOATING_WINDOW_LOOK, B_NORMAL_WINDOW_FEEL, : BWindow( frame, name, B_FLOATING_WINDOW_LOOK, B_NORMAL_WINDOW_FEEL,
B_NOT_ZOOMABLE | B_NOT_RESIZABLE | B_NOT_CLOSABLE ) B_NOT_ZOOMABLE | B_NOT_RESIZABLE | B_NOT_CLOSABLE )
{ {
p_intf = p_interface; this->p_intf = p_intf;
BRect rect; BRect rect;
/* "background" view */ /* "background" view */
...@@ -132,8 +132,6 @@ PreferencesWindow::PreferencesWindow( BRect frame, const char* name, ...@@ -132,8 +132,6 @@ PreferencesWindow::PreferencesWindow( BRect frame, const char* name,
rect.top = rect.bottom - 10; rect.top = rect.bottom - 10;
fRestartString = new BStringView( rect, NULL, fRestartString = new BStringView( rect, NULL,
"Warning: changing settings after starting playback may have no effect." ); "Warning: changing settings after starting playback may have no effect." );
/*rgb_color redColor = {255, 0, 0, 255};
fRestartString->SetHighColor(redColor);*/
fRestartString->SetAlignment( B_ALIGN_CENTER ); fRestartString->SetAlignment( B_ALIGN_CENTER );
fPrefsView->AddChild( fRestartString ); fPrefsView->AddChild( fRestartString );
...@@ -154,9 +152,9 @@ PreferencesWindow::PreferencesWindow( BRect frame, const char* name, ...@@ -154,9 +152,9 @@ PreferencesWindow::PreferencesWindow( BRect frame, const char* name,
button = new BButton( rect, NULL, "Defaults", new BMessage( PREFS_DEFAULTS ) ); button = new BButton( rect, NULL, "Defaults", new BMessage( PREFS_DEFAULTS ) );
fPrefsView->AddChild( button ); fPrefsView->AddChild( button );
// start window thread in hidden state // start window thread in hidden state
Hide(); Hide();
Show(); Show();
} }
/***************************************************************************** /*****************************************************************************
...@@ -171,36 +169,36 @@ PreferencesWindow::~PreferencesWindow() ...@@ -171,36 +169,36 @@ PreferencesWindow::~PreferencesWindow()
*****************************************************************************/ *****************************************************************************/
void PreferencesWindow::MessageReceived( BMessage * p_message ) void PreferencesWindow::MessageReceived( BMessage * p_message )
{ {
switch ( p_message->what ) switch ( p_message->what )
{ {
case DVDOLD_CHECK: case DVDOLD_CHECK:
case SLIDER_UPDATE: case SLIDER_UPDATE:
{ {
ApplyChanges(); ApplyChanges();
break; break;
} }
case PREFS_DEFAULTS: case PREFS_DEFAULTS:
{ {
SetDefaults(); SetDefaults();
ApplyChanges(); ApplyChanges();
break; break;
} }
case PREFS_SAVE: case PREFS_SAVE:
{ {
config_SaveConfigFile( p_intf, "main" ); config_SaveConfigFile( p_intf, "main" );
config_SaveConfigFile( p_intf, "adjust" ); config_SaveConfigFile( p_intf, "adjust" );
config_SaveConfigFile( p_intf, "ffmpeg" ); config_SaveConfigFile( p_intf, "ffmpeg" );
break; break;
} }
case PREFS_OK: case PREFS_OK:
{ {
Hide(); Hide();
break; break;
} }
default: default:
BWindow::MessageReceived( p_message ); BWindow::MessageReceived( p_message );
break; break;
} }
} }
/***************************************************************************** /*****************************************************************************
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* PreferencesWindow.h * PreferencesWindow.h
***************************************************************************** *****************************************************************************
* Copyright (C) 1999, 2000, 2001 VideoLAN * Copyright (C) 1999, 2000, 2001 VideoLAN
* $Id: PreferencesWindow.h,v 1.6 2003/01/17 18:19:43 titer Exp $ * $Id: PreferencesWindow.h,v 1.7 2003/01/25 20:15:41 titer Exp $
* *
* Authors: Eric Petit <titer@videolan.org> * Authors: Eric Petit <titer@videolan.org>
* *
...@@ -38,9 +38,9 @@ ...@@ -38,9 +38,9 @@
class PreferencesWindow : public BWindow class PreferencesWindow : public BWindow
{ {
public: public:
PreferencesWindow( BRect frame, PreferencesWindow( intf_thread_t * p_intf,
const char* name, BRect frame,
intf_thread_t *p_interface ); const char * name );
virtual ~PreferencesWindow(); virtual ~PreferencesWindow();
virtual void MessageReceived(BMessage *message); virtual void MessageReceived(BMessage *message);
void ReallyQuit(); void ReallyQuit();
...@@ -65,5 +65,5 @@ class PreferencesWindow : public BWindow ...@@ -65,5 +65,5 @@ class PreferencesWindow : public BWindow
intf_thread_t * p_intf; intf_thread_t * p_intf;
}; };
#endif // BEOS_PREFERENCES_WINDOW_H #endif // BEOS_PREFERENCES_WINDOW_H
...@@ -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.15 2003/01/22 01:13:22 titer Exp $ * $Id: VlcWrapper.h,v 1.16 2003/01/25 20:15:41 titer 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>
...@@ -35,16 +35,18 @@ class VlcWrapper; ...@@ -35,16 +35,18 @@ class VlcWrapper;
*****************************************************************************/ *****************************************************************************/
struct intf_sys_t struct intf_sys_t
{ {
InterfaceWindow * p_window; msg_subscription_t * p_sub;
InterfaceWindow * p_window;
vlc_bool_t b_loop; vlc_bool_t b_loop;
vlc_bool_t b_mute; vlc_bool_t b_mute;
int i_part; int i_part;
audio_volume_t i_saved_volume; audio_volume_t i_saved_volume;
int i_channel; int i_channel;
bool b_dvdold; bool b_dvdold;
VlcWrapper * p_wrapper; VlcWrapper * p_wrapper;
}; };
/***************************************************************************** /*****************************************************************************
...@@ -94,8 +96,8 @@ public: ...@@ -94,8 +96,8 @@ public:
void PlaylistJumpTo( int ); void PlaylistJumpTo( int );
void GetNavCapabilities( bool * canSkipPrev, void GetNavCapabilities( bool * canSkipPrev,
bool * canSkipNext ); bool * canSkipNext );
void NavigatePrev(); void NavigatePrev();
void NavigateNext(); void NavigateNext();
/* Audio */ /* Audio */
bool HasAudio(); bool HasAudio();
...@@ -124,8 +126,8 @@ public: ...@@ -124,8 +126,8 @@ public:
void LoadSubFile( char * psz_file ); void LoadSubFile( char * psz_file );
private: private:
intf_thread_t * p_intf; intf_thread_t * p_intf;
input_thread_t * p_input; input_thread_t * p_input;
playlist_t * p_playlist; playlist_t * p_playlist;
aout_instance_t * p_aout; aout_instance_t * p_aout;
}; };
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