aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBibiko <bibiko@eva.mpg.de>2010-02-02 10:25:54 +0000
committerBibiko <bibiko@eva.mpg.de>2010-02-02 10:25:54 +0000
commit52b6a2b07abf9dbcf375431188fcd09aec44b60e (patch)
tree90b308b3281e4c470ba22bc449abd982e986fb50
parent71d01e1417607aebc4254b32258c91b09078672f (diff)
downloadsequelpro-52b6a2b07abf9dbcf375431188fcd09aec44b60e.tar.gz
sequelpro-52b6a2b07abf9dbcf375431188fcd09aec44b60e.tar.bz2
sequelpro-52b6a2b07abf9dbcf375431188fcd09aec44b60e.zip
• added key-shortcut ⌘= to make the textview size larger
• ⌘-, ⌘+, ⌘= changes the font size temporarily (Mac app conform) • added key-shortcut ⌘0 to reset the font to pref default • fixed search field background for Tables List • fixed NSUInteger for completion parsing; interrupt completion if parsed string length is larger than 100000 since it doesn't make sense and leads to warnings
-rw-r--r--Interfaces/English.lproj/DBView.xib139
-rw-r--r--Source/CMTextView.m53
-rw-r--r--Source/CustomQuery.m20
3 files changed, 100 insertions, 112 deletions
diff --git a/Interfaces/English.lproj/DBView.xib b/Interfaces/English.lproj/DBView.xib
index 534a09a3..a4e8d47f 100644
--- a/Interfaces/English.lproj/DBView.xib
+++ b/Interfaces/English.lproj/DBView.xib
@@ -18,13 +18,13 @@
<bool key="EncodedWithXMLCoder">YES</bool>
<string>740</string>
<string>740</string>
- <string>1.2.1</string>
+ <string>1.2.5</string>
</object>
</object>
<object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
<bool key="EncodedWithXMLCoder">YES</bool>
<integer value="6232"/>
- <integer value="6701"/>
+ <integer value="5"/>
</object>
<object class="NSArray" key="IBDocument.PluginDependencies">
<bool key="EncodedWithXMLCoder">YES</bool>
@@ -100,7 +100,7 @@
<object class="NSSearchField" id="727834078">
<reference key="NSNextResponder" ref="801427893"/>
<int key="NSvFlags">290</int>
- <string key="NSFrame">{{5, 1}, {204, 19}}</string>
+ <string key="NSFrame">{{5, 2}, {204, 19}}</string>
<reference key="NSSuperview" ref="801427893"/>
<bool key="NSEnabled">YES</bool>
<object class="NSSearchFieldCell" key="NSCell" id="134854992">
@@ -192,7 +192,7 @@
<object class="NSTableView" id="970881282">
<reference key="NSNextResponder" ref="494991824"/>
<int key="NSvFlags">4362</int>
- <string key="NSFrameSize">{213, 38}</string>
+ <string key="NSFrameSize">{218, 38}</string>
<reference key="NSSuperview" ref="494991824"/>
<bool key="NSEnabled">YES</bool>
<object class="_NSCornerView" key="NSCornerView">
@@ -203,7 +203,7 @@
<object class="NSMutableArray" key="NSTableColumns">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSTableColumn" id="423746394">
- <double key="NSWidth">210</double>
+ <double key="NSWidth">215</double>
<double key="NSMinWidth">40</double>
<double key="NSMaxWidth">1000</double>
<object class="NSTableHeaderCell" key="NSHeaderCell">
@@ -252,13 +252,8 @@
<double key="NSIntercellSpacingWidth">3</double>
<double key="NSIntercellSpacingHeight">2</double>
<object class="NSColor" key="NSBackgroundColor">
- <int key="NSColorSpace">6</int>
- <string key="NSCatalogName">System</string>
- <string key="NSColorName">_sourceListBackgroundColor</string>
- <object class="NSColor" key="NSColor">
- <int key="NSColorSpace">1</int>
- <bytes key="NSRGB">MC44MzkyMTU2OTU5IDAuODY2NjY2Njc0NiAwLjg5ODAzOTIyMTgAA</bytes>
- </object>
+ <int key="NSColorSpace">2</int>
+ <bytes key="NSRGB">MC44NzQ1MDk4MTE0IDAuODkwMTk2MDg1IDAuOTE3NjQ3MDYzNwA</bytes>
</object>
<object class="NSColor" key="NSGridColor" id="864903678">
<int key="NSColorSpace">6</int>
@@ -281,12 +276,12 @@
<int key="NSTableViewDraggingDestinationStyle">1</int>
</object>
</object>
- <string key="NSFrame">{{1, 1}, {213, 38}}</string>
+ <string key="NSFrame">{{1, 1}, {218, 38}}</string>
<reference key="NSSuperview" ref="607475905"/>
<reference key="NSNextKeyView" ref="970881282"/>
<reference key="NSDocView" ref="970881282"/>
<reference key="NSBGColor" ref="1024678221"/>
- <int key="NScvFlags">4</int>
+ <int key="NScvFlags">2</int>
</object>
<object class="NSScroller" id="196112633">
<reference key="NSNextResponder" ref="607475905"/>
@@ -308,7 +303,7 @@
<double key="NSPercent">0.57142859697341919</double>
</object>
</object>
- <string key="NSFrame">{{0, -13}, {215, 40}}</string>
+ <string key="NSFrame">{{-1, -13}, {220.212, 40}}</string>
<reference key="NSSuperview" ref="801427893"/>
<reference key="NSNextKeyView" ref="494991824"/>
<int key="NSsFlags">2</int>
@@ -1694,6 +1689,7 @@
<bool key="BWGBHasTopBorder">NO</bool>
<bool key="BWGBHasBottomBorder">NO</bool>
<bool key="BWGBHasGradient">NO</bool>
+ <bool key="BWGBHasFillColor">NO</bool>
<float key="BWGBTopInsetAlpha">0.0</float>
<float key="BWGBBottomInsetAlpha">0.0</float>
</object>
@@ -3808,7 +3804,7 @@
<object class="NSTabViewItem" id="94659530">
<string key="NSIdentifier">status</string>
<object class="NSView" key="NSView" id="730602982">
- <nil key="NSNextResponder"/>
+ <reference key="NSNextResponder" ref="714795046"/>
<int key="NSvFlags">256</int>
<object class="NSMutableArray" key="NSSubviews">
<bool key="EncodedWithXMLCoder">YES</bool>
@@ -3835,6 +3831,29 @@
<object class="NSTextView" id="69074373">
<reference key="NSNextResponder" ref="78677381"/>
<int key="NSvFlags">2322</int>
+ <object class="NSMutableSet" key="NSDragTypes">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="NSArray" key="set.sortedObjects">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <string>Apple HTML pasteboard type</string>
+ <string>Apple PDF pasteboard type</string>
+ <string>Apple PICT pasteboard type</string>
+ <string>Apple PNG pasteboard type</string>
+ <string>Apple URL pasteboard type</string>
+ <string>CorePasteboardFlavorType 0x6D6F6F76</string>
+ <string>NSColor pasteboard type</string>
+ <string>NSFilenamesPboardType</string>
+ <string>NSStringPboardType</string>
+ <string>NeXT Encapsulated PostScript v1.2 pasteboard type</string>
+ <string>NeXT RTFD pasteboard type</string>
+ <string>NeXT Rich Text Format v1.0 pasteboard type</string>
+ <string>NeXT TIFF v4.0 pasteboard type</string>
+ <string>NeXT font pasteboard type</string>
+ <string>NeXT ruler pasteboard type</string>
+ <string>WebURLsWithTitlesPboardType</string>
+ <string>public.url</string>
+ </object>
+ </object>
<string key="NSFrameSize">{542, 14}</string>
<reference key="NSSuperview" ref="78677381"/>
<object class="NSTextContainer" key="NSTextContainer" id="708157837">
@@ -3894,7 +3913,7 @@
<nil key="NSDefaultParagraphStyle"/>
</object>
<int key="NSTVFlags">6</int>
- <string key="NSMaxSize">{1085, 1e+07}</string>
+ <string key="NSMaxSize">{1097, 1e+07}</string>
<string key="NSMinize">{223, 0}</string>
<nil key="NSDelegate"/>
</object>
@@ -4032,7 +4051,7 @@
<nil key="NSDefaultParagraphStyle"/>
</object>
<int key="NSTVFlags">6</int>
- <string key="NSMaxSize">{1085, 1e+07}</string>
+ <string key="NSMaxSize">{1097, 1e+07}</string>
<string key="NSMinize">{223, 0}</string>
<nil key="NSDelegate"/>
</object>
@@ -4451,6 +4470,7 @@
</object>
</object>
<string key="NSFrame">{{10, 7}, {706, 544}}</string>
+ <reference key="NSSuperview" ref="714795046"/>
</object>
<string key="NSLabel">Status</string>
<reference key="NSColor" ref="62854682"/>
@@ -4846,7 +4866,7 @@
<object class="NSTabViewItem" id="75945221">
<string key="NSIdentifier">triggers</string>
<object class="NSView" key="NSView" id="776303855">
- <reference key="NSNextResponder" ref="714795046"/>
+ <nil key="NSNextResponder"/>
<int key="NSvFlags">256</int>
<object class="NSMutableArray" key="NSSubviews">
<bool key="EncodedWithXMLCoder">YES</bool>
@@ -5279,21 +5299,20 @@
</object>
</object>
<string key="NSFrame">{{10, 7}, {706, 544}}</string>
- <reference key="NSSuperview" ref="714795046"/>
</object>
<string key="NSLabel">Triggers</string>
<reference key="NSColor" ref="62854682"/>
<reference key="NSTabView" ref="714795046"/>
</object>
</object>
- <reference key="NSSelectedTabViewItem" ref="75945221"/>
+ <reference key="NSSelectedTabViewItem" ref="94659530"/>
<reference key="NSFont" ref="26"/>
<int key="NSTvFlags">134217731</int>
<bool key="NSAllowTruncatedLabels">YES</bool>
<bool key="NSDrawsBackground">YES</bool>
<object class="NSMutableArray" key="NSSubviews">
<bool key="EncodedWithXMLCoder">YES</bool>
- <reference ref="776303855"/>
+ <reference ref="730602982"/>
</object>
</object>
</object>
@@ -13212,26 +13231,6 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string>
<int key="connectionID">5531</int>
</object>
<object class="IBConnectionRecord">
- <object class="IBBindingConnection" key="connection">
- <string key="label">font: values.CustomQueryEditorFont</string>
- <reference key="source" ref="1055190999"/>
- <reference key="destination" ref="461189245"/>
- <object class="NSNibBindingConnector" key="connector">
- <reference key="NSSource" ref="1055190999"/>
- <reference key="NSDestination" ref="461189245"/>
- <string key="NSLabel">font: values.CustomQueryEditorFont</string>
- <string key="NSBinding">font</string>
- <string key="NSKeyPath">values.CustomQueryEditorFont</string>
- <object class="NSDictionary" key="NSOptions">
- <string key="NS.key.0">NSValueTransformerName</string>
- <string key="NS.object.0">NSUnarchiveFromData</string>
- </object>
- <int key="NSNibBindingConnectorVersion">2</int>
- </object>
- </object>
- <int key="connectionID">5533</int>
- </object>
- <object class="IBConnectionRecord">
<object class="IBOutletConnection" key="connection">
<string key="label">autohelpMenuItem</string>
<reference key="source" ref="601471102"/>
@@ -13592,26 +13591,6 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string>
<int key="connectionID">5860</int>
</object>
<object class="IBConnectionRecord">
- <object class="IBBindingConnection" key="connection">
- <string key="label">font: values.CustomQueryEditorFont</string>
- <reference key="source" ref="421486962"/>
- <reference key="destination" ref="461189245"/>
- <object class="NSNibBindingConnector" key="connector">
- <reference key="NSSource" ref="421486962"/>
- <reference key="NSDestination" ref="461189245"/>
- <string key="NSLabel">font: values.CustomQueryEditorFont</string>
- <string key="NSBinding">font</string>
- <string key="NSKeyPath">values.CustomQueryEditorFont</string>
- <object class="NSDictionary" key="NSOptions">
- <string key="NS.key.0">NSValueTransformerName</string>
- <string key="NS.object.0">NSUnarchiveFromData</string>
- </object>
- <int key="NSNibBindingConnectorVersion">2</int>
- </object>
- </object>
- <int key="connectionID">5864</int>
- </object>
- <object class="IBConnectionRecord">
<object class="IBActionConnection" key="connection">
<string key="label">selectTableColumn:</string>
<reference key="source" ref="885866030"/>
@@ -14789,26 +14768,6 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string>
<int key="connectionID">6587</int>
</object>
<object class="IBConnectionRecord">
- <object class="IBBindingConnection" key="connection">
- <string key="label">font: values.CustomQueryEditorFont</string>
- <reference key="source" ref="843242867"/>
- <reference key="destination" ref="461189245"/>
- <object class="NSNibBindingConnector" key="connector">
- <reference key="NSSource" ref="843242867"/>
- <reference key="NSDestination" ref="461189245"/>
- <string key="NSLabel">font: values.CustomQueryEditorFont</string>
- <string key="NSBinding">font</string>
- <string key="NSKeyPath">values.CustomQueryEditorFont</string>
- <object class="NSDictionary" key="NSOptions">
- <string key="NS.key.0">NSValueTransformerName</string>
- <string key="NS.object.0">NSUnarchiveFromData</string>
- </object>
- <int key="NSNibBindingConnectorVersion">2</int>
- </object>
- </object>
- <int key="connectionID">6593</int>
- </object>
- <object class="IBConnectionRecord">
<object class="IBOutletConnection" key="connection">
<string key="label">createTableSyntaxTextView</string>
<reference key="source" ref="427689665"/>
@@ -22776,7 +22735,8 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string>
<string>669.IBPluginDependency</string>
<string>669.ImportedFromIB2</string>
<string>6690.IBPluginDependency</string>
- <string>6691.IBPluginDependency</string>
+ <string>6692.IBPluginDependency</string>
+ <string>6693.IBPluginDependency</string>
<string>6694.IBPluginDependency</string>
<string>6695.IBPluginDependency</string>
<string>6696.IBAttributePlaceholdersKey</string>
@@ -22820,8 +22780,12 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string>
<string>672.IBPluginDependency</string>
<string>672.ImportedFromIB2</string>
<string>6720.IBPluginDependency</string>
+ <string>6727.IBPluginDependency</string>
+ <string>6728.IBPluginDependency</string>
+ <string>6729.IBPluginDependency</string>
<string>673.IBPluginDependency</string>
<string>673.ImportedFromIB2</string>
+ <string>6730.IBPluginDependency</string>
<string>6735.IBEditorWindowLastContentRect</string>
<string>6735.IBPluginDependency</string>
<string>6736.IBPluginDependency</string>
@@ -23697,10 +23661,10 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="1"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>{{799, 846}, {944, 550}}</string>
+ <string>{{239, 357}, {944, 550}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<boolean value="NO"/>
- <string>{{799, 846}, {944, 550}}</string>
+ <string>{{239, 357}, {944, 550}}</string>
<integer value="1"/>
<integer value="1"/>
<string>{{62, 352}, {845, 504}}</string>
@@ -24660,6 +24624,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<object class="NSMutableDictionary">
<string key="NS.key.0">ToolTip</string>
<object class="IBToolTipAttribute" key="NS.object.0">
@@ -24723,7 +24688,11 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string>
<integer value="1"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="1"/>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>{{539, 190}, {158, 23}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
diff --git a/Source/CMTextView.m b/Source/CMTextView.m
index 97fceb37..2601a314 100644
--- a/Source/CMTextView.m
+++ b/Source/CMTextView.m
@@ -106,6 +106,10 @@ NSInteger alphabeticSort(id string1, id string2, void *reverse)
- (void) awakeFromNib
{
+
+ prefs = [[NSUserDefaults standardUserDefaults] retain];
+ [self setFont:[NSUnarchiver unarchiveObjectWithData:[prefs dataForKey:SPCustomQueryEditorFont]]];
+
// Set self as delegate for the textView's textStorage to enable syntax highlighting,
[[self textStorage] setDelegate:self];
@@ -125,6 +129,13 @@ NSInteger alphabeticSort(id string1, id string2, void *reverse)
[scrollView setHasHorizontalRuler:NO];
[scrollView setHasVerticalRuler:YES];
[scrollView setRulersVisible:YES];
+ [self setAllowsDocumentBackgroundColorChange:YES];
+ [self setContinuousSpellCheckingEnabled:NO];
+ [self setAutoindent:[prefs boolForKey:SPCustomQueryAutoIndent]];
+ [self setAutoindentIgnoresEnter:YES];
+ [self setAutopair:[prefs boolForKey:SPCustomQueryAutoPairCharacters]];
+ [self setAutohelp:[prefs boolForKey:SPCustomQueryUpdateAutoHelp]];
+ [self setAutouppercaseKeywords:[prefs boolForKey:SPCustomQueryAutoUppercaseKeywords]];
// Re-define 64 tab stops for a better editing
NSFont *tvFont = [self font];
@@ -168,8 +179,6 @@ NSInteger alphabeticSort(id string1, id string2, void *reverse)
NSNotificationCenter *aNotificationCenter = [NSNotificationCenter defaultCenter];
[aNotificationCenter addObserver:self selector:@selector(boundsDidChangeNotification:) name:@"NSViewBoundsDidChangeNotification" object:[scrollView contentView]];
- prefs = [[NSUserDefaults standardUserDefaults] retain];
-
[self setQueryHiliteColor:[NSUnarchiver unarchiveObjectWithData:[prefs dataForKey:SPCustomQueryEditorHighlightQueryColor]]];
[self setQueryEditorBackgroundColor:[NSUnarchiver unarchiveObjectWithData:[prefs dataForKey:SPCustomQueryEditorBackgroundColor]]];
[self setCommentColor:[NSUnarchiver unarchiveObjectWithData:[prefs dataForKey:SPCustomQueryEditorCommentColor]]];
@@ -184,6 +193,7 @@ NSInteger alphabeticSort(id string1, id string2, void *reverse)
[self setShouldHiliteQuery:[prefs boolForKey:SPCustomQueryHighlightCurrentQuery]];
// Register observers for the when editor background colors preference changes
+ [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];
[prefs addObserver:self forKeyPath:SPCustomQueryHighlightCurrentQuery options:NSKeyValueObservingOptionNew context:NULL];
@@ -211,6 +221,9 @@ NSInteger alphabeticSort(id string1, id string2, void *reverse)
if ([keyPath isEqualToString:SPCustomQueryEditorBackgroundColor]) {
[self setQueryEditorBackgroundColor:[NSUnarchiver unarchiveObjectWithData:[change objectForKey:NSKeyValueChangeNewKey]]];
[self setNeedsDisplay:YES];
+ } else if ([keyPath isEqualToString:SPCustomQueryEditorFont]) {
+ [self setFont:[NSUnarchiver unarchiveObjectWithData:[change objectForKey:NSKeyValueChangeNewKey]]];
+ [self setNeedsDisplay:YES];
} else if ([keyPath isEqualToString:SPCustomQueryEditorHighlightQueryColor]) {
[self setQueryHiliteColor:[NSUnarchiver unarchiveObjectWithData:[change objectForKey:NSKeyValueChangeNewKey]]];
[self setNeedsDisplay:YES];
@@ -510,6 +523,10 @@ NSInteger alphabeticSort(id string1, id string2, void *reverse)
NSString* prefix = @"";
NSString *currentDb = nil;
+ // Break for long stuff
+ if(completionRange.length>100000) return;
+
+
NSString* allow; // additional chars which not close the popup
if(isDictMode)
allow= @"_";
@@ -549,9 +566,9 @@ NSInteger alphabeticSort(id string1, id string2, void *reverse)
NSCharacterSet *whiteSpaceCharSet = [NSCharacterSet whitespaceAndNewlineCharacterSet];
NSUInteger start = caretPos;
NSInteger backticksCounter = (caretIsInsideBackticks) ? 1 : 0;
- NSUInteger pointCounter = 0;
- NSUInteger firstPoint = 0;
- NSUInteger secondPoint = 0;
+ NSInteger pointCounter = 0;
+ NSInteger firstPoint = 0;
+ NSInteger secondPoint = 0;
BOOL rightBacktick = NO;
BOOL leftBacktick = NO;
BOOL doParsing = YES;
@@ -592,9 +609,13 @@ NSInteger alphabeticSort(id string1, id string2, void *reverse)
}
dbBrowseMode = (pointCounter || backticksCounter);
-
+
if(dbBrowseMode) {
parseRange = NSMakeRange(start, caretPos-start);
+
+ // Break for long stuff
+ if(parseRange.length>100000) return;
+
NSString *parsedString = [[self string] substringWithRange:parseRange];
// Check if parsed string is wrapped by ``
@@ -1449,7 +1470,7 @@ NSInteger alphabeticSort(id string1, id string2, void *reverse)
return;
}
if(curFlags & NSCommandKeyMask) {
- if([charactersIgnMod isEqualToString:@"+"]) // increase text size by 1; ⌘+ and numpad +
+ if([charactersIgnMod isEqualToString:@"+"] || [charactersIgnMod isEqualToString:@"="]) // increase text size by 1; ⌘+, ⌘=, and ⌘ numpad +
{
[self makeTextSizeLarger];
return;
@@ -1459,6 +1480,10 @@ NSInteger alphabeticSort(id string1, id string2, void *reverse)
[self makeTextSizeSmaller];
return;
}
+ if([charactersIgnMod isEqualToString:@"0"]) { // reset font to default
+ [self setFont:[NSUnarchiver unarchiveObjectWithData:[prefs dataForKey:SPCustomQueryEditorFont]]];
+ return;
+ }
}
// Only process for character autopairing if autopairing is enabled and a single character is being added.
@@ -3452,6 +3477,20 @@ NSInteger alphabeticSort(id string1, id string2, void *reverse)
NSLog(@"%@ ‘%@’.", NSLocalizedString(@"Couldn't read the file content of", @"Couldn't read the file content of"), aPath);
}
+- (void)changeFont:(id)sender
+{
+ if (prefs && [self font] != nil) {
+ [prefs setObject:[NSArchiver archivedDataWithRootObject:[self font]] forKey:SPCustomQueryEditorFont];
+ NSFont *nf = [[NSFontPanel sharedFontPanel] panelConvertFont:[NSUnarchiver unarchiveObjectWithData:[prefs dataForKey:SPCustomQueryEditorFont]]];
+ BOOL oldEditable = [self isEditable];
+ [self setEditable:YES];
+ [self setFont:nf];
+ [self setEditable:oldEditable];
+ [self setNeedsDisplay:YES];
+ [prefs setObject:[NSArchiver archivedDataWithRootObject:nf] forKey:SPCustomQueryEditorFont];
+ }
+}
+
- (void) dealloc
{
[[NSNotificationCenter defaultCenter] removeObserver:self];
diff --git a/Source/CustomQuery.m b/Source/CustomQuery.m
index d977d7de..75bbb894 100644
--- a/Source/CustomQuery.m
+++ b/Source/CustomQuery.m
@@ -1278,19 +1278,11 @@
// Set up the interface
- [textView setAllowsDocumentBackgroundColorChange:YES];
-
[customQueryView setVerticalMotionCanBeginDrag:NO];
- [textView setContinuousSpellCheckingEnabled:NO];
[autoindentMenuItem setState:([prefs boolForKey:SPCustomQueryAutoIndent]?NSOnState:NSOffState)];
- [textView setAutoindent:[prefs boolForKey:SPCustomQueryAutoIndent]];
- [textView setAutoindentIgnoresEnter:YES];
[autopairMenuItem setState:([prefs boolForKey:SPCustomQueryAutoPairCharacters]?NSOnState:NSOffState)];
- [textView setAutopair:[prefs boolForKey:SPCustomQueryAutoPairCharacters]];
[autohelpMenuItem setState:([prefs boolForKey:SPCustomQueryUpdateAutoHelp]?NSOnState:NSOffState)];
- [textView setAutohelp:[prefs boolForKey:SPCustomQueryUpdateAutoHelp]];
[autouppercaseKeywordsMenuItem setState:([prefs boolForKey:SPCustomQueryAutoUppercaseKeywords]?NSOnState:NSOffState)];
- [textView setAutouppercaseKeywords:[prefs boolForKey:SPCustomQueryAutoUppercaseKeywords]];
if ( [[SPQueryController sharedQueryController] historyForFileURL:[tableDocumentInstance fileURL]] )
{
@@ -2107,18 +2099,6 @@
}
}
-/*
- * Save the custom query editor font if it is changed.
- */
-- (void)textViewDidChangeTypingAttributes:(NSNotification *)aNotification
-{
- // Only save the font if prefs have been loaded, ensuring the saved font has been applied once.
- // And check for [textView font] != nil which occurs while awaking from nib.
- if (prefs && [textView font] != nil)
- [prefs setObject:[NSArchiver archivedDataWithRootObject:[textView font]] forKey:SPCustomQueryEditorFont];
-
-}
-
#pragma mark -
#pragma mark TextField delegate methods