]> git.sesse.net Git - vlc/blobdiff - modules/gui/macosx/extended.m
macosx: get rid of the infamous 'get' prefixes everywhere and finally respect Cocoa...
[vlc] / modules / gui / macosx / extended.m
index e8247825be1fc71bcb06d21016a9d1cd219c1726..7b182e881273e1afa6d5aa3313eb527e2191542b 100644 (file)
@@ -1,10 +1,10 @@
 /*****************************************************************************
  * extended.m: MacOS X Extended interface panel
  *****************************************************************************
- * Copyright (C) 2005-2006 the VideoLAN team
+ * Copyright (C) 2005-2008 the VideoLAN team
  * $Id$
  *
- * Authors: Felix Kühne <fkuehne@users.sf.net>
+ * Authors: Felix Paul Kühne <fkuehne@videolan.org>
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  *****************************************************************************/
 
 
-/*****************************************************************************
- * Note: 
- * the code used to bind with VLC's modules is heavily based upon 
- * ../wxwidgets/extrapanel.cpp, written by Clément Stenac.
- * the code used to insert/remove the views was inspired by intf.m, 
- * written by Derk-Jan Hartman and Benjamin Pracht. 
- * (all 3 are members of the VideoLAN team) 
- *****************************************************************************/
-
-
 /*****************************************************************************
  * Preamble
  *****************************************************************************/
 
 #import "extended.h"
-#import "intf.h"
 #import "vout.h"
-#import <vlc/aout.h>
-#import <aout_internal.h>
-#import <vlc/vout.h>
-#import <vlc/intf.h>
+#import <vlc_aout.h>
+#import <vlc_vout.h>
+#import <vlc_interface.h>
 
 /*****************************************************************************
  * VLCExtended implementation
@@ -77,12 +65,7 @@ static VLCExtended *_o_sharedInstance = nil;
     /* localise GUI-strings */
     /* method is called from intf.m (in method showExtended) */
     [o_extended_window setTitle: _NS("Extended controls")];
-    [o_lbl_video setStringValue: _NS("Video")];
-    [o_lbl_audio setStringValue: _NS("Audio")];
-    [o_lbl_audioFlts setStringValue: _NS("Audio filters")];
-    [o_lbl_videoFlts setStringValue: _NS("Video filters")];
-    [o_lbl_adjustImage setStringValue: _NS("Image adjustment")];
-    [o_btn_vidFlts_mrInfo setTitle: _NS("More Info")];
+    [o_btn_vidFlts_mrInfo setToolTip: _NS("Shows more information about the available video filters.")];
     [o_ckb_wave setTitle: _NS("Wave")];
     [o_ckb_ripple setTitle: _NS("Ripple")];
     [o_ckb_psycho setTitle: _NS("Psychedelic")];
@@ -104,10 +87,10 @@ static VLCExtended *_o_sharedInstance = nil;
     [o_ckb_intZoom setToolTip: _NS("Enables an interactive Zoom feature")];
     [o_ckb_vlme_norm setTitle: _NS("Volume normalization")];
     [o_ckb_vlme_norm setToolTip: _NS("Prevents the audio output from going "
-        "over a predefined value.")];
+                                     "over a predefined value.")];
     [o_ckb_hdphnVirt setTitle: _NS("Headphone virtualization")];
     [o_ckb_hdphnVirt setToolTip: _NS("Imitates the effect of surround sound "
-        "when using headphones.")];
+                                     "when using headphones.")];
     [o_lbl_maxLevel setStringValue: _NS("Maximum level")];
     [o_btn_rstrDefaults setTitle: _NS("Restore Defaults")];
     [o_ckb_enblAdjustImg setTitle: _NS("Enable")];
@@ -117,7 +100,7 @@ static VLCExtended *_o_sharedInstance = nil;
     [o_lbl_hue setStringValue: _NS("Hue")];
     [o_lbl_saturation setStringValue: _NS("Saturation")];
     [o_lbl_opaque setStringValue: _NS("Opaqueness")];
-    
 }
 
 - (void)awakeFromNib
@@ -127,7 +110,22 @@ static VLCExtended *_o_sharedInstance = nil;
     char * psz_vfilters;
     intf_thread_t * p_intf = VLCIntf;
     psz_vfilters = config_GetPsz( p_intf, "vout-filter" );
