Improved attachObject:toParent: and implemented more of the resource manager.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/apps/gorm/trunk@21080 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Gregory John Casamento 2005-04-10 22:21:59 +00:00
parent 3a84a68109
commit 660c9fd7ad
9 changed files with 212 additions and 160 deletions

View file

@ -1,3 +1,18 @@
2005-04-10 18:13 Gregory John Casamento <greg_casamento@yahoo.com>
* GormCore/GormDocument.h: Organized methods.
* GormCore/GormDocument.m: Added code here to add to top
level objects array, when appropriate.
* GormCore/GormGenericEditor.m: Prevent close when already
closed.
* GormCore/GormObjectEditor.m: Removed code which adds
to document/top level objects, this is done in the document now.
* GormCore/GormPrivate.h: Added new ivar to GormGenericEditor
* GormLib/IBResourceManager.h
* GormLib/IBResourceManager.m: Corrected implementation of
register methods.
* Resources/ClassInformation.plist: Added Object.
2005-04-03 07:36 Gregory John Casamento <greg_casamento@yahoo.com> 2005-04-03 07:36 Gregory John Casamento <greg_casamento@yahoo.com>
* GormLib/IBResourceManager.[hm]: Implementation of this class. * GormLib/IBResourceManager.[hm]: Implementation of this class.

View file

