aboutsummaryrefslogtreecommitdiffstats
path: root/Source
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
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')
-rw-r--r--Source/CustomQuery.h1
-rw-r--r--Source/CustomQuery.m34
-rw-r--r--Source/MainController.m1
-rw-r--r--Source/TableDocument.h2
-rw-r--r--Source/TableDocument.m3
5 files changed, 30 insertions, 11 deletions
diff --git a/Source/CustomQuery.h b/Source/CustomQuery.h
index 5d314316..c2eac75f 100644
--- a/Source/CustomQuery.h
+++ b/Source/CustomQuery.h
@@ -51,6 +51,7 @@
IBOutlet NSMenuItem *shiftLeftMenuItem;
IBOutlet NSMenuItem *shiftRightMenuItem;
IBOutlet NSMenuItem *completionListMenuItem;
+ IBOutlet NSMenuItem *editorFontMenuItem;
IBOutlet NSMenuItem *autoindentMenuItem;
IBOutlet NSMenuItem *autopairMenuItem;
IBOutlet NSMenuItem *autouppercaseKeywordsMenuItem;
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;
}
diff --git a/Source/MainController.m b/Source/MainController.m
index f68c69e3..47a55ca5 100644
--- a/Source/MainController.m
+++ b/Source/MainController.m
@@ -674,6 +674,7 @@ checks for updates and opens download page in default browser
[NSNumber numberWithBool:YES], @"CustomQueryAutopair",
[NSNumber numberWithBool:YES], @"CustomQueryAutoindent",
[NSNumber numberWithBool:NO], @"CustomQueryAutouppercaseKeywords",
+ [NSArchiver archivedDataWithRootObject:[NSFont fontWithName:@"Monaco" size:10.0]], @"CustomQueryEditorFont",
nil]];
// For versions prior to r336, where column widths have been saved, walk through them and remove
diff --git a/Source/TableDocument.h b/Source/TableDocument.h
index c2d37910..f9334c39 100644
--- a/Source/TableDocument.h
+++ b/Source/TableDocument.h
@@ -70,6 +70,8 @@
IBOutlet id sidebarGrabber;
+ IBOutlet NSTextView *customQueryTextView;
+
IBOutlet NSTableView *dbTablesTableView;
IBOutlet id syntaxView;
diff --git a/Source/TableDocument.m b/Source/TableDocument.m
index cd83f007..9e0853e0 100644
--- a/Source/TableDocument.m
+++ b/Source/TableDocument.m
@@ -1264,6 +1264,9 @@ NSString *TableDocumentFavoritesControllerFavoritesDidChange = @"TableDocumentFa
[tableTabView selectTabViewItemAtIndex:2];
[mainToolbar setSelectedItemIdentifier:@"SwitchToRunQueryToolbarItemIdentifier"];
+
+ // Set the focus on the text field if no query has been run
+ if (![[customQueryTextView string] length]) [tableWindow makeFirstResponder:customQueryTextView];
}
- (IBAction)viewStatus:(id)sender