PageRenderTime 26ms CodeModel.GetById 13ms app.highlight 9ms RepoModel.GetById 2ms app.codeStats 0ms

/ILSpy/Options/DisplaySettings.cs

http://github.com/icsharpcode/ILSpy
C# | 269 lines | 211 code | 38 blank | 20 comment | 32 complexity | 77a845ab066b0b213143faebf2255ac4 MD5 | raw file
  1// Copyright (c) 2011 AlphaSierraPapa for the SharpDevelop Team
  2// 
  3// Permission is hereby granted, free of charge, to any person obtaining a copy of this
  4// software and associated documentation files (the "Software"), to deal in the Software
  5// without restriction, including without limitation the rights to use, copy, modify, merge,
  6// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
  7// to whom the Software is furnished to do so, subject to the following conditions:
  8// 
  9// The above copyright notice and this permission notice shall be included in all copies or
 10// substantial portions of the Software.
 11// 
 12// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
 13// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
 14// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
 15// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
 16// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
 17// DEALINGS IN THE SOFTWARE.
 18
 19using System.ComponentModel;
 20using System.Runtime.CompilerServices;
 21using System.Windows.Media;
 22
 23namespace ICSharpCode.ILSpy.Options
 24{
 25	/// <summary>
 26	/// Description of DisplaySettings.
 27	/// </summary>
 28	public class DisplaySettings : INotifyPropertyChanged
 29	{
 30		public DisplaySettings()
 31		{
 32			this.selectedFont = new FontFamily("Consolas");
 33			this.selectedFontSize = 10.0 * 4 / 3;
 34			this.sortResults = true;
 35			this.indentationUseTabs = true;
 36			this.indentationSize = 4;
 37			this.indentationTabSize = 4;
 38			this.highlightMatchingBraces = true;
 39		}
 40		
 41		#region INotifyPropertyChanged implementation
 42		public event PropertyChangedEventHandler PropertyChanged;
 43		
 44		protected virtual void OnPropertyChanged(PropertyChangedEventArgs e)
 45		{
 46			PropertyChanged?.Invoke(this, e);
 47		}
 48		
 49		protected void OnPropertyChanged([CallerMemberName] string propertyName = null)
 50		{
 51			OnPropertyChanged(new PropertyChangedEventArgs(propertyName));
 52		}
 53		#endregion
 54		
 55		FontFamily selectedFont;
 56		
 57		public FontFamily SelectedFont {
 58			get { return selectedFont; }
 59			set {
 60				if (selectedFont != value) {
 61					selectedFont = value;
 62					OnPropertyChanged();
 63				}
 64			}
 65		}
 66		
 67		double selectedFontSize;
 68		
 69		public double SelectedFontSize {
 70			get { return selectedFontSize; }
 71			set {
 72				if (selectedFontSize != value) {
 73					selectedFontSize = value;
 74					OnPropertyChanged();
 75				}
 76			}
 77		}
 78		
 79		bool showLineNumbers;
 80		
 81		public bool ShowLineNumbers {
 82			get { return showLineNumbers; }
 83			set {
 84				if (showLineNumbers != value) {
 85					showLineNumbers = value;
 86					OnPropertyChanged();
 87				}
 88			}
 89		}
 90
 91		bool showMetadataTokens;
 92
 93		public bool ShowMetadataTokens {
 94			get { return showMetadataTokens; }
 95			set {
 96				if (showMetadataTokens != value) {
 97					showMetadataTokens = value;
 98					OnPropertyChanged();
 99				}
100			}
101		}
102
103		bool showMetadataTokensInBase10;
104
105		public bool ShowMetadataTokensInBase10 {
106			get { return showMetadataTokensInBase10; }
107			set {
108				if (showMetadataTokensInBase10 != value) {
109					showMetadataTokensInBase10 = value;
110					OnPropertyChanged();
111				}
112			}
113		}
114
115		bool enableWordWrap;
116
117		public bool EnableWordWrap
118		{
119			get { return enableWordWrap; }
120			set
121			{
122				if (enableWordWrap != value) {
123					enableWordWrap = value;
124					OnPropertyChanged();
125				}
126			}
127		}
128
129		bool sortResults = true;
130
131		public bool SortResults {
132			get { return sortResults; }
133			set {
134				if (sortResults != value) {
135					sortResults = value;
136					OnPropertyChanged();
137				}
138			}
139		}
140
141		bool foldBraces = false;
142
143		public bool FoldBraces {
144			get { return foldBraces; }
145			set {
146				if (foldBraces != value) {
147					foldBraces = value;
148					OnPropertyChanged();
149				}
150			}
151		}
152
153		bool expandMemberDefinitions = false;
154
155		public bool ExpandMemberDefinitions {
156			get { return expandMemberDefinitions; }
157			set {
158				if (expandMemberDefinitions != value) {
159					expandMemberDefinitions = value;
160					OnPropertyChanged();
161				}
162			}
163		}
164
165		bool expandUsingDeclarations = false;
166
167		public bool ExpandUsingDeclarations {
168			get { return expandUsingDeclarations; }
169			set {
170				if (expandUsingDeclarations != value) {
171					expandUsingDeclarations = value;
172					OnPropertyChanged();
173				}
174			}
175		}
176
177		bool showDebugInfo;
178
179		public bool ShowDebugInfo {
180			get { return showDebugInfo; }
181			set {
182				if (showDebugInfo != value) {
183					showDebugInfo = value;
184					OnPropertyChanged();
185				}
186			}
187		}
188
189		bool indentationUseTabs = true;
190
191		public bool IndentationUseTabs {
192			get { return indentationUseTabs; }
193			set {
194				if (indentationUseTabs != value) {
195					indentationUseTabs = value;
196					OnPropertyChanged();
197				}
198			}
199		}
200
201		int indentationTabSize = 4;
202
203		public int IndentationTabSize {
204			get { return indentationTabSize; }
205			set {
206				if (indentationTabSize != value) {
207					indentationTabSize = value;
208					OnPropertyChanged();
209				}
210			}
211		}
212
213		int indentationSize = 4;
214
215		public int IndentationSize {
216			get { return indentationSize; }
217			set {
218				if (indentationSize != value) {
219					indentationSize = value;
220					OnPropertyChanged();
221				}
222			}
223		}
224
225		bool highlightMatchingBraces = true;
226
227		public bool HighlightMatchingBraces {
228			get { return highlightMatchingBraces; }
229			set {
230				if (highlightMatchingBraces != value) {
231					highlightMatchingBraces = value;
232					OnPropertyChanged();
233				}
234			}
235		}
236
237		bool hideEmptyMetadataTables = true;
238
239		public bool HideEmptyMetadataTables {
240			get { return hideEmptyMetadataTables; }
241			set {
242				if (hideEmptyMetadataTables != value) {
243					hideEmptyMetadataTables = value;
244					OnPropertyChanged();
245				}
246			}
247		}
248
249		public void CopyValues(DisplaySettings s)
250		{
251			this.SelectedFont = s.selectedFont;
252			this.SelectedFontSize = s.selectedFontSize;
253			this.ShowLineNumbers = s.showLineNumbers;
254			this.ShowMetadataTokens = s.showMetadataTokens;
255			this.ShowMetadataTokensInBase10 = s.showMetadataTokensInBase10;
256			this.ShowDebugInfo = s.showDebugInfo;
257			this.EnableWordWrap = s.enableWordWrap;
258			this.SortResults = s.sortResults;
259			this.FoldBraces = s.foldBraces;
260			this.ExpandMemberDefinitions = s.expandMemberDefinitions;
261			this.ExpandUsingDeclarations = s.expandUsingDeclarations;
262			this.IndentationUseTabs = s.indentationUseTabs;
263			this.IndentationTabSize = s.indentationTabSize;
264			this.IndentationSize = s.indentationSize;
265			this.HighlightMatchingBraces = s.highlightMatchingBraces;
266			this.HideEmptyMetadataTables = s.HideEmptyMetadataTables;
267		}
268	}
269}