Skip to content

Commit aabb520

Browse files
authored
Change AngouriMath reference to use NuGet package instead of git submodule (#149)
* Waiting for AngouriMath to fix bugs * More interval tests * Parse -> Visualize * Updated but more failing tests * Include Visual Studio automatic updates * A lot less failing tests now * Fix intervals with same boundaries * Update simplification of fractions * Update * Update! * Make buildable * Fix typo * Update * Update * Update * Use = instead of -> * Add a calculator to Avalonia Example * Update * Preparing to remove AngouriMath submodule * Use AngouriMath package * Allow matrices in square brackets * Maybe not exponentiations for ordinary matrix environments * Simplify reference * Resolve the new possible test into QuarticSolution * Fix blurry MathButtons & Update Avalonia to 0.10.0-preview2 * Fix test * Fix test (actually)
1 parent ab9f87c commit aabb520

File tree

29 files changed

+456
-500
lines changed

29 files changed

+456
-500
lines changed

.github/workflows/Test all projects.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ jobs:
4040
"CSharpMath.Rendering.Text.Tests"\
4141
"CSharpMath.Xaml.Tests"\
4242
"CSharpMath.Xaml.Tests.NuGet"\
43-
"AngouriMath/Tests/UnitTests"\
4443
"Typography/Typography.TextBreak/Typography.TextBreak.UnitTests"
4544
do
4645
dotnet add "$p" package Microsoft.NET.Test.Sdk # Update is required for GitHubActionsTestLogger to print anything

.gitmodules

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,3 @@
44
[submodule "Wiki"]
55
path = CSharpMath.Wiki
66
url = https://github.com/verybadcat/CSharpMath.wiki.git
7-
[submodule "AngouriMath"]
8-
path = AngouriMath
9-
url = https://github.com/asc-community/AngouriMath

AngouriMath

Lines changed: 0 additions & 1 deletion
This file was deleted.

CSharpMath.Avalonia.Example/CSharpMath.Avalonia.Example.csproj

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,10 @@
99
<Compile Update="**\*.xaml.cs" DependentUpon="%(Filename)" />
1010
<AvaloniaResource Include="**\*.xaml" />
1111
<EmbeddedResource Include="..\Icon.png" Link="Icon.png" />
12-
<PackageReference Include="Avalonia.Desktop" Version="0.10.0-preview1" />
13-
<PackageReference Include="Avalonia.Diagnostics" Version="0.10.0-preview1" />
12+
<PackageReference Include="Avalonia.Desktop" Version="0.10.0-preview2" />
13+
<PackageReference Include="Avalonia.Diagnostics" Version="0.10.0-preview2" />
1414
<ProjectReference Include="..\CSharpMath.Avalonia\CSharpMath.Avalonia.csproj" />
15+
<ProjectReference Include="..\CSharpMath.Evaluation\CSharpMath.Evaluation.csproj" />
1516
</ItemGroup>
1617

1718
</Project>

CSharpMath.Avalonia.Example/MainView.xaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@
3737
<TabItem Header="MathButton">
3838
<pages:MathButtonPage />
3939
</TabItem>
40+
<TabItem Header="Calculator">
41+
<pages:CalculatorPage />
42+
</TabItem>
4043
</TabControl>
4144

4245
</DockPanel>
Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
11
using Avalonia;
2-
using Avalonia.Controls;
3-
using Avalonia.Markup.Xaml;
4-
using Avalonia.Markup.Xaml.Styling;
5-
6-
namespace CSharpMath.Avalonia.Example {
7-
public class MainView : UserControl {
8-
public MainView() {
9-
InitializeComponent();
10-
11-
var light = AvaloniaXamlLoader.Parse<StyleInclude>(@"<StyleInclude xmlns='https://github.com/avaloniaui' Source='avares://Avalonia.Themes.Fluent/Accents/FluentLight.xaml'/>");
12-
var dark = AvaloniaXamlLoader.Parse<StyleInclude>(@"<StyleInclude xmlns='https://github.com/avaloniaui' Source='avares://Avalonia.Themes.Fluent/Accents/FluentDark.xaml'/>");
13-
var themes = this.Find<RadioButton>("lightThemeRbn");
14-
themes.Checked += (sender, e) => Application.Current.Styles[0] = light;
15-
themes.Unchecked += (sender, e) => Application.Current.Styles[0] = dark;
16-
}
17-
18-
private void InitializeComponent() {
19-
AvaloniaXamlLoader.Load(this);
20-
}
21-
}
22-
}
2+
using Avalonia.Controls;
3+
using Avalonia.Markup.Xaml;
4+
using Avalonia.Styling;
5+
6+
namespace CSharpMath.Avalonia.Example {
7+
public class MainView : UserControl {
8+
public MainView() {
9+
InitializeComponent();
10+
11+
var light = (Styles)AvaloniaXamlLoader.Load(new System.Uri("avares://Avalonia.Themes.Fluent/Accents/FluentLight.xaml"));
12+
var dark = (Styles)AvaloniaXamlLoader.Load(new System.Uri("avares://Avalonia.Themes.Fluent/Accents/FluentDark.xaml"));
13+
var themes = this.Find<RadioButton>("lightThemeRbn");
14+
themes.Checked += (sender, e) => Application.Current.Styles[0] = light;
15+
themes.Unchecked += (sender, e) => Application.Current.Styles[0] = dark;
16+
}
17+
18+
private void InitializeComponent() {
19+
AvaloniaXamlLoader.Load(this);
20+
}
21+
}
22+
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<UserControl xmlns="https://github.com/avaloniaui"
2+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
3+
xmlns:sys="clr-namespace:System;assembly=mscorlib"
4+
xmlns:csmath="clr-namespace:CSharpMath.Avalonia;assembly=CSharpMath.Avalonia"
5+
xmlns:local="clr-namespace:CSharpMath.Avalonia.Example.Pages"
6+
x:Class="CSharpMath.Avalonia.Example.Pages.CalculatorPage">
7+
8+
<ScrollViewer Margin="0, 8" HorizontalScrollBarVisibility="Auto">
9+
10+
<StackPanel Spacing="24">
11+
12+
<StackPanel Spacing="4">
13+
14+
<TextBlock Classes="h1"
15+
Text="CSharpMath.Evaluation.Evaluate" />
16+
17+
<TextBlock Classes="h2"
18+
Text="Evaluates a MathList that can be constructed from LaTeX" />
19+
20+
</StackPanel>
21+
22+
<TextBox Name="input" AcceptsReturn="True" TextWrapping="Wrap" Text="x^4+4x^3+16x^2+4x+1=y" />
23+
24+
<csmath:MathView LaTeX="{Binding #input.Text, Converter={x:Static local:CalculatorPageConverter.Singleton}}" />
25+
26+
</StackPanel>
27+
28+
</ScrollViewer>
29+
30+
</UserControl>
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
using System;
2+
using System.Globalization;
3+
using Avalonia.Controls;
4+
using Avalonia.Data.Converters;
5+
using Avalonia.Markup.Xaml;
6+
7+
namespace CSharpMath.Avalonia.Example.Pages {
8+
public class CalculatorPage : UserControl {
9+
public CalculatorPage() => AvaloniaXamlLoader.Load(this);
10+
}
11+
class CalculatorPageConverter : IValueConverter {
12+
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) =>
13+
value is string latex
14+
? Atom.LaTeXParser.MathListFromLaTeX(latex)
15+
.Bind(list => Evaluation.Interpret(list))
16+
.Match(success => success, error => latex)
17+
: value;
18+
object IValueConverter.ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) =>
19+
throw new NotImplementedException();
20+
public static CalculatorPageConverter Singleton { get; } = new CalculatorPageConverter();
21+
}
22+
}

CSharpMath.Avalonia/CSharpMath.Avalonia.csproj

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@
1010
<ItemGroup>
1111
<Compile Update="**\*.xaml.cs" DependentUpon="%(Filename)" />
1212
<AvaloniaResource Include="**\*.xaml" />
13-
<PackageReference Include="Avalonia" Version="0.10.0-preview1" />
13+
<PackageReference Include="Avalonia" Version="0.10.0-preview2" />
14+
<ProjectReference Include="..\CSharpMath.Evaluation\CSharpMath.Evaluation.csproj" />
1415
<ProjectReference Include="..\CSharpMath.Rendering\CSharpMath.Rendering.csproj" />
1516
</ItemGroup>
1617

0 commit comments

Comments
 (0)