Use windows-like spinning images for GNUstep (currently windows AND linux platforms)
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/branches/gnustep_testplant_branch@38022 72102866-910b-0410-8b05-ffd578937521
|
@ -152,6 +152,18 @@ Images_RESOURCE_FILES = \
|
|||
common_ProgressSpinning_6.tiff \
|
||||
common_ProgressSpinning_7.tiff \
|
||||
common_ProgressSpinning_8.tiff \
|
||||
common_ProgressSpinning2_1.png \
|
||||
common_ProgressSpinning2_2.png \
|
||||
common_ProgressSpinning2_3.png \
|
||||
common_ProgressSpinning2_4.png \
|
||||
common_ProgressSpinning2_5.png \
|
||||
common_ProgressSpinning2_6.png \
|
||||
common_ProgressSpinning2_7.png \
|
||||
common_ProgressSpinning2_8.png \
|
||||
common_ProgressSpinning2_9.png \
|
||||
common_ProgressSpinning2_10.png \
|
||||
common_ProgressSpinning2_11.png \
|
||||
common_ProgressSpinning2_12.png \
|
||||
nsmapping.strings \
|
||||
page_landscape.tiff \
|
||||
page_portrait.tiff
|
||||
|
|
BIN
Images/common_ProgressSpinning2_1.png
Normal file
After Width: | Height: | Size: 8 KiB |
BIN
Images/common_ProgressSpinning2_10.png
Normal file
After Width: | Height: | Size: 8.4 KiB |
BIN
Images/common_ProgressSpinning2_11.png
Normal file
After Width: | Height: | Size: 8.3 KiB |
BIN
Images/common_ProgressSpinning2_12.png
Normal file
After Width: | Height: | Size: 8.3 KiB |
BIN
Images/common_ProgressSpinning2_2.png
Normal file
After Width: | Height: | Size: 7.6 KiB |
BIN
Images/common_ProgressSpinning2_3.png
Normal file
After Width: | Height: | Size: 8.1 KiB |
BIN
Images/common_ProgressSpinning2_4.png
Normal file
After Width: | Height: | Size: 8.4 KiB |
BIN
Images/common_ProgressSpinning2_5.png
Normal file
After Width: | Height: | Size: 8 KiB |
BIN
Images/common_ProgressSpinning2_6.png
Normal file
After Width: | Height: | Size: 7.6 KiB |
BIN
Images/common_ProgressSpinning2_7.png
Normal file
After Width: | Height: | Size: 8 KiB |
BIN
Images/common_ProgressSpinning2_8.png
Normal file
After Width: | Height: | Size: 7.8 KiB |
BIN
Images/common_ProgressSpinning2_9.png
Normal file
After Width: | Height: | Size: 8.1 KiB |
|
@ -62,6 +62,10 @@
|
|||
#import "GNUstepGUI/GSToolbarView.h"
|
||||
#import "GNUstepGUI/GSTitleView.h"
|
||||
|
||||
|
||||
#define USE_SPINNING_DOTS
|
||||
|
||||
|
||||
/* a border width of 5 gives a reasonable compromise between Cocoa metrics and looking good */
|
||||
/* 7.0 gives us the NeXT Look (which is 8 pix wide including the shadow) */
|
||||
#define COLOR_WELL_BORDER_WIDTH 7.0
|
||||
|
@ -1136,11 +1140,17 @@
|
|||
return aRect;
|
||||
}
|
||||
|
||||
// TODO: Add linux type spinning image(s)???
|
||||
// progress indicator drawing methods
|
||||
static NSColor *fillColour = nil;
|
||||
#define MaxCount 10
|
||||
static int indeterminateMaxCount = MaxCount;
|
||||
static int spinningMaxCount = MaxCount;
|
||||
#define MaxCount 12
|
||||
#if defined(USE_SPINNING_DOTS)
|
||||
static int indeterminateMaxCount = 10;
|
||||
static int spinningMaxCount = 12;
|
||||
#else
|
||||
static int indeterminateMaxCount = 10;
|
||||
static int spinningMaxCount = 10;
|
||||
#endif
|
||||
static NSColor *indeterminateColors[MaxCount];
|
||||
static NSImage *spinningImages[MaxCount];
|
||||
|
||||
|
@ -1153,7 +1163,7 @@ static NSImage *spinningImages[MaxCount];
|
|||
fillColour = RETAIN([NSColor controlShadowColor]);
|
||||
|
||||
// Load images for indeterminate style
|
||||
for (i = 0; i < MaxCount; i++)
|
||||
for (i = 0; i < indeterminateMaxCount; i++)
|
||||
{
|
||||
NSString *imgName = [NSString stringWithFormat: @"common_ProgressIndeterminate_%d", i + 1];
|
||||
NSImage *image = [NSImage imageNamed: imgName];
|
||||
|
@ -1167,10 +1177,15 @@ static NSImage *spinningImages[MaxCount];
|
|||
}
|
||||
|
||||
// Load images for spinning style
|
||||
for (i = 0; i < MaxCount; i++)
|
||||
#if defined(USE_SPINNING_DOTS)
|
||||
NSString *baseName = @"common_ProgressSpinning2_";
|
||||
#else
|
||||
NSString *baseName = @"common_ProgressSpinning_";
|
||||
#endif
|
||||
for (i = 0; i < spinningMaxCount; i++)
|
||||
{
|
||||
NSString *imgName = [NSString stringWithFormat: @"common_ProgressSpinning_%d", i + 1];
|
||||
NSImage *image = [NSImage imageNamed: imgName];
|
||||
NSString *imgName = [NSString stringWithFormat: @"%@%d", baseName, i + 1];
|
||||
NSImage *image = [NSImage imageNamed: imgName];
|
||||
|
||||
if (image == nil)
|
||||
{
|
||||
|
@ -1210,14 +1225,16 @@ static NSImage *spinningImages[MaxCount];
|
|||
NSRect imgBox = {{0,0}, {0,0}};
|
||||
|
||||
if (spinningMaxCount != 0)
|
||||
{
|
||||
count = count % spinningMaxCount;
|
||||
imgBox.size = [spinningImages[count] size];
|
||||
[spinningImages[count] drawInRect: r
|
||||
fromRect: imgBox
|
||||
operation: NSCompositeSourceOver
|
||||
fraction: 1.0];
|
||||
}
|
||||
{
|
||||
count = count % spinningMaxCount;
|
||||
imgBox.size = [spinningImages[count] size];
|
||||
[spinningImages[count] drawInRect: r
|
||||
fromRect: imgBox
|
||||
operation: NSCompositeSourceOver
|
||||
fraction: 1.0
|
||||
respectFlipped: YES
|
||||
hints: nil];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -126,6 +126,7 @@
|
|||
&& (_style == NSProgressIndicatorBarStyle)))
|
||||
return;
|
||||
|
||||
[self setHidden:NO];
|
||||
_isRunning = YES;
|
||||
if (!_usesThreadedAnimation)
|
||||
{
|
||||
|
@ -160,6 +161,8 @@
|
|||
// Done automatically
|
||||
}
|
||||
|
||||
if (_isDisplayedWhenStopped == NO)
|
||||
[self setHidden:YES];
|
||||
_isRunning = NO;
|
||||
}
|
||||
|
||||
|
@ -247,6 +250,7 @@
|
|||
|
||||
- (void) setBezeled: (BOOL)flag
|
||||
{
|
||||
NSLog(@"%s:flag: %ld", __PRETTY_FUNCTION__, (long)flag);
|
||||
if (_isBezeled != flag)
|
||||
{
|
||||
_isBezeled = flag;
|
||||
|
@ -295,7 +299,8 @@
|
|||
{
|
||||
_style = style;
|
||||
_count = 0;
|
||||
[self setDisplayedWhenStopped: (style == NSProgressIndicatorBarStyle)];
|
||||
[self setDisplayedWhenStopped:(style == NSProgressIndicatorBarStyle)];
|
||||
[self setBezeled:(style == NSProgressIndicatorBarStyle)];
|
||||
[self sizeToFit];
|
||||
[self setNeedsDisplay: YES];
|
||||
}
|
||||
|
@ -334,7 +339,7 @@
|
|||
|
||||
if (!_isRunning && !_isDisplayedWhenStopped)
|
||||
return;
|
||||
|
||||
|
||||
if (_doubleValue < _minValue)
|
||||
val = 0.0;
|
||||
else if (_doubleValue > _maxValue)
|
||||
|
@ -419,6 +424,54 @@
|
|||
|
||||
if ([aDecoder allowsKeyedCoding])
|
||||
{
|
||||
// things which Gorm encodes, but IB doesn't care about.
|
||||
// process Gorm encodings that IB doesn't care about first
|
||||
// otherwise we overwrite settings read in from XIB...
|
||||
if ([aDecoder containsValueForKey: @"GSDoubleValue"])
|
||||
{
|
||||
_doubleValue = [aDecoder decodeDoubleForKey: @"GSDoubleValue"];
|
||||
}
|
||||
else
|
||||
{
|
||||
_doubleValue = _minValue;
|
||||
}
|
||||
|
||||
if ([aDecoder containsValueForKey: @"GSIsBezeled"])
|
||||
{
|
||||
_isBezeled = [aDecoder decodeBoolForKey: @"GSIsBezeled"];
|
||||
}
|
||||
else
|
||||
{
|
||||
_isBezeled = YES;
|
||||
}
|
||||
|
||||
if ([aDecoder containsValueForKey: @"GSIsVertical"])
|
||||
{
|
||||
_isVertical = [aDecoder decodeBoolForKey: @"GSIsVertical"];
|
||||
}
|
||||
else
|
||||
{
|
||||
_isVertical = NO;
|
||||
}
|
||||
|
||||
if ([aDecoder containsValueForKey: @"GSUsesThreadAnimation"])
|
||||
{
|
||||
_usesThreadedAnimation = [aDecoder decodeBoolForKey: @"GSUsesThreadAnimation"];
|
||||
}
|
||||
else
|
||||
{
|
||||
_usesThreadedAnimation = NO;
|
||||
}
|
||||
|
||||
if ([aDecoder containsValueForKey: @"GSAnimationDelay"])
|
||||
{
|
||||
_animationDelay = [aDecoder decodeDoubleForKey: @"GSAnimationDelay"];
|
||||
}
|
||||
else
|
||||
{
|
||||
_animationDelay = 5.0 / 60.0; // 1 twelfth a a second
|
||||
}
|
||||
|
||||
// id matrix = [aDecoder decodeObjectForKey: @"NSDrawMatrix"];
|
||||
if ([aDecoder containsValueForKey: @"NSMaxValue"])
|
||||
{
|
||||
|
@ -444,6 +497,7 @@
|
|||
if ([aDecoder containsValueForKey: @"NSpiFlags"])
|
||||
{
|
||||
int flags = [aDecoder decodeIntForKey: @"NSpiFlags"];
|
||||
NSLog(@"%s:flags: %p", __PRETTY_FUNCTION__, flags);
|
||||
|
||||
_isIndeterminate = ((flags & 2) == 2);
|
||||
_controlTint = NSDefaultControlTint;
|
||||
|
@ -461,52 +515,6 @@
|
|||
_controlSize = NSRegularControlSize;
|
||||
[self setStyle: NSProgressIndicatorBarStyle];
|
||||
}
|
||||
|
||||
// things which Gorm encodes, but IB doesn't care about.
|
||||
if ([aDecoder containsValueForKey: @"GSDoubleValue"])
|
||||
{
|
||||
_doubleValue = [aDecoder decodeDoubleForKey: @"GSDoubleValue"];
|
||||
}
|
||||
else
|
||||
{
|
||||
_doubleValue = _minValue;
|
||||
}
|
||||
|
||||
if ([aDecoder containsValueForKey: @"GSIsBezeled"])
|
||||
{
|
||||
_isBezeled = [aDecoder decodeBoolForKey: @"GSIsBezeled"];
|
||||
}
|
||||
else
|
||||
{
|
||||
_isBezeled = YES;
|
||||
}
|
||||
|
||||
if ([aDecoder containsValueForKey: @"GSIsVertical"])
|
||||
{
|
||||
_isVertical = [aDecoder decodeBoolForKey: @"GSIsVertical"];
|
||||
}
|
||||
else
|
||||
{
|
||||
_isVertical = NO;
|
||||
}
|
||||
|
||||
if ([aDecoder containsValueForKey: @"GSUsesThreadAnimation"])
|
||||
{
|
||||
_usesThreadedAnimation = [aDecoder decodeBoolForKey: @"GSUsesThreadAnimation"];
|
||||
}
|
||||
else
|
||||
{
|
||||
_usesThreadedAnimation = NO;
|
||||
}
|
||||
|
||||
if ([aDecoder containsValueForKey: @"GSAnimationDelay"])
|
||||
{
|
||||
_animationDelay = [aDecoder decodeDoubleForKey: @"GSAnimationDelay"];
|
||||
}
|
||||
else
|
||||
{
|
||||
_animationDelay = 5.0 / 60.0; // 1 twelfth a a second
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|