Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

314 lines
8.2 KiB

  1. VERSION 5.00
  2. Begin VB.Form frmStopSigns
  3. BorderStyle = 1 'Fixed Single
  4. Caption = "Edit Stop Signs"
  5. ClientHeight = 5910
  6. ClientLeft = 45
  7. ClientTop = 330
  8. ClientWidth = 6480
  9. LinkTopic = "Form1"
  10. MaxButton = 0 'False
  11. MinButton = 0 'False
  12. ScaleHeight = 5910
  13. ScaleWidth = 6480
  14. StartUpPosition = 3 'Windows Default
  15. Begin VB.Frame fraSeparator
  16. Height = 135
  17. Left = 120
  18. TabIndex = 11
  19. Top = 5160
  20. Width = 6255
  21. End
  22. Begin VB.ListBox lstAllStopSigns
  23. BeginProperty Font
  24. Name = "Lucida Console"
  25. Size = 8.25
  26. Charset = 0
  27. Weight = 400
  28. Underline = 0 'False
  29. Italic = 0 'False
  30. Strikethrough = 0 'False
  31. EndProperty
  32. Height = 4020
  33. Left = 120
  34. TabIndex = 1
  35. Top = 360
  36. Width = 3135
  37. End
  38. Begin VB.Frame fraCreate
  39. Caption = "Create new Stop Sign"
  40. Height = 2415
  41. Left = 3360
  42. TabIndex = 3
  43. Top = 240
  44. Width = 3015
  45. Begin VB.CommandButton cmdCreate
  46. Caption = "Create"
  47. Height = 375
  48. Left = 1680
  49. TabIndex = 9
  50. Top = 1920
  51. Width = 1215
  52. End
  53. Begin VB.Frame fraContext
  54. Caption = "Context"
  55. Height = 855
  56. Left = 120
  57. TabIndex = 6
  58. Top = 840
  59. Width = 2775
  60. Begin VB.OptionButton optAtEndOfWord
  61. Caption = "At end of word"
  62. Height = 255
  63. Left = 240
  64. TabIndex = 8
  65. Top = 480
  66. Width = 2415
  67. End
  68. Begin VB.OptionButton optAnywhere
  69. Caption = "Anywhere"
  70. Height = 255
  71. Left = 240
  72. TabIndex = 7
  73. Top = 240
  74. Width = 2415
  75. End
  76. End
  77. Begin VB.TextBox txtStopSign
  78. BeginProperty Font
  79. Name = "Lucida Console"
  80. Size = 8.25
  81. Charset = 0
  82. Weight = 400
  83. Underline = 0 'False
  84. Italic = 0 'False
  85. Strikethrough = 0 'False
  86. EndProperty
  87. Height = 285
  88. Left = 960
  89. TabIndex = 5
  90. Top = 360
  91. Width = 1935
  92. End
  93. Begin VB.Label lblStopSign
  94. Caption = "Stop Sign:"
  95. Height = 255
  96. Left = 120
  97. TabIndex = 4
  98. Top = 360
  99. Width = 735
  100. End
  101. End
  102. Begin VB.CommandButton cmdDelete
  103. Caption = "Delete"
  104. Height = 375
  105. Left = 2040
  106. TabIndex = 2
  107. Top = 4680
  108. Width = 1215
  109. End
  110. Begin VB.CommandButton cmdClose
  111. Caption = "Close"
  112. Height = 375
  113. Left = 5160
  114. TabIndex = 10
  115. Top = 5400
  116. Width = 1215
  117. End
  118. Begin VB.Label lblAllStopSigns
  119. Caption = "All Stop Signs:"
  120. Height = 255
  121. Left = 120
  122. TabIndex = 0
  123. Top = 120
  124. Width = 1215
  125. End
  126. End
  127. Attribute VB_Name = "frmStopSigns"
  128. Attribute VB_GlobalNameSpace = False
  129. Attribute VB_Creatable = False
  130. Attribute VB_PredeclaredId = True
  131. Attribute VB_Exposed = False
  132. Option Explicit
  133. Private p_clsStopSigns As AuthDatabase.StopSigns
  134. Private p_rsAllStopSigns As ADODB.Recordset
  135. Private Sub Form_Load()
  136. On Error GoTo LErrorHandler
  137. Set p_clsStopSigns = g_AuthDatabase.StopSigns
  138. Set p_rsAllStopSigns = New ADODB.Recordset
  139. p_UpdateAllStopSigns
  140. optAnywhere.Value = True
  141. cmdClose.Cancel = True
  142. p_SetToolTips
  143. LEnd:
  144. Exit Sub
  145. LErrorHandler:
  146. p_DisplayErrorMessage "Form_Load"
  147. GoTo LEnd
  148. End Sub
  149. Private Sub Form_Unload(Cancel As Integer)
  150. Set p_clsStopSigns = Nothing
  151. Set p_rsAllStopSigns = Nothing
  152. End Sub
  153. Private Sub lstAllStopSigns_Click()
  154. On Error GoTo LErrorHandler
  155. p_rsAllStopSigns.Move lstAllStopSigns.ListIndex, adBookmarkFirst
  156. LEnd:
  157. Exit Sub
  158. LErrorHandler:
  159. p_DisplayErrorMessage "lstAllStopSigns_Click"
  160. GoTo LEnd
  161. End Sub
  162. Private Sub cmdDelete_Click()
  163. On Error GoTo LErrorHandler
  164. p_clsStopSigns.Delete p_rsAllStopSigns("SSID")
  165. p_UpdateAllStopSigns
  166. LEnd:
  167. Exit Sub
  168. LErrorHandler:
  169. p_DisplayErrorMessage "cmdDelete_Click"
  170. GoTo LEnd
  171. End Sub
  172. Private Sub cmdCreate_Click()
  173. On Error GoTo LErrorHandler
  174. Dim strStopSign As String
  175. Dim intContext As Long
  176. strStopSign = LCase$(RemoveExtraSpaces(txtStopSign.Text))
  177. If (strStopSign = "") Then
  178. GoTo LEnd
  179. End If
  180. If (optAnywhere) Then
  181. intContext = CONTEXT_ANYWHERE_E
  182. Else
  183. intContext = CONTEXT_AT_END_OF_WORD_E
  184. End If
  185. p_clsStopSigns.Create strStopSign, intContext
  186. p_UpdateAllStopSigns
  187. txtStopSign.Text = ""
  188. txtStopSign.SetFocus
  189. LEnd:
  190. Exit Sub
  191. LErrorHandler:
  192. p_DisplayErrorMessage "cmdCreate_Click"
  193. GoTo LEnd
  194. End Sub
  195. Private Sub cmdClose_Click()
  196. Unload Me
  197. End Sub
  198. Private Sub p_UpdateAllStopSigns()
  199. Dim strSuffix As String
  200. p_clsStopSigns.GetAllStopSignsRs p_rsAllStopSigns
  201. lstAllStopSigns.Clear
  202. Do While (Not p_rsAllStopSigns.EOF)
  203. If (Not IsNull(p_rsAllStopSigns("Context"))) Then
  204. If (p_rsAllStopSigns("Context") = CONTEXT_ANYWHERE_E) Then
  205. strSuffix = " (Anywhere)"
  206. Else
  207. strSuffix = " (At end of word)"
  208. End If
  209. lstAllStopSigns.AddItem p_rsAllStopSigns("StopSign") & strSuffix
  210. End If
  211. p_rsAllStopSigns.MoveNext
  212. Loop
  213. If (lstAllStopSigns.ListCount > 0) Then
  214. ' This simulates clicking the list box.
  215. lstAllStopSigns.ListIndex = 0
  216. End If
  217. End Sub
  218. Private Sub p_DisplayErrorMessage( _
  219. ByVal i_strFunction As String _
  220. )
  221. Select Case Err.Number
  222. Case errTooLong
  223. MsgBox "The Stop Sign " & txtStopSign & " is too long", _
  224. vbExclamation + vbOKOnly
  225. Case errContainsOperatorShortcut
  226. MsgBox "Since the Stop Sign " & txtStopSign & " is an operator shortcut, " & _
  227. "its context must be ""At end of word""", _
  228. vbExclamation + vbOKOnly
  229. Case errAlreadyExists
  230. MsgBox "The Stop Sign " & txtStopSign & " already exists", _
  231. vbExclamation + vbOKOnly
  232. Case E_FAIL
  233. DisplayDatabaseLockedError
  234. Case errDatabaseVersionIncompatible
  235. DisplayDatabaseVersionError
  236. Case errNotPermittedForAuthoringGroup, errAuthoringGroupDiffers, _
  237. errAuthoringGroupNotPresent
  238. DisplayAuthoringGroupError
  239. Case Else
  240. g_ErrorInfo.SetInfoAndDump i_strFunction
  241. End Select
  242. End Sub
  243. Private Sub p_SetToolTips()
  244. lblAllStopSigns.ToolTipText = "This is a list of all stop signs that have been " & _
  245. "created for this database."
  246. lstAllStopSigns.ToolTipText = lblAllStopSigns.ToolTipText
  247. txtStopSign.ToolTipText = "Type in a new stop sign to add to the list."
  248. optAnywhere.ToolTipText = "If Anywhere is selected as the context for a stop sign, " & _
  249. "the search engine will remove all instances of the stop sign from the " & _
  250. "search string."
  251. optAtEndOfWord.ToolTipText = "If At end of word is selected as the context for " & _
  252. "a stop sign, the search engine will remove instances of the stop sign from " & _
  253. "the search string only when it appears at the end of a word."
  254. End Sub