aboutsummaryrefslogtreecommitdiffstats
path: root/Source/SPEditorPreferencePane.m
diff options
context:
space:
mode:
authorAbhi Beckert <abhi@Twist-of-Lemon-2.local>2015-05-16 08:06:06 +1000
committerAbhi Beckert <abhi@Twist-of-Lemon-2.local>2015-05-16 08:06:06 +1000
commit57a6f6c73bdaa202164645370d37fcbe5d14a092 (patch)
treedd30aa6156064f1d4c0e10ea87059625470fc2f9 /Source/SPEditorPreferencePane.m
parentb5e972f4504043dfb9c358e272e93fb59ae2127f (diff)
parent0f0c43eb74408b6a65a42e2c6fd46f4142ef8e3f (diff)
downloadsequelpro-57a6f6c73bdaa202164645370d37fcbe5d14a092.tar.gz
sequelpro-57a6f6c73bdaa202164645370d37fcbe5d14a092.tar.bz2
sequelpro-57a6f6c73bdaa202164645370d37fcbe5d14a092.zip
Merge remote-tracking branch 'sequelpro/master'
Diffstat (limited to 'Source/SPEditorPreferencePane.m')
-rw-r--r--Source/SPEditorPreferencePane.m42
1 files changed, 25 insertions, 17 deletions
diff --git a/Source/SPEditorPreferencePane.m b/Source/SPEditorPreferencePane.m
index 93e5c42b..7eaecf47 100644
--- a/Source/SPEditorPreferencePane.m
+++ b/Source/SPEditorPreferencePane.m
@@ -66,7 +66,7 @@ static NSString *SPCustomColorSchemeNameLC = @"user-defined";
editThemeListItems = [[NSArray arrayWithArray:[self _getAvailableThemes]] retain];
editorColors =
- [[NSArray arrayWithObjects:
+ [@[
SPCustomQueryEditorTextColor,
SPCustomQueryEditorBackgroundColor,
SPCustomQueryEditorCaretColor,
@@ -77,11 +77,11 @@ static NSString *SPCustomColorSchemeNameLC = @"user-defined";
SPCustomQueryEditorBacktickColor,
SPCustomQueryEditorVariableColor,
SPCustomQueryEditorHighlightQueryColor,
- SPCustomQueryEditorSelectionColor,
- nil] retain];
+ SPCustomQueryEditorSelectionColor
+ ] retain];
editorNameForColors =
- [[NSArray arrayWithObjects:
+ [@[
NSLocalizedString(@"Text", @"text label for color table (Prefs > Editor)"),
NSLocalizedString(@"Background", @"background label for color table (Prefs > Editor)"),
NSLocalizedString(@"Caret", @"caret label for color table (Prefs > Editor)"),
@@ -92,8 +92,8 @@ static NSString *SPCustomColorSchemeNameLC = @"user-defined";
NSLocalizedString(@"Backtick Quote", @"backtick quote label for color table (Prefs > Editor)"),
NSLocalizedString(@"Variable", @"variable label for color table (Prefs > Editor)"),
NSLocalizedString(@"Query Background", @"query background label for color table (Prefs > Editor)"),
- NSLocalizedString(@"Selection", @"selection label for color table (Prefs > Editor)"),
- nil] retain];
+ NSLocalizedString(@"Selection", @"selection label for color table (Prefs > Editor)")
+ ] retain];
}
return self;
@@ -131,7 +131,7 @@ static NSString *SPCustomColorSchemeNameLC = @"user-defined";
{
NSSavePanel *panel = [NSSavePanel savePanel];
- [panel setAllowedFileTypes:[NSArray arrayWithObject:SPColorThemeFileExtension]];
+ [panel setAllowedFileTypes:@[SPColorThemeFileExtension]];
[panel setExtensionHidden:NO];
[panel setAllowsOtherFileTypes:NO];
@@ -209,7 +209,7 @@ static NSString *SPCustomColorSchemeNameLC = @"user-defined";
if (![fm fileExistsAtPath:selectedPath isDirectory:nil]) {
if ([fm copyItemAtPath:[NSString stringWithFormat:@"%@/%@.%@", themePath, [editThemeListItems objectAtIndex:[editThemeListTable selectedRow]], SPColorThemeFileExtension] toPath:selectedPath error:nil]) {
- if (editThemeListItems) [editThemeListItems release], editThemeListItems = nil;
+ if (editThemeListItems) SPClear(editThemeListItems);
editThemeListItems = [[NSArray arrayWithArray:[self _getAvailableThemes]] retain];
@@ -243,7 +243,7 @@ static NSString *SPCustomColorSchemeNameLC = @"user-defined";
[prefs setObject:SPCustomColorSchemeName forKey:SPCustomQueryEditorThemeName];
}
- if (editThemeListItems) [editThemeListItems release], editThemeListItems = nil;
+ if (editThemeListItems) SPClear(editThemeListItems);
editThemeListItems = [[NSArray arrayWithArray:[self _getAvailableThemes]] retain];
@@ -313,7 +313,7 @@ static NSString *SPCustomColorSchemeNameLC = @"user-defined";
{
[[NSColorPanel sharedColorPanel] close];
- if (editThemeListItems) [editThemeListItems release], editThemeListItems = nil;
+ if (editThemeListItems) SPClear(editThemeListItems);
editThemeListItems = [[NSArray arrayWithArray:[self _getAvailableThemes]] retain];
@@ -595,7 +595,7 @@ static NSString *SPCustomColorSchemeNameLC = @"user-defined";
}
// Reload everything needed
- if (editThemeListItems) [editThemeListItems release], editThemeListItems = nil;
+ if (editThemeListItems) SPClear(editThemeListItems);
editThemeListItems = [[NSArray arrayWithArray:[self _getAvailableThemes]] retain];
[editThemeListTable reloadData];
@@ -732,6 +732,14 @@ static NSString *SPCustomColorSchemeNameLC = @"user-defined";
return NO;
}
+- (void)preferencePaneWillBeShown
+{
+ [self updateColorSchemeSelectionMenu];
+ [self updateDisplayColorThemeName];
+
+ [self updateDisplayedEditorFontName];
+}
+
#pragma mark -
#pragma mark Private API
@@ -770,7 +778,7 @@ static NSString *SPCustomColorSchemeNameLC = @"user-defined";
if ([fm fileExistsAtPath:themePath isDirectory:nil]) {
NSArray *allItemsRaw = [fm contentsOfDirectoryAtPath:themePath error:NULL];
- if(!allItemsRaw) return [NSArray array];
+ if(!allItemsRaw) return @[];
// Filter out all themes
NSPredicate *predicate = [NSPredicate predicateWithFormat:@"SELF ENDSWITH %@", [NSString stringWithFormat:@".%@", SPColorThemeFileExtension]];
@@ -791,7 +799,7 @@ static NSString *SPCustomColorSchemeNameLC = @"user-defined";
return (NSArray *)allItems;
}
- return [NSArray array];
+ return @[];
}
- (void)_saveColorThemeAtPath:(NSString *)path
@@ -1021,10 +1029,10 @@ static NSString *SPCustomColorSchemeNameLC = @"user-defined";
*/
- (void)dealloc
{
- if (themePath) [themePath release], themePath = nil;
- if (editThemeListItems) [editThemeListItems release], editThemeListItems = nil;
- if (editorColors) [editorColors release], editorColors = nil;
- if (editorNameForColors) [editorNameForColors release], editorNameForColors = nil;
+ if (themePath) SPClear(themePath);
+ if (editThemeListItems) SPClear(editThemeListItems);
+ if (editorColors) SPClear(editorColors);
+ if (editorNameForColors) SPClear(editorNameForColors);
[super dealloc];
}