mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-23 07:00:46 +00:00
Replace the NSWindowTemplate5 by the runtime attribute @"NSWindowTemplate.visibleAtLaunch"
This commit is contained in:
parent
8c08f0c4b3
commit
db57ab7885
1 changed files with 26 additions and 49 deletions
|
@ -113,50 +113,6 @@ static NSString *ApplicationClass = nil;
|
|||
|
||||
@end
|
||||
|
||||
@interface NSWindowTemplate5 : NSWindowTemplate
|
||||
{
|
||||
BOOL _visibleAtLaunch;
|
||||
}
|
||||
@end
|
||||
|
||||
@implementation NSWindowTemplate5
|
||||
|
||||
- (id) initWithCoder: (NSCoder *)coder
|
||||
{
|
||||
self = [super initWithCoder: coder];
|
||||
if (self)
|
||||
{
|
||||
_visibleAtLaunch = YES;
|
||||
|
||||
if ([coder containsValueForKey: @"visibleAtLaunch"])
|
||||
{
|
||||
_visibleAtLaunch = [coder decodeBoolForKey: @"visibleAtLaunch"];
|
||||
}
|
||||
}
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
- (id) nibInstantiate
|
||||
{
|
||||
if (_realObject == nil)
|
||||
{
|
||||
// Instantiate the real object...
|
||||
[super nibInstantiate];
|
||||
|
||||
// >= XIB 5 - startup visible windows...
|
||||
if (_visibleAtLaunch)
|
||||
{
|
||||
// bring visible windows to front...
|
||||
[(NSWindow *)_realObject orderFront: self];
|
||||
}
|
||||
}
|
||||
|
||||
return _realObject;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@interface IBActionConnection5 : IBActionConnection
|
||||
{
|
||||
NSString *trigger;
|
||||
|
@ -360,7 +316,7 @@ static NSArray *XmlBoolDefaultYes = nil;
|
|||
@"IBOutletConnection5", @"outlet",
|
||||
@"IBActionConnection5", @"action",
|
||||
@"NSNibBindingConnector", @"binding",
|
||||
@"NSWindowTemplate5", @"window",
|
||||
@"NSWindowTemplate", @"window",
|
||||
@"NSView", @"tableCellView",
|
||||
@"IBUserDefinedRuntimeAttribute5", @"userDefinedRuntimeAttribute",
|
||||
nil];
|
||||
|
@ -700,9 +656,14 @@ static NSArray *XmlBoolDefaultYes = nil;
|
|||
return AUTORELEASE(objectRecord);
|
||||
}
|
||||
|
||||
- (void) addRuntimeAttributesForElement: (GSXibElement*)element forID: (NSString*)idString
|
||||
- (NSString*) getRefIDFor: (GSXibElement*)element postFix: (NSString*)postfix
|
||||
{
|
||||
id orderedObject = [_orderedObjectsDict objectForKey: [element attributeForKey: @"id"]];
|
||||
return [NSString stringWithFormat: @"%@.%@", [orderedObject attributeForKey: @"id"], postfix];
|
||||
}
|
||||
|
||||
- (void) addRuntimeAttributesForElement: (GSXibElement*)element forID: (NSString*)refID
|
||||
{
|
||||
NSString *refID = [NSString stringWithFormat: @"%@.IBAttributePlaceholdersKey", idString];
|
||||
GSXibElement *objectRecord = (GSXibElement*)[_flattenedProperties elementForKey: refID];
|
||||
|
||||
// Mimic the old IBAttributePlaceholders instance...
|
||||
|
@ -2946,8 +2907,24 @@ didStartElement: (NSString*)elementName
|
|||
{
|
||||
// Create the flattened property data for the runtime attributes in the OLD XIB format...
|
||||
id runtimeAttributes = [element elementForKey: @"userDefinedRuntimeAttributes"];
|
||||
id orderedObject = [_orderedObjectsDict objectForKey: [element attributeForKey: @"id"]];
|
||||
[self addRuntimeAttributesForElement: runtimeAttributes forID: [orderedObject attributeForKey: @"id"]];
|
||||
NSString *refID = [self getRefIDFor: element postFix: @"%IBAttributePlaceholdersKey"];
|
||||
|
||||
[self addRuntimeAttributesForElement: runtimeAttributes forID: refID];
|
||||
}
|
||||
else if ([[element attributeForKey: @"key"] isEqualToString: @"window"])
|
||||
{
|
||||
NSString *refID = [self getRefIDFor: element postFix: @"NSWindowTemplate.visibleAtLaunch"];
|
||||
id runtimeAttribute = [[GSXibElement alloc] initWithType: @"string"
|
||||
andAttributes: nil];
|
||||
id visibleAtLaunch = [element attributeForKey: @"visibleAtLaunch"];
|
||||
|
||||
if (visibleAtLaunch == nil)
|
||||
{
|
||||
visibleAtLaunch = @"YES";
|
||||
}
|
||||
[runtimeAttribute setValue: visibleAtLaunch];
|
||||
|
||||
[_flattenedProperties setElement: runtimeAttribute forKey: refID];
|
||||
}
|
||||
|
||||
return object;
|
||||
|
|
Loading…
Reference in a new issue