aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBibiko <bibiko@eva.mpg.de>2009-07-15 15:26:49 +0000
committerBibiko <bibiko@eva.mpg.de>2009-07-15 15:26:49 +0000
commitbc8d45aebfbab783517560d949a8d53e36fba990 (patch)
tree9eb6659641b4efa05d6ef5f4b97d9f5bdd4527d9
parente778e46918e537f88bb41d27adf99f888e4b8ea3 (diff)
downloadsequelpro-bc8d45aebfbab783517560d949a8d53e36fba990.tar.gz
sequelpro-bc8d45aebfbab783517560d949a8d53e36fba990.tar.bz2
sequelpro-bc8d45aebfbab783517560d949a8d53e36fba990.zip
• a right-click at a row within a tableView will select that row before ordering out the contextual menu if not more than one row is selected
-rw-r--r--Interfaces/English.lproj/DBView.xib57
-rw-r--r--Source/CMCopyTable.h3
-rw-r--r--Source/SPTableView.h31
-rw-r--r--Source/SPTableView.m50
-rw-r--r--sequel-pro.xcodeproj/project.pbxproj6
5 files changed, 124 insertions, 23 deletions
diff --git a/Interfaces/English.lproj/DBView.xib b/Interfaces/English.lproj/DBView.xib
index 512e02bd..6ab01886 100644
--- a/Interfaces/English.lproj/DBView.xib
+++ b/Interfaces/English.lproj/DBView.xib
@@ -8,7 +8,6 @@
<string key="IBDocument.HIToolboxVersion">353.00</string>
<object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
<bool key="EncodedWithXMLCoder">YES</bool>
- <integer value="6142"/>
</object>
<object class="NSArray" key="IBDocument.PluginDependencies">
<bool key="EncodedWithXMLCoder">YES</bool>
@@ -47,7 +46,7 @@
<string key="NSWindowContentMaxSize">{3.40282e+38, 3.40282e+38}</string>
<string key="NSWindowContentMinSize">{780, 480}</string>
<object class="NSView" key="NSWindowView" id="579726586">
- <reference key="NSNextResponder"/>
+ <nil key="NSNextResponder"/>
<int key="NSvFlags">256</int>
<object class="NSMutableArray" key="NSSubviews">
<bool key="EncodedWithXMLCoder">YES</bool>
@@ -187,7 +186,6 @@
</object>
<string key="NSFrameSize">{212, 381}</string>
<reference key="NSSuperview" ref="233472824"/>
- <reference key="NSNextKeyView" ref="251040077"/>
<reference key="NSDocView" ref="251040077"/>
<object class="NSColor" key="NSBGColor" id="1024678221">
<int key="NSColorSpace">6</int>
@@ -219,7 +217,6 @@
</object>
<string key="NSFrameSize">{212, 381}</string>
<reference key="NSSuperview" ref="355288374"/>
- <reference key="NSNextKeyView" ref="73685676"/>
<int key="NSsFlags">528</int>
<reference key="NSVScroller" ref="693168867"/>
<reference key="NSHScroller" ref="656188692"/>
@@ -318,7 +315,6 @@
</object>
<string key="NSFrameSize">{212, 145}</string>
<reference key="NSSuperview" ref="298226231"/>
- <reference key="NSNextKeyView" ref="347093764"/>
<reference key="NSDocView" ref="347093764"/>
<reference key="NSBGColor" ref="1024678221"/>
<int key="NScvFlags">6</int>
@@ -345,7 +341,6 @@
</object>
<string key="NSFrameSize">{212, 145}</string>
<reference key="NSSuperview" ref="192579410"/>
- <reference key="NSNextKeyView" ref="685057119"/>
<int key="NSsFlags">512</int>
<reference key="NSVScroller" ref="245346414"/>
<reference key="NSHScroller" ref="353686052"/>
@@ -618,7 +613,7 @@
<object class="NSTabViewItem" id="831053945">
<string key="NSIdentifier">source</string>
<object class="NSView" key="NSView" id="461236772">
- <nil key="NSNextResponder"/>
+ <reference key="NSNextResponder" ref="714795046"/>
<int key="NSvFlags">256</int>
<object class="NSMutableArray" key="NSSubviews">
<bool key="EncodedWithXMLCoder">YES</bool>
@@ -1135,7 +1130,6 @@
</object>
<string key="NSFrame">{{1, 17}, {688, 289}}</string>
<reference key="NSSuperview" ref="22340145"/>
- <reference key="NSNextKeyView" ref="715508012"/>
<reference key="NSDocView" ref="715508012"/>
<reference key="NSBGColor" ref="1024678221"/>
<int key="NScvFlags">4</int>
@@ -1168,7 +1162,6 @@
</object>
<string key="NSFrame">{{1, 0}, {688, 17}}</string>
<reference key="NSSuperview" ref="22340145"/>
- <reference key="NSNextKeyView" ref="926883367"/>
<reference key="NSDocView" ref="926883367"/>
<reference key="NSBGColor" ref="1024678221"/>
<int key="NScvFlags">4</int>
@@ -1177,7 +1170,6 @@
</object>
<string key="NSFrame">{{-1, 22}, {690, 307}}</string>
<reference key="NSSuperview" ref="220777809"/>
- <reference key="NSNextKeyView" ref="16936123"/>
<int key="NSsFlags">562</int>
<reference key="NSVScroller" ref="943144555"/>
<reference key="NSHScroller" ref="456666876"/>
@@ -1720,7 +1712,6 @@
</object>
<string key="NSFrame">{{1, 17}, {688, 142}}</string>
<reference key="NSSuperview" ref="376224367"/>
- <reference key="NSNextKeyView" ref="584834515"/>
<reference key="NSDocView" ref="584834515"/>
<reference key="NSBGColor" ref="1024678221"/>
<int key="NScvFlags">4</int>
@@ -1753,7 +1744,6 @@
</object>
<string key="NSFrame">{{1, 0}, {688, 17}}</string>
<reference key="NSSuperview" ref="376224367"/>
- <reference key="NSNextKeyView" ref="459548655"/>
<reference key="NSDocView" ref="459548655"/>
<reference key="NSBGColor" ref="1024678221"/>
<int key="NScvFlags">4</int>
@@ -1762,7 +1752,6 @@
</object>
<string key="NSFrame">{{-1, 22}, {690, 160}}</string>
<reference key="NSSuperview" ref="1063281455"/>
- <reference key="NSNextKeyView" ref="794929378"/>
<int key="NSsFlags">562</int>
<reference key="NSVScroller" ref="1019209947"/>
<reference key="NSHScroller" ref="328951385"/>
@@ -1875,6 +1864,7 @@
</object>
</object>
<string key="NSFrame">{{10, 7}, {700, 544}}</string>
+ <reference key="NSSuperview" ref="714795046"/>
</object>
<string key="NSLabel">Structure</string>
<reference key="NSColor" ref="62854682"/>
@@ -1883,7 +1873,7 @@
<object class="NSTabViewItem" id="624106058">
<string key="NSIdentifier">content</string>
<object class="NSView" key="NSView" id="1013108064">
- <reference key="NSNextResponder" ref="714795046"/>
+ <nil key="NSNextResponder"/>
<int key="NSvFlags">256</int>
<object class="NSMutableArray" key="NSSubviews">
<bool key="EncodedWithXMLCoder">YES</bool>
@@ -2490,7 +2480,6 @@
</object>
</object>
<string key="NSFrame">{{10, 7}, {700, 544}}</string>
- <reference key="NSSuperview" ref="714795046"/>
</object>
<string key="NSLabel">Content</string>
<reference key="NSColor" ref="62854682"/>
@@ -4300,14 +4289,14 @@
<reference key="NSTabView" ref="714795046"/>
</object>
</object>
- <reference key="NSSelectedTabViewItem" ref="624106058"/>
+ <reference key="NSSelectedTabViewItem" ref="831053945"/>
<reference key="NSFont" ref="26"/>
<int key="NSTvFlags">134217731</int>
<bool key="NSAllowTruncatedLabels">YES</bool>
<bool key="NSDrawsBackground">YES</bool>
<object class="NSMutableArray" key="NSSubviews">
<bool key="EncodedWithXMLCoder">YES</bool>
- <reference ref="1013108064"/>
+ <reference ref="461236772"/>
</object>
</object>
</object>
@@ -4323,7 +4312,6 @@
</object>
</object>
<string key="NSFrameSize">{944, 550}</string>
- <reference key="NSSuperview"/>
</object>
<string key="NSScreenRect">{{0, 0}, {1920, 1178}}</string>
<string key="NSMinSize">{780, 502}</string>
@@ -15084,6 +15072,14 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string>
</object>
<int key="connectionID">6247</int>
</object>
+ <object class="IBConnectionRecord">
+ <object class="IBOutletConnection" key="connection">
+ <string key="label">menu</string>
+ <reference key="source" ref="251040077"/>
+ <reference key="destination" ref="556141845"/>
+ </object>
+ <int key="connectionID">6248</int>
+ </object>
</object>
<object class="IBMutableOrderedSet" key="objectRecords">
<object class="NSArray" key="orderedObjects">
@@ -21509,6 +21505,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string>
<string>1907.ImportedFromIB2</string>
<string>21.IBPluginDependency</string>
<string>21.ImportedFromIB2</string>
+ <string>22.CustomClassName</string>
<string>22.IBPluginDependency</string>
<string>22.ImportedFromIB2</string>
<string>222.IBPluginDependency</string>
@@ -21519,6 +21516,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string>
<string>23.ImportedFromIB2</string>
<string>231.IBPluginDependency</string>
<string>231.ImportedFromIB2</string>
+ <string>232.CustomClassName</string>
<string>232.IBPluginDependency</string>
<string>232.ImportedFromIB2</string>
<string>233.IBPluginDependency</string>
@@ -21549,6 +21547,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string>
<string>287.ImportedFromIB2</string>
<string>288.IBPluginDependency</string>
<string>288.ImportedFromIB2</string>
+ <string>289.CustomClassName</string>
<string>289.IBPluginDependency</string>
<string>289.ImportedFromIB2</string>
<string>29.IBPluginDependency</string>
@@ -23068,6 +23067,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string>
<reference ref="9"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<reference ref="9"/>
+ <string>SPTableView</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<reference ref="9"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
@@ -23078,6 +23078,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string>
<reference ref="9"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<reference ref="9"/>
+ <string>SPTableView</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<reference ref="9"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
@@ -23117,6 +23118,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string>
<reference ref="9"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<reference ref="9"/>
+ <string>SPTableView</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<reference ref="9"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
@@ -23638,8 +23640,8 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<reference ref="9"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>{{308, 115}, {944, 550}}</string>
- <string>{{308, 115}, {944, 550}}</string>
+ <string>{{500, 144}, {944, 550}}</string>
+ <string>{{500, 144}, {944, 550}}</string>
<reference ref="9"/>
<reference ref="9"/>
<string>{{62, 352}, {845, 504}}</string>
@@ -24304,7 +24306,7 @@ aGUgYWN0aXZlIHNlbGVjdGlvbiAo4oyl4oyYUik</string>
<string>com.brandonwalkin.BWToolkit</string>
<string>com.brandonwalkin.BWToolkit</string>
<string>com.brandonwalkin.BWToolkit</string>
- <string>{{463, 282}, {157, 98}}</string>
+ <string>{{300, 100}, {157, 98}}</string>
<string>com.brandonwalkin.BWToolkit</string>
<string>com.brandonwalkin.BWToolkit</string>
<object class="NSMutableDictionary">
@@ -24644,7 +24646,7 @@ Y2hhbmdlIHRoZSBvcmRlcg</string>
</object>
</object>
<nil key="sourceID"/>
- <int key="maxID">6247</int>
+ <int key="maxID">6248</int>
</object>
<object class="IBClassDescriber" key="IBDocument.Classes">
<object class="NSMutableArray" key="referencedPartialClassDescriptions">
@@ -25895,6 +25897,17 @@ Y2hhbmdlIHRoZSBvcmRlcg</string>
</object>
</object>
</object>
+ <object class="NSMutableArray" key="referencedPartialClassDescriptionsV3.1+">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="IBPartialClassDescription">
+ <string key="className">SPTableView</string>
+ <string key="superclassName">NSTableView</string>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBDocumentRelativeSource</string>
+ <string key="minorKey">../../Source/SPTableView.h</string>
+ </object>
+ </object>
+ </object>
</object>
<int key="IBDocument.localizationMode">0</int>
<string key="IBDocument.LastKnownRelativeProjectPath">../../sequel-pro.xcodeproj</string>
diff --git a/Source/CMCopyTable.h b/Source/CMCopyTable.h
index 5da66ec2..4bedac2c 100644
--- a/Source/CMCopyTable.h
+++ b/Source/CMCopyTable.h
@@ -23,6 +23,7 @@
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#import <AppKit/AppKit.h>
+#import "SPTableView.h"
/*!
@class copyTable
@@ -32,7 +33,7 @@
is in similar format. The values for each cell are obtained via the
objects description method
*/
-@interface CMCopyTable : NSTableView
+@interface CMCopyTable : SPTableView
{
id tableInstance; // the table content view instance
diff --git a/Source/SPTableView.h b/Source/SPTableView.h
new file mode 100644
index 00000000..b9b3bfc4
--- /dev/null
+++ b/Source/SPTableView.h
@@ -0,0 +1,31 @@
+//
+// $Id: SPTableView.h 866 2009-06-15 16:05:54Z bibiko $
+//
+// SPTableView.h
+// sequel-pro
+//
+// Created by Hans-Jörg Bibiko on July 15, 2009
+//
+// 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 <Cocoa/Cocoa.h>
+
+
+@interface SPTableView : NSTableView
+
+
+@end
diff --git a/Source/SPTableView.m b/Source/SPTableView.m
new file mode 100644
index 00000000..30ba9674
--- /dev/null
+++ b/Source/SPTableView.m
@@ -0,0 +1,50 @@
+//
+// $Id: SPTableView.m 866 2009-06-15 16:05:54Z bibiko $
+//
+// SPTableView.m
+// sequel-pro
+//
+// Created by Hans-Jörg Bibiko on July 15, 2009
+//
+// 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 "SPTableView.h"
+
+
+@implementation SPTableView
+
+/*
+ * Right-click at row will select that row before ordering out the contextual menu
+ * if not more than one row is selected
+ */
+- (NSMenu *)menuForEvent:(NSEvent *)event
+{
+
+ // If more than one row is selected only returns the default contextual menu
+ if([self numberOfSelectedRows] > 1)
+ return [self menu];
+
+ // Right-click at a row will select that row before ordering out the context menu
+ int row = [self rowAtPoint:[self convertPoint:[event locationInWindow] fromView:nil]];
+ if(row >= 0 && row < [self numberOfRows]) {
+ [self selectRow:row byExtendingSelection:NO];
+ [[self window] makeFirstResponder:self];
+ }
+ return [self menu];
+}
+
+@end
diff --git a/sequel-pro.xcodeproj/project.pbxproj b/sequel-pro.xcodeproj/project.pbxproj
index c39a019a..225cbcbb 100644
--- a/sequel-pro.xcodeproj/project.pbxproj
+++ b/sequel-pro.xcodeproj/project.pbxproj
@@ -159,6 +159,7 @@
BC1E55C4100DC92200AAE9F0 /* table-view-small-square.tiff in Resources */ = {isa = PBXBuildFile; fileRef = BC1E55C3100DC92200AAE9F0 /* table-view-small-square.tiff */; };
BC2C16D40FEBEDF10003993B /* SPDataAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = BC2C16D30FEBEDF10003993B /* SPDataAdditions.m */; };
BC2C8E220FA8C2DB008468C7 /* sequel-pro-mysql-help-template.html in Resources */ = {isa = PBXBuildFile; fileRef = BC2C8E210FA8C2DB008468C7 /* sequel-pro-mysql-help-template.html */; };
+ BC8C8532100E0A8000D7A129 /* SPTableView.m in Sources */ = {isa = PBXBuildFile; fileRef = BC8C8531100E0A8000D7A129 /* SPTableView.m */; };
BC99296E0FF3D001008B79AB /* SPFieldEditor.m in Sources */ = {isa = PBXBuildFile; fileRef = BC99296D0FF3D001008B79AB /* SPFieldEditor.m */; };
BCD0AD490FBBFC340066EA5C /* SPSQLTokenizer.l in Sources */ = {isa = PBXBuildFile; fileRef = BCD0AD480FBBFC340066EA5C /* SPSQLTokenizer.l */; };
/* End PBXBuildFile section */
@@ -453,6 +454,8 @@
BC2C16D20FEBEDF10003993B /* SPDataAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SPDataAdditions.h; sourceTree = "<group>"; };
BC2C16D30FEBEDF10003993B /* SPDataAdditions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SPDataAdditions.m; sourceTree = "<group>"; };
BC2C8E210FA8C2DB008468C7 /* sequel-pro-mysql-help-template.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = "sequel-pro-mysql-help-template.html"; sourceTree = "<group>"; };
+ BC8C8530100E0A8000D7A129 /* SPTableView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SPTableView.h; sourceTree = "<group>"; };
+ BC8C8531100E0A8000D7A129 /* SPTableView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SPTableView.m; sourceTree = "<group>"; };
BC99296C0FF3D001008B79AB /* SPFieldEditor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SPFieldEditor.h; sourceTree = "<group>"; };
BC99296D0FF3D001008B79AB /* SPFieldEditor.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SPFieldEditor.m; sourceTree = "<group>"; };
BCD0AD480FBBFC340066EA5C /* SPSQLTokenizer.l */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.lex; path = SPSQLTokenizer.l; sourceTree = "<group>"; };
@@ -696,6 +699,8 @@
B57747DB0F7A89D0003B34F9 /* SPFavoriteTextFieldCell.m */,
17E6416A0EF01F37001BC333 /* TableDocumentSplitView.h */,
17E6416B0EF01F37001BC333 /* TableDocumentSplitView.m */,
+ BC8C8530100E0A8000D7A129 /* SPTableView.h */,
+ BC8C8531100E0A8000D7A129 /* SPTableView.m */,
);
name = Views;
sourceTree = "<group>";
@@ -1268,6 +1273,7 @@
BC2C16D40FEBEDF10003993B /* SPDataAdditions.m in Sources */,
BC99296E0FF3D001008B79AB /* SPFieldEditor.m in Sources */,
5822C9B51000DB2400DCC3D6 /* SPConnectionController.m in Sources */,
+ BC8C8532100E0A8000D7A129 /* SPTableView.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};