-    if( psz_vfilters && strstr( psz_vfilters, "adjust" ) )
+    /* set the video-filter-checkboxes to the correct values */
+    if( psz_vfilters )
+    {
+        [o_ckb_blur setState: (NSInteger)strstr( psz_vfilters, "motionblur")];
+        [o_ckb_imgClone setState: (NSInteger)strstr( psz_vfilters, "clone")];
+        [o_ckb_imgCrop setState: (NSInteger)strstr( psz_vfilters, "crop")];
+        [o_ckb_trnsform setState: (NSInteger)strstr( psz_vfilters, "transform")];
+        [o_ckb_intZoom setState: (NSInteger)strstr( psz_vfilters, "magnify")];
+
+        free( psz_vfilters );
+    }
+    /* set the video-filter checkboxes to the correct values */
+    char * psz_vifilters;
+    psz_vifilters = config_GetPsz( p_intf, "video-filter" );
+    if( psz_vifilters && strstr( psz_vifilters, "adjust" ) )
     {
         [o_ckb_enblAdjustImg setState: NSOnState];
         [o_btn_rstrDefaults setEnabled: YES];
@@ -147,62 +145,42 @@ static VLCExtended *_o_sharedInstance = nil;
         [o_sld_hue setEnabled: NO];
         [o_sld_saturation setEnabled: NO];
     }
-    
-    /* set the other video-filter-checkboxes to the correct values */
-    if( psz_vfilters )
-    {
-        [o_ckb_blur setState: (int)strstr( psz_vfilters, "motionblur")];
-        [o_ckb_imgClone setState: (int)strstr( psz_vfilters, "clone")];
-        [o_ckb_imgCrop setState: (int)strstr( psz_vfilters, "crop")];
-        [o_ckb_trnsform setState: (int)strstr( psz_vfilters, "transform")];
-
-        free( psz_vfilters );
-    }
-    
-    /* set the video-filter checkboxes to the correct values */
-    char * psz_vifilters;
-    psz_vifilters = config_GetPsz( p_intf, "video-filter" );
     if( psz_vifilters )
     {
-        [o_ckb_wave setState: (int)strstr( psz_vifilters, "wave")];
-        [o_ckb_psycho setState: (int)strstr( psz_vifilters, "psychedelic")];
-        [o_ckb_ripple setState: (int)strstr( psz_vifilters, "ripple")];
-        [o_ckb_gradient setState: (int)strstr( psz_vifilters, "gradient")];
-        [o_ckb_imgInvers setState: (int)strstr( psz_vifilters, "invert")];
+        [o_ckb_wave setState: (NSInteger)strstr( psz_vifilters, "wave")];
+        [o_ckb_psycho setState: (NSInteger)strstr( psz_vifilters, "psychedelic")];
+        [o_ckb_ripple setState: (NSInteger)strstr( psz_vifilters, "ripple")];
+        [o_ckb_gradient setState: (NSInteger)strstr( psz_vifilters, "gradient")];
+        [o_ckb_imgInvers setState: (NSInteger)strstr( psz_vifilters, "invert")];
 
         free( psz_vifilters );
     }
-    
     /* set the audio-filter-checkboxes to the values taken from the prefs */
     char * psz_afilters;
     psz_afilters = config_GetPsz( p_intf, "audio-filter" );
     if( psz_afilters )
     {
-        [o_ckb_hdphnVirt setState: (int)strstr( psz_afilters, "headphone" ) ];
-        [o_ckb_vlme_norm setState: (int)strstr( psz_afilters, "normvol" ) ];
-        
+        [o_ckb_hdphnVirt setState: (NSInteger)strstr( psz_afilters, "headphone" ) ];
+        [o_ckb_vlme_norm setState: (NSInteger)strstr( psz_afilters, "normvol" ) ];
         free( psz_afilters );
     }
-}
 
-- (void)collapsAll
-{
-    /* collaps all views so Cocoa saves the window position correctly */
-    if( o_adjImg_expanded )
-    {
-        [self extWin_exp_adjImg: nil];
-    }
-    if( o_audFlts_expanded )
-    {
-        [self extWin_exp_audFlts: nil];
-    }
-    if( o_vidFlts_expanded )
-    {
-        [self extWin_exp_vidFlts: nil];
-    }
+    /* fill the popup button according to our available views */
+    [o_selector_pop removeAllItems];
+    [o_selector_pop addItemWithTitle: _NS("Adjust Image")];
+    [o_selector_pop addItemWithTitle: _NS("Video Filter")];
+    [o_selector_pop addItemWithTitle: _NS("Audio Filter")];
+    [o_selector_pop selectItemAtIndex: 0];
+
+    /* make sure we draw a view on launch */
+    [self viewSelectorAction: self];
+
+    [self initStrings];
 }
 
-- (BOOL)getConfigChanged
+- (BOOL)configChanged
 {
     return o_config_changed;
 }
@@ -220,47 +198,83 @@ static VLCExtended *_o_sharedInstance = nil;
     }
 
     float f_value;
-    
     f_value = config_GetFloat( p_intf, "saturation" );
     if( f_value > 0 && f_value < 5 )
-    {
         [o_sld_saturation setIntValue: (int)(100 * f_value) ];
-    }
 
     f_value = config_GetFloat( p_intf, "contrast" );
     if( f_value > 0 && f_value < 4 )
-    {
         [o_sld_contrast setIntValue: (int)(100 * f_value) ];
-    }
 
     f_value = config_GetFloat( p_intf, "brightness" );
     if( f_value > 0 && f_value < 2 )
