Commit cc6ee817 authored by Eric Petit's avatar Eric Petit

* store windows sizes in the vlc configuration file

 * fixed an interface bug when launching a file from the command line
 * minor fixes or enhancements
parent a08a63e7
......@@ -2,7 +2,7 @@
* beos.cpp : BeOS plugin for vlc
*****************************************************************************
* Copyright (C) 2000, 2001 VideoLAN
* $Id: BeOS.cpp,v 1.2 2002/09/30 18:30:27 titer Exp $
* $Id: BeOS.cpp,v 1.3 2003/01/25 01:03:44 titer Exp $
*
* Authors: Jean-Marc Dressler <polux@via.ecp.fr>
* Samuel Hocevar <sam@zoy.org>
......@@ -50,6 +50,15 @@ vlc_module_begin();
add_submodule();
set_capability( "interface", 100 );
set_callbacks( E_(OpenIntf), E_(CloseIntf) );
add_integer( "beos-intf-width", 0, NULL, "", "" );
add_integer( "beos-intf-height", 0, NULL, "", "" );
add_integer( "beos-intf-xpos", 0, NULL, "", "" );
add_integer( "beos-intf-ypos", 0, NULL, "", "" );
add_integer( "beos-playlist-width", 0, NULL, "", "" );
add_integer( "beos-playlist-height", 0, NULL, "", "" );
add_integer( "beos-playlist-xpos", 0, NULL, "", "" );
add_integer( "beos-playlist-ypos", 0, NULL, "", "" );
add_bool( "beos-playlist-show", 0, NULL, "", "" );
add_submodule();
set_capability( "video output", 100 );
set_callbacks( E_(OpenVideo), E_(CloseVideo) );
......
......@@ -2,7 +2,7 @@
* InterfaceWindow.cpp: beos interface
*****************************************************************************
* Copyright (C) 1999, 2000, 2001 VideoLAN
* $Id: InterfaceWindow.cpp,v 1.20 2003/01/22 01:13:22 titer Exp $
* $Id: InterfaceWindow.cpp,v 1.21 2003/01/25 01:03:44 titer Exp $
*
* Authors: Jean-Marc Dressler <polux@via.ecp.fr>
* Samuel Hocevar <sam@zoy.org>
......@@ -70,7 +70,7 @@ InterfaceWindow::InterfaceWindow( BRect frame, const char *name,
p_wrapper = p_intf->p_sys->p_wrapper;
p_intf->p_sys->b_dvdold = false;
fPlaylistIsEmpty = ( p_wrapper->PlaylistSize() < 0 );
fPlaylistIsEmpty = !( p_wrapper->PlaylistSize() > 0 );
fPlaylistWindow = new PlayListWindow( BRect( 100.0, 100.0, 400.0, 350.0 ),
"Playlist",
......@@ -96,7 +96,6 @@ InterfaceWindow::InterfaceWindow( BRect frame, const char *name,
p_mediaControl = new MediaControlView( BRect( 0.0, 0.0, 250.0, 50.0 ),
p_intf );
p_mediaControl->SetViewColor( ui_color( B_PANEL_BACKGROUND_COLOR ) );
p_mediaControl->SetEnabled( !fPlaylistIsEmpty );
float width, height;
p_mediaControl->GetPreferredSize( &width, &height );
......@@ -181,10 +180,41 @@ InterfaceWindow::InterfaceWindow( BRect frame, const char *name,
new BMenuItem( "Preferences", new BMessage( OPEN_PREFERENCES ) ) );
fMenuBar->AddItem( fSettingsMenu );
// prepare fow showing
/* Prepare fow showing */
_SetMenusEnabled( false );
p_mediaControl->SetEnabled( false );
/* Restore interface settings */
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 && i_height && i_xpos && i_ypos )
{
/* main window size and position */
ResizeTo( i_width, i_height );
MoveTo( i_xpos, i_ypos );
}
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 && i_height && i_xpos && i_ypos )
{
/* playlist window size and position */
fPlaylistWindow->ResizeTo( i_width, i_height );
fPlaylistWindow->MoveTo( i_xpos, i_ypos );
}
if( config_GetInt( p_intf, "beos-playlist-show" ) )
{
/* playlist showing */
if( fPlaylistWindow->Lock() )
{
fPlaylistWindow->Show();
fPlaylistWindow->Unlock();
}
}
Show();
}
......@@ -553,6 +583,24 @@ bool InterfaceWindow::QuitRequested()
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();
}
config_SaveConfigFile( p_intf, "beos" );
p_intf->b_die = 1;
return( true );
......@@ -571,7 +619,7 @@ void InterfaceWindow::updateInterface()
}
else if ( Lock() )
{
// p_mediaControl->SetEnabled( true );
p_mediaControl->SetEnabled( true );
bool hasTitles = p_wrapper->HasTitles();
bool hasChapters = p_wrapper->HasChapters();
p_mediaControl->SetStatus( p_wrapper->InputStatus(),
......@@ -606,14 +654,18 @@ void InterfaceWindow::updateInterface()
else
{
_SetMenusEnabled( false );
// p_mediaControl->SetEnabled( 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 */
if( p_wrapper->GetVolume() != p_mediaControl->GetVolume() )
int i_volume = p_mediaControl->GetVolume();
if( p_wrapper->GetVolume() != i_volume )
{
p_wrapper->SetVolume( p_mediaControl->GetVolume() );
p_wrapper->SetVolume( i_volume );
}
fLastUpdateTime = system_time();
......
......@@ -2,7 +2,7 @@
* MediaControlView.cpp: beos interface
*****************************************************************************
* Copyright (C) 1999, 2000, 2001 VideoLAN
* $Id: MediaControlView.cpp,v 1.12 2003/01/24 06:31:56 titer Exp $
* $Id: MediaControlView.cpp,v 1.13 2003/01/25 01:03:44 titer Exp $
*
* Authors: Tony Castley <tony@castley.net>
* Stephan Aßmus <stippi@yellowbites.com>
......@@ -78,7 +78,8 @@ MediaControlView::MediaControlView(BRect frame, intf_thread_t *p_interface)
fScrubSem(B_ERROR),
fCurrentRate(DEFAULT_RATE),
fCurrentStatus(UNDEF_S),
fBottomControlHeight(0.0)
fBottomControlHeight(0.0),
fIsEnabled( true )
{
p_intf = p_interface;
......@@ -325,7 +326,14 @@ MediaControlView::SetStatus(int status, int rate)
void
MediaControlView::SetEnabled(bool enabled)
{
if ( LockLooper() )
if( ( enabled && fIsEnabled ) ||
( !enabled && !fIsEnabled ) )
{
/* do not redraw if it is not necessary */
return;
}
if( LockLooper() )
{
fSkipBack->SetEnabled( enabled );
fPlayPause->SetEnabled( enabled );
......@@ -337,6 +345,7 @@ MediaControlView::SetEnabled(bool enabled)
fRewind->SetEnabled( enabled );
fForward->SetEnabled( enabled );
UnlockLooper();
fIsEnabled = enabled;
}
}
......@@ -764,7 +773,9 @@ SeekSlider::ResizeToPreferred()
void
SeekSlider::SetPosition(float position)
{
LockLooper();
SetValue(fMinValue + (int32)floorf((fMaxValue - fMinValue) * position + 0.5));
UnlockLooper();
}
/*****************************************************************************
......
......@@ -2,7 +2,7 @@
* MediaControlView.h: beos interface
*****************************************************************************
* Copyright (C) 1999, 2000, 2001 VideoLAN
* $Id: MediaControlView.h,v 1.4 2003/01/12 02:08:39 titer Exp $
* $Id: MediaControlView.h,v 1.5 2003/01/25 01:03:44 titer Exp $
*
* Authors: Tony Castley <tony@castley.net>
* Stephan Aßmus <stippi@yellowbites.com>
......@@ -86,6 +86,7 @@ class MediaControlView : public BBox
int fCurrentStatus;
float fBottomControlHeight;
BRect fOldBounds;
bool fIsEnabled;
intf_thread_t * p_intf;
};
......
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