Permalink
Browse files

#63: Change one outstanding UI issue

  • Loading branch information...
dmoagx committed May 9, 2018
1 parent 1a958fa commit 1318bce4cd58d8aaa31c6c386c6b709713e1dde9
@@ -102,6 +102,7 @@ typedef NS_ENUM(NSInteger, SPTableContentFilterSource) {
IBOutlet SPTableContentFilterController *filterControllerInstance;
IBOutlet SPFilterTableController *filterTableController;
BOOL scrollViewHasRubberbandScrolling;
#endif
SPMySQLConnection *mySQLConnection;
@@ -247,6 +247,8 @@ - (void)awakeFromNib
[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 @@ - (void)updateFilterRuleEditorSize:(CGFloat)requestedHeight animate:(BOOL)animat
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 @@ - (void)updateFilterRuleEditorSize:(CGFloat)requestedHeight animate:(BOOL)animat
[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
@@ -56,6 +56,13 @@ NSString * const SPTableContentFilterHeightChangedNotification;
SEL action;
}
/**
* 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
*
@@ -735,6 +735,11 @@ - (void)addFilterExpression
[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];

0 comments on commit 1318bce

Please sign in to comment.