-
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.
The new Selection engine is not working properly. I'll start looking …
…at the work on the unified ChildrenHelper. When done, I'm ready to start mapping more keyboard events to actions.
- Loading branch information
FremyCompany_cp
authored and
FremyCompany_cp
committed
Jun 22, 2011
1 parent
6328c61
commit adf886b
Showing
11 changed files
with
562 additions
and
479 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
226 changes: 113 additions & 113 deletions
226
FC.MathEditor/WpfMathEditor/Classes/SelectionHelper.Actions.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 |
---|---|---|
@@ -1,114 +1,114 @@ | ||
Partial Public Class SelectionHelper0 | ||
|
||
Public Enum SelectionPointType | ||
StartPoint | ||
EndPoint | ||
Selection | ||
End Enum | ||
|
||
Public ReadOnly Property IsEmpty As Boolean | ||
Get | ||
If SelectionStart Is Nothing Then | ||
If SelectionEnd Is Nothing Then | ||
' TODO: Implement HasChildren.... in ChildrenHelper | ||
Return CommonAncestror.Children.First Is Nothing | ||
Else | ||
Return False | ||
End If | ||
Else | ||
Return SelectionStart.NextSibling Is SelectionEnd | ||
End If | ||
End Get | ||
End Property | ||
|
||
Public Sub CollapseToEnd() | ||
Dim NewPoint = New Selection(EndPoint.CommonAncestror, EndPoint.CommonAncestror.Children.Before(EndPoint.SelectionStart), EndPoint.SelectionStart) | ||
SetSelection(NewPoint, PointToChange:=SelectionHelper.SelectionPointType.StartPoint) | ||
End Sub | ||
|
||
Public Sub CollapseToStart() | ||
' TODO: Implement CollapseToStart | ||
Throw New NotImplementedException() | ||
End Sub | ||
|
||
Public Sub MoveNext(Optional ByVal MovedPoint As SelectionPointType = SelectionPointType.Selection) | ||
Dim Sel As Selection = GetSelection(MovedPoint) | ||
Dim E = Sel.CommonAncestror.ParentLayoutEngineChild | ||
Sel.CommonAncestror = E.ParentElement | ||
Sel.SelectionStart = E | ||
Sel.SelectionEnd = E.NextSibling | ||
SetSelection(Sel, MovedPoint) | ||
End Sub | ||
|
||
Public Sub MovePrevious(Optional ByVal MovedPoint As SelectionPointType = SelectionPointType.Selection) | ||
Dim Sel As Selection = GetSelection(MovedPoint) | ||
Dim E = Sel.CommonAncestror.ParentLayoutEngineChild | ||
Sel.CommonAncestror = E.ParentElement | ||
Sel.SelectionStart = E.PreviousSibling | ||
Sel.SelectionEnd = E | ||
SetSelection(Sel, MovedPoint) | ||
End Sub | ||
|
||
Public Sub MoveLeft(Optional ByVal MovedPoint As SelectionPointType = SelectionPointType.Selection) | ||
|
||
Dim Sel As Selection = GetSelection(MovedPoint) | ||
Dim E = Sel.SelectionStart | ||
|
||
If E Is Nothing Then | ||
MovePrevious(MovedPoint) | ||
Else | ||
Sel.CommonAncestror = E.ParentElement | ||
Sel.SelectionStart = E.PreviousSibling | ||
Sel.SelectionEnd = E | ||
SetSelection(Sel, MovedPoint) | ||
End If | ||
|
||
End Sub | ||
|
||
Public Sub MoveRight(Optional ByVal MovedPoint As SelectionPointType = SelectionPointType.Selection) | ||
|
||
Dim Sel As Selection = GetSelection(MovedPoint) | ||
Dim E = Sel.SelectionEnd | ||
|
||
If E Is Nothing Then | ||
MoveNext(MovedPoint) | ||
Else | ||
Sel.CommonAncestror = E.ParentElement | ||
Sel.SelectionStart = E | ||
Sel.SelectionEnd = E.NextSibling | ||
SetSelection(Sel, MovedPoint) | ||
End If | ||
|
||
End Sub | ||
|
||
Public Sub MoveStart(Optional ByVal MovedPoint As SelectionPointType = SelectionPointType.Selection) | ||
|
||
Dim Sel As Selection = GetSelection(MovedPoint) | ||
Sel.SelectionStart = Nothing | ||
Sel.SelectionEnd = Sel.CommonAncestror.FirstChild | ||
SetSelection(Sel, MovedPoint) | ||
|
||
End Sub | ||
|
||
Public Sub MoveEnd(Optional ByVal MovedPoint As SelectionPointType = SelectionPointType.Selection) | ||
|
||
Dim Sel As Selection = GetSelection(MovedPoint) | ||
Sel.SelectionEnd = Nothing | ||
Sel.SelectionStart = Sel.CommonAncestror.LastChild | ||
SetSelection(Sel, MovedPoint) | ||
|
||
End Sub | ||
|
||
Public Sub MoveDocumentStart(Optional ByVal MovedPoint As SelectionPointType = SelectionPointType.Selection) | ||
|
||
SetSelection(New Selection(CommonAncestror.Root, Nothing, CommonAncestror.Root.FirstChild), MovedPoint) | ||
|
||
End Sub | ||
|
||
Public Sub MoveDocumentEnd(Optional ByVal MovedPoint As SelectionPointType = SelectionPointType.Selection) | ||
|
||
SetSelection(New Selection(CommonAncestror.Root, CommonAncestror.Root.LastChild, Nothing), MovedPoint) | ||
|
||
End Sub | ||
'Partial Public Class SelectionHelper0 | ||
|
||
' Public Enum SelectionPointType | ||
' StartPoint | ||
' EndPoint | ||
' Selection | ||
' End Enum | ||
|
||
' Public ReadOnly Property IsEmpty As Boolean | ||
' Get | ||
' If SelectionStart Is Nothing Then | ||
' If SelectionEnd Is Nothing Then | ||
' ' TODO: Implement HasChildren.... in ChildrenHelper | ||
' Return CommonAncestror.Children.First Is Nothing | ||
' Else | ||
' Return False | ||
' End If | ||
' Else | ||
' Return SelectionStart.NextSibling Is SelectionEnd | ||
' End If | ||
' End Get | ||
' End Property | ||
|
||
' Public Sub CollapseToEnd() | ||
' Dim NewPoint = New Selection(EndPoint.CommonAncestror, EndPoint.CommonAncestror.Children.Before(EndPoint.SelectionStart), EndPoint.SelectionStart) | ||
' SetSelection(NewPoint, PointToChange:=SelectionHelper.SelectionPointType.StartPoint) | ||
' End Sub | ||
|
||
' Public Sub CollapseToStart() | ||
' ' TODO: Implement CollapseToStart | ||
' Throw New NotImplementedException() | ||
' End Sub | ||
|
||
' Public Sub MoveNext(Optional ByVal MovedPoint As SelectionPointType = SelectionPointType.Selection) | ||
' Dim Sel As Selection = GetSelection(MovedPoint) | ||
' Dim E = Sel.CommonAncestror.ParentLayoutEngineChild | ||
' Sel.CommonAncestror = E.ParentElement | ||
' Sel.SelectionStart = E | ||
' Sel.SelectionEnd = E.NextSibling | ||
' SetSelection(Sel, MovedPoint) | ||
' End Sub | ||
|
||
' Public Sub MovePrevious(Optional ByVal MovedPoint As SelectionPointType = SelectionPointType.Selection) | ||
' Dim Sel As Selection = GetSelection(MovedPoint) | ||
' Dim E = Sel.CommonAncestror.ParentLayoutEngineChild | ||
' Sel.CommonAncestror = E.ParentElement | ||
' Sel.SelectionStart = E.PreviousSibling | ||
' Sel.SelectionEnd = E | ||
' SetSelection(Sel, MovedPoint) | ||
' End Sub | ||
|
||
' Public Sub MoveLeft(Optional ByVal MovedPoint As SelectionPointType = SelectionPointType.Selection) | ||
|
||
' Dim Sel As Selection = GetSelection(MovedPoint) | ||
' Dim E = Sel.SelectionStart | ||
|
||
' If E Is Nothing Then | ||
' MovePrevious(MovedPoint) | ||
' Else | ||
' Sel.CommonAncestror = E.ParentElement | ||
' Sel.SelectionStart = E.PreviousSibling | ||
' Sel.SelectionEnd = E | ||
' SetSelection(Sel, MovedPoint) | ||
' End If | ||
|
||
' End Sub | ||
|
||
' Public Sub MoveRight(Optional ByVal MovedPoint As SelectionPointType = SelectionPointType.Selection) | ||
|
||
' Dim Sel As Selection = GetSelection(MovedPoint) | ||
' Dim E = Sel.SelectionEnd | ||
|
||
' If E Is Nothing Then | ||
' MoveNext(MovedPoint) | ||
' Else | ||
' Sel.CommonAncestror = E.ParentElement | ||
' Sel.SelectionStart = E | ||
' Sel.SelectionEnd = E.NextSibling | ||
' SetSelection(Sel, MovedPoint) | ||
' End If | ||
|
||
' End Sub | ||
|
||
' Public Sub MoveStart(Optional ByVal MovedPoint As SelectionPointType = SelectionPointType.Selection) | ||
|
||
' Dim Sel As Selection = GetSelection(MovedPoint) | ||
' Sel.SelectionStart = Nothing | ||
' Sel.SelectionEnd = Sel.CommonAncestror.FirstChild | ||
' SetSelection(Sel, MovedPoint) | ||
|
||
' End Sub | ||
|
||
' Public Sub MoveEnd(Optional ByVal MovedPoint As SelectionPointType = SelectionPointType.Selection) | ||
|
||
' Dim Sel As Selection = GetSelection(MovedPoint) | ||
' Sel.SelectionEnd = Nothing | ||
' Sel.SelectionStart = Sel.CommonAncestror.LastChild | ||
' SetSelection(Sel, MovedPoint) | ||
|
||
' End Sub | ||
|
||
' Public Sub MoveDocumentStart(Optional ByVal MovedPoint As SelectionPointType = SelectionPointType.Selection) | ||
|
||
' SetSelection(New Selection(CommonAncestror.Root, Nothing, CommonAncestror.Root.FirstChild), MovedPoint) | ||
|
||
' End Sub | ||
|
||
' Public Sub MoveDocumentEnd(Optional ByVal MovedPoint As SelectionPointType = SelectionPointType.Selection) | ||
|
||
' SetSelection(New Selection(CommonAncestror.Root, CommonAncestror.Root.LastChild, Nothing), MovedPoint) | ||
|
||
' End Sub | ||
|
||
End Class | ||
'End Class |
Oops, something went wrong.