aboutsummaryrefslogtreecommitdiffstats
path: root/Source/CMTextView.m
diff options
context:
space:
mode:
authorBibiko <bibiko@eva.mpg.de>2009-05-20 09:10:21 +0000
committerBibiko <bibiko@eva.mpg.de>2009-05-20 09:10:21 +0000
commit4794c5df03806229b92c5681cfb86da8bf00d5a0 (patch)
treeeffafb7a610d623723de28b88cb2bb93c343cdf1 /Source/CMTextView.m
parentf0b3b6ac71d728c880616cc899b03265330fb06f (diff)
downloadsequelpro-4794c5df03806229b92c5681cfb86da8bf00d5a0.tar.gz
sequelpro-4794c5df03806229b92c5681cfb86da8bf00d5a0.tar.bz2
sequelpro-4794c5df03806229b92c5681cfb86da8bf00d5a0.zip
• added ⌘+ and ⌘- for increasing/decreasing the font size by 1 in the Custom Query Editor quickly
Diffstat (limited to 'Source/CMTextView.m')
-rw-r--r--Source/CMTextView.m31
1 files changed, 31 insertions, 0 deletions
diff --git a/Source/CMTextView.m b/Source/CMTextView.m
index ad66a874..7489fe1c 100644
--- a/Source/CMTextView.m
+++ b/Source/CMTextView.m
@@ -304,6 +304,7 @@ YY_BUFFER_STATE yy_scan_string (const char *);
NSString *charactersIgnMod = [theEvent charactersIgnoringModifiers];
unichar insertedCharacter = [characters characterAtIndex:0];
long curFlags = ([theEvent modifierFlags] & allFlags);
+ int keyCode = [theEvent keyCode];
// Note: switch(insertedCharacter) {} does not work instead use charactersIgnoringModifiers
if([charactersIgnMod isEqualToString:@"c"]) // ^C copy as RTF
@@ -319,6 +320,18 @@ YY_BUFFER_STATE yy_scan_string (const char *);
[self showMySQLHelpForCurrentWord:self];
return;
}
+ if(curFlags & NSCommandKeyMask) {
+ if([charactersIgnMod isEqualToString:@"+"]) // increase text size by 1; ⌘+ and numpad +
+ {
+ [self makeTextSizeLarger];
+ return;
+ }
+ if([charactersIgnMod isEqualToString:@"-"]) // decrease text size by 1; ⌘- and numpad -
+ {
+ [self makeTextSizeSmaller];
+ return;
+ }
+ }
// Only process for character autopairing if autopairing is enabled and a single character is being added.
if ([prefs boolForKey:@"CustomQueryAutopair"] && characters && [characters length] == 1) {
@@ -720,6 +733,24 @@ YY_BUFFER_STATE yy_scan_string (const char *);
return [compl autorelease];
}
+/*
+ * Increase the textView's font size by 1
+ */
+- (void)makeTextSizeLarger
+{
+ NSFont *aFont = [self font];
+ [self setFont:[[NSFontManager sharedFontManager] convertFont:aFont toSize:[aFont pointSize]+1]];
+}
+
+/*
+ * Decrease the textView's font size by 1 but not smaller than 4pt
+ */
+- (void)makeTextSizeSmaller
+{
+ NSFont *aFont = [self font];
+ int newSize = ([aFont pointSize]-1 < 4) ? [aFont pointSize] : [aFont pointSize]-1;
+ [self setFont:[[NSFontManager sharedFontManager] convertFont:aFont toSize:newSize]];
+}
/*
* Hook to invoke the auto-uppercasing of SQL keywords after pasting