From 6715fbbce2c2729535a14d332e8a62717dd9614c Mon Sep 17 00:00:00 2001 From: Alexander Ljungberg Date: Thu, 3 May 2012 20:27:05 +0100 Subject: [PATCH] nib2cib support for CPProgressIndicator size. Fixed: a regular size spinner in IB became twice as large in Cappuccino. --- Tools/nib2cib/NSProgressIndicator.j | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/Tools/nib2cib/NSProgressIndicator.j b/Tools/nib2cib/NSProgressIndicator.j index 11d8bae12..37113f000 100644 --- a/Tools/nib2cib/NSProgressIndicator.j +++ b/Tools/nib2cib/NSProgressIndicator.j @@ -40,7 +40,14 @@ var NSProgressIndicatorSpinningFlag = 1 << 12; _style = (NS_flags & NSProgressIndicatorSpinningFlag) ? CPProgressIndicatorSpinningStyle : CPProgressIndicatorBarStyle; _isIndeterminate = (NS_flags & 2) ? YES : NO; _isDisplayedWhenStopped = (NS_flags & 8192) ? NO : YES; - _controlSize = CPRegularControlSize; + _controlSize = (NS_flags & 256) ? CPSmallControlSize : CPRegularControlSize; + + if (_style === CPProgressIndicatorSpinningStyle) + { + // For whatever reason, our 'regular' size is larger than any Cocoa size, our 'small' size is Cocoa's regular and + // our 'mini' size is Cocoa's small. + _controlSize = _controlSize == CPRegularControlSize ? CPSmallControlSize : CPMiniControlSize; + } // There is a bug in Xcode. the currentValue is not stored. // Let's set it to 0.0 for now. @@ -48,12 +55,7 @@ var NSProgressIndicatorSpinningFlag = 1 << 12; // Readjust the height of the control to the correct size. var currentFrameSize = [self frameSize]; - if (_style == CPProgressIndicatorSpinningStyle) - { - currentFrameSize.height = 64.0; - currentFrameSize.width = 64.0; - } - else + if (_style !== CPProgressIndicatorSpinningStyle) currentFrameSize.height = 15.0; [self setFrameSize:currentFrameSize];