1 # IR toolkit for tcl/tk
3 # See the file LICENSE for details.
4 # Sebastian Hammer, Adam Dickmeiss
7 # Revision 1.57 1995-06-29 09:20:30 adam
8 # Target entries in cascade menus are sorted.
10 # Revision 1.56 1995/06/27 19:03:48 adam
11 # Bug fix in do_present in ir-tcl.c: p->set_child member weren't set.
12 # nextResultSetPosition used instead of setOffset.
14 # Revision 1.55 1995/06/27 17:10:37 adam
15 # Bug fix: install procedure didn't work on some systems.
16 # Error turned up when clientrc.tcl was't present.
18 # Revision 1.54 1995/06/27 14:41:03 adam
19 # Bug fix in search-response. Didn't always observe non-surrogate diagnostics.
21 # Revision 1.53 1995/06/26 12:40:09 adam
22 # Client defines its own tkerror.
23 # User may specify 'no preferredRecordSyntax'.
25 # Revision 1.52 1995/06/22 13:14:59 adam
26 # Feature: SUTRS. Setting getSutrs implemented.
27 # Work on display formats.
28 # Preferred record syntax can be set by the user.
30 # Revision 1.51 1995/06/21 11:11:00 adam
31 # Bug fix: libdir undefined in about-origin.
33 # Revision 1.50 1995/06/21 11:04:48 adam
34 # Uses GNU autoconf 2.3.
35 # Install procedure implemented.
36 # boook bitmaps moved to sub directory bitmaps.
38 # Revision 1.49 1995/06/20 14:16:42 adam
39 # More work on cancel mechanism.
41 # Revision 1.48 1995/06/20 08:07:23 adam
42 # New setting: failInfo.
43 # Working on better cancel mechanism.
45 # Revision 1.47 1995/06/19 14:05:29 adam
46 # Bug fix: asked for SUTRS.
48 # Revision 1.46 1995/06/19 13:06:06 adam
49 # New define: IR_TCL_VERSION.
51 # Revision 1.45 1995/06/19 08:08:44 adam
52 # client.tcl: hotTargets now contain both database and target name.
53 # ir-tcl.c: setting protocol edited. Errors in callbacks are logged
54 # by logf(LOG_WARN, ...) calls.
56 # Revision 1.44 1995/06/16 14:55:18 adam
59 # Revision 1.43 1995/06/16 14:41:05 adam
60 # Scan line entries can be copied to a search entry.
62 # Revision 1.42 1995/06/16 12:28:13 adam
63 # Implemented preferredRecordSyntax.
64 # Minor changes in diagnostic handling.
65 # Record list deleted when connection closes.
67 # Revision 1.41 1995/06/14 15:07:59 adam
68 # Bug fix in cascade-target-list. Uses yaz-version.h.
70 # Revision 1.40 1995/06/14 13:37:17 adam
71 # Setting recordType implemented.
72 # Setting implementationVersion implemented.
73 # Settings implementationId / implementationName edited.
75 # Revision 1.39 1995/06/14 12:16:22 adam
76 # hotTargets, textWrap and displayFormat saved in clientg.tcl.
78 # Revision 1.38 1995/06/14 07:22:45 adam
79 # Target definitions can be deleted.
80 # Listbox used in the query definition dialog.
82 # Revision 1.37 1995/06/13 14:37:59 adam
83 # Work on query setup.
84 # Better about origin/target.
85 # Better presentation formats.
87 # Revision 1.36 1995/06/13 07:42:14 adam
88 # Bindings removed from text widgets.
90 # Revision 1.35 1995/06/12 15:17:31 adam
91 # Text widget used in main window (instead of listbox) to support
92 # better presentation formats.
94 # Revision 1.34 1995/06/12 07:59:07 adam
95 # More work on geometry handling.
97 # Revision 1.33 1995/06/09 11:17:35 adam
98 # Start work on geometry management.
100 # Revision 1.32 1995/06/07 09:16:37 adam
101 # New presentation format.
103 # Revision 1.31 1995/06/06 16:31:09 adam
104 # Bug fix: target names couldn't contain blanks.
107 # Revision 1.30 1995/06/06 11:35:41 adam
108 # Work on scan. Display of old sets.
110 # Revision 1.29 1995/06/05 14:11:18 adam
111 # Bug fix in present-more.
113 # Revision 1.28 1995/06/02 14:52:13 adam
114 # Minor changes really.
116 # Revision 1.27 1995/06/02 14:29:42 adam
117 # Work on scan interface - up/down buttons.
119 # Revision 1.26 1995/06/01 16:36:46 adam
120 # About buttons. Minor bug fixes.
122 # Revision 1.25 1995/05/31 13:09:57 adam
123 # Client searches/presents may be interrupted.
124 # New moving book-logo.
126 # Revision 1.24 1995/05/31 08:36:24 adam
127 # Bug fix in client.tcl: didn't save options on clientrc.tcl.
128 # New method: referenceId. More work on scan.
130 # Revision 1.23 1995/05/29 10:33:41 adam
131 # README and rename of startup script.
133 # Revision 1.22 1995/05/26 11:44:09 adam
134 # Bugs fixed. More work on MARC utilities and queries. Test
135 # client is up-to-date again.
137 # Revision 1.21 1995/05/11 15:34:46 adam
138 # Scan request changed a bit. This version works with RLG.
140 # Revision 1.20 1995/04/21 16:31:57 adam
141 # New radiobutton: protocol (z39v2/SR).
143 # Revision 1.19 1995/04/18 16:11:50 adam
144 # First version of graphical Scan. Some work on query-by-form.
146 # Revision 1.18 1995/04/10 10:50:22 adam
147 # Result-set name defaults to suffix of ir-set name.
148 # Started working on scan. Not finished at this point.
150 # Revision 1.17 1995/03/31 09:34:57 adam
151 # Search-button disabled when there is no connection.
153 # Revision 1.16 1995/03/31 08:56:36 adam
154 # New button "Search".
156 # Revision 1.15 1995/03/28 12:45:22 adam
157 # New ir method failback: called on disconnect/protocol error.
158 # New ir set/get method: protocol: SR / Z3950.
159 # Simple popup and disconnect when failback is invoked.
161 # Revision 1.14 1995/03/22 16:07:55 adam
164 # Revision 1.13 1995/03/21 17:27:26 adam
165 # Short-hand keys in setup.
167 # Revision 1.12 1995/03/21 13:41:03 adam
168 # Comstack cs_create not used too often. Non-blocking connect.
170 # Revision 1.11 1995/03/21 10:39:06 adam
171 # Diagnostic error message displayed with tkerror.
173 # Revision 1.10 1995/03/20 15:24:06 adam
174 # Diagnostic records saved on searchResponse.
176 # Revision 1.9 1995/03/17 18:26:16 adam
177 # Non-blocking i/o used now. Database names popup as cascade items.
179 # Revision 1.8 1995/03/17 15:45:00 adam
180 # Improved target/database setup.
182 # Revision 1.7 1995/03/16 17:54:03 adam
183 # Minor changes really.
185 # Revision 1.6 1995/03/15 19:10:20 adam
186 # Database setup in protocol-setup (rather target setup).
188 # Revision 1.5 1995/03/15 13:59:23 adam
191 # Revision 1.4 1995/03/14 17:32:29 adam
192 # Presentation of full Marc record in popup window.
194 # Revision 1.3 1995/03/12 19:31:52 adam
195 # Pattern matching implemented when retrieving MARC records. More
196 # diagnostic functions.
198 # Revision 1.2 1995/03/10 18:00:15 adam
199 # Actual presentation in line-by-line format. RPN query support.
201 # Revision 1.1 1995/03/09 16:15:07 adam
202 # First presentRequest attempts. Hot-target list.
207 if {[file readable bitmaps/book2]} {
210 if {! [file readable ${libdir}/bitmaps/book2]} {
211 puts "Cannot locate system files in ${libdir}. You must either run this"
212 puts "program from the source directory root of ir-tcl or you must assure"
213 puts "that it is installed - normally in /usr/local/lib/irtcl"
221 set profile(Default) {{} {} {210} {} 16384 8192 tcpip {} 1 {} {} Z39 1}
223 set settingsChanged 0
232 set recordSyntax None
235 set queryTypes {Simple}
236 set queryButtons { { {I 0} {I 1} {I 2} } }
237 set queryInfo { { {Title {1=4 4=1}} {Author {1=1}} \
238 {Subject {1=21}} {Any {1=1016}} } }
247 if {[winfo exists $w]} {
256 label $w.top.b -bitmap error
257 message $w.top.t -aspect 300 -text "Error: $err" \
258 -font -Adobe-Helvetica-Bold-R-Normal-*-240-*
259 pack $w.top.b $w.top.t -side left -padx 10 -pady 10
261 bottom-buttons $w [list {Close} [list destroy $w]] 1
264 proc read-formats {} {
265 global displayFormats
267 set formats [glob -nocomplain ${libdir}/formats/*.tcl]
269 if {[file readable $f]} {
271 set l [string length $f]
272 set f [string range $f [string length "${libdir}/formats/"] \
274 lappend displayFormats $f
283 .data.record configure -wrap $m
290 proc set-display-format {f} {
300 .bot.a.status configure -text "Reformatting"
303 add-title-lines -1 10000 1
306 proc initBindings {} {
309 bind $w <Double-1> {}
310 bind $w <Triple-1> {}
311 bind $w <B1-Motion> {}
313 bind $w <Shift-B1-Motion> {}
315 bind $w <B2-Motion> {}
316 bind $w <Any-KeyPress> {}
318 bind $w <BackSpace> {}
320 bind $w <Control-h> {}
321 bind $w <Control-d> {}
322 bind $w <Control-v> {}
325 bind $w <B1-Motion> {}
326 bind $w <Shift-B1-Motion> {}
331 proc post-menu {wbutton wmenu} {
334 $wmenu post [winfo rootx $wbutton] \
335 [expr [winfo rooty $wbutton]+[winfo height $wbutton]]
340 global windowGeometry
341 set windowGeometry($w) [wm geometry $w]
344 global windowGeometry
347 if {[info exists windowGeometry($w)]} {
348 set g $windowGeometry($w)
353 bind $w <Destroy> [list destroyGW $w]
356 if {[file readable "clientrc.tcl"]} {
357 source "clientrc.tcl"
359 if {[file readable "${libdir}/clientrc.tcl"]} {
360 source "${libdir}/clientrc.tcl"
364 if {[file readable "~/.clientrc.tcl"]} {
365 source "~/.clientrc.tcl"
368 set queryButtonsFind [lindex $queryButtons 0]
369 set queryInfoFind [lindex $queryInfo 0]
371 proc top-down-window {w} {
372 frame $w.top -relief raised -border 1
373 frame $w.bot -relief raised -border 1
375 pack $w.top -side top -fill both -expand yes
376 pack $w.bot -fill both
379 proc top-down-ok-cancel {w ok-action g} {
380 frame $w.bot.left -relief sunken -border 1
381 pack $w.bot.left -side left -expand yes -ipadx 2 -ipady 2 -padx 5 -pady 5
382 button $w.bot.left.ok -width 6 -text {Ok} \
383 -command ${ok-action}
384 pack $w.bot.left.ok -expand yes -ipadx 2 -ipady 2 -padx 3 -pady 3
385 button $w.bot.cancel -width 6 -text {Cancel} \
386 -command [list destroy $w]
387 pack $w.bot.cancel -side left -expand yes
395 proc bottom-buttons {w buttonList g} {
397 set l [llength $buttonList]
399 frame $w.bot.$i -relief sunken -border 1
400 pack $w.bot.$i -side left -expand yes -padx 5 -pady 5
401 button $w.bot.$i.ok -text [lindex $buttonList $i] \
402 -command [lindex $buttonList [expr $i+1]]
403 pack $w.bot.$i.ok -expand yes -ipadx 3 -ipady 2 -padx 3 -pady 3 -side left
407 button $w.bot.$i -text [lindex $buttonList $i] \
408 -command [lindex $buttonList [expr $i+1]]
409 pack $w.bot.$i -expand yes -ipadx 2 -ipady 2 -padx 3 -pady 3 -side left
419 proc cancel-operation {} {
427 show-status Cancel 0 1
431 proc show-target {target base} {
435 .bot.a.target configure -text ""
439 .bot.a.target configure -text "$target"
441 .bot.a.target configure -text "$target - $base"
445 proc show-logo {v1} {
454 .bot.logo configure -bitmap @${libdir}/bitmaps/book${v1}
455 after 140 [list show-logo $v1]
459 .bot.logo configure -bitmap @${libdir}/bitmaps/book1
468 proc show-status {status b sb} {
475 .bot.a.status configure -text "$status"
477 if {$busy == 0} {set busy 1}
485 .top.service configure -state normal
486 .mid.search configure -state normal
488 .mid.scan configure -state normal
491 .top.service.m disable 1
492 } elseif {[z39.$setNo nextResultSetPosition] > 0 &&
493 [z39.$setNo nextResultSetPosition] <= [z39.$setNo resultCount]} {
494 .top.service.m enable 1
495 .mid.present configure -state normal
497 .top.service.m disable 1
498 .mid.present configure -state disabled
500 if {[winfo exists .scan-window]} {
501 .scan-window.bot.2 configure -state normal
502 .scan-window.bot.4 configure -state normal
505 .top.service configure -state disabled
506 .mid.search configure -state disabled
507 .mid.scan configure -state disabled
508 .mid.present configure -state disabled
510 if {[winfo exists .scan-window]} {
511 .scan-window.bot.2 configure -state disabled
512 .scan-window.bot.4 configure -state disabled
517 proc show-message {msg} {
518 .bot.a.message configure -text "$msg"
521 proc insertWithTags {w text args} {
522 set start [$w index insert]
523 $w insert insert $text
524 foreach tag [$w tag names $start] {
525 $w tag remove $tag $start insert
528 $w tag add $i $start insert
532 proc popup-license {} {
537 wm title $w "License"
543 text $w.top.t -width 80 -height 10 -wrap word \
544 -yscrollcommand [list $w.top.s set]
545 scrollbar $w.top.s -command [list $w.top.t yview]
547 pack $w.top.s -side right -fill y
548 pack $w.top.t -expand yes -fill both
550 if {[file readable "${libdir}/LICENSE"]} {
551 set f [open "${libdir}/LICENSE" r]
552 while {[gets $f buf] != -1} {
553 $w.top.t insert end $buf
554 $w.top.t insert end "\n"
558 bottom-buttons $w [list {Close} [list destroy $w]] 1
561 proc about-target {} {
562 set w .about-target-w
567 wm title $w "About target"
571 frame $w.top.a -relief ridge -border 2
572 frame $w.top.p -relief ridge -border 2
574 pack $w.top.a $w.top.p -side top -fill x
576 label $w.top.a.about -text "About"
577 label $w.top.a.irtcl -text $hostid \
578 -font -Adobe-Helvetica-Bold-R-Normal-*-240-*
579 pack $w.top.a.about $w.top.a.irtcl -side top
581 set i [z39 targetImplementationName]
582 label $w.top.p.in -text "Implementation name: $i"
583 set i [z39 targetImplementationId]
584 label $w.top.p.ii -text "Implementation id: $i"
585 set i [z39 targetImplementationVersion]
586 label $w.top.p.iv -text "Implementation version: $i"
588 label $w.top.p.op -text "Protocol options: $i"
590 pack $w.top.p.in $w.top.p.ii $w.top.p.iv $w.top.p.op -side top -anchor nw
592 bottom-buttons $w [list {Close} [list destroy $w]] 1
595 proc about-origin-logo {n} {
597 set w .about-origin-w
598 if {![winfo exists $w]} {
605 $w.top.a.logo configure -bitmap @${libdir}/bitmaps/book$n
606 after 140 [list about-origin-logo $n]
609 proc about-origin {} {
610 set w .about-origin-w
613 if {[winfo exists $w]} {
618 wm title $w "About IrTcl"
622 frame $w.top.a -relief ridge -border 2
623 frame $w.top.p -relief ridge -border 2
625 pack $w.top.a $w.top.p -side top -fill x
627 label $w.top.a.irtcl -text "IrTcl" \
628 -font -Adobe-Helvetica-Bold-R-Normal-*-240-*
629 label $w.top.a.logo -bitmap @${libdir}/bitmaps/book1
630 pack $w.top.a.irtcl $w.top.a.logo -side left -expand yes
632 set i [z39 implementationName]
633 label $w.top.p.in -text "Implementation name: $i"
634 set i [z39 implementationId]
635 label $w.top.p.ii -text "Implementation id: $i"
636 set i [z39 implementationVersion]
637 label $w.top.p.iv -text "Implementation version: $i"
639 pack $w.top.p.in $w.top.p.ii $w.top.p.iv -side top -anchor nw
642 bottom-buttons $w [list {Close} [list destroy $w] \
643 {License} [list popup-license]] 0
646 proc popup-marc {sno no b df} {
648 global displayFormats
651 if {[z39.$sno type $no] != "DB"} {
655 set w .full-marc-$fullMarcSeq
662 if {[winfo exists $w]} {
670 frame $w.top -relief raised -border 1
671 frame $w.bot -relief raised -border 1
673 pack $w.top -side top -fill both -expand yes
674 pack $w.bot -fill both
676 text $w.top.record -width 60 -height 5 -wrap word \
677 -yscrollcommand [list $w.top.s set]
678 scrollbar $w.top.s -command [list $w.top.record yview]
680 if {[tk colormodel .] == "color"} {
681 $w.top.record tag configure marc-tag -foreground blue
682 $w.top.record tag configure marc-id -foreground red
684 $w.top.record tag configure marc-tag -foreground black
685 $w.top.record tag configure marc-id -foreground black
687 $w.top.record tag configure marc-data -foreground black
690 $w.top.record delete 0.0 end
691 set recordType [z39.$sno recordType $no]
692 wm title $w "$recordType record #$no"
695 bind $w.top.record <Return> {destroy .full-marc}
697 pack $w.top.s -side right -fill y
698 pack $w.top.record -expand yes -fill both
701 bottom-buttons $w [list \
702 {Close} [list destroy $w]] 0
704 bottom-buttons $w [list \
705 {Close} [list destroy $w] \
706 {Duplicate} [list popup-marc $sno $no 1 0]] 0
707 menubutton $w.bot.formats -text "Format" -menu $w.bot.formats.m
708 menu $w.bot.formats.m
710 foreach f $displayFormats {
711 $w.bot.formats.m add radiobutton -label $f \
712 -variable popupMarcdf -value $i \
713 -command [list display-$f $sno $no $w.top.record 0]
716 pack $w.bot.formats -expand yes -ipadx 2 -ipady 2 \
717 -padx 3 -pady 3 -side left
721 foreach f $displayFormats {
722 $w.bot.formats.m entryconfigure $i \
723 -command [list display-$f $sno $no $w.top.record 0]
727 set ffunc [lindex $displayFormats $df]
728 set ffunc "display-$ffunc"
730 $ffunc $sno $no $w.top.record 0
733 proc update-target-hotlist {target base} {
736 set len [llength $hotTargets]
738 .top.target.m delete 6 [expr 6+[llength $hotTargets]]
741 foreach e $hotTargets {
742 if {$target == [lindex $e 0] && $base == [lindex $e 1]} {
743 set hotTargets [lreplace $hotTargets $i $i]
748 set hotTargets [linsert $hotTargets 0 [list $target $base]]
752 proc set-target-hotlist {} {
756 foreach e $hotTargets {
757 set target [lindex $e 0]
758 set base [lindex $e 1]
760 .top.target.m add command -label "$i $target" -command \
761 [list reopen-target $target {}]
763 .top.target.m add command -label "$i $target - $base" -command \
764 [list reopen-target $target $base]
773 proc reopen-target {target base} {
775 open-target $target $base
776 update-target-hotlist $target $base
779 proc define-target-action {} {
782 set target [.target-define.top.target.entry get]
786 foreach n [array names profile] {
792 set seq [lindex $profile(Default) 12]
794 set profile($target) $profile(Default)
795 set profile(Default) [lreplace $profile(Default) 12 12 [incr seq]]
797 protocol-setup $target
798 destroy .target-define
801 proc fail-response {target} {
802 set c [lindex [z39 failInfo] 0]
803 set m [lindex [z39 failInfo] 1]
808 proc connect-response {target base} {
809 dputs "connect-response"
810 show-target $target $base
814 proc open-target {target base} {
819 z39 comstack [lindex $profile($target) 6]
820 z39 protocol [lindex $profile($target) 11]
821 z39 idAuthentication [lindex $profile($target) 3]
822 z39 maximumRecordSize [lindex $profile($target) 4]
823 z39 preferredMessageSize [lindex $profile($target) 5]
824 dputs "maximumRecordSize="
825 dputs [z39 maximumRecordSize]
826 dputs "preferredMessageSize="
827 dputs [z39 preferredMessageSize]
828 show-status {Connecting} 1 0
830 z39 databaseNames [lindex [lindex $profile($target) 7] 0]
832 z39 databaseNames $base
834 z39 failback [list fail-response $target]
835 z39 callback [list connect-response $target $base]
838 z39 connect [lindex $profile($target) 1]:[lindex $profile($target) 2]
841 tkerror $errorMessage
842 show-status Ready 0 {}
846 .top.target.m disable 0
847 .top.target.m enable 1
848 .top.target.m enable 2
851 proc close-target {} {
860 .bot.a.set configure -text ""
864 show-status {Not connected} 0 0
867 .top.target.m disable 1
868 .top.target.m disable 2
869 .top.rset.m delete 1 last
870 .top.rset.m add separator
871 .top.target.m enable 0
874 proc load-set-action {} {
878 ir-set z39.$setNoLast z39
880 set fname [.load-set.top.filename.entry get]
883 show-status {Loading} 1 {}
885 z39.$setNo loadFile $fname
887 set no [z39.$setNoLast numberOfRecordsReturned]
888 add-title-lines $setNoLast $no 1
890 set l [format "%-4d %7d" $setNoLast $no]
891 .top.rset.m add command -label $l \
892 -command [list add-title-lines $setNoLast 10000 1]
893 show-status {Ready} 0 {}
905 frame $w.top.filename
906 pack $w.top.filename -side top -anchor e -pady 2
908 entry-fields $w.top {filename} \
910 {load-set-action} {destroy .load-set}
912 top-down-ok-cancel $w {load-set-action} 1
916 proc init-request {} {
923 z39 callback {init-response}
924 show-status {Initializing} 1 {}
925 set err [catch {z39 init} errorMessage]
927 tkerror $errorMessage
928 show-status Ready 0 {}
932 proc init-response {} {
940 if {![z39 initResult]} {
941 show-status {Ready} 0 1
942 set u [z39 userInformationField]
944 tkerror "Connection rejected by target: $u"
946 if {[lsearch [z39 options] scan] >= 0} {
951 show-status {Ready} 0 1
955 proc search-request {bflag} {
967 dputs "search-request"
969 if {!$bflag && $busy} {
970 dputs "busy: search-request ignored"
975 show-status {Searching} 1 0
976 set delayRequest {search-request 1}
981 set query [index-query]
987 ir-set z39.$setNo z39
989 if {[lindex $profile($target) 10] == 1} {
990 z39.$setNo setName $setNo
991 dputs "setName=${setNo}"
993 z39.$setNo setName Default
994 dputs "setName=Default"
996 if {[lindex $profile($target) 8] == 1} {
997 z39.$setNo queryType rpn
999 if {[lindex $profile($target) 9] == 1} {
1000 z39.$setNo queryType ccl
1004 if {$recordSyntax == "None" } {
1005 z39.$setNo preferredRecordSyntax {}
1007 z39.$setNo preferredRecordSyntax $recordSyntax
1009 z39 callback {search-response}
1010 z39.$setNo search $query
1011 show-status {Searching} 1 0
1014 proc scan-copy {y entry} {
1016 set no [$w.top.list nearest $y]
1018 .lines.$entry.e delete 0 end
1019 .lines.$entry.e insert 0 [string range [$w.top.list get $no] 8 end]
1022 proc scan-request {} {
1029 global curIndexEntry
1030 global queryButtonsFind
1031 global queryInfoFind
1035 dputs "scan-request"
1038 show-status {Scanning} 1 0
1039 set delayRequest scan-request
1048 set b [lindex $queryButtonsFind $curIndexEntry]
1050 foreach a [lrange [lindex $queryInfoFind [lindex $b 1]] 1 end] {
1051 set attr "@attr $a $attr"
1053 set title [lindex [lindex $queryInfoFind [lindex $b 1]] 0]
1054 ir-scan z39.scan z39
1056 if {![winfo exists $w]} {
1063 entry $w.top.entry -relief sunken
1064 pack $w.top.entry -fill x -padx 4 -pady 2
1065 bind $w.top.entry <KeyRelease> [list scan-term-h $attr]
1067 listbox $w.top.list -yscrollcommand [list $w.top.scroll set] \
1069 scrollbar $w.top.scroll -orient vertical -border 1
1070 pack $w.top.list -side left -fill both -expand yes
1071 pack $w.top.scroll -side right -fill y
1072 $w.top.scroll config -command [list $w.top.list yview]
1074 listbox $w.top.list -font fixed -geometry 60x14
1075 pack $w.top.list -side left -fill both -expand yes
1078 bottom-buttons $w [list {Close} [list destroy $w] \
1079 {Up} [list scan-up $attr] \
1080 {Down} [list scan-down $attr]] 0
1081 bind $w.top.list <Up> [list scan-up $attr]
1082 bind $w.top.list <Down> [list scan-down $attr]
1084 bind $w.top.list <Double-Button-1> [list scan-copy %y $curIndexEntry]
1085 wm title $w "Scan $title"
1087 z39 callback [list scan-response $attr 0 35]
1088 z39.scan numberOfTermsRequested 5
1089 z39.scan preferredPositionInResponse 1
1090 z39.scan scan "${attr} 0"
1092 show-status {Scanning} 1 0
1095 proc scan-term-h {attr} {
1103 set nScanTerm [$w.top.entry get]
1104 if {$nScanTerm == $scanTerm} {
1107 set scanTerm $nScanTerm
1108 z39 callback [list scan-response $attr 0 35]
1109 z39.scan numberOfTermsRequested 5
1110 z39.scan preferredPositionInResponse 1
1111 dputs "${attr} \{${scanTerm}\}"
1112 if {$scanTerm == ""} {
1113 z39.scan scan "${attr} 0"
1115 z39.scan scan "${attr} \{${scanTerm}\}"
1117 show-status {Scanning} 1 0
1120 proc scan-response {attr start toget} {
1127 dputs "In scan-response"
1128 set m [z39.scan numberOfEntriesReturned]
1134 if {![winfo exists .scan-window]} {
1137 dputs "Handling cancel"
1138 if {$delayRequest != ""} {
1143 show-status {Ready} 0 1
1146 set nScanTerm [$w.top.entry get]
1147 if {$nScanTerm != $scanTerm} {
1148 z39 callback [list scan-response $attr 0 35]
1149 z39.scan numberOfTermsRequested 5
1150 z39.scan preferredPositionInResponse 1
1151 set scanTerm $nScanTerm
1152 dputs "${attr} \{${scanTerm}\}"
1153 if {$scanTerm == ""} {
1154 z39.scan scan "${attr} 0"
1156 z39.scan scan "${attr} \{${scanTerm}\}"
1158 show-status {Scanning} 1 0
1161 set status [z39.scan scanStatus]
1164 show-status {Ready} 0 1
1169 for {set i 0} {$i < $m} {incr i} {
1170 set term [lindex [z39.scan scanLine $i] 1]
1171 set nostr [format " %-6d" [lindex [z39.scan scanLine $i] 2]]
1172 $w.top.list insert $i "$nostr $term"
1175 $w.top.list yview $scanView
1177 $w.top.list delete $start end
1178 for {set i 0} {$i < $m} {incr i} {
1179 set term [lindex [z39.scan scanLine $i] 1]
1180 set nostr [format " %-6d" [lindex [z39.scan scanLine $i] 2]]
1181 $w.top.list insert end "$nostr $term"
1185 dputs "Handling cancel"
1187 if {$delayRequest != ""} {
1193 if {$toget > 0 && $m > 1 && $m < $toget} {
1194 set ntoget [expr $toget - $m + 1]
1195 dputs ntoget=$ntoget
1196 z39 callback [list scan-response $attr [expr $start + $m - 1] $ntoget]
1198 dputs "down continue: $q"
1200 z39.scan numberOfTermsRequested 10
1202 z39.scan numberOfTermsRequested $ntoget
1204 z39.scan preferredPositionInResponse 1
1205 dputs "${attr} \{$q\}"
1206 z39.scan scan "${attr} \{$q\}"
1209 if {$toget < 0 && $m > 1 && $m < [expr - $toget]} {
1210 set ntoget [expr - $toget - $m]
1211 dputs ntoget=$ntoget
1212 z39 callback [list scan-response $attr 0 -$ntoget]
1213 set q [string range [$w.top.list get 0] 8 end]
1214 dputs "up continue: $q"
1216 z39.scan numberOfTermsRequested 10
1217 z39.scan preferredPositionInResponse 11
1219 z39.scan numberOfTermsRequested $ntoget
1220 z39.scan preferredPositionInResponse [incr ntoget]
1222 dputs "${attr} \{$q\}"
1223 z39.scan scan "${attr} \{$q\}"
1226 show-status {Ready} 0 1
1229 proc scan-down {attr} {
1237 show-status {Scanning down} 1 0
1238 set delayRequest [list scan-down $attr]
1244 set scanView [expr $scanView + 5]
1245 set s [$w.top.list size]
1246 if {$scanView > $s} {
1247 z39 callback [list scan-response $attr [expr $s - 1] 25]
1248 set q [string range [$w.top.list get [expr $s - 1]] 8 end]
1250 z39.scan numberOfTermsRequested 10
1251 z39.scan preferredPositionInResponse 1
1252 show-status {Scanning} 1 0
1253 dputs "${attr} \{$q\}"
1254 z39.scan scan "${attr} \{$q\}"
1257 $w.top.list yview $scanView
1260 proc scan-up {attr} {
1268 show-status {Scanning up} 1 0
1269 set delayRequest [list scan-up $attr]
1275 set scanView [expr $scanView - 5]
1276 if {$scanView < 0} {
1277 z39 callback [list scan-response $attr 0 -25]
1278 set q [string range [$w.top.list get 0] 8 end]
1280 z39.scan numberOfTermsRequested 10
1281 z39.scan preferredPositionInResponse 11
1282 show-status {Scanning} 1 0
1283 z39.scan scan "${attr} \{$q\}"
1286 $w.top.list yview $scanView
1289 proc search-response {} {
1297 dputs "In search-response"
1299 dputs "Handling cancel"
1301 if {$delayRequest != ""} {
1309 set setMax [z39.$setNo resultCount]
1310 show-status {Ready} 0 1
1311 set status [z39.$setNo responseStatus]
1312 if {[lindex $status 0] == "NSD"} {
1313 z39.$setNo nextResultSetPosition 0
1314 set code [lindex $status 1]
1315 set msg [lindex $status 2]
1316 set addinfo [lindex $status 3]
1317 tkerror "NSD$code: $msg: $addinfo"
1320 show-message "${setMax} hits"
1325 show-status {Ready} 0 1
1326 set l [format "%-4d %7d" $setNo $setMax]
1327 .top.rset.m add command -label $l \
1328 -command [list add-title-lines $setNo 10000 1]
1332 z39 callback {present-response}
1333 z39.$setNo present $setOffset 1
1334 show-status {Retrieving} 1 0
1337 proc present-more {number} {
1345 dputs "present-more"
1347 show-status {Retrieving} 1 0
1348 set delayRequest "present-more $number"
1354 dputs "setNo=$setNo"
1357 set setOffset [z39.$setNo nextResultSetPosition]
1358 dputs "setOffest=${setOffset}"
1359 dputs "setNo=${setNo}"
1360 set max [z39.$setNo resultCount]
1361 if {$max < $setOffset} {
1363 dputs "setOffset=$setOffset"
1364 show-status Ready 0 1
1367 if {$number == ""} {
1371 if {$setMax > $max} {
1375 z39 callback {present-response}
1377 set toGet [expr $setMax - $setOffset + 1]
1384 z39.$setNo present $setOffset $toGet
1385 show-status {Retrieving} 1 0
1388 proc init-title-lines {} {
1389 .data.record delete 0.0 end
1392 proc title-press {y setno} {
1393 show-full-marc $setno [expr 1 + [.data.list nearest $y]] 0
1396 proc add-title-lines {setno no offset} {
1397 global displayFormats
1398 global displayFormat
1408 .bot.a.set configure -text $setno
1409 .data.record delete 0.0 end
1411 set ffunc [lindex $displayFormats $displayFormat]
1412 dputs "ffunc=$ffunc"
1413 set ffunc "display-$ffunc"
1414 for {set i 0} {$i < $no} {incr i} {
1415 set o [expr $i + $offset]
1416 set type [z39.$setno type $o]
1420 .data.record tag bind r$o <Any-Enter> {}
1421 .data.record tag bind r$o <Any-Leave> {}
1422 set insert0 [.data.record index insert]
1423 $ffunc $setno $o .data.record 1
1424 .data.record tag add r$o $insert0 insert
1425 .data.record tag bind r$o <1> \
1426 [list popup-marc $setno $o 0 0]
1430 show-status Ready 0 1
1434 proc present-response {} {
1441 dputs "In present-response"
1442 set no [z39.$setNo numberOfRecordsReturned]
1443 dputs "Returned $no records, setOffset $setOffset"
1444 add-title-lines $setNo $no $setOffset
1445 set setOffset [expr $setOffset + $no]
1447 dputs "Handling cancel"
1449 if {$delayRequest != ""} {
1454 set status [z39.$setNo responseStatus]
1455 if {[lindex $status 0] == "NSD"} {
1456 show-status {Ready} 0 1
1457 set code [lindex $status 1]
1458 set msg [lindex $status 2]
1459 set addinfo [lindex $status 3]
1460 tkerror "NSD$code: $msg: $addinfo"
1463 if {$no > 0 && $setOffset <= $setMax} {
1464 dputs "present-request from ${setOffset}"
1465 set toGet [expr $setMax - $setOffset + 1]
1469 z39.$setNo present $setOffset $toGet
1471 show-status {Ready} 0 1
1475 proc left-cursor {w} {
1476 set i [$w index insert]
1483 proc right-cursor {w} {
1484 set i [$w index insert]
1489 proc bind-fields {list returnAction escapeAction} {
1490 set max [expr [llength $list]-1]
1491 for {set i 0} {$i < $max} {incr i} {
1492 bind [lindex $list $i] <Return> $returnAction
1493 bind [lindex $list $i] <Escape> $escapeAction
1494 bind [lindex $list $i] <Tab> [list focus [lindex $list [expr $i+1]]]
1495 bind [lindex $list $i] <Left> [list left-cursor [lindex $list $i]]
1496 bind [lindex $list $i] <Right> [list right-cursor [lindex $list $i]]
1498 bind [lindex $list $i] <Return> $returnAction
1499 bind [lindex $list $i] <Escape> $escapeAction
1500 bind [lindex $list $i] <Tab> [list focus [lindex $list 0]]
1501 bind [lindex $list $i] <Left> [list left-cursor [lindex $list $i]]
1502 bind [lindex $list $i] <Right> [list right-cursor [lindex $list $i]]
1503 focus [lindex $list 0]
1506 proc entry-fields {parent list tlist returnAction escapeAction} {
1509 foreach field $list {
1510 set label ${parent}.${field}.label
1511 set entry ${parent}.${field}.entry
1512 label $label -text [lindex $tlist $i] -anchor e
1513 entry $entry -width 32 -relief sunken
1514 pack $label -side left
1515 pack $entry -side right
1516 lappend alist $entry
1519 bind-fields $alist $returnAction $escapeAction
1522 proc define-target-dialog {} {
1523 set w .target-define
1529 pack $w.top.target \
1530 -side top -anchor e -pady 2
1531 entry-fields $w.top {target} \
1533 {define-target-action} {destroy .target-define}
1534 top-down-ok-cancel $w {define-target-action} 1
1537 proc protocol-setup-delete {target} {
1539 global settingsChanged
1541 set a [alert "Are you sure you want to delete the target \
1542 definition $target ?"]
1544 set wno [lindex $profile($target) 12]
1547 unset profile($target)
1548 set settingsChanged 1
1553 proc protocol-setup-action {target} {
1556 global protocolRadioType
1557 global settingsChanged
1560 global ResultSetCheck
1562 set wno [lindex $profile($target) 12]
1566 set settingsChanged 1
1567 set len [$w.top.databases.list size]
1568 for {set i 0} {$i < $len} {incr i} {
1569 lappend b [$w.top.databases.list get $i]
1571 set profile($target) [list [$w.top.description.entry get] \
1572 [$w.top.host.entry get] \
1573 [$w.top.port.entry get] \
1574 [$w.top.idAuthentication.entry get] \
1575 [$w.top.maximumRecordSize.entry get] \
1576 [$w.top.preferredMessageSize.entry get] \
1582 $protocolRadioType \
1586 dputs $profile($target)
1590 proc place-force {window parent} {
1591 set g [wm geometry $parent]
1593 set p1 [string first + $g]
1594 set p2 [string last + $g]
1596 set x [expr 40+[string range $g [expr $p1 +1] [expr $p2 -1]]]
1597 set y [expr 60+[string range $g [expr $p2 +1] end]]
1598 wm geometry $window +${x}+${y}
1601 proc add-database-action {target} {
1604 set wno [lindex $profile($target) 12]
1607 $w.top.databases.list insert end \
1608 [.database-select.top.database.entry get]
1609 destroy .database-select
1612 proc add-database {target} {
1615 set w .database-select
1617 set oldFocus [focus]
1620 set wno [lindex $profile($target) 12]
1621 place-force $w .setup-${wno}
1625 frame $w.top.database
1627 pack $w.top.database -side top -anchor e -pady 2
1629 entry-fields $w.top {database} \
1630 {{Database to add:}} \
1631 [list add-database-action $target] {destroy .database-select}
1633 top-down-ok-cancel $w [list add-database-action $target] 1
1637 proc delete-database {target} {
1640 set wno [lindex $profile($target) 12]
1643 foreach i [$w.top.databases.list curselection] {
1644 set b [$w.top.databases.list get $i]
1647 set a [alert "Are you sure you want to remove the database(s)${l}?"]
1649 foreach i [lsort -decreasing \
1650 [$w.top.databases.list curselection]] {
1651 $w.top.databases.list delete $i
1656 proc protocol-setup {target} {
1659 global protocolRadioType
1662 global ResultSetCheck
1664 set wno [lindex $profile($target) 12]
1669 wm title $w "Setup $target"
1673 if {$target == ""} {
1677 dputs $profile($target)
1681 frame $w.top.description
1682 frame $w.top.idAuthentication
1683 frame $w.top.maximumRecordSize
1684 frame $w.top.preferredMessageSize
1685 frame $w.top.cs-type -relief ridge -border 2
1686 frame $w.top.protocol -relief ridge -border 2
1687 frame $w.top.query -relief ridge -border 2
1688 frame $w.top.databases -relief ridge -border 2
1690 # Maximum/preferred/idAuth ...
1691 pack $w.top.description $w.top.host $w.top.port \
1692 $w.top.idAuthentication $w.top.maximumRecordSize \
1693 $w.top.preferredMessageSize -side top -anchor e -pady 2
1695 entry-fields $w.top {description host port idAuthentication \
1696 maximumRecordSize preferredMessageSize} \
1697 {{Description:} {Host:} {Port:} {Id Authentication:} \
1698 {Maximum Record Size:} {Preferred Message Size:}} \
1699 [list protocol-setup-action $target] [list destroy $w]
1701 foreach sub {description host port idAuthentication \
1702 maximumRecordSize preferredMessageSize} {
1704 bind $w.top.$sub.entry <Control-a> [list add-database $target]
1705 bind $w.top.$sub.entry <Control-d> [list delete-database $target]
1707 $w.top.description.entry insert 0 [lindex $profile($target) 0]
1708 $w.top.host.entry insert 0 [lindex $profile($target) 1]
1709 $w.top.port.entry insert 0 [lindex $profile($target) 2]
1710 $w.top.idAuthentication.entry insert 0 [lindex $profile($target) 3]
1711 $w.top.maximumRecordSize.entry insert 0 [lindex $profile($target) 4]
1712 $w.top.preferredMessageSize.entry insert 0 [lindex $profile($target) 5]
1713 set csRadioType [lindex $profile($target) 6]
1714 set RPNCheck [lindex $profile($target) 8]
1715 set CCLCheck [lindex $profile($target) 9]
1716 set ResultSetCheck [lindex $profile($target) 10]
1717 set protocolRadioType [lindex $profile($target) 11]
1718 if {$protocolRadioType == ""} {
1719 set protocolRadioType Z39
1723 pack $w.top.databases -side left -pady 4 -padx 4 -expand yes -fill both
1725 label $w.top.databases.label -text "Databases"
1726 button $w.top.databases.add -text "Add" \
1727 -command [list add-database $target]
1728 button $w.top.databases.delete -text "Delete" \
1729 -command [list delete-database $target]
1730 listbox $w.top.databases.list -geometry 20x6 \
1731 -yscrollcommand "$w.top.databases.scroll set"
1732 scrollbar $w.top.databases.scroll -orient vertical -border 1
1733 pack $w.top.databases.label -side top -fill x \
1735 pack $w.top.databases.add $w.top.databases.delete -side top -fill x \
1737 pack $w.top.databases.list -side left -fill both -expand yes \
1739 pack $w.top.databases.scroll -side right -fill y \
1741 $w.top.databases.scroll config -command "$w.top.databases.list yview"
1743 foreach b [lindex $profile($target) 7] {
1744 $w.top.databases.list insert end $b
1748 pack $w.top.cs-type -pady 4 -padx 4 -side top -fill x
1750 label $w.top.cs-type.label -text "Transport"
1751 radiobutton $w.top.cs-type.tcpip -text "TCP/IP" -anchor w \
1752 -variable csRadioType -value tcpip
1753 radiobutton $w.top.cs-type.mosi -text "MOSI" -anchor w\
1754 -variable csRadioType -value mosi
1756 pack $w.top.cs-type.label $w.top.cs-type.tcpip $w.top.cs-type.mosi \
1757 -padx 4 -side top -fill x
1760 pack $w.top.protocol -pady 4 -padx 4 -side top -fill x
1762 label $w.top.protocol.label -text "Protocol"
1763 radiobutton $w.top.protocol.z39v2 -text "Z39.50" -anchor w \
1764 -variable protocolRadioType -value Z39
1765 radiobutton $w.top.protocol.sr -text "SR" -anchor w \
1766 -variable protocolRadioType -value SR
1768 pack $w.top.protocol.label $w.top.protocol.z39v2 $w.top.protocol.sr \
1769 -padx 4 -side top -fill x
1772 pack $w.top.query -pady 4 -padx 4 -side top -fill x
1774 label $w.top.query.label -text "Query support"
1775 checkbutton $w.top.query.c1 -text "RPN query" -anchor w -variable RPNCheck
1776 checkbutton $w.top.query.c2 -text "CCL query" -anchor w -variable CCLCheck
1777 checkbutton $w.top.query.c3 -text "Result sets" -anchor w -variable ResultSetCheck
1779 pack $w.top.query.label -side top
1780 pack $w.top.query.c1 $w.top.query.c2 $w.top.query.c3 \
1781 -padx 4 -side top -fill x
1784 bottom-buttons $w [list {Ok} [list protocol-setup-action $target] \
1785 {Delete} [list protocol-setup-delete $target] \
1786 {Cancel} [list destroy $w]] 0
1789 proc database-select-action {} {
1790 set w .database-select.top
1792 foreach indx [$w.databases.list curselection] {
1793 lappend b [$w.databases.list get $indx]
1796 z39 databaseNames $b
1798 destroy .database-select
1801 proc database-select {} {
1802 set w .database-select
1812 frame $w.top.databases -relief ridge -border 2
1814 pack $w.top.databases -side left -pady 6 -padx 6 -expand yes -fill x
1816 label $w.top.databases.label -text "List"
1817 listbox $w.top.databases.list -geometry 20x6 \
1818 -yscrollcommand "$w.top.databases.scroll set"
1819 scrollbar $w.top.databases.scroll -orient vertical -border 1
1820 pack $w.top.databases.label -side top -fill x \
1822 pack $w.top.databases.list -side left -fill both -expand yes \
1824 pack $w.top.databases.scroll -side right -fill y \
1826 $w.top.databases.scroll config -command "$w.top.databases.list yview"
1828 foreach b [lindex $profile($hostid) 7] {
1829 $w.top.databases.list insert end $b
1831 top-down-ok-cancel $w {database-select-action} 1
1834 proc cascade-target-list {} {
1837 foreach sub [winfo children .top.target.m.clist] {
1840 .top.target.m.clist delete 0 last
1841 foreach n [lsort [array names profile]] {
1842 if {$n != "Default"} {
1843 set nl [lindex $profile($n) 12]
1844 if {[llength [lindex $profile($n) 7]] > 1} {
1845 .top.target.m.clist add cascade -label $n \
1846 -menu .top.target.m.clist.$nl
1847 menu .top.target.m.clist.$nl
1848 foreach b [lindex $profile($n) 7] {
1849 .top.target.m.clist.$nl add command -label $b \
1850 -command [list reopen-target $n $b]
1853 .top.target.m.clist add command -label $n \
1854 -command [list reopen-target $n {}]
1858 .top.target.m.slist delete 0 last
1859 foreach n [lsort [array names profile]] {
1860 if {$n != "Default"} {
1861 .top.target.m.slist add command -label $n \
1862 -command [list protocol-setup $n]
1867 proc query-select {i} {
1868 global queryButtonsFind
1869 global queryInfoFind
1873 set queryInfoFind [lindex $queryInfo $i]
1874 set queryButtonsFind [lindex $queryButtons $i]
1876 index-lines .lines 1 $queryButtonsFind $queryInfoFind activate-index
1879 proc query-new-action {} {
1883 global settingsChanged
1885 set settingsChanged 1
1886 lappend queryTypes [.query-new.top.index.entry get]
1887 lappend queryButtons {}
1888 lappend queryInfo {}
1902 -side top -anchor e -pady 2
1903 entry-fields $w.top index \
1905 query-new-action {destroy .query-new}
1906 top-down-ok-cancel $w query-new-action 1
1909 proc query-delete-action {queryNo} {
1913 global settingsChanged
1915 set settingsChanged 1
1917 set queryTypes [lreplace $queryTypes $queryNo $queryNo]
1918 set queryButtons [lreplace $queryButtons $queryNo $queryNo]
1919 set queryInfo [lreplace $queryInfo $queryNo $queryNo]
1920 destroy .query-delete
1924 proc query-delete {queryNo} {
1932 set n [lindex $queryTypes $queryNo]
1934 label $w.top.warning -bitmap warning
1935 message $w.top.quest -text "Are you sure you want to delete the \
1936 query type $n ?" -aspect 300
1937 pack $w.top.warning $w.top.quest -side left -expand yes -padx 10 -pady 5
1938 bottom-buttons $w [list {Ok} [list query-delete-action $queryNo] \
1939 {Cancel} [list destroy $w]] 1
1942 proc cascade-query-list {} {
1944 set w .top.options.m.query
1947 $w.slist delete 0 last
1948 foreach n $queryTypes {
1949 $w.slist add command -label $n -command [list query-setup $i]
1954 $w.clist delete 0 last
1955 foreach n $queryTypes {
1956 $w.clist add command -label $n -command [list query-select $i]
1960 $w.dlist delete 0 last
1961 foreach n $queryTypes {
1962 $w.dlist add command -label $n -command [list query-delete $i]
1967 proc save-geometry {} {
1968 global windowGeometry
1971 global displayFormat
1975 set windowGeometry(.) [wm geometry .]
1977 set f [open "~/.clientrc.tcl" w]
1979 puts $f "set hotTargets \{ $hotTargets \}"
1980 puts $f "set textWrap $textWrap"
1981 puts $f "set displayFormat $displayFormat"
1982 puts $f "set popupMarcdf $popupMarcdf"
1983 puts $f "set recordSyntax $recordSyntax"
1984 foreach n [array names windowGeometry] {
1985 puts -nonewline $f "set \{windowGeometry($n)\} \{"
1986 puts -nonewline $f $windowGeometry($n)
1992 proc save-settings {} {
1995 global settingsChanged
2000 if {![file writable "${libdir}/clientrc.tcl"]} {
2001 set a [alert "Cannot open ${libdir}/clientrc.tcl for writing. Do you \
2002 wish to save clientrc.tcl in the current directory instead?"]
2006 set f [open "clientrc.tcl" w]
2008 set f [open "${libdir}/clientrc.tcl" w]
2010 puts $f "# Setup file"
2012 foreach n [array names profile] {
2013 puts -nonewline $f "set \{profile($n)\} \{"
2014 puts -nonewline $f $profile($n)
2017 puts -nonewline $f "set queryTypes \{"
2018 puts -nonewline $f $queryTypes
2021 puts -nonewline $f "set queryButtons \{"
2022 puts -nonewline $f $queryButtons
2025 puts -nonewline $f "set queryInfo \{"
2026 puts -nonewline $f $queryInfo
2029 set settingsChanged 0
2041 label $w.top.warning -bitmap warning
2042 message $w.top.message -text $ask -aspect 300 \
2043 -font -Adobe-Times-Medium-R-Normal-*-180-*
2045 pack $w.top.warning $w.top.message -side left -pady 5 -padx 10 -expand yes
2048 top-down-ok-cancel $w {alert-action} 1
2052 proc alert-action {} {
2058 proc exit-action {} {
2059 global settingsChanged
2061 if {$settingsChanged} {
2062 set a [alert "you haven't saved your settings. Do you wish to save?"]
2071 proc listbuttonaction {w name h user i} {
2072 $w configure -text [lindex $name 0]
2073 $h [lindex $name 1] $user $i
2076 proc listbuttonx {button no names handle user} {
2077 if {[winfo exists $button]} {
2078 $button configure -text [lindex [lindex $names $no] 0]
2079 ${button}.m delete 0 last
2081 menubutton $button -text [lindex [lindex $names $no] 0] \
2082 -width 10 -menu ${button}.m -relief raised -border 1
2086 foreach name $names {
2087 ${button}.m add command -label [lindex $name 0] \
2088 -command [list listbuttonaction ${button} $name \
2094 proc listbutton {button no names} {
2095 menubutton $button -text [lindex $names $no] -width 10 -menu ${button}.m \
2096 -relief raised -border 1
2098 foreach name $names {
2099 ${button}.m add command -label $name \
2100 -command [list ${button} configure -text $name]
2104 proc listbuttonv-action {button var names i} {
2107 set $var [lindex $names [expr $i+1]]
2108 $button configure -text [lindex $names $i]
2111 proc listbuttonv {button var names} {
2115 eval "set val $$var"
2116 set l [llength $names]
2117 for {set i 1} {$i < $l} {incr i 2} {
2118 if {$val == [lindex $names $i]} {
2120 set n [lindex $names $i]
2124 if {[winfo exists $button]} {
2125 $button configure -text $n
2128 menubutton $button -text $n -menu ${button}.m \
2129 -relief raised -border 1
2131 for {set i 0} {$i < $l} {incr i 2} {
2132 ${button}.m add command -label [lindex $names $i] \
2133 -command [list listbuttonv-action $button $var $names $i]
2137 proc query-add-index-action {queryNo} {
2141 global queryButtonsTmp
2143 set newI [.query-add-index.top.index.entry get]
2144 lappend queryInfoTmp [list $newI {}]
2145 $w.top.index.list insert end $newI
2146 destroy .query-add-index
2147 #destroy $w.top.lines
2148 #frame $w.top.lines -relief ridge -border 2
2149 index-lines $w.top.lines 0 $queryButtonsTmp $queryInfoTmp activate-e-index
2150 #pack $w.top.lines -side left -pady 6 -padx 6 -fill y
2153 proc query-add-line {queryNo} {
2157 global queryButtonsTmp
2159 lappend queryButtonsTmp {I 0}
2161 #destroy $w.top.lines
2162 #frame $w.top.lines -relief ridge -border 2
2163 index-lines $w.top.lines 0 $queryButtonsTmp $queryInfoTmp activate-e-index
2164 #pack $w.top.lines -side left -pady 6 -padx 6 -fill y
2167 proc query-del-line {queryNo} {
2171 global queryButtonsTmp
2173 set l [llength $queryButtonsTmp]
2178 set queryButtonsTmp [lreplace $queryButtonsTmp $l $l]
2179 index-lines $w.top.lines 0 $queryButtonsTmp $queryInfoTmp activate-e-index
2182 proc query-add-index {queryNo} {
2183 set w .query-add-index
2186 place-force $w .query-setup
2190 -side top -anchor e -pady 2
2191 entry-fields $w.top {index} \
2193 [list query-add-index-action $queryNo] [list destroy $w]
2194 top-down-ok-cancel $w [list query-add-index-action $queryNo] 1
2197 proc query-setup-action {queryNo} {
2200 global queryButtonsTmp
2202 global queryButtonsFind
2203 global queryInfoFind
2205 global settingsChanged
2207 set settingsChanged 1
2209 set queryInfo [lreplace $queryInfo $queryNo $queryNo \
2211 set queryButtons [lreplace $queryButtons $queryNo $queryNo \
2213 set queryInfoFind $queryInfoTmp
2214 set queryButtonsFind $queryButtonsTmp
2216 destroy .query-setup
2217 index-lines .lines 1 $queryButtonsFind $queryInfoFind activate-index
2220 proc activate-e-index {value no i} {
2221 global queryButtonsTmp
2222 global queryIndexTmp
2224 set queryButtonsTmp [lreplace $queryButtonsTmp $no $no [list I $i]]
2225 dputs $queryButtonsTmp
2226 set queryIndexTmp $i
2229 proc activate-index {value no i} {
2230 global queryButtonsFind
2232 set queryButtonsFind [lreplace $queryButtonsFind $no $no [list I $i]]
2234 dputs "queryButtonsFind $queryButtonsFind"
2237 proc update-attr {} {
2239 listbuttonv $w.top.relation.b relationTmpValue\
2240 {{None} 0 {Less than} 1 {Greater than or equal} 2 {Equal} 3 \
2241 {Greater than or equal} 4 {Greater than} 5 {Not equal} 6 \
2242 {Phonetic} 100 {Stem} 101 {Relevance} 102 {AlwaysMatches} 103}
2243 listbuttonv $w.top.position.b positionTmpValue {{None} 0 \
2244 {First in field} 1 {First in subfield} 2 {Any position in field} 3}
2245 listbuttonv $w.top.structure.b structureTmpValue {{None} 0 {Phrase} 1 \
2246 {Word} 2 {Key} 3 {Year} 4 {Date (norm)} 5 {Word list} 6 \
2247 {Date (un-norm)} 100 {Name (norm)} 101 {Date (un-norm)} 102 \
2248 {Structure} 103 {urx} 104 {free-form} 105 {doc-text} 106 \
2249 {local-number} 107 {string} 108 {numeric string} 109}
2250 listbuttonv $w.top.truncation.b truncationTmpValue {{Auto} 0 {Right} 1 \
2251 {Left} 2 {Left and right} 3 {No truncation} 100 \
2252 {Process #} 101 {Re-1} 102 {Re-2} 103}
2253 listbuttonv $w.top.completeness.b completenessTmpValue {{None} 0 \
2254 {Incomplete subfield} 1 {Complete subfield} 2 {Complete field} 3}
2257 proc use-attr {init} {
2269 {BNB card number} 10
2270 {BGF(sic) number} 11
2272 {Dewey classification} 13
2273 {UDC classification} 14
2274 {Bliss classification} 15
2276 {NLM call number} 17
2277 {NAL call number} 18
2278 {MOS call number} 19
2279 {Local classification} 20
2280 {Subject heading} 21
2282 {BDI-index-subject} 23
2286 {LC-subject-heading} 27
2287 {RVM-subject-heading} 28
2288 {Local subject index} 29
2290 {Date of publication} 31
2291 {Date of acquisition} 32
2293 {Title-collective} 34
2296 {Title-added-title-page} 37
2300 {Title-other-variant} 41
2302 {Title-abbreviated} 43
2306 {Subject-subdivision} 47
2307 {Number-natl-bibliography} 48
2308 {Number-legal-deposit} 49
2309 {Number-govt-publication} 50
2310 {Number-publisher-for-music} 51
2312 {Number-local-call} 53
2314 {Code-geographic-area} 55
2315 {Code-institution} 56
2317 {Name-geographic} 58
2318 {Place-publication} 59
2320 {Microform-generation} 61
2327 {Author-name-personal} 1004
2328 {Author-name-corporate} 1005
2329 {Author-name-conference} 1006
2330 {Identifier-standard} 1007
2331 {Subject-LC-children's} 1008
2332 {Subject-name-personal} 1009
2334 {Date/time added to database} 1011
2335 {Date/time last modified} 1012
2336 {Authority/format identifier} 1013
2338 {Concept-reference} 1015
2340 {Server choice} 1017
2342 {Record source} 1019
2345 {Geographic class} 1022
2349 {Related periodical} 1026
2350 {Report number} 1027
2352 {Thematic number} 1030
2353 {Material type} 1031
2361 set l [llength $attr]
2366 for {set i 0} {$i < $l} {incr i} {
2367 $w.top.use.list insert end [lindex $attr $i]
2369 if {$useTmpValue == [lindex $attr $i]} {
2374 $w.top.use.list select from $s
2375 $w.top.use.list select to $s
2380 $w.top.use.list yview $s
2382 set lno [lindex [$w.top.use.list curselection] 0]
2383 set i [expr $lno+$lno+1]
2384 set useTmpValue [lindex $attr $i]
2385 dputs "useTmpValue=$useTmpValue"
2389 proc index-setup-action {oldAttr queryNo indexNo} {
2390 set attr [lindex $oldAttr 0]
2393 global relationTmpValue
2394 global structureTmpValue
2395 global truncationTmpValue
2396 global completenessTmpValue
2397 global positionTmpValue
2402 dputs "index-setup-action"
2403 dputs "queryNo $queryNo"
2404 dputs "indexNo $indexNo"
2405 if {$useTmpValue > 0} {
2406 lappend attr "1=$useTmpValue"
2408 if {$relationTmpValue > 0} {
2409 lappend attr "2=$relationTmpValue"
2411 if {$positionTmpValue > 0} {
2412 lappend attr "3=$positionTmpValue"
2414 if {$structureTmpValue > 0} {
2415 lappend attr "4=$structureTmpValue"
2417 if {$truncationTmpValue > 0} {
2418 lappend attr "5=$truncationTmpValue"
2420 if {$completenessTmpValue > 0} {
2421 lappend attr "6=$completenessTmpValue"
2423 dputs "new attr $attr"
2424 set queryInfoTmp [lreplace $queryInfoTmp $indexNo $indexNo $attr]
2425 destroy .index-setup
2428 proc index-setup {attr queryNo indexNo} {
2431 global relationTmpValue
2432 global structureTmpValue
2433 global truncationTmpValue
2434 global completenessTmpValue
2435 global positionTmpValue
2437 set relationTmpValue 0
2438 set truncationTmpValue 0
2439 set structureTmpValue 0
2440 set positionTmpValue 0
2441 set completenessTmpValue 0
2444 set len [llength $attr]
2445 for {set i 1} {$i < $len} {incr i} {
2446 set q [lindex $attr $i]
2447 set l [string first = $q]
2449 set t [string range $q 0 [expr $l - 1]]
2450 set v [string range $q [expr $l + 1] end]
2453 { set useTmpValue $v }
2455 { set relationTmpValue $v }
2457 { set positionTmpValue $v }
2459 { set structureTmpValue $v }
2461 { set truncationTmpValue $v }
2463 { set completenessTmpValue $v }
2467 if {[winfo exists $w]} {
2472 set n [lindex $attr 0]
2473 wm title $w "Index setup $n"
2477 frame $w.top.use -relief ridge -border 2
2478 frame $w.top.relation -relief ridge -border 2
2479 frame $w.top.position -relief ridge -border 2
2480 frame $w.top.structure -relief ridge -border 2
2481 frame $w.top.truncation -relief ridge -border 2
2482 frame $w.top.completeness -relief ridge -border 2
2488 pack $w.top.use -side left -pady 6 -padx 6 -fill y
2490 label $w.top.use.label -text "Use"
2491 listbox $w.top.use.list -geometry 26x10 \
2492 -yscrollcommand "$w.top.use.scroll set"
2493 scrollbar $w.top.use.scroll -orient vertical -border 1
2494 pack $w.top.use.label -side top -fill x \
2496 pack $w.top.use.list -side left -fill both -expand yes \
2498 pack $w.top.use.scroll -side right -fill y \
2500 $w.top.use.scroll config -command "$w.top.use.list yview"
2504 # Relation Attributes
2506 pack $w.top.relation -pady 6 -padx 6 -side top
2507 label $w.top.relation.label -text "Relation" -width 18
2509 pack $w.top.relation.label $w.top.relation.b -fill x
2511 # Position Attributes
2513 pack $w.top.position -pady 6 -padx 6 -side top
2514 label $w.top.position.label -text "Position" -width 18
2516 pack $w.top.position.label $w.top.position.b -fill x
2518 # Structure Attributes
2520 pack $w.top.structure -pady 6 -padx 6 -side top
2521 label $w.top.structure.label -text "Structure" -width 18
2523 pack $w.top.structure.label $w.top.structure.b -fill x
2525 # Truncation Attributes
2527 pack $w.top.truncation -pady 6 -padx 6 -side top
2528 label $w.top.truncation.label -text "Truncation" -width 18
2530 pack $w.top.truncation.label $w.top.truncation.b -fill x
2532 # Completeness Attributes
2534 pack $w.top.completeness -pady 6 -padx 6 -side top
2535 label $w.top.completeness.label -text "Completeness" -width 18
2537 pack $w.top.completeness.label $w.top.completeness.b -fill x
2540 bottom-buttons $w [list \
2541 {Ok} [list index-setup-action $attr $queryNo $indexNo] \
2542 {Cancel} [list destroy $w]] 0
2546 proc query-edit-index {queryNo} {
2550 set i [lindex [$w.top.index.list curselection] 0]
2554 set attr [lindex $queryInfoTmp $i]
2555 dputs "Editing no $i $attr"
2556 index-setup $attr $queryNo $i
2559 proc query-delete-index {queryNo} {
2561 global queryButtonsTmp
2564 set i [lindex [$w.top.index.list curselection] 0]
2568 set queryInfoTmp [lreplace $queryInfoTmp $i $i]
2569 index-lines $w.top.lines 0 $queryButtonsTmp $queryInfoTmp activate-e-index
2570 $w.top.index.list delete $i
2573 proc query-setup {queryNo} {
2579 global queryButtonsTmp
2581 global queryIndexTmp
2584 set queryName [lindex $queryTypes $queryNo]
2585 set queryInfoTmp [lindex $queryInfo $queryNo]
2586 set queryButtonsTmp [lindex $queryButtons $queryNo]
2591 wm title $w "Query setup $queryName"
2595 frame $w.top.lines -relief ridge -border 2
2597 pack $w.top.lines -side left -pady 6 -padx 6 -fill y
2601 index-lines $w.top.lines 0 $queryButtonsTmp $queryInfoTmp activate-e-index
2603 button $w.top.lines.add -text "Add" \
2604 -command [list query-add-line $queryNo]
2605 button $w.top.lines.del -text "Remove" \
2606 -command [list query-del-line $queryNo]
2608 pack $w.top.lines.del -fill x -side bottom
2609 pack $w.top.lines.add -fill x -pady 10 -side bottom
2613 frame $w.top.index -relief ridge -border 2
2614 pack $w.top.index -pady 6 -padx 6 -side right -fill y
2616 listbox $w.top.index.list -yscrollcommand [list $w.top.index.scroll set]
2617 scrollbar $w.top.index.scroll -orient vertical -border 1 \
2618 -command [list $w.top.index.list yview]
2619 bind $w.top.index.list <2> [list query-edit-index $queryNo]
2621 pack $w.top.index.list -side left -fill both -expand yes -padx 2 -pady 2
2622 pack $w.top.index.scroll -side right -fill y -padx 2 -pady 2
2624 $w.top.index.list select from 0
2625 $w.top.index.list select to 0
2627 foreach x $queryInfoTmp {
2628 $w.top.index.list insert end [lindex $x 0]
2631 bottom-buttons $w [list \
2632 {Ok} [list query-setup-action $queryNo] \
2633 {Add index} [list query-add-index $queryNo] \
2634 {Edit index} [list query-edit-index $queryNo] \
2635 {Delete index} [list query-delete-index $queryNo] \
2636 {Cancel} [list destroy $w]] 0
2639 proc index-clear {} {
2640 global queryButtonsFind
2643 foreach b $queryButtonsFind {
2644 .lines.$i.e delete 0 end
2649 proc index-query {} {
2650 global queryButtonsFind
2651 global queryInfoFind
2656 foreach b $queryButtonsFind {
2657 set term [string trim [.lines.$i.e get]]
2659 set attr [lrange [lindex $queryInfoFind [lindex $b 1]] 1 end]
2661 set len [string length $term]
2665 if {[string index $term $len] == "?"} {
2667 set term [string range $term 0 [expr $len - 1]]
2669 if {[string index $term 0] == "?"} {
2671 set term [string range $term 1 end]
2673 set term "\{${term}\}"
2674 if {$right && $left} {
2675 set term "@attr 5=3 ${term}"
2677 set term "@attr 5=1 ${term}"
2679 set term "@attr 5=2 ${term}"
2682 set term "@attr $a ${term}"
2685 set qs "@and ${qs} ${term}"
2696 proc index-focus-in {w i} {
2697 global curIndexEntry
2699 $w.$i configure -background red
2700 set curIndexEntry $i
2703 proc index-lines {w realOp buttonInfo queryInfo handle} {
2705 foreach b $buttonInfo {
2706 if {! [winfo exists $w.$i]} {
2707 frame $w.$i -background white -border 1
2709 listbuttonx $w.$i.l [lindex $b 1] $queryInfo $handle $i
2712 if {! [winfo exists $w.$i.e]} {
2713 entry $w.$i.e -width 32 -relief sunken -border 1
2714 bind $w.$i.e <FocusIn> [list index-focus-in $w $i]
2715 bind $w.$i.e <FocusOut> [list $w.$i configure \
2717 pack $w.$i.l -side left
2718 pack $w.$i.e -side left -fill x -expand yes
2719 pack $w.$i -side top -fill x -padx 2 -pady 2
2720 bind $w.$i.e <Left> [list left-cursor $w.$i.e]
2721 bind $w.$i.e <Right> [list right-cursor $w.$i.e]
2722 bind $w.$i.e <Return> {search-request 0}
2725 pack $w.$i.l -side left
2726 pack $w.$i -side top -fill x -padx 2 -pady 2
2731 while {[winfo exists $w.$j]} {
2742 bind $w.$j.e <Tab> "focus $w.$k.e"
2746 bind $w.$i.e <Tab> "focus $w.0.e"
2751 proc search-fields {w buttondefs} {
2753 foreach buttondef $buttondefs {
2754 frame $w.$i -background white
2756 listbutton $w.$i.l 0 $buttondef
2757 entry $w.$i.e -width 32 -relief sunken
2759 pack $w.$i.l -side left
2760 pack $w.$i.e -side left -fill x -expand yes
2762 pack $w.$i -side top -fill x -padx 2 -pady 2
2764 bind $w.$i.e <Left> [list left-cursor $w.$i.e]
2765 bind $w.$i.e <Right> [list right-cursor $w.$i.e]
2773 bind $w.$j.e <Tab> "focus $w.$k.e \n
2774 $w.$k configure -background red \n
2775 $w.$j configure -background white"
2778 bind $w.$i.e <Tab> "focus $w.0.e \n
2779 $w.0 configure -background red \n
2780 $w.$i configure -background white"
2782 $w.0 configure -background red
2785 if {[info exists windowGeometry(.)]} {
2786 set g $windowGeometry(.)
2794 frame .top -border 1 -relief raised
2795 frame .lines -border 1 -relief raised
2796 frame .mid -border 1 -relief raised
2797 frame .data -border 1 -relief raised
2798 frame .bot -border 1 -relief raised
2799 pack .top .lines .mid -side top -fill x
2800 pack .data -side top -fill both -expand yes
2803 menubutton .top.file -text "File" -menu .top.file.m
2805 .top.file.m add command -label "Save settings" -command {save-settings}
2806 .top.file.m add separator
2807 .top.file.m add command -label "Exit" -command {exit-action}
2809 menubutton .top.target -text "Target" -menu .top.target.m
2811 .top.target.m add cascade -label "Connect" -menu .top.target.m.clist
2812 .top.target.m add command -label "Disconnect" -command {close-target}
2813 .top.target.m add command -label "About" -command {about-target}
2814 .top.target.m add cascade -label "Setup" -menu .top.target.m.slist
2815 .top.target.m add command -label "Setup new" -command {define-target-dialog}
2816 .top.target.m add separator
2819 .top.target.m disable 1
2820 .top.target.m disable 2
2822 menu .top.target.m.clist
2823 menu .top.target.m.slist
2826 menubutton .top.service -text "Service" -menu .top.service.m
2828 .top.service.m add command -label "Database" -command {database-select}
2829 .top.service.m add cascade -label "Present" -menu .top.service.m.present
2830 menu .top.service.m.present
2831 .top.service.m.present add command -label "10 More" \
2832 -command [list present-more 10]
2833 .top.service.m.present add command -label "All" \
2834 -command [list present-more {}]
2835 .top.service.m add command -label "Search" -command {search-request 0}
2836 .top.service.m add command -label "Scan" -command {scan-request}
2838 .top.service configure -state disabled
2840 menubutton .top.rset -text "Set" -menu .top.rset.m
2842 .top.rset.m add command -label "Load" -command {load-set}
2843 .top.rset.m add separator
2845 menubutton .top.options -text "Options" -menu .top.options.m
2847 .top.options.m add cascade -label "Query" -menu .top.options.m.query
2848 .top.options.m add cascade -label "Format" -menu .top.options.m.formats
2849 .top.options.m add cascade -label "Wrap" -menu .top.options.m.wrap
2850 .top.options.m add cascade -label "Syntax" -menu .top.options.m.syntax
2852 menu .top.options.m.query
2853 .top.options.m.query add cascade -label "Select" \
2854 -menu .top.options.m.query.clist
2855 .top.options.m.query add cascade -label "Edit" \
2856 -menu .top.options.m.query.slist
2857 .top.options.m.query add command -label "New" \
2858 -command {query-new}
2859 .top.options.m.query add cascade -label "Delete" \
2860 -menu .top.options.m.query.dlist
2862 menu .top.options.m.query.slist
2863 menu .top.options.m.query.clist
2864 menu .top.options.m.query.dlist
2867 menu .top.options.m.formats
2869 foreach f $displayFormats {
2870 .top.options.m.formats add radiobutton -label $f -value $i \
2871 -command [list set-display-format $i] -variable displayFormat
2875 menu .top.options.m.wrap
2876 .top.options.m.wrap add radiobutton -label "Character" \
2877 -value char -variable textWrap -command {set-wrap char}
2878 .top.options.m.wrap add radiobutton -label "Word" \
2879 -value word -variable textWrap -command {set-wrap word}
2880 .top.options.m.wrap add radiobutton -label "None" \
2881 -value none -variable textWrap -command {set-wrap none}
2883 menu .top.options.m.syntax
2884 .top.options.m.syntax add radiobutton -label "None" \
2885 -value None -variable recordSyntax
2886 .top.options.m.syntax add separator
2887 .top.options.m.syntax add radiobutton -label "USMARC" \
2888 -value USMARC -variable recordSyntax
2889 .top.options.m.syntax add radiobutton -label "UNIMARC" \
2890 -value UNIMARC -variable recordSyntax
2891 .top.options.m.syntax add radiobutton -label "UKMARC" \
2892 -value UKMARC -variable recordSyntax
2893 .top.options.m.syntax add radiobutton -label "DANMARC" \
2894 -value DANMARC -variable recordSyntax
2895 .top.options.m.syntax add radiobutton -label "FINMARC" \
2896 -value FINMARC -variable recordSyntax
2897 .top.options.m.syntax add radiobutton -label "NORMARC" \
2898 -value NORMARC -variable recordSyntax
2899 .top.options.m.syntax add radiobutton -label "PICAMARC" \
2900 -value PICAMARC -variable recordSyntax
2901 .top.options.m.syntax add separator
2902 .top.options.m.syntax add radiobutton -label "SUTRS" \
2903 -value SUTRS -variable recordSyntax
2905 menubutton .top.help -text "Help" -menu .top.help.m
2908 .top.help.m add command -label "Help on help" \
2909 -command {tkerror "Help on help not available. Sorry"}
2910 .top.help.m add command -label "About" -command {about-origin}
2912 pack .top.file .top.target .top.service .top.rset .top.options -side left
2913 pack .top.help -side right
2915 index-lines .lines 1 $queryButtonsFind [lindex $queryInfo 0] activate-index
2917 button .mid.search -width 7 -text {Search} -command {search-request 0} \
2919 button .mid.scan -width 7 -text {Scan} \
2920 -command scan-request -state disabled
2921 button .mid.present -width 7 -text {Present} -command [list present-more 10] \
2924 button .mid.clear -width 7 -text {Clear} -command index-clear
2925 pack .mid.search .mid.scan .mid.present .mid.clear -side left \
2926 -fill y -padx 5 -pady 3
2928 text .data.record -height 2 -width 20 -wrap none \
2929 -yscrollcommand [list .data.scroll set] -wrap $textWrap
2930 scrollbar .data.scroll -command [list .data.record yview]
2931 pack .data.scroll -side right -fill y
2932 pack .data.record -expand yes -fill both
2935 if {[tk colormodel .] == "color"} {
2936 .data.record tag configure marc-tag -foreground blue
2937 .data.record tag configure marc-id -foreground red
2939 .data.record tag configure marc-tag -foreground black
2940 .data.record tag configure marc-id -foreground black
2942 .data.record tag configure marc-data -foreground black
2944 button .bot.logo -bitmap @${libdir}/bitmaps/book1 -command cancel-operation
2946 pack .bot.a -side left -fill x
2947 pack .bot.logo -side right -padx 2 -pady 2
2949 message .bot.a.target -text "" -aspect 1000 -border 1
2951 label .bot.a.status -text "Not connected" -width 15 -relief \
2952 sunken -anchor w -border 1
2953 label .bot.a.set -text "" -width 5 -relief \
2954 sunken -anchor w -border 1
2955 label .bot.a.message -text "" -width 15 -relief \
2956 sunken -anchor w -border 1
2958 pack .bot.a.target -side top -anchor nw -padx 2 -pady 2
2959 pack .bot.a.status .bot.a.set .bot.a.message \
2960 -side left -padx 2 -pady 2