diff options
author | rowanbeentje <rowan@beent.je> | 2010-05-24 09:24:38 +0000 |
---|---|---|
committer | rowanbeentje <rowan@beent.je> | 2010-05-24 09:24:38 +0000 |
commit | d48005bd9b34f2fb1afd31f7487b7bbf8b9b978f (patch) | |
tree | c27ac371a986bdf2e8f9dd4441ed37c44b04ec64 | |
parent | 98238ec8fb393295fc01804a3104092e3ea24c92 (diff) | |
download | sequelpro-d48005bd9b34f2fb1afd31f7487b7bbf8b9b978f.tar.gz sequelpro-d48005bd9b34f2fb1afd31f7487b7bbf8b9b978f.tar.bz2 sequelpro-d48005bd9b34f2fb1afd31f7487b7bbf8b9b978f.zip |
- Add support for progress indicator in tabs
- Hide Navigator menu option again
- Remove accidentally committed debug
-rw-r--r-- | Interfaces/English.lproj/MainMenu.xib | 11 | ||||
-rw-r--r-- | Source/SPHistoryController.m | 1 | ||||
-rw-r--r-- | Source/SPWindowController.m | 47 | ||||
-rw-r--r-- | Source/TableContent.m | 2 | ||||
-rw-r--r-- | Source/TableDocument.h | 1 | ||||
-rw-r--r-- | Source/TableDocument.m | 18 |
6 files changed, 57 insertions, 23 deletions
diff --git a/Interfaces/English.lproj/MainMenu.xib b/Interfaces/English.lproj/MainMenu.xib index 9eb99ada..26ba4dc4 100644 --- a/Interfaces/English.lproj/MainMenu.xib +++ b/Interfaces/English.lproj/MainMenu.xib @@ -2,7 +2,7 @@ <archive type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="7.10"> <data> <int key="IBDocument.SystemTarget">1050</int> - <string key="IBDocument.SystemVersion">10D573</string> + <string key="IBDocument.SystemVersion">10D2094</string> <string key="IBDocument.InterfaceBuilderVersion">762</string> <string key="IBDocument.AppKitVersion">1038.29</string> <string key="IBDocument.HIToolboxVersion">460.00</string> @@ -12,7 +12,7 @@ </object> <object class="NSMutableArray" key="IBDocument.EditedObjectIDs"> <bool key="EncodedWithXMLCoder">YES</bool> - <integer value="81"/> + <integer value="29"/> </object> <object class="NSArray" key="IBDocument.PluginDependencies"> <bool key="EncodedWithXMLCoder">YES</bool> @@ -1236,6 +1236,7 @@ </object> <object class="NSMenuItem" id="986291195"> <reference key="NSMenu" ref="466354362"/> + <bool key="NSIsHidden">YES</bool> <string key="NSTitle">Show Navigator</string> <string key="NSKeyEquiv">n</string> <int key="NSKeyEquivModMask">1835008</int> @@ -5066,7 +5067,7 @@ <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> - <string>{{594, 292}, {251, 293}}</string> + <string>{{546, 237}, {251, 293}}</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>{{698, 703}, {184, 133}}</string> @@ -5092,7 +5093,7 @@ <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> - <string>{{644, 332}, {255, 253}}</string> + <string>{{596, 277}, {255, 253}}</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>{{312, 683}, {231, 153}}</string> @@ -5159,7 +5160,7 @@ <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> - <string>{{725, 352}, {292, 233}}</string> + <string>{{677, 297}, {292, 233}}</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>{{829, 663}, {268, 173}}</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> 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]; |