mirror of
https://github.com/gnustep/apps-gorm.git
synced 2025-04-22 14:10:44 +00:00
Code cleanup and some fixes.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/apps/gorm/trunk@18759 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
6198b52db5
commit
04a1c007b5
15 changed files with 103 additions and 83 deletions
24
ChangeLog
24
ChangeLog
|
@ -1,3 +1,27 @@
|
|||
2004-03-03 11:00 Gregory John Casamento <greg_casamento@yahoo.com>
|
||||
|
||||
* GormCustomClassInspector.[hm]: Removed _currentSelection
|
||||
as it was redundant with the "object" ivar. Rearranged the
|
||||
call for setObject:. it was sligtly out of sync. The user
|
||||
needed to click on the object twice to make certain everything
|
||||
is set properly. Removed references to "correctClassName".
|
||||
* GormClassManager.[hm]: Removed the class method "correctClassName"
|
||||
the function is now done by overriding the "className" method
|
||||
when necessary to return the name of the class the Gorm* equivalent
|
||||
is standing in for. This is a cleaner solution.
|
||||
* GormDocument.m: Removed all references to "correctClassName" in the
|
||||
_selectClass: method.
|
||||
* GormFilesOwner.m: Changed some NSLogs to NSDebugLog so that the
|
||||
selection of classes for the File's Owner wont display on the console
|
||||
what class was chosen.
|
||||
* Palettes/GormNSMenu.m: Added className.
|
||||
* Palettes/GormNSPanel.m: same.
|
||||
* Palettes/GormNSWindow.m: same.
|
||||
* Palettes/GormPopUpButtonEditor.m: Added className to implementation
|
||||
of GormNSPopUpButton and GormNSPopUpButtonCell.
|
||||
* Palettes/GormNSOutlineView: added className.
|
||||
* Palettes/GormNSTableView: same.
|
||||
|
||||
2004-02-29 11:56 Gregory John Casamento <greg_casamento@yahoo.com>
|
||||
|
||||
* GormCustomClassInspector.m: -[GormCustomClassInspector setObject:]
|
||||
|
|
|
@ -75,9 +75,6 @@
|
|||
- (NSString *) nonCustomSuperClassOf: (NSString *)className;
|
||||
- (NSString *)parentOfClass: (NSString *)aClass;
|
||||
|
||||
// class methods
|
||||
// Maps internally used names to actual names.
|
||||
+ (NSString *) correctClassName: (NSString *)className;
|
||||
@end
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1470,56 +1470,15 @@
|
|||
className = [dict objectForKey: @"Super"];
|
||||
[classes insertObject: className atIndex: 0];
|
||||
}
|
||||
else
|
||||
{
|
||||
NSLog(@"This should never happen... an instance without an associated class.");
|
||||
break;
|
||||
}
|
||||
}
|
||||
return classes;
|
||||
}
|
||||
|
||||
+ (NSString *) correctClassName: (NSString *)className
|
||||
{
|
||||
if ([className isEqualToString: @"GormNSMenu"])
|
||||
{
|
||||
return @"NSMenu";
|
||||
}
|
||||
if ([className isEqualToString: @"GormNSWindow"])
|
||||
{
|
||||
return @"NSWindow";
|
||||
}
|
||||
if ([className isEqualToString: @"GormNSPanel"])
|
||||
{
|
||||
return @"NSPanel";
|
||||
}
|
||||
if ([className isEqualToString: @"GormNSBrowser"])
|
||||
{
|
||||
return @"NSBrowser";
|
||||
}
|
||||
if ([className isEqualToString: @"GormNSTableView"])
|
||||
{
|
||||
return @"NSTableView";
|
||||
}
|
||||
if ([className isEqualToString: @"GormNSOutlineView"])
|
||||
{
|
||||
return @"NSOutlineView";
|
||||
}
|
||||
if ([className isEqualToString: @"GormNSPopUpButton"])
|
||||
{
|
||||
return @"NSPopUpButton";
|
||||
}
|
||||
if ([className isEqualToString: @"GormNSPopUpButtonCell"])
|
||||
{
|
||||
return @"NSPopUpButtonCell";
|
||||
}
|
||||
if ([className isEqualToString: @"GormFirstResponder"])
|
||||
{
|
||||
return @"FirstResponder";
|
||||
}
|
||||
if ([className isEqualToString: @"GormFilesOwner"])
|
||||
{
|
||||
return @"FilesOwner";
|
||||
}
|
||||
|
||||
return className;
|
||||
}
|
||||
|
||||
- (void) addActions: (NSArray *)actions forClassNamed: (NSString *)className
|
||||
{
|
||||
id action = nil;
|
||||
|
|
|
@ -37,7 +37,6 @@
|
|||
id browser;
|
||||
id _document;
|
||||
GormClassManager *_classManager;
|
||||
id _currentSelection;
|
||||
NSString *_currentSelectionClassName;
|
||||
NSString *_parentClassName;
|
||||
int _rowToSelect;
|
||||
|
|
|
@ -49,7 +49,6 @@
|
|||
{
|
||||
// initialize all member variables...
|
||||
_classManager = nil;
|
||||
_currentSelection = nil;
|
||||
_currentSelectionClassName = nil;
|
||||
_rowToSelect = 0;
|
||||
|
||||
|
@ -67,52 +66,52 @@
|
|||
- (void) _setCurrentSelectionClassName: (id)anobject
|
||||
{
|
||||
NSString *className;
|
||||
NSMutableArray *classes = nil;
|
||||
|
||||
className = [_classManager customClassForObject: anobject];
|
||||
if ([className isEqualToString: @""]
|
||||
|| className == nil)
|
||||
{
|
||||
className = NSStringFromClass([anobject class]);
|
||||
className = [anobject className];
|
||||
}
|
||||
|
||||
ASSIGN(_currentSelectionClassName,
|
||||
[GormClassManager correctClassName: className]);
|
||||
ASSIGN(_parentClassName,
|
||||
[GormClassManager correctClassName: NSStringFromClass([anobject class])]);
|
||||
|
||||
// get a list of all of the classes allowed and the class to be shown.
|
||||
classes = [NSMutableArray arrayWithObject: _parentClassName];
|
||||
[classes addObjectsFromArray: [_classManager allCustomSubclassesOf: _parentClassName]];
|
||||
|
||||
// select the appropriate row in the inspector...
|
||||
_rowToSelect = [classes indexOfObject: className];
|
||||
_rowToSelect = (_rowToSelect != NSNotFound)?_rowToSelect:0;
|
||||
ASSIGN(_currentSelectionClassName, className);
|
||||
ASSIGN(_parentClassName, [anobject className]);
|
||||
}
|
||||
|
||||
- (void) setObject: (id)anObject
|
||||
{
|
||||
NSMutableArray *classes = nil;
|
||||
|
||||
[super setObject: anObject];
|
||||
_document = [(Gorm *)NSApp activeDocument];
|
||||
_classManager = [(Gorm *)NSApp classManager];
|
||||
_currentSelection = anObject;
|
||||
|
||||
// get the information...
|
||||
NSDebugLog(@"Current selection %@", [self object]);
|
||||
[self _setCurrentSelectionClassName: [self object]];
|
||||
|
||||
// load the array...
|
||||
[browser loadColumnZero];
|
||||
NSDebugLog(@"Current selection %@", _currentSelection);
|
||||
[self _setCurrentSelectionClassName: _currentSelection];
|
||||
|
||||
// select the class...
|
||||
[browser selectRow: _rowToSelect inColumn: 0];
|
||||
|
||||
// get a list of all of the classes allowed and the class to be shown
|
||||
// and select the appropriate row in the inspector...
|
||||
classes = [NSMutableArray arrayWithObject: _parentClassName];
|
||||
[classes addObjectsFromArray: [_classManager allCustomSubclassesOf: _parentClassName]];
|
||||
|
||||
_rowToSelect = [classes indexOfObject: _currentSelectionClassName];
|
||||
_rowToSelect = (_rowToSelect != NSNotFound)?_rowToSelect:0;
|
||||
|
||||
if(_rowToSelect != NSNotFound)
|
||||
{
|
||||
[browser selectRow: _rowToSelect inColumn: 0];
|
||||
}
|
||||
[browser setNeedsDisplay: YES];
|
||||
|
||||
}
|
||||
|
||||
|
||||
- (void) awakeFromNib
|
||||
{
|
||||
[browser setTarget: self];
|
||||
[browser setAction: @selector(select:)];
|
||||
[browser reloadColumn: 0];
|
||||
}
|
||||
|
||||
- (void) _replaceCellClassForObject: (id)obj
|
||||
|
@ -156,8 +155,8 @@
|
|||
{
|
||||
NSCell *cell = [browser selectedCellInColumn: 0];
|
||||
NSString *stringValue = [NSString stringWithString: [cell stringValue]];
|
||||
NSString *nameForObject = [_document nameForObject: _currentSelection];
|
||||
NSString *classForObject = [GormClassManager correctClassName: NSStringFromClass([_currentSelection class])];
|
||||
NSString *nameForObject = [_document nameForObject: [self object]];
|
||||
NSString *classForObject = [[self object] className];
|
||||
|
||||
NSDebugLog(@"selected = %@, class = %@",stringValue,nameForObject);
|
||||
|
||||
|
@ -179,7 +178,7 @@
|
|||
|
||||
}
|
||||
else
|
||||
NSLog(@"name for object %@ returned as nil",_currentSelection);
|
||||
NSLog(@"name for object %@ returned as nil",[self object]);
|
||||
}
|
||||
|
||||
// Browser delegate
|
||||
|
|
|
@ -100,6 +100,10 @@ NSString *GSCustomClassMap = @"GSCustomClassMap";
|
|||
{
|
||||
return @"GormNotApplicableInspector";
|
||||
}
|
||||
- (NSString*) className
|
||||
{
|
||||
return @"FirstResponder";
|
||||
}
|
||||
@end
|
||||
|
||||
@implementation GormFontManager
|
||||
|
@ -462,7 +466,6 @@ static NSImage *classesImage = nil;
|
|||
// class selection...
|
||||
- (void) _selectClass: (NSString *)className
|
||||
{
|
||||
NSString *newClassName;
|
||||
NSString *currentClass = nil;
|
||||
NSArray *classes;
|
||||
NSEnumerator *en;
|
||||
|
@ -478,8 +481,7 @@ static NSImage *classesImage = nil;
|
|||
return; // return if it is nil
|
||||
}
|
||||
|
||||
newClassName = [GormClassManager correctClassName: className];
|
||||
classes = [[self classManager] allSuperClassesOf: newClassName];
|
||||
classes = [[self classManager] allSuperClassesOf: className];
|
||||
en = [classes objectEnumerator];
|
||||
|
||||
// open the items...
|
||||
|
@ -489,7 +491,7 @@ static NSImage *classesImage = nil;
|
|||
}
|
||||
|
||||
// select the item...
|
||||
row = [classesView rowForItem: newClassName];
|
||||
row = [classesView rowForItem: className];
|
||||
if (row != NSNotFound)
|
||||
{
|
||||
[classesView selectRow: row byExtendingSelection: NO];
|
||||
|
|
|
@ -199,7 +199,7 @@
|
|||
{
|
||||
NSString *title = [[browser selectedCell] stringValue];
|
||||
|
||||
NSLog(@"Selected %d, %@", [browser selectedRowInColumn: 0], title);
|
||||
NSDebugLog(@"Selected %d, %@", [browser selectedRowInColumn: 0], title);
|
||||
if (hasConnections > 0 && [title isEqual: [object className]] == NO)
|
||||
{
|
||||
if (NSRunAlertPanel(0, _(@"This operation will break existing connection"),
|
||||
|
|
|
@ -441,7 +441,7 @@
|
|||
}
|
||||
else
|
||||
{
|
||||
NSString *newTitle = [GormClassManager correctClassName: NSStringFromClass([obj class])];
|
||||
NSString *newTitle = [obj className];
|
||||
[panel setTitle: [NSString stringWithFormat:_(@"%@ Inspector"), newTitle]];
|
||||
}
|
||||
|
||||
|
|
|
@ -138,6 +138,11 @@
|
|||
// bring main menu to front.
|
||||
}
|
||||
}
|
||||
|
||||
- (NSString *)className
|
||||
{
|
||||
return @"NSMenu";
|
||||
}
|
||||
@end
|
||||
|
||||
/*
|
||||
|
|
|
@ -60,4 +60,9 @@
|
|||
{
|
||||
return _gormStyleMask;
|
||||
}
|
||||
|
||||
- (NSString *) className
|
||||
{
|
||||
return @"NSPanel";
|
||||
}
|
||||
@end
|
||||
|
|
|
@ -63,4 +63,9 @@
|
|||
{
|
||||
return NO;
|
||||
}
|
||||
|
||||
- (NSString *) className
|
||||
{
|
||||
return @"NSWindow";
|
||||
}
|
||||
@end
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
Class _gormnspopupbuttonCellClass = 0;
|
||||
@interface GormNSPopUpButton : NSPopUpButton
|
||||
@end
|
||||
|
||||
@implementation GormNSPopUpButton
|
||||
/*
|
||||
* Class methods
|
||||
|
@ -38,6 +39,11 @@ Class _gormnspopupbuttonCellClass = 0;
|
|||
{
|
||||
return @"GormPopUpButtonEditor";
|
||||
}
|
||||
|
||||
- (NSString *) className
|
||||
{
|
||||
return @"NSPopUpButton";
|
||||
}
|
||||
@end
|
||||
|
||||
@interface GormNSPopUpButtonCell : NSPopUpButtonCell
|
||||
|
@ -78,6 +84,11 @@ Class _gormnspopupbuttonCellClass = 0;
|
|||
|
||||
return self;
|
||||
}
|
||||
|
||||
- (NSString *) className
|
||||
{
|
||||
return @"NSPopUpButtonCell";
|
||||
}
|
||||
@end
|
||||
// @interface GormPopUpNSMenu : NSMenu
|
||||
// - (BOOL)canBecomeMainWindow
|
||||
|
|
|
@ -108,4 +108,9 @@ static id _sharedDelegate = nil;
|
|||
self = [super initWithCoder: aCoder];
|
||||
return self;
|
||||
}
|
||||
|
||||
- (NSString *) className
|
||||
{
|
||||
return @"NSBrowser";
|
||||
}
|
||||
@end
|
||||
|
|
|
@ -383,4 +383,9 @@ static id _sharedDataSource = nil;
|
|||
{
|
||||
return _gormAllowsColumnSelection;
|
||||
}
|
||||
|
||||
- (NSString *) className
|
||||
{
|
||||
return @"NSOutlineView";
|
||||
}
|
||||
@end
|
||||
|
|
|
@ -215,4 +215,8 @@ static id _sharedDataSource = nil;
|
|||
return _gormAllowsColumnSelection;
|
||||
}
|
||||
|
||||
- (NSString *) className
|
||||
{
|
||||
return @"NSTableView";
|
||||
}
|
||||
@end
|
||||
|
|
Loading…
Reference in a new issue