diff --git a/CSharpMath.Analyzers/CSharpMath.Analyzers.Test/CSharpMath.Analyzers.Test.csproj b/CSharpMath.Analyzers/CSharpMath.Analyzers.Test/CSharpMath.Analyzers.Test.csproj
index c3e932d4..d7e92ae2 100644
--- a/CSharpMath.Analyzers/CSharpMath.Analyzers.Test/CSharpMath.Analyzers.Test.csproj
+++ b/CSharpMath.Analyzers/CSharpMath.Analyzers.Test/CSharpMath.Analyzers.Test.csproj
@@ -9,7 +9,7 @@
all
runtime; build; native; contentfiles; analyzers
-
+
diff --git a/CSharpMath.Analyzers/CSharpMath.Analyzers/CSharpMath.Analyzers.csproj b/CSharpMath.Analyzers/CSharpMath.Analyzers/CSharpMath.Analyzers.csproj
index a16db676..57dd7890 100644
--- a/CSharpMath.Analyzers/CSharpMath.Analyzers/CSharpMath.Analyzers.csproj
+++ b/CSharpMath.Analyzers/CSharpMath.Analyzers/CSharpMath.Analyzers.csproj
@@ -24,7 +24,7 @@
-
+
diff --git a/CSharpMath.Editor/CSharpMath.Editor.csproj b/CSharpMath.Editor/CSharpMath.Editor.csproj
index 5b753f3d..de2a92ef 100644
--- a/CSharpMath.Editor/CSharpMath.Editor.csproj
+++ b/CSharpMath.Editor/CSharpMath.Editor.csproj
@@ -3,7 +3,7 @@
true
netstandard1.3
latest
- 0.2.0-alpha2
+ 0.2.0-alpha3
The 0.2.0 Editor Update brings an editor interface to CSharpMath.
The base code for a What You See Is What You Get math editor.
CSharpMath.Editor
@@ -16,7 +16,7 @@
git
https://github.com/verybadcat/CSharpMath.git
master
- f7790129228ab88cb4af2ebcfd725383488bd527
+ 5751094f494526c7463a7aaef8f531dcc44ef213
false
© CSharpMath Contributors 2018
diff --git a/CSharpMath.Editor/Interfaces/IMathListIndex.cs b/CSharpMath.Editor/Interfaces/IMathListIndex.cs
index 49b68221..008a4f2d 100644
--- a/CSharpMath.Editor/Interfaces/IMathListIndex.cs
+++ b/CSharpMath.Editor/Interfaces/IMathListIndex.cs
@@ -3,31 +3,6 @@
using System.Text;
namespace CSharpMath.Editor {
- /**
- @typedef MTMathListSubIndexType
- @brief The type of the subindex.
-
- The type of the subindex denotes what branch the path to the atom that this index points to takes.
- */
- public enum MathListSubIndexType : byte {
- /// The index denotes the whole atom, subIndex is nil.
- None = 0,
- /// The position in the subindex is an index into the nucleus
- Nucleus,
- /// The subindex indexes into the superscript.
- Superscript,
- /// The subindex indexes into the subscript
- Subscript,
- /// The subindex indexes into the numerator (only valid for fractions)
- Numerator,
- /// The subindex indexes into the denominator (only valid for fractions)
- Denominator,
- /// The subindex indexes into the radicand (only valid for radicals)
- Radicand,
- /// The subindex indexes into the degree (only valid for radicals)
- Degree
- }
-
/**
* An index that points to a particular character in the MTMathList. The index is a LinkedList that represents
* a path from the beginning of the MTMathList to reach a particular atom in the list. The next node of the path
diff --git a/CSharpMath.Editor/Keyboards/DefaultMathKeyboardView.cs b/CSharpMath.Editor/Keyboards/DefaultMathKeyboardView.cs
index 7b88dd86..d85f7348 100644
--- a/CSharpMath.Editor/Keyboards/DefaultMathKeyboardView.cs
+++ b/CSharpMath.Editor/Keyboards/DefaultMathKeyboardView.cs
@@ -20,17 +20,17 @@ public static MathKeyboardView Default(ButtonCtor ctor, Func(layoutCtor,
registerPressed,
new RectangleF(0, 45, 320, 180),
-#warning Replace "⸋⁄□" with image
- ctor(new RectangleF(0, 90, 49.5f, 45), "⸋⁄□", 18, ToBeReplacedWithImage, DefaultShadow, ToBeReplacedWithImage, null),
- ctor(new RectangleF(199, 45, 49, 45), Constants.Symbols.Multiplication.ToString(), DefaultFontSize, DefaultTitle, DefaultShadow, DefaultHighlight, null),
+#warning Replace Constants.KeyboardSymbols.Fraction with image
+ ctor(new RectangleF(0, 90, 49.5f, 45), Constants.KeyboardSymbols.Fraction, 18, ToBeReplacedWithImage, DefaultShadow, ToBeReplacedWithImage, null),
+ ctor(new RectangleF(199, 45, 49, 45), Constants.Symbols.Multiplication, DefaultFontSize, DefaultTitle, DefaultShadow, DefaultHighlight, null),
ctor(new RectangleF(149, 135, 50, 45), "=", 25, DefaultTitle, DefaultShadow, DefaultHighlight, DefaultDisabled),
- ctor(new RectangleF(199, 0, 49, 45), Constants.Symbols.Division.ToString(), DefaultFontSize, DefaultTitle, DefaultShadow, DefaultHighlight, null),
-#warning Replace "⬜⸋" with image
- ctor(new RectangleF(0, 135, 50, 45), "⬜⸋", 18, ToBeReplacedWithImage, DefaultShadow, ToBeReplacedWithImage, null),
+ ctor(new RectangleF(199, 0, 49, 45), Constants.Symbols.Division, DefaultFontSize, DefaultTitle, DefaultShadow, DefaultHighlight, null),
+#warning Replace Constants.KeyboardSymbols.Exponent with image
+ ctor(new RectangleF(0, 135, 50, 45), Constants.KeyboardSymbols.Exponent, 18, ToBeReplacedWithImage, DefaultShadow, ToBeReplacedWithImage, null),
null,
null,
null,
@@ -65,26 +65,26 @@ public static MathKeyboardView Default(ButtonCtor ctor, Func(layoutCtor,
registerPressed,
new RectangleF(0, 45, 320, 180),
- ctor(new RectangleF(0, 90, 50, 45), "⸋⁄□", 18, ToBeReplacedWithImage, DefaultShadow, ToBeReplacedWithImage, null),
+ ctor(new RectangleF(0, 90, 50, 45), Constants.KeyboardSymbols.Fraction, 18, ToBeReplacedWithImage, DefaultShadow, ToBeReplacedWithImage, null),
null,
null,
null,
-#warning Replace "⬜⸋" with image
- ctor(new RectangleF(0, 135, 50, 45), "⬜⸋", 18, ToBeReplacedWithImage, DefaultShadow, ToBeReplacedWithImage, null),
+#warning Replace Constants.KeyboardSymbols.Exponent with image
+ ctor(new RectangleF(0, 135, 50, 45), Constants.KeyboardSymbols.Exponent, 18, ToBeReplacedWithImage, DefaultShadow, ToBeReplacedWithImage, null),
null,
null,
null,
null,
null,
- ctor(new RectangleF(150, 90, 49, 45), $"|⬜|", 24, DefaultTitle, DefaultShadow, DefaultHighlight, null),
+ ctor(new RectangleF(150, 90, 49, 45), Constants.KeyboardSymbols.Absolute, 24, DefaultTitle, DefaultShadow, DefaultHighlight, null),
null,
new[] {
ctor(new RectangleF(0, 0, 50, 45), "x", DefaultFontSize, DefaultTitle, DefaultShadow, DefaultHighlight, null),
@@ -94,14 +94,14 @@ public static MathKeyboardView Default(ButtonCtor ctor, Func", DefaultFontSize, DefaultTitle, DefaultShadow, DefaultHighlight, null),
ctor(new RectangleF(150, 135, 49, 45), ":", DefaultFontSize, DefaultTitle, DefaultShadow, DefaultHighlight, null),
ctor(new RectangleF(199, 135, 50, 45), ",", DefaultFontSize, DefaultTitle, DefaultShadow, DefaultHighlight, null),
@@ -115,24 +115,24 @@ public static MathKeyboardView Default(ButtonCtor ctor, Func", DefaultFontSize, DefaultTitleBar, DefaultShadow, DefaultHighlight, null),
new MathKeyboard(layoutCtor,
registerPressed,
new RectangleF(0, 45, 320, 180),
- ctor(new RectangleF(0, 90, 49.5f, 45), "⸋⁄□", 18, ToBeReplacedWithImage, DefaultShadow, ToBeReplacedWithImage, null),
+ ctor(new RectangleF(0, 90, 49.5f, 45), Constants.KeyboardSymbols.Fraction, 18, ToBeReplacedWithImage, DefaultShadow, ToBeReplacedWithImage, null),
null,
null,
null,
- ctor(new RectangleF(0, 135, 50, 45), "⬜⸋", 18, ToBeReplacedWithImage, DefaultShadow, ToBeReplacedWithImage, null),
- ctor(new RectangleF(50, 135, 50, 45), "⎵", DefaultFontSize, ToBeReplacedWithImage, DefaultShadow, ToBeReplacedWithImage, null),
+ ctor(new RectangleF(0, 135, 50, 45), Constants.KeyboardSymbols.Exponent, 18, ToBeReplacedWithImage, DefaultShadow, ToBeReplacedWithImage, null),
+ ctor(new RectangleF(50, 135, 50, 45), Constants.KeyboardSymbols.Subscript, DefaultFontSize, ToBeReplacedWithImage, DefaultShadow, ToBeReplacedWithImage, null),
null,
- ctor(new RectangleF(100, 135, 50, 45), "√⬜", DefaultFontSize, ToBeReplacedWithImage, DefaultShadow, ToBeReplacedWithImage, null),
- ctor(new RectangleF(150, 135, 49, 45), "⸋√⬜", DefaultFontSize, ToBeReplacedWithImage, DefaultShadow, ToBeReplacedWithImage, DefaultDisabled),
- ctor(new RectangleF(150, 90, 49, 45), "ˡᵒᵍ▫", DefaultFontSize, ToBeReplacedWithImage, DefaultShadow, ToBeReplacedWithImage, null),
+ ctor(new RectangleF(100, 135, 50, 45), Constants.KeyboardSymbols.SquareRoot, DefaultFontSize, ToBeReplacedWithImage, DefaultShadow, ToBeReplacedWithImage, null),
+ ctor(new RectangleF(150, 135, 49, 45), Constants.KeyboardSymbols.NthRoot, DefaultFontSize, ToBeReplacedWithImage, DefaultShadow, ToBeReplacedWithImage, DefaultDisabled),
+ ctor(new RectangleF(150, 90, 49, 45), Constants.KeyboardSymbols.LogBase, DefaultFontSize, ToBeReplacedWithImage, DefaultShadow, ToBeReplacedWithImage, null),
null,
null,
new[] {
@@ -164,9 +164,9 @@ public static MathKeyboardView Default(ButtonCtor ctor, Func(layoutCtor,
@@ -221,12 +221,12 @@ public static MathKeyboardView Default(ButtonCtor ctor, Func layoutCtor, Action regi
layout = layoutCtor();
layout.Bounds = bounds;
if (fractionButton != null) {
- registerPressed(fractionButton, delegate { keyPressed(Symbols.FractionSlash); });
+ registerPressed(fractionButton, delegate { KeyPressed(Symbols.FractionSlash); });
layout.Add(fractionButton);
}
if (multiplyButton != null) {
- registerPressed(multiplyButton, delegate { keyPressed(Symbols.Multiplication); });
+ registerPressed(multiplyButton, delegate { KeyPressed(Symbols.Multiplication); });
layout.Add(multiplyButton);
}
if (equalsButton != null) {
- registerPressed(equalsButton, delegate { keyPressed('='); });
+ registerPressed(equalsButton, delegate { KeyPressed("="); });
layout.Add(equalsButton);
}
if (divisionButton != null) {
- registerPressed(divisionButton, delegate { keyPressed(Symbols.Division); });
+ registerPressed(divisionButton, delegate { KeyPressed(Symbols.Division); });
layout.Add(divisionButton);
}
if (exponentButton != null) {
- registerPressed(exponentButton, delegate { keyPressed('^'); });
+ registerPressed(exponentButton, delegate { KeyPressed("^"); });
layout.Add(exponentButton);
}
if(subscriptButton != null){
- registerPressed(subscriptButton, delegate { keyPressed('_'); });
+ registerPressed(subscriptButton, delegate { KeyPressed("_"); });
layout.Add(subscriptButton);
}
if (shiftButton != null) {
- registerPressed(shiftButton, delegate { shiftPressed(); });
+ registerPressed(shiftButton, delegate { ShiftPressed(); });
layout.Add(shiftButton);
}
if (squareRootButton != null) {
- registerPressed(squareRootButton, delegate { keyPressed(Symbols.SquareRoot); });
+ registerPressed(squareRootButton, delegate { KeyPressed(Symbols.SquareRoot); });
layout.Add(squareRootButton);
}
if (radicalButton != null) {
- registerPressed(radicalButton, delegate { keyPressed(Symbols.CubeRoot); });
+ registerPressed(radicalButton, delegate { KeyPressed(Symbols.CubeRoot); });
layout.Add(radicalButton);
}
if (logBaseButton != null) {
- registerPressed(logBaseButton, delegate { keyPressed("log"); keyPressed("_"); });
+ registerPressed(logBaseButton, delegate { KeyPressed("log"); KeyPressed("_"); });
layout.Add(logBaseButton);
}
if(absButton != null){
- registerPressed(absButton, delegate { keyPressed("||"); });
+ registerPressed(absButton, delegate { KeyPressed("||"); });
layout.Add(absButton);
}
foreach (var button in (numbers ?? Array.Empty()).Concat(variables ?? Array.Empty()).Concat(operators ?? Array.Empty()).Concat(relations ?? Array.Empty()).Concat(letters ?? Array.Empty()).Concat(greekLetters ?? Array.Empty()) ?? Array.Empty()) {
- registerPressed(button, delegate { keyPressed(button.Text); });
+ registerPressed(button, delegate { KeyPressed(button.Text); });
layout.Add(button);
}
if (alphaRho != null) {
- registerPressed(alphaRho, delegate { keyPressed(alphaRho.Text); });
+ registerPressed(alphaRho, delegate { KeyPressed(alphaRho.Text); });
layout.Add(alphaRho);
}
if (deltaOmega != null) {
- registerPressed(deltaOmega, delegate { keyPressed(deltaOmega.Text); });
+ registerPressed(deltaOmega, delegate { KeyPressed(deltaOmega.Text); });
layout.Add(deltaOmega);
}
if (sigmaPhi != null) {
- registerPressed(sigmaPhi, delegate { keyPressed(sigmaPhi.Text); });
+ registerPressed(sigmaPhi, delegate { KeyPressed(sigmaPhi.Text); });
layout.Add(sigmaPhi);
}
if (muNu != null) {
- registerPressed(muNu, delegate { keyPressed(muNu.Text); });
+ registerPressed(muNu, delegate { KeyPressed(muNu.Text); });
layout.Add(muNu);
}
if (lambdaBeta != null) {
- registerPressed(lambdaBeta, delegate { keyPressed(lambdaBeta.Text); });
+ registerPressed(lambdaBeta, delegate { KeyPressed(lambdaBeta.Text); });
layout.Add(lambdaBeta);
}
if (backspace != null) {
- registerPressed(backspace, delegate { backspacePressed(); });
+ registerPressed(backspace, delegate { BackspacePressed(); });
layout.Add(backspace);
}
if (dismiss != null) {
- registerPressed(dismiss, dismissPressed);
+ registerPressed(dismiss, DismissPressed);
layout.Add(dismiss);
}
if (enter != null) {
- registerPressed(enter, delegate { keyPressed('\n'); });
+ registerPressed(enter, delegate { KeyPressed("\n"); });
layout.Add(enter);
}
@@ -111,8 +111,9 @@ public MathKeyboard(Func layoutCtor, Action regi
}
public readonly TLayout layout;
- public Action insertText;
- public Action delete;
+ public event Action InsertText;
+ public event Action Delete;
+ public event EventHandler DismissPressed = delegate { };
public TButton fractionButton; //(weak)
public TButton multiplyButton; //(weak)
public TButton equalsButton; //(weak)
@@ -137,20 +138,14 @@ public MathKeyboard(Func layoutCtor, Action regi
public TButton _sigmaPhi; //(weak)
public TButton _muNu; //(weak)
public TButton _lambdaBeta; //(weak)
-
- public event EventHandler textChanged = delegate { };
- public event EventHandler dismissPressed = delegate { };
-
- public void keyPressed(char key) =>
- insertText(key.ToString());
-
- public void keyPressed(string key) =>
- insertText(key);
- public void backspacePressed() =>
- delete();
- public void parensPressed() =>
- insertText("()");
- public void shiftPressed() {
+
+ public void KeyPressed(string key) =>
+ InsertText?.Invoke(key);
+ public void BackspacePressed() =>
+ Delete?.Invoke();
+ public void ParensPressed() =>
+ KeyPressed("()");
+ public void ShiftPressed() {
Shifted ^= true;
if (Shifted) {
foreach (var button in letters)
diff --git a/CSharpMath.Editor/MathListIndex.cs b/CSharpMath.Editor/MathListIndex.cs
index 4db69025..eebe3ddb 100644
--- a/CSharpMath.Editor/MathListIndex.cs
+++ b/CSharpMath.Editor/MathListIndex.cs
@@ -1,4 +1,28 @@
namespace CSharpMath.Editor {
+ /**
+ @typedef MTMathListSubIndexType
+ @brief The type of the subindex.
+
+ The type of the subindex denotes what branch the path to the atom that this index points to takes.
+ */
+ public enum MathListSubIndexType : byte {
+ /// The index denotes the whole atom, subIndex is nil.
+ None = 0,
+ /// The position in the subindex is an index into the nucleus
+ Nucleus,
+ /// The subindex indexes into the superscript.
+ Superscript,
+ /// The subindex indexes into the subscript
+ Subscript,
+ /// The subindex indexes into the numerator (only valid for fractions)
+ Numerator,
+ /// The subindex indexes into the denominator (only valid for fractions)
+ Denominator,
+ /// The subindex indexes into the radicand (only valid for radicals)
+ Radicand,
+ /// The subindex indexes into the degree (only valid for radicals)
+ Degree
+ }
public class MathListIndex : IMathListIndex {
private MathListIndex() { }
@@ -8,27 +32,19 @@ private MathListIndex() { }
[NullableReference]
public MathListIndex SubIndex { get; set; }
- public static MathListIndex Level0Index(int index) =>
- new MathListIndex {
- AtomIndex = index
- };
-
- public static MathListIndex IndexAtLocation(int location, [NullableReference]MathListIndex subIndex, MathListSubIndexType type) {
- var index = Level0Index(location);
- index.SubIndexType = type;
- index.SubIndex = subIndex;
- return index;
- }
+ public static MathListIndex Level0Index(int index) => new MathListIndex { AtomIndex = index };
+ public static MathListIndex IndexAtLocation(int location, [NullableReference]MathListIndex subIndex, MathListSubIndexType type) =>
+ new MathListIndex { AtomIndex = location, SubIndexType = type, SubIndex = subIndex };
public MathListIndex LevelUpWithSubIndex([NullableReference]MathListIndex subIndex, MathListSubIndexType type) {
- if (SubIndexType == MathListSubIndexType.None)
+ if (SubIndexType is MathListSubIndexType.None)
return IndexAtLocation(AtomIndex, subIndex, type);
// we have to recurse
return IndexAtLocation(AtomIndex, SubIndex.LevelUpWithSubIndex(subIndex, type), SubIndexType);
}
[NullableReference]
public MathListIndex LevelDown() {
- if (SubIndexType == MathListSubIndexType.None) {
+ if (SubIndexType is MathListSubIndexType.None) {
return null;
}
// recurse
@@ -73,8 +89,7 @@ public bool HasSubIndexOfType(MathListSubIndexType subIndexType) {
}
public bool AtBeginningOfLine => FinalIndex is 0;
-
-
+
public bool AtSameLevel(MathListIndex other) {
if (SubIndexType != other.SubIndexType) {
return false;
diff --git a/CSharpMath.Forms.EditorUnitTests/CSharpMath.Forms.EditorUnitTests.UWP/CSharpMath.Forms.EditorUnitTests.UWP.csproj b/CSharpMath.Forms.EditorUnitTests/CSharpMath.Forms.EditorUnitTests.UWP/CSharpMath.Forms.EditorUnitTests.UWP.csproj
index a12716ee..77237ab0 100644
--- a/CSharpMath.Forms.EditorUnitTests/CSharpMath.Forms.EditorUnitTests.UWP/CSharpMath.Forms.EditorUnitTests.UWP.csproj
+++ b/CSharpMath.Forms.EditorUnitTests/CSharpMath.Forms.EditorUnitTests.UWP/CSharpMath.Forms.EditorUnitTests.UWP.csproj
@@ -144,7 +144,7 @@
-
+
diff --git a/CSharpMath.Forms.Example/CSharpMath.Forms.Example.Android/CSharpMath.Forms.Example.Android.csproj b/CSharpMath.Forms.Example/CSharpMath.Forms.Example.Android/CSharpMath.Forms.Example.Android.csproj
index 420df492..489d1461 100644
--- a/CSharpMath.Forms.Example/CSharpMath.Forms.Example.Android/CSharpMath.Forms.Example.Android.csproj
+++ b/CSharpMath.Forms.Example/CSharpMath.Forms.Example.Android/CSharpMath.Forms.Example.Android.csproj
@@ -56,7 +56,7 @@
4.5.1
- 4.5.1
+ 4.5.2
diff --git a/CSharpMath.Forms.Example/CSharpMath.Forms.Example.UWP/CSharpMath.Forms.Example.UWP.csproj b/CSharpMath.Forms.Example/CSharpMath.Forms.Example.UWP/CSharpMath.Forms.Example.UWP.csproj
index 66eafb23..73b401c4 100644
--- a/CSharpMath.Forms.Example/CSharpMath.Forms.Example.UWP/CSharpMath.Forms.Example.UWP.csproj
+++ b/CSharpMath.Forms.Example/CSharpMath.Forms.Example.UWP/CSharpMath.Forms.Example.UWP.csproj
@@ -172,7 +172,7 @@
- 6.1.9
+ 6.2.2
diff --git a/CSharpMath.Forms/CSharpMath.Forms.csproj b/CSharpMath.Forms/CSharpMath.Forms.csproj
index 1df4a289..2127f04c 100644
--- a/CSharpMath.Forms/CSharpMath.Forms.csproj
+++ b/CSharpMath.Forms/CSharpMath.Forms.csproj
@@ -3,13 +3,13 @@
netstandard2.0
latest
true
- 0.2.0-alpha2
+ 0.2.0-alpha3
CSharpMath Contributors (verybadcat, Happypig375, charlesroddie, FoggyFinder)
The 0.2.0 Editor Update brings an editor interface to CSharpMath.
git
https://github.com/verybadcat/CSharpMath.git
master
- f7790129228ab88cb4af2ebcfd725383488bd527
+ 5751094f494526c7463a7aaef8f531dcc44ef213
https://github.com/verybadcat/CSharpMath
https://github.com/verybadcat/CSharpMath/blob/master/LICENSE
https://raw.githubusercontent.com/verybadcat/CSharpMath/master/Icon.png
diff --git a/CSharpMath.Ios/CSharpMath.Ios.csproj b/CSharpMath.Ios/CSharpMath.Ios.csproj
index 7e332777..cba26c21 100644
--- a/CSharpMath.Ios/CSharpMath.Ios.csproj
+++ b/CSharpMath.Ios/CSharpMath.Ios.csproj
@@ -14,7 +14,7 @@
true
CSharpMath.Ios
- 0.2.0-alpha2
+ 0.2.0-alpha3
CSharpMath Contributors (verybadcat, Happypig375, charlesroddie, FoggyFinder)
en
https://github.com/verybadcat/CSharpMath/blob/master/LICENSE
@@ -28,7 +28,7 @@
https://github.com/verybadcat/CSharpMath.git
true
master
- f7790129228ab88cb4af2ebcfd725383488bd527
+ 5751094f494526c7463a7aaef8f531dcc44ef213
false
https://raw.githubusercontent.com/verybadcat/CSharpMath/master/Icon.png
diff --git a/CSharpMath.NuGetPackageTests.CSharp/CSharpMath.NuGetPackageTests.CSharp.UWP/CSharpMath.NuGetPackageTests.CSharp.UWP.csproj b/CSharpMath.NuGetPackageTests.CSharp/CSharpMath.NuGetPackageTests.CSharp.UWP/CSharpMath.NuGetPackageTests.CSharp.UWP.csproj
index 6ac29a61..d9199ab0 100644
--- a/CSharpMath.NuGetPackageTests.CSharp/CSharpMath.NuGetPackageTests.CSharp.UWP/CSharpMath.NuGetPackageTests.CSharp.UWP.csproj
+++ b/CSharpMath.NuGetPackageTests.CSharp/CSharpMath.NuGetPackageTests.CSharp.UWP/CSharpMath.NuGetPackageTests.CSharp.UWP.csproj
@@ -144,7 +144,7 @@
-
+
diff --git a/CSharpMath.Rendering/CSharpMath.Rendering.csproj b/CSharpMath.Rendering/CSharpMath.Rendering.csproj
index 045728ff..30efbe43 100644
--- a/CSharpMath.Rendering/CSharpMath.Rendering.csproj
+++ b/CSharpMath.Rendering/CSharpMath.Rendering.csproj
@@ -11,7 +11,7 @@
true
CSharpMath.Rendering
- 0.2.0-alpha2
+ 0.2.0-alpha3
CSharpMath Contributors (verybadcat, Happypig375, charlesroddie, FoggyFinder)
https://github.com/verybadcat/CSharpMath/blob/master/LICENSE
https://github.com/verybadcat/CSharpMath
@@ -24,7 +24,7 @@
true
https://github.com/verybadcat/CSharpMath.git
master
- f7790129228ab88cb4af2ebcfd725383488bd527
+ 5751094f494526c7463a7aaef8f531dcc44ef213
false
https://raw.githubusercontent.com/verybadcat/CSharpMath/master/Icon.png
diff --git a/CSharpMath.Rendering/Editor/EditableMathPainter.cs b/CSharpMath.Rendering/Editor/EditableMathPainter.cs
index daf96232..8e7d1c3a 100644
--- a/CSharpMath.Rendering/Editor/EditableMathPainter.cs
+++ b/CSharpMath.Rendering/Editor/EditableMathPainter.cs
@@ -23,8 +23,8 @@ protected EditableMathPainter(MathKeyboardView keyboard, float
Source = new EditableMathSource(new MathList());
if (keyboard?.Tabs != null)
foreach (var tab in keyboard.Tabs) {
- tab.insertText = InsertText;
- tab.delete = DeleteBackwards;
+ tab.InsertText += InsertText;
+ tab.Delete += DeleteBackwards;
}
}
@@ -150,7 +150,7 @@ public void MoveCaretToPoint(PointF point) {
public static void ClearPlaceholders(Interfaces.IMathList mathList) {
foreach (var atom in (IList)mathList?.Atoms ?? Array.Empty()) {
if (atom.AtomType is Enumerations.MathAtomType.Placeholder)
- atom.Nucleus = Constants.Symbols.WhiteSquare.ToString();
+ atom.Nucleus = Constants.Symbols.WhiteSquare;
if (atom.Superscript is Interfaces.IMathList super)
ClearPlaceholders(super);
if (atom.Subscript is Interfaces.IMathList sub)
@@ -182,7 +182,7 @@ public void InsertionPointChanged() {
ClearPlaceholders(MathList);
var atom = MathList.AtomAt(InsertionIndex);
if (atom?.AtomType is MathAtomType.Placeholder) {
- atom.Nucleus = Symbols.BlackSquare.ToString();
+ atom.Nucleus = Symbols.BlackSquare;
if (InsertionIndex.FinalSubIndexType is MathListSubIndexType.Nucleus) {
// If the insertion index is inside a placeholder, move it out.
InsertionIndex = InsertionIndex.LevelDown();
@@ -194,7 +194,7 @@ public void InsertionPointChanged() {
if (atom != null && atom.AtomType is MathAtomType.Placeholder &&
atom.Superscript is null && atom.Subscript is null) {
InsertionIndex = previousIndex;
- atom.Nucleus = Symbols.BlackSquare.ToString();
+ atom.Nucleus = Symbols.BlackSquare;
// TODO - disable caret
}
}
@@ -289,12 +289,13 @@ public bool UpdatePlaceholderIfPresent(IMathAtom atom) {
return false;
}
- public static MathAtom AtomForCharacter(char c) {
+ public static MathAtom AtomForCharacter(string firstChar) {
+ var c = firstChar[0];
// Get the basic conversion from MathAtoms, and then special case unicode characters and latex special characters.
- switch (c) {
+ switch (firstChar) {
//https://github.com/kostub/MathEditor/blob/61f67c6224000c224e252f6eeba483003f11d3d5/mathEditor/editor/MTEditableMathLabel.m#L414
case Symbols.Multiplication:
- case '*':
+ case "*":
return MathAtoms.Times;
case Symbols.SquareRoot:
return MathAtoms.PlaceholderSquareRoot;
@@ -303,13 +304,13 @@ public static MathAtom AtomForCharacter(char c) {
case Symbols.Angle:
return MathAtoms.Create(MathAtomType.Ordinary, c);
case Symbols.Division:
- case '/':
+ case "/":
return MathAtoms.Divide;
case Symbols.FractionSlash:
return MathAtoms.PlaceholderFraction;
- case '{':
+ case "{":
return MathAtoms.Create(MathAtomType.Open, c);
- case '}':
+ case "}":
return MathAtoms.Create(MathAtomType.Close, c);
case Symbols.GreaterEqual:
case Symbols.LessEqual:
@@ -321,8 +322,8 @@ public static MathAtom AtomForCharacter(char c) {
// Including capital greek letters
return MathAtoms.Create(MathAtomType.Variable, c);
case var _ when c < '\x21' || c > '\x7E':
- case '\'':
- case '~':
+ case "'":
+ case "~":
// Not ascii
return null;
case var _ when MathAtoms.ForCharacter(c) is MathAtom atom:
@@ -445,7 +446,7 @@ void HandleSlashButton() {
}
if (current.AtomIndex == InsertionIndex.AtomIndex) {
// so we didn't really find any numbers before this, so make the numerator 1
- numerator.Add(AtomForCharacter('1'));
+ numerator.Add(AtomForCharacter("1"));
if (!current.AtBeginningOfLine) {
var prevAtom = MathList.AtomAt(current.Previous);
if (prevAtom.AtomType is MathAtomType.Fraction) {
@@ -468,15 +469,15 @@ void HandleSlashButton() {
}
void InsertParens() {
- MathList.Insert(InsertionIndex, AtomForCharacter('('));
+ MathList.Insert(InsertionIndex, AtomForCharacter("("));
InsertionIndex = InsertionIndex.Next;
- MathList.Insert(InsertionIndex, AtomForCharacter(')'));
+ MathList.Insert(InsertionIndex, AtomForCharacter(")"));
// Don't go to the next insertion index, to start inserting before the close parens.
}
void InsertAbsValue() {
- MathList.Insert(InsertionIndex, AtomForCharacter('|'));
+ MathList.Insert(InsertionIndex, AtomForCharacter("|"));
InsertionIndex = InsertionIndex.Next;
- MathList.Insert(InsertionIndex, AtomForCharacter('|'));
+ MathList.Insert(InsertionIndex, AtomForCharacter("|"));
// Don't go to the next insertion index, to start inserting before the second absolute value
}
@@ -486,13 +487,12 @@ void InsertAbsValue() {
ReturnPressed?.Invoke(this, EventArgs.Empty);
return;
}
- var ch = str[0];
- var atom = str.Length > 1 ? MathAtoms.ForLatexSymbolName(str) : AtomForCharacter(ch);
+ var atom = str.Length > 1 ? MathAtoms.ForLatexSymbolName(str) : AtomForCharacter(str);
if (InsertionIndex.SubIndexType is MathListSubIndexType.Denominator && atom.AtomType is MathAtomType.Relation)
// pull the insertion index out
InsertionIndex = InsertionIndex.LevelDown().Next;
- switch (ch) {
- case '^':
+ switch (str) {
+ case "^":
// Special ^ handling - adds an exponent
HandleExponentButton();
break;
@@ -502,17 +502,17 @@ void InsertAbsValue() {
case Symbols.CubeRoot:
HandleRadical(true);
break;
- case '_':
+ case "_":
HandleSubscriptButton();
break;
- case '/':
+ case "/":
HandleSlashButton();
break;
- case var _ when str is "()":
+ case "()":
RemovePlaceholderIfPresent();
InsertParens();
break;
- case var _ when str is "||":
+ case "||":
RemovePlaceholderIfPresent();
InsertAbsValue();
break;
diff --git a/CSharpMath.SkiaSharp/CSharpMath.SkiaSharp.csproj b/CSharpMath.SkiaSharp/CSharpMath.SkiaSharp.csproj
index 176adddb..4b87d1de 100644
--- a/CSharpMath.SkiaSharp/CSharpMath.SkiaSharp.csproj
+++ b/CSharpMath.SkiaSharp/CSharpMath.SkiaSharp.csproj
@@ -3,13 +3,13 @@
netstandard1.3
latest
true
- 0.2.0-alpha2
+ 0.2.0-alpha3
CSharpMath Contributors (verybadcat, Happypig375, charlesroddie, FoggyFinder)
The 0.2.0 Editor Update brings an editor interface to CSharpMath.
git
https://github.com/verybadcat/CSharpMath.git
master
- f7790129228ab88cb4af2ebcfd725383488bd527
+ 5751094f494526c7463a7aaef8f531dcc44ef213
https://github.com/verybadcat/CSharpMath
false
https://github.com/verybadcat/CSharpMath/blob/master/LICENSE
diff --git a/CSharpMath.Utils.NuGet/ReleaseData.xml b/CSharpMath.Utils.NuGet/ReleaseData.xml
index 6b60599a..848aa74e 100644
--- a/CSharpMath.Utils.NuGet/ReleaseData.xml
+++ b/CSharpMath.Utils.NuGet/ReleaseData.xml
@@ -2,13 +2,13 @@
<_Global->
true
- 0.2.0-alpha2
+ 0.2.0-alpha3
CSharpMath Contributors (verybadcat, Happypig375, charlesroddie, FoggyFinder)
The 0.2.0 Editor Update brings an editor interface to CSharpMath.
git
https://github.com/verybadcat/CSharpMath.git
master
- f7790129228ab88cb4af2ebcfd725383488bd527
+ 5751094f494526c7463a7aaef8f531dcc44ef213
https://github.com/verybadcat/CSharpMath
false
https://github.com/verybadcat/CSharpMath/blob/master/LICENSE
diff --git a/CSharpMath/CSharpMath.csproj b/CSharpMath/CSharpMath.csproj
index 8dbf001c..3e88e7c2 100644
--- a/CSharpMath/CSharpMath.csproj
+++ b/CSharpMath/CSharpMath.csproj
@@ -12,9 +12,9 @@
https://github.com/verybadcat/CSharpMath/blob/master/LICENSE
© CSharpMath Contributors 2018
math;mathematics;mathematical;formula;equation;equations;expression;tex;latex;render;rendering;display
- 0.2.0-alpha2
+ 0.2.0-alpha3
master
- f7790129228ab88cb4af2ebcfd725383488bd527
+ 5751094f494526c7463a7aaef8f531dcc44ef213
false
https://raw.githubusercontent.com/verybadcat/CSharpMath/master/Icon.png
CSharpMath
@@ -38,6 +38,7 @@
+
\ No newline at end of file
diff --git a/CSharpMath/Constants/Symbols.cs b/CSharpMath/Constants/Symbols.cs
index 671b5144..25c98911 100644
--- a/CSharpMath/Constants/Symbols.cs
+++ b/CSharpMath/Constants/Symbols.cs
@@ -4,18 +4,33 @@
namespace CSharpMath.Constants {
public static class Symbols {
- public const char Multiplication = '\u00D7';
- public const char Division = '\u00F7';
- public const char FractionSlash = '\u2044';
- public const char WhiteSquare = '\u25A1';
- public const char BlackSquare = '\u25A0';
- public const char LessEqual = '\u2264';
- public const char GreaterEqual = '\u2265';
- public const char NotEqual = '\u2260';
- public const char SquareRoot = '\u221A'; // \sqrt
- public const char CubeRoot = '\u221B';
- public const char Infinity = '\u221E'; // \infty
- public const char Angle = '\u2220'; // \angle
- public const char Degree = '\u00B0'; // \circ
+ public const string Multiplication = "\u00D7";
+ public const string Division = "\u00F7";
+ public const string FractionSlash = "\u2044";
+ public const string WhiteSquare = "\u25A1";
+ public const string BlackSquare = "\u25A0";
+ public const string LessEqual = "\u2264";
+ public const string GreaterEqual = "\u2265";
+ public const string NotEqual = "\u2260";
+ public const string SquareRoot = "\u221A"; // \sqrt
+ public const string CubeRoot = "\u221B";
+ public const string Infinity = "\u221E"; // \infty
+ public const string Angle = "\u2220"; // \angle
+ public const string Degree = "\u00B0"; // \circ
+ }
+ public static class KeyboardSymbols {
+ public const string Left = "◄";
+ public const string Right = "►";
+ public const string Back = "🔙";
+ public const string Dismiss = "🚫";
+ public const string Enter = "⏎";
+
+ public const string Fraction = "⸋⁄□";
+ public const string Exponent = "⬜⸋";
+ public const string Subscript = "⎵";
+ public const string SquareRoot = "√⬜";
+ public const string NthRoot = "⸋√⬜";
+ public const string LogBase = "ˡᵒᵍ▫";
+ public const string Absolute = "|⬜|";
}
}
diff --git a/CSharpMath/Typesetting/Typesetter.cs b/CSharpMath/Typesetting/Typesetter.cs
index 16ba9a8b..a117636a 100644
--- a/CSharpMath/Typesetting/Typesetter.cs
+++ b/CSharpMath/Typesetting/Typesetter.cs
@@ -855,7 +855,7 @@ private IDownshiftableDisplay _FindGlyphForBoundary(string delimi
private IDownshiftableDisplay _GetRadicalGlyph(float radicalHeight) {
#warning GlyphFinder.FindGlyph
- TGlyph radicalGlyph = _context.GlyphFinder.FindGlyphForCharacterAtIndex(_font, 0, Constants.Symbols.SquareRoot.ToString());
+ TGlyph radicalGlyph = _context.GlyphFinder.FindGlyphForCharacterAtIndex(_font, 0, Constants.Symbols.SquareRoot);
TGlyph glyph = _FindGlyph(radicalGlyph, radicalHeight, out float glyphAscent, out float glyphDescent, out float glyphWidth);
IDownshiftableDisplay glyphDisplay = null;