Options dialog: Fix theme configuration.

[DEVELOPMENT ENVIRONMENT]
* NEW: Update French translation
* BUG: Options dialog: Fix theme configuration.
* BUG: Fix specifiic highlighters.
This commit is contained in:
Benoît Minisini 2023-11-01 18:27:24 +01:00
parent b2e4cea881
commit b7f65eebf1
8 changed files with 320 additions and 305 deletions

File diff suppressed because it is too large Load diff

View file

@ -100,7 +100,6 @@ Public Sub LoadFile() As Boolean
ReadConfig
TextHighlighter.Register("highlight/conflict.highlight")
edtEditor.Mode = "conflict"
Reload

View file

@ -16,7 +16,7 @@ Private $hDownloadHelp As DownloadManager
Private $hLastTheme As TextHighlighterTheme
Private $hTheme As TextHighlighterTheme
Private $aHighlightTypes As String[]
Private $aHighlightKeys As String[]
Private $aHighlightNames As String[]
Private $bSaveCurrentLayout As Boolean
@ -202,14 +202,14 @@ Public Sub _new()
btnAutoTrans_Click
$aHighlightTypes = TextHighlighter.List
$aHighlightNames = New String[$aHighlightTypes.Count]
For I = 0 To $aHighlightTypes.Max
$aHighlightNames[I] = TextHighlighter[$aHighlightTypes[I]].Name
$aHighlightKeys = TextHighlighter.List
$aHighlightNames = New String[$aHighlightKeys.Count]
For I = 0 To $aHighlightKeys.Max
$aHighlightNames[I] = TextHighlighter.GetName($aHighlightKeys[I])
Next
cmbHighlight.List = $aHighlightNames
cmbHighlight.Add(("All"), 0)
cmbHighlight.Add(("Common colors"), 0)
cmbHighlight.Index = 0
ReloadStyles
@ -1755,36 +1755,33 @@ End
Private Sub ReloadStyles()
Dim aStyles As String[]
Dim hHBox As HBox
Dim hColor As DrawingArea
Dim hButton As ToolButton
Dim sStyle As String
Dim aNames As String[]
Dim I As Integer
Dim aColors As String[]
Dim sColor As String
svwTheme.Children.Clear
' If cmbHighlight.Index = 0 Then
' aStyles = TextHighlighter.Styles
' Else
' aStyles = TextHighlighter[$aHighlightTypes[$aHighlightNames.Find(cmbHighlight.Text)]].Styles
' Endif
If cmbHighlight.Index = 0 Then
aColors = TextHighlighterTheme.Colors
Else
aColors = TextHighlighter[$aHighlightKeys[$aHighlightNames.Find(cmbHighlight.Text)]].Colors
Endif
'
' aNames = New String[aStyles.Count]
' For I = 0 To aStyles.Max
' aNames[I] = Highlight.GetStyleName(aStyles[I])
' Next
aNames = aColors.Copy()
For I = 0 To aNames.Max
aNames[I] = Tr(aNames[I])
Next
aStyles = TextHighlighterTheme.Colors
aNames = aStyles
' aStyles.SortUsing(aNames)
aColors.SortUsing(aNames)
For Each sStyle In aStyles
For Each sColor In aColors
hHBox = New HBox(svwTheme)
hHBox.Tag = sStyle
hHBox.Tag = sColor
hHBox.Height = 4 * Desktop.Scale
'hHBox.Spacing = 4
hColor = New DrawingArea(hHBox) As "dwgStyle"

View file

@ -382,6 +382,7 @@ Public Sub Main()
If Not Settings["/ShowMenus", True] Then Env["APPMENU_DISPLAY_BOTH"] = "1"
Env["QT_LOGGING_RULES"] = "*.debug=false"
RegisterHighlight
UpdateTheme
DESKTOP_FONT = Application.Font.ToString()
@ -7145,3 +7146,10 @@ Private Sub PrintUsage()
Print
End
Private Sub RegisterHighlight()
TextHighlighter.Register("commit_git", ("Git commit"), "./highlight/commit_git.highlight")
TextHighlighter.Register("conflict", ("Conflict"), "./highlight/conflict.highlight")
End

