The R Project SVN R-packages

Rev

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

Rev 6260 Rev 6263
Line 505... Line 505...
505
}
505
}
506
 
506
 
507
- (void)updateLineWrappingMode
507
- (void)updateLineWrappingMode
508
{
508
{
509
 
509
 
510
	// lineWrappingEnabled = [Preferences flagForKey:enableLineWrappingKey withDefault: YES];
-
 
511
	// 
-
 
512
	// NSSize contentSize = [scrollView contentSize];
-
 
513
	// NSTextContainer *textContainer = [self textContainer];
-
 
514
	// 
-
 
515
	// // [self setMinSize:contentSize];
-
 
516
	// 
-
 
517
	// if (lineWrappingEnabled) {
-
 
518
	// 	[scrollView setHasHorizontalScroller:YES];
-
 
519
	// 	[textContainer setContainerSize:NSMakeSize(contentSize.width, CGFLOAT_MAX)];
-
 
520
	// 	[textContainer setWidthTracksTextView:YES];
-
 
521
	// 	[self setHorizontallyResizable:NO];
-
 
522
	// 	[(NoodleLineNumberView*)[[self enclosingScrollView] verticalRulerView] setLineWrappingMode:YES];
-
 
523
	// } else {
-
 
524
	// 	[scrollView setHasHorizontalScroller:YES];
-
 
525
	// 	[textContainer setContainerSize:NSMakeSize(CGFLOAT_MAX, CGFLOAT_MAX)];
-
 
526
	// 	[textContainer setWidthTracksTextView:NO];
-
 
527
	// 	[self setHorizontallyResizable:YES];
-
 
528
	// 	[(NoodleLineNumberView*)[[self enclosingScrollView] verticalRulerView] setLineWrappingMode:NO];
-
 
529
	// }
-
 
530
	// 
-
 
531
	// [[[self enclosingScrollView] verticalRulerView] performSelector:@selector(refresh) withObject:nil afterDelay:0.0f];
-
 
532
 
-
 
533
	NSSize layoutSize;
510
	NSSize layoutSize;
534
	
511
	
535
	lineWrappingEnabled = [Preferences flagForKey:enableLineWrappingKey withDefault: YES];
512
	lineWrappingEnabled = [Preferences flagForKey:enableLineWrappingKey withDefault: YES];
-
 
513
 
536
	[self setHorizontallyResizable:YES];
514
	[self setHorizontallyResizable:YES];
537
	if (!lineWrappingEnabled) {
515
	if (!lineWrappingEnabled) {
-
 
516
		NSRange curRange = [self selectedRange];
538
		layoutSize = NSMakeSize(10e6,10e6);
517
		layoutSize = NSMakeSize(10e6,10e6);
539
		[scrollView setHasHorizontalScroller:YES];
518
		[scrollView setHasHorizontalScroller:YES];
540
		[self setMaxSize:layoutSize];
519
		[self setMaxSize:layoutSize];
541
		[[self textContainer] setContainerSize:layoutSize];
520
		[[self textContainer] setContainerSize:layoutSize];
542
		[[self textContainer] setWidthTracksTextView:NO];
521
		[[self textContainer] setWidthTracksTextView:NO];
-
 
522
		[self scrollRangeToVisible:NSMakeRange(curRange.location, 0)];
543
	} else {
523
	} else {
544
		[scrollView setHasHorizontalScroller:NO];
524
		[scrollView setHasHorizontalScroller:NO];
545
		layoutSize = [self maxSize];
525
		layoutSize = [self maxSize];
546
		[self setMaxSize:layoutSize];
526
		[self setMaxSize:layoutSize];
547
		[[self textContainer] setContainerSize:layoutSize];
527
		[[self textContainer] setContainerSize:layoutSize];
548
		[[self textContainer] setWidthTracksTextView:YES];
528
		[[self textContainer] setWidthTracksTextView:YES];
549
		// Enforce view to be re-layouted correctly
529
		// Enforce view to be re-layouted correctly
-
 
530
		// by re-inserting the the current text buffer
550
		[[self undoManager] disableUndoRegistration];
531
		[[self undoManager] disableUndoRegistration];
-
 
532
		NSRange curRange = [self selectedRange];
-
 
533
		NSString *t = [[NSString alloc] initWithString:[self string]];
551
		[self selectAll:nil];
534
		[self selectAll:nil];
552
		[self cut:nil];
535
		[self insertText:@""];
-
 
536
		usleep(1000);
553
		[self paste:nil];
537
		[self insertText:t];
-
 
538
		[t release];
-
 
539
		[self setSelectedRange:curRange];
-
 
540
		[self scrollRangeToVisible:NSMakeRange(curRange.location, 0)];
554
		[[self undoManager] enableUndoRegistration];
541
		[[self undoManager] enableUndoRegistration];
555
	}
542
	}
556
	[[self textContainer] setHeightTracksTextView:NO];
543
	[[self textContainer] setHeightTracksTextView:NO];
557
 
544
 
558
 
-
 
559
}
545
}
560
 
546
 
561
- (void)drawRect:(NSRect)rect
547
- (void)drawRect:(NSRect)rect
562
{
548
{
563
	// Draw background only for screen display but not while printing
549
	// Draw background only for screen display but not while printing