]> git.sesse.net Git - vlc/blobdiff - modules/gui/beos/PreferencesWindow.cpp
* skeleton of the arm crosscompilation howto
[vlc] / modules / gui / beos / PreferencesWindow.cpp
index 0929a2903bd60e51a968f29a9aecb3bec1da8e03..ce0cffba67cb42b6f05fc37845587dc24b832d69 100644 (file)
@@ -2,7 +2,7 @@
  * PreferencesWindow.cpp: beos interface
  *****************************************************************************
  * Copyright (C) 1999, 2000, 2001 VideoLAN
- * $Id: PreferencesWindow.cpp,v 1.3 2002/11/26 01:06:08 titer Exp $
+ * $Id: PreferencesWindow.cpp,v 1.13 2003/02/09 17:10:52 stippi Exp $
  *
  * Authors: Eric Petit <titer@videolan.org>
  *
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
  *****************************************************************************/
 
+/* system headers */
+#include <malloc.h>
+#include <string.h>
+
 /* BeOS headers */
 #include <InterfaceKit.h>
+#include <Entry.h>
+#include <Path.h>
+#include <TranslatorRoster.h>
 
 /* VLC headers */
 #include <vlc/vlc.h>
 #include "MsgVals.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
+ *****************************************************************************/
+class DirectoryTextControl : public BTextControl
+{
+ 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()
+{
+}
+
+/*****************************************************************************
+ * DirectoryTextControl::MessageReceived
+ *****************************************************************************/
+void
+DirectoryTextControl::MessageReceived( BMessage* message )
+{
+       switch ( message->what )
+       {
+               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( BRect frame, const char* name,
-                                                               intf_thread_t *p_interface )
-       :       BWindow( frame, name, B_FLOATING_WINDOW_LOOK, B_NORMAL_WINDOW_FEEL,
-                                B_NOT_ZOOMABLE | B_NOT_RESIZABLE | B_NOT_CLOSABLE )
+PreferencesWindow::PreferencesWindow( intf_thread_t * p_interface,
+                                      BRect frame, const char * name )
+    : BWindow( frame, name, B_FLOATING_WINDOW_LOOK, B_NORMAL_WINDOW_FEEL,
+               B_NOT_ZOOMABLE | B_NOT_RESIZABLE ),
+         fDVDMenusBackup( false ),
+         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;
 
     /* "background" view */
+    rgb_color background = ui_color( B_PANEL_BACKGROUND_COLOR );
     fPrefsView = new BView( Bounds(), NULL, B_FOLLOW_ALL, B_WILL_DRAW );
-    fPrefsView->SetViewColor( ui_color( B_PANEL_BACKGROUND_COLOR ) );
+    fPrefsView->SetViewColor( background );
     AddChild( fPrefsView );
 
     /* add the tabs */
     rect = Bounds();
-    rect.top += 10;
-    rect.bottom -= 65;
+    rect.top += 10.0;
+    rect.bottom -= 45.0;
     fTabView = new BTabView( rect, "preferences view" );
-    fTabView->SetViewColor( ui_color( B_PANEL_BACKGROUND_COLOR ) );
+    fTabView->SetViewColor( background );
     
-    fFfmpegView = new BView( fTabView->Bounds(), NULL, B_FOLLOW_ALL, B_WILL_DRAW );
-    fFfmpegView->SetViewColor( ui_color( B_PANEL_BACKGROUND_COLOR ) );
+    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( ui_color( B_PANEL_BACKGROUND_COLOR ) );
+    fAdjustView->SetViewColor( background );
     
-    fFfmpegTab = new BTab();
-    fTabView->AddTab( fFfmpegView, fFfmpegTab );
-    fFfmpegTab->SetLabel( "Ffmpeg" );
+    fGeneralTab = new BTab();
+    fTabView->AddTab( fGeneralView, fGeneralTab );
+    fGeneralTab->SetLabel( "General" );
     
     fAdjustTab = new BTab();
     fTabView->AddTab( fAdjustView, fAdjustTab );
-    fAdjustTab->SetLabel( "Adjust" );
+    fAdjustTab->SetLabel( "Picture" );
     
     /* fills the tabs */
-    /* ffmpeg tab */
-    rect = fFfmpegView->Bounds();
+    /* general tab */
+    rect = fGeneralView->Bounds();
     rect.InsetBy( 10, 10 );
+    rect.bottom = rect.top + 10;
+    fDvdMenusCheck = new BCheckBox( rect, "dvdmenus", "Use DVD menus",
+                                  new BMessage( DVDMENUS_CHECK ) );
+    fGeneralView->AddChild( fDvdMenusCheck );
+    
+    rect.top = rect.bottom + 20;
     rect.bottom = rect.top + 30;
     fPpSlider = new BSlider( rect, "post-processing", "MPEG4 post-processing level",
-                               new BMessage( SLIDER_UPDATE ),
+                               new BMessage( FFMPEG_UPDATE ),
                                0, 6, B_TRIANGLE_THUMB,
                                B_FOLLOW_LEFT, B_WILL_DRAW ); 
     fPpSlider->SetHashMarks(B_HASH_MARKS_BOTTOM);
     fPpSlider->SetHashMarkCount( 7 );
     fPpSlider->SetLimitLabels( "None", "Maximum" );
-    fFfmpegView->AddChild( fPpSlider );
-    
+    fGeneralView->AddChild( fPpSlider );
+
+
+       rect.top = fPpSlider->Frame().bottom + 5.0;
+       rect.bottom = rect.top + 15.0;
+       fScreenShotPathTC = new DirectoryTextControl( rect, "screenshot path",
+                                                                                                 "Screenshot Path:",
+                                                                                                 fScreenShotPathBackup.String(),
+                                                                                                 new BMessage( SET_FOLDER ) );
+//     fScreenShotPathTC->ResizeToPreferred();
+
+       rect.top = fScreenShotPathTC->Frame().bottom + 5.0;
+       rect.bottom = rect.top + 15.0;  // TODO: this will be so tricky to get right!
+       BMenu* translatorMenu = new BMenu( "translators" );
+       add_translator_items( translatorMenu, B_TRANSLATOR_BITMAP, SET_TRANSLATOR );
+       fScreenShotFormatMF = new BMenuField( rect, "translators field",
+                                                                                 "Screenshot Format:", translatorMenu );
+       fScreenShotFormatMF->Menu()->SetRadioMode( true );
+       fScreenShotFormatMF->Menu()->SetLabelFromMarked( true );
+       // 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 );
+               fScreenShotFormatMF->SetDivider( labelWidthM );
+       }
+       else
+       {
+               fScreenShotPathTC->SetDivider( labelWidthP );
+               fScreenShotFormatMF->SetDivider( labelWidthP );
+       }
+
+    /* restart message */
+    rect = fGeneralView->Bounds();
+    rect.bottom -= 40.0;
+    font_height fh;
+    be_plain_font->GetHeight( &fh );
+    rect.top = rect.bottom - ceilf( fh.ascent + fh.descent ) - 2.0;
+    fRestartString = new BStringView( rect, NULL,
+        "DVD-menu and MPEG4 settings take effect after playback is restarted." );
+    fRestartString->SetAlignment( B_ALIGN_CENTER );
+    fGeneralView->AddChild( fRestartString );
+
     
     /* adjust tab */
     rect = fAdjustView->Bounds();
     rect.InsetBy( 10, 10 );
     rect.bottom = rect.top + 30;
     fBrightnessSlider = new BSlider( rect, "brightness", "Brightness",
-                                       new BMessage( SLIDER_UPDATE ),
+                                       new BMessage( ADJUST_UPDATE ),
                                        0, 200, B_TRIANGLE_THUMB,
                                        B_FOLLOW_LEFT, B_WILL_DRAW );
-    fBrightnessSlider->SetValue( 100 * config_GetFloat( p_intf, "Brightness" ) );
     rect.OffsetBy( 0, 40 );
     fContrastSlider = new BSlider( rect, "contrast", "Contrast",
-                                     new BMessage( SLIDER_UPDATE ),
+                                     new BMessage( ADJUST_UPDATE ),
                                      0, 200, B_TRIANGLE_THUMB,
                                      B_FOLLOW_LEFT, B_WILL_DRAW );
-    fContrastSlider->SetValue( 100 * config_GetFloat( p_intf, "Contrast" ) );
     rect.OffsetBy( 0, 40 );
     fHueSlider = new BSlider( rect, "hue", "Hue",
-                                new BMessage( SLIDER_UPDATE ),
+                                new BMessage( ADJUST_UPDATE ),
                                 0, 360, B_TRIANGLE_THUMB,
                                 B_FOLLOW_LEFT, B_WILL_DRAW );
-    fHueSlider->SetValue( config_GetInt( p_intf, "Hue" ) );
     rect.OffsetBy( 0, 40 );
     fSaturationSlider = new BSlider( rect, "saturation", "Saturation",
-                                       new BMessage( SLIDER_UPDATE ),
+                                       new BMessage( ADJUST_UPDATE ),
                                        0, 200, B_TRIANGLE_THUMB,
                                        B_FOLLOW_LEFT, B_WILL_DRAW );
-    fSaturationSlider->SetValue( 100 * config_GetFloat( p_intf, "Saturation" ) );
     fAdjustView->AddChild( fBrightnessSlider );
     fAdjustView->AddChild( fContrastSlider );
     fAdjustView->AddChild( fHueSlider );
@@ -119,16 +340,6 @@ PreferencesWindow::PreferencesWindow( BRect frame, const char* name,
     
     fPrefsView->AddChild( fTabView );
 
-    /* restart message */
-    rect = fPrefsView->Bounds();
-    rect.bottom -= 43;
-    rect.top = rect.bottom - 10;
-    fRestartString = new BStringView( rect, NULL, "" );
-    rgb_color redColor = {255, 0, 0, 255};
-    fRestartString->SetHighColor(redColor);
-    fRestartString->SetAlignment( B_ALIGN_CENTER );
-    fPrefsView->AddChild( fRestartString );
-
     /* buttons */
     BButton *button;
     rect = Bounds();
@@ -137,18 +348,29 @@ PreferencesWindow::PreferencesWindow( BRect frame, const char* name,
     rect.left = rect.right - 80;
     button = new BButton( rect, NULL, "OK", new BMessage( PREFS_OK ) );
     fPrefsView->AddChild( button );
-    
+
+       SetDefaultButton( button );
+
     rect.OffsetBy( -90, 0 );
     button = new BButton( rect, NULL, "Cancel", new BMessage( PREFS_CANCEL ) );
     fPrefsView->AddChild( button );
-    
+
     rect.OffsetBy( -90, 0 );
+    button = new BButton( rect, NULL, "Revert", new BMessage( PREFS_REVERT ) );
+    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 );
-    
-       // start window thread in hidden state
-       Hide();
-       Show();
+
+
+       // sync GUI to VLC 
+       _SetToSettings();
+
+    // start window thread in hidden state
+    Hide();
+    Show();
 }
 
 /*****************************************************************************
@@ -158,34 +380,84 @@ PreferencesWindow::~PreferencesWindow()
 {
 }
 
+/*****************************************************************************
+ * PreferencesWindow::QuitRequested
+ *****************************************************************************/
+bool
+PreferencesWindow::QuitRequested()
+{
+       // work arround problem when window is closed or Ok pressed though
+       // the text control has focus (it will not have commited changes)
+       config_PutPsz( p_intf, "beos-screenshot-path", fScreenShotPathTC->Text() );
+       if ( !IsHidden() )
+               Hide();
+       return false;
+}
+
 /*****************************************************************************
  * PreferencesWindow::MessageReceived
  *****************************************************************************/
 void PreferencesWindow::MessageReceived( BMessage * p_message )
 {
-       switch ( p_message->what )
+    switch ( p_message->what )
+    {
+       case SET_TRANSLATOR:
+       case SET_FOLDER:
+               _ApplyScreenShotSettings();
+               break;
+        case DVDMENUS_CHECK:
+               _ApplyDVDSettings();
+               break;
+        case ADJUST_UPDATE:
+               _ApplyPictureSettings();
+               break;
+        case FFMPEG_UPDATE:
+               _ApplyFFmpegSettings();
+            break;
+        case PREFS_REVERT:
+               _RevertChanges();
+               break;
+        case PREFS_DEFAULTS:
+            _SetDefaults();
+            _ApplyChanges();
+            break;
+        case PREFS_CANCEL:
+               _RevertChanges();
+               // fall through
+        case PREFS_OK:
+            PostMessage( B_QUIT_REQUESTED );
+            break;
+        default:
+            BWindow::MessageReceived( p_message );
+            break;
+    }
+}
+
+/*****************************************************************************
+ * PreferencesWindow::Show
+ *****************************************************************************/
+void
+PreferencesWindow::Show()
+{
+       // collect settings for backup
+    fDVDMenusBackup = fDvdMenusCheck->Value() == B_CONTROL_ON;
+    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() )
        {
-           case SLIDER_UPDATE:
-           {
-               ApplyChanges();
-               break;
-           }
-           case PREFS_DEFAULTS:
-           {
-               SetDefaults();
-               break;
-           }
-           case PREFS_OK:
-           {
-               config_PutInt( p_intf, "ffmpeg-pp-q", fPpSlider->Value() );
-            config_PutPsz( p_intf, "filter", "adjust" );
-            ApplyChanges();
-            Hide();
-           }
-               default:
-                       BWindow::MessageReceived( p_message );
-                       break;
+               BMessage* message = item->Message();
+               if ( message && message->FindInt32( kTypeField,
+                                                       (int32*)&fScreenShotFormatBackup ) != B_OK )
+                       fScreenShotFormatBackup = kDefaultScreenShotFormat;
        }
+       else
+           fScreenShotFormatBackup = kDefaultScreenShotFormat;
+
+       BWindow::Show();
 }
 
 /*****************************************************************************
@@ -193,62 +465,189 @@ void PreferencesWindow::MessageReceived( BMessage * p_message )
  *****************************************************************************/
 void PreferencesWindow::ReallyQuit()
 {
+    Lock();
     Hide();
     Quit();
 }
 
+void
+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 ) )
+                       item->SetMarked( true );
+       }
+       fScreenShotPathTC->SetText( screenShotPath );
+}
+
+
 /*****************************************************************************
- * PreferencesWindow::SetDefaults
+ * PreferencesWindow::_SetDefaults
  *****************************************************************************/
