TextHighlighterTheme: Fix ToString() method.
[GB.EVAL.HIGHLIGHT] * BUG: TextHighlighterTheme: Fix ToString() method. * NEW: TextHighlighterTheme: Initialize directly from the IDE 'gambas' theme file.
This commit is contained in:
parent
44f77955f3
commit
879d0796fc
1 changed files with 21 additions and 57 deletions
|
@ -13,52 +13,7 @@ Private $cStyles As New Collection
|
|||
|
||||
Public Sub _new()
|
||||
|
||||
Add("Background", &HFFFFFF)
|
||||
Add("Normal", &H000000)
|
||||
Add("Keyword", &H000000, True)
|
||||
Add("Datatype", &HDF6B00, True)
|
||||
Add("Function", &H3398C3, True)
|
||||
Add("Operator", &H000000, True)
|
||||
Add("Symbol", &H000000)
|
||||
Add("Number", &HE00000, True)
|
||||
Add("String", &H7F0000)
|
||||
Add("Comment", &H808080)
|
||||
Add("Documentation", &H808080, True)
|
||||
Add("Preprocessor", &H008040, True)
|
||||
Add("Breakpoint", &HFF5F5F)
|
||||
Add("Current", &H42C9FF)
|
||||
Add("Selection", &HC3EDFF)
|
||||
Add("Highlight", &H6FE06F)
|
||||
Add("CurrentLine", &HE7F3FF)
|
||||
Add("Error", &HBF0303, False, True)
|
||||
Add("Escape", &H7F0000, True, False, True)
|
||||
Add("Label", &H000000, False, False, True)
|
||||
Add("Constant", &H800080, True)
|
||||
Add("Alternate", &HFFFF7F)
|
||||
Add("Added", &H006000, True)
|
||||
Add("Removed", &H800000).Strikeout = True
|
||||
|
||||
Me["Class"] = Me["Datatype"]
|
||||
Me["Id"] = Me["Function"]
|
||||
Me["Element"] = Me["Keyword"]
|
||||
Me["Property"] = Me["Symbol"]
|
||||
Add("Pseudo", &H404040, True)
|
||||
Me["Rule"] = Me["Preprocessor"]
|
||||
Me["Important"] = Me["Number"]
|
||||
Me["Important"].Underline = True
|
||||
|
||||
Me["File"] = Me["Documentation"]
|
||||
Me["Header"] = Me["Comment"]
|
||||
Me["Position"] = Me["Keyword"]
|
||||
|
||||
Me["Markup"] = Me["Function"]
|
||||
Me["Attribute"] = Me["Operator"]
|
||||
Me["Value"] = Me["String"]
|
||||
Me["Entity"] = Me["Datatype"]
|
||||
|
||||
Me["WebMarkup"] = Me["Preprocessor"]
|
||||
Me["WebComment"] = Me["Documentation"]
|
||||
Add("WebArgument", &H008040)
|
||||
_Load("gambas")
|
||||
|
||||
End
|
||||
|
||||
|
@ -132,9 +87,8 @@ Public Sub Save(Path As String)
|
|||
|
||||
End
|
||||
|
||||
Static Public Sub Load(Path As String) As TextHighlighterTheme
|
||||
Public Sub _Load(Path As String)
|
||||
|
||||
Dim hTheme As TextHighlighterTheme
|
||||
Dim aTheme As String[]
|
||||
Dim I As Integer
|
||||
Dim sLine As String
|
||||
|
@ -142,12 +96,6 @@ Static Public Sub Load(Path As String) As TextHighlighterTheme
|
|||
Dim sName As String
|
||||
Dim hStyle As TextHighlighterStyle
|
||||
|
||||
hTheme = New TextHighlighterTheme
|
||||
|
||||
If File.IsRelative(Path) Then
|
||||
Path = ".." &/ Path
|
||||
Endif
|
||||
|
||||
aTheme = Split(File.Load(Path), "\n")
|
||||
If aTheme[0] <> "[Gambas Highlighting Theme 1.0]" And If aTheme[0] <> "[Theme]" Then Goto RAISE_ERROR
|
||||
|
||||
|
@ -160,11 +108,11 @@ Static Public Sub Load(Path As String) As TextHighlighterTheme
|
|||
If Not sName Or If Not IsAlnum(sName) Then Goto RAISE_ERROR
|
||||
|
||||
hStyle = TextHighlighterStyle.FromString(UnQuote(Trim(Mid$(sLine, iPos + 1))))
|
||||
hTheme[sName] = hStyle
|
||||
Me[sName] = hStyle
|
||||
|
||||
Next
|
||||
|
||||
Return hTheme
|
||||
Return
|
||||
|
||||
RAISE_ERROR:
|
||||
|
||||
|
@ -172,6 +120,22 @@ RAISE_ERROR:
|
|||
|
||||
End
|
||||
|
||||
|
||||
Static Public Sub Load(Path As String) As TextHighlighterTheme
|
||||
|
||||
Dim hTheme As TextHighlighterTheme
|
||||
|
||||
hTheme = New TextHighlighterTheme
|
||||
|
||||
If File.IsRelative(Path) Then
|
||||
Path = ".." &/ Path
|
||||
Endif
|
||||
|
||||
hTheme._Load(Path)
|
||||
Return hTheme
|
||||
|
||||
End
|
||||
|
||||
Public Sub ToString() As String
|
||||
|
||||
Dim hStyle As TextHighlighterStyle
|
||||
|
@ -179,7 +143,7 @@ Public Sub ToString() As String
|
|||
|
||||
aStyle = New String[]
|
||||
For Each hStyle In $cStyles
|
||||
aStyle.Add(hStyle.Name & "=" & hStyle.ToString())
|
||||
aStyle.Add(hStyle.Key & "=" & hStyle.ToString())
|
||||
Next
|
||||
|
||||
Return aStyle.Join(";")
|
||||
|
|
Loading…
Reference in a new issue