Commit 2ae76332 authored by Felix Paul Kühne's avatar Felix Paul Kühne

* added the opaqueness-slider to the extended panel (refs #318)

    - on-the-fly changing is not yet possible, since I don't know the correct pointer (the current one gives "dereferencing pointer to incomplete type"); see FIXME.
* VLCExtended is the delegate for o_extended_window now, to save the prefs automatically, once VLC is going to be terminated
* "awakeFromNib" was partially moved to "showPanel" to retrieve the slider values before showing the window, in case they were saved in the prefs-window
parent db818a6a
......@@ -4,6 +4,7 @@
{
ACTIONS = {
"adjImg_Enbl" = id;
"adjImg_opaque" = id;
"adjImg_rstrDefaults" = id;
"adjImg_sliders" = id;
"audFtls_hdphnVirt" = id;
......@@ -48,6 +49,7 @@
"o_lbl_gamma" = id;
"o_lbl_hue" = id;
"o_lbl_maxLevel" = id;
"o_lbl_opaque" = id;
"o_lbl_saturation" = id;
"o_lbl_video" = id;
"o_lbl_videoFlts" = id;
......@@ -56,6 +58,7 @@
"o_sld_gamma" = id;
"o_sld_hue" = id;
"o_sld_maxLevel" = id;
"o_sld_opaque" = id;
"o_sld_saturation" = id;
"o_videoFilters_view" = id;
};
......
......@@ -9,7 +9,7 @@
<key>13</key>
<string>506 668 390 138 0 0 1440 878 </string>
<key>32</key>
<string>525 497 390 213 0 0 1440 878 </string>
<string>525 487 390 233 0 0 1440 878 </string>
<key>5</key>
<string>525 506 390 196 0 0 1440 878 </string>
</dict>
......@@ -23,7 +23,6 @@
<array>
<integer>18</integer>
<integer>32</integer>
<integer>5</integer>
</array>
<key>IBSystem Version</key>
<string>8C46</string>
......
......@@ -74,11 +74,13 @@
IBOutlet id o_lbl_gamma;
IBOutlet id o_lbl_hue;
IBOutlet id o_lbl_saturation;
IBOutlet id o_lbl_opaque;
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;
IBOutlet id o_sld_opaque;
/* global variables */
BOOL o_adjImg_expanded;
......@@ -89,6 +91,7 @@
- (IBAction)adjImg_Enbl:(id)sender;
- (IBAction)adjImg_rstrDefaults:(id)sender;
- (IBAction)adjImg_sliders:(id)sender;
- (IBAction)adjImg_opaque:(id)sender;
- (IBAction)audFtls_hdphnVirt:(id)sender;
- (IBAction)audFtls_maxLevelSld:(id)sender;
- (IBAction)audFtls_vlmeNorm:(id)sender;
......
......@@ -38,6 +38,7 @@
#import "extended.h"
#import "intf.h"
#import "vout.h"
#import <vlc/aout.h>
#import <aout_internal.h>
#import <vlc/vout.h>
......@@ -67,6 +68,10 @@ static VLCExtended *_o_sharedInstance = nil;
return _o_sharedInstance;
}
/*****************************************************************************
* GUI methods
*****************************************************************************/
- (void)initStrings
{
/* localise GUI-strings */
......@@ -104,6 +109,7 @@ static VLCExtended *_o_sharedInstance = nil;
[o_lbl_gamma setStringValue: _NS("Gamma")];
[o_lbl_hue setStringValue: _NS("Hue")];
[o_lbl_saturation setStringValue: _NS("Saturation")];
[o_lbl_opaque setStringValue: _NS("Opaqueness")];
}
......@@ -134,13 +140,44 @@ 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_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" );
......@@ -148,55 +185,32 @@ static VLCExtended *_o_sharedInstance = nil;
{
[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];
......@@ -304,6 +318,34 @@ static VLCExtended *_o_sharedInstance = 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 */
......@@ -355,20 +397,20 @@ 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 - 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];
......@@ -378,13 +420,13 @@ static VLCExtended *_o_sharedInstance = nil;
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];
......@@ -528,6 +570,11 @@ static VLCExtended *_o_sharedInstance = nil;
"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
......@@ -673,16 +720,31 @@ static VLCExtended *_o_sharedInstance = nil;
{
/* 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
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment