Skip to content

Commit b248a99

Browse files
committed
bumped terminal gui version and switched to nuget package, fixed compat breaks
1 parent 02fc68d commit b248a99

File tree

5 files changed

+54
-65
lines changed

5 files changed

+54
-65
lines changed

HarmonyCore.CliTool/HarmonyCore.CliTool.csproj

+6-6
Original file line numberDiff line numberDiff line change
@@ -25,21 +25,21 @@
2525

2626
<ItemGroup>
2727
<PackageReference Include="CommandLineParser" Version="2.9.1" />
28-
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.0.0" />
28+
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.2.2" />
2929
<PackageReference Include="Microsoft.Build.Tasks.Core" Version="17.3.2" ExcludeAssets="runtime" />
30-
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Scripting" Version="4.5.0" />
30+
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Scripting" Version="4.9.2" />
3131
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
32-
<PackageReference Include="Octokit" Version="5.1.0" />
33-
<PackageReference Include="Synergex.SynergyDE.synrnt" Version="12.2.1.1003" />
34-
<PackageReference Include="System.CodeDom" Version="6.0.0" />
32+
<PackageReference Include="Octokit" Version="10.0.0" />
33+
<PackageReference Include="Synergex.SynergyDE.synrnt" Version="12.3.1.1014" />
34+
<PackageReference Include="System.CodeDom" Version="8.0.0" />
3535
<PackageReference Include="System.Runtime" Version="4.3.1" />
36+
<PackageReference Include="Terminal.Gui" Version="1.15.1" />
3637
</ItemGroup>
3738
<ItemGroup>
3839
<ProjectReference Include="..\CodeGen\DotNetCore\CodeGenEngine\CodeGenEngine.synproj" />
3940
<ProjectReference Include="..\CodeGen\DotNetCore\HarmonyCoreCodeGen.Core\HarmonyCoreCodeGen.Core.synproj" />
4041
<ProjectReference Include="..\CodeGen\DotNetCore\HarmonyCoreExtensions\HarmonyCoreExtensions.synproj" />
4142
<ProjectReference Include="..\CodeGen\DotNetCore\MethodCatalogAPI\MethodCatalogAPI.synproj" />
4243
<ProjectReference Include="..\CodeGen\DotNetCore\RepositoryAPI\RepositoryAPI.synproj" />
43-
<ProjectReference Include="..\Terminal.Gui\Terminal.Gui\Terminal.Gui.csproj" />
4444
</ItemGroup>
4545
</Project>

HarmonyCore.CliTool/TUI/Views/MultiItemSettingsView.cs

+15-7
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,16 @@ public MultiItemSettingsView(IMultiItemSettingsBase settings)
3333
Height = Dim.Fill(),
3434
};
3535

36-
_leftFrame = new FrameView(settings.Name);
36+
_leftFrame = new FrameView(settings.Name) { Width = Dim.Percent(25), Height = Dim.Fill() };
3737
if (_settings.CanAddItems)
3838
{
39-
_currentItemFrame = new FrameView($"To add {_settings.Name.ToLower()}, select \"Add {_settings.Name.ToLower()}\" in the status bar");
39+
_currentItemFrame = new FrameView($"To add {_settings.Name.ToLower()}, select \"Add {_settings.Name.ToLower()}\" in the status bar")
40+
{ Width = Dim.Percent(75), Height = Dim.Fill() };
4041
}
4142
else
4243
{
43-
_currentItemFrame = new FrameView($"No {_settings.Name.ToLower()} are available.");
44+
_currentItemFrame = new FrameView($"No {_settings.Name.ToLower()} are available.")
45+
{ Width = Dim.Percent(75), Height = Dim.Fill() };
4446
if (_settings.Name.ToLower() == "interfaces")
4547
{
4648
var helpText = "Before you can add interfaces for traditional Synergy routines, "
@@ -109,6 +111,7 @@ public MultiItemSettingsView(IMultiItemSettingsBase settings)
109111
};
110112

111113
Add(_leftFrame, _currentItemFrame, _structureListScrollBarView);
114+
SetNeedsDisplay();
112115
}
113116

114117

@@ -181,6 +184,11 @@ public void SelectItem(ISingleItemSettings targetSetting)
181184

