1 # IR toolkit for tcl/tk
3 # See the file LICENSE for details.
4 # Sebastian Hammer, Adam Dickmeiss
7 # Revision 1.56 1995-06-27 19:03:48 adam
8 # Bug fix in do_present in ir-tcl.c: p->set_child member weren't set.
9 # nextResultSetPosition used instead of setOffset.
11 # Revision 1.55 1995/06/27 17:10:37 adam
12 # Bug fix: install procedure didn't work on some systems.
13 # Error turned up when clientrc.tcl was't present.
15 # Revision 1.54 1995/06/27 14:41:03 adam
16 # Bug fix in search-response. Didn't always observe non-surrogate diagnostics.
18 # Revision 1.53 1995/06/26 12:40:09 adam
19 # Client defines its own tkerror.
20 # User may specify 'no preferredRecordSyntax'.
22 # Revision 1.52 1995/06/22 13:14:59 adam
23 # Feature: SUTRS. Setting getSutrs implemented.
24 # Work on display formats.
25 # Preferred record syntax can be set by the user.
27 # Revision 1.51 1995/06/21 11:11:00 adam
28 # Bug fix: libdir undefined in about-origin.
30 # Revision 1.50 1995/06/21 11:04:48 adam
31 # Uses GNU autoconf 2.3.
32 # Install procedure implemented.
33 # boook bitmaps moved to sub directory bitmaps.
35 # Revision 1.49 1995/06/20 14:16:42 adam
36 # More work on cancel mechanism.
38 # Revision 1.48 1995/06/20 08:07:23 adam
39 # New setting: failInfo.
40 # Working on better cancel mechanism.
42 # Revision 1.47 1995/06/19 14:05:29 adam
43 # Bug fix: asked for SUTRS.
45 # Revision 1.46 1995/06/19 13:06:06 adam
46 # New define: IR_TCL_VERSION.
48 # Revision 1.45 1995/06/19 08:08:44 adam
49 # client.tcl: hotTargets now contain both database and target name.
50 # ir-tcl.c: setting protocol edited. Errors in callbacks are logged
51 # by logf(LOG_WARN, ...) calls.
53 # Revision 1.44 1995/06/16 14:55:18 adam
56 # Revision 1.43 1995/06/16 14:41:05 adam
57 # Scan line entries can be copied to a search entry.
59 # Revision 1.42 1995/06/16 12:28:13 adam
60 # Implemented preferredRecordSyntax.
61 # Minor changes in diagnostic handling.
62 # Record list deleted when connection closes.
64 # Revision 1.41 1995/06/14 15:07:59 adam
65 # Bug fix in cascade-target-list. Uses yaz-version.h.
67 # Revision 1.40 1995/06/14 13:37:17 adam
68 # Setting recordType implemented.
69 # Setting implementationVersion implemented.
70 # Settings implementationId / implementationName edited.
72 # Revision 1.39 1995/06/14 12:16:22 adam
73 # hotTargets, textWrap and displayFormat saved in clientg.tcl.
75 # Revision 1.38 1995/06/14 07:22:45 adam
76 # Target definitions can be deleted.
77 # Listbox used in the query definition dialog.
79 # Revision 1.37 1995/06/13 14:37:59 adam
80 # Work on query setup.
81 # Better about origin/target.
82 # Better presentation formats.
84 # Revision 1.36 1995/06/13 07:42:14 adam
85 # Bindings removed from text widgets.
87 # Revision 1.35 1995/06/12 15:17:31 adam
88 # Text widget used in main window (instead of listbox) to support
89 # better presentation formats.
91 # Revision 1.34 1995/06/12 07:59:07 adam
92 # More work on geometry handling.
94 # Revision 1.33 1995/06/09 11:17:35 adam
95 # Start work on geometry management.
97 # Revision 1.32 1995/06/07 09:16:37 adam
98 # New presentation format.
100 # Revision 1.31 1995/06/06 16:31:09 adam
101 # Bug fix: target names couldn't contain blanks.
104 # Revision 1.30 1995/06/06 11:35:41 adam
105 # Work on scan. Display of old sets.
107 # Revision 1.29 1995/06/05 14:11:18 adam
108 # Bug fix in present-more.
110 # Revision 1.28 1995/06/02 14:52:13 adam
111 # Minor changes really.
113 # Revision 1.27 1995/06/02 14:29:42 adam
114 # Work on scan interface - up/down buttons.
116 # Revision 1.26 1995/06/01 16:36:46 adam
117 # About buttons. Minor bug fixes.
119 # Revision 1.25 1995/05/31 13:09:57 adam
120 # Client searches/presents may be interrupted.
121 # New moving book-logo.
123 # Revision 1.24 1995/05/31 08:36:24 adam
124 # Bug fix in client.tcl: didn't save options on clientrc.tcl.
125 # New method: referenceId. More work on scan.
127 # Revision 1.23 1995/05/29 10:33:41 adam
128 # README and rename of startup script.
130 # Revision 1.22 1995/05/26 11:44:09 adam
131 # Bugs fixed. More work on MARC utilities and queries. Test
132 # client is up-to-date again.
134 # Revision 1.21 1995/05/11 15:34:46 adam
135 # Scan request changed a bit. This version works with RLG.
137 # Revision 1.20 1995/04/21 16:31:57 adam
138 # New radiobutton: protocol (z39v2/SR).
140 # Revision 1.19 1995/04/18 16:11:50 adam
141 # First version of graphical Scan. Some work on query-by-form.
143 # Revision 1.18 1995/04/10 10:50:22 adam
144 # Result-set name defaults to suffix of ir-set name.
145 # Started working on scan. Not finished at this point.
147 # Revision 1.17 1995/03/31 09:34:57 adam
148 # Search-button disabled when there is no connection.
150 # Revision 1.16 1995/03/31 08:56:36 adam
151 # New button "Search".
153 # Revision 1.15 1995/03/28 12:45:22 adam
154 # New ir method failback: called on disconnect/protocol error.
155 # New ir set/get method: protocol: SR / Z3950.
156 # Simple popup and disconnect when failback is invoked.
158 # Revision 1.14 1995/03/22 16:07:55 adam
161 # Revision 1.13 1995/03/21 17:27:26 adam
162 # Short-hand keys in setup.
164 # Revision 1.12 1995/03/21 13:41:03 adam
165 # Comstack cs_create not used too often. Non-blocking connect.
167 # Revision 1.11 1995/03/21 10:39:06 adam
168 # Diagnostic error message displayed with tkerror.
170 # Revision 1.10 1995/03/20 15:24:06 adam
171 # Diagnostic records saved on searchResponse.
173 # Revision 1.9 1995/03/17 18:26:16 adam
174 # Non-blocking i/o used now. Database names popup as cascade items.
176 # Revision 1.8 1995/03/17 15:45:00 adam
177 # Improved target/database setup.
179 # Revision 1.7 1995/03/16 17:54:03 adam
180 # Minor changes really.
182 # Revision 1.6 1995/03/15 19:10:20 adam
183 # Database setup in protocol-setup (rather target setup).
185 # Revision 1.5 1995/03/15 13:59:23 adam
188 # Revision 1.4 1995/03/14 17:32:29 adam
189 # Presentation of full Marc record in popup window.
191 # Revision 1.3 1995/03/12 19:31:52 adam
192 # Pattern matching implemented when retrieving MARC records. More
193 # diagnostic functions.
195 # Revision 1.2 1995/03/10 18:00:15 adam
196 # Actual presentation in line-by-line format. RPN query support.
198 # Revision 1.1 1995/03/09 16:15:07 adam
199 # First presentRequest attempts. Hot-target list.
204 if {[file readable bitmaps/book2]} {
207 if {! [file readable ${libdir}/bitmaps/book2]} {
208 puts "Cannot locate system files in ${libdir}. You must either run this"
209 puts "program from the source directory root of ir-tcl or you must assure"
210 puts "that it is installed - normally in /usr/local/lib/irtcl"
218 set profile(Default) {{} {} {210} {} 16384 8192 tcpip {} 1 {} {} Z39 1}
220 set settingsChanged 0
229 set recordSyntax None
232 set queryTypes {Simple}
233 set queryButtons { { {I 0} {I 1} {I 2} } }
234 set queryInfo { { {Title {1=4 4=1}} {Author {1=1}} \
235 {Subject {1=21}} {Any {1=1016}} } }
244 if {[winfo exists $w]} {
253 label $w.top.b -bitmap error
254 message $w.top.t -aspect 300 -text "Error: $err" \
255 -font -Adobe-Helvetica-Bold-R-Normal-*-240-*
256 pack $w.top.b $w.top.t -side left -padx 10 -pady 10
258 bottom-buttons $w [list {Close} [list destroy $w]] 1
261 proc read-formats {} {
262 global displayFormats
264 set formats [glob -nocomplain ${libdir}/formats/*.tcl]
266 if {[file readable $f]} {
268 set l [string length $f]
269 set f [string range $f [string length "${libdir}/formats/"] \
271 lappend displayFormats $f
280 .data.record configure -wrap $m
287 proc set-display-format {f} {
297 .bot.a.status configure -text "Reformatting"
300 add-title-lines -1 10000 1
303 proc initBindings {} {
306 bind $w <Double-1> {}
307 bind $w <Triple-1> {}
308 bind $w <B1-Motion> {}
310 bind $w <Shift-B1-Motion> {}
312 bind $w <B2-Motion> {}
313 bind $w <Any-KeyPress> {}
315 bind $w <BackSpace> {}
317 bind $w <Control-h> {}
318 bind $w <Control-d> {}
319 bind $w <Control-v> {}
322 bind $w <B1-Motion> {}
323 bind $w <Shift-B1-Motion> {}
328 proc post-menu {wbutton wmenu} {
331 $wmenu post [winfo rootx $wbutton] \
332 [expr [winfo rooty $wbutton]+[winfo height $wbutton]]
337 global windowGeometry
338 set windowGeometry($w) [wm geometry $w]
341 global windowGeometry
344 if {[info exists windowGeometry($w)]} {
345 set g $windowGeometry($w)
350 bind $w <Destroy> [list destroyGW $w]
353 if {[file readable "clientrc.tcl"]} {
354 source "clientrc.tcl"
356 if {[file readable "${libdir}/clientrc.tcl"]} {
357 source "${libdir}/clientrc.tcl"
361 if {[file readable "~/.clientrc.tcl"]} {
362 source "~/.clientrc.tcl"
365 set queryButtonsFind [lindex $queryButtons 0]
366 set queryInfoFind [lindex $queryInfo 0]
368 proc top-down-window {w} {
369 frame $w.top -relief raised -border 1
370 frame $w.bot -relief raised -border 1
372 pack $w.top -side top -fill both -expand yes
373 pack $w.bot -fill both
376 proc top-down-ok-cancel {w ok-action g} {
377 frame $w.bot.left -relief sunken -border 1
378 pack $w.bot.left -side left -expand yes -ipadx 2 -ipady 2 -padx 5 -pady 5
379 button $w.bot.left.ok -width 6 -text {Ok} \
380 -command ${ok-action}
381 pack $w.bot.left.ok -expand yes -ipadx 2 -ipady 2 -padx 3 -pady 3
382 button $w.bot.cancel -width 6 -text {Cancel} \
383 -command [list destroy $w]
384 pack $w.bot.cancel -side left -expand yes
392 proc bottom-buttons {w buttonList g} {
394 set l [llength $buttonList]
396 frame $w.bot.$i -relief sunken -border 1
397 pack $w.bot.$i -side left -expand yes -padx 5 -pady 5
398 button $w.bot.$i.ok -text [lindex $buttonList $i] \
399 -command [lindex $buttonList [expr $i+1]]
400 pack $w.bot.$i.ok -expand yes -ipadx 3 -ipady 2 -padx 3 -pady 3 -side left
404 button $w.bot.$i -text [lindex $buttonList $i] \
405 -command [lindex $buttonList [expr $i+1]]
406 pack $w.bot.$i -expand yes -ipadx 2 -ipady 2 -padx 3 -pady 3 -side left
416 proc cancel-operation {} {
424 show-status Cancel 0 1
428 proc show-target {target base} {
432 .bot.a.target configure -text ""
436 .bot.a.target configure -text "$target"
438 .bot.a.target configure -text "$target - $base"
442 proc show-logo {v1} {
451 .bot.logo configure -bitmap @${libdir}/bitmaps/book${v1}
452 after 140 [list show-logo $v1]
456 .bot.logo configure -bitmap @${libdir}/bitmaps/book1
465 proc show-status {status b sb} {
472 .bot.a.status configure -text "$status"
474 if {$busy == 0} {set busy 1}
482 .top.service configure -state normal
483 .mid.search configure -state normal
485 .mid.scan configure -state normal
488 .top.service.m disable 1
489 } elseif {[z39.$setNo nextResultSetPosition] > 0 &&
490 [z39.$setNo nextResultSetPosition] <= [z39.$setNo resultCount]} {
491 .top.service.m enable 1
492 .mid.present configure -state normal
494 .top.service.m disable 1
495 .mid.present configure -state disabled
497 if {[winfo exists .scan-window]} {
498 .scan-window.bot.2 configure -state normal
499 .scan-window.bot.4 configure -state normal
502 .top.service configure -state disabled
503 .mid.search configure -state disabled
504 .mid.scan configure -state disabled
505 .mid.present configure -state disabled
507 if {[winfo exists .scan-window]} {
508 .scan-window.bot.2 configure -state disabled
509 .scan-window.bot.4 configure -state disabled
514 proc show-message {msg} {
515 .bot.a.message configure -text "$msg"
518 proc insertWithTags {w text args} {
519 set start [$w index insert]
520 $w insert insert $text
521 foreach tag [$w tag names $start] {
522 $w tag remove $tag $start insert
525 $w tag add $i $start insert
529 proc popup-license {} {
534 wm title $w "License"
540 text $w.top.t -width 80 -height 10 -wrap word \
541 -yscrollcommand [list $w.top.s set]
542 scrollbar $w.top.s -command [list $w.top.t yview]
544 pack $w.top.s -side right -fill y
545 pack $w.top.t -expand yes -fill both
547 if {[file readable "${libdir}/LICENSE"]} {
548 set f [open "${libdir}/LICENSE" r]
549 while {[gets $f buf] != -1} {
550 $w.top.t insert end $buf
551 $w.top.t insert end "\n"
555 bottom-buttons $w [list {Close} [list destroy $w]] 1
558 proc about-target {} {
559 set w .about-target-w
564 wm title $w "About target"
568 frame $w.top.a -relief ridge -border 2
569 frame $w.top.p -relief ridge -border 2
571 pack $w.top.a $w.top.p -side top -fill x
573 label $w.top.a.about -text "About"
574 label $w.top.a.irtcl -text $hostid \
575 -font -Adobe-Helvetica-Bold-R-Normal-*-240-*
576 pack $w.top.a.about $w.top.a.irtcl -side top
578 set i [z39 targetImplementationName]
579 label $w.top.p.in -text "Implementation name: $i"
580 set i [z39 targetImplementationId]
581 label $w.top.p.ii -text "Implementation id: $i"
582 set i [z39 targetImplementationVersion]
583 label $w.top.p.iv -text "Implementation version: $i"
585 label $w.top.p.op -text "Protocol options: $i"
587 pack $w.top.p.in $w.top.p.ii $w.top.p.iv $w.top.p.op -side top -anchor nw
589 bottom-buttons $w [list {Close} [list destroy $w]] 1
592 proc about-origin-logo {n} {
594 set w .about-origin-w
595 if {![winfo exists $w]} {
602 $w.top.a.logo configure -bitmap @${libdir}/bitmaps/book$n
603 after 140 [list about-origin-logo $n]
606 proc about-origin {} {
607 set w .about-origin-w
610 if {[winfo exists $w]} {
615 wm title $w "About IrTcl"
619 frame $w.top.a -relief ridge -border 2
620 frame $w.top.p -relief ridge -border 2
622 pack $w.top.a $w.top.p -side top -fill x
624 label $w.top.a.irtcl -text "IrTcl" \
625 -font -Adobe-Helvetica-Bold-R-Normal-*-240-*
626 label $w.top.a.logo -bitmap @${libdir}/bitmaps/book1
627 pack $w.top.a.irtcl $w.top.a.logo -side left -expand yes
629 set i [z39 implementationName]
630 label $w.top.p.in -text "Implementation name: $i"
631 set i [z39 implementationId]
632 label $w.top.p.ii -text "Implementation id: $i"
633 set i [z39 implementationVersion]
634 label $w.top.p.iv -text "Implementation version: $i"
636 pack $w.top.p.in $w.top.p.ii $w.top.p.iv -side top -anchor nw
639 bottom-buttons $w [list {Close} [list destroy $w] \
640 {License} [list popup-license]] 0
643 proc popup-marc {sno no b df} {
645 global displayFormats
648 if {[z39.$sno type $no] != "DB"} {
652 set w .full-marc-$fullMarcSeq
659 if {[winfo exists $w]} {
667 frame $w.top -relief raised -border 1
668 frame $w.bot -relief raised -border 1
670 pack $w.top -side top -fill both -expand yes
671 pack $w.bot -fill both
673 text $w.top.record -width 60 -height 5 -wrap word \
674 -yscrollcommand [list $w.top.s set]
675 scrollbar $w.top.s -command [list $w.top.record yview]
677 if {[tk colormodel .] == "color"} {
678 $w.top.record tag configure marc-tag -foreground blue
679 $w.top.record tag configure marc-id -foreground red
681 $w.top.record tag configure marc-tag -foreground black
682 $w.top.record tag configure marc-id -foreground black
684 $w.top.record tag configure marc-data -foreground black
687 $w.top.record delete 0.0 end
688 set recordType [z39.$sno recordType $no]
689 wm title $w "$recordType record #$no"
692 bind $w.top.record <Return> {destroy .full-marc}
694 pack $w.top.s -side right -fill y
695 pack $w.top.record -expand yes -fill both
698 bottom-buttons $w [list \
699 {Close} [list destroy $w]] 0
701 bottom-buttons $w [list \
702 {Close} [list destroy $w] \
703 {Duplicate} [list popup-marc $sno $no 1 0]] 0
704 menubutton $w.bot.formats -text "Format" -menu $w.bot.formats.m
705 menu $w.bot.formats.m
707 foreach f $displayFormats {
708 $w.bot.formats.m add radiobutton -label $f \
709 -variable popupMarcdf -value $i \
710 -command [list display-$f $sno $no $w.top.record 0]
713 pack $w.bot.formats -expand yes -ipadx 2 -ipady 2 \
714 -padx 3 -pady 3 -side left
718 foreach f $displayFormats {
719 $w.bot.formats.m entryconfigure $i \
720 -command [list display-$f $sno $no $w.top.record 0]
724 set ffunc [lindex $displayFormats $df]
725 set ffunc "display-$ffunc"
727 $ffunc $sno $no $w.top.record 0
730 proc update-target-hotlist {target base} {
733 set len [llength $hotTargets]
735 .top.target.m delete 6 [expr 6+[llength $hotTargets]]
738 foreach e $hotTargets {
739 if {$target == [lindex $e 0] && $base == [lindex $e 1]} {
740 set hotTargets [lreplace $hotTargets $i $i]
745 set hotTargets [linsert $hotTargets 0 [list $target $base]]
749 proc set-target-hotlist {} {
753 foreach e $hotTargets {
754 set target [lindex $e 0]
755 set base [lindex $e 1]
757 .top.target.m add command -label "$i $target" -command \
758 [list reopen-target $target {}]
760 .top.target.m add command -label "$i $target - $base" -command \
761 [list reopen-target $target $base]
770 proc reopen-target {target base} {
772 open-target $target $base
773 update-target-hotlist $target $base
776 proc define-target-action {} {
779 set target [.target-define.top.target.entry get]
783 foreach n [array names profile] {
789 set seq [lindex $profile(Default) 12]
791 set profile($target) $profile(Default)
792 set profile(Default) [lreplace $profile(Default) 12 12 [incr seq]]
794 protocol-setup $target
795 destroy .target-define
798 proc fail-response {target} {
799 set c [lindex [z39 failInfo] 0]
800 set m [lindex [z39 failInfo] 1]
805 proc connect-response {target base} {
806 dputs "connect-response"
807 show-target $target $base
811 proc open-target {target base} {
816 z39 comstack [lindex $profile($target) 6]
817 z39 protocol [lindex $profile($target) 11]
818 z39 idAuthentication [lindex $profile($target) 3]
819 z39 maximumRecordSize [lindex $profile($target) 4]
820 z39 preferredMessageSize [lindex $profile($target) 5]
821 dputs "maximumRecordSize="
822 dputs [z39 maximumRecordSize]
823 dputs "preferredMessageSize="
824 dputs [z39 preferredMessageSize]
825 show-status {Connecting} 1 0
827 z39 databaseNames [lindex [lindex $profile($target) 7] 0]
829 z39 databaseNames $base
831 z39 failback [list fail-response $target]
832 z39 callback [list connect-response $target $base]
835 z39 connect [lindex $profile($target) 1]:[lindex $profile($target) 2]
838 tkerror $errorMessage
839 show-status Ready 0 {}
843 .top.target.m disable 0
844 .top.target.m enable 1
845 .top.target.m enable 2
848 proc close-target {} {
857 .bot.a.set configure -text ""
861 show-status {Not connected} 0 0
864 .top.target.m disable 1
865 .top.target.m disable 2
866 .top.rset.m delete 1 last
867 .top.rset.m add separator
868 .top.target.m enable 0
871 proc load-set-action {} {
875 ir-set z39.$setNoLast z39
877 set fname [.load-set.top.filename.entry get]
880 show-status {Loading} 1 {}
882 z39.$setNo loadFile $fname
884 set no [z39.$setNoLast numberOfRecordsReturned]
885 add-title-lines $setNoLast $no 1
887 set l [format "%-4d %7d" $setNoLast $no]
888 .top.rset.m add command -label $l \
889 -command [list add-title-lines $setNoLast 10000 1]
890 show-status {Ready} 0 {}
902 frame $w.top.filename
903 pack $w.top.filename -side top -anchor e -pady 2
905 entry-fields $w.top {filename} \
907 {load-set-action} {destroy .load-set}
909 top-down-ok-cancel $w {load-set-action} 1
913 proc init-request {} {
920 z39 callback {init-response}
921 show-status {Initializing} 1 {}
922 set err [catch {z39 init} errorMessage]
924 tkerror $errorMessage
925 show-status Ready 0 {}
929 proc init-response {} {
937 if {![z39 initResult]} {
938 show-status {Ready} 0 1
939 set u [z39 userInformationField]
941 tkerror "Connection rejected by target: $u"
943 if {[lsearch [z39 options] scan] >= 0} {
948 show-status {Ready} 0 1
952 proc search-request {bflag} {
964 dputs "search-request"
966 if {!$bflag && $busy} {
967 dputs "busy: search-request ignored"
972 show-status {Searching} 1 0
973 set delayRequest {search-request 1}
978 set query [index-query]
984 ir-set z39.$setNo z39
986 if {[lindex $profile($target) 10] == 1} {
987 z39.$setNo setName $setNo
988 dputs "setName=${setNo}"
990 z39.$setNo setName Default
991 dputs "setName=Default"
993 if {[lindex $profile($target) 8] == 1} {
994 z39.$setNo queryType rpn
996 if {[lindex $profile($target) 9] == 1} {
997 z39.$setNo queryType ccl
1001 if {$recordSyntax == "None" } {
1002 z39.$setNo preferredRecordSyntax {}
1004 z39.$setNo preferredRecordSyntax $recordSyntax
1006 z39 callback {search-response}
1007 z39.$setNo search $query
1008 show-status {Searching} 1 0
1011 proc scan-copy {y entry} {
1013 set no [$w.top.list nearest $y]
1015 .lines.$entry.e delete 0 end
1016 .lines.$entry.e insert 0 [string range [$w.top.list get $no] 8 end]
1019 proc scan-request {} {
1026 global curIndexEntry
1027 global queryButtonsFind
1028 global queryInfoFind
1032 dputs "scan-request"
1035 show-status {Scanning} 1 0
1036 set delayRequest scan-request
1045 set b [lindex $queryButtonsFind $curIndexEntry]
1047 foreach a [lrange [lindex $queryInfoFind [lindex $b 1]] 1 end] {
1048 set attr "@attr $a $attr"
1050 set title [lindex [lindex $queryInfoFind [lindex $b 1]] 0]
1051 ir-scan z39.scan z39
1053 if {![winfo exists $w]} {
1060 entry $w.top.entry -relief sunken
1061 pack $w.top.entry -fill x -padx 4 -pady 2
1062 bind $w.top.entry <KeyRelease> [list scan-term-h $attr]
1064 listbox $w.top.list -yscrollcommand [list $w.top.scroll set] \
1066 scrollbar $w.top.scroll -orient vertical -border 1
1067 pack $w.top.list -side left -fill both -expand yes
1068 pack $w.top.scroll -side right -fill y
1069 $w.top.scroll config -command [list $w.top.list yview]
1071 listbox $w.top.list -font fixed -geometry 60x14
1072 pack $w.top.list -side left -fill both -expand yes
1075 bottom-buttons $w [list {Close} [list destroy $w] \
1076 {Up} [list scan-up $attr] \
1077 {Down} [list scan-down $attr]] 0
1078 bind $w.top.list <Up> [list scan-up $attr]
1079 bind $w.top.list <Down> [list scan-down $attr]
1081 bind $w.top.list <Double-Button-1> [list scan-copy %y $curIndexEntry]
1082 wm title $w "Scan $title"
1084 z39 callback [list scan-response $attr 0 35]
1085 z39.scan numberOfTermsRequested 5
1086 z39.scan preferredPositionInResponse 1
1087 z39.scan scan "${attr} 0"
1089 show-status {Scanning} 1 0
1092 proc scan-term-h {attr} {
1100 set nScanTerm [$w.top.entry get]
1101 if {$nScanTerm == $scanTerm} {
1104 set scanTerm $nScanTerm
1105 z39 callback [list scan-response $attr 0 35]
1106 z39.scan numberOfTermsRequested 5
1107 z39.scan preferredPositionInResponse 1
1108 dputs "${attr} \{${scanTerm}\}"
1109 if {$scanTerm == ""} {
1110 z39.scan scan "${attr} 0"
1112 z39.scan scan "${attr} \{${scanTerm}\}"
1114 show-status {Scanning} 1 0
1117 proc scan-response {attr start toget} {
1124 dputs "In scan-response"
1125 set m [z39.scan numberOfEntriesReturned]
1131 if {![winfo exists .scan-window]} {
1134 dputs "Handling cancel"
1135 if {$delayRequest != ""} {
1140 show-status {Ready} 0 1
1143 set nScanTerm [$w.top.entry get]
1144 if {$nScanTerm != $scanTerm} {
1145 z39 callback [list scan-response $attr 0 35]
1146 z39.scan numberOfTermsRequested 5
1147 z39.scan preferredPositionInResponse 1
1148 set scanTerm $nScanTerm
1149 dputs "${attr} \{${scanTerm}\}"
1150 if {$scanTerm == ""} {
1151 z39.scan scan "${attr} 0"
1153 z39.scan scan "${attr} \{${scanTerm}\}"
1155 show-status {Scanning} 1 0
1158 set status [z39.scan scanStatus]
1161 show-status {Ready} 0 1
1166 for {set i 0} {$i < $m} {incr i} {
1167 set term [lindex [z39.scan scanLine $i] 1]
1168 set nostr [format " %-6d" [lindex [z39.scan scanLine $i] 2]]
1169 $w.top.list insert $i "$nostr $term"
1172 $w.top.list yview $scanView
1174 $w.top.list delete $start end
1175 for {set i 0} {$i < $m} {incr i} {
1176 set term [lindex [z39.scan scanLine $i] 1]
1177 set nostr [format " %-6d" [lindex [z39.scan scanLine $i] 2]]
1178 $w.top.list insert end "$nostr $term"
1182 dputs "Handling cancel"
1184 if {$delayRequest != ""} {
1190 if {$toget > 0 && $m > 1 && $m < $toget} {
1191 set ntoget [expr $toget - $m + 1]
1192 dputs ntoget=$ntoget
1193 z39 callback [list scan-response $attr [expr $start + $m - 1] $ntoget]
1195 dputs "down continue: $q"
1197 z39.scan numberOfTermsRequested 10
1199 z39.scan numberOfTermsRequested $ntoget
1201 z39.scan preferredPositionInResponse 1
1202 dputs "${attr} \{$q\}"
1203 z39.scan scan "${attr} \{$q\}"
1206 if {$toget < 0 && $m > 1 && $m < [expr - $toget]} {
1207 set ntoget [expr - $toget - $m]
1208 dputs ntoget=$ntoget
1209 z39 callback [list scan-response $attr 0 -$ntoget]
1210 set q [string range [$w.top.list get 0] 8 end]
1211 dputs "up continue: $q"
1213 z39.scan numberOfTermsRequested 10
1214 z39.scan preferredPositionInResponse 11
1216 z39.scan numberOfTermsRequested $ntoget
1217 z39.scan preferredPositionInResponse [incr ntoget]
1219 dputs "${attr} \{$q\}"
1220 z39.scan scan "${attr} \{$q\}"
1223 show-status {Ready} 0 1
1226 proc scan-down {attr} {
1234 show-status {Scanning down} 1 0
1235 set delayRequest [list scan-down $attr]
1241 set scanView [expr $scanView + 5]
1242 set s [$w.top.list size]
1243 if {$scanView > $s} {
1244 z39 callback [list scan-response $attr [expr $s - 1] 25]
1245 set q [string range [$w.top.list get [expr $s - 1]] 8 end]
1247 z39.scan numberOfTermsRequested 10
1248 z39.scan preferredPositionInResponse 1
1249 show-status {Scanning} 1 0
1250 dputs "${attr} \{$q\}"
1251 z39.scan scan "${attr} \{$q\}"
1254 $w.top.list yview $scanView
1257 proc scan-up {attr} {
1265 show-status {Scanning up} 1 0
1266 set delayRequest [list scan-up $attr]
1272 set scanView [expr $scanView - 5]
1273 if {$scanView < 0} {
1274 z39 callback [list scan-response $attr 0 -25]
1275 set q [string range [$w.top.list get 0] 8 end]
1277 z39.scan numberOfTermsRequested 10
1278 z39.scan preferredPositionInResponse 11
1279 show-status {Scanning} 1 0
1280 z39.scan scan "${attr} \{$q\}"
1283 $w.top.list yview $scanView
1286 proc search-response {} {
1294 dputs "In search-response"
1296 dputs "Handling cancel"
1298 if {$delayRequest != ""} {
1306 set setMax [z39.$setNo resultCount]
1307 show-status {Ready} 0 1
1308 set status [z39.$setNo responseStatus]
1309 if {[lindex $status 0] == "NSD"} {
1310 z39.$setNo nextResultSetPosition 0
1311 set code [lindex $status 1]
1312 set msg [lindex $status 2]
1313 set addinfo [lindex $status 3]
1314 tkerror "NSD$code: $msg: $addinfo"
1317 show-message "${setMax} hits"
1322 show-status {Ready} 0 1
1323 set l [format "%-4d %7d" $setNo $setMax]
1324 .top.rset.m add command -label $l \
1325 -command [list add-title-lines $setNo 10000 1]
1329 z39 callback {present-response}
1330 z39.$setNo present $setOffset 1
1331 show-status {Retrieving} 1 0
1334 proc present-more {number} {
1342 dputs "present-more"
1344 show-status {Retrieving} 1 0
1345 set delayRequest "present-more $number"
1351 dputs "setNo=$setNo"
1354 set setOffset [z39.$setNo nextResultSetPosition]
1355 dputs "setOffest=${setOffset}"
1356 dputs "setNo=${setNo}"
1357 set max [z39.$setNo resultCount]
1358 if {$max < $setOffset} {
1360 dputs "setOffset=$setOffset"
1361 show-status Ready 0 1
1364 if {$number == ""} {
1368 if {$setMax > $max} {
1372 z39 callback {present-response}
1374 set toGet [expr $setMax - $setOffset + 1]
1381 z39.$setNo present $setOffset $toGet
1382 show-status {Retrieving} 1 0
1385 proc init-title-lines {} {
1386 .data.record delete 0.0 end
1389 proc title-press {y setno} {
1390 show-full-marc $setno [expr 1 + [.data.list nearest $y]] 0
1393 proc add-title-lines {setno no offset} {
1394 global displayFormats
1395 global displayFormat
1405 .bot.a.set configure -text $setno
1406 .data.record delete 0.0 end
1408 set ffunc [lindex $displayFormats $displayFormat]
1409 dputs "ffunc=$ffunc"
1410 set ffunc "display-$ffunc"
1411 for {set i 0} {$i < $no} {incr i} {
1412 set o [expr $i + $offset]
1413 set type [z39.$setno type $o]
1417 .data.record tag bind r$o <Any-Enter> {}
1418 .data.record tag bind r$o <Any-Leave> {}
1419 set insert0 [.data.record index insert]
1420 $ffunc $setno $o .data.record 1
1421 .data.record tag add r$o $insert0 insert
1422 .data.record tag bind r$o <1> \
1423 [list popup-marc $setno $o 0 0]
1427 show-status Ready 0 1
1431 proc present-response {} {
1438 dputs "In present-response"
1439 set no [z39.$setNo numberOfRecordsReturned]
1440 dputs "Returned $no records, setOffset $setOffset"
1441 add-title-lines $setNo $no $setOffset
1442 set setOffset [expr $setOffset + $no]
1444 dputs "Handling cancel"
1446 if {$delayRequest != ""} {
1451 set status [z39.$setNo responseStatus]
1452 if {[lindex $status 0] == "NSD"} {
1453 show-status {Ready} 0 1
1454 set code [lindex $status 1]
1455 set msg [lindex $status 2]
1456 set addinfo [lindex $status 3]
1457 tkerror "NSD$code: $msg: $addinfo"
1460 if {$no > 0 && $setOffset <= $setMax} {
1461 dputs "present-request from ${setOffset}"
1462 set toGet [expr $setMax - $setOffset + 1]
1466 z39.$setNo present $setOffset $toGet
1468 show-status {Ready} 0 1
1472 proc left-cursor {w} {
1473 set i [$w index insert]
1480 proc right-cursor {w} {
1481 set i [$w index insert]
1486 proc bind-fields {list returnAction escapeAction} {
1487 set max [expr [llength $list]-1]
1488 for {set i 0} {$i < $max} {incr i} {
1489 bind [lindex $list $i] <Return> $returnAction
1490 bind [lindex $list $i] <Escape> $escapeAction
1491 bind [lindex $list $i] <Tab> [list focus [lindex $list [expr $i+1]]]
1492 bind [lindex $list $i] <Left> [list left-cursor [lindex $list $i]]
1493 bind [lindex $list $i] <Right> [list right-cursor [lindex $list $i]]
1495 bind [lindex $list $i] <Return> $returnAction
1496 bind [lindex $list $i] <Escape> $escapeAction
1497 bind [lindex $list $i] <Tab> [list focus [lindex $list 0]]
1498 bind [lindex $list $i] <Left> [list left-cursor [lindex $list $i]]
1499 bind [lindex $list $i] <Right> [list right-cursor [lindex $list $i]]
1500 focus [lindex $list 0]
1503 proc entry-fields {parent list tlist returnAction escapeAction} {
1506 foreach field $list {
1507 set label ${parent}.${field}.label
1508 set entry ${parent}.${field}.entry
1509 label $label -text [lindex $tlist $i] -anchor e
1510 entry $entry -width 32 -relief sunken
1511 pack $label -side left
1512 pack $entry -side right
1513 lappend alist $entry
1516 bind-fields $alist $returnAction $escapeAction
1519 proc define-target-dialog {} {
1520 set w .target-define
1526 pack $w.top.target \
1527 -side top -anchor e -pady 2
1528 entry-fields $w.top {target} \
1530 {define-target-action} {destroy .target-define}
1531 top-down-ok-cancel $w {define-target-action} 1
1534 proc protocol-setup-delete {target} {
1536 global settingsChanged
1538 set a [alert "Are you sure you want to delete the target \
1539 definition $target ?"]
1541 set wno [lindex $profile($target) 12]
1544 unset profile($target)
1545 set settingsChanged 1
1550 proc protocol-setup-action {target} {
1553 global protocolRadioType
1554 global settingsChanged
1557 global ResultSetCheck
1559 set wno [lindex $profile($target) 12]
1563 set settingsChanged 1
1564 set len [$w.top.databases.list size]
1565 for {set i 0} {$i < $len} {incr i} {
1566 lappend b [$w.top.databases.list get $i]
1568 set profile($target) [list [$w.top.description.entry get] \
1569 [$w.top.host.entry get] \
1570 [$w.top.port.entry get] \
1571 [$w.top.idAuthentication.entry get] \
1572 [$w.top.maximumRecordSize.entry get] \
1573 [$w.top.preferredMessageSize.entry get] \
1579 $protocolRadioType \
1583 dputs $profile($target)
1587 proc place-force {window parent} {
1588 set g [wm geometry $parent]
1590 set p1 [string first + $g]
1591 set p2 [string last + $g]
1593 set x [expr 40+[string range $g [expr $p1 +1] [expr $p2 -1]]]
1594 set y [expr 60+[string range $g [expr $p2 +1] end]]
1595 wm geometry $window +${x}+${y}
1598 proc add-database-action {target} {
1601 set wno [lindex $profile($target) 12]
1604 $w.top.databases.list insert end \
1605 [.database-select.top.database.entry get]
1606 destroy .database-select
1609 proc add-database {target} {
1612 set w .database-select
1614 set oldFocus [focus]
1617 set wno [lindex $profile($target) 12]
1618 place-force $w .setup-${wno}
1622 frame $w.top.database
1624 pack $w.top.database -side top -anchor e -pady 2
1626 entry-fields $w.top {database} \
1627 {{Database to add:}} \
1628 [list add-database-action $target] {destroy .database-select}
1630 top-down-ok-cancel $w [list add-database-action $target] 1
1634 proc delete-database {target} {
1637 set wno [lindex $profile($target) 12]
1640 foreach i [$w.top.databases.list curselection] {
1641 set b [$w.top.databases.list get $i]
1644 set a [alert "Are you sure you want to remove the database(s)${l}?"]
1646 foreach i [lsort -decreasing \
1647 [$w.top.databases.list curselection]] {
1648 $w.top.databases.list delete $i
1653 proc protocol-setup {target} {
1656 global protocolRadioType
1659 global ResultSetCheck
1661 set wno [lindex $profile($target) 12]
1666 wm title $w "Setup $target"
1670 if {$target == ""} {
1674 dputs $profile($target)
1678 frame $w.top.description
1679 frame $w.top.idAuthentication
1680 frame $w.top.maximumRecordSize
1681 frame $w.top.preferredMessageSize
1682 frame $w.top.cs-type -relief ridge -border 2
1683 frame $w.top.protocol -relief ridge -border 2
1684 frame $w.top.query -relief ridge -border 2
1685 frame $w.top.databases -relief ridge -border 2
1687 # Maximum/preferred/idAuth ...
1688 pack $w.top.description $w.top.host $w.top.port \
1689 $w.top.idAuthentication $w.top.maximumRecordSize \
1690 $w.top.preferredMessageSize -side top -anchor e -pady 2
1692 entry-fields $w.top {description host port idAuthentication \
1693 maximumRecordSize preferredMessageSize} \
1694 {{Description:} {Host:} {Port:} {Id Authentication:} \
1695 {Maximum Record Size:} {Preferred Message Size:}} \
1696 [list protocol-setup-action $target] [list destroy $w]
1698 foreach sub {description host port idAuthentication \
1699 maximumRecordSize preferredMessageSize} {
1701 bind $w.top.$sub.entry <Control-a> [list add-database $target]
1702 bind $w.top.$sub.entry <Control-d> [list delete-database $target]
1704 $w.top.description.entry insert 0 [lindex $profile($target) 0]
1705 $w.top.host.entry insert 0 [lindex $profile($target) 1]
1706 $w.top.port.entry insert 0 [lindex $profile($target) 2]
1707 $w.top.idAuthentication.entry insert 0 [lindex $profile($target) 3]
1708 $w.top.maximumRecordSize.entry insert 0 [lindex $profile($target) 4]
1709 $w.top.preferredMessageSize.entry insert 0 [lindex $profile($target) 5]
1710 set csRadioType [lindex $profile($target) 6]
1711 set RPNCheck [lindex $profile($target) 8]
1712 set CCLCheck [lindex $profile($target) 9]
1713 set ResultSetCheck [lindex $profile($target) 10]
1714 set protocolRadioType [lindex $profile($target) 11]
1715 if {$protocolRadioType == ""} {
1716 set protocolRadioType Z39
1720 pack $w.top.databases -side left -pady 4 -padx 4 -expand yes -fill both
1722 label $w.top.databases.label -text "Databases"
1723 button $w.top.databases.add -text "Add" \
1724 -command [list add-database $target]
1725 button $w.top.databases.delete -text "Delete" \
1726 -command [list delete-database $target]
1727 listbox $w.top.databases.list -geometry 20x6 \
1728 -yscrollcommand "$w.top.databases.scroll set"
1729 scrollbar $w.top.databases.scroll -orient vertical -border 1
1730 pack $w.top.databases.label -side top -fill x \
1732 pack $w.top.databases.add $w.top.databases.delete -side top -fill x \
1734 pack $w.top.databases.list -side left -fill both -expand yes \
1736 pack $w.top.databases.scroll -side right -fill y \
1738 $w.top.databases.scroll config -command "$w.top.databases.list yview"
1740 foreach b [lindex $profile($target) 7] {
1741 $w.top.databases.list insert end $b
1745 pack $w.top.cs-type -pady 4 -padx 4 -side top -fill x
1747 label $w.top.cs-type.label -text "Transport"
1748 radiobutton $w.top.cs-type.tcpip -text "TCP/IP" -anchor w \
1749 -variable csRadioType -value tcpip
1750 radiobutton $w.top.cs-type.mosi -text "MOSI" -anchor w\
1751 -variable csRadioType -value mosi
1753 pack $w.top.cs-type.label $w.top.cs-type.tcpip $w.top.cs-type.mosi \
1754 -padx 4 -side top -fill x
1757 pack $w.top.protocol -pady 4 -padx 4 -side top -fill x
1759 label $w.top.protocol.label -text "Protocol"
1760 radiobutton $w.top.protocol.z39v2 -text "Z39.50" -anchor w \
1761 -variable protocolRadioType -value Z39
1762 radiobutton $w.top.protocol.sr -text "SR" -anchor w \
1763 -variable protocolRadioType -value SR
1765 pack $w.top.protocol.label $w.top.protocol.z39v2 $w.top.protocol.sr \
1766 -padx 4 -side top -fill x
1769 pack $w.top.query -pady 4 -padx 4 -side top -fill x
1771 label $w.top.query.label -text "Query support"
1772 checkbutton $w.top.query.c1 -text "RPN query" -anchor w -variable RPNCheck
1773 checkbutton $w.top.query.c2 -text "CCL query" -anchor w -variable CCLCheck
1774 checkbutton $w.top.query.c3 -text "Result sets" -anchor w -variable ResultSetCheck
1776 pack $w.top.query.label -side top
1777 pack $w.top.query.c1 $w.top.query.c2 $w.top.query.c3 \
1778 -padx 4 -side top -fill x
1781 bottom-buttons $w [list {Ok} [list protocol-setup-action $target] \
1782 {Delete} [list protocol-setup-delete $target] \
1783 {Cancel} [list destroy $w]] 0
1786 proc database-select-action {} {
1787 set w .database-select.top
1789 foreach indx [$w.databases.list curselection] {
1790 lappend b [$w.databases.list get $indx]
1793 z39 databaseNames $b
1795 destroy .database-select
1798 proc database-select {} {
1799 set w .database-select
1809 frame $w.top.databases -relief ridge -border 2
1811 pack $w.top.databases -side left -pady 6 -padx 6 -expand yes -fill x
1813 label $w.top.databases.label -text "List"
1814 listbox $w.top.databases.list -geometry 20x6 \
1815 -yscrollcommand "$w.top.databases.scroll set"
1816 scrollbar $w.top.databases.scroll -orient vertical -border 1
1817 pack $w.top.databases.label -side top -fill x \
1819 pack $w.top.databases.list -side left -fill both -expand yes \
1821 pack $w.top.databases.scroll -side right -fill y \
1823 $w.top.databases.scroll config -command "$w.top.databases.list yview"
1825 foreach b [lindex $profile($hostid) 7] {
1826 $w.top.databases.list insert end $b
1828 top-down-ok-cancel $w {database-select-action} 1
1831 proc cascade-target-list {} {
1834 foreach sub [winfo children .top.target.m.clist] {
1837 .top.target.m.clist delete 0 last
1838 foreach n [array names profile] {
1839 if {$n != "Default"} {
1840 set nl [lindex $profile($n) 12]
1841 if {[llength [lindex $profile($n) 7]] > 1} {
1842 .top.target.m.clist add cascade -label $n \
1843 -menu .top.target.m.clist.$nl
1844 menu .top.target.m.clist.$nl
1845 foreach b [lindex $profile($n) 7] {
1846 .top.target.m.clist.$nl add command -label $b \
1847 -command [list reopen-target $n $b]
1850 .top.target.m.clist add command -label $n \
1851 -command [list reopen-target $n {}]
1855 .top.target.m.slist delete 0 last
1856 foreach n [array names profile] {
1857 if {$n != "Default"} {
1858 .top.target.m.slist add command -label $n \
1859 -command [list protocol-setup $n]
1864 proc query-select {i} {
1865 global queryButtonsFind
1866 global queryInfoFind
1870 set queryInfoFind [lindex $queryInfo $i]
1871 set queryButtonsFind [lindex $queryButtons $i]
1873 index-lines .lines 1 $queryButtonsFind $queryInfoFind activate-index
1876 proc query-new-action {} {
1880 global settingsChanged
1882 set settingsChanged 1
1883 lappend queryTypes [.query-new.top.index.entry get]
1884 lappend queryButtons {}
1885 lappend queryInfo {}
1899 -side top -anchor e -pady 2
1900 entry-fields $w.top index \
1902 query-new-action {destroy .query-new}
1903 top-down-ok-cancel $w query-new-action 1
1906 proc query-delete-action {queryNo} {
1910 global settingsChanged
1912 set settingsChanged 1
1914 set queryTypes [lreplace $queryTypes $queryNo $queryNo]
1915 set queryButtons [lreplace $queryButtons $queryNo $queryNo]
1916 set queryInfo [lreplace $queryInfo $queryNo $queryNo]
1917 destroy .query-delete
1921 proc query-delete {queryNo} {
1929 set n [lindex $queryTypes $queryNo]
1931 label $w.top.warning -bitmap warning
1932 message $w.top.quest -text "Are you sure you want to delete the \
1933 query type $n ?" -aspect 300
1934 pack $w.top.warning $w.top.quest -side left -expand yes -padx 10 -pady 5
1935 bottom-buttons $w [list {Ok} [list query-delete-action $queryNo] \
1936 {Cancel} [list destroy $w]] 1
1939 proc cascade-query-list {} {
1941 set w .top.options.m.query
1944 $w.slist delete 0 last
1945 foreach n $queryTypes {
1946 $w.slist add command -label $n -command [list query-setup $i]
1951 $w.clist delete 0 last
1952 foreach n $queryTypes {
1953 $w.clist add command -label $n -command [list query-select $i]
1957 $w.dlist delete 0 last
1958 foreach n $queryTypes {
1959 $w.dlist add command -label $n -command [list query-delete $i]
1964 proc save-geometry {} {
1965 global windowGeometry
1968 global displayFormat
1972 set windowGeometry(.) [wm geometry .]
1974 set f [open "~/.clientrc.tcl" w]
1976 puts $f "set hotTargets \{ $hotTargets \}"
1977 puts $f "set textWrap $textWrap"
1978 puts $f "set displayFormat $displayFormat"
1979 puts $f "set popupMarcdf $popupMarcdf"
1980 puts $f "set recordSyntax $recordSyntax"
1981 foreach n [array names windowGeometry] {
1982 puts -nonewline $f "set \{windowGeometry($n)\} \{"
1983 puts -nonewline $f $windowGeometry($n)
1989 proc save-settings {} {
1992 global settingsChanged
1997 if {![file writable "${libdir}/clientrc.tcl"]} {
1998 set a [alert "Cannot open ${libdir}/clientrc.tcl for writing. Do you \
1999 wish to save clientrc.tcl in the current directory instead?"]
2003 set f [open "clientrc.tcl" w]
2005 set f [open "${libdir}/clientrc.tcl" w]
2007 puts $f "# Setup file"
2009 foreach n [array names profile] {
2010 puts -nonewline $f "set \{profile($n)\} \{"
2011 puts -nonewline $f $profile($n)
2014 puts -nonewline $f "set queryTypes \{"
2015 puts -nonewline $f $queryTypes
2018 puts -nonewline $f "set queryButtons \{"
2019 puts -nonewline $f $queryButtons
2022 puts -nonewline $f "set queryInfo \{"
2023 puts -nonewline $f $queryInfo
2026 set settingsChanged 0
2038 label $w.top.warning -bitmap warning
2039 message $w.top.message -text $ask -aspect 300 \
2040 -font -Adobe-Times-Medium-R-Normal-*-180-*
2042 pack $w.top.warning $w.top.message -side left -pady 5 -padx 10 -expand yes
2045 top-down-ok-cancel $w {alert-action} 1
2049 proc alert-action {} {
2055 proc exit-action {} {
2056 global settingsChanged
2058 if {$settingsChanged} {
2059 set a [alert "you haven't saved your settings. Do you wish to save?"]
2068 proc listbuttonaction {w name h user i} {
2069 $w configure -text [lindex $name 0]
2070 $h [lindex $name 1] $user $i
2073 proc listbuttonx {button no names handle user} {
2074 if {[winfo exists $button]} {
2075 $button configure -text [lindex [lindex $names $no] 0]
2076 ${button}.m delete 0 last
2078 menubutton $button -text [lindex [lindex $names $no] 0] \
2079 -width 10 -menu ${button}.m -relief raised -border 1
2083 foreach name $names {
2084 ${button}.m add command -label [lindex $name 0] \
2085 -command [list listbuttonaction ${button} $name \
2091 proc listbutton {button no names} {
2092 menubutton $button -text [lindex $names $no] -width 10 -menu ${button}.m \
2093 -relief raised -border 1
2095 foreach name $names {
2096 ${button}.m add command -label $name \
2097 -command [list ${button} configure -text $name]
2101 proc listbuttonv-action {button var names i} {
2104 set $var [lindex $names [expr $i+1]]
2105 $button configure -text [lindex $names $i]
2108 proc listbuttonv {button var names} {
2112 eval "set val $$var"
2113 set l [llength $names]
2114 for {set i 1} {$i < $l} {incr i 2} {
2115 if {$val == [lindex $names $i]} {
2117 set n [lindex $names $i]
2121 if {[winfo exists $button]} {
2122 $button configure -text $n
2125 menubutton $button -text $n -menu ${button}.m \
2126 -relief raised -border 1
2128 for {set i 0} {$i < $l} {incr i 2} {
2129 ${button}.m add command -label [lindex $names $i] \
2130 -command [list listbuttonv-action $button $var $names $i]
2134 proc query-add-index-action {queryNo} {
2138 global queryButtonsTmp
2140 set newI [.query-add-index.top.index.entry get]
2141 lappend queryInfoTmp [list $newI {}]
2142 $w.top.index.list insert end $newI
2143 destroy .query-add-index
2144 #destroy $w.top.lines
2145 #frame $w.top.lines -relief ridge -border 2
2146 index-lines $w.top.lines 0 $queryButtonsTmp $queryInfoTmp activate-e-index
2147 #pack $w.top.lines -side left -pady 6 -padx 6 -fill y
2150 proc query-add-line {queryNo} {
2154 global queryButtonsTmp
2156 lappend queryButtonsTmp {I 0}
2158 #destroy $w.top.lines
2159 #frame $w.top.lines -relief ridge -border 2
2160 index-lines $w.top.lines 0 $queryButtonsTmp $queryInfoTmp activate-e-index
2161 #pack $w.top.lines -side left -pady 6 -padx 6 -fill y
2164 proc query-del-line {queryNo} {
2168 global queryButtonsTmp
2170 set l [llength $queryButtonsTmp]
2175 set queryButtonsTmp [lreplace $queryButtonsTmp $l $l]
2176 index-lines $w.top.lines 0 $queryButtonsTmp $queryInfoTmp activate-e-index
2179 proc query-add-index {queryNo} {
2180 set w .query-add-index
2183 place-force $w .query-setup
2187 -side top -anchor e -pady 2
2188 entry-fields $w.top {index} \
2190 [list query-add-index-action $queryNo] [list destroy $w]
2191 top-down-ok-cancel $w [list query-add-index-action $queryNo] 1
2194 proc query-setup-action {queryNo} {
2197 global queryButtonsTmp
2199 global queryButtonsFind
2200 global queryInfoFind
2202 global settingsChanged
2204 set settingsChanged 1
2206 set queryInfo [lreplace $queryInfo $queryNo $queryNo \
2208 set queryButtons [lreplace $queryButtons $queryNo $queryNo \
2210 set queryInfoFind $queryInfoTmp
2211 set queryButtonsFind $queryButtonsTmp
2213 destroy .query-setup
2214 index-lines .lines 1 $queryButtonsFind $queryInfoFind activate-index
2217 proc activate-e-index {value no i} {
2218 global queryButtonsTmp
2219 global queryIndexTmp
2221 set queryButtonsTmp [lreplace $queryButtonsTmp $no $no [list I $i]]
2222 dputs $queryButtonsTmp
2223 set queryIndexTmp $i
2226 proc activate-index {value no i} {
2227 global queryButtonsFind
2229 set queryButtonsFind [lreplace $queryButtonsFind $no $no [list I $i]]
2231 dputs "queryButtonsFind $queryButtonsFind"
2234 proc update-attr {} {
2236 listbuttonv $w.top.relation.b relationTmpValue\
2237 {{None} 0 {Less than} 1 {Greater than or equal} 2 {Equal} 3 \
2238 {Greater than or equal} 4 {Greater than} 5 {Not equal} 6 \
2239 {Phonetic} 100 {Stem} 101 {Relevance} 102 {AlwaysMatches} 103}
2240 listbuttonv $w.top.position.b positionTmpValue {{None} 0 \
2241 {First in field} 1 {First in subfield} 2 {Any position in field} 3}
2242 listbuttonv $w.top.structure.b structureTmpValue {{None} 0 {Phrase} 1 \
2243 {Word} 2 {Key} 3 {Year} 4 {Date (norm)} 5 {Word list} 6 \
2244 {Date (un-norm)} 100 {Name (norm)} 101 {Date (un-norm)} 102 \
2245 {Structure} 103 {urx} 104 {free-form} 105 {doc-text} 106 \
2246 {local-number} 107 {string} 108 {numeric string} 109}
2247 listbuttonv $w.top.truncation.b truncationTmpValue {{Auto} 0 {Right} 1 \
2248 {Left} 2 {Left and right} 3 {No truncation} 100 \
2249 {Process #} 101 {Re-1} 102 {Re-2} 103}
2250 listbuttonv $w.top.completeness.b completenessTmpValue {{None} 0 \
2251 {Incomplete subfield} 1 {Complete subfield} 2 {Complete field} 3}
2254 proc use-attr {init} {
2266 {BNB card number} 10
2267 {BGF(sic) number} 11
2269 {Dewey classification} 13
2270 {UDC classification} 14
2271 {Bliss classification} 15
2273 {NLM call number} 17
2274 {NAL call number} 18
2275 {MOS call number} 19
2276 {Local classification} 20
2277 {Subject heading} 21
2279 {BDI-index-subject} 23
2283 {LC-subject-heading} 27
2284 {RVM-subject-heading} 28
2285 {Local subject index} 29
2287 {Date of publication} 31
2288 {Date of acquisition} 32
2290 {Title-collective} 34
2293 {Title-added-title-page} 37
2297 {Title-other-variant} 41
2299 {Title-abbreviated} 43
2303 {Subject-subdivision} 47
2304 {Number-natl-bibliography} 48
2305 {Number-legal-deposit} 49
2306 {Number-govt-publication} 50
2307 {Number-publisher-for-music} 51
2309 {Number-local-call} 53
2311 {Code-geographic-area} 55
2312 {Code-institution} 56
2314 {Name-geographic} 58
2315 {Place-publication} 59
2317 {Microform-generation} 61
2324 {Author-name-personal} 1004
2325 {Author-name-corporate} 1005
2326 {Author-name-conference} 1006
2327 {Identifier-standard} 1007
2328 {Subject-LC-children's} 1008
2329 {Subject-name-personal} 1009
2331 {Date/time added to database} 1011
2332 {Date/time last modified} 1012
2333 {Authority/format identifier} 1013
2335 {Concept-reference} 1015
2337 {Server choice} 1017
2339 {Record source} 1019
2342 {Geographic class} 1022
2346 {Related periodical} 1026
2347 {Report number} 1027
2349 {Thematic number} 1030
2350 {Material type} 1031
2358 set l [llength $attr]
2363 for {set i 0} {$i < $l} {incr i} {
2364 $w.top.use.list insert end [lindex $attr $i]
2366 if {$useTmpValue == [lindex $attr $i]} {
2371 $w.top.use.list select from $s
2372 $w.top.use.list select to $s
2377 $w.top.use.list yview $s
2379 set lno [lindex [$w.top.use.list curselection] 0]
2380 set i [expr $lno+$lno+1]
2381 set useTmpValue [lindex $attr $i]
2382 dputs "useTmpValue=$useTmpValue"
2386 proc index-setup-action {oldAttr queryNo indexNo} {
2387 set attr [lindex $oldAttr 0]
2390 global relationTmpValue
2391 global structureTmpValue
2392 global truncationTmpValue
2393 global completenessTmpValue
2394 global positionTmpValue
2399 dputs "index-setup-action"
2400 dputs "queryNo $queryNo"
2401 dputs "indexNo $indexNo"
2402 if {$useTmpValue > 0} {
2403 lappend attr "1=$useTmpValue"
2405 if {$relationTmpValue > 0} {
2406 lappend attr "2=$relationTmpValue"
2408 if {$positionTmpValue > 0} {
2409 lappend attr "3=$positionTmpValue"
2411 if {$structureTmpValue > 0} {
2412 lappend attr "4=$structureTmpValue"
2414 if {$truncationTmpValue > 0} {
2415 lappend attr "5=$truncationTmpValue"
2417 if {$completenessTmpValue > 0} {
2418 lappend attr "6=$completenessTmpValue"
2420 dputs "new attr $attr"
2421 set queryInfoTmp [lreplace $queryInfoTmp $indexNo $indexNo $attr]
2422 destroy .index-setup
2425 proc index-setup {attr queryNo indexNo} {
2428 global relationTmpValue
2429 global structureTmpValue
2430 global truncationTmpValue
2431 global completenessTmpValue
2432 global positionTmpValue
2434 set relationTmpValue 0
2435 set truncationTmpValue 0
2436 set structureTmpValue 0
2437 set positionTmpValue 0
2438 set completenessTmpValue 0
2441 set len [llength $attr]
2442 for {set i 1} {$i < $len} {incr i} {
2443 set q [lindex $attr $i]
2444 set l [string first = $q]
2446 set t [string range $q 0 [expr $l - 1]]
2447 set v [string range $q [expr $l + 1] end]
2450 { set useTmpValue $v }
2452 { set relationTmpValue $v }
2454 { set positionTmpValue $v }
2456 { set structureTmpValue $v }
2458 { set truncationTmpValue $v }
2460 { set completenessTmpValue $v }
2464 if {[winfo exists $w]} {
2469 set n [lindex $attr 0]
2470 wm title $w "Index setup $n"
2474 frame $w.top.use -relief ridge -border 2
2475 frame $w.top.relation -relief ridge -border 2
2476 frame $w.top.position -relief ridge -border 2
2477 frame $w.top.structure -relief ridge -border 2
2478 frame $w.top.truncation -relief ridge -border 2
2479 frame $w.top.completeness -relief ridge -border 2
2485 pack $w.top.use -side left -pady 6 -padx 6 -fill y
2487 label $w.top.use.label -text "Use"
2488 listbox $w.top.use.list -geometry 26x10 \
2489 -yscrollcommand "$w.top.use.scroll set"
2490 scrollbar $w.top.use.scroll -orient vertical -border 1
2491 pack $w.top.use.label -side top -fill x \
2493 pack $w.top.use.list -side left -fill both -expand yes \
2495 pack $w.top.use.scroll -side right -fill y \
2497 $w.top.use.scroll config -command "$w.top.use.list yview"
2501 # Relation Attributes
2503 pack $w.top.relation -pady 6 -padx 6 -side top
2504 label $w.top.relation.label -text "Relation" -width 18
2506 pack $w.top.relation.label $w.top.relation.b -fill x
2508 # Position Attributes
2510 pack $w.top.position -pady 6 -padx 6 -side top
2511 label $w.top.position.label -text "Position" -width 18
2513 pack $w.top.position.label $w.top.position.b -fill x
2515 # Structure Attributes
2517 pack $w.top.structure -pady 6 -padx 6 -side top
2518 label $w.top.structure.label -text "Structure" -width 18
2520 pack $w.top.structure.label $w.top.structure.b -fill x
2522 # Truncation Attributes
2524 pack $w.top.truncation -pady 6 -padx 6 -side top
2525 label $w.top.truncation.label -text "Truncation" -width 18
2527 pack $w.top.truncation.label $w.top.truncation.b -fill x
2529 # Completeness Attributes
2531 pack $w.top.completeness -pady 6 -padx 6 -side top
2532 label $w.top.completeness.label -text "Completeness" -width 18
2534 pack $w.top.completeness.label $w.top.completeness.b -fill x
2537 bottom-buttons $w [list \
2538 {Ok} [list index-setup-action $attr $queryNo $indexNo] \
2539 {Cancel} [list destroy $w]] 0
2543 proc query-edit-index {queryNo} {
2547 set i [lindex [$w.top.index.list curselection] 0]
2551 set attr [lindex $queryInfoTmp $i]
2552 dputs "Editing no $i $attr"
2553 index-setup $attr $queryNo $i
2556 proc query-delete-index {queryNo} {
2558 global queryButtonsTmp
2561 set i [lindex [$w.top.index.list curselection] 0]
2565 set queryInfoTmp [lreplace $queryInfoTmp $i $i]
2566 index-lines $w.top.lines 0 $queryButtonsTmp $queryInfoTmp activate-e-index
2567 $w.top.index.list delete $i
2570 proc query-setup {queryNo} {
2576 global queryButtonsTmp
2578 global queryIndexTmp
2581 set queryName [lindex $queryTypes $queryNo]
2582 set queryInfoTmp [lindex $queryInfo $queryNo]
2583 set queryButtonsTmp [lindex $queryButtons $queryNo]
2588 wm title $w "Query setup $queryName"
2592 frame $w.top.lines -relief ridge -border 2
2594 pack $w.top.lines -side left -pady 6 -padx 6 -fill y
2598 index-lines $w.top.lines 0 $queryButtonsTmp $queryInfoTmp activate-e-index
2600 button $w.top.lines.add -text "Add" \
2601 -command [list query-add-line $queryNo]
2602 button $w.top.lines.del -text "Remove" \
2603 -command [list query-del-line $queryNo]
2605 pack $w.top.lines.del -fill x -side bottom
2606 pack $w.top.lines.add -fill x -pady 10 -side bottom
2610 frame $w.top.index -relief ridge -border 2
2611 pack $w.top.index -pady 6 -padx 6 -side right -fill y
2613 listbox $w.top.index.list -yscrollcommand [list $w.top.index.scroll set]
2614 scrollbar $w.top.index.scroll -orient vertical -border 1 \
2615 -command [list $w.top.index.list yview]
2616 bind $w.top.index.list <2> [list query-edit-index $queryNo]
2618 pack $w.top.index.list -side left -fill both -expand yes -padx 2 -pady 2
2619 pack $w.top.index.scroll -side right -fill y -padx 2 -pady 2
2621 $w.top.index.list select from 0
2622 $w.top.index.list select to 0
2624 foreach x $queryInfoTmp {
2625 $w.top.index.list insert end [lindex $x 0]
2628 bottom-buttons $w [list \
2629 {Ok} [list query-setup-action $queryNo] \
2630 {Add index} [list query-add-index $queryNo] \
2631 {Edit index} [list query-edit-index $queryNo] \
2632 {Delete index} [list query-delete-index $queryNo] \
2633 {Cancel} [list destroy $w]] 0
2636 proc index-clear {} {
2637 global queryButtonsFind
2640 foreach b $queryButtonsFind {
2641 .lines.$i.e delete 0 end
2646 proc index-query {} {
2647 global queryButtonsFind
2648 global queryInfoFind
2653 foreach b $queryButtonsFind {
2654 set term [string trim [.lines.$i.e get]]
2656 set attr [lrange [lindex $queryInfoFind [lindex $b 1]] 1 end]
2658 set len [string length $term]
2662 if {[string index $term $len] == "?"} {
2664 set term [string range $term 0 [expr $len - 1]]
2666 if {[string index $term 0] == "?"} {
2668 set term [string range $term 1 end]
2670 set term "\{${term}\}"
2671 if {$right && $left} {
2672 set term "@attr 5=3 ${term}"
2674 set term "@attr 5=1 ${term}"
2676 set term "@attr 5=2 ${term}"
2679 set term "@attr $a ${term}"
2682 set qs "@and ${qs} ${term}"
2693 proc index-focus-in {w i} {
2694 global curIndexEntry
2696 $w.$i configure -background red
2697 set curIndexEntry $i
2700 proc index-lines {w realOp buttonInfo queryInfo handle} {
2702 foreach b $buttonInfo {
2703 if {! [winfo exists $w.$i]} {
2704 frame $w.$i -background white -border 1
2706 listbuttonx $w.$i.l [lindex $b 1] $queryInfo $handle $i
2709 if {! [winfo exists $w.$i.e]} {
2710 entry $w.$i.e -width 32 -relief sunken -border 1
2711 bind $w.$i.e <FocusIn> [list index-focus-in $w $i]
2712 bind $w.$i.e <FocusOut> [list $w.$i configure \
2714 pack $w.$i.l -side left
2715 pack $w.$i.e -side left -fill x -expand yes
2716 pack $w.$i -side top -fill x -padx 2 -pady 2
2717 bind $w.$i.e <Left> [list left-cursor $w.$i.e]
2718 bind $w.$i.e <Right> [list right-cursor $w.$i.e]
2719 bind $w.$i.e <Return> {search-request 0}
2722 pack $w.$i.l -side left
2723 pack $w.$i -side top -fill x -padx 2 -pady 2
2728 while {[winfo exists $w.$j]} {
2739 bind $w.$j.e <Tab> "focus $w.$k.e"
2743 bind $w.$i.e <Tab> "focus $w.0.e"
2748 proc search-fields {w buttondefs} {
2750 foreach buttondef $buttondefs {
2751 frame $w.$i -background white
2753 listbutton $w.$i.l 0 $buttondef
2754 entry $w.$i.e -width 32 -relief sunken
2756 pack $w.$i.l -side left
2757 pack $w.$i.e -side left -fill x -expand yes
2759 pack $w.$i -side top -fill x -padx 2 -pady 2
2761 bind $w.$i.e <Left> [list left-cursor $w.$i.e]
2762 bind $w.$i.e <Right> [list right-cursor $w.$i.e]
2770 bind $w.$j.e <Tab> "focus $w.$k.e \n
2771 $w.$k configure -background red \n
2772 $w.$j configure -background white"
2775 bind $w.$i.e <Tab> "focus $w.0.e \n
2776 $w.0 configure -background red \n
2777 $w.$i configure -background white"
2779 $w.0 configure -background red
2782 if {[info exists windowGeometry(.)]} {
2783 set g $windowGeometry(.)
2791 frame .top -border 1 -relief raised
2792 frame .lines -border 1 -relief raised
2793 frame .mid -border 1 -relief raised
2794 frame .data -border 1 -relief raised
2795 frame .bot -border 1 -relief raised
2796 pack .top .lines .mid -side top -fill x
2797 pack .data -side top -fill both -expand yes
2800 menubutton .top.file -text "File" -menu .top.file.m
2802 .top.file.m add command -label "Save settings" -command {save-settings}
2803 .top.file.m add separator
2804 .top.file.m add command -label "Exit" -command {exit-action}
2806 menubutton .top.target -text "Target" -menu .top.target.m
2808 .top.target.m add cascade -label "Connect" -menu .top.target.m.clist
2809 .top.target.m add command -label "Disconnect" -command {close-target}
2810 .top.target.m add command -label "About" -command {about-target}
2811 .top.target.m add cascade -label "Setup" -menu .top.target.m.slist
2812 .top.target.m add command -label "Setup new" -command {define-target-dialog}
2813 .top.target.m add separator
2816 .top.target.m disable 1
2817 .top.target.m disable 2
2819 menu .top.target.m.clist
2820 menu .top.target.m.slist
2823 menubutton .top.service -text "Service" -menu .top.service.m
2825 .top.service.m add command -label "Database" -command {database-select}
2826 .top.service.m add cascade -label "Present" -menu .top.service.m.present
2827 menu .top.service.m.present
2828 .top.service.m.present add command -label "10 More" \
2829 -command [list present-more 10]
2830 .top.service.m.present add command -label "All" \
2831 -command [list present-more {}]
2832 .top.service.m add command -label "Search" -command {search-request 0}
2833 .top.service.m add command -label "Scan" -command {scan-request}
2835 .top.service configure -state disabled
2837 menubutton .top.rset -text "Set" -menu .top.rset.m
2839 .top.rset.m add command -label "Load" -command {load-set}
2840 .top.rset.m add separator
2842 menubutton .top.options -text "Options" -menu .top.options.m
2844 .top.options.m add cascade -label "Query" -menu .top.options.m.query
2845 .top.options.m add cascade -label "Format" -menu .top.options.m.formats
2846 .top.options.m add cascade -label "Wrap" -menu .top.options.m.wrap
2847 .top.options.m add cascade -label "Syntax" -menu .top.options.m.syntax
2849 menu .top.options.m.query
2850 .top.options.m.query add cascade -label "Select" \
2851 -menu .top.options.m.query.clist
2852 .top.options.m.query add cascade -label "Edit" \
2853 -menu .top.options.m.query.slist
2854 .top.options.m.query add command -label "New" \
2855 -command {query-new}
2856 .top.options.m.query add cascade -label "Delete" \
2857 -menu .top.options.m.query.dlist
2859 menu .top.options.m.query.slist
2860 menu .top.options.m.query.clist
2861 menu .top.options.m.query.dlist
2864 menu .top.options.m.formats
2866 foreach f $displayFormats {
2867 .top.options.m.formats add radiobutton -label $f -value $i \
2868 -command [list set-display-format $i] -variable displayFormat
2872 menu .top.options.m.wrap
2873 .top.options.m.wrap add radiobutton -label "Character" \
2874 -value char -variable textWrap -command {set-wrap char}
2875 .top.options.m.wrap add radiobutton -label "Word" \
2876 -value word -variable textWrap -command {set-wrap word}
2877 .top.options.m.wrap add radiobutton -label "None" \
2878 -value none -variable textWrap -command {set-wrap none}
2880 menu .top.options.m.syntax
2881 .top.options.m.syntax add radiobutton -label "None" \
2882 -value None -variable recordSyntax
2883 .top.options.m.syntax add separator
2884 .top.options.m.syntax add radiobutton -label "USMARC" \
2885 -value USMARC -variable recordSyntax
2886 .top.options.m.syntax add radiobutton -label "UNIMARC" \
2887 -value UNIMARC -variable recordSyntax
2888 .top.options.m.syntax add radiobutton -label "UKMARC" \
2889 -value UKMARC -variable recordSyntax
2890 .top.options.m.syntax add radiobutton -label "DANMARC" \
2891 -value DANMARC -variable recordSyntax
2892 .top.options.m.syntax add radiobutton -label "FINMARC" \
2893 -value FINMARC -variable recordSyntax
2894 .top.options.m.syntax add radiobutton -label "NORMARC" \
2895 -value NORMARC -variable recordSyntax
2896 .top.options.m.syntax add radiobutton -label "PICAMARC" \
2897 -value PICAMARC -variable recordSyntax
2898 .top.options.m.syntax add separator
2899 .top.options.m.syntax add radiobutton -label "SUTRS" \
2900 -value SUTRS -variable recordSyntax
2902 menubutton .top.help -text "Help" -menu .top.help.m
2905 .top.help.m add command -label "Help on help" \
2906 -command {tkerror "Help on help not available. Sorry"}
2907 .top.help.m add command -label "About" -command {about-origin}
2909 pack .top.file .top.target .top.service .top.rset .top.options -side left
2910 pack .top.help -side right
2912 index-lines .lines 1 $queryButtonsFind [lindex $queryInfo 0] activate-index
2914 button .mid.search -width 7 -text {Search} -command {search-request 0} \
2916 button .mid.scan -width 7 -text {Scan} \
2917 -command scan-request -state disabled
2918 button .mid.present -width 7 -text {Present} -command [list present-more 10] \
2921 button .mid.clear -width 7 -text {Clear} -command index-clear
2922 pack .mid.search .mid.scan .mid.present .mid.clear -side left \
2923 -fill y -padx 5 -pady 3
2925 text .data.record -height 2 -width 20 -wrap none \
2926 -yscrollcommand [list .data.scroll set] -wrap $textWrap
2927 scrollbar .data.scroll -command [list .data.record yview]
2928 pack .data.scroll -side right -fill y
2929 pack .data.record -expand yes -fill both
2932 if {[tk colormodel .] == "color"} {
2933 .data.record tag configure marc-tag -foreground blue
2934 .data.record tag configure marc-id -foreground red
2936 .data.record tag configure marc-tag -foreground black
2937 .data.record tag configure marc-id -foreground black
2939 .data.record tag configure marc-data -foreground black
2941 button .bot.logo -bitmap @${libdir}/bitmaps/book1 -command cancel-operation
2943 pack .bot.a -side left -fill x
2944 pack .bot.logo -side right -padx 2 -pady 2
2946 message .bot.a.target -text "" -aspect 1000 -border 1
2948 label .bot.a.status -text "Not connected" -width 15 -relief \
2949 sunken -anchor w -border 1
2950 label .bot.a.set -text "" -width 5 -relief \
2951 sunken -anchor w -border 1
2952 label .bot.a.message -text "" -width 15 -relief \
2953 sunken -anchor w -border 1
2955 pack .bot.a.target -side top -anchor nw -padx 2 -pady 2
2956 pack .bot.a.status .bot.a.set .bot.a.message \
2957 -side left -padx 2 -pady 2