New logic to add predefined connectors and some documentation.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/apps/gorm/trunk@18321 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Gregory John Casamento 2004-01-06 06:11:24 +00:00
parent b2cd08261b
commit 79fad1e58a
4 changed files with 108 additions and 5 deletions

View file

@ -1,3 +1,15 @@
2004-01-06 01:12 Gregory John Casamento <greg_casamento@yahoo.com>
* GormDocument.m: [GormDocument attachObject:] added logic
to automatically add predefined connections to the connectors
array so that they can be manipulated in Gorm. If a palette
defines the destination to be the First Responder,
and the label to be "orderFrontStandardInfoPanel:" then this
will be reflected in the connections inspector.
* GormLib/IBConnectors.h: Made the comments into documentation
style comments so, if/when I start using gsdoc to document the
innerworkings of Gorm, it will be ready.
2004-01-04 22:39 Gregory John Casamento <greg_casamento@yahoo.com>
* GormDocument.m: Made -[GormDocument _identifierString:],

View file

@ -44,6 +44,37 @@
}
@end
/*
@implementation NSMenuItem (IBObjectAdditions)
- (void)awakeFromDocument: (id <IBDocuments>)doc
{
NSLog(@"In here");
// [self setState: NSOnState];
// [self setState: NSOffState];
}
@end
*/
@interface NSNibControlConnector (GormExtension)
- (BOOL) isEqual: (id)object;
@end
@implementation NSNibControlConnector (GormExtension)
- (BOOL) isEqual: (id)object
{
BOOL result = NO;
if([[self source] isEqual: [object source]] &&
[[self destination] isEqual: [object destination]] &&
[[self label] isEqual: [object label]])
{
result = YES;
}
return result;
}
@end
// Internal only
NSString *GSCustomClassMap = @"GSCustomClassMap";
@ -286,6 +317,44 @@ static NSImage *classesImage = nil;
[self attachObject: [anObject documentView] toParent: aParent];
}
}
// Detect and add any connection the object might have.
// This is done so that any palette items which have predefined connections will be
// shown in the connections list.
if([anObject respondsToSelector: @selector(action)] == YES &&
[anObject respondsToSelector: @selector(target)] == YES)
{
SEL sel = [anObject action];
if(sel != NULL)
{
NSString *label = NSStringFromSelector(sel);
id source = anObject;
NSNibControlConnector *con = [NSNibControlConnector new];
id destination = [anObject target];
NSArray *sourceConnections = [self connectorsForSource: source];
if(destination == nil)
{
destination = firstResponder;
}
// build the connection
[con setSource: source];
[con setDestination: destination];
[con setLabel: label];
// don't duplicate the connection if it already exists.
// if([sourceConnections indexOfObjectIdenticalTo: con] == NSNotFound)
if([sourceConnections containsObject: con] == NO)
{
// add it to our connections set.
[self addConnector: (id<IBConnectors>)con];
}
RELEASE(con);
}
}
}
- (void) attachObjects: (NSArray*)anArray toParent: (id)aParent

View file

@ -60,30 +60,30 @@ extern NSString *IBDidRemoveConnectorNotification;
@end
@interface NSApplication (IBConnections)
/*
/**
* [NSApp -connectSource] returns the source object as set by the most recent
* [NSApp -displayConnectionBetween:and:]
*/
- (id) connectSource;
/*
/**
* [NSApp -connectDestination] returns the target object as set by the most
* recent [NSApp -displayConnectionBetween:and:]
*/
- (id) connectDestination;
/*
/**
* [NSApp -isConnecting] simply lets you know if a connection is in progress.
*/
- (BOOL) isConnecting;
/*
/**
* [NSApp -stopConnecting] terminates the current connection process and
* removes the connection marks from the display.
*/
- (void) stopConnecting;
/*
/**
* [NSApp -displayConnectionBetween:and:] is used to set the source and target
* objects and mark the display appropriately. Setting either source or
* target to 'nil' will remove markup from any previous source or target.

View file

@ -140,6 +140,28 @@
}
@end
/*
@interface GormNSMenu (GNUstepExtra)
- (void) setTornOff: (BOOL)flag;
- (void) _showTornOffMenuIfAny: (NSNotification*)notification;
- (void) _showOnActivateApp: (NSNotification*)notification;
@end
@implementation GormNSMenu (GNUstepExtra)
- (void) setTornOff: (BOOL)flag
{
}
- (void) _showTornOffMenuIfAny: (NSNotification*)notification
{
}
- (void) _showOnActivateApp: (NSNotification*)notification
{
}
@end
*/
@implementation NSMenu (GormNSMenu)
+ (id) allocSubstitute
{