@ -64,7 +64,7 @@
BOOL isActive; BOOL isActive;
BOOL isDocumentOpen; BOOL isDocumentOpen;
NSMenu *savedMenu; NSMenu *savedMenu;
NSMenuItem *quitItem; /* Replaced during test */ NSMenuItem *quitItem; /* Replaced during test-mode */
NSMutableArray *savedEditors; NSMutableArray *savedEditors;
NSMutableArray *hidden; NSMutableArray *hidden;
NSMutableArray *openEditors; NSMutableArray *openEditors;
@ -74,59 +74,39 @@
id filePrefsView; id filePrefsView;
id filePrefsManager; id filePrefsManager;
NSWindow *filePrefsWindow; NSWindow *filePrefsWindow;
NSMutableArray *resourceManagers;
} }
- (void) addConnector: (id<IBConnectors>)aConnector;
- (NSArray*) allConnectors; /* Archiving objects */
- (void) attachObject: (id)anObject toParent: (id)aParent;
- (void) attachObjects: (NSArray*)anArray toParent: (id)aParent;
- (void) beginArchiving; - (void) beginArchiving;
- (GormClassManager*) classManager;
- (NSArray*) connectorsForDestination: (id)destination;
- (NSArray*) connectorsForDestination: (id)destination
ofClass: (Class)aConnectorClass;
- (NSArray*) connectorsForSource: (id)source;
- (NSArray*) connectorsForSource: (id)source
ofClass: (Class)aConnectorClass;
- (BOOL) containsObject: (id)anObject;
- (BOOL) containsObjectWithName: (NSString*)aName forParent: (id)parent;
- (BOOL) copyObject: (id)anObject
type: (NSString*)aType
toPasteboard: (NSPasteboard*)aPasteboard;
- (BOOL) copyObjects: (NSArray*)anArray
type: (NSString*)aType
toPasteboard: (NSPasteboard*)aPasteboard;
- (void) detachObject: (id)anObject;
- (void) detachObjects: (NSArray*)anArray;
- (NSString*) documentPath;
- (void) endArchiving; - (void) endArchiving;
/* Handle notifications */
- (void) handleNotification: (NSNotification*)aNotification; - (void) handleNotification: (NSNotification*)aNotification;
/* Document management */
- (BOOL) isActive; - (BOOL) isActive;
- (NSString*) nameForObject: (id)anObject;
- (id) objectForName: (NSString*)aString;
- (BOOL) objectIsVisibleAtLaunch: (id)anObject; - (BOOL) objectIsVisibleAtLaunch: (id)anObject;
- (BOOL) objectIsDeferred: (id)anObject; - (BOOL) objectIsDeferred: (id)anObject;
- (NSArray*) objects;
- (id) loadDocument: (NSString*)path; - (id) loadDocument: (NSString*)path;
- (id) openDocument: (id)sender; - (id) openDocument: (id)sender;
- (id) parentOfObject: (id)anObject;
- (NSArray*) pasteType: (NSString*)aType
fromPasteboard: (NSPasteboard*)aPasteboard
parent: (id)parent;
- (void) removeConnector: (id<IBConnectors>)aConnector;
- (id) revertDocument: (id)sender; - (id) revertDocument: (id)sender;
- (BOOL) saveAsDocument: (id)sender; - (BOOL) saveAsDocument: (id)sender;
- (BOOL) saveGormDocument: (id)sender; - (BOOL) saveGormDocument: (id)sender;
- (void) setupDefaults: (NSString*)type; - (void) setupDefaults: (NSString*)type;
- (void) setDocumentActive: (BOOL)flag; - (void) setDocumentActive: (BOOL)flag;
- (void) setName: (NSString*)aName forObject: (id)object;
- (void) setObject: (id)anObject isVisibleAtLaunch: (BOOL)flag; - (void) setObject: (id)anObject isVisibleAtLaunch: (BOOL)flag;
- (void) setObject: (id)anObject isDeferred: (BOOL)flag; - (void) setObject: (id)anObject isDeferred: (BOOL)flag;
- (void) touch; /* Mark document as having been changed. */
- (NSWindow*) window; - (NSWindow*) window;
- (BOOL) couldCloseDocument; - (BOOL) couldCloseDocument;
- (BOOL) windowShouldClose: (id)sender; - (BOOL) windowShouldClose: (id)sender;
- (BOOL) isTopLevelObject: (id)obj;
- (void) closeAllEditors;
- (void) createResourceManagers;
- (NSArray *) resourceManagers;
// classes support.. /* Managing classes */
- (GormClassManager*) classManager;
- (id) createSubclass: (id)sender; - (id) createSubclass: (id)sender;
- (id) instantiateClass: (id)sender; - (id) instantiateClass: (id)sender;
- (id) createClassFiles: (id)sender; - (id) createClassFiles: (id)sender;
@ -138,11 +118,11 @@
- (BOOL) classIsSelected; - (BOOL) classIsSelected;
- (void) removeAllInstancesOfClass: (NSString *)classNamed; - (void) removeAllInstancesOfClass: (NSString *)classNamed;
// sound & image support /* Sound & Image support */
- (id) openSound: (id)sender; - (id) openSound: (id)sender;
- (id) openImage: (id)sender; - (id) openImage: (id)sender;
// Internals support /* Connections */
- (void) rebuildObjToNameMapping; - (void) rebuildObjToNameMapping;
- (BOOL) removeConnectionsWithLabel: (NSString *)name - (BOOL) removeConnectionsWithLabel: (NSString *)name
forClassNamed: (NSString *)className forClassNamed: (NSString *)className
@ -150,24 +130,24 @@
- (BOOL) removeConnectionsForClassNamed: (NSString *)name; - (BOOL) removeConnectionsForClassNamed: (NSString *)name;
- (BOOL) renameConnectionsForClassNamed: (NSString *)name - (BOOL) renameConnectionsForClassNamed: (NSString *)name
toName: (NSString *)newName; toName: (NSString *)newName;
- (BOOL) isTopLevelObject: (id)obj;
- (void) closeAllEditors;
// class loading /* class loading */
- (id) loadClass: (id)sender; - (id) loadClass: (id)sender;
// services/windows menus... /* services/windows menus... */
- (void) setServicesMenu: (NSMenu *)menu; - (void) setServicesMenu: (NSMenu *)menu;
- (NSMenu *) servicesMenu; - (NSMenu *) servicesMenu;
- (void) setWindowsMenu: (NSMenu *)menu; - (void) setWindowsMenu: (NSMenu *)menu;
- (NSMenu *) windowsMenu; - (NSMenu *) windowsMenu;
// first responder/font manager /* first responder/font manager */
- (id) fontManager; - (id) fontManager;
- (id) firstResponder; - (id) firstResponder;
// windowAndRect:forObject: is called by Gorm to determine where it should /*
// draw selection markup * windowAndRect:forObject: is called by Gorm to determine where it should
* draw selection markup
*/
- (NSWindow*) windowAndRect: (NSRect*)r forObject: (id)object; - (NSWindow*) windowAndRect: (NSRect*)r forObject: (id)object;
@end @end

