mirror of
https://github.com/gui-cs/Terminal.Gui.git
synced 2025-12-26 15:57:56 +01:00
Dim code cleanup - fix warnings
This commit is contained in:
@@ -453,17 +453,18 @@ public class Pos
|
||||
|
||||
internal class PosCombine (bool add, Pos left, Pos right) : Pos
|
||||
{
|
||||
internal bool _add = add;
|
||||
internal Pos _left = left, _right = right;
|
||||
internal bool Add { get; set; } = add;
|
||||
internal Pos Left { get; set; } = left;
|
||||
internal Pos Right { get; set; } = right;
|
||||
|
||||
public override string ToString () { return $"Combine({_left}{(_add ? '+' : '-')}{_right})"; }
|
||||
public override string ToString () { return $"Combine({Left}{(Add ? '+' : '-')}{Right})"; }
|
||||
|
||||
internal override int Anchor (int width)
|
||||
{
|
||||
int la = _left.Anchor (width);
|
||||
int ra = _right.Anchor (width);
|
||||
int la = Left.Anchor (width);
|
||||
int ra = Right.Anchor (width);
|
||||
|
||||
if (_add)
|
||||
if (Add)
|
||||
{
|
||||
return la + ra;
|
||||
}
|
||||
@@ -474,10 +475,10 @@ public class Pos
|
||||
internal override int Calculate (int superviewDimension, Dim dim, View us, Dimension dimension)
|
||||
{
|
||||
int newDimension = dim.Calculate (0, superviewDimension, us, dimension);
|
||||
int left = _left.Calculate (superviewDimension, dim, us, dimension);
|
||||
int right = _right.Calculate (superviewDimension, dim, us, dimension);
|
||||
int left = Left.Calculate (superviewDimension, dim, us, dimension);
|
||||
int right = Right.Calculate (superviewDimension, dim, us, dimension);
|
||||
|
||||
if (_add)
|
||||
if (Add)
|
||||
{
|
||||
return left + right;
|
||||
}
|
||||
@@ -491,12 +492,12 @@ public class Pos
|
||||
/// <returns></returns>
|
||||
internal override bool ReferencesOtherViews ()
|
||||
{
|
||||
if (_left.ReferencesOtherViews ())
|
||||
if (Left.ReferencesOtherViews ())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
if (_right.ReferencesOtherViews ())
|
||||
if (Right.ReferencesOtherViews ())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@@ -758,7 +759,7 @@ public class Pos
|
||||
|
||||
/// <summary>
|
||||
/// <para>
|
||||
/// A Dim object describes the dimensions of a <see cref="View"/>. Dim is the type of the
|
||||
/// Describes the horizontal or vertical dimensions of a <see cref="View"/>. Dim is the type of the
|
||||
/// <see cref="View.Width"/> and <see cref="View.Height"/> properties of <see cref="View"/>. Dim objects enable
|
||||
/// Computed Layout (see <see cref="LayoutStyle.Computed"/>) to automatically manage the dimensions of a view.
|
||||
/// </para>
|
||||
|
||||
@@ -917,8 +917,8 @@ public partial class View
|
||||
|
||||
return;
|
||||
case Pos.PosCombine pc:
|
||||
CollectPos (pc._left, from, ref nNodes, ref nEdges);
|
||||
CollectPos (pc._right, from, ref nNodes, ref nEdges);
|
||||
CollectPos (pc.Left, from, ref nNodes, ref nEdges);
|
||||
CollectPos (pc.Right, from, ref nNodes, ref nEdges);
|
||||
|
||||
break;
|
||||
}
|
||||
@@ -1105,8 +1105,8 @@ public partial class View
|
||||
|
||||
case Pos pos and Pos.PosCombine:
|
||||
// Recursively check for not Absolute or not View
|
||||
ThrowInvalid (view, (pos as Pos.PosCombine)._left, name);
|
||||
ThrowInvalid (view, (pos as Pos.PosCombine)._right, name);
|
||||
ThrowInvalid (view, (pos as Pos.PosCombine).Left, name);
|
||||
ThrowInvalid (view, (pos as Pos.PosCombine).Right, name);
|
||||
|
||||
break;
|
||||
|
||||
|
||||
@@ -132,19 +132,6 @@ public class Dialogs : Scenario
|
||||
};
|
||||
frame.Add (label);
|
||||
|
||||
static IEnumerable<string> GetUniqueEnumNames<T> () where T : Enum
|
||||
{
|
||||
var values = new HashSet<int> ();
|
||||
foreach (var name in Enum.GetNames (typeof (T)))
|
||||
{
|
||||
var value = (int)Enum.Parse (typeof (T), name);
|
||||
if (values.Add (value))
|
||||
{
|
||||
yield return name;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var labels = new [] { "Left", "Centered", "Right", "Justified", "FirstLeftRestRight", "LastRightRestLeft" };
|
||||
var alignmentGroup = new RadioGroup
|
||||
{
|
||||
|
||||
@@ -225,13 +225,13 @@ public class PosTests (ITestOutputHelper output)
|
||||
Assert.Equal (10, posAbsolute.Anchor (0));
|
||||
|
||||
var posCombine = new Pos.PosCombine (true, posFactor, posAbsolute);
|
||||
Assert.Equal (posCombine._left, posFactor);
|
||||
Assert.Equal (posCombine._right, posAbsolute);
|
||||
Assert.Equal (posCombine.Left, posFactor);
|
||||
Assert.Equal (posCombine.Right, posAbsolute);
|
||||
Assert.Equal (20, posCombine.Anchor (100));
|
||||
|
||||
posCombine = new (true, posAbsolute, posFactor);
|
||||
Assert.Equal (posCombine._left, posAbsolute);
|
||||
Assert.Equal (posCombine._right, posFactor);
|
||||
Assert.Equal (posCombine.Left, posAbsolute);
|
||||
Assert.Equal (posCombine.Right, posFactor);
|
||||
Assert.Equal (20, posCombine.Anchor (100));
|
||||
|
||||
var view = new View { Frame = new (20, 10, 20, 1) };
|
||||
|
||||
Reference in New Issue
Block a user