-    {
         [o_sld_brightness setIntValue: (int)(100 * f_value) ];
-    }
 
     f_value = config_GetFloat( p_intf, "gamma" );
     if( f_value > 0 && f_value < 10 )
-    {
         [o_sld_gamma setIntValue: (int)(10 * f_value) ];
-    }
 
     f_value = config_GetFloat( p_intf, "norm-max-level" );
     if( f_value > 0 && f_value < 10 )
-    {
         [o_sld_maxLevel setFloatValue: f_value ];
-    }
 
     [o_sld_opaque setFloatValue: (config_GetFloat( p_intf,
         "macosx-opaqueness") * 100)];
 
-
     /* show the window */
     [o_extended_window displayIfNeeded];
     [o_extended_window makeKeyAndOrderFront:nil];
 }
 
-- (IBAction)adjImg_Enbl:(id)sender
+- (IBAction)viewSelectorAction:(id)sender
+{
+    NSView *o_toBeShown_view;
+    /* check which view to show */
+    if( [[[o_selector_pop selectedItem] title] isEqualToString: _NS("Adjust Image")] )
+        o_toBeShown_view = o_adjustImg_view;
+    else if( [[[o_selector_pop selectedItem] title] isEqualToString: _NS("Audio Filter")] )
+        o_toBeShown_view = o_audioFlts_view;
+    else if( [[[o_selector_pop selectedItem] title] isEqualToString: _NS("Video Filter")] )
+        o_toBeShown_view = o_videoFilters_view;
+    else
+        msg_Err( VLCIntf, "invalid ui view requested" );
+    
+    NSRect o_win_rect, o_view_rect, o_old_view_rect;
+    o_win_rect = [o_extended_window frame];
+    o_view_rect = [o_toBeShown_view frame];
+    
+    if( o_currentlyshown_view != nil )
+    {
+        /* restore our window's height, if we've shown another category previously */
+        o_old_view_rect = [o_currentlyshown_view frame];
+        o_win_rect.size.height = o_win_rect.size.height - o_old_view_rect.size.height;
+        o_win_rect.origin.y = ( o_win_rect.origin.y + o_old_view_rect.size.height ) - o_view_rect.size.height;
+        
+        /* remove our previous category view */
+        [o_currentlyshown_view removeFromSuperviewWithoutNeedingDisplay];
+    }
+    
+    o_win_rect.size.height = o_win_rect.size.height + o_view_rect.size.height;
+    
+    //[o_extended_window displayIfNeeded];
+    [o_extended_window setFrame: o_win_rect display:YES animate: YES];
+    
+    [o_toBeShown_view setFrame: NSMakeRect( 0, 
+                                              0, //[o_top_controls_box frame].size.height, 
+                                              o_view_rect.size.width, 
+                                              o_view_rect.size.height )];
+    [o_toBeShown_view setNeedsDisplay: YES];
+    [o_toBeShown_view setAutoresizesSubviews: YES];
+    [[o_extended_window contentView] addSubview: o_toBeShown_view];
+
+    /* keep our current category for further reference */
+    [o_currentlyshown_view release];
+    o_currentlyshown_view = o_toBeShown_view;
+    [o_currentlyshown_view retain];
+}
+
+- (IBAction)enableAdjustImage:(id)sender
 {
     /* en-/disable the sliders */
     if ([o_ckb_enblAdjustImg state] == NSOnState)
@@ -271,19 +285,21 @@ static VLCExtended *_o_sharedInstance = nil;
         [o_sld_gamma setEnabled: YES];
         [o_sld_hue setEnabled: YES];
         [o_sld_saturation setEnabled: YES];
-        [self changeVoutFiltersString: "adjust" onOrOff: VLC_TRUE];
-    }else{
+        [self changeVideoFiltersString: "adjust" onOrOff: true];
+    }
+    else
+    {
         [o_btn_rstrDefaults setEnabled: NO];
         [o_sld_brightness setEnabled: NO];
         [o_sld_contrast setEnabled: NO];
         [o_sld_gamma setEnabled: NO];
         [o_sld_hue setEnabled: NO];
         [o_sld_saturation setEnabled: NO];
-        [self changeVoutFiltersString: "adjust" onOrOff: VLC_FALSE];
+        [self changeVideoFiltersString: "adjust" onOrOff: false];
     }
 }
 
