From c901722e2151d1d0ed3a2ce530f6eb5010563959 Mon Sep 17 00:00:00 2001 From: Adam Dickmeiss Date: Fri, 2 Jun 1995 14:29:42 +0000 Subject: [PATCH] Work on scan interface - up/down buttons. --- client.tcl | 170 +++++++++++++++++++++++++++++++++++++++++++++++++--------- clientrc.tcl | 4 +- 2 files changed, 148 insertions(+), 26 deletions(-) diff --git a/client.tcl b/client.tcl index 6af6a95..aa95b0a 100644 --- a/client.tcl +++ b/client.tcl @@ -1,6 +1,9 @@ # # $Log: client.tcl,v $ -# Revision 1.26 1995-06-01 16:36:46 adam +# Revision 1.27 1995-06-02 14:29:42 adam +# Work on scan interface - up/down buttons. +# +# Revision 1.26 1995/06/01 16:36:46 adam # About buttons. Minor bug fixes. # # Revision 1.25 1995/05/31 13:09:57 adam @@ -213,12 +216,21 @@ proc show-status {status b sb} { .mid.search configure -state normal .mid.scan configure -state normal .mid.present configure -state normal + if {[winfo exists .scan-window]} { + .scan-window.bot.2 configure -state normal + .scan-window.bot.4 configure -state normal + } set searchEnable 1 } else { .top.search configure -state disabled .mid.search configure -state disabled .mid.scan configure -state disabled .mid.present configure -state disabled + + if {[winfo exists .scan-window]} { + .scan-window.bot.2 configure -state disabled + .scan-window.bot.4 configure -state disabled + } set searchEnable 0 } } @@ -253,8 +265,10 @@ proc about-target {} { label $w.top.ii -text "Implementation id: $i" set i [z39 targetImplementationVersion] label $w.top.iv -text "Implementation version: $i" + set i [z39 options] + label $w.top.op -text "Protocol options: $i" - pack $w.top.in $w.top.ii $w.top.iv -side top -anchor nw + pack $w.top.in $w.top.ii $w.top.iv $w.top.op -side top -anchor nw bottom-buttons $w [list {Close} [list destroy $w]] 1 } @@ -429,6 +443,7 @@ proc open-target {target base} { puts [z39 maximumRecordSize] puts -nonewline "preferredMessageSize=" puts [z39 preferredMessageSize] + show-status {Connecting} 0 0 if {$base == ""} { z39 databaseNames [lindex [lindex $profile($target) 7] 0] } else { @@ -437,7 +452,7 @@ proc open-target {target base} { z39 failback [list fail-response $target] z39 callback [list connect-response $target] z39 connect [lindex $profile($target) 1]:[lindex $profile($target) 2] - show-status {Connecting} 1 0 + show-status {Connecting} 1 {} set hostid $target .top.target.m disable 0 .top.target.m enable 1 @@ -567,54 +582,161 @@ proc search-request {} { show-status {Search} 1 0 } -proc scan-request {} { +proc scan-request {attr} { set w .scan-window global profile global hostid + global scanView set target $hostid + set scanView 0 ir-scan z39.scan z39 - z39 callback {scan-response} + z39 callback [list scan-response $attr 0 25] if {![winfo exists $w]} { toplevel $w wm title $w "Scan" - wm minsize $w 200 200 + wm minsize $w 0 0 top-down-window $w - listbox $w.top.list -yscrollcommand [list $w.top.scroll set] \ - -font fixed -geometry 50x14 - scrollbar $w.top.scroll -orient vertical -border 1 - pack $w.top.list -side left -fill both -expand yes - pack $w.top.scroll -side right -fill y - $w.top.scroll config -command [list $w.top.list yview] - - bottom-buttons $w [list {Close} [list destroy $w]] 0 - } - z39.scan numberOfTermsRequested 100 - z39.scan scan "@attr 1=4 0" + if {1} { + listbox $w.top.list -yscrollcommand [list $w.top.scroll set] \ + -font fixed -geometry 50x14 + scrollbar $w.top.scroll -orient vertical -border 1 + pack $w.top.list -side left -fill both -expand yes + pack $w.top.scroll -side right -fill y + $w.top.scroll config -command [list $w.top.list yview] + } else { + listbox $w.top.list -font fixed -geometry 60x14 + pack $w.top.list -side left -fill both -expand yes + } + + bottom-buttons $w [list {Close} [list destroy $w] \ + {Up} [list scan-up $attr] \ + {Down} [list scan-down $attr]] 0 + bind $w.top.list [list scan-up $attr] + bind $w.top.list [list scan-down $attr] + } + focus $w.top.list + z39.scan numberOfTermsRequested 5 + z39.scan preferredPositionInResponse 1 + z39.scan scan "${attr} b" show-status {Scan} 1 0 } -proc scan-response {} { + +proc scan-response {attr start toget} { + global cancelFlag + set w .scan-window + puts "In scan-response" set m [z39.scan numberOfEntriesReturned] puts $m - for {set i 0} {$i < $m} {incr i} { - set term [lindex [z39.scan scanLine $i] 1] - set nostr [format "%7d" [lindex [z39.scan scanLine $i] 2]] + puts attr=$attr + puts start=$start + puts toget=$toget - $w.top.list insert end "$nostr $term" + if {![winfo exists .scan-window]} { + show-status {Ready} 0 1 + set cancelFlag 0 + return + } + if {$toget < 0} { + for {set i 0} {$i < $m} {incr i} { + set term [lindex [z39.scan scanLine $i] 1] + set nostr [format " %-6d" [lindex [z39.scan scanLine $i] 2]] + $w.top.list insert $i "$nostr $term" + } + } else { + $w.top.list delete $start end + for {set i 0} {$i < $m} {incr i} { + set term [lindex [z39.scan scanLine $i] 1] + set nostr [format " %-6d" [lindex [z39.scan scanLine $i] 2]] + $w.top.list insert end "$nostr $term" + } + } + if {$cancelFlag} { + show-status {Ready} 0 1 + set cancelFlag 0 + return + } + if {$toget > 0 && $m > 1 && $m < $toget} { + set ntoget [expr $toget - $m + 1] + puts ntoget=$ntoget + z39 callback [list scan-response $attr [expr $start + $m - 1] $ntoget] + set q $term + puts "down continue: $q" + if {$ntoget > 10} { + z39.scan numberOfTermsRequested 10 + } else { + z39.scan numberOfTermsRequested $ntoget + } + z39.scan preferredPositionInResponse 1 + z39.scan scan "${attr} \{$q\}" + return + } + if {$toget < 0 && $m > 1 && $m < [expr - $toget]} { + set ntoget [expr - $toget - $m] + puts ntoget=$ntoget + z39 callback [list scan-response $attr 0 -$ntoget] + set q [string range [$w.top.list get 0] 7 end] + puts "up continue: $q" + if {$ntoget > 10} { + z39.scan numberOfTermsRequested 10 + z39.scan preferredPositionInResponse 11 + } else { + z39.scan numberOfTermsRequested $ntoget + z39.scan preferredPositionInResponse [incr ntoget] + } + z39.scan scan "${attr} \{$q\}" + return } show-status {Ready} 0 1 } +proc scan-down {attr} { + global scanView + + set w .scan-window + set scanView [expr $scanView + 5] + set s [$w.top.list size] + if {$scanView > $s} { + z39 callback [list scan-response $attr [expr $s - 1] 30] + set q [string range [$w.top.list get [expr $s - 1]] 7 end] + puts "down: $q" + z39.scan numberOfTermsRequested 10 + z39.scan preferredPositionInResponse 1 + show-status {Scan} 1 0 + z39.scan scan "${attr} \{$q\}" + return + } + $w.top.list yview $scanView +} + +proc scan-up {attr} { + global scanView + + set w .scan-window + if {$scanView < 5} { + z39 callback [list scan-response $attr 0 -30] + set q [string range [$w.top.list get 0] 7 end] + puts "up: $q" + z39.scan numberOfTermsRequested 10 + z39.scan preferredPositionInResponse 11 + show-status {Scan} 1 0 + z39.scan scan "${attr} \{$q\}" + return + } + set scanView [expr $scanView - 5] + $w.top.list yview $scanView +} + proc search-response {} { global setNo global setOffset @@ -1638,8 +1760,8 @@ index-lines .lines 1 $queryButtonsFind [lindex $queryInfo 0] activate-index button .mid.search -width 7 -text {Search} -command search-request \ -state disabled -button .mid.scan -width 7 -text {Scan} -command scan-request \ - -state disabled +button .mid.scan -width 7 -text {Scan} \ + -command [list scan-request "@attr 1=4"] -state disabled button .mid.present -width 7 -text {Present} -command [list present-more 10] \ -state disabled diff --git a/clientrc.tcl b/clientrc.tcl index 6f6265b..e75ae33 100644 --- a/clientrc.tcl +++ b/clientrc.tcl @@ -1,5 +1,5 @@ # Setup file -set hotTargets { dranet RLG ztest LOC Penn DANBIB Aleph CARL OCLC IREG Innovative CNIDR CLSI AULS Nsrtest } +set hotTargets { ztest dranet RLG LOC Penn DANBIB Aleph CARL OCLC IREG Innovative CNIDR CLSI AULS Nsrtest } set profile(CNIDR) {CNIDR Kudzu.cnidr.org 5556 {} 16384 8192 tcpip {Book ERIC} 1 {} {} z39v2} set profile(Penn) {{Penn State's Library} 128.118.88.200 210 {} 16384 8192 tcpip CATALOG 1 {} {} z39v2} set profile(ztest) {{test server} localhost 9999 {} 16384 4096 tcpip dummy 1 {} {} z39v2} @@ -12,8 +12,8 @@ set profile(DANBIB) {{SR Target DANBIB} 0103/find2.denet.dk 4500 {} 8192 8192 mo set profile(OCLC) {OCLC rdsd-rs6000.dev.oclc.org 211 {} 16384 8192 tcpip OLUC 1 {} {} z39v2} set profile(Aleph) {{Aleph at ram10.aleph.co.il:5555} localhost 9998 {} 16384 4096 tcpip {dem mar} 1 0 1 z39v2} set profile(CARL) {{CARL systems} Z39.50.carl.org 210 {} 16384 8192 tcpip {ACC AIC AUR BEM CUB DPL DNU EPL FRC LAW LCC MCC MIN MPL NJC NWC OCC PPC PUE RDR RGU SPL TCC TKU UNC WYO} 1 {} {} z39v2} -set profile(CLSI) {CLSI inet-gw.clsi.uc.geac.com 210 {} 16384 8192 tcpip Cl 1 {} {} z39v2} set profile(Innovative) {{Innovatives server: demo.iii.com} demo.iii.com 210 {} 16384 8192 tcpip DEFAULT 1 {} {} z39v2} +set profile(CLSI) {CLSI inet-gw.clsi.uc.geac.com 210 {} 16384 8192 tcpip Cl 1 {} {} z39v2} set profile(AULS) {{Acadia university} auls.acadiau.ca 210 {} 16384 8192 tcpip AULS 1 {} {} z39v2} set profile(dranet) {dranet dranet.dra.com 210 {} 16384 16384 tcpip drewdb 1 {} {} z39v2} set queryTypes {Simple} -- 1.7.10.4