182185
public void AttachStatusBar(StatusBar target)
183186
{
187+
Application.Top.Resized += Top_Resized;
188+
if (Application.Top.GetCurrentWidth(out var currentWidth) &&
189+
Application.Top.GetCurrentHeight(out var currentHeight))
190+
Top_Resized(new Size(currentWidth, currentHeight));
191+
184192
_statusBar = target;
185193
if (_settings.CanAddItems)
186194
{
@@ -266,11 +274,13 @@ public void DetachStatusBar()
266274
while (_statusBar.Items.Length > 0)
267275
_statusBar.RemoveItem(0);
268276
_statusBar = null;
277+
278+
Application.Top.Resized -= Top_Resized;
269279
}
270280

271-
public override void LayoutSubviews()
281+
private void Top_Resized(Size obj)
272282
{
273-
Application.Top.GetCurrentWidth(out var applicationWidth);
283+
var applicationWidth = obj.Width;
274284
if (applicationWidth < 120)
275285
{
276286
_currentItemFrame.X = 0;
@@ -295,8 +305,6 @@ public override void LayoutSubviews()
295305
_leftFrame.X = 0;
296306
_leftFrame.Y = 0;
297307
}
298-
299-
base.LayoutSubviews();
300308
}
301309

302310
private void _structureListView_SelectedItemChanged(ListViewItemEventArgs obj)

HarmonyCore.CliTool/TUI/Views/SingleItemSettingsView.cs

+32-25
Original file line numberDiff line numberDiff line change
@@ -31,19 +31,30 @@ public SingleItemSettingsView(ISingleItemSettings settings, string titleContext
3131
_dataSource.Columns.Add(_promptColumn);
3232
_dataSource.Columns.Add(_valueColumn);
3333

34-
var alignRight = new TableView.ColumnStyle()
34+
_tableView = new TableView(_dataSource)
3535
{
36-
AlignmentGetter = (obj) => TextAlignment.Right,
37-
RepresentationGetter = (obj) =>
36+
X = Pos.Center(),
37+
Y = 0,
38+
Width = Dim.Fill(),
39+
Height = Dim.Fill()
40+
};
41+
_tableView.FullRowSelect = true;
42+
_tableView.Style.ShowHorizontalHeaderOverline = false;
43+
_tableView.Style.ShowHorizontalHeaderUnderline = false;
44+
_tableView.Style.ShowVerticalHeaderLines = false;
45+
_tableView.Style.ShowVerticalCellLines = false;
46+
47+
var alignRight = _tableView.Style.GetOrCreateColumnStyle(_promptColumn);
48+
alignRight.AlignmentGetter = (obj) => TextAlignment.Right;
49+
alignRight.RepresentationGetter = (obj) =>
3850
{
3951
if (!GetCurrentWidth(out var currentWidth))
4052
currentWidth = 40;
4153
else
4254
currentWidth = (int)(currentWidth * .30f);
4355

4456
return Pad(obj.ToString(), currentWidth, true) + Driver.VLine;
45-
}
46-
};
57+
};
4758

4859
string Pad(string value, int minChars, bool left)
4960
{
@@ -62,34 +73,25 @@ string Truncate(string value, int maxChars)
6273

6374
int maxPrompt = 0;
6475

65-
var singleItemSetting = new TableView.ColumnStyle()
66-
{
67-
RepresentationGetter = (obj) =>
76+
var singleItemSetting = _tableView.Style.GetOrCreateColumnStyle(_valueColumn);
77+
singleItemSetting.AlignmentGetter = (obj) => TextAlignment.Left;
78+
singleItemSetting.RepresentationGetter = (obj) =>
6879
{
6980
var typedObj = obj as IPropertyItemSetting;
7081
if (!GetCurrentWidth(out var currentWidth))
7182
currentWidth = 40;
72-
else
83+
if(currentWidth <= 0)
84+
_tableView.GetCurrentWidth(out currentWidth);
85+
86+
if(currentWidth > 0)
7387
currentWidth = Math.Max(0, Math.Min(currentWidth - maxPrompt, currentWidth / 2) - 5);
88+
else
89+
currentWidth = 40;
7490

7591
return Truncate(typedObj.Value?.ToString() ?? "-", currentWidth);
76-
}
77-
};
92+
};
93+
7894

79-
_tableView = new TableView(_dataSource)
80-
{
81-
X = Pos.Center(),
82-
Y = 0,
83-
Width = Dim.Fill(),
84-
Height = Dim.Fill()
85-
};
86-
_tableView.FullRowSelect = true;
87-
_tableView.Style.ShowHorizontalHeaderOverline = false;
88-
_tableView.Style.ShowHorizontalHeaderUnderline = false;
89-
_tableView.Style.ShowVerticalHeaderLines = false;
90-
_tableView.Style.ShowVerticalCellLines = false;
91-
_tableView.Style.ColumnStyles.Add(_promptColumn, alignRight);
92-
_tableView.Style.ColumnStyles.Add(_valueColumn, singleItemSetting);
9395
Add(_tableView);
9496
SetupScrollBar();
9597
foreach (var item in _settings.DisplayProperties)
@@ -170,7 +172,12 @@ public void HighlightCell(IPropertyItemSetting targetProperty)
170172
{
171173
var row = _tableView.Table.Rows[i];
172174
if (row[1] is IPropertyItemSetting rowItem && rowItem.Prompt == targetProperty.Prompt)
175+
{
176+
var screenPos = _tableView.ScreenToCell(i, 1);
177+
//_scrollBar.Position =
173178
_tableView.SetSelection(1, i, false);
179+
_tableView.EnsureSelectedCellIsVisible();
180+
}
174181
}
175182
_tableView.SetNeedsDisplay();
176183
}

HarmonyCore.sln

-26
Original file line numberDiff line numberDiff line change
@@ -198,8 +198,6 @@ Project("{BBD0F5D1-1CC4-42FD-BA4C-A96779C64378}") = "HarmonyCoreExtensions", "Co
198198
EndProject
199199
Project("{BBD0F5D1-1CC4-42FD-BA4C-A96779C64378}") = "HarmonyCoreCodeGen.Core", "CodeGen\DotNetCore\HarmonyCoreCodeGen.Core\HarmonyCoreCodeGen.Core.synproj", "{6C94D108-0F08-4C31-A6A1-2F626DF92CAF}"
200200
EndProject
201-
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Terminal.Gui", "Terminal.Gui\Terminal.Gui\Terminal.Gui.csproj", "{29E1385D-D456-4341-B426-5D68C83216A5}"
202-
EndProject
203201
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "XmlDoc", "XmlDoc", "{DCE82EE4-9552-4C8B-B1E8-97E27DF65488}"
204202
ProjectSection(SolutionItems) = preProject
205203
XmlDoc\Services.Controllers.xml = XmlDoc\Services.Controllers.xml
@@ -816,30 +814,6 @@ Global
816814
{6C94D108-0F08-4C31-A6A1-2F626DF92CAF}.ReleaseNuget|x64.Build.0 = Release|Any CPU
817815
{6C94D108-0F08-4C31-A6A1-2F626DF92CAF}.ReleaseNuget|x86.ActiveCfg = Release|x86
818816
{6C94D108-0F08-4C31-A6A1-2F626DF92CAF}.ReleaseNuget|x86.Build.0 = Release|x86
819-
{29E1385D-D456-4341-B426-5D68C83216A5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
820-
{29E1385D-D456-4341-B426-5D68C83216A5}.Debug|Any CPU.Build.0 = Debug|Any CPU
821-
{29E1385D-D456-4341-B426-5D68C83216A5}.Debug|linux64.ActiveCfg = Debug|Any CPU
822-
{29E1385D-D456-4341-B426-5D68C83216A5}.Debug|linux64.Build.0 = Debug|Any CPU
823-
{29E1385D-D456-4341-B426-5D68C83216A5}.Debug|x64.ActiveCfg = Debug|Any CPU
824-
{29E1385D-D456-4341-B426-5D68C83216A5}.Debug|x64.Build.0 = Debug|Any CPU
825-
{29E1385D-D456-4341-B426-5D68C83216A5}.Debug|x86.ActiveCfg = Debug|Any CPU
826-
{29E1385D-D456-4341-B426-5D68C83216A5}.Debug|x86.Build.0 = Debug|Any CPU
827-
{29E1385D-D456-4341-B426-5D68C83216A5}.Release|Any CPU.ActiveCfg = Release|Any CPU
828-
{29E1385D-D456-4341-B426-5D68C83216A5}.Release|Any CPU.Build.0 = Release|Any CPU
829-
{29E1385D-D456-4341-B426-5D68C83216A5}.Release|linux64.ActiveCfg = Release|Any CPU
830-
{29E1385D-D456-4341-B426-5D68C83216A5}.Release|linux64.Build.0 = Release|Any CPU
831-
{29E1385D-D456-4341-B426-5D68C83216A5}.Release|x64.ActiveCfg = Release|Any CPU
832-
{29E1385D-D456-4341-B426-5D68C83216A5}.Release|x64.Build.0 = Release|Any CPU
833-
{29E1385D-D456-4341-B426-5D68C83216A5}.Release|x86.ActiveCfg = Release|Any CPU
834-
{29E1385D-D456-4341-B426-5D68C83216A5}.Release|x86.Build.0 = Release|Any CPU
835-
{29E1385D-D456-4341-B426-5D68C83216A5}.ReleaseNuget|Any CPU.ActiveCfg = Release|Any CPU
836-
{29E1385D-D456-4341-B426-5D68C83216A5}.ReleaseNuget|Any CPU.Build.0 = Release|Any CPU
837-
{29E1385D-D456-4341-B426-5D68C83216A5}.ReleaseNuget|linux64.ActiveCfg = Release|Any CPU
838-
{29E1385D-D456-4341-B426-5D68C83216A5}.ReleaseNuget|linux64.Build.0 = Release|Any CPU
839-
{29E1385D-D456-4341-B426-5D68C83216A5}.ReleaseNuget|x64.ActiveCfg = Release|Any CPU
840-
{29E1385D-D456-4341-B426-5D68C83216A5}.ReleaseNuget|x64.Build.0 = Release|Any CPU
841-
{29E1385D-D456-4341-B426-5D68C83216A5}.ReleaseNuget|x86.ActiveCfg = Release|Any CPU
842-
{29E1385D-D456-4341-B426-5D68C83216A5}.ReleaseNuget|x86.Build.0 = Release|Any CPU
843817
EndGlobalSection
844818
GlobalSection(SolutionProperties) = preSolution
845819
HideSolutionNode = FALSE

0 commit comments

Comments
 (0)