diff --git a/ChangeLog b/ChangeLog index 91742f003..955eec5e7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,67 @@ +2005-11-16 Richard Frith-Macdonald + + * Source/GSEPSPrintOperation.m: + * Source/GSHelpManagerPanel.m: + * Source/GSHorizontalTypesetter.m: + * Source/GSLayoutManager.m: + * Source/GSNibCompatibility.m: + * Source/GSNibTemplates.m: + * Source/GSPDFPrintOperation.m: + * Source/GSPrintOperation.m: + * Source/GSPrinting.m: + * Source/GSSlideView.m: + * Source/GSTable.m: + * Source/GSToolbar.m: + * Source/NSAlert.m: + * Source/NSApplication.m: + * Source/NSBezierPath.m: + * Source/NSBitmapImageRep+PNM.m: + * Source/NSBox.m: + * Source/NSBrowser.m: + * Source/NSBrowserCell.m: + * Source/NSBundleAdditions.m: + * Source/NSCell.m: + * Source/NSColor.m: + * Source/NSColorList.m: + * Source/NSColorWell.m: + * Source/NSCustomImageRep.m: + * Source/NSDataLink.m: + * Source/NSDataLinkManager.m: + * Source/NSDataLinkPanel.m: + * Source/NSDocument.m: + * Source/NSForm.m: + * Source/NSGraphicsContext.m: + * Source/NSHelpManager.m: + * Source/NSImage.m: + * Source/NSLayoutManager.m: + * Source/NSMatrix.m: + * Source/NSNib.m: + * Source/NSOpenGLPixelFormat.m: + * Source/NSOpenGLView.m: + * Source/NSOutlineView.m: + * Source/NSPageLayout.m: + * Source/NSPrintInfo.m: + * Source/NSPrintOperation.m: + * Source/NSPrintPanel.m: + * Source/NSPrinter.m: + * Source/NSResponder.m: + * Source/NSRulerView.m: + * Source/NSSelection.m: + * Source/NSSpellChecker.m: + * Source/NSSpellServer.m: + * Source/NSSplitView.m: + * Source/NSStepper.m: + * Source/NSTabView.m: + * Source/NSTableView.m: + * Source/NSTextView.m: + * Source/NSTextView_actions.m: + * Source/NSToolbarItem.m: + * Source/NSView.m: + * Source/NSWindow.m: + * Source/NSWorkspace.m: + Fix some common coding style violations ... should have no effect + other than improving readability. + 2005-11-15 fabien * Source/NSColor.m : Improved documentation, various cleanups. diff --git a/Source/GSEPSPrintOperation.m b/Source/GSEPSPrintOperation.m index d2d2af8bf..37adffab8 100644 --- a/Source/GSEPSPrintOperation.m +++ b/Source/GSEPSPrintOperation.m @@ -73,7 +73,7 @@ [[NSProcessInfo processInfo] globallyUniqueString]]; _path = [_path stringByAppendingPathExtension: @"ps"]; - RETAIN( _path ); + RETAIN(_path); return self; } diff --git a/Source/GSHelpManagerPanel.m b/Source/GSHelpManagerPanel.m index 54f356da9..ee1cf0715 100644 --- a/Source/GSHelpManagerPanel.m +++ b/Source/GSHelpManagerPanel.m @@ -40,7 +40,7 @@ static GSHelpManagerPanel* _GSsharedGSHelpPanel; + (id) sharedHelpManagerPanel { - if(!_GSsharedGSHelpPanel) + if (!_GSsharedGSHelpPanel) _GSsharedGSHelpPanel = [[GSHelpManagerPanel alloc] init]; return _GSsharedGSHelpPanel; diff --git a/Source/GSHorizontalTypesetter.m b/Source/GSHorizontalTypesetter.m index 507fed35b..b92eca0c7 100644 --- a/Source/GSHorizontalTypesetter.m +++ b/Source/GSHorizontalTypesetter.m @@ -258,7 +258,7 @@ including gi will have been cached. if (g->g == NSControlGlyph) return gi + cache_base; ch = [str characterAtIndex: g->char_index]; - if (ch == 0x20 || ch == 0x0a || ch == 0x0d /* TODO: paragraph/line separator */ ) + if (ch == 0x20 || ch == 0x0a || ch == 0x0d /* TODO: paragraph/line separator */) { g->dont_show = YES; if (gi > 0) diff --git a/Source/GSLayoutManager.m b/Source/GSLayoutManager.m index dce3220a1..f83ce653a 100644 --- a/Source/GSLayoutManager.m +++ b/Source/GSLayoutManager.m @@ -97,7 +97,7 @@ Private method used internally by GSLayoutManager for sanity checking. r->font = [r->font retain]; } --(void ) _run_free_attributes: (glyph_run_t *)r +-(void) _run_free_attributes: (glyph_run_t *)r { [r->font release]; } diff --git a/Source/GSNibCompatibility.m b/Source/GSNibCompatibility.m index 10a56ddec..3a6f64ba0 100644 --- a/Source/GSNibCompatibility.m +++ b/Source/GSNibCompatibility.m @@ -160,7 +160,7 @@ - (id) awakeAfterUsingCoder: (NSCoder *)coder { - if([self respondsToSelector: @selector(isInInterfaceBuilder)]) + if ([self respondsToSelector: @selector(isInInterfaceBuilder)]) { // if we live in the interface builder, give them an instance of // the parent, not the child.. @@ -278,7 +278,7 @@ - (id) awakeAfterUsingCoder: (NSCoder *)coder { - if([self respondsToSelector: @selector(isInInterfaceBuilder)]) + if ([self respondsToSelector: @selector(isInInterfaceBuilder)]) { // if we live in the interface builder, give them an instance of // the parent, not the child.. @@ -374,7 +374,7 @@ - (id) awakeAfterUsingCoder: (NSCoder *)coder { - if([self respondsToSelector: @selector(isInInterfaceBuilder)]) + if ([self respondsToSelector: @selector(isInInterfaceBuilder)]) { // if we live in the interface builder, give them an instance of // the parent, not the child.. @@ -478,7 +478,7 @@ - (id) awakeAfterUsingCoder: (NSCoder *)coder { - if([self respondsToSelector: @selector(isInInterfaceBuilder)]) + if ([self respondsToSelector: @selector(isInInterfaceBuilder)]) { // if we live in the interface builder, give them an instance of // the parent, not the child.. @@ -578,7 +578,7 @@ - (id) awakeAfterUsingCoder: (NSCoder *)coder { - if([self respondsToSelector: @selector(isInInterfaceBuilder)]) + if ([self respondsToSelector: @selector(isInInterfaceBuilder)]) { // if we live in the interface builder, give them an instance of // the parent, not the child.. @@ -679,7 +679,7 @@ - (id) awakeAfterUsingCoder: (NSCoder *)coder { - if([self respondsToSelector: @selector(isInInterfaceBuilder)]) + if ([self respondsToSelector: @selector(isInInterfaceBuilder)]) { // if we live in the interface builder, give them an instance of // the parent, not the child.. @@ -719,15 +719,15 @@ [obj setContinuous: [self isContinuous]]; // since only some controls have delegates, we need to test - if([obj respondsToSelector: @selector(setDelegate:)]) + if ([obj respondsToSelector: @selector(setDelegate:)]) [obj setDelegate: _delegate]; // since only some controls have data sources, we need to test - if([obj respondsToSelector: @selector(setDataSource:)]) + if ([obj respondsToSelector: @selector(setDataSource:)]) [obj setDataSource: _dataSource]; // since only some controls have data sources, we need to test - if([obj respondsToSelector: @selector(setUsesDataSource:)]) + if ([obj respondsToSelector: @selector(setUsesDataSource:)]) [obj setUsesDataSource: _usesDataSource]; RELEASE(self); @@ -802,7 +802,7 @@ - (id) awakeAfterUsingCoder: (NSCoder *)coder { - if([self respondsToSelector: @selector(isInInterfaceBuilder)]) + if ([self respondsToSelector: @selector(isInInterfaceBuilder)]) { // if we live in the interface builder, give them an instance of // the parent, not the child.. diff --git a/Source/GSNibTemplates.m b/Source/GSNibTemplates.m index 7b2b8fa0f..6dcd36943 100644 --- a/Source/GSNibTemplates.m +++ b/Source/GSNibTemplates.m @@ -111,7 +111,7 @@ static NSString *GSInternalNibItemAddedNotification = @"_GSInternalNibItemAddedN - init { - if((self = [super init]) != nil) + if ((self = [super init]) != nil) { NSNotificationCenter *nc = [NSNotificationCenter defaultCenter]; @@ -228,7 +228,7 @@ static NSString *GSInternalNibItemAddedNotification = @"_GSInternalNibItemAddedN * file. */ obj = [context objectForKey: @"NSTopLevelObjects"]; - if([obj isKindOfClass: [NSMutableArray class]]) + if ([obj isKindOfClass: [NSMutableArray class]]) { topObjects = obj; } @@ -248,7 +248,7 @@ static NSString *GSInternalNibItemAddedNotification = @"_GSInternalNibItemAddedN if ([context objectForKey: key] == nil || [key isEqualToString: @"NSOwner"]) // we want to send the message to the owner { - if([key isEqualToString: @"NSWindowsMenu"] == NO && // we don't want to send a message to these menus twice, + if ([key isEqualToString: @"NSWindowsMenu"] == NO && // we don't want to send a message to these menus twice, [key isEqualToString: @"NSServicesMenu"] == NO && // if they're custom classes. [key isEqualToString: @"NSVisible"] == NO && // also exclude any other special parts of the nameTable. [key isEqualToString: @"NSDeferred"] == NO && @@ -276,11 +276,11 @@ static NSString *GSInternalNibItemAddedNotification = @"_GSInternalNibItemAddedN * then he will get the objects back in an array which he merely must release in * order to release the objects held within. GJC */ - if([key isEqualToString: @"NSOwner"] == NO) + if ([key isEqualToString: @"NSOwner"] == NO) { - if([topLevelObjects containsObject: o]) // anything already designated a top level item.. + if ([topLevelObjects containsObject: o]) // anything already designated a top level item.. { - if(topObjects == nil) + if (topObjects == nil) { // It is expected, if the NSTopLevelObjects key is not passed in, // that the user has opted to either allow these objects to leak or @@ -347,7 +347,7 @@ static NSString *GSInternalNibItemAddedNotification = @"_GSInternalNibItemAddedN - (void) encodeWithCoder: (NSCoder*)aCoder { int version = [GSNibContainer version]; - if(version == GNUSTEP_NIB_VERSION) + if (version == GNUSTEP_NIB_VERSION) { [aCoder encodeObject: nameTable]; [aCoder encodeObject: connections]; @@ -377,13 +377,13 @@ static NSString *GSInternalNibItemAddedNotification = @"_GSInternalNibItemAddedN int version = [aCoder versionForClassName: @"GSNibContainer"]; // save the version to the ivar, we need it later. - if(version == GNUSTEP_NIB_VERSION) + if (version == GNUSTEP_NIB_VERSION) { [aCoder decodeValueOfObjCType: @encode(id) at: &nameTable]; [aCoder decodeValueOfObjCType: @encode(id) at: &connections]; [aCoder decodeValueOfObjCType: @encode(id) at: &topLevelObjects]; } - else if(version == 0) + else if (version == 0) { GSNibItemCollector *nibitems = [[GSNibItemCollector alloc] init]; NSEnumerator *en; @@ -400,10 +400,10 @@ static NSString *GSInternalNibItemAddedNotification = @"_GSInternalNibItemAddedN // iterate through the objects returned en = [nameTable keyEnumerator]; - while((key = [en nextObject]) != nil) + while ((key = [en nextObject]) != nil) { id o = [nameTable objectForKey: key]; - if(([o isKindOfClass: [NSMenu class]] && [key isEqual: @"NSMenu"]) || + if (([o isKindOfClass: [NSMenu class]] && [key isEqual: @"NSMenu"]) || [o isKindOfClass: [NSWindow class]]) { [topLevelObjects addObject: o]; // if it's a top level object, add it. @@ -526,9 +526,9 @@ static NSString *GSInternalNibItemAddedNotification = @"_GSInternalNibItemAddedN // the set of things to be retained. Also, the initial version of the nib container // needed this code, but subsequent versions don't, so don't send the notification, // if the version isn't zero. - if(obj != nil && [aCoder versionForClassName: NSStringFromClass([GSNibContainer class])] == 0) + if (obj != nil && [aCoder versionForClassName: NSStringFromClass([GSNibContainer class])] == 0) { - if([self isKindOfClass: [GSNibItem class]] == YES && + if ([self isKindOfClass: [GSNibItem class]] == YES && [self isKindOfClass: [GSCustomView class]] == NO) { NSNotificationCenter *nc = [NSNotificationCenter defaultCenter]; @@ -595,13 +595,13 @@ static NSString *GSInternalNibItemAddedNotification = @"_GSInternalNibItemAddedN - (id) initWithObject: (id)object className: (NSString *)className superClassName: (NSString *)superClassName { - if((self = [self init]) != nil) + if ((self = [self init]) != nil) { NSDebugLog(@"Created template %@ -> %@",NSStringFromClass([self class]), className); ASSIGN(_object, object); ASSIGN(_className, className); _superClass = NSClassFromString(superClassName); - if(_superClass == nil) + if (_superClass == nil) { [NSException raise: NSInternalInconsistencyException format: @"Unable to find class '%@', it is not linked into the application.", superClassName]; @@ -612,7 +612,7 @@ static NSString *GSInternalNibItemAddedNotification = @"_GSInternalNibItemAddedN - init { - if((self = [super init]) != nil) + if ((self = [super init]) != nil) { _className = nil; _superClass = nil; @@ -642,9 +642,9 @@ static NSString *GSInternalNibItemAddedNotification = @"_GSInternalNibItemAddedN { id obj = nil; int version = [coder versionForClassName: @"GSClassSwapper"]; - if(version == 0) + if (version == 0) { - if((self = [super init]) != nil) + if ((self = [super init]) != nil) { NSUnarchiver *unarchiver = (NSUnarchiver *)coder; @@ -654,10 +654,10 @@ static NSString *GSInternalNibItemAddedNotification = @"_GSInternalNibItemAddedN // if we are living within the interface builder app, then don't try to // morph into the subclass. - if([self shouldSwapClass]) + if ([self shouldSwapClass]) { Class aClass = NSClassFromString(_className); - if(aClass == nil) + if (aClass == nil) { [NSException raise: NSInternalInconsistencyException format: @"Unable to find class '%@', it is not linked into the application.", _className]; @@ -687,7 +687,7 @@ static NSString *GSInternalNibItemAddedNotification = @"_GSInternalNibItemAddedN [aCoder encodeValueOfObjCType: @encode(id) at: &_className]; [aCoder encodeValueOfObjCType: @encode(Class) at: &_superClass]; - if(_object != nil) + if (_object != nil) { // Don't call encodeValue, the way templates are used will prevent // it from being saved correctly. Just call encodeWithCoder directly. @@ -698,7 +698,7 @@ static NSString *GSInternalNibItemAddedNotification = @"_GSInternalNibItemAddedN - (BOOL) shouldSwapClass { BOOL result = YES; - if([self respondsToSelector: @selector(isInInterfaceBuilder)]) + if ([self respondsToSelector: @selector(isInInterfaceBuilder)]) { result = !([self isInInterfaceBuilder]); } @@ -802,7 +802,7 @@ static NSString *GSInternalNibItemAddedNotification = @"_GSInternalNibItemAddedN } // change the origin of the window. - if(changedOrigin) + if (changedOrigin) { [window setFrameOrigin: origin]; } @@ -812,18 +812,18 @@ static NSString *GSInternalNibItemAddedNotification = @"_GSInternalNibItemAddedN - (id) initWithCoder: (NSCoder *)coder { id obj = [super initWithCoder: coder]; - if(obj != nil) + if (obj != nil) { int version = [coder versionForClassName: @"GSWindowTemplate"]; - if(version == GSWINDOWT_VERSION) + if (version == GSWINDOWT_VERSION) { // decode the defer flag... [coder decodeValueOfObjCType: @encode(BOOL) at: &_deferFlag]; [coder decodeValueOfObjCType: @encode(unsigned int) at: &_autoPositionMask]; _screenRect = [coder decodeRect]; } - else if(version == 0) + else if (version == 0) { // decode the defer flag... [coder decodeValueOfObjCType: @encode(BOOL) at: &_deferFlag]; @@ -831,9 +831,9 @@ static NSString *GSInternalNibItemAddedNotification = @"_GSInternalNibItemAddedN _screenRect = [[_object screen] frame]; } - if([self shouldSwapClass]) + if ([self shouldSwapClass]) { - if(GSGetMethod([obj class], @selector(initWithContentRect:styleMask:backing:defer:), YES, NO) != NULL + if (GSGetMethod([obj class], @selector(initWithContentRect:styleMask:backing:defer:), YES, NO) != NULL && ![_className isEqualToString: NSStringFromClass(_superClass)]) { NSView *contentView = [obj contentView]; @@ -860,7 +860,7 @@ static NSString *GSInternalNibItemAddedNotification = @"_GSInternalNibItemAddedN // Set all of the attributes into the object, if it // responds to any of these methods. // - if([obj respondsToSelector: @selector(setAutoPositionMask:)]) + if ([obj respondsToSelector: @selector(setAutoPositionMask:)]) { [obj setAutoPositionMask: [self autoPositionMask]]; } @@ -876,14 +876,14 @@ static NSString *GSInternalNibItemAddedNotification = @"_GSInternalNibItemAddedN [super encodeWithCoder: coder]; - if(version == GSWINDOWT_VERSION) + if (version == GSWINDOWT_VERSION) { _screenRect = [[_object screen] frame]; [coder encodeValueOfObjCType: @encode(BOOL) at: &_deferFlag]; [coder encodeValueOfObjCType: @encode(unsigned int) at: &_autoPositionMask]; [coder encodeRect: _screenRect]; } - else if(version == 0) + else if (version == 0) { [coder encodeValueOfObjCType: @encode(BOOL) at: &_deferFlag]; } @@ -902,11 +902,11 @@ static NSString *GSInternalNibItemAddedNotification = @"_GSInternalNibItemAddedN - (id) initWithCoder: (NSCoder *)coder { id obj = [super initWithCoder: coder]; - if(obj != nil) + if (obj != nil) { - if([self shouldSwapClass]) + if ([self shouldSwapClass]) { - if(GSGetMethod([obj class],@selector(initWithFrame:), YES, NO) != NULL + if (GSGetMethod([obj class],@selector(initWithFrame:), YES, NO) != NULL && ![_className isEqualToString: NSStringFromClass(_superClass)]) { NSRect theFrame = [obj frame]; @@ -932,11 +932,11 @@ static NSString *GSInternalNibItemAddedNotification = @"_GSInternalNibItemAddedN - (id) initWithCoder: (NSCoder *)coder { id obj = [super initWithCoder: coder]; - if(obj != nil) + if (obj != nil) { - if([self shouldSwapClass]) + if ([self shouldSwapClass]) { - if(GSGetMethod([obj class],@selector(initWithFrame:), YES, NO) != NULL + if (GSGetMethod([obj class],@selector(initWithFrame:), YES, NO) != NULL && ![_className isEqualToString: NSStringFromClass(_superClass)]) { NSRect theFrame = [obj frame]; @@ -962,11 +962,11 @@ static NSString *GSInternalNibItemAddedNotification = @"_GSInternalNibItemAddedN - (id) initWithCoder: (NSCoder *)coder { id obj = [super initWithCoder: coder]; - if(obj != nil) + if (obj != nil) { - if([self shouldSwapClass]) + if ([self shouldSwapClass]) { - if(GSGetMethod([obj class],@selector(initWithFrame:textContainer:), YES, NO) != NULL + if (GSGetMethod([obj class],@selector(initWithFrame:textContainer:), YES, NO) != NULL && ![_className isEqualToString: NSStringFromClass(_superClass)]) { NSRect theFrame = [obj frame]; @@ -994,11 +994,11 @@ static NSString *GSInternalNibItemAddedNotification = @"_GSInternalNibItemAddedN - (id) initWithCoder: (NSCoder *)coder { id obj = [super initWithCoder: coder]; - if(obj != nil) + if (obj != nil) { - if([self shouldSwapClass]) + if ([self shouldSwapClass]) { - if(GSGetMethod([obj class],@selector(initWithTitle:), YES, NO) != NULL + if (GSGetMethod([obj class],@selector(initWithTitle:), YES, NO) != NULL && ![_className isEqualToString: NSStringFromClass(_superClass)]) { NSString *theTitle = [obj title]; @@ -1025,12 +1025,12 @@ static NSString *GSInternalNibItemAddedNotification = @"_GSInternalNibItemAddedN - (id) initWithCoder: (NSCoder *)coder { id obj = [super initWithCoder: coder]; - if(obj != nil) + if (obj != nil) { /* - if([self shouldSwapClass]) + if ([self shouldSwapClass]) { - if(GSGetMethod([obj class],@selector(initWithFrame:), YES, NO) != NULL) + if (GSGetMethod([obj class],@selector(initWithFrame:), YES, NO) != NULL) { NSRect theFrame = [obj frame]; obj = [obj initWithFrame: theFrame]; @@ -1055,11 +1055,11 @@ static NSString *GSInternalNibItemAddedNotification = @"_GSInternalNibItemAddedN - (id) initWithCoder: (NSCoder *)coder { id obj = [super initWithCoder: coder]; - if(obj != nil) + if (obj != nil) { - if([self shouldSwapClass]) + if ([self shouldSwapClass]) { - if(GSGetMethod([obj class],@selector(init), YES, NO) != NULL + if (GSGetMethod([obj class],@selector(init), YES, NO) != NULL && ![_className isEqualToString: NSStringFromClass(_superClass)]) { obj = [self init]; @@ -1080,7 +1080,7 @@ static NSString *GSInternalNibItemAddedNotification = @"_GSInternalNibItemAddedN withSuperClassName: (NSString *)superClassName { id template = nil; - if(object != nil) + if (object != nil) { if ([object isKindOfClass: [NSWindow class]]) { diff --git a/Source/GSPDFPrintOperation.m b/Source/GSPDFPrintOperation.m index 6b7fdd95f..e2262f32a 100644 --- a/Source/GSPDFPrintOperation.m +++ b/Source/GSPDFPrintOperation.m @@ -67,7 +67,7 @@ [[NSProcessInfo processInfo] globallyUniqueString]]; _path = [_path stringByAppendingPathExtension: @"pdf"]; - RETAIN( _path ); + RETAIN(_path); return self; } diff --git a/Source/GSPrintOperation.m b/Source/GSPrintOperation.m index e71d1433a..48dac2292 100644 --- a/Source/GSPrintOperation.m +++ b/Source/GSPrintOperation.m @@ -70,7 +70,7 @@ principalClass = [[GSPrinting printingBundle] principalClass]; - if( principalClass == nil ) + if (principalClass == nil) return nil; return [[principalClass gsPrintOperationClass] allocWithZone: zone]; @@ -158,7 +158,7 @@ /* We can't remove the temp file because the previewer might still be using it, perhaps the printer is also? - if ( _path ) + if (_path) { [[NSFileManager defaultManager] removeFileAtPath: _path handler: nil]; diff --git a/Source/GSPrinting.m b/Source/GSPrinting.m index 7451f41be..1406f1c65 100644 --- a/Source/GSPrinting.m +++ b/Source/GSPrinting.m @@ -64,7 +64,7 @@ static NSBundle *printingBundle = nil; libraryPathsEnumerator = [NSStandardLibraryPaths() objectEnumerator]; - while( (path = [libraryPathsEnumerator nextObject]) ) + while ((path = [libraryPathsEnumerator nextObject])) { path = [path stringByAppendingPathComponent: @"Bundles"]; path = [path stringByAppendingPathComponent: @"GSPrinting"]; @@ -75,7 +75,7 @@ static NSBundle *printingBundle = nil; NSBundle *bundle; bundle = [NSBundle bundleWithPath: path]; - if( [bundle load] == NO ) + if ([bundle load] == NO) { NSDebugLLog(@"GSPrinting", @"Error loading printing bundle at %@", path); @@ -83,7 +83,7 @@ static NSBundle *printingBundle = nil; } //one last check to make sure the principle class can be loaded - if( [bundle principalClass] == Nil) + if ([bundle principalClass] == Nil) { NSDebugLLog(@"GSPrinting", @"Error loading principal class from printing bundle at %@", @@ -108,13 +108,13 @@ static NSBundle *printingBundle = nil; { NSBundle *bundle; - if( (bundle = [GSPrinting loadPrintingBundle: @"GSCUPS"]) ) + if ((bundle = [GSPrinting loadPrintingBundle: @"GSCUPS"])) return bundle; - if( (bundle = [GSPrinting loadPrintingBundle: @"GSLPR"]) ) + if ((bundle = [GSPrinting loadPrintingBundle: @"GSLPR"])) return bundle; - if( (bundle = [GSPrinting loadPrintingBundle: @"GSWin32"]) ) + if ((bundle = [GSPrinting loadPrintingBundle: @"GSWin32"])) return bundle; return nil; @@ -127,7 +127,7 @@ static NSBundle *printingBundle = nil; NSString *defaultBundleName; NSBundle *bundle; - if( printingBundle ) + if (printingBundle) { return printingBundle; } @@ -138,20 +138,20 @@ static NSBundle *printingBundle = nil; stringForKey: @"GSPrinting"]; /*Which Printing Bundle?*/ - if( defaultBundleName == nil ) + if (defaultBundleName == nil) { NSDebugLLog(@"GSPrinting", @"User did not set a printing bundle, trying till something works"); bundle = [GSPrinting loadAnyWorkingPrintingBundle]; - if( bundle == nil ) + if (bundle == nil) { NSDebugLLog(@"GSPrinting", @"Could not load any working printing bundle"); NSRunAlertPanel(@"GNUstep Printing Backend System", @"Could not open any working printing bundle. Printing will not work.", - @"Ok", NULL, NULL ); + @"Ok", NULL, NULL); return nil; } @@ -164,7 +164,7 @@ static NSBundle *printingBundle = nil; bundle = [GSPrinting loadPrintingBundle: defaultBundleName]; - if( bundle == nil ) + if (bundle == nil) { NSDebugLLog(@"GSPrinting", @"User set %@ as the printing bundle but that did not work.\ @@ -172,13 +172,13 @@ static NSBundle *printingBundle = nil; defaultBundleName); bundle = [GSPrinting loadAnyWorkingPrintingBundle]; - if( bundle == nil ) + if (bundle == nil) { NSDebugLLog(@"GSPrinting", @"Could not load any working printing bundle"); NSRunAlertPanel(@"GNUstep Printing Backend System", @"Could not open any working printing bundle. Printing will not work.", - @"Ok", NULL, NULL ); + @"Ok", NULL, NULL); return nil; } else @@ -190,7 +190,7 @@ static NSBundle *printingBundle = nil; defaultBundleName, [[bundle bundlePath] lastPathComponent]]; NSRunAlertPanel(@"GNUstep Printing Backend System", - msg, @"Ok", NULL, NULL ); + msg, @"Ok", NULL, NULL); } } } diff --git a/Source/GSSlideView.m b/Source/GSSlideView.m index 90d318734..12c6fa95f 100644 --- a/Source/GSSlideView.m +++ b/Source/GSSlideView.m @@ -81,7 +81,7 @@ [NSEvent startPeriodicEventsAfterDelay: SLIDE_TIME_STEP withPeriod: SLIDE_TIME_STEP]; - while(steps--) + while (steps--) { NSEvent *theEvent = [NSApp nextEventMatchingMask: NSPeriodicMask untilDate: [NSDate distantFuture] diff --git a/Source/GSTable.m b/Source/GSTable.m index ecb887657..2106e4d02 100644 --- a/Source/GSTable.m +++ b/Source/GSTable.m @@ -189,7 +189,7 @@ borderChange = aBorder - _minXBorder; - for(i = 0; i < _numberOfColumns; i++) + for (i = 0; i < _numberOfColumns; i++) { _columnXOrigin[i] += borderChange; [self _updateColumnOrigin: i]; @@ -229,7 +229,7 @@ borderChange = aBorder - _minYBorder; - for(i = 0; i < _numberOfRows; i++) + for (i = 0; i < _numberOfRows; i++) { _rowYOrigin[i] += borderChange; [self _updateRowOrigin: i]; diff --git a/Source/GSToolbar.m b/Source/GSToolbar.m index 7873e5d60..86901249f 100644 --- a/Source/GSToolbar.m +++ b/Source/GSToolbar.m @@ -681,7 +681,7 @@ static GSValidationCenter *vc; _customizationPaletteIsRunning = [NSBundle loadNibNamed: @"GSToolbarCustomizationPalette" owner: self]; - if(!_customizationPaletteIsRunning) + if (!_customizationPaletteIsRunning) { NSLog(@"Failed to load gorm for GSToolbarCustomizationPalette"); } @@ -692,7 +692,7 @@ static GSValidationCenter *vc; NSEnumerator *e = [[self visibleItems] objectEnumerator]; NSToolbarItem *item = nil; - while((item = [e nextObject]) != nil) + while ((item = [e nextObject]) != nil) { [item validate]; } @@ -985,7 +985,7 @@ static GSValidationCenter *vc; { NSToolbarItem *item = nil; - if([itemIdent isEqual: NSToolbarSeparatorItemIdentifier] || + if ([itemIdent isEqual: NSToolbarSeparatorItemIdentifier] || [itemIdent isEqual: NSToolbarSpaceItemIdentifier] || [itemIdent isEqual: NSToolbarFlexibleSpaceItemIdentifier] || [itemIdent isEqual: NSToolbarShowColorsItemIdentifier] || @@ -1031,7 +1031,7 @@ static GSValidationCenter *vc; allowedItems = [_delegate toolbarAllowedItemIdentifiers: self]; - if([allowedItems containsObject: itemIdentifier]) + if ([allowedItems containsObject: itemIdentifier]) { item = [self _toolbarItemForIdentifier: itemIdentifier]; if (item == nil) @@ -1140,7 +1140,7 @@ static GSValidationCenter *vc; - (void) _setDelegate: (id)delegate broadcast: (BOOL)broadcast { - //if(_delegate) + //if (_delegate) // [nc removeObserver: _delegate name: nil object: self]; if (_delegate == delegate) diff --git a/Source/NSAlert.m b/Source/NSAlert.m index afa761626..03c509ca4 100644 --- a/Source/NSAlert.m +++ b/Source/NSAlert.m @@ -289,7 +289,7 @@ makeScrollViewWithRect(NSRect rect) [button setButtonType: NSMomentaryPushButton]; [button setTitle: @""]; [button setTarget: self]; - [button setAction: @selector(buttonAction: )]; + [button setAction: @selector(buttonAction:)]; [button setFont: [NSFont systemFontOfSize: 0]]; return button; } @@ -1334,7 +1334,7 @@ void NSBeginInformationalAlertSheet(NSString *title, [button setAutoresizingMask: NSViewMinXMargin | NSViewMaxYMargin]; [button setButtonType: NSMomentaryPushButton]; [button setTarget: self]; - [button setAction: @selector(buttonAction: )]; + [button setAction: @selector(buttonAction:)]; [button setFont: [NSFont systemFontOfSize: 0]]; if (count == 0) { diff --git a/Source/NSApplication.m b/Source/NSApplication.m index 04d9a3b22..74b49c6f3 100644 --- a/Source/NSApplication.m +++ b/Source/NSApplication.m @@ -178,7 +178,7 @@ gnustep_backend_path (NSString *dir, NSString *name) static NSString * gnustep_backend_framework (NSString *bundleName) { - if ( bundleName == nil ) + if (bundleName == nil) bundleName = @"GNUstep_back.framework"; else { @@ -208,7 +208,7 @@ gnustep_backend_bundle(NSString *bundleName) NSString *path, *bundleWithVersion; int version = GNUSTEP_GUI_MAJOR_VERSION * 100 + GNUSTEP_GUI_MINOR_VERSION; - if ( bundleName == nil ) + if (bundleName == nil) bundleName = @"libgnustep-back"; else { diff --git a/Source/NSBezierPath.m b/Source/NSBezierPath.m index 2be61b241..d9859c18b 100644 --- a/Source/NSBezierPath.m +++ b/Source/NSBezierPath.m @@ -91,7 +91,7 @@ typedef struct _PathElement + (void)initialize { - if(self == [NSBezierPath class]) + if (self == [NSBezierPath class]) NSBezierPath_concrete_class = [GSBezierPath class]; } @@ -277,7 +277,7 @@ typedef struct _PathElement - (void) dealloc { - if(_cacheImage != nil) + if (_cacheImage != nil) RELEASE(_cacheImage); if (_dash_pattern != NULL) @@ -470,13 +470,13 @@ typedef struct _PathElement { NSGraphicsContext *ctxt = GSCurrentContext(); - if(_cachesBezierPath) + if (_cachesBezierPath) { NSRect bounds = [self bounds]; NSPoint origin = bounds.origin; // FIXME: I don't see how this should work with color changes - if(_cacheImage == nil) + if (_cacheImage == nil) { _cacheImage = [[NSImage alloc] initWithSize: bounds.size]; [_cacheImage lockFocus]; @@ -498,19 +498,19 @@ typedef struct _PathElement { NSGraphicsContext *ctxt = GSCurrentContext(); - if(_cachesBezierPath) + if (_cachesBezierPath) { NSRect bounds = [self bounds]; NSPoint origin = bounds.origin; // FIXME: I don't see how this should work with color changes - if(_cacheImage == nil) + if (_cacheImage == nil) { _cacheImage = [[NSImage alloc] initWithSize: bounds.size]; [_cacheImage lockFocus]; DPStranslate(ctxt, -origin.x, -origin.y); [ctxt GSSendBezierPath: self]; - if([self windingRule] == NSNonZeroWindingRule) + if ([self windingRule] == NSNonZeroWindingRule) DPSfill(ctxt); else DPSeofill(ctxt); @@ -521,7 +521,7 @@ typedef struct _PathElement else { [ctxt GSSendBezierPath: self]; - if([self windingRule] == NSNonZeroWindingRule) + if ([self windingRule] == NSNonZeroWindingRule) DPSfill(ctxt); else DPSeofill(ctxt); @@ -533,7 +533,7 @@ typedef struct _PathElement NSGraphicsContext *ctxt = GSCurrentContext(); [ctxt GSSendBezierPath: self]; - if([self windingRule] == NSNonZeroWindingRule) + if ([self windingRule] == NSNonZeroWindingRule) DPSclip(ctxt); else DPSeoclip(ctxt); @@ -545,7 +545,7 @@ typedef struct _PathElement DPSinitclip(ctxt); [ctxt GSSendBezierPath: self]; - if([self windingRule] == NSNonZeroWindingRule) + if ([self windingRule] == NSNonZeroWindingRule) DPSclip(ctxt); else DPSeoclip(ctxt); @@ -569,7 +569,7 @@ typedef struct _PathElement last_p = NSZeroPoint; count = [self elementCount]; - for(i = 0; i < count; i++) + for (i = 0; i < count; i++) { type = [self elementAtIndex: i associatedPoints: pts]; switch(type) @@ -627,7 +627,7 @@ typedef struct _PathElement last_type = NSMoveToBezierPathElement; count = [self elementCount]; - for(i = count - 1; i >= 0; i--) + for (i = count - 1; i >= 0; i--) { type = [self elementAtIndex: i associatedPoints: pts]; switch(type) @@ -702,7 +702,7 @@ typedef struct _PathElement int i, count; count = [self elementCount]; - for(i = 0; i < count; i++) + for (i = 0; i < count; i++) { type = [self elementAtIndex: i associatedPoints: pts]; switch(type) @@ -1491,7 +1491,7 @@ static int winding_curve(double_point from, double_point to, double_point c1, { int sum; - if(![self elementCount]) + if (![self elementCount]) return NO; if (!NSPointInRect(point, [self bounds])) @@ -1529,7 +1529,7 @@ static int winding_curve(double_point from, double_point to, double_point c1, { _cachesBezierPath = flag; - if(!flag) + if (!flag) INVALIDATE_CACHE(); } @@ -1556,7 +1556,7 @@ static int winding_curve(double_point from, double_point to, double_point c1, count = [self elementCount]; [aCoder encodeValueOfObjCType: @encode(int) at: &count]; - for(i = 0; i < count; i++) + for (i = 0; i < count; i++) { type = [self elementAtIndex: i associatedPoints: pts]; [aCoder encodeValueOfObjCType: @encode(NSBezierPathElement) at: &type]; @@ -1603,7 +1603,7 @@ static int winding_curve(double_point from, double_point to, double_point c1, [aCoder decodeValueOfObjCType: @encode(int) at: &count]; - for(i = 0; i < count; i++) + for (i = 0; i < count; i++) { [aCoder decodeValueOfObjCType: @encode(NSBezierPathElement) at: &type]; switch(type) @@ -1639,7 +1639,7 @@ static int winding_curve(double_point from, double_point to, double_point c1, { NSBezierPath *path = (NSBezierPath*)NSCopyObject (self, 0, zone); - if(_cachesBezierPath && _cacheImage) + if (_cachesBezierPath && _cacheImage) path->_cacheImage = [_cacheImage copy]; if (_dash_pattern != NULL) @@ -1900,11 +1900,11 @@ static NSPoint point_on_curve(double t, NSPoint a, NSPoint b, NSPoint c, if (points != NULL) { - if(type == NSMoveToBezierPathElement || type == NSLineToBezierPathElement) + if (type == NSMoveToBezierPathElement || type == NSLineToBezierPathElement) { points[0] = elm.points[0]; } - else if(type == NSCurveToBezierPathElement) + else if (type == NSCurveToBezierPathElement) { points[0] = elm.points[0]; points[1] = elm.points[1]; @@ -1964,7 +1964,7 @@ static NSPoint point_on_curve(double t, NSPoint a, NSPoint b, NSPoint c, [transform methodForSelector: transformPointSel]; count = GSIArrayCount(pathElements); - for(i = 0; i < count; i++) + for (i = 0; i < count; i++) { type = elments[i].type; switch(type) diff --git a/Source/NSBitmapImageRep+PNM.m b/Source/NSBitmapImageRep+PNM.m index a71160012..48fadd54b 100644 --- a/Source/NSBitmapImageRep+PNM.m +++ b/Source/NSBitmapImageRep+PNM.m @@ -56,7 +56,7 @@ do \ { \ char *p = buffer; \ - while ( *ptr != '\n' && *ptr != '\r' && (ptr-bytes) < length) \ + while (*ptr != '\n' && *ptr != '\r' && (ptr-bytes) < length) \ { \ *p++ = *ptr++; \ if (p == &buffer[sizeof(buffer)]) \ @@ -117,7 +117,7 @@ bytesPerRow: 0 bitsPerPixel: 0]; - if ([self bytesPerRow] * ysize > (length - (ptr - bytes)) ) + if ([self bytesPerRow] * ysize > (length - (ptr - bytes))) ERRMSG(@"Invalid PNM file (short data)"); pchar = [self bitmapData]; if (levels < 256) diff --git a/Source/NSBox.m b/Source/NSBox.m index 0a069fc61..f14b93896 100644 --- a/Source/NSBox.m +++ b/Source/NSBox.m @@ -48,7 +48,7 @@ /** *

EXPLAINS NSBox

- *

TODO : explains how is resized the rects ( margins etc... )

+ *

TODO : explains how is resized the rects (margins etc...)

*/ @implementation NSBox diff --git a/Source/NSBrowser.m b/Source/NSBrowser.m index 67a386408..fe20fb21e 100644 --- a/Source/NSBrowser.m +++ b/Source/NSBrowser.m @@ -1863,7 +1863,7 @@ static NSTextFieldCell *titleCell; a = [sender selectedCells]; aCount = [a count]; - if(aCount == 0) + if (aCount == 0) return; selectedCells = [a mutableCopy]; @@ -2277,7 +2277,7 @@ static NSTextFieldCell *titleCell; IMP lcarc = [self methodForSelector: lcarcSel]; selectedColumn = [self selectedColumn]; - if(selectedColumn != -1) + if (selectedColumn != -1) { matrix = [self matrixInColumn: selectedColumn]; n = [matrix numberOfRows]; @@ -2828,7 +2828,7 @@ static NSTextFieldCell *titleCell; // Get the selected cell // Use its string value as the title // Only if it is not a leaf - if(_allowsMultipleSelection == NO) + if (_allowsMultipleSelection == NO) { c = [self selectedCellInColumn: column - 1]; } @@ -2842,7 +2842,7 @@ static NSTextFieldCell *titleCell; selectedCells = [matrix selectedCells]; - if([selectedCells count] == 1) + if ([selectedCells count] == 1) { c = [selectedCells objectAtIndex:0]; } diff --git a/Source/NSBrowserCell.m b/Source/NSBrowserCell.m index c9be38b3c..2f352a54a 100644 --- a/Source/NSBrowserCell.m +++ b/Source/NSBrowserCell.m @@ -154,7 +154,7 @@ static NSFont *_leafFont; /** *

Returns the alternate image in the NSBrowserCell - * ( used when the cell is highlighted )

+ * (used when the cell is highlighted)

*

See Also: -setAlternateImage:

*/ - (NSImage*) alternateImage @@ -163,7 +163,7 @@ static NSFont *_leafFont; } /** - *

Sets the altenate image ( used when the cell is highlighted ) to anImage + *

Sets the altenate image (used when the cell is highlighted) to anImage *

See Also: -alternateImage

*/ - (void) setAlternateImage: (NSImage *)anImage diff --git a/Source/NSBundleAdditions.m b/Source/NSBundleAdditions.m index be7484fc4..ff94e03da 100644 --- a/Source/NSBundleAdditions.m +++ b/Source/NSBundleAdditions.m @@ -271,12 +271,12 @@ Class gmodel_class(void) NSFileManager *mgr = [NSFileManager defaultManager]; BOOL isDir = NO; - if([mgr fileExistsAtPath: fileName isDirectory: &isDir]) + if ([mgr fileExistsAtPath: fileName isDirectory: &isDir]) { NSData *data = nil; // if the data is in a directory, then load from objects.gorm in the directory - if(isDir == NO) + if (isDir == NO) { data = [NSData dataWithContentsOfFile: fileName]; NSDebugLog(@"Loaded data from file..."); @@ -420,7 +420,7 @@ Class gmodel_class(void) else { path = [rootPath stringByAppendingPathExtension: ext]; - if([mgr isReadableFileAtPath: path]) + if ([mgr isReadableFileAtPath: path]) { return path; } diff --git a/Source/NSCell.m b/Source/NSCell.m index 8273b5c28..533f98a87 100644 --- a/Source/NSCell.m +++ b/Source/NSCell.m @@ -715,8 +715,8 @@ static NSColor *shadowCol; /**

Sets the NSCell's state. Please use always symbolic constants when calling this method. The integer values could be changed in the this - implementation. ( Currently they match the Cocoa values but they are - quite strange )

See Also: -state

+ implementation. (Currently they match the Cocoa values but they are + quite strange)

See Also: -state

*/ - (void) setState: (int)value { @@ -1338,7 +1338,7 @@ static NSColor *shadowCol; { SEL action = [self action]; - if(_cell.is_disabled == YES) + if (_cell.is_disabled == YES) { return; } @@ -1677,7 +1677,7 @@ static NSColor *shadowCol; } /**

Does nothing. This method is used by subclasses to recalculate sizes

- *

It is usally called by a NSControl object ( [NSControl-calcSize] )

+ *

It is usally called by a NSControl object ([NSControl-calcSize])

*/ - (void) calcDrawInfo: (NSRect)aRect { @@ -1690,7 +1690,7 @@ static NSColor *shadowCol;

- the TODO ... if the cell is type of NSTextCellType or the image size if the cell has a NSImageCellType type.

This method returns NSZeroSize if the cell has a NSNullCellType type - ( Cocoa returns a very big size instead ). + (Cocoa returns a very big size instead).

*/ - (NSSize) cellSize diff --git a/Source/NSColor.m b/Source/NSColor.m index b0c5b9586..fe707e6c7 100644 --- a/Source/NSColor.m +++ b/Source/NSColor.m @@ -919,7 +919,7 @@ systemColorWithName(NSString *name) } } -/**

Returns the alpha component ( 1.0 by default )

+/**

Returns the alpha component (1.0 by default)

*/ - (float) alphaComponent { diff --git a/Source/NSColorList.m b/Source/NSColorList.m index 3c26e1b68..4cdfddaf3 100644 --- a/Source/NSColorList.m +++ b/Source/NSColorList.m @@ -497,7 +497,7 @@ static NSLock *_gnustep_color_list_lock = nil; */ if (path_is_standard && ([fm fileExistsAtPath: path] == NO)) { - if([fm createDirectoryAtPath: path + if ([fm createDirectoryAtPath: path attributes: nil]) { NSLog (@"Created standard directory %@", path); diff --git a/Source/NSColorWell.m b/Source/NSColorWell.m index e343b34bc..66b8fa99c 100644 --- a/Source/NSColorWell.m +++ b/Source/NSColorWell.m @@ -281,7 +281,7 @@ static NSString *GSColorWellDidBecomeExclusiveNotification = // OPENSTEP 4.2 and OSX behavior indicates that the colorwell doesn't // work when the widget is marked as disabled. // - if([self isEnabled]) + if ([self isEnabled]) { NSPoint point = [self convertPoint: [theEvent locationInWindow] fromView: nil]; diff --git a/Source/NSCustomImageRep.m b/Source/NSCustomImageRep.m index 00411d87e..5269705d8 100644 --- a/Source/NSCustomImageRep.m +++ b/Source/NSCustomImageRep.m @@ -119,7 +119,7 @@ ctxt = GSCurrentContext(); // if either is zero, don't scale at all. - if(_size.width == 0 || _size.height == 0) + if (_size.width == 0 || _size.height == 0) { scale = NSMakeSize(NSWidth(aRect), NSHeight(aRect)); diff --git a/Source/NSDataLink.m b/Source/NSDataLink.m index f312dd665..7c5a22379 100644 --- a/Source/NSDataLink.m +++ b/Source/NSDataLink.m @@ -57,7 +57,7 @@ // - (id)initLinkedToFile:(NSString *)filename { - if((self = [self init]) != nil) + if ((self = [self init]) != nil) { NSData *data = [NSData dataWithBytes: [filename cString] length: [filename cStringLength]]; NSSelection *selection = [NSSelection selectionWithDescriptionData: data]; @@ -70,7 +70,7 @@ managedBy:(NSDataLinkManager *)linkManager supportingTypes:(NSArray *)newTypes { - if((self = [self init]) != nil) + if ((self = [self init]) != nil) { ASSIGN(sourceSelection,selection); ASSIGN(sourceManager,linkManager); @@ -130,7 +130,7 @@ { NSString *path = filename; - if([[path pathExtension] isEqual: NSDataLinkFilenameExtension] == NO) + if ([[path pathExtension] isEqual: NSDataLinkFilenameExtension] == NO) { path = [filename stringByAppendingPathExtension: NSDataLinkFilenameExtension]; } @@ -225,12 +225,12 @@ // circumstances a link cannot be broken, so this method // always returns YES. - if([srcDelegate respondsToSelector: @selector(dataLinkManager:didBreakLink:)]) + if ([srcDelegate respondsToSelector: @selector(dataLinkManager:didBreakLink:)]) { [srcDelegate dataLinkManager: sourceManager didBreakLink: self]; } - if([dstDelegate respondsToSelector: @selector(dataLinkManager:didBreakLink:)]) + if ([dstDelegate respondsToSelector: @selector(dataLinkManager:didBreakLink:)]) { [dstDelegate dataLinkManager: destinationManager didBreakLink: self]; } @@ -242,7 +242,7 @@ { _flags.isDirty = YES; - if(updateMode != NSUpdateNever) + if (updateMode != NSUpdateNever) { [sourceManager noteDocumentEdited]; } @@ -304,7 +304,7 @@ { int version = [aCoder versionForClassName: @"NSDataLink"]; - if(version == 0) + if (version == 0) { BOOL flag = NO; diff --git a/Source/NSDataLinkManager.m b/Source/NSDataLinkManager.m index 163999253..77d0b6298 100644 --- a/Source/NSDataLinkManager.m +++ b/Source/NSDataLinkManager.m @@ -106,7 +106,7 @@ { self = [super init]; - if(self != nil) + if (self != nil) { ASSIGN(delegate,anObject); filename = nil; @@ -124,7 +124,7 @@ { self = [super init]; - if(self != nil) + if (self != nil) { ASSIGN(delegate,anObject); ASSIGN(filename,path); @@ -148,7 +148,7 @@ [link setDestinationSelection: selection]; [link setDestinationManager: self]; - if([destinationLinks containsObject: link] == NO) + if ([destinationLinks containsObject: link] == NO) { [destinationLinks addObject: link]; result = YES; @@ -173,9 +173,9 @@ NSEnumerator *en = [links objectEnumerator]; NSDataLink *link = nil; - while((link = [en nextObject]) != nil) + while ((link = [en nextObject]) != nil) { - if([link destinationSelection] == oldSelection) + if ([link destinationSelection] == oldSelection) { } } @@ -189,7 +189,7 @@ NSEnumerator *en = [allLinks objectEnumerator]; id obj = nil; - while((obj = [en nextObject]) != nil) + while ((obj = [en nextObject]) != nil) { [obj break]; } @@ -201,7 +201,7 @@ NSEnumerator *en = [allLinks objectEnumerator]; id obj = nil; - while((obj = [en nextObject]) != nil) + while ((obj = [en nextObject]) != nil) { [obj writeToPasteboard: pasteboard]; } @@ -212,7 +212,7 @@ // - (void)noteDocumentClosed { - if([delegate respondsToSelector: @selector(dataLinkManagerCloseDocument:)]) + if ([delegate respondsToSelector: @selector(dataLinkManagerCloseDocument:)]) { [delegate dataLinkManagerCloseDocument: self]; } @@ -220,7 +220,7 @@ - (void)noteDocumentEdited { - if([delegate respondsToSelector: @selector(dataLinkManagerDidEditLinks:)]) + if ([delegate respondsToSelector: @selector(dataLinkManagerDidEditLinks:)]) { [delegate dataLinkManagerDidEditLinks: self]; } @@ -228,7 +228,7 @@ - (void)noteDocumentReverted { - if([delegate respondsToSelector: @selector(dataLinkManagerDidEditLinks:)]) + if ([delegate respondsToSelector: @selector(dataLinkManagerDidEditLinks:)]) { [delegate dataLinkManagerDidEditLinks: self]; } @@ -305,9 +305,9 @@ NSEnumerator *en = [self destinationLinkEnumerator]; id obj = nil; - while((obj = [en nextObject]) != nil) + while ((obj = [en nextObject]) != nil) { - if([obj destinationSelection] == destSel) + if ([obj destinationSelection] == destSel) { break; } @@ -351,7 +351,7 @@ { int version = [aCoder versionForClassName: @"NSDataLinkManager"]; - if(version == 0) + if (version == 0) { BOOL flag = NO; diff --git a/Source/NSDataLinkPanel.m b/Source/NSDataLinkPanel.m index 2c75270ec..1221a8e9d 100644 --- a/Source/NSDataLinkPanel.m +++ b/Source/NSDataLinkPanel.m @@ -47,7 +47,7 @@ static NSDataLinkPanel *_sharedDataLinkPanel; NSString *panelPath; NSDictionary *table; - if((self = [super init]) != nil) + if ((self = [super init]) != nil) { panelPath = [GSGuiBundle() pathForResource: @"GSDataLinkPanel" ofType: @"gorm" @@ -113,7 +113,7 @@ static NSDataLinkPanel *_sharedDataLinkPanel; */ + (NSDataLinkPanel *)sharedDataLinkPanel { - if(_sharedDataLinkPanel == nil) + if (_sharedDataLinkPanel == nil) { id controller = [[GSDataLinkPanelController alloc] init]; _sharedDataLinkPanel = [controller panel]; diff --git a/Source/NSDocument.m b/Source/NSDocument.m index c72fa8725..2e6357d70 100644 --- a/Source/NSDocument.m +++ b/Source/NSDocument.m @@ -589,13 +589,13 @@ } else if (sel_eq(action, @selector(undo:))) { - if(_undoManager == nil) + if (_undoManager == nil) { result = NO; } else { - if([_undoManager canUndo]) + if ([_undoManager canUndo]) { [anItem setTitle: [_undoManager undoMenuItemTitle]]; result = YES; @@ -609,13 +609,13 @@ } else if (sel_eq(action, @selector(redo:))) { - if(_undoManager == nil) + if (_undoManager == nil) { result = NO; } else { - if([_undoManager canRedo]) + if ([_undoManager canRedo]) { [anItem setTitle: [_undoManager redoMenuItemTitle]]; result = YES; diff --git a/Source/NSForm.m b/Source/NSForm.m index 9f35ebe31..08d173025 100644 --- a/Source/NSForm.m +++ b/Source/NSForm.m @@ -131,7 +131,7 @@ static Class defaultCellClass = nil; [[NSNotificationCenter defaultCenter] addObserver: self - selector: @selector(_setTitleWidthNeedsUpdate: ) + selector: @selector(_setTitleWidthNeedsUpdate:) name: _NSFormCellDidChangeTitleWidthNotification object: newCell]; } diff --git a/Source/NSGraphicsContext.m b/Source/NSGraphicsContext.m index 377a29fb3..6ebd6c576 100644 --- a/Source/NSGraphicsContext.m +++ b/Source/NSGraphicsContext.m @@ -1351,7 +1351,7 @@ NSGraphicsContext *GSCurrentContext(void) DPSsetdash(self, pattern, count, phase); count = [path elementCount]; - for(i = 0; i < count; i++) + for (i = 0; i < count; i++) { type = [path elementAtIndex: i associatedPoints: pts]; switch(type) diff --git a/Source/NSHelpManager.m b/Source/NSHelpManager.m index 28b70dc9b..8f9f4a45f 100644 --- a/Source/NSHelpManager.m +++ b/Source/NSHelpManager.m @@ -48,12 +48,12 @@ RETAIN([NSDictionary dictionaryWithContentsOfFile: [self pathForResource: @"Help" ofType: @"plist"]]); - if(contextHelp) + if (contextHelp) { helpFile = [contextHelp objectForKey: key]; } - if(helpFile) + if (helpFile) { return [NSUnarchiver unarchiveObjectWithData: [helpFile objectForKey: @"NSHelpRTFContents"]]; @@ -83,7 +83,7 @@ help = [info objectForKey: @"GSHelpContentsFile"]; - if(!help) + if (!help) { help = [info objectForKey: @"NSExecutable"]; // If there's no specification, we look for a file named "appname.rtf" @@ -176,9 +176,9 @@ static BOOL _gnu_contextHelpActive = NO; // their context help is. id hc = NSMapGet(contextHelpTopics, object); - if(hc) + if (hc) { - if(![hc isKindOfClass: [NSAttributedString class]]) + if (![hc isKindOfClass: [NSAttributedString class]]) { hc = [[NSBundle mainBundle] contextHelpForKey: hc]; /* We store the retrieved value, or remove the key from diff --git a/Source/NSImage.m b/Source/NSImage.m index 35cb522ab..a5618852a 100644 --- a/Source/NSImage.m +++ b/Source/NSImage.m @@ -661,7 +661,7 @@ repd_for_rep(NSArray *_reps, NSImageRep *rep) unsigned i; i = [_reps count]; - while(i--) + while (i--) { GSRepData *repd; diff --git a/Source/NSLayoutManager.m b/Source/NSLayoutManager.m index c15f713ea..0cbaed070 100644 --- a/Source/NSLayoutManager.m +++ b/Source/NSLayoutManager.m @@ -137,7 +137,7 @@ first. Remaining cases, highest priority first: int lo, hi, mid; \ \ lf = tc->linefrags; \ - for (lo = 0, hi = tc->num_linefrags - 1; lo < hi; ) \ + for (lo = 0, hi = tc->num_linefrags - 1; lo < hi;) \ { \ mid = (lo + hi) / 2; \ if (lf[mid].pos > glyph) \ @@ -472,7 +472,7 @@ line frag rect. */ /* Find first glyph in bounds. */ /* Find right "line", ie. the first "line" not above bounds. */ - for (low = 0, high = tc->num_linefrags - 1; low < high; ) + for (low = 0, high = tc->num_linefrags - 1; low < high;) { mid = (low + high) / 2; lf = &tc->linefrags[mid]; @@ -507,7 +507,7 @@ line frag rect. */ /* Find last glyph in bounds. */ /* Find right "line", ie. last "line" not below bounds. */ - for (low = 0, high = tc->num_linefrags - 1; low < high; ) + for (low = 0, high = tc->num_linefrags - 1; low < high;) { mid = (low + high) / 2; lf = &tc->linefrags[mid]; @@ -693,7 +693,7 @@ anything visible prev = lp->p.x; last_visible = lf->pos; - for (j = lp->pos - glyph_pos; j + glyph_pos < lp->pos + lp->length; ) + for (j = lp->pos - glyph_pos; j + glyph_pos < lp->pos + lp->length;) { if (r->glyphs[j].isNotShown || r->glyphs[j].g == NSControlGlyph || !r->glyphs[j].g) diff --git a/Source/NSMatrix.m b/Source/NSMatrix.m index 022ca539e..2bee74215 100644 --- a/Source/NSMatrix.m +++ b/Source/NSMatrix.m @@ -886,18 +886,18 @@ static SEL getSel; { if (_cells[i][j] == aCell) { - if(row) + if (row) *row = i; - if(column) + if (column) *column = j; return YES; } } } - if(row) + if (row) *row = -1; - if(column) + if (column) *column = -1; return NO; @@ -1465,7 +1465,7 @@ static SEL getSel; { return nil; } - else if(_cells != 0) + else if (_cells != 0) { return _cells[_dottedRow][_dottedColumn]; } @@ -1607,7 +1607,7 @@ static SEL getSel; case NSTabTextMovement: if (_tabKeyTraversesCells) { - if([self _selectNextSelectableCellAfterRow: _selectedRow + if ([self _selectNextSelectableCellAfterRow: _selectedRow column: _selectedColumn]) break; } @@ -1617,7 +1617,7 @@ static SEL getSel; { if (_tabKeyTraversesCells) { - if([self _selectNextSelectableCellAfterRow: -1 + if ([self _selectNextSelectableCellAfterRow: -1 column: -1]) break; } @@ -1627,7 +1627,7 @@ static SEL getSel; case NSBacktabTextMovement: if (_tabKeyTraversesCells) { - if([self _selectPreviousSelectableCellBeforeRow: _selectedRow + if ([self _selectPreviousSelectableCellBeforeRow: _selectedRow column: _selectedColumn]) break; } @@ -1637,7 +1637,7 @@ static SEL getSel; { if (_tabKeyTraversesCells) { - if([self _selectPreviousSelectableCellBeforeRow: _numRows + if ([self _selectPreviousSelectableCellBeforeRow: _numRows column: _numCols]) break; } @@ -3384,13 +3384,13 @@ static SEL getSel; { if ([theEvent modifierFlags] & NSShiftKeyMask) { - if([self _selectNextSelectableCellAfterRow: _selectedRow + if ([self _selectNextSelectableCellAfterRow: _selectedRow column: _selectedColumn]) return; } else { - if([self _selectPreviousSelectableCellBeforeRow: _selectedRow + if ([self _selectPreviousSelectableCellBeforeRow: _selectedRow column: _selectedColumn]) return; } diff --git a/Source/NSNib.m b/Source/NSNib.m index d1dfcff0c..7be788818 100644 --- a/Source/NSNib.m +++ b/Source/NSNib.m @@ -67,10 +67,10 @@ ASSIGN(newFileName, fileName); // detect if it's a directory or not... - if([mgr fileExistsAtPath: fileName isDirectory: &isDir]) + if ([mgr fileExistsAtPath: fileName isDirectory: &isDir]) { // if the data is in a directory, then load from objects.gorm in the directory - if(isDir == YES) + if (isDir == YES) { newFileName = [fileName stringByAppendingPathComponent: @"objects.gorm"]; } @@ -115,7 +115,7 @@ { NSMutableDictionary *ctx = nil; - if(dict != nil) + if (dict != nil) { id obj = nil; @@ -124,7 +124,7 @@ // remove and set the owner... obj = [ctx objectForKey: @"NSNibOwner"]; - if(obj != nil) + if (obj != nil) { [ctx removeObjectForKey: @"NSNibOwner"]; [ctx setObject: obj forKey: @"NSOwner"]; @@ -132,7 +132,7 @@ // Remove and set the top level objects... obj = [ctx objectForKey: @"NSNibTopLevelObjects"]; - if(obj != nil) + if (obj != nil) { [ctx removeObjectForKey: @"NSNibTopLevelObjects"]; [ctx setObject: obj forKey: @"NSTopLevelObjects"]; @@ -151,7 +151,7 @@ */ - (id)initWithContentsOfURL: (NSURL *)nibFileURL { - if((self = [super init]) != nil) + if ((self = [super init]) != nil) { // load the nib data into memory... _nibData = [NSData dataWithContentsOfURL: nibFileURL]; @@ -166,12 +166,12 @@ */ - (id)initWithNibNamed: (NSString *)nibNamed bundle: (NSBundle *)bundle { - if((self = [super init]) != nil) + if ((self = [super init]) != nil) { NSString *bundlePath = nil; NSString *fileName = nil; - if(bundle == nil) + if (bundle == nil) { bundle = [NSBundle mainBundle]; } @@ -265,7 +265,7 @@ // add the necessary things to the table... [externalNameTable setObject: owner forKey: @"NSNibOwner"]; - if(topLevelObjects != 0) + if (topLevelObjects != 0) { *topLevelObjects = [NSMutableArray array]; [externalNameTable setObject: *topLevelObjects forKey: @"NSNibTopLevelObjects"]; @@ -276,7 +276,7 @@ - (id) initWithCoder: (NSCoder *)coder { - if((self = [super init]) != nil) + if ((self = [super init]) != nil) { [coder decodeValueOfObjCType: @encode(id) at: &_nibData]; diff --git a/Source/NSOpenGLPixelFormat.m b/Source/NSOpenGLPixelFormat.m index dd9695333..807bb5f20 100644 --- a/Source/NSOpenGLPixelFormat.m +++ b/Source/NSOpenGLPixelFormat.m @@ -53,7 +53,7 @@ { Class glPixelFormatClass = [GSCurrentServer() glPixelFormatClass]; - if ( glPixelFormatClass == nil ) + if (glPixelFormatClass == nil) { NSWarnMLog(@"Backend doesn't have any glPixelFormatClass"); return nil; @@ -67,7 +67,7 @@ // + (void) initialize // { -// if ( self == [NSOpenGLPixelFormat class] ) +// if (self == [NSOpenGLPixelFormat class]) // { // temp = (GSGLPixelFormat *) NSAllocateObject([GSGLPixelFormat class], 0, // NSDefaultMallocZone()); @@ -77,7 +77,7 @@ + allocWithZone: (NSZone *) z { Class c = [self _classPixelFormat]; - if ( c ) + if (c) return NSAllocateObject(c, 0, z); else return nil; diff --git a/Source/NSOpenGLView.m b/Source/NSOpenGLView.m index 2b8a42c0c..d3210c78a 100644 --- a/Source/NSOpenGLView.m +++ b/Source/NSOpenGLView.m @@ -107,7 +107,7 @@ */ - (NSOpenGLContext*)openGLContext { - if ( glcontext == nil ) + if (glcontext == nil) { glcontext = [[NSOpenGLContext alloc] initWithFormat: pixel_format shareContext: nil]; @@ -181,12 +181,12 @@ - (void) lockFocusInRect: (NSRect) aRect { [super lockFocusInRect: aRect]; - if ( !glcontext ) + if (!glcontext) { [self openGLContext]; NSAssert(glcontext, NSInternalInconsistencyException); } - if ( attached == NO && glcontext != nil ) + if (attached == NO && glcontext != nil) { NSDebugMLLog(@"GL", @"Attaching context to the view"); [glcontext setView: self]; diff --git a/Source/NSOutlineView.m b/Source/NSOutlineView.m index 8b4f95f09..0dea2df68 100644 --- a/Source/NSOutlineView.m +++ b/Source/NSOutlineView.m @@ -165,7 +165,7 @@ static NSImage *unexpandable = nil; NSFreeMapTable(_itemDict); NSFreeMapTable(_levelOfItems); - if(_autosaveExpandedItems) + if (_autosaveExpandedItems) { // notify when an item expands... [nc removeObserver: self @@ -218,12 +218,12 @@ static NSImage *unexpandable = nil; const SEL shouldSelector = @selector(outlineView:shouldCollapseItem:); BOOL canCollapse = YES; - if([_delegate respondsToSelector: shouldSelector]) + if ([_delegate respondsToSelector: shouldSelector]) { canCollapse = [_delegate outlineView: self shouldCollapseItem: item]; } - if([self isExpandable: item] && [self isItemExpanded: item] && canCollapse) + if ([self isExpandable: item] && [self isItemExpanded: item] && canCollapse) { NSMutableDictionary *infoDict = [NSMutableDictionary dictionary]; unsigned int row; @@ -258,7 +258,7 @@ static NSImage *unexpandable = nil; userInfo: infoDict]; // recursively find all children and call this method to open them. - if(collapseChildren) // collapse all + if (collapseChildren) // collapse all { NSMutableArray *allChildren = nil; int numchild = 0; @@ -268,11 +268,11 @@ static NSImage *unexpandable = nil; allChildren = NSMapGet(_itemDict, sitem); numchild = [allChildren count]; - for(index = 0;index < numchild;index++) + for (index = 0;index < numchild;index++) { id child = [allChildren objectAtIndex: index]; - if([self isExpandable: child]) + if ([self isExpandable: child]) { [self collapseItem: child collapseChildren: collapseChildren]; } @@ -303,16 +303,16 @@ static NSImage *unexpandable = nil; const SEL shouldExpandSelector = @selector(outlineView:shouldExpandItem:); BOOL canExpand = YES; - if([_delegate respondsToSelector: shouldExpandSelector]) + if ([_delegate respondsToSelector: shouldExpandSelector]) { canExpand = [_delegate outlineView: self shouldExpandItem: item]; } // if the item is expandable - if([self isExpandable: item]) + if ([self isExpandable: item]) { // if it is not already expanded and it can be expanded, then expand - if(![self isItemExpanded: item] && canExpand) + if (![self isItemExpanded: item] && canExpand) { NSMutableDictionary *infoDict = [NSMutableDictionary dictionary]; unsigned int row; @@ -349,7 +349,7 @@ static NSImage *unexpandable = nil; } // recursively find all children and call this method to open them. - if(expandChildren) // expand all + if (expandChildren) // expand all { NSMutableArray *allChildren = nil; int numchild = 0; @@ -359,11 +359,11 @@ static NSImage *unexpandable = nil; allChildren = NSMapGet(_itemDict, sitem); numchild = [allChildren count]; - for(index = 0;index < numchild;index++) + for (index = 0;index < numchild;index++) { id child = [allChildren objectAtIndex: index]; - if([self isExpandable: child]) + if ([self isExpandable: child]) { [self expandItem: child expandChildren: expandChildren]; } @@ -407,7 +407,7 @@ static NSImage *unexpandable = nil; */ - (BOOL)isItemExpanded: (id)item { - if(item == nil) + if (item == nil) return YES; // Check the array to determine if it is expanded. @@ -427,7 +427,7 @@ static NSImage *unexpandable = nil; */ - (int)levelForItem: (id)item { - if(item != nil) + if (item != nil) { id object = NSMapGet(_levelOfItems, item); return [object intValue]; @@ -522,7 +522,7 @@ static NSImage *unexpandable = nil; - (int)rowForItem: (id)item { int row; - if(item == nil) + if (item == nil) return -1; row = [_items indexOfObject: item]; @@ -546,13 +546,13 @@ static NSImage *unexpandable = nil; */ - (void)setAutosaveExpandedItems: (BOOL)flag { - if(flag == _autosaveExpandedItems) + if (flag == _autosaveExpandedItems) { return; } _autosaveExpandedItems = flag; - if(flag) + if (flag) { [self _autoloadExpandedItems]; // notify when an item expands... @@ -693,17 +693,17 @@ static NSImage *unexpandable = nil; - (void) reloadData { // release the old array - if(_items != nil) + if (_items != nil) { RELEASE(_items); } - if(_itemDict != NULL) + if (_itemDict != NULL) { NSFreeMapTable(_itemDict); } - if(_levelOfItems != NULL) + if (_levelOfItems != NULL) { NSFreeMapTable(_levelOfItems); } @@ -859,7 +859,7 @@ static NSImage *unexpandable = nil; /* Using columnAtPoint: here would make it called twice per row per drawn rect - so we avoid it and do it natively */ - if(rowIndex >= _numberOfRows) + if (rowIndex >= _numberOfRows) { return; } @@ -906,7 +906,7 @@ static NSImage *unexpandable = nil; drawingRect = [self frameOfCellAtColumn: i row: rowIndex]; - if(tb == _outlineTableColumn) + if (tb == _outlineTableColumn) { NSImage *image = nil; int level = 0; @@ -914,7 +914,7 @@ static NSImage *unexpandable = nil; // float originalWidth = drawingRect.size.width; // display the correct arrow... - if([self isItemExpanded: item]) + if ([self isItemExpanded: item]) { image = expanded; } @@ -923,7 +923,7 @@ static NSImage *unexpandable = nil; image = collapsed; } - if(![self isExpandable: item]) + if (![self isExpandable: item]) { image = unexpandable; } @@ -932,7 +932,7 @@ static NSImage *unexpandable = nil; indentationFactor = _indentationPerLevel * level; imageCell = [[NSCell alloc] initImageCell: image]; - if(_indentationMarkerFollowsCell) + if (_indentationMarkerFollowsCell) { imageRect.origin.x = drawingRect.origin.x + indentationFactor; imageRect.origin.y = drawingRect.origin.y; @@ -952,7 +952,7 @@ static NSImage *unexpandable = nil; } /* Do not indent if the delegate set the image to nil. */ - if ( [imageCell image] ) + if ([imageCell image]) { imageRect.size.width = [image size].width; imageRect.size.height = [image size].height; @@ -978,17 +978,17 @@ static NSImage *unexpandable = nil; { int index = 0; - if(_autoResizesOutlineColumn) + if (_autoResizesOutlineColumn) { float widest = 0; - for(index = 0;index < _numberOfRows; index++) + for (index = 0;index < _numberOfRows; index++) { float offset = [self levelForRow: index] * [self indentationPerLevel]; NSRect drawingRect = [self frameOfCellAtColumn: 0 row: index]; float length = drawingRect.size.width + offset; - if(widest < length) widest = length; + if (widest < length) widest = length; } // [_outlineTableColumn setWidth: widest]; } @@ -1063,7 +1063,7 @@ static NSImage *unexpandable = nil; if ((verticalQuarterPosition - oldProposedDropRow * 4 <= 2) && - (verticalQuarterPosition - oldProposedDropRow * 4 >= -3) ) + (verticalQuarterPosition - oldProposedDropRow * 4 >= -3)) { row = oldProposedDropRow; } @@ -1129,7 +1129,7 @@ static NSImage *unexpandable = nil; int i; int j = 0; int lvl; - for ( i = row - 1; i >= 0; i-- ) + for (i = row - 1; i >= 0; i--) { lvl = [self levelForRow: i]; if (lvl == level - 1) @@ -1268,7 +1268,7 @@ static NSImage *unexpandable = nil; { int lvl, i, j = 0; - for ( i = currentDropRow - 1; i >= 0; i-- ) + for (i = currentDropRow - 1; i >= 0; i--) { lvl = [self levelForRow: i]; if (lvl == currentDropLevel - 1) @@ -1410,7 +1410,7 @@ static NSImage *unexpandable = nil; _textObject = [_editedCell setUpFieldEditorAttributes: t]; // determine which image to use... - if([self isItemExpanded: item]) + if ([self isItemExpanded: item]) { image = expanded; } @@ -1419,7 +1419,7 @@ static NSImage *unexpandable = nil; image = collapsed; } - if(![self isExpandable: item]) + if (![self isExpandable: item]) { image = unexpandable; } @@ -1428,7 +1428,7 @@ static NSImage *unexpandable = nil; [self lockFocus]; - if(tb == [self outlineTableColumn]) + if (tb == [self outlineTableColumn]) { level = [self levelForItem: item]; indentationFactor = _indentationPerLevel * level; @@ -1437,7 +1437,7 @@ static NSImage *unexpandable = nil; // create the image cell.. imageCell = [[NSCell alloc] initImageCell: image]; - if(_indentationMarkerFollowsCell) + if (_indentationMarkerFollowsCell) { imageRect.origin.x = drawingRect.origin.x + indentationFactor; imageRect.origin.y = drawingRect.origin.y; @@ -1606,7 +1606,7 @@ static NSImage *unexpandable = nil; NSMutableArray *itemArray = [NSMutableArray arrayWithCapacity: count]; - for ( i = 0; i < count; i++ ) + for (i = 0; i < count; i++) { [itemArray addObject: [self itemAtRow: @@ -1634,7 +1634,7 @@ static NSImage *unexpandable = nil; { id result = nil; - if([_dataSource respondsToSelector: + if ([_dataSource respondsToSelector: @selector(outlineView:objectValueForTableColumn:byItem:)]) { id item = [self itemAtRow: index]; @@ -1651,7 +1651,7 @@ static NSImage *unexpandable = nil; forTableColumn: (NSTableColumn *)tb row: (int) index { - if([_dataSource respondsToSelector: + if ([_dataSource respondsToSelector: @selector(outlineView:setObjectValue:forTableColumn:byItem:)]) { id item = [self itemAtRow: index]; @@ -1723,7 +1723,7 @@ static NSImage *unexpandable = nil; id anitem = [anarray objectAtIndex: i]; // Only collect the children if the item is expanded - if([self isItemExpanded: startitem]) + if ([self isItemExpanded: startitem]) { [allChildren addObject: anitem]; } @@ -1772,14 +1772,14 @@ static NSImage *unexpandable = nil; numchildren = [removeAll count]; // close the item... - if(item != nil) + if (item != nil) { [_expandedItems removeObject: item]; } // For the close method it doesn't matter what order they are // removed in. - for(i=0; i < numchildren; i++) + for (i=0; i < numchildren; i++) { id child = [removeAll objectAtIndex: i]; [_items removeObject: child]; @@ -1798,13 +1798,13 @@ static NSImage *unexpandable = nil; numchildren = [object count]; // open the item... - if(item != nil) + if (item != nil) { [_expandedItems addObject: item]; } insertionPoint = [_items indexOfObject: item]; - if(insertionPoint == NSNotFound) + if (insertionPoint == NSNotFound) { insertionPoint = 0; } @@ -1813,20 +1813,20 @@ static NSImage *unexpandable = nil; insertionPoint++; } - for(i=numchildren-1; i >= 0; i--) + for (i=numchildren-1; i >= 0; i--) { id obj = NSMapGet(_itemDict, sitem); id child = [obj objectAtIndex: i]; // Add all of the children... - if([self isItemExpanded: child]) + if ([self isItemExpanded: child]) { NSMutableArray *insertAll = [NSMutableArray array]; int i = 0, numitems = 0; [self _collectItemsStartingWith: child into: insertAll]; numitems = [insertAll count]; - for(i = numitems-1; i >= 0; i--) + for (i = numitems-1; i >= 0; i--) { [_items insertObject: [insertAll objectAtIndex: i] atIndex: insertionPoint]; diff --git a/Source/NSPageLayout.m b/Source/NSPageLayout.m index 9ea4cca42..29e6bf289 100644 --- a/Source/NSPageLayout.m +++ b/Source/NSPageLayout.m @@ -232,7 +232,7 @@ enum { principalClass = [[GSPrinting printingBundle] principalClass]; - if( principalClass == nil ) + if (principalClass == nil) return nil; return [[principalClass pageLayoutClass] allocWithZone: zone]; @@ -481,13 +481,13 @@ enum { customPapers = [globalDomain objectForKey: @"GSPageLayoutCustomPaperSizes"]; - if( customPapers ) + if (customPapers) { customPapers = [customPapers mutableCopy]; } else { - customPapers = RETAIN( [NSMutableDictionary dictionary] ); + customPapers = RETAIN([NSMutableDictionary dictionary]); } } @@ -499,7 +499,7 @@ enum { //an ivar. { int n; - for( n = 100; n <= 105; n++ ) + for (n = 100; n <= 105; n++) { NSTextField *textField; textField = [[[tabView tabViewItemAtIndex:1] view] viewWithTag: n]; @@ -522,8 +522,8 @@ enum { -(void) dealloc { - RELEASE( customPapers ); - RELEASE( measurementString ); + RELEASE(customPapers); + RELEASE(measurementString); [super release]; } @@ -576,7 +576,7 @@ enum { -(void) paperRadioMatrixClicked: (id) sender { - if( [sender selectedRow] == 0) //Standard Paper Sizes + if ([sender selectedRow] == 0) //Standard Paper Sizes { [customPaperSizePopUp setEnabled: NO]; [standardPaperSizePopUp setEnabled: YES]; @@ -616,29 +616,29 @@ enum { string = [defaults objectForKey: @"NSMeasurementUnit"]; NSLog(@"NSMeasurementUnit is %@", string); - if( string == nil ) //default to cm, most of the world is metric... + if (string == nil) //default to cm, most of the world is metric... { measurementString = @"cm"; factorValue = 2.54/72.0; } else { - if( [string caseInsensitiveCompare: @"CENTIMETERS"] == NSOrderedSame ) + if ([string caseInsensitiveCompare: @"CENTIMETERS"] == NSOrderedSame) { measurementString = @"cm"; factorValue = 2.54/72.0; } - else if( [string caseInsensitiveCompare: @"INCHES"] == NSOrderedSame ) + else if ([string caseInsensitiveCompare: @"INCHES"] == NSOrderedSame) { measurementString = @"in"; factorValue = 1.0/72.0; } - else if( [string caseInsensitiveCompare: @"POINTS"] == NSOrderedSame ) + else if ([string caseInsensitiveCompare: @"POINTS"] == NSOrderedSame) { measurementString = @"pt"; factorValue = 1.0; } - else if( [string caseInsensitiveCompare: @"PICAS"] == NSOrderedSame ) + else if ([string caseInsensitiveCompare: @"PICAS"] == NSOrderedSame) { measurementString = @"pi"; factorValue = 1.0/12.0; @@ -668,7 +668,7 @@ enum { printer = [NSPrinter printerWithName: [printerPopUp titleOfSelectedItem]]; //Get the paper name and size - if( [paperRadioMatrix selectedRow] == 0) //Standard Papers + if ([paperRadioMatrix selectedRow] == 0) //Standard Papers { paperName = [standardPaperSizePopUp titleOfSelectedItem]; paperSize = [printer pageSizeForPaper: paperName]; @@ -715,7 +715,7 @@ enum { -(void) setPrintInfo:(NSPrintInfo*)printInfo { - ASSIGN( _printInfo, printInfo); + ASSIGN(_printInfo, printInfo); } -(NSView*) accessoryView @@ -725,7 +725,7 @@ enum { -(void) setAccessoryView:(NSView*)accessoryView { - ASSIGN( _accessoryView, accessoryView); + ASSIGN(_accessoryView, accessoryView); } @@ -744,7 +744,7 @@ enum { //Fill in the printers printerNames = [NSPrinter printerNames]; - if( [printerNames count] == 0 ) //NO PRINTERS + if ([printerNames count] == 0) //NO PRINTERS { [printerPopUp addItemWithTitle: @"(none)"]; [printerPopUp setEnabled: NO]; @@ -786,7 +786,7 @@ enum { NSString *paperName; NSNumber *scaleNumber; - NSLog( @"readPrintInfo: %@", [[_printInfo dictionary] description]); + NSLog(@"readPrintInfo: %@", [[_printInfo dictionary] description]); printer = [_printInfo printer]; @@ -795,15 +795,15 @@ enum { //set the paper. Try to set the custom paper first. paperName = [_printInfo paperName]; - if(([customPaperSizePopUp isEnabled] == YES) && - ([customPaperSizePopUp indexOfItemWithTitle: paperName] != -1 )) + if (([customPaperSizePopUp isEnabled] == YES) && + ([customPaperSizePopUp indexOfItemWithTitle: paperName] != -1)) { [paperRadioMatrix selectCellAtRow: 1 column: 0]; [customPaperSizePopUp selectItemWithTitle: paperName]; } - else if( [standardPaperSizePopUp isEnabled] == YES) + else if ([standardPaperSizePopUp isEnabled] == YES) { [paperRadioMatrix selectCellAtRow: 0 column: 0]; @@ -812,7 +812,7 @@ enum { } //set the orientation - if( [_printInfo orientation] == NSPortraitOrientation) + if ([_printInfo orientation] == NSPortraitOrientation) { [paperOrientationMatrix selectCellAtRow: 0 column: 0]; @@ -846,7 +846,7 @@ enum { NSNumber *scaleNumber; //Write printer object - if( [printerPopUp isEnabled] == NO) //NO PRINTERS + if ([printerPopUp isEnabled] == NO) //NO PRINTERS { printer = nil; } @@ -857,13 +857,13 @@ enum { [_printInfo setPrinter: printer]; //write paper name - if(([paperRadioMatrix selectedRow] == 0) && + if (([paperRadioMatrix selectedRow] == 0) && ([standardPaperSizePopUp isEnabled] == YES)) //standard paper sizes { paperName = [standardPaperSizePopUp titleOfSelectedItem]; [_printInfo setPaperName: paperName]; } - else if(([paperRadioMatrix selectedRow] == 1) && + else if (([paperRadioMatrix selectedRow] == 1) && ([customPaperSizePopUp isEnabled] == YES)) //custom paper size { NSDictionary *customPaper; @@ -896,7 +896,7 @@ enum { } //Write orientation - if( [paperOrientationMatrix selectedColumn] == 0) + if ([paperOrientationMatrix selectedColumn] == 0) { [_printInfo setOrientation: NSPortraitOrientation]; } @@ -910,7 +910,7 @@ enum { [[_printInfo dictionary] setObject: scaleNumber forKey: NSPrintScalingFactor]; - NSLog( @"writePrintInfo: %@", [[_printInfo dictionary] description]); + NSLog(@"writePrintInfo: %@", [[_printInfo dictionary] description]); } @@ -943,7 +943,7 @@ enum { //NSTableView datasource handlers -(int) numberOfRowsInTableView:(NSTableView*) tableView { - if( tableView == customPaperTableView) + if (tableView == customPaperTableView) { return [customPapers count]; } @@ -958,16 +958,16 @@ enum { objectValueForTableColumn: (NSTableColumn*) tableColumn row: (int) index { - if( tableView == customPaperTableView) + if (tableView == customPaperTableView) { return [[customPapers allKeys] objectAtIndex: index]; } else //summaryTableView { - if( tableColumn == summarySettingColumn ) + if (tableColumn == summarySettingColumn) { - switch( index ) + switch(index) { case 0: return @"Name"; case 1: return @"Dimensions"; @@ -991,7 +991,7 @@ enum { printerName = [printerPopUp titleOfSelectedItem]; printer = [NSPrinter printerWithName: printerName]; - if( [paperRadioMatrix selectedRow] == 0 ) //standard papers + if ([paperRadioMatrix selectedRow] == 0) //standard papers { NSRect imageRect; NSSize paperSize; @@ -1017,14 +1017,14 @@ enum { rightMargin = [[customPapers objectForKey: @"RightMargin"] doubleValue]; } - switch( index ) + switch(index) { case 0: return paperName; case 1: return [dimensionsTextField stringValue]; case 2: - if( [paperOrientationMatrix selectedColumn] == 0) + if ([paperOrientationMatrix selectedColumn] == 0) { return @"Portrait"; } @@ -1058,7 +1058,7 @@ enum { -(void) tabView: (NSTabView*) tabView willSelectTabViewItem: (NSTabViewItem*) tabViewItem { - if( tabViewItem == summaryTabViewItem ) + if (tabViewItem == summaryTabViewItem) { [summaryTableView sizeToFit]; } @@ -1109,7 +1109,7 @@ enum { //Figure out if we we should scale according to the //the width or the height // - if( _paperSize.width >= _paperSize.height) + if (_paperSize.width >= _paperSize.height) { ratio = _paperSize.height/ _paperSize.width; width = bounds.size.width; @@ -1132,7 +1132,7 @@ enum { paper.size.height = height; shadow = paper; - if( [self isFlipped] == NO) + if ([self isFlipped] == NO) shadow.origin.y -= 2; else shadow.origin.y += 2; @@ -1152,7 +1152,7 @@ enum { [NSBezierPath strokeRect: paper]; //Draw the margins? - if( _drawsMargins == YES ) + if (_drawsMargins == YES) { NSRect margins; double scale; diff --git a/Source/NSPrintInfo.m b/Source/NSPrintInfo.m index 2b37a2334..623221eac 100644 --- a/Source/NSPrintInfo.m +++ b/Source/NSPrintInfo.m @@ -84,7 +84,7 @@ static NSPrintInfo *sharedPrintInfo = nil; principalClass = [[GSPrinting printingBundle] principalClass]; - if( principalClass == nil ) + if (principalClass == nil) return nil; return [[principalClass printInfoClass] allocWithZone: zone]; @@ -124,7 +124,7 @@ static NSPrintInfo *sharedPrintInfo = nil; principalClass = [[GSPrinting printingBundle] principalClass]; - if( principalClass == nil ) + if (principalClass == nil) return nil; return [[principalClass printInfoClass] defaultPrinter]; @@ -136,7 +136,7 @@ static NSPrintInfo *sharedPrintInfo = nil; principalClass = [[GSPrinting printingBundle] principalClass]; - if( principalClass == nil ) + if (principalClass == nil) return; [[principalClass printInfoClass] setDefaultPrinter: printer]; @@ -195,18 +195,18 @@ static NSPrintInfo *sharedPrintInfo = nil; - if( aDict != nil ) + if (aDict != nil) { [_info addEntriesFromDictionary: aDict]; - if([[_info objectForKey: NSPrintPrinter] isKindOfClass: [NSString class]]) + if ([[_info objectForKey: NSPrintPrinter] isKindOfClass: [NSString class]]) { NSString *printerName; printerName = [_info objectForKey: NSPrintPrinter]; printer = [NSPrinter printerWithName: printerName]; - if( printer ) + if (printer) [self setPrinter: printer]; else [_info removeObjectForKey: NSPrintPrinter]; @@ -456,7 +456,7 @@ static NSPrintInfo *sharedPrintInfo = nil; printerName = [_info objectForKey: NSPrintPrinter]; printer = [NSPrinter printerWithName: printerName]; - if( printer ) + if (printer) [self setPrinter: printer]; else [_info removeObjectForKey: NSPrintPrinter]; diff --git a/Source/NSPrintOperation.m b/Source/NSPrintOperation.m index a473f66de..0ad93a508 100644 --- a/Source/NSPrintOperation.m +++ b/Source/NSPrintOperation.m @@ -879,7 +879,7 @@ scaleRect(NSRect rect, double scale) { viewPageRange = NSMakeRange(1, (info.xpages * info.ypages)); } - [dict setObject: NSNUMBER(NSMaxRange(viewPageRange) ) + [dict setObject: NSNUMBER(NSMaxRange(viewPageRange)) forKey: @"NSPrintTotalPages"]; if (allPages == YES) { @@ -986,7 +986,7 @@ scaleRect(NSRect rect, double scale) } /* Print each page */ /* Make sure we end the sheet */ - if ( info.nup > 1 && (info.last - info.first) % info.nup != info.nup - 1 ) + if (info.nup > 1 && (info.last - info.first) % info.nup != info.nup - 1) { [_view drawSheetBorderWithSize: info.paperBounds.size]; [_view _endSheet]; @@ -1082,7 +1082,7 @@ scaleRect(NSRect rect, double scale) [self endPage]; /* End a physical page */ - if ( ((currentPage - info.first) % info.nup == info.nup-1) ) + if (((currentPage - info.first) % info.nup == info.nup-1)) { [self drawSheetBorderWithSize: info.paperBounds.size]; [self _endSheet]; diff --git a/Source/NSPrintPanel.m b/Source/NSPrintPanel.m index ee1b7f6cf..27e5ff989 100644 --- a/Source/NSPrintPanel.m +++ b/Source/NSPrintPanel.m @@ -85,7 +85,7 @@ static NSPrintPanel *shared_instance; principalClass = [[GSPrinting printingBundle] principalClass]; - if( principalClass == nil ) + if (principalClass == nil) return nil; return [[principalClass printPanelClass] allocWithZone: zone]; @@ -273,7 +273,7 @@ static NSPrintPanel *shared_instance; { _picked = NSPPPreviewButton; } - else if (tag ==NSFaxButton ) + else if (tag ==NSFaxButton) { _picked = NSFaxButton; NSRunAlertPanel(@"Sorry", @"Faxing of print file not implemented", diff --git a/Source/NSPrinter.m b/Source/NSPrinter.m index cbdc9f05e..4521226c8 100644 --- a/Source/NSPrinter.m +++ b/Source/NSPrinter.m @@ -121,7 +121,7 @@ static NSMutableDictionary* printerCache; // Initial version [self setVersion:1]; } - printerCache = RETAIN( [NSMutableDictionary dictionary] ); + printerCache = RETAIN([NSMutableDictionary dictionary]); } /** Load the appropriate bundle for the Printer @@ -133,7 +133,7 @@ static NSMutableDictionary* printerCache; principalClass = [[GSPrinting printingBundle] principalClass]; - if( principalClass == nil ) + if (principalClass == nil) return nil; return [[principalClass printerClass] allocWithZone: zone]; @@ -152,23 +152,23 @@ static NSMutableDictionary* printerCache; //First, the cache has to be managed. //Take into account any deleted printers. keyEnum = [[printerCache allKeys] objectEnumerator]; - while( (key = [keyEnum nextObject]) ) + while ((key = [keyEnum nextObject])) { NSEnumerator *namesEnum; NSString *validName; BOOL stillValid = NO; namesEnum = [[self printerNames] objectEnumerator]; - while( (validName = [namesEnum nextObject]) ) + while ((validName = [namesEnum nextObject])) { - if( [validName isEqualToString: key] ) + if ([validName isEqualToString: key]) { stillValid = YES; break; } } - if( stillValid == NO ) + if (stillValid == NO) { [printerCache removeObjectForKey: key]; } @@ -176,7 +176,7 @@ static NSMutableDictionary* printerCache; printer = [printerCache objectForKey: name]; - if( printer ) + if (printer) { return printer; } @@ -186,12 +186,12 @@ static NSMutableDictionary* printerCache; principalClass = [[GSPrinting printingBundle] principalClass]; - if( principalClass == nil ) + if (principalClass == nil) return nil; printer = [[principalClass printerClass] printerWithName: name]; - if( printer ) + if (printer) { [printerCache setObject: printer forKey: name]; @@ -225,13 +225,13 @@ static NSMutableDictionary* printerCache; printerNamesEnum = [[self printerNames] objectEnumerator]; - while( (printerName = [printerNamesEnum nextObject]) ) + while ((printerName = [printerNamesEnum nextObject])) { NSPrinter *printer; printer = [self printerWithName: printerName]; - if( [[printer type] isEqualToString: type] ) + if ([[printer type] isEqualToString: type]) { return printer; } @@ -246,7 +246,7 @@ static NSMutableDictionary* printerCache; principalClass = [[GSPrinting printingBundle] principalClass]; - if( principalClass == nil ) + if (principalClass == nil) return nil; return [[principalClass printerClass] printerNames]; @@ -265,7 +265,7 @@ static NSMutableDictionary* printerCache; printerNamesEnum = [[self printerNames] objectEnumerator]; - while( (printerName = [printerNamesEnum nextObject]) ) + while ((printerName = [printerNamesEnum nextObject])) { printer = [self printerWithName: printerName]; @@ -319,12 +319,12 @@ static NSMutableDictionary* printerCache; protocols = [NSScanner scannerWithString: result]; - while( ![protocols isAtEnd] ) + while (![protocols isAtEnd]) { [protocols scanUpToCharactersFromSet: [NSCharacterSet whitespaceCharacterSet] intoString: &result]; - if ( [result isEqual:@"BCP"] ) + if ([result isEqual:@"BCP"]) return YES; } @@ -383,7 +383,7 @@ static NSMutableDictionary* printerCache; if (!result) return NO; - if ( [result caseInsensitiveCompare: @"REVERSE"] == NSOrderedSame) + if ([result caseInsensitiveCompare: @"REVERSE"] == NSOrderedSame) return YES; else return NO; @@ -415,7 +415,7 @@ static NSMutableDictionary* printerCache; result = [NSMutableDictionary dictionary]; - if( [self isKey: @"DefaultResolution" + if ([self isKey: @"DefaultResolution" inTable:@"PPD"]) { int dpi = [self intForKey: @"DefaultResolution" @@ -425,7 +425,7 @@ static NSMutableDictionary* printerCache; forKey: NSDeviceResolution]; } - if( [self isKey: @"ColorDevice" + if ([self isKey: @"ColorDevice" inTable: @"PPD"]) { BOOL color = [self booleanForKey: @"ColorDevice" @@ -434,7 +434,7 @@ static NSMutableDictionary* printerCache; // FIXME: Should NSDeviceWhiteColorSpace be NSDeviceBlackColorSpace? // FIXME #2: Are they calibrated? // Basically I'm not sure which color spaces should be used... - if( color == YES ) + if (color == YES) { [result setObject: NSDeviceCMYKColorSpace forKey: NSDeviceColorSpaceName]; @@ -446,8 +446,8 @@ static NSMutableDictionary* printerCache; } } - if( [self isKey: @"DefaultBitsPerPixel" - inTable: @"PPD"] ) + if ([self isKey: @"DefaultBitsPerPixel" + inTable: @"PPD"]) { int bits = [self intForKey: @"DefaultBitsPerPixel" inTable: @"PPD"]; @@ -456,13 +456,13 @@ static NSMutableDictionary* printerCache; forKey: NSDeviceBitsPerSample]; } - if( [self isKey: @"DefaultPageSize" - inTable: @"PPD"] ) + if ([self isKey: @"DefaultPageSize" + inTable: @"PPD"]) { NSString* defaultPageSize = [self stringForKey: @"DefaultPageSize" inTable: @"PPD"]; - if( defaultPageSize ) + if (defaultPageSize) { NSSize paperSize = [self pageSizeForPaper: defaultPageSize]; @@ -567,7 +567,7 @@ static NSMutableDictionary* printerCache; results = [self stringListForKey: key inTable: table]; - if( results == nil) + if (results == nil) return nil; return [results objectAtIndex: 0]; @@ -584,7 +584,7 @@ static NSMutableDictionary* printerCache; tableObj = [_tables objectForKey: table ]; - if( tableObj == nil ) + if (tableObj == nil) { [NSException raise: NSGenericException format: @"Could not find table %@", table]; @@ -610,7 +610,7 @@ static NSMutableDictionary* printerCache; // Select correct table tableObj = [_tables objectForKey: table]; - if( tableObj == nil ) + if (tableObj == nil) return NSPrinterTableNotFound; else return NSPrinterTableOK; @@ -627,7 +627,7 @@ static NSMutableDictionary* printerCache; // Select correct table tableObj = [_tables objectForKey: table]; - if( tableObj == nil ) + if (tableObj == nil) { [NSException raise: NSGenericException format: @"Could not find table %@", table]; @@ -635,7 +635,7 @@ static NSMutableDictionary* printerCache; } // And check it - if ( [tableObj objectForKey: key] == nil) + if ([tableObj objectForKey: key] == nil) return NO; else return YES; @@ -690,7 +690,7 @@ static NSMutableDictionary* printerCache; ASSIGN(_printerHost, host); ASSIGN(_printerNote, note); - _tables = RETAIN( [NSMutableDictionary dictionary] ); + _tables = RETAIN([NSMutableDictionary dictionary]); return self; } @@ -723,28 +723,28 @@ static NSMutableDictionary* printerCache; NSMutableArray* valArray; //make sure the class variables for scanning are created - if( !newlineSet) + if (!newlineSet) { newlineSet = [NSCharacterSet characterSetWithCharactersInString: @"\n\r"]; - RETAIN( newlineSet ); + RETAIN(newlineSet); } - if( !keyEndSet ) + if (!keyEndSet) { keyEndSet = [NSCharacterSet characterSetWithCharactersInString: @"\n\r\t: "]; - RETAIN( keyEndSet ); + RETAIN(keyEndSet); } - if( !optKeyEndSet ) + if (!optKeyEndSet) { optKeyEndSet = [NSCharacterSet characterSetWithCharactersInString: @"\n\r:/"]; - RETAIN( optKeyEndSet ); + RETAIN(optKeyEndSet); } - if( !valueEndSet ) + if (!valueEndSet) { valueEndSet = [NSCharacterSet characterSetWithCharactersInString: @"\n\r/"]; - RETAIN( valueEndSet ); + RETAIN(valueEndSet); } @@ -786,24 +786,24 @@ static NSMutableDictionary* printerCache; // Search the PPD dictionary for symbolvalues and substitute them. objEnum = [[_tables objectForKey: @"PPD"] objectEnumerator]; - while( (valArray = [objEnum nextObject]) ) + while ((valArray = [objEnum nextObject])) { NSString *oldValue; NSString *newValue; int i, max; max = [valArray count]; - for( i=0 ; i < max ; i++ ) + for (i=0 ; i < max ; i++) { oldValue = [valArray objectAtIndex: i]; - if( [oldValue isKindOfClass: [NSString class]] + if ([oldValue isKindOfClass: [NSString class]] && ![oldValue isEqual: @""] && [[oldValue substringToIndex: 1] isEqual: @"^"]) { newValue = [ppdSymbolValues objectForKey: [oldValue substringFromIndex: 1]]; - if( !newValue ) + if (!newValue) { [NSException raise: NSPPDParseException format: @"Unknown symbol value, ^%@ in PPD file %@.ppd", @@ -837,10 +837,10 @@ static NSMutableDictionary* printerCache; @"PPD-Adobe", nil] objectEnumerator]; - while( (checkVal = [objEnum nextObject]) ) + while ((checkVal = [objEnum nextObject])) { - if( ![self isKey: checkVal - inTable: @"PPD"] ) + if (![self isKey: checkVal + inTable: @"PPD"]) { [NSException raise:NSPPDParseException format:@"Required keyword *%@ not found in PPD file %@.ppd", @@ -850,7 +850,7 @@ static NSMutableDictionary* printerCache; */ // Release the local autoreleasePool - RELEASE( subpool ); + RELEASE(subpool); //Sometimes it's good to see the tables... @@ -914,7 +914,7 @@ static NSMutableDictionary* printerCache; [ppdData setCharactersToBeSkipped: [NSCharacterSet whitespaceCharacterSet]]; // Main processing starts here... - while( YES ) //Only check for the end after accounting for whitespace + while (YES) //Only check for the end after accounting for whitespace { // Get to the start of a new keyword, skipping blank lines [ppdData scanCharactersFromSet: @@ -922,12 +922,12 @@ static NSMutableDictionary* printerCache; intoString: NULL]; //this could be the end... - if( [ppdData isAtEnd] ) + if ([ppdData isAtEnd]) break; // All new entries should starts '*' - if( ![ppdData scanString: @"*" - intoString: NULL] ) + if (![ppdData scanString: @"*" + intoString: NULL]) { [NSException raise: NSPPDParseException format: @"Line not starting with * in PPD file %@", @@ -935,7 +935,7 @@ static NSMutableDictionary* printerCache; } // Skip lines starting '*%', '*End', '*SymbolLength', or '*SymbolEnd' - if ( [ppdData scanString: @"%" + if ([ppdData scanString: @"%" intoString: NULL] || [ppdData scanString: @"End" //if we get this there is problem, yes? intoString: NULL] @@ -954,24 +954,24 @@ static NSMutableDictionary* printerCache; intoString: &keyword]; // Loop if there is no value section, these keywords are ignored - if( [ppdData scanCharactersFromSet: newlineSet - intoString: NULL] ) + if ([ppdData scanCharactersFromSet: newlineSet + intoString: NULL]) { continue; } // Add the line to the relevant table - if( [keyword isEqual: @"OrderDependency"] ) + if ([keyword isEqual: @"OrderDependency"]) { [self addPPDOrderDependency: ppdData withPPDPath: ppdPath]; } - else if( [keyword isEqual: @"UIConstraints"] ) + else if ([keyword isEqual: @"UIConstraints"]) { [self addPPDUIConstraint: ppdData withPPDPath: ppdPath]; } - else if( [keyword isEqual: @"Include"] ) + else if ([keyword isEqual: @"Include"]) { NSFileManager *fileManager; NSString *fileName = nil; @@ -993,16 +993,16 @@ static NSMutableDictionary* printerCache; intoString: NULL]; //the fileName could be an absolute path or just a filename. - if( [fileManager fileExistsAtPath: fileName] ) + if ([fileManager fileExistsAtPath: fileName]) { //it was absolute, we are done path = fileName; } //it was not absolute. Check to see if it exists in the //directory of this ppd - else if( [fileManager fileExistsAtPath: + else if ([fileManager fileExistsAtPath: [[ppdPath stringByDeletingLastPathComponent] - stringByAppendingPathComponent: fileName] ] ) + stringByAppendingPathComponent: fileName] ]) { path = [[ppdPath stringByDeletingLastPathComponent] stringByAppendingPathComponent: fileName]; @@ -1022,7 +1022,7 @@ static NSMutableDictionary* printerCache; NSString *symbolName; NSString *symbolVal; - if( ![ppdData scanString: @"^" + if (![ppdData scanString: @"^" intoString: NULL]) { [NSException raise: NSPPDParseException @@ -1043,7 +1043,7 @@ static NSMutableDictionary* printerCache; [ppdData scanUpToString: @"\"" /*"*/ intoString: &symbolVal]; - if ( !symbolVal ) + if (!symbolVal) symbolVal = @""; [ppdData scanString: @"\"" /*"*/ @@ -1096,7 +1096,7 @@ static NSMutableDictionary* printerCache; [ppdData scanUpToCharactersFromSet: optKeyEndSet intoString: &optionKeyword]; - if( [ppdData scanCharactersFromSet: newlineSet + if ([ppdData scanCharactersFromSet: newlineSet intoString: NULL]) { [NSException raise: NSPPDParseException @@ -1104,8 +1104,8 @@ static NSMutableDictionary* printerCache; ppdPath]; } - if( [ppdData scanString: @"/" - intoString: NULL] ) + if ([ppdData scanString: @"/" + intoString: NULL]) { // Option keyword translation exists - scan it [ppdData scanUpToString: @":" @@ -1118,13 +1118,13 @@ static NSMutableDictionary* printerCache; // Read the value part // Values starting with a " are read until the second ", ignoring \n etc. - if( [ppdData scanString: @"\"" /*"*/ - intoString: NULL] ) + if ([ppdData scanString: @"\"" /*"*/ + intoString: NULL]) { [ppdData scanUpToString: @"\"" /*"*/ intoString: &value]; - if ( !value ) + if (!value) value = @""; [ppdData scanString: @"\"" /*"*/ @@ -1132,7 +1132,7 @@ static NSMutableDictionary* printerCache; // It is a QuotedValue if it's in quotes, and there is no option // key, or the main key is a *JCL keyword - if ( !optionKeyword || [[mainKeyword substringToIndex:3] + if (!optionKeyword || [[mainKeyword substringToIndex:3] isEqualToString: @"JCL"]) { value = [self interpretQuotedValue: value]; @@ -1145,8 +1145,8 @@ static NSMutableDictionary* printerCache; intoString: &value]; } // If there is a value translation, scan it - if( [ppdData scanString: @"/" - intoString: NULL] ) + if ([ppdData scanString: @"/" + intoString: NULL]) { [ppdData scanUpToCharactersFromSet: newlineSet intoString: &valueTranslation]; @@ -1165,15 +1165,15 @@ static NSMutableDictionary* printerCache; // If a keyword is read twice, 'first instance is correct', according to // the standard. // Finally, add the strings to the tables - if( optionKeyword ) + if (optionKeyword) { NSString *mainAndOptionKeyword; mainAndOptionKeyword=[mainKeyword stringByAppendingFormat: @"/%@", optionKeyword]; - if( [self isKey: mainAndOptionKeyword - inTable: @"PPD"] ) + if ([self isKey: mainAndOptionKeyword + inTable: @"PPD"]) { return; } @@ -1190,7 +1190,7 @@ static NSMutableDictionary* printerCache; // option keywords. // This is done by making the first item in the array an empty // string, which will be skipped by stringListForKey:, if necessary - if( ![[_tables objectForKey: @"PPD"] objectForKey: mainKeyword] ) + if (![[_tables objectForKey: @"PPD"] objectForKey: mainKeyword]) { [self addString: @"" forKey: mainKeyword @@ -1213,9 +1213,9 @@ static NSMutableDictionary* printerCache; } else { - if( [self isKey: mainKeyword + if ([self isKey: mainKeyword inTable: @"PPD"] && - ![repKeys containsObject: mainKeyword] ) + ![repKeys containsObject: mainKeyword]) { return; } @@ -1237,8 +1237,8 @@ static NSMutableDictionary* printerCache; NSString* optionKey2 = nil; // UIConstraint should have no option keyword - if( ![constraint scanString: @":" - intoString: NULL] ) + if (![constraint scanString: @":" + intoString: NULL]) { [NSException raise:NSPPDParseException format:@"UIConstraints has option keyword in PPD File %@", @@ -1253,8 +1253,8 @@ static NSMutableDictionary* printerCache; [constraint scanUpToCharactersFromSet: [NSCharacterSet whitespaceCharacterSet] intoString: &mainKey1]; - if( ![constraint scanString: @"*" - intoString: NULL] ) + if (![constraint scanString: @"*" + intoString: NULL]) { [constraint scanUpToCharactersFromSet: [NSCharacterSet whitespaceCharacterSet] intoString: &optionKey1]; @@ -1268,7 +1268,7 @@ static NSMutableDictionary* printerCache; [NSCharacterSet whitespaceAndNewlineCharacterSet] intoString: &mainKey2]; - if( ![constraint scanCharactersFromSet: newlineSet + if (![constraint scanCharactersFromSet: newlineSet intoString: NULL]) { [constraint scanUpToCharactersFromSet: @@ -1281,7 +1281,7 @@ static NSMutableDictionary* printerCache; } // Add to table - if( optionKey1 ) + if (optionKey1) mainKey1 = [mainKey1 stringByAppendingFormat: @"/%@", optionKey1]; [self addString: mainKey2 @@ -1305,7 +1305,7 @@ static NSMutableDictionary* printerCache; NSString *optionKeyword = nil; // Order dependency should have no option keyword - if( ![dependency scanString: @":" + if (![dependency scanString: @":" intoString: NULL]) { [NSException raise: NSPPDParseException @@ -1326,7 +1326,7 @@ static NSMutableDictionary* printerCache; [NSCharacterSet whitespaceAndNewlineCharacterSet] intoString: &keyword]; - if( ![dependency scanCharactersFromSet: newlineSet + if (![dependency scanCharactersFromSet: newlineSet intoString: NULL]) { // Optional keyword exists @@ -1340,7 +1340,7 @@ static NSMutableDictionary* printerCache; intoString: NULL]; // Add to table - if(optionKeyword) + if (optionKeyword) keyword = [keyword stringByAppendingFormat: @"/%@", optionKeyword]; [self addString: realValue @@ -1366,14 +1366,14 @@ static NSMutableDictionary* printerCache; forKey: key inTable: @"PPD"]; - if(valueTranslation) + if (valueTranslation) { [self addString: valueTranslation forKey: key inTable: @"PPDArgumentTranslation"]; } - if(optionTranslation) + if (optionTranslation) { [self addString: optionTranslation forKey: key @@ -1396,12 +1396,12 @@ static NSMutableDictionary* printerCache; tableObj = [_tables objectForKey: table]; - if( tableObj == nil ) - NSDebugMLLog( @"GSPrinting", @"Could not find table %@!", table); + if (tableObj == nil) + NSDebugMLLog(@"GSPrinting", @"Could not find table %@!", table); array = (NSMutableArray*)[tableObj objectForKey:key]; - if( array == nil ) //it does not exist, create it + if (array == nil) //it does not exist, create it { array = [NSMutableArray array]; [tableObj setObject: array @@ -1428,22 +1428,22 @@ static NSMutableDictionary* printerCache; // Don't bother unless there's something to convert range = [qString rangeOfString: @"<"]; - if( !range.length ) + if (!range.length) return qString; scanner = [NSScanner scannerWithString: qString]; emptySet = [NSCharacterSet characterSetWithCharactersInString: @""]; [scanner setCharactersToBeSkipped: emptySet]; - if( ![scanner scanUpToString: @"<" - intoString: &value] ) + if (![scanner scanUpToString: @"<" + intoString: &value]) { value = [NSString string]; } stringLength = [qString length]; - while ( ![scanner isAtEnd] ) + while (![scanner isAtEnd]) { [scanner scanString: @"<" intoString: NULL]; @@ -1451,11 +1451,11 @@ static NSMutableDictionary* printerCache; [scanner scanCharactersFromSet: [NSCharacterSet whitespaceAndNewlineCharacterSet] intoString: NULL]; - while( ![scanner scanString: @">" + while (![scanner scanString: @">" intoString: NULL]) { location = [scanner scanLocation]; - if( location+2 > stringLength ) + if (location+2 > stringLength) { [NSException raise: NSPPDParseException format: @"Badly formatted hexadecimal substring in \ @@ -1472,7 +1472,7 @@ static NSMutableDictionary* printerCache; intoString: NULL]; } - if([scanner scanUpToString:@"<" intoString:&part]) + if ([scanner scanUpToString:@"<" intoString:&part]) { value = [value stringByAppendingString: part]; } diff --git a/Source/NSResponder.m b/Source/NSResponder.m index f5b4866ff..6c89329f7 100644 --- a/Source/NSResponder.m +++ b/Source/NSResponder.m @@ -180,7 +180,7 @@ - (void) helpRequested: (NSEvent*)theEvent { - if(![[NSHelpManager sharedHelpManager] + if (![[NSHelpManager sharedHelpManager] showContextHelpForObject: self locationHint: [theEvent locationInWindow]]) if (_next_responder) @@ -338,20 +338,20 @@ */ - (void) encodeWithCoder: (NSCoder*)aCoder { - if([aCoder allowsKeyedCoding]) + if ([aCoder allowsKeyedCoding]) { - if(_interface_style != NSNoInterfaceStyle) + if (_interface_style != NSNoInterfaceStyle) { [aCoder encodeInt: _interface_style forKey: @"NSInterfaceStyle"]; } - if([self menu] != nil) + if ([self menu] != nil) { [aCoder encodeObject: [self menu] forKey: @"NSMenu"]; } - if([self nextResponder] != nil) + if ([self nextResponder] != nil) { [aCoder encodeConditionalObject: [self nextResponder] forKey: @"NSNextResponder"]; @@ -369,19 +369,19 @@ { id obj = nil; - if([aDecoder allowsKeyedCoding]) + if ([aDecoder allowsKeyedCoding]) { - if([aDecoder containsValueForKey: @"NSInterfaceStyle"]) + if ([aDecoder containsValueForKey: @"NSInterfaceStyle"]) { _interface_style = [aDecoder decodeIntForKey: @"NSInterfaceStyle"]; } - if([aDecoder containsValueForKey: @"NSMenu"]) + if ([aDecoder containsValueForKey: @"NSMenu"]) { obj = [aDecoder decodeObjectForKey: @"NSMenu"]; } - if([aDecoder containsValueForKey: @"NSNextResponder"]) + if ([aDecoder containsValueForKey: @"NSNextResponder"]) { [self setNextResponder: [aDecoder decodeObjectForKey: @"NSNextResponder"]]; } diff --git a/Source/NSRulerView.m b/Source/NSRulerView.m index b71265ce7..8dd20f352 100644 --- a/Source/NSRulerView.m +++ b/Source/NSRulerView.m @@ -466,7 +466,7 @@ static NSMutableDictionary *units = nil; /* test markers in reverse order so that markers drawn on top are tested before those underneath */ markerEnum = [_markers reverseObjectEnumerator]; - while ( (marker = [markerEnum nextObject]) != nil) + while ((marker = [markerEnum nextObject]) != nil) { if (NSMouseInRect (point, [marker imageRectInRuler], flipped)) { diff --git a/Source/NSSelection.m b/Source/NSSelection.m index 04596af31..1ad5b43cc 100644 --- a/Source/NSSelection.m +++ b/Source/NSSelection.m @@ -109,7 +109,7 @@ typedef enum // + (NSSelection *)allSelection { - if(!_sharedAllSelection) + if (!_sharedAllSelection) { _sharedAllSelection = [NSSelection _wellKnownSelection: "GNUstep All selection marker"]; @@ -120,7 +120,7 @@ typedef enum + (NSSelection *)currentSelection { - if(!_sharedCurrentSelection) + if (!_sharedCurrentSelection) { _sharedCurrentSelection = [NSSelection _wellKnownSelection: "GNUstep Current selection marker"]; @@ -131,7 +131,7 @@ typedef enum + (NSSelection *)emptySelection { - if(!_sharedEmptySelection) + if (!_sharedEmptySelection) { _sharedEmptySelection = [NSSelection _wellKnownSelection: "GNUstep Empty selection marker"]; @@ -230,7 +230,7 @@ typedef enum at: _descriptionData]; // if it's a well known selection then determine which one it is. - if(_isWellKnownSelection) + if (_isWellKnownSelection) { switch(_selectionType) { diff --git a/Source/NSSpellChecker.m b/Source/NSSpellChecker.m index 4eaff78ec..95e281bac 100644 --- a/Source/NSSpellChecker.m +++ b/Source/NSSpellChecker.m @@ -162,7 +162,7 @@ static int __documentTag = 0; + (NSSpellChecker *)sharedSpellChecker { // Create the shared instance. - if(__sharedSpellChecker == nil) + if (__sharedSpellChecker == nil) { __sharedSpellChecker = [[NSSpellChecker alloc] init]; } @@ -195,7 +195,7 @@ static int __documentTag = 0; // Start the service for this language proxy = [[NSApp _listener] _launchSpellCheckerForLanguage: language]; - if(proxy == nil) + if (proxy == nil) { NSLog(@"Failed to get the spellserver"); } @@ -217,12 +217,12 @@ static int __documentTag = 0; - (id)_serverProxy { - if(_serverProxy == nil) + if (_serverProxy == nil) { // Start the server and retain the reference to the // proxy. id proxy = [self _startServerForLanguage: _language]; - if(proxy != nil) + if (proxy != nil) { _serverProxy = proxy; RETAIN(_serverProxy); @@ -271,7 +271,7 @@ static int __documentTag = 0; // Load the gmodel file panel = [GSGuiBundle() pathForResource: @"GSSpellPanel" ofType: @"gorm" inDirectory: nil]; - if(![NSBundle loadNibFile: panel + if (![NSBundle loadNibFile: panel externalNameTable: [NSDictionary dictionaryWithObject: self forKey: @"NSOwner"] withZone: [self zone]]) { @@ -357,13 +357,13 @@ static int __documentTag = 0; _currentTag = tag; // We have no string to work with - if(stringToCheck == nil) + if (stringToCheck == nil) { return NSMakeRange(0,0); } else // The string is zero length - if([stringToCheck length] == 0) + if ([stringToCheck length] == 0) { return NSMakeRange(0,0); } @@ -385,14 +385,14 @@ static int __documentTag = 0; wordCount: wordCount countOnly: NO]; - if(r.length != 0) + if (r.length != 0) { // Adjust results relative to the original string r.location += startingOffset; } else { - if(wrapFlag) + if (wrapFlag) { // Check the second half of the string NSString *firstHalfOfString = [stringToCheck @@ -449,7 +449,7 @@ static int __documentTag = 0; BOOL result = NO; index = [_dictionaryPulldown indexOfItemWithTitle: aLanguage]; - if(index != -1) + if (index != -1) { [_dictionaryPulldown selectItemAtIndex: index]; result = YES; @@ -477,10 +477,10 @@ inSpellDocumentWithTag:(int)tag NSNumber *key = [NSNumber numberWithInt: tag]; NSMutableSet *words = [_ignoredWords objectForKey: key]; - if(![wordToIgnore isEqualToString: @""]) + if (![wordToIgnore isEqualToString: @""]) { // If there is a dictionary add to it, if not create one. - if(words == nil) + if (words == nil) { words = [NSMutableSet setWithObject: wordToIgnore]; [_ignoredWords setObject: words forKey: key]; @@ -536,7 +536,7 @@ inSpellDocumentWithTag:(int)tag to: nil from: _spellPanel]; - if(!processed) + if (!processed) { NSLog(@"No responder found"); } @@ -595,7 +595,7 @@ inSpellDocumentWithTag:(int)tag to: nil from: _wordField]; - if(!processed) + if (!processed) { NSLog(@"_ignore: No responder found"); } @@ -618,7 +618,7 @@ inSpellDocumentWithTag:(int)tag to: nil from: _wordField]; - if(!processed) + if (!processed) { NSLog(@"No responder found"); } @@ -634,11 +634,11 @@ inSpellDocumentWithTag:(int)tag // Start the service for this language language = [_dictionaryPulldown stringValue]; - if(![language isEqualToString: _language]) + if (![language isEqualToString: _language]) { NSLog(@"Language = %@",language); proxy = [self _startServerForLanguage: language]; - if(proxy != nil) + if (proxy != nil) { ASSIGN(_language, language); ASSIGN(_serverProxy, proxy); @@ -716,7 +716,7 @@ inSpellDocumentWithTag:(int)tag NSBrowserCell *cell= nil; int i = 0; - while((word = [e nextObject]) != nil) + while ((word = [e nextObject]) != nil) { [matrix insertRow: i withCells: nil]; cell = [matrix cellAtRow: i column: 0]; diff --git a/Source/NSSpellServer.m b/Source/NSSpellServer.m index 02ea9dfba..d57026c6d 100644 --- a/Source/NSSpellServer.m +++ b/Source/NSSpellServer.m @@ -49,7 +49,7 @@ GSSpellServerName(NSString *vendor, NSString *language) { NSString *serverName = nil; - if(language == nil || vendor == nil) + if (language == nil || vendor == nil) { return nil; } @@ -111,13 +111,13 @@ GSSpellServerName(NSString *vendor, NSString *language) NSConnection *connection = nil; BOOL result = NO; - if(serverName == nil) + if (serverName == nil) { return NO; } connection = [[NSConnection alloc] init]; - if(connection) + if (connection) { RETAIN(connection); [connection setRootObject: self]; @@ -188,12 +188,12 @@ GSSpellServerName(NSString *vendor, NSString *language) if (![mgr fileExistsAtPath: path ]) { - if([mgr fileExistsAtPath: dirPath]) + if ([mgr fileExistsAtPath: dirPath]) { // The directory exists create the file. NSArray *emptyDict = [NSArray array]; - if(![emptyDict writeToFile: path atomically: YES]) + if (![emptyDict writeToFile: path atomically: YES]) { NSLog(@"Failed to create %@",path); path = nil; @@ -202,12 +202,12 @@ GSSpellServerName(NSString *vendor, NSString *language) else { // The directory does not exist create it. - if([mgr createDirectoryAtPath: dirPath attributes: nil]) + if ([mgr createDirectoryAtPath: dirPath attributes: nil]) { // Directory created. Now create the empty file. NSArray *emptyDict = [NSArray array]; - if(![emptyDict writeToFile: path atomically: YES]) + if (![emptyDict writeToFile: path atomically: YES]) { NSLog(@"Failed to create %@",path); path = nil; @@ -232,12 +232,12 @@ GSSpellServerName(NSString *vendor, NSString *language) NSString *path = nil; NSMutableSet *words = nil; - if((words = [_userDictionaries objectForKey: language]) == nil) + if ((words = [_userDictionaries objectForKey: language]) == nil) { - if((path = [self _pathToDictionary: language]) != nil) + if ((path = [self _pathToDictionary: language]) != nil) { NSArray *wordarray = [NSArray arrayWithContentsOfFile: path]; - if(wordarray == nil) + if (wordarray == nil) { NSLog(@"Unable to load user dictionary from path %@",path); } @@ -268,23 +268,23 @@ GSSpellServerName(NSString *vendor, NSString *language) NSEnumerator *setEnumerator = nil; // Catch the odd cases before they start trouble later on... - if(word == nil || dict == nil) + if (word == nil || dict == nil) { return NO; // avoid checking, if NIL. } - if([word length] == 0 || [dict count] == 0) + if ([word length] == 0 || [dict count] == 0) { return NO; // avoid checking, if has no length. } // Check the dictionary for the word... setEnumerator = [dict objectEnumerator]; - while((dictWord = [setEnumerator nextObject]) && result == NO) + while ((dictWord = [setEnumerator nextObject]) && result == NO) { // If the case is important then uppercase both strings // and compare, otherwise do the comparison. - if(flag == NO) + if (flag == NO) { NSString *upperWord = [word uppercaseString]; NSString *upperDictWord = [dictWord uppercaseString]; @@ -297,16 +297,16 @@ GSSpellServerName(NSString *vendor, NSString *language) } } - if(result == NO && _ignoredWords) + if (result == NO && _ignoredWords) { NSEnumerator *arrayEnumerator = [_ignoredWords objectEnumerator]; NSString *iword = nil; - while((iword = [arrayEnumerator nextObject]) && result == NO) + while ((iword = [arrayEnumerator nextObject]) && result == NO) { // If the case is important then uppercase both strings // and compare, otherwise do the comparison. - if(flag == NO) + if (flag == NO) { NSString *upperWord = [word uppercaseString]; NSString *upperIWord = [iword uppercaseString]; @@ -334,7 +334,7 @@ is a set of words learned by the spell service for that particular user. NSSet *userDict = [self _openUserDictionary: _currentLanguage]; BOOL result = NO; - if(userDict) + if (userDict) { result = [self _isWord: word inDictionary: userDict @@ -349,10 +349,10 @@ is a set of words learned by the spell service for that particular user. { NSString *path = nil; - if((path = [self _pathToDictionary: language]) != nil) + if ((path = [self _pathToDictionary: language]) != nil) { NSMutableSet *set = [_userDictionaries objectForKey: language]; - if(![[set allObjects] writeToFile: path atomically: YES]) + if (![[set allObjects] writeToFile: path atomically: YES]) { NSLog(@"Unable to save dictionary to path %@",path); return NO; diff --git a/Source/NSSplitView.m b/Source/NSSplitView.m index 0ed133311..af0caa4b0 100644 --- a/Source/NSSplitView.m +++ b/Source/NSSplitView.m @@ -514,7 +514,7 @@ static NSNotificationCenter *nc = nil; inMode: NSEventTrackingRunLoopMode dequeue: YES]; } - while(ee != nil); + while (ee != nil); } } @@ -883,7 +883,7 @@ static inline NSPoint centerSizeInRect(NSSize innerSize, NSRect outerRect) #define SET_DELEGATE_NOTIFICATION(notif_name) \ if ([_delegate respondsToSelector: @selector(splitView##notif_name:)]) \ [nc addObserver: _delegate \ - selector: @selector(splitView##notif_name: ) \ + selector: @selector(splitView##notif_name:) \ name: NSSplitView##notif_name##Notification \ object: self] diff --git a/Source/NSStepper.m b/Source/NSStepper.m index cc00e80a3..e2c7c22f4 100644 --- a/Source/NSStepper.m +++ b/Source/NSStepper.m @@ -172,10 +172,10 @@ id _nsstepperCellClass = nil; BOOL isDirectionUp; BOOL autorepeat = [_cell autorepeat]; - if([_cell isEnabled] == NO) + if ([_cell isEnabled] == NO) return; - if([event type] != NSLeftMouseDown) + if ([event type] != NSLeftMouseDown) return; upRect = [_cell upButtonRectWithFrame: _bounds]; @@ -232,7 +232,7 @@ id _nsstepperCellClass = nil; untilDate: farAway inMode: NSEventTrackingRunLoopMode dequeue: YES]; - while([event type] != NSLeftMouseUp) + while ([event type] != NSLeftMouseUp) { if ([event type] == NSPeriodic) { diff --git a/Source/NSTabView.m b/Source/NSTabView.m index d4c976677..047fa6f35 100644 --- a/Source/NSTabView.m +++ b/Source/NSTabView.m @@ -667,7 +667,7 @@ { NSTabViewItem *anItem = [_items objectAtIndex: i]; - if(NSPointInRect(point,[anItem _tabRect])) + if (NSPointInRect(point,[anItem _tabRect])) return anItem; } diff --git a/Source/NSTableView.m b/Source/NSTableView.m index 754c25e85..0d2bb9f42 100644 --- a/Source/NSTableView.m +++ b/Source/NSTableView.m @@ -142,10 +142,10 @@ void quick_sort_internal(columnSorting *data, int p, int r) int i = p - 1; int j = r + 1; columnSorting exchange; - while(1) + while (1) { j--; - for(; + for (; (data[j].width > x) || ((data[j].width == x) && (data[j].isMax == YES) @@ -154,14 +154,14 @@ void quick_sort_internal(columnSorting *data, int p, int r) ; i++; - for(; + for (; (data[i].width < x) || ((data[i].width == x) && (data[i].isMax == NO) && (y == YES)); i++) ; - if ( i < j ) + if (i < j) { exchange = data[j]; data[j] = data[i]; @@ -572,10 +572,10 @@ static void computeNewSelection } } - else if ( (selectionMode & ALLOWS_MULTIPLE) + else if ((selectionMode & ALLOWS_MULTIPLE) && ((selectionMode & SHIFT_DOWN) == 0) && (selectionMode & ALLOWS_EMPTY) - ) + ) // ic, sr : ok // new multiple selection (empty possible) { @@ -804,7 +804,7 @@ static void computeNewSelection && ((selectionMode & SHIFT_DOWN) == 0) && ((selectionMode & ALLOWS_EMPTY) == 0) && ((selectionMode & ADDING_ROW) == 0)) - ) + ) { if (_oldRow == -1) { @@ -1297,7 +1297,7 @@ static void computeNewSelection notified = YES; } } - if ( notified + if (notified && (*_selectedRow >= _originalRow) && (*_selectedRow <= _currentRow)) { @@ -1323,7 +1323,7 @@ static void computeNewSelection notified = YES; } } - if ( notified + if (notified && (*_selectedRow >= _originalRow) && (*_selectedRow <= _currentRow)) { @@ -1364,7 +1364,7 @@ static void computeNewSelection } } - if ( notified + if (notified && (*_selectedRow > _oldRow) && (*_selectedRow <= _currentRow)) { @@ -1422,7 +1422,7 @@ static void computeNewSelection } } - if ( notified + if (notified && (*_selectedRow < _oldRow) && (*_selectedRow >= _currentRow)) { @@ -1499,7 +1499,7 @@ static void computeNewSelection } } - if ( notified + if (notified && (*_selectedRow > _oldRow) && (*_selectedRow <= _currentRow)) { @@ -1551,7 +1551,7 @@ static void computeNewSelection } } - if ( notified + if (notified && (*_selectedRow > _oldRow) && (*_selectedRow <= _currentRow)) { @@ -1597,7 +1597,7 @@ static void computeNewSelection count--; } } - if ( notified + if (notified && (*_selectedRow >= _originalRow) && (*_selectedRow <= _currentRow)) { @@ -1625,7 +1625,7 @@ static void computeNewSelection count--; } } - if ( notified + if (notified && (*_selectedRow >= _originalRow) && (*_selectedRow <= _currentRow)) { @@ -1668,7 +1668,7 @@ static void computeNewSelection } } - if ( notified + if (notified && (*_selectedRow > _oldRow) && (*_selectedRow <= _currentRow)) { @@ -1728,7 +1728,7 @@ static void computeNewSelection } } - if ( notified + if (notified && (*_selectedRow < _oldRow) && (*_selectedRow >= _currentRow)) { @@ -1806,7 +1806,7 @@ static void computeNewSelection } } - if ( notified + if (notified && (*_selectedRow > _oldRow) && (*_selectedRow <= _currentRow)) { @@ -1859,7 +1859,7 @@ static void computeNewSelection } } - if ( notified + if (notified && (*_selectedRow > _oldRow) && (*_selectedRow <= _currentRow)) { @@ -4104,7 +4104,7 @@ static inline float computePeriod(NSPoint mouseLocationWin, remainingWidth -= (nextPoint - previousPoint) * numberOfCurrentColumns; - for(j = 0; j < _numberOfColumns; j++) + for (j = 0; j < _numberOfColumns; j++) { if (minWidth[j] <= previousPoint && maxWidth[j] >= nextPoint) @@ -4125,7 +4125,7 @@ static inline float computePeriod(NSPoint mouseLocationWin, int remainder = remainingInt - quotient * numberOfCurrentColumns; int oldRemainder = remainder; - for(j = _numberOfColumns - 1; j >= 0; j--) + for (j = _numberOfColumns - 1; j >= 0; j--) { if (minWidth[j] <= previousPoint && maxWidth[j] >= nextPoint) @@ -4142,7 +4142,7 @@ static inline float computePeriod(NSPoint mouseLocationWin, while (oldRemainder > remainder && remainder > 0) { oldRemainder = remainder; - for(j = 0; j < _numberOfColumns; j++) + for (j = 0; j < _numberOfColumns; j++) { if (minWidth[j] <= previousPoint && maxWidth[j] >= nextPoint) @@ -4865,14 +4865,14 @@ static inline float computePeriod(NSPoint mouseLocationWin, // Send action ? break; case NSTabTextMovement: - if([self _editNextEditableCellAfterRow: row column: column] == YES) + if ([self _editNextEditableCellAfterRow: row column: column] == YES) { break; } [_window selectKeyViewFollowingView: self]; break; case NSBacktabTextMovement: - if([self _editPreviousEditableCellBeforeRow: row column: column] == YES) + if ([self _editPreviousEditableCellBeforeRow: row column: column] == YES) { break; } @@ -5478,7 +5478,7 @@ static inline float computePeriod(NSPoint mouseLocationWin, fromView: _super_view].size.width; float table_width = 0; - if(_numberOfColumns > 0) + if (_numberOfColumns > 0) { table_width = _columnOrigins[_numberOfColumns - 1] + @@ -5496,20 +5496,20 @@ static inline float computePeriod(NSPoint mouseLocationWin, NSLog(@"_superview_width %f", _superview_width); */ - if ( table_width - _superview_width <= 0.001 - && table_width - _superview_width >= -0.001 ) + if (table_width - _superview_width <= 0.001 + && table_width - _superview_width >= -0.001) { // the last column had been sized to fit [self sizeToFit]; } - else if ( table_width <= _superview_width - && table_width >= visible_width ) + else if (table_width <= _superview_width + && table_width >= visible_width) { // the tableView was too small and is now too large [self sizeToFit]; } else if (table_width >= _superview_width - && table_width <= visible_width ) + && table_width <= visible_width) { // the tableView was too large and is now too small if (_numberOfColumns > 0) @@ -5524,7 +5524,7 @@ static inline float computePeriod(NSPoint mouseLocationWin, fromView: _super_view].size.width; float table_width = 0; - if(_numberOfColumns > 0) + if (_numberOfColumns > 0) { table_width = _columnOrigins[_numberOfColumns - 1] + @@ -5542,20 +5542,20 @@ static inline float computePeriod(NSPoint mouseLocationWin, NSLog(@"_superview_width %f", _superview_width); */ - if ( table_width - _superview_width <= 0.001 - && table_width - _superview_width >= -0.001 ) + if (table_width - _superview_width <= 0.001 + && table_width - _superview_width >= -0.001) { // the last column had been sized to fit [self sizeLastColumnToFit]; } - else if ( table_width <= _superview_width - && table_width >= visible_width ) + else if (table_width <= _superview_width + && table_width >= visible_width) { // the tableView was too small and is now too large [self sizeLastColumnToFit]; } else if (table_width >= _superview_width - && table_width <= visible_width ) + && table_width <= visible_width) { // the tableView was too large and is now too small if (_numberOfColumns > 0) @@ -5624,7 +5624,7 @@ static inline float computePeriod(NSPoint mouseLocationWin, quarterPosition = (p.y - _bounds.origin.y) / _rowHeight * 4.; if ((quarterPosition - oldDropRow * 4 <= 2) && - (quarterPosition - oldDropRow * 4 >= -3) ) + (quarterPosition - oldDropRow * 4 >= -3)) { row = oldDropRow; } @@ -5634,7 +5634,7 @@ static inline float computePeriod(NSPoint mouseLocationWin, } // Are we in the two middle quarters of the row? Use TableViewDropOn - if(positionInRow > _rowHeight/4 && positionInRow <= (3*_rowHeight)/4) + if (positionInRow > _rowHeight/4 && positionInRow <= (3*_rowHeight)/4) { currentDropRow = (int)(p.y - _bounds.origin.y) / (int)_rowHeight; currentDropOperation = NSTableViewDropOn; @@ -5906,7 +5906,7 @@ static inline float computePeriod(NSPoint mouseLocationWin, { id result = nil; - if([_dataSource respondsToSelector: + if ([_dataSource respondsToSelector: @selector(tableView:objectValueForTableColumn:row:)]) { result = [_dataSource tableView: self @@ -5921,7 +5921,7 @@ static inline float computePeriod(NSPoint mouseLocationWin, forTableColumn: (NSTableColumn *)tb row: (int) index { - if([_dataSource respondsToSelector: + if ([_dataSource respondsToSelector: @selector(tableView:setObjectValue:forTableColumn:row:)]) { [_dataSource tableView: self diff --git a/Source/NSTextView.m b/Source/NSTextView.m index 5be1ca00e..a0277de87 100644 --- a/Source/NSTextView.m +++ b/Source/NSTextView.m @@ -197,9 +197,9 @@ Helpers are here, the actual methods are in the main implementation. */ #define SET_DELEGATE_NOTIFICATION(notif_name) \ - if ([_delegate respondsToSelector: @selector(text##notif_name: )]) \ + if ([_delegate respondsToSelector: @selector(text##notif_name:)]) \ [notificationCenter addObserver: _delegate \ - selector: @selector(text##notif_name: ) \ + selector: @selector(text##notif_name:) \ name: NSText##notif_name##Notification \ object: _notifObject] @@ -1534,7 +1534,7 @@ before this TODO can be removed [cv documentView] == self) { NSSize b = [cv bounds].size; - effectiveMinSize.width = MAX(effectiveMinSize.width , b.width ); + effectiveMinSize.width = MAX(effectiveMinSize.width , b.width); effectiveMinSize.height = MAX(effectiveMinSize.height, b.height); } diff --git a/Source/NSTextView_actions.m b/Source/NSTextView_actions.m index d056b2e94..aba6507b9 100644 --- a/Source/NSTextView_actions.m +++ b/Source/NSTextView_actions.m @@ -174,7 +174,7 @@ send -shouldChangeTextInRange:replacementString: or -didChangeText. return; [_textStorage beginEditing]; - for (i = r.location; i < NSMaxRange(r); ) + for (i = r.location; i < NSMaxRange(r);) { current = [_textStorage attribute: name atIndex: i diff --git a/Source/NSToolbarItem.m b/Source/NSToolbarItem.m index 0d1af3023..8cfbe4bb9 100644 --- a/Source/NSToolbarItem.m +++ b/Source/NSToolbarItem.m @@ -1144,7 +1144,7 @@ NSString *GSMovableToolbarItemPboardType = @"GSMovableToolbarItemPboardType"; - (BOOL) isEnabled { - if(_flags._isEnabled) + if (_flags._isEnabled) { return [(id)_backView isEnabled]; } @@ -1153,7 +1153,7 @@ NSString *GSMovableToolbarItemPboardType = @"GSMovableToolbarItemPboardType"; - (NSImage *)image { - if(_flags._image) + if (_flags._image) { return _image; } @@ -1203,7 +1203,7 @@ NSString *GSMovableToolbarItemPboardType = @"GSMovableToolbarItemPboardType"; - (void) setAction: (SEL)action { - if(_flags._setAction) + if (_flags._setAction) { if ([_backView isKindOfClass: [GSToolbarButton class]]) [(GSToolbarButton *)_backView setToolbarItemAction: action]; @@ -1221,13 +1221,13 @@ NSString *GSMovableToolbarItemPboardType = @"GSMovableToolbarItemPboardType"; - (void) setEnabled: (BOOL)enabled { - if(_flags._setEnabled) + if (_flags._setEnabled) [(id)_backView setEnabled: enabled]; } - (void) setImage: (NSImage *)image { - if(_flags._setImage) + if (_flags._setImage) { ASSIGN(_image, image); @@ -1273,13 +1273,13 @@ NSString *GSMovableToolbarItemPboardType = @"GSMovableToolbarItemPboardType"; - (void) setTag: (int)tag { - if(_flags._tag) + if (_flags._tag) _tag = tag; } - (void) setTarget: (id)target { - if(_flags._target) + if (_flags._target) { if ([_backView isKindOfClass: [NSButton class]]) [(NSButton *)_backView setTarget: target]; @@ -1332,7 +1332,7 @@ NSString *GSMovableToolbarItemPboardType = @"GSMovableToolbarItemPboardType"; - (int) tag { - if(_flags._tag) + if (_flags._tag) return _tag; return 0; @@ -1463,7 +1463,7 @@ NSString *GSMovableToolbarItemPboardType = @"GSMovableToolbarItemPboardType"; // NSValidatedUserInterfaceItem protocol - (SEL) action { - if(_flags._action) + if (_flags._action) { if ([_backView isKindOfClass: [GSToolbarButton class]]) return [(GSToolbarButton *)_backView toolbarItemAction]; @@ -1473,7 +1473,7 @@ NSString *GSMovableToolbarItemPboardType = @"GSMovableToolbarItemPboardType"; - (id) target { - if(_flags._target) + if (_flags._target) { if ([_backView isKindOfClass: [NSButton class]]) return [(NSButton *)_backView target]; diff --git a/Source/NSView.m b/Source/NSView.m index 364c964cf..d65c42ced 100644 --- a/Source/NSView.m +++ b/Source/NSView.m @@ -892,7 +892,7 @@ GSSetDragTypes(NSView* obj, NSArray *types) /** * Notifies the receiver that it will now be a view of newWindow. * Note, this method is also used when removing a view from a window - * (in which case, newWindow is nil ) to let all the subviews know + * (in which case, newWindow is nil) to let all the subviews know * that they have also been removed from the window. */ - (void) viewWillMoveToWindow: (NSWindow*)newWindow @@ -3884,7 +3884,7 @@ static NSView* findByTag(NSView *view, int aTag, unsigned *level) */ - (void) encodeWithCoder: (NSCoder*)aCoder { - if([aCoder allowsKeyedCoding]) + if ([aCoder allowsKeyedCoding]) { int vFlags = 0; @@ -3902,13 +3902,13 @@ static NSView* findByTag(NSView *view, int aTag, unsigned *level) vFlags = _autoresizingMask; // add the autoresize flag. - if(_autoresizes_subviews) + if (_autoresizes_subviews) { vFlags |= 0x100; } // add the hidden flag - if(_is_hidden) + if (_is_hidden) { vFlags |= 0x80000000; } diff --git a/Source/NSWindow.m b/Source/NSWindow.m index bd7be6ce3..4560fe291 100644 --- a/Source/NSWindow.m +++ b/Source/NSWindow.m @@ -4199,7 +4199,7 @@ resetCursorRectsForView(NSView *theView) /* If the image has been specified, use it, if not use the default. */ obj = [aDecoder decodeObject]; - if(obj != nil) + if (obj != nil) { ASSIGN(_miniaturizedImage, obj); } diff --git a/Source/NSWorkspace.m b/Source/NSWorkspace.m index 965d1f7d2..3ff0e98a7 100644 --- a/Source/NSWorkspace.m +++ b/Source/NSWorkspace.m @@ -305,13 +305,13 @@ static NSString *GSWorkspaceNotification = @"GSWorkspaceNotification"; * NSTypes = ( * { * NSIcon = "tiff.tiff"; - * NSUnixExtensions = ( tiff, tif ); + * NSUnixExtensions = (tiff, tif); * }, * { * NSIcon = "xbm.tiff"; - * NSUnixExtensions = ( xbm ); + * NSUnixExtensions = (xbm); * } - * ); + *); * } * */