home *** CD-ROM | disk | FTP | other *** search
/ Super Net 1 / SUPERNET_1.iso / PC / OTROS / EXTRAS / WINWAIS / VB / WSRC.FRM (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1994-02-07  |  32.5 KB  |  988 lines

  1. VERSION 2.00
  2. Begin Form wsrc_form 
  3.    AutoRedraw      =   -1  'True
  4.    BackColor       =   &H00FFFFFF&
  5.    Caption         =   "View"
  6.    ClientHeight    =   4395
  7.    ClientLeft      =   -30
  8.    ClientTop       =   1995
  9.    ClientWidth     =   9525
  10.    DrawMode        =   6  'Invert
  11.    FontBold        =   0   'False
  12.    FontItalic      =   0   'False
  13.    FontName        =   "Terminal"
  14.    FontSize        =   9
  15.    FontStrikethru  =   0   'False
  16.    FontUnderline   =   0   'False
  17.    Height          =   5085
  18.    Left            =   -90
  19.    LinkMode        =   1  'Source
  20.    LinkTopic       =   "Form1"
  21.    MinButton       =   0   'False
  22.    ScaleHeight     =   4395
  23.    ScaleWidth      =   9525
  24.    Top             =   1365
  25.    Width           =   9645
  26.    Begin VScrollBar wsrc_scroll 
  27.       Height          =   945
  28.       Left            =   9210
  29.       TabIndex        =   25
  30.       Top             =   540
  31.       Width           =   285
  32.    End
  33.    Begin SSPanel wsrc_frame 
  34.       Align           =   2  'Align Bottom
  35.       Alignment       =   0  'Left Justify - TOP
  36.       BackColor       =   &H00C0C0C0&
  37.       BevelInner      =   1  'Inset
  38.       Caption         =   " Potential New WAIS Source"
  39.       Font3D          =   0  'None
  40.       ForeColor       =   &H00000000&
  41.       Height          =   2880
  42.       Left            =   0
  43.       Outline         =   -1  'True
  44.       TabIndex        =   10
  45.       Top             =   1515
  46.       Width           =   9525
  47.       Begin SSPanel Panel3D2 
  48.          Alignment       =   6  'Center - TOP
  49.          BackColor       =   &H00C0C0C0&
  50.          BevelOuter      =   1  'Inset
  51.          Caption         =   "Panel3D2"
  52.          Font3D          =   1  'Raised w/light shading
  53.          ForeColor       =   &H00000000&
  54.          Height          =   2595
  55.          Left            =   7080
  56.          Outline         =   -1  'True
  57.          TabIndex        =   32
  58.          Top             =   150
  59.          Width           =   2325
  60.          Begin CommandButton add_source 
  61.             Caption         =   "Add This Source"
  62.             Height          =   405
  63.             Left            =   360
  64.             TabIndex        =   24
  65.             Top             =   1950
  66.             Width           =   1605
  67.          End
  68.          Begin Label Label1 
  69.             BackColor       =   &H00C0C0C0&
  70.             Caption         =   "This is a new WAIS information source.  Press the button below to add this source to your list of available sources.  You may edit the entries to the left prior to pressing the ADD button."
  71.             Height          =   1725
  72.             Left            =   60
  73.             TabIndex        =   26
  74.             Top             =   60
  75.             Width           =   2265
  76.          End
  77.       End
  78.       Begin SSPanel Panel3D1 
  79.          Alignment       =   6  'Center - TOP
  80.          BackColor       =   &H00C0C0C0&
  81.          BevelOuter      =   1  'Inset
  82.          Font3D          =   1  'Raised w/light shading
  83.          ForeColor       =   &H00000000&
  84.          Height          =   465
  85.          Left            =   1110
  86.          Outline         =   -1  'True
  87.          TabIndex        =   30
  88.          Top             =   810
  89.          Width           =   855
  90.          Begin TextBox s_add_prefix 
  91.             BackColor       =   &H00FFFFFF&
  92.             FontBold        =   0   'False
  93.             FontItalic      =   0   'False
  94.             FontName        =   "Terminal"
  95.             FontSize        =   9
  96.             FontStrikethru  =   0   'False
  97.             FontUnderline   =   0   'False
  98.             Height          =   345
  99.             Left            =   60
  100.             TabIndex        =   31
  101.             Top             =   60
  102.             Width           =   735
  103.          End
  104.       End
  105.       Begin SSPanel Panel3D14 
  106.          BackColor       =   &H00C0C0C0&
  107.          BevelOuter      =   1  'Inset
  108.          Caption         =   "Source Group"
  109.          Font3D          =   0  'None
  110.          ForeColor       =   &H00000000&
  111.          Height          =   435
  112.          Left            =   150
  113.          Outline         =   -1  'True
  114.          TabIndex        =   29
  115.          Top             =   390
  116.          Width           =   975
  117.       End
  118.       Begin SSPanel Panel3D15 
  119.          Alignment       =   6  'Center - TOP
  120.          BackColor       =   &H00C0C0C0&
  121.          BevelOuter      =   1  'Inset
  122.          Font3D          =   1  'Raised w/light shading
  123.          ForeColor       =   &H00000000&
  124.          Height          =   435
  125.          Left            =   1110
  126.          Outline         =   -1  'True
  127.          TabIndex        =   27
  128.          Top             =   390
  129.          Width           =   5925
  130.          Begin ComboBox source_groups 
  131.             Height          =   300
  132.             Left            =   60
  133.             TabIndex        =   28
  134.             Text            =   "source_groups"
  135.             Top             =   60
  136.             Width           =   5775
  137.          End
  138.       End
  139.       Begin SSPanel Panel3D3 
  140.          BackColor       =   &H00C0C0C0&
  141.          BevelOuter      =   1  'Inset
  142.          Caption         =   "Source Name"
  143.          Font3D          =   0  'None
  144.          ForeColor       =   &H00000000&
  145.          Height          =   465
  146.          Left            =   150
  147.          Outline         =   -1  'True
  148.          TabIndex        =   23
  149.          Top             =   810
  150.          Width           =   975
  151.       End
  152.       Begin SSPanel Panel3D4 
  153.          BackColor       =   &H00C0C0C0&
  154.          BevelOuter      =   1  'Inset
  155.          Caption         =   "Port"
  156.          Font3D          =   0  'None
  157.          ForeColor       =   &H00000000&
  158.          Height          =   465
  159.          Left            =   150
  160.          Outline         =   -1  'True
  161.          TabIndex        =   22
  162.          Top             =   1260
  163.          Width           =   975
  164.       End
  165.       Begin SSPanel Panel3D5 
  166.          BackColor       =   &H00C0C0C0&
  167.          BevelOuter      =   1  'Inset
  168.          Caption         =   "Server"
  169.          Font3D          =   0  'None
  170.          ForeColor       =   &H00000000&
  171.          Height          =   465
  172.          Left            =   150
  173.          Outline         =   -1  'True
  174.          TabIndex        =   20
  175.          Top             =   1710
  176.          Width           =   975
  177.          Begin SSPanel Panel3D9 
  178.             BackColor       =   &H00C0C0C0&
  179.             BevelOuter      =   1  'Inset
  180.             Caption         =   "Panel3D9"
  181.             Font3D          =   1  'Raised w/light shading
  182.             ForeColor       =   &H00000000&
  183.             Height          =   195
  184.             Left            =   1020
  185.             Outline         =   -1  'True
  186.             TabIndex        =   21
  187.             Top             =   60
  188.             Width           =   5955
  189.          End
  190.       End
  191.       Begin SSPanel Panel3D6 
  192.          BackColor       =   &H00C0C0C0&
  193.          BevelOuter      =   1  'Inset
  194.          Caption         =   "Database Name"
  195.          Font3D          =   0  'None
  196.          ForeColor       =   &H00000000&
  197.          Height          =   465
  198.          Left            =   150
  199.          Outline         =   -1  'True
  200.          TabIndex        =   19
  201.          Top             =   2160
  202.          Width           =   975
  203.       End
  204.       Begin SSPanel Panel3D7 
  205.          Alignment       =   6  'Center - TOP
  206.          BackColor       =   &H00C0C0C0&
  207.          BevelOuter      =   1  'Inset
  208.          Font3D          =   1  'Raised w/light shading
  209.          ForeColor       =   &H00000000&
  210.          Height          =   495
  211.          Left            =   1950
  212.          Outline         =   -1  'True
  213.          TabIndex        =   17
  214.          Top             =   780
  215.          Width           =   5085
  216.          Begin TextBox s_add_title 
  217.             BackColor       =   &H00FFFFFF&
  218.             FontBold        =   0   'False
  219.             FontItalic      =   0   'False
  220.             FontName        =   "Terminal"
  221.             FontSize        =   9
  222.             FontStrikethru  =   0   'False
  223.             FontUnderline   =   0   'False
  224.             Height          =   345
  225.             Left            =   30
  226.             TabIndex        =   18
  227.             Top             =   90
  228.             Width           =   4995
  229.          End
  230.       End
  231.       Begin SSPanel Panel3D8 
  232.          Alignment       =   6  'Center - TOP
  233.          BackColor       =   &H00C0C0C0&
  234.          BevelOuter      =   1  'Inset
  235.          Font3D          =   1  'Raised w/light shading
  236.          ForeColor       =   &H00000000&
  237.          Height          =   465
  238.          Left            =   1110
  239.          Outline         =   -1  'True
  240.          TabIndex        =   15
  241.          Top             =   1260
  242.          Width           =   855
  243.          Begin TextBox s_add_port 
  244.             BackColor       =   &H00FFFFFF&
  245.             FontBold        =   0   'False
  246.             FontItalic      =   0   'False
  247.             FontName        =   "Terminal"
  248.             FontSize        =   9
  249.             FontStrikethru  =   0   'False
  250.             FontUnderline   =   0   'False
  251.             Height          =   375
  252.             Left            =   60
  253.             TabIndex        =   16
  254.             Top             =   30
  255.             Width           =   735
  256.          End
  257.       End
  258.       Begin SSPanel Panel3D10 
  259.          BackColor       =   &H00C0C0C0&
  260.          BevelOuter      =   1  'Inset
  261.          Caption         =   "Panel3D10"
  262.          Font3D          =   1  'Raised w/light shading
  263.          ForeColor       =   &H00000000&
  264.          Height          =   465
  265.          Left            =   1110
  266.          Outline         =   -1  'True
  267.          TabIndex        =   13
  268.          Top             =   1710
  269.          Width           =   5925
  270.          Begin TextBox s_add_server 
  271.             BackColor       =   &H00FFFFFF&
  272.             FontBold        =   0   'False
  273.             FontItalic      =   0   'False
  274.             FontName        =   "Terminal"
  275.             FontSize        =   9
  276.             FontStrikethru  =   0   'False
  277.             FontUnderline   =   0   'False
  278.             Height          =   345
  279.             Left            =   60
  280.             TabIndex        =   14
  281.             Top             =   60
  282.             Width           =   5805
  283.          End
  284.       End
  285.       Begin SSPanel Panel3D11 
  286.          BackColor       =   &H00C0C0C0&
  287.          BevelOuter      =   1  'Inset
  288.          Caption         =   "Panel3D11"
  289.          Font3D          =   1  'Raised w/light shading
  290.          ForeColor       =   &H00000000&
  291.          Height          =   465
  292.          Left            =   1110
  293.          Outline         =   -1  'True
  294.          TabIndex        =   11
  295.          Top             =   2160
  296.          Width           =   5925
  297.          Begin TextBox s_add_database 
  298.             BackColor       =   &H00FFFFFF&
  299.             FontBold        =   0   'False
  300.             FontItalic      =   0   'False
  301.             FontName        =   "Terminal"
  302.             FontSize        =   9
  303.             FontStrikethru  =   0   'False
  304.             FontUnderline   =   0   'False
  305.             Height          =   345
  306.             Left            =   60
  307.             TabIndex        =   12
  308.             Top             =   30
  309.             Width           =   5805
  310.          End
  311.       End
  312.    End
  313.    Begin SSPanel button_frame 
  314.       Align           =   1  'Align Top
  315.       BackColor       =   &H00808080&
  316.       Font3D          =   1  'Raised w/light shading
  317.       ForeColor       =   &H00000000&
  318.       Height          =   555
  319.       Left            =   0
  320.       Outline         =   -1  'True
  321.       TabIndex        =   0
  322.       Top             =   0
  323.       Width           =   9525
  324.       Begin SSCommand add_section_bbox 
  325.          AutoSize        =   1  'Adjust Picture Size To Button
  326.          BevelWidth      =   1
  327.          Font3D          =   0  'None
  328.          Height          =   420
  329.          Left            =   4110
  330.          Picture         =   WSRC.FRX:0000
  331.          TabIndex        =   9
  332.          Top             =   90
  333.          Width           =   450
  334.       End
  335.       Begin SSCommand copy_bbox 
  336.          AutoSize        =   1  'Adjust Picture Size To Button
  337.          BevelWidth      =   1
  338.          Font3D          =   0  'None
  339.          Height          =   390
  340.          Left            =   3570
  341.          Picture         =   WSRC.FRX:0182
  342.          TabIndex        =   8
  343.          Top             =   90
  344.          Width           =   420
  345.       End
  346.       Begin SSCommand prev_in_order_bbox 
  347.          AutoSize        =   1  'Adjust Picture Size To Button
  348.          BevelWidth      =   1
  349.          Font3D          =   0  'None
  350.          Height          =   390
  351.          Left            =   3030
  352.          Picture         =   WSRC.FRX:0304
  353.          TabIndex        =   7
  354.          Top             =   90
  355.          Width           =   420
  356.       End
  357.       Begin SSCommand prev_listed_bbox 
  358.          AutoSize        =   1  'Adjust Picture Size To Button
  359.          BevelWidth      =   1
  360.          Font3D          =   0  'None
  361.          Height          =   390
  362.          Left            =   2610
  363.          Picture         =   WSRC.FRX:0486
  364.          TabIndex        =   6
  365.          Top             =   90
  366.          Width           =   420
  367.       End
  368.       Begin SSCommand next_in_order_bbox 
  369.          AutoSize        =   1  'Adjust Picture Size To Button
  370.          BevelWidth      =   1
  371.          Font3D          =   0  'None
  372.          Height          =   390
  373.          Left            =   2130
  374.          Picture         =   WSRC.FRX:0608
  375.          TabIndex        =   5
  376.          Top             =   90
  377.          Width           =   420
  378.       End
  379.       Begin SSCommand next_listed_bbox 
  380.          AutoSize        =   1  'Adjust Picture Size To Button
  381.          BevelWidth      =   1
  382.          Font3D          =   0  'None
  383.          Height          =   390
  384.          Left            =   1710
  385.          Picture         =   WSRC.FRX:078A
  386.          TabIndex        =   4
  387.          Top             =   90
  388.          Width           =   420
  389.       End
  390.       Begin SSCommand find_bbox 
  391.          AutoSize        =   1  'Adjust Picture Size To Button
  392.          BevelWidth      =   1
  393.          Font3D          =   0  'None
  394.          Height          =   390
  395.          Left            =   1140
  396.          Picture         =   WSRC.FRX:090C
  397.          TabIndex        =   3
  398.          Top             =   90
  399.          Width           =   420
  400.       End
  401.       Begin SSCommand print_bbox 
  402.          AutoSize        =   1  'Adjust Picture Size To Button
  403.          BevelWidth      =   1
  404.          Font3D          =   0  'None
  405.          Height          =   390
  406.          Left            =   570
  407.          Picture         =   WSRC.FRX:0A8E
  408.          TabIndex        =   2
  409.          Top             =   90
  410.          Width           =   420
  411.       End
  412.       Begin SSCommand save_bbox 
  413.          AutoSize        =   1  'Adjust Picture Size To Button
  414.          BevelWidth      =   1
  415.          Font3D          =   0  'None
  416.          Height          =   390
  417.          Left            =   120
  418.          Picture         =   WSRC.FRX:0C10
  419.          TabIndex        =   1
  420.          Top             =   90
  421.          Width           =   420
  422.       End
  423.    End
  424.    Begin Menu file_menu 
  425.       Caption         =   "&File"
  426.       Begin Menu menu_save 
  427.          Caption         =   "&Save as..."
  428.       End
  429.       Begin Menu menu_print 
  430.          Caption         =   "&Print"
  431.       End
  432.       Begin Menu s1 
  433.          Caption         =   "-"
  434.       End
  435.       Begin Menu menu_done 
  436.          Caption         =   "&Done"
  437.          Shortcut        =   {F3}
  438.       End
  439.    End
  440.    Begin Menu menu_edit 
  441.       Caption         =   "&Edit"
  442.       Begin Menu menu_find_key 
  443.          Caption         =   "&Find key"
  444.          Shortcut        =   {F5}
  445.       End
  446.       Begin Menu s2 
  447.          Caption         =   "-"
  448.       End
  449.       Begin Menu menu_next 
  450.          Caption         =   "View &next document"
  451.          Begin Menu menu_next_in_order 
  452.             Caption         =   "&In order"
  453.             Shortcut        =   {F8}
  454.          End
  455.          Begin Menu menu_next_listed 
  456.             Caption         =   "&Listed in questions"
  457.             Shortcut        =   +{F8}
  458.          End
  459.       End
  460.       Begin Menu menu_prev 
  461.          Caption         =   "View &prev document"
  462.          Begin Menu menu_prev_in_order 
  463.             Caption         =   "&In order"
  464.             Shortcut        =   {F7}
  465.          End
  466.          Begin Menu menu_prev_listed 
  467.             Caption         =   "&Listed in questions"
  468.             Shortcut        =   +{F7}
  469.          End
  470.       End
  471.       Begin Menu s3 
  472.          Caption         =   "-"
  473.       End
  474.       Begin Menu menu_copy 
  475.          Caption         =   "&Copy"
  476.          Shortcut        =   +{F6}
  477.       End
  478.       Begin Menu s4 
  479.          Caption         =   "-"
  480.       End
  481.       Begin Menu menu_add_section 
  482.          Caption         =   "&Add section"
  483.          Shortcut        =   {F6}
  484.       End
  485.    End
  486. Const FORM_OFFSET = 3 ' offset from top of form for button bar
  487. Dim rec As String * MAX_TEXT_LENGTH
  488. Dim tmp_handle As Integer
  489. Dim recno As Integer
  490. Dim doc_lines As Integer
  491. Dim lines_per_page As Integer
  492. Dim line_size As Single
  493. Dim wdno As Integer
  494. Dim box_top As Single
  495. Dim box_bottom As Single
  496. Dim box_drawn As Integer
  497. Dim button_down As Integer
  498. Dim form_cancelled As Integer
  499. Sub add_section_bbox_Click ()
  500.     menu_add_section_click
  501. End Sub
  502. Sub add_source_Click ()
  503.     Dim pfx As String * 4
  504.     If Trim$(source_groups.Text) = "" Or Trim$(s_add_port) = "" Or Trim$(s_add_server) = "" Or Trim$(s_add_database) = "" Then
  505.       MsgBox ("A source field entry is missing, please enter it")
  506.       Exit Sub
  507.     End If
  508.     If source_groups.Text <> current_group Then
  509.       save_source_group
  510.       current_group = UCase$(Trim$(source_groups.Text))
  511.       sources_are_loaded = False
  512.       load_source_group
  513.     End If
  514.     src = sources_form.s_source_list.ListCount
  515.     s_port(src) = Val(s_add_port.Text)
  516.     s_service(src) = Trim$(s_add_server.Text)
  517.     s_database(src) = Trim$(s_add_database.Text)
  518.     pfx = s_add_prefix.Text
  519.     s_add_prefix.Text = pfx
  520.     sources_form.s_source_list.AddItem pfx + " " + s_add_title.Text
  521.     sources_have_changed = True
  522.     s_add_prefix.Enabled = False
  523.     s_add_title.Enabled = False
  524.     s_add_port.Enabled = False
  525.     s_add_server.Enabled = False
  526.     s_add_database.Enabled = False
  527.     add_source.Enabled = False
  528.     source_groups.Enabled = False
  529. End Sub
  530. Sub copy_bbox_Click ()
  531.     menu_copy_click
  532. End Sub
  533. Sub find_bbox_Click ()
  534.     menu_find_key_click
  535. End Sub
  536. Sub Form_Load ()
  537.     tmp_handle = FreeFile
  538.     Open temp_path + "\WAIS.$$$" For Random As tmp_handle Len = MAX_TEXT_LENGTH
  539.     form_cancelled = False
  540.     If question_form.max_displays.Checked Then
  541.       wsrc_form.WindowState = MAXIMIZED
  542.     End If
  543.     caption = viewed_headline
  544.     load_group_list wsrc_form, READWRITE
  545.     init_find = False
  546.     doc_selected = NONE
  547.     If viewed_docno <> CURRDOC Then
  548.       If viewed_docno = 0 Then
  549.         menu_prev_listed.Enabled = False
  550.         prev_listed_bbox.Enabled = False
  551.       End If
  552.       If viewed_docno > question_form.title.ListCount - 2 Then
  553.         menu_next_listed.Enabled = False
  554.         next_listed_bbox.Enabled = False
  555.       End If
  556.     End If
  557.     line_size = TextHeight("A")
  558.     lines_per_page = wsrc_form.ScaleHeight / line_size - 22
  559.     wsrc_scroll.LargeChange = lines_per_page
  560.     wsrc_scroll.Min = 1
  561.     box_top = -1
  562.     box_drawn = False
  563.     button_down = False
  564.     s_add_prefix.Text = ""
  565.     s_add_title.Text = ""
  566.     s_add_port.Text = ""
  567.     s_add_server.Text = ""
  568.     s_add_database.Text = ""
  569.     doc_lines = LOF(tmp_handle) / MAX_TEXT_LENGTH
  570.     If doc_lines <= lines_per_page Then
  571.         wsrc_scroll.Max = 1
  572.     Else
  573.         wsrc_scroll.Max = doc_lines - lines_per_page
  574.     End If
  575.       
  576.     wsrc_scroll.Min = 1
  577.     For x = 1 To doc_lines
  578.                 
  579.       Get #tmp_handle, x, rec
  580.         
  581.       If InStr(LCase$(rec), ":ip-name") And ip_number_found = False Then
  582.         c1 = InStr(rec, Chr$(34))
  583.         c2 = InStr(c1 + 1, rec, Chr$(34))
  584.         If c2 = 0 Then
  585.           c2 = Len(RTrim$(rec))
  586.         End If
  587.         s_add_server.Text = LTrim$(Mid$(rec, c1 + 1, c2 - c1 - 1))
  588.         'wsrc_scroll.Min = x
  589.       End If
  590.       If InStr(LCase$(rec), ":ip-address") Then
  591.         c1 = InStr(rec, Chr$(34))
  592.         c2 = InStr(c1 + 1, rec, Chr$(34))
  593.         If c2 = 0 Then
  594.           c2 = Len(RTrim$(rec))
  595.         End If
  596.         s_add_server.Text = LTrim$(Mid$(rec, c1 + 1, c2 - c1 - 1))
  597.         ip_number_found = True
  598.         'wsrc_scroll.Min = x
  599.       End If
  600.       If InStr(LCase$(rec), ":tcp-port") > 1 Then
  601.         i = InStr(LCase$(rec), ":tcp-port") + 9
  602.         port$ = Str$(Val(Mid$(rec, i, 70)))
  603.         s_add_port.Text = Right$(port$, Len(port$) - 1)
  604.         'wsrc_scroll.Min = x
  605.       End If
  606.           
  607.       If InStr(LCase$(rec), ":database-name") Then
  608.         c1 = InStr(rec, Chr$(34))
  609.         c2 = InStr(c1 + 1, rec, Chr$(34))
  610.         If c2 = 0 Then
  611.           c2 = Len(RTrim$(rec))
  612.         End If
  613.         s_add_database.Text = LTrim$(Mid$(rec, c1 + 1, c2 - c1 - 1))
  614.         'wsrc_scroll.Min = x
  615.       End If
  616.       
  617.       'If InStr(LCase$(rec), ":description") Then
  618.       '  wsrc_scroll.Min = x
  619.       'End If
  620.         
  621.     Next x
  622.         
  623.     s_add_prefix.Text = Mid$(question_form.title.Text, 18, 4)
  624.     s_add_title.Text = Right$(question_form.title.Text, Len(question_form.title.Text) - 17)
  625.     recno = wsrc_scroll.Min
  626.     z = show_page()
  627. End Sub
  628. Sub Form_MouseDown (Button As Integer, Shift As Integer, x As Single, Y As Single)
  629.     If Y < line_size * (FORM_OFFSET + 1) Then
  630.       Exit Sub
  631.     End If
  632.     button_down = True
  633.     If box_drawn Then
  634.         wsrc_form.Line (0, box_top)-(wsrc_form.ScaleWidth, box_bottom), , BF
  635.         box_drawn = False
  636.     End If
  637.     box_top = Int(Y / line_size) * line_size
  638. End Sub
  639. Sub Form_MouseMove (Button As Integer, Shift As Integer, x As Single, Y As Single)
  640.     If button_down Then
  641.         If box_drawn Then
  642.             wsrc_form.Line (0, box_top)-(wsrc_form.ScaleWidth, box_bottom), , BF
  643.         End If
  644.         box_bottom = Int(Y / line_size) * line_size + line_size
  645.         wsrc_form.Line (0, box_top)-(wsrc_form.ScaleWidth, box_bottom), , BF
  646.         box_drawn = True
  647.     End If
  648. End Sub
  649. Sub form_MouseUp (Button As Integer, Shift As Integer, x As Single, Y As Single)
  650.     button_down = False
  651. End Sub
  652. Sub form_resize ()
  653.     If Not form_cancelled Then
  654.       wsrc_scroll.Height = wsrc_form.Height - button_frame.Height - wsrc_frame.Height - 675
  655.       wsrc_scroll.Left = wsrc_form.Width - 400
  656.       wsrc_scroll.Refresh
  657.       lines_per_page = wsrc_form.ScaleHeight / line_size - 22
  658.       
  659.       wsrc_scroll.LargeChange = lines_per_page
  660.       If doc_lines <= lines_per_page Then
  661.         wsrc_scroll.Max = 1
  662.       Else
  663.         wsrc_scroll.Max = doc_lines - lines_per_page
  664.       End If
  665.       z = show_page()
  666.     End If
  667. End Sub
  668. Sub Form_Unload (Cancel As Integer)
  669.     form_cancelled = True
  670.     If doc_selected = NORMAL Then
  671.       doc_selected = NONE
  672.     End If
  673.     Close (tmp_handle)
  674. End Sub
  675. Sub menu_add_section_click ()
  676. Dim DocID As REF
  677.     If box_top < 0 Then
  678.       MsgBox "You haven't selected a section to add", MB_INFO
  679.       Exit Sub
  680.     End If
  681.     z = get_docid(viewed_docno, DocID)
  682.     refno = question_form.reference.ListCount
  683.     ref_doc_size(refno) = DocID.doc_size
  684.     ref_doc_bytes(refno) = Left$(DocID.doc_bytes, DocID.doc_size)
  685.     ref_type(refno) = DocID.type
  686.     ref_start(refno) = Int(box_top / line_size) + recno - FORM_OFFSET - 1
  687.     ref_end(refno) = Int(box_bottom / line_size) + recno - (FORM_OFFSET + 2)
  688.     ref_line$ = "[" + LTrim$(Str$(ref_start(refno))) + "," + LTrim$(Str$(ref_end(refno))) + "]" + viewed_headline
  689.     question_form.reference.AddItem ref_line$
  690.     wsrc_form.DrawMode = 7
  691.     wsrc_form.Line (0, box_top)-(wsrc_form.ScaleWidth, box_bottom), &HFFFF&, BF
  692.     wsrc_form.DrawMode = 6
  693.     box_drawn = False
  694.     box_top = -1
  695.     box_bottom = 0
  696. End Sub
  697. Sub menu_copy_click ()
  698.     If box_top < 0 Then
  699.         MsgBox "You haven't selected a section to copy to the clipboard", MB_INFO
  700.         Exit Sub
  701.     End If
  702.     REF = question_form.reference.ListCount
  703.     title = question_form.title.ListIndex
  704.     first_line = Int(box_top / line_size) + recno
  705.     last_line = Int(box_bottom / line_size) + recno
  706.     wsrc_form.DrawMode = 6
  707.     wsrc_form.Line (0, box_top)-(wsrc_form.ScaleWidth, box_bottom), &HFFFF&, BF
  708.     wsrc_form.DrawMode = 6
  709.     box_drawn = False
  710.     box_top = -1
  711.     box_bottom = 0
  712.     For x = first_line To last_line
  713.         Get #1, x, rec
  714.         cliptext$ = cliptext$ + RTrim$(rec) + Chr$(10) + Chr$(13)
  715.     Next x
  716.     clipboard.SetText cliptext$, 1
  717. End Sub
  718. Sub menu_done_Click ()
  719.     doc_selected = NONE
  720.     wsrc_form.Hide
  721. End Sub
  722. Sub menu_find_key_click ()
  723.     If word(0) = "" Then
  724.         MsgBox "No key words were used for this search", MB_INFO
  725.     End If
  726.     If doc_lines <= lines_per_page Then
  727.         Exit Sub
  728.     End If
  729.     If wsrc_scroll.Value >= doc_lines - lines_per_page Then
  730.         Exit Sub
  731.     End If
  732.     recno = recno + lines_per_page
  733.     While Not show_page()
  734.         recno = recno + lines_per_page
  735.     Wend
  736.     If doc_lines - lines_per_page > recno Then
  737.         wsrc_scroll.Value = recno
  738.     Else
  739.         wsrc_scroll.Value = doc_lines - lines_per_page
  740.     End If
  741.     wsrc_scroll.Refresh
  742. End Sub
  743. Sub menu_next_in_order_click ()
  744.     doc_selected = DOC_NEXT_INORDER
  745.     wsrc_form.Hide
  746. End Sub
  747. Sub menu_next_listed_click ()
  748.     doc_selected = DOC_NEXT_LISTED
  749.     wsrc_form.Hide
  750. End Sub
  751. Sub menu_prev_in_order_click ()
  752.     doc_selected = DOC_PREV_INORDER
  753.     wsrc_form.Hide
  754. End Sub
  755. Sub menu_prev_listed_click ()
  756.     doc_selected = DOC_PREV_LISTED
  757.     wsrc_form.Hide
  758. End Sub
  759. Sub menu_print_click ()
  760. Dim rec As String * MAX_TEXT_LENGTH
  761.     question_form.file_dialog.CancelError = True
  762.     question_form.file_dialog.FilterIndex = 1
  763.     question_form.file_dialog.Flags = PD_HIDEPRINTTOFILE Or PD_NOPAGENUMS
  764.     On Error Resume Next
  765.     question_form.file_dialog.Action = 5
  766.     Select Case Err
  767.       Case 0
  768.         mousepointer = HOURGLASS
  769.         linecnt = 99
  770.         pagecnt = 0
  771.         For x = 1 To doc_lines
  772.             If linecnt > 55 Then
  773.                 GoSub header
  774.             End If
  775.             Get #1, x, rec
  776.             printer.Print RTrim$(rec)
  777.         Next x
  778.         printer.EndDoc
  779.         Close (2)
  780.         mousepointer = DEFAULT
  781.       Case 32755
  782.         z = show_page()
  783.         Exit Sub
  784.       Case Else
  785.         msg$ = "Print failed with code" + Str$(Err) + ", print cancelled."
  786.         MsgBox msg$, MB_WARN
  787.     End Select
  788.     z = show_page()
  789. Exit Sub
  790. header:
  791.     printer.NewPage
  792.     heading$ = Right$(question_form.title.List(view_docno), Len(question_form.title.List(docno)) - 17)
  793.     If Len(heading$) > xx Then
  794.         heading$ = Left$(heading$, xx)
  795.     End If
  796.     pagecnt = pagecnt + 1
  797.     linecnt = 0
  798.     printer.Print heading$; Format$(Now, "ddddd tttt"); "Page"; Str$(pagecnt)
  799.     printer.Print
  800. Return
  801. End Sub
  802. Sub menu_save_click ()
  803. Dim rec As String * MAX_TEXT_LENGTH
  804.     ip_number_found = False
  805.     If InStr(title_type(docno), "WSRC") Then
  806.     Else
  807.       
  808.       cur_dir$ = CurDir$
  809.       
  810.       On Error Resume Next
  811.       question_form.file_dialog.Action = 2
  812.       Select Case Err
  813.         Case 0
  814.           mousepointer = HOURGLASS
  815.           save_handle = FreeFile
  816.           Open question_form.file_dialog.Filename For Output As save_handle
  817.           For x = 1 To doc_lines
  818.             
  819.             Get #tmp_handle, x, rec
  820.             Print #save_handle, RTrim$(rec)
  821.           Next x
  822.           Close (save_handle)
  823.           mousepointer = DEFAULT
  824.         Case 32755
  825.           z = show_page()
  826.           Exit Sub
  827.         Case Else
  828.           msg$ = "Save failed with code" + Str$(Err) + ", save cancelled."
  829.           MsgBox msg$, MB_WARN
  830.       End Select
  831.       ChDir cur_dir$
  832.       z = show_page()
  833.     End If
  834. End Sub
  835. Sub next_in_order_bbox_Click ()
  836.     menu_next_in_order_click
  837. End Sub
  838. Sub next_listed_bbox_Click ()
  839.     menu_next_listed_click
  840. End Sub
  841. Sub prev_in_order_bbox_Click ()
  842.     menu_prev_in_order_click
  843. End Sub
  844. Sub prev_listed_bbox_Click ()
  845.     menu_prev_listed_click
  846. End Sub
  847. Sub print_bbox_Click ()
  848.     menu_print_click
  849. End Sub
  850. Sub save_bbox_Click ()
  851.     menu_save_click
  852. End Sub
  853. Function show_page () As Integer
  854. Static pos As Integer
  855.     show_page = False
  856.     If Not init_find Then
  857.         GoSub first_find
  858.     End If
  859.     wsrc_form.Cls
  860.     For x = 0 To FORM_OFFSET
  861.       wsrc_form.Print
  862.     Next x
  863.     ln = x - 1
  864.     For x = recno To recno + lines_per_page
  865.         
  866.       If x <= doc_lines Then
  867.            
  868.         Get #tmp_handle, x, rec
  869.         currentx = 0
  870.         wsrc_form.Print " "; rec
  871.         ln = ln + 1
  872.             
  873.         If question_form.keywords.Text <> "" Then
  874.           rec = LCase$(rec)
  875.                 
  876.           For Y = 0 To wdno
  877.             pos = 1
  878.             While pos > 0
  879.               pos = InStr(pos, rec, word(Y))
  880.               If pos > 0 Then
  881.                 If test_for_word(word(Y), pos) Then
  882.                   show_page = True
  883.                   wsrc_form.DrawMode = 9
  884.                   wd_left = pos * wsrc_form.TextWidth("A")
  885.                   wd_right = (pos + Len(word(Y))) * wsrc_form.TextWidth("A")
  886.                   wd_top = ln * wsrc_form.TextHeight("A")
  887.                   wd_bottom = wd_top + wsrc_form.TextHeight("A")
  888.                   wsrc_form.Line (wd_left, wd_top)-(wd_right, wd_bottom), &HFF00&, BF
  889.                   wsrc_form.DrawMode = 6
  890.                 End If
  891.                 pos = pos + Len(word(Y))
  892.               End If
  893.             Wend
  894.           Next Y
  895.         End If
  896.       Else
  897.         show_page = True
  898.       End If
  899.     Next x
  900. Exit Function
  901. first_find:
  902.     For c1 = 0 To 19
  903.       word(c1) = ""
  904.     Next c1
  905.     words$ = LCase$(question_form.keywords.Text)
  906.     For c1 = 1 To Len(words$)
  907.       letter$ = Mid$(words$, c1, 1)
  908.       If letter$ < "0" Or (letter$ > "9" And letter$ < "a") Or (letter$ > "z") Then
  909.         Mid$(words$, c1, 1) = " "
  910.       End If
  911.     Next c1
  912.     c1 = 1
  913.     For wdno = 0 To 19
  914.         c2 = InStr(c1, words$, " ")
  915.         If c2 = 0 Then
  916.             word(wdno) = Trim$(Mid$(words$, c1, Len(words$) - c1 + 1))
  917.             Exit For
  918.         End If
  919.         word(wdno) = Trim$(Mid$(words$, c1, c2 - c1))
  920.         c1 = c2 + 1
  921.         If word(wdno) = "and" Or word(wdno) = "" Or word(wdno) = Space$(Len(word(wdno))) Then
  922.             wdno = wdno - 1
  923.         End If
  924.     Next wdno
  925.     If word(wdno) = "" Then
  926.       wdno = wdno - 1
  927.     End If
  928.     init_find = True
  929. Return
  930. End Function
  931. Sub source_groups_Click ()
  932.     switch_source_group
  933. End Sub
  934. Sub source_groups_KeyPress (keyascii As Integer)
  935.   If keyascii = 13 Then
  936.     switch_source_group
  937.     keyascii = 0
  938.   End If
  939. End Sub
  940. Sub source_groups_LostFocus ()
  941.     switch_source_group
  942. End Sub
  943. Sub switch_source_group ()
  944.     If source_groups.Text = "" Then
  945.       MsgBox ("Please enter a NEW or EXISTING source group name")
  946.       Exit Sub
  947.     End If
  948.     If source_groups.Text <> current_group Then
  949.       save_source_group
  950.       sources_are_loaded = False
  951.       current_group = UCase$(source_groups.Text)
  952.       load_source_group
  953.     End If
  954. End Sub
  955. Function test_for_word (word As String, pos As Integer) As Integer
  956.     If pos > 1 Then
  957.       Select Case Mid$(rec, pos - 1, 1)
  958.         Case "1" To "9"
  959.           test_for_word = False
  960.           Exit Function
  961.         Case "a" To "z"
  962.           test_for_word = False
  963.           Exit Function
  964.       End Select
  965.     End If
  966.     wdend = pos + Len(word)
  967.     If wdend < 81 Then
  968.       Select Case Mid$(rec, wdend, 1)
  969.         Case "1" To "9"
  970.           test_for_word = False
  971.           Exit Function
  972.         Case "a" To "z"
  973.           test_for_word = False
  974.           Exit Function
  975.       End Select
  976.     End If
  977.     test_for_word = True
  978. End Function
  979. Sub wsrc_scroll_Change ()
  980.     If recno <> wsrc_scroll.Value Then
  981.         recno = wsrc_scroll.Value
  982.         z = show_page()
  983.     End If
  984.     box_drawn = False
  985.     box_top = -1
  986.     box_bottom = 0
  987. End Sub
  988.