aboutsummaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorBibiko <bibiko@eva.mpg.de>2009-05-20 11:31:21 +0000
committerBibiko <bibiko@eva.mpg.de>2009-05-20 11:31:21 +0000
commit365c6c4e30a2b54848d14c240aa3580875a90393 (patch)
tree9f550b0aee81cde51044b3ee5e756259802e4db0 /Source
parentc2a0f048423967f16af1651f97ed929d83cccf68 (diff)
downloadsequelpro-365c6c4e30a2b54848d14c240aa3580875a90393.tar.gz
sequelpro-365c6c4e30a2b54848d14c240aa3580875a90393.tar.bz2
sequelpro-365c6c4e30a2b54848d14c240aa3580875a90393.zip
• added "Copy as RTF" to CustomQuery's context menu and bound it to CTRL+C (other format could also be added - waiting for user feedback)
Diffstat (limited to 'Source')
-rw-r--r--Source/CMTextView.m18
1 files changed, 16 insertions, 2 deletions
diff --git a/Source/CMTextView.m b/Source/CMTextView.m
index 09c5447d..48832133 100644
--- a/Source/CMTextView.m
+++ b/Source/CMTextView.m
@@ -50,6 +50,7 @@ YY_BUFFER_STATE yy_scan_string (const char *);
#define kBTQuoteValue @"isBTQuoted"
#define SP_CQ_SEARCH_IN_MYSQL_HELP_MENU_ITEM_TAG 1000
+#define SP_CQ_COPY_AS_RTF_MENU_ITEM_TAG 1001
#define SP_SYNTAX_HILITE_BIAS 2000
@@ -2035,7 +2036,10 @@ YY_BUFFER_STATE yy_scan_string (const char *);
else
showMySQLHelpFor = NSLocalizedString(@"MySQL Help for Word", @"MySQL Help for Word");
- // Add the menu item if it doesn't yet exist
+ // Add the menu items for
+ // - MySQL Help for Word/Selection
+ // - Copy as RTF
+ // if it doesn't yet exist
NSMenu *menu = [[self class] defaultMenu];
if ([[[self class] defaultMenu] itemWithTag:SP_CQ_SEARCH_IN_MYSQL_HELP_MENU_ITEM_TAG] == nil)
@@ -2048,6 +2052,13 @@ YY_BUFFER_STATE yy_scan_string (const char *);
} else {
[[menu itemWithTag:SP_CQ_SEARCH_IN_MYSQL_HELP_MENU_ITEM_TAG] setTitle:showMySQLHelpFor];
}
+ if ([[[self class] defaultMenu] itemWithTag:SP_CQ_COPY_AS_RTF_MENU_ITEM_TAG] == nil)
+ {
+ NSMenuItem *copyAsRTFMenuItem = [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"Copy as RTF", @"Copy as RTF") action:@selector(copyAsRTF) keyEquivalent:@"c"];
+ [copyAsRTFMenuItem setTag:SP_CQ_COPY_AS_RTF_MENU_ITEM_TAG];
+ [copyAsRTFMenuItem setKeyEquivalentModifierMask:NSControlKeyMask];
+ [menu insertItem:copyAsRTFMenuItem atIndex:2];
+ }
return menu;
}
@@ -2062,7 +2073,10 @@ YY_BUFFER_STATE yy_scan_string (const char *);
long stringSize = [self getRangeForCurrentWord].length;
return (stringSize || stringSize > 64);
}
-
+ // Enable Copy as RTF if soemthing is selected
+ if ([menuItem action] == @selector(copyAsRTF)) {
+ return ([self selectedRange].length>0);
+ }
return YES;
}