forked from pmougin/F-Script
-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathFSGenericObjectInspector.m
53 lines (42 loc) · 1.42 KB
/
FSGenericObjectInspector.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
// FSGenericObjectInspector.m Copyright (c) 2001-2009 Philippe Mougin.
// This software is open source. See the license.
#import "FSGenericObjectInspector.h"
#import "FSMiscTools.h"
static NSPoint topLeftPoint = {0,0}; // Used for cascading windows.
@implementation FSGenericObjectInspector
+(FSGenericObjectInspector *)genericObjectInspectorWithObject:(id)object
{
return [[[self alloc] initWithObject:object] autorelease];
}
-(FSGenericObjectInspector *)initWithObject:(id)object
{
if ((self = [super init]))
{
inspectedObject = [object retain];
[NSBundle loadNibNamed:@"genObjInspector.nib" owner:self];
[self retain]; // To balance the autorelease in windowWillClose:
[self updateAction:nil];
topLeftPoint = [window cascadeTopLeftFromPoint:topLeftPoint];
[window makeKeyAndOrderFront:nil];
return self;
}
return nil;
}
-(void) dealloc
{
//NSLog(@"\n FSGenericObjectInspector dealloc\n");
[inspectedObject release];
[super dealloc];
}
- (void)updateAction:(id)sender
{
[window setTitle:[NSString stringWithFormat:@"Inspecting %@ at address %p",descriptionForFSMessage(inspectedObject), inspectedObject]];
[printStringView setFont:[NSFont userFixedPitchFontOfSize:userFixedPitchFontSize()]];
[printStringView setString:printString(inspectedObject)];
}
/////////////////// Window delegate callbacks
- (void)windowWillClose:(NSNotification *)aNotification
{
[self autorelease];
}
@end