-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding subscript support (no rendering)
- Loading branch information
FremyCompany_cp
authored and
FremyCompany_cp
committed
Aug 28, 2012
1 parent
71c08e3
commit 991172c
Showing
7 changed files
with
251 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 0 additions & 1 deletion
1
FC.MathEditor/WpfMathEditor/Formatters/Fraction/FractionFormatter.vb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
68 changes: 68 additions & 0 deletions
68
FC.MathEditor/WpfMathEditor/Formatters/SubSupScript/SubSupScriptFormatter.vb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
Public Class SubSupScriptFormatter : Inherits MathElement | ||
|
||
Public Sub New(Optional Base As RowLayoutEngine = Nothing, Optional SubScript As RowLayoutEngine = Nothing, Optional SuperScript As RowLayoutEngine = Nothing) | ||
|
||
If Base Is Nothing Then Base = New RowLayoutEngine() | ||
If SubScript Is Nothing Then SubScript = New RowLayoutEngine() | ||
If SuperScript Is Nothing Then SuperScript = New RowLayoutEngine() | ||
|
||
Children.Add(Base) | ||
Children.Add(SubScript) | ||
Children.Add(SuperScript) | ||
DirectCast(Children, FormatterChildrenHelper).Freeze() | ||
|
||
End Sub | ||
|
||
Public Property Base As RowLayoutEngine | ||
Get | ||
Return Children(0) | ||
End Get | ||
Set(value As RowLayoutEngine) | ||
Children.Replace(Children(0), value) | ||
End Set | ||
End Property | ||
|
||
Public Property SubScript As RowLayoutEngine | ||
Get | ||
Return Children(1) | ||
End Get | ||
Set(value As RowLayoutEngine) | ||
Children.Replace(Children(1), value) | ||
End Set | ||
End Property | ||
|
||
Public Property SuperScript As RowLayoutEngine | ||
Get | ||
Return Children(2) | ||
End Get | ||
Set(value As RowLayoutEngine) | ||
Children.Replace(Children(2), value) | ||
End Set | ||
End Property | ||
|
||
Protected Overrides Function Clone_Internal(ByRef ShouldCloneChildren As Boolean) As MathElement | ||
|
||
If ShouldCloneChildren Then | ||
Dim Result As New SubSupScriptFormatter(Base.Clone, SubScript.Clone, SuperScript.Clone) | ||
ShouldCloneChildren = False | ||
Return Result | ||
Else | ||
Return New SubSupScriptFormatter() | ||
End If | ||
|
||
End Function | ||
|
||
Protected Overrides Function GetInitialChildrenHelper() As ChildrenHelper | ||
Return New FormatterChildrenHelper(Me) | ||
End Function | ||
|
||
Protected Overrides Function GetInitialExportHelper() As ExportHelper | ||
Return New SubSupScriptFormatterExportHelper(Me) | ||
End Function | ||
|
||
Protected Overrides Function GetInitialInputHelper() As InputHelper | ||
' TODO: Input helper for | ||
Return New EmptyInputHelper(Me) | ||
End Function | ||
|
||
End Class |
68 changes: 68 additions & 0 deletions
68
FC.MathEditor/WpfMathEditor/Formatters/SubSupScript/SubSupScriptFormatterExportHelper.vb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
Public Class SubSupScriptFormatterExportHelper : Inherits ExportHelper | ||
|
||
Public Sub New(This As SubSupScriptFormatter) | ||
MyBase.New(This) | ||
End Sub | ||
|
||
Public Shadows ReadOnly Property This As SubSupScriptFormatter | ||
Get | ||
Return MyBase.This | ||
End Get | ||
End Property | ||
|
||
Public Overrides Sub AppendKeyboardInput(SB As System.Text.StringBuilder) | ||
This.Base.Export.AppendKeyboardInput(SB) | ||
SB.Append("_"c) | ||
This.SubScript.Export.AppendKeyboardInput(SB) | ||
End Sub | ||
|
||
Public Overrides Sub AppendLaTeX(SB As System.Text.StringBuilder) | ||
This.Base.Export.AppendLaTeX(SB) | ||
SB.Append("_"c) | ||
This.SubScript.Export.AppendLaTeX(SB) | ||
End Sub | ||
|
||
Public Overrides Sub AppendMathML(SB As System.Text.StringBuilder) | ||
|
||
End Sub | ||
|
||
Public Overrides Sub AppendSimpleText(SB As System.Text.StringBuilder) | ||
This.Base.Export.AppendSimpleText(SB) | ||
SB.Append("_"c) | ||
This.SubScript.Export.AppendSimpleText(SB) | ||
End Sub | ||
|
||
Protected Overrides Sub CalculateMinHeight_Internal() | ||
|
||
End Sub | ||
|
||
Protected Overrides Sub Draw_Internal(DG As System.Windows.Media.DrawingContext) | ||
|
||
End Sub | ||
|
||
Protected Overrides Sub GenerateLayout_Internal() | ||
|
||
End Sub | ||
|
||
Protected Overrides ReadOnly Property PreferInlineContent_Internal As Boolean | ||
Get | ||
Return False | ||
End Get | ||
End Property | ||
|
||
Public Overrides ReadOnly Property PreferInlineContentFor(Child As MathElement) As Boolean | ||
Get | ||
|
||
' Only the scripts have a special behavior | ||
If Child IsNot This.Base Then Return True | ||
|
||
' We need to keep inheritance for the base | ||
Return MyBase.PreferInlineContentFor(Child) | ||
|
||
End Get | ||
End Property | ||
|
||
Protected Overrides Sub PrepareLayout_Internal(AvailABH As Double, AvailBBH As Double) | ||
|
||
End Sub | ||
End Class |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters