1 # IR toolkit for tcl/tk
3 # See the file LICENSE for details.
4 # Sebastian Hammer, Adam Dickmeiss
7 # Revision 1.63 1995-08-04 13:20:48 adam
8 # Buttons at the bottom are slightly smaller.
10 # Revision 1.62 1995/08/04 11:32:37 adam
11 # More work on output queue. Memory related routines moved
14 # Revision 1.61 1995/07/20 08:09:39 adam
15 # client.tcl: Targets removed from hotTargets list when targets
16 # are removed/modified.
17 # ir-tcl.c: More work on triggerResourceControl.
19 # Revision 1.60 1995/06/30 16:30:19 adam
22 # Revision 1.59 1995/06/29 14:06:25 adam
23 # Another bug in install fixed. Configure searches for more versions of yaz.
25 # Revision 1.58 1995/06/29 12:34:06 adam
26 # IrTcl now works with both tk4.0b4/tcl7.4b4 and tk3.6/tcl7.3
28 # Revision 1.57 1995/06/29 09:20:30 adam
29 # Target entries in cascade menus are sorted.
31 # Revision 1.56 1995/06/27 19:03:48 adam
32 # Bug fix in do_present in ir-tcl.c: p->set_child member weren't set.
33 # nextResultSetPosition used instead of setOffset.
35 # Revision 1.55 1995/06/27 17:10:37 adam
36 # Bug fix: install procedure didn't work on some systems.
37 # Error turned up when clientrc.tcl was't present.
39 # Revision 1.54 1995/06/27 14:41:03 adam
40 # Bug fix in search-response. Didn't always observe non-surrogate diagnostics.
42 # Revision 1.53 1995/06/26 12:40:09 adam
43 # Client defines its own tkerror.
44 # User may specify 'no preferredRecordSyntax'.
46 # Revision 1.52 1995/06/22 13:14:59 adam
47 # Feature: SUTRS. Setting getSutrs implemented.
48 # Work on display formats.
49 # Preferred record syntax can be set by the user.
51 # Revision 1.51 1995/06/21 11:11:00 adam
52 # Bug fix: libdir undefined in about-origin.
54 # Revision 1.50 1995/06/21 11:04:48 adam
55 # Uses GNU autoconf 2.3.
56 # Install procedure implemented.
57 # boook bitmaps moved to sub directory bitmaps.
59 # Revision 1.49 1995/06/20 14:16:42 adam
60 # More work on cancel mechanism.
62 # Revision 1.48 1995/06/20 08:07:23 adam
63 # New setting: failInfo.
64 # Working on better cancel mechanism.
66 # Revision 1.47 1995/06/19 14:05:29 adam
67 # Bug fix: asked for SUTRS.
69 # Revision 1.46 1995/06/19 13:06:06 adam
70 # New define: IR_TCL_VERSION.
72 # Revision 1.45 1995/06/19 08:08:44 adam
73 # client.tcl: hotTargets now contain both database and target name.
74 # ir-tcl.c: setting protocol edited. Errors in callbacks are logged
75 # by logf(LOG_WARN, ...) calls.
77 # Revision 1.44 1995/06/16 14:55:18 adam
80 # Revision 1.43 1995/06/16 14:41:05 adam
81 # Scan line entries can be copied to a search entry.
83 # Revision 1.42 1995/06/16 12:28:13 adam
84 # Implemented preferredRecordSyntax.
85 # Minor changes in diagnostic handling.
86 # Record list deleted when connection closes.
88 # Revision 1.41 1995/06/14 15:07:59 adam
89 # Bug fix in cascade-target-list. Uses yaz-version.h.
91 # Revision 1.40 1995/06/14 13:37:17 adam
92 # Setting recordType implemented.
93 # Setting implementationVersion implemented.
94 # Settings implementationId / implementationName edited.
96 # Revision 1.39 1995/06/14 12:16:22 adam
97 # hotTargets, textWrap and displayFormat saved in clientg.tcl.
99 # Revision 1.38 1995/06/14 07:22:45 adam
100 # Target definitions can be deleted.
101 # Listbox used in the query definition dialog.
103 # Revision 1.37 1995/06/13 14:37:59 adam
104 # Work on query setup.
105 # Better about origin/target.
106 # Better presentation formats.
108 # Revision 1.36 1995/06/13 07:42:14 adam
109 # Bindings removed from text widgets.
111 # Revision 1.35 1995/06/12 15:17:31 adam
112 # Text widget used in main window (instead of listbox) to support
113 # better presentation formats.
115 # Revision 1.34 1995/06/12 07:59:07 adam
116 # More work on geometry handling.
118 # Revision 1.33 1995/06/09 11:17:35 adam
119 # Start work on geometry management.
121 # Revision 1.32 1995/06/07 09:16:37 adam
122 # New presentation format.
124 # Revision 1.31 1995/06/06 16:31:09 adam
125 # Bug fix: target names couldn't contain blanks.
128 # Revision 1.30 1995/06/06 11:35:41 adam
129 # Work on scan. Display of old sets.
131 # Revision 1.29 1995/06/05 14:11:18 adam
132 # Bug fix in present-more.
134 # Revision 1.28 1995/06/02 14:52:13 adam
135 # Minor changes really.
137 # Revision 1.27 1995/06/02 14:29:42 adam
138 # Work on scan interface - up/down buttons.
140 # Revision 1.26 1995/06/01 16:36:46 adam
141 # About buttons. Minor bug fixes.
143 # Revision 1.25 1995/05/31 13:09:57 adam
144 # Client searches/presents may be interrupted.
145 # New moving book-logo.
147 # Revision 1.24 1995/05/31 08:36:24 adam
148 # Bug fix in client.tcl: didn't save options on clientrc.tcl.
149 # New method: referenceId. More work on scan.
151 # Revision 1.23 1995/05/29 10:33:41 adam
152 # README and rename of startup script.
154 # Revision 1.22 1995/05/26 11:44:09 adam
155 # Bugs fixed. More work on MARC utilities and queries. Test
156 # client is up-to-date again.
158 # Revision 1.21 1995/05/11 15:34:46 adam
159 # Scan request changed a bit. This version works with RLG.
161 # Revision 1.20 1995/04/21 16:31:57 adam
162 # New radiobutton: protocol (z39v2/SR).
164 # Revision 1.19 1995/04/18 16:11:50 adam
165 # First version of graphical Scan. Some work on query-by-form.
167 # Revision 1.18 1995/04/10 10:50:22 adam
168 # Result-set name defaults to suffix of ir-set name.
169 # Started working on scan. Not finished at this point.
171 # Revision 1.17 1995/03/31 09:34:57 adam
172 # Search-button disabled when there is no connection.
174 # Revision 1.16 1995/03/31 08:56:36 adam
175 # New button "Search".
177 # Revision 1.15 1995/03/28 12:45:22 adam
178 # New ir method failback: called on disconnect/protocol error.
179 # New ir set/get method: protocol: SR / Z3950.
180 # Simple popup and disconnect when failback is invoked.
182 # Revision 1.14 1995/03/22 16:07:55 adam
185 # Revision 1.13 1995/03/21 17:27:26 adam
186 # Short-hand keys in setup.
188 # Revision 1.12 1995/03/21 13:41:03 adam
189 # Comstack cs_create not used too often. Non-blocking connect.
191 # Revision 1.11 1995/03/21 10:39:06 adam
192 # Diagnostic error message displayed with tkerror.
194 # Revision 1.10 1995/03/20 15:24:06 adam
195 # Diagnostic records saved on searchResponse.
197 # Revision 1.9 1995/03/17 18:26:16 adam
198 # Non-blocking i/o used now. Database names popup as cascade items.
200 # Revision 1.8 1995/03/17 15:45:00 adam
201 # Improved target/database setup.
203 # Revision 1.7 1995/03/16 17:54:03 adam
204 # Minor changes really.
206 # Revision 1.6 1995/03/15 19:10:20 adam
207 # Database setup in protocol-setup (rather target setup).
209 # Revision 1.5 1995/03/15 13:59:23 adam
212 # Revision 1.4 1995/03/14 17:32:29 adam
213 # Presentation of full Marc record in popup window.
215 # Revision 1.3 1995/03/12 19:31:52 adam
216 # Pattern matching implemented when retrieving MARC records. More
217 # diagnostic functions.
219 # Revision 1.2 1995/03/10 18:00:15 adam
220 # Actual presentation in line-by-line format. RPN query support.
222 # Revision 1.1 1995/03/09 16:15:07 adam
223 # First presentRequest attempts. Hot-target list.
227 if {$tk_version == "3.6"} {
234 proc configure-enable-e {w n} {
236 $w entryconfigure $n -state normal
238 proc configure-disable-e {w n} {
240 $w entryconfigure $n -state disabled
242 set noFocus [list -takefocus 0]
244 proc configure-enable-e {w n} {
247 proc configure-disable-e {w n} {
254 if {[tk colormodel .] == "color"} {
264 if {[file readable bitmaps/book2]} {
267 if {! [file readable ${libdir}/bitmaps/book2]} {
268 puts "Cannot locate system files in ${libdir}. You must either run this"
269 puts "program from the source directory root of ir-tcl or you must assure"
270 puts "that it is installed - normally in /usr/local/lib/irtcl"
278 set profile(Default) {{} {} {210} {} 16384 8192 tcpip {} 1 {} {} Z39 1}
280 set settingsChanged 0
289 set recordSyntax None
292 set queryTypes {Simple}
293 set queryButtons { { {I 0} {I 1} {I 2} } }
294 set queryInfo { { {Title {1=4 4=1}} {Author {1=1}} \
295 {Subject {1=21}} {Any {1=1016}} } }
304 if {[winfo exists $w]} {
313 label $w.top.b -bitmap error
314 message $w.top.t -aspect 300 -text "Error: $err" \
315 -font -Adobe-Helvetica-Bold-R-Normal-*-180-*
316 pack $w.top.b $w.top.t -side left -padx 10 -pady 10
318 bottom-buttons $w [list {Close} [list destroy $w]] 1
321 proc read-formats {} {
322 global displayFormats
324 set formats [glob -nocomplain ${libdir}/formats/*.tcl]
326 if {[file readable $f]} {
328 set l [string length $f]
329 set f [string range $f [string length "${libdir}/formats/"] \
331 lappend displayFormats $f
340 .data.record configure -wrap $m
347 proc set-display-format {f} {
357 .bot.a.status configure -text "Reformatting"
360 add-title-lines -1 10000 1
363 proc initBindings {} {
366 bind $w <Double-1> {}
367 bind $w <Triple-1> {}
368 bind $w <B1-Motion> {}
370 bind $w <Shift-B1-Motion> {}
372 bind $w <B2-Motion> {}
373 bind $w <Any-KeyPress> {}
375 bind $w <BackSpace> {}
377 bind $w <Control-h> {}
378 bind $w <Control-d> {}
379 bind $w <Control-v> {}
382 bind $w <B1-Motion> {}
383 bind $w <Shift-B1-Motion> {}
388 proc post-menu {wbutton wmenu} {
391 $wmenu post [winfo rootx $wbutton] \
392 [expr [winfo rooty $wbutton]+[winfo height $wbutton]]
397 global windowGeometry
398 set windowGeometry($w) [wm geometry $w]
401 global windowGeometry
404 if {[info exists windowGeometry($w)]} {
405 set g $windowGeometry($w)
410 bind $w <Destroy> [list destroyGW $w]
413 if {[file readable "clientrc.tcl"]} {
414 source "clientrc.tcl"
416 if {[file readable "${libdir}/clientrc.tcl"]} {
417 source "${libdir}/clientrc.tcl"
421 if {[file readable "~/.clientrc.tcl"]} {
422 source "~/.clientrc.tcl"
425 set queryButtonsFind [lindex $queryButtons 0]
426 set queryInfoFind [lindex $queryInfo 0]
428 proc top-down-window {w} {
429 frame $w.top -relief raised -border 1
430 frame $w.bot -relief raised -border 1
432 pack $w.top -side top -fill both -expand yes
433 pack $w.bot -fill both
436 proc top-down-ok-cancel {w ok-action g} {
437 frame $w.bot.left -relief sunken -border 1
438 pack $w.bot.left -side left -expand yes -ipadx 2 -ipady 2 -padx 4 -pady 4
439 button $w.bot.left.ok -width 5 -text {Ok} \
440 -command ${ok-action}
441 pack $w.bot.left.ok -expand yes -ipadx 2 -ipady 2 -padx 3 -pady 3
442 button $w.bot.cancel -width 6 -text {Cancel} \
443 -command [list destroy $w]
444 pack $w.bot.cancel -side left -expand yes
452 proc bottom-buttons {w buttonList g} {
454 set l [llength $buttonList]
456 frame $w.bot.$i -relief sunken -border 1
457 pack $w.bot.$i -side left -expand yes -padx 4 -pady 4
458 button $w.bot.$i.ok -text [lindex $buttonList $i] \
459 -command [lindex $buttonList [expr $i+1]]
460 pack $w.bot.$i.ok -expand yes -ipadx 2 -ipady 2 -padx 2 -pady 2 -side left
464 button $w.bot.$i -text [lindex $buttonList $i] \
465 -command [lindex $buttonList [expr $i+1]]
466 pack $w.bot.$i -expand yes -ipadx 2 -ipady 2 -padx 2 -pady 2 -side left
476 proc cancel-operation {} {
484 show-status Cancel 0 1
488 proc show-target {target base} {
492 .bot.a.target configure -text ""
496 .bot.a.target configure -text "$target"
498 .bot.a.target configure -text "$target - $base"
502 proc show-logo {v1} {
511 .bot.logo configure -bitmap @${libdir}/bitmaps/book${v1}
512 after 140 [list show-logo $v1]
516 .bot.logo configure -bitmap @${libdir}/bitmaps/book1
525 proc show-status {status b sb} {
532 .bot.a.status configure -text "$status"
534 if {$busy == 0} {set busy 1}
542 .top.service configure -state normal
543 .mid.search configure -state normal
545 .mid.scan configure -state normal
548 configure-disable-e .top.service.m 1
549 } elseif {[z39.$setNo nextResultSetPosition] > 0 &&
550 [z39.$setNo nextResultSetPosition] <= [z39.$setNo resultCount]} {
551 configure-enable-e .top.service.m 1
552 .mid.present configure -state normal
554 configure-disable-e .top.service.m 1
555 .mid.present configure -state disabled
557 if {[winfo exists .scan-window]} {
558 .scan-window.bot.2 configure -state normal
559 .scan-window.bot.4 configure -state normal
562 .top.service configure -state disabled
563 .mid.search configure -state disabled
564 .mid.scan configure -state disabled
565 .mid.present configure -state disabled
567 if {[winfo exists .scan-window]} {
568 .scan-window.bot.2 configure -state disabled
569 .scan-window.bot.4 configure -state disabled
574 proc show-message {msg} {
575 .bot.a.message configure -text "$msg"
578 proc insertWithTags {w text args} {
579 set start [$w index insert]
580 $w insert insert $text
581 foreach tag [$w tag names $start] {
582 $w tag remove $tag $start insert
585 $w tag add $i $start insert
589 proc popup-license {} {
594 wm title $w "License"
600 text $w.top.t -width 80 -height 10 -wrap word \
601 -yscrollcommand [list $w.top.s set]
602 scrollbar $w.top.s -command [list $w.top.t yview]
604 pack $w.top.s -side right -fill y
605 pack $w.top.t -expand yes -fill both
607 if {[file readable "${libdir}/LICENSE"]} {
608 set f [open "${libdir}/LICENSE" r]
609 while {[gets $f buf] != -1} {
610 $w.top.t insert end $buf
611 $w.top.t insert end "\n"
615 bottom-buttons $w [list {Close} [list destroy $w]] 1
618 proc about-target {} {
619 set w .about-target-w
624 wm title $w "About target"
628 frame $w.top.a -relief ridge -border 2
629 frame $w.top.p -relief ridge -border 2
631 pack $w.top.a $w.top.p -side top -fill x
633 label $w.top.a.about -text "About"
634 label $w.top.a.irtcl -text $hostid \
635 -font -Adobe-Helvetica-Bold-R-Normal-*-240-*
636 pack $w.top.a.about $w.top.a.irtcl -side top
638 set i [z39 targetImplementationName]
639 label $w.top.p.in -text "Implementation name: $i"
640 set i [z39 targetImplementationId]
641 label $w.top.p.ii -text "Implementation id: $i"
642 set i [z39 targetImplementationVersion]
643 label $w.top.p.iv -text "Implementation version: $i"
645 label $w.top.p.op -text "Protocol options: $i"
647 pack $w.top.p.in $w.top.p.ii $w.top.p.iv $w.top.p.op -side top -anchor nw
649 bottom-buttons $w [list {Close} [list destroy $w]] 1
652 proc about-origin-logo {n} {
654 set w .about-origin-w
655 if {![winfo exists $w]} {
662 $w.top.a.logo configure -bitmap @${libdir}/bitmaps/book$n
663 after 140 [list about-origin-logo $n]
666 proc about-origin {} {
667 set w .about-origin-w
670 if {[winfo exists $w]} {
675 wm title $w "About IrTcl"
679 frame $w.top.a -relief ridge -border 2
680 frame $w.top.p -relief ridge -border 2
682 pack $w.top.a $w.top.p -side top -fill x
684 label $w.top.a.irtcl -text "IrTcl" \
685 -font -Adobe-Helvetica-Bold-R-Normal-*-240-*
686 label $w.top.a.logo -bitmap @${libdir}/bitmaps/book1
687 pack $w.top.a.irtcl $w.top.a.logo -side left -expand yes
689 set i [z39 implementationName]
690 label $w.top.p.in -text "Implementation name: $i"
691 set i [z39 implementationId]
692 label $w.top.p.ii -text "Implementation id: $i"
693 set i [z39 implementationVersion]
694 label $w.top.p.iv -text "Implementation version: $i"
696 pack $w.top.p.in $w.top.p.ii $w.top.p.iv -side top -anchor nw
699 bottom-buttons $w [list {Close} [list destroy $w] \
700 {License} [list popup-license]] 0
703 proc popup-marc {sno no b df} {
705 global displayFormats
708 if {[z39.$sno type $no] != "DB"} {
712 set w .full-marc-$fullMarcSeq
719 if {[winfo exists $w]} {
727 frame $w.top -relief raised -border 1
728 frame $w.bot -relief raised -border 1
730 pack $w.top -side top -fill both -expand yes
731 pack $w.bot -fill both
733 text $w.top.record -width 60 -height 5 -wrap word \
734 -yscrollcommand [list $w.top.s set]
735 scrollbar $w.top.s -command [list $w.top.record yview]
739 $w.top.record tag configure marc-tag -foreground blue
740 $w.top.record tag configure marc-id -foreground red
742 $w.top.record tag configure marc-tag -foreground black
743 $w.top.record tag configure marc-id -foreground black
745 $w.top.record tag configure marc-data -foreground black
748 $w.top.record delete 0.0 end
749 set recordType [z39.$sno recordType $no]
750 wm title $w "$recordType record #$no"
753 bind $w.top.record <Return> {destroy .full-marc}
755 pack $w.top.s -side right -fill y
756 pack $w.top.record -expand yes -fill both
759 bottom-buttons $w [list \
760 {Close} [list destroy $w]] 0
762 bottom-buttons $w [list \
763 {Close} [list destroy $w] \
764 {Duplicate} [list popup-marc $sno $no 1 0]] 0
765 menubutton $w.bot.formats -text "Format" -menu $w.bot.formats.m
766 menu $w.bot.formats.m
768 foreach f $displayFormats {
769 $w.bot.formats.m add radiobutton -label $f \
770 -variable popupMarcdf -value $i \
771 -command [list display-$f $sno $no $w.top.record 0]
774 pack $w.bot.formats -expand yes -ipadx 2 -ipady 2 \
775 -padx 3 -pady 3 -side left
779 $w.bot.formats.m delete 0 last
780 foreach f $displayFormats {
781 $w.bot.formats.m add radiobutton -label $f \
782 -variable popupMarcdf -value $i \
783 -command [list display-$f $sno $no $w.top.record 0]
787 set ffunc [lindex $displayFormats $df]
788 set ffunc "display-$ffunc"
790 $ffunc $sno $no $w.top.record 0
793 proc update-target-hotlist {target base} {
796 set olen [llength $hotTargets]
798 foreach e $hotTargets {
799 if {$target == [lindex $e 0] && $base == [lindex $e 1]} {
800 set hotTargets [lreplace $hotTargets $i $i]
805 set hotTargets [linsert $hotTargets 0 [list $target $base]]
806 set-target-hotlist $olen
809 proc delete-target-hotlist {target} {
812 set olen [llength $hotTargets]
814 foreach e $hotTargets {
815 if {$target == [lindex $e 0]} {
816 set hotTargets [lreplace $hotTargets $i $i]
820 set-target-hotlist $olen
823 proc set-target-hotlist {olen} {
829 .top.target.m delete 7 [expr 7+$olen]
831 .top.target.m delete 6 [expr 6+$olen]
835 foreach e $hotTargets {
836 set target [lindex $e 0]
837 set base [lindex $e 1]
839 .top.target.m add command -label "$i $target" -command \
840 [list reopen-target $target {}]
842 .top.target.m add command -label "$i $target - $base" -command \
843 [list reopen-target $target $base]
852 proc reopen-target {target base} {
854 open-target $target $base
855 update-target-hotlist $target $base
858 proc define-target-action {} {
861 set target [.target-define.top.target.entry get]
865 foreach n [array names profile] {
871 set seq [lindex $profile(Default) 12]
873 set profile($target) $profile(Default)
874 set profile(Default) [lreplace $profile(Default) 12 12 [incr seq]]
876 protocol-setup $target
877 destroy .target-define
880 proc fail-response {target} {
881 set c [lindex [z39 failInfo] 0]
882 set m [lindex [z39 failInfo] 1]
887 proc connect-response {target base} {
888 dputs "connect-response"
889 show-target $target $base
893 proc open-target {target base} {
898 z39 comstack [lindex $profile($target) 6]
899 z39 protocol [lindex $profile($target) 11]
900 z39 idAuthentication [lindex $profile($target) 3]
901 z39 maximumRecordSize [lindex $profile($target) 4]
902 z39 preferredMessageSize [lindex $profile($target) 5]
903 dputs "maximumRecordSize="
904 dputs [z39 maximumRecordSize]
905 dputs "preferredMessageSize="
906 dputs [z39 preferredMessageSize]
907 show-status Connecting 1 0
909 z39 databaseNames [lindex [lindex $profile($target) 7] 0]
911 z39 databaseNames $base
913 z39 failback [list fail-response $target]
914 z39 callback [list connect-response $target $base]
917 z39 connect [lindex $profile($target) 1]:[lindex $profile($target) 2]
920 tkerror $errorMessage
921 show-status "Not connected" 0 {}
925 configure-disable-e .top.target.m 0
926 configure-enable-e .top.target.m 1
927 configure-enable-e .top.target.m 2
930 proc close-target {} {
940 .bot.a.set configure -text ""
944 show-status {Not connected} 0 0
947 configure-disable-e .top.target.m 1
948 configure-disable-e .top.target.m 2
950 .top.rset.m delete 2 last
952 .top.rset.m delete 1 last
954 .top.rset.m add separator
955 configure-enable-e .top.target.m 0
958 proc load-set-action {} {
962 ir-set z39.$setNoLast z39
964 set fname [.load-set.top.filename.entry get]
967 show-status Loading 1 {}
969 z39.$setNoLast loadFile $fname
971 set no [z39.$setNoLast numberOfRecordsReturned]
972 add-title-lines $setNoLast $no 1
974 set l [format "%-4d %7d" $setNoLast $no]
975 .top.rset.m add command -label $l \
976 -command [list add-title-lines $setNoLast 10000 1]
977 show-status Ready 0 {}
987 frame $w.top.filename
988 pack $w.top.filename -side top -anchor e -pady 2
990 entry-fields $w.top {filename} \
992 {load-set-action} {destroy .load-set}
994 top-down-ok-cancel $w {load-set-action} 1
998 proc init-request {} {
1005 z39 callback {init-response}
1006 show-status Initializing 1 {}
1007 set err [catch {z39 init} errorMessage]
1009 tkerror $errorMessage
1010 show-status Ready 0 {}
1014 proc init-response {} {
1022 if {![z39 initResult]} {
1023 show-status Ready 0 1
1024 set u [z39 userInformationField]
1026 tkerror "Connection rejected by target: $u"
1028 if {[lsearch [z39 options] scan] >= 0} {
1033 show-status Ready 0 1
1037 proc search-request {bflag} {
1049 dputs "search-request"
1051 if {!$bflag && $busy} {
1052 dputs "busy: search-request ignored"
1057 show-status Searching 1 0
1058 set delayRequest {search-request 1}
1063 set query [index-query]
1068 set setNo $setNoLast
1069 ir-set z39.$setNo z39
1071 if {[lindex $profile($target) 10] == 1} {
1072 z39.$setNo setName $setNo
1073 dputs "setName=${setNo}"
1075 z39.$setNo setName Default
1076 dputs "setName=Default"
1078 if {[lindex $profile($target) 8] == 1} {
1079 z39.$setNo queryType rpn
1081 if {[lindex $profile($target) 9] == 1} {
1082 z39.$setNo queryType ccl
1086 if {$recordSyntax == "None" } {
1087 z39.$setNo preferredRecordSyntax {}
1089 z39.$setNo preferredRecordSyntax $recordSyntax
1091 z39 callback {search-response}
1092 z39.$setNo search $query
1093 show-status Searching 1 0
1096 proc scan-copy {y entry} {
1098 set no [$w.top.list nearest $y]
1100 .lines.$entry.e delete 0 end
1101 .lines.$entry.e insert 0 [string range [$w.top.list get $no] 8 end]
1104 proc scan-request {} {
1111 global curIndexEntry
1112 global queryButtonsFind
1113 global queryInfoFind
1117 dputs "scan-request"
1120 show-status Scanning 1 0
1121 set delayRequest scan-request
1130 set b [lindex $queryButtonsFind $curIndexEntry]
1132 foreach a [lrange [lindex $queryInfoFind [lindex $b 1]] 1 end] {
1133 set attr "@attr $a $attr"
1135 set title [lindex [lindex $queryInfoFind [lindex $b 1]] 0]
1136 ir-scan z39.scan z39
1138 if {![winfo exists $w]} {
1145 entry $w.top.entry -relief sunken
1146 pack $w.top.entry -fill x -padx 4 -pady 2
1147 bind $w.top.entry <KeyRelease> [list scan-term-h $attr]
1148 listbox $w.top.list -yscrollcommand [list $w.top.scroll set] \
1150 scrollbar $w.top.scroll -orient vertical -border 1
1151 pack $w.top.list -side left -fill both -expand yes
1152 pack $w.top.scroll -side right -fill y
1153 $w.top.scroll config -command [list $w.top.list yview]
1155 bottom-buttons $w [list {Close} [list destroy $w] \
1156 {Up} [list scan-up $attr] \
1157 {Down} [list scan-down $attr]] 0
1158 bind $w.top.list <Up> [list scan-up $attr]
1159 bind $w.top.list <Down> [list scan-down $attr]
1162 bind $w.top.list <Double-Button-1> [list scan-copy %y $curIndexEntry]
1163 wm title $w "Scan $title"
1165 z39 callback [list scan-response $attr 0 35]
1166 z39.scan numberOfTermsRequested 5
1167 z39.scan preferredPositionInResponse 1
1168 z39.scan scan "${attr} 0"
1170 show-status Scanning 1 0
1173 proc scan-term-h {attr} {
1181 set nScanTerm [$w.top.entry get]
1182 if {$nScanTerm == $scanTerm} {
1185 set scanTerm $nScanTerm
1186 z39 callback [list scan-response $attr 0 35]
1187 z39.scan numberOfTermsRequested 5
1188 z39.scan preferredPositionInResponse 1
1189 dputs "${attr} \{${scanTerm}\}"
1190 if {$scanTerm == ""} {
1191 z39.scan scan "${attr} 0"
1193 z39.scan scan "${attr} \{${scanTerm}\}"
1195 show-status Scanning 1 0
1198 proc scan-response {attr start toget} {
1205 dputs "In scan-response"
1206 set m [z39.scan numberOfEntriesReturned]
1212 if {![winfo exists .scan-window]} {
1215 dputs "Handling cancel"
1216 if {$delayRequest != ""} {
1221 show-status Ready 0 1
1224 set nScanTerm [$w.top.entry get]
1225 if {$nScanTerm != $scanTerm} {
1226 z39 callback [list scan-response $attr 0 35]
1227 z39.scan numberOfTermsRequested 5
1228 z39.scan preferredPositionInResponse 1
1229 set scanTerm $nScanTerm
1230 dputs "${attr} \{${scanTerm}\}"
1231 if {$scanTerm == ""} {
1232 z39.scan scan "${attr} 0"
1234 z39.scan scan "${attr} \{${scanTerm}\}"
1236 show-status Scanning 1 0
1239 set status [z39.scan scanStatus]
1242 show-status Ready 0 1
1247 for {set i 0} {$i < $m} {incr i} {
1248 set term [lindex [z39.scan scanLine $i] 1]
1249 set nostr [format " %-6d" [lindex [z39.scan scanLine $i] 2]]
1250 $w.top.list insert $i "$nostr $term"
1253 $w.top.list yview $scanView
1255 $w.top.list delete $start end
1256 for {set i 0} {$i < $m} {incr i} {
1257 set term [lindex [z39.scan scanLine $i] 1]
1258 set nostr [format " %-6d" [lindex [z39.scan scanLine $i] 2]]
1259 $w.top.list insert end "$nostr $term"
1263 dputs "Handling cancel"
1265 if {$delayRequest != ""} {
1271 if {$toget > 0 && $m > 1 && $m < $toget} {
1272 set ntoget [expr $toget - $m + 1]
1273 dputs ntoget=$ntoget
1274 z39 callback [list scan-response $attr [expr $start + $m - 1] $ntoget]
1276 dputs "down continue: $q"
1278 z39.scan numberOfTermsRequested 10
1280 z39.scan numberOfTermsRequested $ntoget
1282 z39.scan preferredPositionInResponse 1
1283 dputs "${attr} \{$q\}"
1284 z39.scan scan "${attr} \{$q\}"
1287 if {$toget < 0 && $m > 1 && $m < [expr - $toget]} {
1288 set ntoget [expr - $toget - $m]
1289 dputs ntoget=$ntoget
1290 z39 callback [list scan-response $attr 0 -$ntoget]
1291 set q [string range [$w.top.list get 0] 8 end]
1292 dputs "up continue: $q"
1294 z39.scan numberOfTermsRequested 10
1295 z39.scan preferredPositionInResponse 11
1297 z39.scan numberOfTermsRequested $ntoget
1298 z39.scan preferredPositionInResponse [incr ntoget]
1300 dputs "${attr} \{$q\}"
1301 z39.scan scan "${attr} \{$q\}"
1304 show-status Ready 0 1
1307 proc scan-down {attr} {
1315 show-status {Scanning down} 1 0
1316 set delayRequest [list scan-down $attr]
1322 set scanView [expr $scanView + 5]
1323 set s [$w.top.list size]
1324 if {$scanView > $s} {
1325 z39 callback [list scan-response $attr [expr $s - 1] 25]
1326 set q [string range [$w.top.list get [expr $s - 1]] 8 end]
1328 z39.scan numberOfTermsRequested 10
1329 z39.scan preferredPositionInResponse 1
1330 show-status Scanning 1 0
1331 dputs "${attr} \{$q\}"
1332 z39.scan scan "${attr} \{$q\}"
1335 $w.top.list yview $scanView
1338 proc scan-up {attr} {
1346 show-status Scanning 1 0
1347 set delayRequest [list scan-up $attr]
1353 set scanView [expr $scanView - 5]
1354 if {$scanView < 0} {
1355 z39 callback [list scan-response $attr 0 -25]
1356 set q [string range [$w.top.list get 0] 8 end]
1358 z39.scan numberOfTermsRequested 10
1359 z39.scan preferredPositionInResponse 11
1360 show-status Scanning 1 0
1361 z39.scan scan "${attr} \{$q\}"
1364 $w.top.list yview $scanView
1367 proc search-response {} {
1375 dputs "In search-response"
1377 dputs "Handling cancel"
1379 if {$delayRequest != ""} {
1387 set setMax [z39.$setNo resultCount]
1388 show-status Ready 0 1
1389 set status [z39.$setNo responseStatus]
1390 if {[lindex $status 0] == "NSD"} {
1391 z39.$setNo nextResultSetPosition 0
1392 set code [lindex $status 1]
1393 set msg [lindex $status 2]
1394 set addinfo [lindex $status 3]
1395 tkerror "NSD$code: $msg: $addinfo"
1398 show-message "${setMax} hits"
1403 show-status Ready 0 1
1404 set l [format "%-4d %7d" $setNo $setMax]
1405 .top.rset.m add command -label $l \
1406 -command [list add-title-lines $setNo 10000 1]
1410 z39 callback {present-response}
1411 z39.$setNo present $setOffset 1
1412 show-status Retrieving 1 0
1415 proc present-more {number} {
1423 dputs "present-more"
1425 show-status Retrieving 1 0
1426 set delayRequest "present-more $number"
1432 dputs "setNo=$setNo"
1435 set setOffset [z39.$setNo nextResultSetPosition]
1436 dputs "setOffest=${setOffset}"
1437 dputs "setNo=${setNo}"
1438 set max [z39.$setNo resultCount]
1439 if {$max < $setOffset} {
1441 dputs "setOffset=$setOffset"
1442 show-status Ready 0 1
1445 if {$number == ""} {
1449 if {$setMax > $max} {
1453 z39 callback {present-response}
1455 set toGet [expr $setMax - $setOffset + 1]
1462 z39.$setNo present $setOffset $toGet
1463 show-status Retrieving 1 0
1466 proc init-title-lines {} {
1467 .data.record delete 0.0 end
1470 proc title-press {y setno} {
1471 show-full-marc $setno [expr 1 + [.data.list nearest $y]] 0
1474 proc add-title-lines {setno no offset} {
1475 global displayFormats
1476 global displayFormat
1486 .bot.a.set configure -text $setno
1487 .data.record delete 0.0 end
1489 set ffunc [lindex $displayFormats $displayFormat]
1490 dputs "ffunc=$ffunc"
1491 set ffunc "display-$ffunc"
1492 for {set i 0} {$i < $no} {incr i} {
1493 set o [expr $i + $offset]
1494 set type [z39.$setno type $o]
1498 .data.record tag bind r$o <Any-Enter> {}
1499 .data.record tag bind r$o <Any-Leave> {}
1500 set insert0 [.data.record index insert]
1501 $ffunc $setno $o .data.record 1
1502 .data.record tag add r$o $insert0 insert
1503 .data.record tag bind r$o <1> \
1504 [list popup-marc $setno $o 0 0]
1508 show-status Ready 0 1
1512 proc present-response {} {
1519 dputs "In present-response"
1520 set no [z39.$setNo numberOfRecordsReturned]
1521 dputs "Returned $no records, setOffset $setOffset"
1522 add-title-lines $setNo $no $setOffset
1523 set setOffset [expr $setOffset + $no]
1525 dputs "Handling cancel"
1527 if {$delayRequest != ""} {
1532 set status [z39.$setNo responseStatus]
1533 if {[lindex $status 0] == "NSD"} {
1534 show-status Ready 0 1
1535 set code [lindex $status 1]
1536 set msg [lindex $status 2]
1537 set addinfo [lindex $status 3]
1538 tkerror "NSD$code: $msg: $addinfo"
1541 if {$no > 0 && $setOffset <= $setMax} {
1542 dputs "present-request from ${setOffset}"
1543 set toGet [expr $setMax - $setOffset + 1]
1547 z39.$setNo present $setOffset $toGet
1549 show-status Ready 0 1
1553 proc left-cursor {w} {
1554 set i [$w index insert]
1562 proc right-cursor {w} {
1563 set i [$w index insert]
1569 proc bind-fields {list returnAction escapeAction} {
1571 set max [expr [llength $list]-1]
1572 for {set i 0} {$i < $max} {incr i} {
1573 bind [lindex $list $i] <Return> $returnAction
1574 bind [lindex $list $i] <Escape> $escapeAction
1576 bind [lindex $list $i] <Tab> \
1577 [list focus [lindex $list [expr $i+1]]]
1578 bind [lindex $list $i] <Left> \
1579 [list left-cursor [lindex $list $i]]
1580 bind [lindex $list $i] <Right> \
1581 [list right-cursor [lindex $list $i]]
1584 bind [lindex $list $i] <Return> $returnAction
1585 bind [lindex $list $i] <Escape> $escapeAction
1587 bind [lindex $list $i] <Tab> [list focus [lindex $list 0]]
1588 bind [lindex $list $i] <Left> [list left-cursor [lindex $list $i]]
1589 bind [lindex $list $i] <Right> [list right-cursor [lindex $list $i]]
1591 focus [lindex $list 0]
1594 proc entry-fields {parent list tlist returnAction escapeAction} {
1597 foreach field $list {
1598 set label ${parent}.${field}.label
1599 set entry ${parent}.${field}.entry
1600 label $label -text [lindex $tlist $i] -anchor e
1601 entry $entry -width 32 -relief sunken
1602 pack $label -side left
1603 pack $entry -side right
1604 lappend alist $entry
1607 bind-fields $alist $returnAction $escapeAction
1610 proc define-target-dialog {} {
1611 set w .target-define
1617 pack $w.top.target \
1618 -side top -anchor e -pady 2
1619 entry-fields $w.top {target} \
1621 {define-target-action} {destroy .target-define}
1622 top-down-ok-cancel $w {define-target-action} 1
1625 proc protocol-setup-delete {target} {
1627 global settingsChanged
1629 set a [alert "Are you sure you want to delete the target \
1630 definition $target ?"]
1632 set wno [lindex $profile($target) 12]
1635 unset profile($target)
1636 set settingsChanged 1
1638 delete-target-hotlist $target
1642 proc protocol-setup-action {target} {
1645 global protocolRadioType
1646 global settingsChanged
1649 global ResultSetCheck
1651 set wno [lindex $profile($target) 12]
1655 set settingsChanged 1
1656 set len [$w.top.databases.list size]
1657 for {set i 0} {$i < $len} {incr i} {
1658 lappend b [$w.top.databases.list get $i]
1660 set profile($target) [list [$w.top.description.entry get] \
1661 [$w.top.host.entry get] \
1662 [$w.top.port.entry get] \
1663 [$w.top.idAuthentication.entry get] \
1664 [$w.top.maximumRecordSize.entry get] \
1665 [$w.top.preferredMessageSize.entry get] \
1671 $protocolRadioType \
1675 delete-target-hotlist $target
1676 dputs $profile($target)
1680 proc place-force {window parent} {
1681 set g [wm geometry $parent]
1683 set p1 [string first + $g]
1684 set p2 [string last + $g]
1686 set x [expr 40+[string range $g [expr $p1 +1] [expr $p2 -1]]]
1687 set y [expr 60+[string range $g [expr $p2 +1] end]]
1688 wm geometry $window +${x}+${y}
1691 proc add-database-action {target} {
1694 set wno [lindex $profile($target) 12]
1697 $w.top.databases.list insert end \
1698 [.database-select.top.database.entry get]
1699 destroy .database-select
1702 proc add-database {target} {
1705 set w .database-select
1707 set oldFocus [focus]
1709 set wno [lindex $profile($target) 12]
1710 place-force $w .setup-${wno}
1714 frame $w.top.database
1716 pack $w.top.database -side top -anchor e -pady 2
1718 entry-fields $w.top {database} \
1719 {{Database to add:}} \
1720 [list add-database-action $target] {destroy .database-select}
1722 top-down-ok-cancel $w [list add-database-action $target] 1
1726 proc delete-database {target} {
1729 set wno [lindex $profile($target) 12]
1732 foreach i [$w.top.databases.list curselection] {
1733 set b [$w.top.databases.list get $i]
1736 set a [alert "Are you sure you want to remove the database(s)${l}?"]
1738 foreach i [lsort -decreasing \
1739 [$w.top.databases.list curselection]] {
1740 $w.top.databases.list delete $i
1745 proc protocol-setup {target} {
1748 global protocolRadioType
1751 global ResultSetCheck
1753 set wno [lindex $profile($target) 12]
1758 wm title $w "Setup $target"
1762 if {$target == ""} {
1766 dputs $profile($target)
1768 frame $w.top.description
1771 frame $w.top.idAuthentication
1772 frame $w.top.maximumRecordSize
1773 frame $w.top.preferredMessageSize
1774 frame $w.top.cs-type -relief ridge -border 2
1775 frame $w.top.protocol -relief ridge -border 2
1776 frame $w.top.query -relief ridge -border 2
1777 frame $w.top.databases -relief ridge -border 2
1779 # Maximum/preferred/idAuth ...
1780 pack $w.top.description $w.top.host $w.top.port \
1781 $w.top.idAuthentication $w.top.maximumRecordSize \
1782 $w.top.preferredMessageSize -side top -anchor e -pady 2
1784 entry-fields $w.top {description host port idAuthentication \
1785 maximumRecordSize preferredMessageSize} \
1786 {{Description:} {Host:} {Port:} {Id Authentication:} \
1787 {Maximum Record Size:} {Preferred Message Size:}} \
1788 [list protocol-setup-action $target] [list destroy $w]
1790 foreach sub {description host port idAuthentication \
1791 maximumRecordSize preferredMessageSize} {
1793 bind $w.top.$sub.entry <Control-a> [list add-database $target]
1794 bind $w.top.$sub.entry <Control-d> [list delete-database $target]
1796 $w.top.description.entry insert 0 [lindex $profile($target) 0]
1797 $w.top.host.entry insert 0 [lindex $profile($target) 1]
1798 $w.top.port.entry insert 0 [lindex $profile($target) 2]
1799 $w.top.idAuthentication.entry insert 0 [lindex $profile($target) 3]
1800 $w.top.maximumRecordSize.entry insert 0 [lindex $profile($target) 4]
1801 $w.top.preferredMessageSize.entry insert 0 [lindex $profile($target) 5]
1802 set csRadioType [lindex $profile($target) 6]
1803 set RPNCheck [lindex $profile($target) 8]
1804 set CCLCheck [lindex $profile($target) 9]
1805 set ResultSetCheck [lindex $profile($target) 10]
1806 set protocolRadioType [lindex $profile($target) 11]
1807 if {$protocolRadioType == ""} {
1808 set protocolRadioType Z39
1812 pack $w.top.databases -side left -pady 4 -padx 4 -expand yes -fill both
1814 label $w.top.databases.label -text "Databases"
1815 button $w.top.databases.add -text "Add" \
1816 -command [list add-database $target]
1817 button $w.top.databases.delete -text "Delete" \
1818 -command [list delete-database $target]
1821 listbox $w.top.databases.list -geometry 20x6 \
1822 -yscrollcommand "$w.top.databases.scroll set"
1824 listbox $w.top.databases.list -width 20 \
1825 -yscrollcommand "$w.top.databases.scroll set"
1827 scrollbar $w.top.databases.scroll -orient vertical -border 1
1828 pack $w.top.databases.label -side top -fill x \
1830 pack $w.top.databases.add $w.top.databases.delete -side top -fill x \
1832 pack $w.top.databases.list -side left -fill both -expand yes \
1834 pack $w.top.databases.scroll -side right -fill y \
1836 $w.top.databases.scroll config -command "$w.top.databases.list yview"
1838 foreach b [lindex $profile($target) 7] {
1839 $w.top.databases.list insert end $b
1843 pack $w.top.cs-type -pady 4 -padx 4 -side top -fill x
1845 label $w.top.cs-type.label -text "Transport"
1846 radiobutton $w.top.cs-type.tcpip -text "TCP/IP" -anchor w \
1847 -variable csRadioType -value tcpip
1848 radiobutton $w.top.cs-type.mosi -text "MOSI" -anchor w\
1849 -variable csRadioType -value mosi
1851 pack $w.top.cs-type.label $w.top.cs-type.tcpip $w.top.cs-type.mosi \
1852 -padx 4 -side top -fill x
1855 pack $w.top.protocol -pady 4 -padx 4 -side top -fill x
1857 label $w.top.protocol.label -text "Protocol"
1858 radiobutton $w.top.protocol.z39v2 -text "Z39.50" -anchor w \
1859 -variable protocolRadioType -value Z39
1860 radiobutton $w.top.protocol.sr -text "SR" -anchor w \
1861 -variable protocolRadioType -value SR
1863 pack $w.top.protocol.label $w.top.protocol.z39v2 $w.top.protocol.sr \
1864 -padx 4 -side top -fill x
1867 pack $w.top.query -pady 4 -padx 4 -side top -fill x
1869 label $w.top.query.label -text "Query support"
1870 checkbutton $w.top.query.c1 -text "RPN query" -anchor w -variable RPNCheck
1871 checkbutton $w.top.query.c2 -text "CCL query" -anchor w -variable CCLCheck
1872 checkbutton $w.top.query.c3 -text "Result sets" -anchor w -variable ResultSetCheck
1874 pack $w.top.query.label -side top
1875 pack $w.top.query.c1 $w.top.query.c2 $w.top.query.c3 \
1876 -padx 4 -side top -fill x
1879 bottom-buttons $w [list {Ok} [list protocol-setup-action $target] \
1880 {Delete} [list protocol-setup-delete $target] \
1881 {Cancel} [list destroy $w]] 0
1884 proc database-select-action {} {
1885 set w .database-select.top
1887 foreach indx [$w.databases.list curselection] {
1888 lappend b [$w.databases.list get $indx]
1891 z39 databaseNames $b
1893 destroy .database-select
1896 proc database-select {} {
1897 set w .database-select
1902 set oldFocus [focus]
1907 frame $w.top.databases -relief ridge -border 2
1909 pack $w.top.databases -side left -pady 6 -padx 6 -expand yes -fill x
1911 label $w.top.databases.label -text "List"
1912 listbox $w.top.databases.list -width 20 -height 6 \
1913 -yscrollcommand "$w.top.databases.scroll set"
1914 scrollbar $w.top.databases.scroll -orient vertical -border 1
1915 pack $w.top.databases.label -side top -fill x \
1917 pack $w.top.databases.list -side left -fill both -expand yes \
1919 pack $w.top.databases.scroll -side right -fill y \
1921 $w.top.databases.scroll config -command "$w.top.databases.list yview"
1923 foreach b [lindex $profile($hostid) 7] {
1924 $w.top.databases.list insert end $b
1926 top-down-ok-cancel $w {database-select-action} 1
1930 proc cascade-target-list {} {
1933 foreach sub [winfo children .top.target.m.clist] {
1936 .top.target.m.clist delete 0 last
1937 foreach n [lsort [array names profile]] {
1938 if {$n != "Default"} {
1939 set nl [lindex $profile($n) 12]
1940 if {[llength [lindex $profile($n) 7]] > 1} {
1941 .top.target.m.clist add cascade -label $n \
1942 -menu .top.target.m.clist.$nl
1943 menu .top.target.m.clist.$nl
1944 foreach b [lindex $profile($n) 7] {
1945 .top.target.m.clist.$nl add command -label $b \
1946 -command [list reopen-target $n $b]
1949 .top.target.m.clist add command -label $n \
1950 -command [list reopen-target $n {}]
1954 .top.target.m.slist delete 0 last
1955 foreach n [lsort [array names profile]] {
1956 if {$n != "Default"} {
1957 .top.target.m.slist add command -label $n \
1958 -command [list protocol-setup $n]
1963 proc query-select {i} {
1964 global queryButtonsFind
1965 global queryInfoFind
1969 set queryInfoFind [lindex $queryInfo $i]
1970 set queryButtonsFind [lindex $queryButtons $i]
1972 index-lines .lines 1 $queryButtonsFind $queryInfoFind activate-index
1975 proc query-new-action {} {
1979 global settingsChanged
1981 set settingsChanged 1
1982 lappend queryTypes [.query-new.top.index.entry get]
1983 lappend queryButtons {}
1984 lappend queryInfo {}
1994 set oldFocus [focus]
1999 -side top -anchor e -pady 2
2000 entry-fields $w.top index \
2002 query-new-action {destroy .query-new}
2003 top-down-ok-cancel $w query-new-action 1
2007 proc query-delete-action {queryNo} {
2011 global settingsChanged
2013 set settingsChanged 1
2015 set queryTypes [lreplace $queryTypes $queryNo $queryNo]
2016 set queryButtons [lreplace $queryButtons $queryNo $queryNo]
2017 set queryInfo [lreplace $queryInfo $queryNo $queryNo]
2018 destroy .query-delete
2022 proc query-delete {queryNo} {
2030 set n [lindex $queryTypes $queryNo]
2032 label $w.top.warning -bitmap warning
2033 message $w.top.quest -text "Are you sure you want to delete the \
2034 query type $n ?" -aspect 300
2035 pack $w.top.warning $w.top.quest -side left -expand yes -padx 10 -pady 5
2036 bottom-buttons $w [list {Ok} [list query-delete-action $queryNo] \
2037 {Cancel} [list destroy $w]] 1
2040 proc cascade-query-list {} {
2042 set w .top.options.m.query
2045 $w.slist delete 0 last
2046 foreach n $queryTypes {
2047 $w.slist add command -label $n -command [list query-setup $i]
2052 $w.clist delete 0 last
2053 foreach n $queryTypes {
2054 $w.clist add command -label $n -command [list query-select $i]
2058 $w.dlist delete 0 last
2059 foreach n $queryTypes {
2060 $w.dlist add command -label $n -command [list query-delete $i]
2065 proc save-geometry {} {
2066 global windowGeometry
2069 global displayFormat
2073 set windowGeometry(.) [wm geometry .]
2075 set f [open "~/.clientrc.tcl" w]
2077 puts $f "set hotTargets \{ $hotTargets \}"
2078 puts $f "set textWrap $textWrap"
2079 puts $f "set displayFormat $displayFormat"
2080 puts $f "set popupMarcdf $popupMarcdf"
2081 puts $f "set recordSyntax $recordSyntax"
2082 foreach n [array names windowGeometry] {
2083 puts -nonewline $f "set \{windowGeometry($n)\} \{"
2084 puts -nonewline $f $windowGeometry($n)
2090 proc save-settings {} {
2093 global settingsChanged
2098 if {![file writable "${libdir}/clientrc.tcl"]} {
2099 set a [alert "Cannot open ${libdir}/clientrc.tcl for writing. Do you \
2100 wish to save clientrc.tcl in the current directory instead?"]
2104 set f [open "clientrc.tcl" w]
2106 set f [open "${libdir}/clientrc.tcl" w]
2108 puts $f "# Setup file"
2110 foreach n [array names profile] {
2111 puts -nonewline $f "set \{profile($n)\} \{"
2112 puts -nonewline $f $profile($n)
2115 puts -nonewline $f "set queryTypes \{"
2116 puts -nonewline $f $queryTypes
2119 puts -nonewline $f "set queryButtons \{"
2120 puts -nonewline $f $queryButtons
2123 puts -nonewline $f "set queryInfo \{"
2124 puts -nonewline $f $queryInfo
2127 set settingsChanged 0
2136 set oldFocus [focus]
2140 label $w.top.warning -bitmap warning
2141 message $w.top.message -text $ask -aspect 300 \
2142 -font -Adobe-Times-Medium-R-Normal-*-180-*
2144 pack $w.top.warning $w.top.message -side left -pady 5 -padx 10 -expand yes
2147 top-down-ok-cancel $w {alert-action} 1
2152 proc alert-action {} {
2158 proc exit-action {} {
2159 global settingsChanged
2161 if {$settingsChanged} {
2162 set a [alert "you haven't saved your settings. Do you wish to save?"]
2171 proc listbuttonaction {w name h user i} {
2172 $w configure -text [lindex $name 0]
2173 $h [lindex $name 1] $user $i
2176 proc listbuttonx {button no names handle user} {
2177 if {[winfo exists $button]} {
2178 $button configure -text [lindex [lindex $names $no] 0]
2179 ${button}.m delete 0 last
2181 menubutton $button -text [lindex [lindex $names $no] 0] \
2182 -width 10 -menu ${button}.m -relief raised -border 1
2186 foreach name $names {
2187 ${button}.m add command -label [lindex $name 0] \
2188 -command [list listbuttonaction ${button} $name \
2194 proc listbutton {button no names} {
2195 menubutton $button -text [lindex $names $no] -width 10 -menu ${button}.m \
2196 -relief raised -border 1
2198 foreach name $names {
2199 ${button}.m add command -label $name \
2200 -command [list ${button} configure -text $name]
2204 proc listbuttonv-action {button var names i} {
2207 set $var [lindex $names [expr $i+1]]
2208 $button configure -text [lindex $names $i]
2211 proc listbuttonv {button var names} {
2215 eval "set val $$var"
2216 set l [llength $names]
2217 for {set i 1} {$i < $l} {incr i 2} {
2218 if {$val == [lindex $names $i]} {
2220 set n [lindex $names $i]
2224 if {[winfo exists $button]} {
2225 $button configure -text $n
2228 menubutton $button -text $n -menu ${button}.m \
2229 -relief raised -border 1
2231 for {set i 0} {$i < $l} {incr i 2} {
2232 ${button}.m add command -label [lindex $names $i] \
2233 -command [list listbuttonv-action $button $var $names $i]
2237 proc query-add-index-action {queryNo} {
2241 global queryButtonsTmp
2243 set newI [.query-add-index.top.index.entry get]
2244 lappend queryInfoTmp [list $newI {}]
2245 $w.top.index.list insert end $newI
2246 destroy .query-add-index
2247 #destroy $w.top.lines
2248 #frame $w.top.lines -relief ridge -border 2
2249 index-lines $w.top.lines 0 $queryButtonsTmp $queryInfoTmp activate-e-index
2250 #pack $w.top.lines -side left -pady 6 -padx 6 -fill y
2253 proc query-add-line {queryNo} {
2257 global queryButtonsTmp
2259 lappend queryButtonsTmp {I 0}
2261 #destroy $w.top.lines
2262 #frame $w.top.lines -relief ridge -border 2
2263 index-lines $w.top.lines 0 $queryButtonsTmp $queryInfoTmp activate-e-index
2264 #pack $w.top.lines -side left -pady 6 -padx 6 -fill y
2267 proc query-del-line {queryNo} {
2271 global queryButtonsTmp
2273 set l [llength $queryButtonsTmp]
2278 set queryButtonsTmp [lreplace $queryButtonsTmp $l $l]
2279 index-lines $w.top.lines 0 $queryButtonsTmp $queryInfoTmp activate-e-index
2282 proc query-add-index {queryNo} {
2283 set w .query-add-index
2286 set oldFocus [focus]
2287 place-force $w .query-setup
2291 -side top -anchor e -pady 2
2292 entry-fields $w.top {index} \
2294 [list query-add-index-action $queryNo] [list destroy $w]
2295 top-down-ok-cancel $w [list query-add-index-action $queryNo] 1
2299 proc query-setup-action {queryNo} {
2302 global queryButtonsTmp
2304 global queryButtonsFind
2305 global queryInfoFind
2307 global settingsChanged
2309 set settingsChanged 1
2311 set queryInfo [lreplace $queryInfo $queryNo $queryNo \
2313 set queryButtons [lreplace $queryButtons $queryNo $queryNo \
2315 set queryInfoFind $queryInfoTmp
2316 set queryButtonsFind $queryButtonsTmp
2318 destroy .query-setup
2319 index-lines .lines 1 $queryButtonsFind $queryInfoFind activate-index
2322 proc activate-e-index {value no i} {
2323 global queryButtonsTmp
2324 global queryIndexTmp
2326 set queryButtonsTmp [lreplace $queryButtonsTmp $no $no [list I $i]]
2327 dputs $queryButtonsTmp
2328 set queryIndexTmp $i
2331 proc activate-index {value no i} {
2332 global queryButtonsFind
2334 set queryButtonsFind [lreplace $queryButtonsFind $no $no [list I $i]]
2336 dputs "queryButtonsFind $queryButtonsFind"
2339 proc update-attr {} {
2341 listbuttonv $w.top.relation.b relationTmpValue\
2342 {{None} 0 {Less than} 1 {Greater than or equal} 2 {Equal} 3 \
2343 {Greater than or equal} 4 {Greater than} 5 {Not equal} 6 \
2344 {Phonetic} 100 {Stem} 101 {Relevance} 102 {AlwaysMatches} 103}
2345 listbuttonv $w.top.position.b positionTmpValue {{None} 0 \
2346 {First in field} 1 {First in subfield} 2 {Any position in field} 3}
2347 listbuttonv $w.top.structure.b structureTmpValue {{None} 0 {Phrase} 1 \
2348 {Word} 2 {Key} 3 {Year} 4 {Date (norm)} 5 {Word list} 6 \
2349 {Date (un-norm)} 100 {Name (norm)} 101 {Date (un-norm)} 102 \
2350 {Structure} 103 {urx} 104 {free-form} 105 {doc-text} 106 \
2351 {local-number} 107 {string} 108 {numeric string} 109}
2352 listbuttonv $w.top.truncation.b truncationTmpValue {{Auto} 0 {Right} 1 \
2353 {Left} 2 {Left and right} 3 {No truncation} 100 \
2354 {Process #} 101 {Re-1} 102 {Re-2} 103}
2355 listbuttonv $w.top.completeness.b completenessTmpValue {{None} 0 \
2356 {Incomplete subfield} 1 {Complete subfield} 2 {Complete field} 3}
2359 proc use-attr {init} {
2371 {BNB card number} 10
2372 {BGF(sic) number} 11
2374 {Dewey classification} 13
2375 {UDC classification} 14
2376 {Bliss classification} 15
2378 {NLM call number} 17
2379 {NAL call number} 18
2380 {MOS call number} 19
2381 {Local classification} 20
2382 {Subject heading} 21
2384 {BDI-index-subject} 23
2388 {LC-subject-heading} 27
2389 {RVM-subject-heading} 28
2390 {Local subject index} 29
2392 {Date of publication} 31
2393 {Date of acquisition} 32
2395 {Title-collective} 34
2398 {Title-added-title-page} 37
2402 {Title-other-variant} 41
2404 {Title-abbreviated} 43
2408 {Subject-subdivision} 47
2409 {Number-natl-bibliography} 48
2410 {Number-legal-deposit} 49
2411 {Number-govt-publication} 50
2412 {Number-publisher-for-music} 51
2414 {Number-local-call} 53
2416 {Code-geographic-area} 55
2417 {Code-institution} 56
2419 {Name-geographic} 58
2420 {Place-publication} 59
2422 {Microform-generation} 61
2429 {Author-name-personal} 1004
2430 {Author-name-corporate} 1005
2431 {Author-name-conference} 1006
2432 {Identifier-standard} 1007
2433 {Subject-LC-children's} 1008
2434 {Subject-name-personal} 1009
2436 {Date/time added to database} 1011
2437 {Date/time last modified} 1012
2438 {Authority/format identifier} 1013
2440 {Concept-reference} 1015
2442 {Server choice} 1017
2444 {Record source} 1019
2447 {Geographic class} 1022
2451 {Related periodical} 1026
2452 {Report number} 1027
2454 {Thematic number} 1030
2455 {Material type} 1031
2464 set l [llength $attr]
2469 for {set i 0} {$i < $l} {incr i} {
2470 $w.top.use.list insert end [lindex $attr $i]
2472 if {$useTmpValue == [lindex $attr $i]} {
2478 $w.top.use.list selection clear 0 end
2479 $w.top.use.list selection set $s $s
2481 $w.top.use.list select from $s
2482 $w.top.use.list select to $s
2488 $w.top.use.list yview $s
2490 set lno [lindex [$w.top.use.list curselection] 0]
2491 set i [expr $lno+$lno+1]
2492 set useTmpValue [lindex $attr $i]
2493 dputs "useTmpValue=$useTmpValue"
2497 proc index-setup-action {oldAttr queryNo indexNo} {
2498 set attr [lindex $oldAttr 0]
2501 global relationTmpValue
2502 global structureTmpValue
2503 global truncationTmpValue
2504 global completenessTmpValue
2505 global positionTmpValue
2510 dputs "index-setup-action"
2511 dputs "queryNo $queryNo"
2512 dputs "indexNo $indexNo"
2513 if {$useTmpValue > 0} {
2514 lappend attr "1=$useTmpValue"
2516 if {$relationTmpValue > 0} {
2517 lappend attr "2=$relationTmpValue"
2519 if {$positionTmpValue > 0} {
2520 lappend attr "3=$positionTmpValue"
2522 if {$structureTmpValue > 0} {
2523 lappend attr "4=$structureTmpValue"
2525 if {$truncationTmpValue > 0} {
2526 lappend attr "5=$truncationTmpValue"
2528 if {$completenessTmpValue > 0} {
2529 lappend attr "6=$completenessTmpValue"
2531 dputs "new attr $attr"
2532 set queryInfoTmp [lreplace $queryInfoTmp $indexNo $indexNo $attr]
2533 destroy .index-setup
2536 proc index-setup {attr queryNo indexNo} {
2539 global relationTmpValue
2540 global structureTmpValue
2541 global truncationTmpValue
2542 global completenessTmpValue
2543 global positionTmpValue
2546 set relationTmpValue 0
2547 set truncationTmpValue 0
2548 set structureTmpValue 0
2549 set positionTmpValue 0
2550 set completenessTmpValue 0
2553 set len [llength $attr]
2554 for {set i 1} {$i < $len} {incr i} {
2555 set q [lindex $attr $i]
2556 set l [string first = $q]
2558 set t [string range $q 0 [expr $l - 1]]
2559 set v [string range $q [expr $l + 1] end]
2562 { set useTmpValue $v }
2564 { set relationTmpValue $v }
2566 { set positionTmpValue $v }
2568 { set structureTmpValue $v }
2570 { set truncationTmpValue $v }
2572 { set completenessTmpValue $v }
2576 if {[winfo exists $w]} {
2581 set n [lindex $attr 0]
2582 wm title $w "Index setup $n"
2586 frame $w.top.use -relief ridge -border 2
2587 frame $w.top.relation -relief ridge -border 2
2588 frame $w.top.position -relief ridge -border 2
2589 frame $w.top.structure -relief ridge -border 2
2590 frame $w.top.truncation -relief ridge -border 2
2591 frame $w.top.completeness -relief ridge -border 2
2597 pack $w.top.use -side left -pady 6 -padx 6 -fill y
2599 label $w.top.use.label -text "Use"
2601 listbox $w.top.use.list -width 26 \
2602 -yscrollcommand "$w.top.use.scroll set"
2604 listbox $w.top.use.list -geometry 26x10 \
2605 -yscrollcommand "$w.top.use.scroll set"
2607 scrollbar $w.top.use.scroll -orient vertical -border 1
2608 pack $w.top.use.label -side top -fill x \
2610 pack $w.top.use.list -side left -fill both -expand yes \
2612 pack $w.top.use.scroll -side right -fill y \
2614 $w.top.use.scroll config -command "$w.top.use.list yview"
2618 # Relation Attributes
2620 pack $w.top.relation -pady 6 -padx 6 -side top
2621 label $w.top.relation.label -text "Relation" -width 18
2623 pack $w.top.relation.label $w.top.relation.b -fill x
2625 # Position Attributes
2627 pack $w.top.position -pady 6 -padx 6 -side top
2628 label $w.top.position.label -text "Position" -width 18
2630 pack $w.top.position.label $w.top.position.b -fill x
2632 # Structure Attributes
2634 pack $w.top.structure -pady 6 -padx 6 -side top
2635 label $w.top.structure.label -text "Structure" -width 18
2637 pack $w.top.structure.label $w.top.structure.b -fill x
2639 # Truncation Attributes
2641 pack $w.top.truncation -pady 6 -padx 6 -side top
2642 label $w.top.truncation.label -text "Truncation" -width 18
2644 pack $w.top.truncation.label $w.top.truncation.b -fill x
2646 # Completeness Attributes
2648 pack $w.top.completeness -pady 6 -padx 6 -side top
2649 label $w.top.completeness.label -text "Completeness" -width 18
2651 pack $w.top.completeness.label $w.top.completeness.b -fill x
2654 bottom-buttons $w [list \
2655 {Ok} [list index-setup-action $attr $queryNo $indexNo] \
2656 {Cancel} [list destroy $w]] 0
2660 proc query-edit-index {queryNo} {
2664 set i [lindex [$w.top.index.list curselection] 0]
2668 set attr [lindex $queryInfoTmp $i]
2669 dputs "Editing no $i $attr"
2670 index-setup $attr $queryNo $i
2673 proc query-delete-index {queryNo} {
2675 global queryButtonsTmp
2678 set i [lindex [$w.top.index.list curselection] 0]
2682 set queryInfoTmp [lreplace $queryInfoTmp $i $i]
2683 index-lines $w.top.lines 0 $queryButtonsTmp $queryInfoTmp activate-e-index
2684 $w.top.index.list delete $i
2687 proc query-setup {queryNo} {
2693 global queryButtonsTmp
2695 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
2821 $w.$i configure -background red
2823 set curIndexEntry $i
2826 proc index-lines {w realOp buttonInfo queryInfo handle} {
2829 foreach b $buttonInfo {
2830 if {! [winfo exists $w.$i]} {
2832 frame $w.$i -border 0
2834 frame $w.$i -background white -border 1
2837 listbuttonx $w.$i.l [lindex $b 1] $queryInfo $handle $i
2840 if {! [winfo exists $w.$i.e]} {
2841 entry $w.$i.e -width 32 -relief sunken -border 1
2842 bind $w.$i.e <FocusIn> [list index-focus-in $w $i]
2843 bind $w.$i.e <FocusOut> [list $w.$i configure \
2845 pack $w.$i.l -side left
2846 pack $w.$i.e -side left -fill x -expand yes
2847 pack $w.$i -side top -fill x -padx 2 -pady 2
2849 bind $w.$i.e <Left> [list left-cursor $w.$i.e]
2850 bind $w.$i.e <Right> [list right-cursor $w.$i.e]
2852 bind $w.$i.e <Return> {search-request 0}
2855 pack $w.$i.l -side left
2856 pack $w.$i -side top -fill x -padx 2 -pady 2
2861 while {[winfo exists $w.$j]} {
2873 bind $w.$j.e <Tab> "focus $w.$k.e"
2879 bind $w.$i.e <Tab> "focus $w.0.e"
2885 proc search-fields {w buttondefs} {
2887 foreach buttondef $buttondefs {
2888 frame $w.$i -background white
2890 listbutton $w.$i.l 0 $buttondef
2891 entry $w.$i.e -width 32 -relief sunken
2893 pack $w.$i.l -side left
2894 pack $w.$i.e -side left -fill x -expand yes
2896 pack $w.$i -side top -fill x -padx 2 -pady 2
2898 bind $w.$i.e <Left> [list left-cursor $w.$i.e]
2899 bind $w.$i.e <Right> [list right-cursor $w.$i.e]
2907 bind $w.$j.e <Tab> "focus $w.$k.e \n
2908 $w.$k configure -background red \n
2909 $w.$j configure -background white"
2912 bind $w.$i.e <Tab> "focus $w.0.e \n
2913 $w.0 configure -background red \n
2914 $w.$i configure -background white"
2916 $w.0 configure -background red
2919 if {[info exists windowGeometry(.)]} {
2920 set g $windowGeometry(.)
2928 frame .top -border 1 -relief raised
2929 frame .lines -border 1 -relief raised
2930 frame .mid -border 1 -relief raised
2931 frame .data -border 1 -relief raised
2932 frame .bot -border 1 -relief raised
2933 pack .top .lines .mid -side top -fill x
2934 pack .data -side top -fill both -expand yes
2937 menubutton .top.file -text "File" -menu .top.file.m
2939 .top.file.m add command -label "Save settings" -command {save-settings}
2940 .top.file.m add separator
2941 .top.file.m add command -label "Exit" -command {exit-action}
2943 menubutton .top.target -text "Target" -menu .top.target.m
2945 .top.target.m add cascade -label "Connect" -menu .top.target.m.clist
2946 .top.target.m add command -label "Disconnect" -command {close-target}
2947 .top.target.m add command -label "About" -command {about-target}
2948 .top.target.m add cascade -label "Setup" -menu .top.target.m.slist
2949 .top.target.m add command -label "Setup new" -command {define-target-dialog}
2950 .top.target.m add separator
2951 set-target-hotlist 0
2953 configure-disable-e .top.target.m 1
2954 configure-disable-e .top.target.m 2
2956 menu .top.target.m.clist
2957 menu .top.target.m.slist
2960 menubutton .top.service -text "Service" -menu .top.service.m
2962 .top.service.m add command -label "Database" -command {database-select}
2963 .top.service.m add cascade -label "Present" -menu .top.service.m.present
2964 menu .top.service.m.present
2965 .top.service.m.present add command -label "10 More" \
2966 -command [list present-more 10]
2967 .top.service.m.present add command -label "All" \
2968 -command [list present-more {}]
2969 .top.service.m add command -label "Search" -command {search-request 0}
2970 .top.service.m add command -label "Scan" -command {scan-request}
2972 .top.service configure -state disabled
2974 menubutton .top.rset -text "Set" -menu .top.rset.m
2976 .top.rset.m add command -label "Load" -command {load-set}
2977 .top.rset.m add separator
2979 menubutton .top.options -text "Options" -menu .top.options.m
2981 .top.options.m add cascade -label "Query" -menu .top.options.m.query
2982 .top.options.m add cascade -label "Format" -menu .top.options.m.formats
2983 .top.options.m add cascade -label "Wrap" -menu .top.options.m.wrap
2984 .top.options.m add cascade -label "Syntax" -menu .top.options.m.syntax
2986 menu .top.options.m.query
2987 .top.options.m.query add cascade -label "Select" \
2988 -menu .top.options.m.query.clist
2989 .top.options.m.query add cascade -label "Edit" \
2990 -menu .top.options.m.query.slist
2991 .top.options.m.query add command -label "New" \
2992 -command {query-new}
2993 .top.options.m.query add cascade -label "Delete" \
2994 -menu .top.options.m.query.dlist
2996 menu .top.options.m.query.slist
2997 menu .top.options.m.query.clist
2998 menu .top.options.m.query.dlist
3001 menu .top.options.m.formats
3003 foreach f $displayFormats {
3004 .top.options.m.formats add radiobutton -label $f -value $i \
3005 -command [list set-display-format $i] -variable displayFormat
3009 menu .top.options.m.wrap
3010 .top.options.m.wrap add radiobutton -label "Character" \
3011 -value char -variable textWrap -command {set-wrap char}
3012 .top.options.m.wrap add radiobutton -label "Word" \
3013 -value word -variable textWrap -command {set-wrap word}
3014 .top.options.m.wrap add radiobutton -label "None" \
3015 -value none -variable textWrap -command {set-wrap none}
3017 menu .top.options.m.syntax
3018 .top.options.m.syntax add radiobutton -label "None" \
3019 -value None -variable recordSyntax
3020 .top.options.m.syntax add separator
3021 .top.options.m.syntax add radiobutton -label "USMARC" \
3022 -value USMARC -variable recordSyntax
3023 .top.options.m.syntax add radiobutton -label "UNIMARC" \
3024 -value UNIMARC -variable recordSyntax
3025 .top.options.m.syntax add radiobutton -label "UKMARC" \
3026 -value UKMARC -variable recordSyntax
3027 .top.options.m.syntax add radiobutton -label "DANMARC" \
3028 -value DANMARC -variable recordSyntax
3029 .top.options.m.syntax add radiobutton -label "FINMARC" \
3030 -value FINMARC -variable recordSyntax
3031 .top.options.m.syntax add radiobutton -label "NORMARC" \
3032 -value NORMARC -variable recordSyntax
3033 .top.options.m.syntax add radiobutton -label "PICAMARC" \
3034 -value PICAMARC -variable recordSyntax
3035 .top.options.m.syntax add separator
3036 .top.options.m.syntax add radiobutton -label "SUTRS" \
3037 -value SUTRS -variable recordSyntax
3039 menubutton .top.help -text "Help" -menu .top.help.m
3042 .top.help.m add command -label "Help on help" \
3043 -command {tkerror "Help on help not available. Sorry"}
3044 .top.help.m add command -label "About" -command {about-origin}
3046 pack .top.file .top.target .top.service .top.rset .top.options -side left
3047 pack .top.help -side right
3049 index-lines .lines 1 $queryButtonsFind [lindex $queryInfo 0] activate-index
3051 button .mid.search -width 7 -text {Search} -command {search-request 0} \
3053 button .mid.scan -width 7 -text {Scan} \
3054 -command scan-request -state disabled
3055 button .mid.present -width 7 -text {Present} -command [list present-more 10] \
3058 button .mid.clear -width 7 -text {Clear} -command index-clear
3059 pack .mid.search .mid.scan .mid.present .mid.clear -side left \
3060 -fill y -padx 5 -pady 3
3062 text .data.record -height 2 -width 20 -wrap none \
3063 -yscrollcommand [list .data.scroll set] -wrap $textWrap
3064 scrollbar .data.scroll -command [list .data.record yview]
3066 .data.record configure -takefocus 0
3067 .data.scroll configure -takefocus 0
3069 pack .data.scroll -side right -fill y
3070 pack .data.record -expand yes -fill both
3074 .data.record tag configure marc-tag -foreground blue
3075 .data.record tag configure marc-id -foreground red
3077 .data.record tag configure marc-tag -foreground black
3078 .data.record tag configure marc-id -foreground black
3080 .data.record tag configure marc-data -foreground black
3082 button .bot.logo -bitmap @${libdir}/bitmaps/book1 -command cancel-operation
3084 .bot.logo configure -takefocus 0
3087 pack .bot.a -side left -fill x
3088 pack .bot.logo -side right -padx 2 -pady 2
3090 message .bot.a.target -text "" -aspect 1000 -border 1
3092 label .bot.a.status -text "Not connected" -width 15 -relief \
3093 sunken -anchor w -border 1
3094 label .bot.a.set -text "" -width 5 -relief \
3095 sunken -anchor w -border 1
3096 label .bot.a.message -text "" -width 15 -relief \
3097 sunken -anchor w -border 1
3099 pack .bot.a.target -side top -anchor nw -padx 2 -pady 2
3100 pack .bot.a.status .bot.a.set .bot.a.message \
3101 -side left -padx 2 -pady 2