Commit 497db07a authored by David Fuhrmann's avatar David Fuhrmann

macosx: CAS: eye candy and {en,dis}abling logic for customize panel

parent 64daf779
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -62,6 +62,8 @@
IBOutlet id _customize_newProfile_btn;
IBOutlet id _customize_tabview;
IBOutlet id _customize_encap_matrix;
IBOutlet id _customize_vid_settings_box;
IBOutlet id _customize_vid_ckb;
IBOutlet id _customize_vid_keep_ckb;
IBOutlet id _customize_vid_codec_lbl;
......@@ -78,6 +80,8 @@
IBOutlet id _customize_vid_height_fld;
IBOutlet id _customize_vid_scale_lbl;
IBOutlet id _customize_vid_scale_pop;
IBOutlet id _customize_aud_settings_box;
IBOutlet id _customize_aud_ckb;
IBOutlet id _customize_aud_keep_ckb;
IBOutlet id _customize_aud_codec_lbl;
......@@ -88,6 +92,7 @@
IBOutlet id _customize_aud_channels_fld;
IBOutlet id _customize_aud_samplerate_lbl;
IBOutlet id _customize_aud_samplerate_pop;
IBOutlet id _customize_subs_ckb;
IBOutlet id _customize_subs_pop;
IBOutlet id _customize_subs_overlay_ckb;
......@@ -158,6 +163,10 @@
- (void)panel:(VLCEnterTextPanel *)panel returnValue:(NSUInteger)value text:(NSString *)text;
- (void)panel:(VLCSelectItemInPopupPanel *)panel returnValue:(NSUInteger)value item:(NSUInteger)item;
- (IBAction)videoSettingsChanged:(id)sender;
- (IBAction)audioSettingsChanged:(id)sender;
- (IBAction)subSettingsChanged:(id)sender;
- (void)updateDropView;
@end
......
......@@ -641,6 +641,27 @@ static VLCConvertAndSave *_o_sharedInstance = nil;
}
}
- (IBAction)videoSettingsChanged:(id)sender
{
bool enableSettings = [_customize_vid_ckb state] == NSOnState && [_customize_vid_keep_ckb state] == NSOffState;
[_customize_vid_settings_box enableSubviews:enableSettings];
[_customize_vid_keep_ckb setEnabled:[_customize_vid_ckb state] == NSOnState];
}
- (IBAction)audioSettingsChanged:(id)sender
{
bool enableSettings = [_customize_aud_ckb state] == NSOnState && [_customize_aud_keep_ckb state] == NSOffState;
[_customize_aud_settings_box enableSubviews:enableSettings];
[_customize_aud_keep_ckb setEnabled:[_customize_aud_ckb state] == NSOnState];
}
- (IBAction)subSettingsChanged:(id)sender
{
bool enableSettings = [_customize_subs_ckb state] == NSOnState;
[_customize_subs_overlay_ckb setEnabled:enableSettings];
[_customize_subs_pop setEnabled:enableSettings];
}
# pragma mark -
# pragma mark Private Functionality
- (void)updateDropView
......@@ -750,6 +771,10 @@ static VLCConvertAndSave *_o_sharedInstance = nil;
}
}
[self videoSettingsChanged:nil];
[self audioSettingsChanged:nil];
[self subSettingsChanged:nil];
[self setCurrentProfile: [[[NSMutableArray alloc] initWithArray: [profileString componentsSeparatedByString:@";"]] autorelease]];
}
......
......@@ -211,3 +211,11 @@
- (bool)isPartialStringValid:(NSString*)partialString newEditingString:(NSString**)newString errorDescription:(NSString**)error;
@end
/*****************************************************************************
* NSView addition
*****************************************************************************/
@interface NSView (EnableSubviews)
- (void)enableSubviews:(BOOL)b_enable;
@end
\ No newline at end of file
......@@ -856,4 +856,29 @@ void _drawFrameInRect(NSRect frameRect)
}
@end
@implementation NSView (EnableSubviews)
- (void)enableSubviews:(BOOL)b_enable
{
for (NSView *o_view in [self subviews]) {
[o_view enableSubviews:b_enable];
// enable NSControl
if ([o_view respondsToSelector:@selector(setEnabled:)]) {
[(NSControl *)o_view setEnabled:b_enable];
}
// also "enable / disable" text views
if ([o_view respondsToSelector:@selector(setTextColor:)]) {
if (b_enable == NO) {
[(NSTextField *)o_view setTextColor:[NSColor disabledControlTextColor]];
} else {
[(NSTextField *)o_view setTextColor:[NSColor controlTextColor]];
}
}
}
}
@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