Update delegate

This commit is contained in:
Gregory John Casamento 2023-06-21 07:22:24 -04:00
parent bc0be9a97c
commit b8dc15cca3
2 changed files with 74 additions and 72 deletions

View file

@ -1,26 +1,53 @@
/* All rights reserved */
#import <AppKit/AppKit.h>
/* GormAppDelegate.m
*
* Copyright (C) 2023 Free Software Foundation, Inc.
*
* Author: Gregory John Casamento <greg.casamento@gmail.com>
* Date: 2023
*
* This file is part of GNUstep.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111
* USA.
*/
#include <GormCore/GormCore.h>
#include <GormCore/GormPrefs.h>
#include <GNUstepBase/GSObjCRuntime.h>
@class NSDictionary;
@class NSImage;
@class NSMenu;
@class NSMutableArray;
@class NSSet;
@interface GormAppDelegate : NSObject <IB, GormAppDelegate, GormServer>
{
IBOutlet id gormMenu;
IBOutlet id guideLineMenuItem;
IBOutlet id gormMenu;
IBOutlet id guideLineMenuItem;
GormPrefController *preferencesController;
GormClassManager *classManager;
GormInspectorsManager *inspectorsManager;
GormPalettesManager *palettesManager;
GormPluginManager *pluginManager;
id<IBSelectionOwners> selectionOwner;
BOOL isConnecting;
BOOL isTesting;
id testContainer;
id<IBSelectionOwners> selectionOwner;
BOOL isConnecting;
BOOL isTesting;
id testContainer;
NSMenu *mainMenu; // saves the main menu...
NSMenu *servicesMenu; // saves the services menu...
NSMenu *classMenu; // so we can set it for the class view
@ -30,8 +57,8 @@
NSImage *targetImage;
NSImage *gormImage;
NSImage *testingImage;
id connectSource;
id connectDestination;
id connectSource;
id connectDestination;
NSMutableArray *testingWindows;
NSSet *topObjects;
}

View file

@ -23,38 +23,15 @@
* USA.
*/
#import <AppKit/AppKit.h>
#import <Foundation/NSArray.h>
#import <Foundation/NSDictionary.h>
#import <Foundation/NSSet.h>
#import <AppKit/NSImage.h>
#import <AppKit/NSMenu.h>
#import "GormAppDelegate.h"
/*
@implementation NSApplication (GormPrivateMethods)
// NSApplication override to make Inspector's shortcuts available globally
- (void) sendEvent: (NSEvent *)theEvent
{
if ([theEvent type] == NSKeyDown)
{
NSPanel *inspector = [[self inspectorsManager] panel];
if ([inspector performKeyEquivalent: theEvent] != NO)
{
[inspector orderFront: self];
return;
}
}
[super sendEvent: theEvent];
}
- (void) arrangeInFront: (id)sender
{
if([self isTestingInterface] == NO)
{
[NSApp arrangeInFront: sender];
}
}
@end
*/
@implementation GormAppDelegate
// Methods to support external apps adding and deleting
@ -164,7 +141,7 @@
[self palettesManager];
[self pluginManager];
[GormDocumentController sharedDocumentController];
/*
* Start the server
*/
@ -174,7 +151,7 @@
NSLog(@"Could not register GormServer");
}
}
return self;
}
@ -251,15 +228,15 @@
{
GormDocumentController *docController;
docController = [GormDocumentController sharedDocumentController];
if ([[docController documents] count] > 0)
{
return NO;
}
{
return NO;
}
else
{
return YES;
}
{
return YES;
}
}
return NO;
@ -461,11 +438,7 @@
- (IBAction) testInterface: (id)sender
{
if (isTesting == YES)
{
return;
}
else
if (isTesting == NO)
{
// top level objects
NS_DURING
@ -545,6 +518,8 @@
NSMutableDictionary *nameTable = [testContainer nameTable];
NSMenu *aMenu = [nameTable objectForKey: @"NSMenu"];
mainMenu = [NSApp mainMenu]; // save the menu before testing...
[[NSApp mainMenu] close];
[NSApp setMainMenu: aMenu];
// initialize the context.
RETAIN(testContainer);
@ -716,15 +691,13 @@
[self stopConnecting];
}
[(id<IBSelectionOwners,IBEditors>)selectionOwner deleteSelection];
[(id<IBSelectionOwners,IBEditors>)selectionOwner deleteSelection];
}
/*
- (IBAction) selectAllItems: (id)sender
{
return;
}
*/
- (IBAction) setName: (id)sender
{
@ -756,7 +729,7 @@
- (IBAction) guideline: (id) sender
{
[[NSNotificationCenter defaultCenter] postNotificationName: GormToggleGuidelineNotification
object:nil];
object:nil];
if ( [guideLineMenuItem tag] == 0 )
{
[guideLineMenuItem setTitle:_(@"Turn GuideLine On")];
@ -769,7 +742,6 @@
}
}
- (IBAction) orderFrontFontPanel: (id) sender
{
NSFontPanel *fontPanel = [NSFontPanel sharedFontPanel];
@ -883,13 +855,13 @@
{
[[NSRunLoop currentRunLoop]
performSelector: @selector(endTesting:)
target: self
argument: nil
order: 5000
modes: [NSArray arrayWithObjects:
NSDefaultRunLoopMode,
NSModalPanelRunLoopMode,
NSEventTrackingRunLoopMode, nil]];
target: self
argument: nil
order: 5000
modes: [NSArray arrayWithObjects:
NSDefaultRunLoopMode,
NSModalPanelRunLoopMode,
NSEventTrackingRunLoopMode, nil]];
}
- (IBAction) endTesting: (id)sender
@ -939,8 +911,16 @@
DESTROY(menuLocations);
}
// Restore windows and menus...
[NSApp setMainMenu: mainMenu];
[NSApp setApplicationIconImage: gormImage];
[[NSApp mainMenu] display];
e = [testingWindows objectEnumerator];
while ((val = [e nextObject]) != nil)
{
[val orderFront: self];
}
NS_DURING
{
@ -952,7 +932,6 @@
}
NS_ENDHANDLER
[mainMenu display]; // bring it to the front...
isTesting = NO;
if ([selectionOwner conformsToProtocol: @protocol(IBEditors)] == YES)
@ -1363,8 +1342,4 @@
[[NSApp keyWindow] print: sender];
}
- (IBAction) selectAllItems: (id)sender
{
}
@end