View file

@ -254,6 +254,10 @@ static NSImage *fileImage = nil;
selector: @selector(handleNotification:) selector: @selector(handleNotification:)
name: IBWillEndTestingInterfaceNotification name: IBWillEndTestingInterfaceNotification
object: nil]; object: nil];
[nc addObserver: self
selector: @selector(handleNotification:)
name: IBResourceManagerRegistryDidChangeNotification
object: nil];
// objects... // objects...
mainRect.origin = NSMakePoint(0,0); mainRect.origin = NSMakePoint(0,0);
@ -379,8 +383,12 @@ static NSImage *fileImage = nil;
// are we upgrading an archive? // are we upgrading an archive?
isOlderArchive = NO; isOlderArchive = NO;
// document is open... // document is open...
isDocumentOpen = YES; isDocumentOpen = YES;
// load resource managers
[self createResourceManagers];
} }
else else
{ {
@ -451,6 +459,7 @@ static NSImage *fileImage = nil;
{ {
aParent = filesOwner; aParent = filesOwner;
} }
old = [self connectorsForSource: anObject ofClass: [NSNibConnector class]]; old = [self connectorsForSource: anObject ofClass: [NSNibConnector class]];
if ([old count] > 0) if ([old count] > 0)
{ {
@ -465,6 +474,7 @@ static NSImage *fileImage = nil;
[self addConnector: (id<IBConnectors>)con]; [self addConnector: (id<IBConnectors>)con];
RELEASE(con); RELEASE(con);
} }
/* /*
* Make sure that there is a name for this object. * Make sure that there is a name for this object.
*/ */
@ -488,6 +498,22 @@ static NSImage *fileImage = nil;
[anObject setReleasedWhenClosed: NO]; [anObject setReleasedWhenClosed: NO];
} }
} }
else if((aParent == filesOwner || aParent == nil) &&
[anObject isKindOfClass: [NSMenu class]] == NO)
{
if([anObject isKindOfClass: [NSObject class]] &&
[anObject isKindOfClass: [NSView class]] == NO)
{
[objectsView addObject: anObject];
[topLevelObjects addObject: anObject];
}
else if([anObject isKindOfClass: [NSView class]] && [anObject superview] == nil)
{
[objectsView addObject: anObject];
[topLevelObjects addObject: anObject];
}
}
/* /*
* Check if it's a font manager. * Check if it's a font manager.
*/ */
@ -497,6 +523,7 @@ static NSImage *fileImage = nil;
// the proxy instead. // the proxy instead.
[self _instantiateFontManager]; [self _instantiateFontManager];
} }
/* /*
* Add the current menu and any submenus. * Add the current menu and any submenus.
*/ */
@ -951,6 +978,10 @@ static NSImage *fileImage = nil;
// windows... // windows...
RELEASE(window); RELEASE(window);
RELEASE(filePrefsWindow); RELEASE(filePrefsWindow);
// resource managers
RELEASE(resourceManagers);
[super dealloc]; [super dealloc];
} }
@ -1508,6 +1539,15 @@ static NSImage *fileImage = nil;
[classesView selectClass: newClass]; [classesView selectClass: newClass];
} }
} }
else if([name isEqual: IBResourceManagerRegistryDidChangeNotification])
{
if(resourceManagers != nil)
{
Class cls = [aNotification object];
id mgr = [(IBResourceManager *)[cls alloc] initWithDocument: self];
[resourceManagers addObject: mgr];
}
}
} }
- (id) instantiateClass: (id)sender - (id) instantiateClass: (id)sender
@ -1555,8 +1595,8 @@ static NSImage *fileImage = nil;
// add it to the top level objects... // add it to the top level objects...
[self setName: nil forObject: instance]; [self setName: nil forObject: instance];
[self attachObject: instance toParent: nil]; [self attachObject: instance toParent: nil];
[topLevelObjects addObject: instance]; // [topLevelObjects addObject: instance];
[objectsView addObject: instance]; // [objectsView addObject: instance];
// we want to record if it's custom or not and act appropriately... // we want to record if it's custom or not and act appropriately...
if(isCustom) if(isCustom)
@ -3426,6 +3466,31 @@ static NSImage *fileImage = nil;
{ {
return fontManager; return fontManager;
} }
- (void) createResourceManagers
{
NSArray *resourceClasses = [IBResourceManager registeredResourceManagerClassesForFramework: nil];
NSEnumerator *en = [resourceClasses objectEnumerator];
Class cls = nil;
if(resourceManagers != nil)
{
// refresh...
DESTROY(resourceManagers);
}
resourceManagers = [[NSMutableArray alloc] init];
while((cls = [en nextObject]) != nil)
{
id mgr = [(IBResourceManager *)[cls alloc] initWithDocument: self];
[resourceManagers addObject: mgr];
}
}
- (NSArray *) resourceManagers
{
return resourceManagers;
}
@end @end
@implementation GormDocument (MenuValidation) @implementation GormDocument (MenuValidation)

