3 # Revision 1.33 1995-06-09 11:17:35 adam
4 # Start work on geometry management.
6 # Revision 1.32 1995/06/07 09:16:37 adam
7 # New presentation format.
9 # Revision 1.31 1995/06/06 16:31:09 adam
10 # Bug fix: target names couldn't contain blanks.
13 # Revision 1.30 1995/06/06 11:35:41 adam
14 # Work on scan. Display of old sets.
16 # Revision 1.29 1995/06/05 14:11:18 adam
17 # Bug fix in present-more.
19 # Revision 1.28 1995/06/02 14:52:13 adam
20 # Minor changes really.
22 # Revision 1.27 1995/06/02 14:29:42 adam
23 # Work on scan interface - up/down buttons.
25 # Revision 1.26 1995/06/01 16:36:46 adam
26 # About buttons. Minor bug fixes.
28 # Revision 1.25 1995/05/31 13:09:57 adam
29 # Client searches/presents may be interrupted.
30 # New moving book-logo.
32 # Revision 1.24 1995/05/31 08:36:24 adam
33 # Bug fix in client.tcl: didn't save options on clientrc.tcl.
34 # New method: referenceId. More work on scan.
36 # Revision 1.23 1995/05/29 10:33:41 adam
37 # README and rename of startup script.
39 # Revision 1.22 1995/05/26 11:44:09 adam
40 # Bugs fixed. More work on MARC utilities and queries. Test
41 # client is up-to-date again.
43 # Revision 1.21 1995/05/11 15:34:46 adam
44 # Scan request changed a bit. This version works with RLG.
46 # Revision 1.20 1995/04/21 16:31:57 adam
47 # New radiobutton: protocol (z39v2/SR).
49 # Revision 1.19 1995/04/18 16:11:50 adam
50 # First version of graphical Scan. Some work on query-by-form.
52 # Revision 1.18 1995/04/10 10:50:22 adam
53 # Result-set name defaults to suffix of ir-set name.
54 # Started working on scan. Not finished at this point.
56 # Revision 1.17 1995/03/31 09:34:57 adam
57 # Search-button disabled when there is no connection.
59 # Revision 1.16 1995/03/31 08:56:36 adam
60 # New button "Search".
62 # Revision 1.15 1995/03/28 12:45:22 adam
63 # New ir method failback: called on disconnect/protocol error.
64 # New ir set/get method: protocol: SR / Z3950.
65 # Simple popup and disconnect when failback is invoked.
67 # Revision 1.14 1995/03/22 16:07:55 adam
70 # Revision 1.13 1995/03/21 17:27:26 adam
71 # Short-hand keys in setup.
73 # Revision 1.12 1995/03/21 13:41:03 adam
74 # Comstack cs_create not used too often. Non-blocking connect.
76 # Revision 1.11 1995/03/21 10:39:06 adam
77 # Diagnostic error message displayed with tkerror.
79 # Revision 1.10 1995/03/20 15:24:06 adam
80 # Diagnostic records saved on searchResponse.
82 # Revision 1.9 1995/03/17 18:26:16 adam
83 # Non-blocking i/o used now. Database names popup as cascade items.
85 # Revision 1.8 1995/03/17 15:45:00 adam
86 # Improved target/database setup.
88 # Revision 1.7 1995/03/16 17:54:03 adam
89 # Minor changes really.
91 # Revision 1.6 1995/03/15 19:10:20 adam
92 # Database setup in protocol-setup (rather target setup).
94 # Revision 1.5 1995/03/15 13:59:23 adam
97 # Revision 1.4 1995/03/14 17:32:29 adam
98 # Presentation of full Marc record in popup window.
100 # Revision 1.3 1995/03/12 19:31:52 adam
101 # Pattern matching implemented when retrieving MARC records. More
102 # diagnostic functions.
104 # Revision 1.2 1995/03/10 18:00:15 adam
105 # Actual presentation in line-by-line format. RPN query support.
107 # Revision 1.1 1995/03/09 16:15:07 adam
108 # First presentRequest attempts. Hot-target list.
115 set profile(Default) {{} {} {210} {} 16384 8192 tcpip {} 1 {} {} z39v2}
117 set settingsChanged 0
122 set displayFormat nice
124 set queryTypes {Simple}
125 set queryButtons { { {I 0} {I 1} {I 2} } }
126 set queryInfo { { {Title {1=4}} {Author {1=1}} \
127 {Subject {1=21}} {Any {1=1016}} } }
129 set windowGeometry(.scan-window) {}
132 global windowGeometry
133 set windowGeometry($w) [wm geometry $w]
138 global windowGeometry
141 if {[info exists windowGeometry($w)]} {
142 set g $windowGeometry($w)
151 if {[file readable "clientrc.tcl"]} {
152 source "clientrc.tcl"
155 set queryButtonsFind [lindex $queryButtons 0]
156 set queryInfoFind [lindex $queryInfo 0]
158 proc top-down-window {w} {
159 frame $w.top -relief raised -border 1
160 frame $w.bot -relief raised -border 1
162 pack $w.top -side top -fill both -expand yes
163 pack $w.bot -fill both
166 proc top-down-ok-cancel {w ok-action g} {
167 frame $w.bot.left -relief sunken -border 1
168 pack $w.bot.left -side left -expand yes -ipadx 2 -ipady 2 -padx 5 -pady 5
169 button $w.bot.left.ok -width 6 -text {Ok} \
170 -command ${ok-action}
171 pack $w.bot.left.ok -expand yes -ipadx 2 -ipady 2 -padx 3 -pady 3
172 button $w.bot.cancel -width 6 -text {Cancel} \
173 -command [list destroy $w]
174 pack $w.bot.cancel -side left -expand yes
182 proc bottom-buttons {w buttonList g} {
184 set l [llength $buttonList]
186 frame $w.bot.$i -relief sunken -border 1
187 pack $w.bot.$i -side left -expand yes -padx 5 -pady 5
188 button $w.bot.$i.ok -text [lindex $buttonList $i] \
189 -command [lindex $buttonList [expr $i+1]]
190 pack $w.bot.$i.ok -expand yes -ipadx 2 -ipady 2 -padx 3 -pady 3 -side left
194 button $w.bot.$i -text [lindex $buttonList $i] \
195 -command [lindex $buttonList [expr $i+1]]
196 pack $w.bot.$i -expand yes -ipadx 2 -ipady 2 -padx 3 -pady 3 -side left
206 proc cancel-operation {} {
212 show-status Cancelled 0 {}
216 proc show-target {target} {
217 .bot.a.target configure -text "$target"
220 proc show-logo {v1} {
227 .bot.logo configure -bitmap @book${v1}
228 after 140 [list show-logo $v1]
232 .bot.logo configure -bitmap @book1
241 proc show-status {status b sb} {
245 .bot.a.status configure -text "$status"
247 if {$busy == 0} {set busy 1}
255 .top.service configure -state normal
256 .mid.search configure -state normal
257 .mid.scan configure -state normal
258 .mid.present configure -state normal
259 if {[winfo exists .scan-window]} {
260 .scan-window.bot.2 configure -state normal
261 .scan-window.bot.4 configure -state normal
265 .top.service configure -state disabled
266 .mid.search configure -state disabled
267 .mid.scan configure -state disabled
268 .mid.present configure -state disabled
270 if {[winfo exists .scan-window]} {
271 .scan-window.bot.2 configure -state disabled
272 .scan-window.bot.4 configure -state disabled
278 proc show-message {msg} {
279 .bot.a.message configure -text "$msg"
282 proc insertWithTags {w text args} {
283 set start [$w index insert]
284 $w insert insert $text
285 foreach tag [$w tag names $start] {
286 $w tag remove $tag $start insert
289 $w tag add $i $start insert
293 proc about-target {} {
294 set w .about-target-w
298 wm title $w "About target"
301 set i [z39 targetImplementationName]
302 label $w.top.in -text "Implementation name: $i"
303 set i [z39 targetImplementationId]
304 label $w.top.ii -text "Implementation id: $i"
305 set i [z39 targetImplementationVersion]
306 label $w.top.iv -text "Implementation version: $i"
308 label $w.top.op -text "Protocol options: $i"
310 pack $w.top.in $w.top.ii $w.top.iv $w.top.op -side top -anchor nw
312 bottom-buttons $w [list {Close} [list destroyG $w]] 1
315 proc about-origin {} {
316 set w .about-origin-w
320 wm title $w "About IrTcl"
324 set i [z39 implementationName]
325 label $w.top.in -text "Implementation name: $i"
326 set i [z39 implementationId]
327 label $w.top.ii -text "Implementation id: $i"
329 pack $w.top.in $w.top.ii -side top -anchor nw
331 bottom-buttons $w [list {Close} [list destroyG $w]] 1
334 proc display-raw {sno no w} {
336 set r [z39.$sno getMarc $no list * * *]
338 set tag [lindex $line 0]
339 set indicator [lindex $line 1]
340 set fields [lindex $line 2]
342 if {$indicator != ""} {
343 insertWithTags $w "$tag $indicator" marc-tag
345 insertWithTags $w "$tag " marc-tag
347 foreach field $fields {
348 set id [lindex $field 0]
349 set data [lindex $field 1]
351 insertWithTags $w " $id " marc-id
353 set start [$w index insert]
354 insertWithTags $w $data {}
360 proc display-nice {sno no w} {
362 set i [z39.$sno getMarc $no field 245 * a]
365 insertWithTags $w "Title: " marc-tag
366 insertWithTags $w $i marc-data
367 set i [z39.$sno getMarc $no field 245 * b]
369 insertWithTags $w [lindex $i 0] marc-data
373 set i [z39.$sno getMarc $no field 700 * a]
375 set i [z39.$sno getMarc $no field 100 * a]
378 if {[llength $i] > 1} {
379 insertWithTags $w "Authors: " marc-tag
381 insertWithTags $w "Author: " marc-tag
384 insertWithTags $w $x marc-data
388 set i [z39.$sno getMarc $no field 110 * *]
390 insertWithTags $w "Co-Author: " marc-tag
392 insertWithTags $w $x marc-data
397 set i [z39.$sno getMarc $no field 650 * *]
400 insertWithTags $w "Keywords: " marc-tag
405 insertWithTags $w $x marc-data
410 set i [concat [z39.$sno getMarc $no field 260 * a] \
411 [z39.$sno getMarc $no field 260 * b]]
413 insertWithTags $w "Publisher: " marc-tag
415 insertWithTags $w $x marc-data
419 set i [z39.$sno getMarc $no field 020 * a]
421 insertWithTags $w "ISBN: " marc-tag
423 insertWithTags $w $x marc-data
427 set i [z39.$sno getMarc $no field 022 * a]
429 insertWithTags $w "ISSN: " marc-tag
431 insertWithTags $w $x marc-data
435 set i [z39.$sno getMarc $no field 030 * a]
437 insertWithTags $w "CODEN: " marc-tag
439 insertWithTags $w $x marc-data
443 set i [z39.$sno getMarc $no field 015 * a]
445 insertWithTags $w "Ctl number: " marc-tag
447 insertWithTags $w $x marc-data
451 set i [z39.$sno getMarc $no field 010 * a]
453 insertWithTags $w "LC number: " marc-tag
455 insertWithTags $w $x marc-data
461 proc show-full-marc {sno no b} {
465 if {[z39.$sno type $no] != "DB"} {
469 set w .full-marc-$fullMarcSeq
474 if {[winfo exists $w]} {
486 frame $w.top -relief raised -border 1
487 frame $w.bot -relief raised -border 1
489 pack $w.top -side top -fill both -expand yes
490 pack $w.bot -fill both
492 text $w.top.record -width 60 -height 12 -wrap word \
493 -yscrollcommand [list $w.top.s set]
494 scrollbar $w.top.s -command [list $w.top.record yview]
498 $w.top.record tag configure marc-tag -foreground blue
499 $w.top.record tag configure marc-data -foreground black
500 $w.top.record tag configure marc-id -foreground red
502 if {$displayFormat == "nice"} {
503 display-nice $sno $no $w.top.record
505 display-raw $sno $no $w.top.record
508 bind $w.top.record <Return> {destroy .full-marc}
510 pack $w.top.s -side right -fill y
511 pack $w.top.record -expand yes -fill both
513 bottom-buttons $w [list \
514 {Close} [list destroy $w] \
515 {Raw} [list display-raw $sno $no $w.top.record] \
516 {Duplicate} [list show-full-marc $sno $no 1]] 0
518 $w.bot.2 configure -command [list display-raw $sno $no $w.top.record]
519 $w.bot.4 configure -command [list show-full-marc $sno $no 1]
523 proc update-target-hotlist {target} {
526 set len [llength $hotTargets]
528 .top.target.m delete 6 [expr 6+[llength $hotTargets]]
530 set indx [lsearch $hotTargets $target]
532 set hotTargets [lreplace $hotTargets $indx $indx]
534 set hotTargets [linsert $hotTargets 0 $target]
538 proc set-target-hotlist {} {
542 foreach target $hotTargets {
543 .top.target.m add command -label "$i $target" -command \
544 [list reopen-target $target {}]
552 proc reopen-target {target base} {
554 open-target $target $base
555 update-target-hotlist $target
558 proc define-target-action {} {
561 set target [.target-define.top.target.entry get]
565 update-target-hotlist $target
566 foreach n [array names profile] {
572 set seq [lindex $profile(Default) 12]
574 set profile($target) $profile(Default)
575 set profile(Default) [lreplace $profile(Default) 12 12 [incr seq]]
577 protocol-setup $target
578 destroy .target-define
581 proc fail-response {target} {
583 tkerror "Target connection closed or protocol error"
586 proc connect-response {target} {
587 puts "connect-response"
592 proc open-target {target base} {
597 z39 comstack [lindex $profile($target) 6]
598 z39 idAuthentication [lindex $profile($target) 3]
599 z39 maximumRecordSize [lindex $profile($target) 4]
600 z39 preferredMessageSize [lindex $profile($target) 5]
601 puts -nonewline "maximumRecordSize="
602 puts [z39 maximumRecordSize]
603 puts -nonewline "preferredMessageSize="
604 puts [z39 preferredMessageSize]
605 show-status {Connecting} 0 0
607 z39 databaseNames [lindex [lindex $profile($target) 7] 0]
609 z39 databaseNames $base
611 z39 failback [list fail-response $target]
612 z39 callback [list connect-response $target]
613 z39 connect [lindex $profile($target) 1]:[lindex $profile($target) 2]
614 # z39 options search present scan namedResultSets triggerResourceCtrl
615 show-status {Connecting} 1 {}
617 .top.target.m disable 0
618 .top.target.m enable 1
619 .top.target.m enable 2
622 proc close-target {} {
630 show-status {Not connected} 0 0
632 .top.target.m disable 1
633 .top.target.m disable 2
634 .top.target.m enable 0
637 proc load-set-action {} {
641 ir-set z39.$setNo z39
643 set fname [.load-set.top.filename.entry get]
646 show-status {Loading} 1 {}
647 z39.$setNo loadFile $fname
649 set no [z39.$setNo numberOfRecordsReturned]
650 add-title-lines $setNo $no 1
652 set l [format "%-4d %7d" $setNo $no]
653 .top.rset.m add command -label $l \
654 -command [list add-title-lines $setNo 10000 1]
655 show-status {Ready} 0 {}
668 frame $w.top.filename
670 pack $w.top.filename -side top -anchor e -pady 2
672 entry-fields $w.top {filename} \
674 {load-set-action} {destroy .load-set}
676 top-down-ok-cancel $w {load-set-action} 1
680 proc init-request {} {
688 z39 callback {init-response}
689 show-status {Initializing} 1 {}
693 proc init-response {} {
700 show-status {Ready} 0 1
701 if {![z39 initResult]} {
702 set u [z39 userInformationField]
704 tkerror "Connection rejected by target: $u"
708 proc search-request {} {
718 if {$searchEnable == 0} {
721 set query [index-query]
726 ir-set z39.$setNo z39
728 if {[lindex $profile($target) 10] == 1} {
729 z39.$setNo setName $setNo
730 puts "setName=${setNo}"
732 z39.$setNo setName Default
733 puts "setName=Default"
735 if {[lindex $profile($target) 8] == 1} {
736 z39.$setNo queryType rpn
738 if {[lindex $profile($target) 9] == 1} {
739 z39.$setNo queryType ccl
741 z39 callback {search-response}
742 z39.$setNo search $query
743 show-status {Search} 1 0
746 proc scan-request {attr} {
760 if {![winfo exists $w]} {
769 entry $w.top.entry -relief sunken
770 pack $w.top.entry -fill x -padx 4 -pady 2
771 bind $w.top.entry <KeyRelease> [list scan-term-h $attr]
773 listbox $w.top.list -yscrollcommand [list $w.top.scroll set] \
774 -font fixed -geometry 50x14
775 scrollbar $w.top.scroll -orient vertical -border 1
776 pack $w.top.list -side left -fill both -expand yes
777 pack $w.top.scroll -side right -fill y
778 $w.top.scroll config -command [list $w.top.list yview]
780 listbox $w.top.list -font fixed -geometry 60x14
781 pack $w.top.list -side left -fill both -expand yes
784 bottom-buttons $w [list {Close} [list destroyG $w] \
785 {Up} [list scan-up $attr] \
786 {Down} [list scan-down $attr]] 0
787 bind $w.top.list <Up> [list scan-up $attr]
788 bind $w.top.list <Down> [list scan-down $attr]
791 z39 callback [list scan-response $attr 0 35]
792 z39.scan numberOfTermsRequested 5
793 z39.scan preferredPositionInResponse 1
794 z39.scan scan "${attr} 0"
796 show-status {Scan} 1 0
799 proc scan-term-h {attr} {
807 set nScanTerm [$w.top.entry get]
808 if {$nScanTerm == $scanTerm} {
811 set scanTerm $nScanTerm
812 z39 callback [list scan-response $attr 0 35]
813 z39.scan numberOfTermsRequested 5
814 z39.scan preferredPositionInResponse 1
815 puts "${attr} \{${scanTerm}\}"
816 if {$scanTerm == ""} {
817 z39.scan scan "${attr} 0"
819 z39.scan scan "${attr} \{${scanTerm}\}"
821 show-status {Scan} 1 0
824 proc scan-response {attr start toget} {
830 puts "In scan-response"
831 set m [z39.scan numberOfEntriesReturned]
837 if {![winfo exists .scan-window]} {
838 show-status {Ready} 0 1
842 set nScanTerm [$w.top.entry get]
843 if {$nScanTerm != $scanTerm} {
844 z39 callback [list scan-response $attr 0 35]
845 z39.scan numberOfTermsRequested 5
846 z39.scan preferredPositionInResponse 1
847 set scanTerm $nScanTerm
848 puts "${attr} \{${scanTerm}\}"
849 if {$scanTerm == ""} {
850 z39.scan scan "${attr} 0"
852 z39.scan scan "${attr} \{${scanTerm}\}"
854 show-status {Scan} 1 0
857 set status [z39.scan scanStatus]
860 show-status {Ready} 0 1
865 for {set i 0} {$i < $m} {incr i} {
866 set term [lindex [z39.scan scanLine $i] 1]
867 set nostr [format " %-6d" [lindex [z39.scan scanLine $i] 2]]
868 $w.top.list insert $i "$nostr $term"
871 $w.top.list yview $scanView
873 $w.top.list delete $start end
874 for {set i 0} {$i < $m} {incr i} {
875 set term [lindex [z39.scan scanLine $i] 1]
876 set nostr [format " %-6d" [lindex [z39.scan scanLine $i] 2]]
877 $w.top.list insert end "$nostr $term"
881 show-status {Ready} 0 1
885 if {$toget > 0 && $m > 1 && $m < $toget} {
886 set ntoget [expr $toget - $m + 1]
888 z39 callback [list scan-response $attr [expr $start + $m - 1] $ntoget]
890 puts "down continue: $q"
892 z39.scan numberOfTermsRequested 10
894 z39.scan numberOfTermsRequested $ntoget
896 z39.scan preferredPositionInResponse 1
897 puts "${attr} \{$q\}"
898 z39.scan scan "${attr} \{$q\}"
901 if {$toget < 0 && $m > 1 && $m < [expr - $toget]} {
902 set ntoget [expr - $toget - $m]
904 z39 callback [list scan-response $attr 0 -$ntoget]
905 set q [string range [$w.top.list get 0] 8 end]
906 puts "up continue: $q"
908 z39.scan numberOfTermsRequested 10
909 z39.scan preferredPositionInResponse 11
911 z39.scan numberOfTermsRequested $ntoget
912 z39.scan preferredPositionInResponse [incr ntoget]
914 puts "${attr} \{$q\}"
915 z39.scan scan "${attr} \{$q\}"
918 show-status {Ready} 0 1
921 proc scan-down {attr} {
925 set scanView [expr $scanView + 5]
926 set s [$w.top.list size]
927 if {$scanView > $s} {
928 z39 callback [list scan-response $attr [expr $s - 1] 25]
929 set q [string range [$w.top.list get [expr $s - 1]] 8 end]
931 z39.scan numberOfTermsRequested 10
932 z39.scan preferredPositionInResponse 1
933 show-status {Scan} 1 0
934 puts "${attr} \{$q\}"
935 z39.scan scan "${attr} \{$q\}"
938 $w.top.list yview $scanView
941 proc scan-up {attr} {
945 set scanView [expr $scanView - 5]
947 z39 callback [list scan-response $attr 0 -25]
948 set q [string range [$w.top.list get 0] 8 end]
950 z39.scan numberOfTermsRequested 10
951 z39.scan preferredPositionInResponse 11
952 show-status {Scan} 1 0
953 z39.scan scan "${attr} \{$q\}"
956 $w.top.list yview $scanView
959 proc search-response {} {
966 puts "In search-response"
968 show-status {Ready} 0 1
969 set setMax [z39.$setNo resultCount]
970 show-message "${setMax} hits"
971 set l [format "%-4d %7d" $setNo $setMax]
972 .top.rset.m add command -label $l \
973 -command [list add-title-lines $setNo 10000 1]
975 set status [z39.$setNo responseStatus]
976 if {[lindex $status 0] == "NSD"} {
977 set code [lindex $status 1]
978 set msg [lindex $status 2]
979 set addinfo [lindex $status 3]
980 tkerror "NSD$code: $msg: $addinfo"
992 z39 callback {present-response}
993 z39.$setNo present $setOffset 1
994 show-status {Retrieve} 1 0
997 proc present-more {number} {
1002 puts "setOffset=$setOffset"
1008 set max [z39.$setNo resultCount]
1009 if {$max <= $setOffset} {
1011 puts "setOffset=$setOffset"
1014 if {$number == ""} {
1018 if {$setMax > $max} {
1022 z39 callback {present-response}
1024 set toGet [expr $setMax - $setOffset + 1]
1031 z39.$setNo present $setOffset $toGet
1032 show-status {Retrieve} 1 0
1035 proc init-title-lines {} {
1036 .data.list delete 0 end
1039 proc title-press {y setno} {
1040 show-full-marc $setno [expr 1 + [.data.list nearest $y]] 0
1043 proc add-title-lines {setno no offset} {
1045 .bot.a.set configure -text $setno
1046 .data.list delete 0 end
1048 bind .data.list <Double-Button-1> [list title-press %y $setno]
1049 bind .data.list <Button-2> [list title-press %y $setno]
1050 for {set i 0} {$i < $no} {incr i} {
1051 set o [expr $i + $offset]
1052 set type [z39.$setno type $o]
1053 if {$type == "DB"} {
1054 set title [lindex [z39.$setno getMarc $o field 245 * a] 0]
1055 set year [lindex [z39.$setno getMarc $o field 260 * c] 0]
1056 set nostr [format "%5d" $o]
1057 .data.list insert end "$nostr $title - $year"
1058 } elseif {$type == "SD"} {
1059 set err [lindex [z39.$setno diag $o] 1]
1060 set add [lindex [z39.$setno diag $o] 2]
1064 .data.list insert end "Error ${err}${add}"
1065 } elseif {$type == ""} {
1071 proc present-response {} {
1077 puts "In present-response"
1078 set no [z39.$setNo numberOfRecordsReturned]
1079 puts "Returned $no records, setOffset $setOffset"
1080 add-title-lines $setNo $no $setOffset
1081 set setOffset [expr $setOffset + $no]
1082 set status [z39.$setNo responseStatus]
1083 if {[lindex $status 0] == "NSD"} {
1084 show-status {Ready} 0 1
1085 set code [lindex $status 1]
1086 set msg [lindex $status 2]
1087 set addinfo [lindex $status 3]
1088 tkerror "NSD$code: $msg: $addinfo"
1092 show-status {Ready} 0 1
1096 if {$no > 0 && $setOffset <= $setMax} {
1097 puts "present from ${setOffset}"
1098 set toGet [expr $setMax - $setOffset + 1]
1102 z39.$setNo present $setOffset $toGet
1104 show-status {Finished} 0 1
1108 proc left-cursor {w} {
1109 set i [$w index insert]
1116 proc right-cursor {w} {
1117 set i [$w index insert]
1122 proc bind-fields {list returnAction escapeAction} {
1123 set max [expr [llength $list]-1]
1124 for {set i 0} {$i < $max} {incr i} {
1125 bind [lindex $list $i] <Return> $returnAction
1126 bind [lindex $list $i] <Escape> $escapeAction
1127 bind [lindex $list $i] <Tab> [list focus [lindex $list [expr $i+1]]]
1128 bind [lindex $list $i] <Left> [list left-cursor [lindex $list $i]]
1129 bind [lindex $list $i] <Right> [list right-cursor [lindex $list $i]]
1131 bind [lindex $list $i] <Return> $returnAction
1132 bind [lindex $list $i] <Escape> $escapeAction
1133 bind [lindex $list $i] <Tab> [list focus [lindex $list 0]]
1134 bind [lindex $list $i] <Left> [list left-cursor [lindex $list $i]]
1135 bind [lindex $list $i] <Right> [list right-cursor [lindex $list $i]]
1136 focus [lindex $list 0]
1139 proc entry-fields {parent list tlist returnAction escapeAction} {
1142 foreach field $list {
1143 set label ${parent}.${field}.label
1144 set entry ${parent}.${field}.entry
1145 label $label -text [lindex $tlist $i] -anchor e
1146 entry $entry -width 32 -relief sunken
1147 pack $label -side left
1148 pack $entry -side right
1149 lappend alist $entry
1152 bind-fields $alist $returnAction $escapeAction
1155 proc define-target-dialog {} {
1156 set w .target-define
1162 pack $w.top.target \
1163 -side top -anchor e -pady 2
1164 entry-fields $w.top {target} \
1166 {define-target-action} {destroy .target-define}
1167 top-down-ok-cancel $w {define-target-action} 1
1170 proc protocol-setup-action {target} {
1173 global protocolRadioType
1174 global settingsChanged
1177 global ResultSetCheck
1179 set wno [lindex $profile($target) 12]
1183 set settingsChanged 1
1184 set len [$w.top.databases.list size]
1185 for {set i 0} {$i < $len} {incr i} {
1186 lappend b [$w.top.databases.list get $i]
1188 set profile($target) [list [$w.top.description.entry get] \
1189 [$w.top.host.entry get] \
1190 [$w.top.port.entry get] \
1191 [$w.top.idAuthentication.entry get] \
1192 [$w.top.maximumRecordSize.entry get] \
1193 [$w.top.preferredMessageSize.entry get] \
1199 $protocolRadioType \
1203 puts $profile($target)
1207 proc place-force {window parent} {
1208 set g [wm geometry $parent]
1210 set p1 [string first + $g]
1211 set p2 [string last + $g]
1213 set x [expr 40+[string range $g [expr $p1 +1] [expr $p2 -1]]]
1214 set y [expr 60+[string range $g [expr $p2 +1] end]]
1215 wm geometry $window +${x}+${y}
1218 proc add-database-action {target} {
1221 set wno [lindex $profile($target) 12]
1224 $w.top.databases.list insert end \
1225 [.database-select.top.database.entry get]
1226 destroy .database-select
1229 proc add-database {target} {
1232 set w .database-select
1234 set oldFocus [focus]
1237 set wno [lindex $profile($target) 12]
1238 place-force $w .setup-${wno}
1242 frame $w.top.database
1244 pack $w.top.database -side top -anchor e -pady 2
1246 entry-fields $w.top {database} \
1247 {{Database to add:}} \
1248 [list add-database-action $target] {destroy .database-select}
1250 top-down-ok-cancel $w [list add-database-action $target] 1
1254 proc delete-database {target} {
1257 set wno [lindex $profile($target) 12]
1260 foreach i [lsort -decreasing \
1261 [$w.top.databases.list curselection]] {
1262 $w.top.databases.list delete $i
1266 proc protocol-setup {target} {
1269 global protocolRadioType
1272 global ResultSetCheck
1274 set wno [lindex $profile($target) 12]
1279 wm title $w "Setup $target"
1283 if {$target == ""} {
1287 puts $profile($target)
1291 frame $w.top.description
1292 frame $w.top.idAuthentication
1293 frame $w.top.maximumRecordSize
1294 frame $w.top.preferredMessageSize
1295 frame $w.top.cs-type -relief ridge -border 2
1296 frame $w.top.protocol -relief ridge -border 2
1297 frame $w.top.query -relief ridge -border 2
1298 frame $w.top.databases -relief ridge -border 2
1300 # Maximum/preferred/idAuth ...
1301 pack $w.top.description $w.top.host $w.top.port \
1302 $w.top.idAuthentication $w.top.maximumRecordSize \
1303 $w.top.preferredMessageSize -side top -anchor e -pady 2
1305 entry-fields $w.top {description host port idAuthentication \
1306 maximumRecordSize preferredMessageSize} \
1307 {{Description:} {Host:} {Port:} {Id Authentication:} \
1308 {Maximum Record Size:} {Preferred Message Size:}} \
1309 [list protocol-setup-action $target] [list destroyG $w]
1311 foreach sub {description host port idAuthentication \
1312 maximumRecordSize preferredMessageSize} {
1314 bind $w.top.$sub.entry <Control-a> [list add-database $target]
1315 bind $w.top.$sub.entry <Control-d> [list delete-database $target]
1317 $w.top.description.entry insert 0 [lindex $profile($target) 0]
1318 $w.top.host.entry insert 0 [lindex $profile($target) 1]
1319 $w.top.port.entry insert 0 [lindex $profile($target) 2]
1320 $w.top.idAuthentication.entry insert 0 [lindex $profile($target) 3]
1321 $w.top.maximumRecordSize.entry insert 0 [lindex $profile($target) 4]
1322 $w.top.preferredMessageSize.entry insert 0 [lindex $profile($target) 5]
1323 set csRadioType [lindex $profile($target) 6]
1324 set RPNCheck [lindex $profile($target) 8]
1325 set CCLCheck [lindex $profile($target) 9]
1326 set ResultSetCheck [lindex $profile($target) 10]
1327 set protocolRadioType [lindex $profile($target) 11]
1328 if {$protocolRadioType == ""} {
1329 set protocolRadioType z39v2
1333 pack $w.top.databases -side left -pady 6 -padx 6 -expand yes -fill both
1335 label $w.top.databases.label -text "Databases"
1336 button $w.top.databases.add -text "Add" \
1337 -command [list add-database $target]
1338 button $w.top.databases.delete -text "Delete" \
1339 -command [list delete-database $target]
1340 listbox $w.top.databases.list -geometry 20x6 \
1341 -yscrollcommand "$w.top.databases.scroll set"
1342 scrollbar $w.top.databases.scroll -orient vertical -border 1
1343 pack $w.top.databases.label -side top -fill x \
1345 pack $w.top.databases.add $w.top.databases.delete -side top -fill x \
1347 pack $w.top.databases.list -side left -fill both -expand yes \
1349 pack $w.top.databases.scroll -side right -fill y \
1351 $w.top.databases.scroll config -command "$w.top.databases.list yview"
1353 foreach b [lindex $profile($target) 7] {
1354 $w.top.databases.list insert end $b
1358 pack $w.top.cs-type -pady 6 -padx 6 -side top -fill x
1360 label $w.top.cs-type.label -text "Transport"
1361 radiobutton $w.top.cs-type.tcpip -text "TCP/IP" -anchor w \
1362 -command {puts tcp/ip} -variable csRadioType -value tcpip
1363 radiobutton $w.top.cs-type.mosi -text "MOSI" -anchor w\
1364 -command {puts mosi} -variable csRadioType -value mosi
1366 pack $w.top.cs-type.label $w.top.cs-type.tcpip $w.top.cs-type.mosi \
1367 -padx 4 -side top -fill x
1370 pack $w.top.protocol -pady 6 -padx 6 -side top -fill x
1372 label $w.top.protocol.label -text "Protocol"
1373 radiobutton $w.top.protocol.z39v2 -text "Z39.50" -anchor w \
1374 -command {puts z39v2} -variable protocolRadioType -value z39v2
1375 radiobutton $w.top.protocol.sr -text "SR" -anchor w \
1376 -command {puts sr} -variable protocolRadioType -value sr
1378 pack $w.top.protocol.label $w.top.protocol.z39v2 $w.top.protocol.sr \
1379 -padx 4 -side top -fill x
1382 pack $w.top.query -pady 6 -padx 6 -side top -fill x
1384 label $w.top.query.label -text "Query support"
1385 checkbutton $w.top.query.c1 -text "RPN query" -anchor w -variable RPNCheck
1386 checkbutton $w.top.query.c2 -text "CCL query" -anchor w -variable CCLCheck
1387 checkbutton $w.top.query.c3 -text "Result sets" -anchor w -variable ResultSetCheck
1389 pack $w.top.query.label -side top
1390 pack $w.top.query.c1 $w.top.query.c2 $w.top.query.c3 \
1391 -padx 4 -side top -fill x
1394 bottom-buttons $w [list {Ok} [list protocol-setup-action $target] \
1395 {Cancel} [list destroyG $w]] 0
1396 # top-down-ok-cancel $w [list protocol-setup-action $target] 0
1399 proc database-select-action {} {
1400 set w .database-select.top
1402 foreach indx [$w.databases.list curselection] {
1403 lappend b [$w.databases.list get $indx]
1406 z39 databaseNames $b
1408 destroy .database-select
1411 proc database-select {} {
1412 set w .database-select
1422 frame $w.top.databases -relief ridge -border 2
1424 pack $w.top.databases -side left -pady 6 -padx 6 -expand yes -fill x
1426 label $w.top.databases.label -text "List"
1427 listbox $w.top.databases.list -geometry 20x6 \
1428 -yscrollcommand "$w.top.databases.scroll set"
1429 scrollbar $w.top.databases.scroll -orient vertical -border 1
1430 pack $w.top.databases.label -side top -fill x \
1432 pack $w.top.databases.list -side left -fill both -expand yes \
1434 pack $w.top.databases.scroll -side right -fill y \
1436 $w.top.databases.scroll config -command "$w.top.databases.list yview"
1438 foreach b [lindex $profile($hostid) 7] {
1439 $w.top.databases.list insert end $b
1441 top-down-ok-cancel $w {database-select-action} 1
1444 proc cascade-target-list {} {
1447 foreach sub [winfo children .top.target.m.clist] {
1448 puts "deleting $sub"
1451 .top.target.m.clist delete 0 last
1452 foreach n [array names profile] {
1453 if {$n != "Default"} {
1454 set nl [string tolower $n]
1455 if {[llength [lindex $profile($n) 7]] > 1} {
1456 .top.target.m.clist add cascade -label $n \
1457 -menu .top.target.m.clist.$nl
1458 menu .top.target.m.clist.$nl
1459 foreach b [lindex $profile($n) 7] {
1460 .top.target.m.clist.$nl add command -label $b \
1461 -command [list reopen-target $n $b]
1464 .top.target.m.clist add command -label $n \
1465 -command [list reopen-target $n {}]
1469 .top.target.m.slist delete 0 last
1470 foreach n [array names profile] {
1471 if {$n != "Default"} {
1472 .top.target.m.slist add command -label $n \
1473 -command [list protocol-setup $n]
1478 proc cascade-query-list {} {
1482 .top.options.m.slist delete 0 last
1483 foreach n $queryTypes {
1484 .top.options.m.slist add command -label $n \
1485 -command [list query-setup $i]
1490 .top.options.m.clist delete 0 last
1491 foreach n $queryTypes {
1492 .top.options.m.clist add command -label $n \
1493 -command [list query-select $i]
1498 proc save-settings {} {
1501 global settingsChanged
1508 set f [open "clientrc.tcl" w]
1509 puts $f "# Setup file"
1510 puts $f "set hotTargets \{ $hotTargets \}"
1512 foreach n [array names profile] {
1513 puts -nonewline $f "set \{profile($n)\} \{"
1514 puts -nonewline $f $profile($n)
1517 puts -nonewline $f "set queryTypes \{"
1518 puts -nonewline $f $queryTypes
1521 puts -nonewline $f "set queryButtons \{"
1522 puts -nonewline $f $queryButtons
1525 puts -nonewline $f "set queryInfo \{"
1526 puts -nonewline $f $queryInfo
1530 set settingsChanged 0
1542 message $w.top.message -text $ask
1544 pack $w.top.message -side left -pady 6 -padx 20 -expand yes -fill x
1547 top-down-ok-cancel $w {alert-action} 1
1551 proc alert-action {} {
1557 proc exit-action {} {
1558 global settingsChanged
1560 if {$settingsChanged} {
1561 set a [alert "you havent saved your settings. Do you wish to save?"]
1569 proc listbuttonaction {w name h user i} {
1570 $w configure -text [lindex $name 0]
1571 $h [lindex $name 1] $user $i
1574 proc listbuttonx {button no names handle user} {
1575 if {[winfo exists $button]} {
1576 $button configure -text [lindex [lindex $names $no] 0]
1577 ${button}.m delete 0 last
1579 menubutton $button -text [lindex [lindex $names $no] 0] \
1580 -width 10 -menu ${button}.m -relief raised -border 1
1584 foreach name $names {
1585 ${button}.m add command -label [lindex $name 0] \
1586 -command [list listbuttonaction ${button} $name \
1592 proc listbutton {button no names} {
1593 menubutton $button -text [lindex $names $no] -width 10 -menu ${button}.m \
1594 -relief raised -border 1
1596 foreach name $names {
1597 ${button}.m add command -label $name \
1598 -command [list ${button} configure -text $name]
1602 proc query-add-index-action {queryNo} {
1603 set w .setup-query-$queryNo
1606 global queryButtonsTmp
1608 lappend queryInfoTmp [list [.query-add-index.top.index.entry get] {}]
1610 destroy .query-add-index
1611 #destroy $w.top.lines
1612 #frame $w.top.lines -relief ridge -border 2
1613 index-lines $w.top.lines 0 $queryButtonsTmp $queryInfoTmp activate-e-index
1614 #pack $w.top.lines -side left -pady 6 -padx 6 -fill y
1617 proc query-add-line {queryNo} {
1618 set w .setup-query-$queryNo
1621 global queryButtonsTmp
1623 lappend queryButtonsTmp {I 0}
1625 #destroy $w.top.lines
1626 #frame $w.top.lines -relief ridge -border 2
1627 index-lines $w.top.lines 0 $queryButtonsTmp $queryInfoTmp activate-e-index
1628 #pack $w.top.lines -side left -pady 6 -padx 6 -fill y
1631 proc query-del-line {queryNo} {
1632 set w .setup-query-$queryNo
1635 global queryButtonsTmp
1637 set l [llength $queryButtonsTmp]
1642 set queryButtonsTmp [lreplace $queryButtonsTmp $l $l]
1643 index-lines $w.top.lines 0 $queryButtonsTmp $queryInfoTmp activate-e-index
1646 proc query-add-index {queryNo} {
1647 set w .query-add-index
1650 place-force $w .setup-query-$queryNo
1654 -side top -anchor e -pady 2
1655 entry-fields $w.top {index} \
1657 [list query-add-index-action $queryNo] {destroy .query-add-index}
1658 top-down-ok-cancel $w [list query-add-index-action $queryNo] 1
1661 proc query-setup-action {queryNo} {
1664 global queryButtonsTmp
1666 global queryButtonsFind
1667 global queryInfoFind
1669 set queryInfo [lreplace $queryInfo $queryNo $queryNo \
1671 set queryButtons [lreplace $queryButtons $queryNo $queryNo \
1673 set queryInfoFind $queryInfoTmp
1674 set queryButtonsFind $queryButtonsTmp
1678 destroy .setup-query-$queryNo
1680 index-lines .lines 1 $queryButtonsFind $queryInfoFind activate-index
1683 proc activate-e-index {value no i} {
1684 global queryButtonsTmp
1686 puts $queryButtonsTmp
1687 set queryButtonsTmp [lreplace $queryButtonsTmp $no $no [list I $i]]
1688 puts $queryButtonsTmp
1694 proc activate-index {value no i} {
1695 global queryButtonsFind
1697 set queryButtonsFind [lreplace $queryButtonsFind $no $no [list I $i]]
1699 puts "queryButtonsFind $queryButtonsFind"
1705 proc query-setup {queryNo} {
1706 set w .setup-query-$queryNo
1708 set queryTypes {Simple}
1711 global queryButtonsTmp
1714 set queryName [lindex $queryTypes $queryNo]
1715 set queryInfoTmp [lindex $queryInfo $queryNo]
1716 set queryButtonsTmp [lindex $queryButtons $queryNo]
1718 #set queryButtons { {I 0 I 1 I 2} }
1719 #set queryInfo { { {Title ti} {Author au} {Subject sh} } }
1723 wm title $w "Query setup $queryName"
1728 frame $w.top.lines -relief ridge -border 2
1729 frame $w.top.use -relief ridge -border 2
1730 frame $w.top.relation -relief ridge -border 2
1731 frame $w.top.position -relief ridge -border 2
1732 frame $w.top.structure -relief ridge -border 2
1733 frame $w.top.truncation -relief ridge -border 2
1734 frame $w.top.completeness -relief ridge -border 2
1738 index-lines $w.top.lines 0 $queryButtonsTmp $queryInfoTmp activate-e-index
1740 pack $w.top.lines -side left -pady 6 -padx 6 -fill y
1743 pack $w.top.use -side left -pady 6 -padx 6 -fill y
1745 label $w.top.use.label -text "Use"
1746 listbox $w.top.use.list -geometry 20x10 \
1747 -yscrollcommand "$w.top.use.scroll set"
1748 scrollbar $w.top.use.scroll -orient vertical -border 1
1749 pack $w.top.use.label -side top -fill x \
1751 pack $w.top.use.list -side left -fill both -expand yes \
1753 pack $w.top.use.scroll -side right -fill y \
1755 $w.top.use.scroll config -command "$w.top.use.list yview"
1757 foreach u {{Personal name} {Corporate name}} {
1758 $w.top.use.list insert end $u
1760 # Relation Attributes
1761 pack $w.top.relation -pady 6 -padx 6 -side top
1763 label $w.top.relation.label -text "Relation" -width 18
1765 listbutton $w.top.relation.b 0\
1766 {{None} {Less than} {Greater than or equal} \
1767 {Equal} {Greater than or equal} {Greater than} {Not equal} \
1769 {Stem} {Relevance} {AlwaysMatches}}
1771 pack $w.top.relation.label $w.top.relation.b -fill x
1773 # Position Attributes
1774 pack $w.top.position -pady 6 -padx 6 -side top
1776 label $w.top.position.label -text "Position" -width 18
1778 listbutton $w.top.position.b 0 {{None} {First in field} {First in subfield}
1779 {Any position in field}}
1781 pack $w.top.position.label $w.top.position.b -fill x
1783 # Structure Attributes
1785 pack $w.top.structure -pady 6 -padx 6 -side top
1787 label $w.top.structure.label -text "Structure" -width 18
1789 listbutton $w.top.structure.b 0 {{None} {Phrase} {Word} {Key} {Year}
1790 {Date (norm)} {Word list} {Date (un-norm)} {Name (norm)} {Date (un-norm)}
1791 {Structure} {urx} {free-form} {doc-text} {local-number} {string}
1794 pack $w.top.structure.label $w.top.structure.b -fill x
1796 # Truncation Attributes
1798 pack $w.top.truncation -pady 6 -padx 6 -side top
1800 label $w.top.truncation.label -text "Truncation" -width 18
1802 listbutton $w.top.truncation.b 0 {{Auto} {Right} {Left} {Left and right} \
1803 {No truncation} {Process #} {Re-1} {Re-2}}
1804 pack $w.top.truncation.label $w.top.truncation.b -fill x
1806 # Completeness Attributes
1808 pack $w.top.completeness -pady 6 -padx 6 -side top
1810 label $w.top.completeness.label -text "Truncation" -width 18
1812 listbutton $w.top.completeness.b 0 {{None} {Incomplete subfield} \
1813 {Complete subfield} {Complete field}}
1814 pack $w.top.completeness.label $w.top.completeness.b -fill x
1817 bottom-buttons $w [list \
1818 {Ok} [list query-setup-action $queryNo] \
1819 {Add index} [list query-add-index $queryNo] \
1820 {Add line} [list query-add-line $queryNo] \
1821 {Delete line} [list query-del-line $queryNo] \
1822 {Cancel} [list destroy $w]] 0
1825 proc index-clear {} {
1826 global queryButtonsFind
1829 foreach b $queryButtonsFind {
1830 .lines.$i.e delete 0 end
1835 proc index-query {} {
1836 global queryButtonsFind
1837 global queryInfoFind
1842 foreach b $queryButtonsFind {
1843 set term [string trim [.lines.$i.e get]]
1845 set attr [lindex [lindex $queryInfoFind [lindex $b 1]] 1]
1847 set term "\{${term}\}"
1849 set term "@attr $a ${term}"
1852 set qs "@and ${qs} ${term}"
1863 proc index-lines {w realOp buttonInfo queryInfo handle} {
1865 foreach b $buttonInfo {
1866 if {! [winfo exists $w.$i]} {
1867 frame $w.$i -background white -border 1
1869 listbuttonx $w.$i.l [lindex $b 1] $queryInfo $handle $i
1872 if {! [winfo exists $w.$i.e]} {
1873 entry $w.$i.e -width 32 -relief sunken -border 1
1874 bind $w.$i.e <FocusIn> [list $w.$i configure \
1876 bind $w.$i.e <FocusOut> [list $w.$i configure \
1878 pack $w.$i.l -side left
1879 pack $w.$i.e -side left -fill x -expand yes
1880 pack $w.$i -side top -fill x -padx 2 -pady 2
1881 bind $w.$i.e <Left> [list left-cursor $w.$i.e]
1882 bind $w.$i.e <Right> [list right-cursor $w.$i.e]
1883 bind $w.$i.e <Return> search-request
1886 pack $w.$i.l -side left
1887 pack $w.$i -side top -fill x -padx 2 -pady 2
1892 while {[winfo exists $w.$j]} {
1903 bind $w.$j.e <Tab> "focus $w.$k.e"
1907 bind $w.$i.e <Tab> "focus $w.0.e"
1912 proc search-fields {w buttondefs} {
1914 foreach buttondef $buttondefs {
1915 frame $w.$i -background white
1917 listbutton $w.$i.l 0 $buttondef
1918 entry $w.$i.e -width 32 -relief sunken
1920 pack $w.$i.l -side left
1921 pack $w.$i.e -side left -fill x -expand yes
1923 pack $w.$i -side top -fill x -padx 2 -pady 2
1925 bind $w.$i.e <Left> [list left-cursor $w.$i.e]
1926 bind $w.$i.e <Right> [list right-cursor $w.$i.e]
1934 bind $w.$j.e <Tab> "focus $w.$k.e \n
1935 $w.$k configure -background red \n
1936 $w.$j configure -background white"
1939 bind $w.$i.e <Tab> "focus $w.0.e \n
1940 $w.0 configure -background red \n
1941 $w.$i configure -background white"
1943 $w.0 configure -background red
1946 if {[info exists windowGeometry(.w)]} {
1947 set g $windowGeometry(.w)
1953 frame .top -border 1 -relief raised
1954 frame .lines -border 1 -relief raised
1955 frame .mid -border 1 -relief raised
1956 frame .data -border 1 -relief raised
1957 frame .bot -border 1 -relief raised
1958 pack .top .lines .mid -side top -fill x
1959 pack .data -side top -fill both -expand yes
1962 menubutton .top.file -text "File" -underline 0 -menu .top.file.m
1964 .top.file.m add command -label "Save settings" -command {save-settings}
1965 .top.file.m add separator
1966 .top.file.m add command -label "Exit" -command {exit-action}
1967 .top.file.m add separator
1968 .top.file.m add command -label "About" -command {about-origin}
1970 menubutton .top.target -text "Target" -underline 0 -menu .top.target.m
1972 .top.target.m add cascade -label "Connect" -menu .top.target.m.clist
1973 .top.target.m add command -label "Disconnect" -command {close-target}
1974 .top.target.m add command -label "About" -command {about-target}
1975 .top.target.m add cascade -label "Setup" -menu .top.target.m.slist
1976 .top.target.m add command -label "Setup new" -command {define-target-dialog}
1977 .top.target.m add separator
1980 .top.target.m disable 1
1981 .top.target.m disable 2
1983 menu .top.target.m.clist
1984 menu .top.target.m.slist
1987 menubutton .top.service -text "Service" -underline 0 -menu .top.service.m
1989 .top.service.m add command -label "Database" -command {database-select}
1990 .top.service.m add cascade -label "Query type" -menu .top.service.m.querytype
1991 menu .top.service.m.querytype
1992 .top.service.m.querytype add radiobutton -label "RPN"
1993 .top.service.m.querytype add radiobutton -label "CCL"
1994 .top.service.m add cascade -label "Present" -menu .top.service.m.present
1995 menu .top.service.m.present
1996 .top.service.m.present add command -label "More" \
1997 -command [list present-more 10]
1998 .top.service.m.present add command -label "All" \
1999 -command [list present-more {}]
2000 .top.service configure -state disabled
2002 menubutton .top.rset -text "Set" -menu .top.rset.m
2004 .top.rset.m add command -label "Load" -command {load-set}
2005 .top.rset.m add separator
2007 menubutton .top.options -text "Options" -underline 0 -menu .top.options.m
2009 .top.options.m add cascade -label "Choose query" -menu .top.options.m.clist
2010 .top.options.m add command -label "Define query" -command {new-query-dialog}
2011 .top.options.m add cascade -label "Edit query" -menu .top.options.m.slist
2012 menu .top.options.m.clist
2013 menu .top.options.m.slist
2016 menubutton .top.help -text "Help" -menu .top.help.m
2019 .top.help.m add command -label "Help on help" \
2020 -command {tkerror "Help on help not available. Sorry"}
2021 .top.help.m add command -label "About" \
2022 -command {tkerror "About not available. Sorry"}
2024 pack .top.file .top.target .top.service .top.rset .top.options -side left
2025 pack .top.help -side right
2027 index-lines .lines 1 $queryButtonsFind [lindex $queryInfo 0] activate-index
2029 button .mid.search -width 7 -text {Search} -command search-request \
2031 button .mid.scan -width 7 -text {Scan} \
2032 -command [list scan-request "@attr 1=4 @attr 5=1 @attr 4=1"] -state disabled
2033 button .mid.present -width 7 -text {Present} -command [list present-more 10] \
2036 button .mid.clear -width 7 -text {Clear} -command index-clear
2037 pack .mid.search .mid.scan .mid.present .mid.clear -side left \
2038 -fill y -padx 5 -pady 3
2040 listbox .data.list -yscrollcommand {.data.scroll set} -font fixed -geometry 20x2
2041 scrollbar .data.scroll -orient vertical -border 1
2042 pack .data.list -side left -fill both -expand yes
2043 pack .data.scroll -side right -fill y
2044 .data.scroll config -command {.data.list yview}
2046 button .bot.logo -bitmap @book1 -command cancel-operation
2048 pack .bot.a -side left -fill x
2049 pack .bot.logo -side right -padx 2 -pady 2
2051 message .bot.a.target -text "" -aspect 1000 -border 1
2053 label .bot.a.status -text "Not connected" -width 15 -relief \
2054 sunken -anchor w -border 1
2055 label .bot.a.set -text "" -width 5 -relief \
2056 sunken -anchor w -border 1
2057 label .bot.a.message -text "" -width 15 -relief \
2058 sunken -anchor w -border 1
2060 pack .bot.a.target -side top -anchor nw -padx 2 -pady 2
2061 pack .bot.a.status .bot.a.set .bot.a.message \
2062 -side left -padx 2 -pady 2