-- (IBAction)adjImg_rstrDefaults:(id)sender
+- (IBAction)restoreDefaultsForAdjustImage:(id)sender
 {
     /* reset the sliders */
     [o_sld_brightness setIntValue: 100];
@@ -291,71 +307,94 @@ static VLCExtended *_o_sharedInstance = nil;
     [o_sld_gamma setIntValue: 10];
     [o_sld_hue setIntValue: 0];
     [o_sld_saturation setIntValue: 100];
-    
+    [o_sld_opaque setIntValue: 100];
+
     /* transmit the values */
-    [self adjImg_sliders: o_sld_brightness];
-    [self adjImg_sliders: o_sld_contrast];
-    [self adjImg_sliders: o_sld_gamma];
-    [self adjImg_sliders: o_sld_hue];
-    [self adjImg_sliders: o_sld_saturation];
+    [self sliderActionAdjustImage: o_sld_brightness];
+    [self sliderActionAdjustImage: o_sld_contrast];
+    [self sliderActionAdjustImage: o_sld_gamma];
+    [self sliderActionAdjustImage: o_sld_hue];
+    [self sliderActionAdjustImage: o_sld_saturation];
+    [self opaqueSliderAction: o_sld_opaque];
 }
 
-- (IBAction)adjImg_sliders:(id)sender
+- (IBAction)sliderActionAdjustImage:(id)sender
 {
     /* read-out the sliders' values and apply them */
     intf_thread_t * p_intf = VLCIntf;
-    vout_thread_t *p_vout = (vout_thread_t *)vlc_object_find(p_intf,
-                                 VLC_OBJECT_VOUT, FIND_ANYWHERE);
+    vout_thread_t *p_vout = (vout_thread_t *)vlc_object_find(p_intf, VLC_OBJECT_VOUT, FIND_ANYWHERE);
+    vlc_object_t *p_filter;
+
     if( p_vout == NULL )
     {
+        msg_Dbg( p_intf, "no vout present, saving settings anyway" );
         if (sender == o_sld_brightness)
         {
             config_PutFloat( p_intf , "brightness" , [o_sld_brightness floatValue] / 100);
-        } else if (sender == o_sld_contrast)
+        } 
+        else if (sender == o_sld_contrast)
         {
             config_PutFloat( p_intf , "contrast" , [o_sld_contrast floatValue] / 100);
-        } else if (sender == o_sld_gamma)
+        } 
+        else if (sender == o_sld_gamma)
         {
             config_PutFloat( p_intf , "gamma" , [o_sld_gamma floatValue] / 10);
-        } else if (sender == o_sld_hue)
+        } 
+        else if (sender == o_sld_hue)
         {
             config_PutInt( p_intf , "hue" , [o_sld_hue intValue]);
-        } else if (sender == o_sld_saturation)
+        } 
+        else if (sender == o_sld_saturation)
         {
             config_PutFloat( p_intf , "saturation" , [o_sld_saturation floatValue] / 100);
-        } else {
+        } 
+        else
+        {
             msg_Warn( p_intf, "the corresponding subfilter coundn't be found" );
         }
-    } else {
-        vlc_value_t val;
+    } 
+    else
+    {
+        msg_Dbg( p_intf, "we found a vout to adjust, let's look for the filter" );
+        p_filter = (vlc_object_t *)vlc_object_find_name( p_intf, "adjust", FIND_ANYWHERE );
+
+        if(! p_filter )
+        {
+            msg_Err( p_intf, "we're unable to find the adjust filter!" );
+            vlc_object_release( p_vout );
+            return;
+        }
+
         if (sender == o_sld_brightness)
         {
-            val.f_float = [o_sld_brightness floatValue] / 100;
-            var_Set( p_vout, "brightness", val );
-            config_PutFloat( p_intf , "brightness" , [o_sld_brightness floatValue] / 100);
-        else if (sender == o_sld_contrast)
+            var_SetFloat( p_filter, "brightness", [o_sld_brightness floatValue] / 100 );
+            config_PutFloat( p_intf, "brightness", [o_sld_brightness floatValue] / 100 );
+        } 
+        else if (sender == o_sld_contrast)
         {
-            val.f_float = [o_sld_contrast floatValue] / 100;
-            var_Set( p_vout, "contrast", val );
-            config_PutFloat( p_intf , "contrast" , [o_sld_contrast floatValue] / 100);
-        else if (sender == o_sld_gamma)
+            var_SetFloat( p_filter, "contrast", [o_sld_contrast floatValue] / 100 );
+            config_PutFloat( p_intf, "contrast", [o_sld_contrast floatValue] / 100 );
+        } 
+        else if (sender == o_sld_gamma)
         {
-            val.f_float = [o_sld_gamma floatValue] / 10;
-            var_Set( p_vout, "gamma", val );
-            config_PutFloat( p_intf , "gamma" , [o_sld_gamma floatValue] / 10);
-        else if (sender == o_sld_hue)
+            var_SetFloat( p_filter, "gamma", [o_sld_gamma floatValue] / 10 );
+            config_PutFloat( p_intf, "gamma", [o_sld_gamma floatValue] / 10 );
+        } 
+        else if (sender == o_sld_hue)
         {
-            val.i_int = [o_sld_hue intValue];
-            var_Set( p_vout, "hue", val );
-            config_PutInt( p_intf , "hue" , [o_sld_hue intValue]);
-        else if (sender == o_sld_saturation)
+            var_SetInteger( p_filter, "hue", [o_sld_hue intValue] );
+            config_PutInt( p_intf , "hue" , [o_sld_hue intValue] );
+        } 
+        else if (sender == o_sld_saturation)
         {
-            val.f_float = [o_sld_saturation floatValue] / 100;
-            var_Set( p_vout, "saturation", val );
-            config_PutFloat( p_intf , "saturation" , [o_sld_saturation floatValue] / 100);
-        } else {
-            msg_Warn( p_intf, "the corresponding subfilter coundn't be found" );
+            var_SetFloat( p_filter, "saturation", [o_sld_saturation floatValue] / 100 );
+            config_PutFloat( p_intf , "saturation" , [o_sld_saturation floatValue] / 100 );
+        } 
+        else
+        {
+            msg_Warn( p_intf, "couldn't find variable for slider!" );
         }
+        vlc_object_release( p_filter );
         vlc_object_release( p_vout );
     }
 
