~ubuntu-branches/ubuntu/natty/monodevelop/natty

« back to all changes in this revision

Viewing changes to src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/SourceEditorOptions.cs

  • Committer: Bazaar Package Importer
  • Author(s): Jo Shields
  • Date: 2010-01-07 19:06:58 UTC
  • mto: (1.6.1 upstream)
  • mto: This revision was merged to the branch mainline in revision 46.
  • Revision ID: james.westby@ubuntu.com-20100107190658-z9z95lgk4kwfes7p
ImportĀ upstreamĀ versionĀ 2.2+dfsg

Show diffs side-by-side

added added

removed removed

Lines of Context:
94
94
                
95
95
                DefaultSourceEditorOptions (MonoDevelop.Ide.Gui.Content.TextStylePolicy currentPolicy)
96
96
                {
97
 
                        GetPreferences (this, EventArgs.Empty);
 
97
                        LoadAllPrefs ();
98
98
                        UpdateStylePolicy (currentPolicy);
99
 
                        PropertyService.PropertyChanged += GetPreferences;
 
99
                        PropertyService.PropertyChanged += UpdatePreferences;
100
100
                }
101
101
                
102
102
                public override void Dispose()
103
103
                {
104
 
                        PropertyService.PropertyChanged -= GetPreferences;
 
104
                        PropertyService.PropertyChanged -= UpdatePreferences;
105
105
                }
106
106
                
107
107
                void UpdateStylePolicy (MonoDevelop.Ide.Gui.Content.TextStylePolicy currentPolicy)
113
113
                        base.RemoveTrailingWhitespaces = currentPolicy.RemoveTrailingWhitespace; //PropertyService.Get ("RemoveTrailingWhitespaces", true);
114
114
                }
115
115
                
116
 
                void GetPreferences (object sender, EventArgs args)
117
 
                {
118
 
                        this.tabIsReindent         = PropertyService.Get ("TabIsReindent", false);
 
116
                // Need to be picky about only updating individual properties when they change.
 
117
                // The old approach called LoadAllPrefs on any prefs event, which sometimes caused 
 
118
                // massive change event storms.
 
119
                void UpdatePreferences (object sender, PropertyChangedEventArgs args)
 
120
                {
 
121
                        switch (args.Key) {
 
122
                        case "TabIsReindent": 
 
123
                                this.TabIsReindent = (bool) args.NewValue;
 
124
                                break;
 
125
                        case "EnableSemanticHighlighting":
 
126
                                this.EnableSemanticHighlighting = (bool) args.NewValue;
 
127
                                break;
 
128
                        case "AutoInsertMatchingBracket":
 
129
                                this.AutoInsertMatchingBracket = (bool) args.NewValue;
 
130
                                break;
 
131
                        case "EnableCodeCompletion":
 
132
                                this.EnableCodeCompletion = (bool) args.NewValue;
 
133
                                break;
 
134
                        case "EnableParameterInsight":
 
135
                                this.EnableParameterInsight = (bool) args.NewValue;
 
136
                                break;
 
137
                        case "EnableQuickFinder":
 
138
                                this.EnableQuickFinder = (bool) args.NewValue;
 
139
                                break;
 
140
                        case "UnderlineErrors":
 
141
                                this.UnderlineErrors = (bool) args.NewValue;
 
142
                                break;
 
143
                        case "IndentStyle":
 
144
                                this.IndentStyle = (MonoDevelop.Ide.Gui.Content.IndentStyle) args.NewValue;
 
145
                                break;
 
146
                        case "EditorFontType":
 
147
                                this.EditorFontType = (MonoDevelop.SourceEditor.EditorFontType) args.NewValue;
 
148
                                break;
 
149
                        case "ShowLineNumberMargin":
 
150
                                base.ShowLineNumberMargin = (bool) args.NewValue;
 
151
                                break;
 
152
                        case "ShowFoldMargin":
 
153
                                base.ShowFoldMargin = (bool) args.NewValue;
 
154
                                break;
 
155
                        case "ShowInvalidLines":
 
156
                                base.ShowInvalidLines = (bool) args.NewValue;
 
157
                                break;
 
158
                        case "ShowTabs":
 
159
                                base.ShowTabs = (bool) args.NewValue;
 
160
                                break;
 
161
                        case "ShowEolMarkers":
 
162
                                base.ShowEolMarkers = (bool) args.NewValue;
 
163
                                break;
 
164
                        case "HighlightCaretLine":
 
165
                                base.HighlightCaretLine = (bool) args.NewValue;
 
166
                                break;
 
167
                        case "ShowSpaces":
 
168
                                base.ShowSpaces = (bool) args.NewValue;
 
169
                                break;
 
170
                        case "EnableSyntaxHighlighting":
 
171
                                base.EnableSyntaxHighlighting = (bool) args.NewValue;
 
172
                                break;
 
173
                        case "HighlightMatchingBracket":
 
174
                                base.HighlightMatchingBracket = (bool) args.NewValue;
 
175
                                break;
 
176
                        case "ShowRuler":
 
177
                                base.ShowRuler = (bool) args.NewValue;
 
178
                                break;
 
179
                        case "FontName":
 
180
                                base.FontName = (string) args.NewValue;
 
181
                                break;
 
182
                        case "ColorScheme":
 
183
                                base.ColorScheme = (string) args.NewValue;
 
184
                                break;
 
185
                        case "DefaultRegionsFolding":
 
186
                                this.DefaultRegionsFolding = (bool) args.NewValue;
 
187
                                break;
 
188
                        case "DefaultCommentFolding":
 
189
                                this.DefaultCommentFolding = (bool) args.NewValue;
 
190
                                break;
 
191
                        case "UseViModes":
 
192
                                this.UseViModes = (bool) args.NewValue;
 
193
                                break;
 
194
                        case "OnTheFlyFormatting":
 
195
                                this.OnTheFlyFormatting = (bool) args.NewValue;
 
196
                                break;
 
197
                        case "EnableAutoCodeCompletion":
 
198
                                this.EnableAutoCodeCompletion = (bool) args.NewValue;
 
199
                                break;
 
200
                        case "CompleteWithSpaceOrPunctuation":
 
201
                                this.CompleteWithSpaceOrPunctuation = (bool) args.NewValue;
 
202
                                break;
 
203
                        case "ControlLeftRightMode":
 
204
                                this.ControlLeftRightMode = (ControlLeftRightMode)Enum.Parse (typeof(ControlLeftRightMode), (string) args.NewValue);
 
205
                                break;
 
206
                        case "EnableAnimations":
 
207
                                base.EnableAnimations =  (bool) args.NewValue;
 
208
                                break;
 
209
                        }
 
210
                }
 
211
                
 
212
                void LoadAllPrefs ()
 
213
                {
 
214
                        this.tabIsReindent = PropertyService.Get ("TabIsReindent", false);
119
215
                        this.enableSemanticHighlighting = PropertyService.Get ("EnableSemanticHighlighting", false);
120
 
//                      this.autoInsertTemplates        = PropertyService.Get ("AutoInsertTemplates", false);
121
 
                        this.autoInsertMatchingBracket  = PropertyService.Get ("AutoInsertMatchingBracket", false);
122
 
                        this.enableCodeCompletion       = PropertyService.Get ("EnableCodeCompletion", true);
123
 
                        this.enableQuickFinder          = PropertyService.Get ("EnableQuickFinder", true);
124
 
                        this.underlineErrors            = PropertyService.Get ("UnderlineErrors", true);
125
 
                        this.indentStyle                = PropertyService.Get ("IndentStyle", MonoDevelop.Ide.Gui.Content.IndentStyle.Smart);
126
 
                        this.editorFontType             = PropertyService.Get ("EditorFontType", MonoDevelop.SourceEditor.EditorFontType.DefaultMonospace);
127
 
                        base.ShowLineNumberMargin  = PropertyService.Get ("ShowLineNumberMargin", true);
128
 
                        base.ShowFoldMargin        = PropertyService.Get ("ShowFoldMargin", true);
129
 
                        base.ShowInvalidLines      = PropertyService.Get ("ShowInvalidLines", true);
130
 
                        base.ShowTabs              = PropertyService.Get ("ShowTabs", false);
131
 
                        base.ShowEolMarkers        = PropertyService.Get ("ShowEolMarkers", false);
132
 
                        base.HighlightCaretLine    = PropertyService.Get ("HighlightCaretLine", false);
133
 
                        base.ShowSpaces            = PropertyService.Get ("ShowSpaces", false);
 
216
                        //                      this.autoInsertTemplates        = PropertyService.Get ("AutoInsertTemplates", false);
 
217
                        this.autoInsertMatchingBracket = PropertyService.Get ("AutoInsertMatchingBracket", false);
 
218
                        this.enableCodeCompletion = PropertyService.Get ("EnableCodeCompletion", true);
 
219
                        this.enableParameterInsight = PropertyService.Get ("EnableParameterInsight", true);
 
220
                        this.enableQuickFinder = PropertyService.Get ("EnableQuickFinder", true);
 
221
                        this.underlineErrors = PropertyService.Get ("UnderlineErrors", true);
 
222
                        this.indentStyle = PropertyService.Get ("IndentStyle", MonoDevelop.Ide.Gui.Content.IndentStyle.Smart);
 
223
                        this.editorFontType = PropertyService.Get ("EditorFontType", MonoDevelop.SourceEditor.EditorFontType.DefaultMonospace);
 
224
                        base.ShowLineNumberMargin = PropertyService.Get ("ShowLineNumberMargin", true);
 
225
                        base.ShowFoldMargin = PropertyService.Get ("ShowFoldMargin", true);
 
226
                        base.ShowInvalidLines = PropertyService.Get ("ShowInvalidLines", true);
 
227
                        base.ShowTabs = PropertyService.Get ("ShowTabs", false);
 
228
                        base.ShowEolMarkers = PropertyService.Get ("ShowEolMarkers", false);
 
229
                        base.HighlightCaretLine = PropertyService.Get ("HighlightCaretLine", false);
 
230
                        base.ShowSpaces = PropertyService.Get ("ShowSpaces", false);
134
231
                        base.EnableSyntaxHighlighting = PropertyService.Get ("EnableSyntaxHighlighting", true);
135
232
                        base.HighlightMatchingBracket = PropertyService.Get ("HighlightMatchingBracket", true);
136
 
                        base.ShowRuler                = PropertyService.Get ("ShowRuler", false);
137
 
                        base.FontName                 = PropertyService.Get ("FontName", "Mono 10");
138
 
                        base.ColorScheme               =  PropertyService.Get ("ColorScheme", "Default");
139
 
                        this.defaultRegionsFolding      =  PropertyService.Get ("DefaultRegionsFolding", false);
140
 
                        this.defaultCommentFolding      =  PropertyService.Get ("DefaultCommentFolding", true);
 
233
                        base.ShowRuler = PropertyService.Get ("ShowRuler", false);
 
234
                        base.FontName = PropertyService.Get ("FontName", "Mono 10");
 
235
                        base.ColorScheme = PropertyService.Get ("ColorScheme", "Default");
 
236
                        this.defaultRegionsFolding = PropertyService.Get ("DefaultRegionsFolding", false);
 
237
                        this.defaultCommentFolding = PropertyService.Get ("DefaultCommentFolding", true);
141
238
                        this.useViModes = PropertyService.Get ("UseViModes", false);
142
239
                        this.onTheFlyFormatting = PropertyService.Get ("OnTheFlyFormatting", false);
143
240
                        this.enableAutoCodeCompletion = PropertyService.Get ("EnableAutoCodeCompletion", true);
144
241
                        this.completeWithSpaceOrPunctuation = PropertyService.Get ("CompleteWithSpaceOrPunctuation", true);
145
 
                        this.ControlLeftRightMode =  (ControlLeftRightMode)Enum.Parse (typeof (ControlLeftRightMode), PropertyService.Get ("ControlLeftRightMode", DesktopService.DefaultControlLeftRightBehavior));
 
242
                        this.ControlLeftRightMode = (ControlLeftRightMode)Enum.Parse (typeof(ControlLeftRightMode), PropertyService.Get ("ControlLeftRightMode", DesktopService.DefaultControlLeftRightBehavior));
 
243
                        base.EnableAnimations = PropertyService.Get ("EnableAnimations", true);
146
244
                }
147
245
                
148
246
                #region new options
258
356
                
259
357
                bool enableCodeCompletion;
260
358
                public bool EnableCodeCompletion {
261
 
                        get {
262
 
                                return enableCodeCompletion;
263
 
                        }
 
359
                        get { return enableCodeCompletion; }
264
360
                        set {
265
361
                                if (value != this.enableCodeCompletion) {
266
362
                                        this.enableCodeCompletion = value;
270
366
                        }
271
367
                }
272
368
                
 
369
                bool enableParameterInsight;
 
370
                public bool EnableParameterInsight {
 
371
                        get { return enableParameterInsight; }
 
372
                        set {
 
373
                                if (value != this.enableParameterInsight) {
 
374
                                        this.enableParameterInsight = value;
 
375
                                        PropertyService.Set ("EnableParameterInsight", value);
 
376
                                        OnChanged (EventArgs.Empty);
 
377
                                }
 
378
                        }
 
379
                }
 
380
                
273
381
                bool enableQuickFinder;
274
382
                public bool EnableQuickFinder {
275
383
                        get {
367
475
                                        controlLeftRightMode = value;
368
476
                                        PropertyService.Set ("ControlLeftRightMode", value.ToString ());
369
477
                                        SetWordFindStrategy ();
 
478
                                        OnChanged (EventArgs.Empty);
370
479
                                }
371
480
                        }
372
481
                }
405
514
 
406
515
                public override bool AllowTabsAfterNonTabs {
407
516
                        set {
408
 
                                PropertyService.Set ("AllowTabsAfterNonTabs", value);
409
 
                                base.AllowTabsAfterNonTabs = value;
 
517
                                if (value != AllowTabsAfterNonTabs) {
 
518
                                        PropertyService.Set ("AllowTabsAfterNonTabs", value);
 
519
                                        base.AllowTabsAfterNonTabs = value;
 
520
                                }
410
521
                        }
411
522
                }
412
523
                                
517
628
                                base.ShowRuler = value;
518
629
                        }
519
630
                }
 
631
                
 
632
                public override bool EnableAnimations {
 
633
                        set {
 
634
                                PropertyService.Set ("EnableAnimations", value);
 
635
                                base.EnableAnimations = value;
 
636
                        }
 
637
                }
520
638
 
521
639
                public override bool AutoIndent {
522
640
                        get {