mirror of
https://github.com/gnustep/apps-gorm.git
synced 2025-02-24 12:01:16 +00:00
Rearrangement, refactoring and a memory leak fix.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/apps/gorm/trunk@19296 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
4b58c2c8c1
commit
a840e3a7ee
12 changed files with 227 additions and 174 deletions
27
ChangeLog
27
ChangeLog
|
@ -1,3 +1,30 @@
|
||||||
|
2004-05-13 01:03 Gregory John Casamento <greg_casamento@yahoo.com>
|
||||||
|
|
||||||
|
NOTE: These changes might unstabilize things a bit.
|
||||||
|
* Gorm.m: The document is now autoreleased when it is instantiated.
|
||||||
|
This change was made in [Gorm application:openFile:],[Gorm open:],
|
||||||
|
[Gorm newGormDocument:].
|
||||||
|
* GormDocument.m: Addition of a method called
|
||||||
|
[GormDocument _closeAllEditors] this closes all of the editors from
|
||||||
|
the handleNotification method before the any objects are ultimately
|
||||||
|
released. Removal of old, commented out GormFontManager implementation.
|
||||||
|
Streamlined the dealloc method to make certain everything is released.
|
||||||
|
Also changed the window in the init method so that it doesn't release itself
|
||||||
|
when it's closed by the user. This allows for a more controlled shutdown.
|
||||||
|
* GormDocument.h: Minor code cleanup.
|
||||||
|
* GormGenericEditor.[hm]: Added activate, closed ivars. Also added code
|
||||||
|
in close and activate to make use of them. Added code in dealloc to call
|
||||||
|
[GormGenericEditor close] if there the flag indicates the editor is
|
||||||
|
open. Also moved some common, trivial, operations to the parent class
|
||||||
|
implementation of initWithObject:inDocument:.
|
||||||
|
* GormObjectEditor.m: Added code in close to remove the document from the
|
||||||
|
map. This eliminates a crash which was occurring.
|
||||||
|
* GormSoundEditor.m: Same.
|
||||||
|
* GormImageEditor.m: Same.
|
||||||
|
* GormViewEditor.m: Re-arranged the initWithObject:inDocument:.
|
||||||
|
* GormWindowEditor.m: Same.
|
||||||
|
* GormMenuEditor.m: Same.
|
||||||
|
|
||||||
2004-05-10 21:45 Gregory John Casamento <greg_casamento@yahoo.com>
|
2004-05-10 21:45 Gregory John Casamento <greg_casamento@yahoo.com>
|
||||||
|
|
||||||
* GormDocument.m: [GormDocument handleNotification:] was failing
|
* GormDocument.m: [GormDocument handleNotification:] was failing
|
||||||
|
|
23
Gorm.m
23
Gorm.m
|
@ -117,7 +117,6 @@ NSString *GormResizeCellNotification = @"GormResizeCellNotification";
|
||||||
// do not decode super (it would try to morph into theClass ! )
|
// do not decode super (it would try to morph into theClass ! )
|
||||||
[aCoder decodeValueOfObjCType: @encode(id) at: &theClass];
|
[aCoder decodeValueOfObjCType: @encode(id) at: &theClass];
|
||||||
theFrame = [aCoder decodeRect];
|
theFrame = [aCoder decodeRect];
|
||||||
//NSLog(@"Decoding proxy : %@", theClass);
|
|
||||||
RETAIN(theClass); // release in dealloc of GSNibItem...
|
RETAIN(theClass); // release in dealloc of GSNibItem...
|
||||||
|
|
||||||
return self;
|
return self;
|
||||||
|
@ -129,7 +128,6 @@ NSString *GormResizeCellNotification = @"GormResizeCellNotification";
|
||||||
theFrame = [aCoder decodeRect];
|
theFrame = [aCoder decodeRect];
|
||||||
[aCoder decodeValueOfObjCType: @encode(unsigned int)
|
[aCoder decodeValueOfObjCType: @encode(unsigned int)
|
||||||
at: &autoresizingMask];
|
at: &autoresizingMask];
|
||||||
//NSLog(@"Decoding proxy : %@", theClass);
|
|
||||||
RETAIN(theClass); // release in dealloc of GSNibItem...
|
RETAIN(theClass); // release in dealloc of GSNibItem...
|
||||||
|
|
||||||
return self;
|
return self;
|
||||||
|
@ -578,10 +576,10 @@ NSString *GormResizeCellNotification = @"GormResizeCellNotification";
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
- (void) open: (id) sender
|
- (void) open: (id) sender
|
||||||
{
|
{
|
||||||
GormDocument *doc = [GormDocument new];
|
GormDocument *doc = AUTORELEASE([GormDocument new]);
|
||||||
|
|
||||||
[documents addObject: doc];
|
[documents addObject: doc];
|
||||||
RELEASE(doc);
|
// RELEASE(doc);
|
||||||
if ([doc openDocument: sender] == nil)
|
if ([doc openDocument: sender] == nil)
|
||||||
{
|
{
|
||||||
[documents removeObjectIdenticalTo: doc];
|
[documents removeObjectIdenticalTo: doc];
|
||||||
|
@ -614,9 +612,9 @@ NSString *GormResizeCellNotification = @"GormResizeCellNotification";
|
||||||
//include Modules Menu
|
//include Modules Menu
|
||||||
- (void) newGormDocument : (id) sender
|
- (void) newGormDocument : (id) sender
|
||||||
{
|
{
|
||||||
id doc = [GormDocument new];
|
id doc = AUTORELEASE([GormDocument new]);
|
||||||
[documents addObject: doc];
|
[documents addObject: doc];
|
||||||
RELEASE(doc);
|
// RELEASE(doc);
|
||||||
switch ([sender tag])
|
switch ([sender tag])
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
|
@ -678,13 +676,15 @@ NSString *GormResizeCellNotification = @"GormResizeCellNotification";
|
||||||
if (doc != nil)
|
if (doc != nil)
|
||||||
{
|
{
|
||||||
[documents addObject: doc];
|
[documents addObject: doc];
|
||||||
|
// RELEASE(doc);
|
||||||
[[doc window] makeKeyAndOrderFront: self];
|
[[doc window] makeKeyAndOrderFront: self];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) close: (id)sender
|
- (void) close: (id)sender
|
||||||
{
|
{
|
||||||
NSWindow *window = [(GormDocument *)[self activeDocument] window];
|
GormDocument *document = (GormDocument *)[self activeDocument];
|
||||||
|
NSWindow *window = [document window];
|
||||||
|
|
||||||
[window setReleasedWhenClosed: YES];
|
[window setReleasedWhenClosed: YES];
|
||||||
[window performClose: self];
|
[window performClose: self];
|
||||||
|
@ -1137,14 +1137,11 @@ NSString *GormResizeCellNotification = @"GormResizeCellNotification";
|
||||||
}
|
}
|
||||||
else if ([name isEqual: IBWillCloseDocumentNotification])
|
else if ([name isEqual: IBWillCloseDocumentNotification])
|
||||||
{
|
{
|
||||||
RETAIN(obj); // release below...
|
|
||||||
[documents removeObjectIdenticalTo: obj];
|
[documents removeObjectIdenticalTo: obj];
|
||||||
AUTORELEASE(obj);
|
// AUTORELEASE(obj); // let the document go, once everything is done...
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
- (void) awakeFromNib
|
- (void) awakeFromNib
|
||||||
{
|
{
|
||||||
// set the menu...
|
// set the menu...
|
||||||
|
@ -1192,10 +1189,10 @@ NSString *GormResizeCellNotification = @"GormResizeCellNotification";
|
||||||
|
|
||||||
- (BOOL)application:(NSApplication *)application openFile:(NSString *)fileName
|
- (BOOL)application:(NSApplication *)application openFile:(NSString *)fileName
|
||||||
{
|
{
|
||||||
GormDocument *doc = [GormDocument new];
|
GormDocument *doc = AUTORELEASE([GormDocument new]);
|
||||||
|
|
||||||
[documents addObject: doc];
|
[documents addObject: doc];
|
||||||
RELEASE(doc);
|
// RELEASE(doc);
|
||||||
if ([doc loadDocument: fileName] == nil)
|
if ([doc loadDocument: fileName] == nil)
|
||||||
{
|
{
|
||||||
[documents removeObjectIdenticalTo: doc];
|
[documents removeObjectIdenticalTo: doc];
|
||||||
|
|
|
@ -69,7 +69,7 @@
|
||||||
NSMutableArray *hidden;
|
NSMutableArray *hidden;
|
||||||
NSMutableSet *sounds;
|
NSMutableSet *sounds;
|
||||||
NSMutableSet *images;
|
NSMutableSet *images;
|
||||||
// NSFileWrapper *wrapper;
|
// NSMutableArray *editors;
|
||||||
}
|
}
|
||||||
- (void) addConnector: (id<IBConnectors>)aConnector;
|
- (void) addConnector: (id<IBConnectors>)aConnector;
|
||||||
- (NSArray*) allConnectors;
|
- (NSArray*) allConnectors;
|
||||||
|
|
144
GormDocument.m
144
GormDocument.m
|
@ -107,44 +107,6 @@ NSString *GSCustomClassMap = @"GSCustomClassMap";
|
||||||
}
|
}
|
||||||
@end
|
@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;
|
|
||||||
}
|
|
||||||
- (NSString*) inspectorClassName
|
|
||||||
{
|
|
||||||
return @"GormNotApplicableInspector";
|
|
||||||
}
|
|
||||||
- (NSString*) connectInspectorClassName
|
|
||||||
{
|
|
||||||
return @"GormConnectionInspector";
|
|
||||||
}
|
|
||||||
- (NSString*) sizeInspectorClassName
|
|
||||||
{
|
|
||||||
return @"GormNotApplicableInspector";
|
|
||||||
}
|
|
||||||
- (NSString*) classInspectorClassName
|
|
||||||
{
|
|
||||||
return @"GormNotApplicableInspector";
|
|
||||||
}
|
|
||||||
- (NSString *)className
|
|
||||||
{
|
|
||||||
return @"NSFontManager";
|
|
||||||
}
|
|
||||||
@end
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -205,14 +167,6 @@ static NSImage *classesImage = nil;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
- (void) awakeWithContext: (NSDictionary *)context
|
|
||||||
{
|
|
||||||
// do nothing.. This is defined to override the one in GSNibContainer.
|
|
||||||
NSLog(@"In awakeWithContext");
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
- (void) addConnector: (id<IBConnectors>)aConnector
|
- (void) addConnector: (id<IBConnectors>)aConnector
|
||||||
{
|
{
|
||||||
if ([connections indexOfObjectIdenticalTo: aConnector] == NSNotFound)
|
if ([connections indexOfObjectIdenticalTo: aConnector] == NSNotFound)
|
||||||
|
@ -295,7 +249,6 @@ static NSImage *classesImage = nil;
|
||||||
[[self openEditorForObject: anObject] activate];
|
[[self openEditorForObject: anObject] activate];
|
||||||
if ([anObject isKindOfClass: [NSWindow class]] == YES)
|
if ([anObject isKindOfClass: [NSWindow class]] == YES)
|
||||||
{
|
{
|
||||||
// RETAIN(anObject);
|
|
||||||
[anObject setReleasedWhenClosed: NO];
|
[anObject setReleasedWhenClosed: NO];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -701,7 +654,7 @@ static NSImage *classesImage = nil;
|
||||||
toPasteboard: (NSPasteboard*)aPasteboard
|
toPasteboard: (NSPasteboard*)aPasteboard
|
||||||
{
|
{
|
||||||
NSEnumerator *enumerator;
|
NSEnumerator *enumerator;
|
||||||
NSMutableSet *editors;
|
NSMutableSet *editorSet;
|
||||||
id obj;
|
id obj;
|
||||||
NSMutableData *data;
|
NSMutableData *data;
|
||||||
NSArchiver *archiver;
|
NSArchiver *archiver;
|
||||||
|
@ -710,14 +663,14 @@ static NSImage *classesImage = nil;
|
||||||
* Remove all editors from the selected objects before archiving
|
* Remove all editors from the selected objects before archiving
|
||||||
* and restore them afterwards.
|
* and restore them afterwards.
|
||||||
*/
|
*/
|
||||||
editors = [NSMutableSet new];
|
editorSet = [NSMutableSet new];
|
||||||
enumerator = [anArray objectEnumerator];
|
enumerator = [anArray objectEnumerator];
|
||||||
while ((obj = [enumerator nextObject]) != nil)
|
while ((obj = [enumerator nextObject]) != nil)
|
||||||
{
|
{
|
||||||
id editor = [self editorForObject: obj create: NO];
|
id editor = [self editorForObject: obj create: NO];
|
||||||
if (editor != nil)
|
if (editor != nil)
|
||||||
{
|
{
|
||||||
[editors addObject: editor];
|
[editorSet addObject: editor];
|
||||||
[editor deactivate];
|
[editor deactivate];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -730,12 +683,12 @@ static NSImage *classesImage = nil;
|
||||||
[archiver encodeRootObject: anArray];
|
[archiver encodeRootObject: anArray];
|
||||||
|
|
||||||
// reactivate
|
// reactivate
|
||||||
enumerator = [editors objectEnumerator];
|
enumerator = [editorSet objectEnumerator];
|
||||||
while ((obj = [enumerator nextObject]) != nil)
|
while ((obj = [enumerator nextObject]) != nil)
|
||||||
{
|
{
|
||||||
[obj activate];
|
[obj activate];
|
||||||
}
|
}
|
||||||
RELEASE(editors);
|
RELEASE(editorSet);
|
||||||
|
|
||||||
[aPasteboard declareTypes: [NSArray arrayWithObject: aType]
|
[aPasteboard declareTypes: [NSArray arrayWithObject: aType]
|
||||||
owner: self];
|
owner: self];
|
||||||
|
@ -772,6 +725,21 @@ static NSImage *classesImage = nil;
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
// For debugging
|
||||||
|
- (id) retain
|
||||||
|
{
|
||||||
|
NSLog(@"Document being retained... %d: %@", [self retainCount], self);
|
||||||
|
return [super retain];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (oneway void) release
|
||||||
|
{
|
||||||
|
NSLog(@"Document being released... %d: %@", [self retainCount], self);
|
||||||
|
[super release];
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
- (void) pasteboardChangedOwner: (NSPasteboard*)sender
|
- (void) pasteboardChangedOwner: (NSPasteboard*)sender
|
||||||
{
|
{
|
||||||
NSDebugLog(@"Owner changed for %@", sender);
|
NSDebugLog(@"Owner changed for %@", sender);
|
||||||
|
@ -780,8 +748,6 @@ static NSImage *classesImage = nil;
|
||||||
- (void) dealloc
|
- (void) dealloc
|
||||||
{
|
{
|
||||||
[[NSNotificationCenter defaultCenter] removeObserver: self];
|
[[NSNotificationCenter defaultCenter] removeObserver: self];
|
||||||
[window setDelegate: nil];
|
|
||||||
[window performClose: self];
|
|
||||||
RELEASE(classManager);
|
RELEASE(classManager);
|
||||||
RELEASE(classEditor);
|
RELEASE(classEditor);
|
||||||
RELEASE(hidden);
|
RELEASE(hidden);
|
||||||
|
@ -796,6 +762,7 @@ static NSImage *classesImage = nil;
|
||||||
RELEASE(savedEditors);
|
RELEASE(savedEditors);
|
||||||
RELEASE(scrollView);
|
RELEASE(scrollView);
|
||||||
RELEASE(classesScrollView);
|
RELEASE(classesScrollView);
|
||||||
|
RELEASE(window);
|
||||||
[super dealloc];
|
[super dealloc];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1357,6 +1324,11 @@ static NSImage *classesImage = nil;
|
||||||
[connections removeObjectIdenticalTo: [links objectAtIndex: 0]];
|
[connections removeObjectIdenticalTo: [links objectAtIndex: 0]];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Add to the master list of editors for this document
|
||||||
|
*/
|
||||||
|
// [editors removeObjectIdenticalTo: anEditor];
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Make sure that this editor is not the selection owner.
|
* Make sure that this editor is not the selection owner.
|
||||||
*/
|
*/
|
||||||
|
@ -1398,6 +1370,15 @@ static NSImage *classesImage = nil;
|
||||||
[link setSource: anObject];
|
[link setSource: anObject];
|
||||||
[link setDestination: editor];
|
[link setDestination: editor];
|
||||||
[connections addObject: link];
|
[connections addObject: link];
|
||||||
|
|
||||||
|
// add to the list...
|
||||||
|
/*
|
||||||
|
if(![editors containsObject: editor])
|
||||||
|
{
|
||||||
|
[editors addObject: editor];
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
RELEASE(link);
|
RELEASE(link);
|
||||||
if (anEditor == nil)
|
if (anEditor == nil)
|
||||||
{
|
{
|
||||||
|
@ -1480,9 +1461,31 @@ static NSImage *classesImage = nil;
|
||||||
[savedEditors removeAllObjects];
|
[savedEditors removeAllObjects];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void) _closeAllEditors
|
||||||
|
{
|
||||||
|
NSEnumerator *enumerator;
|
||||||
|
id con;
|
||||||
|
|
||||||
|
// close all editors attached to objects...
|
||||||
|
enumerator = [connections objectEnumerator];
|
||||||
|
while ((con = [enumerator nextObject]) != nil)
|
||||||
|
{
|
||||||
|
if ([con isKindOfClass: [GormObjectToEditor class]] == YES)
|
||||||
|
{
|
||||||
|
[[con destination] close];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// close the editors in the document window...
|
||||||
|
[objectsView close];
|
||||||
|
[imagesView close];
|
||||||
|
[soundsView close];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
- (void) handleNotification: (NSNotification*)aNotification
|
- (void) handleNotification: (NSNotification*)aNotification
|
||||||
{
|
{
|
||||||
NSString *name = [aNotification name];
|
NSString *name = [aNotification name];
|
||||||
NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];
|
NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];
|
||||||
|
|
||||||
if ([name isEqual: NSWindowWillCloseNotification] == YES)
|
if ([name isEqual: NSWindowWillCloseNotification] == YES)
|
||||||
|
@ -1490,9 +1493,6 @@ static NSImage *classesImage = nil;
|
||||||
NSEnumerator *enumerator;
|
NSEnumerator *enumerator;
|
||||||
id obj;
|
id obj;
|
||||||
|
|
||||||
[nc postNotificationName: IBWillCloseDocumentNotification
|
|
||||||
object: self];
|
|
||||||
|
|
||||||
enumerator = [nameTable objectEnumerator];
|
enumerator = [nameTable objectEnumerator];
|
||||||
while ((obj = [enumerator nextObject]) != nil)
|
while ((obj = [enumerator nextObject]) != nil)
|
||||||
{
|
{
|
||||||
|
@ -1506,6 +1506,7 @@ static NSImage *classesImage = nil;
|
||||||
}
|
}
|
||||||
else if ([obj isKindOfClass: [NSWindow class]] == YES)
|
else if ([obj isKindOfClass: [NSWindow class]] == YES)
|
||||||
{
|
{
|
||||||
|
[obj setReleasedWhenClosed: NO];
|
||||||
if ([obj isVisible] == YES)
|
if ([obj isVisible] == YES)
|
||||||
{
|
{
|
||||||
[hidden addObject: obj];
|
[hidden addObject: obj];
|
||||||
|
@ -1514,8 +1515,13 @@ static NSImage *classesImage = nil;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// deactivate the document...
|
||||||
[self setDocumentActive: NO];
|
[self setDocumentActive: NO];
|
||||||
[self setSelectionFromEditor: nil];
|
[self setSelectionFromEditor: nil];
|
||||||
|
[self _closeAllEditors];
|
||||||
|
// [editors makeObjectsPerformSelector: @selector(close)]; // close all of the editors...
|
||||||
|
[nc postNotificationName: IBWillCloseDocumentNotification
|
||||||
|
object: self];
|
||||||
[nc removeObserver: self]; // stop listening to all notifications.
|
[nc removeObserver: self]; // stop listening to all notifications.
|
||||||
}
|
}
|
||||||
else if ([name isEqual: NSWindowDidBecomeKeyNotification] == YES)
|
else if ([name isEqual: NSWindowDidBecomeKeyNotification] == YES)
|
||||||
|
@ -1633,8 +1639,10 @@ static NSImage *classesImage = nil;
|
||||||
alpha: 1.0 ];
|
alpha: 1.0 ];
|
||||||
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
|
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
|
||||||
|
|
||||||
|
// editors = [NSMutableArray new];
|
||||||
classManager = [[GormClassManager alloc] init];
|
classManager = [[GormClassManager alloc] init];
|
||||||
classEditor = [[GormClassEditor alloc] initWithDocument: self];
|
classEditor = [[GormClassEditor alloc] initWithDocument: self];
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* NB. We must retain the map values (object names) as the nameTable
|
* NB. We must retain the map values (object names) as the nameTable
|
||||||
* may not hold identical name objects, but merely equal strings.
|
* may not hold identical name objects, but merely equal strings.
|
||||||
|
@ -1657,7 +1665,7 @@ static NSImage *classesImage = nil;
|
||||||
defer: NO];
|
defer: NO];
|
||||||
[window setMinSize: [window frame].size];
|
[window setMinSize: [window frame].size];
|
||||||
[window setTitle: _(@"UNTITLED")];
|
[window setTitle: _(@"UNTITLED")];
|
||||||
|
[window setReleasedWhenClosed: NO];
|
||||||
[window setDelegate: self];
|
[window setDelegate: self];
|
||||||
|
|
||||||
[nc addObserver: self
|
[nc addObserver: self
|
||||||
|
@ -1770,7 +1778,6 @@ static NSImage *classesImage = nil;
|
||||||
|
|
||||||
objectsView = [[GormObjectEditor alloc] initWithObject: nil
|
objectsView = [[GormObjectEditor alloc] initWithObject: nil
|
||||||
inDocument: self];
|
inDocument: self];
|
||||||
AUTORELEASE(objectsView);
|
|
||||||
[objectsView setFrame: mainRect];
|
[objectsView setFrame: mainRect];
|
||||||
[objectsView setAutoresizingMask:
|
[objectsView setAutoresizingMask:
|
||||||
NSViewHeightSizable|NSViewWidthSizable];
|
NSViewHeightSizable|NSViewWidthSizable];
|
||||||
|
@ -1788,7 +1795,6 @@ static NSImage *classesImage = nil;
|
||||||
|
|
||||||
imagesView = [[GormImageEditor alloc] initWithObject: nil
|
imagesView = [[GormImageEditor alloc] initWithObject: nil
|
||||||
inDocument: self];
|
inDocument: self];
|
||||||
AUTORELEASE(imagesView);
|
|
||||||
[imagesView setFrame: mainRect];
|
[imagesView setFrame: mainRect];
|
||||||
[imagesView setAutoresizingMask: NSViewHeightSizable|NSViewWidthSizable];
|
[imagesView setAutoresizingMask: NSViewHeightSizable|NSViewWidthSizable];
|
||||||
[imagesScrollView setDocumentView: imagesView];
|
[imagesScrollView setDocumentView: imagesView];
|
||||||
|
@ -1805,7 +1811,6 @@ static NSImage *classesImage = nil;
|
||||||
|
|
||||||
soundsView = [[GormSoundEditor alloc] initWithObject: nil
|
soundsView = [[GormSoundEditor alloc] initWithObject: nil
|
||||||
inDocument: self];
|
inDocument: self];
|
||||||
AUTORELEASE(soundsView);
|
|
||||||
[soundsView setFrame: mainRect];
|
[soundsView setFrame: mainRect];
|
||||||
[soundsView setAutoresizingMask: NSViewHeightSizable|NSViewWidthSizable];
|
[soundsView setAutoresizingMask: NSViewHeightSizable|NSViewWidthSizable];
|
||||||
[soundsScrollView setDocumentView: soundsView];
|
[soundsScrollView setDocumentView: soundsView];
|
||||||
|
@ -1912,6 +1917,13 @@ static NSImage *classesImage = nil;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
// add editors here to the list...
|
||||||
|
// [editors addObject: classEditor];
|
||||||
|
[editors addObject: objectsView];
|
||||||
|
[editors addObject: imagesView];
|
||||||
|
[editors addObject: soundsView];
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
@ -2600,7 +2612,7 @@ static NSImage *classesImage = nil;
|
||||||
[self attachObject: aMenu toParent: nil];
|
[self attachObject: aMenu toParent: nil];
|
||||||
[objectsView addObject: aMenu];
|
[objectsView addObject: aMenu];
|
||||||
[[aMenu window] setFrameTopLeftPoint:
|
[[aMenu window] setFrameTopLeftPoint:
|
||||||
NSMakePoint(1, frame.size.height-200)];
|
NSMakePoint(1, frame.size.height-200)];
|
||||||
RELEASE(aMenu);
|
RELEASE(aMenu);
|
||||||
}
|
}
|
||||||
else if ([type isEqual: @"Inspector"] == YES)
|
else if ([type isEqual: @"Inspector"] == YES)
|
||||||
|
@ -2627,7 +2639,7 @@ static NSImage *classesImage = nil;
|
||||||
}
|
}
|
||||||
|
|
||||||
[aWindow setFrameTopLeftPoint:
|
[aWindow setFrameTopLeftPoint:
|
||||||
NSMakePoint(220, frame.size.height-100)];
|
NSMakePoint(220, frame.size.height-100)];
|
||||||
[aWindow setTitle: _(@"Inspector Window")];
|
[aWindow setTitle: _(@"Inspector Window")];
|
||||||
[self setName: @"InspectorWin" forObject: aWindow];
|
[self setName: @"InspectorWin" forObject: aWindow];
|
||||||
[self attachObject: aWindow toParent: nil];
|
[self attachObject: aWindow toParent: nil];
|
||||||
|
@ -2657,7 +2669,7 @@ static NSImage *classesImage = nil;
|
||||||
}
|
}
|
||||||
|
|
||||||
[aWindow setFrameTopLeftPoint:
|
[aWindow setFrameTopLeftPoint:
|
||||||
NSMakePoint(220, frame.size.height-100)];
|
NSMakePoint(220, frame.size.height-100)];
|
||||||
[aWindow setTitle: _(@"Palette Window")];
|
[aWindow setTitle: _(@"Palette Window")];
|
||||||
[self setName: @"PaletteWin" forObject: aWindow];
|
[self setName: @"PaletteWin" forObject: aWindow];
|
||||||
[self attachObject: aWindow toParent: nil];
|
[self attachObject: aWindow toParent: nil];
|
||||||
|
@ -3310,8 +3322,8 @@ static NSImage *classesImage = nil;
|
||||||
}
|
}
|
||||||
|
|
||||||
return YES;
|
return YES;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (BOOL) windowShouldClose: (id)sender
|
- (BOOL) windowShouldClose: (id)sender
|
||||||
{
|
{
|
||||||
return [self couldCloseDocument];
|
return [self couldCloseDocument];
|
||||||
|
|
|
@ -22,6 +22,7 @@
|
||||||
|
|
||||||
- (BOOL) activate
|
- (BOOL) activate
|
||||||
{
|
{
|
||||||
|
activated = YES;
|
||||||
[[self window] makeKeyAndOrderFront: self];
|
[[self window] makeKeyAndOrderFront: self];
|
||||||
return YES;
|
return YES;
|
||||||
}
|
}
|
||||||
|
@ -87,6 +88,7 @@
|
||||||
|
|
||||||
- (void) close
|
- (void) close
|
||||||
{
|
{
|
||||||
|
closed = YES;
|
||||||
[self deactivate];
|
[self deactivate];
|
||||||
[self closeSubeditors];
|
[self closeSubeditors];
|
||||||
}
|
}
|
||||||
|
@ -103,6 +105,13 @@
|
||||||
|
|
||||||
- (id) initWithObject: (id)anObject inDocument: (id<IBDocuments>)aDocument
|
- (id) initWithObject: (id)anObject inDocument: (id<IBDocuments>)aDocument
|
||||||
{
|
{
|
||||||
|
if((self = [super init]) != nil)
|
||||||
|
{
|
||||||
|
// don't retain the document...
|
||||||
|
document = aDocument;
|
||||||
|
closed = NO;
|
||||||
|
activated = NO;
|
||||||
|
}
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -117,6 +126,7 @@
|
||||||
|
|
||||||
- (void) deactivate
|
- (void) deactivate
|
||||||
{
|
{
|
||||||
|
activated = NO;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) copySelection
|
- (void) copySelection
|
||||||
|
@ -130,7 +140,10 @@
|
||||||
|
|
||||||
- (void) dealloc
|
- (void) dealloc
|
||||||
{
|
{
|
||||||
RELEASE(objects);
|
if(closed == NO)
|
||||||
|
[self close];
|
||||||
|
|
||||||
|
// RELEASE(objects); // FIXME: This will leak...
|
||||||
[super dealloc];
|
[super dealloc];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -49,7 +49,7 @@ static int handled_mask= NSDragOperationCopy|NSDragOperationGeneric|NSDragOperat
|
||||||
if (self == [GormImageEditor class])
|
if (self == [GormImageEditor class])
|
||||||
{
|
{
|
||||||
docMap = NSCreateMapTable(NSNonRetainedObjectMapKeyCallBacks,
|
docMap = NSCreateMapTable(NSNonRetainedObjectMapKeyCallBacks,
|
||||||
NSObjectMapValueCallBacks, 2);
|
NSObjectMapValueCallBacks, 2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -194,13 +194,11 @@ static int handled_mask= NSDragOperationCopy|NSDragOperationGeneric|NSDragOperat
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
self = [super init];
|
self = [super initWithObject: anObject inDocument: aDocument];
|
||||||
if (self != nil)
|
if (self != nil)
|
||||||
{
|
{
|
||||||
NSButtonCell *proto;
|
NSButtonCell *proto;
|
||||||
|
|
||||||
document = aDocument;
|
|
||||||
|
|
||||||
[self registerForDraggedTypes: [NSArray arrayWithObjects:
|
[self registerForDraggedTypes: [NSArray arrayWithObjects:
|
||||||
NSFilenamesPboardType, nil]];
|
NSFilenamesPboardType, nil]];
|
||||||
|
|
||||||
|
@ -238,6 +236,13 @@ static int handled_mask= NSDragOperationCopy|NSDragOperationGeneric|NSDragOperat
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void) close
|
||||||
|
{
|
||||||
|
[super close];
|
||||||
|
[[NSNotificationCenter defaultCenter] removeObserver: self];
|
||||||
|
NSMapRemove(docMap,document);
|
||||||
|
}
|
||||||
|
|
||||||
- (void) makeSelectionVisible: (BOOL)flag
|
- (void) makeSelectionVisible: (BOOL)flag
|
||||||
{
|
{
|
||||||
if (flag == YES && selected != nil)
|
if (flag == YES && selected != nil)
|
||||||
|
@ -489,6 +494,7 @@ static int handled_mask= NSDragOperationCopy|NSDragOperationGeneric|NSDragOperat
|
||||||
RELEASE(name);
|
RELEASE(name);
|
||||||
RELEASE(path);
|
RELEASE(path);
|
||||||
RELEASE(image);
|
RELEASE(image);
|
||||||
|
[super dealloc];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) setImageName: (NSString *)aName
|
- (void) setImageName: (NSString *)aName
|
||||||
|
|
|
@ -111,9 +111,6 @@ static NSMapTable *docMap = 0;
|
||||||
return NO;
|
return NO;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
- (void) copySelection
|
- (void) copySelection
|
||||||
{
|
{
|
||||||
if (selected != nil)
|
if (selected != nil)
|
||||||
|
@ -252,10 +249,10 @@ static NSMapTable *docMap = 0;
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
- (void) handleNotification: (NSNotification*)aNotification
|
- (void) handleNotification: (NSNotification*)aNotification
|
||||||
{
|
{
|
||||||
NSString *name = [aNotification name];
|
NSString *name = [aNotification name];
|
||||||
|
|
||||||
if([name isEqual: GormResizeCellNotification])
|
if([name isEqual: GormResizeCellNotification])
|
||||||
{
|
{
|
||||||
NSDebugLog(@"Recieved notification");
|
NSDebugLog(@"Recieved notification");
|
||||||
|
@ -263,7 +260,6 @@ static NSMapTable *docMap = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Initialisation - register to receive DnD with our own types.
|
* Initialisation - register to receive DnD with our own types.
|
||||||
*/
|
*/
|
||||||
|
@ -279,7 +275,7 @@ static NSMapTable *docMap = 0;
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
self = [super init];
|
self = [super initWithObject: anObject inDocument: aDocument];
|
||||||
if (self != nil)
|
if (self != nil)
|
||||||
{
|
{
|
||||||
NSButtonCell *proto;
|
NSButtonCell *proto;
|
||||||
|
@ -324,6 +320,13 @@ static NSMapTable *docMap = 0;
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void) close
|
||||||
|
{
|
||||||
|
[super close];
|
||||||
|
[[NSNotificationCenter defaultCenter] removeObserver: self];
|
||||||
|
NSMapRemove(docMap,document);
|
||||||
|
}
|
||||||
|
|
||||||
- (void) makeSelectionVisible: (BOOL)flag
|
- (void) makeSelectionVisible: (BOOL)flag
|
||||||
{
|
{
|
||||||
if (flag == YES && selected != nil)
|
if (flag == YES && selected != nil)
|
||||||
|
|
|
@ -175,6 +175,8 @@ extern NSString *GormResizeCellNotification;
|
||||||
id selected;
|
id selected;
|
||||||
NSPasteboard *dragPb;
|
NSPasteboard *dragPb;
|
||||||
NSString *dragType;
|
NSString *dragType;
|
||||||
|
BOOL closed;
|
||||||
|
BOOL activated;
|
||||||
}
|
}
|
||||||
// selection methods...
|
// selection methods...
|
||||||
- (void) selectObjects: (NSArray*)objects;
|
- (void) selectObjects: (NSArray*)objects;
|
||||||
|
@ -214,15 +216,9 @@ extern NSString *GormResizeCellNotification;
|
||||||
- (id) changeSelection: (id)sender;
|
- (id) changeSelection: (id)sender;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@interface GormObjectEditor : GormGenericEditor // <IBEditors, IBSelectionOwners>
|
@interface GormObjectEditor : GormGenericEditor
|
||||||
{
|
{
|
||||||
// NSMutableArray *objects;
|
|
||||||
// id<IBDocuments> document;
|
|
||||||
// id selected;
|
|
||||||
// NSPasteboard *dragPb;
|
|
||||||
// NSString *dragType;
|
|
||||||
}
|
}
|
||||||
// + (GormObjectEditor*) editorForDocument: (id<IBDocuments>)aDocument;
|
|
||||||
- (void) draggedImage: (NSImage*)i endedAt: (NSPoint)p deposited: (BOOL)f;
|
- (void) draggedImage: (NSImage*)i endedAt: (NSPoint)p deposited: (BOOL)f;
|
||||||
- (unsigned int) draggingSourceOperationMaskForLocal: (BOOL)flag;
|
- (unsigned int) draggingSourceOperationMaskForLocal: (BOOL)flag;
|
||||||
- (BOOL) acceptsTypeFromArray: (NSArray*)types;
|
- (BOOL) acceptsTypeFromArray: (NSArray*)types;
|
||||||
|
@ -230,13 +226,8 @@ extern NSString *GormResizeCellNotification;
|
||||||
- (void) resetObject: (id)anObject;
|
- (void) resetObject: (id)anObject;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@interface GormSoundEditor : GormGenericEditor // <IBEditors, IBSelectionOwners>
|
@interface GormSoundEditor : GormGenericEditor
|
||||||
{
|
{
|
||||||
// NSMutableArray *objects;
|
|
||||||
// id<IBDocuments> document;
|
|
||||||
// id selected;
|
|
||||||
// NSPasteboard *dragPb;
|
|
||||||
// NSString *dragType;
|
|
||||||
}
|
}
|
||||||
// don't redeclare methods already declared in protocols.
|
// don't redeclare methods already declared in protocols.
|
||||||
+ (GormSoundEditor*) editorForDocument: (id<IBDocuments>)aDocument;
|
+ (GormSoundEditor*) editorForDocument: (id<IBDocuments>)aDocument;
|
||||||
|
@ -244,7 +235,7 @@ extern NSString *GormResizeCellNotification;
|
||||||
- (unsigned int) draggingSourceOperationMaskForLocal: (BOOL)flag;
|
- (unsigned int) draggingSourceOperationMaskForLocal: (BOOL)flag;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@interface GormImageEditor : GormGenericEditor // <IBEditors, IBSelectionOwners>
|
@interface GormImageEditor : GormGenericEditor
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
// don't redeclare methods already declared in protocols.
|
// don't redeclare methods already declared in protocols.
|
||||||
|
|
|
@ -171,6 +171,7 @@ static NSMapTable *docMap = 0;
|
||||||
- (void) handleNotification: (NSNotification*)aNotification
|
- (void) handleNotification: (NSNotification*)aNotification
|
||||||
{
|
{
|
||||||
NSString *name = [aNotification name];
|
NSString *name = [aNotification name];
|
||||||
|
|
||||||
if([name isEqual: GormResizeCellNotification])
|
if([name isEqual: GormResizeCellNotification])
|
||||||
{
|
{
|
||||||
NSDebugLog(@"Recieved notification");
|
NSDebugLog(@"Recieved notification");
|
||||||
|
@ -193,13 +194,11 @@ static NSMapTable *docMap = 0;
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
self = [super init];
|
self = [super initWithObject: anObject inDocument: aDocument];
|
||||||
if (self != nil)
|
if (self != nil)
|
||||||
{
|
{
|
||||||
NSButtonCell *proto;
|
NSButtonCell *proto;
|
||||||
|
|
||||||
document = aDocument;
|
|
||||||
|
|
||||||
[self registerForDraggedTypes: [NSArray arrayWithObjects:
|
[self registerForDraggedTypes: [NSArray arrayWithObjects:
|
||||||
IBObjectPboardType, GormLinkPboardType, nil]];
|
IBObjectPboardType, GormLinkPboardType, nil]];
|
||||||
|
|
||||||
|
@ -237,6 +236,13 @@ static NSMapTable *docMap = 0;
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void) close
|
||||||
|
{
|
||||||
|
[super close];
|
||||||
|
[[NSNotificationCenter defaultCenter] removeObserver: self];
|
||||||
|
NSMapRemove(docMap,document);
|
||||||
|
}
|
||||||
|
|
||||||
- (void) makeSelectionVisible: (BOOL)flag
|
- (void) makeSelectionVisible: (BOOL)flag
|
||||||
{
|
{
|
||||||
if (flag == YES && selected != nil)
|
if (flag == YES && selected != nil)
|
||||||
|
|
|
@ -213,7 +213,6 @@ static BOOL currently_displaying = NO;
|
||||||
|
|
||||||
- (void) close
|
- (void) close
|
||||||
{
|
{
|
||||||
|
|
||||||
if (closed == NO)
|
if (closed == NO)
|
||||||
{
|
{
|
||||||
[self deactivate];
|
[self deactivate];
|
||||||
|
@ -248,7 +247,6 @@ static BOOL currently_displaying = NO;
|
||||||
if (closed == NO)
|
if (closed == NO)
|
||||||
[self close];
|
[self close];
|
||||||
|
|
||||||
// RELEASE(_editedObject);
|
|
||||||
[super dealloc];
|
[super dealloc];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -256,37 +254,33 @@ static BOOL currently_displaying = NO;
|
||||||
inDocument: (id<IBDocuments>)aDocument
|
inDocument: (id<IBDocuments>)aDocument
|
||||||
{
|
{
|
||||||
NSMutableArray *draggedTypes;
|
NSMutableArray *draggedTypes;
|
||||||
_editedObject = (NSView*)anObject;
|
|
||||||
|
|
||||||
if ((self = [super initWithFrame: [_editedObject frame]]) == nil)
|
ASSIGN(_editedObject, (NSView*)anObject);
|
||||||
return nil;
|
|
||||||
|
|
||||||
RETAIN(_editedObject);
|
if ((self = [super initWithFrame: [_editedObject frame]]) != nil)
|
||||||
|
|
||||||
document = aDocument;
|
|
||||||
|
|
||||||
draggedTypes = [NSMutableArray arrayWithObject: GormLinkPboardType];
|
|
||||||
|
|
||||||
|
|
||||||
if ([_editedObject respondsToSelector: @selector(setImage:)])
|
|
||||||
{
|
{
|
||||||
[draggedTypes addObject: GormImagePboardType];
|
// we do not retain the document...
|
||||||
|
document = aDocument;
|
||||||
|
|
||||||
|
draggedTypes = [NSMutableArray arrayWithObject: GormLinkPboardType];
|
||||||
|
if ([_editedObject respondsToSelector: @selector(setImage:)])
|
||||||
|
{
|
||||||
|
[draggedTypes addObject: GormImagePboardType];
|
||||||
|
}
|
||||||
|
if ([_editedObject respondsToSelector: @selector(setSound:)])
|
||||||
|
{
|
||||||
|
[draggedTypes addObject: GormSoundPboardType];
|
||||||
|
}
|
||||||
|
|
||||||
|
[self registerForDraggedTypes: draggedTypes];
|
||||||
|
|
||||||
|
activated = NO;
|
||||||
|
closed = NO;
|
||||||
}
|
}
|
||||||
if ([_editedObject respondsToSelector: @selector(setSound:)])
|
|
||||||
{
|
|
||||||
[draggedTypes addObject: GormSoundPboardType];
|
|
||||||
}
|
|
||||||
|
|
||||||
[self registerForDraggedTypes: draggedTypes];
|
|
||||||
|
|
||||||
|
|
||||||
activated = NO;
|
|
||||||
closed = NO;
|
|
||||||
|
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
- (void) editedObjectFrameDidChange: (id) sender
|
- (void) editedObjectFrameDidChange: (id) sender
|
||||||
{
|
{
|
||||||
[self setFrame: [_editedObject frame]];
|
[self setFrame: [_editedObject frame]];
|
||||||
|
|
|
@ -227,13 +227,12 @@
|
||||||
- (void) dealloc
|
- (void) dealloc
|
||||||
{
|
{
|
||||||
if (closed == NO)
|
if (closed == NO)
|
||||||
{
|
|
||||||
[self close];
|
[self close];
|
||||||
}
|
|
||||||
RELEASE(edited);
|
// RELEASE(edited);
|
||||||
RELEASE(selection);
|
RELEASE(selection);
|
||||||
RELEASE(subeditors);
|
RELEASE(subeditors);
|
||||||
RELEASE(document);
|
// RELEASE(document);
|
||||||
[super dealloc];
|
[super dealloc];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -282,14 +281,22 @@
|
||||||
- (id) initWithObject: (id)anObject
|
- (id) initWithObject: (id)anObject
|
||||||
inDocument: (id<IBDocuments>)aDocument
|
inDocument: (id<IBDocuments>)aDocument
|
||||||
{
|
{
|
||||||
_displaySelection = YES;
|
NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];
|
||||||
_editedObject = (NSView*)anObject;
|
|
||||||
edited = anObject;
|
|
||||||
|
|
||||||
if ((self = [super initWithFrame: NSZeroRect]) == nil)
|
if ((self = [super initWithFrame: NSZeroRect]) == nil)
|
||||||
return nil;
|
return nil;
|
||||||
|
|
||||||
document = aDocument;
|
[nc addObserver: self
|
||||||
|
selector: @selector(handleNotification:)
|
||||||
|
name: IBWillCloseDocumentNotification
|
||||||
|
object: aDocument];
|
||||||
|
|
||||||
|
_displaySelection = YES;
|
||||||
|
_editedObject = (NSView*)anObject;
|
||||||
|
ASSIGN(edited, anObject);
|
||||||
|
RETAIN(edited);
|
||||||
|
// we don't retain the document...
|
||||||
|
document = aDocument;
|
||||||
|
|
||||||
[self registerForDraggedTypes: [NSArray arrayWithObjects:
|
[self registerForDraggedTypes: [NSArray arrayWithObjects:
|
||||||
GormLinkPboardType, IBViewPboardType, nil]];
|
GormLinkPboardType, IBViewPboardType, nil]];
|
||||||
|
@ -400,5 +407,4 @@
|
||||||
// [document setSelectionFromEditor: self];
|
// [document setSelectionFromEditor: self];
|
||||||
[self makeSelectionVisible: NO];
|
[self makeSelectionVisible: NO];
|
||||||
}
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
|
@ -384,7 +384,6 @@
|
||||||
|
|
||||||
- (BOOL) activate
|
- (BOOL) activate
|
||||||
{
|
{
|
||||||
// NSAssert(isClosed == NO, NSInternalInconsistencyException);
|
|
||||||
if (original == nil)
|
if (original == nil)
|
||||||
{
|
{
|
||||||
NSWindow *w;
|
NSWindow *w;
|
||||||
|
@ -435,7 +434,6 @@
|
||||||
|
|
||||||
- (void) close
|
- (void) close
|
||||||
{
|
{
|
||||||
// NSAssert(isClosed == NO, NSInternalInconsistencyException);
|
|
||||||
isClosed = YES;
|
isClosed = YES;
|
||||||
[[NSNotificationCenter defaultCenter] removeObserver: self];
|
[[NSNotificationCenter defaultCenter] removeObserver: self];
|
||||||
|
|
||||||
|
@ -446,11 +444,8 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
[self closeSubeditors];
|
[self closeSubeditors];
|
||||||
|
|
||||||
[self deactivate];
|
[self deactivate];
|
||||||
|
|
||||||
[edited close];
|
[edited close];
|
||||||
|
|
||||||
[document editor: self didCloseForObject: edited];
|
[document editor: self didCloseForObject: edited];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -503,10 +498,9 @@
|
||||||
{
|
{
|
||||||
[self close];
|
[self close];
|
||||||
}
|
}
|
||||||
RELEASE(edited);
|
// RELEASE(edited);
|
||||||
RELEASE(selection);
|
RELEASE(selection);
|
||||||
RELEASE(subeditor);
|
RELEASE(subeditor);
|
||||||
RELEASE(document);
|
|
||||||
[super dealloc];
|
[super dealloc];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -666,21 +660,25 @@ void _attachAll(NSMenu *menu, id document)
|
||||||
- (id) initWithObject: (id)anObject inDocument: (id<IBDocuments>)aDocument
|
- (id) initWithObject: (id)anObject inDocument: (id<IBDocuments>)aDocument
|
||||||
{
|
{
|
||||||
self = [super init];
|
self = [super init];
|
||||||
ASSIGN(document, aDocument);
|
if(self != nil)
|
||||||
ASSIGN(edited, anObject);
|
{
|
||||||
selection = [NSMutableArray new];
|
document = aDocument;
|
||||||
rep = [edited menuRepresentation];
|
ASSIGN(edited, anObject);
|
||||||
/*
|
RETAIN(edited);
|
||||||
* Permit views and connections to be dragged in to the window.
|
selection = [NSMutableArray new];
|
||||||
*/
|
rep = [edited menuRepresentation];
|
||||||
[self registerForDraggedTypes: [NSArray arrayWithObjects:
|
|
||||||
IBMenuPboardType, GormLinkPboardType, nil]];
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Make sure that all our menu items are attached in the document.
|
* Permit views and connections to be dragged in to the window.
|
||||||
*/
|
*/
|
||||||
_attachAll(edited, document);
|
[self registerForDraggedTypes: [NSArray arrayWithObjects:
|
||||||
// [document attachObjects: [edited itemArray] toParent: edited];
|
IBMenuPboardType, GormLinkPboardType, nil]];
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Make sure that all our menu items are attached in the document.
|
||||||
|
*/
|
||||||
|
_attachAll(edited, document);
|
||||||
|
}
|
||||||
|
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue