aboutsummaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
Diffstat (limited to 'Source')
-rw-r--r--Source/SPHistoryController.m1
-rw-r--r--Source/SPWindowController.m47
-rw-r--r--Source/TableContent.m2
-rw-r--r--Source/TableDocument.h1
-rw-r--r--Source/TableDocument.m18
5 files changed, 51 insertions, 18 deletions
diff --git a/Source/SPHistoryController.m b/Source/SPHistoryController.m
index 421569e7..b8128a0f 100644
--- a/Source/SPHistoryController.m
+++ b/Source/SPHistoryController.m
@@ -65,7 +65,6 @@
- (void) dealloc
{
-NSLog(@"history is dealloc'd");
[[NSNotificationCenter defaultCenter] removeObserver:self];
[tableContentStates release];
[history release];
diff --git a/Source/SPWindowController.m b/Source/SPWindowController.m
index 3c8b9be7..d7b4f6ac 100644
--- a/Source/SPWindowController.m
+++ b/Source/SPWindowController.m
@@ -28,6 +28,12 @@
#import <PSMTabBar/PSMTabBarControl.h>
#import <PSMTabBar/PSMTabStyle.h>
+@interface SPWindowController (PrivateAPI)
+
+- (void) _updateProgressIndicatorForItem:(NSTabViewItem *)theItem;
+
+@end
+
@implementation SPWindowController
/**
@@ -97,7 +103,10 @@
// Tell the new database connection view to set up the window and update titles
[newTableDocument didBecomeActiveTabInWindow];
[newTableDocument updateWindowTitle:self];
-
+
+ // Bind the tab bar's progress display to the document
+ [self _updateProgressIndicatorForItem:newItem];
+
[newTableDocument release];
}
@@ -193,6 +202,7 @@
- (void)tabView:(NSTabView *)aTabView didCloseTabViewItem:(NSTabViewItem *)tabViewItem
{
TableDocument *theDocument = [tabViewItem identifier];
+ [theDocument removeObserver:self forKeyPath:@"isProcessing"];
[theDocument parentTabDidClose];
}
@@ -224,6 +234,10 @@
[draggedDocument willResignActiveTabInWindow];
[draggedDocument setParentWindow:[tabBarControl window]];
[draggedDocument didBecomeActiveTabInWindow];
+
+ // Update isProcessing observation
+ [draggedDocument removeObserver:[draggedFromWindow windowController] forKeyPath:@"isProcessing"];
+ [[[tabBarControl window] windowController] _updateProgressIndicatorForItem:tabViewItem];
}
}
@@ -369,4 +383,35 @@
return [frontDocument performSelector:theSelector withObject:theObject];
}
+@end
+
+@implementation SPWindowController (PrivateAPI)
+
+/**
+ * Binds a tab bar item's progress indicator to the represented
+ * tableDocument.
+ */
+- (void) _updateProgressIndicatorForItem:(NSTabViewItem *)theItem
+{
+ PSMTabBarCell *theCell = [[tabBar cells] objectAtIndex:[tabView indexOfTabViewItem:theItem]];
+ [[theCell indicator] setControlSize:NSSmallControlSize];
+ TableDocument *theDocument = [theItem identifier];
+
+ [[theCell indicator] setHidden:NO];
+ NSMutableDictionary *bindingOptions = [NSMutableDictionary dictionary];
+ [bindingOptions setObject:NSNegateBooleanTransformerName forKey:@"NSValueTransformerName"];
+ [[theCell indicator] bind:@"animate" toObject:theDocument withKeyPath:@"isProcessing" options:nil];
+ [[theCell indicator] bind:@"hidden" toObject:theDocument withKeyPath:@"isProcessing" options:bindingOptions];
+ [theDocument addObserver:self forKeyPath:@"isProcessing" options:nil context:nil];
+}
+
+/**
+ * When receiving an update for a bound value - an observed value on the
+ * document - ask the tab bar control to redraw as appropriate.
+ */
+- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context
+{
+ [tabBar update];
+}
+
@end \ No newline at end of file
diff --git a/Source/TableContent.m b/Source/TableContent.m
index cf639b72..723d107a 100644
--- a/Source/TableContent.m
+++ b/Source/TableContent.m
@@ -3386,7 +3386,7 @@
// Last but not least
- (void)dealloc
-{NSLog(@"content is deallocd");
+{
[[NSNotificationCenter defaultCenter] removeObserver:self];
[tableValues release];
diff --git a/Source/TableDocument.h b/Source/TableDocument.h
index 539d14b2..b8478f98 100644
--- a/Source/TableDocument.h
+++ b/Source/TableDocument.h
@@ -188,6 +188,7 @@
@property (readwrite, assign) SPWindowController *parentWindowController;
@property (readwrite, assign) NSTabViewItem *parentTabViewItem;
+@property (readwrite, assign) BOOL isProcessing;
- (BOOL)isUntitled;
- (BOOL)couldCommitCurrentViewActions;
diff --git a/Source/TableDocument.m b/Source/TableDocument.m
index 5d3209e5..d0637eed 100644
--- a/Source/TableDocument.m
+++ b/Source/TableDocument.m
@@ -75,6 +75,7 @@
@synthesize parentWindowController;
@synthesize parentTabViewItem;
+@synthesize isProcessing;
- (id)init
{
@@ -2583,7 +2584,7 @@
*/
- (void)willPerformQuery:(NSNotification *)notification
{
- isProcessing = YES;
+ [self setIsProcessing:YES];
[queryProgressBar startAnimation:self];
}
@@ -2592,7 +2593,7 @@
*/
- (void)hasPerformedQuery:(NSNotification *)notification
{
- isProcessing = NO;
+ [self setIsProcessing:NO];
[queryProgressBar stopAnimation:self];
}
@@ -3932,18 +3933,6 @@
}
/**
- * Support the tab's progress spinner
- */
-- (BOOL)isProcessing
-{
- return (isProcessing || (_isWorkingLevel > 0));
-}
-- (void)setIsProcessing:(BOOL)value
-{
- isProcessing = value;
-}
-
-/**
* Set the parent window
*/
- (void)setParentWindow:(NSWindow *)aWindow
@@ -4228,7 +4217,6 @@
*/
- (void)dealloc
{
-NSLog(@"is dealloc'd");
// Unregister observers
[prefs removeObserver:self forKeyPath:SPDisplayTableViewVerticalGridlines];