From: Felix Paul Kühne Date: Thu, 4 Aug 2005 23:24:50 +0000 (+0000) Subject: * port of the WX-advanded-GUI to OSX (refs #268) X-Git-Tag: 0.8.4~1004 X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=36ef2f6c3a6405a222d359cc5041e24beaaa32ab;p=vlc * port of the WX-advanded-GUI to OSX (refs #268) - the adjust-image-filter and the audio-filters are completely useable ToDo: - complete i18n support - video-filters - loading the settings from the prefs correctly - probably minor layout tweaks, etc. --- diff --git a/Makefile.am b/Makefile.am index 909cd4a9e0..d8e4d64157 100644 --- a/Makefile.am +++ b/Makefile.am @@ -561,6 +561,8 @@ VLC-release.app: vlc voutgl.m \ wizard.h \ wizard.m \ + extended.h \ + extended.m \ vout.m; do \ cp "$(srcdir)/modules/gui/macosx/$$i" \ $(top_builddir)/tmp/modules/gui/macosx; \ @@ -671,6 +673,8 @@ VLC.app: vlc voutgl.m \ wizard.h \ wizard.m \ + extended.h \ + extended.m \ vout.m; do \ cp "$(srcdir)/modules/gui/macosx/$$i" \ $(top_builddir)/tmp/modules/gui/macosx; \ diff --git a/extras/MacOSX/Resources/English.lproj/Extended.nib/classes.nib b/extras/MacOSX/Resources/English.lproj/Extended.nib/classes.nib new file mode 100644 index 0000000000..d83209bc3e --- /dev/null +++ b/extras/MacOSX/Resources/English.lproj/Extended.nib/classes.nib @@ -0,0 +1,64 @@ +{ + IBClasses = ( + {CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; }, + { + ACTIONS = { + "adjImg_Enbl" = id; + "adjImg_rstrDefaults" = id; + "adjImg_sliders" = id; + "audFtls_hdphnVirt" = id; + "audFtls_maxLevelSld" = id; + "audFtls_vlmeNorm" = id; + "extWin_exp_adjImg" = id; + "extWin_exp_audFlts" = id; + "extWin_exp_vidFlts" = id; + vidFlts = id; + "vidFlts_mrInfo" = id; + }; + CLASS = VLCExtended; + LANGUAGE = ObjC; + OUTLETS = { + "o_adjustImg_view" = id; + "o_audioFlts_view" = id; + "o_box_adjImg" = id; + "o_box_audFlts" = id; + "o_box_vidFlts" = id; + "o_btn_rstrDefaults" = id; + "o_btn_vidFlts_mrInfo" = id; + "o_ckb_blur" = id; + "o_ckb_distortion" = id; + "o_ckb_enblAdjustImg" = id; + "o_ckb_hdphnVirt" = id; + "o_ckb_imgClone" = id; + "o_ckb_imgCrop" = id; + "o_ckb_imgInvers" = id; + "o_ckb_trnsform" = id; + "o_ckb_vlme_norm" = id; + "o_expBtn_adjustImage" = id; + "o_expBtn_audioFlts" = id; + "o_expBtn_videoFlts" = id; + "o_extWin_adjImg_sepe" = id; + "o_extWin_vidFlts_sepe" = id; + "o_extended_window" = id; + "o_lbl_adjustImage" = id; + "o_lbl_audioFlts" = id; + "o_lbl_brightness" = id; + "o_lbl_contrast" = id; + "o_lbl_gamma" = id; + "o_lbl_hue" = id; + "o_lbl_maxLevel" = id; + "o_lbl_saturation" = id; + "o_lbl_videoFlts" = id; + "o_sld_brightness" = id; + "o_sld_contrast" = id; + "o_sld_gamma" = id; + "o_sld_hue" = id; + "o_sld_maxLevel" = id; + "o_sld_saturation" = id; + "o_videoFilters_view" = id; + }; + SUPERCLASS = NSObject; + } + ); + IBVersion = 1; +} \ No newline at end of file diff --git a/extras/MacOSX/Resources/English.lproj/Extended.nib/info.nib b/extras/MacOSX/Resources/English.lproj/Extended.nib/info.nib new file mode 100644 index 0000000000..ad4f9d9fca --- /dev/null +++ b/extras/MacOSX/Resources/English.lproj/Extended.nib/info.nib @@ -0,0 +1,31 @@ + + + + + IBDocumentLocation + 219 20 356 292 0 0 1440 878 + IBEditorPositions + + 13 + 506 668 390 138 0 0 1440 878 + 32 + 525 497 390 213 0 0 1440 878 + 5 + 598 370 390 196 0 0 1440 878 + + IBFramework Version + 437.0 + IBLockedObjects + + 32 + + IBOpenObjects + + 18 + 32 + 5 + + IBSystem Version + 8C46 + + diff --git a/extras/MacOSX/Resources/English.lproj/Extended.nib/keyedobjects.nib b/extras/MacOSX/Resources/English.lproj/Extended.nib/keyedobjects.nib new file mode 100644 index 0000000000..19e5323ce0 Binary files /dev/null and b/extras/MacOSX/Resources/English.lproj/Extended.nib/keyedobjects.nib differ diff --git a/extras/MacOSX/Resources/English.lproj/MainMenu.nib/classes.nib b/extras/MacOSX/Resources/English.lproj/MainMenu.nib/classes.nib index a8f2171073..687e6213f0 100644 --- a/extras/MacOSX/Resources/English.lproj/MainMenu.nib/classes.nib +++ b/extras/MacOSX/Resources/English.lproj/MainMenu.nib/classes.nib @@ -2,12 +2,6 @@ IBClasses = ( {CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; }, {CLASS = MPSlider; LANGUAGE = ObjC; SUPERCLASS = NSSlider; }, - { - ACTIONS = {showPanel = id; }; - CLASS = VLAboutBox; - LANGUAGE = ObjC; - SUPERCLASS = NSObject; - }, {CLASS = VLBrushedMetalImageView; LANGUAGE = ObjC; SUPERCLASS = NSImageView; }, {CLASS = VLCApplication; LANGUAGE = ObjC; SUPERCLASS = NSApplication; }, {CLASS = VLCControllerView; LANGUAGE = ObjC; SUPERCLASS = NSView; }, @@ -71,6 +65,43 @@ }; SUPERCLASS = NSObject; }, + { + CLASS = VLCExtended; + LANGUAGE = ObjC; + OUTLETS = { + "o_adjustImg_view" = id; + "o_audioFlts_view" = id; + "o_btn_rstrDefaults" = id; + "o_btn_vidFlts_mrInfo" = id; + "o_ckb_blur" = id; + "o_ckb_distortion" = id; + "o_ckb_enblAdjustImg" = id; + "o_ckb_hdphn_virt" = id; + "o_ckb_imgClone" = id; + "o_ckb_imgCrop" = id; + "o_ckb_imgInvers" = id; + "o_ckb_trnsform" = id; + "o_ckb_vlme_norm" = id; + "o_expBtn_adjustImage" = id; + "o_expBtn_audioFlts" = id; + "o_expBtn_videoFlts" = id; + "o_extended_window" = id; + "o_lbl_brightness" = id; + "o_lbl_contrast" = id; + "o_lbl_gamma" = id; + "o_lbl_hue" = id; + "o_lbl_maxLevel" = id; + "o_lbl_saturation" = id; + "o_sld_brightness" = id; + "o_sld_contrast" = id; + "o_sld_gamma" = id; + "o_sld_hue" = id; + "o_sld_maxLevel" = id; + "o_sld_saturation" = id; + "o_videoFilters_view" = id; + }; + SUPERCLASS = NSObject; + }, { ACTIONS = { createOutlineGroup = id; @@ -113,6 +144,7 @@ openRecentItem = id; openWebsite = id; reportABug = id; + showExtended = id; showWizard = id; timesliderUpdate = id; togglePlaylist = id; @@ -162,6 +194,7 @@ "o_mi_documentation" = id; "o_mi_double_window" = id; "o_mi_equalizer" = id; + "o_mi_extended" = id; "o_mi_faster" = id; "o_mi_ffmpeg_pp" = id; "o_mi_fittoscreen" = id; @@ -242,8 +275,6 @@ }; SUPERCLASS = NSObject; }, - {CLASS = VLCOpen; LANGUAGE = ObjC; SUPERCLASS = NSObject; }, - {CLASS = VLCOutput; LANGUAGE = ObjC; SUPERCLASS = NSObject; }, { ACTIONS = { deleteItem = id; @@ -285,22 +316,7 @@ }; SUPERCLASS = NSObject; }, - {CLASS = VLCPlaylistView; LANGUAGE = ObjC; SUPERCLASS = NSOutlineView; }, - { - ACTIONS = {advancedToggle = id; closePrefs = id; resetAll = id; savePrefs = id; }; - CLASS = VLCPrefs; - LANGUAGE = ObjC; - OUTLETS = { - "o_advanced_ckb" = id; - "o_cancel_btn" = id; - "o_prefs_view" = id; - "o_prefs_window" = id; - "o_reset_btn" = id; - "o_save_btn" = id; - "o_tree" = id; - }; - SUPERCLASS = NSObject; - } + {CLASS = VLCPlaylistView; LANGUAGE = ObjC; SUPERCLASS = NSOutlineView; } ); IBVersion = 1; } \ No newline at end of file diff --git a/extras/MacOSX/Resources/English.lproj/MainMenu.nib/info.nib b/extras/MacOSX/Resources/English.lproj/MainMenu.nib/info.nib index b80338c6cb..af003ad301 100644 --- a/extras/MacOSX/Resources/English.lproj/MainMenu.nib/info.nib +++ b/extras/MacOSX/Resources/English.lproj/MainMenu.nib/info.nib @@ -3,13 +3,13 @@ IBDocumentLocation - 43 309 496 270 0 0 1024 746 + 52 78 496 270 0 0 1440 878 IBEditorPositions 1617 542 480 104 149 0 0 1024 746 2197 - 214 442 596 144 0 0 1024 746 + 422 532 596 143 0 0 1440 878 29 557 789 437 44 0 0 1440 878 915 @@ -21,10 +21,11 @@ IBOpenObjects - 29 + 2029 21 + 29 IBSystem Version - 8C40 + 8C46 diff --git a/extras/MacOSX/Resources/English.lproj/MainMenu.nib/keyedobjects.nib b/extras/MacOSX/Resources/English.lproj/MainMenu.nib/keyedobjects.nib index 027493ed79..1900818114 100644 Binary files a/extras/MacOSX/Resources/English.lproj/MainMenu.nib/keyedobjects.nib and b/extras/MacOSX/Resources/English.lproj/MainMenu.nib/keyedobjects.nib differ diff --git a/extras/MacOSX/vlc.pbproj/project.pbxproj b/extras/MacOSX/vlc.pbproj/project.pbxproj index 6da705cb28..c51f1290dc 100644 --- a/extras/MacOSX/vlc.pbproj/project.pbxproj +++ b/extras/MacOSX/vlc.pbproj/project.pbxproj @@ -813,6 +813,7 @@ DCF358BB077F10BA007DB450, DCA693C30789DF8700139EC6, DCFCCDB9085CE18F001E36AF, + DC7F46ED08A183FC0027DB24, ); isa = PBXResourcesBuildPhase; runOnlyForDeploymentPostprocessing = 0; @@ -895,6 +896,8 @@ 8E9CA1A606D7DEE800B7186C, DC769AB8085DF0DB001A838D, DC769AB7085DF0DB001A838D, + DC7F46F008A187F60027DB24, + DC7F46F108A187F60027DB24, ); isa = PBXGroup; name = Classes; @@ -2159,12 +2162,15 @@ //DC4 DC769AB7085DF0DB001A838D = { fileEncoding = 5; + indentWidth = 4; isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; name = wizard.m; path = ../../modules/gui/macosx/wizard.m; refType = 2; sourceTree = SOURCE_ROOT; + tabWidth = 4; + usesTabs = 0; }; DC769AB8085DF0DB001A838D = { fileEncoding = 5; @@ -2175,6 +2181,50 @@ refType = 2; sourceTree = SOURCE_ROOT; }; + DC7F46EB08A183FC0027DB24 = { + children = ( + DC7F46EC08A183FC0027DB24, + ); + isa = PBXVariantGroup; + name = Extended.nib; + path = ""; + refType = 4; + sourceTree = ""; + }; + DC7F46EC08A183FC0027DB24 = { + isa = PBXFileReference; + lastKnownFileType = wrapper.nib; + name = English; + path = Resources/English.lproj/Extended.nib; + refType = 4; + sourceTree = ""; + }; + DC7F46ED08A183FC0027DB24 = { + fileRef = DC7F46EB08A183FC0027DB24; + isa = PBXBuildFile; + settings = { + }; + }; + DC7F46F008A187F60027DB24 = { + explicitFileType = sourcecode.c.objc; + fileEncoding = 5; + isa = PBXFileReference; + name = extended.h; + path = ../../modules/gui/macosx/extended.h; + refType = 2; + sourceTree = SOURCE_ROOT; + usesTabs = 0; + }; + DC7F46F108A187F60027DB24 = { + explicitFileType = sourcecode.c.objc; + fileEncoding = 5; + includeInIndex = 0; + isa = PBXFileReference; + name = extended.m; + path = ../../modules/gui/macosx/extended.m; + refType = 2; + sourceTree = SOURCE_ROOT; + }; DCA00AA7075F948800E6BF46 = { children = ( DCA00AA8075F948800E6BF46, @@ -2260,6 +2310,7 @@ DCF358B9077F10BA007DB450, DCA693C10789DF8700139EC6, DCFCCDB7085CE18F001E36AF, + DC7F46EB08A183FC0027DB24, ); isa = PBXGroup; name = nibs; diff --git a/modules/gui/macosx/Modules.am b/modules/gui/macosx/Modules.am index eda20da922..f6d98fb710 100644 --- a/modules/gui/macosx/Modules.am +++ b/modules/gui/macosx/Modules.am @@ -30,5 +30,7 @@ SOURCES_macosx = \ vout.h \ wizard.h \ wizard.m \ + extended.h \ + extended.m \ $(NULL) diff --git a/modules/gui/macosx/extended.h b/modules/gui/macosx/extended.h new file mode 100644 index 0000000000..a8157f2148 --- /dev/null +++ b/modules/gui/macosx/extended.h @@ -0,0 +1,104 @@ +/***************************************************************************** + * extended.h: MacOS X Extended interface panel + ***************************************************************************** + * Copyright (C) 2005 the VideoLAN team + * $Id$ + * + * Authors: Felix 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 + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA. + *****************************************************************************/ + +/***************************************************************************** + * VLCExtended + *****************************************************************************/ + +#import + +@interface VLCExtended : NSObject +{ + /* views and window */ + IBOutlet id o_adjustImg_view; + IBOutlet id o_audioFlts_view; + IBOutlet id o_videoFilters_view; + IBOutlet id o_extended_window; + + /* window content */ + IBOutlet id o_expBtn_adjustImage; + IBOutlet id o_expBtn_audioFlts; + IBOutlet id o_expBtn_videoFlts; + IBOutlet id o_lbl_audioFlts; + IBOutlet id o_lbl_videoFlts; + IBOutlet id o_lbl_adjustImage; + IBOutlet id o_extWin_adjImg_sepe; + IBOutlet id o_extWin_vidFlts_sepe; + IBOutlet id o_box_vidFlts; + IBOutlet id o_box_audFlts; + IBOutlet id o_box_adjImg; + + /* video filters */ + IBOutlet id o_btn_vidFlts_mrInfo; + IBOutlet id o_ckb_blur; + IBOutlet id o_ckb_distortion; + IBOutlet id o_ckb_imgClone; + IBOutlet id o_ckb_imgCrop; + IBOutlet id o_ckb_imgInvers; + IBOutlet id o_ckb_trnsform; + + /* audio filters */ + IBOutlet id o_ckb_vlme_norm; + IBOutlet id o_ckb_hdphnVirt; + IBOutlet id o_lbl_maxLevel; + IBOutlet id o_sld_maxLevel; + + /* adjust image */ + IBOutlet id o_btn_rstrDefaults; + IBOutlet id o_ckb_enblAdjustImg; + IBOutlet id o_lbl_brightness; + IBOutlet id o_lbl_contrast; + IBOutlet id o_lbl_gamma; + IBOutlet id o_lbl_hue; + IBOutlet id o_lbl_saturation; + IBOutlet id o_sld_brightness; + IBOutlet id o_sld_contrast; + IBOutlet id o_sld_gamma; + IBOutlet id o_sld_hue; + IBOutlet id o_sld_saturation; + + /* global variables */ + BOOL * o_adjImg_expanded; + BOOL * o_audFlts_expanded; + BOOL * o_vidFlts_expanded; +} + +- (IBAction)adjImg_Enbl:(id)sender; +- (IBAction)adjImg_rstrDefaults:(id)sender; +- (IBAction)adjImg_sliders:(id)sender; +- (IBAction)audFtls_hdphnVirt:(id)sender; +- (IBAction)audFtls_maxLevelSld:(id)sender; +- (IBAction)audFtls_vlmeNorm:(id)sender; +- (IBAction)extWin_exp_adjImg:(id)sender; +- (IBAction)extWin_exp_audFlts:(id)sender; +- (IBAction)extWin_exp_vidFlts:(id)sender; +- (IBAction)vidFlts:(id)sender; +- (IBAction)vidFlts_mrInfo:(id)sender; + ++ (VLCExtended *)sharedInstance; + +- (void)showPanel; +- (void)initStrings; +- (void)changeVFiltersString: (char *)psz_name onOrOff: (BOOL)o_onOrOff; +- (void)changeAFiltersString: (char *)psz_name onOrOff: (BOOL)o_onOrOff; +@end diff --git a/modules/gui/macosx/extended.m b/modules/gui/macosx/extended.m new file mode 100644 index 0000000000..5488f3b4d2 --- /dev/null +++ b/modules/gui/macosx/extended.m @@ -0,0 +1,579 @@ +/***************************************************************************** + * extended.m: MacOS X Extended interface panel + ***************************************************************************** + * Copyright (C) 2005 the VideoLAN team + * $Id$ + * + * Authors: Felix 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 + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA. + *****************************************************************************/ + + +/***************************************************************************** + * 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 view and resize/remove the other stuff + * was inspired by intf.m, written by Derk-Jan Hartman. + * (both are members of the VideoLAN team) + *****************************************************************************/ + + +/***************************************************************************** + * Preamble + *****************************************************************************/ + +#import "extended.h" +#import "intf.h" +#import +#import +#import +#import +#import + +/***************************************************************************** + * VLCExtended implementation + *****************************************************************************/ + +@implementation VLCExtended + +static VLCExtended *_o_sharedInstance = nil; + ++ (VLCExtended *)sharedInstance +{ + return _o_sharedInstance ? _o_sharedInstance : [[self alloc] init]; +} + +- (id)init +{ + if (_o_sharedInstance) { + [self dealloc]; + } else { + _o_sharedInstance = [super init]; + } + + return _o_sharedInstance; +} + +- (void)initStrings +{ + /* localise GUI-strings */ + /* method is called from intf.m (in method showExtended) */ +} + +- (void)awakeFromNib +{ + /* set the adjust-filter-sliders to the values from the prefs and enable + * them, if wanted */ + char * psz_vfilters; + intf_thread_t * p_intf = VLCIntf; + psz_vfilters = config_GetPsz( p_intf, "vout-filter" ); + if( psz_vfilters && strstr( psz_vfilters, "adjust" ) ) + { + [o_ckb_enblAdjustImg setState: NSOnState]; + [o_btn_rstrDefaults setEnabled: YES]; + [o_sld_brightness setEnabled: YES]; + [o_sld_contrast setEnabled: YES]; + [o_sld_gamma setEnabled: YES]; + [o_sld_hue setEnabled: YES]; + [o_sld_saturation setEnabled: YES]; + } + else + { + [o_ckb_enblAdjustImg setState: NSOffState]; + [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]; + } + if( psz_vfilters ) free( psz_vfilters ); + + int i_value = config_GetInt( p_intf, "hue" ); + if( i_value > 0 && i_value < 360 ) + { + [o_sld_hue setIntValue: i_value]; + } + + 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) ]; + } + + + /* 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" ) ]; + free( psz_afilters ); + } +} + +- (void)showPanel +{ + /* show the window */ + [o_extended_window displayIfNeeded]; + [o_extended_window makeKeyAndOrderFront:nil]; +} + +- (IBAction)adjImg_Enbl:(id)sender +{ + /* en-/disable the sliders */ + if ([o_ckb_enblAdjustImg state] == NSOnState) + { + [o_btn_rstrDefaults setEnabled: YES]; + [o_sld_brightness setEnabled: YES]; + [o_sld_contrast setEnabled: YES]; + [o_sld_gamma setEnabled: YES]; + [o_sld_hue setEnabled: YES]; + [o_sld_saturation setEnabled: YES]; + [self changeVFiltersString: "adjust" onOrOff: YES]; + }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 changeVFiltersString: "adjust" onOrOff: NO]; + } +} + +- (IBAction)adjImg_rstrDefaults:(id)sender +{ + /* reset the sliders */ + [o_sld_brightness setIntValue: 100]; + [o_sld_contrast setIntValue: 100]; + [o_sld_gamma setIntValue: 10]; + [o_sld_hue setIntValue: 0]; + [o_sld_saturation 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]; +} + +- (IBAction)adjImg_sliders:(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); + if( p_vout == NULL ) + { + if (sender == o_sld_brightness) + { + config_PutFloat( p_intf , "brightness" , [o_sld_brightness floatValue] / 100); + } else if (sender == o_sld_contrast) + { + config_PutFloat( p_intf , "contrast" , [o_sld_contrast floatValue] / 100); + } else if (sender == o_sld_gamma) + { + config_PutFloat( p_intf , "gamma" , [o_sld_gamma floatValue] / 10); + } else if (sender == o_sld_hue) + { + config_PutInt( p_intf , "hue" , [o_sld_hue intValue]); + } else if (sender == o_sld_saturation) + { + config_PutFloat( p_intf , "saturation" , [o_sld_saturation floatValue] / 100); + } + } else { + vlc_value_t val; + 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) + { + 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) + { + 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) + { + 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) + { + val.f_float = [o_sld_saturation floatValue] / 100; + var_Set( p_vout, "saturation", val ); + config_PutFloat( p_intf , "saturation" , [o_sld_saturation floatValue] / 100); + } + } +} + +- (IBAction)audFtls_hdphnVirt:(id)sender +{ + /* en-/disable headphone virtualisation */ + if ([o_ckb_hdphnVirt state] == NSOnState) + { + [self changeAFiltersString: "headphone" onOrOff: YES ]; + }else{ + [self changeAFiltersString: "headphone" onOrOff: NO ]; + } +} + +- (IBAction)audFtls_maxLevelSld:(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); + if( p_aout != NULL ) + { + var_SetFloat( p_aout, "norm-max-level", [o_sld_maxLevel floatValue] / 10 ); + vlc_object_release( p_aout ); + } + else + { + config_PutFloat( p_intf, "norm-max-level", [o_sld_maxLevel floatValue] /10 ); + } +} + +- (IBAction)audFtls_vlmeNorm:(id)sender +{ + /* en-/disable volume normalisation */ + if ([o_ckb_vlme_norm state] == NSOnState) + { + [self changeAFiltersString: "normvol" onOrOff: YES ]; + }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 - 151; + o_win_rect.origin.y = [o_extended_window frame].origin.y + 151; + o_box_audFlts_rect.origin.y = o_box_audFlts_rect.origin.y + 151; + o_box_vidFlts_rect.origin.y = o_box_vidFlts_rect.origin.y + 151; + + /* 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 + 151; + o_win_rect.origin.y = [o_extended_window frame].origin.y - 151; + o_box_audFlts_rect.origin.y = o_box_audFlts_rect.origin.y - 151; + o_box_vidFlts_rect.origin.y = o_box_vidFlts_rect.origin.y - 151; + } + + [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 - 151; + o_adjImg_expanded = NO; + } else { + /* insert view */ + o_box_adjImg_rect.size.height = [o_box_adjImg frame].size.height + 151; + [o_adjustImg_view setFrame: NSMakeRect( 20, -10, 370, 161)]; + [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 - 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; + + /* 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_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; + 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_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 +{ + /* en-/disable video filters */ +} + +- (IBAction)vidFlts_mrInfo:(id)sender +{ + /* show info sheet */ + NSBeginInformationalAlertSheet(_NS("More information"), _NS("OK"), @"", @"", \ + o_extended_window, nil, nil, nil, nil, _NS("Select the video effects " \ + "filters to apply. You must restart the stream for these settings to " \ + "take effect.\nTo configure the filters, go to the Preferences, and " \ + "go to Modules/Video Filters. You can then configure each filter.\n" \ + "If you want fine control over the filters ( to choose the order in " \ + "which they are applied ), you need to enter manually a filters " \ + "string (Preferences / Video / Filters).")); +} + +- (void)changeVFiltersString:(char *)psz_name onOrOff:(BOOL)o_onOrOff +{ + /* copied from ../wxwidgets/extrapanel.cpp + * renamed to conform with Cocoa's rules */ + + 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 ); + + if( o_onOrOff ) + { + 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, "vout-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, "vout-filter", psz_string ); + vlc_object_release( p_vout ); + } + + free( psz_string ); +} + + +- (void)changeAFiltersString: (char *)psz_name onOrOff: (BOOL)o_onOrOff; +{ + char *psz_parser, *psz_string; + intf_thread_t * p_intf = VLCIntf; + aout_instance_t * p_aout= (aout_instance_t *)vlc_object_find(p_intf, + VLC_OBJECT_AOUT, FIND_ANYWHERE); + + if( p_aout ) + { + psz_string = var_GetString( p_aout, "audio-filter" ); + } + else + { + psz_string = config_GetPsz( p_intf, "audio-filter" ); + } + + if( !psz_string ) psz_string = strdup(""); + + psz_parser = strstr( psz_string, psz_name ); + + if( o_onOrOff ) + { + 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 ); + + if( *(psz_string+strlen(psz_string ) -1 ) == ':' ) + { + *(psz_string+strlen(psz_string ) -1 ) = '\0'; + } + } + else + { + free( psz_string ); + return; + } + } + + if( p_aout == NULL ) + { + config_PutPsz( p_intf, "audio-filter", psz_string ); + } + else + { + var_SetString( p_aout, "audio-filter", psz_string ); + int i = 0; + while( i < p_aout->i_nb_inputs ) + { + p_aout->pp_inputs[i]->b_restart = VLC_TRUE; + i = (i + 1); + } + vlc_object_release( p_aout ); + } + free( psz_string ); +} +@end diff --git a/modules/gui/macosx/intf.h b/modules/gui/macosx/intf.h index 004add4c17..75237ca069 100644 --- a/modules/gui/macosx/intf.h +++ b/modules/gui/macosx/intf.h @@ -91,9 +91,11 @@ struct intf_sys_t id o_about; /* VLAboutBox */ id o_open; /* VLCOpen */ id o_wizard; /* VLCWizard */ + id o_extended; /* VLCExtended */ BOOL nib_open_loaded; /* reference to the open-nib */ BOOL nib_about_loaded; /* reference to the about-nib */ BOOL nib_wizard_loaded; /* reference to the wizard-nib */ + BOOL nib_extended_loaded; /* reference to the extended-nib */ IBOutlet id o_window; /* main window */ IBOutlet id o_playlist_view;/* playlist view */ @@ -226,6 +228,7 @@ struct intf_sys_t IBOutlet id o_mi_close_window; IBOutlet id o_mi_controller; IBOutlet id o_mi_equalizer; + IBOutlet id o_mi_extended; IBOutlet id o_mi_playlist; IBOutlet id o_mi_info; IBOutlet id o_mi_messages; @@ -292,6 +295,7 @@ struct intf_sys_t - (IBAction)intfOpenNet:(id)sender; - (IBAction)showWizard:(id)sender; +- (IBAction)showExtended:(id)sender; - (IBAction)viewAbout:(id)sender; - (IBAction)viewPreferences:(id)sender; diff --git a/modules/gui/macosx/intf.m b/modules/gui/macosx/intf.m index e0c8a1f50b..e9bc0cf76a 100644 --- a/modules/gui/macosx/intf.m +++ b/modules/gui/macosx/intf.m @@ -39,6 +39,7 @@ #include "about.h" #include "open.h" #include "wizard.h" +#include "extended.h" /***************************************************************************** * Local prototypes. @@ -298,6 +299,7 @@ static VLCMain *_o_sharedMainInstance = nil; o_prefs = nil; o_open = [[VLCOpen alloc] init]; o_wizard = [[VLCWizard alloc] init]; + o_extended = [[VLCExtended alloc] init]; i_lastShownVolume = -1; return _o_sharedMainInstance; @@ -527,6 +529,7 @@ static VLCMain *_o_sharedMainInstance = nil; [o_mi_close_window setTitle: _NS("Close Window")]; [o_mi_controller setTitle: _NS("Controller")]; [o_mi_equalizer setTitle: _NS("Equalizer")]; + [o_mi_extended setTitle: _NS("Extended controls")]; [o_mi_playlist setTitle: _NS("Playlist")]; [o_mi_info setTitle: _NS("Info")]; [o_mi_messages setTitle: _NS("Messages")]; @@ -1444,6 +1447,18 @@ static VLCMain *_o_sharedMainInstance = nil; } } +- (IBAction)showExtended:(id)sender +{ + if (!nib_extended_loaded) + { + nib_extended_loaded = [NSBundle loadNibNamed:@"Extended" owner:self]; + [o_extended initStrings]; + [o_extended showPanel]; + } else { + [o_extended showPanel]; + } +} + - (IBAction)viewAbout:(id)sender { if (!nib_about_loaded)