aboutsummaryrefslogtreecommitdiffstats
path: root/Source/CustomQuery.m
diff options
context:
space:
mode:
authorrowanbeentje <rowan@beent.je>2009-04-05 00:38:34 +0000
committerrowanbeentje <rowan@beent.je>2009-04-05 00:38:34 +0000
commit977d1a25340e5c2aef868f43cb180a1d9472b29c (patch)
tree6bd393f8a26c583d071289ddc349f8db98782f28 /Source/CustomQuery.m
parentbe9d9739ab37719ce761ee7c1e7c97ec2aa8a76d (diff)
downloadsequelpro-977d1a25340e5c2aef868f43cb180a1d9472b29c.tar.gz
sequelpro-977d1a25340e5c2aef868f43cb180a1d9472b29c.tar.bz2
sequelpro-977d1a25340e5c2aef868f43cb180a1d9472b29c.zip
- Fix an invalid reference to a missing pulldown_arrow image causing invalid log entries
- Set the focus to the custom query text field when appropriate when switching to the custom query tab - Add the ability to set the custom query editor font, save and load it from preferences, and no longer reset the font on queries
Diffstat (limited to 'Source/CustomQuery.m')
-rw-r--r--Source/CustomQuery.m34
1 files changed, 23 insertions, 11 deletions
diff --git a/Source/CustomQuery.m b/Source/CustomQuery.m
index 6b89f6a4..23590fa7 100644
--- a/Source/CustomQuery.m
+++ b/Source/CustomQuery.m
@@ -56,13 +56,8 @@
[self performQueries:queries];
- // Select the text of the query textView for re-editing and set standard font
+ // Select the text of the query textView for re-editing
[textView selectAll:self];
- if ( [prefs boolForKey:@"useMonospacedFonts"] ) {
- [textView setFont:[NSFont fontWithName:@"Monaco" size:[NSFont smallSystemFontSize]]];
- } else {
- [textView setFont:[NSFont systemFontOfSize:[NSFont smallSystemFontSize]]];
- }
}
/*
@@ -184,6 +179,12 @@ closes the sheet
[textView complete:self];
}
+ // "Editor font..." menu item to bring up the font panel
+ if (sender == editorFontMenuItem) {
+ [[NSFontPanel sharedFontPanel] setPanelFont:[textView font] isMultiple:NO];
+ [[NSFontPanel sharedFontPanel] makeKeyAndOrderFront:self];
+ }
+
// "Indent new lines" toggle
if (sender == autoindentMenuItem) {
BOOL enableAutoindent = ([autoindentMenuItem state] == NSOffState);
@@ -601,11 +602,7 @@ sets the connection (received from TableDocument) and makes things that have to
// Set up the interface
[customQueryView setVerticalMotionCanBeginDrag:NO];
- if ( [prefs boolForKey:@"useMonospacedFonts"] ) {
- [textView setFont:[NSFont fontWithName:@"Monaco" size:[NSFont smallSystemFontSize]]];
- } else {
- [textView setFont:[NSFont systemFontOfSize:[NSFont smallSystemFontSize]]];
- }
+ [textView setFont:[NSUnarchiver unarchiveObjectWithData:[prefs dataForKey:@"CustomQueryEditorFont"]]];
[textView setContinuousSpellCheckingEnabled:NO];
[autoindentMenuItem setState:([prefs boolForKey:@"CustomQueryAutoindent"]?NSOnState:NSOffState)];
[textView setAutoindent:[prefs boolForKey:@"CustomQueryAutoindent"]];
@@ -1007,6 +1004,20 @@ traps enter key and
}
+/*
+ * 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.
+ if (prefs) {
+ [prefs setObject:[NSArchiver archivedDataWithRootObject:[textView font]] forKey:@"CustomQueryEditorFont"];
+ }
+}
+
+
+
#pragma mark -
#pragma mark TableView notifications
@@ -1032,6 +1043,7 @@ traps enter key and
- (id)init;
{
self = [super init];
+ prefs = nil;
return self;
}