mirror of
https://github.com/darlinghq/darling-cocotron.git
synced 2024-11-23 20:19:40 +00:00
- Decoding of NIB external name table replacement, allObjects, and NSCustomObject substantially changed to use mostly public API and be compatible with Apple's Foundation. Custom object's are instantiated only after replacement is performed and only done if present in NSIBObjectData's NSNamesKeys (tests indicate they are always in this array).
- Type fixes on -[NSCoder/NSKeyedUnarchiver decodeBytesForKey:...] - Foundation project fix for copied Info.plist - added NSKeyedUnarchiver delegate protocol, partial implemented. private replaceObject:withObject: method - changed use of -[NSString _KVC_partBeforeDot:afterDot:] in AppKit to NSStringKVCFunctions.h because it is not present in Apple's Foundation - changed NSApplication use of objc_msg_lookup to methodForSelector - moved KGContext/NSPrintInfo imageableRect logic into Win32Display
This commit is contained in:
parent
75aaabb071
commit
30bc8be10c
@ -2080,6 +2080,10 @@
|
||||
FE25FF630EE58712009C91B1 /* KGFont.m in Sources */ = {isa = PBXBuildFile; fileRef = FE25FF610EE58712009C91B1 /* KGFont.m */; };
|
||||
FE25FF640EE58712009C91B1 /* KGFont.h in Headers */ = {isa = PBXBuildFile; fileRef = FE25FF600EE58712009C91B1 /* KGFont.h */; settings = {ATTRIBUTES = (Private, ); }; };
|
||||
FE25FF650EE58712009C91B1 /* KGFont.m in Sources */ = {isa = PBXBuildFile; fileRef = FE25FF610EE58712009C91B1 /* KGFont.m */; };
|
||||
FE2C7F550FDC4C8E00D5DFB5 /* NSStringKVCFunctions.h in Headers */ = {isa = PBXBuildFile; fileRef = FE2C7F540FDC4C8E00D5DFB5 /* NSStringKVCFunctions.h */; };
|
||||
FE2C7F560FDC4C8E00D5DFB5 /* NSStringKVCFunctions.h in Headers */ = {isa = PBXBuildFile; fileRef = FE2C7F540FDC4C8E00D5DFB5 /* NSStringKVCFunctions.h */; };
|
||||
FE2C7F570FDC4C8E00D5DFB5 /* NSStringKVCFunctions.h in Headers */ = {isa = PBXBuildFile; fileRef = FE2C7F540FDC4C8E00D5DFB5 /* NSStringKVCFunctions.h */; };
|
||||
FE2C7F580FDC4C8E00D5DFB5 /* NSStringKVCFunctions.h in Headers */ = {isa = PBXBuildFile; fileRef = FE2C7F540FDC4C8E00D5DFB5 /* NSStringKVCFunctions.h */; };
|
||||
FE311FA80CCC430200EBD696 /* KTFont_gdi.h in Headers */ = {isa = PBXBuildFile; fileRef = FE311FA40CCC430200EBD696 /* KTFont_gdi.h */; };
|
||||
FE311FA90CCC430200EBD696 /* KTFont_gdi.m in Sources */ = {isa = PBXBuildFile; fileRef = FE311FA50CCC430200EBD696 /* KTFont_gdi.m */; };
|
||||
FE337FCA0EE77A6C00D4A751 /* CTFont.m in Sources */ = {isa = PBXBuildFile; fileRef = FE337FC90EE77A6C00D4A751 /* CTFont.m */; };
|
||||
@ -3452,6 +3456,7 @@
|
||||
FE2A11530B45C65E006C03DE /* NSTokenField.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NSTokenField.m; sourceTree = "<group>"; };
|
||||
FE2A115A0B45C66A006C03DE /* NSTokenFieldCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NSTokenFieldCell.h; sourceTree = "<group>"; };
|
||||
FE2A115B0B45C66A006C03DE /* NSTokenFieldCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NSTokenFieldCell.m; sourceTree = "<group>"; };
|
||||
FE2C7F540FDC4C8E00D5DFB5 /* NSStringKVCFunctions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NSStringKVCFunctions.h; sourceTree = "<group>"; };
|
||||
FE311FA40CCC430200EBD696 /* KTFont_gdi.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = KTFont_gdi.h; sourceTree = "<group>"; };
|
||||
FE311FA50CCC430200EBD696 /* KTFont_gdi.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = KTFont_gdi.m; sourceTree = "<group>"; };
|
||||
FE337FC90EE77A6C00D4A751 /* CTFont.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CTFont.m; sourceTree = "<group>"; };
|
||||
@ -4673,6 +4678,7 @@
|
||||
FE2A10250B44A239006C03DE /* NSController */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
FE2C7F540FDC4C8E00D5DFB5 /* NSStringKVCFunctions.h */,
|
||||
C85D91930EE6A806004EBAEA /* NSDictionaryController.h */,
|
||||
C85D91940EE6A806004EBAEA /* NSDictionaryController.m */,
|
||||
C8C52C8D0E7ED1FF003F03B5 /* NSObservationProxy.h */,
|
||||
@ -5152,6 +5158,7 @@
|
||||
FEA317C30FD5893300F480D4 /* NSRaise.h in Headers */,
|
||||
FE9DB3D60FD6BD5A00A1CE17 /* NSRangeEntries.h in Headers */,
|
||||
FEAED7A00FD6C96E0043F915 /* KGDataConsumer.h in Headers */,
|
||||
FE2C7F560FDC4C8E00D5DFB5 /* NSStringKVCFunctions.h in Headers */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
@ -5514,6 +5521,7 @@
|
||||
FEA317C40FD5893300F480D4 /* NSRaise.h in Headers */,
|
||||
FE9DB3D70FD6BD5B00A1CE17 /* NSRangeEntries.h in Headers */,
|
||||
FEAED79E0FD6C96E0043F915 /* KGDataConsumer.h in Headers */,
|
||||
FE2C7F550FDC4C8E00D5DFB5 /* NSStringKVCFunctions.h in Headers */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
@ -5870,6 +5878,7 @@
|
||||
FEA317C20FD5893300F480D4 /* NSRaise.h in Headers */,
|
||||
FE9DB3D50FD6BD5A00A1CE17 /* NSRangeEntries.h in Headers */,
|
||||
FEAED7A20FD6C96E0043F915 /* KGDataConsumer.h in Headers */,
|
||||
FE2C7F570FDC4C8E00D5DFB5 /* NSStringKVCFunctions.h in Headers */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
@ -6154,6 +6163,7 @@
|
||||
FEA314D90FD5667D00F480D4 /* NSControllerMarker.h in Headers */,
|
||||
FEA317C50FD5893300F480D4 /* NSRaise.h in Headers */,
|
||||
FEA3182B0FD5961100F480D4 /* NSRangeEntries.h in Headers */,
|
||||
FE2C7F580FDC4C8E00D5DFB5 /* NSStringKVCFunctions.h in Headers */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
|
@ -745,7 +745,7 @@ id NSApp=nil;
|
||||
if([[sheet _animationContext] stepCount]<=0)
|
||||
break;
|
||||
|
||||
function=objc_msg_lookup([context modalDelegate],[context didEndSelector]);
|
||||
function=[[context modalDelegate] methodForSelector:[context didEndSelector]];
|
||||
function([context modalDelegate],[context didEndSelector],sheet,returnCode,[context contextInfo]);
|
||||
|
||||
return;
|
||||
|
@ -16,7 +16,6 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
|
||||
#import <Foundation/NSKeyValueObserving.h>
|
||||
#import <Foundation/NSKeyValueCoding.h>
|
||||
#import <Foundation/NSSortDescriptor.h>
|
||||
#import <Foundation/NSString+KVCAdditions.h>
|
||||
#import <AppKit/NSRaise.h>
|
||||
#import "NSObservationProxy.h"
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
#import <Foundation/NSDictionary.h>
|
||||
#import <Foundation/NSString.h>
|
||||
#import <Foundation/NSException.h>
|
||||
#import <Foundation/NSString+KVCAdditions.h>
|
||||
#import "NSStringKVCFunctions.h"
|
||||
#import <Foundation/NSKeyValueObserving.h>
|
||||
#import <Foundation/NSIndexSet.h>
|
||||
|
||||
@ -142,7 +142,7 @@
|
||||
if([keyPath hasPrefix:@"@"])
|
||||
{
|
||||
NSString* firstPart, *rest;
|
||||
[keyPath _KVC_partBeforeDot:&firstPart afterDot:&rest];
|
||||
NSStringKVCSplitOnDot(keyPath,&firstPart,&rest);
|
||||
|
||||
// observe ourselves
|
||||
[super addObserver:observer
|
||||
@ -183,7 +183,7 @@
|
||||
if([keyPath hasPrefix:@"@"])
|
||||
{
|
||||
NSString* firstPart, *rest;
|
||||
[keyPath _KVC_partBeforeDot:&firstPart afterDot:&rest];
|
||||
NSStringKVCSplitOnDot(keyPath,&firstPart,&rest);
|
||||
|
||||
[super removeObserver:observer
|
||||
forKeyPath:keyPath];
|
||||
@ -210,7 +210,7 @@
|
||||
[self willChangeValueForKey:keyPath];
|
||||
|
||||
NSString* firstPart, *rest;
|
||||
[keyPath _KVC_partBeforeDot:&firstPart afterDot:&rest];
|
||||
NSStringKVCSplitOnDot(keyPath,&firstPart,&rest);
|
||||
|
||||
// if dependencies: observe these in any case
|
||||
if(rest)
|
||||
@ -252,7 +252,7 @@
|
||||
if([keyPath hasPrefix:@"@"]) {
|
||||
[self willChangeValueForKey:keyPath];
|
||||
NSString* firstPart, *rest;
|
||||
[keyPath _KVC_partBeforeDot:&firstPart afterDot:&rest];
|
||||
NSStringKVCSplitOnDot(keyPath,&firstPart,&rest);
|
||||
|
||||
if(rest)
|
||||
[obj removeObserver:proxy
|
||||
@ -299,7 +299,7 @@
|
||||
if([keyPath hasPrefix:@"@"]) {
|
||||
[self willChangeValueForKey:keyPath];
|
||||
NSString* firstPart, *rest;
|
||||
[keyPath _KVC_partBeforeDot:&firstPart afterDot:&rest];
|
||||
NSStringKVCSplitOnDot(keyPath,&firstPart,&rest);
|
||||
|
||||
if(rest) {
|
||||
[old removeObserver:proxy
|
||||
|
23
AppKit/NSController/NSStringKVCFunctions.h
Normal file
23
AppKit/NSController/NSStringKVCFunctions.h
Normal file
@ -0,0 +1,23 @@
|
||||
/* Copyright (c) 2007 Johannes Fortmann
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
|
||||
#import <Foundation/NSString.h>
|
||||
|
||||
void NSStringKVCSplitOnDot(NSString *self,NSString **before,NSString **after){
|
||||
NSRange range=[self rangeOfString:@"."];
|
||||
if(range.location!=NSNotFound)
|
||||
{
|
||||
*before=[self substringToIndex:range.location];
|
||||
*after=[self substringFromIndex:range.location+1];
|
||||
}
|
||||
else
|
||||
{
|
||||
*before=self;
|
||||
*after=nil;
|
||||
}
|
||||
}
|
@ -12,7 +12,6 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
|
||||
#import <Foundation/NSValue.h>
|
||||
#import <Foundation/NSThread.h>
|
||||
#import <ApplicationServices/ApplicationServices.h>
|
||||
#import <CoreGraphics/KGContext.h>
|
||||
|
||||
NSString *NSPrintPrinter=@"NSPrintPrinter";
|
||||
NSString *NSPrintPrinterName=@"NSPrintPrinterName";
|
||||
@ -133,9 +132,11 @@ NSString *NSPrintVerticallyCentered=@"NSPrintVerticallyCentered";
|
||||
|
||||
-(NSRect)imageablePageBounds {
|
||||
NSRect result;
|
||||
CGContextRef context=[_attributes objectForKey:@"_KGContext"];
|
||||
NSValue *imageable=[_attributes objectForKey:@"_imageableRect"];
|
||||
|
||||
if(![context getImageableRect:&result]){
|
||||
if(imageable!=nil)
|
||||
result=[imageable rectValue];
|
||||
else {
|
||||
result.origin.x=0;
|
||||
result.origin.y=0;
|
||||
result.size=[self paperSize];
|
||||
|
@ -914,7 +914,11 @@ static int CALLBACK buildTypeface(const LOGFONTA *lofFont_old,
|
||||
else {
|
||||
NSDictionary *auxiliaryInfo=[NSDictionary dictionaryWithObject:[attributes objectForKey:@"_title"] forKey:kCGPDFContextTitle];
|
||||
KGContext_gdi *context=[[[KGContext_gdi alloc] initWithPrinterDC:printProperties.hDC auxiliaryInfo:auxiliaryInfo] autorelease];
|
||||
|
||||
NSRect imageable;
|
||||
|
||||
if([context getImageableRect:&imageable])
|
||||
[attributes setObject:[NSValue valueWithRect:imageable] forKey:@"_imageableRect"];
|
||||
|
||||
[attributes setObject:context forKey:@"_KGContext"];
|
||||
|
||||
[attributes setObject:[NSValue valueWithSize:[context pointSize]] forKey:NSPrintPaperSize];
|
||||
|
@ -12,4 +12,6 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
|
||||
NSString *_className;
|
||||
}
|
||||
|
||||
-(id)createCustomInstance;
|
||||
|
||||
@end
|
||||
|
@ -32,6 +32,24 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
-(id)createCustomInstance {
|
||||
Class class=NSClassFromString(_className);
|
||||
id ret=nil;
|
||||
|
||||
if(class==Nil)
|
||||
NSLog(@"NSCustomObject unknown class %@",_className);
|
||||
|
||||
if([_className isEqualToString:@"NSApplication"]) {
|
||||
ret=[[NSApplication sharedApplication] retain];
|
||||
}
|
||||
else {
|
||||
ret=[[class alloc] init];
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
#if 0
|
||||
-awakeAfterUsingCoder:(NSCoder *)coder {
|
||||
Class class=NSClassFromString(_className);
|
||||
id ret=nil;
|
||||
@ -49,6 +67,6 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@end
|
||||
|
@ -18,13 +18,20 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
|
||||
#import <AppKit/NSFontManager.h>
|
||||
#import <AppKit/NSNib.h>
|
||||
|
||||
@interface NSKeyedUnarchiver(private)
|
||||
-(void)replaceObject:object withObject:replacement;
|
||||
@end
|
||||
|
||||
@interface NSNib(private)
|
||||
-(NSDictionary *)externalNameTable;
|
||||
@end
|
||||
|
||||
@implementation NSIBObjectData
|
||||
|
||||
-initWithCoder:(NSCoder *)coder {
|
||||
if([coder isKindOfClass:[NSNibKeyedUnarchiver class]]){
|
||||
NSNibKeyedUnarchiver *keyed=(NSNibKeyedUnarchiver *)coder;
|
||||
NSMutableDictionary *nameTable=[NSMutableDictionary dictionaryWithDictionary:[keyed externalNameTable]];
|
||||
NSArray *uids=[keyed decodeArrayOfUidsForKey:@"NSNamesKeys"];
|
||||
NSMutableDictionary *nameTable=[NSMutableDictionary dictionaryWithDictionary:[[keyed delegate] externalNameTable]];
|
||||
int i,count;
|
||||
id owner;
|
||||
|
||||
@ -35,15 +42,27 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
|
||||
|
||||
_namesValues=[[keyed decodeObjectForKey:@"NSNamesValues"] retain];
|
||||
count=[_namesValues count];
|
||||
NSMutableArray *namedObjects=[[keyed decodeObjectForKey:@"NSNamesKeys"] mutableCopy];
|
||||
|
||||
for(i=0;i<count;i++){
|
||||
NSString *check=[_namesValues objectAtIndex:i];
|
||||
id external=[nameTable objectForKey:check];
|
||||
|
||||
if(external!=nil)
|
||||
[keyed replaceObject:external atUid:[[uids objectAtIndex:i] intValue]];
|
||||
id nibObject=[namedObjects objectAtIndex:i];
|
||||
|
||||
if(external!=nil){
|
||||
[keyed replaceObject:nibObject withObject:external];
|
||||
[namedObjects replaceObjectAtIndex:i withObject:external];
|
||||
}
|
||||
else if([nibObject isKindOfClass:[NSCustomObject class]]){
|
||||
id replacement=[nibObject createCustomInstance];
|
||||
|
||||
[keyed replaceObject:nibObject withObject:replacement];
|
||||
[namedObjects replaceObjectAtIndex:i withObject:replacement];
|
||||
[replacement release];
|
||||
}
|
||||
}
|
||||
_namesKeys=namedObjects;
|
||||
|
||||
_namesKeys=[[keyed decodeObjectForKey:@"NSNamesKeys"] retain];
|
||||
_accessibilityConnectors=[[keyed decodeObjectForKey:@"NSAccessibilityConnectors"] retain];
|
||||
_accessibilityOidsKeys=[[keyed decodeObjectForKey:@"NSAccessibilityOidsKeys"] retain];
|
||||
_accessibilityOidsValues=[[keyed decodeObjectForKey:@"NSAccessibilityOidsValues"] retain];
|
||||
|
@ -9,13 +9,15 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
|
||||
#import <Foundation/NSObject.h>
|
||||
#import <AppKit/AppKitExport.h>
|
||||
|
||||
@class NSURL,NSBundle,NSDictionary,NSArray,NSData;
|
||||
@class NSURL,NSBundle,NSDictionary,NSArray,NSData,NSMutableArray;
|
||||
|
||||
APPKIT_EXPORT NSString *NSNibOwner;
|
||||
APPKIT_EXPORT NSString *NSNibTopLevelObjects;
|
||||
|
||||
@interface NSNib : NSObject {
|
||||
NSData *_data;
|
||||
NSMutableArray *_allObjects;
|
||||
NSDictionary *_nameTable;
|
||||
}
|
||||
|
||||
-initWithContentsOfURL:(NSURL *)url;
|
||||
|
@ -16,6 +16,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
|
||||
#import <AppKit/NSTableCornerView.h>
|
||||
#import "NSIBObjectData.h"
|
||||
#import "NSNibHelpConnector.h"
|
||||
#import "NSCustomObject.h"
|
||||
|
||||
NSString *NSNibOwner=@"NSOwner";
|
||||
NSString *NSNibTopLevelObjects=@"NSNibTopLevelObjects";
|
||||
@ -38,6 +39,8 @@ NSString *NSNibTopLevelObjects=@"NSNibTopLevelObjects";
|
||||
return nil;
|
||||
}
|
||||
|
||||
_allObjects=[NSMutableArray new];
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
@ -64,17 +67,35 @@ NSString *NSNibTopLevelObjects=@"NSNibTopLevelObjects";
|
||||
|
||||
-(void)dealloc {
|
||||
[_data release];
|
||||
[_allObjects release];
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
-unarchiver:(NSKeyedUnarchiver *)unarchiver didDecodeObject:object {
|
||||
[_allObjects addObject:object];
|
||||
return object;
|
||||
}
|
||||
|
||||
-(void)unarchiver:(NSKeyedUnarchiver *)unarchiver willReplaceObject:object withObject:replacement {
|
||||
NSUInteger index=[_allObjects indexOfObjectIdenticalTo:object];
|
||||
[_allObjects replaceObjectAtIndex:index withObject:replacement];
|
||||
}
|
||||
|
||||
-(NSDictionary *)externalNameTable {
|
||||
return _nameTable;
|
||||
}
|
||||
|
||||
-(BOOL)instantiateNibWithExternalNameTable:(NSDictionary *)nameTable {
|
||||
NSNibKeyedUnarchiver *unarchiver=[[[NSNibKeyedUnarchiver alloc] initForReadingWithData:_data externalNameTable:nameTable] autorelease];
|
||||
_nameTable=[nameTable retain];
|
||||
NSNibKeyedUnarchiver *unarchiver=[[[NSNibKeyedUnarchiver alloc] initForReadingWithData:_data] autorelease];
|
||||
NSIBObjectData *objectData;
|
||||
NSArray *allObjects;
|
||||
int i,count;
|
||||
NSMenu *menu;
|
||||
NSArray *topLevelObjects;
|
||||
|
||||
[unarchiver setDelegate:self];
|
||||
|
||||
/*
|
||||
TO DO:
|
||||
- utf8 in the multinational panel
|
||||
@ -84,7 +105,7 @@ NSString *NSNibTopLevelObjects=@"NSNibTopLevelObjects";
|
||||
[unarchiver setClass:[NSNibHelpConnector class] forClassName:@"NSIBHelpConnector"];
|
||||
|
||||
objectData=[unarchiver decodeObjectForKey:@"IB.objectdata"];
|
||||
|
||||
|
||||
[objectData buildConnectionsWithNameTable:nameTable];
|
||||
if((menu=[objectData mainMenu])!=nil)
|
||||
[NSApp setMainMenu:menu];
|
||||
@ -102,21 +123,20 @@ NSString *NSNibTopLevelObjects=@"NSNibTopLevelObjects";
|
||||
else
|
||||
[topLevelObjects makeObjectsPerformSelector:@selector(retain)];
|
||||
|
||||
allObjects=[unarchiver allObjects];
|
||||
// We do not need to add the objects from nameTable to allObjects as they get put into the uid->object table already
|
||||
// Do we send awakeFromNib to objects in the nameTable *not* present in the nib ?
|
||||
|
||||
count=[allObjects count];
|
||||
count=[_allObjects count];
|
||||
|
||||
for(i=0;i<count;i++){
|
||||
id object=[allObjects objectAtIndex:i];
|
||||
id object=[_allObjects objectAtIndex:i];
|
||||
|
||||
if([object respondsToSelector:@selector(awakeFromNib)])
|
||||
[object awakeFromNib];
|
||||
}
|
||||
|
||||
for(i=0;i<count;i++){
|
||||
id object=[allObjects objectAtIndex:i];
|
||||
id object=[_allObjects objectAtIndex:i];
|
||||
|
||||
if([object respondsToSelector:@selector(postAwakeFromNib)])
|
||||
[object performSelector:@selector(postAwakeFromNib)];
|
||||
@ -124,6 +144,9 @@ NSString *NSNibTopLevelObjects=@"NSNibTopLevelObjects";
|
||||
|
||||
[[objectData visibleWindows] makeObjectsPerformSelector:@selector(makeKeyAndOrderFront:) withObject:nil];
|
||||
|
||||
[_nameTable release];
|
||||
_nameTable=nil;
|
||||
|
||||
return (objectData!=nil);
|
||||
}
|
||||
|
||||
|
@ -8,17 +8,6 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
|
||||
|
||||
#import <Foundation/NSKeyedArchiver.h>
|
||||
|
||||
@interface NSNibKeyedUnarchiver : NSKeyedUnarchiver {
|
||||
NSDictionary *_nameTable;
|
||||
}
|
||||
|
||||
-initForReadingWithData:(NSData *)data externalNameTable:(NSDictionary *)table;
|
||||
|
||||
-(NSDictionary *)externalNameTable;
|
||||
|
||||
-(NSArray *)allObjects;
|
||||
|
||||
-(NSArray *)decodeArrayOfUidsForKey:(NSString *)key;
|
||||
-(void)replaceObject:object atUid:(int)uid;
|
||||
@interface NSNibKeyedUnarchiver : NSKeyedUnarchiver
|
||||
|
||||
@end
|
||||
|
@ -16,73 +16,5 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
|
||||
|
||||
@implementation NSNibKeyedUnarchiver
|
||||
|
||||
-initForReadingWithData:(NSData *)data externalNameTable:(NSDictionary *)table {
|
||||
[super initForReadingWithData:data];
|
||||
_nameTable=[table retain];
|
||||
return self;
|
||||
}
|
||||
|
||||
-(void)dealloc {
|
||||
[_nameTable release];
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
-(NSDictionary *)externalNameTable {
|
||||
return _nameTable;
|
||||
}
|
||||
|
||||
-(NSArray *)allObjects {
|
||||
NSMutableArray *result=[NSMutableArray array];
|
||||
NSMapEnumerator state=NSEnumerateMapTable(_uidToObject);
|
||||
void *key,*value;
|
||||
|
||||
while(NSNextMapEnumeratorPair(&state,&key,&value))
|
||||
if(value!=NULL)
|
||||
[result addObject:(id)value];
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
-(NSArray *)decodeArrayOfUidsForKey:(NSString *)key {
|
||||
NSMutableArray *result=[NSMutableArray array];
|
||||
id plist=[[_plistStack lastObject] objectForKey:key];
|
||||
int i,count;
|
||||
|
||||
if(plist==nil)
|
||||
return nil;
|
||||
|
||||
if(![plist isKindOfClass:[NSDictionary class]])
|
||||
[NSException raise:NSInvalidArgumentException format:@"-[%@ %s] expecting dictionary plist, got %@",isa,sel_getName(_cmd),[plist class]];
|
||||
|
||||
plist=[_objects objectAtIndex:[[plist objectForKey:@"CF$UID"] intValue]];
|
||||
plist=[plist objectForKey:@"NS.objects"];
|
||||
|
||||
if(![plist isKindOfClass:[NSArray class]]){
|
||||
[NSException raise:NSInvalidArgumentException format:@"-[%@ %s] expecting array plist, got %@",isa,sel_getName(_cmd),[plist class]];
|
||||
return nil;
|
||||
}
|
||||
count=[plist count];
|
||||
for(i=0;i<count;i++){
|
||||
NSDictionary *check=[plist objectAtIndex:i];
|
||||
NSNumber *uid;
|
||||
|
||||
if(![check isKindOfClass:[NSDictionary class]])
|
||||
[NSException raise:NSInvalidArgumentException format:@"-[%@ %s] expecting dictionary plist, got %@",isa,sel_getName(_cmd),[plist class]];
|
||||
|
||||
uid=[check objectForKey:@"CF$UID"];
|
||||
|
||||
if(![uid isKindOfClass:[NSNumber class]])
|
||||
[NSException raise:NSInvalidArgumentException format:@"-[%@ %s] expecting number, got %@",isa,sel_getName(_cmd),[plist class]];
|
||||
|
||||
[result addObject:uid];
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
-(void)replaceObject:object atUid:(int)uid {
|
||||
NSMapInsert(_uidToObject,(void *)uid,object);
|
||||
}
|
||||
|
||||
@end
|
||||
|
@ -240,7 +240,6 @@ COREGRAPHICS_EXPORT void CGContextShowTextAtPoint(CGContextRef context,float x,f
|
||||
|
||||
COREGRAPHICS_EXPORT void CGContextDrawShading(CGContextRef context,CGShadingRef shading);
|
||||
COREGRAPHICS_EXPORT void CGContextDrawImage(CGContextRef context,CGRect rect,CGImageRef image);
|
||||
COREGRAPHICS_EXPORT NSData *CGContextCaptureBitmap(CGContextRef context,CGRect rect);
|
||||
COREGRAPHICS_EXPORT void CGContextDrawLayerAtPoint(CGContextRef context,CGPoint point,CGLayerRef layer);
|
||||
COREGRAPHICS_EXPORT void CGContextDrawLayerInRect(CGContextRef context,CGRect rect,CGLayerRef layer);
|
||||
COREGRAPHICS_EXPORT void CGContextDrawPDFPage(CGContextRef context,CGPDFPageRef page);
|
||||
@ -253,11 +252,12 @@ COREGRAPHICS_EXPORT void CGContextSynchronize(CGContextRef context);
|
||||
COREGRAPHICS_EXPORT void CGContextBeginPage(CGContextRef context,const CGRect *mediaBox);
|
||||
COREGRAPHICS_EXPORT void CGContextEndPage(CGContextRef context);
|
||||
|
||||
// private for NSAffineTransform
|
||||
// **PRIVATE** These are private in Apple's implementation as well as ours.
|
||||
|
||||
COREGRAPHICS_EXPORT void CGContextSetCTM(CGContextRef context,CGAffineTransform matrix);
|
||||
COREGRAPHICS_EXPORT void CGContextResetClip(CGContextRef context);
|
||||
|
||||
// Temporary hacks
|
||||
|
||||
COREGRAPHICS_EXPORT void CGContextResetClip(CGContextRef context);
|
||||
|
||||
COREGRAPHICS_EXPORT NSData *CGContextCaptureBitmap(CGContextRef context,CGRect rect);
|
||||
COREGRAPHICS_EXPORT void CGContextCopyBits(CGContextRef context,CGRect rect,CGPoint point,int gState);
|
||||
|
@ -10254,7 +10254,7 @@
|
||||
GCC_PRECOMPILE_PREFIX_HEADER = NO;
|
||||
GCC_VERSION = 4.2;
|
||||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
||||
INFOPLIST_FILE = /Users/cjwl/Cocotron/1.0/rForwarding/Foundation/Info.plist;
|
||||
INFOPLIST_FILE = Info.plist;
|
||||
INSTALL_PATH = /Developer/Cocotron/1.0/Darwin/x86_64/Frameworks;
|
||||
OTHER_CFLAGS = (
|
||||
"-DFOUNDATION_INSIDE_BUILD",
|
||||
@ -10281,7 +10281,7 @@
|
||||
GCC_OPTIMIZATION_LEVEL = 0;
|
||||
GCC_PRECOMPILE_PREFIX_HEADER = NO;
|
||||
GCC_VERSION = 4.2;
|
||||
INFOPLIST_FILE = "/Users/cjwl/Cocotron/1.0/rForwarding/Foundation/Info copy.plist";
|
||||
INFOPLIST_FILE = Info.plist;
|
||||
INSTALL_PATH = /Developer/Cocotron/1.0/Darwin/i386/Frameworks;
|
||||
OTHER_CFLAGS = (
|
||||
"-DFOUNDATION_INSIDE_BUILD",
|
||||
|
@ -71,7 +71,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
|
||||
|
||||
-(BOOL)containsValueForKey:(NSString *)key;
|
||||
|
||||
-(void *)decodeBytesForKey:(NSString *)key returnedLength:(NSUInteger *)lengthp;
|
||||
-(const uint8_t *)decodeBytesForKey:(NSString *)key returnedLength:(NSUInteger *)lengthp;
|
||||
-(NSPoint)decodePointForKey:(NSString *)key;
|
||||
-(NSRect)decodeRectForKey:(NSString *)key;
|
||||
-(NSSize)decodeSizeForKey:(NSString *)key;
|
||||
|
@ -267,7 +267,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
|
||||
return NO;
|
||||
}
|
||||
|
||||
-(void *)decodeBytesForKey:(NSString *)key returnedLength:(NSUInteger *)lengthp {
|
||||
-(const uint8_t *)decodeBytesForKey:(NSString *)key returnedLength:(NSUInteger *)lengthp {
|
||||
*lengthp=0;
|
||||
return NULL;
|
||||
}
|
||||
|
@ -27,7 +27,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
|
||||
|
||||
-(BOOL)containsValueForKey:(NSString *)key;
|
||||
|
||||
-(const void *)decodeBytesForKey:(NSString *)key returnedLength:(NSUInteger *)lengthp;
|
||||
-(const uint8_t *)decodeBytesForKey:(NSString *)key returnedLength:(NSUInteger *)lengthp;
|
||||
-(BOOL)decodeBoolForKey:(NSString *)key;
|
||||
-(double)decodeDoubleForKey:(NSString *)key;
|
||||
-(float)decodeFloatForKey:(NSString *)key;
|
||||
@ -48,3 +48,10 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
|
||||
-(Class)classForClassName:(NSString *)className;
|
||||
|
||||
@end
|
||||
|
||||
@interface NSObject(NSKeyedUnarchiverDelegate)
|
||||
-unarchiver:(NSKeyedUnarchiver *)unarchiver didDecodeObject:object;
|
||||
-(void)unarchiver:(NSKeyedUnarchiver *)unarchiver willReplaceObject:object withObject:replacement;
|
||||
-(Class)unarchiver:(NSKeyedUnarchiver *)unarchiver cannotDecodeObjectOfClassName:(NSString *)className originalClasses:(NSArray *)classHierarchy;
|
||||
@end
|
||||
|
||||
|
@ -94,6 +94,8 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
|
||||
NSMapInsert(_uidToObject,(void *)uidIntValue,result);
|
||||
result=[result awakeAfterUsingCoder:self];
|
||||
[result autorelease];
|
||||
if([_delegate respondsToSelector:@selector(unarchiver:didDecodeObject:)])
|
||||
result=[_delegate unarchiver:self didDecodeObject:result];
|
||||
NSMapInsert(_uidToObject,(void *)uidIntValue,result);
|
||||
[_plistStack removeLastObject];
|
||||
}
|
||||
@ -144,7 +146,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
|
||||
return ([[_plistStack lastObject] objectForKey:key]!=nil)?YES:NO;
|
||||
}
|
||||
|
||||
-(const void *)decodeBytesForKey:(NSString *)key returnedLength:(NSUInteger *)lengthp {
|
||||
-(const uint8_t *)decodeBytesForKey:(NSString *)key returnedLength:(NSUInteger *)lengthp {
|
||||
NSData *data=[[_plistStack lastObject] objectForKey:key];
|
||||
|
||||
*lengthp=[data length];
|
||||
@ -417,6 +419,22 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
|
||||
return result;
|
||||
}
|
||||
|
||||
-(void)replaceObject:object withObject:replacement {
|
||||
NSMapEnumerator state=NSEnumerateMapTable(_uidToObject);
|
||||
void *key,*value;
|
||||
|
||||
while(NSNextMapEnumeratorPair(&state,&key,&value)){
|
||||
if(value==object){
|
||||
|
||||
if([_delegate respondsToSelector:@selector(unarchiver:willReplaceObject:withObject:)])
|
||||
[_delegate unarchiver:self willReplaceObject:value withObject:replacement];
|
||||
|
||||
NSMapInsert(_uidToObject,key,replacement);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
-(void)finishDecoding {
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user