1 # IR toolkit for tcl/tk
3 # See the file LICENSE for details.
4 # Sebastian Hammer, Adam Dickmeiss
7 # Revision 1.62 1995-08-04 11:32:37 adam
8 # More work on output queue. Memory related routines moved
11 # Revision 1.61 1995/07/20 08:09:39 adam
12 # client.tcl: Targets removed from hotTargets list when targets
13 # are removed/modified.
14 # ir-tcl.c: More work on triggerResourceControl.
16 # Revision 1.60 1995/06/30 16:30:19 adam
19 # Revision 1.59 1995/06/29 14:06:25 adam
20 # Another bug in install fixed. Configure searches for more versions of yaz.
22 # Revision 1.58 1995/06/29 12:34:06 adam
23 # IrTcl now works with both tk4.0b4/tcl7.4b4 and tk3.6/tcl7.3
25 # Revision 1.57 1995/06/29 09:20:30 adam
26 # Target entries in cascade menus are sorted.
28 # Revision 1.56 1995/06/27 19:03:48 adam
29 # Bug fix in do_present in ir-tcl.c: p->set_child member weren't set.
30 # nextResultSetPosition used instead of setOffset.
32 # Revision 1.55 1995/06/27 17:10:37 adam
33 # Bug fix: install procedure didn't work on some systems.
34 # Error turned up when clientrc.tcl was't present.
36 # Revision 1.54 1995/06/27 14:41:03 adam
37 # Bug fix in search-response. Didn't always observe non-surrogate diagnostics.
39 # Revision 1.53 1995/06/26 12:40:09 adam
40 # Client defines its own tkerror.
41 # User may specify 'no preferredRecordSyntax'.
43 # Revision 1.52 1995/06/22 13:14:59 adam
44 # Feature: SUTRS. Setting getSutrs implemented.
45 # Work on display formats.
46 # Preferred record syntax can be set by the user.
48 # Revision 1.51 1995/06/21 11:11:00 adam
49 # Bug fix: libdir undefined in about-origin.
51 # Revision 1.50 1995/06/21 11:04:48 adam
52 # Uses GNU autoconf 2.3.
53 # Install procedure implemented.
54 # boook bitmaps moved to sub directory bitmaps.
56 # Revision 1.49 1995/06/20 14:16:42 adam
57 # More work on cancel mechanism.
59 # Revision 1.48 1995/06/20 08:07:23 adam
60 # New setting: failInfo.
61 # Working on better cancel mechanism.
63 # Revision 1.47 1995/06/19 14:05:29 adam
64 # Bug fix: asked for SUTRS.
66 # Revision 1.46 1995/06/19 13:06:06 adam
67 # New define: IR_TCL_VERSION.
69 # Revision 1.45 1995/06/19 08:08:44 adam
70 # client.tcl: hotTargets now contain both database and target name.
71 # ir-tcl.c: setting protocol edited. Errors in callbacks are logged
72 # by logf(LOG_WARN, ...) calls.
74 # Revision 1.44 1995/06/16 14:55:18 adam
77 # Revision 1.43 1995/06/16 14:41:05 adam
78 # Scan line entries can be copied to a search entry.
80 # Revision 1.42 1995/06/16 12:28:13 adam
81 # Implemented preferredRecordSyntax.
82 # Minor changes in diagnostic handling.
83 # Record list deleted when connection closes.
85 # Revision 1.41 1995/06/14 15:07:59 adam
86 # Bug fix in cascade-target-list. Uses yaz-version.h.
88 # Revision 1.40 1995/06/14 13:37:17 adam
89 # Setting recordType implemented.
90 # Setting implementationVersion implemented.
91 # Settings implementationId / implementationName edited.
93 # Revision 1.39 1995/06/14 12:16:22 adam
94 # hotTargets, textWrap and displayFormat saved in clientg.tcl.
96 # Revision 1.38 1995/06/14 07:22:45 adam
97 # Target definitions can be deleted.
98 # Listbox used in the query definition dialog.
100 # Revision 1.37 1995/06/13 14:37:59 adam
101 # Work on query setup.
102 # Better about origin/target.
103 # Better presentation formats.
105 # Revision 1.36 1995/06/13 07:42:14 adam
106 # Bindings removed from text widgets.
108 # Revision 1.35 1995/06/12 15:17:31 adam
109 # Text widget used in main window (instead of listbox) to support
110 # better presentation formats.
112 # Revision 1.34 1995/06/12 07:59:07 adam
113 # More work on geometry handling.
115 # Revision 1.33 1995/06/09 11:17:35 adam
116 # Start work on geometry management.
118 # Revision 1.32 1995/06/07 09:16:37 adam
119 # New presentation format.
121 # Revision 1.31 1995/06/06 16:31:09 adam
122 # Bug fix: target names couldn't contain blanks.
125 # Revision 1.30 1995/06/06 11:35:41 adam
126 # Work on scan. Display of old sets.
128 # Revision 1.29 1995/06/05 14:11:18 adam
129 # Bug fix in present-more.
131 # Revision 1.28 1995/06/02 14:52:13 adam
132 # Minor changes really.
134 # Revision 1.27 1995/06/02 14:29:42 adam
135 # Work on scan interface - up/down buttons.
137 # Revision 1.26 1995/06/01 16:36:46 adam
138 # About buttons. Minor bug fixes.
140 # Revision 1.25 1995/05/31 13:09:57 adam
141 # Client searches/presents may be interrupted.
142 # New moving book-logo.
144 # Revision 1.24 1995/05/31 08:36:24 adam
145 # Bug fix in client.tcl: didn't save options on clientrc.tcl.
146 # New method: referenceId. More work on scan.
148 # Revision 1.23 1995/05/29 10:33:41 adam
149 # README and rename of startup script.
151 # Revision 1.22 1995/05/26 11:44:09 adam
152 # Bugs fixed. More work on MARC utilities and queries. Test
153 # client is up-to-date again.
155 # Revision 1.21 1995/05/11 15:34:46 adam
156 # Scan request changed a bit. This version works with RLG.
158 # Revision 1.20 1995/04/21 16:31:57 adam
159 # New radiobutton: protocol (z39v2/SR).
161 # Revision 1.19 1995/04/18 16:11:50 adam
162 # First version of graphical Scan. Some work on query-by-form.
164 # Revision 1.18 1995/04/10 10:50:22 adam
165 # Result-set name defaults to suffix of ir-set name.
166 # Started working on scan. Not finished at this point.
168 # Revision 1.17 1995/03/31 09:34:57 adam
169 # Search-button disabled when there is no connection.
171 # Revision 1.16 1995/03/31 08:56:36 adam
172 # New button "Search".
174 # Revision 1.15 1995/03/28 12:45:22 adam
175 # New ir method failback: called on disconnect/protocol error.
176 # New ir set/get method: protocol: SR / Z3950.
177 # Simple popup and disconnect when failback is invoked.
179 # Revision 1.14 1995/03/22 16:07:55 adam
182 # Revision 1.13 1995/03/21 17:27:26 adam
183 # Short-hand keys in setup.
185 # Revision 1.12 1995/03/21 13:41:03 adam
186 # Comstack cs_create not used too often. Non-blocking connect.
188 # Revision 1.11 1995/03/21 10:39:06 adam
189 # Diagnostic error message displayed with tkerror.
191 # Revision 1.10 1995/03/20 15:24:06 adam
192 # Diagnostic records saved on searchResponse.
194 # Revision 1.9 1995/03/17 18:26:16 adam
195 # Non-blocking i/o used now. Database names popup as cascade items.
197 # Revision 1.8 1995/03/17 15:45:00 adam
198 # Improved target/database setup.
200 # Revision 1.7 1995/03/16 17:54:03 adam
201 # Minor changes really.
203 # Revision 1.6 1995/03/15 19:10:20 adam
204 # Database setup in protocol-setup (rather target setup).
206 # Revision 1.5 1995/03/15 13:59:23 adam
209 # Revision 1.4 1995/03/14 17:32:29 adam
210 # Presentation of full Marc record in popup window.
212 # Revision 1.3 1995/03/12 19:31:52 adam
213 # Pattern matching implemented when retrieving MARC records. More
214 # diagnostic functions.
216 # Revision 1.2 1995/03/10 18:00:15 adam
217 # Actual presentation in line-by-line format. RPN query support.
219 # Revision 1.1 1995/03/09 16:15:07 adam
220 # First presentRequest attempts. Hot-target list.
224 if {$tk_version == "3.6"} {
231 proc configure-enable-e {w n} {
233 $w entryconfigure $n -state normal
235 proc configure-disable-e {w n} {
237 $w entryconfigure $n -state disabled
239 set noFocus [list -takefocus 0]
241 proc configure-enable-e {w n} {
244 proc configure-disable-e {w n} {
251 if {[tk colormodel .] == "color"} {
261 if {[file readable bitmaps/book2]} {
264 if {! [file readable ${libdir}/bitmaps/book2]} {
265 puts "Cannot locate system files in ${libdir}. You must either run this"
266 puts "program from the source directory root of ir-tcl or you must assure"
267 puts "that it is installed - normally in /usr/local/lib/irtcl"
275 set profile(Default) {{} {} {210} {} 16384 8192 tcpip {} 1 {} {} Z39 1}
277 set settingsChanged 0
286 set recordSyntax None
289 set queryTypes {Simple}
290 set queryButtons { { {I 0} {I 1} {I 2} } }
291 set queryInfo { { {Title {1=4 4=1}} {Author {1=1}} \
292 {Subject {1=21}} {Any {1=1016}} } }
301 if {[winfo exists $w]} {
310 label $w.top.b -bitmap error
311 message $w.top.t -aspect 300 -text "Error: $err" \
312 -font -Adobe-Helvetica-Bold-R-Normal-*-180-*
313 pack $w.top.b $w.top.t -side left -padx 10 -pady 10
315 bottom-buttons $w [list {Close} [list destroy $w]] 1
318 proc read-formats {} {
319 global displayFormats
321 set formats [glob -nocomplain ${libdir}/formats/*.tcl]
323 if {[file readable $f]} {
325 set l [string length $f]
326 set f [string range $f [string length "${libdir}/formats/"] \
328 lappend displayFormats $f
337 .data.record configure -wrap $m
344 proc set-display-format {f} {
354 .bot.a.status configure -text "Reformatting"
357 add-title-lines -1 10000 1
360 proc initBindings {} {
363 bind $w <Double-1> {}
364 bind $w <Triple-1> {}
365 bind $w <B1-Motion> {}
367 bind $w <Shift-B1-Motion> {}
369 bind $w <B2-Motion> {}
370 bind $w <Any-KeyPress> {}
372 bind $w <BackSpace> {}
374 bind $w <Control-h> {}
375 bind $w <Control-d> {}
376 bind $w <Control-v> {}
379 bind $w <B1-Motion> {}
380 bind $w <Shift-B1-Motion> {}
385 proc post-menu {wbutton wmenu} {
388 $wmenu post [winfo rootx $wbutton] \
389 [expr [winfo rooty $wbutton]+[winfo height $wbutton]]
394 global windowGeometry
395 set windowGeometry($w) [wm geometry $w]
398 global windowGeometry
401 if {[info exists windowGeometry($w)]} {
402 set g $windowGeometry($w)
407 bind $w <Destroy> [list destroyGW $w]
410 if {[file readable "clientrc.tcl"]} {
411 source "clientrc.tcl"
413 if {[file readable "${libdir}/clientrc.tcl"]} {
414 source "${libdir}/clientrc.tcl"
418 if {[file readable "~/.clientrc.tcl"]} {
419 source "~/.clientrc.tcl"
422 set queryButtonsFind [lindex $queryButtons 0]
423 set queryInfoFind [lindex $queryInfo 0]
425 proc top-down-window {w} {
426 frame $w.top -relief raised -border 1
427 frame $w.bot -relief raised -border 1
429 pack $w.top -side top -fill both -expand yes
430 pack $w.bot -fill both
433 proc top-down-ok-cancel {w ok-action g} {
434 frame $w.bot.left -relief sunken -border 1
435 pack $w.bot.left -side left -expand yes -ipadx 2 -ipady 2 -padx 5 -pady 5
436 button $w.bot.left.ok -width 6 -text {Ok} \
437 -command ${ok-action}
438 pack $w.bot.left.ok -expand yes -ipadx 2 -ipady 2 -padx 3 -pady 3
439 button $w.bot.cancel -width 6 -text {Cancel} \
440 -command [list destroy $w]
441 pack $w.bot.cancel -side left -expand yes
449 proc bottom-buttons {w buttonList g} {
451 set l [llength $buttonList]
453 frame $w.bot.$i -relief sunken -border 1
454 pack $w.bot.$i -side left -expand yes -padx 5 -pady 5
455 button $w.bot.$i.ok -text [lindex $buttonList $i] \
456 -command [lindex $buttonList [expr $i+1]]
457 pack $w.bot.$i.ok -expand yes -ipadx 3 -ipady 2 -padx 3 -pady 3 -side left
461 button $w.bot.$i -text [lindex $buttonList $i] \
462 -command [lindex $buttonList [expr $i+1]]
463 pack $w.bot.$i -expand yes -ipadx 2 -ipady 2 -padx 3 -pady 3 -side left
473 proc cancel-operation {} {
481 show-status Cancel 0 1
485 proc show-target {target base} {
489 .bot.a.target configure -text ""
493 .bot.a.target configure -text "$target"
495 .bot.a.target configure -text "$target - $base"
499 proc show-logo {v1} {
508 .bot.logo configure -bitmap @${libdir}/bitmaps/book${v1}
509 after 140 [list show-logo $v1]
513 .bot.logo configure -bitmap @${libdir}/bitmaps/book1
522 proc show-status {status b sb} {
529 .bot.a.status configure -text "$status"
531 if {$busy == 0} {set busy 1}
539 .top.service configure -state normal
540 .mid.search configure -state normal
542 .mid.scan configure -state normal
545 configure-disable-e .top.service.m 1
546 } elseif {[z39.$setNo nextResultSetPosition] > 0 &&
547 [z39.$setNo nextResultSetPosition] <= [z39.$setNo resultCount]} {
548 configure-enable-e .top.service.m 1
549 .mid.present configure -state normal
551 configure-disable-e .top.service.m 1
552 .mid.present configure -state disabled
554 if {[winfo exists .scan-window]} {
555 .scan-window.bot.2 configure -state normal
556 .scan-window.bot.4 configure -state normal
559 .top.service configure -state disabled
560 .mid.search configure -state disabled
561 .mid.scan configure -state disabled
562 .mid.present configure -state disabled
564 if {[winfo exists .scan-window]} {
565 .scan-window.bot.2 configure -state disabled
566 .scan-window.bot.4 configure -state disabled
571 proc show-message {msg} {
572 .bot.a.message configure -text "$msg"
575 proc insertWithTags {w text args} {
576 set start [$w index insert]
577 $w insert insert $text
578 foreach tag [$w tag names $start] {
579 $w tag remove $tag $start insert
582 $w tag add $i $start insert
586 proc popup-license {} {
591 wm title $w "License"
597 text $w.top.t -width 80 -height 10 -wrap word \
598 -yscrollcommand [list $w.top.s set]
599 scrollbar $w.top.s -command [list $w.top.t yview]
601 pack $w.top.s -side right -fill y
602 pack $w.top.t -expand yes -fill both
604 if {[file readable "${libdir}/LICENSE"]} {
605 set f [open "${libdir}/LICENSE" r]
606 while {[gets $f buf] != -1} {
607 $w.top.t insert end $buf
608 $w.top.t insert end "\n"
612 bottom-buttons $w [list {Close} [list destroy $w]] 1
615 proc about-target {} {
616 set w .about-target-w
621 wm title $w "About target"
625 frame $w.top.a -relief ridge -border 2
626 frame $w.top.p -relief ridge -border 2
628 pack $w.top.a $w.top.p -side top -fill x
630 label $w.top.a.about -text "About"
631 label $w.top.a.irtcl -text $hostid \
632 -font -Adobe-Helvetica-Bold-R-Normal-*-240-*
633 pack $w.top.a.about $w.top.a.irtcl -side top
635 set i [z39 targetImplementationName]
636 label $w.top.p.in -text "Implementation name: $i"
637 set i [z39 targetImplementationId]
638 label $w.top.p.ii -text "Implementation id: $i"
639 set i [z39 targetImplementationVersion]
640 label $w.top.p.iv -text "Implementation version: $i"
642 label $w.top.p.op -text "Protocol options: $i"
644 pack $w.top.p.in $w.top.p.ii $w.top.p.iv $w.top.p.op -side top -anchor nw
646 bottom-buttons $w [list {Close} [list destroy $w]] 1
649 proc about-origin-logo {n} {
651 set w .about-origin-w
652 if {![winfo exists $w]} {
659 $w.top.a.logo configure -bitmap @${libdir}/bitmaps/book$n
660 after 140 [list about-origin-logo $n]
663 proc about-origin {} {
664 set w .about-origin-w
667 if {[winfo exists $w]} {
672 wm title $w "About IrTcl"
676 frame $w.top.a -relief ridge -border 2
677 frame $w.top.p -relief ridge -border 2
679 pack $w.top.a $w.top.p -side top -fill x
681 label $w.top.a.irtcl -text "IrTcl" \
682 -font -Adobe-Helvetica-Bold-R-Normal-*-240-*
683 label $w.top.a.logo -bitmap @${libdir}/bitmaps/book1
684 pack $w.top.a.irtcl $w.top.a.logo -side left -expand yes
686 set i [z39 implementationName]
687 label $w.top.p.in -text "Implementation name: $i"
688 set i [z39 implementationId]
689 label $w.top.p.ii -text "Implementation id: $i"
690 set i [z39 implementationVersion]
691 label $w.top.p.iv -text "Implementation version: $i"
693 pack $w.top.p.in $w.top.p.ii $w.top.p.iv -side top -anchor nw
696 bottom-buttons $w [list {Close} [list destroy $w] \
697 {License} [list popup-license]] 0
700 proc popup-marc {sno no b df} {
702 global displayFormats
705 if {[z39.$sno type $no] != "DB"} {
709 set w .full-marc-$fullMarcSeq
716 if {[winfo exists $w]} {
724 frame $w.top -relief raised -border 1
725 frame $w.bot -relief raised -border 1
727 pack $w.top -side top -fill both -expand yes
728 pack $w.bot -fill both
730 text $w.top.record -width 60 -height 5 -wrap word \
731 -yscrollcommand [list $w.top.s set]
732 scrollbar $w.top.s -command [list $w.top.record yview]
736 $w.top.record tag configure marc-tag -foreground blue
737 $w.top.record tag configure marc-id -foreground red
739 $w.top.record tag configure marc-tag -foreground black
740 $w.top.record tag configure marc-id -foreground black
742 $w.top.record tag configure marc-data -foreground black
745 $w.top.record delete 0.0 end
746 set recordType [z39.$sno recordType $no]
747 wm title $w "$recordType record #$no"
750 bind $w.top.record <Return> {destroy .full-marc}
752 pack $w.top.s -side right -fill y
753 pack $w.top.record -expand yes -fill both
756 bottom-buttons $w [list \
757 {Close} [list destroy $w]] 0
759 bottom-buttons $w [list \
760 {Close} [list destroy $w] \
761 {Duplicate} [list popup-marc $sno $no 1 0]] 0
762 menubutton $w.bot.formats -text "Format" -menu $w.bot.formats.m
763 menu $w.bot.formats.m
765 foreach f $displayFormats {
766 $w.bot.formats.m add radiobutton -label $f \
767 -variable popupMarcdf -value $i \
768 -command [list display-$f $sno $no $w.top.record 0]
771 pack $w.bot.formats -expand yes -ipadx 2 -ipady 2 \
772 -padx 3 -pady 3 -side left
776 $w.bot.formats.m delete 0 last
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]
784 set ffunc [lindex $displayFormats $df]
785 set ffunc "display-$ffunc"
787 $ffunc $sno $no $w.top.record 0
790 proc update-target-hotlist {target base} {
793 set olen [llength $hotTargets]
795 foreach e $hotTargets {
796 if {$target == [lindex $e 0] && $base == [lindex $e 1]} {
797 set hotTargets [lreplace $hotTargets $i $i]
802 set hotTargets [linsert $hotTargets 0 [list $target $base]]
803 set-target-hotlist $olen
806 proc delete-target-hotlist {target} {
809 set olen [llength $hotTargets]
811 foreach e $hotTargets {
812 if {$target == [lindex $e 0]} {
813 set hotTargets [lreplace $hotTargets $i $i]
817 set-target-hotlist $olen
820 proc set-target-hotlist {olen} {
826 .top.target.m delete 7 [expr 7+$olen]
828 .top.target.m delete 6 [expr 6+$olen]
832 foreach e $hotTargets {
833 set target [lindex $e 0]
834 set base [lindex $e 1]
836 .top.target.m add command -label "$i $target" -command \
837 [list reopen-target $target {}]
839 .top.target.m add command -label "$i $target - $base" -command \
840 [list reopen-target $target $base]
849 proc reopen-target {target base} {
851 open-target $target $base
852 update-target-hotlist $target $base
855 proc define-target-action {} {
858 set target [.target-define.top.target.entry get]
862 foreach n [array names profile] {
868 set seq [lindex $profile(Default) 12]
870 set profile($target) $profile(Default)
871 set profile(Default) [lreplace $profile(Default) 12 12 [incr seq]]
873 protocol-setup $target
874 destroy .target-define
877 proc fail-response {target} {
878 set c [lindex [z39 failInfo] 0]
879 set m [lindex [z39 failInfo] 1]
884 proc connect-response {target base} {
885 dputs "connect-response"
886 show-target $target $base
890 proc open-target {target base} {
895 z39 comstack [lindex $profile($target) 6]
896 z39 protocol [lindex $profile($target) 11]
897 z39 idAuthentication [lindex $profile($target) 3]
898 z39 maximumRecordSize [lindex $profile($target) 4]
899 z39 preferredMessageSize [lindex $profile($target) 5]
900 dputs "maximumRecordSize="
901 dputs [z39 maximumRecordSize]
902 dputs "preferredMessageSize="
903 dputs [z39 preferredMessageSize]
904 show-status {Connecting} 1 0
906 z39 databaseNames [lindex [lindex $profile($target) 7] 0]
908 z39 databaseNames $base
910 z39 failback [list fail-response $target]
911 z39 callback [list connect-response $target $base]
914 z39 connect [lindex $profile($target) 1]:[lindex $profile($target) 2]
917 tkerror $errorMessage
918 show-status "Not connected" 0 {}
922 configure-disable-e .top.target.m 0
923 configure-enable-e .top.target.m 1
924 configure-enable-e .top.target.m 2
927 proc close-target {} {
937 .bot.a.set configure -text ""
941 show-status {Not connected} 0 0
944 configure-disable-e .top.target.m 1
945 configure-disable-e .top.target.m 2
947 .top.rset.m delete 2 last
949 .top.rset.m delete 1 last
951 .top.rset.m add separator
952 configure-enable-e .top.target.m 0
955 proc load-set-action {} {
959 ir-set z39.$setNoLast z39
961 set fname [.load-set.top.filename.entry get]
964 show-status {Loading} 1 {}
966 z39.$setNoLast loadFile $fname
968 set no [z39.$setNoLast numberOfRecordsReturned]
969 add-title-lines $setNoLast $no 1
971 set l [format "%-4d %7d" $setNoLast $no]
972 .top.rset.m add command -label $l \
973 -command [list add-title-lines $setNoLast 10000 1]
974 show-status {Ready} 0 {}
984 frame $w.top.filename
985 pack $w.top.filename -side top -anchor e -pady 2
987 entry-fields $w.top {filename} \
989 {load-set-action} {destroy .load-set}
991 top-down-ok-cancel $w {load-set-action} 1
995 proc init-request {} {
1002 z39 callback {init-response}
1003 show-status {Initializing} 1 {}
1004 set err [catch {z39 init} errorMessage]
1006 tkerror $errorMessage
1007 show-status Ready 0 {}
1011 proc init-response {} {
1019 if {![z39 initResult]} {
1020 show-status {Ready} 0 1
1021 set u [z39 userInformationField]
1023 tkerror "Connection rejected by target: $u"
1025 if {[lsearch [z39 options] scan] >= 0} {
1030 show-status {Ready} 0 1
1034 proc search-request {bflag} {
1046 dputs "search-request"
1048 if {!$bflag && $busy} {
1049 dputs "busy: search-request ignored"
1054 show-status {Searching} 1 0
1055 set delayRequest {search-request 1}
1060 set query [index-query]
1065 set setNo $setNoLast
1066 ir-set z39.$setNo z39
1068 if {[lindex $profile($target) 10] == 1} {
1069 z39.$setNo setName $setNo
1070 dputs "setName=${setNo}"
1072 z39.$setNo setName Default
1073 dputs "setName=Default"
1075 if {[lindex $profile($target) 8] == 1} {
1076 z39.$setNo queryType rpn
1078 if {[lindex $profile($target) 9] == 1} {
1079 z39.$setNo queryType ccl
1083 if {$recordSyntax == "None" } {
1084 z39.$setNo preferredRecordSyntax {}
1086 z39.$setNo preferredRecordSyntax $recordSyntax
1088 z39 callback {search-response}
1089 z39.$setNo search $query
1090 show-status {Searching} 1 0
1093 proc scan-copy {y entry} {
1095 set no [$w.top.list nearest $y]
1097 .lines.$entry.e delete 0 end
1098 .lines.$entry.e insert 0 [string range [$w.top.list get $no] 8 end]
1101 proc scan-request {} {
1108 global curIndexEntry
1109 global queryButtonsFind
1110 global queryInfoFind
1114 dputs "scan-request"
1117 show-status {Scanning} 1 0
1118 set delayRequest scan-request
1127 set b [lindex $queryButtonsFind $curIndexEntry]
1129 foreach a [lrange [lindex $queryInfoFind [lindex $b 1]] 1 end] {
1130 set attr "@attr $a $attr"
1132 set title [lindex [lindex $queryInfoFind [lindex $b 1]] 0]
1133 ir-scan z39.scan z39
1135 if {![winfo exists $w]} {
1142 entry $w.top.entry -relief sunken
1143 pack $w.top.entry -fill x -padx 4 -pady 2
1144 bind $w.top.entry <KeyRelease> [list scan-term-h $attr]
1145 listbox $w.top.list -yscrollcommand [list $w.top.scroll set] \
1147 scrollbar $w.top.scroll -orient vertical -border 1
1148 pack $w.top.list -side left -fill both -expand yes
1149 pack $w.top.scroll -side right -fill y
1150 $w.top.scroll config -command [list $w.top.list yview]
1152 bottom-buttons $w [list {Close} [list destroy $w] \
1153 {Up} [list scan-up $attr] \
1154 {Down} [list scan-down $attr]] 0
1155 bind $w.top.list <Up> [list scan-up $attr]
1156 bind $w.top.list <Down> [list scan-down $attr]
1159 bind $w.top.list <Double-Button-1> [list scan-copy %y $curIndexEntry]
1160 wm title $w "Scan $title"
1162 z39 callback [list scan-response $attr 0 35]
1163 z39.scan numberOfTermsRequested 5
1164 z39.scan preferredPositionInResponse 1
1165 z39.scan scan "${attr} 0"
1167 show-status {Scanning} 1 0
1170 proc scan-term-h {attr} {
1178 set nScanTerm [$w.top.entry get]
1179 if {$nScanTerm == $scanTerm} {
1182 set scanTerm $nScanTerm
1183 z39 callback [list scan-response $attr 0 35]
1184 z39.scan numberOfTermsRequested 5
1185 z39.scan preferredPositionInResponse 1
1186 dputs "${attr} \{${scanTerm}\}"
1187 if {$scanTerm == ""} {
1188 z39.scan scan "${attr} 0"
1190 z39.scan scan "${attr} \{${scanTerm}\}"
1192 show-status {Scanning} 1 0
1195 proc scan-response {attr start toget} {
1202 dputs "In scan-response"
1203 set m [z39.scan numberOfEntriesReturned]
1209 if {![winfo exists .scan-window]} {
1212 dputs "Handling cancel"
1213 if {$delayRequest != ""} {
1218 show-status {Ready} 0 1
1221 set nScanTerm [$w.top.entry get]
1222 if {$nScanTerm != $scanTerm} {
1223 z39 callback [list scan-response $attr 0 35]
1224 z39.scan numberOfTermsRequested 5
1225 z39.scan preferredPositionInResponse 1
1226 set scanTerm $nScanTerm
1227 dputs "${attr} \{${scanTerm}\}"
1228 if {$scanTerm == ""} {
1229 z39.scan scan "${attr} 0"
1231 z39.scan scan "${attr} \{${scanTerm}\}"
1233 show-status {Scanning} 1 0
1236 set status [z39.scan scanStatus]
1239 show-status {Ready} 0 1
1244 for {set i 0} {$i < $m} {incr i} {
1245 set term [lindex [z39.scan scanLine $i] 1]
1246 set nostr [format " %-6d" [lindex [z39.scan scanLine $i] 2]]
1247 $w.top.list insert $i "$nostr $term"
1250 $w.top.list yview $scanView
1252 $w.top.list delete $start end
1253 for {set i 0} {$i < $m} {incr i} {
1254 set term [lindex [z39.scan scanLine $i] 1]
1255 set nostr [format " %-6d" [lindex [z39.scan scanLine $i] 2]]
1256 $w.top.list insert end "$nostr $term"
1260 dputs "Handling cancel"
1262 if {$delayRequest != ""} {
1268 if {$toget > 0 && $m > 1 && $m < $toget} {
1269 set ntoget [expr $toget - $m + 1]
1270 dputs ntoget=$ntoget
1271 z39 callback [list scan-response $attr [expr $start + $m - 1] $ntoget]
1273 dputs "down continue: $q"
1275 z39.scan numberOfTermsRequested 10
1277 z39.scan numberOfTermsRequested $ntoget
1279 z39.scan preferredPositionInResponse 1
1280 dputs "${attr} \{$q\}"
1281 z39.scan scan "${attr} \{$q\}"
1284 if {$toget < 0 && $m > 1 && $m < [expr - $toget]} {
1285 set ntoget [expr - $toget - $m]
1286 dputs ntoget=$ntoget
1287 z39 callback [list scan-response $attr 0 -$ntoget]
1288 set q [string range [$w.top.list get 0] 8 end]
1289 dputs "up continue: $q"
1291 z39.scan numberOfTermsRequested 10
1292 z39.scan preferredPositionInResponse 11
1294 z39.scan numberOfTermsRequested $ntoget
1295 z39.scan preferredPositionInResponse [incr ntoget]
1297 dputs "${attr} \{$q\}"
1298 z39.scan scan "${attr} \{$q\}"
1301 show-status {Ready} 0 1
1304 proc scan-down {attr} {
1312 show-status {Scanning down} 1 0
1313 set delayRequest [list scan-down $attr]
1319 set scanView [expr $scanView + 5]
1320 set s [$w.top.list size]
1321 if {$scanView > $s} {
1322 z39 callback [list scan-response $attr [expr $s - 1] 25]
1323 set q [string range [$w.top.list get [expr $s - 1]] 8 end]
1325 z39.scan numberOfTermsRequested 10
1326 z39.scan preferredPositionInResponse 1
1327 show-status {Scanning} 1 0
1328 dputs "${attr} \{$q\}"
1329 z39.scan scan "${attr} \{$q\}"
1332 $w.top.list yview $scanView
1335 proc scan-up {attr} {
1343 show-status {Scanning up} 1 0
1344 set delayRequest [list scan-up $attr]
1350 set scanView [expr $scanView - 5]
1351 if {$scanView < 0} {
1352 z39 callback [list scan-response $attr 0 -25]
1353 set q [string range [$w.top.list get 0] 8 end]
1355 z39.scan numberOfTermsRequested 10
1356 z39.scan preferredPositionInResponse 11
1357 show-status {Scanning} 1 0
1358 z39.scan scan "${attr} \{$q\}"
1361 $w.top.list yview $scanView
1364 proc search-response {} {
1372 dputs "In search-response"
1374 dputs "Handling cancel"
1376 if {$delayRequest != ""} {
1384 set setMax [z39.$setNo resultCount]
1385 show-status {Ready} 0 1
1386 set status [z39.$setNo responseStatus]
1387 if {[lindex $status 0] == "NSD"} {
1388 z39.$setNo nextResultSetPosition 0
1389 set code [lindex $status 1]
1390 set msg [lindex $status 2]
1391 set addinfo [lindex $status 3]
1392 tkerror "NSD$code: $msg: $addinfo"
1395 show-message "${setMax} hits"
1400 show-status {Ready} 0 1
1401 set l [format "%-4d %7d" $setNo $setMax]
1402 .top.rset.m add command -label $l \
1403 -command [list add-title-lines $setNo 10000 1]
1407 z39 callback {present-response}
1408 z39.$setNo present $setOffset 1
1409 show-status {Retrieving} 1 0
1412 proc present-more {number} {
1420 dputs "present-more"
1422 show-status {Retrieving} 1 0
1423 set delayRequest "present-more $number"
1429 dputs "setNo=$setNo"
1432 set setOffset [z39.$setNo nextResultSetPosition]
1433 dputs "setOffest=${setOffset}"
1434 dputs "setNo=${setNo}"
1435 set max [z39.$setNo resultCount]
1436 if {$max < $setOffset} {
1438 dputs "setOffset=$setOffset"
1439 show-status Ready 0 1
1442 if {$number == ""} {
1446 if {$setMax > $max} {
1450 z39 callback {present-response}
1452 set toGet [expr $setMax - $setOffset + 1]
1459 z39.$setNo present $setOffset $toGet
1460 show-status {Retrieving} 1 0
1463 proc init-title-lines {} {
1464 .data.record delete 0.0 end
1467 proc title-press {y setno} {
1468 show-full-marc $setno [expr 1 + [.data.list nearest $y]] 0
1471 proc add-title-lines {setno no offset} {
1472 global displayFormats
1473 global displayFormat
1483 .bot.a.set configure -text $setno
1484 .data.record delete 0.0 end
1486 set ffunc [lindex $displayFormats $displayFormat]
1487 dputs "ffunc=$ffunc"
1488 set ffunc "display-$ffunc"
1489 for {set i 0} {$i < $no} {incr i} {
1490 set o [expr $i + $offset]
1491 set type [z39.$setno type $o]
1495 .data.record tag bind r$o <Any-Enter> {}
1496 .data.record tag bind r$o <Any-Leave> {}
1497 set insert0 [.data.record index insert]
1498 $ffunc $setno $o .data.record 1
1499 .data.record tag add r$o $insert0 insert
1500 .data.record tag bind r$o <1> \
1501 [list popup-marc $setno $o 0 0]
1505 show-status Ready 0 1
1509 proc present-response {} {
1516 dputs "In present-response"
1517 set no [z39.$setNo numberOfRecordsReturned]
1518 dputs "Returned $no records, setOffset $setOffset"
1519 add-title-lines $setNo $no $setOffset
1520 set setOffset [expr $setOffset + $no]
1522 dputs "Handling cancel"
1524 if {$delayRequest != ""} {
1529 set status [z39.$setNo responseStatus]
1530 if {[lindex $status 0] == "NSD"} {
1531 show-status {Ready} 0 1
1532 set code [lindex $status 1]
1533 set msg [lindex $status 2]
1534 set addinfo [lindex $status 3]
1535 tkerror "NSD$code: $msg: $addinfo"
1538 if {$no > 0 && $setOffset <= $setMax} {
1539 dputs "present-request from ${setOffset}"
1540 set toGet [expr $setMax - $setOffset + 1]
1544 z39.$setNo present $setOffset $toGet
1546 show-status {Ready} 0 1
1550 proc left-cursor {w} {
1551 set i [$w index insert]
1559 proc right-cursor {w} {
1560 set i [$w index insert]
1566 proc bind-fields {list returnAction escapeAction} {
1568 set max [expr [llength $list]-1]
1569 for {set i 0} {$i < $max} {incr i} {
1570 bind [lindex $list $i] <Return> $returnAction
1571 bind [lindex $list $i] <Escape> $escapeAction
1573 bind [lindex $list $i] <Tab> \
1574 [list focus [lindex $list [expr $i+1]]]
1575 bind [lindex $list $i] <Left> \
1576 [list left-cursor [lindex $list $i]]
1577 bind [lindex $list $i] <Right> \
1578 [list right-cursor [lindex $list $i]]
1581 bind [lindex $list $i] <Return> $returnAction
1582 bind [lindex $list $i] <Escape> $escapeAction
1584 bind [lindex $list $i] <Tab> [list focus [lindex $list 0]]
1585 bind [lindex $list $i] <Left> [list left-cursor [lindex $list $i]]
1586 bind [lindex $list $i] <Right> [list right-cursor [lindex $list $i]]
1588 focus [lindex $list 0]
1591 proc entry-fields {parent list tlist returnAction escapeAction} {
1594 foreach field $list {
1595 set label ${parent}.${field}.label
1596 set entry ${parent}.${field}.entry
1597 label $label -text [lindex $tlist $i] -anchor e
1598 entry $entry -width 32 -relief sunken
1599 pack $label -side left
1600 pack $entry -side right
1601 lappend alist $entry
1604 bind-fields $alist $returnAction $escapeAction
1607 proc define-target-dialog {} {
1608 set w .target-define
1614 pack $w.top.target \
1615 -side top -anchor e -pady 2
1616 entry-fields $w.top {target} \
1618 {define-target-action} {destroy .target-define}
1619 top-down-ok-cancel $w {define-target-action} 1
1622 proc protocol-setup-delete {target} {
1624 global settingsChanged
1626 set a [alert "Are you sure you want to delete the target \
1627 definition $target ?"]
1629 set wno [lindex $profile($target) 12]
1632 unset profile($target)
1633 set settingsChanged 1
1635 delete-target-hotlist $target
1639 proc protocol-setup-action {target} {
1642 global protocolRadioType
1643 global settingsChanged
1646 global ResultSetCheck
1648 set wno [lindex $profile($target) 12]
1652 set settingsChanged 1
1653 set len [$w.top.databases.list size]
1654 for {set i 0} {$i < $len} {incr i} {
1655 lappend b [$w.top.databases.list get $i]
1657 set profile($target) [list [$w.top.description.entry get] \
1658 [$w.top.host.entry get] \
1659 [$w.top.port.entry get] \
1660 [$w.top.idAuthentication.entry get] \
1661 [$w.top.maximumRecordSize.entry get] \
1662 [$w.top.preferredMessageSize.entry get] \
1668 $protocolRadioType \
1672 delete-target-hotlist $target
1673 dputs $profile($target)
1677 proc place-force {window parent} {
1678 set g [wm geometry $parent]
1680 set p1 [string first + $g]
1681 set p2 [string last + $g]
1683 set x [expr 40+[string range $g [expr $p1 +1] [expr $p2 -1]]]
1684 set y [expr 60+[string range $g [expr $p2 +1] end]]
1685 wm geometry $window +${x}+${y}
1688 proc add-database-action {target} {
1691 set wno [lindex $profile($target) 12]
1694 $w.top.databases.list insert end \
1695 [.database-select.top.database.entry get]
1696 destroy .database-select
1699 proc add-database {target} {
1702 set w .database-select
1704 set oldFocus [focus]
1706 set wno [lindex $profile($target) 12]
1707 place-force $w .setup-${wno}
1711 frame $w.top.database
1713 pack $w.top.database -side top -anchor e -pady 2
1715 entry-fields $w.top {database} \
1716 {{Database to add:}} \
1717 [list add-database-action $target] {destroy .database-select}
1719 top-down-ok-cancel $w [list add-database-action $target] 1
1723 proc delete-database {target} {
1726 set wno [lindex $profile($target) 12]
1729 foreach i [$w.top.databases.list curselection] {
1730 set b [$w.top.databases.list get $i]
1733 set a [alert "Are you sure you want to remove the database(s)${l}?"]
1735 foreach i [lsort -decreasing \
1736 [$w.top.databases.list curselection]] {
1737 $w.top.databases.list delete $i
1742 proc protocol-setup {target} {
1745 global protocolRadioType
1748 global ResultSetCheck
1750 set wno [lindex $profile($target) 12]
1755 wm title $w "Setup $target"
1759 if {$target == ""} {
1763 dputs $profile($target)
1765 frame $w.top.description
1768 frame $w.top.idAuthentication
1769 frame $w.top.maximumRecordSize
1770 frame $w.top.preferredMessageSize
1771 frame $w.top.cs-type -relief ridge -border 2
1772 frame $w.top.protocol -relief ridge -border 2
1773 frame $w.top.query -relief ridge -border 2
1774 frame $w.top.databases -relief ridge -border 2
1776 # Maximum/preferred/idAuth ...
1777 pack $w.top.description $w.top.host $w.top.port \
1778 $w.top.idAuthentication $w.top.maximumRecordSize \
1779 $w.top.preferredMessageSize -side top -anchor e -pady 2
1781 entry-fields $w.top {description host port idAuthentication \
1782 maximumRecordSize preferredMessageSize} \
1783 {{Description:} {Host:} {Port:} {Id Authentication:} \
1784 {Maximum Record Size:} {Preferred Message Size:}} \
1785 [list protocol-setup-action $target] [list destroy $w]
1787 foreach sub {description host port idAuthentication \
1788 maximumRecordSize preferredMessageSize} {
1790 bind $w.top.$sub.entry <Control-a> [list add-database $target]
1791 bind $w.top.$sub.entry <Control-d> [list delete-database $target]
1793 $w.top.description.entry insert 0 [lindex $profile($target) 0]
1794 $w.top.host.entry insert 0 [lindex $profile($target) 1]
1795 $w.top.port.entry insert 0 [lindex $profile($target) 2]
1796 $w.top.idAuthentication.entry insert 0 [lindex $profile($target) 3]
1797 $w.top.maximumRecordSize.entry insert 0 [lindex $profile($target) 4]
1798 $w.top.preferredMessageSize.entry insert 0 [lindex $profile($target) 5]
1799 set csRadioType [lindex $profile($target) 6]
1800 set RPNCheck [lindex $profile($target) 8]
1801 set CCLCheck [lindex $profile($target) 9]
1802 set ResultSetCheck [lindex $profile($target) 10]
1803 set protocolRadioType [lindex $profile($target) 11]
1804 if {$protocolRadioType == ""} {
1805 set protocolRadioType Z39
1809 pack $w.top.databases -side left -pady 4 -padx 4 -expand yes -fill both
1811 label $w.top.databases.label -text "Databases"
1812 button $w.top.databases.add -text "Add" \
1813 -command [list add-database $target]
1814 button $w.top.databases.delete -text "Delete" \
1815 -command [list delete-database $target]
1818 listbox $w.top.databases.list -geometry 20x6 \
1819 -yscrollcommand "$w.top.databases.scroll set"
1821 listbox $w.top.databases.list -width 20 \
1822 -yscrollcommand "$w.top.databases.scroll set"
1824 scrollbar $w.top.databases.scroll -orient vertical -border 1
1825 pack $w.top.databases.label -side top -fill x \
1827 pack $w.top.databases.add $w.top.databases.delete -side top -fill x \
1829 pack $w.top.databases.list -side left -fill both -expand yes \
1831 pack $w.top.databases.scroll -side right -fill y \
1833 $w.top.databases.scroll config -command "$w.top.databases.list yview"
1835 foreach b [lindex $profile($target) 7] {
1836 $w.top.databases.list insert end $b
1840 pack $w.top.cs-type -pady 4 -padx 4 -side top -fill x
1842 label $w.top.cs-type.label -text "Transport"
1843 radiobutton $w.top.cs-type.tcpip -text "TCP/IP" -anchor w \
1844 -variable csRadioType -value tcpip
1845 radiobutton $w.top.cs-type.mosi -text "MOSI" -anchor w\
1846 -variable csRadioType -value mosi
1848 pack $w.top.cs-type.label $w.top.cs-type.tcpip $w.top.cs-type.mosi \
1849 -padx 4 -side top -fill x
1852 pack $w.top.protocol -pady 4 -padx 4 -side top -fill x
1854 label $w.top.protocol.label -text "Protocol"
1855 radiobutton $w.top.protocol.z39v2 -text "Z39.50" -anchor w \
1856 -variable protocolRadioType -value Z39
1857 radiobutton $w.top.protocol.sr -text "SR" -anchor w \
1858 -variable protocolRadioType -value SR
1860 pack $w.top.protocol.label $w.top.protocol.z39v2 $w.top.protocol.sr \
1861 -padx 4 -side top -fill x
1864 pack $w.top.query -pady 4 -padx 4 -side top -fill x
1866 label $w.top.query.label -text "Query support"
1867 checkbutton $w.top.query.c1 -text "RPN query" -anchor w -variable RPNCheck
1868 checkbutton $w.top.query.c2 -text "CCL query" -anchor w -variable CCLCheck
1869 checkbutton $w.top.query.c3 -text "Result sets" -anchor w -variable ResultSetCheck
1871 pack $w.top.query.label -side top
1872 pack $w.top.query.c1 $w.top.query.c2 $w.top.query.c3 \
1873 -padx 4 -side top -fill x
1876 bottom-buttons $w [list {Ok} [list protocol-setup-action $target] \
1877 {Delete} [list protocol-setup-delete $target] \
1878 {Cancel} [list destroy $w]] 0
1881 proc database-select-action {} {
1882 set w .database-select.top
1884 foreach indx [$w.databases.list curselection] {
1885 lappend b [$w.databases.list get $indx]
1888 z39 databaseNames $b
1890 destroy .database-select
1893 proc database-select {} {
1894 set w .database-select
1899 set oldFocus [focus]
1904 frame $w.top.databases -relief ridge -border 2
1906 pack $w.top.databases -side left -pady 6 -padx 6 -expand yes -fill x
1908 label $w.top.databases.label -text "List"
1909 listbox $w.top.databases.list -geometry 20x6 \
1910 -yscrollcommand "$w.top.databases.scroll set"
1911 scrollbar $w.top.databases.scroll -orient vertical -border 1
1912 pack $w.top.databases.label -side top -fill x \
1914 pack $w.top.databases.list -side left -fill both -expand yes \
1916 pack $w.top.databases.scroll -side right -fill y \
1918 $w.top.databases.scroll config -command "$w.top.databases.list yview"
1920 foreach b [lindex $profile($hostid) 7] {
1921 $w.top.databases.list insert end $b
1923 top-down-ok-cancel $w {database-select-action} 1
1927 proc cascade-target-list {} {
1930 foreach sub [winfo children .top.target.m.clist] {
1933 .top.target.m.clist delete 0 last
1934 foreach n [lsort [array names profile]] {
1935 if {$n != "Default"} {
1936 set nl [lindex $profile($n) 12]
1937 if {[llength [lindex $profile($n) 7]] > 1} {
1938 .top.target.m.clist add cascade -label $n \
1939 -menu .top.target.m.clist.$nl
1940 menu .top.target.m.clist.$nl
1941 foreach b [lindex $profile($n) 7] {
1942 .top.target.m.clist.$nl add command -label $b \
1943 -command [list reopen-target $n $b]
1946 .top.target.m.clist add command -label $n \
1947 -command [list reopen-target $n {}]
1951 .top.target.m.slist delete 0 last
1952 foreach n [lsort [array names profile]] {
1953 if {$n != "Default"} {
1954 .top.target.m.slist add command -label $n \
1955 -command [list protocol-setup $n]
1960 proc query-select {i} {
1961 global queryButtonsFind
1962 global queryInfoFind
1966 set queryInfoFind [lindex $queryInfo $i]
1967 set queryButtonsFind [lindex $queryButtons $i]
1969 index-lines .lines 1 $queryButtonsFind $queryInfoFind activate-index
1972 proc query-new-action {} {
1976 global settingsChanged
1978 set settingsChanged 1
1979 lappend queryTypes [.query-new.top.index.entry get]
1980 lappend queryButtons {}
1981 lappend queryInfo {}
1991 set oldFocus [focus]
1996 -side top -anchor e -pady 2
1997 entry-fields $w.top index \
1999 query-new-action {destroy .query-new}
2000 top-down-ok-cancel $w query-new-action 1
2004 proc query-delete-action {queryNo} {
2008 global settingsChanged
2010 set settingsChanged 1
2012 set queryTypes [lreplace $queryTypes $queryNo $queryNo]
2013 set queryButtons [lreplace $queryButtons $queryNo $queryNo]
2014 set queryInfo [lreplace $queryInfo $queryNo $queryNo]
2015 destroy .query-delete
2019 proc query-delete {queryNo} {
2027 set n [lindex $queryTypes $queryNo]
2029 label $w.top.warning -bitmap warning
2030 message $w.top.quest -text "Are you sure you want to delete the \
2031 query type $n ?" -aspect 300
2032 pack $w.top.warning $w.top.quest -side left -expand yes -padx 10 -pady 5
2033 bottom-buttons $w [list {Ok} [list query-delete-action $queryNo] \
2034 {Cancel} [list destroy $w]] 1
2037 proc cascade-query-list {} {
2039 set w .top.options.m.query
2042 $w.slist delete 0 last
2043 foreach n $queryTypes {
2044 $w.slist add command -label $n -command [list query-setup $i]
2049 $w.clist delete 0 last
2050 foreach n $queryTypes {
2051 $w.clist add command -label $n -command [list query-select $i]
2055 $w.dlist delete 0 last
2056 foreach n $queryTypes {
2057 $w.dlist add command -label $n -command [list query-delete $i]
2062 proc save-geometry {} {
2063 global windowGeometry
2066 global displayFormat
2070 set windowGeometry(.) [wm geometry .]
2072 set f [open "~/.clientrc.tcl" w]
2074 puts $f "set hotTargets \{ $hotTargets \}"
2075 puts $f "set textWrap $textWrap"
2076 puts $f "set displayFormat $displayFormat"
2077 puts $f "set popupMarcdf $popupMarcdf"
2078 puts $f "set recordSyntax $recordSyntax"
2079 foreach n [array names windowGeometry] {
2080 puts -nonewline $f "set \{windowGeometry($n)\} \{"
2081 puts -nonewline $f $windowGeometry($n)
2087 proc save-settings {} {
2090 global settingsChanged
2095 if {![file writable "${libdir}/clientrc.tcl"]} {
2096 set a [alert "Cannot open ${libdir}/clientrc.tcl for writing. Do you \
2097 wish to save clientrc.tcl in the current directory instead?"]
2101 set f [open "clientrc.tcl" w]
2103 set f [open "${libdir}/clientrc.tcl" w]
2105 puts $f "# Setup file"
2107 foreach n [array names profile] {
2108 puts -nonewline $f "set \{profile($n)\} \{"
2109 puts -nonewline $f $profile($n)
2112 puts -nonewline $f "set queryTypes \{"
2113 puts -nonewline $f $queryTypes
2116 puts -nonewline $f "set queryButtons \{"
2117 puts -nonewline $f $queryButtons
2120 puts -nonewline $f "set queryInfo \{"
2121 puts -nonewline $f $queryInfo
2124 set settingsChanged 0
2133 set oldFocus [focus]
2137 label $w.top.warning -bitmap warning
2138 message $w.top.message -text $ask -aspect 300 \
2139 -font -Adobe-Times-Medium-R-Normal-*-180-*
2141 pack $w.top.warning $w.top.message -side left -pady 5 -padx 10 -expand yes
2144 top-down-ok-cancel $w {alert-action} 1
2149 proc alert-action {} {
2155 proc exit-action {} {
2156 global settingsChanged
2158 if {$settingsChanged} {
2159 set a [alert "you haven't saved your settings. Do you wish to save?"]
2168 proc listbuttonaction {w name h user i} {
2169 $w configure -text [lindex $name 0]
2170 $h [lindex $name 1] $user $i
2173 proc listbuttonx {button no names handle user} {
2174 if {[winfo exists $button]} {
2175 $button configure -text [lindex [lindex $names $no] 0]
2176 ${button}.m delete 0 last
2178 menubutton $button -text [lindex [lindex $names $no] 0] \
2179 -width 10 -menu ${button}.m -relief raised -border 1
2183 foreach name $names {
2184 ${button}.m add command -label [lindex $name 0] \
2185 -command [list listbuttonaction ${button} $name \
2191 proc listbutton {button no names} {
2192 menubutton $button -text [lindex $names $no] -width 10 -menu ${button}.m \
2193 -relief raised -border 1
2195 foreach name $names {
2196 ${button}.m add command -label $name \
2197 -command [list ${button} configure -text $name]
2201 proc listbuttonv-action {button var names i} {
2204 set $var [lindex $names [expr $i+1]]
2205 $button configure -text [lindex $names $i]
2208 proc listbuttonv {button var names} {
2212 eval "set val $$var"
2213 set l [llength $names]
2214 for {set i 1} {$i < $l} {incr i 2} {
2215 if {$val == [lindex $names $i]} {
2217 set n [lindex $names $i]
2221 if {[winfo exists $button]} {
2222 $button configure -text $n
2225 menubutton $button -text $n -menu ${button}.m \
2226 -relief raised -border 1
2228 for {set i 0} {$i < $l} {incr i 2} {
2229 ${button}.m add command -label [lindex $names $i] \
2230 -command [list listbuttonv-action $button $var $names $i]
2234 proc query-add-index-action {queryNo} {
2238 global queryButtonsTmp
2240 set newI [.query-add-index.top.index.entry get]
2241 lappend queryInfoTmp [list $newI {}]
2242 $w.top.index.list insert end $newI
2243 destroy .query-add-index
2244 #destroy $w.top.lines
2245 #frame $w.top.lines -relief ridge -border 2
2246 index-lines $w.top.lines 0 $queryButtonsTmp $queryInfoTmp activate-e-index
2247 #pack $w.top.lines -side left -pady 6 -padx 6 -fill y
2250 proc query-add-line {queryNo} {
2254 global queryButtonsTmp
2256 lappend queryButtonsTmp {I 0}
2258 #destroy $w.top.lines
2259 #frame $w.top.lines -relief ridge -border 2
2260 index-lines $w.top.lines 0 $queryButtonsTmp $queryInfoTmp activate-e-index
2261 #pack $w.top.lines -side left -pady 6 -padx 6 -fill y
2264 proc query-del-line {queryNo} {
2268 global queryButtonsTmp
2270 set l [llength $queryButtonsTmp]
2275 set queryButtonsTmp [lreplace $queryButtonsTmp $l $l]
2276 index-lines $w.top.lines 0 $queryButtonsTmp $queryInfoTmp activate-e-index
2279 proc query-add-index {queryNo} {
2280 set w .query-add-index
2283 set oldFocus [focus]
2284 place-force $w .query-setup
2288 -side top -anchor e -pady 2
2289 entry-fields $w.top {index} \
2291 [list query-add-index-action $queryNo] [list destroy $w]
2292 top-down-ok-cancel $w [list query-add-index-action $queryNo] 1
2296 proc query-setup-action {queryNo} {
2299 global queryButtonsTmp
2301 global queryButtonsFind
2302 global queryInfoFind
2304 global settingsChanged
2306 set settingsChanged 1
2308 set queryInfo [lreplace $queryInfo $queryNo $queryNo \
2310 set queryButtons [lreplace $queryButtons $queryNo $queryNo \
2312 set queryInfoFind $queryInfoTmp
2313 set queryButtonsFind $queryButtonsTmp
2315 destroy .query-setup
2316 index-lines .lines 1 $queryButtonsFind $queryInfoFind activate-index
2319 proc activate-e-index {value no i} {
2320 global queryButtonsTmp
2321 global queryIndexTmp
2323 set queryButtonsTmp [lreplace $queryButtonsTmp $no $no [list I $i]]
2324 dputs $queryButtonsTmp
2325 set queryIndexTmp $i
2328 proc activate-index {value no i} {
2329 global queryButtonsFind
2331 set queryButtonsFind [lreplace $queryButtonsFind $no $no [list I $i]]
2333 dputs "queryButtonsFind $queryButtonsFind"
2336 proc update-attr {} {
2338 listbuttonv $w.top.relation.b relationTmpValue\
2339 {{None} 0 {Less than} 1 {Greater than or equal} 2 {Equal} 3 \
2340 {Greater than or equal} 4 {Greater than} 5 {Not equal} 6 \
2341 {Phonetic} 100 {Stem} 101 {Relevance} 102 {AlwaysMatches} 103}
2342 listbuttonv $w.top.position.b positionTmpValue {{None} 0 \
2343 {First in field} 1 {First in subfield} 2 {Any position in field} 3}
2344 listbuttonv $w.top.structure.b structureTmpValue {{None} 0 {Phrase} 1 \
2345 {Word} 2 {Key} 3 {Year} 4 {Date (norm)} 5 {Word list} 6 \
2346 {Date (un-norm)} 100 {Name (norm)} 101 {Date (un-norm)} 102 \
2347 {Structure} 103 {urx} 104 {free-form} 105 {doc-text} 106 \
2348 {local-number} 107 {string} 108 {numeric string} 109}
2349 listbuttonv $w.top.truncation.b truncationTmpValue {{Auto} 0 {Right} 1 \
2350 {Left} 2 {Left and right} 3 {No truncation} 100 \
2351 {Process #} 101 {Re-1} 102 {Re-2} 103}
2352 listbuttonv $w.top.completeness.b completenessTmpValue {{None} 0 \
2353 {Incomplete subfield} 1 {Complete subfield} 2 {Complete field} 3}
2356 proc use-attr {init} {
2368 {BNB card number} 10
2369 {BGF(sic) number} 11
2371 {Dewey classification} 13
2372 {UDC classification} 14
2373 {Bliss classification} 15
2375 {NLM call number} 17
2376 {NAL call number} 18
2377 {MOS call number} 19
2378 {Local classification} 20
2379 {Subject heading} 21
2381 {BDI-index-subject} 23
2385 {LC-subject-heading} 27
2386 {RVM-subject-heading} 28
2387 {Local subject index} 29
2389 {Date of publication} 31
2390 {Date of acquisition} 32
2392 {Title-collective} 34
2395 {Title-added-title-page} 37
2399 {Title-other-variant} 41
2401 {Title-abbreviated} 43
2405 {Subject-subdivision} 47
2406 {Number-natl-bibliography} 48
2407 {Number-legal-deposit} 49
2408 {Number-govt-publication} 50
2409 {Number-publisher-for-music} 51
2411 {Number-local-call} 53
2413 {Code-geographic-area} 55
2414 {Code-institution} 56
2416 {Name-geographic} 58
2417 {Place-publication} 59
2419 {Microform-generation} 61
2426 {Author-name-personal} 1004
2427 {Author-name-corporate} 1005
2428 {Author-name-conference} 1006
2429 {Identifier-standard} 1007
2430 {Subject-LC-children's} 1008
2431 {Subject-name-personal} 1009
2433 {Date/time added to database} 1011
2434 {Date/time last modified} 1012
2435 {Authority/format identifier} 1013
2437 {Concept-reference} 1015
2439 {Server choice} 1017
2441 {Record source} 1019
2444 {Geographic class} 1022
2448 {Related periodical} 1026
2449 {Report number} 1027
2451 {Thematic number} 1030
2452 {Material type} 1031
2461 set l [llength $attr]
2466 for {set i 0} {$i < $l} {incr i} {
2467 $w.top.use.list insert end [lindex $attr $i]
2469 if {$useTmpValue == [lindex $attr $i]} {
2475 $w.top.use.list selection clear 0 end
2476 $w.top.use.list selection set $s $s
2478 $w.top.use.list select from $s
2479 $w.top.use.list select to $s
2485 $w.top.use.list yview $s
2487 set lno [lindex [$w.top.use.list curselection] 0]
2488 set i [expr $lno+$lno+1]
2489 set useTmpValue [lindex $attr $i]
2490 dputs "useTmpValue=$useTmpValue"
2494 proc index-setup-action {oldAttr queryNo indexNo} {
2495 set attr [lindex $oldAttr 0]
2498 global relationTmpValue
2499 global structureTmpValue
2500 global truncationTmpValue
2501 global completenessTmpValue
2502 global positionTmpValue
2507 dputs "index-setup-action"
2508 dputs "queryNo $queryNo"
2509 dputs "indexNo $indexNo"
2510 if {$useTmpValue > 0} {
2511 lappend attr "1=$useTmpValue"
2513 if {$relationTmpValue > 0} {
2514 lappend attr "2=$relationTmpValue"
2516 if {$positionTmpValue > 0} {
2517 lappend attr "3=$positionTmpValue"
2519 if {$structureTmpValue > 0} {
2520 lappend attr "4=$structureTmpValue"
2522 if {$truncationTmpValue > 0} {
2523 lappend attr "5=$truncationTmpValue"
2525 if {$completenessTmpValue > 0} {
2526 lappend attr "6=$completenessTmpValue"
2528 dputs "new attr $attr"
2529 set queryInfoTmp [lreplace $queryInfoTmp $indexNo $indexNo $attr]
2530 destroy .index-setup
2533 proc index-setup {attr queryNo indexNo} {
2536 global relationTmpValue
2537 global structureTmpValue
2538 global truncationTmpValue
2539 global completenessTmpValue
2540 global positionTmpValue
2543 set relationTmpValue 0
2544 set truncationTmpValue 0
2545 set structureTmpValue 0
2546 set positionTmpValue 0
2547 set completenessTmpValue 0
2550 set len [llength $attr]
2551 for {set i 1} {$i < $len} {incr i} {
2552 set q [lindex $attr $i]
2553 set l [string first = $q]
2555 set t [string range $q 0 [expr $l - 1]]
2556 set v [string range $q [expr $l + 1] end]
2559 { set useTmpValue $v }
2561 { set relationTmpValue $v }
2563 { set positionTmpValue $v }
2565 { set structureTmpValue $v }
2567 { set truncationTmpValue $v }
2569 { set completenessTmpValue $v }
2573 if {[winfo exists $w]} {
2578 set n [lindex $attr 0]
2579 wm title $w "Index setup $n"
2583 frame $w.top.use -relief ridge -border 2
2584 frame $w.top.relation -relief ridge -border 2
2585 frame $w.top.position -relief ridge -border 2
2586 frame $w.top.structure -relief ridge -border 2
2587 frame $w.top.truncation -relief ridge -border 2
2588 frame $w.top.completeness -relief ridge -border 2
2594 pack $w.top.use -side left -pady 6 -padx 6 -fill y
2596 label $w.top.use.label -text "Use"
2598 listbox $w.top.use.list -width 26 \
2599 -yscrollcommand "$w.top.use.scroll set"
2601 listbox $w.top.use.list -geometry 26x10 \
2602 -yscrollcommand "$w.top.use.scroll set"
2604 scrollbar $w.top.use.scroll -orient vertical -border 1
2605 pack $w.top.use.label -side top -fill x \
2607 pack $w.top.use.list -side left -fill both -expand yes \
2609 pack $w.top.use.scroll -side right -fill y \
2611 $w.top.use.scroll config -command "$w.top.use.list yview"
2615 # Relation Attributes
2617 pack $w.top.relation -pady 6 -padx 6 -side top
2618 label $w.top.relation.label -text "Relation" -width 18
2620 pack $w.top.relation.label $w.top.relation.b -fill x
2622 # Position Attributes
2624 pack $w.top.position -pady 6 -padx 6 -side top
2625 label $w.top.position.label -text "Position" -width 18
2627 pack $w.top.position.label $w.top.position.b -fill x
2629 # Structure Attributes
2631 pack $w.top.structure -pady 6 -padx 6 -side top
2632 label $w.top.structure.label -text "Structure" -width 18
2634 pack $w.top.structure.label $w.top.structure.b -fill x
2636 # Truncation Attributes
2638 pack $w.top.truncation -pady 6 -padx 6 -side top
2639 label $w.top.truncation.label -text "Truncation" -width 18
2641 pack $w.top.truncation.label $w.top.truncation.b -fill x
2643 # Completeness Attributes
2645 pack $w.top.completeness -pady 6 -padx 6 -side top
2646 label $w.top.completeness.label -text "Completeness" -width 18
2648 pack $w.top.completeness.label $w.top.completeness.b -fill x
2651 bottom-buttons $w [list \
2652 {Ok} [list index-setup-action $attr $queryNo $indexNo] \
2653 {Cancel} [list destroy $w]] 0
2657 proc query-edit-index {queryNo} {
2661 set i [lindex [$w.top.index.list curselection] 0]
2665 set attr [lindex $queryInfoTmp $i]
2666 dputs "Editing no $i $attr"
2667 index-setup $attr $queryNo $i
2670 proc query-delete-index {queryNo} {
2672 global queryButtonsTmp
2675 set i [lindex [$w.top.index.list curselection] 0]
2679 set queryInfoTmp [lreplace $queryInfoTmp $i $i]
2680 index-lines $w.top.lines 0 $queryButtonsTmp $queryInfoTmp activate-e-index
2681 $w.top.index.list delete $i
2684 proc query-setup {queryNo} {
2690 global queryButtonsTmp
2692 global queryIndexTmp
2696 set queryName [lindex $queryTypes $queryNo]
2697 set queryInfoTmp [lindex $queryInfo $queryNo]
2698 set queryButtonsTmp [lindex $queryButtons $queryNo]
2703 wm title $w "Query setup $queryName"
2707 frame $w.top.lines -relief ridge -border 2
2709 pack $w.top.lines -side left -pady 6 -padx 6 -fill y
2713 index-lines $w.top.lines 0 $queryButtonsTmp $queryInfoTmp activate-e-index
2715 button $w.top.lines.add -text "Add" \
2716 -command [list query-add-line $queryNo]
2717 button $w.top.lines.del -text "Remove" \
2718 -command [list query-del-line $queryNo]
2720 pack $w.top.lines.del -fill x -side bottom
2721 pack $w.top.lines.add -fill x -pady 10 -side bottom
2725 frame $w.top.index -relief ridge -border 2
2726 pack $w.top.index -pady 6 -padx 6 -side right -fill y
2728 listbox $w.top.index.list -yscrollcommand [list $w.top.index.scroll set]
2729 scrollbar $w.top.index.scroll -orient vertical -border 1 \
2730 -command [list $w.top.index.list yview]
2731 bind $w.top.index.list <2> [list query-edit-index $queryNo]
2733 pack $w.top.index.list -side left -fill both -expand yes -padx 2 -pady 2
2734 pack $w.top.index.scroll -side right -fill y -padx 2 -pady 2
2737 $w.top.index.list selection clear 0 end
2738 $w.top.index.list selection set 0 0
2740 $w.top.index.list select from 0
2741 $w.top.index.list select to 0
2744 foreach x $queryInfoTmp {
2745 $w.top.index.list insert end [lindex $x 0]
2748 bottom-buttons $w [list \
2749 {Ok} [list query-setup-action $queryNo] \
2750 {Add index} [list query-add-index $queryNo] \
2751 {Edit index} [list query-edit-index $queryNo] \
2752 {Delete index} [list query-delete-index $queryNo] \
2753 {Cancel} [list destroy $w]] 0
2756 proc index-clear {} {
2757 global queryButtonsFind
2760 foreach b $queryButtonsFind {
2761 .lines.$i.e delete 0 end
2766 proc index-query {} {
2767 global queryButtonsFind
2768 global queryInfoFind
2773 foreach b $queryButtonsFind {
2774 set term [string trim [.lines.$i.e get]]
2776 set attr [lrange [lindex $queryInfoFind [lindex $b 1]] 1 end]
2778 set len [string length $term]
2782 if {[string index $term $len] == "?"} {
2784 set term [string range $term 0 [expr $len - 1]]
2786 if {[string index $term 0] == "?"} {
2788 set term [string range $term 1 end]
2790 set term "\{${term}\}"
2791 if {$right && $left} {
2792 set term "@attr 5=3 ${term}"
2794 set term "@attr 5=1 ${term}"
2796 set term "@attr 5=2 ${term}"
2799 set term "@attr $a ${term}"
2802 set qs "@and ${qs} ${term}"
2813 proc index-focus-in {w i} {
2814 global curIndexEntry
2818 $w.$i configure -background red
2820 set curIndexEntry $i
2823 proc index-lines {w realOp buttonInfo queryInfo handle} {
2826 foreach b $buttonInfo {
2827 if {! [winfo exists $w.$i]} {
2829 frame $w.$i -border 0
2831 frame $w.$i -background white -border 1
2834 listbuttonx $w.$i.l [lindex $b 1] $queryInfo $handle $i
2837 if {! [winfo exists $w.$i.e]} {
2838 entry $w.$i.e -width 32 -relief sunken -border 1
2839 bind $w.$i.e <FocusIn> [list index-focus-in $w $i]
2840 bind $w.$i.e <FocusOut> [list $w.$i configure \
2842 pack $w.$i.l -side left
2843 pack $w.$i.e -side left -fill x -expand yes
2844 pack $w.$i -side top -fill x -padx 2 -pady 2
2846 bind $w.$i.e <Left> [list left-cursor $w.$i.e]
2847 bind $w.$i.e <Right> [list right-cursor $w.$i.e]
2849 bind $w.$i.e <Return> {search-request 0}
2852 pack $w.$i.l -side left
2853 pack $w.$i -side top -fill x -padx 2 -pady 2
2858 while {[winfo exists $w.$j]} {
2870 bind $w.$j.e <Tab> "focus $w.$k.e"
2876 bind $w.$i.e <Tab> "focus $w.0.e"
2882 proc search-fields {w buttondefs} {
2884 foreach buttondef $buttondefs {
2885 frame $w.$i -background white
2887 listbutton $w.$i.l 0 $buttondef
2888 entry $w.$i.e -width 32 -relief sunken
2890 pack $w.$i.l -side left
2891 pack $w.$i.e -side left -fill x -expand yes
2893 pack $w.$i -side top -fill x -padx 2 -pady 2
2895 bind $w.$i.e <Left> [list left-cursor $w.$i.e]
2896 bind $w.$i.e <Right> [list right-cursor $w.$i.e]
2904 bind $w.$j.e <Tab> "focus $w.$k.e \n
2905 $w.$k configure -background red \n
2906 $w.$j configure -background white"
2909 bind $w.$i.e <Tab> "focus $w.0.e \n
2910 $w.0 configure -background red \n
2911 $w.$i configure -background white"
2913 $w.0 configure -background red
2916 if {[info exists windowGeometry(.)]} {
2917 set g $windowGeometry(.)
2925 frame .top -border 1 -relief raised
2926 frame .lines -border 1 -relief raised
2927 frame .mid -border 1 -relief raised
2928 frame .data -border 1 -relief raised
2929 frame .bot -border 1 -relief raised
2930 pack .top .lines .mid -side top -fill x
2931 pack .data -side top -fill both -expand yes
2934 menubutton .top.file -text "File" -menu .top.file.m
2936 .top.file.m add command -label "Save settings" -command {save-settings}
2937 .top.file.m add separator
2938 .top.file.m add command -label "Exit" -command {exit-action}
2940 menubutton .top.target -text "Target" -menu .top.target.m
2942 .top.target.m add cascade -label "Connect" -menu .top.target.m.clist
2943 .top.target.m add command -label "Disconnect" -command {close-target}
2944 .top.target.m add command -label "About" -command {about-target}
2945 .top.target.m add cascade -label "Setup" -menu .top.target.m.slist
2946 .top.target.m add command -label "Setup new" -command {define-target-dialog}
2947 .top.target.m add separator
2948 set-target-hotlist 0
2950 configure-disable-e .top.target.m 1
2951 configure-disable-e .top.target.m 2
2953 menu .top.target.m.clist
2954 menu .top.target.m.slist
2957 menubutton .top.service -text "Service" -menu .top.service.m
2959 .top.service.m add command -label "Database" -command {database-select}
2960 .top.service.m add cascade -label "Present" -menu .top.service.m.present
2961 menu .top.service.m.present
2962 .top.service.m.present add command -label "10 More" \
2963 -command [list present-more 10]
2964 .top.service.m.present add command -label "All" \
2965 -command [list present-more {}]
2966 .top.service.m add command -label "Search" -command {search-request 0}
2967 .top.service.m add command -label "Scan" -command {scan-request}
2969 .top.service configure -state disabled
2971 menubutton .top.rset -text "Set" -menu .top.rset.m
2973 .top.rset.m add command -label "Load" -command {load-set}
2974 .top.rset.m add separator
2976 menubutton .top.options -text "Options" -menu .top.options.m
2978 .top.options.m add cascade -label "Query" -menu .top.options.m.query
2979 .top.options.m add cascade -label "Format" -menu .top.options.m.formats
2980 .top.options.m add cascade -label "Wrap" -menu .top.options.m.wrap
2981 .top.options.m add cascade -label "Syntax" -menu .top.options.m.syntax
2983 menu .top.options.m.query
2984 .top.options.m.query add cascade -label "Select" \
2985 -menu .top.options.m.query.clist
2986 .top.options.m.query add cascade -label "Edit" \
2987 -menu .top.options.m.query.slist
2988 .top.options.m.query add command -label "New" \
2989 -command {query-new}
2990 .top.options.m.query add cascade -label "Delete" \
2991 -menu .top.options.m.query.dlist
2993 menu .top.options.m.query.slist
2994 menu .top.options.m.query.clist
2995 menu .top.options.m.query.dlist
2998 menu .top.options.m.formats
3000 foreach f $displayFormats {
3001 .top.options.m.formats add radiobutton -label $f -value $i \
3002 -command [list set-display-format $i] -variable displayFormat
3006 menu .top.options.m.wrap
3007 .top.options.m.wrap add radiobutton -label "Character" \
3008 -value char -variable textWrap -command {set-wrap char}
3009 .top.options.m.wrap add radiobutton -label "Word" \
3010 -value word -variable textWrap -command {set-wrap word}
3011 .top.options.m.wrap add radiobutton -label "None" \
3012 -value none -variable textWrap -command {set-wrap none}
3014 menu .top.options.m.syntax
3015 .top.options.m.syntax add radiobutton -label "None" \
3016 -value None -variable recordSyntax
3017 .top.options.m.syntax add separator
3018 .top.options.m.syntax add radiobutton -label "USMARC" \
3019 -value USMARC -variable recordSyntax
3020 .top.options.m.syntax add radiobutton -label "UNIMARC" \
3021 -value UNIMARC -variable recordSyntax
3022 .top.options.m.syntax add radiobutton -label "UKMARC" \
3023 -value UKMARC -variable recordSyntax
3024 .top.options.m.syntax add radiobutton -label "DANMARC" \
3025 -value DANMARC -variable recordSyntax
3026 .top.options.m.syntax add radiobutton -label "FINMARC" \
3027 -value FINMARC -variable recordSyntax
3028 .top.options.m.syntax add radiobutton -label "NORMARC" \
3029 -value NORMARC -variable recordSyntax
3030 .top.options.m.syntax add radiobutton -label "PICAMARC" \
3031 -value PICAMARC -variable recordSyntax
3032 .top.options.m.syntax add separator
3033 .top.options.m.syntax add radiobutton -label "SUTRS" \
3034 -value SUTRS -variable recordSyntax
3036 menubutton .top.help -text "Help" -menu .top.help.m
3039 .top.help.m add command -label "Help on help" \
3040 -command {tkerror "Help on help not available. Sorry"}
3041 .top.help.m add command -label "About" -command {about-origin}
3043 pack .top.file .top.target .top.service .top.rset .top.options -side left
3044 pack .top.help -side right
3046 index-lines .lines 1 $queryButtonsFind [lindex $queryInfo 0] activate-index
3048 button .mid.search -width 7 -text {Search} -command {search-request 0} \
3050 button .mid.scan -width 7 -text {Scan} \
3051 -command scan-request -state disabled
3052 button .mid.present -width 7 -text {Present} -command [list present-more 10] \
3055 button .mid.clear -width 7 -text {Clear} -command index-clear
3056 pack .mid.search .mid.scan .mid.present .mid.clear -side left \
3057 -fill y -padx 5 -pady 3
3059 text .data.record -height 2 -width 20 -wrap none \
3060 -yscrollcommand [list .data.scroll set] -wrap $textWrap
3061 scrollbar .data.scroll -command [list .data.record yview]
3063 .data.record configure -takefocus 0
3064 .data.scroll configure -takefocus 0
3066 pack .data.scroll -side right -fill y
3067 pack .data.record -expand yes -fill both
3071 .data.record tag configure marc-tag -foreground blue
3072 .data.record tag configure marc-id -foreground red
3074 .data.record tag configure marc-tag -foreground black
3075 .data.record tag configure marc-id -foreground black
3077 .data.record tag configure marc-data -foreground black
3079 button .bot.logo -bitmap @${libdir}/bitmaps/book1 -command cancel-operation
3081 .bot.logo configure -takefocus 0
3084 pack .bot.a -side left -fill x
3085 pack .bot.logo -side right -padx 2 -pady 2
3087 message .bot.a.target -text "" -aspect 1000 -border 1
3089 label .bot.a.status -text "Not connected" -width 15 -relief \
3090 sunken -anchor w -border 1
3091 label .bot.a.set -text "" -width 5 -relief \
3092 sunken -anchor w -border 1
3093 label .bot.a.message -text "" -width 15 -relief \
3094 sunken -anchor w -border 1
3096 pack .bot.a.target -side top -anchor nw -padx 2 -pady 2
3097 pack .bot.a.status .bot.a.set .bot.a.message \
3098 -side left -padx 2 -pady 2