Correcting some menu difficulties with Gorm.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/apps/gorm/trunk@17827 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Gregory John Casamento 2003-10-13 03:32:51 +00:00
parent 7c8894276f
commit 7b2f9f74b4
6 changed files with 78 additions and 11 deletions

View file

@ -1,3 +1,16 @@
2003-10-12 23:25 Gregory John Casamento <greg_casamento@yahoo.com>
* GormInspectorsManager.m: Corrected method of disassociating
connection after exception.
* GormMenuEditor.m: Added _findAll:withArray: and _findAllSubmenus:
to recursively collect all objects which should be deleted from the
nameTable when the user deletes a menu item.
* Palettes/0Menus/GormMenuInspectors.m: Eliminated uneeded variable
and corrected method being called to eliminate previous setting
of services/window menu.
* Palettes/0Menus/GormNSMenu.m: Beginnings of fix to prevent Gorm
from loading all menus at once.
2003-10-12 01:49 Gregory John Casamento <greg_casamento@yahoo.com>
* GormDocument.m: Added code to help with copy/paste issue.

4
Gorm.m
View file

@ -517,9 +517,9 @@ NSString *GormDidDeleteClassNotification = @"GormDidDeleteClassNotification";
forKey: @"ApplicationName"];
[dict setObject: @"[GNUstep | Graphical] Object Relationship Modeller"
forKey: @"ApplicationDescription"];
[dict setObject: @"Gorm 0.4.1 (Beta)"
[dict setObject: @"Gorm 0.4.3 (Beta)"
forKey: @"ApplicationRelease"];
[dict setObject: @"0.4.1 Oct 12 2003"
[dict setObject: @"0.4.3 Oct 12 2003"
forKey: @"FullVersionID"];
[dict setObject: [NSArray arrayWithObjects: @"Gregory John Casamento <greg_casamento@yahoo.com>",
@"Richard Frith-Macdonald <rfm@gnu.org>",

View file

@ -1074,8 +1074,8 @@ selectCellWithString: (NSString*)title
NSString *msg = [NSString stringWithFormat: @"Cannot establish connection: %@",
[localException reason]];
// get rid of the bad connector and recover.
[[currentConnector source] setTarget: nil]; // unset these values on the source.
[[currentConnector source] setAction: nil]; // ibid.
[currentConnector setDestination: nil];
[currentConnector establishConnection];
[[(id<IB>)NSApp activeDocument] removeConnector: currentConnector];
NSRunAlertPanel(_(@"Problem making connection"), msg,
_(@"OK"),nil,nil,nil);
@ -1135,8 +1135,8 @@ selectCellWithString: (NSString*)title
NSString *msg = [NSString stringWithFormat: @"Cannot establish connection: %@",
[localException reason]];
// get rid of the bad connector and recover.
[[currentConnector source] setTarget: nil]; // unset these values on the source.
[[currentConnector source] setAction: nil]; // ibid.
[currentConnector setDestination: nil];
[currentConnector establishConnection];
[[(id<IB>)NSApp activeDocument] removeConnector: currentConnector];
NSRunAlertPanel(_(@"Problem making connection"), msg,
_(@"OK"),nil,nil,nil);

View file

@ -506,6 +506,43 @@
[super dealloc];
}
// find all subitems for the given items...
- (void) _findAll: (id)item withArray: (NSMutableArray *)array
{
[array addObject: item];
if([item isKindOfClass: [NSMenuItem class]])
{
if([item hasSubmenu])
{
NSMenu *submenu = [item submenu];
NSArray *items = [submenu itemArray];
NSEnumerator *e = [items objectEnumerator];
id i = nil;
[array addObject: submenu];
while((i = [e nextObject]) != nil)
{
[self _findAll: i withArray: array];
}
}
}
}
// find all sub items for the selections...
- (NSArray *) _findAllSubmenus: (NSArray *)array
{
NSEnumerator *e = [array objectEnumerator];
id i = nil;
NSMutableArray *results = [[NSMutableArray alloc] init];
while((i = [e nextObject]) != nil)
{
[self _findAll: i withArray: results];
}
return results;
}
- (void) deleteSelection
{
if ([selection count] > 0)
@ -513,14 +550,20 @@
NSArray *s = [NSArray arrayWithArray: selection];
NSEnumerator *e = [s objectEnumerator];
NSMenuItem *i;
NSArray *d = nil;
[self makeSelectionVisible: NO];
[self selectObjects: [NSArray array]];
// find all relavent objects. Remove them from the nameTable.
d = [self _findAllSubmenus: s];
[document detachObjects: d];
// remove the items from the menu...
while ((i = [e nextObject]) != nil && [edited numberOfItems] > 1)
{
[edited removeItem: i];
}
[document detachObjects: s];
}
}

View file

@ -57,8 +57,9 @@
- (void) setObject: (id)anObject
{
BOOL flag = NO;
GormDocument *doc = (GormDocument *)[(id<IB>)NSApp activeDocument];
// BOOL flag = NO;
[super setObject: anObject];
[titleText setStringValue: [object title]];
@ -89,7 +90,7 @@
[doc setWindowsMenu: [self object]];
if([doc servicesMenu] == [self object])
{
[doc setServicesObject: nil];
[doc setServicesMenu: nil];
}
}
@ -99,7 +100,7 @@
[doc setServicesMenu: [self object]];
if([doc windowsMenu] == [self object])
{
[doc setWindowsObject: nil];
[doc setWindowsMenu: nil];
}
}

View file

@ -42,7 +42,7 @@
}
@end
@interface GormNSMenuWindow : NSWindow
@interface GormNSMenuWindow : NSWindow // NSPanel
{
GormDocument *_document;
}
@ -125,9 +125,19 @@
[win setMenu: self];
[win setLevel: NSSubmenuWindowLevel];
// [win setWorksWhenModal: NO];
// [win setBecomesKeyOnlyIfNeeded: YES];
return win;
}
- (void) awakeFromDocument: (id)document
{
if([self supermenu] == nil)
{
// bring main menu to front.
}
}
@end
@implementation NSMenu (GormNSMenu)