diff options
author | Bibiko <bibiko@eva.mpg.de> | 2010-11-15 23:23:54 +0000 |
---|---|---|
committer | Bibiko <bibiko@eva.mpg.de> | 2010-11-15 23:23:54 +0000 |
commit | 487df2675fdc65933010ccf08ae0f5aa4ad92842 (patch) | |
tree | 78a2d4478604ce7c72dc6e17f7470bc055f6ff8a /Source/SPTextViewAdditions.m | |
parent | cd4ae516d0db053c1bb818e617cf5b5bbebdaafc (diff) | |
download | sequelpro-487df2675fdc65933010ccf08ae0f5aa4ad92842.tar.gz sequelpro-487df2675fdc65933010ccf08ae0f5aa4ad92842.tar.bz2 sequelpro-487df2675fdc65933010ccf08ae0f5aa4ad92842.zip |
• Bundle support
- started to populate the main menu item Bundles [still hidden]
- enabled key equivalents for NSTextViews
- distinguishes between Query Editor scope and text input scope via menu item validation inside main menu Bundles
Diffstat (limited to 'Source/SPTextViewAdditions.m')
-rw-r--r-- | Source/SPTextViewAdditions.m | 27 |
1 files changed, 22 insertions, 5 deletions
diff --git a/Source/SPTextViewAdditions.m b/Source/SPTextViewAdditions.m index 381f8f0a..24a5236f 100644 --- a/Source/SPTextViewAdditions.m +++ b/Source/SPTextViewAdditions.m @@ -715,17 +715,19 @@ NSInteger i = 0; for(NSDictionary *item in bundleItems) { - NSString *keyEq = @""; - // if([item objectForKey:SPBundleFileKeyEquivalentKey]) - // keyEq = [[item objectForKey:SPBundleFileKeyEquivalentKey] objectAtIndex:0]; - // else - // keyEq = @""; + NSString *keyEq; + if([item objectForKey:SPBundleFileKeyEquivalentKey]) + keyEq = [[item objectForKey:SPBundleFileKeyEquivalentKey] objectAtIndex:0]; + else + keyEq = @""; NSMenuItem *mItem = [[[NSMenuItem alloc] initWithTitle:[item objectForKey:SPBundleInternLabelKey] action:@selector(executeBundleItemForInputField:) keyEquivalent:keyEq] autorelease]; if([keyEq length]) [mItem setKeyEquivalentModifierMask:[[[item objectForKey:SPBundleFileKeyEquivalentKey] objectAtIndex:1] intValue]]; + [mItem setTarget:[[NSApp mainWindow] firstResponder]]; + if([item objectForKey:SPBundleFileTooltipKey]) [mItem setToolTip:[item objectForKey:SPBundleFileTooltipKey]]; @@ -744,6 +746,21 @@ } +- (BOOL)validateMenuItem:(NSMenuItem *)menuItem +{ + + if([menuItem action] == @selector(executeBundleItemForEditor:)) + { + return NO; + } + if([menuItem action] == @selector(executeBundleItemForInputField:)) + { + return YES; + } + + return YES; + +} #pragma mark - #pragma mark multi-touch trackpad support |