aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorstuconnolly <stuart02@gmail.com>2010-11-10 18:38:45 +0000
committerstuconnolly <stuart02@gmail.com>2010-11-10 18:38:45 +0000
commitdb80c9b84be4326d2e2d36839c532159fb9d61fd (patch)
tree334c668db00c997c134163b8a1400d79b4e6fdae
parentb72f9507c2be480c680b7f58753789432882f1c4 (diff)
downloadsequelpro-db80c9b84be4326d2e2d36839c532159fb9d61fd.tar.gz
sequelpro-db80c9b84be4326d2e2d36839c532159fb9d61fd.tar.bz2
sequelpro-db80c9b84be4326d2e2d36839c532159fb9d61fd.zip
Add a new outline view to be used by the connection view so hitting enter doesn't start editing the selected favorite. This will also allow behaviour to be further customised. Fixes issue #892.
-rw-r--r--Interfaces/English.lproj/ConnectionView.xib23
-rw-r--r--Source/SPFavoritesOutlineView.h28
-rw-r--r--Source/SPFavoritesOutlineView.m71
-rw-r--r--Source/SPOutlineView.m36
-rw-r--r--sequel-pro.xcodeproj/project.pbxproj6
5 files changed, 120 insertions, 44 deletions
diff --git a/Interfaces/English.lproj/ConnectionView.xib b/Interfaces/English.lproj/ConnectionView.xib
index 8243fa90..d8829c89 100644
--- a/Interfaces/English.lproj/ConnectionView.xib
+++ b/Interfaces/English.lproj/ConnectionView.xib
@@ -110,7 +110,7 @@
</object>
<object class="NSTextFieldCell" key="NSDataCell" id="93569184">
<int key="NSCellFlags">69336641</int>
- <int key="NSCellFlags2">133120</int>
+ <int key="NSCellFlags2">137216</int>
<string key="NSContents">Text Cell</string>
<reference key="NSSupport" ref="26"/>
<reference key="NSControlView" ref="1012579052"/>
@@ -154,7 +154,7 @@
</object>
</object>
<double key="NSRowHeight">17</double>
- <int key="NSTvFlags">373293056</int>
+ <int key="NSTvFlags">104857600</int>
<reference key="NSDelegate"/>
<reference key="NSDataSource"/>
<int key="NSColumnAutoresizingStyle">5</int>
@@ -6162,7 +6162,7 @@
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>SPOutlineView</string>
+ <string>SPFavoritesOutlineView</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>SPTableTextFieldCell</string>
@@ -7261,19 +7261,26 @@
<reference key="sourceIdentifier" ref="968459546"/>
</object>
<object class="IBPartialClassDescription">
- <string key="className">SPFlippedView</string>
- <string key="superclassName">NSView</string>
- <reference key="sourceIdentifier" ref="968459546"/>
+ <string key="className">SPConnectionController</string>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBProjectSource</string>
+ <string key="minorKey">Source/SPConnectionControllerDelegate.h</string>
+ </object>
</object>
<object class="IBPartialClassDescription">
- <string key="className">SPOutlineView</string>
+ <string key="className">SPFavoritesOutlineView</string>
<string key="superclassName">NSOutlineView</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBProjectSource</string>
- <string key="minorKey">Source/SPOutlineView.h</string>
+ <string key="minorKey">Source/SPFavoritesOutlineView.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
+ <string key="className">SPFlippedView</string>
+ <string key="superclassName">NSView</string>
+ <reference key="sourceIdentifier" ref="968459546"/>
+ </object>
+ <object class="IBPartialClassDescription">
<string key="className">SPTableTextFieldCell</string>
<string key="superclassName">ImageAndTextCell</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
diff --git a/Source/SPFavoritesOutlineView.h b/Source/SPFavoritesOutlineView.h
new file mode 100644
index 00000000..e9972d99
--- /dev/null
+++ b/Source/SPFavoritesOutlineView.h
@@ -0,0 +1,28 @@
+//
+// $Id$
+//
+// SPFavoritesOutlineView.h
+// sequel-pro
+//
+// Created by Stuart Connolly (stuconnolly.com) on November 10, 2010
+// Copyright (c) 2010 Stuart Connolly. All rights reserved.
+//
+// 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 SPFavoritesOutlineView : NSOutlineView
+
+@end
diff --git a/Source/SPFavoritesOutlineView.m b/Source/SPFavoritesOutlineView.m
new file mode 100644
index 00000000..6930c281
--- /dev/null
+++ b/Source/SPFavoritesOutlineView.m
@@ -0,0 +1,71 @@
+//
+// $Id$
+//
+// SPFavoritesOutlineView.m
+// sequel-pro
+//
+// Created by Stuart Connolly (stuconnolly.com) on November 10, 2010
+// Copyright (c) 2010 Stuart Connolly. All rights reserved.
+//
+// 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 "SPFavoritesOutlineView.h"
+
+@implementation SPFavoritesOutlineView
+
+- (BOOL)acceptsFirstResponder
+{
+ return YES;
+}
+
+/**
+ * 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 return 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
+ NSInteger row = [self rowAtPoint:[self convertPoint:[event locationInWindow] fromView:nil]];
+
+ if ((row >= 0) && (row < [self numberOfRows])) {
+ [self selectRowIndexes:[NSIndexSet indexSetWithIndex:row] byExtendingSelection:NO];
+ [[self window] makeFirstResponder:self];
+ }
+
+ return [self menu];
+}
+
+/**
+ * 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] respondsToSelector:@selector(outlineView:shouldSelectItem:)]) {
+ if ([[self delegate] outlineView:self shouldSelectItem:[self itemAtRow:[self rowAtPoint:[self convertPoint:[event locationInWindow] fromView:nil]]]]) {
+ [super rightMouseDown:event];
+ }
+ }
+ else {
+ [super rightMouseDown:event];
+ }
+}
+
+@end
diff --git a/Source/SPOutlineView.m b/Source/SPOutlineView.m
index 7ae50072..f60807f3 100644
--- a/Source/SPOutlineView.m
+++ b/Source/SPOutlineView.m
@@ -42,40 +42,4 @@
}
}
-/**
- * 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 return 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
- NSInteger row = [self rowAtPoint:[self convertPoint:[event locationInWindow] fromView:nil]];
-
- if ((row >= 0) && (row < [self numberOfRows])) {
- [self selectRowIndexes:[NSIndexSet indexSetWithIndex:row] byExtendingSelection:NO];
- [[self window] makeFirstResponder:self];
- }
-
- return [self menu];
-}
-
-/**
- * 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] respondsToSelector:@selector(outlineView:shouldSelectItem:)]) {
- if ([[self delegate] outlineView:self shouldSelectItem:[self itemAtRow:[self rowAtPoint:[self convertPoint:[event locationInWindow] fromView:nil]]]]) {
- [super rightMouseDown:event];
- }
- }
- else {
- [super rightMouseDown:event];
- }
-}
-
@end
diff --git a/sequel-pro.xcodeproj/project.pbxproj b/sequel-pro.xcodeproj/project.pbxproj
index 9b6f156a..304072c1 100644
--- a/sequel-pro.xcodeproj/project.pbxproj
+++ b/sequel-pro.xcodeproj/project.pbxproj
@@ -125,6 +125,7 @@
17D3C6041289BF350047709F /* SPConnectionControllerDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 17D3C6031289BF350047709F /* SPConnectionControllerDelegate.m */; };
17D3C66E128AD4710047709F /* SPFavoritesController.m in Sources */ = {isa = PBXBuildFile; fileRef = 17D3C66D128AD4710047709F /* SPFavoritesController.m */; };
17D3C671128AD8160047709F /* SPSingleton.m in Sources */ = {isa = PBXBuildFile; fileRef = 17D3C670128AD8160047709F /* SPSingleton.m */; };
+ 17D3C6D3128B1C900047709F /* SPFavoritesOutlineView.m in Sources */ = {isa = PBXBuildFile; fileRef = 17D3C6D2128B1C900047709F /* SPFavoritesOutlineView.m */; };
17D3DC201281816E002A163A /* SPDatabaseViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 17D3DC1F1281816E002A163A /* SPDatabaseViewController.m */; };
17DC8E75126F4AB600E9AAEC /* MCPConnectionDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = 17DC8E74126F4AB600E9AAEC /* MCPConnectionDelegate.h */; settings = {ATTRIBUTES = (Public, ); }; };
17DCC5C7115C202700F89A00 /* MCPStringAdditions.h in Headers */ = {isa = PBXBuildFile; fileRef = 17DCC5C5115C202700F89A00 /* MCPStringAdditions.h */; };
@@ -714,6 +715,8 @@
17D3C66D128AD4710047709F /* SPFavoritesController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SPFavoritesController.m; sourceTree = "<group>"; };
17D3C66F128AD8160047709F /* SPSingleton.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SPSingleton.h; sourceTree = "<group>"; };
17D3C670128AD8160047709F /* SPSingleton.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SPSingleton.m; sourceTree = "<group>"; };
+ 17D3C6D1128B1C900047709F /* SPFavoritesOutlineView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SPFavoritesOutlineView.h; sourceTree = "<group>"; };
+ 17D3C6D2128B1C900047709F /* SPFavoritesOutlineView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SPFavoritesOutlineView.m; sourceTree = "<group>"; };
17D3DC1E1281816E002A163A /* SPDatabaseViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SPDatabaseViewController.h; sourceTree = "<group>"; };
17D3DC1F1281816E002A163A /* SPDatabaseViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SPDatabaseViewController.m; sourceTree = "<group>"; };
17DA04EA0FC1A7DA00D66140 /* Unit Tests-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = "Unit Tests-Info.plist"; path = "Plists/Unit Tests-Info.plist"; sourceTree = "<group>"; };
@@ -1849,6 +1852,8 @@
children = (
173C44D61044A6AF001F3A30 /* SPOutlineView.h */,
173C44D71044A6B0001F3A30 /* SPOutlineView.m */,
+ 17D3C6D1128B1C900047709F /* SPFavoritesOutlineView.h */,
+ 17D3C6D2128B1C900047709F /* SPFavoritesOutlineView.m */,
BC4DF1961158FB280059FABD /* SPNavigatorOutlineView.h */,
BC4DF1971158FB280059FABD /* SPNavigatorOutlineView.m */,
);
@@ -3078,6 +3083,7 @@
17D3C6041289BF350047709F /* SPConnectionControllerDelegate.m in Sources */,
17D3C66E128AD4710047709F /* SPFavoritesController.m in Sources */,
17D3C671128AD8160047709F /* SPSingleton.m in Sources */,
+ 17D3C6D3128B1C900047709F /* SPFavoritesOutlineView.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};