@@ -363,28 +402,27 @@ static VLCExtended *_o_sharedInstance = nil;
 }
 
 /* change the opaqueness of the vouts */
-- (IBAction)adjImg_opaque:(id)sender
+- (IBAction)opaqueSliderAction:(id)sender
 {
     vlc_value_t val;
     id o_window = [NSApp keyWindow];
     NSArray *o_windows = [NSApp orderedWindows];
     NSEnumerator *o_enumerator = [o_windows objectEnumerator];
-    playlist_t * p_playlist = pl_Yield( VLCIntf );
+    playlist_t * p_playlist = pl_Hold( VLCIntf );
     vout_thread_t *p_vout = vlc_object_find( VLCIntf, VLC_OBJECT_VOUT, FIND_ANYWHERE );
     vout_thread_t *p_real_vout;
 
     val.f_float = [o_sld_opaque floatValue] / 100;
 
-
     if( p_vout != NULL )
     {
-        p_real_vout = [VLCVoutView getRealVout: p_vout];
+        p_real_vout = [VLCVoutView realVout: p_vout];
         var_Set( p_real_vout, "macosx-opaqueness", val );
 
         while ((o_window = [o_enumerator nextObject]))
         {
-            if( [[o_window className] isEqualToString: @"VLCWindow"] ||
-                [[[VLCMain sharedInstance] getEmbeddedList]
+            if( [[o_window className] isEqualToString: @"VLCVoutWindow"] ||
+                [[[VLCMain sharedInstance] embeddedList]
                                     windowContainsEmbedded: o_window])
             {
                 [o_window setAlphaValue: val.f_float];
@@ -393,192 +431,55 @@ static VLCExtended *_o_sharedInstance = nil;
         }
         vlc_object_release( p_vout );
     }
-    
+
     /* store to prefs */
     config_PutFloat( p_playlist , "macosx-opaqueness" , val.f_float );
-    
-    vlc_object_release( p_playlist );
+
+    pl_Release( VLCIntf );
 
     o_config_changed = YES;
 }
 
-- (IBAction)audFtls_hdphnVirt:(id)sender
+- (IBAction)enableHeadphoneVirtualizer:(id)sender
 {
     /* en-/disable headphone virtualisation */
     if ([o_ckb_hdphnVirt state] == NSOnState)
-    {
-        [self changeAFiltersString: "headphone_channel_mixer" onOrOff: VLC_TRUE ];
-    }else{
-        [self changeAFiltersString: "headphone_channel_mixer" onOrOff: VLC_FALSE ];
-    }
+        [self changeAFiltersString: "headphone_channel_mixer" onOrOff: true ];
+    else
+        [self changeAFiltersString: "headphone_channel_mixer" onOrOff: false ];
 }
 
-- (IBAction)audFtls_maxLevelSld:(id)sender
+- (IBAction)sliderActionMaximumAudioLevel:(id)sender
 {
     /* read-out the slider's value and apply it */
     intf_thread_t * p_intf = VLCIntf;
-    aout_instance_t * p_aout= (aout_instance_t *)vlc_object_find(p_intf,
-                                 VLC_OBJECT_AOUT, FIND_ANYWHERE);
+    aout_instance_t * p_aout= (aout_instance_t *)vlc_object_find(p_intf, VLC_OBJECT_AOUT, FIND_ANYWHERE);
+
     if( p_aout != NULL )
     {
         var_SetFloat( p_aout, "norm-max-level", [o_sld_maxLevel floatValue] );
         vlc_object_release( p_aout );
     }
+
     config_PutFloat( p_intf, "norm-max-level", [o_sld_maxLevel floatValue] );
 
     o_config_changed = YES;
 }
 
-- (IBAction)audFtls_vlmeNorm:(id)sender
+- (IBAction)enableVolumeNormalization:(id)sender
 {
     /* en-/disable volume normalisation */
-    if ([o_ckb_vlme_norm state] == NSOnState)
-    {
+    if( [o_ckb_vlme_norm state] == NSOnState )
         [self changeAFiltersString: "normvol" onOrOff: YES ];
-    }else{
+    else
         [self changeAFiltersString: "normvol" onOrOff: NO ];
-    }
-}
-
-- (IBAction)extWin_exp_adjImg:(id)sender
-{
-    /* expand or collapse adjImg */
-    NSRect o_win_rect = [o_extended_window frame];
-    NSRect o_box_audFlts_rect = [o_box_audFlts frame];
-    NSRect o_box_vidFlts_rect = [o_box_vidFlts frame];
-    NSRect o_box_adjImg_rect = [o_box_adjImg frame];
-    
-    if (o_adjImg_expanded)
-    {
-        /* move the window contents upwards (partially done through settings
-         * inside the nib) and resize the window */
-        o_win_rect.size.height = o_win_rect.size.height - 193;
-        o_win_rect.origin.y = [o_extended_window frame].origin.y + 193;
-        o_box_audFlts_rect.origin.y = o_box_audFlts_rect.origin.y + 193;
-        o_box_vidFlts_rect.origin.y = o_box_vidFlts_rect.origin.y + 193;
-        
-        /* remove the inserted view */
-        [o_adjustImg_view removeFromSuperviewWithoutNeedingDisplay];
-    }else{
-    
-        /* move the window contents downwards and resize the window */
-        o_win_rect.size.height = o_win_rect.size.height + 193;
-        o_win_rect.origin.y = [o_extended_window frame].origin.y - 193;
-        o_box_audFlts_rect.origin.y = o_box_audFlts_rect.origin.y - 193;
-        o_box_vidFlts_rect.origin.y = o_box_vidFlts_rect.origin.y - 193;
-    }
-    
-    [o_box_audFlts setFrameFromContentFrame: o_box_audFlts_rect];
-    [o_box_vidFlts setFrameFromContentFrame: o_box_vidFlts_rect];
-    [o_extended_window displayIfNeeded];
-    [o_extended_window setFrame: o_win_rect display:YES animate: YES];
-    
-    if (o_adjImg_expanded)
-    {
-        o_box_adjImg_rect.size.height = [o_box_adjImg frame].size.height - 193;
-        o_adjImg_expanded = NO;
-    } else {
-        /* insert view */
-        o_box_adjImg_rect.size.height = [o_box_adjImg frame].size.height + 193;
-        [o_adjustImg_view setFrame: NSMakeRect( 20, -10, 370, 203)];
-        [o_adjustImg_view setNeedsDisplay:YES];
-        [o_adjustImg_view setAutoresizesSubviews: YES];
-        [[o_box_adjImg contentView] addSubview: o_adjustImg_view];
-        o_adjImg_expanded = YES;
-    }
-    [o_box_adjImg setFrameFromContentFrame: o_box_adjImg_rect];
-}
-
-- (IBAction)extWin_exp_audFlts:(id)sender
-{
-    /* expand or collapse audFlts */
-    NSRect o_win_rect = [o_extended_window frame];
-    NSRect o_box_audFlts_rect = [o_box_audFlts frame];
-    
-    if (o_audFlts_expanded)
-    {
-        /* move the window contents upwards (partially done through settings
-         * inside the nib) and resize the window */
-        o_win_rect.size.height = o_win_rect.size.height - 66;
-        o_win_rect.origin.y = [o_extended_window frame].origin.y + 66;
-        
-        /* remove the inserted view */
-        [o_audioFlts_view removeFromSuperviewWithoutNeedingDisplay];
-    }else{
-        /* move the window contents downwards and resize the window */
-        o_win_rect.size.height = o_win_rect.size.height + 66;
-        o_win_rect.origin.y = [o_extended_window frame].origin.y - 66;
-    }
-    [o_extended_window displayIfNeeded];
-    [o_extended_window setFrame: o_win_rect display:YES animate: YES];
-    
-    
-    if (o_audFlts_expanded)
-    {
-        o_box_audFlts_rect.size.height = [o_box_audFlts frame].size.height - 66;
-        o_audFlts_expanded = NO;
-    } else {
-        /* insert view */
-        o_box_audFlts_rect.size.height = [o_box_audFlts frame].size.height + 66;
-        [o_audioFlts_view setFrame: NSMakeRect( 20, -20, 370, 76)];
-        [o_audioFlts_view setNeedsDisplay:YES];
-        [o_audioFlts_view setAutoresizesSubviews: YES];
-        [[o_box_audFlts contentView] addSubview: o_audioFlts_view];
-        o_audFlts_expanded = YES;
-    }
-    [o_box_audFlts setFrameFromContentFrame: o_box_audFlts_rect];
-}
-
-- (IBAction)extWin_exp_vidFlts:(id)sender
-{
-    /* expand or collapse vidFlts */
-    NSRect o_win_rect = [o_extended_window frame];
-    NSRect o_box_audFlts_rect = [o_box_audFlts frame];
-    NSRect o_box_vidFlts_rect = [o_box_vidFlts frame];
-    
-    if (o_vidFlts_expanded)
-    {
-        /* move the window contents upwards (partially done through settings
-         * inside the nib) and resize the window */
-        o_win_rect.size.height = o_win_rect.size.height - 188;
-        o_win_rect.origin.y = [o_extended_window frame].origin.y + 188;
-        o_box_audFlts_rect.origin.y = o_box_audFlts_rect.origin.y + 188;
-        
-        /* remove the inserted view */
-        [o_videoFilters_view removeFromSuperviewWithoutNeedingDisplay];
-    }else{
-    
-        /* move the window contents downwards and resize the window */
-        o_win_rect.size.height = o_win_rect.size.height + 188;
-        o_win_rect.origin.y = [o_extended_window frame].origin.y - 188;
-        o_box_audFlts_rect.origin.y = o_box_audFlts_rect.origin.y - 188;
-    }
-    
-    [o_box_audFlts setFrameFromContentFrame: o_box_audFlts_rect];
-    [o_extended_window displayIfNeeded];
-    [o_extended_window setFrame: o_win_rect display:YES animate: YES];
-    
-    if (o_vidFlts_expanded)
-    {
-        o_box_vidFlts_rect.size.height = [o_box_vidFlts frame].size.height - 188;
-        o_vidFlts_expanded = NO;
-    } else {
-        /* insert view */
-        o_box_vidFlts_rect.size.height = [o_box_vidFlts frame].size.height + 188;
-        [o_videoFilters_view setFrame: NSMakeRect( 20, -10, 370, 188)];
-        [o_videoFilters_view setNeedsDisplay:YES];
-        [o_videoFilters_view setAutoresizesSubviews: YES];
-        [[o_box_vidFlts contentView] addSubview: o_videoFilters_view];
-        o_vidFlts_expanded = YES;
-    }
-    [o_box_vidFlts setFrameFromContentFrame: o_box_vidFlts_rect];
 }
 
-- (IBAction)vidFlts:(id)sender
+- (IBAction)videoFilterAction:(id)sender
 {
     /* en-/disable video filters */
     if (sender == o_ckb_blur)
-        [self changeVoutFiltersString: "motionblur" onOrOff: [o_ckb_blur state]];
+        [self changeVideoFiltersString: "motionblur" onOrOff: [o_ckb_blur state]];
 
     else if (sender == o_ckb_imgClone)
         [self changeVoutFiltersString: "clone" onOrOff: [o_ckb_imgClone state]];
@@ -607,22 +508,27 @@ static VLCExtended *_o_sharedInstance = nil;
     else if (sender == o_ckb_ripple )
         [self changeVideoFiltersString: "ripple" onOrOff: [o_ckb_ripple state]];
 
-    else {
-        /* this shouldn't happen */
-        msg_Warn (VLCIntf, "cannot find switched video-filter");
-    }
+    else
+        msg_Err( VLCIntf, "cannot find switched video-filter" ); /* this can't happen */
 }
 
-- (IBAction)vidFlts_mrInfo:(id)sender
+- (IBAction)moreInfoVideoFilters:(id)sender
 {
     /* show info sheet */
-    NSBeginInformationalAlertSheet(_NS("More Information"), _NS("OK"), @"", @"",
-        o_extended_window, nil, nil, nil, nil, _NS("This panel allows to "
-        "select video effects filters to apply.\n"
-        "The filters can be configured individually in the Preferences, in "
-        "the subsections of Video/Filters.\n"
-        "To choose the order in which the filter are applied, a filter "
-        "option string can be set in the Preferences, Video / Filters section."));
+    NSBeginInformationalAlertSheet(_NS("About the video filters"), 
+                                   _NS("OK"), 
+                                   @"", 
+                                   @"",
+                                   o_extended_window, 
+                                   nil, 
+                                   nil, 
+                                   nil, 
+                                   nil, 
+                                   _NS("This panel allows on-the-fly selection of various video effects.\n"
+                                       "These filters can be configured individually in the Preferences, in "
+                                       "the subsections of Video/Filters.\n"
+                                       "To choose the order in which the filter are applied, a filter "
+                                       "option string can be set in the Preferences, Video / Filters section."));
 }
 
 
@@ -630,20 +536,20 @@ static VLCExtended *_o_sharedInstance = nil;
  * methods to communicate changes to VLC's core
  *****************************************************************************/
 
-- (void)changeVoutFiltersString:(char *)psz_name onOrOff:(vlc_bool_t )b_add 
+- (void)changeVoutFiltersString:(char *)psz_name onOrOff:(bool )b_add
 {
     /* copied from ../wxwidgets/extrapanel.cpp
      * renamed to conform with Cocoa's rules */
-    /* this method only changes 1st generation video filters (the ones which 
+    /* this method only changes 1st generation video filters (the ones that
      * can't be used for transcoding). Have a look at changeVideoFiltersString
      * for the 2nd generation filters. */
-     
     vout_thread_t *p_vout;
     intf_thread_t * p_intf = VLCIntf;
-    
     char *psz_parser, *psz_string;
     psz_string = config_GetPsz( p_intf, "vout-filter" );
-    
     if( !psz_string ) psz_string = strdup("");
 
     psz_parser = strstr( psz_string, psz_name );
@@ -700,17 +606,17 @@ static VLCExtended *_o_sharedInstance = nil;
 }
 
 
-- (void)changeVideoFiltersString:(char *)psz_name onOrOff:(vlc_bool_t )b_add 
+- (void)changeVideoFiltersString:(char *)psz_name onOrOff:(bool )b_add
 {
     /* same as changeVoutFiltersString but addressing the "video-filter"
      * variable which represents the video filter 2 modules */
-     
     vout_thread_t *p_vout;
     intf_thread_t * p_intf = VLCIntf;
-    
     char *psz_parser, *psz_string;
     psz_string = config_GetPsz( p_intf, "video-filter" );
-    
     if( !psz_string ) psz_string = strdup("");
 
     psz_parser = strstr( psz_string, psz_name );
@@ -766,7 +672,7 @@ static VLCExtended *_o_sharedInstance = nil;
     o_config_changed = YES;
 }
 
-- (void)changeAFiltersString: (char *)psz_name onOrOff: (vlc_bool_t )b_add;
+- (void)changeAFiltersString: (char *)psz_name onOrOff: (bool )b_add;
 {
     /* copied from ../wxwidgets/extrapanel.cpp
      * renamed to conform with Cocoa's rules */
@@ -778,7 +684,7 @@ static VLCExtended *_o_sharedInstance = nil;
 
     if( p_aout )
     {
-        psz_string = var_GetString( p_aout, "audio-filter" );
+        psz_string = var_GetNonEmptyString( p_aout, "audio-filter" );
     }
     else
     {
@@ -800,6 +706,7 @@ static VLCExtended *_o_sharedInstance = nil;
         }
         else
         {
+            if( p_aout ) vlc_object_release( p_aout );
             return;
         }
     }
@@ -819,6 +726,7 @@ static VLCExtended *_o_sharedInstance = nil;
          else
          {
              free( psz_string );
+             if( p_aout ) vlc_object_release( p_aout );
              return;
          }
     }
@@ -833,7 +741,7 @@ static VLCExtended *_o_sharedInstance = nil;
         int i = 0;
         while( i < p_aout->i_nb_inputs )
         {
-            p_aout->pp_inputs[i]->b_restart = VLC_TRUE;
+            p_aout->pp_inputs[i]->b_restart = true;
             i = (i + 1);
         }
         vlc_object_release( p_aout );
@@ -844,18 +752,27 @@ static VLCExtended *_o_sharedInstance = nil;
 }
 
 - (void)savePrefs
-{    
+{
     /* save the preferences to make sure that our module-changes will up on
      * next launch again */
-    playlist_t * p_playlist = pl_Yield( VLCIntf );
+    playlist_t * p_playlist = pl_Hold( VLCIntf );
     int returnedValue;
     NSArray * theModules;
-    theModules = [[NSArray alloc] initWithObjects: @"main", @"headphone",
-        @"transform", @"adjust", @"invert", @"motionblur", @"distort",
-        @"clone", @"crop", @"normvol", @"headphone_channel_mixer", @"macosx",
+    theModules = [[NSArray alloc] initWithObjects: @"main", 
+        @"headphone",
+        @"transform", 
+        @"adjust", 
+        @"invert", 
+        @"motionblur", 
+        @"distort",
+        @"clone", 
+        @"crop", 
+        @"normvol", 
+        @"headphone_channel_mixer", 
+        @"macosx",
         nil];
     unsigned int x = 0;
-    
     while ( x != [theModules count] )
     {
         returnedValue = config_SaveConfigFile( p_playlist, [[theModules
@@ -864,20 +781,20 @@ static VLCExtended *_o_sharedInstance = nil;
         if (returnedValue != 0)
         {
             msg_Err(p_playlist, "unable to save the preferences of the "
-            "extended control attribute '%s' (%i)", 
+            "extended control attribute '%s' (%i)",
             [[theModules objectAtIndex: x] UTF8String] , returnedValue);
             [theModules release];
-            vlc_object_release( p_playlist );
-            
+            pl_Release( VLCIntf );
             return;
         }
 
         x = ( x + 1 );
     }
-    
-    msg_Dbg( p_playlist, "VLCExtended: saved certain preferences successfully" );
-    
+    msg_Dbg( VLCIntf, "VLCExtended: saved certain preferences successfully" );
     [theModules release];
-    vlc_object_release( p_playlist );
+    pl_Release( VLCIntf );
 }
 @end