mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-05-31 20:40:47 +00:00
fix c99-ism
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@29756 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
5c1cbe5755
commit
776d5aa982
3 changed files with 79 additions and 11 deletions
|
@ -1,3 +1,7 @@
|
||||||
|
2010-02-25 Riccardo Mottola <rmottola@users.sf.net>
|
||||||
|
|
||||||
|
* Source/NSDrawer.m: removed c99-isms
|
||||||
|
|
||||||
2010-02-24 Richard Frith-Macdonald <rfm@gnu.org>
|
2010-02-24 Richard Frith-Macdonald <rfm@gnu.org>
|
||||||
|
|
||||||
* Source/NSPasteboard.m: remove obsolete code for setting up invocation.
|
* Source/NSPasteboard.m: remove obsolete code for setting up invocation.
|
||||||
|
|
|
@ -509,13 +509,15 @@ static const int current_version = 1;
|
||||||
- (void) _takeInAccountFlexibleSpaces
|
- (void) _takeInAccountFlexibleSpaces
|
||||||
{
|
{
|
||||||
NSArray *items = [_toolbar items];
|
NSArray *items = [_toolbar items];
|
||||||
NSEnumerator *e = [items objectEnumerator];
|
NSEnumerator *e;
|
||||||
NSToolbarItem *item;
|
NSToolbarItem *item;
|
||||||
NSView *backView;
|
NSView *backView;
|
||||||
NSRect lastBackViewFrame;
|
NSRect lastBackViewFrame;
|
||||||
float lengthAvailable;
|
float lengthAvailable;
|
||||||
unsigned int flexibleSpaceItemsNumber = 0;
|
unsigned int flexibleSpaceItemsNumber;
|
||||||
BOOL mustAdjustNext = NO;
|
unsigned int resizableItemsNumber;
|
||||||
|
float resizableSpaceFromMins;
|
||||||
|
BOOL mustAdjustNext;
|
||||||
float x = 0;
|
float x = 0;
|
||||||
|
|
||||||
if ([items count] == 0)
|
if ([items count] == 0)
|
||||||
|
@ -527,17 +529,36 @@ static const int current_version = 1;
|
||||||
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])
|
|
||||||
{
|
{
|
||||||
flexibleSpaceItemsNumber++;
|
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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
NSLog(@"length available 1: %f", lengthAvailable);
|
||||||
|
NSLog(@"resizable space %f in %d items", resizableSpaceFromMins, resizableItemsNumber);
|
||||||
if (lengthAvailable < flexibleSpaceItemsNumber)
|
if (flexibleSpaceItemsNumber < 1 && resizableSpaceFromMins <= 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
mustAdjustNext = NO;
|
||||||
e = [items objectEnumerator];
|
e = [items objectEnumerator];
|
||||||
while ((item = [e nextObject]) != nil)
|
while ((item = [e nextObject]) != nil)
|
||||||
{
|
{
|
||||||
|
@ -560,7 +581,47 @@ static const int current_version = 1;
|
||||||
}
|
}
|
||||||
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
|
||||||
|
|
|
@ -112,6 +112,7 @@ static NSNotificationCenter *nc = nil;
|
||||||
{
|
{
|
||||||
NSRect rect = contentRect;
|
NSRect rect = contentRect;
|
||||||
NSRect border = contentRect;
|
NSRect border = contentRect;
|
||||||
|
NSSize containerContentSize;
|
||||||
|
|
||||||
rect.origin.x += 6;
|
rect.origin.x += 6;
|
||||||
rect.origin.y += 6;
|
rect.origin.y += 6;
|
||||||
|
@ -140,7 +141,7 @@ static NSNotificationCenter *nc = nil;
|
||||||
[_borderBox addSubview: _container];
|
[_borderBox addSubview: _container];
|
||||||
|
|
||||||
// determine the difference between the container's content size and the window content size
|
// determine the difference between the container's content size and the window content size
|
||||||
NSSize containerContentSize = [[_container contentView] frame].size;
|
containerContentSize = [[_container contentView] frame].size;
|
||||||
_borderSize = NSMakeSize(contentRect.size.width - containerContentSize.width,
|
_borderSize = NSMakeSize(contentRect.size.width - containerContentSize.width,
|
||||||
contentRect.size.height - containerContentSize.height);
|
contentRect.size.height - containerContentSize.height);
|
||||||
}
|
}
|
||||||
|
@ -339,12 +340,14 @@ static NSNotificationCenter *nc = nil;
|
||||||
|
|
||||||
- (void) closeOnEdge
|
- (void) closeOnEdge
|
||||||
{
|
{
|
||||||
|
NSRect frame;
|
||||||
|
|
||||||
[self stopTimer];
|
[self stopTimer];
|
||||||
[self lockBorderBoxForSliding];
|
[self lockBorderBoxForSliding];
|
||||||
[self slideOpen:NO];
|
[self slideOpen:NO];
|
||||||
[self orderOut: self];
|
[self orderOut: self];
|
||||||
|
|
||||||
NSRect frame = [self frameFromParentWindowFrameInState:NSDrawerOpenState];
|
frame = [self frameFromParentWindowFrameInState:NSDrawerOpenState];
|
||||||
[self setFrame:frame display: YES]; // make sure it's the full (open) size again (offscreen) before unlocking
|
[self setFrame:frame display: YES]; // make sure it's the full (open) size again (offscreen) before unlocking
|
||||||
[self performSelector:@selector(unlockBorderBoxAfterSliding) withObject:nil afterDelay:0.01];
|
[self performSelector:@selector(unlockBorderBoxAfterSliding) withObject:nil afterDelay:0.01];
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue