Merge from NibCompatibility branch.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/apps/gorm/trunk@23033 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Gregory John Casamento 2006-06-05 02:12:00 +00:00
parent 3236e82774
commit 966d2b8409
34 changed files with 1512 additions and 2026 deletions

137
ChangeLog
View file

@ -1,3 +1,129 @@
2006-06-04 22:11 Gregory John Casamento <greg_casamento@yahoo.com>
* ChangeLog
* English.lproj/GormDocument.gorm
* English.lproj/Gorm.gorm
* GormCore/GModelDecoder.m
* GormCore/GNUmakefile
* GormCore/GormClassManager.h
* GormCore/GormClassManager.m
* GormCore/GormDocument.h
* GormCore/GormDocument.m
* GormCore/GormFilePrefsManager.h
* GormCore/GormFilePrefsManager.m
* GormCore/GormFilesOwner.m
* GormCore/GormImageEditor.m
* GormCore/GormImage.h
* GormCore/GormImage.m
* GormCore/GormProtocol.h
* GormCore/GormResource.h
* GormCore/GormResource.m
* GormCore/GormSound.h
* GormCore/GormSound.m
* GormCore/GormViewWithContentViewEditor.m
* GormInfo.plist
* GormLib/IBDocuments.h
* GormLib/IBPalette.m
* Gorm.m
* Palettes/0Menus/GormNSMenu.m
* Palettes/1Windows/GormNSWindow.m
* Version: Merged from NibCompatibility branch.
2006-06-03 11:44 Gregory John Casamento <greg_casamento@yahoo.com>
* English.lproj/Gorm.gorm: Add GormDocumentController as delegate
to Gorm.
* GormCore/GormDocumentController.m: Comment.
* GormCore/GormDocument.h: Comments and containerClass declaration.
* GormCore/GormDocument.m: containerClass implementation and use.
* GormLib/IBDocuments.h: More descriptive comment.
* GormLib/IBPalette.m: Remove IBPaletteDocument, since this is
not used.
* Gorm.m: Remove applicationShouldTerminate, since it is handled
by GormDocumentController as the app delegate.
2006-06-01 23:06 Gregory John Casamento <greg_casamento@yahoo.com>
* GormInfo.plist: Correct NSName entries.
2006-05-30 00:03 Gregory John Casamento <greg_casamento@yahoo.com>
* GormCore/GormDocumentController.h
* GormCore/GormDocumentController.m: New file.
* Gorm.m: Reimplemented activeDocument to use the document controller.
2006-05-29 22:55 Gregory John Casamento <greg_casamento@yahoo.com>
* GormCore/GormDocument.m: Removed some unused variables in
fileWrapperRepresentationOfType:.
2006-05-29 22:50 Gregory John Casamento <greg_casamento@yahoo.com>
* GormCore/GormDocument.[hm]: Added scmDirWrapper and private method
saveSCMDirectory to preserve the .svn/CVS directories, if they
are there.
* GormInfo.plist: GormDocument will be responsible for saving/reading
all types.
2006-05-29 18:38 Gregory John Casamento <greg_casamento@yahoo.com>
* GormCore/GormImage.m: Corrected minor issue in initWithData:...
2006-05-29 11:48 Gregory John Casamento <greg_casamento@yahoo.com>
* GormCore/GormDocument.h: Added new ivars for holding images/sounds
temporarily.
* GormCore/GormDocument.m: loadFileWrapperRepresentation:ofType:
modified to use images/sounds arrays. The awakeFromNib method
now pulls objects from those arrays and inserts them into the
GormImageEditor/GormSoundEditor instances when the nib is fully
loaded.
2006-05-29 10:39 Gregory John Casamento <greg_casamento@yahoo.com>
* GormCore/GormDocument.m: Override displayName and keepBackupFile.
* Palettes/1Windows/GormNSWindow.m: Remove test code.
2006-05-28 23:31 Gregory John Casamento <greg_casamento@yahoo.com>
* GormCore/GormProtocol.h: Removed some methods not needed anymore.
2006-05-28 23:03 Gregory John Casamento <greg_casamento@yahoo.com>
* English.lproj/Gorm.gorm: Removed uneeded methods from Gorm class.
* GormCore/GormDocument.[hm]: Add sender as a parameter to translate
and exportStrings.
* Gorm.m: Removed some uneeded checks in validateMenu: also removed
uneeded methods which were used to forward to GormDocument.
* Palettes/0Menus/GormNSMenu.m: Can't become key.
2006-05-28 19:36 Gregory John Casamento <greg_casamento@yahoo.com>
* English.lproj/GormDocument.gorm: Reparented GormDocument
to be a subclass of NSDocument and also redid connections.
* English.lproj/Gorm.gorm: Added new GormDocumentController class.
redid connections to save/new/and loadDocument methods for NSDocument
subclasses.
* GormCore/GModelDecoder.m: Changed to reflect changes to document.
* GormCore/GNUmakefile: Added new classes.
* GormCore/GormClassManager.[hm]: Added methods to allow
initialization and saving to NSData
* GormCore/GormDocument.[hm]: Removed save* and load* methods,
implemented loadFileWrapperRepresentation:ofType: and
fileWrapperRepresentationOfType: for NSDocument.
* GormCore/GormFilePrefsManager.[hm]: Added methods
to allow initialization from data.
* GormCore/GormImageEditor.m: Changed comment.
* GormCore/GormImage.[hm]: Allow init with data.
* GormCore/GormProtocol.h: Removed superceded methods.
* GormCore/GormResource.[hm]: Allow initialization with data.
* GormCore/GormSound.[hm]: Changed to allow initialization with
data.
* GormCore/GormViewWithContentViewEditor.m: Fixed warning.
* GormInfo.plist: Updated information for use with NSDocument.
* Gorm.m: Remove superceded methods.
* Palettes/1Windows/GormNSWindow.m: Temporary debugging method.
2006-05-20 18:19 Gregory John Casamento <greg_casamento@yahoo.com>
* GormCore/GormFilePrefsManager.m: Updated to 1.0.9
@ -263,8 +389,19 @@
* Palettes/1Windows/GormWindowAttributesInspector.m: Correction
for bug#15236. In ok: method the newStyleMask variable wasn't
<<<<<<< .working
properly initialized, this was causing the flags to be set
2006-01-08 14:03 Gregory John Casamento <greg_casamento@yahoo.com>
=======
properly initialized, this was causing the flags to be set
>>>>>>> .merge-right.r22963
* GormCore/GormPrivate.m: Removed deprecated templates.
* GormCore/GormViewEditor.m: Removed problem which was causing
a notification loop.
2005-12-15 19:08 Gregory John Casamento <greg_casamento@yahoo.com>
* GormCore/GormDocument.m: Correction for crash on close after

View file

