소스 검색

More simplification

Tigger Kindel 1 년 전
부모
커밋
841bbf2ed7
3개의 변경된 파일14개의 추가작업 그리고 48개의 파일을 삭제
  1. 0 1
      Terminal.Gui/ConsoleDrivers/ConsoleDriver.cs
  2. 13 46
      Terminal.Gui/Drawing/Color.cs
  3. 1 1
      Terminal.sln.DotSettings

+ 0 - 1
Terminal.Gui/ConsoleDrivers/ConsoleDriver.cs

@@ -390,7 +390,6 @@ public abstract class ConsoleDriver {
 	public Attribute CurrentAttribute {
 		get => _currentAttribute;
 		set {
-			//if (value is { Initialized: false, HasValidColors: true } && Application.Driver != null) {
 			if (value is { Initialized: false } && Application.Driver != null) {
 				_currentAttribute = new Attribute (value.Foreground, value.Background);
 				return;

+ 13 - 46
Terminal.Gui/Drawing/Color.cs

@@ -744,14 +744,6 @@ namespace Terminal.Gui {
 		[JsonIgnore]
 		public bool Initialized { get; internal set; }
 
-		//// TODO: This no longer makes sense - remove it
-		///// <summary>
-		///// Returns <see langword="true"/> if the Attribute is valid (both foreground and background have valid color values).
-		///// </summary>
-		///// <returns></returns>
-		//[JsonIgnore]
-		//public bool HasValidColors => (int)Foreground.ColorName > -1 && (int)Background.ColorName > -1;
-
 		/// <inheritdoc />
 		public override string ToString ()
 		{
@@ -761,7 +753,7 @@ namespace Terminal.Gui {
 	}
 
 	/// <summary>
-	/// Defines the color <see cref="Attribute"/>s for common visible elements in a <see cref="View"/>. 
+	/// Defines the <see cref="Attribute"/>s for common visible elements in a <see cref="View"/>. 
 	/// Containers such as <see cref="Window"/> and <see cref="FrameView"/> use <see cref="ColorScheme"/> to determine
 	/// the colors used by sub-views.
 	/// </summary>
@@ -780,7 +772,7 @@ namespace Terminal.Gui {
 		/// Used by <see cref="Colors.SetColorScheme(ColorScheme, string)"/> and <see cref="Colors.GetColorScheme(string)"/> to track which ColorScheme 
 		/// is being accessed.
 		/// </summary>
-		internal string schemeBeingSet = "";
+		internal string _schemeBeingSet = "";
 
 		/// <summary>
 		/// Creates a new instance.
@@ -819,65 +811,40 @@ namespace Terminal.Gui {
 		/// The foreground and background color for text when the view is not focused, hot, or disabled.
 		/// </summary>
 		public Attribute Normal {
-			get { return _normal; }
-			set {
-				//if (!value.HasValidColors) {
-				//	return;
-				//}
-				_normal = value;
-			}
+			get => _normal;
+			set => _normal = value;
 		}
 
 		/// <summary>
 		/// The foreground and background color for text when the view has the focus.
 		/// </summary>
 		public Attribute Focus {
-			get { return _focus; }
-			set {
-				//if (!value.HasValidColors) {
-				//	return;
-				//}
-				_focus = value;
-			}
+			get => _focus;
+			set => _focus = value;
 		}
 
 		/// <summary>
 		/// The foreground and background color for text when the view is highlighted (hot).
 		/// </summary>
 		public Attribute HotNormal {
-			get { return _hotNormal; }
-			set {
-				//if (!value.HasValidColors) {
-				//	return;
-				//}
-				_hotNormal = value;
-			}
+			get => _hotNormal;
+			set => _hotNormal = value;
 		}
 
 		/// <summary>
 		/// The foreground and background color for text when the view is highlighted (hot) and has focus.
 		/// </summary>
 		public Attribute HotFocus {
-			get { return _hotFocus; }
-			set {
-				//if (!value.HasValidColors) {
-				//	return;
-				//}
-				_hotFocus = value;
-			}
+			get => _hotFocus;
+			set => _hotFocus = value;
 		}
 
 		/// <summary>
 		/// The default foreground and background color for text, when the view is disabled.
 		/// </summary>
 		public Attribute Disabled {
-			get { return _disabled; }
-			set {
-				//if (!value.HasValidColors) {
-				//	return;
-				//}
-				_disabled = value;
-			}
+			get => _disabled;
+			set => _disabled = value;
 		}
 
 		/// <summary>
@@ -1062,7 +1029,7 @@ namespace Terminal.Gui {
 		static void SetColorScheme (ColorScheme colorScheme, [CallerMemberName] string schemeBeingSet = null)
 		{
 			ColorSchemes [schemeBeingSet] = colorScheme;
-			colorScheme.schemeBeingSet = schemeBeingSet;
+			colorScheme._schemeBeingSet = schemeBeingSet;
 		}
 
 		/// <summary>

+ 1 - 1
Terminal.sln.DotSettings

@@ -113,7 +113,7 @@
 	<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/PredefinedNamingRules/=Constants/@EntryIndexedValue">&lt;Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /&gt;</s:String>
 	<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/PredefinedNamingRules/=PrivateInstanceFields/@EntryIndexedValue">&lt;Policy Inspect="True" Prefix="_" Suffix="" Style="aaBb" /&gt;</s:String>
 	<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/PredefinedNamingRules/=PrivateStaticFields/@EntryIndexedValue">&lt;Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /&gt;</s:String>
-	<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/PredefinedNamingRules/=PublicFields/@EntryIndexedValue">&lt;Policy Inspect="True" Prefix="_" Suffix="" Style="AaBb" /&gt;</s:String>
+	<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/PredefinedNamingRules/=PublicFields/@EntryIndexedValue">&lt;Policy Inspect="True" Prefix="_" Suffix="" Style="aaBb" /&gt;</s:String>
 	<s:Boolean x:Key="/Default/Environment/InjectedLayers/FileInjectedLayer/=CAF4ECB3AC41AE43BD233D613AC1562C/@KeyIndexDefined">True</s:Boolean>
 	<s:String x:Key="/Default/Environment/InjectedLayers/FileInjectedLayer/=CAF4ECB3AC41AE43BD233D613AC1562C/AbsolutePath/@EntryValue">Terminal.sln.DotSettings</s:String>
 	<s:String x:Key="/Default/Environment/InjectedLayers/FileInjectedLayer/=CAF4ECB3AC41AE43BD233D613AC1562C/RelativePath/@EntryValue"></s:String>