2001-10-19 19:41:13 +00:00
# import "ResourceDocument.h"
# import "Resource.h"
2002-02-07 03:45:43 +00:00
# import "ResourceNameCell.h"
# import "CreateResourceSheetController.h"
2001-10-19 19:41:13 +00:00
2002-02-07 20:33:31 +00:00
# import "ResKnifePluginProtocol.h"
2001-10-19 19:41:13 +00:00
@ implementation ResourceDocument
- ( id ) init
{
self = [ super init ] ;
2002-02-02 11:31:28 +00:00
resources = [ [ NSMutableArray alloc ] init ] ;
2001-10-19 19:41:13 +00:00
otherFork = nil ;
return self ;
}
- ( void ) dealloc
{
if ( otherFork )
DisposePtr ( ( Ptr ) otherFork ) ;
[ resources release ] ;
[ super dealloc ] ;
}
2002-02-06 20:57:56 +00:00
/ * WINDOW DELEGATION * /
2002-02-07 03:45:43 +00:00
# pragma mark -
2002-02-06 20:57:56 +00:00
2001-10-19 19:41:13 +00:00
- ( NSString * ) windowNibName
{
// Override returning the nib file name of the document
// If you need to use a subclass of NSWindowController or if your document supports multiple NSWindowControllers , you should remove this method and override - makeWindowControllers instead .
return @ "ResourceDocument" ;
}
2002-02-02 11:31:28 +00:00
- ( void ) windowControllerDidLoadNib : ( NSWindowController * ) controller
2001-10-19 19:41:13 +00:00
{
2002-02-07 03:45:43 +00:00
[ super windowControllerDidLoadNib : controller ] ;
2002-02-06 20:57:56 +00:00
[ self setupToolbar : controller ] ;
2002-02-07 03:45:43 +00:00
{ // set up first column in outline view to display images as well as text
ResourceNameCell * resourceNameCell = [ [ [ ResourceNameCell alloc ] init ] autorelease ] ;
[ resourceNameCell setEditable : YES ] ;
[ [ outlineView tableColumnWithIdentifier : @ "name" ] setDataCell : resourceNameCell ] ;
}
2002-02-11 01:22:17 +00:00
// [ [ controller window ] setResizeIncrements : NSMakeSize ( 1 , 18 ) ] ;
2002-02-02 11:31:28 +00:00
// [ controller setDocumet : self ] ;
2001-10-19 19:41:13 +00:00
[ dataSource setResources : resources ] ;
}
- ( BOOL ) keepBackupFile
{
2002-02-07 03:45:43 +00:00
return [ [ NSUserDefaults standardUserDefaults ] boolForKey : @ "PreserveBackups" ] ;
2001-10-19 19:41:13 +00:00
}
- ( BOOL ) windowShouldClose : ( NSWindow * ) sender
{
NSString * file = [ [ [ sender representedFilename ] lastPathComponent ] stringByDeletingPathExtension ] ;
if ( [ file isEqualToString : @ "" ] ) file = @ "this document" ;
2002-02-11 01:22:17 +00:00
NSBeginAlertSheet ( @ "Save Document?" , @ "Save" , @ "Don<6F> t Save" , @ "Cancel" , sender , self , @ selector ( didEndShouldCloseSheet : returnCode : contextInfo : ) , NULL , sender , @ "Do you wish to save %@?" , file ) ;
2001-10-19 19:41:13 +00:00
return NO ;
}
- ( void ) didEndShouldCloseSheet : ( NSWindow * ) sheet returnCode : ( int ) returnCode contextInfo : ( void * ) contextInfo
{
if ( returnCode = = NSAlertDefaultReturn ) // save then close
{
[ self saveDocument : contextInfo ] ;
[ ( NSWindow * ) contextInfo close ] ;
}
2002-02-11 01:22:17 +00:00
else if ( returnCode = = NSAlertAlternateReturn ) // don ' t save , just close
2001-10-19 19:41:13 +00:00
{
[ ( NSWindow * ) contextInfo close ] ;
}
else if ( returnCode = = NSAlertErrorReturn )
{
NSLog ( @ "didEndShouldCloseSheet received NSAlertErrorReturn return code" ) ;
}
2002-02-11 01:22:17 +00:00
// else returnCode = = NSAlertOtherReturn , cancel
2001-10-19 19:41:13 +00:00
}
2002-02-06 20:57:56 +00:00
/ * TOOLBAR MANAGMENT * /
2002-02-07 03:45:43 +00:00
# pragma mark -
2002-02-06 20:57:56 +00:00
2002-02-11 01:22:17 +00:00
static NSString * RKToolbarIdentifier = @ "com.nickshanks.resknife.toolbar" ;
static NSString * RKCreateItemIdentifier = @ "com.nickshanks.resknife.toolbar.create" ;
static NSString * RKDeleteItemIdentifier = @ "com.nickshanks.resknife.toolbar.delete" ;
static NSString * RKEditItemIdentifier = @ "com.nickshanks.resknife.toolbar.edit" ;
static NSString * RKEditHexItemIdentifier = @ "com.nickshanks.resknife.toolbar.edithex" ;
static NSString * RKSaveItemIdentifier = @ "com.nickshanks.resknife.toolbar.save" ;
static NSString * RKShowInfoItemIdentifier = @ "com.nickshanks.resknife.toolbar.showinfo" ;
2002-02-06 20:57:56 +00:00
- ( void ) setupToolbar : ( NSWindowController * ) controller
{
/ * This routine should become invalid once toolbars are integrated into nib files * /
NSToolbar * toolbar = [ [ [ NSToolbar alloc ] initWithIdentifier : RKToolbarIdentifier ] autorelease ] ;
// set toolbar properties
[ toolbar setVisible : NO ] ;
[ toolbar setAutosavesConfiguration : YES ] ;
[ toolbar setAllowsUserCustomization : YES ] ;
[ toolbar setDisplayMode : NSToolbarDisplayModeDefault ] ;
// attach toolbar to window
[ toolbar setDelegate : self ] ;
[ [ controller window ] setToolbar : toolbar ] ;
}
- ( NSToolbarItem * ) toolbar : ( NSToolbar * ) toolbar itemForItemIdentifier : ( NSString * ) itemIdentifier willBeInsertedIntoToolbar : ( BOOL ) flag
{
2002-02-07 03:45:43 +00:00
NSToolbarItem * item = [ [ [ NSToolbarItem alloc ] initWithItemIdentifier : itemIdentifier ] autorelease ] ;
if ( [ itemIdentifier isEqual : RKCreateItemIdentifier ] )
{
[ item setLabel : @ "Create" ] ;
[ item setPaletteLabel : @ "Create" ] ;
[ item setToolTip : @ "Create New Resource" ] ;
[ item setImage : [ NSImage imageNamed : @ "Create" ] ] ;
[ item setTarget : self ] ;
[ item setAction : @ selector ( showCreateResourceSheet : ) ] ;
return item ;
}
else if ( [ itemIdentifier isEqual : RKDeleteItemIdentifier ] )
{
[ item setLabel : @ "Delete" ] ;
[ item setPaletteLabel : @ "Delete" ] ;
[ item setToolTip : @ "Delete Selected Resource" ] ;
[ item setImage : [ NSImage imageNamed : @ "Delete" ] ] ;
2002-02-07 07:37:51 +00:00
[ item setTarget : outlineView ] ;
2002-02-07 03:45:43 +00:00
[ item setAction : @ selector ( clear : ) ] ;
return item ;
}
else if ( [ itemIdentifier isEqual : RKEditItemIdentifier ] )
{
[ item setLabel : @ "Edit" ] ;
[ item setPaletteLabel : @ "Edit" ] ;
[ item setToolTip : @ "Edit Resource In Default Editor" ] ;
[ item setImage : [ NSImage imageNamed : @ "Edit" ] ] ;
[ item setTarget : self ] ;
[ item setAction : @ selector ( openResource : ) ] ;
return item ;
}
else if ( [ itemIdentifier isEqual : RKEditHexItemIdentifier ] )
{
[ item setLabel : @ "Edit Hex" ] ;
[ item setPaletteLabel : @ "Edit Hex" ] ;
[ item setToolTip : @ "Edit Resource As Hexadecimal" ] ;
[ item setImage : [ NSImage imageNamed : @ "Edit Hex" ] ] ;
[ item setTarget : self ] ;
[ item setAction : @ selector ( openResourceAsHex : ) ] ;
return item ;
}
else if ( [ itemIdentifier isEqual : RKSaveItemIdentifier ] )
2002-02-06 20:57:56 +00:00
{
[ item setLabel : @ "Save" ] ;
[ item setPaletteLabel : @ "Save" ] ;
2002-02-07 03:45:43 +00:00
[ item setToolTip : [ NSString stringWithFormat : @ "Save To %@ Fork" , ! otherFork ? @ "Data" : @ "Resource" ] ] ;
2002-02-06 20:57:56 +00:00
[ item setImage : [ NSImage imageNamed : @ "Save" ] ] ;
[ item setTarget : self ] ;
[ item setAction : @ selector ( saveDocument : ) ] ;
return item ;
}
2002-02-07 03:45:43 +00:00
else if ( [ itemIdentifier isEqual : RKShowInfoItemIdentifier ] )
{
[ item setLabel : @ "Show Info" ] ;
[ item setPaletteLabel : @ "Show Info" ] ;
[ item setToolTip : @ "Show Resource Information Window" ] ;
[ item setImage : [ NSImage imageNamed : @ "Show Info" ] ] ;
[ item setTarget : [ NSApp delegate ] ] ;
[ item setAction : @ selector ( showInfo : ) ] ;
return item ;
}
2002-02-06 20:57:56 +00:00
else return nil ;
2002-02-07 03:45:43 +00:00
/ * if ( [ itemIdent isEqual : SearchDocToolbarItemIdentifier ] ) {
2002-02-06 20:57:56 +00:00
NSMenu * submenu = nil ;
NSMenuItem * submenuItem = nil , * menuFormRep = nil ;
// Set up the standard properties
[ toolbarItem setLabel : @ "Search" ] ;
[ toolbarItem setPaletteLabel : @ "Search" ] ;
[ toolbarItem setToolTip : @ "Search Your Document" ] ;
// Use a custom view , a text field , for the search item
[ toolbarItem setView : searchFieldOutlet ] ;
[ toolbarItem setMinSize : NSMakeSize ( 30 , NSHeight ( [ searchFieldOutlet frame ] ) ) ] ;
[ toolbarItem setMaxSize : NSMakeSize ( 400 , NSHeight ( [ searchFieldOutlet frame ] ) ) ] ;
// By default , in text only mode , a custom items label will be shown as disabled text , but you can provide a
// custom menu of your own by using < item > setMenuFormRepresentation ]
submenu = [ [ [ NSMenu alloc ] init ] autorelease ] ;
submenuItem = [ [ [ NSMenuItem alloc ] initWithTitle : @ "Search Panel" action : @ selector ( searchUsingSearchPanel : ) keyEquivalent : @ "" ] autorelease ] ;
menuFormRep = [ [ [ NSMenuItem alloc ] init ] autorelease ] ;
[ submenu addItem : submenuItem ] ;
[ submenuItem setTarget : self ] ;
[ menuFormRep setSubmenu : submenu ] ;
[ menuFormRep setTitle : [ toolbarItem label ] ] ;
[ toolbarItem setMenuFormRepresentation : menuFormRep ] ;
} else {
// itemIdent refered to a toolbar item that is not provide or supported by us or cocoa
// Returning nil will inform the toolbar self kind of item is not supported
toolbarItem = nil ;
}
2002-02-07 03:45:43 +00:00
return toolbarItem ; * /
2002-02-06 20:57:56 +00:00
}
- ( NSArray * ) toolbarDefaultItemIdentifiers : ( NSToolbar * ) toolbar
{
2002-02-07 03:45:43 +00:00
return [ NSArray arrayWithObjects : RKCreateItemIdentifier , RKEditItemIdentifier , RKEditHexItemIdentifier , NSToolbarSeparatorItemIdentifier , RKSaveItemIdentifier , NSToolbarPrintItemIdentifier , NSToolbarFlexibleSpaceItemIdentifier , NSToolbarCustomizeToolbarItemIdentifier , nil ] ;
2002-02-06 20:57:56 +00:00
}
- ( NSArray * ) toolbarAllowedItemIdentifiers : ( NSToolbar * ) toolbar
{
2002-02-07 03:45:43 +00:00
return [ NSArray arrayWithObjects : RKCreateItemIdentifier , RKDeleteItemIdentifier , RKEditItemIdentifier , RKEditHexItemIdentifier , RKSaveItemIdentifier , RKShowInfoItemIdentifier , NSToolbarPrintItemIdentifier , NSToolbarCustomizeToolbarItemIdentifier , NSToolbarFlexibleSpaceItemIdentifier , NSToolbarSpaceItemIdentifier , NSToolbarSeparatorItemIdentifier , nil ] ;
2002-02-06 20:57:56 +00:00
}
2002-02-07 03:45:43 +00:00
- ( BOOL ) validateToolbarItem : ( NSToolbarItem * ) item
{
BOOL valid = NO ;
NSString * identifier = [ item itemIdentifier ] ;
if ( [ identifier isEqual : RKCreateItemIdentifier ] ) valid = YES ;
2002-02-07 07:37:51 +00:00
// else if ( [ identifier isEqual : RKDeleteItemIdentifier ] ) valid = [ outlineView numberOfSelectedRows ] ? YES : NO ;
2002-02-07 03:45:43 +00:00
else if ( [ identifier isEqual : RKEditItemIdentifier ] ) valid = NO ;
else if ( [ identifier isEqual : RKEditHexItemIdentifier ] ) valid = [ outlineView numberOfSelectedRows ] ? YES : NO ;
else if ( [ identifier isEqual : RKSaveItemIdentifier ] ) valid = [ self isDocumentEdited ] ;
else if ( [ identifier isEqual : NSToolbarPrintItemIdentifier ] ) valid = YES ;
return valid ;
}
2002-02-06 20:57:56 +00:00
/ *
- ( void ) toolbarWillAddItem : ( NSNotification * ) notif {
// Optional delegate method Before an new item is added to the toolbar , self notification is posted
// self is the best place to notice a new item is going into the toolbar For instance , if you need to
// cache a reference to the toolbar item or need to set up some initial state , self is the best place
// to do it The notification object is the toolbar to which the item is being added The item being
// added is found by referencing the @ "item" key in the userInfo
NSToolbarItem * addedItem = [ [ notif userInfo ] objectForKey : @ "item" ] ;
if ( [ [ addedItem itemIdentifier ] isEqual : SearchDocToolbarItemIdentifier ] ) {
activeSearchItem = [ addedItem retain ] ;
[ activeSearchItem setTarget : self ] ;
[ activeSearchItem setAction : @ selector ( searchUsingToolbarTextField : ) ] ;
} else if ( [ [ addedItem itemIdentifier ] isEqual : NSToolbarPrintItemIdentifier ] ) {
[ addedItem setToolTip : @ "Print Your Document" ] ;
[ addedItem setTarget : self ] ;
}
}
- ( void ) toolbarDidRemoveItem : ( NSNotification * ) notif {
// Optional delegate method After an item is removed from a toolbar the notification is sent self allows
// the chance to tear down information related to the item that may have been cached The notification object
// is the toolbar to which the item is being added The item being added is found by referencing the @ "item"
// key in the userInfo
NSToolbarItem * removedItem = [ [ notif userInfo ] objectForKey : @ "item" ] ;
if ( removedItem = = activeSearchItem ) {
[ activeSearchItem autorelease ] ;
activeSearchItem = nil ;
}
}
2002-02-07 03:45:43 +00:00
* /
/ * DOCUMENT MANAGEMENT * /
# pragma mark -
- ( IBAction ) showCreateResourceSheet : ( id ) sender
{
[ [ dataSource createResourceSheetController ] showCreateResourceSheet : self ] ;
}
2002-02-11 01:22:17 +00:00
2002-02-07 03:45:43 +00:00
- ( IBAction ) openResource : ( id ) sender
{
if ( NO ) ;
else [ self openResourceAsHex : sender ] ;
}
2002-02-11 01:22:17 +00:00
2002-02-07 03:45:43 +00:00
- ( IBAction ) openResourceAsHex : ( id ) sender
{
2002-02-07 20:33:31 +00:00
NSBundle * hexEditor = [ NSBundle bundleWithPath : [ [ [ NSBundle mainBundle ] builtInPlugInsPath ] stringByAppendingPathComponent : @ "Hexadecimal Editor.plugin" ] ] ;
2002-02-07 03:45:43 +00:00
Resource * resource = [ outlineView itemAtRow : [ outlineView selectedRow ] ] ;
2002-02-11 01:22:17 +00:00
// bug : I alloc a plug instance here , but have no idea where I should dealloc it , perhaps the plug ought to call [ self autorelease ] when it ' s last window is closed ?
2002-02-07 20:33:31 +00:00
[ ( id < ResKnifePluginProtocol > ) [ [ hexEditor principalClass ] alloc ] initWithResource : resource ] ;
2002-02-07 03:45:43 +00:00
}
2002-02-11 01:22:17 +00:00
2002-02-07 03:45:43 +00:00
- ( IBAction ) playSound : ( id ) sender
{
}
2002-02-11 01:22:17 +00:00
2002-02-06 20:57:56 +00:00
/ * FILE HANDLING * /
2002-02-07 03:45:43 +00:00
# pragma mark -
2002-02-06 20:57:56 +00:00
2001-10-19 19:41:13 +00:00
- ( BOOL ) readFromFile : ( NSString * ) fileName ofType : ( NSString * ) type
{
BOOL succeeded = NO ;
OSStatus error = noErr ;
HFSUniStr255 * resourceForkName = ( HFSUniStr255 * ) NewPtrClear ( sizeof ( HFSUniStr255 ) ) ;
FSRef * fileRef = ( FSRef * ) NewPtrClear ( sizeof ( FSRef ) ) ;
SInt16 fileRefNum = 0 ;
// open fork with resources in it
error = FSPathMakeRef ( [ fileName cString ] , fileRef , nil ) ;
error = FSGetResourceForkName ( resourceForkName ) ;
SetResLoad ( false ) ; // don ' t load "preload" resources
error = FSOpenResourceFile ( fileRef , resourceForkName -> length , ( UniChar * ) & resourceForkName -> unicode , fsRdPerm , & fileRefNum ) ;
if ( error ) // try to open data fork instead
error = FSOpenResourceFile ( fileRef , 0 , nil , fsRdPerm , & fileRefNum ) ;
else otherFork = resourceForkName ;
SetResLoad ( true ) ; // restore resource loading as soon as is possible
// read the resources
if ( fileRefNum && ! error )
succeeded = [ self readResourceMap : fileRefNum ] ;
// tidy up loose ends
if ( ! otherFork ) DisposePtr ( ( Ptr ) resourceForkName ) ; // only delete if we ' re not saving it
if ( fileRefNum ) FSClose ( fileRefNum ) ;
DisposePtr ( ( Ptr ) fileRef ) ;
return succeeded ;
}
- ( BOOL ) readResourceMap : ( SInt16 ) fileRefNum
{
OSStatus error = noErr ;
unsigned short i , j , n ;
SInt16 oldResFile = CurResFile ( ) ;
UseResFile ( fileRefNum ) ;
for ( i = 1 ; i <= Count1Types ( ) ; i + + )
{
ResType resType ;
Get1IndType ( & resType , i ) ;
n = Count1Resources ( resType ) ;
for ( j = 1 ; j <= n ; j + + )
{
Str255 nameStr ;
long sizeLong ;
short resIDShort ;
short attrsShort ;
Handle resourceHandle ;
resourceHandle = Get1IndResource ( resType , j ) ;
error = ResError ( ) ;
if ( error ! = noErr )
{
UseResFile ( oldResFile ) ;
return NO ;
}
GetResInfo ( resourceHandle , & resIDShort , & resType , nameStr ) ;
sizeLong = GetResourceSizeOnDisk ( resourceHandle ) ;
attrsShort = GetResAttrs ( resourceHandle ) ;
HLockHi ( resourceHandle ) ;
2002-02-02 11:31:28 +00:00
// create the resource & add it to the array
2001-10-19 19:41:13 +00:00
{
NSString * name = [ NSString stringWithCString : & nameStr [ 1 ] length : nameStr [ 0 ] ] ;
NSString * type = [ NSString stringWithCString : ( char * ) & resType length : 4 ] ;
NSNumber * size = [ NSNumber numberWithLong : sizeLong ] ;
NSNumber * resID = [ NSNumber numberWithShort : resIDShort ] ;
NSNumber * attributes = [ NSNumber numberWithShort : attrsShort ] ;
NSData * data = [ NSData dataWithBytes : * resourceHandle length : sizeLong ] ;
Resource * resource = [ Resource resourceOfType : type andID : resID withName : name andAttributes : attributes data : data ofLength : size ] ;
2002-02-02 11:31:28 +00:00
[ resources addObject : resource ] ; // array retains resource
2001-10-19 19:41:13 +00:00
}
HUnlock ( resourceHandle ) ;
ReleaseResource ( resourceHandle ) ;
}
}
// save resource map and clean up
UseResFile ( oldResFile ) ;
return YES ;
}
- ( BOOL ) writeToFile : ( NSString * ) fileName ofType : ( NSString * ) type
{
BOOL succeeded = NO ;
OSStatus error = noErr ;
FSRef * parentRef = ( FSRef * ) NewPtrClear ( sizeof ( FSRef ) ) ;
FSRef * fileRef = ( FSRef * ) NewPtrClear ( sizeof ( FSRef ) ) ;
FSSpec * fileSpec = ( FSSpec * ) NewPtrClear ( sizeof ( FSSpec ) ) ;
SInt16 fileRefNum = 0 ;
// create and open file for writing
error = FSPathMakeRef ( [ [ fileName stringByDeletingLastPathComponent ] cString ] , parentRef , nil ) ;
if ( otherFork )
{
unichar * uniname = ( unichar * ) NewPtrClear ( sizeof ( unichar ) * 256 ) ;
[ [ fileName lastPathComponent ] getCharacters : uniname ] ;
error = FSCreateResourceFile ( parentRef , [ [ fileName lastPathComponent ] length ] , ( UniChar * ) uniname , kFSCatInfoNone , nil , otherFork -> length , ( UniChar * ) & otherFork -> unicode , fileRef , fileSpec ) ;
if ( ! error )
error = FSOpenResourceFile ( fileRef , otherFork -> length , ( UniChar * ) & otherFork -> unicode , fsWrPerm , & fileRefNum ) ;
}
else
{
unichar * uniname = ( unichar * ) NewPtrClear ( sizeof ( unichar ) * 256 ) ;
[ [ fileName lastPathComponent ] getCharacters : uniname ] ;
error = FSCreateResourceFile ( parentRef , [ [ fileName lastPathComponent ] length ] , ( UniChar * ) uniname , kFSCatInfoNone , nil , 0 , nil , fileRef , fileSpec ) ;
if ( ! error )
error = FSOpenResourceFile ( fileRef , 0 , nil , fsWrPerm , & fileRefNum ) ;
}
// write resource array to file
if ( fileRefNum && ! error )
succeeded = [ self writeResourceMap : fileRefNum ] ;
// tidy up loose ends
if ( fileRefNum ) FSClose ( fileRefNum ) ;
DisposePtr ( ( Ptr ) fileRef ) ;
return succeeded ;
}
- ( BOOL ) writeResourceMap : ( SInt16 ) fileRefNum
{
OSStatus error = noErr ;
unsigned long i ;
SInt16 oldResFile = CurResFile ( ) ;
UseResFile ( fileRefNum ) ;
for ( i = 0 ; i < [ resources count ] ; i + + )
{
Resource * resource = [ resources objectAtIndex : i ] ;
Str255 nameStr ;
ResType resType ;
short resIDShort = [ [ resource resID ] shortValue ] ;
long sizeLong = [ [ resource size ] longValue ] ;
short attrsShort = [ [ resource attributes ] shortValue ] ;
Handle resourceHandle = NewHandleClear ( sizeLong ) ;
nameStr [ 0 ] = [ [ resource name ] cStringLength ] ;
BlockMoveData ( [ [ resource name ] cString ] , & nameStr [ 1 ] , nameStr [ 0 ] ) ;
[ [ resource type ] getCString : ( char * ) & resType maxLength : 4 ] ;
HLockHi ( resourceHandle ) ;
[ [ resource data ] getBytes : * resourceHandle ] ;
HUnlock ( resourceHandle ) ;
AddResource ( resourceHandle , resType , resIDShort , nameStr ) ;
if ( ResError ( ) = = addResFailed )
{
2002-02-02 11:31:28 +00:00
NSLog ( @ "*Saving failed*; could not add resource \" % @ \ " of type %@ to file." , [ resource name ] , [ resource type ] ) ;
2001-10-19 19:41:13 +00:00
error = addResFailed ;
}
else
{
2002-02-02 11:31:28 +00:00
NSLog ( @ "Added resource %@, \" % @ \ ", of type %@ to file." , [ resource resID ] , [ resource name ] , [ resource type ] ) ;
2001-10-19 19:41:13 +00:00
SetResAttrs ( resourceHandle , attrsShort ) ;
ChangedResource ( resourceHandle ) ;
UpdateResFile ( fileRefNum ) ;
}
}
// save resource map and clean up
UseResFile ( oldResFile ) ;
return error ? NO : YES ;
}
2002-02-06 20:57:56 +00:00
/ * ACCESSORS * /
2002-02-07 03:45:43 +00:00
# pragma mark -
2002-02-06 20:57:56 +00:00
2001-10-19 19:41:13 +00:00
- ( NSOutlineView * ) outlineView
{
return outlineView ;
}
- ( ResourceDataSource * ) dataSource
{
return dataSource ;
}
@ end