Skip to content

Commit

Permalink
Change AngouriMath reference to use NuGet package instead of git subm…
Browse files Browse the repository at this point in the history
…odule (#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)
  • Loading branch information
Happypig375 authored Jul 29, 2020
1 parent ab9f87c commit aabb520
Show file tree
Hide file tree
Showing 29 changed files with 456 additions and 500 deletions.
1 change: 0 additions & 1 deletion .github/workflows/Test all projects.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ jobs:
"CSharpMath.Rendering.Text.Tests"\
"CSharpMath.Xaml.Tests"\
"CSharpMath.Xaml.Tests.NuGet"\
"AngouriMath/Tests/UnitTests"\
"Typography/Typography.TextBreak/Typography.TextBreak.UnitTests"
do
dotnet add "$p" package Microsoft.NET.Test.Sdk # Update is required for GitHubActionsTestLogger to print anything
Expand Down
3 changes: 0 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,3 @@
[submodule "Wiki"]
path = CSharpMath.Wiki
url = https://github.com/verybadcat/CSharpMath.wiki.git
[submodule "AngouriMath"]
path = AngouriMath
url = https://github.com/asc-community/AngouriMath
1 change: 0 additions & 1 deletion AngouriMath
Submodule AngouriMath deleted from 4bfbd5
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,10 @@
<Compile Update="**\*.xaml.cs" DependentUpon="%(Filename)" />
<AvaloniaResource Include="**\*.xaml" />
<EmbeddedResource Include="..\Icon.png" Link="Icon.png" />
<PackageReference Include="Avalonia.Desktop" Version="0.10.0-preview1" />
<PackageReference Include="Avalonia.Diagnostics" Version="0.10.0-preview1" />
<PackageReference Include="Avalonia.Desktop" Version="0.10.0-preview2" />
<PackageReference Include="Avalonia.Diagnostics" Version="0.10.0-preview2" />
<ProjectReference Include="..\CSharpMath.Avalonia\CSharpMath.Avalonia.csproj" />
<ProjectReference Include="..\CSharpMath.Evaluation\CSharpMath.Evaluation.csproj" />
</ItemGroup>

</Project>
3 changes: 3 additions & 0 deletions CSharpMath.Avalonia.Example/MainView.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@
<TabItem Header="MathButton">
<pages:MathButtonPage />
</TabItem>
<TabItem Header="Calculator">
<pages:CalculatorPage />
</TabItem>
</TabControl>

</DockPanel>
Expand Down
42 changes: 21 additions & 21 deletions CSharpMath.Avalonia.Example/MainView.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
using Avalonia;
using Avalonia.Controls;
using Avalonia.Markup.Xaml;
using Avalonia.Markup.Xaml.Styling;

namespace CSharpMath.Avalonia.Example {
public class MainView : UserControl {
public MainView() {
InitializeComponent();

var light = AvaloniaXamlLoader.Parse<StyleInclude>(@"<StyleInclude xmlns='https://github.com/avaloniaui' Source='avares://Avalonia.Themes.Fluent/Accents/FluentLight.xaml'/>");
var dark = AvaloniaXamlLoader.Parse<StyleInclude>(@"<StyleInclude xmlns='https://github.com/avaloniaui' Source='avares://Avalonia.Themes.Fluent/Accents/FluentDark.xaml'/>");
var themes = this.Find<RadioButton>("lightThemeRbn");
themes.Checked += (sender, e) => Application.Current.Styles[0] = light;
themes.Unchecked += (sender, e) => Application.Current.Styles[0] = dark;
}

private void InitializeComponent() {
AvaloniaXamlLoader.Load(this);
}
}
}
using Avalonia.Controls;
using Avalonia.Markup.Xaml;
using Avalonia.Styling;

namespace CSharpMath.Avalonia.Example {
public class MainView : UserControl {
public MainView() {
InitializeComponent();

var light = (Styles)AvaloniaXamlLoader.Load(new System.Uri("avares://Avalonia.Themes.Fluent/Accents/FluentLight.xaml"));
var dark = (Styles)AvaloniaXamlLoader.Load(new System.Uri("avares://Avalonia.Themes.Fluent/Accents/FluentDark.xaml"));
var themes = this.Find<RadioButton>("lightThemeRbn");
themes.Checked += (sender, e) => Application.Current.Styles[0] = light;
themes.Unchecked += (sender, e) => Application.Current.Styles[0] = dark;
}

private void InitializeComponent() {
AvaloniaXamlLoader.Load(this);
}
}
}
30 changes: 30 additions & 0 deletions CSharpMath.Avalonia.Example/Pages/CalculatorPage.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<UserControl xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:sys="clr-namespace:System;assembly=mscorlib"
xmlns:csmath="clr-namespace:CSharpMath.Avalonia;assembly=CSharpMath.Avalonia"
xmlns:local="clr-namespace:CSharpMath.Avalonia.Example.Pages"
x:Class="CSharpMath.Avalonia.Example.Pages.CalculatorPage">

<ScrollViewer Margin="0, 8" HorizontalScrollBarVisibility="Auto">

<StackPanel Spacing="24">

<StackPanel Spacing="4">

<TextBlock Classes="h1"
Text="CSharpMath.Evaluation.Evaluate" />

<TextBlock Classes="h2"
Text="Evaluates a MathList that can be constructed from LaTeX" />

</StackPanel>

<TextBox Name="input" AcceptsReturn="True" TextWrapping="Wrap" Text="x^4+4x^3+16x^2+4x+1=y" />

<csmath:MathView LaTeX="{Binding #input.Text, Converter={x:Static local:CalculatorPageConverter.Singleton}}" />

</StackPanel>

</ScrollViewer>

</UserControl>
22 changes: 22 additions & 0 deletions CSharpMath.Avalonia.Example/Pages/CalculatorPage.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
using System;
using System.Globalization;
using Avalonia.Controls;
using Avalonia.Data.Converters;
using Avalonia.Markup.Xaml;

namespace CSharpMath.Avalonia.Example.Pages {
public class CalculatorPage : UserControl {
public CalculatorPage() => AvaloniaXamlLoader.Load(this);
}
class CalculatorPageConverter : IValueConverter {
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) =>
value is string latex
? Atom.LaTeXParser.MathListFromLaTeX(latex)
.Bind(list => Evaluation.Interpret(list))
.Match(success => success, error => latex)
: value;
object IValueConverter.ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) =>
throw new NotImplementedException();
public static CalculatorPageConverter Singleton { get; } = new CalculatorPageConverter();
}
}
3 changes: 2 additions & 1 deletion CSharpMath.Avalonia/CSharpMath.Avalonia.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
<ItemGroup>
<Compile Update="**\*.xaml.cs" DependentUpon="%(Filename)" />
<AvaloniaResource Include="**\*.xaml" />
<PackageReference Include="Avalonia" Version="0.10.0-preview1" />
<PackageReference Include="Avalonia" Version="0.10.0-preview2" />
<ProjectReference Include="..\CSharpMath.Evaluation\CSharpMath.Evaluation.csproj" />
<ProjectReference Include="..\CSharpMath.Rendering\CSharpMath.Rendering.csproj" />
</ItemGroup>

Expand Down
Loading

0 comments on commit aabb520

Please sign in to comment.