aboutsummaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
Diffstat (limited to 'Source')
-rw-r--r--Source/SPFieldMapperController.m38
-rw-r--r--Source/SPWindowAdditions.m52
2 files changed, 50 insertions, 40 deletions
diff --git a/Source/SPFieldMapperController.m b/Source/SPFieldMapperController.m
index 6d3db4f1..1787c6f2 100644
--- a/Source/SPFieldMapperController.m
+++ b/Source/SPFieldMapperController.m
@@ -282,8 +282,10 @@
for(NSInteger i=0; i < [fieldMappingGlobalValues count]; i++)
if([[fieldMappingGlobalValuesSQLMarked objectAtIndex:i] boolValue])
[globals addObject:[fieldMappingGlobalValues objectAtIndex:i]];
- else
+ else if([[fieldMappingGlobalValues objectAtIndex:i] isKindOfClass:[NSNull class]])
[globals addObject:[NSString stringWithFormat:@"'%@'", [fieldMappingGlobalValues objectAtIndex:i]]];
+ else
+ [globals addObject:[NSString stringWithFormat:@"'%@'", [[fieldMappingGlobalValues objectAtIndex:i] stringByReplacingOccurrencesOfString:@"'" withString:@"\\'"]]];
return globals;
}
@@ -1070,6 +1072,9 @@
- (IBAction)removeGlobalValue:(id)sender
{
+
+ [globalValuesTableView abortEditing];
+
NSIndexSet *indexes = [globalValuesTableView selectedRowIndexes];
// get last index
@@ -1105,26 +1110,26 @@
- (IBAction)closeGlobalValuesSheet:(id)sender
{
- // Ensure all changes are stored before ordering out
- [globalValuesTableView validateEditing];
- if ([globalValuesTableView numberOfSelectedRows] == 1)
- [globalValuesSheet makeFirstResponder:globalValuesTableView];
+ // Ensure all changes are stored before ordering out
+ [globalValuesTableView validateEditing];
+ if ([globalValuesTableView numberOfSelectedRows] == 1)
+ [globalValuesSheet makeFirstResponder:globalValuesTableView];
- // Replace the current map pair with the last selected global value
- if([replaceAfterSavingCheckBox state] == NSOnState && [globalValuesTableView numberOfSelectedRows] == 1) {
+ // Replace the current map pair with the last selected global value
+ if([replaceAfterSavingCheckBox state] == NSOnState && [globalValuesTableView numberOfSelectedRows] == 1) {
- [fieldMappingArray replaceObjectAtIndex:[fieldMapperTableView selectedRow] withObject:[NSNumber numberWithInteger:[globalValuesTableView selectedRow]+numberOfImportColumns]];
+ [fieldMappingArray replaceObjectAtIndex:[fieldMapperTableView selectedRow] withObject:[NSNumber numberWithInteger:[globalValuesTableView selectedRow]+numberOfImportColumns]];
- // Set corresponding operator to doImport if not set to isEqual
- if([fieldMappingOperatorArray objectAtIndex:[fieldMapperTableView selectedRow]] != isEqual)
- [fieldMappingOperatorArray replaceObjectAtIndex:[fieldMapperTableView selectedRow] withObject:doImport];
+ // Set corresponding operator to doImport if not set to isEqual
+ if([fieldMappingOperatorArray objectAtIndex:[fieldMapperTableView selectedRow]] != isEqual)
+ [fieldMappingOperatorArray replaceObjectAtIndex:[fieldMapperTableView selectedRow] withObject:doImport];
- [fieldMapperTableView reloadData];
+ [fieldMapperTableView reloadData];
- // Set alignment popup to "custom order"
- [alignByPopup selectItemWithTag:3];
+ // Set alignment popup to "custom order"
+ [alignByPopup selectItemWithTag:3];
- }
+ }
[NSApp endSheet:globalValuesSheet returnCode:[sender tag]];
}
@@ -1468,6 +1473,9 @@
NSString *orgTitle = [[menuItem title] substringToIndex:[[menuItem title] rangeOfString:@":"].location];
[menuItem setTitle:[NSString stringWithFormat:@"%@: %@", orgTitle, [fieldMappingTableTypes objectAtIndex:row]]];
}
+ else if (!newTableMode && [menuItem action] == @selector(insertNULLValue:)) {
+ return ([[globalValuesTableView selectedRowIndexes] count] == 1) ? YES : NO;
+ }
else if (!newTableMode && [menuItem action] == @selector(editColumn:)) {
NSString *orgTitle = [[menuItem title] substringToIndex:[[menuItem title] rangeOfString:@":"].location];
[menuItem setTitle:[NSString stringWithFormat:@"%@: %@", orgTitle, [fieldMappingTableColumnNames objectAtIndex:row]]];
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