diff options
author | Bibiko <bibiko@eva.mpg.de> | 2010-01-30 22:29:34 +0000 |
---|---|---|
committer | Bibiko <bibiko@eva.mpg.de> | 2010-01-30 22:29:34 +0000 |
commit | 890247960876e8dd987dd44ec98da4300b6a0fd3 (patch) | |
tree | fe077fbf95d6599c88dc2c2f34494665452a32ef /Source/SPPreferenceController.m | |
parent | a776a6437e40837cc2e20a9231e3eb8ef1a73ddf (diff) | |
download | sequelpro-890247960876e8dd987dd44ec98da4300b6a0fd3.tar.gz sequelpro-890247960876e8dd987dd44ec98da4300b6a0fd3.tar.bz2 sequelpro-890247960876e8dd987dd44ec98da4300b6a0fd3.zip |
• CMTextView's colours are set via observer, live changed in editable textviews
• added Preference setting "Table font" in "Table" pane to set the table font/size for all result tables (Content, Custom Query)
• added to SPTableView the method setFont:
• fixed the initialisation of vars in CMTextView (fixes the displaying of create syntax)
Diffstat (limited to 'Source/SPPreferenceController.m')
-rw-r--r-- | Source/SPPreferenceController.m | 38 |
1 files changed, 32 insertions, 6 deletions
diff --git a/Source/SPPreferenceController.m b/Source/SPPreferenceController.m index 6377153a..d7d6bdbe 100644 --- a/Source/SPPreferenceController.m +++ b/Source/SPPreferenceController.m @@ -57,6 +57,7 @@ keychain = nil; favoriteNameFieldWasTouched = YES; favoriteType = 0; + fontChangeTarget = 0; } return self; @@ -457,6 +458,8 @@ [[self window] setShowsResizeIndicator:NO]; [toolbar setSelectedItemIdentifier:SPPreferenceToolbarTables]; + NSFont *nf = [NSUnarchiver unarchiveObjectWithData:[prefs dataForKey:SPGlobalResultTableFont]]; + [globalResultTableFontName setStringValue:[NSString stringWithFormat:@"%@, %.1f pt", [nf displayName], [nf pointSize]]]; [self _resizeWindowForContentView:tablesView]; } @@ -1051,12 +1054,23 @@ } // ------------------------------------------------------------------------------- +// global table font selection +// ------------------------------------------------------------------------------- +// show the font panel +- (IBAction)showGlobalResultTableFontPanel:(id)sender +{ + fontChangeTarget = 1; + [[NSFontPanel sharedFontPanel] setPanelFont:[NSUnarchiver unarchiveObjectWithData:[prefs dataForKey:SPGlobalResultTableFont]] isMultiple:NO]; + [[NSFontPanel sharedFontPanel] makeKeyAndOrderFront:self]; +} + +// ------------------------------------------------------------------------------- // query editor font selection -// // ------------------------------------------------------------------------------- // show the font panel - (IBAction)showCustomQueryFontPanel:(id)sender { + fontChangeTarget = 2; [[NSFontPanel sharedFontPanel] setPanelFont:[NSUnarchiver unarchiveObjectWithData:[prefs dataForKey:SPCustomQueryEditorFont]] isMultiple:NO]; [[NSFontPanel sharedFontPanel] makeKeyAndOrderFront:self]; } @@ -1076,17 +1090,29 @@ [prefs setObject:[NSArchiver archivedDataWithRootObject:[NSColor whiteColor]] forKey:SPCustomQueryEditorBackgroundColor]; } -// set font panel's valid modes + +// Set font panel's valid modes - (NSUInteger)validModesForFontPanel:(NSFontPanel *)fontPanel { - return (NSFontPanelAllModesMask ^ NSFontPanelAllEffectsModeMask); + return (NSFontPanelSizeModeMask|NSFontPanelCollectionModeMask); } + // Action receiver for a font change in the font panel - (void)changeFont:(id)sender { - NSFont *nf = [[NSFontPanel sharedFontPanel] panelConvertFont:[NSUnarchiver unarchiveObjectWithData:[prefs dataForKey:SPCustomQueryEditorFont]]]; - [prefs setObject:[NSArchiver archivedDataWithRootObject:nf] forKey:SPCustomQueryEditorFont]; - [editorFontName setStringValue:[NSString stringWithFormat:@"%@, %.1f pt", [nf displayName], [nf pointSize]]]; + NSFont *nf; + switch(fontChangeTarget) { + case 1: + nf = [[NSFontPanel sharedFontPanel] panelConvertFont:[NSUnarchiver unarchiveObjectWithData:[prefs dataForKey:SPGlobalResultTableFont]]]; + [prefs setObject:[NSArchiver archivedDataWithRootObject:nf] forKey:SPGlobalResultTableFont]; + [globalResultTableFontName setStringValue:[NSString stringWithFormat:@"%@, %.1f pt", [nf displayName], [nf pointSize]]]; + break; + case 2: + nf = [[NSFontPanel sharedFontPanel] panelConvertFont:[NSUnarchiver unarchiveObjectWithData:[prefs dataForKey:SPCustomQueryEditorFont]]]; + [prefs setObject:[NSArchiver archivedDataWithRootObject:nf] forKey:SPCustomQueryEditorFont]; + [editorFontName setStringValue:[NSString stringWithFormat:@"%@, %.1f pt", [nf displayName], [nf pointSize]]]; + break; + } } // ------------------------------------------------------------------------------- |