mirror of
https://github.com/gnustep/apps-gorm.git
synced 2025-02-23 19:51:00 +00:00
New classes/headers, fleshed out document class, added document.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/apps/gorm/trunk@20509 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
01a4bfe708
commit
49c7adba2b
11 changed files with 812 additions and 23 deletions
13
ChangeLog
13
ChangeLog
|
@ -1,3 +1,16 @@
|
|||
2005-01-01 02:39 Gregory John Casamento <greg_casamento@yahoo.com>
|
||||
|
||||
* GormLib/GNUmakefile: Added new headers and new .m file.
|
||||
* GormLib/IBCellAdditions.h: Added include for NSCell.h
|
||||
* GormLib/IBDocuments.h: Added documentation.
|
||||
* GormLib/IBDocuments.m: Added include of IBDocuments.h to get
|
||||
string declarations.
|
||||
* GormLib/IBPalette.m: Implemented IBPaletteDocument.
|
||||
* GormLib/IBProjectFiles.h: New
|
||||
* GormLib/IBProjects.h: New
|
||||
* GormLib/IBResourceManager.[hm]: New
|
||||
* GormLib/InterfaceBuilder.h: Added new headers.
|
||||
|
||||
2004-12-31 14:29 Gregory John Casamento <greg_casamento@yahoo.com>
|
||||
|
||||
* Palettes/1Windows/GormNSWindowInspector.gorm: Added form
|
||||
|
|
|
@ -53,6 +53,9 @@ IBInspectorManager.h \
|
|||
IBObjectAdditions.h \
|
||||
IBObjectProtocol.h \
|
||||
IBPalette.h \
|
||||
IBProjects.h \
|
||||
IBProjectFiles.h \
|
||||
IBResourceManager.h \
|
||||
IBSystem.h \
|
||||
IBViewAdditions.h \
|
||||
IBViewProtocol.h \
|
||||
|
@ -70,7 +73,8 @@ IBEditors.m \
|
|||
IBInspector.m \
|
||||
IBInspectorManager.m \
|
||||
IBObjectAdditions.m \
|
||||
IBPalette.m
|
||||
IBPalette.m \
|
||||
IBResourceManager.m
|
||||
|
||||
#
|
||||
# C files
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
#ifndef INCLUDED_IBCELLADDITIONS_H
|
||||
#define INCLUDED_IBCELLADDITIONS_H
|
||||
|
||||
#include <AppKit/NSCell.h>
|
||||
#include <InterfaceBuilder/IBCellProtocol.h>
|
||||
|
||||
@interface NSCell (IBCellAdditions) <IBCellProtocol>
|
||||
|
|
|
@ -36,47 +36,179 @@ IB_EXTERN NSString *IBDidSaveDocumentNotification;
|
|||
IB_EXTERN NSString *IBWillCloseDocumentNotification;
|
||||
|
||||
@protocol IBDocuments <NSObject>
|
||||
/**
|
||||
* Add a connection
|
||||
*/
|
||||
- (void) addConnector: (id<IBConnectors>)aConnector;
|
||||
|
||||
/**
|
||||
* Returns an array containing all connections for the receiver.
|
||||
*/
|
||||
- (NSArray*) allConnectors;
|
||||
|
||||
/**
|
||||
* Attaches an object to the document and makes the association
|
||||
* with the parent.
|
||||
*/
|
||||
- (void) attachObject: (id)anObject toParent: (id)aParent;
|
||||
|
||||
/**
|
||||
* Iterates over anArray and attaches all objects in it to the
|
||||
* receiver with aParent as the parent.
|
||||
*/
|
||||
- (void) attachObjects: (NSArray*)anArray toParent: (id)aParent;
|
||||
|
||||
/**
|
||||
* Returns an autoreleased array containing all connections for
|
||||
* the given destination.
|
||||
*/
|
||||
- (NSArray*) connectorsForDestination: (id)destination;
|
||||
|
||||
/**
|
||||
* Returns an autoreleased array containing all connectors of
|
||||
* the given class for the destination.
|
||||
*/
|
||||
- (NSArray*) connectorsForDestination: (id)destination
|
||||
ofClass: (Class)aConnectorClass;
|
||||
/**
|
||||
* Returns an autoreleased array containing all connections for
|
||||
* the given source.
|
||||
*/
|
||||
- (NSArray*) connectorsForSource: (id)source;
|
||||
|
||||
/**
|
||||
* Returns an autoreleased array containing all connectors of the
|
||||
* given class for the source.
|
||||
*/
|
||||
- (NSArray*) connectorsForSource: (id)source
|
||||
ofClass: (Class)aConnectorClass;
|
||||
|
||||
/**
|
||||
* Returns YES, if the receiver contains anObject.
|
||||
*/
|
||||
- (BOOL) containsObject: (id)anObject;
|
||||
|
||||
/**
|
||||
* Returns YES, if the receiver contains an object with the given name
|
||||
* and parent.
|
||||
*/
|
||||
- (BOOL) containsObjectWithName: (NSString*)aName forParent: (id)parent;
|
||||
|
||||
/**
|
||||
* Copies anObject to the pasteboard with the aType.
|
||||
*/
|
||||
- (BOOL) copyObject: (id)anObject
|
||||
type: (NSString*)aType
|
||||
toPasteboard: (NSPasteboard*)aPasteboard;
|
||||
|
||||
/**
|
||||
* Copues an array of objects to aPasteboard with aType.
|
||||
*/
|
||||
- (BOOL) copyObjects: (NSArray*)anArray
|
||||
type: (NSString*)aType
|
||||
toPasteboard: (NSPasteboard*)aPasteboard;
|
||||
|
||||
/**
|
||||
* Detaches anObject from the receiver.
|
||||
*/
|
||||
- (void) detachObject: (id)anObject;
|
||||
|
||||
/**
|
||||
* Detaches an array of objects from the receiver.
|
||||
*/
|
||||
- (void) detachObjects: (NSArray*)anArray;
|
||||
|
||||
/**
|
||||
* The path of the file which represents the document.
|
||||
*/
|
||||
- (NSString*) documentPath;
|
||||
|
||||
/**
|
||||
* Called when an editor is closed.
|
||||
*/
|
||||
- (void) editor: (id<IBEditors>)anEditor didCloseForObject: (id)anObject;
|
||||
|
||||
/**
|
||||
* Returns the associated editor for anObject, if flag is YES, it will
|
||||
* create an instance of the editor class if one does not already exist
|
||||
* for the given object.
|
||||
*/
|
||||
- (id<IBEditors>) editorForObject: (id)anObject
|
||||
create: (BOOL)flag;
|
||||
|
||||
/**
|
||||
* Returns the associated subeditor for anObject, if flag is YES, it will
|
||||
* create an instance of the editor.
|
||||
*/
|
||||
- (id<IBEditors>) editorForObject: (id)anObject
|
||||
inEditor: (id<IBEditors>)anEditor
|
||||
create: (BOOL)flag;
|
||||
|
||||
/**
|
||||
* Returns the name associated with the object.
|
||||
*/
|
||||
- (NSString*) nameForObject: (id)anObject;
|
||||
|
||||
/**
|
||||
* Returns the object for the given aName.
|
||||
*/
|
||||
- (id) objectForName: (NSString*)aName;
|
||||
|
||||
/**
|
||||
* Returns all objects in the receiver's name table.
|
||||
*/
|
||||
- (NSArray*) objects;
|
||||
|
||||
/**
|
||||
* Creates an editor, if necessary using editorForObject:create:, opens it
|
||||
* and brings the window containing the editor to the front.
|
||||
*/
|
||||
- (id<IBEditors>) openEditorForObject: (id)anObject;
|
||||
|
||||
/**
|
||||
* Returns the parent of the given editor.
|
||||
*/
|
||||
- (id<IBEditors, IBSelectionOwners>) parentEditorForEditor: (id<IBEditors>)anEditor;
|
||||
|
||||
/**
|
||||
* Returns the parent of the given object.
|
||||
*/
|
||||
- (id) parentOfObject: (id)anObject;
|
||||
|
||||
/**
|
||||
* Pastes the given type from the aPasteboard.
|
||||
*/
|
||||
- (NSArray*) pasteType: (NSString*)aType
|
||||
fromPasteboard: (NSPasteboard*)aPasteboard
|
||||
parent: (id)parent;
|
||||
|
||||
/**
|
||||
* Remove aConnector from the receiver.
|
||||
*/
|
||||
- (void) removeConnector: (id<IBConnectors>)aConnector;
|
||||
|
||||
/**
|
||||
* The current editor wants to give up the selection, this method iterates
|
||||
* over all editors and determines if any editors will take over the selection.
|
||||
* If one is found it is activated.
|
||||
*/
|
||||
- (void) resignSelectionForEditor: (id<IBEditors>)editor;
|
||||
|
||||
/**
|
||||
* Set aName for object in the receiver. This replaces any name the object
|
||||
* may have previously had.
|
||||
*/
|
||||
- (void) setName: (NSString*)aName forObject: (id)object;
|
||||
|
||||
/**
|
||||
* Sets the currently selected object from the given editor.
|
||||
*/
|
||||
- (void) setSelectionFromEditor: (id<IBEditors>)anEditor;
|
||||
- (void) touch; /* Mark document as having been changed. */
|
||||
|
||||
/**
|
||||
* Mark document as having been changed.
|
||||
*/
|
||||
- (void) touch;
|
||||
@end
|
||||
|
||||
#endif
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
*/
|
||||
|
||||
#include <Foundation/NSString.h>
|
||||
#include <InterfaceBuilder/IBDocuments.h>
|
||||
|
||||
NSString *IBDidOpenDocumentNotification = @"IBDidOpenDocumentNotification";
|
||||
NSString *IBWillSaveDocumentNotification = @"IBWillSaveDocumentNotification";
|
||||
|
|
|
@ -43,6 +43,7 @@ NSString *GormLinkPboardType = @"GormLinkPboardType";
|
|||
{
|
||||
NSMutableDictionary *nameTable;
|
||||
NSMutableArray *connections;
|
||||
NSMutableArray *parentLinks;
|
||||
NSString *documentPath;
|
||||
}
|
||||
@end
|
||||
|
@ -168,9 +169,12 @@ static NSMapTable *viewToType = 0;
|
|||
@end
|
||||
|
||||
/**
|
||||
* Implementation of document protocol.
|
||||
* Implementation of document protocol for palette.
|
||||
*/
|
||||
|
||||
//
|
||||
// NOTE: This is a very rudimentary implementation.
|
||||
//
|
||||
@implementation IBPaletteDocument
|
||||
|
||||
- (id) initWithDocumentPath: (NSString *)docPath
|
||||
|
@ -180,6 +184,7 @@ static NSMapTable *viewToType = 0;
|
|||
ASSIGN(documentPath, docPath);
|
||||
nameTable = [[NSMutableDictionary alloc] init];
|
||||
connections = [[NSMutableArray alloc] init];
|
||||
parentLinks = [[NSMutableArray alloc] init];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
@ -189,59 +194,133 @@ static NSMapTable *viewToType = 0;
|
|||
RELEASE(documentPath);
|
||||
RELEASE(nameTable);
|
||||
RELEASE(connections);
|
||||
RELEASE(parentLinks);
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
- (void) addConnector: (id<IBConnectors>)aConnector
|
||||
{
|
||||
// does nothing...
|
||||
[connections addObject: aConnector];
|
||||
}
|
||||
|
||||
- (NSArray*) allConnectors
|
||||
{
|
||||
return nil;
|
||||
return connections;
|
||||
}
|
||||
|
||||
- (NSString *) _uniqueObjectNameFrom: (NSString *)name
|
||||
{
|
||||
NSString *search = [NSString stringWithString: name];
|
||||
int i = 1;
|
||||
|
||||
while([nameTable objectForKey: search])
|
||||
{
|
||||
search = [name stringByAppendingString: [NSString stringWithFormat: @"%d",i++]];
|
||||
}
|
||||
|
||||
return search;
|
||||
}
|
||||
|
||||
- (void) attachObject: (id)anObject toParent: (id)aParent
|
||||
{
|
||||
// does nothing...
|
||||
NSNibConnector *conn = [NSNibConnector init];
|
||||
NSString *name = [self _uniqueObjectNameFrom: [anObject className]];
|
||||
|
||||
// create the relationship.
|
||||
[conn setSource: aParent];
|
||||
[conn setDestination: anObject];
|
||||
[parentLinks addObject: conn];
|
||||
[nameTable setObject: anObject forKey: name];
|
||||
[connections addObject: conn];
|
||||
}
|
||||
|
||||
- (void) attachObjects: (NSArray*)anArray toParent: (id)aParent
|
||||
{
|
||||
// does nothing...
|
||||
NSEnumerator *en = [anArray objectEnumerator];
|
||||
id obj;
|
||||
|
||||
while((obj = [en nextObject]) != nil)
|
||||
{
|
||||
[self attachObject: obj toParent: aParent];
|
||||
}
|
||||
}
|
||||
|
||||
- (NSArray*) connectorsForDestination: (id)destination
|
||||
{
|
||||
return nil;
|
||||
return [self connectorsForDestination: destination ofClass: [NSObject class]];
|
||||
}
|
||||
|
||||
- (NSArray*) connectorsForDestination: (id)destination
|
||||
ofClass: (Class)aConnectorClass
|
||||
ofClass: (Class)aClass
|
||||
{
|
||||
return nil;
|
||||
NSEnumerator *en = [connections objectEnumerator];
|
||||
NSMutableArray *array = [NSMutableArray array];
|
||||
id obj;
|
||||
|
||||
while((obj = [en nextObject]) != nil)
|
||||
{
|
||||
id dest = [obj destination];
|
||||
if(dest == destination && [obj isKindOfClass: aClass])
|
||||
{
|
||||
[array addObject: obj];
|
||||
}
|
||||
}
|
||||
|
||||
return array;
|
||||
}
|
||||
|
||||
- (NSArray*) connectorsForSource: (id)source
|
||||
{
|
||||
return nil;
|
||||
return [self connectorsForSource: source ofClass: [NSObject class]];
|
||||
}
|
||||
|
||||
- (NSArray*) connectorsForSource: (id)source
|
||||
ofClass: (Class)aConnectorClass
|
||||
ofClass: (Class)aClass
|
||||
{
|
||||
return nil;
|
||||
NSEnumerator *en = [connections objectEnumerator];
|
||||
NSMutableArray *array = [NSMutableArray array];
|
||||
id obj;
|
||||
|
||||
while((obj = [en nextObject]) != nil)
|
||||
{
|
||||
id src = [obj source];
|
||||
if(src == source && [obj isKindOfClass: aClass])
|
||||
{
|
||||
[array addObject: obj];
|
||||
}
|
||||
}
|
||||
|
||||
return array;
|
||||
}
|
||||
|
||||
- (BOOL) containsObject: (id)anObject
|
||||
{
|
||||
return NO;
|
||||
return [[nameTable allValues] containsObject: anObject];
|
||||
}
|
||||
|
||||
- (BOOL) containsObjectWithName: (NSString*)aName forParent: (id)parent
|
||||
{
|
||||
return NO;
|
||||
BOOL result = NO;
|
||||
id obj = [nameTable objectForKey: aName];
|
||||
|
||||
if(obj != nil)
|
||||
{
|
||||
NSEnumerator *en = [parentLinks objectEnumerator];
|
||||
id conn;
|
||||
|
||||
while((conn = [en nextObject]) != nil)
|
||||
{
|
||||
id dst = [conn destination];
|
||||
if(dst == obj)
|
||||
{
|
||||
result = YES;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
- (BOOL) copyObject: (id)anObject
|
||||
|
@ -260,12 +339,19 @@ static NSMapTable *viewToType = 0;
|
|||
|
||||
- (void) detachObject: (id)anObject
|
||||
{
|
||||
// does nothing...
|
||||
NSString *name = [self nameForObject: anObject];
|
||||
[nameTable removeObjectForKey: name];
|
||||
}
|
||||
|
||||
- (void) detachObjects: (NSArray*)anArray
|
||||
{
|
||||
// does nothing...
|
||||
NSEnumerator *en = [anArray objectEnumerator];
|
||||
id obj;
|
||||
|
||||
while((obj = [en nextObject]) != nil)
|
||||
{
|
||||
[self detachObject: obj];
|
||||
}
|
||||
}
|
||||
|
||||
- (NSString*) documentPath
|
||||
|
@ -281,6 +367,7 @@ static NSMapTable *viewToType = 0;
|
|||
- (id<IBEditors>) editorForObject: (id)anObject
|
||||
create: (BOOL)flag
|
||||
{
|
||||
// does nothing...
|
||||
return nil;
|
||||
}
|
||||
|
||||
|
@ -288,22 +375,34 @@ static NSMapTable *viewToType = 0;
|
|||
inEditor: (id<IBEditors>)anEditor
|
||||
create: (BOOL)flag
|
||||
{
|
||||
// does nothing...
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (NSString*) nameForObject: (id)anObject
|
||||
{
|
||||
return nil;
|
||||
NSEnumerator *en = [nameTable keyEnumerator];
|
||||
NSString *key;
|
||||
|
||||
while((key = [en nextObject]) != nil)
|
||||
{
|
||||
if(anObject == [nameTable objectForKey: key])
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return key;
|
||||
}
|
||||
|
||||
- (id) objectForName: (NSString*)aName
|
||||
{
|
||||
return nil;
|
||||
return [nameTable objectForKey: aName];
|
||||
}
|
||||
|
||||
- (NSArray*) objects
|
||||
{
|
||||
return nil;
|
||||
return [NSArray arrayWithArray: [nameTable allValues]];
|
||||
}
|
||||
|
||||
- (id<IBEditors>) openEditorForObject: (id)anObject
|
||||
|
@ -318,7 +417,21 @@ static NSMapTable *viewToType = 0;
|
|||
|
||||
- (id) parentOfObject: (id)anObject
|
||||
{
|
||||
return nil;
|
||||
NSEnumerator *en = [parentLinks objectEnumerator];
|
||||
id conn;
|
||||
id result;
|
||||
|
||||
while((conn = [en nextObject]) != nil)
|
||||
{
|
||||
id dst = [conn destination];
|
||||
if(dst == anObject)
|
||||
{
|
||||
result = [conn source];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
- (NSArray*) pasteType: (NSString*)aType
|
||||
|
@ -330,7 +443,7 @@ static NSMapTable *viewToType = 0;
|
|||
|
||||
- (void) removeConnector: (id<IBConnectors>)aConnector
|
||||
{
|
||||
// does nothing...
|
||||
[connections removeObjectIdenticalTo: aConnector];
|
||||
}
|
||||
|
||||
- (void) resignSelectionForEditor: (id<IBEditors>)editor
|
||||
|
@ -340,7 +453,13 @@ static NSMapTable *viewToType = 0;
|
|||
|
||||
- (void) setName: (NSString*)aName forObject: (id)object
|
||||
{
|
||||
|
||||
id obj = [nameTable objectForKey: aName];
|
||||
|
||||
RETAIN(obj);
|
||||
[nameTable removeObjectForKey: aName];
|
||||
[nameTable setObject: object forKey: aName];
|
||||
RELEASE(obj);
|
||||
|
||||
}
|
||||
|
||||
- (void) setSelectionFromEditor: (id<IBEditors>)anEditor
|
||||
|
|
64
GormLib/IBProjectFiles.h
Normal file
64
GormLib/IBProjectFiles.h
Normal file
|
@ -0,0 +1,64 @@
|
|||
/* IBProjectFiles.h
|
||||
*
|
||||
* Copyright (C) 2003 Free Software Foundation, Inc.
|
||||
*
|
||||
* Author: Gregory John Casamento <greg_casamento@yahoo.com>
|
||||
* Date: 2003
|
||||
*
|
||||
* This file is part of GNUstep.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#ifndef INCLUDED_IBPROJECTFILES_H
|
||||
#define INCLUDED_IBPROJECTFILES_H
|
||||
|
||||
#include <InterfaceBuilder/IBProjects.h>
|
||||
|
||||
@class NSString;
|
||||
|
||||
@protocol IBProjectFiles <NSObject>
|
||||
/**
|
||||
* The file name.
|
||||
*/
|
||||
- (NSString *) fileName;
|
||||
|
||||
/**
|
||||
* The file type for this file.
|
||||
*/
|
||||
- (NSString *) fileType;
|
||||
|
||||
/**
|
||||
* Returns YES, if the file is localized, NO if it's simply in Resources.
|
||||
*/
|
||||
- (BOOL) isLocalized;
|
||||
|
||||
/**
|
||||
* The language
|
||||
*/
|
||||
- (NSString *) language;
|
||||
|
||||
/**
|
||||
* The path for the file.
|
||||
*/
|
||||
- (NSString *) path;
|
||||
|
||||
/**
|
||||
* The project to which this file belongs.
|
||||
*/
|
||||
- (id<IBProjects>) project;
|
||||
@end
|
||||
|
||||
#endif
|
116
GormLib/IBProjects.h
Normal file
116
GormLib/IBProjects.h
Normal file
|
@ -0,0 +1,116 @@
|
|||
/* IBProjects.h
|
||||
*
|
||||
* Copyright (C) 2004 Free Software Foundation, Inc.
|
||||
*
|
||||
* Author: Gregory John Casamento <greg_casamento@yahoo.com>
|
||||
* Date: 2004
|
||||
*
|
||||
* This file is part of GNUstep.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#ifndef INCLUDED_IBPROJECTS_H
|
||||
#define INCLUDED_IBPROJECTS_H
|
||||
|
||||
#include <Foundation/NSObject.h>
|
||||
#include <AppKit/NSInterfaceStyle.h>
|
||||
|
||||
@class NSString, NSArray;
|
||||
|
||||
@protocol IBProjects <NSObject>
|
||||
|
||||
/**
|
||||
* Called to retrieve the application icon to be used for the
|
||||
* interface/language combination.
|
||||
*/
|
||||
- (id) applicationIconForInterfaceStyle: (NSInterfaceStyle)style
|
||||
inLanguage: (NSString *)lang;
|
||||
|
||||
/**
|
||||
* Returns YES, if the file is in the given path.
|
||||
*/
|
||||
- (BOOL) containsFileAtPath: (NSString *)path;
|
||||
|
||||
/**
|
||||
* Returns an array containing the list of files of that filetype
|
||||
* in the project.
|
||||
*/
|
||||
- (NSArray *) filesForFileType: (NSString *)type;
|
||||
|
||||
/**
|
||||
* Returns YES, if child is a child of the reciever.
|
||||
*/
|
||||
- (BOOL) isAncestorOfProject: (id<IBProjects>) child;
|
||||
|
||||
/**
|
||||
* Returns YES, if parent is a parent of the receiver.
|
||||
*/
|
||||
- (BOOL) isDescendantOfProject: (id<IBProjects>) parent;
|
||||
|
||||
/**
|
||||
* Is there currently a connection to the project.
|
||||
*/
|
||||
- (BOOL) isLive;
|
||||
|
||||
/**
|
||||
* Returns the language for the file at the given path.
|
||||
*/
|
||||
- (NSString *) languageForFileAtPath: (NSString *)path;
|
||||
|
||||
/**
|
||||
* Returns the nib for the interface/style combination.
|
||||
*/
|
||||
- (id) mainNibFileForInterfaceStyle: (NSInterfaceStyle)style
|
||||
inLanguage: (NSString *)lang;
|
||||
|
||||
/**
|
||||
* Locates and returns the location of filename within the
|
||||
* receiver.
|
||||
*/
|
||||
- (NSString *) pathForFilename: (NSString *)filename;
|
||||
|
||||
/**
|
||||
* Returns the full path for the project directory.
|
||||
*/
|
||||
- (NSString *) projectDirectory;
|
||||
|
||||
/**
|
||||
* Returns the project manager object.
|
||||
*/
|
||||
- (id) projectManager;
|
||||
|
||||
/**
|
||||
* The name of the project.
|
||||
*/
|
||||
- (NSString *) projectName;
|
||||
|
||||
/**
|
||||
* The topmost project in the project hierarchy containing the receiver.
|
||||
*/
|
||||
- (id<IBProjects>) rootProject;
|
||||
|
||||
/**
|
||||
* Any and all direct subjects of this project.
|
||||
*/
|
||||
- (NSArray *) subprojects;
|
||||
|
||||
/**
|
||||
* The project which is the direct parent of the receiver.
|
||||
*/
|
||||
- (id<IBProjects>) superproject;
|
||||
|
||||
@end
|
||||
#endif
|
154
GormLib/IBResourceManager.h
Normal file
154
GormLib/IBResourceManager.h
Normal file
|
@ -0,0 +1,154 @@
|
|||
/* IBResourceManager.h
|
||||
*
|
||||
* Copyright (C) 2005 Free Software Foundation, Inc.
|
||||
*
|
||||
* Author: Gregory John Casamento <greg_casamento@yahoo.com>
|
||||
* Date: 2005
|
||||
*
|
||||
* This file is part of GNUstep.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#ifndef INCLUDED_IBRESOURCEMANAGER_H
|
||||
#define INCLUDED_IBRESOURCEMANAGER_H
|
||||
|
||||
#include <Foundation/NSObject.h>
|
||||
#include <InterfaceBuilder/IBProjects.h>
|
||||
#include <InterfaceBuilder/IBProjectFiles.h>
|
||||
#include <InterfaceBuilder/IBDocuments.h>
|
||||
|
||||
@class NSArray, NSString, NSPasteboard;
|
||||
|
||||
/**
|
||||
* Notification sent when a resource manager class is added to /removed from
|
||||
* the registry.
|
||||
*/
|
||||
IB_EXTERN NSString *IBResourceManagerRegistryDidChangeNotification;
|
||||
|
||||
/**
|
||||
* Enumerated type to allow specification of where the resource
|
||||
* lives.
|
||||
*/
|
||||
enum IBResourceLocation {
|
||||
kNibResource = 0,
|
||||
kProjectResource,
|
||||
kPaletteResource,
|
||||
kSystemResource,
|
||||
kUnknownResource
|
||||
};
|
||||
|
||||
@interface IBResourceManager : NSObject
|
||||
{
|
||||
id<IBDocuments> document;
|
||||
}
|
||||
|
||||
/**
|
||||
* Register the given class as a resource mananger.
|
||||
*/
|
||||
+ (void) registerResourceManagerClass: (Class)managerClass;
|
||||
|
||||
/**
|
||||
* Register the given class as a resource manager for the frameworks in the array.
|
||||
*/
|
||||
+ (void) registerResourceManagerClass: (Class)managerClass
|
||||
forFrameworks: (NSArray *)frameworks;
|
||||
|
||||
/**
|
||||
* Return an array of classes for the given framework.
|
||||
*/
|
||||
+ (NSArray *) registeredResourceManagerClassesForFramework: (NSString *)framework;
|
||||
|
||||
/**
|
||||
* Returns YES, if the pasteboard contains a type the resource
|
||||
* manager can accept.
|
||||
*/
|
||||
- (BOOL) acceptsResourcesFromPasteboard: (NSPasteboard *)pboard;
|
||||
|
||||
/**
|
||||
* Add a resource.
|
||||
*/
|
||||
- (void) addResources: (NSArray *)resources;
|
||||
|
||||
/**
|
||||
* Add resoures from the pasteboard. Invokes the
|
||||
* acceptsResourcesFromPasteboard: method to determine
|
||||
* if the resources will be added.
|
||||
*/
|
||||
- (void) addResourcesFromPasteboard: (NSPasteboard *)pboard;
|
||||
|
||||
/**
|
||||
* Called by an external application when a file owned by
|
||||
* the GUI builder is modified.
|
||||
*/
|
||||
- (void) application: (NSString *) appName didModifyFileAtPath: (NSString *)path;
|
||||
|
||||
/**
|
||||
* Returns the document with which this resource manager is
|
||||
* associated.
|
||||
*/
|
||||
- (id<IBDocuments>) document;
|
||||
|
||||
/**
|
||||
* Instantiate the resource manager with the given
|
||||
* document object.
|
||||
*/
|
||||
- (id) initWithDocument: (id<IBDocuments>)document;
|
||||
|
||||
/**
|
||||
* Returns YES, if this resource manager is non-modifiable.
|
||||
*/
|
||||
- (BOOL) isReadOnly;
|
||||
|
||||
/**
|
||||
* Called by an external application when the a file
|
||||
* is added.
|
||||
*/
|
||||
- (void) project: (id<IBProjects>)proj didAddFile: (id<IBProjectFiles>)file;
|
||||
|
||||
/**
|
||||
* Called by an external application when the a file
|
||||
* changes localization.
|
||||
*/
|
||||
- (void) project: (id<IBProjects>)proj didChangeLocalizationOfFile: (id<IBProjectFiles>)file;
|
||||
|
||||
/**
|
||||
* Called by an external application when a file
|
||||
* is removed.
|
||||
*/
|
||||
- (void) project: (id<IBProjects>)proj didRemoveFile: (id<IBProjectFiles>)file;
|
||||
|
||||
/**
|
||||
* Returns a list of resource file types this manager can accept.
|
||||
*/
|
||||
- (NSArray *) resourceFileTypes;
|
||||
|
||||
/**
|
||||
* Returns a list of pasteboard types this manager can accept.
|
||||
*/
|
||||
- (NSArray *) resourcePasteboardTypes;
|
||||
|
||||
/**
|
||||
* Returns the associated resources for the objects.
|
||||
*/
|
||||
- (NSArray *) resourcesForObjects: (NSArray *)objs;
|
||||
|
||||
/**
|
||||
* Writes a resource to the document path.
|
||||
*/
|
||||
- (void) writeToDocumentPath: (NSString *)path;
|
||||
@end
|
||||
|
||||
#endif
|
178
GormLib/IBResourceManager.m
Normal file
178
GormLib/IBResourceManager.m
Normal file
|
@ -0,0 +1,178 @@
|
|||
/* IBResourceManager.m
|
||||
*
|
||||
* Copyright (C) 2005 Free Software Foundation, Inc.
|
||||
*
|
||||
* Author: Gregory John Casamento <greg_casamento@yahoo.com>
|
||||
* Date: 2005
|
||||
*
|
||||
* This file is part of GNUstep.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#include <InterfaceBuilder/IBResourceManager.h>
|
||||
#include <Foundation/NSArray.h>
|
||||
#include <Foundation/NSString.h>
|
||||
#include <AppKit/NSPasteboard.h>
|
||||
|
||||
/**
|
||||
* Notification sent when a resource manager class is added to /removed from
|
||||
* the registry.
|
||||
*/
|
||||
NSString *IBResourceManagerRegistryDidChangeNotification = @"IBResourceManagerRegistryDidChangeNotification";
|
||||
|
||||
@implementation IBResourceManager : NSObject
|
||||
/**
|
||||
* Register the given class as a resource mananger.
|
||||
*/
|
||||
+ (void) registerResourceManagerClass: (Class)managerClass
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Register the given class as a resource manager for the frameworks in the array.
|
||||
*/
|
||||
+ (void) registerResourceManagerClass: (Class)managerClass
|
||||
forFrameworks: (NSArray *)frameworks
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Return an array of classes for the given framework.
|
||||
*/
|
||||
+ (NSArray *) registeredResourceManagerClassesForFramework: (NSString *)framework
|
||||
{
|
||||
return nil;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns YES, if the pasteboard contains a type the resource
|
||||
* manager can accept.
|
||||
*/
|
||||
- (BOOL) acceptsResourcesFromPasteboard: (NSPasteboard *)pboard
|
||||
{
|
||||
return NO;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a resource.
|
||||
*/
|
||||
- (void) addResources: (NSArray *)resources
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Add resoures from the pasteboard. Invokes the
|
||||
* acceptsResourcesFromPasteboard: method to determine
|
||||
* if the resources will be added.
|
||||
*/
|
||||
- (void) addResourcesFromPasteboard: (NSPasteboard *)pboard
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Called by an external application when a file owned by
|
||||
* the GUI builder is modified.
|
||||
*/
|
||||
- (void) application: (NSString *) appName didModifyFileAtPath: (NSString *)path
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the document with which this resource manager is
|
||||
* associated.
|
||||
*/
|
||||
- (id<IBDocuments>) document
|
||||
{
|
||||
return document;
|
||||
}
|
||||
|
||||
/**
|
||||
* Instantiate the resource manager with the given
|
||||
* document object.
|
||||
*/
|
||||
- (id) initWithDocument: (id<IBDocuments>)doc
|
||||
{
|
||||
if((self = [super init]) != nil)
|
||||
{
|
||||
document = doc;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns YES, if this resource manager is non-modifiable.
|
||||
*/
|
||||
- (BOOL) isReadOnly;
|
||||
{
|
||||
return NO;
|
||||
}
|
||||
|
||||
/**
|
||||
* Called by an external application when the a file
|
||||
* is added.
|
||||
*/
|
||||
- (void) project: (id<IBProjects>)proj didAddFile: (id<IBProjectFiles>)file
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Called by an external application when the a file
|
||||
* changes localization.
|
||||
*/
|
||||
- (void) project: (id<IBProjects>)proj didChangeLocalizationOfFile: (id<IBProjectFiles>)file
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Called by an external application when a file
|
||||
* is removed.
|
||||
*/
|
||||
- (void) project: (id<IBProjects>)proj didRemoveFile: (id<IBProjectFiles>)file
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a list of resource file types this manager can accept.
|
||||
*/
|
||||
- (NSArray *) resourceFileTypes
|
||||
{
|
||||
return nil;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a list of pasteboard types this manager can accept.
|
||||
*/
|
||||
- (NSArray *) resourcePasteboardTypes
|
||||
{
|
||||
return nil;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the associated resources for the objects.
|
||||
*/
|
||||
- (NSArray *) resourcesForObjects: (NSArray *)objs;
|
||||
{
|
||||
return nil;
|
||||
}
|
||||
|
||||
/**
|
||||
* Writes a resource to the document path.
|
||||
*/
|
||||
- (void) writeToDocumentPath: (NSString *)path
|
||||
{
|
||||
}
|
||||
|
||||
@end
|
|
@ -26,6 +26,8 @@
|
|||
#define INCLUDED_INTERFACEBUIDLER_H
|
||||
|
||||
#include <InterfaceBuilder/IBApplicationAdditions.h>
|
||||
#include <InterfaceBuilder/IBCellAdditions.h>
|
||||
#include <InterfaceBuilder/IBCellProtocol.h>
|
||||
#include <InterfaceBuilder/IBConnectors.h>
|
||||
#include <InterfaceBuilder/IBDefines.h>
|
||||
#include <InterfaceBuilder/IBDocuments.h>
|
||||
|
@ -33,8 +35,13 @@
|
|||
#include <InterfaceBuilder/IBInspector.h>
|
||||
#include <InterfaceBuilder/IBInspectorManager.h>
|
||||
#include <InterfaceBuilder/IBObjectAdditions.h>
|
||||
#include <InterfaceBuilder/IBObjectProtocol.h>
|
||||
#include <InterfaceBuilder/IBPalette.h>
|
||||
#include <InterfaceBuilder/IBProjects.h>
|
||||
#include <InterfaceBuilder/IBProjectFiles.h>
|
||||
#include <InterfaceBuilder/IBResourceManager.h>
|
||||
#include <InterfaceBuilder/IBSystem.h>
|
||||
#include <InterfaceBuilder/IBViewAdditions.h>
|
||||
#include <InterfaceBuilder/IBViewProtocol.h>
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in a new issue