1 # IR toolkit for tcl/tk
3 # See the file LICENSE for details.
4 # Sebastian Hammer, Adam Dickmeiss
7 # Revision 1.61 1995-07-20 08:09:39 adam
8 # client.tcl: Targets removed from hotTargets list when targets
9 # are removed/modified.
10 # ir-tcl.c: More work on triggerResourceControl.
12 # Revision 1.60 1995/06/30 16:30:19 adam
15 # Revision 1.59 1995/06/29 14:06:25 adam
16 # Another bug in install fixed. Configure searches for more versions of yaz.
18 # Revision 1.58 1995/06/29 12:34:06 adam
19 # IrTcl now works with both tk4.0b4/tcl7.4b4 and tk3.6/tcl7.3
21 # Revision 1.57 1995/06/29 09:20:30 adam
22 # Target entries in cascade menus are sorted.
24 # Revision 1.56 1995/06/27 19:03:48 adam
25 # Bug fix in do_present in ir-tcl.c: p->set_child member weren't set.
26 # nextResultSetPosition used instead of setOffset.
28 # Revision 1.55 1995/06/27 17:10:37 adam
29 # Bug fix: install procedure didn't work on some systems.
30 # Error turned up when clientrc.tcl was't present.
32 # Revision 1.54 1995/06/27 14:41:03 adam
33 # Bug fix in search-response. Didn't always observe non-surrogate diagnostics.
35 # Revision 1.53 1995/06/26 12:40:09 adam
36 # Client defines its own tkerror.
37 # User may specify 'no preferredRecordSyntax'.
39 # Revision 1.52 1995/06/22 13:14:59 adam
40 # Feature: SUTRS. Setting getSutrs implemented.
41 # Work on display formats.
42 # Preferred record syntax can be set by the user.
44 # Revision 1.51 1995/06/21 11:11:00 adam
45 # Bug fix: libdir undefined in about-origin.
47 # Revision 1.50 1995/06/21 11:04:48 adam
48 # Uses GNU autoconf 2.3.
49 # Install procedure implemented.
50 # boook bitmaps moved to sub directory bitmaps.
52 # Revision 1.49 1995/06/20 14:16:42 adam
53 # More work on cancel mechanism.
55 # Revision 1.48 1995/06/20 08:07:23 adam
56 # New setting: failInfo.
57 # Working on better cancel mechanism.
59 # Revision 1.47 1995/06/19 14:05:29 adam
60 # Bug fix: asked for SUTRS.
62 # Revision 1.46 1995/06/19 13:06:06 adam
63 # New define: IR_TCL_VERSION.
65 # Revision 1.45 1995/06/19 08:08:44 adam
66 # client.tcl: hotTargets now contain both database and target name.
67 # ir-tcl.c: setting protocol edited. Errors in callbacks are logged
68 # by logf(LOG_WARN, ...) calls.
70 # Revision 1.44 1995/06/16 14:55:18 adam
73 # Revision 1.43 1995/06/16 14:41:05 adam
74 # Scan line entries can be copied to a search entry.
76 # Revision 1.42 1995/06/16 12:28:13 adam
77 # Implemented preferredRecordSyntax.
78 # Minor changes in diagnostic handling.
79 # Record list deleted when connection closes.
81 # Revision 1.41 1995/06/14 15:07:59 adam
82 # Bug fix in cascade-target-list. Uses yaz-version.h.
84 # Revision 1.40 1995/06/14 13:37:17 adam
85 # Setting recordType implemented.
86 # Setting implementationVersion implemented.
87 # Settings implementationId / implementationName edited.
89 # Revision 1.39 1995/06/14 12:16:22 adam
90 # hotTargets, textWrap and displayFormat saved in clientg.tcl.
92 # Revision 1.38 1995/06/14 07:22:45 adam
93 # Target definitions can be deleted.
94 # Listbox used in the query definition dialog.
96 # Revision 1.37 1995/06/13 14:37:59 adam
97 # Work on query setup.
98 # Better about origin/target.
99 # Better presentation formats.
101 # Revision 1.36 1995/06/13 07:42:14 adam
102 # Bindings removed from text widgets.
104 # Revision 1.35 1995/06/12 15:17:31 adam
105 # Text widget used in main window (instead of listbox) to support
106 # better presentation formats.
108 # Revision 1.34 1995/06/12 07:59:07 adam
109 # More work on geometry handling.
111 # Revision 1.33 1995/06/09 11:17:35 adam
112 # Start work on geometry management.
114 # Revision 1.32 1995/06/07 09:16:37 adam
115 # New presentation format.
117 # Revision 1.31 1995/06/06 16:31:09 adam
118 # Bug fix: target names couldn't contain blanks.
121 # Revision 1.30 1995/06/06 11:35:41 adam
122 # Work on scan. Display of old sets.
124 # Revision 1.29 1995/06/05 14:11:18 adam
125 # Bug fix in present-more.
127 # Revision 1.28 1995/06/02 14:52:13 adam
128 # Minor changes really.
130 # Revision 1.27 1995/06/02 14:29:42 adam
131 # Work on scan interface - up/down buttons.
133 # Revision 1.26 1995/06/01 16:36:46 adam
134 # About buttons. Minor bug fixes.
136 # Revision 1.25 1995/05/31 13:09:57 adam
137 # Client searches/presents may be interrupted.
138 # New moving book-logo.
140 # Revision 1.24 1995/05/31 08:36:24 adam
141 # Bug fix in client.tcl: didn't save options on clientrc.tcl.
142 # New method: referenceId. More work on scan.
144 # Revision 1.23 1995/05/29 10:33:41 adam
145 # README and rename of startup script.
147 # Revision 1.22 1995/05/26 11:44:09 adam
148 # Bugs fixed. More work on MARC utilities and queries. Test
149 # client is up-to-date again.
151 # Revision 1.21 1995/05/11 15:34:46 adam
152 # Scan request changed a bit. This version works with RLG.
154 # Revision 1.20 1995/04/21 16:31:57 adam
155 # New radiobutton: protocol (z39v2/SR).
157 # Revision 1.19 1995/04/18 16:11:50 adam
158 # First version of graphical Scan. Some work on query-by-form.
160 # Revision 1.18 1995/04/10 10:50:22 adam
161 # Result-set name defaults to suffix of ir-set name.
162 # Started working on scan. Not finished at this point.
164 # Revision 1.17 1995/03/31 09:34:57 adam
165 # Search-button disabled when there is no connection.
167 # Revision 1.16 1995/03/31 08:56:36 adam
168 # New button "Search".
170 # Revision 1.15 1995/03/28 12:45:22 adam
171 # New ir method failback: called on disconnect/protocol error.
172 # New ir set/get method: protocol: SR / Z3950.
173 # Simple popup and disconnect when failback is invoked.
175 # Revision 1.14 1995/03/22 16:07:55 adam
178 # Revision 1.13 1995/03/21 17:27:26 adam
179 # Short-hand keys in setup.
181 # Revision 1.12 1995/03/21 13:41:03 adam
182 # Comstack cs_create not used too often. Non-blocking connect.
184 # Revision 1.11 1995/03/21 10:39:06 adam
185 # Diagnostic error message displayed with tkerror.
187 # Revision 1.10 1995/03/20 15:24:06 adam
188 # Diagnostic records saved on searchResponse.
190 # Revision 1.9 1995/03/17 18:26:16 adam
191 # Non-blocking i/o used now. Database names popup as cascade items.
193 # Revision 1.8 1995/03/17 15:45:00 adam
194 # Improved target/database setup.
196 # Revision 1.7 1995/03/16 17:54:03 adam
197 # Minor changes really.
199 # Revision 1.6 1995/03/15 19:10:20 adam
200 # Database setup in protocol-setup (rather target setup).
202 # Revision 1.5 1995/03/15 13:59:23 adam
205 # Revision 1.4 1995/03/14 17:32:29 adam
206 # Presentation of full Marc record in popup window.
208 # Revision 1.3 1995/03/12 19:31:52 adam
209 # Pattern matching implemented when retrieving MARC records. More
210 # diagnostic functions.
212 # Revision 1.2 1995/03/10 18:00:15 adam
213 # Actual presentation in line-by-line format. RPN query support.
215 # Revision 1.1 1995/03/09 16:15:07 adam
216 # First presentRequest attempts. Hot-target list.
220 if {$tk_version == "3.6"} {
227 proc configure-enable-e {w n} {
229 $w entryconfigure $n -state normal
231 proc configure-disable-e {w n} {
233 $w entryconfigure $n -state disabled
235 set noFocus [list -takefocus 0]
237 proc configure-enable-e {w n} {
240 proc configure-disable-e {w n} {
247 if {[tk colormodel .] == "color"} {
257 if {[file readable bitmaps/book2]} {
260 if {! [file readable ${libdir}/bitmaps/book2]} {
261 puts "Cannot locate system files in ${libdir}. You must either run this"
262 puts "program from the source directory root of ir-tcl or you must assure"
263 puts "that it is installed - normally in /usr/local/lib/irtcl"
271 set profile(Default) {{} {} {210} {} 16384 8192 tcpip {} 1 {} {} Z39 1}
273 set settingsChanged 0
282 set recordSyntax None
285 set queryTypes {Simple}
286 set queryButtons { { {I 0} {I 1} {I 2} } }
287 set queryInfo { { {Title {1=4 4=1}} {Author {1=1}} \
288 {Subject {1=21}} {Any {1=1016}} } }
297 if {[winfo exists $w]} {
306 label $w.top.b -bitmap error
307 message $w.top.t -aspect 300 -text "Error: $err" \
308 -font -Adobe-Helvetica-Bold-R-Normal-*-180-*
309 pack $w.top.b $w.top.t -side left -padx 10 -pady 10
311 bottom-buttons $w [list {Close} [list destroy $w]] 1
314 proc read-formats {} {
315 global displayFormats
317 set formats [glob -nocomplain ${libdir}/formats/*.tcl]
319 if {[file readable $f]} {
321 set l [string length $f]
322 set f [string range $f [string length "${libdir}/formats/"] \
324 lappend displayFormats $f
333 .data.record configure -wrap $m
340 proc set-display-format {f} {
350 .bot.a.status configure -text "Reformatting"
353 add-title-lines -1 10000 1
356 proc initBindings {} {
359 bind $w <Double-1> {}
360 bind $w <Triple-1> {}
361 bind $w <B1-Motion> {}
363 bind $w <Shift-B1-Motion> {}
365 bind $w <B2-Motion> {}
366 bind $w <Any-KeyPress> {}
368 bind $w <BackSpace> {}
370 bind $w <Control-h> {}
371 bind $w <Control-d> {}
372 bind $w <Control-v> {}
375 bind $w <B1-Motion> {}
376 bind $w <Shift-B1-Motion> {}
381 proc post-menu {wbutton wmenu} {
384 $wmenu post [winfo rootx $wbutton] \
385 [expr [winfo rooty $wbutton]+[winfo height $wbutton]]
390 global windowGeometry
391 set windowGeometry($w) [wm geometry $w]
394 global windowGeometry
397 if {[info exists windowGeometry($w)]} {
398 set g $windowGeometry($w)
403 bind $w <Destroy> [list destroyGW $w]
406 if {[file readable "clientrc.tcl"]} {
407 source "clientrc.tcl"
409 if {[file readable "${libdir}/clientrc.tcl"]} {
410 source "${libdir}/clientrc.tcl"
414 if {[file readable "~/.clientrc.tcl"]} {
415 source "~/.clientrc.tcl"
418 set queryButtonsFind [lindex $queryButtons 0]
419 set queryInfoFind [lindex $queryInfo 0]
421 proc top-down-window {w} {
422 frame $w.top -relief raised -border 1
423 frame $w.bot -relief raised -border 1
425 pack $w.top -side top -fill both -expand yes
426 pack $w.bot -fill both
429 proc top-down-ok-cancel {w ok-action g} {
430 frame $w.bot.left -relief sunken -border 1
431 pack $w.bot.left -side left -expand yes -ipadx 2 -ipady 2 -padx 5 -pady 5
432 button $w.bot.left.ok -width 6 -text {Ok} \
433 -command ${ok-action}
434 pack $w.bot.left.ok -expand yes -ipadx 2 -ipady 2 -padx 3 -pady 3
435 button $w.bot.cancel -width 6 -text {Cancel} \
436 -command [list destroy $w]
437 pack $w.bot.cancel -side left -expand yes
445 proc bottom-buttons {w buttonList g} {
447 set l [llength $buttonList]
449 frame $w.bot.$i -relief sunken -border 1
450 pack $w.bot.$i -side left -expand yes -padx 5 -pady 5
451 button $w.bot.$i.ok -text [lindex $buttonList $i] \
452 -command [lindex $buttonList [expr $i+1]]
453 pack $w.bot.$i.ok -expand yes -ipadx 3 -ipady 2 -padx 3 -pady 3 -side left
457 button $w.bot.$i -text [lindex $buttonList $i] \
458 -command [lindex $buttonList [expr $i+1]]
459 pack $w.bot.$i -expand yes -ipadx 2 -ipady 2 -padx 3 -pady 3 -side left
469 proc cancel-operation {} {
477 show-status Cancel 0 1
481 proc show-target {target base} {
485 .bot.a.target configure -text ""
489 .bot.a.target configure -text "$target"
491 .bot.a.target configure -text "$target - $base"
495 proc show-logo {v1} {
504 .bot.logo configure -bitmap @${libdir}/bitmaps/book${v1}
505 after 140 [list show-logo $v1]
509 .bot.logo configure -bitmap @${libdir}/bitmaps/book1
518 proc show-status {status b sb} {
525 .bot.a.status configure -text "$status"
527 if {$busy == 0} {set busy 1}
535 .top.service configure -state normal
536 .mid.search configure -state normal
538 .mid.scan configure -state normal
541 configure-disable-e .top.service.m 1
542 } elseif {[z39.$setNo nextResultSetPosition] > 0 &&
543 [z39.$setNo nextResultSetPosition] <= [z39.$setNo resultCount]} {
544 configure-enable-e .top.service.m 1
545 .mid.present configure -state normal
547 configure-disable-e .top.service.m 1
548 .mid.present configure -state disabled
550 if {[winfo exists .scan-window]} {
551 .scan-window.bot.2 configure -state normal
552 .scan-window.bot.4 configure -state normal
555 .top.service configure -state disabled
556 .mid.search configure -state disabled
557 .mid.scan configure -state disabled
558 .mid.present configure -state disabled
560 if {[winfo exists .scan-window]} {
561 .scan-window.bot.2 configure -state disabled
562 .scan-window.bot.4 configure -state disabled
567 proc show-message {msg} {
568 .bot.a.message configure -text "$msg"
571 proc insertWithTags {w text args} {
572 set start [$w index insert]
573 $w insert insert $text
574 foreach tag [$w tag names $start] {
575 $w tag remove $tag $start insert
578 $w tag add $i $start insert
582 proc popup-license {} {
587 wm title $w "License"
593 text $w.top.t -width 80 -height 10 -wrap word \
594 -yscrollcommand [list $w.top.s set]
595 scrollbar $w.top.s -command [list $w.top.t yview]
597 pack $w.top.s -side right -fill y
598 pack $w.top.t -expand yes -fill both
600 if {[file readable "${libdir}/LICENSE"]} {
601 set f [open "${libdir}/LICENSE" r]
602 while {[gets $f buf] != -1} {
603 $w.top.t insert end $buf
604 $w.top.t insert end "\n"
608 bottom-buttons $w [list {Close} [list destroy $w]] 1
611 proc about-target {} {
612 set w .about-target-w
617 wm title $w "About target"
621 frame $w.top.a -relief ridge -border 2
622 frame $w.top.p -relief ridge -border 2
624 pack $w.top.a $w.top.p -side top -fill x
626 label $w.top.a.about -text "About"
627 label $w.top.a.irtcl -text $hostid \
628 -font -Adobe-Helvetica-Bold-R-Normal-*-240-*
629 pack $w.top.a.about $w.top.a.irtcl -side top
631 set i [z39 targetImplementationName]
632 label $w.top.p.in -text "Implementation name: $i"
633 set i [z39 targetImplementationId]
634 label $w.top.p.ii -text "Implementation id: $i"
635 set i [z39 targetImplementationVersion]
636 label $w.top.p.iv -text "Implementation version: $i"
638 label $w.top.p.op -text "Protocol options: $i"
640 pack $w.top.p.in $w.top.p.ii $w.top.p.iv $w.top.p.op -side top -anchor nw
642 bottom-buttons $w [list {Close} [list destroy $w]] 1
645 proc about-origin-logo {n} {
647 set w .about-origin-w
648 if {![winfo exists $w]} {
655 $w.top.a.logo configure -bitmap @${libdir}/bitmaps/book$n
656 after 140 [list about-origin-logo $n]
659 proc about-origin {} {
660 set w .about-origin-w
663 if {[winfo exists $w]} {
668 wm title $w "About IrTcl"
672 frame $w.top.a -relief ridge -border 2
673 frame $w.top.p -relief ridge -border 2
675 pack $w.top.a $w.top.p -side top -fill x
677 label $w.top.a.irtcl -text "IrTcl" \
678 -font -Adobe-Helvetica-Bold-R-Normal-*-240-*
679 label $w.top.a.logo -bitmap @${libdir}/bitmaps/book1
680 pack $w.top.a.irtcl $w.top.a.logo -side left -expand yes
682 set i [z39 implementationName]
683 label $w.top.p.in -text "Implementation name: $i"
684 set i [z39 implementationId]
685 label $w.top.p.ii -text "Implementation id: $i"
686 set i [z39 implementationVersion]
687 label $w.top.p.iv -text "Implementation version: $i"
689 pack $w.top.p.in $w.top.p.ii $w.top.p.iv -side top -anchor nw
692 bottom-buttons $w [list {Close} [list destroy $w] \
693 {License} [list popup-license]] 0
696 proc popup-marc {sno no b df} {
698 global displayFormats
701 if {[z39.$sno type $no] != "DB"} {
705 set w .full-marc-$fullMarcSeq
712 if {[winfo exists $w]} {
720 frame $w.top -relief raised -border 1
721 frame $w.bot -relief raised -border 1
723 pack $w.top -side top -fill both -expand yes
724 pack $w.bot -fill both
726 text $w.top.record -width 60 -height 5 -wrap word \
727 -yscrollcommand [list $w.top.s set]
728 scrollbar $w.top.s -command [list $w.top.record yview]
732 $w.top.record tag configure marc-tag -foreground blue
733 $w.top.record tag configure marc-id -foreground red
735 $w.top.record tag configure marc-tag -foreground black
736 $w.top.record tag configure marc-id -foreground black
738 $w.top.record tag configure marc-data -foreground black
741 $w.top.record delete 0.0 end
742 set recordType [z39.$sno recordType $no]
743 wm title $w "$recordType record #$no"
746 bind $w.top.record <Return> {destroy .full-marc}
748 pack $w.top.s -side right -fill y
749 pack $w.top.record -expand yes -fill both
752 bottom-buttons $w [list \
753 {Close} [list destroy $w]] 0
755 bottom-buttons $w [list \
756 {Close} [list destroy $w] \
757 {Duplicate} [list popup-marc $sno $no 1 0]] 0
758 menubutton $w.bot.formats -text "Format" -menu $w.bot.formats.m
759 menu $w.bot.formats.m
761 foreach f $displayFormats {
762 $w.bot.formats.m add radiobutton -label $f \
763 -variable popupMarcdf -value $i \
764 -command [list display-$f $sno $no $w.top.record 0]
767 pack $w.bot.formats -expand yes -ipadx 2 -ipady 2 \
768 -padx 3 -pady 3 -side left
772 $w.bot.formats.m delete 0 last
773 foreach f $displayFormats {
774 $w.bot.formats.m add radiobutton -label $f \
775 -variable popupMarcdf -value $i \
776 -command [list display-$f $sno $no $w.top.record 0]
780 set ffunc [lindex $displayFormats $df]
781 set ffunc "display-$ffunc"
783 $ffunc $sno $no $w.top.record 0
786 proc update-target-hotlist {target base} {
789 set olen [llength $hotTargets]
791 foreach e $hotTargets {
792 if {$target == [lindex $e 0] && $base == [lindex $e 1]} {
793 set hotTargets [lreplace $hotTargets $i $i]
798 set hotTargets [linsert $hotTargets 0 [list $target $base]]
799 set-target-hotlist $olen
802 proc delete-target-hotlist {target} {
805 set olen [llength $hotTargets]
807 foreach e $hotTargets {
808 if {$target == [lindex $e 0]} {
809 set hotTargets [lreplace $hotTargets $i $i]
813 set-target-hotlist $olen
816 proc set-target-hotlist {olen} {
822 .top.target.m delete 7 [expr 7+$olen]
824 .top.target.m delete 6 [expr 6+$olen]
828 foreach e $hotTargets {
829 set target [lindex $e 0]
830 set base [lindex $e 1]
832 .top.target.m add command -label "$i $target" -command \
833 [list reopen-target $target {}]
835 .top.target.m add command -label "$i $target - $base" -command \
836 [list reopen-target $target $base]
845 proc reopen-target {target base} {
847 open-target $target $base
848 update-target-hotlist $target $base
851 proc define-target-action {} {
854 set target [.target-define.top.target.entry get]
858 foreach n [array names profile] {
864 set seq [lindex $profile(Default) 12]
866 set profile($target) $profile(Default)
867 set profile(Default) [lreplace $profile(Default) 12 12 [incr seq]]
869 protocol-setup $target
870 destroy .target-define
873 proc fail-response {target} {
874 set c [lindex [z39 failInfo] 0]
875 set m [lindex [z39 failInfo] 1]
880 proc connect-response {target base} {
881 dputs "connect-response"
882 show-target $target $base
886 proc open-target {target base} {
891 z39 comstack [lindex $profile($target) 6]
892 z39 protocol [lindex $profile($target) 11]
893 z39 idAuthentication [lindex $profile($target) 3]
894 z39 maximumRecordSize [lindex $profile($target) 4]
895 z39 preferredMessageSize [lindex $profile($target) 5]
896 dputs "maximumRecordSize="
897 dputs [z39 maximumRecordSize]
898 dputs "preferredMessageSize="
899 dputs [z39 preferredMessageSize]
900 show-status {Connecting} 1 0
902 z39 databaseNames [lindex [lindex $profile($target) 7] 0]
904 z39 databaseNames $base
906 z39 failback [list fail-response $target]
907 z39 callback [list connect-response $target $base]
910 z39 connect [lindex $profile($target) 1]:[lindex $profile($target) 2]
913 tkerror $errorMessage
914 show-status "Not connected" 0 {}
918 configure-disable-e .top.target.m 0
919 configure-enable-e .top.target.m 1
920 configure-enable-e .top.target.m 2
923 proc close-target {} {
933 .bot.a.set configure -text ""
937 show-status {Not connected} 0 0
940 configure-disable-e .top.target.m 1
941 configure-disable-e .top.target.m 2
943 .top.rset.m delete 2 last
945 .top.rset.m delete 1 last
947 .top.rset.m add separator
948 configure-enable-e .top.target.m 0
951 proc load-set-action {} {
955 ir-set z39.$setNoLast z39
957 set fname [.load-set.top.filename.entry get]
960 show-status {Loading} 1 {}
962 z39.$setNoLast loadFile $fname
964 set no [z39.$setNoLast numberOfRecordsReturned]
965 add-title-lines $setNoLast $no 1
967 set l [format "%-4d %7d" $setNoLast $no]
968 .top.rset.m add command -label $l \
969 -command [list add-title-lines $setNoLast 10000 1]
970 show-status {Ready} 0 {}
980 frame $w.top.filename
981 pack $w.top.filename -side top -anchor e -pady 2
983 entry-fields $w.top {filename} \
985 {load-set-action} {destroy .load-set}
987 top-down-ok-cancel $w {load-set-action} 1
991 proc init-request {} {
998 z39 callback {init-response}
999 show-status {Initializing} 1 {}
1000 set err [catch {z39 init} errorMessage]
1002 tkerror $errorMessage
1003 show-status Ready 0 {}
1007 proc init-response {} {
1015 if {![z39 initResult]} {
1016 show-status {Ready} 0 1
1017 set u [z39 userInformationField]
1019 tkerror "Connection rejected by target: $u"
1021 if {[lsearch [z39 options] scan] >= 0} {
1026 show-status {Ready} 0 1
1030 proc search-request {bflag} {
1042 dputs "search-request"
1044 if {!$bflag && $busy} {
1045 dputs "busy: search-request ignored"
1050 show-status {Searching} 1 0
1051 set delayRequest {search-request 1}
1056 set query [index-query]
1061 set setNo $setNoLast
1062 ir-set z39.$setNo z39
1064 if {[lindex $profile($target) 10] == 1} {
1065 z39.$setNo setName $setNo
1066 dputs "setName=${setNo}"
1068 z39.$setNo setName Default
1069 dputs "setName=Default"
1071 if {[lindex $profile($target) 8] == 1} {
1072 z39.$setNo queryType rpn
1074 if {[lindex $profile($target) 9] == 1} {
1075 z39.$setNo queryType ccl
1079 if {$recordSyntax == "None" } {
1080 z39.$setNo preferredRecordSyntax {}
1082 z39.$setNo preferredRecordSyntax $recordSyntax
1084 z39 callback {search-response}
1085 z39.$setNo search $query
1086 show-status {Searching} 1 0
1089 proc scan-copy {y entry} {
1091 set no [$w.top.list nearest $y]
1093 .lines.$entry.e delete 0 end
1094 .lines.$entry.e insert 0 [string range [$w.top.list get $no] 8 end]
1097 proc scan-request {} {
1104 global curIndexEntry
1105 global queryButtonsFind
1106 global queryInfoFind
1110 dputs "scan-request"
1113 show-status {Scanning} 1 0
1114 set delayRequest scan-request
1123 set b [lindex $queryButtonsFind $curIndexEntry]
1125 foreach a [lrange [lindex $queryInfoFind [lindex $b 1]] 1 end] {
1126 set attr "@attr $a $attr"
1128 set title [lindex [lindex $queryInfoFind [lindex $b 1]] 0]
1129 ir-scan z39.scan z39
1131 if {![winfo exists $w]} {
1138 entry $w.top.entry -relief sunken
1139 pack $w.top.entry -fill x -padx 4 -pady 2
1140 bind $w.top.entry <KeyRelease> [list scan-term-h $attr]
1141 listbox $w.top.list -yscrollcommand [list $w.top.scroll set] \
1143 scrollbar $w.top.scroll -orient vertical -border 1
1144 pack $w.top.list -side left -fill both -expand yes
1145 pack $w.top.scroll -side right -fill y
1146 $w.top.scroll config -command [list $w.top.list yview]
1148 bottom-buttons $w [list {Close} [list destroy $w] \
1149 {Up} [list scan-up $attr] \
1150 {Down} [list scan-down $attr]] 0
1151 bind $w.top.list <Up> [list scan-up $attr]
1152 bind $w.top.list <Down> [list scan-down $attr]
1155 bind $w.top.list <Double-Button-1> [list scan-copy %y $curIndexEntry]
1156 wm title $w "Scan $title"
1158 z39 callback [list scan-response $attr 0 35]
1159 z39.scan numberOfTermsRequested 5
1160 z39.scan preferredPositionInResponse 1
1161 z39.scan scan "${attr} 0"
1163 show-status {Scanning} 1 0
1166 proc scan-term-h {attr} {
1174 set nScanTerm [$w.top.entry get]
1175 if {$nScanTerm == $scanTerm} {
1178 set scanTerm $nScanTerm
1179 z39 callback [list scan-response $attr 0 35]
1180 z39.scan numberOfTermsRequested 5
1181 z39.scan preferredPositionInResponse 1
1182 dputs "${attr} \{${scanTerm}\}"
1183 if {$scanTerm == ""} {
1184 z39.scan scan "${attr} 0"
1186 z39.scan scan "${attr} \{${scanTerm}\}"
1188 show-status {Scanning} 1 0
1191 proc scan-response {attr start toget} {
1198 dputs "In scan-response"
1199 set m [z39.scan numberOfEntriesReturned]
1205 if {![winfo exists .scan-window]} {
1208 dputs "Handling cancel"
1209 if {$delayRequest != ""} {
1214 show-status {Ready} 0 1
1217 set nScanTerm [$w.top.entry get]
1218 if {$nScanTerm != $scanTerm} {
1219 z39 callback [list scan-response $attr 0 35]
1220 z39.scan numberOfTermsRequested 5
1221 z39.scan preferredPositionInResponse 1
1222 set scanTerm $nScanTerm
1223 dputs "${attr} \{${scanTerm}\}"
1224 if {$scanTerm == ""} {
1225 z39.scan scan "${attr} 0"
1227 z39.scan scan "${attr} \{${scanTerm}\}"
1229 show-status {Scanning} 1 0
1232 set status [z39.scan scanStatus]
1235 show-status {Ready} 0 1
1240 for {set i 0} {$i < $m} {incr i} {
1241 set term [lindex [z39.scan scanLine $i] 1]
1242 set nostr [format " %-6d" [lindex [z39.scan scanLine $i] 2]]
1243 $w.top.list insert $i "$nostr $term"
1246 $w.top.list yview $scanView
1248 $w.top.list delete $start end
1249 for {set i 0} {$i < $m} {incr i} {
1250 set term [lindex [z39.scan scanLine $i] 1]
1251 set nostr [format " %-6d" [lindex [z39.scan scanLine $i] 2]]
1252 $w.top.list insert end "$nostr $term"
1256 dputs "Handling cancel"
1258 if {$delayRequest != ""} {
1264 if {$toget > 0 && $m > 1 && $m < $toget} {
1265 set ntoget [expr $toget - $m + 1]
1266 dputs ntoget=$ntoget
1267 z39 callback [list scan-response $attr [expr $start + $m - 1] $ntoget]
1269 dputs "down continue: $q"
1271 z39.scan numberOfTermsRequested 10
1273 z39.scan numberOfTermsRequested $ntoget
1275 z39.scan preferredPositionInResponse 1
1276 dputs "${attr} \{$q\}"
1277 z39.scan scan "${attr} \{$q\}"
1280 if {$toget < 0 && $m > 1 && $m < [expr - $toget]} {
1281 set ntoget [expr - $toget - $m]
1282 dputs ntoget=$ntoget
1283 z39 callback [list scan-response $attr 0 -$ntoget]
1284 set q [string range [$w.top.list get 0] 8 end]
1285 dputs "up continue: $q"
1287 z39.scan numberOfTermsRequested 10
1288 z39.scan preferredPositionInResponse 11
1290 z39.scan numberOfTermsRequested $ntoget
1291 z39.scan preferredPositionInResponse [incr ntoget]
1293 dputs "${attr} \{$q\}"
1294 z39.scan scan "${attr} \{$q\}"
1297 show-status {Ready} 0 1
1300 proc scan-down {attr} {
1308 show-status {Scanning down} 1 0
1309 set delayRequest [list scan-down $attr]
1315 set scanView [expr $scanView + 5]
1316 set s [$w.top.list size]
1317 if {$scanView > $s} {
1318 z39 callback [list scan-response $attr [expr $s - 1] 25]
1319 set q [string range [$w.top.list get [expr $s - 1]] 8 end]
1321 z39.scan numberOfTermsRequested 10
1322 z39.scan preferredPositionInResponse 1
1323 show-status {Scanning} 1 0
1324 dputs "${attr} \{$q\}"
1325 z39.scan scan "${attr} \{$q\}"
1328 $w.top.list yview $scanView
1331 proc scan-up {attr} {
1339 show-status {Scanning up} 1 0
1340 set delayRequest [list scan-up $attr]
1346 set scanView [expr $scanView - 5]
1347 if {$scanView < 0} {
1348 z39 callback [list scan-response $attr 0 -25]
1349 set q [string range [$w.top.list get 0] 8 end]
1351 z39.scan numberOfTermsRequested 10
1352 z39.scan preferredPositionInResponse 11
1353 show-status {Scanning} 1 0
1354 z39.scan scan "${attr} \{$q\}"
1357 $w.top.list yview $scanView
1360 proc search-response {} {
1368 dputs "In search-response"
1370 dputs "Handling cancel"
1372 if {$delayRequest != ""} {
1380 set setMax [z39.$setNo resultCount]
1381 show-status {Ready} 0 1
1382 set status [z39.$setNo responseStatus]
1383 if {[lindex $status 0] == "NSD"} {
1384 z39.$setNo nextResultSetPosition 0
1385 set code [lindex $status 1]
1386 set msg [lindex $status 2]
1387 set addinfo [lindex $status 3]
1388 tkerror "NSD$code: $msg: $addinfo"
1391 show-message "${setMax} hits"
1396 show-status {Ready} 0 1
1397 set l [format "%-4d %7d" $setNo $setMax]
1398 .top.rset.m add command -label $l \
1399 -command [list add-title-lines $setNo 10000 1]
1403 z39 callback {present-response}
1404 z39.$setNo present $setOffset 1
1405 show-status {Retrieving} 1 0
1408 proc present-more {number} {
1416 dputs "present-more"
1418 show-status {Retrieving} 1 0
1419 set delayRequest "present-more $number"
1425 dputs "setNo=$setNo"
1428 set setOffset [z39.$setNo nextResultSetPosition]
1429 dputs "setOffest=${setOffset}"
1430 dputs "setNo=${setNo}"
1431 set max [z39.$setNo resultCount]
1432 if {$max < $setOffset} {
1434 dputs "setOffset=$setOffset"
1435 show-status Ready 0 1
1438 if {$number == ""} {
1442 if {$setMax > $max} {
1446 z39 callback {present-response}
1448 set toGet [expr $setMax - $setOffset + 1]
1455 z39.$setNo present $setOffset $toGet
1456 show-status {Retrieving} 1 0
1459 proc init-title-lines {} {
1460 .data.record delete 0.0 end
1463 proc title-press {y setno} {
1464 show-full-marc $setno [expr 1 + [.data.list nearest $y]] 0
1467 proc add-title-lines {setno no offset} {
1468 global displayFormats
1469 global displayFormat
1479 .bot.a.set configure -text $setno
1480 .data.record delete 0.0 end
1482 set ffunc [lindex $displayFormats $displayFormat]
1483 dputs "ffunc=$ffunc"
1484 set ffunc "display-$ffunc"
1485 for {set i 0} {$i < $no} {incr i} {
1486 set o [expr $i + $offset]
1487 set type [z39.$setno type $o]
1491 .data.record tag bind r$o <Any-Enter> {}
1492 .data.record tag bind r$o <Any-Leave> {}
1493 set insert0 [.data.record index insert]
1494 $ffunc $setno $o .data.record 1
1495 .data.record tag add r$o $insert0 insert
1496 .data.record tag bind r$o <1> \
1497 [list popup-marc $setno $o 0 0]
1501 show-status Ready 0 1
1505 proc present-response {} {
1512 dputs "In present-response"
1513 set no [z39.$setNo numberOfRecordsReturned]
1514 dputs "Returned $no records, setOffset $setOffset"
1515 add-title-lines $setNo $no $setOffset
1516 set setOffset [expr $setOffset + $no]
1518 dputs "Handling cancel"
1520 if {$delayRequest != ""} {
1525 set status [z39.$setNo responseStatus]
1526 if {[lindex $status 0] == "NSD"} {
1527 show-status {Ready} 0 1
1528 set code [lindex $status 1]
1529 set msg [lindex $status 2]
1530 set addinfo [lindex $status 3]
1531 tkerror "NSD$code: $msg: $addinfo"
1534 if {$no > 0 && $setOffset <= $setMax} {
1535 dputs "present-request from ${setOffset}"
1536 set toGet [expr $setMax - $setOffset + 1]
1540 z39.$setNo present $setOffset $toGet
1542 show-status {Ready} 0 1
1546 proc left-cursor {w} {
1547 set i [$w index insert]
1555 proc right-cursor {w} {
1556 set i [$w index insert]
1562 proc bind-fields {list returnAction escapeAction} {
1564 set max [expr [llength $list]-1]
1565 for {set i 0} {$i < $max} {incr i} {
1566 bind [lindex $list $i] <Return> $returnAction
1567 bind [lindex $list $i] <Escape> $escapeAction
1569 bind [lindex $list $i] <Tab> \
1570 [list focus [lindex $list [expr $i+1]]]
1571 bind [lindex $list $i] <Left> \
1572 [list left-cursor [lindex $list $i]]
1573 bind [lindex $list $i] <Right> \
1574 [list right-cursor [lindex $list $i]]
1577 bind [lindex $list $i] <Return> $returnAction
1578 bind [lindex $list $i] <Escape> $escapeAction
1580 bind [lindex $list $i] <Tab> [list focus [lindex $list 0]]
1581 bind [lindex $list $i] <Left> [list left-cursor [lindex $list $i]]
1582 bind [lindex $list $i] <Right> [list right-cursor [lindex $list $i]]
1584 focus [lindex $list 0]
1587 proc entry-fields {parent list tlist returnAction escapeAction} {
1590 foreach field $list {
1591 set label ${parent}.${field}.label
1592 set entry ${parent}.${field}.entry
1593 label $label -text [lindex $tlist $i] -anchor e
1594 entry $entry -width 32 -relief sunken
1595 pack $label -side left
1596 pack $entry -side right
1597 lappend alist $entry
1600 bind-fields $alist $returnAction $escapeAction
1603 proc define-target-dialog {} {
1604 set w .target-define
1610 pack $w.top.target \
1611 -side top -anchor e -pady 2
1612 entry-fields $w.top {target} \
1614 {define-target-action} {destroy .target-define}
1615 top-down-ok-cancel $w {define-target-action} 1
1618 proc protocol-setup-delete {target} {
1620 global settingsChanged
1622 set a [alert "Are you sure you want to delete the target \
1623 definition $target ?"]
1625 set wno [lindex $profile($target) 12]
1628 unset profile($target)
1629 set settingsChanged 1
1631 delete-target-hotlist $target
1635 proc protocol-setup-action {target} {
1638 global protocolRadioType
1639 global settingsChanged
1642 global ResultSetCheck
1644 set wno [lindex $profile($target) 12]
1648 set settingsChanged 1
1649 set len [$w.top.databases.list size]
1650 for {set i 0} {$i < $len} {incr i} {
1651 lappend b [$w.top.databases.list get $i]
1653 set profile($target) [list [$w.top.description.entry get] \
1654 [$w.top.host.entry get] \
1655 [$w.top.port.entry get] \
1656 [$w.top.idAuthentication.entry get] \
1657 [$w.top.maximumRecordSize.entry get] \
1658 [$w.top.preferredMessageSize.entry get] \
1664 $protocolRadioType \
1668 delete-target-hotlist $target
1669 dputs $profile($target)
1673 proc place-force {window parent} {
1674 set g [wm geometry $parent]
1676 set p1 [string first + $g]
1677 set p2 [string last + $g]
1679 set x [expr 40+[string range $g [expr $p1 +1] [expr $p2 -1]]]
1680 set y [expr 60+[string range $g [expr $p2 +1] end]]
1681 wm geometry $window +${x}+${y}
1684 proc add-database-action {target} {
1687 set wno [lindex $profile($target) 12]
1690 $w.top.databases.list insert end \
1691 [.database-select.top.database.entry get]
1692 destroy .database-select
1695 proc add-database {target} {
1698 set w .database-select
1700 set oldFocus [focus]
1702 set wno [lindex $profile($target) 12]
1703 place-force $w .setup-${wno}
1707 frame $w.top.database
1709 pack $w.top.database -side top -anchor e -pady 2
1711 entry-fields $w.top {database} \
1712 {{Database to add:}} \
1713 [list add-database-action $target] {destroy .database-select}
1715 top-down-ok-cancel $w [list add-database-action $target] 1
1719 proc delete-database {target} {
1722 set wno [lindex $profile($target) 12]
1725 foreach i [$w.top.databases.list curselection] {
1726 set b [$w.top.databases.list get $i]
1729 set a [alert "Are you sure you want to remove the database(s)${l}?"]
1731 foreach i [lsort -decreasing \
1732 [$w.top.databases.list curselection]] {
1733 $w.top.databases.list delete $i
1738 proc protocol-setup {target} {
1741 global protocolRadioType
1744 global ResultSetCheck
1746 set wno [lindex $profile($target) 12]
1751 wm title $w "Setup $target"
1755 if {$target == ""} {
1759 dputs $profile($target)
1761 frame $w.top.description
1764 frame $w.top.idAuthentication
1765 frame $w.top.maximumRecordSize
1766 frame $w.top.preferredMessageSize
1767 frame $w.top.cs-type -relief ridge -border 2
1768 frame $w.top.protocol -relief ridge -border 2
1769 frame $w.top.query -relief ridge -border 2
1770 frame $w.top.databases -relief ridge -border 2
1772 # Maximum/preferred/idAuth ...
1773 pack $w.top.description $w.top.host $w.top.port \
1774 $w.top.idAuthentication $w.top.maximumRecordSize \
1775 $w.top.preferredMessageSize -side top -anchor e -pady 2
1777 entry-fields $w.top {description host port idAuthentication \
1778 maximumRecordSize preferredMessageSize} \
1779 {{Description:} {Host:} {Port:} {Id Authentication:} \
1780 {Maximum Record Size:} {Preferred Message Size:}} \
1781 [list protocol-setup-action $target] [list destroy $w]
1783 foreach sub {description host port idAuthentication \
1784 maximumRecordSize preferredMessageSize} {
1786 bind $w.top.$sub.entry <Control-a> [list add-database $target]
1787 bind $w.top.$sub.entry <Control-d> [list delete-database $target]
1789 $w.top.description.entry insert 0 [lindex $profile($target) 0]
1790 $w.top.host.entry insert 0 [lindex $profile($target) 1]
1791 $w.top.port.entry insert 0 [lindex $profile($target) 2]
1792 $w.top.idAuthentication.entry insert 0 [lindex $profile($target) 3]
1793 $w.top.maximumRecordSize.entry insert 0 [lindex $profile($target) 4]
1794 $w.top.preferredMessageSize.entry insert 0 [lindex $profile($target) 5]
1795 set csRadioType [lindex $profile($target) 6]
1796 set RPNCheck [lindex $profile($target) 8]
1797 set CCLCheck [lindex $profile($target) 9]
1798 set ResultSetCheck [lindex $profile($target) 10]
1799 set protocolRadioType [lindex $profile($target) 11]
1800 if {$protocolRadioType == ""} {
1801 set protocolRadioType Z39
1805 pack $w.top.databases -side left -pady 4 -padx 4 -expand yes -fill both
1807 label $w.top.databases.label -text "Databases"
1808 button $w.top.databases.add -text "Add" \
1809 -command [list add-database $target]
1810 button $w.top.databases.delete -text "Delete" \
1811 -command [list delete-database $target]
1814 listbox $w.top.databases.list -geometry 20x6 \
1815 -yscrollcommand "$w.top.databases.scroll set"
1817 listbox $w.top.databases.list -width 20 \
1818 -yscrollcommand "$w.top.databases.scroll set"
1820 scrollbar $w.top.databases.scroll -orient vertical -border 1
1821 pack $w.top.databases.label -side top -fill x \
1823 pack $w.top.databases.add $w.top.databases.delete -side top -fill x \
1825 pack $w.top.databases.list -side left -fill both -expand yes \
1827 pack $w.top.databases.scroll -side right -fill y \
1829 $w.top.databases.scroll config -command "$w.top.databases.list yview"
1831 foreach b [lindex $profile($target) 7] {
1832 $w.top.databases.list insert end $b
1836 pack $w.top.cs-type -pady 4 -padx 4 -side top -fill x
1838 label $w.top.cs-type.label -text "Transport"
1839 radiobutton $w.top.cs-type.tcpip -text "TCP/IP" -anchor w \
1840 -variable csRadioType -value tcpip
1841 radiobutton $w.top.cs-type.mosi -text "MOSI" -anchor w\
1842 -variable csRadioType -value mosi
1844 pack $w.top.cs-type.label $w.top.cs-type.tcpip $w.top.cs-type.mosi \
1845 -padx 4 -side top -fill x
1848 pack $w.top.protocol -pady 4 -padx 4 -side top -fill x
1850 label $w.top.protocol.label -text "Protocol"
1851 radiobutton $w.top.protocol.z39v2 -text "Z39.50" -anchor w \
1852 -variable protocolRadioType -value Z39
1853 radiobutton $w.top.protocol.sr -text "SR" -anchor w \
1854 -variable protocolRadioType -value SR
1856 pack $w.top.protocol.label $w.top.protocol.z39v2 $w.top.protocol.sr \
1857 -padx 4 -side top -fill x
1860 pack $w.top.query -pady 4 -padx 4 -side top -fill x
1862 label $w.top.query.label -text "Query support"
1863 checkbutton $w.top.query.c1 -text "RPN query" -anchor w -variable RPNCheck
1864 checkbutton $w.top.query.c2 -text "CCL query" -anchor w -variable CCLCheck
1865 checkbutton $w.top.query.c3 -text "Result sets" -anchor w -variable ResultSetCheck
1867 pack $w.top.query.label -side top
1868 pack $w.top.query.c1 $w.top.query.c2 $w.top.query.c3 \
1869 -padx 4 -side top -fill x
1872 bottom-buttons $w [list {Ok} [list protocol-setup-action $target] \
1873 {Delete} [list protocol-setup-delete $target] \
1874 {Cancel} [list destroy $w]] 0
1877 proc database-select-action {} {
1878 set w .database-select.top
1880 foreach indx [$w.databases.list curselection] {
1881 lappend b [$w.databases.list get $indx]
1884 z39 databaseNames $b
1886 destroy .database-select
1889 proc database-select {} {
1890 set w .database-select
1895 set oldFocus [focus]
1900 frame $w.top.databases -relief ridge -border 2
1902 pack $w.top.databases -side left -pady 6 -padx 6 -expand yes -fill x
1904 label $w.top.databases.label -text "List"
1905 listbox $w.top.databases.list -geometry 20x6 \
1906 -yscrollcommand "$w.top.databases.scroll set"
1907 scrollbar $w.top.databases.scroll -orient vertical -border 1
1908 pack $w.top.databases.label -side top -fill x \
1910 pack $w.top.databases.list -side left -fill both -expand yes \
1912 pack $w.top.databases.scroll -side right -fill y \
1914 $w.top.databases.scroll config -command "$w.top.databases.list yview"
1916 foreach b [lindex $profile($hostid) 7] {
1917 $w.top.databases.list insert end $b
1919 top-down-ok-cancel $w {database-select-action} 1
1923 proc cascade-target-list {} {
1926 foreach sub [winfo children .top.target.m.clist] {
1929 .top.target.m.clist delete 0 last
1930 foreach n [lsort [array names profile]] {
1931 if {$n != "Default"} {
1932 set nl [lindex $profile($n) 12]
1933 if {[llength [lindex $profile($n) 7]] > 1} {
1934 .top.target.m.clist add cascade -label $n \
1935 -menu .top.target.m.clist.$nl
1936 menu .top.target.m.clist.$nl
1937 foreach b [lindex $profile($n) 7] {
1938 .top.target.m.clist.$nl add command -label $b \
1939 -command [list reopen-target $n $b]
1942 .top.target.m.clist add command -label $n \
1943 -command [list reopen-target $n {}]
1947 .top.target.m.slist delete 0 last
1948 foreach n [lsort [array names profile]] {
1949 if {$n != "Default"} {
1950 .top.target.m.slist add command -label $n \
1951 -command [list protocol-setup $n]
1956 proc query-select {i} {
1957 global queryButtonsFind
1958 global queryInfoFind
1962 set queryInfoFind [lindex $queryInfo $i]
1963 set queryButtonsFind [lindex $queryButtons $i]
1965 index-lines .lines 1 $queryButtonsFind $queryInfoFind activate-index
1968 proc query-new-action {} {
1972 global settingsChanged
1974 set settingsChanged 1
1975 lappend queryTypes [.query-new.top.index.entry get]
1976 lappend queryButtons {}
1977 lappend queryInfo {}
1987 set oldFocus [focus]
1992 -side top -anchor e -pady 2
1993 entry-fields $w.top index \
1995 query-new-action {destroy .query-new}
1996 top-down-ok-cancel $w query-new-action 1
2000 proc query-delete-action {queryNo} {
2004 global settingsChanged
2006 set settingsChanged 1
2008 set queryTypes [lreplace $queryTypes $queryNo $queryNo]
2009 set queryButtons [lreplace $queryButtons $queryNo $queryNo]
2010 set queryInfo [lreplace $queryInfo $queryNo $queryNo]
2011 destroy .query-delete
2015 proc query-delete {queryNo} {
2023 set n [lindex $queryTypes $queryNo]
2025 label $w.top.warning -bitmap warning
2026 message $w.top.quest -text "Are you sure you want to delete the \
2027 query type $n ?" -aspect 300
2028 pack $w.top.warning $w.top.quest -side left -expand yes -padx 10 -pady 5
2029 bottom-buttons $w [list {Ok} [list query-delete-action $queryNo] \
2030 {Cancel} [list destroy $w]] 1
2033 proc cascade-query-list {} {
2035 set w .top.options.m.query
2038 $w.slist delete 0 last
2039 foreach n $queryTypes {
2040 $w.slist add command -label $n -command [list query-setup $i]
2045 $w.clist delete 0 last
2046 foreach n $queryTypes {
2047 $w.clist add command -label $n -command [list query-select $i]
2051 $w.dlist delete 0 last
2052 foreach n $queryTypes {
2053 $w.dlist add command -label $n -command [list query-delete $i]
2058 proc save-geometry {} {
2059 global windowGeometry
2062 global displayFormat
2066 set windowGeometry(.) [wm geometry .]
2068 set f [open "~/.clientrc.tcl" w]
2070 puts $f "set hotTargets \{ $hotTargets \}"
2071 puts $f "set textWrap $textWrap"
2072 puts $f "set displayFormat $displayFormat"
2073 puts $f "set popupMarcdf $popupMarcdf"
2074 puts $f "set recordSyntax $recordSyntax"
2075 foreach n [array names windowGeometry] {
2076 puts -nonewline $f "set \{windowGeometry($n)\} \{"
2077 puts -nonewline $f $windowGeometry($n)
2083 proc save-settings {} {
2086 global settingsChanged
2091 if {![file writable "${libdir}/clientrc.tcl"]} {
2092 set a [alert "Cannot open ${libdir}/clientrc.tcl for writing. Do you \
2093 wish to save clientrc.tcl in the current directory instead?"]
2097 set f [open "clientrc.tcl" w]
2099 set f [open "${libdir}/clientrc.tcl" w]
2101 puts $f "# Setup file"
2103 foreach n [array names profile] {
2104 puts -nonewline $f "set \{profile($n)\} \{"
2105 puts -nonewline $f $profile($n)
2108 puts -nonewline $f "set queryTypes \{"
2109 puts -nonewline $f $queryTypes
2112 puts -nonewline $f "set queryButtons \{"
2113 puts -nonewline $f $queryButtons
2116 puts -nonewline $f "set queryInfo \{"
2117 puts -nonewline $f $queryInfo
2120 set settingsChanged 0
2129 set oldFocus [focus]
2133 label $w.top.warning -bitmap warning
2134 message $w.top.message -text $ask -aspect 300 \
2135 -font -Adobe-Times-Medium-R-Normal-*-180-*
2137 pack $w.top.warning $w.top.message -side left -pady 5 -padx 10 -expand yes
2140 top-down-ok-cancel $w {alert-action} 1
2145 proc alert-action {} {
2151 proc exit-action {} {
2152 global settingsChanged
2154 if {$settingsChanged} {
2155 set a [alert "you haven't saved your settings. Do you wish to save?"]
2164 proc listbuttonaction {w name h user i} {
2165 $w configure -text [lindex $name 0]
2166 $h [lindex $name 1] $user $i
2169 proc listbuttonx {button no names handle user} {
2170 if {[winfo exists $button]} {
2171 $button configure -text [lindex [lindex $names $no] 0]
2172 ${button}.m delete 0 last
2174 menubutton $button -text [lindex [lindex $names $no] 0] \
2175 -width 10 -menu ${button}.m -relief raised -border 1
2179 foreach name $names {
2180 ${button}.m add command -label [lindex $name 0] \
2181 -command [list listbuttonaction ${button} $name \
2187 proc listbutton {button no names} {
2188 menubutton $button -text [lindex $names $no] -width 10 -menu ${button}.m \
2189 -relief raised -border 1
2191 foreach name $names {
2192 ${button}.m add command -label $name \
2193 -command [list ${button} configure -text $name]
2197 proc listbuttonv-action {button var names i} {
2200 set $var [lindex $names [expr $i+1]]
2201 $button configure -text [lindex $names $i]
2204 proc listbuttonv {button var names} {
2208 eval "set val $$var"
2209 set l [llength $names]
2210 for {set i 1} {$i < $l} {incr i 2} {
2211 if {$val == [lindex $names $i]} {
2213 set n [lindex $names $i]
2217 if {[winfo exists $button]} {
2218 $button configure -text $n
2221 menubutton $button -text $n -menu ${button}.m \
2222 -relief raised -border 1
2224 for {set i 0} {$i < $l} {incr i 2} {
2225 ${button}.m add command -label [lindex $names $i] \
2226 -command [list listbuttonv-action $button $var $names $i]
2230 proc query-add-index-action {queryNo} {
2234 global queryButtonsTmp
2236 set newI [.query-add-index.top.index.entry get]
2237 lappend queryInfoTmp [list $newI {}]
2238 $w.top.index.list insert end $newI
2239 destroy .query-add-index
2240 #destroy $w.top.lines
2241 #frame $w.top.lines -relief ridge -border 2
2242 index-lines $w.top.lines 0 $queryButtonsTmp $queryInfoTmp activate-e-index
2243 #pack $w.top.lines -side left -pady 6 -padx 6 -fill y
2246 proc query-add-line {queryNo} {
2250 global queryButtonsTmp
2252 lappend queryButtonsTmp {I 0}
2254 #destroy $w.top.lines
2255 #frame $w.top.lines -relief ridge -border 2
2256 index-lines $w.top.lines 0 $queryButtonsTmp $queryInfoTmp activate-e-index
2257 #pack $w.top.lines -side left -pady 6 -padx 6 -fill y
2260 proc query-del-line {queryNo} {
2264 global queryButtonsTmp
2266 set l [llength $queryButtonsTmp]
2271 set queryButtonsTmp [lreplace $queryButtonsTmp $l $l]
2272 index-lines $w.top.lines 0 $queryButtonsTmp $queryInfoTmp activate-e-index
2275 proc query-add-index {queryNo} {
2276 set w .query-add-index
2279 set oldFocus [focus]
2280 place-force $w .query-setup
2284 -side top -anchor e -pady 2
2285 entry-fields $w.top {index} \
2287 [list query-add-index-action $queryNo] [list destroy $w]
2288 top-down-ok-cancel $w [list query-add-index-action $queryNo] 1
2292 proc query-setup-action {queryNo} {
2295 global queryButtonsTmp
2297 global queryButtonsFind
2298 global queryInfoFind
2300 global settingsChanged
2302 set settingsChanged 1
2304 set queryInfo [lreplace $queryInfo $queryNo $queryNo \
2306 set queryButtons [lreplace $queryButtons $queryNo $queryNo \
2308 set queryInfoFind $queryInfoTmp
2309 set queryButtonsFind $queryButtonsTmp
2311 destroy .query-setup
2312 index-lines .lines 1 $queryButtonsFind $queryInfoFind activate-index
2315 proc activate-e-index {value no i} {
2316 global queryButtonsTmp
2317 global queryIndexTmp
2319 set queryButtonsTmp [lreplace $queryButtonsTmp $no $no [list I $i]]
2320 dputs $queryButtonsTmp
2321 set queryIndexTmp $i
2324 proc activate-index {value no i} {
2325 global queryButtonsFind
2327 set queryButtonsFind [lreplace $queryButtonsFind $no $no [list I $i]]
2329 dputs "queryButtonsFind $queryButtonsFind"
2332 proc update-attr {} {
2334 listbuttonv $w.top.relation.b relationTmpValue\
2335 {{None} 0 {Less than} 1 {Greater than or equal} 2 {Equal} 3 \
2336 {Greater than or equal} 4 {Greater than} 5 {Not equal} 6 \
2337 {Phonetic} 100 {Stem} 101 {Relevance} 102 {AlwaysMatches} 103}
2338 listbuttonv $w.top.position.b positionTmpValue {{None} 0 \
2339 {First in field} 1 {First in subfield} 2 {Any position in field} 3}
2340 listbuttonv $w.top.structure.b structureTmpValue {{None} 0 {Phrase} 1 \
2341 {Word} 2 {Key} 3 {Year} 4 {Date (norm)} 5 {Word list} 6 \
2342 {Date (un-norm)} 100 {Name (norm)} 101 {Date (un-norm)} 102 \
2343 {Structure} 103 {urx} 104 {free-form} 105 {doc-text} 106 \
2344 {local-number} 107 {string} 108 {numeric string} 109}
2345 listbuttonv $w.top.truncation.b truncationTmpValue {{Auto} 0 {Right} 1 \
2346 {Left} 2 {Left and right} 3 {No truncation} 100 \
2347 {Process #} 101 {Re-1} 102 {Re-2} 103}
2348 listbuttonv $w.top.completeness.b completenessTmpValue {{None} 0 \
2349 {Incomplete subfield} 1 {Complete subfield} 2 {Complete field} 3}
2352 proc use-attr {init} {
2364 {BNB card number} 10
2365 {BGF(sic) number} 11
2367 {Dewey classification} 13
2368 {UDC classification} 14
2369 {Bliss classification} 15
2371 {NLM call number} 17
2372 {NAL call number} 18
2373 {MOS call number} 19
2374 {Local classification} 20
2375 {Subject heading} 21
2377 {BDI-index-subject} 23
2381 {LC-subject-heading} 27
2382 {RVM-subject-heading} 28
2383 {Local subject index} 29
2385 {Date of publication} 31
2386 {Date of acquisition} 32
2388 {Title-collective} 34
2391 {Title-added-title-page} 37
2395 {Title-other-variant} 41
2397 {Title-abbreviated} 43
2401 {Subject-subdivision} 47
2402 {Number-natl-bibliography} 48
2403 {Number-legal-deposit} 49
2404 {Number-govt-publication} 50
2405 {Number-publisher-for-music} 51
2407 {Number-local-call} 53
2409 {Code-geographic-area} 55
2410 {Code-institution} 56
2412 {Name-geographic} 58
2413 {Place-publication} 59
2415 {Microform-generation} 61
2422 {Author-name-personal} 1004
2423 {Author-name-corporate} 1005
2424 {Author-name-conference} 1006
2425 {Identifier-standard} 1007
2426 {Subject-LC-children's} 1008
2427 {Subject-name-personal} 1009
2429 {Date/time added to database} 1011
2430 {Date/time last modified} 1012
2431 {Authority/format identifier} 1013
2433 {Concept-reference} 1015
2435 {Server choice} 1017
2437 {Record source} 1019
2440 {Geographic class} 1022
2444 {Related periodical} 1026
2445 {Report number} 1027
2447 {Thematic number} 1030
2448 {Material type} 1031
2457 set l [llength $attr]
2462 for {set i 0} {$i < $l} {incr i} {
2463 $w.top.use.list insert end [lindex $attr $i]
2465 if {$useTmpValue == [lindex $attr $i]} {
2471 $w.top.use.list selection clear 0 end
2472 $w.top.use.list selection set $s $s
2474 $w.top.use.list select from $s
2475 $w.top.use.list select to $s
2481 $w.top.use.list yview $s
2483 set lno [lindex [$w.top.use.list curselection] 0]
2484 set i [expr $lno+$lno+1]
2485 set useTmpValue [lindex $attr $i]
2486 dputs "useTmpValue=$useTmpValue"
2490 proc index-setup-action {oldAttr queryNo indexNo} {
2491 set attr [lindex $oldAttr 0]
2494 global relationTmpValue
2495 global structureTmpValue
2496 global truncationTmpValue
2497 global completenessTmpValue
2498 global positionTmpValue
2503 dputs "index-setup-action"
2504 dputs "queryNo $queryNo"
2505 dputs "indexNo $indexNo"
2506 if {$useTmpValue > 0} {
2507 lappend attr "1=$useTmpValue"
2509 if {$relationTmpValue > 0} {
2510 lappend attr "2=$relationTmpValue"
2512 if {$positionTmpValue > 0} {
2513 lappend attr "3=$positionTmpValue"
2515 if {$structureTmpValue > 0} {
2516 lappend attr "4=$structureTmpValue"
2518 if {$truncationTmpValue > 0} {
2519 lappend attr "5=$truncationTmpValue"
2521 if {$completenessTmpValue > 0} {
2522 lappend attr "6=$completenessTmpValue"
2524 dputs "new attr $attr"
2525 set queryInfoTmp [lreplace $queryInfoTmp $indexNo $indexNo $attr]
2526 destroy .index-setup
2529 proc index-setup {attr queryNo indexNo} {
2532 global relationTmpValue
2533 global structureTmpValue
2534 global truncationTmpValue
2535 global completenessTmpValue
2536 global positionTmpValue
2539 set relationTmpValue 0
2540 set truncationTmpValue 0
2541 set structureTmpValue 0
2542 set positionTmpValue 0
2543 set completenessTmpValue 0
2546 set len [llength $attr]
2547 for {set i 1} {$i < $len} {incr i} {
2548 set q [lindex $attr $i]
2549 set l [string first = $q]
2551 set t [string range $q 0 [expr $l - 1]]
2552 set v [string range $q [expr $l + 1] end]
2555 { set useTmpValue $v }
2557 { set relationTmpValue $v }
2559 { set positionTmpValue $v }
2561 { set structureTmpValue $v }
2563 { set truncationTmpValue $v }
2565 { set completenessTmpValue $v }
2569 if {[winfo exists $w]} {
2574 set n [lindex $attr 0]
2575 wm title $w "Index setup $n"
2579 frame $w.top.use -relief ridge -border 2
2580 frame $w.top.relation -relief ridge -border 2
2581 frame $w.top.position -relief ridge -border 2
2582 frame $w.top.structure -relief ridge -border 2
2583 frame $w.top.truncation -relief ridge -border 2
2584 frame $w.top.completeness -relief ridge -border 2
2590 pack $w.top.use -side left -pady 6 -padx 6 -fill y
2592 label $w.top.use.label -text "Use"
2594 listbox $w.top.use.list -width 26 \
2595 -yscrollcommand "$w.top.use.scroll set"
2597 listbox $w.top.use.list -geometry 26x10 \
2598 -yscrollcommand "$w.top.use.scroll set"
2600 scrollbar $w.top.use.scroll -orient vertical -border 1
2601 pack $w.top.use.label -side top -fill x \
2603 pack $w.top.use.list -side left -fill both -expand yes \
2605 pack $w.top.use.scroll -side right -fill y \
2607 $w.top.use.scroll config -command "$w.top.use.list yview"
2611 # Relation Attributes
2613 pack $w.top.relation -pady 6 -padx 6 -side top
2614 label $w.top.relation.label -text "Relation" -width 18
2616 pack $w.top.relation.label $w.top.relation.b -fill x
2618 # Position Attributes
2620 pack $w.top.position -pady 6 -padx 6 -side top
2621 label $w.top.position.label -text "Position" -width 18
2623 pack $w.top.position.label $w.top.position.b -fill x
2625 # Structure Attributes
2627 pack $w.top.structure -pady 6 -padx 6 -side top
2628 label $w.top.structure.label -text "Structure" -width 18
2630 pack $w.top.structure.label $w.top.structure.b -fill x
2632 # Truncation Attributes
2634 pack $w.top.truncation -pady 6 -padx 6 -side top
2635 label $w.top.truncation.label -text "Truncation" -width 18
2637 pack $w.top.truncation.label $w.top.truncation.b -fill x
2639 # Completeness Attributes
2641 pack $w.top.completeness -pady 6 -padx 6 -side top
2642 label $w.top.completeness.label -text "Completeness" -width 18
2644 pack $w.top.completeness.label $w.top.completeness.b -fill x
2647 bottom-buttons $w [list \
2648 {Ok} [list index-setup-action $attr $queryNo $indexNo] \
2649 {Cancel} [list destroy $w]] 0
2653 proc query-edit-index {queryNo} {
2657 set i [lindex [$w.top.index.list curselection] 0]
2661 set attr [lindex $queryInfoTmp $i]
2662 dputs "Editing no $i $attr"
2663 index-setup $attr $queryNo $i
2666 proc query-delete-index {queryNo} {
2668 global queryButtonsTmp
2671 set i [lindex [$w.top.index.list curselection] 0]
2675 set queryInfoTmp [lreplace $queryInfoTmp $i $i]
2676 index-lines $w.top.lines 0 $queryButtonsTmp $queryInfoTmp activate-e-index
2677 $w.top.index.list delete $i
2680 proc query-setup {queryNo} {
2686 global queryButtonsTmp
2688 global queryIndexTmp
2692 set queryName [lindex $queryTypes $queryNo]
2693 set queryInfoTmp [lindex $queryInfo $queryNo]
2694 set queryButtonsTmp [lindex $queryButtons $queryNo]
2699 wm title $w "Query setup $queryName"
2703 frame $w.top.lines -relief ridge -border 2
2705 pack $w.top.lines -side left -pady 6 -padx 6 -fill y
2709 index-lines $w.top.lines 0 $queryButtonsTmp $queryInfoTmp activate-e-index
2711 button $w.top.lines.add -text "Add" \
2712 -command [list query-add-line $queryNo]
2713 button $w.top.lines.del -text "Remove" \
2714 -command [list query-del-line $queryNo]
2716 pack $w.top.lines.del -fill x -side bottom
2717 pack $w.top.lines.add -fill x -pady 10 -side bottom
2721 frame $w.top.index -relief ridge -border 2
2722 pack $w.top.index -pady 6 -padx 6 -side right -fill y
2724 listbox $w.top.index.list -yscrollcommand [list $w.top.index.scroll set]
2725 scrollbar $w.top.index.scroll -orient vertical -border 1 \
2726 -command [list $w.top.index.list yview]
2727 bind $w.top.index.list <2> [list query-edit-index $queryNo]
2729 pack $w.top.index.list -side left -fill both -expand yes -padx 2 -pady 2
2730 pack $w.top.index.scroll -side right -fill y -padx 2 -pady 2
2733 $w.top.index.list selection clear 0 end
2734 $w.top.index.list selection set 0 0
2736 $w.top.index.list select from 0
2737 $w.top.index.list select to 0
2740 foreach x $queryInfoTmp {
2741 $w.top.index.list insert end [lindex $x 0]
2744 bottom-buttons $w [list \
2745 {Ok} [list query-setup-action $queryNo] \
2746 {Add index} [list query-add-index $queryNo] \
2747 {Edit index} [list query-edit-index $queryNo] \
2748 {Delete index} [list query-delete-index $queryNo] \
2749 {Cancel} [list destroy $w]] 0
2752 proc index-clear {} {
2753 global queryButtonsFind
2756 foreach b $queryButtonsFind {
2757 .lines.$i.e delete 0 end
2762 proc index-query {} {
2763 global queryButtonsFind
2764 global queryInfoFind
2769 foreach b $queryButtonsFind {
2770 set term [string trim [.lines.$i.e get]]
2772 set attr [lrange [lindex $queryInfoFind [lindex $b 1]] 1 end]
2774 set len [string length $term]
2778 if {[string index $term $len] == "?"} {
2780 set term [string range $term 0 [expr $len - 1]]
2782 if {[string index $term 0] == "?"} {
2784 set term [string range $term 1 end]
2786 set term "\{${term}\}"
2787 if {$right && $left} {
2788 set term "@attr 5=3 ${term}"
2790 set term "@attr 5=1 ${term}"
2792 set term "@attr 5=2 ${term}"
2795 set term "@attr $a ${term}"
2798 set qs "@and ${qs} ${term}"
2809 proc index-focus-in {w i} {
2810 global curIndexEntry
2814 $w.$i configure -background red
2816 set curIndexEntry $i
2819 proc index-lines {w realOp buttonInfo queryInfo handle} {
2822 foreach b $buttonInfo {
2823 if {! [winfo exists $w.$i]} {
2825 frame $w.$i -border 0
2827 frame $w.$i -background white -border 1
2830 listbuttonx $w.$i.l [lindex $b 1] $queryInfo $handle $i
2833 if {! [winfo exists $w.$i.e]} {
2834 entry $w.$i.e -width 32 -relief sunken -border 1
2835 bind $w.$i.e <FocusIn> [list index-focus-in $w $i]
2836 bind $w.$i.e <FocusOut> [list $w.$i configure \
2838 pack $w.$i.l -side left
2839 pack $w.$i.e -side left -fill x -expand yes
2840 pack $w.$i -side top -fill x -padx 2 -pady 2
2842 bind $w.$i.e <Left> [list left-cursor $w.$i.e]
2843 bind $w.$i.e <Right> [list right-cursor $w.$i.e]
2845 bind $w.$i.e <Return> {search-request 0}
2848 pack $w.$i.l -side left
2849 pack $w.$i -side top -fill x -padx 2 -pady 2
2854 while {[winfo exists $w.$j]} {
2866 bind $w.$j.e <Tab> "focus $w.$k.e"
2872 bind $w.$i.e <Tab> "focus $w.0.e"
2878 proc search-fields {w buttondefs} {
2880 foreach buttondef $buttondefs {
2881 frame $w.$i -background white
2883 listbutton $w.$i.l 0 $buttondef
2884 entry $w.$i.e -width 32 -relief sunken
2886 pack $w.$i.l -side left
2887 pack $w.$i.e -side left -fill x -expand yes
2889 pack $w.$i -side top -fill x -padx 2 -pady 2
2891 bind $w.$i.e <Left> [list left-cursor $w.$i.e]
2892 bind $w.$i.e <Right> [list right-cursor $w.$i.e]
2900 bind $w.$j.e <Tab> "focus $w.$k.e \n
2901 $w.$k configure -background red \n
2902 $w.$j configure -background white"
2905 bind $w.$i.e <Tab> "focus $w.0.e \n
2906 $w.0 configure -background red \n
2907 $w.$i configure -background white"
2909 $w.0 configure -background red
2912 if {[info exists windowGeometry(.)]} {
2913 set g $windowGeometry(.)
2921 frame .top -border 1 -relief raised
2922 frame .lines -border 1 -relief raised
2923 frame .mid -border 1 -relief raised
2924 frame .data -border 1 -relief raised
2925 frame .bot -border 1 -relief raised
2926 pack .top .lines .mid -side top -fill x
2927 pack .data -side top -fill both -expand yes
2930 menubutton .top.file -text "File" -menu .top.file.m
2932 .top.file.m add command -label "Save settings" -command {save-settings}
2933 .top.file.m add separator
2934 .top.file.m add command -label "Exit" -command {exit-action}
2936 menubutton .top.target -text "Target" -menu .top.target.m
2938 .top.target.m add cascade -label "Connect" -menu .top.target.m.clist
2939 .top.target.m add command -label "Disconnect" -command {close-target}
2940 .top.target.m add command -label "About" -command {about-target}
2941 .top.target.m add cascade -label "Setup" -menu .top.target.m.slist
2942 .top.target.m add command -label "Setup new" -command {define-target-dialog}
2943 .top.target.m add separator
2944 set-target-hotlist 0
2946 configure-disable-e .top.target.m 1
2947 configure-disable-e .top.target.m 2
2949 menu .top.target.m.clist
2950 menu .top.target.m.slist
2953 menubutton .top.service -text "Service" -menu .top.service.m
2955 .top.service.m add command -label "Database" -command {database-select}
2956 .top.service.m add cascade -label "Present" -menu .top.service.m.present
2957 menu .top.service.m.present
2958 .top.service.m.present add command -label "10 More" \
2959 -command [list present-more 10]
2960 .top.service.m.present add command -label "All" \
2961 -command [list present-more {}]
2962 .top.service.m add command -label "Search" -command {search-request 0}
2963 .top.service.m add command -label "Scan" -command {scan-request}
2965 .top.service configure -state disabled
2967 menubutton .top.rset -text "Set" -menu .top.rset.m
2969 .top.rset.m add command -label "Load" -command {load-set}
2970 .top.rset.m add separator
2972 menubutton .top.options -text "Options" -menu .top.options.m
2974 .top.options.m add cascade -label "Query" -menu .top.options.m.query
2975 .top.options.m add cascade -label "Format" -menu .top.options.m.formats
2976 .top.options.m add cascade -label "Wrap" -menu .top.options.m.wrap
2977 .top.options.m add cascade -label "Syntax" -menu .top.options.m.syntax
2979 menu .top.options.m.query
2980 .top.options.m.query add cascade -label "Select" \
2981 -menu .top.options.m.query.clist
2982 .top.options.m.query add cascade -label "Edit" \
2983 -menu .top.options.m.query.slist
2984 .top.options.m.query add command -label "New" \
2985 -command {query-new}
2986 .top.options.m.query add cascade -label "Delete" \
2987 -menu .top.options.m.query.dlist
2989 menu .top.options.m.query.slist
2990 menu .top.options.m.query.clist
2991 menu .top.options.m.query.dlist
2994 menu .top.options.m.formats
2996 foreach f $displayFormats {
2997 .top.options.m.formats add radiobutton -label $f -value $i \
2998 -command [list set-display-format $i] -variable displayFormat
3002 menu .top.options.m.wrap
3003 .top.options.m.wrap add radiobutton -label "Character" \
3004 -value char -variable textWrap -command {set-wrap char}
3005 .top.options.m.wrap add radiobutton -label "Word" \
3006 -value word -variable textWrap -command {set-wrap word}
3007 .top.options.m.wrap add radiobutton -label "None" \
3008 -value none -variable textWrap -command {set-wrap none}
3010 menu .top.options.m.syntax
3011 .top.options.m.syntax add radiobutton -label "None" \
3012 -value None -variable recordSyntax
3013 .top.options.m.syntax add separator
3014 .top.options.m.syntax add radiobutton -label "USMARC" \
3015 -value USMARC -variable recordSyntax
3016 .top.options.m.syntax add radiobutton -label "UNIMARC" \
3017 -value UNIMARC -variable recordSyntax
3018 .top.options.m.syntax add radiobutton -label "UKMARC" \
3019 -value UKMARC -variable recordSyntax
3020 .top.options.m.syntax add radiobutton -label "DANMARC" \
3021 -value DANMARC -variable recordSyntax
3022 .top.options.m.syntax add radiobutton -label "FINMARC" \
3023 -value FINMARC -variable recordSyntax
3024 .top.options.m.syntax add radiobutton -label "NORMARC" \
3025 -value NORMARC -variable recordSyntax
3026 .top.options.m.syntax add radiobutton -label "PICAMARC" \
3027 -value PICAMARC -variable recordSyntax
3028 .top.options.m.syntax add separator
3029 .top.options.m.syntax add radiobutton -label "SUTRS" \
3030 -value SUTRS -variable recordSyntax
3032 menubutton .top.help -text "Help" -menu .top.help.m
3035 .top.help.m add command -label "Help on help" \
3036 -command {tkerror "Help on help not available. Sorry"}
3037 .top.help.m add command -label "About" -command {about-origin}
3039 pack .top.file .top.target .top.service .top.rset .top.options -side left
3040 pack .top.help -side right
3042 index-lines .lines 1 $queryButtonsFind [lindex $queryInfo 0] activate-index
3044 button .mid.search -width 7 -text {Search} -command {search-request 0} \
3046 button .mid.scan -width 7 -text {Scan} \
3047 -command scan-request -state disabled
3048 button .mid.present -width 7 -text {Present} -command [list present-more 10] \
3051 button .mid.clear -width 7 -text {Clear} -command index-clear
3052 pack .mid.search .mid.scan .mid.present .mid.clear -side left \
3053 -fill y -padx 5 -pady 3
3055 text .data.record -height 2 -width 20 -wrap none \
3056 -yscrollcommand [list .data.scroll set] -wrap $textWrap
3057 scrollbar .data.scroll -command [list .data.record yview]
3059 .data.record configure -takefocus 0
3060 .data.scroll configure -takefocus 0
3062 pack .data.scroll -side right -fill y
3063 pack .data.record -expand yes -fill both
3067 .data.record tag configure marc-tag -foreground blue
3068 .data.record tag configure marc-id -foreground red
3070 .data.record tag configure marc-tag -foreground black
3071 .data.record tag configure marc-id -foreground black
3073 .data.record tag configure marc-data -foreground black
3075 button .bot.logo -bitmap @${libdir}/bitmaps/book1 -command cancel-operation
3077 .bot.logo configure -takefocus 0
3080 pack .bot.a -side left -fill x
3081 pack .bot.logo -side right -padx 2 -pady 2
3083 message .bot.a.target -text "" -aspect 1000 -border 1
3085 label .bot.a.status -text "Not connected" -width 15 -relief \
3086 sunken -anchor w -border 1
3087 label .bot.a.set -text "" -width 5 -relief \
3088 sunken -anchor w -border 1
3089 label .bot.a.message -text "" -width 15 -relief \
3090 sunken -anchor w -border 1
3092 pack .bot.a.target -side top -anchor nw -padx 2 -pady 2
3093 pack .bot.a.status .bot.a.set .bot.a.message \
3094 -side left -padx 2 -pady 2