GitLab Commit is coming up on August 3-4. Learn how to innovate together using GitLab, the DevOps platform. Register for free: gitlabcommitvirtual2021.com

Commit e41cb20e authored by Benoît Minisini's avatar Benoît Minisini
Browse files

Some fixes in the text editor HTML preview.

[DEVELOPMENT ENVIRONMENT]
* NEW: Text editor: Disable the popup menu in the HTML preview.
* BUG: Text editor: Correctly refresh the preview highlight when the preview is resized.
parent f94a927e
Pipeline #247061245 failed with stage
in 25 minutes and 44 seconds
......@@ -31,7 +31,7 @@ Component=gb.signal
Description="Integrated Development Environment for Gambas"
Authors="Benoît Minisini\nFabien Bodard\nCharlie Reinl\nJosé Luis Redrejo\nRobert Rowe\nTobias Boege"
Arguments=[["-L"],["-t","/home/benoit/gambas/git/master/app/src/gambas3"],["--help"]]
Environment="GB_GUI=gb.qt5\n GTK_DEBUG=interactive"
Environment="GB_GUI=gb.gtk3\n GTK_DEBUG=interactive"
TabSize=2
Translate=1
Language=en
......
......@@ -65,6 +65,7 @@ Private $iShowPreview As Integer
Private $hTimerPreview As Timer
Private $sTempPreview As String
Private $bMovePreviewOnReady As Boolean
Private $bPreviewReady As Boolean
Public Sub _new(sPath As String, Optional bModule As Boolean)
......@@ -1941,8 +1942,10 @@ Public Sub Preview_Ready()
If $bMovePreviewOnReady Then
$bMovePreviewOnReady = False
$hPreview.ExecJavascript("goto_line(" & CStr($hEditor.Line) & ");")
Try $hPreview.ExecJavascript("goto_line(" & CStr($hEditor.Line) & ");")
If Error Then Error Error.Text
Endif
$bPreviewReady = True
End
......@@ -1959,6 +1962,8 @@ Private Sub RefreshPreview(Optional bReload As Boolean)
If bReload Then
$bPreviewReady = False
Project.SetMessage(("Preview refresh..."))
Select Case $iShowPreview
......@@ -2022,7 +2027,7 @@ Private Sub RefreshPreview(Optional bReload As Boolean)
Else
'Debug $hEditor.Line
$hPreview.ExecJavascript("goto_line(" & CStr($hEditor.Line) & ");")
If $bPreviewReady Then $hPreview.ExecJavascript("goto_line(" & CStr($hEditor.Line) & ");")
Endif
......@@ -2064,8 +2069,14 @@ Public Sub Preview_GotFocus()
End
Public Sub splPreview_Resize()
Public Sub Preview_Menu()
RefreshPreview
Stop Event
End
Public Sub Preview_Resize()
RefreshPreview
End
......@@ -8,20 +8,21 @@ Public Const _DrawWith As String = "WebView"
Inherits WebView
Event Ready
Event Resize
Property NoHeader As Boolean
Property NoHeader As Boolean Use $bNoHeader
Property NoMenu As Boolean Use $bNoMenu
Private $hObs As Observer
Private $hWatcher As Watcher
Private $hSpinner As Spinner
Private $bNoHeader As Boolean
Private $sNextUrl As String
Private $hNotExist As Label
Public Sub _new()
$hObs = New Observer(Me) As "WebView"
$hWatcher = New Watcher(Me) As "WebView"
$hWatcher = New Watcher(Me) As "Watcher"
$hSpinner = New Spinner(Me.Window)
$hSpinner.Hide
......@@ -49,7 +50,7 @@ Private Sub ShowWaiting(bShow As Boolean)
If bShow Then
$hSpinner.Show
WebView_Move
Watcher_Move
$hSpinner.Raise
$hSpinner.Start
Else
......@@ -89,7 +90,7 @@ End
'
' End
Public Sub WebView_Move()
Public Sub Watcher_Move()
Dim hWin As Window
......@@ -104,9 +105,10 @@ Public Sub WebView_Move()
End
Public Sub WebView_Resize()
Public Sub Watcher_Resize()
WebView_Move
Watcher_Move
Raise Resize
End
......@@ -227,18 +229,6 @@ Public Sub WebView_Progress()
End
Private Function NoHeader_Read() As Boolean
Return $bNoHeader
End
Private Sub NoHeader_Write(Value As Boolean)
$bNoHeader = Value
End
Public Sub Stop()
Super.Stop
......
var goto_line_timer;
function $(id)
{
return document.getElementById(id);
}
function goto_line(line)
function do_goto_line(line)
{
var sel = [null, null, null];
var r1, r2;
......@@ -74,4 +76,11 @@ function goto_line(line)
sel[2].style.display = 'block';
elt.scrollIntoView({block:'center'});
}
function goto_line(line)
{
if (goto_line_timer)
clearTimeout(goto_line_timer);
goto_line_timer = setTimeout(function() { do_goto_line(line); goto_line_timer = undefined;}, 100);
}
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment