mirror of
https://github.com/gnustep/apps-gorm.git
synced 2025-04-22 22:20:44 +00:00
Lots and lots of fixes and enhancements.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/apps/gorm/trunk@14191 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
393b1ebb5c
commit
7e9a778000
10 changed files with 147 additions and 85 deletions
22
ChangeLog
22
ChangeLog
|
@ -1,3 +1,25 @@
|
|||
2002-07-22 Gregory John Casamento <greg_casamento@yahoo.com>
|
||||
|
||||
* Resources/GormCustomClassInspector.[gorm,classes]: Added.
|
||||
* GormCustomClassInspector.[hm]: Added. Custom class support is not
|
||||
fully functional. I am currently working on it, but I thought
|
||||
it would be useful to commit the code sooner rather than later.
|
||||
* Gorm.m: Made some fixes to prevent core dump.
|
||||
* GormClassManager.m: Removed some debugging NSLog calls and
|
||||
added logic to prevent the addition of duplication outlets/actions
|
||||
to a class.
|
||||
* GormDocument.m: Finished up the delete functionality. Added code
|
||||
to show an alert panel when the user tries to add a duplicate outlet/
|
||||
action to the class.
|
||||
* GormOutlineView.m: Added method to allow deletion of a given
|
||||
row directly from the outline view.
|
||||
* GormInspectorsManager.m: Modified to pop up button to show custom
|
||||
class inspector as an option.
|
||||
* GormObjectEditor.m: returns custom class inspector when
|
||||
class1InspectorClassName is called.
|
||||
* IBInspector.m: Removed some code which was causing core dump.
|
||||
|
||||
|
||||
2002-07-21 Gregory John Casamento <greg_casamento@yahoo.com>
|
||||
|
||||
* GormClassManager.[hm]: Added some methods to support custom
|
||||
|
|
|
@ -107,13 +107,15 @@ Gorm_RESOURCE_FILES = \
|
|||
Images/GormOutlet.tiff \
|
||||
Images/GormActionSelected.tiff \
|
||||
Images/GormOutletSelected.tiff \
|
||||
Resources/GormViewSizeInspector.gorm
|
||||
Resources/GormViewSizeInspector.gorm \
|
||||
Resources/GormCustomClassInspector.gorm
|
||||
|
||||
Gorm_HEADERS = \
|
||||
Gorm.h \
|
||||
GormPrivate.h \
|
||||
GormCustomView.h \
|
||||
GormOutlineView.h
|
||||
GormOutlineView.h \
|
||||
GormCustomClassInspector.h
|
||||
|
||||
Gorm_OBJC_FILES = \
|
||||
Gorm.m \
|
||||
|
@ -132,7 +134,8 @@ Gorm_OBJC_FILES = \
|
|||
GormClassManager.m \
|
||||
GormInspectorsManager.m \
|
||||
GormPalettesManager.m \
|
||||
GormOutlineView.m
|
||||
GormOutlineView.m \
|
||||
GormCustomClassInspector.m
|
||||
|
||||
-include GNUmakefile.preamble
|
||||
|
||||
|
|
6
Gorm.m
6
Gorm.m
|
@ -304,7 +304,7 @@ NSString *GormLinkPboardType = @"GormLinkPboardType";
|
|||
RELEASE(palettesManager);
|
||||
RELEASE(documents);
|
||||
RELEASE(classManager);
|
||||
[super dealloc];
|
||||
// [super dealloc];
|
||||
}
|
||||
|
||||
- (id) delete: (id)sender
|
||||
|
@ -753,8 +753,8 @@ NSLog(@"StartupTime %f", [startDate timeIntervalSinceNow]);
|
|||
[d setObject: @"Gorm" forKey: @"ApplicationName"];
|
||||
[d setObject: @"GNUstep Graphical Object Relationship Modeller"
|
||||
forKey: @"ApplicationDescription"];
|
||||
[d setObject: @"Gorm 0.1" forKey: @"ApplicationRelease"];
|
||||
[d setObject: @"0.1 Feb 2000" forKey: @"FullVersionID"];
|
||||
[d setObject: @"Gorm 0.2" forKey: @"ApplicationRelease"];
|
||||
[d setObject: @"0.2 Jul 2002" forKey: @"FullVersionID"];
|
||||
[d setObject: [NSArray arrayWithObjects:
|
||||
@"Gregory John Casamento <greg_casamento@yahoo.com>",
|
||||
@"Richard Frith-Macdonald <rfm@gnu.org>",
|
||||
|
|
|
@ -104,14 +104,11 @@ NSString *IBClassNameChangedNotification = @"IBClassNameChangedNotification";
|
|||
NSMutableArray *combined = [NSMutableArray arrayWithArray: array];
|
||||
NSString *new = @"newAction", *search = [new stringByAppendingString: @":"];
|
||||
int i = 1;
|
||||
NSLog(@"before...");
|
||||
[combined addObjectsFromArray: extra];
|
||||
while([combined containsObject: search])
|
||||
{
|
||||
NSLog(@"Here...");
|
||||
new = [new stringByAppendingString: [NSString stringWithFormat: @"%d", i++]];
|
||||
search = [new stringByAppendingString: @":"];
|
||||
NSLog(@"string = %@ %@", new, search);
|
||||
}
|
||||
|
||||
[self addAction: search forClassNamed: name];
|
||||
|
@ -198,8 +195,6 @@ NSString *IBClassNameChangedNotification = @"IBClassNameChangedNotification";
|
|||
NSMutableArray *extraActions = [info objectForKey: @"ExtraActions"];
|
||||
NSArray *allActions = [self allActionsForClassNamed: className];
|
||||
|
||||
NSLog(@"action: %@",anAction);
|
||||
|
||||
if([allActions containsObject: anAction])
|
||||
{
|
||||
return;
|
||||
|
@ -243,6 +238,12 @@ NSString *IBClassNameChangedNotification = @"IBClassNameChangedNotification";
|
|||
NSMutableArray *actions = [info objectForKey: @"Actions"];
|
||||
NSMutableArray *allActions = [info objectForKey: @"AllActions"];
|
||||
|
||||
if([allActions containsObject: newAction] ||
|
||||
[extraActions containsObject: newAction])
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if([extraActions containsObject: oldAction])
|
||||
{
|
||||
int all_index = [allActions indexOfObject: oldAction];
|
||||
|
@ -268,6 +269,12 @@ NSString *IBClassNameChangedNotification = @"IBClassNameChangedNotification";
|
|||
NSMutableArray *outlets = [info objectForKey: @"Outlets"];
|
||||
NSMutableArray *allOutlets = [info objectForKey: @"AllOutlets"];
|
||||
|
||||
if([allOutlets containsObject: newOutlet] ||
|
||||
[extraOutlets containsObject: newOutlet])
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if([extraOutlets containsObject: oldOutlet])
|
||||
{
|
||||
int all_index = [allOutlets indexOfObject: oldOutlet];
|
||||
|
@ -1141,7 +1148,6 @@ NSString *IBClassNameChangedNotification = @"IBClassNameChangedNotification";
|
|||
|
||||
[combined addObjectsFromArray: array];
|
||||
[combined addObjectsFromArray: extra_array];
|
||||
NSLog(@"action = %@, actions = %@",name,combined);
|
||||
result = ([combined indexOfObject: name] != NSNotFound);
|
||||
}
|
||||
|
||||
|
@ -1161,7 +1167,6 @@ NSString *IBClassNameChangedNotification = @"IBClassNameChangedNotification";
|
|||
|
||||
[combined addObjectsFromArray: array];
|
||||
[combined addObjectsFromArray: extra_array];
|
||||
NSLog(@"outlet = %@, outlets = %@",name,combined);
|
||||
result = ([combined indexOfObject: name] != NSNotFound);
|
||||
}
|
||||
|
||||
|
|
126
GormDocument.m
126
GormDocument.m
|
@ -471,6 +471,7 @@ static NSImage *classesImage = nil;
|
|||
|
||||
newClassName = [classManager addClassWithSuperClassName:
|
||||
itemSelected];
|
||||
RETAIN(newClassName);
|
||||
[classesView reloadData];
|
||||
[classesView expandItem: itemSelected];
|
||||
i = [classesView rowForItem: newClassName];
|
||||
|
@ -709,7 +710,64 @@ static NSImage *classesImage = nil;
|
|||
|
||||
- (id) remove: (id)sender
|
||||
{
|
||||
[classesView removeSelectedItem];
|
||||
int i = [classesView selectedRow];
|
||||
id anitem = [classesView itemAtRow: i];
|
||||
if([anitem isKindOfClass: [GormOutletActionHolder class]])
|
||||
{
|
||||
id itemBeingEdited = [classesView itemBeingEdited];
|
||||
|
||||
// if the class being edited is a custom class, then allow the deletion...
|
||||
if([classManager isCustomClass: itemBeingEdited])
|
||||
{
|
||||
if([classesView editType] == Actions)
|
||||
{
|
||||
// if this action is an action on the class, not it's superclass
|
||||
// allow the deletion...
|
||||
if([classManager isAction: [anitem getName]
|
||||
ofClass: itemBeingEdited])
|
||||
{
|
||||
[classManager removeAction: [anitem getName]
|
||||
fromClassNamed: itemBeingEdited];
|
||||
[classesView removeItemAtRow: i];
|
||||
}
|
||||
}
|
||||
else if([classesView editType] == Outlets)
|
||||
{
|
||||
// if this outlet is an outlet on the class, not it's superclass
|
||||
// allow the deletion...
|
||||
if([classManager isOutlet: [anitem getName]
|
||||
ofClass: itemBeingEdited])
|
||||
{
|
||||
[classManager removeOutlet: [anitem getName]
|
||||
fromClassNamed: itemBeingEdited];
|
||||
[classesView removeItemAtRow: i];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
NSArray *subclasses = [classManager subClassesOf: anitem];
|
||||
// if the class has no subclasses, then delete.
|
||||
if([subclasses count] == 0)
|
||||
{
|
||||
// if the class being edited is a custom class, then allow the deletion...
|
||||
if([classManager isCustomClass: anitem])
|
||||
{
|
||||
[classManager removeClassNamed: anitem];
|
||||
[classesView reloadData];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
NSString *message = [NSString stringWithFormat:
|
||||
@"The class %@ has subclasses which must be removed",
|
||||
anitem];
|
||||
NSRunAlertPanel(@"Problem removing class",
|
||||
message,
|
||||
nil, nil, nil);
|
||||
}
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
|
@ -2216,9 +2274,9 @@ static NSImage *classesImage = nil;
|
|||
}
|
||||
|
||||
// --- NSOutlineView dataSource ---
|
||||
- (id) outlineView: (NSOutlineView *)anOutlineView
|
||||
- (id) outlineView: (NSOutlineView *)anOutlineView
|
||||
objectValueForTableColumn: (NSTableColumn *)aTableColumn
|
||||
byItem: item
|
||||
byItem: item
|
||||
{
|
||||
if (anOutlineView == classesView)
|
||||
{
|
||||
|
@ -2258,14 +2316,45 @@ objectValueForTableColumn: (NSTableColumn *)aTableColumn
|
|||
if([anOutlineView editType] == Actions)
|
||||
{
|
||||
NSString *formattedAction = [self _formatAction: anObject];
|
||||
[classManager replaceAction: name withAction: formattedAction forClassNamed: [anOutlineView itemBeingEdited]];
|
||||
[item setName: formattedAction];
|
||||
if(![classManager isAction: formattedAction
|
||||
ofClass: [anOutlineView itemBeingEdited]])
|
||||
{
|
||||
[classManager replaceAction: name
|
||||
withAction: formattedAction
|
||||
forClassNamed: [anOutlineView itemBeingEdited]];
|
||||
[item setName: formattedAction];
|
||||
}
|
||||
else
|
||||
{
|
||||
NSString *message = [NSString stringWithFormat:
|
||||
@"The class %@ already has an action named %@",
|
||||
[anOutlineView itemBeingEdited],formattedAction];
|
||||
NSRunAlertPanel(@"Problem Adding Action",
|
||||
message,nil,nil,nil);
|
||||
|
||||
}
|
||||
}
|
||||
else if([anOutlineView editType] == Outlets)
|
||||
{
|
||||
NSString *formattedOutlet = [self _formatOutlet: anObject];
|
||||
[classManager replaceOutlet: name withOutlet: formattedOutlet forClassNamed: [anOutlineView itemBeingEdited]];
|
||||
[item setName: formattedOutlet];
|
||||
|
||||
if(![classManager isOutlet: formattedOutlet
|
||||
ofClass: [anOutlineView itemBeingEdited]])
|
||||
{
|
||||
[classManager replaceOutlet: name
|
||||
withOutlet: formattedOutlet
|
||||
forClassNamed: [anOutlineView itemBeingEdited]];
|
||||
[item setName: formattedOutlet];
|
||||
}
|
||||
else
|
||||
{
|
||||
NSString *message = [NSString stringWithFormat:
|
||||
@"The class %@ already has an outlet named %@",
|
||||
[anOutlineView itemBeingEdited],formattedOutlet];
|
||||
NSRunAlertPanel(@"Problem Adding Outlet",
|
||||
message,nil,nil,nil);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2362,29 +2451,6 @@ numberOfChildrenOfItem: (id)item
|
|||
return [classManager addNewOutletToClassNamed: item];
|
||||
}
|
||||
|
||||
- (void) outlineView: (NSOutlineView)anOutlineView
|
||||
removeItem: (id)item
|
||||
{
|
||||
if([item isKindOfClass: [GormOutletActionHolder class]])
|
||||
{
|
||||
id itemBeingEdited = [classesView itemBeingEdited];
|
||||
if([classesView editType] == Actions)
|
||||
{
|
||||
[classManager removeAction: [item getName]
|
||||
fromClassNamed: itemBeingEdited];
|
||||
}
|
||||
else if([classesView editType] == Outlets)
|
||||
{
|
||||
[classManager removeOutlet: [item getName]
|
||||
fromClassNamed: itemBeingEdited];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
[classManager removeClassNamed: item];
|
||||
}
|
||||
}
|
||||
|
||||
// Delegate methods
|
||||
- (BOOL) outlineView: (NSOutlineView *)outlineView
|
||||
shouldEditTableColumn: (NSTableColumn *)tableColumn
|
||||
|
|
|
@ -267,7 +267,7 @@
|
|||
[item setKeyEquivalent: @"4"];
|
||||
[item setTag: 3];
|
||||
|
||||
[popup addItemWithTitle: @"Class Edit"];
|
||||
[popup addItemWithTitle: @"Custom Class"];
|
||||
item = [popup itemAtIndex: 4];
|
||||
[item setTarget: self];
|
||||
[item setAction: @selector(setCurrentInspector:)];
|
||||
|
@ -873,7 +873,7 @@ selectCellWithString: (NSString*)title
|
|||
RELEASE(outlets);
|
||||
RELEASE(okButton);
|
||||
RELEASE(revertButton);
|
||||
RELEASE(window);
|
||||
// RELEASE(window);
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
|
|
|
@ -47,7 +47,7 @@
|
|||
}
|
||||
- (NSString*) classInspectorClassName
|
||||
{
|
||||
return @"GormClassInspector";
|
||||
return @"GormCustomClassInspector";
|
||||
}
|
||||
- (NSString*) editorClassName
|
||||
{
|
||||
|
@ -909,12 +909,3 @@ NSImage *mVLine = nil;
|
|||
}
|
||||
}
|
||||
@end
|
||||
|
||||
// Custom class inspector declaration and definition
|
||||
@interface GormCustomClassInspector : IBInspector
|
||||
{
|
||||
}
|
||||
@end
|
||||
|
||||
@implementation GormCustomClassInspector
|
||||
@end
|
||||
|
|
|
@ -63,7 +63,7 @@ typedef enum {None, Outlets, Actions} GSAttributeType;
|
|||
- (void) setMenuItem: (NSMenuItem *)item;
|
||||
- (void) addAttributeToClass;
|
||||
- (GSAttributeType)editType;
|
||||
- (void) removeSelectedItem;
|
||||
- (void) removeItemAtRow: (int)row;
|
||||
@end /* interface of GormOutlineView */
|
||||
|
||||
// informal protocol to define necessary methods on
|
||||
|
@ -84,8 +84,6 @@ typedef enum {None, Outlets, Actions} GSAttributeType;
|
|||
addNewActionForClass: (id)item;
|
||||
- (NSString *)outlineView: (NSOutlineView *)anOutlineView
|
||||
addNewOutletForClass: (id)item;
|
||||
- (void)outlineView: (NSOutlineView *)anOutlineView
|
||||
removeItem: (id)item;
|
||||
@end
|
||||
|
||||
@interface NSObject (GormOutlineViewDelegate)
|
||||
|
|
|
@ -214,33 +214,12 @@ static NSColor *darkGreyBlueColor = nil;
|
|||
}
|
||||
}
|
||||
|
||||
- (void)removeSelectedItem
|
||||
- (void) removeItemAtRow: (int)row
|
||||
{
|
||||
id item = [self itemAtRow: [self selectedRow]];
|
||||
int deletionPoint = 0;
|
||||
|
||||
if(![item isKindOfClass: [GormOutletActionHolder class]])
|
||||
{
|
||||
if(item == _itemBeingEdited)
|
||||
return; // we do not delete a class while it's being edited
|
||||
}
|
||||
|
||||
if(![_dataSource outlineView: self
|
||||
shouldEditTableColumn: _outlineTableColumn
|
||||
item: item])
|
||||
{
|
||||
return; // return if this is something we can't edit...
|
||||
}
|
||||
|
||||
[_items removeObjectAtIndex: row];
|
||||
_numberOfRows -= 1;
|
||||
[_dataSource outlineView: self removeItem: item];
|
||||
deletionPoint = [_items indexOfObject: item];
|
||||
if(deletionPoint != NSNotFound)
|
||||
{
|
||||
[_items removeObjectAtIndex: deletionPoint];
|
||||
[self setNeedsDisplay: YES];
|
||||
[self noteNumberOfRowsChanged];
|
||||
}
|
||||
[self setNeedsDisplay: YES];
|
||||
[self noteNumberOfRowsChanged];
|
||||
}
|
||||
|
||||
- (void)_openActions: (id)item
|
||||
|
|
|
@ -36,8 +36,6 @@ NSString *IBSelectionChangedNotification
|
|||
{
|
||||
[[NSNotificationCenter defaultCenter] removeObserver: self];
|
||||
RELEASE(object);
|
||||
RELEASE(okButton);
|
||||
RELEASE(revertButton);
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue