Fix Continuation Indent

This commit is contained in:
TheBrokenRail 2020-05-12 14:51:39 -04:00
parent 98620811ce
commit b6548a202d
824 changed files with 14463 additions and 13875 deletions

View File

@ -63,6 +63,7 @@ UseTab: Never
Language: ObjC
BasedOnStyle: LLVM
IndentWidth: 4
ContinuationIndentWidth: 8
UseTab: Never
SpaceBeforeParens: ControlStatements
SpaceBeforeRangeBasedForLoopColon: true

View File

@ -140,8 +140,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
options: (NSKeyValueObservingOptions) options
context: (void *) context
{
NSLog(
@"Proxy for %@ asked to observe by %@ for keypath %@ options 0x%08x\n",
NSLog(@"Proxy for %@ asked to observe by %@ for keypath %@ options "
@"0x%08x\n",
_object, observer, keyPath, options);
_NSManagedProxy_observerInfo *observerInfo =
[[_NSManagedProxy_observerInfo alloc] init];

View File

@ -273,8 +273,9 @@
- (NSURL *) URLForApplicationWithBundleIdentifier: (NSString *) bundleIdentifier
{
CFURLRef url;
OSStatus status = LSFindApplicationForInfo(
kLSUnknownCreator, (CFStringRef) bundleIdentifier, NULL, NULL, &url);
OSStatus status = LSFindApplicationForInfo(kLSUnknownCreator,
(CFStringRef) bundleIdentifier,
NULL, NULL, &url);
if (status != noErr)
return nil;

View File

@ -406,8 +406,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
frame.origin.y = panelSize.height - TOP_MARGIN - messageSize.height;
frame.size = messageSize;
textField = [[[NSTextField alloc] initWithFrame: frame] autorelease];
[textField
setAttributedStringValue: [[[NSAttributedString alloc]
[textField setAttributedStringValue:
[[[NSAttributedString alloc]
initWithString: _messageText
attributes: messageAttributes]
autorelease]];
@ -426,7 +426,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
messageInformativeGap - informativeSize.height;
frame.size = informativeSize;
textField = [[[NSTextField alloc] initWithFrame: frame] autorelease];
[textField setStringValue: [[[NSAttributedString alloc]
[textField
setStringValue: [[[NSAttributedString alloc]
initWithString: _informativeText
attributes: informativeAttributes]
autorelease]];
@ -491,10 +492,10 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
// manual layout
if (_needsLayout) {
if ([_buttons count] == 0) {
[self addButtonWithTitle: NSLocalizedStringFromTableInBundle(
[self addButtonWithTitle:
NSLocalizedStringFromTableInBundle(
@"OK", nil,
[NSBundle
bundleForClass: [NSAlert class]],
[NSBundle bundleForClass: [NSAlert class]],
@"Default button title for NSAlert")];
}

View File

@ -58,7 +58,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
if (defaultTitle == nil)
defaultTitle = NSLocalizedStringFromTableInBundle(
@"OK", nil, [NSBundle bundleForClass: [NSAlertPanel class]], @"");
@"OK", nil, [NSBundle bundleForClass: [NSAlertPanel class]],
@"");
defaultSize = [drawer sizeOfString: defaultTitle
withAttributes: nil
@ -122,10 +123,10 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
contentRect.origin = NSZeroPoint;
contentRect.size = panelSize;
self = [self
initWithContentRect: contentRect
self = [self initWithContentRect: contentRect
styleMask: sheet ? NSDocModalWindowMask
: NSTitledWindowMask | NSClosableWindowMask
: NSTitledWindowMask |
NSClosableWindowMask
backing: NSBackingStoreBuffered
defer: NO];
@ -194,8 +195,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
viewFrame.origin.y -= messageSize.height - imageSize.height;
viewFrame.size = messageSize;
viewFrame.size.width +=
6; // TextField's like to shrink the title area a bit - so make sure it
// doesn't make it too small for the message!
6; // TextField's like to shrink the title area a bit - so make sure
// it doesn't make it too small for the message!
_messageText = [[[NSTextField alloc] initWithFrame: viewFrame] autorelease];
[_messageText setStringValue: message];
[_messageText setSelectable: YES];

View File

@ -208,8 +208,8 @@ NSString *NSAnimationRunLoopMode = @"NSAnimationRunLoopMode";
while (_isAnimating)
[[NSRunLoop currentRunLoop]
runMode: NSAnimationRunLoopMode
beforeDate: [NSDate
dateWithTimeIntervalSinceNow: _duration]];
beforeDate: [NSDate dateWithTimeIntervalSinceNow:
_duration]];
[self _setCurrentProgressAndEndIfNeeded: 1.0];
break;

View File

@ -309,15 +309,15 @@ NSApplication *NSApp = nil;
}
- (void) unregisterDelegate {
if ([_delegate
respondsToSelector: @selector(applicationWillFinishLaunching:)]) {
if ([_delegate respondsToSelector: @selector
(applicationWillFinishLaunching:)]) {
[[NSNotificationCenter defaultCenter]
removeObserver: _delegate
name: NSApplicationWillFinishLaunchingNotification
object: self];
}
if ([_delegate
respondsToSelector: @selector(applicationDidFinishLaunching:)]) {
if ([_delegate respondsToSelector: @selector
(applicationDidFinishLaunching:)]) {
[[NSNotificationCenter defaultCenter]
removeObserver: _delegate
name: NSApplicationDidFinishLaunchingNotification
@ -339,16 +339,16 @@ NSApplication *NSApp = nil;
}
- (void) registerDelegate {
if ([_delegate
respondsToSelector: @selector(applicationWillFinishLaunching:)]) {
if ([_delegate respondsToSelector: @selector
(applicationWillFinishLaunching:)]) {
[[NSNotificationCenter defaultCenter]
addObserver: _delegate
selector: @selector(applicationWillFinishLaunching:)
name: NSApplicationWillFinishLaunchingNotification
object: self];
}
if ([_delegate
respondsToSelector: @selector(applicationDidFinishLaunching:)]) {
if ([_delegate respondsToSelector: @selector
(applicationDidFinishLaunching:)]) {
[[NSNotificationCenter defaultCenter]
addObserver: _delegate
selector: @selector(applicationDidFinishLaunching:)
@ -463,9 +463,9 @@ NSApplication *NSApp = nil;
if (isFilename)
title = [NSString
stringWithFormat: @"%@ -- %@", [title lastPathComponent],
[title
stringByDeletingLastPathComponent]];
stringWithFormat:
@"%@ -- %@", [title lastPathComponent],
[title stringByDeletingLastPathComponent]];
[item setTitle: title];
[[self windowsMenu] itemChanged: item];
@ -1036,12 +1036,12 @@ NSApplication *NSApp = nil;
NSMutableDictionary *values = [NSMutableDictionary dictionary];
values[@"NSWindow"] = window;
[self
performSelectorOnMainThread: @selector(_mainThreadRunModalForWindow:)
[self performSelectorOnMainThread: @selector(_mainThreadRunModalForWindow:)
withObject: values
waitUntilDone: YES
modes: @[
NSDefaultRunLoopMode, NSModalPanelRunLoopMode
NSDefaultRunLoopMode,
NSModalPanelRunLoopMode
]];
NSNumber *result = values[@"result"];
@ -1385,7 +1385,8 @@ NSApplication *NSApp = nil;
if (helpBookFolder != nil) {
BOOL isDir;
NSString *folder =
[[NSBundle mainBundle] pathForResource: helpBookFolder ofType: nil];
[[NSBundle mainBundle] pathForResource: helpBookFolder
ofType: nil];
if (folder != nil &&
[[NSFileManager defaultManager] fileExistsAtPath: folder
isDirectory: &isDir] &&
@ -1396,7 +1397,8 @@ NSApplication *NSApp = nil;
objectForKey: @"CFBundleHelpTOCFile"];
if (helpBookName != nil) {
NSString *helpFilePath =
[helpBundle pathForResource: helpBookName ofType: nil];
[helpBundle pathForResource: helpBookName
ofType: nil];
if (helpFilePath) {
if ([[NSWorkspace sharedWorkspace]
openFile: helpFilePath
@ -1423,15 +1425,17 @@ NSApplication *NSApp = nil;
NSAlert *alert = [[NSAlert alloc] init];
[alert setMessageText: NSLocalizedStringFromTableInBundle(
@"Help", nil,
[NSBundle bundleForClass: [NSApplication class]],
@"Help alert title")];
[alert
setInformativeText:
[NSString
stringWithFormat: NSLocalizedStringFromTableInBundle(
@"Help isn't available for %@.", nil,
[NSBundle bundleForClass: [NSApplication
class]],
@"Help alert title")];
[alert setInformativeText:
[NSString stringWithFormat:
NSLocalizedStringFromTableInBundle(
@"Help isn't available for %@.",
nil,
[NSBundle bundleForClass:
[NSApplication
class]],
@""),
processName]];
[alert runModal];
@ -1548,7 +1552,8 @@ int NSApplicationMain(int argc, const char *argv[]) {
if ((argc = [arguments count]))
[[NSUserDefaults standardUserDefaults]
setObject: ((argc == 1) ? [arguments lastObject] : arguments)
setObject: ((argc == 1) ? [arguments lastObject]
: arguments)
forKey: @"NSOpen"];
}

View File

@ -285,16 +285,14 @@ NSUInteger NSUnderlineByWordMask = 0x8000;
if (expand) {
for (; result.location != 0; result.location--, result.length++) {
if (![set characterIsMember: [string
characterAtIndex: result.location -
1]])
if (![set characterIsMember:
[string characterAtIndex: result.location - 1]])
break;
}
for (; NSMaxRange(result) < length; result.length++) {
if (![set
characterIsMember: [string characterAtIndex: NSMaxRange(
result)]])
if (![set characterIsMember:
[string characterAtIndex: NSMaxRange(result)]])
break;
}
} else if (location < length)

View File

@ -515,8 +515,8 @@ static int numberOfPointsForOperator(int op) {
|| ((fromPoint.y > point.y) &&
(toPoint.y <= point.y))) { // a downward crossing
// compute the actual edge-ray intersect x-coordinate
CGFloat vt =
(CGFloat)(point.y - fromPoint.y) / (toPoint.y - fromPoint.y);
CGFloat vt = (CGFloat)(point.y - fromPoint.y) /
(toPoint.y - fromPoint.y);
if (point.x <
fromPoint.x +
vt * (toPoint.x - fromPoint.x)) // point.x < intersect
@ -526,8 +526,8 @@ static int numberOfPointsForOperator(int op) {
// Subdivide the bezier path and test both subpaths - adapted from the
// flatten path code
CGPoint sub1_start = fromPoint;
CGPoint sub1_cp1 =
CGPointMake((fromPoint.x + tan1.x) / 2, (fromPoint.y + tan1.y) / 2);
CGPoint sub1_cp1 = CGPointMake((fromPoint.x + tan1.x) / 2,
(fromPoint.y + tan1.y) / 2);
CGPoint T = CGPointMake((tan1.x + tan2.x) / 2, (tan1.y + tan2.y) / 2);
CGPoint sub1_cp2 =
CGPointMake((sub1_cp1.x + T.x) / 2, (sub1_cp1.y + T.y) / 2);
@ -592,7 +592,8 @@ static int numberOfPointsForOperator(int op) {
// compute the actual edge-ray intersect x-coordinate
CGFloat vt = (CGFloat)(point.y - currentPoint.y) /
(toPoint.y - currentPoint.y);
if (point.x < currentPoint.x +
if (point.x <
currentPoint.x +
vt * (toPoint.x -
currentPoint.x)) // point.x < intersect
++cn; // a valid crossing of y=point.y right of point.x
@ -619,7 +620,8 @@ static int numberOfPointsForOperator(int op) {
// compute the actual edge-ray intersect x-coordinate
CGFloat vt = (CGFloat)(point.y - currentPoint.y) /
(toPoint.y - currentPoint.y);
if (point.x < currentPoint.x +
if (point.x <
currentPoint.x +
vt * (toPoint.x -
currentPoint.x)) // point.x < intersect
++cn; // a valid crossing of y=point.y right of point.x
@ -871,14 +873,17 @@ static void cgArcFromApply(void *info, const CGPathElement *element) {
[self moveToPoint: NSMakePoint(rect.origin.x + radius, NSMaxY(rect))];
[self appendBezierPathWithArcWithCenter: NSMakePoint(
rect.origin.x +
rect.size.width - radius,
rect.size.width -
radius,
rect.origin.y +
rect.size.height - radius)
rect.size.height -
radius)
radius: radius
startAngle: 90
endAngle: 0.0f
clockwise: YES];
[self appendBezierPathWithArcWithCenter: NSMakePoint(rect.origin.x +
[self appendBezierPathWithArcWithCenter: NSMakePoint(
rect.origin.x +
rect.size.width -
radius,
rect.origin.y + radius)
@ -892,7 +897,8 @@ static void cgArcFromApply(void *info, const CGPathElement *element) {
startAngle: 270
endAngle: 180
clockwise: YES];
[self appendBezierPathWithArcWithCenter: NSMakePoint(rect.origin.x + radius,
[self appendBezierPathWithArcWithCenter: NSMakePoint(
rect.origin.x + radius,
rect.origin.y +
rect.size.height -
radius)
@ -938,8 +944,8 @@ static inline CGFloat degreesToRadians(CGFloat degrees) {
NSString *fontName = [font fontName];
CGFontRef cgFont = CGFontCreateWithFontName((CFStringRef) fontName);
if (cgFont) {
CTFontRef fontRef =
CTFontCreateWithGraphicsFont(cgFont, [font pointSize], NULL, NULL);
CTFontRef fontRef = CTFontCreateWithGraphicsFont(
cgFont, [font pointSize], NULL, NULL);
if (fontRef) {
CGPathRef glyphPath =
CTFontCreatePathForGlyph(fontRef, glyph, NULL);
@ -1159,7 +1165,8 @@ static NSUInteger flattenBezierCurve(CGFloat desiredFlatness, CGPoint start,
// Find the previous start of a path
for (j = i - 1; j >= 0; j--) {
NSBezierPathElement type =
[self elementAtIndex: j associatedPoints: prevPoints];
[self elementAtIndex: j
associatedPoints: prevPoints];
if (type == NSMoveToBezierPathElement) {
nextPoint = prevPoints[0];
break;

View File

@ -48,13 +48,13 @@ NSBitmapImageRepPropertyKey NSImageCurrentFrame = @"NSImageCurrentFrame";
@implementation NSBitmapImageRep
+ (NSArray *) imageUnfilteredFileTypes {
return
[NSArray arrayWithObjects:
// Try to order them so the most used ones are at the top
// of the list
@"png", @"tiff", @"tif", @"jpg", @"jpeg", @"icns", @"gif",
@"bmp", @"PNG", @"TIFF", @"TIF", @"JPG", @"JPEG", @"ICNS",
@"jpe", @"JPE", @"GIF", @"BMP", nil];
return [NSArray arrayWithObjects:
// Try to order them so the most used ones are at
// the top of the list
@"png", @"tiff", @"tif", @"jpg", @"jpeg",
@"icns", @"gif", @"bmp", @"PNG", @"TIFF",
@"TIF", @"JPG", @"JPEG", @"ICNS", @"jpe",
@"JPE", @"GIF", @"BMP", nil];
}
+ (NSArray *) imageRepsWithContentsOfFile: (NSString *) path {
@ -93,8 +93,8 @@ NSBitmapImageRepPropertyKey NSImageCurrentFrame = @"NSImageCurrentFrame";
{
NSMutableData *result = [NSMutableData data];
CGImageDestinationRef dest = CGImageDestinationCreateWithData(
(CFMutableDataRef) result, (CFStringRef) @"public.tiff", [array count],
NULL);
(CFMutableDataRef) result, (CFStringRef) @"public.tiff",
[array count], NULL);
for (NSBitmapImageRep *bitmap in array) {
CGImageDestinationAddImage(dest, [bitmap CGImage], NULL);
@ -145,12 +145,10 @@ NSBitmapImageRepPropertyKey NSImageCurrentFrame = @"NSImageCurrentFrame";
CFDictionaryRef properties =
CGImageSourceCopyPropertiesAtIndex(imageSource, i, nil);
NSNumber *xres =
[[(id) CFDictionaryGetValue(properties, kCGImagePropertyDPIWidth)
copy] autorelease];
NSNumber *yres =
[[(id) CFDictionaryGetValue(properties, kCGImagePropertyDPIHeight)
copy] autorelease];
NSNumber *xres = [[(id) CFDictionaryGetValue(
properties, kCGImagePropertyDPIWidth) copy] autorelease];
NSNumber *yres = [[(id) CFDictionaryGetValue(
properties, kCGImagePropertyDPIHeight) copy] autorelease];
CFRelease(properties);
@ -305,11 +303,11 @@ NSBitmapImageRepPropertyKey NSImageCurrentFrame = @"NSImageCurrentFrame";
CFDictionaryRef properties =
CGImageSourceCopyPropertiesAtIndex(imageSource, 0, nil);
NSNumber *xres =
[[(id) CFDictionaryGetValue(properties, kCGImagePropertyDPIWidth) copy]
autorelease];
[[(id) CFDictionaryGetValue(properties, kCGImagePropertyDPIWidth)
copy] autorelease];
NSNumber *yres =
[[(id) CFDictionaryGetValue(properties, kCGImagePropertyDPIHeight) copy]
autorelease];
[[(id) CFDictionaryGetValue(properties, kCGImagePropertyDPIHeight)
copy] autorelease];
CFRelease(properties);
CFRelease(imageSource);
@ -597,8 +595,8 @@ NSBitmapImageRepPropertyKey NSImageCurrentFrame = @"NSImageCurrentFrame";
(int) (components[(numberOfComponents - 1) - i] *
maxValue))); // clamp just in case
#else
pixels[i] =
MAX(0, MIN(maxValue, (int) (components[i] *
pixels[i] = MAX(
0, MIN(maxValue, (int) (components[i] *
maxValue))); // clamp just in case
#endif
}
@ -717,7 +715,8 @@ NSBitmapImageRepPropertyKey NSImageCurrentFrame = @"NSImageCurrentFrame";
factor: (float) factor
{
return [[self class]
TIFFRepresentationOfImageRepsInArray: [NSArray arrayWithObject: self]
TIFFRepresentationOfImageRepsInArray: [NSArray
arrayWithObject: self]
usingCompression: compression
factor: factor];
}
@ -734,8 +733,8 @@ NSBitmapImageRepPropertyKey NSImageCurrentFrame = @"NSImageCurrentFrame";
CGImageRef image = CGImageCreate(
_pixelsWide, _pixelsHigh, _bitsPerPixel / _samplesPerPixel,
_bitsPerPixel, _bytesPerRow, [self CGColorSpace], [self CGBitmapInfo],
provider, NULL, NO, kCGRenderingIntentDefault);
_bitsPerPixel, _bytesPerRow, [self CGColorSpace],
[self CGBitmapInfo], provider, NULL, NO, kCGRenderingIntentDefault);
CGDataProviderRelease(provider);
@ -764,11 +763,11 @@ NSBitmapImageRepPropertyKey NSImageCurrentFrame = @"NSImageCurrentFrame";
- (CGColorSpaceRef) CGColorSpace {
if ([_colorSpaceName isEqualToString: NSDeviceRGBColorSpace])
return (
CGColorSpaceRef)[(id) CGColorSpaceCreateDeviceRGB() autorelease];
return (CGColorSpaceRef)[(id) CGColorSpaceCreateDeviceRGB()
autorelease];
if ([_colorSpaceName isEqualToString: NSCalibratedRGBColorSpace])
return (
CGColorSpaceRef)[(id) CGColorSpaceCreateDeviceRGB() autorelease];
return (CGColorSpaceRef)[(id) CGColorSpaceCreateDeviceRGB()
autorelease];
return NULL;
}

View File

@ -201,7 +201,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
- (NSAttributedString *) _attributedTitle {
NSMutableDictionary *attributes = [NSMutableDictionary dictionary];
NSMutableParagraphStyle *paraStyle =
[[[NSParagraphStyle defaultParagraphStyle] mutableCopy] autorelease];
[[[NSParagraphStyle defaultParagraphStyle] mutableCopy]
autorelease];
NSFont *font = [_titleCell font];
if (font != nil)
@ -217,9 +218,9 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
[attributes setObject: [NSColor windowBackgroundColor]
forKey: NSBackgroundColorAttributeName];
return
[[[NSAttributedString alloc] initWithString: [_titleCell stringValue]
attributes: attributes] autorelease];
return [[[NSAttributedString alloc] initWithString: [_titleCell stringValue]
attributes: attributes]
autorelease];
}
#define TEXTGAP 4
@ -235,10 +236,9 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
// result.size.width=ceil(size.width); // // NSTextField cell must be bugged
// we get too low values for the width here
result.size.width =
bounds.size.width -
result.origin
.x; // use the whole width until the text field cell size is fixed
result.size.width = bounds.size.width -
result.origin.x; // use the whole width until the text
// field cell size is fixed
switch (_titlePosition) {

View File

@ -299,8 +299,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
column -= [self firstVisibleColumn];
result.size.width =
([self bounds].size.width - (_numberOfVisibleColumns - 1) * columnGap) /
result.size.width = ([self bounds].size.width -
(_numberOfVisibleColumns - 1) * columnGap) /
_numberOfVisibleColumns;
result.size.height = [self titleHeight];
result.origin.x = column * (result.size.width + columnGap);
@ -357,8 +357,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
createRowsForColumn:inMatrix:)])
if (![delegate respondsToSelector: @selector(browser:
numberOfRowsInColumn:)] &&
![delegate respondsToSelector: @selector(browser:
willDisplayCell:atRow:column:)])
![delegate respondsToSelector: @selector
(browser:willDisplayCell:atRow:column:)])
[NSException raise: NSInternalInconsistencyException
format: @"-[NSBrowser setDelegate:] doesn't implement "
@"delegate methods"];
@ -600,12 +600,12 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
if (column >= [self firstVisibleColumn] &&
column <= [self lastVisibleColumn]) {
NSScrollView *scrollView =
[_scrollViews objectAtIndex: column - [self firstVisibleColumn]];
NSScrollView *scrollView = [_scrollViews
objectAtIndex: column - [self firstVisibleColumn]];
[scrollView setDocumentView: [_matrices objectAtIndex: column]];
[scrollView
setLineScroll: [[_matrices objectAtIndex: column] cellSize].height];
[scrollView setLineScroll: [[_matrices objectAtIndex: column] cellSize]
.height];
[scrollView
setPageScroll: [[scrollView contentView] frame].size.height];
}
@ -655,8 +655,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
title = [_delegate browser: self titleOfColumn: column];
else if (_takesTitleFromPreviousColumn) {
if (column > 0) {
title =
[[[self matrixInColumn: column - 1] selectedCell] stringValue];
title = [[[self matrixInColumn: column - 1] selectedCell]
stringValue];
}
}
@ -882,9 +882,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
}
if ([self hasHorizontalScroller])
[[self graphicsStyle]
drawBrowserHorizontalScrollerWellInRect: [self
frameOfScrollerBorder]
[[self graphicsStyle] drawBrowserHorizontalScrollerWellInRect:
[self frameOfScrollerBorder]
clipRect: rect];
}
@ -951,9 +950,9 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
- (void) moveRight: sender {
if (![[self selectedCell] isLeaf]) {
[self
selectRow: 0
inColumn: _selectedColumn + 1]; // nb this changes _selectedColumn
[self selectRow: 0
inColumn: _selectedColumn +
1]; // nb this changes _selectedColumn
[self doClick: [self matrixInColumn: _selectedColumn]];
}
}

View File

@ -227,8 +227,8 @@ static const CGFloat kImageMargin = 2.;
}
if (altContents) {
_alternateTitle =
[[NSString alloc] initWithBytesNoCopy: altContents
_alternateTitle = [[NSString alloc]
initWithBytesNoCopy: altContents
length: strlen(altContents)
encoding: NSUTF8StringEncoding
freeWhenDone: TRUE];
@ -368,11 +368,12 @@ static const CGFloat kImageMargin = 2.;
if (([[self image]
isEqual: [NSImage imageNamed: @"NSRadioButton"]] &&
[[self alternateImage]
isEqual: [NSImage
imageNamed: @"NSHighlightedRadioButton"]]) ||
isEqual: [NSImage imageNamed: @"NSHighlightedRadioButt"
@"on"]]) ||
([[self image] isEqual: [NSImage imageNamed: @"NSSwitch"]] &&
[[self alternateImage]
isEqual: [NSImage imageNamed: @"NSHighlightedSwitch"]])) {
isEqual: [NSImage imageNamed:
@"NSHighlightedSwitch"]])) {
flags |= 0x1000;
}
}
@ -532,7 +533,8 @@ static const CGFloat kImageMargin = 2.;
- (NSAttributedString *) attributedAlternateTitle {
NSMutableDictionary *attributes = [NSMutableDictionary dictionary];
NSMutableParagraphStyle *paraStyle =
[[[NSParagraphStyle defaultParagraphStyle] mutableCopy] autorelease];
[[[NSParagraphStyle defaultParagraphStyle] mutableCopy]
autorelease];
NSFont *font = [self font];
if (font != nil)
@ -549,9 +551,9 @@ static const CGFloat kImageMargin = 2.;
[attributes setObject: [NSColor disabledControlTextColor]
forKey: NSForegroundColorAttributeName];
return
[[[NSAttributedString alloc] initWithString: [self alternateTitle]
attributes: attributes] autorelease];
return [[[NSAttributedString alloc] initWithString: [self alternateTitle]
attributes: attributes]
autorelease];
}
- (int) highlightsBy {
@ -763,8 +765,8 @@ static const CGFloat kImageMargin = 2.;
_imagePosition = NSImageLeft;
_imageDimsWhenDisabled = NO;
[self setImage: [NSImage imageNamed: @"NSRadioButton"]];
[self setAlternateImage: [NSImage
imageNamed: @"NSHighlightedRadioButton"]];
[self setAlternateImage:
[NSImage imageNamed: @"NSHighlightedRadioButton"]];
[self setAlignment: NSLeftTextAlignment];
[self setBordered: NO];
[self setBezeled: NO];
@ -972,10 +974,11 @@ static const CGFloat kImageMargin = 2.;
const CGFloat baseY = floor(frame.origin.y);
const CGFloat maxY = baseY + frame.size.height - 1.0;
CGRect r =
CGRectMake(floor(frame.origin.x), baseY, ceil(frame.size.width), 1.0);
CGRect r = CGRectMake(floor(frame.origin.x), baseY, ceil(frame.size.width),
1.0);
while (r.origin.y <= maxY) {
CGFloat g = bottomGray + (topGray - bottomGray) *
CGFloat g =
bottomGray + (topGray - bottomGray) *
((r.origin.y - baseY) / (maxY - baseY));
CGFloat components[4] = {g, g, g, 1.0};
CGContextSetFillColor(ctx, components);
@ -1278,8 +1281,8 @@ static NSSize scaledImageSizeInFrameSize(NSSize imageSize, NSSize frameSize,
if ([self bezelStyle] == NSDisclosureBezelStyle)
imagePosition = NSImageOnly;
imageSize =
scaledImageSizeInFrameSize(imageSize, frame.size, [self imageScaling]);
imageSize = scaledImageSizeInFrameSize(imageSize, frame.size,
[self imageScaling]);
imageOrigin.x += floor((frame.size.width - imageSize.width) / 2);
imageOrigin.y += floor((frame.size.height - imageSize.height) / 2);

View File

@ -78,16 +78,16 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
- (BOOL) drawAtPoint: (NSPoint) point {
NSRect rect = {point, _size};
CGImageRef imageRef =
CGBitmapContextCreateImage([[_window graphicsContext] graphicsPort]);
CGImageRef imageRef = CGBitmapContextCreateImage(
[[_window graphicsContext] graphicsPort]);
CGContextDrawImage(NSCurrentGraphicsPort(), rect, imageRef);
CGImageRelease(imageRef);
return YES;
}
- (BOOL) drawInRect: (NSRect) rect {
CGImageRef imageRef =
CGBitmapContextCreateImage([[_window graphicsContext] graphicsPort]);
CGImageRef imageRef = CGBitmapContextCreateImage(
[[_window graphicsContext] graphicsPort]);
CGContextDrawImage(NSCurrentGraphicsPort(), rect, imageRef);
CGImageRelease(imageRef);
return YES;

View File

@ -764,9 +764,9 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
- (void) setStringValue: (NSString *) value {
if (value == nil) {
[NSException
raise: NSInvalidArgumentException
format: @"-[%@ %s] value==nil", [self class], sel_getName(_cmd)];
[NSException raise: NSInvalidArgumentException
format: @"-[%@ %s] value==nil", [self class],
sel_getName(_cmd)];
return;
}
@ -982,8 +982,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
[[view window] flushWindow];
event = [[view window]
nextEventMatchingMask: NSLeftMouseUpMask | NSLeftMouseDraggedMask];
event = [[view window] nextEventMatchingMask: NSLeftMouseUpMask |
NSLeftMouseDraggedMask];
} while (YES);
@ -1150,8 +1150,9 @@ static NSString *NSStringFromCellType(NSCellType type) {
- (NSString *) description {
return [NSString
stringWithFormat: @"%@\n\ttype: %@\n\tfont: %@\n\tobjectValue: %@",
[super description], NSStringFromCellType(_cellType),
_font, _objectValue];
[super description],
NSStringFromCellType(_cellType), _font,
_objectValue];
}
@end

View File

@ -93,8 +93,8 @@ static int NSColor_ignoresAlpha = -1;
[self getCyan: &c magenta: &m yellow: &y black: &k alpha: &a];
[coder encodeInt: 5 forKey: @"NSColorSpace"];
NSString *string =
[NSString stringWithFormat: @"%f %f %f %f %f", c, m, y, k, a];
NSString *string = [NSString
stringWithFormat: @"%f %f %f %f %f", c, m, y, k, a];
NSData *data = [string dataUsingEncoding: NSASCIIStringEncoding];
[coder encodeBytes: [data bytes]
length: [data length]
@ -902,7 +902,8 @@ static void releasePatternInfo(void *info) {
[[[NSUserDefaults standardUserDefaults]
objectForKey: @"NSIgnoreAlpha"]
compare: @"NO"
options: NSCaseInsensitiveSearch] != NSOrderedSame;
options: NSCaseInsensitiveSearch] !=
NSOrderedSame;
}
}

View File

@ -159,9 +159,9 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
- (NSColor *) colorWithAlphaComponent: (CGFloat) alpha {
CGColorRef ref = CGColorCreateCopyWithAlpha(_colorRef, alpha);
NSColor *result =
[[[[self class] alloc] initWithColorRef: ref
spaceName: _colorSpaceName] autorelease];
NSColor *result = [[[[self class] alloc] initWithColorRef: ref
spaceName: _colorSpaceName]
autorelease];
CGColorRelease(ref);
return result;
@ -219,8 +219,8 @@ static inline CGFloat calibratedWhiteFromRGB(CGFloat r, CGFloat g, CGFloat b) {
CGFloat alpha = components[3];
if ([otherSpaceName isEqualToString: NSDeviceWhiteColorSpace])
return [NSColor
colorWithDeviceWhite: calibratedWhiteFromRGB(red, green, blue)
return [NSColor colorWithDeviceWhite: calibratedWhiteFromRGB(
red, green, blue)
alpha: alpha];
if ([otherSpaceName isEqualToString: NSDeviceCMYKColorSpace])
@ -296,8 +296,8 @@ static inline CGFloat calibratedWhiteFromRGB(CGFloat r, CGFloat g, CGFloat b) {
CGFloat alpha = components[3];
if ([otherSpaceName isEqualToString: NSDeviceWhiteColorSpace])
return [NSColor
colorWithDeviceWhite: calibratedWhiteFromRGB(red, green, blue)
return [NSColor colorWithDeviceWhite: calibratedWhiteFromRGB(
red, green, blue)
alpha: alpha];
if ([otherSpaceName isEqualToString: NSDeviceCMYKColorSpace])

View File

@ -142,8 +142,8 @@ static NSUInteger _pickerMask = 0;
for (i = 0; i < count; i++) {
Class colorPickerClass = [colorPickersClassArray objectAtIndex: i];
NSColorPicker *newPicker =
[[[colorPickerClass alloc] initWithPickerMask: _pickerMask
NSColorPicker *newPicker = [[[colorPickerClass alloc]
initWithPickerMask: _pickerMask
colorPanel: self] autorelease];
NSCell *cell = [colorPickersMatrix cellAtRow: 0 column: i];
@ -219,7 +219,8 @@ static NSUInteger _pickerMask = 0;
[[NSNotificationQueue defaultQueue]
enqueueNotification:
[NSNotification
notificationWithName: NSColorPanelColorDidChangeNotification
notificationWithName:
NSColorPanelColorDidChangeNotification
object: self]
postingStyle: NSPostNow
coalesceMask: NSNotificationCoalescingOnName

View File

@ -58,8 +58,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
- (void) colorListBrowserClicked: (id) sender {
[[NSColorPanel sharedColorPanel]
setColor: [_pickedColorList
colorWithKey: [[sender selectedCell] stringValue]]];
setColor: [_pickedColorList colorWithKey: [[sender selectedCell]
stringValue]]];
}
- (NSInteger) browser: (NSBrowser *) sender
@ -80,7 +80,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
[cell setStringValue: [[_pickedColorList allKeys] objectAtIndex: row]];
[cell setLeaf: YES];
[cell setLoaded: YES];
[cell setColor: [_pickedColorList colorWithKey: [[_pickedColorList allKeys]
[cell setColor: [_pickedColorList
colorWithKey: [[_pickedColorList allKeys]
objectAtIndex: row]]];
}

View File

@ -193,9 +193,9 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
[greyscaleSlider setIntValue: intValue];
[[self colorPanel]
setColor: [NSColor
colorWithCalibratedWhite: intValue / 100.0
alpha: [[self colorPanel] alpha]]];
setColor: [NSColor colorWithCalibratedWhite: intValue / 100.0
alpha: [[self colorPanel]
alpha]]];
}
- (void) grayscaleConstant: sender {
@ -223,10 +223,13 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
[[rgbTextFieldMatrix cellAtRow: 2 column: 0] setIntValue: [blue intValue]];
[[self colorPanel]
setColor: [NSColor colorWithCalibratedRed: [red doubleValue] / 255.0
green: [green doubleValue] / 255.0
setColor: [NSColor
colorWithCalibratedRed: [red doubleValue] / 255.0
green: [green doubleValue] /
255.0
blue: [blue doubleValue] / 255.0
alpha: [[self colorPanel] alpha]]];
alpha: [[self colorPanel]
alpha]]];
}
- (void) rgbSliderChanged: sender {
@ -254,7 +257,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
[_blackSlider setIntValue: [black intValue]];
[[self colorPanel]
setColor: [NSColor colorWithDeviceCyan: [cyan doubleValue] / 100.0
setColor: [NSColor
colorWithDeviceCyan: [cyan doubleValue] / 100.0
magenta: [magenta doubleValue] / 100.0
yellow: [yellow doubleValue] / 100.0
black: [black doubleValue] / 100.0
@ -289,9 +293,12 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
[[self colorPanel]
setColor: [NSColor
colorWithCalibratedHue: [hue doubleValue] / 359.0
saturation: [saturation doubleValue] / 100.0
brightness: [brightness doubleValue] / 100.0
alpha: [[self colorPanel] alpha]]];
saturation: [saturation doubleValue] /
100.0
brightness: [brightness doubleValue] /
100.0
alpha: [[self colorPanel]
alpha]]];
}
- (void) hsbSliderChanged: sender {

View File

@ -50,7 +50,8 @@
setColor: [NSColor colorWithCalibratedHue: hue / 360.0
saturation: saturation / 100.0
brightness: brightness / 100.0
alpha: [[self colorPanel] alpha]]];
alpha: [[self colorPanel]
alpha]]];
}
- (void) setColor: (NSColor *) color {

View File

@ -125,8 +125,8 @@
relativeDistanceFromCenter = 1;
// Get the angle and ensure it's in 0..2*PI
CGFloat angle =
fmod(atan2(location.y, location.x) - M_PI_2 + M_PI * 2.f, M_PI * 2.f);
CGFloat angle = fmod(atan2(location.y, location.x) - M_PI_2 + M_PI * 2.f,
M_PI * 2.f);
// Hue is stored in degrees
_hueValue = angle * 180.f / M_PI;

View File

@ -284,8 +284,8 @@ NSNotificationName _NSColorWellDidBecomeExclusiveNotification =
BOOL wasActive = [self isActive];
NSPoint point = [self convertPoint: [event locationInWindow]
fromView: nil];
BOOL mouseInBorder =
!NSMouseInRect(point, NSInsetRect(_bounds, 8, 8), [self isFlipped]);
BOOL mouseInBorder = !NSMouseInRect(point, NSInsetRect(_bounds, 8, 8),
[self isFlipped]);
BOOL canStartDrag = !mouseInBorder;
if (mouseInBorder) {
// Toggle the initial state.
@ -297,8 +297,8 @@ NSNotificationName _NSColorWellDidBecomeExclusiveNotification =
BOOL shouldStartDrag = NO;
do {
event =
[[self window] nextEventMatchingMask: NSLeftMouseUpMask |
event = [[self window]
nextEventMatchingMask: NSLeftMouseUpMask |
NSLeftMouseDraggedMask];
point = [self convertPoint: [event locationInWindow] fromView: nil];
BOOL mouseInBounds =

View File

@ -581,7 +581,8 @@ static NSMutableDictionary *cellClassDictionary = nil;
object: self
userInfo: [NSDictionary
dictionaryWithObject: [note object]
forKey: @"NSFieldEditor"]];
forKey: @"NSFieldEdito"
@"r"]];
// If this control's value is bound to an object that conforms to
// NSEditorRegistration, register as an editor.
@ -606,7 +607,8 @@ static NSMutableDictionary *cellClassDictionary = nil;
object: self
userInfo: [NSDictionary
dictionaryWithObject: [note object]
forKey: @"NSFieldEditor"]];
forKey: @"NSFieldEdito"
@"r"]];
}
- (void) textDidEndEditing: (NSNotification *) note {
@ -623,7 +625,8 @@ static NSMutableDictionary *cellClassDictionary = nil;
object: self
userInfo: [NSDictionary
dictionaryWithObject: [note object]
forKey: @"NSFieldEditor"]];
forKey: @"NSFieldEdito"
@"r"]];
// If this control's value is bound to an object that conforms to
// NSEditorRegistration, unregister as an editor.
@ -675,8 +678,8 @@ static NSMutableDictionary *cellClassDictionary = nil;
}
[[self window] flushWindow];
event = [[self window]
nextEventMatchingMask: NSLeftMouseUpMask | NSLeftMouseDraggedMask];
event = [[self window] nextEventMatchingMask: NSLeftMouseUpMask |
NSLeftMouseDraggedMask];
} while ([event type] != NSLeftMouseUp);
[self unlockFocus];

View File

@ -173,13 +173,13 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
id sortedObjects = objects;
if ([self filterPredicate]) {
sortedObjects =
[sortedObjects filteredArrayUsingPredicate: [self filterPredicate]];
sortedObjects = [sortedObjects
filteredArrayUsingPredicate: [self filterPredicate]];
}
if ([self sortDescriptors]) {
sortedObjects =
[sortedObjects sortedArrayUsingDescriptors: [self sortDescriptors]];
sortedObjects = [sortedObjects
sortedArrayUsingDescriptors: [self sortDescriptors]];
}
return sortedObjects;
@ -381,8 +381,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
id set = [NSMutableIndexSet indexSet];
int i, count = [objects count];
for (i = 0; i < [objects count]; i++) {
NSUInteger idx =
[[self arrangedObjects] indexOfObject: [objects objectAtIndex: i]];
NSUInteger idx = [[self arrangedObjects]
indexOfObject: [objects objectAtIndex: i]];
if (idx != NSNotFound) {
[set addIndex: idx];
}

View File

@ -62,10 +62,9 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
[_observableSelection release];
if ([_observationProxies count] > 0)
[NSException
raise: NSInvalidArgumentException
format:
@"NSControllerSelectionProxy still being observed by %@ on %@",
[NSException raise: NSInvalidArgumentException
format: @"NSControllerSelectionProxy still being observed "
@"by %@ on %@",
[[_observationProxies objectAtIndex: 0] observer],
[[_observationProxies objectAtIndex: 0] keyPath]];

View File

@ -71,7 +71,8 @@
// NSDictionaryController has a default sort descriptor, NSArrayController
// does not
[self setSortDescriptors:
[NSArray arrayWithObject: [NSSortDescriptor
[NSArray arrayWithObject:
[NSSortDescriptor
sortDescriptorWithKey: @"key"
ascending: YES]]];
_initialKey = @"key";
@ -86,7 +87,8 @@
_includedKeys = [[coder decodeObjectForKey: @"NSIncludedKeys"] retain];
_excludedKeys = [[coder decodeObjectForKey: @"NSExcludedKeys"] retain];
[self setSortDescriptors:
[NSArray arrayWithObject: [NSSortDescriptor
[NSArray arrayWithObject:
[NSSortDescriptor
sortDescriptorWithKey: @"key"
ascending: YES]]];
_initialKey = @"key";

View File

@ -101,8 +101,8 @@ void NSStringKVCSplitOnDot(NSString *self, NSString **before, NSString **after)
}
- (NSString *) description {
return
[NSString stringWithFormat: @"observation proxy for %@ on key path %@",
return [NSString
stringWithFormat: @"observation proxy for %@ on key path %@",
_observer, _keyPath];
}
@end

View File

@ -201,8 +201,8 @@ static void drawRoundedSelection(NSRect rect) {
- (NSArray *) _attributedStrings {
NSMutableArray *result = [NSMutableArray array];
NSMutableParagraphStyle *style =
[[[NSParagraphStyle defaultParagraphStyle] mutableCopy] autorelease];
NSMutableParagraphStyle *style = [[[NSParagraphStyle defaultParagraphStyle]
mutableCopy] autorelease];
NSMutableDictionary *attributes = [NSMutableDictionary dictionary];
NSMutableDictionary *separatorAttributes;
@ -231,14 +231,15 @@ static void drawRoundedSelection(NSRect rect) {
NSString *year = [NSString stringWithFormat: @"%d", [components year]];
[attributes
setObject: [NSNumber numberWithUnsignedInteger: [components month]]
setObject: [NSNumber numberWithUnsignedInteger: [components
month]]
forKey: @"_value"];
[attributes setObject: [NSNumber numberWithUnsignedInteger: 1]
forKey: @"_min"];
[attributes setObject: [NSNumber numberWithUnsignedInteger: 12]
forKey: @"_max"];
[attributes
setObject: [NSNumber numberWithUnsignedInteger: NSMonthCalendarUnit]
[attributes setObject: [NSNumber numberWithUnsignedInteger:
NSMonthCalendarUnit]
forKey: @"_unit"];
[attributes setObject: [NSNumber numberWithFloat: digitWidth * 2]
forKey: @"_width"];
@ -246,20 +247,22 @@ static void drawRoundedSelection(NSRect rect) {
initWithString: month
attributes: attributes] autorelease]];
[result
addObject: [[[NSAttributedString alloc]
[result addObject: [[[NSAttributedString alloc]
initWithString: @"/"
attributes: separatorAttributes] autorelease]];
attributes: separatorAttributes]
autorelease]];
[attributes
setObject: [NSNumber numberWithUnsignedInteger: [components day]]
setObject: [NSNumber
numberWithUnsignedInteger: [components day]]
forKey: @"_value"];
[attributes setObject: [NSNumber numberWithUnsignedInteger: 1]
forKey: @"_min"];
[attributes setObject: [NSNumber numberWithUnsignedInteger: 31]
forKey: @"_max"];
[attributes
setObject: [NSNumber numberWithUnsignedInteger: NSDayCalendarUnit]
setObject: [NSNumber
numberWithUnsignedInteger: NSDayCalendarUnit]
forKey: @"_unit"];
[attributes setObject: [NSNumber numberWithFloat: digitWidth * 2]
forKey: @"_width"];
@ -267,20 +270,21 @@ static void drawRoundedSelection(NSRect rect) {
initWithString: day
attributes: attributes] autorelease]];
[result
addObject: [[[NSAttributedString alloc]
[result addObject: [[[NSAttributedString alloc]
initWithString: @"/"
attributes: separatorAttributes] autorelease]];
attributes: separatorAttributes]
autorelease]];
[attributes
setObject: [NSNumber numberWithUnsignedInteger: [components year]]
setObject: [NSNumber
numberWithUnsignedInteger: [components year]]
forKey: @"_value"];
[attributes setObject: [NSNumber numberWithUnsignedInteger: 0]
forKey: @"_min"];
[attributes setObject: [NSNumber numberWithUnsignedInteger: 9999]
forKey: @"_max"];
[attributes
setObject: [NSNumber numberWithUnsignedInteger: NSYearCalendarUnit]
[attributes setObject: [NSNumber numberWithUnsignedInteger:
NSYearCalendarUnit]
forKey: @"_unit"];
[attributes setObject: [NSNumber numberWithFloat: digitWidth * 4]
forKey: @"_width"];
@ -444,13 +448,15 @@ static void getRectsInFrameForAttributesStrings(NSRect *rects, NSRect frame,
[self drawInteriorWithFrame: frame inView: view];
[[_controlView graphicsStyle]
drawStepperButtonInRect: [self _upArrowFrameForStepperFrame: stepper]
drawStepperButtonInRect:
[self _upArrowFrameForStepperFrame: stepper]
clipRect: stepper
enabled: [self isEnabled]
highlighted: _isUpHighlighted
upNotDown: YES];
[[_controlView graphicsStyle]
drawStepperButtonInRect: [self _downArrowFrameForStepperFrame: stepper]
drawStepperButtonInRect:
[self _downArrowFrameForStepperFrame: stepper]
clipRect: stepper
enabled: [self isEnabled]
highlighted: _isDownHighlighted

View File

@ -83,10 +83,9 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
}
// None of the backends can be used.
[NSException
raise: NSWindowServerCommunicationException
format:
@"Failed to connect to a window server. Available backends are: %@",
[NSException raise: NSWindowServerCommunicationException
format: @"Failed to connect to a window server. Available "
@"backends are: %@",
backends];
[backends release];

View File

@ -372,8 +372,8 @@ static int untitled_document_number = 0;
else
return untitledName;
} else {
return
[[NSFileManager defaultManager] displayNameAtPath: [_fileURL path]];
return [[NSFileManager defaultManager]
displayNameAtPath: [_fileURL path]];
}
}
@ -455,8 +455,8 @@ static int untitled_document_number = 0;
if ([self _isSelectorOverridden: @selector(readFromFile:ofType:)]) {
return [self readFromFile: [url path] ofType: type];
} else {
NSFileWrapper *fileWrapper =
[[[NSFileWrapper alloc] initWithPath: [url path]] autorelease];
NSFileWrapper *fileWrapper = [[[NSFileWrapper alloc]
initWithPath: [url path]] autorelease];
return [self readFromFileWrapper: fileWrapper
ofType: type
@ -490,8 +490,8 @@ static int untitled_document_number = 0;
- (NSFileWrapper *) fileWrapperOfType: (NSString *) type
error: (NSError **) error
{
if ([self
_isSelectorOverridden: @selector(fileWrapperRepresentationOfType:)])
if ([self _isSelectorOverridden: @selector
(fileWrapperRepresentationOfType:)])
return [self fileWrapperRepresentationOfType: type];
else {
NSData *data = [self dataOfType: type error: error];
@ -723,7 +723,8 @@ static int untitled_document_number = 0;
// document subclass
if ([self _isSelectorOverridden: @selector
(saveToFile:
saveOperation:delegate:didSaveSelector:contextInfo:)]) {
saveOperation:delegate:didSaveSelector:contextInfo
:)]) {
[self saveToFile: savePath
saveOperation: operation
delegate: delegate
@ -774,16 +775,19 @@ static int untitled_document_number = 0;
int result = NSRunAlertPanel(
[self displayName],
NSLocalizedStringFromTableInBundle(
@"Another user or process has changed this document's file "
@"on disk.\n\nIf you save now, those changes will be lost. "
@"Another user or process has changed this "
@"document's file "
@"on disk.\n\nIf you save now, those changes will "
@"be lost. "
@"Save anyway?",
nil, [NSBundle bundleForClass: [NSDocument class]], @""),
nil, [NSBundle bundleForClass: [NSDocument class]],
@""),
NSLocalizedStringFromTableInBundle(
@"Don't Save", nil,
[NSBundle bundleForClass: [NSDocument class]], @""),
NSLocalizedStringFromTableInBundle(
@"Save", nil, [NSBundle bundleForClass: [NSDocument class]],
@""),
@"Save", nil,
[NSBundle bundleForClass: [NSDocument class]], @""),
nil);
if (result == NSAlertDefaultReturn) {
// The user canceled the save operation.
@ -799,7 +803,8 @@ static int untitled_document_number = 0;
if ([self _isSelectorOverridden: @selector
(saveToFile:
saveOperation:delegate:didSaveSelector:contextInfo:)]) {
saveOperation:delegate:didSaveSelector:contextInfo
:)]) {
[self saveToFile: [_fileURL path]
saveOperation: NSSaveOperation
delegate: delegate
@ -865,8 +870,9 @@ static int untitled_document_number = 0;
if ([delegate respondsToSelector: selector]) {
void (*delegateMethod)(id, SEL, id, BOOL, void *);
delegateMethod = (void (*)(
id, SEL, id, BOOL, void *)) [delegate methodForSelector: selector];
delegateMethod =
(void (*)(id, SEL, id, BOOL,
void *)) [delegate methodForSelector: selector];
delegateMethod(delegate, selector, self, success, info);
}
}
@ -890,8 +896,9 @@ static int untitled_document_number = 0;
if ([delegate respondsToSelector: selector]) {
// Tell delegate if the print info was updated.
void (*delegateMethod)(id, SEL, id, BOOL, void *);
delegateMethod = (void (*)(
id, SEL, id, BOOL, void *)) [delegate methodForSelector: selector];
delegateMethod =
(void (*)(id, SEL, id, BOOL,
void *)) [delegate methodForSelector: selector];
delegateMethod(delegate, selector, self, button == NSOKButton, info);
}
}
@ -967,13 +974,14 @@ static int untitled_document_number = 0;
@"Save changes to %@?", nil,
[NSBundle bundleForClass: [NSDocument class]], @""),
NSLocalizedStringFromTableInBundle(
@"Yes", nil, [NSBundle bundleForClass: [NSDocument class]],
@""),
@"Yes", nil,
[NSBundle bundleForClass: [NSDocument class]], @""),
NSLocalizedStringFromTableInBundle(
@"No", nil, [NSBundle bundleForClass: [NSDocument class]], @""),
@"No", nil,
[NSBundle bundleForClass: [NSDocument class]], @""),
NSLocalizedStringFromTableInBundle(
@"Cancel", nil, [NSBundle bundleForClass: [NSDocument class]],
@""),
@"Cancel", nil,
[NSBundle bundleForClass: [NSDocument class]], @""),
fileName);
if (result == NSAlertDefaultReturn) {
[self saveDocumentWithDelegate: delegate
@ -994,8 +1002,9 @@ static int untitled_document_number = 0;
if ([delegate respondsToSelector: selector]) {
void (*delegateMethod)(id, SEL, id, BOOL, void *);
delegateMethod = (void (*)(
id, SEL, id, BOOL, void *)) [delegate methodForSelector: selector];
delegateMethod =
(void (*)(id, SEL, id, BOOL,
void *)) [delegate methodForSelector: selector];
delegateMethod(delegate, selector, self, OKToClose, info);
}
}
@ -1011,8 +1020,9 @@ static int untitled_document_number = 0;
contextInfo: info];
} else if ([delegate respondsToSelector: selector]) {
void (*delegateMethod)(id, SEL, id, BOOL, void *);
delegateMethod = (void (*)(
id, SEL, id, BOOL, void *)) [delegate methodForSelector: selector];
delegateMethod =
(void (*)(id, SEL, id, BOOL,
void *)) [delegate methodForSelector: selector];
delegateMethod(delegate, selector, self, YES, info);
}
}
@ -1021,12 +1031,15 @@ static int untitled_document_number = 0;
int result = NSRunAlertPanel(
nil,
NSLocalizedStringFromTableInBundle(
@"%@ has been edited. Are you sure you want to undo changes?", nil,
@"%@ has been edited. Are you sure you want to undo "
@"changes?",
nil, [NSBundle bundleForClass: [NSDocument class]], @""),
NSLocalizedStringFromTableInBundle(
@"Revert", nil,
[NSBundle bundleForClass: [NSDocument class]], @""),
NSLocalizedStringFromTableInBundle(
@"Revert", nil, [NSBundle bundleForClass: [NSDocument class]], @""),
NSLocalizedStringFromTableInBundle(
@"Cancel", nil, [NSBundle bundleForClass: [NSDocument class]], @""),
@"Cancel", nil,
[NSBundle bundleForClass: [NSDocument class]], @""),
nil, [self displayName]);
if (result == NSAlertDefaultReturn) {
@ -1140,8 +1153,8 @@ static int untitled_document_number = 0;
if (data == nil)
return nil;
return
[[[NSFileWrapper alloc] initRegularFileWithContents: data] autorelease];
return [[[NSFileWrapper alloc] initRegularFileWithContents: data]
autorelease];
}
- initWithContentsOfFile: (NSString *) path ofType: (NSString *) type {
@ -1161,7 +1174,8 @@ static int untitled_document_number = 0;
@"Can't open file '%@'. Error = %@", nil,
[NSBundle bundleForClass: [NSDocument class]], @""),
NSLocalizedStringFromTableInBundle(
@"OK", nil, [NSBundle bundleForClass: [NSDocument class]], @""),
@"OK", nil,
[NSBundle bundleForClass: [NSDocument class]], @""),
nil, nil, path, error);
[self dealloc];
return nil;
@ -1186,7 +1200,8 @@ static int untitled_document_number = 0;
@"Can't open file '%@'. Error = %@", nil,
[NSBundle bundleForClass: [NSDocument class]], @""),
NSLocalizedStringFromTableInBundle(
@"OK", nil, [NSBundle bundleForClass: [NSDocument class]], @""),
@"OK", nil,
[NSBundle bundleForClass: [NSDocument class]], @""),
nil, nil, url, error);
[self dealloc];
return nil;
@ -1372,13 +1387,14 @@ static int untitled_document_number = 0;
NSBeginAlertSheet(
nil,
NSLocalizedStringFromTableInBundle(
@"Yes", nil, [NSBundle bundleForClass: [NSDocument class]],
@""),
@"Yes", nil,
[NSBundle bundleForClass: [NSDocument class]], @""),
NSLocalizedStringFromTableInBundle(
@"No", nil, [NSBundle bundleForClass: [NSDocument class]], @""),
@"No", nil,
[NSBundle bundleForClass: [NSDocument class]], @""),
NSLocalizedStringFromTableInBundle(
@"Cancel", nil, [NSBundle bundleForClass: [NSDocument class]],
@""),
@"Cancel", nil,
[NSBundle bundleForClass: [NSDocument class]], @""),
sender, self,
@selector(didEndShouldCloseSheet:returnCode:contextInfo:), NULL,
sender,
@ -1398,11 +1414,11 @@ static int untitled_document_number = 0;
@"Save changes to %@?", nil,
[NSBundle bundleForClass: [NSDocument class]], @""),
NSLocalizedStringFromTableInBundle(
@"Yes", nil, [NSBundle bundleForClass: [NSDocument class]],
@""),
@"Yes", nil,
[NSBundle bundleForClass: [NSDocument class]], @""),
NSLocalizedStringFromTableInBundle(
@"No", nil, [NSBundle bundleForClass: [NSDocument class]],
@""),
@"No", nil,
[NSBundle bundleForClass: [NSDocument class]], @""),
NSLocalizedStringFromTableInBundle(
@"Cancel", nil,
[NSBundle bundleForClass: [NSDocument class]], @""),

View File

@ -402,8 +402,8 @@ static NSDocumentController *shared = nil;
{
IMP mine = [NSDocumentController instanceMethodForSelector: @selector
(openDocumentWithContentsOfFile:display:)];
IMP theirs = [self
methodForSelector: @selector(openDocumentWithContentsOfFile:display:)];
IMP theirs = [self methodForSelector: @selector
(openDocumentWithContentsOfFile:display:)];
if ([url isFileURL] && mine != theirs)
return [self openDocumentWithContentsOfFile: [url path]
@ -468,8 +468,9 @@ static NSDocumentController *shared = nil;
[context release];
if ([delegate respondsToSelector: selector]) {
void (*delegateMethod)(id, SEL, id, BOOL, void *);
delegateMethod = (void (*)(
id, SEL, id, BOOL, void *)) [delegate methodForSelector: selector];
delegateMethod =
(void (*)(id, SEL, id, BOOL,
void *)) [delegate methodForSelector: selector];
delegateMethod(delegate, selector, self, ([_documents count] == 0),
info);
}
@ -651,8 +652,8 @@ static NSDocumentController *shared = nil;
while (--count >= 0) {
NSString *path = [lastPathArray objectAtIndex: count];
NSMenuItem *item =
[[[NSMenuItem alloc] initWithTitle: path
NSMenuItem *item = [[[NSMenuItem alloc]
initWithTitle: path
action: @selector(_openRecentDocument:)
keyEquivalent: nil] autorelease];

View File

@ -54,8 +54,8 @@ NSString *const NSDrawerDidCloseNotification = @"NSDrawerDidCloseNotification";
NSRect parentFrame = [parentWindow frame];
NSRect parentContentRect =
[parentWindow contentRectForFrameRect: parentFrame];
NSRect drawerFrame =
[NSWindow frameRectForContentRect: NSMakeRect(0, 0, contentSize.width,
NSRect drawerFrame = [NSWindow
frameRectForContentRect: NSMakeRect(0, 0, contentSize.width,
contentSize.height)
styleMask: NSDrawerWindowMask];
@ -168,21 +168,20 @@ NSString *const NSDrawerDidCloseNotification = @"NSDrawerDidCloseNotification";
_state = 0;
_edge = 0;
if ([keyed containsValueForKey: @"NSPreferredEdge"])
[self
setPreferredEdge: [keyed decodeIntForKey: @"NSPreferredEdge"]];
[self setPreferredEdge:
[keyed decodeIntForKey: @"NSPreferredEdge"]];
else
_preferredEdge = 0;
if ([keyed containsValueForKey: @"NSLeadingOffset"])
[self setLeadingOffset: [keyed
decodeFloatForKey: @"NSLeadingOffset"]];
[self setLeadingOffset:
[keyed decodeFloatForKey: @"NSLeadingOffset"]];
else
_leadingOffset = 0;
if ([keyed containsValueForKey: @"NSTrailingOffset"])
[self
setTrailingOffset: [keyed
decodeFloatForKey: @"NSTrailingOffset"]];
[self setTrailingOffset:
[keyed decodeFloatForKey: @"NSTrailingOffset"]];
else
_trailingOffset = 0;
@ -197,8 +196,8 @@ NSString *const NSDrawerDidCloseNotification = @"NSDrawerDidCloseNotification";
_parentWindow = _nextParentWindow = nil;
if ([keyed containsValueForKey: @"NSParentWindow"])
[self
setParentWindow: [keyed decodeObjectForKey: @"NSParentWindow"]];
[self setParentWindow:
[keyed decodeObjectForKey: @"NSParentWindow"]];
if ([keyed containsValueForKey: @"NSDelegate"])
[self setDelegate: [keyed decodeObjectForKey: @"NSDelegate"]];
@ -206,18 +205,16 @@ NSString *const NSDrawerDidCloseNotification = @"NSDrawerDidCloseNotification";
_delegate = nil;
if ([keyed containsValueForKey: @"NSMinContentSize"]) {
[self
setMinContentSize: [keyed
decodeSizeForKey: @"NSMinContentSize"]];
[self setMinContentSize:
[keyed decodeSizeForKey: @"NSMinContentSize"]];
_minContentSize.width += 12.0;
_minContentSize.height += 12.0;
} else
_minContentSize = NSZeroSize;
if ([keyed containsValueForKey: @"NSMaxContentSize"]) {
[self
setMaxContentSize: [keyed
decodeSizeForKey: @"NSMaxContentSize"]];
[self setMaxContentSize:
[keyed decodeSizeForKey: @"NSMaxContentSize"]];
_maxContentSize.width += 12.0;
_maxContentSize.height += 12.0;
} else
@ -379,8 +376,8 @@ NSString *const NSDrawerDidCloseNotification = @"NSDrawerDidCloseNotification";
}
- (void) open {
[self
openOnEdge: [[self class] visibleEdgeWithPreferredEdge: _preferredEdge
[self openOnEdge: [[self class]
visibleEdgeWithPreferredEdge: _preferredEdge
parentWindow: _parentWindow
drawerWindow: _drawerWindow]];
}

View File

@ -158,8 +158,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
initWithType: type
location: location
modifierFlags: modifierFlags
window: [NSApp
windowWithWindowNumber: windowNumber]
window: [NSApp windowWithWindowNumber:
windowNumber]
characters: characters
charactersIgnoringModifiers: charactersIgnoringModifiers
isARepeat: isARepeat
@ -241,11 +241,11 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
- (NSString *) description {
return [NSString
stringWithFormat: @"<NSEvent: type=%lu loc=(%f,%f) time=%f flags=0x%X "
stringWithFormat:
@"<NSEvent: type=%lu loc=(%f,%f) time=%f flags=0x%X "
@"win=%p winNum=%lu>",
(unsigned long) [self type],
[self locationInWindow].x, [self locationInWindow].y,
[self timestamp],
(unsigned long) [self type], [self locationInWindow].x,
[self locationInWindow].y, [self timestamp],
(unsigned long) [self modifierFlags], [self window],
(unsigned long) [self windowNumber]];
}

View File

@ -121,8 +121,8 @@ static NSLock *_cacheLock = nil;
if (self == [NSFont class]) {
_fontCacheCapacity = 4;
_fontCacheSize = 0;
_fontCache =
NSZoneMalloc([self zone], sizeof(NSFont *) * _fontCacheCapacity);
_fontCache = NSZoneMalloc([self zone],
sizeof(NSFont *) * _fontCacheCapacity);
#ifndef DARLING
_nibFontTranslator = [[NSNibFontNameTranslator alloc] init];
#endif
@ -234,8 +234,8 @@ static NSLock *_cacheLock = nil;
[ctFont release];
[name release];
} else {
result = [NSFont
fontWithName: [O2Font postscriptNameForDisplayName: fallbackName]
result = [NSFont fontWithName: [O2Font postscriptNameForDisplayName:
fallbackName]
size: size];
}
O2FontLog(@"asked for type: %d got font: %@", type, result);
@ -299,8 +299,8 @@ static NSLock *_cacheLock = nil;
}
+ (NSFont *) userFontOfSize: (CGFloat) size {
return [NSFont
fontWithName: [O2Font postscriptNameForDisplayName: @"San Francisco"]
return [NSFont fontWithName: [O2Font postscriptNameForDisplayName:
@"San Francisco"]
size: (size == 0) ? 12.0 : size];
}
@ -580,7 +580,8 @@ static NSLock *_cacheLock = nil;
- (NSAffineTransform *) textTransform {
NSAffineTransform *result = [NSAffineTransform transform];
NSAffineTransformStruct fields = {
_matrix[0], _matrix[1], _matrix[2], _matrix[3], _matrix[4], _matrix[5],
_matrix[0], _matrix[1], _matrix[2],
_matrix[3], _matrix[4], _matrix[5],
};
[result setTransformStruct: fields];
@ -611,8 +612,9 @@ static NSLock *_cacheLock = nil;
while ([nameComponents count] > 1 && familyName == nil) {
[nameComponents removeLastObject];
familyName = [[NSFontFamily
fontFamilyWithName: [nameComponents
componentsJoinedByString: blank]] name];
fontFamilyWithName:
[nameComponents componentsJoinedByString: blank]]
name];
}
}
@ -664,11 +666,12 @@ static NSLock *_cacheLock = nil;
// [self
// matrix], NSFontMatrixAttribute,
//// currently returns nil
// [self coveredCharacterSet], NSFontCharacterSetAttribute, //
// currently returns nil
// [self coveredCharacterSet], NSFontCharacterSetAttribute,
// // currently returns nil
[self _fontTraitsAsDictionary], NSFontTraitsAttribute,
[typeface traitName], NSFontFaceAttribute,
[NSNumber numberWithDouble: [self maximumAdvancement].width],
[NSNumber
numberWithDouble: [self maximumAdvancement].width],
NSFontFixedAdvanceAttribute, [self displayName],
NSFontVisibleNameAttribute, nil];

View File

@ -174,8 +174,8 @@ const NSFontWeight NSFontWeightRegular = 0x0000000000000000;
[NSMutableDictionary dictionaryWithDictionary: _attributes];
NSMutableDictionary *traitsCopy = [NSMutableDictionary
dictionaryWithDictionary: [_attributes
objectForKey: NSFontTraitsAttribute]];
dictionaryWithDictionary:
[_attributes objectForKey: NSFontTraitsAttribute]];
[traitsCopy setObject: [NSNumber numberWithUnsignedInt: traits]
forKey: NSFontSymbolicTrait];
[copy setObject: traitsCopy forKey: NSFontTraitsAttribute];

View File

@ -170,10 +170,11 @@ static Class _fontPanelFactory;
NSString *traitName = [typeface traitName];
// Callers expect an array of four objects
[result
addObject: [NSArray arrayWithObjects: name, traitName,
[NSNumber numberWithInt: 0],
[NSNumber numberWithInt: 0],
[result addObject: [NSArray arrayWithObjects: name, traitName,
[NSNumber
numberWithInt: 0],
[NSNumber
numberWithInt: 0],
nil]];
}
@ -319,14 +320,16 @@ static Class _fontPanelFactory;
[item setTag: NSUnitalicFontMask];
[item setTitle: NSLocalizedStringFromTableInBundle(
@"Unitalic", nil,
[NSBundle bundleForClass: [NSFontManager
[NSBundle bundleForClass:
[NSFontManager
class]],
@"Remove the italic font trait")];
} else {
[item setTag: NSItalicFontMask];
[item setTitle: NSLocalizedStringFromTableInBundle(
@"Italic", nil,
[NSBundle bundleForClass: [NSFontManager
[NSBundle bundleForClass:
[NSFontManager
class]],
@"Add the italic font trait")];
}
@ -336,14 +339,16 @@ static Class _fontPanelFactory;
[item setTag: NSUnboldFontMask];
[item setTitle: NSLocalizedStringFromTableInBundle(
@"Unbold", nil,
[NSBundle bundleForClass: [NSFontManager
[NSBundle bundleForClass:
[NSFontManager
class]],
@"Remove the bold font trait")];
} else {
[item setTag: NSBoldFontMask];
[item setTitle: NSLocalizedStringFromTableInBundle(
@"Bold", nil,
[NSBundle bundleForClass: [NSFontManager
[NSBundle bundleForClass:
[NSFontManager
class]],
@"Add the bold font trait")];
}

View File

@ -195,7 +195,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
[_sampleTextField
setStringValue: [[font displayName]
stringByAppendingFormat: @" %g pt", pointSize]];
stringByAppendingFormat: @" %g pt",
pointSize]];
[_sampleTextField setFont: font];
}
@ -210,8 +211,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
unsigned traitIndex = [traits indexOfObject: [typeface traitName]];
NSArray *sizes = [self availablePointSizes];
unsigned sizeIndex = [sizes
indexOfObject: [NSString
stringWithFormat: @"%g", [font pointSize]]];
indexOfObject: [NSString stringWithFormat: @"%g",
[font pointSize]]];
[self buildFamilyMatrix];
[_familyMatrix selectCellAtRow: familyIndex column: 0];
@ -260,8 +261,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
if (row >= 0) {
[_sizeTextField
setStringValue: [NSString
stringWithFormat: @"%g",
setStringValue:
[NSString stringWithFormat: @"%g",
[[sizes objectAtIndex: row]
floatValue]]];
}

View File

@ -172,7 +172,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
- (NSAttributedString *) attributedStringValue {
NSMutableDictionary *attributes = [NSMutableDictionary dictionary];
NSMutableParagraphStyle *paraStyle =
[[[NSParagraphStyle defaultParagraphStyle] mutableCopy] autorelease];
[[[NSParagraphStyle defaultParagraphStyle] mutableCopy]
autorelease];
NSFont *font = [self font];
if (font != nil)
@ -189,9 +190,9 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
[paraStyle setAlignment: _textAlignment];
[attributes setObject: paraStyle forKey: NSParagraphStyleAttributeName];
return
[[[NSAttributedString alloc] initWithString: [self stringValue]
attributes: attributes] autorelease];
return [[[NSAttributedString alloc] initWithString: [self stringValue]
attributes: attributes]
autorelease];
}
- (void) drawInteriorWithFrame: (NSRect) frame inView: (NSView *) control {

View File

@ -37,9 +37,9 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
[super dealloc];
}
+ (NSGlyphInfo *) glyphInfoWithCharacterIdentifier: (NSUInteger) identifier
collection:
(NSCharacterCollection) collection
+ (NSGlyphInfo *)
glyphInfoWithCharacterIdentifier: (NSUInteger) identifier
collection: (NSCharacterCollection) collection
baseString: (NSString *) baseString
{
NSUnimplementedMethod();

View File

@ -174,8 +174,8 @@ static void evaluate(void *info, CGFloat const *input, CGFloat *output) {
{
CGContextRef context = [[NSGraphicsContext currentContext] graphicsPort];
CGFunctionCallbacks callbacks = {0, evaluate, NULL};
CGFunctionRef function =
CGFunctionCreate(self, 1, NULL, _numberOfComponents, NULL, &callbacks);
CGFunctionRef function = CGFunctionCreate(
self, 1, NULL, _numberOfComponents, NULL, &callbacks);
CGColorSpaceRef colorSpace = [_colorSpace CGColorSpace];
CGShadingRef shading = CGShadingCreateAxial(colorSpace, startingPoint,
endingPoint, function, NO, NO);

View File

@ -173,8 +173,9 @@ NSImageName const NSImageNameTouchBarRecordStopTemplate =
+ (NSArray *) _checkBundles {
return [NSArray
arrayWithObjects: [NSBundle mainBundle], // Check the main bundle first
// according to the doc
arrayWithObjects: [NSBundle
mainBundle], // Check the main bundle
// first according to the doc
[NSBundle bundleForClass: self], nil];
}
@ -328,8 +329,8 @@ NSImageName const NSImageNameTouchBarRecordStopTemplate =
- initWithCGImage: (CGImageRef) cgImage size: (NSSize) size; {
if (self = [self initWithSize: size]) {
NSBitmapImageRep *rep =
[[[NSBitmapImageRep alloc] initWithCGImage: cgImage] autorelease];
NSBitmapImageRep *rep = [[[NSBitmapImageRep alloc]
initWithCGImage: cgImage] autorelease];
[_representations addObject: rep];
}
return self;
@ -337,8 +338,9 @@ NSImageName const NSImageNameTouchBarRecordStopTemplate =
- initWithPasteboard: (NSPasteboard *) pasteboard {
NSString *available = [pasteboard
availableTypeFromArray: [[self class] imageUnfilteredPasteboardTypes]];
NSString *available =
[pasteboard availableTypeFromArray:
[[self class] imageUnfilteredPasteboardTypes]];
NSData *data = [pasteboard dataForType: available];
if (data == nil) {
[self release];
@ -580,7 +582,8 @@ NSImageName const NSImageNameTouchBarRecordStopTemplate =
}
- (NSImageRep *)
_bestUncachedFallbackCachedRepresentationForDevice: (NSDictionary *) device
_bestUncachedFallbackCachedRepresentationForDevice:
(NSDictionary *) device
size: (NSSize) size
{
int i, count = [_representations count];
@ -668,13 +671,14 @@ NSImageName const NSImageNameTouchBarRecordStopTemplate =
case NSImageCacheBySize:
if ([[uncached colorSpaceName]
isEqual: [device objectForKey: NSDeviceColorSpaceName]]) {
isEqual: [device objectForKey:
NSDeviceColorSpaceName]]) {
NSSize size = [self size];
if ((size.width == [uncached pixelsWide]) &&
(size.height == [uncached pixelsHigh])) {
int deviceBPS =
[[device objectForKey: NSDeviceBitsPerSample] intValue];
int deviceBPS = [[device
objectForKey: NSDeviceBitsPerSample] intValue];
if (deviceBPS == [uncached bitsPerSample])
return uncached;
@ -811,8 +815,8 @@ NSImageName const NSImageNameTouchBarRecordStopTemplate =
if ([representation isKindOfClass: [NSCachedImageRep class]])
context = [NSGraphicsContext
graphicsContextWithWindow: [(NSCachedImageRep *)
representation window]];
graphicsContextWithWindow: [(NSCachedImageRep *) representation
window]];
else if ([representation isKindOfClass: [NSBitmapImageRep class]])
context = [NSGraphicsContext
graphicsContextWithBitmapImageRep: (NSBitmapImageRep *)
@ -958,8 +962,8 @@ NSImageName const NSImageNameTouchBarRecordStopTemplate =
// Keep a lid on any intermediate allocations while producing caches
NSAutoreleasePool *pool = [NSAutoreleasePool new];
NSImageRep *any =
[[[self _bestUncachedFallbackCachedRepresentationForDevice: nil
NSImageRep *any = [[[self
_bestUncachedFallbackCachedRepresentationForDevice: nil
size: rect.size]
retain] autorelease];
NSImageRep *cachedRep = nil;
@ -1060,8 +1064,8 @@ NSImageName const NSImageNameTouchBarRecordStopTemplate =
- (NSString *) description {
NSSize size = [self size];
return
[NSString stringWithFormat:
return [NSString
stringWithFormat:
@"<%@[%p] name: %@ size: { %f, %f } representations: %@>",
[self class], self, _name, size.width, size.height,
_representations];

View File

@ -345,12 +345,12 @@ static NSMutableArray *_registeredClasses = nil;
- (NSString *) description {
return [NSString
stringWithFormat: @"<%@[%p] size: { %f, %f } colorSpace: %@ (%dx%d @ "
stringWithFormat:
@"<%@[%p] size: { %f, %f } colorSpace: %@ (%dx%d @ "
@"%d bps) alpha: %@ opaque: %@>",
[self class], self, _size.width, _size.height,
_colorSpaceName, _pixelsWide, _pixelsHigh,
_bitsPerSample, _hasAlpha ? @"YES" : @"NO",
_isOpaque ? @"YES" : @"NO"];
_colorSpaceName, _pixelsWide, _pixelsHigh, _bitsPerSample,
_hasAlpha ? @"YES" : @"NO", _isOpaque ? @"YES" : @"NO"];
}
@end

View File

@ -41,32 +41,32 @@ static NSDictionary *sScrollerButtonAttributes = nil;
sNormalMenuTextAttributes = [[NSDictionary
dictionaryWithObjectsAndKeys: menuFont, NSFontAttributeName,
[NSColor menuItemTextColor],
NSForegroundColorAttributeName, nil]
retain];
NSForegroundColorAttributeName,
nil] retain];
sSelectedMenuTextAttributes = [[NSDictionary
dictionaryWithObjectsAndKeys: menuFont, NSFontAttributeName,
dictionaryWithObjectsAndKeys:
menuFont, NSFontAttributeName,
[NSColor selectedMenuItemTextColor],
NSForegroundColorAttributeName, nil]
retain];
NSForegroundColorAttributeName, nil] retain];
sDimmedMenuTextAttributes = [[NSDictionary
dictionaryWithObjectsAndKeys: menuFont, NSFontAttributeName,
[NSColor grayColor],
NSForegroundColorAttributeName, nil]
retain];
NSForegroundColorAttributeName,
nil] retain];
sDimmedMenuTextShadowAttributes = [[NSDictionary
dictionaryWithObjectsAndKeys: menuFont, NSFontAttributeName,
[NSColor whiteColor],
NSForegroundColorAttributeName, nil]
retain];
NSForegroundColorAttributeName,
nil] retain];
sScrollerButtonAttributes = [[NSDictionary
dictionaryWithObjectsAndKeys: [NSFont labelFontOfSize: 8],
NSFontAttributeName,
[NSColor grayColor],
NSForegroundColorAttributeName, nil]
retain];
NSForegroundColorAttributeName,
nil] retain];
}
}
@ -189,8 +189,8 @@ static NSDictionary *sScrollerButtonAttributes = nil;
}
- (CGFloat) menuBarHeight {
NSDictionary *attributes =
[NSDictionary dictionaryWithObjectsAndKeys: [NSFont menuFontOfSize: 0],
NSDictionary *attributes = [NSDictionary
dictionaryWithObjectsAndKeys: [NSFont menuFontOfSize: 0],
NSFontAttributeName, nil];
CGFloat result = [@"Menu" sizeWithAttributes: attributes].height;
@ -279,7 +279,8 @@ static NSDictionary *sScrollerButtonAttributes = nil;
[mutableString
addAttributes:
[NSDictionary
dictionaryWithObject: [NSColor menuItemTextColor]
dictionaryWithObject:
[NSColor menuItemTextColor]
forKey: NSForegroundColorAttributeName]
range: range];
}
@ -315,8 +316,8 @@ static NSDictionary *sScrollerButtonAttributes = nil;
else
color = [NSColor disabledControlTextColor];
checkMark =
[[NSInterfacePartAttributedString alloc] initWithCharacter: 0x61
checkMark = [[NSInterfacePartAttributedString alloc]
initWithCharacter: 0x61
fontName: @"Marlett"
pointSize: 10
color: color];
@ -545,8 +546,8 @@ static NSDictionary *sScrollerButtonAttributes = nil;
NSRect blockRect = progressRect;
int numBlocks;
numBlocks =
(animation * progressRect.size.width) / (BLOCK_WIDTH + BLOCK_SPACING);
numBlocks = (animation * progressRect.size.width) /
(BLOCK_WIDTH + BLOCK_SPACING);
if (numBlocks > 0)
numBlocks++;

View File

@ -101,9 +101,9 @@ static void *NSBinderChangeContext;
result = [NSValueTransformer valueTransformerForName: name];
if (result == nil) {
NSBindingDebugLog(
kNSBindingDebugLogLevel1,
@"[NSValueTransformer valueTransformerForName:%@] failed in "
NSBindingDebugLog(kNSBindingDebugLogLevel1,
@"[NSValueTransformer "
@"valueTransformerForName:%@] failed in "
@"NSBinder.m",
name);
}
@ -151,8 +151,8 @@ static void *NSBinderChangeContext;
- (void) setSource: (id) value {
if (_source != value) {
_source = value;
[self
setBindingPath: [_source _replacementKeyPathForBinding: _binding]];
[self setBindingPath: [_source
_replacementKeyPathForBinding: _binding]];
}
}
@ -185,8 +185,8 @@ static void *NSBinderChangeContext;
if (_binding != value) {
[_binding release];
_binding = [value copy];
[self
setBindingPath: [_source _replacementKeyPathForBinding: _binding]];
[self setBindingPath: [_source
_replacementKeyPathForBinding: _binding]];
}
}

View File

@ -52,9 +52,9 @@ static void *NSKVOBinderChangeContext;
- (void) stopObservingChanges {
@try {
if (_isObserving) {
NSBindingDebugLog(
kNSBindingDebugLogLevel2,
@"stop observing binding between %@.%@ alias %@ and %@.%@ (%@)",
NSBindingDebugLog(kNSBindingDebugLogLevel2,
@"stop observing binding between %@.%@ alias %@ "
@"and %@.%@ (%@)",
[_source className], _binding, _bindingPath,
[_destination className], _keyPath, self);
[super stopObservingChanges];
@ -153,16 +153,17 @@ NSString *NSFormatDisplayPattern(NSString *pattern, id *values,
- (void) writeDestinationToSource {
NSArray *peersIncludingSelf = [self peerBinders];
NSInteger i,
count = (peersIncludingSelf == nil) ? 1 : [peersIncludingSelf count];
NSInteger i, count = (peersIncludingSelf == nil)
? 1
: [peersIncludingSelf count];
id allBinders[count];
id allValues[count];
BOOL isEditable = YES;
BOOL containsPlaceholder = NO;
if (count > 1)
peersIncludingSelf =
[peersIncludingSelf sortedArrayUsingSelector: @selector(compare:)];
peersIncludingSelf = [peersIncludingSelf
sortedArrayUsingSelector: @selector(compare:)];
if (peersIncludingSelf == nil)
allBinders[0] = self;
@ -195,8 +196,8 @@ NSString *NSFormatDisplayPattern(NSString *pattern, id *values,
allValues[i] = dstValue;
}
NSString *pattern =
[[allBinders[0] options] objectForKey: NSDisplayPatternBindingOption];
NSString *pattern = [[allBinders[0] options]
objectForKey: NSDisplayPatternBindingOption];
id value;
if (pattern != nil) {
@ -248,8 +249,8 @@ NSString *NSFormatDisplayPattern(NSString *pattern, id *values,
BOOL isValidKeyPath = YES;
id currentValue = nil;
id bindingPath =
[allBinders[0] bindingPath]; // We want the real one - not "xxxx2" fake
// path from non-main peers
[allBinders[0] bindingPath]; // We want the real one - not "xxxx2"
// fake path from non-main peers
@try {
currentValue = [_source valueForKeyPath: bindingPath];
} @catch (id ex) {
@ -279,7 +280,8 @@ NSString *NSFormatDisplayPattern(NSString *pattern, id *values,
} @catch (id ex) {
if (isValidKeyPath == NO ||
[currentValue
isEqualTo: [NSNumber numberWithBool: NO]] == NO) {
isEqualTo: [NSNumber numberWithBool: NO]] ==
NO) {
[_source setValue: [NSNumber numberWithBool: NO]
forKeyPath: bindingPath];
}
@ -302,8 +304,8 @@ NSString *NSFormatDisplayPattern(NSString *pattern, id *values,
} else {
NSBindingDebugLog(
kNSBindingDebugLogLevel2,
@"skipping setting value on _source: %@ forKeyPath: %@", _source,
bindingPath);
@"skipping setting value on _source: %@ forKeyPath: %@",
_source, bindingPath);
}
if ([self conditionallySetsEditable])

View File

@ -152,13 +152,15 @@ static void *NSMultipleValueBinderWholeArrayChangeContext;
context: &NSMultipleValueBinderWholeArrayChangeContext];
if (![_valueKeyPath hasPrefix: @"@"])
[_rowValues addObserver: self
toObjectsAtIndexes: [NSIndexSet
toObjectsAtIndexes:
[NSIndexSet
indexSetWithIndexesInRange:
NSMakeRange(
0, [_rowValues count])]
NSMakeRange(0,
[_rowValues count])]
forKeyPath: _valueKeyPath
options: 0
context: &NSMultipleValueBinderChangeContext];
context: &
NSMultipleValueBinderChangeContext];
} @catch (id ex) {
NSLog(@"%@", ex);
}
@ -172,10 +174,11 @@ static void *NSMultipleValueBinderWholeArrayChangeContext;
[_destination removeObserver: self forKeyPath: _arrayKeyPath];
if (![_valueKeyPath hasPrefix: @"@"])
[_rowValues removeObserver: self
fromObjectsAtIndexes: [NSIndexSet
fromObjectsAtIndexes:
[NSIndexSet
indexSetWithIndexesInRange:
NSMakeRange(
0, [_rowValues count])]
NSMakeRange(0,
[_rowValues count])]
forKeyPath: _valueKeyPath];
} @catch (id ex) {
NSLog(@"%@", ex);
@ -227,10 +230,10 @@ static void *NSMultipleValueBinderWholeArrayChangeContext;
[self startObservingChanges];
if ([self createsSortDescriptor] && [_binding isEqual: @"value"]) {
[_source
setSortDescriptorPrototype: [[[NSSortDescriptor alloc]
[_source setSortDescriptorPrototype: [[[NSSortDescriptor alloc]
initWithKey: _valueKeyPath
ascending: YES] autorelease]];
ascending: YES]
autorelease]];
}
if ([_source respondsToSelector: @selector
(_establishBindingsWithDestinationIfUnbound:)]) {

View File

@ -90,8 +90,8 @@ void NSDetermineBindingDebugLoggingLevel(void) {
NSString *path = [bundle pathForResource: @"defaultBindingOptions"
ofType: @"plist"];
if ((defaultBindingOptions =
[[NSDictionary alloc] initWithContentsOfFile: path]) == nil)
if ((defaultBindingOptions = [[NSDictionary alloc]
initWithContentsOfFile: path]) == nil)
defaultBindingOptions = [NSDictionary new];
}
@ -107,9 +107,9 @@ void NSDetermineBindingDebugLoggingLevel(void) {
if (self == [NSObject class])
values = [NSMutableDictionary dictionary];
else
values =
[[[[self superclass] _defaultBindingOptionsForBinding: binding]
mutableCopy] autorelease];
values = [[[[self superclass]
_defaultBindingOptionsForBinding: binding] mutableCopy]
autorelease];
[values addEntriesFromDictionary: [defaultBindingOptions
objectForKey: bindingKey]];
@ -152,8 +152,8 @@ void NSDetermineBindingDebugLoggingLevel(void) {
id binder = [ownBinders objectForKey: binding];
if (!binder && create) {
binder =
[[[[self class] _binderClassForBinding: binding] new] autorelease];
binder = [[[[self class] _binderClassForBinding: binding] new]
autorelease];
[ownBinders setObject: binder forKey: binding];
}
@ -243,8 +243,9 @@ void NSDetermineBindingDebugLoggingLevel(void) {
- (NSDictionary *) infoForBinding: (id) binding {
_NSBinder *binder = [self _binderForBinding: binding create: NO];
NSDictionary *result = [NSDictionary
dictionaryWithObjectsAndKeys: [binder destination], NSObservedObjectKey,
[binder keyPath], NSObservedKeyPathKey,
dictionaryWithObjectsAndKeys: [binder destination],
NSObservedObjectKey, [binder keyPath],
NSObservedKeyPathKey,
[binder options], NSOptionsKey, nil];
return result;

View File

@ -31,7 +31,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+ (NSArray *) keyBindingPaths {
return [NSArray
arrayWithObjects: [[NSBundle
bundleForClass: [NSKeyboardBindingManager class]]
bundleForClass: [NSKeyboardBindingManager
class]]
pathForResource: @"StandardKeyBindings"
ofType: @"keyBindings"],
[[NSBundle mainBundle]
@ -105,7 +106,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
NSString *key = [allKeys objectAtIndex: i];
id value = [dict objectForKey: key];
NSMutableArray *keyComponents =
[[[key componentsSeparatedByString: @","] mutableCopy] autorelease];
[[[key componentsSeparatedByString: @","] mutableCopy]
autorelease];
unsigned short hexCode;
unsigned modifierMask = 0, hexInt = 0;
NSScanner *scanner =

View File

@ -76,8 +76,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
_cells = [[NSMutableArray alloc]
initWithArray: [keyed decodeObjectForKey: @"NSCells"]];
id selectedCell = [keyed decodeObjectForKey: @"NSSelectedCell"];
if ((_selectedIndex =
[_cells indexOfObjectIdenticalTo: selectedCell]) != NSNotFound)
if ((_selectedIndex = [_cells
indexOfObjectIdenticalTo: selectedCell]) != NSNotFound)
[self selectCell: selectedCell];
else
_selectedIndex = -1;
@ -453,10 +453,10 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
struct {
SEL selector;
NSString *name;
} notes[] = {
{@selector(controlTextDidBeginEditing:),
} notes[] = {{@selector(controlTextDidBeginEditing:),
NSControlTextDidBeginEditingNotification},
{@selector(controlTextDidChange:), NSControlTextDidChangeNotification},
{@selector(controlTextDidChange:),
NSControlTextDidChangeNotification},
{@selector(controlTextDidEndEditing:),
NSControlTextDidEndEditingNotification},
{NULL, nil}};

View File

@ -31,10 +31,12 @@ static NSMutableArray *_measurementUnits = nil;
measurementUnitWithName: @"Inches"
abbreviation: @"in"
pointsPerUnit: 72.0
stepUpCycle: [NSArray
arrayWithObject: [NSNumber
numberWithFloat: 2.0]]
stepDownCycle: [NSArray arrayWithObjects:
stepUpCycle: [NSArray arrayWithObject:
[NSNumber numberWithFloat:
2.0]]
stepDownCycle:
[NSArray
arrayWithObjects:
[NSNumber numberWithFloat: 0.5],
[NSNumber numberWithFloat: 0.25],
[NSNumber numberWithFloat: 0.125],
@ -46,10 +48,11 @@ static NSMutableArray *_measurementUnits = nil;
measurementUnitWithName: @"Centimeters"
abbreviation: @"cm"
pointsPerUnit: 28.35
stepUpCycle: [NSArray
arrayWithObject: [NSNumber
numberWithFloat: 2.0]]
stepDownCycle: [NSArray arrayWithObjects:
stepUpCycle: [NSArray arrayWithObject:
[NSNumber numberWithFloat:
2.0]]
stepDownCycle:
[NSArray arrayWithObjects:
[NSNumber numberWithFloat: 0.5],
[NSNumber numberWithFloat: 0.2],
nil]];
@ -61,9 +64,11 @@ static NSMutableArray *_measurementUnits = nil;
abbreviation: @"pt"
pointsPerUnit: 1.0
stepUpCycle: [NSArray arrayWithObject:
[NSNumber numberWithFloat: 10.0]]
[NSNumber numberWithFloat:
10.0]]
stepDownCycle: [NSArray arrayWithObject:
[NSNumber numberWithFloat: 0.5]]];
[NSNumber numberWithFloat:
0.5]]];
}
+ (NSMeasurementUnit *) picasMeasurementUnit {
@ -72,9 +77,11 @@ static NSMutableArray *_measurementUnits = nil;
abbreviation: @"pc"
pointsPerUnit: 12.0
stepUpCycle: [NSArray arrayWithObject:
[NSNumber numberWithFloat: 10.0]]
[NSNumber numberWithFloat:
10.0]]
stepDownCycle: [NSArray arrayWithObject:
[NSNumber numberWithFloat: 0.5]]];
[NSNumber numberWithFloat:
0.5]]];
}
+ (NSArray *) allMeasurementUnits {

View File

@ -36,9 +36,9 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
}
+ (CGFloat) menuHeight {
NSDictionary *attributes =
[NSDictionary dictionaryWithObjectsAndKeys: [self menuFont],
NSFontAttributeName, nil];
NSDictionary *attributes = [NSDictionary
dictionaryWithObjectsAndKeys: [self menuFont], NSFontAttributeName,
nil];
CGFloat result = [@"Menu" sizeWithAttributes: attributes].height;
result += 3; // border top/bottom margin
@ -88,8 +88,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
NSRect result;
NSSize titleSize = [[self graphicsStyle] menuItemTextSize: [item title]];
result.origin =
NSMakePoint(NSMaxX(previousBorderRect) + 6,
result.origin = NSMakePoint(
NSMaxX(previousBorderRect) + 6,
floor(([self bounds].size.height - titleSize.height) / 2));
result.size = titleSize;
@ -169,8 +169,8 @@ static void drawSunkenBorder(NSRect rect) {
NSRect bounds = [self bounds];
NSImage *image = [self overflowImage];
NSSize size = [image size];
NSRect rect =
NSInsetRect(NSMakeRect(0, 0, size.width, bounds.size.height), -3, 0);
NSRect rect = NSInsetRect(NSMakeRect(0, 0, size.width, bounds.size.height),
-3, 0);
rect.origin.x = NSMaxX(bounds) - rect.size.width;
@ -198,8 +198,7 @@ static void drawSunkenBorder(NSRect rect) {
[[self graphicsStyle]
drawMenuBarItemBorderInRect: borderRect
hover:
(i ==
hover: (i ==
_selectedItemIndex) /*NSPointInRect(mouseLoc,borderRect)*/
selected: (i == _selectedItemIndex)];

View File

@ -132,8 +132,8 @@ const NSNotificationName NSMenuDidEndTrackingNotification =
[coder decodeValueOfObjCType: @encode(int) at: &flags];
[coder
decodeValuesOfObjCTypes: "@@@", &_title, &_itemArray, &_name];
[coder decodeValuesOfObjCTypes: "@@@", &_title, &_itemArray,
&_name];
_autoenablesItems = !(flags & 0x80000000);
// _excludeMarkColumn = flags & 0x80000;
@ -382,9 +382,9 @@ BOOL itemIsEnabled(NSMenuItem *item) {
enabled = NO;
} else if ([target respondsToSelector: @selector(validateMenuItem:)]) {
enabled = [target validateMenuItem: item];
} else if ([target
respondsToSelector: @selector
(validateUserInterfaceItem:)]) { // New validation scheme
} else if ([target respondsToSelector: @selector
(validateUserInterfaceItem:)]) { // New validation
// scheme
enabled = [target validateUserInterfaceItem: item];
} else {
enabled = YES;
@ -477,8 +477,8 @@ BOOL itemIsEnabled(NSMenuItem *item) {
NSInteger i, count = [_itemArray count];
for (i = 0; i < count; i++) {
NSMenu *check =
[[[_itemArray objectAtIndex: i] submenu] _menuWithName: name];
NSMenu *check = [[[_itemArray objectAtIndex: i] submenu]
_menuWithName: name];
if (check != nil)
return check;

View File

@ -390,8 +390,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
}
- (NSString *) description {
return [NSString
stringWithFormat: @"<%@[0x%x]: title: %@ action: %@ hasSubmenu: %@>",
return [NSString stringWithFormat:
@"<%@[0x%x]: title: %@ action: %@ hasSubmenu: %@>",
[self class], self, [self title],
NSStringFromSelector(_action),
([self hasSubmenu] ? @"YES" : @"NO")];

View File

@ -169,8 +169,8 @@ const NSTimeInterval kMouseMovementThreshold = .001f;
// so a tactical autorelease pool keeps a lid on things
NSAutoreleasePool *pool = [NSAutoreleasePool new];
int count = [viewStack count];
NSScreen *screen =
[self _screenForPoint: [[event window] convertBaseToScreen: point]];
NSScreen *screen = [self
_screenForPoint: [[event window] convertBaseToScreen: point]];
point = [[event window] convertBaseToScreen: point];
@ -226,8 +226,8 @@ const NSTimeInterval kMouseMovementThreshold = .001f;
// If it's got a cascading menu then push that on the
// stack
if ((branch =
[checkView viewAtSelectedIndexPositionOnScreen:
if ((branch = [checkView
viewAtSelectedIndexPositionOnScreen:
screen]) != nil) {
MENUDEBUG(@"adding a new cascading view: %@",
branch);
@ -428,7 +428,8 @@ const NSTimeInterval kMouseMovementThreshold = .001f;
NSMenuView *branch = nil;
// If there's a submenu at the current selected index
if ((branch = [activeMenuView
viewAtSelectedIndexPositionOnScreen: screen]) != nil) {
viewAtSelectedIndexPositionOnScreen: screen]) !=
nil) {
MENUDEBUG(@"adding a new cascading view: %@", branch);
[viewStack addObject: branch];
} else {

View File

@ -173,8 +173,8 @@ static NSRect boundsToTitleAreaRect(NSRect rect) {
NSMenuItem *item = [items objectAtIndex: i];
if ([item isSeparatorItem]) {
NSRect separatorRect =
NSMakeRect(origin.x, origin.y, NSWidth(itemArea),
NSRect separatorRect = NSMakeRect(
origin.x, origin.y, NSWidth(itemArea),
[[self graphicsStyle] menuItemSeparatorSize].height);
[[self graphicsStyle] drawMenuSeparatorInRect: separatorRect];
@ -194,8 +194,8 @@ static NSRect boundsToTitleAreaRect(NSRect rect) {
NSSize partSize;
BOOL showsEnabled = ([item isEnabled] || [item hasSubmenu]);
partRect =
NSMakeRect(origin.x, origin.y, itemArea.size.width, itemHeight);
partRect = NSMakeRect(origin.x, origin.y, itemArea.size.width,
itemHeight);
if (selected)
[[self graphicsStyle] drawMenuSelectionInRect: partRect

View File

@ -53,7 +53,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
// Cache some empty charset so we don't look for it again
[sNameToCharacterSetCache
setObject: [NSCharacterSet
characterSetWithRange: NSMakeRange(0, 0)]
characterSetWithRange: NSMakeRange(
0, 0)]
forKey: name];
}
}
@ -179,9 +180,9 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
while (location < limit) {
NSRange effectiveRange;
NSMutableDictionary *attributes =
[[[self attributesAtIndex: location effectiveRange: &effectiveRange]
mutableCopy] autorelease];
NSMutableDictionary *attributes = [[[self
attributesAtIndex: location
effectiveRange: &effectiveRange] mutableCopy] autorelease];
NSFont *font = NSFontAttributeInDictionary(attributes);
font = [[NSFontManager sharedFontManager] convertFont: font

View File

@ -183,10 +183,12 @@ static inline id childOfItemAtIndex(NSOutlineView *self, id item,
NSNonOwnedPointerMapValueCallBacks, 0);
_itemToLevel = NSCreateMapTable(NSNonOwnedPointerOrNullMapKeyCallBacks,
NSIntegerMapValueCallBacks, 0);
_itemToExpansionState = NSCreateMapTable(
NSNonOwnedPointerOrNullMapKeyCallBacks, NSIntegerMapValueCallBacks, 0);
_itemToNumberOfChildren = NSCreateMapTable(
NSNonOwnedPointerOrNullMapKeyCallBacks, NSIntegerMapValueCallBacks, 0);
_itemToExpansionState =
NSCreateMapTable(NSNonOwnedPointerOrNullMapKeyCallBacks,
NSIntegerMapValueCallBacks, 0);
_itemToNumberOfChildren =
NSCreateMapTable(NSNonOwnedPointerOrNullMapKeyCallBacks,
NSIntegerMapValueCallBacks, 0);
_markerCell = [[NSButtonCell alloc] initImageCell: nil];
[_markerCell setBezelStyle: NSDisclosureBezelStyle];
@ -303,8 +305,8 @@ static inline id childOfItemAtIndex(NSOutlineView *self, id item,
expandThisItem = NO;
if (expandThisItem) {
NSDictionary *userInfo =
[NSDictionary dictionaryWithObjectsAndKeys: item, @"NSObject", nil];
NSDictionary *userInfo = [NSDictionary
dictionaryWithObjectsAndKeys: item, @"NSObject", nil];
[[NSNotificationCenter defaultCenter]
postNotificationName: NSOutlineViewItemWillExpandNotification
object: self
@ -322,8 +324,8 @@ static inline id childOfItemAtIndex(NSOutlineView *self, id item,
}
if (expandChildren) {
int i,
numberOfChildren = numberOfChildrenOfItemAndReload(self, item, YES);
int i, numberOfChildren =
numberOfChildrenOfItemAndReload(self, item, YES);
for (i = 0; i < numberOfChildren; ++i) {
id child = [_dataSource outlineView: self child: i ofItem: item];
@ -344,8 +346,8 @@ static inline id childOfItemAtIndex(NSOutlineView *self, id item,
byItem: item];
// FIXME: Does it actually send this to the delegate too?
if ([_delegate respondsToSelector: @selector(outlineView:
objectValueForTableColumn:byItem:)])
if ([_delegate respondsToSelector: @selector
(outlineView:objectValueForTableColumn:byItem:)])
return [_delegate outlineView: self
objectValueForTableColumn: column
byItem: item];
@ -413,8 +415,8 @@ static inline id childOfItemAtIndex(NSOutlineView *self, id item,
collapseThisItem = NO;
if (collapseThisItem) {
NSDictionary *userInfo =
[NSDictionary dictionaryWithObjectsAndKeys: item, @"NSObject", nil];
NSDictionary *userInfo = [NSDictionary
dictionaryWithObjectsAndKeys: item, @"NSObject", nil];
[[NSNotificationCenter defaultCenter]
postNotificationName: NSOutlineViewItemWillCollapseNotification
object: self
@ -432,8 +434,8 @@ static inline id childOfItemAtIndex(NSOutlineView *self, id item,
}
if (collapseChildren) {
NSInteger i,
numberOfChildren = numberOfChildrenOfItemAndReload(self, item, YES);
NSInteger i, numberOfChildren =
numberOfChildrenOfItemAndReload(self, item, YES);
for (i = 0; i < numberOfChildren; ++i) {
id child = [_dataSource outlineView: self child: i ofItem: item];
@ -733,8 +735,8 @@ static void loadItemIntoMapTables(NSOutlineView *self, id item,
}
if (isItemExpanded(self, item)) {
NSInteger i,
numberOfChildren = numberOfChildrenOfItemAndReload(self, item, NO);
NSInteger i, numberOfChildren =
numberOfChildrenOfItemAndReload(self, item, NO);
id lastChild = nil;
for (i = 0; i < numberOfChildren; i++) {
@ -844,10 +846,10 @@ static void loadItemIntoMapTables(NSOutlineView *self, id item,
else
[_markerCell setState: NSOffState];
if ([_delegate
respondsToSelector: @selector
if ([_delegate respondsToSelector: @selector
(outlineView:
willDisplayOutlineCell:forTableColumn:item:)])
willDisplayOutlineCell:forTableColumn
:item:)])
[_delegate outlineView: self
willDisplayOutlineCell: _markerCell
forTableColumn: column
@ -923,8 +925,8 @@ static void loadItemIntoMapTables(NSOutlineView *self, id item,
}
- (BOOL) delegateSelectionShouldChange {
if ([_delegate
respondsToSelector: @selector(selectionShouldChangeInOutlineView:)])
if ([_delegate respondsToSelector: @selector
(selectionShouldChangeInOutlineView:)])
return [_delegate selectionShouldChangeInOutlineView: self];
return YES;
@ -948,7 +950,8 @@ static void loadItemIntoMapTables(NSOutlineView *self, id item,
object: self
userInfo: [NSDictionary
dictionaryWithObjectsAndKeys:
[NSNumber numberWithFloat: oldWidth],
[NSNumber numberWithFloat:
oldWidth],
@"NSOldWidth", nil]];
}

View File

@ -31,8 +31,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
}
- (int) runModalWithPrintInfo: (NSPrintInfo *) printInfo {
return
[[NSDisplay currentDisplay] runModalPageLayoutWithPrintInfo: printInfo];
return [[NSDisplay currentDisplay]
runModalPageLayoutWithPrintInfo: printInfo];
}
- (int) runModal {

View File

@ -42,9 +42,9 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
NSTextTab *tabs[count];
for (i = 0; i < count; i++) {
tabs[i] =
[[[NSTextTab alloc] initWithType: NSLeftTabStopType
location: (i + 1) * 28.0] autorelease];
tabs[i] = [[[NSTextTab alloc] initWithType: NSLeftTabStopType
location: (i + 1) * 28.0]
autorelease];
}
shared = [[NSArray alloc] initWithObjects: tabs count: count];
}
@ -308,23 +308,23 @@ static inline id mutableCopyWithZone(NSParagraphStyle *self, NSZone *zone) {
switch ([tab tabStopType]) {
case NSLeftTabStopType:
[tabsString
appendString: [NSString
stringWithFormat: @"%fL", [tab location]]];
appendString: [NSString stringWithFormat: @"%fL",
[tab location]]];
break;
case NSRightTabStopType:
[tabsString
appendString: [NSString
stringWithFormat: @"%fR", [tab location]]];
appendString: [NSString stringWithFormat: @"%fR",
[tab location]]];
break;
case NSCenterTabStopType:
[tabsString
appendString: [NSString
stringWithFormat: @"%fC", [tab location]]];
appendString: [NSString stringWithFormat: @"%fC",
[tab location]]];
break;
case NSDecimalTabStopType:
[tabsString
appendString: [NSString
stringWithFormat: @"%fD", [tab location]]];
appendString: [NSString stringWithFormat: @"%fD",
[tab location]]];
break;
}
}
@ -335,17 +335,21 @@ static inline id mutableCopyWithZone(NSParagraphStyle *self, NSZone *zone) {
@"Alignment %d, LineSpacing %f, ParagraphSpacing %f, "
@"ParagraphSpacingBefore %f, HeadIndent %f, TailIndent %f, "
@"FirstLineHeadIndent %f, "
@"LineHeight %f/%f, LineHeightMultiple %f, LineBreakMode %d, Tabs "
@"LineHeight %f/%f, LineHeightMultiple %f, LineBreakMode "
@"%d, Tabs "
@"%@, "
@"DefaultTabInterval %f, Blocks %@, Lists %@, BaseWritingDirection "
@"DefaultTabInterval %f, Blocks %@, Lists %@, "
@"BaseWritingDirection "
@"%d, "
@"HyphenationFactor %f, TighteningFactor %f, HeaderLevel %d",
@"HyphenationFactor %f, TighteningFactor %f, HeaderLevel "
@"%d",
_alignment, _lineSpacing, _paragraphSpacing,
_paragraphSpacingBefore, _headIndent, _tailIndent,
_firstLineHeadIndent, _minimumLineHeight, _maximumLineHeight,
_lineHeightMultiple, _lineBreakMode, tabsString,
_defaultTabInterval, _textBlocks, _textLists, _writingDirection,
_hyphenationFactor, _tighteningFactorForTruncation, _headerLevel];
_firstLineHeadIndent, _minimumLineHeight,
_maximumLineHeight, _lineHeightMultiple, _lineBreakMode,
tabsString, _defaultTabInterval, _textBlocks, _textLists,
_writingDirection, _hyphenationFactor,
_tighteningFactorForTruncation, _headerLevel];
}
@end

View File

@ -121,9 +121,9 @@ const NSPasteboardReadingOptionKey
- (NSString *) stringForType: (NSPasteboardType) type {
NSData *data = [self dataForType: type];
return
[[[NSString alloc] initWithData: data
encoding: NSUnicodeStringEncoding] autorelease];
return [[[NSString alloc] initWithData: data
encoding: NSUnicodeStringEncoding]
autorelease];
}
- (id) propertyListForType: (NSPasteboardType) type {

View File

@ -18,9 +18,8 @@
[self setPlaceholderString:
[coder decodeObjectForKey: @"NSPlaceholderString"]];
[self
setBackgroundColor: [coder
decodeObjectForKey: @"NSBackgroundColor"]];
[self setBackgroundColor:
[coder decodeObjectForKey: @"NSBackgroundColor"]];
[self setPathComponentCells:
[coder decodeObjectForKey: @"NSPathComponentCells"]];
[self setPathStyle: [coder decodeIntForKey: @"NSPathStyle"]];
@ -190,7 +189,8 @@
[controlView setNeedsDisplay: YES];
event = [[controlView window]
nextEventMatchingMask: NSLeftMouseUpMask | NSLeftMouseDraggedMask];
nextEventMatchingMask: NSLeftMouseUpMask |
NSLeftMouseDraggedMask];
} while ([event type] != NSLeftMouseUp);

View File

@ -130,8 +130,8 @@ static const NSTimeInterval kAnimationDuration = .3;
[window setBackgroundColor: [NSColor clearColor]];
[window orderFront: nil];
NSTimer *timer =
[NSTimer timerWithTimeInterval: kAnimationDuration /
NSTimer *timer = [NSTimer
timerWithTimeInterval: kAnimationDuration /
([NSPoofView numberOfPoofImages] - 1)
target: poofView
selector: @selector(poof:)

View File

@ -372,8 +372,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
}
NSRect otherFrame = frame;
NSSize arrowSize = [arrowImage size];
otherFrame.origin.x +=
otherFrame.size.width - (arrowSize.width + (4 - sizeFactor));
otherFrame.origin.x += otherFrame.size.width -
(arrowSize.width + (4 - sizeFactor));
otherFrame.origin.y +=
(otherFrame.size.height - arrowSize.height) / 2;
otherFrame.size = arrowSize;

View File

@ -120,8 +120,8 @@ static const NSTimeInterval kMenuInitialClickThreshold = .3f;
size = [[self graphicsStyle]
menuItemAttributedTextSize: attributedTitle];
} else {
size =
[[self graphicsStyle] menuItemTextSize: [item title]];
size = [[self graphicsStyle]
menuItemTextSize: [item title]];
}
}
titleAndIconWidth += size.width;
@ -277,8 +277,8 @@ static NSRect boundsToTitleAreaRect(NSRect rect) {
origin = itemRect.origin;
if ([item isSeparatorItem]) {
NSRect separatorRect =
NSMakeRect(origin.x, origin.y, NSWidth(itemArea),
NSRect separatorRect = NSMakeRect(
origin.x, origin.y, NSWidth(itemArea),
[[self graphicsStyle] menuItemSeparatorSize].height);
[[self graphicsStyle] drawMenuSeparatorInRect: separatorRect];
@ -299,8 +299,8 @@ static NSRect boundsToTitleAreaRect(NSRect rect) {
NSSize partSize;
BOOL showsEnabled = ([item isEnabled] || [item hasSubmenu]);
partRect =
NSMakeRect(origin.x, origin.y, itemArea.size.width, itemHeight);
partRect = NSMakeRect(origin.x, origin.y, itemArea.size.width,
itemHeight);
if (selected)
[[self graphicsStyle] drawMenuSelectionInRect: partRect
@ -350,8 +350,8 @@ static NSRect boundsToTitleAreaRect(NSRect rect) {
NSAttributedString *atitle = [item attributedTitle];
if (atitle != nil && [atitle length] > 0) {
CENTER_PART_RECT_VERTICALLY(
[[self graphicsStyle] menuItemAttributedTextSize: atitle]);
CENTER_PART_RECT_VERTICALLY([[self graphicsStyle]
menuItemAttributedTextSize: atitle]);
#if WINDOWS
// On Windows, when using the AGG graphics context, enabling
// font smoothing switches to using AGG for text drawing,
@ -365,8 +365,8 @@ static NSRect boundsToTitleAreaRect(NSRect rect) {
// without any special attributes It would probably be better to
// add font caching to the regular Win32 drawing context
CGContextSetShouldSmoothFonts(
(CGContextRef)[
[NSGraphicsContext currentContext] graphicsPort],
(CGContextRef)[[NSGraphicsContext
currentContext] graphicsPort],
YES);
#endif
[[self graphicsStyle] drawAttributedMenuItemText: atitle
@ -387,17 +387,17 @@ static NSRect boundsToTitleAreaRect(NSRect rect) {
// without any special attributes It would probably be better to
// add font caching to the regular Win32 drawing context
CGContextSetShouldSmoothFonts(
(CGContextRef)[
[NSGraphicsContext currentContext] graphicsPort],
(CGContextRef)[[NSGraphicsContext
currentContext] graphicsPort],
NO);
#endif
NSString *title = [item title];
if (useCustomFont) {
NSDictionary *attributes = [self itemAttributes];
NSAttributedString *attributedTitle =
[[[NSAttributedString alloc] initWithString: title
attributes: attributes]
autorelease];
[[[NSAttributedString alloc]
initWithString: title
attributes: attributes] autorelease];
CENTER_PART_RECT_VERTICALLY([[self graphicsStyle]
menuItemAttributedTextSize: attributedTitle]);
[[self graphicsStyle]
@ -554,8 +554,9 @@ static NSRect boundsToTitleAreaRect(NSRect rect) {
event = [[self window]
nextEventMatchingMask: NSPeriodicMask | NSLeftMouseUpMask |
NSMouseMovedMask | NSLeftMouseDraggedMask |
NSKeyDownMask | NSAppKitDefinedMask];
NSMouseMovedMask |
NSLeftMouseDraggedMask | NSKeyDownMask |
NSAppKitDefinedMask];
if (firstTimestamp == 0.) {
// Note: we don't do that using the first event, because in case the
// menu takes a long of time to display, the next event we get will

View File

@ -30,7 +30,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
_releaseWhenClosed = YES;
_view = [[NSPopUpView alloc]
initWithFrame: NSMakeRect(0, 0, frame.size.width, frame.size.height)];
initWithFrame: NSMakeRect(0, 0, frame.size.width,
frame.size.height)];
[[self contentView] addSubview: _view];
return self;

View File

@ -76,24 +76,17 @@ const NSPrintingPaginationMode NSClipPagination = NSPrintingPaginationModeClip;
- init {
NSDictionary *defaults = [NSDictionary
dictionaryWithObjectsAndKeys: [NSNumber numberWithInt: 1],
NSPrintCopies,
[NSNumber numberWithBool: YES],
NSPrintAllPages, @"US Letter",
NSPrintPaperName,
[NSValue
valueWithSize: NSMakeSize(612, 792)],
NSPrintPaperSize,
[NSNumber numberWithFloat: 36],
NSPrintTopMargin,
[NSNumber numberWithFloat: 36],
NSPrintLeftMargin,
[NSNumber numberWithFloat: 36],
NSPrintRightMargin,
[NSNumber numberWithFloat: 36],
dictionaryWithObjectsAndKeys:
[NSNumber numberWithInt: 1], NSPrintCopies,
[NSNumber numberWithBool: YES], NSPrintAllPages,
@"US Letter", NSPrintPaperName,
[NSValue valueWithSize: NSMakeSize(612, 792)],
NSPrintPaperSize, [NSNumber numberWithFloat: 36],
NSPrintTopMargin, [NSNumber numberWithFloat: 36],
NSPrintLeftMargin, [NSNumber numberWithFloat: 36],
NSPrintRightMargin, [NSNumber numberWithFloat: 36],
NSPrintBottomMargin,
[NSNumber
numberWithInt: NSPortraitOrientation],
[NSNumber numberWithInt: NSPortraitOrientation],
NSPrintOrientation, nil];
return [self initWithDictionary: defaults];

View File

@ -314,7 +314,8 @@ static NSPrintOperation *_currentOperation = nil;
}
if ((context = (CGContextRef)
[[_printInfo dictionary] objectForKey: @"_KGContext"]) == nil)
[[_printInfo dictionary] objectForKey: @"_KGContext"]) ==
nil)
return nil;
} else if (_type == NSPrintOperationPDFInRect) {
NSDictionary *auxiliaryInfo = [NSDictionary

View File

@ -140,8 +140,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
location = [_ruler convertPoint: location
fromView: [_ruler clientView]];
} else {
location =
[_ruler convertPoint: location
location = [_ruler
convertPoint: location
fromView: [[_ruler enclosingScrollView] documentView]];
}
@ -228,8 +228,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
[_ruler unlockFocus];
[[_ruler window] flushWindow];
event = [[_ruler window]
nextEventMatchingMask: NSLeftMouseUpMask | NSLeftMouseDraggedMask];
event = [[_ruler window] nextEventMatchingMask: NSLeftMouseUpMask |
NSLeftMouseDraggedMask];
} while ([event type] != NSLeftMouseUp);
_isDragging = NO;
@ -285,8 +285,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
}
[_ruler setNeedsDisplay: YES];
}
event = [[_ruler window]
nextEventMatchingMask: NSLeftMouseUpMask | NSLeftMouseDraggedMask];
event = [[_ruler window] nextEventMatchingMask: NSLeftMouseUpMask |
NSLeftMouseDraggedMask];
} while ([event type] != NSLeftMouseUp);
_isDragging = NO;

View File

@ -321,8 +321,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
}
- (NSDictionary *) attributesForLabel {
NSMutableParagraphStyle *style =
[[[NSParagraphStyle defaultParagraphStyle] mutableCopy] autorelease];
NSMutableParagraphStyle *style = [[[NSParagraphStyle defaultParagraphStyle]
mutableCopy] autorelease];
[style setLineBreakMode: NSLineBreakByClipping];
[style setAlignment: NSLeftTextAlignment];
@ -508,13 +508,15 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
[[_rulerlineLocations objectAtIndex: i] doubleValue] + 0.5;
[NSBezierPath
strokeLineFromPoint: NSMakePoint(NSMinX(rect), NSMinY(rect))
toPoint: NSMakePoint(NSMinX(rect), NSMaxY(rect))];
toPoint: NSMakePoint(NSMinX(rect),
NSMaxY(rect))];
} else {
rect.origin.y =
[[_rulerlineLocations objectAtIndex: i] doubleValue] + 0.5;
[NSBezierPath
strokeLineFromPoint: NSMakePoint(NSMinX(rect), NSMinY(rect))
toPoint: NSMakePoint(NSMaxX(rect), NSMinY(rect))];
toPoint: NSMakePoint(NSMaxX(rect),
NSMinY(rect))];
}
}
}

View File

@ -177,17 +177,19 @@ static NSOpenPanel *_newPanel = nil;
{
id inv = [NSInvocation
invocationWithMethodSignature:
[self
methodSignatureForSelector: @selector
[self methodSignatureForSelector: @selector
(_background_beginSheetForDirectory:
file:types:modalForWindow
:modalDelegate:didEndSelector
file:types
:modalForWindow
:modalDelegate
:didEndSelector
:contextInfo:)]];
[inv setTarget: self];
[inv setSelector: @selector
(_background_beginSheetForDirectory:
file:types:modalForWindow:modalDelegate
:didEndSelector:contextInfo:)];
file:types:modalForWindow
:modalDelegate:didEndSelector
:contextInfo:)];
[inv setArgument: &path atIndex: 2];
[inv setArgument: &name atIndex: 3];
[inv setArgument: &fileTypes atIndex: 4];
@ -210,7 +212,8 @@ static NSOpenPanel *_newPanel = nil;
id pool = [NSAutoreleasePool new];
int ret = [self runModalForDirectory: path file: name types: fileTypes];
id inv = [NSInvocation invocationWithMethodSignature:
id inv = [NSInvocation
invocationWithMethodSignature:
[self methodSignatureForSelector: @selector
(_selector_savePanelDidEnd:
returnCode:contextInfo:)]];

View File

@ -238,12 +238,12 @@ static NSSavePanel *_newPanel = nil;
{
id inv = [NSInvocation
invocationWithMethodSignature:
[self
methodSignatureForSelector: @selector
[self methodSignatureForSelector: @selector
(_background_beginSheetForDirectory:
file:modalForWindow:modalDelegate
:didEndSelector:contextInfo
:)]];
file:modalForWindow
:modalDelegate
:didEndSelector
:contextInfo:)]];
[inv setTarget: self];
[inv setSelector: @selector
(_background_beginSheetForDirectory:
@ -275,7 +275,8 @@ static NSSavePanel *_newPanel = nil;
id pool = [NSAutoreleasePool new];
int ret = [self runModalForDirectory: path file: name];
id inv = [NSInvocation invocationWithMethodSignature:
id inv = [NSInvocation
invocationWithMethodSignature:
[self methodSignatureForSelector: @selector
(_selector_savePanelDidEnd:
returnCode:contextInfo:)]];

View File

@ -360,8 +360,8 @@ static Class _rulerViewClass = nil;
- (void) createVerticalScrollerIfNeeded {
if (_verticalScroller == nil) {
_verticalScroller =
[[NSScroller alloc] initWithFrame: [self verticalScrollerFrame]];
_verticalScroller = [[NSScroller alloc]
initWithFrame: [self verticalScrollerFrame]];
[_verticalScroller
setAutoresizingMask: NSViewMinXMargin | NSViewHeightSizable];
[_verticalScroller setTarget: self];
@ -371,8 +371,8 @@ static Class _rulerViewClass = nil;
- (void) createHorizontalScrollerIfNeeded {
if (_horizontalScroller == nil) {
_horizontalScroller =
[[NSScroller alloc] initWithFrame: [self horizontalScrollerFrame]];
_horizontalScroller = [[NSScroller alloc]
initWithFrame: [self horizontalScrollerFrame]];
[_horizontalScroller
setAutoresizingMask: NSViewMaxYMargin | NSViewWidthSizable];
[_horizontalScroller setTarget: self];
@ -836,16 +836,17 @@ static Class _rulerViewClass = nil;
CGFloat value =
(heightDiff <= 0)
? 0
: (clipRect.origin.y - docRect.origin.y) / heightDiff;
: (clipRect.origin.y - docRect.origin.y) /
heightDiff;
if (![docView isFlipped])
value = 1.0 - value;
[_verticalScroller setEnabled: YES];
[_verticalScroller setHidden: NO];
[_verticalScroller
setFloatValue: value
knobProportion: clipRect.size.height / docRect.size.height];
[_verticalScroller setFloatValue: value
knobProportion: clipRect.size.height /
docRect.size.height];
}
if (widthDiff <= 0) {
@ -855,13 +856,14 @@ static Class _rulerViewClass = nil;
CGFloat value =
(widthDiff <= 0)
? 0
: (clipRect.origin.x - docRect.origin.x) / widthDiff;
: (clipRect.origin.x - docRect.origin.x) /
widthDiff;
[_horizontalScroller setEnabled: YES];
[_horizontalScroller setHidden: NO];
[_horizontalScroller
setFloatValue: value
knobProportion: clipRect.size.width / docRect.size.width];
[_horizontalScroller setFloatValue: value
knobProportion: clipRect.size.width /
docRect.size.width];
}
}

View File

@ -456,8 +456,8 @@ static inline CGFloat roundFloat(CGFloat value) {
NSPoint point;
CGFloat delta;
event = [[self window]
nextEventMatchingMask: NSLeftMouseUpMask | NSLeftMouseDraggedMask];
event = [[self window] nextEventMatchingMask: NSLeftMouseUpMask |
NSLeftMouseDraggedMask];
point = [self convertPoint: [event locationInWindow] fromView: nil];
@ -553,8 +553,8 @@ static inline CGFloat roundFloat(CGFloat value) {
[self sendAction: _action to: _target];
}
event = [[self window]
nextEventMatchingMask: NSLeftMouseUpMask | NSLeftMouseDraggedMask];
event = [[self window] nextEventMatchingMask: NSLeftMouseUpMask |
NSLeftMouseDraggedMask];
} while ([event type] != NSLeftMouseUp);

View File

@ -33,7 +33,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
initImageCell: [NSImage imageNamed: @"NSSearchGlass"]];
[_searchButtonCell setImageScaling: NSImageScaleProportionallyUpOrDown];
_cancelButtonCell = [[NSButtonCell alloc]
initImageCell: [NSImage
initImageCell:
[NSImage
imageNamed: @"NSStopProgressFreestandingTemplate"]];
[_cancelButtonCell setImageScaling: NSImageScaleProportionallyUpOrDown];
return self;
@ -45,7 +46,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
initImageCell: [NSImage imageNamed: @"NSSearchGlass"]];
[_searchButtonCell setImageScaling: NSImageScaleProportionallyUpOrDown];
_cancelButtonCell = [[NSButtonCell alloc]
initImageCell: [NSImage
initImageCell:
[NSImage
imageNamed: @"NSStopProgressFreestandingTemplate"]];
[_cancelButtonCell setImageScaling: NSImageScaleProportionallyUpOrDown];
return self;

View File

@ -43,9 +43,9 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
}
- (id) description {
return
[NSString stringWithFormat: @"%@ - %@ (%f) [%d]", [super description],
_label, _width, _tag];
return [NSString stringWithFormat: @"%@ - %@ (%f) [%d]",
[super description], _label, _width,
_tag];
}
- (void) dealloc {

View File

@ -363,8 +363,9 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
- (BOOL) startTrackingAt: (NSPoint) startPoint inView: (NSView *) controlView {
// save the segment clicked on and its state
_firstTrackingSegmentIndex = [self
_segmentForPoint: [controlView convertPoint: startPoint fromView: nil]];
_firstTrackingSegmentIndex =
[self _segmentForPoint: [controlView convertPoint: startPoint
fromView: nil]];
NSSegmentItem *trackingItem =
[_segments objectAtIndex: _firstTrackingSegmentIndex];
if (![trackingItem isEnabled])
@ -459,8 +460,9 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
untilMouseUp: (BOOL) flag
{
NSPoint startPoint = [event locationInWindow];
NSInteger segmentUnderMouse = [self
_segmentForPoint: [controlView convertPoint: startPoint fromView: nil]];
NSInteger segmentUnderMouse =
[self _segmentForPoint: [controlView convertPoint: startPoint
fromView: nil]];
if (segmentUnderMouse == NSNotFound)
return YES;

View File

@ -119,8 +119,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
[coder decodeValuesOfObjCTypes: "dddf@", &_maxValue, _minValue,
&value, &f1, &obj];
} else {
[coder
decodeValuesOfObjCTypes: "ddd", &_maxValue, _minValue, &value];
[coder decodeValuesOfObjCTypes: "ddd", &_maxValue, _minValue,
&value];
[self setTitle: @""];
_altIncrementValue = 0;
}
@ -284,7 +284,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
CGFloat length =
(_isVertical ? _lastRect.size.height : _lastRect.size.width) -
2 * PIXELINSET;
CGFloat position = floor((_numberOfTickMarks == 1)
CGFloat position =
floor((_numberOfTickMarks == 1)
? length / 2
: index * (length / (_numberOfTickMarks - 1)));

View File

@ -58,7 +58,8 @@ static NSMutableDictionary *sSounds = nil;
if ([[NSBundle mainBundle] pathForResource: name
ofType: type]) {
sound = [[[NSSound alloc]
initWithContentsOfFile: [[NSBundle mainBundle]
initWithContentsOfFile:
[[NSBundle mainBundle]
pathForResource: name
ofType: type]
byReference: NO] autorelease];

View File

@ -153,7 +153,8 @@ static NSSpellChecker *shared = nil;
if (_spellingViewController == nil) {
_spellingViewController = [[NSSpellingViewController alloc]
initWithNibName: @"NSSpellingViewController"
bundle: [NSBundle bundleForClass: [NSSpellingViewController
bundle: [NSBundle bundleForClass:
[NSSpellingViewController
class]]];
}
return (NSSpellingViewController *) _spellingViewController;
@ -166,9 +167,10 @@ static NSSpellChecker *shared = nil;
NSView *view = [vc view];
NSRect frame = [view frame];
_spellingPanel = [[NSPanel alloc]
initWithContentRect: frame
styleMask: NSUtilityWindowMask | NSResizableWindowMask |
_spellingPanel =
[[NSPanel alloc] initWithContentRect: frame
styleMask: NSUtilityWindowMask |
NSResizableWindowMask |
NSClosableWindowMask
backing: NSBackingStoreBuffered
defer: YES];
@ -176,7 +178,8 @@ static NSSpellChecker *shared = nil;
[_spellingPanel
setTitle: NSLocalizedStringFromTableInBundle(
@"Spelling", nil,
[NSBundle bundleForClass: [NSSpellChecker class]],
[NSBundle bundleForClass: [NSSpellChecker
class]],
@"The title of the spelling dialog")];
[view setFrameOrigin: NSMakePoint(0, 10)];
[[_spellingPanel contentView] addSubview: view];
@ -236,8 +239,8 @@ static NSSpellChecker *shared = nil;
- (NSRange) checkSpellingOfString: (NSString *) string
startingAt: (NSInteger) offset
{
return
[self checkSpellingOfString: string
return [self
checkSpellingOfString: string
startingAt: offset
language: [[NSLocale currentLocale] localeIdentifier]
wrap: NO
@ -270,9 +273,9 @@ static NSSpellChecker *shared = nil;
[options setObject: orthography forKey: NSTextCheckingOrthographyKey];
}
NSArray *checking = [self
checkString: string
range: NSMakeRange(offset, [string length] - offset)
NSArray *checking = [self checkString: string
range: NSMakeRange(offset,
[string length] - offset)
types: NSTextCheckingTypeSpelling
options: options
inSpellDocumentWithTag: tag
@ -349,7 +352,8 @@ static NSSpellChecker *shared = nil;
options: (NSDictionary *) options
inSpellDocumentWithTag: (NSInteger) tag
completionHandler:
(void (^)(NSInteger sequenceNumber, NSArray *results,
(void (^)(NSInteger sequenceNumber,
NSArray *results,
NSOrthography *orthography,
NSInteger wordCount)) completionHandler
{
@ -481,7 +485,8 @@ static NSSpellChecker *shared = nil;
if ([guesses count] == 0) {
NSMenuItem *item = [result
addItemWithTitle: NSLocalizedStringFromTableInBundle(
addItemWithTitle:
NSLocalizedStringFromTableInBundle(
@"< No Suggestions >", nil,
[NSBundle
bundleForClass: [NSSpellChecker class]],
@ -516,8 +521,8 @@ static NSSpellChecker *shared = nil;
alternativeStrings: (NSArray *) alternativeStrings
forStringInRect: (NSRect) rect
view: (NSView *) view
completionHandler:
(void (^)(NSString *acceptedString)) completionBlock
completionHandler: (void (^)(NSString *acceptedString))
completionBlock
{
NSUnimplementedMethod();
}

View File

@ -382,8 +382,8 @@ static CGFloat constrainTo(CGFloat value, CGFloat min, CGFloat max) {
NSAutoreleasePool *pool = [NSAutoreleasePool new];
NSPoint point;
event = [[self window]
nextEventMatchingMask: NSLeftMouseUpMask | NSLeftMouseDraggedMask];
event = [[self window] nextEventMatchingMask: NSLeftMouseUpMask |
NSLeftMouseDraggedMask];
eventType = [event type];
point = [self convertPoint: [event locationInWindow] fromView: nil];
@ -516,10 +516,10 @@ static CGFloat constrainTo(CGFloat value, CGFloat min, CGFloat max) {
constrainMaxCoordinate: maxPosition
ofSubviewAt: index];
}
} else if ([_delegate
respondsToSelector: @selector
} else if ([_delegate respondsToSelector: @selector
(splitView:
constrainMinCoordinate:maxCoordinate:ofSubviewAt:)]) {
constrainMinCoordinate:maxCoordinate
:ofSubviewAt:)]) {
// Use the deprecated API
[_delegate splitView: self

View File

@ -165,8 +165,8 @@ const CGFloat NSStringDrawerLargeDimension = 1000000.;
withAttributes: (NSDictionary *) attributes
truncatingTail: (BOOL) truncateTail
{
NSAttributedString *string =
[[[NSAttributedString alloc] initWithString: self
NSAttributedString *string = [[[NSAttributedString alloc]
initWithString: self
attributes: attributes] autorelease];
[string _clipAndDrawInRect: rect truncatingTail: truncateTail];
}
@ -206,9 +206,10 @@ const CGFloat NSStringDrawerLargeDimension = 1000000.;
NSAttributedString *clippedTitle = string;
do {
clippedTitle = [clippedTitle
attributedSubstringFromRange: NSMakeRange(
0,
[clippedTitle length] - 1)];
attributedSubstringFromRange: NSMakeRange(0,
[clippedTitle
length] -
1)];
NSMutableAttributedString *tmpString =
[[clippedTitle mutableCopy] autorelease];
[tmpString appendAttributedString: ellipsis];

View File

@ -63,8 +63,9 @@ static NSSystemInfoPanel *_sharedInfoPanel = nil;
NSString *versionString = bundleVersion;
if (bundleShortVersion != nil)
versionString = [NSString
stringWithFormat: @"%@ (%@)", bundleShortVersion, bundleVersion];
versionString =
[NSString stringWithFormat: @"%@ (%@)", bundleShortVersion,
bundleVersion];
if (versionString != nil)
[versionField setStringValue: versionString];
@ -83,7 +84,8 @@ static NSSystemInfoPanel *_sharedInfoPanel = nil;
[creditScrollView setFrame: NSMakeRect(0, 0, 0, 0)];
[legalTextField
setStringValue: [[NSBundle mainBundle]
setStringValue:
[[NSBundle mainBundle]
localizedStringForKey: @"NSHumanReadableCopyright"
value: @" "
table: @"InfoPlist"]];
@ -137,13 +139,13 @@ static NSSystemInfoPanel *_sharedInfoPanel = nil;
NSString *AppVerUsed =
ApplicationVersion
? ApplicationVersion
: [NSString
stringWithFormat: @"Version %@", CFBundleShortVersionString];
: [NSString stringWithFormat: @"Version %@",
CFBundleShortVersionString];
if (!AppVerUsed) {
if (VerUsed)
[versionField
setStringValue: [NSString
stringWithFormat: @"Version %@", VerUsed]];
setStringValue: [NSString stringWithFormat: @"Version %@",
VerUsed]];
else
[versionField setStringValue: @""];
} else {

View File

@ -51,8 +51,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
_drawsBackground = [keyed decodeBoolForKey: @"NSDrawsBackground"];
_controlSize = (flags & 0x18000000) >> 27;
if (_font == nil)
_font =
[[NSFont boldSystemFontOfSize: 13 - _controlSize * 2] retain];
_font = [[NSFont boldSystemFontOfSize: 13 - _controlSize * 2]
retain];
_type = (flags & 0x7);
switch (_type) {
@ -137,8 +137,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
finalSize =
[[_items objectAtIndex: 0] sizeOfLabel: _allowsTruncatedLabels];
for (i = 1; i < count; ++i)
finalSize.width +=
[[_items objectAtIndex: i] sizeOfLabel: _allowsTruncatedLabels]
finalSize.width += [[_items objectAtIndex: i]
sizeOfLabel: _allowsTruncatedLabels]
.width;
return finalSize;
@ -437,9 +437,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
if ([sender respondsToSelector: @selector(indexOfSelectedItem)])
[self selectTabViewItemAtIndex: [sender indexOfSelectedItem]];
else if ([sender isKindOfClass: [NSMatrix class]])
[self selectTabViewItemAtIndex: [[sender cells]
indexOfObject: [sender
selectedCell]]];
[self selectTabViewItemAtIndex:
[[sender cells] indexOfObject: [sender selectedCell]]];
}
- (NSRect) rectForItemBorderAtIndex: (unsigned) index {
@ -536,8 +535,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
// Shouldn't the view machinery do this automatically?? it might now
[[self superview] setNeedsDisplay: YES];
do {
event =
[[self window] nextEventMatchingMask: NSLeftMouseUpMask |
event = [[self window]
nextEventMatchingMask: NSLeftMouseUpMask |
NSLeftMouseDraggedMask];
} while ([event type] != NSLeftMouseUp);

View File

@ -38,8 +38,8 @@ NSString *_NSTruncatedStringWithAttributesInRect(NSString *string,
while ([string length] > 1 &&
[string sizeWithAttributes: attributes].width > rect.size.width) {
string =
[string substringWithRange: NSMakeRange(0, [string length] - 1)];
string = [string
substringWithRange: NSMakeRange(0, [string length] - 1)];
}
if (length == [string length])

View File

@ -84,10 +84,11 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
- (NSString *) description {
return [NSString
stringWithFormat: @"<%@ 0x%08lx identifier: \"%@\" headerCell: %@ "
stringWithFormat:
@"<%@ 0x%08lx identifier: \"%@\" headerCell: %@ "
@"dataCell: %@ width: %f minWidth: %f maxWidth: %f>",
[self class], self, _identifier, _headerCell,
_dataCell, _width, _minWidth, _maxWidth];
[self class], self, _identifier, _headerCell, _dataCell,
_width, _minWidth, _maxWidth];
}
- (id) identifier {

View File

@ -73,9 +73,9 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
NSSize spacing = [_tableView intercellSpacing];
if (column < 0 || column >= [[_tableView tableColumns] count]) {
[NSException
raise: NSInternalInconsistencyException
format: @"headerRectOfColumn: invalid index %d (valid {%d, %d})",
[NSException raise: NSInternalInconsistencyException
format: @"headerRectOfColumn: invalid index %d (valid {%d, "
@"%d})",
column, 0, [tableColumns count]];
}
@ -116,8 +116,9 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
columnRect.size.width = [column width] + spacing.width;
[[column headerCell]
setHighlighted: [_tableView
isColumnSelected: [[_tableView tableColumns]
setHighlighted:
[_tableView isColumnSelected:
[[_tableView tableColumns]
indexOfObject: column]]];
[[column headerCell] setControlView: self];
[[column headerCell] drawWithFrame: columnRect inView: self];
@ -142,7 +143,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
if ([[_tableView delegate] respondsToSelector: @selector
(tableView:mouseDownInHeaderOfTableColumn:)])
[[_tableView delegate] tableView: _tableView
mouseDownInHeaderOfTableColumn: [[_tableView tableColumns]
mouseDownInHeaderOfTableColumn:
[[_tableView tableColumns]
objectAtIndex: clickedColumn]];
if ([_tableView allowsColumnResizing]) {

View File

@ -163,8 +163,8 @@ const CGFloat NSTableViewDefaultRowHeight = 16.0f;
_allowsColumnReordering = YES;
_allowsColumnResizing = YES;
_autoresizesAllColumnsToFit =
NO; // the default isn't actually given in the spec, but this seems more
// like default behavior
NO; // the default isn't actually given in the spec, but this seems
// more like default behavior
_allowsMultipleSelection = NO;
_allowsEmptySelection = YES;
_allowsColumnSelection = YES;
@ -386,8 +386,8 @@ static CGFloat rowHeightAtIndex(NSTableView *self, NSInteger index) {
rect.size.width = 0.;
count = [_tableColumns count];
for (i = 0; i < count; i++)
rect.size.width +=
[[_tableColumns objectAtIndex: i] width] + _intercellSpacing.width;
rect.size.width += [[_tableColumns objectAtIndex: i] width] +
_intercellSpacing.width;
rect.size.height = rowHeightAtIndex(self, row) + _intercellSpacing.height;
return rect;
@ -406,12 +406,12 @@ static CGFloat rowHeightAtIndex(NSTableView *self, NSInteger index) {
rect.origin.x = 0.;
for (i = 0; i < column; i++)
rect.origin.x +=
[[_tableColumns objectAtIndex: i] width] + _intercellSpacing.width;
rect.origin.x += [[_tableColumns objectAtIndex: i] width] +
_intercellSpacing.width;
rect.origin.y = 0.;
rect.size.width =
[[_tableColumns objectAtIndex: column] width] + _intercellSpacing.width;
rect.size.width = [[_tableColumns objectAtIndex: column] width] +
_intercellSpacing.width;
rect.size.height = 0.;
for (i = 0; i < numberOfRows; i++)
rect.size.height +=
@ -460,8 +460,8 @@ static CGFloat rowHeightAtIndex(NSTableView *self, NSInteger index) {
CGFloat width = 0.;
for (i = 0; i < numberOfColumns; i++) {
width +=
[[_tableColumns objectAtIndex: i] width] + _intercellSpacing.width;
width += [[_tableColumns objectAtIndex: i] width] +
_intercellSpacing.width;
if (width > rect.origin.x)
break;
@ -517,15 +517,15 @@ static CGFloat rowHeightAtIndex(NSTableView *self, NSInteger index) {
frame.origin.x = 0.;
for (i = 0; i < column; i++)
frame.origin.x +=
[[_tableColumns objectAtIndex: i] width] + _intercellSpacing.width;
frame.origin.x += [[_tableColumns objectAtIndex: i] width] +
_intercellSpacing.width;
frame.origin.y = 0.;
for (i = 0; i < row; i++)
frame.origin.y += rowHeightAtIndex(self, i) + _intercellSpacing.height;
frame.size.width =
[[_tableColumns objectAtIndex: column] width] + _intercellSpacing.width;
frame.size.width = [[_tableColumns objectAtIndex: column] width] +
_intercellSpacing.width;
frame.size.height = rowHeightAtIndex(self, row) + _intercellSpacing.height;
return frame;
@ -911,11 +911,11 @@ static CGFloat rowHeightAtIndex(NSTableView *self, NSInteger index) {
}
if (extend) {
NSMutableIndexSet *mutableIndexes =
[[NSMutableIndexSet alloc] initWithIndexSet: _selectedRowIndexes];
NSMutableIndexSet *mutableIndexes = [[NSMutableIndexSet alloc]
initWithIndexSet: _selectedRowIndexes];
[mutableIndexes addIndexes: indexes];
newIndexes =
[[[NSIndexSet alloc] initWithIndexSet: mutableIndexes] autorelease];
newIndexes = [[[NSIndexSet alloc] initWithIndexSet: mutableIndexes]
autorelease];
[mutableIndexes release];
} else
newIndexes = indexes;
@ -988,8 +988,8 @@ static CGFloat rowHeightAtIndex(NSTableView *self, NSInteger index) {
}
- (BOOL) isColumnSelected: (NSInteger) col {
return
[_selectedColumns containsObject: [_tableColumns objectAtIndex: col]];
return [_selectedColumns
containsObject: [_tableColumns objectAtIndex: col]];
}
- (NSEnumerator *) selectedColumnEnumerator {
@ -1034,7 +1034,8 @@ static CGFloat rowHeightAtIndex(NSTableView *self, NSInteger index) {
[self selectRowIndexes: [NSIndexSet
indexSetWithIndexesInRange:
NSMakeRange(startRow,
endRow - startRow + 1)]
endRow - startRow +
1)]
byExtendingSelection: NO];
} else
[self selectRowIndexes: [NSIndexSet indexSetWithIndex: row]
@ -1082,7 +1083,8 @@ static CGFloat rowHeightAtIndex(NSTableView *self, NSInteger index) {
}
- (void) selectAll: sender {
[self selectRowIndexes: [NSIndexSet indexSetWithIndexesInRange:
[self selectRowIndexes: [NSIndexSet
indexSetWithIndexesInRange:
NSMakeRange(0, [self numberOfRows])]
byExtendingSelection: NO];
}
@ -1139,7 +1141,9 @@ static CGFloat rowHeightAtIndex(NSTableView *self, NSInteger index) {
// visible rows only, as the often used -rectOfColumn: needs them all.
[self noteHeightOfRowsWithIndexesChanged:
[NSIndexSet
indexSetWithIndexesInRange: NSMakeRange(0, numberOfRows)]];
indexSetWithIndexesInRange: NSMakeRange(
0,
numberOfRows)]];
// if there's any editing going on, we'd better stop it.
if (_editingCell != nil)
@ -1197,7 +1201,8 @@ static CGFloat rowHeightAtIndex(NSTableView *self, NSInteger index) {
[_headerView setFrameSize: rect.size];
[[self enclosingScrollView]
setVerticalLineScroll: _standardRowHeight + _intercellSpacing.height];
setVerticalLineScroll: _standardRowHeight +
_intercellSpacing.height];
[self setNeedsDisplay: YES];
[_headerView setNeedsDisplay: YES];
@ -1240,15 +1245,11 @@ static CGFloat rowHeightAtIndex(NSTableView *self, NSInteger index) {
for (row = 0; row < numberOfRows; ++row)
if ([self isColumnSelected: column] || [self isRowSelected: row])
if (!(row == _editedRow && column == _editedColumn))
[self
drawHighlightedSelectionForColumn: column
[self drawHighlightedSelectionForColumn: column
row: row
inRect:
[self
frameOfCellAtColumn:
inRect: [self frameOfCellAtColumn:
column
row:
row]];
row: row]];
}
- (NSCell *) preparedCellAtColumn: (NSInteger) columnNumber
@ -1270,8 +1271,8 @@ static CGFloat rowHeightAtIndex(NSTableView *self, NSInteger index) {
[self isColumnSelected: columnNumber]) {
[(NSTextFieldCell *) dataCell
setDrawsBackground: NO]; // so the selection shows properly,
// dont just set the color so custom
// background works
// dont just set the color so
// custom background works
[(NSTextFieldCell *) dataCell
setTextColor: [NSColor selectedTextColor]];
} else
@ -1315,8 +1316,8 @@ static CGFloat rowHeightAtIndex(NSTableView *self, NSInteger index) {
} else {
NSCell *dataCell = [self preparedCellAtColumn: drawThisColumn
row: row];
NSRect cellRect =
[self _adjustedFrame: [self frameOfCellAtColumn: drawThisColumn
NSRect cellRect = [self
_adjustedFrame: [self frameOfCellAtColumn: drawThisColumn
row: row]
forCell: dataCell];
@ -1422,8 +1423,8 @@ static CGFloat rowHeightAtIndex(NSTableView *self, NSInteger index) {
CGFloat result = 0;
for (i = 0; i < count; ++i)
result +=
[[_tableColumns objectAtIndex: i] width] + _intercellSpacing.width;
result += [[_tableColumns objectAtIndex: i] width] +
_intercellSpacing.width;
return result;
}
@ -1626,17 +1627,22 @@ static CGFloat rowHeightAtIndex(NSTableView *self, NSInteger index) {
if ([self numberOfRows] == 0)
[NSBezierPath
strokeLineFromPoint: NSMakePoint(0, 0)
toPoint: NSMakePoint([self bounds].size.width, 0)];
toPoint: NSMakePoint([self bounds].size.width,
0)];
else {
if (_draggingRow == [self numberOfRows]) {
rowRect = NSIntersectionRect([self rectOfRow: _draggingRow - 1],
[self visibleRect]);
[NSBezierPath
strokeLineFromPoint: NSMakePoint(0, rowRect.origin.y +
rowRect.size.height)
toPoint: NSMakePoint(rowRect.size.width,
strokeLineFromPoint: NSMakePoint(
0, rowRect.origin.y +
rowRect.size
.height)
toPoint: NSMakePoint(
rowRect.size.width,
rowRect.origin.y +
rowRect.size.height)];
rowRect.size
.height)];
} else {
rowRect = NSIntersectionRect([self rectOfRow: _draggingRow],
[self visibleRect]);
@ -1650,8 +1656,8 @@ static CGFloat rowHeightAtIndex(NSTableView *self, NSInteger index) {
}
- (BOOL) delegateSelectionShouldChange {
if ([_delegate
respondsToSelector: @selector(selectionShouldChangeInTableView:)])
if ([_delegate respondsToSelector: @selector
(selectionShouldChangeInTableView:)])
return [_delegate selectionShouldChangeInTableView: self];
return YES;
@ -1675,7 +1681,8 @@ static CGFloat rowHeightAtIndex(NSTableView *self, NSInteger index) {
object: self
userInfo: [NSDictionary
dictionaryWithObjectsAndKeys:
[NSNumber numberWithFloat: oldWidth],
[NSNumber numberWithFloat:
oldWidth],
@"NSOldWidth", nil]];
}
@ -1714,7 +1721,8 @@ static CGFloat rowHeightAtIndex(NSTableView *self, NSInteger index) {
if ([clickedCell isKindOfClass: [NSButtonCell class]]) {
[clickedCell
setObjectValue:
[self dataSourceObjectValueForTableColumn: clickedColumnObject
[self dataSourceObjectValueForTableColumn:
clickedColumnObject
row: _clickedRow]];
if ([clickedCell trackMouse: event
@ -1726,8 +1734,8 @@ static CGFloat rowHeightAtIndex(NSTableView *self, NSInteger index) {
NSNumber *value = nil;
if ([clickedCell isKindOfClass: [NSPopUpButtonCell class]]) {
value = [NSNumber
numberWithInt: [(NSPopUpButtonCell *)
clickedCell indexOfSelectedItem]];
numberWithInt: [(NSPopUpButtonCell *) clickedCell
indexOfSelectedItem]];
} else {
value = [NSNumber numberWithInt: [clickedCell state]];
}
@ -1771,7 +1779,8 @@ static CGFloat rowHeightAtIndex(NSTableView *self, NSInteger index) {
startRow = _clickedRow;
}
[self selectRowIndexes: [NSIndexSet
[self selectRowIndexes:
[NSIndexSet
indexSetWithIndexesInRange:
NSMakeRange(startRow,
endRow - startRow +
@ -1868,7 +1877,9 @@ static CGFloat rowHeightAtIndex(NSTableView *self, NSInteger index) {
for (i = 0; i < numberOfRows; i++) {
if (i >= startRow && i <= endRow)
[self selectRowIndexes:
[NSIndexSet indexSetWithIndex: i]
[NSIndexSet
indexSetWithIndex:
i]
byExtendingSelection: YES];
else
[self deselectRow: i];
@ -1894,7 +1905,8 @@ static CGFloat rowHeightAtIndex(NSTableView *self, NSInteger index) {
[binder allowsEditingForRow: _clickedRow]) {
if (_clickedColumn != -1 && _clickedRow != -1) {
if ([self delegateShouldEditTableColumn:
[_tableColumns objectAtIndex: _clickedColumn]
[_tableColumns
objectAtIndex: _clickedColumn]
row: _clickedRow]) {
interpretedAsEdit = YES;
[self editColumn: [self clickedColumn]
@ -1918,8 +1930,8 @@ static CGFloat rowHeightAtIndex(NSTableView *self, NSInteger index) {
NSCell *dataCell = [column dataCellForRow: i];
[dataCell setControlView: self];
[dataCell
setObjectValue: [self dataSourceObjectValueForTableColumn: column
[dataCell setObjectValue:
[self dataSourceObjectValueForTableColumn: column
row: i]];
width = [[dataCell attributedStringValue] size].width;
@ -1966,9 +1978,9 @@ static CGFloat rowHeightAtIndex(NSTableView *self, NSInteger index) {
BOOL result;
NSInteger proposedRow = [self _getDraggedRow: info];
if ([_dataSource respondsToSelector: @selector
(tableView:
validateDrop:proposedRow:proposedDropOperation:)]) {
if ([_dataSource
respondsToSelector: @selector
(tableView:validateDrop:proposedRow:proposedDropOperation:)]) {
if ((result = [_dataSource tableView: self
validateDrop: info
proposedRow: proposedRow

View File

@ -53,15 +53,15 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
- initWithCoder: (NSCoder *) coder {
NSLog(@"NSTextField initWithCoder");
[super initWithCoder: coder];
[self
registerForDraggedTypes: [NSArray arrayWithObject: NSStringPboardType]];
[self registerForDraggedTypes:
[NSArray arrayWithObject: NSStringPboardType]];
if ([coder allowsKeyedCoding]) {
NSKeyedUnarchiver *keyed = (NSKeyedUnarchiver *) coder;
[self setDelegate: [keyed decodeObjectForKey: @"NSDelegate"]];
_errorAction =
NSSelectorFromString([keyed decodeObjectForKey: @"NSErrorAction"]);
_errorAction = NSSelectorFromString(
[keyed decodeObjectForKey: @"NSErrorAction"]);
double maxLayoutWidth =
[keyed decodeDoubleForKey: @"NSPreferredMaxLayoutWidth"];
@ -86,8 +86,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
[_cell setEditable: YES];
[_cell setSelectable: YES];
[_cell setBezeled: YES];
[self
registerForDraggedTypes: [NSArray arrayWithObject: NSStringPboardType]];
[self registerForDraggedTypes:
[NSArray arrayWithObject: NSStringPboardType]];
return self;
}
@ -112,10 +112,10 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
struct {
SEL selector;
NSString *name;
} notes[] = {
{@selector(controlTextDidBeginEditing:),
} notes[] = {{@selector(controlTextDidBeginEditing:),
NSControlTextDidBeginEditingNotification},
{@selector(controlTextDidChange:), NSControlTextDidChangeNotification},
{@selector(controlTextDidChange:),
NSControlTextDidChangeNotification},
{@selector(controlTextDidEndEditing:),
NSControlTextDidEndEditingNotification},
{NULL, nil}};
@ -385,7 +385,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
// Just in case we get no error from the formatter
errorString = NSLocalizedStringFromTableInBundle(
@"Invalid number", nil,
[NSBundle bundleForClass: [NSTextField class]], @"");
[NSBundle bundleForClass: [NSTextField class]],
@"");
}
info = [NSDictionary
dictionaryWithObject: errorString
@ -417,8 +418,9 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
[super setStringValue: value];
else {
NSRange selectedRange = [_currentEditor selectedRange];
BOOL isEntireString = NSEqualRanges(
selectedRange, NSMakeRange(0, [[_currentEditor string] length]));
BOOL isEntireString =
NSEqualRanges(selectedRange,
NSMakeRange(0, [[_currentEditor string] length]));
[super setStringValue: value];
[_currentEditor setString: [self stringValue]];

View File

@ -83,8 +83,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
[self setBackgroundColor: [NSColor whiteColor]];
} else {
_drawsBackground = TRUE;
[self setBackgroundColor: [NSColor
colorWithCalibratedWhite: bgcolor
[self setBackgroundColor:
[NSColor colorWithCalibratedWhite: bgcolor
alpha: 1.0]];
}
[self setTextColor: [NSColor colorWithCalibratedWhite: fgcolor

View File

@ -180,7 +180,8 @@ void buildUnicharData() {
NSDictionary *mirroredDictionary = [NSDictionary
dictionaryWithObjectsAndKeys: [NSNumber numberWithInt: 1], @"Y",
[NSNumber numberWithInt: 0], @"N", nil];
[NSNumber numberWithInt: 0], @"N",
nil];
path = [[NSBundle bundleForClass: NSClassFromString(@"NSTypesetter")]
pathForResource: @"UnicodeData"

View File

@ -102,8 +102,8 @@ static inline NSGlyphFragment *fragmentAtGlyphIndex(NSLayoutManager *self,
// The text storage owns the layout manager (and text view can own the
// storage) Retaining it here would create a retain cycle.
_textStorage =
[[[keyed decodeObjectForKey: @"NSTextStorage"] retain] autorelease];
_textStorage = [[[keyed decodeObjectForKey: @"NSTextStorage"] retain]
autorelease];
_rangeToTemporaryAttributes = NSCreateRangeToCopiedObjectEntries(0);
NSRangeEntryInsert(_rangeToTemporaryAttributes,
@ -115,8 +115,8 @@ static inline NSGlyphFragment *fragmentAtGlyphIndex(NSLayoutManager *self,
_delegate = [keyed decodeObjectForKey: @"NSDelegate"];
_textContainers = [NSMutableArray new];
[_textContainers
addObjectsFromArray: [keyed
decodeObjectForKey: @"NSTextContainers"]];
addObjectsFromArray:
[keyed decodeObjectForKey: @"NSTextContainers"]];
_glyphFragments = NSCreateRangeToOwnedPointerEntries(2);
_invalidFragments = NSCreateRangeToOwnedPointerEntries(2);
_layoutInvalid = YES;
@ -632,7 +632,8 @@ static inline NSGlyphFragment *fragmentAtGlyphIndex(NSLayoutManager *self,
// Validate everything - we should at least validate everything up to this
// container
[self validateGlyphsAndLayoutForGlyphRange: NSMakeRange(
0, [self numberOfGlyphs])];
0,
[self numberOfGlyphs])];
}
- (NSRect) usedRectForTextContainer: (NSTextContainer *) container {
@ -654,8 +655,8 @@ static inline NSGlyphFragment *fragmentAtGlyphIndex(NSLayoutManager *self,
NSRange range;
NSGlyphFragment *fragment;
while (
NSNextRangeEnumeratorEntry(&state, &range, (void **) &fragment)) {
while (NSNextRangeEnumeratorEntry(&state, &range,
(void **) &fragment)) {
if (fragment->container == container) {
NSRect rect = fragment->usedRect;
#if DEBUG_usedRectForTextContainer
@ -1250,8 +1251,8 @@ static inline NSGlyphFragment *fragmentAtGlyphIndex(NSLayoutManager *self,
NSRange range;
NSGlyphFragment *fragment;
while (
NSNextRangeEnumeratorEntry(&state, &range, (void **) &fragment)) {
while (NSNextRangeEnumeratorEntry(&state, &range,
(void **) &fragment)) {
if (fragment->container == container) {
NSRect check = fragment->rect;
@ -1274,7 +1275,8 @@ static inline NSGlyphFragment *fragmentAtGlyphIndex(NSLayoutManager *self,
- (NSRange) glyphRangeForBoundingRectWithoutAdditionalLayout: (NSRect) bounds
inTextContainer:
(NSTextContainer *) container
(NSTextContainer *)
container
{
return NSMakeRange(0, 0);
}
@ -1318,8 +1320,9 @@ static inline NSGlyphFragment *fragmentAtGlyphIndex(NSLayoutManager *self,
static inline void _appendRectToCache(NSLayoutManager *self, NSRect rect) {
if (self->_rectCacheCount >= self->_rectCacheCapacity) {
self->_rectCacheCapacity *= 2;
self->_rectCache = NSZoneRealloc(
NULL, self->_rectCache, sizeof(NSRect) * self->_rectCacheCapacity);
self->_rectCache =
NSZoneRealloc(NULL, self->_rectCache,
sizeof(NSRect) * self->_rectCacheCapacity);
}
self->_rectCache[self->_rectCacheCount++] = rect;
@ -1659,9 +1662,10 @@ static inline void _appendRectToCache(NSLayoutManager *self, NSRect rect) {
continueSearch && tempOffset < NSMaxRange(effectiveRange);
tempOffset++) {
NSRange tempEffectiveRange = NSMakeRange(0, 0);
NSDictionary *tempAttrs = [self
temporaryAttributesAtCharacterIndex: tempOffset
effectiveRange: &tempEffectiveRange];
NSDictionary *tempAttrs =
[self temporaryAttributesAtCharacterIndex: tempOffset
effectiveRange:
&tempEffectiveRange];
if (NSEqualRanges(effectiveRange, tempEffectiveRange)) {
// Things are lined up nicely - we can just use the
// effectiveRange as is
@ -1689,8 +1693,8 @@ static inline void _appendRectToCache(NSLayoutManager *self, NSRect rect) {
}
NSRange tempEffectiveRange = NSMakeRange(0, 0);
NSDictionary *tempAttrs =
[self temporaryAttributesAtCharacterIndex: location
NSDictionary *tempAttrs = [self
temporaryAttributesAtCharacterIndex: location
effectiveRange: &tempEffectiveRange];
if ([tempAttrs count] > 0) {
// Merge in the temporary attributes
@ -1703,7 +1707,8 @@ static inline void _appendRectToCache(NSLayoutManager *self, NSRect rect) {
if (checkTemporaryAttributesUsage) {
tempAttrs = [_delegate layoutManager: self
shouldUseTemporaryAttributes: tempAttrs
forDrawingToScreen: [[NSGraphicsContext
forDrawingToScreen:
[[NSGraphicsContext
currentContext]
isDrawingToScreen]
atCharacterIndex: location
@ -1723,8 +1728,8 @@ static inline void _appendRectToCache(NSLayoutManager *self, NSRect rect) {
if (color != nil) {
NSUInteger i, rectCount;
NSRect *rects =
[self rectArrayForCharacterRange: effectiveRange
NSRect *rects = [self
rectArrayForCharacterRange: effectiveRange
withinSelectedCharacterRange: NSMakeRange(NSNotFound, 0)
inTextContainer: container
rectCount: &rectCount];
@ -1759,9 +1764,10 @@ static inline void _appendRectToCache(NSLayoutManager *self, NSRect rect) {
containerOrigin: (NSPoint) containerOrigin
{
#if DEBUG_LM_DRAWING
NSLog(
@"drawUnderlineForGlyphRange: %@ underlineType: %@ baselineOffset: %f "
@"lineFragmentRect: %@ lineFragmentGlyphRange: %@ containerOrigin: %@",
NSLog(@"drawUnderlineForGlyphRange: %@ underlineType: %@ baselineOffset: "
@"%f "
@"lineFragmentRect: %@ lineFragmentGlyphRange: %@ containerOrigin: "
@"%@",
NSStringFromRange(glyphRange), underlineVal, baselineOffset,
NSStringFromRect(lineRect), NSStringFromRange(lineGlyphRange),
NSStringFromPoint(containerOrigin));
@ -1821,7 +1827,8 @@ static inline void _appendRectToCache(NSLayoutManager *self, NSRect rect) {
BOOL checkTemporaryAttributesUsage = [_delegate
respondsToSelector: @selector
(layoutManager:
shouldUseTemporaryAttributes:forDrawingToScreen:atCharacterIndex
shouldUseTemporaryAttributes:forDrawingToScreen
:atCharacterIndex
:effectiveRange:)];
if (checkTemporaryAttributesUsage) {
tmpAttrs = [_delegate layoutManager: self
@ -2046,8 +2053,8 @@ static inline void _appendRectToCache(NSLayoutManager *self, NSRect rect) {
NSRange glyphRange = range;
// Next take a look at the overprinting options
BOOL underline =
[[attributes objectForKey: NSUnderlineStyleAttributeName] boolValue];
BOOL underline = [[attributes objectForKey: NSUnderlineStyleAttributeName]
boolValue];
BOOL strikeThru = [[attributes
objectForKey: NSStrikethroughStyleAttributeName] boolValue];
@ -2067,8 +2074,8 @@ static inline void _appendRectToCache(NSLayoutManager *self, NSRect rect) {
if (strikeThru) {
// Make sure we've got a good strikeThru color
NSColor *strikeThruColor =
[attributes objectForKey: NSStrikethroughColorAttributeName];
NSColor *strikeThruColor = [attributes
objectForKey: NSStrikethroughColorAttributeName];
if (strikeThruColor == nil) {
strikeThruColor = [NSColor blackColor];
}
@ -2212,8 +2219,8 @@ static inline void _appendRectToCache(NSLayoutManager *self, NSRect rect) {
NSUInteger length = 0;
BOOL showGlyphs = NO;
NSGlyph glyph =
(location < NSMaxRange(range)) ? glyphs[i] : NSNullGlyph;
NSGlyph glyph = (location < NSMaxRange(range)) ? glyphs[i]
: NSNullGlyph;
// Glyph is invisible so just translate it to a Null glyph
if (glyph == NSControlGlyph) {
@ -2361,10 +2368,11 @@ static inline void _appendRectToCache(NSLayoutManager *self, NSRect rect) {
NSRange range;
NSGlyphFragment *fragment;
BOOL checkTemporaryAttributesUsage = [_delegate
respondsToSelector: @selector
BOOL checkTemporaryAttributesUsage =
[_delegate respondsToSelector: @selector
(layoutManager:
shouldUseTemporaryAttributes:forDrawingToScreen:atCharacterIndex
shouldUseTemporaryAttributes:forDrawingToScreen
:atCharacterIndex
:effectiveRange:)];
// Iterate over the glyph fragments (which identify runs of common
@ -2460,8 +2468,8 @@ static inline void _appendRectToCache(NSLayoutManager *self, NSRect rect) {
subRange =
[self glyphRangeForCharacterRange: subRange
actualCharacterRange: NULL];
glyphXOffset =
[self _drawGlyphsForSubGlyphRange: subRange
glyphXOffset = [self
_drawGlyphsForSubGlyphRange: subRange
forFragment: fragment
atPoint: origin
subRangeXOffset: glyphXOffset
@ -2472,7 +2480,8 @@ static inline void _appendRectToCache(NSLayoutManager *self, NSRect rect) {
NSDictionary *tempAttrs = [self
temporaryAttributesAtCharacterIndex: charIndex
effectiveRange: &tempRange];
effectiveRange: &
tempRange];
if (checkTemporaryAttributesUsage) {
tempAttrs = [_delegate layoutManager: self
@ -2498,8 +2507,8 @@ static inline void _appendRectToCache(NSLayoutManager *self, NSRect rect) {
[self glyphRangeForCharacterRange: tempRange
actualCharacterRange: NULL];
glyphXOffset =
[self _drawGlyphsForSubGlyphRange: tempGlyphRange
glyphXOffset = [self
_drawGlyphsForSubGlyphRange: tempGlyphRange
forFragment: fragment
atPoint: origin
subRangeXOffset: glyphXOffset
@ -2511,8 +2520,8 @@ static inline void _appendRectToCache(NSLayoutManager *self, NSRect rect) {
offset = NSMaxRange(tempRange);
charIndex =
offset -
1; // Make sure we leap over the temp range (one off
// to accommodate the auto-increment)
1; // Make sure we leap over the temp range (one
// off to accommodate the auto-increment)
length = -1; // accommodate the auto-increment
}
@ -2568,8 +2577,8 @@ static inline void _appendRectToCache(NSLayoutManager *self, NSRect rect) {
i = result.location;
j = result.location;
while (
(fragment = NSRangeEntryAtIndex(self->_glyphFragments, i - 1, NULL))) {
while ((fragment =
NSRangeEntryAtIndex(self->_glyphFragments, i - 1, NULL))) {
if (fragment->location.y != origin)
break;
result.location = i;
@ -2599,9 +2608,9 @@ static inline void _appendRectToCache(NSLayoutManager *self, NSRect rect) {
return [font defaultLineHeightForFont];
}
- (NSDictionary *) temporaryAttributesAtCharacterIndex: (NSUInteger) charIndex
effectiveRange:
(NSRangePointer) effectiveCharRange
- (NSDictionary *)
temporaryAttributesAtCharacterIndex: (NSUInteger) charIndex
effectiveRange: (NSRangePointer) effectiveCharRange
{
NSDictionary *result;
@ -2703,7 +2712,8 @@ static inline void _appendRectToCache(NSLayoutManager *self, NSRect rect) {
replace.location = location;
replace.length =
MIN(NSMaxRange(charRange), NSMaxRange(effectiveRange)) - location;
MIN(NSMaxRange(charRange), NSMaxRange(effectiveRange)) -
location;
if ([check objectForKey: attrName] != nil) {
NSMutableDictionary *modify = [[check mutableCopy] autorelease];
@ -2781,8 +2791,8 @@ static inline void _appendRectToCache(NSLayoutManager *self, NSRect rect) {
// Check if we can expand it before the found range
NSRange effectiveRange;
while (range->location > rangeLimit.location) {
id attr =
[self temporaryAttributesAtCharacterIndex: range->location - 1
id attr = [self
temporaryAttributesAtCharacterIndex: range->location - 1
effectiveRange: &effectiveRange];
if (attr == result || [attr isEqual: result]) {
// Expand the found range location
@ -2794,8 +2804,8 @@ static inline void _appendRectToCache(NSLayoutManager *self, NSRect rect) {
}
// Check if we can expand it after the found range
while (NSMaxRange(*range) < NSMaxRange(rangeLimit)) {
id attr =
[self temporaryAttributesAtCharacterIndex: NSMaxRange(*range)
id attr = [self
temporaryAttributesAtCharacterIndex: NSMaxRange(*range)
effectiveRange: &effectiveRange];
if (attr == result || [attr isEqual: result]) {
// Expand the found range length

View File

@ -46,8 +46,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
- (void) addRange: (NSRange) range {
if (_count >= _capacity) {
_capacity *= 2;
_ranges =
NSZoneRealloc([self zone], _ranges, sizeof(NSRange) * _capacity);
_ranges = NSZoneRealloc([self zone], _ranges,
sizeof(NSRange) * _capacity);
}
_ranges[_count++] = range;

View File

@ -15,8 +15,8 @@
{
NSImage *image = [NSImage imageNamed: @"NSRulerMarkerTab"];
NSPoint imageOrigin = NSMakePoint(0, 0);
NSRulerMarker *marker =
[[[NSRulerMarker alloc] initWithRulerView: ruler
NSRulerMarker *marker = [[[NSRulerMarker alloc]
initWithRulerView: ruler
markerLocation: location
image: image
imageOrigin: imageOrigin] autorelease];
@ -28,8 +28,8 @@
{
NSImage *image = [NSImage imageNamed: @"NSRulerMarkerTab"];
NSPoint imageOrigin = NSMakePoint(0, 0);
NSRulerMarker *marker =
[[[NSRulerMarker alloc] initWithRulerView: ruler
NSRulerMarker *marker = [[[NSRulerMarker alloc]
initWithRulerView: ruler
markerLocation: location
image: image
imageOrigin: imageOrigin] autorelease];
@ -41,8 +41,8 @@
{
NSImage *image = [NSImage imageNamed: @"NSRulerMarkerTab"];
NSPoint imageOrigin = NSMakePoint(0, 0);
NSRulerMarker *marker =
[[[NSRulerMarker alloc] initWithRulerView: ruler
NSRulerMarker *marker = [[[NSRulerMarker alloc]
initWithRulerView: ruler
markerLocation: location
image: image
imageOrigin: imageOrigin] autorelease];
@ -54,8 +54,8 @@
{
NSImage *image = [NSImage imageNamed: @"NSRulerMarkerTab"];
NSPoint imageOrigin = NSMakePoint(0, 0);
NSRulerMarker *marker =
[[[NSRulerMarker alloc] initWithRulerView: ruler
NSRulerMarker *marker = [[[NSRulerMarker alloc]
initWithRulerView: ruler
markerLocation: location
image: image
imageOrigin: imageOrigin] autorelease];
@ -67,8 +67,8 @@
{
NSImage *image = [NSImage imageNamed: @"NSRulerMarkerTab"];
NSPoint imageOrigin = NSMakePoint(0, 0);
NSRulerMarker *marker =
[[[NSRulerMarker alloc] initWithRulerView: ruler
NSRulerMarker *marker = [[[NSRulerMarker alloc]
initWithRulerView: ruler
markerLocation: location
image: image
imageOrigin: imageOrigin] autorelease];
@ -80,8 +80,8 @@
{
NSImage *image = [NSImage imageNamed: @"NSRulerMarkerTab"];
NSPoint imageOrigin = NSMakePoint(0, 0);
NSRulerMarker *marker =
[[[NSRulerMarker alloc] initWithRulerView: ruler
NSRulerMarker *marker = [[[NSRulerMarker alloc]
initWithRulerView: ruler
markerLocation: location
image: image
imageOrigin: imageOrigin] autorelease];
@ -93,8 +93,8 @@
{
NSImage *image = [NSImage imageNamed: @"NSRulerMarkerTab"];
NSPoint imageOrigin = NSMakePoint(0, 0);
NSRulerMarker *marker =
[[[NSRulerMarker alloc] initWithRulerView: ruler
NSRulerMarker *marker = [[[NSRulerMarker alloc]
initWithRulerView: ruler
markerLocation: location
image: image
imageOrigin: imageOrigin] autorelease];
@ -106,8 +106,8 @@
{
NSImage *image = [NSImage imageNamed: @"NSRulerMarkerTab"];
NSPoint imageOrigin = NSMakePoint(0, 0);
NSRulerMarker *marker =
[[[NSRulerMarker alloc] initWithRulerView: ruler
NSRulerMarker *marker = [[[NSRulerMarker alloc]
initWithRulerView: ruler
markerLocation: location
image: image
imageOrigin: imageOrigin] autorelease];
@ -119,8 +119,8 @@
{
NSImage *image = [NSImage imageNamed: @"NSRulerMarkerTab"];
NSPoint imageOrigin = NSMakePoint(0, 0);
NSRulerMarker *marker =
[[[NSRulerMarker alloc] initWithRulerView: ruler
NSRulerMarker *marker = [[[NSRulerMarker alloc]
initWithRulerView: ruler
markerLocation: location
image: image
imageOrigin: imageOrigin] autorelease];

View File

@ -116,10 +116,11 @@ NSString *const NSTextStorageDidProcessEditingNotification =
- (void) processEditing {
int i, count;
if ([_delegate
respondsToSelector: @selector(textStorageWillProcessEditing:)]) {
if ([_delegate respondsToSelector: @selector
(textStorageWillProcessEditing:)]) {
NSNotification *note = [NSNotification
notificationWithName: NSTextStorageWillProcessEditingNotification
notificationWithName:
NSTextStorageWillProcessEditingNotification
object: self
userInfo: nil];
[_delegate textStorageWillProcessEditing: note];

View File

@ -120,8 +120,10 @@ static inline void setAttributes(NSTextStorage_concrete *self,
NSRangeEntriesVerify(self->_rangeToAttributes, [self length]);
}
static inline void replaceCharactersInRangeWithAttributedString(
NSTextStorage_concrete *self, NSRange replaced, NSAttributedString *other)
static inline void
replaceCharactersInRangeWithAttributedString(NSTextStorage_concrete *self,
NSRange replaced,
NSAttributedString *other)
{
NSString *string = [other string];
unsigned location = 0;
@ -132,8 +134,8 @@ static inline void replaceCharactersInRangeWithAttributedString(
NSRange effectiveRange;
NSDictionary *attributes = [other attributesAtIndex: location
effectiveRange: &effectiveRange];
NSRange range =
NSMakeRange(replaced.location + location, effectiveRange.length);
NSRange range = NSMakeRange(replaced.location + location,
effectiveRange.length);
setAttributes(self, attributes, range);
@ -179,8 +181,8 @@ static inline void replaceCharactersInRangeWithAttributedString(
}
- (NSMutableString *) mutableString {
return
[[[NSClassFromString(@"NSMutableStringProxyForMutableAttributedString")
return [[[NSClassFromString(
@"NSMutableStringProxyForMutableAttributedString")
allocWithZone: NULL]
performSelector: @selector(initWithMutableAttributedString:)
withObject: self] autorelease];

View File

@ -100,32 +100,36 @@ NSString *const NSOldSelectedCharacterRange = @"NSOldSelectedCharacterRange";
if (menu == nil) {
menu = [[NSMenu alloc] initWithTitle: @""];
[menu
addItemWithTitle: NSLocalizedStringFromTableInBundle(
[menu addItemWithTitle: NSLocalizedStringFromTableInBundle(
@"Cut", nil,
[NSBundle bundleForClass: [NSTextView class]],
[NSBundle
bundleForClass: [NSTextView
class]],
@"Cut the selection")
action: @selector(cut:)
keyEquivalent: @""];
[menu
addItemWithTitle: NSLocalizedStringFromTableInBundle(
[menu addItemWithTitle: NSLocalizedStringFromTableInBundle(
@"Copy", nil,
[NSBundle bundleForClass: [NSTextView class]],
[NSBundle
bundleForClass: [NSTextView
class]],
@"Copy the selection")
action: @selector(copy:)
keyEquivalent: @""];
[menu
addItemWithTitle: NSLocalizedStringFromTableInBundle(
[menu addItemWithTitle: NSLocalizedStringFromTableInBundle(
@"Paste", nil,
[NSBundle bundleForClass: [NSTextView class]],
[NSBundle
bundleForClass: [NSTextView
class]],
@"Paste the selection")
action: @selector(paste:)
keyEquivalent: @""];
[menu addItem: [NSMenuItem separatorItem]];
[menu
addItemWithTitle: NSLocalizedStringFromTableInBundle(
[menu addItemWithTitle: NSLocalizedStringFromTableInBundle(
@"Select All", nil,
[NSBundle bundleForClass: [NSTextView class]],
[NSBundle
bundleForClass: [NSTextView
class]],
@"Select all the content")
action: @selector(selectAll:)
keyEquivalent: @""];
@ -184,11 +188,11 @@ NSString *const NSOldSelectedCharacterRange = @"NSOldSelectedCharacterRange";
_rangeForUserCompletion = NSMakeRange(NSNotFound, 0);
_selectedTextAttributes = [[NSDictionary
dictionaryWithObjectsAndKeys: [NSColor selectedTextColor],
dictionaryWithObjectsAndKeys:
[NSColor selectedTextColor],
NSForegroundColorAttributeName,
[NSColor selectedTextBackgroundColor],
NSBackgroundColorAttributeName, nil]
retain];
NSBackgroundColorAttributeName, nil] retain];
[_textStorage
addAttribute: NSFontAttributeName
@ -223,8 +227,8 @@ NSString *const NSOldSelectedCharacterRange = @"NSOldSelectedCharacterRange";
format: @"-[%@ %s] is not implemented for coder %@",
[self class], sel_getName(_cmd), coder];
}
[self
registerForDraggedTypes: [NSArray arrayWithObjects: NSRTFPboardType,
[self registerForDraggedTypes: [NSArray
arrayWithObjects: NSRTFPboardType,
NSStringPboardType,
nil]];
@ -258,7 +262,8 @@ NSString *const NSOldSelectedCharacterRange = @"NSOldSelectedCharacterRange";
[_selectedRanges addObject: [NSValue valueWithRange: NSMakeRange(0, 0)]];
NSMutableDictionary *typingAttributes =
[[_textStorage attributesAtIndex: 0 effectiveRange: NULL] mutableCopy];
[[_textStorage attributesAtIndex: 0
effectiveRange: NULL] mutableCopy];
if (![typingAttributes objectForKey: NSFontAttributeName]) {
[typingAttributes setObject: _font forKey: NSFontAttributeName];
}
@ -287,8 +292,8 @@ NSString *const NSOldSelectedCharacterRange = @"NSOldSelectedCharacterRange";
[self setBoundsOrigin: NSMakePoint(-_textContainerInset.width,
-_textContainerInset.height)];
[self configureMenu];
[self
registerForDraggedTypes: [NSArray arrayWithObjects: NSRTFPboardType,
[self registerForDraggedTypes: [NSArray
arrayWithObjects: NSRTFPboardType,
NSStringPboardType,
nil]];
@ -526,9 +531,9 @@ NSString *const NSOldSelectedCharacterRange = @"NSOldSelectedCharacterRange";
stillSelecting: (BOOL) stillSelecting
{
if ([ranges count] == 0)
[NSException
raise: NSInvalidArgumentException
format: @"-[%@ %s] ranges should not be empty", [self class], _cmd];
[NSException raise: NSInvalidArgumentException
format: @"-[%@ %s] ranges should not be empty",
[self class], _cmd];
// Save the initial selected ranges so we can use it when we're done with
// the selection change
@ -568,16 +573,16 @@ NSString *const NSOldSelectedCharacterRange = @"NSOldSelectedCharacterRange";
object: self
userInfo:
[NSDictionary
dictionaryWithObject: [oldRanges
objectAtIndex: 0]
forKey:
NSOldSelectedCharacterRange]];
dictionaryWithObject:
[oldRanges objectAtIndex: 0]
forKey: NSOldSelectedCharacterRange]];
}
if (!_isContinuousSpellCheckingEnabled)
[[self layoutManager]
removeTemporaryAttribute: NSSpellingStateAttributeName
forCharacterRange: NSMakeRange(0, [[self string] length])];
forCharacterRange: NSMakeRange(0,
[[self string] length])];
}
- (void) setSelectedRanges: (NSArray *) ranges {
@ -627,7 +632,8 @@ NSString *const NSOldSelectedCharacterRange = @"NSOldSelectedCharacterRange";
result = completions;
if ([_delegate respondsToSelector: @selector
if ([_delegate
respondsToSelector: @selector
(textView:
completions:forPartialWordRange:indexOfSelectedItem:)])
result = [_delegate textView: self
@ -655,8 +661,9 @@ NSString *const NSOldSelectedCharacterRange = @"NSOldSelectedCharacterRange";
// selected.
if (movement == NSReturnTextMovement ||
movement == NSOtherTextMovement) {
[self setSelectedRange: NSMakeRange(
range.location + [string length], 0)];
[self setSelectedRange: NSMakeRange(range.location +
[string length],
0)];
[self endUserCompletion];
} else if (movement == NSCancelTextMovement)
[self endUserCompletion];
@ -671,8 +678,8 @@ NSString *const NSOldSelectedCharacterRange = @"NSOldSelectedCharacterRange";
type: (NSString *) type
{
if ([type isEqualToString: NSStringPboardType]) {
[pasteboard
setString: [[self string] substringWithRange: [self selectedRange]]
[pasteboard setString: [[self string]
substringWithRange: [self selectedRange]]
forType: type];
return YES;
} else if ([type isEqualToString: NSRTFPboardType]) {
@ -811,8 +818,8 @@ NSString *const NSOldSelectedCharacterRange = @"NSOldSelectedCharacterRange";
NSUInteger rectCount = 0;
// Get the last used fragment rect
range = NSMakeRange([_textStorage length] - 1, 1);
range =
[[self layoutManager] glyphRangeForCharacterRange: range
range = [[self layoutManager]
glyphRangeForCharacterRange: range
actualCharacterRange: NULL];
result = [[self layoutManager]
lineFragmentUsedRectForGlyphAtIndex: range.location
@ -996,12 +1003,12 @@ NSString *const NSOldSelectedCharacterRange = @"NSOldSelectedCharacterRange";
[_insertionPointTimer release];
_insertionPointTimer = nil;
NSDictionary *userInfo =
[NSDictionary dictionaryWithObject: [NSNumber numberWithInt: movement]
NSDictionary *userInfo = [NSDictionary
dictionaryWithObject: [NSNumber numberWithInt: movement]
forKey: @"NSTextMovement"];
NSNotification *note =
[NSNotification notificationWithName: NSTextDidEndEditingNotification
NSNotification *note = [NSNotification
notificationWithName: NSTextDidEndEditingNotification
object: self
userInfo: userInfo];
@ -1023,7 +1030,8 @@ NSString *const NSOldSelectedCharacterRange = @"NSOldSelectedCharacterRange";
if (_userCompletionSelectedItem >= [_userCompletions count])
_userCompletionSelectedItem = 0;
[self insertCompletion: [_userCompletions
[self insertCompletion:
[_userCompletions
objectAtIndex: _userCompletionSelectedItem]
forPartialWordRange: _rangeForUserCompletion
movement: NSTabTextMovement
@ -1051,7 +1059,8 @@ NSString *const NSOldSelectedCharacterRange = @"NSOldSelectedCharacterRange";
}
if (_rangeForUserCompletion.location != NSNotFound) {
[self insertCompletion: [_userCompletions
[self insertCompletion:
[_userCompletions
objectAtIndex: _userCompletionSelectedItem]
forPartialWordRange: _rangeForUserCompletion
movement: NSReturnTextMovement
@ -1170,7 +1179,8 @@ NSString *const NSOldSelectedCharacterRange = @"NSOldSelectedCharacterRange";
if (_userCompletionSelectedItem < [_userCompletions count] - 1)
_userCompletionSelectedItem++;
[self insertCompletion: [_userCompletions
[self insertCompletion:
[_userCompletions
objectAtIndex: _userCompletionSelectedItem]
forPartialWordRange: _rangeForUserCompletion
movement: NSDownTextMovement
@ -1251,7 +1261,8 @@ NSString *const NSOldSelectedCharacterRange = @"NSOldSelectedCharacterRange";
if (_userCompletionSelectedItem > 0)
_userCompletionSelectedItem--;
[self insertCompletion: [_userCompletions
[self insertCompletion:
[_userCompletions
objectAtIndex: _userCompletionSelectedItem]
forPartialWordRange: _rangeForUserCompletion
movement: NSUpTextMovement
@ -1536,8 +1547,8 @@ NSString *const NSOldSelectedCharacterRange = @"NSOldSelectedCharacterRange";
} else {
if (range.location > 0) {
range.location--;
if (![self
_delegateChangeTextInRange: NSMakeRange(range.location, 1)
if (![self _delegateChangeTextInRange: NSMakeRange(range.location,
1)
replacementString: @""])
return;
@ -2022,8 +2033,8 @@ NSString *const NSOldSelectedCharacterRange = @"NSOldSelectedCharacterRange";
NSString *transposed = [b stringByAppendingString: a];
if (![self
_delegateChangeTextInRange: NSMakeRange(range.location - 1, 2)
if (![self _delegateChangeTextInRange: NSMakeRange(range.location - 1,
2)
replacementString: transposed])
return;
@ -2047,7 +2058,8 @@ NSString *const NSOldSelectedCharacterRange = @"NSOldSelectedCharacterRange";
return;
if ([[NSCharacterSet whitespaceCharacterSet]
characterIsMember: [string characterAtIndex: range.location]] == NO)
characterIsMember: [string characterAtIndex: range.location]] ==
NO)
return;
space = [string substringWithRange: NSMakeRange(range.location, 1)];
@ -2068,8 +2080,8 @@ NSString *const NSOldSelectedCharacterRange = @"NSOldSelectedCharacterRange";
[self replaceCharactersInRange: NSMakeRange(previousWord, 0) withString: b];
[self replaceCharactersInRange: NSMakeRange(previousWord + [b length], 0)
withString: space];
[self
replaceCharactersInRange: NSMakeRange(previousWord + [b length] + 1, 0)
[self replaceCharactersInRange: NSMakeRange(previousWord + [b length] + 1,
0)
withString: a];
[self _setAndScrollToRange: NSMakeRange(nextWord + 1, 0)];
@ -2085,9 +2097,10 @@ NSString *const NSOldSelectedCharacterRange = @"NSOldSelectedCharacterRange";
_rangeForUserCompletion = [self rangeForUserCompletion];
_userCompletionHint = [[[_textStorage string]
substringWithRange: _rangeForUserCompletion] retain];
_userCompletions = [[self
completionsForPartialWordRange: _rangeForUserCompletion
indexOfSelectedItem: &_userCompletionSelectedItem] retain];
_userCompletions =
[[self completionsForPartialWordRange: _rangeForUserCompletion
indexOfSelectedItem: &_userCompletionSelectedItem]
retain];
if ([_userCompletions count] == 0) {
[self endUserCompletion];
@ -2124,12 +2137,14 @@ NSString *const NSOldSelectedCharacterRange = @"NSOldSelectedCharacterRange";
if (flag) {
[sender setTitle: NSLocalizedStringFromTableInBundle(
@"Hide Ruler", nil,
[NSBundle bundleForClass: [NSTextView class]],
[NSBundle bundleForClass: [NSTextView
class]],
@"Hide the page ruler")];
} else {
[sender setTitle: NSLocalizedStringFromTableInBundle(
@"Show Ruler", nil,
[NSBundle bundleForClass: [NSTextView class]],
[NSBundle bundleForClass: [NSTextView
class]],
@"Show the page ruler")];
}
}
@ -2231,7 +2246,8 @@ NSString *const NSOldSelectedCharacterRange = @"NSOldSelectedCharacterRange";
SEL selector;
NSString *name;
} notes[] = {
{@selector(textDidBeginEditing:), NSTextDidBeginEditingNotification},
{@selector(textDidBeginEditing:),
NSTextDidBeginEditingNotification},
{@selector(textDidEndEditing:), NSTextDidEndEditingNotification},
{@selector(textDidChange:), NSTextDidChangeNotification},
{@selector(textViewDidChangeSelection:),
@ -2301,7 +2317,8 @@ NSString *const NSOldSelectedCharacterRange = @"NSOldSelectedCharacterRange";
[style setAlignment: _textAlignment];
NSDictionary *attributes = [NSDictionary
dictionaryWithObjectsAndKeys: _font, NSFontAttributeName, style,
NSParagraphStyleAttributeName, nil];
NSParagraphStyleAttributeName,
nil];
if (attributes &&
[attributes isEqualToDictionary: [self typingAttributes]] == NO) {
[self setTypingAttributes: attributes];
@ -2616,10 +2633,10 @@ NSString *const NSOldSelectedCharacterRange = @"NSOldSelectedCharacterRange";
NSMutableParagraphStyle *style = nil;
if ([[self textStorage] length] > 0)
style =
[[[[self textStorage] attribute: NSParagraphStyleAttributeName
style = [[[[self textStorage] attribute: NSParagraphStyleAttributeName
atIndex: range.location
effectiveRange: NULL] mutableCopy] autorelease];
effectiveRange: NULL] mutableCopy]
autorelease];
if (style == nil)
style = [[[NSParagraphStyle defaultParagraphStyle] mutableCopy]
@ -2721,8 +2738,8 @@ NSString *const NSOldSelectedCharacterRange = @"NSOldSelectedCharacterRange";
[self _configureTextContainerSize];
usedRect =
[[self layoutManager] usedRectForTextContainer: [self textContainer]];
usedRect = [[self layoutManager]
usedRectForTextContainer: [self textContainer]];
extraRect = [[self layoutManager] extraLineFragmentUsedRect];
if (!NSEqualRects(extraRect, NSZeroRect)) {
extraRect.size.width = NSMaxX(usedRect) - NSMinX(extraRect);
@ -3282,23 +3299,23 @@ NSString *const NSOldSelectedCharacterRange = @"NSOldSelectedCharacterRange";
if ([_delegate
respondsToSelector: @selector
(textView:
willChangeSelectionFromCharacterRanges:toCharacterRanges:)])
willChangeSelectionFromCharacterRanges:toCharacterRanges
:)])
result = [_delegate textView: self
willChangeSelectionFromCharacterRanges: from
toCharacterRanges: to];
else if ([_delegate
respondsToSelector: @selector
else if ([_delegate respondsToSelector: @selector
(textView:
willChangeSelectionFromCharacterRange:toCharacterRange
:)]) {
willChangeSelectionFromCharacterRange:
toCharacterRange:)]) {
NSRange fromRange = [[from objectAtIndex: 0] rangeValue];
NSRange toRange = [[to objectAtIndex: 0] rangeValue];
NSRange resultRange = [_delegate textView: self
willChangeSelectionFromCharacterRange: fromRange
toCharacterRange: toRange];
result =
[NSArray arrayWithObject: [NSValue valueWithRange: resultRange]];
result = [NSArray
arrayWithObject: [NSValue valueWithRange: resultRange]];
}
return result;
@ -3311,10 +3328,13 @@ NSString *const NSOldSelectedCharacterRange = @"NSOldSelectedCharacterRange";
[_textStorage
setAttributedString:
[[[NSAttributedString alloc]
initWithString: NSLocalizedStringFromTableInBundle(
initWithString:
NSLocalizedStringFromTableInBundle(
@"", nil,
[NSBundle
bundleForClass: [NSTextView class]],
bundleForClass:
[NSTextView
class]],
@"")
attributes: nil] autorelease]];
}
@ -3411,8 +3431,9 @@ NSString *const NSOldSelectedCharacterRange = @"NSOldSelectedCharacterRange";
}
- (void) _continuousSpellCheck {
[self
_continuousSpellCheckWithInvalidatedRange: NSMakeRange(0, [[self string]
[self _continuousSpellCheckWithInvalidatedRange: NSMakeRange(
0,
[[self string]
length])];
}
@ -3431,8 +3452,8 @@ NSString *const NSOldSelectedCharacterRange = @"NSOldSelectedCharacterRange";
}
}
NSRange range =
NSMakeRange(selection.location, [string length] - selection.location);
NSRange range = NSMakeRange(selection.location,
[string length] - selection.location);
NSSpellChecker *checker = [NSSpellChecker sharedSpellChecker];
NSArray *checking = [checker checkString: string
@ -3470,21 +3491,24 @@ NSString *const NSOldSelectedCharacterRange = @"NSOldSelectedCharacterRange";
@try {
NSRange range = [_textStorage
doubleClickAtIndex: [self glyphIndexForPoint: point
doubleClickAtIndex:
[self glyphIndexForPoint: point
fractionOfDistanceThroughGlyph: &fraction]];
[self setSelectedRange: range];
NSSpellChecker *checker = [NSSpellChecker sharedSpellChecker];
NSArray *guesses = [checker
guessesForWordRange: range
NSArray *guesses =
[checker guessesForWordRange: range
inString: [self string]
language: [[NSLocale currentLocale] localeIdentifier]
language: [[NSLocale currentLocale]
localeIdentifier]
inSpellDocumentWithTag: [self spellCheckerDocumentTag]];
if ([guesses count] == 0) {
NSMenuItem *item = [menu
addItemWithTitle: NSLocalizedStringFromTableInBundle(
addItemWithTitle:
NSLocalizedStringFromTableInBundle(
@"No Guesses Found", nil,
[NSBundle
bundleForClass: [NSTextView class]],
@ -3506,26 +3530,30 @@ NSString *const NSOldSelectedCharacterRange = @"NSOldSelectedCharacterRange";
}
[menu addItemWithTitle: NSLocalizedStringFromTableInBundle(
@"Cut", nil,
[NSBundle bundleForClass: [NSTextView class]],
[NSBundle
bundleForClass: [NSTextView class]],
@"Cut the selection")
action: @selector(cut:)
keyEquivalent: @""];
[menu addItemWithTitle: NSLocalizedStringFromTableInBundle(
@"Copy", nil,
[NSBundle bundleForClass: [NSTextView class]],
[NSBundle
bundleForClass: [NSTextView class]],
@"Copy the selection")
action: @selector(copy:)
keyEquivalent: @""];
[menu addItemWithTitle: NSLocalizedStringFromTableInBundle(
@"Paste", nil,
[NSBundle bundleForClass: [NSTextView class]],
[NSBundle
bundleForClass: [NSTextView class]],
@"Paste the selection")
action: @selector(paste:)
keyEquivalent: @""];
[menu addItem: [NSMenuItem separatorItem]];
[menu addItemWithTitle: NSLocalizedStringFromTableInBundle(
@"Select All", nil,
[NSBundle bundleForClass: [NSTextView class]],
[NSBundle
bundleForClass: [NSTextView class]],
@"Select all the content")
action: @selector(selectAll:)
keyEquivalent: @""];
@ -3689,10 +3717,12 @@ NSString *const NSOldSelectedCharacterRange = @"NSOldSelectedCharacterRange";
// keep the tabstops sorted
[tabstops
sortUsingDescriptors:
[NSArray
arrayWithObject: [NSSortDescriptor
sortDescriptorWithKey: @"location"
ascending: YES]]];
[NSArray arrayWithObject:
[NSSortDescriptor
sortDescriptorWithKey:
@"location"
ascending:
YES]]];
[newStyle setTabStops: tabstops];
[_textStorage addAttribute: NSParagraphStyleAttributeName
value: newStyle
@ -3717,8 +3747,10 @@ NSString *const NSOldSelectedCharacterRange = @"NSOldSelectedCharacterRange";
// keep the tabstops sorted
[tabstops
sortUsingDescriptors:
[NSArray arrayWithObject: [NSSortDescriptor
sortDescriptorWithKey: @"location"
[NSArray arrayWithObject:
[NSSortDescriptor
sortDescriptorWithKey:
@"location"
ascending: YES]]];
[newStyle setTabStops: tabstops];
if (![_typingAttributes isKindOfClass: [NSMutableDictionary class]]) {
@ -3800,10 +3832,12 @@ NSString *const NSOldSelectedCharacterRange = @"NSOldSelectedCharacterRange";
// keep the tabstops sorted
[tabstops
sortUsingDescriptors:
[NSArray
arrayWithObject: [NSSortDescriptor
sortDescriptorWithKey: @"location"
ascending: YES]]];
[NSArray arrayWithObject:
[NSSortDescriptor
sortDescriptorWithKey:
@"location"
ascending:
YES]]];
[newStyle setTabStops: tabstops];
[_textStorage addAttribute: NSParagraphStyleAttributeName
value: newStyle
@ -3826,8 +3860,10 @@ NSString *const NSOldSelectedCharacterRange = @"NSOldSelectedCharacterRange";
// keep the tabstops sorted
[tabstops
sortUsingDescriptors:
[NSArray arrayWithObject: [NSSortDescriptor
sortDescriptorWithKey: @"location"
[NSArray arrayWithObject:
[NSSortDescriptor
sortDescriptorWithKey:
@"location"
ascending: YES]]];
[newStyle setTabStops: tabstops];
if (![_typingAttributes isKindOfClass: [NSMutableDictionary class]]) {

View File

@ -34,8 +34,8 @@
}
+ sharedSystemTypesetter {
return [self
sharedSystemTypesetterForBehavior: [self defaultTypesetterBehavior]];
return [self sharedSystemTypesetterForBehavior:
[self defaultTypesetterBehavior]];
}
- (void) dealloc {

View File

@ -305,7 +305,8 @@ static void loadGlyphAndCharacterCacheForLocation(NSTypesetter_concrete *self,
CGFloat x = _scanRect.origin.x + fragmentWidth;
NSTextTab *tab =
[self textTabForGlyphLocation: x
writingDirection: [_currentParagraphStyle
writingDirection:
[_currentParagraphStyle
baseWritingDirection]
maxLocation: NSMaxX(_scanRect)];
CGFloat nextx;
@ -317,8 +318,8 @@ static void loadGlyphAndCharacterCacheForLocation(NSTypesetter_concrete *self,
[_currentParagraphStyle defaultTabInterval];
if (interval > 0)
nextx =
(((NSInteger)(x / interval)) + 1) * interval;
nextx = (((NSInteger)(x / interval)) + 1) *
interval;
else
nextx = x;
}
@ -350,8 +351,8 @@ static void loadGlyphAndCharacterCacheForLocation(NSTypesetter_concrete *self,
break;
}
glyphAdvance =
_positionOfGlyph(_font, NULL, glyph, _previousGlyph, &isNominal)
glyphAdvance = _positionOfGlyph(_font, NULL, glyph, _previousGlyph,
&isNominal)
.x;
if (!isNominal && fragmentRange.length > 1) {
#if DEBUG_GETLINEFRAGMENTRECT
@ -365,8 +366,9 @@ static void loadGlyphAndCharacterCacheForLocation(NSTypesetter_concrete *self,
break;
}
// Get the width of the glyph
glyphMaxWidth =
_positionOfGlyph(_font, NULL, NSNullGlyph, glyph, &isNominal).x;
glyphMaxWidth = _positionOfGlyph(_font, NULL, NSNullGlyph, glyph,
&isNominal)
.x;
}
switch (_lineBreakMode) {
@ -409,8 +411,8 @@ static void loadGlyphAndCharacterCacheForLocation(NSTypesetter_concrete *self,
1];
[_layoutManager _rollbackLatestFragment];
[_glyphRangesInLine
removeRangeAtIndex: [_glyphRangesInLine
count] -
removeRangeAtIndex:
[_glyphRangesInLine count] -
1];
if (_wordWrapRange.location ==
range.location) {
@ -431,8 +433,9 @@ static void loadGlyphAndCharacterCacheForLocation(NSTypesetter_concrete *self,
_scanRect.origin.x = NSMaxX(_fullLineRect);
_scanRect.origin.y = NSMinY(proposedRect);
_scanRect.size.width = 0;
_scanRect.size.height = MAX(
proposedRect.size.height, fragmentHeight);
_scanRect.size.height =
MAX(proposedRect.size.height,
fragmentHeight);
_lineRange.length -= fragmentRange.length;
fragmentRange.length = 0;
fragmentWidth = 0;
@ -572,8 +575,8 @@ static void loadGlyphAndCharacterCacheForLocation(NSTypesetter_concrete *self,
#endif
// Check we still fit if something changed our height
_scanRect.size.height = height;
_scanRect =
[_container lineFragmentRectForProposedRect: _scanRect
_scanRect = [_container
lineFragmentRectForProposedRect: _scanRect
sweepDirection: NSLineSweepRight
movementDirection: NSLineMovesDown
remainingRect: remainingRect];
@ -636,8 +639,8 @@ static void loadGlyphAndCharacterCacheForLocation(NSTypesetter_concrete *self,
NSLog(@"reordering fragment range: %@",
NSStringFromRange(range));
#endif
NSPoint location =
[_layoutManager locationForGlyphAtIndex: range.location];
NSPoint location = [_layoutManager
locationForGlyphAtIndex: range.location];
NSRect usedRect = [_layoutManager
lineFragmentUsedRectForGlyphAtIndex: range.location
effectiveRange: NULL];
@ -740,8 +743,8 @@ static void loadGlyphAndCharacterCacheForLocation(NSTypesetter_concrete *self,
NSLog(@"adjusting glyph range: %@", NSStringFromRange(range));
#endif
NSRect backRect =
[_layoutManager lineFragmentRectForGlyphAtIndex: range.location
NSRect backRect = [_layoutManager
lineFragmentRectForGlyphAtIndex: range.location
effectiveRange: NULL];
NSRect usedRect = [_layoutManager
lineFragmentUsedRectForGlyphAtIndex: range.location
@ -954,8 +957,8 @@ static void loadGlyphAndCharacterCacheForLocation(NSTypesetter_concrete *self,
_whitespaceAdvancement = [_font advancementForGlyph: spaceGlyph].width;
}
if ((_currentParagraphStyle =
[_attributes objectForKey: NSParagraphStyleAttributeName]) == nil)
if ((_currentParagraphStyle = [_attributes
objectForKey: NSParagraphStyleAttributeName]) == nil)
#if DEBUG_FETCHATTRIBUTES
NSLog(@"using default paragraph style");
#endif
@ -964,8 +967,8 @@ static void loadGlyphAndCharacterCacheForLocation(NSTypesetter_concrete *self,
_alignment = [_currentParagraphStyle alignment];
_currentParagraphBidiLevel = 0;
if (_bidiLevels) {
NSRange paragraphRange =
[_string paragraphRangeForRange: NSMakeRange(characterIndex, 0)];
NSRange paragraphRange = [_string
paragraphRangeForRange: NSMakeRange(characterIndex, 0)];
_currentParagraphBidiLevel = _bidiLevels[paragraphRange.location];
}
if (_alignment == NSNaturalTextAlignment) {
@ -1209,8 +1212,9 @@ static void loadGlyphAndCharacterCacheForLocation(NSTypesetter_concrete *self,
if (_bidiLevelsCapacity < NSMaxRange(glyphRange)) {
NSInteger newBidiLevelsCapacity =
MAX(_bidiLevelsCapacity * 2, NSMaxRange(glyphRange));
_bidiLevels = (uint8_t *) NSZoneRealloc(
[self zone], _bidiLevels, newBidiLevelsCapacity * sizeof(uint8_t));
_bidiLevels = (uint8_t *) NSZoneRealloc([self zone], _bidiLevels,
newBidiLevelsCapacity *
sizeof(uint8_t));
// Anything new is left-to-right by default
bzero(_bidiLevels + _bidiLevelsCapacity,
newBidiLevelsCapacity - _bidiLevelsCapacity);

View File

@ -190,7 +190,8 @@
_affectedRange.location -= delta;
NSAttributedString *killedString = [string
attributedSubstringFromRange: NSMakeRange(
_affectedRange.location,
_affectedRange
.location,
delta)];
[_attributedString insertAttributedString: killedString
atIndex: 0];

Some files were not shown because too many files have changed in this diff Show More