diff options
author | rowanbeentje <rowan@beent.je> | 2009-11-21 22:18:27 +0000 |
---|---|---|
committer | rowanbeentje <rowan@beent.je> | 2009-11-21 22:18:27 +0000 |
commit | 7ead84b0868975752f445d1917bc693a5bf502b7 (patch) | |
tree | 8bb28e0a7b5482fc13276bc192e738d6e9761b8b | |
parent | f184235a7f7996e68f4f6548ec8932b289e3d3c1 (diff) | |
download | sequelpro-7ead84b0868975752f445d1917bc693a5bf502b7.tar.gz sequelpro-7ead84b0868975752f445d1917bc693a5bf502b7.tar.bz2 sequelpro-7ead84b0868975752f445d1917bc693a5bf502b7.zip |
- Relocate the table changed notification, allowing table info pane to update early in the change process, but ensure the change notification occurs on the main thread for stability. Added NSNotificationAdditions from the Colloquy project for this.
- Change the design of the progress indicator layer, and tweak task progress for improved feedback and less flickering by correctly updating interface as appropriate, and delaying status changes for a short time. This partially addresses Issue #455.
-rw-r--r-- | Interfaces/English.lproj/ProgressIndicatorLayer.xib | 241 | ||||
-rw-r--r-- | Source/NSNotificationAdditions.h | 34 | ||||
-rw-r--r-- | Source/NSNotificationAdditions.m | 75 | ||||
-rw-r--r-- | Source/TableContent.m | 3 | ||||
-rw-r--r-- | Source/TableDocument.h | 2 | ||||
-rw-r--r-- | Source/TableDocument.m | 18 | ||||
-rw-r--r-- | Source/TablesList.m | 12 | ||||
-rw-r--r-- | Source/YRKSpinningProgressIndicator.m | 1 | ||||
-rw-r--r-- | sequel-pro.xcodeproj/project.pbxproj | 6 |
9 files changed, 290 insertions, 102 deletions
diff --git a/Interfaces/English.lproj/ProgressIndicatorLayer.xib b/Interfaces/English.lproj/ProgressIndicatorLayer.xib index de3df433..54d32869 100644 --- a/Interfaces/English.lproj/ProgressIndicatorLayer.xib +++ b/Interfaces/English.lproj/ProgressIndicatorLayer.xib @@ -2,10 +2,10 @@ <archive type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="7.10"> <data> <int key="IBDocument.SystemTarget">1050</int> - <string key="IBDocument.SystemVersion">10B504</string> + <string key="IBDocument.SystemVersion">10C540</string> <string key="IBDocument.InterfaceBuilderVersion">740</string> - <string key="IBDocument.AppKitVersion">1038.2</string> - <string key="IBDocument.HIToolboxVersion">437.00</string> + <string key="IBDocument.AppKitVersion">1038.25</string> + <string key="IBDocument.HIToolboxVersion">458.00</string> <object class="NSMutableDictionary" key="IBDocument.PluginVersions"> <bool key="EncodedWithXMLCoder">YES</bool> <object class="NSArray" key="dict.sortedKeys"> @@ -21,7 +21,7 @@ </object> <object class="NSMutableArray" key="IBDocument.EditedObjectIDs"> <bool key="EncodedWithXMLCoder">YES</bool> - <integer value="1"/> + <integer value="10"/> </object> <object class="NSArray" key="IBDocument.PluginDependencies"> <bool key="EncodedWithXMLCoder">YES</bool> @@ -63,76 +63,125 @@ <int key="NSvFlags">256</int> <object class="NSMutableArray" key="NSSubviews"> <bool key="EncodedWithXMLCoder">YES</bool> - <object class="NSCustomView" id="602680912"> + <object class="NSBox" id="234202374"> <reference key="NSNextResponder" ref="950529842"/> - <int key="NSvFlags">274</int> - <string key="NSFrame">{{50, 84}, {160, 160}}</string> + <int key="NSvFlags">12</int> + <object class="NSMutableArray" key="NSSubviews"> + <bool key="EncodedWithXMLCoder">YES</bool> + <object class="NSView" id="172592959"> + <reference key="NSNextResponder" ref="234202374"/> + <int key="NSvFlags">256</int> + <object class="NSMutableArray" key="NSSubviews"> + <bool key="EncodedWithXMLCoder">YES</bool> + <object class="NSTextField" id="545295640"> + <reference key="NSNextResponder" ref="172592959"/> + <int key="NSvFlags">290</int> + <string key="NSFrame">{{97, 30}, {326, 49}}</string> + <reference key="NSSuperview" ref="172592959"/> + <bool key="NSViewIsLayerTreeHost">YES</bool> + <object class="NSShadow" key="NSViewShadow"> + <double key="NSShadowHoriz">1</double> + <double key="NSShadowVert">-1</double> + <double key="NSShadowBlurRadius">2</double> + <object class="NSColor" key="NSShadowColor" id="823228870"> + <int key="NSColorSpace">3</int> + <bytes key="NSWhite">MAA</bytes> + </object> + </object> + <int key="NSViewLayerContentsRedrawPolicy">2</int> + <bool key="NSEnabled">YES</bool> + <object class="NSTextFieldCell" key="NSCell" id="39991509"> + <int key="NSCellFlags">67239424</int> + <int key="NSCellFlags2">4460544</int> + <string key="NSContents">Multiline Label</string> + <object class="NSFont" key="NSSupport"> + <string key="NSName">LucidaGrande-Bold</string> + <double key="NSSize">13</double> + <int key="NSfFlags">16</int> + </object> + <reference key="NSControlView" ref="545295640"/> + <object class="NSColor" key="NSBackgroundColor"> + <int key="NSColorSpace">1</int> + <bytes key="NSRGB">MCAwIDAAA</bytes> + </object> + <object class="NSColor" key="NSTextColor" id="424449304"> + <int key="NSColorSpace">3</int> + <bytes key="NSWhite">MQA</bytes> + </object> + </object> + </object> + </object> + <string key="NSFrameSize">{436, 90}</string> + <reference key="NSSuperview" ref="234202374"/> + <int key="NSViewLayerContentsRedrawPolicy">2</int> + </object> + </object> + <string key="NSFrame">{{0, 70}, {436, 90}}</string> <reference key="NSSuperview" ref="950529842"/> - <bool key="NSViewIsLayerTreeHost">YES</bool> - <object class="NSShadow" key="NSViewShadow"> - <double key="NSShadowHoriz">1</double> - <double key="NSShadowVert">-1</double> - <double key="NSShadowBlurRadius">1</double> - <object class="NSColor" key="NSShadowColor" id="823228870"> + <int key="NSViewLayerContentsRedrawPolicy">2</int> + <string key="NSOffsets">{0, 0}</string> + <object class="NSTextFieldCell" key="NSTitleCell"> + <int key="NSCellFlags">67239424</int> + <int key="NSCellFlags2">0</int> + <string key="NSContents">Box</string> + <object class="NSFont" key="NSSupport" id="26"> + <string key="NSName">LucidaGrande</string> + <double key="NSSize">11</double> + <int key="NSfFlags">3100</int> + </object> + <object class="NSColor" key="NSBackgroundColor" id="834659164"> + <int key="NSColorSpace">6</int> + <string key="NSCatalogName">System</string> + <string key="NSColorName">textBackgroundColor</string> + <reference key="NSColor" ref="424449304"/> + </object> + <object class="NSColor" key="NSTextColor"> <int key="NSColorSpace">3</int> - <bytes key="NSWhite">MAA</bytes> + <bytes key="NSWhite">MCAwLjgwMDAwMDAxMTkAA</bytes> </object> </object> - <int key="NSViewLayerContentsRedrawPolicy">2</int> - <string key="NSClassName">YRKSpinningProgressIndicator</string> + <reference key="NSContentView" ref="172592959"/> + <int key="NSBorderType">0</int> + <int key="NSBoxType">4</int> + <int key="NSTitlePosition">0</int> + <bool key="NSTransparent">NO</bool> + <double key="NSCornerRadius2">9</double> + <object class="NSColor" key="NSFillColor2"> + <int key="NSColorSpace">3</int> + <bytes key="NSWhite">MC4yNTQwMzIyNTgxIDAuOAA</bytes> + </object> </object> - <object class="NSTextField" id="545295640"> + <object class="NSCustomView" id="602680912"> <reference key="NSNextResponder" ref="950529842"/> - <int key="NSvFlags">290</int> - <string key="NSFrame">{{13, 34}, {234, 42}}</string> + <int key="NSvFlags">274</int> + <string key="NSFrame">{{13, 79}, {73, 73}}</string> <reference key="NSSuperview" ref="950529842"/> <bool key="NSViewIsLayerTreeHost">YES</bool> <object class="NSShadow" key="NSViewShadow"> <double key="NSShadowHoriz">1</double> <double key="NSShadowVert">-1</double> - <double key="NSShadowBlurRadius">2</double> + <double key="NSShadowBlurRadius">1</double> <reference key="NSShadowColor" ref="823228870"/> </object> <int key="NSViewLayerContentsRedrawPolicy">2</int> - <bool key="NSEnabled">YES</bool> - <object class="NSTextFieldCell" key="NSCell" id="39991509"> - <int key="NSCellFlags">67239424</int> - <int key="NSCellFlags2">138678272</int> - <string key="NSContents">Multiline Label</string> - <object class="NSFont" key="NSSupport"> - <string key="NSName">LucidaGrande-Bold</string> - <double key="NSSize">13</double> - <int key="NSfFlags">16</int> - </object> - <reference key="NSControlView" ref="545295640"/> - <object class="NSColor" key="NSBackgroundColor"> - <int key="NSColorSpace">1</int> - <bytes key="NSRGB">MCAwIDAAA</bytes> - </object> - <object class="NSColor" key="NSTextColor" id="424449304"> - <int key="NSColorSpace">3</int> - <bytes key="NSWhite">MQA</bytes> - </object> - </object> + <string key="NSClassName">YRKSpinningProgressIndicator</string> </object> <object class="BWTransparentButton" id="540103856"> <reference key="NSNextResponder" ref="950529842"/> <int key="NSvFlags">290</int> - <string key="NSFrame">{{64, 4}, {132, 28}}</string> + <string key="NSFrame">{{295, 72}, {132, 28}}</string> <reference key="NSSuperview" ref="950529842"/> + <int key="NSViewLayerContentsRedrawPolicy">2</int> <bool key="NSEnabled">YES</bool> <object class="BWTransparentButtonCell" key="NSCell" id="1030687082"> <int key="NSCellFlags">67239424</int> <int key="NSCellFlags2">134348800</int> <string key="NSContents">Cancel</string> - <object class="NSFont" key="NSSupport" id="26"> - <string key="NSName">LucidaGrande</string> - <double key="NSSize">11</double> - <int key="NSfFlags">3100</int> - </object> + <reference key="NSSupport" ref="26"/> <reference key="NSControlView" ref="540103856"/> - <int key="NSButtonFlags">-2038284033</int> + <int key="NSButtonFlags">-2034876161</int> <int key="NSButtonFlags2">268435585</int> + <reference key="NSAlternateImage" ref="26"/> <string key="NSAlternateContents"/> <string key="NSKeyEquivalent">.</string> <int key="NSPeriodicDelay">200</int> @@ -140,24 +189,21 @@ </object> </object> </object> - <string key="NSFrameSize">{260, 260}</string> + <string key="NSFrameSize">{437, 160}</string> <reference key="NSSuperview" ref="450247213"/> + <int key="NSViewLayerContentsRedrawPolicy">2</int> </object> </object> - <string key="NSFrameSize">{260, 260}</string> + <string key="NSFrame">{{0, -70}, {437, 160}}</string> <reference key="NSSuperview" ref="1005"/> + <int key="NSViewLayerContentsRedrawPolicy">2</int> <string key="NSOffsets">{0, 0}</string> <object class="NSTextFieldCell" key="NSTitleCell"> <int key="NSCellFlags">67239424</int> <int key="NSCellFlags2">0</int> <string key="NSContents">Box</string> <reference key="NSSupport" ref="26"/> - <object class="NSColor" key="NSBackgroundColor"> - <int key="NSColorSpace">6</int> - <string key="NSCatalogName">System</string> - <string key="NSColorName">textBackgroundColor</string> - <reference key="NSColor" ref="424449304"/> - </object> + <reference key="NSBackgroundColor" ref="834659164"/> <object class="NSColor" key="NSTextColor"> <int key="NSColorSpace">3</int> <bytes key="NSWhite">MCAwLjgwMDAwMDAxMTkAA</bytes> @@ -168,15 +214,16 @@ <int key="NSBoxType">4</int> <int key="NSTitlePosition">0</int> <bool key="NSTransparent">NO</bool> + <bool key="NSFullyTransparent">YES</bool> <real value="0.0" key="NSBorderWidth2"/> <double key="NSCornerRadius2">15</double> <object class="NSColor" key="NSFillColor2"> <int key="NSColorSpace">3</int> - <bytes key="NSWhite">MCAwLjUAA</bytes> + <bytes key="NSWhite">MCAwLjcAA</bytes> </object> </object> </object> - <string key="NSFrameSize">{260, 260}</string> + <string key="NSFrameSize">{437, 90}</string> <reference key="NSSuperview"/> <int key="NSViewLayerContentsRedrawPolicy">2</int> <string key="NSClassName">NSView</string> @@ -267,32 +314,18 @@ <reference key="object" ref="450247213"/> <object class="NSMutableArray" key="children"> <bool key="EncodedWithXMLCoder">YES</bool> - <reference ref="545295640"/> - <reference ref="540103856"/> <reference ref="602680912"/> + <reference ref="234202374"/> + <reference ref="540103856"/> </object> <reference key="parent" ref="1005"/> </object> <object class="IBObjectRecord"> - <int key="objectID">15</int> - <reference key="object" ref="545295640"/> - <object class="NSMutableArray" key="children"> - <bool key="EncodedWithXMLCoder">YES</bool> - <reference ref="39991509"/> - </object> - <reference key="parent" ref="450247213"/> - </object> - <object class="IBObjectRecord"> <int key="objectID">11</int> <reference key="object" ref="602680912"/> <reference key="parent" ref="450247213"/> </object> <object class="IBObjectRecord"> - <int key="objectID">16</int> - <reference key="object" ref="39991509"/> - <reference key="parent" ref="545295640"/> - </object> - <object class="IBObjectRecord"> <int key="objectID">17</int> <reference key="object" ref="540103856"/> <object class="NSMutableArray" key="children"> @@ -306,6 +339,29 @@ <reference key="object" ref="1030687082"/> <reference key="parent" ref="540103856"/> </object> + <object class="IBObjectRecord"> + <int key="objectID">38</int> + <reference key="object" ref="234202374"/> + <object class="NSMutableArray" key="children"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="545295640"/> + </object> + <reference key="parent" ref="450247213"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">15</int> + <reference key="object" ref="545295640"/> + <object class="NSMutableArray" key="children"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="39991509"/> + </object> + <reference key="parent" ref="234202374"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">16</int> + <reference key="object" ref="39991509"/> + <reference key="parent" ref="545295640"/> + </object> </object> </object> <object class="NSMutableDictionary" key="flattenedProperties"> @@ -333,6 +389,10 @@ <string>16.IBPluginDependency</string> <string>17.IBPluginDependency</string> <string>18.IBPluginDependency</string> + <string>38.IBPluginDependency</string> + <string>38.IBViewIntegration.shadowBlurRadius</string> + <string>38.IBViewIntegration.shadowOffsetHeight</string> + <string>38.IBViewIntegration.shadowOffsetWidth</string> </object> <object class="NSMutableArray" key="dict.values"> <bool key="EncodedWithXMLCoder">YES</bool> @@ -346,7 +406,7 @@ </object> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> - <string>{{393, 332}, {260, 260}}</string> + <string>{{393, 502}, {437, 90}}</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>{628, 654}</string> <string>{{357, 416}, {480, 272}}</string> @@ -363,6 +423,10 @@ <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.brandonwalkin.BWToolkit</string> <string>com.brandonwalkin.BWToolkit</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <real value="3"/> + <real value="-3"/> + <real value="3"/> </object> </object> <object class="NSMutableDictionary" key="unlocalizedProperties"> @@ -381,7 +445,7 @@ </object> </object> <nil key="sourceID"/> - <int key="maxID">37</int> + <int key="maxID">38</int> </object> <object class="IBClassDescriber" key="IBDocument.Classes"> <object class="NSMutableArray" key="referencedPartialClassDescriptions"> @@ -554,6 +618,13 @@ </object> <object class="IBPartialClassDescription"> <string key="className">TableDocument</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBProjectSource</string> + <string key="minorKey">Source/SPConnectionDelegate.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">TableDocument</string> <string key="superclassName">NSDocument</string> <object class="NSMutableDictionary" key="actions"> <bool key="EncodedWithXMLCoder">YES</bool> @@ -572,11 +643,8 @@ <string>closePanelSheet:</string> <string>closePasswordSheet:</string> <string>closeSheet:</string> - <string>copy:</string> <string>copyCreateTableSyntax:</string> <string>copyCreateTableSyntaxFromSheet:</string> - <string>copyServerVariableName:</string> - <string>copyServerVariableValue:</string> <string>export:</string> <string>exportMultipleTables:</string> <string>exportTable:</string> @@ -589,12 +657,12 @@ <string>repairTable:</string> <string>saveConnectionSheet:</string> <string>saveCreateSyntax:</string> - <string>saveServerVariables:</string> <string>setDatabases:</string> <string>showCreateTableSyntax:</string> <string>showMySQLHelp:</string> + <string>showServerProcesses:</string> + <string>showServerVariables:</string> <string>showUserManager:</string> - <string>showVariables:</string> <string>validateSaveConnectionAccessory:</string> <string>viewContent:</string> <string>viewQuery:</string> @@ -643,9 +711,6 @@ <string>id</string> <string>id</string> <string>id</string> - <string>id</string> - <string>id</string> - <string>id</string> </object> </object> <object class="NSMutableDictionary" key="outlets"> @@ -685,7 +750,6 @@ <string>saveConnectionIncludeQuery</string> <string>saveConnectionSavePassword</string> <string>saveConnectionSavePasswordAlert</string> - <string>saveVariablesButton</string> <string>sidebarGrabber</string> <string>spHistoryControllerInstance</string> <string>tableContentInstance</string> @@ -708,10 +772,6 @@ <string>titleImageView</string> <string>titleStringView</string> <string>userManagerInstance</string> - <string>variablesCountTextField</string> - <string>variablesSearchField</string> - <string>variablesSheet</string> - <string>variablesTableView</string> </object> <object class="NSMutableArray" key="dict.values"> <bool key="EncodedWithXMLCoder">YES</bool> @@ -748,7 +808,6 @@ <string>id</string> <string>id</string> <string>id</string> - <string>NSButton</string> <string>id</string> <string>id</string> <string>id</string> @@ -771,10 +830,6 @@ <string>id</string> <string>id</string> <string>SPUserManager</string> - <string>NSTextField</string> - <string>NSSearchField</string> - <string>id</string> - <string>id</string> </object> </object> <object class="IBClassDescriptionSource" key="sourceIdentifier"> diff --git a/Source/NSNotificationAdditions.h b/Source/NSNotificationAdditions.h new file mode 100644 index 00000000..37fe4c0e --- /dev/null +++ b/Source/NSNotificationAdditions.h @@ -0,0 +1,34 @@ +// +// $Id$ +// +// NSNotificationAdditions.h +// sequel-pro +// +// Copied from the Colloquy project; original code available from Trac at +// http://colloquy.info/project/browser/trunk/Additions/NSNotificationAdditions.h +// +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// More info at <http://code.google.com/p/sequel-pro/> + +@interface NSNotificationCenter (NSNotificationCenterAdditions) +- (void) postNotificationOnMainThread:(NSNotification *) notification; +- (void) postNotificationOnMainThread:(NSNotification *) notification waitUntilDone:(BOOL) wait; + +- (void) postNotificationOnMainThreadWithName:(NSString *) name object:(id) object; +- (void) postNotificationOnMainThreadWithName:(NSString *) name object:(id) object userInfo:(NSDictionary *) userInfo; +- (void) postNotificationOnMainThreadWithName:(NSString *) name object:(id) object userInfo:(NSDictionary *) userInfo waitUntilDone:(BOOL) wait; +@end diff --git a/Source/NSNotificationAdditions.m b/Source/NSNotificationAdditions.m new file mode 100644 index 00000000..2e075ed3 --- /dev/null +++ b/Source/NSNotificationAdditions.m @@ -0,0 +1,75 @@ +// +// $Id$ +// +// NSNotificationAdditions.m +// sequel-pro +// +// Copied from the Colloquy project; original code available from Trac at +// http://colloquy.info/project/browser/trunk/Additions/NSNotificationAdditions.m +// +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// More info at <http://code.google.com/p/sequel-pro/> + +#import "NSNotificationAdditions.h" +#import <pthread.h> + +@implementation NSNotificationCenter (NSNotificationCenterAdditions) +- (void) postNotificationOnMainThread:(NSNotification *) notification { + if( pthread_main_np() ) return [self postNotification:notification]; + [self postNotificationOnMainThread:notification waitUntilDone:NO]; +} + +- (void) postNotificationOnMainThread:(NSNotification *) notification waitUntilDone:(BOOL) wait { + if( pthread_main_np() ) return [self postNotification:notification]; + [[self class] performSelectorOnMainThread:@selector( _postNotification: ) withObject:notification waitUntilDone:wait]; +} + ++ (void) _postNotification:(NSNotification *) notification { + [[self defaultCenter] postNotification:notification]; +} + +- (void) postNotificationOnMainThreadWithName:(NSString *) name object:(id) object { + if( pthread_main_np() ) return [self postNotificationName:name object:object userInfo:nil]; + [self postNotificationOnMainThreadWithName:name object:object userInfo:nil waitUntilDone:NO]; +} + +- (void) postNotificationOnMainThreadWithName:(NSString *) name object:(id) object userInfo:(NSDictionary *) userInfo { + if( pthread_main_np() ) return [self postNotificationName:name object:object userInfo:userInfo]; + [self postNotificationOnMainThreadWithName:name object:object userInfo:userInfo waitUntilDone:NO]; +} + +- (void) postNotificationOnMainThreadWithName:(NSString *) name object:(id) object userInfo:(NSDictionary *) userInfo waitUntilDone:(BOOL) wait { + if( pthread_main_np() ) return [self postNotificationName:name object:object userInfo:userInfo]; + + NSMutableDictionary *info = [[NSMutableDictionary allocWithZone:nil] initWithCapacity:3]; + if( name ) [info setObject:name forKey:@"name"]; + if( object ) [info setObject:object forKey:@"object"]; + if( userInfo ) [info setObject:userInfo forKey:@"userInfo"]; + + [[self class] performSelectorOnMainThread:@selector( _postNotificationName: ) withObject:info waitUntilDone:wait]; + + [info release]; +} + ++ (void) _postNotificationName:(NSDictionary *) info { + NSString *name = [info objectForKey:@"name"]; + id object = [info objectForKey:@"object"]; + NSDictionary *userInfo = [info objectForKey:@"userInfo"]; + + [[self defaultCenter] postNotificationName:name object:object userInfo:userInfo]; +} +@end diff --git a/Source/TableContent.m b/Source/TableContent.m index 60a7ce4a..bcaed509 100644 --- a/Source/TableContent.m +++ b/Source/TableContent.m @@ -638,7 +638,8 @@ if (rowsProcessed < targetRowCount) { [tableDocumentInstance setTaskPercentage:(rowsProcessed*relativeTargetRowCount)]; } else if (rowsProcessed == targetRowCount) { - [tableDocumentInstance performSelectorOnMainThread:@selector(setTaskProgressToIndeterminate) withObject:nil waitUntilDone:NO]; + [tableDocumentInstance setTaskPercentage:100.0]; + [tableDocumentInstance performSelectorOnMainThread:@selector(setTaskProgressToIndeterminateAfterDelay:) withObject:[NSNumber numberWithBool:YES] waitUntilDone:NO]; } } diff --git a/Source/TableDocument.h b/Source/TableDocument.h index db4b48ae..8164746a 100644 --- a/Source/TableDocument.h +++ b/Source/TableDocument.h @@ -187,7 +187,7 @@ - (void) showTaskProgressWindow:(NSTimer *)theTimer; - (void) setTaskDescription:(NSString *)description; - (void) setTaskPercentage:(float)taskPercentage; -- (void) setTaskProgressToIndeterminate; +- (void) setTaskProgressToIndeterminateAfterDelay:(BOOL)afterDelay; - (void) endTask; - (void) enableTaskCancellationWithTitle:(NSString *)buttonTitle callbackObject:(id)callbackObject callbackFunction:(SEL)callbackFunction; - (void) disableTaskCancellation; diff --git a/Source/TableDocument.m b/Source/TableDocument.m index 4e0f68fc..98a231ab 100644 --- a/Source/TableDocument.m +++ b/Source/TableDocument.m @@ -1266,7 +1266,7 @@ [[NSNotificationCenter defaultCenter] postNotificationName:SPDocumentTaskStartNotification object:self]; // Schedule appearance of the task window in the near future - taskDrawTimer = [[NSTimer scheduledTimerWithTimeInterval:0.25 target:self selector:@selector(showTaskProgressWindow:) userInfo:nil repeats:NO] retain]; + taskDrawTimer = [[NSTimer scheduledTimerWithTimeInterval:0.5 target:self selector:@selector(showTaskProgressWindow:) userInfo:nil repeats:NO] retain]; } } @@ -1306,6 +1306,7 @@ if (taskDisplayIsIndeterminate) { taskDisplayIsIndeterminate = NO; [taskProgressIndicator stopAnimation:self]; + [taskProgressIndicator setDoubleValue:0.5]; } taskProgressValue = taskPercentage; @@ -1319,10 +1320,17 @@ /** * Sets the task progress indicator back to indeterminate (also performed - * automatically whenever a new task is started) + * automatically whenever a new task is started). + * This can optionally be called with afterDelay set, in which case the intederminate + * switch will be made a fter a short pause to minimise flicker for short actions. */ -- (void) setTaskProgressToIndeterminate +- (void) setTaskProgressToIndeterminateAfterDelay:(BOOL)afterDelay { + if (afterDelay) { + [self performSelector:@selector(setTaskProgressToIndeterminateAfterDelay:) withObject:nil afterDelay:0.5]; + return; + } + if (taskDisplayIsIndeterminate) return; taskDisplayIsIndeterminate = YES; [taskProgressIndicator setIndeterminate:YES]; @@ -1354,9 +1362,11 @@ [taskFadeAnimator release], taskFadeAnimator = nil; } - // Hide the task interface + // Hide the task interface and reset to indeterminate if (taskDisplayIsIndeterminate) [taskProgressIndicator stopAnimation:self]; [taskProgressWindow setAlphaValue:0.0]; + taskDisplayIsIndeterminate = YES; + [taskProgressIndicator setIndeterminate:YES]; // Re-enable window interface [historyControl setEnabled:YES]; diff --git a/Source/TablesList.m b/Source/TablesList.m index f37be72e..eabf062f 100644 --- a/Source/TablesList.m +++ b/Source/TablesList.m @@ -35,6 +35,7 @@ #import "RegexKitLite.h" #import "SPDatabaseData.h" #import "NSMutableArray-MultipleSort.h" +#import "NSNotificationAdditions.h" #import "SPConstants.h" @interface TablesList (PrivateAPI) @@ -738,6 +739,14 @@ // Reset the table information caches [tableDataInstance resetAllData]; + if (selectedTableType == SP_TABLETYPE_TABLE) { + [tableDataInstance updateInformationForCurrentTable]; + } else if (selectedTableType == SP_TABLETYPE_VIEW) { + [tableDataInstance updateInformationForCurrentView]; + } + + // Notify listeners of the table change now that the state is fully set up. + [[NSNotificationCenter defaultCenter] postNotificationOnMainThreadWithName:SPTableChangedNotification object:tableDocumentInstance]; [separatorTableMenuItem setHidden:NO]; [separatorTableContextMenuItem setHidden:NO]; @@ -921,9 +930,6 @@ // Add a history entry [spHistoryControllerInstance updateHistoryEntries]; - - // Notify listeners of the table change now that the state is fully set up - [[NSNotificationCenter defaultCenter] postNotificationName:SPTableChangedNotification object:tableDocumentInstance]; // Empty the loading pool and exit the thread [tableDocumentInstance endTask]; diff --git a/Source/YRKSpinningProgressIndicator.m b/Source/YRKSpinningProgressIndicator.m index 4d211be3..cca0a28c 100644 --- a/Source/YRKSpinningProgressIndicator.m +++ b/Source/YRKSpinningProgressIndicator.m @@ -192,6 +192,7 @@ - (void)startAnimation:(id)sender { + if (!_isIndeterminate) return; if (_isAnimating) return; _isAnimating = YES; diff --git a/sequel-pro.xcodeproj/project.pbxproj b/sequel-pro.xcodeproj/project.pbxproj index c8a884d3..73980982 100644 --- a/sequel-pro.xcodeproj/project.pbxproj +++ b/sequel-pro.xcodeproj/project.pbxproj @@ -166,6 +166,7 @@ 589235321020C1230011DE00 /* SPHistoryController.m in Sources */ = {isa = PBXBuildFile; fileRef = 589235301020C1230011DE00 /* SPHistoryController.m */; }; 58BC5E56103898140058C2E6 /* MCPStreamingResult.h in Headers */ = {isa = PBXBuildFile; fileRef = 583B779710386B0200B21F7E /* MCPStreamingResult.h */; settings = {ATTRIBUTES = (Public, ); }; }; 58BC5E571038983E0058C2E6 /* MCPResultPlus.h in Headers */ = {isa = PBXBuildFile; fileRef = 17B7B5D1101603B200F057DE /* MCPResultPlus.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 58C34F5310B86CAE00D37E14 /* NSNotificationAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = 58C34F5210B86CAE00D37E14 /* NSNotificationAdditions.m */; }; 58C56EF50F438E120035701E /* SPDataCellFormatter.m in Sources */ = {isa = PBXBuildFile; fileRef = 58C56EF40F438E120035701E /* SPDataCellFormatter.m */; }; 58CB20ED0F79A75D005EA204 /* button_edit_mode_selected.tiff in Resources */ = {isa = PBXBuildFile; fileRef = 58CB20EC0F79A75D005EA204 /* button_edit_mode_selected.tiff */; }; 58CDB3300FCE138D00F8ACA3 /* SPSSHTunnel.m in Sources */ = {isa = PBXBuildFile; fileRef = 58CDB32F0FCE138D00F8ACA3 /* SPSSHTunnel.m */; }; @@ -569,6 +570,8 @@ 588B2CC70FE5641E00EC5FC0 /* ssh-disconnected.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "ssh-disconnected.png"; sourceTree = "<group>"; }; 589235301020C1230011DE00 /* SPHistoryController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SPHistoryController.m; sourceTree = "<group>"; }; 589235311020C1230011DE00 /* SPHistoryController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SPHistoryController.h; sourceTree = "<group>"; }; + 58C34F5110B86CAE00D37E14 /* NSNotificationAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NSNotificationAdditions.h; sourceTree = "<group>"; }; + 58C34F5210B86CAE00D37E14 /* NSNotificationAdditions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NSNotificationAdditions.m; sourceTree = "<group>"; }; 58C56EF30F438E120035701E /* SPDataCellFormatter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SPDataCellFormatter.h; sourceTree = "<group>"; }; 58C56EF40F438E120035701E /* SPDataCellFormatter.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SPDataCellFormatter.m; sourceTree = "<group>"; }; 58CB20EC0F79A75D005EA204 /* button_edit_mode_selected.tiff */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; path = button_edit_mode_selected.tiff; sourceTree = "<group>"; }; @@ -1414,6 +1417,8 @@ B52460D40F8EF92300171639 /* SPArrayAdditions.m */, 5841929F101E57BB0089807F /* NSMutableArray-MultipleSort.h */, 584192A0101E57BB0089807F /* NSMutableArray-MultipleSort.m */, + 58C34F5110B86CAE00D37E14 /* NSNotificationAdditions.h */, + 58C34F5210B86CAE00D37E14 /* NSNotificationAdditions.m */, 1789343A0F30C1DD0097539A /* SPStringAdditions.h */, 1789343B0F30C1DD0097539A /* SPStringAdditions.m */, B52460D50F8EF92300171639 /* SPTextViewAdditions.h */, @@ -1860,6 +1865,7 @@ 1792C13710AD75C800ABE758 /* SPServerVariablesController.m in Sources */, 1792C26110AE1A2D00ABE758 /* SPConnectionDelegate.m in Sources */, 17CC97F310B4ABE90034CD7A /* SPAboutController.m in Sources */, + 58C34F5310B86CAE00D37E14 /* NSNotificationAdditions.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; |