Made some enhancements to class manager and inspector manager. General

clean up and corrected some bugs.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/apps/gorm/trunk@16788 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Gregory John Casamento 2003-05-25 19:08:36 +00:00
parent 819aa1e91b
commit 194f1b0d9e
6 changed files with 125 additions and 25 deletions

View file

@ -1,3 +1,14 @@
2003-05-24 Gregory John Casamento <greg_casamento@yahoo.com>
* GormInspectorsManager.m: Made changes to revert inspector to
"empty" when a document is closed.
* GormClassManager.m: Prevent user from adding methods to FirstResponder.
FirstResponder now automatically adds all action methods to it's action.
* GormDocument.m: Corrected a problem which was allowing the user to
instantiate FirstResponder.
* Gorm.m: Cleaned up some places where I was using (Gorm *) and should
have been using (id<IB>).
2003-05-25 Fabien Vallon <fabien@tuxfamily>
* Gorm.m : fix typo
@ -41,14 +52,16 @@
* GormCustomClassEditor.[hm]: Removed Gorm.h header reference.
* GormDocument.h: Added some headers.
* GormDocument.m: General code cleanup. Removed Notifications which
will be in GormLib classes. Implemented use of "awakeFromDocument:" a new
method defined in GormLib which allows implemention of behavior when
a class is loaded by Gorm. (see Apple's interface builder framework)
will be in GormLib classes. Implemented use of "awakeFromDocument:"
a new method defined in GormLib which allows implemention of
behavior when a class is loaded by Gorm. (see Apple's interface
builder framework)
* GormFilesOwner.m: Added NSNibConnector header which was previously
provided by Gorm.h. This was the only include needed here.
* GormInspectorsManager.m: Same as above.
* GormPrivate.h: Added GPL notice and include for InterfaceBuilder.h
* GormSoundInspector.h: Corrected description for GormSoundInspector class.
* GormSoundInspector.h: Corrected description for GormSoundInspector
class.
* Palettes: Updated all palettes in the palettes directory to include
the new headers.
* GormLib/GNUmakefile: new file.

4
Gorm.m
View file

@ -1560,7 +1560,7 @@ static NSButtonType _buttonTypeForObject( id button )
sel_eq(action, @selector(addAttributeToClass:)) ||
sel_eq(action, @selector(remove:)))
{
id document = [(Gorm *)NSApp activeDocument];
id document = [(id<IB>)NSApp activeDocument];
if(document == nil)
{
return NO;
@ -1576,7 +1576,7 @@ static NSButtonType _buttonTypeForObject( id button )
sel_eq(action, @selector(loadImage:)) ||
sel_eq(action, @selector(debug:)))
{
id document = [(Gorm *)NSApp activeDocument];
id document = [(id<IB>)NSApp activeDocument];
if(document == nil)
{
return NO;

View file

@ -206,6 +206,10 @@
[extraActions addObject: anAction];
[[info objectForKey: @"AllActions"] insertObject: anAction atIndex: 0];
if(![className isEqualToString: @"FirstResponder"])
{
[self addAction: anAction forClassNamed: @"FirstResponder"];
}
}
- (void) addOutlet: (NSString *)anOutlet forClassNamed: (NSString *)className
@ -260,6 +264,10 @@
[actions replaceObjectAtIndex: actions_index withObject: newAction];
[allActions replaceObjectAtIndex: all_index withObject: newAction];
}
if(![className isEqualToString: @"FirstResponder"])
{
[self replaceAction: oldAction withAction: newAction forClassNamed: @"FirstResponder"];
}
}
- (void) replaceOutlet: (NSString *)oldOutlet
@ -812,6 +820,10 @@
}
[extraActions removeObject: anAction];
}
if(![className isEqualToString: @"FirstResponder"])
{
[self removeAction: anAction fromClassNamed: @"FirstResponder"];
}
}
- (void) removeOutlet: (NSString*)anOutlet forObject: (id)anObject
@ -1046,7 +1058,8 @@
- (BOOL) isCustomClass: (NSString *)className
{
return ([customClasses indexOfObject: className] != NSNotFound);
return ([customClasses indexOfObject: className] != NSNotFound &&
![className isEqualToString: @"FirstResponder"]);
}
- (BOOL) isKnownClass: (NSString *)className

View file

@ -420,7 +420,7 @@ static NSImage *classesImage = nil;
/*
* Method to replace custom objects with templates for archiving.
*/
if (![(Gorm *)NSApp isTestingInterface]) // if we arent testing the interface, substitute the templates when appropriate.
if (![(id<IB>)NSApp isTestingInterface]) // if we arent testing the interface, substitute the templates when appropriate.
{
[self _replaceObjectsWithTemplates];
}
@ -1165,7 +1165,7 @@ static NSImage *classesImage = nil;
/*
* Make sure that this editor is not the selection owner.
*/
if ([(Gorm *)NSApp selectionOwner] ==
if ([(id<IB>)NSApp selectionOwner] ==
anEditor)
{
[self resignSelectionForEditor: anEditor];
@ -1319,7 +1319,7 @@ static NSImage *classesImage = nil;
/*
* Method to replace custom templates with objects for archiving.
*/
if (![(Gorm *)NSApp isTestingInterface])
if (![(id<IB>)NSApp isTestingInterface])
// do not use templates if we are testing.
{
[self _replaceTemplatesWithObjects];
@ -1779,6 +1779,10 @@ static NSImage *classesImage = nil;
if (i >= 0)
{
id className = [classesView itemAtRow: i];
if([className isEqualToString: @"FirstResponder"])
return nil;
GSNibItem *item =
[[GormObjectProxy alloc] initWithClassName: className
frame: NSMakeRect(0,0,0,0)];
@ -1793,7 +1797,7 @@ static NSImage *classesImage = nil;
}
return nil;
return self;
}
- (BOOL) isActive

View file

@ -16,6 +16,7 @@
}
- (NSPanel*) panel;
- (void) setClassInspector;
- (void) setEmptyInspector;
- (void) setCurrentInspector: (id)anObject;
- (void) updateSelection;
@end

View file

@ -197,6 +197,12 @@
// [NSApp stopConnecting];
}
}
else if ([name isEqual: IBWillCloseDocumentNotification] == YES)
{
// show an empty selection of the document closes
[self setEmptyInspector];
// [panel orderOut: self];
}
}
- (id) init
@ -304,21 +310,29 @@
[self setCurrentInspector: 0];
[nc addObserver: self
selector: @selector(handleNotification:)
name: IBWillBeginTestingInterfaceNotification
object: nil];
selector: @selector(handleNotification:)
name: IBWillBeginTestingInterfaceNotification
object: nil];
[nc addObserver: self
selector: @selector(handleNotification:)
name: IBWillEndTestingInterfaceNotification
object: nil];
selector: @selector(handleNotification:)
name: IBWillEndTestingInterfaceNotification
object: nil];
[nc addObserver: self
selector: @selector(handleNotification:)
name: NSWindowDidResignKeyNotification
object: panel];
selector: @selector(handleNotification:)
name: NSWindowDidResignKeyNotification
object: panel];
[nc addObserver: self
selector: @selector(updateInspectorPopUp:)
name: NSPopUpButtonWillPopUpNotification
object: popup];
selector: @selector(updateInspectorPopUp:)
name: NSPopUpButtonWillPopUpNotification
object: popup];
[nc addObserver: self
selector: @selector(handleNotification:)
name: NSPopUpButtonWillPopUpNotification
object: popup];
[nc addObserver: self
selector: @selector(handleNotification:)
name: IBWillCloseDocumentNotification
object: [(id<IB>)NSApp activeDocument]];
[popup setTarget: self];
[popup setAction: @selector(updateInspectorPopUp:)];
return self;
@ -351,6 +365,45 @@
[self setCurrentInspector: self];
}
- (void) setEmptyInspector
{
NSString *newInspector = @"GormEmptyInspector";
NSView *newView = nil;
// current = 1;
[panel setTitle: @"Inspector"];
inspector = [cache objectForKey: newInspector];
if(inspector == nil)
{
Class c = NSClassFromString(newInspector);
inspector = [c new];
}
newView = [[inspector window] contentView];
if (newView != nil)
{
NSView *outer = [panel contentView];
NSRect rect = [outer bounds];
if (buttonView != nil)
{
[buttonView removeFromSuperview];
buttonView = nil;
}
rect.size.height = [selectionView frame].origin.y;
/*
* Make the inspector view the correct size for the viewable panel,
* and set the frame size for the new contents before adding them.
*/
[inspectorView setFrame: rect];
rect.origin = NSZeroPoint;
[newView setFrame: rect];
[inspectorView addSubview: newView];
}
}
- (void) setCurrentInspector: (id)anObj
{
NSArray *selection = [[(id<IB>)NSApp selectionOwner] selection];
@ -507,7 +560,7 @@
if (revert != nil)
{
bRect = [revert frame];
bRect.origin.y = 10;
bRect.origin.y = 10;
bRect.origin.x = 10;
[revert setFrame: bRect];
[buttonView addSubview: revert];
@ -916,11 +969,21 @@ selectCellWithString: (NSString*)title
[super dealloc];
}
- (void) handleNotification: (NSNotification *)notification
{
// got the notification... since we only subscribe to one, just do what
// needs to be done.
[self setObject: object];
// [newBrowser loadColumnZero];
[self _internalCall: newBrowser]; // reload the connections browser..
}
- (id) init
{
self = [super init];
if (self != nil)
{
NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];
NSView *contents;
NSSplitView *split;
NSRect rect;
@ -975,6 +1038,12 @@ selectCellWithString: (NSString*)title
[revertButton setTarget: self];
[revertButton setTitle: _(@"Revert")];
[revertButton setEnabled: NO];
// catch notifications concerning connection deletions...
[nc addObserver: self
selector: @selector(handleNotification:)
name: IBDidRemoveConnectorNotification
object: nil];
}
return self;
}
@ -1062,7 +1131,7 @@ selectCellWithString: (NSString*)title
- (void) setObject: (id)anObject
{
if (anObject != nil && anObject != object)
if (anObject != nil) // && anObject != object)
{
NSArray *array;