]> git.sesse.net Git - vlc/blobdiff - modules/gui/macosx/extended.m
Qt4 - Dialogs. String Changes, reviewed by tonsofpcs
[vlc] / modules / gui / macosx / extended.m
index 545277f61cea31920dca92a150a5321d7967a0f6..1b1033ea813a1c5975355d1ee2d247306c740ec5 100644 (file)
@@ -1,10 +1,10 @@
 /*****************************************************************************
  * extended.m: MacOS X Extended interface panel
  *****************************************************************************
- * Copyright (C) 2005-2006 the VideoLAN team
+ * Copyright (C) 2005-2007 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
@@ -82,7 +71,7 @@ static VLCExtended *_o_sharedInstance = nil;
     [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")];
@@ -127,7 +116,21 @@ 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: (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 && strstr( psz_vifilters, "adjust" ) )
     {
         [o_ckb_enblAdjustImg setState: NSOnState];
         [o_btn_rstrDefaults setEnabled: YES];
@@ -147,21 +150,6 @@ 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")];
@@ -190,15 +178,15 @@ static VLCExtended *_o_sharedInstance = nil;
     /* collaps all views so Cocoa saves the window position correctly */
     if( o_adjImg_expanded )
     {
-        [self extWin_exp_adjImg: nil];
+        [self expandAdjustImage: nil];
     }
     if( o_audFlts_expanded )
     {
-        [self extWin_exp_audFlts: nil];
+        [self expandAudioFilters: nil];
     }
     if( o_vidFlts_expanded )
     {
-        [self extWin_exp_vidFlts: nil];
+        [self expandVideoFilters: nil];
     }
 }
 
@@ -260,7 +248,7 @@ static VLCExtended *_o_sharedInstance = nil;
     [o_extended_window makeKeyAndOrderFront:nil];
 }
 
-- (IBAction)adjImg_Enbl:(id)sender
+- (IBAction)enableAdjustImage:(id)sender
 {
     /* en-/disable the sliders */
     if ([o_ckb_enblAdjustImg state] == NSOnState)
@@ -271,7 +259,7 @@ 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];
+        [self changeVideoFiltersString: "adjust" onOrOff: VLC_TRUE];
     }else{
         [o_btn_rstrDefaults setEnabled: NO];
         [o_sld_brightness setEnabled: NO];
@@ -279,11 +267,11 @@ static VLCExtended *_o_sharedInstance = nil;
         [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: VLC_FALSE];
     }
 }
 
