Skip to content

Commit

Permalink
Merge pull request #2868 from abhibeckert/master
Browse files Browse the repository at this point in the history
#2863 fix LHS table views when dragging a tab off a window
  • Loading branch information
abhibeckert authored Aug 25, 2017
2 parents 0625044 + 16cf257 commit 2e809e6
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
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,8 @@
int64_t instanceId;
}

@property (assign) NSTableView *dbTablesTableView;

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

#import <PSMTabBar/PSMTabBarControl.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)
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 2e809e6

Please sign in to comment.