1 # IR toolkit for tcl/tk
3 # See the file LICENSE for details.
4 # Sebastian Hammer, Adam Dickmeiss
7 # Revision 1.64 1995-08-24 15:33:02 adam
10 # Revision 1.63 1995/08/04 13:20:48 adam
11 # Buttons at the bottom are slightly smaller.
13 # Revision 1.62 1995/08/04 11:32:37 adam
14 # More work on output queue. Memory related routines moved
17 # Revision 1.61 1995/07/20 08:09:39 adam
18 # client.tcl: Targets removed from hotTargets list when targets
19 # are removed/modified.
20 # ir-tcl.c: More work on triggerResourceControl.
22 # Revision 1.60 1995/06/30 16:30:19 adam
25 # Revision 1.59 1995/06/29 14:06:25 adam
26 # Another bug in install fixed. Configure searches for more versions of yaz.
28 # Revision 1.58 1995/06/29 12:34:06 adam
29 # IrTcl now works with both tk4.0b4/tcl7.4b4 and tk3.6/tcl7.3
31 # Revision 1.57 1995/06/29 09:20:30 adam
32 # Target entries in cascade menus are sorted.
34 # Revision 1.56 1995/06/27 19:03:48 adam
35 # Bug fix in do_present in ir-tcl.c: p->set_child member weren't set.
36 # nextResultSetPosition used instead of setOffset.
38 # Revision 1.55 1995/06/27 17:10:37 adam
39 # Bug fix: install procedure didn't work on some systems.
40 # Error turned up when clientrc.tcl was't present.
42 # Revision 1.54 1995/06/27 14:41:03 adam
43 # Bug fix in search-response. Didn't always observe non-surrogate diagnostics.
45 # Revision 1.53 1995/06/26 12:40:09 adam
46 # Client defines its own tkerror.
47 # User may specify 'no preferredRecordSyntax'.
49 # Revision 1.52 1995/06/22 13:14:59 adam
50 # Feature: SUTRS. Setting getSutrs implemented.
51 # Work on display formats.
52 # Preferred record syntax can be set by the user.
54 # Revision 1.51 1995/06/21 11:11:00 adam
55 # Bug fix: libdir undefined in about-origin.
57 # Revision 1.50 1995/06/21 11:04:48 adam
58 # Uses GNU autoconf 2.3.
59 # Install procedure implemented.
60 # boook bitmaps moved to sub directory bitmaps.
62 # Revision 1.49 1995/06/20 14:16:42 adam
63 # More work on cancel mechanism.
65 # Revision 1.48 1995/06/20 08:07:23 adam
66 # New setting: failInfo.
67 # Working on better cancel mechanism.
69 # Revision 1.47 1995/06/19 14:05:29 adam
70 # Bug fix: asked for SUTRS.
72 # Revision 1.46 1995/06/19 13:06:06 adam
73 # New define: IR_TCL_VERSION.
75 # Revision 1.45 1995/06/19 08:08:44 adam
76 # client.tcl: hotTargets now contain both database and target name.
77 # ir-tcl.c: setting protocol edited. Errors in callbacks are logged
78 # by logf(LOG_WARN, ...) calls.
80 # Revision 1.44 1995/06/16 14:55:18 adam
83 # Revision 1.43 1995/06/16 14:41:05 adam
84 # Scan line entries can be copied to a search entry.
86 # Revision 1.42 1995/06/16 12:28:13 adam
87 # Implemented preferredRecordSyntax.
88 # Minor changes in diagnostic handling.
89 # Record list deleted when connection closes.
91 # Revision 1.41 1995/06/14 15:07:59 adam
92 # Bug fix in cascade-target-list. Uses yaz-version.h.
94 # Revision 1.40 1995/06/14 13:37:17 adam
95 # Setting recordType implemented.
96 # Setting implementationVersion implemented.
97 # Settings implementationId / implementationName edited.
99 # Revision 1.39 1995/06/14 12:16:22 adam
100 # hotTargets, textWrap and displayFormat saved in clientg.tcl.
102 # Revision 1.38 1995/06/14 07:22:45 adam
103 # Target definitions can be deleted.
104 # Listbox used in the query definition dialog.
106 # Revision 1.37 1995/06/13 14:37:59 adam
107 # Work on query setup.
108 # Better about origin/target.
109 # Better presentation formats.
111 # Revision 1.36 1995/06/13 07:42:14 adam
112 # Bindings removed from text widgets.
114 # Revision 1.35 1995/06/12 15:17:31 adam
115 # Text widget used in main window (instead of listbox) to support
116 # better presentation formats.
118 # Revision 1.34 1995/06/12 07:59:07 adam
119 # More work on geometry handling.
121 # Revision 1.33 1995/06/09 11:17:35 adam
122 # Start work on geometry management.
124 # Revision 1.32 1995/06/07 09:16:37 adam
125 # New presentation format.
127 # Revision 1.31 1995/06/06 16:31:09 adam
128 # Bug fix: target names couldn't contain blanks.
131 # Revision 1.30 1995/06/06 11:35:41 adam
132 # Work on scan. Display of old sets.
134 # Revision 1.29 1995/06/05 14:11:18 adam
135 # Bug fix in present-more.
137 # Revision 1.28 1995/06/02 14:52:13 adam
138 # Minor changes really.
140 # Revision 1.27 1995/06/02 14:29:42 adam
141 # Work on scan interface - up/down buttons.
143 # Revision 1.26 1995/06/01 16:36:46 adam
144 # About buttons. Minor bug fixes.
146 # Revision 1.25 1995/05/31 13:09:57 adam
147 # Client searches/presents may be interrupted.
148 # New moving book-logo.
150 # Revision 1.24 1995/05/31 08:36:24 adam
151 # Bug fix in client.tcl: didn't save options on clientrc.tcl.
152 # New method: referenceId. More work on scan.
154 # Revision 1.23 1995/05/29 10:33:41 adam
155 # README and rename of startup script.
157 # Revision 1.22 1995/05/26 11:44:09 adam
158 # Bugs fixed. More work on MARC utilities and queries. Test
159 # client is up-to-date again.
161 # Revision 1.21 1995/05/11 15:34:46 adam
162 # Scan request changed a bit. This version works with RLG.
164 # Revision 1.20 1995/04/21 16:31:57 adam
165 # New radiobutton: protocol (z39v2/SR).
167 # Revision 1.19 1995/04/18 16:11:50 adam
168 # First version of graphical Scan. Some work on query-by-form.
170 # Revision 1.18 1995/04/10 10:50:22 adam
171 # Result-set name defaults to suffix of ir-set name.
172 # Started working on scan. Not finished at this point.
174 # Revision 1.17 1995/03/31 09:34:57 adam
175 # Search-button disabled when there is no connection.
177 # Revision 1.16 1995/03/31 08:56:36 adam
178 # New button "Search".
180 # Revision 1.15 1995/03/28 12:45:22 adam
181 # New ir method failback: called on disconnect/protocol error.
182 # New ir set/get method: protocol: SR / Z3950.
183 # Simple popup and disconnect when failback is invoked.
185 # Revision 1.14 1995/03/22 16:07:55 adam
188 # Revision 1.13 1995/03/21 17:27:26 adam
189 # Short-hand keys in setup.
191 # Revision 1.12 1995/03/21 13:41:03 adam
192 # Comstack cs_create not used too often. Non-blocking connect.
194 # Revision 1.11 1995/03/21 10:39:06 adam
195 # Diagnostic error message displayed with tkerror.
197 # Revision 1.10 1995/03/20 15:24:06 adam
198 # Diagnostic records saved on searchResponse.
200 # Revision 1.9 1995/03/17 18:26:16 adam
201 # Non-blocking i/o used now. Database names popup as cascade items.
203 # Revision 1.8 1995/03/17 15:45:00 adam
204 # Improved target/database setup.
206 # Revision 1.7 1995/03/16 17:54:03 adam
207 # Minor changes really.
209 # Revision 1.6 1995/03/15 19:10:20 adam
210 # Database setup in protocol-setup (rather target setup).
212 # Revision 1.5 1995/03/15 13:59:23 adam
215 # Revision 1.4 1995/03/14 17:32:29 adam
216 # Presentation of full Marc record in popup window.
218 # Revision 1.3 1995/03/12 19:31:52 adam
219 # Pattern matching implemented when retrieving MARC records. More
220 # diagnostic functions.
222 # Revision 1.2 1995/03/10 18:00:15 adam
223 # Actual presentation in line-by-line format. RPN query support.
225 # Revision 1.1 1995/03/09 16:15:07 adam
226 # First presentRequest attempts. Hot-target list.
230 if {$tk_version == "3.6"} {
241 proc configure-enable-e {w n} {
243 $w entryconfigure $n -state normal
245 proc configure-disable-e {w n} {
247 $w entryconfigure $n -state disabled
249 set noFocus [list -takefocus 0]
251 proc configure-enable-e {w n} {
254 proc configure-disable-e {w n} {
261 if {[tk colormodel .] == "color"} {
271 if {[file readable bitmaps/book2]} {
274 if {! [file readable ${libdir}/bitmaps/book2]} {
275 puts "Cannot locate system files in ${libdir}. You must either run this"
276 puts "program from the source directory root of ir-tcl or you must assure"
277 puts "that it is installed - normally in /usr/local/lib/irtcl"
285 set profile(Default) {{} {} {210} {} 16384 8192 tcpip {} 1 {} {} Z39 1}
287 set settingsChanged 0
296 set recordSyntax None
299 set queryTypes {Simple}
300 set queryButtons { { {I 0} {I 1} {I 2} } }
301 set queryInfo { { {Title {1=4 4=1}} {Author {1=1}} \
302 {Subject {1=21}} {Any {1=1016}} } }
311 if {[winfo exists $w]} {
320 label $w.top.b -bitmap error
321 message $w.top.t -aspect 300 -text "Error: $err" \
322 -font -Adobe-Helvetica-Bold-R-Normal-*-180-*
323 pack $w.top.b $w.top.t -side left -padx 10 -pady 10
325 bottom-buttons $w [list {Close} [list destroy $w]] 1
328 proc read-formats {} {
329 global displayFormats
331 set formats [glob -nocomplain ${libdir}/formats/*.tcl]
333 if {[file readable $f]} {
335 set l [string length $f]
336 set f [string range $f [string length "${libdir}/formats/"] \
338 lappend displayFormats $f
347 .data.record configure -wrap $m
354 proc set-display-format {f} {
364 .bot.a.status configure -text "Reformatting"
367 add-title-lines -1 10000 1
370 proc initBindings {} {
373 bind $w <Double-1> {}
374 bind $w <Triple-1> {}
375 bind $w <B1-Motion> {}
377 bind $w <Shift-B1-Motion> {}
379 bind $w <B2-Motion> {}
380 bind $w <Any-KeyPress> {}
382 bind $w <BackSpace> {}
384 bind $w <Control-h> {}
385 bind $w <Control-d> {}
386 bind $w <Control-v> {}
389 bind $w <B1-Motion> {}
390 bind $w <Shift-B1-Motion> {}
395 proc post-menu {wbutton wmenu} {
398 $wmenu post [winfo rootx $wbutton] \
399 [expr [winfo rooty $wbutton]+[winfo height $wbutton]]
404 global windowGeometry
405 set windowGeometry($w) [wm geometry $w]
408 global windowGeometry
411 if {[info exists windowGeometry($w)]} {
412 set g $windowGeometry($w)
417 bind $w <Destroy> [list destroyGW $w]
420 if {[file readable "clientrc.tcl"]} {
421 source "clientrc.tcl"
423 if {[file readable "${libdir}/clientrc.tcl"]} {
424 source "${libdir}/clientrc.tcl"
428 if {[file readable "~/.clientrc.tcl"]} {
429 source "~/.clientrc.tcl"
432 set queryButtonsFind [lindex $queryButtons 0]
433 set queryInfoFind [lindex $queryInfo 0]
435 proc top-down-window {w} {
436 frame $w.top -relief raised -border 1
437 frame $w.bot -relief raised -border 1
439 pack $w.top -side top -fill both -expand yes
440 pack $w.bot -fill both
443 proc top-down-ok-cancel {w ok-action g} {
444 frame $w.bot.left -relief sunken -border 1
445 pack $w.bot.left -side left -expand yes -ipadx 2 -ipady 2 -padx 4 -pady 4
446 button $w.bot.left.ok -width 5 -text {Ok} \
447 -command ${ok-action}
448 pack $w.bot.left.ok -expand yes -ipadx 2 -ipady 2 -padx 3 -pady 3
449 button $w.bot.cancel -width 6 -text {Cancel} \
450 -command [list destroy $w]
451 pack $w.bot.cancel -side left -expand yes
459 proc bottom-buttons {w buttonList g} {
461 set l [llength $buttonList]
463 frame $w.bot.$i -relief sunken -border 1
464 pack $w.bot.$i -side left -expand yes -padx 4 -pady 4
465 button $w.bot.$i.ok -text [lindex $buttonList $i] \
466 -command [lindex $buttonList [expr $i+1]]
467 pack $w.bot.$i.ok -expand yes -ipadx 2 -ipady 2 -padx 2 -pady 2 -side left
471 button $w.bot.$i -text [lindex $buttonList $i] \
472 -command [lindex $buttonList [expr $i+1]]
473 pack $w.bot.$i -expand yes -ipadx 2 -ipady 2 -padx 2 -pady 2 -side left
483 proc cancel-operation {} {
491 show-status Cancel 0 1
495 proc show-target {target base} {
499 .bot.a.target configure -text ""
503 .bot.a.target configure -text "$target"
505 .bot.a.target configure -text "$target - $base"
509 proc show-logo {v1} {
518 .bot.logo configure -bitmap @${libdir}/bitmaps/book${v1}
519 after 140 [list show-logo $v1]
523 .bot.logo configure -bitmap @${libdir}/bitmaps/book1
532 proc show-status {status b sb} {
539 .bot.a.status configure -text "$status"
541 if {$busy == 0} {set busy 1}
549 .top.service configure -state normal
550 .mid.search configure -state normal
552 .mid.scan configure -state normal
555 configure-disable-e .top.service.m 1
556 } elseif {[z39.$setNo nextResultSetPosition] > 0 &&
557 [z39.$setNo nextResultSetPosition] <= [z39.$setNo resultCount]} {
558 configure-enable-e .top.service.m 1
559 .mid.present configure -state normal
561 configure-disable-e .top.service.m 1
562 .mid.present configure -state disabled
564 if {[winfo exists .scan-window]} {
565 .scan-window.bot.2 configure -state normal
566 .scan-window.bot.4 configure -state normal
569 .top.service configure -state disabled
570 .mid.search configure -state disabled
571 .mid.scan configure -state disabled
572 .mid.present configure -state disabled
574 if {[winfo exists .scan-window]} {
575 .scan-window.bot.2 configure -state disabled
576 .scan-window.bot.4 configure -state disabled
581 proc show-message {msg} {
582 .bot.a.message configure -text "$msg"
585 proc insertWithTags {w text args} {
586 set start [$w index insert]
587 $w insert insert $text
588 foreach tag [$w tag names $start] {
589 $w tag remove $tag $start insert
592 $w tag add $i $start insert
596 proc popup-license {} {
601 wm title $w "License"
607 text $w.top.t -width 80 -height 10 -wrap word \
608 -yscrollcommand [list $w.top.s set]
609 scrollbar $w.top.s -command [list $w.top.t yview]
611 pack $w.top.s -side right -fill y
612 pack $w.top.t -expand yes -fill both
614 if {[file readable "${libdir}/LICENSE"]} {
615 set f [open "${libdir}/LICENSE" r]
616 while {[gets $f buf] != -1} {
617 $w.top.t insert end $buf
618 $w.top.t insert end "\n"
622 bottom-buttons $w [list {Close} [list destroy $w]] 1
625 proc about-target {} {
626 set w .about-target-w
631 wm title $w "About target"
635 frame $w.top.a -relief ridge -border 2
636 frame $w.top.p -relief ridge -border 2
638 pack $w.top.a $w.top.p -side top -fill x
640 label $w.top.a.about -text "About"
641 label $w.top.a.irtcl -text $hostid \
642 -font -Adobe-Helvetica-Bold-R-Normal-*-240-*
643 pack $w.top.a.about $w.top.a.irtcl -side top
645 set i [z39 targetImplementationName]
646 label $w.top.p.in -text "Implementation name: $i"
647 set i [z39 targetImplementationId]
648 label $w.top.p.ii -text "Implementation id: $i"
649 set i [z39 targetImplementationVersion]
650 label $w.top.p.iv -text "Implementation version: $i"
652 label $w.top.p.op -text "Protocol options: $i"
654 pack $w.top.p.in $w.top.p.ii $w.top.p.iv $w.top.p.op -side top -anchor nw
656 bottom-buttons $w [list {Close} [list destroy $w]] 1
659 proc about-origin-logo {n} {
661 set w .about-origin-w
662 if {![winfo exists $w]} {
669 $w.top.a.logo configure -bitmap @${libdir}/bitmaps/book$n
670 after 140 [list about-origin-logo $n]
673 proc about-origin {} {
674 set w .about-origin-w
677 if {[winfo exists $w]} {
682 wm title $w "About IrTcl"
686 frame $w.top.a -relief ridge -border 2
687 frame $w.top.p -relief ridge -border 2
689 pack $w.top.a $w.top.p -side top -fill x
691 label $w.top.a.irtcl -text "IrTcl" \
692 -font -Adobe-Helvetica-Bold-R-Normal-*-240-*
693 label $w.top.a.logo -bitmap @${libdir}/bitmaps/book1
694 pack $w.top.a.irtcl $w.top.a.logo -side left -expand yes
696 set i [z39 implementationName]
697 label $w.top.p.in -text "Implementation name: $i"
698 set i [z39 implementationId]
699 label $w.top.p.ii -text "Implementation id: $i"
700 set i [z39 implementationVersion]
701 label $w.top.p.iv -text "Implementation version: $i"
703 pack $w.top.p.in $w.top.p.ii $w.top.p.iv -side top -anchor nw
706 bottom-buttons $w [list {Close} [list destroy $w] \
707 {License} [list popup-license]] 0
710 proc popup-marc {sno no b df} {
712 global displayFormats
715 if {[z39.$sno type $no] != "DB"} {
719 set w .full-marc-$fullMarcSeq
726 if {[winfo exists $w]} {
734 frame $w.top -relief raised -border 1
735 frame $w.bot -relief raised -border 1
737 pack $w.top -side top -fill both -expand yes
738 pack $w.bot -fill both
740 text $w.top.record -width 60 -height 5 -wrap word \
741 -yscrollcommand [list $w.top.s set]
742 scrollbar $w.top.s -command [list $w.top.record yview]
746 $w.top.record tag configure marc-tag -foreground blue
747 $w.top.record tag configure marc-id -foreground red
749 $w.top.record tag configure marc-tag -foreground black
750 $w.top.record tag configure marc-id -foreground black
752 $w.top.record tag configure marc-data -foreground black
755 $w.top.record delete 0.0 end
756 set recordType [z39.$sno recordType $no]
757 wm title $w "$recordType record #$no"
760 bind $w.top.record <Return> {destroy .full-marc}
762 pack $w.top.s -side right -fill y
763 pack $w.top.record -expand yes -fill both
766 bottom-buttons $w [list \
767 {Close} [list destroy $w]] 0
769 bottom-buttons $w [list \
770 {Close} [list destroy $w] \
771 {Duplicate} [list popup-marc $sno $no 1 0]] 0
772 menubutton $w.bot.formats -text "Format" -menu $w.bot.formats.m
773 menu $w.bot.formats.m
775 foreach f $displayFormats {
776 $w.bot.formats.m add radiobutton -label $f \
777 -variable popupMarcdf -value $i \
778 -command [list display-$f $sno $no $w.top.record 0]
781 pack $w.bot.formats -expand yes -ipadx 2 -ipady 2 \
782 -padx 3 -pady 3 -side left
786 $w.bot.formats.m delete 0 last
787 foreach f $displayFormats {
788 $w.bot.formats.m add radiobutton -label $f \
789 -variable popupMarcdf -value $i \
790 -command [list display-$f $sno $no $w.top.record 0]
794 set ffunc [lindex $displayFormats $df]
795 set ffunc "display-$ffunc"
797 $ffunc $sno $no $w.top.record 0
800 proc update-target-hotlist {target base} {
803 set olen [llength $hotTargets]
805 foreach e $hotTargets {
806 if {$target == [lindex $e 0] && $base == [lindex $e 1]} {
807 set hotTargets [lreplace $hotTargets $i $i]
812 set hotTargets [linsert $hotTargets 0 [list $target $base]]
813 set-target-hotlist $olen
816 proc delete-target-hotlist {target} {
819 set olen [llength $hotTargets]
821 foreach e $hotTargets {
822 if {$target == [lindex $e 0]} {
823 set hotTargets [lreplace $hotTargets $i $i]
827 set-target-hotlist $olen
830 proc set-target-hotlist {olen} {
835 .top.target.m delete 7 [expr 7+$olen]
837 .top.target.m delete 6 [expr 6+$olen]
841 foreach e $hotTargets {
842 set target [lindex $e 0]
843 set base [lindex $e 1]
845 .top.target.m add command -label "$i $target" -command \
846 [list reopen-target $target {}]
848 .top.target.m add command -label "$i $target - $base" -command \
849 [list reopen-target $target $base]
858 proc reopen-target {target base} {
860 open-target $target $base
861 update-target-hotlist $target $base
864 proc define-target-action {} {
867 set target [.target-define.top.target.entry get]
871 foreach n [array names profile] {
877 set seq [lindex $profile(Default) 12]
879 set profile($target) $profile(Default)
880 set profile(Default) [lreplace $profile(Default) 12 12 [incr seq]]
882 protocol-setup $target
883 destroy .target-define
886 proc fail-response {target} {
887 set c [lindex [z39 failInfo] 0]
888 set m [lindex [z39 failInfo] 1]
893 proc connect-response {target base} {
894 dputs "connect-response"
895 show-target $target $base
899 proc open-target {target base} {
904 z39 comstack [lindex $profile($target) 6]
905 z39 protocol [lindex $profile($target) 11]
906 z39 idAuthentication [lindex $profile($target) 3]
907 z39 maximumRecordSize [lindex $profile($target) 4]
908 z39 preferredMessageSize [lindex $profile($target) 5]
909 dputs "maximumRecordSize="
910 dputs [z39 maximumRecordSize]
911 dputs "preferredMessageSize="
912 dputs [z39 preferredMessageSize]
913 show-status Connecting 1 0
915 z39 databaseNames [lindex [lindex $profile($target) 7] 0]
917 z39 databaseNames $base
919 z39 failback [list fail-response $target]
920 z39 callback [list connect-response $target $base]
923 z39 connect [lindex $profile($target) 1]:[lindex $profile($target) 2]
926 tkerror $errorMessage
927 show-status "Not connected" 0 {}
931 configure-disable-e .top.target.m 0
932 configure-enable-e .top.target.m 1
933 configure-enable-e .top.target.m 2
936 proc close-target {} {
945 .bot.a.set configure -text ""
949 show-status {Not connected} 0 0
952 configure-disable-e .top.target.m 1
953 configure-disable-e .top.target.m 2
955 .top.rset.m delete 2 last
957 .top.rset.m delete 1 last
959 .top.rset.m add separator
960 configure-enable-e .top.target.m 0
963 proc load-set-action {} {
967 ir-set z39.$setNoLast z39
969 set fname [.load-set.top.filename.entry get]
972 show-status Loading 1 {}
974 z39.$setNoLast loadFile $fname
976 set no [z39.$setNoLast numberOfRecordsReturned]
977 add-title-lines $setNoLast $no 1
979 set l [format "%-4d %7d" $setNoLast $no]
980 .top.rset.m add command -label $l \
981 -command [list add-title-lines $setNoLast 10000 1]
982 show-status Ready 0 {}
992 frame $w.top.filename
993 pack $w.top.filename -side top -anchor e -pady 2
995 entry-fields $w.top {filename} \
997 {load-set-action} {destroy .load-set}
999 top-down-ok-cancel $w {load-set-action} 1
1003 proc init-request {} {
1010 z39 callback {init-response}
1011 show-status Initializing 1 {}
1012 set err [catch {z39 init} errorMessage]
1014 tkerror $errorMessage
1015 show-status Ready 0 {}
1019 proc init-response {} {
1027 if {![z39 initResult]} {
1028 show-status Ready 0 1
1029 set u [z39 userInformationField]
1031 tkerror "Connection rejected by target: $u"
1033 if {[lsearch [z39 options] scan] >= 0} {
1038 show-status Ready 0 1
1042 proc search-request {bflag} {
1054 dputs "search-request"
1056 if {!$bflag && $busy} {
1057 dputs "busy: search-request ignored"
1062 show-status Searching 1 0
1063 set delayRequest {search-request 1}
1068 set query [index-query]
1073 set setNo $setNoLast
1074 ir-set z39.$setNo z39
1076 if {[lindex $profile($target) 10] == 1} {
1077 z39.$setNo setName $setNo
1078 dputs "setName=${setNo}"
1080 z39.$setNo setName Default
1081 dputs "setName=Default"
1083 if {[lindex $profile($target) 8] == 1} {
1084 z39.$setNo queryType rpn
1086 if {[lindex $profile($target) 9] == 1} {
1087 z39.$setNo queryType ccl
1091 if {$recordSyntax == "None" } {
1092 z39.$setNo preferredRecordSyntax {}
1094 z39.$setNo preferredRecordSyntax $recordSyntax
1096 z39 callback {search-response}
1097 z39.$setNo search $query
1098 show-status Searching 1 0
1101 proc scan-copy {y entry} {
1103 set no [$w.top.list nearest $y]
1105 .lines.$entry.e delete 0 end
1106 .lines.$entry.e insert 0 [string range [$w.top.list get $no] 8 end]
1109 proc scan-request {} {
1116 global curIndexEntry
1117 global queryButtonsFind
1118 global queryInfoFind
1122 dputs "scan-request"
1125 show-status Scanning 1 0
1126 set delayRequest scan-request
1135 set b [lindex $queryButtonsFind $curIndexEntry]
1137 foreach a [lrange [lindex $queryInfoFind [lindex $b 1]] 1 end] {
1138 set attr "@attr $a $attr"
1140 set title [lindex [lindex $queryInfoFind [lindex $b 1]] 0]
1141 ir-scan z39.scan z39
1143 if {![winfo exists $w]} {
1150 entry $w.top.entry -relief sunken
1151 pack $w.top.entry -fill x -padx 4 -pady 2
1152 bind $w.top.entry <KeyRelease> [list scan-term-h $attr]
1153 listbox $w.top.list -yscrollcommand [list $w.top.scroll set] \
1155 scrollbar $w.top.scroll -orient vertical -border 1
1156 pack $w.top.list -side left -fill both -expand yes
1157 pack $w.top.scroll -side right -fill y
1158 $w.top.scroll config -command [list $w.top.list yview]
1160 bottom-buttons $w [list {Close} [list destroy $w] \
1161 {Up} [list scan-up $attr] \
1162 {Down} [list scan-down $attr]] 0
1163 bind $w.top.list <Up> [list scan-up $attr]
1164 bind $w.top.list <Down> [list scan-down $attr]
1167 bind $w.top.list <Double-Button-1> [list scan-copy %y $curIndexEntry]
1168 wm title $w "Scan $title"
1170 z39 callback [list scan-response $attr 0 35]
1171 z39.scan numberOfTermsRequested 5
1172 z39.scan preferredPositionInResponse 1
1173 z39.scan scan "${attr} 0"
1175 show-status Scanning 1 0
1178 proc scan-term-h {attr} {
1186 set nScanTerm [$w.top.entry get]
1187 if {$nScanTerm == $scanTerm} {
1190 set scanTerm $nScanTerm
1191 z39 callback [list scan-response $attr 0 35]
1192 z39.scan numberOfTermsRequested 5
1193 z39.scan preferredPositionInResponse 1
1194 dputs "${attr} \{${scanTerm}\}"
1195 if {$scanTerm == ""} {
1196 z39.scan scan "${attr} 0"
1198 z39.scan scan "${attr} \{${scanTerm}\}"
1200 show-status Scanning 1 0
1203 proc scan-response {attr start toget} {
1210 dputs "In scan-response"
1211 set m [z39.scan numberOfEntriesReturned]
1217 if {![winfo exists .scan-window]} {
1220 dputs "Handling cancel"
1221 if {$delayRequest != ""} {
1226 show-status Ready 0 1
1229 set nScanTerm [$w.top.entry get]
1230 if {$nScanTerm != $scanTerm} {
1231 z39 callback [list scan-response $attr 0 35]
1232 z39.scan numberOfTermsRequested 5
1233 z39.scan preferredPositionInResponse 1
1234 set scanTerm $nScanTerm
1235 dputs "${attr} \{${scanTerm}\}"
1236 if {$scanTerm == ""} {
1237 z39.scan scan "${attr} 0"
1239 z39.scan scan "${attr} \{${scanTerm}\}"
1241 show-status Scanning 1 0
1244 set status [z39.scan scanStatus]
1247 show-status Ready 0 1
1252 for {set i 0} {$i < $m} {incr i} {
1253 set term [lindex [z39.scan scanLine $i] 1]
1254 set nostr [format " %-6d" [lindex [z39.scan scanLine $i] 2]]
1255 $w.top.list insert $i "$nostr $term"
1258 $w.top.list yview $scanView
1260 $w.top.list delete $start end
1261 for {set i 0} {$i < $m} {incr i} {
1262 set term [lindex [z39.scan scanLine $i] 1]
1263 set nostr [format " %-6d" [lindex [z39.scan scanLine $i] 2]]
1264 $w.top.list insert end "$nostr $term"
1268 dputs "Handling cancel"
1270 if {$delayRequest != ""} {
1276 if {$toget > 0 && $m > 1 && $m < $toget} {
1277 set ntoget [expr $toget - $m + 1]
1278 dputs ntoget=$ntoget
1279 z39 callback [list scan-response $attr [expr $start + $m - 1] $ntoget]
1281 dputs "down continue: $q"
1283 z39.scan numberOfTermsRequested 10
1285 z39.scan numberOfTermsRequested $ntoget
1287 z39.scan preferredPositionInResponse 1
1288 dputs "${attr} \{$q\}"
1289 z39.scan scan "${attr} \{$q\}"
1292 if {$toget < 0 && $m > 1 && $m < [expr - $toget]} {
1293 set ntoget [expr - $toget - $m]
1294 dputs ntoget=$ntoget
1295 z39 callback [list scan-response $attr 0 -$ntoget]
1296 set q [string range [$w.top.list get 0] 8 end]
1297 dputs "up continue: $q"
1299 z39.scan numberOfTermsRequested 10
1300 z39.scan preferredPositionInResponse 11
1302 z39.scan numberOfTermsRequested $ntoget
1303 z39.scan preferredPositionInResponse [incr ntoget]
1305 dputs "${attr} \{$q\}"
1306 z39.scan scan "${attr} \{$q\}"
1309 show-status Ready 0 1
1312 proc scan-down {attr} {
1320 show-status {Scanning down} 1 0
1321 set delayRequest [list scan-down $attr]
1327 set scanView [expr $scanView + 5]
1328 set s [$w.top.list size]
1329 if {$scanView > $s} {
1330 z39 callback [list scan-response $attr [expr $s - 1] 25]
1331 set q [string range [$w.top.list get [expr $s - 1]] 8 end]
1333 z39.scan numberOfTermsRequested 10
1334 z39.scan preferredPositionInResponse 1
1335 show-status Scanning 1 0
1336 dputs "${attr} \{$q\}"
1337 z39.scan scan "${attr} \{$q\}"
1340 $w.top.list yview $scanView
1343 proc scan-up {attr} {
1351 show-status Scanning 1 0
1352 set delayRequest [list scan-up $attr]
1358 set scanView [expr $scanView - 5]
1359 if {$scanView < 0} {
1360 z39 callback [list scan-response $attr 0 -25]
1361 set q [string range [$w.top.list get 0] 8 end]
1363 z39.scan numberOfTermsRequested 10
1364 z39.scan preferredPositionInResponse 11
1365 show-status Scanning 1 0
1366 z39.scan scan "${attr} \{$q\}"
1369 $w.top.list yview $scanView
1372 proc search-response {} {
1380 dputs "In search-response"
1382 dputs "Handling cancel"
1384 if {$delayRequest != ""} {
1392 set setMax [z39.$setNo resultCount]
1393 show-status Ready 0 1
1394 set status [z39.$setNo responseStatus]
1395 if {[lindex $status 0] == "NSD"} {
1396 z39.$setNo nextResultSetPosition 0
1397 set code [lindex $status 1]
1398 set msg [lindex $status 2]
1399 set addinfo [lindex $status 3]
1400 tkerror "NSD$code: $msg: $addinfo"
1403 show-message "${setMax} hits"
1408 show-status Ready 0 1
1409 set l [format "%-4d %7d" $setNo $setMax]
1410 .top.rset.m add command -label $l \
1411 -command [list add-title-lines $setNo 10000 1]
1415 z39 callback {present-response}
1416 z39.$setNo present $setOffset 1
1417 show-status Retrieving 1 0
1420 proc present-more {number} {
1428 dputs "present-more"
1430 show-status Retrieving 1 0
1431 set delayRequest "present-more $number"
1437 dputs "setNo=$setNo"
1440 set setOffset [z39.$setNo nextResultSetPosition]
1441 dputs "setOffest=${setOffset}"
1442 dputs "setNo=${setNo}"
1443 set max [z39.$setNo resultCount]
1444 if {$max < $setOffset} {
1446 dputs "setOffset=$setOffset"
1447 show-status Ready 0 1
1450 if {$number == ""} {
1454 if {$setMax > $max} {
1458 z39 callback {present-response}
1460 set toGet [expr $setMax - $setOffset + 1]
1467 z39.$setNo present $setOffset $toGet
1468 show-status Retrieving 1 0
1471 proc init-title-lines {} {
1472 .data.record delete 0.0 end
1475 proc title-press {y setno} {
1476 show-full-marc $setno [expr 1 + [.data.list nearest $y]] 0
1479 proc add-title-lines {setno no offset} {
1480 global displayFormats
1481 global displayFormat
1491 .bot.a.set configure -text $setno
1492 .data.record delete 0.0 end
1494 set ffunc [lindex $displayFormats $displayFormat]
1495 dputs "ffunc=$ffunc"
1496 set ffunc "display-$ffunc"
1497 for {set i 0} {$i < $no} {incr i} {
1498 set o [expr $i + $offset]
1499 set type [z39.$setno type $o]
1503 .data.record tag bind r$o <Any-Enter> {}
1504 .data.record tag bind r$o <Any-Leave> {}
1505 set insert0 [.data.record index insert]
1506 $ffunc $setno $o .data.record 1
1507 .data.record tag add r$o $insert0 insert
1508 .data.record tag bind r$o <1> \
1509 [list popup-marc $setno $o 0 0]
1513 show-status Ready 0 1
1517 proc present-response {} {
1524 dputs "In present-response"
1525 set no [z39.$setNo numberOfRecordsReturned]
1526 dputs "Returned $no records, setOffset $setOffset"
1527 add-title-lines $setNo $no $setOffset
1528 set setOffset [expr $setOffset + $no]
1530 dputs "Handling cancel"
1532 if {$delayRequest != ""} {
1537 set status [z39.$setNo responseStatus]
1538 if {[lindex $status 0] == "NSD"} {
1539 show-status Ready 0 1
1540 set code [lindex $status 1]
1541 set msg [lindex $status 2]
1542 set addinfo [lindex $status 3]
1543 tkerror "NSD$code: $msg: $addinfo"
1546 if {$no > 0 && $setOffset <= $setMax} {
1547 dputs "present-request from ${setOffset}"
1548 set toGet [expr $setMax - $setOffset + 1]
1552 z39.$setNo present $setOffset $toGet
1554 show-status Ready 0 1
1558 proc left-cursor {w} {
1559 set i [$w index insert]
1567 proc right-cursor {w} {
1568 set i [$w index insert]
1574 proc bind-fields {list returnAction escapeAction} {
1575 set max [expr [llength $list]-1]
1576 for {set i 0} {$i < $max} {incr i} {
1577 bind [lindex $list $i] <Return> $returnAction
1578 bind [lindex $list $i] <Escape> $escapeAction
1580 bind [lindex $list $i] <Tab> \
1581 [list focus [lindex $list [expr $i+1]]]
1582 bind [lindex $list $i] <Left> \
1583 [list left-cursor [lindex $list $i]]
1584 bind [lindex $list $i] <Right> \
1585 [list right-cursor [lindex $list $i]]
1588 bind [lindex $list $i] <Return> $returnAction
1589 bind [lindex $list $i] <Escape> $escapeAction
1591 bind [lindex $list $i] <Tab> [list focus [lindex $list 0]]
1592 bind [lindex $list $i] <Left> [list left-cursor [lindex $list $i]]
1593 bind [lindex $list $i] <Right> [list right-cursor [lindex $list $i]]
1595 focus [lindex $list 0]
1598 proc entry-fields {parent list tlist returnAction escapeAction} {
1601 foreach field $list {
1602 set label ${parent}.${field}.label
1603 set entry ${parent}.${field}.entry
1604 label $label -text [lindex $tlist $i] -anchor e
1605 entry $entry -width 32 -relief sunken
1606 pack $label -side left
1607 pack $entry -side right
1608 lappend alist $entry
1611 bind-fields $alist $returnAction $escapeAction
1614 proc define-target-dialog {} {
1615 set w .target-define
1621 pack $w.top.target \
1622 -side top -anchor e -pady 2
1623 entry-fields $w.top {target} \
1625 {define-target-action} {destroy .target-define}
1626 top-down-ok-cancel $w {define-target-action} 1
1629 proc protocol-setup-delete {target} {
1631 global settingsChanged
1633 set a [alert "Are you sure you want to delete the target \
1634 definition $target ?"]
1636 set wno [lindex $profile($target) 12]
1639 unset profile($target)
1640 set settingsChanged 1
1642 delete-target-hotlist $target
1646 proc protocol-setup-action {target} {
1649 global protocolRadioType
1650 global settingsChanged
1653 global ResultSetCheck
1655 set wno [lindex $profile($target) 12]
1659 set settingsChanged 1
1660 set len [$w.top.databases.list size]
1661 for {set i 0} {$i < $len} {incr i} {
1662 lappend b [$w.top.databases.list get $i]
1664 set profile($target) [list [$w.top.description.entry get] \
1665 [$w.top.host.entry get] \
1666 [$w.top.port.entry get] \
1667 [$w.top.idAuthentication.entry get] \
1668 [$w.top.maximumRecordSize.entry get] \
1669 [$w.top.preferredMessageSize.entry get] \
1675 $protocolRadioType \
1679 delete-target-hotlist $target
1680 dputs $profile($target)
1684 proc place-force {window parent} {
1685 set g [wm geometry $parent]
1687 set p1 [string first + $g]
1688 set p2 [string last + $g]
1690 set x [expr 40+[string range $g [expr $p1 +1] [expr $p2 -1]]]
1691 set y [expr 60+[string range $g [expr $p2 +1] end]]
1692 wm geometry $window +${x}+${y}
1695 proc add-database-action {target} {
1698 set wno [lindex $profile($target) 12]
1701 $w.top.databases.list insert end \
1702 [.database-select.top.database.entry get]
1703 destroy .database-select
1706 proc add-database {target} {
1709 set w .database-select
1711 set oldFocus [focus]
1713 set wno [lindex $profile($target) 12]
1714 place-force $w .setup-${wno}
1718 frame $w.top.database
1720 pack $w.top.database -side top -anchor e -pady 2
1722 entry-fields $w.top {database} \
1723 {{Database to add:}} \
1724 [list add-database-action $target] {destroy .database-select}
1726 top-down-ok-cancel $w [list add-database-action $target] 1
1730 proc delete-database {target} {
1733 set wno [lindex $profile($target) 12]
1736 foreach i [$w.top.databases.list curselection] {
1737 set b [$w.top.databases.list get $i]
1740 set a [alert "Are you sure you want to remove the database(s)${l}?"]
1742 foreach i [lsort -decreasing \
1743 [$w.top.databases.list curselection]] {
1744 $w.top.databases.list delete $i
1749 proc protocol-setup {target} {
1752 global protocolRadioType
1755 global ResultSetCheck
1757 set wno [lindex $profile($target) 12]
1762 wm title $w "Setup $target"
1766 if {$target == ""} {
1770 dputs $profile($target)
1772 frame $w.top.description
1775 frame $w.top.idAuthentication
1776 frame $w.top.maximumRecordSize
1777 frame $w.top.preferredMessageSize
1778 frame $w.top.cs-type -relief ridge -border 2
1779 frame $w.top.protocol -relief ridge -border 2
1780 frame $w.top.query -relief ridge -border 2
1781 frame $w.top.databases -relief ridge -border 2
1783 # Maximum/preferred/idAuth ...
1784 pack $w.top.description $w.top.host $w.top.port \
1785 $w.top.idAuthentication $w.top.maximumRecordSize \
1786 $w.top.preferredMessageSize -side top -anchor e -pady 2
1788 entry-fields $w.top {description host port idAuthentication \
1789 maximumRecordSize preferredMessageSize} \
1790 {{Description:} {Host:} {Port:} {Id Authentication:} \
1791 {Maximum Record Size:} {Preferred Message Size:}} \
1792 [list protocol-setup-action $target] [list destroy $w]
1794 foreach sub {description host port idAuthentication \
1795 maximumRecordSize preferredMessageSize} {
1797 bind $w.top.$sub.entry <Control-a> [list add-database $target]
1798 bind $w.top.$sub.entry <Control-d> [list delete-database $target]
1800 $w.top.description.entry insert 0 [lindex $profile($target) 0]
1801 $w.top.host.entry insert 0 [lindex $profile($target) 1]
1802 $w.top.port.entry insert 0 [lindex $profile($target) 2]
1803 $w.top.idAuthentication.entry insert 0 [lindex $profile($target) 3]
1804 $w.top.maximumRecordSize.entry insert 0 [lindex $profile($target) 4]
1805 $w.top.preferredMessageSize.entry insert 0 [lindex $profile($target) 5]
1806 set csRadioType [lindex $profile($target) 6]
1807 set RPNCheck [lindex $profile($target) 8]
1808 set CCLCheck [lindex $profile($target) 9]
1809 set ResultSetCheck [lindex $profile($target) 10]
1810 set protocolRadioType [lindex $profile($target) 11]
1811 if {$protocolRadioType == ""} {
1812 set protocolRadioType Z39
1816 pack $w.top.databases -side left -pady 4 -padx 4 -expand yes -fill both
1818 label $w.top.databases.label -text "Databases"
1819 button $w.top.databases.add -text "Add" \
1820 -command [list add-database $target]
1821 button $w.top.databases.delete -text "Delete" \
1822 -command [list delete-database $target]
1824 listbox $w.top.databases.list -geometry 20x6 \
1825 -yscrollcommand "$w.top.databases.scroll set"
1827 listbox $w.top.databases.list -width 20 \
1828 -yscrollcommand "$w.top.databases.scroll set"
1830 scrollbar $w.top.databases.scroll -orient vertical -border 1
1831 pack $w.top.databases.label -side top -fill x \
1833 pack $w.top.databases.add $w.top.databases.delete -side top -fill x \
1835 pack $w.top.databases.list -side left -fill both -expand yes \
1837 pack $w.top.databases.scroll -side right -fill y \
1839 $w.top.databases.scroll config -command "$w.top.databases.list yview"
1841 foreach b [lindex $profile($target) 7] {
1842 $w.top.databases.list insert end $b
1846 pack $w.top.cs-type -pady 4 -padx 4 -side top -fill x
1848 label $w.top.cs-type.label -text "Transport"
1849 radiobutton $w.top.cs-type.tcpip -text "TCP/IP" -anchor w \
1850 -variable csRadioType -value tcpip
1851 radiobutton $w.top.cs-type.mosi -text "MOSI" -anchor w\
1852 -variable csRadioType -value mosi
1854 pack $w.top.cs-type.label $w.top.cs-type.tcpip $w.top.cs-type.mosi \
1855 -padx 4 -side top -fill x
1858 pack $w.top.protocol -pady 4 -padx 4 -side top -fill x
1860 label $w.top.protocol.label -text "Protocol"
1861 radiobutton $w.top.protocol.z39v2 -text "Z39.50" -anchor w \
1862 -variable protocolRadioType -value Z39
1863 radiobutton $w.top.protocol.sr -text "SR" -anchor w \
1864 -variable protocolRadioType -value SR
1866 pack $w.top.protocol.label $w.top.protocol.z39v2 $w.top.protocol.sr \
1867 -padx 4 -side top -fill x
1870 pack $w.top.query -pady 4 -padx 4 -side top -fill x
1872 label $w.top.query.label -text "Query support"
1873 checkbutton $w.top.query.c1 -text "RPN query" -anchor w -variable RPNCheck
1874 checkbutton $w.top.query.c2 -text "CCL query" -anchor w -variable CCLCheck
1875 checkbutton $w.top.query.c3 -text "Result sets" -anchor w -variable ResultSetCheck
1877 pack $w.top.query.label -side top
1878 pack $w.top.query.c1 $w.top.query.c2 $w.top.query.c3 \
1879 -padx 4 -side top -fill x
1882 bottom-buttons $w [list {Ok} [list protocol-setup-action $target] \
1883 {Delete} [list protocol-setup-delete $target] \
1884 {Cancel} [list destroy $w]] 0
1887 proc database-select-action {} {
1888 set w .database-select.top
1890 foreach indx [$w.databases.list curselection] {
1891 lappend b [$w.databases.list get $indx]
1894 z39 databaseNames $b
1896 destroy .database-select
1899 proc database-select {} {
1900 set w .database-select
1905 set oldFocus [focus]
1910 frame $w.top.databases -relief ridge -border 2
1912 pack $w.top.databases -side left -pady 6 -padx 6 -expand yes -fill x
1914 label $w.top.databases.label -text "List"
1915 listbox $w.top.databases.list -width 20 -height 6 \
1916 -yscrollcommand "$w.top.databases.scroll set"
1917 scrollbar $w.top.databases.scroll -orient vertical -border 1
1918 pack $w.top.databases.label -side top -fill x \
1920 pack $w.top.databases.list -side left -fill both -expand yes \
1922 pack $w.top.databases.scroll -side right -fill y \
1924 $w.top.databases.scroll config -command "$w.top.databases.list yview"
1926 foreach b [lindex $profile($hostid) 7] {
1927 $w.top.databases.list insert end $b
1929 top-down-ok-cancel $w {database-select-action} 1
1933 proc cascade-target-list {} {
1936 foreach sub [winfo children .top.target.m.clist] {
1939 .top.target.m.clist delete 0 last
1940 foreach n [lsort [array names profile]] {
1941 if {$n != "Default"} {
1942 set nl [lindex $profile($n) 12]
1943 if {[llength [lindex $profile($n) 7]] > 1} {
1944 .top.target.m.clist add cascade -label $n \
1945 -menu .top.target.m.clist.$nl
1946 menu .top.target.m.clist.$nl
1947 foreach b [lindex $profile($n) 7] {
1948 .top.target.m.clist.$nl add command -label $b \
1949 -command [list reopen-target $n $b]
1952 .top.target.m.clist add command -label $n \
1953 -command [list reopen-target $n {}]
1957 .top.target.m.slist delete 0 last
1958 foreach n [lsort [array names profile]] {
1959 if {$n != "Default"} {
1960 .top.target.m.slist add command -label $n \
1961 -command [list protocol-setup $n]
1966 proc query-select {i} {
1967 global queryButtonsFind
1968 global queryInfoFind
1972 set queryInfoFind [lindex $queryInfo $i]
1973 set queryButtonsFind [lindex $queryButtons $i]
1975 index-lines .lines 1 $queryButtonsFind $queryInfoFind activate-index
1978 proc query-new-action {} {
1982 global settingsChanged
1984 set settingsChanged 1
1985 lappend queryTypes [.query-new.top.index.entry get]
1986 lappend queryButtons {}
1987 lappend queryInfo {}
1997 set oldFocus [focus]
2002 -side top -anchor e -pady 2
2003 entry-fields $w.top index \
2005 query-new-action {destroy .query-new}
2006 top-down-ok-cancel $w query-new-action 1
2010 proc query-delete-action {queryNo} {
2014 global settingsChanged
2016 set settingsChanged 1
2018 set queryTypes [lreplace $queryTypes $queryNo $queryNo]
2019 set queryButtons [lreplace $queryButtons $queryNo $queryNo]
2020 set queryInfo [lreplace $queryInfo $queryNo $queryNo]
2021 destroy .query-delete
2025 proc query-delete {queryNo} {
2033 set n [lindex $queryTypes $queryNo]
2035 label $w.top.warning -bitmap warning
2036 message $w.top.quest -text "Are you sure you want to delete the \
2037 query type $n ?" -aspect 300
2038 pack $w.top.warning $w.top.quest -side left -expand yes -padx 10 -pady 5
2039 bottom-buttons $w [list {Ok} [list query-delete-action $queryNo] \
2040 {Cancel} [list destroy $w]] 1
2043 proc cascade-query-list {} {
2045 set w .top.options.m.query
2048 $w.slist delete 0 last
2049 foreach n $queryTypes {
2050 $w.slist add command -label $n -command [list query-setup $i]
2055 $w.clist delete 0 last
2056 foreach n $queryTypes {
2057 $w.clist add command -label $n -command [list query-select $i]
2061 $w.dlist delete 0 last
2062 foreach n $queryTypes {
2063 $w.dlist add command -label $n -command [list query-delete $i]
2068 proc save-geometry {} {
2069 global windowGeometry
2072 global displayFormat
2076 set windowGeometry(.) [wm geometry .]
2078 set f [open "~/.clientrc.tcl" w]
2080 puts $f "set hotTargets \{ $hotTargets \}"
2081 puts $f "set textWrap $textWrap"
2082 puts $f "set displayFormat $displayFormat"
2083 puts $f "set popupMarcdf $popupMarcdf"
2084 puts $f "set recordSyntax $recordSyntax"
2085 foreach n [array names windowGeometry] {
2086 puts -nonewline $f "set \{windowGeometry($n)\} \{"
2087 puts -nonewline $f $windowGeometry($n)
2093 proc save-settings {} {
2096 global settingsChanged
2101 if {![file writable "${libdir}/clientrc.tcl"]} {
2102 set a [alert "Cannot open ${libdir}/clientrc.tcl for writing. Do you \
2103 wish to save clientrc.tcl in the current directory instead?"]
2107 set f [open "clientrc.tcl" w]
2109 set f [open "${libdir}/clientrc.tcl" w]
2111 puts $f "# Setup file"
2113 foreach n [array names profile] {
2114 puts -nonewline $f "set \{profile($n)\} \{"
2115 puts -nonewline $f $profile($n)
2118 puts -nonewline $f "set queryTypes \{"
2119 puts -nonewline $f $queryTypes
2122 puts -nonewline $f "set queryButtons \{"
2123 puts -nonewline $f $queryButtons
2126 puts -nonewline $f "set queryInfo \{"
2127 puts -nonewline $f $queryInfo
2130 set settingsChanged 0
2139 set oldFocus [focus]
2143 label $w.top.warning -bitmap warning
2144 message $w.top.message -text $ask -aspect 300 \
2145 -font -Adobe-Times-Medium-R-Normal-*-180-*
2147 pack $w.top.warning $w.top.message -side left -pady 5 -padx 10 -expand yes
2150 top-down-ok-cancel $w {alert-action} 1
2155 proc alert-action {} {
2161 proc exit-action {} {
2162 global settingsChanged
2164 if {$settingsChanged} {
2165 set a [alert "you haven't saved your settings. Do you wish to save?"]
2174 proc listbuttonaction {w name h user i} {
2175 $w configure -text [lindex $name 0]
2176 $h [lindex $name 1] $user $i
2179 proc listbuttonx {button no names handle user} {
2180 if {[winfo exists $button]} {
2181 $button configure -text [lindex [lindex $names $no] 0]
2182 ${button}.m delete 0 last
2184 menubutton $button -text [lindex [lindex $names $no] 0] \
2185 -width 10 -menu ${button}.m -relief raised -border 1
2189 foreach name $names {
2190 ${button}.m add command -label [lindex $name 0] \
2191 -command [list listbuttonaction ${button} $name \
2197 proc listbutton {button no names} {
2198 menubutton $button -text [lindex $names $no] -width 10 -menu ${button}.m \
2199 -relief raised -border 1
2201 foreach name $names {
2202 ${button}.m add command -label $name \
2203 -command [list ${button} configure -text $name]
2207 proc listbuttonv-action {button var names i} {
2210 set $var [lindex $names [expr $i+1]]
2211 $button configure -text [lindex $names $i]
2214 proc listbuttonv {button var names} {
2218 eval "set val $$var"
2219 set l [llength $names]
2220 for {set i 1} {$i < $l} {incr i 2} {
2221 if {$val == [lindex $names $i]} {
2223 set n [lindex $names $i]
2227 if {[winfo exists $button]} {
2228 $button configure -text $n
2231 menubutton $button -text $n -menu ${button}.m \
2232 -relief raised -border 1
2234 for {set i 0} {$i < $l} {incr i 2} {
2235 ${button}.m add command -label [lindex $names $i] \
2236 -command [list listbuttonv-action $button $var $names $i]
2240 proc query-add-index-action {queryNo} {
2244 global queryButtonsTmp
2246 set newI [.query-add-index.top.index.entry get]
2247 lappend queryInfoTmp [list $newI {}]
2248 $w.top.index.list insert end $newI
2249 destroy .query-add-index
2250 #destroy $w.top.lines
2251 #frame $w.top.lines -relief ridge -border 2
2252 index-lines $w.top.lines 0 $queryButtonsTmp $queryInfoTmp activate-e-index
2253 #pack $w.top.lines -side left -pady 6 -padx 6 -fill y
2256 proc query-add-line {queryNo} {
2260 global queryButtonsTmp
2262 lappend queryButtonsTmp {I 0}
2264 #destroy $w.top.lines
2265 #frame $w.top.lines -relief ridge -border 2
2266 index-lines $w.top.lines 0 $queryButtonsTmp $queryInfoTmp activate-e-index
2267 #pack $w.top.lines -side left -pady 6 -padx 6 -fill y
2270 proc query-del-line {queryNo} {
2274 global queryButtonsTmp
2276 set l [llength $queryButtonsTmp]
2281 set queryButtonsTmp [lreplace $queryButtonsTmp $l $l]
2282 index-lines $w.top.lines 0 $queryButtonsTmp $queryInfoTmp activate-e-index
2285 proc query-add-index {queryNo} {
2286 set w .query-add-index
2289 set oldFocus [focus]
2290 place-force $w .query-setup
2294 -side top -anchor e -pady 2
2295 entry-fields $w.top {index} \
2297 [list query-add-index-action $queryNo] [list destroy $w]
2298 top-down-ok-cancel $w [list query-add-index-action $queryNo] 1
2302 proc query-setup-action {queryNo} {
2305 global queryButtonsTmp
2307 global queryButtonsFind
2308 global queryInfoFind
2310 global settingsChanged
2312 set settingsChanged 1
2314 set queryInfo [lreplace $queryInfo $queryNo $queryNo \
2316 set queryButtons [lreplace $queryButtons $queryNo $queryNo \
2318 set queryInfoFind $queryInfoTmp
2319 set queryButtonsFind $queryButtonsTmp
2321 destroy .query-setup
2322 index-lines .lines 1 $queryButtonsFind $queryInfoFind activate-index
2325 proc activate-e-index {value no i} {
2326 global queryButtonsTmp
2327 global queryIndexTmp
2329 set queryButtonsTmp [lreplace $queryButtonsTmp $no $no [list I $i]]
2330 dputs $queryButtonsTmp
2331 set queryIndexTmp $i
2334 proc activate-index {value no i} {
2335 global queryButtonsFind
2337 set queryButtonsFind [lreplace $queryButtonsFind $no $no [list I $i]]
2339 dputs "queryButtonsFind $queryButtonsFind"
2342 proc update-attr {} {
2344 listbuttonv $w.top.relation.b relationTmpValue\
2345 {{None} 0 {Less than} 1 {Greater than or equal} 2 {Equal} 3 \
2346 {Greater than or equal} 4 {Greater than} 5 {Not equal} 6 \
2347 {Phonetic} 100 {Stem} 101 {Relevance} 102 {AlwaysMatches} 103}
2348 listbuttonv $w.top.position.b positionTmpValue {{None} 0 \
2349 {First in field} 1 {First in subfield} 2 {Any position in field} 3}
2350 listbuttonv $w.top.structure.b structureTmpValue {{None} 0 {Phrase} 1 \
2351 {Word} 2 {Key} 3 {Year} 4 {Date (norm)} 5 {Word list} 6 \
2352 {Date (un-norm)} 100 {Name (norm)} 101 {Date (un-norm)} 102 \
2353 {Structure} 103 {urx} 104 {free-form} 105 {doc-text} 106 \
2354 {local-number} 107 {string} 108 {numeric string} 109}
2355 listbuttonv $w.top.truncation.b truncationTmpValue {{Auto} 0 {Right} 1 \
2356 {Left} 2 {Left and right} 3 {No truncation} 100 \
2357 {Process #} 101 {Re-1} 102 {Re-2} 103}
2358 listbuttonv $w.top.completeness.b completenessTmpValue {{None} 0 \
2359 {Incomplete subfield} 1 {Complete subfield} 2 {Complete field} 3}
2362 proc use-attr {init} {
2374 {BNB card number} 10
2375 {BGF(sic) number} 11
2377 {Dewey classification} 13
2378 {UDC classification} 14
2379 {Bliss classification} 15
2381 {NLM call number} 17
2382 {NAL call number} 18
2383 {MOS call number} 19
2384 {Local classification} 20
2385 {Subject heading} 21
2387 {BDI-index-subject} 23
2391 {LC-subject-heading} 27
2392 {RVM-subject-heading} 28
2393 {Local subject index} 29
2395 {Date of publication} 31
2396 {Date of acquisition} 32
2398 {Title-collective} 34
2401 {Title-added-title-page} 37
2405 {Title-other-variant} 41
2407 {Title-abbreviated} 43
2411 {Subject-subdivision} 47
2412 {Number-natl-bibliography} 48
2413 {Number-legal-deposit} 49
2414 {Number-govt-publication} 50
2415 {Number-publisher-for-music} 51
2417 {Number-local-call} 53
2419 {Code-geographic-area} 55
2420 {Code-institution} 56
2422 {Name-geographic} 58
2423 {Place-publication} 59
2425 {Microform-generation} 61
2432 {Author-name-personal} 1004
2433 {Author-name-corporate} 1005
2434 {Author-name-conference} 1006
2435 {Identifier-standard} 1007
2436 {Subject-LC-children's} 1008
2437 {Subject-name-personal} 1009
2439 {Date/time added to database} 1011
2440 {Date/time last modified} 1012
2441 {Authority/format identifier} 1013
2443 {Concept-reference} 1015
2445 {Server choice} 1017
2447 {Record source} 1019
2450 {Geographic class} 1022
2454 {Related periodical} 1026
2455 {Report number} 1027
2457 {Thematic number} 1030
2458 {Material type} 1031
2466 set l [llength $attr]
2471 for {set i 0} {$i < $l} {incr i} {
2472 $w.top.use.list insert end [lindex $attr $i]
2474 if {$useTmpValue == [lindex $attr $i]} {
2480 $w.top.use.list selection clear 0 end
2481 $w.top.use.list selection set $s $s
2483 $w.top.use.list select from $s
2484 $w.top.use.list select to $s
2490 $w.top.use.list yview $s
2492 set lno [lindex [$w.top.use.list curselection] 0]
2493 set i [expr $lno+$lno+1]
2494 set useTmpValue [lindex $attr $i]
2495 dputs "useTmpValue=$useTmpValue"
2499 proc index-setup-action {oldAttr queryNo indexNo} {
2500 set attr [lindex $oldAttr 0]
2503 global relationTmpValue
2504 global structureTmpValue
2505 global truncationTmpValue
2506 global completenessTmpValue
2507 global positionTmpValue
2512 dputs "index-setup-action"
2513 dputs "queryNo $queryNo"
2514 dputs "indexNo $indexNo"
2515 if {$useTmpValue > 0} {
2516 lappend attr "1=$useTmpValue"
2518 if {$relationTmpValue > 0} {
2519 lappend attr "2=$relationTmpValue"
2521 if {$positionTmpValue > 0} {
2522 lappend attr "3=$positionTmpValue"
2524 if {$structureTmpValue > 0} {
2525 lappend attr "4=$structureTmpValue"
2527 if {$truncationTmpValue > 0} {
2528 lappend attr "5=$truncationTmpValue"
2530 if {$completenessTmpValue > 0} {
2531 lappend attr "6=$completenessTmpValue"
2533 dputs "new attr $attr"
2534 set queryInfoTmp [lreplace $queryInfoTmp $indexNo $indexNo $attr]
2535 destroy .index-setup
2538 proc index-setup {attr queryNo indexNo} {
2541 global relationTmpValue
2542 global structureTmpValue
2543 global truncationTmpValue
2544 global completenessTmpValue
2545 global positionTmpValue
2547 set relationTmpValue 0
2548 set truncationTmpValue 0
2549 set structureTmpValue 0
2550 set positionTmpValue 0
2551 set completenessTmpValue 0
2554 set len [llength $attr]
2555 for {set i 1} {$i < $len} {incr i} {
2556 set q [lindex $attr $i]
2557 set l [string first = $q]
2559 set t [string range $q 0 [expr $l - 1]]
2560 set v [string range $q [expr $l + 1] end]
2563 { set useTmpValue $v }
2565 { set relationTmpValue $v }
2567 { set positionTmpValue $v }
2569 { set structureTmpValue $v }
2571 { set truncationTmpValue $v }
2573 { set completenessTmpValue $v }
2577 if {[winfo exists $w]} {
2582 set n [lindex $attr 0]
2583 wm title $w "Index setup $n"
2587 frame $w.top.use -relief ridge -border 2
2588 frame $w.top.relation -relief ridge -border 2
2589 frame $w.top.position -relief ridge -border 2
2590 frame $w.top.structure -relief ridge -border 2
2591 frame $w.top.truncation -relief ridge -border 2
2592 frame $w.top.completeness -relief ridge -border 2
2598 pack $w.top.use -side left -pady 6 -padx 6 -fill y
2600 label $w.top.use.label -text "Use"
2602 listbox $w.top.use.list -width 26 \
2603 -yscrollcommand "$w.top.use.scroll set"
2605 listbox $w.top.use.list -geometry 26x10 \
2606 -yscrollcommand "$w.top.use.scroll set"
2608 scrollbar $w.top.use.scroll -orient vertical -border 1
2609 pack $w.top.use.label -side top -fill x \
2611 pack $w.top.use.list -side left -fill both -expand yes \
2613 pack $w.top.use.scroll -side right -fill y \
2615 $w.top.use.scroll config -command "$w.top.use.list yview"
2619 # Relation Attributes
2621 pack $w.top.relation -pady 6 -padx 6 -side top
2622 label $w.top.relation.label -text "Relation" -width 18
2624 pack $w.top.relation.label $w.top.relation.b -fill x
2626 # Position Attributes
2628 pack $w.top.position -pady 6 -padx 6 -side top
2629 label $w.top.position.label -text "Position" -width 18
2631 pack $w.top.position.label $w.top.position.b -fill x
2633 # Structure Attributes
2635 pack $w.top.structure -pady 6 -padx 6 -side top
2636 label $w.top.structure.label -text "Structure" -width 18
2638 pack $w.top.structure.label $w.top.structure.b -fill x
2640 # Truncation Attributes
2642 pack $w.top.truncation -pady 6 -padx 6 -side top
2643 label $w.top.truncation.label -text "Truncation" -width 18
2645 pack $w.top.truncation.label $w.top.truncation.b -fill x
2647 # Completeness Attributes
2649 pack $w.top.completeness -pady 6 -padx 6 -side top
2650 label $w.top.completeness.label -text "Completeness" -width 18
2652 pack $w.top.completeness.label $w.top.completeness.b -fill x
2655 bottom-buttons $w [list \
2656 {Ok} [list index-setup-action $attr $queryNo $indexNo] \
2657 {Cancel} [list destroy $w]] 0
2661 proc query-edit-index {queryNo} {
2665 set i [lindex [$w.top.index.list curselection] 0]
2669 set attr [lindex $queryInfoTmp $i]
2670 dputs "Editing no $i $attr"
2671 index-setup $attr $queryNo $i
2674 proc query-delete-index {queryNo} {
2676 global queryButtonsTmp
2679 set i [lindex [$w.top.index.list curselection] 0]
2683 set queryInfoTmp [lreplace $queryInfoTmp $i $i]
2684 index-lines $w.top.lines 0 $queryButtonsTmp $queryInfoTmp activate-e-index
2685 $w.top.index.list delete $i
2688 proc query-setup {queryNo} {
2694 global queryButtonsTmp
2696 global queryIndexTmp
2699 set queryName [lindex $queryTypes $queryNo]
2700 set queryInfoTmp [lindex $queryInfo $queryNo]
2701 set queryButtonsTmp [lindex $queryButtons $queryNo]
2706 wm title $w "Query setup $queryName"
2710 frame $w.top.lines -relief ridge -border 2
2712 pack $w.top.lines -side left -pady 6 -padx 6 -fill y
2716 index-lines $w.top.lines 0 $queryButtonsTmp $queryInfoTmp activate-e-index
2718 button $w.top.lines.add -text "Add" \
2719 -command [list query-add-line $queryNo]
2720 button $w.top.lines.del -text "Remove" \
2721 -command [list query-del-line $queryNo]
2723 pack $w.top.lines.del -fill x -side bottom
2724 pack $w.top.lines.add -fill x -pady 10 -side bottom
2728 frame $w.top.index -relief ridge -border 2
2729 pack $w.top.index -pady 6 -padx 6 -side right -fill y
2731 listbox $w.top.index.list -yscrollcommand [list $w.top.index.scroll set]
2732 scrollbar $w.top.index.scroll -orient vertical -border 1 \
2733 -command [list $w.top.index.list yview]
2734 bind $w.top.index.list <2> [list query-edit-index $queryNo]
2736 pack $w.top.index.list -side left -fill both -expand yes -padx 2 -pady 2
2737 pack $w.top.index.scroll -side right -fill y -padx 2 -pady 2
2740 $w.top.index.list selection clear 0 end
2741 $w.top.index.list selection set 0 0
2743 $w.top.index.list select from 0
2744 $w.top.index.list select to 0
2747 foreach x $queryInfoTmp {
2748 $w.top.index.list insert end [lindex $x 0]
2751 bottom-buttons $w [list \
2752 {Ok} [list query-setup-action $queryNo] \
2753 {Add index} [list query-add-index $queryNo] \
2754 {Edit index} [list query-edit-index $queryNo] \
2755 {Delete index} [list query-delete-index $queryNo] \
2756 {Cancel} [list destroy $w]] 0
2759 proc index-clear {} {
2760 global queryButtonsFind
2763 foreach b $queryButtonsFind {
2764 .lines.$i.e delete 0 end
2769 proc index-query {} {
2770 global queryButtonsFind
2771 global queryInfoFind
2776 foreach b $queryButtonsFind {
2777 set term [string trim [.lines.$i.e get]]
2779 set attr [lrange [lindex $queryInfoFind [lindex $b 1]] 1 end]
2781 set len [string length $term]
2785 if {[string index $term $len] == "?"} {
2787 set term [string range $term 0 [expr $len - 1]]
2789 if {[string index $term 0] == "?"} {
2791 set term [string range $term 1 end]
2793 set term "\{${term}\}"
2794 if {$right && $left} {
2795 set term "@attr 5=3 ${term}"
2797 set term "@attr 5=1 ${term}"
2799 set term "@attr 5=2 ${term}"
2802 set term "@attr $a ${term}"
2805 set qs "@and ${qs} ${term}"
2816 proc index-focus-in {w i} {
2817 global curIndexEntry
2820 $w.$i configure -background red
2822 set curIndexEntry $i
2825 proc index-lines {w realOp buttonInfo queryInfo handle} {
2827 foreach b $buttonInfo {
2828 if {! [winfo exists $w.$i]} {
2830 frame $w.$i -border 0
2832 frame $w.$i -background white -border 1
2835 listbuttonx $w.$i.l [lindex $b 1] $queryInfo $handle $i
2838 if {! [winfo exists $w.$i.e]} {
2839 entry $w.$i.e -width 32 -relief sunken -border 1
2840 bind $w.$i.e <FocusIn> [list index-focus-in $w $i]
2841 bind $w.$i.e <FocusOut> [list $w.$i configure \
2843 pack $w.$i.l -side left
2844 pack $w.$i.e -side left -fill x -expand yes
2845 pack $w.$i -side top -fill x -padx 2 -pady 2
2847 bind $w.$i.e <Left> [list left-cursor $w.$i.e]
2848 bind $w.$i.e <Right> [list right-cursor $w.$i.e]
2850 bind $w.$i.e <Return> {search-request 0}
2853 pack $w.$i.l -side left
2854 pack $w.$i -side top -fill x -padx 2 -pady 2
2859 while {[winfo exists $w.$j]} {
2871 bind $w.$j.e <Tab> "focus $w.$k.e"
2877 bind $w.$i.e <Tab> "focus $w.0.e"
2883 proc search-fields {w buttondefs} {
2885 foreach buttondef $buttondefs {
2886 frame $w.$i -background white
2888 listbutton $w.$i.l 0 $buttondef
2889 entry $w.$i.e -width 32 -relief sunken
2891 pack $w.$i.l -side left
2892 pack $w.$i.e -side left -fill x -expand yes
2894 pack $w.$i -side top -fill x -padx 2 -pady 2
2896 bind $w.$i.e <Left> [list left-cursor $w.$i.e]
2897 bind $w.$i.e <Right> [list right-cursor $w.$i.e]
2905 bind $w.$j.e <Tab> "focus $w.$k.e \n
2906 $w.$k configure -background red \n
2907 $w.$j configure -background white"
2910 bind $w.$i.e <Tab> "focus $w.0.e \n
2911 $w.0 configure -background red \n
2912 $w.$i configure -background white"
2914 $w.0 configure -background red
2917 if {[info exists windowGeometry(.)]} {
2918 set g $windowGeometry(.)
2926 frame .top -border 1 -relief raised
2927 frame .lines -border 1 -relief raised
2928 frame .mid -border 1 -relief raised
2929 frame .data -border 1 -relief raised
2930 frame .bot -border 1 -relief raised
2931 pack .top .lines .mid -side top -fill x
2932 pack .data -side top -fill both -expand yes
2935 menubutton .top.file -text "File" -menu .top.file.m
2937 .top.file.m add command -label "Save settings" -command {save-settings}
2938 .top.file.m add separator
2939 .top.file.m add command -label "Exit" -command {exit-action}
2941 menubutton .top.target -text "Target" -menu .top.target.m
2943 .top.target.m add cascade -label "Connect" -menu .top.target.m.clist
2944 .top.target.m add command -label "Disconnect" -command {close-target}
2945 .top.target.m add command -label "About" -command {about-target}
2946 .top.target.m add cascade -label "Setup" -menu .top.target.m.slist
2947 .top.target.m add command -label "Setup new" -command {define-target-dialog}
2948 .top.target.m add separator
2949 set-target-hotlist 0
2951 configure-disable-e .top.target.m 1
2952 configure-disable-e .top.target.m 2
2954 menu .top.target.m.clist
2955 menu .top.target.m.slist
2958 menubutton .top.service -text "Service" -menu .top.service.m
2960 .top.service.m add command -label "Database" -command {database-select}
2961 .top.service.m add cascade -label "Present" -menu .top.service.m.present
2962 menu .top.service.m.present
2963 .top.service.m.present add command -label "10 More" \
2964 -command [list present-more 10]
2965 .top.service.m.present add command -label "All" \
2966 -command [list present-more {}]
2967 .top.service.m add command -label "Search" -command {search-request 0}
2968 .top.service.m add command -label "Scan" -command {scan-request}
2970 .top.service configure -state disabled
2972 menubutton .top.rset -text "Set" -menu .top.rset.m
2974 .top.rset.m add command -label "Load" -command {load-set}
2975 .top.rset.m add separator
2977 menubutton .top.options -text "Options" -menu .top.options.m
2979 .top.options.m add cascade -label "Query" -menu .top.options.m.query
2980 .top.options.m add cascade -label "Format" -menu .top.options.m.formats
2981 .top.options.m add cascade -label "Wrap" -menu .top.options.m.wrap
2982 .top.options.m add cascade -label "Syntax" -menu .top.options.m.syntax
2984 menu .top.options.m.query
2985 .top.options.m.query add cascade -label "Select" \
2986 -menu .top.options.m.query.clist
2987 .top.options.m.query add cascade -label "Edit" \
2988 -menu .top.options.m.query.slist
2989 .top.options.m.query add command -label "New" \
2990 -command {query-new}
2991 .top.options.m.query add cascade -label "Delete" \
2992 -menu .top.options.m.query.dlist
2994 menu .top.options.m.query.slist
2995 menu .top.options.m.query.clist
2996 menu .top.options.m.query.dlist
2999 menu .top.options.m.formats
3001 foreach f $displayFormats {
3002 .top.options.m.formats add radiobutton -label $f -value $i \
3003 -command [list set-display-format $i] -variable displayFormat
3007 menu .top.options.m.wrap
3008 .top.options.m.wrap add radiobutton -label "Character" \
3009 -value char -variable textWrap -command {set-wrap char}
3010 .top.options.m.wrap add radiobutton -label "Word" \
3011 -value word -variable textWrap -command {set-wrap word}
3012 .top.options.m.wrap add radiobutton -label "None" \
3013 -value none -variable textWrap -command {set-wrap none}
3015 menu .top.options.m.syntax
3016 .top.options.m.syntax add radiobutton -label "None" \
3017 -value None -variable recordSyntax
3018 .top.options.m.syntax add separator
3019 .top.options.m.syntax add radiobutton -label "USMARC" \
3020 -value USMARC -variable recordSyntax
3021 .top.options.m.syntax add radiobutton -label "UNIMARC" \
3022 -value UNIMARC -variable recordSyntax
3023 .top.options.m.syntax add radiobutton -label "UKMARC" \
3024 -value UKMARC -variable recordSyntax
3025 .top.options.m.syntax add radiobutton -label "DANMARC" \
3026 -value DANMARC -variable recordSyntax
3027 .top.options.m.syntax add radiobutton -label "FINMARC" \
3028 -value FINMARC -variable recordSyntax
3029 .top.options.m.syntax add radiobutton -label "NORMARC" \
3030 -value NORMARC -variable recordSyntax
3031 .top.options.m.syntax add radiobutton -label "PICAMARC" \
3032 -value PICAMARC -variable recordSyntax
3033 .top.options.m.syntax add separator
3034 .top.options.m.syntax add radiobutton -label "SUTRS" \
3035 -value SUTRS -variable recordSyntax
3037 menubutton .top.help -text "Help" -menu .top.help.m
3040 .top.help.m add command -label "Help on help" \
3041 -command {tkerror "Help on help not available. Sorry"}
3042 .top.help.m add command -label "About" -command {about-origin}
3044 pack .top.file .top.target .top.service .top.rset .top.options -side left
3045 pack .top.help -side right
3047 index-lines .lines 1 $queryButtonsFind [lindex $queryInfo 0] activate-index
3049 button .mid.search -width 7 -text {Search} -command {search-request 0} \
3051 button .mid.scan -width 7 -text {Scan} \
3052 -command scan-request -state disabled
3053 button .mid.present -width 7 -text {Present} -command [list present-more 10] \
3056 button .mid.clear -width 7 -text {Clear} -command index-clear
3057 pack .mid.search .mid.scan .mid.present .mid.clear -side left \
3058 -fill y -padx 4 -pady 2
3060 text .data.record -height 2 -width 20 -wrap none \
3061 -yscrollcommand [list .data.scroll set] -wrap $textWrap
3062 scrollbar .data.scroll -command [list .data.record yview]
3064 .data.record configure -takefocus 0
3065 .data.scroll configure -takefocus 0
3067 pack .data.scroll -side right -fill y
3068 pack .data.record -expand yes -fill both
3072 .data.record tag configure marc-tag -foreground blue
3073 .data.record tag configure marc-id -foreground red
3075 .data.record tag configure marc-tag -foreground black
3076 .data.record tag configure marc-id -foreground black
3078 .data.record tag configure marc-data -foreground black
3080 button .bot.logo -bitmap @${libdir}/bitmaps/book1 -command cancel-operation
3082 .bot.logo configure -takefocus 0
3085 pack .bot.a -side left -fill x
3086 pack .bot.logo -side right -padx 2 -pady 2
3088 message .bot.a.target -text "" -aspect 1000 -border 1
3090 label .bot.a.status -text "Not connected" -width 15 -relief \
3091 sunken -anchor w -border 1
3092 label .bot.a.set -text "" -width 5 -relief \
3093 sunken -anchor w -border 1
3094 label .bot.a.message -text "" -width 15 -relief \
3095 sunken -anchor w -border 1
3097 pack .bot.a.target -side top -anchor nw -padx 2 -pady 2
3098 pack .bot.a.status .bot.a.set .bot.a.message \
3099 -side left -padx 2 -pady 2 -ipadx 1 -ipady 1