1 # IR toolkit for tcl/tk
3 # See the file LICENSE for details.
4 # Sebastian Hammer, Adam Dickmeiss
7 # Revision 1.65 1995-08-24 15:39:09 adam
10 # Revision 1.64 1995/08/24 15:33:02 adam
13 # Revision 1.63 1995/08/04 13:20:48 adam
14 # Buttons at the bottom are slightly smaller.
16 # Revision 1.62 1995/08/04 11:32:37 adam
17 # More work on output queue. Memory related routines moved
20 # Revision 1.61 1995/07/20 08:09:39 adam
21 # client.tcl: Targets removed from hotTargets list when targets
22 # are removed/modified.
23 # ir-tcl.c: More work on triggerResourceControl.
25 # Revision 1.60 1995/06/30 16:30:19 adam
28 # Revision 1.59 1995/06/29 14:06:25 adam
29 # Another bug in install fixed. Configure searches for more versions of yaz.
31 # Revision 1.58 1995/06/29 12:34:06 adam
32 # IrTcl now works with both tk4.0b4/tcl7.4b4 and tk3.6/tcl7.3
34 # Revision 1.57 1995/06/29 09:20:30 adam
35 # Target entries in cascade menus are sorted.
37 # Revision 1.56 1995/06/27 19:03:48 adam
38 # Bug fix in do_present in ir-tcl.c: p->set_child member weren't set.
39 # nextResultSetPosition used instead of setOffset.
41 # Revision 1.55 1995/06/27 17:10:37 adam
42 # Bug fix: install procedure didn't work on some systems.
43 # Error turned up when clientrc.tcl was't present.
45 # Revision 1.54 1995/06/27 14:41:03 adam
46 # Bug fix in search-response. Didn't always observe non-surrogate diagnostics.
48 # Revision 1.53 1995/06/26 12:40:09 adam
49 # Client defines its own tkerror.
50 # User may specify 'no preferredRecordSyntax'.
52 # Revision 1.52 1995/06/22 13:14:59 adam
53 # Feature: SUTRS. Setting getSutrs implemented.
54 # Work on display formats.
55 # Preferred record syntax can be set by the user.
57 # Revision 1.51 1995/06/21 11:11:00 adam
58 # Bug fix: libdir undefined in about-origin.
60 # Revision 1.50 1995/06/21 11:04:48 adam
61 # Uses GNU autoconf 2.3.
62 # Install procedure implemented.
63 # boook bitmaps moved to sub directory bitmaps.
65 # Revision 1.49 1995/06/20 14:16:42 adam
66 # More work on cancel mechanism.
68 # Revision 1.48 1995/06/20 08:07:23 adam
69 # New setting: failInfo.
70 # Working on better cancel mechanism.
72 # Revision 1.47 1995/06/19 14:05:29 adam
73 # Bug fix: asked for SUTRS.
75 # Revision 1.46 1995/06/19 13:06:06 adam
76 # New define: IR_TCL_VERSION.
78 # Revision 1.45 1995/06/19 08:08:44 adam
79 # client.tcl: hotTargets now contain both database and target name.
80 # ir-tcl.c: setting protocol edited. Errors in callbacks are logged
81 # by logf(LOG_WARN, ...) calls.
83 # Revision 1.44 1995/06/16 14:55:18 adam
86 # Revision 1.43 1995/06/16 14:41:05 adam
87 # Scan line entries can be copied to a search entry.
89 # Revision 1.42 1995/06/16 12:28:13 adam
90 # Implemented preferredRecordSyntax.
91 # Minor changes in diagnostic handling.
92 # Record list deleted when connection closes.
94 # Revision 1.41 1995/06/14 15:07:59 adam
95 # Bug fix in cascade-target-list. Uses yaz-version.h.
97 # Revision 1.40 1995/06/14 13:37:17 adam
98 # Setting recordType implemented.
99 # Setting implementationVersion implemented.
100 # Settings implementationId / implementationName edited.
102 # Revision 1.39 1995/06/14 12:16:22 adam
103 # hotTargets, textWrap and displayFormat saved in clientg.tcl.
105 # Revision 1.38 1995/06/14 07:22:45 adam
106 # Target definitions can be deleted.
107 # Listbox used in the query definition dialog.
109 # Revision 1.37 1995/06/13 14:37:59 adam
110 # Work on query setup.
111 # Better about origin/target.
112 # Better presentation formats.
114 # Revision 1.36 1995/06/13 07:42:14 adam
115 # Bindings removed from text widgets.
117 # Revision 1.35 1995/06/12 15:17:31 adam
118 # Text widget used in main window (instead of listbox) to support
119 # better presentation formats.
121 # Revision 1.34 1995/06/12 07:59:07 adam
122 # More work on geometry handling.
124 # Revision 1.33 1995/06/09 11:17:35 adam
125 # Start work on geometry management.
127 # Revision 1.32 1995/06/07 09:16:37 adam
128 # New presentation format.
130 # Revision 1.31 1995/06/06 16:31:09 adam
131 # Bug fix: target names couldn't contain blanks.
134 # Revision 1.30 1995/06/06 11:35:41 adam
135 # Work on scan. Display of old sets.
137 # Revision 1.29 1995/06/05 14:11:18 adam
138 # Bug fix in present-more.
140 # Revision 1.28 1995/06/02 14:52:13 adam
141 # Minor changes really.
143 # Revision 1.27 1995/06/02 14:29:42 adam
144 # Work on scan interface - up/down buttons.
146 # Revision 1.26 1995/06/01 16:36:46 adam
147 # About buttons. Minor bug fixes.
149 # Revision 1.25 1995/05/31 13:09:57 adam
150 # Client searches/presents may be interrupted.
151 # New moving book-logo.
153 # Revision 1.24 1995/05/31 08:36:24 adam
154 # Bug fix in client.tcl: didn't save options on clientrc.tcl.
155 # New method: referenceId. More work on scan.
157 # Revision 1.23 1995/05/29 10:33:41 adam
158 # README and rename of startup script.
160 # Revision 1.22 1995/05/26 11:44:09 adam
161 # Bugs fixed. More work on MARC utilities and queries. Test
162 # client is up-to-date again.
164 # Revision 1.21 1995/05/11 15:34:46 adam
165 # Scan request changed a bit. This version works with RLG.
167 # Revision 1.20 1995/04/21 16:31:57 adam
168 # New radiobutton: protocol (z39v2/SR).
170 # Revision 1.19 1995/04/18 16:11:50 adam
171 # First version of graphical Scan. Some work on query-by-form.
173 # Revision 1.18 1995/04/10 10:50:22 adam
174 # Result-set name defaults to suffix of ir-set name.
175 # Started working on scan. Not finished at this point.
177 # Revision 1.17 1995/03/31 09:34:57 adam
178 # Search-button disabled when there is no connection.
180 # Revision 1.16 1995/03/31 08:56:36 adam
181 # New button "Search".
183 # Revision 1.15 1995/03/28 12:45:22 adam
184 # New ir method failback: called on disconnect/protocol error.
185 # New ir set/get method: protocol: SR / Z3950.
186 # Simple popup and disconnect when failback is invoked.
188 # Revision 1.14 1995/03/22 16:07:55 adam
191 # Revision 1.13 1995/03/21 17:27:26 adam
192 # Short-hand keys in setup.
194 # Revision 1.12 1995/03/21 13:41:03 adam
195 # Comstack cs_create not used too often. Non-blocking connect.
197 # Revision 1.11 1995/03/21 10:39:06 adam
198 # Diagnostic error message displayed with tkerror.
200 # Revision 1.10 1995/03/20 15:24:06 adam
201 # Diagnostic records saved on searchResponse.
203 # Revision 1.9 1995/03/17 18:26:16 adam
204 # Non-blocking i/o used now. Database names popup as cascade items.
206 # Revision 1.8 1995/03/17 15:45:00 adam
207 # Improved target/database setup.
209 # Revision 1.7 1995/03/16 17:54:03 adam
210 # Minor changes really.
212 # Revision 1.6 1995/03/15 19:10:20 adam
213 # Database setup in protocol-setup (rather target setup).
215 # Revision 1.5 1995/03/15 13:59:23 adam
218 # Revision 1.4 1995/03/14 17:32:29 adam
219 # Presentation of full Marc record in popup window.
221 # Revision 1.3 1995/03/12 19:31:52 adam
222 # Pattern matching implemented when retrieving MARC records. More
223 # diagnostic functions.
225 # Revision 1.2 1995/03/10 18:00:15 adam
226 # Actual presentation in line-by-line format. RPN query support.
228 # Revision 1.1 1995/03/09 16:15:07 adam
229 # First presentRequest attempts. Hot-target list.
233 if {$tk_version == "3.6"} {
244 proc configure-enable-e {w n} {
246 $w entryconfigure $n -state normal
248 proc configure-disable-e {w n} {
250 $w entryconfigure $n -state disabled
252 set noFocus [list -takefocus 0]
254 proc configure-enable-e {w n} {
257 proc configure-disable-e {w n} {
264 if {[tk colormodel .] == "color"} {
274 if {[file readable bitmaps/book2]} {
277 if {! [file readable ${libdir}/bitmaps/book2]} {
278 puts "Cannot locate system files in ${libdir}. You must either run this"
279 puts "program from the source directory root of ir-tcl or you must assure"
280 puts "that it is installed - normally in /usr/local/lib/irtcl"
288 set profile(Default) {{} {} {210} {} 16384 8192 tcpip {} 1 {} {} Z39 1}
290 set settingsChanged 0
299 set recordSyntax None
302 set queryTypes {Simple}
303 set queryButtons { { {I 0} {I 1} {I 2} } }
304 set queryInfo { { {Title {1=4 4=1}} {Author {1=1}} \
305 {Subject {1=21}} {Any {1=1016}} } }
314 if {[winfo exists $w]} {
323 label $w.top.b -bitmap error
324 message $w.top.t -aspect 300 -text "Error: $err" \
325 -font -Adobe-Helvetica-Bold-R-Normal-*-180-*
326 pack $w.top.b $w.top.t -side left -padx 10 -pady 10
328 bottom-buttons $w [list {Close} [list destroy $w]] 1
331 proc read-formats {} {
332 global displayFormats
334 set formats [glob -nocomplain ${libdir}/formats/*.tcl]
336 if {[file readable $f]} {
338 set l [string length $f]
339 set f [string range $f [string length "${libdir}/formats/"] \
341 lappend displayFormats $f
350 .data.record configure -wrap $m
356 proc set-display-format {f} {
366 .bot.a.status configure -text "Reformatting"
369 add-title-lines -1 10000 1
372 proc initBindings {} {
375 bind $w <Double-1> {}
376 bind $w <Triple-1> {}
377 bind $w <B1-Motion> {}
379 bind $w <Shift-B1-Motion> {}
381 bind $w <B2-Motion> {}
382 bind $w <Any-KeyPress> {}
384 bind $w <BackSpace> {}
386 bind $w <Control-h> {}
387 bind $w <Control-d> {}
388 bind $w <Control-v> {}
391 bind $w <B1-Motion> {}
392 bind $w <Shift-B1-Motion> {}
397 proc post-menu {wbutton wmenu} {
400 $wmenu post [winfo rootx $wbutton] \
401 [expr [winfo rooty $wbutton]+[winfo height $wbutton]]
406 global windowGeometry
407 set windowGeometry($w) [wm geometry $w]
410 global windowGeometry
413 if {[info exists windowGeometry($w)]} {
414 set g $windowGeometry($w)
419 bind $w <Destroy> [list destroyGW $w]
422 if {[file readable "clientrc.tcl"]} {
423 source "clientrc.tcl"
425 if {[file readable "${libdir}/clientrc.tcl"]} {
426 source "${libdir}/clientrc.tcl"
430 if {[file readable "~/.clientrc.tcl"]} {
431 source "~/.clientrc.tcl"
434 set queryButtonsFind [lindex $queryButtons 0]
435 set queryInfoFind [lindex $queryInfo 0]
437 proc top-down-window {w} {
438 frame $w.top -relief raised -border 1
439 frame $w.bot -relief raised -border 1
441 pack $w.top -side top -fill both -expand yes
442 pack $w.bot -fill both
445 proc top-down-ok-cancel {w ok-action g} {
446 frame $w.bot.left -relief sunken -border 1
447 pack $w.bot.left -side left -expand yes -ipadx 2 -ipady 2 -padx 4 -pady 4
448 button $w.bot.left.ok -width 5 -text {Ok} \
449 -command ${ok-action}
450 pack $w.bot.left.ok -expand yes -ipadx 2 -ipady 2 -padx 3 -pady 3
451 button $w.bot.cancel -width 6 -text {Cancel} \
452 -command [list destroy $w]
453 pack $w.bot.cancel -side left -expand yes
461 proc bottom-buttons {w buttonList g} {
463 set l [llength $buttonList]
465 frame $w.bot.$i -relief sunken -border 1
466 pack $w.bot.$i -side left -expand yes -padx 4 -pady 4
467 button $w.bot.$i.ok -text [lindex $buttonList $i] \
468 -command [lindex $buttonList [expr $i+1]]
469 pack $w.bot.$i.ok -expand yes -ipadx 2 -ipady 2 -padx 2 -pady 2 -side left
473 button $w.bot.$i -text [lindex $buttonList $i] \
474 -command [lindex $buttonList [expr $i+1]]
475 pack $w.bot.$i -expand yes -ipadx 2 -ipady 2 -padx 2 -pady 2 -side left
485 proc cancel-operation {} {
493 show-status Cancel 0 1
497 proc show-target {target base} {
501 .bot.a.target configure -text ""
505 .bot.a.target configure -text "$target"
507 .bot.a.target configure -text "$target - $base"
511 proc show-logo {v1} {
520 .bot.logo configure -bitmap @${libdir}/bitmaps/book${v1}
521 after 140 [list show-logo $v1]
525 .bot.logo configure -bitmap @${libdir}/bitmaps/book1
534 proc show-status {status b sb} {
541 .bot.a.status configure -text "$status"
543 if {$busy == 0} {set busy 1}
551 .top.service configure -state normal
552 .mid.search configure -state normal
554 .mid.scan configure -state normal
557 configure-disable-e .top.service.m 1
558 } elseif {[z39.$setNo nextResultSetPosition] > 0 &&
559 [z39.$setNo nextResultSetPosition] <= [z39.$setNo resultCount]} {
560 configure-enable-e .top.service.m 1
561 .mid.present configure -state normal
563 configure-disable-e .top.service.m 1
564 .mid.present configure -state disabled
566 if {[winfo exists .scan-window]} {
567 .scan-window.bot.2 configure -state normal
568 .scan-window.bot.4 configure -state normal
571 .top.service configure -state disabled
572 .mid.search configure -state disabled
573 .mid.scan configure -state disabled
574 .mid.present configure -state disabled
576 if {[winfo exists .scan-window]} {
577 .scan-window.bot.2 configure -state disabled
578 .scan-window.bot.4 configure -state disabled
583 proc show-message {msg} {
584 .bot.a.message configure -text "$msg"
587 proc insertWithTags {w text args} {
588 set start [$w index insert]
589 $w insert insert $text
590 foreach tag [$w tag names $start] {
591 $w tag remove $tag $start insert
594 $w tag add $i $start insert
598 proc popup-license {} {
603 wm title $w "License"
609 text $w.top.t -width 80 -height 10 -wrap word \
610 -yscrollcommand [list $w.top.s set]
611 scrollbar $w.top.s -command [list $w.top.t yview]
613 pack $w.top.s -side right -fill y
614 pack $w.top.t -expand yes -fill both
616 if {[file readable "${libdir}/LICENSE"]} {
617 set f [open "${libdir}/LICENSE" r]
618 while {[gets $f buf] != -1} {
619 $w.top.t insert end $buf
620 $w.top.t insert end "\n"
624 bottom-buttons $w [list {Close} [list destroy $w]] 1
627 proc about-target {} {
628 set w .about-target-w
633 wm title $w "About target"
637 frame $w.top.a -relief ridge -border 2
638 frame $w.top.p -relief ridge -border 2
640 pack $w.top.a $w.top.p -side top -fill x
642 label $w.top.a.about -text "About"
643 label $w.top.a.irtcl -text $hostid \
644 -font -Adobe-Helvetica-Bold-R-Normal-*-240-*
645 pack $w.top.a.about $w.top.a.irtcl -side top
647 set i [z39 targetImplementationName]
648 label $w.top.p.in -text "Implementation name: $i"
649 set i [z39 targetImplementationId]
650 label $w.top.p.ii -text "Implementation id: $i"
651 set i [z39 targetImplementationVersion]
652 label $w.top.p.iv -text "Implementation version: $i"
654 label $w.top.p.op -text "Protocol options: $i"
656 pack $w.top.p.in $w.top.p.ii $w.top.p.iv $w.top.p.op -side top -anchor nw
658 bottom-buttons $w [list {Close} [list destroy $w]] 1
661 proc about-origin-logo {n} {
663 set w .about-origin-w
664 if {![winfo exists $w]} {
671 $w.top.a.logo configure -bitmap @${libdir}/bitmaps/book$n
672 after 140 [list about-origin-logo $n]
675 proc about-origin {} {
676 set w .about-origin-w
679 if {[winfo exists $w]} {
684 wm title $w "About IrTcl"
688 frame $w.top.a -relief ridge -border 2
689 frame $w.top.p -relief ridge -border 2
691 pack $w.top.a $w.top.p -side top -fill x
693 label $w.top.a.irtcl -text "IrTcl" \
694 -font -Adobe-Helvetica-Bold-R-Normal-*-240-*
695 label $w.top.a.logo -bitmap @${libdir}/bitmaps/book1
696 pack $w.top.a.irtcl $w.top.a.logo -side left -expand yes
698 set i [z39 implementationName]
699 label $w.top.p.in -text "Implementation name: $i"
700 set i [z39 implementationId]
701 label $w.top.p.ii -text "Implementation id: $i"
702 set i [z39 implementationVersion]
703 label $w.top.p.iv -text "Implementation version: $i"
705 pack $w.top.p.in $w.top.p.ii $w.top.p.iv -side top -anchor nw
708 bottom-buttons $w [list {Close} [list destroy $w] \
709 {License} [list popup-license]] 0
712 proc popup-marc {sno no b df} {
714 global displayFormats
717 if {[z39.$sno type $no] != "DB"} {
721 set w .full-marc-$fullMarcSeq
728 if {[winfo exists $w]} {
736 frame $w.top -relief raised -border 1
737 frame $w.bot -relief raised -border 1
739 pack $w.top -side top -fill both -expand yes
740 pack $w.bot -fill both
742 text $w.top.record -width 60 -height 5 -wrap word \
743 -yscrollcommand [list $w.top.s set]
744 scrollbar $w.top.s -command [list $w.top.record yview]
748 $w.top.record tag configure marc-tag -foreground blue
749 $w.top.record tag configure marc-id -foreground red
751 $w.top.record tag configure marc-tag -foreground black
752 $w.top.record tag configure marc-id -foreground black
754 $w.top.record tag configure marc-data -foreground black
757 $w.top.record delete 0.0 end
758 set recordType [z39.$sno recordType $no]
759 wm title $w "$recordType record #$no"
762 bind $w.top.record <Return> {destroy .full-marc}
764 pack $w.top.s -side right -fill y
765 pack $w.top.record -expand yes -fill both
768 bottom-buttons $w [list \
769 {Close} [list destroy $w]] 0
771 bottom-buttons $w [list \
772 {Close} [list destroy $w] \
773 {Duplicate} [list popup-marc $sno $no 1 0]] 0
774 menubutton $w.bot.formats -text "Format" -menu $w.bot.formats.m
775 menu $w.bot.formats.m
777 foreach f $displayFormats {
778 $w.bot.formats.m add radiobutton -label $f \
779 -variable popupMarcdf -value $i \
780 -command [list display-$f $sno $no $w.top.record 0]
783 pack $w.bot.formats -expand yes -ipadx 2 -ipady 2 \
784 -padx 3 -pady 3 -side left
788 $w.bot.formats.m delete 0 last
789 foreach f $displayFormats {
790 $w.bot.formats.m add radiobutton -label $f \
791 -variable popupMarcdf -value $i \
792 -command [list display-$f $sno $no $w.top.record 0]
796 set ffunc [lindex $displayFormats $df]
797 set ffunc "display-$ffunc"
799 $ffunc $sno $no $w.top.record 0
802 proc update-target-hotlist {target base} {
805 set olen [llength $hotTargets]
807 foreach e $hotTargets {
808 if {$target == [lindex $e 0] && $base == [lindex $e 1]} {
809 set hotTargets [lreplace $hotTargets $i $i]
814 set hotTargets [linsert $hotTargets 0 [list $target $base]]
815 set-target-hotlist $olen
818 proc delete-target-hotlist {target} {
821 set olen [llength $hotTargets]
823 foreach e $hotTargets {
824 if {$target == [lindex $e 0]} {
825 set hotTargets [lreplace $hotTargets $i $i]
829 set-target-hotlist $olen
832 proc set-target-hotlist {olen} {
837 .top.target.m delete 7 [expr 7+$olen]
839 .top.target.m delete 6 [expr 6+$olen]
843 foreach e $hotTargets {
844 set target [lindex $e 0]
845 set base [lindex $e 1]
847 .top.target.m add command -label "$i $target" -command \
848 [list reopen-target $target {}]
850 .top.target.m add command -label "$i $target - $base" -command \
851 [list reopen-target $target $base]
860 proc reopen-target {target base} {
862 open-target $target $base
863 update-target-hotlist $target $base
866 proc define-target-action {} {
869 set target [.target-define.top.target.entry get]
873 foreach n [array names profile] {
879 set seq [lindex $profile(Default) 12]
881 set profile($target) $profile(Default)
882 set profile(Default) [lreplace $profile(Default) 12 12 [incr seq]]
884 protocol-setup $target
885 destroy .target-define
888 proc fail-response {target} {
889 set c [lindex [z39 failInfo] 0]
890 set m [lindex [z39 failInfo] 1]
895 proc connect-response {target base} {
896 dputs "connect-response"
897 show-target $target $base
901 proc open-target {target base} {
906 z39 comstack [lindex $profile($target) 6]
907 z39 protocol [lindex $profile($target) 11]
908 z39 idAuthentication [lindex $profile($target) 3]
909 z39 maximumRecordSize [lindex $profile($target) 4]
910 z39 preferredMessageSize [lindex $profile($target) 5]
911 dputs "maximumRecordSize="
912 dputs [z39 maximumRecordSize]
913 dputs "preferredMessageSize="
914 dputs [z39 preferredMessageSize]
915 show-status Connecting 1 0
917 z39 databaseNames [lindex [lindex $profile($target) 7] 0]
919 z39 databaseNames $base
921 z39 failback [list fail-response $target]
922 z39 callback [list connect-response $target $base]
925 z39 connect [lindex $profile($target) 1]:[lindex $profile($target) 2]
928 tkerror $errorMessage
929 show-status "Not connected" 0 {}
933 configure-disable-e .top.target.m 0
934 configure-enable-e .top.target.m 1
935 configure-enable-e .top.target.m 2
938 proc close-target {} {
947 .bot.a.set configure -text ""
951 show-status {Not connected} 0 0
954 configure-disable-e .top.target.m 1
955 configure-disable-e .top.target.m 2
957 .top.rset.m delete 2 last
959 .top.rset.m delete 1 last
961 .top.rset.m add separator
962 configure-enable-e .top.target.m 0
965 proc load-set-action {} {
969 ir-set z39.$setNoLast z39
971 set fname [.load-set.top.filename.entry get]
974 show-status Loading 1 {}
976 z39.$setNoLast loadFile $fname
978 set no [z39.$setNoLast numberOfRecordsReturned]
979 add-title-lines $setNoLast $no 1
981 set l [format "%-4d %7d" $setNoLast $no]
982 .top.rset.m add command -label $l \
983 -command [list add-title-lines $setNoLast 10000 1]
984 show-status Ready 0 {}
994 frame $w.top.filename
995 pack $w.top.filename -side top -anchor e -pady 2
997 entry-fields $w.top {filename} \
999 {load-set-action} {destroy .load-set}
1001 top-down-ok-cancel $w {load-set-action} 1
1005 proc init-request {} {
1012 z39 callback {init-response}
1013 show-status Initializing 1 {}
1014 set err [catch {z39 init} errorMessage]
1016 tkerror $errorMessage
1017 show-status Ready 0 {}
1021 proc init-response {} {
1029 if {![z39 initResult]} {
1030 show-status Ready 0 1
1031 set u [z39 userInformationField]
1033 tkerror "Connection rejected by target: $u"
1035 if {[lsearch [z39 options] scan] >= 0} {
1040 show-status Ready 0 1
1044 proc search-request {bflag} {
1056 dputs "search-request"
1058 if {!$bflag && $busy} {
1059 dputs "busy: search-request ignored"
1064 show-status Searching 1 0
1065 set delayRequest {search-request 1}
1070 set query [index-query]
1075 set setNo $setNoLast
1076 ir-set z39.$setNo z39
1078 if {[lindex $profile($target) 10] == 1} {
1079 z39.$setNo setName $setNo
1080 dputs "setName=${setNo}"
1082 z39.$setNo setName Default
1083 dputs "setName=Default"
1085 if {[lindex $profile($target) 8] == 1} {
1086 z39.$setNo queryType rpn
1088 if {[lindex $profile($target) 9] == 1} {
1089 z39.$setNo queryType ccl
1093 if {$recordSyntax == "None" } {
1094 z39.$setNo preferredRecordSyntax {}
1096 z39.$setNo preferredRecordSyntax $recordSyntax
1098 z39 callback {search-response}
1099 z39.$setNo search $query
1100 show-status Searching 1 0
1103 proc scan-copy {y entry} {
1105 set no [$w.top.list nearest $y]
1107 .lines.$entry.e delete 0 end
1108 .lines.$entry.e insert 0 [string range [$w.top.list get $no] 8 end]
1111 proc scan-request {} {
1118 global curIndexEntry
1119 global queryButtonsFind
1120 global queryInfoFind
1124 dputs "scan-request"
1127 show-status Scanning 1 0
1128 set delayRequest scan-request
1137 set b [lindex $queryButtonsFind $curIndexEntry]
1139 foreach a [lrange [lindex $queryInfoFind [lindex $b 1]] 1 end] {
1140 set attr "@attr $a $attr"
1142 set title [lindex [lindex $queryInfoFind [lindex $b 1]] 0]
1143 ir-scan z39.scan z39
1145 if {![winfo exists $w]} {
1152 entry $w.top.entry -relief sunken
1153 pack $w.top.entry -fill x -padx 4 -pady 2
1154 bind $w.top.entry <KeyRelease> [list scan-term-h $attr]
1155 listbox $w.top.list -yscrollcommand [list $w.top.scroll set] \
1157 scrollbar $w.top.scroll -orient vertical -border 1
1158 pack $w.top.list -side left -fill both -expand yes
1159 pack $w.top.scroll -side right -fill y
1160 $w.top.scroll config -command [list $w.top.list yview]
1162 bottom-buttons $w [list {Close} [list destroy $w] \
1163 {Up} [list scan-up $attr] \
1164 {Down} [list scan-down $attr]] 0
1165 bind $w.top.list <Up> [list scan-up $attr]
1166 bind $w.top.list <Down> [list scan-down $attr]
1169 bind $w.top.list <Double-Button-1> [list scan-copy %y $curIndexEntry]
1170 wm title $w "Scan $title"
1172 z39 callback [list scan-response $attr 0 35]
1173 z39.scan numberOfTermsRequested 5
1174 z39.scan preferredPositionInResponse 1
1175 z39.scan scan "${attr} 0"
1177 show-status Scanning 1 0
1180 proc scan-term-h {attr} {
1188 set nScanTerm [$w.top.entry get]
1189 if {$nScanTerm == $scanTerm} {
1192 set scanTerm $nScanTerm
1193 z39 callback [list scan-response $attr 0 35]
1194 z39.scan numberOfTermsRequested 5
1195 z39.scan preferredPositionInResponse 1
1196 dputs "${attr} \{${scanTerm}\}"
1197 if {$scanTerm == ""} {
1198 z39.scan scan "${attr} 0"
1200 z39.scan scan "${attr} \{${scanTerm}\}"
1202 show-status Scanning 1 0
1205 proc scan-response {attr start toget} {
1212 dputs "In scan-response"
1213 set m [z39.scan numberOfEntriesReturned]
1219 if {![winfo exists .scan-window]} {
1222 dputs "Handling cancel"
1223 if {$delayRequest != ""} {
1228 show-status Ready 0 1
1231 set nScanTerm [$w.top.entry get]
1232 if {$nScanTerm != $scanTerm} {
1233 z39 callback [list scan-response $attr 0 35]
1234 z39.scan numberOfTermsRequested 5
1235 z39.scan preferredPositionInResponse 1
1236 set scanTerm $nScanTerm
1237 dputs "${attr} \{${scanTerm}\}"
1238 if {$scanTerm == ""} {
1239 z39.scan scan "${attr} 0"
1241 z39.scan scan "${attr} \{${scanTerm}\}"
1243 show-status Scanning 1 0
1246 set status [z39.scan scanStatus]
1249 show-status Ready 0 1
1254 for {set i 0} {$i < $m} {incr i} {
1255 set term [lindex [z39.scan scanLine $i] 1]
1256 set nostr [format " %-6d" [lindex [z39.scan scanLine $i] 2]]
1257 $w.top.list insert $i "$nostr $term"
1260 $w.top.list yview $scanView
1262 $w.top.list delete $start end
1263 for {set i 0} {$i < $m} {incr i} {
1264 set term [lindex [z39.scan scanLine $i] 1]
1265 set nostr [format " %-6d" [lindex [z39.scan scanLine $i] 2]]
1266 $w.top.list insert end "$nostr $term"
1270 dputs "Handling cancel"
1272 if {$delayRequest != ""} {
1278 if {$toget > 0 && $m > 1 && $m < $toget} {
1279 set ntoget [expr $toget - $m + 1]
1280 dputs ntoget=$ntoget
1281 z39 callback [list scan-response $attr [expr $start + $m - 1] $ntoget]
1283 dputs "down continue: $q"
1285 z39.scan numberOfTermsRequested 10
1287 z39.scan numberOfTermsRequested $ntoget
1289 z39.scan preferredPositionInResponse 1
1290 dputs "${attr} \{$q\}"
1291 z39.scan scan "${attr} \{$q\}"
1294 if {$toget < 0 && $m > 1 && $m < [expr - $toget]} {
1295 set ntoget [expr - $toget - $m]
1296 dputs ntoget=$ntoget
1297 z39 callback [list scan-response $attr 0 -$ntoget]
1298 set q [string range [$w.top.list get 0] 8 end]
1299 dputs "up continue: $q"
1301 z39.scan numberOfTermsRequested 10
1302 z39.scan preferredPositionInResponse 11
1304 z39.scan numberOfTermsRequested $ntoget
1305 z39.scan preferredPositionInResponse [incr ntoget]
1307 dputs "${attr} \{$q\}"
1308 z39.scan scan "${attr} \{$q\}"
1311 show-status Ready 0 1
1314 proc scan-down {attr} {
1322 show-status {Scanning down} 1 0
1323 set delayRequest [list scan-down $attr]
1329 set scanView [expr $scanView + 5]
1330 set s [$w.top.list size]
1331 if {$scanView > $s} {
1332 z39 callback [list scan-response $attr [expr $s - 1] 25]
1333 set q [string range [$w.top.list get [expr $s - 1]] 8 end]
1335 z39.scan numberOfTermsRequested 10
1336 z39.scan preferredPositionInResponse 1
1337 show-status Scanning 1 0
1338 dputs "${attr} \{$q\}"
1339 z39.scan scan "${attr} \{$q\}"
1342 $w.top.list yview $scanView
1345 proc scan-up {attr} {
1353 show-status Scanning 1 0
1354 set delayRequest [list scan-up $attr]
1360 set scanView [expr $scanView - 5]
1361 if {$scanView < 0} {
1362 z39 callback [list scan-response $attr 0 -25]
1363 set q [string range [$w.top.list get 0] 8 end]
1365 z39.scan numberOfTermsRequested 10
1366 z39.scan preferredPositionInResponse 11
1367 show-status Scanning 1 0
1368 z39.scan scan "${attr} \{$q\}"
1371 $w.top.list yview $scanView
1374 proc search-response {} {
1382 dputs "In search-response"
1384 dputs "Handling cancel"
1386 if {$delayRequest != ""} {
1394 set setMax [z39.$setNo resultCount]
1395 show-status Ready 0 1
1396 set status [z39.$setNo responseStatus]
1397 if {[lindex $status 0] == "NSD"} {
1398 z39.$setNo nextResultSetPosition 0
1399 set code [lindex $status 1]
1400 set msg [lindex $status 2]
1401 set addinfo [lindex $status 3]
1402 tkerror "NSD$code: $msg: $addinfo"
1405 show-message "${setMax} hits"
1410 show-status Ready 0 1
1411 set l [format "%-4d %7d" $setNo $setMax]
1412 .top.rset.m add command -label $l \
1413 -command [list add-title-lines $setNo 10000 1]
1417 z39 callback {present-response}
1418 z39.$setNo present $setOffset 1
1419 show-status Retrieving 1 0
1422 proc present-more {number} {
1430 dputs "present-more"
1432 show-status Retrieving 1 0
1433 set delayRequest "present-more $number"
1439 dputs "setNo=$setNo"
1442 set setOffset [z39.$setNo nextResultSetPosition]
1443 dputs "setOffest=${setOffset}"
1444 dputs "setNo=${setNo}"
1445 set max [z39.$setNo resultCount]
1446 if {$max < $setOffset} {
1448 dputs "setOffset=$setOffset"
1449 show-status Ready 0 1
1452 if {$number == ""} {
1456 if {$setMax > $max} {
1460 z39 callback {present-response}
1462 set toGet [expr $setMax - $setOffset + 1]
1469 z39.$setNo present $setOffset $toGet
1470 show-status Retrieving 1 0
1473 proc init-title-lines {} {
1474 .data.record delete 0.0 end
1477 proc title-press {y setno} {
1478 show-full-marc $setno [expr 1 + [.data.list nearest $y]] 0
1481 proc add-title-lines {setno no offset} {
1482 global displayFormats
1483 global displayFormat
1493 .bot.a.set configure -text $setno
1494 .data.record delete 0.0 end
1496 set ffunc [lindex $displayFormats $displayFormat]
1497 dputs "ffunc=$ffunc"
1498 set ffunc "display-$ffunc"
1499 for {set i 0} {$i < $no} {incr i} {
1500 set o [expr $i + $offset]
1501 set type [z39.$setno type $o]
1505 .data.record tag bind r$o <Any-Enter> {}
1506 .data.record tag bind r$o <Any-Leave> {}
1507 set insert0 [.data.record index insert]
1508 $ffunc $setno $o .data.record 1
1509 .data.record tag add r$o $insert0 insert
1510 .data.record tag bind r$o <1> \
1511 [list popup-marc $setno $o 0 0]
1515 show-status Ready 0 1
1519 proc present-response {} {
1526 dputs "In present-response"
1527 set no [z39.$setNo numberOfRecordsReturned]
1528 dputs "Returned $no records, setOffset $setOffset"
1529 add-title-lines $setNo $no $setOffset
1530 set setOffset [expr $setOffset + $no]
1532 dputs "Handling cancel"
1534 if {$delayRequest != ""} {
1539 set status [z39.$setNo responseStatus]
1540 if {[lindex $status 0] == "NSD"} {
1541 show-status Ready 0 1
1542 set code [lindex $status 1]
1543 set msg [lindex $status 2]
1544 set addinfo [lindex $status 3]
1545 tkerror "NSD$code: $msg: $addinfo"
1548 if {$no > 0 && $setOffset <= $setMax} {
1549 dputs "present-request from ${setOffset}"
1550 set toGet [expr $setMax - $setOffset + 1]
1554 z39.$setNo present $setOffset $toGet
1556 show-status Ready 0 1
1560 proc left-cursor {w} {
1561 set i [$w index insert]
1569 proc right-cursor {w} {
1570 set i [$w index insert]
1576 proc bind-fields {list returnAction escapeAction} {
1577 set max [expr [llength $list]-1]
1578 for {set i 0} {$i < $max} {incr i} {
1579 bind [lindex $list $i] <Return> $returnAction
1580 bind [lindex $list $i] <Escape> $escapeAction
1582 bind [lindex $list $i] <Tab> \
1583 [list focus [lindex $list [expr $i+1]]]
1584 bind [lindex $list $i] <Left> \
1585 [list left-cursor [lindex $list $i]]
1586 bind [lindex $list $i] <Right> \
1587 [list right-cursor [lindex $list $i]]
1590 bind [lindex $list $i] <Return> $returnAction
1591 bind [lindex $list $i] <Escape> $escapeAction
1593 bind [lindex $list $i] <Tab> [list focus [lindex $list 0]]
1594 bind [lindex $list $i] <Left> [list left-cursor [lindex $list $i]]
1595 bind [lindex $list $i] <Right> [list right-cursor [lindex $list $i]]
1597 focus [lindex $list 0]
1600 proc entry-fields {parent list tlist returnAction escapeAction} {
1603 foreach field $list {
1604 set label ${parent}.${field}.label
1605 set entry ${parent}.${field}.entry
1606 label $label -text [lindex $tlist $i] -anchor e
1607 entry $entry -width 32 -relief sunken
1608 pack $label -side left
1609 pack $entry -side right
1610 lappend alist $entry
1613 bind-fields $alist $returnAction $escapeAction
1616 proc define-target-dialog {} {
1617 set w .target-define
1623 pack $w.top.target \
1624 -side top -anchor e -pady 2
1625 entry-fields $w.top {target} \
1627 {define-target-action} {destroy .target-define}
1628 top-down-ok-cancel $w {define-target-action} 1
1631 proc protocol-setup-delete {target} {
1633 global settingsChanged
1635 set a [alert "Are you sure you want to delete the target \
1636 definition $target ?"]
1638 set wno [lindex $profile($target) 12]
1641 unset profile($target)
1642 set settingsChanged 1
1644 delete-target-hotlist $target
1648 proc protocol-setup-action {target} {
1651 global protocolRadioType
1652 global settingsChanged
1655 global ResultSetCheck
1657 set wno [lindex $profile($target) 12]
1661 set settingsChanged 1
1662 set len [$w.top.databases.list size]
1663 for {set i 0} {$i < $len} {incr i} {
1664 lappend b [$w.top.databases.list get $i]
1666 set profile($target) [list [$w.top.description.entry get] \
1667 [$w.top.host.entry get] \
1668 [$w.top.port.entry get] \
1669 [$w.top.idAuthentication.entry get] \
1670 [$w.top.maximumRecordSize.entry get] \
1671 [$w.top.preferredMessageSize.entry get] \
1677 $protocolRadioType \
1681 delete-target-hotlist $target
1682 dputs $profile($target)
1686 proc place-force {window parent} {
1687 set g [wm geometry $parent]
1689 set p1 [string first + $g]
1690 set p2 [string last + $g]
1692 set x [expr 40+[string range $g [expr $p1 +1] [expr $p2 -1]]]
1693 set y [expr 60+[string range $g [expr $p2 +1] end]]
1694 wm geometry $window +${x}+${y}
1697 proc add-database-action {target} {
1700 set wno [lindex $profile($target) 12]
1703 $w.top.databases.list insert end \
1704 [.database-select.top.database.entry get]
1705 destroy .database-select
1708 proc add-database {target} {
1711 set w .database-select
1713 set oldFocus [focus]
1715 set wno [lindex $profile($target) 12]
1716 place-force $w .setup-${wno}
1720 frame $w.top.database
1722 pack $w.top.database -side top -anchor e -pady 2
1724 entry-fields $w.top {database} \
1725 {{Database to add:}} \
1726 [list add-database-action $target] {destroy .database-select}
1728 top-down-ok-cancel $w [list add-database-action $target] 1
1732 proc delete-database {target} {
1735 set wno [lindex $profile($target) 12]
1738 foreach i [$w.top.databases.list curselection] {
1739 set b [$w.top.databases.list get $i]
1742 set a [alert "Are you sure you want to remove the database(s)${l}?"]
1744 foreach i [lsort -decreasing \
1745 [$w.top.databases.list curselection]] {
1746 $w.top.databases.list delete $i
1751 proc protocol-setup {target} {
1754 global protocolRadioType
1757 global ResultSetCheck
1759 set wno [lindex $profile($target) 12]
1764 wm title $w "Setup $target"
1768 if {$target == ""} {
1772 dputs $profile($target)
1774 frame $w.top.description
1777 frame $w.top.idAuthentication
1778 frame $w.top.maximumRecordSize
1779 frame $w.top.preferredMessageSize
1780 frame $w.top.cs-type -relief ridge -border 2
1781 frame $w.top.protocol -relief ridge -border 2
1782 frame $w.top.query -relief ridge -border 2
1783 frame $w.top.databases -relief ridge -border 2
1785 # Maximum/preferred/idAuth ...
1786 pack $w.top.description $w.top.host $w.top.port \
1787 $w.top.idAuthentication $w.top.maximumRecordSize \
1788 $w.top.preferredMessageSize -side top -anchor e -pady 2
1790 entry-fields $w.top {description host port idAuthentication \
1791 maximumRecordSize preferredMessageSize} \
1792 {{Description:} {Host:} {Port:} {Id Authentication:} \
1793 {Maximum Record Size:} {Preferred Message Size:}} \
1794 [list protocol-setup-action $target] [list destroy $w]
1796 foreach sub {description host port idAuthentication \
1797 maximumRecordSize preferredMessageSize} {
1799 bind $w.top.$sub.entry <Control-a> [list add-database $target]
1800 bind $w.top.$sub.entry <Control-d> [list delete-database $target]
1802 $w.top.description.entry insert 0 [lindex $profile($target) 0]
1803 $w.top.host.entry insert 0 [lindex $profile($target) 1]
1804 $w.top.port.entry insert 0 [lindex $profile($target) 2]
1805 $w.top.idAuthentication.entry insert 0 [lindex $profile($target) 3]
1806 $w.top.maximumRecordSize.entry insert 0 [lindex $profile($target) 4]
1807 $w.top.preferredMessageSize.entry insert 0 [lindex $profile($target) 5]
1808 set csRadioType [lindex $profile($target) 6]
1809 set RPNCheck [lindex $profile($target) 8]
1810 set CCLCheck [lindex $profile($target) 9]
1811 set ResultSetCheck [lindex $profile($target) 10]
1812 set protocolRadioType [lindex $profile($target) 11]
1813 if {$protocolRadioType == ""} {
1814 set protocolRadioType Z39
1818 pack $w.top.databases -side left -pady 4 -padx 4 -expand yes -fill both
1820 label $w.top.databases.label -text "Databases"
1821 button $w.top.databases.add -text "Add" \
1822 -command [list add-database $target]
1823 button $w.top.databases.delete -text "Delete" \
1824 -command [list delete-database $target]
1826 listbox $w.top.databases.list -geometry 20x6 \
1827 -yscrollcommand "$w.top.databases.scroll set"
1829 listbox $w.top.databases.list -width 20 \
1830 -yscrollcommand "$w.top.databases.scroll set"
1832 scrollbar $w.top.databases.scroll -orient vertical -border 1
1833 pack $w.top.databases.label -side top -fill x \
1835 pack $w.top.databases.add $w.top.databases.delete -side top -fill x \
1837 pack $w.top.databases.list -side left -fill both -expand yes \
1839 pack $w.top.databases.scroll -side right -fill y \
1841 $w.top.databases.scroll config -command "$w.top.databases.list yview"
1843 foreach b [lindex $profile($target) 7] {
1844 $w.top.databases.list insert end $b
1848 pack $w.top.cs-type -pady 4 -padx 4 -side top -fill x
1850 label $w.top.cs-type.label -text "Transport"
1851 radiobutton $w.top.cs-type.tcpip -text "TCP/IP" -anchor w \
1852 -variable csRadioType -value tcpip
1853 radiobutton $w.top.cs-type.mosi -text "MOSI" -anchor w\
1854 -variable csRadioType -value mosi
1856 pack $w.top.cs-type.label $w.top.cs-type.tcpip $w.top.cs-type.mosi \
1857 -padx 4 -side top -fill x
1860 pack $w.top.protocol -pady 4 -padx 4 -side top -fill x
1862 label $w.top.protocol.label -text "Protocol"
1863 radiobutton $w.top.protocol.z39v2 -text "Z39.50" -anchor w \
1864 -variable protocolRadioType -value Z39
1865 radiobutton $w.top.protocol.sr -text "SR" -anchor w \
1866 -variable protocolRadioType -value SR
1868 pack $w.top.protocol.label $w.top.protocol.z39v2 $w.top.protocol.sr \
1869 -padx 4 -side top -fill x
1872 pack $w.top.query -pady 4 -padx 4 -side top -fill x
1874 label $w.top.query.label -text "Query support"
1875 checkbutton $w.top.query.c1 -text "RPN query" -anchor w -variable RPNCheck
1876 checkbutton $w.top.query.c2 -text "CCL query" -anchor w -variable CCLCheck
1877 checkbutton $w.top.query.c3 -text "Result sets" -anchor w -variable ResultSetCheck
1879 pack $w.top.query.label -side top
1880 pack $w.top.query.c1 $w.top.query.c2 $w.top.query.c3 \
1881 -padx 4 -side top -fill x
1884 bottom-buttons $w [list {Ok} [list protocol-setup-action $target] \
1885 {Delete} [list protocol-setup-delete $target] \
1886 {Cancel} [list destroy $w]] 0
1889 proc database-select-action {} {
1890 set w .database-select.top
1892 foreach indx [$w.databases.list curselection] {
1893 lappend b [$w.databases.list get $indx]
1896 z39 databaseNames $b
1898 destroy .database-select
1901 proc database-select {} {
1902 set w .database-select
1907 set oldFocus [focus]
1912 frame $w.top.databases -relief ridge -border 2
1914 pack $w.top.databases -side left -pady 6 -padx 6 -expand yes -fill x
1916 label $w.top.databases.label -text "List"
1917 listbox $w.top.databases.list -width 20 -height 6 \
1918 -yscrollcommand "$w.top.databases.scroll set"
1919 scrollbar $w.top.databases.scroll -orient vertical -border 1
1920 pack $w.top.databases.label -side top -fill x \
1922 pack $w.top.databases.list -side left -fill both -expand yes \
1924 pack $w.top.databases.scroll -side right -fill y \
1926 $w.top.databases.scroll config -command "$w.top.databases.list yview"
1928 foreach b [lindex $profile($hostid) 7] {
1929 $w.top.databases.list insert end $b
1931 top-down-ok-cancel $w {database-select-action} 1
1935 proc cascade-target-list {} {
1938 foreach sub [winfo children .top.target.m.clist] {
1941 .top.target.m.clist delete 0 last
1942 foreach n [lsort [array names profile]] {
1943 if {$n != "Default"} {
1944 set nl [lindex $profile($n) 12]
1945 if {[llength [lindex $profile($n) 7]] > 1} {
1946 .top.target.m.clist add cascade -label $n \
1947 -menu .top.target.m.clist.$nl
1948 menu .top.target.m.clist.$nl
1949 foreach b [lindex $profile($n) 7] {
1950 .top.target.m.clist.$nl add command -label $b \
1951 -command [list reopen-target $n $b]
1954 .top.target.m.clist add command -label $n \
1955 -command [list reopen-target $n {}]
1959 .top.target.m.slist delete 0 last
1960 foreach n [lsort [array names profile]] {
1961 if {$n != "Default"} {
1962 .top.target.m.slist add command -label $n \
1963 -command [list protocol-setup $n]
1968 proc query-select {i} {
1969 global queryButtonsFind
1970 global queryInfoFind
1974 set queryInfoFind [lindex $queryInfo $i]
1975 set queryButtonsFind [lindex $queryButtons $i]
1977 index-lines .lines 1 $queryButtonsFind $queryInfoFind activate-index
1980 proc query-new-action {} {
1984 global settingsChanged
1986 set settingsChanged 1
1987 lappend queryTypes [.query-new.top.index.entry get]
1988 lappend queryButtons {}
1989 lappend queryInfo {}
1999 set oldFocus [focus]
2004 -side top -anchor e -pady 2
2005 entry-fields $w.top index \
2007 query-new-action {destroy .query-new}
2008 top-down-ok-cancel $w query-new-action 1
2012 proc query-delete-action {queryNo} {
2016 global settingsChanged
2018 set settingsChanged 1
2020 set queryTypes [lreplace $queryTypes $queryNo $queryNo]
2021 set queryButtons [lreplace $queryButtons $queryNo $queryNo]
2022 set queryInfo [lreplace $queryInfo $queryNo $queryNo]
2023 destroy .query-delete
2027 proc query-delete {queryNo} {
2035 set n [lindex $queryTypes $queryNo]
2037 label $w.top.warning -bitmap warning
2038 message $w.top.quest -text "Are you sure you want to delete the \
2039 query type $n ?" -aspect 300
2040 pack $w.top.warning $w.top.quest -side left -expand yes -padx 10 -pady 5
2041 bottom-buttons $w [list {Ok} [list query-delete-action $queryNo] \
2042 {Cancel} [list destroy $w]] 1
2045 proc cascade-query-list {} {
2047 set w .top.options.m.query
2050 $w.slist delete 0 last
2051 foreach n $queryTypes {
2052 $w.slist add command -label $n -command [list query-setup $i]
2057 $w.clist delete 0 last
2058 foreach n $queryTypes {
2059 $w.clist add command -label $n -command [list query-select $i]
2063 $w.dlist delete 0 last
2064 foreach n $queryTypes {
2065 $w.dlist add command -label $n -command [list query-delete $i]
2070 proc save-geometry {} {
2071 global windowGeometry
2074 global displayFormat
2078 set windowGeometry(.) [wm geometry .]
2080 set f [open "~/.clientrc.tcl" w]
2082 puts $f "set hotTargets \{ $hotTargets \}"
2083 puts $f "set textWrap $textWrap"
2084 puts $f "set displayFormat $displayFormat"
2085 puts $f "set popupMarcdf $popupMarcdf"
2086 puts $f "set recordSyntax $recordSyntax"
2087 foreach n [array names windowGeometry] {
2088 puts -nonewline $f "set \{windowGeometry($n)\} \{"
2089 puts -nonewline $f $windowGeometry($n)
2095 proc save-settings {} {
2098 global settingsChanged
2103 if {![file writable "${libdir}/clientrc.tcl"]} {
2104 set a [alert "Cannot open ${libdir}/clientrc.tcl for writing. Do you \
2105 wish to save clientrc.tcl in the current directory instead?"]
2109 set f [open "clientrc.tcl" w]
2111 set f [open "${libdir}/clientrc.tcl" w]
2113 puts $f "# Setup file"
2115 foreach n [array names profile] {
2116 puts -nonewline $f "set \{profile($n)\} \{"
2117 puts -nonewline $f $profile($n)
2120 puts -nonewline $f "set queryTypes \{"
2121 puts -nonewline $f $queryTypes
2124 puts -nonewline $f "set queryButtons \{"
2125 puts -nonewline $f $queryButtons
2128 puts -nonewline $f "set queryInfo \{"
2129 puts -nonewline $f $queryInfo
2132 set settingsChanged 0
2141 set oldFocus [focus]
2145 label $w.top.warning -bitmap warning
2146 message $w.top.message -text $ask -aspect 300 \
2147 -font -Adobe-Times-Medium-R-Normal-*-180-*
2149 pack $w.top.warning $w.top.message -side left -pady 5 -padx 10 -expand yes
2152 top-down-ok-cancel $w {alert-action} 1
2157 proc alert-action {} {
2163 proc exit-action {} {
2164 global settingsChanged
2166 if {$settingsChanged} {
2167 set a [alert "you haven't saved your settings. Do you wish to save?"]
2176 proc listbuttonaction {w name h user i} {
2177 $w configure -text [lindex $name 0]
2178 $h [lindex $name 1] $user $i
2181 proc listbuttonx {button no names handle user} {
2182 if {[winfo exists $button]} {
2183 $button configure -text [lindex [lindex $names $no] 0]
2184 ${button}.m delete 0 last
2186 menubutton $button -text [lindex [lindex $names $no] 0] \
2187 -width 10 -menu ${button}.m -relief raised -border 1
2191 foreach name $names {
2192 ${button}.m add command -label [lindex $name 0] \
2193 -command [list listbuttonaction ${button} $name \
2199 proc listbutton {button no names} {
2200 menubutton $button -text [lindex $names $no] -width 10 -menu ${button}.m \
2201 -relief raised -border 1
2203 foreach name $names {
2204 ${button}.m add command -label $name \
2205 -command [list ${button} configure -text $name]
2209 proc listbuttonv-action {button var names i} {
2212 set $var [lindex $names [expr $i+1]]
2213 $button configure -text [lindex $names $i]
2216 proc listbuttonv {button var names} {
2220 eval "set val $$var"
2221 set l [llength $names]
2222 for {set i 1} {$i < $l} {incr i 2} {
2223 if {$val == [lindex $names $i]} {
2225 set n [lindex $names $i]
2229 if {[winfo exists $button]} {
2230 $button configure -text $n
2233 menubutton $button -text $n -menu ${button}.m \
2234 -relief raised -border 1
2236 for {set i 0} {$i < $l} {incr i 2} {
2237 ${button}.m add command -label [lindex $names $i] \
2238 -command [list listbuttonv-action $button $var $names $i]
2242 proc query-add-index-action {queryNo} {
2246 global queryButtonsTmp
2248 set newI [.query-add-index.top.index.entry get]
2249 lappend queryInfoTmp [list $newI {}]
2250 $w.top.index.list insert end $newI
2251 destroy .query-add-index
2252 #destroy $w.top.lines
2253 #frame $w.top.lines -relief ridge -border 2
2254 index-lines $w.top.lines 0 $queryButtonsTmp $queryInfoTmp activate-e-index
2255 #pack $w.top.lines -side left -pady 6 -padx 6 -fill y
2258 proc query-add-line {queryNo} {
2262 global queryButtonsTmp
2264 lappend queryButtonsTmp {I 0}
2266 #destroy $w.top.lines
2267 #frame $w.top.lines -relief ridge -border 2
2268 index-lines $w.top.lines 0 $queryButtonsTmp $queryInfoTmp activate-e-index
2269 #pack $w.top.lines -side left -pady 6 -padx 6 -fill y
2272 proc query-del-line {queryNo} {
2276 global queryButtonsTmp
2278 set l [llength $queryButtonsTmp]
2283 set queryButtonsTmp [lreplace $queryButtonsTmp $l $l]
2284 index-lines $w.top.lines 0 $queryButtonsTmp $queryInfoTmp activate-e-index
2287 proc query-add-index {queryNo} {
2288 set w .query-add-index
2291 set oldFocus [focus]
2292 place-force $w .query-setup
2296 -side top -anchor e -pady 2
2297 entry-fields $w.top {index} \
2299 [list query-add-index-action $queryNo] [list destroy $w]
2300 top-down-ok-cancel $w [list query-add-index-action $queryNo] 1
2304 proc query-setup-action {queryNo} {
2307 global queryButtonsTmp
2309 global queryButtonsFind
2310 global queryInfoFind
2312 global settingsChanged
2314 set settingsChanged 1
2316 set queryInfo [lreplace $queryInfo $queryNo $queryNo \
2318 set queryButtons [lreplace $queryButtons $queryNo $queryNo \
2320 set queryInfoFind $queryInfoTmp
2321 set queryButtonsFind $queryButtonsTmp
2323 destroy .query-setup
2324 index-lines .lines 1 $queryButtonsFind $queryInfoFind activate-index
2327 proc activate-e-index {value no i} {
2328 global queryButtonsTmp
2329 global queryIndexTmp
2331 set queryButtonsTmp [lreplace $queryButtonsTmp $no $no [list I $i]]
2332 dputs $queryButtonsTmp
2333 set queryIndexTmp $i
2336 proc activate-index {value no i} {
2337 global queryButtonsFind
2339 set queryButtonsFind [lreplace $queryButtonsFind $no $no [list I $i]]
2341 dputs "queryButtonsFind $queryButtonsFind"
2344 proc update-attr {} {
2346 listbuttonv $w.top.relation.b relationTmpValue\
2347 {{None} 0 {Less than} 1 {Greater than or equal} 2 {Equal} 3 \
2348 {Greater than or equal} 4 {Greater than} 5 {Not equal} 6 \
2349 {Phonetic} 100 {Stem} 101 {Relevance} 102 {AlwaysMatches} 103}
2350 listbuttonv $w.top.position.b positionTmpValue {{None} 0 \
2351 {First in field} 1 {First in subfield} 2 {Any position in field} 3}
2352 listbuttonv $w.top.structure.b structureTmpValue {{None} 0 {Phrase} 1 \
2353 {Word} 2 {Key} 3 {Year} 4 {Date (norm)} 5 {Word list} 6 \
2354 {Date (un-norm)} 100 {Name (norm)} 101 {Date (un-norm)} 102 \
2355 {Structure} 103 {urx} 104 {free-form} 105 {doc-text} 106 \
2356 {local-number} 107 {string} 108 {numeric string} 109}
2357 listbuttonv $w.top.truncation.b truncationTmpValue {{Auto} 0 {Right} 1 \
2358 {Left} 2 {Left and right} 3 {No truncation} 100 \
2359 {Process #} 101 {Re-1} 102 {Re-2} 103}
2360 listbuttonv $w.top.completeness.b completenessTmpValue {{None} 0 \
2361 {Incomplete subfield} 1 {Complete subfield} 2 {Complete field} 3}
2364 proc use-attr {init} {
2376 {BNB card number} 10
2377 {BGF(sic) number} 11
2379 {Dewey classification} 13
2380 {UDC classification} 14
2381 {Bliss classification} 15
2383 {NLM call number} 17
2384 {NAL call number} 18
2385 {MOS call number} 19
2386 {Local classification} 20
2387 {Subject heading} 21
2389 {BDI-index-subject} 23
2393 {LC-subject-heading} 27
2394 {RVM-subject-heading} 28
2395 {Local subject index} 29
2397 {Date of publication} 31
2398 {Date of acquisition} 32
2400 {Title-collective} 34
2403 {Title-added-title-page} 37
2407 {Title-other-variant} 41
2409 {Title-abbreviated} 43
2413 {Subject-subdivision} 47
2414 {Number-natl-bibliography} 48
2415 {Number-legal-deposit} 49
2416 {Number-govt-publication} 50
2417 {Number-publisher-for-music} 51
2419 {Number-local-call} 53
2421 {Code-geographic-area} 55
2422 {Code-institution} 56
2424 {Name-geographic} 58
2425 {Place-publication} 59
2427 {Microform-generation} 61
2434 {Author-name-personal} 1004
2435 {Author-name-corporate} 1005
2436 {Author-name-conference} 1006
2437 {Identifier-standard} 1007
2438 {Subject-LC-children's} 1008
2439 {Subject-name-personal} 1009
2441 {Date/time added to database} 1011
2442 {Date/time last modified} 1012
2443 {Authority/format identifier} 1013
2445 {Concept-reference} 1015
2447 {Server choice} 1017
2449 {Record source} 1019
2452 {Geographic class} 1022
2456 {Related periodical} 1026
2457 {Report number} 1027
2459 {Thematic number} 1030
2460 {Material type} 1031
2468 set l [llength $attr]
2473 for {set i 0} {$i < $l} {incr i} {
2474 $w.top.use.list insert end [lindex $attr $i]
2476 if {$useTmpValue == [lindex $attr $i]} {
2482 $w.top.use.list selection clear 0 end
2483 $w.top.use.list selection set $s $s
2485 $w.top.use.list select from $s
2486 $w.top.use.list select to $s
2492 $w.top.use.list yview $s
2494 set lno [lindex [$w.top.use.list curselection] 0]
2495 set i [expr $lno+$lno+1]
2496 set useTmpValue [lindex $attr $i]
2497 dputs "useTmpValue=$useTmpValue"
2501 proc index-setup-action {oldAttr queryNo indexNo} {
2502 set attr [lindex $oldAttr 0]
2505 global relationTmpValue
2506 global structureTmpValue
2507 global truncationTmpValue
2508 global completenessTmpValue
2509 global positionTmpValue
2514 dputs "index-setup-action"
2515 dputs "queryNo $queryNo"
2516 dputs "indexNo $indexNo"
2517 if {$useTmpValue > 0} {
2518 lappend attr "1=$useTmpValue"
2520 if {$relationTmpValue > 0} {
2521 lappend attr "2=$relationTmpValue"
2523 if {$positionTmpValue > 0} {
2524 lappend attr "3=$positionTmpValue"
2526 if {$structureTmpValue > 0} {
2527 lappend attr "4=$structureTmpValue"
2529 if {$truncationTmpValue > 0} {
2530 lappend attr "5=$truncationTmpValue"
2532 if {$completenessTmpValue > 0} {
2533 lappend attr "6=$completenessTmpValue"
2535 dputs "new attr $attr"
2536 set queryInfoTmp [lreplace $queryInfoTmp $indexNo $indexNo $attr]
2537 destroy .index-setup
2540 proc index-setup {attr queryNo indexNo} {
2543 global relationTmpValue
2544 global structureTmpValue
2545 global truncationTmpValue
2546 global completenessTmpValue
2547 global positionTmpValue
2549 set relationTmpValue 0
2550 set truncationTmpValue 0
2551 set structureTmpValue 0
2552 set positionTmpValue 0
2553 set completenessTmpValue 0
2556 set len [llength $attr]
2557 for {set i 1} {$i < $len} {incr i} {
2558 set q [lindex $attr $i]
2559 set l [string first = $q]
2561 set t [string range $q 0 [expr $l - 1]]
2562 set v [string range $q [expr $l + 1] end]
2565 { set useTmpValue $v }
2567 { set relationTmpValue $v }
2569 { set positionTmpValue $v }
2571 { set structureTmpValue $v }
2573 { set truncationTmpValue $v }
2575 { set completenessTmpValue $v }
2579 if {[winfo exists $w]} {
2584 set n [lindex $attr 0]
2585 wm title $w "Index setup $n"
2589 frame $w.top.use -relief ridge -border 2
2590 frame $w.top.relation -relief ridge -border 2
2591 frame $w.top.position -relief ridge -border 2
2592 frame $w.top.structure -relief ridge -border 2
2593 frame $w.top.truncation -relief ridge -border 2
2594 frame $w.top.completeness -relief ridge -border 2
2600 pack $w.top.use -side left -pady 6 -padx 6 -fill y
2602 label $w.top.use.label -text "Use"
2604 listbox $w.top.use.list -width 26 \
2605 -yscrollcommand "$w.top.use.scroll set"
2607 listbox $w.top.use.list -geometry 26x10 \
2608 -yscrollcommand "$w.top.use.scroll set"
2610 scrollbar $w.top.use.scroll -orient vertical -border 1
2611 pack $w.top.use.label -side top -fill x \
2613 pack $w.top.use.list -side left -fill both -expand yes \
2615 pack $w.top.use.scroll -side right -fill y \
2617 $w.top.use.scroll config -command "$w.top.use.list yview"
2621 # Relation Attributes
2623 pack $w.top.relation -pady 6 -padx 6 -side top
2624 label $w.top.relation.label -text "Relation" -width 18
2626 pack $w.top.relation.label $w.top.relation.b -fill x
2628 # Position Attributes
2630 pack $w.top.position -pady 6 -padx 6 -side top
2631 label $w.top.position.label -text "Position" -width 18
2633 pack $w.top.position.label $w.top.position.b -fill x
2635 # Structure Attributes
2637 pack $w.top.structure -pady 6 -padx 6 -side top
2638 label $w.top.structure.label -text "Structure" -width 18
2640 pack $w.top.structure.label $w.top.structure.b -fill x
2642 # Truncation Attributes
2644 pack $w.top.truncation -pady 6 -padx 6 -side top
2645 label $w.top.truncation.label -text "Truncation" -width 18
2647 pack $w.top.truncation.label $w.top.truncation.b -fill x
2649 # Completeness Attributes
2651 pack $w.top.completeness -pady 6 -padx 6 -side top
2652 label $w.top.completeness.label -text "Completeness" -width 18
2654 pack $w.top.completeness.label $w.top.completeness.b -fill x
2657 bottom-buttons $w [list \
2658 {Ok} [list index-setup-action $attr $queryNo $indexNo] \
2659 {Cancel} [list destroy $w]] 0
2663 proc query-edit-index {queryNo} {
2667 set i [lindex [$w.top.index.list curselection] 0]
2671 set attr [lindex $queryInfoTmp $i]
2672 dputs "Editing no $i $attr"
2673 index-setup $attr $queryNo $i
2676 proc query-delete-index {queryNo} {
2678 global queryButtonsTmp
2681 set i [lindex [$w.top.index.list curselection] 0]
2685 set queryInfoTmp [lreplace $queryInfoTmp $i $i]
2686 index-lines $w.top.lines 0 $queryButtonsTmp $queryInfoTmp activate-e-index
2687 $w.top.index.list delete $i
2690 proc query-setup {queryNo} {
2696 global queryButtonsTmp
2698 global queryIndexTmp
2701 set queryName [lindex $queryTypes $queryNo]
2702 set queryInfoTmp [lindex $queryInfo $queryNo]
2703 set queryButtonsTmp [lindex $queryButtons $queryNo]
2708 wm title $w "Query setup $queryName"
2712 frame $w.top.lines -relief ridge -border 2
2714 pack $w.top.lines -side left -pady 6 -padx 6 -fill y
2718 index-lines $w.top.lines 0 $queryButtonsTmp $queryInfoTmp activate-e-index
2720 button $w.top.lines.add -text "Add" \
2721 -command [list query-add-line $queryNo]
2722 button $w.top.lines.del -text "Remove" \
2723 -command [list query-del-line $queryNo]
2725 pack $w.top.lines.del -fill x -side bottom
2726 pack $w.top.lines.add -fill x -pady 10 -side bottom
2730 frame $w.top.index -relief ridge -border 2
2731 pack $w.top.index -pady 6 -padx 6 -side right -fill y
2733 listbox $w.top.index.list -yscrollcommand [list $w.top.index.scroll set]
2734 scrollbar $w.top.index.scroll -orient vertical -border 1 \
2735 -command [list $w.top.index.list yview]
2736 bind $w.top.index.list <2> [list query-edit-index $queryNo]
2738 pack $w.top.index.list -side left -fill both -expand yes -padx 2 -pady 2
2739 pack $w.top.index.scroll -side right -fill y -padx 2 -pady 2
2742 $w.top.index.list selection clear 0 end
2743 $w.top.index.list selection set 0 0
2745 $w.top.index.list select from 0
2746 $w.top.index.list select to 0
2749 foreach x $queryInfoTmp {
2750 $w.top.index.list insert end [lindex $x 0]
2753 bottom-buttons $w [list \
2754 {Ok} [list query-setup-action $queryNo] \
2755 {Add index} [list query-add-index $queryNo] \
2756 {Edit index} [list query-edit-index $queryNo] \
2757 {Delete index} [list query-delete-index $queryNo] \
2758 {Cancel} [list destroy $w]] 0
2761 proc index-clear {} {
2762 global queryButtonsFind
2765 foreach b $queryButtonsFind {
2766 .lines.$i.e delete 0 end
2771 proc index-query {} {
2772 global queryButtonsFind
2773 global queryInfoFind
2778 foreach b $queryButtonsFind {
2779 set term [string trim [.lines.$i.e get]]
2781 set attr [lrange [lindex $queryInfoFind [lindex $b 1]] 1 end]
2783 set len [string length $term]
2787 if {[string index $term $len] == "?"} {
2789 set term [string range $term 0 [expr $len - 1]]
2791 if {[string index $term 0] == "?"} {
2793 set term [string range $term 1 end]
2795 set term "\{${term}\}"
2796 if {$right && $left} {
2797 set term "@attr 5=3 ${term}"
2799 set term "@attr 5=1 ${term}"
2801 set term "@attr 5=2 ${term}"
2804 set term "@attr $a ${term}"
2807 set qs "@and ${qs} ${term}"
2818 proc index-focus-in {w i} {
2819 global curIndexEntry
2822 $w.$i configure -background red
2824 set curIndexEntry $i
2827 proc index-lines {w realOp buttonInfo queryInfo handle} {
2829 foreach b $buttonInfo {
2830 if {! [winfo exists $w.$i]} {
2832 frame $w.$i -border 0
2834 frame $w.$i -background white -border 1
2837 listbuttonx $w.$i.l [lindex $b 1] $queryInfo $handle $i
2840 if {! [winfo exists $w.$i.e]} {
2841 entry $w.$i.e -width 32 -relief sunken -border 1
2842 bind $w.$i.e <FocusIn> [list index-focus-in $w $i]
2843 bind $w.$i.e <FocusOut> [list $w.$i configure \
2845 pack $w.$i.l -side left
2846 pack $w.$i.e -side left -fill x -expand yes
2847 pack $w.$i -side top -fill x -padx 2 -pady 2
2849 bind $w.$i.e <Left> [list left-cursor $w.$i.e]
2850 bind $w.$i.e <Right> [list right-cursor $w.$i.e]
2852 bind $w.$i.e <Return> {search-request 0}
2855 pack $w.$i.l -side left
2856 pack $w.$i -side top -fill x -padx 2 -pady 2
2861 while {[winfo exists $w.$j]} {
2873 bind $w.$j.e <Tab> "focus $w.$k.e"
2879 bind $w.$i.e <Tab> "focus $w.0.e"
2885 proc search-fields {w buttondefs} {
2887 foreach buttondef $buttondefs {
2888 frame $w.$i -background white
2890 listbutton $w.$i.l 0 $buttondef
2891 entry $w.$i.e -width 32 -relief sunken
2893 pack $w.$i.l -side left
2894 pack $w.$i.e -side left -fill x -expand yes
2896 pack $w.$i -side top -fill x -padx 2 -pady 2
2898 bind $w.$i.e <Left> [list left-cursor $w.$i.e]
2899 bind $w.$i.e <Right> [list right-cursor $w.$i.e]
2907 bind $w.$j.e <Tab> "focus $w.$k.e \n
2908 $w.$k configure -background red \n
2909 $w.$j configure -background white"
2912 bind $w.$i.e <Tab> "focus $w.0.e \n
2913 $w.0 configure -background red \n
2914 $w.$i configure -background white"
2916 $w.0 configure -background red
2919 if {[info exists windowGeometry(.)]} {
2920 set g $windowGeometry(.)
2928 frame .top -border 1 -relief raised
2929 frame .lines -border 1 -relief raised
2930 frame .mid -border 1 -relief raised
2931 frame .data -border 1 -relief raised
2932 frame .bot -border 1 -relief raised
2933 pack .top .lines .mid -side top -fill x
2934 pack .data -side top -fill both -expand yes
2937 menubutton .top.file -text "File" -menu .top.file.m
2939 .top.file.m add command -label "Save settings" -command {save-settings}
2940 .top.file.m add separator
2941 .top.file.m add command -label "Exit" -command {exit-action}
2943 menubutton .top.target -text "Target" -menu .top.target.m
2945 .top.target.m add cascade -label "Connect" -menu .top.target.m.clist
2946 .top.target.m add command -label "Disconnect" -command {close-target}
2947 .top.target.m add command -label "About" -command {about-target}
2948 .top.target.m add cascade -label "Setup" -menu .top.target.m.slist
2949 .top.target.m add command -label "Setup new" -command {define-target-dialog}
2950 .top.target.m add separator
2951 set-target-hotlist 0
2953 configure-disable-e .top.target.m 1
2954 configure-disable-e .top.target.m 2
2956 menu .top.target.m.clist
2957 menu .top.target.m.slist
2960 menubutton .top.service -text "Service" -menu .top.service.m
2962 .top.service.m add command -label "Database" -command {database-select}
2963 .top.service.m add cascade -label "Present" -menu .top.service.m.present
2964 menu .top.service.m.present
2965 .top.service.m.present add command -label "10 More" \
2966 -command [list present-more 10]
2967 .top.service.m.present add command -label "All" \
2968 -command [list present-more {}]
2969 .top.service.m add command -label "Search" -command {search-request 0}
2970 .top.service.m add command -label "Scan" -command {scan-request}
2972 .top.service configure -state disabled
2974 menubutton .top.rset -text "Set" -menu .top.rset.m
2976 .top.rset.m add command -label "Load" -command {load-set}
2977 .top.rset.m add separator
2979 menubutton .top.options -text "Options" -menu .top.options.m
2981 .top.options.m add cascade -label "Query" -menu .top.options.m.query
2982 .top.options.m add cascade -label "Format" -menu .top.options.m.formats
2983 .top.options.m add cascade -label "Wrap" -menu .top.options.m.wrap
2984 .top.options.m add cascade -label "Syntax" -menu .top.options.m.syntax
2986 menu .top.options.m.query
2987 .top.options.m.query add cascade -label "Select" \
2988 -menu .top.options.m.query.clist
2989 .top.options.m.query add cascade -label "Edit" \
2990 -menu .top.options.m.query.slist
2991 .top.options.m.query add command -label "New" \
2992 -command {query-new}
2993 .top.options.m.query add cascade -label "Delete" \
2994 -menu .top.options.m.query.dlist
2996 menu .top.options.m.query.slist
2997 menu .top.options.m.query.clist
2998 menu .top.options.m.query.dlist
3001 menu .top.options.m.formats
3003 foreach f $displayFormats {
3004 .top.options.m.formats add radiobutton -label $f -value $i \
3005 -command [list set-display-format $i] -variable displayFormat
3009 menu .top.options.m.wrap
3010 .top.options.m.wrap add radiobutton -label "Character" \
3011 -value char -variable textWrap -command {set-wrap char}
3012 .top.options.m.wrap add radiobutton -label "Word" \
3013 -value word -variable textWrap -command {set-wrap word}
3014 .top.options.m.wrap add radiobutton -label "None" \
3015 -value none -variable textWrap -command {set-wrap none}
3017 menu .top.options.m.syntax
3018 .top.options.m.syntax add radiobutton -label "None" \
3019 -value None -variable recordSyntax
3020 .top.options.m.syntax add separator
3021 .top.options.m.syntax add radiobutton -label "USMARC" \
3022 -value USMARC -variable recordSyntax
3023 .top.options.m.syntax add radiobutton -label "UNIMARC" \
3024 -value UNIMARC -variable recordSyntax
3025 .top.options.m.syntax add radiobutton -label "UKMARC" \
3026 -value UKMARC -variable recordSyntax
3027 .top.options.m.syntax add radiobutton -label "DANMARC" \
3028 -value DANMARC -variable recordSyntax
3029 .top.options.m.syntax add radiobutton -label "FINMARC" \
3030 -value FINMARC -variable recordSyntax
3031 .top.options.m.syntax add radiobutton -label "NORMARC" \
3032 -value NORMARC -variable recordSyntax
3033 .top.options.m.syntax add radiobutton -label "PICAMARC" \
3034 -value PICAMARC -variable recordSyntax
3035 .top.options.m.syntax add separator
3036 .top.options.m.syntax add radiobutton -label "SUTRS" \
3037 -value SUTRS -variable recordSyntax
3039 menubutton .top.help -text "Help" -menu .top.help.m
3042 .top.help.m add command -label "Help on help" \
3043 -command {tkerror "Help on help not available. Sorry"}
3044 .top.help.m add command -label "About" -command {about-origin}
3046 pack .top.file .top.target .top.service .top.rset .top.options -side left
3047 pack .top.help -side right
3049 index-lines .lines 1 $queryButtonsFind [lindex $queryInfo 0] activate-index
3051 button .mid.search -width 7 -text {Search} -command {search-request 0} \
3053 button .mid.scan -width 7 -text {Scan} \
3054 -command scan-request -state disabled
3055 button .mid.present -width 7 -text {Present} -command [list present-more 10] \
3058 button .mid.clear -width 7 -text {Clear} -command index-clear
3059 pack .mid.search .mid.scan .mid.present .mid.clear -side left \
3060 -fill y -padx 4 -pady 2
3062 text .data.record -height 2 -width 20 -wrap none \
3063 -yscrollcommand [list .data.scroll set] -wrap $textWrap
3064 scrollbar .data.scroll -command [list .data.record yview]
3066 .data.record configure -takefocus 0
3067 .data.scroll configure -takefocus 0
3069 pack .data.scroll -side right -fill y
3070 pack .data.record -expand yes -fill both
3074 .data.record tag configure marc-tag -foreground blue
3075 .data.record tag configure marc-id -foreground red
3077 .data.record tag configure marc-tag -foreground black
3078 .data.record tag configure marc-id -foreground black
3080 .data.record tag configure marc-data -foreground black
3082 button .bot.logo -bitmap @${libdir}/bitmaps/book1 -command cancel-operation
3084 .bot.logo configure -takefocus 0
3087 pack .bot.a -side left -fill x
3088 pack .bot.logo -side right -padx 2 -pady 2 -ipadx 1
3090 message .bot.a.target -text "" -aspect 1000 -border 1
3092 label .bot.a.status -text "Not connected" -width 15 -relief \
3093 sunken -anchor w -border 1
3094 label .bot.a.set -text "" -width 5 -relief \
3095 sunken -anchor w -border 1
3096 label .bot.a.message -text "" -width 15 -relief \
3097 sunken -anchor w -border 1
3099 pack .bot.a.target -side top -anchor nw -padx 2 -pady 2
3100 pack .bot.a.status .bot.a.set .bot.a.message \
3101 -side left -padx 2 -pady 2 -ipadx 1 -ipady 1