TerminalView: Animate scrolling when Application.Animations property is TRUE.
[GB.FORM.TERMINAL] * NEW: TerminalView: Animate scrolling when Application.Animations property is TRUE.
This commit is contained in:
parent
279c9a2782
commit
62fefce8f7
4 changed files with 50 additions and 19 deletions
|
@ -11,6 +11,7 @@ Component=gb.form
|
|||
Component=gb.term
|
||||
Component=gb.net
|
||||
Authors="Benoît Minisini\nFabien Bodard"
|
||||
Environment="GB_JIT_DEBUG=0"
|
||||
TabSize=2
|
||||
Language=fr
|
||||
Type=Component
|
||||
|
|
|
@ -27,6 +27,7 @@ End
|
|||
Public Sub Form_Open()
|
||||
|
||||
'Exec ["stty", "onlcr"] Wait
|
||||
Application.Animations = True
|
||||
TerminalView1.Exec(["bash"])
|
||||
|
||||
End
|
||||
|
|
|
@ -9,7 +9,7 @@ Private Enum MODE_AppScreen, MODE_AppCuKeys, MODE_AppKeyPad, MODE_Mouse1000, MOD
|
|||
Private $aMode As New Boolean[13]
|
||||
'Private $aSavedMode As New Boolean[13]
|
||||
Private $sLeft As String
|
||||
Private $iCpt As Integer
|
||||
'Private $iCpt As Integer
|
||||
|
||||
Public Sub Reset()
|
||||
|
||||
|
@ -176,21 +176,21 @@ Private Sub Escape(hView As TerminalView, hScreen As TerminalScreen, hOutput As
|
|||
|
||||
sStr = Mid$(sData, iPos, iLen)
|
||||
|
||||
If hScreen.DEBUG_FILTER Then
|
||||
Inc $iCpt
|
||||
Error Format($iCpt, "######0"); " | ";
|
||||
Error "ESC";
|
||||
For I = 1 To Len(sStr)
|
||||
Error " "; Mid$(sStr, I, 1);
|
||||
Next
|
||||
Error
|
||||
If $iCpt > 5120 Then
|
||||
hScreen.DebugRefresh
|
||||
hView.Suspended = True
|
||||
Stop
|
||||
hView.Suspended = False
|
||||
Endif
|
||||
Endif
|
||||
' If hScreen.DEBUG_FILTER Then
|
||||
' Inc $iCpt
|
||||
' Error Format($iCpt, "######0"); " | ";
|
||||
' Error "ESC";
|
||||
' For I = 1 To Len(sStr)
|
||||
' Error " "; Mid$(sStr, I, 1);
|
||||
' Next
|
||||
' Error
|
||||
' If $iCpt > 5120 Then
|
||||
' hScreen.DebugRefresh
|
||||
' hView.Suspended = True
|
||||
' Stop
|
||||
' hView.Suspended = False
|
||||
' Endif
|
||||
' Endif
|
||||
|
||||
Select Case Left(sStr)
|
||||
|
||||
|
|
|
@ -90,6 +90,11 @@ Private $fLastMouseDownY As Integer
|
|||
|
||||
Private mnuPopup As Menu
|
||||
|
||||
Private $iScrollY As Integer
|
||||
Private $iTargetY As Integer
|
||||
Private $hTimerScroll As Timer
|
||||
Private $bIgnoreNextAnimation As Boolean
|
||||
|
||||
'Private $bDoubleFont As Boolean = True
|
||||
|
||||
Public Sub _new()
|
||||
|
@ -369,7 +374,7 @@ End
|
|||
|
||||
Private Sub GetScrollY() As Integer
|
||||
|
||||
Return $hScroll.Value
|
||||
Return $iScrollY '$hScroll.Value
|
||||
|
||||
End
|
||||
|
||||
|
@ -384,7 +389,7 @@ Public Sub View_Draw()
|
|||
|
||||
ApplyLimit
|
||||
|
||||
$hScreen.Paint(GetScrollY() * $LH, $LH, $CW, $iAscent, $bHideCursor, $hCacheFont)
|
||||
$hScreen.Paint(GetScrollY(), $LH, $CW, $iAscent, $bHideCursor, $hCacheFont)
|
||||
|
||||
If $bTermUseMouse Then
|
||||
Paint.FillRect($iMouseX * $CW, $iMouseY * $LH, $CW, $LH, Color.SetAlpha(Color.SelectedBackground, 64))
|
||||
|
@ -998,10 +1003,33 @@ End
|
|||
|
||||
Public Sub ScrollBar_Change()
|
||||
|
||||
Refresh
|
||||
$iTargetY = $hScroll.Value * $LH
|
||||
If $iTargetY <> $iScrollY Then
|
||||
If Application.Animations And If Not $bIgnoreNextAnimation Then
|
||||
If Not $hTimerScroll Then
|
||||
$hTimerScroll = New Timer As "TimerScroll"
|
||||
$hTimerScroll.Delay = 20
|
||||
Endif
|
||||
$hTimerScroll.Start
|
||||
Else
|
||||
$bIgnoreNextAnimation = False
|
||||
$iScrollY = $iTargetY
|
||||
$hView.Refresh
|
||||
Endif
|
||||
Endif
|
||||
|
||||
End
|
||||
|
||||
Public Sub TimerScroll_Timer()
|
||||
|
||||
$iScrollY += ($iTargetY - $iScrollY + Sgn($iTargetY - $iScrollY)) \ 2
|
||||
$hView.Refresh
|
||||
|
||||
If $iScrollY = $iTargetY Then $hTimerScroll.Stop
|
||||
|
||||
End
|
||||
|
||||
|
||||
Public Sub Kill()
|
||||
|
||||
If $hProcess Then
|
||||
|
@ -1078,6 +1106,7 @@ End
|
|||
|
||||
Public Sub _ShowScreen()
|
||||
|
||||
$bIgnoreNextAnimation = True
|
||||
$hScroll.Value = $hScreen.ScreenTop()
|
||||
Refresh
|
||||
|
||||
|
|
Loading…
Reference in a new issue