1 # IR toolkit for tcl/tk
3 # See the file LICENSE for details.
4 # Sebastian Hammer, Adam Dickmeiss
7 # Revision 1.69 1995-09-21 13:42:54 adam
10 # Revision 1.68 1995/09/21 13:11:49 adam
11 # Support of dynamic loading.
12 # Test script uses load command if necessary.
14 # Revision 1.67 1995/09/20 14:35:19 adam
17 # Revision 1.66 1995/08/29 15:30:13 adam
18 # Work on GRS records.
20 # Revision 1.65 1995/08/24 15:39:09 adam
23 # Revision 1.64 1995/08/24 15:33:02 adam
26 # Revision 1.63 1995/08/04 13:20:48 adam
27 # Buttons at the bottom are slightly smaller.
29 # Revision 1.62 1995/08/04 11:32:37 adam
30 # More work on output queue. Memory related routines moved
33 # Revision 1.61 1995/07/20 08:09:39 adam
34 # client.tcl: Targets removed from hotTargets list when targets
35 # are removed/modified.
36 # ir-tcl.c: More work on triggerResourceControl.
38 # Revision 1.60 1995/06/30 16:30:19 adam
41 # Revision 1.59 1995/06/29 14:06:25 adam
42 # Another bug in install fixed. Configure searches for more versions of yaz.
44 # Revision 1.58 1995/06/29 12:34:06 adam
45 # IrTcl now works with both tk4.0b4/tcl7.4b4 and tk3.6/tcl7.3
47 # Revision 1.57 1995/06/29 09:20:30 adam
48 # Target entries in cascade menus are sorted.
50 # Revision 1.56 1995/06/27 19:03:48 adam
51 # Bug fix in do_present in ir-tcl.c: p->set_child member weren't set.
52 # nextResultSetPosition used instead of setOffset.
54 # Revision 1.55 1995/06/27 17:10:37 adam
55 # Bug fix: install procedure didn't work on some systems.
56 # Error turned up when clientrc.tcl was't present.
58 # Revision 1.54 1995/06/27 14:41:03 adam
59 # Bug fix in search-response. Didn't always observe non-surrogate diagnostics.
61 # Revision 1.53 1995/06/26 12:40:09 adam
62 # Client defines its own tkerror.
63 # User may specify 'no preferredRecordSyntax'.
65 # Revision 1.52 1995/06/22 13:14:59 adam
66 # Feature: SUTRS. Setting getSutrs implemented.
67 # Work on display formats.
68 # Preferred record syntax can be set by the user.
70 # Revision 1.51 1995/06/21 11:11:00 adam
71 # Bug fix: libdir undefined in about-origin.
73 # Revision 1.50 1995/06/21 11:04:48 adam
74 # Uses GNU autoconf 2.3.
75 # Install procedure implemented.
76 # boook bitmaps moved to sub directory bitmaps.
78 # Revision 1.49 1995/06/20 14:16:42 adam
79 # More work on cancel mechanism.
81 # Revision 1.48 1995/06/20 08:07:23 adam
82 # New setting: failInfo.
83 # Working on better cancel mechanism.
85 # Revision 1.47 1995/06/19 14:05:29 adam
86 # Bug fix: asked for SUTRS.
88 # Revision 1.46 1995/06/19 13:06:06 adam
89 # New define: IR_TCL_VERSION.
91 # Revision 1.45 1995/06/19 08:08:44 adam
92 # client.tcl: hotTargets now contain both database and target name.
93 # ir-tcl.c: setting protocol edited. Errors in callbacks are logged
94 # by logf(LOG_WARN, ...) calls.
96 # Revision 1.44 1995/06/16 14:55:18 adam
99 # Revision 1.43 1995/06/16 14:41:05 adam
100 # Scan line entries can be copied to a search entry.
102 # Revision 1.42 1995/06/16 12:28:13 adam
103 # Implemented preferredRecordSyntax.
104 # Minor changes in diagnostic handling.
105 # Record list deleted when connection closes.
107 # Revision 1.41 1995/06/14 15:07:59 adam
108 # Bug fix in cascade-target-list. Uses yaz-version.h.
110 # Revision 1.40 1995/06/14 13:37:17 adam
111 # Setting recordType implemented.
112 # Setting implementationVersion implemented.
113 # Settings implementationId / implementationName edited.
115 # Revision 1.39 1995/06/14 12:16:22 adam
116 # hotTargets, textWrap and displayFormat saved in clientg.tcl.
118 # Revision 1.38 1995/06/14 07:22:45 adam
119 # Target definitions can be deleted.
120 # Listbox used in the query definition dialog.
122 # Revision 1.37 1995/06/13 14:37:59 adam
123 # Work on query setup.
124 # Better about origin/target.
125 # Better presentation formats.
127 # Revision 1.36 1995/06/13 07:42:14 adam
128 # Bindings removed from text widgets.
130 # Revision 1.35 1995/06/12 15:17:31 adam
131 # Text widget used in main window (instead of listbox) to support
132 # better presentation formats.
134 # Revision 1.34 1995/06/12 07:59:07 adam
135 # More work on geometry handling.
137 # Revision 1.33 1995/06/09 11:17:35 adam
138 # Start work on geometry management.
140 # Revision 1.32 1995/06/07 09:16:37 adam
141 # New presentation format.
143 # Revision 1.31 1995/06/06 16:31:09 adam
144 # Bug fix: target names couldn't contain blanks.
147 # Revision 1.30 1995/06/06 11:35:41 adam
148 # Work on scan. Display of old sets.
150 # Revision 1.29 1995/06/05 14:11:18 adam
151 # Bug fix in present-more.
153 # Revision 1.28 1995/06/02 14:52:13 adam
154 # Minor changes really.
156 # Revision 1.27 1995/06/02 14:29:42 adam
157 # Work on scan interface - up/down buttons.
159 # Revision 1.26 1995/06/01 16:36:46 adam
160 # About buttons. Minor bug fixes.
162 # Revision 1.25 1995/05/31 13:09:57 adam
163 # Client searches/presents may be interrupted.
164 # New moving book-logo.
166 # Revision 1.24 1995/05/31 08:36:24 adam
167 # Bug fix in client.tcl: didn't save options on clientrc.tcl.
168 # New method: referenceId. More work on scan.
170 # Revision 1.23 1995/05/29 10:33:41 adam
171 # README and rename of startup script.
173 # Revision 1.22 1995/05/26 11:44:09 adam
174 # Bugs fixed. More work on MARC utilities and queries. Test
175 # client is up-to-date again.
177 # Revision 1.21 1995/05/11 15:34:46 adam
178 # Scan request changed a bit. This version works with RLG.
180 # Revision 1.20 1995/04/21 16:31:57 adam
181 # New radiobutton: protocol (z39v2/SR).
183 # Revision 1.19 1995/04/18 16:11:50 adam
184 # First version of graphical Scan. Some work on query-by-form.
186 # Revision 1.18 1995/04/10 10:50:22 adam
187 # Result-set name defaults to suffix of ir-set name.
188 # Started working on scan. Not finished at this point.
190 # Revision 1.17 1995/03/31 09:34:57 adam
191 # Search-button disabled when there is no connection.
193 # Revision 1.16 1995/03/31 08:56:36 adam
194 # New button "Search".
196 # Revision 1.15 1995/03/28 12:45:22 adam
197 # New ir method failback: called on disconnect/protocol error.
198 # New ir set/get method: protocol: SR / Z3950.
199 # Simple popup and disconnect when failback is invoked.
201 # Revision 1.14 1995/03/22 16:07:55 adam
204 # Revision 1.13 1995/03/21 17:27:26 adam
205 # Short-hand keys in setup.
207 # Revision 1.12 1995/03/21 13:41:03 adam
208 # Comstack cs_create not used too often. Non-blocking connect.
210 # Revision 1.11 1995/03/21 10:39:06 adam
211 # Diagnostic error message displayed with tkerror.
213 # Revision 1.10 1995/03/20 15:24:06 adam
214 # Diagnostic records saved on searchResponse.
216 # Revision 1.9 1995/03/17 18:26:16 adam
217 # Non-blocking i/o used now. Database names popup as cascade items.
219 # Revision 1.8 1995/03/17 15:45:00 adam
220 # Improved target/database setup.
222 # Revision 1.7 1995/03/16 17:54:03 adam
223 # Minor changes really.
225 # Revision 1.6 1995/03/15 19:10:20 adam
226 # Database setup in protocol-setup (rather target setup).
228 # Revision 1.5 1995/03/15 13:59:23 adam
231 # Revision 1.4 1995/03/14 17:32:29 adam
232 # Presentation of full Marc record in popup window.
234 # Revision 1.3 1995/03/12 19:31:52 adam
235 # Pattern matching implemented when retrieving MARC records. More
236 # diagnostic functions.
238 # Revision 1.2 1995/03/10 18:00:15 adam
239 # Actual presentation in line-by-line format. RPN query support.
241 # Revision 1.1 1995/03/09 16:15:07 adam
242 # First presentRequest attempts. Hot-target list.
246 if {$tk_version == "3.6"} {
257 proc configure-enable-e {w n} {
259 $w entryconfigure $n -state normal
261 proc configure-disable-e {w n} {
263 $w entryconfigure $n -state disabled
265 set noFocus [list -takefocus 0]
267 proc configure-enable-e {w n} {
270 proc configure-disable-e {w n} {
277 if {[tk colormodel .] == "color"} {
287 if {[file readable bitmaps/book2]} {
290 if {! [file readable ${libdir}/bitmaps/book2]} {
291 puts "Cannot locate system files in ${libdir}. You must either run this"
292 puts "program from the source directory root of ir-tcl or you must assure"
293 puts "that it is installed - normally in /usr/local/lib/irtcl"
301 set profile(Default) {{} {} {210} {} 16384 8192 tcpip {} 1 {} {} Z39 1}
303 set settingsChanged 0
312 set recordSyntax None
315 set queryTypes {Simple}
316 set queryButtons { { {I 0} {I 1} {I 2} } }
317 set queryInfo { { {Title {1=4 4=1}} {Author {1=1}} \
318 {Subject {1=21}} {Any {1=1016}} } }
327 if {[winfo exists $w]} {
336 label $w.top.b -bitmap error
337 message $w.top.t -aspect 300 -text "Error: $err" \
338 -font -Adobe-Helvetica-Bold-R-Normal-*-180-*
339 pack $w.top.b $w.top.t -side left -padx 10 -pady 10
341 bottom-buttons $w [list {Close} [list destroy $w]] 1
344 proc read-formats {} {
345 global displayFormats
347 if {[catch {set formats [glob -nocomplain ${libdir}/formats/*.tcl]}]} {
348 set formats ./formats/raw.tcl
351 if {[file readable $f]} {
353 set l [string length $f]
354 set f [string range $f [string length "${libdir}/formats/"] \
356 lappend displayFormats $f
365 .data.record configure -wrap $m
371 proc set-display-format {f} {
381 .bot.a.status configure -text "Reformatting"
384 add-title-lines -1 10000 1
387 proc initBindings {} {
390 bind $w <Double-1> {}
391 bind $w <Triple-1> {}
392 bind $w <B1-Motion> {}
394 bind $w <Shift-B1-Motion> {}
396 bind $w <B2-Motion> {}
397 bind $w <Any-KeyPress> {}
399 bind $w <BackSpace> {}
401 bind $w <Control-h> {}
402 bind $w <Control-d> {}
403 bind $w <Control-v> {}
406 bind $w <B1-Motion> {}
407 bind $w <Shift-B1-Motion> {}
412 proc post-menu {wbutton wmenu} {
415 $wmenu post [winfo rootx $wbutton] \
416 [expr [winfo rooty $wbutton]+[winfo height $wbutton]]
421 global windowGeometry
422 set windowGeometry($w) [wm geometry $w]
425 global windowGeometry
428 if {[info exists windowGeometry($w)]} {
429 set g $windowGeometry($w)
434 bind $w <Destroy> [list destroyGW $w]
437 if {[file readable "clientrc.tcl"]} {
438 source "clientrc.tcl"
440 if {[file readable "${libdir}/clientrc.tcl"]} {
441 source "${libdir}/clientrc.tcl"
445 if {[file readable "~/.clientrc.tcl"]} {
446 source "~/.clientrc.tcl"
449 set queryButtonsFind [lindex $queryButtons 0]
450 set queryInfoFind [lindex $queryInfo 0]
452 proc top-down-window {w} {
453 frame $w.top -relief raised -border 1
454 frame $w.bot -relief raised -border 1
456 pack $w.top -side top -fill both -expand yes
457 pack $w.bot -fill both
460 proc top-down-ok-cancel {w ok-action g} {
461 frame $w.bot.left -relief sunken -border 1
462 pack $w.bot.left -side left -expand yes -ipadx 2 -ipady 2 -padx 1 -pady 1
463 button $w.bot.left.ok -width 4 -text {Ok} \
464 -command ${ok-action}
465 pack $w.bot.left.ok -expand yes -ipadx 1 -ipady 1 -padx 2 -pady 2
466 button $w.bot.cancel -width 5 -text {Cancel} \
467 -command [list destroy $w]
468 pack $w.bot.cancel -side left -expand yes
476 proc bottom-buttons {w buttonList g} {
478 set l [llength $buttonList]
480 frame $w.bot.$i -relief sunken -border 1
481 pack $w.bot.$i -side left -expand yes -padx 2 -pady 2
482 button $w.bot.$i.ok -text [lindex $buttonList $i] \
483 -command [lindex $buttonList [expr $i+1]]
484 pack $w.bot.$i.ok -expand yes -padx 2 -pady 2 -side left
488 button $w.bot.$i -text [lindex $buttonList $i] \
489 -command [lindex $buttonList [expr $i+1]]
490 pack $w.bot.$i -expand yes -padx 2 -pady 2 -side left
500 proc cancel-operation {} {
508 show-status Cancel 0 1
512 proc show-target {target base} {
516 .bot.a.target configure -text ""
520 .bot.a.target configure -text "$target"
522 .bot.a.target configure -text "$target - $base"
526 proc show-logo {v1} {
535 .bot.logo configure -bitmap @${libdir}/bitmaps/book${v1}
536 after 140 [list show-logo $v1]
540 .bot.logo configure -bitmap @${libdir}/bitmaps/book1
549 proc show-status {status b sb} {
556 .bot.a.status configure -text "$status"
558 if {$busy == 0} {set busy 1}
566 .top.service configure -state normal
567 .mid.search configure -state normal
569 .mid.scan configure -state normal
572 configure-disable-e .top.service.m 1
573 } elseif {[z39.$setNo nextResultSetPosition] > 0 &&
574 [z39.$setNo nextResultSetPosition] <= [z39.$setNo resultCount]} {
575 configure-enable-e .top.service.m 1
576 .mid.present configure -state normal
578 configure-disable-e .top.service.m 1
579 .mid.present configure -state disabled
581 if {[winfo exists .scan-window]} {
582 .scan-window.bot.2 configure -state normal
583 .scan-window.bot.4 configure -state normal
586 .top.service configure -state disabled
587 .mid.search configure -state disabled
588 .mid.scan configure -state disabled
589 .mid.present configure -state disabled
591 if {[winfo exists .scan-window]} {
592 .scan-window.bot.2 configure -state disabled
593 .scan-window.bot.4 configure -state disabled
598 proc show-message {msg} {
599 .bot.a.message configure -text "$msg"
602 proc insertWithTags {w text args} {
603 set start [$w index insert]
604 $w insert insert $text
605 foreach tag [$w tag names $start] {
606 $w tag remove $tag $start insert
609 $w tag add $i $start insert
613 proc popup-license {} {
618 wm title $w "License"
624 text $w.top.t -width 80 -height 10 -wrap word \
625 -yscrollcommand [list $w.top.s set]
626 scrollbar $w.top.s -command [list $w.top.t yview]
628 pack $w.top.s -side right -fill y
629 pack $w.top.t -expand yes -fill both
631 if {[file readable "${libdir}/LICENSE"]} {
632 set f [open "${libdir}/LICENSE" r]
633 while {[gets $f buf] != -1} {
634 $w.top.t insert end $buf
635 $w.top.t insert end "\n"
639 bottom-buttons $w [list {Close} [list destroy $w]] 1
642 proc about-target {} {
643 set w .about-target-w
648 wm title $w "About target"
652 frame $w.top.a -relief ridge -border 2
653 frame $w.top.p -relief ridge -border 2
655 pack $w.top.a $w.top.p -side top -fill x
657 label $w.top.a.about -text "About"
658 label $w.top.a.irtcl -text $hostid \
659 -font -Adobe-Helvetica-Bold-R-Normal-*-240-*
660 pack $w.top.a.about $w.top.a.irtcl -side top
662 set i [z39 targetImplementationName]
663 label $w.top.p.in -text "Implementation name: $i"
664 set i [z39 targetImplementationId]
665 label $w.top.p.ii -text "Implementation id: $i"
666 set i [z39 targetImplementationVersion]
667 label $w.top.p.iv -text "Implementation version: $i"
669 label $w.top.p.op -text "Protocol options: $i"
671 pack $w.top.p.in $w.top.p.ii $w.top.p.iv $w.top.p.op -side top -anchor nw
673 bottom-buttons $w [list {Close} [list destroy $w]] 1
676 proc about-origin-logo {n} {
678 set w .about-origin-w
679 if {![winfo exists $w]} {
686 $w.top.a.logo configure -bitmap @${libdir}/bitmaps/book$n
687 after 140 [list about-origin-logo $n]
690 proc about-origin {} {
691 set w .about-origin-w
694 if {[winfo exists $w]} {
699 wm title $w "About IrTcl"
703 frame $w.top.a -relief ridge -border 2
704 frame $w.top.p -relief ridge -border 2
706 pack $w.top.a $w.top.p -side top -fill x
708 label $w.top.a.irtcl -text "IrTcl" \
709 -font -Adobe-Helvetica-Bold-R-Normal-*-240-*
710 label $w.top.a.logo -bitmap @${libdir}/bitmaps/book1
711 pack $w.top.a.irtcl $w.top.a.logo -side left -expand yes
714 catch {set i [z39 implementationName]}
715 label $w.top.p.in -text "Implementation name: $i"
716 catch {set i [z39 implementationId]}
717 label $w.top.p.ii -text "Implementation id: $i"
718 catch {set i [z39 implementationVersion]}
719 label $w.top.p.iv -text "Implementation version: $i"
721 pack $w.top.p.in $w.top.p.ii $w.top.p.iv -side top -anchor nw
724 bottom-buttons $w [list {Close} [list destroy $w] \
725 {License} [list popup-license]] 0
728 proc popup-marc {sno no b df} {
730 global displayFormats
733 if {[z39.$sno type $no] != "DB"} {
737 set w .full-marc-$fullMarcSeq
744 if {[winfo exists $w]} {
752 frame $w.top -relief raised -border 1
753 frame $w.bot -relief raised -border 1
755 pack $w.top -side top -fill both -expand yes
756 pack $w.bot -fill both
758 text $w.top.record -width 60 -height 5 -wrap word \
759 -yscrollcommand [list $w.top.s set]
760 scrollbar $w.top.s -command [list $w.top.record yview]
764 $w.top.record tag configure marc-tag -foreground blue
765 $w.top.record tag configure marc-id -foreground red
767 $w.top.record tag configure marc-tag -foreground black
768 $w.top.record tag configure marc-id -foreground black
770 $w.top.record tag configure marc-data -foreground black
773 $w.top.record delete 0.0 end
774 set recordType [z39.$sno recordType $no]
775 wm title $w "$recordType record #$no"
778 bind $w.top.record <Return> {destroy .full-marc}
780 pack $w.top.s -side right -fill y
781 pack $w.top.record -expand yes -fill both
784 bottom-buttons $w [list \
785 {Close} [list destroy $w]] 0
787 bottom-buttons $w [list \
788 {Close} [list destroy $w] \
789 {Duplicate} [list popup-marc $sno $no 1 0]] 0
790 menubutton $w.bot.formats -text "Format" -menu $w.bot.formats.m
791 menu $w.bot.formats.m
793 foreach f $displayFormats {
794 $w.bot.formats.m add radiobutton -label $f \
795 -variable popupMarcdf -value $i \
796 -command [list display-$f $sno $no $w.top.record 0]
799 pack $w.bot.formats -expand yes -ipadx 2 -ipady 2 \
800 -padx 3 -pady 3 -side left
804 $w.bot.formats.m delete 0 last
805 foreach f $displayFormats {
806 $w.bot.formats.m add radiobutton -label $f \
807 -variable popupMarcdf -value $i \
808 -command [list display-$f $sno $no $w.top.record 0]
812 set ffunc [lindex $displayFormats $df]
813 set ffunc "display-$ffunc"
815 $ffunc $sno $no $w.top.record 0
818 proc update-target-hotlist {target base} {
821 set olen [llength $hotTargets]
823 foreach e $hotTargets {
824 if {$target == [lindex $e 0] && $base == [lindex $e 1]} {
825 set hotTargets [lreplace $hotTargets $i $i]
830 set hotTargets [linsert $hotTargets 0 [list $target $base]]
831 set-target-hotlist $olen
834 proc delete-target-hotlist {target} {
837 set olen [llength $hotTargets]
839 foreach e $hotTargets {
840 if {$target == [lindex $e 0]} {
841 set hotTargets [lreplace $hotTargets $i $i]
845 set-target-hotlist $olen
848 proc set-target-hotlist {olen} {
853 .top.target.m delete 7 [expr 7+$olen]
855 .top.target.m delete 6 [expr 6+$olen]
859 foreach e $hotTargets {
860 set target [lindex $e 0]
861 set base [lindex $e 1]
863 .top.target.m add command -label "$i $target" -command \
864 [list reopen-target $target {}]
866 .top.target.m add command -label "$i $target - $base" -command \
867 [list reopen-target $target $base]
876 proc reopen-target {target base} {
878 open-target $target $base
879 update-target-hotlist $target $base
882 proc define-target-action {} {
885 set target [.target-define.top.target.entry get]
889 foreach n [array names profile] {
895 set seq [lindex $profile(Default) 12]
897 set profile($target) $profile(Default)
898 set profile(Default) [lreplace $profile(Default) 12 12 [incr seq]]
900 protocol-setup $target
901 destroy .target-define
904 proc fail-response {target} {
905 set c [lindex [z39 failInfo] 0]
906 set m [lindex [z39 failInfo] 1]
911 proc connect-response {target base} {
912 dputs "connect-response"
913 show-target $target $base
917 proc open-target {target base} {
922 z39 comstack [lindex $profile($target) 6]
923 z39 protocol [lindex $profile($target) 11]
924 z39 idAuthentication [lindex $profile($target) 3]
925 z39 maximumRecordSize [lindex $profile($target) 4]
926 z39 preferredMessageSize [lindex $profile($target) 5]
927 dputs "maximumRecordSize="
928 dputs [z39 maximumRecordSize]
929 dputs "preferredMessageSize="
930 dputs [z39 preferredMessageSize]
931 show-status Connecting 1 0
933 z39 databaseNames [lindex [lindex $profile($target) 7] 0]
935 z39 databaseNames $base
937 z39 failback [list fail-response $target]
938 z39 callback [list connect-response $target $base]
941 z39 connect [lindex $profile($target) 1]:[lindex $profile($target) 2]
944 tkerror $errorMessage
945 show-status "Not connected" 0 {}
949 configure-disable-e .top.target.m 0
950 configure-enable-e .top.target.m 1
951 configure-enable-e .top.target.m 2
954 proc close-target {} {
963 .bot.a.set configure -text ""
967 show-status {Not connected} 0 0
970 configure-disable-e .top.target.m 1
971 configure-disable-e .top.target.m 2
973 .top.rset.m delete 2 last
975 .top.rset.m delete 1 last
977 .top.rset.m add separator
978 configure-enable-e .top.target.m 0
981 proc load-set-action {} {
985 ir-set z39.$setNoLast z39
987 set fname [.load-set.top.filename.entry get]
990 show-status Loading 1 {}
992 z39.$setNoLast loadFile $fname
994 set no [z39.$setNoLast numberOfRecordsReturned]
995 add-title-lines $setNoLast $no 1
997 set l [format "%-4d %7d" $setNoLast $no]
998 .top.rset.m add command -label $l \
999 -command [list add-title-lines $setNoLast 10000 1]
1000 show-status Ready 0 {}
1006 set oldFocus [focus]
1010 frame $w.top.filename
1011 pack $w.top.filename -side top -anchor e -pady 2
1013 entry-fields $w.top {filename} \
1015 {load-set-action} {destroy .load-set}
1017 top-down-ok-cancel $w {load-set-action} 1
1021 proc init-request {} {
1028 z39 callback {init-response}
1029 show-status Initializing 1 {}
1030 set err [catch {z39 init} errorMessage]
1032 tkerror $errorMessage
1033 show-status Ready 0 {}
1037 proc init-response {} {
1045 if {![z39 initResult]} {
1046 show-status Ready 0 1
1047 set u [z39 userInformationField]
1049 tkerror "Connection rejected by target: $u"
1051 if {[lsearch [z39 options] scan] >= 0} {
1056 show-status Ready 0 1
1060 proc search-request {bflag} {
1072 dputs "search-request"
1074 if {!$bflag && $busy} {
1075 dputs "busy: search-request ignored"
1080 show-status Searching 1 0
1081 set delayRequest {search-request 1}
1086 set query [index-query]
1091 set setNo $setNoLast
1092 ir-set z39.$setNo z39
1094 if {[lindex $profile($target) 10] == 1} {
1095 z39.$setNo setName $setNo
1096 dputs "setName=${setNo}"
1098 z39.$setNo setName Default
1099 dputs "setName=Default"
1101 if {[lindex $profile($target) 8] == 1} {
1102 z39.$setNo queryType rpn
1104 if {[lindex $profile($target) 9] == 1} {
1105 z39.$setNo queryType ccl
1109 if {$recordSyntax == "None" } {
1110 z39.$setNo preferredRecordSyntax {}
1112 z39.$setNo preferredRecordSyntax $recordSyntax
1114 z39 callback {search-response}
1115 z39.$setNo search $query
1116 show-status Searching 1 0
1119 proc scan-copy {y entry} {
1121 set no [$w.top.list nearest $y]
1123 .lines.$entry.e delete 0 end
1124 .lines.$entry.e insert 0 [string range [$w.top.list get $no] 8 end]
1127 proc scan-request {} {
1134 global curIndexEntry
1135 global queryButtonsFind
1136 global queryInfoFind
1140 dputs "scan-request"
1143 show-status Scanning 1 0
1144 set delayRequest scan-request
1153 set b [lindex $queryButtonsFind $curIndexEntry]
1155 foreach a [lrange [lindex $queryInfoFind [lindex $b 1]] 1 end] {
1156 set attr "@attr $a $attr"
1158 set title [lindex [lindex $queryInfoFind [lindex $b 1]] 0]
1159 ir-scan z39.scan z39
1161 if {![winfo exists $w]} {
1168 entry $w.top.entry -relief sunken
1169 pack $w.top.entry -fill x -padx 4 -pady 2
1170 bind $w.top.entry <KeyRelease> [list scan-term-h $attr]
1171 listbox $w.top.list -yscrollcommand [list $w.top.scroll set] \
1173 scrollbar $w.top.scroll -orient vertical -border 1
1174 pack $w.top.list -side left -fill both -expand yes
1175 pack $w.top.scroll -side right -fill y
1176 $w.top.scroll config -command [list $w.top.list yview]
1178 bottom-buttons $w [list {Close} [list destroy $w] \
1179 {Up} [list scan-up $attr] \
1180 {Down} [list scan-down $attr]] 0
1181 bind $w.top.list <Up> [list scan-up $attr]
1182 bind $w.top.list <Down> [list scan-down $attr]
1185 bind $w.top.list <Double-Button-1> [list scan-copy %y $curIndexEntry]
1186 wm title $w "Scan $title"
1188 z39 callback [list scan-response $attr 0 35]
1189 z39.scan numberOfTermsRequested 5
1190 z39.scan preferredPositionInResponse 1
1191 z39.scan scan "${attr} 0"
1193 show-status Scanning 1 0
1196 proc scan-term-h {attr} {
1204 set nScanTerm [$w.top.entry get]
1205 if {$nScanTerm == $scanTerm} {
1208 set scanTerm $nScanTerm
1209 z39 callback [list scan-response $attr 0 35]
1210 z39.scan numberOfTermsRequested 5
1211 z39.scan preferredPositionInResponse 1
1212 dputs "${attr} \{${scanTerm}\}"
1213 if {$scanTerm == ""} {
1214 z39.scan scan "${attr} 0"
1216 z39.scan scan "${attr} \{${scanTerm}\}"
1218 show-status Scanning 1 0
1221 proc scan-response {attr start toget} {
1228 dputs "In scan-response"
1229 set m [z39.scan numberOfEntriesReturned]
1235 if {![winfo exists .scan-window]} {
1238 dputs "Handling cancel"
1239 if {$delayRequest != ""} {
1244 show-status Ready 0 1
1247 set nScanTerm [$w.top.entry get]
1248 if {$nScanTerm != $scanTerm} {
1249 z39 callback [list scan-response $attr 0 35]
1250 z39.scan numberOfTermsRequested 5
1251 z39.scan preferredPositionInResponse 1
1252 set scanTerm $nScanTerm
1253 dputs "${attr} \{${scanTerm}\}"
1254 if {$scanTerm == ""} {
1255 z39.scan scan "${attr} 0"
1257 z39.scan scan "${attr} \{${scanTerm}\}"
1259 show-status Scanning 1 0
1262 set status [z39.scan scanStatus]
1265 show-status Ready 0 1
1270 for {set i 0} {$i < $m} {incr i} {
1271 set term [lindex [z39.scan scanLine $i] 1]
1272 set nostr [format " %-6d" [lindex [z39.scan scanLine $i] 2]]
1273 $w.top.list insert $i "$nostr $term"
1276 $w.top.list yview $scanView
1278 $w.top.list delete $start end
1279 for {set i 0} {$i < $m} {incr i} {
1280 set term [lindex [z39.scan scanLine $i] 1]
1281 set nostr [format " %-6d" [lindex [z39.scan scanLine $i] 2]]
1282 $w.top.list insert end "$nostr $term"
1286 dputs "Handling cancel"
1288 if {$delayRequest != ""} {
1294 if {$toget > 0 && $m > 1 && $m < $toget} {
1295 set ntoget [expr $toget - $m + 1]
1296 dputs ntoget=$ntoget
1297 z39 callback [list scan-response $attr [expr $start + $m - 1] $ntoget]
1299 dputs "down continue: $q"
1301 z39.scan numberOfTermsRequested 10
1303 z39.scan numberOfTermsRequested $ntoget
1305 z39.scan preferredPositionInResponse 1
1306 dputs "${attr} \{$q\}"
1307 z39.scan scan "${attr} \{$q\}"
1310 if {$toget < 0 && $m > 1 && $m < [expr - $toget]} {
1311 set ntoget [expr - $toget - $m]
1312 dputs ntoget=$ntoget
1313 z39 callback [list scan-response $attr 0 -$ntoget]
1314 set q [string range [$w.top.list get 0] 8 end]
1315 dputs "up continue: $q"
1317 z39.scan numberOfTermsRequested 10
1318 z39.scan preferredPositionInResponse 11
1320 z39.scan numberOfTermsRequested $ntoget
1321 z39.scan preferredPositionInResponse [incr ntoget]
1323 dputs "${attr} \{$q\}"
1324 z39.scan scan "${attr} \{$q\}"
1327 show-status Ready 0 1
1330 proc scan-down {attr} {
1338 show-status {Scanning down} 1 0
1339 set delayRequest [list scan-down $attr]
1345 set scanView [expr $scanView + 5]
1346 set s [$w.top.list size]
1347 if {$scanView > $s} {
1348 z39 callback [list scan-response $attr [expr $s - 1] 25]
1349 set q [string range [$w.top.list get [expr $s - 1]] 8 end]
1351 z39.scan numberOfTermsRequested 10
1352 z39.scan preferredPositionInResponse 1
1353 show-status Scanning 1 0
1354 dputs "${attr} \{$q\}"
1355 z39.scan scan "${attr} \{$q\}"
1358 $w.top.list yview $scanView
1361 proc scan-up {attr} {
1369 show-status Scanning 1 0
1370 set delayRequest [list scan-up $attr]
1376 set scanView [expr $scanView - 5]
1377 if {$scanView < 0} {
1378 z39 callback [list scan-response $attr 0 -25]
1379 set q [string range [$w.top.list get 0] 8 end]
1381 z39.scan numberOfTermsRequested 10
1382 z39.scan preferredPositionInResponse 11
1383 show-status Scanning 1 0
1384 z39.scan scan "${attr} \{$q\}"
1387 $w.top.list yview $scanView
1390 proc search-response {} {
1398 dputs "In search-response"
1400 dputs "Handling cancel"
1402 if {$delayRequest != ""} {
1410 set setMax [z39.$setNo resultCount]
1411 show-status Ready 0 1
1412 set status [z39.$setNo responseStatus]
1413 if {[lindex $status 0] == "NSD"} {
1414 z39.$setNo nextResultSetPosition 0
1415 set code [lindex $status 1]
1416 set msg [lindex $status 2]
1417 set addinfo [lindex $status 3]
1418 tkerror "NSD$code: $msg: $addinfo"
1421 show-message "${setMax} hits"
1426 show-status Ready 0 1
1427 set l [format "%-4d %7d" $setNo $setMax]
1428 .top.rset.m add command -label $l \
1429 -command [list add-title-lines $setNo 10000 1]
1433 z39 callback {present-response}
1434 z39.$setNo present $setOffset 1
1435 show-status Retrieving 1 0
1438 proc present-more {number} {
1446 dputs "present-more"
1448 show-status Retrieving 1 0
1449 set delayRequest "present-more $number"
1455 dputs "setNo=$setNo"
1458 set setOffset [z39.$setNo nextResultSetPosition]
1459 dputs "setOffest=${setOffset}"
1460 dputs "setNo=${setNo}"
1461 set max [z39.$setNo resultCount]
1462 if {$max < $setOffset} {
1464 dputs "setOffset=$setOffset"
1465 show-status Ready 0 1
1468 if {$number == ""} {
1472 if {$setMax > $max} {
1476 z39 callback {present-response}
1478 set toGet [expr $setMax - $setOffset + 1]
1485 z39.$setNo present $setOffset $toGet
1486 show-status Retrieving 1 0
1489 proc init-title-lines {} {
1490 .data.record delete 0.0 end
1493 proc title-press {y setno} {
1494 show-full-marc $setno [expr 1 + [.data.list nearest $y]] 0
1497 proc add-title-lines {setno no offset} {
1498 global displayFormats
1499 global displayFormat
1509 .bot.a.set configure -text $setno
1510 .data.record delete 0.0 end
1512 set ffunc [lindex $displayFormats $displayFormat]
1513 dputs "ffunc=$ffunc"
1514 set ffunc "display-$ffunc"
1515 for {set i 0} {$i < $no} {incr i} {
1516 set o [expr $i + $offset]
1517 set type [z39.$setno type $o]
1521 .data.record tag bind r$o <Any-Enter> {}
1522 .data.record tag bind r$o <Any-Leave> {}
1523 set insert0 [.data.record index insert]
1524 $ffunc $setno $o .data.record 1
1525 .data.record tag add r$o $insert0 insert
1526 .data.record tag bind r$o <1> \
1527 [list popup-marc $setno $o 0 0]
1531 show-status Ready 0 1
1535 proc present-response {} {
1542 dputs "In present-response"
1543 set no [z39.$setNo numberOfRecordsReturned]
1544 dputs "Returned $no records, setOffset $setOffset"
1545 add-title-lines $setNo $no $setOffset
1546 set setOffset [expr $setOffset + $no]
1548 dputs "Handling cancel"
1550 if {$delayRequest != ""} {
1555 set status [z39.$setNo responseStatus]
1556 if {[lindex $status 0] == "NSD"} {
1557 show-status Ready 0 1
1558 set code [lindex $status 1]
1559 set msg [lindex $status 2]
1560 set addinfo [lindex $status 3]
1561 tkerror "NSD$code: $msg: $addinfo"
1564 if {$no > 0 && $setOffset <= $setMax} {
1565 dputs "present-request from ${setOffset}"
1566 set toGet [expr $setMax - $setOffset + 1]
1570 z39.$setNo present $setOffset $toGet
1572 show-status Ready 0 1
1576 proc left-cursor {w} {
1577 set i [$w index insert]
1585 proc right-cursor {w} {
1586 set i [$w index insert]
1592 proc bind-fields {list returnAction escapeAction} {
1593 set max [expr [llength $list]-1]
1594 for {set i 0} {$i < $max} {incr i} {
1595 bind [lindex $list $i] <Return> $returnAction
1596 bind [lindex $list $i] <Escape> $escapeAction
1598 bind [lindex $list $i] <Tab> \
1599 [list focus [lindex $list [expr $i+1]]]
1600 bind [lindex $list $i] <Left> \
1601 [list left-cursor [lindex $list $i]]
1602 bind [lindex $list $i] <Right> \
1603 [list right-cursor [lindex $list $i]]
1606 bind [lindex $list $i] <Return> $returnAction
1607 bind [lindex $list $i] <Escape> $escapeAction
1609 bind [lindex $list $i] <Tab> [list focus [lindex $list 0]]
1610 bind [lindex $list $i] <Left> [list left-cursor [lindex $list $i]]
1611 bind [lindex $list $i] <Right> [list right-cursor [lindex $list $i]]
1613 focus [lindex $list 0]
1616 proc entry-fields {parent list tlist returnAction escapeAction} {
1619 foreach field $list {
1620 set label ${parent}.${field}.label
1621 set entry ${parent}.${field}.entry
1622 label $label -text [lindex $tlist $i] -anchor e
1623 entry $entry -width 32 -relief sunken
1624 pack $label -side left
1625 pack $entry -side right
1626 lappend alist $entry
1629 bind-fields $alist $returnAction $escapeAction
1632 proc define-target-dialog {} {
1633 set w .target-define
1639 pack $w.top.target \
1640 -side top -anchor e -pady 2
1641 entry-fields $w.top {target} \
1643 {define-target-action} {destroy .target-define}
1644 top-down-ok-cancel $w {define-target-action} 1
1647 proc protocol-setup-delete {target} {
1649 global settingsChanged
1651 set a [alert "Are you sure you want to delete the target \
1652 definition $target ?"]
1654 set wno [lindex $profile($target) 12]
1657 unset profile($target)
1658 set settingsChanged 1
1660 delete-target-hotlist $target
1664 proc protocol-setup-action {target} {
1667 global protocolRadioType
1668 global settingsChanged
1671 global ResultSetCheck
1673 set wno [lindex $profile($target) 12]
1677 set settingsChanged 1
1678 set len [$w.top.databases.list size]
1679 for {set i 0} {$i < $len} {incr i} {
1680 lappend b [$w.top.databases.list get $i]
1682 set profile($target) [list [$w.top.description.entry get] \
1683 [$w.top.host.entry get] \
1684 [$w.top.port.entry get] \
1685 [$w.top.idAuthentication.entry get] \
1686 [$w.top.maximumRecordSize.entry get] \
1687 [$w.top.preferredMessageSize.entry get] \
1693 $protocolRadioType \
1697 delete-target-hotlist $target
1698 dputs $profile($target)
1702 proc place-force {window parent} {
1703 set g [wm geometry $parent]
1705 set p1 [string first + $g]
1706 set p2 [string last + $g]
1708 set x [expr 40+[string range $g [expr $p1 +1] [expr $p2 -1]]]
1709 set y [expr 60+[string range $g [expr $p2 +1] end]]
1710 wm geometry $window +${x}+${y}
1713 proc add-database-action {target} {
1716 set wno [lindex $profile($target) 12]
1719 $w.top.databases.list insert end \
1720 [.database-select.top.database.entry get]
1721 destroy .database-select
1724 proc add-database {target} {
1727 set w .database-select
1729 set oldFocus [focus]
1731 set wno [lindex $profile($target) 12]
1732 place-force $w .setup-${wno}
1736 frame $w.top.database
1738 pack $w.top.database -side top -anchor e -pady 2
1740 entry-fields $w.top {database} \
1741 {{Database to add:}} \
1742 [list add-database-action $target] {destroy .database-select}
1744 top-down-ok-cancel $w [list add-database-action $target] 1
1748 proc delete-database {target} {
1751 set wno [lindex $profile($target) 12]
1754 foreach i [$w.top.databases.list curselection] {
1755 set b [$w.top.databases.list get $i]
1758 set a [alert "Are you sure you want to remove the database(s)${l}?"]
1760 foreach i [lsort -decreasing \
1761 [$w.top.databases.list curselection]] {
1762 $w.top.databases.list delete $i
1767 proc protocol-setup {target} {
1770 global protocolRadioType
1773 global ResultSetCheck
1775 set wno [lindex $profile($target) 12]
1780 wm title $w "Setup $target"
1784 if {$target == ""} {
1788 dputs $profile($target)
1790 frame $w.top.description
1793 frame $w.top.idAuthentication
1794 frame $w.top.maximumRecordSize
1795 frame $w.top.preferredMessageSize
1796 frame $w.top.cs-type -relief ridge -border 2
1797 frame $w.top.protocol -relief ridge -border 2
1798 frame $w.top.query -relief ridge -border 2
1799 frame $w.top.databases -relief ridge -border 2
1801 # Maximum/preferred/idAuth ...
1802 pack $w.top.description $w.top.host $w.top.port \
1803 $w.top.idAuthentication $w.top.maximumRecordSize \
1804 $w.top.preferredMessageSize -side top -anchor e -pady 2
1806 entry-fields $w.top {description host port idAuthentication \
1807 maximumRecordSize preferredMessageSize} \
1808 {{Description:} {Host:} {Port:} {Id Authentication:} \
1809 {Maximum Record Size:} {Preferred Message Size:}} \
1810 [list protocol-setup-action $target] [list destroy $w]
1812 foreach sub {description host port idAuthentication \
1813 maximumRecordSize preferredMessageSize} {
1815 bind $w.top.$sub.entry <Control-a> [list add-database $target]
1816 bind $w.top.$sub.entry <Control-d> [list delete-database $target]
1818 $w.top.description.entry insert 0 [lindex $profile($target) 0]
1819 $w.top.host.entry insert 0 [lindex $profile($target) 1]
1820 $w.top.port.entry insert 0 [lindex $profile($target) 2]
1821 $w.top.idAuthentication.entry insert 0 [lindex $profile($target) 3]
1822 $w.top.maximumRecordSize.entry insert 0 [lindex $profile($target) 4]
1823 $w.top.preferredMessageSize.entry insert 0 [lindex $profile($target) 5]
1824 set csRadioType [lindex $profile($target) 6]
1825 set RPNCheck [lindex $profile($target) 8]
1826 set CCLCheck [lindex $profile($target) 9]
1827 set ResultSetCheck [lindex $profile($target) 10]
1828 set protocolRadioType [lindex $profile($target) 11]
1829 if {$protocolRadioType == ""} {
1830 set protocolRadioType Z39
1834 pack $w.top.databases -side left -pady 2 -padx 2 -expand yes -fill both
1836 label $w.top.databases.label -text "Databases"
1837 button $w.top.databases.add -text "Add" \
1838 -command [list add-database $target]
1839 button $w.top.databases.delete -text "Delete" \
1840 -command [list delete-database $target]
1842 listbox $w.top.databases.list -geometry 14x6 \
1843 -yscrollcommand "$w.top.databases.scroll set"
1845 listbox $w.top.databases.list -width 14 -height 5\
1846 -yscrollcommand "$w.top.databases.scroll set"
1848 scrollbar $w.top.databases.scroll -orient vertical -border 1
1849 pack $w.top.databases.label -side top -fill x \
1851 pack $w.top.databases.add $w.top.databases.delete -side top -fill x \
1853 pack $w.top.databases.list -side left -fill both -expand yes \
1855 pack $w.top.databases.scroll -side right -fill y \
1857 $w.top.databases.scroll config -command "$w.top.databases.list yview"
1859 foreach b [lindex $profile($target) 7] {
1860 $w.top.databases.list insert end $b
1864 pack $w.top.cs-type -pady 2 -padx 2 -side top -fill x
1866 label $w.top.cs-type.label -text "Transport"
1867 radiobutton $w.top.cs-type.tcpip -text "TCP/IP" -anchor w \
1868 -variable csRadioType -value tcpip
1869 radiobutton $w.top.cs-type.mosi -text "MOSI" -anchor w\
1870 -variable csRadioType -value mosi
1872 pack $w.top.cs-type.label $w.top.cs-type.tcpip $w.top.cs-type.mosi \
1873 -padx 2 -side top -fill x
1876 pack $w.top.protocol -pady 2 -padx 2 -side top -fill x
1878 label $w.top.protocol.label -text "Protocol"
1879 radiobutton $w.top.protocol.z39v2 -text "Z39.50" -anchor w \
1880 -variable protocolRadioType -value Z39
1881 radiobutton $w.top.protocol.sr -text "SR" -anchor w \
1882 -variable protocolRadioType -value SR
1884 pack $w.top.protocol.label $w.top.protocol.z39v2 $w.top.protocol.sr \
1885 -padx 2 -side top -fill x
1888 pack $w.top.query -pady 2 -padx 2 -side top -fill x
1890 label $w.top.query.label -text "Query support"
1891 checkbutton $w.top.query.c1 -text "RPN query" -anchor w -variable RPNCheck
1892 checkbutton $w.top.query.c2 -text "CCL query" -anchor w -variable CCLCheck
1893 checkbutton $w.top.query.c3 -text "Result sets" -anchor w -variable ResultSetCheck
1895 pack $w.top.query.label -side top
1896 pack $w.top.query.c1 $w.top.query.c2 $w.top.query.c3 \
1897 -padx 2 -side top -fill x
1900 bottom-buttons $w [list {Ok} [list protocol-setup-action $target] \
1901 {Delete} [list protocol-setup-delete $target] \
1902 {Cancel} [list destroy $w]] 0
1905 proc database-select-action {} {
1906 set w .database-select.top
1908 foreach indx [$w.databases.list curselection] {
1909 lappend b [$w.databases.list get $indx]
1912 z39 databaseNames $b
1914 destroy .database-select
1917 proc database-select {} {
1918 set w .database-select
1923 set oldFocus [focus]
1928 frame $w.top.databases -relief ridge -border 2
1930 pack $w.top.databases -side left -pady 6 -padx 6 -expand yes -fill x
1932 label $w.top.databases.label -text "List"
1933 listbox $w.top.databases.list -width 20 -height 6 \
1934 -yscrollcommand "$w.top.databases.scroll set"
1935 scrollbar $w.top.databases.scroll -orient vertical -border 1
1936 pack $w.top.databases.label -side top -fill x \
1938 pack $w.top.databases.list -side left -fill both -expand yes \
1940 pack $w.top.databases.scroll -side right -fill y \
1942 $w.top.databases.scroll config -command "$w.top.databases.list yview"
1944 foreach b [lindex $profile($hostid) 7] {
1945 $w.top.databases.list insert end $b
1947 top-down-ok-cancel $w {database-select-action} 1
1951 proc cascade-target-list {} {
1954 foreach sub [winfo children .top.target.m.clist] {
1957 .top.target.m.clist delete 0 last
1958 foreach n [lsort [array names profile]] {
1959 if {$n != "Default"} {
1960 set nl [lindex $profile($n) 12]
1961 if {[llength [lindex $profile($n) 7]] > 1} {
1962 .top.target.m.clist add cascade -label $n \
1963 -menu .top.target.m.clist.$nl
1964 menu .top.target.m.clist.$nl
1965 foreach b [lindex $profile($n) 7] {
1966 .top.target.m.clist.$nl add command -label $b \
1967 -command [list reopen-target $n $b]
1970 .top.target.m.clist add command -label $n \
1971 -command [list reopen-target $n {}]
1975 .top.target.m.slist delete 0 last
1976 foreach n [lsort [array names profile]] {
1977 if {$n != "Default"} {
1978 .top.target.m.slist add command -label $n \
1979 -command [list protocol-setup $n]
1984 proc query-select {i} {
1985 global queryButtonsFind
1986 global queryInfoFind
1990 set queryInfoFind [lindex $queryInfo $i]
1991 set queryButtonsFind [lindex $queryButtons $i]
1993 index-lines .lines 1 $queryButtonsFind $queryInfoFind activate-index
1996 proc query-new-action {} {
2000 global settingsChanged
2002 set settingsChanged 1
2003 lappend queryTypes [.query-new.top.index.entry get]
2004 lappend queryButtons {}
2005 lappend queryInfo {}
2015 set oldFocus [focus]
2020 -side top -anchor e -pady 2
2021 entry-fields $w.top index \
2023 query-new-action {destroy .query-new}
2024 top-down-ok-cancel $w query-new-action 1
2028 proc query-delete-action {queryNo} {
2032 global settingsChanged
2034 set settingsChanged 1
2036 set queryTypes [lreplace $queryTypes $queryNo $queryNo]
2037 set queryButtons [lreplace $queryButtons $queryNo $queryNo]
2038 set queryInfo [lreplace $queryInfo $queryNo $queryNo]
2039 destroy .query-delete
2043 proc query-delete {queryNo} {
2051 set n [lindex $queryTypes $queryNo]
2053 label $w.top.warning -bitmap warning
2054 message $w.top.quest -text "Are you sure you want to delete the \
2055 query type $n ?" -aspect 300
2056 pack $w.top.warning $w.top.quest -side left -expand yes -padx 10 -pady 5
2057 bottom-buttons $w [list {Ok} [list query-delete-action $queryNo] \
2058 {Cancel} [list destroy $w]] 1
2061 proc cascade-query-list {} {
2063 set w .top.options.m.query
2066 $w.slist delete 0 last
2067 foreach n $queryTypes {
2068 $w.slist add command -label $n -command [list query-setup $i]
2073 $w.clist delete 0 last
2074 foreach n $queryTypes {
2075 $w.clist add command -label $n -command [list query-select $i]
2079 $w.dlist delete 0 last
2080 foreach n $queryTypes {
2081 $w.dlist add command -label $n -command [list query-delete $i]
2086 proc save-geometry {} {
2087 global windowGeometry
2090 global displayFormat
2094 set windowGeometry(.) [wm geometry .]
2096 if {[catch {set f [open ~/.clientrc.tcl w]}]} {
2099 puts $f "set hotTargets \{ $hotTargets \}"
2100 puts $f "set textWrap $textWrap"
2101 puts $f "set displayFormat $displayFormat"
2102 puts $f "set popupMarcdf $popupMarcdf"
2103 puts $f "set recordSyntax $recordSyntax"
2104 foreach n [array names windowGeometry] {
2105 puts -nonewline $f "set \{windowGeometry($n)\} \{"
2106 puts -nonewline $f $windowGeometry($n)
2112 proc save-settings {} {
2115 global settingsChanged
2120 if {![file writable "${libdir}/clientrc.tcl"]} {
2121 set a [alert "Cannot open ${libdir}/clientrc.tcl for writing. Do you \
2122 wish to save clientrc.tcl in the current directory instead?"]
2126 set f [open "clientrc.tcl" w]
2128 set f [open "${libdir}/clientrc.tcl" w]
2130 puts $f "# Setup file"
2132 foreach n [array names profile] {
2133 puts -nonewline $f "set \{profile($n)\} \{"
2134 puts -nonewline $f $profile($n)
2137 puts -nonewline $f "set queryTypes \{"
2138 puts -nonewline $f $queryTypes
2141 puts -nonewline $f "set queryButtons \{"
2142 puts -nonewline $f $queryButtons
2145 puts -nonewline $f "set queryInfo \{"
2146 puts -nonewline $f $queryInfo
2149 set settingsChanged 0
2158 set oldFocus [focus]
2162 label $w.top.warning -bitmap warning
2163 message $w.top.message -text $ask -aspect 300 \
2164 -font -Adobe-Times-Medium-R-Normal-*-180-*
2166 pack $w.top.warning $w.top.message -side left -pady 5 -padx 10 -expand yes
2169 top-down-ok-cancel $w {alert-action} 1
2174 proc alert-action {} {
2180 proc exit-action {} {
2181 global settingsChanged
2183 if {$settingsChanged} {
2184 set a [alert "you haven't saved your settings. Do you wish to save?"]
2193 proc listbuttonaction {w name h user i} {
2194 $w configure -text [lindex $name 0]
2195 $h [lindex $name 1] $user $i
2198 proc listbuttonx {button no names handle user} {
2199 if {[winfo exists $button]} {
2200 $button configure -text [lindex [lindex $names $no] 0]
2201 ${button}.m delete 0 last
2203 menubutton $button -text [lindex [lindex $names $no] 0] \
2204 -width 10 -menu ${button}.m -relief raised -border 1
2208 foreach name $names {
2209 ${button}.m add command -label [lindex $name 0] \
2210 -command [list listbuttonaction ${button} $name \
2216 proc listbutton {button no names} {
2217 menubutton $button -text [lindex $names $no] -width 10 -menu ${button}.m \
2218 -relief raised -border 1
2220 foreach name $names {
2221 ${button}.m add command -label $name \
2222 -command [list ${button} configure -text $name]
2226 proc listbuttonv-action {button var names i} {
2229 set $var [lindex $names [expr $i+1]]
2230 $button configure -text [lindex $names $i]
2233 proc listbuttonv {button var names} {
2237 eval "set val $$var"
2238 set l [llength $names]
2239 for {set i 1} {$i < $l} {incr i 2} {
2240 if {$val == [lindex $names $i]} {
2242 set n [lindex $names $i]
2246 if {[winfo exists $button]} {
2247 $button configure -text $n
2250 menubutton $button -text $n -menu ${button}.m \
2251 -relief raised -border 1
2253 for {set i 0} {$i < $l} {incr i 2} {
2254 ${button}.m add command -label [lindex $names $i] \
2255 -command [list listbuttonv-action $button $var $names $i]
2259 proc query-add-index-action {queryNo} {
2263 global queryButtonsTmp
2265 set newI [.query-add-index.top.index.entry get]
2266 lappend queryInfoTmp [list $newI {}]
2267 $w.top.index.list insert end $newI
2268 destroy .query-add-index
2269 #destroy $w.top.lines
2270 #frame $w.top.lines -relief ridge -border 2
2271 index-lines $w.top.lines 0 $queryButtonsTmp $queryInfoTmp activate-e-index
2272 #pack $w.top.lines -side left -pady 6 -padx 6 -fill y
2275 proc query-add-line {queryNo} {
2279 global queryButtonsTmp
2281 lappend queryButtonsTmp {I 0}
2283 #destroy $w.top.lines
2284 #frame $w.top.lines -relief ridge -border 2
2285 index-lines $w.top.lines 0 $queryButtonsTmp $queryInfoTmp activate-e-index
2286 #pack $w.top.lines -side left -pady 6 -padx 6 -fill y
2289 proc query-del-line {queryNo} {
2293 global queryButtonsTmp
2295 set l [llength $queryButtonsTmp]
2300 set queryButtonsTmp [lreplace $queryButtonsTmp $l $l]
2301 index-lines $w.top.lines 0 $queryButtonsTmp $queryInfoTmp activate-e-index
2304 proc query-add-index {queryNo} {
2305 set w .query-add-index
2308 set oldFocus [focus]
2309 place-force $w .query-setup
2313 -side top -anchor e -pady 2
2314 entry-fields $w.top {index} \
2316 [list query-add-index-action $queryNo] [list destroy $w]
2317 top-down-ok-cancel $w [list query-add-index-action $queryNo] 1
2321 proc query-setup-action {queryNo} {
2324 global queryButtonsTmp
2326 global queryButtonsFind
2327 global queryInfoFind
2329 global settingsChanged
2331 set settingsChanged 1
2333 set queryInfo [lreplace $queryInfo $queryNo $queryNo \
2335 set queryButtons [lreplace $queryButtons $queryNo $queryNo \
2337 set queryInfoFind $queryInfoTmp
2338 set queryButtonsFind $queryButtonsTmp
2340 destroy .query-setup
2341 index-lines .lines 1 $queryButtonsFind $queryInfoFind activate-index
2344 proc activate-e-index {value no i} {
2345 global queryButtonsTmp
2346 global queryIndexTmp
2348 set queryButtonsTmp [lreplace $queryButtonsTmp $no $no [list I $i]]
2349 dputs $queryButtonsTmp
2350 set queryIndexTmp $i
2353 proc activate-index {value no i} {
2354 global queryButtonsFind
2356 set queryButtonsFind [lreplace $queryButtonsFind $no $no [list I $i]]
2358 dputs "queryButtonsFind $queryButtonsFind"
2361 proc update-attr {} {
2363 listbuttonv $w.top.relation.b relationTmpValue\
2364 {{None} 0 {Less than} 1 {Greater than or equal} 2 {Equal} 3 \
2365 {Greater than or equal} 4 {Greater than} 5 {Not equal} 6 \
2366 {Phonetic} 100 {Stem} 101 {Relevance} 102 {AlwaysMatches} 103}
2367 listbuttonv $w.top.position.b positionTmpValue {{None} 0 \
2368 {First in field} 1 {First in subfield} 2 {Any position in field} 3}
2369 listbuttonv $w.top.structure.b structureTmpValue {{None} 0 {Phrase} 1 \
2370 {Word} 2 {Key} 3 {Year} 4 {Date (norm)} 5 {Word list} 6 \
2371 {Date (un-norm)} 100 {Name (norm)} 101 {Date (un-norm)} 102 \
2372 {Structure} 103 {urx} 104 {free-form} 105 {doc-text} 106 \
2373 {local-number} 107 {string} 108 {numeric string} 109}
2374 listbuttonv $w.top.truncation.b truncationTmpValue {{Auto} 0 {Right} 1 \
2375 {Left} 2 {Left and right} 3 {No truncation} 100 \
2376 {Process #} 101 {Re-1} 102 {Re-2} 103}
2377 listbuttonv $w.top.completeness.b completenessTmpValue {{None} 0 \
2378 {Incomplete subfield} 1 {Complete subfield} 2 {Complete field} 3}
2381 proc use-attr {init} {
2393 {BNB card number} 10
2394 {BGF(sic) number} 11
2396 {Dewey classification} 13
2397 {UDC classification} 14
2398 {Bliss classification} 15
2400 {NLM call number} 17
2401 {NAL call number} 18
2402 {MOS call number} 19
2403 {Local classification} 20
2404 {Subject heading} 21
2406 {BDI-index-subject} 23
2410 {LC-subject-heading} 27
2411 {RVM-subject-heading} 28
2412 {Local subject index} 29
2414 {Date of publication} 31
2415 {Date of acquisition} 32
2417 {Title-collective} 34
2420 {Title-added-title-page} 37
2424 {Title-other-variant} 41
2426 {Title-abbreviated} 43
2430 {Subject-subdivision} 47
2431 {Number-natl-bibliography} 48
2432 {Number-legal-deposit} 49
2433 {Number-govt-publication} 50
2434 {Number-publisher-for-music} 51
2436 {Number-local-call} 53
2438 {Code-geographic-area} 55
2439 {Code-institution} 56
2441 {Name-geographic} 58
2442 {Place-publication} 59
2444 {Microform-generation} 61
2451 {Author-name-personal} 1004
2452 {Author-name-corporate} 1005
2453 {Author-name-conference} 1006
2454 {Identifier-standard} 1007
2455 {Subject-LC-children's} 1008
2456 {Subject-name-personal} 1009
2458 {Date/time added to database} 1011
2459 {Date/time last modified} 1012
2460 {Authority/format identifier} 1013
2462 {Concept-reference} 1015
2464 {Server choice} 1017
2466 {Record source} 1019
2469 {Geographic class} 1022
2473 {Related periodical} 1026
2474 {Report number} 1027
2476 {Thematic number} 1030
2477 {Material type} 1031
2485 set l [llength $attr]
2490 for {set i 0} {$i < $l} {incr i} {
2491 $w.top.use.list insert end [lindex $attr $i]
2493 if {$useTmpValue == [lindex $attr $i]} {
2499 $w.top.use.list selection clear 0 end
2500 $w.top.use.list selection set $s $s
2502 $w.top.use.list select from $s
2503 $w.top.use.list select to $s
2509 $w.top.use.list yview $s
2511 set lno [lindex [$w.top.use.list curselection] 0]
2512 set i [expr $lno+$lno+1]
2513 set useTmpValue [lindex $attr $i]
2514 dputs "useTmpValue=$useTmpValue"
2518 proc index-setup-action {oldAttr queryNo indexNo} {
2519 set attr [lindex $oldAttr 0]
2522 global relationTmpValue
2523 global structureTmpValue
2524 global truncationTmpValue
2525 global completenessTmpValue
2526 global positionTmpValue
2531 dputs "index-setup-action"
2532 dputs "queryNo $queryNo"
2533 dputs "indexNo $indexNo"
2534 if {$useTmpValue > 0} {
2535 lappend attr "1=$useTmpValue"
2537 if {$relationTmpValue > 0} {
2538 lappend attr "2=$relationTmpValue"
2540 if {$positionTmpValue > 0} {
2541 lappend attr "3=$positionTmpValue"
2543 if {$structureTmpValue > 0} {
2544 lappend attr "4=$structureTmpValue"
2546 if {$truncationTmpValue > 0} {
2547 lappend attr "5=$truncationTmpValue"
2549 if {$completenessTmpValue > 0} {
2550 lappend attr "6=$completenessTmpValue"
2552 dputs "new attr $attr"
2553 set queryInfoTmp [lreplace $queryInfoTmp $indexNo $indexNo $attr]
2554 destroy .index-setup
2557 proc index-setup {attr queryNo indexNo} {
2560 global relationTmpValue
2561 global structureTmpValue
2562 global truncationTmpValue
2563 global completenessTmpValue
2564 global positionTmpValue
2566 set relationTmpValue 0
2567 set truncationTmpValue 0
2568 set structureTmpValue 0
2569 set positionTmpValue 0
2570 set completenessTmpValue 0
2573 set len [llength $attr]
2574 for {set i 1} {$i < $len} {incr i} {
2575 set q [lindex $attr $i]
2576 set l [string first = $q]
2578 set t [string range $q 0 [expr $l - 1]]
2579 set v [string range $q [expr $l + 1] end]
2582 { set useTmpValue $v }
2584 { set relationTmpValue $v }
2586 { set positionTmpValue $v }
2588 { set structureTmpValue $v }
2590 { set truncationTmpValue $v }
2592 { set completenessTmpValue $v }
2596 if {[winfo exists $w]} {
2601 set n [lindex $attr 0]
2602 wm title $w "Index setup $n"
2606 frame $w.top.use -relief ridge -border 2
2607 frame $w.top.relation -relief ridge -border 2
2608 frame $w.top.position -relief ridge -border 2
2609 frame $w.top.structure -relief ridge -border 2
2610 frame $w.top.truncation -relief ridge -border 2
2611 frame $w.top.completeness -relief ridge -border 2
2617 pack $w.top.use -side left -pady 6 -padx 6 -fill y
2619 label $w.top.use.label -text "Use"
2621 listbox $w.top.use.list -width 26 \
2622 -yscrollcommand "$w.top.use.scroll set"
2624 listbox $w.top.use.list -geometry 26x10 \
2625 -yscrollcommand "$w.top.use.scroll set"
2627 scrollbar $w.top.use.scroll -orient vertical -border 1
2628 pack $w.top.use.label -side top -fill x \
2630 pack $w.top.use.list -side left -fill both -expand yes \
2632 pack $w.top.use.scroll -side right -fill y \
2634 $w.top.use.scroll config -command "$w.top.use.list yview"
2638 # Relation Attributes
2640 pack $w.top.relation -pady 6 -padx 6 -side top
2641 label $w.top.relation.label -text "Relation" -width 18
2643 pack $w.top.relation.label $w.top.relation.b -fill x
2645 # Position Attributes
2647 pack $w.top.position -pady 6 -padx 6 -side top
2648 label $w.top.position.label -text "Position" -width 18
2650 pack $w.top.position.label $w.top.position.b -fill x
2652 # Structure Attributes
2654 pack $w.top.structure -pady 6 -padx 6 -side top
2655 label $w.top.structure.label -text "Structure" -width 18
2657 pack $w.top.structure.label $w.top.structure.b -fill x
2659 # Truncation Attributes
2661 pack $w.top.truncation -pady 6 -padx 6 -side top
2662 label $w.top.truncation.label -text "Truncation" -width 18
2664 pack $w.top.truncation.label $w.top.truncation.b -fill x
2666 # Completeness Attributes
2668 pack $w.top.completeness -pady 6 -padx 6 -side top
2669 label $w.top.completeness.label -text "Completeness" -width 18
2671 pack $w.top.completeness.label $w.top.completeness.b -fill x
2674 bottom-buttons $w [list \
2675 {Ok} [list index-setup-action $attr $queryNo $indexNo] \
2676 {Cancel} [list destroy $w]] 0
2680 proc query-edit-index {queryNo} {
2684 set i [lindex [$w.top.index.list curselection] 0]
2688 set attr [lindex $queryInfoTmp $i]
2689 dputs "Editing no $i $attr"
2690 index-setup $attr $queryNo $i
2693 proc query-delete-index {queryNo} {
2695 global queryButtonsTmp
2698 set i [lindex [$w.top.index.list curselection] 0]
2702 set queryInfoTmp [lreplace $queryInfoTmp $i $i]
2703 index-lines $w.top.lines 0 $queryButtonsTmp $queryInfoTmp activate-e-index
2704 $w.top.index.list delete $i
2707 proc query-setup {queryNo} {
2713 global queryButtonsTmp
2715 global queryIndexTmp
2718 set queryName [lindex $queryTypes $queryNo]
2719 set queryInfoTmp [lindex $queryInfo $queryNo]
2720 set queryButtonsTmp [lindex $queryButtons $queryNo]
2725 wm title $w "Query setup $queryName"
2729 frame $w.top.lines -relief ridge -border 2
2731 pack $w.top.lines -side left -pady 6 -padx 6 -fill y
2735 index-lines $w.top.lines 0 $queryButtonsTmp $queryInfoTmp activate-e-index
2737 button $w.top.lines.add -text "Add" \
2738 -command [list query-add-line $queryNo]
2739 button $w.top.lines.del -text "Remove" \
2740 -command [list query-del-line $queryNo]
2742 pack $w.top.lines.del -fill x -side bottom
2743 pack $w.top.lines.add -fill x -pady 10 -side bottom
2747 frame $w.top.index -relief ridge -border 2
2748 pack $w.top.index -pady 6 -padx 6 -side right -fill y
2750 listbox $w.top.index.list -yscrollcommand [list $w.top.index.scroll set]
2751 scrollbar $w.top.index.scroll -orient vertical -border 1 \
2752 -command [list $w.top.index.list yview]
2753 bind $w.top.index.list <2> [list query-edit-index $queryNo]
2755 pack $w.top.index.list -side left -fill both -expand yes -padx 2 -pady 2
2756 pack $w.top.index.scroll -side right -fill y -padx 2 -pady 2
2759 $w.top.index.list selection clear 0 end
2760 $w.top.index.list selection set 0 0
2762 $w.top.index.list select from 0
2763 $w.top.index.list select to 0
2766 foreach x $queryInfoTmp {
2767 $w.top.index.list insert end [lindex $x 0]
2770 bottom-buttons $w [list \
2771 {Ok} [list query-setup-action $queryNo] \
2772 {Add index} [list query-add-index $queryNo] \
2773 {Edit index} [list query-edit-index $queryNo] \
2774 {Delete index} [list query-delete-index $queryNo] \
2775 {Cancel} [list destroy $w]] 0
2778 proc index-clear {} {
2779 global queryButtonsFind
2782 foreach b $queryButtonsFind {
2783 .lines.$i.e delete 0 end
2788 proc index-query {} {
2789 global queryButtonsFind
2790 global queryInfoFind
2795 foreach b $queryButtonsFind {
2796 set term [string trim [.lines.$i.e get]]
2798 set attr [lrange [lindex $queryInfoFind [lindex $b 1]] 1 end]
2800 set len [string length $term]
2804 if {[string index $term $len] == "?"} {
2806 set term [string range $term 0 [expr $len - 1]]
2808 if {[string index $term 0] == "?"} {
2810 set term [string range $term 1 end]
2812 set term "\{${term}\}"
2813 if {$right && $left} {
2814 set term "@attr 5=3 ${term}"
2816 set term "@attr 5=1 ${term}"
2818 set term "@attr 5=2 ${term}"
2821 set term "@attr $a ${term}"
2824 set qs "@and ${qs} ${term}"
2835 proc index-focus-in {w i} {
2836 global curIndexEntry
2839 $w.$i configure -background red
2841 set curIndexEntry $i
2844 proc index-lines {w realOp buttonInfo queryInfo handle} {
2846 foreach b $buttonInfo {
2847 if {! [winfo exists $w.$i]} {
2849 frame $w.$i -border 0
2851 frame $w.$i -background white -border 1
2854 listbuttonx $w.$i.l [lindex $b 1] $queryInfo $handle $i
2857 if {! [winfo exists $w.$i.e]} {
2858 entry $w.$i.e -width 32 -relief sunken -border 1
2859 bind $w.$i.e <FocusIn> [list index-focus-in $w $i]
2860 bind $w.$i.e <FocusOut> [list $w.$i configure \
2862 pack $w.$i.l -side left
2863 pack $w.$i.e -side left -fill x -expand yes
2864 pack $w.$i -side top -fill x -padx 2 -pady 2
2866 bind $w.$i.e <Left> [list left-cursor $w.$i.e]
2867 bind $w.$i.e <Right> [list right-cursor $w.$i.e]
2869 bind $w.$i.e <Return> {search-request 0}
2872 pack $w.$i.l -side left
2873 pack $w.$i -side top -fill x -padx 2 -pady 2
2878 while {[winfo exists $w.$j]} {
2890 bind $w.$j.e <Tab> "focus $w.$k.e"
2896 bind $w.$i.e <Tab> "focus $w.0.e"
2902 proc search-fields {w buttondefs} {
2904 foreach buttondef $buttondefs {
2905 frame $w.$i -background white
2907 listbutton $w.$i.l 0 $buttondef
2908 entry $w.$i.e -width 32 -relief sunken
2910 pack $w.$i.l -side left
2911 pack $w.$i.e -side left -fill x -expand yes
2913 pack $w.$i -side top -fill x -padx 2 -pady 2
2915 bind $w.$i.e <Left> [list left-cursor $w.$i.e]
2916 bind $w.$i.e <Right> [list right-cursor $w.$i.e]
2924 bind $w.$j.e <Tab> "focus $w.$k.e \n
2925 $w.$k configure -background red \n
2926 $w.$j configure -background white"
2929 bind $w.$i.e <Tab> "focus $w.0.e \n
2930 $w.0 configure -background red \n
2931 $w.$i configure -background white"
2933 $w.0 configure -background red
2936 if {[info exists windowGeometry(.)]} {
2937 set g $windowGeometry(.)
2945 frame .top -border 1 -relief raised
2946 frame .lines -border 1 -relief raised
2947 frame .mid -border 1 -relief raised
2948 frame .data -border 1 -relief raised
2949 frame .bot -border 1 -relief raised
2950 pack .top .lines .mid -side top -fill x
2951 pack .data -side top -fill both -expand yes
2954 menubutton .top.file -text "File" -menu .top.file.m
2956 .top.file.m add command -label "Save settings" -command {save-settings}
2957 .top.file.m add separator
2958 .top.file.m add command -label "Exit" -command {exit-action}
2960 menubutton .top.target -text "Target" -menu .top.target.m
2962 .top.target.m add cascade -label "Connect" -menu .top.target.m.clist
2963 .top.target.m add command -label "Disconnect" -command {close-target}
2964 .top.target.m add command -label "About" -command {about-target}
2965 .top.target.m add cascade -label "Setup" -menu .top.target.m.slist
2966 .top.target.m add command -label "Setup new" -command {define-target-dialog}
2967 .top.target.m add separator
2968 set-target-hotlist 0
2970 configure-disable-e .top.target.m 1
2971 configure-disable-e .top.target.m 2
2973 menu .top.target.m.clist
2974 menu .top.target.m.slist
2977 menubutton .top.service -text "Service" -menu .top.service.m
2979 .top.service.m add command -label "Database" -command {database-select}
2980 .top.service.m add cascade -label "Present" -menu .top.service.m.present
2981 menu .top.service.m.present
2982 .top.service.m.present add command -label "10 More" \
2983 -command [list present-more 10]
2984 .top.service.m.present add command -label "All" \
2985 -command [list present-more {}]
2986 .top.service.m add command -label "Search" -command {search-request 0}
2987 .top.service.m add command -label "Scan" -command {scan-request}
2989 .top.service configure -state disabled
2991 menubutton .top.rset -text "Set" -menu .top.rset.m
2993 .top.rset.m add command -label "Load" -command {load-set}
2994 .top.rset.m add separator
2996 menubutton .top.options -text "Options" -menu .top.options.m
2998 .top.options.m add cascade -label "Query" -menu .top.options.m.query
2999 .top.options.m add cascade -label "Format" -menu .top.options.m.formats
3000 .top.options.m add cascade -label "Wrap" -menu .top.options.m.wrap
3001 .top.options.m add cascade -label "Syntax" -menu .top.options.m.syntax
3003 menu .top.options.m.query
3004 .top.options.m.query add cascade -label "Select" \
3005 -menu .top.options.m.query.clist
3006 .top.options.m.query add cascade -label "Edit" \
3007 -menu .top.options.m.query.slist
3008 .top.options.m.query add command -label "New" \
3009 -command {query-new}
3010 .top.options.m.query add cascade -label "Delete" \
3011 -menu .top.options.m.query.dlist
3013 menu .top.options.m.query.slist
3014 menu .top.options.m.query.clist
3015 menu .top.options.m.query.dlist
3018 menu .top.options.m.formats
3020 foreach f $displayFormats {
3021 .top.options.m.formats add radiobutton -label $f -value $i \
3022 -command [list set-display-format $i] -variable displayFormat
3026 menu .top.options.m.wrap
3027 .top.options.m.wrap add radiobutton -label "Character" \
3028 -value char -variable textWrap -command {set-wrap char}
3029 .top.options.m.wrap add radiobutton -label "Word" \
3030 -value word -variable textWrap -command {set-wrap word}
3031 .top.options.m.wrap add radiobutton -label "None" \
3032 -value none -variable textWrap -command {set-wrap none}
3034 menu .top.options.m.syntax
3035 .top.options.m.syntax add radiobutton -label "None" \
3036 -value None -variable recordSyntax
3037 .top.options.m.syntax add separator
3038 .top.options.m.syntax add radiobutton -label "USMARC" \
3039 -value USMARC -variable recordSyntax
3040 .top.options.m.syntax add radiobutton -label "UNIMARC" \
3041 -value UNIMARC -variable recordSyntax
3042 .top.options.m.syntax add radiobutton -label "UKMARC" \
3043 -value UKMARC -variable recordSyntax
3044 .top.options.m.syntax add radiobutton -label "DANMARC" \
3045 -value DANMARC -variable recordSyntax
3046 .top.options.m.syntax add radiobutton -label "FINMARC" \
3047 -value FINMARC -variable recordSyntax
3048 .top.options.m.syntax add radiobutton -label "NORMARC" \
3049 -value NORMARC -variable recordSyntax
3050 .top.options.m.syntax add radiobutton -label "PICAMARC" \
3051 -value PICAMARC -variable recordSyntax
3052 .top.options.m.syntax add separator
3053 .top.options.m.syntax add radiobutton -label "SUTRS" \
3054 -value SUTRS -variable recordSyntax
3055 .top.options.m.syntax add separator
3056 .top.options.m.syntax add radiobutton -label "GRS1" \
3057 -value GRS1 -variable recordSyntax
3059 menubutton .top.help -text "Help" -menu .top.help.m
3062 .top.help.m add command -label "Help on help" \
3063 -command {tkerror "Help on help not available. Sorry"}
3064 .top.help.m add command -label "About" -command {about-origin}
3066 pack .top.file .top.target .top.service .top.rset .top.options -side left
3067 pack .top.help -side right
3069 index-lines .lines 1 $queryButtonsFind [lindex $queryInfo 0] activate-index
3071 button .mid.search -text Search -command {search-request 0} \
3073 button .mid.scan -text Scan \
3074 -command scan-request -state disabled
3075 button .mid.present -text {Present} -command [list present-more 10] \
3078 button .mid.clear -text Clear -command index-clear
3079 pack .mid.search .mid.scan .mid.present .mid.clear -side left \
3082 text .data.record -height 2 -width 20 -wrap none \
3083 -yscrollcommand [list .data.scroll set] -wrap $textWrap
3084 scrollbar .data.scroll -command [list .data.record yview]
3086 .data.record configure -takefocus 0
3087 .data.scroll configure -takefocus 0
3089 pack .data.scroll -side right -fill y
3090 pack .data.record -expand yes -fill both
3094 .data.record tag configure marc-tag -foreground blue
3095 .data.record tag configure marc-id -foreground red
3097 .data.record tag configure marc-tag -foreground black
3098 .data.record tag configure marc-id -foreground black
3100 .data.record tag configure marc-data -foreground black
3102 button .bot.logo -bitmap @${libdir}/bitmaps/book1 -command cancel-operation
3104 .bot.logo configure -takefocus 0
3107 pack .bot.a -side left -fill x
3108 pack .bot.logo -side right -padx 2 -pady 2 -ipadx 1
3110 message .bot.a.target -text "" -aspect 1000 -border 1
3112 label .bot.a.status -text "Not connected" -width 15 -relief \
3113 sunken -anchor w -border 1
3114 label .bot.a.set -text "" -width 5 -relief \
3115 sunken -anchor w -border 1
3116 label .bot.a.message -text "" -width 15 -relief \
3117 sunken -anchor w -border 1
3119 pack .bot.a.target -side top -anchor nw -padx 2 -pady 2
3120 pack .bot.a.status .bot.a.set .bot.a.message \
3121 -side left -padx 2 -pady 2 -ipadx 1 -ipady 1
3123 if {[catch {ir z39}]} {
3124 set e [info sharedlibextension]
3128 puts -nonewline "Loading irtcl$e ..."