aboutsummaryrefslogtreecommitdiffstats
path: root/Source/SPTextView.m
diff options
context:
space:
mode:
authorBibiko <bibiko@eva.mpg.de>2010-08-16 12:32:26 +0000
committerBibiko <bibiko@eva.mpg.de>2010-08-16 12:32:26 +0000
commitcb2919df1f18505c7bdbe187019862e8b934a6af (patch)
tree79e37d8e6fe7bef3abda7c27b9700785c772dd74 /Source/SPTextView.m
parenta4b8942109134428b04f355679e410146d07ff89 (diff)
downloadsequelpro-cb2919df1f18505c7bdbe187019862e8b934a6af.tar.gz
sequelpro-cb2919df1f18505c7bdbe187019862e8b934a6af.tar.bz2
sequelpro-cb2919df1f18505c7bdbe187019862e8b934a6af.zip
• added chance to export/import the color theme of the Query Editor in Prefs > Editor > Gear menu as normal plist file
- file extension is spTheme - can also import TextMate theme tmTheme files directly • added the chance to set the selection color in the Query Editor • fixed code for setting the insertion point color • changed the way how the query highlight color will be drawn - now it also supports colors with an alpha value
Diffstat (limited to 'Source/SPTextView.m')
-rw-r--r--Source/SPTextView.m15
1 files changed, 12 insertions, 3 deletions
diff --git a/Source/SPTextView.m b/Source/SPTextView.m
index a8ba29c8..9501992a 100644
--- a/Source/SPTextView.m
+++ b/Source/SPTextView.m
@@ -168,11 +168,14 @@ NSInteger alphabeticSort(id string1, id string2, void *reverse)
[self setNumericColor:[NSUnarchiver unarchiveObjectWithData:[prefs dataForKey:SPCustomQueryEditorNumericColor]]];
[self setVariableColor:[NSUnarchiver unarchiveObjectWithData:[prefs dataForKey:SPCustomQueryEditorVariableColor]]];
[self setOtherTextColor:[NSUnarchiver unarchiveObjectWithData:[prefs dataForKey:SPCustomQueryEditorTextColor]]];
- [self setTextColor:[self otherTextColor]];
- [self setInsertionPointColor:[self otherTextColor]];
+ [self setTextColor:otherTextColor];
+ [self setInsertionPointColor:[NSUnarchiver unarchiveObjectWithData:[prefs dataForKey:SPCustomQueryEditorCaretColor]]];
[self setShouldHiliteQuery:[prefs boolForKey:SPCustomQueryHighlightCurrentQuery]];
+ [self setSelectedTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:[NSUnarchiver unarchiveObjectWithData:[prefs dataForKey:SPCustomQueryEditorSelectionColor]], NSBackgroundColorAttributeName, nil]];
// Register observers for the when editor background colors preference changes
+ [prefs addObserver:self forKeyPath:SPCustomQueryEditorSelectionColor options:NSKeyValueObservingOptionNew context:NULL];
+ [prefs addObserver:self forKeyPath:SPCustomQueryEditorCaretColor options:NSKeyValueObservingOptionNew context:NULL];
[prefs addObserver:self forKeyPath:SPCustomQueryEditorFont options:NSKeyValueObservingOptionNew context:NULL];
[prefs addObserver:self forKeyPath:SPCustomQueryEditorBackgroundColor options:NSKeyValueObservingOptionNew context:NULL];
[prefs addObserver:self forKeyPath:SPCustomQueryEditorHighlightQueryColor options:NSKeyValueObservingOptionNew context:NULL];
@@ -209,6 +212,12 @@ NSInteger alphabeticSort(id string1, id string2, void *reverse)
} else if ([keyPath isEqualToString:SPCustomQueryEditorHighlightQueryColor]) {
[self setQueryHiliteColor:[NSUnarchiver unarchiveObjectWithData:[change objectForKey:NSKeyValueChangeNewKey]]];
[self setNeedsDisplay:YES];
+ } else if ([keyPath isEqualToString:SPCustomQueryEditorCaretColor]) {
+ [self setInsertionPointColor:[NSUnarchiver unarchiveObjectWithData:[change objectForKey:NSKeyValueChangeNewKey]]];
+ [self setNeedsDisplay:YES];
+ } else if ([keyPath isEqualToString:SPCustomQueryEditorSelectionColor]) {
+ [self setSelectedTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:[NSUnarchiver unarchiveObjectWithData:[change objectForKey:NSKeyValueChangeNewKey]], NSBackgroundColorAttributeName, nil]];
+ [self setNeedsDisplay:YES];
} else if ([keyPath isEqualToString:SPCustomQueryHighlightCurrentQuery]) {
[self setShouldHiliteQuery:[[change objectForKey:NSKeyValueChangeNewKey] boolValue]];
[self setNeedsDisplay:YES];
@@ -2743,7 +2752,7 @@ NSInteger alphabeticSort(id string1, id string2, void *reverse)
inTextContainer: [self textContainer]
rectCount: &rectCount ];
[[self queryHiliteColor] setFill];
- NSRectFillList(queryRects, rectCount);
+ NSRectFillListUsingOperation(queryRects, rectCount, NSCompositeSourceOver);
}
// Highlight snippets coming from the Query Favorite text macro