Skip to content
Permalink
Browse files

merge some smaller classes (part of #2789)

  • Loading branch information
dmoagx committed Jan 20, 2018
1 parent 8b221ee commit 0b096429fee59f72d0191a05d56d3b06229afd4e
@@ -33,7 +33,7 @@
#import "SPServerSupport.h"
#import "SPDatabaseData.h"

@interface SPCharsetCollationHelper (Hidden)
@interface SPCharsetCollationHelper ()

- (void)charsetButtonClicked:(id)sender;
- (void)collationButtonClicked:(id)sender;
@@ -31,12 +31,6 @@
@class SPDatabaseDocument;
@class SPSplitView;

@interface NSObject (SPContentFilterManagerDelegate)

- (void)contentFiltersHaveBeenUpdated:(id)manager;

@end

@interface SPContentFilterManager : NSWindowController <NSOpenSavePanelDelegate>
{
#ifndef SP_CODA /* ivars */
@@ -254,3 +254,10 @@
- (void)setDoGroupDueToChars;

@end

@protocol SPFieldEditorControllerDelegate <NSObject>

@optional
- (void)processFieldEditorResult:(id)data contextInfo:(NSDictionary*)contextInfo;

@end
@@ -47,12 +47,6 @@
HexSegment
} FieldEditorSegment;

@interface SPFieldEditorController (SPFieldEditorControllerDelegate)

- (void)processFieldEditorResult:(id)data contextInfo:(NSDictionary*)contextInfo;

@end

@implementation SPFieldEditorController

@synthesize editedFieldInfo;
@@ -672,7 +666,9 @@ - (IBAction)closeEditSheet:(id)sender
else if ( [callerInstance isKindOfClass:[SPTableContent class]] )
[(SPTableContent*)callerInstance processFieldEditorResult:returnData contextInfo:contextInfo];
#else
[callerInstance processFieldEditorResult:returnData contextInfo:contextInfo];
if([callerInstance respondsToSelector:@selector(processFieldEditorResult:contextInfo:)]) {
[(id <SPFieldEditorControllerDelegate>)callerInstance processFieldEditorResult:returnData contextInfo:contextInfo];
}
#endif
}
}
@@ -30,7 +30,7 @@

#import "SPGotoDatabaseController.h"

@interface SPGotoDatabaseController (Private)
@interface SPGotoDatabaseController ()

/** Update the list of matched names
* @param filter The string to be matched.
@@ -477,6 +477,7 @@ - (IBAction)closeQueryManagerSheet:(id)sender
[prefs setObject:[self queryFavoritesForFileURL:nil] forKey:SPQueryFavorites];

// Inform all opened documents to update the query favorites list
#warning This should be done using notifications
for(id doc in [SPAppDelegate orderedDocuments])
if([[doc valueForKeyPath:@"customQueryInstance"] respondsToSelector:@selector(queryFavoritesHaveBeenUpdated:)])
[[doc valueForKeyPath:@"customQueryInstance"] queryFavoritesHaveBeenUpdated:self];
@@ -37,7 +37,7 @@
#import "SPTableTextFieldCell.h"
#import "SPAppController.h"

@interface SPTableInfo (PrivateAPI)
@interface SPTableInfo ()

- (NSString *)_getUserDefinedDateStringFromMySQLDate:(NSString *)mysqlDate;

@@ -540,6 +540,57 @@ - (BOOL)validateMenuItem:(NSMenuItem *)menuItem
return YES;
}

#pragma mark -
#pragma mark TextField delegate methods

- (void)controlTextDidChange:(NSNotification *)notification
{
// Make sure the user does not enter a taken name, using the quickly-generated incomplete list
if ([notification object] == constraintName) {
NSString *userValue = [[constraintName stringValue] lowercaseString];

// Make field red and disable add button
if ([takenConstraintNames containsObject:userValue]) {
[constraintName setTextColor:[NSColor redColor]];
[confirmAddRelationButton setEnabled:NO];
}
else {
[constraintName setTextColor:[NSColor controlTextColor]];
[confirmAddRelationButton setEnabled:YES];
}
}
}

#pragma mark -
#pragma mark Tableview delegate methods

/**
* Called whenever the relations table view selection changes.
*/
- (void)tableViewSelectionDidChange:(NSNotification *)notification
{
[removeRelationButton setEnabled:([relationsTableView numberOfSelectedRows] > 0)];
}

/*
* Double-click action on table cells - for the time being, return
* NO to disable editing.
*/
- (BOOL)tableView:(NSTableView *)tableView shouldEditTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)rowIndex
{
if ([tableDocumentInstance isWorking]) return NO;

return NO;
}

/**
* Disable row selection while the document is working.
*/
- (BOOL)tableView:(NSTableView *)tableView shouldSelectRow:(NSInteger)rowIndex
{
return ![tableDocumentInstance isWorking];
}

#pragma mark -
#pragma mark Private API

This file was deleted.

This file was deleted.

@@ -656,6 +656,65 @@ - (void)_removePreferenceObservers
[prefs removeObserver:self forKeyPath:SPDisplayTableViewVerticalGridlines];
}

#pragma mark -
#pragma mark Tableview delegate methods

/**
* Called whenever the triggers table view selection changes.
*/
- (void)tableViewSelectionDidChange:(NSNotification *)notification
{
[removeTriggerButton setEnabled:([triggersTableView numberOfSelectedRows] > 0)];
}

/**
* Alter the colour of cells displaying NULL values
*/
- (void)tableView:(NSTableView *)tableView willDisplayCell:(id)cell forTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)rowIndex
{
if (![cell respondsToSelector:@selector(setTextColor:)]) {
return;
}

id value = [[triggerData objectAtIndex:rowIndex] objectForKey:[tableColumn identifier]];

[cell setTextColor:[value isNSNull] ? [NSColor lightGrayColor] : [NSColor blackColor]];
}

/**
* Double-click action on table cells - for the time being, return NO to disable editing.
*/
- (BOOL)tableView:(NSTableView *)tableView shouldEditTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)rowIndex
{
if ([tableDocumentInstance isWorking]) return NO;

// Start Edit panel
if (((NSInteger)[triggerData count] > rowIndex) && [triggerData objectAtIndex:rowIndex]) {
[self _editTriggerAtIndex:rowIndex];
}

return NO;
}

/**
* Disable row selection while the document is working.
*/
- (BOOL)tableView:(NSTableView *)tableView shouldSelectRow:(NSInteger)rowIndex
{
return (![tableDocumentInstance isWorking]);
}

#pragma mark -
#pragma mark Textfield delegate methods

/**
* Toggles the enabled state of confirm add trigger button based on the editing of the trigger's name.
*/
- (void)controlTextDidChange:(NSNotification *)notification
{
[self _toggleConfirmAddTriggerButtonEnabled];
}

#pragma mark -

- (void)dealloc

This file was deleted.

0 comments on commit 0b09642

Please sign in to comment.
You can’t perform that action at this time.