From 8886d935e933c6239aa9b35e900d96f7d07527c7 Mon Sep 17 00:00:00 2001 From: dmoagx Date: Fri, 16 Mar 2012 20:19:17 +0000 Subject: * Moves the background color code for SPTextView into the class. Fixes #1073 --- Source/SPDatabaseDocument.m | 12 ------------ Source/SPExtendedTableInfo.m | 11 ----------- Source/SPQueryFavoriteManager.m | 12 ------------ Source/SPTextView.m | 8 ++++++-- 4 files changed, 6 insertions(+), 37 deletions(-) (limited to 'Source') diff --git a/Source/SPDatabaseDocument.m b/Source/SPDatabaseDocument.m index 53d9b5c6..4af8de2f 100644 --- a/Source/SPDatabaseDocument.m +++ b/Source/SPDatabaseDocument.m @@ -299,18 +299,6 @@ static NSString *SPCreateSyntx = @"SPCreateSyntax"; // Hide the activity list [self setActivityPaneHidden:[NSNumber numberWithInteger:1]]; - // Bind the background color of the create syntax text view to the users preference - [createTableSyntaxTextView setAllowsDocumentBackgroundColorChange:YES]; - - NSMutableDictionary *bindingOptions = [NSMutableDictionary dictionary]; - - [bindingOptions setObject:NSUnarchiveFromDataTransformerName forKey:@"NSValueTransformerName"]; - - [createTableSyntaxTextView bind:@"backgroundColor" - toObject:[NSUserDefaultsController sharedUserDefaultsController] - withKeyPath:@"values.CustomQueryEditorBackgroundColor" - options:bindingOptions]; - // Load additional nibs, keeping track of the top-level objects to allow correct release NSArray *connectionDialogTopLevelObjects = nil; NSNib *nibLoader = [[NSNib alloc] initWithNibNamed:@"ConnectionErrorDialog" bundle:[NSBundle mainBundle]]; diff --git a/Source/SPExtendedTableInfo.m b/Source/SPExtendedTableInfo.m index 3429446b..dcacf2ed 100644 --- a/Source/SPExtendedTableInfo.m +++ b/Source/SPExtendedTableInfo.m @@ -53,17 +53,6 @@ static NSString *SPUpdateTableTypeNewType = @"SPUpdateTableTypeNewType"; */ - (void)awakeFromNib { - [tableCreateSyntaxTextView setAllowsDocumentBackgroundColorChange:YES]; - - NSMutableDictionary *bindingOptions = [NSMutableDictionary dictionary]; - - [bindingOptions setObject:NSUnarchiveFromDataTransformerName forKey:@"NSValueTransformerName"]; - - [tableCreateSyntaxTextView bind:@"backgroundColor" - toObject:[NSUserDefaultsController sharedUserDefaultsController] - withKeyPath:@"values.CustomQueryEditorBackgroundColor" - options:bindingOptions]; - // Add observers for document task activity [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(startDocumentTaskForTab:) diff --git a/Source/SPQueryFavoriteManager.m b/Source/SPQueryFavoriteManager.m index 28f824fe..1b5ce3dc 100644 --- a/Source/SPQueryFavoriteManager.m +++ b/Source/SPQueryFavoriteManager.m @@ -82,18 +82,6 @@ */ - (void)awakeFromNib { - [favoriteQueryTextView setAllowsDocumentBackgroundColorChange:YES]; - - NSMutableDictionary *bindingOptions = [NSMutableDictionary dictionary]; - - [bindingOptions setObject:NSUnarchiveFromDataTransformerName forKey:@"NSValueTransformerName"]; - - [favoriteQueryTextView bind:@"backgroundColor" - toObject:[NSUserDefaultsController sharedUserDefaultsController] - withKeyPath:@"values.CustomQueryEditorBackgroundColor" - options:bindingOptions]; - - [favorites addObject:[NSDictionary dictionaryWithObjectsAndKeys: @"Global", @"name", @"", @"headerOfFileURL", diff --git a/Source/SPTextView.m b/Source/SPTextView.m index 500e4892..6611d6f8 100644 --- a/Source/SPTextView.m +++ b/Source/SPTextView.m @@ -180,7 +180,9 @@ NSInteger _alphabeticSort(id string1, id string2, void *reverse) #ifndef SP_REFACTOR [self setQueryHiliteColor:[NSUnarchiver unarchiveObjectWithData:[prefs dataForKey:SPCustomQueryEditorHighlightQueryColor]]]; - [self setQueryEditorBackgroundColor:[NSUnarchiver unarchiveObjectWithData:[prefs dataForKey:SPCustomQueryEditorBackgroundColor]]]; + NSColor *backgroundColor = [NSUnarchiver unarchiveObjectWithData:[prefs dataForKey:SPCustomQueryEditorBackgroundColor]]; + [self setQueryEditorBackgroundColor:backgroundColor]; + [self setBackgroundColor:backgroundColor]; [self setCommentColor:[NSUnarchiver unarchiveObjectWithData:[prefs dataForKey:SPCustomQueryEditorCommentColor]]]; [self setQuoteColor:[NSUnarchiver unarchiveObjectWithData:[prefs dataForKey:SPCustomQueryEditorQuoteColor]]]; [self setKeywordColor:[NSUnarchiver unarchiveObjectWithData:[prefs dataForKey:SPCustomQueryEditorSQLKeywordColor]]]; @@ -240,7 +242,9 @@ NSInteger _alphabeticSort(id string1, id string2, void *reverse) { #ifndef SP_REFACTOR if ([keyPath isEqualToString:SPCustomQueryEditorBackgroundColor]) { - [self setQueryEditorBackgroundColor:[NSUnarchiver unarchiveObjectWithData:[change objectForKey:NSKeyValueChangeNewKey]]]; + NSColor *backgroundColor = [NSUnarchiver unarchiveObjectWithData:[change objectForKey:NSKeyValueChangeNewKey]]; + [self setQueryEditorBackgroundColor:backgroundColor]; + [self setBackgroundColor:backgroundColor]; [self setNeedsDisplayInRect:[self bounds]]; } else if ([keyPath isEqualToString:SPCustomQueryEditorFont]) { [self setFont:[NSUnarchiver unarchiveObjectWithData:[change objectForKey:NSKeyValueChangeNewKey]]]; -- cgit v1.2.3