The R Project SVN R-packages

Rev

Rev 7327 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 7327 Rev 7916
Line 95... Line 95...
95
		maxWidthOfGlyph = s.width;
95
		maxWidthOfGlyph = s.width;
96
		maxHeightOfGlyph = s.height;
96
		maxHeightOfGlyph = s.height;
97
		[self updateGutterThicknessConstants];
97
		[self updateGutterThicknessConstants];
98
		currentRuleThickness = 0.0f;
98
		currentRuleThickness = 0.0f;
99
 
99
 
100
		// Cache loop methods for speed
-
 
101
		lineNumberForCharacterIndexSel = @selector(lineNumberForCharacterIndex:);
-
 
102
		lineNumberForCharacterIndexIMP = [self methodForSelector:lineNumberForCharacterIndexSel];
-
 
103
		lineRangeForRangeSel = @selector(lineRangeForRange:);
-
 
104
		addObjectSel = @selector(addObject:);
-
 
105
		numberWithUnsignedIntegerSel = @selector(numberWithUnsignedInteger:);
-
 
106
		numberWithUnsignedIntegerIMP = [NSNumber methodForSelector:numberWithUnsignedIntegerSel];
-
 
107
		rangeOfLineSel = @selector(getLineStart:end:contentsEnd:forRange:);
-
 
108
 
-
 
109
		currentNumberOfLines = 1;
100
		currentNumberOfLines = 1;
110
		lineWrapping = NO;
101
		lineWrapping = NO;
111
		numberClass = [NSNumber class];
-
 
112
		
102
		
113
		normalBackgroundColor = [[NSColor colorWithCalibratedWhite: 0.95 alpha: 1.0] retain];
103
		normalBackgroundColor = [[NSColor colorWithCalibratedWhite: 0.95 alpha: 1.0] retain];
114
		foldedBackgroundColor = [[NSColor colorWithCalibratedWhite: 0.85 alpha: 1.0] retain];
104
		foldedBackgroundColor = [[NSColor colorWithCalibratedWhite: 0.85 alpha: 1.0] retain];
115
 
105
 
116
		top          = [[NSImage imageNamed:@"Folding Top"] retain];
106
		top          = [[NSImage imageNamed:@"Folding Top"] retain];
Line 290... Line 280...
290
 
280
 
291
	// Fudge the range a tad in case there is an extra new line at end.
281
	// Fudge the range a tad in case there is an extra new line at end.
292
	// It doesn't show up in the glyphs so would not be accounted for.
282
	// It doesn't show up in the glyphs so would not be accounted for.
293
	range.length++;
283
	range.length++;
294
 
284
 
295
	for (line = (NSUInteger)(*lineNumberForCharacterIndexIMP)(self, lineNumberForCharacterIndexSel, range.location); line < count; line++)
285
	for (line = [self lineNumberForCharacterIndex: range.location]; line < count; line++)
296
	{
286
	{
297
 
287
 
298
		rects = [layoutManager rectArrayForCharacterRange:NSMakeRange([NSArrayObjectAtIndex(lines, line) unsignedIntegerValue], 0)
288
		rects = [layoutManager rectArrayForCharacterRange:NSMakeRange([NSArrayObjectAtIndex(lines, line) unsignedIntegerValue], 0)
299
							 withinSelectedCharacterRange:nullRange
289
							 withinSelectedCharacterRange:nullRange
300
										  inTextContainer:container
290
										  inTextContainer:container
Line 394... Line 384...
394
	CGFloat y;
384
	CGFloat y;
395
	BOOL isHoveringRect = YES;
385
	BOOL isHoveringRect = YES;
396
	BOOL flipped = [self isFlipped];
386
	BOOL flipped = [self isFlipped];
397
 
387
 
398
 
388
 
399
	for (line = (NSUInteger)(*lineNumberForCharacterIndexIMP)(self, lineNumberForCharacterIndexSel, range.location); line < count; line++)
389
	for (line = [self lineNumberForCharacterIndex: range.location]; line < count; line++)
400
	{
390
	{
401
		index = [NSArrayObjectAtIndex(lines, line) unsignedIntegerValue];
391
		index = [NSArrayObjectAtIndex(lines, line) unsignedIntegerValue];
402
 
392
 
403
		if (NSLocationInRange(index, range))
393
		if (NSLocationInRange(index, range))
404
		{
394
		{
Line 785... Line 775...
785
 
775
 
786
	lineIndices = [[NSMutableArray alloc] initWithCapacity:currentNumberOfLines];
776
	lineIndices = [[NSMutableArray alloc] initWithCapacity:currentNumberOfLines];
787
 
777
 
788
	index = 0;
778
	index = 0;
789
 
779
 
790
	// Cache loop methods for speed
-
 
791
	IMP rangeOfLineIMP = [textString methodForSelector:rangeOfLineSel];
-
 
792
	addObjectIMP = [lineIndices methodForSelector:addObjectSel];
-
 
793
 
-
 
794
	do
780
	do
795
	{
781
	{
796
		(void)(*addObjectIMP)(lineIndices, addObjectSel, (*numberWithUnsignedIntegerIMP)(numberClass, numberWithUnsignedIntegerSel, index));
782
        [lineIndices addObject: [NSNumber numberWithUnsignedInteger: index]];
797
		(*rangeOfLineIMP)(textString, rangeOfLineSel, NULL, &index, NULL, NSMakeRange(index, 0));
783
        [textString getLineStart:NULL end:&index contentsEnd:NULL forRange:NSMakeRange(index, 0)];
798
	}
784
	}
799
	while (index < stringLength);
785
	while (index < stringLength);
800
 
786
 
801
	// Check if text ends with a new line.
787
	// Check if text ends with a new line.
802
	(*rangeOfLineIMP)(textString, rangeOfLineSel, NULL, &lineEnd, &contentEnd, NSMakeRange([[lineIndices lastObject] intValue], 0));
788
    [textString getLineStart:NULL end:&lineEnd contentsEnd:&contentEnd forRange:NSMakeRange([[lineIndices lastObject] intValue], 0)];
803
	if (contentEnd < lineEnd)
789
	if (contentEnd < lineEnd)
804
		(void)(*addObjectIMP)(lineIndices, addObjectSel, (*numberWithUnsignedIntegerIMP)(numberClass, numberWithUnsignedIntegerSel, index));
790
        [lineIndices addObject: [NSNumber numberWithUnsignedInteger: index]];
805
 
791
 
806
	NSUInteger lineCount = [lineIndices count];
792
	NSUInteger lineCount = [lineIndices count];
807
	if(lineCount < 100)
793
	if(lineCount < 100)
808
		newThickness = maxWidthOfGlyph2;
794
		newThickness = maxWidthOfGlyph2;
809
	else if(lineCount < 1000)
795
	else if(lineCount < 1000)