aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBibiko <bibiko@eva.mpg.de>2009-08-21 19:10:39 +0000
committerBibiko <bibiko@eva.mpg.de>2009-08-21 19:10:39 +0000
commita946912ea562fe7eb02ec51b77420e63db3a38da (patch)
tree5d4d6bec7626196c376cc190b426ebea020d28ab
parent2b4af74516353df1a8e4db256a2b3e58f319ed94 (diff)
downloadsequelpro-a946912ea562fe7eb02ec51b77420e63db3a38da.tar.gz
sequelpro-a946912ea562fe7eb02ec51b77420e63db3a38da.tar.bz2
sequelpro-a946912ea562fe7eb02ec51b77420e63db3a38da.zip
• an attempt to improve the cascading of new connection windows for large windows
-rw-r--r--Source/TableDocument.m17
1 files changed, 17 insertions, 0 deletions
diff --git a/Source/TableDocument.m b/Source/TableDocument.m
index 52d3fe2c..86763614 100644
--- a/Source/TableDocument.m
+++ b/Source/TableDocument.m
@@ -102,6 +102,23 @@
NSPoint topLeftPoint = previousFrame.origin;
topLeftPoint.y += previousFrame.size.height;
[tableWindow setFrameTopLeftPoint:[tableWindow cascadeTopLeftFromPoint:topLeftPoint]];
+
+ // iTry to check if new frame fits into the screen
+ NSRect screenFrame = [[NSScreen mainScreen] frame];
+ NSScreen* candidate;
+ for(candidate in [NSScreen screens])
+ if(NSMinX([candidate frame]) < topLeftPoint.x && NSMinX([candidate frame]) > NSMinX(screenFrame))
+ screenFrame = [candidate frame];
+
+ previousFrame = [tableWindow frame];
+ topLeftPoint = previousFrame.origin;
+ if(topLeftPoint.x + previousFrame.size.width > screenFrame.size.width-1) {
+ previousFrame.size.width -= 50;
+ previousFrame.size.height -= 50;
+ previousFrame.origin.y += 50;
+ [tableWindow setFrame:previousFrame display:YES];
+ }
+
}
// Set up the toolbar