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

  1. VERSION 2.00
  2. Begin Form view_form 
  3.    AutoRedraw      =   -1  'True
  4.    BackColor       =   &H00FFFFFF&
  5.    Caption         =   "View"
  6.    ClientHeight    =   3990
  7.    ClientLeft      =   30
  8.    ClientTop       =   945
  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          =   4680
  18.    Left            =   -30
  19.    LinkMode        =   1  'Source
  20.    LinkTopic       =   "Form1"
  21.    MinButton       =   0   'False
  22.    ScaleHeight     =   3990
  23.    ScaleWidth      =   9525
  24.    Top             =   315
  25.    Width           =   9645
  26.    Begin PictureBox corner_fill 
  27.       BackColor       =   &H00808080&
  28.       FillColor       =   &H00808080&
  29.       FillStyle       =   0  'Solid
  30.       Height          =   255
  31.       Left            =   9270
  32.       ScaleHeight     =   225
  33.       ScaleWidth      =   225
  34.       TabIndex        =   14
  35.       Top             =   3720
  36.       Width           =   255
  37.    End
  38.    Begin HScrollBar horiz_scroll 
  39.       Height          =   270
  40.       Left            =   -30
  41.       TabIndex        =   13
  42.       Top             =   3720
  43.       Width           =   9315
  44.    End
  45.    Begin SSPanel button_frame 
  46.       Align           =   1  'Align Top
  47.       BackColor       =   &H00808080&
  48.       Font3D          =   1  'Raised w/light shading
  49.       ForeColor       =   &H00000000&
  50.       Height          =   555
  51.       Left            =   0
  52.       Outline         =   -1  'True
  53.       TabIndex        =   1
  54.       Top             =   0
  55.       Width           =   9525
  56.       Begin SSCommand map_bbox 
  57.          AutoSize        =   1  'Adjust Picture Size To Button
  58.          BevelWidth      =   1
  59.          Font3D          =   0  'None
  60.          Height          =   405
  61.          Left            =   5160
  62.          Picture         =   VIEW.FRX:0000
  63.          TabIndex        =   12
  64.          Top             =   90
  65.          Width           =   420
  66.       End
  67.       Begin SSCommand telnet_bbox 
  68.          AutoSize        =   1  'Adjust Picture Size To Button
  69.          BevelWidth      =   1
  70.          Font3D          =   0  'None
  71.          Height          =   420
  72.          Left            =   4680
  73.          Picture         =   VIEW.FRX:0182
  74.          TabIndex        =   11
  75.          Top             =   90
  76.          Width           =   450
  77.       End
  78.       Begin SSCommand add_section_bbox 
  79.          AutoSize        =   1  'Adjust Picture Size To Button
  80.          BevelWidth      =   1
  81.          Font3D          =   0  'None
  82.          Height          =   420
  83.          Left            =   4110
  84.          Picture         =   VIEW.FRX:0304
  85.          TabIndex        =   10
  86.          Top             =   90
  87.          Width           =   450
  88.       End
  89.       Begin SSCommand copy_bbox 
  90.          AutoSize        =   1  'Adjust Picture Size To Button
  91.          BevelWidth      =   1
  92.          Font3D          =   0  'None
  93.          Height          =   390
  94.          Left            =   3570
  95.          Picture         =   VIEW.FRX:0486
  96.          TabIndex        =   9
  97.          Top             =   90
  98.          Width           =   420
  99.       End
  100.       Begin SSCommand prev_in_order_bbox 
  101.          AutoSize        =   1  'Adjust Picture Size To Button
  102.          BevelWidth      =   1
  103.          Font3D          =   0  'None
  104.          Height          =   390
  105.          Left            =   3030
  106.          Picture         =   VIEW.FRX:0608
  107.          TabIndex        =   8
  108.          Top             =   90
  109.          Width           =   420
  110.       End
  111.       Begin SSCommand prev_listed_bbox 
  112.          AutoSize        =   1  'Adjust Picture Size To Button
  113.          BevelWidth      =   1
  114.          Font3D          =   0  'None
  115.          Height          =   390
  116.          Left            =   2610
  117.          Picture         =   VIEW.FRX:078A
  118.          TabIndex        =   7
  119.          Top             =   90
  120.          Width           =   420
  121.       End
  122.       Begin SSCommand next_in_order_bbox 
  123.          AutoSize        =   1  'Adjust Picture Size To Button
  124.          BevelWidth      =   1
  125.          Font3D          =   0  'None
  126.          Height          =   390
  127.          Left            =   2130
  128.          Picture         =   VIEW.FRX:090C
  129.          TabIndex        =   6
  130.          Top             =   90
  131.          Width           =   420
  132.       End
  133.       Begin SSCommand next_listed_bbox 
  134.          AutoSize        =   1  'Adjust Picture Size To Button
  135.          BevelWidth      =   1
  136.          Font3D          =   0  'None
  137.          Height          =   390
  138.          Left            =   1710
  139.          Picture         =   VIEW.FRX:0A8E
  140.          TabIndex        =   5
  141.          Top             =   90
  142.          Width           =   420
  143.       End
  144.       Begin SSCommand find_bbox 
  145.          AutoSize        =   1  'Adjust Picture Size To Button
  146.          BevelWidth      =   1
  147.          Font3D          =   0  'None
  148.          Height          =   390
  149.          Left            =   1140
  150.          Picture         =   VIEW.FRX:0C10
  151.          TabIndex        =   4
  152.          Top             =   90
  153.          Width           =   420
  154.       End
  155.       Begin SSCommand print_bbox 
  156.          AutoSize        =   1  'Adjust Picture Size To Button
  157.          BevelWidth      =   1
  158.          Font3D          =   0  'None
  159.          Height          =   390
  160.          Left            =   570
  161.          Picture         =   VIEW.FRX:0D92
  162.          TabIndex        =   3
  163.          Top             =   90
  164.          Width           =   420
  165.       End
  166.       Begin SSCommand save_bbox 
  167.          AutoSize        =   1  'Adjust Picture Size To Button
  168.          BevelWidth      =   1
  169.          Font3D          =   0  'None
  170.          Height          =   390
  171.          Left            =   120
  172.          Picture         =   VIEW.FRX:0F14
  173.          TabIndex        =   2
  174.          Top             =   90
  175.          Width           =   420
  176.       End
  177.    End
  178.    Begin VScrollBar view_scroll 
  179.       Height          =   3195
  180.       Left            =   9270
  181.       TabIndex        =   0
  182.       Top             =   540
  183.       Width           =   255
  184.    End
  185.    Begin Menu file_menu 
  186.       Caption         =   "&File"
  187.       Begin Menu menu_save 
  188.          Caption         =   "&Save as..."
  189.       End
  190.       Begin Menu menu_print 
  191.          Caption         =   "&Print"
  192.       End
  193.       Begin Menu s1 
  194.          Caption         =   "-"
  195.       End
  196.       Begin Menu menu_done 
  197.          Caption         =   "&Done"
  198.          Shortcut        =   {F3}
  199.       End
  200.    End
  201.    Begin Menu menu_edit 
  202.       Caption         =   "&Edit"
  203.       Begin Menu menu_find_key 
  204.          Caption         =   "&Find key"
  205.          Shortcut        =   {F5}
  206.       End
  207.       Begin Menu s2 
  208.          Caption         =   "-"
  209.       End
  210.       Begin Menu menu_next 
  211.          Caption         =   "View &next document"
  212.          Begin Menu menu_next_in_order 
  213.             Caption         =   "&In order"
  214.             Shortcut        =   {F8}
  215.          End
  216.          Begin Menu menu_next_listed 
  217.             Caption         =   "&Listed in questions"
  218.             Shortcut        =   +{F8}
  219.          End
  220.       End
  221.       Begin Menu menu_prev 
  222.          Caption         =   "View &prev document"
  223.          Begin Menu menu_prev_in_order 
  224.             Caption         =   "&In order"
  225.             Shortcut        =   {F7}
  226.          End
  227.          Begin Menu menu_prev_listed 
  228.             Caption         =   "&Listed in questions"
  229.             Shortcut        =   +{F7}
  230.          End
  231.       End
  232.       Begin Menu s3 
  233.          Caption         =   "-"
  234.       End
  235.       Begin Menu menu_copy 
  236.          Caption         =   "&Copy"
  237.          Shortcut        =   +{F6}
  238.       End
  239.       Begin Menu s4 
  240.          Caption         =   "-"
  241.       End
  242.       Begin Menu menu_add_section 
  243.          Caption         =   "&Add section"
  244.          Shortcut        =   {F6}
  245.       End
  246.    End
  247.    Begin Menu link_menu 
  248.       Caption         =   "&Link to..."
  249.       Begin Menu link_menu_name 
  250.          Caption         =   "xxxx"
  251.       End
  252.    End
  253.    Begin Menu map_menu 
  254.       Caption         =   "&Show Map..."
  255.    End
  256. Const FORM_OFFSET = 3 ' offset from top of form for button bar
  257. Dim rec As String * MAX_TEXT_LENGTH
  258. Dim tmp_handle As Integer
  259. Dim recno As Integer
  260. Dim doc_lines As Integer
  261. Dim lines_per_page As Integer
  262. Dim line_size As Single
  263. Dim wdno As Integer
  264. Dim box_top As Single
  265. Dim box_bottom As Single
  266. Dim box_drawn As Integer
  267. Dim button_down As Integer
  268. Dim form_cancelled As Integer
  269. Sub add_section_bbox_Click ()
  270.     menu_add_section_click
  271. End Sub
  272. Sub copy_bbox_Click ()
  273.     menu_copy_click
  274. End Sub
  275. Sub find_bbox_Click ()
  276.     menu_find_key_click
  277. End Sub
  278. Sub Form_Load ()
  279.     tmp_handle = FreeFile
  280.     Open temp_path + "\WAIS.$$$" For Random As tmp_handle Len = MAX_TEXT_LENGTH
  281.     form_cancelled = False
  282.     If question_form.max_displays.Checked Then
  283.       view_form.WindowState = MAXIMIZED
  284.     End If
  285.     Caption = viewed_headline
  286.     link_menu.Visible = False
  287.     link_menu.Enabled = False
  288.     telnet_bbox.Enabled = False
  289.     map_menu.Visible = False
  290.     map_menu.Enabled = False
  291.     map_bbox.Enabled = False
  292.     init_find = False
  293.     doc_selected = NONE
  294.     doc_lines = LOF(tmp_handle) / MAX_TEXT_LENGTH
  295.     If viewed_docno <> CURRDOC Then
  296.       If viewed_docno = 0 Then
  297.         menu_prev_listed.Enabled = False
  298.         prev_listed_bbox.Enabled = False
  299.       End If
  300.       If viewed_docno > question_form.title.ListCount - 2 Then
  301.         menu_next_listed.Enabled = False
  302.         next_listed_bbox.Enabled = False
  303.       End If
  304.     End If
  305.     line_size = TextHeight("A")
  306.     lines_per_page = view_form.ScaleHeight / line_size - 7
  307.     view_scroll.LargeChange = lines_per_page
  308.     view_scroll.Min = 1
  309.     If doc_lines <= lines_per_page Then
  310.         view_scroll.Max = 1
  311.     Else
  312.         view_scroll.Max = doc_lines - lines_per_page
  313.     End If
  314.     horiz_scroll.Min = 1
  315.     horiz_scroll.LargeChange = view_form.ScaleWidth / TextWidth("A")
  316.     horiz_scroll.Max = MAX_TEXT_LENGTH - horiz_scroll.LargeChange
  317.     box_top = -1
  318.     box_drawn = False
  319.     button_down = False
  320.     recno = 1
  321.     For x = 1 To doc_lines
  322.       Get tmp_handle, x, rec
  323.       link_wk$ = LCase$(Trim$(rec))
  324.       If Left$(link_wk$, 7) = "minimum" Then
  325.         If Mid$(link_wk$, 9, 8) = "latitude" Then
  326.           minlat$ = Trim$(Right$(link_wk$, Len(link_wk$) - 17))
  327.         ElseIf Mid$(link_wk$, 9, 9) = "longitude" Then
  328.           minlon$ = Trim$(Right$(link_wk$, Len(link_wk$) - 18))
  329.         End If
  330.       ElseIf Left$(link_wk$, 7) = "maximum" Then
  331.         If Mid$(link_wk$, 9, 8) = "latitude" Then
  332.           maxlat$ = Trim$(Right$(link_wk$, Len(link_wk$) - 17))
  333.         ElseIf Mid$(link_wk$, 9, 9) = "longitude" Then
  334.           maxlon$ = LTrim$(Right$(link_wk$, Len(link_wk$) - 18))
  335.         End If
  336.       ElseIf Left$(link_wk$, 7) = "catalog" And Mid$(link_wk$, 9, 4) = "link" Then
  337.         link_menu_name.Caption = Trim$(Right$(link_wk$, Len(link_wk$) - 13))
  338.         link_menu.Enabled = True
  339.         link_menu.Visible = True
  340.         telnet_bbox.Enabled = True
  341.       End If
  342.     Next x
  343.     If minlat$ <> "" And minlon$ <> "" And maxlat$ <> "" And maxlon$ <> "" Then
  344.       
  345.       map_menu.Enabled = True
  346.       map_menu.Visible = True
  347.       map_bbox.Enabled = True
  348.       spat_loc$ = maxlat$ + "," + maxlon$ + " "
  349.       spat_loc$ = spat_loc$ + maxlat$ + "," + minlon$ + " "
  350.       spat_loc$ = spat_loc$ + minlat$ + "," + minlon$ + " "
  351.       spat_loc$ = spat_loc$ + minlat$ + "," + maxlon$ + " "
  352.       spat_loc$ = spat_loc$ + maxlat$ + "," + maxlon$ + " "
  353.       sign = 1
  354.       in_point = 0
  355.       For x = 1 To Len(spat_loc$)
  356.         ch$ = LCase$(Mid$(spat_loc$, x, 1))
  357.         Select Case ch$
  358.           Case "-", ".", "0" To "9"
  359.             num$ = num$ + ch$
  360.           Case "n", "e"
  361.             sign = 1
  362.           Case "s", "w"
  363.             sign = -1
  364.           Case ","
  365.             in_location(in_point, 0) = Val(num$) * sign
  366.             num$ = ""
  367.             sign = 1
  368.           Case " ", ")"
  369.             in_location(in_point, 1) = Val(num$) * sign
  370.             num$ = ""
  371.             in_point = in_point + 1
  372.             sign = 1
  373.         End Select
  374.       Next x
  375.       
  376.     End If
  377. End Sub
  378. Sub Form_MouseDown (Button As Integer, Shift As Integer, x As Single, Y As Single)
  379.     If Y < line_size * (FORM_OFFSET + 1) Then
  380.       Exit Sub
  381.     End If
  382.     button_down = True
  383.     If box_drawn Then
  384.         view_form.Line (0, box_top)-(view_form.ScaleWidth, box_bottom), , BF
  385.         box_drawn = False
  386.     End If
  387.     box_top = Int(Y / line_size) * line_size
  388. End Sub
  389. Sub Form_MouseMove (Button As Integer, Shift As Integer, x As Single, Y As Single)
  390.     If button_down Then
  391.         If box_drawn Then
  392.             view_form.Line (0, box_top)-(view_form.ScaleWidth, box_bottom), , BF
  393.         End If
  394.         box_bottom = Int(Y / line_size) * line_size + line_size
  395.         view_form.Line (0, box_top)-(view_form.ScaleWidth, box_bottom), , BF
  396.         box_drawn = True
  397.     End If
  398. End Sub
  399. Sub form_MouseUp (Button As Integer, Shift As Integer, x As Single, Y As Single)
  400.     button_down = False
  401. End Sub
  402. Sub form_resize ()
  403.     If Not form_cancelled Then
  404.       view_scroll.Height = view_form.Height - button_frame.Height - horiz_scroll.Height - 625
  405.       view_scroll.Left = view_form.Width - 325
  406.       horiz_scroll.Top = view_form.Height - 925
  407.       horiz_scroll.Width = view_form.Width - 300
  408.       corner_fill.Top = horiz_scroll.Top
  409.       corner_fill.Left = view_scroll.Left
  410.       lines_per_page = view_form.ScaleHeight / line_size - 7
  411.       view_scroll.LargeChange = lines_per_page
  412.       view_scroll.Min = 1
  413.       If doc_lines <= lines_per_page Then
  414.         view_scroll.Max = 1
  415.       Else
  416.         view_scroll.Max = doc_lines - lines_per_page
  417.       End If
  418.       horiz_scroll.Min = 1
  419.       horiz_scroll.LargeChange = view_form.ScaleWidth / TextWidth("A")
  420.       horiz_scroll.Max = MAX_TEXT_LENGTH - horiz_scroll.LargeChange
  421.       
  422.       z = show_page()
  423.     End If
  424. End Sub
  425. Sub Form_Unload (Cancel As Integer)
  426.     form_cancelled = True
  427.     If doc_selected = NORMAL Then
  428.       doc_selected = NONE
  429.     End If
  430.     Close (tmp_handle)
  431. End Sub
  432. Sub horiz_scroll_Change ()
  433.   z = show_page()
  434. End Sub
  435. Sub link_menu_name_click ()
  436. Dim ln As String * 80
  437. Dim link_name As String
  438. Dim link_address As String
  439. Dim link_found As Integer
  440.   For x = 0 To 9
  441.     fn$ = "Link" + Trim$(Str$(x + 1))
  442.     lnsz = GetINIString("Links", fn$, "", ln, 80, "wais.ini")
  443.     If lnsz > 0 Then
  444.       c = InStr(ln, " ")
  445.       If c > 1 Then
  446.         link_name$ = LCase$(Left$(ln, c - 1))
  447.         link_address$ = LCase$(LTrim$(Mid$(ln, c + 1, lnsz - c)))
  448.         If link_menu_name.Caption = link_name Then
  449.           link_found = True
  450.           Exit For
  451.         End If
  452.       End If
  453.     End If
  454.   Next x
  455.   If link_found = False Then
  456.     msg$ = "Cannot find link file entry for " + link_name
  457.     MsgBox msg$, MB_WARN
  458.     Exit Sub
  459.   End If
  460.   z = Shell("vttelnet " + link_address, 1)
  461.   z = show_page()
  462. End Sub
  463. Sub map_bbox_Click ()
  464.     map_menu_click
  465. End Sub
  466. Sub map_menu_click ()
  467.     map_form.Show 1
  468.     Unload map_form
  469.     z = show_page()
  470. End Sub
  471. Sub menu_add_section_click ()
  472. Dim DocID As REF
  473.     If box_top < 0 Then
  474.         MsgBox "You haven't selected a section to add", MB_INFO
  475.         Exit Sub
  476.     End If
  477.     z = get_docid(viewed_docno, DocID)
  478.     refno = question_form.reference.ListCount
  479.     ref_doc_size(refno) = DocID.doc_size
  480.     ref_doc_bytes(refno) = Left$(DocID.doc_bytes, DocID.doc_size)
  481.     ref_type(refno) = DocID.type
  482.     ref_start(refno) = Int(box_top / line_size) + recno - FORM_OFFSET - 1
  483.     ref_end(refno) = Int(box_bottom / line_size) + recno - (FORM_OFFSET + 2)
  484.     ref_line$ = "[" + LTrim$(Str$(ref_start(refno))) + "," + LTrim$(Str$(ref_end(refno))) + "]" + viewed_headline
  485.     question_form.reference.AddItem ref_line$
  486.     view_form.DrawMode = 7
  487.     view_form.Line (0, box_top)-(view_form.ScaleWidth, box_bottom), &HFFFF&, BF
  488.     view_form.DrawMode = 6
  489.     box_drawn = False
  490.     box_top = -1
  491.     box_bottom = 0
  492. End Sub
  493. Sub menu_copy_click ()
  494.     If box_top < 0 Then
  495.         MsgBox "You haven't selected a section to copy to the clipboard", MB_INFO
  496.         Exit Sub
  497.     End If
  498.     REF = question_form.reference.ListCount
  499.     title = question_form.title.ListIndex
  500.     first_line = Int(box_top / line_size) + recno
  501.     last_line = Int(box_bottom / line_size) + recno
  502.     view_form.DrawMode = 6
  503.     view_form.Line (0, box_top)-(view_form.ScaleWidth, box_bottom), &HFFFF&, BF
  504.     view_form.DrawMode = 6
  505.     box_drawn = False
  506.     box_top = -1
  507.     box_bottom = 0
  508.     For x = first_line To last_line
  509.         Get #1, x, rec
  510.         cliptext$ = cliptext$ + RTrim$(rec) + Chr$(10) + Chr$(13)
  511.     Next x
  512.     clipboard.SetText cliptext$, 1
  513. End Sub
  514. Sub menu_done_Click ()
  515.     doc_selected = NONE
  516.     view_form.Hide
  517. End Sub
  518. Sub menu_find_key_click ()
  519.     If word(0) = "" Then
  520.         MsgBox "No key words were used for this search", MB_INFO
  521.     End If
  522.     If doc_lines <= lines_per_page Then
  523.         Exit Sub
  524.     End If
  525.     If view_scroll.Value >= doc_lines - lines_per_page Then
  526.         Exit Sub
  527.     End If
  528.     recno = recno + lines_per_page
  529.     While Not show_page()
  530.         recno = recno + lines_per_page
  531.     Wend
  532.     If doc_lines - lines_per_page > recno Then
  533.         view_scroll.Value = recno
  534.     Else
  535.         view_scroll.Value = doc_lines - lines_per_page
  536.     End If
  537.     view_scroll.Refresh
  538. End Sub
  539. Sub menu_next_in_order_click ()
  540.     doc_selected = DOC_NEXT_INORDER
  541.     view_form.Hide
  542. End Sub
  543. Sub menu_next_listed_click ()
  544.     doc_selected = DOC_NEXT_LISTED
  545.     view_form.Hide
  546. End Sub
  547. Sub menu_prev_in_order_click ()
  548.     doc_selected = DOC_PREV_INORDER
  549.     view_form.Hide
  550. End Sub
  551. Sub menu_prev_listed_click ()
  552.     doc_selected = DOC_PREV_LISTED
  553.     view_form.Hide
  554. End Sub
  555. Sub menu_print_click ()
  556.     Dim rec As String * MAX_TEXT_LENGTH
  557.     question_form.file_dialog.CancelError = True
  558.     question_form.file_dialog.FilterIndex = 1
  559.     question_form.file_dialog.Flags = PD_HIDEPRINTTOFILE Or PD_NOPAGENUMS
  560.     On Error Resume Next
  561.     question_form.file_dialog.Action = 5
  562.     Select Case Err
  563.       Case 0
  564.         mousepointer = HOURGLASS
  565.         linecnt = 99
  566.         pagecnt = 0
  567.         For x = 1 To doc_lines
  568.             If linecnt > 55 Then
  569.                 GoSub header
  570.             End If
  571.             Get #1, x, rec
  572.             printer.Print RTrim$(rec)
  573.         Next x
  574.         printer.EndDoc
  575.         Close (2)
  576.         mousepointer = DEFAULT
  577.       Case 32755
  578.         z = show_page()
  579.         Exit Sub
  580.       Case Else
  581.         msg$ = "Print failed with code" + Str$(Err) + ", print cancelled."
  582.         MsgBox msg$, MB_WARN
  583.     End Select
  584.     z = show_page()
  585. Exit Sub
  586. header:
  587.     printer.NewPage
  588.     heading$ = Right$(question_form.title.List(view_docno), Len(question_form.title.List(docno)) - 17)
  589.     If Len(heading$) > xx Then
  590.         heading$ = Left$(heading$, xx)
  591.     End If
  592.     pagecnt = pagecnt + 1
  593.     linecnt = 0
  594.     printer.Print heading$; Format$(Now, "ddddd tttt"); "Page"; Str$(pagecnt)
  595.     printer.Print
  596. Return
  597. End Sub
  598. Sub menu_save_click ()
  599. Dim rec As String * MAX_TEXT_LENGTH
  600.     cur_dir$ = CurDir$
  601.       
  602.     On Error Resume Next
  603.     question_form.file_dialog.Action = 2
  604.     Select Case Err
  605.       Case 0
  606.         mousepointer = HOURGLASS
  607.         save_handle = FreeFile
  608.         Open question_form.file_dialog.Filename For Output As save_handle
  609.         For x = 1 To doc_lines
  610.           Get #tmp_handle, x, rec
  611.           Print #save_handle, RTrim$(rec)
  612.         Next x
  613.         Close (save_handle)
  614.         mousepointer = DEFAULT
  615.       Case 32755
  616.         z = show_page()
  617.         Exit Sub
  618.       Case Else
  619.         msg$ = "Save failed with code" + Str$(Err) + ", save cancelled."
  620.         MsgBox msg$, MB_WARN
  621.     End Select
  622.     ChDir cur_dir$
  623.     z = show_page()
  624. End Sub
  625. Sub next_in_order_bbox_Click ()
  626.     menu_next_in_order_click
  627. End Sub
  628. Sub next_listed_bbox_Click ()
  629.     menu_next_listed_click
  630. End Sub
  631. Sub prev_in_order_bbox_Click ()
  632.     menu_prev_in_order_click
  633. End Sub
  634. Sub prev_listed_bbox_Click ()
  635.     menu_prev_listed_click
  636. End Sub
  637. Sub print_bbox_Click ()
  638.     menu_print_click
  639. End Sub
  640. Sub save_bbox_Click ()
  641.     menu_save_click
  642. End Sub
  643. Function show_page () As Integer
  644. Static pos As Integer
  645.     show_page = False
  646.     If Not init_find Then
  647.         GoSub first_find
  648.     End If
  649.     view_form.Cls
  650.     For x = 0 To FORM_OFFSET
  651.       view_form.Print
  652.     Next x
  653.     ln = x - 1
  654.     For x = recno To recno + lines_per_page
  655.         
  656.       If x <= doc_lines Then
  657.            
  658.         Get #tmp_handle, x, rec
  659.         rec = Right$(rec, MAX_TEXT_LENGTH - horiz_scroll.Value + 1)
  660.         
  661.         currentx = 0
  662.         view_form.Print " "; rec
  663.         ln = ln + 1
  664.             
  665.         If question_form.keywords.Text <> "" Then
  666.           rec = LCase$(rec)
  667.                 
  668.           For Y = 0 To wdno
  669.             pos = 1
  670.             While pos > 0
  671.               pos = InStr(pos, rec, word(Y))
  672.               If pos > 0 Then
  673.                 If test_for_word(word(Y), pos) Then
  674.                   show_page = True
  675.                   view_form.DrawMode = 9
  676.                   wd_left = pos * view_form.TextWidth("A")
  677.                   wd_right = (pos + Len(word(Y))) * view_form.TextWidth("A")
  678.                   wd_top = ln * view_form.TextHeight("A")
  679.                   wd_bottom = wd_top + view_form.TextHeight("A")
  680.                   view_form.Line (wd_left, wd_top)-(wd_right, wd_bottom), &HFF00&, BF
  681.                   view_form.DrawMode = 6
  682.                 End If
  683.                 pos = pos + Len(word(Y))
  684.               End If
  685.             Wend
  686.           Next Y
  687.         End If
  688.       Else
  689.         show_page = True
  690.       End If
  691.     Next x
  692. Exit Function
  693. first_find:
  694.     For c1 = 0 To 19
  695.       word(c1) = ""
  696.     Next c1
  697.     words$ = LCase$(question_form.keywords.Text)
  698.     For c1 = 1 To Len(words$)
  699.       letter$ = Mid$(words$, c1, 1)
  700.       If letter$ < "0" Or (letter$ > "9" And letter$ < "a") Or (letter$ > "z") Then
  701.         Mid$(words$, c1, 1) = " "
  702.       End If
  703.     Next c1
  704.     c1 = 1
  705.     For wdno = 0 To 19
  706.         c2 = InStr(c1, words$, " ")
  707.         If c2 = 0 Then
  708.             word(wdno) = Trim$(Mid$(words$, c1, Len(words$) - c1 + 1))
  709.             Exit For
  710.         End If
  711.         word(wdno) = Trim$(Mid$(words$, c1, c2 - c1))
  712.         c1 = c2 + 1
  713.         If word(wdno) = "and" Or word(wdno) = "" Or word(wdno) = Space$(Len(word(wdno))) Then
  714.             wdno = wdno - 1
  715.         End If
  716.     Next wdno
  717.     If word(wdno) = "" Then
  718.       wdno = wdno - 1
  719.     End If
  720.     init_find = True
  721. Return
  722. End Function
  723. Sub telnet_bbox_Click ()
  724.     link_menu_name_click
  725. End Sub
  726. Function test_for_word (word As String, pos As Integer) As Integer
  727.     If pos > 1 Then
  728.       Select Case Mid$(rec, pos - 1, 1)
  729.         Case "1" To "9"
  730.           test_for_word = False
  731.           Exit Function
  732.         Case "a" To "z"
  733.           test_for_word = False
  734.           Exit Function
  735.       End Select
  736.     End If
  737.     wdend = pos + Len(word)
  738.     If wdend < 81 Then
  739.       Select Case Mid$(rec, wdend, 1)
  740.         Case "1" To "9"
  741.           test_for_word = False
  742.           Exit Function
  743.         Case "a" To "z"
  744.           test_for_word = False
  745.           Exit Function
  746.       End Select
  747.     End If
  748.     test_for_word = True
  749. End Function
  750. Sub view_scroll_Change ()
  751.     If recno <> view_scroll.Value Then
  752.         recno = view_scroll.Value
  753.         z = show_page()
  754.     End If
  755.     box_drawn = False
  756.     box_top = -1
  757.     box_bottom = 0
  758. End Sub
  759.