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.

374 lines
9.6 KiB

  1. VERSION 5.00
  2. Begin VB.Form frmFind
  3. Caption = "Find"
  4. ClientHeight = 8265
  5. ClientLeft = 360
  6. ClientTop = 540
  7. ClientWidth = 6015
  8. LinkTopic = "Form1"
  9. ScaleHeight = 8265
  10. ScaleWidth = 6015
  11. Begin VB.ListBox lstConditions
  12. Height = 960
  13. Left = 120
  14. Style = 1 'Checkbox
  15. TabIndex = 5
  16. Top = 2400
  17. Width = 5775
  18. End
  19. Begin VB.CommandButton cmdClose
  20. Caption = "Close"
  21. Height = 375
  22. Left = 4680
  23. TabIndex = 7
  24. Top = 3480
  25. Width = 1215
  26. End
  27. Begin VB.CommandButton cmdFind
  28. Caption = "Find"
  29. Height = 375
  30. Left = 3360
  31. TabIndex = 6
  32. Top = 3480
  33. Width = 1215
  34. End
  35. Begin VB.ListBox lstEntries
  36. Height = 4155
  37. ItemData = "frmFind.frx":0000
  38. Left = 120
  39. List = "frmFind.frx":0007
  40. TabIndex = 9
  41. Top = 3960
  42. Width = 5775
  43. End
  44. Begin VB.Frame fraString
  45. Caption = "String"
  46. Height = 1935
  47. Left = 120
  48. TabIndex = 0
  49. Top = 120
  50. Width = 5775
  51. Begin VB.ListBox lstFields
  52. Height = 960
  53. Left = 120
  54. Style = 1 'Checkbox
  55. TabIndex = 3
  56. Top = 840
  57. Width = 5535
  58. End
  59. Begin VB.ComboBox cboString
  60. Height = 315
  61. Left = 120
  62. TabIndex = 1
  63. Top = 240
  64. Width = 5535
  65. End
  66. Begin VB.Label lblFields
  67. Caption = "Find in:"
  68. Height = 255
  69. Left = 120
  70. TabIndex = 2
  71. Top = 600
  72. Width = 4095
  73. End
  74. End
  75. Begin VB.Label lblConditions
  76. Caption = "Which conditions do you want to check?"
  77. Height = 255
  78. Left = 120
  79. TabIndex = 4
  80. Top = 2160
  81. Width = 4935
  82. End
  83. Begin VB.Label lblEntries
  84. Caption = "Click on an entry:"
  85. Height = 255
  86. Left = 120
  87. TabIndex = 8
  88. Top = 3720
  89. Width = 2775
  90. End
  91. End
  92. Attribute VB_Name = "frmFind"
  93. Attribute VB_GlobalNameSpace = False
  94. Attribute VB_Creatable = False
  95. Attribute VB_PredeclaredId = True
  96. Attribute VB_Exposed = False
  97. Option Explicit
  98. Private p_clsSizer As Sizer
  99. Private Sub Form_Load()
  100. On Error GoTo LErrorHandler
  101. cmdClose.Cancel = True
  102. cmdFind.Default = True
  103. lstEntries.Clear
  104. p_InitializeFields
  105. p_InitializeConditions
  106. p_SetToolTips
  107. Set p_clsSizer = New Sizer
  108. LEnd:
  109. Exit Sub
  110. LErrorHandler:
  111. GoTo LEnd
  112. End Sub
  113. Private Sub Form_Unload(Cancel As Integer)
  114. Set p_clsSizer = Nothing
  115. End Sub
  116. Private Sub Form_Activate()
  117. On Error GoTo LErrorHandler
  118. p_SetSizingInfo
  119. LEnd:
  120. Exit Sub
  121. LErrorHandler:
  122. GoTo LEnd
  123. End Sub
  124. Private Sub Form_Resize()
  125. On Error GoTo LErrorHandler
  126. p_clsSizer.Resize
  127. LEnd:
  128. Exit Sub
  129. LErrorHandler:
  130. GoTo LEnd
  131. End Sub
  132. Private Sub cmdFind_Click()
  133. On Error GoTo LErrorHandler
  134. Dim DOMNodeList As MSXML2.IXMLDOMNodeList
  135. Dim DOMNode As MSXML2.IXMLDOMNode
  136. Dim enumSearchTargets As SEARCH_TARGET_E
  137. Dim intIndex As Long
  138. Dim strText As String
  139. enumSearchTargets = p_GetSearchTargets
  140. If (enumSearchTargets = 0) Then
  141. MsgBox "Please select some search options", vbOKOnly
  142. Exit Sub
  143. End If
  144. lstEntries.Clear
  145. strText = cboString.Text
  146. p_AddStringIfRequired strText
  147. Set DOMNodeList = frmMain.Find(strText, enumSearchTargets)
  148. If (DOMNodeList.length = 0) Then
  149. MsgBox "No matching entry found", vbOKOnly
  150. Exit Sub
  151. End If
  152. For intIndex = 0 To DOMNodeList.length - 1
  153. Set DOMNode = DOMNodeList(intIndex)
  154. lstEntries.AddItem "[" & (intIndex + 1) & "] " & _
  155. XMLGetAttribute(DOMNode, HHT_TITLE_C)
  156. lstEntries.ItemData(lstEntries.NewIndex) = XMLGetAttribute(DOMNode, HHT_tid_C)
  157. Next
  158. LEnd:
  159. Exit Sub
  160. LErrorHandler:
  161. GoTo LEnd
  162. End Sub
  163. Private Sub cmdClose_Click()
  164. lstEntries.Clear
  165. Hide
  166. End Sub
  167. Private Sub lstEntries_DblClick()
  168. lstEntries_Click
  169. End Sub
  170. Private Sub lstEntries_Click()
  171. frmMain.Highlight lstEntries.ItemData(lstEntries.ListIndex)
  172. End Sub
  173. Private Sub p_AddStringIfRequired(i_str As String)
  174. Dim intIndex As Long
  175. Dim str As String
  176. str = LCase$(i_str)
  177. For intIndex = 0 To cboString.ListCount - 1
  178. If (str = LCase$(cboString.List(intIndex))) Then
  179. Exit Sub
  180. End If
  181. Next
  182. cboString.AddItem i_str, 0
  183. End Sub
  184. Private Function p_GetSearchTargets() As SEARCH_TARGET_E
  185. Dim enumSearchTargets As SEARCH_TARGET_E
  186. Dim intIndex As Long
  187. For intIndex = 0 To lstFields.ListCount - 1
  188. If (lstFields.Selected(intIndex)) Then
  189. enumSearchTargets = enumSearchTargets Or lstFields.ItemData(intIndex)
  190. End If
  191. Next
  192. For intIndex = 0 To lstConditions.ListCount - 1
  193. If (lstConditions.Selected(intIndex)) Then
  194. enumSearchTargets = enumSearchTargets Or lstConditions.ItemData(intIndex)
  195. End If
  196. Next
  197. p_GetSearchTargets = enumSearchTargets
  198. End Function
  199. Private Sub p_InitializeFields()
  200. lstFields.AddItem "Title"
  201. lstFields.ItemData(lstFields.NewIndex) = ST_TITLE_E
  202. lstFields.AddItem "URI"
  203. lstFields.ItemData(lstFields.NewIndex) = ST_URI_E
  204. lstFields.AddItem "Description"
  205. lstFields.ItemData(lstFields.NewIndex) = ST_DESCRIPTION_E
  206. lstFields.AddItem "Comments"
  207. lstFields.ItemData(lstFields.NewIndex) = ST_COMMENTS_E
  208. lstFields.AddItem "Imported File"
  209. lstFields.ItemData(lstFields.NewIndex) = ST_BASE_FILE_E
  210. End Sub
  211. Private Sub p_InitializeConditions()
  212. lstConditions.AddItem "Topics without associated keywords"
  213. lstConditions.ItemData(lstConditions.NewIndex) = ST_TOPICS_WITHOUT_KEYWORDS_E
  214. lstConditions.AddItem "Nodes without associated keywords"
  215. lstConditions.ItemData(lstConditions.NewIndex) = ST_NODES_WITHOUT_KEYWORDS_E
  216. lstConditions.AddItem "In my Authoring Group"
  217. lstConditions.ItemData(lstConditions.NewIndex) = ST_SELF_AUTHORING_GROUP_E
  218. lstConditions.AddItem "Windows Me broken links"
  219. lstConditions.ItemData(lstConditions.NewIndex) = ST_BROKEN_LINK_WINME_E
  220. lstConditions.AddItem "Windows XP Personal broken links"
  221. lstConditions.ItemData(lstConditions.NewIndex) = ST_BROKEN_LINK_STD_E
  222. lstConditions.AddItem "Windows XP Professional broken links"
  223. lstConditions.ItemData(lstConditions.NewIndex) = ST_BROKEN_LINK_PRO_E
  224. lstConditions.AddItem "Windows XP 64-bit Professional broken links"
  225. lstConditions.ItemData(lstConditions.NewIndex) = ST_BROKEN_LINK_PRO64_E
  226. lstConditions.AddItem "Windows XP Server broken links"
  227. lstConditions.ItemData(lstConditions.NewIndex) = ST_BROKEN_LINK_SRV_E
  228. lstConditions.AddItem "Windows XP Advanced Server broken links"
  229. lstConditions.ItemData(lstConditions.NewIndex) = ST_BROKEN_LINK_ADV_E
  230. lstConditions.AddItem "Windows XP 64-bit Advanced Server broken links"
  231. lstConditions.ItemData(lstConditions.NewIndex) = ST_BROKEN_LINK_ADV64_E
  232. lstConditions.AddItem "Windows XP Datacenter Server broken links"
  233. lstConditions.ItemData(lstConditions.NewIndex) = ST_BROKEN_LINK_DAT_E
  234. lstConditions.AddItem "Windows XP 64-bit Datacenter Server broken links"
  235. lstConditions.ItemData(lstConditions.NewIndex) = ST_BROKEN_LINK_DAT64_E
  236. ' lstConditions.AddItem "Marked for Indexer"
  237. ' lstConditions.ItemData(lstConditions.NewIndex) = ST_MARK1_E
  238. End Sub
  239. Private Sub p_SetSizingInfo()
  240. Static blnInfoSet As Boolean
  241. ' If (blnInfoSet) Then
  242. ' Exit Sub
  243. ' End If
  244. p_clsSizer.AddControl fraString
  245. Set p_clsSizer.ReferenceControl(DIM_WIDTH_E) = Me
  246. p_clsSizer.AddControl cboString
  247. Set p_clsSizer.ReferenceControl(DIM_WIDTH_E) = fraString
  248. p_clsSizer.AddControl lstFields
  249. Set p_clsSizer.ReferenceControl(DIM_WIDTH_E) = fraString
  250. p_clsSizer.AddControl lstConditions
  251. Set p_clsSizer.ReferenceControl(DIM_WIDTH_E) = Me
  252. p_clsSizer.AddControl cmdFind
  253. Set p_clsSizer.ReferenceControl(DIM_LEFT_E) = Me
  254. p_clsSizer.ReferenceDimension(DIM_LEFT_E) = DIM_WIDTH_E
  255. p_clsSizer.AddControl cmdClose
  256. Set p_clsSizer.ReferenceControl(DIM_LEFT_E) = Me
  257. p_clsSizer.ReferenceDimension(DIM_LEFT_E) = DIM_WIDTH_E
  258. p_clsSizer.AddControl lstEntries
  259. Set p_clsSizer.ReferenceControl(DIM_WIDTH_E) = Me
  260. Set p_clsSizer.ReferenceControl(DIM_HEIGHT_E) = Me
  261. ' blnInfoSet = True
  262. End Sub
  263. Private Sub p_SetToolTips()
  264. cboString.ToolTipText = "Type the word or words you want to search for."
  265. lblFields.ToolTipText = "Select which fields you want to search within."
  266. lstFields.ToolTipText = lblFields.ToolTipText
  267. lblConditions.ToolTipText = "Select other conditions that the search must meet."
  268. lstConditions.ToolTipText = lblConditions.ToolTipText
  269. lblEntries.ToolTipText = "Click on an entry to display it in the taxonomy."
  270. lstEntries.ToolTipText = lblEntries.ToolTipText
  271. End Sub