New .gorm based inspectors for menus and menu items. Also some general code cleanup.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/apps/gorm/trunk@17737 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Gregory John Casamento 2003-09-28 01:58:57 +00:00
parent 6d36250f7e
commit 15253a9462
9 changed files with 361 additions and 134 deletions

View file

@ -1,3 +1,20 @@
2003-09-27 21:58 Gregory John Casamento <greg_casamento@yahoo.com>
* Palettes/0Menus/GNUmakefile: Add .gorm files for new inspectors
* Palettes/0Menus/GormMenuEditor.m: Re-added assertion to ensure
consistency. Code cleanup: Got rid of some commented out code and
some code which was for logging purposes only.
* Palettes/0Menus/GormNSMenu.m: Removed some old code which was for
debugging.
* Palettes/0Menus/GormMenuInspectors.m: Removed hardcoded GUI and
replaced it with the loading of the appropriate .gorm files for each
inspector.
* Palettes/0Menus/GormMenuAttributesInspector.gorm: New gui for menu
inspector. Also added the beginnings of the mechanizm by which the
services/windows menus will be specified.
* Palettes/0Menus/GormMenuItemAttributesInspector.gorm: New gui for
menu item inspector.
2003-09-08 Gregory John Casamento <greg_casamento@yahoo.com>
* GormClassManager.m: [nonCustomSuperClassOf:] if the class

View file

@ -30,8 +30,11 @@ PALETTE_NAME = 0Menus
GormMenuInspectors.m \
GormNSMenu.m \
main.m
0Menus_PRINCIPAL_CLASS = MenusPalette
0Menus_RESOURCE_FILES = MenusPalette.tiff
0Menus_RESOURCE_FILES = MenusPalette.tiff \
GormMenuAttributesInspector.gorm \
GormMenuItemAttributesInspector.gorm
0Menus_STANDARD_INSTALL = no

View file

@ -0,0 +1,156 @@
{
FirstResponder = {
Actions = (
"activateContextHelpMode:",
"alignCenter:",
"alignJustified:",
"alignLeft:",
"alignRight:",
"arrangeInFront:",
"cancel:",
"capitalizeWord:",
"changeColor:",
"changeFont:",
"checkSpelling:",
"close:",
"complete:",
"copy:",
"copyFont:",
"copyRuler:",
"cut:",
"delete:",
"deleteBackward:",
"deleteForward:",
"deleteToBeginningOfLine:",
"deleteToBeginningOfParagraph:",
"deleteToEndOfLine:",
"deleteToEndOfParagraph:",
"deleteToMark:",
"deleteWordBackward:",
"deleteWordForward:",
"deminiaturize:",
"deselectAll:",
"fax:",
"hide:",
"hideOtherApplications:",
"indent:",
"loosenKerning:",
"lowerBaseline:",
"lowercaseWord:",
"makeKeyAndOrderFront:",
"miniaturize:",
"miniaturizeAll:",
"moveBackward:",
"moveBackwardAndModifySelection:",
"moveDown:",
"moveDownAndModifySelection:",
"moveForward:",
"moveForwardAndModifySelection:",
"moveLeft:",
"moveRight:",
"moveToBeginningOfDocument:",
"moveToBeginningOfLine:",
"moveToBeginningOfParagraph:",
"moveToEndOfDocument:",
"moveToEndOfLine:",
"moveToEndOfParagraph:",
"moveUp:",
"moveUpAndModifySelection:",
"moveWordBackward:",
"moveWordBackwardAndModifySelection:",
"moveWordForward:",
"moveWordForwardAndModifySelection:",
"newDocument:",
"ok:",
"openDocument:",
"orderBack:",
"orderFront:",
"orderFrontColorPanel:",
"orderFrontDataLinkPanel:",
"orderFrontFontPanel:",
"orderFrontHelpPanel:",
"orderFrontStandardAboutPanel:",
"orderFrontStandardInfoPanel:",
"orderOut:",
"pageDown:",
"pageUp:",
"paste:",
"pasteAsPlainText:",
"pasteAsRichText:",
"pasteFont:",
"pasteRuler:",
"performClose:",
"performMiniaturize:",
"performZoom:",
"print:",
"raiseBaseline:",
"revertDocumentToSaved:",
"runPageLayout:",
"runToolbarCustomizationPalette:",
"saveAllDocuments:",
"saveDocument:",
"saveDocumentAs:",
"saveDocumentTo:",
"scrollLineDown:",
"scrollLineUp:",
"scrollPageDown:",
"scrollPageUp:",
"scrollViaScroller:",
"selectAll:",
"selectLine:",
"selectNextKeyView:",
"selectParagraph:",
"selectPreviousKeyView:",
"selectText:",
"selectText:",
"selectToMark:",
"selectWord:",
"showContextHelp:",
"showGuessPanel:",
"showHelp:",
"showWindow:",
"stop:",
"subscript:",
"superscript:",
"swapWithMark:",
"takeDoubleValueFrom:",
"takeFloatValueFrom:",
"takeIntValueFrom:",
"takeObjectValueFrom:",
"takeStringValueFrom:",
"terminate:",
"tightenKerning:",
"toggle:",
"toggleContinuousSpellChecking:",
"toggleRuler:",
"toggleToolbarShown:",
"toggleTraditionalCharacterShape:",
"transpose:",
"transposeWords:",
"turnOffKerning:",
"turnOffLigatures:",
"underline:",
"unhide:",
"unhideAllApplications:",
"unscript:",
"uppercaseWord:",
"useAllLigatures:",
"useStandardKerning:",
"useStandardLigatures:",
"yank:",
"zoom:",
"setObject:"
);
Super = NSObject;
};
GormMenuAttributesInspector = {
Actions = (
"setObject:"
);
Outlets = (
titleText,
menuType
);
Super = IBInspector;
};
}

View file

@ -183,8 +183,6 @@
[tf setEditable: YES];
[tf setBezeled: NO];
[tf setBordered: NO];
// [tf setAlignment: [_EO alignment]];
// [tf setFont: [_EO font]];
[self addSubview: tf];
[tf setStringValue: [[cell menuItem] title]];
[self editTextField: tf
@ -385,7 +383,7 @@
- (BOOL) activate
{
// NSAssert(isClosed == NO, NSInternalInconsistencyException);
NSAssert(isClosed == NO, NSInternalInconsistencyException);
if (original == nil)
{
NSWindow *w;
@ -393,10 +391,10 @@
NSView *sub;
NSMenuItem *item;
/*
* Swap ourselves in as a replacement for the original window
* content view.
*/
//
// Swap ourselves in as a replacement for the original window
// content view.
//
w = [rep window];
original = RETAIN([w contentView]);
[self setFrame: [original frame]];
@ -405,11 +403,12 @@
{
[self addSubview: sub];
}
[w setContentView: self];
/*
* Line up submenu with parent menu.
*/
//
// Line up submenu with parent menu.
//
item = [document parentOfObject: edited];
if (item != nil)
{
@ -772,14 +771,6 @@
enumerator = [items objectEnumerator];
while ((item = [enumerator nextObject]) != nil)
{
// NSString *title = [item title];
// if ([edited indexOfItemWithTitle: title] > 0)
// {
// [document detachObject: item]; /* Already exists */
// }
// else
// {
if ([edited _ownedByPopUp])
{
NSLog(@"owned by popup");
@ -789,7 +780,6 @@
else
NSLog(@"not owned by popup");
[edited insertItem: item atIndex: pos++];
// }
}
[edited sizeToFit];
[edited display];

View file

@ -28,6 +28,7 @@
@interface GormMenuAttributesInspector : IBInspector
{
NSTextField *titleText;
NSMatrix *menuType;
}
@end
@ -40,38 +41,13 @@
- (id) init
{
self = [super init];
if (self != nil)
if ([super init] == nil)
return nil;
if ([NSBundle loadNibNamed: @"GormMenuAttributesInspector" owner: self] == NO)
{
NSView *contents;
NSTextField *title;
RELEASE(window);
window = [[NSWindow alloc] initWithContentRect: NSMakeRect(0, 0, IVW, IVH)
styleMask: NSBorderlessWindowMask
backing: NSBackingStoreRetained
defer: NO];
contents = [window contentView];
title
= [[NSTextField alloc] initWithFrame: NSMakeRect(10,IVH-30,70,20)];
[title setEditable: NO];
[title setSelectable: NO];
[title setBezeled: NO];
[title setAlignment: NSLeftTextAlignment];
[title setFont: [NSFont systemFontOfSize: 14.0]];
[title setDrawsBackground: NO];
[title setStringValue: @"Title:"];
[contents addSubview: title];
RELEASE(title);
titleText
= [[NSTextField alloc] initWithFrame: NSMakeRect(60,IVH-30,IVW-80,20)];
[titleText setDelegate: self];
[contents addSubview: titleText];
RELEASE(titleText);
NSLog(@"Could not gorm GormMenuAttributesInspector");
return nil;
}
return self;
}
@ -126,60 +102,13 @@
- (id) init
{
self = [super init];
if (self != nil)
if ([super init] == nil)
return nil;
if ([NSBundle loadNibNamed: @"GormMenuItemAttributesInspector" owner: self] == NO)
{
NSView *contents;
NSTextField *title;
RELEASE(window);
window = [[NSWindow alloc] initWithContentRect: NSMakeRect(0, 0, IVW, IVH)
styleMask: NSBorderlessWindowMask
backing: NSBackingStoreRetained
defer: NO];
contents = [window contentView];
title
= [[NSTextField alloc] initWithFrame: NSMakeRect(10,IVH-30,50,20)];
[title setEditable: NO];
[title setSelectable: NO];
[title setBezeled: NO];
[title setAlignment: NSLeftTextAlignment];
[title setFont: [NSFont systemFontOfSize: 14.0]];
[title setDrawsBackground: NO];
[title setStringValue: @"Title:"];
[contents addSubview: title];
RELEASE(title);
titleText
= [[NSTextField alloc] initWithFrame: NSMakeRect(60,IVH-30,IVW-80,20)];
[titleText setDelegate: self];
[contents addSubview: titleText];
RELEASE(titleText);
title
= [[NSTextField alloc] initWithFrame: NSMakeRect(10,IVH-60,70,20)];
[title setEditable: NO];
[title setSelectable: NO];
[title setBezeled: NO];
[title setAlignment: NSLeftTextAlignment];
[title setFont: [NSFont systemFontOfSize: 14.0]];
[title setDrawsBackground: NO];
[title setStringValue: @"Shortcut:"];
[contents addSubview: title];
RELEASE(title);
shortCut
= [[NSTextField alloc] initWithFrame: NSMakeRect(80,IVH-60,20,20)];
[shortCut setDelegate: self];
[contents addSubview: shortCut];
RELEASE(shortCut);
tagText
= [[NSTextField alloc] initWithFrame: NSMakeRect(60,IVH-90,IVW-80,20)];
[tagText setDelegate: self];
[contents addSubview: tagText];
RELEASE(tagText);
NSLog(@"Could not gorm GormMenuItemAttributesInspector");
return nil;
}
return self;
}
@ -190,7 +119,6 @@
[titleText setStringValue: [object title]];
[shortCut setStringValue: [object keyEquivalent]];
[tagText setIntValue: [object tag]];
}
@end

View file

@ -0,0 +1,155 @@
{
FirstResponder = {
Actions = (
"activateContextHelpMode:",
"alignCenter:",
"alignJustified:",
"alignLeft:",
"alignRight:",
"arrangeInFront:",
"cancel:",
"capitalizeWord:",
"changeColor:",
"changeFont:",
"checkSpelling:",
"close:",
"complete:",
"copy:",
"copyFont:",
"copyRuler:",
"cut:",
"delete:",
"deleteBackward:",
"deleteForward:",
"deleteToBeginningOfLine:",
"deleteToBeginningOfParagraph:",
"deleteToEndOfLine:",
"deleteToEndOfParagraph:",
"deleteToMark:",
"deleteWordBackward:",
"deleteWordForward:",
"deminiaturize:",
"deselectAll:",
"fax:",
"hide:",
"hideOtherApplications:",
"indent:",
"loosenKerning:",
"lowerBaseline:",
"lowercaseWord:",
"makeKeyAndOrderFront:",
"miniaturize:",
"miniaturizeAll:",
"moveBackward:",
"moveBackwardAndModifySelection:",
"moveDown:",
"moveDownAndModifySelection:",
"moveForward:",
"moveForwardAndModifySelection:",
"moveLeft:",
"moveRight:",
"moveToBeginningOfDocument:",
"moveToBeginningOfLine:",
"moveToBeginningOfParagraph:",
"moveToEndOfDocument:",
"moveToEndOfLine:",
"moveToEndOfParagraph:",
"moveUp:",
"moveUpAndModifySelection:",
"moveWordBackward:",
"moveWordBackwardAndModifySelection:",
"moveWordForward:",
"moveWordForwardAndModifySelection:",
"newDocument:",
"ok:",
"openDocument:",
"orderBack:",
"orderFront:",
"orderFrontColorPanel:",
"orderFrontDataLinkPanel:",
"orderFrontFontPanel:",
"orderFrontHelpPanel:",
"orderFrontStandardAboutPanel:",
"orderFrontStandardInfoPanel:",
"orderOut:",
"pageDown:",
"pageUp:",
"paste:",
"pasteAsPlainText:",
"pasteAsRichText:",
"pasteFont:",
"pasteRuler:",
"performClose:",
"performMiniaturize:",
"performZoom:",
"print:",
"raiseBaseline:",
"revertDocumentToSaved:",
"runPageLayout:",
"runToolbarCustomizationPalette:",
"saveAllDocuments:",
"saveDocument:",
"saveDocumentAs:",
"saveDocumentTo:",
"scrollLineDown:",
"scrollLineUp:",
"scrollPageDown:",
"scrollPageUp:",
"scrollViaScroller:",
"selectAll:",
"selectLine:",
"selectNextKeyView:",
"selectParagraph:",
"selectPreviousKeyView:",
"selectText:",
"selectText:",
"selectToMark:",
"selectWord:",
"showContextHelp:",
"showGuessPanel:",
"showHelp:",
"showWindow:",
"stop:",
"subscript:",
"superscript:",
"swapWithMark:",
"takeDoubleValueFrom:",
"takeFloatValueFrom:",
"takeIntValueFrom:",
"takeObjectValueFrom:",
"takeStringValueFrom:",
"terminate:",
"tightenKerning:",
"toggle:",
"toggleContinuousSpellChecking:",
"toggleRuler:",
"toggleToolbarShown:",
"toggleTraditionalCharacterShape:",
"transpose:",
"transposeWords:",
"turnOffKerning:",
"turnOffLigatures:",
"underline:",
"unhide:",
"unhideAllApplications:",
"unscript:",
"uppercaseWord:",
"useAllLigatures:",
"useStandardKerning:",
"useStandardLigatures:",
"yank:",
"zoom:"
);
Super = NSObject;
};
GormMenuItemAttributesInspector = {
Actions = (
);
Outlets = (
tagText,
shortCut,
titleText
);
Super = IBInspector;
};
}

View file

@ -49,18 +49,6 @@
@end
@implementation GormNSMenuWindow
- initWithCoder: (NSCoder *)coder
{
NSLog(@"initWithCoder");
return [super initWithCoder: coder];
}
- (void) encodeWithCoder: (NSCoder *)coder
{
NSLog(@"encode");
[super encodeWithCoder: coder];
}
- (BOOL)canBecomeMainWindow
{
return YES;
@ -90,10 +78,10 @@
target: [self _menu]
argument: nil
order: 500000
modes: [NSArray arrayWithObjects:
NSDefaultRunLoopMode,
modes: [NSArray arrayWithObjects: NSDefaultRunLoopMode,
NSModalPanelRunLoopMode,
NSEventTrackingRunLoopMode, nil]];
NSEventTrackingRunLoopMode,
nil]];
}
}
@ -102,7 +90,7 @@
[super becomeMainWindow];
if ([[self _menu] _ownedByPopUp] )
{
// do nothing...
}
}
@ -113,10 +101,6 @@
type = [theEvent type];
if (type == NSLeftMouseDown)
{
if (_f.is_main == YES)
{
NSLog(@"already main %@", [NSApp mainWindow]);
}
[self makeMainWindow];
[self makeKeyWindow];
}
@ -126,29 +110,23 @@
@end
@implementation GormNSMenu
- (BOOL) performKeyEquivalent: (NSEvent*)theEvent
{
return NO;
}
- (NSPanel*) _createWindow
{
NSPanel *win = [[GormNSMenuWindow alloc]
initWithContentRect: NSZeroRect
styleMask: /*NSTitledWindowMask/*/NSBorderlessWindowMask
styleMask: NSBorderlessWindowMask
backing: NSBackingStoreBuffered
defer: YES];
[win setMenu: self];
// [win setLevel: NSSubmenuWindowLevel];
// [win setWorksWhenModal: YES];
// [win setBecomesKeyOnlyIfNeeded: YES];
[win setLevel: NSSubmenuWindowLevel];
return win;
}
@end
@implementation NSMenu (GormNSMenu)