Correct flipped drawing of progress bar.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@28919 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Fred Kiefer 2009-10-30 08:26:48 +00:00
parent 26ce4eb477
commit fc666eeb69
2 changed files with 25 additions and 6 deletions

View file

@ -1,3 +1,7 @@
2009-10-29 Fred Kiefer <FredKiefer@gmx.de>
* Source/NSProgressIndicator.m: Correct flipped drawing.
2009-10-28 Fred Kiefer <FredKiefer@gmx.de>
* Source/NSProgressIndicator.m: Fill more methods.

View file

@ -4,6 +4,8 @@
Author: Gerrit van Dyk <gerritvd@decimax.com>
Date: 1999
Author: Fred Kiefer <fredkiefer@gmx.de>
Date: 2009
This file is part of the GNUstep GUI Library.
@ -120,7 +122,7 @@ static NSImage *spinningImages[MaxCount];
- (void)animate:(id)sender
{
if (!_isIndeterminate)
if (!_isIndeterminate && (_style == NSProgressIndicatorBarStyle))
return;
_count++;
@ -139,7 +141,8 @@ static NSImage *spinningImages[MaxCount];
- (void)setAnimationDelay:(NSTimeInterval)delay
{
_animationDelay = delay;
if (_isRunning && _isIndeterminate)
if (_isRunning && (_isIndeterminate
|| (_style == NSProgressIndicatorSpinningStyle)))
{
[self stopAnimation: self];
[self startAnimation: self];
@ -160,7 +163,8 @@ static NSImage *spinningImages[MaxCount];
- (void)startAnimation:(id)sender
{
if (!_isIndeterminate || _isRunning)
if (_isRunning || (!_isIndeterminate
&& (_style == NSProgressIndicatorBarStyle)))
return;
_isRunning = YES;
@ -182,7 +186,8 @@ static NSImage *spinningImages[MaxCount];
- (void)stopAnimation:(id)sender
{
if (!_isIndeterminate || !_isRunning)
if (!_isRunning || (!_isIndeterminate
&& (_style == NSProgressIndicatorBarStyle)))
return;
if (!_usesThreadedAnimation)
@ -253,6 +258,8 @@ static NSImage *spinningImages[MaxCount];
if (_minValue != newMinimum)
{
_minValue = newMinimum;
if (_minValue > _doubleValue)
_doubleValue = _minValue;
[self setNeedsDisplay: YES];
}
}
@ -267,6 +274,8 @@ static NSImage *spinningImages[MaxCount];
if (_maxValue != newMaximum)
{
_maxValue = newMaximum;
if (_maxValue < _doubleValue)
_doubleValue = _maxValue;
[self setNeedsDisplay: YES];
}
}
@ -357,6 +366,9 @@ static NSImage *spinningImages[MaxCount];
{
NSRect r;
if (!_isRunning && !_isDisplayedWhenStopped)
return;
// Draw the Bezel
if (_isBezeled)
{
@ -401,8 +413,11 @@ static NSImage *spinningImages[MaxCount];
{
float height = NSHeight(r) * (val / (_maxValue - _minValue));
// Compensate for the flip
r.origin.y = NSHeight(r) - height;
if ([self isFlipped])
{
// Compensate for the flip
r.origin.y += NSHeight(r) - height;
}
r.size.height = height;
}
else