Skip to content

Commit 00aaefb

Browse files
BDisptigtznind
authored
Fixes #3951. Adds View dependency to DimFunc and PosFunc (#4210)
* Fixes #4208. MainLoopSyncContext doesn't work with the v2 drivers * Fixes #3951. Add DimFuncWithView with a View dependency * Revert to iteration which will handle the necessary processes * Revert "Revert to iteration which will handle the necessary processes" This reverts commit 50015ac. * Layout and draw before position cursor * Add optional View parameter and property to the DimFunc and PosFunc * Trying fix unit test error * Revert layout changes * Fixes #4216. Legacy drivers aren't refreshing the screen correctly on view drag * Add assertion proving NeedsLayout is always false before call OnSubViewsLaidOut * Fix unit test error * Increasing time to abort * Revert "Increasing time to abort" This reverts commit d7306e7. * Trying fix integration tests * Still trying fix integrations unit tests * Revert comment * Layout is performed during the iteration * Using Dim.Func with status bar view * Still trying fix integrations tests by locking _subviews * Still trying fix integrations tests by locking _subviews * Add internal SnapshotSubviews method * Remove lock from SnapshotSubviews method * Using SnapshotSubviews method in the DrawSubViews method * Remove lock from SnapshotSubviews method * Using SnapshotSubviews method in the DrawSubViews method * Using SnapshotSubviews * Prevent new app if the previous wasn't yet finished * Replace SnapshotSubviews method with ViewCollectionHelpers class * Lock entire GuiTestContext constructor * Using Snapshot in the ordered field * Fixes #4221 Extra modifiers f1 to f4 in v2net (#4220) * Assume we are running in a terminal that supports true color by default unless user explicitly forces 16 * Add support for extra modifiers for F1 to F4 keys * Revert "Assume we are running in a terminal that supports true color by default unless user explicitly forces 16" This reverts commit 4cc2530. * Cleanup * Update comments * Code cleanup --------- Co-authored-by: Tig <tig@users.noreply.github.com> * Move ViewCollectionHelpers class to a separate file * Remove Border.Layout call in the DoDrawAdornmentsSubViews method. * Remove adornments layout call within the draw --------- Co-authored-by: Tig <tig@users.noreply.github.com> Co-authored-by: Thomas Nind <31306100+tznind@users.noreply.github.com>
1 parent 7ca765c commit 00aaefb

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+421
-242
lines changed

Examples/UICatalog/Scenarios/Adornments.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public override void Main ()
3535
Title = "The _Window",
3636
Arrangement = ViewArrangement.Overlapped | ViewArrangement.Movable,
3737

38-
Width = Dim.Fill (Dim.Func (() => editor.Frame.Width)),
38+
Width = Dim.Fill (Dim.Func (_ => editor.Frame.Width)),
3939
Height = Dim.Fill ()
4040
};
4141
app.Add (window);

Examples/UICatalog/Scenarios/AllViewsTester.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ public override void Main ()
101101
{
102102
Title = "Arrangement [_3]",
103103
X = Pos.Right (_classListView) - 1,
104-
Y = Pos.Bottom (_adornmentsEditor) - Pos.Func (() => _adornmentsEditor.Frame.Height == 1 ? 0 : 1),
104+
Y = Pos.Bottom (_adornmentsEditor) - Pos.Func (_ => _adornmentsEditor.Frame.Height == 1 ? 0 : 1),
105105
Width = Dim.Width (_adornmentsEditor),
106106
Height = Dim.Fill (),
107107
AutoSelectViewToEdit = false,
@@ -134,7 +134,7 @@ public override void Main ()
134134
{
135135
Title = "ViewportSettings [_5]",
136136
X = Pos.Right (_arrangementEditor) - 1,
137-
Y = Pos.Bottom (_layoutEditor) - Pos.Func (() => _layoutEditor.Frame.Height == 1 ? 0 : 1),
137+
Y = Pos.Bottom (_layoutEditor) - Pos.Func (_ => _layoutEditor.Frame.Height == 1 ? 0 : 1),
138138
Width = Dim.Width (_layoutEditor),
139139
Height = Dim.Auto (),
140140
CanFocus = true,
@@ -148,7 +148,7 @@ public override void Main ()
148148
{
149149
Title = "View Properties [_6]",
150150
X = Pos.Right (_adornmentsEditor) - 1,
151-
Y = Pos.Bottom (_viewportSettingsEditor) - Pos.Func (() => _viewportSettingsEditor.Frame.Height == 1 ? 0 : 1),
151+
Y = Pos.Bottom (_viewportSettingsEditor) - Pos.Func (_ => _viewportSettingsEditor.Frame.Height == 1 ? 0 : 1),
152152
Width = Dim.Width (_layoutEditor),
153153
Height = Dim.Auto (),
154154
CanFocus = true,
@@ -171,7 +171,7 @@ public override void Main ()
171171

172172
_layoutEditor.Width = Dim.Fill (
173173
Dim.Func (
174-
() =>
174+
_ =>
175175
{
176176
if (_eventLog.NeedsLayout)
177177
{

Examples/UICatalog/Scenarios/Arrangement.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ public override void Main ()
6666
View tiledView3 = CreateTiledView (2, Pos.Right (tiledView2) - 1, Pos.Top (tiledView2));
6767
tiledView3.Height = Dim.Height (tiledView1);
6868
View tiledView4 = CreateTiledView (3, Pos.Left (tiledView1), Pos.Bottom (tiledView1) - 1);
69-
tiledView4.Width = Dim.Func (() => tiledView3.Frame.Width + tiledView2.Frame.Width + tiledView1.Frame.Width - 2);
69+
tiledView4.Width = Dim.Func (_ => tiledView3.Frame.Width + tiledView2.Frame.Width + tiledView1.Frame.Width - 2);
7070

7171
View movableSizeableWithProgress = CreateOverlappedView (2, 10, 8);
7272
movableSizeableWithProgress.Title = "Movable _& Sizable";

Examples/UICatalog/Scenarios/CharacterMap/CharacterMap.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ public override void Main ()
3939
{
4040
X = 0,
4141
Y = 1,
42-
Width = Dim.Fill (Dim.Func (() => _categoryList!.Frame.Width)),
4342
Height = Dim.Fill (),
4443
// SchemeName = "Base"
4544

@@ -172,6 +171,8 @@ public override void Main ()
172171
};
173172
top.Add (menu);
174173

174+
_charMap.Width = Dim.Fill (Dim.Func (v => v!.Frame.Width, _categoryList));
175+
175176
_charMap.SelectedCodePoint = 0;
176177
_charMap.SetFocus ();
177178

Examples/UICatalog/Scenarios/ConfigurationEditor.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public override void Main ()
5555
_tabView = new ()
5656
{
5757
Width = Dim.Fill (),
58-
Height = Dim.Fill (Dim.Func (() => statusBar.Frame.Height))
58+
Height = Dim.Fill (Dim.Func (_ => statusBar.Frame.Height))
5959
};
6060

6161
win.Add (_tabView, statusBar);

Examples/UICatalog/Scenarios/DynamicMenuBar.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -598,7 +598,7 @@ public DynamicMenuBarSample ()
598598
X = Pos.Right (btnPrevious) + 1,
599599
Y = Pos.Top (btnPrevious),
600600

601-
Width = Dim.Fill () - Dim.Func (() => btnAdd.Frame.Width + 1),
601+
Width = Dim.Fill () - Dim.Func (_ => btnAdd.Frame.Width + 1),
602602
Height = 1
603603
};
604604

Examples/UICatalog/Scenarios/EditorsAndHelpers/AdornmentEditor.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ private void AdornmentEditor_Initialized (object? sender, EventArgs e)
100100

101101
_leftEdit = new ()
102102
{
103-
X = Pos.Left (_topEdit) - Pos.Func (() => _topEdit.Text.Length) - 2, Y = Pos.Bottom (_topEdit),
103+
X = Pos.Left (_topEdit) - Pos.Func (_ => _topEdit.Text.Length) - 2, Y = Pos.Bottom (_topEdit),
104104
Format = _topEdit.Format
105105
};
106106

Examples/UICatalog/Scenarios/EditorsAndHelpers/AdornmentsEditor.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ private void AdornmentsEditor_Initialized (object? sender, EventArgs e)
122122
PaddingEditor.Border!.Thickness = PaddingEditor.Border.Thickness with { Bottom = 0 };
123123
Add (PaddingEditor);
124124

125-
Width = Dim.Auto (maximumContentDim: Dim.Func (() => MarginEditor.Frame.Width - 2));
125+
Width = Dim.Auto (maximumContentDim: Dim.Func (_ => MarginEditor.Frame.Width - 2));
126126

127127
MarginEditor.ExpanderButton!.Collapsed = true;
128128
BorderEditor.ExpanderButton!.Collapsed = true;

Examples/UICatalog/Scenarios/EditorsAndHelpers/DimEditor.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ protected override void OnUpdateLayoutSettings ()
6868
break;
6969
case DimFunc func:
7070
_valueEdit.Enabled = true;
71-
_value = func.Fn ();
71+
_value = func.Fn (null);
7272
_valueEdit!.Text = _value.ToString ();
7373
break;
7474
case DimPercent percent:
@@ -98,7 +98,7 @@ private void DimEditor_Initialized (object? sender, EventArgs e)
9898
{
9999
X = Pos.Right (label) + 1,
100100
Y = 0,
101-
Width = Dim.Func (() => _radioItems.Max (i => i.GetColumns ()) - label.Frame.Width + 1),
101+
Width = Dim.Func (_ => _radioItems.Max (i => i.GetColumns ()) - label.Frame.Width + 1),
102102
Text = $"{_value}"
103103
};
104104

@@ -141,7 +141,7 @@ private void DimChanged ()
141141
0 => Dim.Absolute (_value),
142142
1 => Dim.Auto (),
143143
2 => Dim.Fill (_value),
144-
3 => Dim.Func (() => _value),
144+
3 => Dim.Func (_ => _value),
145145
4 => Dim.Percent (_value),
146146
_ => Dimension == Dimension.Width ? ViewToEdit.Width : ViewToEdit.Height
147147
};

Examples/UICatalog/Scenarios/EditorsAndHelpers/EventLog.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public EventLog ()
2020
Y = 0;
2121

2222
Width = Dim.Func (
23-
() =>
23+
_ =>
2424
{
2525
if (!IsInitialized)
2626
{

0 commit comments

Comments
 (0)