mirror of
https://github.com/gnustep/apps-gorm.git
synced 2025-04-22 22:20:44 +00:00
Changes to support cut/copy/paste for classes in Gorm.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/apps/gorm/trunk@20449 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
b0287361d7
commit
b2cdaedc13
6 changed files with 219 additions and 135 deletions
15
ChangeLog
15
ChangeLog
|
@ -1,3 +1,18 @@
|
|||
2004-12-14 06:04 Gregory John Casamento <greg_casamento@yahoo.com>
|
||||
|
||||
* GormClassEditor.m: Added code in -deleteSelection to copy the
|
||||
selection, if it's a class, added code in copySelection and
|
||||
pasteInSelection to handle copy/paste.
|
||||
* GormClassManager.h: Made variable names conform a little more to
|
||||
standard practice. Also changed the declarations of "NSArray*" to
|
||||
"NSArray *".
|
||||
* GormClassManager.m: Corrected addClass:withSuperClassNamed:actions:
|
||||
outlets: to eliminate duplicate actions, outlets from the class being
|
||||
added if they exist on the superclass.
|
||||
* Gorm.m: Changed coercion to id<IBSelectionEditors,IBEditors) in
|
||||
the methods which handle copy, paste, delete, etc.
|
||||
* TODO: Added more items scheduled for 1.0 release.
|
||||
|
||||
2004-12-12 20:55 Gregory John Casamento <greg_casamento@yahoo.com>
|
||||
|
||||
* GormDocument.h: Added declaration for windowAndRect:forObject:
|
||||
|
|
10
Gorm.m
10
Gorm.m
|
@ -821,7 +821,7 @@ static NSImage *testingImage = nil;
|
|||
|| [selectionOwner respondsToSelector: @selector(copySelection)] == NO)
|
||||
return;
|
||||
|
||||
[(GormGenericEditor *)selectionOwner copySelection];
|
||||
[(id<IBSelectionOwners,IBEditors>)selectionOwner copySelection];
|
||||
}
|
||||
|
||||
|
||||
|
@ -831,8 +831,8 @@ static NSImage *testingImage = nil;
|
|||
|| [selectionOwner respondsToSelector: @selector(copySelection)] == NO
|
||||
|| [selectionOwner respondsToSelector: @selector(deleteSelection)] == NO)
|
||||
return;
|
||||
[(GormGenericEditor *)selectionOwner copySelection];
|
||||
[(GormGenericEditor *)selectionOwner deleteSelection];
|
||||
[(id<IBSelectionOwners,IBEditors>)selectionOwner copySelection];
|
||||
[(id<IBSelectionOwners,IBEditors>)selectionOwner deleteSelection];
|
||||
}
|
||||
|
||||
- (void) paste: (id)sender
|
||||
|
@ -840,7 +840,7 @@ static NSImage *testingImage = nil;
|
|||
if ([selectionOwner respondsToSelector: @selector(pasteInSelection)] == NO)
|
||||
return;
|
||||
|
||||
[(GormGenericEditor *)selectionOwner pasteInSelection];
|
||||
[(id<IBSelectionOwners,IBEditors>)selectionOwner pasteInSelection];
|
||||
}
|
||||
|
||||
|
||||
|
@ -849,7 +849,7 @@ static NSImage *testingImage = nil;
|
|||
if ([[selectionOwner selection] count] == 0
|
||||
|| [selectionOwner respondsToSelector: @selector(deleteSelection)] == NO)
|
||||
return;
|
||||
[(GormGenericEditor *)selectionOwner deleteSelection];
|
||||
[(id<IBSelectionOwners,IBEditors>)selectionOwner deleteSelection];
|
||||
}
|
||||
|
||||
- (void) selectAllItems: (id)sender
|
||||
|
|
|
@ -27,6 +27,8 @@
|
|||
#include "GormClassManager.h"
|
||||
#include <AppKit/NSPasteboard.h>
|
||||
|
||||
NSString *GormClassPboardType = @"GormClassPboardType";
|
||||
|
||||
@implementation GormClassEditor
|
||||
|
||||
- (GormClassEditor*) initWithDocument: (GormDocument*)doc
|
||||
|
@ -98,7 +100,9 @@
|
|||
|
||||
- (void) dealloc
|
||||
{
|
||||
RELEASE(selectedClass);
|
||||
// selectedClass is one of the items in the items in the outlineView.
|
||||
// it will be deallocated there.
|
||||
// RELEASE(selectedClass);
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
|
@ -351,6 +355,7 @@
|
|||
BOOL removed = [document removeConnectionsForClassNamed: anitem];
|
||||
if (removed)
|
||||
{
|
||||
[self copySelection];
|
||||
[classManager removeClassNamed: anitem];
|
||||
[self reloadData];
|
||||
[nc postNotificationName: GormDidModifyClassNotification
|
||||
|
@ -371,7 +376,48 @@
|
|||
|
||||
- (void) copySelection
|
||||
{
|
||||
// does nothing.
|
||||
NSPasteboard *pb = [NSPasteboard generalPasteboard];
|
||||
NSMutableDictionary *dict =
|
||||
[NSMutableDictionary dictionaryWithObjectsAndKeys: [classManager dictionaryForClassNamed: selectedClass],
|
||||
selectedClass, nil];
|
||||
id classPlist = [[dict description] propertyList];
|
||||
|
||||
if(classPlist != nil)
|
||||
{
|
||||
[pb declareTypes: [NSArray arrayWithObject: GormClassPboardType] owner: self];
|
||||
[pb setPropertyList: classPlist forType: GormClassPboardType];
|
||||
}
|
||||
}
|
||||
|
||||
- (void) pasteInSelection
|
||||
{
|
||||
NSPasteboard *pb = [NSPasteboard generalPasteboard];
|
||||
NSArray *types = [pb types];
|
||||
|
||||
if([types containsObject: GormClassPboardType])
|
||||
{
|
||||
id classPlist = [pb propertyListForType: GormClassPboardType];
|
||||
NSDictionary *classesDict = [NSDictionary dictionaryWithDictionary: classPlist];
|
||||
id name = nil;
|
||||
NSEnumerator *en = [classesDict keyEnumerator];
|
||||
|
||||
while((name = [en nextObject]) != nil)
|
||||
{
|
||||
NSDictionary *classDict = [classesDict objectForKey: name];
|
||||
NSString *className = [classManager uniqueClassNameFrom: name];
|
||||
BOOL added = [classManager addClassNamed: className
|
||||
withSuperClassNamed: selectedClass
|
||||
withActions: [classDict objectForKey: @"Actions"]
|
||||
withOutlets: [classDict objectForKey: @"Outlets"]];
|
||||
if(!added)
|
||||
{
|
||||
NSString *message = [NSString stringWithFormat: @"Addition of %@ with superclass %@ failed.", className,
|
||||
selectedClass];
|
||||
NSRunAlertPanel(_(@"Problem pasting class"),
|
||||
message, nil, nil, nil);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@end
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
#ifndef INCLUDED_GormClassManager_h
|
||||
#define INCLUDED_GormClassManager_h
|
||||
|
||||
// the custom classes and category arrays will hold only those things which
|
||||
// The custom classes and category arrays will hold only those things which
|
||||
// will be persisted to the .classes file. Since the overall list of classes will
|
||||
// not change it seems that the only thing that we should save is the "delta"
|
||||
// that being the custom classes. Once loaded they can be "merged" in with the
|
||||
|
@ -44,59 +44,57 @@
|
|||
|
||||
- (id) initWithDocument: (id)aDocument;
|
||||
|
||||
/** Managing actions and outlets */
|
||||
- (void) addAction: (NSString*)anAction forObject: (id)anObject;
|
||||
- (void) addOutlet: (NSString*)anOutlet forObject: (id)anObject;
|
||||
- (NSArray*) allActionsForClassNamed: (NSString*)className;
|
||||
- (NSArray*) allActionsForObject: (id)anObject;
|
||||
- (NSArray*) extraActionsForObject: (id)anObject;
|
||||
- (NSArray*) allOutletsForClassNamed: (NSString*)className;
|
||||
- (NSArray*) allOutletsForObject: (id)anObject;
|
||||
- (NSArray*) extraOutletsForObject: (id)anObject;
|
||||
- (NSArray*) allClassNames;
|
||||
- (void) removeAction: (NSString*)anAction forObject: (id)anObject;
|
||||
- (void) removeOutlet: (NSString*)anOutlet forObject: (id)anObject;
|
||||
- (void) removeAction: (NSString*)anAction fromClassNamed: (NSString*)anObject;
|
||||
- (void) removeOutlet: (NSString*)anOutlet fromClassNamed: (NSString*)anObject;
|
||||
/* Managing actions and outlets */
|
||||
- (void) addAction: (NSString *)anAction forObject: (id)anObject;
|
||||
- (void) addOutlet: (NSString *)anOutlet forObject: (id)anObject;
|
||||
- (NSArray *) allActionsForClassNamed: (NSString *)className;
|
||||
- (NSArray *) allActionsForObject: (id)anObject;
|
||||
- (NSArray *) extraActionsForObject: (id)anObject;
|
||||
- (NSArray *) allOutletsForClassNamed: (NSString *)className;
|
||||
- (NSArray *) allOutletsForObject: (id)anObject;
|
||||
- (NSArray *) extraOutletsForObject: (id)anObject;
|
||||
- (NSArray *) allClassNames;
|
||||
- (void) removeAction: (NSString *)anAction forObject: (id)anObject;
|
||||
- (void) removeOutlet: (NSString *)anOutlet forObject: (id)anObject;
|
||||
- (void) removeAction: (NSString *)anAction fromClassNamed: (NSString *)anObject;
|
||||
- (void) removeOutlet: (NSString *)anOutlet fromClassNamed: (NSString *)anObject;
|
||||
- (void) addOutlet: (NSString *)anOutlet forClassNamed: (NSString *)className;
|
||||
- (void) addAction: (NSString *)anAction forClassNamed: (NSString *)className;
|
||||
- (void) addActions: (NSArray *)actions forClassNamed: (NSString *)className;
|
||||
- (void) addOutlets: (NSArray *)outlets forClassNamed: (NSString *)className;
|
||||
- (NSString *) addNewActionToClassNamed: (NSString *)name;
|
||||
- (NSString *) addNewOutletToClassNamed: (NSString *)name;
|
||||
- (void) replaceAction: (NSString *)oldAction withAction: (NSString *)newAction forClassNamed: className;
|
||||
- (void) replaceOutlet: (NSString *)oldOutlet withOutlet: (NSString *)newOutlet forClassNamed: className;
|
||||
- (void) replaceAction: (NSString *)oldAction withAction: (NSString *)newAction forClassNamed: (NSString *)className;
|
||||
- (void) replaceOutlet: (NSString *)oldOutlet withOutlet: (NSString *)newOutlet forClassNamed: (NSString *)className;
|
||||
|
||||
/** Managing classes and subclasses */
|
||||
- (BOOL) renameClassNamed: (NSString *)oldName newName: (NSString*)name;
|
||||
/* Managing classes and subclasses */
|
||||
- (BOOL) renameClassNamed: (NSString *)oldName newName: (NSString *)name;
|
||||
- (void) removeClassNamed: (NSString *)className;
|
||||
- (NSString*) addClassWithSuperClassName: (NSString*)name;
|
||||
- (NSArray*) subClassesOf: (NSString *)superclass;
|
||||
- (NSArray*) allSubclassesOf: (NSString *)superClass;
|
||||
- (NSArray*) customSubClassesOf: (NSString *)superclass;
|
||||
- (NSArray*) allCustomSubclassesOf: (NSString *)superclass;
|
||||
- (NSArray*) allCustomClassNames;
|
||||
|
||||
- (BOOL) addClassNamed: (NSString*)className
|
||||
withSuperClassNamed: (NSString*)superClassName
|
||||
withActions: (NSArray*)actions
|
||||
withOutlets: (NSArray*)outlets;
|
||||
|
||||
- (BOOL) addClassNamed: (NSString*)class_name
|
||||
withSuperClassNamed: (NSString*)super_class_name
|
||||
withActions: (NSArray*)_actions
|
||||
withOutlets: (NSArray*)_outlets
|
||||
- (NSString *) addClassWithSuperClassName: (NSString *)name;
|
||||
- (NSArray *) subClassesOf: (NSString *)superclass;
|
||||
- (NSArray *) allSubclassesOf: (NSString *)superClass;
|
||||
- (NSArray *) customSubClassesOf: (NSString *)superclass;
|
||||
- (NSArray *) allCustomSubclassesOf: (NSString *)superclass;
|
||||
- (NSArray *) allCustomClassNames;
|
||||
- (BOOL) addClassNamed: (NSString *)className
|
||||
withSuperClassNamed: (NSString *)superClassName
|
||||
withActions: (NSArray *)actions
|
||||
withOutlets: (NSArray *)outlets;
|
||||
- (BOOL) addClassNamed: (NSString *)class_name
|
||||
withSuperClassNamed: (NSString *)super_class_name
|
||||
withActions: (NSArray *)_actions
|
||||
withOutlets: (NSArray *)_outlets
|
||||
isCustom: (BOOL) isCustom;
|
||||
|
||||
- (BOOL) setSuperClassNamed: (NSString*)superclass
|
||||
forClassNamed: (NSString*)subclass;
|
||||
|
||||
- (BOOL) setSuperClassNamed: (NSString *)superclass
|
||||
forClassNamed: (NSString *)subclass;
|
||||
- (NSString *)parentOfClass: (NSString *)aClass;
|
||||
- (NSString*) superClassNameForClassNamed: (NSString*)className;
|
||||
- (BOOL) isSuperclass: (NSString*)superclass
|
||||
linkedToClass: (NSString*)subclass;
|
||||
- (NSString *) superClassNameForClassNamed: (NSString *)className;
|
||||
- (BOOL) isSuperclass: (NSString *)superclass
|
||||
linkedToClass: (NSString *)subclass;
|
||||
- (NSDictionary *) dictionaryForClassNamed: (NSString *)className;
|
||||
- (NSString *) uniqueClassNameFrom: (NSString *)name;
|
||||
|
||||
/** Managing custom classes */
|
||||
/* Managing custom classes */
|
||||
- (BOOL) isCustomClass: (NSString *)className;
|
||||
- (BOOL) isNonCustomClass: (NSString *)className;
|
||||
- (BOOL) isCategoryForClass: (NSString *)className;
|
||||
|
@ -105,13 +103,10 @@
|
|||
- (BOOL) isOutlet: (NSString *)outletName ofClass: (NSString *)className;
|
||||
- (NSArray *) allSuperClassesOf: (NSString *)className;
|
||||
- (BOOL) canInstantiateClassNamed: (NSString *)className;
|
||||
|
||||
- (NSString *) customClassForObject: (id)object;
|
||||
- (NSString *) customClassForName: (NSString *)name;
|
||||
|
||||
- (void) setCustomClass: (NSString *)className
|
||||
forName: (NSString *)object;
|
||||
|
||||
- (void) removeCustomClassForName: (NSString *) object;
|
||||
- (NSMutableDictionary *) customClassMap;
|
||||
- (void) setCustomClassMap: (NSMutableDictionary *)dict;
|
||||
|
@ -119,18 +114,16 @@
|
|||
- (NSString *) nonCustomSuperClassOf: (NSString *)className;
|
||||
- (BOOL) isAction: (NSString *)actionName onCategoryForClassNamed: (NSString *)className;
|
||||
|
||||
/** Parsing and creating classes */
|
||||
- (BOOL) makeSourceAndHeaderFilesForClass: (NSString*)className
|
||||
withName:(NSString*)sourcePath
|
||||
and:(NSString*)headerPath;
|
||||
|
||||
/* Parsing and creating classes */
|
||||
- (BOOL) makeSourceAndHeaderFilesForClass: (NSString *)className
|
||||
withName: (NSString *)sourcePath
|
||||
and: (NSString *)headerPath;
|
||||
- (BOOL) parseHeader: (NSString *)headerPath;
|
||||
|
||||
/** loading and saving */
|
||||
- (BOOL) saveToFile: (NSString*)path;
|
||||
- (BOOL) loadFromFile: (NSString*)path;
|
||||
- (BOOL) loadCustomClasses: (NSString*)path;
|
||||
|
||||
/* Loading and saving */
|
||||
- (BOOL) saveToFile: (NSString *)path;
|
||||
- (BOOL) loadFromFile: (NSString *)path;
|
||||
- (BOOL) loadCustomClasses: (NSString *)path;
|
||||
@end
|
||||
|
||||
#endif
|
||||
|
|
|
@ -129,7 +129,20 @@
|
|||
[dict removeObjectsForKeys: array];
|
||||
}
|
||||
|
||||
- (NSString*) addClassWithSuperClassName: (NSString*)name
|
||||
- (NSString *) uniqueClassNameFrom: (NSString *)name
|
||||
{
|
||||
NSString *search = [NSString stringWithString: name];
|
||||
int i = 1;
|
||||
|
||||
while([classInformation objectForKey: search])
|
||||
{
|
||||
search = [name stringByAppendingString: [NSString stringWithFormat: @"%d",i++]];
|
||||
}
|
||||
|
||||
return search;
|
||||
}
|
||||
|
||||
- (NSString *) addClassWithSuperClassName: (NSString*)name
|
||||
{
|
||||
if ([name isEqualToString: @"NSObject"]
|
||||
|| [classInformation objectForKey: name] != nil)
|
||||
|
@ -137,27 +150,18 @@
|
|||
NSMutableDictionary *classInfo;
|
||||
NSMutableArray *outlets;
|
||||
NSMutableArray *actions;
|
||||
NSString *newClassName;
|
||||
int i;
|
||||
NSString *className = [self uniqueClassNameFrom: @"NewClass"];
|
||||
|
||||
classInfo = [[NSMutableDictionary alloc] initWithCapacity: 3];
|
||||
outlets = [[NSMutableArray alloc] initWithCapacity: 0];
|
||||
actions = [[NSMutableArray alloc] initWithCapacity: 0];
|
||||
newClassName = @"NewClass";
|
||||
i = 1;
|
||||
|
||||
[classInfo setObject: outlets forKey: @"Outlets"];
|
||||
[classInfo setObject: actions forKey: @"Actions"];
|
||||
[classInfo setObject: name forKey: @"Super"];
|
||||
|
||||
while ([classInformation objectForKey: newClassName] != nil)
|
||||
{
|
||||
newClassName = [newClassName stringByAppendingString:
|
||||
[NSString stringWithFormat: @"%d", i++]];
|
||||
|
||||
}
|
||||
[classInformation setObject: classInfo forKey: newClassName];
|
||||
[customClasses addObject: newClassName];
|
||||
[classInformation setObject: classInfo forKey: className];
|
||||
[customClasses addObject: className];
|
||||
|
||||
[self touch];
|
||||
|
||||
|
@ -165,9 +169,10 @@
|
|||
postNotificationName: GormDidAddClassNotification
|
||||
object: self];
|
||||
|
||||
return newClassName;
|
||||
return className;
|
||||
}
|
||||
return @"";
|
||||
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (NSString *) addNewActionToClassNamed: (NSString *)name
|
||||
|
@ -204,52 +209,62 @@
|
|||
return new;
|
||||
}
|
||||
|
||||
- (BOOL) addClassNamed: (NSString*)class_name
|
||||
withSuperClassNamed: (NSString*)super_class_name
|
||||
withActions: (NSArray*)_actions
|
||||
withOutlets: (NSArray*)_outlets
|
||||
- (BOOL) addClassNamed: (NSString *)className
|
||||
withSuperClassNamed: (NSString *)superClassName
|
||||
withActions: (NSArray *)actions
|
||||
withOutlets: (NSArray *)outlets
|
||||
{
|
||||
return [self addClassNamed: class_name
|
||||
withSuperClassNamed: super_class_name
|
||||
withActions: _actions
|
||||
withOutlets: _outlets
|
||||
return [self addClassNamed: className
|
||||
withSuperClassNamed: superClassName
|
||||
withActions: actions
|
||||
withOutlets: outlets
|
||||
isCustom: YES];
|
||||
}
|
||||
|
||||
- (BOOL) addClassNamed: (NSString*)class_name
|
||||
withSuperClassNamed: (NSString*)super_class_name
|
||||
withActions: (NSArray*)_actions
|
||||
withOutlets: (NSArray*)_outlets
|
||||
- (BOOL) addClassNamed: (NSString *)className
|
||||
withSuperClassNamed: (NSString *)superClassName
|
||||
withActions: (NSArray *)actions
|
||||
withOutlets: (NSArray *)outlets
|
||||
isCustom: (BOOL) isCustom
|
||||
{
|
||||
BOOL result = NO;
|
||||
NSString *className = [class_name copy];
|
||||
NSString *superClassName = [super_class_name copy];
|
||||
NSArray *actions = [_actions copy];
|
||||
NSArray *outlets = [_outlets copy];
|
||||
NSString *classNameCopy = [NSString stringWithString: className];
|
||||
NSString *superClassNameCopy = [NSString stringWithString: superClassName];
|
||||
NSMutableArray *actionsCopy = [NSMutableArray arrayWithArray: actions];
|
||||
NSMutableArray *outletsCopy = [NSMutableArray arrayWithArray: outlets];
|
||||
|
||||
if ([superClassName isEqualToString: @"NSObject"]
|
||||
|| [classInformation objectForKey: superClassName] != nil)
|
||||
// We make an autoreleased copy of all of the inputs. This prevents changes
|
||||
// to the original objects from reflecting here. GJC
|
||||
|
||||
if ([superClassNameCopy isEqualToString: @"NSObject"]
|
||||
|| [classInformation objectForKey: superClassNameCopy] != nil)
|
||||
{
|
||||
NSMutableDictionary *classInfo;
|
||||
|
||||
if (![classInformation objectForKey: className])
|
||||
if (![classInformation objectForKey: classNameCopy])
|
||||
{
|
||||
NSEnumerator *e = [actions objectEnumerator];
|
||||
NSEnumerator *e = [actionsCopy objectEnumerator];
|
||||
id action = nil;
|
||||
NSArray *superActions = [self allActionsForClassNamed: superClassNameCopy];
|
||||
NSArray *superOutlets = [self allOutletsForClassNamed: superClassNameCopy];
|
||||
|
||||
[self touch];
|
||||
classInfo = [[NSMutableDictionary alloc] initWithCapacity: 3];
|
||||
|
||||
// if an outlet/action is defined on the superclass before this
|
||||
// class is added, the superclass' entry takes precedence.
|
||||
[actionsCopy removeObjectsInArray: superActions];
|
||||
[outletsCopy removeObjectsInArray: superOutlets];
|
||||
|
||||
[classInfo setObject: outlets forKey: @"Outlets"];
|
||||
[classInfo setObject: actions forKey: @"Actions"];
|
||||
[classInfo setObject: superClassName forKey: @"Super"];
|
||||
[classInformation setObject: classInfo forKey: className];
|
||||
[classInfo setObject: outletsCopy forKey: @"Outlets"];
|
||||
[classInfo setObject: actionsCopy forKey: @"Actions"];
|
||||
[classInfo setObject: superClassNameCopy forKey: @"Super"];
|
||||
[classInformation setObject: classInfo forKey: classNameCopy];
|
||||
|
||||
// if it's a custom class add it to the list.
|
||||
if(isCustom)
|
||||
{
|
||||
[customClasses addObject: className];
|
||||
[customClasses addObject: classNameCopy];
|
||||
}
|
||||
|
||||
// copy all actions from the class imported to the first responder
|
||||
|
@ -275,7 +290,7 @@
|
|||
return result;
|
||||
}
|
||||
|
||||
- (void) addAction: (NSString*)anAction forObject: (id)anObject
|
||||
- (void) addAction: (NSString *)anAction forObject: (id)anObject
|
||||
{
|
||||
[self addAction: anAction forClassNamed: [anObject className]];
|
||||
}
|
||||
|
@ -328,7 +343,7 @@
|
|||
[self touch];
|
||||
}
|
||||
|
||||
- (void) addOutlet: (NSString*)outlet forObject: (id)anObject
|
||||
- (void) addOutlet: (NSString *)outlet forObject: (id)anObject
|
||||
{
|
||||
[self addOutlet: outlet forClassNamed: [anObject className]];
|
||||
}
|
||||
|
@ -465,12 +480,12 @@
|
|||
}
|
||||
}
|
||||
|
||||
- (void) removeAction: (NSString*)anAction forObject: (id)anObject
|
||||
- (void) removeAction: (NSString *)anAction forObject: (id)anObject
|
||||
{
|
||||
[self removeAction: anAction fromClassNamed: [anObject className]];
|
||||
}
|
||||
|
||||
- (void) removeAction: (NSString*)anAction
|
||||
- (void) removeAction: (NSString *)anAction
|
||||
fromClassNamed: (NSString *)className
|
||||
{
|
||||
NSMutableDictionary *info = [classInformation objectForKey: className];
|
||||
|
@ -530,12 +545,12 @@
|
|||
}
|
||||
}
|
||||
|
||||
- (void) removeOutlet: (NSString*)anOutlet forObject: (id)anObject
|
||||
- (void) removeOutlet: (NSString *)anOutlet forObject: (id)anObject
|
||||
{
|
||||
[self removeOutlet: anOutlet fromClassNamed: [anObject className]];
|
||||
}
|
||||
|
||||
- (void) removeOutlet: (NSString*)anOutlet fromClassNamed: (NSString *)className
|
||||
- (void) removeOutlet: (NSString *)anOutlet fromClassNamed: (NSString *)className
|
||||
{
|
||||
NSMutableDictionary *info = [classInformation objectForKey: className];
|
||||
NSMutableArray *extraOutlets = [info objectForKey: @"ExtraOutlets"];
|
||||
|
@ -581,7 +596,7 @@
|
|||
}
|
||||
|
||||
|
||||
- (NSArray*) allActionsForObject: (id)obj
|
||||
- (NSArray *) allActionsForObject: (id)obj
|
||||
{
|
||||
NSString *className;
|
||||
NSArray *actions;
|
||||
|
@ -643,7 +658,7 @@
|
|||
return actions;
|
||||
}
|
||||
|
||||
- (NSArray*) allActionsForClassNamed: (NSString*)className
|
||||
- (NSArray *) allActionsForClassNamed: (NSString *)className
|
||||
{
|
||||
NSMutableDictionary *info = [classInformation objectForKey: className];
|
||||
|
||||
|
@ -695,18 +710,18 @@
|
|||
return nil;
|
||||
}
|
||||
|
||||
- (NSArray*) allCustomClassNames
|
||||
- (NSArray *) allCustomClassNames
|
||||
{
|
||||
// return [customClassMap allKeys];
|
||||
return customClasses;
|
||||
}
|
||||
|
||||
- (NSArray*) allClassNames
|
||||
- (NSArray *) allClassNames
|
||||
{
|
||||
return [[classInformation allKeys] sortedArrayUsingSelector: @selector(compare:)];
|
||||
}
|
||||
|
||||
- (NSArray*) allOutletsForObject: (id)obj
|
||||
- (NSArray *) allOutletsForObject: (id)obj
|
||||
{
|
||||
NSString *className;
|
||||
NSArray *outlets;
|
||||
|
@ -764,7 +779,7 @@
|
|||
return outlets;
|
||||
}
|
||||
|
||||
- (NSArray*) allOutletsForClassNamed: (NSString*)className;
|
||||
- (NSArray *) allOutletsForClassNamed: (NSString *)className;
|
||||
{
|
||||
NSMutableDictionary *info = [classInformation objectForKey: className];
|
||||
|
||||
|
@ -816,7 +831,7 @@
|
|||
return nil;
|
||||
}
|
||||
|
||||
- (NSMutableDictionary*) classInfoForClassName: (NSString*)className
|
||||
- (NSMutableDictionary*) classInfoForClassName: (NSString *)className
|
||||
{
|
||||
NSMutableDictionary *info;
|
||||
|
||||
|
@ -898,14 +913,14 @@
|
|||
[super dealloc];
|
||||
}
|
||||
|
||||
- (NSArray*) extraActionsForObject: (id)anObject
|
||||
- (NSArray *) extraActionsForObject: (id)anObject
|
||||
{
|
||||
NSMutableDictionary *info = [self classInfoForObject: anObject];
|
||||
|
||||
return [info objectForKey: @"ExtraActions"];
|
||||
}
|
||||
|
||||
- (NSArray*) extraOutletsForObject: (id)anObject
|
||||
- (NSArray *) extraOutletsForObject: (id)anObject
|
||||
{
|
||||
NSMutableDictionary *info = [self classInfoForObject: anObject];
|
||||
|
||||
|
@ -1041,7 +1056,7 @@
|
|||
object: self];
|
||||
}
|
||||
|
||||
- (BOOL) renameClassNamed: (NSString*)oldName newName: (NSString*)newName
|
||||
- (BOOL) renameClassNamed: (NSString *)oldName newName: (NSString *)newName
|
||||
{
|
||||
id classInfo = [classInformation objectForKey: oldName];
|
||||
NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];
|
||||
|
@ -1111,7 +1126,7 @@
|
|||
return [dictForClass objectForKey: @"Super"];
|
||||
}
|
||||
|
||||
- (BOOL) saveToFile: (NSString*)path
|
||||
- (BOOL) saveToFile: (NSString *)path
|
||||
{
|
||||
NSMutableDictionary *ci;
|
||||
NSEnumerator *enumerator;
|
||||
|
@ -1212,7 +1227,7 @@
|
|||
return [ci writeToFile: path atomically: YES];
|
||||
}
|
||||
|
||||
- (BOOL) loadFromFile: (NSString*)path
|
||||
- (BOOL) loadFromFile: (NSString *)path
|
||||
{
|
||||
NSDictionary *dict;
|
||||
NSEnumerator *enumerator;
|
||||
|
@ -1335,23 +1350,23 @@
|
|||
else
|
||||
{
|
||||
NSMutableArray *actions = [classDict objectForKey: @"Actions"];
|
||||
NSMutableArray *orig_actions = [info objectForKey: @"Actions"];
|
||||
NSMutableArray *all_actions = nil;
|
||||
NSMutableArray *origActions = [info objectForKey: @"Actions"];
|
||||
NSMutableArray *allActions = nil;
|
||||
|
||||
// remove any duplicate actions...
|
||||
if(orig_actions != nil)
|
||||
if(origActions != nil)
|
||||
{
|
||||
NSEnumerator *en = [actions objectEnumerator];
|
||||
id action = nil;
|
||||
|
||||
all_actions = [NSMutableArray arrayWithArray: orig_actions];
|
||||
[all_actions addObjectsFromArray: actions];
|
||||
[info setObject: all_actions forKey: @"AllActions"];
|
||||
allActions = [NSMutableArray arrayWithArray: origActions];
|
||||
[allActions addObjectsFromArray: actions];
|
||||
[info setObject: allActions forKey: @"AllActions"];
|
||||
|
||||
// take out any duplicates which might be present.
|
||||
while((action = [en nextObject]) != nil)
|
||||
{
|
||||
if([orig_actions containsObject: action])
|
||||
if([origActions containsObject: action])
|
||||
{
|
||||
[actions removeObject: action];
|
||||
}
|
||||
|
@ -1412,8 +1427,8 @@
|
|||
return ([classInformation objectForKey: className] != nil);
|
||||
}
|
||||
|
||||
- (BOOL) setSuperClassNamed: (NSString*)superclass
|
||||
forClassNamed: (NSString*)subclass
|
||||
- (BOOL) setSuperClassNamed: (NSString *)superclass
|
||||
forClassNamed: (NSString *)subclass
|
||||
{
|
||||
NSArray *cn = [self allClassNames];
|
||||
|
||||
|
@ -1452,7 +1467,7 @@
|
|||
return NO;
|
||||
}
|
||||
|
||||
- (NSString*) superClassNameForClassNamed: (NSString*)className
|
||||
- (NSString *) superClassNameForClassNamed: (NSString *)className
|
||||
{
|
||||
NSMutableDictionary *info = [classInformation objectForKey: className];
|
||||
NSString *superName = nil;
|
||||
|
@ -1469,7 +1484,7 @@
|
|||
return superName;
|
||||
}
|
||||
|
||||
- (BOOL) isSuperclass: (NSString*)superclass linkedToClass: (NSString*)subclass
|
||||
- (BOOL) isSuperclass: (NSString *)superclass linkedToClass: (NSString *)subclass
|
||||
{
|
||||
NSString *ssclass;
|
||||
|
||||
|
@ -1495,13 +1510,26 @@
|
|||
return [self isSuperclass: superclass linkedToClass: ssclass];
|
||||
}
|
||||
|
||||
- (NSDictionary *) dictionaryForClassNamed: (NSString *)className
|
||||
{
|
||||
NSMutableDictionary *info = [NSMutableDictionary dictionaryWithDictionary: [classInformation objectForKey: className]];
|
||||
|
||||
if(info != nil)
|
||||
{
|
||||
[info removeObjectForKey: @"AllActions"];
|
||||
[info removeObjectForKey: @"AllOutlets"];
|
||||
}
|
||||
|
||||
return info;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* create .m & .h files for a class
|
||||
*/
|
||||
- (BOOL) makeSourceAndHeaderFilesForClass: (NSString*)className
|
||||
withName: (NSString*)sourcePath
|
||||
and: (NSString*)headerPath
|
||||
- (BOOL) makeSourceAndHeaderFilesForClass: (NSString *)className
|
||||
withName: (NSString *)sourcePath
|
||||
and: (NSString *)headerPath
|
||||
{
|
||||
NSMutableString *headerFile;
|
||||
NSMutableString *sourceFile;
|
||||
|
|
2
TODO
2
TODO
|
@ -32,3 +32,5 @@ Usability features:
|
|||
outlet/action automatically after the user finishes editing the current
|
||||
one.
|
||||
|
||||
2) Make GormClassEditor return a dictionary instead of a proxy object as it's
|
||||
selection.
|
Loading…
Reference in a new issue