From 716fddbfe48369a27aebe14f9889eb5e2f35d68e Mon Sep 17 00:00:00 2001 From: Nicholas Shanks Date: Thu, 31 Jul 2008 21:31:19 +0000 Subject: [PATCH] Move NuTemplateEditor to Cocoa/Plug-Ins/Template Editor/ and rename many classes to not reference "NuTemplate". --- .../Plug-Ins/Template Editor/Element.h | 80 ++- Cocoa/Plug-Ins/Template Editor/Element.m | 142 ++++++ Cocoa/Plug-Ins/Template Editor/ElementDATE.h | 12 + Cocoa/Plug-Ins/Template Editor/ElementDATE.m | 64 +++ Cocoa/Plug-Ins/Template Editor/ElementDBYT.h | 17 + Cocoa/Plug-Ins/Template Editor/ElementDBYT.m | 53 ++ Cocoa/Plug-Ins/Template Editor/ElementDLLG.h | 14 + Cocoa/Plug-Ins/Template Editor/ElementDLLG.m | 50 ++ Cocoa/Plug-Ins/Template Editor/ElementDLNG.h | 17 + Cocoa/Plug-Ins/Template Editor/ElementDLNG.m | 53 ++ Cocoa/Plug-Ins/Template Editor/ElementDWRD.h | 17 + Cocoa/Plug-Ins/Template Editor/ElementDWRD.m | 53 ++ Cocoa/Plug-Ins/Template Editor/ElementFBYT.h | 14 + Cocoa/Plug-Ins/Template Editor/ElementFBYT.m | 70 +++ Cocoa/Plug-Ins/Template Editor/ElementFIXD.h | 14 + Cocoa/Plug-Ins/Template Editor/ElementFIXD.m | 50 ++ Cocoa/Plug-Ins/Template Editor/ElementFRAC.h | 14 + Cocoa/Plug-Ins/Template Editor/ElementFRAC.m | 50 ++ Cocoa/Plug-Ins/Template Editor/ElementHEXD.h | 13 + Cocoa/Plug-Ins/Template Editor/ElementHEXD.m | 64 +++ Cocoa/Plug-Ins/Template Editor/ElementKEYB.h | 15 + Cocoa/Plug-Ins/Template Editor/ElementKEYB.mm | 105 ++++ Cocoa/Plug-Ins/Template Editor/ElementLSTB.h | 26 + Cocoa/Plug-Ins/Template Editor/ElementLSTB.mm | 249 ++++++++++ Cocoa/Plug-Ins/Template Editor/ElementLSTC.h | 4 + Cocoa/Plug-Ins/Template Editor/ElementLSTC.mm | 60 +++ Cocoa/Plug-Ins/Template Editor/ElementLSTE.h | 24 + Cocoa/Plug-Ins/Template Editor/ElementLSTE.m | 99 ++++ Cocoa/Plug-Ins/Template Editor/ElementOCNT.h | 19 + Cocoa/Plug-Ins/Template Editor/ElementOCNT.m | 85 ++++ Cocoa/Plug-Ins/Template Editor/ElementPSTR.h | 30 ++ Cocoa/Plug-Ins/Template Editor/ElementPSTR.m | 154 ++++++ Cocoa/Plug-Ins/Template Editor/ElementUBYT.h | 14 + Cocoa/Plug-Ins/Template Editor/ElementUBYT.m | 50 ++ Cocoa/Plug-Ins/Template Editor/ElementULLG.h | 14 + Cocoa/Plug-Ins/Template Editor/ElementULLG.m | 50 ++ Cocoa/Plug-Ins/Template Editor/ElementULNG.h | 14 + Cocoa/Plug-Ins/Template Editor/ElementULNG.m | 50 ++ Cocoa/Plug-Ins/Template Editor/ElementUWRD.h | 14 + Cocoa/Plug-Ins/Template Editor/ElementUWRD.m | 50 ++ .../English.lproj/Localizable.strings | 11 + .../TemplateWindow.nib/classes.nib | 17 + .../TemplateWindow.nib}/info.nib | 15 +- .../TemplateWindow.nib/keyedobjects.nib | Bin 0 -> 9234 bytes .../TemplateWindow.nib/objects.nib | Bin 0 -> 3268 bytes Cocoa/Plug-Ins/Template Editor/Info.plist | 33 ++ .../Plug-Ins/Template Editor}/Read Me.txt | 8 +- .../Resources/DisplayTMPL.png | Bin .../Plug-Ins/Template Editor}/TMPLs.rsrc | Bin .../Plug-Ins/Template Editor/TemplateStream.h | 36 ++ .../Plug-Ins/Template Editor/TemplateStream.m | 313 ++++++++++++ .../TemplateWindowController.h | 53 ++ .../TemplateWindowController.m | 461 ++++++++++++++++++ .../Plug-Ins/Template Editor}/Templates.rsrc | Bin .../NuTemplateWindow.nib/classes.nib | 12 - .../NuTemplateWindow.nib/objects.nib | Bin 3288 -> 0 bytes NuTemplateEditor/Info.plist | 34 -- NuTemplateEditor/Localizable.strings | 2 - NuTemplateEditor/NuTemplateDBYTElement.h | 23 - NuTemplateEditor/NuTemplateDBYTElement.m | 91 ---- NuTemplateEditor/NuTemplateDLNGElement.h | 23 - NuTemplateEditor/NuTemplateDLNGElement.m | 78 --- NuTemplateEditor/NuTemplateDWRDElement.h | 23 - NuTemplateEditor/NuTemplateDWRDElement.m | 78 --- NuTemplateEditor/NuTemplateElement.m | 134 ----- NuTemplateEditor/NuTemplateGroupElement.h | 20 - NuTemplateEditor/NuTemplateGroupElement.m | 108 ---- NuTemplateEditor/NuTemplateLSTBElement.h | 28 -- NuTemplateEditor/NuTemplateLSTBElement.m | 162 ------ NuTemplateEditor/NuTemplateLSTCElement.h | 33 -- NuTemplateEditor/NuTemplateLSTCElement.m | 173 ------- NuTemplateEditor/NuTemplateLSTEElement.h | 32 -- NuTemplateEditor/NuTemplateLSTEElement.m | 126 ----- NuTemplateEditor/NuTemplateOCNTElement.h | 26 - NuTemplateEditor/NuTemplateOCNTElement.m | 159 ------ NuTemplateEditor/NuTemplatePSTRElement.h | 20 - NuTemplateEditor/NuTemplatePSTRElement.m | 105 ---- NuTemplateEditor/NuTemplateStream.h | 38 -- NuTemplateEditor/NuTemplateStream.m | 135 ----- NuTemplateEditor/NuTemplateTNAMElement.h | 20 - NuTemplateEditor/NuTemplateTNAMElement.m | 82 ---- NuTemplateEditor/NuTemplateWindowController.h | 59 --- NuTemplateEditor/NuTemplateWindowController.m | 371 -------------- ResKnife.xcodeproj/project.pbxproj | 328 ++++++++----- 84 files changed, 3078 insertions(+), 2379 deletions(-) rename NuTemplateEditor/NuTemplateElement.h => Cocoa/Plug-Ins/Template Editor/Element.h (50%) create mode 100644 Cocoa/Plug-Ins/Template Editor/Element.m create mode 100644 Cocoa/Plug-Ins/Template Editor/ElementDATE.h create mode 100644 Cocoa/Plug-Ins/Template Editor/ElementDATE.m create mode 100644 Cocoa/Plug-Ins/Template Editor/ElementDBYT.h create mode 100644 Cocoa/Plug-Ins/Template Editor/ElementDBYT.m create mode 100644 Cocoa/Plug-Ins/Template Editor/ElementDLLG.h create mode 100644 Cocoa/Plug-Ins/Template Editor/ElementDLLG.m create mode 100644 Cocoa/Plug-Ins/Template Editor/ElementDLNG.h create mode 100644 Cocoa/Plug-Ins/Template Editor/ElementDLNG.m create mode 100644 Cocoa/Plug-Ins/Template Editor/ElementDWRD.h create mode 100644 Cocoa/Plug-Ins/Template Editor/ElementDWRD.m create mode 100644 Cocoa/Plug-Ins/Template Editor/ElementFBYT.h create mode 100644 Cocoa/Plug-Ins/Template Editor/ElementFBYT.m create mode 100644 Cocoa/Plug-Ins/Template Editor/ElementFIXD.h create mode 100644 Cocoa/Plug-Ins/Template Editor/ElementFIXD.m create mode 100644 Cocoa/Plug-Ins/Template Editor/ElementFRAC.h create mode 100644 Cocoa/Plug-Ins/Template Editor/ElementFRAC.m create mode 100644 Cocoa/Plug-Ins/Template Editor/ElementHEXD.h create mode 100644 Cocoa/Plug-Ins/Template Editor/ElementHEXD.m create mode 100644 Cocoa/Plug-Ins/Template Editor/ElementKEYB.h create mode 100644 Cocoa/Plug-Ins/Template Editor/ElementKEYB.mm create mode 100644 Cocoa/Plug-Ins/Template Editor/ElementLSTB.h create mode 100644 Cocoa/Plug-Ins/Template Editor/ElementLSTB.mm create mode 100644 Cocoa/Plug-Ins/Template Editor/ElementLSTC.h create mode 100644 Cocoa/Plug-Ins/Template Editor/ElementLSTC.mm create mode 100644 Cocoa/Plug-Ins/Template Editor/ElementLSTE.h create mode 100644 Cocoa/Plug-Ins/Template Editor/ElementLSTE.m create mode 100644 Cocoa/Plug-Ins/Template Editor/ElementOCNT.h create mode 100644 Cocoa/Plug-Ins/Template Editor/ElementOCNT.m create mode 100644 Cocoa/Plug-Ins/Template Editor/ElementPSTR.h create mode 100644 Cocoa/Plug-Ins/Template Editor/ElementPSTR.m create mode 100644 Cocoa/Plug-Ins/Template Editor/ElementUBYT.h create mode 100644 Cocoa/Plug-Ins/Template Editor/ElementUBYT.m create mode 100644 Cocoa/Plug-Ins/Template Editor/ElementULLG.h create mode 100644 Cocoa/Plug-Ins/Template Editor/ElementULLG.m create mode 100644 Cocoa/Plug-Ins/Template Editor/ElementULNG.h create mode 100644 Cocoa/Plug-Ins/Template Editor/ElementULNG.m create mode 100644 Cocoa/Plug-Ins/Template Editor/ElementUWRD.h create mode 100644 Cocoa/Plug-Ins/Template Editor/ElementUWRD.m create mode 100644 Cocoa/Plug-Ins/Template Editor/English.lproj/Localizable.strings create mode 100644 Cocoa/Plug-Ins/Template Editor/English.lproj/TemplateWindow.nib/classes.nib rename {NuTemplateEditor/English.lproj/NuTemplateWindow.nib => Cocoa/Plug-Ins/Template Editor/English.lproj/TemplateWindow.nib}/info.nib (65%) create mode 100644 Cocoa/Plug-Ins/Template Editor/English.lproj/TemplateWindow.nib/keyedobjects.nib create mode 100644 Cocoa/Plug-Ins/Template Editor/English.lproj/TemplateWindow.nib/objects.nib create mode 100644 Cocoa/Plug-Ins/Template Editor/Info.plist rename {NuTemplateEditor => Cocoa/Plug-Ins/Template Editor}/Read Me.txt (95%) rename {NuTemplateEditor => Cocoa/Plug-Ins/Template Editor}/Resources/DisplayTMPL.png (100%) rename {NuTemplateEditor => Cocoa/Plug-Ins/Template Editor}/TMPLs.rsrc (100%) create mode 100644 Cocoa/Plug-Ins/Template Editor/TemplateStream.h create mode 100644 Cocoa/Plug-Ins/Template Editor/TemplateStream.m create mode 100644 Cocoa/Plug-Ins/Template Editor/TemplateWindowController.h create mode 100644 Cocoa/Plug-Ins/Template Editor/TemplateWindowController.m rename {NuTemplateEditor => Cocoa/Plug-Ins/Template Editor}/Templates.rsrc (100%) delete mode 100644 NuTemplateEditor/English.lproj/NuTemplateWindow.nib/classes.nib delete mode 100644 NuTemplateEditor/English.lproj/NuTemplateWindow.nib/objects.nib delete mode 100644 NuTemplateEditor/Info.plist delete mode 100644 NuTemplateEditor/Localizable.strings delete mode 100644 NuTemplateEditor/NuTemplateDBYTElement.h delete mode 100644 NuTemplateEditor/NuTemplateDBYTElement.m delete mode 100644 NuTemplateEditor/NuTemplateDLNGElement.h delete mode 100644 NuTemplateEditor/NuTemplateDLNGElement.m delete mode 100644 NuTemplateEditor/NuTemplateDWRDElement.h delete mode 100644 NuTemplateEditor/NuTemplateDWRDElement.m delete mode 100644 NuTemplateEditor/NuTemplateElement.m delete mode 100644 NuTemplateEditor/NuTemplateGroupElement.h delete mode 100644 NuTemplateEditor/NuTemplateGroupElement.m delete mode 100644 NuTemplateEditor/NuTemplateLSTBElement.h delete mode 100644 NuTemplateEditor/NuTemplateLSTBElement.m delete mode 100644 NuTemplateEditor/NuTemplateLSTCElement.h delete mode 100644 NuTemplateEditor/NuTemplateLSTCElement.m delete mode 100644 NuTemplateEditor/NuTemplateLSTEElement.h delete mode 100644 NuTemplateEditor/NuTemplateLSTEElement.m delete mode 100644 NuTemplateEditor/NuTemplateOCNTElement.h delete mode 100644 NuTemplateEditor/NuTemplateOCNTElement.m delete mode 100644 NuTemplateEditor/NuTemplatePSTRElement.h delete mode 100644 NuTemplateEditor/NuTemplatePSTRElement.m delete mode 100644 NuTemplateEditor/NuTemplateStream.h delete mode 100644 NuTemplateEditor/NuTemplateStream.m delete mode 100644 NuTemplateEditor/NuTemplateTNAMElement.h delete mode 100644 NuTemplateEditor/NuTemplateTNAMElement.m delete mode 100644 NuTemplateEditor/NuTemplateWindowController.h delete mode 100644 NuTemplateEditor/NuTemplateWindowController.m diff --git a/NuTemplateEditor/NuTemplateElement.h b/Cocoa/Plug-Ins/Template Editor/Element.h similarity index 50% rename from NuTemplateEditor/NuTemplateElement.h rename to Cocoa/Plug-Ins/Template Editor/Element.h index a92cf22..54cb270 100644 --- a/NuTemplateEditor/NuTemplateElement.h +++ b/Cocoa/Plug-Ins/Template Editor/Element.h @@ -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 -#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 +@interface Element : NSObject { - 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). */ diff --git a/Cocoa/Plug-Ins/Template Editor/Element.m b/Cocoa/Plug-Ins/Template Editor/Element.m new file mode 100644 index 0000000..fce054c --- /dev/null +++ b/Cocoa/Plug-Ins/Template Editor/Element.m @@ -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 @""; +} + +- (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 diff --git a/Cocoa/Plug-Ins/Template Editor/ElementDATE.h b/Cocoa/Plug-Ins/Template Editor/ElementDATE.h new file mode 100644 index 0000000..8889024 --- /dev/null +++ b/Cocoa/Plug-Ins/Template Editor/ElementDATE.h @@ -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 diff --git a/Cocoa/Plug-Ins/Template Editor/ElementDATE.m b/Cocoa/Plug-Ins/Template Editor/ElementDATE.m new file mode 100644 index 0000000..42d8281 --- /dev/null +++ b/Cocoa/Plug-Ins/Template Editor/ElementDATE.m @@ -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 diff --git a/Cocoa/Plug-Ins/Template Editor/ElementDBYT.h b/Cocoa/Plug-Ins/Template Editor/ElementDBYT.h new file mode 100644 index 0000000..b604737 --- /dev/null +++ b/Cocoa/Plug-Ins/Template Editor/ElementDBYT.h @@ -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 \ No newline at end of file diff --git a/Cocoa/Plug-Ins/Template Editor/ElementDBYT.m b/Cocoa/Plug-Ins/Template Editor/ElementDBYT.m new file mode 100644 index 0000000..c4a4a2f --- /dev/null +++ b/Cocoa/Plug-Ins/Template Editor/ElementDBYT.m @@ -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 diff --git a/Cocoa/Plug-Ins/Template Editor/ElementDLLG.h b/Cocoa/Plug-Ins/Template Editor/ElementDLLG.h new file mode 100644 index 0000000..acdd365 --- /dev/null +++ b/Cocoa/Plug-Ins/Template Editor/ElementDLLG.h @@ -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 diff --git a/Cocoa/Plug-Ins/Template Editor/ElementDLLG.m b/Cocoa/Plug-Ins/Template Editor/ElementDLLG.m new file mode 100644 index 0000000..51a2411 --- /dev/null +++ b/Cocoa/Plug-Ins/Template Editor/ElementDLLG.m @@ -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 diff --git a/Cocoa/Plug-Ins/Template Editor/ElementDLNG.h b/Cocoa/Plug-Ins/Template Editor/ElementDLNG.h new file mode 100644 index 0000000..6ae1802 --- /dev/null +++ b/Cocoa/Plug-Ins/Template Editor/ElementDLNG.h @@ -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 diff --git a/Cocoa/Plug-Ins/Template Editor/ElementDLNG.m b/Cocoa/Plug-Ins/Template Editor/ElementDLNG.m new file mode 100644 index 0000000..edb5380 --- /dev/null +++ b/Cocoa/Plug-Ins/Template Editor/ElementDLNG.m @@ -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 diff --git a/Cocoa/Plug-Ins/Template Editor/ElementDWRD.h b/Cocoa/Plug-Ins/Template Editor/ElementDWRD.h new file mode 100644 index 0000000..0246c67 --- /dev/null +++ b/Cocoa/Plug-Ins/Template Editor/ElementDWRD.h @@ -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 diff --git a/Cocoa/Plug-Ins/Template Editor/ElementDWRD.m b/Cocoa/Plug-Ins/Template Editor/ElementDWRD.m new file mode 100644 index 0000000..6051e11 --- /dev/null +++ b/Cocoa/Plug-Ins/Template Editor/ElementDWRD.m @@ -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 diff --git a/Cocoa/Plug-Ins/Template Editor/ElementFBYT.h b/Cocoa/Plug-Ins/Template Editor/ElementFBYT.h new file mode 100644 index 0000000..92de00c --- /dev/null +++ b/Cocoa/Plug-Ins/Template Editor/ElementFBYT.h @@ -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 diff --git a/Cocoa/Plug-Ins/Template Editor/ElementFBYT.m b/Cocoa/Plug-Ins/Template Editor/ElementFBYT.m new file mode 100644 index 0000000..0f55d96 --- /dev/null +++ b/Cocoa/Plug-Ins/Template Editor/ElementFBYT.m @@ -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 diff --git a/Cocoa/Plug-Ins/Template Editor/ElementFIXD.h b/Cocoa/Plug-Ins/Template Editor/ElementFIXD.h new file mode 100644 index 0000000..4d3a40e --- /dev/null +++ b/Cocoa/Plug-Ins/Template Editor/ElementFIXD.h @@ -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 diff --git a/Cocoa/Plug-Ins/Template Editor/ElementFIXD.m b/Cocoa/Plug-Ins/Template Editor/ElementFIXD.m new file mode 100644 index 0000000..2f36e56 --- /dev/null +++ b/Cocoa/Plug-Ins/Template Editor/ElementFIXD.m @@ -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 diff --git a/Cocoa/Plug-Ins/Template Editor/ElementFRAC.h b/Cocoa/Plug-Ins/Template Editor/ElementFRAC.h new file mode 100644 index 0000000..6a97dbc --- /dev/null +++ b/Cocoa/Plug-Ins/Template Editor/ElementFRAC.h @@ -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 diff --git a/Cocoa/Plug-Ins/Template Editor/ElementFRAC.m b/Cocoa/Plug-Ins/Template Editor/ElementFRAC.m new file mode 100644 index 0000000..1adf266 --- /dev/null +++ b/Cocoa/Plug-Ins/Template Editor/ElementFRAC.m @@ -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 diff --git a/Cocoa/Plug-Ins/Template Editor/ElementHEXD.h b/Cocoa/Plug-Ins/Template Editor/ElementHEXD.h new file mode 100644 index 0000000..2b6fc35 --- /dev/null +++ b/Cocoa/Plug-Ins/Template Editor/ElementHEXD.h @@ -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 diff --git a/Cocoa/Plug-Ins/Template Editor/ElementHEXD.m b/Cocoa/Plug-Ins/Template Editor/ElementHEXD.m new file mode 100644 index 0000000..0f0414d --- /dev/null +++ b/Cocoa/Plug-Ins/Template Editor/ElementHEXD.m @@ -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 diff --git a/Cocoa/Plug-Ins/Template Editor/ElementKEYB.h b/Cocoa/Plug-Ins/Template Editor/ElementKEYB.h new file mode 100644 index 0000000..e757afa --- /dev/null +++ b/Cocoa/Plug-Ins/Template Editor/ElementKEYB.h @@ -0,0 +1,15 @@ +#import +#import "Element.h" + +@interface ElementKEYB : Element +{ + NSMutableArray *subElements; +} + +- (void)setSubElements:(NSMutableArray *)a; +- (NSMutableArray *)subElements; + +@end + +@interface ElementKEYE : Element +@end diff --git a/Cocoa/Plug-Ins/Template Editor/ElementKEYB.mm b/Cocoa/Plug-Ins/Template Editor/ElementKEYB.mm new file mode 100644 index 0000000..363229d --- /dev/null +++ b/Cocoa/Plug-Ins/Template Editor/ElementKEYB.mm @@ -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 diff --git a/Cocoa/Plug-Ins/Template Editor/ElementLSTB.h b/Cocoa/Plug-Ins/Template Editor/ElementLSTB.h new file mode 100644 index 0000000..802e31d --- /dev/null +++ b/Cocoa/Plug-Ins/Template Editor/ElementLSTB.h @@ -0,0 +1,26 @@ +#import +#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 diff --git a/Cocoa/Plug-Ins/Template Editor/ElementLSTB.mm b/Cocoa/Plug-Ins/Template Editor/ElementLSTB.mm new file mode 100644 index 0000000..e8a478e --- /dev/null +++ b/Cocoa/Plug-Ins/Template Editor/ElementLSTB.mm @@ -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 diff --git a/Cocoa/Plug-Ins/Template Editor/ElementLSTC.h b/Cocoa/Plug-Ins/Template Editor/ElementLSTC.h new file mode 100644 index 0000000..9a47a00 --- /dev/null +++ b/Cocoa/Plug-Ins/Template Editor/ElementLSTC.h @@ -0,0 +1,4 @@ +#import "ElementLSTB.h" + +@interface ElementLSTC : ElementLSTB +@end diff --git a/Cocoa/Plug-Ins/Template Editor/ElementLSTC.mm b/Cocoa/Plug-Ins/Template Editor/ElementLSTC.mm new file mode 100644 index 0000000..3c26316 --- /dev/null +++ b/Cocoa/Plug-Ins/Template Editor/ElementLSTC.mm @@ -0,0 +1,60 @@ +#import +#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 diff --git a/Cocoa/Plug-Ins/Template Editor/ElementLSTE.h b/Cocoa/Plug-Ins/Template Editor/ElementLSTE.h new file mode 100644 index 0000000..faf2169 --- /dev/null +++ b/Cocoa/Plug-Ins/Template Editor/ElementLSTE.h @@ -0,0 +1,24 @@ +#import +#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 diff --git a/Cocoa/Plug-Ins/Template Editor/ElementLSTE.m b/Cocoa/Plug-Ins/Template Editor/ElementLSTE.m new file mode 100644 index 0000000..dc6d0dc --- /dev/null +++ b/Cocoa/Plug-Ins/Template Editor/ElementLSTE.m @@ -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 diff --git a/Cocoa/Plug-Ins/Template Editor/ElementOCNT.h b/Cocoa/Plug-Ins/Template Editor/ElementOCNT.h new file mode 100644 index 0000000..c43cf29 --- /dev/null +++ b/Cocoa/Plug-Ins/Template Editor/ElementOCNT.h @@ -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 diff --git a/Cocoa/Plug-Ins/Template Editor/ElementOCNT.m b/Cocoa/Plug-Ins/Template Editor/ElementOCNT.m new file mode 100644 index 0000000..69d3a9f --- /dev/null +++ b/Cocoa/Plug-Ins/Template Editor/ElementOCNT.m @@ -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 + diff --git a/Cocoa/Plug-Ins/Template Editor/ElementPSTR.h b/Cocoa/Plug-Ins/Template Editor/ElementPSTR.h new file mode 100644 index 0000000..5086ccb --- /dev/null +++ b/Cocoa/Plug-Ins/Template Editor/ElementPSTR.h @@ -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 diff --git a/Cocoa/Plug-Ins/Template Editor/ElementPSTR.m b/Cocoa/Plug-Ins/Template Editor/ElementPSTR.m new file mode 100644 index 0000000..d493d0a --- /dev/null +++ b/Cocoa/Plug-Ins/Template Editor/ElementPSTR.m @@ -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 diff --git a/Cocoa/Plug-Ins/Template Editor/ElementUBYT.h b/Cocoa/Plug-Ins/Template Editor/ElementUBYT.h new file mode 100644 index 0000000..3646e80 --- /dev/null +++ b/Cocoa/Plug-Ins/Template Editor/ElementUBYT.h @@ -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 diff --git a/Cocoa/Plug-Ins/Template Editor/ElementUBYT.m b/Cocoa/Plug-Ins/Template Editor/ElementUBYT.m new file mode 100644 index 0000000..1b74f85 --- /dev/null +++ b/Cocoa/Plug-Ins/Template Editor/ElementUBYT.m @@ -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 diff --git a/Cocoa/Plug-Ins/Template Editor/ElementULLG.h b/Cocoa/Plug-Ins/Template Editor/ElementULLG.h new file mode 100644 index 0000000..d90bdc2 --- /dev/null +++ b/Cocoa/Plug-Ins/Template Editor/ElementULLG.h @@ -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 diff --git a/Cocoa/Plug-Ins/Template Editor/ElementULLG.m b/Cocoa/Plug-Ins/Template Editor/ElementULLG.m new file mode 100644 index 0000000..4b1a83d --- /dev/null +++ b/Cocoa/Plug-Ins/Template Editor/ElementULLG.m @@ -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 diff --git a/Cocoa/Plug-Ins/Template Editor/ElementULNG.h b/Cocoa/Plug-Ins/Template Editor/ElementULNG.h new file mode 100644 index 0000000..156752f --- /dev/null +++ b/Cocoa/Plug-Ins/Template Editor/ElementULNG.h @@ -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 diff --git a/Cocoa/Plug-Ins/Template Editor/ElementULNG.m b/Cocoa/Plug-Ins/Template Editor/ElementULNG.m new file mode 100644 index 0000000..015a396 --- /dev/null +++ b/Cocoa/Plug-Ins/Template Editor/ElementULNG.m @@ -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 diff --git a/Cocoa/Plug-Ins/Template Editor/ElementUWRD.h b/Cocoa/Plug-Ins/Template Editor/ElementUWRD.h new file mode 100644 index 0000000..667e97f --- /dev/null +++ b/Cocoa/Plug-Ins/Template Editor/ElementUWRD.h @@ -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 diff --git a/Cocoa/Plug-Ins/Template Editor/ElementUWRD.m b/Cocoa/Plug-Ins/Template Editor/ElementUWRD.m new file mode 100644 index 0000000..640a580 --- /dev/null +++ b/Cocoa/Plug-Ins/Template Editor/ElementUWRD.m @@ -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 diff --git a/Cocoa/Plug-Ins/Template Editor/English.lproj/Localizable.strings b/Cocoa/Plug-Ins/Template Editor/English.lproj/Localizable.strings new file mode 100644 index 0000000..f01b20f --- /dev/null +++ b/Cocoa/Plug-Ins/Template Editor/English.lproj/Localizable.strings @@ -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."; \ No newline at end of file diff --git a/Cocoa/Plug-Ins/Template Editor/English.lproj/TemplateWindow.nib/classes.nib b/Cocoa/Plug-Ins/Template Editor/English.lproj/TemplateWindow.nib/classes.nib new file mode 100644 index 0000000..a169578 --- /dev/null +++ b/Cocoa/Plug-Ins/Template Editor/English.lproj/TemplateWindow.nib/classes.nib @@ -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; +} \ No newline at end of file diff --git a/NuTemplateEditor/English.lproj/NuTemplateWindow.nib/info.nib b/Cocoa/Plug-Ins/Template Editor/English.lproj/TemplateWindow.nib/info.nib similarity index 65% rename from NuTemplateEditor/English.lproj/NuTemplateWindow.nib/info.nib rename to Cocoa/Plug-Ins/Template Editor/English.lproj/TemplateWindow.nib/info.nib index d14c849..8492809 100644 --- a/NuTemplateEditor/English.lproj/NuTemplateWindow.nib/info.nib +++ b/Cocoa/Plug-Ins/Template Editor/English.lproj/TemplateWindow.nib/info.nib @@ -3,22 +3,25 @@ IBDocumentLocation - 235 41 356 240 0 0 1024 746 + 775 135 356 240 0 0 1600 1002 IBEditorPositions 23 - 379 326 270 342 0 0 1024 746 + 695 542 210 302 0 0 1600 1002 IBFramework Version - 326.0 + 446.1 IBLockedObjects - + + 35 + + IBOldestOS + 3 IBOpenObjects 21 - 23 IBSystem Version - 7A202 + 8P135 diff --git a/Cocoa/Plug-Ins/Template Editor/English.lproj/TemplateWindow.nib/keyedobjects.nib b/Cocoa/Plug-Ins/Template Editor/English.lproj/TemplateWindow.nib/keyedobjects.nib new file mode 100644 index 0000000000000000000000000000000000000000..29cf80754dc4983584635d0095019986c453481c GIT binary patch literal 9234 zcma)B2Ygh;x}TY|CEL&T-LnS>Arv7%8iY_Jg%(OcHb8)2T#_YOSh8VvLx30^KsqQ$ zuTlk-CZIGC^jZ+GacSaJyk09s!G|c<_P#l1Hw5qX{a*6h-E-#5eC7YunKQOJ7>Gnu zQ_mrc2;z_eDUk}Pk#=OVFI-j`nCuT1C&O1H5UMIlj)tm>lS5<2`^%z{Qr=YP9pInp zFVBrlv>-ftV!I@?x+XKMZHlGDnZp~5(=XT zszo!=9JB#Fiw>Ye=mNTkK1E-nZ_ssg3;lq8M89Ajn{iXz47bK@a66oeGjKQD9rwUF zxDOtTi|`0sg2&)eJQfG>L>$3UJPpsnv+*MQBwmV_;dOWu-i){5=kRX42k*lN@gaN^ zzl~4gckmf}0e&yykMTe7C-^h`Py7X%jK9Ix@O69>|42-PCuU+Hb|R3bq#em1-AN7^ zf)9{~$WT&Dd}J)CAeCey4wA_@LLMcLktgshvWP4t%g7qCo@^k`;*(@M*$dw(5niPjIui+1wm%E;o1DsDBmhFi<6qY!;-6Ng25}i1sRYLnGlc6 z$bziMhV00JoXCaTNI)JWq9&**YK9U~bCiTypk&k%wL+~?8}tBbi`t*`9WVK;*ZF)M-_Sp2g)Ph zZ;{c3-a_9*zjQsO&>Ne^p8O|CwnipUA`^)7<_o>U1Hd@w9}%c357kD7CzmmPjG!zA zI6S+PSjns4E~bIZ%=stz8wuDa3=-Cc!V_RkpHNkFkgv*D;SY}ldj2UC5yW-A-Sk=jkD;q8Dfa-9fj~b5uzYpGnDCKs+5~piEF)QkIEC6_hLGT}A$h z)j?l0rUXbH4Tpk3fA}oQLS0Zc>RK$T<&TV#FREbeX4DmRdl-n-M53XIvP#8q-AZ}B zATK{u7VbNm%p(uwZ$bH}7wQHG52}g!08+0%I;_wO-}1^n z$h#BuMg33#>W>DXfoKpaM1#=~^bi_KHME2-rccvlbOl{S*U)uz1KmhB)BJO27#a?I zN1$Rf5{*Km0m@$fNHkF8i-K)N6nY2x#`=RGxHnW2F7s0p9Yse|?PW9uJ&a1xBghA< z$D%S+j{ImGxM3vOC8pd1bNIG0L^b^Rt3C*Hrn*WK!WGyKg^hdahNe6(1ydE1XDjS zg+H7h3{@Y#!AMElTwNCJ6%^FzT9O9#C|WlSu%DvRN21N_X?PIIW8SI~ZD4Wb1y z@0S?7yWmkiOU#GS5p)zR`3gFQUPZ^zTyz5Xy@p-~+x`u`f!+lEZ=tt=>oW8XI)zT7 zGjR1DdLN=-EBX-h`8zs?&X@9##tI+|AcTTJZ?&%se04;iJX#4*$&kwyaI^j~2Dq7dccIJR2g}iU^a(JR7&1Y?MsDy57Zv`yS6q?2;%)E>W}h#aSI~zfyF0<| zPCAqpjFcIsWyRw9TXc0Rx{9u`$d;6mnB6lF6con!yd;|Jd(88`2hnaylttR4l(*H@ zrFDUPky@XUSeKTbk_hx;4E_h*-imI^491i;hE?{yJIK2Q{e*r-cWE=4NwaDG$LLo8 z<2Up>`U4}3F~J;GAO}{WU0971um)?v>rP_>HewUl1Co&BG|V9yoGTx^4ss17PRZ#Y ztmDpCP!4G_FfQN^!`gy~wA#;13Tq1@y~_hqtzj7$ddxT(-xO&%&w&Y=C*@LvlJcTp z%|wlcwol4;z-2~JbZWK#B6<^Buoc@tU^{kTCw5^s7O)44xCyf*WS@ADLRP8{g`>bK zmZw=tWE`br!(1?aolaZPHnaszqA3=|^xu&s0bHr52>6}DiMToNO2RF0GH!`mfx%cp zg&$VWA$5(Ds3qm5f{e+urCBeQ46G>&l>7RIeNd02^o}3EZ8zh#s2eO}eZ}8#3T_Wn zJ76X5$grynL>WGkzYC=LXQ?ay`i8%1dqF zoQw0e;XIs=d*R;y>BkI4sm3xoeFFYqIU50Wa?4oBXE&fX`-xkxFGvj5L+5Y-?hkG^ z5D&tIv5XHjL5jtWG?jJ$cSyI`(tgh|D`0Zm6hkCac$0F6#4uOb;*t-OBu@j$??-2( zj1Fx_(-;C!nabp@t3h`e{?1O7ZL$Qq$IB=|lxq>~3K7>csn;|Xaib&AFw_I7jgGU9 z%Q;61y!jyKLXfkE6h7Tq_~75sFlj|21Ay%o#|+SsKFAC(TJ}82RpX@NTJ3J|iZysG zB-RE$XbygmfEv-o>+yyd-8`Br8`cps?4PPe+(EW52Z8A7EdSk$u4nP~EqFWLA@$g? zjyN|Q_DzLwlYSfXeICCM0iqEEc<6=Lob<`8O#6pFg~&sACbwiOc(33 zF0+DyUx9Y!RjG?};A8kzseH}CuY>W=1B`FrH}PAL!HRt03V#$B4q@FyRTPHg$dw9^ znGVp_G#KD`Z}j;ji?#h?FQvVFj0 z!)HOZbNGCW|6q+7V=x_l+NZJhnSD!AWOV{~Ix$FK%Y!emhU;yp$N8na zRe~-y3y@=lQ&OTmNZvk8TAd9AHNA6s9MMnlm96-Sj3^{AS!!mVQFUqAz%{)yH0}6v zXd|xSe*tP8J9we7W^Ilo>8?y?Fo!!j^l?~7u$S8v4z2g+lFlzzJ-5a+b}wYKE?J~ zpWr+AC;T(Mi~o&(!N20)@bCB!(3V@IechWW(6qTP1g+l`wU%$VK-LUn(DQtbi90mXk zk0@%`AHaY_222~)d%e2$2;oaTQT+o-W!)a$U1x^EXnngOWI;nRX7la{0vT18ruHlzjHM^Qf= zOXt9691YQlbOz7U$Kkq2W{?6q7+BSYw1RcXF#b550kcAXv4bI*M1=n=v>QHqNmr>? ztpNGTX(go8O8QuAdqR3J$+KVtwkNhm+mqvvIgZ7)C+Q^j&s!9d2V`5IcStXY*i&%z z9_dT^kpdI|%?6;eWDq(>21`~N91g&?!WX=E3KFE_EJIHqqyatZX@HIgJtjcYJ_(w3 zGa6G^)F>;Cs>@)T=JYO^_c!q*ixdGAEm;!}(pLc(6XT8hG?059Z0EMah7S6DG7_K| z4WB%adN;K0tZ|o${h@*x*H)$`W+s^MTkDuCbu za>;4%hWbklH4bdd>YHRPk!)tQjcg^`z+~*7vf5EQd;^^>W&XIGS^0waPw$*vU;j}f zQj6{*_5wOjb^^KGWKWFTOkOHRlV1qaC;m$@%1F&@RE)?z7G8PaWBK67a=uA}3dDAF zDT&$lXCWDdL+IKTx%x=rg5oh(V4K)3G^A*_`6?*r8j)419}x2s2WlIxUA8WO%J~tlRJ$ zrIL$i6r?9YSHknk#t;4xd$9Wc2fN5WC5m>smQfsC9*DqM>(qhpzNBF_xcS%8q)NJ; zO)6%>-!}so-$0}AEnxf%%ox*nDb!PVP)Rqj2jHB6sz5a03-$?wBlnIW8y29^BaaKx(j|h9+pjjbBbBOry10QOgQiw1H1Qf z$SqpPE_UdRwn_fN8SswHtZkL3aVADhggw3P=*{4`i$((^gWyp7A%Jcj7>1qrEe0@F0Ep}`d^0VPfSCeE z;v2wd%w$@CYZV-rZ;W%Tl(=#MZag=E3vv^=DlWuTbCb9*7vZ8@4L6yq<)&~`xoKP- z_b6A-J;puGQEoangC3?w=u!F#Jw{)p$LR_B8hxGqjlMzOq;Ju;=}GzyJw;E`GxS~h z9(|vFKtH5s={DZMr|?a94=?gf`3Lx9z8T+~Pv_ly3%(_v#JA(y^8#<@Gk6>CWix5lm^g>c)s9h*6M&s2~nzms5TAKoUq;k{A{ygKX(Zw?-U zR|4f|9C4B+@VadpSwVJ?{p2`#mwZd^a2k$>7h@@0SFVVA1i+XA>Q3io!fUWO+&p;w zwFq8)ErHiw%i)#RYIxnXo_mJd1h2bxa)-Dh+$-Eg?lbON?lyN5fGm7^V zA1KZ$eo<Wy%%GwaWF%XOx?iTa-JL&ntH-4=PV6Pb<$U zKURLBys0v%+^S?%sw!L6P1QryQVwM(B9VG)j4!Y zx)fcOE?+l9H&j=o8?GzXjnb9s%5?$VG~IOFT-_4g3f(H*8r^!`^Sb@IL%QR-GrDuS zf9h`NzSsS%`%SOZ3;I_2Onqm47kyWKcm0F<-ue;xa(#t9pbzWo^-J_y^n3LO_2=}T z>%Y){rT<2MRexQ7OMly-G-wTagVA6%G&M9gv@morbTxE0JZQ)j6%Z)3ItBo6sTaAZ}M~%mf$BnNU-!)z}UN?Sc zylMQwc-wf__^ZimvYPBBr^#(fH}y0PFby&dH;pj`O;OW4(*n~X(^IA;rnROWrd_5z zrbDK;P3KLYo38T;-T-0VobS(j`7!)BzLFo$2l*;K#82WU^HcaG{04qIzmGr0f5m^p zU*)g!-|^q`Kk&EtyZkR^r#aEw!rao_+T6oD++1p|G}pk}jCtmz=H=!M=56MK<`d?3 z%xBG4%-77f&A(VImgbgpOQxl>rHiGjC1jatS#Ej8vdePRa?*0%a>a7pa>q)nE~{V_ ztxc_o)+B4PwUxDvwXLvpAPIcBf>z$7~r#ojm=Q_7KcRBYu_c;$Zk2^0ouQzeAC?^@`3(zV$2v}?U``s_O54sP#kGkJ-zwf^4zV80cebfDe`?mXz`)BvR-M_kj7mz>%g`g5l zf=y^5bP>7=-Gv8*93fBWCG-*c3H^nELZL837%CJAV}!}V6k(e1sPLFTg&D#V!fau# zFke_GJSi*|Rtx)t1H#L~A>oMditws%LU>(xLwHL#DV!3{2p&>G zr=us$)78_%)6F=5DndzD3nd6z~S>RdZdCIfIv(&TPv(mHLv(~fT^NeScXNzZ> zXS?S)&kLSio;{uyJ^MW`c@BC`cz*KS_59-b&GUzdMNU+TYEdKVM1yD&&7xJbi%!uk zdc-DTGqJhYLTo9v79SAXiS5OXVw#vCb`rD1Y_XfzL+mN$iuq!1v9DMl4iE>4gT;qL xuQ*H`A&wMBi(|x6u~H0(6U3-kBi4#koG#837m7=e^hb#N%RMLm#=pgl{|nh-qjCTM literal 0 HcmV?d00001 diff --git a/Cocoa/Plug-Ins/Template Editor/English.lproj/TemplateWindow.nib/objects.nib b/Cocoa/Plug-Ins/Template Editor/English.lproj/TemplateWindow.nib/objects.nib new file mode 100644 index 0000000000000000000000000000000000000000..4236cf984067767f54d6494a8dfd091b30bce66a GIT binary patch literal 3268 zcma)8Uu+b|8K1GwuJN5?9}r5YOPz!!g(MY$st=YD4m)*gi5yYRB9+o6TJF|#oAsTw zx30re*z@c@M=N{fRZ!e;wP=pOm4H%(wh*aFh02OPMCGBn*iorkL?vEQRh1v0zi(#G zKD$Kfoo{FT&CK`x=KJ%TFOjs5PwIuTZRy&C(|$|vj1c01Y;JVu@X?>@dHXrd)*SY^ z5M9}vk}%g-ONOV)c4n|C_LTP%qRJ5&< zY3i2edV(80L9EHt%H`a&HaV$Vdq~rxVt&3SJ9c==HjScw#L%ZbA$ovdO~8dnW^-fO zQB%%8BgCd`E;g`Rh|X+|w&4w{UewEzrD8$1*eqf1#zNDWr1`-G5~Kh+Pryjzu)jjM z;JYCcsSG~j@ke2Oe#$1B2Q5oG&V=|%Hm6=^L+)2S*LC?Ohfg^CNygOZyXxzOmCYv@ ztBTWMhyPBDLz&erhkg3CUkxjaRzQjC@K@5k4)0-%o_&-5woWVD~EJIRURB znrziWp*&|A${pS>&x=tS2%#f<@4N(u9dE|bZLVpK(iZaMG~>(_Nttv=yum@E{sHo( zO`a=`0ggX4QAELYQD%}C;iV2!JF1)B3wx=CH^ysNH_d(_dZ9pn-5xP?vp}L}W#S*q z+eWEK|EFcu(Az=OpkY)J&Rxbtf@*+F9FiuW9kn%rpzNFtcZrUd_kTD4<4$;F2Yz?& zu|sT%<(a_>Ok>|?7M?}C>rlkUlQl*uR!hNOurP=;##glGGZ{wltj|1Kt1WPfZRfcQ zu-W?)nQ#PqE$Vdy+VjMf4=Y=rzMF9p?2;=!4tM?b{{iv4o)|&`5H3sm;T2_@x7h8A zlWxuMRnOzh50PQNxd>oMFeXUuh-Oadp2Mz6zhC}Px$F`aB#1b@-#3l8SJ)?iSdaOS z%{c(L7I~aQyVu@!ZT0Y*j#)-ave#!0z{5Ct+I1^0BKOF5zUx&31t~#H?mg4zut3B} zDqYwi(TvetE1Fh!e;F`w(if+E@e9g6P^98}$*RPTmCaC2Y{va1IFss}U3Pe)IVyO* zOB|2Xi+MA?98ltlpsB=L8QNP%lb;cZEw%8B!!D+i4*M5l^z@gM5m`3=64BUH<)L>G z;sHs2tvf+~tWNZY=Y95><9{RiqkX5OML1X;PW;Nh)q;RD+$5&M)4vrTvLRW7LwG?> zT}Vq4w=sP?u6|$qdgDo03X4-}DMgaJc<-LWK5{s6S&jZObbN;2-~E4Jgu(NYgD&Ex zSjRyP+Rf8IAl;)ziK2nsjWrHBvBp8{CPIjVFlhl0q$A(I{ZB---MPeLGa0wHjEh zlBA*tMGx1!*zUt1hAt4pYLUV2d0Au#6^iUrSwx?&7E!YV8(t$=M8fuEbE;)&HZTtV z&#dS%40#I>BWCgsv^hL*xTCK5%H-?dxcT`mG#jNUE3Z>#qZ?9cJaKbAL8ap@x?Chk z3q0SMaoTU!c->)tc9`R1!?vcqf$tRzyJQW-+iPw0nK$0JcSk=qMRwy+{Yjwz=SX7&MlGrR6Xc zgs|P(PIW`NP4o~BL_JXR?x7K{^_W}y|{}?9ECZ#%cL@&6mwyuNHpj9zE>Fi)ht!gz8vssgm zbQ@h<2O2=Upk*DU#_4pJqE%b7xvX)NdQKhJPqB!0xP(saPqIPA%&IIsdydh8lXPw1 ztkO30Y&pkP5ct%jWq2W@#q>WhG Mgg#xeUh};F0_qGr3jhEB literal 0 HcmV?d00001 diff --git a/Cocoa/Plug-Ins/Template Editor/Info.plist b/Cocoa/Plug-Ins/Template Editor/Info.plist new file mode 100644 index 0000000..8bdecc2 --- /dev/null +++ b/Cocoa/Plug-Ins/Template Editor/Info.plist @@ -0,0 +1,33 @@ + + + + + CFBundleDevelopmentRegion + English + CFBundleExecutable + Template Editor + CFBundleIdentifier + com.nickshanks.resknife.templateeditor + CFBundleInfoDictionaryVersion + 6.0 + CFBundlePackageType + BNDL + CFBundleSignature + ResK + CFBundleVersion + 3 + NSPrincipalClass + TemplateWindowController + RKSupportedTypes + + + IsResKnifeDefaultForType + YES + RKTypeName + Template Editor + RKTypeRole + Editor + + + + diff --git a/NuTemplateEditor/Read Me.txt b/Cocoa/Plug-Ins/Template Editor/Read Me.txt similarity index 95% rename from NuTemplateEditor/Read Me.txt rename to Cocoa/Plug-Ins/Template Editor/Read Me.txt index baf5537..7a92f54 100644 --- a/NuTemplateEditor/Read Me.txt +++ b/Cocoa/Plug-Ins/Template Editor/Read Me.txt @@ -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 diff --git a/NuTemplateEditor/Resources/DisplayTMPL.png b/Cocoa/Plug-Ins/Template Editor/Resources/DisplayTMPL.png similarity index 100% rename from NuTemplateEditor/Resources/DisplayTMPL.png rename to Cocoa/Plug-Ins/Template Editor/Resources/DisplayTMPL.png diff --git a/NuTemplateEditor/TMPLs.rsrc b/Cocoa/Plug-Ins/Template Editor/TMPLs.rsrc similarity index 100% rename from NuTemplateEditor/TMPLs.rsrc rename to Cocoa/Plug-Ins/Template Editor/TMPLs.rsrc diff --git a/Cocoa/Plug-Ins/Template Editor/TemplateStream.h b/Cocoa/Plug-Ins/Template Editor/TemplateStream.h new file mode 100644 index 0000000..b8b84e6 --- /dev/null +++ b/Cocoa/Plug-Ins/Template Editor/TemplateStream.h @@ -0,0 +1,36 @@ +#import + +@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 diff --git a/Cocoa/Plug-Ins/Template Editor/TemplateStream.m b/Cocoa/Plug-Ins/Template Editor/TemplateStream.m new file mode 100644 index 0000000..6ca073d --- /dev/null +++ b/Cocoa/Plug-Ins/Template Editor/TemplateStream.m @@ -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 diff --git a/Cocoa/Plug-Ins/Template Editor/TemplateWindowController.h b/Cocoa/Plug-Ins/Template Editor/TemplateWindowController.h new file mode 100644 index 0000000..3778e14 --- /dev/null +++ b/Cocoa/Plug-Ins/Template Editor/TemplateWindowController.h @@ -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 +#import "ResKnifePluginProtocol.h" +#import "ResKnifeResourceProtocol.h" + +@interface TemplateWindowController : NSWindowController +{ + 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 resource; // The resource we operate on. + id backup; // The original resource. + BOOL liveEdit; +} + +- (void)setupToolbar; +- (void)readTemplate:(id )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 \ No newline at end of file diff --git a/Cocoa/Plug-Ins/Template Editor/TemplateWindowController.m b/Cocoa/Plug-Ins/Template Editor/TemplateWindowController.m new file mode 100644 index 0000000..f691ae4 --- /dev/null +++ b/Cocoa/Plug-Ins/Template Editor/TemplateWindowController.m @@ -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 )newResource +{ + return [self initWithResources:newResource, nil]; +} + +- (id)initWithResources:(id )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)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 \ No newline at end of file diff --git a/NuTemplateEditor/Templates.rsrc b/Cocoa/Plug-Ins/Template Editor/Templates.rsrc similarity index 100% rename from NuTemplateEditor/Templates.rsrc rename to Cocoa/Plug-Ins/Template Editor/Templates.rsrc diff --git a/NuTemplateEditor/English.lproj/NuTemplateWindow.nib/classes.nib b/NuTemplateEditor/English.lproj/NuTemplateWindow.nib/classes.nib deleted file mode 100644 index d510212..0000000 --- a/NuTemplateEditor/English.lproj/NuTemplateWindow.nib/classes.nib +++ /dev/null @@ -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; -} \ No newline at end of file diff --git a/NuTemplateEditor/English.lproj/NuTemplateWindow.nib/objects.nib b/NuTemplateEditor/English.lproj/NuTemplateWindow.nib/objects.nib deleted file mode 100644 index 38eb30459973dee4d5fbd8306a6a653cbe6c2045..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 3288 zcma)8U2GiH6~1@9HjaPdU1A6FLuY%9?M-4F5n#$+%sg$Dd>FH)YdrZ~E#K8AQ|1vRNylW!g)tJb3m~*)4<S=b+A~@1ZGOCBQ@Tn%_u z!4S>2bE=RTIzwiNa2)W_59xvrZ&Fez0+w$9|E6wQWOAm7$MX4!N9N~Wrh?DRwD6_? zMoZ>+!B$5FAnJNjhKE5(EnL?$N2m~jzw}C}`~KAwdDY>sm-}A-F#zA_1Yig*4&dID z$b$4AD%!ecs7Ew)oO0eC<`#cG%=spSEVpg9%nXX*30D1DEsU84yb;^Wy;10l^%Rf+r0(`t^V@({etn6_}9ONx{oGep! z0pL4?F!Fy!?~Cr3X8d49K_P_tVKGim!8c<2s2a>m_CXgqgNQmMf~z+q@9B0I6n)i+NuOQKaf?P9IJ{lf zAk<-hzjpCssE3%#U;Gm!A&xy#Je**}<9~idHjPp%0C^SP9maRBMRamz$s2Dra`R;L zrZP(;d1*j)ncYN~-8FvC2|=k_5pG#D#V*&kVbh4EtqHUW7Ipr>uOMQS+(q?lrBPV(>{U>_erM0Ak3iOCT1>5remm$4$mDJPQiG|b~ zogt#0&1Jr+P|!4N8!1LU+D1#Fl)4W4K?MH*F3w2@dL)+lCPr(FJ_)|%J@D;1>u7%! zX<2LF4Wn-X&1oCboVG!1VVNMqYe>uSBQL#QCv>AGWpoFlvq)&TZlL+hNo$SJsClkV z=)b#PH(-z!kf3xn>3$vJu14GiVfYHceT(0))?NP38)J!h7se6rZa1T67~P9j@GiII zD%knb{mQ)x4!`@`#*C|mjH9zMK>#mGQ5CeSH!*JgI`j}R?!#}tYhYP;&@*x=abuB& z2XiCK{=IQ&RwD{jg?j}l^x1|Kp>9=Fy@f?QD-!8UFq=eG#^}l<@6o%oGmWJlFpFPwvB(Na`ATz~?BIV{AuJaU#C%HwDaavdiu_TL#g z$H-@lFc%cIuFXil%xSi1h3Yf0xryhVyZ(*5h$-(<#amwTu2sFoDTEDv9<{RLszu*% z9WeJ1{Lk&%H^*YXW%LCeA09@3q$|ib=+~CKYR#)GcuOngPOl7}*Uw$TtAecY>=)iO zkic2oFrD2myvj|>7D3X5XmCzY4O>R-Er1kUtW5w92=7WDYcMFhOCY<+$ubD*-9&h` z4Q#ETUbJaJ>V&r%=mn_}-W2@o7}9igSE2XNI2=s!oPwScjR&d?!$mWoga?>dhw-32 zTkgPS)}79zwPQFMsW5#R228^yOa!0E@dVz~Wy#6;RZKxUw(}@_uygDD>IxJ=$5_?^ zX}GOYUO`-KIcU9^pm5fttvOX!M_^zUQZ|KAwv5Z+86}+eNLZL@n5^m;0N0lJWsLq7 z+Z-9u)&4-gx}hg2z0s50*PK>>asBu~tzd@$uqs*+>Y8i?jozTXg6n!TL$kH4KBQR% zyFML4Cx$6+JCCKb)o#CMn}6jl|I!`)wV(MbJ$~|be~S9GyZxoD{+?g>xBbMw_vijS z_xU^S^q24P%iH~JKlK-H^Y7Z@SNr_l-G1L*|BhXLWv9Qeqr9(7kU@#zfk9I-vqKiJ Kaon_?7UBnSe@cu1 diff --git a/NuTemplateEditor/Info.plist b/NuTemplateEditor/Info.plist deleted file mode 100644 index 9d14fb8..0000000 --- a/NuTemplateEditor/Info.plist +++ /dev/null @@ -1,34 +0,0 @@ - - - - - CFBundleDevelopmentRegion - English - CFBundleExecutable - New Template Editor - CFBundleGetInfoString - - CFBundleIconFile - - CFBundleIdentifier - com.ulikusterer.resknife.nutemplateeditor - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - - CFBundlePackageType - BNDL - CFBundleShortVersionString - - CFBundleSignature - ResK - CFBundleVersion - 0.0.1d1 - NSMainNibFile - NuTemplateWindow - NSPrincipalClass - NuTemplateWindowController - RKEditedType - Template Editor - - diff --git a/NuTemplateEditor/Localizable.strings b/NuTemplateEditor/Localizable.strings deleted file mode 100644 index 8cc7365..0000000 --- a/NuTemplateEditor/Localizable.strings +++ /dev/null @@ -1,2 +0,0 @@ -/* Name we give the "Create New Resource..." menu item: */ -"Create List Entry" = "Create List Entry"; \ No newline at end of file diff --git a/NuTemplateEditor/NuTemplateDBYTElement.h b/NuTemplateEditor/NuTemplateDBYTElement.h deleted file mode 100644 index e0532a6..0000000 --- a/NuTemplateEditor/NuTemplateDBYTElement.h +++ /dev/null @@ -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 diff --git a/NuTemplateEditor/NuTemplateDBYTElement.m b/NuTemplateEditor/NuTemplateDBYTElement.m deleted file mode 100644 index 97915f4..0000000 --- a/NuTemplateEditor/NuTemplateDBYTElement.m +++ /dev/null @@ -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 diff --git a/NuTemplateEditor/NuTemplateDLNGElement.h b/NuTemplateEditor/NuTemplateDLNGElement.h deleted file mode 100644 index c74cdd7..0000000 --- a/NuTemplateEditor/NuTemplateDLNGElement.h +++ /dev/null @@ -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 diff --git a/NuTemplateEditor/NuTemplateDLNGElement.m b/NuTemplateEditor/NuTemplateDLNGElement.m deleted file mode 100644 index fb0f9ce..0000000 --- a/NuTemplateEditor/NuTemplateDLNGElement.m +++ /dev/null @@ -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 diff --git a/NuTemplateEditor/NuTemplateDWRDElement.h b/NuTemplateEditor/NuTemplateDWRDElement.h deleted file mode 100644 index bcb6f00..0000000 --- a/NuTemplateEditor/NuTemplateDWRDElement.h +++ /dev/null @@ -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 diff --git a/NuTemplateEditor/NuTemplateDWRDElement.m b/NuTemplateEditor/NuTemplateDWRDElement.m deleted file mode 100644 index 1d45414..0000000 --- a/NuTemplateEditor/NuTemplateDWRDElement.m +++ /dev/null @@ -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 diff --git a/NuTemplateEditor/NuTemplateElement.m b/NuTemplateEditor/NuTemplateElement.m deleted file mode 100644 index 263db7f..0000000 --- a/NuTemplateEditor/NuTemplateElement.m +++ /dev/null @@ -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 @""; -} - - --(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 diff --git a/NuTemplateEditor/NuTemplateGroupElement.h b/NuTemplateEditor/NuTemplateGroupElement.h deleted file mode 100644 index 72157b4..0000000 --- a/NuTemplateEditor/NuTemplateGroupElement.h +++ /dev/null @@ -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 diff --git a/NuTemplateEditor/NuTemplateGroupElement.m b/NuTemplateEditor/NuTemplateGroupElement.m deleted file mode 100644 index c886f9d..0000000 --- a/NuTemplateEditor/NuTemplateGroupElement.m +++ /dev/null @@ -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 diff --git a/NuTemplateEditor/NuTemplateLSTBElement.h b/NuTemplateEditor/NuTemplateLSTBElement.h deleted file mode 100644 index e214b9e..0000000 --- a/NuTemplateEditor/NuTemplateLSTBElement.h +++ /dev/null @@ -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 -#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 diff --git a/NuTemplateEditor/NuTemplateLSTBElement.m b/NuTemplateEditor/NuTemplateLSTBElement.m deleted file mode 100644 index f31790a..0000000 --- a/NuTemplateEditor/NuTemplateLSTBElement.m +++ /dev/null @@ -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 diff --git a/NuTemplateEditor/NuTemplateLSTCElement.h b/NuTemplateEditor/NuTemplateLSTCElement.h deleted file mode 100644 index 3c76956..0000000 --- a/NuTemplateEditor/NuTemplateLSTCElement.h +++ /dev/null @@ -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 -#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 diff --git a/NuTemplateEditor/NuTemplateLSTCElement.m b/NuTemplateEditor/NuTemplateLSTCElement.m deleted file mode 100644 index c5ea7d6..0000000 --- a/NuTemplateEditor/NuTemplateLSTCElement.m +++ /dev/null @@ -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 diff --git a/NuTemplateEditor/NuTemplateLSTEElement.h b/NuTemplateEditor/NuTemplateLSTEElement.h deleted file mode 100644 index d0a711b..0000000 --- a/NuTemplateEditor/NuTemplateLSTEElement.h +++ /dev/null @@ -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 -#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 diff --git a/NuTemplateEditor/NuTemplateLSTEElement.m b/NuTemplateEditor/NuTemplateLSTEElement.m deleted file mode 100644 index e7d0525..0000000 --- a/NuTemplateEditor/NuTemplateLSTEElement.m +++ /dev/null @@ -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 diff --git a/NuTemplateEditor/NuTemplateOCNTElement.h b/NuTemplateEditor/NuTemplateOCNTElement.h deleted file mode 100644 index 25baa3e..0000000 --- a/NuTemplateEditor/NuTemplateOCNTElement.h +++ /dev/null @@ -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 diff --git a/NuTemplateEditor/NuTemplateOCNTElement.m b/NuTemplateEditor/NuTemplateOCNTElement.m deleted file mode 100644 index 068e1ac..0000000 --- a/NuTemplateEditor/NuTemplateOCNTElement.m +++ /dev/null @@ -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 diff --git a/NuTemplateEditor/NuTemplatePSTRElement.h b/NuTemplateEditor/NuTemplatePSTRElement.h deleted file mode 100644 index 2ac8c61..0000000 --- a/NuTemplateEditor/NuTemplatePSTRElement.h +++ /dev/null @@ -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 diff --git a/NuTemplateEditor/NuTemplatePSTRElement.m b/NuTemplateEditor/NuTemplatePSTRElement.m deleted file mode 100644 index 080323d..0000000 --- a/NuTemplateEditor/NuTemplatePSTRElement.m +++ /dev/null @@ -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 diff --git a/NuTemplateEditor/NuTemplateStream.h b/NuTemplateEditor/NuTemplateStream.h deleted file mode 100644 index 70e808a..0000000 --- a/NuTemplateEditor/NuTemplateStream.h +++ /dev/null @@ -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 - - -@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 diff --git a/NuTemplateEditor/NuTemplateStream.m b/NuTemplateEditor/NuTemplateStream.m deleted file mode 100644 index 2b8bdff..0000000 --- a/NuTemplateEditor/NuTemplateStream.m +++ /dev/null @@ -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 diff --git a/NuTemplateEditor/NuTemplateTNAMElement.h b/NuTemplateEditor/NuTemplateTNAMElement.h deleted file mode 100644 index d1d9503..0000000 --- a/NuTemplateEditor/NuTemplateTNAMElement.h +++ /dev/null @@ -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 diff --git a/NuTemplateEditor/NuTemplateTNAMElement.m b/NuTemplateEditor/NuTemplateTNAMElement.m deleted file mode 100644 index 352dc86..0000000 --- a/NuTemplateEditor/NuTemplateTNAMElement.m +++ /dev/null @@ -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 diff --git a/NuTemplateEditor/NuTemplateWindowController.h b/NuTemplateEditor/NuTemplateWindowController.h deleted file mode 100644 index b10d04c..0000000 --- a/NuTemplateEditor/NuTemplateWindowController.h +++ /dev/null @@ -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 -#import "ResKnifePluginProtocol.h" -#import "ResKnifeResourceProtocol.h" - - -/* ----------------------------------------------------------------------------- - Interface: - -------------------------------------------------------------------------- */ - -@interface NuTemplateWindowController : NSWindowController -{ - 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 resource; // The resource we operate on. - NSMenuItem* createFieldItem; // "Create Resource" menu item we usurp to create list items. -} - --(void) readTemplate: (id )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 diff --git a/NuTemplateEditor/NuTemplateWindowController.m b/NuTemplateEditor/NuTemplateWindowController.m deleted file mode 100644 index 1008202..0000000 --- a/NuTemplateEditor/NuTemplateWindowController.m +++ /dev/null @@ -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 )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 diff --git a/ResKnife.xcodeproj/project.pbxproj b/ResKnife.xcodeproj/project.pbxproj index 7950731..2fb4e63 100644 --- a/ResKnife.xcodeproj/project.pbxproj +++ b/ResKnife.xcodeproj/project.pbxproj @@ -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 = ""; }; - 3D0933A704DEFEE600DD74B1 /* NuTemplateElement.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NuTemplateElement.m; sourceTree = ""; }; - 3D0933BA04DF10D700DD74B1 /* NuTemplateGroupElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NuTemplateGroupElement.h; sourceTree = ""; }; - 3D0933BB04DF10D700DD74B1 /* NuTemplateGroupElement.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NuTemplateGroupElement.m; sourceTree = ""; }; - 3D0933BE04DF151C00DD74B1 /* NuTemplateStream.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NuTemplateStream.h; sourceTree = ""; }; - 3D0933BF04DF151C00DD74B1 /* NuTemplateStream.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NuTemplateStream.m; sourceTree = ""; }; - 3D0933C404DF1C0800DD74B1 /* NuTemplateLSTBElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NuTemplateLSTBElement.h; sourceTree = ""; }; - 3D0933C504DF1C0800DD74B1 /* NuTemplateLSTBElement.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NuTemplateLSTBElement.m; sourceTree = ""; }; - 3D0933E304DF2FF700DD74B1 /* NuTemplateTNAMElement.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = NuTemplateTNAMElement.h; sourceTree = ""; }; - 3D0933E404DF2FF700DD74B1 /* NuTemplateTNAMElement.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = NuTemplateTNAMElement.m; sourceTree = ""; }; - 3D0933E704DF317D00DD74B1 /* NuTemplatePSTRElement.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = NuTemplatePSTRElement.h; sourceTree = ""; }; - 3D0933E804DF317D00DD74B1 /* NuTemplatePSTRElement.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = NuTemplatePSTRElement.m; sourceTree = ""; }; - 3D0933EE04DF381900DD74B1 /* NuTemplateDWRDElement.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = NuTemplateDWRDElement.m; sourceTree = ""; }; - 3D0933EF04DF381900DD74B1 /* NuTemplateDWRDElement.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = NuTemplateDWRDElement.h; sourceTree = ""; }; 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 = ""; }; - 3D0933F704DFE80500DD74B1 /* NuTemplateLSTEElement.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = NuTemplateLSTEElement.m; sourceTree = ""; }; - 3D0ABFB904E152CA00C85300 /* Read Me.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "Read Me.txt"; sourceTree = ""; }; 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 = ""; }; - 3D0B38B304DEF41E005AED5E /* NuTemplateWindowController.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = NuTemplateWindowController.m; sourceTree = ""; }; - 3D0B38B604DEF465005AED5E /* English */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = English; path = English.lproj/NuTemplateWindow.nib; sourceTree = ""; }; - 3D2EE5E204E5C56F00515930 /* Localizable.strings */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.strings; name = Localizable.strings; path = ../Localizable.strings; sourceTree = ""; }; 3D35755A04DAEB4300B8225B /* main.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 3D35755C04DAEB6200B8225B /* RKEditorRegistry.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = RKEditorRegistry.h; sourceTree = ""; }; 3D35755D04DAEB6200B8225B /* RKEditorRegistry.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = RKEditorRegistry.m; sourceTree = ""; }; @@ -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 = ""; }; - 3D4737B404E872DB00AF65FE /* NuTemplateDLNGElement.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = NuTemplateDLNGElement.h; sourceTree = ""; }; - 3D4737B704E873F300AF65FE /* NuTemplateDBYTElement.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = NuTemplateDBYTElement.m; sourceTree = ""; }; - 3D4737B804E873F300AF65FE /* NuTemplateDBYTElement.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = NuTemplateDBYTElement.h; sourceTree = ""; }; - 3D50046F04EF040900F3B64D /* NuTemplateOCNTElement.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = NuTemplateOCNTElement.h; sourceTree = ""; }; - 3D50047004EF040900F3B64D /* NuTemplateOCNTElement.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = NuTemplateOCNTElement.m; sourceTree = ""; }; - 3D50047304EF122000F3B64D /* NuTemplateLSTCElement.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = NuTemplateLSTCElement.m; sourceTree = ""; }; - 3D50047404EF122000F3B64D /* NuTemplateLSTCElement.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = NuTemplateLSTCElement.h; sourceTree = ""; }; 3D53A9FD04F171DC006651FA /* RKSupportResourceRegistry.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RKSupportResourceRegistry.h; sourceTree = ""; }; 3D53A9FE04F171DC006651FA /* RKSupportResourceRegistry.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RKSupportResourceRegistry.m; sourceTree = ""; }; E17752320E424BAB00F737F8 /* NSData-HexRepresentation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSData-HexRepresentation.h"; sourceTree = ""; }; E17752330E424BAB00F737F8 /* NSData-HexRepresentation.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSData-HexRepresentation.m"; sourceTree = ""; }; E177526D0E424DCB00F737F8 /* OpenPanelDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OpenPanelDelegate.m; sourceTree = ""; }; E177526E0E424DCB00F737F8 /* OpenPanelDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OpenPanelDelegate.h; sourceTree = ""; }; - E17753880E4251C600F737F8 /* DisplayTMPL.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = DisplayTMPL.png; sourceTree = ""; }; - E17753890E4251C600F737F8 /* Templates.rsrc */ = {isa = PBXFileReference; lastKnownFileType = archive.rsrc; name = Templates.rsrc; path = ../Templates.rsrc; sourceTree = ""; }; - E177538A0E4251C600F737F8 /* TMPLs.rsrc */ = {isa = PBXFileReference; lastKnownFileType = archive.rsrc; name = TMPLs.rsrc; path = ../TMPLs.rsrc; sourceTree = ""; }; + E17757020E425EE200F737F8 /* Element.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Element.h; sourceTree = ""; }; + E17757030E425EE200F737F8 /* Element.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Element.m; sourceTree = ""; }; + E17757040E425EE200F737F8 /* ElementDATE.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ElementDATE.h; sourceTree = ""; }; + E17757050E425EE200F737F8 /* ElementDATE.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ElementDATE.m; sourceTree = ""; }; + E17757060E425EE200F737F8 /* ElementDBYT.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ElementDBYT.h; sourceTree = ""; }; + E17757070E425EE200F737F8 /* ElementDBYT.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ElementDBYT.m; sourceTree = ""; }; + E17757080E425EE200F737F8 /* ElementDLLG.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ElementDLLG.h; sourceTree = ""; }; + E17757090E425EE200F737F8 /* ElementDLLG.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ElementDLLG.m; sourceTree = ""; }; + E177570A0E425EE200F737F8 /* ElementDLNG.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ElementDLNG.h; sourceTree = ""; }; + E177570B0E425EE200F737F8 /* ElementDLNG.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ElementDLNG.m; sourceTree = ""; }; + E177570C0E425EE200F737F8 /* ElementDWRD.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ElementDWRD.h; sourceTree = ""; }; + E177570D0E425EE200F737F8 /* ElementDWRD.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ElementDWRD.m; sourceTree = ""; }; + E177570E0E425EE200F737F8 /* ElementFBYT.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ElementFBYT.h; sourceTree = ""; }; + E177570F0E425EE200F737F8 /* ElementFBYT.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ElementFBYT.m; sourceTree = ""; }; + E17757100E425EE200F737F8 /* ElementFIXD.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ElementFIXD.h; sourceTree = ""; }; + E17757110E425EE200F737F8 /* ElementFIXD.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ElementFIXD.m; sourceTree = ""; }; + E17757120E425EE200F737F8 /* ElementFRAC.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ElementFRAC.h; sourceTree = ""; }; + E17757130E425EE200F737F8 /* ElementFRAC.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ElementFRAC.m; sourceTree = ""; }; + E17757140E425EE200F737F8 /* ElementHEXD.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ElementHEXD.h; sourceTree = ""; }; + E17757150E425EE200F737F8 /* ElementHEXD.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ElementHEXD.m; sourceTree = ""; }; + E17757160E425EE200F737F8 /* ElementKEYB.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ElementKEYB.h; sourceTree = ""; }; + E17757170E425EE200F737F8 /* ElementKEYB.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ElementKEYB.mm; sourceTree = ""; }; + E17757180E425EE200F737F8 /* ElementLSTB.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ElementLSTB.h; sourceTree = ""; }; + E17757190E425EE200F737F8 /* ElementLSTB.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ElementLSTB.mm; sourceTree = ""; }; + E177571A0E425EE200F737F8 /* ElementLSTC.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ElementLSTC.h; sourceTree = ""; }; + E177571B0E425EE200F737F8 /* ElementLSTC.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ElementLSTC.mm; sourceTree = ""; }; + E177571C0E425EE200F737F8 /* ElementLSTE.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ElementLSTE.h; sourceTree = ""; }; + E177571D0E425EE200F737F8 /* ElementLSTE.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ElementLSTE.m; sourceTree = ""; }; + E177571E0E425EE200F737F8 /* ElementOCNT.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ElementOCNT.h; sourceTree = ""; }; + E177571F0E425EE200F737F8 /* ElementOCNT.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ElementOCNT.m; sourceTree = ""; }; + E17757200E425EE200F737F8 /* ElementPSTR.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ElementPSTR.h; sourceTree = ""; }; + E17757210E425EE200F737F8 /* ElementPSTR.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ElementPSTR.m; sourceTree = ""; }; + E17757220E425EE200F737F8 /* ElementUBYT.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ElementUBYT.h; sourceTree = ""; }; + E17757230E425EE200F737F8 /* ElementUBYT.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ElementUBYT.m; sourceTree = ""; }; + E17757240E425EE200F737F8 /* ElementULLG.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ElementULLG.h; sourceTree = ""; }; + E17757250E425EE200F737F8 /* ElementULLG.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ElementULLG.m; sourceTree = ""; }; + E17757260E425EE200F737F8 /* ElementULNG.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ElementULNG.h; sourceTree = ""; }; + E17757270E425EE200F737F8 /* ElementULNG.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ElementULNG.m; sourceTree = ""; }; + E17757280E425EE200F737F8 /* ElementUWRD.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ElementUWRD.h; sourceTree = ""; }; + E17757290E425EE200F737F8 /* ElementUWRD.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ElementUWRD.m; sourceTree = ""; }; + E177572B0E425EE200F737F8 /* English */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.strings; name = English; path = English.lproj/Localizable.strings; sourceTree = ""; }; + E177572D0E425EE200F737F8 /* English */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = English; path = English.lproj/TemplateWindow.nib; sourceTree = ""; }; + E177572E0E425EE200F737F8 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = Info.plist; path = ../Info.plist; sourceTree = ""; }; + E177572F0E425EE200F737F8 /* Read Me.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "Read Me.txt"; sourceTree = ""; }; + E17757310E425EE200F737F8 /* DisplayTMPL.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = DisplayTMPL.png; sourceTree = ""; }; + E17757320E425EE200F737F8 /* Templates.rsrc */ = {isa = PBXFileReference; lastKnownFileType = archive.rsrc; path = Templates.rsrc; sourceTree = ""; }; + E17757330E425EE200F737F8 /* TemplateStream.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TemplateStream.h; sourceTree = ""; }; + E17757340E425EE200F737F8 /* TemplateStream.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TemplateStream.m; sourceTree = ""; }; + E17757350E425EE200F737F8 /* TemplateWindowController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TemplateWindowController.h; sourceTree = ""; }; + E17757360E425EE200F737F8 /* TemplateWindowController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TemplateWindowController.m; sourceTree = ""; }; + E17757370E425EE200F737F8 /* TMPLs.rsrc */ = {isa = PBXFileReference; lastKnownFileType = archive.rsrc; path = TMPLs.rsrc; sourceTree = ""; }; E1B2A43B0E41103700A72928 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; name = Info.plist; path = "../Plug-Ins/Hex Editor/Info.plist"; sourceTree = ""; }; 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 = ""; }; @@ -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 = ""; }; 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 = ""; }; 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 = ""; }; @@ -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 = ""; - }; - 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 = ""; }; - 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 = ""; + }; + E17757300E425EE200F737F8 /* Resources */ = { + isa = PBXGroup; + children = ( + E177572A0E425EE200F737F8 /* Localizable.strings */, + E177572C0E425EE200F737F8 /* TemplateWindow.nib */, + E177572E0E425EE200F737F8 /* Info.plist */, + E17757310E425EE200F737F8 /* DisplayTMPL.png */, ); path = Resources; sourceTree = ""; }; + 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 = ""; + }; 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 = ""; - }; 3D3B99BC04DC16FC0056861E /* ICONWindow.nib */ = { isa = PBXVariantGroup; children = ( @@ -2092,6 +2138,24 @@ name = ICONWindow.nib; sourceTree = ""; }; + E177572A0E425EE200F737F8 /* Localizable.strings */ = { + isa = PBXVariantGroup; + children = ( + E177572B0E425EE200F737F8 /* English */, + ); + name = Localizable.strings; + path = ..; + sourceTree = ""; + }; + E177572C0E425EE200F737F8 /* TemplateWindow.nib */ = { + isa = PBXVariantGroup; + children = ( + E177572D0E425EE200F737F8 /* English */, + ); + name = TemplateWindow.nib; + path = ..; + sourceTree = ""; + }; 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 = (