diff --git a/ChangeLog b/ChangeLog
index 91742f003..955eec5e7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,67 @@
+2005-11-16 Richard Frith-Macdonald EXPLAINS NSBox TODO : explains how is resized the rects ( margins etc... ) TODO : explains how is resized the rects (margins etc...) Returns the alternate image in the NSBrowserCell
- * ( 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