aboutsummaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorrowanbeentje <rowan@beent.je>2010-07-31 22:21:00 +0000
committerrowanbeentje <rowan@beent.je>2010-07-31 22:21:00 +0000
commitaeb89462c557f2b9f79c070b7ce30fa68f63faf7 (patch)
tree9757ee6b55819126ccc3e481050597cbb3db1a25 /Source
parent3755c18f7b0c572c2205011d7a1d519c36fa2ef0 (diff)
downloadsequelpro-aeb89462c557f2b9f79c070b7ce30fa68f63faf7.tar.gz
sequelpro-aeb89462c557f2b9f79c070b7ce30fa68f63faf7.tar.bz2
sequelpro-aeb89462c557f2b9f79c070b7ce30fa68f63faf7.zip
- Replace progress indicator CoreAnimation drawing with manual shadow/fade code; this addresses hangs (see Issue #6677) and also prevents triggering the discrete graphics chip on newer MacBook Pros.
- Update localisable strings
Diffstat (limited to 'Source')
-rw-r--r--Source/SPDatabaseDocument.m27
-rw-r--r--Source/YRKSpinningProgressIndicator.h1
-rw-r--r--Source/YRKSpinningProgressIndicator.m24
3 files changed, 46 insertions, 6 deletions
diff --git a/Source/SPDatabaseDocument.m b/Source/SPDatabaseDocument.m
index bace5cb5..c2d4896c 100644
--- a/Source/SPDatabaseDocument.m
+++ b/Source/SPDatabaseDocument.m
@@ -226,6 +226,12 @@
// Set up the progress indicator child window and layer - change indicator color and size
[taskProgressIndicator setForeColor:[NSColor whiteColor]];
+ NSShadow *progressIndicatorShadow = [[NSShadow alloc] init];
+ [progressIndicatorShadow setShadowOffset:NSMakeSize(1.0, -1.0)];
+ [progressIndicatorShadow setShadowBlurRadius:1.0];
+ [progressIndicatorShadow setShadowColor:[NSColor colorWithCalibratedWhite:0.0 alpha:0.75]];
+ [taskProgressIndicator setShadow:progressIndicatorShadow];
+ [progressIndicatorShadow release];
taskProgressWindow = [[NSWindow alloc] initWithContentRect:[taskProgressLayer bounds] styleMask:NSBorderlessWindowMask backing:NSBackingStoreBuffered defer:NO];
[taskProgressWindow setReleasedWhenClosed:NO];
[taskProgressWindow setOpaque:NO];
@@ -1276,11 +1282,11 @@
// Set the task text. If a nil string was supplied, a generic query notification is occurring -
// if a task is not already active, use default text.
if (!description) {
- if (!_isWorkingLevel) [taskDescriptionText setStringValue:NSLocalizedString(@"Working...", @"Generic working description")];
+ if (!_isWorkingLevel) [self setTaskDescription:NSLocalizedString(@"Working...", @"Generic working description")];
// Otherwise display the supplied string
} else {
- [taskDescriptionText setStringValue:description];
+ [self setTaskDescription:description];
}
// Increment the task level
@@ -1343,7 +1349,22 @@
*/
- (void) setTaskDescription:(NSString *)description
{
- [taskDescriptionText setStringValue:description];
+ NSShadow *shadow = [[NSShadow alloc] init];
+ [shadow setShadowColor:[NSColor colorWithCalibratedWhite:0.0 alpha:0.75]];
+ [shadow setShadowOffset:NSMakeSize(1.0, -1.0)];
+ [shadow setShadowBlurRadius:3.0];
+
+ NSMutableDictionary *attributes = [[NSMutableDictionary alloc] initWithObjectsAndKeys:
+ [NSFont boldSystemFontOfSize:13.0], NSFontAttributeName,
+ shadow, NSShadowAttributeName,
+ nil];
+ NSAttributedString *string = [[NSAttributedString alloc] initWithString:description attributes:attributes];
+
+ [taskDescriptionText setAttributedStringValue:string];
+
+ [string release];
+ [attributes release];
+ [shadow release];
}
/**
diff --git a/Source/YRKSpinningProgressIndicator.h b/Source/YRKSpinningProgressIndicator.h
index 4be79805..e97711b2 100644
--- a/Source/YRKSpinningProgressIndicator.h
+++ b/Source/YRKSpinningProgressIndicator.h
@@ -18,6 +18,7 @@
NSColor *_foreColor;
NSColor *_backColor;
BOOL _drawBackground;
+ NSShadow *_shadow;
NSTimer *_fadeOutAnimationTimer;
BOOL _isFadingOut;
diff --git a/Source/YRKSpinningProgressIndicator.m b/Source/YRKSpinningProgressIndicator.m
index 4872b201..b6f3c0ac 100644
--- a/Source/YRKSpinningProgressIndicator.m
+++ b/Source/YRKSpinningProgressIndicator.m
@@ -56,6 +56,7 @@
_currentValue = 0.0;
_maxValue = 100.0;
_usesThreadedAnimation = NO;
+ _shadow = nil;
}
return self;
}
@@ -63,6 +64,7 @@
- (void) dealloc {
if (_foreColor) [_foreColor release];
if (_backColor) [_backColor release];
+ if (_shadow) [_shadow release];
if (_isAnimating) [self stopAnimation:self];
[super dealloc];
@@ -94,15 +96,17 @@
else
maxSize = size.width;
+ CGContextRef currentContext = (CGContextRef)[[NSGraphicsContext currentContext] graphicsPort];
+ [NSGraphicsContext saveGraphicsState];
+
+ if (_shadow) [_shadow set];
+
// fill the background, if set
if(_drawBackground) {
[_backColor set];
[NSBezierPath fillRect:[self bounds]];
}
- CGContextRef currentContext = (CGContextRef)[[NSGraphicsContext currentContext] graphicsPort];
- [NSGraphicsContext saveGraphicsState];
-
// Move the CTM so 0,0 is at the center of our bounds
CGContextTranslateCTM(currentContext,[self bounds].size.width/2,[self bounds].size.height/2);
@@ -313,6 +317,20 @@
[self setNeedsDisplay:YES];
}
+- (NSShadow *)shadow
+{
+ return [[_shadow retain] autorelease];
+}
+
+- (void)setShadow:(NSShadow *)value
+{
+ if (_shadow != value) {
+ [_shadow release];
+ _shadow = [value copy];
+ [self setNeedsDisplay:YES];
+ }
+}
+
- (BOOL)isIndeterminate
{
return _isIndeterminate;