#import "extended.h"
#import "intf.h"
+#import "vout.h"
#import <vlc/aout.h>
#import <aout_internal.h>
#import <vlc/vout.h>
return _o_sharedInstance;
}
+/*****************************************************************************
+ * GUI methods
+ *****************************************************************************/
+
- (void)initStrings
{
/* localise GUI-strings */
[o_lbl_gamma setStringValue: _NS("Gamma")];
[o_lbl_hue setStringValue: _NS("Hue")];
[o_lbl_saturation setStringValue: _NS("Saturation")];
+ [o_lbl_opaque setStringValue: _NS("Opaqueness")];
}
[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_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 );
+ }
+
+ /* 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
+{
+ /* get the correct slider values from the prefs, in case they were changed
+ * elsewhere */
+ intf_thread_t * p_intf = VLCIntf;
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" );
{
[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 other video-filter-checkboxes to the correct values */
- if( psz_vfilters )
- {
- [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 );
- }
-
- /* 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 );
- }
-
+
[o_sld_maxLevel setFloatValue: (config_GetFloat(p_intf, "norm-max-level") \
* 10)];
-}
-- (void)showPanel
-{
+ [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_opaque:(id)sender
+{
+ /* change the opaqueness of the vouts */
+ playlist_t * p_playlist = vlc_object_find( VLCIntf, VLC_OBJECT_PLAYLIST, \
+ FIND_ANYWHERE );
+ vout_thread_t * p_vout = (vout_thread_t *)vlc_object_find( p_playlist, \
+ VLC_OBJECT_VOUT, FIND_ANYWHERE );
+
+ vlc_value_t val;
+ val.f_float = [o_sld_opaque floatValue] / 100;
+
+ /* Try to set on the fly */
+ if( p_vout )
+ {
+ /* FIXME: insert the correct pointer here */
+ /* [p_vout->p_sys->o_window setAlpha: var_CreateGetFloat( p_vout, \
+ "macosx-opaqueness")]; */
+ msg_Dbg( p_playlist, "p_vout found");
+ var_Set( p_vout, "macosx-opaqueness", val );
+ vlc_object_release( p_vout );
+ }
+
+ /* store to prefs */
+ config_PutFloat( p_playlist , "macosx-opaqueness" , val.f_float );
+
+ vlc_object_release( p_playlist );
+}
+
- (IBAction)audFtls_hdphnVirt:(id)sender
{
/* en-/disable headphone virtualisation */
{
/* 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;
+ 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;
/* 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_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_box_audFlts setFrameFromContentFrame: o_box_audFlts_rect];
if (o_adjImg_expanded)
{
- o_box_adjImg_rect.size.height = [o_box_adjImg frame].size.height - 151;
+ o_box_adjImg_rect.size.height = [o_box_adjImg frame].size.height - 171;
msg_Dbg( VLCIntf, "collapsed adjust-image section");
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_box_adjImg_rect.size.height = [o_box_adjImg frame].size.height + 171;
+ [o_adjustImg_view setFrame: NSMakeRect( 20, -10, 370, 181)];
[o_adjustImg_view setNeedsDisplay:YES];
[o_adjustImg_view setAutoresizesSubviews: YES];
[[o_box_adjImg contentView] addSubview: o_adjustImg_view];
"string (Preferences / Video / Filters)."));
}
+
+/*****************************************************************************
+ * methods to communicate changes to VLC's core
+ *****************************************************************************/
+
- (void)changeVFiltersString:(char *)psz_name onOrOff:(vlc_bool_t )b_add
{
/* copied from ../wxwidgets/extrapanel.cpp
{
/* save the preferences to make sure that our module-changes will up on
* next launch again */
- intf_thread_t * p_intf = VLCIntf;
+ playlist_t * p_playlist = vlc_object_find( VLCIntf, VLC_OBJECT_PLAYLIST, \
+ FIND_ANYWHERE );
int returnedValue;
- returnedValue = config_SaveConfigFile( p_intf, NULL);
+ returnedValue = config_SaveConfigFile( p_playlist, NULL);
if (returnedValue == 0)
{
- msg_Dbg(p_intf, "VLCExtended: saved preferences successfully");
+ msg_Dbg(p_playlist, "VLCExtended: saved preferences successfully");
} else {
- msg_Dbg(p_intf, "VLCExtended: error while saving the preferences (%i) " \
- , returnedValue);
+ msg_Dbg(p_playlist, "VLCExtended: error while saving the preferences " \
+ "(%i)" , returnedValue);
}
+ vlc_object_release( p_playlist );
+}
+
+
+/*****************************************************************************
+ * delegate method
+ *****************************************************************************/
+
+- (BOOL)applicationShouldTerminate:(NSWindow *)sender
+{
+ /* save the prefs before shutting down */
+ [self savePrefs];
+
+ return YES;
}
@end