mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-24 06:28:54 +00:00
revert accidental commit
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@29758 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
a295ee6455
commit
e0b40e98fc
1 changed files with 9 additions and 70 deletions
|
@ -583,15 +583,13 @@ static void initSystemExtensionsColors(void)
|
|||
- (void) _takeInAccountFlexibleSpaces
|
||||
{
|
||||
NSArray *items = [_toolbar items];
|
||||
NSEnumerator *e;
|
||||
NSEnumerator *e = [items objectEnumerator];
|
||||
NSToolbarItem *item;
|
||||
NSView *backView;
|
||||
NSRect lastBackViewFrame;
|
||||
float lengthAvailable;
|
||||
unsigned int flexibleSpaceItemsNumber;
|
||||
unsigned int resizableItemsNumber;
|
||||
float resizableSpaceFromMins;
|
||||
BOOL mustAdjustNext;
|
||||
unsigned int flexibleSpaceItemsNumber = 0;
|
||||
BOOL mustAdjustNext = NO;
|
||||
float x = 0;
|
||||
|
||||
if ([items count] == 0)
|
||||
|
@ -603,36 +601,17 @@ static void initSystemExtensionsColors(void)
|
|||
if (lengthAvailable < 1)
|
||||
return;
|
||||
|
||||
|
||||
/* search for flexible spaces or for items which are resizable */
|
||||
flexibleSpaceItemsNumber = 0;
|
||||
resizableItemsNumber = 0;
|
||||
resizableSpaceFromMins = 0;
|
||||
e = [items objectEnumerator];
|
||||
while ((item = [e nextObject]) != nil)
|
||||
{
|
||||
if ([item _isFlexibleSpace])
|
||||
{
|
||||
float currWidth;
|
||||
float minWidth;
|
||||
|
||||
currWidth = [[item _backView] frame].size.width;
|
||||
minWidth = [item minSize].width;
|
||||
if ([item _isFlexibleSpace])
|
||||
{
|
||||
flexibleSpaceItemsNumber++;
|
||||
}
|
||||
else if (([item maxSize].width > minWidth) && (currWidth > minWidth))
|
||||
{
|
||||
resizableItemsNumber++;
|
||||
resizableSpaceFromMins += currWidth - minWidth;
|
||||
NSLog(@"%@: min, curr width: %f %f", [item itemIdentifier], minWidth, currWidth);
|
||||
}
|
||||
flexibleSpaceItemsNumber++;
|
||||
}
|
||||
NSLog(@"length available 1: %f", lengthAvailable);
|
||||
NSLog(@"resizable space %f in %d items", resizableSpaceFromMins, resizableItemsNumber);
|
||||
if (flexibleSpaceItemsNumber < 1 && resizableSpaceFromMins <= 0)
|
||||
}
|
||||
|
||||
if (lengthAvailable < flexibleSpaceItemsNumber)
|
||||
return;
|
||||
|
||||
mustAdjustNext = NO;
|
||||
e = [items objectEnumerator];
|
||||
while ((item = [e nextObject]) != nil)
|
||||
{
|
||||
|
@ -655,47 +634,7 @@ static void initSystemExtensionsColors(void)
|
|||
}
|
||||
x += [backView frame].size.width;
|
||||
}
|
||||
|
||||
lastBackViewFrame = [[[items lastObject] _backView] frame];
|
||||
lengthAvailable = [self frame].size.width - NSMaxX(lastBackViewFrame);
|
||||
NSLog(@"length available 2: %f", lengthAvailable);
|
||||
if (lengthAvailable <= 0 || resizableItemsNumber < 0)
|
||||
return;
|
||||
|
||||
/* we adjusted all the flexible spaces, now we can try to adjust views to their minimum */
|
||||
mustAdjustNext = NO;
|
||||
e = [items objectEnumerator];
|
||||
while ((item = [e nextObject]) != nil)
|
||||
{
|
||||
float currWidth;
|
||||
float minWidth;
|
||||
NSRect backViewFrame;
|
||||
|
||||
backView = [item _backView];
|
||||
backViewFrame = [backView frame];
|
||||
currWidth = backViewFrame.size.width;
|
||||
minWidth = [item minSize].width;
|
||||
if (([item maxSize].width > minWidth) && (currWidth > minWidth))
|
||||
{
|
||||
float newWidth;
|
||||
|
||||
newWidth = currWidth - (lengthAvailable / resizableItemsNumber);
|
||||
if (newWidth < minWidth)
|
||||
newWidth = minWidth;
|
||||
|
||||
[backView setFrame: NSMakeRect(x, backViewFrame.origin.y,
|
||||
newWidth,
|
||||
backViewFrame.size.height)];
|
||||
mustAdjustNext = YES;
|
||||
}
|
||||
else if (mustAdjustNext)
|
||||
{
|
||||
[backView setFrame: NSMakeRect(x, backViewFrame.origin.y,
|
||||
backViewFrame.size.width, backViewFrame.size.height)];
|
||||
}
|
||||
x += backViewFrame.size.width;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
- (void) _handleViewsVisibility
|
||||
|
|
Loading…
Reference in a new issue