Option Explicit
Public strDir As String
Private Sub cmbLexer_Click()
If txtName.Text = "" Then txtName.Text = cmbLexer.Text
End Sub
Private Sub cmdCancel_Click()
Unload Me
End Sub
Private Sub cmdOK_Click()
Dim strFile As String
Dim strHold As String
Dim lLang As Integer
Dim strLang As String
Dim i As Long
If txtName.Text = "" Then
MsgBox "Please enter a valid name for this language"
Exit Sub
End If
lLang = cmbLexer.ListIndex
If lLang > 28 Then lLang = lLang + 2
strLang = lLang
Dim hTemp As Highlighter
For i = 0 To 127
'hTemp.StyleBack(i) = clrBack.SelectedColor
'hTemp.StyleFore(i) = clrFore.SelectedColor
hTemp.StyleFont(i) = cmbFont.Text
hTemp.StyleVisible(i) = 1
hTemp.StyleSize(i) = txtSize.Text
Next i
hTemp.iLang = lLang
hTemp.strName = txtName.Text
strFile = strDir & "\" & txtName.Text & ".bin"
Open strFile For Binary Access Write As #1
hTemp.strFile = strFile
Put #1, , hTemp
Close #1
' strFile = strDir & "\" & txtName.Text & ".CHL"
' writeini "data", "LangName", txtName.Text, strFile
' writeini "data", "Language", strLang, strFile
' strHold = ":::V:C:::" & cmbFont.Text & ":" & txtSize.Text & ":" & clrBack.SelectedColor & ":" & clrBack.SelectedColor & "::"
' writeini "data", "Style[32]", strHold, strFile
LoadHighlighter strFile
'frmOptions.ListLangs strDir
Unload Me
End Sub
Private Sub Form_Load()
Dim i As Long
For i = 0 To Screen.FontCount - 1
cmbFont.AddItem Screen.Fonts(i)
Next i
cmbFont.Text = "Courier New"
cmbLexer.ListIndex = 3
End Sub
Private Sub txtSize_KeyPress(KeyAscii As Integer)
If Not IsNumeric(Chr(KeyAscii)) And (KeyAscii <> 8) Then KeyAscii = 0
End Sub