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 @@ ...@@ -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.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> * Authors: Jean-Marc Dressler <polux@via.ecp.fr>
* Samuel Hocevar <sam@zoy.org> * Samuel Hocevar <sam@zoy.org>
...@@ -51,28 +51,6 @@ vlc_module_begin(); ...@@ -51,28 +51,6 @@ vlc_module_begin();
add_submodule(); add_submodule();
set_capability( "interface", 100 ); set_capability( "interface", 100 );
set_callbacks( E_(OpenIntf), E_(CloseIntf) ); 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(); 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.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> * Authors: Jean-Marc Dressler <polux@via.ecp.fr>
* Samuel Hocevar <sam@zoy.org> * Samuel Hocevar <sam@zoy.org>
...@@ -85,7 +85,10 @@ int E_(OpenIntf) ( vlc_object_t *p_this ) ...@@ -85,7 +85,10 @@ int E_(OpenIntf) ( vlc_object_t *p_this )
free( p_intf->p_sys ); free( p_intf->p_sys );
msg_Err( p_intf, "cannot allocate InterfaceWindow" ); msg_Err( p_intf, "cannot allocate InterfaceWindow" );
return( 1 ); return( 1 );
} else { }
else
{
/* Make the be_app aware the interface has been created */
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);
......
...@@ -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.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> * Authors: Jean-Marc Dressler <polux@via.ecp.fr>
* Samuel Hocevar <sam@zoy.org> * Samuel Hocevar <sam@zoy.org>
...@@ -53,7 +53,6 @@ ...@@ -53,7 +53,6 @@
#define INTERFACE_UPDATE_TIMEOUT 80000 // 2 frames if at 25 fps #define INTERFACE_UPDATE_TIMEOUT 80000 // 2 frames if at 25 fps
#define INTERFACE_LOCKING_TIMEOUT 5000 #define INTERFACE_LOCKING_TIMEOUT 5000
#define USE_VLC_CONFIG_FILE 0
// make_sure_frame_is_on_screen // make_sure_frame_is_on_screen
bool bool
...@@ -202,7 +201,7 @@ InterfaceWindow::InterfaceWindow( BRect frame, const char* name, ...@@ -202,7 +201,7 @@ 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( p_intf, window_rect, _("Settings") ); fPreferencesWindow = new PreferencesWindow( p_intf, window_rect, _("Preferences") );
window_rect.Set( screen_rect.right - 500, window_rect.Set( screen_rect.right - 500,
screen_rect.top + 50, screen_rect.top + 50,
screen_rect.right - 150, screen_rect.right - 150,
...@@ -241,7 +240,7 @@ InterfaceWindow::InterfaceWindow( BRect frame, const char* name, ...@@ -241,7 +240,7 @@ InterfaceWindow::InterfaceWindow( BRect frame, const char* name,
// Add the file Menu // Add the file Menu
BMenu* fileMenu = new BMenu( _("File") ); BMenu* fileMenu = new BMenu( _("File") );
fMenuBar->AddItem( fileMenu ); fMenuBar->AddItem( fileMenu );
fileMenu->AddItem( new BMenuItem( _AddEllipsis(_("Open Subtitles")), fileMenu->AddItem( new BMenuItem( _AddEllipsis(_("Open File")),
new BMessage( OPEN_FILE ), 'O') ); new BMessage( OPEN_FILE ), 'O') );
fileMenu->AddItem( new CDMenu( _("Open Disc") ) ); fileMenu->AddItem( new CDMenu( _("Open Disc") ) );
...@@ -301,7 +300,7 @@ InterfaceWindow::InterfaceWindow( BRect frame, const char* name, ...@@ -301,7 +300,7 @@ InterfaceWindow::InterfaceWindow( BRect frame, const char* name,
new BMessage( OPEN_PLAYLIST ), 'P') ); new BMessage( OPEN_PLAYLIST ), 'P') );
fShowMenu->AddItem( new BMenuItem( _AddEllipsis(_("Messages")), fShowMenu->AddItem( new BMenuItem( _AddEllipsis(_("Messages")),
new BMessage( OPEN_MESSAGES ), 'M' ) ); new BMessage( OPEN_MESSAGES ), 'M' ) );
fShowMenu->AddItem( new BMenuItem( _AddEllipsis(_("Settings")), fShowMenu->AddItem( new BMenuItem( _AddEllipsis(_("Preferences")),
new BMessage( OPEN_PREFERENCES ), 'S' ) ); new BMessage( OPEN_PREFERENCES ), 'S' ) );
fMenuBar->AddItem( fShowMenu ); fMenuBar->AddItem( fShowMenu );
...@@ -957,58 +956,6 @@ launch_window( BWindow* window, bool showing ) ...@@ -957,58 +956,6 @@ launch_window( BWindow* window, bool showing )
void void
InterfaceWindow::_RestoreSettings() 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 ) if ( load_settings( fSettings, "interface_settings", "VideoLAN Client" ) == B_OK )
{ {
BRect frame; BRect frame;
...@@ -1033,7 +980,6 @@ InterfaceWindow::_RestoreSettings() ...@@ -1033,7 +980,6 @@ InterfaceWindow::_RestoreSettings()
if ( fSettings->FindInt32( "playlist display mode", (int32*)&displayMode ) == B_OK ) if ( fSettings->FindInt32( "playlist display mode", (int32*)&displayMode ) == B_OK )
fPlaylistWindow->SetDisplayMode( displayMode ); fPlaylistWindow->SetDisplayMode( displayMode );
} }
}
} }
/***************************************************************************** /*****************************************************************************
...@@ -1042,47 +988,6 @@ InterfaceWindow::_RestoreSettings() ...@@ -1042,47 +988,6 @@ InterfaceWindow::_RestoreSettings()
void void
InterfaceWindow::_StoreSettings() 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 ) if ( fSettings->ReplaceRect( "main frame", Frame() ) != B_OK )
fSettings->AddRect( "main frame", Frame() ); fSettings->AddRect( "main frame", Frame() );
if ( fPlaylistWindow->Lock() ) if ( fPlaylistWindow->Lock() )
...@@ -1114,20 +1019,9 @@ InterfaceWindow::_StoreSettings() ...@@ -1114,20 +1019,9 @@ InterfaceWindow::_StoreSettings()
fSettings->AddInt32( "playlist display mode", displayMode ); fSettings->AddInt32( "playlist display mode", displayMode );
save_settings( fSettings, "interface_settings", "VideoLAN Client" ); 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 * CDMenu::CDMenu
*****************************************************************************/ *****************************************************************************/
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* PreferencesWindow.cpp: beos interface * PreferencesWindow.cpp: beos interface
***************************************************************************** *****************************************************************************
* Copyright (C) 1999, 2000, 2001 VideoLAN * Copyright (C) 1999, 2000, 2001 VideoLAN
* $Id: PreferencesWindow.cpp,v 1.14 2003/04/22 16:36:16 titer Exp $ * $Id: PreferencesWindow.cpp,v 1.15 2003/05/03 13:37:21 titer Exp $
* *
* Authors: Eric Petit <titer@videolan.org> * Authors: Eric Petit <titer@videolan.org>
* *
...@@ -21,354 +21,236 @@ ...@@ -21,354 +21,236 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/ *****************************************************************************/
/* system headers */ #include <stdlib.h> /* atoi(), strtod() */
#include <malloc.h>
#include <string.h>
/* BeOS headers */
#include <InterfaceKit.h> #include <InterfaceKit.h>
#include <Entry.h> #include <SupportKit.h>
#include <Path.h>
#include <TranslatorRoster.h>
/* VLC headers */
#include <vlc/vlc.h> #include <vlc/vlc.h>
#include <vlc/intf.h> #include <vlc/intf.h>
/* BeOS module headers */
#include "VlcWrapper.h"
#include "MsgVals.h"
#include "PreferencesWindow.h" #include "PreferencesWindow.h"
static const char* kTranslatorField = "be:translator";
static const char* kTypeField = "be:type";
static const char* kDefaultScreenShotPath = "/boot/home/vlc screenshot";
static const uint32 kDefaultScreenShotFormat = 'PNG ';
// add_translator_items
status_t
add_translator_items( BMenu* intoMenu, uint32 fromType, uint32 command )
{
BTranslatorRoster* roster = BTranslatorRoster::Default();
translator_id* ids = NULL;
int32 count = 0;
status_t err = B_NO_INIT;
if ( roster )
err = roster->GetAllTranslators( &ids, &count );
if ( err < B_OK )
return err;
for ( int32 tix = 0; tix < count; tix++ )
{
const translation_format* formats = NULL;
int32 num_formats = 0;
bool checkOutFormats = false;
err = roster->GetInputFormats( ids[tix], &formats, &num_formats );
if ( err == B_OK )
{
for ( int iix = 0; iix < num_formats; iix++ )
{
if ( formats[iix].type == fromType )
{
checkOutFormats = true;
break;
}
}
}
if ( !checkOutFormats )
continue;
err = roster->GetOutputFormats(ids[tix], &formats, &num_formats);
if ( err == B_OK )
{
for ( int32 oix = 0; oix < num_formats; oix++ )
{
if ( formats[oix].type != fromType )
{
BMessage* message = new BMessage( command );
message->AddInt32( kTranslatorField, ids[tix] );
message->AddInt32( kTypeField, formats[oix].type );
intoMenu->AddItem( new BMenuItem( formats[oix].name, message ) );
}
}
}
}
delete[] ids;
return B_OK;
}
// get_config_string
char*
get_config_string( intf_thread_t* intf, const char* field, const char* defaultString )
{
char* string = config_GetPsz( intf, field );
if ( !string )
{
string = strdup( defaultString );
config_PutPsz( intf, field, string );
}
return string;
}
// get_config_int
int32
get_config_int( intf_thread_t* intf, const char* field, int32 defaultValue )
{
int32 value = config_GetInt( intf, field );
if ( value < 0 )
{
value = defaultValue;
config_PutInt( intf, field, value );
}
return value;
}
// get_config_float
float
get_config_float( intf_thread_t* intf, const char* field, float defaultValue )
{
float value = config_GetFloat( intf, field );
if ( value < 0 )
{
value = defaultValue;
config_PutFloat( intf, field, value );
}
return value;
}
/***************************************************************************** /*****************************************************************************
* DirectoryTextControl class * StringItemWithView::StringItemWithView
*****************************************************************************/ *****************************************************************************/
class DirectoryTextControl : public BTextControl StringItemWithView::StringItemWithView( const char * text )
{ : BStringItem( text )
public:
DirectoryTextControl( BRect frame, const char* name,
const char* label, const char* text,
BMessage* message,
uint32 resizingMode = B_FOLLOW_LEFT | B_FOLLOW_TOP,
uint32 flags = B_WILL_DRAW | B_NAVIGABLE );
virtual ~DirectoryTextControl();
virtual void MessageReceived(BMessage *msg);
};
DirectoryTextControl::DirectoryTextControl( BRect frame, const char* name,
const char* label, const char* text,
BMessage* message,
uint32 resizingMode, uint32 flags)
: BTextControl( frame, name, label, text, message, resizingMode, flags )
{
}
DirectoryTextControl::~DirectoryTextControl()
{ {
/* We use the default constructor */
} }
/***************************************************************************** /*****************************************************************************
* DirectoryTextControl::MessageReceived * ConfigView::ConfigView
*****************************************************************************/ *****************************************************************************/
void ConfigView::ConfigView( BRect frame, const char * name,
DirectoryTextControl::MessageReceived( BMessage* message ) uint32 resizingMode, uint32 flags )
: BView( frame, name, resizingMode, flags )
{ {
switch ( message->what ) /* We use the default constructor */
{
case B_SIMPLE_DATA:
{
entry_ref ref;
if ( message->FindRef( "refs", &ref ) == B_OK ) {
BString directory;
BEntry entry;
BPath path;
if ( entry.SetTo( &ref, true ) == B_OK
&& entry.IsDirectory()
&& path.SetTo( &entry ) == B_OK )
{
SetText( path.Path() );
}
}
break;
}
default:
BTextControl::MessageReceived( message );
break;
}
} }
/***************************************************************************** /*****************************************************************************
* Preferences::PreferencesWindow * PreferencesWindow::PreferencesWindow
*****************************************************************************/ *****************************************************************************/
PreferencesWindow::PreferencesWindow( intf_thread_t * p_interface, PreferencesWindow::PreferencesWindow( intf_thread_t * p_interface,
BRect frame, const char * name ) BRect frame, const char * name )
: BWindow( frame, name, B_FLOATING_WINDOW_LOOK, B_NORMAL_WINDOW_FEEL, : BWindow( frame, name, B_FLOATING_WINDOW_LOOK, B_NORMAL_WINDOW_FEEL,
B_NOT_ZOOMABLE | B_NOT_RESIZABLE ), B_NOT_ZOOMABLE ),
fDVDMenusBackup( false ), fConfigScroll( NULL ),
fPostProcessingBackup( 0 ),
fBrightnessBackup( 100.0 ),
fContrastBackup( 100.0 ),
fHueBackup( 0 ),
fSaturationBackup( 100.0 ),
fScreenShotPathBackup( kDefaultScreenShotPath ),
fScreenShotFormatBackup( kDefaultScreenShotFormat ),
p_intf( p_interface ) p_intf( p_interface )
{ {
BRect rect; BRect rect;
/* "background" view */ /* The "background" view */
rgb_color background = ui_color( B_PANEL_BACKGROUND_COLOR ); rgb_color background = ui_color( B_PANEL_BACKGROUND_COLOR );
fPrefsView = new BView( Bounds(), NULL, B_FOLLOW_ALL, B_WILL_DRAW ); fPrefsView = new BView( Bounds(), NULL, B_FOLLOW_ALL, B_WILL_DRAW );
fPrefsView->SetViewColor( background ); fPrefsView->SetViewColor( background );
AddChild( fPrefsView ); AddChild( fPrefsView );
/* add the tabs */ /* Create the preferences tree */
rect = Bounds(); rect = Bounds();
rect.top += 10.0;
rect.bottom -= 45.0;
fTabView = new BTabView( rect, "preferences view" );
fTabView->SetViewColor( background );
fGeneralView = new BView( fTabView->Bounds(), NULL, B_FOLLOW_ALL, B_WILL_DRAW );
fGeneralView->SetViewColor( background );
fAdjustView = new BView( fTabView->Bounds(), NULL, B_FOLLOW_ALL, B_WILL_DRAW );
fAdjustView->SetViewColor( background );
fGeneralTab = new BTab();
fTabView->AddTab( fGeneralView, fGeneralTab );
fGeneralTab->SetLabel( _("General") );
fAdjustTab = new BTab();
fTabView->AddTab( fAdjustView, fAdjustTab );
fAdjustTab->SetLabel( _("Picture") );
/* fills the tabs */
/* general tab */
rect = fGeneralView->Bounds();
rect.InsetBy( 10, 10 ); rect.InsetBy( 10, 10 );
rect.bottom = rect.top + 10; rect.right = rect.left + 150;
fDvdMenusCheck = new BCheckBox( rect, "dvdmenus", _("Use DVD menus"), fOutline = new BOutlineListView( rect, "preferences tree",
new BMessage( DVDMENUS_CHECK ) ); B_SINGLE_SELECTION_LIST,
fGeneralView->AddChild( fDvdMenusCheck ); B_FOLLOW_LEFT | B_FOLLOW_TOP_BOTTOM );
rect.top = rect.bottom + 20; rect.right += B_V_SCROLL_BAR_WIDTH;
rect.bottom = rect.top + 30; BScrollView * scrollview = new BScrollView( "scrollview", fOutline,
fPpSlider = new BSlider( rect, "post-processing", _("MPEG4 post-processing level"), B_FOLLOW_LEFT | B_FOLLOW_TOP_BOTTOM,
new BMessage( FFMPEG_UPDATE ), 0, false, true );
0, 6, B_TRIANGLE_THUMB, fPrefsView->AddChild( scrollview );
B_FOLLOW_LEFT, B_WILL_DRAW );
fPpSlider->SetHashMarks(B_HASH_MARKS_BOTTOM); /* We need to be informed if the user selects an item */
fPpSlider->SetHashMarkCount( 7 ); fOutline->SetSelectionMessage( new BMessage( PREFS_ITEM_SELECTED ) );
fPpSlider->SetLimitLabels( _("None"), _("Maximum") );
fGeneralView->AddChild( fPpSlider ); /* Create a dummy view so we can correctly place the real config views later */
rect.bottom -= 40;
rect.left = rect.right + 15;
rect.top = fPpSlider->Frame().bottom + 5.0; rect.right = Bounds().right - 15;
rect.bottom = rect.top + 15.0; fDummyView = new BView( rect, "", B_FOLLOW_ALL_SIDES, B_WILL_DRAW );
fScreenShotPathTC = new DirectoryTextControl( rect, "screenshot path", fPrefsView->AddChild( fDummyView );
_("Screenshot Path:"),
fScreenShotPathBackup.String(), /* Fill the tree */
new BMessage( SET_FOLDER ) ); /* TODO:
// fScreenShotPathTC->ResizeToPreferred(); - manage CONFIG_HINT_SUBCATEGORY
- use a pop-up for CONFIG_HINT_MODULE
rect.top = fScreenShotPathTC->Frame().bottom + 5.0; - use BSliders for integer_with_range and float_with_range
rect.bottom = rect.top + 15.0; // TODO: this will be so tricky to get right! - add a tab for BeOS specific configution (screenshot path, etc)
BMenu* translatorMenu = new BMenu( "translators" ); - add the needed LockLooper()s
add_translator_items( translatorMenu, B_TRANSLATOR_BITMAP, SET_TRANSLATOR ); - fix window resizing
fScreenShotFormatMF = new BMenuField( rect, "translators field", - make this intuitive ! */
_("Screenshot Format:"), translatorMenu ); vlc_list_t * p_list;
fScreenShotFormatMF->Menu()->SetRadioMode( true ); p_list = vlc_list_find( p_intf, VLC_OBJECT_MODULE, FIND_ANYWHERE );
fScreenShotFormatMF->Menu()->SetLabelFromMarked( true ); if( !p_list )
// this will most likely not work for BMenuFields
// fScreenShotFormatMF->ResizeToPreferred();
fGeneralView->AddChild( fScreenShotPathTC );
fGeneralView->AddChild( fScreenShotFormatMF );
// make sure the controls labels are aligned nicely
float labelWidthM = fScreenShotFormatMF->StringWidth( fScreenShotFormatMF->Label() ) + 5.0;
float labelWidthP = fScreenShotPathTC->StringWidth( fScreenShotPathTC->Label() ) + 5.0;
if ( labelWidthM > labelWidthP )
{ {
fScreenShotPathTC->SetDivider( labelWidthM ); msg_Warn( p_intf, "couldn't find any module !" );
fScreenShotFormatMF->SetDivider( labelWidthM ); return;
} }
else
module_t * p_module;
for( int i = 0; i < p_list->i_count; i++ )
{ {
fScreenShotPathTC->SetDivider( labelWidthP ); p_module = (module_t*) p_list->p_values[i].p_object;
fScreenShotFormatMF->SetDivider( labelWidthP );
}
/* restart message */ /* If the module has no config option, ignore it */
rect = fGeneralView->Bounds(); module_config_t * p_item;
rect.bottom -= 40.0; p_item = p_module->p_config;
font_height fh; if( !p_item )
be_plain_font->GetHeight( &fh ); continue;
rect.top = rect.bottom - ceilf( fh.ascent + fh.descent ) - 2.0; do
fRestartString = new BStringView( rect, NULL, {
_("DVD-menu and MPEG4 settings take effect after playback is restarted.") ); if( p_item->i_type & CONFIG_ITEM )
fRestartString->SetAlignment( B_ALIGN_CENTER ); break;
fGeneralView->AddChild( fRestartString ); } while( p_item->i_type != CONFIG_HINT_END && p_item++ );
if( p_item->i_type == CONFIG_HINT_END )
continue;
/* Build the config view for this module */
rect = fDummyView->Bounds();
rect.right -= B_V_SCROLL_BAR_WIDTH;
ConfigView * configView;
configView = new ConfigView( rect, "config view",
B_FOLLOW_LEFT_RIGHT | B_FOLLOW_TOP, B_WILL_DRAW );
configView->SetViewColor( background );
/* adjust tab */ rect = configView->Bounds();
rect = fAdjustView->Bounds();
rect.InsetBy( 10, 10 ); rect.InsetBy( 10, 10 );
rect.bottom = rect.top + 30; rect.bottom = rect.top + TEXT_HEIGHT;
fBrightnessSlider = new BSlider( rect, "brightness", _("Brightness"), BTextControl * textControl;
new BMessage( ADJUST_UPDATE ), BCheckBox * checkBox;
0, 200, B_TRIANGLE_THUMB,
B_FOLLOW_LEFT, B_WILL_DRAW ); /* FIXME: we use the BControl name to store the VLC variable name.
rect.OffsetBy( 0, 40 ); To know what variable type it is, I add one character at the beginning
fContrastSlider = new BSlider( rect, "contrast", _("Contrast"), of the name (see ApplyChanges()); it's not pretty, but it works. To
new BMessage( ADJUST_UPDATE ), be cleaned later. */
0, 200, B_TRIANGLE_THUMB, char name[128];
B_FOLLOW_LEFT, B_WILL_DRAW ); p_item = p_module->p_config;
rect.OffsetBy( 0, 40 ); bool firstItem = true;
fHueSlider = new BSlider( rect, "hue", _("Hue"), do
new BMessage( ADJUST_UPDATE ), {
0, 360, B_TRIANGLE_THUMB, switch( p_item->i_type )
B_FOLLOW_LEFT, B_WILL_DRAW ); {
rect.OffsetBy( 0, 40 ); case CONFIG_ITEM_STRING:
fSaturationSlider = new BSlider( rect, "saturation", _("Saturation"), case CONFIG_ITEM_FILE:
new BMessage( ADJUST_UPDATE ), case CONFIG_ITEM_MODULE:
0, 200, B_TRIANGLE_THUMB, case CONFIG_ITEM_DIRECTORY:
B_FOLLOW_LEFT, B_WILL_DRAW ); if( !firstItem )
fAdjustView->AddChild( fBrightnessSlider ); rect.OffsetBy( 0, 25 );
fAdjustView->AddChild( fContrastSlider ); else
fAdjustView->AddChild( fHueSlider ); firstItem = false;
fAdjustView->AddChild( fSaturationSlider );
memset( name, 0, 128 );
fPrefsView->AddChild( fTabView ); sprintf( name, "s%s", p_item->psz_name );
textControl = new BTextControl( rect, name, p_item->psz_text,
/* buttons */ "", new BMessage(),
BButton *button; B_FOLLOW_LEFT_RIGHT | B_FOLLOW_TOP );
configView->AddChild( textControl );
break;
case CONFIG_ITEM_INTEGER:
if( !firstItem )
rect.OffsetBy( 0, 25 );
else
firstItem = false;
memset( name, 0, 128 );
sprintf( name, "i%s", p_item->psz_name );
textControl = new BTextControl( rect, name, p_item->psz_text,
"", new BMessage(),
B_FOLLOW_LEFT_RIGHT | B_FOLLOW_TOP );
configView->AddChild( textControl );
break;
case CONFIG_ITEM_FLOAT:
if( !firstItem )
rect.OffsetBy( 0, 25 );
else
firstItem = false;
memset( name, 0, 128 );
sprintf( name, "f%s", p_item->psz_name );
textControl = new BTextControl( rect, name, p_item->psz_text,
"", new BMessage(),
B_FOLLOW_LEFT_RIGHT | B_FOLLOW_TOP );
configView->AddChild( textControl );
break;
case CONFIG_ITEM_BOOL:
if( !firstItem )
rect.OffsetBy( 0,25 );
else
firstItem = false;
memset( name, 0, 128 );
sprintf( name, "b%s", p_item->psz_name );
checkBox = new BCheckBox( rect, name, p_item->psz_text,
new BMessage(), B_FOLLOW_LEFT_RIGHT | B_FOLLOW_TOP );
configView->AddChild( checkBox );
break;
}
} while( p_item->i_type != CONFIG_HINT_END && p_item++ );
/* Adjust the configView size */
rect.bottom += 10;
configView->fRealBounds = BRect( 0, 0, configView->Bounds().Width(), rect.bottom );
configView->ResizeTo( configView->Bounds().Width(), configView->Bounds().Height() );
/* Add the item to the tree */
StringItemWithView * stringItem;
stringItem = new StringItemWithView( p_module->psz_object_name );
stringItem->fConfigView = configView;
fOutline->AddItem( stringItem );
}
vlc_list_release( p_list );
/* Set the correct values */
ApplyChanges( false );
/* Select the first item */
fOutline->Select( 0 );
/* Add the buttons */
BButton * button;
rect = Bounds(); rect = Bounds();
rect.InsetBy( 10, 10 ); rect.InsetBy( 10, 10 );
rect.top = rect.bottom - 25;
rect.left = rect.right - 80; rect.left = rect.right - 80;
button = new BButton( rect, NULL, _("OK"), new BMessage( PREFS_OK ) ); rect.top = rect.bottom - 25;
button = new BButton( rect, "", _("OK"), new BMessage( PREFS_OK ),
B_FOLLOW_RIGHT | B_FOLLOW_BOTTOM );
fPrefsView->AddChild( button ); fPrefsView->AddChild( button );
SetDefaultButton( button );
rect.OffsetBy( -90, 0 ); rect.OffsetBy( -90, 0 );
button = new BButton( rect, NULL, _("Cancel"), new BMessage( PREFS_CANCEL ) ); button = new BButton( rect, "", _("Revert"), new BMessage( PREFS_REVERT ),
B_FOLLOW_RIGHT | B_FOLLOW_BOTTOM );
fPrefsView->AddChild( button ); fPrefsView->AddChild( button );
rect.OffsetBy( -90, 0 ); rect.OffsetBy( -90, 0 );
button = new BButton( rect, NULL, _("Revert"), new BMessage( PREFS_REVERT ) ); button = new BButton( rect, "", _("Apply"), new BMessage( PREFS_APPLY ),
B_FOLLOW_RIGHT | B_FOLLOW_BOTTOM );
fPrefsView->AddChild( button ); fPrefsView->AddChild( button );
rect.left = Bounds().left + 10.0;
rect.right = rect.left + 80.0;
button = new BButton( rect, NULL, _("Defaults"), new BMessage( PREFS_DEFAULTS ) );
fPrefsView->AddChild( button );
// sync GUI to VLC
_SetToSettings();
// start window thread in hidden state
Hide(); Hide();
Show(); Show();
} }
...@@ -383,13 +265,9 @@ PreferencesWindow::~PreferencesWindow() ...@@ -383,13 +265,9 @@ PreferencesWindow::~PreferencesWindow()
/***************************************************************************** /*****************************************************************************
* PreferencesWindow::QuitRequested * PreferencesWindow::QuitRequested
*****************************************************************************/ *****************************************************************************/
bool bool PreferencesWindow::QuitRequested()
PreferencesWindow::QuitRequested()
{ {
// work arround problem when window is closed or Ok pressed though if( !IsHidden() )
// the text control has focus (it will not have commited changes)
config_PutPsz( p_intf, "beos-screenshot-path", fScreenShotPathTC->Text() );
if ( !IsHidden() )
Hide(); Hide();
return false; return false;
} }
...@@ -397,257 +275,165 @@ PreferencesWindow::QuitRequested() ...@@ -397,257 +275,165 @@ PreferencesWindow::QuitRequested()
/***************************************************************************** /*****************************************************************************
* PreferencesWindow::MessageReceived * PreferencesWindow::MessageReceived
*****************************************************************************/ *****************************************************************************/
void PreferencesWindow::MessageReceived( BMessage * p_message ) void PreferencesWindow::MessageReceived( BMessage * message )
{ {
switch ( p_message->what ) switch( message->what )
{ {
case SET_TRANSLATOR: case PREFS_ITEM_SELECTED:
case SET_FOLDER: Update();
_ApplyScreenShotSettings();
break;
case DVDMENUS_CHECK:
_ApplyDVDSettings();
break;
case ADJUST_UPDATE:
_ApplyPictureSettings();
break; break;
case FFMPEG_UPDATE:
_ApplyFFmpegSettings(); case PREFS_OK:
ApplyChanges( true );
PostMessage( B_QUIT_REQUESTED );
break; break;
case PREFS_REVERT: case PREFS_REVERT:
_RevertChanges(); ApplyChanges( false );
break;
case PREFS_DEFAULTS:
_SetDefaults();
_ApplyChanges();
break; break;
case PREFS_CANCEL:
_RevertChanges(); case PREFS_APPLY:
// fall through ApplyChanges( true );
case PREFS_OK:
PostMessage( B_QUIT_REQUESTED );
break; break;
default: default:
BWindow::MessageReceived( p_message ); BWindow::MessageReceived( message );
break;
} }
} }
/***************************************************************************** /*****************************************************************************
* PreferencesWindow::Show * PreferencesWindow::FrameResized
*****************************************************************************/ *****************************************************************************/
void void PreferencesWindow::FrameResized( float width, float height )
PreferencesWindow::Show()
{ {
// collect settings for backup BWindow::FrameResized( width, height );
fDVDMenusBackup = fDvdMenusCheck->Value() == B_CONTROL_ON; UpdateScrollBar();
fPostProcessingBackup = fPpSlider->Value();
fBrightnessBackup = fBrightnessSlider->Value();
fContrastBackup = fContrastSlider->Value();
fHueBackup = fHueSlider->Value();
fSaturationBackup = fSaturationSlider->Value();
fScreenShotPathBackup.SetTo( fScreenShotPathTC->Text() );
if ( BMenuItem* item = fScreenShotFormatMF->Menu()->FindMarked() )
{
BMessage* message = item->Message();
if ( message && message->FindInt32( kTypeField,
(int32*)&fScreenShotFormatBackup ) != B_OK )
fScreenShotFormatBackup = kDefaultScreenShotFormat;
}
else
fScreenShotFormatBackup = kDefaultScreenShotFormat;
BWindow::Show();
} }
/***************************************************************************** /*****************************************************************************
* PreferencesWindow::ReallyQuit * PreferencesWindow::Update
*****************************************************************************/ *****************************************************************************/
void PreferencesWindow::ReallyQuit() void PreferencesWindow::Update()
{ {
Lock(); /* Get the selected item */
Hide(); if( fOutline->CurrentSelection() < 0 )
Quit(); return;
} StringItemWithView * selectedItem =
(StringItemWithView*) fOutline->ItemAt( fOutline->CurrentSelection() );
void if( fConfigScroll )
PreferencesWindow::_SetGUI( bool dvdMenus, int32 postProcessing,
float brightness, float contrast,
int32 hue, float saturation,
const char* screenShotPath,
uint32 screenShotTranslator)
{
fDvdMenusCheck->SetValue( dvdMenus );
fPpSlider->SetValue( postProcessing );
fBrightnessSlider->SetValue( brightness );
fContrastSlider->SetValue( contrast );
fHueSlider->SetValue( hue );
fSaturationSlider->SetValue( saturation );
// mark appropriate translator item
bool found = false;
for ( int32 i = 0; BMenuItem* item = fScreenShotFormatMF->Menu()->ItemAt( i ); i++ )
{
if ( BMessage* message = item->Message() )
{
uint32 format;
if ( message->FindInt32( kTypeField, (int32*)&format ) == B_OK
&& format == screenShotTranslator )
{
item->SetMarked( true );
found = true;
break;
}
}
}
if ( !found )
{ {
if ( BMenuItem* item = fScreenShotFormatMF->Menu()->ItemAt( 0 ) ) /* If we don't do this, the ConfigView will remember a wrong position */
item->SetMarked( true ); BScrollBar * scrollBar = fConfigScroll->ScrollBar( B_VERTICAL );
scrollBar->SetValue( 0 );
/* Detach the current ConfigView, remove the BScrollView */
BView * view;
while( ( view = fConfigScroll->ChildAt( 0 ) ) )
fConfigScroll->RemoveChild( view );
fDummyView->RemoveChild( fConfigScroll );
delete fConfigScroll;
} }
fScreenShotPathTC->SetText( screenShotPath );
}
/***************************************************************************** /* Create a BScrollView with the new ConfigView in it */
* PreferencesWindow::_SetDefaults fConfigScroll = new BScrollView( "", selectedItem->fConfigView, B_FOLLOW_ALL_SIDES,
*****************************************************************************/ 0, false, true, B_NO_BORDER );
void PreferencesWindow::_SetDefaults() fDummyView->AddChild( fConfigScroll );
{ UpdateScrollBar();
_SetGUI( false, 0, 100.0, 100.0, 0, 100.0,
kDefaultScreenShotPath, kDefaultScreenShotFormat );
}
/*****************************************************************************
* PreferencesWindow::_SetToSettings
*****************************************************************************/
void PreferencesWindow::_SetToSettings()
{
char* path = get_config_string( p_intf, "beos-screenshot-path", kDefaultScreenShotPath );
p_intf->p_sys->b_dvdmenus = get_config_int( p_intf, "beos-use-dvd-menus", false );
_SetGUI( p_intf->p_sys->b_dvdmenus,
get_config_int( p_intf, "ffmpeg-pp-q", 0 ),
100 * get_config_float( p_intf, "brightness", 1.0 ),
100 * get_config_float( p_intf, "contrast", 1.0 ),
get_config_int( p_intf, "hue", 0 ),
100 * get_config_float( p_intf, "saturation", 1.0 ),
path,
get_config_int( p_intf, "beos-screenshot-format",
kDefaultScreenShotFormat ) );
free( path );
} }
/*****************************************************************************
* PreferencesWindow::_RevertChanges
*****************************************************************************/
void
PreferencesWindow::_RevertChanges()
{
_SetGUI( fDVDMenusBackup,
fPostProcessingBackup,
fBrightnessBackup,
fContrastBackup,
fHueBackup,
fSaturationBackup,
fScreenShotPathBackup.String(),
fScreenShotFormatBackup );
_ApplyChanges();
}
/***************************************************************************** /*****************************************************************************
* PreferencesWindow::_ApplyChanges * PreferencesWindow::UpdateScrollBar
*****************************************************************************/ *****************************************************************************/
void PreferencesWindow::_ApplyChanges() void PreferencesWindow::UpdateScrollBar()
{ {
_ApplyScreenShotSettings(); /* We have to fix the scrollbar manually because it doesn't handle
_ApplyPictureSettings(); correctly simple BViews */
_ApplyFFmpegSettings();
_ApplyDVDSettings(); /* Get the current config view */
if( fOutline->CurrentSelection() < 0 )
return;
StringItemWithView * selectedItem =
(StringItemWithView*) fOutline->ItemAt( fOutline->CurrentSelection() );
/* Fix the scrollbar */
BRect visible = fConfigScroll->Bounds() & selectedItem->fConfigView->fRealBounds;
BRect total = fConfigScroll->Bounds() | selectedItem->fConfigView->fRealBounds;
BScrollBar * scrollBar = fConfigScroll->ScrollBar( B_VERTICAL );
long max = (long)( selectedItem->fConfigView->fRealBounds.Height() -
fConfigScroll->Bounds().Height() );
if( max < 0 ) max = 0;
scrollBar->SetRange( 0, max );
scrollBar->SetProportion( visible.Height() / total.Height() );
} }
/***************************************************************************** /*****************************************************************************
* PreferencesWindow::_ApplyScreenShotSettings * PreferencesWindow::ApplyChanges
* Apply changes if doIt is true, revert them otherwise
*****************************************************************************/ *****************************************************************************/
void void PreferencesWindow::ApplyChanges( bool doIt )
PreferencesWindow::_ApplyScreenShotSettings()
{ {
// screen shot settings StringItemWithView * item;
uint32 translator = kDefaultScreenShotFormat; ConfigView * view;
if ( BMenuItem* item = fScreenShotFormatMF->Menu()->FindMarked() ) BView * child;
const char * name;
BString string;
for( int i = 0; i < fOutline->CountItems(); i++ )
{ {
BMessage* message = item->Message(); item = (StringItemWithView*) fOutline->ItemAt( i );
if ( message && message->FindInt32( kTypeField, (int32*)&translator ) != B_OK ) view = item->fConfigView;
translator = kDefaultScreenShotFormat;
}
config_PutInt( p_intf, "beos-screenshot-format", translator );
config_PutPsz( p_intf, "beos-screenshot-path", fScreenShotPathTC->Text() );
}
/***************************************************************************** for( int j = 0; j < view->CountChildren(); j++ )
* PreferencesWindow::_ApplyPictureSettings
*****************************************************************************/
void
PreferencesWindow::_ApplyPictureSettings()
{
VlcWrapper* p_wrapper = p_intf->p_sys->p_wrapper;
// picture adjustment settings
config_PutFloat( p_intf, "brightness",
(float)fBrightnessSlider->Value() / 100 );
config_PutFloat( p_intf, "contrast",
(float)fContrastSlider->Value() / 100 );
config_PutInt( p_intf, "hue", fHueSlider->Value() );
config_PutFloat( p_intf, "saturation",
(float)fSaturationSlider->Value() / 100 );
// take care of changing "filters on the fly"
if( config_GetFloat( p_intf, "brightness" ) != 1 ||
config_GetFloat( p_intf, "contrast" ) != 1 ||
config_GetInt( p_intf, "hue" ) != 0 ||
config_GetFloat( p_intf, "saturation" ) != 1 )
{ {
char* string = config_GetPsz( p_intf, "filter" ); child = view->ChildAt( j );
if( !string || strcmp( string, "adjust" ) ) name = child->Name();
switch( *name )
{ {
config_PutPsz( p_intf, "filter", "adjust" ); case 's': /* BTextControl, string variable */
p_wrapper->FilterChange(); if( doIt )
} config_PutPsz( p_intf, name + 1, ((BTextControl*)child)->Text() );
if ( string ) else
free( string ); ((BTextControl*)child)->SetText( config_GetPsz( p_intf, name + 1 ) );
} break;
case 'i': /* BTextControl, int variable */
if( doIt )
config_PutInt( p_intf, name + 1, atoi( ((BTextControl*)child)->Text() ) );
else else
{ {
char* string = config_GetPsz( p_intf, "filter" ); string = "";
if ( string ) string << config_GetInt( p_intf, name + 1 );
((BTextControl*)child)->SetText( string.String() );
}
break;
case 'f': /* BTextControl, float variable */
if( doIt )
config_PutFloat( p_intf, name + 1,
strtod( ((BTextControl*)child)->Text(), NULL ) );
else
{ {
config_PutPsz( p_intf, "filter", NULL ); string = "";
p_wrapper->FilterChange(); string << config_GetFloat( p_intf, name + 1 );
free( string ); ((BTextControl*)child)->SetText( string.String() );
}
break;
case 'b': /* BCheckBox, bool variable */
if( doIt )
config_PutInt( p_intf, name + 1, ((BCheckBox*)child)->Value() );
else
((BCheckBox*)child)->SetValue( config_GetInt( p_intf, name + 1 ) );
break;
}
} }
} }
} }
/***************************************************************************** /*****************************************************************************
* PreferencesWindow::_ApplyFFmpegSettings * PreferencesWindow::ReallyQuit
*****************************************************************************/
void
PreferencesWindow::_ApplyFFmpegSettings()
{
// ffmpeg post processing
config_PutInt( p_intf, "ffmpeg-pp-q", fPpSlider->Value() );
}
/*****************************************************************************
* PreferencesWindow::_ApplyDVDSettings
*****************************************************************************/ *****************************************************************************/
void void PreferencesWindow::ReallyQuit()
PreferencesWindow::_ApplyDVDSettings()
{ {
// dvd menus Lock();
bool dvdMenus = fDvdMenusCheck->Value() == B_CONTROL_ON; Hide();
p_intf->p_sys->b_dvdmenus = dvdMenus; Quit();
config_PutInt( p_intf, "beos-use-dvd-menus", dvdMenus );
} }
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* PreferencesWindow.h * PreferencesWindow.h
***************************************************************************** *****************************************************************************
* Copyright (C) 1999, 2000, 2001 VideoLAN * 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> * Authors: Eric Petit <titer@videolan.org>
* *
...@@ -25,106 +25,61 @@ ...@@ -25,106 +25,61 @@
#define BEOS_PREFERENCES_WINDOW_H #define BEOS_PREFERENCES_WINDOW_H
#include <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_OK 'prok'
#define PREFS_CANCEL 'prcb' #define PREFS_REVERT 'prre'
#define PREFS_DEFAULTS 'prde' #define PREFS_APPLY 'prap'
#define PREFS_REVERT 'prrv' #define TEXT_HEIGHT 16
#define FFMPEG_UPDATE 'ffup'
#define ADJUST_UPDATE 'ajst' class ConfigView : public BView
#define DVDMENUS_CHECK 'dvme' {
#define SET_TRANSLATOR 'sttr' public:
#define SET_FOLDER 'stdr' 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 StringItemWithView : public BStringItem
class BCheckBox; {
class BSlider; public:
class BStringView; StringItemWithView( const char * text );
class BMenuField;
class BTextControl; /* Here we store the ConfigView associated to this module */
ConfigView * fConfigView;
};
class PreferencesWindow : public BWindow class PreferencesWindow : public BWindow
{ {
public: public:
PreferencesWindow( intf_thread_t* p_intf, PreferencesWindow( intf_thread_t * p_intf,
BRect frame, BRect frame,
const char* name ); const char * name );
virtual ~PreferencesWindow(); virtual ~PreferencesWindow();
virtual bool QuitRequested(); virtual bool QuitRequested();
virtual void MessageReceived(BMessage* message); virtual void MessageReceived(BMessage* message);
virtual void Show(); virtual void FrameResized( float, float );
void Update();
void UpdateScrollBar();
void ApplyChanges( bool doIt );
void ReallyQuit(); void ReallyQuit();
private: private:
void _SetGUI( bool dvdMenus, BView * fPrefsView;
int32 postProcessing, BOutlineListView * fOutline;
float brightness, BView * fDummyView;
float contrast, BScrollView * fConfigScroll;
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;
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 #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