mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-23 15:11:37 +00:00
Prevent division by zero exception if a theme has no images for a
spinning or indeterminate progress indicator. Ensure that a running animation is stopped when an indeterminate indicator is changed into a determinate one. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@29136 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
00c843ffc6
commit
06dc196682
3 changed files with 30 additions and 11 deletions
10
ChangeLog
10
ChangeLog
|
@ -1,3 +1,13 @@
|
|||
2009-12-17 Wolfgang Lux <wolfgang.lux@gmail.com>
|
||||
|
||||
* Source/GSThemeDrawing.m (-drawProgressIndicator:withBounds:...):
|
||||
Prevent division by zero exception if no images are available for
|
||||
a spinning or indeterminate progress indicator.
|
||||
|
||||
* Source/NSProgressIndicator.m (-setIndeterminate): Ensure that a
|
||||
running animation is stopped when an indeterminate indicator is
|
||||
changed into a determinate one.
|
||||
|
||||
2009-12-17 Wolfgang Lux <wolfgang.lux@gmail.com>
|
||||
|
||||
* Source/NSComboBoxCell.m (-drawInteriorWithFrame:inView:): Fix
|
||||
|
|
|
@ -834,20 +834,26 @@ static NSImage *spinningImages[MaxCount];
|
|||
{
|
||||
NSRect imgBox = {{0,0}, {0,0}};
|
||||
|
||||
count = count % spinningMaxCount;
|
||||
imgBox.size = [spinningImages[count] size];
|
||||
[spinningImages[count] drawInRect: r
|
||||
fromRect: imgBox
|
||||
operation: NSCompositeSourceOver
|
||||
fraction: 1.0];
|
||||
if (spinningMaxCount != 0)
|
||||
{
|
||||
count = count % spinningMaxCount;
|
||||
imgBox.size = [spinningImages[count] size];
|
||||
[spinningImages[count] drawInRect: r
|
||||
fromRect: imgBox
|
||||
operation: NSCompositeSourceOver
|
||||
fraction: 1.0];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ([progress isIndeterminate])
|
||||
{
|
||||
count = count % indeterminateMaxCount;
|
||||
[indeterminateColors[count] set];
|
||||
NSRectFill(r);
|
||||
if (indeterminateMaxCount != 0)
|
||||
{
|
||||
count = count % indeterminateMaxCount;
|
||||
[indeterminateColors[count] set];
|
||||
NSRectFill(r);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -258,11 +258,14 @@
|
|||
|
||||
- (void) setIndeterminate: (BOOL)flag
|
||||
{
|
||||
_isIndeterminate = flag;
|
||||
// Maybe we need more functionality here when we implement indeterminate
|
||||
/* Note: We must stop a running animation before setting _isIndeterminate
|
||||
because -stopAnimation: has no effect when _isIndeterminate is NO. */
|
||||
if (flag == NO && _isRunning)
|
||||
[self stopAnimation: self];
|
||||
|
||||
_isIndeterminate = flag;
|
||||
// Maybe we need more functionality here when we implement indeterminate
|
||||
|
||||
[self setNeedsDisplay: YES];
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue