Skip to content

Commit 6328c61

Browse files
FremyCompany_cpFremyCompany_cp
authored andcommitted
Litle progress
1 parent 3e8ac4f commit 6328c61

13 files changed

+933
-324
lines changed

FC.MathEditor/WpfMathEditor/Classes/ChildrenHelper.vb

Lines changed: 6 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
''' </summary>
1919
''' <param name="Element">The element to search for</param>
2020
Public Function Contains(ByVal Element As MathElement) As Boolean
21-
Return (Element.Parent Is Me) AndAlso Contains_Internal(Element)
21+
Return (Element.ParentElement Is Me) AndAlso Contains_Internal(Element)
2222
End Function
2323

2424
''' <summary>
@@ -62,7 +62,7 @@
6262
''' <param name="OldChild">The old child.</param>
6363
Public Sub Remove(ByVal OldChild As MathElement)
6464

65-
If OldChild.Parent IsNot This Then _
65+
If OldChild.ParentElement IsNot This Then _
6666
Throw New ArgumentException("OldChild was not a child of this element.")
6767

6868
Try
@@ -275,7 +275,7 @@
275275
''' </summary>
276276
''' <param name="Element">The element to be added to the children list</param>
277277
Public Function CanContains(ByVal Element As MathElement) As Boolean
278-
Return (Element IsNot Nothing) AndAlso (Element.Parent Is Nothing) AndAlso CanContains_Internal(Element)
278+
Return (Element IsNot Nothing) AndAlso (Element.ParentElement Is Nothing) AndAlso CanContains_Internal(Element)
279279
End Function
280280

281281
''' <summary>
@@ -329,9 +329,9 @@
329329

330330
' Perform checks
331331
If OldChild Is NewChild Then Throw New ArgumentException("An element can be replaced by itself.")
332-
If OldChild.Parent IsNot Me Then Throw New ArgumentException("The element to replace is not attached to this element.")
332+
If OldChild.ParentElement IsNot Me Then Throw New ArgumentException("The element to replace is not attached to this element.")
333333

334-
If NewChild.Parent Is Me Then Remove(NewChild)
334+
If NewChild.ParentElement Is Me Then Remove(NewChild)
335335

336336
' Launch user-defined code
337337
This.Attach(NewChild)
@@ -487,70 +487,4 @@
487487
Return GetEnumerator()
488488
End Function
489489

490-
End Class
491-
492-
Public Class SiblingEnumeratorGenerator : Implements IEnumerable(Of MathElement)
493-
494-
Private FirstEl, LastEl As MathElement
495-
Public Sub New(ByVal FirstEl As MathElement)
496-
Me.New(FirstEl, Nothing)
497-
End Sub
498-
499-
Public Sub New(ByVal FirstEl As MathElement, ByVal LastEl As MathElement)
500-
Me.FirstEl = FirstEl : Me.LastEl = LastEl
501-
End Sub
502-
503-
Public Function GetEnumerator() As System.Collections.Generic.IEnumerator(Of MathElement) Implements System.Collections.Generic.IEnumerable(Of MathElement).GetEnumerator
504-
Return New SiblingEnumerator(FirstEl, LastEl)
505-
End Function
506-
507-
Public Function GetGenericEnumerator() As System.Collections.IEnumerator Implements System.Collections.IEnumerable.GetEnumerator
508-
Return GetEnumerator()
509-
End Function
510-
511-
End Class
512-
513-
Public Class SiblingEnumerator : Implements IEnumerator(Of MathElement)
514-
515-
Private FirstEl As MathElement, NextEl As MathElement, CurrentEl As MathElement
516-
Public Sub New(ByVal FirstEl As MathElement)
517-
Me.FirstEl = FirstEl : Me.NextEl = FirstEl
518-
End Sub
519-
520-
Private LastEl As MathElement
521-
Public Sub New(ByVal FirstEl As MathElement, ByVal LastEl As MathElement)
522-
Me.FirstEl = FirstEl : Me.NextEl = FirstEl : Me.LastEl = LastEl
523-
End Sub
524-
525-
Public ReadOnly Property Current As MathElement Implements System.Collections.Generic.IEnumerator(Of MathElement).Current
526-
Get
527-
Return CurrentEl
528-
End Get
529-
End Property
530-
531-
Public ReadOnly Property CurrentUnTyped As Object Implements System.Collections.IEnumerator.Current
532-
Get
533-
Return CurrentEl
534-
End Get
535-
End Property
536-
537-
Public Function MoveNext() As Boolean Implements System.Collections.IEnumerator.MoveNext
538-
If (NextEl Is Nothing) OrElse (LastEl IsNot Nothing AndAlso Current Is LastEl) Then
539-
CurrentEl = Nothing
540-
Return False
541-
Else
542-
CurrentEl = NextEl
543-
NextEl = CurrentEl.NextSibling
544-
Return True
545-
End If
546-
End Function
547-
548-
Public Sub Reset() Implements System.Collections.IEnumerator.Reset
549-
NextEl = FirstEl : CurrentEl = Nothing
550-
End Sub
551-
552-
Public Sub Dispose() Implements IDisposable.Dispose
553-
FirstEl = Nothing : NextEl = Nothing : CurrentEl = Nothing
554-
End Sub
555-
556-
End Class
490+
End Class

FC.MathEditor/WpfMathEditor/Classes/ExportHelper.vb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -185,10 +185,10 @@
185185
Private _LocationInParent As Rect
186186
Public ReadOnly Property LocationInParent As Rect
187187
Get
188-
If This.Parent Is Nothing Then
188+
If This.ParentElement Is Nothing Then
189189
Return SizeRect
190190
Else
191-
This.Parent.Export.PerformLayout()
191+
This.ParentElement.Export.PerformLayout()
192192
Return _LocationInParent
193193
End If
194194
End Get
@@ -200,11 +200,11 @@
200200

201201
Public ReadOnly Property LocationInRoot As Rect
202202
Get
203-
If This.Parent Is Nothing Then Return LocationInParent
203+
If This.ParentElement Is Nothing Then Return LocationInParent
204204

205205
This.Root.Export.PerformLayout()
206206
Dim L = LocationInParent
207-
Return FitRect(LocationInParent, This.Parent.Export.SizeRect, This.Parent.Export.LocationInRoot)
207+
Return FitRect(LocationInParent, This.ParentElement.Export.SizeRect, This.ParentElement.Export.LocationInRoot)
208208

209209
End Get
210210
End Property

FC.MathEditor/WpfMathEditor/Classes/InputHelper.vb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -207,8 +207,8 @@
207207
End If
208208

209209
' The parent may want to pre-process, too
210-
If This.Parent IsNot Nothing Then
211-
This.Parent.Input.PreProcessChar(InputChar)
210+
If This.ParentElement IsNot Nothing Then
211+
This.ParentElement.Input.PreProcessChar(InputChar)
212212
End If
213213

214214
' No pre-process
@@ -218,7 +218,7 @@
218218

219219
Public Overridable Function ProcessWaitChar(ByVal InputChar As Integer) As Boolean
220220
' Default wait char processing : eat, and walk to next child
221-
WaitChar = Nothing : This.Selection.SetSelection(This.Parent, This, This.NextSibling)
221+
WaitChar = Nothing : This.Selection.SetSelection(This.ParentElement, This, This.NextSibling)
222222
Return True
223223
End Function
224224

@@ -328,10 +328,10 @@
328328
Public Property WritingMode As InputWritingMode
329329
Get
330330
If WM = 0 Then
331-
If This.Parent Is Nothing Then
331+
If This.ParentElement Is Nothing Then
332332
Return InputWritingMode.Linear
333333
Else
334-
Return This.Parent.Input.WritingMode
334+
Return This.ParentElement.Input.WritingMode
335335
End If
336336
Else
337337
Return WM

FC.MathEditor/WpfMathEditor/Classes/MathElement.Input.vb

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -38,27 +38,35 @@
3838
End Property
3939

4040
Public Overridable Function GetNextInputElement(ByVal CurrentElement As MathElement) As MathElement
41-
If CurrentElement Is Nothing Then Return Children.First
42-
Return Children.After(CurrentElement)
41+
If Me.Children.IsFormatter Then
42+
If CurrentElement Is Nothing Then Return Children.First
43+
Return Children.After(CurrentElement)
44+
Else
45+
Return Nothing
46+
End If
4347
End Function
4448

4549
Public Overridable Function GetPreviousInputElement(ByVal CurrentElement As MathElement) As MathElement
46-
If CurrentElement Is Nothing Then Return Children.Last
47-
Return Children.Before(CurrentElement)
50+
If Me.Children.IsFormatter Then
51+
If CurrentElement Is Nothing Then Return Children.Last
52+
Return Children.Before(CurrentElement)
53+
Else
54+
Return Nothing
55+
End If
4856
End Function
4957

5058
Public ReadOnly Property ParentLayoutEngine As MathElement
5159
Get
52-
Dim P As MathElement = Parent
53-
If Parent Is Nothing Then
60+
Dim P As MathElement = ParentElement
61+
If ParentElement Is Nothing Then
5462
Throw New InvalidOperationException("Unable to retreive a ParentLayoutEngine from an unparented element.")
5563
End If
5664

5765
While P IsNot Nothing
5866
If P.Children.IsLayoutEngine Then
5967
Return P
6068
Else
61-
P = P.Parent
69+
P = P.ParentElement
6270
End If
6371
End While
6472

@@ -69,15 +77,15 @@
6977
Public ReadOnly Property ParentLayoutEngineChild As MathElement
7078
Get
7179
Dim P As MathElement = Me
72-
If Parent Is Nothing Then
80+
If ParentElement Is Nothing Then
7381
Throw New InvalidOperationException("Unable to retreive a ParentLayoutEngine from an unparented element.")
7482
End If
7583

7684
While P IsNot Nothing
77-
If P.Parent.Children.IsLayoutEngine Then
85+
If P.ParentElement.Children.IsLayoutEngine Then
7886
Return P
7987
Else
80-
P = P.Parent
88+
P = P.ParentElement
8189
End If
8290
End While
8391

FC.MathEditor/WpfMathEditor/Classes/MathElement.Layout.vb

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,10 @@
5252
Public Property FontFamily As FontFamily
5353
Get
5454
If _FontFamily Is Nothing Then
55-
If Parent Is Nothing Then
55+
If ParentElement Is Nothing Then
5656
Return DefaultFontFamily
5757
Else
58-
_FontFamily = Parent.FontFamily
58+
_FontFamily = ParentElement.FontFamily
5959
Return _FontFamily
6060
End If
6161
Else
@@ -82,10 +82,10 @@
8282
Public Property FontStretch As FontStretch?
8383
Get
8484
If _FontStretch Is Nothing Then
85-
If Parent Is Nothing Then
85+
If ParentElement Is Nothing Then
8686
Return DefaultFontStretch
8787
Else
88-
_FontStretch = Parent.FontStretch
88+
_FontStretch = ParentElement.FontStretch
8989
Return _FontStretch
9090
End If
9191
Else
@@ -112,10 +112,10 @@
112112
Public Property FontStyle As FontStyle?
113113
Get
114114
If _FontStyle Is Nothing Then
115-
If Parent Is Nothing Then
115+
If ParentElement Is Nothing Then
116116
Return DefaultFontStyle
117117
Else
118-
_FontStyle = Parent.FontStyle
118+
_FontStyle = ParentElement.FontStyle
119119
Return _FontStyle
120120
End If
121121
Else
@@ -142,10 +142,10 @@
142142
Public Property FontWeight As FontWeight?
143143
Get
144144
If _FontWeight Is Nothing Then
145-
If Parent Is Nothing Then
145+
If ParentElement Is Nothing Then
146146
Return DefaultFontWeight
147147
Else
148-
_FontWeight = Parent.FontWeight
148+
_FontWeight = ParentElement.FontWeight
149149
Return _FontWeight
150150
End If
151151
Else
@@ -173,10 +173,10 @@
173173
Public Property Foreground As Color?
174174
Get
175175
If _Foreground Is Nothing Then
176-
If Parent Is Nothing Then
176+
If ParentElement Is Nothing Then
177177
Return SystemColors.WindowTextColor
178178
Else
179-
_Foreground = Parent.Foreground
179+
_Foreground = ParentElement.Foreground
180180
Return _Foreground
181181
End If
182182
Else
@@ -203,10 +203,10 @@
203203
Public Property FontSize As Double?
204204
Get
205205
If _FontSize Is Nothing Then
206-
If Parent Is Nothing Then
206+
If ParentElement Is Nothing Then
207207
Return 20
208208
Else
209-
_FontSize = Parent.FontSize
209+
_FontSize = ParentElement.FontSize
210210
Return _FontSize
211211
End If
212212
Else
@@ -233,10 +233,10 @@
233233
Public Property Background As Color?
234234
Get
235235
If _Background Is Nothing Then
236-
If Parent Is Nothing Then
236+
If ParentElement Is Nothing Then
237237
Return Colors.Transparent
238238
Else
239-
_Background = Parent.Background
239+
_Background = ParentElement.Background
240240
Return _Background
241241
End If
242242
Else

0 commit comments

Comments
 (0)