Move NSCustomObject5 functionality to NSCustomObject

This commit is contained in:
Gregory John Casamento 2020-01-24 02:39:21 -05:00
parent 53452e411e
commit a383b12aef
4 changed files with 33 additions and 56 deletions

View file

@ -217,6 +217,7 @@ typedef struct _GSWindowTemplateFlags
NSString *_className;
NSString *_extension;
id _object;
NSString *_userLabel;
}
- (void) setClassName: (NSString *)name;
- (NSString *)className;
@ -224,6 +225,7 @@ typedef struct _GSWindowTemplateFlags
- (NSString *)extension;
- (void) setRealObject: (id)obj;
- (id) realObject;
- (NSString *) userLabel;
@end
@interface NSCustomView : NSView <GSNibLoading>

View file

@ -49,14 +49,6 @@
- (NSRange) decodeRangeForKey: (NSString*)key;
@end
@interface NSCustomObject5 : NSCustomObject
{
NSString *_userLabel;
}
- (NSString*) userLabel;
@end
@interface IBActionConnection5 : IBActionConnection
{
NSString *trigger;

View file

@ -8,7 +8,7 @@
Copyright (C) 1997, 1999 Free Software Foundation, Inc.
Author: Gregory John Casamento
Date: 2003, 2005
Date: 2003, 2005, 2020
Author: Fred Kiefer
Date: 2003, 2010
@ -958,6 +958,9 @@ static BOOL _isInInterfaceBuilder = NO;
@end
@implementation NSCustomObject
static NSString *ApplicationClass = nil;
- (void) setClassName: (NSString *)name
{
ASSIGNCOPY(_className, name);
@ -995,6 +998,27 @@ static BOOL _isInInterfaceBuilder = NO;
ASSIGN(_className, [coder decodeObjectForKey: @"NSClassName"]);
ASSIGN(_extension, [coder decodeObjectForKey: @"NSExtension"]);
ASSIGN(_object, [coder decodeObjectForKey: @"NSObject"]);
// If we've not set the general application class yet...
if (_className && (ApplicationClass == nil) &&
([NSClassFromString(_className) isKindOfClass: [NSApplication class]]))
{
ASSIGNCOPY(ApplicationClass, _className);
}
_userLabel = [coder decodeObjectForKey: @"userLabel"];
// Override this one type...
if (_userLabel)
{
if ([@"Application" isEqualToString: _userLabel])
{
if (ApplicationClass == nil)
ASSIGN(_className, @"NSApplication");
else
ASSIGN(_className, ApplicationClass);
}
}
}
else
{
@ -1022,6 +1046,11 @@ static BOOL _isInInterfaceBuilder = NO;
}
- (NSString *) userLabel
{
return _userLabel;
}
- (id) nibInstantiate
{
if (_object == nil)

View file

@ -60,52 +60,6 @@
#define DEBUG_XIB5 0
@implementation NSCustomObject5
static NSString *ApplicationClass = nil;
- (id) initWithCoder: (NSCoder *)coder
{
self = [super initWithCoder: coder];
if (self)
{
// If we've not set the general application class yet...
if (_className && (ApplicationClass == nil) &&
([NSClassFromString(_className) isKindOfClass: [NSApplication class]]))
{
ASSIGNCOPY(ApplicationClass, _className);
}
_userLabel = [coder decodeObjectForKey: @"userLabel"];
// Override this one type...
if (_userLabel)
{
if ([@"Application" isEqualToString: _userLabel])
{
if (ApplicationClass == nil)
ASSIGN(_className, @"NSApplication");
else
ASSIGN(_className, ApplicationClass);
}
}
}
return self;
}
- (NSString *) userLabel
{
return _userLabel;
}
- (NSString *) description
{
return [[super description] stringByAppendingFormat: @"%@ - %@", _userLabel, _className];
}
@end
@implementation IBActionConnection5
- (instancetype) initWithCoder: (NSCoder *)coder
@ -292,7 +246,7 @@ static NSArray *XmlBoolDefaultYes = nil;
@"NSMutableArray", @"rowTemplates",
@"NSSegmentItem", @"segment",
@"NSCell", @"customCell",
@"NSCustomObject5", @"customObject",
@"NSCustomObject", @"customObject",
@"IBOutletConnection5", @"outlet",
@"IBActionConnection5", @"action",
@"NSNibBindingConnector", @"binding",