diff --git a/Terminal.Gui/View/Layout/ViewLayout.cs b/Terminal.Gui/View/Layout/ViewLayout.cs index b6aaa42d0..d9e4fab95 100644 --- a/Terminal.Gui/View/Layout/ViewLayout.cs +++ b/Terminal.Gui/View/Layout/ViewLayout.cs @@ -868,8 +868,7 @@ public partial class View internal void CollectAll (View from, ref HashSet nNodes, ref HashSet<(View, View)> nEdges) { - // BUGBUG: This should really only work on initialized subviews - foreach (View v in from.InternalSubviews /*.Where(v => v.IsInitialized)*/) + foreach (View v in from.InternalSubviews) { nNodes.Add (v); diff --git a/Terminal.Gui/View/ViewContent.cs b/Terminal.Gui/View/ViewContent.cs index a38c92d2c..a362c8f79 100644 --- a/Terminal.Gui/View/ViewContent.cs +++ b/Terminal.Gui/View/ViewContent.cs @@ -329,44 +329,6 @@ public partial class View return new (_viewportLocation, Frame.Size); } - //// BUGBUG: This is a hack. Viewport_get should not have side effects. - //if (Frame.Size == Size.Empty) - //{ - // // The Frame has not been set yet (e.g. the view has not been added to a SuperView yet). - // // - // // Use _width & _height instead of Width & Height to avoid debug spew - // DimAuto widthAuto = _width as DimAuto; - // DimAuto heightAuto = _height as DimAuto; - - // if ((widthAuto is { } && widthAuto._style.HasFlag (DimAutoStyle.Text)) - // || (heightAuto is { } && heightAuto._style.HasFlag (DimAutoStyle.Text))) - // { - // //if (TextFormatter.NeedsFormat) - // { - // // We always use TF in autosize = false mode - // TextFormatter.AutoSize = false; - - // var size = TextFormatter.GetAutoSize (); - // if (widthAuto is null || !widthAuto._style.HasFlag (DimAutoStyle.Text)) - // { - // size.Width = _width.Anchor (0); - // } - - // if (heightAuto is null || !heightAuto._style.HasFlag (DimAutoStyle.Text)) - // { - // size.Height = _height.Anchor (0); - // } - - // // Whenever DimAutoStyle.Text is set, ContentSize will match TextFormatter.Size. - // //ContentSize = size;//TextFormatter.Size == Size.Empty ? null : TextFormatter.Size; - // TextFormatter.Size = size; ; - - // // Whenever DimAutoStyle.Text is set, ContentSize will match TextFormatter.Size. - // ContentSize = TextFormatter.Size == Size.Empty ? null : TextFormatter.Size; - // } - // } - //} - Thickness thickness = GetAdornmentsThickness (); return new ( _viewportLocation, diff --git a/Terminal.Gui/Views/ComboBox.cs b/Terminal.Gui/Views/ComboBox.cs index 1f8c37a6c..3eb630e64 100644 --- a/Terminal.Gui/Views/ComboBox.cs +++ b/Terminal.Gui/Views/ComboBox.cs @@ -605,6 +605,7 @@ public class ComboBox : View return true; } + // TODO: Upgrade Combobox to use Dim.Auto instead of all this stuff. private void ProcessLayout () { if (Viewport.Height < _minimumHeight && (Height is null || Height is DimAbsolute)) diff --git a/Terminal.Gui/Views/DatePicker.cs b/Terminal.Gui/Views/DatePicker.cs index a044f2a70..613051fbe 100644 --- a/Terminal.Gui/Views/DatePicker.cs +++ b/Terminal.Gui/Views/DatePicker.cs @@ -206,7 +206,7 @@ public class DatePicker : View { X = Pos.Right (_dateLabel), Y = 0, - Width = 12,//Dim.Width (_calendar) - Dim.Width(_dateLabel), // BUGBUG: Fix when Dim.Auto(subviews) fully works + Width = Dim.Width (_calendar) - Dim.Width (_dateLabel), Height = 1, Culture = Culture }; @@ -236,7 +236,7 @@ public class DatePicker : View Y = Pos.Bottom (_calendar) - 1, Height = 1, Width = 2, - Text = GetForwardButtonText(), + Text = GetForwardButtonText (), WantContinuousButtonPressed = true, NoPadding = true, NoDecorations = true @@ -277,7 +277,7 @@ public class DatePicker : View Width = Dim.Auto (); // BUGBUG: Remove when Dim.Auto(subviews) fully works - SetContentSize(new (_calendar.Style.ColumnStyles.Sum (c => c.Value.MinWidth) + 7, _calendar.Frame.Height + 1)); + SetContentSize (new (_calendar.Style.ColumnStyles.Sum (c => c.Value.MinWidth) + 7, _calendar.Frame.Height + 1)); _dateField.DateChanged += DateField_DateChanged; @@ -287,35 +287,35 @@ public class DatePicker : View private static string StandardizeDateFormat (string format) { return format switch - { - "MM/dd/yyyy" => "MM/dd/yyyy", - "yyyy-MM-dd" => "yyyy-MM-dd", - "yyyy/MM/dd" => "yyyy/MM/dd", - "dd/MM/yyyy" => "dd/MM/yyyy", - "d?/M?/yyyy" => "dd/MM/yyyy", - "dd.MM.yyyy" => "dd.MM.yyyy", - "dd-MM-yyyy" => "dd-MM-yyyy", - "dd/MM yyyy" => "dd/MM/yyyy", - "d. M. yyyy" => "dd.MM.yyyy", - "yyyy.MM.dd" => "yyyy.MM.dd", - "g yyyy/M/d" => "yyyy/MM/dd", - "d/M/yyyy" => "dd/MM/yyyy", - "d?/M?/yyyy g" => "dd/MM/yyyy", - "d-M-yyyy" => "dd-MM-yyyy", - "d.MM.yyyy" => "dd.MM.yyyy", - "d.MM.yyyy '?'." => "dd.MM.yyyy", - "M/d/yyyy" => "MM/dd/yyyy", - "d. M. yyyy." => "dd.MM.yyyy", - "d.M.yyyy." => "dd.MM.yyyy", - "g yyyy-MM-dd" => "yyyy-MM-dd", - "d.M.yyyy" => "dd.MM.yyyy", - "d/MM/yyyy" => "dd/MM/yyyy", - "yyyy/M/d" => "yyyy/MM/dd", - "dd. MM. yyyy." => "dd.MM.yyyy", - "yyyy. MM. dd." => "yyyy.MM.dd", - "yyyy. M. d." => "yyyy.MM.dd", - "d. MM. yyyy" => "dd.MM.yyyy", - _ => "dd/MM/yyyy" - }; + { + "MM/dd/yyyy" => "MM/dd/yyyy", + "yyyy-MM-dd" => "yyyy-MM-dd", + "yyyy/MM/dd" => "yyyy/MM/dd", + "dd/MM/yyyy" => "dd/MM/yyyy", + "d?/M?/yyyy" => "dd/MM/yyyy", + "dd.MM.yyyy" => "dd.MM.yyyy", + "dd-MM-yyyy" => "dd-MM-yyyy", + "dd/MM yyyy" => "dd/MM/yyyy", + "d. M. yyyy" => "dd.MM.yyyy", + "yyyy.MM.dd" => "yyyy.MM.dd", + "g yyyy/M/d" => "yyyy/MM/dd", + "d/M/yyyy" => "dd/MM/yyyy", + "d?/M?/yyyy g" => "dd/MM/yyyy", + "d-M-yyyy" => "dd-MM-yyyy", + "d.MM.yyyy" => "dd.MM.yyyy", + "d.MM.yyyy '?'." => "dd.MM.yyyy", + "M/d/yyyy" => "MM/dd/yyyy", + "d. M. yyyy." => "dd.MM.yyyy", + "d.M.yyyy." => "dd.MM.yyyy", + "g yyyy-MM-dd" => "yyyy-MM-dd", + "d.M.yyyy" => "dd.MM.yyyy", + "d/MM/yyyy" => "dd/MM/yyyy", + "yyyy/M/d" => "yyyy/MM/dd", + "dd. MM. yyyy." => "dd.MM.yyyy", + "yyyy. MM. dd." => "yyyy.MM.dd", + "yyyy. M. d." => "yyyy.MM.dd", + "d. MM. yyyy" => "dd.MM.yyyy", + _ => "dd/MM/yyyy" + }; } } diff --git a/Terminal.Gui/Views/Slider.cs b/Terminal.Gui/Views/Slider.cs index 9182605b4..0c9644e75 100644 --- a/Terminal.Gui/Views/Slider.cs +++ b/Terminal.Gui/Views/Slider.cs @@ -610,7 +610,7 @@ public class Slider : View /// Adjust the dimensions of the Slider to the best value. public void SetContentSizeBestFit () { - if (!IsInitialized || /*!(Height is DimAuto && Width is DimAuto) || */_options.Count == 0) + if (/*!IsInitialized ||*/ /*!(Height is DimAuto && Width is DimAuto) || */_options.Count == 0) { return; } diff --git a/Terminal.Gui/Views/TextValidateField.cs b/Terminal.Gui/Views/TextValidateField.cs index 0f02ff002..268bf0c73 100644 --- a/Terminal.Gui/Views/TextValidateField.cs +++ b/Terminal.Gui/Views/TextValidateField.cs @@ -397,7 +397,7 @@ namespace Terminal.Gui /// public TextValidateField () { - Height = 1; // BUGBUG: Views should avoid setting Height as doing so implies Frame.Size == ContentSize + Height = Dim.Auto (minimumContentDim: 1); CanFocus = true; // Things this view knows how to do @@ -533,7 +533,7 @@ namespace Terminal.Gui } /// - protected internal override bool OnMouseEvent (MouseEvent mouseEvent) + protected internal override bool OnMouseEvent (MouseEvent mouseEvent) { if (mouseEvent.Flags.HasFlag (MouseFlags.Button1Pressed)) { diff --git a/UICatalog/Scenarios/Buttons.cs b/UICatalog/Scenarios/Buttons.cs index fb6706366..83b7d3da8 100644 --- a/UICatalog/Scenarios/Buttons.cs +++ b/UICatalog/Scenarios/Buttons.cs @@ -275,7 +275,7 @@ public class Buttons : Scenario X = Pos.Left (absoluteFrame) + 1, Y = Pos.Bottom (radioGroup) + 1, Height = 1, - Width = Dim.Width (absoluteFrame) - 2, // BUGBUG: Not always the width isn't calculated correctly. + Width = Dim.Width (absoluteFrame) - 2, ColorScheme = Colors.ColorSchemes ["TopLevel"], Text = muhkb };