Commit c33e5f19 authored by Felix Paul Kühne's avatar Felix Paul Kühne

macosx: unify and modernize coding style

parent 8b66194b
This diff is collapsed.
...@@ -289,21 +289,21 @@ static VLCConvertAndSave *_o_sharedInstance = nil; ...@@ -289,21 +289,21 @@ static VLCConvertAndSave *_o_sharedInstance = nil;
input_item_AddOption(p_input, [[self composedOptions] UTF8String], VLC_INPUT_OPTION_TRUSTED); input_item_AddOption(p_input, [[self composedOptions] UTF8String], VLC_INPUT_OPTION_TRUSTED);
int returnValue; int returnValue;
returnValue = playlist_AddInput( p_playlist, p_input, PLAYLIST_STOP, PLAYLIST_END, true, pl_Unlocked ); returnValue = playlist_AddInput(p_playlist, p_input, PLAYLIST_STOP, PLAYLIST_END, true, pl_Unlocked);
if (returnValue == VLC_SUCCESS) { if (returnValue == VLC_SUCCESS) {
/* let's "play" */ /* let's "play" */
PL_LOCK; PL_LOCK;
playlist_item_t *p_item = playlist_ItemGetByInput( p_playlist, p_input ); playlist_item_t *p_item = playlist_ItemGetByInput(p_playlist, p_input);
playlist_Control( p_playlist, PLAYLIST_VIEWPLAY, pl_Locked, NULL, playlist_Control(p_playlist, PLAYLIST_VIEWPLAY, pl_Locked, NULL,
p_item ); p_item);
PL_UNLOCK; PL_UNLOCK;
} }
else else
msg_Err( VLCIntf, "CAS: playlist add input failed :("); msg_Err(VLCIntf, "CAS: playlist add input failed :(");
/* we're done with this input */ /* we're done with this input */
vlc_gc_decref( p_input ); vlc_gc_decref(p_input);
[_window performClose:sender]; [_window performClose:sender];
} }
...@@ -575,8 +575,8 @@ static VLCConvertAndSave *_o_sharedInstance = nil; ...@@ -575,8 +575,8 @@ static VLCConvertAndSave *_o_sharedInstance = nil;
NSString *desired_type = [paste availableTypeFromArray: types]; NSString *desired_type = [paste availableTypeFromArray: types];
NSData *carried_data = [paste dataForType: desired_type]; NSData *carried_data = [paste dataForType: desired_type];
if( carried_data ) { if (carried_data) {
if( [desired_type isEqualToString:NSFilenamesPboardType] ) { if ([desired_type isEqualToString:NSFilenamesPboardType]) {
NSArray *values = [[paste propertyListForType: NSFilenamesPboardType] sortedArrayUsingSelector:@selector(caseInsensitiveCompare:)]; NSArray *values = [[paste propertyListForType: NSFilenamesPboardType] sortedArrayUsingSelector:@selector(caseInsensitiveCompare:)];
if ([values count] > 0) { if ([values count] > 0) {
...@@ -585,11 +585,11 @@ static VLCConvertAndSave *_o_sharedInstance = nil; ...@@ -585,11 +585,11 @@ static VLCConvertAndSave *_o_sharedInstance = nil;
[self updateDropView]; [self updateDropView];
return YES; return YES;
} }
} else if( [desired_type isEqualToString:@"VLCPlaylistItemPboardType"] ) { } else if ([desired_type isEqualToString:@"VLCPlaylistItemPboardType"]) {
NSArray * array = [[[VLCMain sharedInstance] playlist] draggedItems]; NSArray * array = [[[VLCMain sharedInstance] playlist] draggedItems];
NSUInteger count = [array count]; NSUInteger count = [array count];
if (count > 0) { if (count > 0) {
playlist_t * p_playlist = pl_Get( VLCIntf ); playlist_t * p_playlist = pl_Get(VLCIntf);
playlist_item_t * p_item = NULL; playlist_item_t * p_item = NULL;
PL_LOCK; PL_LOCK;
...@@ -729,35 +729,35 @@ static VLCConvertAndSave *_o_sharedInstance = nil; ...@@ -729,35 +729,35 @@ static VLCConvertAndSave *_o_sharedInstance = nil;
{ {
if ([format isEqualToString:@"ts"]) if ([format isEqualToString:@"ts"])
[_customize_encap_matrix selectCellWithTag:MPEGTS]; [_customize_encap_matrix selectCellWithTag:MPEGTS];
else if([format isEqualToString:@"webm"]) else if ([format isEqualToString:@"webm"])
[_customize_encap_matrix selectCellWithTag:WEBM]; [_customize_encap_matrix selectCellWithTag:WEBM];
else if([format isEqualToString:@"ogg"]) else if ([format isEqualToString:@"ogg"])
[_customize_encap_matrix selectCellWithTag:OGG]; [_customize_encap_matrix selectCellWithTag:OGG];
else if([format isEqualToString:@"ogm"]) else if ([format isEqualToString:@"ogm"])
[_customize_encap_matrix selectCellWithTag:OGG]; [_customize_encap_matrix selectCellWithTag:OGG];
else if([format isEqualToString:@"mp4"]) else if ([format isEqualToString:@"mp4"])
[_customize_encap_matrix selectCellWithTag:MP4]; [_customize_encap_matrix selectCellWithTag:MP4];
else if([format isEqualToString:@"mov"]) else if ([format isEqualToString:@"mov"])
[_customize_encap_matrix selectCellWithTag:MP4]; [_customize_encap_matrix selectCellWithTag:MP4];
else if([format isEqualToString:@"ps"]) else if ([format isEqualToString:@"ps"])
[_customize_encap_matrix selectCellWithTag:MPEGPS]; [_customize_encap_matrix selectCellWithTag:MPEGPS];
else if([format isEqualToString:@"mpjpeg"]) else if ([format isEqualToString:@"mpjpeg"])
[_customize_encap_matrix selectCellWithTag:MJPEG]; [_customize_encap_matrix selectCellWithTag:MJPEG];
else if([format isEqualToString:@"wav"]) else if ([format isEqualToString:@"wav"])
[_customize_encap_matrix selectCellWithTag:WAV]; [_customize_encap_matrix selectCellWithTag:WAV];
else if([format isEqualToString:@"flv"]) else if ([format isEqualToString:@"flv"])
[_customize_encap_matrix selectCellWithTag:FLV]; [_customize_encap_matrix selectCellWithTag:FLV];
else if([format isEqualToString:@"mpeg1"]) else if ([format isEqualToString:@"mpeg1"])
[_customize_encap_matrix selectCellWithTag:MPEG1]; [_customize_encap_matrix selectCellWithTag:MPEG1];
else if([format isEqualToString:@"mkv"]) else if ([format isEqualToString:@"mkv"])
[_customize_encap_matrix selectCellWithTag:MKV]; [_customize_encap_matrix selectCellWithTag:MKV];
else if([format isEqualToString:@"raw"]) else if ([format isEqualToString:@"raw"])
[_customize_encap_matrix selectCellWithTag:RAW]; [_customize_encap_matrix selectCellWithTag:RAW];
else if([format isEqualToString:@"avi"]) else if ([format isEqualToString:@"avi"])
[_customize_encap_matrix selectCellWithTag:AVI]; [_customize_encap_matrix selectCellWithTag:AVI];
else if([format isEqualToString:@"asf"]) else if ([format isEqualToString:@"asf"])
[_customize_encap_matrix selectCellWithTag:ASF]; [_customize_encap_matrix selectCellWithTag:ASF];
else if([format isEqualToString:@"wmv"]) else if ([format isEqualToString:@"wmv"])
[_customize_encap_matrix selectCellWithTag:ASF]; [_customize_encap_matrix selectCellWithTag:ASF];
else else
msg_Err(VLCIntf, "CAS: unknown encap format requested for customization"); msg_Err(VLCIntf, "CAS: unknown encap format requested for customization");
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -111,9 +111,8 @@ ...@@ -111,9 +111,8 @@
- (void)loadButtonIcons - (void)loadButtonIcons
{ {
if (!OSX_SNOW_LEOPARD) if (!OSX_SNOW_LEOPARD) {
{ if ([NSColor currentControlTint] == NSBlueControlTint)
if( [NSColor currentControlTint] == NSBlueControlTint )
{ {
o_red_img = [[NSImage imageNamed:@"lion-window-close"] retain]; o_red_img = [[NSImage imageNamed:@"lion-window-close"] retain];
o_red_over_img = [[NSImage imageNamed:@"lion-window-close-over"] retain]; o_red_over_img = [[NSImage imageNamed:@"lion-window-close-over"] retain];
...@@ -136,7 +135,7 @@ ...@@ -136,7 +135,7 @@
o_green_on_img = [[NSImage imageNamed:@"lion-window-zoom-on-graphite"] retain]; o_green_on_img = [[NSImage imageNamed:@"lion-window-zoom-on-graphite"] retain];
} }
} else { } else {
if( [NSColor currentControlTint] == NSBlueControlTint ) if ([NSColor currentControlTint] == NSBlueControlTint)
{ {
o_red_img = [[NSImage imageNamed:@"snowleo-window-close"] retain]; o_red_img = [[NSImage imageNamed:@"snowleo-window-close"] retain];
o_red_over_img = [[NSImage imageNamed:@"snowleo-window-close-over"] retain]; o_red_over_img = [[NSImage imageNamed:@"snowleo-window-close-over"] retain];
...@@ -174,20 +173,17 @@ ...@@ -174,20 +173,17 @@
[[self window] miniaturize: sender]; [[self window] miniaturize: sender];
else if (sender == o_green_btn) else if (sender == o_green_btn)
[[self window] performZoom: sender]; [[self window] performZoom: sender];
else if (sender == o_fullscreen_btn) else if (sender == o_fullscreen_btn) {
{
// set fs directly to true, as the vars can be already true in some configs // set fs directly to true, as the vars can be already true in some configs
var_SetBool( pl_Get( VLCIntf ), "fullscreen", true ); var_SetBool(pl_Get(VLCIntf), "fullscreen", true);
vout_thread_t *p_vout = getVout(); vout_thread_t *p_vout = getVout();
if( p_vout ) if (p_vout) {
{ var_SetBool(p_vout, "fullscreen", true);
var_SetBool( p_vout, "fullscreen", true ); vlc_object_release(p_vout);
vlc_object_release( p_vout );
} }
} } else
else msg_Err(VLCIntf, "unknown button action sender");
msg_Err( VLCIntf, "unknown button action sender" );
[self setWindowButtonOver: NO]; [self setWindowButtonOver: NO];
[self setWindowFullscreenButtonOver: NO]; [self setWindowFullscreenButtonOver: NO];
...@@ -195,8 +191,7 @@ ...@@ -195,8 +191,7 @@
- (void)setWindowTitle:(NSString *)title - (void)setWindowTitle:(NSString *)title
{ {
if (!o_window_title_shadow) if (!o_window_title_shadow) {
{
o_window_title_shadow = [[NSShadow alloc] init]; o_window_title_shadow = [[NSShadow alloc] init];
[o_window_title_shadow setShadowColor:[NSColor colorWithCalibratedWhite:1.0 alpha:0.5]]; [o_window_title_shadow setShadowColor:[NSColor colorWithCalibratedWhite:1.0 alpha:0.5]];
[o_window_title_shadow setShadowOffset:NSMakeSize(0.0, -1.5)]; [o_window_title_shadow setShadowOffset:NSMakeSize(0.0, -1.5)];
...@@ -220,14 +215,11 @@ ...@@ -220,14 +215,11 @@
- (void)setWindowButtonOver:(BOOL)b_value - (void)setWindowButtonOver:(BOOL)b_value
{ {
if( b_value ) if (b_value) {
{
[o_red_btn setImage: o_red_over_img]; [o_red_btn setImage: o_red_over_img];
[o_yellow_btn setImage: o_yellow_over_img]; [o_yellow_btn setImage: o_yellow_over_img];
[o_green_btn setImage: o_green_over_img]; [o_green_btn setImage: o_green_over_img];
} } else {
else
{
[o_red_btn setImage: o_red_img]; [o_red_btn setImage: o_red_img];
[o_yellow_btn setImage: o_yellow_img]; [o_yellow_btn setImage: o_yellow_img];
[o_green_btn setImage: o_green_img]; [o_green_btn setImage: o_green_img];
...@@ -245,7 +237,7 @@ ...@@ -245,7 +237,7 @@
- (void)mouseDown:(NSEvent *)event - (void)mouseDown:(NSEvent *)event
{ {
NSPoint ml = [self convertPoint: [event locationInWindow] fromView: self]; NSPoint ml = [self convertPoint: [event locationInWindow] fromView: self];
if( ([[self window] frame].size.height - ml.y) <= 22. && [event clickCount] == 2) { if (([[self window] frame].size.height - ml.y) <= 22. && [event clickCount] == 2) {
//Get settings from "System Preferences" > "Appearance" > "Double-click on windows title bar to minimize" //Get settings from "System Preferences" > "Appearance" > "Double-click on windows title bar to minimize"
NSString *const MDAppleMiniaturizeOnDoubleClickKey = @"AppleMiniaturizeOnDoubleClick"; NSString *const MDAppleMiniaturizeOnDoubleClickKey = @"AppleMiniaturizeOnDoubleClick";
NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults]; NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults];
...@@ -323,9 +315,8 @@ ...@@ -323,9 +315,8 @@
id theControlView = [self controlView]; id theControlView = [self controlView];
if ([theControlView respondsToSelector: @selector(extendedAccessibilityIsAttributeSettable:)]) { if ([theControlView respondsToSelector: @selector(extendedAccessibilityIsAttributeSettable:)]) {
NSNumber *theValue = [theControlView extendedAccessibilityIsAttributeSettable: theAttributeName]; NSNumber *theValue = [theControlView extendedAccessibilityIsAttributeSettable: theAttributeName];
if (theValue) { if (theValue)
return [theValue boolValue]; // same basic strategy we use in -accessibilityAttributeValue: return [theValue boolValue]; // same basic strategy we use in -accessibilityAttributeValue:
}
} }
return [super accessibilityIsAttributeSettable: theAttributeName]; return [super accessibilityIsAttributeSettable: theAttributeName];
} }
...@@ -367,8 +358,7 @@ ...@@ -367,8 +358,7 @@
if (windowFrame.size.width < winMinSize.width) if (windowFrame.size.width < winMinSize.width)
windowFrame.size.width = winMinSize.width; windowFrame.size.width = winMinSize.width;
if (windowFrame.size.height < winMinSize.height) if (windowFrame.size.height < winMinSize.height) {
{
windowFrame.size.height = winMinSize.height; windowFrame.size.height = winMinSize.height;
windowFrame.origin.y = oldOriginY; windowFrame.origin.y = oldOriginY;
} }
...@@ -431,12 +421,10 @@ ...@@ -431,12 +421,10 @@
- (void)accessibilityPerformAction: (NSString*)theActionName { - (void)accessibilityPerformAction: (NSString*)theActionName {
if ([theActionName isEqualToString: NSAccessibilityPressAction]) { if ([theActionName isEqualToString: NSAccessibilityPressAction]) {
if ([self isEnabled]) { if ([self isEnabled])
[self performClick: nil]; [self performClick: nil];
} } else
} else {
[super accessibilityPerformAction: theActionName]; [super accessibilityPerformAction: theActionName];
}
} }
@end @end
...@@ -506,7 +494,7 @@ ...@@ -506,7 +494,7 @@
NSImage * icon; NSImage * icon;
NSMenuItem * currentItem; NSMenuItem * currentItem;
NSMutableString * currentPath; NSMutableString * currentPath;
NSSize iconSize = NSMakeSize( 16., 16. ); NSSize iconSize = NSMakeSize(16., 16.);
for (NSUInteger i = count - 1; i > 0; i--) { for (NSUInteger i = count - 1; i > 0; i--) {
currentPath = [NSMutableString stringWithCapacity:1024]; currentPath = [NSMutableString stringWithCapacity:1024];
for (NSUInteger y = 0; y < i; y++) for (NSUInteger y = 0; y < i; y++)
...@@ -552,8 +540,7 @@ ...@@ -552,8 +540,7 @@
NSUInteger count = [contextMenu numberOfItems]; NSUInteger count = [contextMenu numberOfItems];
NSUInteger selectedItem = [contextMenu indexOfItem: sender]; NSUInteger selectedItem = [contextMenu indexOfItem: sender];
if (selectedItem == count - 1) // the fake computer item if (selectedItem == count - 1) { // the fake computer item
{
[[NSWorkspace sharedWorkspace] selectFile: @"/" inFileViewerRootedAtPath: @""]; [[NSWorkspace sharedWorkspace] selectFile: @"/" inFileViewerRootedAtPath: @""];
return; return;
} }
...@@ -562,8 +549,7 @@ ...@@ -562,8 +549,7 @@
if (! representedURL) if (! representedURL)
return; return;
if (selectedItem == 0) // the actual file, let's save time if (selectedItem == 0) { // the actual file, let's save time
{
[[NSWorkspace sharedWorkspace] selectFile: [representedURL path] inFileViewerRootedAtPath: [representedURL path]]; [[NSWorkspace sharedWorkspace] selectFile: [representedURL path] inFileViewerRootedAtPath: [representedURL path]];
return; return;
} }
...@@ -589,7 +575,7 @@ ...@@ -589,7 +575,7 @@
- (void)rightMouseDown:(NSEvent *)o_event - (void)rightMouseDown:(NSEvent *)o_event
{ {
if( [o_event type] == NSRightMouseDown ) if ([o_event type] == NSRightMouseDown)
[self showRightClickMenuWithEvent:o_event]; [self showRightClickMenuWithEvent:o_event];
[super mouseDown: o_event]; [super mouseDown: o_event];
......
This diff is collapsed.
...@@ -44,9 +44,9 @@ static VLCTrackSynchronization *_o_sharedInstance = nil; ...@@ -44,9 +44,9 @@ static VLCTrackSynchronization *_o_sharedInstance = nil;
- (id)init - (id)init
{ {
if (_o_sharedInstance) { if (_o_sharedInstance)
[self dealloc]; [self dealloc];
} else { else {
p_intf = VLCIntf; p_intf = VLCIntf;
_o_sharedInstance = [super init]; _o_sharedInstance = [super init];
} }
...@@ -65,16 +65,15 @@ static VLCTrackSynchronization *_o_sharedInstance = nil; ...@@ -65,16 +65,15 @@ static VLCTrackSynchronization *_o_sharedInstance = nil;
[o_sv_lbl setStringValue: _NS("Subtitles/Video")]; [o_sv_lbl setStringValue: _NS("Subtitles/Video")];
[o_sv_advance_lbl setStringValue: _NS("Subtitle track syncronization:")]; [o_sv_advance_lbl setStringValue: _NS("Subtitle track syncronization:")];
[[o_sv_advance_value_fld formatter] setFormat:[NSString stringWithFormat:@"#,##0.000 %@", _NS("s")]]; [[o_sv_advance_value_fld formatter] setFormat:[NSString stringWithFormat:@"#,##0.000 %@", _NS("s")]];
[o_sv_advance_value_fld setToolTip: _NS("A positive value means that the subtitles are ahead of the video" )]; [o_sv_advance_value_fld setToolTip: _NS("A positive value means that the subtitles are ahead of the video")];
[o_sv_speed_lbl setStringValue: _NS("Subtitles speed:")]; [o_sv_speed_lbl setStringValue: _NS("Subtitles speed:")];
[[o_sv_speed_value_fld formatter] setFormat:[NSString stringWithFormat:@"#,##0.000 %@", _NS("fps")]]; [[o_sv_speed_value_fld formatter] setFormat:[NSString stringWithFormat:@"#,##0.000 %@", _NS("fps")]];
[o_sv_dur_lbl setStringValue: _NS("Subtitles duration factor:")]; [o_sv_dur_lbl setStringValue: _NS("Subtitles duration factor:")];
int i_mode = var_InheritInteger( p_intf, SUBSDELAY_CFG_MODE ); int i_mode = var_InheritInteger(p_intf, SUBSDELAY_CFG_MODE);
NSString * o_toolTip, * o_suffix; NSString * o_toolTip, * o_suffix;
switch (i_mode) switch (i_mode) {
{
default: default:
case SUBSDELAY_MODE_ABSOLUTE: case SUBSDELAY_MODE_ABSOLUTE:
o_toolTip = _NS("Extend subtitles duration by this value.\nSet 0 to disable."); o_toolTip = _NS("Extend subtitles duration by this value.\nSet 0 to disable.");
...@@ -101,7 +100,7 @@ static VLCTrackSynchronization *_o_sharedInstance = nil; ...@@ -101,7 +100,7 @@ static VLCTrackSynchronization *_o_sharedInstance = nil;
- (IBAction)toggleWindow:(id)sender - (IBAction)toggleWindow:(id)sender
{ {
if( [o_window isVisible] ) if ([o_window isVisible])
[o_window orderOut:sender]; [o_window orderOut:sender];
else else
[o_window makeKeyAndOrderFront:sender]; [o_window makeKeyAndOrderFront:sender];
...@@ -118,28 +117,26 @@ static VLCTrackSynchronization *_o_sharedInstance = nil; ...@@ -118,28 +117,26 @@ static VLCTrackSynchronization *_o_sharedInstance = nil;
[o_sv_speed_stp setFloatValue:1.0]; [o_sv_speed_stp setFloatValue:1.0];
[o_sv_dur_stp setFloatValue:0.0]; [o_sv_dur_stp setFloatValue:0.0];
input_thread_t * p_input = pl_CurrentInput( p_intf ); input_thread_t * p_input = pl_CurrentInput(p_intf);
if( p_input ) if (p_input) {
{ var_SetTime(p_input, "audio-delay", 0.0);
var_SetTime( p_input, "audio-delay", 0.0 ); var_SetTime(p_input, "spu-delay", 0.0);
var_SetTime( p_input, "spu-delay", 0.0 ); var_SetFloat(p_input, "sub-fps", 1.0);
var_SetFloat( p_input, "sub-fps", 1.0 );
[self svDurationValueChanged:nil]; [self svDurationValueChanged:nil];
vlc_object_release( p_input ); vlc_object_release(p_input);
} }
} }
- (void)updateValues - (void)updateValues
{ {
input_thread_t * p_input = pl_CurrentInput( p_intf ); input_thread_t * p_input = pl_CurrentInput(p_intf);
if( p_input ) if (p_input) {
{ [o_av_value_fld setDoubleValue: var_GetTime(p_input, "audio-delay") / 1000000.];
[o_av_value_fld setDoubleValue: var_GetTime( p_input, "audio-delay" ) / 1000000.]; [o_sv_advance_value_fld setDoubleValue: var_GetTime(p_input, "spu-delay") / 1000000.];
[o_sv_advance_value_fld setDoubleValue: var_GetTime( p_input, "spu-delay" ) / 1000000.]; [o_sv_speed_value_fld setFloatValue: var_GetFloat(p_input, "sub-fps")];
[o_sv_speed_value_fld setFloatValue: var_GetFloat( p_input, "sub-fps" )]; vlc_object_release(p_input);
vlc_object_release( p_input );
} }
[o_av_stp setDoubleValue: [o_av_value_fld doubleValue]]; [o_av_stp setDoubleValue: [o_av_value_fld doubleValue]];
[o_sv_advance_stp setDoubleValue: [o_sv_advance_value_fld doubleValue]]; [o_sv_advance_stp setDoubleValue: [o_sv_advance_value_fld doubleValue]];
...@@ -148,79 +145,74 @@ static VLCTrackSynchronization *_o_sharedInstance = nil; ...@@ -148,79 +145,74 @@ static VLCTrackSynchronization *_o_sharedInstance = nil;
- (IBAction)avValueChanged:(id)sender - (IBAction)avValueChanged:(id)sender
{ {
if( sender == o_av_stp ) if (sender == o_av_stp)
[o_av_value_fld setDoubleValue: [o_av_stp doubleValue]]; [o_av_value_fld setDoubleValue: [o_av_stp doubleValue]];
else else
[o_av_stp setDoubleValue: [o_av_value_fld doubleValue]]; [o_av_stp setDoubleValue: [o_av_value_fld doubleValue]];
input_thread_t * p_input = pl_CurrentInput( p_intf ); input_thread_t * p_input = pl_CurrentInput(p_intf);
if( p_input ) if (p_input) {
{ var_SetTime(p_input, "audio-delay", [o_av_value_fld doubleValue] * 1000000.);
var_SetTime( p_input, "audio-delay", [o_av_value_fld doubleValue] * 1000000. );
vlc_object_release( p_input ); vlc_object_release(p_input);
} }
} }
- (IBAction)svAdvanceValueChanged:(id)sender - (IBAction)svAdvanceValueChanged:(id)sender
{ {
if( sender == o_sv_advance_stp ) if (sender == o_sv_advance_stp)
[o_sv_advance_value_fld setDoubleValue: [o_sv_advance_stp doubleValue]]; [o_sv_advance_value_fld setDoubleValue: [o_sv_advance_stp doubleValue]];
else else
[o_sv_advance_stp setDoubleValue: [o_sv_advance_value_fld doubleValue]]; [o_sv_advance_stp setDoubleValue: [o_sv_advance_value_fld doubleValue]];
input_thread_t * p_input = pl_CurrentInput( p_intf ); input_thread_t * p_input = pl_CurrentInput(p_intf);
if( p_input ) if (p_input) {
{ var_SetTime(p_input, "spu-delay", [o_sv_advance_value_fld doubleValue] * 1000000.);
var_SetTime( p_input, "spu-delay", [o_sv_advance_value_fld doubleValue] * 1000000. );
vlc_object_release( p_input ); vlc_object_release(p_input);
} }
} }
- (IBAction)svSpeedValueChanged:(id)sender - (IBAction)svSpeedValueChanged:(id)sender
{ {
if( sender == o_sv_speed_stp ) if (sender == o_sv_speed_stp)
[o_sv_speed_value_fld setFloatValue: [o_sv_speed_stp floatValue]]; [o_sv_speed_value_fld setFloatValue: [o_sv_speed_stp floatValue]];
else else
[o_sv_speed_stp setFloatValue: [o_sv_speed_value_fld floatValue]]; [o_sv_speed_stp setFloatValue: [o_sv_speed_value_fld floatValue]];
input_thread_t * p_input = pl_CurrentInput( p_intf ); input_thread_t * p_input = pl_CurrentInput(p_intf);
if( p_input ) if (p_input) {
{ var_SetFloat(p_input, "sub-fps", [o_sv_speed_value_fld floatValue]);
var_SetFloat( p_input, "sub-fps", [o_sv_speed_value_fld floatValue] );
vlc_object_release( p_input ); vlc_object_release(p_input);
} }
} }
- (IBAction)svDurationValueChanged:(id)sender - (IBAction)svDurationValueChanged:(id)sender
{ {
if( sender == o_sv_dur_stp ) if (sender == o_sv_dur_stp)
[o_sv_dur_value_fld setFloatValue: [o_sv_dur_stp floatValue]]; [o_sv_dur_value_fld setFloatValue: [o_sv_dur_stp floatValue]];
else else
[o_sv_dur_stp setFloatValue: [o_sv_dur_value_fld floatValue]]; [o_sv_dur_stp setFloatValue: [o_sv_dur_value_fld floatValue]];
input_thread_t * p_input = pl_CurrentInput( p_intf ); input_thread_t * p_input = pl_CurrentInput(p_intf);
if( p_input ) if (p_input) {
{
float f_factor = [o_sv_dur_value_fld floatValue]; float f_factor = [o_sv_dur_value_fld floatValue];
config_PutFloat( p_intf, SUBSDELAY_CFG_FACTOR, f_factor ); config_PutFloat(p_intf, SUBSDELAY_CFG_FACTOR, f_factor);
/* Try to find an instance of subsdelay, and set its factor */ /* Try to find an instance of subsdelay, and set its factor */
vlc_object_t *p_obj = ( vlc_object_t * ) vlc_object_find_name( p_intf->p_libvlc, "subsdelay" ); vlc_object_t *p_obj = (vlc_object_t *) vlc_object_find_name(p_intf->p_libvlc, "subsdelay");
if( p_obj ) if (p_obj) {
{ var_SetFloat(p_obj, SUBSDELAY_CFG_FACTOR, f_factor);
var_SetFloat( p_obj, SUBSDELAY_CFG_FACTOR, f_factor ); vlc_object_release(p_obj);
vlc_object_release( p_obj );
} }
[[VLCVideoEffects sharedInstance] setVideoFilter: "subsdelay" on: f_factor > 0]; [[VLCVideoEffects sharedInstance] setVideoFilter: "subsdelay" on: f_factor > 0];
vlc_object_release( p_input ); vlc_object_release(p_input);
} }
} }
......
...@@ -28,7 +28,8 @@ ...@@ -28,7 +28,8 @@
@class VLCDialogGridView; @class VLCDialogGridView;
@interface VLCDialogButton : NSButton { @interface VLCDialogButton : NSButton
{
extension_widget_t *widget; extension_widget_t *widget;
} }
...@@ -36,7 +37,8 @@ ...@@ -36,7 +37,8 @@
@end @end
@interface VLCDialogPopUpButton : NSPopUpButton { @interface VLCDialogPopUpButton : NSPopUpButton
{
extension_widget_t *widget; extension_widget_t *widget;
} }
...@@ -44,7 +46,8 @@ ...@@ -44,7 +46,8 @@
@end @end
@interface VLCDialogTextField : NSTextField { @interface VLCDialogTextField : NSTextField
{
extension_widget_t *widget; extension_widget_t *widget;
} }
...@@ -52,7 +55,8 @@ ...@@ -52,7 +55,8 @@
@end @end
@interface VLCDialogWindow : NSWindow { @interface VLCDialogWindow : NSWindow
{
extension_dialog_t *dialog; extension_dialog_t *dialog;
BOOL has_lock; BOOL has_lock;
} }
...@@ -62,7 +66,8 @@ ...@@ -62,7 +66,8 @@
@end @end
@interface VLCDialogList : NSTableView <NSTableViewDataSource> { @interface VLCDialogList : NSTableView <NSTableViewDataSource>
{
extension_widget_t *widget; extension_widget_t *widget;
NSMutableArray *contentArray; NSMutableArray *contentArray;
} }
...@@ -72,7 +77,8 @@ ...@@ -72,7 +77,8 @@
@end @end
@interface VLCDialogGridView : NSView { @interface VLCDialogGridView : NSView
{
NSUInteger _rowCount, _colCount; NSUInteger _rowCount, _colCount;
NSMutableArray *_griddedViews; NSMutableArray *_griddedViews;
} }
......
...@@ -72,8 +72,7 @@ ...@@ -72,8 +72,7 @@
- (id)init - (id)init
{ {
if ((self = [super init])) if ((self = [super init])) {
{
_colCount = 0; _colCount = 0;
_rowCount = 0; _rowCount = 0;
_griddedViews = [[NSMutableArray alloc] init]; _griddedViews = [[NSMutableArray alloc] init];
...@@ -91,8 +90,7 @@ ...@@ -91,8 +90,7 @@
{ {
_colCount = 0; _colCount = 0;
_rowCount = 0; _rowCount = 0;
for (NSDictionary *obj in _griddedViews) for (NSDictionary *obj in _griddedViews) {
{
NSUInteger row = [[obj objectForKey:@"row"] intValue]; NSUInteger row = [[obj objectForKey:@"row"] intValue];
NSUInteger col = [[obj objectForKey:@"col"] intValue]; NSUInteger col = [[obj objectForKey:@"col"] intValue];
if (col + 1 > _colCount) if (col + 1 > _colCount)
...@@ -189,9 +187,8 @@ ...@@ -189,9 +187,8 @@
{ {
CGFloat top = [self marginY]; CGFloat top = [self marginY];
for (NSUInteger i = 1; i < _rowCount - targetRow; i++) for (NSUInteger i = 1; i < _rowCount - targetRow; i++)
{
top += [self heightOfRow:_rowCount - i] + [self marginY]; top += [self heightOfRow:_rowCount - i] + [self marginY];
}
return top; return top;
} }
...@@ -247,8 +244,7 @@ ...@@ -247,8 +244,7 @@
- (CGFloat)leftOfColumn:(NSUInteger)targetColumn - (CGFloat)leftOfColumn:(NSUInteger)targetColumn
{ {
CGFloat left = [self marginX]; CGFloat left = [self marginX];
for (NSUInteger i = 0; i < targetColumn; i++) for (NSUInteger i = 0; i < targetColumn; i++) {
{
left += [self widthOfColumn:i] + [self marginX]; left += [self widthOfColumn:i] + [self marginX];
} }
return left; return left;
......
This diff is collapsed.
...@@ -43,18 +43,18 @@ ...@@ -43,18 +43,18 @@
/***************************************************************************** /*****************************************************************************
* DeviceCallback: Callback triggered when the video-device variable is changed * DeviceCallback: Callback triggered when the video-device variable is changed
*****************************************************************************/ *****************************************************************************/
int DeviceCallback( vlc_object_t *p_this, const char *psz_variable, int DeviceCallback(vlc_object_t *p_this, const char *psz_variable,
vlc_value_t old_val, vlc_value_t new_val, void *param ) vlc_value_t old_val, vlc_value_t new_val, void *param)
{ {
vlc_value_t val; vlc_value_t val;
vout_thread_t *p_vout = (vout_thread_t *)p_this; vout_thread_t *p_vout = (vout_thread_t *)p_this;
msg_Dbg( p_vout, "set %"PRId64, new_val.i_int ); msg_Dbg(p_vout, "set %"PRId64, new_val.i_int);
var_Create( p_vout->p_libvlc, "video-device", VLC_VAR_INTEGER ); var_Create(p_vout->p_libvlc, "video-device", VLC_VAR_INTEGER);
var_Set( p_vout->p_libvlc, "video-device", new_val ); var_Set(p_vout->p_libvlc, "video-device", new_val);
val.b_bool = true; val.b_bool = true;
var_Set( p_vout, "intf-change", val ); var_Set(p_vout, "intf-change", val);
return VLC_SUCCESS; return VLC_SUCCESS;
} }
...@@ -111,10 +111,10 @@ int DeviceCallback( vlc_object_t *p_this, const char *psz_variable, ...@@ -111,10 +111,10 @@ int DeviceCallback( vlc_object_t *p_this, const char *psz_variable,
- (void)closeVout - (void)closeVout
{ {
vout_thread_t * p_vout = getVout(); vout_thread_t * p_vout = getVout();
if( p_vout ) if (p_vout)
{ {
var_DelCallback( p_vout, "video-device", DeviceCallback, NULL ); var_DelCallback(p_vout, "video-device", DeviceCallback, NULL);
vlc_object_release( p_vout ); vlc_object_release(p_vout);
} }
} }
...@@ -133,50 +133,43 @@ int DeviceCallback( vlc_object_t *p_this, const char *psz_variable, ...@@ -133,50 +133,43 @@ int DeviceCallback( vlc_object_t *p_this, const char *psz_variable,
i_pressed_modifiers = [o_event modifierFlags]; i_pressed_modifiers = [o_event modifierFlags];
if( i_pressed_modifiers & NSShiftKeyMask ) if (i_pressed_modifiers & NSShiftKeyMask)
val.i_int |= KEY_MODIFIER_SHIFT; val.i_int |= KEY_MODIFIER_SHIFT;
if( i_pressed_modifiers & NSControlKeyMask ) if (i_pressed_modifiers & NSControlKeyMask)
val.i_int |= KEY_MODIFIER_CTRL; val.i_int |= KEY_MODIFIER_CTRL;
if( i_pressed_modifiers & NSAlternateKeyMask ) if (i_pressed_modifiers & NSAlternateKeyMask)
val.i_int |= KEY_MODIFIER_ALT; val.i_int |= KEY_MODIFIER_ALT;
if( i_pressed_modifiers & NSCommandKeyMask ) if (i_pressed_modifiers & NSCommandKeyMask)
val.i_int |= KEY_MODIFIER_COMMAND; val.i_int |= KEY_MODIFIER_COMMAND;
NSString * characters = [o_event charactersIgnoringModifiers]; NSString * characters = [o_event charactersIgnoringModifiers];
if ([characters length] > 0) if ([characters length] > 0) {
{
key = [[characters lowercaseString] characterAtIndex: 0]; key = [[characters lowercaseString] characterAtIndex: 0];
if( key ) if (key) {
{
vout_thread_t * p_vout = getVout(); vout_thread_t * p_vout = getVout();
/* Escape should always get you out of fullscreen */ /* Escape should always get you out of fullscreen */
if( key == (unichar) 0x1b ) if (key == (unichar) 0x1b) {
{ playlist_t * p_playlist = pl_Get(VLCIntf);
playlist_t * p_playlist = pl_Get( VLCIntf ); if (var_GetBool(p_playlist, "fullscreen"))
if( var_GetBool( p_playlist, "fullscreen") )
[[VLCCoreInteraction sharedInstance] toggleFullscreen]; [[VLCCoreInteraction sharedInstance] toggleFullscreen];
} }
/* handle Lion's default key combo for fullscreen-toggle in addition to our own hotkeys */ /* handle Lion's default key combo for fullscreen-toggle in addition to our own hotkeys */
else if( key == 'f' && i_pressed_modifiers & NSControlKeyMask && i_pressed_modifiers & NSCommandKeyMask ) else if (key == 'f' && i_pressed_modifiers & NSControlKeyMask && i_pressed_modifiers & NSCommandKeyMask)
[[VLCCoreInteraction sharedInstance] toggleFullscreen]; [[VLCCoreInteraction sharedInstance] toggleFullscreen];
else if ( p_vout ) else if (p_vout) {
{ if (key == ' ')
if( key == ' ' )
{
[[VLCCoreInteraction sharedInstance] play]; [[VLCCoreInteraction sharedInstance] play];
} else {
else val.i_int |= (int)CocoaKeyToVLC(key);
{ var_Set(p_vout->p_libvlc, "key-pressed", val);
val.i_int |= (int)CocoaKeyToVLC( key );
var_Set( p_vout->p_libvlc, "key-pressed", val );
} }
} }
else else
msg_Dbg( VLCIntf, "could not send keyevent to VLC core" ); msg_Dbg(VLCIntf, "could not send keyevent to VLC core");
if (p_vout) if (p_vout)
vlc_object_release( p_vout ); vlc_object_release(p_vout);
return; return;
} }
...@@ -191,28 +184,20 @@ int DeviceCallback( vlc_object_t *p_this, const char *psz_variable, ...@@ -191,28 +184,20 @@ int DeviceCallback( vlc_object_t *p_this, const char *psz_variable,
- (void)mouseDown:(NSEvent *)o_event - (void)mouseDown:(NSEvent *)o_event
{ {
if( ( [o_event type] == NSLeftMouseDown ) && if (([o_event type] == NSLeftMouseDown) && (! ([o_event modifierFlags] & NSControlKeyMask))) {
( ! ( [o_event modifierFlags] & NSControlKeyMask ) ) ) if ([o_event clickCount] > 1)
{
if( [o_event clickCount] > 1 )
{
/* multiple clicking */
[[VLCCoreInteraction sharedInstance] toggleFullscreen]; [[VLCCoreInteraction sharedInstance] toggleFullscreen];
} } else if (([o_event type] == NSRightMouseDown) ||
} (([o_event type] == NSLeftMouseDown) &&
else if( ( [o_event type] == NSRightMouseDown ) || ([o_event modifierFlags] & NSControlKeyMask)))
( ( [o_event type] == NSLeftMouseDown ) &&
( [o_event modifierFlags] & NSControlKeyMask ) ) )
{
[NSMenu popUpContextMenu: [[VLCMainMenu sharedInstance] voutMenu] withEvent: o_event forView: self]; [NSMenu popUpContextMenu: [[VLCMainMenu sharedInstance] voutMenu] withEvent: o_event forView: self];
}
[super mouseDown: o_event]; [super mouseDown: o_event];
} }
- (void)rightMouseDown:(NSEvent *)o_event - (void)rightMouseDown:(NSEvent *)o_event
{ {
if( [o_event type] == NSRightMouseDown ) if ([o_event type] == NSRightMouseDown)
[NSMenu popUpContextMenu: [[VLCMainMenu sharedInstance] voutMenu] withEvent: o_event forView: self]; [NSMenu popUpContextMenu: [[VLCMainMenu sharedInstance] voutMenu] withEvent: o_event forView: self];
[super mouseDown: o_event]; [super mouseDown: o_event];
...@@ -220,7 +205,7 @@ int DeviceCallback( vlc_object_t *p_this, const char *psz_variable, ...@@ -220,7 +205,7 @@ int DeviceCallback( vlc_object_t *p_this, const char *psz_variable,
- (void)rightMouseUp:(NSEvent *)o_event - (void)rightMouseUp:(NSEvent *)o_event
{ {
if( [o_event type] == NSRightMouseUp ) if ([o_event type] == NSRightMouseUp)
[NSMenu popUpContextMenu: [[VLCMainMenu sharedInstance] voutMenu] withEvent: o_event forView: self]; [NSMenu popUpContextMenu: [[VLCMainMenu sharedInstance] voutMenu] withEvent: o_event forView: self];
[super mouseUp: o_event]; [super mouseUp: o_event];
...@@ -229,7 +214,7 @@ int DeviceCallback( vlc_object_t *p_this, const char *psz_variable, ...@@ -229,7 +214,7 @@ int DeviceCallback( vlc_object_t *p_this, const char *psz_variable,
- (void)mouseMoved:(NSEvent *)o_event - (void)mouseMoved:(NSEvent *)o_event
{ {
NSPoint ml = [self convertPoint: [o_event locationInWindow] fromView: nil]; NSPoint ml = [self convertPoint: [o_event locationInWindow] fromView: nil];
if( [self mouse: ml inRect: [self bounds]] ) if ([self mouse: ml inRect: [self bounds]])
[[VLCMain sharedInstance] showFullscreenController]; [[VLCMain sharedInstance] showFullscreenController];
[super mouseMoved: o_event]; [super mouseMoved: o_event];
...@@ -270,8 +255,7 @@ int DeviceCallback( vlc_object_t *p_this, const char *psz_variable, ...@@ -270,8 +255,7 @@ int DeviceCallback( vlc_object_t *p_this, const char *psz_variable,
CGFloat f_threshold = 0.3; CGFloat f_threshold = 0.3;
BOOL b_fullscreen = [[VLCMainWindow sharedInstance] fullscreen]; BOOL b_fullscreen = [[VLCMainWindow sharedInstance] fullscreen];
if( ( f_cumulated_magnification > f_threshold && !b_fullscreen ) || ( f_cumulated_magnification < -f_threshold && b_fullscreen ) ) if ((f_cumulated_magnification > f_threshold && !b_fullscreen) || (f_cumulated_magnification < -f_threshold && b_fullscreen)) {
{
f_cumulated_magnification = 0.0; f_cumulated_magnification = 0.0;
[[VLCCoreInteraction sharedInstance] toggleFullscreen]; [[VLCCoreInteraction sharedInstance] toggleFullscreen];
} }
......
...@@ -53,11 +53,10 @@ static VLAboutBox *_o_sharedInstance = nil; ...@@ -53,11 +53,10 @@ static VLAboutBox *_o_sharedInstance = nil;
- (id)init - (id)init
{ {
if (_o_sharedInstance) { if (_o_sharedInstance)
[self dealloc]; [self dealloc];
} else { else
_o_sharedInstance = [super init]; _o_sharedInstance = [super init];
}
return _o_sharedInstance; return _o_sharedInstance;
} }
...@@ -85,8 +84,7 @@ static VLAboutBox *_o_sharedInstance = nil; ...@@ -85,8 +84,7 @@ static VLAboutBox *_o_sharedInstance = nil;
- (void)showAbout - (void)showAbout
{ {
if(! b_isSetUp ) if (! b_isSetUp) {
{
/* Get the localized info dictionary (InfoPlist.strings) */ /* Get the localized info dictionary (InfoPlist.strings) */
NSDictionary *o_local_dict; NSDictionary *o_local_dict;
o_local_dict = [[NSBundle mainBundle] localizedInfoDictionary]; o_local_dict = [[NSBundle mainBundle] localizedInfoDictionary];
...@@ -113,8 +111,7 @@ static VLAboutBox *_o_sharedInstance = nil; ...@@ -113,8 +111,7 @@ static VLAboutBox *_o_sharedInstance = nil;
NSMutableArray *tmpArray = [NSMutableArray arrayWithArray: [[NSString stringWithUTF8String: psz_authors]componentsSeparatedByString:@"\n\n"]]; NSMutableArray *tmpArray = [NSMutableArray arrayWithArray: [[NSString stringWithUTF8String: psz_authors]componentsSeparatedByString:@"\n\n"]];
NSUInteger count = [tmpArray count]; NSUInteger count = [tmpArray count];
for( NSUInteger i = 0; i < count; i++ ) for (NSUInteger i = 0; i < count; i++) {
{
[tmpArray replaceObjectAtIndex:i withObject:[[tmpArray objectAtIndex:i]stringByReplacingOccurrencesOfString:@"\n" withString:@", "]]; [tmpArray replaceObjectAtIndex:i withObject:[[tmpArray objectAtIndex:i]stringByReplacingOccurrencesOfString:@"\n" withString:@", "]];
[tmpArray replaceObjectAtIndex:i withObject:[[tmpArray objectAtIndex:i]stringByReplacingOccurrencesOfString:@", -" withString:@"\n-" options:0 range:NSRangeFromString(@"0 30")]]; [tmpArray replaceObjectAtIndex:i withObject:[[tmpArray objectAtIndex:i]stringByReplacingOccurrencesOfString:@", -" withString:@"\n-" options:0 range:NSRangeFromString(@"0 30")]];
[tmpArray replaceObjectAtIndex:i withObject:[[tmpArray objectAtIndex:i]stringByReplacingOccurrencesOfString:@"-, " withString:@"-\n" options:0 range:NSRangeFromString(@"0 30")]]; [tmpArray replaceObjectAtIndex:i withObject:[[tmpArray objectAtIndex:i]stringByReplacingOccurrencesOfString:@"-, " withString:@"-\n" options:0 range:NSRangeFromString(@"0 30")]];
...@@ -141,7 +138,7 @@ static VLAboutBox *_o_sharedInstance = nil; ...@@ -141,7 +138,7 @@ static VLAboutBox *_o_sharedInstance = nil;
/* Show the window */ /* Show the window */
b_restart = YES; b_restart = YES;
[o_credits_textview scrollPoint:NSMakePoint( 0, 0 )]; [o_credits_textview scrollPoint:NSMakePoint(0, 0)];
[o_about_window makeKeyAndOrderFront: nil]; [o_about_window makeKeyAndOrderFront: nil];
} }
...@@ -161,8 +158,7 @@ static VLAboutBox *_o_sharedInstance = nil; ...@@ -161,8 +158,7 @@ static VLAboutBox *_o_sharedInstance = nil;
- (void)scrollCredits:(NSTimer *)timer - (void)scrollCredits:(NSTimer *)timer
{ {
if( b_restart ) if (b_restart) {
{
/* Reset the starttime */ /* Reset the starttime */
i_start = [NSDate timeIntervalSinceReferenceDate] + 4.0; i_start = [NSDate timeIntervalSinceReferenceDate] + 4.0;
f_current = 0; f_current = 0;
...@@ -170,24 +166,20 @@ static VLAboutBox *_o_sharedInstance = nil; ...@@ -170,24 +166,20 @@ static VLAboutBox *_o_sharedInstance = nil;
b_restart = NO; b_restart = NO;
} }
if( [NSDate timeIntervalSinceReferenceDate] >= i_start ) if ([NSDate timeIntervalSinceReferenceDate] >= i_start) {
{
/* Increment the scroll position */ /* Increment the scroll position */
f_current += 0.005; f_current += 0.005;
/* Scroll to the position */ /* Scroll to the position */
[o_credits_textview scrollPoint:NSMakePoint( 0, f_current )]; [o_credits_textview scrollPoint:NSMakePoint(0, f_current)];
/* If at end, restart at the top */ /* If at end, restart at the top */
if( f_current >= f_end ) if (f_current >= f_end) {
{
/* f_end may be wrong on first run, so don't trust it too much */ /* f_end may be wrong on first run, so don't trust it too much */
if( f_end == [o_credits_textview bounds].size.height - [o_credits_scrollview bounds].size.height ) if (f_end == [o_credits_textview bounds].size.height - [o_credits_scrollview bounds].size.height) {
{
b_restart = YES; b_restart = YES;
[o_credits_textview scrollPoint:NSMakePoint( 0, 0 )]; [o_credits_textview scrollPoint:NSMakePoint(0, 0)];
} } else
else
f_end = [o_credits_textview bounds].size.height - [o_credits_scrollview bounds].size.height; f_end = [o_credits_textview bounds].size.height - [o_credits_scrollview bounds].size.height;
} }
} }
......
...@@ -39,30 +39,30 @@ ...@@ -39,30 +39,30 @@
NSString *o_command = [[self commandDescription] commandName]; NSString *o_command = [[self commandDescription] commandName];
NSString *o_urlString = [self directParameter]; NSString *o_urlString = [self directParameter];
if ( [o_command isEqualToString:@"GetURL"] || [o_command isEqualToString:@"OpenURL"] ) { if ([o_command isEqualToString:@"GetURL"] || [o_command isEqualToString:@"OpenURL"]) {
intf_thread_t * p_intf = VLCIntf; intf_thread_t * p_intf = VLCIntf;
playlist_t * p_playlist = pl_Get( p_intf ); playlist_t * p_playlist = pl_Get(p_intf);
if ( o_urlString ) { if (o_urlString) {
NSURL * o_url; NSURL * o_url;
input_item_t *p_input; input_item_t *p_input;
int returnValue; int returnValue;
p_input = input_item_New( [o_urlString fileSystemRepresentation], p_input = input_item_New([o_urlString fileSystemRepresentation],
[[[NSFileManager defaultManager] [[[NSFileManager defaultManager]
displayNameAtPath: o_urlString] UTF8String] ); displayNameAtPath: o_urlString] UTF8String]);
if (!p_input) if (!p_input)
return nil; return nil;
returnValue = playlist_AddInput( p_playlist, p_input, PLAYLIST_INSERT, returnValue = playlist_AddInput(p_playlist, p_input, PLAYLIST_INSERT,
PLAYLIST_END, true, pl_Unlocked ); PLAYLIST_END, true, pl_Unlocked);
vlc_gc_decref( p_input ); vlc_gc_decref(p_input);
if (returnValue != VLC_SUCCESS) if (returnValue != VLC_SUCCESS)
return nil; return nil;
o_url = [NSURL fileURLWithPath: o_urlString]; o_url = [NSURL fileURLWithPath: o_urlString];
if( o_url != nil ) if (o_url != nil)
[[NSDocumentController sharedDocumentController] noteNewRecentDocumentURL: o_url]; [[NSDocumentController sharedDocumentController] noteNewRecentDocumentURL: o_url];
} }
} }
...@@ -86,25 +86,25 @@ ...@@ -86,25 +86,25 @@
NSString *o_parameter = [self directParameter]; NSString *o_parameter = [self directParameter];
intf_thread_t * p_intf = VLCIntf; intf_thread_t * p_intf = VLCIntf;
playlist_t * p_playlist = pl_Get( p_intf ); playlist_t * p_playlist = pl_Get(p_intf);
if ( [o_command isEqualToString:@"play"] ) if ([o_command isEqualToString:@"play"])
[[VLCCoreInteraction sharedInstance] play]; [[VLCCoreInteraction sharedInstance] play];
else if ( [o_command isEqualToString:@"stop"] ) else if ([o_command isEqualToString:@"stop"])
[[VLCCoreInteraction sharedInstance] stop]; [[VLCCoreInteraction sharedInstance] stop];
else if ( [o_command isEqualToString:@"previous"] ) else if ([o_command isEqualToString:@"previous"])
[[VLCCoreInteraction sharedInstance] previous]; [[VLCCoreInteraction sharedInstance] previous];
else if ( [o_command isEqualToString:@"next"] ) else if ([o_command isEqualToString:@"next"])
[[VLCCoreInteraction sharedInstance] next]; [[VLCCoreInteraction sharedInstance] next];
else if ( [o_command isEqualToString:@"fullscreen"] ) else if ([o_command isEqualToString:@"fullscreen"])
[[VLCCoreInteraction sharedInstance] toggleFullscreen]; [[VLCCoreInteraction sharedInstance] toggleFullscreen];
else if ( [o_command isEqualToString:@"mute"] ) else if ([o_command isEqualToString:@"mute"])
[[VLCCoreInteraction sharedInstance] setMute: YES]; [[VLCCoreInteraction sharedInstance] setMute: YES];
else if ( [o_command isEqualToString:@"volumeUp"] ) else if ([o_command isEqualToString:@"volumeUp"])
[[VLCCoreInteraction sharedInstance] volumeUp]; [[VLCCoreInteraction sharedInstance] volumeUp];
else if ( [o_command isEqualToString:@"volumeDown"] ) else if ([o_command isEqualToString:@"volumeDown"])
[[VLCCoreInteraction sharedInstance] volumeDown]; [[VLCCoreInteraction sharedInstance] volumeDown];
else if ( [o_command isEqualToString:@"stepForward"] ) { else if ([o_command isEqualToString:@"stepForward"]) {
//default: forwardShort //default: forwardShort
if (o_parameter) { if (o_parameter) {
int i_parameter = [o_parameter intValue]; int i_parameter = [o_parameter intValue];
...@@ -127,7 +127,7 @@ ...@@ -127,7 +127,7 @@
} }
} else } else
[[VLCCoreInteraction sharedInstance] forwardShort]; [[VLCCoreInteraction sharedInstance] forwardShort];
} else if ( [o_command isEqualToString:@"stepBackward"] ) { } else if ([o_command isEqualToString:@"stepBackward"]) {
//default: backwardShort //default: backwardShort
if (o_parameter) { if (o_parameter) {
int i_parameter = [o_parameter intValue]; int i_parameter = [o_parameter intValue];
...@@ -161,23 +161,24 @@ ...@@ -161,23 +161,24 @@
*****************************************************************************/ *****************************************************************************/
@implementation NSApplication(ScriptSupport) @implementation NSApplication(ScriptSupport)
- (BOOL) scriptFullscreenMode { - (BOOL)scriptFullscreenMode {
vout_thread_t * p_vout = getVout(); vout_thread_t * p_vout = getVout();
if( !p_vout ) if (!p_vout)
return NO; return NO;
BOOL b_value = var_GetBool( p_vout, "fullscreen"); BOOL b_value = var_GetBool(p_vout, "fullscreen");
vlc_object_release( p_vout ); vlc_object_release(p_vout);
return b_value; return b_value;
} }
- (void) setScriptFullscreenMode: (BOOL) mode {
- (void)setScriptFullscreenMode:(BOOL)mode {
vout_thread_t * p_vout = getVout(); vout_thread_t * p_vout = getVout();
if( !p_vout ) if (!p_vout)
return; return;
if (var_GetBool( p_vout, "fullscreen") == mode) { if (var_GetBool(p_vout, "fullscreen") == mode) {
vlc_object_release( p_vout ); vlc_object_release(p_vout);
return; return;
} }
vlc_object_release( p_vout ); vlc_object_release(p_vout);
[[VLCCoreInteraction sharedInstance] toggleFullscreen]; [[VLCCoreInteraction sharedInstance] toggleFullscreen];
} }
...@@ -187,51 +188,51 @@ ...@@ -187,51 +188,51 @@
- (BOOL) playing { - (BOOL) playing {
intf_thread_t *p_intf = VLCIntf; intf_thread_t *p_intf = VLCIntf;
if( !p_intf ) if (!p_intf)
return NO; return NO;
input_thread_t * p_input = pl_CurrentInput( p_intf ); input_thread_t * p_input = pl_CurrentInput(p_intf);
if( !p_input ) if (!p_input)
return NO; return NO;
input_state_e i_state = ERROR_S; input_state_e i_state = ERROR_S;
input_Control( p_input, INPUT_GET_STATE, &i_state ); input_Control(p_input, INPUT_GET_STATE, &i_state);
vlc_object_release( p_input ); vlc_object_release(p_input);
return ( ( i_state == OPENING_S ) || ( i_state == PLAYING_S ) ); return ((i_state == OPENING_S) || (i_state == PLAYING_S));
} }
- (int) audioVolume { - (int) audioVolume {
return ( [[VLCCoreInteraction sharedInstance] volume] ); return ([[VLCCoreInteraction sharedInstance] volume]);
} }
- (void) setAudioVolume: (int) i_audioVolume { - (void) setAudioVolume:(int)i_audioVolume {
[[VLCCoreInteraction sharedInstance] setVolume:(int)i_audioVolume]; [[VLCCoreInteraction sharedInstance] setVolume:(int)i_audioVolume];
} }
- (int) currentTime { - (int) currentTime {
input_thread_t * p_input = pl_CurrentInput( VLCIntf ); input_thread_t * p_input = pl_CurrentInput(VLCIntf);
int64_t i_currentTime = -1; int64_t i_currentTime = -1;
if( !p_input ) if (!p_input)
return i_currentTime; return i_currentTime;
input_Control( p_input, INPUT_GET_TIME, &i_currentTime ); input_Control(p_input, INPUT_GET_TIME, &i_currentTime);
vlc_object_release( p_input ); vlc_object_release(p_input);
return (int)( i_currentTime / 1000000 ); return (int)(i_currentTime / 1000000);
} }
- (void) setCurrentTime: (int) i_currentTime { - (void) setCurrentTime:(int)i_currentTime {
if (i_currentTime) { if (i_currentTime) {
int64_t i64_value = (int64_t)i_currentTime; int64_t i64_value = (int64_t)i_currentTime;
input_thread_t * p_input = pl_CurrentInput( VLCIntf ); input_thread_t * p_input = pl_CurrentInput(VLCIntf);
if ( !p_input ) if (!p_input)
return; return;
input_Control( p_input, INPUT_SET_TIME, (int64_t)(i64_value * 1000000) ); input_Control(p_input, INPUT_SET_TIME, (int64_t)(i64_value * 1000000));
vlc_object_release( p_input ); vlc_object_release(p_input);
} }
} }
......
This diff is collapsed.
This diff is collapsed.
...@@ -43,10 +43,9 @@ static VLCCoreDialogProvider *_o_sharedInstance = nil; ...@@ -43,10 +43,9 @@ static VLCCoreDialogProvider *_o_sharedInstance = nil;
-(id)init -(id)init
{ {
if( _o_sharedInstance ) if (_o_sharedInstance)
[self dealloc]; [self dealloc];
else else {
{
_o_sharedInstance = [super init]; _o_sharedInstance = [super init];
o_error_panel = [[VLCErrorPanel alloc] init]; o_error_panel = [[VLCErrorPanel alloc] init];
b_progress_cancelled = NO; b_progress_cancelled = NO;
...@@ -70,18 +69,18 @@ static VLCCoreDialogProvider *_o_sharedInstance = nil; ...@@ -70,18 +69,18 @@ static VLCCoreDialogProvider *_o_sharedInstance = nil;
{ {
NSString *o_type = [NSString stringWithUTF8String:type]; NSString *o_type = [NSString stringWithUTF8String:type];
if( [o_type isEqualToString: @"dialog-error"] ) if ([o_type isEqualToString: @"dialog-error"])
[self performSelectorOnMainThread:@selector(showFatalDialog:) withObject:o_value waitUntilDone:YES]; [self performSelectorOnMainThread:@selector(showFatalDialog:) withObject:o_value waitUntilDone:YES];
else if( [o_type isEqualToString: @"dialog-critical"] ) else if ([o_type isEqualToString: @"dialog-critical"])
[self performSelectorOnMainThread:@selector(showFatalWaitDialog:) withObject:o_value waitUntilDone:YES]; [self performSelectorOnMainThread:@selector(showFatalWaitDialog:) withObject:o_value waitUntilDone:YES];
else if( [o_type isEqualToString: @"dialog-question"] ) else if ([o_type isEqualToString: @"dialog-question"])
[self performSelectorOnMainThread:@selector(showQuestionDialog:) withObject:o_value waitUntilDone:YES]; [self performSelectorOnMainThread:@selector(showQuestionDialog:) withObject:o_value waitUntilDone:YES];
else if( [o_type isEqualToString: @"dialog-login"] ) else if ([o_type isEqualToString: @"dialog-login"])
[self performSelectorOnMainThread:@selector(showLoginDialog:) withObject:o_value waitUntilDone:YES]; [self performSelectorOnMainThread:@selector(showLoginDialog:) withObject:o_value waitUntilDone:YES];
else if( [o_type isEqualToString: @"dialog-progress-bar"] ) else if ([o_type isEqualToString: @"dialog-progress-bar"])
[self performSelectorOnMainThread:@selector(showProgressDialogOnMainThread:) withObject: o_value waitUntilDone:YES]; [self performSelectorOnMainThread:@selector(showProgressDialogOnMainThread:) withObject: o_value waitUntilDone:YES];
else else
msg_Err( VLCIntf, "unhandled dialog type: '%s'", type ); msg_Err(VLCIntf, "unhandled dialog type: '%s'", type);
} }
-(void)showFatalDialog: (NSValue *)o_value -(void)showFatalDialog: (NSValue *)o_value
...@@ -109,22 +108,22 @@ static VLCCoreDialogProvider *_o_sharedInstance = nil; ...@@ -109,22 +108,22 @@ static VLCCoreDialogProvider *_o_sharedInstance = nil;
NSString *o_yes, *o_no, *o_cancel; NSString *o_yes, *o_no, *o_cancel;
NSInteger i_returnValue = 0; NSInteger i_returnValue = 0;
if( p_dialog->yes != NULL ) if (p_dialog->yes != NULL)
o_yes = [NSString stringWithUTF8String: p_dialog->yes]; o_yes = [NSString stringWithUTF8String: p_dialog->yes];
if( p_dialog->no != NULL ) if (p_dialog->no != NULL)
o_no = [NSString stringWithUTF8String: p_dialog->no]; o_no = [NSString stringWithUTF8String: p_dialog->no];
if( p_dialog->cancel != NULL ) if (p_dialog->cancel != NULL)
o_cancel = [NSString stringWithUTF8String: p_dialog->cancel]; o_cancel = [NSString stringWithUTF8String: p_dialog->cancel];
o_alert = [NSAlert alertWithMessageText: [NSString stringWithUTF8String: p_dialog->title] defaultButton: o_yes alternateButton:o_no otherButton: o_cancel informativeTextWithFormat: @"%s", p_dialog->message]; o_alert = [NSAlert alertWithMessageText: [NSString stringWithUTF8String: p_dialog->title] defaultButton: o_yes alternateButton:o_no otherButton: o_cancel informativeTextWithFormat: @"%s", p_dialog->message];
[o_alert setAlertStyle: NSInformationalAlertStyle]; [o_alert setAlertStyle: NSInformationalAlertStyle];
i_returnValue = [o_alert runModal]; i_returnValue = [o_alert runModal];
if( i_returnValue == NSAlertDefaultReturn ) if (i_returnValue == NSAlertDefaultReturn)
p_dialog->answer = 1; p_dialog->answer = 1;
if( i_returnValue == NSAlertAlternateReturn ) if (i_returnValue == NSAlertAlternateReturn)
p_dialog->answer = 2; p_dialog->answer = 2;
if( i_returnValue == NSAlertOtherReturn ) if (i_returnValue == NSAlertOtherReturn)
p_dialog->answer = 3; p_dialog->answer = 3;
} }
...@@ -142,20 +141,17 @@ static VLCCoreDialogProvider *_o_sharedInstance = nil; ...@@ -142,20 +141,17 @@ static VLCCoreDialogProvider *_o_sharedInstance = nil;
[o_auth_win center]; [o_auth_win center];
i_returnValue = [NSApp runModalForWindow: o_auth_win]; i_returnValue = [NSApp runModalForWindow: o_auth_win];
[o_auth_win close]; [o_auth_win close];
if( i_returnValue ) if (i_returnValue)
{
*p_dialog->username = strdup( [[o_auth_login_fld stringValue] UTF8String] );
*p_dialog->password = strdup( [[o_auth_pw_fld stringValue] UTF8String] );
}
else
{ {
*p_dialog->username = *p_dialog->password = NULL; *p_dialog->username = strdup([[o_auth_login_fld stringValue] UTF8String]);
} *p_dialog->password = strdup([[o_auth_pw_fld stringValue] UTF8String]);
} else
*p_dialog->username = *p_dialog->password = NULL;
} }
-(IBAction)loginDialogAction:(id)sender -(IBAction)loginDialogAction:(id)sender
{ {
if( [[sender title] isEqualToString: _NS("OK")] ) if ([[sender title] isEqualToString: _NS("OK")])
[NSApp stopModalWithCode: 1]; [NSApp stopModalWithCode: 1];
else else
[NSApp stopModalWithCode: 0]; [NSApp stopModalWithCode: 0];
...@@ -172,21 +168,19 @@ static VLCCoreDialogProvider *_o_sharedInstance = nil; ...@@ -172,21 +168,19 @@ static VLCCoreDialogProvider *_o_sharedInstance = nil;
if (!p_dialog || b_progress_cancelled) if (!p_dialog || b_progress_cancelled)
return; return;
if( p_dialog->title != NULL ) if (p_dialog->title != NULL)
{ {
[o_prog_win setTitle: [NSString stringWithUTF8String: p_dialog->title]]; [o_prog_win setTitle: [NSString stringWithUTF8String: p_dialog->title]];
[o_prog_title_txt setStringValue: [NSString stringWithUTF8String: p_dialog->title]]; [o_prog_title_txt setStringValue: [NSString stringWithUTF8String: p_dialog->title]];
} } else {
else
{
[o_prog_win setTitle: @""]; [o_prog_win setTitle: @""];
[o_prog_title_txt setStringValue: @""]; [o_prog_title_txt setStringValue: @""];
} }
if( p_dialog->cancel != NULL ) if (p_dialog->cancel != NULL)
[o_prog_cancel_btn setTitle: [NSString stringWithUTF8String: p_dialog->cancel]]; [o_prog_cancel_btn setTitle: [NSString stringWithUTF8String: p_dialog->cancel]];
else else
[o_prog_cancel_btn setTitle: _NS("Cancel")]; [o_prog_cancel_btn setTitle: _NS("Cancel")];
if( p_dialog->message != NULL ) if (p_dialog->message != NULL)
[o_prog_description_txt setStringValue: [NSString stringWithUTF8String: p_dialog->message]]; [o_prog_description_txt setStringValue: [NSString stringWithUTF8String: p_dialog->message]];
else else
[o_prog_description_txt setStringValue: @""]; [o_prog_description_txt setStringValue: @""];
...@@ -249,7 +243,7 @@ static VLCCoreDialogProvider *_o_sharedInstance = nil; ...@@ -249,7 +243,7 @@ static VLCCoreDialogProvider *_o_sharedInstance = nil;
{ {
[super init]; [super init];
if( !b_nib_loaded ) if (!b_nib_loaded)
b_nib_loaded = [NSBundle loadNibNamed:@"ErrorPanel" owner:self]; b_nib_loaded = [NSBundle loadNibNamed:@"ErrorPanel" owner:self];
/* init data sources */ /* init data sources */
...@@ -290,7 +284,7 @@ static VLCCoreDialogProvider *_o_sharedInstance = nil; ...@@ -290,7 +284,7 @@ static VLCCoreDialogProvider *_o_sharedInstance = nil;
[ourError [ourError
addAttribute: NSFontAttributeName addAttribute: NSFontAttributeName
value: [NSFont boldSystemFontOfSize:11] value: [NSFont boldSystemFontOfSize:11]
range: NSMakeRange( 0, [o_error length])]; range: NSMakeRange(0, [o_error length])];
[o_errors addObject: ourError]; [o_errors addObject: ourError];
[ourError release]; [ourError release];
...@@ -322,10 +316,10 @@ static VLCCoreDialogProvider *_o_sharedInstance = nil; ...@@ -322,10 +316,10 @@ static VLCCoreDialogProvider *_o_sharedInstance = nil;
- (id)tableView:(NSTableView *)theDataTable objectValueForTableColumn: - (id)tableView:(NSTableView *)theDataTable objectValueForTableColumn:
(NSTableColumn *)theTableColumn row: (NSInteger)row (NSTableColumn *)theTableColumn row: (NSInteger)row
{ {
if( [[theTableColumn identifier] isEqualToString: @"error_msg"] ) if ([[theTableColumn identifier] isEqualToString: @"error_msg"])
return [o_errors objectAtIndex: row]; return [o_errors objectAtIndex: row];
if( [[theTableColumn identifier] isEqualToString: @"icon"] ) if ([[theTableColumn identifier] isEqualToString: @"icon"])
return [o_icons objectAtIndex: row]; return [o_icons objectAtIndex: row];
return @"unknown identifier"; return @"unknown identifier";
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -313,7 +313,5 @@ ...@@ -313,7 +313,5 @@
@end @end
@interface VLCOpenTextField : NSTextField @interface VLCOpenTextField : NSTextField
{
}
- (void)mouseDown:(NSEvent *)theEvent; - (void)mouseDown:(NSEvent *)theEvent;
@end @end
This diff is collapsed.
This diff is collapsed.
...@@ -41,8 +41,6 @@ ...@@ -41,8 +41,6 @@
* VLCPlaylistView interface * VLCPlaylistView interface
*****************************************************************************/ *****************************************************************************/
@interface VLCPlaylistView : NSOutlineView @interface VLCPlaylistView : NSOutlineView
{
}
@end @end
...@@ -72,9 +70,6 @@ ...@@ -72,9 +70,6 @@
* VLCPlaylistWizard interface * VLCPlaylistWizard interface
*****************************************************************************/ *****************************************************************************/
@interface VLCPlaylistWizard : VLCPlaylistCommon @interface VLCPlaylistWizard : VLCPlaylistCommon
{
}
- (IBAction)reloadOutlineView; - (IBAction)reloadOutlineView;
@end @end
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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