mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-22 18:11:06 +00:00
Fix badly placed #endif
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@5269 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
d893d16629
commit
82b2d93762
2 changed files with 59 additions and 55 deletions
|
@ -1,3 +1,7 @@
|
|||
Wed Nov 24 16:58:00 1999 Richard Frith-Macdonald <richard@brainstorm.co.uk>
|
||||
|
||||
* Source/NSMenuView.m: ([-sizeTofit]) oops - fixed error in last mod.
|
||||
|
||||
Wed Nov 24 1999 Nicola Pero <n.pero@mi.flashnet.it>
|
||||
|
||||
The three new autolayout classes; code extremely stable, API
|
||||
|
|
|
@ -392,71 +392,71 @@ static float GSMenuBarHeight = 25.0; // A wild guess.
|
|||
return menuv_needsSizing;
|
||||
}
|
||||
|
||||
- (void)sizeToFit
|
||||
- (void) sizeToFit
|
||||
{
|
||||
int i;
|
||||
int howMany = [menuv_itemCells count];
|
||||
float howHigh = (howMany * cellSize.height);
|
||||
float neededImageAndTitleWidth = [[NSFont boldSystemFontOfSize: 12]
|
||||
widthOfString: [menuv_menu title]] + 17;
|
||||
float neededKeyEquivalentWidth = 0.;
|
||||
float neededStateImageWidth = 0.;
|
||||
float accumulatedOffset = 0.;
|
||||
unsigned i;
|
||||
unsigned howMany = [menuv_itemCells count];
|
||||
float howHigh = (howMany * cellSize.height);
|
||||
float neededImageAndTitleWidth = [[NSFont boldSystemFontOfSize: 12]
|
||||
widthOfString: [menuv_menu title]] + 17;
|
||||
float neededKeyEquivalentWidth = 0.;
|
||||
float neededStateImageWidth = 0.;
|
||||
float accumulatedOffset = 0.;
|
||||
|
||||
// TODO: Optimize this loop.
|
||||
for (i = 0; i < howMany; i++)
|
||||
{
|
||||
float anImageAndTitleWidth;
|
||||
float anImageWidth;
|
||||
float aKeyEquivalentWidth;
|
||||
float aStateImageWidth;
|
||||
float aTitleWidth;
|
||||
NSMenuItemCell *aCell = [menuv_itemCells objectAtIndex: i];
|
||||
{
|
||||
float anImageAndTitleWidth;
|
||||
float anImageWidth;
|
||||
float aKeyEquivalentWidth;
|
||||
float aStateImageWidth;
|
||||
float aTitleWidth;
|
||||
NSMenuItemCell *aCell = [menuv_itemCells objectAtIndex: i];
|
||||
|
||||
// State image area.
|
||||
aStateImageWidth = [aCell stateImageWidth];
|
||||
// State image area.
|
||||
aStateImageWidth = [aCell stateImageWidth];
|
||||
|
||||
if (aStateImageWidth > neededStateImageWidth)
|
||||
neededStateImageWidth = aStateImageWidth;
|
||||
if (aStateImageWidth > neededStateImageWidth)
|
||||
neededStateImageWidth = aStateImageWidth;
|
||||
|
||||
// Image and title area.
|
||||
aTitleWidth = [aCell titleWidth];
|
||||
anImageWidth = [aCell imageWidth];
|
||||
switch ([aCell imagePosition])
|
||||
{
|
||||
case NSNoImage:
|
||||
anImageAndTitleWidth = aTitleWidth;
|
||||
break;
|
||||
// Image and title area.
|
||||
aTitleWidth = [aCell titleWidth];
|
||||
anImageWidth = [aCell imageWidth];
|
||||
switch ([aCell imagePosition])
|
||||
{
|
||||
case NSNoImage:
|
||||
anImageAndTitleWidth = aTitleWidth;
|
||||
break;
|
||||
|
||||
case NSImageOnly:
|
||||
anImageAndTitleWidth = anImageWidth;
|
||||
break;
|
||||
case NSImageOnly:
|
||||
anImageAndTitleWidth = anImageWidth;
|
||||
break;
|
||||
|
||||
case NSImageLeft:
|
||||
case NSImageRight:
|
||||
anImageAndTitleWidth = anImageWidth + aTitleWidth + xDist;
|
||||
break;
|
||||
case NSImageLeft:
|
||||
case NSImageRight:
|
||||
anImageAndTitleWidth = anImageWidth + aTitleWidth + xDist;
|
||||
break;
|
||||
|
||||
case NSImageBelow:
|
||||
case NSImageAbove:
|
||||
case NSImageOverlaps:
|
||||
default:
|
||||
if (aTitleWidth > anImageWidth)
|
||||
anImageAndTitleWidth = aTitleWidth;
|
||||
else
|
||||
anImageAndTitleWidth = anImageWidth;
|
||||
break;
|
||||
}
|
||||
anImageAndTitleWidth += aStateImageWidth;
|
||||
if (anImageAndTitleWidth > neededImageAndTitleWidth)
|
||||
neededImageAndTitleWidth = anImageAndTitleWidth;
|
||||
case NSImageBelow:
|
||||
case NSImageAbove:
|
||||
case NSImageOverlaps:
|
||||
default:
|
||||
if (aTitleWidth > anImageWidth)
|
||||
anImageAndTitleWidth = aTitleWidth;
|
||||
else
|
||||
anImageAndTitleWidth = anImageWidth;
|
||||
break;
|
||||
}
|
||||
anImageAndTitleWidth += aStateImageWidth;
|
||||
if (anImageAndTitleWidth > neededImageAndTitleWidth)
|
||||
neededImageAndTitleWidth = anImageAndTitleWidth;
|
||||
|
||||
// Key equivalent area.
|
||||
aKeyEquivalentWidth = [aCell keyEquivalentWidth];
|
||||
// Key equivalent area.
|
||||
aKeyEquivalentWidth = [aCell keyEquivalentWidth];
|
||||
|
||||
if (aKeyEquivalentWidth > neededKeyEquivalentWidth)
|
||||
neededKeyEquivalentWidth = aKeyEquivalentWidth;
|
||||
}
|
||||
if (aKeyEquivalentWidth > neededKeyEquivalentWidth)
|
||||
neededKeyEquivalentWidth = aKeyEquivalentWidth;
|
||||
}
|
||||
|
||||
// Cache the needed widths.
|
||||
menuv_stateImageWidth = neededStateImageWidth;
|
||||
|
@ -474,15 +474,15 @@ static float GSMenuBarHeight = 25.0; // A wild guess.
|
|||
// Calculate frame size.
|
||||
#if 0
|
||||
if (![menuv_menu _isBeholdenToPopUpButton])
|
||||
cellSize.width = accumulatedOffset + 3; // Add the border width
|
||||
#endif
|
||||
cellSize.width = accumulatedOffset + 3; // Add the border width
|
||||
|
||||
[self setFrameSize: NSMakeSize(cellSize.width + 1, howHigh)];
|
||||
|
||||
menuv_needsSizing = NO;
|
||||
}
|
||||
|
||||
- (void)sizeToFitForPopUpButton
|
||||
- (void) sizeToFitForPopUpButton
|
||||
{
|
||||
int howHigh = ([menuv_items_link count] * cellSize.height);
|
||||
|
||||
|
|
Loading…
Reference in a new issue