@ -1,66 +1 @@
{
"## Comment" = "Do NOT change this file, Gorm maintains it";
FirstResponder = {
Actions = (
"arrangeSelectedObjects:",
"exportStrings:",
"alignSelectedObjects:",
"orderFrontFontPanel:",
"translate:"
);
Super = NSObject;
};
Gorm = {
Actions = (
"editClass:",
"createSubclass:",
"testInterface:",
"setName:",
"selectAllItems:",
"saveAs:",
"saveAll:",
"save:",
"revertToSaved:",
"paste:",
"palettes:",
"open:",
"loadSound:",
"loadPalette:",
"newGormDocument:",
"inspector:",
"infoPanel:",
"endTesting:",
"delete:",
"cut:",
"copy:",
"newPalette:",
"newInspector:",
"newEmpty:",
"close:",
"miniaturize:",
"debug:",
"loadImage:",
"orderFrontFontPanel:",
"ungroup:",
"groupSelectionInScrollView:",
"groupSelectionInBox:",
"groupSelectionInSplitView:",
"remove:",
"addAttributeToClass:",
"instantiateClass:",
"createClassFiles:",
"loadClass:",
"preferencesPanel:",
"guideline:",
"translate:",
"exportStrings:",
"arrangeSelectedObjects:",
"alignSelectedObjects:"
);
Outlets = (
gormMenu,
guideLineMenuItem
);
Super = NSApplication;
};
}
{"## Comment" = "Do NOT change this file, Gorm maintains it"; FirstResponder = {Actions = ("arrangeSelectedObjects:", "exportStrings:", "alignSelectedObjects:", "orderFrontFontPanel:", "translate:"); 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:"); Outlets = (gormMenu, guideLineMenuItem); Super = NSApplication; }; GormDocumentController = {Actions = (); Outlets = (); Super = NSDocumentController; }; }

Binary file not shown.

Binary file not shown.

View file

@ -18,12 +18,11 @@
);
Outlets = (
selectionBox,
window,
filePrefsView,
filePrefsManager,
filePrefsWindow
);
Super = GSNibContainer;
Super = NSDocument;
};
GormFilePrefsManager = {
Actions = (

241
Gorm.m
View file

@ -34,7 +34,6 @@
@interface Gorm : NSApplication <IB, Gorm>
{
id infoPanel;
GormPrefController *preferencesController;
GormClassManager *classManager;
GormInspectorsManager *inspectorsManager;
@ -74,21 +73,7 @@
- (id<IBDocuments>) activeDocument
{
unsigned i = [documents count];
if (i > 0)
{
while (i-- > 0)
{
id doc = [documents objectAtIndex: i];
if ([doc isActive] == YES)
{
return doc;
}
}
}
return nil;
return [[NSDocumentController sharedDocumentController] currentDocument];
}
/*
@ -141,12 +126,6 @@
}
}
/*
* Make sure the palettes manager exists, so that the editors and
* inspectors provided in the standard palettes are available.
*/
[self palettesManager];
/*
* load the interface...
*/
@ -156,6 +135,12 @@
exit(-1);
}
/*
* Make sure the palettes manager exists, so that the editors and
* inspectors provided in the standard palettes are available.
*/
[self palettesManager];
/*
* set the delegate.
*/
@ -170,7 +155,6 @@
NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];
[nc removeObserver: self];
RELEASE(infoPanel);
RELEASE(inspectorsManager);
RELEASE(palettesManager);
RELEASE(documents);
@ -202,14 +186,6 @@
{
[[[self palettesManager] panel] makeKeyAndOrderFront: self];
}
if(GSGetMethod([GSNibContainer class],@selector(awakeWithContext:),YES,YES) == NULL)
{
NSRunAlertPanel(_(@"Incorrect GNUstep Version"),
_(@"The version of GNUstep you are using is too old for this version of Gorm, please update."),
_(@"OK"), nil, nil);
[self terminate: self];
}
}
- (void) applicationWillTerminate: (NSApplication*)sender
@ -222,53 +198,6 @@
forKey: @"ShowPalettes"];
}
- (BOOL) applicationShouldTerminate: (NSApplication*)sender
{
id doc;
BOOL edited = NO;
NSEnumerator *enumerator = [documents objectEnumerator];
if (isTesting == YES)
{
[self endTesting: sender];
return NO;
}
while (( doc = [enumerator nextObject] ) != nil )
{
if ([[doc window] isDocumentEdited] == YES)
{
edited = YES;
break;
}
}
if (edited == YES)
{
int result;
result = NSRunAlertPanel(_(@"Quit"),
_(@"There are edited windows"),
_(@"Review Unsaved"),
_( @"Quit Anyway"),
_(@"Cancel"));
if (result == NSAlertDefaultReturn)
{
enumerator = [ documents objectEnumerator];
while ((doc = [enumerator nextObject]) != nil)
{
if ( [[doc window] isDocumentEdited] == YES)
{
if ( ! [doc couldCloseDocument] )
return NO;
}
}
}
else if (result == NSAlertOtherReturn)
return NO;
}
return YES;
}
- (GormClassManager*) classManager
{
id document = [self activeDocument];
@ -420,7 +349,6 @@
}
/** Info Menu Actions */
- (void) preferencesPanel: (id) sender
{
if(! preferencesController)
@ -432,100 +360,13 @@
}
/** Document Menu Actions */
- (void) open: (id) sender
{
GormDocument *doc = AUTORELEASE([[GormDocument alloc] init]);
[documents addObject: doc];
if ([doc openDocument: sender] == nil)
{
[doc closeAllEditors];
[documents removeObjectIdenticalTo: doc];
doc = nil;
}
else
{
[[doc window] makeKeyAndOrderFront: self];
}
}
- (void) newGormDocument : (id) sender
{
id doc = AUTORELEASE([[GormDocument alloc] init]);
[documents addObject: doc];
switch ([sender tag])
{
case 0:
[doc setupDefaults: @"Application"];
break;
case 1:
[doc setupDefaults: @"Empty"];
break;
case 2:
[doc setupDefaults: @"Inspector"];
break;
case 3:
[doc setupDefaults: @"Palette"];
break;
default:
printf("unknow newGormDocument tag");
}
if (NSEqualPoints(cascadePoint, NSZeroPoint))
{
NSRect frame = [[doc window] frame];
cascadePoint = NSMakePoint(frame.origin.x, NSMaxY(frame));
}
cascadePoint = [[doc window] cascadeTopLeftFromPoint:cascadePoint];
[[doc window] makeKeyAndOrderFront: self];
}
- (void) save: (id)sender
{
[(GormDocument *)[self activeDocument] saveGormDocument: sender];
}
- (void) saveAs: (id)sender
{
[(GormDocument *)[self activeDocument] saveAsDocument: sender];
}
- (void) saveAll: (id)sender
{
NSEnumerator *enumerator = [documents objectEnumerator];
id doc;
while ((doc = [enumerator nextObject]) != nil)
{
if ([[doc window] isDocumentEdited] == YES)
{
if (! [doc saveGormDocument: sender] )
NSLog(@"can not save %@",doc);
}
}
}
- (void) revertToSaved: (id)sender
{
id doc = [(GormDocument *)[self activeDocument] revertDocument: sender];
if (doc != nil)
{
[documents addObject: doc];
// RELEASE(doc);
[[doc window] makeKeyAndOrderFront: self];
}
}
- (void) close: (id)sender
{
GormDocument *document = (GormDocument *)[self activeDocument];
NSWindow *window = [document window];
[window performClose: self];
if([document canCloseDocument])
{
[document close];
}
}
- (void) debug: (id) sender
@ -610,7 +451,7 @@
// do not allow custom classes during testing.
[GSClassSwapper setIsInInterfaceBuilder: YES];
[archiver encodeRootObject: activeDoc];
[archiver encodeRootObject: [activeDoc container]];
data = RETAIN([archiver archiverData]); // Released below...
[activeDoc endArchiving];
RELEASE(archiver);
@ -1094,6 +935,7 @@
return nil;
}
/*
- (BOOL)application:(NSApplication *)application openFile:(NSString *)fileName
{
NSString *ext = [fileName pathExtension];
@ -1116,6 +958,7 @@
return (doc != nil);
}
*/
- (GormPalettesManager*) palettesManager
{
@ -1186,28 +1029,6 @@
connectDestination = nil;
}
- (void) arrangeSelectedObjects: (id)sender
{
[[self activeDocument] performSelector: @selector(arrangeSelectedObjects:)
withObject: sender];
}
- (void) alignSelectedObjects: (id)sender
{
[[self activeDocument] performSelector: @selector(alignSelectedObjects:)
withObject: sender];
}
- (void) translate: (id)sender
{
[[self activeDocument] performSelector: @selector(translate)];
}
- (void) exportStrings: (id)sender
{
[[self activeDocument] performSelector: @selector(exportStrings)];
}
- (BOOL) validateMenuItem: (NSMenuItem*)item
{
GormDocument *active = (GormDocument*)[self activeDocument];
@ -1223,45 +1044,16 @@
}
if (sel_eq(action, @selector(close:))
|| sel_eq(action, @selector(miniaturize:))
|| sel_eq(action, @selector(save:))
|| sel_eq(action, @selector(saveAs:))
|| sel_eq(action, @selector(saveAll:)))
|| sel_eq(action, @selector(miniaturize:)))
{
if (active == nil)
return NO;
}
else if (sel_eq(action, @selector(revertToSaved:)))
{
if (active == nil || [active documentPath] == nil
|| [[active window] isDocumentEdited] == NO)
return NO;
}
else if (sel_eq(action, @selector(testInterface:)))
{
if (active == nil)
return NO;
}
else if (sel_eq(action, @selector(translate:)))
{
if (active == nil)
return NO;
}
else if (sel_eq(action, @selector(arrangeSelectedObjects:)))
{
if (active == nil)
return NO;
}
else if (sel_eq(action, @selector(alignSelectedObjects:)))
{
if (active == nil)
return NO;
}
else if (sel_eq(action, @selector(exportStrings:)))
{
if (active == nil)
return NO;
}
else if (sel_eq(action, @selector(copy:)))
{
if ([s count] == 0)
@ -1412,9 +1204,6 @@
{
return NO;
}
// if([name isEqual: @"FirstResponder"])
// return NO;
}
if(sel_eq(action, @selector(instantiateClass:)))

