Move NuTemplateEditor to Cocoa/Plug-Ins/Template Editor/ and rename many classes to not reference "NuTemplate".
This commit is contained in:
parent
af1db3f963
commit
716fddbfe4
|
@ -1,13 +1,5 @@
|
|||
//
|
||||
// NuTemplateElement.h
|
||||
// ResKnife (PB2)
|
||||
//
|
||||
// Created by Uli Kusterer on Mon Aug 04 2003.
|
||||
// Copyright (c) 2003 M. Uli Kusterer. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import "NuTemplateStream.h"
|
||||
#import "TemplateStream.h"
|
||||
|
||||
/*
|
||||
This is the base class for all template field types. Subclass this to
|
||||
|
@ -20,51 +12,55 @@
|
|||
effective and the object in question isn't mutable).
|
||||
*/
|
||||
|
||||
@interface NuTemplateElement : NSObject <NSCopying>
|
||||
@interface Element : NSObject <NSCopying>
|
||||
{
|
||||
NSString* type; // Type code of this item (4 chars if from TMPL resource, but we may support longer types later).
|
||||
NSString* label; // Label ("name") of this field.
|
||||
NSMutableArray* containing; // The NSMutableArray* of the template field containing us, or the template window's list.
|
||||
BOOL _isTMPL; // for debugging
|
||||
NSString *type; // Type code of this item (4 chars if from TMPL resource, but we may support longer types later).
|
||||
NSString *label; // Label ("name") of this field.
|
||||
NSMutableArray *parentArray; // The NSMutableArray* of the template field containing us, or the template window's list.
|
||||
}
|
||||
|
||||
+(id) elementForType: (NSString*)type withLabel: (NSString*)label;
|
||||
|
||||
-(id) initForType: (NSString*)type withLabel: (NSString*)label;
|
||||
|
||||
// Accessors:
|
||||
-(void) setType:(NSString*)t;
|
||||
-(NSString*) type;
|
||||
|
||||
-(void) setLabel:(NSString*)l;
|
||||
-(NSString*) label;
|
||||
|
||||
-(void) setContaining: (NSMutableArray*)arr;
|
||||
-(NSMutableArray*) containing;
|
||||
|
||||
-(NSString*) stringValue; // Used to display your data in the list.
|
||||
|
||||
// Items that have sub-items (like LSTB, LSTZ, LSTC and other lists) should implement these:
|
||||
-(int) subElementCount;
|
||||
-(NuTemplateElement*) subElementAtIndex: (int)n;
|
||||
-(void) readSubElementsFrom: (NuTemplateStream*)stream;
|
||||
|
||||
// This is called on an item of your class when displaying resource data using a template that uses your field:
|
||||
-(void) readDataFrom: (NuTemplateStream*)stream;
|
||||
+ (id)elementForType:(NSString *)type withLabel:(NSString *)label;
|
||||
- (id)initForType:(NSString *)type withLabel:(NSString *)label;
|
||||
|
||||
// This is used to instantiate copies of the item from the template for storing data of the resource. A copy created with this is then sent readDataFrom:.
|
||||
-(id) copyWithZone: (NSZone*)zone;
|
||||
- (id)copyWithZone:(NSZone *)zone;
|
||||
|
||||
// Accessors:
|
||||
- (void)setIsTMPL:(BOOL)t;
|
||||
- (BOOL)isTMPL;
|
||||
|
||||
- (void)setType:(NSString *)t;
|
||||
- (NSString *)type;
|
||||
|
||||
- (void)setLabel:(NSString *)l;
|
||||
- (NSString *)label;
|
||||
|
||||
- (void)setParentArray:(NSMutableArray *)array;
|
||||
- (NSMutableArray *)parentArray;
|
||||
|
||||
- (NSString *)stringValue; // Used to display your data in the list.
|
||||
- (BOOL)editable;
|
||||
|
||||
// Items that have sub-items (like LSTB, LSTZ, LSTC and other lists) should implement these:
|
||||
- (int)subElementCount;
|
||||
- (Element *)subElementAtIndex:(int)n;
|
||||
- (void)readSubElementsFrom:(TemplateStream *)stream;
|
||||
|
||||
// This is called on an item of your class when displaying resource data using a template that uses your field:
|
||||
- (void)readDataFrom:(TemplateStream *)stream;
|
||||
|
||||
// The following are used to write resource data back out:
|
||||
-(unsigned int) sizeOnDisk;
|
||||
-(void) writeDataTo: (NuTemplateStream*)stream;
|
||||
- (unsigned int)sizeOnDisk;
|
||||
- (void)writeDataTo:(TemplateStream *)stream;
|
||||
|
||||
/* Apart from these messages, a NuTemplateElement may also implement the IBActions for
|
||||
/* Apart from these messages, a Element may also implement the IBActions for
|
||||
the standard edit commands (cut, copy, paste, clear). When an element is selected,
|
||||
the template editor will forward any calls to these items to the element, if it
|
||||
implements them, and it will automatically enable the appropriate menu items. It
|
||||
will also forward validateMenuItem: for the Paste menu item to the element.
|
||||
will also forward validateMenuItem:for the Paste menu item to the element.
|
||||
|
||||
The showCreateResourceSheet: action will also be forwarded to elements by the
|
||||
The createListEntry:action will also be forwarded to elements by the
|
||||
template editor. Use this to allow creating new list items or for similar
|
||||
purposes ("Create New Resource..." is renamed to "Create List Entry" while the
|
||||
template editor is key). */
|
|
@ -0,0 +1,142 @@
|
|||
#import "Element.h"
|
||||
|
||||
@implementation Element
|
||||
|
||||
+ (id)elementForType:(NSString *)t withLabel:(NSString *)l
|
||||
{
|
||||
return [[[self alloc] autorelease] initForType:t withLabel:l];
|
||||
}
|
||||
|
||||
- (id)initForType:(NSString *)t withLabel:(NSString *)l
|
||||
{
|
||||
self = [super init];
|
||||
if(!self) return nil;
|
||||
label = [l copy];
|
||||
type = [t copy];
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)dealloc
|
||||
{
|
||||
[label release];
|
||||
[type release];
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
- (id)copyWithZone:(NSZone *)zone
|
||||
{
|
||||
Element *element = [[[self class] allocWithZone:zone] initForType:type withLabel:label];
|
||||
[element setParentArray:parentArray];
|
||||
return element;
|
||||
}
|
||||
|
||||
#pragma mark -
|
||||
|
||||
- (void)setIsTMPL:(BOOL)t
|
||||
{
|
||||
_isTMPL = t;
|
||||
}
|
||||
|
||||
- (BOOL)isTMPL
|
||||
{
|
||||
return _isTMPL;
|
||||
}
|
||||
|
||||
- (void)setType:(NSString *)t
|
||||
{
|
||||
id old = type;
|
||||
type = [t copy];
|
||||
[old release];
|
||||
}
|
||||
|
||||
- (NSString *)type
|
||||
{
|
||||
return type;
|
||||
}
|
||||
|
||||
- (void)setLabel:(NSString *)l
|
||||
{
|
||||
id old = label;
|
||||
label = [l copy];
|
||||
[old release];
|
||||
}
|
||||
|
||||
- (NSString *)label
|
||||
{
|
||||
return label;
|
||||
}
|
||||
|
||||
- (void)setParentArray:(NSMutableArray *)array
|
||||
{
|
||||
// do not retain parent object
|
||||
parentArray = array;
|
||||
}
|
||||
|
||||
- (NSMutableArray *)parentArray
|
||||
{
|
||||
return parentArray;
|
||||
}
|
||||
|
||||
/*** METHODS SUBCLASSES SHOULD OVERRIDE ***/
|
||||
|
||||
- (int)subElementCount
|
||||
{
|
||||
// default implementation suitable for most element types
|
||||
return 0;
|
||||
}
|
||||
|
||||
- (Element *)subElementAtIndex:(int)n
|
||||
{
|
||||
// default implementation suitable for most element types
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (void)readSubElementsFrom:(TemplateStream *)stream
|
||||
{
|
||||
// by default, items don't read any sub-elements.
|
||||
}
|
||||
|
||||
// You should read whatever kind of data your template field stands for from "stream"
|
||||
// and store it in an instance variable.
|
||||
- (void)readDataFrom:(TemplateStream *)stream
|
||||
{
|
||||
NSLog(@"-readDataFrom:called on non-concrete class Element");
|
||||
}
|
||||
|
||||
// Before writeDataTo:is called, this is called to calculate the final resource size:
|
||||
// Items with sub-elements should return the sum of the sizes of all their sub-elements here as well.
|
||||
- (unsigned int)sizeOnDisk
|
||||
{
|
||||
// default implementation suitable for dimentionless element types
|
||||
return 0;
|
||||
}
|
||||
|
||||
- (void)writeDataTo:(TemplateStream *)stream
|
||||
{
|
||||
NSLog(@"-writeDataTo:called on non-concrete class Element");
|
||||
}
|
||||
|
||||
- (NSString *)stringValue
|
||||
{
|
||||
NSLog(@"-stringValue called on non-concrete class Element");
|
||||
return @"<unknown>";
|
||||
}
|
||||
|
||||
- (void)setStringValue:(NSString *)value
|
||||
{
|
||||
// we need this method, otherwise KVC throws an exception which screws up the table
|
||||
NSLog(@"-setStringValue:@\"%@\" called on non-concrete class Element", value);
|
||||
}
|
||||
|
||||
- (BOOL)editable
|
||||
{
|
||||
// override this for non-editable field types
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (float)rowHeight
|
||||
{
|
||||
return 18.0;
|
||||
}
|
||||
|
||||
@end
|
|
@ -0,0 +1,12 @@
|
|||
#import "Element.h"
|
||||
|
||||
@interface ElementDATE : Element
|
||||
{
|
||||
// seconds since 1 Jan 1904
|
||||
UInt32 value;
|
||||
}
|
||||
- (UInt32)value;
|
||||
- (void)setValue:(UInt32)v;
|
||||
- (NSString *)stringValue;
|
||||
- (void)setStringValue:(NSString *)str;
|
||||
@end
|
|
@ -0,0 +1,64 @@
|
|||
#import "ElementDATE.h"
|
||||
|
||||
@implementation ElementDATE
|
||||
|
||||
- (id)copyWithZone:(NSZone *)zone
|
||||
{
|
||||
ElementDATE *element = [super copyWithZone:zone];
|
||||
[element setValue:value];
|
||||
return element;
|
||||
}
|
||||
|
||||
- (void)readDataFrom:(TemplateStream *)stream
|
||||
{
|
||||
[stream readAmount:sizeof(value) toBuffer:&value];
|
||||
}
|
||||
|
||||
- (unsigned int)sizeOnDisk
|
||||
{
|
||||
return sizeof(value);
|
||||
}
|
||||
|
||||
- (void)writeDataTo:(TemplateStream *)stream
|
||||
{
|
||||
[stream writeAmount:sizeof(value) fromBuffer:&value];
|
||||
}
|
||||
|
||||
- (UInt32)value
|
||||
{
|
||||
return value;
|
||||
}
|
||||
|
||||
- (void)setValue:(UInt32)v
|
||||
{
|
||||
value = v;
|
||||
}
|
||||
|
||||
- (NSString *)stringValue
|
||||
{
|
||||
CFAbsoluteTime cfTime;
|
||||
OSStatus error = UCConvertSecondsToCFAbsoluteTime(value, &cfTime);
|
||||
if(error) return nil;
|
||||
// return [[NSCalendarDate dateWithTimeIntervalSinceReferenceDate:(NSTimeInterval)cfTime] descriptionWithLocale:[NSLocale currentLocale]];
|
||||
return [[NSCalendarDate dateWithTimeIntervalSinceReferenceDate:(NSTimeInterval)cfTime] descriptionWithLocale:[NSDictionary dictionaryWithObject:[[NSUserDefaults standardUserDefaults] objectForKey:NSShortTimeDateFormatString] forKey:@"NSTimeDateFormatString"]];
|
||||
// return [[NSCalendarDate dateWithTimeIntervalSinceReferenceDate:(NSTimeInterval)cfTime] descriptionWithLocale:[NSDictionary dictionaryWithObjectsAndKeys:
|
||||
// [[NSUserDefaults standardUserDefaults] objectForKey:NSShortTimeDateFormatString], @"NSTimeDateFormatString",
|
||||
// [[NSUserDefaults standardUserDefaults] objectForKey:NSAMPMDesignation], @"NSAMPMDesignation",
|
||||
// [[NSUserDefaults standardUserDefaults] objectForKey:NSMonthNameArray], @"NSMonthNameArray",
|
||||
// [[NSUserDefaults standardUserDefaults] objectForKey:NSShortMonthNameArray], @"NSShortMonthNameArray",
|
||||
// [[NSUserDefaults standardUserDefaults] objectForKey:NSWeekDayNameArray], @"NSWeekDayNameArray",
|
||||
// [[NSUserDefaults standardUserDefaults] objectForKey:NSShortWeekDayNameArray], @"NSShortWeekDayNameArray",
|
||||
// nil]];
|
||||
// return [[NSCalendarDate dateWithTimeIntervalSinceReferenceDate:(NSTimeInterval)cfTime] descriptionWithLocale:[NSDictionary dictionaryWithObject:[[NSCalendar currentCalendar] calendarIdentifier] forKey:@"NSLocaleCalendar"]];
|
||||
// return [[NSCalendarDate dateWithTimeIntervalSinceReferenceDate:(NSTimeInterval)cfTime] descriptionWithCalendarFormat:[NSCalendar currentCalendar]];// timeZone:[NSTimeZone localTimeZone] locale:[NSDictionary dictionaryWithObject:[NSCalendar currentCalendar] forKey:@"NSLocaleCalendar"]];
|
||||
|
||||
}
|
||||
|
||||
- (void)setStringValue:(NSString *)str
|
||||
{
|
||||
// UCConvertCFAbsoluteTimeToSeconds((CFAbsoluteTime)[[NSCalendarDate dateWithString:str] timeIntervalSinceReferenceDate], &value);
|
||||
UCConvertCFAbsoluteTimeToSeconds((CFAbsoluteTime)[[NSCalendarDate dateWithNaturalLanguageString:str] timeIntervalSinceReferenceDate], &value);
|
||||
// UCConvertCFAbsoluteTimeToSeconds((CFAbsoluteTime)[[NSCalendarDate dateWithNaturalLanguageString:str locale:[NSDictionary dictionaryWithObject:[NSLocale currentLocale] forKey:@"NSLocale"]] timeIntervalSinceReferenceDate], &value);
|
||||
}
|
||||
|
||||
@end
|
|
@ -0,0 +1,17 @@
|
|||
#import "Element.h"
|
||||
|
||||
@interface ElementDBYT : Element
|
||||
{
|
||||
SInt8 value;
|
||||
}
|
||||
|
||||
- (void)setValue:(SInt8)v;
|
||||
- (SInt8)value;
|
||||
|
||||
- (NSString *)stringValue;
|
||||
- (void)setStringValue:(NSString *)str;
|
||||
|
||||
@end
|
||||
|
||||
@interface ElementKBYT : ElementDBYT
|
||||
@end
|
|
@ -0,0 +1,53 @@
|
|||
#import "ElementDBYT.h"
|
||||
|
||||
@implementation ElementDBYT
|
||||
|
||||
- (id)copyWithZone:(NSZone *)zone
|
||||
{
|
||||
ElementDBYT *element = [super copyWithZone:zone];
|
||||
[element setValue:value];
|
||||
return element;
|
||||
}
|
||||
|
||||
- (void)readDataFrom:(TemplateStream *)stream
|
||||
{
|
||||
[stream readAmount:sizeof(value) toBuffer:&value];
|
||||
}
|
||||
|
||||
- (unsigned int)sizeOnDisk
|
||||
{
|
||||
return sizeof(value);
|
||||
}
|
||||
|
||||
- (void)writeDataTo:(TemplateStream *)stream
|
||||
{
|
||||
[stream writeAmount:sizeof(value) fromBuffer:&value];
|
||||
}
|
||||
|
||||
- (void)setValue:(SInt8)v
|
||||
{
|
||||
value = v;
|
||||
}
|
||||
|
||||
- (SInt8)value
|
||||
{
|
||||
return value;
|
||||
}
|
||||
|
||||
- (NSString *)stringValue
|
||||
{
|
||||
return [NSString stringWithFormat:@"%hhd", value];
|
||||
}
|
||||
|
||||
- (void)setStringValue:(NSString *)str
|
||||
{
|
||||
char cstr[256];
|
||||
char *endPtr = cstr + 255;
|
||||
strncpy(cstr, [str cString], 255);
|
||||
value = strtol(cstr, &endPtr, 10);
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@implementation ElementKBYT
|
||||
@end
|
|
@ -0,0 +1,14 @@
|
|||
#import "Element.h"
|
||||
|
||||
@interface ElementDLLG : Element
|
||||
{
|
||||
SInt64 value;
|
||||
}
|
||||
|
||||
- (void)setValue:(SInt64)v;
|
||||
- (SInt64)value;
|
||||
|
||||
- (NSString *)stringValue;
|
||||
- (void)setStringValue:(NSString *)str;
|
||||
|
||||
@end
|
|
@ -0,0 +1,50 @@
|
|||
#import "ElementDLLG.h"
|
||||
|
||||
@implementation ElementDLLG
|
||||
|
||||
- (id)copyWithZone:(NSZone*)zone
|
||||
{
|
||||
ElementDLLG *element = [super copyWithZone:zone];
|
||||
[element setValue:value];
|
||||
return element;
|
||||
}
|
||||
|
||||
- (void)readDataFrom:(TemplateStream *)stream
|
||||
{
|
||||
[stream readAmount:sizeof(value) toBuffer:&value];
|
||||
}
|
||||
|
||||
- (unsigned int)sizeOnDisk
|
||||
{
|
||||
return sizeof(value);
|
||||
}
|
||||
|
||||
- (void)writeDataTo:(TemplateStream *)stream
|
||||
{
|
||||
[stream writeAmount:sizeof(value) fromBuffer:&value];
|
||||
}
|
||||
|
||||
- (void)setValue:(SInt64)v
|
||||
{
|
||||
value = v;
|
||||
}
|
||||
|
||||
- (SInt64)value
|
||||
{
|
||||
return value;
|
||||
}
|
||||
|
||||
- (NSString *)stringValue
|
||||
{
|
||||
return [NSString stringWithFormat:@"%lld", value];
|
||||
}
|
||||
|
||||
- (void)setStringValue:(NSString *)str
|
||||
{
|
||||
char cstr[256];
|
||||
char *endPtr = cstr + 255;
|
||||
strncpy(cstr, [str cString], 255);
|
||||
value = strtoll(cstr, &endPtr, 10);
|
||||
}
|
||||
|
||||
@end
|
|
@ -0,0 +1,17 @@
|
|||
#import "Element.h"
|
||||
|
||||
@interface ElementDLNG : Element
|
||||
{
|
||||
SInt32 value;
|
||||
}
|
||||
|
||||
- (void)setValue:(SInt32)v;
|
||||
- (SInt32)value;
|
||||
|
||||
- (NSString *)stringValue;
|
||||
- (void)setStringValue:(NSString *)str;
|
||||
|
||||
@end
|
||||
|
||||
@interface ElementKLNG : ElementDLNG
|
||||
@end
|
|
@ -0,0 +1,53 @@
|
|||
#import "ElementDLNG.h"
|
||||
|
||||
@implementation ElementDLNG
|
||||
|
||||
- (id)copyWithZone:(NSZone *)zone
|
||||
{
|
||||
ElementDLNG *element = [super copyWithZone:zone];
|
||||
[element setValue:value];
|
||||
return element;
|
||||
}
|
||||
|
||||
- (void)readDataFrom:(TemplateStream *)stream
|
||||
{
|
||||
[stream readAmount:sizeof(value) toBuffer:&value];
|
||||
}
|
||||
|
||||
- (unsigned int)sizeOnDisk
|
||||
{
|
||||
return sizeof(value);
|
||||
}
|
||||
|
||||
- (void)writeDataTo:(TemplateStream *)stream
|
||||
{
|
||||
[stream writeAmount:sizeof(value) fromBuffer:&value];
|
||||
}
|
||||
|
||||
- (void)setValue:(SInt32)v
|
||||
{
|
||||
value = v;
|
||||
}
|
||||
|
||||
- (SInt32)value
|
||||
{
|
||||
return value;
|
||||
}
|
||||
|
||||
- (NSString *)stringValue
|
||||
{
|
||||
return [NSString stringWithFormat:@"%ld", value];
|
||||
}
|
||||
|
||||
- (void)setStringValue:(NSString *)str
|
||||
{
|
||||
char cstr[256];
|
||||
char *endPtr = cstr + 255;
|
||||
strncpy(cstr, [str cString], 255);
|
||||
value = strtol(cstr, &endPtr, 10);
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@implementation ElementKLNG
|
||||
@end
|
|
@ -0,0 +1,17 @@
|
|||
#import "Element.h"
|
||||
|
||||
@interface ElementDWRD : Element
|
||||
{
|
||||
SInt16 value;
|
||||
}
|
||||
|
||||
- (void)setValue:(SInt16)v;
|
||||
- (SInt16)value;
|
||||
|
||||
- (NSString *)stringValue;
|
||||
- (void)setStringValue:(NSString *)str;
|
||||
|
||||
@end
|
||||
|
||||
@interface ElementKWRD : ElementDWRD
|
||||
@end
|
|
@ -0,0 +1,53 @@
|
|||
#import "ElementDWRD.h"
|
||||
|
||||
@implementation ElementDWRD
|
||||
|
||||
- (id)copyWithZone:(NSZone *)zone
|
||||
{
|
||||
ElementDWRD *element = [super copyWithZone:zone];
|
||||
[element setValue:value];
|
||||
return element;
|
||||
}
|
||||
|
||||
- (void)readDataFrom:(TemplateStream *)stream
|
||||
{
|
||||
[stream readAmount:sizeof(value) toBuffer:&value];
|
||||
}
|
||||
|
||||
- (unsigned int)sizeOnDisk
|
||||
{
|
||||
return sizeof(value);
|
||||
}
|
||||
|
||||
- (void)writeDataTo:(TemplateStream *)stream
|
||||
{
|
||||
[stream writeAmount:sizeof(value) fromBuffer:&value];
|
||||
}
|
||||
|
||||
- (void)setValue:(SInt16)v
|
||||
{
|
||||
value = v;
|
||||
}
|
||||
|
||||
- (SInt16)value
|
||||
{
|
||||
return value;
|
||||
}
|
||||
|
||||
- (NSString *)stringValue
|
||||
{
|
||||
return [NSString stringWithFormat:@"%hd", value];
|
||||
}
|
||||
|
||||
- (void)setStringValue:(NSString *)str
|
||||
{
|
||||
char cstr[256];
|
||||
char *endPtr = cstr + 255;
|
||||
strncpy(cstr, [str cString], 255);
|
||||
value = strtol(cstr, &endPtr, 10);
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@implementation ElementKWRD
|
||||
@end
|
|
@ -0,0 +1,14 @@
|
|||
#import "Element.h"
|
||||
|
||||
@interface ElementFBYT : Element
|
||||
{
|
||||
unsigned long length;
|
||||
}
|
||||
|
||||
- (void)setLength:(unsigned long)l;
|
||||
- (unsigned long)length;
|
||||
|
||||
- (NSString *)stringValue;
|
||||
- (void)setStringValue:(NSString *)str;
|
||||
|
||||
@end
|
|
@ -0,0 +1,70 @@
|
|||
#import "ElementFBYT.h"
|
||||
|
||||
// implements FBYT, FWRD, FLNG, FLLG
|
||||
@implementation ElementFBYT
|
||||
|
||||
- (id)initForType:(NSString *)t withLabel:(NSString *)l
|
||||
{
|
||||
self = [super initForType:t withLabel:l];
|
||||
if(!self) return nil;
|
||||
if ([t isEqualToString:@"FBYT"]) length = 1;
|
||||
else if([t isEqualToString:@"FWRD"]) length = 2;
|
||||
else if([t isEqualToString:@"FLNG"]) length = 4;
|
||||
else if([t isEqualToString:@"FLLG"]) length = 8;
|
||||
else length = 0;
|
||||
return self;
|
||||
}
|
||||
|
||||
- (id)copyWithZone:(NSZone *)zone
|
||||
{
|
||||
ElementFBYT *element = [super copyWithZone:zone];
|
||||
[element setLength:length];
|
||||
return element;
|
||||
}
|
||||
|
||||
- (void)readDataFrom:(TemplateStream *)stream
|
||||
{
|
||||
[stream advanceAmount:length pad:NO];
|
||||
}
|
||||
|
||||
- (unsigned int)sizeOnDisk
|
||||
{
|
||||
return length;
|
||||
}
|
||||
|
||||
- (void)writeDataTo:(TemplateStream *)stream
|
||||
{
|
||||
[stream advanceAmount:length pad:YES];
|
||||
}
|
||||
|
||||
- (void)setLength:(unsigned long)l
|
||||
{
|
||||
length = l;
|
||||
}
|
||||
|
||||
- (unsigned long)length
|
||||
{
|
||||
return length;
|
||||
}
|
||||
|
||||
- (NSString *)stringValue
|
||||
{
|
||||
return @"";
|
||||
}
|
||||
|
||||
- (void)setStringValue:(NSString *)str
|
||||
{
|
||||
}
|
||||
|
||||
- (NSString *)label
|
||||
{
|
||||
if(length) return @"";
|
||||
return [super label];
|
||||
}
|
||||
|
||||
- (BOOL)editable
|
||||
{
|
||||
return NO;
|
||||
}
|
||||
|
||||
@end
|
|
@ -0,0 +1,14 @@
|
|||
#import "Element.h"
|
||||
|
||||
@interface ElementFIXD : Element
|
||||
{
|
||||
Fixed value;
|
||||
}
|
||||
|
||||
- (void)setValue:(Fixed)v;
|
||||
- (Fixed)value;
|
||||
|
||||
- (NSString *)stringValue;
|
||||
- (void)setStringValue:(NSString *)str;
|
||||
|
||||
@end
|
|
@ -0,0 +1,50 @@
|
|||
#import "ElementFIXD.h"
|
||||
|
||||
@implementation ElementFIXD
|
||||
|
||||
- (id)copyWithZone:(NSZone *)zone
|
||||
{
|
||||
ElementFIXD *element = [super copyWithZone:zone];
|
||||
[element setValue:value];
|
||||
return element;
|
||||
}
|
||||
|
||||
- (void)readDataFrom:(TemplateStream *)stream
|
||||
{
|
||||
[stream readAmount:sizeof(value) toBuffer:&value];
|
||||
}
|
||||
|
||||
- (unsigned int)sizeOnDisk
|
||||
{
|
||||
return sizeof(value);
|
||||
}
|
||||
|
||||
- (void)writeDataTo:(TemplateStream *)stream
|
||||
{
|
||||
[stream writeAmount:sizeof(value) fromBuffer:&value];
|
||||
}
|
||||
|
||||
- (void)setValue:(Fixed)v
|
||||
{
|
||||
value = v;
|
||||
}
|
||||
|
||||
- (Fixed)value
|
||||
{
|
||||
return value;
|
||||
}
|
||||
|
||||
- (NSString *)stringValue
|
||||
{
|
||||
return [NSString stringWithFormat:@"%.3lf", FixedToFloat(value)];
|
||||
}
|
||||
|
||||
- (void)setStringValue:(NSString *)str
|
||||
{
|
||||
char cstr[256];
|
||||
char *endPtr = cstr + 255;
|
||||
strncpy(cstr, [str cString], 255);
|
||||
value = FloatToFixed(strtof(cstr, &endPtr));
|
||||
}
|
||||
|
||||
@end
|
|
@ -0,0 +1,14 @@
|
|||
#import "Element.h"
|
||||
|
||||
@interface ElementFRAC : Element
|
||||
{
|
||||
Fract value;
|
||||
}
|
||||
|
||||
- (void)setValue:(Fract)v;
|
||||
- (Fract)value;
|
||||
|
||||
- (NSString *)stringValue;
|
||||
- (void)setStringValue:(NSString *)str;
|
||||
|
||||
@end
|
|
@ -0,0 +1,50 @@
|
|||
#import "ElementFRAC.h"
|
||||
|
||||
@implementation ElementFRAC
|
||||
|
||||
- (id)copyWithZone:(NSZone *)zone
|
||||
{
|
||||
ElementFRAC *element = [super copyWithZone:zone];
|
||||
[element setValue:value];
|
||||
return element;
|
||||
}
|
||||
|
||||
- (void)readDataFrom:(TemplateStream *)stream
|
||||
{
|
||||
[stream readAmount:sizeof(value) toBuffer:&value];
|
||||
}
|
||||
|
||||
- (unsigned int)sizeOnDisk
|
||||
{
|
||||
return sizeof(value);
|
||||
}
|
||||
|
||||
- (void)writeDataTo:(TemplateStream *)stream
|
||||
{
|
||||
[stream writeAmount:sizeof(value) fromBuffer:&value];
|
||||
}
|
||||
|
||||
- (void)setValue:(Fract)v
|
||||
{
|
||||
value = v;
|
||||
}
|
||||
|
||||
- (Fract)value
|
||||
{
|
||||
return value;
|
||||
}
|
||||
|
||||
- (NSString *)stringValue
|
||||
{
|
||||
return [NSString stringWithFormat:@"%.10lg", FractToFloat(value)];
|
||||
}
|
||||
|
||||
- (void)setStringValue:(NSString *)str
|
||||
{
|
||||
char cstr[256];
|
||||
char *endPtr = cstr + 255;
|
||||
strncpy(cstr, [str cString], 255);
|
||||
value = FloatToFract(strtof(cstr, &endPtr));
|
||||
}
|
||||
|
||||
@end
|
|
@ -0,0 +1,13 @@
|
|||
#import "Element.h"
|
||||
|
||||
@interface ElementHEXD : Element
|
||||
{
|
||||
NSData *value;
|
||||
}
|
||||
- (void)setValue:(NSData *)d;
|
||||
- (NSData *)value;
|
||||
|
||||
- (NSString *)stringValue;
|
||||
- (void)setStringValue:(NSString *)str;
|
||||
|
||||
@end
|
|
@ -0,0 +1,64 @@
|
|||
#import "ElementHEXD.h"
|
||||
|
||||
@implementation ElementHEXD
|
||||
|
||||
- (id)copyWithZone:(NSZone *)zone
|
||||
{
|
||||
ElementHEXD *element = [super copyWithZone:zone];
|
||||
[element setValue:value];
|
||||
return element;
|
||||
}
|
||||
|
||||
- (void)readSubElementsFrom:(TemplateStream *)stream
|
||||
{
|
||||
// override to tell stream to stop reading any more TMPL fields
|
||||
if([stream bytesToGo] > 0)
|
||||
{
|
||||
NSLog(@"Warning: Template has fields following hex dump, ignoring them.");
|
||||
[stream setBytesToGo:0];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)readDataFrom:(TemplateStream *)stream
|
||||
{
|
||||
[self setValue:[NSData dataWithBytes:[stream data] length:[stream bytesToGo]]];
|
||||
[stream setBytesToGo:0];
|
||||
}
|
||||
|
||||
- (unsigned int)sizeOnDisk
|
||||
{
|
||||
return [value length];
|
||||
}
|
||||
|
||||
- (void)writeDataTo:(TemplateStream *)stream
|
||||
{
|
||||
[stream writeAmount:[value length] fromBuffer:[value bytes]];
|
||||
}
|
||||
|
||||
- (void)setValue:(NSData *)d
|
||||
{
|
||||
id old = value;
|
||||
value = [d retain];
|
||||
[old release];
|
||||
}
|
||||
|
||||
- (NSData *)value
|
||||
{
|
||||
return value;
|
||||
}
|
||||
|
||||
- (NSString *)stringValue
|
||||
{
|
||||
return [value description];
|
||||
}
|
||||
|
||||
- (void)setStringValue:(NSString *)str
|
||||
{
|
||||
}
|
||||
|
||||
- (BOOL)editable
|
||||
{
|
||||
return NO;
|
||||
}
|
||||
|
||||
@end
|
|
@ -0,0 +1,15 @@
|
|||
#import <Cocoa/Cocoa.h>
|
||||
#import "Element.h"
|
||||
|
||||
@interface ElementKEYB : Element
|
||||
{
|
||||
NSMutableArray *subElements;
|
||||
}
|
||||
|
||||
- (void)setSubElements:(NSMutableArray *)a;
|
||||
- (NSMutableArray *)subElements;
|
||||
|
||||
@end
|
||||
|
||||
@interface ElementKEYE : Element
|
||||
@end
|
|
@ -0,0 +1,105 @@
|
|||
#import "ElementKEYB.h"
|
||||
|
||||
@implementation ElementKEYB
|
||||
|
||||
- (id)initForType:(NSString *)t withLabel:(NSString *)l
|
||||
{
|
||||
self = [super initForType:t withLabel:l];
|
||||
if(!self) return nil;
|
||||
subElements = [[NSMutableArray alloc] init];
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)dealloc
|
||||
{
|
||||
[subElements release];
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
- (id)copyWithZone:(NSZone *)zone
|
||||
{
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (void)readSubElementsFrom:(TemplateStream *)stream
|
||||
{
|
||||
while([stream bytesToGo] > 0)
|
||||
{
|
||||
Element *element = [stream readOneElement];
|
||||
if([[element type] isEqualToString:@"KEYE"])
|
||||
break;
|
||||
[subElements addObject:element];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)readDataFrom:(TemplateStream *)stream
|
||||
{
|
||||
if([[self label] isEqualToString: [[stream key] stringValue]])
|
||||
{
|
||||
for(unsigned i = 0; i < [subElements count]; i++)
|
||||
[[subElements objectAtIndex:i] readDataFrom:stream];
|
||||
}
|
||||
}
|
||||
|
||||
// Before writeDataTo:is called, this is called to calculate the final resource size:
|
||||
// This returns the sizes of all our sub-elements. If you subclass, add to that the size
|
||||
// of this element itself.
|
||||
- (unsigned int)sizeOnDisk
|
||||
{
|
||||
// if(![[self label] isEqualToString: [[stream key] stringValue]])
|
||||
// return 0;
|
||||
|
||||
unsigned int size = 0;
|
||||
NSEnumerator *enumerator = [subElements objectEnumerator];
|
||||
while(Element *element = [enumerator nextObject])
|
||||
size += [element sizeOnDisk];
|
||||
return size;
|
||||
}
|
||||
|
||||
- (void)writeDataTo:(TemplateStream *)stream
|
||||
{
|
||||
if([[self label] isEqualToString: [[stream key] stringValue]])
|
||||
{
|
||||
// writes out the data of all our sub-elements here:
|
||||
NSEnumerator *enumerator = [subElements objectEnumerator];
|
||||
while(Element *element = [enumerator nextObject])
|
||||
[element writeDataTo:stream];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)setSubElements:(NSMutableArray *)a
|
||||
{
|
||||
id old = subElements;
|
||||
subElements = [a retain];
|
||||
[old release];
|
||||
}
|
||||
|
||||
- (NSMutableArray *)subElements
|
||||
{
|
||||
return subElements;
|
||||
}
|
||||
|
||||
- (int)subElementCount
|
||||
{
|
||||
return [subElements count];
|
||||
}
|
||||
|
||||
- (Element *)subElementAtIndex:(int)n
|
||||
{
|
||||
return [subElements objectAtIndex:n];
|
||||
}
|
||||
|
||||
- (NSString *)stringValue { return @""; }
|
||||
- (void)setStringValue:(NSString *)str {}
|
||||
- (BOOL)editable { return NO; }
|
||||
@end
|
||||
|
||||
#pragma mark -
|
||||
|
||||
@implementation ElementKEYE
|
||||
- (void)readDataFrom:(TemplateStream *)stream {}
|
||||
- (void)writeDataTo:(TemplateStream *)stream {}
|
||||
- (NSString *)stringValue { return @""; }
|
||||
- (void)setStringValue:(NSString *)str {}
|
||||
- (BOOL)editable { return NO; }
|
||||
@end
|
|
@ -0,0 +1,26 @@
|
|||
#import <Cocoa/Cocoa.h>
|
||||
#import "Element.h"
|
||||
|
||||
@class ElementLSTE;
|
||||
@class ElementOCNT;
|
||||
|
||||
@interface ElementLSTB : Element
|
||||
{
|
||||
NSMutableArray *subElements;
|
||||
ElementLSTB *groupElementTemplate; // TMPL equivalent of self, for cloning
|
||||
ElementOCNT *countElement; // Our "list counter" element.
|
||||
}
|
||||
|
||||
- (void)readDataForElements:(TemplateStream *)stream;
|
||||
- (IBAction)createListEntry:(id)sender;
|
||||
|
||||
- (void)setSubElements:(NSMutableArray *)a;
|
||||
- (NSMutableArray *)subElements;
|
||||
|
||||
- (void)setGroupElementTemplate:(ElementLSTB *)e;
|
||||
- (ElementLSTB *)groupElementTemplate;
|
||||
|
||||
- (void)setCountElement:(ElementOCNT *)e;
|
||||
- (ElementOCNT *)countElement;
|
||||
|
||||
@end
|
|
@ -0,0 +1,249 @@
|
|||
#import "ElementLSTB.h"
|
||||
#import "ElementLSTC.h"
|
||||
#import "ElementLSTE.h"
|
||||
#import "ElementOCNT.h"
|
||||
|
||||
// implements LSTB, LSTZ
|
||||
@implementation ElementLSTB
|
||||
|
||||
- (id)initForType:(NSString *)t withLabel:(NSString *)l
|
||||
{
|
||||
self = [super initForType:t withLabel:l];
|
||||
if(!self) return nil;
|
||||
subElements = [[NSMutableArray alloc] init];
|
||||
groupElementTemplate = self;
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)dealloc
|
||||
{
|
||||
[subElements release];
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
- (id)copyWithZone:(NSZone *)zone
|
||||
{
|
||||
ElementLSTB *element = [super copyWithZone:zone];
|
||||
if(!element) return nil;
|
||||
|
||||
ElementOCNT *counter = nil;
|
||||
NSMutableArray *array = [element subElements]; // get empty array created by -initWithType:label:
|
||||
[element setGroupElementTemplate:groupElementTemplate]; // override group template (init sets this to self)
|
||||
unsigned count = [[groupElementTemplate subElements] count];
|
||||
for(unsigned i = 0; i < count; i++)
|
||||
{
|
||||
Element *subToClone = [[groupElementTemplate subElements] objectAtIndex:i];
|
||||
if([subToClone class] == [ElementLSTB class] ||
|
||||
[subToClone class] == [ElementLSTC class])
|
||||
{
|
||||
// instead create a terminating 'LSTE' item, using LSTB/C item's label
|
||||
ElementLSTE *end = [ElementLSTE elementForType:@"LSTE" withLabel:[subToClone label]];
|
||||
[array addObject:end];
|
||||
[end setParentArray:array];
|
||||
[end setGroupElementTemplate:[(id)subToClone groupElementTemplate]];
|
||||
[end setCountElement:counter];
|
||||
if([[subToClone type] isEqualToString:@"LSTZ"])
|
||||
[end setWritesZeroByte:YES];
|
||||
}
|
||||
else
|
||||
{
|
||||
Element *clone = [[subToClone copy] autorelease];
|
||||
if([clone class] == [ElementOCNT class])
|
||||
counter = (ElementOCNT *)clone;
|
||||
[array addObject:clone];
|
||||
}
|
||||
}
|
||||
return element;
|
||||
}
|
||||
|
||||
- (void)readSubElementsFrom:(TemplateStream *)stream
|
||||
{
|
||||
while([stream bytesToGo] > 0)
|
||||
{
|
||||
Element *element = [stream readOneElement];
|
||||
if([[element type] isEqualToString:@"LSTE"])
|
||||
{
|
||||
if([type isEqualToString:@"LSTZ"])
|
||||
[(ElementLSTE *)element setWritesZeroByte:YES];
|
||||
break;
|
||||
}
|
||||
[subElements addObject:element];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)readDataForElements:(TemplateStream *)stream
|
||||
{
|
||||
int counterValue = 0;
|
||||
ElementOCNT *counter = nil;
|
||||
for(unsigned i = 0; i < [subElements count]; i++)
|
||||
{
|
||||
Element *element = [subElements objectAtIndex:i];
|
||||
|
||||
// set up the counter tracking
|
||||
if([element class] == [ElementOCNT class]) counter = (ElementOCNT *) element;
|
||||
|
||||
// decrement the counter if we have list items
|
||||
if([element class] == [ElementLSTC class]) counterValue--;
|
||||
|
||||
// if we get to the end of the list and need more items, create them
|
||||
if([element class] == [ElementLSTE class] && counterValue > 0)
|
||||
{
|
||||
int index = [subElements indexOfObject:element];
|
||||
while(counterValue--)
|
||||
{
|
||||
// create subarray for new data
|
||||
ElementLSTB *list = [[[(ElementLSTE *)element groupElementTemplate] copy] autorelease];
|
||||
[subElements insertObject:list atIndex:index++];
|
||||
[list setParentArray:subElements];
|
||||
[list setCountElement:counter];
|
||||
|
||||
// read data into it and increment loop
|
||||
[list readDataForElements:stream]; i++;
|
||||
}
|
||||
}
|
||||
|
||||
// actually read the data for this item
|
||||
[element readDataFrom:stream];
|
||||
|
||||
// now that we've read the (possibly counter) data, save it to the local variable
|
||||
if(counter) counterValue = [counter value];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)readDataFrom:(TemplateStream *)stream
|
||||
{
|
||||
BOOL isZeroTerminated = [type isEqualToString:@"LSTZ"];
|
||||
unsigned int bytesToGoAtStart = [stream bytesToGo];
|
||||
if(isZeroTerminated)
|
||||
{
|
||||
char termByte = 0;
|
||||
[stream peekAmount:1 toBuffer:&termByte];
|
||||
if(termByte)
|
||||
[self readDataForElements:stream];
|
||||
}
|
||||
else [self readDataForElements:stream];
|
||||
|
||||
/* Read additional elements until we have enough items,
|
||||
except if we're not the first item in our list. */
|
||||
if(parentArray)
|
||||
{
|
||||
while([stream bytesToGo] > 0)
|
||||
{
|
||||
if(isZeroTerminated)
|
||||
{
|
||||
char termByte = 0;
|
||||
[stream peekAmount:1 toBuffer:&termByte];
|
||||
if(termByte == 0) break;
|
||||
}
|
||||
|
||||
// actually read the item
|
||||
Element *nextItem = [[groupElementTemplate copy] autorelease];
|
||||
[nextItem setParentArray:nil]; // Make sure it doesn't get into this "if" clause.
|
||||
[parentArray addObject:nextItem]; // Add it below ourselves.
|
||||
[nextItem readDataFrom:stream]; // Read it the same way we were.
|
||||
[nextItem setParentArray:parentArray]; // Set parentArray *after* -readDataFrom: so it doesn't pass the if(parentArray) check above.
|
||||
}
|
||||
|
||||
// now add a terminating 'LSTE' item, using this item's label
|
||||
ElementLSTE *end = [ElementLSTE elementForType:@"LSTE" withLabel:label];
|
||||
[parentArray addObject:end];
|
||||
[end setParentArray:parentArray];
|
||||
[end setGroupElementTemplate:groupElementTemplate];
|
||||
[end setCountElement:countElement];
|
||||
if(isZeroTerminated)
|
||||
{
|
||||
[end setWritesZeroByte:YES];
|
||||
[end readDataFrom:stream];
|
||||
}
|
||||
|
||||
// if it's an empty list delete this LSTB so we only have the empty LSTE.
|
||||
if(bytesToGoAtStart == 0)
|
||||
[parentArray removeObject:self];
|
||||
}
|
||||
}
|
||||
|
||||
// Before writeDataTo:is called, this is called to calculate the final resource size:
|
||||
// This returns the sizes of all our sub-elements. If you subclass, add to that the size
|
||||
// of this element itself.
|
||||
- (unsigned int)sizeOnDisk
|
||||
{
|
||||
unsigned int size = 0;
|
||||
NSEnumerator *enumerator = [subElements objectEnumerator];
|
||||
while(Element *element = [enumerator nextObject])
|
||||
size += [element sizeOnDisk];
|
||||
return size;
|
||||
}
|
||||
|
||||
- (void)writeDataTo:(TemplateStream *)stream
|
||||
{
|
||||
// Writes out the data of all our sub-elements here:
|
||||
NSEnumerator *enumerator = [subElements objectEnumerator];
|
||||
while(Element *element = [enumerator nextObject])
|
||||
[element writeDataTo:stream];
|
||||
}
|
||||
|
||||
#pragma mark -
|
||||
|
||||
- (void)setSubElements:(NSMutableArray *)a
|
||||
{
|
||||
id old = subElements;
|
||||
subElements = [a retain];
|
||||
[old release];
|
||||
}
|
||||
|
||||
- (NSMutableArray *)subElements
|
||||
{
|
||||
return subElements;
|
||||
}
|
||||
|
||||
- (int)subElementCount
|
||||
{
|
||||
return [subElements count];
|
||||
}
|
||||
|
||||
- (Element *)subElementAtIndex:(int)n
|
||||
{
|
||||
return [subElements objectAtIndex:n];
|
||||
}
|
||||
|
||||
- (void)setGroupElementTemplate:(ElementLSTB *)e
|
||||
{
|
||||
// do not retain, -init sets this to 'self' initially!
|
||||
groupElementTemplate = e;
|
||||
}
|
||||
|
||||
- (ElementLSTB *)groupElementTemplate
|
||||
{
|
||||
return groupElementTemplate;
|
||||
}
|
||||
|
||||
- (void)setCountElement:(ElementOCNT *)e
|
||||
{
|
||||
// do not retain sibling element
|
||||
countElement = e;
|
||||
}
|
||||
|
||||
- (ElementOCNT *)countElement
|
||||
{
|
||||
return countElement;
|
||||
}
|
||||
|
||||
- (IBAction)createListEntry:(id)sender
|
||||
{
|
||||
ElementLSTB *list = [[groupElementTemplate copy] autorelease];
|
||||
[parentArray insertObject:list atIndex:[parentArray indexOfObject:self]];
|
||||
[list setParentArray:parentArray];
|
||||
[list setCountElement:countElement];
|
||||
[countElement increment];
|
||||
}
|
||||
|
||||
- (IBAction)clear:(id)sender
|
||||
{
|
||||
[countElement decrement];
|
||||
[parentArray removeObject:self];
|
||||
}
|
||||
|
||||
- (NSString *)stringValue { return @""; }
|
||||
- (void)setStringValue:(NSString *)str {}
|
||||
- (BOOL)editable { return NO; }
|
||||
@end
|
|
@ -0,0 +1,4 @@
|
|||
#import "ElementLSTB.h"
|
||||
|
||||
@interface ElementLSTC : ElementLSTB
|
||||
@end
|
|
@ -0,0 +1,60 @@
|
|||
#import <Cocoa/Cocoa.h>
|
||||
#import "ElementLSTC.h"
|
||||
#import "ElementLSTE.h"
|
||||
#import "ElementOCNT.h"
|
||||
|
||||
@implementation ElementLSTC
|
||||
|
||||
- (void)readSubElementsFrom:(TemplateStream *)stream
|
||||
{
|
||||
while([stream bytesToGo] > 0)
|
||||
{
|
||||
Element *element = [stream readOneElement];
|
||||
if([[element type] isEqualToString:@"LSTE"])
|
||||
break;
|
||||
[subElements addObject:element];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)readDataFrom:(TemplateStream *)stream
|
||||
{
|
||||
[self setCountElement:[stream counter]];
|
||||
unsigned int itemsToGo = [countElement value];
|
||||
unsigned int itemsToGoAtStart = itemsToGo;
|
||||
|
||||
// Read a first item:
|
||||
if(itemsToGo > 0)
|
||||
{
|
||||
[self readDataForElements:stream];
|
||||
itemsToGo--;
|
||||
}
|
||||
|
||||
/* Read additional elements until we have enough items,
|
||||
except if we're not the first item in our list. */
|
||||
if(parentArray)
|
||||
{
|
||||
while(itemsToGo--)
|
||||
{
|
||||
// Actually read the item:
|
||||
Element *nextItem = [[groupElementTemplate copy] autorelease]; // Make another list item just like this one.
|
||||
[nextItem setParentArray:nil]; // Make sure it doesn't get into this "if" clause.
|
||||
[parentArray addObject:nextItem]; // Add it below ourselves.
|
||||
[nextItem readDataFrom:stream]; // Read it the same way we were.
|
||||
[nextItem setParentArray:parentArray]; // Set parentArray *after* -readDataFrom: so it doesn't pass the if(parentArray) check above.
|
||||
}
|
||||
|
||||
// now add a terminating 'LSTE' item, using this item's label
|
||||
ElementLSTE *end = [ElementLSTE elementForType:@"LSTE" withLabel:label];
|
||||
[parentArray addObject:end];
|
||||
[end setParentArray:parentArray];
|
||||
[end setGroupElementTemplate:groupElementTemplate];
|
||||
[end setCountElement:countElement];
|
||||
[stream popCounter];
|
||||
|
||||
// if it's an empty list delete this LSTC so we only have the empty LSTE.
|
||||
if(itemsToGoAtStart == 0)
|
||||
[parentArray removeObject:self];
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
|
@ -0,0 +1,24 @@
|
|||
#import <Cocoa/Cocoa.h>
|
||||
#import "Element.h"
|
||||
|
||||
@class ElementOCNT;
|
||||
@class ElementLSTB;
|
||||
@interface ElementLSTE : Element
|
||||
{
|
||||
ElementLSTB *groupElementTemplate; // The item of which we're to create a copy.
|
||||
ElementOCNT *countElement; // The "counter" element if we're the end of an LSTC list.
|
||||
BOOL writesZeroByte; // Write a terminating zero-byte when writing out this item (used by LSTZ).
|
||||
}
|
||||
|
||||
- (IBAction)createListEntry:(id)sender;
|
||||
|
||||
- (void)setWritesZeroByte:(BOOL)n;
|
||||
- (BOOL)writesZeroByte;
|
||||
|
||||
- (void)setGroupElementTemplate:(ElementLSTB *)e;
|
||||
- (ElementLSTB *)groupElementTemplate;
|
||||
|
||||
- (void)setCountElement:(ElementOCNT *)e;
|
||||
- (ElementOCNT *)countElement;
|
||||
|
||||
@end
|
|
@ -0,0 +1,99 @@
|
|||
#import "ElementLSTE.h"
|
||||
#import "ElementLSTB.h"
|
||||
#import "ElementOCNT.h"
|
||||
|
||||
@implementation ElementLSTE
|
||||
|
||||
- (id)copyWithZone:(NSZone *)zone
|
||||
{
|
||||
ElementLSTE *element = [super copyWithZone:zone];
|
||||
[element setGroupElementTemplate:groupElementTemplate];
|
||||
[element setWritesZeroByte:writesZeroByte];
|
||||
[element setCountElement:countElement];
|
||||
return element;
|
||||
}
|
||||
|
||||
- (void)dealloc
|
||||
{
|
||||
[groupElementTemplate release];
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
- (void)setGroupElementTemplate:(ElementLSTB *)e
|
||||
{
|
||||
id old = groupElementTemplate;
|
||||
groupElementTemplate = [e retain];
|
||||
[old release];
|
||||
}
|
||||
|
||||
- (ElementLSTB *)groupElementTemplate
|
||||
{
|
||||
return groupElementTemplate;
|
||||
}
|
||||
|
||||
- (void)setCountElement:(ElementOCNT *)e
|
||||
{
|
||||
// do not retain sibling element
|
||||
countElement = e;
|
||||
}
|
||||
|
||||
- (ElementOCNT *)countElement
|
||||
{
|
||||
return countElement;
|
||||
}
|
||||
|
||||
- (void)readSubElementsFrom:(TemplateStream *)stream
|
||||
{
|
||||
}
|
||||
|
||||
- (void)readDataFrom:(TemplateStream *)stream
|
||||
{
|
||||
if(writesZeroByte)
|
||||
[stream advanceAmount:1 pad:NO];
|
||||
}
|
||||
|
||||
- (unsigned int)sizeOnDisk
|
||||
{
|
||||
return writesZeroByte? 1:0;
|
||||
}
|
||||
|
||||
- (void)writeDataTo:(TemplateStream *)stream
|
||||
{
|
||||
if(writesZeroByte)
|
||||
[stream advanceAmount:1 pad:YES];
|
||||
}
|
||||
|
||||
- (void)setWritesZeroByte:(BOOL)n
|
||||
{
|
||||
writesZeroByte = n;
|
||||
}
|
||||
|
||||
- (BOOL)writesZeroByte
|
||||
{
|
||||
return writesZeroByte;
|
||||
}
|
||||
|
||||
- (IBAction)createListEntry:(id)sender
|
||||
{
|
||||
ElementLSTB *list = [[groupElementTemplate copy] autorelease];
|
||||
[parentArray insertObject:list atIndex:[parentArray indexOfObject:self]];
|
||||
[list setParentArray:parentArray];
|
||||
[list setCountElement:countElement];
|
||||
[countElement increment];
|
||||
}
|
||||
|
||||
- (NSString *)stringValue
|
||||
{
|
||||
return @"";
|
||||
}
|
||||
|
||||
- (void)setStringValue:(NSString *)str
|
||||
{
|
||||
}
|
||||
|
||||
- (BOOL)editable
|
||||
{
|
||||
return NO;
|
||||
}
|
||||
|
||||
@end
|
|
@ -0,0 +1,19 @@
|
|||
#import "Element.h"
|
||||
|
||||
@interface ElementOCNT : Element
|
||||
{
|
||||
unsigned long value;
|
||||
}
|
||||
|
||||
- (BOOL)countFromZero;
|
||||
|
||||
- (void)setValue:(unsigned long)v;
|
||||
- (unsigned long)value;
|
||||
|
||||
- (void)increment;
|
||||
- (void)decrement;
|
||||
|
||||
- (NSString *)stringValue;
|
||||
- (void)setStringValue:(NSString *)str;
|
||||
|
||||
@end
|
|
@ -0,0 +1,85 @@
|
|||
#import "ElementOCNT.h"
|
||||
|
||||
// implements ZCNT, OCNT, BCNT, BZCT, WCNT, WZCT, LCNT, LZCT
|
||||
@implementation ElementOCNT
|
||||
|
||||
- (id)copyWithZone:(NSZone *)zone
|
||||
{
|
||||
ElementOCNT *element = [super copyWithZone:zone];
|
||||
if(!element) return nil;
|
||||
|
||||
// always reset counter on copy
|
||||
[element setValue:0];
|
||||
return element;
|
||||
}
|
||||
|
||||
- (void)readDataFrom:(TemplateStream *)stream
|
||||
{
|
||||
value = 0;
|
||||
if ([type isEqualToString:@"LCNT"] || [type isEqualToString:@"LZCT"]) [stream readAmount:4 toBuffer:&value];
|
||||
else if([type isEqualToString:@"BCNT"] || [type isEqualToString:@"BZCT"]) [stream readAmount:1 toBuffer:(char *)(&value)+3];
|
||||
else [stream readAmount:2 toBuffer:(short *)(&value)+1];
|
||||
if([self countFromZero]) value += 1;
|
||||
}
|
||||
|
||||
- (unsigned int)sizeOnDisk
|
||||
{
|
||||
if ([type isEqualToString:@"LCNT"] || [type isEqualToString:@"LZCT"]) return 4;
|
||||
else if([type isEqualToString:@"BCNT"] || [type isEqualToString:@"BZCT"]) return 1;
|
||||
else return 2;
|
||||
}
|
||||
|
||||
- (void)writeDataTo:(TemplateStream *)stream
|
||||
{
|
||||
if([self countFromZero]) value -= 1;
|
||||
if ([type isEqualToString:@"LCNT"] || [type isEqualToString:@"LZCT"]) [stream writeAmount:4 fromBuffer:&value];
|
||||
else if([type isEqualToString:@"BCNT"] || [type isEqualToString:@"BZCT"]) [stream writeAmount:1 fromBuffer:(char *)(&value)+3];
|
||||
else [stream writeAmount:2 fromBuffer:(short *)(&value)+1];
|
||||
if([self countFromZero]) value += 1;
|
||||
}
|
||||
|
||||
- (BOOL)countFromZero
|
||||
{
|
||||
return [type isEqualToString:@"ZCNT"] ||
|
||||
[type isEqualToString:@"BZCT"] ||
|
||||
[type isEqualToString:@"WZCT"] ||
|
||||
[type isEqualToString:@"LZCT"];
|
||||
}
|
||||
|
||||
- (void)setValue:(unsigned long)v
|
||||
{
|
||||
value = v;
|
||||
}
|
||||
|
||||
- (unsigned long)value
|
||||
{
|
||||
return value;
|
||||
}
|
||||
|
||||
- (void)increment
|
||||
{
|
||||
[self setValue:value+1]; // using -setValue for KVO
|
||||
}
|
||||
|
||||
- (void)decrement
|
||||
{
|
||||
if(value > 0)
|
||||
[self setValue:value-1];
|
||||
}
|
||||
|
||||
- (NSString *)stringValue
|
||||
{
|
||||
return [NSString stringWithFormat:@"%ld", value];
|
||||
}
|
||||
|
||||
- (void)setStringValue:(NSString *)str
|
||||
{
|
||||
}
|
||||
|
||||
- (BOOL)editable
|
||||
{
|
||||
return NO;
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
@ -0,0 +1,30 @@
|
|||
#import "Element.h"
|
||||
|
||||
enum StringPadding
|
||||
{
|
||||
kNoPadding = 0,
|
||||
kPadToOddLength,
|
||||
kPadToEvenLength
|
||||
};
|
||||
|
||||
@interface ElementPSTR : Element
|
||||
{
|
||||
NSString *value;
|
||||
UInt32 _maxLength; // for restricted strings
|
||||
UInt32 _minLength;
|
||||
enum StringPadding _pad; // for odd- and even-padded strings
|
||||
BOOL _terminatingByte; // for C strings
|
||||
int _lengthBytes; // for Pascal strings
|
||||
int _alignment; // pads end to align on multiple of this
|
||||
}
|
||||
|
||||
- (NSString *)stringValue;
|
||||
- (void)setStringValue:(NSString *)str;
|
||||
- (void)setMaxLength:(UInt32)v;
|
||||
- (void)setMinLength:(UInt32)v;
|
||||
- (void)setPad:(enum StringPadding)v;
|
||||
- (void)setTerminatingByte:(BOOL)v;
|
||||
- (void)setLengthBytes:(int)v;
|
||||
- (void)setAlignment:(int)v;
|
||||
|
||||
@end
|
|
@ -0,0 +1,154 @@
|
|||
#import "ElementPSTR.h"
|
||||
|
||||
// implements PSTR, OSTR, ESTR, BSTR, WSTR, LSTR, CSTR, OCST, ECST, CHAR, TNAM
|
||||
@implementation ElementPSTR
|
||||
|
||||
- (id)initForType:(NSString *)t withLabel:(NSString *)l
|
||||
{
|
||||
self = [super initForType:t withLabel:l];
|
||||
if(!self) return nil;
|
||||
value = [@"" retain];
|
||||
if ([t isEqualToString:@"PSTR"] ||
|
||||
[t isEqualToString:@"BSTR"]) { _lengthBytes = 1; _maxLength = UINT8_MAX; _minLength = 0; _terminatingByte = NO; _pad = kNoPadding; _alignment = 0; }
|
||||
else if([t isEqualToString:@"WSTR"]) { _lengthBytes = 2; _maxLength = UINT16_MAX; _minLength = 0; _terminatingByte = NO; _pad = kNoPadding; _alignment = 0; }
|
||||
else if([t isEqualToString:@"LSTR"]) { _lengthBytes = 4; _maxLength = UINT32_MAX; _minLength = 0; _terminatingByte = NO; _pad = kNoPadding; _alignment = 0; }
|
||||
else if([t isEqualToString:@"OSTR"]) { _lengthBytes = 1; _maxLength = UINT8_MAX-1; _minLength = 0; _terminatingByte = NO; _pad = kPadToOddLength; _alignment = 0; }
|
||||
else if([t isEqualToString:@"ESTR"]) { _lengthBytes = 1; _maxLength = UINT8_MAX; _minLength = 0; _terminatingByte = NO; _pad = kPadToEvenLength; _alignment = 0; }
|
||||
else if([t isEqualToString:@"CSTR"]) { _lengthBytes = 0; _maxLength = 0; _minLength = 0; _terminatingByte = YES; _pad = kNoPadding; _alignment = 0; }
|
||||
else if([t isEqualToString:@"OCST"]) { _lengthBytes = 0; _maxLength = 0; _minLength = 0; _terminatingByte = YES; _pad = kPadToOddLength; _alignment = 0; }
|
||||
else if([t isEqualToString:@"ECST"]) { _lengthBytes = 0; _maxLength = 0; _minLength = 0; _terminatingByte = YES; _pad = kPadToEvenLength; _alignment = 0; }
|
||||
else if([t isEqualToString:@"CHAR"]) { _lengthBytes = 0; _maxLength = 1; _minLength = 1; _terminatingByte = NO; _pad = kNoPadding; _alignment = 0; }
|
||||
else if([t isEqualToString:@"TNAM"]) { _lengthBytes = 0; _maxLength = 4; _minLength = 4; _terminatingByte = NO; _pad = kNoPadding; _alignment = 0; }
|
||||
// temp until keyed values are implemented
|
||||
else if([t isEqualToString:@"KCHR"]) { _lengthBytes = 0; _maxLength = 1; _minLength = 1; _terminatingByte = NO; _pad = kNoPadding; _alignment = 0; }
|
||||
else if([t isEqualToString:@"KTYP"]) { _lengthBytes = 0; _maxLength = 4; _minLength = 4; _terminatingByte = NO; _pad = kNoPadding; _alignment = 0; }
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)dealloc
|
||||
{
|
||||
[value release];
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
- (id)copyWithZone:(NSZone*)zone
|
||||
{
|
||||
ElementPSTR *element = [super copyWithZone:zone];
|
||||
[element setStringValue:value];
|
||||
[element setMaxLength:_maxLength];
|
||||
[element setMinLength:_minLength];
|
||||
[element setPad:_pad];
|
||||
[element setTerminatingByte:_terminatingByte];
|
||||
[element setLengthBytes:_lengthBytes];
|
||||
[element setAlignment:_alignment];
|
||||
return element;
|
||||
}
|
||||
|
||||
- (void)readDataFrom:(TemplateStream *)stream
|
||||
{
|
||||
// get string length
|
||||
UInt32 length = 0;
|
||||
if(_lengthBytes > 0)
|
||||
{
|
||||
[stream readAmount:_lengthBytes toBuffer:&length];
|
||||
length >>= (4 - _lengthBytes) << 3;
|
||||
}
|
||||
if(_terminatingByte)
|
||||
length += [stream bytesToNull];
|
||||
if(_maxLength && length > _maxLength) length = _maxLength;
|
||||
if(length < _minLength) length = _minLength;
|
||||
|
||||
// read string
|
||||
void *buffer = malloc(length);
|
||||
if(_minLength) memset(buffer, 0, _minLength);
|
||||
[stream readAmount:length toBuffer:buffer];
|
||||
if([NSString instancesRespondToSelector:@selector(initWithBytesNoCopy:length:encoding:freeWhenDone:)]) // 10.3
|
||||
[self setStringValue:[[[NSString alloc] initWithBytesNoCopy:buffer length:length encoding:NSMacOSRomanStringEncoding freeWhenDone:YES] autorelease]];
|
||||
else
|
||||
{
|
||||
[self setStringValue:[[[NSString alloc] initWithBytes:buffer length:length encoding:NSMacOSRomanStringEncoding] autorelease]];
|
||||
free(buffer);
|
||||
}
|
||||
|
||||
// skip over empty bytes
|
||||
if(_terminatingByte) [stream advanceAmount:1 pad:NO];
|
||||
if(_pad == kPadToOddLength && (length + _lengthBytes) % 2 == 0) [stream advanceAmount:1 pad:NO];
|
||||
if(_pad == kPadToEvenLength && (length + _lengthBytes) % 2 == 1) [stream advanceAmount:1 pad:NO];
|
||||
// alignment unhandled here
|
||||
}
|
||||
|
||||
- (unsigned int)sizeOnDisk
|
||||
{
|
||||
UInt32 length;
|
||||
if([value respondsToSelector:@selector(lengthOfBytesUsingEncoding:)]) // 10.4
|
||||
length = [value lengthOfBytesUsingEncoding:NSMacOSRomanStringEncoding];
|
||||
else length = [value cStringLength];
|
||||
if(_maxLength && length > _maxLength) length = _maxLength;
|
||||
if(length < _minLength) length = _minLength;
|
||||
length += _lengthBytes + (_terminatingByte? 1:0);
|
||||
if(_pad == kPadToOddLength && length % 2 == 0) length++;
|
||||
if(_pad == kPadToEvenLength && length % 2 == 1) length++;
|
||||
// don't know how to deal with alignment here
|
||||
return length;
|
||||
}
|
||||
|
||||
- (void)writeDataTo:(TemplateStream *)stream
|
||||
{
|
||||
// write string
|
||||
UInt32 length = [value length], writeLength;
|
||||
if(_maxLength && length > _maxLength) length = _maxLength;
|
||||
writeLength = length << ((4 - _lengthBytes) << 3);
|
||||
if(_lengthBytes)
|
||||
[stream writeAmount:_lengthBytes fromBuffer:&writeLength];
|
||||
|
||||
#warning FIXME: This code should display a warning saying that the string in the PSTR is not MacOSRoman
|
||||
if([value respondsToSelector:@selector(cStringUsingEncoding:)])
|
||||
{
|
||||
const void *buffer = [value cStringUsingEncoding:NSMacOSRomanStringEncoding];
|
||||
if(buffer) [stream writeAmount:length fromBuffer:buffer];
|
||||
else [stream advanceAmount:length pad:YES];
|
||||
}
|
||||
else
|
||||
{
|
||||
const void *buffer = [value cString];
|
||||
if(buffer) [stream writeAmount:length fromBuffer:buffer];
|
||||
else [stream advanceAmount:length pad:YES];
|
||||
}
|
||||
|
||||
// pad to minimum length with spaces
|
||||
if(length < _minLength)
|
||||
{
|
||||
SInt32 padAmount = _minLength - length;
|
||||
while(padAmount > 0)
|
||||
{
|
||||
UInt32 spaces = ' ';
|
||||
[stream writeAmount:(padAmount < 4)? padAmount:4 fromBuffer:&spaces];
|
||||
length += (padAmount < 4)? padAmount:4;
|
||||
padAmount -= 4;
|
||||
}
|
||||
}
|
||||
if(_terminatingByte) [stream advanceAmount:1 pad:YES];
|
||||
if(_pad == kPadToOddLength && (length + _lengthBytes + (_terminatingByte? 1:0)) % 2 == 0) [stream advanceAmount:1 pad:YES];
|
||||
if(_pad == kPadToEvenLength && (length + _lengthBytes + (_terminatingByte? 1:0)) % 2 == 1) [stream advanceAmount:1 pad:YES];
|
||||
}
|
||||
|
||||
- (NSString *)stringValue
|
||||
{
|
||||
return value;
|
||||
}
|
||||
|
||||
- (void)setStringValue:(NSString *)str
|
||||
{
|
||||
id old = value;
|
||||
value = [str copy];
|
||||
[old release];
|
||||
}
|
||||
|
||||
- (void)setMaxLength:(UInt32)v { _maxLength = v; }
|
||||
- (void)setMinLength:(UInt32)v { _minLength = v; }
|
||||
- (void)setPad:(enum StringPadding)v { _pad = v; }
|
||||
- (void)setTerminatingByte:(BOOL)v { _terminatingByte = v; }
|
||||
- (void)setLengthBytes:(int)v { _lengthBytes = v; }
|
||||
- (void)setAlignment:(int)v { _alignment = v; }
|
||||
|
||||
@end
|
|
@ -0,0 +1,14 @@
|
|||
#import "Element.h"
|
||||
|
||||
@interface ElementUBYT : Element
|
||||
{
|
||||
UInt8 value;
|
||||
}
|
||||
|
||||
- (void)setValue:(UInt8)v;
|
||||
- (UInt8)value;
|
||||
|
||||
- (NSString *)stringValue;
|
||||
- (void)setStringValue:(NSString *)str;
|
||||
|
||||
@end
|
|
@ -0,0 +1,50 @@
|
|||
#import "ElementUBYT.h"
|
||||
|
||||
@implementation ElementUBYT
|
||||
|
||||
- (id)copyWithZone:(NSZone *)zone
|
||||
{
|
||||
ElementUBYT *element = [super copyWithZone:zone];
|
||||
[element setValue:value];
|
||||
return element;
|
||||
}
|
||||
|
||||
- (void)readDataFrom:(TemplateStream *)stream
|
||||
{
|
||||
[stream readAmount:sizeof(value) toBuffer:&value];
|
||||
}
|
||||
|
||||
- (unsigned int)sizeOnDisk
|
||||
{
|
||||
return sizeof(value);
|
||||
}
|
||||
|
||||
- (void)writeDataTo:(TemplateStream *)stream
|
||||
{
|
||||
[stream writeAmount:sizeof(value) fromBuffer:&value];
|
||||
}
|
||||
|
||||
- (void)setValue:(UInt8)v
|
||||
{
|
||||
value = v;
|
||||
}
|
||||
|
||||
- (UInt8)value
|
||||
{
|
||||
return value;
|
||||
}
|
||||
|
||||
- (NSString *)stringValue
|
||||
{
|
||||
return [NSString stringWithFormat:@"%hhu", value];
|
||||
}
|
||||
|
||||
- (void)setStringValue:(NSString *)str
|
||||
{
|
||||
char cstr[256];
|
||||
char *endPtr = cstr + 255;
|
||||
strncpy(cstr, [str cString], 255);
|
||||
value = strtoul(cstr, &endPtr, 10);
|
||||
}
|
||||
|
||||
@end
|
|
@ -0,0 +1,14 @@
|
|||
#import "Element.h"
|
||||
|
||||
@interface ElementULLG : Element
|
||||
{
|
||||
UInt64 value;
|
||||
}
|
||||
|
||||
- (void)setValue:(UInt64)v;
|
||||
- (UInt64)value;
|
||||
|
||||
- (NSString *)stringValue;
|
||||
- (void)setStringValue:(NSString *)str;
|
||||
|
||||
@end
|
|
@ -0,0 +1,50 @@
|
|||
#import "ElementULLG.h"
|
||||
|
||||
@implementation ElementULLG
|
||||
|
||||
- (id)copyWithZone:(NSZone*)zone
|
||||
{
|
||||
ElementULLG *element = [super copyWithZone:zone];
|
||||
[element setValue:value];
|
||||
return element;
|
||||
}
|
||||
|
||||
- (void)readDataFrom:(TemplateStream *)stream
|
||||
{
|
||||
[stream readAmount:sizeof(value) toBuffer:&value];
|
||||
}
|
||||
|
||||
- (unsigned int)sizeOnDisk
|
||||
{
|
||||
return sizeof(value);
|
||||
}
|
||||
|
||||
- (void)writeDataTo:(TemplateStream *)stream
|
||||
{
|
||||
[stream writeAmount:sizeof(value) fromBuffer:&value];
|
||||
}
|
||||
|
||||
- (void)setValue:(UInt64)v
|
||||
{
|
||||
value = v;
|
||||
}
|
||||
|
||||
- (UInt64)value
|
||||
{
|
||||
return value;
|
||||
}
|
||||
|
||||
- (NSString *)stringValue
|
||||
{
|
||||
return [NSString stringWithFormat:@"%llu", value];
|
||||
}
|
||||
|
||||
- (void)setStringValue:(NSString *)str
|
||||
{
|
||||
char cstr[256];
|
||||
char *endPtr = cstr + 255;
|
||||
strncpy(cstr, [str cString], 255);
|
||||
value = strtoull(cstr, &endPtr, 10);
|
||||
}
|
||||
|
||||
@end
|
|
@ -0,0 +1,14 @@
|
|||
#import "Element.h"
|
||||
|
||||
@interface ElementULNG : Element
|
||||
{
|
||||
UInt32 value;
|
||||
}
|
||||
|
||||
- (void)setValue:(UInt32)v;
|
||||
- (UInt32)value;
|
||||
|
||||
- (NSString *)stringValue;
|
||||
- (void)setStringValue:(NSString *)str;
|
||||
|
||||
@end
|
|
@ -0,0 +1,50 @@
|
|||
#import "ElementULNG.h"
|
||||
|
||||
@implementation ElementULNG
|
||||
|
||||
- (id)copyWithZone:(NSZone *)zone
|
||||
{
|
||||
ElementULNG *element = [super copyWithZone:zone];
|
||||
[element setValue:value];
|
||||
return element;
|
||||
}
|
||||
|
||||
- (void)readDataFrom:(TemplateStream *)stream
|
||||
{
|
||||
[stream readAmount:sizeof(value) toBuffer:&value];
|
||||
}
|
||||
|
||||
- (unsigned int)sizeOnDisk
|
||||
{
|
||||
return sizeof(value);
|
||||
}
|
||||
|
||||
- (void)writeDataTo:(TemplateStream *)stream
|
||||
{
|
||||
[stream writeAmount:sizeof(value) fromBuffer:&value];
|
||||
}
|
||||
|
||||
- (void)setValue:(UInt32)v
|
||||
{
|
||||
value = v;
|
||||
}
|
||||
|
||||
- (UInt32)value
|
||||
{
|
||||
return value;
|
||||
}
|
||||
|
||||
- (NSString *)stringValue
|
||||
{
|
||||
return [NSString stringWithFormat:@"%lu", value];
|
||||
}
|
||||
|
||||
- (void)setStringValue:(NSString *)str
|
||||
{
|
||||
char cstr[256];
|
||||
char *endPtr = cstr + 255;
|
||||
strncpy(cstr, [str cString], 255);
|
||||
value = strtoul(cstr, &endPtr, 10);
|
||||
}
|
||||
|
||||
@end
|
|
@ -0,0 +1,14 @@
|
|||
#import "Element.h"
|
||||
|
||||
@interface ElementUWRD : Element
|
||||
{
|
||||
UInt16 value;
|
||||
}
|
||||
|
||||
- (void)setValue:(UInt16)v;
|
||||
- (UInt16)value;
|
||||
|
||||
- (NSString *)stringValue;
|
||||
- (void)setStringValue:(NSString *)str;
|
||||
|
||||
@end
|
|
@ -0,0 +1,50 @@
|
|||
#import "ElementUWRD.h"
|
||||
|
||||
@implementation ElementUWRD
|
||||
|
||||
- (id)copyWithZone:(NSZone *)zone
|
||||
{
|
||||
ElementUWRD *element = [super copyWithZone:zone];
|
||||
[element setValue:value];
|
||||
return element;
|
||||
}
|
||||
|
||||
- (void)readDataFrom:(TemplateStream *)stream
|
||||
{
|
||||
[stream readAmount:sizeof(value) toBuffer:&value];
|
||||
}
|
||||
|
||||
- (unsigned int)sizeOnDisk
|
||||
{
|
||||
return sizeof(value);
|
||||
}
|
||||
|
||||
- (void)writeDataTo:(TemplateStream *)stream
|
||||
{
|
||||
[stream writeAmount:sizeof(value) fromBuffer:&value];
|
||||
}
|
||||
|
||||
- (void)setValue:(UInt16)v
|
||||
{
|
||||
value = v;
|
||||
}
|
||||
|
||||
- (UInt16)value
|
||||
{
|
||||
return value;
|
||||
}
|
||||
|
||||
- (NSString*)stringValue
|
||||
{
|
||||
return [NSString stringWithFormat:@"%hu", value];
|
||||
}
|
||||
|
||||
- (void)setStringValue:(NSString *)str
|
||||
{
|
||||
char cstr[256];
|
||||
char *endPtr = cstr + 255;
|
||||
strncpy(cstr, [str cString], 255);
|
||||
value = strtoul(cstr, &endPtr, 10);
|
||||
}
|
||||
|
||||
@end
|
|
@ -0,0 +1,11 @@
|
|||
/* menu item for creating new array entries */
|
||||
"Create List Entry" = "Create List Entry";
|
||||
|
||||
/* label for HEXD fields created in response to a template error */
|
||||
"Error: Hex Dump" = "Error: Dumping Hex";
|
||||
|
||||
/* Keep changes dialog */
|
||||
"Do you want to keep the changes you made to this resource?" = "Do you want to keep the changes you made to this resource?";
|
||||
"Keep" = "Keep";
|
||||
"Don't Keep" = "Don’t Keep";
|
||||
"Your changes cannot be saved later if you don't keep them." = "Your changes cannot be saved later if you don’t keep them.";
|
17
Cocoa/Plug-Ins/Template Editor/English.lproj/TemplateWindow.nib/classes.nib
generated
Normal file
17
Cocoa/Plug-Ins/Template Editor/English.lproj/TemplateWindow.nib/classes.nib
generated
Normal file
|
@ -0,0 +1,17 @@
|
|||
{
|
||||
IBClasses = (
|
||||
{CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; },
|
||||
{CLASS = NTOutlineView; LANGUAGE = ObjC; SUPERCLASS = NSOutlineView; },
|
||||
{
|
||||
CLASS = TemplateWindowController;
|
||||
LANGUAGE = ObjC;
|
||||
OUTLETS = {
|
||||
dataList = NSOutlineView;
|
||||
displayList = NSOutlineView;
|
||||
tmplDrawer = NSDrawer;
|
||||
};
|
||||
SUPERCLASS = NSWindowController;
|
||||
}
|
||||
);
|
||||
IBVersion = 1;
|
||||
}
|
|
@ -3,22 +3,25 @@
|
|||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>IBDocumentLocation</key>
|
||||
<string>235 41 356 240 0 0 1024 746 </string>
|
||||
<string>775 135 356 240 0 0 1600 1002 </string>
|
||||
<key>IBEditorPositions</key>
|
||||
<dict>
|
||||
<key>23</key>
|
||||
<string>379 326 270 342 0 0 1024 746 </string>
|
||||
<string>695 542 210 302 0 0 1600 1002 </string>
|
||||
</dict>
|
||||
<key>IBFramework Version</key>
|
||||
<string>326.0</string>
|
||||
<string>446.1</string>
|
||||
<key>IBLockedObjects</key>
|
||||
<array/>
|
||||
<array>
|
||||
<integer>35</integer>
|
||||
</array>
|
||||
<key>IBOldestOS</key>
|
||||
<integer>3</integer>
|
||||
<key>IBOpenObjects</key>
|
||||
<array>
|
||||
<integer>21</integer>
|
||||
<integer>23</integer>
|
||||
</array>
|
||||
<key>IBSystem Version</key>
|
||||
<string>7A202</string>
|
||||
<string>8P135</string>
|
||||
</dict>
|
||||
</plist>
|
BIN
Cocoa/Plug-Ins/Template Editor/English.lproj/TemplateWindow.nib/keyedobjects.nib
generated
Normal file
BIN
Cocoa/Plug-Ins/Template Editor/English.lproj/TemplateWindow.nib/keyedobjects.nib
generated
Normal file
Binary file not shown.
BIN
Cocoa/Plug-Ins/Template Editor/English.lproj/TemplateWindow.nib/objects.nib
generated
Normal file
BIN
Cocoa/Plug-Ins/Template Editor/English.lproj/TemplateWindow.nib/objects.nib
generated
Normal file
Binary file not shown.
|
@ -0,0 +1,33 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>English</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>Template Editor</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>com.nickshanks.resknife.templateeditor</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>BNDL</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>ResK</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>3</string>
|
||||
<key>NSPrincipalClass</key>
|
||||
<string>TemplateWindowController</string>
|
||||
<key>RKSupportedTypes</key>
|
||||
<array>
|
||||
<dict>
|
||||
<key>IsResKnifeDefaultForType</key>
|
||||
<string>YES</string>
|
||||
<key>RKTypeName</key>
|
||||
<string>Template Editor</string>
|
||||
<key>RKTypeRole</key>
|
||||
<string>Editor</string>
|
||||
</dict>
|
||||
</array>
|
||||
</dict>
|
||||
</plist>
|
|
@ -9,11 +9,11 @@ lists, there is a subclass GroupElement from which you can instead subclass to
|
|||
have some of the work done for you.
|
||||
|
||||
When opening a resource, the template editor first creates a TemplateStream for the template
|
||||
resource and calls readOneObject:on it until it runs out of data, instantiating a hierarchy
|
||||
resource and calls readOneObject: on it until it runs out of data, instantiating a hierarchy
|
||||
of Element subclasses for based on the template.
|
||||
|
||||
After that, it creates a TemplateStream for the resource and loops over the template object
|
||||
hierarchy, creating a copy of each item, and then calling readDataFrom:containingArray:on
|
||||
hierarchy, creating a copy of each item, and then calling readDataFrom:containingArray: on
|
||||
the copy, which in turn reads data from the TemplateStream and stores it in its instance
|
||||
variables. For this to work, subclasses of Element *must* implement the NSCopying
|
||||
protocol.
|
||||
|
@ -28,10 +28,10 @@ resource and passed to all template fields (the copies with the resource data, n
|
|||
pre-parsed template hierarchy), via writeDataTo:, which is where they should write their
|
||||
data to the stream. Before that, sizeOnDisk is called on each Element to
|
||||
calculate the new size of the resource before the actual process of writing them out.
|
||||
This size must include the size of all of their sub-items, and writeDataTo:must call
|
||||
This size must include the size of all of their sub-items, and writeDataTo: must call
|
||||
these sub items if they are to be written to disk.
|
||||
|
||||
SPECIAL CASE:LISTS
|
||||
SPECIAL CASE: LISTS
|
||||
|
||||
When the editor encounters an LSTB element, the LSTB element is called upon to parse its
|
||||
"sub-elements" (the items that make up one list item). The LSTB element reads all elements
|
Before Width: | Height: | Size: 274 B After Width: | Height: | Size: 274 B |
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 15 KiB |
|
@ -0,0 +1,36 @@
|
|||
#import <Foundation/Foundation.h>
|
||||
|
||||
@class Element;
|
||||
@interface TemplateStream : NSObject
|
||||
{
|
||||
char *data;
|
||||
unsigned int bytesToGo;
|
||||
NSMutableArray *counterStack;
|
||||
NSMutableArray *keyStack;
|
||||
}
|
||||
|
||||
+ (id)streamWithBytes:(char *)d length:(unsigned int)l;
|
||||
+ (id)substreamWithStream:(TemplateStream *)s length:(unsigned int)l;
|
||||
|
||||
- (id)initStreamWithBytes:(char *)d length:(unsigned int)l;
|
||||
- (id)initWithStream:(TemplateStream *)s length:(unsigned int)l;
|
||||
|
||||
- (char *)data;
|
||||
- (unsigned int)bytesToGo;
|
||||
- (void)setBytesToGo:(unsigned int)b;
|
||||
- (Element *)counter;
|
||||
- (void)pushCounter:(Element *)c;
|
||||
- (void)popCounter;
|
||||
- (Element *)key;
|
||||
- (void)pushKey:(Element *)k;
|
||||
- (void)popKey;
|
||||
|
||||
- (Element *)readOneElement; // For parsing of 'TMPL' resource as template.
|
||||
- (unsigned int)bytesToNull;
|
||||
- (void)advanceAmount:(unsigned int)l pad:(BOOL)pad; // advance r/w pointer and optionally write padding bytes
|
||||
- (void)peekAmount:(unsigned int)l toBuffer:(void *)buffer; // read bytes without advancing pointer
|
||||
- (void)readAmount:(unsigned int)l toBuffer:(void *)buffer; // stream reading
|
||||
- (void)writeAmount:(unsigned int)l fromBuffer:(const void *)buffer; // stream writing
|
||||
- (NSMutableDictionary *)fieldRegistry;
|
||||
|
||||
@end
|
|
@ -0,0 +1,313 @@
|
|||
#import "TemplateStream.h"
|
||||
#import "Element.h"
|
||||
#import "ElementOCNT.h" // for tracking current counter
|
||||
#import "ElementHEXD.h" // for errors
|
||||
|
||||
#import "ElementDBYT.h"
|
||||
#import "ElementDWRD.h"
|
||||
#import "ElementDLNG.h"
|
||||
#import "ElementDLLG.h"
|
||||
#import "ElementUBYT.h"
|
||||
#import "ElementUWRD.h"
|
||||
#import "ElementULNG.h"
|
||||
#import "ElementULLG.h"
|
||||
#import "ElementFIXD.h"
|
||||
#import "ElementFRAC.h"
|
||||
#import "ElementFBYT.h"
|
||||
#import "ElementPSTR.h"
|
||||
//#import "ElementHEXD.h"
|
||||
#import "ElementDATE.h"
|
||||
//#import "ElementOCNT.h"
|
||||
#import "ElementLSTB.h"
|
||||
#import "ElementLSTC.h"
|
||||
#import "ElementLSTE.h"
|
||||
#import "ElementKEYB.h"
|
||||
|
||||
@implementation TemplateStream
|
||||
|
||||
+ (id)streamWithBytes:(char *)d length:(unsigned int)l
|
||||
{
|
||||
return [[[self alloc] autorelease] initStreamWithBytes:d length:l];
|
||||
}
|
||||
|
||||
+ (id)substreamWithStream:(TemplateStream *)s length:(unsigned int)l
|
||||
{
|
||||
return [[[self alloc] autorelease] initWithStream:s length:l];
|
||||
}
|
||||
|
||||
- (id)initStreamWithBytes:(char *)d length:(unsigned int)l
|
||||
{
|
||||
self = [super init];
|
||||
if(!self) return nil;
|
||||
data = d;
|
||||
bytesToGo = l;
|
||||
counterStack = [[NSMutableArray alloc] init];
|
||||
keyStack = [[NSMutableArray alloc] init];
|
||||
return self;
|
||||
}
|
||||
|
||||
- (id)initWithStream:(TemplateStream *)s length:(unsigned int)l
|
||||
{
|
||||
return [self initStreamWithBytes:[s data] length:MIN(l, [s bytesToGo])];
|
||||
}
|
||||
|
||||
- (void)dealloc
|
||||
{
|
||||
[counterStack release];
|
||||
[keyStack release];
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
- (char *)data
|
||||
{
|
||||
return data;
|
||||
}
|
||||
|
||||
- (unsigned int)bytesToGo
|
||||
{
|
||||
return bytesToGo;
|
||||
}
|
||||
|
||||
- (void)setBytesToGo:(unsigned int)b
|
||||
{
|
||||
bytesToGo = b;
|
||||
}
|
||||
|
||||
- (unsigned int)bytesToNull
|
||||
{
|
||||
unsigned int dist = 0;
|
||||
while(dist < bytesToGo)
|
||||
{
|
||||
if(*(char *)(data+dist) == 0x00)
|
||||
return dist;
|
||||
dist++;
|
||||
}
|
||||
return bytesToGo;
|
||||
}
|
||||
|
||||
- (ElementOCNT *)counter
|
||||
{
|
||||
return (ElementOCNT *) [counterStack lastObject];
|
||||
}
|
||||
|
||||
- (void)pushCounter:(ElementOCNT *)c
|
||||
{
|
||||
[counterStack addObject:c];
|
||||
}
|
||||
|
||||
- (void)popCounter
|
||||
{
|
||||
[counterStack removeLastObject];
|
||||
}
|
||||
|
||||
- (Element *)key
|
||||
{
|
||||
NSLog(@"Getting last key of stack: %@", keyStack);
|
||||
return [counterStack lastObject];
|
||||
}
|
||||
|
||||
- (void)pushKey:(Element *)k
|
||||
{
|
||||
[keyStack addObject:k];
|
||||
NSLog(@"Pushed key to stack: %@", keyStack);
|
||||
}
|
||||
|
||||
- (void)popKey
|
||||
{
|
||||
NSLog(@"Popping key from stack: %@", keyStack);
|
||||
[keyStack removeLastObject];
|
||||
}
|
||||
|
||||
#pragma mark -
|
||||
|
||||
- (Element *)readOneElement
|
||||
{
|
||||
// check where pointer will be AFTER having loaded this element
|
||||
NSString *type = nil, *label = nil;
|
||||
if(*data + 5 <= bytesToGo)
|
||||
{
|
||||
bytesToGo -= *data + 5;
|
||||
label = [[[NSString alloc] initWithBytes:data+1 length:*data encoding:NSMacOSRomanStringEncoding] autorelease];
|
||||
data += *data +1;
|
||||
type = [[[NSString alloc] initWithBytes:data length:4 encoding:NSMacOSRomanStringEncoding] autorelease];
|
||||
data += 4;
|
||||
}
|
||||
else
|
||||
{
|
||||
bytesToGo = 0;
|
||||
NSLog(@"Corrupt TMPL resource: not enough data. Dumping remaining resource as hex.");
|
||||
return [ElementHEXD elementForType:@"HEXD" withLabel:NSLocalizedString(@"Error: Hex Dump", nil)];
|
||||
}
|
||||
|
||||
// create element class
|
||||
Class class = [[self fieldRegistry] objectForKey:type];
|
||||
if(class)
|
||||
{
|
||||
Element *element = (Element *) [class elementForType:type withLabel:label];
|
||||
[element readSubElementsFrom:self];
|
||||
return element;
|
||||
}
|
||||
else
|
||||
{
|
||||
bytesToGo = 0;
|
||||
NSLog(@"Class not found for template element type '%@'. Dumping remaining resource as hex.", type);
|
||||
return [ElementHEXD elementForType:@"HEXD" withLabel:NSLocalizedString(@"Error: Hex Dump", nil)];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)advanceAmount:(unsigned int)l pad:(BOOL)pad
|
||||
{
|
||||
if(l > bytesToGo) l = bytesToGo;
|
||||
if(l > 0)
|
||||
{
|
||||
if(pad) memset(data, 0, l);
|
||||
data += l;
|
||||
bytesToGo -= l;
|
||||
}
|
||||
}
|
||||
|
||||
- (void)peekAmount:(unsigned int)l toBuffer:(void *)buffer
|
||||
{
|
||||
if(l > bytesToGo) l = bytesToGo;
|
||||
if(l > 0) memmove(buffer, data, l);
|
||||
}
|
||||
|
||||
- (void)readAmount:(unsigned int)l toBuffer:(void *)buffer
|
||||
{
|
||||
if(l > bytesToGo) l = bytesToGo;
|
||||
if(l > 0)
|
||||
{
|
||||
memmove(buffer, data, l);
|
||||
data += l;
|
||||
bytesToGo -= l;
|
||||
}
|
||||
}
|
||||
|
||||
- (void)writeAmount:(unsigned int)l fromBuffer:(const void *)buffer
|
||||
{
|
||||
if(l > bytesToGo) l = bytesToGo;
|
||||
if(l > 0)
|
||||
{
|
||||
memmove(data, buffer, l);
|
||||
data += l;
|
||||
bytesToGo -= l;
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark -
|
||||
#pragma mark Misc
|
||||
|
||||
- (NSMutableDictionary *)fieldRegistry
|
||||
{
|
||||
static NSMutableDictionary *registry = nil;
|
||||
if(!registry)
|
||||
{
|
||||
registry = [[NSMutableDictionary alloc] init];
|
||||
|
||||
// integers
|
||||
[registry setObject:[ElementDBYT class] forKey:@"DBYT"]; // signed ints
|
||||
[registry setObject:[ElementDWRD class] forKey:@"DWRD"];
|
||||
[registry setObject:[ElementDLNG class] forKey:@"DLNG"];
|
||||
[registry setObject:[ElementDLLG class] forKey:@"DLLG"];
|
||||
[registry setObject:[ElementUBYT class] forKey:@"UBYT"]; // unsigned ints
|
||||
[registry setObject:[ElementUWRD class] forKey:@"UWRD"];
|
||||
[registry setObject:[ElementULNG class] forKey:@"ULNG"];
|
||||
[registry setObject:[ElementULLG class] forKey:@"ULLG"];
|
||||
[registry setObject:[ElementFBYT class] forKey:@"FBYT"]; // filler ints
|
||||
[registry setObject:[ElementFBYT class] forKey:@"FWRD"];
|
||||
[registry setObject:[ElementFBYT class] forKey:@"FLNG"];
|
||||
[registry setObject:[ElementFBYT class] forKey:@"FLLG"];
|
||||
|
||||
// fractions
|
||||
[registry setObject:[ElementFIXD class] forKey:@"FIXD"]; // 16.16 fixed fraction
|
||||
[registry setObject:[ElementFRAC class] forKey:@"FRAC"]; // 2.30 fixed fraction
|
||||
|
||||
// strings
|
||||
[registry setObject:[ElementPSTR class] forKey:@"PSTR"];
|
||||
[registry setObject:[ElementPSTR class] forKey:@"BSTR"];
|
||||
[registry setObject:[ElementPSTR class] forKey:@"WSTR"];
|
||||
[registry setObject:[ElementPSTR class] forKey:@"LSTR"];
|
||||
[registry setObject:[ElementPSTR class] forKey:@"OSTR"];
|
||||
[registry setObject:[ElementPSTR class] forKey:@"ESTR"];
|
||||
[registry setObject:[ElementPSTR class] forKey:@"CSTR"];
|
||||
[registry setObject:[ElementPSTR class] forKey:@"OCST"];
|
||||
[registry setObject:[ElementPSTR class] forKey:@"ECST"];
|
||||
[registry setObject:[ElementPSTR class] forKey:@"CHAR"];
|
||||
[registry setObject:[ElementPSTR class] forKey:@"TNAM"];
|
||||
|
||||
// hex dumps
|
||||
[registry setObject:[ElementHEXD class] forKey:@"HEXD"];
|
||||
|
||||
// list counters
|
||||
[registry setObject:[ElementOCNT class] forKey:@"OCNT"];
|
||||
[registry setObject:[ElementOCNT class] forKey:@"ZCNT"];
|
||||
[registry setObject:[ElementOCNT class] forKey:@"BCNT"];
|
||||
[registry setObject:[ElementOCNT class] forKey:@"BZCT"];
|
||||
[registry setObject:[ElementOCNT class] forKey:@"WCNT"];
|
||||
[registry setObject:[ElementOCNT class] forKey:@"WZCT"];
|
||||
[registry setObject:[ElementOCNT class] forKey:@"LCNT"];
|
||||
[registry setObject:[ElementOCNT class] forKey:@"LZCT"];
|
||||
// list begin/end
|
||||
[registry setObject:[ElementLSTC class] forKey:@"LSTC"];
|
||||
[registry setObject:[ElementLSTB class] forKey:@"LSTB"];
|
||||
[registry setObject:[ElementLSTB class] forKey:@"LSTZ"];
|
||||
[registry setObject:[ElementLSTE class] forKey:@"LSTE"];
|
||||
// key begin/end
|
||||
[registry setObject:[ElementKEYB class] forKey:@"KEYB"];
|
||||
[registry setObject:[ElementKEYE class] forKey:@"KEYE"];
|
||||
|
||||
// dates
|
||||
[registry setObject:[ElementDATE class] forKey:@"DATE"]; // 4-byte date (seconds since 1 Jan 1904)
|
||||
[registry setObject:[ElementDATE class] forKey:@"MDAT"];
|
||||
|
||||
// and some faked ones just to increase compatibility (these are marked 'x' in the docs)
|
||||
[registry setObject:[ElementUBYT class] forKey:@"HBYT"]; // hex byte/word/long
|
||||
[registry setObject:[ElementUWRD class] forKey:@"HWRD"];
|
||||
[registry setObject:[ElementULNG class] forKey:@"HLNG"];
|
||||
[registry setObject:[ElementULLG class] forKey:@"HLLG"];
|
||||
[registry setObject:[ElementKBYT class] forKey:@"KBYT"]; // signed keys
|
||||
[registry setObject:[ElementKWRD class] forKey:@"KWRD"];
|
||||
[registry setObject:[ElementKLNG class] forKey:@"KLNG"];
|
||||
[registry setObject:[ElementDLLG class] forKey:@"KLLG"];
|
||||
[registry setObject:[ElementUBYT class] forKey:@"KUBT"]; // unsigned keys
|
||||
[registry setObject:[ElementUWRD class] forKey:@"KUWD"];
|
||||
[registry setObject:[ElementULNG class] forKey:@"KULG"];
|
||||
[registry setObject:[ElementULLG class] forKey:@"KULL"];
|
||||
[registry setObject:[ElementUBYT class] forKey:@"KHBT"]; // hex keys
|
||||
[registry setObject:[ElementUWRD class] forKey:@"KHWD"];
|
||||
[registry setObject:[ElementULNG class] forKey:@"KHLG"];
|
||||
[registry setObject:[ElementULLG class] forKey:@"KHLL"];
|
||||
[registry setObject:[ElementPSTR class] forKey:@"KCHR"]; // keyed MacRoman values
|
||||
[registry setObject:[ElementPSTR class] forKey:@"KTYP"];
|
||||
[registry setObject:[ElementFBYT class] forKey:@"KRID"]; // key on ID of the resource
|
||||
[registry setObject:[ElementUWRD class] forKey:@"BOOL"]; // true = 256; false = 0
|
||||
[registry setObject:[ElementUBYT class] forKey:@"BFLG"]; // binary flag the size of a byte/word/long
|
||||
[registry setObject:[ElementUWRD class] forKey:@"WFLG"];
|
||||
[registry setObject:[ElementULNG class] forKey:@"LFLG"];
|
||||
[registry setObject:[ElementDWRD class] forKey:@"RSID"]; // resouce id (signed word)
|
||||
[registry setObject:[ElementULNG class] forKey:@"REAL"]; // single precision float
|
||||
[registry setObject:[ElementULLG class] forKey:@"DOUB"]; // double precision float
|
||||
[registry setObject:[ElementUWRD class] forKey:@"SFRC"]; // 0.16 fixed fraction
|
||||
[registry setObject:[ElementUWRD class] forKey:@"FXYZ"]; // 1.15 fixed fraction
|
||||
[registry setObject:[ElementUWRD class] forKey:@"FWID"]; // 4.12 fixed fraction
|
||||
[registry setObject:[ElementFBYT class] forKey:@"CASE"];
|
||||
[registry setObject:[ElementFBYT class] forKey:@"TITL"]; // resource title (e.g. utxt would have "Unicode Text"; must be first element of template, and not anywhere else)
|
||||
[registry setObject:[ElementFBYT class] forKey:@"CMNT"];
|
||||
[registry setObject:[ElementFBYT class] forKey:@"DVDR"];
|
||||
[registry setObject:[ElementULLG class] forKey:@"LLDT"]; // 8-byte date (LongDateTime; seconds since 1 Jan 1904)
|
||||
[registry setObject:[ElementDBYT class] forKey:@"STYL"]; // QuickDraw font style
|
||||
[registry setObject:[ElementULNG class] forKey:@"PNT "]; // QuickDraw point
|
||||
[registry setObject:[ElementULLG class] forKey:@"RECT"]; // QuickDraw rect
|
||||
[registry setObject:[ElementDWRD class] forKey:@"SCPC"]; // MacOS script code (ScriptCode)
|
||||
[registry setObject:[ElementDWRD class] forKey:@"LNGC"]; // MacOS language code (LangCode)
|
||||
[registry setObject:[ElementDWRD class] forKey:@"RGNC"]; // MacOS region code (RegionCode)
|
||||
|
||||
// unhandled types at present, see file:///Users/nicholas/Sites/resknife.sf.net/resorcerer_comparison.html
|
||||
// BBIT, BBnn, FBIT, FBnn, WBIT, WBnn
|
||||
// Pnnn, Cnnn, Hnnn, Fnnn, HEXD
|
||||
// AWRD, ALNG (not so easy, element needs to know how much data preceeds it in the stream)
|
||||
}
|
||||
return registry;
|
||||
}
|
||||
|
||||
@end
|
|
@ -0,0 +1,53 @@
|
|||
/* =============================================================================
|
||||
PROJECT: ResKnife
|
||||
FILE: TemplateWindowController.h
|
||||
|
||||
PURPOSE: This is the main class of our template editor. Every
|
||||
resource editor's main class implements the
|
||||
ResKnifePluginProtocol. Every editor should implement
|
||||
initWithResource:. Only implement initWithResources:if you feel
|
||||
like writing a template editor.
|
||||
|
||||
Note that your plugin is responsible for committing suicide
|
||||
after its window has been closed. If you subclass it from
|
||||
NSWindowController, the controller will take care of that
|
||||
for you, according to a guy named Doug.
|
||||
|
||||
AUTHORS: M. Uli Kusterer, witness(at)zathras.de, (c) 2003.
|
||||
|
||||
REVISIONS:
|
||||
2003-07-31 UK Created.
|
||||
========================================================================== */
|
||||
|
||||
#import <Cocoa/Cocoa.h>
|
||||
#import "ResKnifePluginProtocol.h"
|
||||
#import "ResKnifeResourceProtocol.h"
|
||||
|
||||
@interface TemplateWindowController : NSWindowController <ResKnifeTemplatePluginProtocol>
|
||||
{
|
||||
IBOutlet NSOutlineView *displayList; // template display (debug only).
|
||||
IBOutlet NSOutlineView *dataList; // Data display.
|
||||
IBOutlet NSDrawer *tmplDrawer;
|
||||
NSMutableDictionary *toolbarItems;
|
||||
NSMutableArray *templateStructure; // Pre-parsed form of our template.
|
||||
NSMutableArray *resourceStructure; // Parsed form of our resource.
|
||||
id <ResKnifeResourceProtocol> resource; // The resource we operate on.
|
||||
id <ResKnifeResourceProtocol> backup; // The original resource.
|
||||
BOOL liveEdit;
|
||||
}
|
||||
|
||||
- (void)setupToolbar;
|
||||
- (void)readTemplate:(id <ResKnifeResourceProtocol>)tmplRes;
|
||||
- (void)loadResource;
|
||||
- (IBAction)saveResource:(id)sender;
|
||||
- (IBAction)revertResource:(id)sender;
|
||||
- (IBAction)createListEntry:(id)sender;
|
||||
- (IBAction)cut:(id)sender;
|
||||
- (IBAction)copy:(id)sender;
|
||||
- (IBAction)paste:(id)sender;
|
||||
- (IBAction)clear:(id)sender;
|
||||
|
||||
@end
|
||||
|
||||
@interface NTOutlineView : NSOutlineView
|
||||
@end
|
|
@ -0,0 +1,461 @@
|
|||
#import "TemplateWindowController.h"
|
||||
#import "TemplateStream.h"
|
||||
#import "Element.h"
|
||||
#import "ElementOCNT.h"
|
||||
#import "ElementLSTE.h"
|
||||
// and ones for keyed fields
|
||||
#import "ElementDBYT.h"
|
||||
#import "ElementDWRD.h"
|
||||
#import "ElementDLNG.h"
|
||||
|
||||
#import "NSOutlineView-SelectedItems.h"
|
||||
|
||||
@implementation TemplateWindowController
|
||||
|
||||
- (id)initWithResource:(id <ResKnifeResourceProtocol>)newResource
|
||||
{
|
||||
return [self initWithResources:newResource, nil];
|
||||
}
|
||||
|
||||
- (id)initWithResources:(id <ResKnifeResourceProtocol>)newResource, ...
|
||||
{
|
||||
id tmplResource;
|
||||
va_list resourceList;
|
||||
|
||||
va_start(resourceList, newResource);
|
||||
self = [self initWithWindowNibName:@"TemplateWindow"];
|
||||
if(!self)
|
||||
{
|
||||
va_end(resourceList);
|
||||
return nil;
|
||||
}
|
||||
|
||||
toolbarItems = [[NSMutableDictionary alloc] init];
|
||||
// undoManager = [[NSUndoManager alloc] init];
|
||||
liveEdit = NO;
|
||||
if(liveEdit)
|
||||
{
|
||||
resource = [(id)newResource retain]; // resource to work on
|
||||
backup = [(NSObject *)resource copy]; // for reverting only
|
||||
}
|
||||
else
|
||||
{
|
||||
backup = [(id)newResource retain]; // actual resource to change when saving data
|
||||
resource = [(NSObject *)backup copy]; // resource to work on
|
||||
}
|
||||
templateStructure = [[NSMutableArray alloc] init];
|
||||
resourceStructure = [[NSMutableArray alloc] init];
|
||||
|
||||
tmplResource = va_arg(resourceList, id);
|
||||
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(templateDataDidChange:) name:ResourceDataDidChangeNotification object:tmplResource];
|
||||
[self readTemplate:tmplResource]; // reads (but doesn't retain) the template for this resource (TMPL resource with name equal to the passed resource's type)
|
||||
|
||||
while(tmplResource = va_arg(resourceList, id))
|
||||
NSLog(@"Too many params passed to -initWithResources:%@", [tmplResource description]);
|
||||
va_end(resourceList);
|
||||
|
||||
// load the window from the nib
|
||||
[self setShouldCascadeWindows:YES];
|
||||
[self window];
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)dealloc
|
||||
{
|
||||
[[NSNotificationCenter defaultCenter] removeObserver:self];
|
||||
[toolbarItems release];
|
||||
[templateStructure release];
|
||||
[resourceStructure release];
|
||||
[(id)resource release];
|
||||
[(id)backup release];
|
||||
[super dealloc];
|
||||
}
|
||||
/*
|
||||
- (void)windowControllerDidLoadNib:(NSWindowController *)controller
|
||||
{
|
||||
[super windowControllerDidLoadNib:controller];
|
||||
[self setupToolbar:controller];
|
||||
}
|
||||
*/
|
||||
- (void)windowDidLoad
|
||||
{
|
||||
[super windowDidLoad];
|
||||
[self setupToolbar];
|
||||
[self loadResource];
|
||||
if(liveEdit) [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(resourceDataDidChange:) name:ResourceDataDidChangeNotification object:resource];
|
||||
else [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(resourceDataDidChange:) name:ResourceDataDidChangeNotification object:backup];
|
||||
[[self window] setTitle:[resource defaultWindowTitle]];
|
||||
[[[dataList tableColumnWithIdentifier:@"label"] dataCell] setFont:[NSFont boldSystemFontOfSize:[NSFont systemFontSize]]];
|
||||
[self showWindow:self];
|
||||
[displayList reloadData];
|
||||
}
|
||||
|
||||
- (void)templateDataDidChange:(NSNotification *)notification
|
||||
{
|
||||
[templateStructure removeAllObjects];
|
||||
[self readTemplate:[notification object]];
|
||||
if([self isWindowLoaded])
|
||||
[self loadResource];
|
||||
}
|
||||
|
||||
- (void)resourceDataDidChange:(NSNotification *)notification
|
||||
{
|
||||
if(!liveEdit)
|
||||
// bug: should display alert asking if you want to replace data in this editor or reassert this data, revoking the other editor's changes
|
||||
[resource setData:[[backup data] copy]];
|
||||
[self loadResource];
|
||||
}
|
||||
|
||||
- (void)loadResource
|
||||
{
|
||||
// create new stream
|
||||
TemplateStream *stream = [TemplateStream streamWithBytes:(char *)[[resource data] bytes] length:[[resource data] length]];
|
||||
|
||||
// loop through template cloning its elements
|
||||
Element *element;
|
||||
[resourceStructure removeAllObjects];
|
||||
NSEnumerator *enumerator = [templateStructure objectEnumerator];
|
||||
while(element = [enumerator nextObject])
|
||||
{
|
||||
Element *clone = [[element copy] autorelease]; // copy the template object.
|
||||
// NSLog(@"clone = %@; resourceStructure = %@", clone, resourceStructure);
|
||||
[resourceStructure addObject:clone]; // add it to our parsed resource data list. Do this right away so the element can append other items should it desire to.
|
||||
[clone setParentArray:resourceStructure]; // the parent for these is the root level resourceStructure object
|
||||
Class cc = [clone class];
|
||||
|
||||
BOOL pushedCounter = NO;
|
||||
BOOL pushedKey = NO;
|
||||
if(cc == [ElementOCNT class])
|
||||
{ [stream pushCounter:clone]; pushedCounter = YES; }
|
||||
if(cc == [ElementKBYT class] ||
|
||||
cc == [ElementKWRD class] ||
|
||||
cc == [ElementKLNG class] )
|
||||
{ [stream pushKey:clone]; pushedKey = YES; }
|
||||
[clone readDataFrom:stream]; // fill it with resource data.
|
||||
if(cc == [ElementLSTE class] && pushedCounter)
|
||||
[stream popCounter];
|
||||
// if(cc == [ElementKEYE class] && pushedKey)
|
||||
// [stream popKey];
|
||||
}
|
||||
|
||||
// reload the view
|
||||
id item;
|
||||
[dataList reloadData];
|
||||
int row = [dataList numberOfRows];
|
||||
while(item = [dataList itemAtRow: --row])
|
||||
{
|
||||
if([dataList isExpandable: item] && ![dataList isItemExpanded: item])
|
||||
[dataList expandItem: item expandChildren: YES];
|
||||
}
|
||||
}
|
||||
|
||||
- (BOOL)windowShouldClose:(id)sender
|
||||
{
|
||||
[[self window] makeFirstResponder:dataList];
|
||||
[dataList abortEditing];
|
||||
|
||||
if([[self window] isDocumentEdited])
|
||||
{
|
||||
NSBeginAlertSheet(NSLocalizedString(@"Do you want to keep the changes you made to this resource?", nil), NSLocalizedString(@"Keep", nil), NSLocalizedString(@"Don't Keep", nil), NSLocalizedString(@"Cancel", nil), sender, self, @selector(saveSheetDidClose:returnCode:contextInfo:), nil, nil, NSLocalizedString(@"Your changes cannot be saved later if you don't keep them.", nil));
|
||||
return NO;
|
||||
}
|
||||
else return YES;
|
||||
}
|
||||
|
||||
- (void)saveSheetDidClose:(NSWindow *)sheet returnCode:(int)returnCode contextInfo:(void *)contextInfo
|
||||
{
|
||||
switch(returnCode)
|
||||
{
|
||||
case NSAlertDefaultReturn: // keep
|
||||
[self saveResource:nil];
|
||||
[[self window] close];
|
||||
break;
|
||||
|
||||
case NSAlertAlternateReturn: // don't keep
|
||||
[[self window] close];
|
||||
break;
|
||||
|
||||
case NSAlertOtherReturn: // cancel
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
- (void)saveResource:(id)sender
|
||||
{
|
||||
// get size of resource by summing size of all fields
|
||||
Element *element;
|
||||
unsigned int size = 0;
|
||||
NSEnumerator *enumerator = [resourceStructure objectEnumerator];
|
||||
while(element = [enumerator nextObject])
|
||||
size += [element sizeOnDisk];
|
||||
|
||||
// create data and stream
|
||||
NSMutableData *newData = [NSMutableData dataWithLength:size];
|
||||
TemplateStream *stream = [TemplateStream streamWithBytes:(char *)[newData bytes] length:size];
|
||||
|
||||
// write bytes into new data object
|
||||
enumerator = [resourceStructure objectEnumerator];
|
||||
while(element = [enumerator nextObject])
|
||||
[element writeDataTo:stream];
|
||||
|
||||
// send the new resource data to ResKnife
|
||||
if(liveEdit)
|
||||
{
|
||||
[[NSNotificationCenter defaultCenter] removeObserver:self name:ResourceDataDidChangeNotification object:resource];
|
||||
[resource setData:newData];
|
||||
[backup setData:[newData copy]];
|
||||
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(resourceDataDidChange:) name:ResourceDataDidChangeNotification object:resource];
|
||||
}
|
||||
else
|
||||
{
|
||||
[[NSNotificationCenter defaultCenter] removeObserver:self name:ResourceDataDidChangeNotification object:backup];
|
||||
[resource setData:newData];
|
||||
[backup setData:[newData copy]];
|
||||
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(resourceDataDidChange:) name:ResourceDataDidChangeNotification object:backup];
|
||||
[self setDocumentEdited:NO];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)revertResource:(id)sender
|
||||
{
|
||||
[resource setData:[[backup data] copy]];
|
||||
}
|
||||
|
||||
- (void)readTemplate:(id<ResKnifeResourceProtocol>)tmplRes
|
||||
{
|
||||
char *data = (char*) [[tmplRes data] bytes];
|
||||
unsigned long bytesToGo = [[tmplRes data] length];
|
||||
TemplateStream *stream = [TemplateStream streamWithBytes:data length:bytesToGo];
|
||||
|
||||
// read new fields from the template and add them to our list
|
||||
while([stream bytesToGo] > 0)
|
||||
{
|
||||
Element *element = [stream readOneElement];
|
||||
if(element)
|
||||
{
|
||||
[element setIsTMPL:YES]; // for debugging
|
||||
[templateStructure addObject:element];
|
||||
}
|
||||
else
|
||||
{
|
||||
NSLog(@"Error reading template stream, aborting.");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
[displayList reloadData];
|
||||
}
|
||||
|
||||
#pragma mark -
|
||||
#pragma mark Table Management
|
||||
|
||||
- (id)outlineView:(NSOutlineView*)outlineView child:(int)index ofItem:(id)item
|
||||
{
|
||||
if((item == nil) && (outlineView == displayList))
|
||||
return [templateStructure objectAtIndex:index];
|
||||
else if((item == nil) && (outlineView == dataList))
|
||||
return [resourceStructure objectAtIndex:index];
|
||||
else return [item subElementAtIndex:index];
|
||||
}
|
||||
|
||||
- (BOOL)outlineView:(NSOutlineView *)outlineView isItemExpandable:(id)item
|
||||
{
|
||||
return ([item subElementCount] > 0);
|
||||
}
|
||||
|
||||
- (int)outlineView:(NSOutlineView *)outlineView numberOfChildrenOfItem:(id)item
|
||||
{
|
||||
if((item == nil) && (outlineView == displayList))
|
||||
return [templateStructure count];
|
||||
else if((item == nil) && (outlineView == dataList))
|
||||
return [resourceStructure count];
|
||||
else return [item subElementCount];
|
||||
}
|
||||
|
||||
- (id)outlineView:(NSOutlineView *)outlineView objectValueForTableColumn:(NSTableColumn *)tableColumn byItem:(id)item
|
||||
{
|
||||
return [item valueForKey:[tableColumn identifier]];
|
||||
}
|
||||
|
||||
- (void)outlineView:(NSOutlineView *)outlineView setObjectValue:(id)object forTableColumn:(NSTableColumn *)tableColumn byItem:(id)item
|
||||
{
|
||||
id old = [item valueForKey:[tableColumn identifier]];
|
||||
if([(Element *)item editable] && ![old isEqual:object])
|
||||
{
|
||||
// [[self undoManager] registerUndoWithTarget:item selector:@selector(setStringValue:) object:old];
|
||||
// [[self undoManager] setActionName:NSLocalizedString(@"Changes", nil)];
|
||||
[item setValue:object forKey:[tableColumn identifier]];
|
||||
if(!liveEdit) [self setDocumentEdited:YES];
|
||||
|
||||
// remove self to avoid reloading the resource
|
||||
[[NSNotificationCenter defaultCenter] removeObserver:self name:ResourceDataDidChangeNotification object:resource];
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName:ResourceDataDidChangeNotification object:resource];
|
||||
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(resourceDataDidChange:) name:ResourceDataDidChangeNotification object:resource];
|
||||
}
|
||||
}
|
||||
|
||||
- (BOOL)outlineView:(NSOutlineView *)outlineView shouldEditTableColumn:(NSTableColumn *)tableColumn item:(id)item
|
||||
{
|
||||
return [(Element *)item editable];
|
||||
}
|
||||
|
||||
/*- (float)outlineView:(NSOutlineView *)outlineView heightOfRowByItem:(id)item
|
||||
{
|
||||
return [item rowHeight];
|
||||
}*/
|
||||
|
||||
#pragma mark -
|
||||
#pragma mark Menu Management
|
||||
|
||||
// these next five methods are a crude hack - the items ought ot be in the responder chain themselves
|
||||
- (IBAction)createListEntry:(id)sender;
|
||||
{
|
||||
// This works by selecting an item that serves as a template (another LSTB), or knows how to create an item (LSTE) and passing the message on to it.
|
||||
id element = [dataList selectedItem];
|
||||
if([element respondsToSelector:@selector(createListEntry:)])
|
||||
{
|
||||
[element createListEntry:sender];
|
||||
[dataList reloadData];
|
||||
[dataList expandItem:[dataList selectedItem] expandChildren:YES];
|
||||
if(!liveEdit) [self setDocumentEdited:YES];
|
||||
}
|
||||
}
|
||||
|
||||
- (IBAction)cut:(id)sender;
|
||||
{
|
||||
[[dataList selectedItem] cut:sender];
|
||||
[dataList reloadData];
|
||||
if(!liveEdit) [self setDocumentEdited:YES];
|
||||
}
|
||||
|
||||
- (IBAction)copy:(id)sender;
|
||||
{
|
||||
[[dataList selectedItem] copy:sender];
|
||||
[dataList reloadData];
|
||||
}
|
||||
|
||||
- (IBAction)paste:(id)sender;
|
||||
{
|
||||
[[dataList selectedItem] paste:sender];
|
||||
[dataList reloadData];
|
||||
if(!liveEdit) [self setDocumentEdited:YES];
|
||||
}
|
||||
|
||||
- (IBAction)clear:(id)sender;
|
||||
{
|
||||
[[dataList selectedItem] clear:sender];
|
||||
[dataList reloadData];
|
||||
if(!liveEdit) [self setDocumentEdited:YES];
|
||||
}
|
||||
|
||||
- (BOOL)validateMenuItem:(NSMenuItem*)item
|
||||
{
|
||||
Element *element = (Element*) [dataList selectedItem];
|
||||
if([item action] == @selector(createListEntry:)) return(element && [element respondsToSelector:@selector(createListEntry:)]);
|
||||
else if([item action] == @selector(cut:)) return(element && [element respondsToSelector:@selector(cut:)]);
|
||||
else if([item action] == @selector(copy:)) return(element && [element respondsToSelector:@selector(copy:)]);
|
||||
else if([item action] == @selector(paste:) && element && [element respondsToSelector:@selector(validateMenuItem:)])
|
||||
return([element validateMenuItem:item]);
|
||||
else if([item action] == @selector(clear:)) return(element && [element respondsToSelector:@selector(clear:)]);
|
||||
else if([item action] == @selector(saveDocument:)) return YES;
|
||||
else return NO;
|
||||
}
|
||||
|
||||
- (void)windowDidBecomeKey:(NSNotification *)notification
|
||||
{
|
||||
NSMenu *resourceMenu = [[[NSApp mainMenu] itemAtIndex:3] submenu];
|
||||
NSMenuItem *createItem = [resourceMenu itemAtIndex:[resourceMenu indexOfItemWithTarget:nil andAction:@selector(showCreateResourceSheet:)]];
|
||||
[createItem setTitle:NSLocalizedString(@"Create List Entry", nil)];
|
||||
[createItem setAction:@selector(createListEntry:)];
|
||||
}
|
||||
|
||||
- (void)windowDidResignKey:(NSNotification *)notification
|
||||
{
|
||||
NSMenu *resourceMenu = [[[NSApp mainMenu] itemAtIndex:3] submenu];
|
||||
NSMenuItem *createItem = [resourceMenu itemAtIndex:[resourceMenu indexOfItemWithTarget:nil andAction:@selector(createListEntry:)]];
|
||||
[createItem setTitle:NSLocalizedString(@"Create New Resource...", nil)];
|
||||
[createItem setAction:@selector(showCreateResourceSheet:)];
|
||||
}
|
||||
|
||||
#pragma mark -
|
||||
#pragma mark Toolbar Management
|
||||
|
||||
static NSString *RKTEToolbarIdentifier = @"com.nickshanks.resknife.templateeditor.toolbar";
|
||||
static NSString *RKTEDisplayTMPLIdentifier = @"com.nickshanks.resknife.templateeditor.toolbar.tmpl";
|
||||
|
||||
- (void)setupToolbar
|
||||
{
|
||||
/* This routine should become invalid once toolbars are integrated into nib files */
|
||||
|
||||
NSToolbarItem *item;
|
||||
[toolbarItems removeAllObjects]; // just in case this method is called more than once per document (which it shouldn't be!)
|
||||
|
||||
item = [[[NSToolbarItem alloc] initWithItemIdentifier:RKTEDisplayTMPLIdentifier] autorelease];
|
||||
[item setLabel:NSLocalizedString(@"Parsed TMPL", nil)];
|
||||
[item setPaletteLabel:NSLocalizedString(@"Display Parsed TMPL", nil)];
|
||||
[item setToolTip:NSLocalizedString(@"Display Parsed TMPL", nil)];
|
||||
[item setImage:[NSImage imageNamed:@"DisplayTMPL"]];
|
||||
[item setTarget:tmplDrawer];
|
||||
[item setAction:@selector(toggle:)];
|
||||
[toolbarItems setObject:item forKey:RKTEDisplayTMPLIdentifier];
|
||||
|
||||
NSToolbar *toolbar = [[[NSToolbar alloc] initWithIdentifier:RKTEToolbarIdentifier] autorelease];
|
||||
|
||||
// set toolbar properties
|
||||
[toolbar setVisible:NO];
|
||||
[toolbar setAutosavesConfiguration:YES];
|
||||
[toolbar setAllowsUserCustomization:YES];
|
||||
[toolbar setDisplayMode:NSToolbarDisplayModeLabelOnly];
|
||||
[toolbar setSizeMode:NSToolbarSizeModeSmall];
|
||||
|
||||
// attach toolbar to window
|
||||
[toolbar setDelegate:self];
|
||||
[[self window] setToolbar:toolbar];
|
||||
}
|
||||
|
||||
- (NSToolbarItem *)toolbar:(NSToolbar *)toolbar itemForItemIdentifier:(NSString *)itemIdentifier willBeInsertedIntoToolbar:(BOOL)flag
|
||||
{
|
||||
return [toolbarItems objectForKey:itemIdentifier];
|
||||
}
|
||||
|
||||
- (NSArray *)toolbarDefaultItemIdentifiers:(NSToolbar *)toolbar
|
||||
{
|
||||
return [NSArray arrayWithObjects:RKTEDisplayTMPLIdentifier, NSToolbarFlexibleSpaceItemIdentifier, NSToolbarPrintItemIdentifier, nil];
|
||||
}
|
||||
|
||||
- (NSArray *)toolbarAllowedItemIdentifiers:(NSToolbar *)toolbar
|
||||
{
|
||||
return [NSArray arrayWithObjects:RKTEDisplayTMPLIdentifier, NSToolbarPrintItemIdentifier, NSToolbarCustomizeToolbarItemIdentifier, NSToolbarFlexibleSpaceItemIdentifier, NSToolbarSpaceItemIdentifier, NSToolbarSeparatorItemIdentifier, nil];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
#pragma mark -
|
||||
#pragma mark Table Event Handling
|
||||
|
||||
@implementation NTOutlineView
|
||||
- (void)keyDown:(NSEvent *)event
|
||||
{
|
||||
Element *selectedItem = nil;
|
||||
int selectedRow = [self selectedRow];
|
||||
if(selectedRow != -1)
|
||||
selectedItem = [self selectedItem];
|
||||
|
||||
if(selectedItem && [selectedItem editable] && ([[event characters] isEqualToString:@"\r"] || [[event characters] isEqualToString:@"\t"]))
|
||||
[self editColumn:1 row:selectedRow withEvent:nil select:YES];
|
||||
else if(selectedItem && [selectedItem respondsToSelector:@selector(clear:)] && [[event characters] isEqualToString:[NSString stringWithCString:"\x7F"]])
|
||||
[[[self window] windowController] clear:nil];
|
||||
else [super keyDown:event];
|
||||
}
|
||||
- (BOOL)textView:(NSTextView *)textView doCommandBySelector:(SEL)selector
|
||||
{
|
||||
// pressed return, end editing
|
||||
if(selector == @selector(insertNewline:))
|
||||
{
|
||||
[[self window] makeFirstResponder:self];
|
||||
[self abortEditing];
|
||||
return YES;
|
||||
}
|
||||
return [super textView:textView doCommandBySelector:selector];
|
||||
}
|
||||
@end
|
Before Width: | Height: | Size: 22 KiB After Width: | Height: | Size: 22 KiB |
|
@ -1,12 +0,0 @@
|
|||
{
|
||||
IBClasses = (
|
||||
{CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; },
|
||||
{
|
||||
CLASS = NuTemplateWindowController;
|
||||
LANGUAGE = ObjC;
|
||||
OUTLETS = {dataList = NSOutlineView; displayList = NSOutlineView; resource = id; };
|
||||
SUPERCLASS = NSWindowController;
|
||||
}
|
||||
);
|
||||
IBVersion = 1;
|
||||
}
|
Binary file not shown.
|
@ -1,34 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>English</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>New Template Editor</string>
|
||||
<key>CFBundleGetInfoString</key>
|
||||
<string></string>
|
||||
<key>CFBundleIconFile</key>
|
||||
<string></string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>com.ulikusterer.resknife.nutemplateeditor</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleName</key>
|
||||
<string></string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>BNDL</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string></string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>ResK</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>0.0.1d1</string>
|
||||
<key>NSMainNibFile</key>
|
||||
<string>NuTemplateWindow</string>
|
||||
<key>NSPrincipalClass</key>
|
||||
<string>NuTemplateWindowController</string>
|
||||
<key>RKEditedType</key>
|
||||
<string>Template Editor</string>
|
||||
</dict>
|
||||
</plist>
|
|
@ -1,2 +0,0 @@
|
|||
/* Name we give the "Create New Resource..." menu item: */
|
||||
"Create List Entry" = "Create List Entry";
|
|
@ -1,23 +0,0 @@
|
|||
//
|
||||
// NuTemplateDBYTElement.h
|
||||
// ResKnife (PB2)
|
||||
//
|
||||
// Created by Uli Kusterer on Tue Aug 05 2003.
|
||||
// Copyright (c) 2003 M. Uli Kusterer. All rights reserved.
|
||||
//
|
||||
|
||||
#import "NuTemplateElement.h"
|
||||
|
||||
|
||||
@interface NuTemplateDBYTElement : NuTemplateElement
|
||||
{
|
||||
char charValue;
|
||||
}
|
||||
|
||||
-(void) setCharValue: (char)n;
|
||||
-(char) charValue;
|
||||
|
||||
-(NSString*) stringValue;
|
||||
-(void) setStringValue: (NSString*)str;
|
||||
|
||||
@end
|
|
@ -1,91 +0,0 @@
|
|||
//
|
||||
// NuTemplateDBYTElement.m
|
||||
// ResKnife (PB2)
|
||||
//
|
||||
// Created by Uli Kusterer on Tue Aug 05 2003.
|
||||
// Copyright (c) 2003 M. Uli Kusterer. All rights reserved.
|
||||
//
|
||||
|
||||
#import "NuTemplateDBYTElement.h"
|
||||
|
||||
|
||||
@implementation NuTemplateDBYTElement
|
||||
|
||||
-(id) initForType: (NSString*)t withLabel: (NSString*)l
|
||||
{
|
||||
if( self = [super initForType:t withLabel:l] )
|
||||
{
|
||||
if( [l isEqualToString: @"CHAR"] )
|
||||
charValue = ' ';
|
||||
else
|
||||
charValue = 0;
|
||||
}
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
-(id) copyWithZone: (NSZone*)zone
|
||||
{
|
||||
NuTemplateDBYTElement* el = [super copyWithZone: zone];
|
||||
|
||||
if( el )
|
||||
[el setCharValue: charValue];
|
||||
|
||||
return el;
|
||||
}
|
||||
|
||||
|
||||
-(void) readDataFrom: (NuTemplateStream*)stream
|
||||
{
|
||||
[stream readAmount:sizeof(charValue) toBuffer: &charValue];
|
||||
}
|
||||
|
||||
|
||||
-(unsigned int) sizeOnDisk
|
||||
{
|
||||
return sizeof(charValue);
|
||||
}
|
||||
|
||||
-(void) writeDataTo: (NuTemplateStream*)stream
|
||||
{
|
||||
[stream writeAmount:sizeof(charValue) fromBuffer: &charValue];
|
||||
}
|
||||
|
||||
|
||||
-(void) setCharValue: (char)d
|
||||
{
|
||||
charValue = d;
|
||||
}
|
||||
|
||||
-(char) charValue
|
||||
{
|
||||
return charValue;
|
||||
}
|
||||
|
||||
|
||||
-(NSString*) stringValue
|
||||
{
|
||||
if( [type isEqualToString: @"CHAR"] )
|
||||
return [NSString stringWithCString:&charValue length:1];
|
||||
else
|
||||
return [NSString stringWithFormat: @"%d", charValue];
|
||||
}
|
||||
|
||||
|
||||
-(void) setStringValue: (NSString*)str
|
||||
{
|
||||
if( [type isEqualToString: @"CHAR"] )
|
||||
charValue = [str cString][0];
|
||||
else
|
||||
{
|
||||
char cstr[256];
|
||||
char* endPtr = cstr +255;
|
||||
|
||||
strncpy( cstr, [str cString], 255 );
|
||||
charValue = strtol( cstr, &endPtr, 10 );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@end
|
|
@ -1,23 +0,0 @@
|
|||
//
|
||||
// NuTemplateDLNGlement.h
|
||||
// ResKnife (PB2)
|
||||
//
|
||||
// Created by Uli Kusterer on Tue Aug 05 2003.
|
||||
// Copyright (c) 2003 M. Uli Kusterer. All rights reserved.
|
||||
//
|
||||
|
||||
#import "NuTemplateElement.h"
|
||||
|
||||
|
||||
@interface NuTemplateDLNGElement : NuTemplateElement
|
||||
{
|
||||
long longValue;
|
||||
}
|
||||
|
||||
-(void) setLongValue: (long)n;
|
||||
-(long) longValue;
|
||||
|
||||
-(NSString*) stringValue;
|
||||
-(void) setStringValue: (NSString*)str;
|
||||
|
||||
@end
|
|
@ -1,78 +0,0 @@
|
|||
//
|
||||
// NuTemplateDLNGElement.m
|
||||
// ResKnife (PB2)
|
||||
//
|
||||
// Created by Uli Kusterer on Tue Aug 05 2003.
|
||||
// Copyright (c) 2003 M. Uli Kusterer. All rights reserved.
|
||||
//
|
||||
|
||||
#import "NuTemplateDLNGElement.h"
|
||||
|
||||
|
||||
@implementation NuTemplateDLNGElement
|
||||
|
||||
-(id) initForType: (NSString*)t withLabel: (NSString*)l
|
||||
{
|
||||
if( self = [super initForType:t withLabel:l] )
|
||||
longValue = 0;
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
-(id) copyWithZone: (NSZone*)zone
|
||||
{
|
||||
NuTemplateDLNGElement* el = [super copyWithZone: zone];
|
||||
|
||||
if( el )
|
||||
[el setLongValue: longValue];
|
||||
|
||||
return el;
|
||||
}
|
||||
|
||||
|
||||
-(void) readDataFrom: (NuTemplateStream*)stream
|
||||
{
|
||||
[stream readAmount:sizeof(longValue) toBuffer: &longValue];
|
||||
}
|
||||
|
||||
|
||||
-(unsigned int) sizeOnDisk
|
||||
{
|
||||
return sizeof(longValue);
|
||||
}
|
||||
|
||||
-(void) writeDataTo: (NuTemplateStream*)stream
|
||||
{
|
||||
[stream writeAmount:sizeof(longValue) fromBuffer: &longValue];
|
||||
}
|
||||
|
||||
|
||||
-(void) setLongValue: (long)d
|
||||
{
|
||||
longValue = d;
|
||||
}
|
||||
|
||||
-(long) longValue
|
||||
{
|
||||
return longValue;
|
||||
}
|
||||
|
||||
|
||||
-(NSString*) stringValue
|
||||
{
|
||||
return [NSString stringWithFormat: @"%ld", longValue];
|
||||
}
|
||||
|
||||
|
||||
-(void) setStringValue: (NSString*)str
|
||||
{
|
||||
char cstr[256];
|
||||
char* endPtr = cstr +255;
|
||||
|
||||
strncpy( cstr, [str cString], 255 );
|
||||
longValue = strtol( cstr, &endPtr, 10 );
|
||||
}
|
||||
|
||||
|
||||
|
||||
@end
|
|
@ -1,23 +0,0 @@
|
|||
//
|
||||
// NuTemplateDWRDElement.h
|
||||
// ResKnife (PB2)
|
||||
//
|
||||
// Created by Uli Kusterer on Tue Aug 05 2003.
|
||||
// Copyright (c) 2003 M. Uli Kusterer. All rights reserved.
|
||||
//
|
||||
|
||||
#import "NuTemplateElement.h"
|
||||
|
||||
|
||||
@interface NuTemplateDWRDElement : NuTemplateElement
|
||||
{
|
||||
short shortValue;
|
||||
}
|
||||
|
||||
-(void) setShortValue: (short)n;
|
||||
-(short) shortValue;
|
||||
|
||||
-(NSString*) stringValue;
|
||||
-(void) setStringValue: (NSString*)str;
|
||||
|
||||
@end
|
|
@ -1,78 +0,0 @@
|
|||
//
|
||||
// NuTemplateDWRDElement.m
|
||||
// ResKnife (PB2)
|
||||
//
|
||||
// Created by Uli Kusterer on Tue Aug 05 2003.
|
||||
// Copyright (c) 2003 M. Uli Kusterer. All rights reserved.
|
||||
//
|
||||
|
||||
#import "NuTemplateDWRDElement.h"
|
||||
|
||||
|
||||
@implementation NuTemplateDWRDElement
|
||||
|
||||
-(id) initForType: (NSString*)t withLabel: (NSString*)l
|
||||
{
|
||||
if( self = [super initForType:t withLabel:l] )
|
||||
shortValue = 0;
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
-(id) copyWithZone: (NSZone*)zone
|
||||
{
|
||||
NuTemplateDWRDElement* el = [super copyWithZone: zone];
|
||||
|
||||
if( el )
|
||||
[el setShortValue: shortValue];
|
||||
|
||||
return el;
|
||||
}
|
||||
|
||||
|
||||
-(void) readDataFrom: (NuTemplateStream*)stream
|
||||
{
|
||||
[stream readAmount:2 toBuffer: &shortValue];
|
||||
}
|
||||
|
||||
|
||||
-(unsigned int) sizeOnDisk
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
|
||||
-(void) writeDataTo: (NuTemplateStream*)stream
|
||||
{
|
||||
[stream writeAmount:2 fromBuffer: &shortValue];
|
||||
}
|
||||
|
||||
|
||||
-(void) setShortValue: (short)d
|
||||
{
|
||||
shortValue = d;
|
||||
}
|
||||
|
||||
-(short) shortValue
|
||||
{
|
||||
return shortValue;
|
||||
}
|
||||
|
||||
|
||||
-(NSString*) stringValue
|
||||
{
|
||||
return [NSString stringWithFormat: @"%d", shortValue];
|
||||
}
|
||||
|
||||
|
||||
-(void) setStringValue: (NSString*)str
|
||||
{
|
||||
char cstr[256];
|
||||
char* endPtr = cstr +255;
|
||||
|
||||
strncpy( cstr, [str cString], 255 );
|
||||
shortValue = strtol( cstr, &endPtr, 10 );
|
||||
}
|
||||
|
||||
|
||||
|
||||
@end
|
|
@ -1,134 +0,0 @@
|
|||
//
|
||||
// NuTemplateElement.m
|
||||
// ResKnife (PB2)
|
||||
//
|
||||
// Created by Uli Kusterer on Mon Aug 04 2003.
|
||||
// Copyright (c) 2003 M. Uli Kusterer. All rights reserved.
|
||||
//
|
||||
|
||||
#import "NuTemplateElement.h"
|
||||
|
||||
|
||||
@implementation NuTemplateElement
|
||||
|
||||
+(id) elementForType: (NSString*)t withLabel: (NSString*)l
|
||||
{
|
||||
return [[[self alloc] autorelease] initForType:t withLabel:l];
|
||||
}
|
||||
|
||||
-(id) initForType: (NSString*)t withLabel: (NSString*)l
|
||||
{
|
||||
if( self = [super init] )
|
||||
{
|
||||
label = [l retain];
|
||||
type = [t retain];
|
||||
containing = nil;
|
||||
}
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
-(void) dealloc
|
||||
{
|
||||
[label release];
|
||||
[type release];
|
||||
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
-(id) copyWithZone: (NSZone*)zone
|
||||
{
|
||||
NuTemplateElement* el = [[[self class] allocWithZone: zone] initForType: type withLabel: label];
|
||||
|
||||
[el setContaining: [self containing]];
|
||||
|
||||
return el;
|
||||
}
|
||||
|
||||
|
||||
|
||||
-(void) setType:(NSString*)t
|
||||
{
|
||||
[t retain];
|
||||
[type release];
|
||||
type = t;
|
||||
}
|
||||
|
||||
-(NSString*) type
|
||||
{
|
||||
return type;
|
||||
}
|
||||
|
||||
-(void) setLabel:(NSString*)l
|
||||
{
|
||||
[l retain];
|
||||
[label release];
|
||||
label = l;
|
||||
}
|
||||
|
||||
-(NSString*) label
|
||||
{
|
||||
return label;
|
||||
}
|
||||
|
||||
-(void) setContaining: (NSMutableArray*)arr
|
||||
{
|
||||
containing = arr; // It contains *us*, so it's unlikely we survive longer than it'd do, and we don't want to create a ring.
|
||||
}
|
||||
|
||||
-(NSMutableArray*) containing
|
||||
{
|
||||
return containing;
|
||||
}
|
||||
|
||||
|
||||
-(int) subElementCount
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
-(NuTemplateElement*) subElementAtIndex: (int)n
|
||||
{
|
||||
return nil;
|
||||
}
|
||||
|
||||
-(void) readSubElementsFrom: (NuTemplateStream*)stream
|
||||
{
|
||||
// By default, items don't read any sub-elements.
|
||||
}
|
||||
|
||||
|
||||
-(void) readDataFrom: (NuTemplateStream*)stream
|
||||
{
|
||||
// You should read whatever kind of data your template field stands for from "stream"
|
||||
// and store it in an instance variable.
|
||||
}
|
||||
|
||||
|
||||
// Before writeDataTo: is called, this is called to calculate the final resource size:
|
||||
// Items with sub-elements should return the sizes of all their sub-elements here as well.
|
||||
-(unsigned int) sizeOnDisk
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
-(void) writeDataTo: (NuTemplateStream*)stream
|
||||
{
|
||||
// You should write out your data here.
|
||||
}
|
||||
|
||||
|
||||
-(NSString*) stringValue
|
||||
{
|
||||
return @"<unknown>";
|
||||
}
|
||||
|
||||
|
||||
-(void) setStringValue: (NSString*)str
|
||||
{
|
||||
// We need this method. Otherwise key/value coding throws an exception which screws up the table.
|
||||
NSLog(@"This template item can't accept any values, especially not \"%@\".",str);
|
||||
}
|
||||
|
||||
|
||||
@end
|
|
@ -1,20 +0,0 @@
|
|||
//
|
||||
// NuTemplateGroupElement.h
|
||||
// ResKnife (PB2)
|
||||
//
|
||||
// Created by Uli Kusterer on Tue Aug 05 2003.
|
||||
// Copyright (c) 2003 M. Uli Kusterer. All rights reserved.
|
||||
//
|
||||
|
||||
#import "NuTemplateElement.h"
|
||||
|
||||
|
||||
@interface NuTemplateGroupElement : NuTemplateElement
|
||||
{
|
||||
NSMutableArray* subElements;
|
||||
}
|
||||
|
||||
-(void) setSubElements: (NSMutableArray*)a;
|
||||
-(NSMutableArray*) subElements;
|
||||
|
||||
@end
|
|
@ -1,108 +0,0 @@
|
|||
//
|
||||
// NuTemplateGroupElement.m
|
||||
// ResKnife (PB2)
|
||||
//
|
||||
// Created by Uli Kusterer on Tue Aug 05 2003.
|
||||
// Copyright (c) 2003 M. Uli Kusterer. All rights reserved.
|
||||
//
|
||||
|
||||
#import "NuTemplateGroupElement.h"
|
||||
|
||||
|
||||
@implementation NuTemplateGroupElement
|
||||
|
||||
-(id) initForType: (NSString*)t withLabel: (NSString*)l
|
||||
{
|
||||
if( self = [super initForType:t withLabel:l] )
|
||||
subElements = [[NSMutableArray alloc] init];
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
-(void) dealloc
|
||||
{
|
||||
[subElements release];
|
||||
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
-(id) copyWithZone: (NSZone*)zone
|
||||
{
|
||||
NuTemplateGroupElement* el = [super copyWithZone: zone];
|
||||
|
||||
if( el )
|
||||
{
|
||||
NSMutableArray* arr = [[subElements mutableCopy] autorelease];
|
||||
NSEnumerator* enny = [arr objectEnumerator];
|
||||
NSObject* obj;
|
||||
unsigned x = 0;
|
||||
|
||||
while( obj = [enny nextObject] )
|
||||
{
|
||||
[arr replaceObjectAtIndex:x withObject: [[obj copy] autorelease]];
|
||||
x++;
|
||||
}
|
||||
|
||||
[el setSubElements: arr];
|
||||
}
|
||||
|
||||
return el;
|
||||
}
|
||||
|
||||
|
||||
-(void) setSubElements: (NSMutableArray*)a
|
||||
{
|
||||
[a retain];
|
||||
[subElements release];
|
||||
subElements = a;
|
||||
}
|
||||
|
||||
-(NSMutableArray*) subElements
|
||||
{
|
||||
return subElements;
|
||||
}
|
||||
|
||||
-(int) subElementCount
|
||||
{
|
||||
return [subElements count];
|
||||
}
|
||||
|
||||
-(NuTemplateElement*) subElementAtIndex: (int)n
|
||||
{
|
||||
return [subElements objectAtIndex: n];
|
||||
}
|
||||
|
||||
-(void) readSubElementsFrom: (NuTemplateStream*)stream
|
||||
{
|
||||
NSLog(@"Code for reading this object's sub-elements is missing.");
|
||||
}
|
||||
|
||||
|
||||
// Before writeDataTo: is called, this is called to calculate the final resource size:
|
||||
// This returns the sizes of all our sub-elements. If you subclass, add to that the size
|
||||
// of this element itself.
|
||||
-(unsigned int) sizeOnDisk
|
||||
{
|
||||
unsigned int theSize = 0;
|
||||
NSEnumerator* enny = [subElements objectEnumerator];
|
||||
NuTemplateElement* obj;
|
||||
|
||||
while( obj = [enny nextObject] )
|
||||
theSize += [obj sizeOnDisk];
|
||||
|
||||
return theSize;
|
||||
}
|
||||
|
||||
// Writes out the data of all our sub-elements here:
|
||||
-(void) writeDataTo: (NuTemplateStream*)stream
|
||||
{
|
||||
NSEnumerator* enny = [subElements objectEnumerator];
|
||||
NuTemplateElement* obj;
|
||||
|
||||
while( obj = [enny nextObject] )
|
||||
[obj writeDataTo: stream];
|
||||
}
|
||||
|
||||
|
||||
|
||||
@end
|
|
@ -1,28 +0,0 @@
|
|||
//
|
||||
// NuTemplateLSTBElement.h
|
||||
// ResKnife (PB2)
|
||||
//
|
||||
// Implements LSTB and LSTZ fields.
|
||||
//
|
||||
// Created by Uli Kusterer on Tue Aug 05 2003.
|
||||
// Copyright (c) 2003 M. Uli Kusterer. All rights reserved.
|
||||
//
|
||||
|
||||
#import <AppKit/AppKit.h>
|
||||
#import "NuTemplateGroupElement.h"
|
||||
|
||||
|
||||
@class NuTemplateLSTEElement;
|
||||
|
||||
|
||||
@interface NuTemplateLSTBElement : NuTemplateGroupElement
|
||||
{
|
||||
NuTemplateLSTEElement* endElement; // Template to create our "list end" element from.
|
||||
}
|
||||
|
||||
-(IBAction) showCreateResourceSheet: (id)sender;
|
||||
|
||||
-(void) setEndElement: (NuTemplateLSTEElement*)e;
|
||||
-(NuTemplateLSTEElement*) endElement;
|
||||
|
||||
@end
|
|
@ -1,162 +0,0 @@
|
|||
//
|
||||
// NuTemplateLSTBElement.m
|
||||
// ResKnife (PB2)
|
||||
//
|
||||
// Implements LSTB and LSTZ fields.
|
||||
//
|
||||
// Created by Uli Kusterer on Tue Aug 05 2003.
|
||||
// Copyright (c) 2003 M. Uli Kusterer. All rights reserved.
|
||||
//
|
||||
|
||||
#import "NuTemplateLSTBElement.h"
|
||||
#import "NuTemplateLSTEElement.h"
|
||||
|
||||
|
||||
@implementation NuTemplateLSTBElement
|
||||
|
||||
-(void) dealloc
|
||||
{
|
||||
[endElement release];
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
|
||||
-(void) readSubElementsFrom: (NuTemplateStream*)stream
|
||||
{
|
||||
while( [stream bytesToGo] > 0 )
|
||||
{
|
||||
NuTemplateElement* obj = [stream readOneElement];
|
||||
|
||||
if( [[obj type] isEqualToString: @"LSTE"] )
|
||||
{
|
||||
endElement = [obj retain];
|
||||
if( [type isEqualToString: @"LSTZ"] )
|
||||
[endElement setWritesZeroByte:YES];
|
||||
break;
|
||||
}
|
||||
[subElements addObject: obj];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
-(void) readDataForElements: (NuTemplateStream*)stream
|
||||
{
|
||||
NSEnumerator *enny = [subElements objectEnumerator];
|
||||
NuTemplateElement *el;
|
||||
|
||||
while( el = [enny nextObject] )
|
||||
{
|
||||
[el readDataFrom: stream];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
-(void) readDataFrom: (NuTemplateStream*)stream
|
||||
{
|
||||
BOOL isZeroTerminated = [type isEqualToString: @"LSTZ"];
|
||||
NSEnumerator *enny = [subElements objectEnumerator];
|
||||
NuTemplateElement *el, *nextItem;
|
||||
unsigned int bytesToGoAtStart = [stream bytesToGo];
|
||||
char termByte = 0;
|
||||
|
||||
/* Fill this first list element with data:
|
||||
If there is no more data in the stream, the items will
|
||||
fill themselves with default values. */
|
||||
if( isZeroTerminated )
|
||||
{
|
||||
termByte = 0;
|
||||
[stream peekAmount:1 toBuffer:&termByte]; // "Peek" doesn't change the read offset.
|
||||
if( termByte != 0 )
|
||||
[self readDataForElements: stream];
|
||||
}
|
||||
else
|
||||
[self readDataForElements: stream];
|
||||
|
||||
/* Read additional elements until we have enough items,
|
||||
except if we're not the first item in our list. */
|
||||
if( containing != nil )
|
||||
{
|
||||
while( [stream bytesToGo] > 0 )
|
||||
{
|
||||
if( isZeroTerminated ) // Is zero-terminated list? Check whether there is a termination byte.
|
||||
{
|
||||
termByte = 0;
|
||||
[stream peekAmount:1 toBuffer:&termByte]; // "Peek" doesn't change the read offset.
|
||||
if( termByte == 0 )
|
||||
break; // No need to actually read the peeked byte, LSTE will do that.
|
||||
}
|
||||
|
||||
// Actually read the item:
|
||||
nextItem = [[self copy] autorelease]; // Make another list item just like this one.
|
||||
[nextItem setContaining: nil]; // Make sure it doesn't get into this "if" clause.
|
||||
[containing addObject: nextItem]; // Add it below ourselves.
|
||||
[nextItem readDataFrom:stream]; // Read it the same way we were.
|
||||
[nextItem setContaining: containing]; // Set "containing" *after* readDataFrom so it doesn't pass the "containing == nil" check above.
|
||||
}
|
||||
|
||||
// Now add a terminating 'LSTE' item:
|
||||
NuTemplateLSTEElement* tlee;
|
||||
tlee = [[endElement copy] autorelease];
|
||||
[containing addObject: tlee];
|
||||
[tlee setContaining: containing];
|
||||
[tlee setGroupElemTemplate: self];
|
||||
[tlee readDataFrom: stream]; // If LSTE has data to read (e.g. if we're an LSTZ, the terminating byte), let it do that!
|
||||
|
||||
if( bytesToGoAtStart == 0 ) // It's an empty list. Delete this LSTB again, so we only have the empty LSTE.
|
||||
{
|
||||
[tlee setSubElements: subElements]; // Take over the LSTB's sub-elements.
|
||||
[containing removeObject:self]; // Remove the LSTB.
|
||||
}
|
||||
else
|
||||
[tlee setSubElements: [[subElements copy] autorelease]]; // Make a copy. So each has its own array.
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
-(NSString*) stringValue
|
||||
{
|
||||
return @"";
|
||||
}
|
||||
|
||||
|
||||
-(id) copyWithZone: (NSZone*)zone
|
||||
{
|
||||
NuTemplateLSTBElement* el = [super copyWithZone: zone];
|
||||
|
||||
[el setEndElement: [self endElement]];
|
||||
|
||||
return el;
|
||||
}
|
||||
|
||||
-(void) setEndElement: (NuTemplateLSTEElement*)e
|
||||
{
|
||||
[e retain];
|
||||
[endElement release];
|
||||
endElement = e;
|
||||
}
|
||||
|
||||
|
||||
-(NuTemplateLSTEElement*) endElement
|
||||
{
|
||||
return endElement;
|
||||
}
|
||||
|
||||
|
||||
-(IBAction) showCreateResourceSheet: (id)sender
|
||||
{
|
||||
unsigned idx = [containing indexOfObject:self];
|
||||
NuTemplateGroupElement* te = [[self copy] autorelease];
|
||||
|
||||
[containing insertObject:te atIndex:idx+1];
|
||||
[te setContaining:containing];
|
||||
}
|
||||
|
||||
|
||||
-(IBAction) clear: (id)sender
|
||||
{
|
||||
[[self retain] autorelease]; // Make sure we don't go away right now. That may surprise the one who called clear, or otherwise be bad.
|
||||
[containing removeObject: self]; // Remove us from the array we're in. (this releases us once)
|
||||
}
|
||||
|
||||
|
||||
@end
|
|
@ -1,33 +0,0 @@
|
|||
//
|
||||
// NuTemplateLSTCElement.h
|
||||
// ResKnife (PB2)
|
||||
//
|
||||
// Implements LSTB and LSTZ fields.
|
||||
//
|
||||
// Created by Uli Kusterer on Tue Aug 05 2003.
|
||||
// Copyright (c) 2003 M. Uli Kusterer. All rights reserved.
|
||||
//
|
||||
|
||||
#import <AppKit/AppKit.h>
|
||||
#import "NuTemplateGroupElement.h"
|
||||
|
||||
|
||||
@class NuTemplateLSTEElement;
|
||||
@class NuTemplateOCNTElement;
|
||||
|
||||
|
||||
@interface NuTemplateLSTCElement : NuTemplateGroupElement
|
||||
{
|
||||
NuTemplateLSTEElement* endElement; // Template to create our "list end" element from.
|
||||
NuTemplateOCNTElement* countElement; // Our "list counter" element.
|
||||
}
|
||||
|
||||
-(IBAction) showCreateResourceSheet: (id)sender;
|
||||
|
||||
-(void) setEndElement: (NuTemplateLSTEElement*)e;
|
||||
-(NuTemplateLSTEElement*) endElement;
|
||||
|
||||
-(void) setCountElement: (NuTemplateOCNTElement*)e;
|
||||
-(NuTemplateOCNTElement*) countElement;
|
||||
|
||||
@end
|
|
@ -1,173 +0,0 @@
|
|||
//
|
||||
// NuTemplateLSTCElement.m
|
||||
// ResKnife (PB2)
|
||||
//
|
||||
// Implements LSTB and LSTZ fields.
|
||||
//
|
||||
// Created by Uli Kusterer on Tue Aug 05 2003.
|
||||
// Copyright (c) 2003 M. Uli Kusterer. All rights reserved.
|
||||
//
|
||||
|
||||
#import "NuTemplateLSTCElement.h"
|
||||
#import "NuTemplateLSTEElement.h"
|
||||
#import "NuTemplateOCNTElement.h"
|
||||
|
||||
|
||||
@implementation NuTemplateLSTCElement
|
||||
|
||||
-(void) dealloc
|
||||
{
|
||||
[endElement release];
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
|
||||
-(void) readSubElementsFrom: (NuTemplateStream*)stream
|
||||
{
|
||||
countElement = [NuTemplateOCNTElement lastParsedElement];
|
||||
|
||||
while( [stream bytesToGo] > 0 )
|
||||
{
|
||||
NuTemplateElement* obj = [stream readOneElement];
|
||||
|
||||
if( [[obj type] isEqualToString: @"LSTE"] )
|
||||
{
|
||||
endElement = [obj retain];
|
||||
break;
|
||||
}
|
||||
[subElements addObject: obj];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
-(void) readDataForElements: (NuTemplateStream*)stream
|
||||
{
|
||||
NSEnumerator *enny = [subElements objectEnumerator];
|
||||
NuTemplateElement *el;
|
||||
|
||||
while( el = [enny nextObject] )
|
||||
{
|
||||
[el readDataFrom: stream];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
-(void) readDataFrom: (NuTemplateStream*)stream
|
||||
{
|
||||
NSEnumerator *enny = [subElements objectEnumerator];
|
||||
NuTemplateElement *el, *nextItem;
|
||||
unsigned int itemsToGo = 0,
|
||||
itemsToGoAtStart = 0;
|
||||
|
||||
countElement = [NuTemplateOCNTElement lastParsedElement];
|
||||
NSLog( @"countElement: %@", countElement );
|
||||
|
||||
itemsToGo = [countElement longValue];
|
||||
itemsToGoAtStart = itemsToGo;
|
||||
NSLog( @"LSTC: Number of items: %ld", itemsToGo );
|
||||
|
||||
// Read a first item:
|
||||
if( itemsToGo > 0 )
|
||||
{
|
||||
[self readDataForElements: stream];
|
||||
itemsToGo--;
|
||||
}
|
||||
|
||||
/* Read additional elements until we have enough items,
|
||||
except if we're not the first item in our list. */
|
||||
if( containing != nil )
|
||||
{
|
||||
while( itemsToGo-- )
|
||||
{
|
||||
// Actually read the item:
|
||||
nextItem = [[self copy] autorelease]; // Make another list item just like this one.
|
||||
[nextItem setContaining: nil]; // Make sure it doesn't get into this "if" clause.
|
||||
[containing addObject: nextItem]; // Add it below ourselves.
|
||||
[nextItem readDataFrom:stream]; // Read it the same way we were.
|
||||
[nextItem setContaining: containing]; // Set "containing" *after* readDataFrom so it doesn't pass the "containing == nil" check above.
|
||||
}
|
||||
|
||||
// Now add a terminating 'LSTE' item:
|
||||
NuTemplateLSTEElement* tlee;
|
||||
tlee = [[endElement copy] autorelease];
|
||||
[containing addObject: tlee];
|
||||
[tlee setContaining: containing];
|
||||
[tlee setGroupElemTemplate: self];
|
||||
[tlee setCountElement: countElement];
|
||||
[tlee readDataFrom: stream]; // If LSTE has data to read (e.g. if we're an LSTZ, the terminating byte), let it do that!
|
||||
|
||||
if( itemsToGoAtStart == 0 ) // It's an empty list. Delete this LSTC again, so we only have the empty LSTE.
|
||||
{
|
||||
[tlee setSubElements: subElements]; // Take over the LSTC's sub-elements.
|
||||
[containing removeObject:self]; // Remove the LSTB.
|
||||
}
|
||||
else
|
||||
[tlee setSubElements: [[subElements copy] autorelease]]; // Make a copy. So each has its own array.
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
-(NSString*) stringValue
|
||||
{
|
||||
return @"";
|
||||
}
|
||||
|
||||
|
||||
-(id) copyWithZone: (NSZone*)zone
|
||||
{
|
||||
NuTemplateLSTCElement* el = [super copyWithZone: zone];
|
||||
|
||||
[el setEndElement: [self endElement]];
|
||||
[el setCountElement: [self countElement]];
|
||||
|
||||
return el;
|
||||
}
|
||||
|
||||
|
||||
-(void) setEndElement: (NuTemplateLSTEElement*)e
|
||||
{
|
||||
[e retain];
|
||||
[endElement release];
|
||||
endElement = e;
|
||||
}
|
||||
|
||||
-(NuTemplateLSTEElement*) endElement
|
||||
{
|
||||
return endElement;
|
||||
}
|
||||
|
||||
|
||||
-(void) setCountElement: (NuTemplateOCNTElement*)e
|
||||
{
|
||||
countElement = e;
|
||||
}
|
||||
|
||||
-(NuTemplateOCNTElement*) countElement
|
||||
{
|
||||
return countElement;
|
||||
}
|
||||
|
||||
|
||||
-(IBAction) showCreateResourceSheet: (id)sender
|
||||
{
|
||||
unsigned idx = [containing indexOfObject:self];
|
||||
NuTemplateGroupElement* te = [[self copy] autorelease];
|
||||
|
||||
[containing insertObject:te atIndex:idx+1];
|
||||
[te setContaining:containing];
|
||||
|
||||
// Update "counter" item:
|
||||
[countElement setLongValue: ([countElement longValue] +1)];
|
||||
}
|
||||
|
||||
|
||||
-(IBAction) clear: (id)sender
|
||||
{
|
||||
[[self retain] autorelease]; // Make sure we don't go away right now. That may surprise the one who called clear, or otherwise be bad.
|
||||
[containing removeObject: self]; // Remove us from the array we're in. (this releases us once)
|
||||
|
||||
[countElement setLongValue: [countElement longValue] -1];
|
||||
}
|
||||
|
||||
|
||||
@end
|
|
@ -1,32 +0,0 @@
|
|||
//
|
||||
// NuTemplateLSTEElement.h
|
||||
// ResKnife (PB2)
|
||||
//
|
||||
// Created by Uli Kusterer on Tue Aug 05 2003.
|
||||
// Copyright (c) 2003 M. Uli Kusterer. All rights reserved.
|
||||
//
|
||||
|
||||
#import <AppKit/AppKit.h>
|
||||
#import "NuTemplateGroupElement.h"
|
||||
|
||||
@class NuTemplateOCNTElement;
|
||||
|
||||
@interface NuTemplateLSTEElement : NuTemplateGroupElement
|
||||
{
|
||||
NuTemplateGroupElement* groupElemTemplate; // The item of which we're to create a copy.
|
||||
NuTemplateOCNTElement* countElement; // The "counter" element if we're the end of an LSTC list.
|
||||
BOOL writesZeroByte; // Write a terminating zero-byte when writing out this item (used by LSTZ).
|
||||
}
|
||||
|
||||
-(IBAction) showCreateResourceSheet: (id)sender;
|
||||
|
||||
-(void) setWritesZeroByte: (BOOL)n;
|
||||
-(BOOL) writesZeroByte;
|
||||
|
||||
-(void) setGroupElemTemplate: (NuTemplateGroupElement*)e;
|
||||
-(NuTemplateGroupElement*) groupElemTemplate;
|
||||
|
||||
-(void) setCountElement: (NuTemplateOCNTElement*)e;
|
||||
-(NuTemplateOCNTElement*) countElement;
|
||||
|
||||
@end
|
|
@ -1,126 +0,0 @@
|
|||
//
|
||||
// NuTemplateLSTEElement.m
|
||||
// ResKnife (PB2)
|
||||
//
|
||||
// Created by Uli Kusterer on Tue Aug 05 2003.
|
||||
// Copyright (c) 2003 M. Uli Kusterer. All rights reserved.
|
||||
//
|
||||
|
||||
#import "NuTemplateLSTEElement.h"
|
||||
#import "NuTemplateLSTBElement.h"
|
||||
#import "NuTemplateOCNTElement.h"
|
||||
|
||||
@implementation NuTemplateLSTEElement
|
||||
|
||||
-(void) dealloc
|
||||
{
|
||||
[groupElemTemplate release];
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
|
||||
-(void) setGroupElemTemplate: (NuTemplateGroupElement*)e
|
||||
{
|
||||
[e retain];
|
||||
[groupElemTemplate release];
|
||||
groupElemTemplate = e;
|
||||
}
|
||||
|
||||
-(NuTemplateGroupElement*) groupElemTemplate
|
||||
{
|
||||
return groupElemTemplate;
|
||||
}
|
||||
|
||||
|
||||
-(void) setCountElement: (NuTemplateOCNTElement*)e
|
||||
{
|
||||
countElement = e;
|
||||
}
|
||||
|
||||
-(NuTemplateOCNTElement*) countElement
|
||||
{
|
||||
return countElement;
|
||||
}
|
||||
|
||||
|
||||
-(void) readSubElementsFrom: (NuTemplateStream*)stream
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
-(void) readDataFrom: (NuTemplateStream*)stream
|
||||
{
|
||||
if( writesZeroByte )
|
||||
{
|
||||
char termByte;
|
||||
[stream readAmount:1 toBuffer: &termByte];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Doesn't write any sub-elements because this is simply a placeholder to allow for empty lists:
|
||||
-(unsigned int) sizeOnDisk
|
||||
{
|
||||
return writesZeroByte ? 1 : 0;
|
||||
}
|
||||
|
||||
-(void) writeDataTo: (NuTemplateStream*)stream
|
||||
{
|
||||
if( writesZeroByte )
|
||||
{
|
||||
char fillByte = 0;
|
||||
[stream writeAmount:sizeof(fillByte) fromBuffer: &fillByte];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
-(int) subElementCount
|
||||
{
|
||||
return 0; // We don't want the user to be able to uncollapse us to see our sub-items.
|
||||
}
|
||||
|
||||
|
||||
-(NSString*) stringValue
|
||||
{
|
||||
return @"";
|
||||
}
|
||||
|
||||
|
||||
-(void) setWritesZeroByte: (BOOL)n
|
||||
{
|
||||
writesZeroByte = n;
|
||||
}
|
||||
|
||||
-(BOOL) writesZeroByte
|
||||
{
|
||||
return writesZeroByte;
|
||||
}
|
||||
|
||||
|
||||
-(id) copyWithZone: (NSZone*)zone
|
||||
{
|
||||
NuTemplateLSTEElement* el = [super copyWithZone: zone];
|
||||
|
||||
[el setGroupElemTemplate: [self groupElemTemplate]];
|
||||
[el setWritesZeroByte: [self writesZeroByte]];
|
||||
[el setCountElement: [self countElement]];
|
||||
|
||||
return el;
|
||||
}
|
||||
|
||||
|
||||
-(IBAction) showCreateResourceSheet: (id)sender
|
||||
{
|
||||
unsigned idx = [containing indexOfObject:self];
|
||||
NuTemplateGroupElement* ge = [[groupElemTemplate copy] autorelease];
|
||||
|
||||
[containing insertObject:ge atIndex:idx];
|
||||
[ge setContaining: containing];
|
||||
[countElement setLongValue: ([countElement longValue] +1)];
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@end
|
|
@ -1,26 +0,0 @@
|
|||
//
|
||||
// NuTemplateOCNTElement.h
|
||||
// ResKnife (PB2)
|
||||
//
|
||||
// Created by Uli Kusterer on Tue Aug 05 2003.
|
||||
// Copyright (c) 2003 M. Uli Kusterer. All rights reserved.
|
||||
//
|
||||
|
||||
#import "NuTemplateElement.h"
|
||||
|
||||
|
||||
@interface NuTemplateOCNTElement : NuTemplateElement
|
||||
{
|
||||
unsigned long longValue;
|
||||
}
|
||||
|
||||
+(NuTemplateOCNTElement*) lastParsedElement;
|
||||
+(void) setLastParsedElement: (NuTemplateOCNTElement*)e;
|
||||
|
||||
-(void) setLongValue: (unsigned long)n;
|
||||
-(unsigned long) longValue;
|
||||
|
||||
-(NSString*) stringValue;
|
||||
-(void) setStringValue: (NSString*)str;
|
||||
|
||||
@end
|
|
@ -1,159 +0,0 @@
|
|||
//
|
||||
// NuTemplateOCNTElement.m
|
||||
// ResKnife (PB2)
|
||||
//
|
||||
// Created by Uli Kusterer on Tue Aug 05 2003.
|
||||
// Copyright (c) 2003 M. Uli Kusterer. All rights reserved.
|
||||
//
|
||||
|
||||
#import "NuTemplateOCNTElement.h"
|
||||
|
||||
|
||||
static NuTemplateOCNTElement* sLastParsedElement = nil;
|
||||
|
||||
|
||||
@implementation NuTemplateOCNTElement
|
||||
|
||||
+(NuTemplateOCNTElement*) lastParsedElement
|
||||
{
|
||||
return sLastParsedElement;
|
||||
}
|
||||
|
||||
+(void) setLastParsedElement: (NuTemplateOCNTElement*)e
|
||||
{
|
||||
NSLog( @"[NuTemplateOCNTElement setLastParsedElement: %@]", e );
|
||||
sLastParsedElement = e;
|
||||
}
|
||||
|
||||
|
||||
-(id) initForType: (NSString*)t withLabel: (NSString*)l
|
||||
{
|
||||
if( self = [super initForType:t withLabel:l] )
|
||||
longValue = 0;
|
||||
|
||||
[[self class] setLastParsedElement:self];
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
-(id) copyWithZone: (NSZone*)zone
|
||||
{
|
||||
NuTemplateOCNTElement* el = [super copyWithZone: zone];
|
||||
|
||||
if( el )
|
||||
{
|
||||
[el setLongValue: longValue];
|
||||
[[self class] setLastParsedElement:el];
|
||||
}
|
||||
|
||||
return el;
|
||||
}
|
||||
|
||||
|
||||
-(void) readDataFrom: (NuTemplateStream*)stream
|
||||
{
|
||||
if( [type isEqualToString: @"LCNT"] )
|
||||
[stream readAmount:4 toBuffer: &longValue];
|
||||
else if( [type isEqualToString: @"LZCT"] )
|
||||
{
|
||||
[stream readAmount:sizeof(longValue) toBuffer: &longValue];
|
||||
longValue += 1;
|
||||
}
|
||||
else if( [type isEqualToString: @"BCNT"] )
|
||||
{
|
||||
unsigned char n = 0;
|
||||
[stream readAmount:sizeof(n) toBuffer: &n];
|
||||
longValue = n;
|
||||
}
|
||||
else if( [type isEqualToString: @"BZCT"] )
|
||||
{
|
||||
char n = 0;
|
||||
[stream readAmount:sizeof(n) toBuffer: &n];
|
||||
longValue = n;
|
||||
}
|
||||
else if( [type isEqualToString: @"ZCNT"] )
|
||||
{
|
||||
short n = -1;
|
||||
[stream readAmount:sizeof(n) toBuffer: &n];
|
||||
longValue = n +1;
|
||||
}
|
||||
else // OCNT, WCNT
|
||||
{
|
||||
unsigned short n = 0;
|
||||
[stream readAmount:sizeof(n) toBuffer: &n];
|
||||
longValue = n;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
-(unsigned int) sizeOnDisk
|
||||
{
|
||||
if( [type isEqualToString: @"LCNT"] )
|
||||
return 4;
|
||||
else if( [type isEqualToString: @"LZCT"] )
|
||||
return 4;
|
||||
else if( [type isEqualToString: @"BZCT"] )
|
||||
return 1;
|
||||
else if( [type isEqualToString: @"BCNT"] )
|
||||
return 1;
|
||||
else // OCNT, WCNT, ZCNT
|
||||
return 2;
|
||||
}
|
||||
|
||||
-(void) writeDataTo: (NuTemplateStream*)stream
|
||||
{
|
||||
if( [type isEqualToString: @"LCNT"] )
|
||||
[stream writeAmount:4 fromBuffer: &longValue];
|
||||
else if( [type isEqualToString: @"LZCT"] )
|
||||
{
|
||||
long n = longValue -1;
|
||||
[stream writeAmount:sizeof(n) fromBuffer: &n];
|
||||
}
|
||||
else if( [type isEqualToString: @"BZCT"] )
|
||||
{
|
||||
char n = longValue -1;
|
||||
[stream writeAmount:sizeof(n) fromBuffer: &n];
|
||||
}
|
||||
else if( [type isEqualToString: @"BCNT"] )
|
||||
{
|
||||
unsigned char n = longValue -1;
|
||||
[stream writeAmount:sizeof(n) fromBuffer: &n];
|
||||
}
|
||||
else if( [type isEqualToString: @"ZCNT"] )
|
||||
{
|
||||
short n = longValue -1;
|
||||
[stream writeAmount:sizeof(n) fromBuffer: &n];
|
||||
}
|
||||
else // OCNT, WCNT
|
||||
{
|
||||
unsigned short n = longValue;
|
||||
[stream writeAmount:sizeof(n) fromBuffer: &n];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
-(void) setLongValue: (unsigned long)d
|
||||
{
|
||||
longValue = d;
|
||||
}
|
||||
|
||||
-(unsigned long) longValue
|
||||
{
|
||||
return longValue;
|
||||
}
|
||||
|
||||
|
||||
-(NSString*) stringValue
|
||||
{
|
||||
return [NSString stringWithFormat: @"%ld", longValue];
|
||||
}
|
||||
|
||||
|
||||
-(void) setStringValue: (NSString*)str
|
||||
{
|
||||
// Dummy out. User can't change counter this way, they have to add items.
|
||||
}
|
||||
|
||||
|
||||
|
||||
@end
|
|
@ -1,20 +0,0 @@
|
|||
//
|
||||
// NuTemplatePSTRElement.h
|
||||
// ResKnife (PB2)
|
||||
//
|
||||
// Created by Uli Kusterer on Tue Aug 05 2003.
|
||||
// Copyright (c) 2003 M. Uli Kusterer. All rights reserved.
|
||||
//
|
||||
|
||||
#import "NuTemplateElement.h"
|
||||
|
||||
|
||||
@interface NuTemplatePSTRElement : NuTemplateElement
|
||||
{
|
||||
NSString* stringValue;
|
||||
}
|
||||
|
||||
-(void) setStringValue: (NSString*)d;
|
||||
-(NSString*) stringValue;
|
||||
|
||||
@end
|
|
@ -1,105 +0,0 @@
|
|||
//
|
||||
// NuTemplatePSTRElement.m
|
||||
// ResKnife (PB2)
|
||||
//
|
||||
// Created by Uli Kusterer on Tue Aug 05 2003.
|
||||
// Copyright (c) 2003 M. Uli Kusterer. All rights reserved.
|
||||
//
|
||||
|
||||
#import "NuTemplatePSTRElement.h"
|
||||
|
||||
|
||||
@implementation NuTemplatePSTRElement
|
||||
|
||||
-(id) initForType: (NSString*)t withLabel: (NSString*)l
|
||||
{
|
||||
if( self = [super initForType:t withLabel:l] )
|
||||
stringValue = [[NSString alloc] init];
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
-(void) dealloc
|
||||
{
|
||||
[stringValue release];
|
||||
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
-(id) copyWithZone: (NSZone*)zone
|
||||
{
|
||||
NuTemplatePSTRElement* el = [super copyWithZone: zone];
|
||||
|
||||
if( el )
|
||||
[el setStringValue: stringValue];
|
||||
|
||||
return el;
|
||||
}
|
||||
|
||||
|
||||
-(void) readDataFrom: (NuTemplateStream*)stream
|
||||
{
|
||||
char buf[256] = { 0 };
|
||||
|
||||
if( [type isEqualToString: @"PSTR"] ) // Packed, variable-length string.
|
||||
{
|
||||
[stream readAmount:1 toBuffer: buf];
|
||||
[stream readAmount:buf[0] toBuffer: (buf +1)];
|
||||
}
|
||||
else if( [type isEqualToString: @"P100"] ) // Constant-size string. Resourcerer-style P100, not ResEdit-style P0FF.
|
||||
[stream readAmount:256 toBuffer: buf];
|
||||
else if( [type isEqualToString: @"P020"] ) // Constant-size string. Resourcerer-style P020, not ResEdit-style P01F.
|
||||
[stream readAmount:32 toBuffer: buf];
|
||||
else if( [type isEqualToString: @"P040"] ) // Constant-size string. Resourcerer-style P040, not ResEdit-style P03F.
|
||||
[stream readAmount:64 toBuffer: buf];
|
||||
|
||||
[self setStringValue: [NSString stringWithCString:(buf +1) length:buf[0]]];
|
||||
|
||||
NSLog(@"PSTR: %@", stringValue);
|
||||
}
|
||||
|
||||
|
||||
// Before writeDataTo: is called, this is called to calculate the final resource size:
|
||||
-(unsigned int) sizeOnDisk
|
||||
{
|
||||
if( [type isEqualToString: @"PSTR"] )
|
||||
return [stringValue length] +1;
|
||||
else if( [type isEqualToString: @"P100"] ) // Str255
|
||||
return 256;
|
||||
else if( [type isEqualToString: @"P020"] ) // Str31
|
||||
return 32;
|
||||
else if( [type isEqualToString: @"P040"] ) // Str63
|
||||
return 64;
|
||||
else
|
||||
return 1;
|
||||
}
|
||||
|
||||
-(void) writeDataTo: (NuTemplateStream*)stream
|
||||
{
|
||||
unsigned char buf[257] = { 0 }; // 256 + terminating zero-byte (which isn't written, but generated by getCString)
|
||||
|
||||
[stringValue getCString:(buf +1) maxLength:255];
|
||||
buf[0] = [stringValue length];
|
||||
if( [type isEqualToString: @"PSTR"] )
|
||||
[stream writeAmount:([stringValue length] +1) fromBuffer:buf];
|
||||
else
|
||||
[stream writeAmount:[self sizeOnDisk] fromBuffer:buf];
|
||||
}
|
||||
|
||||
|
||||
-(void) setStringValue: (NSString*)d
|
||||
{
|
||||
[d retain];
|
||||
[stringValue release];
|
||||
stringValue = d;
|
||||
}
|
||||
|
||||
|
||||
-(NSString*) stringValue
|
||||
{
|
||||
return stringValue;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@end
|
|
@ -1,38 +0,0 @@
|
|||
//
|
||||
// NuTemplateStream.h
|
||||
// ResKnife (PB2)
|
||||
//
|
||||
// Created by Uli Kusterer on Tue Aug 05 2003.
|
||||
// Copyright (c) 2003 M. Uli Kusterer. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
|
||||
@class NuTemplateElement;
|
||||
|
||||
|
||||
@interface NuTemplateStream : NSObject
|
||||
{
|
||||
unsigned int bytesToGo;
|
||||
char* data;
|
||||
}
|
||||
|
||||
+(NSMutableDictionary*) fieldRegistry;
|
||||
|
||||
+(id) streamWithBytes: (char*)d length: (unsigned int)l;
|
||||
+(id) substreamWithStream: (NuTemplateStream*)s length: (unsigned int)l;
|
||||
|
||||
-(id) initStreamWithBytes: (char*)d length: (unsigned int)l;
|
||||
-(id) initWithStream: (NuTemplateStream*)s length: (unsigned int)l;
|
||||
|
||||
-(unsigned int) bytesToGo;
|
||||
-(char*) data;
|
||||
|
||||
-(NuTemplateElement*) readOneElement; // For parsing of 'TMPL' resource as template.
|
||||
-(void) readAmount: (unsigned int)l toBuffer: (void*)buf; // For reading data from the resource.
|
||||
-(void) peekAmount: (unsigned int)l toBuffer: (void*)buf; // For examining data w/o advancing the read/write mark.
|
||||
|
||||
-(void) writeAmount: (unsigned int)l fromBuffer: (void*)buf; // For writing data back to the resource.
|
||||
|
||||
@end
|
|
@ -1,135 +0,0 @@
|
|||
//
|
||||
// NuTemplateStream.m
|
||||
// ResKnife (PB2)
|
||||
//
|
||||
// Created by Uli Kusterer on Tue Aug 05 2003.
|
||||
// Copyright (c) 2003 M. Uli Kusterer. All rights reserved.
|
||||
//
|
||||
|
||||
#import "NuTemplateStream.h"
|
||||
#import "NuTemplateElement.h"
|
||||
|
||||
|
||||
@implementation NuTemplateStream
|
||||
|
||||
+(NSMutableDictionary*) fieldRegistry
|
||||
{
|
||||
static NSMutableDictionary* sFieldRegistry = nil;
|
||||
|
||||
if( !sFieldRegistry )
|
||||
sFieldRegistry = [[NSMutableDictionary alloc] init];
|
||||
|
||||
return sFieldRegistry;
|
||||
}
|
||||
|
||||
+(id) streamWithBytes: (char*)d length: (unsigned int)l
|
||||
{
|
||||
return [[[self alloc] autorelease] initStreamWithBytes:d length:l];
|
||||
}
|
||||
|
||||
+(id) substreamWithStream: (NuTemplateStream*)s length: (unsigned int)l
|
||||
{
|
||||
return [[[self alloc] autorelease] initWithStream:s length:l];
|
||||
}
|
||||
|
||||
|
||||
-(id) initStreamWithBytes: (char*)d length: (unsigned int)l
|
||||
{
|
||||
if( self = [super init] )
|
||||
{
|
||||
data = d;
|
||||
bytesToGo = l;
|
||||
}
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
-(id) initWithStream: (NuTemplateStream*)s length: (unsigned int)l
|
||||
{
|
||||
if( self = [super init] )
|
||||
{
|
||||
data = [s data];
|
||||
if( l > [s bytesToGo] )
|
||||
bytesToGo = [s bytesToGo];
|
||||
else
|
||||
bytesToGo = l;
|
||||
}
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
|
||||
-(unsigned int) bytesToGo
|
||||
{
|
||||
return bytesToGo;
|
||||
}
|
||||
|
||||
|
||||
-(char*) data
|
||||
{
|
||||
return data;
|
||||
}
|
||||
|
||||
|
||||
-(NuTemplateElement*) readOneElement
|
||||
{
|
||||
NSString* label = [NSString stringWithCString: data +1 length: *data];
|
||||
unsigned long labelLen = (*data) +1;
|
||||
NuTemplateElement* obj = nil;
|
||||
data += labelLen;
|
||||
|
||||
// Get type (4 characters after that):
|
||||
NSString* type = [NSString stringWithCString: data length: 4];
|
||||
data += 4;
|
||||
|
||||
// Update number of bytes left: (termination criterion!)
|
||||
bytesToGo -= labelLen +4;
|
||||
|
||||
// TODO: We should really look up the class for an entry of this type in a dictionary:
|
||||
Class theClass = [[NuTemplateStream fieldRegistry] objectForKey:type];
|
||||
obj = (NuTemplateElement*) [theClass elementForType:type withLabel:label];
|
||||
[obj readSubElementsFrom: self];
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
||||
|
||||
-(void) readAmount: (unsigned int)l toBuffer: (void*)buf
|
||||
{
|
||||
if( l > bytesToGo )
|
||||
l = bytesToGo;
|
||||
|
||||
if( l > 0 )
|
||||
{
|
||||
memmove( buf, data, l );
|
||||
data += l;
|
||||
bytesToGo -= l;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
-(void) peekAmount: (unsigned int)l toBuffer: (void*)buf
|
||||
{
|
||||
if( l > bytesToGo )
|
||||
l = bytesToGo;
|
||||
|
||||
if( l > 0 )
|
||||
memmove( buf, data, l );
|
||||
}
|
||||
|
||||
|
||||
-(void) writeAmount: (unsigned int)l fromBuffer: (void*)buf
|
||||
{
|
||||
if( l > bytesToGo )
|
||||
l = bytesToGo;
|
||||
|
||||
if( l > 0 )
|
||||
{
|
||||
memmove( data, buf, l );
|
||||
data += l;
|
||||
bytesToGo -= l;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@end
|
|
@ -1,20 +0,0 @@
|
|||
//
|
||||
// NuTemplateTNAMElement.h
|
||||
// ResKnife (PB2)
|
||||
//
|
||||
// Created by Uli Kusterer on Tue Aug 05 2003.
|
||||
// Copyright (c) 2003 M. Uli Kusterer. All rights reserved.
|
||||
//
|
||||
|
||||
#import "NuTemplateElement.h"
|
||||
|
||||
|
||||
@interface NuTemplateTNAMElement : NuTemplateElement
|
||||
{
|
||||
NSString* stringValue;
|
||||
}
|
||||
|
||||
-(void) setStringValue: (NSString*)d;
|
||||
-(NSString*) stringValue;
|
||||
|
||||
@end
|
|
@ -1,82 +0,0 @@
|
|||
//
|
||||
// NuTemplateTNAMElement.m
|
||||
// ResKnife (PB2)
|
||||
//
|
||||
// Created by Uli Kusterer on Tue Aug 05 2003.
|
||||
// Copyright (c) 2003 M. Uli Kusterer. All rights reserved.
|
||||
//
|
||||
|
||||
#import "NuTemplateTNAMElement.h"
|
||||
|
||||
|
||||
@implementation NuTemplateTNAMElement
|
||||
|
||||
-(id) initForType: (NSString*)t withLabel: (NSString*)l
|
||||
{
|
||||
if( self = [super initForType:t withLabel:l] )
|
||||
stringValue = [[NSString alloc] init];
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
-(void) dealloc
|
||||
{
|
||||
[stringValue release];
|
||||
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
-(id) copyWithZone: (NSZone*)zone
|
||||
{
|
||||
NuTemplateTNAMElement* el = [super copyWithZone: zone];
|
||||
|
||||
if( el )
|
||||
[el setStringValue: stringValue];
|
||||
|
||||
return el;
|
||||
}
|
||||
|
||||
|
||||
-(void) readDataFrom: (NuTemplateStream*)stream
|
||||
{
|
||||
char buf[4] = { ' ', ' ', ' ', ' ' };
|
||||
|
||||
[stream readAmount:4 toBuffer: buf];
|
||||
|
||||
[self setStringValue: [NSString stringWithCString:buf length:4]];
|
||||
|
||||
NSLog(@"TNAM: %@", stringValue);
|
||||
}
|
||||
|
||||
|
||||
// Before writeDataTo: is called, this is called to calculate the final resource size:
|
||||
-(unsigned int) sizeOnDisk
|
||||
{
|
||||
return 4;
|
||||
}
|
||||
|
||||
-(void) writeDataTo: (NuTemplateStream*)stream
|
||||
{
|
||||
char buf[5] = { ' ', ' ', ' ', ' ', 0 };
|
||||
|
||||
[stringValue getCString:buf maxLength:4];
|
||||
[stream writeAmount:4 fromBuffer:buf];
|
||||
}
|
||||
|
||||
|
||||
-(void) setStringValue: (NSString*)d
|
||||
{
|
||||
[d retain];
|
||||
[stringValue release];
|
||||
stringValue = d;
|
||||
}
|
||||
|
||||
|
||||
-(NSString*) stringValue
|
||||
{
|
||||
return stringValue;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@end
|
|
@ -1,59 +0,0 @@
|
|||
/* =============================================================================
|
||||
PROJECT: ResKnife
|
||||
FILE: NuTemplateWindowController.h
|
||||
|
||||
PURPOSE: This is the main class of our template editor. Every
|
||||
resource editor's main class implements the
|
||||
ResKnifePluginProtocol. Every editor should implement
|
||||
initWithResource:. Only implement initWithResources: if you feel
|
||||
like writing a template editor.
|
||||
|
||||
Note that your plugin is responsible for committing suicide
|
||||
after its window has been closed. If you subclass it from
|
||||
NSWindowController, the controller will take care of that
|
||||
for you, according to a guy named Doug.
|
||||
|
||||
AUTHORS: M. Uli Kusterer, witness(at)zathras.de, (c) 2003.
|
||||
|
||||
REVISIONS:
|
||||
2003-07-31 UK Created.
|
||||
========================================================================== */
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
Headers:
|
||||
-------------------------------------------------------------------------- */
|
||||
|
||||
#import <Cocoa/Cocoa.h>
|
||||
#import "ResKnifePluginProtocol.h"
|
||||
#import "ResKnifeResourceProtocol.h"
|
||||
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
Interface:
|
||||
-------------------------------------------------------------------------- */
|
||||
|
||||
@interface NuTemplateWindowController : NSWindowController <ResKnifeTemplatePluginProtocol>
|
||||
{
|
||||
IBOutlet NSOutlineView* displayList; // template display (debug only).
|
||||
IBOutlet NSOutlineView* dataList; // Data display.
|
||||
|
||||
NSMutableArray* templateStructure; // Pre-parsed form of our template.
|
||||
NSMutableArray* resourceStructure; // Parsed form of our resource.
|
||||
id <ResKnifeResourceProtocol> resource; // The resource we operate on.
|
||||
NSMenuItem* createFieldItem; // "Create Resource" menu item we usurp to create list items.
|
||||
}
|
||||
|
||||
-(void) readTemplate: (id <ResKnifeResourceProtocol>)tmplRes;
|
||||
-(void) reloadResData;
|
||||
-(void) resourceDataDidChange: (NSNotification*)notification;
|
||||
-(void) writeResData;
|
||||
|
||||
-(IBAction) showCreateResourceSheet: (id)sender;
|
||||
-(IBAction) cut: (id)sender;
|
||||
-(IBAction) copy: (id)sender;
|
||||
-(IBAction) paste: (id)sender;
|
||||
-(IBAction) clear: (id)sender;
|
||||
-(IBAction) saveDocument: (id)sender;
|
||||
|
||||
|
||||
@end
|
|
@ -1,371 +0,0 @@
|
|||
/* =============================================================================
|
||||
PROJECT: ResKnife
|
||||
FILE: NuTemplateWindowController.h
|
||||
|
||||
PURPOSE: This is the main class of our template editor. Every
|
||||
resource editor's main class implements the
|
||||
ResKnifePluginProtocol. Every editor should implement
|
||||
initWithResource:. Only implement initWithResources: if you feel
|
||||
like writing a template editor.
|
||||
|
||||
Note that your plugin is responsible for committing suicide
|
||||
after its window has been closed. If you subclass it from
|
||||
NSWindowController, the controller will take care of that
|
||||
for you, according to a guy named Doug.
|
||||
|
||||
AUTHORS: M. Uli Kusterer, witness(at)zathras.de, (c) 2003.
|
||||
|
||||
REVISIONS:
|
||||
2003-07-31 UK Created.
|
||||
========================================================================== */
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
Headers:
|
||||
-------------------------------------------------------------------------- */
|
||||
|
||||
#import "NuTemplateWindowController.h"
|
||||
#import "NuTemplateElement.h"
|
||||
#import "NuTemplateLSTBElement.h"
|
||||
#import "NuTemplateLSTEElement.h"
|
||||
#import "NuTemplateTNAMElement.h"
|
||||
#import "NuTemplatePSTRElement.h"
|
||||
#import "NuTemplateDWRDElement.h"
|
||||
#import "NuTemplateDLNGElement.h"
|
||||
#import "NuTemplateDBYTElement.h"
|
||||
#import "NuTemplateOCNTElement.h"
|
||||
#import "NuTemplateLSTCElement.h"
|
||||
#import "NuTemplateStream.h"
|
||||
|
||||
#import "NSOutlineView-SelectedItems.h"
|
||||
|
||||
|
||||
@implementation NuTemplateWindowController
|
||||
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
initWithResource:
|
||||
This is it! This is the constructor. Create your window here and
|
||||
do whatever else makes you happy. A new instance is created for each
|
||||
resource. Note that you are responsible for keeping track of your
|
||||
resource.
|
||||
-------------------------------------------------------------------------- */
|
||||
|
||||
- (id)initWithResource:(id)newResource
|
||||
{
|
||||
return [self initWithResources:newResource, nil];
|
||||
}
|
||||
|
||||
- (id)initWithResources:(id)newResource, ...
|
||||
{
|
||||
id currentResource;
|
||||
va_list resourceList;
|
||||
|
||||
va_start( resourceList, newResource );
|
||||
|
||||
self = [self initWithWindowNibName:@"NuTemplateWindow"];
|
||||
if( !self )
|
||||
{
|
||||
va_end( resourceList );
|
||||
return self;
|
||||
}
|
||||
|
||||
createFieldItem = nil;
|
||||
resource = [newResource retain];
|
||||
templateStructure = [[NSMutableArray alloc] init];
|
||||
resourceStructure = [[NSMutableArray alloc] init];
|
||||
|
||||
currentResource = va_arg( resourceList, id );
|
||||
[self readTemplate:currentResource]; // reads (but doesn't retain) the template for this resource (TMPL resource with name equal to the passed resource's type)
|
||||
|
||||
while( currentResource = va_arg( resourceList, id ) )
|
||||
NSLog( @"too many params passed to -initWithResources: %@", [currentResource description] );
|
||||
va_end( resourceList );
|
||||
|
||||
// load the window from the nib
|
||||
[self window];
|
||||
return self;
|
||||
}
|
||||
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
* DESTRUCTOR
|
||||
-------------------------------------------------------------------------- */
|
||||
|
||||
-(void) dealloc
|
||||
{
|
||||
[[NSNotificationCenter defaultCenter] removeObserver:self];
|
||||
[(id)resource autorelease];
|
||||
[templateStructure release];
|
||||
[resourceStructure release];
|
||||
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
windowDidLoad:
|
||||
Our window is there, stuff the image in it.
|
||||
-------------------------------------------------------------------------- */
|
||||
|
||||
-(void) windowDidLoad
|
||||
{
|
||||
[super windowDidLoad];
|
||||
|
||||
// set the window's title
|
||||
[[self window] setTitle:[resource nameForEditorWindow]];
|
||||
|
||||
[self reloadResData];
|
||||
|
||||
// we don't want this notification until we have a window! (Only register for notifications on the resource we're editing)
|
||||
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(resourceDataDidChange:) name:ResourceDataDidChangeNotification object:resource];
|
||||
|
||||
// finally, show the window
|
||||
[self showWindow:self];
|
||||
|
||||
[displayList reloadData];
|
||||
}
|
||||
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
resourceDataDidChange:
|
||||
Notification that someone changed our resource's data and we should
|
||||
update our display.
|
||||
-------------------------------------------------------------------------- */
|
||||
|
||||
-(void) resourceDataDidChange: (NSNotification*)notification
|
||||
{
|
||||
// ensure it's our resource which got changed (should always be true, we don't register for notifications on other resource objects)
|
||||
if( [notification object] == (id)resource )
|
||||
[self reloadResData];
|
||||
}
|
||||
|
||||
|
||||
-(void) reloadResData
|
||||
{
|
||||
char* theData = (char*) [[resource data] bytes];
|
||||
unsigned long bytesToGo = [[resource data] length];
|
||||
NuTemplateStream* stream = [NuTemplateStream streamWithBytes: theData length: bytesToGo];
|
||||
NSEnumerator* enny = [templateStructure objectEnumerator];
|
||||
NuTemplateElement* currElement;
|
||||
|
||||
[resourceStructure removeAllObjects]; // Get rid of old parsed resource.
|
||||
|
||||
// Loop over template and read each field:
|
||||
while( currElement = [enny nextObject] )
|
||||
{
|
||||
currElement = [[currElement copy] autorelease]; // Copy the template object.
|
||||
|
||||
if( [[currElement type] isEqualToString: @"OCNT"] )
|
||||
NSLog( @"Instantiated: %@", currElement );
|
||||
|
||||
[resourceStructure addObject: currElement]; // Add it to our parsed resource data list. Do this right away so the element can append other items should it desire to.
|
||||
[currElement setContaining: resourceStructure];
|
||||
[currElement readDataFrom: stream]; // Fill it with resource data.
|
||||
}
|
||||
|
||||
[dataList reloadData]; // Make sure our outline view displays the new data.
|
||||
}
|
||||
|
||||
|
||||
-(void) writeResData
|
||||
{
|
||||
unsigned int theSize = 0;
|
||||
NSEnumerator* enny = [resourceStructure objectEnumerator];
|
||||
NuTemplateElement* obj;
|
||||
|
||||
while( obj = [enny nextObject] )
|
||||
theSize += [obj sizeOnDisk];
|
||||
|
||||
NSMutableData* newData = [NSMutableData dataWithLength: theSize];
|
||||
NuTemplateStream* stream = [NuTemplateStream streamWithBytes: [newData bytes] length: theSize];
|
||||
|
||||
enny = [resourceStructure objectEnumerator];
|
||||
while( obj = [enny nextObject] )
|
||||
[obj writeDataTo: stream];
|
||||
|
||||
[resource setData: newData];
|
||||
}
|
||||
|
||||
|
||||
-(void) readTemplate: (id <ResKnifeResourceProtocol>)tmplRes
|
||||
{
|
||||
char* theData = (char*) [[tmplRes data] bytes];
|
||||
unsigned long bytesToGo = [[tmplRes data] length];
|
||||
NuTemplateStream* stream = [NuTemplateStream streamWithBytes: theData length: bytesToGo];
|
||||
NSMutableDictionary* fieldReg = [NuTemplateStream fieldRegistry];
|
||||
|
||||
// Registry empty? Add field types we support:
|
||||
if( [fieldReg count] == 0 )
|
||||
{
|
||||
[fieldReg setObject: [NuTemplateLSTBElement class] forKey: @"LSTB"];
|
||||
[fieldReg setObject: [NuTemplateLSTBElement class] forKey: @"LSTZ"];
|
||||
[fieldReg setObject: [NuTemplateLSTEElement class] forKey: @"LSTE"];
|
||||
[fieldReg setObject: [NuTemplateTNAMElement class] forKey: @"TNAM"];
|
||||
[fieldReg setObject: [NuTemplatePSTRElement class] forKey: @"PSTR"];
|
||||
[fieldReg setObject: [NuTemplatePSTRElement class] forKey: @"P100"];
|
||||
[fieldReg setObject: [NuTemplatePSTRElement class] forKey: @"P020"];
|
||||
[fieldReg setObject: [NuTemplatePSTRElement class] forKey: @"P040"];
|
||||
[fieldReg setObject: [NuTemplateDWRDElement class] forKey: @"DWRD"];
|
||||
[fieldReg setObject: [NuTemplateDLNGElement class] forKey: @"DLNG"];
|
||||
[fieldReg setObject: [NuTemplateDBYTElement class] forKey: @"DBYT"];
|
||||
[fieldReg setObject: [NuTemplateDBYTElement class] forKey: @"CHAR"];
|
||||
[fieldReg setObject: [NuTemplateOCNTElement class] forKey: @"OCNT"];
|
||||
[fieldReg setObject: [NuTemplateOCNTElement class] forKey: @"ZCNT"];
|
||||
[fieldReg setObject: [NuTemplateOCNTElement class] forKey: @"LCNT"];
|
||||
[fieldReg setObject: [NuTemplateOCNTElement class] forKey: @"LZCT"];
|
||||
[fieldReg setObject: [NuTemplateLSTCElement class] forKey: @"LSTC"];
|
||||
}
|
||||
|
||||
// Read new fields from the template and add them to our list:
|
||||
while( [stream bytesToGo] > 0 )
|
||||
{
|
||||
NuTemplateElement* obj = [stream readOneElement];
|
||||
|
||||
[templateStructure addObject: obj];
|
||||
}
|
||||
|
||||
[displayList reloadData];
|
||||
}
|
||||
|
||||
|
||||
-(id) outlineView:(NSOutlineView*)outlineView child:(int)index ofItem:(id)item
|
||||
{
|
||||
if( (item == nil) && (outlineView == displayList) )
|
||||
return [templateStructure objectAtIndex:index];
|
||||
else if( (item == nil) && (outlineView == dataList) )
|
||||
return [resourceStructure objectAtIndex:index];
|
||||
else
|
||||
return [item subElementAtIndex: index];
|
||||
}
|
||||
|
||||
|
||||
-(BOOL) outlineView:(NSOutlineView *)outlineView isItemExpandable:(id)item
|
||||
{
|
||||
return ([item subElementCount] > 0);
|
||||
}
|
||||
|
||||
-(int) outlineView:(NSOutlineView *)outlineView numberOfChildrenOfItem:(id)item
|
||||
{
|
||||
if( (item == nil) && (outlineView == displayList) )
|
||||
return [templateStructure count];
|
||||
else if( (item == nil) && (outlineView == dataList) )
|
||||
return [resourceStructure count];
|
||||
else
|
||||
return [item subElementCount];
|
||||
}
|
||||
|
||||
-(id) outlineView:(NSOutlineView *)outlineView objectValueForTableColumn:(NSTableColumn *)tableColumn byItem:(id)item
|
||||
{
|
||||
return [item valueForKey:[tableColumn identifier]];
|
||||
}
|
||||
|
||||
-(void) outlineView:(NSOutlineView *)outlineView setObjectValue:(id)object forTableColumn:(NSTableColumn *)tableColumn byItem:(id)item
|
||||
{
|
||||
NS_DURING
|
||||
[item takeValue:object forKey: [tableColumn identifier]];
|
||||
NS_HANDLER
|
||||
|
||||
NS_ENDHANDLER
|
||||
}
|
||||
|
||||
|
||||
-(IBAction) cut: (id)sender;
|
||||
{
|
||||
NuTemplateElement *selItem = (NuTemplateElement*) [dataList selectedItem];
|
||||
|
||||
[selItem cut: sender]; // Let selected item do its magic.
|
||||
|
||||
[dataList reloadData]; // Update our display.
|
||||
}
|
||||
|
||||
-(IBAction) copy: (id)sender;
|
||||
{
|
||||
NuTemplateElement *selItem = (NuTemplateElement*) [dataList selectedItem];
|
||||
|
||||
[selItem copy: sender]; // Let selected item do its magic.
|
||||
|
||||
[dataList reloadData]; // Update our display.
|
||||
}
|
||||
|
||||
-(IBAction) paste: (id)sender;
|
||||
{
|
||||
NuTemplateElement *selItem = (NuTemplateElement*) [dataList selectedItem];
|
||||
|
||||
[selItem paste: sender]; // Let selected item do its magic.
|
||||
|
||||
[dataList reloadData]; // Update our display.
|
||||
}
|
||||
|
||||
-(IBAction) clear: (id)sender;
|
||||
{
|
||||
NuTemplateElement *selItem = (NuTemplateElement*) [dataList selectedItem];
|
||||
|
||||
[selItem clear: sender]; // Let selected item do its magic.
|
||||
|
||||
[dataList reloadData]; // Update our display.
|
||||
}
|
||||
|
||||
/* showCreateResourceSheet: we mis-use this menu item for creating new template fields.
|
||||
This works by selecting an item that serves as a template (another LSTB), or knows
|
||||
how to create an item (LSTE) and passing the message on to it. */
|
||||
|
||||
-(IBAction) showCreateResourceSheet: (id)sender;
|
||||
{
|
||||
NuTemplateElement *selItem = (NuTemplateElement*) [dataList selectedItem];
|
||||
|
||||
[selItem showCreateResourceSheet: sender]; // Let selected item do its magic.
|
||||
|
||||
[dataList reloadData]; // Update our display.
|
||||
}
|
||||
|
||||
|
||||
-(BOOL) validateMenuItem: (NSMenuItem*)item
|
||||
{
|
||||
NuTemplateElement *selElement = (NuTemplateElement*) [dataList selectedItem];
|
||||
|
||||
if( [item action] == @selector(showCreateResourceSheet:) )
|
||||
{
|
||||
createFieldItem = item;
|
||||
[item setTitle: NSLocalizedString(@"Create List Entry",@"")];
|
||||
|
||||
return( selElement != nil && [selElement respondsToSelector: @selector(showCreateResourceSheet:)] );
|
||||
}
|
||||
else if( [item action] == @selector(cut:) )
|
||||
return( selElement != nil && [selElement respondsToSelector: @selector(cut:)] );
|
||||
else if( [item action] == @selector(copy:) )
|
||||
return( selElement != nil && [selElement respondsToSelector: @selector(copy:)] );
|
||||
else if( [item action] == @selector(paste:) && selElement != nil
|
||||
&& [selElement respondsToSelector: @selector(validateMenuItem:)] )
|
||||
return( [selElement validateMenuItem: item] );
|
||||
else if( [item action] == @selector(clear:) )
|
||||
return( selElement != nil && [selElement respondsToSelector: @selector(clear:)] );
|
||||
else if( [item action] == @selector(saveDocument:) )
|
||||
return YES;
|
||||
else return NO;
|
||||
}
|
||||
|
||||
|
||||
-(void) windowDidResignKey: (NSNotification*)notification
|
||||
{
|
||||
if( createFieldItem )
|
||||
{
|
||||
[createFieldItem setTitle: NSLocalizedString(@"Create New Resource...",@"")];
|
||||
createFieldItem = nil;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
-(IBAction) saveDocument: (id)sender
|
||||
{
|
||||
[self writeResData];
|
||||
}
|
||||
|
||||
|
||||
-(BOOL) windowShouldClose: (id)sender // Window delegate.
|
||||
{
|
||||
[self writeResData]; // Save resource.
|
||||
|
||||
return YES;
|
||||
}
|
||||
|
||||
@end
|
|
@ -12,12 +12,37 @@
|
|||
E17752700E424DCB00F737F8 /* OpenPanelDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = E177526E0E424DCB00F737F8 /* OpenPanelDelegate.h */; };
|
||||
E17752760E424ED400F737F8 /* Notifications.m in Sources */ = {isa = PBXBuildFile; fileRef = F5C9ECCE027F474A01A8010C /* Notifications.m */; };
|
||||
E17753350E424F0C00F737F8 /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F5B5884A0156D40B01000001 /* Carbon.framework */; };
|
||||
E177538B0E4251C600F737F8 /* DisplayTMPL.png in Resources */ = {isa = PBXBuildFile; fileRef = E17753880E4251C600F737F8 /* DisplayTMPL.png */; };
|
||||
E177538E0E4251D000F737F8 /* Templates.rsrc in Copy Support Resources */ = {isa = PBXBuildFile; fileRef = E17753890E4251C600F737F8 /* Templates.rsrc */; };
|
||||
E177539D0E42521800F737F8 /* Font Templates.rsrc in Copy Support Resources */ = {isa = PBXBuildFile; fileRef = E1B2A73B0E41218F00A72928 /* Font Templates.rsrc */; };
|
||||
E17753B90E42528100F737F8 /* NovaTools.plugin in CopyFiles */ = {isa = PBXBuildFile; fileRef = E1B2A4940E41103800A72928 /* NovaTools.plugin */; };
|
||||
E17753CD0E42528400F737F8 /* Font Editor.plugin in CopyFiles */ = {isa = PBXBuildFile; fileRef = E1B2A7220E41213300A72928 /* Font Editor.plugin */; };
|
||||
E17753E40E42534300F737F8 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F5B5884B0156D40B01000001 /* Cocoa.framework */; };
|
||||
E17757380E425EE600F737F8 /* Element.m in Sources */ = {isa = PBXBuildFile; fileRef = E17757030E425EE200F737F8 /* Element.m */; };
|
||||
E17757390E425EE600F737F8 /* ElementDATE.m in Sources */ = {isa = PBXBuildFile; fileRef = E17757050E425EE200F737F8 /* ElementDATE.m */; };
|
||||
E177573A0E425EE600F737F8 /* ElementDBYT.m in Sources */ = {isa = PBXBuildFile; fileRef = E17757070E425EE200F737F8 /* ElementDBYT.m */; };
|
||||
E177573B0E425EE600F737F8 /* ElementDLLG.m in Sources */ = {isa = PBXBuildFile; fileRef = E17757090E425EE200F737F8 /* ElementDLLG.m */; };
|
||||
E177573C0E425EE600F737F8 /* ElementDLNG.m in Sources */ = {isa = PBXBuildFile; fileRef = E177570B0E425EE200F737F8 /* ElementDLNG.m */; };
|
||||
E177573D0E425EE600F737F8 /* ElementDWRD.m in Sources */ = {isa = PBXBuildFile; fileRef = E177570D0E425EE200F737F8 /* ElementDWRD.m */; };
|
||||
E177573E0E425EE600F737F8 /* ElementFBYT.m in Sources */ = {isa = PBXBuildFile; fileRef = E177570F0E425EE200F737F8 /* ElementFBYT.m */; };
|
||||
E177573F0E425EE600F737F8 /* ElementFIXD.m in Sources */ = {isa = PBXBuildFile; fileRef = E17757110E425EE200F737F8 /* ElementFIXD.m */; };
|
||||
E17757400E425EE600F737F8 /* ElementFRAC.m in Sources */ = {isa = PBXBuildFile; fileRef = E17757130E425EE200F737F8 /* ElementFRAC.m */; };
|
||||
E17757410E425EE600F737F8 /* ElementHEXD.m in Sources */ = {isa = PBXBuildFile; fileRef = E17757150E425EE200F737F8 /* ElementHEXD.m */; };
|
||||
E17757420E425EE600F737F8 /* ElementKEYB.mm in Sources */ = {isa = PBXBuildFile; fileRef = E17757170E425EE200F737F8 /* ElementKEYB.mm */; };
|
||||
E17757430E425EE600F737F8 /* ElementLSTB.mm in Sources */ = {isa = PBXBuildFile; fileRef = E17757190E425EE200F737F8 /* ElementLSTB.mm */; };
|
||||
E17757440E425EE600F737F8 /* ElementLSTC.mm in Sources */ = {isa = PBXBuildFile; fileRef = E177571B0E425EE200F737F8 /* ElementLSTC.mm */; };
|
||||
E17757450E425EE600F737F8 /* ElementLSTE.m in Sources */ = {isa = PBXBuildFile; fileRef = E177571D0E425EE200F737F8 /* ElementLSTE.m */; };
|
||||
E17757460E425EE600F737F8 /* ElementOCNT.m in Sources */ = {isa = PBXBuildFile; fileRef = E177571F0E425EE200F737F8 /* ElementOCNT.m */; };
|
||||
E17757470E425EE600F737F8 /* ElementPSTR.m in Sources */ = {isa = PBXBuildFile; fileRef = E17757210E425EE200F737F8 /* ElementPSTR.m */; };
|
||||
E17757480E425EE600F737F8 /* ElementUBYT.m in Sources */ = {isa = PBXBuildFile; fileRef = E17757230E425EE200F737F8 /* ElementUBYT.m */; };
|
||||
E17757490E425EE600F737F8 /* ElementULLG.m in Sources */ = {isa = PBXBuildFile; fileRef = E17757250E425EE200F737F8 /* ElementULLG.m */; };
|
||||
E177574A0E425EE600F737F8 /* ElementULNG.m in Sources */ = {isa = PBXBuildFile; fileRef = E17757270E425EE200F737F8 /* ElementULNG.m */; };
|
||||
E177574B0E425EE600F737F8 /* ElementUWRD.m in Sources */ = {isa = PBXBuildFile; fileRef = E17757290E425EE200F737F8 /* ElementUWRD.m */; };
|
||||
E177574C0E425EE600F737F8 /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = E177572A0E425EE200F737F8 /* Localizable.strings */; };
|
||||
E177574D0E425EE600F737F8 /* TemplateWindow.nib in Resources */ = {isa = PBXBuildFile; fileRef = E177572C0E425EE200F737F8 /* TemplateWindow.nib */; };
|
||||
E177574E0E425EE600F737F8 /* Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = E177572E0E425EE200F737F8 /* Info.plist */; };
|
||||
E17757500E425EE600F737F8 /* DisplayTMPL.png in Resources */ = {isa = PBXBuildFile; fileRef = E17757310E425EE200F737F8 /* DisplayTMPL.png */; };
|
||||
E17757520E425EE600F737F8 /* TemplateStream.m in Sources */ = {isa = PBXBuildFile; fileRef = E17757340E425EE200F737F8 /* TemplateStream.m */; };
|
||||
E17757530E425EE600F737F8 /* TemplateWindowController.m in Sources */ = {isa = PBXBuildFile; fileRef = E17757360E425EE200F737F8 /* TemplateWindowController.m */; };
|
||||
E17757580E425F1D00F737F8 /* Templates.rsrc in Copy Support Resources */ = {isa = PBXBuildFile; fileRef = E17757320E425EE200F737F8 /* Templates.rsrc */; };
|
||||
E1B2A3EA0E41103700A72928 /* ResKnifeResourceProtocol.h in Headers */ = {isa = PBXBuildFile; fileRef = F5CDEBAB01FC893201A80001 /* ResKnifeResourceProtocol.h */; };
|
||||
E1B2A3EB0E41103700A72928 /* ResKnifePluginProtocol.h in Headers */ = {isa = PBXBuildFile; fileRef = F5502C4001C579FF01C57124 /* ResKnifePluginProtocol.h */; };
|
||||
E1B2A3EC0E41103700A72928 /* ApplicationDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = F5B5881D0156D40B01000001 /* ApplicationDelegate.h */; };
|
||||
|
@ -231,22 +256,7 @@
|
|||
E1B2A5510E41103A00A72928 /* Notifications.m in Sources */ = {isa = PBXBuildFile; fileRef = F5C9ECCE027F474A01A8010C /* Notifications.m */; };
|
||||
E1B2A5520E41103A00A72928 /* ICONWindowController.m in Sources */ = {isa = PBXBuildFile; fileRef = 3D3B99B804DC16A30056861E /* ICONWindowController.m */; };
|
||||
E1B2A5540E41103A00A72928 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F5B5884B0156D40B01000001 /* Cocoa.framework */; };
|
||||
E1B2A56D0E41103A00A72928 /* NuTemplateWindow.nib in Resources */ = {isa = PBXBuildFile; fileRef = 3D0B38B504DEF465005AED5E /* NuTemplateWindow.nib */; };
|
||||
E1B2A56F0E41103A00A72928 /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = 3D2EE5E204E5C56F00515930 /* Localizable.strings */; };
|
||||
E1B2A5710E41103A00A72928 /* NuTemplateWindowController.m in Sources */ = {isa = PBXBuildFile; fileRef = 3D0B38B304DEF41E005AED5E /* NuTemplateWindowController.m */; };
|
||||
E1B2A5720E41103A00A72928 /* Notifications.m in Sources */ = {isa = PBXBuildFile; fileRef = F5C9ECCE027F474A01A8010C /* Notifications.m */; };
|
||||
E1B2A5730E41103A00A72928 /* NuTemplateElement.m in Sources */ = {isa = PBXBuildFile; fileRef = 3D0933A704DEFEE600DD74B1 /* NuTemplateElement.m */; };
|
||||
E1B2A5740E41103A00A72928 /* NuTemplateGroupElement.m in Sources */ = {isa = PBXBuildFile; fileRef = 3D0933BB04DF10D700DD74B1 /* NuTemplateGroupElement.m */; };
|
||||
E1B2A5750E41103A00A72928 /* NuTemplateStream.m in Sources */ = {isa = PBXBuildFile; fileRef = 3D0933BF04DF151C00DD74B1 /* NuTemplateStream.m */; };
|
||||
E1B2A5760E41103A00A72928 /* NuTemplateLSTBElement.m in Sources */ = {isa = PBXBuildFile; fileRef = 3D0933C504DF1C0800DD74B1 /* NuTemplateLSTBElement.m */; };
|
||||
E1B2A5770E41103A00A72928 /* NuTemplateTNAMElement.m in Sources */ = {isa = PBXBuildFile; fileRef = 3D0933E404DF2FF700DD74B1 /* NuTemplateTNAMElement.m */; };
|
||||
E1B2A5780E41103A00A72928 /* NuTemplatePSTRElement.m in Sources */ = {isa = PBXBuildFile; fileRef = 3D0933E804DF317D00DD74B1 /* NuTemplatePSTRElement.m */; };
|
||||
E1B2A5790E41103A00A72928 /* NuTemplateDWRDElement.m in Sources */ = {isa = PBXBuildFile; fileRef = 3D0933EE04DF381900DD74B1 /* NuTemplateDWRDElement.m */; };
|
||||
E1B2A57A0E41103A00A72928 /* NuTemplateLSTEElement.m in Sources */ = {isa = PBXBuildFile; fileRef = 3D0933F704DFE80500DD74B1 /* NuTemplateLSTEElement.m */; };
|
||||
E1B2A57B0E41103A00A72928 /* NuTemplateDLNGElement.m in Sources */ = {isa = PBXBuildFile; fileRef = 3D4737B304E872DB00AF65FE /* NuTemplateDLNGElement.m */; };
|
||||
E1B2A57C0E41103A00A72928 /* NuTemplateDBYTElement.m in Sources */ = {isa = PBXBuildFile; fileRef = 3D4737B704E873F300AF65FE /* NuTemplateDBYTElement.m */; };
|
||||
E1B2A57D0E41103A00A72928 /* NuTemplateOCNTElement.m in Sources */ = {isa = PBXBuildFile; fileRef = 3D50047004EF040900F3B64D /* NuTemplateOCNTElement.m */; };
|
||||
E1B2A57E0E41103A00A72928 /* NuTemplateLSTCElement.m in Sources */ = {isa = PBXBuildFile; fileRef = 3D50047304EF122000F3B64D /* NuTemplateLSTCElement.m */; };
|
||||
E1B2A5800E41103A00A72928 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F5B5884B0156D40B01000001 /* Cocoa.framework */; };
|
||||
E1B2A5920E41103A00A72928 /* Template Editor.plugin in CopyFiles */ = {isa = PBXBuildFile; fileRef = E1B2A5860E41103A00A72928 /* Template Editor.plugin */; };
|
||||
E1B2A5930E41103A00A72928 /* Hexadecimal Editor.plugin in CopyFiles */ = {isa = PBXBuildFile; fileRef = E1B2A4570E41103800A72928 /* Hexadecimal Editor.plugin */; };
|
||||
|
@ -288,14 +298,14 @@
|
|||
isa = PBXContainerItemProxy;
|
||||
containerPortal = F5B5880F0156D2A601000001 /* Project object */;
|
||||
proxyType = 1;
|
||||
remoteGlobalIDString = E1B2A7210E41213300A72928 /* Font Editor Cocoa */;
|
||||
remoteGlobalIDString = E1B2A7210E41213300A72928;
|
||||
remoteInfo = "Font Editor Cocoa";
|
||||
};
|
||||
E17753B30E42526F00F737F8 /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
containerPortal = F5B5880F0156D2A601000001 /* Project object */;
|
||||
proxyType = 1;
|
||||
remoteGlobalIDString = E1B2A46A0E41103800A72928 /* NovaTools */;
|
||||
remoteGlobalIDString = E1B2A46A0E41103800A72928;
|
||||
remoteInfo = NovaTools;
|
||||
};
|
||||
E1B2A5870E41103A00A72928 /* PBXContainerItemProxy */ = {
|
||||
|
@ -321,7 +331,7 @@
|
|||
dstPath = "Support Resources";
|
||||
dstSubfolderSpec = 7;
|
||||
files = (
|
||||
E177538E0E4251D000F737F8 /* Templates.rsrc in Copy Support Resources */,
|
||||
E17757580E425F1D00F737F8 /* Templates.rsrc in Copy Support Resources */,
|
||||
);
|
||||
name = "Copy Support Resources";
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
|
@ -353,29 +363,8 @@
|
|||
/* End PBXCopyFilesBuildPhase section */
|
||||
|
||||
/* Begin PBXFileReference section */
|
||||
3D0933A604DEFEE600DD74B1 /* NuTemplateElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NuTemplateElement.h; sourceTree = "<group>"; };
|
||||
3D0933A704DEFEE600DD74B1 /* NuTemplateElement.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NuTemplateElement.m; sourceTree = "<group>"; };
|
||||
3D0933BA04DF10D700DD74B1 /* NuTemplateGroupElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NuTemplateGroupElement.h; sourceTree = "<group>"; };
|
||||
3D0933BB04DF10D700DD74B1 /* NuTemplateGroupElement.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NuTemplateGroupElement.m; sourceTree = "<group>"; };
|
||||
3D0933BE04DF151C00DD74B1 /* NuTemplateStream.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NuTemplateStream.h; sourceTree = "<group>"; };
|
||||
3D0933BF04DF151C00DD74B1 /* NuTemplateStream.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NuTemplateStream.m; sourceTree = "<group>"; };
|
||||
3D0933C404DF1C0800DD74B1 /* NuTemplateLSTBElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NuTemplateLSTBElement.h; sourceTree = "<group>"; };
|
||||
3D0933C504DF1C0800DD74B1 /* NuTemplateLSTBElement.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NuTemplateLSTBElement.m; sourceTree = "<group>"; };
|
||||
3D0933E304DF2FF700DD74B1 /* NuTemplateTNAMElement.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = NuTemplateTNAMElement.h; sourceTree = "<group>"; };
|
||||
3D0933E404DF2FF700DD74B1 /* NuTemplateTNAMElement.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = NuTemplateTNAMElement.m; sourceTree = "<group>"; };
|
||||
3D0933E704DF317D00DD74B1 /* NuTemplatePSTRElement.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = NuTemplatePSTRElement.h; sourceTree = "<group>"; };
|
||||
3D0933E804DF317D00DD74B1 /* NuTemplatePSTRElement.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = NuTemplatePSTRElement.m; sourceTree = "<group>"; };
|
||||
3D0933EE04DF381900DD74B1 /* NuTemplateDWRDElement.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = NuTemplateDWRDElement.m; sourceTree = "<group>"; };
|
||||
3D0933EF04DF381900DD74B1 /* NuTemplateDWRDElement.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = NuTemplateDWRDElement.h; sourceTree = "<group>"; };
|
||||
3D0933F404DFD7CF00DD74B1 /* TODO.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = TODO.txt; sourceTree = SOURCE_ROOT; };
|
||||
3D0933F604DFE80500DD74B1 /* NuTemplateLSTEElement.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = NuTemplateLSTEElement.h; sourceTree = "<group>"; };
|
||||
3D0933F704DFE80500DD74B1 /* NuTemplateLSTEElement.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = NuTemplateLSTEElement.m; sourceTree = "<group>"; };
|
||||
3D0ABFB904E152CA00C85300 /* Read Me.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "Read Me.txt"; sourceTree = "<group>"; };
|
||||
3D0ABFBC04E172F700C85300 /* README.txt */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; path = README.txt; sourceTree = SOURCE_ROOT; };
|
||||
3D0B38B204DEF41E005AED5E /* NuTemplateWindowController.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = NuTemplateWindowController.h; sourceTree = "<group>"; };
|
||||
3D0B38B304DEF41E005AED5E /* NuTemplateWindowController.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = NuTemplateWindowController.m; sourceTree = "<group>"; };
|
||||
3D0B38B604DEF465005AED5E /* English */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = English; path = English.lproj/NuTemplateWindow.nib; sourceTree = "<group>"; };
|
||||
3D2EE5E204E5C56F00515930 /* Localizable.strings */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.strings; name = Localizable.strings; path = ../Localizable.strings; sourceTree = "<group>"; };
|
||||
3D35755A04DAEB4300B8225B /* main.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
|
||||
3D35755C04DAEB6200B8225B /* RKEditorRegistry.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = RKEditorRegistry.h; sourceTree = "<group>"; };
|
||||
3D35755D04DAEB6200B8225B /* RKEditorRegistry.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = RKEditorRegistry.m; sourceTree = "<group>"; };
|
||||
|
@ -383,23 +372,63 @@
|
|||
3D3B99B804DC16A30056861E /* ICONWindowController.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; name = ICONWindowController.m; path = ICONEditor/ICONWindowController.m; sourceTree = SOURCE_ROOT; };
|
||||
3D3B99B904DC16A30056861E /* ICONWindowController.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = ICONWindowController.h; path = ICONEditor/ICONWindowController.h; sourceTree = SOURCE_ROOT; };
|
||||
3D3B99BD04DC16FC0056861E /* English */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = English; path = ICONEditor/English.lproj/ICONWindow.nib; sourceTree = SOURCE_ROOT; };
|
||||
3D4737B304E872DB00AF65FE /* NuTemplateDLNGElement.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = NuTemplateDLNGElement.m; sourceTree = "<group>"; };
|
||||
3D4737B404E872DB00AF65FE /* NuTemplateDLNGElement.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = NuTemplateDLNGElement.h; sourceTree = "<group>"; };
|
||||
3D4737B704E873F300AF65FE /* NuTemplateDBYTElement.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = NuTemplateDBYTElement.m; sourceTree = "<group>"; };
|
||||
3D4737B804E873F300AF65FE /* NuTemplateDBYTElement.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = NuTemplateDBYTElement.h; sourceTree = "<group>"; };
|
||||
3D50046F04EF040900F3B64D /* NuTemplateOCNTElement.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = NuTemplateOCNTElement.h; sourceTree = "<group>"; };
|
||||
3D50047004EF040900F3B64D /* NuTemplateOCNTElement.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = NuTemplateOCNTElement.m; sourceTree = "<group>"; };
|
||||
3D50047304EF122000F3B64D /* NuTemplateLSTCElement.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = NuTemplateLSTCElement.m; sourceTree = "<group>"; };
|
||||
3D50047404EF122000F3B64D /* NuTemplateLSTCElement.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = NuTemplateLSTCElement.h; sourceTree = "<group>"; };
|
||||
3D53A9FD04F171DC006651FA /* RKSupportResourceRegistry.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RKSupportResourceRegistry.h; sourceTree = "<group>"; };
|
||||
3D53A9FE04F171DC006651FA /* RKSupportResourceRegistry.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RKSupportResourceRegistry.m; sourceTree = "<group>"; };
|
||||
E17752320E424BAB00F737F8 /* NSData-HexRepresentation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSData-HexRepresentation.h"; sourceTree = "<group>"; };
|
||||
E17752330E424BAB00F737F8 /* NSData-HexRepresentation.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSData-HexRepresentation.m"; sourceTree = "<group>"; };
|
||||
E177526D0E424DCB00F737F8 /* OpenPanelDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OpenPanelDelegate.m; sourceTree = "<group>"; };
|
||||
E177526E0E424DCB00F737F8 /* OpenPanelDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OpenPanelDelegate.h; sourceTree = "<group>"; };
|
||||
E17753880E4251C600F737F8 /* DisplayTMPL.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = DisplayTMPL.png; sourceTree = "<group>"; };
|
||||
E17753890E4251C600F737F8 /* Templates.rsrc */ = {isa = PBXFileReference; lastKnownFileType = archive.rsrc; name = Templates.rsrc; path = ../Templates.rsrc; sourceTree = "<group>"; };
|
||||
E177538A0E4251C600F737F8 /* TMPLs.rsrc */ = {isa = PBXFileReference; lastKnownFileType = archive.rsrc; name = TMPLs.rsrc; path = ../TMPLs.rsrc; sourceTree = "<group>"; };
|
||||
E17757020E425EE200F737F8 /* Element.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Element.h; sourceTree = "<group>"; };
|
||||
E17757030E425EE200F737F8 /* Element.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Element.m; sourceTree = "<group>"; };
|
||||
E17757040E425EE200F737F8 /* ElementDATE.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ElementDATE.h; sourceTree = "<group>"; };
|
||||
E17757050E425EE200F737F8 /* ElementDATE.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ElementDATE.m; sourceTree = "<group>"; };
|
||||
E17757060E425EE200F737F8 /* ElementDBYT.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ElementDBYT.h; sourceTree = "<group>"; };
|
||||
E17757070E425EE200F737F8 /* ElementDBYT.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ElementDBYT.m; sourceTree = "<group>"; };
|
||||
E17757080E425EE200F737F8 /* ElementDLLG.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ElementDLLG.h; sourceTree = "<group>"; };
|
||||
E17757090E425EE200F737F8 /* ElementDLLG.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ElementDLLG.m; sourceTree = "<group>"; };
|
||||
E177570A0E425EE200F737F8 /* ElementDLNG.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ElementDLNG.h; sourceTree = "<group>"; };
|
||||
E177570B0E425EE200F737F8 /* ElementDLNG.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ElementDLNG.m; sourceTree = "<group>"; };
|
||||
E177570C0E425EE200F737F8 /* ElementDWRD.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ElementDWRD.h; sourceTree = "<group>"; };
|
||||
E177570D0E425EE200F737F8 /* ElementDWRD.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ElementDWRD.m; sourceTree = "<group>"; };
|
||||
E177570E0E425EE200F737F8 /* ElementFBYT.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ElementFBYT.h; sourceTree = "<group>"; };
|
||||
E177570F0E425EE200F737F8 /* ElementFBYT.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ElementFBYT.m; sourceTree = "<group>"; };
|
||||
E17757100E425EE200F737F8 /* ElementFIXD.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ElementFIXD.h; sourceTree = "<group>"; };
|
||||
E17757110E425EE200F737F8 /* ElementFIXD.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ElementFIXD.m; sourceTree = "<group>"; };
|
||||
E17757120E425EE200F737F8 /* ElementFRAC.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ElementFRAC.h; sourceTree = "<group>"; };
|
||||
E17757130E425EE200F737F8 /* ElementFRAC.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ElementFRAC.m; sourceTree = "<group>"; };
|
||||
E17757140E425EE200F737F8 /* ElementHEXD.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ElementHEXD.h; sourceTree = "<group>"; };
|
||||
E17757150E425EE200F737F8 /* ElementHEXD.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ElementHEXD.m; sourceTree = "<group>"; };
|
||||
E17757160E425EE200F737F8 /* ElementKEYB.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ElementKEYB.h; sourceTree = "<group>"; };
|
||||
E17757170E425EE200F737F8 /* ElementKEYB.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ElementKEYB.mm; sourceTree = "<group>"; };
|
||||
E17757180E425EE200F737F8 /* ElementLSTB.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ElementLSTB.h; sourceTree = "<group>"; };
|
||||
E17757190E425EE200F737F8 /* ElementLSTB.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ElementLSTB.mm; sourceTree = "<group>"; };
|
||||
E177571A0E425EE200F737F8 /* ElementLSTC.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ElementLSTC.h; sourceTree = "<group>"; };
|
||||
E177571B0E425EE200F737F8 /* ElementLSTC.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ElementLSTC.mm; sourceTree = "<group>"; };
|
||||
E177571C0E425EE200F737F8 /* ElementLSTE.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ElementLSTE.h; sourceTree = "<group>"; };
|
||||
E177571D0E425EE200F737F8 /* ElementLSTE.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ElementLSTE.m; sourceTree = "<group>"; };
|
||||
E177571E0E425EE200F737F8 /* ElementOCNT.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ElementOCNT.h; sourceTree = "<group>"; };
|
||||
E177571F0E425EE200F737F8 /* ElementOCNT.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ElementOCNT.m; sourceTree = "<group>"; };
|
||||
E17757200E425EE200F737F8 /* ElementPSTR.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ElementPSTR.h; sourceTree = "<group>"; };
|
||||
E17757210E425EE200F737F8 /* ElementPSTR.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ElementPSTR.m; sourceTree = "<group>"; };
|
||||
E17757220E425EE200F737F8 /* ElementUBYT.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ElementUBYT.h; sourceTree = "<group>"; };
|
||||
E17757230E425EE200F737F8 /* ElementUBYT.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ElementUBYT.m; sourceTree = "<group>"; };
|
||||
E17757240E425EE200F737F8 /* ElementULLG.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ElementULLG.h; sourceTree = "<group>"; };
|
||||
E17757250E425EE200F737F8 /* ElementULLG.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ElementULLG.m; sourceTree = "<group>"; };
|
||||
E17757260E425EE200F737F8 /* ElementULNG.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ElementULNG.h; sourceTree = "<group>"; };
|
||||
E17757270E425EE200F737F8 /* ElementULNG.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ElementULNG.m; sourceTree = "<group>"; };
|
||||
E17757280E425EE200F737F8 /* ElementUWRD.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ElementUWRD.h; sourceTree = "<group>"; };
|
||||
E17757290E425EE200F737F8 /* ElementUWRD.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ElementUWRD.m; sourceTree = "<group>"; };
|
||||
E177572B0E425EE200F737F8 /* English */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.strings; name = English; path = English.lproj/Localizable.strings; sourceTree = "<group>"; };
|
||||
E177572D0E425EE200F737F8 /* English */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = English; path = English.lproj/TemplateWindow.nib; sourceTree = "<group>"; };
|
||||
E177572E0E425EE200F737F8 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = Info.plist; path = ../Info.plist; sourceTree = "<group>"; };
|
||||
E177572F0E425EE200F737F8 /* Read Me.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "Read Me.txt"; sourceTree = "<group>"; };
|
||||
E17757310E425EE200F737F8 /* DisplayTMPL.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = DisplayTMPL.png; sourceTree = "<group>"; };
|
||||
E17757320E425EE200F737F8 /* Templates.rsrc */ = {isa = PBXFileReference; lastKnownFileType = archive.rsrc; path = Templates.rsrc; sourceTree = "<group>"; };
|
||||
E17757330E425EE200F737F8 /* TemplateStream.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TemplateStream.h; sourceTree = "<group>"; };
|
||||
E17757340E425EE200F737F8 /* TemplateStream.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TemplateStream.m; sourceTree = "<group>"; };
|
||||
E17757350E425EE200F737F8 /* TemplateWindowController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TemplateWindowController.h; sourceTree = "<group>"; };
|
||||
E17757360E425EE200F737F8 /* TemplateWindowController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TemplateWindowController.m; sourceTree = "<group>"; };
|
||||
E17757370E425EE200F737F8 /* TMPLs.rsrc */ = {isa = PBXFileReference; lastKnownFileType = archive.rsrc; path = TMPLs.rsrc; sourceTree = "<group>"; };
|
||||
E1B2A43B0E41103700A72928 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; name = Info.plist; path = "../Plug-Ins/Hex Editor/Info.plist"; sourceTree = "<group>"; };
|
||||
E1B2A43C0E41103800A72928 /* ResKnife Cocoa.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "ResKnife Cocoa.app"; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
E1B2A4560E41103800A72928 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
||||
|
@ -418,7 +447,6 @@
|
|||
E1B2A5470E41103900A72928 /* Info-Uli_s_Template_Editor__Upgraded_.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "Info-Uli_s_Template_Editor__Upgraded_.plist"; sourceTree = "<group>"; };
|
||||
E1B2A5480E41103A00A72928 /* Ulis Template Editor.bundle */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "Ulis Template Editor.bundle"; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
E1B2A55A0E41103A00A72928 /* Bitmap Editor.plugin */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "Bitmap Editor.plugin"; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
E1B2A5850E41103A00A72928 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; name = Info.plist; path = ../Info.plist; sourceTree = "<group>"; };
|
||||
E1B2A5860E41103A00A72928 /* Template Editor.plugin */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "Template Editor.plugin"; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
E1B2A7220E41213300A72928 /* Font Editor.plugin */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "Font Editor.plugin"; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
E1B2A7360E41218F00A72928 /* English */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = English; path = English.lproj/FontDocument.nib; sourceTree = "<group>"; };
|
||||
|
@ -736,50 +764,6 @@
|
|||
/* End PBXFrameworksBuildPhase section */
|
||||
|
||||
/* Begin PBXGroup section */
|
||||
3D0933EB04DF319F00DD74B1 /* Field Types */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
3D0933C404DF1C0800DD74B1 /* NuTemplateLSTBElement.h */,
|
||||
3D0933C504DF1C0800DD74B1 /* NuTemplateLSTBElement.m */,
|
||||
3D0933F604DFE80500DD74B1 /* NuTemplateLSTEElement.h */,
|
||||
3D0933F704DFE80500DD74B1 /* NuTemplateLSTEElement.m */,
|
||||
3D0933E304DF2FF700DD74B1 /* NuTemplateTNAMElement.h */,
|
||||
3D0933E404DF2FF700DD74B1 /* NuTemplateTNAMElement.m */,
|
||||
3D0933E704DF317D00DD74B1 /* NuTemplatePSTRElement.h */,
|
||||
3D0933E804DF317D00DD74B1 /* NuTemplatePSTRElement.m */,
|
||||
3D0933EF04DF381900DD74B1 /* NuTemplateDWRDElement.h */,
|
||||
3D0933EE04DF381900DD74B1 /* NuTemplateDWRDElement.m */,
|
||||
3D4737B404E872DB00AF65FE /* NuTemplateDLNGElement.h */,
|
||||
3D4737B304E872DB00AF65FE /* NuTemplateDLNGElement.m */,
|
||||
3D4737B804E873F300AF65FE /* NuTemplateDBYTElement.h */,
|
||||
3D4737B704E873F300AF65FE /* NuTemplateDBYTElement.m */,
|
||||
3D50046F04EF040900F3B64D /* NuTemplateOCNTElement.h */,
|
||||
3D50047004EF040900F3B64D /* NuTemplateOCNTElement.m */,
|
||||
3D50047404EF122000F3B64D /* NuTemplateLSTCElement.h */,
|
||||
3D50047304EF122000F3B64D /* NuTemplateLSTCElement.m */,
|
||||
);
|
||||
name = "Field Types";
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
3D0B38A504DEF41E005AED5E /* Template Editor */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
3D0ABFB904E152CA00C85300 /* Read Me.txt */,
|
||||
3D0B38B204DEF41E005AED5E /* NuTemplateWindowController.h */,
|
||||
3D0B38B304DEF41E005AED5E /* NuTemplateWindowController.m */,
|
||||
3D0933A604DEFEE600DD74B1 /* NuTemplateElement.h */,
|
||||
3D0933A704DEFEE600DD74B1 /* NuTemplateElement.m */,
|
||||
3D0933BA04DF10D700DD74B1 /* NuTemplateGroupElement.h */,
|
||||
3D0933BB04DF10D700DD74B1 /* NuTemplateGroupElement.m */,
|
||||
3D0933BE04DF151C00DD74B1 /* NuTemplateStream.h */,
|
||||
3D0933BF04DF151C00DD74B1 /* NuTemplateStream.m */,
|
||||
3D0933EB04DF319F00DD74B1 /* Field Types */,
|
||||
E17753870E4251C600F737F8 /* Resources */,
|
||||
);
|
||||
name = "Template Editor";
|
||||
path = NuTemplateEditor;
|
||||
sourceTree = SOURCE_ROOT;
|
||||
};
|
||||
3D3B99B704DC167D0056861E /* Bitmap Editor */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
|
@ -801,19 +785,80 @@
|
|||
path = Categories;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
E17753870E4251C600F737F8 /* Resources */ = {
|
||||
E17757010E425EE200F737F8 /* Template Editor */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
E1B2A5850E41103A00A72928 /* Info.plist */,
|
||||
3D2EE5E204E5C56F00515930 /* Localizable.strings */,
|
||||
E17753880E4251C600F737F8 /* DisplayTMPL.png */,
|
||||
E17753890E4251C600F737F8 /* Templates.rsrc */,
|
||||
E177538A0E4251C600F737F8 /* TMPLs.rsrc */,
|
||||
3D0B38B504DEF465005AED5E /* NuTemplateWindow.nib */,
|
||||
E177572F0E425EE200F737F8 /* Read Me.txt */,
|
||||
E17757350E425EE200F737F8 /* TemplateWindowController.h */,
|
||||
E17757360E425EE200F737F8 /* TemplateWindowController.m */,
|
||||
E17757330E425EE200F737F8 /* TemplateStream.h */,
|
||||
E17757340E425EE200F737F8 /* TemplateStream.m */,
|
||||
E17757020E425EE200F737F8 /* Element.h */,
|
||||
E17757030E425EE200F737F8 /* Element.m */,
|
||||
E17757570E425EFF00F737F8 /* Elements */,
|
||||
E17757300E425EE200F737F8 /* Resources */,
|
||||
E17757320E425EE200F737F8 /* Templates.rsrc */,
|
||||
E17757370E425EE200F737F8 /* TMPLs.rsrc */,
|
||||
);
|
||||
path = "Template Editor";
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
E17757300E425EE200F737F8 /* Resources */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
E177572A0E425EE200F737F8 /* Localizable.strings */,
|
||||
E177572C0E425EE200F737F8 /* TemplateWindow.nib */,
|
||||
E177572E0E425EE200F737F8 /* Info.plist */,
|
||||
E17757310E425EE200F737F8 /* DisplayTMPL.png */,
|
||||
);
|
||||
path = Resources;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
E17757570E425EFF00F737F8 /* Elements */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
E17757040E425EE200F737F8 /* ElementDATE.h */,
|
||||
E17757050E425EE200F737F8 /* ElementDATE.m */,
|
||||
E17757060E425EE200F737F8 /* ElementDBYT.h */,
|
||||
E17757070E425EE200F737F8 /* ElementDBYT.m */,
|
||||
E17757080E425EE200F737F8 /* ElementDLLG.h */,
|
||||
E17757090E425EE200F737F8 /* ElementDLLG.m */,
|
||||
E177570A0E425EE200F737F8 /* ElementDLNG.h */,
|
||||
E177570B0E425EE200F737F8 /* ElementDLNG.m */,
|
||||
E177570C0E425EE200F737F8 /* ElementDWRD.h */,
|
||||
E177570D0E425EE200F737F8 /* ElementDWRD.m */,
|
||||
E177570E0E425EE200F737F8 /* ElementFBYT.h */,
|
||||
E177570F0E425EE200F737F8 /* ElementFBYT.m */,
|
||||
E17757100E425EE200F737F8 /* ElementFIXD.h */,
|
||||
E17757110E425EE200F737F8 /* ElementFIXD.m */,
|
||||
E17757120E425EE200F737F8 /* ElementFRAC.h */,
|
||||
E17757130E425EE200F737F8 /* ElementFRAC.m */,
|
||||
E17757140E425EE200F737F8 /* ElementHEXD.h */,
|
||||
E17757150E425EE200F737F8 /* ElementHEXD.m */,
|
||||
E17757160E425EE200F737F8 /* ElementKEYB.h */,
|
||||
E17757170E425EE200F737F8 /* ElementKEYB.mm */,
|
||||
E17757180E425EE200F737F8 /* ElementLSTB.h */,
|
||||
E17757190E425EE200F737F8 /* ElementLSTB.mm */,
|
||||
E177571A0E425EE200F737F8 /* ElementLSTC.h */,
|
||||
E177571B0E425EE200F737F8 /* ElementLSTC.mm */,
|
||||
E177571C0E425EE200F737F8 /* ElementLSTE.h */,
|
||||
E177571D0E425EE200F737F8 /* ElementLSTE.m */,
|
||||
E177571E0E425EE200F737F8 /* ElementOCNT.h */,
|
||||
E177571F0E425EE200F737F8 /* ElementOCNT.m */,
|
||||
E17757200E425EE200F737F8 /* ElementPSTR.h */,
|
||||
E17757210E425EE200F737F8 /* ElementPSTR.m */,
|
||||
E17757220E425EE200F737F8 /* ElementUBYT.h */,
|
||||
E17757230E425EE200F737F8 /* ElementUBYT.m */,
|
||||
E17757240E425EE200F737F8 /* ElementULLG.h */,
|
||||
E17757250E425EE200F737F8 /* ElementULLG.m */,
|
||||
E17757260E425EE200F737F8 /* ElementULNG.h */,
|
||||
E17757270E425EE200F737F8 /* ElementULNG.m */,
|
||||
E17757280E425EE200F737F8 /* ElementUWRD.h */,
|
||||
E17757290E425EE200F737F8 /* ElementUWRD.m */,
|
||||
);
|
||||
name = Elements;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
E1B2A7340E41218F00A72928 /* Font Editor */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
|
@ -894,7 +939,7 @@
|
|||
F5502C4001C579FF01C57124 /* ResKnifePluginProtocol.h */,
|
||||
F5CDEBAB01FC893201A80001 /* ResKnifeResourceProtocol.h */,
|
||||
F5EF839F020C08E601A80001 /* Hex Editor */,
|
||||
3D0B38A504DEF41E005AED5E /* Template Editor */,
|
||||
E17757010E425EE200F737F8 /* Template Editor */,
|
||||
3D3B99B704DC167D0056861E /* Bitmap Editor */,
|
||||
E1B2A7340E41218F00A72928 /* Font Editor */,
|
||||
F5DF1C0F0254C78801A80001 /* NovaTools */,
|
||||
|
@ -1774,9 +1819,10 @@
|
|||
isa = PBXResourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
E1B2A56D0E41103A00A72928 /* NuTemplateWindow.nib in Resources */,
|
||||
E1B2A56F0E41103A00A72928 /* Localizable.strings in Resources */,
|
||||
E177538B0E4251C600F737F8 /* DisplayTMPL.png in Resources */,
|
||||
E177574E0E425EE600F737F8 /* Info.plist in Resources */,
|
||||
E177574C0E425EE600F737F8 /* Localizable.strings in Resources */,
|
||||
E177574D0E425EE600F737F8 /* TemplateWindow.nib in Resources */,
|
||||
E17757500E425EE600F737F8 /* DisplayTMPL.png in Resources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
|
@ -2021,21 +2067,30 @@
|
|||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
E1B2A5710E41103A00A72928 /* NuTemplateWindowController.m in Sources */,
|
||||
E1B2A5720E41103A00A72928 /* Notifications.m in Sources */,
|
||||
E1B2A5730E41103A00A72928 /* NuTemplateElement.m in Sources */,
|
||||
E1B2A5740E41103A00A72928 /* NuTemplateGroupElement.m in Sources */,
|
||||
E1B2A5750E41103A00A72928 /* NuTemplateStream.m in Sources */,
|
||||
E1B2A5760E41103A00A72928 /* NuTemplateLSTBElement.m in Sources */,
|
||||
E1B2A5770E41103A00A72928 /* NuTemplateTNAMElement.m in Sources */,
|
||||
E1B2A5780E41103A00A72928 /* NuTemplatePSTRElement.m in Sources */,
|
||||
E1B2A5790E41103A00A72928 /* NuTemplateDWRDElement.m in Sources */,
|
||||
E1B2A57A0E41103A00A72928 /* NuTemplateLSTEElement.m in Sources */,
|
||||
E1B2A57B0E41103A00A72928 /* NuTemplateDLNGElement.m in Sources */,
|
||||
E1B2A57C0E41103A00A72928 /* NuTemplateDBYTElement.m in Sources */,
|
||||
E1B2A57D0E41103A00A72928 /* NuTemplateOCNTElement.m in Sources */,
|
||||
E1B2A57E0E41103A00A72928 /* NuTemplateLSTCElement.m in Sources */,
|
||||
E1B2A77C0E41230E00A72928 /* NGSCategories.m in Sources */,
|
||||
E17757380E425EE600F737F8 /* Element.m in Sources */,
|
||||
E17757390E425EE600F737F8 /* ElementDATE.m in Sources */,
|
||||
E177573A0E425EE600F737F8 /* ElementDBYT.m in Sources */,
|
||||
E177573B0E425EE600F737F8 /* ElementDLLG.m in Sources */,
|
||||
E177573C0E425EE600F737F8 /* ElementDLNG.m in Sources */,
|
||||
E177573D0E425EE600F737F8 /* ElementDWRD.m in Sources */,
|
||||
E177573E0E425EE600F737F8 /* ElementFBYT.m in Sources */,
|
||||
E177573F0E425EE600F737F8 /* ElementFIXD.m in Sources */,
|
||||
E17757400E425EE600F737F8 /* ElementFRAC.m in Sources */,
|
||||
E17757410E425EE600F737F8 /* ElementHEXD.m in Sources */,
|
||||
E17757420E425EE600F737F8 /* ElementKEYB.mm in Sources */,
|
||||
E17757430E425EE600F737F8 /* ElementLSTB.mm in Sources */,
|
||||
E17757440E425EE600F737F8 /* ElementLSTC.mm in Sources */,
|
||||
E17757450E425EE600F737F8 /* ElementLSTE.m in Sources */,
|
||||
E17757460E425EE600F737F8 /* ElementOCNT.m in Sources */,
|
||||
E17757470E425EE600F737F8 /* ElementPSTR.m in Sources */,
|
||||
E17757480E425EE600F737F8 /* ElementUBYT.m in Sources */,
|
||||
E17757490E425EE600F737F8 /* ElementULLG.m in Sources */,
|
||||
E177574A0E425EE600F737F8 /* ElementULNG.m in Sources */,
|
||||
E177574B0E425EE600F737F8 /* ElementUWRD.m in Sources */,
|
||||
E17757520E425EE600F737F8 /* TemplateStream.m in Sources */,
|
||||
E17757530E425EE600F737F8 /* TemplateWindowController.m in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
|
@ -2075,15 +2130,6 @@
|
|||
/* End PBXTargetDependency section */
|
||||
|
||||
/* Begin PBXVariantGroup section */
|
||||
3D0B38B504DEF465005AED5E /* NuTemplateWindow.nib */ = {
|
||||
isa = PBXVariantGroup;
|
||||
children = (
|
||||
3D0B38B604DEF465005AED5E /* English */,
|
||||
);
|
||||
name = NuTemplateWindow.nib;
|
||||
path = ..;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
3D3B99BC04DC16FC0056861E /* ICONWindow.nib */ = {
|
||||
isa = PBXVariantGroup;
|
||||
children = (
|
||||
|
@ -2092,6 +2138,24 @@
|
|||
name = ICONWindow.nib;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
E177572A0E425EE200F737F8 /* Localizable.strings */ = {
|
||||
isa = PBXVariantGroup;
|
||||
children = (
|
||||
E177572B0E425EE200F737F8 /* English */,
|
||||
);
|
||||
name = Localizable.strings;
|
||||
path = ..;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
E177572C0E425EE200F737F8 /* TemplateWindow.nib */ = {
|
||||
isa = PBXVariantGroup;
|
||||
children = (
|
||||
E177572D0E425EE200F737F8 /* English */,
|
||||
);
|
||||
name = TemplateWindow.nib;
|
||||
path = ..;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
E1B2A7350E41218F00A72928 /* FontDocument.nib */ = {
|
||||
isa = PBXVariantGroup;
|
||||
children = (
|
||||
|
@ -2832,7 +2896,7 @@
|
|||
GCC_OPTIMIZATION_LEVEL = 0;
|
||||
GCC_PRECOMPILE_PREFIX_HEADER = YES;
|
||||
GCC_PREFIX_HEADER = "$(SYSTEM_LIBRARY_DIR)/Frameworks/AppKit.framework/Headers/AppKit.h";
|
||||
INFOPLIST_FILE = NuTemplateEditor/Info.plist;
|
||||
INFOPLIST_FILE = "Cocoa/Plug-Ins/Template Editor/Info.plist";
|
||||
OTHER_LDFLAGS = "";
|
||||
PRODUCT_NAME = "Template Editor";
|
||||
WARNING_CFLAGS = (
|
||||
|
@ -2852,7 +2916,7 @@
|
|||
GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
|
||||
GCC_PRECOMPILE_PREFIX_HEADER = YES;
|
||||
GCC_PREFIX_HEADER = "$(SYSTEM_LIBRARY_DIR)/Frameworks/AppKit.framework/Headers/AppKit.h";
|
||||
INFOPLIST_FILE = NuTemplateEditor/Info.plist;
|
||||
INFOPLIST_FILE = "Cocoa/Plug-Ins/Template Editor/Info.plist";
|
||||
OTHER_LDFLAGS = "";
|
||||
PRODUCT_NAME = "Template Editor";
|
||||
WARNING_CFLAGS = (
|
||||
|
|
Loading…
Reference in New Issue