-void PreferencesWindow::SetDefaults()
+void PreferencesWindow::_SetDefaults()
 {
-    fPpSlider->SetValue( 0 );
-    fBrightnessSlider->SetValue( 100 );
-    fContrastSlider->SetValue( 100 );
-    fHueSlider->SetValue( 0 );
-    fSaturationSlider->SetValue( 100 );
+       _SetGUI( false, 0, 100.0, 100.0, 0, 100.0,
+                       kDefaultScreenShotPath, kDefaultScreenShotFormat );
+}
 
-    fRestartString->SetText( config_GetInt( p_intf, "ffmpeg-pp-q" ) ?
-        "Changes will take effect after you restart playback" : "" );
-    
-    config_PutPsz( p_intf, "filter", NULL );
-    config_PutInt( p_intf, "ffmpeg-pp-q", 0 );
-    
-    ApplyChanges();
+/*****************************************************************************
+ * 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::ApplyChanges
+ * PreferencesWindow::_RevertChanges
  *****************************************************************************/
-void PreferencesWindow::ApplyChanges()
+void
+PreferencesWindow::_RevertChanges()
 {
-    bool b_restart_needed = false;
+       _SetGUI( fDVDMenusBackup,
+                       fPostProcessingBackup,
+                       fBrightnessBackup,
+                       fContrastBackup,
+                       fHueBackup,
+                       fSaturationBackup,
+                       fScreenShotPathBackup.String(),
+                       fScreenShotFormatBackup );
 
-    if( ( !config_GetPsz( p_intf, "filter" ) ||
-          strncmp( config_GetPsz( p_intf, "filter" ), "adjust", 6 ) ) &&
-        ( fBrightnessSlider->Value() != 100 ||
-          fContrastSlider->Value() != 100 ||
-          fHueSlider->Value() ||
-          fSaturationSlider->Value() != 100 ) )
-    {
-        b_restart_needed = true;
-    }
+       _ApplyChanges();
+}
 
-    if( fPpSlider->Value() != config_GetInt( p_intf, "ffmpeg-pp-q" ) )
-    {
-        b_restart_needed = true;
-    }
-    
-    config_PutFloat( p_intf, "Brightness",
+/*****************************************************************************
+ * PreferencesWindow::_ApplyChanges
+ *****************************************************************************/
+void PreferencesWindow::_ApplyChanges()
+{
+       _ApplyScreenShotSettings();
+       _ApplyPictureSettings();
+       _ApplyFFmpegSettings();
+       _ApplyDVDSettings();
+}
+
+/*****************************************************************************
+ * PreferencesWindow::_ApplyScreenShotSettings
+ *****************************************************************************/
+void
+PreferencesWindow::_ApplyScreenShotSettings()
+{
+       // screen shot settings
+       uint32 translator = kDefaultScreenShotFormat;
+       if ( BMenuItem* item = fScreenShotFormatMF->Menu()->FindMarked() )
+       {
+               BMessage* message = item->Message();
+               if ( message && message->FindInt32( kTypeField, (int32*)&translator ) != B_OK )
+                       translator = kDefaultScreenShotFormat;
+       }
+       config_PutInt( p_intf, "beos-screenshot-format", translator );
+       config_PutPsz( p_intf, "beos-screenshot-path", fScreenShotPathTC->Text() );
+}
+
+/*****************************************************************************
+ * 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",
+    config_PutFloat( p_intf, "contrast",
                      (float)fContrastSlider->Value() / 100 );
-    config_PutInt( p_intf, "Hue", fHueSlider->Value() );
-    config_PutFloat( p_intf, "Saturation",
+    config_PutInt( p_intf, "hue", fHueSlider->Value() );
+    config_PutFloat( p_intf, "saturation",
                      (float)fSaturationSlider->Value() / 100 );
-    
-    fRestartString->LockLooper();
-    fRestartString->SetText( b_restart_needed ?
-        "Changes will take effect after you restart playback" : "" );
-    fRestartString->UnlockLooper();
+
+       // 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" );
+        if( !string || strcmp( string, "adjust" ) )
+        {
+            config_PutPsz( p_intf, "filter", "adjust" );
+            p_wrapper->FilterChange();
+        }
+        if ( string )
+               free( string );
+    }
+    else
+    {
+       char* string = config_GetPsz( p_intf, "filter" );
+        if ( string )
+        {
+            config_PutPsz( p_intf, "filter", NULL );
+            p_wrapper->FilterChange();
+               free( string );
+        }
+    }
+}
+
+/*****************************************************************************
+ * PreferencesWindow::_ApplyFFmpegSettings
+ *****************************************************************************/
+void
+PreferencesWindow::_ApplyFFmpegSettings()
+{
+       // ffmpeg post processing
+    config_PutInt( p_intf, "ffmpeg-pp-q", fPpSlider->Value() );
 }
+
+/*****************************************************************************
+ * PreferencesWindow::_ApplyDVDSettings
+ *****************************************************************************/
+void
+PreferencesWindow::_ApplyDVDSettings()
+{
+       // dvd menus
+       bool dvdMenus = fDvdMenusCheck->Value() == B_CONTROL_ON;
+       p_intf->p_sys->b_dvdmenus = dvdMenus;
+       config_PutInt( p_intf, "beos-use-dvd-menus", dvdMenus );
+}
+