View file

@ -547,12 +547,14 @@ static BOOL gormFileOwnerDecoded;
}
else
{
NSString *className = (dest == nil)?(NSString *)@"FirstResponder":(NSString *)[dest className];
newcon = AUTORELEASE([[NSNibControlConnector alloc] init]);
if(![classManager isAction: [con label]
ofClass: (dest == nil)?@"FirstResponder":[dest className]])
ofClass: className])
{
[classManager addAction: [con label]
forClassNamed: (dest == nil)?@"FirstResponder":[dest className]];
forClassNamed: className];
}
}
@ -561,11 +563,11 @@ static BOOL gormFileOwnerDecoded;
[newcon setSource: source];
[newcon setDestination: (dest != nil)?dest:[self firstResponder]];
[newcon setLabel: [con label]];
[connections addObject: newcon];
[[container connections] addObject: newcon];
}
// make sure that all of the actions on the application's delegate object are also added to FirstResponder.
enumerator = [connections objectEnumerator];
enumerator = [[container connections] objectEnumerator];
while ((con = [enumerator nextObject]) != nil)
{
if([con isKindOfClass: [NSNibControlConnector class]])

View file

@ -48,6 +48,7 @@ GormCore_HEADER_FILES = \
GormCustomClassInspector.h \
GormCustomView.h \
GormDocument.h \
GormDocumentController.h \
GormFilePrefsManager.h \
GormFilesOwner.h \
GormFontViewController.h \
@ -102,6 +103,7 @@ GormCore_OBJC_FILES = \
GormCustomClassInspector.m \
GormCustomView.m \
GormDocument.m \
GormDocumentController.m \
GormFilePrefsManager.m \
GormFilesOwner.m \
GormFontViewController.m \

View file

@ -124,8 +124,11 @@
/* Loading and saving */
- (BOOL) saveToFile: (NSString *)path;
- (NSData *) data;
- (BOOL) loadFromFile: (NSString *)path;
- (BOOL) loadCustomClasses: (NSString *)path;
- (BOOL) loadCustomClassesWithData: (NSData *)data;
- (BOOL) loadCustomClassesWithDict: (NSDictionary *)dict;
@end
#endif

View file

@ -1161,12 +1161,13 @@
return [dictForClass objectForKey: @"Super"];
}
- (BOOL) saveToFile: (NSString *)path
- (NSData *) data
{
NSMutableDictionary *ci;
NSEnumerator *enumerator;
id key;
NSMutableDictionary *ci = nil;
NSEnumerator *enumerator = nil;
id key = nil;
NSString *result = nil;
// save all custom classes....
ci = AUTORELEASE([[NSMutableDictionary alloc] initWithCapacity: 0]);
enumerator = [customClasses objectEnumerator];
@ -1254,12 +1255,15 @@
[ci setObject: @"Do NOT change this file, Gorm maintains it"
forKey: @"## Comment"];
/*
[ci setObject: [NSNumber numberWithInt: [[ci description] hash]]
forKey: @"hashValue"];
*/
result = [ci description];
return [ci writeToFile: path atomically: YES];
return [NSData dataWithBytes: [result cString]
length: [result cStringLength]];
}
- (BOOL) saveToFile: (NSString *)path
{
return [[self data] writeToFile: path atomically: YES];
}
- (BOOL) loadFromFile: (NSString *)path
@ -1327,15 +1331,13 @@
return YES;
}
// this method will load the custom classes and merge them with the
// Class information loaded at initialization time.
- (BOOL) loadCustomClasses: (NSString *)path
{
NSMutableDictionary *dict;
NSEnumerator *en;
id key;
// int hash;
// int hashDict;
NSDebugLog(@"Load custom classes from file %@",path);
@ -1351,18 +1353,21 @@
NSLog(@"Default classes file not loaded");
return NO;
}
return [self loadCustomClassesWithDict: dict];
}
/*
// Hash value to prevent tampering. This value stops someone from
// being able to manually modify the file.
hash = [[dict objectForKey: @"hashValue"] intValue];
[dict removeObjectForKey: @"hashValue"];
hashDict = [[dict description] hash];
if(hash != hashDict && hash != 0)
{
NSLog(@"WARNING: The data.classes file has been tampered with");
}
*/
- (BOOL) loadCustomClassesWithData: (NSData *)data
{
NSString *dictString = AUTORELEASE([[NSString alloc] initWithData: data encoding: NSUTF8StringEncoding]);
NSDictionary *dict = [dictString propertyList];
return [self loadCustomClassesWithDict: dict];
}
- (BOOL) loadCustomClassesWithDict: (NSDictionary *)dict
{
NSEnumerator *en = nil;
id key = nil;
// Iterate over the set of classes, if it's in the classInformation
// list, it's a category, if it's not it's a custom class.

View file

@ -42,13 +42,12 @@
}
@end
@interface GormDocument : GSNibContainer <IBDocuments>
@interface GormDocument : NSDocument <IBDocuments>
{
GormClassManager *classManager;
GormFilesOwner *filesOwner;
GormFirstResponder *firstResponder;
GormObjectProxy *fontManager;
NSString *documentPath;
NSMapTable *objToName;
NSWindow *window;
NSBox *selectionBox;
@ -60,7 +59,6 @@
id objectsView;
id soundsView;
id imagesView;
BOOL hasSetDefaults;
BOOL isActive;
BOOL isDocumentOpen;
NSMenu *savedMenu;
@ -75,13 +73,13 @@
id filePrefsManager;
NSWindow *filePrefsWindow;
NSMutableArray *resourceManagers;
NSData *infoData; /* data.info contents */
NSMutableArray *images; /* temporary storage for images. */
NSMutableArray *sounds; /* temporary storage for sounds. */
NSFileWrapper *scmDirWrapper;
id<GSNibContainer> container;
}
/**
* Return the types readable by this document class
*/
+ (NSArray *) readableTypes;
/* Archiving objects */
/**
@ -121,49 +119,12 @@
*/
- (BOOL) objectIsDeferred: (id)anObject;
/**
* This assumes we have an empty document to start with - the loaded
* document is merged in to it.
*/
- (id) loadDocument: (NSString*)path;
/**
* This assumes we have an empty document to start with - the loaded
* document is merged in to it.
*/
- (id) openDocument: (id)sender;
/**
* Retrieve all objects which have parent as thier parent. If flag is YES,
* then retrieve the entire graph of objects starting with the parent.
*/
- (NSArray *) retrieveObjectsForParent: (id)parent recursively: (BOOL)flag;
/**
* To revert to a saved version, we actually load a new document and
* close the original document, returning the id of the new document.
*/
- (id) revertDocument: (id)sender;
/**
* Save the document. If this is called when documentPath is nil,
* then saveGormDocument: will call it to define the path.
*/
- (BOOL) saveAsDocument: (id)sender;
/**
* Archives the .gorm file. Creates the directory and all of the
* contents using the archiver and other class manager.
*/
- (BOOL) saveGormDocument: (id)sender;
/**
* Creates a blank document depending on the value of type.
* If type is "Application", "Inspector" or "Palette" it creates
* an appropriate blank document for the user to start with.
*/
- (void) setupDefaults: (NSString*)type;
/**
* Marks this document as the currently active document. The active document is
* the one being edited by the user.
@ -186,14 +147,9 @@
- (NSWindow*) window;
/**
* Determine if the document should be closed or not.
* Return the container object associated with this document.
*/
- (BOOL) couldCloseDocument;
/**
* Called when the document window close is selected.
*/
- (BOOL) windowShouldClose: (id)sender;
- (id<GSNibContainer>) container;
/**
* Returns YES, if obj is a top level object.
@ -240,8 +196,8 @@
- (NSArray *) allManagedPboardTypes;
/* Language translation */
- (void) translate;
- (void) exportStrings;
- (void) translate: (id)sender;
- (void) exportStrings: (id)sender;
/* Managing classes */
- (GormClassManager*) classManager;
@ -348,32 +304,36 @@
*/
- (void) alignSelectedObjects: (id)sender;
/*
* windowAndRect:forObject: is called by Gorm to determine where it should
/**
* WindowAndRect:forObject: is called by Gorm to determine where it should
* draw selection markup
*/
- (NSWindow*) windowAndRect: (NSRect*)r forObject: (id)object;
/**
* The container class to use in editing....
*/
- (Class) containerClass;
@end
@interface GormDocument (MenuValidation)
/**
* Returns TRUE if the document is editing instance/objects.
* Returns YES if the document is editing instance/objects.
*/
- (BOOL) isEditingObjects;
/**
* Returns TRUE if the document is editing images.
* Returns YES if the document is editing images.
*/
- (BOOL) isEditingImages;
/**
* Returns TRUE if the document is editing sounds.
* Returns YES if the document is editing sounds.
*/
- (BOOL) isEditingSounds;
/**
* Returns TRUE if the document is editing classes.
* Returns YES if the document is editing classes.
*/
- (BOOL) isEditingClasses;
@end

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,47 @@
/* GormDocumentController.m
*
* This class contains Gorm specific implementation of the IBDocuments
* protocol plus additional methods which are useful for managing the
* contents of the document.
*
* Copyright (C) 2006 Free Software Foundation, Inc.
*
* Author: Gregory John Casamento <greg_casamento@yahoo.com>
* Date: 2006
*
* 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., 51 Franklin Street, Fifth Floor, Boston, MA 02111 USA.
*/
#ifndef INCLUDED_GormDocumentController_h
#define INCLUDED_GormDocumentController_h
#include <AppKit/NSDocumentController.h>
typedef enum {
GormApplication = 0,
GormEmpty = 1,
GormInspector = 2,
GormPalette = 3
} GormDocumentType;
@interface GormDocumentController : NSDocumentController
{
// GormDocumentType _documentType;
}
@end
#endif

View file

@ -0,0 +1,192 @@
/* GormDocumentController.m
*
* This class is a subclass of the NSDocumentController
*
* Copyright (C) 2006 Free Software Foundation, Inc.
*
* Author: Gregory John Casamento <greg_casamento@yahoo.com>
* Date: 2006
*
* 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., 51 Franklin Street, Fifth Floor, Boston, MA 02111 USA.
*/
#include "GormPrivate.h"
#include <GormCore/GormDocument.h>
#include <GormCore/GormDocumentController.h>
@implementation GormDocumentController
- (id) currentDocument
{
NSArray *documents = [self documents];
unsigned i = [documents count];
id result = nil;
if (i > 0)
{
while (i-- > 0)
{
id doc = [documents objectAtIndex: i];
if ([doc isActive] == YES)
{
result = doc;
break;
}
}
}
return result;
}
- (void) newDocument: (id)sender
{
GormDocument *doc = nil;
GormDocumentType documentType = (GormDocumentType)[sender tag];
NSDebugLog(@"In gorm document controller...");
[super newDocument: sender];
doc = (GormDocument *)[[self documents] lastObject]; // get the latest document...
switch (documentType)
{
case GormApplication:
{
NSMenu *aMenu;
NSWindow *aWindow;
NSRect frame = [[NSScreen mainScreen] frame];
unsigned style = NSTitledWindowMask | NSClosableWindowMask
| NSResizableWindowMask | NSMiniaturizableWindowMask;
if ([NSMenu respondsToSelector: @selector(allocSubstitute)])
{
aMenu = [[NSMenu allocSubstitute] init];
}
else
{
aMenu = [[NSMenu alloc] init];
}
if ([NSWindow respondsToSelector: @selector(allocSubstitute)])
{
aWindow = [[NSWindow allocSubstitute]
initWithContentRect: NSMakeRect(0,0,600, 400)
styleMask: style
backing: NSBackingStoreRetained
defer: NO];
}
else
{
aWindow = [[NSWindow alloc]
initWithContentRect: NSMakeRect(0,0,600, 400)
styleMask: style
backing: NSBackingStoreRetained
defer: NO];
}
[aWindow setFrameTopLeftPoint:
NSMakePoint(220, frame.size.height-100)];
[aWindow setTitle: _(@"My Window")];
[doc setName: @"My Window" forObject: aWindow];
[doc attachObject: aWindow toParent: nil];
[doc setObject: aWindow isVisibleAtLaunch: YES];
[aMenu setTitle: _(@"Main Menu")];
[aMenu addItemWithTitle: _(@"Hide")
action: @selector(hide:)
keyEquivalent: @"h"];
[aMenu addItemWithTitle: _(@"Quit")
action: @selector(terminate:)
keyEquivalent: @"q"];
// the first menu attached becomes the main menu.
[doc attachObject: aMenu toParent: nil];
}
break;
case GormInspector:
{
NSPanel *aWindow;
NSRect frame = [[NSScreen mainScreen] frame];
unsigned style = NSTitledWindowMask | NSClosableWindowMask;
if ([NSPanel respondsToSelector: @selector(allocSubstitute)])
{
aWindow = [[NSPanel allocSubstitute]
initWithContentRect: NSMakeRect(0,0, IVW, IVH)
styleMask: style
backing: NSBackingStoreRetained
defer: NO];
}
else
{
aWindow = [[NSPanel alloc]
initWithContentRect: NSMakeRect(0,0, IVW, IVH)
styleMask: style
backing: NSBackingStoreRetained
defer: NO];
}
[aWindow setFrameTopLeftPoint:
NSMakePoint(220, frame.size.height-100)];
[aWindow setTitle: _(@"Inspector Window")];
[doc setName: @"InspectorWin" forObject: aWindow];
[doc attachObject: aWindow toParent: nil];
}
break;
case GormPalette:
{
NSPanel *aWindow;
NSRect frame = [[NSScreen mainScreen] frame];
unsigned style = NSTitledWindowMask | NSClosableWindowMask;
if ([NSPanel respondsToSelector: @selector(allocSubstitute)])
{
aWindow = [[NSPanel allocSubstitute]
initWithContentRect: NSMakeRect(0,0,272,160)
styleMask: style
backing: NSBackingStoreRetained
defer: NO];
}
else
{
aWindow = [[NSPanel alloc]
initWithContentRect: NSMakeRect(0,0,272,160)
styleMask: style
backing: NSBackingStoreRetained
defer: NO];
}
[aWindow setFrameTopLeftPoint:
NSMakePoint(220, frame.size.height-100)];
[aWindow setTitle: _(@"Palette Window")];
[doc setName: @"PaletteWin" forObject: aWindow];
[doc attachObject: aWindow toParent: nil];
}
break;
case GormEmpty:
{
// nothing to do...
}
break;
default:
{
NSLog(@"Unknown document type...");
}
}
// [doc touch];
}
@end

View file

@ -35,11 +35,21 @@
*/
- (void) selectArchiveType: (id)sender;
/**
* Loads the encoded file info.
*/
- (BOOL) loadFromData: (NSData *)data;
/**
* Loads the encoded file info.
*/
- (BOOL) loadFromFile: (NSString *)path;
/**
* Saves the encoded file info.
*/
- (NSData *) data;
/**
* Saves the encoded file info.
*/

View file

@ -83,7 +83,7 @@ NSString *formatVersion(int version)
+ (int) currentVersion
{
return appVersion(1,0,9);
return appVersion(1,1,0);
}
- (void) awakeFromNib
@ -160,13 +160,19 @@ NSString *formatVersion(int version)
// Loading and saving the file.
- (BOOL) saveToFile: (NSString *)path
{
return [[self data] writeToFile: path atomically: YES];
}
// Loading and saving the file.
- (NSData *) data
{
// upon saving, update to the latest.
version = [GormFilePrefsManager currentVersion];
[gormAppVersion setStringValue: formatVersion(version)];
// save.
return [NSArchiver archiveRootObject: self toFile: path];
// return the data...
return [NSArchiver archivedDataWithRootObject: self];
}
- (int) versionOfClass: (NSString *)className
@ -188,33 +194,33 @@ NSString *formatVersion(int version)
}
- (BOOL) loadFromFile: (NSString *)path
{
return [self loadFromData: [NSData dataWithContentsOfFile: path]];
}
- (BOOL) loadFromData: (NSData *)data
{
BOOL result = YES;
NSFileManager *mgr = [NSFileManager defaultManager];
// read/load the file...
if([mgr isReadableFileAtPath: path])
NS_DURING
{
NS_DURING
{
id object = [NSUnarchiver unarchiveObjectWithFile: path];
[gormAppVersion setStringValue: formatVersion([object version])];
version = [object version];
[targetVersion selectItemWithTitle: [object targetVersionName]];
ASSIGN(targetVersionName,[object targetVersionName]);
[archiveType selectItemWithTitle: [object archiveTypeName]];
ASSIGN(archiveTypeName, [object archiveTypeName]);
[self selectTargetVersion: targetVersion];
result = YES;
}
NS_HANDLER
{
NSLog(@"Problem loading info file: %@",[localException reason]);
result = NO;
}
NS_ENDHANDLER
id object = [NSUnarchiver unarchiveObjectWithData: data];
[gormAppVersion setStringValue: formatVersion([object version])];
version = [object version];
[targetVersion selectItemWithTitle: [object targetVersionName]];
ASSIGN(targetVersionName,[object targetVersionName]);
[archiveType selectItemWithTitle: [object archiveTypeName]];
ASSIGN(archiveTypeName, [object archiveTypeName]);
[self selectTargetVersion: targetVersion];
result = YES;
}
NS_HANDLER
{
NSLog(@"Problem loading info file: %@",[localException reason]);
result = NO;
}
NS_ENDHANDLER;
return result;
}

View file

@ -37,6 +37,7 @@
- (void) dealloc
{
RELEASE(className);
[super dealloc];
}
- (NSImage*) imageForViewer

View file

@ -50,6 +50,12 @@
*/
+ (GormImage *) imageForPath: (NSString *)path inWrapper: (BOOL)flag;
/**
* Initialize with image data. Mark it as in the
* wrapper depending on the value of flag.
*/
+ (GormImage*)imageForData: (NSData *)aData withFileName: (NSString *)aName inWrapper: (BOOL)flag;
/**
* A thumbnail of the image.
*/

View file

@ -51,18 +51,58 @@
return AUTORELEASE([[GormImage alloc] initWithPath: aPath inWrapper: flag]);
}
- (id) initWithName: (NSString *)aName
path: (NSString *)aPath
inWrapper: (BOOL)flag
+ (GormImage*)imageForData: (NSData *)aData withFileName: (NSString *)aName inWrapper: (BOOL)flag
{
if((self = [super initWithName: aName path: aPath inWrapper: flag]) != nil)
return AUTORELEASE([[GormImage alloc] initWithData: aData withFileName: aName inWrapper: flag]);
}
- (id) initWithData: (NSData *)aData withFileName: (NSString *)aName inWrapper: (BOOL)flag
{
if((self = [super initWithData: aData withFileName: aName inWrapper: flag]))
{
NSSize originalSize;
float ratioH;
float ratioW;
image = RETAIN([[NSImage alloc] initByReferencingFile: aPath]);
smallImage = RETAIN([[NSImage alloc] initWithContentsOfFile: aPath]);
ASSIGN(image, AUTORELEASE([[NSImage alloc] initWithData: aData]));
ASSIGN(smallImage, AUTORELEASE([[NSImage alloc] initWithData: aData]));
[image setName: aName];
originalSize = [smallImage size];
ratioW = originalSize.width / 70;
ratioH = originalSize.height / 55;
if (ratioH > 1 || ratioW > 1)
{
[smallImage setScalesWhenResized: YES];
if (ratioH > ratioW)
{
[smallImage setSize: NSMakeSize(originalSize.width / ratioH, 55)];
}
else
{
[smallImage setSize: NSMakeSize(70, originalSize.height / ratioW)];
}
}
[image setArchiveByName: NO];
[smallImage setArchiveByName: NO];
}
return self;
}
- (id) initWithName: (NSString *)aName
path: (NSString *)aPath
inWrapper: (BOOL)flag
{
if((self = [super initWithName: aName path: aPath inWrapper: flag]))
{
NSSize originalSize;
float ratioH;
float ratioW;
ASSIGN(image, AUTORELEASE([[NSImage alloc] initByReferencingFile: aPath]));
ASSIGN(smallImage, AUTORELEASE([[NSImage alloc] initWithContentsOfFile: aPath]));
[image setName: aName];
if (smallImage == nil)
@ -91,10 +131,6 @@
[image setArchiveByName: NO];
[smallImage setArchiveByName: NO];
}
else
{
RELEASE(self);
}
return self;
}

View file

@ -121,9 +121,11 @@ static NSMapTable *docMap = 0;
if(closed == NO)
[self close];
// TODO: This is a band-aid fix until I find the actual problem.
// This *WILL* leak, but I don't want it crashing on people.
// It is not necessary to call super dealloc here.
// images are cached throughout the lifetime of the app.
// Once loaded, they are in the cache permanently and
// are release on app termination.
RELEASE(objects);
NSDebugLog(@"Released...");
}

View file

@ -56,14 +56,6 @@
- (GormPalettesManager*) palettesManager;
- (GormInspectorsManager*) inspectorsManager;
// file manipulation
- (void) newGormDocument: (id) sender;
- (void) open: (id)sender;
- (void) revertToSaved: (id)sender;
- (void) save: (id)sender;
- (void) saveAll: (id)sender;
- (void) saveAs: (id)sender;
// testing the interface
- (void) testInterface: (id)sender;
- (id) endTesting: (id)sender;
@ -73,8 +65,6 @@
- (void) loadImage: (id) sender;
// grouping/layout
- (void) arrangeSelectedObjects: (id)sender;
- (void) alignSelectedObjects: (id)sender;
- (void) groupSelectionInSplitView: (id)sender;
- (void) groupSelectionInBox: (id)sender;
- (void) groupSelectionInScrollView: (id)sender;
@ -82,16 +72,10 @@
// added for classes support
- (GormClassManager*) classManager;
- (void) createSubclass: (id)sender;
- (void) instantiateClass: (id)sender;
- (NSMenu*) classMenu;
// utility
- (BOOL) documentNameIsUnique: (NSString *)filename;
// language translation
- (void) translate: (id)sender;
- (void) exportStrings: (id)sender;
@end
#endif

View file

@ -33,7 +33,7 @@
#include <InterfaceBuilder/IBProjects.h>
#include <InterfaceBuilder/IBObjectAdditions.h>
@class NSString;
@class NSString, NSData;
@interface GormResource : NSObject <IBProjectFiles>
{
@ -46,6 +46,7 @@
id<IBProjects> project;
BOOL isSystemResource;
BOOL isInWrapper;
NSData *data;
}
// factory methods
@ -61,6 +62,9 @@
- (id) initWithName: (NSString *)aName
path: (NSString *)aPath
inWrapper: (BOOL)flag;
- (id) initWithData: (NSData *)aData
withFileName: (NSString *)aFileName
inWrapper: (BOOL)flag;
// instances methods
- (void) setName: (NSString *)aName;
@ -69,6 +73,8 @@
- (BOOL) isSystemResource;
- (void) setInWrapper: (BOOL)flag;
- (BOOL) isInWrapper;
- (void) setData: (NSData *)data;
- (NSData *) data;
- (BOOL) isEqual: (id)object;
@end

View file

@ -46,14 +46,26 @@
- (id) initWithPath: (NSString *)aPath inWrapper: (BOOL)flag
{
NSString *aName = [[aPath lastPathComponent] stringByDeletingPathExtension];
if((self = [self initWithName: aName path: aPath inWrapper: flag]) == nil)
return [self initWithName: aName path: aPath inWrapper: flag];
}
- (id) initWithData: (NSData *)aData withFileName: (NSString *)aFileName inWrapper: (BOOL)flag
{
if((self = [self init]))
{
RELEASE(self);
ASSIGN(path, nil);
ASSIGN(fileName, aFileName);
ASSIGN(name, [fileName stringByDeletingPathExtension]);
ASSIGN(fileType, [fileName pathExtension]);
language = nil;
isLocalized = NO;
isSystemResource = NO;
isInWrapper = flag;
project = nil;
}
return self;
}
- (id) initWithName: (NSString *)aName
path: (NSString *)aPath
{
@ -67,7 +79,7 @@
path: (NSString *)aPath
inWrapper: (BOOL)flag
{
if((self = [super init]) != nil)
if((self = [super init]))
{
ASSIGN(path, aPath);
ASSIGN(name, aName);
@ -79,11 +91,6 @@
isInWrapper = flag;
project = nil;
}
else
{
RELEASE(self);
}
return self;
}
@ -93,6 +100,7 @@
RELEASE(path);
RELEASE(fileName);
RELEASE(fileType);
RELEASE(data);
[super dealloc];
}
@ -131,6 +139,16 @@
return isInWrapper;
}
- (void) setData: (NSData *)aData
{
ASSIGN(data, aData);
}
- (NSData *) data
{
return data;
}
- (BOOL) isEqual: (id)object
{
BOOL result = NO;

View file

@ -46,6 +46,8 @@
*/
+ (GormSound*) soundForPath: (NSString *)path inWrapper: (BOOL)flag;
+ (GormSound*) soundForData: (NSData *)aData withFileName: (NSString *)aName inWrapper: (BOOL)flag;
@end
#endif

View file

@ -40,6 +40,20 @@
return AUTORELEASE([[GormSound alloc] initWithPath: aPath inWrapper: flag]);
}
+ (GormSound*)soundForData: (NSData *)aData withFileName: (NSString *)aName inWrapper: (BOOL)flag
{
return AUTORELEASE([[GormSound alloc] initWithData: aData withFileName: aName inWrapper: flag]);
}
- (id) initWithData: (NSData *)aData withFileName: (NSString *)aName inWrapper: (BOOL)flag
{
if((self = [super initWithData: aData withFileName: aName inWrapper: flag]))
{
// ASSIGN(sound, AUTORELEASE([[NSImage alloc] initWithData: aData]));
}
return self;
}
- (id) initWithName: (NSString *)aName
path: (NSString *)aPath
inWrapper: (BOOL)flag

View file

@ -879,8 +879,8 @@ int _sortViews(id view1, id view2, void *context)
isVertical: (BOOL)isVertical
{
NSMutableArray *array = [subviews mutableCopy];
NSMutableArray *result = [array sortedArrayUsingFunction: _sortViews
context: &isVertical];
NSArray *result = [array sortedArrayUsingFunction: _sortViews
context: &isVertical];
return result;
}

View file

@ -3,14 +3,18 @@
NSRole = "Editor";
NSTypes = (
{
NSName = "GSGormFileType";
NSHumanReadableName = "GNUstep Gorm";
NSRole = Editor;
NSDocumentClass = GormDocument;
NSUnixExtensions = ( "gorm" );
NSIcon = "GormFile.tiff";
},
{
NSUnixExtensions = ( "gmodel" );
NSIcon = "FileIcon_gmodel.tiff";
},
{
NSName = "GSNibFileType";
NSHumanReadableName = "Cocoa Nib";
NSRole = Editor;
NSDocumentClass = GormDocument;
NSUnixExtensions = ( "nib" );
NSIcon = "GormNib.tiff";
},
@ -22,9 +26,9 @@
ApplicationDescription = "[GNUstep | Graphical] Object Relationship Modeller";
ApplicationIcon = "Gorm.tiff";
ApplicationName = "Gorm";
ApplicationRelease = "Gorm 1.0.9 (SVN)";
ApplicationRelease = "Gorm 1.1.0 (SVN)";
Authors = ("Gregory John Casamento <greg_casamento@yahoo.com>","Richard Frith-Macdonald <rfm@gnu.org>","Pierre-Yves Rivaille <pyrivail@ens-lyon.fr>");
Copyright = "Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 FSF";
CopyrightDescription = "Released under the GNU General Public License 2.0";
NSBuildVersion = "1.0.9 May 20 2006";
NSBuildVersion = "1.1.0 Jun 4 2006";
}

View file

@ -171,7 +171,9 @@ IB_EXTERN NSString *IBWillCloseDocumentNotification;
- (id<IBEditors, IBSelectionOwners>) parentEditorForEditor: (id<IBEditors>)anEditor;
/**
* Returns the parent of the given object.
* Return the parent of anObject. The File's Owner is the root object in the
* hierarchy, if anObject's parent is the Files's Owner, this method should return
* nil.
*/
- (id) parentOfObject: (id)anObject;

View file

