Changes to facilitate XIB loading in IB/Gorm. Added customClassNames to IBObjectContainer and skipped instantiation of custom classes in GSXib5KeyedUnarchiver if we are currently loading as a model in IB/Gorm.

This commit is contained in:
Gregory John Casamento 2021-04-25 10:04:34 -04:00
parent b97aca9cd4
commit 79fa1b68cd
4 changed files with 29 additions and 4 deletions

View file

@ -1,3 +1,16 @@
2021-04-25 Gregory John Casamento <greg.casamento@gmail.com>
* Headers/Additions/GNUstepGUI/GSXibLoading.h: Add declaration
for customClassNames so that we can use that to collect the names
of all of the custom classes and their associations.
* Source/GNUmakefile: Remove classes which are not used.
* Source/GSXib5KeyedUnarchiver.m: In parserDidStartElement...
call isInInterfaceBuilder to determine if we should allocate
custom classes.
* Source/GSXibLoading.m: Add in code in nibInstantiate which uses
[NSClassSwapper isInInterfaceBuilder] to prevent connections
from being established if the XIB is being loaded in IB/Gorm.
2021-04-23 Gregory John Casamento <greg.casamento@gmail.com>
* Source/Functions.m: QuickFix. Remove unecessary warning

View file

@ -159,6 +159,7 @@
- (id) nibInstantiate;
- (NSEnumerator *) connectionRecordEnumerator;
- (NSEnumerator *) objectRecordEnumerator;
- (NSDictionary *) customClassNames;
@end
@interface IBUserDefinedRuntimeAttributesPlaceholder : NSObject <NSCoding>

View file

@ -760,11 +760,16 @@ didStartElement: (NSString*)elementName
NSString *className = nil;
NSString *elementType = elementName;
if (([@"window" isEqualToString: elementName] == NO) &&
([@"customView" isEqualToString: elementName] == NO) &&
([@"customObject" isEqualToString: elementName] == NO))
// If we are in IB we don't want to handle custom classes since they are
// not linked into the application.
if ([NSClassSwapper isInInterfaceBuilder] == NO)
{
className = [attributes objectForKey: @"customClass"];
if (([@"window" isEqualToString: elementName] == NO) &&
([@"customView" isEqualToString: elementName] == NO) &&
([@"customObject" isEqualToString: elementName] == NO))
{
className = [attributes objectForKey: @"customClass"];
}
}
if (nil == className)

View file

@ -1039,6 +1039,12 @@
NSEnumerator *en;
id obj;
// If we are currently in IB, then don't do anything.
if ([NSClassSwapper isInInterfaceBuilder])
{
return self;
}
// iterate over connections, instantiate, and then establish them.
en = [connectionRecords objectEnumerator];
while ((obj = [en nextObject]) != nil)