View file

@ -113,10 +113,13 @@
- (void) close - (void) close
{ {
closed = YES; if(closed == NO)
[document editor: self didCloseForObject: [self editedObject]]; {
[self deactivate]; closed = YES;
[self closeSubeditors]; [document editor: self didCloseForObject: [self editedObject]];
[self deactivate];
[self closeSubeditors];
}
} }
// Stubbed out methods... Since this is an abstract class, some methods need to be // Stubbed out methods... Since this is an abstract class, some methods need to be
@ -137,6 +140,7 @@
document = aDocument; document = aDocument;
closed = NO; closed = NO;
activated = NO; activated = NO;
resourceManager = nil;
} }
return self; return self;
} }
@ -169,7 +173,8 @@
if(closed == NO) if(closed == NO)
[self close]; [self close];
RELEASE(objects); // RELEASE(objects);
RELEASE(resourceManager);
[super dealloc]; [super dealloc];
} }

View file

@ -90,6 +90,9 @@ static NSMapTable *docMap = 0;
docMap = NSCreateMapTable(NSObjectMapKeyCallBacks, docMap = NSCreateMapTable(NSObjectMapKeyCallBacks,
NSObjectMapValueCallBacks, NSObjectMapValueCallBacks,
2); 2);
// create the resource manager...
[IBResourceManager registerResourceManagerClass: [IBResourceManager class]];
} }
} }
@ -128,7 +131,7 @@ static NSMapTable *docMap = 0;
if (selected != nil) if (selected != nil)
{ {
[document copyObjects: [self selection] [document copyObjects: [self selection]
type: IBViewPboardType type: IBObjectPboardType
toPasteboard: [NSPasteboard generalPasteboard]]; toPasteboard: [NSPasteboard generalPasteboard]];
} }
} }
@ -158,7 +161,7 @@ static NSMapTable *docMap = 0;
[document detachObject: selected]; [document detachObject: selected];
if ([selected isKindOfClass: [NSWindow class]] == YES) if ([selected isKindOfClass: [NSWindow class]] == YES)
{ {
NSArray *subviews = allSubviews([selected contentView]); NSArray *subviews = allSubviews([(NSWindow *)selected contentView]);
[document detachObjects: subviews]; [document detachObjects: subviews];
[selected close]; [selected close];
} }
@ -428,8 +431,8 @@ static NSMapTable *docMap = 0;
if (dragType == IBObjectPboardType) if (dragType == IBObjectPboardType)
{ {
NSArray *array; NSArray *array;
NSEnumerator *enumerator; // NSEnumerator *enumerator;
id obj; // id obj;
/* /*
* Ask the document to get the dragged objects from the pasteboard and * Ask the document to get the dragged objects from the pasteboard and
@ -438,13 +441,17 @@ static NSMapTable *docMap = 0;
array = [document pasteType: IBObjectPboardType array = [document pasteType: IBObjectPboardType
fromPasteboard: dragPb fromPasteboard: dragPb
parent: [objects objectAtIndex: 0]]; parent: [objects objectAtIndex: 0]];
/*
enumerator = [array objectEnumerator]; enumerator = [array objectEnumerator];
while ((obj = [enumerator nextObject]) != nil) while ((obj = [enumerator nextObject]) != nil)
{ {
RETAIN(obj); // FIXME: This will probably leak... RETAIN(obj);
[[(GormDocument *)document topLevelObjects] addObject: obj]; [[(GormDocument *)document topLevelObjects] addObject: obj];
[self addObject: obj]; [self addObject: obj];
} }
*/
return YES; return YES;
} }
else if (dragType == GormLinkPboardType) else if (dragType == GormLinkPboardType)