@ -39,15 +39,6 @@ NSString *GormImagePboardType = @"GormImagePboardType";
NSString *GormSoundPboardType = @"GormSoundPboardType";
NSString *GormLinkPboardType = @"GormLinkPboardType";
@interface IBPaletteDocument : NSObject <IBDocuments>
{
NSMutableDictionary *nameTable;
NSMutableArray *connections;
NSMutableArray *parentLinks;
NSString *documentPath;
}
@end
@implementation IBPalette
static NSMapTable *viewToObject = 0;
@ -124,8 +115,10 @@ static NSMapTable *viewToType = 0;
fileName = [bundle pathForImageResource: fileName];
if (fileName == nil)
{
NSRunAlertPanel(NULL, @"Icon for palette is missing",
@"OK", NULL, NULL);
NSRunAlertPanel(NULL,
[NSString stringWithFormat: @"Palette could not load image %@.",
fileName],
@"OK", NULL, NULL);
AUTORELEASE(self);
return nil;
}
@ -140,15 +133,15 @@ static NSMapTable *viewToType = 0;
externalNameTable: context
withZone: NSDefaultMallocZone()] == NO)
{
NSRunAlertPanel(NULL, @"Nib for palette would not load",
@"OK", NULL, NULL);
NSRunAlertPanel(NULL,
[NSString stringWithFormat: @"Palette could not load nib/gorm %@.",
fileName],
@"OK", NULL, NULL);
AUTORELEASE(self);
return nil;
}
}
paletteDocument = [[IBPaletteDocument alloc] init];
return self;
}
@ -167,308 +160,3 @@ static NSMapTable *viewToType = 0;
return paletteDocument;
}
@end
/**
* Implementation of document protocol for palette.
*/
//
// NOTE: This is a very rudimentary implementation.
//
@implementation IBPaletteDocument
- (id) initWithDocumentPath: (NSString *)docPath
{
if((self = [super init]) != nil)
{
ASSIGN(documentPath, docPath);
nameTable = [[NSMutableDictionary alloc] init];
connections = [[NSMutableArray alloc] init];
parentLinks = [[NSMutableArray alloc] init];
}
return self;
}
- (void) dealloc
{
RELEASE(documentPath);
RELEASE(nameTable);
RELEASE(connections);
RELEASE(parentLinks);
[super dealloc];
}
- (void) addConnector: (id<IBConnectors>)aConnector
{
[connections addObject: aConnector];
}
- (NSArray*) allConnectors
{
return connections;
}
- (NSString *) _uniqueObjectNameFrom: (NSString *)name
{
NSString *search = [NSString stringWithString: name];
int i = 1;
while([nameTable objectForKey: search])
{
search = [name stringByAppendingString: [NSString stringWithFormat: @"%d",i++]];
}
return search;
}
- (void) attachObject: (id)anObject toParent: (id)aParent
{
NSNibConnector *conn = [NSNibConnector init];
NSString *name = [self _uniqueObjectNameFrom: [anObject className]];
// create the relationship.
[conn setSource: aParent];
[conn setDestination: anObject];
[parentLinks addObject: conn];
[nameTable setObject: anObject forKey: name];
[connections addObject: conn];
}
- (void) attachObjects: (NSArray*)anArray toParent: (id)aParent
{
NSEnumerator *en = [anArray objectEnumerator];
id obj;
while((obj = [en nextObject]) != nil)
{
[self attachObject: obj toParent: aParent];
}
}
- (NSArray*) connectorsForDestination: (id)destination
{
return [self connectorsForDestination: destination ofClass: [NSObject class]];
}
- (NSArray*) connectorsForDestination: (id)destination
ofClass: (Class)aClass
{
NSEnumerator *en = [connections objectEnumerator];
NSMutableArray *array = [NSMutableArray array];
id obj;
while((obj = [en nextObject]) != nil)
{
id dest = [obj destination];
if(dest == destination && [obj isKindOfClass: aClass])
{
[array addObject: obj];
}
}
return array;
}
- (NSArray*) connectorsForSource: (id)source
{
return [self connectorsForSource: source ofClass: [NSObject class]];
}
- (NSArray*) connectorsForSource: (id)source
ofClass: (Class)aClass
{
NSEnumerator *en = [connections objectEnumerator];
NSMutableArray *array = [NSMutableArray array];
id obj;
while((obj = [en nextObject]) != nil)
{
id src = [obj source];
if(src == source && [obj isKindOfClass: aClass])
{
[array addObject: obj];
}
}
return array;
}
- (BOOL) containsObject: (id)anObject
{
return [[nameTable allValues] containsObject: anObject];
}
- (BOOL) containsObjectWithName: (NSString*)aName forParent: (id)parent
{
BOOL result = NO;
id obj = [nameTable objectForKey: aName];
if(obj != nil)
{
NSEnumerator *en = [parentLinks objectEnumerator];
id conn;
while((conn = [en nextObject]) != nil)
{
id dst = [conn destination];
if(dst == obj)
{
result = YES;
break;
}
}
}
return result;
}
- (BOOL) copyObject: (id)anObject
type: (NSString*)aType
toPasteboard: (NSPasteboard*)aPasteboard
{
return NO;
}
- (BOOL) copyObjects: (NSArray*)anArray
type: (NSString*)aType
toPasteboard: (NSPasteboard*)aPasteboard
{
return NO;
}
- (void) detachObject: (id)anObject
{
NSString *name = [self nameForObject: anObject];
[nameTable removeObjectForKey: name];
}
- (void) detachObjects: (NSArray*)anArray
{
NSEnumerator *en = [anArray objectEnumerator];
id obj;
while((obj = [en nextObject]) != nil)
{
[self detachObject: obj];
}
}
- (NSString*) documentPath
{
return documentPath;
}
- (void) editor: (id<IBEditors>)anEditor didCloseForObject: (id)anObject
{
// does nothing...
}
- (id<IBEditors>) editorForObject: (id)anObject
create: (BOOL)flag
{
// does nothing...
return nil;
}
- (id<IBEditors>) editorForObject: (id)anObject
inEditor: (id<IBEditors>)anEditor
create: (BOOL)flag
{
// does nothing...
return nil;
}
- (NSString*) nameForObject: (id)anObject
{
NSEnumerator *en = [nameTable keyEnumerator];
NSString *key;
while((key = [en nextObject]) != nil)
{
if(anObject == [nameTable objectForKey: key])
{
break;
}
}
return key;
}
- (id) objectForName: (NSString*)aName
{
return [nameTable objectForKey: aName];
}
- (NSArray*) objects
{
return [NSArray arrayWithArray: [nameTable allValues]];
}
- (id<IBEditors>) openEditorForObject: (id)anObject
{
return nil;
}
- (id<IBEditors, IBSelectionOwners>) parentEditorForEditor: (id<IBEditors>)anEditor
{
return nil;
}
- (id) parentOfObject: (id)anObject
{
NSEnumerator *en = [parentLinks objectEnumerator];
id conn;
id result;
while((conn = [en nextObject]) != nil)
{
id dst = [conn destination];
if(dst == anObject)
{
result = [conn source];
break;
}
}
return result;
}
- (NSArray*) pasteType: (NSString*)aType
fromPasteboard: (NSPasteboard*)aPasteboard
parent: (id)parent
{
return nil;
}
- (void) removeConnector: (id<IBConnectors>)aConnector
{
[connections removeObjectIdenticalTo: aConnector];
}
- (void) resignSelectionForEditor: (id<IBEditors>)editor
{
// does nothing...
}
- (void) setName: (NSString*)aName forObject: (id)object
{
id obj = [nameTable objectForKey: aName];
RETAIN(obj);
[nameTable removeObjectForKey: aName];
[nameTable setObject: object forKey: aName];
RELEASE(obj);
}
- (void) setSelectionFromEditor: (id<IBEditors>)anEditor
{
// does nothing...
}
- (void) touch
{
// does nothing...
}
@end

View file

@ -34,7 +34,7 @@
@implementation GormNSMenuWindow
- (BOOL)canBecomeMainWindow
{
return YES;
return NO;
}
- (BOOL)canBecomeKeyWindow
{

View file

@ -155,4 +155,13 @@ static unsigned int defaultStyleMask = NSTitledWindowMask | NSClosableWindowMask
{
// do nothing...
}
/*
- (void) release
{
NSLog(@"Someone is releasing %@",self);
[super release];
}
*/
@end

View file

@ -3,13 +3,13 @@
# Compatible with Bourne shell syntax, so it can included there too.
# The gcc version required to compile the library.
GNUSTEP_GCC=2.95.0
GNUSTEP_GCC=3.1.0
# GNUstep version required
GNUSTEP_CORE_VERSION=0.10.0
GNUSTEP_CORE_VERSION=0.10.4
# The version number of this release.
MAJOR_VERSION=1
MINOR_VERSION=0
SUBMINOR_VERSION=8
MINOR_VERSION=1
SUBMINOR_VERSION=0
VERSION=${MAJOR_VERSION}.${MINOR_VERSION}.${SUBMINOR_VERSION}