View file

@ -499,7 +499,6 @@ End
Public Sub InitHistory(hEditor As TextEditor)
TextHighlighter.Register("highlight/commit_git.highlight")
hEditor.Highlight = "commit_git"
End

View file

@ -162,34 +162,34 @@ Public Sub Form_Open()
End
Public Sub edtConflict_Highlight(Text As String)
Dim iState As Integer
iState = TextHighlighter.State
TextHighlighter.Limit = False
If Text Begins "<<<<<<" Then
'iPos = String.InStr(sText, " ")
TextHighlighter.Add(Highlight.Comment, String.Len(Text))
'Highlight.Add(Highlight.Keyword, String.Len(sText) - iPos)
TextHighlighter.State = Highlight.Number
TextHighlighter.Limit = True
Else If Text Begins "======" Then
TextHighlighter.Add(Highlight.Comment, String.Len(Text))
TextHighlighter.State = Highlight.Function
Else If Text Begins ">>>>>>" Then
TextHighlighter.Add(Highlight.Comment, String.Len(Text))
'iPos = String.InStr(sText, " ")
'Highlight.Add(Highlight.Comment, iPos)
'Highlight.Add(Highlight.Keyword, String.Len(sText) - iPos)
TextHighlighter.State = Highlight.Normal
Else
TextHighlighter.Add(iState, String.Len(Text))
Endif
End
' Public Sub edtConflict_Highlight(Text As String)
'
' Dim iState As Integer
'
' iState = TextHighlighter.State
'
' TextHighlighter.Limit = False
'
' If Text Begins "<<<<<<" Then
' 'iPos = String.InStr(sText, " ")
' TextHighlighter.Add(Highlight.Comment, String.Len(Text))
' 'Highlight.Add(Highlight.Keyword, String.Len(sText) - iPos)
' TextHighlighter.State = Highlight.Number
' TextHighlighter.Limit = True
' Else If Text Begins "======" Then
' TextHighlighter.Add(Highlight.Comment, String.Len(Text))
' TextHighlighter.State = Highlight.Function
' Else If Text Begins ">>>>>>" Then
' TextHighlighter.Add(Highlight.Comment, String.Len(Text))
' 'iPos = String.InStr(sText, " ")
' 'Highlight.Add(Highlight.Comment, iPos)
' 'Highlight.Add(Highlight.Keyword, String.Len(sText) - iPos)
' TextHighlighter.State = Highlight.Normal
' Else
' TextHighlighter.Add(iState, String.Len(Text))
' Endif
'
' End
Public Sub Form_Close()

View file

@ -1,23 +1,23 @@
commit{Datatype}:
commit{Commit=Datatype}:
limit
match /^commit.*?\n/
author{Function}:
author{Author=Function}:
match /^Author:.*?\n/
date{Preprocessor}:
date{Date=Preprocessor}:
match /^Date:.*?\n/
merge{Number}:
merge{Merge=Number}:
match /^Merge:.*?\n/
diff{Datatype}:
diff{Diff=Datatype}:
limit
from /^diff/
index{Keyword}:
index{Index=Keyword}:
from /^index/
file{Keyword}:
file{File=Keyword}:
match /^(\+\+\+|---)/
file.path{String}:
match /.*?\n/
position{Function}:
position{Position=Function}:
from /^@@/ to @@
added{Added}:
from /^\+/ to "\n"

View file

@ -11,8 +11,8 @@ BODY {
font-family: default-font;*/
background: white;
color: #404040;
box-sizing: border-box;
height: 100vh;
box-sizing: border-box;
height: 100vh;
}
A {