Add code to pull object from map so that connections work properly

This commit is contained in:
Gregory John Casamento 2023-12-16 12:41:08 -05:00
parent 4c2abb1303
commit b919cbb709
2 changed files with 39 additions and 23 deletions

View file

@ -31,6 +31,7 @@
@interface GormXibWrapperLoader : GormWrapperLoader @interface GormXibWrapperLoader : GormWrapperLoader
{ {
NSMutableDictionary *_idToName;
IBObjectContainer *_container; IBObjectContainer *_container;
id _nibFilesOwner; id _nibFilesOwner;
} }

View file

@ -49,11 +49,30 @@
* Xib loader... * Xib loader...
*/ */
@implementation GormXibWrapperLoader @implementation GormXibWrapperLoader
+ (NSString *) fileType + (NSString *) fileType
{ {
return @"GSXibFileType"; return @"GSXibFileType";
} }
- (instancetype) init
{
self = [super init];
if (self != nil)
{
_idToName = [[NSMutableDictionary alloc] init];
_container = nil;
_nibFilesOwner = nil;
}
return self;
}
- (void) dealloc
{
RELEASE(_idToName);
[super dealloc];
}
- (id) _replaceProxyInstanceWithRealObject: (id)obj - (id) _replaceProxyInstanceWithRealObject: (id)obj
classManager: (GormClassManager *)classManager classManager: (GormClassManager *)classManager
withID: (NSString *)theId withID: (NSString *)theId
@ -70,15 +89,6 @@
{ {
return [document firstResponder]; return [document firstResponder];
} }
else
{
[classManager addClassNamed: className
withSuperClassNamed: @"NSObject"
withActions: nil
withOutlets: nil
isCustom: YES];
}
} }
else if ([obj respondsToSelector: @selector(className)]) else if ([obj respondsToSelector: @selector(className)])
{ {
@ -87,7 +97,15 @@
} }
else if (obj == nil) else if (obj == nil)
{ {
return [document firstResponder]; id o = [_idToName objectForKey: theId];
if (o != nil)
{
return o;
}
else
{
return [document firstResponder];
}
} }
return obj; return obj;
@ -135,12 +153,8 @@
// //
// Special internal classes // Special internal classes
// //
/* #pragma GCC diagnostic push
[u setClass: [GormObjectProxy class] #pragma GCC diagnostic ignored "-Wreceiver-forward-class"
forClassName: @"NSCustomObject"];
[u setClass: [GormObjectProxy class]
forClassName: @"NSCustomObject5"];
*/
[u setClass: [GormCustomView class] [u setClass: [GormCustomView class]
forClassName: @"NSCustomView"]; forClassName: @"NSCustomView"];
[u setClass: [GormWindowTemplate class] [u setClass: [GormWindowTemplate class]
@ -151,6 +165,7 @@
forClassName: @"NSMenu"]; forClassName: @"NSMenu"];
[u setClass: [IBUserDefinedRuntimeAttribute class] [u setClass: [IBUserDefinedRuntimeAttribute class]
forClassName: @"IBUserDefinedRuntimeAttribute5"]; forClassName: @"IBUserDefinedRuntimeAttribute5"];
#pragma GCC diagnostic pop
// //
// Substitute any classes specified by the palettes... // Substitute any classes specified by the palettes...
@ -348,13 +363,13 @@
{ {
theName = [doc instantiateClassNamed: customClassName]; theName = [doc instantiateClassNamed: customClassName];
} }
/* // Set up the mapping...
NSDebugLog(@"Assigning %@ as customClass = %@", theName, customClassName); if (theName != nil)
[classManager setCustomClass: customClassName {
forName: theName]; [_idToName setObject: theName forKey: theId];
*/ }
} }
/* /*
* add connections... * add connections...