Oolite 1.91.0.7644-241112-7f5034b
Loading...
Searching...
No Matches
OOJavaScriptConsoleController(Private) Category Reference

Instance Methods

(NSColor *) - foregroundColorForKey:
 
(NSColor *) - backgroundColorForKey:
 
(void) - reloadAllSettings
 
(void) - setUpFonts
 
(void) - saveHistory
 

Detailed Description

Definition at line 54 of file OOJavaScriptConsoleController.m.

Method Documentation

◆ backgroundColorForKey:

- (NSColor *) backgroundColorForKey: (NSString *) key

Extends class OOJavaScriptConsoleController.

Definition at line 1 of file OOJavaScriptConsoleController.m.

376 :(NSString *)key
377{
378 NSColor *result = nil;
379 NSString *expandedKey = nil;
380
381 if (key == nil) key = @"general";
382
383 result = [_bgColors objectForKey:key];
384 if (result == nil)
385 {
386 // No cached colour; load colour description from config file
387 expandedKey = [key stringByAppendingString:@"-background-color"];
388 result = [NSColor colorWithOOColorDescription:[_debugger configurationValueForKey:expandedKey]];
389 if (result == nil)
390 {
391 expandedKey = [key stringByAppendingString:@"-background-colour"];
392 result = [NSColor colorWithOOColorDescription:[_debugger configurationValueForKey:expandedKey]];
393 }
394 if (result == nil && ![key isEqualToString:@"general"])
395 {
396 result = [self backgroundColorForKey:nil];
397 }
398 if (result == nil) result = [NSColor whiteColor];
399
400 // Store loaded colour in cache
401 if (result != nil)
402 {
403 if (_bgColors == nil) _bgColors = [[NSMutableDictionary alloc] init];
404 [_bgColors setObject:result forKey:key];
405 }
406 }
407
408 return result;
409}
return nil

◆ foregroundColorForKey:

- (NSColor *) foregroundColorForKey: (NSString *) key

Extends class OOJavaScriptConsoleController.

Definition at line 1 of file OOJavaScriptConsoleController.m.

340 :(NSString *)key
341{
342 NSColor *result = nil;
343 NSString *expandedKey = nil;
344
345 if (key == nil) key = @"general";
346
347 result = [_fgColors objectForKey:key];
348 if (result == nil)
349 {
350 // No cached colour; load colour description from config file
351 expandedKey = [key stringByAppendingString:@"-foreground-color"];
352 result = [NSColor colorWithOOColorDescription:[_debugger configurationValueForKey:expandedKey]];
353 if (result == nil)
354 {
355 expandedKey = [key stringByAppendingString:@"-foreground-colour"];
356 result = [NSColor colorWithOOColorDescription:[_debugger configurationValueForKey:expandedKey]];
357 }
358 if (result == nil && ![key isEqualToString:@"general"])
359 {
360 result = [self foregroundColorForKey:nil];
361 }
362 if (result == nil) result = [NSColor blackColor];
363
364 // Store loaded colour in cache
365 if (result != nil)
366 {
367 if (_fgColors == nil) _fgColors = [[NSMutableDictionary alloc] init];
368 [_fgColors setObject:result forKey:key];
369 }
370 }
371
372 return result;
373}

◆ reloadAllSettings

- (void) reloadAllSettings

Extends class OOJavaScriptConsoleController.

Definition at line 1 of file OOJavaScriptConsoleController.m.

413{
414 [_fgColors removeAllObjects];
415 [_bgColors removeAllObjects];
416 [consoleTextView setBackgroundColor:[self backgroundColorForKey:nil]];
417 [self setUpFonts];
418}

◆ saveHistory

- (void) saveHistory

Extends class OOJavaScriptConsoleController.

Definition at line 1 of file OOJavaScriptConsoleController.m.

449{
450 NSArray *history = nil;
451
452 history = [inputHistoryManager history];
453 if (history != nil)
454 {
455 [[NSUserDefaults standardUserDefaults] setObject:history forKey:@"debug-js-console-scrollback"];
456 [[NSUserDefaults standardUserDefaults] synchronize];
457 }
458}

◆ setUpFonts

- (void) setUpFonts

Extends class OOJavaScriptConsoleController.

Definition at line 1 of file OOJavaScriptConsoleController.m.

422{
423 NSString *fontFace = nil;
424 NSInteger fontSize;
425
426 DESTROY(_baseFont);
427 DESTROY(_boldFont);
428
429 // Set font.
430 fontFace = [_debugger configurationValueForKey:@"font-face"
431 class:[NSString class]
432 defaultValue:@"Courier"];
433 fontSize = (NSInteger)[_debugger configurationIntValueForKey:@"font-size"
434 defaultValue:12];
435
436 _baseFont = [NSFont fontWithName:fontFace size:fontSize];
437 if (_baseFont == nil) _baseFont = [NSFont userFixedPitchFontOfSize:0];
438 [_baseFont retain];
439
440 // Get bold variant of font.
441 _boldFont = [[NSFontManager sharedFontManager] convertFont:_baseFont
442 toHaveTrait:NSBoldFontMask];
443 if (_boldFont == nil) _boldFont = _baseFont;
444 [_boldFont retain];
445}
#define DESTROY(x)
Definition OOCocoa.h:77

The documentation for this category was generated from the following file: