aboutsummaryrefslogtreecommitdiffstats
path: root/Source/SPWindowAdditions.m
diff options
context:
space:
mode:
authorBibiko <bibiko@eva.mpg.de>2010-10-22 23:19:21 +0000
committerBibiko <bibiko@eva.mpg.de>2010-10-22 23:19:21 +0000
commita24ef7bf96e86d8e9ad7ee3ac9147dfca5cb810d (patch)
tree574fb0ac9cb5653b8c27b510ba9caba8dd1172b0 /Source/SPWindowAdditions.m
parente4db241d2ddf8f4548355addb207ab6c77967e70 (diff)
downloadsequelpro-a24ef7bf96e86d8e9ad7ee3ac9147dfca5cb810d.tar.gz
sequelpro-a24ef7bf96e86d8e9ad7ee3ac9147dfca5cb810d.tar.bz2
sequelpro-a24ef7bf96e86d8e9ad7ee3ac9147dfca5cb810d.zip
• re-enabled three finger trackpad wiping gesture for controlling the table history
• CSV Import Field Mapper Sheet - fixed issue for inserting a global value containing a ' - started preparations of the "Add value or expression" sheet for future enhancements
Diffstat (limited to 'Source/SPWindowAdditions.m')
-rw-r--r--Source/SPWindowAdditions.m52
1 files changed, 27 insertions, 25 deletions
diff --git a/Source/SPWindowAdditions.m b/Source/SPWindowAdditions.m
index 90a7ce79..7fd7a780 100644
--- a/Source/SPWindowAdditions.m
+++ b/Source/SPWindowAdditions.m
@@ -33,42 +33,39 @@
*/
- (CGFloat)toolbarHeight
{
- NSRect windowFrame;
+ NSRect windowFrame;
CGFloat toolbarHeight = 0.0;
-
- if (([self toolbar]) && ([[self toolbar] isVisible])) {
- windowFrame = [NSWindow contentRectForFrameRect:[self frame] styleMask:[self styleMask]];
-
+
+ if ([self toolbar] && [[self toolbar] isVisible]) {
+ windowFrame = [NSWindow contentRectForFrameRect:[self frame] styleMask:[self styleMask]];
toolbarHeight = NSHeight(windowFrame) - NSHeight([[self contentView] frame]);
- }
-
- return toolbarHeight;
+ }
+
+ return toolbarHeight;
}
/**
* Resizes this window to the size of the supplied view.
*/
- (void)resizeForContentView:(NSView *)view titleBarVisible:(BOOL)visible
-{
+{
NSSize viewSize = [view frame].size;
- NSRect frame = [self frame];
-
- if ((viewSize.height) < [self contentMinSize].height) {
+ NSRect frame = [self frame];
+
+ if (viewSize.height < [self contentMinSize].height) {
viewSize.height = [self contentMinSize].height;
}
-
+
CGFloat newHeight = (viewSize.height + [self toolbarHeight]);
-
+
// If the title bar is visible add 22 pixels to new height of window.
- if (visible) {
- newHeight += 22;
- }
-
+ if (visible) newHeight += 22;
+
frame.origin.y += frame.size.height - newHeight;
-
+
frame.size.height = newHeight;
frame.size.width = viewSize.width;
-
+
[self setFrame:frame display:YES animate:YES];
}
@@ -77,13 +74,18 @@
*/
- (void)swipeWithEvent:(NSEvent *)anEvent
{
- if([[self delegate] isKindOfClass:[SPDatabaseDocument class]]
- && [[self delegate] valueForKeyPath:@"spHistoryControllerInstance"]
- && ![[self delegate] isWorking])
+
+ if(![[self delegate] isKindOfClass:[SPWindowController class]] || ![[[self delegate] documents] count]) return;
+
+ id frontDoc = [[self delegate] selectedTableDocument];
+
+ if( frontDoc && [frontDoc isKindOfClass:[SPDatabaseDocument class]]
+ && [frontDoc valueForKeyPath:@"spHistoryControllerInstance"]
+ && ![frontDoc isWorking])
if([anEvent deltaX] == -1.0f)
- [[[self delegate] valueForKeyPath:@"spHistoryControllerInstance"] valueForKey:@"goForwardInHistory"];
+ [[frontDoc valueForKeyPath:@"spHistoryControllerInstance"] valueForKey:@"goForwardInHistory"];
else if([anEvent deltaX] == 1.0f)
- [[[self delegate] valueForKeyPath:@"spHistoryControllerInstance"] valueForKey:@"goBackInHistory"];
+ [[frontDoc valueForKeyPath:@"spHistoryControllerInstance"] valueForKey:@"goBackInHistory"];
}
@end