From d5ee07fe1bad9c1ed220d7577abad406d85ffbad Mon Sep 17 00:00:00 2001 From: Randall Luecke Date: Wed, 2 Jun 2010 20:43:09 -0500 Subject: [PATCH 1/8] CPControl should not be allowed to performClick: if it's disabled. --- AppKit/CPControl.j | 3 +++ 1 file changed, 3 insertions(+) diff --git a/AppKit/CPControl.j b/AppKit/CPControl.j index 2f03926c1..7de6719c4 100644 --- a/AppKit/CPControl.j +++ b/AppKit/CPControl.j @@ -332,6 +332,9 @@ var CPControlBlackColor = [CPColor blackColor]; - (void)performClick:(id)sender { + if (![self isEnabled]) + return; + [self highlight:YES]; [self setState:[self nextState]]; [self sendAction:[self action] to:[self target]]; From 57dc0460a3f26a732bb72a620d8691aa7ca56dd1 Mon Sep 17 00:00:00 2001 From: Randall Luecke Date: Thu, 3 Jun 2010 21:09:18 -0500 Subject: [PATCH 2/8] Fixed theme state for CPBrowser. --- AppKit/CPBrowser.j | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/AppKit/CPBrowser.j b/AppKit/CPBrowser.j index 77e3700f8..19bfc97fb 100644 --- a/AppKit/CPBrowser.j +++ b/AppKit/CPBrowser.j @@ -96,7 +96,7 @@ _prototypeView = [[CPTextField alloc] initWithFrame:CGRectMakeZero()]; [_prototypeView setVerticalAlignment:CPCenterVerticalTextAlignment]; - [_prototypeView setValue:[CPColor whiteColor] forThemeAttribute:"text-color" inState:CPThemeStateSelected]; + [_prototypeView setValue:[CPColor whiteColor] forThemeAttribute:"text-color" inState:CPThemeStateSelectedDataView]; [_prototypeView setLineBreakMode:CPLineBreakByTruncatingTail]; _horizontalScrollView = [[CPScrollView alloc] initWithFrame:[self bounds]]; @@ -923,7 +923,7 @@ var _CPBrowserResizeControlBackgroundImage = nil; positioned:CPWindowAbove relativeToEphemeralSubviewNamed:nil]; - var isHighlighted = [self themeState] & CPThemeStateSelected; + var isHighlighted = [self themeState] & CPThemeStateSelectedDataView; [imageView setImage: _isLeaf ? (isHighlighted ? _highlightedBranchImage : _branchImage) : nil]; [imageView setImageScaling:CPScaleNone]; } From ab3d648244ac59654cb3a21fa68ded9be85e1ee8 Mon Sep 17 00:00:00 2001 From: Francisco Ryan Tolmasky I Date: Fri, 4 Jun 2010 19:21:43 -0700 Subject: [PATCH 3/8] Fix for browser:acceptDrop:atRow:column:dropOperation: not being called if browser:validateDrop:proposedRow:column:dropOperation: is implemented. Reviewed by me. --- AppKit/CPBrowser.j | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/AppKit/CPBrowser.j b/AppKit/CPBrowser.j index 19bfc97fb..6387738e9 100644 --- a/AppKit/CPBrowser.j +++ b/AppKit/CPBrowser.j @@ -860,7 +860,7 @@ var _CPBrowserResizeControlBackgroundImage = nil; - (CPDragOperation)tableView:(CPTableView)aTableView validateDrop:(id)info proposedRow:(int)row proposedDropOperation:(CPTableViewDropOperation)operation { if ([_delegate respondsToSelector:@selector(browser:validateDrop:proposedRow:column:dropOperation:)]) - [_delegate browser:_browser validateDrop:info proposedRow:row column:_index dropOperation:operation]; + return [_delegate browser:_browser validateDrop:info proposedRow:row column:_index dropOperation:operation]; else return CPDragOperationNone; } From c8759babaeef6117637cf6bbe1608e90095c1b42 Mon Sep 17 00:00:00 2001 From: Saikat Chakrabarti Date: Thu, 3 Jun 2010 02:05:45 -0700 Subject: [PATCH 4/8] Adding checks for existence of DOM when calling CPPlatformWindow+DOM-only methods Conflicts: AppKit/CPWindow/CPWindow.j --- AppKit/CPApplication.j | 4 ++++ AppKit/CPWindow/CPWindow.j | 8 ++++++++ AppKit/Platform/CPPlatformWindow.j | 4 +++- 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/AppKit/CPApplication.j b/AppKit/CPApplication.j index e23aab878..41d8d6dee 100644 --- a/AppKit/CPApplication.j +++ b/AppKit/CPApplication.j @@ -615,7 +615,11 @@ CPRunContinuesResponse = -1002; */ - (CPArray)orderedWindows { +#if PLATFORM(DOM) return CPWindowObjectList(); +#else + return []; +#endif } - (void)hide:(id)aSender diff --git a/AppKit/CPWindow/CPWindow.j b/AppKit/CPWindow/CPWindow.j index f06953ab1..a28ecf2a6 100644 --- a/AppKit/CPWindow/CPWindow.j +++ b/AppKit/CPWindow/CPWindow.j @@ -742,8 +742,10 @@ CPTexturedBackgroundWindowMask */ - (void)orderFront:(id)aSender { +#if PLATFORM(DOM) [_platformWindow orderFront:self]; [_platformWindow order:CPWindowAbove window:self relativeTo:nil]; +#endif if (_firstResponder === self || !_firstResponder) [self makeFirstResponder:[self initialFirstResponder]]; @@ -771,13 +773,17 @@ CPTexturedBackgroundWindowMask */ - (void)orderOut:(id)aSender { +#if PLATFORM(DOM) if ([self _sharesChromeWithPlatformWindow]) [_platformWindow orderOut:self]; +#endif if ([_delegate respondsToSelector:@selector(windowWillClose:)]) [_delegate windowWillClose:self]; +#if PLATFORM(DOM) [_platformWindow order:CPWindowOut window:self relativeTo:nil]; +#endif [self _updateMainAndKeyWindows]; } @@ -789,7 +795,9 @@ CPTexturedBackgroundWindowMask */ - (void)orderWindow:(CPWindowOrderingMode)aPlace relativeTo:(int)otherWindowNumber { +#if PLATFORM(DOM) [_platformWindow order:aPlace window:self relativeTo:CPApp._windows[otherWindowNumber]]; +#endif } /*! diff --git a/AppKit/Platform/CPPlatformWindow.j b/AppKit/Platform/CPPlatformWindow.j index a0f46cc52..baaab6396 100644 --- a/AppKit/Platform/CPPlatformWindow.j +++ b/AppKit/Platform/CPPlatformWindow.j @@ -160,7 +160,9 @@ var PrimaryPlatformWindow = NULL; _contentRect = _CGRectMakeCopy(aRect); - [self updateNativeContentRect]; +#if PLATFORM(DOM) + [self updateNativeContentRect]; +#endif } - (void)updateFromNativeContentRect From 935f1084d6ca437266684c518d2068f872344e33 Mon Sep 17 00:00:00 2001 From: Stephen Ierodiaconou Date: Tue, 1 Jun 2010 18:59:41 +0300 Subject: [PATCH 5/8] Javascript Date object returns month between 0 and 11 --- Objective-J/CPLog.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Objective-J/CPLog.js b/Objective-J/CPLog.js index b4d69c84f..473ccfd88 100644 --- a/Objective-J/CPLog.js +++ b/Objective-J/CPLog.js @@ -105,7 +105,7 @@ var _CPFormatLogMessage = function(aString, aLevel, aTitle) if (typeof exports.sprintf == "function") return exports.sprintf("%4d-%02d-%02d %02d:%02d:%02d.%03d %s%s: %s", - now.getFullYear(), now.getMonth(), now.getDate(), + now.getFullYear(), now.getMonth() + 1, now.getDate(), now.getHours(), now.getMinutes(), now.getSeconds(), now.getMilliseconds(), aTitle, aLevel, aString); else From 0c9b4da4730a900f1a7e37a80d9cb880829c201a Mon Sep 17 00:00:00 2001 From: Ross Boucher Date: Sun, 6 Jun 2010 12:57:45 -0700 Subject: [PATCH 6/8] Don't supress exceptions in the backtrace decorator, add an exception supressing decarator. --- Objective-J/Debug.js | 23 ++++++++++++++++- .../Templates/Application/index-debug.html | 3 +++ .../Templates/NibApplication/index-debug.html | 5 +++- .../ThemeDescriptor/index-debug.html | 25 +++++++++++++++++++ 4 files changed, 54 insertions(+), 2 deletions(-) diff --git a/Objective-J/Debug.js b/Objective-J/Debug.js index 9c1df6cd6..1df4bd179 100644 --- a/Objective-J/Debug.js +++ b/Objective-J/Debug.js @@ -93,7 +93,7 @@ GLOBAL(objj_backtrace_decorator) = function(msgSend) return function(aReceiverOrSuper, aSelector) { var aReceiver = aReceiverOrSuper && (aReceiverOrSuper.receiver || aReceiverOrSuper); - + // push the receiver and selector onto the backtrace stack objj_backtrace.push({ receiver: aReceiver, selector : aSelector }); try @@ -105,6 +105,9 @@ GLOBAL(objj_backtrace_decorator) = function(msgSend) // print the exception and backtrace CPLog.warn("Exception " + anException + " in " + objj_debug_message_format(aReceiver, aSelector)); objj_backtrace_print(CPLog.warn); + + // re-throw the exception + throw anException; } finally { @@ -114,6 +117,24 @@ GLOBAL(objj_backtrace_decorator) = function(msgSend) } } +GLOBAL(objj_supress_exceptions_decorator) = function(msgSend) +{ + return function(aReceiverOrSuper, aSelector) + { + var aReceiver = aReceiverOrSuper && (aReceiverOrSuper.receiver || aReceiverOrSuper); + + try + { + return msgSend.apply(NULL, arguments); + } + catch (anException) + { + // print the exception and backtrace + CPLog.warn("Exception " + anException + " in " + objj_debug_message_format(aReceiver, aSelector)); + } + } +} + // type checking decorator var objj_typechecks_reported = {}, diff --git a/Tools/capp/Resources/Templates/Application/index-debug.html b/Tools/capp/Resources/Templates/Application/index-debug.html index efc533581..644616e6d 100644 --- a/Tools/capp/Resources/Templates/Application/index-debug.html +++ b/Tools/capp/Resources/Templates/Application/index-debug.html @@ -37,6 +37,9 @@ // Uncomment to enable printing of backtraces on exceptions: //objj_msgSend_decorate(objj_backtrace_decorator); + + // Uncomment to supress exceptions that take place inside a message + //objj_msgSend_decorate(objj_supress_exceptions_decorator) // Uncomment to enable runtime type checking: //objj_msgSend_decorate(objj_typecheck_decorator); diff --git a/Tools/capp/Resources/Templates/NibApplication/index-debug.html b/Tools/capp/Resources/Templates/NibApplication/index-debug.html index b5e9fc417..78c59cd69 100644 --- a/Tools/capp/Resources/Templates/NibApplication/index-debug.html +++ b/Tools/capp/Resources/Templates/NibApplication/index-debug.html @@ -37,6 +37,9 @@ // Uncomment to enable printing of backtraces on exceptions: //objj_msgSend_decorate(objj_backtrace_decorator); + + // Uncomment to supress exceptions that take place inside a message + //objj_msgSend_decorate(objj_supress_exceptions_decorator) // Uncomment to enable runtime type checking: //objj_msgSend_decorate(objj_typecheck_decorator); @@ -51,7 +54,7 @@ //CPLogRegister(CPLogConsole); //CPLogRegister(CPLogPopup); - +