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

  1. VERSION 2.00
  2. Begin Form question_form 
  3.    BackColor       =   &H00C0C0C0&
  4.    Caption         =   "WAIS Query"
  5.    ClientHeight    =   4875
  6.    ClientLeft      =   15
  7.    ClientTop       =   1440
  8.    ClientWidth     =   9465
  9.    Height          =   5565
  10.    Icon            =   QUESTION.FRX:0000
  11.    Left            =   -45
  12.    LinkMode        =   1  'Source
  13.    LinkTopic       =   "Form1"
  14.    ScaleHeight     =   4875
  15.    ScaleWidth      =   9465
  16.    Top             =   810
  17.    Width           =   9585
  18.    Begin SSPanel button_bar 
  19.       Align           =   1  'Align Top
  20.       Alignment       =   0  'Left Justify - TOP
  21.       BackColor       =   &H00808080&
  22.       BevelOuter      =   1  'Inset
  23.       Font3D          =   1  'Raised w/light shading
  24.       ForeColor       =   &H00000000&
  25.       Height          =   495
  26.       Left            =   0
  27.       Outline         =   -1  'True
  28.       TabIndex        =   23
  29.       Top             =   0
  30.       Width           =   9465
  31.       Begin SSCommand slipdial_bbox 
  32.          AutoSize        =   2  'Adjust Button Size To Picture
  33.          BevelWidth      =   1
  34.          Font3D          =   0  'None
  35.          Height          =   420
  36.          Left            =   2340
  37.          Picture         =   QUESTION.FRX:073A
  38.          TabIndex        =   4
  39.          Top             =   30
  40.          Width           =   450
  41.       End
  42.       Begin SSCommand map_bbox 
  43.          AutoSize        =   2  'Adjust Button Size To Picture
  44.          BevelWidth      =   1
  45.          Font3D          =   0  'None
  46.          Height          =   420
  47.          Left            =   1770
  48.          Picture         =   QUESTION.FRX:08BC
  49.          TabIndex        =   3
  50.          Top             =   30
  51.          Width           =   450
  52.       End
  53.       Begin SSCommand aids_clear_bbox 
  54.          AutoSize        =   2  'Adjust Button Size To Picture
  55.          BevelWidth      =   1
  56.          Font3D          =   0  'None
  57.          Height          =   420
  58.          Left            =   1170
  59.          Picture         =   QUESTION.FRX:0A3E
  60.          TabIndex        =   2
  61.          Top             =   30
  62.          Width           =   450
  63.       End
  64.       Begin SSCommand max_displays_bbox 
  65.          AutoSize        =   2  'Adjust Button Size To Picture
  66.          BevelWidth      =   1
  67.          Font3D          =   0  'None
  68.          Height          =   420
  69.          Left            =   750
  70.          Picture         =   QUESTION.FRX:0BC0
  71.          TabIndex        =   1
  72.          Top             =   30
  73.          Width           =   450
  74.       End
  75.       Begin SSCommand add_source_bbox 
  76.          AutoSize        =   2  'Adjust Button Size To Picture
  77.          BevelWidth      =   1
  78.          Font3D          =   0  'None
  79.          Height          =   420
  80.          Left            =   150
  81.          Picture         =   QUESTION.FRX:0D42
  82.          TabIndex        =   0
  83.          Top             =   30
  84.          Width           =   450
  85.       End
  86.    End
  87.    Begin SSPanel results_box 
  88.       Align           =   1  'Align Top
  89.       Alignment       =   3  'Right Justify - TOP
  90.       BackColor       =   &H00C0C0C0&
  91.       Caption         =   "Resulting Documents "
  92.       Font3D          =   0  'None
  93.       ForeColor       =   &H00000000&
  94.       Height          =   2145
  95.       Left            =   0
  96.       TabIndex        =   14
  97.       Top             =   2760
  98.       Width           =   9465
  99.       Begin SSPanel status_label 
  100.          BackColor       =   &H00C0C0C0&
  101.          BevelOuter      =   1  'Inset
  102.          Caption         =   "Status"
  103.          Font3D          =   0  'None
  104.          ForeColor       =   &H00000000&
  105.          Height          =   495
  106.          Left            =   60
  107.          TabIndex        =   22
  108.          Top             =   1590
  109.          Width           =   675
  110.       End
  111.       Begin SSPanel status_box 
  112.          Alignment       =   3  'Right Justify - TOP
  113.          BackColor       =   &H00C0C0C0&
  114.          BevelOuter      =   1  'Inset
  115.          Font3D          =   1  'Raised w/light shading
  116.          ForeColor       =   &H00000000&
  117.          Height          =   495
  118.          Left            =   750
  119.          TabIndex        =   20
  120.          Top             =   1590
  121.          Width           =   8715
  122.          Begin ListBox status_list 
  123.             BackColor       =   &H00FFFFFF&
  124.             Height          =   420
  125.             Left            =   30
  126.             TabIndex        =   21
  127.             Top             =   30
  128.             Width           =   8655
  129.          End
  130.       End
  131.       Begin SSPanel title_box 
  132.          Alignment       =   3  'Right Justify - TOP
  133.          BackColor       =   &H00C0C0C0&
  134.          BevelOuter      =   1  'Inset
  135.          Font3D          =   1  'Raised w/light shading
  136.          ForeColor       =   &H00000000&
  137.          Height          =   1005
  138.          Left            =   90
  139.          TabIndex        =   19
  140.          Top             =   510
  141.          Width           =   9405
  142.          Begin ListBox title 
  143.             BackColor       =   &H00FFFFFF&
  144.             DragIcon        =   QUESTION.FRX:0EC4
  145.             FontBold        =   0   'False
  146.             FontItalic      =   0   'False
  147.             FontName        =   "Terminal"
  148.             FontSize        =   9
  149.             FontStrikethru  =   0   'False
  150.             FontUnderline   =   0   'False
  151.             Height          =   570
  152.             Left            =   30
  153.             TabIndex        =   10
  154.             Tag             =   "TITLE"
  155.             Top             =   30
  156.             Width           =   9345
  157.          End
  158.       End
  159.       Begin SSPanel title_label 
  160.          Alignment       =   1  'Left Justify - MIDDLE
  161.          BackColor       =   &H00C0C0C0&
  162.          BevelOuter      =   1  'Inset
  163.          Caption         =   "Title"
  164.          Font3D          =   0  'None
  165.          ForeColor       =   &H00000000&
  166.          Height          =   255
  167.          Left            =   2190
  168.          TabIndex        =   18
  169.          Top             =   240
  170.          Width           =   7275
  171.       End
  172.       Begin SSPanel Panel3D8 
  173.          BackColor       =   &H00C0C0C0&
  174.          BevelOuter      =   1  'Inset
  175.          Caption         =   "Src"
  176.          Font3D          =   0  'None
  177.          ForeColor       =   &H00000000&
  178.          Height          =   255
  179.          Left            =   1530
  180.          TabIndex        =   17
  181.          Top             =   240
  182.          Width           =   615
  183.       End
  184.       Begin SSPanel Panel3D7 
  185.          BackColor       =   &H00C0C0C0&
  186.          BevelOuter      =   1  'Inset
  187.          Caption         =   "Size"
  188.          Font3D          =   0  'None
  189.          ForeColor       =   &H00000000&
  190.          Height          =   255
  191.          Left            =   750
  192.          TabIndex        =   16
  193.          Top             =   240
  194.          Width           =   735
  195.       End
  196.       Begin SSPanel Panel3D6 
  197.          Alignment       =   1  'Left Justify - MIDDLE
  198.          BackColor       =   &H00C0C0C0&
  199.          BevelOuter      =   1  'Inset
  200.          Caption         =   "Score"
  201.          Font3D          =   0  'None
  202.          ForeColor       =   &H00000000&
  203.          Height          =   255
  204.          Left            =   60
  205.          TabIndex        =   15
  206.          Top             =   240
  207.          Width           =   645
  208.       End
  209.    End
  210.    Begin SSPanel reference_frame 
  211.       Align           =   1  'Align Top
  212.       Alignment       =   0  'Left Justify - TOP
  213.       BackColor       =   &H00C0C0C0&
  214.       Caption         =   "Similar to:"
  215.       Font3D          =   0  'None
  216.       ForeColor       =   &H00000000&
  217.       Height          =   1380
  218.       Left            =   0
  219.       TabIndex        =   12
  220.       Top             =   1380
  221.       Width           =   9465
  222.       Begin CommandButton add_doc 
  223.          Caption         =   "&Add Doc"
  224.          Height          =   375
  225.          Left            =   8370
  226.          TabIndex        =   8
  227.          Top             =   270
  228.          Width           =   1065
  229.       End
  230.       Begin CommandButton del_doc 
  231.          Caption         =   "&Delete Doc"
  232.          Height          =   375
  233.          Left            =   8370
  234.          TabIndex        =   9
  235.          Top             =   810
  236.          Width           =   1065
  237.       End
  238.       Begin SSPanel reference_box 
  239.          Alignment       =   0  'Left Justify - TOP
  240.          BackColor       =   &H00C0C0C0&
  241.          BevelOuter      =   1  'Inset
  242.          Font3D          =   1  'Raised w/light shading
  243.          ForeColor       =   &H00000000&
  244.          Height          =   1005
  245.          Left            =   60
  246.          TabIndex        =   13
  247.          Top             =   240
  248.          Width           =   8265
  249.          Begin ListBox reference 
  250.             BackColor       =   &H00FFFFFF&
  251.             DragIcon        =   QUESTION.FRX:11C6
  252.             FontBold        =   0   'False
  253.             FontItalic      =   0   'False
  254.             FontName        =   "Terminal"
  255.             FontSize        =   9
  256.             FontStrikethru  =   0   'False
  257.             FontUnderline   =   0   'False
  258.             Height          =   570
  259.             Left            =   30
  260.             TabIndex        =   7
  261.             Tag             =   "REF"
  262.             Top             =   30
  263.             Width           =   8175
  264.          End
  265.       End
  266.    End
  267.    Begin SSPanel Panel3D1 
  268.       Align           =   1  'Align Top
  269.       Alignment       =   0  'Left Justify - TOP
  270.       BackColor       =   &H00C0C0C0&
  271.       Caption         =   "Tell me about:"
  272.       Font3D          =   0  'None
  273.       ForeColor       =   &H00000000&
  274.       Height          =   885
  275.       Left            =   0
  276.       TabIndex        =   5
  277.       Top             =   495
  278.       Width           =   9465
  279.       Begin SSCommand search 
  280.          BevelWidth      =   1
  281.          Font3D          =   0  'None
  282.          Height          =   495
  283.          Left            =   8370
  284.          Picture         =   QUESTION.FRX:14C8
  285.          TabIndex        =   24
  286.          Top             =   240
  287.          Width           =   1065
  288.       End
  289.       Begin SSPanel keywords_box 
  290.          Alignment       =   0  'Left Justify - TOP
  291.          BackColor       =   &H00C0C0C0&
  292.          BevelOuter      =   1  'Inset
  293.          Font3D          =   1  'Raised w/light shading
  294.          ForeColor       =   &H00000000&
  295.          Height          =   585
  296.          Left            =   60
  297.          TabIndex        =   11
  298.          Top             =   210
  299.          Width           =   8265
  300.          Begin TextBox keywords 
  301.             BackColor       =   &H00FFFFFF&
  302.             FontBold        =   0   'False
  303.             FontItalic      =   0   'False
  304.             FontName        =   "Terminal"
  305.             FontSize        =   9
  306.             FontStrikethru  =   0   'False
  307.             FontUnderline   =   0   'False
  308.             Height          =   495
  309.             Left            =   30
  310.             MultiLine       =   -1  'True
  311.             ScrollBars      =   2  'Vertical
  312.             TabIndex        =   6
  313.             Top             =   30
  314.             Width           =   8175
  315.          End
  316.       End
  317.    End
  318.    Begin CommonDialog file_dialog 
  319.       Left            =   4080
  320.       Top             =   1920
  321.    End
  322.    Begin Menu file_menu 
  323.       Caption         =   "&File"
  324.       Begin Menu add_source_menu 
  325.          Caption         =   "&Select Sources"
  326.       End
  327.       Begin Menu s1 
  328.          Caption         =   "-"
  329.       End
  330.       Begin Menu exit_menu 
  331.          Caption         =   "E&xit"
  332.       End
  333.    End
  334.    Begin Menu setup_menu 
  335.       Caption         =   "&Setup"
  336.       Begin Menu hide_buttons 
  337.          Caption         =   "&Hide Buttons"
  338.          Checked         =   -1  'True
  339.       End
  340.       Begin Menu max_displays 
  341.          Caption         =   "&Maximize Displays"
  342.          Checked         =   -1  'True
  343.       End
  344.       Begin Menu menu_setup_globe 
  345.          Caption         =   "Show Globe on Map"
  346.          Checked         =   -1  'True
  347.          Enabled         =   0   'False
  348.          Visible         =   0   'False
  349.       End
  350.       Begin Menu menu_setup_grid 
  351.          Caption         =   "Show Grid on Map"
  352.          Checked         =   -1  'True
  353.          Enabled         =   0   'False
  354.          Visible         =   0   'False
  355.       End
  356.       Begin Menu s2 
  357.          Caption         =   "-"
  358.       End
  359.       Begin Menu edit_src_menu 
  360.          Caption         =   "&Sources"
  361.       End
  362.       Begin Menu s5 
  363.          Caption         =   "-"
  364.       End
  365.       Begin Menu max_docs_menu 
  366.          Caption         =   "&Max Documents"
  367.       End
  368.       Begin Menu link_edit_menu 
  369.          Caption         =   "&Link Names"
  370.       End
  371.       Begin Menu filter_menu 
  372.          Caption         =   "&Filters"
  373.       End
  374.    End
  375.    Begin Menu aids_menu 
  376.       Caption         =   "&Aids"
  377.       Begin Menu aids_clear_menu 
  378.          Caption         =   "&Clear"
  379.       End
  380.       Begin Menu x1 
  381.          Caption         =   "-"
  382.       End
  383.       Begin Menu slip_dial 
  384.          Caption         =   "&SLIP Dial"
  385.       End
  386.       Begin Menu map_menu 
  387.          Caption         =   "&Map"
  388.       End
  389.    End
  390.    Begin Menu help_menu 
  391.       Caption         =   "&Help"
  392.       Begin Menu using_menu 
  393.          Caption         =   "&Using WAIS"
  394.       End
  395.       Begin Menu s4 
  396.          Caption         =   "-"
  397.       End
  398.       Begin Menu about_menu 
  399.          Caption         =   "&About WAIS"
  400.       End
  401.    End
  402. Sub about_menu_Click ()
  403.     about_form.Show 1
  404.     Unload about_form
  405. End Sub
  406. Sub add_doc_click ()
  407.     Dim DocID As REF
  408.     If title.ListIndex = -1 Then
  409.         MsgBox "Please highlight a reference for comparison", MB_INFO
  410.         Exit Sub
  411.     End If
  412.     z = get_docid(title.ListIndex, DocID)
  413.     ref_doc_size(reference.ListCount) = DocID.doc_size
  414.     ref_doc_bytes(reference.ListCount) = Left$(DocID.doc_bytes, DocID.doc_size)
  415.     ref_type(reference.ListCount) = DocID.type
  416.     ref_start(reference.ListCount) = -1
  417.     ref_end(reference.ListCount) = -1
  418.     reference.AddItem Right$(title.Text, Len(title.Text) - 11)
  419. End Sub
  420. Sub add_source_bbox_Click ()
  421. '    If Not Value Then
  422. '      Exit Sub
  423. '    End If
  424.     add_source_menu_click
  425. '    add_source_bbox.Value = False
  426. End Sub
  427. Sub add_source_menu_click ()
  428.     mousepointer = HOURGLASS
  429.     sources_form.Show
  430.     mousepointer = DEFAULT
  431. End Sub
  432. Sub aids_clear_bbox_Click ()
  433.     aids_clear_menu_click
  434. End Sub
  435. Sub aids_clear_menu_click ()
  436.     keywords.Text = ""
  437.     If reference.ListCount > 0 Then
  438.       For X = 1 To reference.ListCount
  439.         reference.RemoveItem 0
  440.       Next X
  441.     End If
  442. End Sub
  443. Sub del_doc_click ()
  444.     Dim X As Integer
  445.     If reference.ListIndex > -1 Then
  446.         
  447.         For X = reference.ListIndex To reference.ListCount
  448.             ref_doc_size(X) = ref_doc_size(X + 1)
  449.             ref_doc_bytes(X) = ref_doc_bytes(X + 1)
  450.         Next X
  451.         
  452.         reference.RemoveItem reference.ListIndex
  453.     Else
  454.         MsgBox "You haven't selected a reference to delete", MB_INFO
  455.     End If
  456. End Sub
  457. Sub edit_src_menu_Click ()
  458.     new_src_form.Show 1
  459.     Unload new_src_form
  460. End Sub
  461. Sub exit_menu_Click ()
  462.     If Not MsgBox("Are you sure you want to exit from WAIS?", MB_WARN Or 1) = 1 Then
  463.         Exit Sub
  464.     End If
  465.     final_exit
  466. End Sub
  467. Sub filter_menu_Click ()
  468.     filters_form.Show 1
  469.     Unload filters_form
  470. End Sub
  471. Sub final_exit ()
  472.     Close
  473.     save_source_group
  474.     On Error Resume Next
  475.     Kill temp_path + "\WAIS.$$$"
  476.     For X = 0 To MAX_TEMP_FILES - 1
  477.       If file_list(X) <> "" Then
  478.         fn$ = temp_path + "\WAIS" + Format$(X, "0000") + "." + file_list(X)
  479.         Kill fn$
  480.       End If
  481.     Next X
  482.     z = PutINIString("Settings", "HideButtons", Str$(hide_buttons.Checked), "wais.ini")
  483.     z = PutINIString("Settings", "MaxDocs", Str$(max_docs), "wais.ini")
  484.     z = PutINIString("Settings", "MaxDisplays", Str$(max_displays.Checked), "wais.ini")
  485. '    z = PutINIString("Settings", "WinSock", Str$(winsock_menu.Checked), "wais.ini")
  486.     z = PutINIString("Settings", "SrcGroup", current_group, "wais.ini")
  487.     End
  488. End Sub
  489. Sub Form_Activate ()
  490.   hide_buttons.Checked = Not hide_buttons.Checked
  491.   hide_buttons_click
  492. End Sub
  493. Sub Form_DragDrop (Source As Control, X As Single, Y As Single)
  494.     If Source.Tag = "REF" Then
  495.         del_doc_click
  496.     End If
  497. End Sub
  498. Sub Form_Load ()
  499. Dim wais_handle As Integer
  500. Dim ln As String * 80
  501.     wais_handle = GetModuleHandle("wais")
  502.     If GetModuleUsage(wais_handle) > 0 Then
  503.       z = MsgBox("Another copy of WAIS is already running", MB_WARN)
  504.       End
  505.     End If
  506.     temp_path = Environ$("TEMP")
  507.     If temp_path = "" Then
  508.       temp_path = Environ$("TMP")
  509.     End If
  510.     If Right$(temp_path, 1) = "\" Then
  511.       temp_path = Left$(temp_path, Len(temp_path) - 1)
  512.     End If
  513.     tmpfile$ = temp_path + "\WAIS00*.*"
  514.     fn$ = Dir$(tmpfile$)
  515.     While fn$ <> ""
  516.       Kill temp_path + "\" + fn$
  517.       fn$ = Dir$
  518.     Wend
  519.     'db_path = Command$
  520.     'If db_path = "" Then
  521.     '  db_path = Environ$("WAISDB")
  522.     'End If
  523.     z = set_path(db_path, temp_path)
  524.     'log_status "Using '" + db_path + "' for local databases"
  525.     log_status "Using '" + temp_path + "' for work files"
  526.     max_docs = GetINIInt("Settings", "MaxDocs", 75, "wais.ini")
  527.     maxdocs_form.num_docs.Caption = Str$(max_docs)
  528.     z = set_maxdocs(max_docs)
  529.     max_displays.Checked = GetINIInt("Settings", "MaxDisplays", True, "wais.ini")
  530.     If max_displays.Checked Then
  531.       windowstate = MAXIMIZED
  532.       Refresh
  533.     End If
  534.     hide_buttons.Checked = GetINIInt("Settings", "HideButtons", False, "wais.ini")
  535.     lnsz = GetINIString("Settings", "SrcGroup", "", ln, 80, "wais.ini")
  536.     If lnsz = 0 Then
  537.       current_group = "WAIS"
  538.     Else
  539.       current_group = Trim$(Left$(ln, lnsz))
  540.     End If
  541.     load_group_list sources_form, READONLY
  542.     load_source_group
  543.     coprocessor = coprocessor_status()
  544.     file_dialog.CancelError = True
  545.     file_dialog.DefaultExt = "doc"
  546.     file_dialog.Filename = "*.doc"
  547.     file_dialog.Filter = "Document (*.doc)|*.doc|Text file (*.txt)|*.txt|Print files (*.prt)|*.prt|All files (*.*)|*.*|"
  548.     file_dialog.FilterIndex = 1
  549.     file_dialog.Flags = OFN_PATHMUSTEXIST Or OFN_HIDEREADONLY Or OFN_OVERWRITEPROMPT
  550.     For X = 0 To 9
  551.       fn$ = "Filter" + Trim$(Str$(X + 1))
  552.       lnsz = GetINIString("Filters", fn$, "", ln, 80, "wais.ini")
  553.       If lnsz > 0 Then
  554.         filter_type_code(X) = UCase$(RTrim$(Left$(ln, 4)))
  555.         filter_ext(X) = UCase$(RTrim$(Mid$(ln, 6, 3)))
  556.         filter_name(X) = UCase$(RTrim$(Mid$(ln, 10, lnsz - 9)))
  557.       End If
  558.     Next X
  559.     mousecursor = DEFAULT
  560. End Sub
  561. Sub form_resize ()
  562.     If windowstate = MINIMIZED Then
  563.       Exit Sub
  564.     End If
  565.     If question_form.Height < 5000 Then
  566.        question_form.Height = 5000
  567.     End If
  568.     If question_form.Width < 4000 Then
  569.       question_form.Width = 4000
  570.     End If
  571.     search.Left = question_form.Width - (search.Width + 200)
  572.     add_doc.Left = search.Left
  573.     del_doc.Left = search.Left
  574.     keywords.Width = search.Left - 200
  575.     keywords_box.Width = keywords.Width + 80
  576.     reference.Width = search.Left - 200
  577.     reference_box.Width = reference.Width + 80
  578.     reference.Height = reference_box.Height - 40
  579.     results_box.Height = question_form.Height - keywords_box.Height - reference_box.Height - button_bar.Height
  580.     title.Width = results_box.Width - 200
  581.     title_box.Width = title.Width + 80
  582.     title.Height = results_box.Height - 2500
  583.     title_box.Height = title.Height + 80
  584.     title_label.Width = title.Width - 2050
  585.     status_label.Top = title_box.Top + title_box.Height + 50
  586.     status_box.Top = status_label.Top
  587.     status_box.Width = title_box.Width - 695
  588.     status_list.Width = status_box.Width - 70
  589. End Sub
  590. Sub Form_Unload (Cancel As Integer)
  591.     If Not MsgBox("Are you sure you want to exit from WAIS?", MB_WARN Or 1) = 1 Then
  592.         Cancel = 1
  593.         Exit Sub
  594.     End If
  595.     final_exit
  596. End Sub
  597. Sub hide_buttons_click ()
  598.     If hide_buttons.Checked = False Then
  599.         hide_buttons.Checked = True
  600.         add_doc.Visible = False
  601.         add_doc.Enabled = False
  602.         del_doc.Visible = False
  603.         del_doc.Enabled = False
  604.         reference_box.Width = title_box.Width
  605.         reference.Width = title.Width
  606.     Else
  607.         hide_buttons.Checked = False
  608.         add_doc.Visible = True
  609.         add_doc.Enabled = True
  610.         del_doc.Visible = True
  611.         del_doc.Enabled = True
  612.         reference_box.Width = keywords_box.Width
  613.         reference.Width = keywords.Width
  614.     End If
  615. End Sub
  616. Sub keywords_DragDrop (Source As Control, X As Single, Y As Single)
  617.     If Source.Tag = "REF" Then
  618.         del_doc_click
  619.     End If
  620. End Sub
  621. Sub keywords_KeyPress (KeyAscii As Integer)
  622.     If KeyAscii = 13 Then
  623.         search.Value = True
  624.         KeyAscii = 0
  625.     End If
  626. End Sub
  627. Sub link_edit_menu_Click ()
  628.     link_edit_form.Show 1
  629.     Unload link_edit_form
  630. End Sub
  631. Sub log_status (status_message As String)
  632.     If status_list.ListCount > 19 Then
  633.         status_list.RemoveItem 19
  634.     End If
  635.     status_list.AddItem status_message, 0
  636.     status_list.ListIndex = 0
  637.     status_list.Refresh
  638. End Sub
  639. Sub map_bbox_Click ()
  640.     map_menu_click
  641. End Sub
  642. Sub map_menu_click ()
  643.     map_form.Show 1
  644.     Unload map_form
  645. End Sub
  646. Sub max_displays_bbox_Click ()
  647.     max_displays_click
  648. End Sub
  649. Sub max_displays_click ()
  650.     If max_displays.Checked Then
  651.       max_displays.Checked = False
  652.       windowstate = DEFAULT
  653.     Else
  654.       max_displays.Checked = True
  655.       windowstate = MAXIMIZED
  656.     End If
  657. End Sub
  658. Sub max_docs_menu_Click ()
  659.     maxdocs_form.Show 1
  660.     Unload maxdocs_form
  661. End Sub
  662. Sub menu_setup_globe_Click ()
  663.     If menu_setup_globe.Checked Then
  664.       menu_setup_globe.Checked = False
  665.     Else
  666.       menu_setup_globe.Checked = True
  667.     End If
  668. End Sub
  669. Sub menu_setup_grid_Click ()
  670.   If menu_setup_grid.Checked Then
  671.     menu_setup_grid.Checked = False
  672.   Else
  673.     menu_setup_grid.Checked = True
  674.   End If
  675. End Sub
  676. Sub reference_DblClick ()
  677.     del_doc_click
  678. End Sub
  679. Sub reference_DragDrop (Source As Control, X As Single, Y As Single)
  680.     If Source.Tag = "TITLE" Then
  681.         add_doc_click
  682.     End If
  683. End Sub
  684. Sub reference_MouseDown (Button As Integer, Shift As Integer, X As Single, Y As Single)
  685.     If reference.ListIndex > -1 Then
  686.         reference.Drag 1
  687.     Else
  688.         reference.Drag 0
  689.     End If
  690. End Sub
  691. Sub reference_MouseUp (Button As Integer, Shift As Integer, X As Single, Y As Single)
  692.     reference.Drag 0
  693. End Sub
  694. Sub search_click ()
  695. Dim func As Integer
  696. Dim stat As Integer
  697. Dim docno As Integer
  698. Dim refno As Integer
  699. Dim tot_ref As Integer
  700. Dim headline As DOC
  701. Dim refid As REF
  702.     If sources_form.source_list.ListCount = 0 Then
  703.       MsgBox "You must select at least one source.  Use File/Select from menu bar to select sources.", MB_INFO
  704.       search.Value = False
  705.       Exit Sub
  706.     End If
  707.     mousepointer = HOURGLASS
  708.     title.Clear
  709.     tot_ref = reference.ListCount
  710.       
  711.     If tot_ref > 0 Then
  712.         
  713.         For refno = 0 To tot_ref - 1
  714.             refid.ch_start = ref_start(refno) - 1
  715.             refid.ch_end = ref_end(refno)
  716.             refid.doc_size = ref_doc_size(refno)
  717.             refid.type = ref_type(refno)
  718.             refid.doc_bytes = ref_doc_bytes(refno)
  719.             stat = reference_titles(refno, tot_ref, refid)
  720.         Next refno
  721.     End If
  722.     func = 0
  723.     For X = 0 To sources_form.source_list.ListCount - 1
  724.       If X > 0 Then
  725.         func = 1
  726.       End If
  727.       If X = sources_form.source_list.ListCount - 1 Then
  728.         func = 2
  729.       End If
  730.         
  731.       kw$ = keywords.Text
  732.       If Len(kw$) = 0 Then
  733.         kw$ = " "
  734.       End If
  735.       log_status " Querying " + src_database(X) + " at " + src_service(X)
  736.         
  737.       z = DoEvents()
  738.       stat = query_titles(func, tot_ref, src_service(X), src_database(X), kw$, src_port(X))
  739.       test_for_error stat, 0
  740.     Next X
  741.     stat = 0
  742.     docno = 0
  743.     While stat = 0 And docno < max_docs
  744.         
  745.       stat = get_titles(docno, headline)
  746.       test_for_error stat, docno
  747.         
  748.       If stat = 0 Or stat = 1 Then
  749.         title_type(docno) = headline.type
  750.         title_length(docno) = headline.length
  751.         tscore$ = String$(headline.score / 250, 15) '240)
  752.         tscore$ = tscore$ + Space$(4 - Len(tscore$))
  753.         If headline.length > 10238976 Then
  754.           tlength$ = " >9999K "
  755.         Else
  756.           tlength$ = Format$(headline.length / 1024, "###.0K")
  757.           tlength$ = Space$(7 - Len(tlength$)) + tlength$ + " "
  758.         End If
  759.         ts = InStr(sources_form.source_list.List(headline.Source), " ")
  760.         If ts = 0 Or ts > 4 Then
  761.           ts = 4
  762.         End If
  763.         tsource$ = Left$(sources_form.source_list.List(headline.Source), ts) + Space$(5 - ts)
  764.         msg$ = tscore$ + tlength$ + tsource$ + Trim$(headline.title)
  765.         title.AddItem msg$
  766.         docno = docno + 1
  767.       End If
  768.     Wend
  769.     search.Value = False
  770.     mousepointer = DEFAULT
  771. End Sub
  772. Sub slip_dial_click ()
  773.     z = Shell("waisdial", 1)
  774.     'dial_form.Show 1
  775.     'Unload dial_form
  776. End Sub
  777. Sub slipdial_bbox_Click ()
  778.     slip_dial_click
  779. End Sub
  780. Function temp_file (type_code As String) As String
  781. Static file_no As Integer
  782.   If file_list(file_no) <> "" Then
  783.     fn$ = temp_path + "\WAIS" + Format$(file_no, "0000") + "." + file_list(file_no)
  784.     Kill fn$
  785.   End If
  786.   file_list(file_no) = type_code
  787.   fn$ = temp_path + "\WAIS" + Format$(file_no, "0000") + "." + type_code
  788.   Name temp_path + "\WAIS.$$$" As fn$
  789.   file_no = file_no + 1
  790.   If file_no = MAX_TEMP_FILES Then
  791.     file_no = 0
  792.   End If
  793.   temp_file = fn$
  794. End Function
  795. Sub test_for_error (stat As Integer, docno As Integer)
  796.         
  797.     Select Case stat
  798.       Case 0
  799.         Exit Sub
  800.       Case 1
  801.         log_status " Found" + Str$(docno + 1) + " references"
  802.       Case 2
  803.         log_status " Server connection failed"
  804.       Case 3
  805.         log_status " Request was too large to handle"
  806.       Case 4
  807.         log_status " Returned message was too large to handle"
  808.       Case 5
  809.         log_status " Server returned diagnostics in response to query"
  810.       Case 6
  811.         log_status " Error 6"
  812.       Case 7
  813.         log_status " Invalid document number was requested"
  814.       Case 8
  815.         log_status " No matching references were found"
  816.       Case Else
  817.         log_status Str$(stat) + " is an unknown error number"
  818.     End Select
  819.     z = DoEvents()
  820. End Sub
  821. Sub title_dblclick ()
  822. Dim docno As Integer
  823. Dim query_type As String
  824. Dim doc_lines As Integer
  825. Dim stat As Integer
  826. Dim rec As String * MAX_TEXT_LENGTH
  827. Dim full_block As String * MAX_SAVE_BLOCK
  828. Dim headline As DOC
  829.   If title.ListIndex < 0 Then
  830.     MsgBox "You must select a document to retrieve", MB_INFO
  831.     Exit Sub
  832.   End If
  833.   doc_selected = NORMAL
  834.   While doc_selected <> NONE
  835.       
  836.     X = DoEvents()
  837.     mousepointer = HOURGLASS
  838.     Select Case doc_selected
  839.           
  840.       Case NORMAL
  841.         docno = title.ListIndex
  842.         log_status " Getting " + Right$(title.List(docno), Len(title.List(docno)) - 17)
  843.         
  844.       Case DOC_NEXT_INORDER
  845.         log_status " Getting next document..."
  846.         stat = get_next_or_prev("WAIS_NEXT", headline)
  847.         test_for_error stat, 0
  848.         If stat Then
  849.           mousepointer = DEFAULT
  850.           Exit Sub
  851.         End If
  852.         docno = CURRDOC
  853.       Case DOC_NEXT_LISTED
  854.         If docno = CURRDOC Then
  855.           docno = title.ListIndex
  856.         End If
  857.         docno = docno + 1
  858.         log_status " Getting " + Right$(title.List(docno), Len(title.List(docno)) - 17)
  859.         title.ListIndex = docno
  860.           
  861.       Case DOC_PREV_INORDER
  862.         log_status " Getting previous document..."
  863.         stat = get_next_or_prev("WAIS_PREV", headline)
  864.         test_for_error stat, 0
  865.         If stat Then
  866.           mousepointer = DEFAULT
  867.           Exit Sub
  868.         End If
  869.         docno = CURRDOC
  870.       Case DOC_PREV_LISTED
  871.         If docno = CURRDOC Then
  872.           docno = title.ListIndex
  873.         End If
  874.         docno = docno - 1
  875.         log_status " Getting " + Right$(title.List(docno), Len(title.List(docno)) - 17)
  876.         title.ListIndex = docno
  877.        
  878.     End Select
  879.             
  880.     If docno = CURRDOC Then
  881.       wk_type$ = headline.type
  882.       viewed_headline = Trim$(headline.title)
  883.     Else
  884.       If docno < 0 Or docno = title.ListCount Then
  885.         mousepointer = DEFAULT
  886.         Exit Sub
  887.       End If
  888.       wk_type$ = title_type(docno)
  889.       viewed_headline = Right$(title.List(docno), Len(title.List(docno)) - 17)
  890.     End If
  891.     viewed_docno = docno
  892.       
  893.     If InStr(wk_type$, ",") Then
  894.       multi_form.Tag = wk_type$
  895.       multi_form.Show 1
  896.       tcode$ = multi_form.Tag
  897.       Unload multi_form
  898.       If tcode$ = "CANCEL" Then
  899.         mousepointer = DEFAULT
  900.         Exit Sub
  901.       End If
  902.     Else
  903.       tcode$ = Left$(wk_type$, InStr(wk_type$, Chr$(0)) - 1)
  904.     End If
  905.       
  906.     stat = get_document(docno, tcode$)
  907.     test_for_error stat, docno
  908.     If stat = 0 Then
  909.       file_dialog.DialogTitle = "WAIS save for type " + tcode$
  910.       If tcode$ = "TEXT" Then
  911.         view_form.Show 1
  912.         Unload view_form
  913.       ElseIf tcode$ = "WSRC" Then
  914.         wsrc_form.Show 1
  915.         Unload wsrc_form
  916.       Else
  917.         doc_selected = NONE
  918.         task_id = 0
  919.         For X = 0 To 9
  920.           If tcode$ = filter_type_code(X) Then
  921.             cmd$ = filter_name(X) + " " + temp_file(filter_ext(X))
  922.             task_id = Shell(cmd$, 1)
  923.             Exit For
  924.           End If
  925.         Next X
  926.         If task_id = 0 Then
  927.           GoSub save_unknown_type
  928.         End If
  929.       End If
  930.     Else
  931.       doc_selected = NONE
  932.     End If
  933.     mousepointer = DEFAULT
  934.   Wend
  935. Exit Sub
  936. save_unknown_type:
  937.     cur_dir$ = CurDir$
  938.     On Error Resume Next
  939.     file_dialog.Action = 2
  940.     Select Case Err
  941.       
  942.       Case 0
  943.         mousepointer = HOURGLASS
  944.         tmp_handle = FreeFile
  945.         Open temp_path + "\WAIS.$$$" For Binary Access Read As tmp_handle Len = 32760
  946.         save_handle = FreeFile
  947.         Open file_dialog.Filename For Output As save_handle
  948.         
  949.         filesize = LOF(tmp_handle)
  950.         While filesize > MAX_SAVE_BLOCK
  951.           Get #tmp_handle, , full_block
  952.           Print #save_handle, full_block;
  953.           filesize = filesize - MAX_SAVE_BLOCK
  954.         Wend
  955.         
  956.         the_rest$ = Space$(filesize)
  957.         Get #tmp_handle, , the_rest$
  958.         Print #save_handle, the_rest$;
  959.         Close (tmp_handle)
  960.         Close (save_handle)
  961.         mousepointer = DEFAULT
  962.       
  963.       Case 32755
  964.         Return
  965.       
  966.       Case Else
  967.         msg$ = "Save failed with code" + Str$(Err) + ", save cancelled."
  968.         MsgBox msg$, MB_WARN
  969.     End Select
  970.     ChDir cur_dir$
  971. Return
  972. End Sub
  973. Sub title_DragDrop (Source As Control, X As Single, Y As Single)
  974.     If Source.Tag = "REF" Then
  975.         del_doc_click
  976.     End If
  977. End Sub
  978. Sub title_KeyPress (KeyAscii As Integer)
  979.     If KeyAscii = 13 Then
  980.         title_dblclick
  981.         KeyAscii = 0
  982.     End If
  983. End Sub
  984. Sub title_MouseDown (Button As Integer, Shift As Integer, X As Single, Y As Single)
  985.     If title.ListIndex > -1 Then
  986.         title.Drag 1
  987.     Else
  988.         title.Drag 0
  989.     End If
  990. End Sub
  991. Sub title_MouseUp (Button As Integer, Shift As Integer, X As Single, Y As Single)
  992.     title.Drag 0
  993. End Sub
  994. Sub using_menu_Click ()
  995.     z = WinHelp(hWnd, "wais.hlp", HELP_INDEX, 0)
  996. End Sub
  997.