* InterfaceWindow.cpp: beos interface
*****************************************************************************
* Copyright (C) 1999, 2000, 2001 VideoLAN
- * $Id: InterfaceWindow.cpp,v 1.26 2003/02/01 12:01:10 stippi Exp $
+ * $Id: InterfaceWindow.cpp,v 1.34 2003/04/22 16:36:16 titer Exp $
*
* Authors: Jean-Marc Dressler <polux@via.ecp.fr>
* Samuel Hocevar <sam@zoy.org>
#define INTERFACE_UPDATE_TIMEOUT 80000 // 2 frames if at 25 fps
#define INTERFACE_LOCKING_TIMEOUT 5000
+#define USE_VLC_CONFIG_FILE 0
// make_sure_frame_is_on_screen
bool
return success;
}
+// collect_folder_contents
+void
+collect_folder_contents( BDirectory& dir, BList& list, bool& deep, bool& asked, BEntry& entry )
+{
+ while ( dir.GetNextEntry( &entry, true ) == B_OK )
+ {
+ if ( !entry.IsDirectory() )
+ {
+ BPath path;
+ // since the directory will give us the entries in reverse order,
+ // we put them each at the same index, effectively reversing the
+ // items while adding them
+ if ( entry.GetPath( &path ) == B_OK )
+ {
+ BString* string = new BString( path.Path() );
+ if ( !list.AddItem( string, 0 ) )
+ delete string; // at least don't leak
+ }
+ }
+ else
+ {
+ if ( !asked )
+ {
+ // ask user if we should parse sub-folders as well
+ BAlert* alert = new BAlert( "sub-folders?",
+ _("Open files from all sub-folders as well?"),
+ _("No"), _("Yes"), NULL, B_WIDTH_AS_USUAL,
+ B_IDEA_ALERT );
+ int32 buttonIndex = alert->Go();
+ deep = buttonIndex == 1;
+ asked = true;
+ // never delete BAlerts!!
+ }
+ if ( deep )
+ {
+ BDirectory subDir( &entry );
+ if ( subDir.InitCheck() == B_OK )
+ collect_folder_contents( subDir, list,
+ deep, asked, entry );
+ }
+ }
+ }
+}
+
/*****************************************************************************
* InterfaceWindow
( screen_rect.bottom - PREFS_WINDOW_HEIGHT ) / 2,
( screen_rect.right + PREFS_WINDOW_WIDTH ) / 2,
( screen_rect.bottom + PREFS_WINDOW_HEIGHT ) / 2 );
- fPreferencesWindow = new PreferencesWindow( p_intf, window_rect, "Preferences" );
+ fPreferencesWindow = new PreferencesWindow( p_intf, window_rect, _("Settings") );
window_rect.Set( screen_rect.right - 500,
screen_rect.top + 50,
screen_rect.right - 150,
screen_rect.top + 250 );
- fPlaylistWindow = new PlayListWindow( window_rect, "Playlist", this, p_intf );
+ 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 );
+ fMessagesWindow = new MessagesWindow( p_intf, window_rect, _("Messages") );
// the media control view
p_mediaControl = new MediaControlView( BRect( 0.0, 0.0, 250.0, 50.0 ),
AddChild( p_mediaControl );
// Add the file Menu
- BMenu* fileMenu = new BMenu( "File" );
+ BMenu* fileMenu = new BMenu( _("File") );
fMenuBar->AddItem( fileMenu );
- fileMenu->AddItem( new BMenuItem( "Open File" B_UTF8_ELLIPSIS,
+ fileMenu->AddItem( new BMenuItem( _AddEllipsis(_("Open Subtitles")),
new BMessage( OPEN_FILE ), 'O') );
- fileMenu->AddItem( new CDMenu( "Open Disc" ) );
+ fileMenu->AddItem( new CDMenu( _("Open Disc") ) );
- fileMenu->AddItem( new BMenuItem( "Open Subtitles" B_UTF8_ELLIPSIS,
+ fileMenu->AddItem( new BMenuItem( _AddEllipsis(_("Open Subtitles")),
new BMessage( LOAD_SUBFILE ) ) );
fileMenu->AddSeparatorItem();
- BMenuItem* item = new BMenuItem( "About" B_UTF8_ELLIPSIS,
+ BMenuItem* item = new BMenuItem( _AddEllipsis(_("About")),
new BMessage( B_ABOUT_REQUESTED ), 'A');
item->SetTarget( be_app );
fileMenu->AddItem( item );
- fileMenu->AddItem( new BMenuItem( "Quit", new BMessage( B_QUIT_REQUESTED ), 'Q') );
+ 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);
+ fLanguageMenu = new LanguageMenu( _("Language"), AUDIO_ES, p_wrapper);
+ fSubtitlesMenu = new LanguageMenu( _("Subtitles"), SPU_ES, p_wrapper);
/* Add the Audio menu */
- fAudioMenu = new BMenu( "Audio" );
+ 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 ) );
+ 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 ) );
+ fGotoMenuMI = new BMenuItem( _("Goto Menu"), new BMessage( NAVIGATE_MENU ) );
/* Add the Navigation menu */
- fNavigationMenu = new BMenu( "Navigation" );
+ fNavigationMenu = new BMenu( _("Navigation") );
fMenuBar->AddItem( fNavigationMenu );
+ fNavigationMenu->AddItem( fGotoMenuMI );
+ fNavigationMenu->AddSeparatorItem();
fNavigationMenu->AddItem( fPrevTitleMI );
fNavigationMenu->AddItem( fNextTitleMI );
- fNavigationMenu->AddItem( fTitleMenu = new TitleMenu( "Go to Title", p_intf ) );
+ 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 ) );
+ fNavigationMenu->AddItem( fChapterMenu = new ChapterMenu( _("Go to Chapter"), p_intf ) );
/* Add the Speed menu */
- fSpeedMenu = new BMenu( "Speed" );
+ 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 ) );
+ 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->AddItem( fFasterMI = new BMenuItem( _("Faster"), new BMessage( FASTER_PLAY) ) );
fSpeedMenu->SetTargetForItems( this );
fMenuBar->AddItem( fSpeedMenu );
/* Add the Show menu */
- fShowMenu = new BMenu( "Window" );
- fShowMenu->AddItem( new BMenuItem( "Play List" B_UTF8_ELLIPSIS,
+ fShowMenu = new BMenu( _("Window") );
+ fShowMenu->AddItem( new BMenuItem( _AddEllipsis(_("Play List")),
new BMessage( OPEN_PLAYLIST ), 'P') );
- fShowMenu->AddItem( new BMenuItem( "Messages" B_UTF8_ELLIPSIS,
+ fShowMenu->AddItem( new BMenuItem( _AddEllipsis(_("Messages")),
new BMessage( OPEN_MESSAGES ), 'M' ) );
- fShowMenu->AddItem( new BMenuItem( "Settings" B_UTF8_ELLIPSIS,
+ fShowMenu->AddItem( new BMenuItem( _AddEllipsis(_("Settings")),
new BMessage( OPEN_PREFERENCES ), 'S' ) );
fMenuBar->AddItem( fShowMenu );
_SetMenusEnabled( false );
p_mediaControl->SetEnabled( false );
- _RestoreSettings();
-
-/* // Restore interface settings
- // main window size and position
- int i_width = config_GetInt( p_intf, "beos-intf-width" ),
- i_height = config_GetInt( p_intf, "beos-intf-height" ),
- i_xpos = config_GetInt( p_intf, "beos-intf-xpos" ),
- i_ypos = config_GetInt( p_intf, "beos-intf-ypos" );
- if( i_width > 20 && i_height > 20 && i_xpos >= 0 && i_ypos >= 0 )
- {
- BRect r( i_xpos, i_ypos, i_xpos + i_width, i_ypos + i_height );
-
- float minWidth, maxWidth, minHeight, maxHeight;
- GetSizeLimits( &minWidth, &maxWidth, &minHeight, &maxHeight );
+ _RestoreSettings();
- make_sure_frame_is_within_limits( r, minWidth, minHeight, maxWidth, maxHeight );
- if ( make_sure_frame_is_on_screen( r ) )
- {
- ResizeTo( r.Width(), r.Height() );
- MoveTo( r.LeftTop() );
- }
- }
- // playlist window size and position
- i_width = config_GetInt( p_intf, "beos-playlist-width" ),
- i_height = config_GetInt( p_intf, "beos-playlist-height" ),
- i_xpos = config_GetInt( p_intf, "beos-playlist-xpos" ),
- i_ypos = config_GetInt( p_intf, "beos-playlist-ypos" );
- if( i_width > 20 && i_height > 20 && i_xpos >= 0 && i_ypos >= 0 )
- {
- BRect r( i_xpos, i_ypos, i_xpos + i_width, i_ypos + i_height );
-
- float minWidth, maxWidth, minHeight, maxHeight;
- fPlaylistWindow->GetSizeLimits( &minWidth, &maxWidth, &minHeight, &maxHeight );
-
- make_sure_frame_is_within_limits( r, minWidth, minHeight, maxWidth, maxHeight );
- if ( make_sure_frame_is_on_screen( r ) )
- {
- fPlaylistWindow->ResizeTo( r.Width(), r.Height() );
- fPlaylistWindow->MoveTo( r.LeftTop() );
- }
- }
- // child windows are not running yet, that's why we aint locking them
- // playlist showing
- // messages window size and position
- i_width = config_GetInt( p_intf, "beos-messages-width" ),
- i_height = config_GetInt( p_intf, "beos-messages-height" ),
- i_xpos = config_GetInt( p_intf, "beos-messages-xpos" ),
- i_ypos = config_GetInt( p_intf, "beos-messages-ypos" );
- if( i_width && i_height && i_xpos && i_ypos )
- {
- BRect r( i_xpos, i_ypos, i_xpos + i_width, i_ypos + i_height );
-
- float minWidth, maxWidth, minHeight, maxHeight;
- fMessagesWindow->GetSizeLimits( &minWidth, &maxWidth, &minHeight, &maxHeight );
-
- make_sure_frame_is_within_limits( r, minWidth, minHeight, maxWidth, maxHeight );
- if ( make_sure_frame_is_on_screen( r ) )
- {
- fMessagesWindow->ResizeTo( r.Width(), r.Height() );
- fMessagesWindow->MoveTo( r.LeftTop() );
- }
- }
- if( config_GetInt( p_intf, "beos-playlist-show" ) )
- {
- fPlaylistWindow->Show();
- }
- else
- {
- fPlaylistWindow->Hide();
- fPlaylistWindow->Show();
- }
- // messages window size and position
- i_width = config_GetInt( p_intf, "beos-messages-width" ),
- i_height = config_GetInt( p_intf, "beos-messages-height" ),
- i_xpos = config_GetInt( p_intf, "beos-messages-xpos" ),
- i_ypos = config_GetInt( p_intf, "beos-messages-ypos" );
- if( i_width > 20 && i_height > 20 && i_xpos >= 0 && i_ypos >= 0 )
- {
- BRect r( i_xpos, i_ypos, i_xpos + i_width, i_ypos + i_height );
- float minWidth, maxWidth, minHeight, maxHeight;
- fMessagesWindow->GetSizeLimits( &minWidth, &maxWidth, &minHeight, &maxHeight );
-
- make_sure_frame_is_within_limits( r, minWidth, minHeight, maxWidth, maxHeight );
- if ( make_sure_frame_is_on_screen( r ) )
- {
- fMessagesWindow->ResizeTo( r.Width(), r.Height() );
- fMessagesWindow->MoveTo( r.LeftTop() );
- }
- }
- // messages showing
- if( config_GetInt( p_intf, "beos-messages-show" ) )
- {
- fMessagesWindow->Show();
- }
- else
- {
- fMessagesWindow->Hide();
- fMessagesWindow->Show();
- }*/
-
Show();
}
if( fMessagesWindow )
fMessagesWindow->ReallyQuit();
fMessagesWindow = NULL;
+ if( fPreferencesWindow )
+ fPreferencesWindow->ReallyQuit();
+ fPreferencesWindow = NULL;
delete fFilePanel;
delete fSettings;
}
{
case B_ABOUT_REQUESTED:
{
- BAlert* alert = new BAlert( VOUT_TITLE,
- "BeOS " VOUT_TITLE "\n\n<www.videolan.org>", "Ok");
+ BAlert* alert = new BAlert( "VLC " PACKAGE_VERSION,
+ "VLC " PACKAGE_VERSION " for BeOS"
+ "\n\n<www.videolan.org>", _("OK"));
alert->Go();
break;
}
break;
case OPEN_FILE:
- _ShowFilePanel( B_REFS_RECEIVED, "VideoLAN Client: Open Media Files" );
+ _ShowFilePanel( B_REFS_RECEIVED, _("VideoLAN Client: Open Media Files") );
break;
case LOAD_SUBFILE:
- _ShowFilePanel( SUBFILE_RECEIVED, "VideoLAN Client: Open Subtitle File" );
+ _ShowFilePanel( SUBFILE_RECEIVED, _("VideoLAN Client: Open Subtitle File") );
break;
case OPEN_PLAYLIST:
p_wrapper->NextTitle();
break;
}
+ case NAVIGATE_MENU:
+ p_wrapper->ToggleTitle( 0 );
+ break;
case TOGGLE_TITLE:
if ( playback_status > UNDEF_S )
{
p_wrapper->NavigateNext();
break;
// drag'n'drop and system messages
+ case MSG_SOUNDPLAY:
+ // convert soundplay drag'n'drop message (containing paths)
+ // to normal message (containing refs)
+ {
+ const char* path;
+ for ( int32 i = 0; p_message->FindString( "path", i, &path ) == B_OK; i++ )
+ {
+ entry_ref ref;
+ if ( get_ref_for_path( path, &ref ) == B_OK )
+ p_message->AddRef( "refs", &ref );
+ }
+ }
+ // fall through
case B_REFS_RECEIVED:
case B_SIMPLE_DATA:
{
* file(s) opened by drag & drop -> replace playlist;
* file(s) opened by 'shift' + drag & drop -> append */
bool replace = false;
+ bool reverse = false;
if ( p_message->WasDropped() )
+ {
replace = !( modifiers() & B_SHIFT_KEY );
+ reverse = true;
+ }
// build list of files to be played from message contents
entry_ref ref;
BList files;
- for ( int i = 0; p_message->FindRef( "refs", i, &ref ) == B_OK; i++ )
- {
- BPath path( &ref );
- if ( path.InitCheck() == B_OK )
- {
- bool add = true;
- // has the user dropped a folder?
- BDirectory dir( &ref );
- if ( dir.InitCheck() == B_OK)
- {
- // has the user dropped a dvd disk icon?
- // TODO: this code does not work for the following situation:
- // if the user dropped the icon for his partition containing
- // all his mp3 files, this routine will not do anything, because
- // the folder that was dropped is a root folder, but no DVD drive
- if ( dir.IsRootDirectory() )
- {
- BVolumeRoster volRoster;
- BVolume vol;
- BDirectory volumeRoot;
- status_t status = volRoster.GetNextVolume( &vol );
- while ( status == B_NO_ERROR )
+
+ // if we should parse sub-folders as well
+ bool askedAlready = false;
+ bool parseSubFolders = askedAlready;
+ // traverse refs in reverse order
+ int32 count;
+ type_code dummy;
+ if ( p_message->GetInfo( "refs", &dummy, &count ) == B_OK && count > 0 )
+ {
+ int32 i = reverse ? count - 1 : 0;
+ int32 increment = reverse ? -1 : 1;
+ for ( ; p_message->FindRef( "refs", i, &ref ) == B_OK; i += increment )
+ {
+ BPath path( &ref );
+ if ( path.InitCheck() == B_OK )
+ {
+ bool add = true;
+ // has the user dropped a folder?
+ BDirectory dir( &ref );
+ if ( dir.InitCheck() == B_OK)
+ {
+ // has the user dropped a dvd disk icon?
+ if ( dir.IsRootDirectory() )
{
- if ( vol.GetRootDirectory( &volumeRoot ) == B_OK
- && dir == volumeRoot )
+ BVolumeRoster volRoster;
+ BVolume vol;
+ BDirectory volumeRoot;
+ status_t status = volRoster.GetNextVolume( &vol );
+ while ( status == B_NO_ERROR )
{
- BString volumeName;
- BString deviceName;
- bool isCDROM;
- if ( get_volume_info( vol, volumeName, isCDROM, deviceName )
- && isCDROM )
+ if ( vol.GetRootDirectory( &volumeRoot ) == B_OK
+ && dir == volumeRoot )
{
- BMessage msg( OPEN_DVD );
- msg.AddString( "device", deviceName.String() );
- PostMessage( &msg );
- add = false;
+ BString volumeName;
+ BString deviceName;
+ bool isCDROM;
+ if ( get_volume_info( vol, volumeName, isCDROM, deviceName )
+ && isCDROM )
+ {
+ BMessage msg( OPEN_DVD );
+ msg.AddString( "device", deviceName.String() );
+ PostMessage( &msg );
+ add = false;
+ }
+ break;
+ }
+ else
+ {
+ vol.Unset();
+ status = volRoster.GetNextVolume( &vol );
}
- break;
- }
- else
- {
- vol.Unset();
- status = volRoster.GetNextVolume( &vol );
}
}
- }
- else
- {
- // add all files from the dropped folder
- // TODO: do this recursively
- dir.Rewind();
- add = false;
- BEntry entry;
- while ( dir.GetNextEntry( &entry ) == B_OK )
- {
- // ", 0" is because we receive the files in reverse order
- if ( !entry.IsDirectory() && entry.GetPath( &path ) == B_OK )
- files.AddItem( new BString( path.Path() ), 0 );
- }
- }
- }
- if( add )
- {
- files.AddItem( new BString( path.Path() ) );
- }
- }
- }
- // give the list to VLC
- // BString objects allocated here will be deleted there
- int32 index;
- if ( p_message->FindInt32("drop index", &index) != B_OK )
- index = -1;
- p_wrapper->OpenFiles( &files, replace, index );
- _UpdatePlaylist();
+ if ( add )
+ {
+ add = false;
+ dir.Rewind(); // defensive programming
+ BEntry entry;
+ collect_folder_contents( dir, files,
+ parseSubFolders,
+ askedAlready,
+ entry );
+ }
+ }
+ if ( add )
+ {
+ BString* string = new BString( path.Path() );
+ if ( !files.AddItem( string, 0 ) )
+ delete string; // at least don't leak
+ }
+ }
+ }
+ // give the list to VLC
+ // BString objects allocated here will be deleted there
+ int32 index;
+ if ( p_message->FindInt32("drop index", &index) != B_OK )
+ index = -1;
+ p_wrapper->OpenFiles( &files, replace, index );
+ _UpdatePlaylist();
+ }
}
break;
}
break;
}
-
+ case MSG_UPDATE:
+ UpdateInterface();
+ break;
default:
BWindow::MessageReceived( p_message );
break;
p_wrapper->PlaylistStop();
p_mediaControl->SetStatus(NOT_STARTED_S, DEFAULT_RATE);
- /* Save interface settings */
-/* BRect frame = Frame();
- config_PutInt( p_intf, "beos-intf-width", (int)frame.Width() );
- config_PutInt( p_intf, "beos-intf-height", (int)frame.Height() );
- config_PutInt( p_intf, "beos-intf-xpos", (int)frame.left );
- config_PutInt( p_intf, "beos-intf-ypos", (int)frame.top );
- if( fPlaylistWindow->Lock() )
- {
- frame = fPlaylistWindow->Frame();
- config_PutInt( p_intf, "beos-playlist-width", (int)frame.Width() );
- config_PutInt( p_intf, "beos-playlist-height", (int)frame.Height() );
- config_PutInt( p_intf, "beos-playlist-xpos", (int)frame.left );
- config_PutInt( p_intf, "beos-playlist-ypos", (int)frame.top );
- config_PutInt( p_intf, "beos-playlist-show", !fPlaylistWindow->IsHidden() );
- fPlaylistWindow->Unlock();
- }
- if( fMessagesWindow->Lock() )
- {
- frame = fMessagesWindow->Frame();
- config_PutInt( p_intf, "beos-messages-width", (int)frame.Width() );
- config_PutInt( p_intf, "beos-messages-height", (int)frame.Height() );
- config_PutInt( p_intf, "beos-messages-xpos", (int)frame.left );
- config_PutInt( p_intf, "beos-messages-ypos", (int)frame.top );
- config_PutInt( p_intf, "beos-messages-show", !fMessagesWindow->IsHidden() );
- fMessagesWindow->Unlock();
- }*/
- config_SaveConfigFile( p_intf, "beos" );
_StoreSettings();
p_intf->b_die = 1;
p_wrapper->GetNavCapabilities( &canSkipPrev, &canSkipNext );
p_mediaControl->SetSkippable( canSkipPrev, canSkipNext );
- if ( p_wrapper->HasAudio() )
+ if ( p_wrapper->HasInput() )
{
p_mediaControl->SetAudioEnabled( true );
p_mediaControl->SetMuted( p_wrapper->IsMuted() );
}
else
{
- _SetMenusEnabled( false );
- if( !( p_wrapper->PlaylistSize() > 0 ) )
- p_mediaControl->SetEnabled( false );
- else
- p_mediaControl->SetProgress( 0 );
- }
-
- /* always force the user-specified volume */
- /* FIXME : I'm quite sure there is a cleaner way to do this */
- int i_volume = p_mediaControl->GetVolume();
- if( p_wrapper->GetVolume() != i_volume )
- {
- p_wrapper->SetVolume( i_volume );
+ if ( LockWithTimeout(INTERFACE_LOCKING_TIMEOUT) == B_OK )
+ {
+ _SetMenusEnabled( false );
+ if( !( p_wrapper->PlaylistSize() > 0 ) )
+ p_mediaControl->SetEnabled( false );
+ else
+ {
+ p_mediaControl->SetProgress( 0 );
+ // enable/disable skip buttons
+ bool canSkipPrev;
+ bool canSkipNext;
+ p_wrapper->GetNavCapabilities( &canSkipPrev, &canSkipNext );
+ p_mediaControl->SetSkippable( canSkipPrev, canSkipNext );
+ }
+ Unlock();
+ }
}
- // strangly, someone is calling this function even after the object has been destructed!
- // even more strangly, this workarround seems to work
- if (fMessagesWindow)
- fMessagesWindow->UpdateMessages();
-
fLastUpdateTime = system_time();
}
fSubtitlesMenu->SetEnabled( hasFile );
if ( fSpeedMenu->IsEnabled() != hasFile )
fSpeedMenu->SetEnabled( hasFile );
+ // "goto menu" menu item
+ bool hasMenu = p_intf->p_sys->b_dvdmenus ? hasTitles : false;
+ if ( fGotoMenuMI->IsEnabled() != hasMenu )
+ fGotoMenuMI->SetEnabled( hasMenu );
Unlock();
}
}
{
if( !fFilePanel )
{
- fFilePanel = new BFilePanel();
+ fFilePanel = new BFilePanel( B_OPEN_PANEL, NULL, NULL,
+ B_FILE_NODE | B_DIRECTORY_NODE );
fFilePanel->SetTarget( this );
}
fFilePanel->Window()->SetTitle( windowTitle );
void
InterfaceWindow::_RestoreSettings()
{
- if ( load_settings( fSettings, "interface_settings", "VideoLAN Client" ) == B_OK )
+ if ( USE_VLC_CONFIG_FILE )
+ {
+ // main window size and position
+ int i_width = config_GetInt( p_intf, "beos-intf-width" ),
+ i_height = config_GetInt( p_intf, "beos-intf-height" ),
+ i_xpos = config_GetInt( p_intf, "beos-intf-xpos" ),
+ i_ypos = config_GetInt( p_intf, "beos-intf-ypos" );
+ if( i_width > 20 && i_height > 20 && i_xpos >= 0 && i_ypos >= 0 )
+ {
+ BRect r( i_xpos, i_ypos, i_xpos + i_width, i_ypos + i_height );
+ set_window_pos( this, r );
+ }
+ // playlist window size and position
+ i_width = config_GetInt( p_intf, "beos-playlist-width" ),
+ i_height = config_GetInt( p_intf, "beos-playlist-height" ),
+ i_xpos = config_GetInt( p_intf, "beos-playlist-xpos" ),
+ i_ypos = config_GetInt( p_intf, "beos-playlist-ypos" );
+ if( i_width > 20 && i_height > 20 && i_xpos >= 0 && i_ypos >= 0 )
+ {
+ BRect r( i_xpos, i_ypos, i_xpos + i_width, i_ypos + i_height );
+ set_window_pos( fPlaylistWindow, r );
+ }
+ // playlist showing
+ launch_window( fPlaylistWindow, config_GetInt( p_intf, "beos-playlist-show" ) );
+ // messages window size and position
+ i_width = config_GetInt( p_intf, "beos-messages-width" ),
+ i_height = config_GetInt( p_intf, "beos-messages-height" ),
+ i_xpos = config_GetInt( p_intf, "beos-messages-xpos" ),
+ i_ypos = config_GetInt( p_intf, "beos-messages-ypos" );
+ if( i_width > 20 && i_height > 20 && i_xpos >= 0 && i_ypos >= 0 )
+ {
+ BRect r( i_xpos, i_ypos, i_xpos + i_width, i_ypos + i_height );
+ set_window_pos( fMessagesWindow, r );
+ }
+ // messages showing
+ launch_window( fMessagesWindow, config_GetInt( p_intf, "beos-messages-show" ) );
+
+ // messages window size and position
+ i_width = config_GetInt( p_intf, "beos-settings-width" ),
+ i_height = config_GetInt( p_intf, "beos-settings-height" ),
+ i_xpos = config_GetInt( p_intf, "beos-settings-xpos" ),
+ i_ypos = config_GetInt( p_intf, "beos-settings-ypos" );
+ if( i_width > 20 && i_height > 20 && i_xpos >= 0 && i_ypos >= 0 )
+ {
+ BRect r( i_xpos, i_ypos, i_xpos + i_width, i_ypos + i_height );
+ set_window_pos( fPreferencesWindow, r );
+ }
+ // settings showing
+ launch_window( fPreferencesWindow, config_GetInt( p_intf, "beos-settings-show" ) );
+ }
+ else
{
- BRect frame;
- if ( fSettings->FindRect( "main frame", &frame ) == B_OK )
- set_window_pos( this, frame );
- if (fSettings->FindRect( "playlist frame", &frame ) == B_OK )
- set_window_pos( fPlaylistWindow, frame );
- if (fSettings->FindRect( "messages frame", &frame ) == B_OK )
- set_window_pos( fMessagesWindow, frame );
- if (fSettings->FindRect( "settings frame", &frame ) == B_OK )
- set_window_pos( fPreferencesWindow, frame );
-
- bool showing;
- if ( fSettings->FindBool( "playlist showing", &showing ) == B_OK )
- launch_window( fPlaylistWindow, showing );
- if ( fSettings->FindBool( "messages showing", &showing ) == B_OK )
- launch_window( fMessagesWindow, showing );
- if ( fSettings->FindBool( "settings showing", &showing ) == B_OK )
- launch_window( fPreferencesWindow, showing );
+ if ( load_settings( fSettings, "interface_settings", "VideoLAN Client" ) == B_OK )
+ {
+ BRect frame;
+ if ( fSettings->FindRect( "main frame", &frame ) == B_OK )
+ set_window_pos( this, frame );
+ if (fSettings->FindRect( "playlist frame", &frame ) == B_OK )
+ set_window_pos( fPlaylistWindow, frame );
+ if (fSettings->FindRect( "messages frame", &frame ) == B_OK )
+ set_window_pos( fMessagesWindow, frame );
+ if (fSettings->FindRect( "settings frame", &frame ) == B_OK )
+ set_window_pos( fPreferencesWindow, frame );
+
+ bool showing;
+ if ( fSettings->FindBool( "playlist showing", &showing ) == B_OK )
+ launch_window( fPlaylistWindow, showing );
+ if ( fSettings->FindBool( "messages showing", &showing ) == B_OK )
+ launch_window( fMessagesWindow, showing );
+ if ( fSettings->FindBool( "settings showing", &showing ) == B_OK )
+ launch_window( fPreferencesWindow, showing );
+
+ uint32 displayMode;
+ if ( fSettings->FindInt32( "playlist display mode", (int32*)&displayMode ) == B_OK )
+ fPlaylistWindow->SetDisplayMode( displayMode );
+ }
}
}
void
InterfaceWindow::_StoreSettings()
{
- if ( fSettings->ReplaceRect( "main frame", Frame() ) != B_OK )
- fSettings->AddRect( "main frame", Frame() );
- if ( fPlaylistWindow->Lock() )
+ if ( USE_VLC_CONFIG_FILE )
{
- if (fSettings->ReplaceRect( "playlist frame", fPlaylistWindow->Frame() ) != B_OK)
- fSettings->AddRect( "playlist frame", fPlaylistWindow->Frame() );
- if (fSettings->ReplaceBool( "playlist showing", !fPlaylistWindow->IsHidden() ) != B_OK)
- fSettings->AddBool( "playlist showing", !fPlaylistWindow->IsHidden() );
- fPlaylistWindow->Unlock();
+ // save interface settings in vlc config file
+ BRect frame = Frame();
+ config_PutInt( p_intf, "beos-intf-width", (int)frame.Width() );
+ config_PutInt( p_intf, "beos-intf-height", (int)frame.Height() );
+ config_PutInt( p_intf, "beos-intf-xpos", (int)frame.left );
+ config_PutInt( p_intf, "beos-intf-ypos", (int)frame.top );
+ if( fPlaylistWindow->Lock() )
+ {
+ frame = fPlaylistWindow->Frame();
+ config_PutInt( p_intf, "beos-playlist-width", (int)frame.Width() );
+ config_PutInt( p_intf, "beos-playlist-height", (int)frame.Height() );
+ config_PutInt( p_intf, "beos-playlist-xpos", (int)frame.left );
+ config_PutInt( p_intf, "beos-playlist-ypos", (int)frame.top );
+ config_PutInt( p_intf, "beos-playlist-show", !fPlaylistWindow->IsHidden() );
+ fPlaylistWindow->Unlock();
+ }
+ if( fMessagesWindow->Lock() )
+ {
+ frame = fMessagesWindow->Frame();
+ config_PutInt( p_intf, "beos-messages-width", (int)frame.Width() );
+ config_PutInt( p_intf, "beos-messages-height", (int)frame.Height() );
+ config_PutInt( p_intf, "beos-messages-xpos", (int)frame.left );
+ config_PutInt( p_intf, "beos-messages-ypos", (int)frame.top );
+ config_PutInt( p_intf, "beos-messages-show", !fMessagesWindow->IsHidden() );
+ fMessagesWindow->Unlock();
+ }
+ if( fPreferencesWindow->Lock() )
+ {
+ frame = fPreferencesWindow->Frame();
+ config_PutInt( p_intf, "beos-messages-width", (int)frame.Width() );
+ config_PutInt( p_intf, "beos-messages-height", (int)frame.Height() );
+ config_PutInt( p_intf, "beos-messages-xpos", (int)frame.left );
+ config_PutInt( p_intf, "beos-messages-ypos", (int)frame.top );
+ config_PutInt( p_intf, "beos-messages-show", !fPreferencesWindow->IsHidden() );
+ fPreferencesWindow->Unlock();
+ }
}
- if ( fMessagesWindow->Lock() )
- {
- if (fSettings->ReplaceRect( "messages frame", fMessagesWindow->Frame() ) != B_OK)
- fSettings->AddRect( "messages frame", fMessagesWindow->Frame() );
- if (fSettings->ReplaceBool( "messages showing", !fMessagesWindow->IsHidden() ) != B_OK)
- fSettings->AddBool( "messages showing", !fMessagesWindow->IsHidden() );
- fMessagesWindow->Unlock();
- }
- if ( fPreferencesWindow->Lock() )
- {
- if (fSettings->ReplaceRect( "settings frame", fPreferencesWindow->Frame() ) != B_OK)
- fSettings->AddRect( "settings frame", fPreferencesWindow->Frame() );
- if (fSettings->ReplaceBool( "settings showing", !fPreferencesWindow->IsHidden() ) != B_OK)
- fSettings->AddBool( "settings showing", !fPreferencesWindow->IsHidden() );
- fPreferencesWindow->Unlock();
- }
- save_settings( fSettings, "interface_settings", "VideoLAN Client" );
+ else
+ {
+ if ( fSettings->ReplaceRect( "main frame", Frame() ) != B_OK )
+ fSettings->AddRect( "main frame", Frame() );
+ if ( fPlaylistWindow->Lock() )
+ {
+ if (fSettings->ReplaceRect( "playlist frame", fPlaylistWindow->Frame() ) != B_OK)
+ fSettings->AddRect( "playlist frame", fPlaylistWindow->Frame() );
+ if (fSettings->ReplaceBool( "playlist showing", !fPlaylistWindow->IsHidden() ) != B_OK)
+ fSettings->AddBool( "playlist showing", !fPlaylistWindow->IsHidden() );
+ fPlaylistWindow->Unlock();
+ }
+ if ( fMessagesWindow->Lock() )
+ {
+ if (fSettings->ReplaceRect( "messages frame", fMessagesWindow->Frame() ) != B_OK)
+ fSettings->AddRect( "messages frame", fMessagesWindow->Frame() );
+ if (fSettings->ReplaceBool( "messages showing", !fMessagesWindow->IsHidden() ) != B_OK)
+ fSettings->AddBool( "messages showing", !fMessagesWindow->IsHidden() );
+ fMessagesWindow->Unlock();
+ }
+ if ( fPreferencesWindow->Lock() )
+ {
+ if (fSettings->ReplaceRect( "settings frame", fPreferencesWindow->Frame() ) != B_OK)
+ fSettings->AddRect( "settings frame", fPreferencesWindow->Frame() );
+ if (fSettings->ReplaceBool( "settings showing", !fPreferencesWindow->IsHidden() ) != B_OK)
+ fSettings->AddBool( "settings showing", !fPreferencesWindow->IsHidden() );
+ fPreferencesWindow->Unlock();
+ }
+ uint32 displayMode = fPlaylistWindow->DisplayMode();
+ if (fSettings->ReplaceInt32( "playlist display mode", displayMode ) != B_OK )
+ fSettings->AddInt32( "playlist display mode", displayMode );
+
+ save_settings( fSettings, "interface_settings", "VideoLAN Client" );
+ }
+
+ // save VLC internal settings
+ config_SaveConfigFile( p_intf, "beos" );
+ config_SaveConfigFile( p_intf, "main" );
+ config_SaveConfigFile( p_intf, "adjust" );
+ config_SaveConfigFile( p_intf, "ffmpeg" );
}
vol.Unset();
status = volRoster.GetNextVolume( &vol );
}
+ return 0;
}
/*****************************************************************************