Fix for longstanding Menu display bug in Gorm. Thank goodness. ;)

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/apps/gorm/trunk@19220 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Gregory John Casamento 2004-05-01 00:05:53 +00:00
parent fc4748f39b
commit 0db2a1bb38
6 changed files with 86 additions and 32 deletions

View file

@ -1,4 +1,18 @@
2004-04-30 22:15 Gregory John Casamento <greg_casamento@yahoo.com>
2004-04-30 20:04 Gregory John Casamento <greg_casamento@yahoo.com>
* Gorm.m: Removed code which calls "awakeFromDocument:" on
objects loaded in palettes.
* GormDocument.m: [GormDocument loadGormDocument:] added back
code which calls awakeFromDocument:. Also in [GormDocument
setDocumentActive:] removed code which was causing all menus
to display instead of just the main menu when loading a .gorm.
* GormMenuEditor.m: [GormMenuEditor activate] removed code
which was causing all submenus to be displayed when the editor
for a menu was activated.
* GormMenuInspectors.m: Removed awakeFromDocument: method.
* GormNSMenu.m: Commented out some old code.
2004-04-30 19:15 Gregory John Casamento <greg_casamento@yahoo.com>
* GormDocument.m: Modified _repairFile so that it works. :)
* Gorm.gorm: Removed some extraneous menu items/submenus.

2
Gorm.m
View file

@ -596,6 +596,7 @@ NSString *GormResizeCellNotification = @"GormResizeCellNotification";
// order everything front.
[[doc window] makeKeyAndOrderFront: self];
/*
// the load is completed, awaken all of the elements.
while ((key = [enumerator nextObject]) != nil)
{
@ -605,6 +606,7 @@ NSString *GormResizeCellNotification = @"GormResizeCellNotification";
[o awakeFromDocument: doc];
}
}
*/
}
}

View file

@ -2034,7 +2034,7 @@ static NSImage *classesImage = nil;
GSNibContainer *c;
NSEnumerator *enumerator;
id <IBConnectors> con;
NSString *ownerClass; // , *key;
NSString *ownerClass, *key;
NSFileManager *mgr = [NSFileManager defaultManager];
BOOL isDir = NO;
NSDirectoryEnumerator *dirEnumerator;
@ -2253,17 +2253,16 @@ static NSImage *classesImage = nil;
NSDebugLog(@"nameTable = %@",[c nameTable]);
//
// enumerator = [[c nameTable] keyEnumerator];
// while ((key = [enumerator nextObject]) != nil)
// {
// id o = [[c nameTable] objectForKey: key];
// if ([o respondsToSelector: @selector(awakeFromDocument:)])
// {
// [o awakeFromDocument: self];
// }
// }
//
// awaken all elements after the load is completed.
enumerator = [[c nameTable] keyEnumerator];
while ((key = [enumerator nextObject]) != nil)
{
id o = [[c nameTable] objectForKey: key];
if ([o respondsToSelector: @selector(awakeFromDocument:)])
{
[o awakeFromDocument: self];
}
}
// this is the last thing we should do...
[nc postNotificationName: IBDidOpenDocumentNotification
@ -3065,15 +3064,22 @@ static NSImage *classesImage = nil;
enumerator = [nameTable objectEnumerator];
if (flag == YES)
{
[(GormDocument*)[(id<IB>)NSApp activeDocument] setDocumentActive: NO];
GormDocument *document = (GormDocument*)[(id<IB>)NSApp activeDocument];
// set the current document active and unset the old one.
[document setDocumentActive: NO];
isActive = YES;
// display everything.
while ((obj = [enumerator nextObject]) != nil)
{
NSString *name = [document nameForObject: obj];
if ([obj isKindOfClass: [NSWindow class]] == YES)
{
[obj orderFront: self];
}
else if ([obj isKindOfClass: [NSMenu class]] == YES)
else if ([obj isKindOfClass: [NSMenu class]] &&
[name isEqual: @"NSMenu"] == YES)
{
[obj display];
}

View file

@ -420,18 +420,14 @@
tl = frame.origin;
tl.x += frame.size.width;
tl.y += frame.size.height;
[edited sizeToFit];
[[[edited menuRepresentation] window] setFrameTopLeftPoint: tl];
}
// display the main menu only.
/* Don't display. This is the cause for Report #3439
if([edited supermenu] == nil)
{
// [edited display];
}
*/
// if it's the main menu, display it when activated, otherwise don't.
if([[document nameForObject: edited] isEqual: @"NSMenu"])
{
[edited sizeToFit];
[[[edited menuRepresentation] window] setFrameTopLeftPoint: tl];
}
}
return NO;
}
return YES;
@ -637,9 +633,15 @@
void _attachAllSubmenus(id menu, NSArray *items, id document)
{
NSEnumerator *e = [items objectEnumerator];
NSString *name = [document nameForObject: menu];
id i = nil;
[menu display];
// if it's the main menu, display it... otherwise..
if([name isEqual: @"NSMenu"])
{
[menu display];
}
while((i = [e nextObject]) != nil)
{
[document attachObject: i toParent: menu];

View file

@ -134,6 +134,7 @@
return @"GormMenuItemAttributesInspector";
}
/*
- (void)awakeFromDocument: (id <IBDocuments>)doc
{
NSMenu *menu = [self menu];
@ -148,6 +149,7 @@
}
}
}
*/
@end
@interface GormMenuItemAttributesInspector : IBInspector

View file

@ -114,6 +114,24 @@
}
@end
/*
@interface NSMenu (GormAdditions)
- (NSWindow *)_bWindow;
- (void) _setBwindow: (NSWindow *)win;
@end
@implementation NSMenu (GormAdditions)
- (NSWindow *)_bWindow
{
return _bWindow;
}
- (void) _setBwindow: (NSWindow *)win
{
_bWindow = win;
}
@end
*/
@implementation GormNSMenu
- (BOOL) performKeyEquivalent: (NSEvent*)theEvent
{
@ -136,18 +154,28 @@
return win;
}
/*
- (void) awakeFromDocument: (id)document
{
if([self supermenu] == nil)
{
// bring main menu to front.
}
NSWindow *win = [self _bWindow];
[win close];
RELEASE(win);
[self _setBwindow: nil];
}
*/
- (NSString *)className
{
return @"NSMenu";
}
/*
- (void) display
{
NSLog(@"Display...");
[super display];
}
*/
@end
/*