Improving on some of the fixes made yesterday.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/apps/gorm/trunk@16877 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Gregory John Casamento 2003-06-07 05:21:16 +00:00
parent fae96e0c3f
commit 7eaef5f1e7
7 changed files with 91 additions and 48 deletions

View file

@ -1,3 +1,17 @@
2003-06-07 Gregory John Casamento <greg_casamento@yahoo.com>
* Resources/GormClassInspector.gorm: Moved buttons into
tab view.
* GormClassInspector.[hm]: Added new methods and ivars for
buttons in each tab view.
* GormDocument.m: Added code to prevent addition of outlets
to FirstResponder.
* GormClassManager.m: Removed code which prevented adding
actions to firstresponder. MOSX is able to add actions, but not
outlets to FirstResponder. Aldo modified call made from
parseHeader in the class manager to add all action to
FirstResponder when importing the class.
2003-06-06 Gregory John Casamento <greg_casamento@yahoo.com>
* Resources/GormClassInspector.gorm: New inspector

View file

@ -35,10 +35,12 @@
{
// outlets
id actionTable;
id add;
id addAction;
id addOutlet;
id classField;
id outletTable;
id remove;
id removeAction;
id removeOutlet;
id tabView;
// internal vars
@ -50,8 +52,10 @@
// class manager..
GormClassManager *classManager;
}
- (void) add: (id)sender;
- (void) remove: (id)sender;
- (void) addAction: (id)sender;
- (void) removeAction: (id)sender;
- (void) addOutlet: (id)sender;
- (void) removeOutlet: (id)sender;
- (void) select: (id)sender;
- (NSString *) _currentClass;
@end

View file

@ -135,10 +135,12 @@ objectValueForTableColumn: (NSTableColumn *)tc
{
// initialize all member variables...
actionTable = nil;
add = nil;
addAction = nil;
addOutlet = nil;
classField = nil;
outletTable = nil;
remove = nil;
removeAction = nil;
removeOutlet = nil;
tabView = nil;
currentClass = nil;
actionData = nil;
@ -176,52 +178,54 @@ objectValueForTableColumn: (NSTableColumn *)tc
- (void) _refreshView
{
id addcell = [add cell];
id removecell = [remove cell];
id addActionCell = [addAction cell];
id removeActionCell = [removeAction cell];
id addOutletCell = [addOutlet cell];
id removeOutletCell = [removeOutlet cell];
BOOL isCustom = [classManager isCustomClass: [self _currentClass]];
BOOL isFirstResponder = [[self _currentClass] isEqualToString: @"FirstResponder"];
[classField setStringValue: [self _currentClass]];
[outletTable reloadData];
[actionTable reloadData];
[addcell setEnabled: isCustom];
[removecell setEnabled: isCustom];
// activate for actions...
[addActionCell setEnabled: isCustom];
[removeActionCell setEnabled: isCustom];
// activate for outlet...
[addOutletCell setEnabled: (isCustom && !isFirstResponder)];
[removeOutletCell setEnabled: (isCustom && !isFirstResponder)];
}
- (void) add: (id)sender
- (void) addAction: (id)sender
{
NSTabViewItem *tvi = [tabView selectedTabViewItem];
if([[tvi identifier] isEqualToString: @"Actions"])
{
[[(Gorm *)NSApp classManager] addNewActionToClassNamed: [self _currentClass]];
[actionTable reloadData];
}
else
{
[[(Gorm *)NSApp classManager] addNewOutletToClassNamed: [self _currentClass]];
[outletTable reloadData];
}
[[(Gorm *)NSApp classManager] addNewActionToClassNamed: [self _currentClass]];
[actionTable reloadData];
}
- (void) remove: (id)sender
- (void) addOutlet: (id)sender
{
NSTabViewItem *tvi = [tabView selectedTabViewItem];
if([[tvi identifier] isEqualToString: @"Actions"])
{
int i = [actionTable selectedRow];
NSArray *list = [[(Gorm *)NSApp classManager] allActionsForClassNamed: [self _currentClass]];
NSString *name = [list objectAtIndex: i];
[[(Gorm *)NSApp classManager] removeAction: name fromClassNamed: [self _currentClass]];
[actionTable reloadData];
}
else
{
int i = [outletTable selectedRow];
NSArray *list = [[(Gorm *)NSApp classManager] allOutletsForClassNamed: [self _currentClass]];
NSString *name = [list objectAtIndex: i];
[[(Gorm *)NSApp classManager] removeOutlet: name fromClassNamed: [self _currentClass]];
[outletTable reloadData];
}
[[(Gorm *)NSApp classManager] addNewOutletToClassNamed: [self _currentClass]];
[outletTable reloadData];
}
- (void) removeAction: (id)sender
{
int i = [actionTable selectedRow];
NSArray *list = [[(Gorm *)NSApp classManager] allActionsForClassNamed: [self _currentClass]];
NSString *name = [list objectAtIndex: i];
[[(Gorm *)NSApp classManager] removeAction: name fromClassNamed: [self _currentClass]];
[actionTable reloadData];
}
- (void) removeOutlet: (id)sender
{
int i = [outletTable selectedRow];
NSArray *list = [[(Gorm *)NSApp classManager] allOutletsForClassNamed: [self _currentClass]];
NSString *name = [list objectAtIndex: i];
[[(Gorm *)NSApp classManager] removeOutlet: name fromClassNamed: [self _currentClass]];
[outletTable reloadData];
}
- (void) select: (id)sender

View file

@ -157,6 +157,9 @@
if (![classInformation objectForKey: className])
{
NSEnumerator *e = [actions objectEnumerator];
id action = nil;
[self _touch];
classInfo = [[NSMutableDictionary alloc] initWithCapacity: 3];
@ -166,6 +169,13 @@
[classInformation setObject: classInfo forKey: className];
[customClasses addObject: className];
RELEASE(classInfo);
// copy all actions from the class imported to the first responder
while(action = [e nextObject])
{
[self addAction: action forClassNamed: @"FirstResponder"];
}
result = YES;
}
else
@ -1085,8 +1095,8 @@
- (BOOL) isCustomClass: (NSString *)className
{
return ([customClasses indexOfObject: className] != NSNotFound &&
![className isEqualToString: @"FirstResponder"]);
return ([customClasses indexOfObject: className] != NSNotFound); // &&
// ![className isEqualToString: @"FirstResponder"]);
}
- (BOOL) isKnownClass: (NSString *)className

View file

@ -3380,6 +3380,7 @@ numberOfChildrenOfItem: (id)item
{
return nil;
}
return [classManager addNewActionToClassNamed: item];
}
@ -3391,6 +3392,10 @@ numberOfChildrenOfItem: (id)item
{
return nil;
}
if([item isEqualToString: @"FirstResponder"])
return nil;
return [classManager addNewOutletToClassNamed: item];
}

View file

@ -138,23 +138,29 @@
"useStandardKerning:",
"useStandardLigatures:",
"yank:",
"zoom:"
"zoom:",
"removeOutlet:",
"addOutlet:"
);
Super = NSObject;
};
GormClassInspector = {
Actions = (
"select:",
"remove:",
"add:"
"removeAction:",
"addAction:",
"removeOutlet:",
"addOutlet:"
);
Outlets = (
classField,
tabView,
remove,
add,
removeOutlet,
addAction,
actionTable,
outletTable
outletTable,
removeAction,
addOutlet
);
Super = IBInspector;
};