1 # IR toolkit for tcl/tk
3 # See the file LICENSE for details.
4 # Sebastian Hammer, Adam Dickmeiss
7 # Revision 1.66 1995-08-29 15:30:13 adam
10 # Revision 1.65 1995/08/24 15:39:09 adam
13 # Revision 1.64 1995/08/24 15:33:02 adam
16 # Revision 1.63 1995/08/04 13:20:48 adam
17 # Buttons at the bottom are slightly smaller.
19 # Revision 1.62 1995/08/04 11:32:37 adam
20 # More work on output queue. Memory related routines moved
23 # Revision 1.61 1995/07/20 08:09:39 adam
24 # client.tcl: Targets removed from hotTargets list when targets
25 # are removed/modified.
26 # ir-tcl.c: More work on triggerResourceControl.
28 # Revision 1.60 1995/06/30 16:30:19 adam
31 # Revision 1.59 1995/06/29 14:06:25 adam
32 # Another bug in install fixed. Configure searches for more versions of yaz.
34 # Revision 1.58 1995/06/29 12:34:06 adam
35 # IrTcl now works with both tk4.0b4/tcl7.4b4 and tk3.6/tcl7.3
37 # Revision 1.57 1995/06/29 09:20:30 adam
38 # Target entries in cascade menus are sorted.
40 # Revision 1.56 1995/06/27 19:03:48 adam
41 # Bug fix in do_present in ir-tcl.c: p->set_child member weren't set.
42 # nextResultSetPosition used instead of setOffset.
44 # Revision 1.55 1995/06/27 17:10:37 adam
45 # Bug fix: install procedure didn't work on some systems.
46 # Error turned up when clientrc.tcl was't present.
48 # Revision 1.54 1995/06/27 14:41:03 adam
49 # Bug fix in search-response. Didn't always observe non-surrogate diagnostics.
51 # Revision 1.53 1995/06/26 12:40:09 adam
52 # Client defines its own tkerror.
53 # User may specify 'no preferredRecordSyntax'.
55 # Revision 1.52 1995/06/22 13:14:59 adam
56 # Feature: SUTRS. Setting getSutrs implemented.
57 # Work on display formats.
58 # Preferred record syntax can be set by the user.
60 # Revision 1.51 1995/06/21 11:11:00 adam
61 # Bug fix: libdir undefined in about-origin.
63 # Revision 1.50 1995/06/21 11:04:48 adam
64 # Uses GNU autoconf 2.3.
65 # Install procedure implemented.
66 # boook bitmaps moved to sub directory bitmaps.
68 # Revision 1.49 1995/06/20 14:16:42 adam
69 # More work on cancel mechanism.
71 # Revision 1.48 1995/06/20 08:07:23 adam
72 # New setting: failInfo.
73 # Working on better cancel mechanism.
75 # Revision 1.47 1995/06/19 14:05:29 adam
76 # Bug fix: asked for SUTRS.
78 # Revision 1.46 1995/06/19 13:06:06 adam
79 # New define: IR_TCL_VERSION.
81 # Revision 1.45 1995/06/19 08:08:44 adam
82 # client.tcl: hotTargets now contain both database and target name.
83 # ir-tcl.c: setting protocol edited. Errors in callbacks are logged
84 # by logf(LOG_WARN, ...) calls.
86 # Revision 1.44 1995/06/16 14:55:18 adam
89 # Revision 1.43 1995/06/16 14:41:05 adam
90 # Scan line entries can be copied to a search entry.
92 # Revision 1.42 1995/06/16 12:28:13 adam
93 # Implemented preferredRecordSyntax.
94 # Minor changes in diagnostic handling.
95 # Record list deleted when connection closes.
97 # Revision 1.41 1995/06/14 15:07:59 adam
98 # Bug fix in cascade-target-list. Uses yaz-version.h.
100 # Revision 1.40 1995/06/14 13:37:17 adam
101 # Setting recordType implemented.
102 # Setting implementationVersion implemented.
103 # Settings implementationId / implementationName edited.
105 # Revision 1.39 1995/06/14 12:16:22 adam
106 # hotTargets, textWrap and displayFormat saved in clientg.tcl.
108 # Revision 1.38 1995/06/14 07:22:45 adam
109 # Target definitions can be deleted.
110 # Listbox used in the query definition dialog.
112 # Revision 1.37 1995/06/13 14:37:59 adam
113 # Work on query setup.
114 # Better about origin/target.
115 # Better presentation formats.
117 # Revision 1.36 1995/06/13 07:42:14 adam
118 # Bindings removed from text widgets.
120 # Revision 1.35 1995/06/12 15:17:31 adam
121 # Text widget used in main window (instead of listbox) to support
122 # better presentation formats.
124 # Revision 1.34 1995/06/12 07:59:07 adam
125 # More work on geometry handling.
127 # Revision 1.33 1995/06/09 11:17:35 adam
128 # Start work on geometry management.
130 # Revision 1.32 1995/06/07 09:16:37 adam
131 # New presentation format.
133 # Revision 1.31 1995/06/06 16:31:09 adam
134 # Bug fix: target names couldn't contain blanks.
137 # Revision 1.30 1995/06/06 11:35:41 adam
138 # Work on scan. Display of old sets.
140 # Revision 1.29 1995/06/05 14:11:18 adam
141 # Bug fix in present-more.
143 # Revision 1.28 1995/06/02 14:52:13 adam
144 # Minor changes really.
146 # Revision 1.27 1995/06/02 14:29:42 adam
147 # Work on scan interface - up/down buttons.
149 # Revision 1.26 1995/06/01 16:36:46 adam
150 # About buttons. Minor bug fixes.
152 # Revision 1.25 1995/05/31 13:09:57 adam
153 # Client searches/presents may be interrupted.
154 # New moving book-logo.
156 # Revision 1.24 1995/05/31 08:36:24 adam
157 # Bug fix in client.tcl: didn't save options on clientrc.tcl.
158 # New method: referenceId. More work on scan.
160 # Revision 1.23 1995/05/29 10:33:41 adam
161 # README and rename of startup script.
163 # Revision 1.22 1995/05/26 11:44:09 adam
164 # Bugs fixed. More work on MARC utilities and queries. Test
165 # client is up-to-date again.
167 # Revision 1.21 1995/05/11 15:34:46 adam
168 # Scan request changed a bit. This version works with RLG.
170 # Revision 1.20 1995/04/21 16:31:57 adam
171 # New radiobutton: protocol (z39v2/SR).
173 # Revision 1.19 1995/04/18 16:11:50 adam
174 # First version of graphical Scan. Some work on query-by-form.
176 # Revision 1.18 1995/04/10 10:50:22 adam
177 # Result-set name defaults to suffix of ir-set name.
178 # Started working on scan. Not finished at this point.
180 # Revision 1.17 1995/03/31 09:34:57 adam
181 # Search-button disabled when there is no connection.
183 # Revision 1.16 1995/03/31 08:56:36 adam
184 # New button "Search".
186 # Revision 1.15 1995/03/28 12:45:22 adam
187 # New ir method failback: called on disconnect/protocol error.
188 # New ir set/get method: protocol: SR / Z3950.
189 # Simple popup and disconnect when failback is invoked.
191 # Revision 1.14 1995/03/22 16:07:55 adam
194 # Revision 1.13 1995/03/21 17:27:26 adam
195 # Short-hand keys in setup.
197 # Revision 1.12 1995/03/21 13:41:03 adam
198 # Comstack cs_create not used too often. Non-blocking connect.
200 # Revision 1.11 1995/03/21 10:39:06 adam
201 # Diagnostic error message displayed with tkerror.
203 # Revision 1.10 1995/03/20 15:24:06 adam
204 # Diagnostic records saved on searchResponse.
206 # Revision 1.9 1995/03/17 18:26:16 adam
207 # Non-blocking i/o used now. Database names popup as cascade items.
209 # Revision 1.8 1995/03/17 15:45:00 adam
210 # Improved target/database setup.
212 # Revision 1.7 1995/03/16 17:54:03 adam
213 # Minor changes really.
215 # Revision 1.6 1995/03/15 19:10:20 adam
216 # Database setup in protocol-setup (rather target setup).
218 # Revision 1.5 1995/03/15 13:59:23 adam
221 # Revision 1.4 1995/03/14 17:32:29 adam
222 # Presentation of full Marc record in popup window.
224 # Revision 1.3 1995/03/12 19:31:52 adam
225 # Pattern matching implemented when retrieving MARC records. More
226 # diagnostic functions.
228 # Revision 1.2 1995/03/10 18:00:15 adam
229 # Actual presentation in line-by-line format. RPN query support.
231 # Revision 1.1 1995/03/09 16:15:07 adam
232 # First presentRequest attempts. Hot-target list.
236 if {$tk_version == "3.6"} {
247 proc configure-enable-e {w n} {
249 $w entryconfigure $n -state normal
251 proc configure-disable-e {w n} {
253 $w entryconfigure $n -state disabled
255 set noFocus [list -takefocus 0]
257 proc configure-enable-e {w n} {
260 proc configure-disable-e {w n} {
267 if {[tk colormodel .] == "color"} {
277 if {[file readable bitmaps/book2]} {
280 if {! [file readable ${libdir}/bitmaps/book2]} {
281 puts "Cannot locate system files in ${libdir}. You must either run this"
282 puts "program from the source directory root of ir-tcl or you must assure"
283 puts "that it is installed - normally in /usr/local/lib/irtcl"
291 set profile(Default) {{} {} {210} {} 16384 8192 tcpip {} 1 {} {} Z39 1}
293 set settingsChanged 0
302 set recordSyntax None
305 set queryTypes {Simple}
306 set queryButtons { { {I 0} {I 1} {I 2} } }
307 set queryInfo { { {Title {1=4 4=1}} {Author {1=1}} \
308 {Subject {1=21}} {Any {1=1016}} } }
317 if {[winfo exists $w]} {
326 label $w.top.b -bitmap error
327 message $w.top.t -aspect 300 -text "Error: $err" \
328 -font -Adobe-Helvetica-Bold-R-Normal-*-180-*
329 pack $w.top.b $w.top.t -side left -padx 10 -pady 10
331 bottom-buttons $w [list {Close} [list destroy $w]] 1
334 proc read-formats {} {
335 global displayFormats
337 if {[catch {set formats [glob -nocomplain ${libdir}/formats/*.tcl]}]} {
338 set formats ./formats/raw.tcl
341 if {[file readable $f]} {
343 set l [string length $f]
344 set f [string range $f [string length "${libdir}/formats/"] \
346 lappend displayFormats $f
355 .data.record configure -wrap $m
361 proc set-display-format {f} {
371 .bot.a.status configure -text "Reformatting"
374 add-title-lines -1 10000 1
377 proc initBindings {} {
380 bind $w <Double-1> {}
381 bind $w <Triple-1> {}
382 bind $w <B1-Motion> {}
384 bind $w <Shift-B1-Motion> {}
386 bind $w <B2-Motion> {}
387 bind $w <Any-KeyPress> {}
389 bind $w <BackSpace> {}
391 bind $w <Control-h> {}
392 bind $w <Control-d> {}
393 bind $w <Control-v> {}
396 bind $w <B1-Motion> {}
397 bind $w <Shift-B1-Motion> {}
402 proc post-menu {wbutton wmenu} {
405 $wmenu post [winfo rootx $wbutton] \
406 [expr [winfo rooty $wbutton]+[winfo height $wbutton]]
411 global windowGeometry
412 set windowGeometry($w) [wm geometry $w]
415 global windowGeometry
418 if {[info exists windowGeometry($w)]} {
419 set g $windowGeometry($w)
424 bind $w <Destroy> [list destroyGW $w]
427 if {[file readable "clientrc.tcl"]} {
428 source "clientrc.tcl"
430 if {[file readable "${libdir}/clientrc.tcl"]} {
431 source "${libdir}/clientrc.tcl"
435 if {[file readable "~/.clientrc.tcl"]} {
436 source "~/.clientrc.tcl"
439 set queryButtonsFind [lindex $queryButtons 0]
440 set queryInfoFind [lindex $queryInfo 0]
442 proc top-down-window {w} {
443 frame $w.top -relief raised -border 1
444 frame $w.bot -relief raised -border 1
446 pack $w.top -side top -fill both -expand yes
447 pack $w.bot -fill both
450 proc top-down-ok-cancel {w ok-action g} {
451 frame $w.bot.left -relief sunken -border 1
452 pack $w.bot.left -side left -expand yes -ipadx 2 -ipady 2 -padx 4 -pady 4
453 button $w.bot.left.ok -width 5 -text {Ok} \
454 -command ${ok-action}
455 pack $w.bot.left.ok -expand yes -ipadx 2 -ipady 2 -padx 3 -pady 3
456 button $w.bot.cancel -width 6 -text {Cancel} \
457 -command [list destroy $w]
458 pack $w.bot.cancel -side left -expand yes
466 proc bottom-buttons {w buttonList g} {
468 set l [llength $buttonList]
470 frame $w.bot.$i -relief sunken -border 1
471 pack $w.bot.$i -side left -expand yes -padx 4 -pady 4
472 button $w.bot.$i.ok -text [lindex $buttonList $i] \
473 -command [lindex $buttonList [expr $i+1]]
474 pack $w.bot.$i.ok -expand yes -ipadx 2 -ipady 2 -padx 2 -pady 2 -side left
478 button $w.bot.$i -text [lindex $buttonList $i] \
479 -command [lindex $buttonList [expr $i+1]]
480 pack $w.bot.$i -expand yes -ipadx 2 -ipady 2 -padx 2 -pady 2 -side left
490 proc cancel-operation {} {
498 show-status Cancel 0 1
502 proc show-target {target base} {
506 .bot.a.target configure -text ""
510 .bot.a.target configure -text "$target"
512 .bot.a.target configure -text "$target - $base"
516 proc show-logo {v1} {
525 .bot.logo configure -bitmap @${libdir}/bitmaps/book${v1}
526 after 140 [list show-logo $v1]
530 .bot.logo configure -bitmap @${libdir}/bitmaps/book1
539 proc show-status {status b sb} {
546 .bot.a.status configure -text "$status"
548 if {$busy == 0} {set busy 1}
556 .top.service configure -state normal
557 .mid.search configure -state normal
559 .mid.scan configure -state normal
562 configure-disable-e .top.service.m 1
563 } elseif {[z39.$setNo nextResultSetPosition] > 0 &&
564 [z39.$setNo nextResultSetPosition] <= [z39.$setNo resultCount]} {
565 configure-enable-e .top.service.m 1
566 .mid.present configure -state normal
568 configure-disable-e .top.service.m 1
569 .mid.present configure -state disabled
571 if {[winfo exists .scan-window]} {
572 .scan-window.bot.2 configure -state normal
573 .scan-window.bot.4 configure -state normal
576 .top.service configure -state disabled
577 .mid.search configure -state disabled
578 .mid.scan configure -state disabled
579 .mid.present configure -state disabled
581 if {[winfo exists .scan-window]} {
582 .scan-window.bot.2 configure -state disabled
583 .scan-window.bot.4 configure -state disabled
588 proc show-message {msg} {
589 .bot.a.message configure -text "$msg"
592 proc insertWithTags {w text args} {
593 set start [$w index insert]
594 $w insert insert $text
595 foreach tag [$w tag names $start] {
596 $w tag remove $tag $start insert
599 $w tag add $i $start insert
603 proc popup-license {} {
608 wm title $w "License"
614 text $w.top.t -width 80 -height 10 -wrap word \
615 -yscrollcommand [list $w.top.s set]
616 scrollbar $w.top.s -command [list $w.top.t yview]
618 pack $w.top.s -side right -fill y
619 pack $w.top.t -expand yes -fill both
621 if {[file readable "${libdir}/LICENSE"]} {
622 set f [open "${libdir}/LICENSE" r]
623 while {[gets $f buf] != -1} {
624 $w.top.t insert end $buf
625 $w.top.t insert end "\n"
629 bottom-buttons $w [list {Close} [list destroy $w]] 1
632 proc about-target {} {
633 set w .about-target-w
638 wm title $w "About target"
642 frame $w.top.a -relief ridge -border 2
643 frame $w.top.p -relief ridge -border 2
645 pack $w.top.a $w.top.p -side top -fill x
647 label $w.top.a.about -text "About"
648 label $w.top.a.irtcl -text $hostid \
649 -font -Adobe-Helvetica-Bold-R-Normal-*-240-*
650 pack $w.top.a.about $w.top.a.irtcl -side top
652 set i [z39 targetImplementationName]
653 label $w.top.p.in -text "Implementation name: $i"
654 set i [z39 targetImplementationId]
655 label $w.top.p.ii -text "Implementation id: $i"
656 set i [z39 targetImplementationVersion]
657 label $w.top.p.iv -text "Implementation version: $i"
659 label $w.top.p.op -text "Protocol options: $i"
661 pack $w.top.p.in $w.top.p.ii $w.top.p.iv $w.top.p.op -side top -anchor nw
663 bottom-buttons $w [list {Close} [list destroy $w]] 1
666 proc about-origin-logo {n} {
668 set w .about-origin-w
669 if {![winfo exists $w]} {
676 $w.top.a.logo configure -bitmap @${libdir}/bitmaps/book$n
677 after 140 [list about-origin-logo $n]
680 proc about-origin {} {
681 set w .about-origin-w
684 if {[winfo exists $w]} {
689 wm title $w "About IrTcl"
693 frame $w.top.a -relief ridge -border 2
694 frame $w.top.p -relief ridge -border 2
696 pack $w.top.a $w.top.p -side top -fill x
698 label $w.top.a.irtcl -text "IrTcl" \
699 -font -Adobe-Helvetica-Bold-R-Normal-*-240-*
700 label $w.top.a.logo -bitmap @${libdir}/bitmaps/book1
701 pack $w.top.a.irtcl $w.top.a.logo -side left -expand yes
703 set i [z39 implementationName]
704 label $w.top.p.in -text "Implementation name: $i"
705 set i [z39 implementationId]
706 label $w.top.p.ii -text "Implementation id: $i"
707 set i [z39 implementationVersion]
708 label $w.top.p.iv -text "Implementation version: $i"
710 pack $w.top.p.in $w.top.p.ii $w.top.p.iv -side top -anchor nw
713 bottom-buttons $w [list {Close} [list destroy $w] \
714 {License} [list popup-license]] 0
717 proc popup-marc {sno no b df} {
719 global displayFormats
722 if {[z39.$sno type $no] != "DB"} {
726 set w .full-marc-$fullMarcSeq
733 if {[winfo exists $w]} {
741 frame $w.top -relief raised -border 1
742 frame $w.bot -relief raised -border 1
744 pack $w.top -side top -fill both -expand yes
745 pack $w.bot -fill both
747 text $w.top.record -width 60 -height 5 -wrap word \
748 -yscrollcommand [list $w.top.s set]
749 scrollbar $w.top.s -command [list $w.top.record yview]
753 $w.top.record tag configure marc-tag -foreground blue
754 $w.top.record tag configure marc-id -foreground red
756 $w.top.record tag configure marc-tag -foreground black
757 $w.top.record tag configure marc-id -foreground black
759 $w.top.record tag configure marc-data -foreground black
762 $w.top.record delete 0.0 end
763 set recordType [z39.$sno recordType $no]
764 wm title $w "$recordType record #$no"
767 bind $w.top.record <Return> {destroy .full-marc}
769 pack $w.top.s -side right -fill y
770 pack $w.top.record -expand yes -fill both
773 bottom-buttons $w [list \
774 {Close} [list destroy $w]] 0
776 bottom-buttons $w [list \
777 {Close} [list destroy $w] \
778 {Duplicate} [list popup-marc $sno $no 1 0]] 0
779 menubutton $w.bot.formats -text "Format" -menu $w.bot.formats.m
780 menu $w.bot.formats.m
782 foreach f $displayFormats {
783 $w.bot.formats.m add radiobutton -label $f \
784 -variable popupMarcdf -value $i \
785 -command [list display-$f $sno $no $w.top.record 0]
788 pack $w.bot.formats -expand yes -ipadx 2 -ipady 2 \
789 -padx 3 -pady 3 -side left
793 $w.bot.formats.m delete 0 last
794 foreach f $displayFormats {
795 $w.bot.formats.m add radiobutton -label $f \
796 -variable popupMarcdf -value $i \
797 -command [list display-$f $sno $no $w.top.record 0]
801 set ffunc [lindex $displayFormats $df]
802 set ffunc "display-$ffunc"
804 $ffunc $sno $no $w.top.record 0
807 proc update-target-hotlist {target base} {
810 set olen [llength $hotTargets]
812 foreach e $hotTargets {
813 if {$target == [lindex $e 0] && $base == [lindex $e 1]} {
814 set hotTargets [lreplace $hotTargets $i $i]
819 set hotTargets [linsert $hotTargets 0 [list $target $base]]
820 set-target-hotlist $olen
823 proc delete-target-hotlist {target} {
826 set olen [llength $hotTargets]
828 foreach e $hotTargets {
829 if {$target == [lindex $e 0]} {
830 set hotTargets [lreplace $hotTargets $i $i]
834 set-target-hotlist $olen
837 proc set-target-hotlist {olen} {
842 .top.target.m delete 7 [expr 7+$olen]
844 .top.target.m delete 6 [expr 6+$olen]
848 foreach e $hotTargets {
849 set target [lindex $e 0]
850 set base [lindex $e 1]
852 .top.target.m add command -label "$i $target" -command \
853 [list reopen-target $target {}]
855 .top.target.m add command -label "$i $target - $base" -command \
856 [list reopen-target $target $base]
865 proc reopen-target {target base} {
867 open-target $target $base
868 update-target-hotlist $target $base
871 proc define-target-action {} {
874 set target [.target-define.top.target.entry get]
878 foreach n [array names profile] {
884 set seq [lindex $profile(Default) 12]
886 set profile($target) $profile(Default)
887 set profile(Default) [lreplace $profile(Default) 12 12 [incr seq]]
889 protocol-setup $target
890 destroy .target-define
893 proc fail-response {target} {
894 set c [lindex [z39 failInfo] 0]
895 set m [lindex [z39 failInfo] 1]
900 proc connect-response {target base} {
901 dputs "connect-response"
902 show-target $target $base
906 proc open-target {target base} {
911 z39 comstack [lindex $profile($target) 6]
912 z39 protocol [lindex $profile($target) 11]
913 z39 idAuthentication [lindex $profile($target) 3]
914 z39 maximumRecordSize [lindex $profile($target) 4]
915 z39 preferredMessageSize [lindex $profile($target) 5]
916 dputs "maximumRecordSize="
917 dputs [z39 maximumRecordSize]
918 dputs "preferredMessageSize="
919 dputs [z39 preferredMessageSize]
920 show-status Connecting 1 0
922 z39 databaseNames [lindex [lindex $profile($target) 7] 0]
924 z39 databaseNames $base
926 z39 failback [list fail-response $target]
927 z39 callback [list connect-response $target $base]
930 z39 connect [lindex $profile($target) 1]:[lindex $profile($target) 2]
933 tkerror $errorMessage
934 show-status "Not connected" 0 {}
938 configure-disable-e .top.target.m 0
939 configure-enable-e .top.target.m 1
940 configure-enable-e .top.target.m 2
943 proc close-target {} {
952 .bot.a.set configure -text ""
956 show-status {Not connected} 0 0
959 configure-disable-e .top.target.m 1
960 configure-disable-e .top.target.m 2
962 .top.rset.m delete 2 last
964 .top.rset.m delete 1 last
966 .top.rset.m add separator
967 configure-enable-e .top.target.m 0
970 proc load-set-action {} {
974 ir-set z39.$setNoLast z39
976 set fname [.load-set.top.filename.entry get]
979 show-status Loading 1 {}
981 z39.$setNoLast loadFile $fname
983 set no [z39.$setNoLast numberOfRecordsReturned]
984 add-title-lines $setNoLast $no 1
986 set l [format "%-4d %7d" $setNoLast $no]
987 .top.rset.m add command -label $l \
988 -command [list add-title-lines $setNoLast 10000 1]
989 show-status Ready 0 {}
999 frame $w.top.filename
1000 pack $w.top.filename -side top -anchor e -pady 2
1002 entry-fields $w.top {filename} \
1004 {load-set-action} {destroy .load-set}
1006 top-down-ok-cancel $w {load-set-action} 1
1010 proc init-request {} {
1017 z39 callback {init-response}
1018 show-status Initializing 1 {}
1019 set err [catch {z39 init} errorMessage]
1021 tkerror $errorMessage
1022 show-status Ready 0 {}
1026 proc init-response {} {
1034 if {![z39 initResult]} {
1035 show-status Ready 0 1
1036 set u [z39 userInformationField]
1038 tkerror "Connection rejected by target: $u"
1040 if {[lsearch [z39 options] scan] >= 0} {
1045 show-status Ready 0 1
1049 proc search-request {bflag} {
1061 dputs "search-request"
1063 if {!$bflag && $busy} {
1064 dputs "busy: search-request ignored"
1069 show-status Searching 1 0
1070 set delayRequest {search-request 1}
1075 set query [index-query]
1080 set setNo $setNoLast
1081 ir-set z39.$setNo z39
1083 if {[lindex $profile($target) 10] == 1} {
1084 z39.$setNo setName $setNo
1085 dputs "setName=${setNo}"
1087 z39.$setNo setName Default
1088 dputs "setName=Default"
1090 if {[lindex $profile($target) 8] == 1} {
1091 z39.$setNo queryType rpn
1093 if {[lindex $profile($target) 9] == 1} {
1094 z39.$setNo queryType ccl
1098 if {$recordSyntax == "None" } {
1099 z39.$setNo preferredRecordSyntax {}
1101 z39.$setNo preferredRecordSyntax $recordSyntax
1103 z39 callback {search-response}
1104 z39.$setNo search $query
1105 show-status Searching 1 0
1108 proc scan-copy {y entry} {
1110 set no [$w.top.list nearest $y]
1112 .lines.$entry.e delete 0 end
1113 .lines.$entry.e insert 0 [string range [$w.top.list get $no] 8 end]
1116 proc scan-request {} {
1123 global curIndexEntry
1124 global queryButtonsFind
1125 global queryInfoFind
1129 dputs "scan-request"
1132 show-status Scanning 1 0
1133 set delayRequest scan-request
1142 set b [lindex $queryButtonsFind $curIndexEntry]
1144 foreach a [lrange [lindex $queryInfoFind [lindex $b 1]] 1 end] {
1145 set attr "@attr $a $attr"
1147 set title [lindex [lindex $queryInfoFind [lindex $b 1]] 0]
1148 ir-scan z39.scan z39
1150 if {![winfo exists $w]} {
1157 entry $w.top.entry -relief sunken
1158 pack $w.top.entry -fill x -padx 4 -pady 2
1159 bind $w.top.entry <KeyRelease> [list scan-term-h $attr]
1160 listbox $w.top.list -yscrollcommand [list $w.top.scroll set] \
1162 scrollbar $w.top.scroll -orient vertical -border 1
1163 pack $w.top.list -side left -fill both -expand yes
1164 pack $w.top.scroll -side right -fill y
1165 $w.top.scroll config -command [list $w.top.list yview]
1167 bottom-buttons $w [list {Close} [list destroy $w] \
1168 {Up} [list scan-up $attr] \
1169 {Down} [list scan-down $attr]] 0
1170 bind $w.top.list <Up> [list scan-up $attr]
1171 bind $w.top.list <Down> [list scan-down $attr]
1174 bind $w.top.list <Double-Button-1> [list scan-copy %y $curIndexEntry]
1175 wm title $w "Scan $title"
1177 z39 callback [list scan-response $attr 0 35]
1178 z39.scan numberOfTermsRequested 5
1179 z39.scan preferredPositionInResponse 1
1180 z39.scan scan "${attr} 0"
1182 show-status Scanning 1 0
1185 proc scan-term-h {attr} {
1193 set nScanTerm [$w.top.entry get]
1194 if {$nScanTerm == $scanTerm} {
1197 set scanTerm $nScanTerm
1198 z39 callback [list scan-response $attr 0 35]
1199 z39.scan numberOfTermsRequested 5
1200 z39.scan preferredPositionInResponse 1
1201 dputs "${attr} \{${scanTerm}\}"
1202 if {$scanTerm == ""} {
1203 z39.scan scan "${attr} 0"
1205 z39.scan scan "${attr} \{${scanTerm}\}"
1207 show-status Scanning 1 0
1210 proc scan-response {attr start toget} {
1217 dputs "In scan-response"
1218 set m [z39.scan numberOfEntriesReturned]
1224 if {![winfo exists .scan-window]} {
1227 dputs "Handling cancel"
1228 if {$delayRequest != ""} {
1233 show-status Ready 0 1
1236 set nScanTerm [$w.top.entry get]
1237 if {$nScanTerm != $scanTerm} {
1238 z39 callback [list scan-response $attr 0 35]
1239 z39.scan numberOfTermsRequested 5
1240 z39.scan preferredPositionInResponse 1
1241 set scanTerm $nScanTerm
1242 dputs "${attr} \{${scanTerm}\}"
1243 if {$scanTerm == ""} {
1244 z39.scan scan "${attr} 0"
1246 z39.scan scan "${attr} \{${scanTerm}\}"
1248 show-status Scanning 1 0
1251 set status [z39.scan scanStatus]
1254 show-status Ready 0 1
1259 for {set i 0} {$i < $m} {incr i} {
1260 set term [lindex [z39.scan scanLine $i] 1]
1261 set nostr [format " %-6d" [lindex [z39.scan scanLine $i] 2]]
1262 $w.top.list insert $i "$nostr $term"
1265 $w.top.list yview $scanView
1267 $w.top.list delete $start end
1268 for {set i 0} {$i < $m} {incr i} {
1269 set term [lindex [z39.scan scanLine $i] 1]
1270 set nostr [format " %-6d" [lindex [z39.scan scanLine $i] 2]]
1271 $w.top.list insert end "$nostr $term"
1275 dputs "Handling cancel"
1277 if {$delayRequest != ""} {
1283 if {$toget > 0 && $m > 1 && $m < $toget} {
1284 set ntoget [expr $toget - $m + 1]
1285 dputs ntoget=$ntoget
1286 z39 callback [list scan-response $attr [expr $start + $m - 1] $ntoget]
1288 dputs "down continue: $q"
1290 z39.scan numberOfTermsRequested 10
1292 z39.scan numberOfTermsRequested $ntoget
1294 z39.scan preferredPositionInResponse 1
1295 dputs "${attr} \{$q\}"
1296 z39.scan scan "${attr} \{$q\}"
1299 if {$toget < 0 && $m > 1 && $m < [expr - $toget]} {
1300 set ntoget [expr - $toget - $m]
1301 dputs ntoget=$ntoget
1302 z39 callback [list scan-response $attr 0 -$ntoget]
1303 set q [string range [$w.top.list get 0] 8 end]
1304 dputs "up continue: $q"
1306 z39.scan numberOfTermsRequested 10
1307 z39.scan preferredPositionInResponse 11
1309 z39.scan numberOfTermsRequested $ntoget
1310 z39.scan preferredPositionInResponse [incr ntoget]
1312 dputs "${attr} \{$q\}"
1313 z39.scan scan "${attr} \{$q\}"
1316 show-status Ready 0 1
1319 proc scan-down {attr} {
1327 show-status {Scanning down} 1 0
1328 set delayRequest [list scan-down $attr]
1334 set scanView [expr $scanView + 5]
1335 set s [$w.top.list size]
1336 if {$scanView > $s} {
1337 z39 callback [list scan-response $attr [expr $s - 1] 25]
1338 set q [string range [$w.top.list get [expr $s - 1]] 8 end]
1340 z39.scan numberOfTermsRequested 10
1341 z39.scan preferredPositionInResponse 1
1342 show-status Scanning 1 0
1343 dputs "${attr} \{$q\}"
1344 z39.scan scan "${attr} \{$q\}"
1347 $w.top.list yview $scanView
1350 proc scan-up {attr} {
1358 show-status Scanning 1 0
1359 set delayRequest [list scan-up $attr]
1365 set scanView [expr $scanView - 5]
1366 if {$scanView < 0} {
1367 z39 callback [list scan-response $attr 0 -25]
1368 set q [string range [$w.top.list get 0] 8 end]
1370 z39.scan numberOfTermsRequested 10
1371 z39.scan preferredPositionInResponse 11
1372 show-status Scanning 1 0
1373 z39.scan scan "${attr} \{$q\}"
1376 $w.top.list yview $scanView
1379 proc search-response {} {
1387 dputs "In search-response"
1389 dputs "Handling cancel"
1391 if {$delayRequest != ""} {
1399 set setMax [z39.$setNo resultCount]
1400 show-status Ready 0 1
1401 set status [z39.$setNo responseStatus]
1402 if {[lindex $status 0] == "NSD"} {
1403 z39.$setNo nextResultSetPosition 0
1404 set code [lindex $status 1]
1405 set msg [lindex $status 2]
1406 set addinfo [lindex $status 3]
1407 tkerror "NSD$code: $msg: $addinfo"
1410 show-message "${setMax} hits"
1415 show-status Ready 0 1
1416 set l [format "%-4d %7d" $setNo $setMax]
1417 .top.rset.m add command -label $l \
1418 -command [list add-title-lines $setNo 10000 1]
1422 z39 callback {present-response}
1423 z39.$setNo present $setOffset 1
1424 show-status Retrieving 1 0
1427 proc present-more {number} {
1435 dputs "present-more"
1437 show-status Retrieving 1 0
1438 set delayRequest "present-more $number"
1444 dputs "setNo=$setNo"
1447 set setOffset [z39.$setNo nextResultSetPosition]
1448 dputs "setOffest=${setOffset}"
1449 dputs "setNo=${setNo}"
1450 set max [z39.$setNo resultCount]
1451 if {$max < $setOffset} {
1453 dputs "setOffset=$setOffset"
1454 show-status Ready 0 1
1457 if {$number == ""} {
1461 if {$setMax > $max} {
1465 z39 callback {present-response}
1467 set toGet [expr $setMax - $setOffset + 1]
1474 z39.$setNo present $setOffset $toGet
1475 show-status Retrieving 1 0
1478 proc init-title-lines {} {
1479 .data.record delete 0.0 end
1482 proc title-press {y setno} {
1483 show-full-marc $setno [expr 1 + [.data.list nearest $y]] 0
1486 proc add-title-lines {setno no offset} {
1487 global displayFormats
1488 global displayFormat
1498 .bot.a.set configure -text $setno
1499 .data.record delete 0.0 end
1501 set ffunc [lindex $displayFormats $displayFormat]
1502 dputs "ffunc=$ffunc"
1503 set ffunc "display-$ffunc"
1504 for {set i 0} {$i < $no} {incr i} {
1505 set o [expr $i + $offset]
1506 set type [z39.$setno type $o]
1510 .data.record tag bind r$o <Any-Enter> {}
1511 .data.record tag bind r$o <Any-Leave> {}
1512 set insert0 [.data.record index insert]
1513 $ffunc $setno $o .data.record 1
1514 .data.record tag add r$o $insert0 insert
1515 .data.record tag bind r$o <1> \
1516 [list popup-marc $setno $o 0 0]
1520 show-status Ready 0 1
1524 proc present-response {} {
1531 dputs "In present-response"
1532 set no [z39.$setNo numberOfRecordsReturned]
1533 dputs "Returned $no records, setOffset $setOffset"
1534 add-title-lines $setNo $no $setOffset
1535 set setOffset [expr $setOffset + $no]
1537 dputs "Handling cancel"
1539 if {$delayRequest != ""} {
1544 set status [z39.$setNo responseStatus]
1545 if {[lindex $status 0] == "NSD"} {
1546 show-status Ready 0 1
1547 set code [lindex $status 1]
1548 set msg [lindex $status 2]
1549 set addinfo [lindex $status 3]
1550 tkerror "NSD$code: $msg: $addinfo"
1553 if {$no > 0 && $setOffset <= $setMax} {
1554 dputs "present-request from ${setOffset}"
1555 set toGet [expr $setMax - $setOffset + 1]
1559 z39.$setNo present $setOffset $toGet
1561 show-status Ready 0 1
1565 proc left-cursor {w} {
1566 set i [$w index insert]
1574 proc right-cursor {w} {
1575 set i [$w index insert]
1581 proc bind-fields {list returnAction escapeAction} {
1582 set max [expr [llength $list]-1]
1583 for {set i 0} {$i < $max} {incr i} {
1584 bind [lindex $list $i] <Return> $returnAction
1585 bind [lindex $list $i] <Escape> $escapeAction
1587 bind [lindex $list $i] <Tab> \
1588 [list focus [lindex $list [expr $i+1]]]
1589 bind [lindex $list $i] <Left> \
1590 [list left-cursor [lindex $list $i]]
1591 bind [lindex $list $i] <Right> \
1592 [list right-cursor [lindex $list $i]]
1595 bind [lindex $list $i] <Return> $returnAction
1596 bind [lindex $list $i] <Escape> $escapeAction
1598 bind [lindex $list $i] <Tab> [list focus [lindex $list 0]]
1599 bind [lindex $list $i] <Left> [list left-cursor [lindex $list $i]]
1600 bind [lindex $list $i] <Right> [list right-cursor [lindex $list $i]]
1602 focus [lindex $list 0]
1605 proc entry-fields {parent list tlist returnAction escapeAction} {
1608 foreach field $list {
1609 set label ${parent}.${field}.label
1610 set entry ${parent}.${field}.entry
1611 label $label -text [lindex $tlist $i] -anchor e
1612 entry $entry -width 32 -relief sunken
1613 pack $label -side left
1614 pack $entry -side right
1615 lappend alist $entry
1618 bind-fields $alist $returnAction $escapeAction
1621 proc define-target-dialog {} {
1622 set w .target-define
1628 pack $w.top.target \
1629 -side top -anchor e -pady 2
1630 entry-fields $w.top {target} \
1632 {define-target-action} {destroy .target-define}
1633 top-down-ok-cancel $w {define-target-action} 1
1636 proc protocol-setup-delete {target} {
1638 global settingsChanged
1640 set a [alert "Are you sure you want to delete the target \
1641 definition $target ?"]
1643 set wno [lindex $profile($target) 12]
1646 unset profile($target)
1647 set settingsChanged 1
1649 delete-target-hotlist $target
1653 proc protocol-setup-action {target} {
1656 global protocolRadioType
1657 global settingsChanged
1660 global ResultSetCheck
1662 set wno [lindex $profile($target) 12]
1666 set settingsChanged 1
1667 set len [$w.top.databases.list size]
1668 for {set i 0} {$i < $len} {incr i} {
1669 lappend b [$w.top.databases.list get $i]
1671 set profile($target) [list [$w.top.description.entry get] \
1672 [$w.top.host.entry get] \
1673 [$w.top.port.entry get] \
1674 [$w.top.idAuthentication.entry get] \
1675 [$w.top.maximumRecordSize.entry get] \
1676 [$w.top.preferredMessageSize.entry get] \
1682 $protocolRadioType \
1686 delete-target-hotlist $target
1687 dputs $profile($target)
1691 proc place-force {window parent} {
1692 set g [wm geometry $parent]
1694 set p1 [string first + $g]
1695 set p2 [string last + $g]
1697 set x [expr 40+[string range $g [expr $p1 +1] [expr $p2 -1]]]
1698 set y [expr 60+[string range $g [expr $p2 +1] end]]
1699 wm geometry $window +${x}+${y}
1702 proc add-database-action {target} {
1705 set wno [lindex $profile($target) 12]
1708 $w.top.databases.list insert end \
1709 [.database-select.top.database.entry get]
1710 destroy .database-select
1713 proc add-database {target} {
1716 set w .database-select
1718 set oldFocus [focus]
1720 set wno [lindex $profile($target) 12]
1721 place-force $w .setup-${wno}
1725 frame $w.top.database
1727 pack $w.top.database -side top -anchor e -pady 2
1729 entry-fields $w.top {database} \
1730 {{Database to add:}} \
1731 [list add-database-action $target] {destroy .database-select}
1733 top-down-ok-cancel $w [list add-database-action $target] 1
1737 proc delete-database {target} {
1740 set wno [lindex $profile($target) 12]
1743 foreach i [$w.top.databases.list curselection] {
1744 set b [$w.top.databases.list get $i]
1747 set a [alert "Are you sure you want to remove the database(s)${l}?"]
1749 foreach i [lsort -decreasing \
1750 [$w.top.databases.list curselection]] {
1751 $w.top.databases.list delete $i
1756 proc protocol-setup {target} {
1759 global protocolRadioType
1762 global ResultSetCheck
1764 set wno [lindex $profile($target) 12]
1769 wm title $w "Setup $target"
1773 if {$target == ""} {
1777 dputs $profile($target)
1779 frame $w.top.description
1782 frame $w.top.idAuthentication
1783 frame $w.top.maximumRecordSize
1784 frame $w.top.preferredMessageSize
1785 frame $w.top.cs-type -relief ridge -border 2
1786 frame $w.top.protocol -relief ridge -border 2
1787 frame $w.top.query -relief ridge -border 2
1788 frame $w.top.databases -relief ridge -border 2
1790 # Maximum/preferred/idAuth ...
1791 pack $w.top.description $w.top.host $w.top.port \
1792 $w.top.idAuthentication $w.top.maximumRecordSize \
1793 $w.top.preferredMessageSize -side top -anchor e -pady 2
1795 entry-fields $w.top {description host port idAuthentication \
1796 maximumRecordSize preferredMessageSize} \
1797 {{Description:} {Host:} {Port:} {Id Authentication:} \
1798 {Maximum Record Size:} {Preferred Message Size:}} \
1799 [list protocol-setup-action $target] [list destroy $w]
1801 foreach sub {description host port idAuthentication \
1802 maximumRecordSize preferredMessageSize} {
1804 bind $w.top.$sub.entry <Control-a> [list add-database $target]
1805 bind $w.top.$sub.entry <Control-d> [list delete-database $target]
1807 $w.top.description.entry insert 0 [lindex $profile($target) 0]
1808 $w.top.host.entry insert 0 [lindex $profile($target) 1]
1809 $w.top.port.entry insert 0 [lindex $profile($target) 2]
1810 $w.top.idAuthentication.entry insert 0 [lindex $profile($target) 3]
1811 $w.top.maximumRecordSize.entry insert 0 [lindex $profile($target) 4]
1812 $w.top.preferredMessageSize.entry insert 0 [lindex $profile($target) 5]
1813 set csRadioType [lindex $profile($target) 6]
1814 set RPNCheck [lindex $profile($target) 8]
1815 set CCLCheck [lindex $profile($target) 9]
1816 set ResultSetCheck [lindex $profile($target) 10]
1817 set protocolRadioType [lindex $profile($target) 11]
1818 if {$protocolRadioType == ""} {
1819 set protocolRadioType Z39
1823 pack $w.top.databases -side left -pady 4 -padx 4 -expand yes -fill both
1825 label $w.top.databases.label -text "Databases"
1826 button $w.top.databases.add -text "Add" \
1827 -command [list add-database $target]
1828 button $w.top.databases.delete -text "Delete" \
1829 -command [list delete-database $target]
1831 listbox $w.top.databases.list -geometry 20x6 \
1832 -yscrollcommand "$w.top.databases.scroll set"
1834 listbox $w.top.databases.list -width 20 \
1835 -yscrollcommand "$w.top.databases.scroll set"
1837 scrollbar $w.top.databases.scroll -orient vertical -border 1
1838 pack $w.top.databases.label -side top -fill x \
1840 pack $w.top.databases.add $w.top.databases.delete -side top -fill x \
1842 pack $w.top.databases.list -side left -fill both -expand yes \
1844 pack $w.top.databases.scroll -side right -fill y \
1846 $w.top.databases.scroll config -command "$w.top.databases.list yview"
1848 foreach b [lindex $profile($target) 7] {
1849 $w.top.databases.list insert end $b
1853 pack $w.top.cs-type -pady 4 -padx 4 -side top -fill x
1855 label $w.top.cs-type.label -text "Transport"
1856 radiobutton $w.top.cs-type.tcpip -text "TCP/IP" -anchor w \
1857 -variable csRadioType -value tcpip
1858 radiobutton $w.top.cs-type.mosi -text "MOSI" -anchor w\
1859 -variable csRadioType -value mosi
1861 pack $w.top.cs-type.label $w.top.cs-type.tcpip $w.top.cs-type.mosi \
1862 -padx 4 -side top -fill x
1865 pack $w.top.protocol -pady 4 -padx 4 -side top -fill x
1867 label $w.top.protocol.label -text "Protocol"
1868 radiobutton $w.top.protocol.z39v2 -text "Z39.50" -anchor w \
1869 -variable protocolRadioType -value Z39
1870 radiobutton $w.top.protocol.sr -text "SR" -anchor w \
1871 -variable protocolRadioType -value SR
1873 pack $w.top.protocol.label $w.top.protocol.z39v2 $w.top.protocol.sr \
1874 -padx 4 -side top -fill x
1877 pack $w.top.query -pady 4 -padx 4 -side top -fill x
1879 label $w.top.query.label -text "Query support"
1880 checkbutton $w.top.query.c1 -text "RPN query" -anchor w -variable RPNCheck
1881 checkbutton $w.top.query.c2 -text "CCL query" -anchor w -variable CCLCheck
1882 checkbutton $w.top.query.c3 -text "Result sets" -anchor w -variable ResultSetCheck
1884 pack $w.top.query.label -side top
1885 pack $w.top.query.c1 $w.top.query.c2 $w.top.query.c3 \
1886 -padx 4 -side top -fill x
1889 bottom-buttons $w [list {Ok} [list protocol-setup-action $target] \
1890 {Delete} [list protocol-setup-delete $target] \
1891 {Cancel} [list destroy $w]] 0
1894 proc database-select-action {} {
1895 set w .database-select.top
1897 foreach indx [$w.databases.list curselection] {
1898 lappend b [$w.databases.list get $indx]
1901 z39 databaseNames $b
1903 destroy .database-select
1906 proc database-select {} {
1907 set w .database-select
1912 set oldFocus [focus]
1917 frame $w.top.databases -relief ridge -border 2
1919 pack $w.top.databases -side left -pady 6 -padx 6 -expand yes -fill x
1921 label $w.top.databases.label -text "List"
1922 listbox $w.top.databases.list -width 20 -height 6 \
1923 -yscrollcommand "$w.top.databases.scroll set"
1924 scrollbar $w.top.databases.scroll -orient vertical -border 1
1925 pack $w.top.databases.label -side top -fill x \
1927 pack $w.top.databases.list -side left -fill both -expand yes \
1929 pack $w.top.databases.scroll -side right -fill y \
1931 $w.top.databases.scroll config -command "$w.top.databases.list yview"
1933 foreach b [lindex $profile($hostid) 7] {
1934 $w.top.databases.list insert end $b
1936 top-down-ok-cancel $w {database-select-action} 1
1940 proc cascade-target-list {} {
1943 foreach sub [winfo children .top.target.m.clist] {
1946 .top.target.m.clist delete 0 last
1947 foreach n [lsort [array names profile]] {
1948 if {$n != "Default"} {
1949 set nl [lindex $profile($n) 12]
1950 if {[llength [lindex $profile($n) 7]] > 1} {
1951 .top.target.m.clist add cascade -label $n \
1952 -menu .top.target.m.clist.$nl
1953 menu .top.target.m.clist.$nl
1954 foreach b [lindex $profile($n) 7] {
1955 .top.target.m.clist.$nl add command -label $b \
1956 -command [list reopen-target $n $b]
1959 .top.target.m.clist add command -label $n \
1960 -command [list reopen-target $n {}]
1964 .top.target.m.slist delete 0 last
1965 foreach n [lsort [array names profile]] {
1966 if {$n != "Default"} {
1967 .top.target.m.slist add command -label $n \
1968 -command [list protocol-setup $n]
1973 proc query-select {i} {
1974 global queryButtonsFind
1975 global queryInfoFind
1979 set queryInfoFind [lindex $queryInfo $i]
1980 set queryButtonsFind [lindex $queryButtons $i]
1982 index-lines .lines 1 $queryButtonsFind $queryInfoFind activate-index
1985 proc query-new-action {} {
1989 global settingsChanged
1991 set settingsChanged 1
1992 lappend queryTypes [.query-new.top.index.entry get]
1993 lappend queryButtons {}
1994 lappend queryInfo {}
2004 set oldFocus [focus]
2009 -side top -anchor e -pady 2
2010 entry-fields $w.top index \
2012 query-new-action {destroy .query-new}
2013 top-down-ok-cancel $w query-new-action 1
2017 proc query-delete-action {queryNo} {
2021 global settingsChanged
2023 set settingsChanged 1
2025 set queryTypes [lreplace $queryTypes $queryNo $queryNo]
2026 set queryButtons [lreplace $queryButtons $queryNo $queryNo]
2027 set queryInfo [lreplace $queryInfo $queryNo $queryNo]
2028 destroy .query-delete
2032 proc query-delete {queryNo} {
2040 set n [lindex $queryTypes $queryNo]
2042 label $w.top.warning -bitmap warning
2043 message $w.top.quest -text "Are you sure you want to delete the \
2044 query type $n ?" -aspect 300
2045 pack $w.top.warning $w.top.quest -side left -expand yes -padx 10 -pady 5
2046 bottom-buttons $w [list {Ok} [list query-delete-action $queryNo] \
2047 {Cancel} [list destroy $w]] 1
2050 proc cascade-query-list {} {
2052 set w .top.options.m.query
2055 $w.slist delete 0 last
2056 foreach n $queryTypes {
2057 $w.slist add command -label $n -command [list query-setup $i]
2062 $w.clist delete 0 last
2063 foreach n $queryTypes {
2064 $w.clist add command -label $n -command [list query-select $i]
2068 $w.dlist delete 0 last
2069 foreach n $queryTypes {
2070 $w.dlist add command -label $n -command [list query-delete $i]
2075 proc save-geometry {} {
2076 global windowGeometry
2079 global displayFormat
2083 set windowGeometry(.) [wm geometry .]
2085 set f [open "~/.clientrc.tcl" w]
2087 puts $f "set hotTargets \{ $hotTargets \}"
2088 puts $f "set textWrap $textWrap"
2089 puts $f "set displayFormat $displayFormat"
2090 puts $f "set popupMarcdf $popupMarcdf"
2091 puts $f "set recordSyntax $recordSyntax"
2092 foreach n [array names windowGeometry] {
2093 puts -nonewline $f "set \{windowGeometry($n)\} \{"
2094 puts -nonewline $f $windowGeometry($n)
2100 proc save-settings {} {
2103 global settingsChanged
2108 if {![file writable "${libdir}/clientrc.tcl"]} {
2109 set a [alert "Cannot open ${libdir}/clientrc.tcl for writing. Do you \
2110 wish to save clientrc.tcl in the current directory instead?"]
2114 set f [open "clientrc.tcl" w]
2116 set f [open "${libdir}/clientrc.tcl" w]
2118 puts $f "# Setup file"
2120 foreach n [array names profile] {
2121 puts -nonewline $f "set \{profile($n)\} \{"
2122 puts -nonewline $f $profile($n)
2125 puts -nonewline $f "set queryTypes \{"
2126 puts -nonewline $f $queryTypes
2129 puts -nonewline $f "set queryButtons \{"
2130 puts -nonewline $f $queryButtons
2133 puts -nonewline $f "set queryInfo \{"
2134 puts -nonewline $f $queryInfo
2137 set settingsChanged 0
2146 set oldFocus [focus]
2150 label $w.top.warning -bitmap warning
2151 message $w.top.message -text $ask -aspect 300 \
2152 -font -Adobe-Times-Medium-R-Normal-*-180-*
2154 pack $w.top.warning $w.top.message -side left -pady 5 -padx 10 -expand yes
2157 top-down-ok-cancel $w {alert-action} 1
2162 proc alert-action {} {
2168 proc exit-action {} {
2169 global settingsChanged
2171 if {$settingsChanged} {
2172 set a [alert "you haven't saved your settings. Do you wish to save?"]
2181 proc listbuttonaction {w name h user i} {
2182 $w configure -text [lindex $name 0]
2183 $h [lindex $name 1] $user $i
2186 proc listbuttonx {button no names handle user} {
2187 if {[winfo exists $button]} {
2188 $button configure -text [lindex [lindex $names $no] 0]
2189 ${button}.m delete 0 last
2191 menubutton $button -text [lindex [lindex $names $no] 0] \
2192 -width 10 -menu ${button}.m -relief raised -border 1
2196 foreach name $names {
2197 ${button}.m add command -label [lindex $name 0] \
2198 -command [list listbuttonaction ${button} $name \
2204 proc listbutton {button no names} {
2205 menubutton $button -text [lindex $names $no] -width 10 -menu ${button}.m \
2206 -relief raised -border 1
2208 foreach name $names {
2209 ${button}.m add command -label $name \
2210 -command [list ${button} configure -text $name]
2214 proc listbuttonv-action {button var names i} {
2217 set $var [lindex $names [expr $i+1]]
2218 $button configure -text [lindex $names $i]
2221 proc listbuttonv {button var names} {
2225 eval "set val $$var"
2226 set l [llength $names]
2227 for {set i 1} {$i < $l} {incr i 2} {
2228 if {$val == [lindex $names $i]} {
2230 set n [lindex $names $i]
2234 if {[winfo exists $button]} {
2235 $button configure -text $n
2238 menubutton $button -text $n -menu ${button}.m \
2239 -relief raised -border 1
2241 for {set i 0} {$i < $l} {incr i 2} {
2242 ${button}.m add command -label [lindex $names $i] \
2243 -command [list listbuttonv-action $button $var $names $i]
2247 proc query-add-index-action {queryNo} {
2251 global queryButtonsTmp
2253 set newI [.query-add-index.top.index.entry get]
2254 lappend queryInfoTmp [list $newI {}]
2255 $w.top.index.list insert end $newI
2256 destroy .query-add-index
2257 #destroy $w.top.lines
2258 #frame $w.top.lines -relief ridge -border 2
2259 index-lines $w.top.lines 0 $queryButtonsTmp $queryInfoTmp activate-e-index
2260 #pack $w.top.lines -side left -pady 6 -padx 6 -fill y
2263 proc query-add-line {queryNo} {
2267 global queryButtonsTmp
2269 lappend queryButtonsTmp {I 0}
2271 #destroy $w.top.lines
2272 #frame $w.top.lines -relief ridge -border 2
2273 index-lines $w.top.lines 0 $queryButtonsTmp $queryInfoTmp activate-e-index
2274 #pack $w.top.lines -side left -pady 6 -padx 6 -fill y
2277 proc query-del-line {queryNo} {
2281 global queryButtonsTmp
2283 set l [llength $queryButtonsTmp]
2288 set queryButtonsTmp [lreplace $queryButtonsTmp $l $l]
2289 index-lines $w.top.lines 0 $queryButtonsTmp $queryInfoTmp activate-e-index
2292 proc query-add-index {queryNo} {
2293 set w .query-add-index
2296 set oldFocus [focus]
2297 place-force $w .query-setup
2301 -side top -anchor e -pady 2
2302 entry-fields $w.top {index} \
2304 [list query-add-index-action $queryNo] [list destroy $w]
2305 top-down-ok-cancel $w [list query-add-index-action $queryNo] 1
2309 proc query-setup-action {queryNo} {
2312 global queryButtonsTmp
2314 global queryButtonsFind
2315 global queryInfoFind
2317 global settingsChanged
2319 set settingsChanged 1
2321 set queryInfo [lreplace $queryInfo $queryNo $queryNo \
2323 set queryButtons [lreplace $queryButtons $queryNo $queryNo \
2325 set queryInfoFind $queryInfoTmp
2326 set queryButtonsFind $queryButtonsTmp
2328 destroy .query-setup
2329 index-lines .lines 1 $queryButtonsFind $queryInfoFind activate-index
2332 proc activate-e-index {value no i} {
2333 global queryButtonsTmp
2334 global queryIndexTmp
2336 set queryButtonsTmp [lreplace $queryButtonsTmp $no $no [list I $i]]
2337 dputs $queryButtonsTmp
2338 set queryIndexTmp $i
2341 proc activate-index {value no i} {
2342 global queryButtonsFind
2344 set queryButtonsFind [lreplace $queryButtonsFind $no $no [list I $i]]
2346 dputs "queryButtonsFind $queryButtonsFind"
2349 proc update-attr {} {
2351 listbuttonv $w.top.relation.b relationTmpValue\
2352 {{None} 0 {Less than} 1 {Greater than or equal} 2 {Equal} 3 \
2353 {Greater than or equal} 4 {Greater than} 5 {Not equal} 6 \
2354 {Phonetic} 100 {Stem} 101 {Relevance} 102 {AlwaysMatches} 103}
2355 listbuttonv $w.top.position.b positionTmpValue {{None} 0 \
2356 {First in field} 1 {First in subfield} 2 {Any position in field} 3}
2357 listbuttonv $w.top.structure.b structureTmpValue {{None} 0 {Phrase} 1 \
2358 {Word} 2 {Key} 3 {Year} 4 {Date (norm)} 5 {Word list} 6 \
2359 {Date (un-norm)} 100 {Name (norm)} 101 {Date (un-norm)} 102 \
2360 {Structure} 103 {urx} 104 {free-form} 105 {doc-text} 106 \
2361 {local-number} 107 {string} 108 {numeric string} 109}
2362 listbuttonv $w.top.truncation.b truncationTmpValue {{Auto} 0 {Right} 1 \
2363 {Left} 2 {Left and right} 3 {No truncation} 100 \
2364 {Process #} 101 {Re-1} 102 {Re-2} 103}
2365 listbuttonv $w.top.completeness.b completenessTmpValue {{None} 0 \
2366 {Incomplete subfield} 1 {Complete subfield} 2 {Complete field} 3}
2369 proc use-attr {init} {
2381 {BNB card number} 10
2382 {BGF(sic) number} 11
2384 {Dewey classification} 13
2385 {UDC classification} 14
2386 {Bliss classification} 15
2388 {NLM call number} 17
2389 {NAL call number} 18
2390 {MOS call number} 19
2391 {Local classification} 20
2392 {Subject heading} 21
2394 {BDI-index-subject} 23
2398 {LC-subject-heading} 27
2399 {RVM-subject-heading} 28
2400 {Local subject index} 29
2402 {Date of publication} 31
2403 {Date of acquisition} 32
2405 {Title-collective} 34
2408 {Title-added-title-page} 37
2412 {Title-other-variant} 41
2414 {Title-abbreviated} 43
2418 {Subject-subdivision} 47
2419 {Number-natl-bibliography} 48
2420 {Number-legal-deposit} 49
2421 {Number-govt-publication} 50
2422 {Number-publisher-for-music} 51
2424 {Number-local-call} 53
2426 {Code-geographic-area} 55
2427 {Code-institution} 56
2429 {Name-geographic} 58
2430 {Place-publication} 59
2432 {Microform-generation} 61
2439 {Author-name-personal} 1004
2440 {Author-name-corporate} 1005
2441 {Author-name-conference} 1006
2442 {Identifier-standard} 1007
2443 {Subject-LC-children's} 1008
2444 {Subject-name-personal} 1009
2446 {Date/time added to database} 1011
2447 {Date/time last modified} 1012
2448 {Authority/format identifier} 1013
2450 {Concept-reference} 1015
2452 {Server choice} 1017
2454 {Record source} 1019
2457 {Geographic class} 1022
2461 {Related periodical} 1026
2462 {Report number} 1027
2464 {Thematic number} 1030
2465 {Material type} 1031
2473 set l [llength $attr]
2478 for {set i 0} {$i < $l} {incr i} {
2479 $w.top.use.list insert end [lindex $attr $i]
2481 if {$useTmpValue == [lindex $attr $i]} {
2487 $w.top.use.list selection clear 0 end
2488 $w.top.use.list selection set $s $s
2490 $w.top.use.list select from $s
2491 $w.top.use.list select to $s
2497 $w.top.use.list yview $s
2499 set lno [lindex [$w.top.use.list curselection] 0]
2500 set i [expr $lno+$lno+1]
2501 set useTmpValue [lindex $attr $i]
2502 dputs "useTmpValue=$useTmpValue"
2506 proc index-setup-action {oldAttr queryNo indexNo} {
2507 set attr [lindex $oldAttr 0]
2510 global relationTmpValue
2511 global structureTmpValue
2512 global truncationTmpValue
2513 global completenessTmpValue
2514 global positionTmpValue
2519 dputs "index-setup-action"
2520 dputs "queryNo $queryNo"
2521 dputs "indexNo $indexNo"
2522 if {$useTmpValue > 0} {
2523 lappend attr "1=$useTmpValue"
2525 if {$relationTmpValue > 0} {
2526 lappend attr "2=$relationTmpValue"
2528 if {$positionTmpValue > 0} {
2529 lappend attr "3=$positionTmpValue"
2531 if {$structureTmpValue > 0} {
2532 lappend attr "4=$structureTmpValue"
2534 if {$truncationTmpValue > 0} {
2535 lappend attr "5=$truncationTmpValue"
2537 if {$completenessTmpValue > 0} {
2538 lappend attr "6=$completenessTmpValue"
2540 dputs "new attr $attr"
2541 set queryInfoTmp [lreplace $queryInfoTmp $indexNo $indexNo $attr]
2542 destroy .index-setup
2545 proc index-setup {attr queryNo indexNo} {
2548 global relationTmpValue
2549 global structureTmpValue
2550 global truncationTmpValue
2551 global completenessTmpValue
2552 global positionTmpValue
2554 set relationTmpValue 0
2555 set truncationTmpValue 0
2556 set structureTmpValue 0
2557 set positionTmpValue 0
2558 set completenessTmpValue 0
2561 set len [llength $attr]
2562 for {set i 1} {$i < $len} {incr i} {
2563 set q [lindex $attr $i]
2564 set l [string first = $q]
2566 set t [string range $q 0 [expr $l - 1]]
2567 set v [string range $q [expr $l + 1] end]
2570 { set useTmpValue $v }
2572 { set relationTmpValue $v }
2574 { set positionTmpValue $v }
2576 { set structureTmpValue $v }
2578 { set truncationTmpValue $v }
2580 { set completenessTmpValue $v }
2584 if {[winfo exists $w]} {
2589 set n [lindex $attr 0]
2590 wm title $w "Index setup $n"
2594 frame $w.top.use -relief ridge -border 2
2595 frame $w.top.relation -relief ridge -border 2
2596 frame $w.top.position -relief ridge -border 2
2597 frame $w.top.structure -relief ridge -border 2
2598 frame $w.top.truncation -relief ridge -border 2
2599 frame $w.top.completeness -relief ridge -border 2
2605 pack $w.top.use -side left -pady 6 -padx 6 -fill y
2607 label $w.top.use.label -text "Use"
2609 listbox $w.top.use.list -width 26 \
2610 -yscrollcommand "$w.top.use.scroll set"
2612 listbox $w.top.use.list -geometry 26x10 \
2613 -yscrollcommand "$w.top.use.scroll set"
2615 scrollbar $w.top.use.scroll -orient vertical -border 1
2616 pack $w.top.use.label -side top -fill x \
2618 pack $w.top.use.list -side left -fill both -expand yes \
2620 pack $w.top.use.scroll -side right -fill y \
2622 $w.top.use.scroll config -command "$w.top.use.list yview"
2626 # Relation Attributes
2628 pack $w.top.relation -pady 6 -padx 6 -side top
2629 label $w.top.relation.label -text "Relation" -width 18
2631 pack $w.top.relation.label $w.top.relation.b -fill x
2633 # Position Attributes
2635 pack $w.top.position -pady 6 -padx 6 -side top
2636 label $w.top.position.label -text "Position" -width 18
2638 pack $w.top.position.label $w.top.position.b -fill x
2640 # Structure Attributes
2642 pack $w.top.structure -pady 6 -padx 6 -side top
2643 label $w.top.structure.label -text "Structure" -width 18
2645 pack $w.top.structure.label $w.top.structure.b -fill x
2647 # Truncation Attributes
2649 pack $w.top.truncation -pady 6 -padx 6 -side top
2650 label $w.top.truncation.label -text "Truncation" -width 18
2652 pack $w.top.truncation.label $w.top.truncation.b -fill x
2654 # Completeness Attributes
2656 pack $w.top.completeness -pady 6 -padx 6 -side top
2657 label $w.top.completeness.label -text "Completeness" -width 18
2659 pack $w.top.completeness.label $w.top.completeness.b -fill x
2662 bottom-buttons $w [list \
2663 {Ok} [list index-setup-action $attr $queryNo $indexNo] \
2664 {Cancel} [list destroy $w]] 0
2668 proc query-edit-index {queryNo} {
2672 set i [lindex [$w.top.index.list curselection] 0]
2676 set attr [lindex $queryInfoTmp $i]
2677 dputs "Editing no $i $attr"
2678 index-setup $attr $queryNo $i
2681 proc query-delete-index {queryNo} {
2683 global queryButtonsTmp
2686 set i [lindex [$w.top.index.list curselection] 0]
2690 set queryInfoTmp [lreplace $queryInfoTmp $i $i]
2691 index-lines $w.top.lines 0 $queryButtonsTmp $queryInfoTmp activate-e-index
2692 $w.top.index.list delete $i
2695 proc query-setup {queryNo} {
2701 global queryButtonsTmp
2703 global queryIndexTmp
2706 set queryName [lindex $queryTypes $queryNo]
2707 set queryInfoTmp [lindex $queryInfo $queryNo]
2708 set queryButtonsTmp [lindex $queryButtons $queryNo]
2713 wm title $w "Query setup $queryName"
2717 frame $w.top.lines -relief ridge -border 2
2719 pack $w.top.lines -side left -pady 6 -padx 6 -fill y
2723 index-lines $w.top.lines 0 $queryButtonsTmp $queryInfoTmp activate-e-index
2725 button $w.top.lines.add -text "Add" \
2726 -command [list query-add-line $queryNo]
2727 button $w.top.lines.del -text "Remove" \
2728 -command [list query-del-line $queryNo]
2730 pack $w.top.lines.del -fill x -side bottom
2731 pack $w.top.lines.add -fill x -pady 10 -side bottom
2735 frame $w.top.index -relief ridge -border 2
2736 pack $w.top.index -pady 6 -padx 6 -side right -fill y
2738 listbox $w.top.index.list -yscrollcommand [list $w.top.index.scroll set]
2739 scrollbar $w.top.index.scroll -orient vertical -border 1 \
2740 -command [list $w.top.index.list yview]
2741 bind $w.top.index.list <2> [list query-edit-index $queryNo]
2743 pack $w.top.index.list -side left -fill both -expand yes -padx 2 -pady 2
2744 pack $w.top.index.scroll -side right -fill y -padx 2 -pady 2
2747 $w.top.index.list selection clear 0 end
2748 $w.top.index.list selection set 0 0
2750 $w.top.index.list select from 0
2751 $w.top.index.list select to 0
2754 foreach x $queryInfoTmp {
2755 $w.top.index.list insert end [lindex $x 0]
2758 bottom-buttons $w [list \
2759 {Ok} [list query-setup-action $queryNo] \
2760 {Add index} [list query-add-index $queryNo] \
2761 {Edit index} [list query-edit-index $queryNo] \
2762 {Delete index} [list query-delete-index $queryNo] \
2763 {Cancel} [list destroy $w]] 0
2766 proc index-clear {} {
2767 global queryButtonsFind
2770 foreach b $queryButtonsFind {
2771 .lines.$i.e delete 0 end
2776 proc index-query {} {
2777 global queryButtonsFind
2778 global queryInfoFind
2783 foreach b $queryButtonsFind {
2784 set term [string trim [.lines.$i.e get]]
2786 set attr [lrange [lindex $queryInfoFind [lindex $b 1]] 1 end]
2788 set len [string length $term]
2792 if {[string index $term $len] == "?"} {
2794 set term [string range $term 0 [expr $len - 1]]
2796 if {[string index $term 0] == "?"} {
2798 set term [string range $term 1 end]
2800 set term "\{${term}\}"
2801 if {$right && $left} {
2802 set term "@attr 5=3 ${term}"
2804 set term "@attr 5=1 ${term}"
2806 set term "@attr 5=2 ${term}"
2809 set term "@attr $a ${term}"
2812 set qs "@and ${qs} ${term}"
2823 proc index-focus-in {w i} {
2824 global curIndexEntry
2827 $w.$i configure -background red
2829 set curIndexEntry $i
2832 proc index-lines {w realOp buttonInfo queryInfo handle} {
2834 foreach b $buttonInfo {
2835 if {! [winfo exists $w.$i]} {
2837 frame $w.$i -border 0
2839 frame $w.$i -background white -border 1
2842 listbuttonx $w.$i.l [lindex $b 1] $queryInfo $handle $i
2845 if {! [winfo exists $w.$i.e]} {
2846 entry $w.$i.e -width 32 -relief sunken -border 1
2847 bind $w.$i.e <FocusIn> [list index-focus-in $w $i]
2848 bind $w.$i.e <FocusOut> [list $w.$i configure \
2850 pack $w.$i.l -side left
2851 pack $w.$i.e -side left -fill x -expand yes
2852 pack $w.$i -side top -fill x -padx 2 -pady 2
2854 bind $w.$i.e <Left> [list left-cursor $w.$i.e]
2855 bind $w.$i.e <Right> [list right-cursor $w.$i.e]
2857 bind $w.$i.e <Return> {search-request 0}
2860 pack $w.$i.l -side left
2861 pack $w.$i -side top -fill x -padx 2 -pady 2
2866 while {[winfo exists $w.$j]} {
2878 bind $w.$j.e <Tab> "focus $w.$k.e"
2884 bind $w.$i.e <Tab> "focus $w.0.e"
2890 proc search-fields {w buttondefs} {
2892 foreach buttondef $buttondefs {
2893 frame $w.$i -background white
2895 listbutton $w.$i.l 0 $buttondef
2896 entry $w.$i.e -width 32 -relief sunken
2898 pack $w.$i.l -side left
2899 pack $w.$i.e -side left -fill x -expand yes
2901 pack $w.$i -side top -fill x -padx 2 -pady 2
2903 bind $w.$i.e <Left> [list left-cursor $w.$i.e]
2904 bind $w.$i.e <Right> [list right-cursor $w.$i.e]
2912 bind $w.$j.e <Tab> "focus $w.$k.e \n
2913 $w.$k configure -background red \n
2914 $w.$j configure -background white"
2917 bind $w.$i.e <Tab> "focus $w.0.e \n
2918 $w.0 configure -background red \n
2919 $w.$i configure -background white"
2921 $w.0 configure -background red
2924 if {[info exists windowGeometry(.)]} {
2925 set g $windowGeometry(.)
2933 frame .top -border 1 -relief raised
2934 frame .lines -border 1 -relief raised
2935 frame .mid -border 1 -relief raised
2936 frame .data -border 1 -relief raised
2937 frame .bot -border 1 -relief raised
2938 pack .top .lines .mid -side top -fill x
2939 pack .data -side top -fill both -expand yes
2942 menubutton .top.file -text "File" -menu .top.file.m
2944 .top.file.m add command -label "Save settings" -command {save-settings}
2945 .top.file.m add separator
2946 .top.file.m add command -label "Exit" -command {exit-action}
2948 menubutton .top.target -text "Target" -menu .top.target.m
2950 .top.target.m add cascade -label "Connect" -menu .top.target.m.clist
2951 .top.target.m add command -label "Disconnect" -command {close-target}
2952 .top.target.m add command -label "About" -command {about-target}
2953 .top.target.m add cascade -label "Setup" -menu .top.target.m.slist
2954 .top.target.m add command -label "Setup new" -command {define-target-dialog}
2955 .top.target.m add separator
2956 set-target-hotlist 0
2958 configure-disable-e .top.target.m 1
2959 configure-disable-e .top.target.m 2
2961 menu .top.target.m.clist
2962 menu .top.target.m.slist
2965 menubutton .top.service -text "Service" -menu .top.service.m
2967 .top.service.m add command -label "Database" -command {database-select}
2968 .top.service.m add cascade -label "Present" -menu .top.service.m.present
2969 menu .top.service.m.present
2970 .top.service.m.present add command -label "10 More" \
2971 -command [list present-more 10]
2972 .top.service.m.present add command -label "All" \
2973 -command [list present-more {}]
2974 .top.service.m add command -label "Search" -command {search-request 0}
2975 .top.service.m add command -label "Scan" -command {scan-request}
2977 .top.service configure -state disabled
2979 menubutton .top.rset -text "Set" -menu .top.rset.m
2981 .top.rset.m add command -label "Load" -command {load-set}
2982 .top.rset.m add separator
2984 menubutton .top.options -text "Options" -menu .top.options.m
2986 .top.options.m add cascade -label "Query" -menu .top.options.m.query
2987 .top.options.m add cascade -label "Format" -menu .top.options.m.formats
2988 .top.options.m add cascade -label "Wrap" -menu .top.options.m.wrap
2989 .top.options.m add cascade -label "Syntax" -menu .top.options.m.syntax
2991 menu .top.options.m.query
2992 .top.options.m.query add cascade -label "Select" \
2993 -menu .top.options.m.query.clist
2994 .top.options.m.query add cascade -label "Edit" \
2995 -menu .top.options.m.query.slist
2996 .top.options.m.query add command -label "New" \
2997 -command {query-new}
2998 .top.options.m.query add cascade -label "Delete" \
2999 -menu .top.options.m.query.dlist
3001 menu .top.options.m.query.slist
3002 menu .top.options.m.query.clist
3003 menu .top.options.m.query.dlist
3006 menu .top.options.m.formats
3008 foreach f $displayFormats {
3009 .top.options.m.formats add radiobutton -label $f -value $i \
3010 -command [list set-display-format $i] -variable displayFormat
3014 menu .top.options.m.wrap
3015 .top.options.m.wrap add radiobutton -label "Character" \
3016 -value char -variable textWrap -command {set-wrap char}
3017 .top.options.m.wrap add radiobutton -label "Word" \
3018 -value word -variable textWrap -command {set-wrap word}
3019 .top.options.m.wrap add radiobutton -label "None" \
3020 -value none -variable textWrap -command {set-wrap none}
3022 menu .top.options.m.syntax
3023 .top.options.m.syntax add radiobutton -label "None" \
3024 -value None -variable recordSyntax
3025 .top.options.m.syntax add separator
3026 .top.options.m.syntax add radiobutton -label "USMARC" \
3027 -value USMARC -variable recordSyntax
3028 .top.options.m.syntax add radiobutton -label "UNIMARC" \
3029 -value UNIMARC -variable recordSyntax
3030 .top.options.m.syntax add radiobutton -label "UKMARC" \
3031 -value UKMARC -variable recordSyntax
3032 .top.options.m.syntax add radiobutton -label "DANMARC" \
3033 -value DANMARC -variable recordSyntax
3034 .top.options.m.syntax add radiobutton -label "FINMARC" \
3035 -value FINMARC -variable recordSyntax
3036 .top.options.m.syntax add radiobutton -label "NORMARC" \
3037 -value NORMARC -variable recordSyntax
3038 .top.options.m.syntax add radiobutton -label "PICAMARC" \
3039 -value PICAMARC -variable recordSyntax
3040 .top.options.m.syntax add separator
3041 .top.options.m.syntax add radiobutton -label "SUTRS" \
3042 -value SUTRS -variable recordSyntax
3043 .top.options.m.syntax add separator
3044 .top.options.m.syntax add radiobutton -label "GRS1" \
3045 -value GRS1 -variable recordSyntax
3047 menubutton .top.help -text "Help" -menu .top.help.m
3050 .top.help.m add command -label "Help on help" \
3051 -command {tkerror "Help on help not available. Sorry"}
3052 .top.help.m add command -label "About" -command {about-origin}
3054 pack .top.file .top.target .top.service .top.rset .top.options -side left
3055 pack .top.help -side right
3057 index-lines .lines 1 $queryButtonsFind [lindex $queryInfo 0] activate-index
3059 button .mid.search -width 7 -text {Search} -command {search-request 0} \
3061 button .mid.scan -width 7 -text {Scan} \
3062 -command scan-request -state disabled
3063 button .mid.present -width 7 -text {Present} -command [list present-more 10] \
3066 button .mid.clear -width 7 -text {Clear} -command index-clear
3067 pack .mid.search .mid.scan .mid.present .mid.clear -side left \
3068 -fill y -padx 4 -pady 2
3070 text .data.record -height 2 -width 20 -wrap none \
3071 -yscrollcommand [list .data.scroll set] -wrap $textWrap
3072 scrollbar .data.scroll -command [list .data.record yview]
3074 .data.record configure -takefocus 0
3075 .data.scroll configure -takefocus 0
3077 pack .data.scroll -side right -fill y
3078 pack .data.record -expand yes -fill both
3082 .data.record tag configure marc-tag -foreground blue
3083 .data.record tag configure marc-id -foreground red
3085 .data.record tag configure marc-tag -foreground black
3086 .data.record tag configure marc-id -foreground black
3088 .data.record tag configure marc-data -foreground black
3090 button .bot.logo -bitmap @${libdir}/bitmaps/book1 -command cancel-operation
3092 .bot.logo configure -takefocus 0
3095 pack .bot.a -side left -fill x
3096 pack .bot.logo -side right -padx 2 -pady 2 -ipadx 1
3098 message .bot.a.target -text "" -aspect 1000 -border 1
3100 label .bot.a.status -text "Not connected" -width 15 -relief \
3101 sunken -anchor w -border 1
3102 label .bot.a.set -text "" -width 5 -relief \
3103 sunken -anchor w -border 1
3104 label .bot.a.message -text "" -width 15 -relief \
3105 sunken -anchor w -border 1
3107 pack .bot.a.target -side top -anchor nw -padx 2 -pady 2
3108 pack .bot.a.status .bot.a.set .bot.a.message \
3109 -side left -padx 2 -pady 2 -ipadx 1 -ipady 1