-- (IBAction)adjImg_rstrDefaults:(id)sender
+- (IBAction)restoreDefaultsForAdjustImage:(id)sender
 {
     /* reset the sliders */
     [o_sld_brightness setIntValue: 100];
@@ -291,16 +279,18 @@ 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;
@@ -363,14 +353,13 @@ 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 = vlc_object_find( VLCIntf, VLC_OBJECT_PLAYLIST,
-        FIND_ANYWHERE );
+    playlist_t * p_playlist = pl_Yield( VLCIntf );
     vout_thread_t *p_vout = vlc_object_find( VLCIntf, VLC_OBJECT_VOUT, FIND_ANYWHERE );
     vout_thread_t *p_real_vout;
 
@@ -384,7 +373,7 @@ static VLCExtended *_o_sharedInstance = nil;
 
         while ((o_window = [o_enumerator nextObject]))
         {
-            if( [[o_window className] isEqualToString: @"VLCWindow"] ||
+            if( [[o_window className] isEqualToString: @"VLCVoutWindow"] ||
                 [[[VLCMain sharedInstance] getEmbeddedList]
                                     windowContainsEmbedded: o_window])
             {
@@ -403,7 +392,7 @@ static VLCExtended *_o_sharedInstance = nil;
     o_config_changed = YES;
 }
 
-- (IBAction)audFtls_hdphnVirt:(id)sender
+- (IBAction)enableHeadphoneVirtualizer:(id)sender
 {
     /* en-/disable headphone virtualisation */
     if ([o_ckb_hdphnVirt state] == NSOnState)
@@ -414,7 +403,7 @@ static VLCExtended *_o_sharedInstance = nil;
     }
 }
 
-- (IBAction)audFtls_maxLevelSld:(id)sender
+- (IBAction)sliderActionMaximumAudioLevel:(id)sender
 {
     /* read-out the slider's value and apply it */
     intf_thread_t * p_intf = VLCIntf;
@@ -430,7 +419,7 @@ static VLCExtended *_o_sharedInstance = nil;
     o_config_changed = YES;
 }
 
-- (IBAction)audFtls_vlmeNorm:(id)sender
+- (IBAction)enableVolumeNormalization:(id)sender
 {
     /* en-/disable volume normalisation */
     if ([o_ckb_vlme_norm state] == NSOnState)
@@ -441,7 +430,7 @@ static VLCExtended *_o_sharedInstance = nil;
     }
 }
 
-- (IBAction)extWin_exp_adjImg:(id)sender
+- (IBAction)expandAdjustImage:(id)sender
 {
     /* expand or collapse adjImg */
     NSRect o_win_rect = [o_extended_window frame];
@@ -490,7 +479,7 @@ static VLCExtended *_o_sharedInstance = nil;
     [o_box_adjImg setFrameFromContentFrame: o_box_adjImg_rect];
 }
 
-- (IBAction)extWin_exp_audFlts:(id)sender
+- (IBAction)expandAudioFilters:(id)sender
 {
     /* expand or collapse audFlts */
     NSRect o_win_rect = [o_extended_window frame];
@@ -530,7 +519,7 @@ static VLCExtended *_o_sharedInstance = nil;
     [o_box_audFlts setFrameFromContentFrame: o_box_audFlts_rect];
 }
 
-- (IBAction)extWin_exp_vidFlts:(id)sender
+- (IBAction)expandVideoFilters:(id)sender
 {
     /* expand or collapse vidFlts */
     NSRect o_win_rect = [o_extended_window frame];
@@ -541,18 +530,18 @@ static VLCExtended *_o_sharedInstance = nil;
     {
         /* 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;
+        o_win_rect.size.height = o_win_rect.size.height - 172;
+        o_win_rect.origin.y = [o_extended_window frame].origin.y + 172;
+        o_box_audFlts_rect.origin.y = o_box_audFlts_rect.origin.y + 172;
         
         /* 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_win_rect.size.height = o_win_rect.size.height + 172;
+        o_win_rect.origin.y = [o_extended_window frame].origin.y - 172;
+        o_box_audFlts_rect.origin.y = o_box_audFlts_rect.origin.y - 172;
     }
     
     [o_box_audFlts setFrameFromContentFrame: o_box_audFlts_rect];
@@ -561,12 +550,12 @@ static VLCExtended *_o_sharedInstance = nil;
     
     if (o_vidFlts_expanded)
     {
-        o_box_vidFlts_rect.size.height = [o_box_vidFlts frame].size.height - 188;
+        o_box_vidFlts_rect.size.height = [o_box_vidFlts frame].size.height - 172;
         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_box_vidFlts_rect.size.height = [o_box_vidFlts frame].size.height + 172;
+        [o_videoFilters_view setFrame: NSMakeRect( 20, -10, 370, 172)];
         [o_videoFilters_view setNeedsDisplay:YES];
         [o_videoFilters_view setAutoresizesSubviews: YES];
         [[o_box_vidFlts contentView] addSubview: o_videoFilters_view];
@@ -575,7 +564,7 @@ static VLCExtended *_o_sharedInstance = nil;
     [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)
@@ -610,17 +599,17 @@ static VLCExtended *_o_sharedInstance = nil;
 
     else {
         /* this shouldn't happen */
-        msg_Warn (VLCIntf, "cannot find switched video-filter");
+        msg_Err( VLCIntf, "cannot find switched video-filter" );
     }
 }
 
-- (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 "
+    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."));
@@ -848,8 +837,7 @@ static VLCExtended *_o_sharedInstance = nil;
 {    
     /* save the preferences to make sure that our module-changes will up on
      * next launch again */
-    playlist_t * p_playlist = vlc_object_find( VLCIntf, VLC_OBJECT_PLAYLIST,
-        FIND_ANYWHERE );
+    playlist_t * p_playlist = pl_Yield( VLCIntf );
     int returnedValue;
     NSArray * theModules;
     theModules = [[NSArray alloc] initWithObjects: @"main", @"headphone",