diff options
author | Bibiko <bibiko@eva.mpg.de> | 2010-12-01 21:42:58 +0000 |
---|---|---|
committer | Bibiko <bibiko@eva.mpg.de> | 2010-12-01 21:42:58 +0000 |
commit | 842e85a37b698be1245dee0948a1abd99973638c (patch) | |
tree | b9e642508660110488fdf4d90e3bd2c3c6dd9181 /Source | |
parent | a7981fb1f88c16fbd0f7732a03d63f599d94309b (diff) | |
download | sequelpro-842e85a37b698be1245dee0948a1abd99973638c.tar.gz sequelpro-842e85a37b698be1245dee0948a1abd99973638c.tar.bz2 sequelpro-842e85a37b698be1245dee0948a1abd99973638c.zip |
• Bundle Editor / Bundle commands
- enabled trigger support to run a command if db, table, or table row was changed
- HTML output window will be ordered out without making it the key window to remain the first responder
• SPTableTExtFieldCell
- forgotten to remove expansionFrameWithFrame: method
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]; |