diff options
Diffstat (limited to 'Source')
-rw-r--r-- | Source/SPBundleHTMLOutputController.m | 2 | ||||
-rw-r--r-- | Source/SPDatabaseDocument.m | 36 | ||||
-rw-r--r-- | Source/SPDatabaseViewController.m | 21 | ||||
-rw-r--r-- | Source/SPTableContent.m | 20 | ||||
-rw-r--r-- | Source/SPTableTextFieldCell.m | 5 |
5 files changed, 62 insertions, 22 deletions
diff --git a/Source/SPBundleHTMLOutputController.m b/Source/SPBundleHTMLOutputController.m index c6129e99..a4c79edc 100644 --- a/Source/SPBundleHTMLOutputController.m +++ b/Source/SPBundleHTMLOutputController.m @@ -70,7 +70,7 @@ - (void)displayHTMLContent:(NSString *)content withOptions:(NSDictionary *)displayOptions { - [[self window] makeKeyAndOrderFront:nil]; + [[self window] orderFront:nil]; NSString *fullContent = @"%@"; fullContent = [NSString stringWithFormat:fullContent, content]; diff --git a/Source/SPDatabaseDocument.m b/Source/SPDatabaseDocument.m index 02889b5e..2729932f 100644 --- a/Source/SPDatabaseDocument.m +++ b/Source/SPDatabaseDocument.m @@ -5301,6 +5301,19 @@ [[parentWindow onMainThread] makeFirstResponder:[tablesListInstance valueForKeyPath:@"tablesListView"]]; } + // If a the table has changed, update the selection + if (![targetItemName isEqualToString:[self table]]) { + if (targetItemName) { + [tablesListInstance selectItemWithName:targetItemName]; + } else { + [[tablesListInstance onMainThread] setTableListSelectability:YES]; + [[[tablesListInstance valueForKey:@"tablesListView"] onMainThread] deselectAll:self]; + [[tablesListInstance onMainThread] setTableListSelectability:NO]; + } + } + + [self endTask]; + NSArray *triggeredCommands = [[NSApp delegate] bundleCommandsForTrigger:SPBundleTriggerActionDatabaseChanged]; for(NSString* cmdPath in triggeredCommands) { NSArray *data = [cmdPath componentsSeparatedByString:@"|"]; @@ -5308,28 +5321,19 @@ [aMenuItem setTag:0]; [aMenuItem setToolTip:[data objectAtIndex:0]]; if([[data objectAtIndex:1] isEqualToString:SPBundleScopeGeneral]) { - ; - } - else if([[data objectAtIndex:1] isEqualToString:SPBundleScopeInputField]) { - ; + [[[NSApp delegate] onMainThread] executeBundleItemForApp:aMenuItem]; } else if([[data objectAtIndex:1] isEqualToString:SPBundleScopeDataTable]) { - ; + if([[[NSApp mainWindow] firstResponder] isKindOfClass:[SPCopyTable class]]) + [[[[NSApp mainWindow] firstResponder] onMainThread] executeBundleItemForDataTable:aMenuItem]; } - } - - // If a the table has changed, update the selection - if (![targetItemName isEqualToString:[self table]]) { - if (targetItemName) { - [tablesListInstance selectItemWithName:targetItemName]; - } else { - [[tablesListInstance onMainThread] setTableListSelectability:YES]; - [[[tablesListInstance valueForKey:@"tablesListView"] onMainThread] deselectAll:self]; - [[tablesListInstance onMainThread] setTableListSelectability:NO]; + else if([[data objectAtIndex:1] isEqualToString:SPBundleScopeInputField]) { + if([[[NSApp mainWindow] firstResponder] isKindOfClass:[NSTextView class]]) + [[[[NSApp mainWindow] firstResponder] onMainThread] executeBundleItemForInputField:aMenuItem]; } } - [self endTask]; [taskPool drain]; + } @end diff --git a/Source/SPDatabaseViewController.m b/Source/SPDatabaseViewController.m index c1b1bdbf..8cf97998 100644 --- a/Source/SPDatabaseViewController.m +++ b/Source/SPDatabaseViewController.m @@ -481,6 +481,27 @@ // Empty the loading pool and exit the thread [self endTask]; + + NSArray *triggeredCommands = [[NSApp delegate] bundleCommandsForTrigger:SPBundleTriggerActionTableChanged]; + for(NSString* cmdPath in triggeredCommands) { + NSArray *data = [cmdPath componentsSeparatedByString:@"|"]; + NSMenuItem *aMenuItem = [[[NSMenuItem alloc] init] autorelease]; + [aMenuItem setTag:0]; + [aMenuItem setToolTip:[data objectAtIndex:0]]; + if([[data objectAtIndex:1] isEqualToString:SPBundleScopeGeneral]) { + [[[NSApp delegate] onMainThread] executeBundleItemForApp:aMenuItem]; + } + else if([[data objectAtIndex:1] isEqualToString:SPBundleScopeDataTable]) { + if([[[[NSApp mainWindow] firstResponder] description] isEqualToString:@"SPCopyTable"]) + [[[[NSApp mainWindow] firstResponder] onMainThread] executeBundleItemForDataTable:aMenuItem]; + } + else if([[data objectAtIndex:1] isEqualToString:SPBundleScopeInputField]) { + if([[[NSApp mainWindow] firstResponder] isKindOfClass:[NSTextView class]]) + [[[[NSApp mainWindow] firstResponder] onMainThread] executeBundleItemForInputField:aMenuItem]; + } + } + + [loadPool drain]; } diff --git a/Source/SPTableContent.m b/Source/SPTableContent.m index 393e0e94..b8656845 100644 --- a/Source/SPTableContent.m +++ b/Source/SPTableContent.m @@ -3866,6 +3866,26 @@ } [self updateCountText]; + + NSArray *triggeredCommands = [[NSApp delegate] bundleCommandsForTrigger:SPBundleTriggerActionTableRowChanged]; + for(NSString* cmdPath in triggeredCommands) { + NSArray *data = [cmdPath componentsSeparatedByString:@"|"]; + NSMenuItem *aMenuItem = [[[NSMenuItem alloc] init] autorelease]; + [aMenuItem setTag:0]; + [aMenuItem setToolTip:[data objectAtIndex:0]]; + if([[data objectAtIndex:1] isEqualToString:SPBundleScopeGeneral]) { + [[[NSApp delegate] onMainThread] executeBundleItemForApp:aMenuItem]; + } + else if([[data objectAtIndex:1] isEqualToString:SPBundleScopeDataTable]) { + if([[[[[NSApp mainWindow] firstResponder] class] description] isEqualToString:@"SPCopyTable"]) + [[[[NSApp mainWindow] firstResponder] onMainThread] executeBundleItemForDataTable:aMenuItem]; + } + else if([[data objectAtIndex:1] isEqualToString:SPBundleScopeInputField]) { + if([[[NSApp mainWindow] firstResponder] isKindOfClass:[NSTextView class]]) + [[[[NSApp mainWindow] firstResponder] onMainThread] executeBundleItemForInputField:aMenuItem]; + } + } + } /** diff --git a/Source/SPTableTextFieldCell.m b/Source/SPTableTextFieldCell.m index 33508517..bcfa0138 100644 --- a/Source/SPTableTextFieldCell.m +++ b/Source/SPTableTextFieldCell.m @@ -56,11 +56,6 @@ } -- (NSRect)expansionFrameWithFrame:(NSRect)cellFrame inView:(NSView *)view -{ - return NSMakeRect(cellFrame.origin.x, cellFrame.origin.y, [self cellSize].width, [self cellSize].height); -} - - (NSSize)cellSize { NSSize cellSize = [super cellSize]; |