|
@@ -880,7 +880,7 @@ Class TextView Extends ScrollableView
|
|
|
|
|
|
End
|
|
End
|
|
|
|
|
|
- Method OnKeyDown:Bool( key:Key,modifiers:Modifier=Null )
|
|
|
|
|
|
+ Method OnKeyDown:Bool( key:Key,modifiers:Modifier )
|
|
|
|
|
|
Select key
|
|
Select key
|
|
Case Key.Backspace
|
|
Case Key.Backspace
|
|
@@ -947,7 +947,6 @@ Class TextView Extends ScrollableView
|
|
If go
|
|
If go
|
|
ReplaceText( lines.Join( "" ) )
|
|
ReplaceText( lines.Join( "" ) )
|
|
SelectText( _doc.StartOfLine( min ),_doc.StartOfLine( max ) )
|
|
SelectText( _doc.StartOfLine( min ),_doc.StartOfLine( max ) )
|
|
- Return False
|
|
|
|
Endif
|
|
Endif
|
|
|
|
|
|
Endif
|
|
Endif
|
|
@@ -1018,16 +1017,17 @@ Class TextView Extends ScrollableView
|
|
|
|
|
|
Local n:=VisibleRect.Height/_charh-1
|
|
Local n:=VisibleRect.Height/_charh-1
|
|
MoveLine( n )
|
|
MoveLine( n )
|
|
-
|
|
|
|
|
|
+
|
|
Default
|
|
Default
|
|
-
|
|
|
|
|
|
+
|
|
Return False
|
|
Return False
|
|
|
|
+
|
|
End
|
|
End
|
|
|
|
|
|
Return True
|
|
Return True
|
|
End
|
|
End
|
|
|
|
|
|
- Method OnControlKeyDown:bool( key:Key,modifiers:Modifier=Null ) Virtual
|
|
|
|
|
|
+ Method OnControlKeyDown:Bool( key:Key,modifiers:Modifier ) Virtual
|
|
|
|
|
|
Select key
|
|
Select key
|
|
Case Key.A
|
|
Case Key.A
|
|
@@ -1045,13 +1045,10 @@ Class TextView Extends ScrollableView
|
|
Case Key.Home
|
|
Case Key.Home
|
|
_cursor=0
|
|
_cursor=0
|
|
UpdateCursor()
|
|
UpdateCursor()
|
|
- Return True
|
|
|
|
Case Key.KeyEnd
|
|
Case Key.KeyEnd
|
|
_cursor=_doc.TextLength
|
|
_cursor=_doc.TextLength
|
|
UpdateCursor()
|
|
UpdateCursor()
|
|
- Return True
|
|
|
|
Case Key.Left
|
|
Case Key.Left
|
|
-
|
|
|
|
If _anchor<>_cursor And Not (modifiers & Modifier.Shift)
|
|
If _anchor<>_cursor And Not (modifiers & Modifier.Shift)
|
|
_cursor=Min( _anchor,_cursor )
|
|
_cursor=Min( _anchor,_cursor )
|
|
Endif
|
|
Endif
|
|
@@ -1066,10 +1063,7 @@ Class TextView Extends ScrollableView
|
|
|
|
|
|
_cursor=FindWord( Max( _cursor-1,0 ),term )
|
|
_cursor=FindWord( Max( _cursor-1,0 ),term )
|
|
UpdateCursor()
|
|
UpdateCursor()
|
|
- Return True
|
|
|
|
-
|
|
|
|
Case Key.Right
|
|
Case Key.Right
|
|
-
|
|
|
|
If _anchor<>_cursor And Not (modifiers & Modifier.Shift)
|
|
If _anchor<>_cursor And Not (modifiers & Modifier.Shift)
|
|
_cursor=Max( _anchor,_cursor )
|
|
_cursor=Max( _anchor,_cursor )
|
|
Endif
|
|
Endif
|
|
@@ -1085,10 +1079,11 @@ Class TextView Extends ScrollableView
|
|
Wend
|
|
Wend
|
|
|
|
|
|
UpdateCursor()
|
|
UpdateCursor()
|
|
- Return True
|
|
|
|
|
|
+ Default
|
|
|
|
+ Return false
|
|
End
|
|
End
|
|
|
|
|
|
- Return False
|
|
|
|
|
|
+ Return True
|
|
End
|
|
End
|
|
|
|
|
|
Method OnKeyEvent( event:KeyEvent ) Override
|
|
Method OnKeyEvent( event:KeyEvent ) Override
|
|
@@ -1113,49 +1108,66 @@ Class TextView Extends ScrollableView
|
|
|
|
|
|
Case EventType.KeyDown,EventType.KeyRepeat
|
|
Case EventType.KeyDown,EventType.KeyRepeat
|
|
|
|
|
|
|
|
+ Local key:=event.Key
|
|
|
|
+ Local modifiers:=event.Modifiers
|
|
|
|
+
|
|
|
|
+ 'map keypad nav keys...
|
|
|
|
+ If Not (modifiers & Modifier.NumLock)
|
|
|
|
+ Select key
|
|
|
|
+ Case Key.Keypad1 key=Key.KeyEnd
|
|
|
|
+ Case Key.Keypad2 key=Key.Down
|
|
|
|
+ Case Key.Keypad3 key=Key.PageDown
|
|
|
|
+ Case Key.Keypad4 key=Key.Left
|
|
|
|
+ Case Key.Keypad6 key=Key.Right
|
|
|
|
+ Case Key.Keypad7 key=Key.Home
|
|
|
|
+ Case Key.Keypad8 key=Key.Up
|
|
|
|
+ Case Key.Keypad9 key=Key.PageUp
|
|
|
|
+ Case Key.Keypad0 key=Key.Insert
|
|
|
|
+ End
|
|
|
|
+ Endif
|
|
|
|
+
|
|
|
|
+ Local r:=False
|
|
|
|
+
|
|
If _macosMode
|
|
If _macosMode
|
|
|
|
|
|
- If event.Modifiers & Modifier.Gui
|
|
|
|
|
|
+ If modifiers & Modifier.Gui
|
|
|
|
|
|
- Select event.Key
|
|
|
|
- Case Key.Home,Key.KeyEnd
|
|
|
|
- Default
|
|
|
|
- If Not OnControlKeyDown( event.Key,event.Modifiers ) Return
|
|
|
|
|
|
+ Select key
|
|
|
|
+ Case Key.A,Key.X,Key.C,Key.V,Key.Z,Key.Y,Key.Left,Key.Right
|
|
|
|
+ r=OnControlKeyDown( key,modifiers )
|
|
End
|
|
End
|
|
-
|
|
|
|
- Else If event.Modifiers & Modifier.Control
|
|
|
|
|
|
|
|
- Select event.Key
|
|
|
|
|
|
+ Else If modifiers & Modifier.Control
|
|
|
|
+
|
|
|
|
+ Select key
|
|
Case Key.A
|
|
Case Key.A
|
|
- OnKeyDown( Key.Home )
|
|
|
|
|
|
+ r=OnKeyDown( Key.Home,modifiers )
|
|
Case Key.E
|
|
Case Key.E
|
|
- OnKeyDown( Key.KeyEnd )
|
|
|
|
|
|
+ r=OnKeyDown( Key.KeyEnd,modifiers )
|
|
End
|
|
End
|
|
|
|
|
|
Else
|
|
Else
|
|
-
|
|
|
|
- Select event.Key
|
|
|
|
- Case Key.Home
|
|
|
|
- OnControlKeyDown( Key.Home )
|
|
|
|
- Case Key.KeyEnd
|
|
|
|
- OnControlKeyDown( Key.KeyEnd )
|
|
|
|
|
|
+
|
|
|
|
+ Select key
|
|
|
|
+ Case Key.Home,Key.KeyEnd
|
|
|
|
+ r=OnControlKeyDown( key,modifiers )
|
|
Default
|
|
Default
|
|
- If Not OnKeyDown( event.Key,event.Modifiers ) Return
|
|
|
|
|
|
+ r=OnKeyDown( key,modifiers )
|
|
End
|
|
End
|
|
-
|
|
|
|
|
|
+
|
|
Endif
|
|
Endif
|
|
-
|
|
|
|
|
|
+
|
|
Else
|
|
Else
|
|
|
|
|
|
- If event.Modifiers & Modifier.Control
|
|
|
|
- If Not OnControlKeyDown( event.Key,event.Modifiers ) Return
|
|
|
|
|
|
+ If modifiers & Modifier.Control
|
|
|
|
+ r=OnControlKeyDown( key,modifiers )
|
|
Else
|
|
Else
|
|
- If Not OnKeyDown( event.Key,event.Modifiers ) Return
|
|
|
|
|
|
+ r=OnKeyDown( key,modifiers )
|
|
Endif
|
|
Endif
|
|
|
|
|
|
Endif
|
|
Endif
|
|
|
|
|
|
- If Not (event.Modifiers & Modifier.Shift) _anchor=_cursor
|
|
|
|
|
|
+ If r And Not (modifiers & Modifier.Shift) _anchor=_cursor
|
|
|
|
|
|
Case EventType.KeyChar
|
|
Case EventType.KeyChar
|
|
|
|
|
|
@@ -1208,27 +1220,6 @@ Class TextView Extends ScrollableView
|
|
|
|
|
|
Return
|
|
Return
|
|
|
|
|
|
- #rem
|
|
|
|
- Case EventType.MouseClick
|
|
|
|
-
|
|
|
|
- _cursor=CharAtPoint( event.Location )
|
|
|
|
-
|
|
|
|
- If Not (event.Modifiers & Modifier.Shift) _anchor=_cursor
|
|
|
|
-
|
|
|
|
- _dragging=True
|
|
|
|
-
|
|
|
|
- MakeKeyView()
|
|
|
|
-
|
|
|
|
- UpdateCursor()
|
|
|
|
-
|
|
|
|
- Case EventType.MouseDoubleClick
|
|
|
|
-
|
|
|
|
- Local term:=New Int[1]
|
|
|
|
- Local start:=FindWord( CharAtPoint( event.Location ),term )
|
|
|
|
-
|
|
|
|
- SelectText( start,term[0] )
|
|
|
|
- #end
|
|
|
|
-
|
|
|
|
Case EventType.MouseUp
|
|
Case EventType.MouseUp
|
|
|
|
|
|
_dragging=False
|
|
_dragging=False
|