Reconcile the position of a view with it's parent. Ensures that the subview will always be pasted into a viewable area.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/apps/gorm/trunk@20527 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Gregory John Casamento 2005-01-08 17:30:09 +00:00
parent 452e9e9d0f
commit 82e6a77348
2 changed files with 19 additions and 0 deletions

View file

@ -1,3 +1,9 @@
2005-01-08 12:28 Gregory John Casamento <greg_casamento@yahoo.com>
* GormViewWithContentViewEditor.m: Change in pasteInView: to
move a view to the origin if it's rect is outside the view it's
being placed into.
2005-01-03 23:56 Gregory John Casamento <greg_casamento@yahoo.com>
* GormDocument.m: Improved resource handling in saveGormDocument:

View file

@ -1221,6 +1221,19 @@ int _sortViews(id view1, id view2, void *context)
{
if ([sub isKindOfClass: [NSView class]] == YES)
{
//
// Correct the frame if it is outside of the containing view.
// this prevents issues where the subview is placed outside the
// viewable region of the superview.
//
if(NSContainsRect([view frame], [sub frame]) == NO)
{
NSRect newFrame = [sub frame];
newFrame.origin.x = 0;
newFrame.origin.y = 0;
[sub setFrame: newFrame];
}
[view addSubview: sub];
[self _addViewToDocument: sub];
[array addObject: