| Line 211... |
Line 211... |
| 211 |
c=[Preferences unarchivedObjectForKey:identifierSyntaxColorKey withDefault:nil];
|
211 |
c=[Preferences unarchivedObjectForKey:identifierSyntaxColorKey withDefault:nil];
|
| 212 |
if (c) shColorIdentifier = c;
|
212 |
if (c) shColorIdentifier = c;
|
| 213 |
else shColorIdentifier=[NSColor colorWithDeviceRed:0.0 green:0.0 blue:0.0 alpha:1.0];
|
213 |
else shColorIdentifier=[NSColor colorWithDeviceRed:0.0 green:0.0 blue:0.0 alpha:1.0];
|
| 214 |
[shColorIdentifier retain];
|
214 |
[shColorIdentifier retain];
|
| 215 |
|
215 |
|
| - |
|
216 |
c=[Preferences unarchivedObjectForKey:editorSelectionBackgroundColorKey withDefault:nil];
|
| - |
|
217 |
if (!c) c=[NSColor selectedControlTextColor];
|
| - |
|
218 |
NSMutableDictionary *attr = [NSMutableDictionary dictionary];
|
| - |
|
219 |
[attr setDictionary:[self selectedTextAttributes]];
|
| - |
|
220 |
[attr setObject:c forKey:NSForegroundColorAttributeName];
|
| - |
|
221 |
[self setSelectedTextAttributes:attr];
|
| - |
|
222 |
|
| 216 |
// Rd stuff
|
223 |
// Rd stuff
|
| 217 |
// c=[Preferences unarchivedObjectForKey:sectionRdSyntaxColorKey withDefault:nil];
|
224 |
// c=[Preferences unarchivedObjectForKey:sectionRdSyntaxColorKey withDefault:nil];
|
| 218 |
// if (c) rdColorSection = c;
|
225 |
// if (c) rdColorSection = c;
|
| 219 |
// else rdColorSection=[NSColor colorWithDeviceRed:0.8 green:0.0353 blue:0.02 alpha:1.0];
|
226 |
// else rdColorSection=[NSColor colorWithDeviceRed:0.8 green:0.0353 blue:0.02 alpha:1.0];
|
| 220 |
// [rdColorSection retain];
|
227 |
// [rdColorSection retain];
|
| Line 282... |
Line 289... |
| 282 |
[prefs addObserver:self forKeyPath:enableLineWrappingKey options:NSKeyValueObservingOptionNew context:NULL];
|
289 |
[prefs addObserver:self forKeyPath:enableLineWrappingKey options:NSKeyValueObservingOptionNew context:NULL];
|
| 283 |
[prefs addObserver:self forKeyPath:RScriptEditorDefaultFont options:NSKeyValueObservingOptionNew context:NULL];
|
290 |
[prefs addObserver:self forKeyPath:RScriptEditorDefaultFont options:NSKeyValueObservingOptionNew context:NULL];
|
| 284 |
[prefs addObserver:self forKeyPath:HighlightIntervalKey options:NSKeyValueObservingOptionNew context:NULL];
|
291 |
[prefs addObserver:self forKeyPath:HighlightIntervalKey options:NSKeyValueObservingOptionNew context:NULL];
|
| 285 |
[prefs addObserver:self forKeyPath:highlightCurrentLine options:NSKeyValueObservingOptionNew context:NULL];
|
292 |
[prefs addObserver:self forKeyPath:highlightCurrentLine options:NSKeyValueObservingOptionNew context:NULL];
|
| 286 |
[prefs addObserver:self forKeyPath:showLineNumbersKey options:NSKeyValueObservingOptionNew context:NULL];
|
293 |
[prefs addObserver:self forKeyPath:showLineNumbersKey options:NSKeyValueObservingOptionNew context:NULL];
|
| - |
|
294 |
[prefs addObserver:self forKeyPath:editorSelectionBackgroundColorKey options:NSKeyValueObservingOptionNew context:NULL];
|
| 287 |
|
295 |
|
| 288 |
[self setTextColor:shColorNormal];
|
296 |
[self setTextColor:shColorNormal];
|
| 289 |
[self setInsertionPointColor:shColorCursor];
|
297 |
[self setInsertionPointColor:shColorCursor];
|
| 290 |
|
298 |
|
| 291 |
theTextStorage = [self textStorage];
|
299 |
theTextStorage = [self textStorage];
|
| Line 397... |
Line 405... |
| 397 |
[self setNeedsDisplayInRect:[self bounds]];
|
405 |
[self setNeedsDisplayInRect:[self bounds]];
|
| 398 |
} else if ([keyPath isEqualToString:editorCurrentLineBackgroundColorKey]) {
|
406 |
} else if ([keyPath isEqualToString:editorCurrentLineBackgroundColorKey]) {
|
| 399 |
if(shColorCurrentLine) [shColorCurrentLine release];
|
407 |
if(shColorCurrentLine) [shColorCurrentLine release];
|
| 400 |
shColorCurrentLine = [[NSUnarchiver unarchiveObjectWithData:[change objectForKey:NSKeyValueChangeNewKey]] retain];
|
408 |
shColorCurrentLine = [[NSUnarchiver unarchiveObjectWithData:[change objectForKey:NSKeyValueChangeNewKey]] retain];
|
| 401 |
[self setNeedsDisplayInRect:[self bounds]];
|
409 |
[self setNeedsDisplayInRect:[self bounds]];
|
| - |
|
410 |
} else if ([keyPath isEqualToString:editorSelectionBackgroundColorKey]) {
|
| - |
|
411 |
NSColor *c = [[NSUnarchiver unarchiveObjectWithData:[change objectForKey:NSKeyValueChangeNewKey]] retain];
|
| - |
|
412 |
NSMutableDictionary *attr = [NSMutableDictionary dictionary];
|
| - |
|
413 |
[attr setDictionary:[self selectedTextAttributes]];
|
| - |
|
414 |
[attr setObject:c forKey:NSForegroundColorAttributeName];
|
| - |
|
415 |
[self setSelectedTextAttributes:attr];
|
| - |
|
416 |
[self setNeedsDisplayInRect:[self bounds]];
|
| 402 |
|
417 |
|
| 403 |
} else if ([keyPath isEqualToString:showSyntaxColoringKey]) {
|
418 |
} else if ([keyPath isEqualToString:showSyntaxColoringKey]) {
|
| 404 |
syntaxHighlightingEnabled = [[change objectForKey:NSKeyValueChangeNewKey] boolValue];
|
419 |
syntaxHighlightingEnabled = [[change objectForKey:NSKeyValueChangeNewKey] boolValue];
|
| 405 |
if(syntaxHighlightingEnabled) {
|
420 |
if(syntaxHighlightingEnabled) {
|
| 406 |
[self performSelector:@selector(doSyntaxHighlighting) withObject:nil afterDelay:0.1];
|
421 |
[self performSelector:@selector(doSyntaxHighlighting) withObject:nil afterDelay:0.1];
|
| Line 531... |
Line 546... |
| 531 |
// Cancel calling doSyntaxHighlighting
|
546 |
// Cancel calling doSyntaxHighlighting
|
| 532 |
[NSObject cancelPreviousPerformRequestsWithTarget:self
|
547 |
[NSObject cancelPreviousPerformRequestsWithTarget:self
|
| 533 |
selector:@selector(doSyntaxHighlighting)
|
548 |
selector:@selector(doSyntaxHighlighting)
|
| 534 |
object:nil];
|
549 |
object:nil];
|
| 535 |
|
550 |
|
| 536 |
[self performSelector:@selector(doSyntaxHighlighting) withObject:nil afterDelay:0.0f];
|
551 |
[self performSelector:@selector(doSyntaxHighlighting) withObject:nil afterDelay:0.001f];
|
| 537 |
|
552 |
|
| 538 |
// Cancel setting undo break point
|
553 |
// Cancel setting undo break point
|
| 539 |
[NSObject cancelPreviousPerformRequestsWithTarget:self
|
554 |
[NSObject cancelPreviousPerformRequestsWithTarget:self
|
| 540 |
selector:@selector(breakUndoCoalescing)
|
555 |
selector:@selector(breakUndoCoalescing)
|
| 541 |
object:nil];
|
556 |
object:nil];
|
| Line 696... |
Line 711... |
| 696 |
|
711 |
|
| 697 |
size_t tokenEnd, token;
|
712 |
size_t tokenEnd, token;
|
| 698 |
NSRange tokenRange;
|
713 |
NSRange tokenRange;
|
| 699 |
|
714 |
|
| 700 |
// first remove the old colors and kQuote
|
715 |
// first remove the old colors and kQuote
|
| 701 |
[theTextStorage removeAttribute:NSForegroundColorAttributeName range:textRange];
|
716 |
// [theTextStorage removeAttribute:NSForegroundColorAttributeName range:textRange];
|
| 702 |
// mainly for suppressing auto-pairing in
|
717 |
// mainly for suppressing auto-pairing in
|
| 703 |
[theTextStorage removeAttribute:kLEXToken range:textRange];
|
718 |
[theTextStorage removeAttribute:kLEXToken range:textRange];
|
| 704 |
|
719 |
|
| 705 |
// initialise flex
|
720 |
// initialise flex
|
| 706 |
yyuoffset = textRange.location; yyuleng = 0;
|
721 |
yyuoffset = textRange.location; yyuleng = 0;
|