The R Project SVN R-packages

Rev

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

Rev 5998 Rev 6001
Line 206... Line 206...
206
	c=[Preferences unarchivedObjectForKey:identifierSyntaxColorKey withDefault:nil];
206
	c=[Preferences unarchivedObjectForKey:identifierSyntaxColorKey withDefault:nil];
207
	if (c) shColorIdentifier = c;
207
	if (c) shColorIdentifier = c;
208
	else shColorIdentifier=[NSColor colorWithDeviceRed:0.0 green:0.0 blue:0.0 alpha:1.0];
208
	else shColorIdentifier=[NSColor colorWithDeviceRed:0.0 green:0.0 blue:0.0 alpha:1.0];
209
	[shColorIdentifier retain]; 
209
	[shColorIdentifier retain]; 
210
 
210
 
-
 
211
	c=[Preferences unarchivedObjectForKey:identifierSyntaxColorKey withDefault:nil];
-
 
212
	if (c) shColorIdentifier = c;
-
 
213
	else shColorIdentifier=[NSColor colorWithDeviceRed:0.0 green:0.0 blue:0.0 alpha:1.0];
-
 
214
	[shColorIdentifier retain]; 
-
 
215
 
-
 
216
 
-
 
217
	c=[Preferences unarchivedObjectForKey:commentRdSyntaxColorKey withDefault:nil];
-
 
218
	if (c) rdColorComment = c;
-
 
219
	else rdColorComment=[NSColor colorWithDeviceRed:0.1 green:0.55 blue:0.05 alpha:1.0];
-
 
220
	[rdColorComment retain];
-
 
221
 
-
 
222
	c=[Preferences unarchivedObjectForKey:sectionRdSyntaxColorKey withDefault:nil];
-
 
223
	if (c) rdColorSection = c;
-
 
224
	else rdColorSection=[NSColor colorWithDeviceRed:0.8 green:0.0353 blue:0.02 alpha:1.0];
-
 
225
	[rdColorSection retain];
-
 
226
 
-
 
227
	c=[Preferences unarchivedObjectForKey:macroArgRdSyntaxColorKey withDefault:nil];
-
 
228
	if (c) rdColorMacroArg = c;
-
 
229
	else rdColorMacroArg=[NSColor colorWithDeviceRed:0.0 green:0.0 blue:0.98 alpha:1.0];
-
 
230
	[rdColorMacroArg retain];
-
 
231
 
-
 
232
	c=[Preferences unarchivedObjectForKey:macroGenRdSyntaxColorKey withDefault:nil];
-
 
233
	if (c) rdColorMacroGen = c;
-
 
234
	else rdColorMacroGen=[NSColor colorWithDeviceRed:0.4 green:0.78 blue:0.98 alpha:1.0];
-
 
235
	[rdColorMacroGen retain]; 
-
 
236
 
-
 
237
	c=[Preferences unarchivedObjectForKey:directiveRdSyntaxColorKey withDefault:nil];
-
 
238
	if (c) rdColorDirective = c;
-
 
239
	else rdColorDirective=[NSColor colorWithDeviceRed:0.0 green:0.785 blue:0.0 alpha:1.0];
-
 
240
	[rdColorDirective retain]; 
-
 
241
 
-
 
242
	c=[Preferences unarchivedObjectForKey:normalRdSyntaxColorKey withDefault:nil];
-
 
243
	if (c) rdColorNormal = c;
-
 
244
	else rdColorNormal=[NSColor colorWithDeviceRed:0.0 green:0.0 blue:0.0 alpha:1.0];
-
 
245
	[rdColorNormal retain]; 
-
 
246
 
-
 
247
 
-
 
248
 
211
	c=[Preferences unarchivedObjectForKey:editorBackgroundColorKey withDefault:nil];
249
	c=[Preferences unarchivedObjectForKey:editorBackgroundColorKey withDefault:nil];
212
	if (c) shColorBackground = c;
250
	if (c) shColorBackground = c;
213
	else shColorBackground=[NSColor colorWithDeviceRed:1.0 green:1.0 blue:1.0 alpha:1.0];
251
	else shColorBackground=[NSColor colorWithDeviceRed:1.0 green:1.0 blue:1.0 alpha:1.0];
214
	[shColorBackground retain]; 
252
	[shColorBackground retain]; 
215
 
253
 
Line 228... Line 266...
228
	[prefs addObserver:self forKeyPath:normalSyntaxColorKey options:NSKeyValueObservingOptionNew context:NULL];
266
	[prefs addObserver:self forKeyPath:normalSyntaxColorKey options:NSKeyValueObservingOptionNew context:NULL];
229
	[prefs addObserver:self forKeyPath:stringSyntaxColorKey options:NSKeyValueObservingOptionNew context:NULL];
267
	[prefs addObserver:self forKeyPath:stringSyntaxColorKey options:NSKeyValueObservingOptionNew context:NULL];
230
	[prefs addObserver:self forKeyPath:numberSyntaxColorKey options:NSKeyValueObservingOptionNew context:NULL];
268
	[prefs addObserver:self forKeyPath:numberSyntaxColorKey options:NSKeyValueObservingOptionNew context:NULL];
231
	[prefs addObserver:self forKeyPath:keywordSyntaxColorKey options:NSKeyValueObservingOptionNew context:NULL];
269
	[prefs addObserver:self forKeyPath:keywordSyntaxColorKey options:NSKeyValueObservingOptionNew context:NULL];
232
	[prefs addObserver:self forKeyPath:commentSyntaxColorKey options:NSKeyValueObservingOptionNew context:NULL];
270
	[prefs addObserver:self forKeyPath:commentSyntaxColorKey options:NSKeyValueObservingOptionNew context:NULL];
-
 
271
	[prefs addObserver:self forKeyPath:normalRdSyntaxColorKey options:NSKeyValueObservingOptionNew context:NULL];
-
 
272
	[prefs addObserver:self forKeyPath:sectionRdSyntaxColorKey options:NSKeyValueObservingOptionNew context:NULL];
-
 
273
	[prefs addObserver:self forKeyPath:macroArgRdSyntaxColorKey options:NSKeyValueObservingOptionNew context:NULL];
-
 
274
	[prefs addObserver:self forKeyPath:macroGenRdSyntaxColorKey options:NSKeyValueObservingOptionNew context:NULL];
-
 
275
	[prefs addObserver:self forKeyPath:commentRdSyntaxColorKey options:NSKeyValueObservingOptionNew context:NULL];
-
 
276
	[prefs addObserver:self forKeyPath:directiveRdSyntaxColorKey options:NSKeyValueObservingOptionNew context:NULL];
233
	[prefs addObserver:self forKeyPath:editorBackgroundColorKey options:NSKeyValueObservingOptionNew context:NULL];
277
	[prefs addObserver:self forKeyPath:editorBackgroundColorKey options:NSKeyValueObservingOptionNew context:NULL];
234
	[prefs addObserver:self forKeyPath:editorCurrentLineBackgroundColorKey options:NSKeyValueObservingOptionNew context:NULL];
278
	[prefs addObserver:self forKeyPath:editorCurrentLineBackgroundColorKey options:NSKeyValueObservingOptionNew context:NULL];
235
	[prefs addObserver:self forKeyPath:identifierSyntaxColorKey options:NSKeyValueObservingOptionNew context:NULL];
279
	[prefs addObserver:self forKeyPath:identifierSyntaxColorKey options:NSKeyValueObservingOptionNew context:NULL];
236
	[prefs addObserver:self forKeyPath:editorCursorColorKey options:NSKeyValueObservingOptionNew context:NULL];
280
	[prefs addObserver:self forKeyPath:editorCursorColorKey options:NSKeyValueObservingOptionNew context:NULL];
