aboutsummaryrefslogtreecommitdiffstats
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
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
-rw-r--r--Source/CMTextView.h4
-rw-r--r--Source/CMTextView.m31
2 files changed, 34 insertions, 1 deletions
diff --git a/Source/CMTextView.h b/Source/CMTextView.h
index e5eee68c..37731784 100644
--- a/Source/CMTextView.h
+++ b/Source/CMTextView.h
@@ -74,6 +74,8 @@
- (void) autoHelp;
- (void) doSyntaxHighlighting;
- (void) insertFileContentOfFile:(NSString *)aPath;
-- (unsigned int)characterIndexOfPoint:(NSPoint)aPoint;
+- (unsigned int) characterIndexOfPoint:(NSPoint)aPoint;
+- (void) makeTextSizeLarger;
+- (void) makeTextSizeSmaller;
@end
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