1 # IR toolkit for tcl/tk
3 # See the file LICENSE for details.
4 # Sebastian Hammer, Adam Dickmeiss
7 # Revision 1.68 1995-09-21 13:11:49 adam
8 # Support of dynamic loading.
9 # Test script uses load command if necessary.
11 # Revision 1.67 1995/09/20 14:35:19 adam
14 # Revision 1.66 1995/08/29 15:30:13 adam
15 # Work on GRS records.
17 # Revision 1.65 1995/08/24 15:39:09 adam
20 # Revision 1.64 1995/08/24 15:33:02 adam
23 # Revision 1.63 1995/08/04 13:20:48 adam
24 # Buttons at the bottom are slightly smaller.
26 # Revision 1.62 1995/08/04 11:32:37 adam
27 # More work on output queue. Memory related routines moved
30 # Revision 1.61 1995/07/20 08:09:39 adam
31 # client.tcl: Targets removed from hotTargets list when targets
32 # are removed/modified.
33 # ir-tcl.c: More work on triggerResourceControl.
35 # Revision 1.60 1995/06/30 16:30:19 adam
38 # Revision 1.59 1995/06/29 14:06:25 adam
39 # Another bug in install fixed. Configure searches for more versions of yaz.
41 # Revision 1.58 1995/06/29 12:34:06 adam
42 # IrTcl now works with both tk4.0b4/tcl7.4b4 and tk3.6/tcl7.3
44 # Revision 1.57 1995/06/29 09:20:30 adam
45 # Target entries in cascade menus are sorted.
47 # Revision 1.56 1995/06/27 19:03:48 adam
48 # Bug fix in do_present in ir-tcl.c: p->set_child member weren't set.
49 # nextResultSetPosition used instead of setOffset.
51 # Revision 1.55 1995/06/27 17:10:37 adam
52 # Bug fix: install procedure didn't work on some systems.
53 # Error turned up when clientrc.tcl was't present.
55 # Revision 1.54 1995/06/27 14:41:03 adam
56 # Bug fix in search-response. Didn't always observe non-surrogate diagnostics.
58 # Revision 1.53 1995/06/26 12:40:09 adam
59 # Client defines its own tkerror.
60 # User may specify 'no preferredRecordSyntax'.
62 # Revision 1.52 1995/06/22 13:14:59 adam
63 # Feature: SUTRS. Setting getSutrs implemented.
64 # Work on display formats.
65 # Preferred record syntax can be set by the user.
67 # Revision 1.51 1995/06/21 11:11:00 adam
68 # Bug fix: libdir undefined in about-origin.
70 # Revision 1.50 1995/06/21 11:04:48 adam
71 # Uses GNU autoconf 2.3.
72 # Install procedure implemented.
73 # boook bitmaps moved to sub directory bitmaps.
75 # Revision 1.49 1995/06/20 14:16:42 adam
76 # More work on cancel mechanism.
78 # Revision 1.48 1995/06/20 08:07:23 adam
79 # New setting: failInfo.
80 # Working on better cancel mechanism.
82 # Revision 1.47 1995/06/19 14:05:29 adam
83 # Bug fix: asked for SUTRS.
85 # Revision 1.46 1995/06/19 13:06:06 adam
86 # New define: IR_TCL_VERSION.
88 # Revision 1.45 1995/06/19 08:08:44 adam
89 # client.tcl: hotTargets now contain both database and target name.
90 # ir-tcl.c: setting protocol edited. Errors in callbacks are logged
91 # by logf(LOG_WARN, ...) calls.
93 # Revision 1.44 1995/06/16 14:55:18 adam
96 # Revision 1.43 1995/06/16 14:41:05 adam
97 # Scan line entries can be copied to a search entry.
99 # Revision 1.42 1995/06/16 12:28:13 adam
100 # Implemented preferredRecordSyntax.
101 # Minor changes in diagnostic handling.
102 # Record list deleted when connection closes.
104 # Revision 1.41 1995/06/14 15:07:59 adam
105 # Bug fix in cascade-target-list. Uses yaz-version.h.
107 # Revision 1.40 1995/06/14 13:37:17 adam
108 # Setting recordType implemented.
109 # Setting implementationVersion implemented.
110 # Settings implementationId / implementationName edited.
112 # Revision 1.39 1995/06/14 12:16:22 adam
113 # hotTargets, textWrap and displayFormat saved in clientg.tcl.
115 # Revision 1.38 1995/06/14 07:22:45 adam
116 # Target definitions can be deleted.
117 # Listbox used in the query definition dialog.
119 # Revision 1.37 1995/06/13 14:37:59 adam
120 # Work on query setup.
121 # Better about origin/target.
122 # Better presentation formats.
124 # Revision 1.36 1995/06/13 07:42:14 adam
125 # Bindings removed from text widgets.
127 # Revision 1.35 1995/06/12 15:17:31 adam
128 # Text widget used in main window (instead of listbox) to support
129 # better presentation formats.
131 # Revision 1.34 1995/06/12 07:59:07 adam
132 # More work on geometry handling.
134 # Revision 1.33 1995/06/09 11:17:35 adam
135 # Start work on geometry management.
137 # Revision 1.32 1995/06/07 09:16:37 adam
138 # New presentation format.
140 # Revision 1.31 1995/06/06 16:31:09 adam
141 # Bug fix: target names couldn't contain blanks.
144 # Revision 1.30 1995/06/06 11:35:41 adam
145 # Work on scan. Display of old sets.
147 # Revision 1.29 1995/06/05 14:11:18 adam
148 # Bug fix in present-more.
150 # Revision 1.28 1995/06/02 14:52:13 adam
151 # Minor changes really.
153 # Revision 1.27 1995/06/02 14:29:42 adam
154 # Work on scan interface - up/down buttons.
156 # Revision 1.26 1995/06/01 16:36:46 adam
157 # About buttons. Minor bug fixes.
159 # Revision 1.25 1995/05/31 13:09:57 adam
160 # Client searches/presents may be interrupted.
161 # New moving book-logo.
163 # Revision 1.24 1995/05/31 08:36:24 adam
164 # Bug fix in client.tcl: didn't save options on clientrc.tcl.
165 # New method: referenceId. More work on scan.
167 # Revision 1.23 1995/05/29 10:33:41 adam
168 # README and rename of startup script.
170 # Revision 1.22 1995/05/26 11:44:09 adam
171 # Bugs fixed. More work on MARC utilities and queries. Test
172 # client is up-to-date again.
174 # Revision 1.21 1995/05/11 15:34:46 adam
175 # Scan request changed a bit. This version works with RLG.
177 # Revision 1.20 1995/04/21 16:31:57 adam
178 # New radiobutton: protocol (z39v2/SR).
180 # Revision 1.19 1995/04/18 16:11:50 adam
181 # First version of graphical Scan. Some work on query-by-form.
183 # Revision 1.18 1995/04/10 10:50:22 adam
184 # Result-set name defaults to suffix of ir-set name.
185 # Started working on scan. Not finished at this point.
187 # Revision 1.17 1995/03/31 09:34:57 adam
188 # Search-button disabled when there is no connection.
190 # Revision 1.16 1995/03/31 08:56:36 adam
191 # New button "Search".
193 # Revision 1.15 1995/03/28 12:45:22 adam
194 # New ir method failback: called on disconnect/protocol error.
195 # New ir set/get method: protocol: SR / Z3950.
196 # Simple popup and disconnect when failback is invoked.
198 # Revision 1.14 1995/03/22 16:07:55 adam
201 # Revision 1.13 1995/03/21 17:27:26 adam
202 # Short-hand keys in setup.
204 # Revision 1.12 1995/03/21 13:41:03 adam
205 # Comstack cs_create not used too often. Non-blocking connect.
207 # Revision 1.11 1995/03/21 10:39:06 adam
208 # Diagnostic error message displayed with tkerror.
210 # Revision 1.10 1995/03/20 15:24:06 adam
211 # Diagnostic records saved on searchResponse.
213 # Revision 1.9 1995/03/17 18:26:16 adam
214 # Non-blocking i/o used now. Database names popup as cascade items.
216 # Revision 1.8 1995/03/17 15:45:00 adam
217 # Improved target/database setup.
219 # Revision 1.7 1995/03/16 17:54:03 adam
220 # Minor changes really.
222 # Revision 1.6 1995/03/15 19:10:20 adam
223 # Database setup in protocol-setup (rather target setup).
225 # Revision 1.5 1995/03/15 13:59:23 adam
228 # Revision 1.4 1995/03/14 17:32:29 adam
229 # Presentation of full Marc record in popup window.
231 # Revision 1.3 1995/03/12 19:31:52 adam
232 # Pattern matching implemented when retrieving MARC records. More
233 # diagnostic functions.
235 # Revision 1.2 1995/03/10 18:00:15 adam
236 # Actual presentation in line-by-line format. RPN query support.
238 # Revision 1.1 1995/03/09 16:15:07 adam
239 # First presentRequest attempts. Hot-target list.
243 if {$tk_version == "3.6"} {
254 proc configure-enable-e {w n} {
256 $w entryconfigure $n -state normal
258 proc configure-disable-e {w n} {
260 $w entryconfigure $n -state disabled
262 set noFocus [list -takefocus 0]
264 proc configure-enable-e {w n} {
267 proc configure-disable-e {w n} {
274 if {[tk colormodel .] == "color"} {
284 if {[file readable bitmaps/book2]} {
287 if {! [file readable ${libdir}/bitmaps/book2]} {
288 puts "Cannot locate system files in ${libdir}. You must either run this"
289 puts "program from the source directory root of ir-tcl or you must assure"
290 puts "that it is installed - normally in /usr/local/lib/irtcl"
298 set profile(Default) {{} {} {210} {} 16384 8192 tcpip {} 1 {} {} Z39 1}
300 set settingsChanged 0
309 set recordSyntax None
312 set queryTypes {Simple}
313 set queryButtons { { {I 0} {I 1} {I 2} } }
314 set queryInfo { { {Title {1=4 4=1}} {Author {1=1}} \
315 {Subject {1=21}} {Any {1=1016}} } }
324 if {[winfo exists $w]} {
333 label $w.top.b -bitmap error
334 message $w.top.t -aspect 300 -text "Error: $err" \
335 -font -Adobe-Helvetica-Bold-R-Normal-*-180-*
336 pack $w.top.b $w.top.t -side left -padx 10 -pady 10
338 bottom-buttons $w [list {Close} [list destroy $w]] 1
341 proc read-formats {} {
342 global displayFormats
344 if {[catch {set formats [glob -nocomplain ${libdir}/formats/*.tcl]}]} {
345 set formats ./formats/raw.tcl
348 if {[file readable $f]} {
350 set l [string length $f]
351 set f [string range $f [string length "${libdir}/formats/"] \
353 lappend displayFormats $f
362 .data.record configure -wrap $m
368 proc set-display-format {f} {
378 .bot.a.status configure -text "Reformatting"
381 add-title-lines -1 10000 1
384 proc initBindings {} {
387 bind $w <Double-1> {}
388 bind $w <Triple-1> {}
389 bind $w <B1-Motion> {}
391 bind $w <Shift-B1-Motion> {}
393 bind $w <B2-Motion> {}
394 bind $w <Any-KeyPress> {}
396 bind $w <BackSpace> {}
398 bind $w <Control-h> {}
399 bind $w <Control-d> {}
400 bind $w <Control-v> {}
403 bind $w <B1-Motion> {}
404 bind $w <Shift-B1-Motion> {}
409 proc post-menu {wbutton wmenu} {
412 $wmenu post [winfo rootx $wbutton] \
413 [expr [winfo rooty $wbutton]+[winfo height $wbutton]]
418 global windowGeometry
419 set windowGeometry($w) [wm geometry $w]
422 global windowGeometry
425 if {[info exists windowGeometry($w)]} {
426 set g $windowGeometry($w)
431 bind $w <Destroy> [list destroyGW $w]
434 if {[file readable "clientrc.tcl"]} {
435 source "clientrc.tcl"
437 if {[file readable "${libdir}/clientrc.tcl"]} {
438 source "${libdir}/clientrc.tcl"
442 if {[file readable "~/.clientrc.tcl"]} {
443 source "~/.clientrc.tcl"
446 set queryButtonsFind [lindex $queryButtons 0]
447 set queryInfoFind [lindex $queryInfo 0]
449 proc top-down-window {w} {
450 frame $w.top -relief raised -border 1
451 frame $w.bot -relief raised -border 1
453 pack $w.top -side top -fill both -expand yes
454 pack $w.bot -fill both
457 proc top-down-ok-cancel {w ok-action g} {
458 frame $w.bot.left -relief sunken -border 1
459 pack $w.bot.left -side left -expand yes -ipadx 2 -ipady 2 -padx 1 -pady 1
460 button $w.bot.left.ok -width 4 -text {Ok} \
461 -command ${ok-action}
462 pack $w.bot.left.ok -expand yes -ipadx 1 -ipady 1 -padx 2 -pady 2
463 button $w.bot.cancel -width 5 -text {Cancel} \
464 -command [list destroy $w]
465 pack $w.bot.cancel -side left -expand yes
473 proc bottom-buttons {w buttonList g} {
475 set l [llength $buttonList]
477 frame $w.bot.$i -relief sunken -border 1
478 pack $w.bot.$i -side left -expand yes -padx 2 -pady 2
479 button $w.bot.$i.ok -text [lindex $buttonList $i] \
480 -command [lindex $buttonList [expr $i+1]]
481 pack $w.bot.$i.ok -expand yes -padx 2 -pady 2 -side left
485 button $w.bot.$i -text [lindex $buttonList $i] \
486 -command [lindex $buttonList [expr $i+1]]
487 pack $w.bot.$i -expand yes -padx 2 -pady 2 -side left
497 proc cancel-operation {} {
505 show-status Cancel 0 1
509 proc show-target {target base} {
513 .bot.a.target configure -text ""
517 .bot.a.target configure -text "$target"
519 .bot.a.target configure -text "$target - $base"
523 proc show-logo {v1} {
532 .bot.logo configure -bitmap @${libdir}/bitmaps/book${v1}
533 after 140 [list show-logo $v1]
537 .bot.logo configure -bitmap @${libdir}/bitmaps/book1
546 proc show-status {status b sb} {
553 .bot.a.status configure -text "$status"
555 if {$busy == 0} {set busy 1}
563 .top.service configure -state normal
564 .mid.search configure -state normal
566 .mid.scan configure -state normal
569 configure-disable-e .top.service.m 1
570 } elseif {[z39.$setNo nextResultSetPosition] > 0 &&
571 [z39.$setNo nextResultSetPosition] <= [z39.$setNo resultCount]} {
572 configure-enable-e .top.service.m 1
573 .mid.present configure -state normal
575 configure-disable-e .top.service.m 1
576 .mid.present configure -state disabled
578 if {[winfo exists .scan-window]} {
579 .scan-window.bot.2 configure -state normal
580 .scan-window.bot.4 configure -state normal
583 .top.service configure -state disabled
584 .mid.search configure -state disabled
585 .mid.scan configure -state disabled
586 .mid.present configure -state disabled
588 if {[winfo exists .scan-window]} {
589 .scan-window.bot.2 configure -state disabled
590 .scan-window.bot.4 configure -state disabled
595 proc show-message {msg} {
596 .bot.a.message configure -text "$msg"
599 proc insertWithTags {w text args} {
600 set start [$w index insert]
601 $w insert insert $text
602 foreach tag [$w tag names $start] {
603 $w tag remove $tag $start insert
606 $w tag add $i $start insert
610 proc popup-license {} {
615 wm title $w "License"
621 text $w.top.t -width 80 -height 10 -wrap word \
622 -yscrollcommand [list $w.top.s set]
623 scrollbar $w.top.s -command [list $w.top.t yview]
625 pack $w.top.s -side right -fill y
626 pack $w.top.t -expand yes -fill both
628 if {[file readable "${libdir}/LICENSE"]} {
629 set f [open "${libdir}/LICENSE" r]
630 while {[gets $f buf] != -1} {
631 $w.top.t insert end $buf
632 $w.top.t insert end "\n"
636 bottom-buttons $w [list {Close} [list destroy $w]] 1
639 proc about-target {} {
640 set w .about-target-w
645 wm title $w "About target"
649 frame $w.top.a -relief ridge -border 2
650 frame $w.top.p -relief ridge -border 2
652 pack $w.top.a $w.top.p -side top -fill x
654 label $w.top.a.about -text "About"
655 label $w.top.a.irtcl -text $hostid \
656 -font -Adobe-Helvetica-Bold-R-Normal-*-240-*
657 pack $w.top.a.about $w.top.a.irtcl -side top
659 set i [z39 targetImplementationName]
660 label $w.top.p.in -text "Implementation name: $i"
661 set i [z39 targetImplementationId]
662 label $w.top.p.ii -text "Implementation id: $i"
663 set i [z39 targetImplementationVersion]
664 label $w.top.p.iv -text "Implementation version: $i"
666 label $w.top.p.op -text "Protocol options: $i"
668 pack $w.top.p.in $w.top.p.ii $w.top.p.iv $w.top.p.op -side top -anchor nw
670 bottom-buttons $w [list {Close} [list destroy $w]] 1
673 proc about-origin-logo {n} {
675 set w .about-origin-w
676 if {![winfo exists $w]} {
683 $w.top.a.logo configure -bitmap @${libdir}/bitmaps/book$n
684 after 140 [list about-origin-logo $n]
687 proc about-origin {} {
688 set w .about-origin-w
691 if {[winfo exists $w]} {
696 wm title $w "About IrTcl"
700 frame $w.top.a -relief ridge -border 2
701 frame $w.top.p -relief ridge -border 2
703 pack $w.top.a $w.top.p -side top -fill x
705 label $w.top.a.irtcl -text "IrTcl" \
706 -font -Adobe-Helvetica-Bold-R-Normal-*-240-*
707 label $w.top.a.logo -bitmap @${libdir}/bitmaps/book1
708 pack $w.top.a.irtcl $w.top.a.logo -side left -expand yes
711 catch {set i [z39 implementationName]}
712 label $w.top.p.in -text "Implementation name: $i"
713 catch {set i [z39 implementationId]}
714 label $w.top.p.ii -text "Implementation id: $i"
715 catch {set i [z39 implementationVersion]}
716 label $w.top.p.iv -text "Implementation version: $i"
718 pack $w.top.p.in $w.top.p.ii $w.top.p.iv -side top -anchor nw
721 bottom-buttons $w [list {Close} [list destroy $w] \
722 {License} [list popup-license]] 0
725 proc popup-marc {sno no b df} {
727 global displayFormats
730 if {[z39.$sno type $no] != "DB"} {
734 set w .full-marc-$fullMarcSeq
741 if {[winfo exists $w]} {
749 frame $w.top -relief raised -border 1
750 frame $w.bot -relief raised -border 1
752 pack $w.top -side top -fill both -expand yes
753 pack $w.bot -fill both
755 text $w.top.record -width 60 -height 5 -wrap word \
756 -yscrollcommand [list $w.top.s set]
757 scrollbar $w.top.s -command [list $w.top.record yview]
761 $w.top.record tag configure marc-tag -foreground blue
762 $w.top.record tag configure marc-id -foreground red
764 $w.top.record tag configure marc-tag -foreground black
765 $w.top.record tag configure marc-id -foreground black
767 $w.top.record tag configure marc-data -foreground black
770 $w.top.record delete 0.0 end
771 set recordType [z39.$sno recordType $no]
772 wm title $w "$recordType record #$no"
775 bind $w.top.record <Return> {destroy .full-marc}
777 pack $w.top.s -side right -fill y
778 pack $w.top.record -expand yes -fill both
781 bottom-buttons $w [list \
782 {Close} [list destroy $w]] 0
784 bottom-buttons $w [list \
785 {Close} [list destroy $w] \
786 {Duplicate} [list popup-marc $sno $no 1 0]] 0
787 menubutton $w.bot.formats -text "Format" -menu $w.bot.formats.m
788 menu $w.bot.formats.m
790 foreach f $displayFormats {
791 $w.bot.formats.m add radiobutton -label $f \
792 -variable popupMarcdf -value $i \
793 -command [list display-$f $sno $no $w.top.record 0]
796 pack $w.bot.formats -expand yes -ipadx 2 -ipady 2 \
797 -padx 3 -pady 3 -side left
801 $w.bot.formats.m delete 0 last
802 foreach f $displayFormats {
803 $w.bot.formats.m add radiobutton -label $f \
804 -variable popupMarcdf -value $i \
805 -command [list display-$f $sno $no $w.top.record 0]
809 set ffunc [lindex $displayFormats $df]
810 set ffunc "display-$ffunc"
812 $ffunc $sno $no $w.top.record 0
815 proc update-target-hotlist {target base} {
818 set olen [llength $hotTargets]
820 foreach e $hotTargets {
821 if {$target == [lindex $e 0] && $base == [lindex $e 1]} {
822 set hotTargets [lreplace $hotTargets $i $i]
827 set hotTargets [linsert $hotTargets 0 [list $target $base]]
828 set-target-hotlist $olen
831 proc delete-target-hotlist {target} {
834 set olen [llength $hotTargets]
836 foreach e $hotTargets {
837 if {$target == [lindex $e 0]} {
838 set hotTargets [lreplace $hotTargets $i $i]
842 set-target-hotlist $olen
845 proc set-target-hotlist {olen} {
850 .top.target.m delete 7 [expr 7+$olen]
852 .top.target.m delete 6 [expr 6+$olen]
856 foreach e $hotTargets {
857 set target [lindex $e 0]
858 set base [lindex $e 1]
860 .top.target.m add command -label "$i $target" -command \
861 [list reopen-target $target {}]
863 .top.target.m add command -label "$i $target - $base" -command \
864 [list reopen-target $target $base]
873 proc reopen-target {target base} {
875 open-target $target $base
876 update-target-hotlist $target $base
879 proc define-target-action {} {
882 set target [.target-define.top.target.entry get]
886 foreach n [array names profile] {
892 set seq [lindex $profile(Default) 12]
894 set profile($target) $profile(Default)
895 set profile(Default) [lreplace $profile(Default) 12 12 [incr seq]]
897 protocol-setup $target
898 destroy .target-define
901 proc fail-response {target} {
902 set c [lindex [z39 failInfo] 0]
903 set m [lindex [z39 failInfo] 1]
908 proc connect-response {target base} {
909 dputs "connect-response"
910 show-target $target $base
914 proc open-target {target base} {
919 z39 comstack [lindex $profile($target) 6]
920 z39 protocol [lindex $profile($target) 11]
921 z39 idAuthentication [lindex $profile($target) 3]
922 z39 maximumRecordSize [lindex $profile($target) 4]
923 z39 preferredMessageSize [lindex $profile($target) 5]
924 dputs "maximumRecordSize="
925 dputs [z39 maximumRecordSize]
926 dputs "preferredMessageSize="
927 dputs [z39 preferredMessageSize]
928 show-status Connecting 1 0
930 z39 databaseNames [lindex [lindex $profile($target) 7] 0]
932 z39 databaseNames $base
934 z39 failback [list fail-response $target]
935 z39 callback [list connect-response $target $base]
938 z39 connect [lindex $profile($target) 1]:[lindex $profile($target) 2]
941 tkerror $errorMessage
942 show-status "Not connected" 0 {}
946 configure-disable-e .top.target.m 0
947 configure-enable-e .top.target.m 1
948 configure-enable-e .top.target.m 2
951 proc close-target {} {
960 .bot.a.set configure -text ""
964 show-status {Not connected} 0 0
967 configure-disable-e .top.target.m 1
968 configure-disable-e .top.target.m 2
970 .top.rset.m delete 2 last
972 .top.rset.m delete 1 last
974 .top.rset.m add separator
975 configure-enable-e .top.target.m 0
978 proc load-set-action {} {
982 ir-set z39.$setNoLast z39
984 set fname [.load-set.top.filename.entry get]
987 show-status Loading 1 {}
989 z39.$setNoLast loadFile $fname
991 set no [z39.$setNoLast numberOfRecordsReturned]
992 add-title-lines $setNoLast $no 1
994 set l [format "%-4d %7d" $setNoLast $no]
995 .top.rset.m add command -label $l \
996 -command [list add-title-lines $setNoLast 10000 1]
997 show-status Ready 0 {}
1003 set oldFocus [focus]
1007 frame $w.top.filename
1008 pack $w.top.filename -side top -anchor e -pady 2
1010 entry-fields $w.top {filename} \
1012 {load-set-action} {destroy .load-set}
1014 top-down-ok-cancel $w {load-set-action} 1
1018 proc init-request {} {
1025 z39 callback {init-response}
1026 show-status Initializing 1 {}
1027 set err [catch {z39 init} errorMessage]
1029 tkerror $errorMessage
1030 show-status Ready 0 {}
1034 proc init-response {} {
1042 if {![z39 initResult]} {
1043 show-status Ready 0 1
1044 set u [z39 userInformationField]
1046 tkerror "Connection rejected by target: $u"
1048 if {[lsearch [z39 options] scan] >= 0} {
1053 show-status Ready 0 1
1057 proc search-request {bflag} {
1069 dputs "search-request"
1071 if {!$bflag && $busy} {
1072 dputs "busy: search-request ignored"
1077 show-status Searching 1 0
1078 set delayRequest {search-request 1}
1083 set query [index-query]
1088 set setNo $setNoLast
1089 ir-set z39.$setNo z39
1091 if {[lindex $profile($target) 10] == 1} {
1092 z39.$setNo setName $setNo
1093 dputs "setName=${setNo}"
1095 z39.$setNo setName Default
1096 dputs "setName=Default"
1098 if {[lindex $profile($target) 8] == 1} {
1099 z39.$setNo queryType rpn
1101 if {[lindex $profile($target) 9] == 1} {
1102 z39.$setNo queryType ccl
1106 if {$recordSyntax == "None" } {
1107 z39.$setNo preferredRecordSyntax {}
1109 z39.$setNo preferredRecordSyntax $recordSyntax
1111 z39 callback {search-response}
1112 z39.$setNo search $query
1113 show-status Searching 1 0
1116 proc scan-copy {y entry} {
1118 set no [$w.top.list nearest $y]
1120 .lines.$entry.e delete 0 end
1121 .lines.$entry.e insert 0 [string range [$w.top.list get $no] 8 end]
1124 proc scan-request {} {
1131 global curIndexEntry
1132 global queryButtonsFind
1133 global queryInfoFind
1137 dputs "scan-request"
1140 show-status Scanning 1 0
1141 set delayRequest scan-request
1150 set b [lindex $queryButtonsFind $curIndexEntry]
1152 foreach a [lrange [lindex $queryInfoFind [lindex $b 1]] 1 end] {
1153 set attr "@attr $a $attr"
1155 set title [lindex [lindex $queryInfoFind [lindex $b 1]] 0]
1156 ir-scan z39.scan z39
1158 if {![winfo exists $w]} {
1165 entry $w.top.entry -relief sunken
1166 pack $w.top.entry -fill x -padx 4 -pady 2
1167 bind $w.top.entry <KeyRelease> [list scan-term-h $attr]
1168 listbox $w.top.list -yscrollcommand [list $w.top.scroll set] \
1170 scrollbar $w.top.scroll -orient vertical -border 1
1171 pack $w.top.list -side left -fill both -expand yes
1172 pack $w.top.scroll -side right -fill y
1173 $w.top.scroll config -command [list $w.top.list yview]
1175 bottom-buttons $w [list {Close} [list destroy $w] \
1176 {Up} [list scan-up $attr] \
1177 {Down} [list scan-down $attr]] 0
1178 bind $w.top.list <Up> [list scan-up $attr]
1179 bind $w.top.list <Down> [list scan-down $attr]
1182 bind $w.top.list <Double-Button-1> [list scan-copy %y $curIndexEntry]
1183 wm title $w "Scan $title"
1185 z39 callback [list scan-response $attr 0 35]
1186 z39.scan numberOfTermsRequested 5
1187 z39.scan preferredPositionInResponse 1
1188 z39.scan scan "${attr} 0"
1190 show-status Scanning 1 0
1193 proc scan-term-h {attr} {
1201 set nScanTerm [$w.top.entry get]
1202 if {$nScanTerm == $scanTerm} {
1205 set scanTerm $nScanTerm
1206 z39 callback [list scan-response $attr 0 35]
1207 z39.scan numberOfTermsRequested 5
1208 z39.scan preferredPositionInResponse 1
1209 dputs "${attr} \{${scanTerm}\}"
1210 if {$scanTerm == ""} {
1211 z39.scan scan "${attr} 0"
1213 z39.scan scan "${attr} \{${scanTerm}\}"
1215 show-status Scanning 1 0
1218 proc scan-response {attr start toget} {
1225 dputs "In scan-response"
1226 set m [z39.scan numberOfEntriesReturned]
1232 if {![winfo exists .scan-window]} {
1235 dputs "Handling cancel"
1236 if {$delayRequest != ""} {
1241 show-status Ready 0 1
1244 set nScanTerm [$w.top.entry get]
1245 if {$nScanTerm != $scanTerm} {
1246 z39 callback [list scan-response $attr 0 35]
1247 z39.scan numberOfTermsRequested 5
1248 z39.scan preferredPositionInResponse 1
1249 set scanTerm $nScanTerm
1250 dputs "${attr} \{${scanTerm}\}"
1251 if {$scanTerm == ""} {
1252 z39.scan scan "${attr} 0"
1254 z39.scan scan "${attr} \{${scanTerm}\}"
1256 show-status Scanning 1 0
1259 set status [z39.scan scanStatus]
1262 show-status Ready 0 1
1267 for {set i 0} {$i < $m} {incr i} {
1268 set term [lindex [z39.scan scanLine $i] 1]
1269 set nostr [format " %-6d" [lindex [z39.scan scanLine $i] 2]]
1270 $w.top.list insert $i "$nostr $term"
1273 $w.top.list yview $scanView
1275 $w.top.list delete $start end
1276 for {set i 0} {$i < $m} {incr i} {
1277 set term [lindex [z39.scan scanLine $i] 1]
1278 set nostr [format " %-6d" [lindex [z39.scan scanLine $i] 2]]
1279 $w.top.list insert end "$nostr $term"
1283 dputs "Handling cancel"
1285 if {$delayRequest != ""} {
1291 if {$toget > 0 && $m > 1 && $m < $toget} {
1292 set ntoget [expr $toget - $m + 1]
1293 dputs ntoget=$ntoget
1294 z39 callback [list scan-response $attr [expr $start + $m - 1] $ntoget]
1296 dputs "down continue: $q"
1298 z39.scan numberOfTermsRequested 10
1300 z39.scan numberOfTermsRequested $ntoget
1302 z39.scan preferredPositionInResponse 1
1303 dputs "${attr} \{$q\}"
1304 z39.scan scan "${attr} \{$q\}"
1307 if {$toget < 0 && $m > 1 && $m < [expr - $toget]} {
1308 set ntoget [expr - $toget - $m]
1309 dputs ntoget=$ntoget
1310 z39 callback [list scan-response $attr 0 -$ntoget]
1311 set q [string range [$w.top.list get 0] 8 end]
1312 dputs "up continue: $q"
1314 z39.scan numberOfTermsRequested 10
1315 z39.scan preferredPositionInResponse 11
1317 z39.scan numberOfTermsRequested $ntoget
1318 z39.scan preferredPositionInResponse [incr ntoget]
1320 dputs "${attr} \{$q\}"
1321 z39.scan scan "${attr} \{$q\}"
1324 show-status Ready 0 1
1327 proc scan-down {attr} {
1335 show-status {Scanning down} 1 0
1336 set delayRequest [list scan-down $attr]
1342 set scanView [expr $scanView + 5]
1343 set s [$w.top.list size]
1344 if {$scanView > $s} {
1345 z39 callback [list scan-response $attr [expr $s - 1] 25]
1346 set q [string range [$w.top.list get [expr $s - 1]] 8 end]
1348 z39.scan numberOfTermsRequested 10
1349 z39.scan preferredPositionInResponse 1
1350 show-status Scanning 1 0
1351 dputs "${attr} \{$q\}"
1352 z39.scan scan "${attr} \{$q\}"
1355 $w.top.list yview $scanView
1358 proc scan-up {attr} {
1366 show-status Scanning 1 0
1367 set delayRequest [list scan-up $attr]
1373 set scanView [expr $scanView - 5]
1374 if {$scanView < 0} {
1375 z39 callback [list scan-response $attr 0 -25]
1376 set q [string range [$w.top.list get 0] 8 end]
1378 z39.scan numberOfTermsRequested 10
1379 z39.scan preferredPositionInResponse 11
1380 show-status Scanning 1 0
1381 z39.scan scan "${attr} \{$q\}"
1384 $w.top.list yview $scanView
1387 proc search-response {} {
1395 dputs "In search-response"
1397 dputs "Handling cancel"
1399 if {$delayRequest != ""} {
1407 set setMax [z39.$setNo resultCount]
1408 show-status Ready 0 1
1409 set status [z39.$setNo responseStatus]
1410 if {[lindex $status 0] == "NSD"} {
1411 z39.$setNo nextResultSetPosition 0
1412 set code [lindex $status 1]
1413 set msg [lindex $status 2]
1414 set addinfo [lindex $status 3]
1415 tkerror "NSD$code: $msg: $addinfo"
1418 show-message "${setMax} hits"
1423 show-status Ready 0 1
1424 set l [format "%-4d %7d" $setNo $setMax]
1425 .top.rset.m add command -label $l \
1426 -command [list add-title-lines $setNo 10000 1]
1430 z39 callback {present-response}
1431 z39.$setNo present $setOffset 1
1432 show-status Retrieving 1 0
1435 proc present-more {number} {
1443 dputs "present-more"
1445 show-status Retrieving 1 0
1446 set delayRequest "present-more $number"
1452 dputs "setNo=$setNo"
1455 set setOffset [z39.$setNo nextResultSetPosition]
1456 dputs "setOffest=${setOffset}"
1457 dputs "setNo=${setNo}"
1458 set max [z39.$setNo resultCount]
1459 if {$max < $setOffset} {
1461 dputs "setOffset=$setOffset"
1462 show-status Ready 0 1
1465 if {$number == ""} {
1469 if {$setMax > $max} {
1473 z39 callback {present-response}
1475 set toGet [expr $setMax - $setOffset + 1]
1482 z39.$setNo present $setOffset $toGet
1483 show-status Retrieving 1 0
1486 proc init-title-lines {} {
1487 .data.record delete 0.0 end
1490 proc title-press {y setno} {
1491 show-full-marc $setno [expr 1 + [.data.list nearest $y]] 0
1494 proc add-title-lines {setno no offset} {
1495 global displayFormats
1496 global displayFormat
1506 .bot.a.set configure -text $setno
1507 .data.record delete 0.0 end
1509 set ffunc [lindex $displayFormats $displayFormat]
1510 dputs "ffunc=$ffunc"
1511 set ffunc "display-$ffunc"
1512 for {set i 0} {$i < $no} {incr i} {
1513 set o [expr $i + $offset]
1514 set type [z39.$setno type $o]
1518 .data.record tag bind r$o <Any-Enter> {}
1519 .data.record tag bind r$o <Any-Leave> {}
1520 set insert0 [.data.record index insert]
1521 $ffunc $setno $o .data.record 1
1522 .data.record tag add r$o $insert0 insert
1523 .data.record tag bind r$o <1> \
1524 [list popup-marc $setno $o 0 0]
1528 show-status Ready 0 1
1532 proc present-response {} {
1539 dputs "In present-response"
1540 set no [z39.$setNo numberOfRecordsReturned]
1541 dputs "Returned $no records, setOffset $setOffset"
1542 add-title-lines $setNo $no $setOffset
1543 set setOffset [expr $setOffset + $no]
1545 dputs "Handling cancel"
1547 if {$delayRequest != ""} {
1552 set status [z39.$setNo responseStatus]
1553 if {[lindex $status 0] == "NSD"} {
1554 show-status Ready 0 1
1555 set code [lindex $status 1]
1556 set msg [lindex $status 2]
1557 set addinfo [lindex $status 3]
1558 tkerror "NSD$code: $msg: $addinfo"
1561 if {$no > 0 && $setOffset <= $setMax} {
1562 dputs "present-request from ${setOffset}"
1563 set toGet [expr $setMax - $setOffset + 1]
1567 z39.$setNo present $setOffset $toGet
1569 show-status Ready 0 1
1573 proc left-cursor {w} {
1574 set i [$w index insert]
1582 proc right-cursor {w} {
1583 set i [$w index insert]
1589 proc bind-fields {list returnAction escapeAction} {
1590 set max [expr [llength $list]-1]
1591 for {set i 0} {$i < $max} {incr i} {
1592 bind [lindex $list $i] <Return> $returnAction
1593 bind [lindex $list $i] <Escape> $escapeAction
1595 bind [lindex $list $i] <Tab> \
1596 [list focus [lindex $list [expr $i+1]]]
1597 bind [lindex $list $i] <Left> \
1598 [list left-cursor [lindex $list $i]]
1599 bind [lindex $list $i] <Right> \
1600 [list right-cursor [lindex $list $i]]
1603 bind [lindex $list $i] <Return> $returnAction
1604 bind [lindex $list $i] <Escape> $escapeAction
1606 bind [lindex $list $i] <Tab> [list focus [lindex $list 0]]
1607 bind [lindex $list $i] <Left> [list left-cursor [lindex $list $i]]
1608 bind [lindex $list $i] <Right> [list right-cursor [lindex $list $i]]
1610 focus [lindex $list 0]
1613 proc entry-fields {parent list tlist returnAction escapeAction} {
1616 foreach field $list {
1617 set label ${parent}.${field}.label
1618 set entry ${parent}.${field}.entry
1619 label $label -text [lindex $tlist $i] -anchor e
1620 entry $entry -width 32 -relief sunken
1621 pack $label -side left
1622 pack $entry -side right
1623 lappend alist $entry
1626 bind-fields $alist $returnAction $escapeAction
1629 proc define-target-dialog {} {
1630 set w .target-define
1636 pack $w.top.target \
1637 -side top -anchor e -pady 2
1638 entry-fields $w.top {target} \
1640 {define-target-action} {destroy .target-define}
1641 top-down-ok-cancel $w {define-target-action} 1
1644 proc protocol-setup-delete {target} {
1646 global settingsChanged
1648 set a [alert "Are you sure you want to delete the target \
1649 definition $target ?"]
1651 set wno [lindex $profile($target) 12]
1654 unset profile($target)
1655 set settingsChanged 1
1657 delete-target-hotlist $target
1661 proc protocol-setup-action {target} {
1664 global protocolRadioType
1665 global settingsChanged
1668 global ResultSetCheck
1670 set wno [lindex $profile($target) 12]
1674 set settingsChanged 1
1675 set len [$w.top.databases.list size]
1676 for {set i 0} {$i < $len} {incr i} {
1677 lappend b [$w.top.databases.list get $i]
1679 set profile($target) [list [$w.top.description.entry get] \
1680 [$w.top.host.entry get] \
1681 [$w.top.port.entry get] \
1682 [$w.top.idAuthentication.entry get] \
1683 [$w.top.maximumRecordSize.entry get] \
1684 [$w.top.preferredMessageSize.entry get] \
1690 $protocolRadioType \
1694 delete-target-hotlist $target
1695 dputs $profile($target)
1699 proc place-force {window parent} {
1700 set g [wm geometry $parent]
1702 set p1 [string first + $g]
1703 set p2 [string last + $g]
1705 set x [expr 40+[string range $g [expr $p1 +1] [expr $p2 -1]]]
1706 set y [expr 60+[string range $g [expr $p2 +1] end]]
1707 wm geometry $window +${x}+${y}
1710 proc add-database-action {target} {
1713 set wno [lindex $profile($target) 12]
1716 $w.top.databases.list insert end \
1717 [.database-select.top.database.entry get]
1718 destroy .database-select
1721 proc add-database {target} {
1724 set w .database-select
1726 set oldFocus [focus]
1728 set wno [lindex $profile($target) 12]
1729 place-force $w .setup-${wno}
1733 frame $w.top.database
1735 pack $w.top.database -side top -anchor e -pady 2
1737 entry-fields $w.top {database} \
1738 {{Database to add:}} \
1739 [list add-database-action $target] {destroy .database-select}
1741 top-down-ok-cancel $w [list add-database-action $target] 1
1745 proc delete-database {target} {
1748 set wno [lindex $profile($target) 12]
1751 foreach i [$w.top.databases.list curselection] {
1752 set b [$w.top.databases.list get $i]
1755 set a [alert "Are you sure you want to remove the database(s)${l}?"]
1757 foreach i [lsort -decreasing \
1758 [$w.top.databases.list curselection]] {
1759 $w.top.databases.list delete $i
1764 proc protocol-setup {target} {
1767 global protocolRadioType
1770 global ResultSetCheck
1772 set wno [lindex $profile($target) 12]
1777 wm title $w "Setup $target"
1781 if {$target == ""} {
1785 dputs $profile($target)
1787 frame $w.top.description
1790 frame $w.top.idAuthentication
1791 frame $w.top.maximumRecordSize
1792 frame $w.top.preferredMessageSize
1793 frame $w.top.cs-type -relief ridge -border 2
1794 frame $w.top.protocol -relief ridge -border 2
1795 frame $w.top.query -relief ridge -border 2
1796 frame $w.top.databases -relief ridge -border 2
1798 # Maximum/preferred/idAuth ...
1799 pack $w.top.description $w.top.host $w.top.port \
1800 $w.top.idAuthentication $w.top.maximumRecordSize \
1801 $w.top.preferredMessageSize -side top -anchor e -pady 2
1803 entry-fields $w.top {description host port idAuthentication \
1804 maximumRecordSize preferredMessageSize} \
1805 {{Description:} {Host:} {Port:} {Id Authentication:} \
1806 {Maximum Record Size:} {Preferred Message Size:}} \
1807 [list protocol-setup-action $target] [list destroy $w]
1809 foreach sub {description host port idAuthentication \
1810 maximumRecordSize preferredMessageSize} {
1812 bind $w.top.$sub.entry <Control-a> [list add-database $target]
1813 bind $w.top.$sub.entry <Control-d> [list delete-database $target]
1815 $w.top.description.entry insert 0 [lindex $profile($target) 0]
1816 $w.top.host.entry insert 0 [lindex $profile($target) 1]
1817 $w.top.port.entry insert 0 [lindex $profile($target) 2]
1818 $w.top.idAuthentication.entry insert 0 [lindex $profile($target) 3]
1819 $w.top.maximumRecordSize.entry insert 0 [lindex $profile($target) 4]
1820 $w.top.preferredMessageSize.entry insert 0 [lindex $profile($target) 5]
1821 set csRadioType [lindex $profile($target) 6]
1822 set RPNCheck [lindex $profile($target) 8]
1823 set CCLCheck [lindex $profile($target) 9]
1824 set ResultSetCheck [lindex $profile($target) 10]
1825 set protocolRadioType [lindex $profile($target) 11]
1826 if {$protocolRadioType == ""} {
1827 set protocolRadioType Z39
1831 pack $w.top.databases -side left -pady 2 -padx 2 -expand yes -fill both
1833 label $w.top.databases.label -text "Databases"
1834 button $w.top.databases.add -text "Add" \
1835 -command [list add-database $target]
1836 button $w.top.databases.delete -text "Delete" \
1837 -command [list delete-database $target]
1839 listbox $w.top.databases.list -geometry 14x6 \
1840 -yscrollcommand "$w.top.databases.scroll set"
1842 listbox $w.top.databases.list -width 14 -height 5\
1843 -yscrollcommand "$w.top.databases.scroll set"
1845 scrollbar $w.top.databases.scroll -orient vertical -border 1
1846 pack $w.top.databases.label -side top -fill x \
1848 pack $w.top.databases.add $w.top.databases.delete -side top -fill x \
1850 pack $w.top.databases.list -side left -fill both -expand yes \
1852 pack $w.top.databases.scroll -side right -fill y \
1854 $w.top.databases.scroll config -command "$w.top.databases.list yview"
1856 foreach b [lindex $profile($target) 7] {
1857 $w.top.databases.list insert end $b
1861 pack $w.top.cs-type -pady 2 -padx 2 -side top -fill x
1863 label $w.top.cs-type.label -text "Transport"
1864 radiobutton $w.top.cs-type.tcpip -text "TCP/IP" -anchor w \
1865 -variable csRadioType -value tcpip
1866 radiobutton $w.top.cs-type.mosi -text "MOSI" -anchor w\
1867 -variable csRadioType -value mosi
1869 pack $w.top.cs-type.label $w.top.cs-type.tcpip $w.top.cs-type.mosi \
1870 -padx 2 -side top -fill x
1873 pack $w.top.protocol -pady 2 -padx 2 -side top -fill x
1875 label $w.top.protocol.label -text "Protocol"
1876 radiobutton $w.top.protocol.z39v2 -text "Z39.50" -anchor w \
1877 -variable protocolRadioType -value Z39
1878 radiobutton $w.top.protocol.sr -text "SR" -anchor w \
1879 -variable protocolRadioType -value SR
1881 pack $w.top.protocol.label $w.top.protocol.z39v2 $w.top.protocol.sr \
1882 -padx 2 -side top -fill x
1885 pack $w.top.query -pady 2 -padx 2 -side top -fill x
1887 label $w.top.query.label -text "Query support"
1888 checkbutton $w.top.query.c1 -text "RPN query" -anchor w -variable RPNCheck
1889 checkbutton $w.top.query.c2 -text "CCL query" -anchor w -variable CCLCheck
1890 checkbutton $w.top.query.c3 -text "Result sets" -anchor w -variable ResultSetCheck
1892 pack $w.top.query.label -side top
1893 pack $w.top.query.c1 $w.top.query.c2 $w.top.query.c3 \
1894 -padx 2 -side top -fill x
1897 bottom-buttons $w [list {Ok} [list protocol-setup-action $target] \
1898 {Delete} [list protocol-setup-delete $target] \
1899 {Cancel} [list destroy $w]] 0
1902 proc database-select-action {} {
1903 set w .database-select.top
1905 foreach indx [$w.databases.list curselection] {
1906 lappend b [$w.databases.list get $indx]
1909 z39 databaseNames $b
1911 destroy .database-select
1914 proc database-select {} {
1915 set w .database-select
1920 set oldFocus [focus]
1925 frame $w.top.databases -relief ridge -border 2
1927 pack $w.top.databases -side left -pady 6 -padx 6 -expand yes -fill x
1929 label $w.top.databases.label -text "List"
1930 listbox $w.top.databases.list -width 20 -height 6 \
1931 -yscrollcommand "$w.top.databases.scroll set"
1932 scrollbar $w.top.databases.scroll -orient vertical -border 1
1933 pack $w.top.databases.label -side top -fill x \
1935 pack $w.top.databases.list -side left -fill both -expand yes \
1937 pack $w.top.databases.scroll -side right -fill y \
1939 $w.top.databases.scroll config -command "$w.top.databases.list yview"
1941 foreach b [lindex $profile($hostid) 7] {
1942 $w.top.databases.list insert end $b
1944 top-down-ok-cancel $w {database-select-action} 1
1948 proc cascade-target-list {} {
1951 foreach sub [winfo children .top.target.m.clist] {
1954 .top.target.m.clist delete 0 last
1955 foreach n [lsort [array names profile]] {
1956 if {$n != "Default"} {
1957 set nl [lindex $profile($n) 12]
1958 if {[llength [lindex $profile($n) 7]] > 1} {
1959 .top.target.m.clist add cascade -label $n \
1960 -menu .top.target.m.clist.$nl
1961 menu .top.target.m.clist.$nl
1962 foreach b [lindex $profile($n) 7] {
1963 .top.target.m.clist.$nl add command -label $b \
1964 -command [list reopen-target $n $b]
1967 .top.target.m.clist add command -label $n \
1968 -command [list reopen-target $n {}]
1972 .top.target.m.slist delete 0 last
1973 foreach n [lsort [array names profile]] {
1974 if {$n != "Default"} {
1975 .top.target.m.slist add command -label $n \
1976 -command [list protocol-setup $n]
1981 proc query-select {i} {
1982 global queryButtonsFind
1983 global queryInfoFind
1987 set queryInfoFind [lindex $queryInfo $i]
1988 set queryButtonsFind [lindex $queryButtons $i]
1990 index-lines .lines 1 $queryButtonsFind $queryInfoFind activate-index
1993 proc query-new-action {} {
1997 global settingsChanged
1999 set settingsChanged 1
2000 lappend queryTypes [.query-new.top.index.entry get]
2001 lappend queryButtons {}
2002 lappend queryInfo {}
2012 set oldFocus [focus]
2017 -side top -anchor e -pady 2
2018 entry-fields $w.top index \
2020 query-new-action {destroy .query-new}
2021 top-down-ok-cancel $w query-new-action 1
2025 proc query-delete-action {queryNo} {
2029 global settingsChanged
2031 set settingsChanged 1
2033 set queryTypes [lreplace $queryTypes $queryNo $queryNo]
2034 set queryButtons [lreplace $queryButtons $queryNo $queryNo]
2035 set queryInfo [lreplace $queryInfo $queryNo $queryNo]
2036 destroy .query-delete
2040 proc query-delete {queryNo} {
2048 set n [lindex $queryTypes $queryNo]
2050 label $w.top.warning -bitmap warning
2051 message $w.top.quest -text "Are you sure you want to delete the \
2052 query type $n ?" -aspect 300
2053 pack $w.top.warning $w.top.quest -side left -expand yes -padx 10 -pady 5
2054 bottom-buttons $w [list {Ok} [list query-delete-action $queryNo] \
2055 {Cancel} [list destroy $w]] 1
2058 proc cascade-query-list {} {
2060 set w .top.options.m.query
2063 $w.slist delete 0 last
2064 foreach n $queryTypes {
2065 $w.slist add command -label $n -command [list query-setup $i]
2070 $w.clist delete 0 last
2071 foreach n $queryTypes {
2072 $w.clist add command -label $n -command [list query-select $i]
2076 $w.dlist delete 0 last
2077 foreach n $queryTypes {
2078 $w.dlist add command -label $n -command [list query-delete $i]
2083 proc save-geometry {} {
2084 global windowGeometry
2087 global displayFormat
2091 set windowGeometry(.) [wm geometry .]
2093 if {[catch {set f [open ~/.clientrc.tcl w]}]} {
2096 puts $f "set hotTargets \{ $hotTargets \}"
2097 puts $f "set textWrap $textWrap"
2098 puts $f "set displayFormat $displayFormat"
2099 puts $f "set popupMarcdf $popupMarcdf"
2100 puts $f "set recordSyntax $recordSyntax"
2101 foreach n [array names windowGeometry] {
2102 puts -nonewline $f "set \{windowGeometry($n)\} \{"
2103 puts -nonewline $f $windowGeometry($n)
2109 proc save-settings {} {
2112 global settingsChanged
2117 if {![file writable "${libdir}/clientrc.tcl"]} {
2118 set a [alert "Cannot open ${libdir}/clientrc.tcl for writing. Do you \
2119 wish to save clientrc.tcl in the current directory instead?"]
2123 set f [open "clientrc.tcl" w]
2125 set f [open "${libdir}/clientrc.tcl" w]
2127 puts $f "# Setup file"
2129 foreach n [array names profile] {
2130 puts -nonewline $f "set \{profile($n)\} \{"
2131 puts -nonewline $f $profile($n)
2134 puts -nonewline $f "set queryTypes \{"
2135 puts -nonewline $f $queryTypes
2138 puts -nonewline $f "set queryButtons \{"
2139 puts -nonewline $f $queryButtons
2142 puts -nonewline $f "set queryInfo \{"
2143 puts -nonewline $f $queryInfo
2146 set settingsChanged 0
2155 set oldFocus [focus]
2159 label $w.top.warning -bitmap warning
2160 message $w.top.message -text $ask -aspect 300 \
2161 -font -Adobe-Times-Medium-R-Normal-*-180-*
2163 pack $w.top.warning $w.top.message -side left -pady 5 -padx 10 -expand yes
2166 top-down-ok-cancel $w {alert-action} 1
2171 proc alert-action {} {
2177 proc exit-action {} {
2178 global settingsChanged
2180 if {$settingsChanged} {
2181 set a [alert "you haven't saved your settings. Do you wish to save?"]
2190 proc listbuttonaction {w name h user i} {
2191 $w configure -text [lindex $name 0]
2192 $h [lindex $name 1] $user $i
2195 proc listbuttonx {button no names handle user} {
2196 if {[winfo exists $button]} {
2197 $button configure -text [lindex [lindex $names $no] 0]
2198 ${button}.m delete 0 last
2200 menubutton $button -text [lindex [lindex $names $no] 0] \
2201 -width 10 -menu ${button}.m -relief raised -border 1
2205 foreach name $names {
2206 ${button}.m add command -label [lindex $name 0] \
2207 -command [list listbuttonaction ${button} $name \
2213 proc listbutton {button no names} {
2214 menubutton $button -text [lindex $names $no] -width 10 -menu ${button}.m \
2215 -relief raised -border 1
2217 foreach name $names {
2218 ${button}.m add command -label $name \
2219 -command [list ${button} configure -text $name]
2223 proc listbuttonv-action {button var names i} {
2226 set $var [lindex $names [expr $i+1]]
2227 $button configure -text [lindex $names $i]
2230 proc listbuttonv {button var names} {
2234 eval "set val $$var"
2235 set l [llength $names]
2236 for {set i 1} {$i < $l} {incr i 2} {
2237 if {$val == [lindex $names $i]} {
2239 set n [lindex $names $i]
2243 if {[winfo exists $button]} {
2244 $button configure -text $n
2247 menubutton $button -text $n -menu ${button}.m \
2248 -relief raised -border 1
2250 for {set i 0} {$i < $l} {incr i 2} {
2251 ${button}.m add command -label [lindex $names $i] \
2252 -command [list listbuttonv-action $button $var $names $i]
2256 proc query-add-index-action {queryNo} {
2260 global queryButtonsTmp
2262 set newI [.query-add-index.top.index.entry get]
2263 lappend queryInfoTmp [list $newI {}]
2264 $w.top.index.list insert end $newI
2265 destroy .query-add-index
2266 #destroy $w.top.lines
2267 #frame $w.top.lines -relief ridge -border 2
2268 index-lines $w.top.lines 0 $queryButtonsTmp $queryInfoTmp activate-e-index
2269 #pack $w.top.lines -side left -pady 6 -padx 6 -fill y
2272 proc query-add-line {queryNo} {
2276 global queryButtonsTmp
2278 lappend queryButtonsTmp {I 0}
2280 #destroy $w.top.lines
2281 #frame $w.top.lines -relief ridge -border 2
2282 index-lines $w.top.lines 0 $queryButtonsTmp $queryInfoTmp activate-e-index
2283 #pack $w.top.lines -side left -pady 6 -padx 6 -fill y
2286 proc query-del-line {queryNo} {
2290 global queryButtonsTmp
2292 set l [llength $queryButtonsTmp]
2297 set queryButtonsTmp [lreplace $queryButtonsTmp $l $l]
2298 index-lines $w.top.lines 0 $queryButtonsTmp $queryInfoTmp activate-e-index
2301 proc query-add-index {queryNo} {
2302 set w .query-add-index
2305 set oldFocus [focus]
2306 place-force $w .query-setup
2310 -side top -anchor e -pady 2
2311 entry-fields $w.top {index} \
2313 [list query-add-index-action $queryNo] [list destroy $w]
2314 top-down-ok-cancel $w [list query-add-index-action $queryNo] 1
2318 proc query-setup-action {queryNo} {
2321 global queryButtonsTmp
2323 global queryButtonsFind
2324 global queryInfoFind
2326 global settingsChanged
2328 set settingsChanged 1
2330 set queryInfo [lreplace $queryInfo $queryNo $queryNo \
2332 set queryButtons [lreplace $queryButtons $queryNo $queryNo \
2334 set queryInfoFind $queryInfoTmp
2335 set queryButtonsFind $queryButtonsTmp
2337 destroy .query-setup
2338 index-lines .lines 1 $queryButtonsFind $queryInfoFind activate-index
2341 proc activate-e-index {value no i} {
2342 global queryButtonsTmp
2343 global queryIndexTmp
2345 set queryButtonsTmp [lreplace $queryButtonsTmp $no $no [list I $i]]
2346 dputs $queryButtonsTmp
2347 set queryIndexTmp $i
2350 proc activate-index {value no i} {
2351 global queryButtonsFind
2353 set queryButtonsFind [lreplace $queryButtonsFind $no $no [list I $i]]
2355 dputs "queryButtonsFind $queryButtonsFind"
2358 proc update-attr {} {
2360 listbuttonv $w.top.relation.b relationTmpValue\
2361 {{None} 0 {Less than} 1 {Greater than or equal} 2 {Equal} 3 \
2362 {Greater than or equal} 4 {Greater than} 5 {Not equal} 6 \
2363 {Phonetic} 100 {Stem} 101 {Relevance} 102 {AlwaysMatches} 103}
2364 listbuttonv $w.top.position.b positionTmpValue {{None} 0 \
2365 {First in field} 1 {First in subfield} 2 {Any position in field} 3}
2366 listbuttonv $w.top.structure.b structureTmpValue {{None} 0 {Phrase} 1 \
2367 {Word} 2 {Key} 3 {Year} 4 {Date (norm)} 5 {Word list} 6 \
2368 {Date (un-norm)} 100 {Name (norm)} 101 {Date (un-norm)} 102 \
2369 {Structure} 103 {urx} 104 {free-form} 105 {doc-text} 106 \
2370 {local-number} 107 {string} 108 {numeric string} 109}
2371 listbuttonv $w.top.truncation.b truncationTmpValue {{Auto} 0 {Right} 1 \
2372 {Left} 2 {Left and right} 3 {No truncation} 100 \
2373 {Process #} 101 {Re-1} 102 {Re-2} 103}
2374 listbuttonv $w.top.completeness.b completenessTmpValue {{None} 0 \
2375 {Incomplete subfield} 1 {Complete subfield} 2 {Complete field} 3}
2378 proc use-attr {init} {
2390 {BNB card number} 10
2391 {BGF(sic) number} 11
2393 {Dewey classification} 13
2394 {UDC classification} 14
2395 {Bliss classification} 15
2397 {NLM call number} 17
2398 {NAL call number} 18
2399 {MOS call number} 19
2400 {Local classification} 20
2401 {Subject heading} 21
2403 {BDI-index-subject} 23
2407 {LC-subject-heading} 27
2408 {RVM-subject-heading} 28
2409 {Local subject index} 29
2411 {Date of publication} 31
2412 {Date of acquisition} 32
2414 {Title-collective} 34
2417 {Title-added-title-page} 37
2421 {Title-other-variant} 41
2423 {Title-abbreviated} 43
2427 {Subject-subdivision} 47
2428 {Number-natl-bibliography} 48
2429 {Number-legal-deposit} 49
2430 {Number-govt-publication} 50
2431 {Number-publisher-for-music} 51
2433 {Number-local-call} 53
2435 {Code-geographic-area} 55
2436 {Code-institution} 56
2438 {Name-geographic} 58
2439 {Place-publication} 59
2441 {Microform-generation} 61
2448 {Author-name-personal} 1004
2449 {Author-name-corporate} 1005
2450 {Author-name-conference} 1006
2451 {Identifier-standard} 1007
2452 {Subject-LC-children's} 1008
2453 {Subject-name-personal} 1009
2455 {Date/time added to database} 1011
2456 {Date/time last modified} 1012
2457 {Authority/format identifier} 1013
2459 {Concept-reference} 1015
2461 {Server choice} 1017
2463 {Record source} 1019
2466 {Geographic class} 1022
2470 {Related periodical} 1026
2471 {Report number} 1027
2473 {Thematic number} 1030
2474 {Material type} 1031
2482 set l [llength $attr]
2487 for {set i 0} {$i < $l} {incr i} {
2488 $w.top.use.list insert end [lindex $attr $i]
2490 if {$useTmpValue == [lindex $attr $i]} {
2496 $w.top.use.list selection clear 0 end
2497 $w.top.use.list selection set $s $s
2499 $w.top.use.list select from $s
2500 $w.top.use.list select to $s
2506 $w.top.use.list yview $s
2508 set lno [lindex [$w.top.use.list curselection] 0]
2509 set i [expr $lno+$lno+1]
2510 set useTmpValue [lindex $attr $i]
2511 dputs "useTmpValue=$useTmpValue"
2515 proc index-setup-action {oldAttr queryNo indexNo} {
2516 set attr [lindex $oldAttr 0]
2519 global relationTmpValue
2520 global structureTmpValue
2521 global truncationTmpValue
2522 global completenessTmpValue
2523 global positionTmpValue
2528 dputs "index-setup-action"
2529 dputs "queryNo $queryNo"
2530 dputs "indexNo $indexNo"
2531 if {$useTmpValue > 0} {
2532 lappend attr "1=$useTmpValue"
2534 if {$relationTmpValue > 0} {
2535 lappend attr "2=$relationTmpValue"
2537 if {$positionTmpValue > 0} {
2538 lappend attr "3=$positionTmpValue"
2540 if {$structureTmpValue > 0} {
2541 lappend attr "4=$structureTmpValue"
2543 if {$truncationTmpValue > 0} {
2544 lappend attr "5=$truncationTmpValue"
2546 if {$completenessTmpValue > 0} {
2547 lappend attr "6=$completenessTmpValue"
2549 dputs "new attr $attr"
2550 set queryInfoTmp [lreplace $queryInfoTmp $indexNo $indexNo $attr]
2551 destroy .index-setup
2554 proc index-setup {attr queryNo indexNo} {
2557 global relationTmpValue
2558 global structureTmpValue
2559 global truncationTmpValue
2560 global completenessTmpValue
2561 global positionTmpValue
2563 set relationTmpValue 0
2564 set truncationTmpValue 0
2565 set structureTmpValue 0
2566 set positionTmpValue 0
2567 set completenessTmpValue 0
2570 set len [llength $attr]
2571 for {set i 1} {$i < $len} {incr i} {
2572 set q [lindex $attr $i]
2573 set l [string first = $q]
2575 set t [string range $q 0 [expr $l - 1]]
2576 set v [string range $q [expr $l + 1] end]
2579 { set useTmpValue $v }
2581 { set relationTmpValue $v }
2583 { set positionTmpValue $v }
2585 { set structureTmpValue $v }
2587 { set truncationTmpValue $v }
2589 { set completenessTmpValue $v }
2593 if {[winfo exists $w]} {
2598 set n [lindex $attr 0]
2599 wm title $w "Index setup $n"
2603 frame $w.top.use -relief ridge -border 2
2604 frame $w.top.relation -relief ridge -border 2
2605 frame $w.top.position -relief ridge -border 2
2606 frame $w.top.structure -relief ridge -border 2
2607 frame $w.top.truncation -relief ridge -border 2
2608 frame $w.top.completeness -relief ridge -border 2
2614 pack $w.top.use -side left -pady 6 -padx 6 -fill y
2616 label $w.top.use.label -text "Use"
2618 listbox $w.top.use.list -width 26 \
2619 -yscrollcommand "$w.top.use.scroll set"
2621 listbox $w.top.use.list -geometry 26x10 \
2622 -yscrollcommand "$w.top.use.scroll set"
2624 scrollbar $w.top.use.scroll -orient vertical -border 1
2625 pack $w.top.use.label -side top -fill x \
2627 pack $w.top.use.list -side left -fill both -expand yes \
2629 pack $w.top.use.scroll -side right -fill y \
2631 $w.top.use.scroll config -command "$w.top.use.list yview"
2635 # Relation Attributes
2637 pack $w.top.relation -pady 6 -padx 6 -side top
2638 label $w.top.relation.label -text "Relation" -width 18
2640 pack $w.top.relation.label $w.top.relation.b -fill x
2642 # Position Attributes
2644 pack $w.top.position -pady 6 -padx 6 -side top
2645 label $w.top.position.label -text "Position" -width 18
2647 pack $w.top.position.label $w.top.position.b -fill x
2649 # Structure Attributes
2651 pack $w.top.structure -pady 6 -padx 6 -side top
2652 label $w.top.structure.label -text "Structure" -width 18
2654 pack $w.top.structure.label $w.top.structure.b -fill x
2656 # Truncation Attributes
2658 pack $w.top.truncation -pady 6 -padx 6 -side top
2659 label $w.top.truncation.label -text "Truncation" -width 18
2661 pack $w.top.truncation.label $w.top.truncation.b -fill x
2663 # Completeness Attributes
2665 pack $w.top.completeness -pady 6 -padx 6 -side top
2666 label $w.top.completeness.label -text "Completeness" -width 18
2668 pack $w.top.completeness.label $w.top.completeness.b -fill x
2671 bottom-buttons $w [list \
2672 {Ok} [list index-setup-action $attr $queryNo $indexNo] \
2673 {Cancel} [list destroy $w]] 0
2677 proc query-edit-index {queryNo} {
2681 set i [lindex [$w.top.index.list curselection] 0]
2685 set attr [lindex $queryInfoTmp $i]
2686 dputs "Editing no $i $attr"
2687 index-setup $attr $queryNo $i
2690 proc query-delete-index {queryNo} {
2692 global queryButtonsTmp
2695 set i [lindex [$w.top.index.list curselection] 0]
2699 set queryInfoTmp [lreplace $queryInfoTmp $i $i]
2700 index-lines $w.top.lines 0 $queryButtonsTmp $queryInfoTmp activate-e-index
2701 $w.top.index.list delete $i
2704 proc query-setup {queryNo} {
2710 global queryButtonsTmp
2712 global queryIndexTmp
2715 set queryName [lindex $queryTypes $queryNo]
2716 set queryInfoTmp [lindex $queryInfo $queryNo]
2717 set queryButtonsTmp [lindex $queryButtons $queryNo]
2722 wm title $w "Query setup $queryName"
2726 frame $w.top.lines -relief ridge -border 2
2728 pack $w.top.lines -side left -pady 6 -padx 6 -fill y
2732 index-lines $w.top.lines 0 $queryButtonsTmp $queryInfoTmp activate-e-index
2734 button $w.top.lines.add -text "Add" \
2735 -command [list query-add-line $queryNo]
2736 button $w.top.lines.del -text "Remove" \
2737 -command [list query-del-line $queryNo]
2739 pack $w.top.lines.del -fill x -side bottom
2740 pack $w.top.lines.add -fill x -pady 10 -side bottom
2744 frame $w.top.index -relief ridge -border 2
2745 pack $w.top.index -pady 6 -padx 6 -side right -fill y
2747 listbox $w.top.index.list -yscrollcommand [list $w.top.index.scroll set]
2748 scrollbar $w.top.index.scroll -orient vertical -border 1 \
2749 -command [list $w.top.index.list yview]
2750 bind $w.top.index.list <2> [list query-edit-index $queryNo]
2752 pack $w.top.index.list -side left -fill both -expand yes -padx 2 -pady 2
2753 pack $w.top.index.scroll -side right -fill y -padx 2 -pady 2
2756 $w.top.index.list selection clear 0 end
2757 $w.top.index.list selection set 0 0
2759 $w.top.index.list select from 0
2760 $w.top.index.list select to 0
2763 foreach x $queryInfoTmp {
2764 $w.top.index.list insert end [lindex $x 0]
2767 bottom-buttons $w [list \
2768 {Ok} [list query-setup-action $queryNo] \
2769 {Add index} [list query-add-index $queryNo] \
2770 {Edit index} [list query-edit-index $queryNo] \
2771 {Delete index} [list query-delete-index $queryNo] \
2772 {Cancel} [list destroy $w]] 0
2775 proc index-clear {} {
2776 global queryButtonsFind
2779 foreach b $queryButtonsFind {
2780 .lines.$i.e delete 0 end
2785 proc index-query {} {
2786 global queryButtonsFind
2787 global queryInfoFind
2792 foreach b $queryButtonsFind {
2793 set term [string trim [.lines.$i.e get]]
2795 set attr [lrange [lindex $queryInfoFind [lindex $b 1]] 1 end]
2797 set len [string length $term]
2801 if {[string index $term $len] == "?"} {
2803 set term [string range $term 0 [expr $len - 1]]
2805 if {[string index $term 0] == "?"} {
2807 set term [string range $term 1 end]
2809 set term "\{${term}\}"
2810 if {$right && $left} {
2811 set term "@attr 5=3 ${term}"
2813 set term "@attr 5=1 ${term}"
2815 set term "@attr 5=2 ${term}"
2818 set term "@attr $a ${term}"
2821 set qs "@and ${qs} ${term}"
2832 proc index-focus-in {w i} {
2833 global curIndexEntry
2836 $w.$i configure -background red
2838 set curIndexEntry $i
2841 proc index-lines {w realOp buttonInfo queryInfo handle} {
2843 foreach b $buttonInfo {
2844 if {! [winfo exists $w.$i]} {
2846 frame $w.$i -border 0
2848 frame $w.$i -background white -border 1
2851 listbuttonx $w.$i.l [lindex $b 1] $queryInfo $handle $i
2854 if {! [winfo exists $w.$i.e]} {
2855 entry $w.$i.e -width 32 -relief sunken -border 1
2856 bind $w.$i.e <FocusIn> [list index-focus-in $w $i]
2857 bind $w.$i.e <FocusOut> [list $w.$i configure \
2859 pack $w.$i.l -side left
2860 pack $w.$i.e -side left -fill x -expand yes
2861 pack $w.$i -side top -fill x -padx 2 -pady 2
2863 bind $w.$i.e <Left> [list left-cursor $w.$i.e]
2864 bind $w.$i.e <Right> [list right-cursor $w.$i.e]
2866 bind $w.$i.e <Return> {search-request 0}
2869 pack $w.$i.l -side left
2870 pack $w.$i -side top -fill x -padx 2 -pady 2
2875 while {[winfo exists $w.$j]} {
2887 bind $w.$j.e <Tab> "focus $w.$k.e"
2893 bind $w.$i.e <Tab> "focus $w.0.e"
2899 proc search-fields {w buttondefs} {
2901 foreach buttondef $buttondefs {
2902 frame $w.$i -background white
2904 listbutton $w.$i.l 0 $buttondef
2905 entry $w.$i.e -width 32 -relief sunken
2907 pack $w.$i.l -side left
2908 pack $w.$i.e -side left -fill x -expand yes
2910 pack $w.$i -side top -fill x -padx 2 -pady 2
2912 bind $w.$i.e <Left> [list left-cursor $w.$i.e]
2913 bind $w.$i.e <Right> [list right-cursor $w.$i.e]
2921 bind $w.$j.e <Tab> "focus $w.$k.e \n
2922 $w.$k configure -background red \n
2923 $w.$j configure -background white"
2926 bind $w.$i.e <Tab> "focus $w.0.e \n
2927 $w.0 configure -background red \n
2928 $w.$i configure -background white"
2930 $w.0 configure -background red
2933 if {[info exists windowGeometry(.)]} {
2934 set g $windowGeometry(.)
2942 frame .top -border 1 -relief raised
2943 frame .lines -border 1 -relief raised
2944 frame .mid -border 1 -relief raised
2945 frame .data -border 1 -relief raised
2946 frame .bot -border 1 -relief raised
2947 pack .top .lines .mid -side top -fill x
2948 pack .data -side top -fill both -expand yes
2951 menubutton .top.file -text "File" -menu .top.file.m
2953 .top.file.m add command -label "Save settings" -command {save-settings}
2954 .top.file.m add separator
2955 .top.file.m add command -label "Exit" -command {exit-action}
2957 menubutton .top.target -text "Target" -menu .top.target.m
2959 .top.target.m add cascade -label "Connect" -menu .top.target.m.clist
2960 .top.target.m add command -label "Disconnect" -command {close-target}
2961 .top.target.m add command -label "About" -command {about-target}
2962 .top.target.m add cascade -label "Setup" -menu .top.target.m.slist
2963 .top.target.m add command -label "Setup new" -command {define-target-dialog}
2964 .top.target.m add separator
2965 set-target-hotlist 0
2967 configure-disable-e .top.target.m 1
2968 configure-disable-e .top.target.m 2
2970 menu .top.target.m.clist
2971 menu .top.target.m.slist
2974 menubutton .top.service -text "Service" -menu .top.service.m
2976 .top.service.m add command -label "Database" -command {database-select}
2977 .top.service.m add cascade -label "Present" -menu .top.service.m.present
2978 menu .top.service.m.present
2979 .top.service.m.present add command -label "10 More" \
2980 -command [list present-more 10]
2981 .top.service.m.present add command -label "All" \
2982 -command [list present-more {}]
2983 .top.service.m add command -label "Search" -command {search-request 0}
2984 .top.service.m add command -label "Scan" -command {scan-request}
2986 .top.service configure -state disabled
2988 menubutton .top.rset -text "Set" -menu .top.rset.m
2990 .top.rset.m add command -label "Load" -command {load-set}
2991 .top.rset.m add separator
2993 menubutton .top.options -text "Options" -menu .top.options.m
2995 .top.options.m add cascade -label "Query" -menu .top.options.m.query
2996 .top.options.m add cascade -label "Format" -menu .top.options.m.formats
2997 .top.options.m add cascade -label "Wrap" -menu .top.options.m.wrap
2998 .top.options.m add cascade -label "Syntax" -menu .top.options.m.syntax
3000 menu .top.options.m.query
3001 .top.options.m.query add cascade -label "Select" \
3002 -menu .top.options.m.query.clist
3003 .top.options.m.query add cascade -label "Edit" \
3004 -menu .top.options.m.query.slist
3005 .top.options.m.query add command -label "New" \
3006 -command {query-new}
3007 .top.options.m.query add cascade -label "Delete" \
3008 -menu .top.options.m.query.dlist
3010 menu .top.options.m.query.slist
3011 menu .top.options.m.query.clist
3012 menu .top.options.m.query.dlist
3015 menu .top.options.m.formats
3017 foreach f $displayFormats {
3018 .top.options.m.formats add radiobutton -label $f -value $i \
3019 -command [list set-display-format $i] -variable displayFormat
3023 menu .top.options.m.wrap
3024 .top.options.m.wrap add radiobutton -label "Character" \
3025 -value char -variable textWrap -command {set-wrap char}
3026 .top.options.m.wrap add radiobutton -label "Word" \
3027 -value word -variable textWrap -command {set-wrap word}
3028 .top.options.m.wrap add radiobutton -label "None" \
3029 -value none -variable textWrap -command {set-wrap none}
3031 menu .top.options.m.syntax
3032 .top.options.m.syntax add radiobutton -label "None" \
3033 -value None -variable recordSyntax
3034 .top.options.m.syntax add separator
3035 .top.options.m.syntax add radiobutton -label "USMARC" \
3036 -value USMARC -variable recordSyntax
3037 .top.options.m.syntax add radiobutton -label "UNIMARC" \
3038 -value UNIMARC -variable recordSyntax
3039 .top.options.m.syntax add radiobutton -label "UKMARC" \
3040 -value UKMARC -variable recordSyntax
3041 .top.options.m.syntax add radiobutton -label "DANMARC" \
3042 -value DANMARC -variable recordSyntax
3043 .top.options.m.syntax add radiobutton -label "FINMARC" \
3044 -value FINMARC -variable recordSyntax
3045 .top.options.m.syntax add radiobutton -label "NORMARC" \
3046 -value NORMARC -variable recordSyntax
3047 .top.options.m.syntax add radiobutton -label "PICAMARC" \
3048 -value PICAMARC -variable recordSyntax
3049 .top.options.m.syntax add separator
3050 .top.options.m.syntax add radiobutton -label "SUTRS" \
3051 -value SUTRS -variable recordSyntax
3052 .top.options.m.syntax add separator
3053 .top.options.m.syntax add radiobutton -label "GRS1" \
3054 -value GRS1 -variable recordSyntax
3056 menubutton .top.help -text "Help" -menu .top.help.m
3059 .top.help.m add command -label "Help on help" \
3060 -command {tkerror "Help on help not available. Sorry"}
3061 .top.help.m add command -label "About" -command {about-origin}
3063 pack .top.file .top.target .top.service .top.rset .top.options -side left
3064 pack .top.help -side right
3066 index-lines .lines 1 $queryButtonsFind [lindex $queryInfo 0] activate-index
3068 button .mid.search -text Search -command {search-request 0} \
3070 button .mid.scan -text Scan \
3071 -command scan-request -state disabled
3072 button .mid.present -text {Present} -command [list present-more 10] \
3075 button .mid.clear -text Clear -command index-clear
3076 pack .mid.search .mid.scan .mid.present .mid.clear -side left \
3079 text .data.record -height 2 -width 20 -wrap none \
3080 -yscrollcommand [list .data.scroll set] -wrap $textWrap
3081 scrollbar .data.scroll -command [list .data.record yview]
3083 .data.record configure -takefocus 0
3084 .data.scroll configure -takefocus 0
3086 pack .data.scroll -side right -fill y
3087 pack .data.record -expand yes -fill both
3091 .data.record tag configure marc-tag -foreground blue
3092 .data.record tag configure marc-id -foreground red
3094 .data.record tag configure marc-tag -foreground black
3095 .data.record tag configure marc-id -foreground black
3097 .data.record tag configure marc-data -foreground black
3099 button .bot.logo -bitmap @${libdir}/bitmaps/book1 -command cancel-operation
3101 .bot.logo configure -takefocus 0
3104 pack .bot.a -side left -fill x
3105 pack .bot.logo -side right -padx 2 -pady 2 -ipadx 1
3107 message .bot.a.target -text "" -aspect 1000 -border 1
3109 label .bot.a.status -text "Not connected" -width 15 -relief \
3110 sunken -anchor w -border 1
3111 label .bot.a.set -text "" -width 5 -relief \
3112 sunken -anchor w -border 1
3113 label .bot.a.message -text "" -width 15 -relief \
3114 sunken -anchor w -border 1
3116 pack .bot.a.target -side top -anchor nw -padx 2 -pady 2
3117 pack .bot.a.status .bot.a.set .bot.a.message \
3118 -side left -padx 2 -pady 2 -ipadx 1 -ipady 1
3120 if {[catch {ir z39}]} {
3121 set e [info sharedlibextension]
3122 puts -nonewline "Loading irtcl..."