diff options
author | Bibiko <bibiko@eva.mpg.de> | 2010-02-01 16:59:08 +0000 |
---|---|---|
committer | Bibiko <bibiko@eva.mpg.de> | 2010-02-01 16:59:08 +0000 |
commit | a410164c7227eb3825a86b1502feaea497e796c1 (patch) | |
tree | 878a0ec7182e0a587e122781f57965cf7767811a /Source | |
parent | c3f6e3a108a017aa20ac645d5d6d9e75adca33b8 (diff) | |
download | sequelpro-a410164c7227eb3825a86b1502feaea497e796c1.tar.gz sequelpro-a410164c7227eb3825a86b1502feaea497e796c1.tar.bz2 sequelpro-a410164c7227eb3825a86b1502feaea497e796c1.zip |
• CMTextView: switch off syntax highlighting if text buffer size is larger than SP_SYNTAX_HILITE_BIAS (has to be improved)
• added SPFieldMapperController
Diffstat (limited to 'Source')
-rw-r--r-- | Source/CMTextView.m | 30 | ||||
-rw-r--r-- | Source/SPFieldMapperController.h | 32 | ||||
-rw-r--r-- | Source/SPFieldMapperController.m | 31 |
3 files changed, 87 insertions, 6 deletions
diff --git a/Source/CMTextView.m b/Source/CMTextView.m index 46ce0227..5ba0f3e9 100644 --- a/Source/CMTextView.m +++ b/Source/CMTextView.m @@ -788,12 +788,35 @@ NSInteger alphabeticSort(id string1, id string2, void *reverse) [[NSPrintInfo sharedPrintInfo] setHorizontallyCentered:NO]; [[NSPrintInfo sharedPrintInfo] setVerticallyCentered:NO]; + NSRange r = NSMakeRange(0, [[self string] length]); + + // Remove all colors before printing for large text buffer + if(r.length > SP_SYNTAX_HILITE_BIAS) { + // Cancel all doSyntaxHighlighting requests + [NSObject cancelPreviousPerformRequestsWithTarget:self + selector:@selector(doSyntaxHighlighting) + object:nil]; + [[self textStorage] removeAttribute:NSForegroundColorAttributeName range:r]; + [[self textStorage] removeAttribute:kLEXToken range:r]; + [[self textStorage] ensureAttributesAreFixedInRange:r]; + + } + [[self textStorage] ensureAttributesAreFixedInRange:r]; + // Setup the print operation with the print info and view NSPrintOperation *printOperation = [NSPrintOperation printOperationWithView:self printInfo:[NSPrintInfo sharedPrintInfo]]; + + // Order out print sheet [printOperation runOperationModalForWindow:[self window] delegate:nil didRunSelector:NULL contextInfo:NULL]; } +- (void)printOperationDidRun:(NSPrintOperation *)printOperation success:(BOOL)success contextInfo:(void *)contextInfo +{ + // Refresh syntax highlighting + [self performSelector:@selector(doSyntaxHighlighting) withObject:nil afterDelay:0.01]; +} + /* * Search for the current selection or current word in the MySQL Help */ @@ -2744,7 +2767,7 @@ NSInteger alphabeticSort(id string1, id string2, void *reverse) NSUInteger strlength = [selfstr length]; NSRange textRange; - + // If text larger than SP_TEXT_SIZE_TRIGGER_FOR_PARTLY_PARSING // do highlighting partly (max SP_SYNTAX_HILITE_BIAS*2). // The approach is to take the middle position of the current view port @@ -2753,11 +2776,6 @@ NSInteger alphabeticSort(id string1, id string2, void *reverse) if(strlength > SP_TEXT_SIZE_TRIGGER_FOR_PARTLY_PARSING) { - // Cancel all doSyntaxHighlighting requests - [NSObject cancelPreviousPerformRequestsWithTarget:self - selector:@selector(doSyntaxHighlighting) - object:nil]; - // Get the text range currently displayed in the view port NSRect visibleRect = [[[self enclosingScrollView] contentView] documentVisibleRect]; NSRange visibleRange = [[self layoutManager] glyphRangeForBoundingRectWithoutAdditionalLayout:visibleRect inTextContainer:[self textContainer]]; diff --git a/Source/SPFieldMapperController.h b/Source/SPFieldMapperController.h new file mode 100644 index 00000000..a1d8d4fa --- /dev/null +++ b/Source/SPFieldMapperController.h @@ -0,0 +1,32 @@ +// +// $Id$ +// +// SPQueryFavoriteManager.h +// sequel-pro +// +// Created by Hans-Jörg Bibiko on February 01, 2010 +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// More info at <http://code.google.com/p/sequel-pro/> + +#import <Cocoa/Cocoa.h> + + +@interface SPFieldMapperController : NSObject { + +} + +@end diff --git a/Source/SPFieldMapperController.m b/Source/SPFieldMapperController.m new file mode 100644 index 00000000..a5729905 --- /dev/null +++ b/Source/SPFieldMapperController.m @@ -0,0 +1,31 @@ +// +// $Id$ +// +// SPQueryFavoriteManager.m +// sequel-pro +// +// Created by Hans-Jörg Bibiko on February 01, 2010 +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// More info at <http://code.google.com/p/sequel-pro/> +// + +#import "SPFieldMapperController.h" + + +@implementation SPFieldMapperController + +@end |