aboutsummaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorrowanbeentje <rowan@beent.je>2012-10-08 14:26:01 +0000
committerrowanbeentje <rowan@beent.je>2012-10-08 14:26:01 +0000
commitc55ffebc406d7d2af3c71b2dace3ec7e3238fd55 (patch)
tree24bd96933a185e5e1fc4629c221b20df2c933330 /Source
parent051e606e86cb7817defc2ecb2cf4efb7c6444e4c (diff)
downloadsequelpro-c55ffebc406d7d2af3c71b2dace3ec7e3238fd55.tar.gz
sequelpro-c55ffebc406d7d2af3c71b2dace3ec7e3238fd55.tar.bz2
sequelpro-c55ffebc406d7d2af3c71b2dace3ec7e3238fd55.zip
- Fix the Quick Connect entry on the connection screen being a drag and drop target
- Speculative fix for 10.6 & 10.5 connection screen padding/layout issues
Diffstat (limited to 'Source')
-rw-r--r--Source/SPConnectionController.h2
-rw-r--r--Source/SPConnectionController.m2
-rw-r--r--Source/SPConnectionControllerDelegate.m5
-rw-r--r--Source/SPConnectionControllerInitializer.m2
-rw-r--r--Source/SPFavoritesOutlineView.h3
-rw-r--r--Source/SPFavoritesOutlineView.m14
-rw-r--r--Source/SPOutlineView.m7
7 files changed, 23 insertions, 12 deletions
diff --git a/Source/SPConnectionController.h b/Source/SPConnectionController.h
index dda04343..6e439953 100644
--- a/Source/SPConnectionController.h
+++ b/Source/SPConnectionController.h
@@ -67,7 +67,7 @@
BOOL isConnecting;
BOOL isEditingConnection;
BOOL isTestingConnection;
-
+
// Standard details
NSInteger previousType;
NSInteger type;
diff --git a/Source/SPConnectionController.m b/Source/SPConnectionController.m
index a6ca5f75..f6e23656 100644
--- a/Source/SPConnectionController.m
+++ b/Source/SPConnectionController.m
@@ -1720,7 +1720,7 @@ static NSComparisonResult _compareFavoritesUsingKey(id favorite1, id favorite2,
{
[[NSNotificationCenter defaultCenter] removeObserver:self];
[NSObject cancelPreviousPerformRequestsWithTarget:self];
-
+
// Unregister observers
#ifndef SP_REFACTOR
[self removeObserver:self forKeyPath:SPFavoriteTypeKey];
diff --git a/Source/SPConnectionControllerDelegate.m b/Source/SPConnectionControllerDelegate.m
index 71ad1390..eee6f44d 100644
--- a/Source/SPConnectionControllerDelegate.m
+++ b/Source/SPConnectionControllerDelegate.m
@@ -303,7 +303,10 @@ static NSString *SPQuickConnectImageWhite = @"quick-connect-icon-white.pdf";
- (NSDragOperation)outlineView:(NSOutlineView *)outlineView validateDrop:(id <NSDraggingInfo>)info proposedItem:(id)item proposedChildIndex:(NSInteger)childIndex
{
NSDragOperation result = NSDragOperationNone;
-
+
+ // Prevent the top level or the quick connect item from being a target
+ if (!item || item == quickConnectItem) return result;
+
// Prevent dropping favorites on other favorites (non-groups)
if ((childIndex == NSOutlineViewDropOnItemIndex) && (![item isGroup])) return result;
diff --git a/Source/SPConnectionControllerInitializer.m b/Source/SPConnectionControllerInitializer.m
index 73ebcad8..b3f06691 100644
--- a/Source/SPConnectionControllerInitializer.m
+++ b/Source/SPConnectionControllerInitializer.m
@@ -62,7 +62,7 @@ static NSString *SPConnectionViewNibName = @"ConnectionView";
- (id)initWithDocument:(SPDatabaseDocument *)document
{
if ((self = [super init])) {
-
+
// Weak reference
dbDocument = document;
diff --git a/Source/SPFavoritesOutlineView.h b/Source/SPFavoritesOutlineView.h
index bc6a8b30..c2d8a8eb 100644
--- a/Source/SPFavoritesOutlineView.h
+++ b/Source/SPFavoritesOutlineView.h
@@ -31,5 +31,8 @@
// More info at <http://code.google.com/p/sequel-pro/>
@interface SPFavoritesOutlineView : NSOutlineView
+{
+ SInt32 systemVersion;
+}
@end
diff --git a/Source/SPFavoritesOutlineView.m b/Source/SPFavoritesOutlineView.m
index 08880ec8..69800606 100644
--- a/Source/SPFavoritesOutlineView.m
+++ b/Source/SPFavoritesOutlineView.m
@@ -37,6 +37,12 @@ static NSUInteger SPFavoritesOutlineViewUnindent = 14;
@implementation SPFavoritesOutlineView
+- (void) awakeFromNib
+{
+ systemVersion = 0;
+ Gestalt(gestaltSystemVersion, &systemVersion);
+}
+
- (BOOL)acceptsFirstResponder
{
return YES;
@@ -99,6 +105,11 @@ static NSUInteger SPFavoritesOutlineViewUnindent = 14;
{
NSRect superFrame = [super frameOfCellAtColumn:columnIndex row:rowIndex];
+ // On system versions lower than Lion, don't alter padding
+ if (systemVersion < 0x1070) {
+ return superFrame;
+ }
+
return NSMakeRect(superFrame.origin.x - SPFavoritesOutlineViewUnindent, superFrame.origin.y, superFrame.size.width + SPFavoritesOutlineViewUnindent, superFrame.size.height);
}
@@ -110,7 +121,8 @@ static NSUInteger SPFavoritesOutlineViewUnindent = 14;
{
NSRect superFrame = [super frameOfOutlineCellAtRow:rowIndex];
- if (superFrame.origin.x > SPFavoritesOutlineViewUnindent) {
+ // On versions of Lion or above, amend the padding appropriately
+ if (systemVersion >= 0x1070 && superFrame.origin.x > SPFavoritesOutlineViewUnindent) {
return NSMakeRect(superFrame.origin.x - SPFavoritesOutlineViewUnindent, superFrame.origin.y, superFrame.size.width, superFrame.size.height);
}
diff --git a/Source/SPOutlineView.m b/Source/SPOutlineView.m
index 187876be..0170b4f5 100644
--- a/Source/SPOutlineView.m
+++ b/Source/SPOutlineView.m
@@ -34,13 +34,6 @@
@implementation SPOutlineView
-- (id)init
-{
- self = [super init];
-
- return self;
-}
-
/**
* Right-click at row will select that row before ordering out the contextual menu
* if not more than one row is selected.