aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorstuconnolly <stuart02@gmail.com>2010-10-15 13:30:37 +0000
committerstuconnolly <stuart02@gmail.com>2010-10-15 13:30:37 +0000
commit60c5717869cdd6f68355f720b63a6df1bb7c87c6 (patch)
treea14845b63e78468da37ced37212a367de7670a20
parent067ad13b4b78a6477687ede0da89e288cff69ba0 (diff)
downloadsequelpro-60c5717869cdd6f68355f720b63a6df1bb7c87c6.tar.gz
sequelpro-60c5717869cdd6f68355f720b63a6df1bb7c87c6.tar.bz2
sequelpro-60c5717869cdd6f68355f720b63a6df1bb7c87c6.zip
Change the connection view's table view to be of type SPTableView so right-clicking a row results in it being selected first. Also, update SPTableView to prevent right-clicking of table view group headings. Fixes issue #867.
-rw-r--r--Interfaces/English.lproj/ConnectionView.xib55
-rw-r--r--Source/SPTableView.m82
-rw-r--r--sequel-pro.xcodeproj/project.pbxproj6
3 files changed, 78 insertions, 65 deletions
diff --git a/Interfaces/English.lproj/ConnectionView.xib b/Interfaces/English.lproj/ConnectionView.xib
index 77bd9719..978d87a3 100644
--- a/Interfaces/English.lproj/ConnectionView.xib
+++ b/Interfaces/English.lproj/ConnectionView.xib
@@ -3,7 +3,7 @@
<data>
<int key="IBDocument.SystemTarget">1050</int>
<string key="IBDocument.SystemVersion">10F569</string>
- <string key="IBDocument.InterfaceBuilderVersion">788</string>
+ <string key="IBDocument.InterfaceBuilderVersion">804</string>
<string key="IBDocument.AppKitVersion">1038.29</string>
<string key="IBDocument.HIToolboxVersion">461.00</string>
<object class="NSMutableDictionary" key="IBDocument.PluginVersions">
@@ -15,27 +15,22 @@
</object>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
- <string>788</string>
+ <string>804</string>
<string>1.2.5</string>
</object>
</object>
<object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
<bool key="EncodedWithXMLCoder">YES</bool>
- <integer value="5166"/>
+ <integer value="4910"/>
</object>
<object class="NSArray" key="IBDocument.PluginDependencies">
<bool key="EncodedWithXMLCoder">YES</bool>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.brandonwalkin.BWToolkit</string>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
</object>
<object class="NSMutableDictionary" key="IBDocument.Metadata">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="NSArray" key="dict.sortedKeys" id="0">
- <bool key="EncodedWithXMLCoder">YES</bool>
- </object>
- <object class="NSMutableArray" key="dict.values">
- <bool key="EncodedWithXMLCoder">YES</bool>
- </object>
+ <string key="NS.key.0">PluginDependencyRecalculationVersion</string>
+ <integer value="1" key="NS.object.0"/>
</object>
<object class="NSMutableArray" key="IBDocument.RootObjects" id="584594810">
<bool key="EncodedWithXMLCoder">YES</bool>
@@ -187,7 +182,7 @@
<reference key="NSSuperview" ref="524598165"/>
<reference key="NSTarget" ref="524598165"/>
<string key="NSAction">_doScroller:</string>
- <double key="NSPercent">0.99812382739212002</double>
+ <double key="NSPercent">0.99812382459640503</double>
</object>
<object class="NSScroller" id="802793151">
<reference key="NSNextResponder" ref="524598165"/>
@@ -502,7 +497,7 @@
<string key="NSColorName">controlColor</string>
<object class="NSColor" key="NSColor" id="355746054">
<int key="NSColorSpace">3</int>
- <bytes key="NSWhite">MC42NjY2NjY2NjY3AA</bytes>
+ <bytes key="NSWhite">MC42NjY2NjY2ODY1AA</bytes>
</object>
</object>
<reference key="NSTextColor" ref="434026568"/>
@@ -840,7 +835,7 @@
<reference key="NSBackgroundColor" ref="211632616"/>
<object class="NSColor" key="NSTextColor">
<int key="NSColorSpace">3</int>
- <bytes key="NSWhite">MC41MDQwMzIyNTgxAA</bytes>
+ <bytes key="NSWhite">MC41MDQwMzIyNTQyAA</bytes>
</object>
</object>
</object>
@@ -1240,7 +1235,7 @@
<reference key="NSBackgroundColor" ref="211632616"/>
<object class="NSColor" key="NSTextColor">
<int key="NSColorSpace">3</int>
- <bytes key="NSWhite">MC41MDQwMzIyNTgxAA</bytes>
+ <bytes key="NSWhite">MC41MDQwMzIyNTQyAA</bytes>
</object>
</object>
</object>
@@ -1676,7 +1671,7 @@
<reference key="NSBackgroundColor" ref="211632616"/>
<object class="NSColor" key="NSTextColor">
<int key="NSColorSpace">3</int>
- <bytes key="NSWhite">MC40OTU5Njc3NDE5AA</bytes>
+ <bytes key="NSWhite">MC40OTU5Njc3NDU4AA</bytes>
</object>
</object>
</object>
@@ -1816,7 +1811,7 @@
<reference key="NSTarget" ref="1058735001"/>
<string key="NSAction">_doScroller:</string>
<double key="NSCurValue">1</double>
- <double key="NSPercent">0.99775280898876406</double>
+ <double key="NSPercent">0.99775278568267822</double>
</object>
<object class="NSScroller" id="108277656">
<reference key="NSNextResponder" ref="1058735001"/>
@@ -1826,7 +1821,7 @@
<int key="NSsFlags">1</int>
<reference key="NSTarget" ref="1058735001"/>
<string key="NSAction">_doScroller:</string>
- <double key="NSPercent">0.97838616714697402</double>
+ <double key="NSPercent">0.97838616371154785</double>
</object>
</object>
<string key="NSFrameSize">{679, 443}</string>
@@ -1880,7 +1875,7 @@
<string key="NSWindowTitle">Error Detail</string>
<string key="NSWindowClass">NSPanel</string>
<nil key="NSViewClass"/>
- <string key="NSWindowContentMaxSize">{1.79769e+308, 1.79769e+308}</string>
+ <string key="NSWindowContentMaxSize">{3.40282e+38, 3.40282e+38}</string>
<string key="NSWindowContentMinSize">{100, 100}</string>
<object class="NSView" key="NSWindowView" id="536120400">
<nil key="NSNextResponder"/>
@@ -1920,9 +1915,9 @@
</object>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
- <object class="NSColor" id="47423510">
+ <object class="NSColor" id="993041153">
<int key="NSColorSpace">1</int>
- <bytes key="NSRGB">MC45MDE5NjA3OSAwLjkwMTk2MDc5IDAuOTAxOTYwNzkAA</bytes>
+ <bytes key="NSRGB">MC45MDE5NjA3OTAyIDAuOTAxOTYwNzkwMiAwLjkwMTk2MDc5MDIAA</bytes>
</object>
<object class="NSFont">
<string key="NSName">LucidaGrande</string>
@@ -2043,7 +2038,7 @@
</object>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
- <reference ref="47423510"/>
+ <reference ref="993041153"/>
<object class="NSFont">
<string key="NSName">LucidaGrande-Bold</string>
<double key="NSSize">10</double>
@@ -2206,7 +2201,7 @@
</object>
<string key="NSScreenRect">{{0, 0}, {1440, 878}}</string>
<string key="NSMinSize">{100, 119}</string>
- <string key="NSMaxSize">{1.79769e+308, 1.79769e+308}</string>
+ <string key="NSMaxSize">{3.40282e+38, 3.40282e+38}</string>
<string key="NSFrameAutosaveName"/>
</object>
<object class="NSUserDefaultsController" id="642702582">
@@ -4313,7 +4308,9 @@
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBObjectRecord">
<int key="objectID">0</int>
- <reference key="object" ref="0"/>
+ <object class="NSArray" key="object" id="0">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ </object>
<reference key="children" ref="584594810"/>
<nil key="parent"/>
</object>
@@ -5902,6 +5899,7 @@
<string>4910.IBPluginDependency</string>
<string>4911.IBPluginDependency</string>
<string>4912.IBPluginDependency</string>
+ <string>4913.CustomClassName</string>
<string>4913.IBPluginDependency</string>
<string>4915.IBPluginDependency</string>
<string>4918.CustomClassName</string>
@@ -6164,6 +6162,7 @@
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <string>SPTableView</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>ImageAndTextCell</string>
@@ -7259,6 +7258,14 @@
<string key="superclassName">NSView</string>
<reference key="sourceIdentifier" ref="968459546"/>
</object>
+ <object class="IBPartialClassDescription">
+ <string key="className">SPTableView</string>
+ <string key="superclassName">NSTableView</string>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBProjectSource</string>
+ <string key="minorKey">Source/SPTableView.h</string>
+ </object>
+ </object>
</object>
<object class="NSMutableArray" key="referencedPartialClassDescriptionsV3.2+">
<bool key="EncodedWithXMLCoder">YES</bool>
diff --git a/Source/SPTableView.m b/Source/SPTableView.m
index aa0b5067..b8590a9a 100644
--- a/Source/SPTableView.m
+++ b/Source/SPTableView.m
@@ -30,46 +30,46 @@
@implementation SPTableView
-/*
+/**
* Right-click at row will select that row before ordering out the contextual menu
- * if not more than one row is selected
+ * if not more than one row is selected.
*/
- (NSMenu *)menuForEvent:(NSEvent *)event
{
-
// Try to retrieve a reference to the table document (assuming this is frontmost tab)
SPDatabaseDocument *parentTableDocument = nil;
+
if ([[[[[self window] delegate] class] description] isEqualToString:@"SPWindowController"]) {
parentTableDocument = [[[self window] delegate] selectedTableDocument];
}
// If SPDatabaseDocument is performing a task suppress any context menu
- if (parentTableDocument && [parentTableDocument isWorking])
- return nil;
+ if (parentTableDocument && [parentTableDocument isWorking]) return nil;
// Check to see whether any edits-in-progress need to be saved before changing selections
- if (parentTableDocument && ![parentTableDocument couldCommitCurrentViewActions])
- return nil;
+ if (parentTableDocument && ![parentTableDocument couldCommitCurrentViewActions]) return nil;
// If more than one row is selected only returns the default contextual menu
- if([self numberOfSelectedRows] > 1)
- return [self menu];
+ if ([self numberOfSelectedRows] > 1) return [self menu];
// Right-click at a row will select that row before ordering out the context menu
NSInteger row = [self rowAtPoint:[self convertPoint:[event locationInWindow] fromView:nil]];
- if(row >= 0 && row < [self numberOfRows]) {
+
+ if (row >= 0 && row < [self numberOfRows]) {
// Check for SPTablesList if right-click on header, then suppress context menu
- if([[[[self delegate] class] description] isEqualToString:@"SPTablesList"]) {
- if([NSArrayObjectAtIndex([[self delegate] valueForKeyPath:@"tableTypes"], row) integerValue] == -1)
+ if ([[[[self delegate] class] description] isEqualToString:@"SPTablesList"]) {
+ if ([NSArrayObjectAtIndex([[self delegate] valueForKeyPath:@"tableTypes"], row) integerValue] == -1)
return nil;
}
- if([[[[self delegate] class] description] isEqualToString:@"SPQueryFavoriteManager"]) {
- if([NSArrayObjectAtIndex([[self delegate] valueForKeyPath:SPFavorites], row) objectForKey:@"headerOfFileURL"])
+
+ if ([[[[self delegate] class] description] isEqualToString:@"SPQueryFavoriteManager"]) {
+ if ([NSArrayObjectAtIndex([[self delegate] valueForKeyPath:SPFavorites], row) objectForKey:@"headerOfFileURL"])
return nil;
}
- if([[[[self delegate] class] description] isEqualToString:@"SPContentFilterManager"]) {
- if([NSArrayObjectAtIndex([[self delegate] valueForKeyPath:@"contentFilters"], row) objectForKey:@"headerOfFileURL"])
+
+ if ([[[[self delegate] class] description] isEqualToString:@"SPContentFilterManager"]) {
+ if ([NSArrayObjectAtIndex([[self delegate] valueForKeyPath:@"contentFilters"], row) objectForKey:@"headerOfFileURL"])
return nil;
}
@@ -80,33 +80,32 @@
return [self menu];
}
--(BOOL)acceptsFirstResponder
+- (BOOL)acceptsFirstResponder
{
return YES;
}
- (void)keyDown:(NSEvent *)theEvent
{
-
// Check if ENTER or RETURN is hit and edit the column.
- if ([self numberOfSelectedRows] == 1 && ([theEvent keyCode] == 36 || [theEvent keyCode] == 76))
- {
-
- if([[[[self delegate] class] description] isEqualToString:@"SPFieldMapperController"]) {
+ if ([self numberOfSelectedRows] == 1 && ([theEvent keyCode] == 36 || [theEvent keyCode] == 76)) {
- if([[self delegate] isGlobalValueSheetOpen]) {
+ if ([[[[self delegate] class] description] isEqualToString:@"SPFieldMapperController"]) {
+ if ([[self delegate] isGlobalValueSheetOpen]) {
[[self delegate] closeGlobalValuesSheet:nil];
return;
}
// ENTER or RETURN closes the SPFieldMapperController sheet
// by sending an object with the tag 1 if no table cell is edited
- if([[self delegate] canBeClosed]) {
+ if ([[self delegate] canBeClosed]) {
NSButton *b = [[[NSButton alloc] init] autorelease];
[b setTag:1];
[[self delegate] closeSheet:b];
+
return;
- } else {
+ }
+ else {
[super keyDown:theEvent];
return;
}
@@ -114,38 +113,45 @@
}
if (![[[[self delegate] class] description] isEqualToString:@"SPCustomQuery"] &&
- ![[[[self delegate] class] description] isEqualToString:@"SPQueryFavoriteManager"]){
+ ![[[[self delegate] class] description] isEqualToString:@"SPQueryFavoriteManager"]) {
// Ensure that editing is permitted
- if (![[self delegate] tableView:self shouldEditTableColumn:[[self tableColumns] objectAtIndex:0] row:[self selectedRow]])
- return;
+ if (![[self delegate] tableView:self shouldEditTableColumn:[[self tableColumns] objectAtIndex:0] row:[self selectedRow]]) return;
// Trigger a cell edit
[self editColumn:0 row:[self selectedRow] withEvent:nil select:YES];
+
return;
}
-
}
-
// Check if ESCAPE is hit and use it to cancel row editing if supported
- else if ([theEvent keyCode] == 53 && [[self delegate] respondsToSelector:@selector(cancelRowEditing)])
- {
+ else if ([theEvent keyCode] == 53 && [[self delegate] respondsToSelector:@selector(cancelRowEditing)]) {
if ([[self delegate] cancelRowEditing]) return;
}
[super keyDown:theEvent];
+}
+/**
+ * To prevent right-clicking in a column's 'group' heading, ask the delegate if we support selecting it
+ * as this normally doesn't apply to left-clicks. If we do support selecting this row, simply pass on the event.
+ */
+- (void)rightMouseDown:(NSEvent *)event
+{
+ if ([[self delegate] tableView:self shouldSelectRow:[self rowAtPoint:[self convertPoint:[event locationInWindow] fromView:nil]]]) {
+ [super rightMouseDown:event];
+ }
}
- (void)setFont:(NSFont *)font;
{
- NSArray *tableColumns;
- NSUInteger columnIndex;
-
- tableColumns = [self tableColumns];
- columnIndex = [tableColumns count];
- while (columnIndex--)
+ NSArray *tableColumns = [self tableColumns];
+ NSUInteger columnIndex = [tableColumns count];
+
+ while (columnIndex--)
+ {
[[(NSTableColumn *)[tableColumns objectAtIndex:columnIndex] dataCell] setFont:font];
+ }
}
@end
diff --git a/sequel-pro.xcodeproj/project.pbxproj b/sequel-pro.xcodeproj/project.pbxproj
index e4364456..538543e3 100644
--- a/sequel-pro.xcodeproj/project.pbxproj
+++ b/sequel-pro.xcodeproj/project.pbxproj
@@ -416,21 +416,21 @@
isa = PBXContainerItemProxy;
containerPortal = 2A37F4A9FDCFA73011CA2CEA /* Project object */;
proxyType = 1;
- remoteGlobalIDString = 8D15AC270486D014006FF6A4 /* Sequel Pro */;
+ remoteGlobalIDString = 8D15AC270486D014006FF6A4;
remoteInfo = "Sequel Pro";
};
1798AB2712676F14000D946A /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 2A37F4A9FDCFA73011CA2CEA /* Project object */;
proxyType = 1;
- remoteGlobalIDString = 8D15AC270486D014006FF6A4 /* Sequel Pro */;
+ remoteGlobalIDString = 8D15AC270486D014006FF6A4;
remoteInfo = "Sequel Pro";
};
1798AB401267731F000D946A /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 2A37F4A9FDCFA73011CA2CEA /* Project object */;
proxyType = 1;
- remoteGlobalIDString = 58B9096011C3A42B000826E5 /* xibLocalizationPostprocessor */;
+ remoteGlobalIDString = 58B9096011C3A42B000826E5;
remoteInfo = xibLocalizationPostprocessor;
};
17B7B59A1016039200F057DE /* PBXContainerItemProxy */ = {