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. :) * GormDocument.m: Modified _repairFile so that it works. :)
* Gorm.gorm: Removed some extraneous menu items/submenus. * Gorm.gorm: Removed some extraneous menu items/submenus.

2
Gorm.m
View file

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

View file

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

View file

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

View file

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

View file

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