From 99d9d529edb507a094b569575f7917a746c7f525 Mon Sep 17 00:00:00 2001 From: Gregory John Casamento Date: Thu, 22 Apr 2021 07:25:53 -0400 Subject: [PATCH] Add custom object replacement class in archiver --- Plugins/Xib/GormXibWrapperLoader.m | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/Plugins/Xib/GormXibWrapperLoader.m b/Plugins/Xib/GormXibWrapperLoader.m index 02ae3ab8..236ffd0a 100644 --- a/Plugins/Xib/GormXibWrapperLoader.m +++ b/Plugins/Xib/GormXibWrapperLoader.m @@ -87,6 +87,8 @@ // [u setClass: [GormObjectProxy class] forClassName: @"NSCustomObject"]; + [u setClass: [GormObjectProxy class] + forClassName: @"NSCustomObject5"]; [u setClass: [GormCustomView class] forClassName: @"NSCustomView"]; [u setClass: [GormWindowTemplate class] @@ -120,6 +122,7 @@ IBConnectionRecord *cr = nil; NSArray *rootObjects; id firstResponder; + Class ns_custom_obj_class = NSClassFromString(@"NSCustomObject"); rootObjects = [u decodeObjectForKey: @"IBDocument.RootObjects"]; nibFilesOwner = [rootObjects objectAtIndex: 0]; @@ -129,7 +132,8 @@ // // set the current class on the File's owner... // - if ([nibFilesOwner isKindOfClass: [GormObjectProxy class]]) + if ([nibFilesOwner isKindOfClass: ns_custom_obj_class] || + [nibFilesOwner isKindOfClass: [GormObjectProxy class]]) { [docFilesOwner setClassName: [nibFilesOwner className]]; } @@ -147,16 +151,19 @@ // skip the file's owner, it is handled above... if ((obj == nibFilesOwner) || (obj == firstResponder)) - continue; - + { + continue; + } + // - // if it's a window template, then replace it with an actual window. + // if it's a window template, then replace it with an + // actual window. // if ([obj isKindOfClass: [NSWindowTemplate class]]) { NSString *className = [obj className]; BOOL isDeferred = [obj isDeferred]; - BOOL isVisible = YES; // [[container visibleWindows] containsObject: obj]; + BOOL isVisible = YES; // make the object deferred/visible... o = [obj nibInstantiate];