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 c2825f17 authored by Benoît Minisini's avatar Benoît Minisini
Browse files

Store the style sheet file used for displaying markdown previews inside the project configuration.

[DEVELOPMENT ENVIRONMENT]
* NEW: Form editor: Add a back and forward button to the preview.
* NEW: Store the style sheet file used for displaying markdown previews inside the project configuration.
parent 4081f4c8
Pipeline #248746096 passed with stage
in 24 minutes and 46 seconds
......@@ -2076,6 +2076,7 @@ Private Sub FillStyleSheet()
For I = 0 To $aStyleSheet.Max
hMenu = New Menu(mnuStyleSheet) As "mnuStyleSheet"
hMenu.Text = File.Name($aStyleSheet[I])
If Project.PreviewStyleSheet = $aStyleSheet[I] Then $iCurrentStyleSheet = I
hMenu.Tag = I
Next
......@@ -2095,10 +2096,14 @@ Public Sub mnuStyleSheet_Click()
If IsNull(Last.Tag) Then
$iCurrentStyleSheet = -1
Project.PreviewStyleSheet = ""
Else
$iCurrentStyleSheet = Last.Tag
Project.PreviewStyleSheet = $aStyleSheet[$iCurrentStyleSheet]
Endif
Project.WriteProject(True)
RefreshPreview(True)
End
......@@ -2182,3 +2187,15 @@ Public Sub btnClosePreview_Click()
btnPreview.Value = False
End
Public Sub btnBack_Click()
$hPreview.Back
End
Public Sub btnForward_Click()
$hPreview.Forward
End
......@@ -555,33 +555,45 @@
MoveScaled(2,2,55,4)
Key = "preview"
Separator = True
{ btnZoomIn ToolButton
{ btnBack ToolButton
MoveScaled(0,0,4,4)
ToolTip = ("Go back")
Action = ".preview-back"
Picture = Picture["icon:/small/left"]
}
{ btnForward ToolButton
MoveScaled(4,0,4,4)
ToolTip = ("Go forward")
Action = ".preview-forward"
Picture = Picture["icon:/small/right"]
}
{ btnStyleSheet MenuButton
MoveScaled(9,0,9,4)
Action = ".preview-css"
AutoResize = True
Picture = Picture["icon:/small/css"]
Border = False
Menu = "mnuStyleSheet"
MenuOnly = True
}
{ btnZoomIn ToolButton
MoveScaled(18,0,4,4)
ToolTip = ("Zoom in")
Action = ".preview-zoom-in"
Picture = Picture["icon:/small/zoom-in"]
}
{ btnZoomOut ToolButton
MoveScaled(4,0,4,4)
MoveScaled(22,0,4,4)
ToolTip = ("Zoom out")
Action = ".preview-zoom-out"
Picture = Picture["icon:/small/zoom-out"]
}
{ btnZoomNormal ToolButton
MoveScaled(8,0,4,4)
MoveScaled(26,0,4,4)
ToolTip = ("No zoom")
Action = ".preview-zoom-normal"
Picture = Picture["icon:/small/zoom-normal"]
}
{ btnStyleSheet MenuButton
MoveScaled(13,0,9,4)
Action = ".preview-css"
AutoResize = True
Picture = Picture["icon:/small/css"]
Border = False
Menu = "mnuStyleSheet"
MenuOnly = True
}
{ Spring1 Spring
MoveScaled(47,1,4,2)
}
......@@ -715,10 +727,18 @@
Shortcut = ""
Picture = "icon:/small/preview"
}
{ Action preview-back
Text = "Go back"
Picture = "icon:/small/left"
}
{ Action preview-css
Text = ""
Picture = "icon:/small/css"
}
{ Action preview-forward
Text = "Go forward"
Picture = "icon:/small/right"
}
{ Action preview-zoom-in
Text = "Zoom in"
Picture = "icon:/small/zoom-in"
......@@ -827,8 +847,8 @@
{ Toolbars
{ Toolbar preview
Text = ""
List = "preview-zoom-in,preview-zoom-out,preview-zoom-normal,preview-css"
Default = "preview-zoom-in,preview-zoom-out,preview-zoom-normal,preview-css,~,$btnClosePreview"
List = "preview-back,preview-forward,preview-css,preview-zoom-in,preview-zoom-out,preview-zoom-normal"
Default = "preview-back,preview-forward,preview-css,preview-zoom-in,preview-zoom-out,preview-zoom-normal,~,$btnClosePreview"
}
{ Toolbar text
Text = "Text editor"
......
......@@ -110,6 +110,7 @@ Public UseHttpServer As Boolean
Public Profiling As Boolean
Public ProfileIndex As Integer
Public DoNotTranslate As String[]
Public PreviewStyleSheet As String
Public Running As Boolean
......@@ -3297,6 +3298,7 @@ Public Sub ReadProject(Optional bConvert As Boolean)
PublishWebSite = ""
PublishCreateMenu = False
DoNotTranslate = New String[]
PreviewStyleSheet = ""
For Each sLig In hFic.Lines
......@@ -3602,6 +3604,9 @@ Public Sub ReadProject(Optional bConvert As Boolean)
Case "reference"
If Not ExtraReferences.Exist(sVal) Then ExtraReferences.Add(sVal)
Case "previewstylesheet"
PreviewStyleSheet = sVal
End Select
......@@ -3798,6 +3803,8 @@ Public Sub WriteProject(Optional bComponentDoNotChange As Boolean, Optional bMak
If DoNotTranslate.Count Then Print #hFile, "DoNotTranslate="; DoNotTranslate.Join(",", Chr$(34))
If PreviewStyleSheet Then Print #hFile, "PreviewStyleSheet="; PreviewStyleSheet
If ExtraReferences Then
For Each sVal In ExtraReferences
Print #hFile, "Reference="; sVal
......
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