VERSION 5.00 Object = "{72D18DD4-0DA7-11D2-8E21-00B404C10000}#2.1#0"; "ODCboLst.ocx" Begin VB.Form frmGrammar BorderStyle = 3 'Fixed Dialog Caption = " Grammar Definitions" ClientHeight = 5700 ClientLeft = 45 ClientTop = 330 ClientWidth = 6375 Icon = "frmGrammar.frx":0000 LinkTopic = "Form1" MaxButton = 0 'False MinButton = 0 'False ScaleHeight = 5700 ScaleWidth = 6375 ShowInTaskbar = 0 'False StartUpPosition = 1 'CenterOwner Begin VB.CommandButton cbDelPhrase DownPicture = "frmGrammar.frx":08CA Enabled = 0 'False Height = 315 Left = 5955 Picture = "frmGrammar.frx":09CC Style = 1 'Graphical TabIndex = 13 ToolTipText = "Delete Class" Top = 3900 Width = 330 End Begin VB.CommandButton cbAddPhrase DownPicture = "frmGrammar.frx":0ACE Enabled = 0 'False Height = 315 Left = 5955 Picture = "frmGrammar.frx":0BD0 Style = 1 'Graphical TabIndex = 12 ToolTipText = "Create New Class" Top = 3540 Width = 330 End Begin VB.TextBox txtProc Enabled = 0 'False BeginProperty Font Name = "Verdana" Size = 8.25 Charset = 0 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 315 Left = 3570 TabIndex = 15 Top = 4830 Width = 2685 End Begin VB.TextBox txtPhrase Enabled = 0 'False BeginProperty Font Name = "Verdana" Size = 8.25 Charset = 0 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 315 Left = 120 TabIndex = 14 Top = 4830 Width = 3375 End Begin VB.Frame fmKeyword BorderStyle = 0 'None Caption = "Frame1" Enabled = 0 'False Height = 390 Left = 3510 TabIndex = 23 Top = 2580 Width = 2775 Begin VB.OptionButton optKeyword Caption = "Replace" Enabled = 0 'False BeginProperty Font Name = "Verdana" Size = 8.25 Charset = 0 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 210 Index = 0 Left = 0 TabIndex = 8 Top = 135 Width = 1155 End Begin VB.OptionButton optKeyword Caption = "First" Enabled = 0 'False BeginProperty Font Name = "Verdana" Size = 8.25 Charset = 0 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 225 Index = 1 Left = 1140 TabIndex = 9 Top = 135 Width = 825 End Begin VB.OptionButton optKeyword Caption = "Last" Enabled = 0 'False BeginProperty Font Name = "Verdana" Size = 8.25 Charset = 0 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 210 Index = 2 Left = 2040 TabIndex = 10 Top = 135 Width = 855 End End Begin VB.Frame fmVerb BorderStyle = 0 'None Caption = "Frame1" Height = 900 Left = 90 TabIndex = 22 Top = 2340 Width = 1395 Begin VB.OptionButton optVerb Caption = "Synonym" Enabled = 0 'False BeginProperty Font Name = "Verdana" Size = 8.25 Charset = 0 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 210 Index = 2 Left = 30 TabIndex = 26 Top = 585 Width = 1230 End Begin VB.OptionButton optVerb Caption = "Verb" Enabled = 0 'False BeginProperty Font Name = "Verdana" Size = 8.25 Charset = 0 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 195 Index = 0 Left = 30 TabIndex = 5 Top = 30 Width = 1050 End Begin VB.OptionButton optVerb Caption = "Extend" Enabled = 0 'False BeginProperty Font Name = "Verdana" Size = 8.25 Charset = 0 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 210 Index = 1 Left = 30 TabIndex = 6 Top = 300 Width = 1050 End End Begin VB.CheckBox chkMeta Alignment = 1 'Right Justify Caption = "Meta" Enabled = 0 'False BeginProperty Font Name = "Verdana" Size = 8.25 Charset = 0 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 240 Left = 2040 TabIndex = 7 Top = 2595 Width = 855 End Begin VB.ListBox cbPhrases Enabled = 0 'False BeginProperty Font Name = "Verdana" Size = 8.25 Charset = 0 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 1035 Left = 120 TabIndex = 11 Top = 3540 Width = 5775 End Begin VB.CommandButton cbAddWord Caption = "Add" Enabled = 0 'False BeginProperty Font Name = "Verdana" Size = 8.25 Charset = 0 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 315 Left = 5490 TabIndex = 2 Top = 300 Width = 765 End Begin VB.CommandButton cbDelWord Caption = "Delete Word" Enabled = 0 'False BeginProperty Font Name = "Verdana" Size = 8.25 Charset = 0 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 270 Left = 3495 TabIndex = 4 Top = 2205 Width = 2775 End Begin VB.TextBox txtNewWord Enabled = 0 'False BeginProperty Font Name = "Verdana" Size = 8.25 Charset = 0 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 315 Left = 3495 TabIndex = 1 Top = 300 Width = 1935 End Begin VB.ListBox cbWords Enabled = 0 'False BeginProperty Font Name = "Verdana" Size = 8.25 Charset = 0 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 1425 Left = 3495 Sorted = -1 'True TabIndex = 3 Top = 705 Width = 2760 End Begin VB.CommandButton cbAddGrammar DownPicture = "frmGrammar.frx":0CD2 Height = 315 Left = 2985 Picture = "frmGrammar.frx":0DD4 Style = 1 'Graphical TabIndex = 19 ToolTipText = "Create New Class" Top = 300 Width = 330 End Begin VB.CommandButton cbDelGrammar DownPicture = "frmGrammar.frx":0ED6 Enabled = 0 'False Height = 315 Left = 2985 Picture = "frmGrammar.frx":0FD8 Style = 1 'Graphical TabIndex = 18 ToolTipText = "Delete Class" Top = 660 Width = 330 End Begin VB.CommandButton cbOK Caption = "&OK" BeginProperty Font Name = "Verdana" Size = 8.25 Charset = 0 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 375 Left = 5265 TabIndex = 16 Top = 5250 Width = 1005 End Begin ODCboLst.OwnerDrawComboList cbGrammar Height = 1860 Left = 120 TabIndex = 0 Top = 285 Width = 2805 _ExtentX = 4948 _ExtentY = 3281 BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} Name = "Courier New" Size = 8.25 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty ForeColor = 16711680 Style = 4 FullRowSelect = -1 'True MaxLength = 0 End Begin VB.Label lblProc Caption = "Procedure" Enabled = 0 'False BeginProperty Font Name = "Verdana" Size = 8.25 Charset = 0 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 180 Left = 3570 TabIndex = 25 Top = 4650 Width = 1125 End Begin VB.Label lblPhrase Caption = "Phrase" Enabled = 0 'False BeginProperty Font Name = "Verdana" Size = 8.25 Charset = 0 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 180 Left = 120 TabIndex = 24 Top = 4650 Width = 1125 End Begin VB.Label lblPhrases Caption = "Phrases and Procedures" Enabled = 0 'False BeginProperty Font Name = "Verdana" Size = 8.25 Charset = 0 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 180 Left = 120 TabIndex = 21 Top = 3345 Width = 2745 End Begin VB.Label Label2 Caption = "Add a Word" Enabled = 0 'False BeginProperty Font Name = "Verdana" Size = 8.25 Charset = 0 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 180 Left = 3510 TabIndex = 20 Top = 120 Width = 1125 End Begin VB.Label lblGrammar Caption = "Grammar" BeginProperty Font Name = "Verdana" Size = 8.25 Charset = 0 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 180 Left = 135 TabIndex = 17 Top = 90 Width = 1125 End End Attribute VB_Name = "frmGrammar" Attribute VB_GlobalNameSpace = False Attribute VB_Creatable = False Attribute VB_PredeclaredId = True Attribute VB_Exposed = False Private gm As infGrammarDefs Private Sub cbAddGrammar_Click() Dim newword As String Dim sChar As String Dim lChar As Long Dim GKey As String GetWord: newword = InputBox("Enter one of the words for the new grammar definition:", "New Grammar") If isBlank(newword) Then MsgBox "You must enter a word", vbCritical, "New Grammar" Exit Sub ElseIf Len(newword) > 9 Then MsgBox "Inform does not recognize more than letters", vbCritical, "Add Grammar" GoTo GetWord Else For lChar = 1 To Len(newword) If Not Mid(newword, lChar, 1) Like "[0-9A-Za-z_]" Then MsgBox "Grammar words may only contain A-Z, a-z, _, or 0-9", vbCritical, "Add Grammar" GoTo GetWord End If Next lChar End If GKey = inf.Modules("Main").Grammar.Add(gtVERB, False, False, newword, gkLAST, "") inf.Modules("Main").Grammar(GKey).Words.Add newword cbGrammar.AddItem newword cbGrammar.ItemData(cbGrammar.NewIndex) = inf.Modules("Main").Grammar(GKey).Index cbWords.Clear cbWords.AddItem newword optVerb(0).Value = True chkMeta.Value = 0 optKeyword(2).Value = True cbPhrases.Clear txtPhrase.Text = "" txtProc.Text = "" cbGrammar.ListIndex = cbGrammar.NewIndex End Sub Private Sub cbAddPhrase_Click() gm.Phrases.Add "", "New" cbPhrases.AddItem " -> New" cbPhrases.ItemData(cbPhrases.NewIndex) = gm.Phrases.Count cbPhrases.ListIndex = cbPhrases.ListCount - 1 End Sub Private Sub cbAddWord_Click() Dim wd As Integer Dim newword As String Dim sChar As String Dim lChar As Long Dim GKey As String newword = txtNewWord If isBlank(newword) Then MsgBox "You must enter a word", vbCritical, "New Grammar" Exit Sub ElseIf Len(newword) > 9 Then MsgBox "Inform does not recognize more than 9 letters", vbCritical, "Add Grammar" Exit Sub Else For lChar = 1 To Len(newword) If Not Mid(newword, lChar, 1) Like "[0-9A-Za-z_]" Then MsgBox "Grammar words may only contain A-Z, a-z, _, or 0-9", vbCritical, "Add Grammar" Exit Sub End If Next lChar End If With frmGrammar If .cbWords.ListCount > 0 Then For wd = 0 To .cbWords.ListCount - 1 If .cbWords.List(wd) = .txtNewWord Then MsgBox "The word is already in the list.", , "Add Word" Exit Sub End If Next wd End If .cbWords.AddItem .txtNewWord .txtNewWord.Text = "" .txtNewWord.SetFocus GKey = "G" & cbGrammar.ItemData(cbGrammar.ListIndex) inf.Modules("Main").Grammar(GKey).Words.Add newword SetAll True cbDelWord.Enabled = True cbDelPhrase.Enabled = False End With End Sub Private Sub cbDelGrammar_Click() Dim GKey As String Dim yn As String li = cbGrammar.ListIndex yn = MsgBox("Are you sure you want to delete this grammar definition?", vbYesNoCancel, "Delete Grammar") If yn = vbYes Then GKey = "G" & gm.Index inf.Modules("Main").Grammar.Remove GKey cbGrammar.RemoveItem li If cbGrammar.ListCount = 0 Then cbWords.Clear cbPhrases.Clear txtPhrase.Text = "" txtProc.Text = "" txtNewWord.Text = "" SetAll False Else cbGrammar.ListIndex = 0 End If End If End Sub Private Sub cbDelPhrase_Click() gm.Phrases.Remove "P" & cbPhrases.ItemData(cbPhrases.ListIndex) cbPhrases.RemoveItem cbPhrases.ListIndex cbDelPhrase.Enabled = False txtPhrase.Enabled = False txtProc.Enabled = False lblPhrase.Enabled = False lblProc.Enabled = False txtPhrase.Text = "" txtProc.Text = "" End Sub Private Sub cbDelWord_Click() Dim wd As String If cbWords.ListIndex = -1 Then MsgBox "Select a word to delete.", vbCritical, "Delete Word" Exit Sub ElseIf cbWords.ListCount = 1 Then MsgBox "You cannot delete the last word - delete the entire definition instead.", vbCritical, "Delete Word" Exit Sub ElseIf cbGrammar.Text = cbWords.Text Then MsgBox "You cannot delete the main word for this definition - delete the entire definition instead.", vbCritical, "Delete Word" Exit Sub End If wd = cbWords.Text gm.Words.Remove wd cbWords.RemoveItem cbWords.ListIndex End Sub Private Sub cbGrammar_Click() Dim wd As infGrammarWord Dim ph As infPhrase Set gm = inf.Modules("Main").Grammar.Item(cbGrammar.ItemData(cbGrammar.ListIndex)) optVerb(gm.GType).Value = True If gm.Meta Then chkMeta.Value = 1 Else chkMeta.Value = 0 cbWords.Clear For Each wd In gm.Words If gm.GType = gtSYNONYM Then If wd.Word <> gm.Definition Then cbWords.AddItem wd.Word End If Else cbWords.AddItem wd.Word End If Next optKeyword(gm.Keyword).Value = True cbPhrases.Clear For Each ph In gm.Phrases cbPhrases.AddItem ph.Definition & " -> " & ph.ProcedureName cbPhrases.ItemData(cbPhrases.NewIndex) = ph.Index Next SetAll True CheckOption gm.GType cbDelWord.Enabled = False cbDelPhrase.Enabled = False txtPhrase.Enabled = False txtProc.Enabled = False lblPhrase.Enabled = False lblProc.Enabled = False End Sub Private Sub cbOk_Click() Unload Me End Sub Private Sub cbPhrases_Click() SetFields = True txtPhrase.Text = gm.Phrases("P" & cbPhrases.ItemData(cbPhrases.ListIndex)).Definition txtProc.Text = gm.Phrases("P" & cbPhrases.ItemData(cbPhrases.ListIndex)).ProcedureName SetFields = False cbDelPhrase.Enabled = True txtPhrase.Enabled = True txtProc.Enabled = True lblPhrase.Enabled = True lblProc.Enabled = True End Sub Private Sub cbWords_Click() cbDelWord.Enabled = True End Sub Private Sub Form_Load() Dim gd As infGrammarDefs Dim wd As infGrammarWord If inf.Modules("Main").Grammar.Count = 0 Then Exit Sub For Each gd In inf.Modules("Main").Grammar If gd.GType = gtSYNONYM Then cbGrammar.AddItem gd.Definition cbGrammar.ItemData(cbGrammar.NewIndex) = gd.Index Else For Each wd In gd.Words cbGrammar.AddItem wd.Word cbGrammar.ItemData(cbGrammar.NewIndex) = gd.Index Next End If Next SetAll True txtPhrase.Enabled = False txtProc.Enabled = False lblPhrase.Enabled = False lblProc.Enabled = False cbGrammar.ListIndex = 0 End Sub Private Sub optVerb_Click(Index As Integer) CheckOption Index End Sub Private Sub txtNewWord_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then cbAddWord_Click End If End Sub Private Sub SetAll(bSet As Boolean) Dim oItem As Variant On Error Resume Next For Each oItem In frmGrammar.Controls If oItem.Name <> "cbGrammar" And oItem.Name <> "cbAddGrammar" And oItem.Name <> "cbOK" And oItem.Name <> "lblGrammar" Then oItem.Enabled = bSet End If Next On Error GoTo 0 End Sub Private Sub txtPhrase_Change() Dim ph As infPhrase Dim PKey As String Dim li As Long If cbPhrases.ListIndex = -1 Then Exit Sub PKey = "P" & cbPhrases.ItemData(cbPhrases.ListIndex) gm.Phrases(PKey).Definition = txtPhrase.Text li = cbPhrases.ListIndex cbPhrases.List(li) = gm.Phrases(PKey).Definition & " -> " & gm.Phrases(PKey).ProcedureName cbPhrases.ItemData(li) = gm.Phrases(PKey).Index cbPhrases.ListIndex = li End Sub Private Sub txtProc_Change() Dim ph As infPhrase Dim PKey As String Dim li As Long If cbPhrases.ListIndex = -1 Then Exit Sub PKey = "P" & cbPhrases.ItemData(cbPhrases.ListIndex) gm.Phrases(PKey).ProcedureName = txtProc.Text li = cbPhrases.ListIndex cbPhrases.List(li) = gm.Phrases(PKey).Definition & " -> " & gm.Phrases(PKey).ProcedureName cbPhrases.ItemData(li) = gm.Phrases(PKey).Index cbPhrases.ListIndex = li End Sub Private Sub CheckOption(Index As Integer) If Index = gtSYNONYM Then chkMeta.Enabled = False optKeyword(0).Enabled = False optKeyword(1).Enabled = False optKeyword(2).Enabled = False lblPhrases.Enabled = False cbPhrases.Enabled = False cbAddPhrase.Enabled = False cbDelPhrase.Enabled = False Else chkMeta.Enabled = True optKeyword(0).Enabled = True optKeyword(1).Enabled = True optKeyword(2).Enabled = True lblPhrases.Enabled = True cbPhrases.Enabled = True cbAddPhrase.Enabled = True cbDelPhrase.Enabled = True End If End Sub