Update canvas changes with new structure

This commit is contained in:
Gregory John Casamento 2023-08-18 03:40:59 -04:00
commit 8e30d4979a
593 changed files with 6575 additions and 2126 deletions

View file

@ -1,6 +0,0 @@
*.app
*.debug
*.profile
*.palette
*obj
.gdbinit

4
.gitignore vendored
View file

@ -3,5 +3,7 @@
*.profile
*.palette
*.plugin
.gdbinit
obj
InterfaceBuilder
derived_src
*.framework

22
Applications/GNUmakefile Normal file
View file

@ -0,0 +1,22 @@
#
# GNUmakefile - Generated by ProjectCenter
#
ifeq ($(GNUSTEP_MAKEFILES),)
GNUSTEP_MAKEFILES := $(shell gnustep-config --variable=GNUSTEP_MAKEFILES 2>/dev/null)
endif
ifeq ($(GNUSTEP_MAKEFILES),)
$(error You need to set GNUSTEP_MAKEFILES before compiling!)
endif
include $(GNUSTEP_MAKEFILES)/common.make
# Generator bundles
SUBPROJECTS = \
Gorm
#
# Makefiles
#
-include GNUmakefile.preamble
include $(GNUSTEP_MAKEFILES)/aggregate.make
-include GNUmakefile.postamble

View file

@ -0,0 +1,128 @@
{
"## Comment" = "Do NOT change this file, Gorm maintains it";
FirstResponder = {
Actions = (
"addAttributeToClass:",
"alignSelectedObjects:",
"arrangeSelectedObjects:",
"createClassFiles:",
"createSubclass:",
"endTesting:",
"exportStrings:",
"exportXLIFFDocument:",
"groupSelectionInBox:",
"groupSelectionInMatrix:",
"groupSelectionInScrollView:",
"groupSelectionInSplitView:",
"groupSelectionInView:",
"guideline:",
"importXLIFFDocument:",
"inspector:",
"instantiateClass:",
"loadClass:",
"loadImage:",
"loadPalette:",
"loadSound:",
"newAction:",
"orderFrontFontPanel:",
"palettes:",
"preferencesPanel:",
"remove:",
"selectAllItems:",
"setName:",
"testinterface:",
"translate:",
"ungroup:"
);
Super = NSObject;
};
Gorm = {
Actions = (
"editClass:",
"createSubclass:",
"testInterface:",
"setName:",
"selectAllItems:",
"paste:",
"palettes:",
"loadSound:",
"loadPalette:",
"inspector:",
"infoPanel:",
"endTesting:",
"delete:",
"cut:",
"copy:",
"close:",
"miniaturize:",
"debug:",
"loadImage:",
"orderFrontFontPanel:",
"ungroup:",
"groupSelectionInScrollView:",
"groupSelectionInBox:",
"groupSelectionInSplitView:",
"remove:",
"addAttributeToClass:",
"instantiateClass:",
"createClassFiles:",
"loadClass:",
"preferencesPanel:",
"guideline:",
"print:",
"groupSelectionInView:",
"groupSelectionInMatrix:"
);
Outlets = (
gormMenu,
guideLineMenuItem
);
Super = NSApplication;
};
GormAppDelegate = {
Actions = (
"copy:",
"cut:",
"delete:",
"endTesting:",
"groupSelectionInBox:",
"groupSelectionInSplitView:",
"inspector:",
"loadImage:",
"loadSound:",
"ungroup:",
"palettes:",
"paste:",
"preferencesPanel:",
"selectAllItems:",
"setName:",
"testinterface:",
"loadPalette:",
"createClassFiles:",
"createSubclass:",
"groupSelectionInScrollView:",
"groupSelectionInView:",
"guideline:",
"instantiateClass:",
"loadClass:",
"addAttributeToClass:",
"remove:",
"exportXLIFFDocument:",
"importXLIFFDocument:",
"exportStrings:",
"translate:"
);
Outlets = (
gormMenu,
guideLineMenuItem
);
Super = NSObject;
};
GormDocumentController = {
Actions = (
);
Outlets = (
);
Super = NSDocumentController;
};
}

Binary file not shown.

View file

@ -0,0 +1,21 @@
{
"## Comment" = "Do NOT change this file, Gorm maintains it";
FirstResponder = {
Actions = (
"updateTargetLanguage:",
"updateSourceLanguage:"
);
Super = NSObject;
};
GormLanguageViewController = {
Actions = (
"updateTargetLanguage:",
"updateSourceLanguage:"
);
Outlets = (
targetLanguage,
sourceLanguage
);
Super = NSViewController;
};
}

View file

@ -0,0 +1,173 @@
# GNUmakefile: main makefile for GNUstep Object Relationship Modeller
#
# Copyright (C) 1999,2002,2003 Free Software Foundation, Inc.
#
# Author: Gregory John Casamento <greg_casamento@yahoo.com>
# Date: 2003
# Author: Richard Frith-Macdonald <richard@brainstorm.co.uk>
# Date: 1999
#
# 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 2 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
ifeq ($(GNUSTEP_MAKEFILES),)
GNUSTEP_MAKEFILES := $(shell gnustep-config --variable=GNUSTEP_MAKEFILES 2>/dev/null)
ifeq ($(GNUSTEP_MAKEFILES),)
$(warning )
$(warning Unable to obtain GNUSTEP_MAKEFILES setting from gnustep-config!)
$(warning Perhaps gnustep-make is not properly installed,)
$(warning so gnustep-config is not in your PATH.)
$(warning )
$(warning Your PATH is currently $(PATH))
$(warning )
endif
endif
ifeq ($(GNUSTEP_MAKEFILES),)
$(error You need to set GNUSTEP_MAKEFILES before compiling!)
endif
PACKAGE_NAME = gorm
export PACKAGE_NAME
include $(GNUSTEP_MAKEFILES)/common.make
CVS_MODULE_NAME = gorm
SVN_MODULE_NAME = gorm
SVN_BASE_URL = svn+ssh://svn.gna.org/svn/gnustep/apps
include ./Version
#
# Each palette is a subproject
#
SUBPROJECTS = \
Palettes
#
# MAIN APP
#
APP_NAME = Gorm
Gorm_PRINCIPAL_CLASS=Gorm
Gorm_APPLICATION_ICON=Gorm.tiff
Gorm_RESOURCE_FILES = \
GormInfo.plist \
Resources/Defaults.plist \
Resources/language-codes.plist \
Palettes/0Menus/0Menus.palette \
Palettes/1Windows/1Windows.palette \
Palettes/2Controls/2Controls.palette \
Palettes/3Containers/3Containers.palette \
Palettes/4Data/4Data.palette \
Images/FileIcon_gmodel.tiff \
Images/GormEHCoil.tiff \
Images/GormEHLine.tiff \
Images/GormEVCoil.tiff \
Images/GormEVLine.tiff \
Images/GormFile.tiff \
Images/GormMenu.tiff \
Images/GormMHCoil.tiff \
Images/GormMHLine.tiff \
Images/GormMVCoil.tiff \
Images/GormMVLine.tiff \
Images/GormNib.tiff \
Images/GormPalette.tiff \
Images/Gorm.tiff \
Images/GormSourceTag.tiff \
Images/GormTargetTag.tiff \
Images/GormLinkImage.tiff \
Images/GormTesting.tiff \
Images/Sunday_seurat.tiff \
Images/number_formatter.tiff \
Images/date_formatter.tiff \
Images/iconAbove_nib.tiff \
Images/iconBelow_nib.tiff \
Images/iconBottomLeft_nib.tiff \
Images/iconBottom_nib.tiff \
Images/iconBottomRight_nib.tiff \
Images/iconCenterLeft_nib.tiff \
Images/iconCenter_nib.tiff \
Images/iconCenterRight_nib.tiff \
Images/iconLeft_nib.tiff \
Images/iconOnly_nib.tiff \
Images/iconRight_nib.tiff \
Images/iconTopLeft_nib.tiff \
Images/iconTop_nib.tiff \
Images/iconTopRight_nib.tiff \
Images/centeralign_nib.tiff \
Images/justifyalign_nib.tiff \
Images/leftalign_nib.tiff \
Images/naturalalign_nib.tiff \
Images/rightalign_nib.tiff \
Images/bezel_nib.tiff \
Images/button_nib.tiff \
Images/centeralign_nib.tiff \
Images/iconAbove_nib.tiff \
Images/iconBelow_nib.tiff \
Images/iconBottomLeft_nib.tiff \
Images/iconBottom_nib.tiff \
Images/iconBottomRight_nib.tiff \
Images/iconCenterLeft_nib.tiff \
Images/iconCenter_nib.tiff \
Images/iconCenterRight_nib.tiff \
Images/iconLeft_nib.tiff \
Images/iconOnly_nib.tiff \
Images/iconRight_nib.tiff \
Images/iconTopLeft_nib.tiff \
Images/iconTop_nib.tiff \
Images/iconTopRight_nib.tiff \
Images/justifyalign_nib.tiff \
Images/leftalign_nib.tiff \
Images/line_nib.tiff \
Images/naturalalign_nib.tiff \
Images/noBorder_nib.tiff \
Images/photoframe_nib.tiff \
Images/ridge_nib.tiff \
Images/rightalign_nib.tiff \
Images/shortbutton_nib.tiff \
Images/tabbot_nib.tiff \
Images/tabtop_nib.tiff \
Images/titleOnly_nib.tiff \
Images/browserView.tiff \
Images/outlineView.tiff \
Images/LeftArr.tiff \
Images/RightArr.tiff \
Gorm_LOCALIZED_RESOURCE_FILES = \
Gorm.gorm \
GormLanguageViewController.gorm \
Gorm.rtfd
Gorm_LANGUAGES = \
English
Gorm_HEADERS = \
GormAppDelegate.h \
GormLanguageViewController.h
Gorm_OBJC_FILES = \
GormAppDelegate.m \
GormLanguageViewController.m \
main.m
-include GNUmakefile.preamble
-include GNUmakefile.local
include $(GNUSTEP_MAKEFILES)/aggregate.make
include $(GNUSTEP_MAKEFILES)/application.make
-include GNUmakefile.postamble