237
	[prefs addObserver:self forKeyPath:showSyntaxColoringKey options:NSKeyValueObservingOptionNew context:NULL];
281
	[prefs addObserver:self forKeyPath:showSyntaxColoringKey options:NSKeyValueObservingOptionNew context:NULL];
Line 260... Line 304...
260
	if(shColorIdentifier) [shColorIdentifier release];
304
	if(shColorIdentifier) [shColorIdentifier release];
261
	if(shColorBackground) [shColorBackground release];
305
	if(shColorBackground) [shColorBackground release];
262
	if(shColorCurrentLine) [shColorCurrentLine release];
306
	if(shColorCurrentLine) [shColorCurrentLine release];
263
	if(shColorCursor) [shColorCursor release];
307
	if(shColorCursor) [shColorCursor release];
264
 
308
 
-
 
309
	if(rdColorNormal) [rdColorNormal release];
-
 
310
	if(rdColorSection) [rdColorSection release];
-
 
311
	if(rdColorMacroArg) [rdColorMacroArg release];
-
 
312
	if(rdColorMacroGen) [rdColorMacroGen release];
-
 
313
	if(rdColorComment) [rdColorComment release];
-
 
314
	if(rdColorDirective) [rdColorDirective release];
-
 
315
 
265
	if(theRulerView) [theRulerView release];
316
	if(theRulerView) [theRulerView release];
266
 
317
 
267
	[[NSNotificationCenter defaultCenter] removeObserver:self];
318
	[[NSNotificationCenter defaultCenter] removeObserver:self];
268
	[[Preferences sharedPreferences] removeDependent:self];
319
	[[Preferences sharedPreferences] removeDependent:self];
269
	if(prefs) [prefs release];
320
	if(prefs) [prefs release];
Line 639... Line 690...
639
			// now loop through all the tokens
690
			// now loop through all the tokens
640
			while ((token = rdlex())) {
691
			while ((token = rdlex())) {
641
		// NSLog(@"t %d", token);
692
		// NSLog(@"t %d", token);
642
				switch (token) {
693
				switch (token) {
643
					case RDPT_COMMENT:
694
					case RDPT_COMMENT:
644
					    tokenColor = shColorComment;
695
					    tokenColor = rdColorComment;
645
					    break;
696
					    break;
646
					case RDPT_SECTION:
697
					case RDPT_SECTION:
647
					    tokenColor = shColorNumber;
698
					    tokenColor = rdColorSection;
648
					    break;
699
					    break;
649
					case RDPT_MACRO_ARG:
700
					case RDPT_MACRO_ARG:
650
					    tokenColor = shColorKeyword;
701
					    tokenColor = rdColorMacroArg;
651
					    break;
702
					    break;
652
					case RDPT_MACRO_GEN:
703
					case RDPT_MACRO_GEN:
653
					    tokenColor = shColorIdentifier;
704
					    tokenColor = rdColorMacroGen;
654
					    break;
705
					    break;
655
					case RDPT_DIRECTIVE:
706
					case RDPT_DIRECTIVE:
656
					    tokenColor = shColorString;
707
					    tokenColor = rdColorDirective;
657
					    break;
708
					    break;
658
					case RDPT_OTHER:
709
					case RDPT_OTHER:
659
					    tokenColor = shColorNormal;
710
					    tokenColor = rdColorNormal;
660
					    break;
711
					    break;
661
					default:
712
					default:
662
					    tokenColor = shColorNormal;
713
					    tokenColor = rdColorNormal;
663
				}
714
				}
664
 
715
 
665
				tokenRange = NSMakeRange(yyuoffset, yyuleng);
716
				tokenRange = NSMakeRange(yyuoffset, yyuleng);
666
 
717
 
667
				// make sure that tokenRange is valid (and therefore within textRange)
718
				// make sure that tokenRange is valid (and therefore within textRange)