Commit a4a766a3 authored by Eric Petit's avatar Eric Petit

beos/* : New Preferences window that lets you configure everything.

          It is not complete yet (see the TODO in PreferencesWindow.cpp)
parent c7bfd461
......@@ -2,7 +2,7 @@
* beos.cpp : BeOS plugin for vlc
*****************************************************************************
* Copyright (C) 2000, 2001 VideoLAN
* $Id: BeOS.cpp,v 1.8 2003/03/30 18:14:37 gbazin Exp $
* $Id: BeOS.cpp,v 1.9 2003/05/03 13:37:21 titer Exp $
*
* Authors: Jean-Marc Dressler <polux@via.ecp.fr>
* Samuel Hocevar <sam@zoy.org>
......@@ -51,28 +51,6 @@ vlc_module_begin();
add_submodule();
set_capability( "interface", 100 );
set_callbacks( E_(OpenIntf), E_(CloseIntf) );
add_integer( "beos-intf-width", 0, NULL, "", "", VLC_TRUE );
add_integer( "beos-intf-height", 0, NULL, "", "", VLC_TRUE );
add_integer( "beos-intf-xpos", 0, NULL, "", "", VLC_TRUE );
add_integer( "beos-intf-ypos", 0, NULL, "", "", VLC_TRUE );
add_integer( "beos-playlist-width", 0, NULL, "", "", VLC_TRUE );
add_integer( "beos-playlist-height", 0, NULL, "", "", VLC_TRUE );
add_integer( "beos-playlist-xpos", 0, NULL, "", "", VLC_TRUE );
add_integer( "beos-playlist-ypos", 0, NULL, "", "", VLC_TRUE );
add_bool( "beos-playlist-show", 0, NULL, "", "", VLC_TRUE );
add_integer( "beos-messages-width", 0, NULL, "", "", VLC_TRUE );
add_integer( "beos-messages-height", 0, NULL, "", "", VLC_TRUE );
add_integer( "beos-messages-xpos", 0, NULL, "", "", VLC_TRUE );
add_integer( "beos-messages-ypos", 0, NULL, "", "", VLC_TRUE );
add_bool( "beos-messages-show", 0, NULL, "", "", VLC_TRUE );
add_integer( "beos-settings-width", 0, NULL, "", "", VLC_TRUE );
add_integer( "beos-settings-height", 0, NULL, "", "", VLC_TRUE );
add_integer( "beos-settings-xpos", 0, NULL, "", "", VLC_TRUE );
add_integer( "beos-settings-ypos", 0, NULL, "", "", VLC_TRUE );
add_bool( "beos-settings-show", 0, NULL, "", "", VLC_TRUE );
add_integer( "beos-screenshot-format", 0, NULL, "", "", VLC_TRUE );
add_string( "beos-screenshot-path", 0, NULL, "", "", VLC_TRUE );
add_bool( "beos-use-dvd-menus", 0, NULL, "", "", VLC_TRUE );
add_submodule();
set_capability( "video output", 100 );
set_callbacks( E_(OpenVideo), E_(CloseVideo) );
......
......@@ -2,7 +2,7 @@
* intf_beos.cpp: beos interface
*****************************************************************************
* Copyright (C) 1999, 2000, 2001 VideoLAN
* $Id: Interface.cpp,v 1.11 2003/03/12 23:15:03 titer Exp $
* $Id: Interface.cpp,v 1.12 2003/05/03 13:37:21 titer Exp $
*
* Authors: Jean-Marc Dressler <polux@via.ecp.fr>
* Samuel Hocevar <sam@zoy.org>
......@@ -85,7 +85,10 @@ int E_(OpenIntf) ( vlc_object_t *p_this )
free( p_intf->p_sys );
msg_Err( p_intf, "cannot allocate InterfaceWindow" );
return( 1 );
} else {
}
else
{
/* Make the be_app aware the interface has been created */
BMessage message(INTERFACE_CREATED);
message.AddPointer("window", p_intf->p_sys->p_window);
be_app->PostMessage(&message);
......
......@@ -2,7 +2,7 @@
* InterfaceWindow.cpp: beos interface
*****************************************************************************
* Copyright (C) 1999, 2000, 2001 VideoLAN
* $Id: InterfaceWindow.cpp,v 1.34 2003/04/22 16:36:16 titer Exp $
* $Id: InterfaceWindow.cpp,v 1.35 2003/05/03 13:37:21 titer Exp $
*
* Authors: Jean-Marc Dressler <polux@via.ecp.fr>
* Samuel Hocevar <sam@zoy.org>
......@@ -53,7 +53,6 @@
#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
......@@ -202,7 +201,7 @@ InterfaceWindow::InterfaceWindow( BRect frame, const char* name,
( 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, _("Settings") );
fPreferencesWindow = new PreferencesWindow( p_intf, window_rect, _("Preferences") );
window_rect.Set( screen_rect.right - 500,
screen_rect.top + 50,
screen_rect.right - 150,
......@@ -241,7 +240,7 @@ InterfaceWindow::InterfaceWindow( BRect frame, const char* name,
// Add the file Menu
BMenu* fileMenu = new BMenu( _("File") );
fMenuBar->AddItem( fileMenu );
fileMenu->AddItem( new BMenuItem( _AddEllipsis(_("Open Subtitles")),
fileMenu->AddItem( new BMenuItem( _AddEllipsis(_("Open File")),
new BMessage( OPEN_FILE ), 'O') );
fileMenu->AddItem( new CDMenu( _("Open Disc") ) );
......@@ -301,7 +300,7 @@ InterfaceWindow::InterfaceWindow( BRect frame, const char* name,
new BMessage( OPEN_PLAYLIST ), 'P') );
fShowMenu->AddItem( new BMenuItem( _AddEllipsis(_("Messages")),
new BMessage( OPEN_MESSAGES ), 'M' ) );
fShowMenu->AddItem( new BMenuItem( _AddEllipsis(_("Settings")),
fShowMenu->AddItem( new BMenuItem( _AddEllipsis(_("Preferences")),
new BMessage( OPEN_PREFERENCES ), 'S' ) );
fMenuBar->AddItem( fShowMenu );
......@@ -957,58 +956,6 @@ launch_window( BWindow* window, bool showing )
void
InterfaceWindow::_RestoreSettings()
{
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
{
if ( load_settings( fSettings, "interface_settings", "VideoLAN Client" ) == B_OK )
{
BRect frame;
......@@ -1033,7 +980,6 @@ InterfaceWindow::_RestoreSettings()
if ( fSettings->FindInt32( "playlist display mode", (int32*)&displayMode ) == B_OK )
fPlaylistWindow->SetDisplayMode( displayMode );
}
}
}
/*****************************************************************************
......@@ -1042,47 +988,6 @@ InterfaceWindow::_RestoreSettings()
void
InterfaceWindow::_StoreSettings()
{
if ( USE_VLC_CONFIG_FILE )
{
// 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();
}
}
else
{
if ( fSettings->ReplaceRect( "main frame", Frame() ) != B_OK )
fSettings->AddRect( "main frame", Frame() );
if ( fPlaylistWindow->Lock() )
......@@ -1114,20 +1019,9 @@ InterfaceWindow::_StoreSettings()
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" );
}
/*****************************************************************************
* CDMenu::CDMenu
*****************************************************************************/
......
This diff is collapsed.
......@@ -2,7 +2,7 @@
* PreferencesWindow.h
*****************************************************************************
* Copyright (C) 1999, 2000, 2001 VideoLAN
* $Id: PreferencesWindow.h,v 1.9 2003/02/09 17:10:52 stippi Exp $
* $Id: PreferencesWindow.h,v 1.10 2003/05/03 13:37:21 titer Exp $
*
* Authors: Eric Petit <titer@videolan.org>
*
......@@ -25,106 +25,61 @@
#define BEOS_PREFERENCES_WINDOW_H
#include <Window.h>
#include <String.h>
#define PREFS_WINDOW_WIDTH 400
#define PREFS_WINDOW_HEIGHT 280
#define PREFS_WINDOW_WIDTH 600
#define PREFS_WINDOW_HEIGHT 300
#define PREFS_ITEM_SELECTED 'pris'
#define PREFS_OK 'prok'
#define PREFS_CANCEL 'prcb'
#define PREFS_DEFAULTS 'prde'
#define PREFS_REVERT 'prrv'
#define FFMPEG_UPDATE 'ffup'
#define ADJUST_UPDATE 'ajst'
#define DVDMENUS_CHECK 'dvme'
#define SET_TRANSLATOR 'sttr'
#define SET_FOLDER 'stdr'
#define PREFS_REVERT 'prre'
#define PREFS_APPLY 'prap'
#define TEXT_HEIGHT 16
class ConfigView : public BView
{
public:
ConfigView( BRect frame, const char * name,
uint32 resizingMode, uint32 flags );
/* When we create the view, we have to give it an arbitrary size because
it will be the size of the BScrollView. That's why we keep the real size
in fRealBounds so we can have a correct BScrollBar later */
BRect fRealBounds;
};
class BTabView;
class BCheckBox;
class BSlider;
class BStringView;
class BMenuField;
class BTextControl;
class StringItemWithView : public BStringItem
{
public:
StringItemWithView( const char * text );
/* Here we store the ConfigView associated to this module */
ConfigView * fConfigView;
};
class PreferencesWindow : public BWindow
{
public:
PreferencesWindow( intf_thread_t* p_intf,
PreferencesWindow( intf_thread_t * p_intf,
BRect frame,
const char* name );
const char * name );
virtual ~PreferencesWindow();
virtual bool QuitRequested();
virtual void MessageReceived(BMessage* message);
virtual void Show();
virtual void FrameResized( float, float );
void Update();
void UpdateScrollBar();
void ApplyChanges( bool doIt );
void ReallyQuit();
private:
void _SetGUI( bool dvdMenus,
int32 postProcessing,
float brightness,
float contrast,
int32 hue,
float saturation,
const char* screenShotPath,
uint32 screenShotTranslator );
void _SetDefaults();
void _SetToSettings();
void _RevertChanges();
void _ApplyChanges();
void _ApplyScreenShotSettings();
void _ApplyPictureSettings();
void _ApplyFFmpegSettings();
void _ApplyDVDSettings();
BView* fPrefsView;
BTabView* fTabView;
BView* fGeneralView;
BView* fAdjustView;
BTab* fGeneralTab;
BTab* fAdjustTab;
BCheckBox* fDvdMenusCheck;
BSlider* fPpSlider;
BSlider* fContrastSlider;
BSlider* fBrightnessSlider;
BSlider* fHueSlider;
BSlider* fSaturationSlider;
BStringView* fRestartString;
BMenuField* fScreenShotFormatMF;
BTextControl* fScreenShotPathTC;
bool fDVDMenusBackup;
int32 fPostProcessingBackup;
float fBrightnessBackup;
float fContrastBackup;
int32 fHueBackup;
float fSaturationBackup;
BString fScreenShotPathBackup;
uint32 fScreenShotFormatBackup;
BView * fPrefsView;
BOutlineListView * fOutline;
BView * fDummyView;
BScrollView * fConfigScroll;
intf_thread_t* p_intf;
intf_thread_t * p_intf;
};
// some global support functions
int32
get_config_int( intf_thread_t* intf,
const char* field,
int32 defaultValue );
float
get_config_float( intf_thread_t* intf,
const char* field,
float defaultValue );
// don't leak the return value! (use free())
char*
get_config_string( intf_thread_t* intf,
const char* field,
const char* defaultString );
#endif // BEOS_PREFERENCES_WINDOW_H
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