View file

@ -112,6 +112,7 @@ extern NSString *GormResizeCellNotification;
NSString *dragType; NSString *dragType;
BOOL closed; BOOL closed;
BOOL activated; BOOL activated;
IBResourceManager *resourceManager;
} }
// selection methods... // selection methods...
- (void) selectObjects: (NSArray*)objects; - (void) selectObjects: (NSArray*)objects;

View file

@ -26,11 +26,12 @@
#define INCLUDED_IBRESOURCEMANAGER_H #define INCLUDED_IBRESOURCEMANAGER_H
#include <Foundation/NSObject.h> #include <Foundation/NSObject.h>
#include <Foundation/NSArray.h>
#include <InterfaceBuilder/IBProjects.h> #include <InterfaceBuilder/IBProjects.h>
#include <InterfaceBuilder/IBProjectFiles.h> #include <InterfaceBuilder/IBProjectFiles.h>
#include <InterfaceBuilder/IBDocuments.h> #include <InterfaceBuilder/IBDocuments.h>
@class NSArray, NSString, NSPasteboard, NSMutableArray; @class NSString, NSPasteboard, NSMutableArray;
/** /**
* Notification sent when a resource manager class is added to /removed from * Notification sent when a resource manager class is added to /removed from

View file

@ -23,6 +23,7 @@
*/ */
#include <InterfaceBuilder/IBResourceManager.h> #include <InterfaceBuilder/IBResourceManager.h>
#include <InterfaceBuilder/IBObjectAdditions.h>
#include <InterfaceBuilder/IBPalette.h> #include <InterfaceBuilder/IBPalette.h>
#include <Foundation/NSArchiver.h> #include <Foundation/NSArchiver.h>
#include <Foundation/NSArray.h> #include <Foundation/NSArray.h>
@ -30,19 +31,19 @@
#include <Foundation/NSMapTable.h> #include <Foundation/NSMapTable.h>
#include <Foundation/NSNotification.h> #include <Foundation/NSNotification.h>
#include <Foundation/NSString.h> #include <Foundation/NSString.h>
#include <Foundation/NSNull.h>
#include <AppKit/NSPasteboard.h> #include <AppKit/NSPasteboard.h>
/**
* Notification sent when a resource manager class is added to /removed from
* the registry.
*/
NSString *IBResourceManagerRegistryDidChangeNotification = @"IBResourceManagerRegistryDidChangeNotification"; NSString *IBResourceManagerRegistryDidChangeNotification = @"IBResourceManagerRegistryDidChangeNotification";
static NSMapTable *_resourceManagers = NULL; static NSMapTable *_resourceManagers = NULL;
@implementation IBResourceManager : NSObject @implementation IBResourceManager : NSObject
+ (void) _createTable /**
* Create the resource manager table.
*/
+ (BOOL) _createTable
{ {
if(_resourceManagers == NULL) if(_resourceManagers == NULL)
{ {
@ -50,68 +51,83 @@ static NSMapTable *_resourceManagers = NULL;
NSObjectMapValueCallBacks, NSObjectMapValueCallBacks,
2); 2);
} }
return (_resourceManagers != NULL);
} }
/** /**
* Register the given class as a resource mananger. * Add a class to the resourceManager master list of classes.
*/ */
+ (void) _addClass: (Class)managerClass
{
if([self _createTable])
{
NSMutableArray *list = NSMapGet(_resourceManagers, [NSNull null]);
if(list == nil)
{
list = [NSMutableArray array];
NSMapInsert(_resourceManagers, [NSNull null], list);
}
if([list containsObject: managerClass] == NO)
{
[list addObject: managerClass];
}
}
}
+ (void) registerResourceManagerClass: (Class)managerClass + (void) registerResourceManagerClass: (Class)managerClass
{ {
NSMutableArray *list = NSMapGet(_resourceManagers, NULL); [self _addClass: managerClass];
if(list == NULL)
{
list = [NSMutableArray array];
NSMapInsert(_resourceManagers, NULL, list);
}
[list addObject: managerClass];
// notify.
[[NSNotificationCenter defaultCenter]
postNotificationName: IBResourceManagerRegistryDidChangeNotification
object: nil];
} }
/**
* Register the given class as a resource manager for the frameworks in the array.
*/
+ (void) registerResourceManagerClass: (Class)managerClass + (void) registerResourceManagerClass: (Class)managerClass
forFrameworks: (NSArray *)frameworks forFrameworks: (NSArray *)frameworks
{ {
NSEnumerator *en = [frameworks objectEnumerator]; if([self _createTable])
NSString *fw = nil;
[self _createTable];
while((fw = [en nextObject]) != nil)
{ {
NSMutableArray *list = NSMapGet(_resourceManagers, fw); NSMutableArray *list = nil;
if(list == NULL) if(frameworks == nil)
{ {
list = [NSMutableArray array]; [self _addClass: managerClass];
NSMapInsert(_resourceManagers, fw, list);
} }
[list addObject: managerClass]; else
} {
NSEnumerator *en = [frameworks objectEnumerator];
NSString *fw = nil;
// notify // add it to all of the frameworks.
[[NSNotificationCenter defaultCenter] while((fw = [en nextObject]) != nil)
postNotificationName: IBResourceManagerRegistryDidChangeNotification {
object: nil]; list = NSMapGet(_resourceManagers, fw);
if(list == nil)
{
list = [NSMutableArray array];
NSMapInsert(_resourceManagers, fw, list);
}
if([list containsObject: managerClass] == NO)
{
[list addObject: managerClass];
}
}
// also add it to the master list.
[self _addClass: managerClass];
}
// notify
[[NSNotificationCenter defaultCenter]
postNotificationName: IBResourceManagerRegistryDidChangeNotification
object: managerClass];
}
} }
/**
* Return an array of classes for the given framework.
*/
+ (NSArray *) registeredResourceManagerClassesForFramework: (NSString *)framework + (NSArray *) registeredResourceManagerClassesForFramework: (NSString *)framework
{ {
return (NSArray *)(NSMapGet(_resourceManagers, framework)); return (NSArray *)(NSMapGet(_resourceManagers, ((framework == nil)?(void *)[NSNull null]:framework)));
} }
/**
* Returns YES, if the pasteboard contains a type the resource
* manager can accept.
*/
- (BOOL) acceptsResourcesFromPasteboard: (NSPasteboard *)pboard - (BOOL) acceptsResourcesFromPasteboard: (NSPasteboard *)pboard
{ {
NSArray *types = [pboard types]; NSArray *types = [pboard types];
@ -127,52 +143,43 @@ static NSMapTable *_resourceManagers = NULL;
return result; return result;
} }
/**
* Add an array of resources.
*/
- (void) addResources: (NSArray *)resourceList - (void) addResources: (NSArray *)resourceList
{ {
// abstract... [document attachObjects: resourceList toParent: nil];
} }
/**
* Add resoures from the pasteboard. Invokes the
* acceptsResourcesFromPasteboard: method to determine
* if the resources will be added.
*/
- (void) addResourcesFromPasteboard: (NSPasteboard *)pboard - (void) addResourcesFromPasteboard: (NSPasteboard *)pboard
{ {
// abstract... NSArray *resourcePbTypes = [self resourcePasteboardTypes];
NSString *type = nil;
NSEnumerator *en = [resourcePbTypes objectEnumerator];
while((type = [en nextObject]) != nil)
{
NSData *data = [pboard dataForType: type];
id obj = [NSUnarchiver unarchiveObjectWithData: data];
if(obj != nil)
{
[document attachObject: obj toParent: nil];
}
}
} }
/**
* Called by an external application when a file owned by
* the GUI builder is modified. Override this method in a
* subclass to take some special action.
*/
- (void) application: (NSString *) appName didModifyFileAtPath: (NSString *)path - (void) application: (NSString *) appName didModifyFileAtPath: (NSString *)path
{ {
// does nothing. // does nothing.
} }
/**
* Returns the document with which this resource manager is
* associated.
*/
- (id<IBDocuments>) document - (id<IBDocuments>) document
{ {
return document; return document;
} }
/**
* Instantiate the resource manager with the given
* document object.
*/
- (id) initWithDocument: (id<IBDocuments>)doc - (id) initWithDocument: (id<IBDocuments>)doc
{ {
if((self = [super init]) != nil) if((self = [super init]) != nil)
{ {
document = doc; document = doc; // weak connection.
} }
return self; return self;
} }
@ -186,73 +193,42 @@ static NSMapTable *_resourceManagers = NULL;
[super dealloc]; [super dealloc];
} }
/**
* Returns YES, if this resource manager is non-modifiable.
*/
- (BOOL) isReadOnly; - (BOOL) isReadOnly;
{ {
return NO; return NO;
} }
/**
* Called by an external application when the a file
* is added. Override in subclass to take action.
*/
- (void) project: (id<IBProjects>)proj didAddFile: (id<IBProjectFiles>)file - (void) project: (id<IBProjects>)proj didAddFile: (id<IBProjectFiles>)file
{ {
} }
/**
* Called by an external application when the a file
* changes localization. Override this method in a subclass
* to take some special action.
*/
- (void) project: (id<IBProjects>)proj didChangeLocalizationOfFile: (id<IBProjectFiles>)file - (void) project: (id<IBProjects>)proj didChangeLocalizationOfFile: (id<IBProjectFiles>)file
{ {
} }
/**
* Called by an external application when a file
* is removed. Override this in a subclass to take
* some special action.
*/
- (void) project: (id<IBProjects>)proj didRemoveFile: (id<IBProjectFiles>)file - (void) project: (id<IBProjects>)proj didRemoveFile: (id<IBProjectFiles>)file
{ {
// does nothing // does nothing in base implementation.
} }
/**
* Returns a list of resource file types this manager can accept. Default
* implementation returns nil.
*/
- (NSArray *) resourceFileTypes - (NSArray *) resourceFileTypes
{ {
return nil; return nil;
} }
/**
* Returns a list of pasteboard types this manager can accept. Default
* implementation returns nil.
*/
- (NSArray *) resourcePasteboardTypes - (NSArray *) resourcePasteboardTypes
{ {
return [NSArray arrayWithObjects: IBObjectPboardType, IBViewPboardType, nil]; return [NSArray arrayWithObjects: IBObjectPboardType, IBViewPboardType, nil];
} }
/**
* Returns the associated resources for the objects.
*/
- (NSArray *) resourcesForObjects: (NSArray *)objs; - (NSArray *) resourcesForObjects: (NSArray *)objs;
{ {
return nil; return nil;
} }
/**
* Writes resources to the document path.
*/
- (void) writeToDocumentPath: (NSString *)path - (void) writeToDocumentPath: (NSString *)path
{ {
// does nothing. // does nothing in base implementation.
} }
@end @end

View file

@ -586,4 +586,6 @@
); );
Super = NSResponder; Super = NSResponder;
}; };
Object = {
};
} }