X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=modules%2Fgui%2Fmacosx%2Fextended.m;h=9b04eb7d35b9d7154fd6e9e4c4cfc73bf3a81f56;hb=6ee1e193fd896ab9a4729fde14f009d9ce629815;hp=6ba63cf3c5572e2f1a06f1b2be93c2ebc3635344;hpb=e90c868f4cba1ec0b18c5be5d230e32f1aa99c8a;p=vlc diff --git a/modules/gui/macosx/extended.m b/modules/gui/macosx/extended.m index 6ba63cf3c5..9b04eb7d35 100644 --- a/modules/gui/macosx/extended.m +++ b/modules/gui/macosx/extended.m @@ -1,10 +1,10 @@ /***************************************************************************** * extended.m: MacOS X Extended interface panel ***************************************************************************** - * Copyright (C) 2005 the VideoLAN team + * Copyright (C) 2005-2007 the VideoLAN team * $Id$ * - * Authors: Felix Kühne + * Authors: Felix Paul Kühne * * 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 @@ -22,16 +22,6 @@ *****************************************************************************/ -/***************************************************************************** - * 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 *****************************************************************************/ @@ -39,10 +29,9 @@ #import "extended.h" #import "intf.h" #import "vout.h" -#import -#import -#import -#import +#import +#import +#import /***************************************************************************** * VLCExtended implementation @@ -81,27 +70,33 @@ static VLCExtended *_o_sharedInstance = nil; [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("Adjust Image")]; - [o_btn_vidFlts_mrInfo setTitle: _NS("More Info")]; - [o_ckb_blur setTitle: _NS("Blurring")]; - [o_ckb_blur setToolTip: _NS("Creates a motion blurring on the image")]; - [o_ckb_distortion setTitle: _NS("Distortion")]; - [o_ckb_distortion setToolTip: _NS("Adds distorsion effects")]; + [o_lbl_adjustImage setStringValue: _NS("Image adjustment")]; + [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")]; + [o_ckb_gradient setTitle: _NS("Gradient")]; + [o_lbl_general setStringValue: _NS("General editing filters")]; + [o_lbl_distort setStringValue: _NS("Distortion filters")]; + [o_ckb_blur setTitle: _NS("Blur")]; + [o_ckb_blur setToolTip: _NS("Adds motion blurring to the image")]; [o_ckb_imgClone setTitle: _NS("Image clone")]; - [o_ckb_imgClone setToolTip: _NS("Creates several copies of the Video " \ + [o_ckb_imgClone setToolTip: _NS("Creates several copies of the Video " "output window" )]; [o_ckb_imgCrop setTitle: _NS("Image cropping")]; [o_ckb_imgCrop setToolTip: _NS("Crops a defined part of the image")]; - [o_ckb_imgInvers setTitle: _NS("Image inversion")]; - [o_ckb_imgInvers setToolTip: _NS("Inverts the image colors")]; + [o_ckb_imgInvers setTitle: _NS("Invert colors")]; + [o_ckb_imgInvers setToolTip: _NS("Inverts the colors of the image")]; [o_ckb_trnsform setTitle: _NS("Transformation")]; [o_ckb_trnsform setToolTip: _NS("Rotates or flips the image")]; + [o_ckb_intZoom setTitle: _NS("Interactive Zoom")]; + [o_ckb_intZoom setToolTip: _NS("Enables an interactive Zoom feature")]; [o_ckb_vlme_norm setTitle: _NS("Volume normalization")]; - [o_ckb_vlme_norm setToolTip: _NS("This filters prevents the audio output " \ - "level from exceeding a defined value.")]; + [o_ckb_vlme_norm setToolTip: _NS("Prevents the audio output from going " + "over a predefined value.")]; [o_ckb_hdphnVirt setTitle: _NS("Headphone virtualization")]; - [o_ckb_hdphnVirt setToolTip: _NS("This filter gives the feeling of a " \ - "5.1 speaker set when using a headphone.")]; + [o_ckb_hdphnVirt setToolTip: _NS("Imitates the effect of surround sound " + "when using headphones.")]; [o_lbl_maxLevel setStringValue: _NS("Maximum level")]; [o_btn_rstrDefaults setTitle: _NS("Restore Defaults")]; [o_ckb_enblAdjustImg setTitle: _NS("Enable")]; @@ -111,7 +106,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 @@ -121,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]; @@ -141,20 +150,17 @@ 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 ) + if( psz_vifilters ) { - [o_ckb_blur setState: (int)strstr( psz_vfilters, "motionblur")]; - [o_ckb_distortion setState: (int)strstr( psz_vfilters, "distort")]; - [o_ckb_imgClone setState: (int)strstr( psz_vfilters, "clone")]; - [o_ckb_imgCrop setState: (int)strstr( psz_vfilters, "crop")]; - [o_ckb_imgInvers setState: (int)strstr( psz_vfilters, "invert")]; - [o_ckb_trnsform setState: (int)strstr( psz_vfilters, "transform")]; - - free( psz_vfilters ); + [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")]; + + 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" ); @@ -162,7 +168,7 @@ static VLCExtended *_o_sharedInstance = nil; { [o_ckb_hdphnVirt setState: (int)strstr( psz_afilters, "headphone" ) ]; [o_ckb_vlme_norm setState: (int)strstr( psz_afilters, "normvol" ) ]; - + free( psz_afilters ); } } @@ -172,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]; } } @@ -202,7 +208,7 @@ static VLCExtended *_o_sharedInstance = nil; } float f_value; - + f_value = config_GetFloat( p_intf, "saturation" ); if( f_value > 0 && f_value < 5 ) { @@ -233,7 +239,7 @@ static VLCExtended *_o_sharedInstance = nil; [o_sld_maxLevel setFloatValue: f_value ]; } - [o_sld_opaque setFloatValue: (config_GetFloat( p_intf, \ + [o_sld_opaque setFloatValue: (config_GetFloat( p_intf, "macosx-opaqueness") * 100)]; @@ -242,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) @@ -253,7 +259,7 @@ static VLCExtended *_o_sharedInstance = nil; [o_sld_gamma setEnabled: YES]; [o_sld_hue setEnabled: YES]; [o_sld_saturation setEnabled: YES]; - [self changeVFiltersString: "adjust" onOrOff: VLC_TRUE]; + [self changeVideoFiltersString: "adjust" onOrOff: VLC_TRUE]; }else{ [o_btn_rstrDefaults setEnabled: NO]; [o_sld_brightness setEnabled: NO]; @@ -261,11 +267,11 @@ static VLCExtended *_o_sharedInstance = nil; [o_sld_gamma setEnabled: NO]; [o_sld_hue setEnabled: NO]; [o_sld_saturation setEnabled: NO]; - [self changeVFiltersString: "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]; @@ -273,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; @@ -345,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; @@ -366,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]) { @@ -376,16 +383,16 @@ 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 ); o_config_changed = YES; } -- (IBAction)audFtls_hdphnVirt:(id)sender +- (IBAction)enableHeadphoneVirtualizer:(id)sender { /* en-/disable headphone virtualisation */ if ([o_ckb_hdphnVirt state] == NSOnState) @@ -396,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; @@ -412,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) @@ -423,70 +430,68 @@ 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]; 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 - 171; - o_win_rect.origin.y = [o_extended_window frame].origin.y + 171; - o_box_audFlts_rect.origin.y = o_box_audFlts_rect.origin.y + 171; - o_box_vidFlts_rect.origin.y = o_box_vidFlts_rect.origin.y + 171; - + 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 + 171; - o_win_rect.origin.y = [o_extended_window frame].origin.y - 171; - o_box_audFlts_rect.origin.y = o_box_audFlts_rect.origin.y - 171; - o_box_vidFlts_rect.origin.y = o_box_vidFlts_rect.origin.y - 171; + 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 - 171; - msg_Dbg( VLCIntf, "collapsed adjust-image section"); + 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 + 171; - [o_adjustImg_view setFrame: NSMakeRect( 20, -10, 370, 181)]; + 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]; - msg_Dbg( VLCIntf, "expanded adjust-image section"); o_adjImg_expanded = YES; } [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]; 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{ @@ -496,12 +501,11 @@ static VLCExtended *_o_sharedInstance = nil; } [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; - msg_Dbg( VLCIntf, "collapsed audio-filters section"); o_audFlts_expanded = NO; } else { /* insert view */ @@ -510,100 +514,104 @@ static VLCExtended *_o_sharedInstance = nil; [o_audioFlts_view setNeedsDisplay:YES]; [o_audioFlts_view setAutoresizesSubviews: YES]; [[o_box_audFlts contentView] addSubview: o_audioFlts_view]; - msg_Dbg( VLCIntf, "expanded audio-filters section"); o_audFlts_expanded = YES; } [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]; 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 - 134; - o_win_rect.origin.y = [o_extended_window frame].origin.y + 134; - o_box_audFlts_rect.origin.y = o_box_audFlts_rect.origin.y + 134; - + 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 + 134; - o_win_rect.origin.y = [o_extended_window frame].origin.y - 134; - o_box_audFlts_rect.origin.y = o_box_audFlts_rect.origin.y - 134; + 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]; [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 - 134; - msg_Dbg( VLCIntf, "collapsed video-filters section"); + 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 + 134; - [o_videoFilters_view setFrame: NSMakeRect( 20, -10, 370, 144)]; + 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]; - msg_Dbg( VLCIntf, "expanded video-filters section"); 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 changeVFiltersString: "motionblur" onOrOff: [o_ckb_blur state]]; - } - else if (sender == o_ckb_distortion) - { - [self changeVFiltersString: "distort" onOrOff: [o_ckb_distortion state]]; - } + [self changeVoutFiltersString: "motionblur" onOrOff: [o_ckb_blur state]]; + else if (sender == o_ckb_imgClone) - { - [self changeVFiltersString: "clone" onOrOff: [o_ckb_imgClone state]]; - } + [self changeVoutFiltersString: "clone" onOrOff: [o_ckb_imgClone state]]; + else if (sender == o_ckb_imgCrop) - { - [self changeVFiltersString: "crop" onOrOff: [o_ckb_imgCrop state]]; - } + [self changeVoutFiltersString: "crop" onOrOff: [o_ckb_imgCrop state]]; + else if (sender == o_ckb_imgInvers) - { - [self changeVFiltersString: "invert" onOrOff: [o_ckb_imgInvers state]]; - } + [self changeVideoFiltersString: "invert" onOrOff: [o_ckb_imgInvers state]]; + else if (sender == o_ckb_trnsform) - { - [self changeVFiltersString: "transform" onOrOff: [o_ckb_trnsform state]]; - } else { + [self changeVoutFiltersString: "transform" onOrOff: [o_ckb_trnsform state]]; + + else if (sender == o_ckb_intZoom ) + [self changeVoutFiltersString: "magnify" onOrOff: [o_ckb_intZoom state]]; + + else if (sender == o_ckb_wave ) + [self changeVideoFiltersString: "wave" onOrOff: [o_ckb_wave state]]; + + else if (sender == o_ckb_gradient ) + [self changeVideoFiltersString: "gradient" onOrOff: [o_ckb_gradient state]]; + + else if (sender == o_ckb_psycho ) + [self changeVideoFiltersString: "psychedelic" onOrOff: [o_ckb_psycho state]]; + + else if (sender == o_ckb_ripple ) + [self changeVideoFiltersString: "ripple" onOrOff: [o_ckb_ripple state]]; + + else { /* this shouldn't happen */ - msg_Warn (VLCIntf, "cannot find selected 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 indivudually in the Preferences, in " \ - "the subsections of Video/Filters\n." \ - "To choose the order in which the filter are applied, a filter " \ + 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.")); } @@ -612,17 +620,20 @@ static VLCExtended *_o_sharedInstance = nil; * methods to communicate changes to VLC's core *****************************************************************************/ -- (void)changeVFiltersString:(char *)psz_name onOrOff:(vlc_bool_t )b_add +- (void)changeVoutFiltersString:(char *)psz_name onOrOff:(vlc_bool_t )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 + * 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 ); @@ -679,6 +690,72 @@ static VLCExtended *_o_sharedInstance = nil; } +- (void)changeVideoFiltersString:(char *)psz_name onOrOff:(vlc_bool_t )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 ); + + if( b_add ) + { + if( !psz_parser ) + { + psz_parser = psz_string; + asprintf( &psz_string, (*psz_string) ? "%s:%s" : "%s%s", + psz_string, psz_name ); + free( psz_parser ); + } + else + { + return; + } + } + else + { + if( psz_parser ) + { + memmove( psz_parser, psz_parser + strlen(psz_name) + + (*(psz_parser + strlen(psz_name)) == ':' ? 1 : 0 ), + strlen(psz_parser + strlen(psz_name)) + 1 ); + + /* Remove trailing : : */ + if( *(psz_string+strlen(psz_string ) -1 ) == ':' ) + { + *(psz_string+strlen(psz_string ) -1 ) = '\0'; + } + } + else + { + free( psz_string ); + return; + } + } + /* Vout is not kept, so put that in the config */ + config_PutPsz( p_intf, "video-filter", psz_string ); + + /* Try to set on the fly */ + p_vout = (vout_thread_t *)vlc_object_find( p_intf, VLC_OBJECT_VOUT, + FIND_ANYWHERE ); + if( p_vout ) + { + var_SetString( p_vout, "video-filter", psz_string ); + vlc_object_release( p_vout ); + } + + free( psz_string ); + + o_config_changed = YES; +} + - (void)changeAFiltersString: (char *)psz_name onOrOff: (vlc_bool_t )b_add; { /* copied from ../wxwidgets/extrapanel.cpp @@ -757,40 +834,39 @@ 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 = 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", \ - @"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 \ + returnedValue = config_SaveConfigFile( p_playlist, [[theModules objectAtIndex: x] UTF8String] ); if (returnedValue != 0) { - msg_Err(p_playlist, "unable to save the preferences of the " \ - "extended control attribute '%s' (%i)", + msg_Err(p_playlist, "unable to save the preferences of the " + "extended control attribute '%s' (%i)", [[theModules objectAtIndex: x] UTF8String] , returnedValue); [theModules release]; vlc_object_release( p_playlist ); - + return; } x = ( x + 1 ); } - + msg_Dbg( p_playlist, "VLCExtended: saved certain preferences successfully" ); - + [theModules release]; vlc_object_release( p_playlist ); }