Skip to content

Instantly share code, notes, and snippets.

@boucher
Created February 9, 2010 20:01
Show Gist options
  • Save boucher/299599 to your computer and use it in GitHub Desktop.
Save boucher/299599 to your computer and use it in GitHub Desktop.
diff --git a/AppKit/CPApplication.j b/AppKit/CPApplication.j
index c8debf4..e5452ee 100644
--- a/AppKit/CPApplication.j
+++ b/AppKit/CPApplication.j
@@ -1043,7 +1043,7 @@ var _CPAppBootstrapperActions = nil;
+ (void)actions
{
- return [@selector(bootstrapPlatform), @selector(loadDefaultTheme), @selector(loadMainCibFile)];
+ return [@selector(loadDefaultTheme)];//[@selector(bootstrapPlatform)];//[@selector(bootstrapPlatform), @selector(loadDefaultTheme), @selector(loadMainCibFile)];
}
+ (void)performActions
@@ -1059,7 +1059,7 @@ var _CPAppBootstrapperActions = nil;
return;
}
- [CPApp run];
+ //[CPApp run];
}
+ (BOOL)bootstrapPlatform
diff --git a/AppKit/CPCursor.j b/AppKit/CPCursor.j
index f5e67f6..d0a9582 100755
--- a/AppKit/CPCursor.j
+++ b/AppKit/CPCursor.j
@@ -230,11 +230,11 @@ var currentCursor = nil,
+ (void)_setCursorCSS:(CPString)aString
{
#if PLATFORM(DOM)
- [CPPlatformWindow primaryPlatformWindow]._DOMBodyElement.style.cursor = aString;
+ //[CPPlatformWindow primaryPlatformWindow]._DOMBodyElement.style.cursor = aString;
- var platformWindows = [[CPPlatformWindow visiblePlatformWindows] allObjects];
- for (var i = 0, count = [platformWindows count]; i < count; i++)
- platformWindows[i]._DOMBodyElement.style.cursor = aString;
+ //var platformWindows = [[CPPlatformWindow visiblePlatformWindows] allObjects];
+ //for (var i = 0, count = [platformWindows count]; i < count; i++)
+ // platformWindows[i]._DOMBodyElement.style.cursor = aString;
#endif
}
diff --git a/AppKit/CPImage.j b/AppKit/CPImage.j
index 32571ac..ff7d71a 100644
--- a/AppKit/CPImage.j
+++ b/AppKit/CPImage.j
@@ -263,22 +263,37 @@ function CPAppKitImage(aFilename, aSize)
var isSynchronous = YES;
// FIXME: We need a better/performance way of doing this.
- _image.onload = function ()
+ /*_image.onload = function ()
{
- if (isSynchronous)
- window.setTimeout(function() { [self _imageDidLoad]; }, 0);
- else
- {
- [self _imageDidLoad];
- [[CPRunLoop currentRunLoop] limitDateForMode:CPDefaultRunLoopMode];
- }
- [self _derefFromImage];
+ try {
+ if (isSynchronous)
+ {
+ window.setNativeTimeout(function() {
+ debugger;
+ try {
+ [self _imageDidLoad];
+ }catch(e){
+ alert(e);
+ debugger;
+ }
+ }, 0);
+ }
+ else
+ {
+ [self _imageDidLoad];
+ [[CPRunLoop currentRunLoop] limitDateForMode:CPDefaultRunLoopMode];
+ }
+ //[self _derefFromImage];
+ } catch(e){
+ alert(e);
+ debugger;
+ }
}
_image.onerror = function ()
{
if (isSynchronous)
- window.setTimeout(function() { [self _imageDidError]; }, 0);
+ window.setNativeTimeout(function() { [self _imageDidError]; }, 0);
else
{
[self _imageDidError];
@@ -298,12 +313,12 @@ function CPAppKitImage(aFilename, aSize)
}
[self _derefFromImage];
}
-
+ */
_image.src = _filename;
// onload and friends may fire after this point but BEFORE the end of the run loop,
// crazy, I know. So don't set isSynchronous here, rather wait a bit longer.
- window.setTimeout(function() { isSynchronous = NO; }, 0);
+ // window.setTimeout(function() { debugger; isSynchronous = NO; }, 0);
}
- (BOOL)isThreePartImage
diff --git a/AppKit/CPThemeBlend.j b/AppKit/CPThemeBlend.j
index cf52303..f3c11e4 100644
--- a/AppKit/CPThemeBlend.j
+++ b/AppKit/CPThemeBlend.j
@@ -60,7 +60,8 @@
{
var themes = [_bundle objectForInfoDictionaryKey:@"CPKeyedThemes"],
count = themes.length;
-
+window.DEADBEEF = 1;
+try{
while (count--)
{
var path = [aBundle pathForResource:themes[count]],
@@ -70,10 +71,14 @@
[unarchiver decodeObjectForKey:@"root"];
- [unarchiver finishDecoding];
+ //[unarchiver finishDecoding];
}
-
- [_loadDelegate blendDidFinishLoading:self];
+}catch(e){
+ alert(e);
+ debugger;
+}
+window.DEADBEEF = 0;
+ //[_loadDelegate blendDidFinishLoading:self];
}
@end
diff --git a/AppKit/Platform/CPPlatform.j b/AppKit/Platform/CPPlatform.j
index 8bf3785..f90f92e 100644
--- a/AppKit/Platform/CPPlatform.j
+++ b/AppKit/Platform/CPPlatform.j
@@ -31,8 +31,8 @@
+ (void)bootstrap
{
- [CPPlatformString bootstrap];
- [CPPlatformWindow setPrimaryPlatformWindow:[[CPPlatformWindow alloc] _init]];
+ //[CPPlatformString bootstrap];
+ //[CPPlatformWindow setPrimaryPlatformWindow:[[CPPlatformWindow alloc] _init]];
}
+ (BOOL)isBrowser
diff --git a/AppKit/Platform/DOM/CPPlatform.j b/AppKit/Platform/DOM/CPPlatform.j
index e3a621f..ca90788 100644
--- a/AppKit/Platform/DOM/CPPlatform.j
+++ b/AppKit/Platform/DOM/CPPlatform.j
@@ -87,7 +87,7 @@ var screenNeedsInitialization = NO,
}
+ (void)initializeScreenIfNecessary
-{
+{return;
if (!screenNeedsInitialization)
return;
diff --git a/AppKit/Platform/DOM/CPPlatformWindow+DOM.j b/AppKit/Platform/DOM/CPPlatformWindow+DOM.j
index e6cff49..dd3b17d 100644
--- a/AppKit/Platform/DOM/CPPlatformWindow+DOM.j
+++ b/AppKit/Platform/DOM/CPPlatformWindow+DOM.j
@@ -157,8 +157,8 @@ var supportsNativeDragAndDrop = [CPPlatform supportsDragAndDrop];
_windowLevels = [];
_windowLayers = [CPDictionary dictionary];
- [self registerDOMWindow];
- [self updateFromNativeContentRect];
+ //[self registerDOMWindow];
+ //[self updateFromNativeContentRect];
_charCodes = {};
}
@@ -241,7 +241,7 @@ var supportsNativeDragAndDrop = [CPPlatform supportsDragAndDrop];
_DOMFocusElement.style.filter = "alpha(opacity=0)";
_DOMFocusElement.className = "cpdontremove";
- _DOMBodyElement.appendChild(_DOMFocusElement);
+ //_DOMBodyElement.appendChild(_DOMFocusElement);
// Create Native Pasteboard handler.
_DOMPasteboardElement = theDocument.createElement("textarea");
@@ -251,7 +251,7 @@ var supportsNativeDragAndDrop = [CPPlatform supportsDragAndDrop];
_DOMPasteboardElement.style.zIndex = "999";
_DOMPasteboardElement.className = "cpdontremove";
- _DOMBodyElement.appendChild(_DOMPasteboardElement);
+ //_DOMBodyElement.appendChild(_DOMPasteboardElement);
// Make sure the pastboard element is blurred.
_DOMPasteboardElement.blur();
@@ -259,6 +259,7 @@ var supportsNativeDragAndDrop = [CPPlatform supportsDragAndDrop];
- (void)registerDOMWindow
{
+return;
var theDocument = _DOMWindow.document;
_DOMBodyElement = theDocument.getElementById("cappuccino-body") || theDocument.body;
@@ -453,7 +454,7 @@ var supportsNativeDragAndDrop = [CPPlatform supportsDragAndDrop];
[self registerDOMWindow];
- _DOMBodyElement.style.cursor = [[CPCursor currentCursor] _cssString];
+ //_DOMBodyElement.style.cursor = [[CPCursor currentCursor] _cssString];
}
- (void)orderOut:(id)aSender
@@ -1139,7 +1140,7 @@ var supportsNativeDragAndDrop = [CPPlatform supportsDragAndDrop];
[_windowLevels insertObject:aLevel atIndex:_windowLevels[middle] > aLevel ? middle : middle + 1];
layer._DOMElement.style.zIndex = aLevel;
- _DOMBodyElement.appendChild(layer._DOMElement);
+ //_DOMBodyElement.appendChild(layer._DOMElement);
}
return layer;
@@ -1172,7 +1173,7 @@ var supportsNativeDragAndDrop = [CPPlatform supportsDragAndDrop];
{
var layer = [layers objectForKey:levels[levelCount]];
- _DOMBodyElement.removeChild(layer._DOMElement);
+ //_DOMBodyElement.removeChild(layer._DOMElement);
}
}
@@ -1186,7 +1187,7 @@ var supportsNativeDragAndDrop = [CPPlatform supportsDragAndDrop];
{
var layer = [layers objectForKey:levels[levelCount]];
- _DOMBodyElement.appendChild(layer._DOMElement);
+ //_DOMBodyElement.appendChild(layer._DOMElement);
}
}
diff --git a/AppKit/Themes/Aristo/ThemeDescriptors.j b/AppKit/Themes/Aristo/ThemeDescriptors.j
index d709b21..417660d 100644
--- a/AppKit/Themes/Aristo/ThemeDescriptors.j
+++ b/AppKit/Themes/Aristo/ThemeDescriptors.j
@@ -18,7 +18,7 @@
{
return @"Aristo";
}
-
+///*
+ (CPButton)button
{
var button = [[CPButton alloc] initWithFrame:CGRectMake(0.0, 0.0, 60.0, 24.0)],
@@ -832,7 +832,7 @@
[_CPCibCustomResource imageResourceWithName:"HUD/scroller-vertical-knob-disabled-center.png" size:CGSizeMake(15.0, 1.0)],
[_CPCibCustomResource imageResourceWithName:"HUD/scroller-vertical-knob-disabled-bottom.png" size:CGSizeMake(15.0, 10.0)]
]
- isVertical:YES]);*/
+ isVertical:YES]);//*/
[scroller setValue:knobColor forThemeAttribute:@"knob-color" inState:CPThemeStateVertical];
//[scroller setValue:knobDisabledColor forThemeAttribute:@"knob-color" inState:CPThemeStateVertical|CPThemeStateDisabled];
@@ -888,7 +888,7 @@
[_CPCibCustomResource imageResourceWithName:"HUD/scroller-horizontal-knob-disabled-center.png" size:CGSizeMake(1.0, 15.0)],
[_CPCibCustomResource imageResourceWithName:"HUD/scroller-horizontal-knob-disabled-right.png" size:CGSizeMake(10.0, 15.0)]
]
- isVertical:NO]);*/
+ isVertical:NO]);//*/
[scroller setValue:knobColor forThemeAttribute:@"knob-color"];
//[scroller setValue:knobDisabledColor forThemeAttribute:@"knob-color" inState:CPThemeStateDisabled];
@@ -898,6 +898,7 @@
return scroller;
}
+//*/
@end
diff --git a/Foundation/CPKeyedUnarchiver.j b/Foundation/CPKeyedUnarchiver.j
index 2a30e82..05f104e 100644
--- a/Foundation/CPKeyedUnarchiver.j
+++ b/Foundation/CPKeyedUnarchiver.j
@@ -302,16 +302,23 @@ var _CPKeyedUnarchiverArrayClass = Ni
@param aKey the object's associated key
@return the decoded object
*/
+
- (id)decodeObjectForKey:(CPString)aKey
{
+ PUSH("decode object for key: "+aKey);
var object = [_plistObject objectForKey:aKey];
if ([object isKindOfClass:_CPKeyedUnarchiverDictionaryClass])
- return _CPKeyedUnarchiverDecodeObjectAtIndex(self, [object objectForKey:_CPKeyedArchiverUIDKey]);
-
+ {
+ var val = _CPKeyedUnarchiverDecodeObjectAtIndex(self, [object objectForKey:_CPKeyedArchiverUIDKey]);
+ POP();
+ return val;
+ }
else if ([object isKindOfClass:_CPKeyedUnarchiverNumberClass] || [object isKindOfClass:_CPKeyedUnarchiverDataClass] || [object isKindOfClass:_CPKeyedUnarchiverStringClass])
+ {
+ POP();
return object;
-
+ }
else if ([object isKindOfClass:_CPKeyedUnarchiverArrayClass])
{
var index = 0,
@@ -320,12 +327,13 @@ var _CPKeyedUnarchiverArrayClass = Ni
for (; index < count; ++index)
array[index] = _CPKeyedUnarchiverDecodeObjectAtIndex(self, [object[index] objectForKey:_CPKeyedArchiverUIDKey]);
-
+ POP();
return array;
}
/* else
CPLog([object className] + " " + object + " " + aKey + " " + [_plistObject description]);*/
-
+ POP();
+
return nil;
}
@@ -409,16 +417,45 @@ var _CPKeyedUnarchiverArrayClass = Ni
@end
+var messages = [],
+ stack = [];
+PUSH = function(msg)
+{
+ messages.push(msg);
+ stack.push(msg);
+ if (stack.length > 1000)
+ console.log("WARN: "+stack.length);
+}
+POP = function()
+{
+ stack.pop();
+}
+PRINT = function(n)
+{
+ console.log(messages.slice(messages.length - n).join("\n"));
+}
+TRACE = function(n)
+{
+ console.log(stack.slice(stack.length - n).join("\n"));
+}
+COUNT = function()
+{
+ console.log("stack: "+stack.length);
+}
+
var _CPKeyedUnarchiverDecodeObjectAtIndex = function(self, anIndex)
{
+ PUSH("decode object at index: "+anIndex);
var object = self._objects[anIndex];
if (object)
+ {
+ POP();
if (object == self._objects[0])
return nil;
else
return object;
-
+ }
var object,
plistObject = self._plistObjects[anIndex];
@@ -496,7 +533,7 @@ var _CPKeyedUnarchiverDecodeObjectAtIndex = function(self, anIndex)
if (object == _CPKeyedArchiverNullString)
{
self._objects[anIndex] = self._objects[0];
-
+ POP();
return nil;
}
else
@@ -508,7 +545,7 @@ var _CPKeyedUnarchiverDecodeObjectAtIndex = function(self, anIndex)
// that it is a wrapper for a primitive JavaScript object.
if ([object isMemberOfClass:_CPKeyedUnarchiverArchiverValueClass])
object = [object JSObject];
-
+ POP();
return object;
}
diff --git a/Objective-J/CFBundle.js b/Objective-J/CFBundle.js
index 12a0a14..5e308b0 100644
--- a/Objective-J/CFBundle.js
+++ b/Objective-J/CFBundle.js
@@ -518,7 +518,7 @@ CFBundle.prototype.removeEventListener = function(/*String*/ anEventName, /*Func
CFBundle.prototype.onerror = function(/*Event*/ anEvent)
{
- throw anEvent.error;
+ //throw anEvent.error;
}
exports.CFBundle = CFBundle;
diff --git a/Objective-J/Runtime.js b/Objective-J/Runtime.js
index d5cf526..d51defd 100644
--- a/Objective-J/Runtime.js
+++ b/Objective-J/Runtime.js
@@ -453,22 +453,34 @@ function ivar_getTypeEncoding(anIvar)
}
// Sending Messages
+var objj_stack = 0,
+ objj_max = 0;;
function objj_msgSend(/*id*/ aReceiver, /*SEL*/ aSelector)
{
if (aReceiver == nil)
return nil;
-
+
+objj_stack += 2;
+if (objj_stack > 100)
+{
+ console.log("OBJJ_WARN: "+objj_stack);
+ objj_max = MAX(objj_max, objj_stack);
+}
CLASS_GET_METHOD_IMPLEMENTATION(var implementation, aReceiver.isa, aSelector);
- switch(arguments.length)
+ /*switch(arguments.length)
{
case 2: return implementation(aReceiver, aSelector);
case 3: return implementation(aReceiver, aSelector, arguments[2]);
case 4: return implementation(aReceiver, aSelector, arguments[2], arguments[3]);
- }
+ }*/
+
+ var result = implementation.apply(aReceiver, arguments);
+
+objj_stack -=2;
- return implementation.apply(aReceiver, arguments);
+ return result;
}
function objj_msgSendSuper(/*id*/ aSuper, /*SEL*/ aSelector)
diff --git a/Tools/Documentation/Cappuccino.doxygen b/Tools/Documentation/Cappuccino.doxygen
index 0f531d5..db0a232 100644
--- a/Tools/Documentation/Cappuccino.doxygen
+++ b/Tools/Documentation/Cappuccino.doxygen
@@ -608,7 +608,7 @@ FILE_PATTERNS = *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i+
# should be searched for input files as well. Possible values are YES and NO.
# If left blank NO is used.
-RECURSIVE = NO
+RECURSIVE = YES
# The EXCLUDE tag can be used to specify files and/or directories that should
# excluded from the INPUT source files. This way you can easily exclude a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment