mirror of
https://github.com/gnustep/apps-gorm.git
synced 2025-04-22 14:10:44 +00:00
Added code to show the current object's class in the classes view.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/apps/gorm/trunk@15297 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
8da3ca9c07
commit
285456e30d
6 changed files with 117 additions and 46 deletions
12
ChangeLog
12
ChangeLog
|
@ -1,3 +1,15 @@
|
|||
2002-12-15 Gregory John Casamento <greg_casamento@yahoo.com>
|
||||
|
||||
* Gorm.m: Minor cleanup.
|
||||
* GormClassManager.[hm]: Added method to get all superclasses
|
||||
of a given class. Moved the "correctClassName" method which maps
|
||||
names of internal classes to thier external exquivalents.
|
||||
* GormCustomClassInspector.m: Made changes to call new class method
|
||||
in GormClassManager.
|
||||
* GormDocument.m: Minor cleanup. Addition of _selectClass method
|
||||
which will cause the classes view to show the class of the instance
|
||||
currently selected in the object view.
|
||||
|
||||
2002-12-14 Pierre-Yves Rivaille <pyrivail@ens-lyon.fr>
|
||||
|
||||
* GormViewEditor.m
|
||||
|
|
6
Gorm.m
6
Gorm.m
|
@ -1753,9 +1753,9 @@ main(int argc, const char **argv)
|
|||
extern BOOL NSImageDoesCaching;
|
||||
|
||||
NSImageDoesCaching = YES;
|
||||
//[NSObject enableDoubleReleaseCheck: YES];
|
||||
|
||||
// [GormPosingView poseAsClass: [NSView class]];
|
||||
|
||||
//[NSObject enableDoubleReleaseCheck: YES];
|
||||
//[GormPosingView poseAsClass: [NSView class]];
|
||||
|
||||
startDate = [[NSDate alloc] init];
|
||||
NSApplicationMain(argc, argv);
|
||||
|
|
|
@ -58,6 +58,7 @@
|
|||
- (BOOL) isKnownClass: (NSString *)className;
|
||||
- (BOOL) isAction: (NSString *)actionName ofClass: (NSString *)className;
|
||||
- (BOOL) isOutlet: (NSString *)outletName ofClass: (NSString *)className;
|
||||
- (NSArray *) allSuperClassesOf: (NSString *)className;
|
||||
|
||||
// custom class support...
|
||||
- (NSString *) customClassForObject: (id)object;
|
||||
|
@ -68,6 +69,10 @@
|
|||
- (void) setCustomClassMap: (NSMutableDictionary *)dict;
|
||||
- (BOOL) isCustomClassMapEmpty;
|
||||
- (NSString *) nonCustomSuperClassOf: (NSString *)className;
|
||||
|
||||
// class methods
|
||||
// Maps internally used names to actual names.
|
||||
+ (NSString *) correctClassName: (NSString *)className;
|
||||
@end
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1274,4 +1274,54 @@ NSString *IBClassNameChangedNotification = @"IBClassNameChangedNotification";
|
|||
return result;
|
||||
}
|
||||
|
||||
- (NSArray *)allSuperClassesOf: (NSString *)className
|
||||
{
|
||||
NSMutableArray *classes = [NSMutableArray array];
|
||||
while(![className isEqualToString: @"NSObject"])
|
||||
{
|
||||
NSDictionary *dict = [self classInfoForClassName: className];
|
||||
className = [dict objectForKey: @"Super"];
|
||||
[classes insertObject: className atIndex: 0];
|
||||
}
|
||||
return classes;
|
||||
}
|
||||
|
||||
|
||||
+ (NSString *) correctClassName: (NSString *)className
|
||||
{
|
||||
if ([className isEqualToString: @"GormNSMenu"])
|
||||
{
|
||||
return @"NSMenu";
|
||||
}
|
||||
if ([className isEqualToString: @"GormNSWindow"])
|
||||
{
|
||||
return @"NSWindow";
|
||||
}
|
||||
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";
|
||||
}
|
||||
|
||||
return className;
|
||||
}
|
||||
@end
|
||||
|
|
|
@ -65,41 +65,6 @@
|
|||
return self;
|
||||
}
|
||||
|
||||
|
||||
- (NSString *)_correctClassName: (NSString *)className
|
||||
{
|
||||
if ([className isEqualToString: @"GormNSMenu"])
|
||||
{
|
||||
return @"NSMenu";
|
||||
}
|
||||
if ([className isEqualToString: @"GormNSWindow"])
|
||||
{
|
||||
return @"NSWindow";
|
||||
}
|
||||
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";
|
||||
}
|
||||
|
||||
return className;
|
||||
}
|
||||
|
||||
- (void) _setCurrentSelectionClassName: (id)anobject
|
||||
{
|
||||
NSString *nameForObject = [_document nameForObject: anobject];
|
||||
|
@ -113,8 +78,8 @@
|
|||
className = NSStringFromClass([anobject class]);
|
||||
}
|
||||
|
||||
ASSIGN(_currentSelectionClassName, [self _correctClassName: className]);
|
||||
ASSIGN(_parentClassName, [self _correctClassName: NSStringFromClass([anobject class])]);
|
||||
ASSIGN(_currentSelectionClassName, [GormClassManager correctClassName: className]);
|
||||
ASSIGN(_parentClassName, [GormClassManager correctClassName: NSStringFromClass([anobject class])]);
|
||||
}
|
||||
|
||||
- (void) setObject: (id)anObject
|
||||
|
|
|
@ -274,8 +274,6 @@ static NSImage *classesImage = nil;
|
|||
{
|
||||
NSMutableDictionary *dict = [NSMutableDictionary dictionary];
|
||||
NSString *name = [[path lastPathComponent] stringByDeletingPathExtension];
|
||||
// [dict setObject: path forKey: @"Path"];
|
||||
// [dict setObject: name forKey: @"Name"];
|
||||
return TEST_AUTORELEASE([[GormImage alloc] initWithName: name path: path]);
|
||||
}
|
||||
|
||||
|
@ -430,6 +428,37 @@ static NSImage *classesImage = nil;
|
|||
}
|
||||
}
|
||||
|
||||
- (void) _selectClass
|
||||
{
|
||||
NSArray *selection = [objectsView selection];
|
||||
|
||||
if([selection count] > 0)
|
||||
{
|
||||
id obj = nil;
|
||||
GormClassManager *cm = [self classManager];
|
||||
|
||||
obj = [[objectsView selection] objectAtIndex: 0];
|
||||
if([obj respondsToSelector: @selector(className)])
|
||||
{
|
||||
NSString *className = [GormClassManager correctClassName: [obj className]], *currentClass = nil;
|
||||
NSArray *classes = [[self classManager] allSuperClassesOf: className];
|
||||
NSEnumerator *en = [classes objectEnumerator];
|
||||
int row = 0;
|
||||
|
||||
// open the items...
|
||||
while((currentClass = [en nextObject]) != nil)
|
||||
{
|
||||
[classesView expandItem: currentClass];
|
||||
}
|
||||
|
||||
// select the item...
|
||||
row = [classesView rowForItem: className];
|
||||
[classesView selectRow: row byExtendingSelection: NO];
|
||||
[classesView scrollRowToVisible: row];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
- (void) changeView: (id)sender
|
||||
{
|
||||
int tag = [[sender selectedCell] tag];
|
||||
|
@ -437,16 +466,26 @@ static NSImage *classesImage = nil;
|
|||
switch (tag)
|
||||
{
|
||||
case 0: // objects
|
||||
[selectionBox setContentView: scrollView];
|
||||
{
|
||||
[selectionBox setContentView: scrollView];
|
||||
NSLog(@"Switching to objects");
|
||||
}
|
||||
break;
|
||||
case 1: // images
|
||||
[selectionBox setContentView: imagesScrollView];
|
||||
{
|
||||
[selectionBox setContentView: imagesScrollView];
|
||||
}
|
||||
break;
|
||||
case 2: // sounds
|
||||
[selectionBox setContentView: soundsScrollView];
|
||||
{
|
||||
[selectionBox setContentView: soundsScrollView];
|
||||
}
|
||||
break;
|
||||
case 3: // classes
|
||||
[selectionBox setContentView: classesScrollView];
|
||||
{
|
||||
[selectionBox setContentView: classesScrollView];
|
||||
[self _selectClass];
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue