mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-23 15:11:37 +00:00
Cleaned resizeWithOldSuperviewSize:
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@11923 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
4fc0a44d47
commit
0f19567490
1 changed files with 12 additions and 39 deletions
|
@ -1273,55 +1273,38 @@ GSSetDragTypes(NSView* obj, NSArray *types)
|
|||
|
||||
- (void) resizeWithOldSuperviewSize: (NSSize)oldSize
|
||||
{
|
||||
float change;
|
||||
float changePerOption;
|
||||
int options = 0;
|
||||
NSRect newFrame, newBounds;
|
||||
NSSize superViewFrameSize = [_super_view frame].size;
|
||||
NSRect newFrame = _frame;
|
||||
BOOL changedOrigin = NO;
|
||||
BOOL changedSize = NO;
|
||||
|
||||
/* FIXME: No need to compute the bounds. setFrame: should do that
|
||||
if needed */
|
||||
|
||||
if (_autoresizingMask == NSViewNotSizable)
|
||||
return;
|
||||
|
||||
newFrame = _frame;
|
||||
newBounds = _bounds;
|
||||
/*
|
||||
* determine if and how the X axis can be resized
|
||||
*/
|
||||
if (_autoresizingMask & NSViewWidthSizable)
|
||||
options++;
|
||||
|
||||
if (_autoresizingMask & NSViewMinXMargin)
|
||||
options++;
|
||||
|
||||
if (_autoresizingMask & NSViewMaxXMargin)
|
||||
options++;
|
||||
|
||||
/*
|
||||
* adjust the X axis if any X options are set in the mask
|
||||
*/
|
||||
if (options >= 1)
|
||||
if (options > 0)
|
||||
{
|
||||
change = superViewFrameSize.width - oldSize.width;
|
||||
changePerOption = change/options;
|
||||
float change = superViewFrameSize.width - oldSize.width;
|
||||
float changePerOption = change / options;
|
||||
|
||||
if (_autoresizingMask & NSViewWidthSizable)
|
||||
{
|
||||
float oldFrameWidth = newFrame.size.width;
|
||||
|
||||
newFrame.size.width += changePerOption;
|
||||
|
||||
if (_is_rotated_or_scaled_from_base)
|
||||
{
|
||||
newBounds.size.width *= newFrame.size.width/oldFrameWidth;
|
||||
}
|
||||
else
|
||||
{
|
||||
newBounds.size.width += changePerOption;
|
||||
}
|
||||
|
||||
changedSize = YES;
|
||||
}
|
||||
if (_autoresizingMask & NSViewMinXMargin)
|
||||
|
@ -1337,34 +1320,24 @@ GSSetDragTypes(NSView* obj, NSArray *types)
|
|||
options = 0;
|
||||
if (_autoresizingMask & NSViewHeightSizable)
|
||||
options++;
|
||||
|
||||
if (_autoresizingMask & NSViewMinYMargin)
|
||||
options++;
|
||||
|
||||
if (_autoresizingMask & NSViewMaxYMargin)
|
||||
options++;
|
||||
|
||||
/*
|
||||
* adjust the Y axis if any Y options are set in the mask
|
||||
*/
|
||||
if (options >= 1)
|
||||
if (options > 0)
|
||||
{
|
||||
change = superViewFrameSize.height - oldSize.height;
|
||||
changePerOption = change/options;
|
||||
|
||||
float change = superViewFrameSize.height - oldSize.height;
|
||||
float changePerOption = change / options;
|
||||
|
||||
if (_autoresizingMask & NSViewHeightSizable)
|
||||
{
|
||||
float oldFrameHeight = newFrame.size.height;
|
||||
|
||||
newFrame.size.height += changePerOption;
|
||||
|
||||
if (_is_rotated_or_scaled_from_base)
|
||||
{
|
||||
newBounds.size.height *= newFrame.size.height/oldFrameHeight;
|
||||
}
|
||||
else
|
||||
{
|
||||
newBounds.size.height += changePerOption;
|
||||
}
|
||||
|
||||
changedSize = YES;
|
||||
}
|
||||
if (_autoresizingMask & (NSViewMaxYMargin | NSViewMinYMargin))
|
||||
|
|
Loading…
Reference in a new issue