aboutsummaryrefslogtreecommitdiffstats
path: root/Source/CMTextView.m
diff options
context:
space:
mode:
authorBibiko <bibiko@eva.mpg.de>2010-01-27 17:48:11 +0000
committerBibiko <bibiko@eva.mpg.de>2010-01-27 17:48:11 +0000
commit98d651758a14f1675a605000cd1813d7fc64695a (patch)
treed8e5595d6ffdfab8fda7aaebea2f7017d56c6df5 /Source/CMTextView.m
parent5c01336855fde8694dfe2c9060c7e8f43b61d950 (diff)
downloadsequelpro-98d651758a14f1675a605000cd1813d7fc64695a.tar.gz
sequelpro-98d651758a14f1675a605000cd1813d7fc64695a.tar.bz2
sequelpro-98d651758a14f1675a605000cd1813d7fc64695a.zip
• improved the graphical representation of text macro snippets
Diffstat (limited to 'Source/CMTextView.m')
-rw-r--r--Source/CMTextView.m25
1 files changed, 19 insertions, 6 deletions
diff --git a/Source/CMTextView.m b/Source/CMTextView.m
index eb2abff4..cadd71c4 100644
--- a/Source/CMTextView.m
+++ b/Source/CMTextView.m
@@ -1125,6 +1125,15 @@ NSInteger alphabeticSort(id string1, id string2, void *reverse)
}
+/*
+ * Return YES if user interacts with snippets (is needed mainly for suppressing
+ * the highlighting of the current query)
+ */
+- (BOOL)isSnippetMode
+{
+ return (snippetControlCounter > -1) ? YES : NO;
+}
+
#pragma mark -
#pragma mark event management
@@ -2865,24 +2874,28 @@ NSInteger alphabeticSort(id string1, id string2, void *reverse)
- (void)drawRect:(NSRect)rect {
- [super drawRect:rect];
-
// Highlight snippets coming from the Query Favorite text macro
if(snippetControlCounter > -1) {
NSInteger i;
- [[NSColor colorWithCalibratedRed:0.0 green:0.5 blue:0.0 alpha:0.1] setFill];
for(i=0; i<snippetControlMax; i++) {
if(snippetControlArray[i][0] > -1) {
NSRange glRange = [[self layoutManager] glyphRangeForCharacterRange:NSMakeRange(snippetControlArray[i][0],snippetControlArray[i][1]) actualCharacterRange:NULL];
if(glRange.length) {
NSRect boundingRect = [[self layoutManager] boundingRectForGlyphRange:glRange inTextContainer:[self textContainer]];
- boundingRect = NSInsetRect(boundingRect, 0, 2);
- NSBezierPath *aBezierPath = [NSBezierPath bezierPathWithRoundedRect:boundingRect xRadius:4 yRadius:15];
+ boundingRect = NSInsetRect(boundingRect, -4, -1);
+ NSBezierPath *aBezierPath = [NSBezierPath bezierPathWithRoundedRect:boundingRect xRadius:5 yRadius:10];
+ [[NSColor colorWithCalibratedRed:1.0 green:1. blue:0.0 alpha:0.4] setFill];
+ [aBezierPath fill];
+ boundingRect = NSInsetRect(boundingRect, 2, 2);
+ aBezierPath = [NSBezierPath bezierPathWithRoundedRect:boundingRect xRadius:5 yRadius:10];
+ [[NSColor colorWithCalibratedRed:1.0 green:1. blue:1.0 alpha:0.8] setFill];
[aBezierPath fill];
}
}
}
}
+ [super drawRect:rect];
+
}
@@ -3051,7 +3064,7 @@ NSInteger alphabeticSort(id string1, id string2, void *reverse)
NSInteger changeInLength = [textStore changeInLength];
NSInteger i;
- // Remove any fully nested snippets relative to the current snippet which is was edited
+ // Remove any fully nested snippets relative to the current snippet which was edited
if(snippetControlArray[i][0] > -1 && i != snippetControlMax) {
NSInteger currentSnippetLocation = snippetControlArray[currentSnippetIndex][0];
NSInteger currentSnippetMaxRange = snippetControlArray[currentSnippetIndex][0] + snippetControlArray[currentSnippetIndex][1];