Commit fda0a7e4 authored by Stephan Assmus's avatar Stephan Assmus

video output has better handling of settings. it remembers flags like...

video output has better handling of settings. it remembers flags like fullscreen, aspect ratio correction and on-top-all-windows fell across multiple files in the playlist and also across program launches
parent 6a6ffd1f
......@@ -2,7 +2,7 @@
* InterfaceWindow.cpp: beos interface
*****************************************************************************
* Copyright (C) 1999, 2000, 2001 VideoLAN
* $Id: InterfaceWindow.cpp,v 1.16.2.6 2002/10/11 00:46:59 stippi Exp $
* $Id: InterfaceWindow.cpp,v 1.16.2.7 2002/10/11 14:18:17 stippi Exp $
*
* Authors: Jean-Marc Dressler <polux@via.ecp.fr>
* Samuel Hocevar <sam@zoy.org>
......@@ -748,64 +748,6 @@ InterfaceWindow::_InputStreamChanged()
Intf_VLCWrapper::set_volume( p_mediaControl->GetVolume() );
}
/*****************************************************************************
* InterfaceWindow::_LoadSettings
*****************************************************************************/
status_t
InterfaceWindow::_LoadSettings( BMessage* message, const char* fileName, const char* folder )
{
status_t ret = B_BAD_VALUE;
if ( message )
{
BPath path;
if ( ( ret = find_directory( B_USER_SETTINGS_DIRECTORY, &path ) ) == B_OK )
{
// passing folder is optional
if ( folder )
ret = path.Append( folder );
if ( ret == B_OK && ( ret = path.Append( fileName ) ) == B_OK )
{
BFile file( path.Path(), B_READ_ONLY );
if ( ( ret = file.InitCheck() ) == B_OK )
{
ret = message->Unflatten( &file );
file.Unset();
}
}
}
}
return ret;
}
/*****************************************************************************
* InterfaceWindow::_SaveSettings
*****************************************************************************/
status_t
InterfaceWindow::_SaveSettings( BMessage* message, const char* fileName, const char* folder )
{
status_t ret = B_BAD_VALUE;
if ( message )
{
BPath path;
if ( ( ret = find_directory( B_USER_SETTINGS_DIRECTORY, &path ) ) == B_OK )
{
// passing folder is optional
if ( folder && ( ret = path.Append( folder ) ) == B_OK )
ret = create_directory( path.Path(), 0777 );
if ( ret == B_OK && ( ret = path.Append( fileName ) ) == B_OK )
{
BFile file( path.Path(), B_WRITE_ONLY | B_CREATE_FILE | B_ERASE_FILE );
if ( ( ret = file.InitCheck() ) == B_OK )
{
ret = message->Flatten( &file );
file.Unset();
}
}
}
}
return ret;
}
/*****************************************************************************
* InterfaceWindow::_RestoreSettings
*****************************************************************************/
......@@ -855,7 +797,7 @@ make_sure_frame_is_within_limits( BRect& frame, float minWidth, float minHeight,
void
InterfaceWindow::_RestoreSettings()
{
if ( _LoadSettings( fSettings, "interface_settings", "VideoLAN Client" ) == B_OK )
if ( load_settings( fSettings, "interface_settings", "VideoLAN Client" ) == B_OK )
{
BRect mainFrame;
if ( fSettings->FindRect( "main frame", &mainFrame ) == B_OK )
......@@ -927,7 +869,7 @@ InterfaceWindow::_StoreSettings()
fSettings->AddBool( "playlist showing", !fPlaylistWindow->IsHidden() );
fPlaylistWindow->Unlock();
}
_SaveSettings( fSettings, "interface_settings", "VideoLAN Client" );
save_settings( fSettings, "interface_settings", "VideoLAN Client" );
}
/*****************************************************************************
......@@ -1200,3 +1142,61 @@ void ChapterMenu::AttachedToWindow()
BMenu::AttachedToWindow();
}
/*****************************************************************************
* load_settings
*****************************************************************************/
status_t
load_settings( BMessage* message, const char* fileName, const char* folder )
{
status_t ret = B_BAD_VALUE;
if ( message )
{
BPath path;
if ( ( ret = find_directory( B_USER_SETTINGS_DIRECTORY, &path ) ) == B_OK )
{
// passing folder is optional
if ( folder )
ret = path.Append( folder );
if ( ret == B_OK && ( ret = path.Append( fileName ) ) == B_OK )
{
BFile file( path.Path(), B_READ_ONLY );
if ( ( ret = file.InitCheck() ) == B_OK )
{
ret = message->Unflatten( &file );
file.Unset();
}
}
}
}
return ret;
}
/*****************************************************************************
* save_settings
*****************************************************************************/
status_t
save_settings( BMessage* message, const char* fileName, const char* folder )
{
status_t ret = B_BAD_VALUE;
if ( message )
{
BPath path;
if ( ( ret = find_directory( B_USER_SETTINGS_DIRECTORY, &path ) ) == B_OK )
{
// passing folder is optional
if ( folder && ( ret = path.Append( folder ) ) == B_OK )
ret = create_directory( path.Path(), 0777 );
if ( ret == B_OK && ( ret = path.Append( fileName ) ) == B_OK )
{
BFile file( path.Path(), B_WRITE_ONLY | B_CREATE_FILE | B_ERASE_FILE );
if ( ( ret = file.InitCheck() ) == B_OK )
{
ret = message->Flatten( &file );
file.Unset();
}
}
}
}
return ret;
}
......@@ -2,7 +2,7 @@
* InterfaceWindow.h: BeOS interface window class prototype
*****************************************************************************
* Copyright (C) 1999, 2000, 2001 VideoLAN
* $Id: InterfaceWindow.h,v 1.12.2.5 2002/10/09 15:29:51 stippi Exp $
* $Id: InterfaceWindow.h,v 1.12.2.6 2002/10/11 14:18:17 stippi Exp $
*
* Authors: Jean-Marc Dressler <polux@via.ecp.fr>
* Tony Castley <tcastley@mail.powerup.com.au>
......@@ -109,12 +109,6 @@ class InterfaceWindow : public BWindow
bool hasTitles = false );
void _UpdateSpeedMenu( int rate );
void _InputStreamChanged();
status_t _LoadSettings( BMessage* message,
const char* fileName,
const char* subFolder = NULL );
status_t _SaveSettings( BMessage* message,
const char* fileName,
const char* subFolder = NULL );
void _RestoreSettings();
void _StoreSettings();
......@@ -148,4 +142,14 @@ class InterfaceWindow : public BWindow
// for forward compatibility
};
// some global support functions
status_t load_settings( BMessage* message,
const char* fileName,
const char* folder = NULL );
status_t save_settings( BMessage* message,
const char* fileName,
const char* folder = NULL );
#endif // BEOS_INTERFACE_WINDOW_H
......@@ -2,7 +2,7 @@
* VideoWindow.h: BeOS video window class prototype
*****************************************************************************
* Copyright (C) 1999, 2000, 2001 VideoLAN
* $Id: VideoWindow.h,v 1.19.2.6 2002/09/29 12:04:27 titer Exp $
* $Id: VideoWindow.h,v 1.19.2.7 2002/10/11 14:18:17 stippi Exp $
*
* Authors: Jean-Marc Dressler <polux@via.ecp.fr>
* Tony Castley <tcastley@mail.powerup.com.au>
......@@ -55,6 +55,53 @@ colorcombo colspace[]=
#define COLOR_COUNT 5
#define DEFAULT_COL 4
class VideoSettings
{
public:
VideoSettings( const VideoSettings& clone );
virtual ~VideoSettings();
static VideoSettings* DefaultSettings();
enum
{
SIZE_OTHER = 0,
SIZE_50 = 1,
SIZE_100 = 2,
SIZE_200 = 3,
};
void SetVideoSize( uint32 mode );
inline uint32 VideoSize() const
{ return fVideoSize; }
enum
{
FLAG_CORRECT_RATIO = 0x0001,
FLAG_SYNC_RETRACE = 0x0002,
FLAG_ON_TOP_ALL = 0x0004,
FLAG_FULL_SCREEN = 0x0008,
};
inline void SetFlags( uint32 flags )
{ fFlags = flags; }
inline void AddFlags( uint32 flags )
{ fFlags |= flags; }
inline void ClearFlags( uint32 flags )
{ fFlags &= ~flags; }
inline bool HasFlags( uint32 flags ) const
{ return fFlags & flags; }
inline uint32 Flags() const
{ return fFlags; }
private:
VideoSettings(); // reserved for default settings
static VideoSettings fDefaultSettings;
uint32 fVideoSize;
uint32 fFlags;
BMessage* fSettings;
};
class VLCView : public BView
{
......@@ -103,8 +150,14 @@ public:
void SetInterfaceShowing(bool showIt);
void SetCorrectAspectRatio(bool doIt);
inline bool CorrectAspectRatio() const
{ return fCorrectAspect; }
bool CorrectAspectRatio() const;
void ToggleFullScreen();
void SetFullScreen(bool doIt);
bool IsFullScreen() const;
void SetOnTop(bool doIt);
bool IsOnTop() const;
void SetSyncToRetrace(bool doIt);
bool IsSyncedToRetrace() const;
inline status_t InitCheck() const
{ return fInitStatus; }
......@@ -113,9 +166,8 @@ public:
int32 i_width; // aspect corrected bitmap size
int32 i_height;
BRect winSize; // current window size
bool is_zoomed, vsync;
BBitmap *bitmap[3];
BBitmap *overlaybitmap;
// BBitmap *overlaybitmap;
VLCView *view;
int i_buffer;
volatile bool teardownwindow;
......@@ -130,6 +182,7 @@ private:
void _FreeBuffers();
void _BlankBitmap(BBitmap* bitmap) const;
void _SetVideoSize(uint32 mode);
void _SetToSettings();
void _SaveScreenShot( BBitmap* bitmap,
char* path,
......@@ -153,6 +206,7 @@ private:
window_feel fCachedFeel;
bool fInterfaceShowing;
status_t fInitStatus;
VideoSettings* fSettings;
};
#endif // BEOS_VIDEO_WINDOW_H
......
This diff is collapsed.
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