Corrected Report #5205. Menus for Windows/Services should now be designated by Gorm and correctly shown when the .gorm file loads.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/apps/gorm/trunk@17742 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Gregory John Casamento 2003-09-28 23:31:35 +00:00
parent 15253a9462
commit daba72b9b9
8 changed files with 133 additions and 9 deletions

View file

@ -1,3 +1,16 @@
2003-09-28 19:32 Gregory John Casamento <greg_casamento@yahoo.com>
* GormDocument.h: Removed some ivars which were not being used.
Added declarations for methods setWindowsMenu, setServicesMenu,
servicesMenu, windowsMenu.
* GormDocument.m: Added implementation of above methods.
* Palettes/0Menus/GormMenuInspectors.m: Added implementation of method
updateMenuType which sets the menu appropriately so that when
the file is unarchived the proper menu setting is reflected.
* Palettes/0Menus/GormMenuAttributesInspector.m: Added connection
for method updateMenuType.
* Resources/Gorm.gorm: Designated services and windows menus for Gorm.
2003-09-27 21:58 Gregory John Casamento <greg_casamento@yahoo.com>
* Palettes/0Menus/GNUmakefile: Add .gorm files for new inspectors

View file

@ -79,10 +79,6 @@
NSMutableSet *sounds;
NSMutableSet *images;
// NSFileWrapper *wrapper;
// working copies of objects in the container...
NSMutableArray *workingConnections;
NSMutableDictionary *workingNameTable;
}
- (void) addConnector: (id<IBConnectors>)aConnector;
- (NSArray*) allConnectors;
@ -163,6 +159,11 @@
// class loading
- (id) loadClass: (id)sender;
// services/windows menus...
- (void) setServicesMenu: (NSMenu *)menu;
- (NSMenu *) servicesMenu;
- (void) setWindowsMenu: (NSMenu *)menu;
- (NSMenu *) windowsMenu;
@end
@interface GormDocument (MenuValidation)

View file

@ -659,7 +659,6 @@ static NSImage *classesImage = nil;
RELEASE(savedEditors);
RELEASE(scrollView);
RELEASE(classesScrollView);
// RELEASE(workingNameTable);
[super dealloc];
}
@ -2520,10 +2519,44 @@ static NSImage *classesImage = nil;
- (BOOL) objectIsDeferred: (id)anObject
{
// NSLog(@"%@, %@", nameTable, anObject);
return [[nameTable objectForKey: @"NSDeferred"] containsObject: anObject];
}
// windows / services menus...
- (void) setWindowsMenu: (NSMenu *)anObject
{
if(anObject != nil)
{
[nameTable setObject: anObject forKey: @"NSWindowsMenu"];
}
else
{
[nameTable removeObjectForKey: @"NSWindowsMenu"];
}
}
- (NSMenu *) windowsMenu
{
return [nameTable objectForKey: @"NSWindowsMenu"];
}
- (void) setServicesMenu: (NSMenu *)anObject
{
if(anObject != nil)
{
[nameTable setObject: anObject forKey: @"NSServicesMenu"];
}
else
{
[nameTable removeObjectForKey: @"NSServicesMenu"];
}
}
- (NSMenu *) servicesMenu
{
return [nameTable objectForKey: @"NSServicesMenu"];
}
/*
* To revert to a saved version, we actually load a new document and
* close the original document, returning the id of the new document.

View file

@ -139,13 +139,15 @@
"useStandardLigatures:",
"yank:",
"zoom:",
"setObject:"
"setObject:",
"updateMenuType:"
);
Super = NSObject;
};
GormMenuAttributesInspector = {
Actions = (
"setObject:"
"setObject:",
"updateMenuType:"
);
Outlets = (
titleText,

View file

@ -24,12 +24,15 @@
#include <AppKit/AppKit.h>
#include <InterfaceBuilder/InterfaceBuilder.h>
#include "GormPrivate.h"
#include "GormDocument.h"
@interface GormMenuAttributesInspector : IBInspector
{
NSTextField *titleText;
NSMatrix *menuType;
}
- (void) updateMenuType: (id)sender;
@end
@implementation GormMenuAttributesInspector
@ -54,10 +57,59 @@
- (void) setObject: (id)anObject
{
BOOL flag = NO;
GormDocument *doc = (GormDocument *)[(id<IB>)NSApp activeDocument];
[super setObject: anObject];
[titleText setStringValue: [object title]];
// set up the menu type matrix...
if([doc windowsMenu] == anObject)
{
[menuType selectCellAtRow: 0 column: 0];
}
else if([doc servicesMenu] == anObject)
{
[menuType selectCellAtRow: 1 column: 0];
}
else // normal menu without any special function
{
[menuType selectCellAtRow: 2 column: 0];
}
}
- (void) updateMenuType: (id)sender
{
BOOL flag;
GormDocument *doc = (GormDocument *)[(id<IB>)NSApp activeDocument];
// look at the values passed back in the matrix.
flag = ([[menuType cellAtRow: 0 column: 0] state] == NSOnState) ? YES : NO; // windows menu...
if(flag)
{
[doc setWindowsMenu: [self object]];
if([doc servicesMenu] == [self object])
{
[doc setServicesObject: nil];
}
}
flag = ([[menuType cellAtRow: 1 column: 0] state] == NSOnState) ? YES : NO; // services menu...
if(flag)
{
[doc setServicesMenu: [self object]];
if([doc windowsMenu] == [self object])
{
[doc setWindowsObject: nil];
}
}
flag = ([[menuType cellAtRow: 2 column: 0] state] == NSOnState) ? YES : NO; // normal menu...
if(flag)
{
[doc setWindowsMenu: nil];
[doc setServicesMenu: nil];
}
}
@end
@ -122,4 +174,3 @@
}
@end

View file

@ -155,6 +155,30 @@ NSwindow inspector
}
@end
// the normal classes...
@implementation NSWindow (IBInspectorClassNames)
- (NSString*) inspectorClassName
{
return @"GormWindowAttributesInspector";
}
- (NSString*) sizeInspectorClassName
{
return @"GormWindowSizeInspector";
}
@end
@implementation NSPanel (IBInspectorClassNames)
- (NSString*) inspectorClassName
{
return @"GormWindowAttributesInspector";
}
- (NSString*) sizeInspectorClassName
{
return @"GormWindowSizeInspector";
}
@end
// special subclasses...
@implementation GormNSWindow (IBInspectorClassNames)
- (NSString*) inspectorClassName
{

Binary file not shown.