aboutsummaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorBibiko <bibiko@eva.mpg.de>2010-08-17 19:39:14 +0000
committerBibiko <bibiko@eva.mpg.de>2010-08-17 19:39:14 +0000
commitcb3f168082f921bdfd65eecec7d21eaf4e8bd79e (patch)
tree82e44241baf24f06a7b8fb4f157973828b9cf189 /Source
parent86c687edf1b91e18b55389200ea363ebd1f29058 (diff)
downloadsequelpro-cb3f168082f921bdfd65eecec7d21eaf4e8bd79e.tar.gz
sequelpro-cb3f168082f921bdfd65eecec7d21eaf4e8bd79e.tar.bz2
sequelpro-cb3f168082f921bdfd65eecec7d21eaf4e8bd79e.zip
• Editor color setting in Pref pane displays the color names using the Editor's font
- added some logic for closing the NSColorPanel - some GUI tweaks
Diffstat (limited to 'Source')
-rw-r--r--Source/SPPreferenceController.m20
-rw-r--r--Source/SPTextView.m6
2 files changed, 23 insertions, 3 deletions
diff --git a/Source/SPPreferenceController.m b/Source/SPPreferenceController.m
index 4f249723..ad8d6bb8 100644
--- a/Source/SPPreferenceController.m
+++ b/Source/SPPreferenceController.m
@@ -106,9 +106,12 @@
}
- NSTableColumn* column;
- SPColorWellCell* colorCell;
-
+ NSTableColumn *column;
+ SPColorWellCell *colorCell;
+ NSTextFieldCell *textCell;
+ column = [[colorSettingTableView tableColumns] objectAtIndex: 0];
+ textCell = [[[NSTextFieldCell alloc] init] autorelease];
+ [textCell setFont:[NSUnarchiver unarchiveObjectWithData:[prefs dataForKey:SPCustomQueryEditorFont]]];
column = [[colorSettingTableView tableColumns] objectAtIndex: 1];
colorCell = [[[SPColorWellCell alloc] init] autorelease];
[colorCell setEditable: YES];
@@ -857,6 +860,8 @@
if(tableView == colorSettingTableView && [[tableColumn identifier] isEqualToString:@"name"]) {
if ([cell isKindOfClass:[NSTextFieldCell class]]) {
[cell setDrawsBackground:YES];
+ NSFont *nf = [NSFont fontWithName:[[[NSFontPanel sharedFontPanel] panelConvertFont:[NSUnarchiver unarchiveObjectWithData:[prefs dataForKey:SPCustomQueryEditorFont]]] fontName] size:13.0f];
+ [cell setFont:nf];
switch(index) {
case 1:
[cell setTextColor:[NSUnarchiver unarchiveObjectWithData:[prefs dataForKey:SPCustomQueryEditorTextColor]]];
@@ -1202,6 +1207,9 @@
// -------------------------------------------------------------------------------
- (void)windowWillClose:(NSNotification *)notification
{
+
+ [[NSColorPanel sharedColorPanel] close];
+
// Mark the currently selected field in the window as having finished editing, to trigger saves.
if ([preferencesWindow firstResponder])
[preferencesWindow endEditingFor:[preferencesWindow firstResponder]];
@@ -1214,6 +1222,9 @@
// -------------------------------------------------------------------------------
- (NSSize)windowWillResize:(NSWindow *)sender toSize:(NSSize)frameSize
{
+
+ [[NSColorPanel sharedColorPanel] close];
+
if ([sender showsResizeIndicator])
return frameSize;
else
@@ -1364,6 +1375,7 @@
// reset syntax highlighting colors
- (IBAction)setDefaultColors:(id)sender
{
+ [[NSColorPanel sharedColorPanel] close];
[prefs setObject:[NSArchiver archivedDataWithRootObject:[NSColor colorWithDeviceRed:0.000 green:0.455 blue:0.000 alpha:1.000]] forKey:SPCustomQueryEditorCommentColor];
[prefs setObject:[NSArchiver archivedDataWithRootObject:[NSColor colorWithDeviceRed:0.769 green:0.102 blue:0.086 alpha:1.000]] forKey:SPCustomQueryEditorQuoteColor];
[prefs setObject:[NSArchiver archivedDataWithRootObject:[NSColor colorWithDeviceRed:0.200 green:0.250 blue:1.000 alpha:1.000]] forKey:SPCustomQueryEditorSQLKeywordColor];
@@ -1393,6 +1405,7 @@
- (void)colorChanged:(id)sender
{
+
if(![[NSColorPanel sharedColorPanel] isVisible]) return;
[prefs setObject:[NSArchiver archivedDataWithRootObject:[sender color]] forKey:[editorColors objectAtIndex:colorRow]];
[colorSettingTableView reloadData];
@@ -1423,6 +1436,7 @@
[editorFontName setStringValue:[NSString stringWithFormat:@"%@, %.1f pt", [nf displayName], [nf pointSize]]];
break;
}
+ [colorSettingTableView reloadData];
}
/**
diff --git a/Source/SPTextView.m b/Source/SPTextView.m
index a4ed1adc..a045a4ad 100644
--- a/Source/SPTextView.m
+++ b/Source/SPTextView.m
@@ -3317,6 +3317,12 @@ 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);
}
+// Do nothing if NSColorPanel was opened from the NSTextView
+- (void)changeColor:(id)sender
+{
+ return;
+}
+
- (void)changeFont:(id)sender
{
if (prefs && [self font] != nil) {