More GormLib changes.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/apps/gorm/trunk@20445 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Gregory John Casamento 2004-12-13 01:58:43 +00:00
parent 6de6f32167
commit b0287361d7
5 changed files with 225 additions and 15 deletions

View file

@ -1,3 +1,15 @@
2004-12-12 20:55 Gregory John Casamento <greg_casamento@yahoo.com>
* GormDocument.h: Added declaration for windowAndRect:forObject:
* GormLib/IBDocuments.h: Removed the declaration for
windowAndRect:forObject: from here as it doesn't belong in the
IBDocuments protocol.
* GormLib/IBPalette.m: Started implementing the private class
IBPaletteDocument.
* Gorm.m: Changed some code due to to switch in location of the
windowAndRect:forObject: method from IBDocuments.h to
GormDocument.h.
2004-12-12 16:00 Gregory John Casamento <greg_casamento@yahoo.com>
* GormLib/GNUmakefile: Added new header files.

18
Gorm.m
View file

@ -435,8 +435,8 @@ static NSImage *testingImage = nil;
{
if (connectSource != nil)
{
window = [[self activeDocument] windowAndRect: &rect
forObject: connectSource];
window = [(GormDocument *)[self activeDocument] windowAndRect: &rect
forObject: connectSource];
if (window != nil)
{
NSView *view = [[window contentView] superview];
@ -459,8 +459,8 @@ static NSImage *testingImage = nil;
{
if (connectDestination != nil)
{
window = [[self activeDocument] windowAndRect: &rect
forObject: connectDestination];
window = [(GormDocument *)[self activeDocument] windowAndRect: &rect
forObject: connectDestination];
if (window != nil)
{
NSView *view = [[window contentView] superview];
@ -482,7 +482,7 @@ static NSImage *testingImage = nil;
}
if (connectSource != nil)
{
window = [[self activeDocument] windowAndRect: &rect forObject: connectSource];
window = [(GormDocument *)[self activeDocument] windowAndRect: &rect forObject: connectSource];
if (window != nil)
{
NSView *view = [[window contentView] superview];
@ -502,8 +502,8 @@ static NSImage *testingImage = nil;
}
if (connectDestination != nil && connectDestination == connectSource)
{
window = [[self activeDocument] windowAndRect: &rect
forObject: connectDestination];
window = [(GormDocument *)[self activeDocument] windowAndRect: &rect
forObject: connectDestination];
if (window != nil)
{
NSView *view = [[window contentView] superview];
@ -525,8 +525,8 @@ static NSImage *testingImage = nil;
}
else if (connectDestination != nil)
{
window = [[self activeDocument] windowAndRect: &rect
forObject: connectDestination];
window = [(GormDocument *)[self activeDocument] windowAndRect: &rect
forObject: connectDestination];
if (window != nil)
{
NSView *view = [[window contentView] superview];

View file

@ -168,6 +168,10 @@
// first responder/font manager
- (id) fontManager;
- (id) firstResponder;
// windowAndRect:forObject: is called by Gorm to determine where it should
// draw selection markup
- (NSWindow*) windowAndRect: (NSRect*)r forObject: (id)object;
@end
@interface GormDocument (MenuValidation)

View file

@ -76,12 +76,6 @@ extern NSString *IBWillCloseDocumentNotification;
- (void) setName: (NSString*)aName forObject: (id)object;
- (void) setSelectionFromEditor: (id<IBEditors>)anEditor;
- (void) touch; /* Mark document as having been changed. */
/*
* windowAndRect:forObject: is called by Gorm to determine where it should
* draw selection markup
*/
- (NSWindow*) windowAndRect: (NSRect*)r forObject: (id)object;
@end
#endif

View file

@ -39,6 +39,14 @@ NSString *GormImagePboardType = @"GormImagePboardType";
NSString *GormSoundPboardType = @"GormSoundPboardType";
NSString *GormLinkPboardType = @"GormLinkPboardType";
@interface IBPaletteDocument : NSObject <IBDocuments>
{
NSMutableDictionary *nameTable;
NSMutableArray *connections;
NSString *documentPath;
}
@end
@implementation IBPalette
static NSMapTable *viewToObject = 0;
@ -89,6 +97,7 @@ static NSMapTable *viewToType = 0;
{
[[NSNotificationCenter defaultCenter] removeObserver: self];
RELEASE(icon);
RELEASE(document);
[super dealloc];
}
@ -104,10 +113,12 @@ static NSMapTable *viewToType = 0;
bundle = [NSBundle bundleForClass: [self class]];
// load the palette dictionary...
fileName = [bundle pathForResource: @"palette" ofType: @"table"];
paletteInfo = [[NSString stringWithContentsOfFile: fileName]
propertyList];
// load the image...
fileName = [paletteInfo objectForKey: @"Icon"];
fileName = [bundle pathForImageResource: fileName];
if (fileName == nil)
@ -119,6 +130,7 @@ static NSMapTable *viewToType = 0;
}
icon = [[NSImage alloc] initWithContentsOfFile: fileName];
// load the nibfile...
fileName = [paletteInfo objectForKey: @"NibFile"];
if (fileName != nil && [fileName isEqual: @""] == NO)
{
@ -134,6 +146,8 @@ static NSMapTable *viewToType = 0;
}
}
document = [[IBPaletteDocument alloc] init];
return self;
}
@ -153,3 +167,189 @@ static NSMapTable *viewToType = 0;
}
@end
/**
* Implementation of document protocol.
*/
@implementation IBPaletteDocument
- (id) initWithDocumentPath: (NSString *)docPath
{
if((self = [super init]) != nil)
{
ASSIGN(documentPath, docPath);
nameTable = [[NSMutableDictionary alloc] init];
connections = [[NSMutableArray alloc] init];
}
return self;
}
- (void) dealloc
{
RELEASE(documentPath);
RELEASE(nameTable);
RELEASE(connections);
[super dealloc];
}
- (void) addConnector: (id<IBConnectors>)aConnector
{
// does nothing...
}
- (NSArray*) allConnectors
{
return nil;
}
- (void) attachObject: (id)anObject toParent: (id)aParent
{
// does nothing...
}
- (void) attachObjects: (NSArray*)anArray toParent: (id)aParent
{
// does nothing...
}
- (NSArray*) connectorsForDestination: (id)destination
{
return nil;
}
- (NSArray*) connectorsForDestination: (id)destination
ofClass: (Class)aConnectorClass
{
return nil;
}
- (NSArray*) connectorsForSource: (id)source
{
return nil;
}
- (NSArray*) connectorsForSource: (id)source
ofClass: (Class)aConnectorClass
{
return nil;
}
- (BOOL) containsObject: (id)anObject
{
return NO;
}
- (BOOL) containsObjectWithName: (NSString*)aName forParent: (id)parent
{
return NO;
}
- (BOOL) copyObject: (id)anObject
type: (NSString*)aType
toPasteboard: (NSPasteboard*)aPasteboard
{
return NO;
}
- (BOOL) copyObjects: (NSArray*)anArray
type: (NSString*)aType
toPasteboard: (NSPasteboard*)aPasteboard
{
return NO;
}
- (void) detachObject: (id)anObject
{
// does nothing...
}
- (void) detachObjects: (NSArray*)anArray
{
// does nothing...
}
- (NSString*) documentPath
{
return documentPath;
}
- (void) editor: (id<IBEditors>)anEditor didCloseForObject: (id)anObject
{
// does nothing...
}
- (id<IBEditors>) editorForObject: (id)anObject
create: (BOOL)flag
{
return nil;
}
- (id<IBEditors>) editorForObject: (id)anObject
inEditor: (id<IBEditors>)anEditor
create: (BOOL)flag
{
return nil;
}
- (NSString*) nameForObject: (id)anObject
{
return nil;
}
- (id) objectForName: (NSString*)aName
{
return nil;
}
- (NSArray*) objects
{
return nil;
}
- (id<IBEditors>) openEditorForObject: (id)anObject
{
return nil;
}
- (id<IBEditors, IBSelectionOwners>) parentEditorForEditor: (id<IBEditors>)anEditor
{
return nil;
}
- (id) parentOfObject: (id)anObject
{
return nil;
}
- (NSArray*) pasteType: (NSString*)aType
fromPasteboard: (NSPasteboard*)aPasteboard
parent: (id)parent
{
return nil;
}
- (void) removeConnector: (id<IBConnectors>)aConnector
{
// does nothing...
}
- (void) resignSelectionForEditor: (id<IBEditors>)editor
{
// does nothing...
}
- (void) setName: (NSString*)aName forObject: (id)object
{
}
- (void) setSelectionFromEditor: (id<IBEditors>)anEditor
{
// does nothing...
}
- (void) touch
{
// does nothing...
}
@end