mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-23 15:11:37 +00:00
Update scenes and update prefix handling for XIB decoding
This commit is contained in:
parent
c15e5cfa6c
commit
463a78a4f7
7 changed files with 90 additions and 17 deletions
|
@ -332,6 +332,7 @@ GSGormLoading.m \
|
|||
GSIconManager.m \
|
||||
GSImageMagickImageRep.m \
|
||||
GSNibLoading.m \
|
||||
GSScenes.m \
|
||||
GSTheme.m \
|
||||
GSThemeDrawing.m \
|
||||
GSThemeInspector.m \
|
||||
|
|
|
@ -81,6 +81,7 @@
|
|||
|
||||
- (instancetype) initWithCoder: (NSCoder *)coder
|
||||
{
|
||||
NSLog(@"Decoding GSScene");
|
||||
if ([coder allowsKeyedCoding])
|
||||
{
|
||||
if ([coder containsValueForKey: @"NSSceneID"])
|
||||
|
|
43
Source/GSScenes.h
Normal file
43
Source/GSScenes.h
Normal file
|
@ -0,0 +1,43 @@
|
|||
/* Interface of class GSScenes
|
||||
Copyright (C) 2024 Free Software Foundation, Inc.
|
||||
|
||||
By: Gregory John Casamento
|
||||
Date: 18-05-2024
|
||||
|
||||
This file is part of the GNUstep Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02110 USA.
|
||||
*/
|
||||
|
||||
#ifndef _GSScenes_h_GNUSTEP_GUI_INCLUDE
|
||||
#define _GSScenes_h_GNUSTEP_GUI_INCLUDE
|
||||
|
||||
#import <Foundation/NSObject.h>
|
||||
|
||||
#if defined(__cplusplus)
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
@interface GSScenes : NSObject
|
||||
|
||||
@end
|
||||
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _GSScenes_h_GNUSTEP_GUI_INCLUDE */
|
||||
|
30
Source/GSScenes.m
Normal file
30
Source/GSScenes.m
Normal file
|
@ -0,0 +1,30 @@
|
|||
/* Implementation of class GSScenes
|
||||
Copyright (C) 2024 Free Software Foundation, Inc.
|
||||
|
||||
By: Gregory John Casamento
|
||||
Date: 18-05-2024
|
||||
|
||||
This file is part of the GNUstep Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02110 USA.
|
||||
*/
|
||||
|
||||
#import "GSScenes.h"
|
||||
|
||||
@implementation GSScenes
|
||||
|
||||
@end
|
||||
|
|
@ -184,13 +184,17 @@
|
|||
|
||||
if (unarchiver != nil)
|
||||
{
|
||||
NSArray *rootObjects;
|
||||
IBObjectContainer *objects;
|
||||
|
||||
NSDebugLLog(@"XIB", @"Invoking unarchiver");
|
||||
[unarchiver setObjectZone: zone];
|
||||
// rootObjects = [unarchiver decodeObjectForKey: @"IBDocument.RootObjects"];
|
||||
rootObjects = [unarchiver decodeObjectForKey: @"IBDocument.RootObjects"];
|
||||
objects = [unarchiver decodeObjectForKey: @"IBDocument.Objects"];
|
||||
NSLog(@"objects %@", objects);
|
||||
|
||||
// NSLog(@"root objects %@", rootObjects);
|
||||
// NSLog(@"objects %@", objects);
|
||||
|
||||
/*
|
||||
[self awake: rootObjects
|
||||
inContainer: objects
|
||||
|
|
|
@ -70,6 +70,7 @@
|
|||
#import "AppKit/NSView.h"
|
||||
|
||||
#import "GSCodingFlags.h"
|
||||
#import "GSScenes.h"
|
||||
#import "GSScene.h"
|
||||
|
||||
#define DEBUG_XIB5 0
|
||||
|
@ -231,8 +232,8 @@ static NSArray *XmlBoolDefaultYes = nil;
|
|||
@"NSStackViewContainer", @"beginningViews",
|
||||
@"NSStackViewContainer", @"middleViews",
|
||||
@"NSStackViewContainer", @"endViews",
|
||||
@"GSScene", @"scene",
|
||||
@"NSMutableArray", @"scenes",
|
||||
// @"GSScene", @"scene",
|
||||
// @"NSMutableArray", @"scenes",
|
||||
nil];
|
||||
RETAIN(XmlTagToObjectClassMap);
|
||||
|
||||
|
@ -242,7 +243,7 @@ static NSArray *XmlBoolDefaultYes = nil;
|
|||
XmlTagsToSkip = [NSArray arrayWithObject: @"dependencies"];
|
||||
RETAIN(XmlTagsToSkip);
|
||||
|
||||
ClassNamePrefixes = [NSArray arrayWithObjects: @"NS", @"IB", nil];
|
||||
ClassNamePrefixes = [NSArray arrayWithObjects: @"NS", @"IB", @"GS", nil];
|
||||
RETAIN(ClassNamePrefixes);
|
||||
|
||||
XmlReferenceAttributes = [NSArray arrayWithObjects: @"headerView", @"initialItem",
|
||||
|
|
|
@ -53,11 +53,7 @@
|
|||
options: 0
|
||||
error: NULL];
|
||||
|
||||
if (document == nil)
|
||||
{
|
||||
return NO;
|
||||
}
|
||||
else
|
||||
if (document)
|
||||
{
|
||||
// Test to see if this is an Xcode 5 XIB...
|
||||
NSArray *documentNodes = [document nodesForXPath: @"/document" error: NULL];
|
||||
|
@ -66,6 +62,8 @@
|
|||
// specific to check here...
|
||||
return [documentNodes count] != 0;
|
||||
}
|
||||
|
||||
return NO;
|
||||
#else
|
||||
|
||||
// We now default to checking XIB 5 versions
|
||||
|
@ -81,11 +79,7 @@
|
|||
options: 0
|
||||
error: NULL];
|
||||
|
||||
if (document == nil)
|
||||
{
|
||||
return NO;
|
||||
}
|
||||
else
|
||||
if (document)
|
||||
{
|
||||
// Test to see if this is an Xcode 5 XIB...
|
||||
NSArray *nodes = [document nodesForXPath: @"/scenes" error: NULL];
|
||||
|
@ -94,11 +88,10 @@
|
|||
// specific to check here...
|
||||
return [nodes count] != 0;
|
||||
}
|
||||
#else
|
||||
#endif
|
||||
|
||||
// We now default to checking XIB 5 versions
|
||||
return NO;
|
||||
#endif
|
||||
}
|
||||
|
||||
+ (NSKeyedUnarchiver *) unarchiverForReadingWithData: (NSData *)data
|
||||
|
|
Loading…
Reference in a new issue