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 )