The R Project SVN R-packages

Rev

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

Rev 6246 Rev 6248
Line 121... Line 121...
121
	// we are a subclass of RTextView which has its own awake and we must call it
121
	// we are a subclass of RTextView which has its own awake and we must call it
122
	[super awakeFromNib];
122
	[super awakeFromNib];
123
 
123
 
124
	SLog(@"RScriptEditorTextView: awakeFromNib <%@>", self);
124
	SLog(@"RScriptEditorTextView: awakeFromNib <%@>", self);
125
 
125
 
-
 
126
	selfDelegate = (RDocumentWinCtrl*)[self delegate];
-
 
127
 
126
	breakSyntaxHighlighting = 0;
128
	breakSyntaxHighlighting = 0;
127
	_foldedSel = @selector(foldedAtIndex:);
129
	_foldedSel = @selector(foldedAtIndex:);
128
	
130
	
129
	// Bind scrollView programmatically - if done in RDocument.xib this'd lead to
131
	// Bind scrollView programmatically - if done in RDocument.xib this'd lead to
130
	// calling awakeFromNib twice
132
	// calling awakeFromNib twice
Line 177... Line 179...
177
	currentHighlight = -1;
179
	currentHighlight = -1;
178
 
180
 
179
	// For now replaced selectedTextBackgroundColor by redColor
181
	// For now replaced selectedTextBackgroundColor by redColor
180
	highlightColorAttr = [[NSDictionary alloc] initWithObjectsAndKeys:[NSColor redColor], NSBackgroundColorAttributeName, nil];
182
	highlightColorAttr = [[NSDictionary alloc] initWithObjectsAndKeys:[NSColor redColor], NSBackgroundColorAttributeName, nil];
181
 
183
 
182
	if([[self delegate] isRdDocument])
184
	if([selfDelegate isRdDocument])
183
		editorToolbar = [[RdEditorToolbar alloc] initWithEditor:[self delegate]];
185
		editorToolbar = [[RdEditorToolbar alloc] initWithEditor:selfDelegate];
184
	else
186
	else
185
		editorToolbar = [[REditorToolbar alloc] initWithEditor:[self delegate]];
187
		editorToolbar = [[REditorToolbar alloc] initWithEditor:selfDelegate];
186
 
188
 
187
	[self setAllowsDocumentBackgroundColorChange:YES];
189
	[self setAllowsDocumentBackgroundColorChange:YES];
188
	[self setContinuousSpellCheckingEnabled:NO];
190
	[self setContinuousSpellCheckingEnabled:NO];
189
 
191
 
190
	if(![Preferences flagForKey:enableLineWrappingKey withDefault: YES])
192
	if(![Preferences flagForKey:enableLineWrappingKey withDefault: YES])
Line 483... Line 485...
483
		[self setNeedsDisplay:YES];
485
		[self setNeedsDisplay:YES];
484
 
486
 
485
	} else if ([keyPath isEqualToString:prefShowArgsHints]) {
487
	} else if ([keyPath isEqualToString:prefShowArgsHints]) {
486
		argsHints = [[change objectForKey:NSKeyValueChangeNewKey] boolValue];
488
		argsHints = [[change objectForKey:NSKeyValueChangeNewKey] boolValue];
487
		if(!argsHints) {
489
		if(!argsHints) {
488
			[[self delegate] setStatusLineText:@""];
490
			[selfDelegate setStatusLineText:@""];
489
		} else {
491
		} else {
490
			[self currentFunctionHint];
492
			[self currentFunctionHint];
491
		}
493
		}
492
 
494
 
493
	} else if ([keyPath isEqualToString:highlightCurrentLine]) {
495
	} else if ([keyPath isEqualToString:highlightCurrentLine]) {
Line 719... Line 721...
719
{
721
{
720
 
722
 
721
	if(!syntaxHighlightingEnabled)
723
	if(!syntaxHighlightingEnabled)
722
		breakSyntaxHighlighting = 0;
724
		breakSyntaxHighlighting = 0;
723
 
725
 
724
	if (!syntaxHighlightingEnabled || [[self delegate] plain]) return;
726
	if (!syntaxHighlightingEnabled || [selfDelegate plain]) return;
725
 
727
 
726
	isSyntaxHighlighting = YES;
728
	isSyntaxHighlighting = YES;
727
 
729
 
728
	NSString *selfstr    = [theTextStorage string];
730
	NSString *selfstr    = [theTextStorage string];
729
	NSInteger strlength  = (NSInteger)[selfstr length];
731
	NSInteger strlength  = (NSInteger)[selfstr length];
Line 792... Line 794...
792
	// initialise flex
794
	// initialise flex
793
	yyuoffset = textRange.location; yyuleng = 0;
795
	yyuoffset = textRange.location; yyuleng = 0;
794
	
796
	
795
	BOOL hasFoldedItems = [theTextStorage hasFoldedItems];
797
	BOOL hasFoldedItems = [theTextStorage hasFoldedItems];
796
 
798
 
797
	if([[self delegate] isRdDocument]) {
799
	if([selfDelegate isRdDocument]) {
798
 
800
 
799
			rd_switch_to_buffer(rd_scan_string(NSStringUTF8String([selfstr substringWithRange:textRange])));
801
			rd_switch_to_buffer(rd_scan_string(NSStringUTF8String([selfstr substringWithRange:textRange])));
800
 
802
 
801
			// now loop through all the tokens
803
			// now loop through all the tokens
802
			while ((token = rdlex())) {
804
			while ((token = rdlex())) {
Line 1422... Line 1424...
1422
	NSInteger i = index;
1424
	NSInteger i = index;
1423
	NSInteger type;
1425
	NSInteger type;
1424
	NSString *selfStr = [self string];
1426
	NSString *selfStr = [self string];
1425
	unichar c;
1427
	unichar c;
1426
 
1428
 
1427
	BOOL isRd = [[self delegate] isRdDocument];
1429
	BOOL isRd = [selfDelegate isRdDocument];
1428
 
1430
 
1429
	unichar commentSign = (isRd) ? '%' : '#';
1431
	unichar commentSign = (isRd) ? '%' : '#';
1430
 
1432
 
1431
	// start checking from the end of a line
1433
	// start checking from the end of a line
1432
	while(i >= 0) {
1434
	while(i >= 0) {