View file

@ -31,8 +31,6 @@ ifeq ($(LN_S_RECURSIVE),)
endif
before-all::
$(RM_LN_S) InterfaceBuilder; \
$(LN_S_RECURSIVE) GormLib InterfaceBuilder
after-all::
@ -41,4 +39,3 @@ after-clean::
after-distclean::
after-clean::
$(RM_LN_S) InterfaceBuilder

View file

@ -26,18 +26,17 @@
# ADDITIONAL_OBJCFLAGS += -Wall -Werror
ADDITIONAL_GUI_LIBS += \
-lGormCore \
-lGorm \
-lGormObjCHeaderParser \
-lGormPrefs
-lInterfaceBuilder \
ADDITIONAL_INCLUDE_DIRS += \
-IInterfaceBuilder \
-IGormObjCHeaderParser \
-IGormPrefs \
-IGormCore
-I../../InterfaceBuilder \
-I../../GormObjCHeaderParser \
-I../../GormCore \
-I../.. \
-I.
ADDITIONAL_LIB_DIRS += \
-LGormLib/$(GNUSTEP_OBJ_DIR) \
-LGormObjCHeaderParser/$(GNUSTEP_OBJ_DIR) \
-LGormPrefs/$(GNUSTEP_OBJ_DIR) \
-LGormCore/$(GNUSTEP_OBJ_DIR)
-L../../InterfaceBuilder/$(GNUSTEP_OBJ_DIR) \
-L../../GormObjCHeaderParser/$(GNUSTEP_OBJ_DIR) \
-L../../GormCore/GormCore.framework \

View file

@ -0,0 +1,98 @@
/* 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.
*/
#ifndef GormAppDelegate_H_INCLUDE
#define GormAppDelegate_H_INCLUDE
#import <AppKit/NSSavePanel.h>
#import <GormCore/GormCore.h>
#import <GormCore/GormPrefs.h>
#import <GNUstepBase/GSObjCRuntime.h>
@class NSDictionary;
@class NSImage;
@class NSMenu;
@class NSMutableArray;
@class NSSet;
@class GormLanguageViewController;
@interface GormAppDelegate : GormAbstractDelegate <NSOpenSavePanelDelegate>
{
@private
GormLanguageViewController *_vc;
}
// 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;
// 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;
// Translation
- (IBAction) importXLIFFDocument: (id)sender;
- (IBAction) exportXLIFFDocument: (id)sender;
- (IBAction) translate: (id)sender;
- (IBAction) exportStrings: (id)sender;
// Print
- (IBAction) print: (id)sender;
@end
#endif // GormAppDelegate_H_INCLUDE

View file

@ -0,0 +1,791 @@
/* 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.
*/
#import <Foundation/NSArray.h>
#import <Foundation/NSDictionary.h>
#import <Foundation/NSSet.h>
#import <AppKit/NSImage.h>
#import <AppKit/NSMenu.h>
#import "GormAppDelegate.h"
#import "GormLanguageViewController.h"
@interface GormDocument (Private)
- (NSMutableArray *) _collectAllObjects;
@end
@implementation GormAppDelegate
// App delegate...
- (BOOL)applicationShouldOpenUntitledFile: (NSApplication *)sender
{
if (NSInterfaceStyleForKey(@"NSMenuInterfaceStyle", nil) ==
NSWindows95InterfaceStyle)
{
return YES;
}
return NO;
}
- (void) applicationOpenUntitledFile: (NSApplication *)sender
{
GormDocumentController *dc = [GormDocumentController sharedDocumentController];
// open a new document and build an application type document by default...
[dc newDocument: sender];
}
- (void) applicationDidFinishLaunching: (NSNotification *)n
{
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
if ( [defaults boolForKey: @"ShowInspectors"] )
{
[[[self inspectorsManager] panel] makeKeyAndOrderFront: self];
}
if ( [defaults boolForKey: @"ShowPalettes"] )
{
[[[self palettesManager] panel] makeKeyAndOrderFront: self];
}
}
- (void) applicationWillTerminate: (NSNotification *)n
{
[[NSUserDefaults standardUserDefaults]
setBool: [[[self inspectorsManager] panel] isVisible]
forKey: @"ShowInspectors"];
[[NSUserDefaults standardUserDefaults]
setBool: [[[self palettesManager] panel] isVisible]
forKey: @"ShowPalettes"];
}
- (BOOL) applicationShouldTerminateAfterLastWindowClosed: (NSApplication *)sender
{
if (NSInterfaceStyleForKey(@"NSMenuInterfaceStyle", nil) ==
NSWindows95InterfaceStyle)
{
GormDocumentController *docController;
docController = [GormDocumentController sharedDocumentController];
if ([[docController documents] count] > 0)
{
return NO;
}
else
{
return YES;
}
}
return NO;
}
- (BOOL) validateMenuItem: (NSMenuItem*)item
{
GormDocument *active = (GormDocument*)[self activeDocument];
SEL action = [item action];
GormClassManager *cm = nil;
NSArray *s = nil;
// if we have an active document...
if(active != nil)
{
cm = [active classManager];
s = [selectionOwner selection];
}
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;
}
}
else if (sel_isEqual(action, @selector(testInterface:)))
{
if (active == nil)
{
return NO;
}
}
else if (sel_isEqual(action, @selector(copy:)))
{
if ([s count] == 0)
{
return NO;
}
else
{
id o = [s objectAtIndex: 0];
NSString *n = [active nameForObject: o];
if ([n isEqual: @"NSOwner"] || [n isEqual: @"NSFirst"])
{
return NO;
}
}
return [selectionOwner respondsToSelector: @selector(copySelection)];
}
else if (sel_isEqual(action, @selector(cut:)))
{
if ([s count] == 0)
{
return NO;
}
else
{
id o = [s objectAtIndex: 0];
NSString *n = [active nameForObject: o];
if ([n isEqual: @"NSOwner"] || [n isEqual: @"NSFirst"])
{
return NO;
}
}
return ([selectionOwner respondsToSelector: @selector(copySelection)]
&& [selectionOwner respondsToSelector: @selector(deleteSelection)]);
}
else if (sel_isEqual(action, @selector(delete:)))
{
if ([s count] == 0)
{
return NO;
}
else
{
id o = [s objectAtIndex: 0];
NSString *n = [active nameForObject: o];
if ([n isEqual: @"NSOwner"] || [n isEqual: @"NSFirst"])
{
return NO;
}
}
return [selectionOwner respondsToSelector: @selector(deleteSelection)];
}
else if (sel_isEqual(action, @selector(paste:)))
{
if ([s count] == 0)
{
return NO;
}
else
{
id o = [s objectAtIndex: 0];
NSString *n = [active nameForObject: o];
if ([n isEqual: @"NSOwner"] || [n isEqual: @"NSFirst"])
{
return NO;
}
}
return [selectionOwner respondsToSelector: @selector(pasteInSelection)];
}
else if (sel_isEqual(action, @selector(setName:)))
{
NSString *n;
id o;
if ([s count] == 0)
{
return NO;
}
if ([s count] > 1)
{
return NO;
}
o = [s objectAtIndex: 0];
n = [active nameForObject: o];
if ([n isEqual: @"NSOwner"] || [n isEqual: @"NSFirst"]
|| [n isEqual: @"NSFont"] || [n isEqual: @"NSMenu"])
{
return NO;
}
else if(![active isTopLevelObject: o])
{
return NO;
}
}
else if(sel_isEqual(action, @selector(createSubclass:)) ||
sel_isEqual(action, @selector(loadClass:)) ||
sel_isEqual(action, @selector(createClassFiles:)) ||
sel_isEqual(action, @selector(instantiateClass:)) ||
sel_isEqual(action, @selector(addAttributeToClass:)) ||
sel_isEqual(action, @selector(remove:)))
{
if(active == nil)
{
return NO;
}
if(![active isEditingClasses])
{
return NO;
}
if(sel_isEqual(action, @selector(createSubclass:)))
{
NSArray *s = [selectionOwner selection];
id o = nil;
NSString *name = nil;
if([s count] == 0 || [s count] > 1)
return NO;
o = [s objectAtIndex: 0];
name = [o className];
if([active classIsSelected] == NO)
{
return NO;
}
if([name isEqual: @"FirstResponder"])
return NO;
}
if(sel_isEqual(action, @selector(createClassFiles:)) ||
sel_isEqual(action, @selector(remove:)))
{
id o = nil;
NSString *name = nil;
if ([s count] == 0)
{
return NO;
}
if ([s count] > 1)
{
return NO;
}
o = [s objectAtIndex: 0];
name = [o className];
if(![cm isCustomClass: name])
{
return NO;
}
}
if(sel_isEqual(action, @selector(instantiateClass:)))
{
id o = nil;
NSString *name = nil;
if ([s count] == 0)
{
return NO;
}
if ([s count] > 1)
{
return NO;
}
if([active classIsSelected] == NO)
{
return NO;
}
o = [s objectAtIndex: 0];
name = [o className];
if(name != nil)
{
id cm = [self classManager];
return [cm canInstantiateClassNamed: name];
}
}
}
else if(sel_isEqual(action, @selector(loadSound:)) ||
sel_isEqual(action, @selector(loadImage:)) ||
sel_isEqual(action, @selector(debug:)))
{
if(active == nil)
{
return NO;
}
}
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];
}
// Translation
- (IBAction) importXLIFFDocument: (id)sender
{
NSArray *fileTypes = [NSArray arrayWithObjects: @"xliff", nil];
NSOpenPanel *oPanel = [NSOpenPanel openPanel];
int result;
[oPanel setAllowsMultipleSelection: NO];
[oPanel setCanChooseFiles: YES];
[oPanel setCanChooseDirectories: NO];
result = [oPanel runModalForDirectory: nil
file: nil
types: fileTypes];
if (result == NSOKButton)
{
GormDocument *doc = (GormDocument *)[self activeDocument];
NSMutableArray *allObjects = [doc _collectAllObjects];
NSString *filename = [oPanel filename];
NSEnumerator *en = nil;
id obj = nil;
BOOL result = NO;
NS_DURING
{
GormXLIFFDocument *xd = [GormXLIFFDocument xliffWithGormDocument: doc];
result = [xd importXLIFFDocumentWithName: filename];
}
NS_HANDLER
{
NSString *message = [localException reason];
NSRunAlertPanel(_(@"Problem loading XLIFF"),
message, nil, nil, nil);
}
NS_ENDHANDLER;
// If actual translation was done, then refresh the objects...
if (result == YES)
{
[doc touch]; // mark the document as modified...
// change to translated values.
en = [allObjects objectEnumerator];
while((obj = [en nextObject]) != nil)
{
if([obj isKindOfClass: [NSView class]])
{
[obj setNeedsDisplay: YES];
}
// redisplay/flush, if the object is a window.
if([obj isKindOfClass: [NSWindow class]])
{
NSWindow *w = (NSWindow *)obj;
[w setViewsNeedDisplay: YES];
[w disableFlushWindow];
[[w contentView] setNeedsDisplay: YES];
[[w contentView] displayIfNeeded];
[w enableFlushWindow];
[w flushWindowIfNeeded];
}
}
}
}
}
- (IBAction) exportXLIFFDocument: (id)sender
{
NSSavePanel *savePanel = [NSSavePanel savePanel];
NSBundle *bundle = [NSBundle bundleForClass: [GormLanguageViewController class]];
NSModalResponse result = 0;
GormDocument *doc = (GormDocument *)[self activeDocument];
if (doc != nil)
{
NSString *fn = [[doc fileURL] path];
fn = [[fn lastPathComponent] stringByDeletingPathExtension];
fn = [fn stringByAppendingPathExtension: @"xliff"];
_vc = [[GormLanguageViewController alloc]
initWithNibName: @"GormLanguageViewController"
bundle: bundle];
NSDebugLog(@"view = %@, _vc = %@", [_vc view], _vc);
[savePanel setTitle: @"Export XLIFF"];
[savePanel setAccessoryView: [_vc view]];
[savePanel setDelegate: self];
// [savePanel setURL: [NSURL fileURLWithPath: fn]];
result = [savePanel runModalForDirectory: nil
file: fn];
if (NSModalResponseOK == result)
{
NSString *filename = [[savePanel URL] path];
GormXLIFFDocument *xd = [GormXLIFFDocument xliffWithGormDocument: doc];
[xd exportXLIFFDocumentWithName: filename
withSourceLanguage: [_vc sourceLanguageIdentifier]
andTargetLanguage: [_vc targetLanguageIdentifier]];
}
}
}
- (NSString *) panel: (id)sender
userEnteredFilename: (NSString *)filename
confirmed: (BOOL)flag
{
if (flag == YES)
{
NSDebugLog(@"Writing the document... %@", filename);
}
else
{
NSDebugLog(@"%@ not saved", filename);
}
return filename;
}
/**
* This method is used to translate all of the strings in the file from one language
* into another. This is helpful when attempting to translate an application for use
* in different locales.
*/
- (IBAction) translate: (id)sender
{
NSArray *fileTypes = [NSArray arrayWithObjects: @"strings", nil];
NSOpenPanel *oPanel = [NSOpenPanel openPanel];
int result;
[oPanel setAllowsMultipleSelection: NO];
[oPanel setCanChooseFiles: YES];
[oPanel setCanChooseDirectories: NO];
result = [oPanel runModalForDirectory: nil
file: nil
types: fileTypes];
if (result == NSOKButton)
{
GormDocument *doc = (GormDocument *)[self activeDocument];
NSMutableArray *allObjects = [doc _collectAllObjects];
NSString *filename = [oPanel filename];
NSEnumerator *en = nil;
id obj = nil;
NS_DURING
{
[doc importStringsFromFile: filename];
}
NS_HANDLER
{
NSString *message = [localException reason];
NSRunAlertPanel(_(@"Problem loading strings"),
message, nil, nil, nil);
}
NS_ENDHANDLER;
[doc touch]; // mark the document as modified...
// change to translated values.
en = [allObjects objectEnumerator];
while((obj = [en nextObject]) != nil)
{
if([obj isKindOfClass: [NSView class]])
{
[obj setNeedsDisplay: YES];
}
// redisplay/flush, if the object is a window.
if([obj isKindOfClass: [NSWindow class]])
{
NSWindow *w = (NSWindow *)obj;
[w setViewsNeedDisplay: YES];
[w disableFlushWindow];
[[w contentView] setNeedsDisplay: YES];
[[w contentView] displayIfNeeded];
[w enableFlushWindow];
[w flushWindowIfNeeded];
}
}
}
}
/**
* This method is used to export all strings in a document to a file for Language
* translation. This allows the user to see all of the strings which can be translated
* and allows the user to provide a translateion for each of them.
*/
- (IBAction) exportStrings: (id)sender
{
NSSavePanel *sp = [NSSavePanel savePanel];
int result;
[sp setRequiredFileType: @"strings"];
[sp setTitle: _(@"Save strings file as...")];
result = [sp runModalForDirectory: NSHomeDirectory()
file: nil];
if (result == NSOKButton)
{
NSString *filename = [sp filename];
GormDocument *doc = (GormDocument *)[self activeDocument];
[doc exportStringsToFile: filename];
}
}
// Print
- (IBAction) print: (id) sender
{
[[NSApp keyWindow] print: sender];
}
@end

