Permalink
Browse files

#63: Rename class SPTableContentFilterController to SPRuleFilterContr…

…oller to reduce confusion
  • Loading branch information...
dmoagx committed May 13, 2018
1 parent e49d33e commit c2fe67ba840a5f4eaa2aed786da3e559b3a8b150
@@ -4596,7 +4596,7 @@ Gw
<outlet property="contentViewPane" destination="27" id="6661"/>
<outlet property="countText" destination="261" id="262"/>
<outlet property="duplicateButton" destination="5178" id="7837"/>
<outlet property="filterControllerInstance" destination="ki9-Po-bdr" id="5od-0U-9xj"/>
<outlet property="ruleFilterController" destination="ki9-Po-bdr" id="5od-0U-9xj"/>
<outlet property="filterRuleEditorContainer" destination="9oo-u0-ndW" id="OZb-jI-CMy"/>
<outlet property="filterTableController" destination="UBS-cN-3Af" id="FV7-by-Gy1"/>
<outlet property="multipleLineEditingButton" destination="5201" id="5203"/>
@@ -4616,7 +4616,7 @@ Gw
<outlet property="toggleRuleFilterButton" destination="LYg-Ux-Lph" id="9eY-dL-AhC"/>
</connections>
</customObject>
<customObject id="ki9-Po-bdr" userLabel="SPTableContentFilter" customClass="SPTableContentFilterController">
<customObject id="ki9-Po-bdr" userLabel="SPRuleFilter" customClass="SPRuleFilterController">
<connections>
<outlet property="filterButton" destination="4676" id="9tZ-dW-BR3"/>
<outlet property="filterRuleEditor" destination="FF9-z2-9od" id="RW4-XM-XQS"/>
@@ -1,5 +1,5 @@
//
// SPTableContentFilterController.h
// SPRuleFilterController.h
// sequel-pro
//
// Created by Max Lohrmann on 04.05.18.
@@ -33,9 +33,9 @@
@class SPTablesList;
@class SPContentFilterManager;
NSString * const SPTableContentFilterHeightChangedNotification;
NSString * const SPRuleFilterHeightChangedNotification;
@interface SPTableContentFilterController : NSObject {
@interface SPRuleFilterController : NSObject {
IBOutlet NSRuleEditor *filterRuleEditor;
IBOutlet SPTableData *tableDataInstance;
IBOutlet SPDatabaseDocument *tableDocumentInstance;
@@ -1,5 +1,5 @@
//
// SPTableContentFilterController.m
// SPRuleFilterController.m
// sequel-pro
//
// Created by Max Lohrmann on 04.05.18.
@@ -28,7 +28,7 @@
//
// More info at <https://github.com/sequelpro/sequelpro>
#import "SPTableContentFilterController.h"
#import "SPRuleFilterController.h"
#import "SPQueryController.h"
#import "SPDatabaseDocument.h"
#import "RegexKitLite.h"
@@ -44,7 +44,7 @@ typedef NS_ENUM(NSInteger, RuleNodeType) {
RuleNodeTypeConnector,
};
NSString * const SPTableContentFilterHeightChangedNotification = @"SPTableContentFilterHeightChanged";
NSString * const SPRuleFilterHeightChangedNotification = @"SPRuleFilterHeightChanged";
/**
* The type of filter rule that the current item represents.
@@ -164,7 +164,7 @@ @interface ConnectorNode : RuleNode {
#pragma mark -
@interface SPTableContentFilterController () <NSRuleEditorDelegate>
@interface SPRuleFilterController () <NSRuleEditorDelegate>
@property (readwrite, assign, nonatomic) CGFloat preferredHeight;
@@ -190,7 +190,7 @@ - (IBAction)filterTable:(id)sender;
@end
@implementation SPTableContentFilterController
@implementation SPRuleFilterController
@synthesize model = model;
@synthesize preferredHeight = preferredHeight;
@@ -505,7 +505,7 @@ - (void)_resize
}
if(wantsHeight != preferredHeight) {
[self setPreferredHeight:wantsHeight];
[[NSNotificationCenter defaultCenter] postNotificationName:SPTableContentFilterHeightChangedNotification object:self];
[[NSNotificationCenter defaultCenter] postNotificationName:SPRuleFilterHeightChangedNotification object:self];
}
}
@@ -43,7 +43,7 @@
@class SPDatabaseDocument;
@class SPTablesList;
@class SPTableStructure;
@class SPTableContentFilterController;
@class SPRuleFilterController;
@class SPFilterTableController;
typedef NS_ENUM(NSInteger, SPTableContentFilterSource) {
@@ -96,7 +96,7 @@ typedef NS_ENUM(NSInteger, SPTableContentFilterSource) {
#ifndef SP_CODA
IBOutlet NSStepper *paginationPageStepper;
IBOutlet SPTableContentFilterController *filterControllerInstance;
IBOutlet SPRuleFilterController *ruleFilterController;
IBOutlet SPFilterTableController *filterTableController;
BOOL scrollViewHasRubberbandScrolling;
#endif
@@ -56,7 +56,7 @@
#import "SPThreadAdditions.h"
#import "SPTableFilterParser.h"
#import "SPFunctions.h"
#import "SPTableContentFilterController.h"
#import "SPRuleFilterController.h"
#import "SPFilterTableController.h"
#import <pthread.h>
@@ -235,20 +235,20 @@ - (void)awakeFromNib
// Add observer to change view sizes with filter rule editor
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(filterRuleEditorPreferredSizeChanged:)
name:SPTableContentFilterHeightChangedNotification
object:filterControllerInstance];
name:SPRuleFilterHeightChangedNotification
object:ruleFilterController];
[contentAreaContainer setPostsFrameChangedNotifications:YES];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(contentViewSizeChanged:)
name:NSViewFrameDidChangeNotification
object:contentAreaContainer];
[filterControllerInstance setTarget:self];
[filterControllerInstance setAction:@selector(filterTable:)];
[ruleFilterController setTarget:self];
[ruleFilterController setAction:@selector(filterTable:)];
[filterTableController setTarget:self];
[filterTableController setAction:@selector(filterTable:)];
//TODO This is only needed for 10.6 compatibility
scrollViewHasRubberbandScrolling = [[[filterControllerInstance view] enclosingScrollView] respondsToSelector:@selector(setVerticalScrollElasticity:)];
scrollViewHasRubberbandScrolling = [[[ruleFilterController view] enclosingScrollView] respondsToSelector:@selector(setVerticalScrollElasticity:)];
// Add observers for document task activity
[[NSNotificationCenter defaultCenter] addObserver:self
@@ -362,7 +362,7 @@ - (void)_setViewBlankState
[self setRuleEditorVisible:NO animate:NO];
[toggleRuleFilterButton setEnabled:NO];
[toggleRuleFilterButton setState:NSOffState];
[filterControllerInstance setColumns:nil];
[ruleFilterController setColumns:nil];
// Disable pagination
[paginationPreviousButton setEnabled:NO];
@@ -634,9 +634,9 @@ - (void) setTableDetails:(NSDictionary *)tableDetails
[filterTableController setColumns:dataColumns];
// Enable and initialize filter fields (with tags for position of menu item and field position)
[filterControllerInstance setColumns:dataColumns];
[ruleFilterController setColumns:dataColumns];
// Restore preserved filter settings if appropriate and valid
[filterControllerInstance restoreSerializedFilters:filtersToRestore];
[ruleFilterController restoreSerializedFilters:filtersToRestore];
// hide/show the rule filter editor, based on its previous state (so that it says visible when switching tables, if someone has enabled it and vice versa)
if(showFilterRuleEditor) {
[self setRuleEditorVisible:YES animate:NO];
@@ -646,7 +646,7 @@ - (void) setTableDetails:(NSDictionary *)tableDetails
[self setRuleEditorVisible:NO animate:NO];
[toggleRuleFilterButton setState:NSOffState];
}
[filterControllerInstance setEnabled:enableInteraction];
[ruleFilterController setEnabled:enableInteraction];
[toggleRuleFilterButton setEnabled:enableInteraction];
// restore the filter to the previously choosen one for the table
activeFilter = activeFilterToRestore;
@@ -1014,7 +1014,7 @@ - (NSString *)tableFilterString
BOOL caseSensitive = (([[NSApp currentEvent] modifierFlags] & NSShiftKeyMask) > 0);
NSError *err = nil;
NSString *filter = [filterControllerInstance sqlWhereExpressionWithBinary:caseSensitive error:&err];
NSString *filter = [ruleFilterController sqlWhereExpressionWithBinary:caseSensitive error:&err];
if(err) {
SPOnewayAlertSheet(
NSLocalizedString(@"Invalid Filter", @"table content : apply filter : invalid filter message title"),
@@ -1256,7 +1256,7 @@ - (IBAction)filterTable:(id)sender
}
// If a button other than the pagination buttons was used, set the active filter type to
// the standard filter field.
else if (sender == filterControllerInstance) {
else if (sender == ruleFilterController) {
activeFilter = SPTableContentFilterSourceRuleFilter;
resetPaging = YES;
}
@@ -1349,12 +1349,12 @@ - (void)setRuleEditorVisible:(BOOL)show animate:(BOOL)animate
{
// we can't change the state of the button here, because the mouse click already changed it
if(show) {
if([filterControllerInstance isEmpty]) {
[filterControllerInstance addFilterExpression];
if([ruleFilterController isEmpty]) {
[ruleFilterController addFilterExpression];
// the sizing will be updated automatically by adding a row
}
else {
[self updateFilterRuleEditorSize:[filterControllerInstance preferredHeight] animate:animate];
[self updateFilterRuleEditorSize:[ruleFilterController preferredHeight] animate:animate];
}
}
else {
@@ -2388,14 +2388,14 @@ - (void)clickLinkArrowTask:(SPTextAndLinkCell *)theArrowCell
else if(navigateAsHex) filterComparison = @"= (Hex String)";
// Store the filter details to use when loading the target table
NSDictionary *filterSettings = [SPTableContentFilterController makeSerializedFilterForColumn:[refDictionary objectForKey:@"column"]
NSDictionary *filterSettings = [SPRuleFilterController makeSerializedFilterForColumn:[refDictionary objectForKey:@"column"]
operator:filterComparison
values:@[targetFilterValue]];
// If the link is within the current table, apply filter settings manually
if ([[refDictionary objectForKey:@"table"] isEqualToString:selectedTable]) {
SPMainQSync(^{
[filterControllerInstance restoreSerializedFilters:filterSettings];
[ruleFilterController restoreSerializedFilters:filterSettings];
[self setRuleEditorVisible:YES animate:YES];
activeFilter = SPTableContentFilterSourceRuleFilter;
});
@@ -3337,7 +3337,7 @@ - (CGFloat) tablesListWidth
*/
- (NSDictionary *) filterSettings
{
return [filterControllerInstance serializedFilter];
return [ruleFilterController serializedFilter];
}
/**
@@ -3445,7 +3445,7 @@ - (void)updateFilterRuleEditorSize:(CGFloat)requestedHeight animate:(BOOL)animat
NSRect contentAreaRect = [contentAreaContainer frame];
CGFloat availableHeight = contentAreaRect.size.height;
NSRect ruleEditorRect = [[[filterControllerInstance view] enclosingScrollView] frame];
NSRect ruleEditorRect = [[[ruleFilterController view] enclosingScrollView] frame];
//adjust for the UI elements below the rule editor, but only if the view height should not be 0 (ie. hidden)
CGFloat containerRequestedHeight = requestedHeight ? requestedHeight + ruleEditorRect.origin.y : 0;
@@ -3472,18 +3472,18 @@ - (void)updateFilterRuleEditorSize:(CGFloat)requestedHeight animate:(BOOL)animat
[NSAnimationContext beginGrouping];
[[tableContentContainer animator] setFrame:bottomContainerRect];
[[filterRuleEditorContainer animator] setFrame:topContainerRect];
[[[[filterControllerInstance view] enclosingScrollView] animator] setFrame:ruleEditorRect];
[[[[ruleFilterController view] enclosingScrollView] animator] setFrame:ruleEditorRect];
[NSAnimationContext endGrouping];
}
else {
[tableContentContainer setFrameSize:bottomContainerRect.size];
[filterRuleEditorContainer setFrame:topContainerRect];
[[[filterControllerInstance view] enclosingScrollView] setFrame:ruleEditorRect];
[[[ruleFilterController view] enclosingScrollView] setFrame:ruleEditorRect];
}
//disable rubberband scrolling as long as there is nothing to scroll
if(scrollViewHasRubberbandScrolling) {
NSScrollView *filterControllerScroller = [[filterControllerInstance view] enclosingScrollView];
NSScrollView *filterControllerScroller = [[ruleFilterController view] enclosingScrollView];
if (ruleEditorRect.size.height >= requestedHeight) {
[filterControllerScroller setVerticalScrollElasticity:NSScrollElasticityNone];
} else {
@@ -3495,14 +3495,14 @@ - (void)updateFilterRuleEditorSize:(CGFloat)requestedHeight animate:(BOOL)animat
- (void)filterRuleEditorPreferredSizeChanged:(NSNotification *)notification
{
if(showFilterRuleEditor) {
[self updateFilterRuleEditorSize:[filterControllerInstance preferredHeight] animate:YES];
[self updateFilterRuleEditorSize:[ruleFilterController preferredHeight] animate:YES];
}
}
- (void)contentViewSizeChanged:(NSNotification *)notification
{
if(showFilterRuleEditor) {
[self updateFilterRuleEditorSize:[filterControllerInstance preferredHeight] animate:NO];
[self updateFilterRuleEditorSize:[ruleFilterController preferredHeight] animate:NO];
}
}
@@ -3627,7 +3627,7 @@ - (void) startDocumentTaskForTab:(NSNotification *)aNotification
[removeButton setEnabled:NO];
[duplicateButton setEnabled:NO];
[reloadButton setEnabled:NO];
[filterControllerInstance setEnabled:NO];
[ruleFilterController setEnabled:NO];
[toggleRuleFilterButton setEnabled:NO];
tableRowsSelectable = NO;
[paginationPreviousButton setEnabled:NO];
@@ -3663,7 +3663,7 @@ - (void) endDocumentTaskForTab:(NSNotification *)aNotification
}
}
[filterControllerInstance setEnabled:(!![selectedTable length])];
[ruleFilterController setEnabled:(!![selectedTable length])];
[toggleRuleFilterButton setEnabled:(!![selectedTable length])];
tableRowsSelectable = YES;
}
@@ -3931,7 +3931,7 @@ - (void)makeContentFilterHaveFocus
{
[self setRuleEditorVisible:YES animate:YES];
[toggleRuleFilterButton setState:NSOnState];
[filterControllerInstance focusFirstInputField];
[ruleFilterController focusFirstInputField];
}
#endif
@@ -185,7 +185,7 @@
503CDBB21ACDC204004F8A2F /* Quartz.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 503CDBB11ACDC204004F8A2F /* Quartz.framework */; };
505F568F1BCEE485007467DD /* SPFunctions.m in Sources */ = {isa = PBXBuildFile; fileRef = 507FF1111BBCC57600104523 /* SPFunctions.m */; };
505F56901BCEE491007467DD /* SPOSInfo.m in Sources */ = {isa = PBXBuildFile; fileRef = 50EAB5B71A8FBB08008F627A /* SPOSInfo.m */; };
506CE9311A311C6C0039F736 /* SPTableContentFilterController.m in Sources */ = {isa = PBXBuildFile; fileRef = 506CE9301A311C6C0039F736 /* SPTableContentFilterController.m */; };
506CE9311A311C6C0039F736 /* SPRuleFilterController.m in Sources */ = {isa = PBXBuildFile; fileRef = 506CE9301A311C6C0039F736 /* SPRuleFilterController.m */; };
507FF1121BBCC57600104523 /* SPFunctions.m in Sources */ = {isa = PBXBuildFile; fileRef = 507FF1111BBCC57600104523 /* SPFunctions.m */; };
507FF1621BBF0D5000104523 /* SPTableCopyTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 112730551180788A000737FD /* SPTableCopyTest.m */; };
507FF2421BC33BBC00104523 /* SPOSInfo.m in Sources */ = {isa = PBXBuildFile; fileRef = 50EAB5B71A8FBB08008F627A /* SPOSInfo.m */; };
@@ -886,8 +886,8 @@
503B02C91AE82C5E0060CAB1 /* SPTableFilterParser.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SPTableFilterParser.m; sourceTree = "<group>"; };
503B02CE1AE95C2C0060CAB1 /* SPTableFilterParserTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SPTableFilterParserTest.m; sourceTree = "<group>"; };
503CDBB11ACDC204004F8A2F /* Quartz.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Quartz.framework; path = System/Library/Frameworks/Quartz.framework; sourceTree = SDKROOT; };
506CE92F1A311C6C0039F736 /* SPTableContentFilterController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SPTableContentFilterController.h; sourceTree = "<group>"; };
506CE9301A311C6C0039F736 /* SPTableContentFilterController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SPTableContentFilterController.m; sourceTree = "<group>"; };
506CE92F1A311C6C0039F736 /* SPRuleFilterController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SPRuleFilterController.h; sourceTree = "<group>"; };
506CE9301A311C6C0039F736 /* SPRuleFilterController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SPRuleFilterController.m; sourceTree = "<group>"; };
507FF1101BBCC4C400104523 /* SPFunctions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SPFunctions.h; sourceTree = "<group>"; };
507FF1111BBCC57600104523 /* SPFunctions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SPFunctions.m; sourceTree = "<group>"; };
508022941BF7BA470052A9B2 /* English */ = {isa = PBXFileReference; lastKnownFileType = text.html; name = English; path = English.lproj/SPQLPluginExportSettingsTemplate.html; sourceTree = "<group>"; };
@@ -1568,8 +1568,8 @@
17A7773311C52D8E001E27B4 /* SPIndexesController.m */,
50A9F8AF19EAD4B90053E571 /* SPGotoDatabaseController.h */,
50A9F8B019EAD4B90053E571 /* SPGotoDatabaseController.m */,
506CE92F1A311C6C0039F736 /* SPTableContentFilterController.h */,
506CE9301A311C6C0039F736 /* SPTableContentFilterController.m */,
506CE92F1A311C6C0039F736 /* SPRuleFilterController.h */,
506CE9301A311C6C0039F736 /* SPRuleFilterController.m */,
1713C73D140D88D400CFD461 /* Query Controller */,
17381853151FB29C0078FFE2 /* User Manager */,
17846B9D170C95D800414499 /* Process List */,
@@ -3263,7 +3263,7 @@
1785EB6A127DD79300F468C8 /* SPEditorPreferencePane.m in Sources */,
17FDB04C1280778B00DBBBC2 /* SPFontPreviewTextField.m in Sources */,
17D3C22212859E070047709F /* SPFavoriteNode.m in Sources */,
506CE9311A311C6C0039F736 /* SPTableContentFilterController.m in Sources */,
506CE9311A311C6C0039F736 /* SPRuleFilterController.m in Sources */,
17D3C66E128AD4710047709F /* SPFavoritesController.m in Sources */,
17D3C671128AD8160047709F /* SPSingleton.m in Sources */,
17D3C6D3128B1C900047709F /* SPFavoritesOutlineView.m in Sources */,

0 comments on commit c2fe67b

Please sign in to comment.