Fix menu problem with loading palettes

This commit is contained in:
Gregory John Casamento 2023-06-28 14:56:39 -04:00
parent 6147fd5859
commit af4f72f3f5
6 changed files with 70 additions and 33 deletions

View file

@ -12,16 +12,16 @@
"groupSelectionInView:",
"inspector:",
"loadImage:",
"loadPallete:",
"loadSound:",
"ungroup:",
"loadPalette:",
"orderFrontFontPanel:",
"palettes:",
"preferencesPanel:",
"selectAllItems:",
"setName:",
"testinterface:",
"translate:"
"translate:",
"ungroup:"
);
Super = NSObject;
};
@ -78,7 +78,6 @@
"groupSelectionInSplitView:",
"inspector:",
"loadImage:",
"loadPallete:",
"loadSound:",
"ungroup:",
"palettes:",
@ -86,7 +85,8 @@
"preferencesPanel:",
"selectAllItems:",
"setName:",
"testinterface:"
"testinterface:",
"loadPalette:"
);
Outlets = (
gormMenu,

View file

@ -45,7 +45,6 @@
- (IBAction) paste: (id)sender;
- (IBAction) delete: (id)sender;
- (IBAction) selectAllItems: (id)sender;
- (IBAction) setName: (id)sender;
// palettes/inspectors.
- (IBAction) inspector: (id) sender;

View file

@ -114,21 +114,31 @@
s = [selectionOwner selection];
}
if (sel_isEqual(action, @selector(close:))
if(sel_isEqual(action, @selector(loadPalette:)))
{
return YES;
}
else if (sel_isEqual(action, @selector(close:))
|| sel_isEqual(action, @selector(miniaturize:)))
{
if (active == nil)
return NO;
{
return NO;
}
}
else if (sel_isEqual(action, @selector(testInterface:)))
{
if (active == nil)
return NO;
{
return NO;
}
}
else if (sel_isEqual(action, @selector(copy:)))
{
if ([s count] == 0)
return NO;
{
return NO;
}
else
{
id o = [s objectAtIndex: 0];
@ -144,7 +154,9 @@
else if (sel_isEqual(action, @selector(cut:)))
{
if ([s count] == 0)
return NO;
{
return NO;
}
else
{
id o = [s objectAtIndex: 0];
@ -161,7 +173,9 @@
else if (sel_isEqual(action, @selector(delete:)))
{
if ([s count] == 0)
return NO;
{
return NO;
}
else
{
id o = [s objectAtIndex: 0];
@ -177,11 +191,14 @@
else if (sel_isEqual(action, @selector(paste:)))
{
if ([s count] == 0)
return NO;
{
return NO;
}
else
{
id o = [s objectAtIndex: 0];
NSString *n = [active nameForObject: o];
if ([n isEqual: @"NSOwner"] || [n isEqual: @"NSFirst"])
{
return NO;

View file

@ -33,4 +33,7 @@
@class NSSet;
@interface AppDelegate : GormAbstractDelegate
- (void) process;
@end

View file

@ -1,3 +1,28 @@
/* AppDelegate.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.
*/
#import <Foundation/NSDictionary.h>
#import <Foundation/NSNotification.h>
#import <Foundation/NSProcessInfo.h>
@ -8,37 +33,30 @@
@implementation AppDelegate
- (NSDictionary *) buildDictionary
{
NSMutableDictionary *dict = [NSMutableDictionary dictionary];
NSArray *keys = [dict allKeys];
/*
FOR_IN(NSString*, k, keys)
{
}
END_FOR_IN(keys);
*/
return dict;
}
- (void) process
{
NSDictionary *args = [self buildDictionary];
NSProcessInfo *pi = [NSProcessInfo processInfo];
GormDocumentController *dc = [GormDocumentController sharedDocumentController];
[NSClassSwapper setIsInInterfaceBuilder: YES];
NSLog(@"Processing... %@", args);
NSLog(@"Processing... %@", [pi arguments]);
if ([[pi arguments] count] > 1)
{
NSString *file = [[pi arguments] objectAtIndex: 1];
NSLog(@"file = %@", file);
[dc openDocumentWithContentsOfFile: file display: NO];
}
[NSClassSwapper setIsInInterfaceBuilder: NO];
}
- (void) applicationDidFinishLaunching: (NSNotification *)n
{
GormDocumentController *dc = [GormDocumentController sharedDocumentController];
puts("== gormtool");
NSLog(@"processInfo: %@", [NSProcessInfo processInfo]);
[self process];