View file

@ -1,7 +1,9 @@
{
NSIcon = "Gorm.tiff";
NSMainNibFile = "Gorm.gorm";
NSPrincipalClass = "NSApplication";
NSRole = "Editor";
NSTypes = (
{
NSName = "GSGormFileType";
@ -38,7 +40,7 @@
{
NSName = "GSXibFileType";
NSHumanReadableName = "Cocoa Xib";
NSRole = Viewer;
NSRole = Editor;
NSDocumentClass = GormDocument;
NSUnixExtensions = ( "xib" );
NSIcon = "GormNib.tiff";
@ -48,18 +50,19 @@
NSIcon = "GormPalette.tiff";
}
);
ApplicationDescription = "[GNUstep | Graphical] Object Relationship Modeller";
ApplicationIcon = "Gorm.tiff";
ApplicationName = "Gorm";
ApplicationRelease = "Gorm 1.3.1 (Release)";
ApplicationRelease = "Gorm 1.4.0 (Unreleased)";
Authors = ("Gregory John Casamento <greg.casamento@gmail.com>",
"Adam Fedor <fedor@gnu.org>",
"Richard Frith-Macdonald <rfm@gnu.org>",
"Wolfgang Lux <wolfgang.lux@gmail.com>",
"Pierre-Yves Rivaille <pyrivail@ens-lyon.fr>",
"Sergii Stoian <stoyan255@gmail.com>");
Copyright = "Copyright (C) 1999-2022 FSF";
Copyright = "Copyright (C) 1999-2023 FSF";
CopyrightDescription = "Released under the GNU General Public License 3.0";
NSBuildVersion = "1.3.1 Jan 15 2022";
NSBuildVersion = "1.4.0";
GSDesktopInstallationDomain=SYSTEM;
}

View file

@ -0,0 +1,52 @@
/* GormLanguageViewController.h
*
* Copyright (C) 2023 Free Software Foundation, Inc.
*
* Author: Gregory John Casamento <greg_casamento@yahoo.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.
*/
#ifndef GormLanguageViewController_H_INCLUDE
#define GormLanguageViewController_H_INCLUDE
#import <AppKit/NSViewController.h>
@class NSDictionary, NSString;
@interface GormLanguageViewController : NSViewController
{
IBOutlet id targetLanguage;
IBOutlet id sourceLanguage;
NSString *sourceLanguageIdentifier;
NSString *targetLanguageIdentifier;
NSDictionary *ldict;
}
- (IBAction) updateTargetLanguage: (id)sender;
- (IBAction) updateSourceLanguage: (id)sender;
- (NSString *) sourceLanguageIdentifier;
- (NSString *) targetLanguageIdentifier;
@end
#endif // GormLanguageViewController_H_INCLUDE

View file

@ -0,0 +1,119 @@
/* GormLanguageViewController.m
*
* Copyright (C) 2023 Free Software Foundation, Inc.
*
* Author: Gregory John Casamento <greg_casamento@yahoo.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/NSString.h>
#import <Foundation/NSDictionary.h>
#import <Foundation/NSBundle.h>
#import <Foundation/NSLocale.h>
#import <AppKit/NSPopUpButton.h>
#import "GormLanguageViewController.h"
@implementation GormLanguageViewController
- (void) selectPreferredLanguage
{
NSString *language = [[NSLocale preferredLanguages] objectAtIndex: 0];
NSInteger i = [[ldict allKeys] indexOfObject: language];
NSDebugLog(@"language = %@", language);
// Set the default translation to the current language
[sourceLanguage selectItemAtIndex: i];
[targetLanguage selectItemAtIndex: i];
// Set them since the above doesn't invoke the method that sets them.
[self updateTargetLanguage: self];
[self updateSourceLanguage: self];
}
- (void) viewDidLoad
{
NSBundle *bundle = [NSBundle bundleForClass: [self class]];
NSString *path = [bundle pathForResource: @"language-codes" ofType: @"plist"];
[super viewDidLoad];
if (path != nil)
{
[targetLanguage removeAllItems];
[sourceLanguage removeAllItems];
NSDebugLog(@"path = %@", path);
ldict = [[NSDictionary alloc] initWithContentsOfFile: path];
if (ldict != nil)
{
NSEnumerator *en = [ldict keyEnumerator];
id k = nil;
while ((k = [en nextObject]) != nil)
{
NSString *v = [ldict objectForKey: k];
NSString *itemTitle = [NSString stringWithFormat: @"%@ (%@)", k, v];
[targetLanguage addItemWithTitle: itemTitle];
[sourceLanguage addItemWithTitle: itemTitle];
}
// Select preferred language in pop up...
[self selectPreferredLanguage];
}
}
else
{
NSLog(@"Unable to load language codes");
}
}
- (void) dealloc
{
RELEASE(ldict);
[super dealloc];
}
- (IBAction) updateTargetLanguage: (id)sender
{
NSInteger i = [targetLanguage indexOfSelectedItem];
targetLanguageIdentifier = [[ldict allKeys] objectAtIndex: i];
}
- (IBAction) updateSourceLanguage: (id)sender
{
NSInteger i = [sourceLanguage indexOfSelectedItem];
sourceLanguageIdentifier = [[ldict allKeys] objectAtIndex: i];
}
- (NSString *) sourceLanguageIdentifier
{
return sourceLanguageIdentifier;
}
- (NSString *) targetLanguageIdentifier
{
return targetLanguageIdentifier;
}
@end

Some files were not shown because too many files have changed in this diff Show more