54@interface OOJavaScriptConsoleController (Private)
60- (NSColor *)foregroundColorForKey:(NSString *)key;
61- (NSColor *)backgroundColorForKey:(NSString *)key;
72@interface NSLayoutManager (Leopard)
73- (void)setAllowsNonContiguousLayout:(BOOL)flag;
103 [
splitView setAutoresizingMask:NSViewHeightSizable | NSViewWidthSizable];
116 NSString *thumbPath = [[
NSBundle bundleForClass:[
self class]] pathForResource:@"SplitViewThumb" ofType:@"png"];
121 if ([[
consoleTextView layoutManager] respondsToSelector:
@selector(setAllowsNonContiguousLayout:)])
123 [[consoleTextView layoutManager] setAllowsNonContiguousLayout:YES];
127 [verticalScroller setFloatValue:1.0];
134 [[
NSNotificationCenter defaultCenter] addObserver:
self selector:@selector(applicationWillTerminate:) name:NSApplicationWillTerminateNotification object:nil];
138- (void)applicationWillTerminate:(NSNotification *)notification
138- (void)applicationWillTerminate:(NSNotification *)notification {
…}
152- (IBAction)showConsole:sender
152- (IBAction)showConsole:sender {
…}
158- (IBAction)toggleShowOnWarning:sender
158- (IBAction)toggleShowOnWarning:sender {
…}
164- (IBAction)toggleShowOnError:sender
164- (IBAction)toggleShowOnError:sender {
…}
170- (IBAction)toggleShowOnLog:sender
170- (IBAction)toggleShowOnLog:sender {
…}
176- (IBAction)consolePerformCommand:sender
178 NSString *command =
nil;
181 command = [consoleInputField stringValue];
182 [consoleInputField setStringValue:@""];
176- (IBAction)consolePerformCommand:sender {
…}
192- (void)appendMessage:(NSString *)string
193 colorKey:(NSString *)colorKey
194 emphasisRange:(NSRange)emphasisRange
198 NSMutableAttributedString *mutableStr =
nil;
199 NSColor *fgColor =
nil,
201 volatile NSRange fullRange;
202 NSTextStorage *textStorage =
nil;
209 fullRange = (NSRange){ 0, [
mutableStr length] };
213 if ([fgColor alphaComponent] == 0.0)
return;
214 [
mutableStr addAttribute:NSForegroundColorAttributeName
222 [
mutableStr addAttribute:NSBackgroundColorAttributeName
227 if (emphasisRange.length != 0)
231 range:emphasisRange];
234 doScroll = [verticalScroller floatValue] > 0.980f;
236 textStorage = [consoleTextView textStorage];
241 [
textStorage deleteCharactersInRange:(NSRange){
length - kConsoleTrimToSize, kConsoleTrimToSize }];
246 if (doScroll) [consoleTextView scrollRangeToVisible:(NSRange){
length, 0 }];
192- (void)appendMessage:(NSString *)string {
…}
254 NSTextStorage *textStorage =
nil;
256 textStorage = [consoleTextView textStorage];
268- (void)noteConfigurationChanged:(NSString *)key
270 if ([key hasSuffix:
@"-foreground-color"] || [key hasSuffix:
@"-foreground-colour"])
273 [_fgColors removeAllObjects];
275 else if ([key hasSuffix:
@"-background-color"] || [key hasSuffix:
@"-background-colour"])
278 [_bgColors removeAllObjects];
281 else if ([key hasPrefix:
@"font-"])
268- (void)noteConfigurationChanged:(NSString *)key {
…}
297- (BOOL)validateMenuItem:(NSMenuItem *)menuItem
305 if (action ==
@selector(toggleShowOnWarning:))
310 if (action ==
@selector(toggleShowOnError:))
315 if (action ==
@selector(toggleShowOnLog:))
320 if (action ==
@selector(showConsole:))
325 return [
self respondsToSelector:action];
297- (BOOL)validateMenuItem:(NSMenuItem *)menuItem {
…}
330- (void)splitView:(
RBSplitView*)sender wasResizedFrom:(
float)oldDimension to:(
float)newDimension
330- (void)splitView:(
RBSplitView*)sender wasResizedFrom:(
float)oldDimension to:(
float)newDimension {
…}
338@implementation OOJavaScriptConsoleController (Private)
340- (NSColor *)foregroundColorForKey:(NSString *)key
342 NSColor *result =
nil;
343 NSString *expandedKey =
nil;
345 if (key ==
nil) key =
@"general";
351 expandedKey = [
key stringByAppendingString:@"-foreground-color"];
352 result = [
NSColor colorWithOOColorDescription:[
_debugger configurationValueForKey:expandedKey]];
355 expandedKey = [
key stringByAppendingString:@"-foreground-colour"];
356 result = [
NSColor colorWithOOColorDescription:[
_debugger configurationValueForKey:expandedKey]];
358 if (result ==
nil && ![key isEqualToString:
@"general"])
362 if (result ==
nil) result = [
NSColor blackColor];
340- (NSColor *)foregroundColorForKey:(NSString *)key {
…}
376- (NSColor *)backgroundColorForKey:(NSString *)key
378 NSColor *result =
nil;
379 NSString *expandedKey =
nil;
381 if (key ==
nil) key =
@"general";
387 expandedKey = [
key stringByAppendingString:@"-background-color"];
388 result = [
NSColor colorWithOOColorDescription:[
_debugger configurationValueForKey:expandedKey]];
391 expandedKey = [
key stringByAppendingString:@"-background-colour"];
392 result = [
NSColor colorWithOOColorDescription:[
_debugger configurationValueForKey:expandedKey]];
394 if (result ==
nil && ![key isEqualToString:
@"general"])
398 if (result ==
nil) result = [
NSColor whiteColor];
376- (NSColor *)backgroundColorForKey:(NSString *)key {
…}
423 NSString *fontFace =
nil;
430 fontFace = [
_debugger configurationValueForKey:@"font-face"
432 defaultValue:@"Courier"];
433 fontSize = (NSInteger)[_debugger configurationIntValueForKey:
@"font-size"
436 _baseFont = [
NSFont fontWithName:fontFace size:fontSize];
437 if (_baseFont ==
nil) _baseFont = [
NSFont userFixedPitchFontOfSize:0];
441 _boldFont = [[
NSFontManager sharedFontManager] convertFont:_baseFont
442 toHaveTrait:NSBoldFontMask];
443 if (_boldFont ==
nil) _boldFont = _baseFont;
450 NSArray *history =
nil;
455 [[
NSUserDefaults standardUserDefaults] setObject:history forKey:@"debug-js-console-scrollback"];
#define OOJS_PROFILE_EXIT_VOID
#define OOJS_PROFILE_ENTER
OODebugMonitor * sharedDebugMonitor()
RBSplitSubview * inputSplitSubview
NSColor * backgroundColorForKey:(NSString *key)
NSColor * foregroundColorForKey:(NSString *key)
OOMacDebugger * _debugger
IBOutlet NSTextView * consoleTextView
void performConsoleCommand:(NSString *command)
BOOL configurationBoolValueForKey:(NSString *key)
void addToHistory:(NSString *string)
void setHistory:(NSArray *history)
void setDimension:(CGFloat value)
void setMinDimension:andMaxDimension:(CGFloat newMinDimension,[andMaxDimension] CGFloat newMaxDimension)
RBSplitSubview * subviewAtPosition:(NSUInteger position)
void adjustSubviewsExcepting:(RBSplitSubview *excepting)
void addSubview:atPosition:(NSView *aView,[atPosition] NSUInteger position)
void setDelegate:(id anObject)
void setDivider:(NSImage *image)
void setVertical:(BOOL flag)