From 5eca837c7b35dc6c7a22d32e482399c897f0a566 Mon Sep 17 00:00:00 2001 From: Bibiko Date: Thu, 17 Jun 2010 08:04:13 +0000 Subject: =?UTF-8?q?=E2=80=A2=20if=20a=20text=20string=20is=20dragged=20on?= =?UTF-8?q?=20tab=20this=20tab=20will=20be=20selected=20and=20the=20corres?= =?UTF-8?q?ponding=20db=20doc=20switches=20to=20Custom=20Query=20editor=20?= =?UTF-8?q?to=20be=20able=20eg=20to=20drag=20a=20query=20from=20one=20tab?= =?UTF-8?q?=20to=20another=20one?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Frameworks/PSMTabBar/PSMTabBarControl.m | 8 +++++++- Source/SPDatabaseDocument.h | 1 + Source/SPDatabaseDocument.m | 8 ++++++++ 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/Frameworks/PSMTabBar/PSMTabBarControl.m b/Frameworks/PSMTabBar/PSMTabBarControl.m index 5b72f1e6..fdd30396 100644 --- a/Frameworks/PSMTabBar/PSMTabBarControl.m +++ b/Frameworks/PSMTabBar/PSMTabBarControl.m @@ -305,7 +305,7 @@ { delegate = object; - NSMutableArray *types = [NSMutableArray arrayWithObject:@"PSMTabBarControlItemPBType"]; + NSMutableArray *types = [NSMutableArray arrayWithObjects:@"PSMTabBarControlItemPBType", NSStringPboardType,nil]; //Update the allowed drag types if ([self delegate] && [[self delegate] respondsToSelector:@selector(allowedDraggedTypesForTabView:)]) { @@ -1499,6 +1499,12 @@ userInfo:sender repeats:NO] retain]; } + //If user drags a text string to a tab switch to Custom Query Editor + if (![[[cell representedObject] identifier] isCustomQuerySelected] + && [[[sender draggingPasteboard] types] indexOfObject:NSStringPboardType] != NSNotFound) { + [[[cell representedObject] identifier] performSelector:@selector(viewQuery:) withObject:nil]; + NSLog(@"A"); + } } return NSDragOperationCopy; } diff --git a/Source/SPDatabaseDocument.h b/Source/SPDatabaseDocument.h index 3ca3ad6f..7ce9d573 100644 --- a/Source/SPDatabaseDocument.h +++ b/Source/SPDatabaseDocument.h @@ -312,6 +312,7 @@ - (IBAction)viewRelations:(id)sender; - (IBAction)viewTriggers:(id)sender; - (IBAction)addConnectionToFavorites:(id)sender; +- (BOOL)isCustomQuerySelected; // Titlebar methods - (void)setStatusIconToImageWithName:(NSString *)imagePath; diff --git a/Source/SPDatabaseDocument.m b/Source/SPDatabaseDocument.m index c5381114..a36591e8 100644 --- a/Source/SPDatabaseDocument.m +++ b/Source/SPDatabaseDocument.m @@ -3468,6 +3468,14 @@ [connectionController addFavorite:self]; } +/** + * Return YES if Custom Query is active. + */ +- (BOOL)isCustomQuerySelected +{ + return [[self selectedToolbarItemIdentifier] isEqualToString:SPMainToolbarCustomQuery]; +} + /** * Called when the NSSavePanel sheet ends. Writes the server variables to the selected file if required. */ -- cgit v1.2.3