mirror of
https://github.com/gnustep/apps-gorm.git
synced 2025-04-23 06:20:47 +00:00
Adding new interface file and enhancing Gorm.m to validate menu correctly.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/apps/gorm/trunk@15439 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
fe86364bd6
commit
e150b5b43b
9 changed files with 276 additions and 225 deletions
14
ChangeLog
14
ChangeLog
|
@ -1,3 +1,17 @@
|
|||
2003-01-01 Gregory John Casamento <greg_casamento@yahoo.com>
|
||||
|
||||
* Gorm.gorm: Added to replace about 200+ lines of
|
||||
code in the Gorm.m file.
|
||||
* Gorm.m: -[Gorm finishLaunching:] removed code
|
||||
which sets up the menu. It has been superceded by
|
||||
the Gorm.gorm file. -[Gorm init] added code
|
||||
to load the .gorm file. -[Gorm validateMenuItem:]
|
||||
modified to turn certain menu items on/off when
|
||||
appropriate.
|
||||
* GormDocument.[hm]: Added MenuValidation category
|
||||
to allow the app to determine which view is being
|
||||
edited (objects, images, sounds, classes).
|
||||
|
||||
2003-01-01 Gregory John Casamento <greg_casamento@yahoo.com>
|
||||
|
||||
* GormClassManager.m: Made a minor correction to the
|
||||
|
|
|
@ -109,7 +109,8 @@ Gorm_RESOURCE_FILES = \
|
|||
Images/GormOutletSelected.tiff \
|
||||
Resources/GormViewSizeInspector.gorm \
|
||||
Resources/GormCustomClassInspector.gorm \
|
||||
Resources/GormSoundInspector.gorm
|
||||
Resources/GormSoundInspector.gorm \
|
||||
Resources/Gorm.gorm
|
||||
|
||||
Gorm_HEADERS = \
|
||||
Gorm.h \
|
||||
|
|
259
Gorm.m
259
Gorm.m
|
@ -978,229 +978,9 @@ static NSButtonType _buttonTypeForObject( id button )
|
|||
}
|
||||
}
|
||||
|
||||
mainMenu = [[NSMenu alloc] initWithTitle: @"Gorm"];
|
||||
|
||||
/*
|
||||
* Set up info menu.
|
||||
*/
|
||||
aMenu = [NSMenu new];
|
||||
[aMenu addItemWithTitle: @"Info Panel..."
|
||||
action: @selector(infoPanel:)
|
||||
keyEquivalent: @""];
|
||||
[aMenu addItemWithTitle: @"Preferences..."
|
||||
action: NULL
|
||||
keyEquivalent: @""];
|
||||
[aMenu addItemWithTitle: @"Help..."
|
||||
action: NULL
|
||||
keyEquivalent: @"?"];
|
||||
menuItem = [mainMenu addItemWithTitle: @"Info"
|
||||
action: NULL
|
||||
keyEquivalent: @""];
|
||||
[mainMenu setSubmenu: aMenu forItem: menuItem];
|
||||
RELEASE(aMenu);
|
||||
|
||||
/*
|
||||
* Set up document menu.
|
||||
*/
|
||||
aMenu = [NSMenu new];
|
||||
[aMenu addItemWithTitle: @"Open..."
|
||||
action: @selector(open:)
|
||||
keyEquivalent: @"o"];
|
||||
[aMenu addItemWithTitle: @"New Application"
|
||||
action: @selector(newApplication:)
|
||||
keyEquivalent: @"n"];
|
||||
modulesMenu = [NSMenu new];
|
||||
[modulesMenu addItemWithTitle: @"New Empty"
|
||||
action: @selector(newEmpty:)
|
||||
keyEquivalent: @"N"];
|
||||
[modulesMenu addItemWithTitle: @"New Inspector"
|
||||
action: @selector(newInspector:)
|
||||
keyEquivalent: @""];
|
||||
[modulesMenu addItemWithTitle: @"New Palette"
|
||||
action: @selector(newPalette:)
|
||||
keyEquivalent: @""];
|
||||
menuItem = [aMenu addItemWithTitle: @"New Module"
|
||||
action: NULL
|
||||
keyEquivalent: @""];
|
||||
[aMenu setSubmenu: modulesMenu forItem: menuItem];
|
||||
RELEASE(modulesMenu);
|
||||
[aMenu addItemWithTitle: @"Save"
|
||||
action: @selector(save:)
|
||||
keyEquivalent: @"s"];
|
||||
[aMenu addItemWithTitle: @"Save As..."
|
||||
action: @selector(saveAs:)
|
||||
keyEquivalent: @"S"];
|
||||
[aMenu addItemWithTitle: @"Save All"
|
||||
action: @selector(saveAll:)
|
||||
keyEquivalent: @""];
|
||||
[aMenu addItemWithTitle: @"Revert to Saved"
|
||||
action: @selector(revertToSaved:)
|
||||
keyEquivalent: @"u"];
|
||||
[aMenu addItemWithTitle: @"Test Interface"
|
||||
action: @selector(testInterface:)
|
||||
keyEquivalent: @"r"];
|
||||
[aMenu addItemWithTitle: @"Miniaturize"
|
||||
action: @selector(miniaturize:)
|
||||
keyEquivalent: @"m"];
|
||||
[aMenu addItemWithTitle: @"Close"
|
||||
action: @selector(close:)
|
||||
keyEquivalent: @""];
|
||||
[aMenu addItemWithTitle: @"Debug"
|
||||
action: @selector(debug:)
|
||||
keyEquivalent: @""];
|
||||
[aMenu addItemWithTitle: @"Load Sound"
|
||||
action: @selector(loadSound:)
|
||||
keyEquivalent: @""];
|
||||
[aMenu addItemWithTitle: @"Load Image"
|
||||
action: @selector(loadImage:)
|
||||
keyEquivalent: @""];
|
||||
menuItem = [mainMenu addItemWithTitle: @"Document"
|
||||
action: NULL
|
||||
keyEquivalent: @""];
|
||||
[mainMenu setSubmenu: aMenu forItem: menuItem];
|
||||
RELEASE(aMenu);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Set up edit menu.
|
||||
*/
|
||||
aMenu = [NSMenu new];
|
||||
[aMenu addItemWithTitle: @"Cut"
|
||||
action: @selector(cut:)
|
||||
keyEquivalent: @"x"];
|
||||
[aMenu addItemWithTitle: @"Copy"
|
||||
action: @selector(copy:)
|
||||
keyEquivalent: @"c"];
|
||||
[aMenu addItemWithTitle: @"Paste"
|
||||
action: @selector(paste:)
|
||||
keyEquivalent: @"v"];
|
||||
[aMenu addItemWithTitle: @"Delete"
|
||||
action: @selector(delete:)
|
||||
keyEquivalent: @""];
|
||||
[aMenu addItemWithTitle: @"Select All"
|
||||
action: @selector(selectAllItems:)
|
||||
keyEquivalent: @"a"];
|
||||
[aMenu addItemWithTitle: @"Set Name..."
|
||||
action: @selector(setName:)
|
||||
keyEquivalent: @""];
|
||||
[aMenu addItemWithTitle: @"Group in splitview"
|
||||
action: @selector(groupSelectionInSplitView:)
|
||||
keyEquivalent: @""];
|
||||
[aMenu addItemWithTitle: @"Group in box"
|
||||
action: @selector(groupSelectionInBox:)
|
||||
keyEquivalent: @""];
|
||||
[aMenu addItemWithTitle: @"Group in scrollview"
|
||||
action: @selector(groupSelectionInScrollView:)
|
||||
keyEquivalent: @""];
|
||||
[aMenu addItemWithTitle: @"Ungroup"
|
||||
action: @selector(ungroup:)
|
||||
keyEquivalent: @""];
|
||||
[[aMenu addItemWithTitle: @"Font Panel"
|
||||
action: @selector(orderFrontFontPanel:)
|
||||
keyEquivalent: @"t"] setTarget: [NSFontManager sharedFontManager]];
|
||||
menuItem = [mainMenu addItemWithTitle: @"Edit"
|
||||
action: NULL
|
||||
keyEquivalent: @""];
|
||||
[mainMenu setSubmenu: aMenu forItem: menuItem];
|
||||
RELEASE(aMenu);
|
||||
|
||||
|
||||
/*
|
||||
* Set up classes menu.
|
||||
*/
|
||||
aMenu = [NSMenu new];
|
||||
[aMenu addItemWithTitle: @"Create Subclass..."
|
||||
action: @selector(createSubclass:)
|
||||
keyEquivalent: @"C"];
|
||||
[aMenu addItemWithTitle: @"Load Class..."
|
||||
action: @selector(loadClass:)
|
||||
keyEquivalent: @"L"];
|
||||
[aMenu addItemWithTitle: @"Create Class's Files..."
|
||||
action: @selector(createClassFiles:)
|
||||
keyEquivalent: @"B"];
|
||||
[aMenu addItemWithTitle: @"Instantiate"
|
||||
action: @selector(instantiateClass:)
|
||||
keyEquivalent: @"I"];
|
||||
[aMenu addItemWithTitle: @"Add Outlet/Action..."
|
||||
action: @selector(addAttributeToClass:)
|
||||
keyEquivalent: @"A"];
|
||||
[aMenu addItemWithTitle: @"Remove..."
|
||||
action: @selector(remove:)
|
||||
keyEquivalent: @""];
|
||||
menuItem = [mainMenu addItemWithTitle: @"Classes"
|
||||
action: NULL
|
||||
keyEquivalent: @""];
|
||||
[mainMenu setSubmenu: aMenu forItem: menuItem];
|
||||
classMenu = aMenu;
|
||||
RELEASE(aMenu);
|
||||
|
||||
/*
|
||||
* Set up tools menu.
|
||||
*/
|
||||
aMenu = [NSMenu new];
|
||||
[aMenu addItemWithTitle: @"Inspector..."
|
||||
action: @selector(inspector:)
|
||||
keyEquivalent: @"i"];
|
||||
[aMenu addItemWithTitle: @"Palettes..."
|
||||
action: @selector(palettes:)
|
||||
keyEquivalent: @"p"];
|
||||
[aMenu addItemWithTitle: @"Load Palette..."
|
||||
action: @selector(loadPalette:)
|
||||
keyEquivalent: @""];
|
||||
menuItem = [mainMenu addItemWithTitle: @"Tools"
|
||||
action: NULL
|
||||
keyEquivalent: @""];
|
||||
[mainMenu setSubmenu: aMenu forItem: menuItem];
|
||||
RELEASE(aMenu);
|
||||
|
||||
|
||||
/*
|
||||
* Set up Windows menu
|
||||
*/
|
||||
windowsMenu = [NSMenu new];
|
||||
[windowsMenu addItemWithTitle: @"Arrange"
|
||||
action: @selector(arrangeInFront:)
|
||||
keyEquivalent: @""];
|
||||
[windowsMenu addItemWithTitle: @"Miniaturize"
|
||||
action: @selector(performMiniaturize:)
|
||||
keyEquivalent: @"m"];
|
||||
[windowsMenu addItemWithTitle: @"Close"
|
||||
action: @selector(performClose:)
|
||||
keyEquivalent: @"w"];
|
||||
menuItem = [mainMenu addItemWithTitle: @"Windows"
|
||||
action: NULL
|
||||
keyEquivalent: @""];
|
||||
[mainMenu setSubmenu: windowsMenu forItem: menuItem];
|
||||
RELEASE(windowsMenu);
|
||||
|
||||
/*
|
||||
* Set up Services menu
|
||||
*/
|
||||
aMenu = [NSMenu new];
|
||||
menuItem = [mainMenu addItemWithTitle: @"Services"
|
||||
action: NULL
|
||||
keyEquivalent: @""];
|
||||
[mainMenu setSubmenu: aMenu forItem: menuItem];
|
||||
RELEASE(aMenu);
|
||||
|
||||
[mainMenu addItemWithTitle: @"Hide"
|
||||
action: @selector(hide:)
|
||||
keyEquivalent: @"h"];
|
||||
|
||||
[mainMenu addItemWithTitle: @"Quit"
|
||||
action: @selector(terminate:)
|
||||
keyEquivalent: @"q"];
|
||||
|
||||
|
||||
[self setMainMenu: mainMenu];
|
||||
[self setWindowsMenu: windowsMenu];
|
||||
// [mainMenu display];
|
||||
[self setDelegate: self];
|
||||
[super finishLaunching];
|
||||
NSLog(@"StartupTime %f", [startDate timeIntervalSinceNow]);
|
||||
NSLog(@"StartupTime %f", [startDate timeIntervalSinceNow]);
|
||||
}
|
||||
|
||||
- (void) handleNotification: (NSNotification*)notification
|
||||
|
@ -1286,6 +1066,13 @@ NSLog(@"StartupTime %f", [startDate timeIntervalSinceNow]);
|
|||
* inspectors provided in the standard palettes are available.
|
||||
*/
|
||||
[self palettesManager];
|
||||
|
||||
// load the interface...
|
||||
if(![NSBundle loadNibNamed: @"Gorm" owner: self])
|
||||
{
|
||||
NSLog(@"Failed to load interface");
|
||||
exit(-1);
|
||||
}
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
@ -1742,6 +1529,36 @@ NSLog(@"StartupTime %f", [startDate timeIntervalSinceNow]);
|
|||
}
|
||||
}
|
||||
|
||||
if(sel_eq(action, @selector(createSubclass:)) ||
|
||||
sel_eq(action, @selector(loadClass:)) ||
|
||||
sel_eq(action, @selector(createClassFiles:)) ||
|
||||
sel_eq(action, @selector(instantiateClass:)) ||
|
||||
sel_eq(action, @selector(addAttributeToClass:)) ||
|
||||
sel_eq(action, @selector(remove:)))
|
||||
{
|
||||
id document = [(Gorm *)NSApp activeDocument];
|
||||
if(document == nil)
|
||||
{
|
||||
return NO;
|
||||
}
|
||||
|
||||
if(![document isEditingClasses])
|
||||
{
|
||||
return NO;
|
||||
}
|
||||
}
|
||||
|
||||
if(sel_eq(action, @selector(loadSound:)) ||
|
||||
sel_eq(action, @selector(loadImage:)) ||
|
||||
sel_eq(action, @selector(debug:)))
|
||||
{
|
||||
id document = [(Gorm *)NSApp activeDocument];
|
||||
if(document == nil)
|
||||
{
|
||||
return NO;
|
||||
}
|
||||
}
|
||||
|
||||
return YES;
|
||||
}
|
||||
|
||||
|
|
|
@ -122,4 +122,11 @@
|
|||
toName: (NSString *)newName;
|
||||
@end
|
||||
|
||||
@interface GormDocument (MenuValidation)
|
||||
- (BOOL) isEditingObjects;
|
||||
- (BOOL) isEditingImages;
|
||||
- (BOOL) isEditingSounds;
|
||||
- (BOOL) isEditingClasses;
|
||||
@end
|
||||
|
||||
#endif
|
||||
|
|
|
@ -3291,3 +3291,25 @@ shouldEditTableColumn: (NSTableColumn *)tableColumn
|
|||
[images addObject: path];
|
||||
}
|
||||
@end
|
||||
|
||||
@implementation GormDocument (MenuValidation)
|
||||
- (BOOL) isEditingObjects
|
||||
{
|
||||
return ([selectionBox contentView] == scrollView);
|
||||
}
|
||||
|
||||
- (BOOL) isEditingImages
|
||||
{
|
||||
return ([selectionBox contentView] == imagesScrollView);
|
||||
}
|
||||
|
||||
- (BOOL) isEditingSounds
|
||||
{
|
||||
return ([selectionBox contentView] == soundsScrollView);
|
||||
}
|
||||
|
||||
- (BOOL) isEditingClasses
|
||||
{
|
||||
return ([selectionBox contentView] == classesScrollView);
|
||||
}
|
||||
@end
|
||||
|
|
|
@ -253,13 +253,13 @@
|
|||
|
||||
- (BOOL) acceptsFirstMouse: (NSEvent*)theEvent
|
||||
{
|
||||
NSLog(@"********* TELL pyr *********** acceptsFirstMouse");
|
||||
NSDebugLog(@"********* TELL pyr *********** acceptsFirstMouse");
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (BOOL) acceptsFirstResponder
|
||||
{
|
||||
NSLog(@"********* TELL pyr *********** acceptsFirstResponder");
|
||||
NSDebugLog(@"********* TELL pyr *********** acceptsFirstResponder");
|
||||
return YES;
|
||||
}
|
||||
|
||||
|
|
|
@ -852,7 +852,7 @@ NSLog(@"Link at index: %d (%@)", pos, NSStringFromPoint(loc));
|
|||
NSMenuItem *item;
|
||||
|
||||
[selection removeAllObjects];
|
||||
NSLog(@"selectObjects %@ %@", selection, anArray);
|
||||
NSDebugLog(@"selectObjects %@ %@", selection, anArray);
|
||||
[selection addObjectsFromArray: anArray];
|
||||
|
||||
count = [selection count];
|
||||
|
|
190
Resources/Gorm.gorm/data.classes
Normal file
190
Resources/Gorm.gorm/data.classes
Normal file
|
@ -0,0 +1,190 @@
|
|||
{
|
||||
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:",
|
||||
"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;
|
||||
};
|
||||
Gorm = {
|
||||
Actions = (
|
||||
"editClass:",
|
||||
"instantiateSubclass:",
|
||||
"createSubclass:",
|
||||
"testInterface:",
|
||||
"setName:",
|
||||
"selectAllItems:",
|
||||
"saveAs:",
|
||||
"saveAll:",
|
||||
"save:",
|
||||
"revertToSaved:",
|
||||
"paste:",
|
||||
"palettes:",
|
||||
"open:",
|
||||
"loadSound:",
|
||||
"loadPalette:",
|
||||
"newApplication:",
|
||||
"inspector:",
|
||||
"infoPanel:",
|
||||
"endTesting:",
|
||||
"delete:",
|
||||
"cut:",
|
||||
"copy:",
|
||||
"newPalette:",
|
||||
"newInspector:",
|
||||
"newEmpty:",
|
||||
"close:",
|
||||
"miniaturize:",
|
||||
"debug:",
|
||||
"loadImage:",
|
||||
"orderFrontFontPanel:",
|
||||
"ungroup:",
|
||||
"groupSelectionInScrollView:",
|
||||
"groupSelectionInBox:",
|
||||
"groupSelectionInSplitView:",
|
||||
"remove:",
|
||||
"addAttributeToClass:",
|
||||
"instantiateClass:",
|
||||
"createClassFiles:",
|
||||
"loadClass:"
|
||||
);
|
||||
Outlets = (
|
||||
);
|
||||
Super = NSApplication;
|
||||
};
|
||||
}
|
BIN
Resources/Gorm.gorm/objects.gorm
Normal file
BIN
Resources/Gorm.gorm/objects.gorm
Normal file
Binary file not shown.
Loading…
Reference in a new issue