Fix for duplicate call to setView:. Also eliminates a recursive notification loop.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/apps/gorm/trunk@21136 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Gregory John Casamento 2005-04-21 04:41:57 +00:00
parent 564893d37a
commit a685897ef9
3 changed files with 26 additions and 4 deletions

View file

@ -1,3 +1,8 @@
2005-04-21 00:39 Gregory John Casamento <greg_casamento@yahoo.com>
* GormCore/GormViewEditor.m: Fix for double "setView:" call.
* GormCore/GormViewWindow.m: Code cleanup.
2005-04-20 23:00 Gregory John Casamento <greg_casamento@yahoo.com>
* GormCore/GormObjectEditor.m: Added copyright information.

View file

@ -158,7 +158,10 @@ static BOOL currently_displaying = NO;
// if the view window is not nil, it's a standalone view...
if(viewWindow != nil)
{
[viewWindow setView: _editedObject];
if([viewWindow view] != _editedObject)
{
[viewWindow setView: _editedObject];
}
}
superview = [_editedObject superview];
@ -181,7 +184,7 @@ static BOOL currently_displaying = NO;
}
[self addSubview: _editedObject];
[_editedObject setPostsFrameChangedNotifications: YES];
[[NSNotificationCenter defaultCenter]
addObserver: self

View file

@ -56,7 +56,8 @@
NSWindow *window = [_view window];
NSRect windowFrame = [window frame];
// if the view is uninitialized, it's new... give it size.
// if the view is uninitialized,
// it's new... give it size.
if(NSIsEmptyRect([_view frame]))
{
NSRect newFrame = windowFrame;
@ -65,7 +66,9 @@
newFrame.origin.y = 20;
newFrame.size.height -= 70;
newFrame.size.width -= 20;
[_view setPostsFrameChangedNotifications: NO];
[_view setFrame: newFrame];
[_view setPostsFrameChangedNotifications: YES];
}
else // otherwise take size from it.
{
@ -87,12 +90,23 @@
NSWindow *window = [_view window];
NSRect windowFrame = [window frame];
NSRect newFrame = windowFrame;
NSRect viewFrame = [_view frame];
newFrame.origin.x = 10;
newFrame.origin.y = 20;
newFrame.size.height -= 70;
newFrame.size.width -= 20;
[_view setFrame: newFrame];
if(NSIsEmptyRect(viewFrame))
{
[_view setPostsFrameChangedNotifications: NO];
[_view setFrame: newFrame];
[_view setPostsFrameChangedNotifications: YES];
}
else
{
[_view setFrame: newFrame];
}
}
@end