1999-12-08 15:04:57 +00:00
|
|
|
|
/* GormDocument.m
|
|
|
|
|
*
|
|
|
|
|
* Copyright (C) 1999 Free Software Foundation, Inc.
|
|
|
|
|
*
|
|
|
|
|
* Author: Richard Frith-Macdonald <richard@brainstrom.co.uk>
|
|
|
|
|
* Date: 1999
|
|
|
|
|
*
|
|
|
|
|
* 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 "GormPrivate.h"
|
2001-10-05 15:02:55 +00:00
|
|
|
|
#include "GormClassManager.h"
|
|
|
|
|
#include "GormCustomView.h"
|
2002-07-08 04:45:23 +00:00
|
|
|
|
#include "GormOutlineView.h"
|
1999-12-08 15:04:57 +00:00
|
|
|
|
|
1999-12-08 15:19:11 +00:00
|
|
|
|
NSString *IBDidOpenDocumentNotification = @"IBDidOpenDocumentNotification";
|
|
|
|
|
NSString *IBWillSaveDocumentNotification = @"IBWillSaveDocumentNotification";
|
|
|
|
|
NSString *IBDidSaveDocumentNotification = @"IBDidSaveDocumentNotification";
|
|
|
|
|
NSString *IBWillCloseDocumentNotification = @"IBWillCloseDocumentNotification";
|
|
|
|
|
|
1999-12-13 17:01:35 +00:00
|
|
|
|
@implementation GormFirstResponder
|
|
|
|
|
- (NSImage*) imageForViewer
|
|
|
|
|
{
|
|
|
|
|
static NSImage *image = nil;
|
|
|
|
|
|
|
|
|
|
if (image == nil)
|
|
|
|
|
{
|
|
|
|
|
NSBundle *bundle = [NSBundle mainBundle];
|
|
|
|
|
NSString *path = [bundle pathForImageResource: @"GormFirstResponder"];
|
|
|
|
|
|
|
|
|
|
image = [[NSImage alloc] initWithContentsOfFile: path];
|
|
|
|
|
}
|
|
|
|
|
return image;
|
|
|
|
|
}
|
1999-12-21 11:38:49 +00:00
|
|
|
|
- (NSString*) inspectorClassName
|
|
|
|
|
{
|
1999-12-21 16:48:32 +00:00
|
|
|
|
return @"GormNotApplicableInspector";
|
|
|
|
|
}
|
|
|
|
|
- (NSString*) connectInspectorClassName
|
|
|
|
|
{
|
2002-01-29 22:41:02 +00:00
|
|
|
|
return @"GormConnectionInspector";
|
1999-12-21 16:48:32 +00:00
|
|
|
|
}
|
|
|
|
|
- (NSString*) sizeInspectorClassName
|
|
|
|
|
{
|
|
|
|
|
return @"GormNotApplicableInspector";
|
1999-12-21 11:38:49 +00:00
|
|
|
|
}
|
1999-12-13 17:01:35 +00:00
|
|
|
|
@end
|
|
|
|
|
|
|
|
|
|
@implementation GormFontManager
|
|
|
|
|
- (NSImage*) imageForViewer
|
|
|
|
|
{
|
|
|
|
|
static NSImage *image = nil;
|
|
|
|
|
|
|
|
|
|
if (image == nil)
|
|
|
|
|
{
|
|
|
|
|
NSBundle *bundle = [NSBundle mainBundle];
|
|
|
|
|
NSString *path = [bundle pathForImageResource: @"GormFontManager"];
|
|
|
|
|
|
|
|
|
|
image = [[NSImage alloc] initWithContentsOfFile: path];
|
|
|
|
|
}
|
|
|
|
|
return image;
|
|
|
|
|
}
|
1999-12-08 15:04:57 +00:00
|
|
|
|
@end
|
|
|
|
|
|
1999-12-13 17:01:35 +00:00
|
|
|
|
|
1999-12-08 15:04:57 +00:00
|
|
|
|
|
1999-12-14 17:38:17 +00:00
|
|
|
|
/*
|
|
|
|
|
* Trivial classes for connections from objects to their editors, and from
|
|
|
|
|
* child editors to their parents. This does nothing special, but we can
|
|
|
|
|
* use the fact that it's a different class to search for it in the connections
|
|
|
|
|
* array.
|
|
|
|
|
*/
|
|
|
|
|
@interface GormObjectToEditor : NSNibConnector
|
|
|
|
|
@end
|
|
|
|
|
|
|
|
|
|
@implementation GormObjectToEditor
|
|
|
|
|
@end
|
|
|
|
|
|
|
|
|
|
@interface GormEditorToParent : NSNibConnector
|
|
|
|
|
@end
|
|
|
|
|
|
|
|
|
|
@implementation GormEditorToParent
|
|
|
|
|
@end
|
|
|
|
|
|
1999-12-08 15:04:57 +00:00
|
|
|
|
@implementation GormDocument
|
|
|
|
|
|
1999-12-14 19:55:18 +00:00
|
|
|
|
static NSImage *objectsImage = nil;
|
|
|
|
|
static NSImage *imagesImage = nil;
|
|
|
|
|
static NSImage *soundsImage = nil;
|
|
|
|
|
static NSImage *classesImage = nil;
|
|
|
|
|
|
1999-12-14 17:38:17 +00:00
|
|
|
|
+ (void) initialize
|
|
|
|
|
{
|
|
|
|
|
if (self == [GormDocument class])
|
|
|
|
|
{
|
1999-12-14 19:55:18 +00:00
|
|
|
|
NSBundle *bundle;
|
|
|
|
|
NSString *path;
|
|
|
|
|
|
|
|
|
|
bundle = [NSBundle mainBundle];
|
|
|
|
|
path = [bundle pathForImageResource: @"GormObject"];
|
|
|
|
|
if (path != nil)
|
|
|
|
|
{
|
|
|
|
|
objectsImage = [[NSImage alloc] initWithContentsOfFile: path];
|
|
|
|
|
}
|
|
|
|
|
path = [bundle pathForImageResource: @"GormImage"];
|
|
|
|
|
if (path != nil)
|
|
|
|
|
{
|
|
|
|
|
imagesImage = [[NSImage alloc] initWithContentsOfFile: path];
|
|
|
|
|
}
|
|
|
|
|
path = [bundle pathForImageResource: @"GormSound"];
|
|
|
|
|
if (path != nil)
|
|
|
|
|
{
|
|
|
|
|
soundsImage = [[NSImage alloc] initWithContentsOfFile: path];
|
|
|
|
|
}
|
|
|
|
|
path = [bundle pathForImageResource: @"GormClass"];
|
|
|
|
|
if (path != nil)
|
|
|
|
|
{
|
|
|
|
|
classesImage = [[NSImage alloc] initWithContentsOfFile: path];
|
|
|
|
|
}
|
1999-12-14 17:38:17 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
1999-12-08 15:04:57 +00:00
|
|
|
|
- (void) addConnector: (id<IBConnectors>)aConnector
|
|
|
|
|
{
|
|
|
|
|
if ([connections indexOfObjectIdenticalTo: aConnector] == NSNotFound)
|
|
|
|
|
{
|
|
|
|
|
[connections addObject: aConnector];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
- (NSArray*) allConnectors
|
|
|
|
|
{
|
1999-12-14 17:38:17 +00:00
|
|
|
|
return [NSArray arrayWithArray: connections];
|
1999-12-08 15:04:57 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
- (void) attachObject: (id)anObject toParent: (id)aParent
|
|
|
|
|
{
|
|
|
|
|
NSArray *old;
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Create a connector that links this object to its parent.
|
|
|
|
|
* A nil parent is the root of the hierarchy so we use a dummy object for it.
|
|
|
|
|
*/
|
|
|
|
|
if (aParent == nil)
|
|
|
|
|
{
|
1999-12-13 17:01:35 +00:00
|
|
|
|
aParent = filesOwner;
|
1999-12-08 15:04:57 +00:00
|
|
|
|
}
|
1999-12-13 17:01:35 +00:00
|
|
|
|
old = [self connectorsForSource: anObject ofClass: [NSNibConnector class]];
|
1999-12-08 15:04:57 +00:00
|
|
|
|
if ([old count] > 0)
|
|
|
|
|
{
|
|
|
|
|
[[old objectAtIndex: 0] setDestination: aParent];
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
1999-12-13 17:01:35 +00:00
|
|
|
|
NSNibConnector *con = [NSNibConnector new];
|
1999-12-08 15:04:57 +00:00
|
|
|
|
|
|
|
|
|
[con setSource: anObject];
|
|
|
|
|
[con setDestination: aParent];
|
|
|
|
|
[self addConnector: (id<IBConnectors>)con];
|
|
|
|
|
RELEASE(con);
|
|
|
|
|
}
|
2000-01-07 06:47:08 +00:00
|
|
|
|
/*
|
|
|
|
|
* Make sure that there is a name for this object.
|
|
|
|
|
*/
|
|
|
|
|
if ([self nameForObject: anObject] == nil)
|
|
|
|
|
{
|
|
|
|
|
[self setName: nil forObject: anObject];
|
|
|
|
|
}
|
2002-02-18 12:48:31 +00:00
|
|
|
|
|
2000-01-07 06:47:08 +00:00
|
|
|
|
/*
|
|
|
|
|
* Add top-level objects to objectsView and open their editors.
|
|
|
|
|
*/
|
1999-12-13 17:01:35 +00:00
|
|
|
|
if ([anObject isKindOfClass: [NSWindow class]] == YES
|
2002-04-07 22:02:41 +00:00
|
|
|
|
// || [anObject isKindOfClass: [NSMenu class]] == YES
|
|
|
|
|
|| [anObject isKindOfClass: [GSNibItem class]] == YES)
|
1999-12-08 15:04:57 +00:00
|
|
|
|
{
|
1999-12-14 19:55:18 +00:00
|
|
|
|
[objectsView addObject: anObject];
|
1999-12-14 17:38:17 +00:00
|
|
|
|
[[self openEditorForObject: anObject] activate];
|
2000-02-25 17:26:57 +00:00
|
|
|
|
if ([anObject isKindOfClass: [NSWindow class]] == YES)
|
|
|
|
|
{
|
2002-04-07 22:02:41 +00:00
|
|
|
|
// RETAIN(anObject);
|
2000-02-25 17:26:57 +00:00
|
|
|
|
[anObject setReleasedWhenClosed: NO];
|
|
|
|
|
}
|
1999-12-08 15:04:57 +00:00
|
|
|
|
}
|
2002-02-18 12:37:26 +00:00
|
|
|
|
|
2002-04-07 22:02:41 +00:00
|
|
|
|
if ([anObject isKindOfClass: [NSMenu class]] == YES)
|
|
|
|
|
{
|
|
|
|
|
[[self openEditorForObject: anObject] activate];
|
|
|
|
|
}
|
|
|
|
|
|
2002-02-18 12:37:26 +00:00
|
|
|
|
/*
|
|
|
|
|
* if this a scrollview, it is interesting to add its contentview
|
|
|
|
|
* if it is a tableview or a textview
|
|
|
|
|
*/
|
|
|
|
|
if (([anObject isKindOfClass: [NSScrollView class]] == YES)
|
|
|
|
|
&& ([(NSScrollView *)anObject documentView] != nil))
|
|
|
|
|
{
|
|
|
|
|
if ([[anObject documentView] isKindOfClass:
|
|
|
|
|
[NSTableView class]] == YES)
|
|
|
|
|
{
|
2002-03-29 16:30:01 +00:00
|
|
|
|
int i;
|
|
|
|
|
int count;
|
|
|
|
|
NSArray *tc;
|
|
|
|
|
id tv = [anObject documentView];
|
|
|
|
|
tc = [tv tableColumns];
|
|
|
|
|
count = [tc count];
|
|
|
|
|
[self attachObject: tv
|
2002-02-18 12:37:26 +00:00
|
|
|
|
toParent: aParent];
|
2002-03-29 16:30:01 +00:00
|
|
|
|
|
|
|
|
|
for (i = 0; i < count; i++)
|
|
|
|
|
{
|
|
|
|
|
[self attachObject: [tc objectAtIndex: i]
|
|
|
|
|
toParent: aParent];
|
|
|
|
|
}
|
2002-02-18 12:37:26 +00:00
|
|
|
|
}
|
|
|
|
|
else if ([[anObject documentView] isKindOfClass:
|
|
|
|
|
[NSTextView class]] == YES)
|
|
|
|
|
{
|
|
|
|
|
[self attachObject: [anObject documentView]
|
|
|
|
|
toParent: aParent];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
1999-12-08 15:04:57 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
- (void) attachObjects: (NSArray*)anArray toParent: (id)aParent
|
|
|
|
|
{
|
|
|
|
|
NSEnumerator *enumerator = [anArray objectEnumerator];
|
|
|
|
|
NSObject *obj;
|
|
|
|
|
|
|
|
|
|
while ((obj = [enumerator nextObject]) != nil)
|
|
|
|
|
{
|
|
|
|
|
[self attachObject: obj toParent: aParent];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2000-01-03 11:00:14 +00:00
|
|
|
|
- (void) beginArchiving
|
|
|
|
|
{
|
|
|
|
|
NSEnumerator *enumerator;
|
|
|
|
|
id<IBConnectors> con;
|
|
|
|
|
id obj;
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Map all connector sources and destinations to their name strings.
|
|
|
|
|
* Deactivate editors so they won't be archived.
|
|
|
|
|
*/
|
|
|
|
|
enumerator = [connections objectEnumerator];
|
|
|
|
|
while ((con = [enumerator nextObject]) != nil)
|
|
|
|
|
{
|
|
|
|
|
if ([con isKindOfClass: [GormObjectToEditor class]] == YES)
|
|
|
|
|
{
|
|
|
|
|
[savedEditors addObject: con];
|
|
|
|
|
[[con destination] deactivate];
|
|
|
|
|
}
|
|
|
|
|
else if ([con isKindOfClass: [GormEditorToParent class]] == YES)
|
|
|
|
|
{
|
|
|
|
|
[savedEditors addObject: con];
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
NSString *name;
|
|
|
|
|
|
|
|
|
|
obj = [con source];
|
|
|
|
|
name = [self nameForObject: obj];
|
|
|
|
|
[con setSource: name];
|
|
|
|
|
obj = [con destination];
|
|
|
|
|
name = [self nameForObject: obj];
|
|
|
|
|
[con setDestination: name];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
[connections removeObjectsInArray: savedEditors];
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Remove objects and connections that shouldn't be archived.
|
|
|
|
|
*/
|
2000-12-27 09:00:32 +00:00
|
|
|
|
NSMapRemove(objToName, (void*)[nameTable objectForKey: @"NSOwner"]);
|
2000-01-03 11:00:14 +00:00
|
|
|
|
[nameTable removeObjectForKey: @"NSOwner"];
|
2000-12-27 09:00:32 +00:00
|
|
|
|
NSMapRemove(objToName, (void*)[nameTable objectForKey: @"NSFirst"]);
|
2000-01-03 11:00:14 +00:00
|
|
|
|
[nameTable removeObjectForKey: @"NSFirst"];
|
|
|
|
|
if (fontManager != nil)
|
|
|
|
|
{
|
2000-12-27 09:00:32 +00:00
|
|
|
|
NSMapRemove(objToName, (void*)[nameTable objectForKey: @"NSFont"]);
|
2000-01-03 11:00:14 +00:00
|
|
|
|
[nameTable removeObjectForKey: @"NSFont"];
|
|
|
|
|
}
|
2001-06-20 16:00:19 +00:00
|
|
|
|
|
|
|
|
|
/* Add information about the NSOwner to the archive */
|
|
|
|
|
NSMapInsert(objToName, (void*)[filesOwner className], (void*)@"NSOwner");
|
2002-04-07 22:02:41 +00:00
|
|
|
|
[nameTable setObject: [filesOwner className] forKey: @"NSOwner"];
|
|
|
|
|
|
2000-01-03 11:00:14 +00:00
|
|
|
|
}
|
|
|
|
|
|
2001-05-08 09:43:11 +00:00
|
|
|
|
- (void) changeCurrentClass: (id)sender
|
|
|
|
|
{
|
|
|
|
|
int row = [classesView selectedRow];
|
|
|
|
|
id classes = [classManager allClassNames];
|
|
|
|
|
|
|
|
|
|
NSLog(@"Double Action");
|
|
|
|
|
|
2002-03-25 01:44:01 +00:00
|
|
|
|
if(row >= 0)
|
2001-05-08 09:43:11 +00:00
|
|
|
|
{
|
2002-03-25 01:44:01 +00:00
|
|
|
|
[classEditor setSelectedClassName: [classesView itemAtRow: row]];
|
2001-05-08 09:43:11 +00:00
|
|
|
|
[self setSelectionFromEditor: (id)classEditor];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
- (void) changeView: (id)sender
|
|
|
|
|
{
|
|
|
|
|
int tag = [[sender selectedCell] tag];
|
|
|
|
|
|
|
|
|
|
switch (tag)
|
|
|
|
|
{
|
|
|
|
|
case 0: // objects
|
|
|
|
|
[selectionBox setContentView: scrollView];
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case 3: // classes
|
|
|
|
|
[selectionBox setContentView: classesScrollView];
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
- (GormClassManager*) classManager
|
|
|
|
|
{
|
|
|
|
|
return classManager;
|
|
|
|
|
}
|
|
|
|
|
|
1999-12-13 17:01:35 +00:00
|
|
|
|
/*
|
|
|
|
|
* A Gorm document is encoded in the archive as a GSNibContainer ...
|
|
|
|
|
* A class that the gnustep gui library knbows about and can unarchive.
|
|
|
|
|
*/
|
|
|
|
|
- (Class) classForCoder
|
|
|
|
|
{
|
|
|
|
|
return [GSNibContainer class];
|
|
|
|
|
}
|
|
|
|
|
|
1999-12-08 15:04:57 +00:00
|
|
|
|
- (NSArray*) connectorsForDestination: (id)destination
|
|
|
|
|
{
|
|
|
|
|
return [self connectorsForDestination: destination ofClass: 0];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
- (NSArray*) connectorsForDestination: (id)destination
|
|
|
|
|
ofClass: (Class)aConnectorClass
|
|
|
|
|
{
|
|
|
|
|
NSMutableArray *array = [NSMutableArray arrayWithCapacity: 16];
|
|
|
|
|
NSEnumerator *enumerator = [connections objectEnumerator];
|
|
|
|
|
id<IBConnectors> c;
|
|
|
|
|
|
|
|
|
|
while ((c = [enumerator nextObject]) != nil)
|
|
|
|
|
{
|
|
|
|
|
if ([c destination] == destination
|
|
|
|
|
&& (aConnectorClass == 0 || aConnectorClass == [c class]))
|
|
|
|
|
{
|
|
|
|
|
[array addObject: c];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return array;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
- (NSArray*) connectorsForSource: (id)source
|
|
|
|
|
{
|
|
|
|
|
return [self connectorsForSource: source ofClass: 0];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
- (NSArray*) connectorsForSource: (id)source
|
|
|
|
|
ofClass: (Class)aConnectorClass
|
|
|
|
|
{
|
|
|
|
|
NSMutableArray *array = [NSMutableArray arrayWithCapacity: 16];
|
|
|
|
|
NSEnumerator *enumerator = [connections objectEnumerator];
|
|
|
|
|
id<IBConnectors> c;
|
|
|
|
|
|
|
|
|
|
while ((c = [enumerator nextObject]) != nil)
|
|
|
|
|
{
|
|
|
|
|
if ([c source] == source
|
|
|
|
|
&& (aConnectorClass == 0 || aConnectorClass == [c class]))
|
|
|
|
|
{
|
|
|
|
|
[array addObject: c];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return array;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
- (BOOL) containsObject: (id)anObject
|
|
|
|
|
{
|
|
|
|
|
if ([self nameForObject: anObject] == nil)
|
|
|
|
|
{
|
|
|
|
|
return NO;
|
|
|
|
|
}
|
|
|
|
|
return YES;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
- (BOOL) containsObjectWithName: (NSString*)aName forParent: (id)parent
|
|
|
|
|
{
|
|
|
|
|
id obj = [nameTable objectForKey: aName];
|
|
|
|
|
|
|
|
|
|
if (obj == nil)
|
|
|
|
|
{
|
|
|
|
|
return NO;
|
|
|
|
|
}
|
|
|
|
|
return YES;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
- (BOOL) copyObject: (id)anObject
|
|
|
|
|
type: (NSString*)aType
|
|
|
|
|
toPasteboard: (NSPasteboard*)aPasteboard
|
|
|
|
|
{
|
|
|
|
|
return [self copyObjects: [NSArray arrayWithObject: anObject]
|
|
|
|
|
type: aType
|
|
|
|
|
toPasteboard: aPasteboard];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
- (BOOL) copyObjects: (NSArray*)anArray
|
|
|
|
|
type: (NSString*)aType
|
|
|
|
|
toPasteboard: (NSPasteboard*)aPasteboard
|
|
|
|
|
{
|
2000-01-14 17:07:44 +00:00
|
|
|
|
NSEnumerator *enumerator;
|
|
|
|
|
NSMutableSet *editors;
|
|
|
|
|
id obj;
|
|
|
|
|
NSData *data;
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Remove all editors from the selected objects before archiving
|
|
|
|
|
* and restore them afterwards.
|
|
|
|
|
*/
|
|
|
|
|
editors = [NSMutableSet new];
|
|
|
|
|
enumerator = [anArray objectEnumerator];
|
|
|
|
|
while ((obj = [enumerator nextObject]) != nil)
|
|
|
|
|
{
|
|
|
|
|
id editor = [self editorForObject: obj create: NO];
|
|
|
|
|
|
|
|
|
|
if (editor != nil)
|
|
|
|
|
{
|
|
|
|
|
[editors addObject: editor];
|
|
|
|
|
[editor deactivate];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
data = [NSArchiver archivedDataWithRootObject: anArray];
|
|
|
|
|
enumerator = [editors objectEnumerator];
|
|
|
|
|
while ((obj = [enumerator nextObject]) != nil)
|
|
|
|
|
{
|
|
|
|
|
[obj activate];
|
|
|
|
|
}
|
|
|
|
|
RELEASE(editors);
|
1999-12-08 15:04:57 +00:00
|
|
|
|
|
|
|
|
|
[aPasteboard declareTypes: [NSArray arrayWithObject: aType]
|
|
|
|
|
owner: self];
|
2000-01-14 17:07:44 +00:00
|
|
|
|
return [aPasteboard setData: data forType: aType];
|
1999-12-08 15:04:57 +00:00
|
|
|
|
}
|
|
|
|
|
|
2001-05-08 09:43:11 +00:00
|
|
|
|
- (id) createSubclass: (id)sender
|
|
|
|
|
{
|
|
|
|
|
int i = [classesView selectedRow];
|
|
|
|
|
|
2002-07-14 23:54:05 +00:00
|
|
|
|
if(i >= 0 && ![classesView isEditing])
|
2001-05-08 09:43:11 +00:00
|
|
|
|
{
|
2002-03-25 01:44:01 +00:00
|
|
|
|
NSString *newClassName;
|
|
|
|
|
id itemSelected = [classesView itemAtRow: i];
|
|
|
|
|
|
2001-05-08 09:43:11 +00:00
|
|
|
|
newClassName = [classManager addClassWithSuperClassName:
|
2002-03-25 01:44:01 +00:00
|
|
|
|
itemSelected];
|
2002-07-22 15:24:37 +00:00
|
|
|
|
RETAIN(newClassName);
|
2001-05-08 09:43:11 +00:00
|
|
|
|
[classesView reloadData];
|
2002-03-25 01:44:01 +00:00
|
|
|
|
[classesView expandItem: itemSelected];
|
|
|
|
|
i = [classesView rowForItem: newClassName];
|
2001-05-08 09:43:11 +00:00
|
|
|
|
[classesView selectRow: i byExtendingSelection: NO];
|
|
|
|
|
[self editClass: self];
|
|
|
|
|
}
|
2002-03-25 01:44:01 +00:00
|
|
|
|
|
2001-06-20 16:00:19 +00:00
|
|
|
|
return self;
|
2001-05-08 09:43:11 +00:00
|
|
|
|
}
|
|
|
|
|
|
2000-01-14 13:34:15 +00:00
|
|
|
|
- (void) pasteboardChangedOwner: (NSPasteboard*)sender
|
|
|
|
|
{
|
2000-01-16 09:56:48 +00:00
|
|
|
|
NSDebugLog(@"Owner changed for %@", sender);
|
2000-01-14 13:34:15 +00:00
|
|
|
|
}
|
|
|
|
|
|
1999-12-08 15:04:57 +00:00
|
|
|
|
- (void) dealloc
|
|
|
|
|
{
|
1999-12-15 15:29:27 +00:00
|
|
|
|
[[NSNotificationCenter defaultCenter] removeObserver: self];
|
1999-12-14 19:55:18 +00:00
|
|
|
|
[window setDelegate: nil];
|
|
|
|
|
[window performClose: self];
|
2001-05-08 09:43:11 +00:00
|
|
|
|
RELEASE(classManager);
|
|
|
|
|
RELEASE(classEditor);
|
2000-02-03 17:04:37 +00:00
|
|
|
|
RELEASE(hidden);
|
1999-12-13 17:01:35 +00:00
|
|
|
|
RELEASE(filesOwner);
|
|
|
|
|
RELEASE(firstResponder);
|
|
|
|
|
RELEASE(fontManager);
|
1999-12-08 15:04:57 +00:00
|
|
|
|
NSFreeMapTable(objToName);
|
|
|
|
|
RELEASE(documentPath);
|
2000-01-03 11:00:14 +00:00
|
|
|
|
RELEASE(savedEditors);
|
2001-05-08 09:43:11 +00:00
|
|
|
|
RELEASE(scrollView);
|
|
|
|
|
RELEASE(classesScrollView);
|
1999-12-08 15:04:57 +00:00
|
|
|
|
[super dealloc];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
- (void) detachObject: (id)anObject
|
|
|
|
|
{
|
2001-07-10 05:40:15 +00:00
|
|
|
|
NSString *name = RETAIN([self nameForObject: anObject]);
|
2000-01-03 11:00:14 +00:00
|
|
|
|
unsigned count;
|
1999-12-08 15:04:57 +00:00
|
|
|
|
|
1999-12-14 17:38:17 +00:00
|
|
|
|
[[self editorForObject: anObject create: NO] close];
|
|
|
|
|
|
2000-01-03 11:00:14 +00:00
|
|
|
|
count = [connections count];
|
1999-12-08 15:04:57 +00:00
|
|
|
|
while (count-- > 0)
|
|
|
|
|
{
|
|
|
|
|
id<IBConnectors> con = [connections objectAtIndex: count];
|
|
|
|
|
|
|
|
|
|
if ([con destination] == anObject || [con source] == anObject)
|
|
|
|
|
{
|
|
|
|
|
[connections removeObjectAtIndex: count];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
NSMapRemove(objToName, (void*)anObject);
|
1999-12-13 17:01:35 +00:00
|
|
|
|
if ([anObject isKindOfClass: [NSWindow class]] == YES
|
|
|
|
|
|| [anObject isKindOfClass: [NSMenu class]] == YES)
|
1999-12-08 15:04:57 +00:00
|
|
|
|
{
|
1999-12-14 19:55:18 +00:00
|
|
|
|
[objectsView removeObject: anObject];
|
1999-12-08 15:04:57 +00:00
|
|
|
|
}
|
2000-01-03 11:00:14 +00:00
|
|
|
|
/*
|
|
|
|
|
* Make sure this object isn't in the list of objects to be made visible
|
|
|
|
|
* on nib loading.
|
|
|
|
|
*/
|
|
|
|
|
[self setObject: anObject isVisibleAtLaunch: NO];
|
|
|
|
|
|
1999-12-08 15:04:57 +00:00
|
|
|
|
[nameTable removeObjectForKey: name];
|
2001-07-10 05:40:15 +00:00
|
|
|
|
RELEASE(name);
|
1999-12-08 15:04:57 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
- (void) detachObjects: (NSArray*)anArray
|
|
|
|
|
{
|
|
|
|
|
NSEnumerator *enumerator = [anArray objectEnumerator];
|
|
|
|
|
NSObject *obj;
|
|
|
|
|
|
|
|
|
|
while ((obj = [enumerator nextObject]) != nil)
|
|
|
|
|
{
|
|
|
|
|
[self detachObject: obj];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
- (NSString*) documentPath
|
|
|
|
|
{
|
|
|
|
|
return documentPath;
|
|
|
|
|
}
|
|
|
|
|
|
2001-12-19 07:13:54 +00:00
|
|
|
|
- (id) parseHeader: (NSString *)headerPath
|
|
|
|
|
{
|
|
|
|
|
NSString *headerFile = [NSString stringWithContentsOfFile: headerPath];
|
|
|
|
|
NSScanner *headerScanner = [NSScanner scannerWithString: headerFile];
|
|
|
|
|
GormClassManager *cm = [self classManager];
|
|
|
|
|
|
|
|
|
|
while(![headerScanner isAtEnd])
|
|
|
|
|
{
|
|
|
|
|
NSScanner *classScanner = nil;
|
|
|
|
|
NSString *classString = nil;
|
|
|
|
|
BOOL classfound = NO, result = NO;
|
|
|
|
|
NSArray *outletTokens = [NSArray arrayWithObjects: @"id", @"IBOutlet", nil];
|
|
|
|
|
NSArray *actionTokens = [NSArray arrayWithObjects: @"(void)", @"(IBAction)", nil];
|
|
|
|
|
NSEnumerator *outletEnum = [outletTokens objectEnumerator];
|
|
|
|
|
NSEnumerator *actionEnum = [actionTokens objectEnumerator];
|
|
|
|
|
NSString *outletToken = nil;
|
|
|
|
|
NSString *actionToken = nil;
|
|
|
|
|
|
|
|
|
|
classfound = [headerScanner scanUpToString: @"@interface"
|
|
|
|
|
intoString: nil];
|
|
|
|
|
|
|
|
|
|
[headerScanner scanUpToString: @"@end"
|
|
|
|
|
intoString: &classString];
|
|
|
|
|
|
|
|
|
|
if(classfound && ![headerScanner isAtEnd])
|
|
|
|
|
{
|
|
|
|
|
NSString
|
|
|
|
|
*className = nil,
|
|
|
|
|
*superClassName = nil,
|
|
|
|
|
*ivarString = nil,
|
|
|
|
|
*methodString = nil;
|
|
|
|
|
NSScanner
|
|
|
|
|
*classScanner = [NSScanner scannerWithString: classString],
|
|
|
|
|
*ivarScanner = nil,
|
|
|
|
|
*methodScanner = nil;
|
|
|
|
|
NSCharacterSet *stopSet = [NSCharacterSet characterSetWithCharactersInString: @" :"];
|
|
|
|
|
NSMutableArray
|
|
|
|
|
*actions = [NSMutableArray array],
|
|
|
|
|
*outlets = [NSMutableArray array];
|
|
|
|
|
|
|
|
|
|
[classScanner scanString: @"@interface"
|
|
|
|
|
intoString: nil];
|
|
|
|
|
[classScanner scanUpToCharactersFromSet: stopSet
|
|
|
|
|
intoString: &className];
|
|
|
|
|
[classScanner scanString: @":"
|
|
|
|
|
intoString: nil];
|
|
|
|
|
[classScanner scanUpToString: @"\n"
|
|
|
|
|
intoString: &superClassName];
|
|
|
|
|
[classScanner scanUpToString: @"{"
|
|
|
|
|
intoString: nil];
|
|
|
|
|
[classScanner scanUpToString: @"}"
|
|
|
|
|
intoString: &ivarString];
|
|
|
|
|
[classScanner scanUpToString: @"@end"
|
|
|
|
|
intoString: &methodString];
|
|
|
|
|
NSDebugLog(@"Found a class \"%@\" with super class \"%@\"", className,
|
|
|
|
|
superClassName);
|
|
|
|
|
|
|
|
|
|
// Interate over the possible tokens which can make an
|
|
|
|
|
// ivar an outlet.
|
|
|
|
|
while((outletToken = [outletEnum nextObject]) != nil)
|
|
|
|
|
{
|
|
|
|
|
NSDebugLog(@"outlet Token = %@",outletToken);
|
|
|
|
|
// Scan the variables of the class...
|
|
|
|
|
ivarScanner = [NSScanner scannerWithString: ivarString];
|
|
|
|
|
while(![ivarScanner isAtEnd])
|
|
|
|
|
{
|
|
|
|
|
NSString *outlet = nil;
|
|
|
|
|
|
|
|
|
|
[ivarScanner scanUpToString: outletToken
|
|
|
|
|
intoString: nil];
|
|
|
|
|
[ivarScanner scanString: outletToken
|
|
|
|
|
intoString: nil];
|
|
|
|
|
[ivarScanner scanUpToString: @";"
|
|
|
|
|
intoString: &outlet];
|
|
|
|
|
if(![ivarScanner isAtEnd])
|
|
|
|
|
{
|
|
|
|
|
NSDebugLog(@"outlet = %@",outlet);
|
|
|
|
|
[outlets addObject: outlet];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
while((actionToken = [actionEnum nextObject]) != nil)
|
|
|
|
|
{
|
|
|
|
|
NSDebugLog(@"Action token %@",actionToken);
|
|
|
|
|
methodScanner = [NSScanner scannerWithString: methodString];
|
|
|
|
|
while(![methodScanner isAtEnd])
|
|
|
|
|
{
|
|
|
|
|
NSString *action = nil;
|
|
|
|
|
BOOL hasArguments = NO;
|
|
|
|
|
NSCharacterSet *stopSet = [NSCharacterSet characterSetWithCharactersInString: @";:"];
|
|
|
|
|
|
|
|
|
|
// Scan the method name
|
|
|
|
|
[methodScanner scanUpToString: actionToken
|
|
|
|
|
intoString: nil];
|
|
|
|
|
[methodScanner scanString: actionToken
|
|
|
|
|
intoString: nil];
|
|
|
|
|
[methodScanner scanUpToCharactersFromSet: stopSet
|
|
|
|
|
intoString: &action];
|
|
|
|
|
|
|
|
|
|
// This will return true if the method has args.
|
|
|
|
|
hasArguments = [methodScanner scanString: @":"
|
|
|
|
|
intoString: nil];
|
|
|
|
|
|
|
|
|
|
if(hasArguments)
|
|
|
|
|
{
|
|
|
|
|
BOOL isAction = NO;
|
|
|
|
|
NSString *argType = nil;
|
|
|
|
|
|
|
|
|
|
// If the argument is (id) then the method can
|
|
|
|
|
// be considered an action and we add it to the list.
|
|
|
|
|
isAction = [methodScanner scanString: @"(id)"
|
|
|
|
|
intoString: &argType];
|
|
|
|
|
|
|
|
|
|
if(![methodScanner isAtEnd])
|
|
|
|
|
{
|
|
|
|
|
if(isAction)
|
|
|
|
|
{
|
|
|
|
|
NSDebugLog(@"action = %@",action);
|
|
|
|
|
[actions addObject: action];
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
NSDebugLog(@"Not an action");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} // end while
|
|
|
|
|
} // end while
|
|
|
|
|
|
|
|
|
|
result = [cm addClassNamed: className
|
|
|
|
|
withSuperClassNamed: superClassName
|
|
|
|
|
withActions: actions
|
|
|
|
|
withOutlets: outlets];
|
|
|
|
|
if(result)
|
|
|
|
|
{
|
|
|
|
|
NSLog(@"Class %@ added", className);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
NSLog(@"Class %@ failed to add", className);
|
|
|
|
|
}
|
|
|
|
|
} // if we found a class
|
|
|
|
|
}
|
|
|
|
|
return self;
|
|
|
|
|
}
|
|
|
|
|
|
2002-07-09 13:30:59 +00:00
|
|
|
|
- (id) addAttributeToClass: (id)sender
|
|
|
|
|
{
|
|
|
|
|
[classesView addAttributeToClass];
|
|
|
|
|
return self;
|
|
|
|
|
}
|
|
|
|
|
|
2002-07-15 05:58:01 +00:00
|
|
|
|
- (id) remove: (id)sender
|
2002-07-12 05:46:29 +00:00
|
|
|
|
{
|
2002-07-22 15:24:37 +00:00
|
|
|
|
int i = [classesView selectedRow];
|
|
|
|
|
id anitem = [classesView itemAtRow: i];
|
|
|
|
|
if([anitem isKindOfClass: [GormOutletActionHolder class]])
|
|
|
|
|
{
|
|
|
|
|
id itemBeingEdited = [classesView itemBeingEdited];
|
|
|
|
|
|
|
|
|
|
// if the class being edited is a custom class, then allow the deletion...
|
|
|
|
|
if([classManager isCustomClass: itemBeingEdited])
|
|
|
|
|
{
|
|
|
|
|
if([classesView editType] == Actions)
|
|
|
|
|
{
|
|
|
|
|
// if this action is an action on the class, not it's superclass
|
|
|
|
|
// allow the deletion...
|
|
|
|
|
if([classManager isAction: [anitem getName]
|
|
|
|
|
ofClass: itemBeingEdited])
|
|
|
|
|
{
|
|
|
|
|
[classManager removeAction: [anitem getName]
|
|
|
|
|
fromClassNamed: itemBeingEdited];
|
|
|
|
|
[classesView removeItemAtRow: i];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else if([classesView editType] == Outlets)
|
|
|
|
|
{
|
|
|
|
|
// if this outlet is an outlet on the class, not it's superclass
|
|
|
|
|
// allow the deletion...
|
|
|
|
|
if([classManager isOutlet: [anitem getName]
|
|
|
|
|
ofClass: itemBeingEdited])
|
|
|
|
|
{
|
|
|
|
|
[classManager removeOutlet: [anitem getName]
|
|
|
|
|
fromClassNamed: itemBeingEdited];
|
|
|
|
|
[classesView removeItemAtRow: i];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
NSArray *subclasses = [classManager subClassesOf: anitem];
|
|
|
|
|
// if the class has no subclasses, then delete.
|
|
|
|
|
if([subclasses count] == 0)
|
|
|
|
|
{
|
|
|
|
|
// if the class being edited is a custom class, then allow the deletion...
|
|
|
|
|
if([classManager isCustomClass: anitem])
|
|
|
|
|
{
|
|
|
|
|
[classManager removeClassNamed: anitem];
|
|
|
|
|
[classesView reloadData];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
NSString *message = [NSString stringWithFormat:
|
|
|
|
|
@"The class %@ has subclasses which must be removed",
|
|
|
|
|
anitem];
|
|
|
|
|
NSRunAlertPanel(@"Problem removing class",
|
|
|
|
|
message,
|
|
|
|
|
nil, nil, nil);
|
|
|
|
|
}
|
|
|
|
|
}
|
2002-07-12 05:46:29 +00:00
|
|
|
|
return self;
|
|
|
|
|
}
|
|
|
|
|
|
2001-12-19 07:13:54 +00:00
|
|
|
|
- (id) loadClass: (id)sender
|
|
|
|
|
{
|
|
|
|
|
NSArray *fileTypes = [NSArray arrayWithObjects: @"h", @"H", nil];
|
|
|
|
|
NSOpenPanel *oPanel = [NSOpenPanel openPanel];
|
|
|
|
|
int result;
|
|
|
|
|
|
|
|
|
|
[oPanel setAllowsMultipleSelection: NO];
|
|
|
|
|
[oPanel setCanChooseFiles: YES];
|
|
|
|
|
[oPanel setCanChooseDirectories: NO];
|
|
|
|
|
result = [oPanel runModalForDirectory: nil
|
|
|
|
|
file: nil
|
|
|
|
|
types: fileTypes];
|
|
|
|
|
if (result == NSOKButton)
|
|
|
|
|
{
|
|
|
|
|
return [self parseHeader: [oPanel filename]];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return nil;
|
|
|
|
|
}
|
|
|
|
|
|
2001-05-08 09:43:11 +00:00
|
|
|
|
- (id) editClass: (id)sender
|
|
|
|
|
{
|
|
|
|
|
[self changeCurrentClass: sender];
|
|
|
|
|
|
|
|
|
|
return self;
|
|
|
|
|
}
|
|
|
|
|
|
2001-07-06 17:10:51 +00:00
|
|
|
|
- (id) createClassFiles: (id)sender
|
|
|
|
|
{
|
|
|
|
|
NSSavePanel *sp;
|
|
|
|
|
int row = [classesView selectedRow];
|
|
|
|
|
id classes = [classManager allClassNames];
|
|
|
|
|
int result;
|
|
|
|
|
|
|
|
|
|
sp = [NSSavePanel savePanel];
|
|
|
|
|
[sp setRequiredFileType: @"m"];
|
|
|
|
|
[sp setTitle: @"Save source file as..."];
|
|
|
|
|
if (documentPath == nil)
|
|
|
|
|
result = [sp runModalForDirectory: NSHomeDirectory() file: @""];
|
|
|
|
|
else
|
|
|
|
|
result = [sp runModalForDirectory:
|
|
|
|
|
[documentPath stringByDeletingLastPathComponent]
|
|
|
|
|
file: @""];
|
|
|
|
|
|
|
|
|
|
if (result == NSOKButton)
|
|
|
|
|
{
|
|
|
|
|
NSString *sourceName = [sp filename];
|
|
|
|
|
NSString *headerName;
|
|
|
|
|
|
|
|
|
|
[sp setRequiredFileType: @"h"];
|
|
|
|
|
[sp setTitle: @"Save header file as..."];
|
|
|
|
|
result = [sp runModalForDirectory:
|
|
|
|
|
[sourceName stringByDeletingLastPathComponent]
|
|
|
|
|
file:
|
|
|
|
|
[[[sourceName lastPathComponent]
|
|
|
|
|
stringByDeletingPathExtension]
|
|
|
|
|
stringByAppendingString: @".h"]];
|
|
|
|
|
if (result == NSOKButton)
|
|
|
|
|
{
|
|
|
|
|
headerName = [sp filename];
|
|
|
|
|
|
|
|
|
|
NSLog(@"createClassFiles");
|
2002-03-25 01:44:01 +00:00
|
|
|
|
if (row >= 0)
|
2001-07-06 17:10:51 +00:00
|
|
|
|
{
|
2002-03-25 01:44:01 +00:00
|
|
|
|
NSLog([classesView itemAtRow: row]);
|
2001-07-06 17:10:51 +00:00
|
|
|
|
if (![classManager
|
|
|
|
|
makeSourceAndHeaderFilesForClass:
|
2002-03-25 01:44:01 +00:00
|
|
|
|
[classesView itemAtRow: row]
|
2001-07-06 17:10:51 +00:00
|
|
|
|
withName: sourceName
|
|
|
|
|
and: headerName])
|
|
|
|
|
{
|
|
|
|
|
NSRunAlertPanel(@"Alert",
|
|
|
|
|
@"Could not create the class's file",
|
|
|
|
|
nil, nil, nil);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return self;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return nil;
|
|
|
|
|
}
|
|
|
|
|
|
2000-01-04 16:25:39 +00:00
|
|
|
|
- (void) editor: (id<IBEditors>)anEditor didCloseForObject: (id)anObject
|
|
|
|
|
{
|
|
|
|
|
NSArray *links;
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* If there is a link from this editor to a parent, remove it.
|
|
|
|
|
*/
|
|
|
|
|
links = [self connectorsForSource: anEditor
|
|
|
|
|
ofClass: [GormEditorToParent class]];
|
|
|
|
|
NSAssert([links count] < 2, NSInternalInconsistencyException);
|
|
|
|
|
if ([links count] == 1)
|
|
|
|
|
{
|
|
|
|
|
[connections removeObjectIdenticalTo: [links objectAtIndex: 0]];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Remove the connection linking the object to this editor
|
|
|
|
|
*/
|
|
|
|
|
links = [self connectorsForSource: anObject
|
|
|
|
|
ofClass: [GormObjectToEditor class]];
|
|
|
|
|
NSAssert([links count] < 2, NSInternalInconsistencyException);
|
|
|
|
|
[connections removeObjectIdenticalTo: [links objectAtIndex: 0]];
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Make sure that this editor is not the selection owner.
|
|
|
|
|
*/
|
|
|
|
|
if ([(id<IB>)NSApp selectionOwner] == anEditor)
|
|
|
|
|
{
|
|
|
|
|
[self resignSelectionForEditor: anEditor];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
- (id<IBEditors>) editorForObject: (id)anObject
|
|
|
|
|
create: (BOOL)flag
|
|
|
|
|
{
|
|
|
|
|
return [self editorForObject: anObject inEditor: nil create: flag];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
- (id<IBEditors>) editorForObject: (id)anObject
|
|
|
|
|
inEditor: (id<IBEditors>)anEditor
|
|
|
|
|
create: (BOOL)flag
|
|
|
|
|
{
|
|
|
|
|
NSArray *links;
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Look up the editor links for the object to see if it already has an
|
|
|
|
|
* editor. If it does return it, otherwise create a new editor and a
|
|
|
|
|
* link to it if the flag is set.
|
|
|
|
|
*/
|
|
|
|
|
links = [self connectorsForSource: anObject
|
|
|
|
|
ofClass: [GormObjectToEditor class]];
|
|
|
|
|
if ([links count] == 0 && flag == YES)
|
|
|
|
|
{
|
|
|
|
|
Class eClass;
|
|
|
|
|
id<IBEditors> editor;
|
|
|
|
|
id<IBConnectors> link;
|
|
|
|
|
|
|
|
|
|
eClass = NSClassFromString([anObject editorClassName]);
|
|
|
|
|
editor = [[eClass alloc] initWithObject: anObject inDocument: self];
|
|
|
|
|
link = [GormObjectToEditor new];
|
|
|
|
|
[link setSource: anObject];
|
|
|
|
|
[link setDestination: editor];
|
|
|
|
|
[connections addObject: link];
|
|
|
|
|
RELEASE(link);
|
2000-01-14 13:34:15 +00:00
|
|
|
|
if (anEditor == nil)
|
|
|
|
|
{
|
|
|
|
|
/*
|
|
|
|
|
* By default all editors are owned by the top-level editor of
|
|
|
|
|
* the document.
|
|
|
|
|
*/
|
|
|
|
|
anEditor = objectsView;
|
|
|
|
|
}
|
|
|
|
|
if (anEditor != editor)
|
2000-01-04 16:25:39 +00:00
|
|
|
|
{
|
|
|
|
|
/*
|
2000-01-14 13:34:15 +00:00
|
|
|
|
* Link to the parent of the editor.
|
2000-01-04 16:25:39 +00:00
|
|
|
|
*/
|
|
|
|
|
link = [GormEditorToParent new];
|
|
|
|
|
[link setSource: editor];
|
|
|
|
|
[link setDestination: anEditor];
|
|
|
|
|
[connections addObject: link];
|
|
|
|
|
RELEASE(link);
|
|
|
|
|
}
|
|
|
|
|
RELEASE(editor);
|
|
|
|
|
return editor;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
return [[links lastObject] destination];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2000-01-03 11:00:14 +00:00
|
|
|
|
- (void) endArchiving
|
|
|
|
|
{
|
|
|
|
|
NSEnumerator *enumerator;
|
|
|
|
|
id<IBConnectors> con;
|
|
|
|
|
id obj;
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Restore removed objects.
|
|
|
|
|
*/
|
2000-12-27 09:00:32 +00:00
|
|
|
|
NSMapRemove(objToName, (void*)[nameTable objectForKey: @"NSOwner"]);
|
2000-01-03 11:00:14 +00:00
|
|
|
|
[nameTable setObject: filesOwner forKey: @"NSOwner"];
|
2000-12-27 09:00:32 +00:00
|
|
|
|
NSMapInsert(objToName, (void*)filesOwner, (void*)@"NSOwner");
|
|
|
|
|
NSMapRemove(objToName, (void*)[nameTable objectForKey: @"NSFirst"]);
|
2000-01-03 11:00:14 +00:00
|
|
|
|
[nameTable setObject: firstResponder forKey: @"NSFirst"];
|
2000-12-27 09:00:32 +00:00
|
|
|
|
NSMapInsert(objToName, (void*)firstResponder, (void*)@"NSFirst");
|
2000-01-03 11:00:14 +00:00
|
|
|
|
if (fontManager != nil)
|
|
|
|
|
{
|
2000-12-27 09:00:32 +00:00
|
|
|
|
NSMapRemove(objToName, (void*)[nameTable objectForKey: @"NSFont"]);
|
2000-01-03 11:00:14 +00:00
|
|
|
|
[nameTable setObject: fontManager forKey: @"NSFont"];
|
2000-12-27 09:00:32 +00:00
|
|
|
|
NSMapInsert(objToName, (void*)fontManager, (void*)@"NSFont");
|
2000-01-03 11:00:14 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Map all connector source and destination names to their objects.
|
|
|
|
|
*/
|
|
|
|
|
enumerator = [connections objectEnumerator];
|
|
|
|
|
while ((con = [enumerator nextObject]) != nil)
|
|
|
|
|
{
|
|
|
|
|
NSString *name;
|
|
|
|
|
|
|
|
|
|
name = (NSString*)[con source];
|
|
|
|
|
obj = [self objectForName: name];
|
|
|
|
|
[con setSource: obj];
|
|
|
|
|
name = (NSString*)[con destination];
|
|
|
|
|
obj = [self objectForName: name];
|
|
|
|
|
[con setDestination: obj];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Restore editor links and reactivate the editors.
|
|
|
|
|
*/
|
|
|
|
|
[connections addObjectsFromArray: savedEditors];
|
|
|
|
|
enumerator = [savedEditors objectEnumerator];
|
|
|
|
|
while ((con = [enumerator nextObject]) != nil)
|
|
|
|
|
{
|
|
|
|
|
[[con destination] activate];
|
|
|
|
|
}
|
|
|
|
|
[savedEditors removeAllObjects];
|
|
|
|
|
}
|
|
|
|
|
|
1999-12-14 19:55:18 +00:00
|
|
|
|
- (void) handleNotification: (NSNotification*)aNotification
|
1999-12-08 15:04:57 +00:00
|
|
|
|
{
|
1999-12-15 15:29:27 +00:00
|
|
|
|
NSString *name = [aNotification name];
|
|
|
|
|
|
|
|
|
|
if ([name isEqual: NSWindowWillCloseNotification] == YES)
|
1999-12-08 15:04:57 +00:00
|
|
|
|
{
|
1999-12-14 19:55:18 +00:00
|
|
|
|
NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];
|
|
|
|
|
NSEnumerator *enumerator;
|
|
|
|
|
id obj;
|
1999-12-08 15:04:57 +00:00
|
|
|
|
|
1999-12-14 19:55:18 +00:00
|
|
|
|
[nc postNotificationName: IBWillCloseDocumentNotification
|
|
|
|
|
object: self];
|
2000-01-04 16:25:39 +00:00
|
|
|
|
|
1999-12-14 19:55:18 +00:00
|
|
|
|
enumerator = [nameTable objectEnumerator];
|
|
|
|
|
while ((obj = [enumerator nextObject]) != nil)
|
1999-12-08 15:04:57 +00:00
|
|
|
|
{
|
2001-11-03 06:04:57 +00:00
|
|
|
|
if ([obj isKindOfClass: [NSMenu class]] == YES)
|
1999-12-14 19:55:18 +00:00
|
|
|
|
{
|
2001-11-03 06:04:57 +00:00
|
|
|
|
if ([[obj window] isVisible] == YES)
|
|
|
|
|
{
|
|
|
|
|
[hidden addObject: obj];
|
|
|
|
|
[obj close];
|
|
|
|
|
}
|
1999-12-14 19:55:18 +00:00
|
|
|
|
}
|
2001-11-03 06:04:57 +00:00
|
|
|
|
else if ([obj isKindOfClass: [NSWindow class]] == YES)
|
2000-01-04 16:25:39 +00:00
|
|
|
|
{
|
2001-11-03 06:04:57 +00:00
|
|
|
|
if ([obj isVisible] == YES)
|
|
|
|
|
{
|
|
|
|
|
[hidden addObject: obj];
|
|
|
|
|
[obj orderOut: self];
|
|
|
|
|
}
|
2000-01-04 16:25:39 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2001-11-03 06:04:57 +00:00
|
|
|
|
[self setDocumentActive: NO];
|
2000-01-04 16:25:39 +00:00
|
|
|
|
}
|
|
|
|
|
else if ([name isEqual: NSWindowDidBecomeKeyNotification] == YES)
|
|
|
|
|
{
|
|
|
|
|
[self setDocumentActive: YES];
|
|
|
|
|
}
|
|
|
|
|
else if ([name isEqual: NSWindowWillMiniaturizeNotification] == YES)
|
|
|
|
|
{
|
1999-12-14 19:55:18 +00:00
|
|
|
|
[self setDocumentActive: NO];
|
1999-12-08 15:04:57 +00:00
|
|
|
|
}
|
2000-01-04 16:25:39 +00:00
|
|
|
|
else if ([name isEqual: NSWindowDidDeminiaturizeNotification] == YES)
|
|
|
|
|
{
|
|
|
|
|
[self setDocumentActive: YES];
|
|
|
|
|
}
|
1999-12-15 15:29:27 +00:00
|
|
|
|
else if ([name isEqual: IBWillBeginTestingInterfaceNotification] == YES)
|
|
|
|
|
{
|
|
|
|
|
if ([window isVisible] == YES)
|
|
|
|
|
{
|
2000-02-03 17:04:37 +00:00
|
|
|
|
[hidden addObject: window];
|
1999-12-15 15:29:27 +00:00
|
|
|
|
[window setExcludedFromWindowsMenu: YES];
|
|
|
|
|
[window orderOut: self];
|
2000-02-03 17:04:37 +00:00
|
|
|
|
}
|
|
|
|
|
if ([(id<IB>)NSApp activeDocument] == self)
|
|
|
|
|
{
|
|
|
|
|
NSEnumerator *enumerator;
|
|
|
|
|
id obj;
|
|
|
|
|
|
|
|
|
|
enumerator = [nameTable objectEnumerator];
|
|
|
|
|
while ((obj = [enumerator nextObject]) != nil)
|
1999-12-15 15:29:27 +00:00
|
|
|
|
{
|
2000-02-03 17:04:37 +00:00
|
|
|
|
if ([obj isKindOfClass: [NSMenu class]] == YES)
|
1999-12-15 15:29:27 +00:00
|
|
|
|
{
|
2000-02-03 17:04:37 +00:00
|
|
|
|
if ([[obj window] isVisible] == YES)
|
1999-12-15 15:29:27 +00:00
|
|
|
|
{
|
2000-02-03 17:04:37 +00:00
|
|
|
|
[hidden addObject: obj];
|
|
|
|
|
[obj close];
|
1999-12-15 15:29:27 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2000-02-03 17:04:37 +00:00
|
|
|
|
else if ([obj isKindOfClass: [NSWindow class]] == YES)
|
1999-12-15 15:29:27 +00:00
|
|
|
|
{
|
2000-02-03 17:04:37 +00:00
|
|
|
|
if ([obj isVisible] == YES)
|
|
|
|
|
{
|
|
|
|
|
[hidden addObject: obj];
|
|
|
|
|
[obj orderOut: self];
|
|
|
|
|
}
|
1999-12-15 15:29:27 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else if ([name isEqual: IBWillEndTestingInterfaceNotification] == YES)
|
|
|
|
|
{
|
2000-02-03 17:04:37 +00:00
|
|
|
|
if ([hidden count] > 0)
|
1999-12-15 15:29:27 +00:00
|
|
|
|
{
|
2000-02-03 17:04:37 +00:00
|
|
|
|
NSEnumerator *enumerator;
|
|
|
|
|
id obj;
|
1999-12-15 15:29:27 +00:00
|
|
|
|
|
2000-02-03 17:04:37 +00:00
|
|
|
|
enumerator = [hidden objectEnumerator];
|
|
|
|
|
while ((obj = [enumerator nextObject]) != nil)
|
|
|
|
|
{
|
|
|
|
|
if ([obj isKindOfClass: [NSMenu class]] == YES)
|
|
|
|
|
{
|
|
|
|
|
[obj display];
|
|
|
|
|
}
|
|
|
|
|
else if ([obj isKindOfClass: [NSWindow class]] == YES)
|
1999-12-15 15:29:27 +00:00
|
|
|
|
{
|
2000-02-03 17:04:37 +00:00
|
|
|
|
[obj orderFront: self];
|
1999-12-15 15:29:27 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2000-02-03 17:04:37 +00:00
|
|
|
|
[hidden removeAllObjects];
|
1999-12-15 15:29:27 +00:00
|
|
|
|
[window setExcludedFromWindowsMenu: NO];
|
|
|
|
|
}
|
|
|
|
|
}
|
2001-05-08 09:43:11 +00:00
|
|
|
|
else if ([name isEqual: IBClassNameChangedNotification] == YES)
|
|
|
|
|
{
|
|
|
|
|
if ([aNotification object] == classManager) [classesView reloadData];
|
|
|
|
|
}
|
1999-12-08 15:04:57 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
- (id) init
|
|
|
|
|
{
|
|
|
|
|
self = [super init];
|
|
|
|
|
if (self != nil)
|
|
|
|
|
{
|
1999-12-14 19:55:18 +00:00
|
|
|
|
NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];
|
|
|
|
|
NSRect winrect = NSMakeRect(100,100,340,252);
|
|
|
|
|
NSRect selectionRect = {{0, 188}, {240, 64}};
|
|
|
|
|
NSRect scrollRect = {{0, 0}, {340, 188}};
|
|
|
|
|
NSRect mainRect = {{20, 0}, {320, 188}};
|
|
|
|
|
NSImage *image;
|
|
|
|
|
NSButtonCell *cell;
|
2001-05-08 09:43:11 +00:00
|
|
|
|
NSTableColumn *tableColumn;
|
1999-12-14 19:55:18 +00:00
|
|
|
|
unsigned style;
|
2002-07-08 04:45:23 +00:00
|
|
|
|
NSColor *salmonColor =
|
|
|
|
|
[NSColor colorWithCalibratedRed: 0.850980
|
|
|
|
|
green: 0.737255
|
|
|
|
|
blue: 0.576471
|
|
|
|
|
alpha: 1.0 ];
|
|
|
|
|
NSColor *darkSalmonColor =
|
|
|
|
|
[NSColor colorWithCalibratedRed: 0.568627
|
|
|
|
|
green: 0.494118
|
|
|
|
|
blue: 0.384314
|
|
|
|
|
alpha: 1.0 ];
|
|
|
|
|
NSColor *lightGreyBlueColor =
|
|
|
|
|
[NSColor colorWithCalibratedRed: 0.450980
|
|
|
|
|
green: 0.450980
|
|
|
|
|
blue: 0.521569
|
|
|
|
|
alpha: 1.0 ];
|
|
|
|
|
NSColor *darkGreyBlueColor =
|
|
|
|
|
[NSColor colorWithCalibratedRed: 0.333333
|
|
|
|
|
green: 0.333333
|
|
|
|
|
blue: 0.384314
|
|
|
|
|
alpha: 1.0 ];
|
1999-12-14 19:55:18 +00:00
|
|
|
|
|
2001-05-08 09:43:11 +00:00
|
|
|
|
classManager = [[GormClassManager alloc] init];
|
|
|
|
|
classEditor = [[GormClassEditor alloc] initWithDocument: self];
|
2000-12-27 09:00:32 +00:00
|
|
|
|
/*
|
|
|
|
|
* NB. We must retain the map values (object names) as the nameTable
|
|
|
|
|
* may not hold identical name objects, but merely equal strings.
|
|
|
|
|
*/
|
1999-12-08 15:04:57 +00:00
|
|
|
|
objToName = NSCreateMapTableWithZone(NSNonRetainedObjectMapKeyCallBacks,
|
2000-12-27 09:00:32 +00:00
|
|
|
|
NSObjectMapValueCallBacks, 128, [self zone]);
|
1999-12-13 17:01:35 +00:00
|
|
|
|
|
2000-01-03 11:00:14 +00:00
|
|
|
|
savedEditors = [NSMutableArray new];
|
1999-12-14 19:55:18 +00:00
|
|
|
|
|
|
|
|
|
style = NSTitledWindowMask | NSClosableWindowMask
|
|
|
|
|
| NSResizableWindowMask | NSMiniaturizableWindowMask;
|
|
|
|
|
window = [[NSWindow alloc] initWithContentRect: winrect
|
|
|
|
|
styleMask: style
|
|
|
|
|
backing: NSBackingStoreRetained
|
|
|
|
|
defer: NO];
|
|
|
|
|
[window setMinSize: [window frame].size];
|
|
|
|
|
[window setTitle: @"UNTITLED"];
|
|
|
|
|
|
|
|
|
|
[window setDelegate: self];
|
2000-01-04 16:25:39 +00:00
|
|
|
|
|
1999-12-14 19:55:18 +00:00
|
|
|
|
[nc addObserver: self
|
|
|
|
|
selector: @selector(handleNotification:)
|
|
|
|
|
name: NSWindowWillCloseNotification
|
|
|
|
|
object: window];
|
2000-01-04 16:25:39 +00:00
|
|
|
|
[nc addObserver: self
|
|
|
|
|
selector: @selector(handleNotification:)
|
|
|
|
|
name: NSWindowDidBecomeKeyNotification
|
|
|
|
|
object: window];
|
|
|
|
|
[nc addObserver: self
|
|
|
|
|
selector: @selector(handleNotification:)
|
|
|
|
|
name: NSWindowWillMiniaturizeNotification
|
|
|
|
|
object: window];
|
|
|
|
|
[nc addObserver: self
|
|
|
|
|
selector: @selector(handleNotification:)
|
|
|
|
|
name: NSWindowDidDeminiaturizeNotification
|
|
|
|
|
object: window];
|
2001-05-08 09:43:11 +00:00
|
|
|
|
[nc addObserver: self
|
|
|
|
|
selector: @selector(handleNotification:)
|
|
|
|
|
name: IBClassNameChangedNotification
|
|
|
|
|
object: nil];
|
1999-12-14 19:55:18 +00:00
|
|
|
|
|
|
|
|
|
selectionView = [[NSMatrix alloc] initWithFrame: selectionRect
|
|
|
|
|
mode: NSRadioModeMatrix
|
|
|
|
|
cellClass: [NSButtonCell class]
|
|
|
|
|
numberOfRows: 1
|
|
|
|
|
numberOfColumns: 4];
|
|
|
|
|
[selectionView setTarget: self];
|
|
|
|
|
[selectionView setAction: @selector(changeView:)];
|
|
|
|
|
[selectionView setAutosizesCells: NO];
|
|
|
|
|
[selectionView setCellSize: NSMakeSize(64,64)];
|
|
|
|
|
[selectionView setIntercellSpacing: NSMakeSize(28,0)];
|
|
|
|
|
[selectionView setAutoresizingMask: NSViewMinYMargin|NSViewWidthSizable];
|
|
|
|
|
|
|
|
|
|
if ((image = objectsImage) != nil)
|
|
|
|
|
{
|
|
|
|
|
cell = [selectionView cellAtRow: 0 column: 0];
|
2001-05-08 09:43:11 +00:00
|
|
|
|
[cell setTag: 0];
|
1999-12-14 19:55:18 +00:00
|
|
|
|
[cell setImage: image];
|
|
|
|
|
[cell setTitle: @"Objects"];
|
|
|
|
|
[cell setBordered: NO];
|
|
|
|
|
[cell setAlignment: NSCenterTextAlignment];
|
|
|
|
|
[cell setImagePosition: NSImageAbove];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ((image = imagesImage) != nil)
|
|
|
|
|
{
|
|
|
|
|
cell = [selectionView cellAtRow: 0 column: 1];
|
2001-05-08 09:43:11 +00:00
|
|
|
|
[cell setTag: 1];
|
1999-12-14 19:55:18 +00:00
|
|
|
|
[cell setImage: image];
|
|
|
|
|
[cell setTitle: @"Images"];
|
|
|
|
|
[cell setBordered: NO];
|
|
|
|
|
[cell setAlignment: NSCenterTextAlignment];
|
|
|
|
|
[cell setImagePosition: NSImageAbove];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ((image = soundsImage) != nil)
|
|
|
|
|
{
|
|
|
|
|
cell = [selectionView cellAtRow: 0 column: 2];
|
2001-05-08 09:43:11 +00:00
|
|
|
|
[cell setTag: 2];
|
1999-12-14 19:55:18 +00:00
|
|
|
|
[cell setImage: image];
|
|
|
|
|
[cell setTitle: @"Sounds"];
|
|
|
|
|
[cell setBordered: NO];
|
|
|
|
|
[cell setAlignment: NSCenterTextAlignment];
|
|
|
|
|
[cell setImagePosition: NSImageAbove];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ((image = classesImage) != nil)
|
|
|
|
|
{
|
|
|
|
|
cell = [selectionView cellAtRow: 0 column: 3];
|
2001-05-08 09:43:11 +00:00
|
|
|
|
[cell setTag: 3];
|
1999-12-14 19:55:18 +00:00
|
|
|
|
[cell setImage: image];
|
|
|
|
|
[cell setTitle: @"Classes"];
|
|
|
|
|
[cell setBordered: NO];
|
|
|
|
|
[cell setAlignment: NSCenterTextAlignment];
|
|
|
|
|
[cell setImagePosition: NSImageAbove];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[[window contentView] addSubview: selectionView];
|
|
|
|
|
RELEASE(selectionView);
|
|
|
|
|
|
2001-05-08 09:43:11 +00:00
|
|
|
|
selectionBox = [[NSBox alloc] initWithFrame: scrollRect];
|
|
|
|
|
[selectionBox setTitlePosition: NSNoTitle];
|
|
|
|
|
[selectionBox setBorderType: NSNoBorder];
|
|
|
|
|
[selectionBox setAutoresizingMask:
|
|
|
|
|
NSViewHeightSizable|NSViewWidthSizable];
|
|
|
|
|
[[window contentView] addSubview: selectionBox];
|
|
|
|
|
RELEASE(selectionBox);
|
|
|
|
|
|
1999-12-14 19:55:18 +00:00
|
|
|
|
scrollView = [[NSScrollView alloc] initWithFrame: scrollRect];
|
|
|
|
|
[scrollView setHasVerticalScroller: YES];
|
|
|
|
|
[scrollView setHasHorizontalScroller: NO];
|
|
|
|
|
[scrollView setAutoresizingMask: NSViewHeightSizable|NSViewWidthSizable];
|
|
|
|
|
|
|
|
|
|
mainRect.origin = NSMakePoint(0,0);
|
|
|
|
|
objectsView = [[GormObjectEditor alloc] initWithObject: nil
|
|
|
|
|
inDocument: self];
|
2002-01-14 04:19:01 +00:00
|
|
|
|
AUTORELEASE(objectsView);
|
1999-12-14 19:55:18 +00:00
|
|
|
|
[objectsView setFrame: mainRect];
|
|
|
|
|
[objectsView setAutoresizingMask: NSViewHeightSizable|NSViewWidthSizable];
|
|
|
|
|
[scrollView setDocumentView: objectsView];
|
|
|
|
|
RELEASE(objectsView);
|
|
|
|
|
|
2001-05-08 09:43:11 +00:00
|
|
|
|
classesScrollView = [[NSScrollView alloc] initWithFrame: scrollRect];
|
|
|
|
|
[classesScrollView setHasVerticalScroller: YES];
|
|
|
|
|
[classesScrollView setHasHorizontalScroller: NO];
|
|
|
|
|
[classesScrollView setAutoresizingMask:
|
|
|
|
|
NSViewHeightSizable|NSViewWidthSizable];
|
|
|
|
|
|
|
|
|
|
mainRect.origin = NSMakePoint(0,0);
|
2002-07-08 04:45:23 +00:00
|
|
|
|
classesView = [[GormOutlineView alloc] initWithFrame: mainRect];
|
2001-05-08 09:43:11 +00:00
|
|
|
|
[classesView setMenu: [(Gorm*)NSApp classMenu]];
|
|
|
|
|
[classesView setDataSource: self];
|
2002-07-14 23:54:05 +00:00
|
|
|
|
[classesView setDelegate: self];
|
2001-05-08 09:43:11 +00:00
|
|
|
|
[classesView setAutoresizesAllColumnsToFit: YES];
|
2001-10-29 12:52:09 +00:00
|
|
|
|
[classesView setAllowsColumnResizing: NO];
|
2002-03-25 01:44:01 +00:00
|
|
|
|
[classesView setDrawsGrid: NO];
|
|
|
|
|
[classesView setIndentationMarkerFollowsCell: YES];
|
|
|
|
|
[classesView setAutoresizesOutlineColumn: YES];
|
|
|
|
|
[classesView setIndentationPerLevel: 10];
|
2002-07-08 04:45:23 +00:00
|
|
|
|
[classesView setAttributeOffset: 30];
|
|
|
|
|
[classesView setBackgroundColor: salmonColor ];
|
2002-07-12 05:46:29 +00:00
|
|
|
|
[classesView setRowHeight: 18];
|
2001-05-08 09:43:11 +00:00
|
|
|
|
[classesScrollView setDocumentView: classesView];
|
|
|
|
|
RELEASE(classesView);
|
|
|
|
|
|
|
|
|
|
tableColumn = [[NSTableColumn alloc] initWithIdentifier: @"classes"];
|
|
|
|
|
[[tableColumn headerCell] setStringValue: @"Classes"];
|
2002-07-08 04:45:23 +00:00
|
|
|
|
[tableColumn setMinWidth: 200];
|
2001-05-08 09:43:11 +00:00
|
|
|
|
[tableColumn setResizable: YES];
|
|
|
|
|
[tableColumn setEditable: YES];
|
2002-03-25 01:44:01 +00:00
|
|
|
|
[classesView addTableColumn: tableColumn];
|
|
|
|
|
[classesView setOutlineTableColumn: tableColumn];
|
2001-05-08 09:43:11 +00:00
|
|
|
|
RELEASE(tableColumn);
|
|
|
|
|
|
|
|
|
|
tableColumn = [[NSTableColumn alloc] initWithIdentifier: @"outlets"];
|
|
|
|
|
[[tableColumn headerCell] setStringValue: @"O"];
|
2002-07-08 04:45:23 +00:00
|
|
|
|
[tableColumn setWidth: 45];
|
2001-05-08 09:43:11 +00:00
|
|
|
|
[tableColumn setResizable: NO];
|
2002-07-14 23:54:05 +00:00
|
|
|
|
[tableColumn setEditable: NO];
|
2001-05-08 09:43:11 +00:00
|
|
|
|
[classesView addTableColumn: tableColumn];
|
2002-07-08 04:45:23 +00:00
|
|
|
|
[classesView setOutletColumn: tableColumn];
|
2001-05-08 09:43:11 +00:00
|
|
|
|
RELEASE(tableColumn);
|
|
|
|
|
|
|
|
|
|
tableColumn = [[NSTableColumn alloc] initWithIdentifier: @"actions"];
|
|
|
|
|
[[tableColumn headerCell] setStringValue: @"A"];
|
2002-07-08 04:45:23 +00:00
|
|
|
|
[tableColumn setWidth: 45];
|
2001-05-08 09:43:11 +00:00
|
|
|
|
[tableColumn setResizable: NO];
|
2002-07-14 23:54:05 +00:00
|
|
|
|
[tableColumn setEditable: NO];
|
2001-05-08 09:43:11 +00:00
|
|
|
|
[classesView addTableColumn: tableColumn];
|
2002-07-08 04:45:23 +00:00
|
|
|
|
[classesView setActionColumn: tableColumn];
|
2001-05-08 09:43:11 +00:00
|
|
|
|
RELEASE(tableColumn);
|
|
|
|
|
|
2002-03-26 17:15:26 +00:00
|
|
|
|
[classesView sizeToFit];
|
|
|
|
|
|
2002-03-25 01:44:01 +00:00
|
|
|
|
// expand all of the items in the classesView...
|
|
|
|
|
[classesView expandItem: @"NSObject"];
|
2001-05-08 09:43:11 +00:00
|
|
|
|
|
|
|
|
|
[selectionBox setContentView: scrollView];
|
|
|
|
|
|
1999-12-13 17:01:35 +00:00
|
|
|
|
/*
|
1999-12-14 19:55:18 +00:00
|
|
|
|
* Set up special-case dummy objects and add them to the objects view.
|
1999-12-13 17:01:35 +00:00
|
|
|
|
*/
|
|
|
|
|
filesOwner = [GormFilesOwner new];
|
|
|
|
|
[self setName: @"NSOwner" forObject: filesOwner];
|
1999-12-14 19:55:18 +00:00
|
|
|
|
[objectsView addObject: filesOwner];
|
1999-12-13 17:01:35 +00:00
|
|
|
|
firstResponder = [GormFirstResponder new];
|
|
|
|
|
[self setName: @"NSFirst" forObject: firstResponder];
|
1999-12-14 19:55:18 +00:00
|
|
|
|
[objectsView addObject: firstResponder];
|
1999-12-13 17:01:35 +00:00
|
|
|
|
fontManager = [GormFontManager new];
|
1999-12-19 06:19:31 +00:00
|
|
|
|
[self setName: @"NSFont" forObject: fontManager];
|
1999-12-15 15:29:27 +00:00
|
|
|
|
|
2001-02-08 07:15:15 +00:00
|
|
|
|
/*
|
|
|
|
|
* Set image for this miniwindow.
|
|
|
|
|
*/
|
|
|
|
|
[window setMiniwindowImage: [(id)filesOwner imageForViewer]];
|
|
|
|
|
|
2000-02-03 17:04:37 +00:00
|
|
|
|
hidden = [NSMutableArray new];
|
1999-12-15 15:29:27 +00:00
|
|
|
|
/*
|
|
|
|
|
* Watch to see when we are starting/ending testing.
|
|
|
|
|
*/
|
|
|
|
|
[nc addObserver: self
|
|
|
|
|
selector: @selector(handleNotification:)
|
|
|
|
|
name: IBWillBeginTestingInterfaceNotification
|
|
|
|
|
object: nil];
|
|
|
|
|
[nc addObserver: self
|
|
|
|
|
selector: @selector(handleNotification:)
|
|
|
|
|
name: IBWillEndTestingInterfaceNotification
|
|
|
|
|
object: nil];
|
1999-12-08 15:04:57 +00:00
|
|
|
|
}
|
|
|
|
|
return self;
|
|
|
|
|
}
|
|
|
|
|
|
2001-05-08 09:43:11 +00:00
|
|
|
|
- (id) instantiateClass: (id)sender
|
|
|
|
|
{
|
|
|
|
|
NSLog(@"document -> instantiateClass: ");
|
|
|
|
|
|
|
|
|
|
if ([[selectionView selectedCell] tag] == 3)
|
|
|
|
|
{
|
|
|
|
|
int i = [classesView selectedRow];
|
|
|
|
|
id classNames = [classManager allClassNames];
|
|
|
|
|
|
2002-03-25 01:44:01 +00:00
|
|
|
|
if (i >= 0)
|
2001-05-08 09:43:11 +00:00
|
|
|
|
{
|
2002-03-25 01:44:01 +00:00
|
|
|
|
id className = [classesView itemAtRow: i];
|
2001-05-08 09:43:11 +00:00
|
|
|
|
GSNibItem *item =
|
|
|
|
|
[[GormObjectProxy alloc] initWithClassName: className
|
|
|
|
|
frame: NSMakeRect(0,0,0,0)];
|
|
|
|
|
|
|
|
|
|
[self setName: nil forObject: item];
|
|
|
|
|
[self attachObject: item toParent: nil];
|
|
|
|
|
//[self setObject: item isVisibleAtLaunch: NO];
|
|
|
|
|
RELEASE(item);
|
|
|
|
|
|
|
|
|
|
[selectionView selectCellWithTag: 0];
|
|
|
|
|
[selectionBox setContentView: scrollView];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return nil;
|
|
|
|
|
}
|
|
|
|
|
|
2000-01-04 16:25:39 +00:00
|
|
|
|
- (BOOL) isActive
|
|
|
|
|
{
|
|
|
|
|
return isActive;
|
|
|
|
|
}
|
|
|
|
|
|
1999-12-08 15:04:57 +00:00
|
|
|
|
- (NSString*) nameForObject: (id)anObject
|
|
|
|
|
{
|
1999-12-13 17:01:35 +00:00
|
|
|
|
return (NSString*)NSMapGet(objToName, (void*)anObject);
|
1999-12-08 15:04:57 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
- (id) objectForName: (NSString*)name
|
|
|
|
|
{
|
1999-12-13 17:01:35 +00:00
|
|
|
|
return [nameTable objectForKey: name];
|
1999-12-08 15:04:57 +00:00
|
|
|
|
}
|
|
|
|
|
|
2000-01-03 11:00:14 +00:00
|
|
|
|
- (BOOL) objectIsVisibleAtLaunch: (id)anObject
|
|
|
|
|
{
|
|
|
|
|
return [[nameTable objectForKey: @"NSVisible"] containsObject: anObject];
|
|
|
|
|
}
|
|
|
|
|
|
1999-12-08 15:04:57 +00:00
|
|
|
|
- (NSArray*) objects
|
|
|
|
|
{
|
|
|
|
|
return [nameTable allValues];
|
|
|
|
|
}
|
|
|
|
|
|
2000-01-04 17:46:26 +00:00
|
|
|
|
/*
|
|
|
|
|
* NB. This assumes we have an empty document to start with - the loaded
|
|
|
|
|
* document is merged in to it.
|
|
|
|
|
*/
|
|
|
|
|
- (id) loadDocument: (NSString*)aFile
|
|
|
|
|
{
|
|
|
|
|
NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];
|
|
|
|
|
NSMutableDictionary *nt;
|
|
|
|
|
NSData *data;
|
|
|
|
|
NSUnarchiver *u;
|
|
|
|
|
GSNibContainer *c;
|
|
|
|
|
NSEnumerator *enumerator;
|
|
|
|
|
id <IBConnectors> con;
|
|
|
|
|
NSString *name;
|
2001-06-20 16:00:19 +00:00
|
|
|
|
NSString *ownerClass;
|
2000-01-04 17:46:26 +00:00
|
|
|
|
|
|
|
|
|
data = [NSData dataWithContentsOfFile: aFile];
|
|
|
|
|
if (data == nil)
|
|
|
|
|
{
|
|
|
|
|
NSRunAlertPanel(NULL,
|
|
|
|
|
[NSString stringWithFormat: @"Could not read '%@' data", aFile],
|
|
|
|
|
@"OK", NULL, NULL);
|
|
|
|
|
return nil;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Create an unarchiver, and use it to unarchive the nib file while
|
|
|
|
|
* handling class replacement so that standard objects understood
|
|
|
|
|
* by the gui library are converted to their Gorm internal equivalents.
|
|
|
|
|
*/
|
|
|
|
|
u = AUTORELEASE([[NSUnarchiver alloc] initForReadingWithData: data]);
|
2001-05-08 09:43:11 +00:00
|
|
|
|
[u decodeClassName: @"GSNibContainer" asClassName: @"GormDocument"];
|
|
|
|
|
[u decodeClassName: @"GSNibItem" asClassName: @"GormObjectProxy"];
|
2001-10-03 17:38:46 +00:00
|
|
|
|
[u decodeClassName: @"GSCustomView" asClassName: @"GormCustomView"];
|
2002-04-07 22:02:41 +00:00
|
|
|
|
[u decodeClassName: @"NSMenu" asClassName: @"GormNSMenu"];
|
2002-02-18 12:37:26 +00:00
|
|
|
|
[u decodeClassName: @"NSWindow" asClassName: @"GormNSWindow"];
|
|
|
|
|
[u decodeClassName: @"NSBrowser" asClassName: @"GormNSBrowser"];
|
2002-03-26 17:15:26 +00:00
|
|
|
|
[u decodeClassName: @"NSTableView" asClassName: @"GormNSTableView"];
|
2002-03-31 15:59:18 +00:00
|
|
|
|
[u decodeClassName: @"NSOutlineView" asClassName: @"GormNSOutlineView"];
|
2001-05-08 09:43:11 +00:00
|
|
|
|
|
2000-01-04 17:46:26 +00:00
|
|
|
|
c = [u decodeObject];
|
|
|
|
|
if (c == nil || [c isKindOfClass: [GSNibContainer class]] == NO)
|
|
|
|
|
{
|
|
|
|
|
NSRunAlertPanel(NULL, @"Could not unarchive document data",
|
|
|
|
|
@"OK", NULL, NULL);
|
|
|
|
|
return nil;
|
|
|
|
|
}
|
2002-07-14 23:54:05 +00:00
|
|
|
|
if (![classManager loadCustomClasses: [[aFile stringByDeletingPathExtension]
|
|
|
|
|
stringByAppendingPathExtension: @"classes"]])
|
2001-05-08 09:43:11 +00:00
|
|
|
|
{
|
|
|
|
|
NSRunAlertPanel(NULL, @"Could not open the associated classes file.\n"
|
|
|
|
|
@"You won't be able to edit connections on custom classes",
|
|
|
|
|
@"OK", NULL, NULL);
|
|
|
|
|
}
|
|
|
|
|
[classesView reloadData];
|
2000-01-04 17:46:26 +00:00
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* In the newly loaded nib container, we change all the connectors
|
|
|
|
|
* to hold the objects rather than their names (using our own dummy
|
|
|
|
|
* object as the 'NSOwner'.
|
|
|
|
|
*/
|
2001-06-20 16:00:19 +00:00
|
|
|
|
ownerClass = [[c nameTable] objectForKey: @"NSOwner"];
|
|
|
|
|
if (ownerClass)
|
|
|
|
|
[filesOwner setClassName: ownerClass];
|
2000-01-04 17:46:26 +00:00
|
|
|
|
[[c nameTable] setObject: filesOwner forKey: @"NSOwner"];
|
|
|
|
|
[[c nameTable] setObject: firstResponder forKey: @"NSFirst"];
|
2000-12-27 09:00:32 +00:00
|
|
|
|
|
2000-01-04 17:46:26 +00:00
|
|
|
|
nt = [c nameTable];
|
2001-05-08 09:43:11 +00:00
|
|
|
|
//NSLog(@"nt : %@", nt);
|
|
|
|
|
//NSLog(@"--------------");
|
|
|
|
|
//NSLog(@"con : %@", [c connections]);
|
2000-01-04 17:46:26 +00:00
|
|
|
|
enumerator = [[c connections] objectEnumerator];
|
|
|
|
|
while ((con = [enumerator nextObject]) != nil)
|
|
|
|
|
{
|
|
|
|
|
NSString *name;
|
|
|
|
|
id obj;
|
|
|
|
|
|
|
|
|
|
name = (NSString*)[con source];
|
|
|
|
|
obj = [nt objectForKey: name];
|
|
|
|
|
[con setSource: obj];
|
|
|
|
|
name = (NSString*)[con destination];
|
|
|
|
|
obj = [nt objectForKey: name];
|
|
|
|
|
[con setDestination: obj];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Now we merge the objects from the nib container into our own data
|
|
|
|
|
* structures, taking care not to overwrite our NSOwner and NSFirst.
|
|
|
|
|
*/
|
|
|
|
|
[nt removeObjectForKey: @"NSOwner"];
|
|
|
|
|
[nt removeObjectForKey: @"NSFirst"];
|
|
|
|
|
[connections addObjectsFromArray: [c connections]];
|
|
|
|
|
[nameTable addEntriesFromDictionary: nt];
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Now we build our reverse mapping information and other initialisation
|
|
|
|
|
*/
|
|
|
|
|
NSResetMapTable(objToName);
|
|
|
|
|
NSMapInsert(objToName, (void*)filesOwner, (void*)@"NSOwner");
|
|
|
|
|
NSMapInsert(objToName, (void*)firstResponder, (void*)@"NSFirst");
|
|
|
|
|
enumerator = [nameTable keyEnumerator];
|
|
|
|
|
while ((name = [enumerator nextObject]) != nil)
|
|
|
|
|
{
|
|
|
|
|
id obj = [nameTable objectForKey: name];
|
|
|
|
|
|
|
|
|
|
NSMapInsert(objToName, (void*)obj, (void*)name);
|
2000-01-13 21:19:03 +00:00
|
|
|
|
if ([obj isKindOfClass: [NSMenu class]] == YES)
|
|
|
|
|
{
|
|
|
|
|
if ([name isEqual: @"NSMenu"] == YES)
|
|
|
|
|
{
|
|
|
|
|
NSRect frame = [[NSScreen mainScreen] frame];
|
|
|
|
|
|
|
|
|
|
[[obj window] setFrameTopLeftPoint:
|
|
|
|
|
NSMakePoint(1, frame.size.height-200)];
|
|
|
|
|
[[self openEditorForObject: obj] activate];
|
2002-04-07 22:02:41 +00:00
|
|
|
|
[objectsView addObject: obj];
|
2000-01-13 21:19:03 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else if ([obj isKindOfClass: [NSWindow class]] == YES)
|
2000-01-04 17:46:26 +00:00
|
|
|
|
{
|
|
|
|
|
[objectsView addObject: obj];
|
|
|
|
|
[[self openEditorForObject: obj] activate];
|
|
|
|
|
}
|
2001-10-03 17:38:46 +00:00
|
|
|
|
else if ([obj isKindOfClass: [GSNibItem class]] == YES
|
2001-10-05 15:02:55 +00:00
|
|
|
|
&& [obj isKindOfClass: [GormCustomView class]] == NO)
|
2001-05-08 09:43:11 +00:00
|
|
|
|
{
|
|
|
|
|
[objectsView addObject: obj];
|
|
|
|
|
//[[self openEditorForObject: obj] activate];
|
|
|
|
|
}
|
2000-01-04 17:46:26 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Finally, we set our new file name
|
|
|
|
|
*/
|
|
|
|
|
ASSIGN(documentPath, aFile);
|
|
|
|
|
[window setTitleWithRepresentedFilename: documentPath];
|
|
|
|
|
[nc postNotificationName: IBDidOpenDocumentNotification
|
|
|
|
|
object: self];
|
|
|
|
|
return self;
|
|
|
|
|
}
|
|
|
|
|
|
1999-12-08 15:04:57 +00:00
|
|
|
|
/*
|
|
|
|
|
* NB. This assumes we have an empty document to start with - the loaded
|
|
|
|
|
* document is merged in to it.
|
|
|
|
|
*/
|
|
|
|
|
- (id) openDocument: (id)sender
|
|
|
|
|
{
|
2000-01-04 12:37:00 +00:00
|
|
|
|
NSArray *fileTypes;
|
1999-12-08 15:04:57 +00:00
|
|
|
|
NSOpenPanel *oPanel = [NSOpenPanel openPanel];
|
|
|
|
|
int result;
|
2002-04-07 22:02:41 +00:00
|
|
|
|
NSString *pth = [[NSUserDefaults standardUserDefaults]
|
|
|
|
|
objectForKey:@"OpenDir"];
|
1999-12-08 15:04:57 +00:00
|
|
|
|
|
2000-01-04 12:37:00 +00:00
|
|
|
|
if ([[NSUserDefaults standardUserDefaults] boolForKey: @"OpenNibs"] == YES)
|
|
|
|
|
{
|
|
|
|
|
fileTypes = [NSArray arrayWithObjects: @"gorm", @"nib", nil];
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
fileTypes = [NSArray arrayWithObjects: @"gorm", nil];
|
|
|
|
|
}
|
1999-12-08 15:04:57 +00:00
|
|
|
|
[oPanel setAllowsMultipleSelection: NO];
|
|
|
|
|
[oPanel setCanChooseFiles: YES];
|
|
|
|
|
[oPanel setCanChooseDirectories: NO];
|
2002-04-07 22:02:41 +00:00
|
|
|
|
result = [oPanel runModalForDirectory: pth
|
1999-12-08 15:04:57 +00:00
|
|
|
|
file: nil
|
|
|
|
|
types: fileTypes];
|
2002-04-07 22:02:41 +00:00
|
|
|
|
[[NSUserDefaults standardUserDefaults] setObject: [oPanel directory]
|
|
|
|
|
forKey:@"OpenDir"];
|
1999-12-08 15:04:57 +00:00
|
|
|
|
if (result == NSOKButton)
|
|
|
|
|
{
|
2000-01-04 17:46:26 +00:00
|
|
|
|
return [self loadDocument: [oPanel filename]];
|
1999-12-08 15:04:57 +00:00
|
|
|
|
}
|
|
|
|
|
return nil; /* Failed */
|
|
|
|
|
}
|
|
|
|
|
|
1999-12-08 15:19:11 +00:00
|
|
|
|
- (id<IBEditors>) openEditorForObject: (id)anObject
|
|
|
|
|
{
|
1999-12-14 17:38:17 +00:00
|
|
|
|
id<IBEditors> e = [self editorForObject: anObject create: YES];
|
|
|
|
|
id<IBEditors> p = [self parentEditorForEditor: e];
|
|
|
|
|
|
2000-01-14 13:34:15 +00:00
|
|
|
|
if (p != nil && p != objectsView)
|
1999-12-14 17:38:17 +00:00
|
|
|
|
{
|
|
|
|
|
[self openEditorForObject: [p editedObject]];
|
|
|
|
|
}
|
2000-01-03 11:00:14 +00:00
|
|
|
|
[e orderFront];
|
|
|
|
|
[[e window] makeKeyAndOrderFront: self];
|
1999-12-14 17:38:17 +00:00
|
|
|
|
return e;
|
1999-12-08 15:19:11 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
- (id<IBEditors>) parentEditorForEditor: (id<IBEditors>)anEditor
|
|
|
|
|
{
|
1999-12-14 17:38:17 +00:00
|
|
|
|
NSArray *links;
|
|
|
|
|
GormObjectToEditor *con;
|
|
|
|
|
|
|
|
|
|
links = [self connectorsForSource: anEditor
|
|
|
|
|
ofClass: [GormObjectToEditor class]];
|
|
|
|
|
con = [links lastObject];
|
|
|
|
|
return [con destination];
|
1999-12-08 15:19:11 +00:00
|
|
|
|
}
|
|
|
|
|
|
1999-12-08 15:04:57 +00:00
|
|
|
|
- (id) parentOfObject: (id)anObject
|
|
|
|
|
{
|
|
|
|
|
NSArray *old;
|
|
|
|
|
id<IBConnectors> con;
|
|
|
|
|
|
1999-12-13 17:01:35 +00:00
|
|
|
|
old = [self connectorsForSource: anObject ofClass: [NSNibConnector class]];
|
1999-12-08 15:04:57 +00:00
|
|
|
|
con = [old lastObject];
|
1999-12-13 17:01:35 +00:00
|
|
|
|
if ([con destination] != filesOwner && [con destination] != firstResponder)
|
1999-12-08 15:04:57 +00:00
|
|
|
|
{
|
|
|
|
|
return [con destination];
|
|
|
|
|
}
|
|
|
|
|
return nil;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
- (NSArray*) pasteType: (NSString*)aType
|
|
|
|
|
fromPasteboard: (NSPasteboard*)aPasteboard
|
|
|
|
|
parent: (id)parent
|
|
|
|
|
{
|
2000-01-14 13:34:15 +00:00
|
|
|
|
NSData *data;
|
|
|
|
|
NSArray *objects;
|
|
|
|
|
NSEnumerator *enumerator;
|
1999-12-08 15:04:57 +00:00
|
|
|
|
NSPoint filePoint;
|
|
|
|
|
NSPoint screenPoint;
|
2002-03-01 14:42:15 +00:00
|
|
|
|
NSUnarchiver *u;
|
1999-12-08 15:04:57 +00:00
|
|
|
|
|
2000-01-14 13:34:15 +00:00
|
|
|
|
data = [aPasteboard dataForType: aType];
|
|
|
|
|
if (data == nil)
|
|
|
|
|
{
|
|
|
|
|
NSLog(@"Pasteboard %@ doesn't contain data of %@", aPasteboard, aType);
|
|
|
|
|
return nil;
|
|
|
|
|
}
|
2002-03-01 14:42:15 +00:00
|
|
|
|
u = AUTORELEASE([[NSUnarchiver alloc] initForReadingWithData: data]);
|
|
|
|
|
[u decodeClassName: @"GSCustomView"
|
|
|
|
|
asClassName: @"GormCustomView"];
|
|
|
|
|
objects = [u decodeObject];
|
2000-01-14 13:34:15 +00:00
|
|
|
|
enumerator = [objects objectEnumerator];
|
1999-12-14 19:55:18 +00:00
|
|
|
|
filePoint = [window mouseLocationOutsideOfEventStream];
|
|
|
|
|
screenPoint = [window convertBaseToScreen: filePoint];
|
1999-12-08 15:04:57 +00:00
|
|
|
|
|
2000-01-04 12:21:17 +00:00
|
|
|
|
/*
|
2000-01-14 17:07:44 +00:00
|
|
|
|
* Windows and panels are a special case - for a multiple window paste,
|
2000-01-04 12:21:17 +00:00
|
|
|
|
* the windows need to be positioned so they are not on top of each other.
|
|
|
|
|
*/
|
1999-12-08 15:04:57 +00:00
|
|
|
|
if ([aType isEqualToString: IBWindowPboardType] == YES)
|
|
|
|
|
{
|
|
|
|
|
NSWindow *win;
|
|
|
|
|
|
|
|
|
|
while ((win = [enumerator nextObject]) != nil)
|
|
|
|
|
{
|
|
|
|
|
[win setFrameTopLeftPoint: screenPoint];
|
2000-01-04 12:21:17 +00:00
|
|
|
|
screenPoint.x += 10;
|
|
|
|
|
screenPoint.y -= 10;
|
1999-12-08 15:04:57 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
[self attachObjects: objects toParent: parent];
|
|
|
|
|
[self touch];
|
|
|
|
|
return objects;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
- (void) removeConnector: (id<IBConnectors>)aConnector
|
|
|
|
|
{
|
|
|
|
|
[connections removeObjectIdenticalTo: aConnector];
|
|
|
|
|
}
|
|
|
|
|
|
1999-12-08 15:19:11 +00:00
|
|
|
|
- (void) resignSelectionForEditor: (id<IBEditors>)editor
|
|
|
|
|
{
|
1999-12-14 17:38:17 +00:00
|
|
|
|
NSEnumerator *enumerator = [connections objectEnumerator];
|
|
|
|
|
Class editClass = [GormObjectToEditor class];
|
|
|
|
|
id<IBConnectors> c;
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* This editor wants to give up the selection. Go through all the known
|
|
|
|
|
* editors (with links in the connections array) and try to find one
|
|
|
|
|
* that wants to take over the selection. Activate whatever editor we
|
1999-12-15 11:12:52 +00:00
|
|
|
|
* find (if any).
|
1999-12-14 17:38:17 +00:00
|
|
|
|
*/
|
|
|
|
|
while ((c = [enumerator nextObject]) != nil)
|
|
|
|
|
{
|
|
|
|
|
if ([c class] == editClass)
|
|
|
|
|
{
|
|
|
|
|
id<IBEditors> e = [c destination];
|
|
|
|
|
|
|
|
|
|
if (e != editor && [e wantsSelection] == YES)
|
|
|
|
|
{
|
1999-12-15 11:12:52 +00:00
|
|
|
|
[e activate];
|
2000-01-04 12:21:17 +00:00
|
|
|
|
[self setSelectionFromEditor: e];
|
2000-01-04 16:25:39 +00:00
|
|
|
|
return;
|
1999-12-14 17:38:17 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2000-01-04 16:25:39 +00:00
|
|
|
|
/*
|
|
|
|
|
* No editor available to take the selection - set a nil owner.
|
|
|
|
|
*/
|
|
|
|
|
[self setSelectionFromEditor: nil];
|
1999-12-08 15:19:11 +00:00
|
|
|
|
}
|
|
|
|
|
|
2000-01-13 21:19:03 +00:00
|
|
|
|
- (void) setupDefaults: (NSString*)type
|
|
|
|
|
{
|
|
|
|
|
if (hasSetDefaults == YES)
|
|
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
hasSetDefaults = YES;
|
|
|
|
|
if ([type isEqual: @"Application"] == YES)
|
|
|
|
|
{
|
2002-04-07 22:02:41 +00:00
|
|
|
|
NSMenu *aMenu;
|
2000-01-13 21:19:03 +00:00
|
|
|
|
NSWindow *aWindow;
|
|
|
|
|
NSRect frame = [[NSScreen mainScreen] frame];
|
|
|
|
|
unsigned style = NSTitledWindowMask | NSClosableWindowMask
|
|
|
|
|
| NSResizableWindowMask | NSMiniaturizableWindowMask;
|
|
|
|
|
|
2002-04-07 22:02:41 +00:00
|
|
|
|
if ([NSMenu respondsToSelector: @selector(allocSubstitute)])
|
|
|
|
|
{
|
|
|
|
|
aMenu = [[NSMenu allocSubstitute] init];
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
aMenu = [[NSMenu alloc] init];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ([NSWindow respondsToSelector: @selector(allocSubstitute)])
|
|
|
|
|
{
|
|
|
|
|
aWindow = [[NSWindow allocSubstitute]
|
|
|
|
|
initWithContentRect: NSMakeRect(0,0,600, 400)
|
|
|
|
|
styleMask: style
|
|
|
|
|
backing: NSBackingStoreRetained
|
|
|
|
|
defer: NO];
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
aWindow = [[NSWindow alloc]
|
|
|
|
|
initWithContentRect: NSMakeRect(0,0,600, 400)
|
|
|
|
|
styleMask: style
|
|
|
|
|
backing: NSBackingStoreRetained
|
|
|
|
|
defer: NO];
|
|
|
|
|
}
|
2000-01-13 21:19:03 +00:00
|
|
|
|
[aWindow setFrameTopLeftPoint:
|
|
|
|
|
NSMakePoint(220, frame.size.height-100)];
|
|
|
|
|
[aWindow setTitle: @"My Window"];
|
2000-01-14 17:26:25 +00:00
|
|
|
|
[self setName: @"My Window" forObject: aWindow];
|
2000-01-13 21:19:03 +00:00
|
|
|
|
[self attachObject: aWindow toParent: nil];
|
2000-01-14 17:07:44 +00:00
|
|
|
|
[self setObject: aWindow isVisibleAtLaunch: YES];
|
2000-01-13 21:19:03 +00:00
|
|
|
|
RELEASE(aWindow);
|
|
|
|
|
|
|
|
|
|
[aMenu setTitle: @"Main Menu"];
|
|
|
|
|
[aMenu addItemWithTitle: @"Hide"
|
|
|
|
|
action: @selector(hide:)
|
|
|
|
|
keyEquivalent: @"h"];
|
|
|
|
|
[aMenu addItemWithTitle: @"Quit"
|
|
|
|
|
action: @selector(terminate:)
|
2002-04-07 22:02:41 +00:00
|
|
|
|
keyEquivalent: @"q"];
|
2000-01-13 21:19:03 +00:00
|
|
|
|
[self setName: @"NSMenu" forObject: aMenu];
|
|
|
|
|
[self attachObject: aMenu toParent: nil];
|
2002-04-07 22:02:41 +00:00
|
|
|
|
[objectsView addObject: aMenu];
|
|
|
|
|
// RETAIN(aMenu);
|
|
|
|
|
|
2000-01-13 21:19:03 +00:00
|
|
|
|
[[aMenu window] setFrameTopLeftPoint:
|
|
|
|
|
NSMakePoint(1, frame.size.height-200)];
|
|
|
|
|
RELEASE(aMenu);
|
|
|
|
|
}
|
2000-01-14 17:07:44 +00:00
|
|
|
|
else if ([type isEqual: @"Inspector"] == YES)
|
|
|
|
|
{
|
|
|
|
|
NSWindow *aWindow;
|
|
|
|
|
NSRect frame = [[NSScreen mainScreen] frame];
|
|
|
|
|
unsigned style = NSTitledWindowMask | NSClosableWindowMask;
|
|
|
|
|
|
|
|
|
|
aWindow = [[NSWindow alloc] initWithContentRect: NSMakeRect(0,0,IVW,IVH)
|
|
|
|
|
styleMask: style
|
|
|
|
|
backing: NSBackingStoreRetained
|
|
|
|
|
defer: NO];
|
|
|
|
|
[aWindow setFrameTopLeftPoint:
|
|
|
|
|
NSMakePoint(220, frame.size.height-100)];
|
|
|
|
|
[aWindow setTitle: @"Inspector Window"];
|
2000-01-14 17:26:25 +00:00
|
|
|
|
[self setName: @"InspectorWin" forObject: aWindow];
|
2000-01-14 17:07:44 +00:00
|
|
|
|
[self attachObject: aWindow toParent: nil];
|
|
|
|
|
RELEASE(aWindow);
|
|
|
|
|
}
|
|
|
|
|
else if ([type isEqual: @"Palette"] == YES)
|
|
|
|
|
{
|
|
|
|
|
NSWindow *aWindow;
|
|
|
|
|
NSRect frame = [[NSScreen mainScreen] frame];
|
|
|
|
|
unsigned style = NSTitledWindowMask | NSClosableWindowMask;
|
|
|
|
|
|
|
|
|
|
aWindow = [[NSWindow alloc] initWithContentRect: NSMakeRect(0,0,272,192)
|
|
|
|
|
styleMask: style
|
|
|
|
|
backing: NSBackingStoreRetained
|
|
|
|
|
defer: NO];
|
|
|
|
|
[aWindow setFrameTopLeftPoint:
|
|
|
|
|
NSMakePoint(220, frame.size.height-100)];
|
|
|
|
|
[aWindow setTitle: @"Palette Window"];
|
2000-01-14 17:26:25 +00:00
|
|
|
|
[self setName: @"PaletteWin" forObject: aWindow];
|
2000-01-14 17:07:44 +00:00
|
|
|
|
[self attachObject: aWindow toParent: nil];
|
|
|
|
|
RELEASE(aWindow);
|
|
|
|
|
}
|
2000-01-13 21:19:03 +00:00
|
|
|
|
}
|
|
|
|
|
|
1999-12-08 15:04:57 +00:00
|
|
|
|
- (void) setName: (NSString*)aName forObject: (id)object
|
|
|
|
|
{
|
|
|
|
|
id oldObject;
|
|
|
|
|
NSString *oldName;
|
|
|
|
|
|
|
|
|
|
if (object == nil)
|
|
|
|
|
{
|
|
|
|
|
NSLog(@"Attempt to set name for nil object");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (aName == nil)
|
|
|
|
|
{
|
|
|
|
|
/*
|
|
|
|
|
* No name given - so we must generate one unless we already have one.
|
|
|
|
|
*/
|
|
|
|
|
oldName = [self nameForObject: object];
|
|
|
|
|
if (oldName == nil)
|
|
|
|
|
{
|
|
|
|
|
NSString *base;
|
|
|
|
|
unsigned i = 0;
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Generate a sensible name for the object based on its class.
|
|
|
|
|
*/
|
2001-05-08 09:43:11 +00:00
|
|
|
|
if ([object isKindOfClass: [GSNibItem class]])
|
|
|
|
|
{
|
|
|
|
|
// use the actual class name for proxies
|
|
|
|
|
base = [(id)object className];
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
base = NSStringFromClass([object class]);
|
|
|
|
|
}
|
1999-12-08 15:04:57 +00:00
|
|
|
|
if ([base hasPrefix: @"NS"] || [base hasPrefix: @"GS"])
|
|
|
|
|
{
|
|
|
|
|
base = [base substringFromIndex: 2];
|
|
|
|
|
}
|
|
|
|
|
aName = base;
|
|
|
|
|
while ([nameTable objectForKey: aName] != nil)
|
|
|
|
|
{
|
|
|
|
|
aName = [base stringByAppendingFormat: @"%u", ++i];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
return; /* Already named ... nothing to do */
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
oldObject = [nameTable objectForKey: aName];
|
|
|
|
|
if (oldObject != nil)
|
|
|
|
|
{
|
|
|
|
|
NSLog(@"Attempt to re-use name '%@'", aName);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
oldName = [self nameForObject: object];
|
|
|
|
|
if (oldName != nil)
|
|
|
|
|
{
|
|
|
|
|
if ([oldName isEqual: aName] == YES)
|
|
|
|
|
{
|
2000-02-25 17:26:57 +00:00
|
|
|
|
return; /* Already have this name ... nothing to do */
|
1999-12-08 15:04:57 +00:00
|
|
|
|
}
|
2000-02-25 17:26:57 +00:00
|
|
|
|
RETAIN(object);
|
|
|
|
|
AUTORELEASE(object);
|
|
|
|
|
[nameTable removeObjectForKey: oldName];
|
1999-12-08 15:04:57 +00:00
|
|
|
|
NSMapRemove(objToName, (void*)object);
|
|
|
|
|
}
|
|
|
|
|
}
|
2000-12-27 09:00:32 +00:00
|
|
|
|
aName = [aName copy]; /* Make sure it's immutable */
|
1999-12-08 15:04:57 +00:00
|
|
|
|
[nameTable setObject: object forKey: aName];
|
|
|
|
|
NSMapInsert(objToName, (void*)object, (void*)aName);
|
2000-12-27 09:00:32 +00:00
|
|
|
|
RELEASE(aName);
|
1999-12-08 15:04:57 +00:00
|
|
|
|
if (oldName != nil)
|
|
|
|
|
{
|
|
|
|
|
[nameTable removeObjectForKey: oldName];
|
|
|
|
|
}
|
1999-12-22 10:13:18 +00:00
|
|
|
|
if ([objectsView containsObject: object] == YES)
|
|
|
|
|
{
|
|
|
|
|
[objectsView refreshCells];
|
|
|
|
|
}
|
1999-12-08 15:04:57 +00:00
|
|
|
|
}
|
|
|
|
|
|
2000-01-03 11:00:14 +00:00
|
|
|
|
- (void) setObject: (id)anObject isVisibleAtLaunch: (BOOL)flag
|
|
|
|
|
{
|
|
|
|
|
NSMutableArray *a = [nameTable objectForKey: @"NSVisible"];
|
|
|
|
|
|
|
|
|
|
if (flag == YES)
|
|
|
|
|
{
|
|
|
|
|
if (a == nil)
|
|
|
|
|
{
|
|
|
|
|
a = [NSMutableArray new];
|
|
|
|
|
[nameTable setObject: a forKey: @"NSVisible"];
|
|
|
|
|
RELEASE(a);
|
|
|
|
|
}
|
|
|
|
|
if ([a containsObject: anObject] == NO)
|
|
|
|
|
{
|
|
|
|
|
[a addObject: anObject];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
[a removeObject: anObject];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2000-01-04 17:46:26 +00:00
|
|
|
|
/*
|
|
|
|
|
* To revert to a saved version, we actually load a new document and
|
|
|
|
|
* close the original document, returning the id of the new document.
|
|
|
|
|
*/
|
|
|
|
|
- (id) revertDocument: (id)sender
|
|
|
|
|
{
|
|
|
|
|
GormDocument *reverted = AUTORELEASE([GormDocument new]);
|
|
|
|
|
|
|
|
|
|
if ([reverted loadDocument: documentPath] != nil)
|
|
|
|
|
{
|
|
|
|
|
NSRect frame = [window frame];
|
|
|
|
|
|
|
|
|
|
[window setReleasedWhenClosed: YES];
|
|
|
|
|
[window close];
|
|
|
|
|
[[reverted window] setFrame: frame display: YES];
|
|
|
|
|
return reverted;
|
|
|
|
|
}
|
|
|
|
|
return nil;
|
|
|
|
|
}
|
|
|
|
|
|
1999-12-08 15:04:57 +00:00
|
|
|
|
- (id) saveAsDocument: (id)sender
|
|
|
|
|
{
|
2000-01-04 12:21:17 +00:00
|
|
|
|
NSUserDefaults *defs = [NSUserDefaults standardUserDefaults];
|
|
|
|
|
NSSavePanel *sp;
|
|
|
|
|
int result;
|
1999-12-08 15:04:57 +00:00
|
|
|
|
|
|
|
|
|
sp = [NSSavePanel savePanel];
|
|
|
|
|
|
2000-01-04 12:21:17 +00:00
|
|
|
|
if ([defs boolForKey: @"SaveAsNib"] == YES)
|
|
|
|
|
{
|
|
|
|
|
[sp setRequiredFileType: @"nib"];
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
[sp setRequiredFileType: @"gorm"];
|
|
|
|
|
}
|
|
|
|
|
|
1999-12-08 15:04:57 +00:00
|
|
|
|
result = [sp runModalForDirectory: NSHomeDirectory() file: @""];
|
|
|
|
|
|
|
|
|
|
if (result == NSOKButton)
|
|
|
|
|
{
|
|
|
|
|
NSFileManager *mgr = [NSFileManager defaultManager];
|
|
|
|
|
NSString *path = [sp filename];
|
|
|
|
|
NSString *old = documentPath;
|
|
|
|
|
id retval;
|
|
|
|
|
|
|
|
|
|
if ([path isEqual: documentPath] == NO
|
|
|
|
|
&& [mgr fileExistsAtPath: path] == YES)
|
|
|
|
|
{
|
|
|
|
|
if (NSRunAlertPanel(NULL, @"A document with that name exists",
|
|
|
|
|
@"Replace", @"Cancel", NULL) != NSAlertDefaultReturn)
|
|
|
|
|
{
|
|
|
|
|
return nil;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
NSString *bPath = [path stringByAppendingString: @"~"];
|
|
|
|
|
|
|
|
|
|
[mgr removeFileAtPath: bPath handler: nil];
|
|
|
|
|
[mgr movePath: path toPath: bPath handler: nil];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
documentPath = RETAIN(path);
|
|
|
|
|
retval = [self saveDocument: sender];
|
|
|
|
|
if (retval == nil)
|
|
|
|
|
{
|
|
|
|
|
RELEASE(documentPath);
|
|
|
|
|
documentPath = old;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
RELEASE(old);
|
|
|
|
|
/* FIXME - need to update files window title etc */
|
|
|
|
|
return self;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return nil;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
- (id) saveDocument: (id)sender
|
|
|
|
|
{
|
1999-12-08 15:19:11 +00:00
|
|
|
|
NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];
|
1999-12-15 11:12:52 +00:00
|
|
|
|
BOOL archiveResult;
|
2001-05-08 09:43:11 +00:00
|
|
|
|
NSArchiver *archiver;
|
|
|
|
|
NSMutableData *archiverData;
|
1999-12-08 15:19:11 +00:00
|
|
|
|
|
2000-01-04 17:46:26 +00:00
|
|
|
|
if (documentPath == nil)
|
1999-12-08 15:04:57 +00:00
|
|
|
|
{
|
|
|
|
|
return [self saveAsDocument: sender];
|
|
|
|
|
}
|
1999-12-08 15:19:11 +00:00
|
|
|
|
|
|
|
|
|
[nc postNotificationName: IBWillSaveDocumentNotification
|
|
|
|
|
object: self];
|
|
|
|
|
|
2000-01-03 11:00:14 +00:00
|
|
|
|
[self beginArchiving];
|
1999-12-15 11:12:52 +00:00
|
|
|
|
|
2001-05-08 09:43:11 +00:00
|
|
|
|
//NSLog(@"nametable : %@", nameTable);
|
|
|
|
|
//NSLog(@"connections : %@", connections);
|
|
|
|
|
|
|
|
|
|
archiverData = [NSMutableData dataWithCapacity: 0];
|
|
|
|
|
archiver = [[NSArchiver alloc] initForWritingWithMutableData: archiverData];
|
|
|
|
|
[archiver encodeClassName: @"GormObjectProxy" intoClassName: @"GSNibItem"];
|
2002-03-31 15:59:18 +00:00
|
|
|
|
[archiver encodeClassName: @"GormCustomView"
|
2001-10-03 17:38:46 +00:00
|
|
|
|
intoClassName: @"GSCustomView"];
|
2002-04-07 22:02:41 +00:00
|
|
|
|
[archiver encodeClassName: @"GormNSMenu"
|
|
|
|
|
intoClassName: @"NSMenu"];
|
2002-03-31 15:59:18 +00:00
|
|
|
|
[archiver encodeClassName: @"GormNSWindow"
|
2002-02-18 12:37:26 +00:00
|
|
|
|
intoClassName: @"NSWindow"];
|
2002-03-31 15:59:18 +00:00
|
|
|
|
[archiver encodeClassName: @"GormNSBrowser"
|
2002-02-18 12:37:26 +00:00
|
|
|
|
intoClassName: @"NSBrowser"];
|
2002-03-31 15:59:18 +00:00
|
|
|
|
[archiver encodeClassName: @"GormNSTableView"
|
2002-03-26 17:15:26 +00:00
|
|
|
|
intoClassName: @"NSTableView"];
|
2002-03-31 15:59:18 +00:00
|
|
|
|
[archiver encodeClassName: @"GormNSOutlineView"
|
|
|
|
|
intoClassName: @"NSOutlineView"];
|
2001-05-08 09:43:11 +00:00
|
|
|
|
[archiver encodeRootObject: self];
|
|
|
|
|
archiveResult = [archiverData writeToFile: documentPath atomically: YES];
|
|
|
|
|
//archiveResult = [NSArchiver archiveRootObject: self toFile: documentPath];
|
|
|
|
|
RELEASE(archiver);
|
|
|
|
|
if (archiveResult)
|
|
|
|
|
archiveResult = [classManager saveToFile:
|
|
|
|
|
[[documentPath stringByDeletingPathExtension]
|
|
|
|
|
stringByAppendingPathExtension: @"classes"]];
|
1999-12-15 11:12:52 +00:00
|
|
|
|
|
2000-01-03 11:00:14 +00:00
|
|
|
|
[self endArchiving];
|
1999-12-15 11:12:52 +00:00
|
|
|
|
|
|
|
|
|
if (archiveResult == NO)
|
1999-12-08 15:04:57 +00:00
|
|
|
|
{
|
|
|
|
|
NSRunAlertPanel(NULL, @"Could not save document",
|
|
|
|
|
@"OK", NULL, NULL);
|
|
|
|
|
return nil;
|
|
|
|
|
}
|
1999-12-15 11:12:52 +00:00
|
|
|
|
|
1999-12-14 19:55:18 +00:00
|
|
|
|
[window setDocumentEdited: NO];
|
|
|
|
|
[window setTitleWithRepresentedFilename: documentPath];
|
1999-12-08 15:19:11 +00:00
|
|
|
|
|
1999-12-15 11:12:52 +00:00
|
|
|
|
[nc postNotificationName: IBDidSaveDocumentNotification
|
1999-12-08 15:19:11 +00:00
|
|
|
|
object: self];
|
1999-12-08 15:04:57 +00:00
|
|
|
|
return self;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
- (void) setDocumentActive: (BOOL)flag
|
|
|
|
|
{
|
2000-01-04 16:25:39 +00:00
|
|
|
|
if (flag != isActive)
|
1999-12-08 15:04:57 +00:00
|
|
|
|
{
|
2000-01-04 16:25:39 +00:00
|
|
|
|
NSEnumerator *enumerator;
|
|
|
|
|
id obj;
|
|
|
|
|
|
|
|
|
|
enumerator = [nameTable objectEnumerator];
|
|
|
|
|
if (flag == YES)
|
1999-12-08 15:04:57 +00:00
|
|
|
|
{
|
2000-01-04 16:25:39 +00:00
|
|
|
|
[(GormDocument*)[(id<IB>)NSApp activeDocument] setDocumentActive: NO];
|
|
|
|
|
isActive = YES;
|
|
|
|
|
while ((obj = [enumerator nextObject]) != nil)
|
1999-12-08 15:04:57 +00:00
|
|
|
|
{
|
2000-01-04 16:25:39 +00:00
|
|
|
|
if ([obj isKindOfClass: [NSWindow class]] == YES)
|
|
|
|
|
{
|
|
|
|
|
[obj orderFront: self];
|
|
|
|
|
}
|
|
|
|
|
else if ([obj isKindOfClass: [NSMenu class]] == YES)
|
|
|
|
|
{
|
|
|
|
|
[obj display];
|
|
|
|
|
}
|
1999-12-08 15:04:57 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2000-01-04 16:25:39 +00:00
|
|
|
|
else
|
1999-12-08 15:04:57 +00:00
|
|
|
|
{
|
2000-01-04 16:25:39 +00:00
|
|
|
|
isActive = NO;
|
|
|
|
|
while ((obj = [enumerator nextObject]) != nil)
|
1999-12-08 15:04:57 +00:00
|
|
|
|
{
|
2000-01-04 16:25:39 +00:00
|
|
|
|
if ([obj isKindOfClass: [NSWindow class]] == YES)
|
|
|
|
|
{
|
|
|
|
|
[obj orderOut: self];
|
|
|
|
|
}
|
|
|
|
|
else if ([obj isKindOfClass: [NSMenu class]] == YES)
|
|
|
|
|
{
|
|
|
|
|
[obj close];
|
|
|
|
|
}
|
1999-12-08 15:04:57 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
1999-12-08 15:19:11 +00:00
|
|
|
|
- (void) setSelectionFromEditor: (id<IBEditors>)anEditor
|
|
|
|
|
{
|
1999-12-14 17:38:17 +00:00
|
|
|
|
NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];
|
2002-04-07 22:02:41 +00:00
|
|
|
|
NSLog(@"setSelectionFromEditor %@", anEditor);
|
1999-12-14 17:38:17 +00:00
|
|
|
|
[nc postNotificationName: IBSelectionChangedNotification
|
|
|
|
|
object: anEditor];
|
1999-12-08 15:19:11 +00:00
|
|
|
|
}
|
|
|
|
|
|
1999-12-08 15:04:57 +00:00
|
|
|
|
- (void) touch
|
|
|
|
|
{
|
1999-12-14 19:55:18 +00:00
|
|
|
|
[window setDocumentEdited: YES];
|
|
|
|
|
}
|
|
|
|
|
|
1999-12-18 08:55:31 +00:00
|
|
|
|
- (NSWindow*) windowAndRect: (NSRect*)r forObject: (id)object
|
|
|
|
|
{
|
2000-01-13 21:19:03 +00:00
|
|
|
|
/*
|
|
|
|
|
* Get the window and rectangle for which link markup should be drawn.
|
|
|
|
|
*/
|
1999-12-18 08:55:31 +00:00
|
|
|
|
if ([objectsView containsObject: object] == YES)
|
|
|
|
|
{
|
2000-01-13 21:19:03 +00:00
|
|
|
|
/*
|
|
|
|
|
* objects that exist in the document objects view must have their link
|
|
|
|
|
* markup drawn there, so we ask the view for the required rectangle.
|
|
|
|
|
*/
|
|
|
|
|
*r = [objectsView rectForObject: object];
|
1999-12-18 08:55:31 +00:00
|
|
|
|
return [objectsView window];
|
|
|
|
|
}
|
2000-01-13 21:19:03 +00:00
|
|
|
|
else if ([object isKindOfClass: [NSMenuItem class]] == YES)
|
1999-12-18 08:55:31 +00:00
|
|
|
|
{
|
2000-01-13 21:19:03 +00:00
|
|
|
|
NSArray *links;
|
|
|
|
|
NSMenu *menu;
|
|
|
|
|
id editor;
|
1999-12-18 08:55:31 +00:00
|
|
|
|
|
2000-01-13 21:19:03 +00:00
|
|
|
|
/*
|
|
|
|
|
* Menu items must have their markup drawn in the window of the
|
|
|
|
|
* editor of the parent menu.
|
|
|
|
|
*/
|
|
|
|
|
links = [self connectorsForSource: object
|
|
|
|
|
ofClass: [NSNibConnector class]];
|
|
|
|
|
menu = [[links lastObject] destination];
|
|
|
|
|
editor = [self editorForObject: menu create: NO];
|
|
|
|
|
*r = [editor rectForObject: object];
|
|
|
|
|
return [editor window];
|
|
|
|
|
}
|
|
|
|
|
else if ([object isKindOfClass: [NSView class]] == YES)
|
|
|
|
|
{
|
|
|
|
|
/*
|
|
|
|
|
* Nowmal view objects just get link markup drawn on them.
|
|
|
|
|
*/
|
|
|
|
|
*r = [object convertRect: [object bounds] toView: nil];
|
1999-12-18 08:55:31 +00:00
|
|
|
|
return [object window];
|
|
|
|
|
}
|
2002-03-29 16:30:01 +00:00
|
|
|
|
else if ([object isKindOfClass: [NSTableColumn class]] == YES)
|
|
|
|
|
{
|
|
|
|
|
// dirty hack
|
|
|
|
|
NSTableView *tv = [[(NSTableColumn*)object dataCell] controlView];
|
|
|
|
|
|
|
|
|
|
NSTableHeaderView *th = [tv headerView];
|
|
|
|
|
int index;
|
|
|
|
|
|
|
|
|
|
if (th == nil || tv == nil)
|
|
|
|
|
{
|
|
|
|
|
NSLog(@"fail 1 %@ %@ %@", [(NSTableColumn*)object headerCell], th, tv);
|
|
|
|
|
*r = NSZeroRect;
|
|
|
|
|
return nil;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
index = [[tv tableColumns] indexOfObject: object];
|
|
|
|
|
|
|
|
|
|
if (index == NSNotFound)
|
|
|
|
|
{
|
|
|
|
|
NSLog(@"fail 2");
|
|
|
|
|
*r = NSZeroRect;
|
|
|
|
|
return nil;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
*r = [th convertRect: [th headerRectOfColumn: index]
|
|
|
|
|
toView: nil];
|
|
|
|
|
NSLog(@"%@", NSStringFromRect(*r));
|
|
|
|
|
return [th window];
|
|
|
|
|
}
|
1999-12-18 08:55:31 +00:00
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
*r = NSZeroRect;
|
|
|
|
|
return nil;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2000-01-04 16:25:39 +00:00
|
|
|
|
- (NSWindow*) window
|
|
|
|
|
{
|
|
|
|
|
return window;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
- (BOOL) windowShouldClose: (id)sender
|
1999-12-14 19:55:18 +00:00
|
|
|
|
{
|
|
|
|
|
if ([window isDocumentEdited] == YES)
|
|
|
|
|
{
|
|
|
|
|
NSString *msg;
|
|
|
|
|
int result;
|
|
|
|
|
|
2000-01-04 17:46:26 +00:00
|
|
|
|
if (documentPath == nil)
|
1999-12-14 19:55:18 +00:00
|
|
|
|
{
|
|
|
|
|
msg = @"Document 'UNTITLED' has been modified";
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
msg = [NSString stringWithFormat: @"Document '%@' has been modified",
|
|
|
|
|
[documentPath lastPathComponent]];
|
|
|
|
|
}
|
|
|
|
|
result = NSRunAlertPanel(NULL, msg, @"Save", @"Cancel", @"Don't Save");
|
|
|
|
|
if (result == NSAlertAlternateReturn)
|
|
|
|
|
{
|
|
|
|
|
return NO;
|
|
|
|
|
}
|
|
|
|
|
else if (result != NSAlertOtherReturn)
|
|
|
|
|
{
|
|
|
|
|
[self saveDocument: self];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return YES;
|
1999-12-08 15:04:57 +00:00
|
|
|
|
}
|
|
|
|
|
|
2002-07-15 05:58:01 +00:00
|
|
|
|
// convenience methods for formatting outlets/actions
|
2002-07-14 23:54:05 +00:00
|
|
|
|
- (NSString*) _identifierString: (NSString*)str
|
2002-03-25 01:44:01 +00:00
|
|
|
|
{
|
2002-07-14 23:54:05 +00:00
|
|
|
|
static NSCharacterSet *illegal = nil;
|
|
|
|
|
static NSCharacterSet *numeric = nil;
|
|
|
|
|
NSRange r;
|
|
|
|
|
NSMutableString *m;
|
|
|
|
|
|
|
|
|
|
if (illegal == nil)
|
|
|
|
|
{
|
|
|
|
|
illegal = [[NSCharacterSet characterSetWithCharactersInString:
|
|
|
|
|
@"_0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"]
|
|
|
|
|
invertedSet];
|
|
|
|
|
numeric = [NSCharacterSet characterSetWithCharactersInString:
|
|
|
|
|
@"0123456789"];
|
|
|
|
|
RETAIN(illegal);
|
|
|
|
|
RETAIN(numeric);
|
|
|
|
|
}
|
|
|
|
|
if (str == nil)
|
|
|
|
|
{
|
|
|
|
|
return nil;
|
|
|
|
|
}
|
|
|
|
|
m = [str mutableCopy];
|
|
|
|
|
r = [str rangeOfCharacterFromSet: illegal];
|
|
|
|
|
while (r.length > 0)
|
|
|
|
|
{
|
|
|
|
|
[m deleteCharactersInRange: r];
|
|
|
|
|
r = [m rangeOfCharacterFromSet: illegal];
|
|
|
|
|
}
|
|
|
|
|
r = [str rangeOfCharacterFromSet: numeric];
|
|
|
|
|
while (r.length > 0 && r.location == 0)
|
|
|
|
|
{
|
|
|
|
|
[m deleteCharactersInRange: r];
|
|
|
|
|
r = [m rangeOfCharacterFromSet: numeric];
|
|
|
|
|
}
|
|
|
|
|
str = [m copy];
|
|
|
|
|
RELEASE(m);
|
|
|
|
|
AUTORELEASE(str);
|
|
|
|
|
|
|
|
|
|
return str;
|
2002-03-25 01:44:01 +00:00
|
|
|
|
}
|
|
|
|
|
|
2002-07-13 19:12:15 +00:00
|
|
|
|
- (NSString *)_formatAction: (NSString *)action
|
|
|
|
|
{
|
2002-07-14 23:54:05 +00:00
|
|
|
|
NSString *identifier = [[self _identifierString: action] stringByAppendingString: @":"];
|
|
|
|
|
return identifier;
|
2002-07-13 19:12:15 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
- (NSString *)_formatOutlet: (NSString *)outlet
|
|
|
|
|
{
|
2002-07-14 23:54:05 +00:00
|
|
|
|
NSString *identifier = [self _identifierString: outlet];
|
|
|
|
|
return identifier;
|
2002-07-13 19:12:15 +00:00
|
|
|
|
}
|
|
|
|
|
|
2002-07-15 05:58:01 +00:00
|
|
|
|
// --- NSOutlineView dataSource ---
|
2002-07-22 15:24:37 +00:00
|
|
|
|
- (id) outlineView: (NSOutlineView *)anOutlineView
|
2002-07-15 05:58:01 +00:00
|
|
|
|
objectValueForTableColumn: (NSTableColumn *)aTableColumn
|
2002-07-22 15:24:37 +00:00
|
|
|
|
byItem: item
|
2002-07-15 05:58:01 +00:00
|
|
|
|
{
|
|
|
|
|
if (anOutlineView == classesView)
|
|
|
|
|
{
|
|
|
|
|
id identifier = [aTableColumn identifier];
|
|
|
|
|
id className = item;
|
|
|
|
|
id classNames = [classManager allClassNames];
|
|
|
|
|
|
|
|
|
|
if ([identifier isEqualToString: @"classes"])
|
|
|
|
|
{
|
|
|
|
|
return className;
|
|
|
|
|
}
|
|
|
|
|
else if ([identifier isEqualToString: @"outlets"])
|
|
|
|
|
{
|
|
|
|
|
return [NSString stringWithFormat: @"%d",
|
|
|
|
|
[[classManager allOutletsForClassNamed: className] count]];
|
|
|
|
|
}
|
|
|
|
|
else if ([identifier isEqualToString: @"actions"])
|
|
|
|
|
{
|
|
|
|
|
return [NSString stringWithFormat: @"%d",
|
|
|
|
|
[[classManager allActionsForClassNamed: className] count]];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
return @"";
|
|
|
|
|
}
|
|
|
|
|
|
2002-07-11 05:50:04 +00:00
|
|
|
|
- (void) outlineView: (NSOutlineView *)anOutlineView
|
|
|
|
|
setObjectValue: (id)anObject
|
|
|
|
|
forTableColumn: (NSTableColumn *)aTableColumn
|
|
|
|
|
byItem: (id)item
|
|
|
|
|
{
|
|
|
|
|
if([item isKindOfClass: [GormOutletActionHolder class]])
|
|
|
|
|
{
|
2002-07-13 19:12:15 +00:00
|
|
|
|
if(![anObject isEqualToString: @""])
|
2002-07-11 05:50:04 +00:00
|
|
|
|
{
|
2002-07-13 19:12:15 +00:00
|
|
|
|
NSString *name = [item getName];
|
|
|
|
|
if([anOutlineView editType] == Actions)
|
|
|
|
|
{
|
|
|
|
|
NSString *formattedAction = [self _formatAction: anObject];
|
2002-07-22 15:24:37 +00:00
|
|
|
|
if(![classManager isAction: formattedAction
|
|
|
|
|
ofClass: [anOutlineView itemBeingEdited]])
|
|
|
|
|
{
|
|
|
|
|
[classManager replaceAction: name
|
|
|
|
|
withAction: formattedAction
|
|
|
|
|
forClassNamed: [anOutlineView itemBeingEdited]];
|
|
|
|
|
[item setName: formattedAction];
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
NSString *message = [NSString stringWithFormat:
|
|
|
|
|
@"The class %@ already has an action named %@",
|
|
|
|
|
[anOutlineView itemBeingEdited],formattedAction];
|
|
|
|
|
NSRunAlertPanel(@"Problem Adding Action",
|
|
|
|
|
message,nil,nil,nil);
|
|
|
|
|
|
|
|
|
|
}
|
2002-07-13 19:12:15 +00:00
|
|
|
|
}
|
|
|
|
|
else if([anOutlineView editType] == Outlets)
|
|
|
|
|
{
|
|
|
|
|
NSString *formattedOutlet = [self _formatOutlet: anObject];
|
2002-07-22 15:24:37 +00:00
|
|
|
|
|
|
|
|
|
if(![classManager isOutlet: formattedOutlet
|
|
|
|
|
ofClass: [anOutlineView itemBeingEdited]])
|
|
|
|
|
{
|
|
|
|
|
[classManager replaceOutlet: name
|
|
|
|
|
withOutlet: formattedOutlet
|
|
|
|
|
forClassNamed: [anOutlineView itemBeingEdited]];
|
|
|
|
|
[item setName: formattedOutlet];
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
NSString *message = [NSString stringWithFormat:
|
|
|
|
|
@"The class %@ already has an outlet named %@",
|
|
|
|
|
[anOutlineView itemBeingEdited],formattedOutlet];
|
|
|
|
|
NSRunAlertPanel(@"Problem Adding Outlet",
|
|
|
|
|
message,nil,nil,nil);
|
|
|
|
|
|
|
|
|
|
}
|
2002-07-13 19:12:15 +00:00
|
|
|
|
}
|
2002-07-11 05:50:04 +00:00
|
|
|
|
}
|
2002-07-12 05:46:29 +00:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2002-07-13 19:12:15 +00:00
|
|
|
|
if(![anObject isEqualToString: @""])
|
|
|
|
|
{
|
|
|
|
|
[classManager renameClassNamed: item newName: anObject];
|
|
|
|
|
[anOutlineView reloadData];
|
|
|
|
|
}
|
2002-07-11 05:50:04 +00:00
|
|
|
|
}
|
2002-07-14 23:54:05 +00:00
|
|
|
|
[anOutlineView setNeedsDisplay: YES];
|
2002-07-11 05:50:04 +00:00
|
|
|
|
}
|
|
|
|
|
|
2002-03-25 01:44:01 +00:00
|
|
|
|
- (int) outlineView: (NSOutlineView *)anOutlineView
|
|
|
|
|
numberOfChildrenOfItem: (id)item
|
|
|
|
|
{
|
|
|
|
|
if(item == nil)
|
|
|
|
|
{
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
NSArray *subclasses = [classManager subClassesOf: item];
|
|
|
|
|
return [subclasses count];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
- (BOOL) outlineView: (NSOutlineView *)anOutlineView
|
|
|
|
|
isItemExpandable: (id)item
|
|
|
|
|
{
|
|
|
|
|
NSArray *subclasses = nil;
|
|
|
|
|
if(item == nil)
|
|
|
|
|
return YES;
|
|
|
|
|
|
|
|
|
|
subclasses = [classManager subClassesOf: item];
|
|
|
|
|
if([subclasses count] > 0)
|
|
|
|
|
return YES;
|
|
|
|
|
|
|
|
|
|
return NO;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
- (id) outlineView: (NSOutlineView *)anOutlineView
|
|
|
|
|
child: (int)index
|
|
|
|
|
ofItem: (id)item
|
2001-05-08 09:43:11 +00:00
|
|
|
|
{
|
2002-03-25 01:44:01 +00:00
|
|
|
|
if(item == nil && index == 0)
|
|
|
|
|
{
|
|
|
|
|
return @"NSObject";
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
NSArray *subclasses = [classManager subClassesOf: item];
|
|
|
|
|
return [subclasses objectAtIndex: index];
|
|
|
|
|
}
|
2001-05-08 09:43:11 +00:00
|
|
|
|
|
2002-03-25 01:44:01 +00:00
|
|
|
|
return nil;
|
2001-05-08 09:43:11 +00:00
|
|
|
|
}
|
2002-07-08 04:45:23 +00:00
|
|
|
|
|
2002-07-15 05:58:01 +00:00
|
|
|
|
// GormOutlineView data source methods...
|
2002-07-11 05:50:04 +00:00
|
|
|
|
- (NSArray *)outlineView: (NSOutlineView *)anOutlineView
|
2002-07-08 04:45:23 +00:00
|
|
|
|
actionsForItem: (id)item
|
|
|
|
|
{
|
|
|
|
|
NSArray *actions = [classManager allActionsForClassNamed: item];
|
|
|
|
|
return actions;
|
|
|
|
|
}
|
|
|
|
|
|
2002-07-11 05:50:04 +00:00
|
|
|
|
- (NSArray *)outlineView: (NSOutlineView *)anOutlineView
|
2002-07-08 04:45:23 +00:00
|
|
|
|
outletsForItem: (id)item
|
|
|
|
|
{
|
|
|
|
|
NSArray *outlets = [classManager allOutletsForClassNamed: item];
|
|
|
|
|
return outlets;
|
|
|
|
|
}
|
2002-07-12 05:46:29 +00:00
|
|
|
|
|
2002-07-14 23:54:05 +00:00
|
|
|
|
- (NSString *)outlineView: (NSOutlineView *)anOutlineView
|
|
|
|
|
addNewActionForClass: (id)item
|
|
|
|
|
{
|
|
|
|
|
if(![classManager isCustomClass: [anOutlineView itemBeingEdited]])
|
|
|
|
|
{
|
|
|
|
|
return nil;
|
|
|
|
|
}
|
|
|
|
|
return [classManager addNewActionToClassNamed: item];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
- (NSString *)outlineView: (NSOutlineView *)anOutlineView
|
|
|
|
|
addNewOutletForClass: (id)item
|
2002-07-12 05:46:29 +00:00
|
|
|
|
{
|
2002-07-14 23:54:05 +00:00
|
|
|
|
if(![classManager isCustomClass: [anOutlineView itemBeingEdited]])
|
|
|
|
|
{
|
|
|
|
|
return nil;
|
|
|
|
|
}
|
|
|
|
|
return [classManager addNewOutletToClassNamed: item];
|
2002-07-12 05:46:29 +00:00
|
|
|
|
}
|
|
|
|
|
|
2002-07-14 23:54:05 +00:00
|
|
|
|
// Delegate methods
|
|
|
|
|
- (BOOL) outlineView: (NSOutlineView *)outlineView
|
|
|
|
|
shouldEditTableColumn: (NSTableColumn *)tableColumn
|
|
|
|
|
item: (id)item
|
2002-07-12 05:46:29 +00:00
|
|
|
|
{
|
2002-07-14 23:54:05 +00:00
|
|
|
|
BOOL result = NO;
|
|
|
|
|
|
|
|
|
|
NSLog(@"in the delegate %@", [tableColumn identifier]);
|
|
|
|
|
if(tableColumn == [outlineView outlineTableColumn])
|
|
|
|
|
{
|
|
|
|
|
NSLog(@"outline table col");
|
|
|
|
|
if(![item isKindOfClass: [GormOutletActionHolder class]])
|
|
|
|
|
{
|
|
|
|
|
result = [classManager isCustomClass: item];
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
id itemBeingEdited = [outlineView itemBeingEdited];
|
|
|
|
|
if([classManager isCustomClass: itemBeingEdited])
|
|
|
|
|
{
|
|
|
|
|
if([outlineView editType] == Actions)
|
|
|
|
|
{
|
|
|
|
|
result = [classManager isAction: [item getName]
|
|
|
|
|
ofClass: itemBeingEdited];
|
|
|
|
|
}
|
|
|
|
|
else if([outlineView editType] == Outlets)
|
|
|
|
|
{
|
|
|
|
|
result = [classManager isOutlet: [item getName]
|
|
|
|
|
ofClass: itemBeingEdited];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return result;
|
2002-07-12 05:46:29 +00:00
|
|
|
|
}
|
2002-07-14 23:54:05 +00:00
|
|
|
|
|
1999-12-08 15:04:57 +00:00
|
|
|
|
@end
|
|
|
|
|
|