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