Skip to content

Commit

Permalink
Restore a tiny bit of the indentation Xcode just hosed
Browse files Browse the repository at this point in the history
  • Loading branch information
dmoagx committed Jan 13, 2018
1 parent f44727d commit c31bc03
Showing 1 changed file with 61 additions and 53 deletions.
114 changes: 61 additions & 53 deletions Source/SPEditorPreferencePane.m
Expand Up @@ -66,34 +66,32 @@ - (id)init

editThemeListItems = [[NSArray arrayWithArray:[self _getAvailableThemes]] retain];

editorColors =
[@[
SPCustomQueryEditorTextColor,
SPCustomQueryEditorBackgroundColor,
SPCustomQueryEditorCaretColor,
SPCustomQueryEditorCommentColor,
SPCustomQueryEditorSQLKeywordColor,
SPCustomQueryEditorNumericColor,
SPCustomQueryEditorQuoteColor,
SPCustomQueryEditorBacktickColor,
SPCustomQueryEditorVariableColor,
SPCustomQueryEditorHighlightQueryColor,
SPCustomQueryEditorSelectionColor
editorColors = [@[
SPCustomQueryEditorTextColor,
SPCustomQueryEditorBackgroundColor,
SPCustomQueryEditorCaretColor,
SPCustomQueryEditorCommentColor,
SPCustomQueryEditorSQLKeywordColor,
SPCustomQueryEditorNumericColor,
SPCustomQueryEditorQuoteColor,
SPCustomQueryEditorBacktickColor,
SPCustomQueryEditorVariableColor,
SPCustomQueryEditorHighlightQueryColor,
SPCustomQueryEditorSelectionColor
] retain];

editorNameForColors =
[@[
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)"),
NSLocalizedString(@"Comment", @"comment label"),
NSLocalizedString(@"Keyword", @"keyword label for color table (Prefs > Editor)"),
NSLocalizedString(@"Numeric", @"numeric label for color table (Prefs > Editor)"),
NSLocalizedString(@"Quote", @"quote label for color table (Prefs > Editor)"),
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)")
editorNameForColors = [@[
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)"),
NSLocalizedString(@"Comment", @"comment label"),
NSLocalizedString(@"Keyword", @"keyword label for color table (Prefs > Editor)"),
NSLocalizedString(@"Numeric", @"numeric label for color table (Prefs > Editor)"),
NSLocalizedString(@"Quote", @"quote label for color table (Prefs > Editor)"),
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)")
] retain];
}

Expand Down Expand Up @@ -193,9 +191,9 @@ - (IBAction)saveAsColorScheme:(id)sender

[NSApp beginSheet:enterNameWindow
modalForWindow:[[self view] window]
modalDelegate:self
modalDelegate:self
didEndSelector:@selector(sheetDidEnd:returnCode:contextInfo:)
contextInfo:SPSaveColorScheme];
contextInfo:SPSaveColorScheme];

}

Expand Down Expand Up @@ -327,9 +325,9 @@ - (IBAction)editThemeList:(id)sender

[NSApp beginSheet:editThemeListWindow
modalForWindow:[[self view] window]
modalDelegate:self
modalDelegate:self
didEndSelector:nil
contextInfo:nil];
contextInfo:nil];
}

#pragma mark -
Expand All @@ -352,7 +350,9 @@ - (void)updateDisplayedEditorFontName
*/
- (void)updateColorSchemeSelectionMenu
{
NSMenuItem *defaultItem = [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"Default", @"default label") action:@selector(setDefaultColors:) keyEquivalent:@""];
NSMenuItem *defaultItem = [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"Default", @"default label")
action:@selector(setDefaultColors:)
keyEquivalent:@""];

[defaultItem setTarget:self];

Expand Down Expand Up @@ -380,7 +380,9 @@ - (void)updateColorSchemeSelectionMenu
[themeSelectionMenu addItem:[NSMenuItem separatorItem]];
}

NSMenuItem *editItem = [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"Edit Theme List…", @"edit theme list label") action:@selector(editThemeList:) keyEquivalent:@""];
NSMenuItem *editItem = [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"Edit Theme List…", @"edit theme list label")
action:@selector(editThemeList:)
keyEquivalent:@""];

[editItem setTarget:self];

Expand Down Expand Up @@ -519,7 +521,9 @@ - (void)sheetDidEnd:(id)sheet returnCode:(NSInteger)returnCode contextInfo:(NSSt
NSFileManager *fm = [NSFileManager defaultManager];

if (![fm fileExistsAtPath:themePath isDirectory:nil]) {
if (![fm createDirectoryAtPath:themePath withIntermediateDirectories:YES attributes:nil error:nil]) {
NSError *error = nil;
if (![fm createDirectoryAtPath:themePath withIntermediateDirectories:YES attributes:nil error:&error]) {
SPLog(@"Failed to create directory '%@'. error=%@", themePath, error);
NSBeep();
return;
}
Expand Down Expand Up @@ -781,9 +785,13 @@ - (NSArray *)_getAvailableThemes
NSFileManager *fm = [NSFileManager defaultManager];

if ([fm fileExistsAtPath:themePath isDirectory:nil]) {
NSArray *allItemsRaw = [fm contentsOfDirectoryAtPath:themePath error:NULL];
NSError *error = nil;
NSArray *allItemsRaw = [fm contentsOfDirectoryAtPath:themePath error:&error];

if(!allItemsRaw) return @[];
if(!allItemsRaw || error) {
SPLog(@"Failed to list contents of path '%@'. error=%@", themePath, error);
return @[];
}

// Filter out all themes
NSPredicate *predicate = [NSPredicate predicateWithFormat:@"SELF ENDSWITH %@", [NSString stringWithFormat:@".%@", SPColorThemeFileExtension]];
Expand Down Expand Up @@ -897,16 +905,16 @@ - (void)_saveColorThemeAtPath:(NSString *)path

NSError *error = nil;
NSData *plist = [NSPropertyListSerialization dataWithPropertyList:scheme
format:NSPropertyListXMLFormat_v1_0
options:0
error:&error];
format:NSPropertyListXMLFormat_v1_0
options:0
error:&error];

if(error) {
NSAlert *alert = [NSAlert alertWithMessageText:NSLocalizedString(@"Error while converting color scheme data", @"error while converting color scheme data")
defaultButton:NSLocalizedString(@"OK", @"OK button")
alternateButton:nil
otherButton:nil
informativeTextWithFormat:@"%@", [error localizedDescription]];
defaultButton:NSLocalizedString(@"OK", @"OK button")
alternateButton:nil
otherButton:nil
informativeTextWithFormat:@"%@", [error localizedDescription]];

[alert setAlertStyle:NSCriticalAlertStyle];
[alert runModal];
Expand All @@ -929,17 +937,17 @@ - (BOOL)_loadColorSchemeFromFile:(NSString *)filename

if(pData && !error) {
theme = [NSPropertyListSerialization propertyListWithData:pData
options:NSPropertyListImmutable
format:NULL
error:&error];
options:NSPropertyListImmutable
format:NULL
error:&error];
}

if (!theme || error) {
NSAlert *alert = [NSAlert alertWithMessageText:[NSString stringWithFormat:NSLocalizedString(@"Error while reading data file", @"error while reading data file")]
defaultButton:NSLocalizedString(@"OK", @"OK button")
alternateButton:nil
otherButton:nil
informativeTextWithFormat:NSLocalizedString(@"File couldn't be read. (%@)", @"error while reading data file"), [error localizedDescription]];
defaultButton:NSLocalizedString(@"OK", @"OK button")
alternateButton:nil
otherButton:nil
informativeTextWithFormat:NSLocalizedString(@"File couldn't be read. (%@)", @"error while reading data file"), [error localizedDescription]];

[alert setAlertStyle:NSCriticalAlertStyle];
[alert runModal];
Expand Down Expand Up @@ -1044,10 +1052,10 @@ - (BOOL)_loadColorSchemeFromFile:(NSString *)filename
}
else {
NSAlert *alert = [NSAlert alertWithMessageText:[NSString stringWithFormat:NSLocalizedString(@"Error while reading data file", @"error while reading data file")]
defaultButton:NSLocalizedString(@"OK", @"OK button")
alternateButton:nil
otherButton:nil
informativeTextWithFormat:NSLocalizedString(@"No color theme data found.", @"error that no color theme found")];
defaultButton:NSLocalizedString(@"OK", @"OK button")
alternateButton:nil
otherButton:nil
informativeTextWithFormat:NSLocalizedString(@"No color theme data found.", @"error that no color theme found")];

[alert setAlertStyle:NSInformationalAlertStyle];
[alert runModal];
Expand Down

0 comments on commit c31bc03

Please sign in to comment.