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]; editThemeListItems = [[NSArray arrayWithArray:[self _getAvailableThemes]] retain];


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


editorNameForColors = editorNameForColors = [@[
[@[ NSLocalizedString(@"Text", @"text label for color table (Prefs > Editor)"),
NSLocalizedString(@"Text", @"text label for color table (Prefs > Editor)"), NSLocalizedString(@"Background", @"background 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(@"Caret", @"caret label for color table (Prefs > Editor)"), NSLocalizedString(@"Comment", @"comment label"),
NSLocalizedString(@"Comment", @"comment label"), NSLocalizedString(@"Keyword", @"keyword label for color table (Prefs > Editor)"),
NSLocalizedString(@"Keyword", @"keyword label for color table (Prefs > Editor)"), NSLocalizedString(@"Numeric", @"numeric 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(@"Quote", @"quote label for color table (Prefs > Editor)"), NSLocalizedString(@"Backtick Quote", @"backtick 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(@"Variable", @"variable label for color table (Prefs > Editor)"), NSLocalizedString(@"Query Background", @"query background 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)")
NSLocalizedString(@"Selection", @"selection label for color table (Prefs > Editor)")
] retain]; ] retain];
} }


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


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


} }


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


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


#pragma mark - #pragma mark -
Expand All @@ -352,7 +350,9 @@ - (void)updateDisplayedEditorFontName
*/ */
- (void)updateColorSchemeSelectionMenu - (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]; [defaultItem setTarget:self];


Expand Down Expand Up @@ -380,7 +380,9 @@ - (void)updateColorSchemeSelectionMenu
[themeSelectionMenu addItem:[NSMenuItem separatorItem]]; [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]; [editItem setTarget:self];


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


if (![fm fileExistsAtPath:themePath isDirectory:nil]) { 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(); NSBeep();
return; return;
} }
Expand Down Expand Up @@ -781,9 +785,13 @@ - (NSArray *)_getAvailableThemes
NSFileManager *fm = [NSFileManager defaultManager]; NSFileManager *fm = [NSFileManager defaultManager];


if ([fm fileExistsAtPath:themePath isDirectory:nil]) { 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 // Filter out all themes
NSPredicate *predicate = [NSPredicate predicateWithFormat:@"SELF ENDSWITH %@", [NSString stringWithFormat:@".%@", SPColorThemeFileExtension]]; NSPredicate *predicate = [NSPredicate predicateWithFormat:@"SELF ENDSWITH %@", [NSString stringWithFormat:@".%@", SPColorThemeFileExtension]];
Expand Down Expand Up @@ -897,16 +905,16 @@ - (void)_saveColorThemeAtPath:(NSString *)path


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


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


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


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


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


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


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

0 comments on commit c31bc03

Please sign in to comment.