aboutsummaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorMax <dmoagx@users.noreply.github.com>2018-05-09 20:19:12 +0200
committerMax <dmoagx@users.noreply.github.com>2018-05-09 20:19:12 +0200
commit1318bce4cd58d8aaa31c6c386c6b709713e1dde9 (patch)
tree0d39e5941201d9af12574da896dd61dc30d3b728 /Source
parent1a958facfa883c5e9604ea282c4bb4f809e981fe (diff)
downloadsequelpro-1318bce4cd58d8aaa31c6c386c6b709713e1dde9.tar.gz
sequelpro-1318bce4cd58d8aaa31c6c386c6b709713e1dde9.tar.bz2
sequelpro-1318bce4cd58d8aaa31c6c386c6b709713e1dde9.zip
#63: Change one outstanding UI issue
Diffstat (limited to 'Source')
-rw-r--r--Source/SPTableContent.h1
-rw-r--r--Source/SPTableContent.m14
-rw-r--r--Source/SPTableContentFilterController.h7
-rw-r--r--Source/SPTableContentFilterController.m5
4 files changed, 26 insertions, 1 deletions
diff --git a/Source/SPTableContent.h b/Source/SPTableContent.h
index c8f7100a..a670c69a 100644
--- a/Source/SPTableContent.h
+++ b/Source/SPTableContent.h
@@ -102,6 +102,7 @@ typedef NS_ENUM(NSInteger, SPTableContentFilterSource) {
IBOutlet SPTableContentFilterController *filterControllerInstance;
IBOutlet SPFilterTableController *filterTableController;
+ BOOL scrollViewHasRubberbandScrolling;
#endif
SPMySQLConnection *mySQLConnection;
diff --git a/Source/SPTableContent.m b/Source/SPTableContent.m
index 7a48dccf..40133b71 100644
--- a/Source/SPTableContent.m
+++ b/Source/SPTableContent.m
@@ -247,6 +247,8 @@ static void *TableContentKVOContext = &TableContentKVOContext;
[filterTableController setTarget:self];
[filterTableController setAction:@selector(filterTable:)];
+ //TODO This is only needed for 10.6 compatibility
+ scrollViewHasRubberbandScrolling = [[[filterControllerInstance view] enclosingScrollView] respondsToSelector:@selector(setVerticalScrollElasticity:)];
// Add observers for document task activity
[[NSNotificationCenter defaultCenter] addObserver:self
@@ -3417,7 +3419,7 @@ static void *TableContentKVOContext = &TableContentKVOContext;
NSRect contentViewRect = [contentAreaContainer frame];
CGFloat availableHeight = contentViewRect.size.height;
//the rule editor can ask for about one-third of the available space before we have it use it's scrollbar
- CGFloat givenHeight = MIN(requestedHeight + 1,(availableHeight / 3));
+ CGFloat givenHeight = MIN(requestedHeight + 1,(availableHeight / 3)); // +1 is the SPFillView at the bottom
// abort if the size didn't really change
NSRect ruleEditorRect = [filterRuleEditorContainer frame];
@@ -3442,6 +3444,16 @@ static void *TableContentKVOContext = &TableContentKVOContext;
[tableContentContainer setFrameSize:tableContentRect.size];
[filterRuleEditorContainer setFrame:ruleEditorRect];
}
+
+ //disable rubberband scrolling as long as there is nothing to scroll
+ if(scrollViewHasRubberbandScrolling) {
+ NSScrollView *filterControllerScroller = [[filterControllerInstance view] enclosingScrollView];
+ if (givenHeight > requestedHeight) { // note that givenHeight + 1 == requestedHeight in order to avoid scroll
+ [filterControllerScroller setVerticalScrollElasticity:NSScrollElasticityNone];
+ } else {
+ [filterControllerScroller setVerticalScrollElasticity:NSScrollElasticityAutomatic];
+ }
+ }
}
- (void)filterRuleEditorPreferredSizeChanged:(NSNotification *)notification
diff --git a/Source/SPTableContentFilterController.h b/Source/SPTableContentFilterController.h
index 3d4029d6..32aeec00 100644
--- a/Source/SPTableContentFilterController.h
+++ b/Source/SPTableContentFilterController.h
@@ -57,6 +57,13 @@ NSString * const SPTableContentFilterHeightChangedNotification;
}
/**
+ * Returns the rule editor view that is managed by this object
+ *
+ * SHOULD be called on the UI thread, or results may be inconsistent!
+ */
+- (NSRuleEditor *)view;
+
+/**
* Makes the first NSTextField found in the rule editor the first responder
*
* MUST BE CALLED ON THE UI THREAD!
diff --git a/Source/SPTableContentFilterController.m b/Source/SPTableContentFilterController.m
index bdddad42..c8efa952 100644
--- a/Source/SPTableContentFilterController.m
+++ b/Source/SPTableContentFilterController.m
@@ -735,6 +735,11 @@ static void _addIfNotNil(NSMutableArray *array, id toAdd);
[filterRuleEditor insertRowAtIndex:0 withType:NSRuleEditorRowTypeSimple asSubrowOfRow:-1 animate:NO];
}
+- (NSRuleEditor *)view
+{
+ return filterRuleEditor;
+}
+
- (NSString *)sqlWhereExpressionWithBinary:(BOOL)isBINARY error:(NSError **)err
{
NSMutableString *filterString = [[NSMutableString alloc] init];