forked from KosmicTask/Fragaria
-
Notifications
You must be signed in to change notification settings - Fork 0
/
MGSPreferencesController.m
164 lines (137 loc) · 9.83 KB
/
MGSPreferencesController.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
//
// MGSPreferencesController.m
// KosmicEditor
//
// Created by Jonathan on 30/04/2010.
// Copyright 2010 mugginsoft.com. All rights reserved.
//
#import "MGSFragariaFramework.h"
// colour prefs
// [NSArchiver archivedDataWithRootObject:[NSColor whiteColor]]
NSString * const MGSPrefsCommandsColourWell = @"CommandsColourWell";
NSString * const MGSPrefsCommentsColourWell = @"CommentsColourWell";
NSString * const MGSPrefsInstructionsColourWell = @"InstructionsColourWell";
NSString * const MGSPrefsKeywordsColourWell = @"KeywordsColourWell";
NSString * const MGSPrefsAutocompleteColourWell = @"AutocompleteColourWell";
NSString * const MGSPrefsVariablesColourWell = @"VariablesColourWell";
NSString * const MGSPrefsStringsColourWell = @"StringsColourWell";
NSString * const MGSPrefsAttributesColourWell = @"AttributesColourWell";
NSString * const MGSPrefsBackgroundColourWell = @"BackgroundColourWell";
NSString * const MGSPrefsTextColourWell = @"TextColourWell";
NSString * const MGSPrefsGutterTextColourWell = @"GutterTextColourWell";
NSString * const MGSPrefsInvisibleCharactersColourWell = @"InvisibleCharactersColourWell";
NSString * const MGSPrefsHighlightLineColourWell = @"HighlightLineColourWell";
// bool
NSString * const MGSPrefsColourCommands = @"ColourCommands";
NSString * const MGSPrefsColourComments = @"ColourComments";
NSString * const MGSPrefsColourInstructions = @"ColourInstructions";
NSString * const MGSPrefsColourKeywords = @"ColourKeywords";
NSString * const MGSPrefsColourAutocomplete = @"ColourAutocomplete";
NSString * const MGSPrefsColourVariables = @"ColourVariables";
NSString * const MGSPrefsColourStrings = @"ColourStrings";
NSString * const MGSPrefsColourAttributes = @"ColourAttributes";
NSString * const MGSPrefsLiveUpdatePreview = @"LiveUpdatePreview";
NSString * const MGSPrefsShowFullPathInWindowTitle = @"ShowFullPathInWindowTitle";
NSString * const MGSPrefsShowLineNumberGutter = @"ShowLineNumberGutter";
NSString * const MGSPrefsSyntaxColourNewDocuments = @"SyntaxColourNewDocuments";
NSString * const MGSPrefsLineWrapNewDocuments = @"LineWrapNewDocuments";
NSString * const MGSPrefsIndentNewLinesAutomatically = @"IndentNewLinesAutomatically";
NSString * const MGSPrefsOnlyColourTillTheEndOfLine = @"OnlyColourTillTheEndOfLine";
NSString * const MGSPrefsShowMatchingBraces = @"ShowMatchingBraces";
NSString * const MGSPrefsShowInvisibleCharacters = @"ShowInvisibleCharacters";
NSString * const MGSPrefsIndentWithSpaces = @"IndentWithSpaces";
NSString * const MGSPrefsColourMultiLineStrings = @"ColourMultiLineStrings";
NSString * const MGSPrefsAutocompleteSuggestAutomatically = @"AutocompleteSuggestAutomatically";
NSString * const MGSPrefsAutocompleteIncludeStandardWords = @"AutocompleteIncludeStandardWords";
NSString * const MGSPrefsAutoSpellCheck = @"AutoSpellCheck";
NSString * const MGSPrefsAutoGrammarCheck = @"AutoGrammarCheck";
NSString * const MGSPrefsSmartInsertDelete = @"SmartInsertDelete";
NSString * const MGSPrefsAutomaticLinkDetection = @"AutomaticLinkDetection";
NSString * const MGSPrefsAutomaticQuoteSubstitution = @"AutomaticQuoteSubstitution";
NSString * const MGSPrefsUseTabStops = @"UseTabStops";
NSString * const MGSPrefsHighlightCurrentLine = @"HighlightCurrentLine";
NSString * const MGSPrefsAutomaticallyIndentBraces = @"AutomaticallyIndentBraces";
NSString * const MGSPrefsAutoInsertAClosingParenthesis = @"AutoInsertAClosingParenthesis";
NSString * const MGSPrefsAutoInsertAClosingBrace = @"AutoInsertAClosingBrace";
// integer
NSString * const MGSPrefsGutterWidth = @"GutterWidth";
NSString * const MGSPrefsTabWidth = @"TabWidth";
NSString * const MGSPrefsIndentWidth = @"IndentWidth";
NSString * const MGSPrefsShowPageGuideAtColumn = @"ShowPageGuideAtColumn";
// float
NSString * const MGSPrefsAutocompleteAfterDelay = @"AutocompleteAfterDelay";
NSString * const MGSPrefsLiveUpdatePreviewDelay = @"LiveUpdatePreviewDelay";
// font
// [NSArchiver archivedDataWithRootObject:[NSFont fontWithName:@"Menlo" size:11]]
NSString * const MGSPrefsTextFont = @"TextFont";
// string
NSString * const MGSPrefsSyntaxColouringPopUpString = @"SyntaxColouringPopUpString";
static BOOL MGS_preferencesInitialized = NO;
@implementation MGSPreferencesController
/*
- initializeValues
*/
+ (void)initializeValues
{
if (MGS_preferencesInitialized) {
return;
}
NSMutableDictionary *dictionary = [NSMutableDictionary dictionary];
[dictionary setValue:[NSArchiver archivedDataWithRootObject:[NSColor colorWithCalibratedRed:0.031f green:0.0f blue:0.855f alpha:1.0f]] forKey:@"CommandsColourWell"];
[dictionary setValue:[NSArchiver archivedDataWithRootObject:[NSColor colorWithCalibratedRed:0.0f green:0.45f blue:0.0f alpha:1.0f]] forKey:@"CommentsColourWell"];
[dictionary setValue:[NSArchiver archivedDataWithRootObject:[NSColor colorWithCalibratedRed:0.45f green:0.45f blue:0.45f alpha:1.0f]] forKey:@"InstructionsColourWell"];
[dictionary setValue:[NSArchiver archivedDataWithRootObject:[NSColor colorWithCalibratedRed:0.737f green:0.0f blue:0.647f alpha:1.0f]] forKey:@"KeywordsColourWell"];
[dictionary setValue:[NSArchiver archivedDataWithRootObject:[NSColor colorWithCalibratedRed:0.84f green:0.41f blue:0.006f alpha:1.0f]] forKey:@"AutocompleteColourWell"];
[dictionary setValue:[NSArchiver archivedDataWithRootObject:[NSColor colorWithCalibratedRed:0.73f green:0.0f blue:0.74f alpha:1.0f]] forKey:@"VariablesColourWell"];
[dictionary setValue:[NSArchiver archivedDataWithRootObject:[NSColor colorWithCalibratedRed:0.804f green:0.071f blue:0.153f alpha:1.0f]] forKey:@"StringsColourWell"];
[dictionary setValue:[NSArchiver archivedDataWithRootObject:[NSColor colorWithCalibratedRed:0.50f green:0.5f blue:0.2f alpha:1.0f]] forKey:@"AttributesColourWell"];
[dictionary setValue:[NSNumber numberWithBool:YES] forKey:@"ColourCommands"];
[dictionary setValue:[NSNumber numberWithBool:YES] forKey:@"ColourComments"];
[dictionary setValue:[NSNumber numberWithBool:YES] forKey:@"ColourInstructions"];
[dictionary setValue:[NSNumber numberWithBool:YES] forKey:@"ColourKeywords"];
[dictionary setValue:[NSNumber numberWithBool:NO] forKey:@"ColourAutocomplete"];
[dictionary setValue:[NSNumber numberWithBool:YES] forKey:@"ColourVariables"];
[dictionary setValue:[NSNumber numberWithBool:YES] forKey:@"ColourStrings"];
[dictionary setValue:[NSNumber numberWithBool:YES] forKey:@"ColourAttributes"];
[dictionary setValue:[NSArchiver archivedDataWithRootObject:[NSColor whiteColor]] forKey:@"BackgroundColourWell"];
[dictionary setValue:[NSArchiver archivedDataWithRootObject:[NSColor textColor]] forKey:@"TextColourWell"];
[dictionary setValue:[NSArchiver archivedDataWithRootObject:[NSColor colorWithCalibratedWhite:0.42f alpha:1.0f]] forKey:@"GutterTextColourWell"];
[dictionary setValue:[NSArchiver archivedDataWithRootObject:[NSColor blackColor]] forKey:@"InvisibleCharactersColourWell"];
[dictionary setValue:[NSArchiver archivedDataWithRootObject:[NSColor colorWithCalibratedRed:0.96f green:0.96f blue:0.71f alpha:1.0f]] forKey:@"HighlightLineColourWell"];
[dictionary setValue:[NSNumber numberWithInteger:40] forKey:@"GutterWidth"];
[dictionary setValue:[NSNumber numberWithInteger:4] forKey:@"TabWidth"];
[dictionary setValue:[NSNumber numberWithInteger:4] forKey:@"IndentWidth"];
[dictionary setValue:[NSNumber numberWithInteger:80] forKey:@"ShowPageGuideAtColumn"];
[dictionary setValue:[NSNumber numberWithFloat:1.0f] forKey:@"AutocompleteAfterDelay"];
[dictionary setValue:[NSArchiver archivedDataWithRootObject:[NSFont fontWithName:@"Menlo" size:11]] forKey:@"TextFont"];
[dictionary setValue:[NSNumber numberWithBool:YES] forKey:@"ShowFullPathInWindowTitle"];
[dictionary setValue:[NSNumber numberWithBool:YES] forKey:@"ShowLineNumberGutter"];
[dictionary setValue:[NSNumber numberWithBool:YES] forKey:@"SyntaxColourNewDocuments"];
[dictionary setValue:[NSNumber numberWithBool:YES] forKey:@"LineWrapNewDocuments"];
[dictionary setValue:[NSNumber numberWithBool:YES] forKey:@"IndentNewLinesAutomatically"];
[dictionary setValue:[NSNumber numberWithBool:YES] forKey:@"OnlyColourTillTheEndOfLine"];
[dictionary setValue:[NSNumber numberWithBool:YES] forKey:@"ShowMatchingBraces"];
[dictionary setValue:[NSNumber numberWithBool:NO] forKey:MGSPrefsShowInvisibleCharacters];
[dictionary setValue:[NSNumber numberWithBool:NO] forKey:@"IndentWithSpaces"];
[dictionary setValue:[NSNumber numberWithBool:NO] forKey:@"ColourMultiLineStrings"];
[dictionary setValue:[NSNumber numberWithBool:NO] forKey:@"AutocompleteSuggestAutomatically"];
[dictionary setValue:[NSNumber numberWithBool:NO] forKey:@"AutocompleteIncludeStandardWords"];
[dictionary setValue:[NSNumber numberWithBool:NO] forKey:@"AutoSpellCheck"];
[dictionary setValue:[NSNumber numberWithBool:NO] forKey:@"AutoGrammarCheck"];
[dictionary setValue:[NSNumber numberWithBool:NO] forKey:@"SmartInsertDelete"];
[dictionary setValue:[NSNumber numberWithBool:YES] forKey:@"AutomaticLinkDetection"];
[dictionary setValue:[NSNumber numberWithBool:NO] forKey:@"AutomaticQuoteSubstitution"];
[dictionary setValue:[NSNumber numberWithBool:YES] forKey:@"UseTabStops"];
[dictionary setValue:[NSNumber numberWithBool:NO] forKey:@"HighlightCurrentLine"];
[dictionary setValue:[NSNumber numberWithInteger:4] forKey:@"SpacesPerTabEntabDetab"];
[dictionary setValue:[NSNumber numberWithBool:YES] forKey:@"AutomaticallyIndentBraces"];
[dictionary setValue:[NSNumber numberWithBool:NO] forKey:@"AutoInsertAClosingParenthesis"];
[dictionary setValue:[NSNumber numberWithBool:NO] forKey:@"AutoInsertAClosingBrace"];
[dictionary setValue:@"Standard" forKey:@"SyntaxColouringPopUpString"];
[dictionary setValue:[NSNumber numberWithBool:NO] forKey:@"LiveUpdatePreview"];
[dictionary setValue:[NSNumber numberWithFloat:1.0f] forKey:@"LiveUpdatePreviewDelay"];
NSUserDefaultsController *defaultsController = [NSUserDefaultsController sharedUserDefaultsController];
[defaultsController setInitialValues:dictionary];
MGS_preferencesInitialized = YES;
}
@end