Skip to content

Commit

Permalink
#2863 fix LHS table views when dragging a tab off a window
Browse files Browse the repository at this point in the history
  • Loading branch information
abhibeckert committed Aug 25, 2017
1 parent ff0e2a8 commit 16cf257
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Source/SPDatabaseDocument.h
Expand Up @@ -291,6 +291,8 @@
int64_t instanceId; int64_t instanceId;
} }


@property (assign) NSTableView *dbTablesTableView;

#ifdef SP_CODA /* ivars */ #ifdef SP_CODA /* ivars */
@property (assign) SPDatabaseData* databaseDataInstance; @property (assign) SPDatabaseData* databaseDataInstance;
@property (assign) SPTableData* tableDataInstance; @property (assign) SPTableData* tableDataInstance;
Expand Down
11 changes: 11 additions & 0 deletions Source/SPWindowControllerDelegate.m
Expand Up @@ -33,6 +33,8 @@
#import "SPDatabaseDocument.h" #import "SPDatabaseDocument.h"
#import "SPDatabaseViewController.h" #import "SPDatabaseViewController.h"
#import "SPAppController.h" #import "SPAppController.h"
#import "SPConnectionController.h"
#import "SPFavoritesOutlineView.h"


#import <PSMTabBar/PSMTabBarControl.h> #import <PSMTabBar/PSMTabBarControl.h>
#import <PSMTabBar/PSMTabStyle.h> #import <PSMTabBar/PSMTabStyle.h>
Expand Down Expand Up @@ -248,6 +250,15 @@ - (void)tabView:(NSTabView*)aTabView didDropTabViewItem:(NSTabViewItem *)tabView


// Check the window and move it to front if it's key (eg for new window creation) // Check the window and move it to front if it's key (eg for new window creation)
if ([[tabBarControl window] isKeyWindow]) [[tabBarControl window] orderFront:self]; if ([[tabBarControl window] isKeyWindow]) [[tabBarControl window] orderFront:self];

// workaround bug where "source list" table views are broken in the new window. See https://github.com/sequelpro/sequelpro/issues/2863
SPWindowController *newWindowController = tabBarControl.window.windowController;
newWindowController.selectedTableDocument.connectionController.favoritesOutlineView.selectionHighlightStyle = NSTableViewSelectionHighlightStyleRegular;
newWindowController.selectedTableDocument.dbTablesTableView.selectionHighlightStyle = NSTableViewSelectionHighlightStyleRegular;
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0)), dispatch_get_main_queue(), ^{
newWindowController.selectedTableDocument.dbTablesTableView.selectionHighlightStyle = NSTableViewSelectionHighlightStyleSourceList;
newWindowController.selectedTableDocument.connectionController.favoritesOutlineView.selectionHighlightStyle = NSTableViewSelectionHighlightStyleSourceList;
});
} }


/** /**
Expand Down

0 comments on commit 16cf257

Please sign in to comment.