mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-06-01 16:21:56 +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
d01fcd0e58
commit
e4a081f773
1 changed files with 9 additions and 70 deletions
|
@ -583,15 +583,13 @@ static void initSystemExtensionsColors(void)
|
||||||
- (void) _takeInAccountFlexibleSpaces
|
- (void) _takeInAccountFlexibleSpaces
|
||||||
{
|
{
|
||||||
NSArray *items = [_toolbar items];
|
NSArray *items = [_toolbar items];
|
||||||
NSEnumerator *e;
|
NSEnumerator *e = [items objectEnumerator];
|
||||||
NSToolbarItem *item;
|
NSToolbarItem *item;
|
||||||
NSView *backView;
|
NSView *backView;
|
||||||
NSRect lastBackViewFrame;
|
NSRect lastBackViewFrame;
|
||||||
float lengthAvailable;
|
float lengthAvailable;
|
||||||
unsigned int flexibleSpaceItemsNumber;
|
unsigned int flexibleSpaceItemsNumber = 0;
|
||||||
unsigned int resizableItemsNumber;
|
BOOL mustAdjustNext = NO;
|
||||||
float resizableSpaceFromMins;
|
|
||||||
BOOL mustAdjustNext;
|
|
||||||
float x = 0;
|
float x = 0;
|
||||||
|
|
||||||
if ([items count] == 0)
|
if ([items count] == 0)
|
||||||
|
@ -603,36 +601,17 @@ static void initSystemExtensionsColors(void)
|
||||||
if (lengthAvailable < 1)
|
if (lengthAvailable < 1)
|
||||||
return;
|
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)
|
while ((item = [e nextObject]) != nil)
|
||||||
|
{
|
||||||
|
if ([item _isFlexibleSpace])
|
||||||
{
|
{
|
||||||
float currWidth;
|
flexibleSpaceItemsNumber++;
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
NSLog(@"length available 1: %f", lengthAvailable);
|
}
|
||||||
NSLog(@"resizable space %f in %d items", resizableSpaceFromMins, resizableItemsNumber);
|
|
||||||
if (flexibleSpaceItemsNumber < 1 && resizableSpaceFromMins <= 0)
|
if (lengthAvailable < flexibleSpaceItemsNumber)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
mustAdjustNext = NO;
|
|
||||||
e = [items objectEnumerator];
|
e = [items objectEnumerator];
|
||||||
while ((item = [e nextObject]) != nil)
|
while ((item = [e nextObject]) != nil)
|
||||||
{
|
{
|
||||||
|
@ -655,47 +634,7 @@ static void initSystemExtensionsColors(void)
|
||||||
}
|
}
|
||||||
x += [backView frame].size.width;
|
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
|
- (void) _handleViewsVisibility
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue