mirror of
https://github.com/gnustep/apps-gorm.git
synced 2025-02-23 11:41:05 +00:00
Move menu actions into GormAppDelegate
This commit is contained in:
parent
91ec1c08c1
commit
608ecef8e4
5 changed files with 290 additions and 272 deletions
|
@ -35,4 +35,47 @@
|
|||
@class NSSet;
|
||||
|
||||
@interface GormAppDelegate : GormAbstractDelegate
|
||||
|
||||
// preferences
|
||||
- (IBAction) preferencesPanel: (id) sender;
|
||||
|
||||
// Cut/Paste operations
|
||||
- (IBAction) copy: (id)sender;
|
||||
- (IBAction) cut: (id)sender;
|
||||
- (IBAction) paste: (id)sender;
|
||||
- (IBAction) delete: (id)sender;
|
||||
- (IBAction) selectAllItems: (id)sender;
|
||||
- (IBAction) setName: (id)sender;
|
||||
|
||||
// palettes/inspectors.
|
||||
- (IBAction) inspector: (id) sender;
|
||||
- (IBAction) palettes: (id) sender;
|
||||
- (IBAction) loadPalette: (id) sender;
|
||||
|
||||
// sound & images
|
||||
- (IBAction) loadSound: (id) sender;
|
||||
- (IBAction) loadImage: (id) sender;
|
||||
|
||||
// grouping/layout
|
||||
- (IBAction) groupSelectionInSplitView: (id)sender;
|
||||
- (IBAction) groupSelectionInBox: (id)sender;
|
||||
- (IBAction) groupSelectionInScrollView: (id)sender;
|
||||
- (IBAction) ungroup: (id)sender;
|
||||
|
||||
// Classes actions
|
||||
- (IBAction) createSubclass: (id)sender;
|
||||
- (IBAction) loadClass: (id)sender;
|
||||
- (IBAction) createClassFiles: (id)sender;
|
||||
- (IBAction) instantiateClass: (id)sender;
|
||||
- (IBAction) addAttributeToClass: (id)sender;
|
||||
- (IBAction) remove: (id)sender;
|
||||
|
||||
// Palettes Actions...
|
||||
- (IBAction) inspector: (id) sender;
|
||||
- (IBAction) palettes: (id) sender;
|
||||
- (IBAction) loadPalette: (id) sender;
|
||||
|
||||
// Print
|
||||
- (IBAction) print: (id)sender;
|
||||
|
||||
@end
|
||||
|
|
|
@ -318,4 +318,246 @@
|
|||
return YES;
|
||||
}
|
||||
|
||||
|
||||
- (IBAction) stop: (id)sender
|
||||
{
|
||||
if(isTesting == NO)
|
||||
{
|
||||
// [super stop: sender];
|
||||
}
|
||||
else
|
||||
{
|
||||
[self endTesting: sender];
|
||||
}
|
||||
}
|
||||
|
||||
- (IBAction) miniaturize: (id)sender
|
||||
{
|
||||
NSWindow *window = [(GormDocument *)[self activeDocument] window];
|
||||
|
||||
[window miniaturize: self];
|
||||
}
|
||||
|
||||
/** Info Menu Actions */
|
||||
- (IBAction) preferencesPanel: (id) sender
|
||||
{
|
||||
if(! preferencesController)
|
||||
{
|
||||
preferencesController = [[GormPrefController alloc] init];
|
||||
}
|
||||
|
||||
[[preferencesController panel] makeKeyAndOrderFront:nil];
|
||||
}
|
||||
|
||||
/** Document Menu Actions */
|
||||
- (IBAction) close: (id)sender
|
||||
{
|
||||
GormDocument *document = (GormDocument *)[self activeDocument];
|
||||
if([document canCloseDocument])
|
||||
{
|
||||
[document close];
|
||||
}
|
||||
}
|
||||
|
||||
- (IBAction) debug: (id) sender
|
||||
{
|
||||
[[self activeDocument] performSelector: @selector(printAllEditors)];
|
||||
}
|
||||
|
||||
- (IBAction) loadSound: (id) sender
|
||||
{
|
||||
[(GormDocument *)[self activeDocument] openSound: sender];
|
||||
}
|
||||
|
||||
- (IBAction) loadImage: (id) sender
|
||||
{
|
||||
[(GormDocument *)[self activeDocument] openImage: sender];
|
||||
}
|
||||
|
||||
|
||||
/** Edit Menu Actions */
|
||||
|
||||
- (IBAction) copy: (id)sender
|
||||
{
|
||||
if ([[selectionOwner selection] count] == 0
|
||||
|| [selectionOwner respondsToSelector: @selector(copySelection)] == NO)
|
||||
return;
|
||||
|
||||
if([self isConnecting])
|
||||
{
|
||||
[self stopConnecting];
|
||||
}
|
||||
|
||||
[(id<IBSelectionOwners,IBEditors>)selectionOwner copySelection];
|
||||
}
|
||||
|
||||
|
||||
- (IBAction) cut: (id)sender
|
||||
{
|
||||
if ([[selectionOwner selection] count] == 0
|
||||
|| [selectionOwner respondsToSelector: @selector(copySelection)] == NO
|
||||
|| [selectionOwner respondsToSelector: @selector(deleteSelection)] == NO)
|
||||
return;
|
||||
|
||||
if([self isConnecting])
|
||||
{
|
||||
[self stopConnecting];
|
||||
}
|
||||
|
||||
[(id<IBSelectionOwners,IBEditors>)selectionOwner copySelection];
|
||||
[(id<IBSelectionOwners,IBEditors>)selectionOwner deleteSelection];
|
||||
}
|
||||
|
||||
- (IBAction) paste: (id)sender
|
||||
{
|
||||
if ([selectionOwner respondsToSelector: @selector(pasteInSelection)] == NO)
|
||||
return;
|
||||
|
||||
if([self isConnecting])
|
||||
{
|
||||
[self stopConnecting];
|
||||
}
|
||||
|
||||
[(id<IBSelectionOwners,IBEditors>)selectionOwner pasteInSelection];
|
||||
}
|
||||
|
||||
|
||||
- (IBAction) delete: (id)sender
|
||||
{
|
||||
if ([[selectionOwner selection] count] == 0
|
||||
|| [selectionOwner respondsToSelector: @selector(deleteSelection)] == NO)
|
||||
return;
|
||||
|
||||
if([self isConnecting])
|
||||
{
|
||||
[self stopConnecting];
|
||||
}
|
||||
|
||||
[(id<IBSelectionOwners,IBEditors>)selectionOwner deleteSelection];
|
||||
}
|
||||
|
||||
- (IBAction) selectAll: (id)sender
|
||||
{
|
||||
if ([[selectionOwner selection] count] == 0
|
||||
|| [selectionOwner respondsToSelector: @selector(deleteSelection)] == NO)
|
||||
return;
|
||||
|
||||
if([self isConnecting])
|
||||
{
|
||||
[self stopConnecting];
|
||||
}
|
||||
|
||||
[(id<IBSelectionOwners,IBEditors>)selectionOwner deleteSelection];
|
||||
}
|
||||
|
||||
- (IBAction) selectAllItems: (id)sender
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
/** Grouping */
|
||||
|
||||
- (IBAction) groupSelectionInSplitView: (id)sender
|
||||
{
|
||||
if ([[selectionOwner selection] count] < 2
|
||||
|| [selectionOwner respondsToSelector: @selector(groupSelectionInSplitView)] == NO)
|
||||
return;
|
||||
|
||||
[(GormGenericEditor *)selectionOwner groupSelectionInSplitView];
|
||||
}
|
||||
|
||||
- (IBAction) groupSelectionInBox: (id)sender
|
||||
{
|
||||
if ([selectionOwner respondsToSelector: @selector(groupSelectionInBox)] == NO)
|
||||
return;
|
||||
[(GormGenericEditor *)selectionOwner groupSelectionInBox];
|
||||
}
|
||||
|
||||
- (IBAction) groupSelectionInView: (id)sender
|
||||
{
|
||||
if ([selectionOwner respondsToSelector: @selector(groupSelectionInView)] == NO)
|
||||
return;
|
||||
[(GormGenericEditor *)selectionOwner groupSelectionInView];
|
||||
}
|
||||
|
||||
- (IBAction) groupSelectionInScrollView: (id)sender
|
||||
{
|
||||
if ([selectionOwner respondsToSelector: @selector(groupSelectionInScrollView)] == NO)
|
||||
return;
|
||||
[(GormGenericEditor *)selectionOwner groupSelectionInScrollView];
|
||||
}
|
||||
|
||||
- (IBAction) groupSelectionInMatrix: (id)sender
|
||||
{
|
||||
if ([selectionOwner respondsToSelector: @selector(groupSelectionInMatrix)] == NO)
|
||||
return;
|
||||
[(GormGenericEditor *)selectionOwner groupSelectionInMatrix];
|
||||
}
|
||||
|
||||
- (IBAction) ungroup: (id)sender
|
||||
{
|
||||
// NSLog(@"ungroup: selectionOwner %@", selectionOwner);
|
||||
if ([selectionOwner respondsToSelector: @selector(ungroup)] == NO)
|
||||
return;
|
||||
[(GormGenericEditor *)selectionOwner ungroup];
|
||||
}
|
||||
|
||||
/** Classes actions */
|
||||
|
||||
- (IBAction) createSubclass: (id)sender
|
||||
{
|
||||
[(GormDocument *)[self activeDocument] createSubclass: sender];
|
||||
}
|
||||
|
||||
- (IBAction) loadClass: (id)sender
|
||||
{
|
||||
// Call the current document and create the class
|
||||
// descibed by the header
|
||||
[(GormDocument *)[self activeDocument] loadClass: sender];
|
||||
}
|
||||
|
||||
- (IBAction) createClassFiles: (id)sender
|
||||
{
|
||||
[(GormDocument *)[self activeDocument] createClassFiles: sender];
|
||||
}
|
||||
|
||||
- (IBAction) instantiateClass: (id)sender
|
||||
{
|
||||
[(GormDocument *)[self activeDocument] instantiateClass: sender];
|
||||
}
|
||||
|
||||
- (IBAction) addAttributeToClass: (id)sender
|
||||
{
|
||||
[(GormDocument *)[self activeDocument] addAttributeToClass: sender];
|
||||
}
|
||||
|
||||
- (IBAction) remove: (id)sender
|
||||
{
|
||||
[(GormDocument *)[self activeDocument] remove: sender];
|
||||
}
|
||||
|
||||
/** Palettes Actions... */
|
||||
|
||||
- (IBAction) inspector: (id) sender
|
||||
{
|
||||
[[[self inspectorsManager] panel] makeKeyAndOrderFront: self];
|
||||
}
|
||||
|
||||
- (IBAction) palettes: (id) sender
|
||||
{
|
||||
[[[self palettesManager] panel] makeKeyAndOrderFront: self];
|
||||
}
|
||||
|
||||
- (IBAction) loadPalette: (id) sender
|
||||
{
|
||||
[[self palettesManager] openPalette: sender];
|
||||
}
|
||||
|
||||
// Print
|
||||
|
||||
- (IBAction) print: (id) sender
|
||||
{
|
||||
[[NSApp keyWindow] print: sender];
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
|
@ -71,6 +71,11 @@
|
|||
NSSet *topObjects;
|
||||
}
|
||||
|
||||
// testing the interface
|
||||
- (IBAction) deferredEndTesting: (id) sender;
|
||||
- (IBAction) testInterface: (id)sender;
|
||||
- (IBAction) endTesting: (id)sender;
|
||||
|
||||
@end
|
||||
|
||||
#endif // import guard
|
||||
|
|
|
@ -143,18 +143,6 @@
|
|||
[super dealloc];
|
||||
}
|
||||
|
||||
- (IBAction) stop: (id)sender
|
||||
{
|
||||
if(isTesting == NO)
|
||||
{
|
||||
// [super stop: sender];
|
||||
}
|
||||
else
|
||||
{
|
||||
[self endTesting: sender];
|
||||
}
|
||||
}
|
||||
|
||||
// Gorm specific methods...
|
||||
|
||||
|
||||
|
@ -313,42 +301,6 @@
|
|||
}
|
||||
}
|
||||
|
||||
/** Info Menu Actions */
|
||||
- (IBAction) preferencesPanel: (id) sender
|
||||
{
|
||||
if(! preferencesController)
|
||||
{
|
||||
preferencesController = [[GormPrefController alloc] init];
|
||||
}
|
||||
|
||||
[[preferencesController panel] makeKeyAndOrderFront:nil];
|
||||
}
|
||||
|
||||
/** Document Menu Actions */
|
||||
- (IBAction) close: (id)sender
|
||||
{
|
||||
GormDocument *document = (GormDocument *)[self activeDocument];
|
||||
if([document canCloseDocument])
|
||||
{
|
||||
[document close];
|
||||
}
|
||||
}
|
||||
|
||||
- (IBAction) debug: (id) sender
|
||||
{
|
||||
[[self activeDocument] performSelector: @selector(printAllEditors)];
|
||||
}
|
||||
|
||||
- (IBAction) loadSound: (id) sender
|
||||
{
|
||||
[(GormDocument *)[self activeDocument] openSound: sender];
|
||||
}
|
||||
|
||||
- (IBAction) loadImage: (id) sender
|
||||
{
|
||||
[(GormDocument *)[self activeDocument] openImage: sender];
|
||||
}
|
||||
|
||||
- (IBAction) testInterface: (id)sender
|
||||
{
|
||||
if (isTesting == NO)
|
||||
|
@ -534,87 +486,6 @@
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
/** Edit Menu Actions */
|
||||
|
||||
- (IBAction) copy: (id)sender
|
||||
{
|
||||
if ([[selectionOwner selection] count] == 0
|
||||
|| [selectionOwner respondsToSelector: @selector(copySelection)] == NO)
|
||||
return;
|
||||
|
||||
if([self isConnecting])
|
||||
{
|
||||
[self stopConnecting];
|
||||
}
|
||||
|
||||
[(id<IBSelectionOwners,IBEditors>)selectionOwner copySelection];
|
||||
}
|
||||
|
||||
|
||||
- (IBAction) cut: (id)sender
|
||||
{
|
||||
if ([[selectionOwner selection] count] == 0
|
||||
|| [selectionOwner respondsToSelector: @selector(copySelection)] == NO
|
||||
|| [selectionOwner respondsToSelector: @selector(deleteSelection)] == NO)
|
||||
return;
|
||||
|
||||
if([self isConnecting])
|
||||
{
|
||||
[self stopConnecting];
|
||||
}
|
||||
|
||||
[(id<IBSelectionOwners,IBEditors>)selectionOwner copySelection];
|
||||
[(id<IBSelectionOwners,IBEditors>)selectionOwner deleteSelection];
|
||||
}
|
||||
|
||||
- (IBAction) paste: (id)sender
|
||||
{
|
||||
if ([selectionOwner respondsToSelector: @selector(pasteInSelection)] == NO)
|
||||
return;
|
||||
|
||||
if([self isConnecting])
|
||||
{
|
||||
[self stopConnecting];
|
||||
}
|
||||
|
||||
[(id<IBSelectionOwners,IBEditors>)selectionOwner pasteInSelection];
|
||||
}
|
||||
|
||||
|
||||
- (IBAction) delete: (id)sender
|
||||
{
|
||||
if ([[selectionOwner selection] count] == 0
|
||||
|| [selectionOwner respondsToSelector: @selector(deleteSelection)] == NO)
|
||||
return;
|
||||
|
||||
if([self isConnecting])
|
||||
{
|
||||
[self stopConnecting];
|
||||
}
|
||||
|
||||
[(id<IBSelectionOwners,IBEditors>)selectionOwner deleteSelection];
|
||||
}
|
||||
|
||||
- (IBAction) selectAll: (id)sender
|
||||
{
|
||||
if ([[selectionOwner selection] count] == 0
|
||||
|| [selectionOwner respondsToSelector: @selector(deleteSelection)] == NO)
|
||||
return;
|
||||
|
||||
if([self isConnecting])
|
||||
{
|
||||
[self stopConnecting];
|
||||
}
|
||||
|
||||
[(id<IBSelectionOwners,IBEditors>)selectionOwner deleteSelection];
|
||||
}
|
||||
|
||||
- (IBAction) selectAllItems: (id)sender
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
- (IBAction) setName: (id)sender
|
||||
{
|
||||
GormSetNameController *panel;
|
||||
|
@ -667,104 +538,6 @@
|
|||
[[NSFontManager sharedFontManager] orderFrontFontPanel: self];
|
||||
}
|
||||
|
||||
/** Grouping */
|
||||
|
||||
- (IBAction) groupSelectionInSplitView: (id)sender
|
||||
{
|
||||
if ([[selectionOwner selection] count] < 2
|
||||
|| [selectionOwner respondsToSelector: @selector(groupSelectionInSplitView)] == NO)
|
||||
return;
|
||||
|
||||
[(GormGenericEditor *)selectionOwner groupSelectionInSplitView];
|
||||
}
|
||||
|
||||
- (IBAction) groupSelectionInBox: (id)sender
|
||||
{
|
||||
if ([selectionOwner respondsToSelector: @selector(groupSelectionInBox)] == NO)
|
||||
return;
|
||||
[(GormGenericEditor *)selectionOwner groupSelectionInBox];
|
||||
}
|
||||
|
||||
- (IBAction) groupSelectionInView: (id)sender
|
||||
{
|
||||
if ([selectionOwner respondsToSelector: @selector(groupSelectionInView)] == NO)
|
||||
return;
|
||||
[(GormGenericEditor *)selectionOwner groupSelectionInView];
|
||||
}
|
||||
|
||||
- (IBAction) groupSelectionInScrollView: (id)sender
|
||||
{
|
||||
if ([selectionOwner respondsToSelector: @selector(groupSelectionInScrollView)] == NO)
|
||||
return;
|
||||
[(GormGenericEditor *)selectionOwner groupSelectionInScrollView];
|
||||
}
|
||||
|
||||
- (IBAction) groupSelectionInMatrix: (id)sender
|
||||
{
|
||||
if ([selectionOwner respondsToSelector: @selector(groupSelectionInMatrix)] == NO)
|
||||
return;
|
||||
[(GormGenericEditor *)selectionOwner groupSelectionInMatrix];
|
||||
}
|
||||
|
||||
- (IBAction) ungroup: (id)sender
|
||||
{
|
||||
// NSLog(@"ungroup: selectionOwner %@", selectionOwner);
|
||||
if ([selectionOwner respondsToSelector: @selector(ungroup)] == NO)
|
||||
return;
|
||||
[(GormGenericEditor *)selectionOwner ungroup];
|
||||
}
|
||||
|
||||
/** Classes actions */
|
||||
|
||||
- (IBAction) createSubclass: (id)sender
|
||||
{
|
||||
[(GormDocument *)[self activeDocument] createSubclass: sender];
|
||||
}
|
||||
|
||||
- (IBAction) loadClass: (id)sender
|
||||
{
|
||||
// Call the current document and create the class
|
||||
// descibed by the header
|
||||
[(GormDocument *)[self activeDocument] loadClass: sender];
|
||||
}
|
||||
|
||||
- (IBAction) createClassFiles: (id)sender
|
||||
{
|
||||
[(GormDocument *)[self activeDocument] createClassFiles: sender];
|
||||
}
|
||||
|
||||
- (IBAction) instantiateClass: (id)sender
|
||||
{
|
||||
[(GormDocument *)[self activeDocument] instantiateClass: sender];
|
||||
}
|
||||
|
||||
- (IBAction) addAttributeToClass: (id)sender
|
||||
{
|
||||
[(GormDocument *)[self activeDocument] addAttributeToClass: sender];
|
||||
}
|
||||
|
||||
- (IBAction) remove: (id)sender
|
||||
{
|
||||
[(GormDocument *)[self activeDocument] remove: sender];
|
||||
}
|
||||
|
||||
/** Palettes Actions... */
|
||||
|
||||
- (IBAction) inspector: (id) sender
|
||||
{
|
||||
[[[self inspectorsManager] panel] makeKeyAndOrderFront: self];
|
||||
}
|
||||
|
||||
- (IBAction) palettes: (id) sender
|
||||
{
|
||||
[[[self palettesManager] panel] makeKeyAndOrderFront: self];
|
||||
}
|
||||
|
||||
- (IBAction) loadPalette: (id) sender
|
||||
{
|
||||
[[self palettesManager] openPalette: sender];
|
||||
}
|
||||
|
||||
/** Testing methods... */
|
||||
|
||||
- (IBAction) deferredEndTesting: (id) sender
|
||||
|
@ -914,7 +687,6 @@
|
|||
mainMenu = (NSMenu *)gormMenu;
|
||||
}
|
||||
|
||||
|
||||
- (GormInspectorsManager*) inspectorsManager
|
||||
{
|
||||
if (inspectorsManager == nil)
|
||||
|
@ -924,7 +696,6 @@
|
|||
return inspectorsManager;
|
||||
}
|
||||
|
||||
|
||||
- (BOOL) isConnecting
|
||||
{
|
||||
return isConnecting;
|
||||
|
@ -940,15 +711,6 @@
|
|||
return linkImage;
|
||||
}
|
||||
|
||||
|
||||
- (id) miniaturize: (id)sender
|
||||
{
|
||||
NSWindow *window = [(GormDocument *)[self activeDocument] window];
|
||||
|
||||
[window miniaturize: self];
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (GormPalettesManager*) palettesManager
|
||||
{
|
||||
if (palettesManager == nil)
|
||||
|
@ -1035,11 +797,6 @@
|
|||
return classMenu;
|
||||
}
|
||||
|
||||
- (IBAction) print: (id) sender
|
||||
{
|
||||
[[NSApp keyWindow] print: sender];
|
||||
}
|
||||
|
||||
// Methods to support external apps adding and deleting
|
||||
// classes from the current document...
|
||||
- (void) addClass: (NSDictionary *) dict
|
||||
|
|
|
@ -44,39 +44,10 @@
|
|||
- (BOOL) isConnecting;
|
||||
- (void) stopConnecting;
|
||||
|
||||
// preferences
|
||||
- (IBAction) preferencesPanel: (id) sender;
|
||||
|
||||
// Cut/Paste operations
|
||||
- (IBAction) copy: (id)sender;
|
||||
- (IBAction) cut: (id)sender;
|
||||
- (IBAction) paste: (id)sender;
|
||||
- (IBAction) delete: (id)sender;
|
||||
- (IBAction) selectAllItems: (id)sender;
|
||||
- (IBAction) setName: (id)sender;
|
||||
|
||||
// palettes/inspectors.
|
||||
- (IBAction) inspector: (id) sender;
|
||||
- (IBAction) palettes: (id) sender;
|
||||
- (IBAction) loadPalette: (id) sender;
|
||||
- (GormPalettesManager*) palettesManager;
|
||||
- (GormInspectorsManager*) inspectorsManager;
|
||||
- (GormPluginManager*) pluginManager;
|
||||
|
||||
// testing the interface
|
||||
- (IBAction) testInterface: (id)sender;
|
||||
- (IBAction) endTesting: (id)sender;
|
||||
|
||||
// sound & images
|
||||
- (IBAction) loadSound: (id) sender;
|
||||
- (IBAction) loadImage: (id) sender;
|
||||
|
||||
// grouping/layout
|
||||
- (IBAction) groupSelectionInSplitView: (id)sender;
|
||||
- (IBAction) groupSelectionInBox: (id)sender;
|
||||
- (IBAction) groupSelectionInScrollView: (id)sender;
|
||||
- (IBAction) ungroup: (id)sender;
|
||||
|
||||
// added for classes support
|
||||
- (GormClassManager*) classManager;
|
||||
- (NSMenu*) classMenu;
|
||||
|
|
Loading…
Reference in a new issue