mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-06-01 22:11:55 +00:00
* Source/GSXibLoader.m
* Source/GSXibLoading.m: Merge from trunk of new XIB fixes. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/branches/gnustep_testplant_branch@35483 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
37d5e64967
commit
7b1a15cd96
3 changed files with 120 additions and 3 deletions
|
@ -1,3 +1,8 @@
|
||||||
|
2012-08-31 12:57-EDT Gregory John Casamento <greg.casamento@gmail.com>
|
||||||
|
|
||||||
|
* Source/GSXibLoader.m
|
||||||
|
* Source/GSXibLoading.m: Merge from trunk of new XIB fixes.
|
||||||
|
|
||||||
2012-08-08 Marcian Lytwyn <marcian.lytwyn@advcsi.com>
|
2012-08-08 Marcian Lytwyn <marcian.lytwyn@advcsi.com>
|
||||||
|
|
||||||
* Source/NSFont.m
|
* Source/NSFont.m
|
||||||
|
|
|
@ -35,6 +35,8 @@
|
||||||
#import <Foundation/NSString.h>
|
#import <Foundation/NSString.h>
|
||||||
#import <Foundation/NSValue.h>
|
#import <Foundation/NSValue.h>
|
||||||
#import <Foundation/NSXMLParser.h>
|
#import <Foundation/NSXMLParser.h>
|
||||||
|
#import <Foundation/NSXMLDocument.h>
|
||||||
|
#import <Foundation/NSXMLElement.h>
|
||||||
#import <GNUstepBase/GSMime.h>
|
#import <GNUstepBase/GSMime.h>
|
||||||
|
|
||||||
#import "AppKit/NSApplication.h"
|
#import "AppKit/NSApplication.h"
|
||||||
|
@ -571,6 +573,15 @@
|
||||||
return objectID;
|
return objectID;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (NSString *) description
|
||||||
|
{
|
||||||
|
return [NSString stringWithFormat: @"<%@, %@, %@, %d>",
|
||||||
|
[self className],
|
||||||
|
object,
|
||||||
|
parent,
|
||||||
|
objectID];
|
||||||
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@implementation IBMutableOrderedSet
|
@implementation IBMutableOrderedSet
|
||||||
|
@ -1018,15 +1029,84 @@
|
||||||
|
|
||||||
@implementation GSXibKeyedUnarchiver
|
@implementation GSXibKeyedUnarchiver
|
||||||
|
|
||||||
|
- (NSData *) _preProcessXib: (NSData *)data
|
||||||
|
{
|
||||||
|
NSData *result = nil;
|
||||||
|
NSXMLDocument *document = [[NSXMLDocument alloc] initWithData:data
|
||||||
|
options:0
|
||||||
|
error:NULL];
|
||||||
|
if(document != nil)
|
||||||
|
{
|
||||||
|
NSArray *customClassNodes = [document nodesForXPath:@"//dictionary[@key=\"flattenedProperties\"]/"
|
||||||
|
@"string[contains(@key,\"CustomClassName\")]"
|
||||||
|
error:NULL];
|
||||||
|
if([customClassNodes count] > 0)
|
||||||
|
{
|
||||||
|
NSArray *objectRecords = nil;
|
||||||
|
NSEnumerator *en = [customClassNodes objectEnumerator];
|
||||||
|
id node = nil;
|
||||||
|
|
||||||
|
while((node = [en nextObject]) != nil)
|
||||||
|
{
|
||||||
|
NSXMLNode *keyNode = [node attributeForName:@"key"];
|
||||||
|
NSString *keyValue = [[keyNode stringValue] stringByReplacingOccurrencesOfString:@".CustomClassName"
|
||||||
|
withString:@""];
|
||||||
|
NSString *className = [node stringValue];
|
||||||
|
NSString *objectRecordXpath = nil;
|
||||||
|
|
||||||
|
objectRecordXpath = [NSString stringWithFormat:@"//object[@class=\"IBObjectRecord\"]/"
|
||||||
|
@"int[@key=\"objectID\"][text()=\"%@\"]/../reference",
|
||||||
|
keyValue];
|
||||||
|
|
||||||
|
objectRecords = [document nodesForXPath:objectRecordXpath
|
||||||
|
error:NULL];
|
||||||
|
NSString *refId = nil;
|
||||||
|
if([objectRecords count] > 0)
|
||||||
|
{
|
||||||
|
id record = nil;
|
||||||
|
en = [objectRecords objectEnumerator];
|
||||||
|
while((record = [en nextObject]) != nil)
|
||||||
|
{
|
||||||
|
if([[[record attributeForName:@"key"] stringValue] isEqualToString:@"object"])
|
||||||
|
{
|
||||||
|
NSArray *classNodes = nil;
|
||||||
|
id classNode = nil;
|
||||||
|
NSString *refXpath = nil;
|
||||||
|
|
||||||
|
refId = [[record attributeForName:@"ref"] stringValue];
|
||||||
|
// NSLog(@"Reference Id = %@",refId);
|
||||||
|
refXpath = [NSString stringWithFormat:@"//object[@id=\"%@\"]",refId];
|
||||||
|
classNodes = [document nodesForXPath:refXpath
|
||||||
|
error:NULL];
|
||||||
|
if([classNodes count] > 0)
|
||||||
|
{
|
||||||
|
classNode = [classNodes objectAtIndex:0];
|
||||||
|
// NSLog(@"%@",classNode);
|
||||||
|
[[classNode attributeForName:@"class"] setStringValue:className];
|
||||||
|
// NSLog(@"Changed %@",classNode);
|
||||||
|
result = [document XMLData];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
- (id) initForReadingWithData: (NSData*)data
|
- (id) initForReadingWithData: (NSData*)data
|
||||||
{
|
{
|
||||||
NSXMLParser *theParser;
|
NSXMLParser *theParser;
|
||||||
|
|
||||||
|
NSData *theData = [self _preProcessXib: data];
|
||||||
|
|
||||||
objects = [[NSMutableDictionary alloc] init];
|
objects = [[NSMutableDictionary alloc] init];
|
||||||
stack = [[NSMutableArray alloc] init];
|
stack = [[NSMutableArray alloc] init];
|
||||||
decoded = [[NSMutableDictionary alloc] init];
|
decoded = [[NSMutableDictionary alloc] init];
|
||||||
|
|
||||||
theParser = [[NSXMLParser alloc] initWithData: data];
|
theParser = [[NSXMLParser alloc] initWithData: theData];
|
||||||
[theParser setDelegate: self];
|
[theParser setDelegate: self];
|
||||||
|
|
||||||
NS_DURING
|
NS_DURING
|
||||||
|
@ -1051,7 +1131,7 @@
|
||||||
DESTROY(objects);
|
DESTROY(objects);
|
||||||
DESTROY(stack);
|
DESTROY(stack);
|
||||||
DESTROY(decoded);
|
DESTROY(decoded);
|
||||||
|
|
||||||
[super dealloc];
|
[super dealloc];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1116,9 +1196,11 @@ didStartElement: (NSString*)elementName
|
||||||
|
|
||||||
- (id) allocObjectForClassName: (NSString*)classname
|
- (id) allocObjectForClassName: (NSString*)classname
|
||||||
{
|
{
|
||||||
Class c = [self classForClassName: classname];
|
Class c = nil;
|
||||||
id delegate = [self delegate];
|
id delegate = [self delegate];
|
||||||
|
|
||||||
|
c = [self classForClassName: classname];
|
||||||
|
|
||||||
if (c == nil)
|
if (c == nil)
|
||||||
{
|
{
|
||||||
c = [[self class] classForClassName: classname];
|
c = [[self class] classForClassName: classname];
|
||||||
|
|
|
@ -22,6 +22,12 @@
|
||||||
@interface IBAccessibilityAttribute : NSObject <NSCoding>
|
@interface IBAccessibilityAttribute : NSObject <NSCoding>
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
@interface IBNSLayoutConstraint : NSObject <NSCoding>
|
||||||
|
@end
|
||||||
|
|
||||||
|
@interface IBLayoutConstant : NSObject <NSCoding>
|
||||||
|
@end
|
||||||
|
|
||||||
@implementation IBUserDefinedRuntimeAttributesPlaceholder
|
@implementation IBUserDefinedRuntimeAttributesPlaceholder
|
||||||
|
|
||||||
- (void) encodeWithCoder: (NSCoder *)coder
|
- (void) encodeWithCoder: (NSCoder *)coder
|
||||||
|
@ -92,3 +98,27 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
@implementation IBNSLayoutConstraint
|
||||||
|
- (void) encodeWithCoder: (NSCoder *)coder
|
||||||
|
{
|
||||||
|
// Do nothing...
|
||||||
|
}
|
||||||
|
|
||||||
|
- (id) initWithCoder: (NSCoder *)coder
|
||||||
|
{
|
||||||
|
return self;
|
||||||
|
}
|
||||||
|
@end
|
||||||
|
|
||||||
|
@implementation IBLayoutConstant
|
||||||
|
- (void) encodeWithCoder: (NSCoder *)coder
|
||||||
|
{
|
||||||
|
// Do nothing...
|
||||||
|
}
|
||||||
|
|
||||||
|
- (id) initWithCoder: (NSCoder *)coder
|
||||||
|
{
|
||||||
|
return self;
|
||||||
|
}
|
||||||
|
@end
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue