1 # IR toolkit for tcl/tk
3 # See the file LICENSE for details.
4 # Sebastian Hammer, Adam Dickmeiss
7 # Revision 1.60 1995-06-30 16:30:19 adam
10 # Revision 1.59 1995/06/29 14:06:25 adam
11 # Another bug in install fixed. Configure searches for more versions of yaz.
13 # Revision 1.58 1995/06/29 12:34:06 adam
14 # IrTcl now works with both tk4.0b4/tcl7.4b4 and tk3.6/tcl7.3
16 # Revision 1.57 1995/06/29 09:20:30 adam
17 # Target entries in cascade menus are sorted.
19 # Revision 1.56 1995/06/27 19:03:48 adam
20 # Bug fix in do_present in ir-tcl.c: p->set_child member weren't set.
21 # nextResultSetPosition used instead of setOffset.
23 # Revision 1.55 1995/06/27 17:10:37 adam
24 # Bug fix: install procedure didn't work on some systems.
25 # Error turned up when clientrc.tcl was't present.
27 # Revision 1.54 1995/06/27 14:41:03 adam
28 # Bug fix in search-response. Didn't always observe non-surrogate diagnostics.
30 # Revision 1.53 1995/06/26 12:40:09 adam
31 # Client defines its own tkerror.
32 # User may specify 'no preferredRecordSyntax'.
34 # Revision 1.52 1995/06/22 13:14:59 adam
35 # Feature: SUTRS. Setting getSutrs implemented.
36 # Work on display formats.
37 # Preferred record syntax can be set by the user.
39 # Revision 1.51 1995/06/21 11:11:00 adam
40 # Bug fix: libdir undefined in about-origin.
42 # Revision 1.50 1995/06/21 11:04:48 adam
43 # Uses GNU autoconf 2.3.
44 # Install procedure implemented.
45 # boook bitmaps moved to sub directory bitmaps.
47 # Revision 1.49 1995/06/20 14:16:42 adam
48 # More work on cancel mechanism.
50 # Revision 1.48 1995/06/20 08:07:23 adam
51 # New setting: failInfo.
52 # Working on better cancel mechanism.
54 # Revision 1.47 1995/06/19 14:05:29 adam
55 # Bug fix: asked for SUTRS.
57 # Revision 1.46 1995/06/19 13:06:06 adam
58 # New define: IR_TCL_VERSION.
60 # Revision 1.45 1995/06/19 08:08:44 adam
61 # client.tcl: hotTargets now contain both database and target name.
62 # ir-tcl.c: setting protocol edited. Errors in callbacks are logged
63 # by logf(LOG_WARN, ...) calls.
65 # Revision 1.44 1995/06/16 14:55:18 adam
68 # Revision 1.43 1995/06/16 14:41:05 adam
69 # Scan line entries can be copied to a search entry.
71 # Revision 1.42 1995/06/16 12:28:13 adam
72 # Implemented preferredRecordSyntax.
73 # Minor changes in diagnostic handling.
74 # Record list deleted when connection closes.
76 # Revision 1.41 1995/06/14 15:07:59 adam
77 # Bug fix in cascade-target-list. Uses yaz-version.h.
79 # Revision 1.40 1995/06/14 13:37:17 adam
80 # Setting recordType implemented.
81 # Setting implementationVersion implemented.
82 # Settings implementationId / implementationName edited.
84 # Revision 1.39 1995/06/14 12:16:22 adam
85 # hotTargets, textWrap and displayFormat saved in clientg.tcl.
87 # Revision 1.38 1995/06/14 07:22:45 adam
88 # Target definitions can be deleted.
89 # Listbox used in the query definition dialog.
91 # Revision 1.37 1995/06/13 14:37:59 adam
92 # Work on query setup.
93 # Better about origin/target.
94 # Better presentation formats.
96 # Revision 1.36 1995/06/13 07:42:14 adam
97 # Bindings removed from text widgets.
99 # Revision 1.35 1995/06/12 15:17:31 adam
100 # Text widget used in main window (instead of listbox) to support
101 # better presentation formats.
103 # Revision 1.34 1995/06/12 07:59:07 adam
104 # More work on geometry handling.
106 # Revision 1.33 1995/06/09 11:17:35 adam
107 # Start work on geometry management.
109 # Revision 1.32 1995/06/07 09:16:37 adam
110 # New presentation format.
112 # Revision 1.31 1995/06/06 16:31:09 adam
113 # Bug fix: target names couldn't contain blanks.
116 # Revision 1.30 1995/06/06 11:35:41 adam
117 # Work on scan. Display of old sets.
119 # Revision 1.29 1995/06/05 14:11:18 adam
120 # Bug fix in present-more.
122 # Revision 1.28 1995/06/02 14:52:13 adam
123 # Minor changes really.
125 # Revision 1.27 1995/06/02 14:29:42 adam
126 # Work on scan interface - up/down buttons.
128 # Revision 1.26 1995/06/01 16:36:46 adam
129 # About buttons. Minor bug fixes.
131 # Revision 1.25 1995/05/31 13:09:57 adam
132 # Client searches/presents may be interrupted.
133 # New moving book-logo.
135 # Revision 1.24 1995/05/31 08:36:24 adam
136 # Bug fix in client.tcl: didn't save options on clientrc.tcl.
137 # New method: referenceId. More work on scan.
139 # Revision 1.23 1995/05/29 10:33:41 adam
140 # README and rename of startup script.
142 # Revision 1.22 1995/05/26 11:44:09 adam
143 # Bugs fixed. More work on MARC utilities and queries. Test
144 # client is up-to-date again.
146 # Revision 1.21 1995/05/11 15:34:46 adam
147 # Scan request changed a bit. This version works with RLG.
149 # Revision 1.20 1995/04/21 16:31:57 adam
150 # New radiobutton: protocol (z39v2/SR).
152 # Revision 1.19 1995/04/18 16:11:50 adam
153 # First version of graphical Scan. Some work on query-by-form.
155 # Revision 1.18 1995/04/10 10:50:22 adam
156 # Result-set name defaults to suffix of ir-set name.
157 # Started working on scan. Not finished at this point.
159 # Revision 1.17 1995/03/31 09:34:57 adam
160 # Search-button disabled when there is no connection.
162 # Revision 1.16 1995/03/31 08:56:36 adam
163 # New button "Search".
165 # Revision 1.15 1995/03/28 12:45:22 adam
166 # New ir method failback: called on disconnect/protocol error.
167 # New ir set/get method: protocol: SR / Z3950.
168 # Simple popup and disconnect when failback is invoked.
170 # Revision 1.14 1995/03/22 16:07:55 adam
173 # Revision 1.13 1995/03/21 17:27:26 adam
174 # Short-hand keys in setup.
176 # Revision 1.12 1995/03/21 13:41:03 adam
177 # Comstack cs_create not used too often. Non-blocking connect.
179 # Revision 1.11 1995/03/21 10:39:06 adam
180 # Diagnostic error message displayed with tkerror.
182 # Revision 1.10 1995/03/20 15:24:06 adam
183 # Diagnostic records saved on searchResponse.
185 # Revision 1.9 1995/03/17 18:26:16 adam
186 # Non-blocking i/o used now. Database names popup as cascade items.
188 # Revision 1.8 1995/03/17 15:45:00 adam
189 # Improved target/database setup.
191 # Revision 1.7 1995/03/16 17:54:03 adam
192 # Minor changes really.
194 # Revision 1.6 1995/03/15 19:10:20 adam
195 # Database setup in protocol-setup (rather target setup).
197 # Revision 1.5 1995/03/15 13:59:23 adam
200 # Revision 1.4 1995/03/14 17:32:29 adam
201 # Presentation of full Marc record in popup window.
203 # Revision 1.3 1995/03/12 19:31:52 adam
204 # Pattern matching implemented when retrieving MARC records. More
205 # diagnostic functions.
207 # Revision 1.2 1995/03/10 18:00:15 adam
208 # Actual presentation in line-by-line format. RPN query support.
210 # Revision 1.1 1995/03/09 16:15:07 adam
211 # First presentRequest attempts. Hot-target list.
215 if {$tk_version == "3.6"} {
222 proc configure-enable-e {w n} {
224 $w entryconfigure $n -state normal
226 proc configure-disable-e {w n} {
228 $w entryconfigure $n -state disabled
230 set noFocus [list -takefocus 0]
232 proc configure-enable-e {w n} {
235 proc configure-disable-e {w n} {
242 if {[tk colormodel .] == "color"} {
252 if {[file readable bitmaps/book2]} {
255 if {! [file readable ${libdir}/bitmaps/book2]} {
256 puts "Cannot locate system files in ${libdir}. You must either run this"
257 puts "program from the source directory root of ir-tcl or you must assure"
258 puts "that it is installed - normally in /usr/local/lib/irtcl"
266 set profile(Default) {{} {} {210} {} 16384 8192 tcpip {} 1 {} {} Z39 1}
268 set settingsChanged 0
277 set recordSyntax None
280 set queryTypes {Simple}
281 set queryButtons { { {I 0} {I 1} {I 2} } }
282 set queryInfo { { {Title {1=4 4=1}} {Author {1=1}} \
283 {Subject {1=21}} {Any {1=1016}} } }
292 if {[winfo exists $w]} {
301 label $w.top.b -bitmap error
302 message $w.top.t -aspect 300 -text "Error: $err" \
303 -font -Adobe-Helvetica-Bold-R-Normal-*-180-*
304 pack $w.top.b $w.top.t -side left -padx 10 -pady 10
306 bottom-buttons $w [list {Close} [list destroy $w]] 1
309 proc read-formats {} {
310 global displayFormats
312 set formats [glob -nocomplain ${libdir}/formats/*.tcl]
314 if {[file readable $f]} {
316 set l [string length $f]
317 set f [string range $f [string length "${libdir}/formats/"] \
319 lappend displayFormats $f
328 .data.record configure -wrap $m
335 proc set-display-format {f} {
345 .bot.a.status configure -text "Reformatting"
348 add-title-lines -1 10000 1
351 proc initBindings {} {
354 bind $w <Double-1> {}
355 bind $w <Triple-1> {}
356 bind $w <B1-Motion> {}
358 bind $w <Shift-B1-Motion> {}
360 bind $w <B2-Motion> {}
361 bind $w <Any-KeyPress> {}
363 bind $w <BackSpace> {}
365 bind $w <Control-h> {}
366 bind $w <Control-d> {}
367 bind $w <Control-v> {}
370 bind $w <B1-Motion> {}
371 bind $w <Shift-B1-Motion> {}
376 proc post-menu {wbutton wmenu} {
379 $wmenu post [winfo rootx $wbutton] \
380 [expr [winfo rooty $wbutton]+[winfo height $wbutton]]
385 global windowGeometry
386 set windowGeometry($w) [wm geometry $w]
389 global windowGeometry
392 if {[info exists windowGeometry($w)]} {
393 set g $windowGeometry($w)
398 bind $w <Destroy> [list destroyGW $w]
401 if {[file readable "clientrc.tcl"]} {
402 source "clientrc.tcl"
404 if {[file readable "${libdir}/clientrc.tcl"]} {
405 source "${libdir}/clientrc.tcl"
409 if {[file readable "~/.clientrc.tcl"]} {
410 source "~/.clientrc.tcl"
413 set queryButtonsFind [lindex $queryButtons 0]
414 set queryInfoFind [lindex $queryInfo 0]
416 proc top-down-window {w} {
417 frame $w.top -relief raised -border 1
418 frame $w.bot -relief raised -border 1
420 pack $w.top -side top -fill both -expand yes
421 pack $w.bot -fill both
424 proc top-down-ok-cancel {w ok-action g} {
425 frame $w.bot.left -relief sunken -border 1
426 pack $w.bot.left -side left -expand yes -ipadx 2 -ipady 2 -padx 5 -pady 5
427 button $w.bot.left.ok -width 6 -text {Ok} \
428 -command ${ok-action}
429 pack $w.bot.left.ok -expand yes -ipadx 2 -ipady 2 -padx 3 -pady 3
430 button $w.bot.cancel -width 6 -text {Cancel} \
431 -command [list destroy $w]
432 pack $w.bot.cancel -side left -expand yes
440 proc bottom-buttons {w buttonList g} {
442 set l [llength $buttonList]
444 frame $w.bot.$i -relief sunken -border 1
445 pack $w.bot.$i -side left -expand yes -padx 5 -pady 5
446 button $w.bot.$i.ok -text [lindex $buttonList $i] \
447 -command [lindex $buttonList [expr $i+1]]
448 pack $w.bot.$i.ok -expand yes -ipadx 3 -ipady 2 -padx 3 -pady 3 -side left
452 button $w.bot.$i -text [lindex $buttonList $i] \
453 -command [lindex $buttonList [expr $i+1]]
454 pack $w.bot.$i -expand yes -ipadx 2 -ipady 2 -padx 3 -pady 3 -side left
464 proc cancel-operation {} {
472 show-status Cancel 0 1
476 proc show-target {target base} {
480 .bot.a.target configure -text ""
484 .bot.a.target configure -text "$target"
486 .bot.a.target configure -text "$target - $base"
490 proc show-logo {v1} {
499 .bot.logo configure -bitmap @${libdir}/bitmaps/book${v1}
500 after 140 [list show-logo $v1]
504 .bot.logo configure -bitmap @${libdir}/bitmaps/book1
513 proc show-status {status b sb} {
520 .bot.a.status configure -text "$status"
522 if {$busy == 0} {set busy 1}
530 .top.service configure -state normal
531 .mid.search configure -state normal
533 .mid.scan configure -state normal
536 configure-disable-e .top.service.m 1
537 } elseif {[z39.$setNo nextResultSetPosition] > 0 &&
538 [z39.$setNo nextResultSetPosition] <= [z39.$setNo resultCount]} {
539 configure-enable-e .top.service.m 1
540 .mid.present configure -state normal
542 configure-disable-e .top.service.m 1
543 .mid.present configure -state disabled
545 if {[winfo exists .scan-window]} {
546 .scan-window.bot.2 configure -state normal
547 .scan-window.bot.4 configure -state normal
550 .top.service configure -state disabled
551 .mid.search configure -state disabled
552 .mid.scan configure -state disabled
553 .mid.present configure -state disabled
555 if {[winfo exists .scan-window]} {
556 .scan-window.bot.2 configure -state disabled
557 .scan-window.bot.4 configure -state disabled
562 proc show-message {msg} {
563 .bot.a.message configure -text "$msg"
566 proc insertWithTags {w text args} {
567 set start [$w index insert]
568 $w insert insert $text
569 foreach tag [$w tag names $start] {
570 $w tag remove $tag $start insert
573 $w tag add $i $start insert
577 proc popup-license {} {
582 wm title $w "License"
588 text $w.top.t -width 80 -height 10 -wrap word \
589 -yscrollcommand [list $w.top.s set]
590 scrollbar $w.top.s -command [list $w.top.t yview]
592 pack $w.top.s -side right -fill y
593 pack $w.top.t -expand yes -fill both
595 if {[file readable "${libdir}/LICENSE"]} {
596 set f [open "${libdir}/LICENSE" r]
597 while {[gets $f buf] != -1} {
598 $w.top.t insert end $buf
599 $w.top.t insert end "\n"
603 bottom-buttons $w [list {Close} [list destroy $w]] 1
606 proc about-target {} {
607 set w .about-target-w
612 wm title $w "About target"
616 frame $w.top.a -relief ridge -border 2
617 frame $w.top.p -relief ridge -border 2
619 pack $w.top.a $w.top.p -side top -fill x
621 label $w.top.a.about -text "About"
622 label $w.top.a.irtcl -text $hostid \
623 -font -Adobe-Helvetica-Bold-R-Normal-*-240-*
624 pack $w.top.a.about $w.top.a.irtcl -side top
626 set i [z39 targetImplementationName]
627 label $w.top.p.in -text "Implementation name: $i"
628 set i [z39 targetImplementationId]
629 label $w.top.p.ii -text "Implementation id: $i"
630 set i [z39 targetImplementationVersion]
631 label $w.top.p.iv -text "Implementation version: $i"
633 label $w.top.p.op -text "Protocol options: $i"
635 pack $w.top.p.in $w.top.p.ii $w.top.p.iv $w.top.p.op -side top -anchor nw
637 bottom-buttons $w [list {Close} [list destroy $w]] 1
640 proc about-origin-logo {n} {
642 set w .about-origin-w
643 if {![winfo exists $w]} {
650 $w.top.a.logo configure -bitmap @${libdir}/bitmaps/book$n
651 after 140 [list about-origin-logo $n]
654 proc about-origin {} {
655 set w .about-origin-w
658 if {[winfo exists $w]} {
663 wm title $w "About IrTcl"
667 frame $w.top.a -relief ridge -border 2
668 frame $w.top.p -relief ridge -border 2
670 pack $w.top.a $w.top.p -side top -fill x
672 label $w.top.a.irtcl -text "IrTcl" \
673 -font -Adobe-Helvetica-Bold-R-Normal-*-240-*
674 label $w.top.a.logo -bitmap @${libdir}/bitmaps/book1
675 pack $w.top.a.irtcl $w.top.a.logo -side left -expand yes
677 set i [z39 implementationName]
678 label $w.top.p.in -text "Implementation name: $i"
679 set i [z39 implementationId]
680 label $w.top.p.ii -text "Implementation id: $i"
681 set i [z39 implementationVersion]
682 label $w.top.p.iv -text "Implementation version: $i"
684 pack $w.top.p.in $w.top.p.ii $w.top.p.iv -side top -anchor nw
687 bottom-buttons $w [list {Close} [list destroy $w] \
688 {License} [list popup-license]] 0
691 proc popup-marc {sno no b df} {
693 global displayFormats
696 if {[z39.$sno type $no] != "DB"} {
700 set w .full-marc-$fullMarcSeq
707 if {[winfo exists $w]} {
715 frame $w.top -relief raised -border 1
716 frame $w.bot -relief raised -border 1
718 pack $w.top -side top -fill both -expand yes
719 pack $w.bot -fill both
721 text $w.top.record -width 60 -height 5 -wrap word \
722 -yscrollcommand [list $w.top.s set]
723 scrollbar $w.top.s -command [list $w.top.record yview]
727 $w.top.record tag configure marc-tag -foreground blue
728 $w.top.record tag configure marc-id -foreground red
730 $w.top.record tag configure marc-tag -foreground black
731 $w.top.record tag configure marc-id -foreground black
733 $w.top.record tag configure marc-data -foreground black
736 $w.top.record delete 0.0 end
737 set recordType [z39.$sno recordType $no]
738 wm title $w "$recordType record #$no"
741 bind $w.top.record <Return> {destroy .full-marc}
743 pack $w.top.s -side right -fill y
744 pack $w.top.record -expand yes -fill both
747 bottom-buttons $w [list \
748 {Close} [list destroy $w]] 0
750 bottom-buttons $w [list \
751 {Close} [list destroy $w] \
752 {Duplicate} [list popup-marc $sno $no 1 0]] 0
753 menubutton $w.bot.formats -text "Format" -menu $w.bot.formats.m
754 menu $w.bot.formats.m
756 foreach f $displayFormats {
757 $w.bot.formats.m add radiobutton -label $f \
758 -variable popupMarcdf -value $i \
759 -command [list display-$f $sno $no $w.top.record 0]
762 pack $w.bot.formats -expand yes -ipadx 2 -ipady 2 \
763 -padx 3 -pady 3 -side left
767 $w.bot.formats.m delete 0 last
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]
775 set ffunc [lindex $displayFormats $df]
776 set ffunc "display-$ffunc"
778 $ffunc $sno $no $w.top.record 0
781 proc update-target-hotlist {target base} {
785 set len [llength $hotTargets]
788 .top.target.m delete 7 [expr 7+[llength $hotTargets]]
790 .top.target.m delete 6 [expr 6+[llength $hotTargets]]
794 foreach e $hotTargets {
795 if {$target == [lindex $e 0] && $base == [lindex $e 1]} {
796 set hotTargets [lreplace $hotTargets $i $i]
801 set hotTargets [linsert $hotTargets 0 [list $target $base]]
805 proc set-target-hotlist {} {
809 foreach e $hotTargets {
810 set target [lindex $e 0]
811 set base [lindex $e 1]
813 .top.target.m add command -label "$i $target" -command \
814 [list reopen-target $target {}]
816 .top.target.m add command -label "$i $target - $base" -command \
817 [list reopen-target $target $base]
826 proc reopen-target {target base} {
828 open-target $target $base
829 update-target-hotlist $target $base
832 proc define-target-action {} {
835 set target [.target-define.top.target.entry get]
839 foreach n [array names profile] {
845 set seq [lindex $profile(Default) 12]
847 set profile($target) $profile(Default)
848 set profile(Default) [lreplace $profile(Default) 12 12 [incr seq]]
850 protocol-setup $target
851 destroy .target-define
854 proc fail-response {target} {
855 set c [lindex [z39 failInfo] 0]
856 set m [lindex [z39 failInfo] 1]
861 proc connect-response {target base} {
862 dputs "connect-response"
863 show-target $target $base
867 proc open-target {target base} {
872 z39 comstack [lindex $profile($target) 6]
873 z39 protocol [lindex $profile($target) 11]
874 z39 idAuthentication [lindex $profile($target) 3]
875 z39 maximumRecordSize [lindex $profile($target) 4]
876 z39 preferredMessageSize [lindex $profile($target) 5]
877 dputs "maximumRecordSize="
878 dputs [z39 maximumRecordSize]
879 dputs "preferredMessageSize="
880 dputs [z39 preferredMessageSize]
881 show-status {Connecting} 1 0
883 z39 databaseNames [lindex [lindex $profile($target) 7] 0]
885 z39 databaseNames $base
887 z39 failback [list fail-response $target]
888 z39 callback [list connect-response $target $base]
891 z39 connect [lindex $profile($target) 1]:[lindex $profile($target) 2]
894 tkerror $errorMessage
895 show-status "Not connected" 0 {}
899 configure-disable-e .top.target.m 0
900 configure-enable-e .top.target.m 1
901 configure-enable-e .top.target.m 2
904 proc close-target {} {
914 .bot.a.set configure -text ""
918 show-status {Not connected} 0 0
921 configure-disable-e .top.target.m 1
922 configure-disable-e .top.target.m 2
924 .top.rset.m delete 2 last
926 .top.rset.m delete 1 last
928 .top.rset.m add separator
929 configure-enable-e .top.target.m 0
932 proc load-set-action {} {
936 ir-set z39.$setNoLast z39
938 set fname [.load-set.top.filename.entry get]
941 show-status {Loading} 1 {}
943 z39.$setNoLast loadFile $fname
945 set no [z39.$setNoLast numberOfRecordsReturned]
946 add-title-lines $setNoLast $no 1
948 set l [format "%-4d %7d" $setNoLast $no]
949 .top.rset.m add command -label $l \
950 -command [list add-title-lines $setNoLast 10000 1]
951 show-status {Ready} 0 {}
963 frame $w.top.filename
964 pack $w.top.filename -side top -anchor e -pady 2
966 entry-fields $w.top {filename} \
968 {load-set-action} {destroy .load-set}
970 top-down-ok-cancel $w {load-set-action} 1
974 proc init-request {} {
981 z39 callback {init-response}
982 show-status {Initializing} 1 {}
983 set err [catch {z39 init} errorMessage]
985 tkerror $errorMessage
986 show-status Ready 0 {}
990 proc init-response {} {
998 if {![z39 initResult]} {
999 show-status {Ready} 0 1
1000 set u [z39 userInformationField]
1002 tkerror "Connection rejected by target: $u"
1004 if {[lsearch [z39 options] scan] >= 0} {
1009 show-status {Ready} 0 1
1013 proc search-request {bflag} {
1025 dputs "search-request"
1027 if {!$bflag && $busy} {
1028 dputs "busy: search-request ignored"
1033 show-status {Searching} 1 0
1034 set delayRequest {search-request 1}
1039 set query [index-query]
1044 set setNo $setNoLast
1045 ir-set z39.$setNo z39
1047 if {[lindex $profile($target) 10] == 1} {
1048 z39.$setNo setName $setNo
1049 dputs "setName=${setNo}"
1051 z39.$setNo setName Default
1052 dputs "setName=Default"
1054 if {[lindex $profile($target) 8] == 1} {
1055 z39.$setNo queryType rpn
1057 if {[lindex $profile($target) 9] == 1} {
1058 z39.$setNo queryType ccl
1062 if {$recordSyntax == "None" } {
1063 z39.$setNo preferredRecordSyntax {}
1065 z39.$setNo preferredRecordSyntax $recordSyntax
1067 z39 callback {search-response}
1068 z39.$setNo search $query
1069 show-status {Searching} 1 0
1072 proc scan-copy {y entry} {
1074 set no [$w.top.list nearest $y]
1076 .lines.$entry.e delete 0 end
1077 .lines.$entry.e insert 0 [string range [$w.top.list get $no] 8 end]
1080 proc scan-request {} {
1087 global curIndexEntry
1088 global queryButtonsFind
1089 global queryInfoFind
1093 dputs "scan-request"
1096 show-status {Scanning} 1 0
1097 set delayRequest scan-request
1106 set b [lindex $queryButtonsFind $curIndexEntry]
1108 foreach a [lrange [lindex $queryInfoFind [lindex $b 1]] 1 end] {
1109 set attr "@attr $a $attr"
1111 set title [lindex [lindex $queryInfoFind [lindex $b 1]] 0]
1112 ir-scan z39.scan z39
1114 if {![winfo exists $w]} {
1121 entry $w.top.entry -relief sunken
1122 pack $w.top.entry -fill x -padx 4 -pady 2
1123 bind $w.top.entry <KeyRelease> [list scan-term-h $attr]
1124 listbox $w.top.list -yscrollcommand [list $w.top.scroll set] \
1126 scrollbar $w.top.scroll -orient vertical -border 1
1127 pack $w.top.list -side left -fill both -expand yes
1128 pack $w.top.scroll -side right -fill y
1129 $w.top.scroll config -command [list $w.top.list yview]
1131 bottom-buttons $w [list {Close} [list destroy $w] \
1132 {Up} [list scan-up $attr] \
1133 {Down} [list scan-down $attr]] 0
1134 bind $w.top.list <Up> [list scan-up $attr]
1135 bind $w.top.list <Down> [list scan-down $attr]
1138 bind $w.top.list <Double-Button-1> [list scan-copy %y $curIndexEntry]
1139 wm title $w "Scan $title"
1141 z39 callback [list scan-response $attr 0 35]
1142 z39.scan numberOfTermsRequested 5
1143 z39.scan preferredPositionInResponse 1
1144 z39.scan scan "${attr} 0"
1146 show-status {Scanning} 1 0
1149 proc scan-term-h {attr} {
1157 set nScanTerm [$w.top.entry get]
1158 if {$nScanTerm == $scanTerm} {
1161 set scanTerm $nScanTerm
1162 z39 callback [list scan-response $attr 0 35]
1163 z39.scan numberOfTermsRequested 5
1164 z39.scan preferredPositionInResponse 1
1165 dputs "${attr} \{${scanTerm}\}"
1166 if {$scanTerm == ""} {
1167 z39.scan scan "${attr} 0"
1169 z39.scan scan "${attr} \{${scanTerm}\}"
1171 show-status {Scanning} 1 0
1174 proc scan-response {attr start toget} {
1181 dputs "In scan-response"
1182 set m [z39.scan numberOfEntriesReturned]
1188 if {![winfo exists .scan-window]} {
1191 dputs "Handling cancel"
1192 if {$delayRequest != ""} {
1197 show-status {Ready} 0 1
1200 set nScanTerm [$w.top.entry get]
1201 if {$nScanTerm != $scanTerm} {
1202 z39 callback [list scan-response $attr 0 35]
1203 z39.scan numberOfTermsRequested 5
1204 z39.scan preferredPositionInResponse 1
1205 set scanTerm $nScanTerm
1206 dputs "${attr} \{${scanTerm}\}"
1207 if {$scanTerm == ""} {
1208 z39.scan scan "${attr} 0"
1210 z39.scan scan "${attr} \{${scanTerm}\}"
1212 show-status {Scanning} 1 0
1215 set status [z39.scan scanStatus]
1218 show-status {Ready} 0 1
1223 for {set i 0} {$i < $m} {incr i} {
1224 set term [lindex [z39.scan scanLine $i] 1]
1225 set nostr [format " %-6d" [lindex [z39.scan scanLine $i] 2]]
1226 $w.top.list insert $i "$nostr $term"
1229 $w.top.list yview $scanView
1231 $w.top.list delete $start end
1232 for {set i 0} {$i < $m} {incr i} {
1233 set term [lindex [z39.scan scanLine $i] 1]
1234 set nostr [format " %-6d" [lindex [z39.scan scanLine $i] 2]]
1235 $w.top.list insert end "$nostr $term"
1239 dputs "Handling cancel"
1241 if {$delayRequest != ""} {
1247 if {$toget > 0 && $m > 1 && $m < $toget} {
1248 set ntoget [expr $toget - $m + 1]
1249 dputs ntoget=$ntoget
1250 z39 callback [list scan-response $attr [expr $start + $m - 1] $ntoget]
1252 dputs "down continue: $q"
1254 z39.scan numberOfTermsRequested 10
1256 z39.scan numberOfTermsRequested $ntoget
1258 z39.scan preferredPositionInResponse 1
1259 dputs "${attr} \{$q\}"
1260 z39.scan scan "${attr} \{$q\}"
1263 if {$toget < 0 && $m > 1 && $m < [expr - $toget]} {
1264 set ntoget [expr - $toget - $m]
1265 dputs ntoget=$ntoget
1266 z39 callback [list scan-response $attr 0 -$ntoget]
1267 set q [string range [$w.top.list get 0] 8 end]
1268 dputs "up continue: $q"
1270 z39.scan numberOfTermsRequested 10
1271 z39.scan preferredPositionInResponse 11
1273 z39.scan numberOfTermsRequested $ntoget
1274 z39.scan preferredPositionInResponse [incr ntoget]
1276 dputs "${attr} \{$q\}"
1277 z39.scan scan "${attr} \{$q\}"
1280 show-status {Ready} 0 1
1283 proc scan-down {attr} {
1291 show-status {Scanning down} 1 0
1292 set delayRequest [list scan-down $attr]
1298 set scanView [expr $scanView + 5]
1299 set s [$w.top.list size]
1300 if {$scanView > $s} {
1301 z39 callback [list scan-response $attr [expr $s - 1] 25]
1302 set q [string range [$w.top.list get [expr $s - 1]] 8 end]
1304 z39.scan numberOfTermsRequested 10
1305 z39.scan preferredPositionInResponse 1
1306 show-status {Scanning} 1 0
1307 dputs "${attr} \{$q\}"
1308 z39.scan scan "${attr} \{$q\}"
1311 $w.top.list yview $scanView
1314 proc scan-up {attr} {
1322 show-status {Scanning up} 1 0
1323 set delayRequest [list scan-up $attr]
1329 set scanView [expr $scanView - 5]
1330 if {$scanView < 0} {
1331 z39 callback [list scan-response $attr 0 -25]
1332 set q [string range [$w.top.list get 0] 8 end]
1334 z39.scan numberOfTermsRequested 10
1335 z39.scan preferredPositionInResponse 11
1336 show-status {Scanning} 1 0
1337 z39.scan scan "${attr} \{$q\}"
1340 $w.top.list yview $scanView
1343 proc search-response {} {
1351 dputs "In search-response"
1353 dputs "Handling cancel"
1355 if {$delayRequest != ""} {
1363 set setMax [z39.$setNo resultCount]
1364 show-status {Ready} 0 1
1365 set status [z39.$setNo responseStatus]
1366 if {[lindex $status 0] == "NSD"} {
1367 z39.$setNo nextResultSetPosition 0
1368 set code [lindex $status 1]
1369 set msg [lindex $status 2]
1370 set addinfo [lindex $status 3]
1371 tkerror "NSD$code: $msg: $addinfo"
1374 show-message "${setMax} hits"
1379 show-status {Ready} 0 1
1380 set l [format "%-4d %7d" $setNo $setMax]
1381 .top.rset.m add command -label $l \
1382 -command [list add-title-lines $setNo 10000 1]
1386 z39 callback {present-response}
1387 z39.$setNo present $setOffset 1
1388 show-status {Retrieving} 1 0
1391 proc present-more {number} {
1399 dputs "present-more"
1401 show-status {Retrieving} 1 0
1402 set delayRequest "present-more $number"
1408 dputs "setNo=$setNo"
1411 set setOffset [z39.$setNo nextResultSetPosition]
1412 dputs "setOffest=${setOffset}"
1413 dputs "setNo=${setNo}"
1414 set max [z39.$setNo resultCount]
1415 if {$max < $setOffset} {
1417 dputs "setOffset=$setOffset"
1418 show-status Ready 0 1
1421 if {$number == ""} {
1425 if {$setMax > $max} {
1429 z39 callback {present-response}
1431 set toGet [expr $setMax - $setOffset + 1]
1438 z39.$setNo present $setOffset $toGet
1439 show-status {Retrieving} 1 0
1442 proc init-title-lines {} {
1443 .data.record delete 0.0 end
1446 proc title-press {y setno} {
1447 show-full-marc $setno [expr 1 + [.data.list nearest $y]] 0
1450 proc add-title-lines {setno no offset} {
1451 global displayFormats
1452 global displayFormat
1462 .bot.a.set configure -text $setno
1463 .data.record delete 0.0 end
1465 set ffunc [lindex $displayFormats $displayFormat]
1466 dputs "ffunc=$ffunc"
1467 set ffunc "display-$ffunc"
1468 for {set i 0} {$i < $no} {incr i} {
1469 set o [expr $i + $offset]
1470 set type [z39.$setno type $o]
1474 .data.record tag bind r$o <Any-Enter> {}
1475 .data.record tag bind r$o <Any-Leave> {}
1476 set insert0 [.data.record index insert]
1477 $ffunc $setno $o .data.record 1
1478 .data.record tag add r$o $insert0 insert
1479 .data.record tag bind r$o <1> \
1480 [list popup-marc $setno $o 0 0]
1484 show-status Ready 0 1
1488 proc present-response {} {
1495 dputs "In present-response"
1496 set no [z39.$setNo numberOfRecordsReturned]
1497 dputs "Returned $no records, setOffset $setOffset"
1498 add-title-lines $setNo $no $setOffset
1499 set setOffset [expr $setOffset + $no]
1501 dputs "Handling cancel"
1503 if {$delayRequest != ""} {
1508 set status [z39.$setNo responseStatus]
1509 if {[lindex $status 0] == "NSD"} {
1510 show-status {Ready} 0 1
1511 set code [lindex $status 1]
1512 set msg [lindex $status 2]
1513 set addinfo [lindex $status 3]
1514 tkerror "NSD$code: $msg: $addinfo"
1517 if {$no > 0 && $setOffset <= $setMax} {
1518 dputs "present-request from ${setOffset}"
1519 set toGet [expr $setMax - $setOffset + 1]
1523 z39.$setNo present $setOffset $toGet
1525 show-status {Ready} 0 1
1529 proc left-cursor {w} {
1530 set i [$w index insert]
1538 proc right-cursor {w} {
1539 set i [$w index insert]
1545 proc bind-fields {list returnAction escapeAction} {
1547 set max [expr [llength $list]-1]
1548 for {set i 0} {$i < $max} {incr i} {
1549 bind [lindex $list $i] <Return> $returnAction
1550 bind [lindex $list $i] <Escape> $escapeAction
1552 bind [lindex $list $i] <Tab> \
1553 [list focus [lindex $list [expr $i+1]]]
1554 bind [lindex $list $i] <Left> \
1555 [list left-cursor [lindex $list $i]]
1556 bind [lindex $list $i] <Right> \
1557 [list right-cursor [lindex $list $i]]
1560 bind [lindex $list $i] <Return> $returnAction
1561 bind [lindex $list $i] <Escape> $escapeAction
1563 bind [lindex $list $i] <Tab> [list focus [lindex $list 0]]
1564 bind [lindex $list $i] <Left> [list left-cursor [lindex $list $i]]
1565 bind [lindex $list $i] <Right> [list right-cursor [lindex $list $i]]
1567 focus [lindex $list 0]
1570 proc entry-fields {parent list tlist returnAction escapeAction} {
1573 foreach field $list {
1574 set label ${parent}.${field}.label
1575 set entry ${parent}.${field}.entry
1576 label $label -text [lindex $tlist $i] -anchor e
1577 entry $entry -width 32 -relief sunken
1578 pack $label -side left
1579 pack $entry -side right
1580 lappend alist $entry
1583 bind-fields $alist $returnAction $escapeAction
1586 proc define-target-dialog {} {
1587 set w .target-define
1593 pack $w.top.target \
1594 -side top -anchor e -pady 2
1595 entry-fields $w.top {target} \
1597 {define-target-action} {destroy .target-define}
1598 top-down-ok-cancel $w {define-target-action} 1
1601 proc protocol-setup-delete {target} {
1603 global settingsChanged
1605 set a [alert "Are you sure you want to delete the target \
1606 definition $target ?"]
1608 set wno [lindex $profile($target) 12]
1611 unset profile($target)
1612 set settingsChanged 1
1617 proc protocol-setup-action {target} {
1620 global protocolRadioType
1621 global settingsChanged
1624 global ResultSetCheck
1626 set wno [lindex $profile($target) 12]
1630 set settingsChanged 1
1631 set len [$w.top.databases.list size]
1632 for {set i 0} {$i < $len} {incr i} {
1633 lappend b [$w.top.databases.list get $i]
1635 set profile($target) [list [$w.top.description.entry get] \
1636 [$w.top.host.entry get] \
1637 [$w.top.port.entry get] \
1638 [$w.top.idAuthentication.entry get] \
1639 [$w.top.maximumRecordSize.entry get] \
1640 [$w.top.preferredMessageSize.entry get] \
1646 $protocolRadioType \
1650 dputs $profile($target)
1654 proc place-force {window parent} {
1655 set g [wm geometry $parent]
1657 set p1 [string first + $g]
1658 set p2 [string last + $g]
1660 set x [expr 40+[string range $g [expr $p1 +1] [expr $p2 -1]]]
1661 set y [expr 60+[string range $g [expr $p2 +1] end]]
1662 wm geometry $window +${x}+${y}
1665 proc add-database-action {target} {
1668 set wno [lindex $profile($target) 12]
1671 $w.top.databases.list insert end \
1672 [.database-select.top.database.entry get]
1673 destroy .database-select
1676 proc add-database {target} {
1679 set w .database-select
1681 set oldFocus [focus]
1684 set wno [lindex $profile($target) 12]
1685 place-force $w .setup-${wno}
1689 frame $w.top.database
1691 pack $w.top.database -side top -anchor e -pady 2
1693 entry-fields $w.top {database} \
1694 {{Database to add:}} \
1695 [list add-database-action $target] {destroy .database-select}
1697 top-down-ok-cancel $w [list add-database-action $target] 1
1701 proc delete-database {target} {
1704 set wno [lindex $profile($target) 12]
1707 foreach i [$w.top.databases.list curselection] {
1708 set b [$w.top.databases.list get $i]
1711 set a [alert "Are you sure you want to remove the database(s)${l}?"]
1713 foreach i [lsort -decreasing \
1714 [$w.top.databases.list curselection]] {
1715 $w.top.databases.list delete $i
1720 proc protocol-setup {target} {
1723 global protocolRadioType
1726 global ResultSetCheck
1728 set wno [lindex $profile($target) 12]
1733 wm title $w "Setup $target"
1737 if {$target == ""} {
1741 dputs $profile($target)
1743 frame $w.top.description
1746 frame $w.top.idAuthentication
1747 frame $w.top.maximumRecordSize
1748 frame $w.top.preferredMessageSize
1749 frame $w.top.cs-type -relief ridge -border 2
1750 frame $w.top.protocol -relief ridge -border 2
1751 frame $w.top.query -relief ridge -border 2
1752 frame $w.top.databases -relief ridge -border 2
1754 # Maximum/preferred/idAuth ...
1755 pack $w.top.description $w.top.host $w.top.port \
1756 $w.top.idAuthentication $w.top.maximumRecordSize \
1757 $w.top.preferredMessageSize -side top -anchor e -pady 2
1759 entry-fields $w.top {description host port idAuthentication \
1760 maximumRecordSize preferredMessageSize} \
1761 {{Description:} {Host:} {Port:} {Id Authentication:} \
1762 {Maximum Record Size:} {Preferred Message Size:}} \
1763 [list protocol-setup-action $target] [list destroy $w]
1765 foreach sub {description host port idAuthentication \
1766 maximumRecordSize preferredMessageSize} {
1768 bind $w.top.$sub.entry <Control-a> [list add-database $target]
1769 bind $w.top.$sub.entry <Control-d> [list delete-database $target]
1771 $w.top.description.entry insert 0 [lindex $profile($target) 0]
1772 $w.top.host.entry insert 0 [lindex $profile($target) 1]
1773 $w.top.port.entry insert 0 [lindex $profile($target) 2]
1774 $w.top.idAuthentication.entry insert 0 [lindex $profile($target) 3]
1775 $w.top.maximumRecordSize.entry insert 0 [lindex $profile($target) 4]
1776 $w.top.preferredMessageSize.entry insert 0 [lindex $profile($target) 5]
1777 set csRadioType [lindex $profile($target) 6]
1778 set RPNCheck [lindex $profile($target) 8]
1779 set CCLCheck [lindex $profile($target) 9]
1780 set ResultSetCheck [lindex $profile($target) 10]
1781 set protocolRadioType [lindex $profile($target) 11]
1782 if {$protocolRadioType == ""} {
1783 set protocolRadioType Z39
1787 pack $w.top.databases -side left -pady 4 -padx 4 -expand yes -fill both
1789 label $w.top.databases.label -text "Databases"
1790 button $w.top.databases.add -text "Add" \
1791 -command [list add-database $target]
1792 button $w.top.databases.delete -text "Delete" \
1793 -command [list delete-database $target]
1796 listbox $w.top.databases.list -geometry 20x6 \
1797 -yscrollcommand "$w.top.databases.scroll set"
1799 listbox $w.top.databases.list -width 20 \
1800 -yscrollcommand "$w.top.databases.scroll set"
1802 scrollbar $w.top.databases.scroll -orient vertical -border 1
1803 pack $w.top.databases.label -side top -fill x \
1805 pack $w.top.databases.add $w.top.databases.delete -side top -fill x \
1807 pack $w.top.databases.list -side left -fill both -expand yes \
1809 pack $w.top.databases.scroll -side right -fill y \
1811 $w.top.databases.scroll config -command "$w.top.databases.list yview"
1813 foreach b [lindex $profile($target) 7] {
1814 $w.top.databases.list insert end $b
1818 pack $w.top.cs-type -pady 4 -padx 4 -side top -fill x
1820 label $w.top.cs-type.label -text "Transport"
1821 radiobutton $w.top.cs-type.tcpip -text "TCP/IP" -anchor w \
1822 -variable csRadioType -value tcpip
1823 radiobutton $w.top.cs-type.mosi -text "MOSI" -anchor w\
1824 -variable csRadioType -value mosi
1826 pack $w.top.cs-type.label $w.top.cs-type.tcpip $w.top.cs-type.mosi \
1827 -padx 4 -side top -fill x
1830 pack $w.top.protocol -pady 4 -padx 4 -side top -fill x
1832 label $w.top.protocol.label -text "Protocol"
1833 radiobutton $w.top.protocol.z39v2 -text "Z39.50" -anchor w \
1834 -variable protocolRadioType -value Z39
1835 radiobutton $w.top.protocol.sr -text "SR" -anchor w \
1836 -variable protocolRadioType -value SR
1838 pack $w.top.protocol.label $w.top.protocol.z39v2 $w.top.protocol.sr \
1839 -padx 4 -side top -fill x
1842 pack $w.top.query -pady 4 -padx 4 -side top -fill x
1844 label $w.top.query.label -text "Query support"
1845 checkbutton $w.top.query.c1 -text "RPN query" -anchor w -variable RPNCheck
1846 checkbutton $w.top.query.c2 -text "CCL query" -anchor w -variable CCLCheck
1847 checkbutton $w.top.query.c3 -text "Result sets" -anchor w -variable ResultSetCheck
1849 pack $w.top.query.label -side top
1850 pack $w.top.query.c1 $w.top.query.c2 $w.top.query.c3 \
1851 -padx 4 -side top -fill x
1854 bottom-buttons $w [list {Ok} [list protocol-setup-action $target] \
1855 {Delete} [list protocol-setup-delete $target] \
1856 {Cancel} [list destroy $w]] 0
1859 proc database-select-action {} {
1860 set w .database-select.top
1862 foreach indx [$w.databases.list curselection] {
1863 lappend b [$w.databases.list get $indx]
1866 z39 databaseNames $b
1868 destroy .database-select
1871 proc database-select {} {
1872 set w .database-select
1882 frame $w.top.databases -relief ridge -border 2
1884 pack $w.top.databases -side left -pady 6 -padx 6 -expand yes -fill x
1886 label $w.top.databases.label -text "List"
1887 listbox $w.top.databases.list -geometry 20x6 \
1888 -yscrollcommand "$w.top.databases.scroll set"
1889 scrollbar $w.top.databases.scroll -orient vertical -border 1
1890 pack $w.top.databases.label -side top -fill x \
1892 pack $w.top.databases.list -side left -fill both -expand yes \
1894 pack $w.top.databases.scroll -side right -fill y \
1896 $w.top.databases.scroll config -command "$w.top.databases.list yview"
1898 foreach b [lindex $profile($hostid) 7] {
1899 $w.top.databases.list insert end $b
1901 top-down-ok-cancel $w {database-select-action} 1
1904 proc cascade-target-list {} {
1907 foreach sub [winfo children .top.target.m.clist] {
1910 .top.target.m.clist delete 0 last
1911 foreach n [lsort [array names profile]] {
1912 if {$n != "Default"} {
1913 set nl [lindex $profile($n) 12]
1914 if {[llength [lindex $profile($n) 7]] > 1} {
1915 .top.target.m.clist add cascade -label $n \
1916 -menu .top.target.m.clist.$nl
1917 menu .top.target.m.clist.$nl
1918 foreach b [lindex $profile($n) 7] {
1919 .top.target.m.clist.$nl add command -label $b \
1920 -command [list reopen-target $n $b]
1923 .top.target.m.clist add command -label $n \
1924 -command [list reopen-target $n {}]
1928 .top.target.m.slist delete 0 last
1929 foreach n [lsort [array names profile]] {
1930 if {$n != "Default"} {
1931 .top.target.m.slist add command -label $n \
1932 -command [list protocol-setup $n]
1937 proc query-select {i} {
1938 global queryButtonsFind
1939 global queryInfoFind
1943 set queryInfoFind [lindex $queryInfo $i]
1944 set queryButtonsFind [lindex $queryButtons $i]
1946 index-lines .lines 1 $queryButtonsFind $queryInfoFind activate-index
1949 proc query-new-action {} {
1953 global settingsChanged
1955 set settingsChanged 1
1956 lappend queryTypes [.query-new.top.index.entry get]
1957 lappend queryButtons {}
1958 lappend queryInfo {}
1972 -side top -anchor e -pady 2
1973 entry-fields $w.top index \
1975 query-new-action {destroy .query-new}
1976 top-down-ok-cancel $w query-new-action 1
1979 proc query-delete-action {queryNo} {
1983 global settingsChanged
1985 set settingsChanged 1
1987 set queryTypes [lreplace $queryTypes $queryNo $queryNo]
1988 set queryButtons [lreplace $queryButtons $queryNo $queryNo]
1989 set queryInfo [lreplace $queryInfo $queryNo $queryNo]
1990 destroy .query-delete
1994 proc query-delete {queryNo} {
2002 set n [lindex $queryTypes $queryNo]
2004 label $w.top.warning -bitmap warning
2005 message $w.top.quest -text "Are you sure you want to delete the \
2006 query type $n ?" -aspect 300
2007 pack $w.top.warning $w.top.quest -side left -expand yes -padx 10 -pady 5
2008 bottom-buttons $w [list {Ok} [list query-delete-action $queryNo] \
2009 {Cancel} [list destroy $w]] 1
2012 proc cascade-query-list {} {
2014 set w .top.options.m.query
2017 $w.slist delete 0 last
2018 foreach n $queryTypes {
2019 $w.slist add command -label $n -command [list query-setup $i]
2024 $w.clist delete 0 last
2025 foreach n $queryTypes {
2026 $w.clist add command -label $n -command [list query-select $i]
2030 $w.dlist delete 0 last
2031 foreach n $queryTypes {
2032 $w.dlist add command -label $n -command [list query-delete $i]
2037 proc save-geometry {} {
2038 global windowGeometry
2041 global displayFormat
2045 set windowGeometry(.) [wm geometry .]
2047 set f [open "~/.clientrc.tcl" w]
2049 puts $f "set hotTargets \{ $hotTargets \}"
2050 puts $f "set textWrap $textWrap"
2051 puts $f "set displayFormat $displayFormat"
2052 puts $f "set popupMarcdf $popupMarcdf"
2053 puts $f "set recordSyntax $recordSyntax"
2054 foreach n [array names windowGeometry] {
2055 puts -nonewline $f "set \{windowGeometry($n)\} \{"
2056 puts -nonewline $f $windowGeometry($n)
2062 proc save-settings {} {
2065 global settingsChanged
2070 if {![file writable "${libdir}/clientrc.tcl"]} {
2071 set a [alert "Cannot open ${libdir}/clientrc.tcl for writing. Do you \
2072 wish to save clientrc.tcl in the current directory instead?"]
2076 set f [open "clientrc.tcl" w]
2078 set f [open "${libdir}/clientrc.tcl" w]
2080 puts $f "# Setup file"
2082 foreach n [array names profile] {
2083 puts -nonewline $f "set \{profile($n)\} \{"
2084 puts -nonewline $f $profile($n)
2087 puts -nonewline $f "set queryTypes \{"
2088 puts -nonewline $f $queryTypes
2091 puts -nonewline $f "set queryButtons \{"
2092 puts -nonewline $f $queryButtons
2095 puts -nonewline $f "set queryInfo \{"
2096 puts -nonewline $f $queryInfo
2099 set settingsChanged 0
2111 label $w.top.warning -bitmap warning
2112 message $w.top.message -text $ask -aspect 300 \
2113 -font -Adobe-Times-Medium-R-Normal-*-180-*
2115 pack $w.top.warning $w.top.message -side left -pady 5 -padx 10 -expand yes
2118 top-down-ok-cancel $w {alert-action} 1
2122 proc alert-action {} {
2128 proc exit-action {} {
2129 global settingsChanged
2131 if {$settingsChanged} {
2132 set a [alert "you haven't saved your settings. Do you wish to save?"]
2141 proc listbuttonaction {w name h user i} {
2142 $w configure -text [lindex $name 0]
2143 $h [lindex $name 1] $user $i
2146 proc listbuttonx {button no names handle user} {
2147 if {[winfo exists $button]} {
2148 $button configure -text [lindex [lindex $names $no] 0]
2149 ${button}.m delete 0 last
2151 menubutton $button -text [lindex [lindex $names $no] 0] \
2152 -width 10 -menu ${button}.m -relief raised -border 1
2156 foreach name $names {
2157 ${button}.m add command -label [lindex $name 0] \
2158 -command [list listbuttonaction ${button} $name \
2164 proc listbutton {button no names} {
2165 menubutton $button -text [lindex $names $no] -width 10 -menu ${button}.m \
2166 -relief raised -border 1
2168 foreach name $names {
2169 ${button}.m add command -label $name \
2170 -command [list ${button} configure -text $name]
2174 proc listbuttonv-action {button var names i} {
2177 set $var [lindex $names [expr $i+1]]
2178 $button configure -text [lindex $names $i]
2181 proc listbuttonv {button var names} {
2185 eval "set val $$var"
2186 set l [llength $names]
2187 for {set i 1} {$i < $l} {incr i 2} {
2188 if {$val == [lindex $names $i]} {
2190 set n [lindex $names $i]
2194 if {[winfo exists $button]} {
2195 $button configure -text $n
2198 menubutton $button -text $n -menu ${button}.m \
2199 -relief raised -border 1
2201 for {set i 0} {$i < $l} {incr i 2} {
2202 ${button}.m add command -label [lindex $names $i] \
2203 -command [list listbuttonv-action $button $var $names $i]
2207 proc query-add-index-action {queryNo} {
2211 global queryButtonsTmp
2213 set newI [.query-add-index.top.index.entry get]
2214 lappend queryInfoTmp [list $newI {}]
2215 $w.top.index.list insert end $newI
2216 destroy .query-add-index
2217 #destroy $w.top.lines
2218 #frame $w.top.lines -relief ridge -border 2
2219 index-lines $w.top.lines 0 $queryButtonsTmp $queryInfoTmp activate-e-index
2220 #pack $w.top.lines -side left -pady 6 -padx 6 -fill y
2223 proc query-add-line {queryNo} {
2227 global queryButtonsTmp
2229 lappend queryButtonsTmp {I 0}
2231 #destroy $w.top.lines
2232 #frame $w.top.lines -relief ridge -border 2
2233 index-lines $w.top.lines 0 $queryButtonsTmp $queryInfoTmp activate-e-index
2234 #pack $w.top.lines -side left -pady 6 -padx 6 -fill y
2237 proc query-del-line {queryNo} {
2241 global queryButtonsTmp
2243 set l [llength $queryButtonsTmp]
2248 set queryButtonsTmp [lreplace $queryButtonsTmp $l $l]
2249 index-lines $w.top.lines 0 $queryButtonsTmp $queryInfoTmp activate-e-index
2252 proc query-add-index {queryNo} {
2253 set w .query-add-index
2256 place-force $w .query-setup
2260 -side top -anchor e -pady 2
2261 entry-fields $w.top {index} \
2263 [list query-add-index-action $queryNo] [list destroy $w]
2264 top-down-ok-cancel $w [list query-add-index-action $queryNo] 1
2267 proc query-setup-action {queryNo} {
2270 global queryButtonsTmp
2272 global queryButtonsFind
2273 global queryInfoFind
2275 global settingsChanged
2277 set settingsChanged 1
2279 set queryInfo [lreplace $queryInfo $queryNo $queryNo \
2281 set queryButtons [lreplace $queryButtons $queryNo $queryNo \
2283 set queryInfoFind $queryInfoTmp
2284 set queryButtonsFind $queryButtonsTmp
2286 destroy .query-setup
2287 index-lines .lines 1 $queryButtonsFind $queryInfoFind activate-index
2290 proc activate-e-index {value no i} {
2291 global queryButtonsTmp
2292 global queryIndexTmp
2294 set queryButtonsTmp [lreplace $queryButtonsTmp $no $no [list I $i]]
2295 dputs $queryButtonsTmp
2296 set queryIndexTmp $i
2299 proc activate-index {value no i} {
2300 global queryButtonsFind
2302 set queryButtonsFind [lreplace $queryButtonsFind $no $no [list I $i]]
2304 dputs "queryButtonsFind $queryButtonsFind"
2307 proc update-attr {} {
2309 listbuttonv $w.top.relation.b relationTmpValue\
2310 {{None} 0 {Less than} 1 {Greater than or equal} 2 {Equal} 3 \
2311 {Greater than or equal} 4 {Greater than} 5 {Not equal} 6 \
2312 {Phonetic} 100 {Stem} 101 {Relevance} 102 {AlwaysMatches} 103}
2313 listbuttonv $w.top.position.b positionTmpValue {{None} 0 \
2314 {First in field} 1 {First in subfield} 2 {Any position in field} 3}
2315 listbuttonv $w.top.structure.b structureTmpValue {{None} 0 {Phrase} 1 \
2316 {Word} 2 {Key} 3 {Year} 4 {Date (norm)} 5 {Word list} 6 \
2317 {Date (un-norm)} 100 {Name (norm)} 101 {Date (un-norm)} 102 \
2318 {Structure} 103 {urx} 104 {free-form} 105 {doc-text} 106 \
2319 {local-number} 107 {string} 108 {numeric string} 109}
2320 listbuttonv $w.top.truncation.b truncationTmpValue {{Auto} 0 {Right} 1 \
2321 {Left} 2 {Left and right} 3 {No truncation} 100 \
2322 {Process #} 101 {Re-1} 102 {Re-2} 103}
2323 listbuttonv $w.top.completeness.b completenessTmpValue {{None} 0 \
2324 {Incomplete subfield} 1 {Complete subfield} 2 {Complete field} 3}
2327 proc use-attr {init} {
2339 {BNB card number} 10
2340 {BGF(sic) number} 11
2342 {Dewey classification} 13
2343 {UDC classification} 14
2344 {Bliss classification} 15
2346 {NLM call number} 17
2347 {NAL call number} 18
2348 {MOS call number} 19
2349 {Local classification} 20
2350 {Subject heading} 21
2352 {BDI-index-subject} 23
2356 {LC-subject-heading} 27
2357 {RVM-subject-heading} 28
2358 {Local subject index} 29
2360 {Date of publication} 31
2361 {Date of acquisition} 32
2363 {Title-collective} 34
2366 {Title-added-title-page} 37
2370 {Title-other-variant} 41
2372 {Title-abbreviated} 43
2376 {Subject-subdivision} 47
2377 {Number-natl-bibliography} 48
2378 {Number-legal-deposit} 49
2379 {Number-govt-publication} 50
2380 {Number-publisher-for-music} 51
2382 {Number-local-call} 53
2384 {Code-geographic-area} 55
2385 {Code-institution} 56
2387 {Name-geographic} 58
2388 {Place-publication} 59
2390 {Microform-generation} 61
2397 {Author-name-personal} 1004
2398 {Author-name-corporate} 1005
2399 {Author-name-conference} 1006
2400 {Identifier-standard} 1007
2401 {Subject-LC-children's} 1008
2402 {Subject-name-personal} 1009
2404 {Date/time added to database} 1011
2405 {Date/time last modified} 1012
2406 {Authority/format identifier} 1013
2408 {Concept-reference} 1015
2410 {Server choice} 1017
2412 {Record source} 1019
2415 {Geographic class} 1022
2419 {Related periodical} 1026
2420 {Report number} 1027
2422 {Thematic number} 1030
2423 {Material type} 1031
2432 set l [llength $attr]
2437 for {set i 0} {$i < $l} {incr i} {
2438 $w.top.use.list insert end [lindex $attr $i]
2440 if {$useTmpValue == [lindex $attr $i]} {
2446 $w.top.use.list selection clear 0 end
2447 $w.top.use.list selection set $s $s
2449 $w.top.use.list select from $s
2450 $w.top.use.list select to $s
2456 $w.top.use.list yview $s
2458 set lno [lindex [$w.top.use.list curselection] 0]
2459 set i [expr $lno+$lno+1]
2460 set useTmpValue [lindex $attr $i]
2461 dputs "useTmpValue=$useTmpValue"
2465 proc index-setup-action {oldAttr queryNo indexNo} {
2466 set attr [lindex $oldAttr 0]
2469 global relationTmpValue
2470 global structureTmpValue
2471 global truncationTmpValue
2472 global completenessTmpValue
2473 global positionTmpValue
2478 dputs "index-setup-action"
2479 dputs "queryNo $queryNo"
2480 dputs "indexNo $indexNo"
2481 if {$useTmpValue > 0} {
2482 lappend attr "1=$useTmpValue"
2484 if {$relationTmpValue > 0} {
2485 lappend attr "2=$relationTmpValue"
2487 if {$positionTmpValue > 0} {
2488 lappend attr "3=$positionTmpValue"
2490 if {$structureTmpValue > 0} {
2491 lappend attr "4=$structureTmpValue"
2493 if {$truncationTmpValue > 0} {
2494 lappend attr "5=$truncationTmpValue"
2496 if {$completenessTmpValue > 0} {
2497 lappend attr "6=$completenessTmpValue"
2499 dputs "new attr $attr"
2500 set queryInfoTmp [lreplace $queryInfoTmp $indexNo $indexNo $attr]
2501 destroy .index-setup
2504 proc index-setup {attr queryNo indexNo} {
2507 global relationTmpValue
2508 global structureTmpValue
2509 global truncationTmpValue
2510 global completenessTmpValue
2511 global positionTmpValue
2514 set relationTmpValue 0
2515 set truncationTmpValue 0
2516 set structureTmpValue 0
2517 set positionTmpValue 0
2518 set completenessTmpValue 0
2521 set len [llength $attr]
2522 for {set i 1} {$i < $len} {incr i} {
2523 set q [lindex $attr $i]
2524 set l [string first = $q]
2526 set t [string range $q 0 [expr $l - 1]]
2527 set v [string range $q [expr $l + 1] end]
2530 { set useTmpValue $v }
2532 { set relationTmpValue $v }
2534 { set positionTmpValue $v }
2536 { set structureTmpValue $v }
2538 { set truncationTmpValue $v }
2540 { set completenessTmpValue $v }
2544 if {[winfo exists $w]} {
2549 set n [lindex $attr 0]
2550 wm title $w "Index setup $n"
2554 frame $w.top.use -relief ridge -border 2
2555 frame $w.top.relation -relief ridge -border 2
2556 frame $w.top.position -relief ridge -border 2
2557 frame $w.top.structure -relief ridge -border 2
2558 frame $w.top.truncation -relief ridge -border 2
2559 frame $w.top.completeness -relief ridge -border 2
2565 pack $w.top.use -side left -pady 6 -padx 6 -fill y
2567 label $w.top.use.label -text "Use"
2569 listbox $w.top.use.list -width 26 \
2570 -yscrollcommand "$w.top.use.scroll set"
2572 listbox $w.top.use.list -geometry 26x10 \
2573 -yscrollcommand "$w.top.use.scroll set"
2575 scrollbar $w.top.use.scroll -orient vertical -border 1
2576 pack $w.top.use.label -side top -fill x \
2578 pack $w.top.use.list -side left -fill both -expand yes \
2580 pack $w.top.use.scroll -side right -fill y \
2582 $w.top.use.scroll config -command "$w.top.use.list yview"
2586 # Relation Attributes
2588 pack $w.top.relation -pady 6 -padx 6 -side top
2589 label $w.top.relation.label -text "Relation" -width 18
2591 pack $w.top.relation.label $w.top.relation.b -fill x
2593 # Position Attributes
2595 pack $w.top.position -pady 6 -padx 6 -side top
2596 label $w.top.position.label -text "Position" -width 18
2598 pack $w.top.position.label $w.top.position.b -fill x
2600 # Structure Attributes
2602 pack $w.top.structure -pady 6 -padx 6 -side top
2603 label $w.top.structure.label -text "Structure" -width 18
2605 pack $w.top.structure.label $w.top.structure.b -fill x
2607 # Truncation Attributes
2609 pack $w.top.truncation -pady 6 -padx 6 -side top
2610 label $w.top.truncation.label -text "Truncation" -width 18
2612 pack $w.top.truncation.label $w.top.truncation.b -fill x
2614 # Completeness Attributes
2616 pack $w.top.completeness -pady 6 -padx 6 -side top
2617 label $w.top.completeness.label -text "Completeness" -width 18
2619 pack $w.top.completeness.label $w.top.completeness.b -fill x
2622 bottom-buttons $w [list \
2623 {Ok} [list index-setup-action $attr $queryNo $indexNo] \
2624 {Cancel} [list destroy $w]] 0
2628 proc query-edit-index {queryNo} {
2632 set i [lindex [$w.top.index.list curselection] 0]
2636 set attr [lindex $queryInfoTmp $i]
2637 dputs "Editing no $i $attr"
2638 index-setup $attr $queryNo $i
2641 proc query-delete-index {queryNo} {
2643 global queryButtonsTmp
2646 set i [lindex [$w.top.index.list curselection] 0]
2650 set queryInfoTmp [lreplace $queryInfoTmp $i $i]
2651 index-lines $w.top.lines 0 $queryButtonsTmp $queryInfoTmp activate-e-index
2652 $w.top.index.list delete $i
2655 proc query-setup {queryNo} {
2661 global queryButtonsTmp
2663 global queryIndexTmp
2667 set queryName [lindex $queryTypes $queryNo]
2668 set queryInfoTmp [lindex $queryInfo $queryNo]
2669 set queryButtonsTmp [lindex $queryButtons $queryNo]
2674 wm title $w "Query setup $queryName"
2678 frame $w.top.lines -relief ridge -border 2
2680 pack $w.top.lines -side left -pady 6 -padx 6 -fill y
2684 index-lines $w.top.lines 0 $queryButtonsTmp $queryInfoTmp activate-e-index
2686 button $w.top.lines.add -text "Add" \
2687 -command [list query-add-line $queryNo]
2688 button $w.top.lines.del -text "Remove" \
2689 -command [list query-del-line $queryNo]
2691 pack $w.top.lines.del -fill x -side bottom
2692 pack $w.top.lines.add -fill x -pady 10 -side bottom
2696 frame $w.top.index -relief ridge -border 2
2697 pack $w.top.index -pady 6 -padx 6 -side right -fill y
2699 listbox $w.top.index.list -yscrollcommand [list $w.top.index.scroll set]
2700 scrollbar $w.top.index.scroll -orient vertical -border 1 \
2701 -command [list $w.top.index.list yview]
2702 bind $w.top.index.list <2> [list query-edit-index $queryNo]
2704 pack $w.top.index.list -side left -fill both -expand yes -padx 2 -pady 2
2705 pack $w.top.index.scroll -side right -fill y -padx 2 -pady 2
2708 $w.top.index.list selection clear 0 end
2709 $w.top.index.list selection set 0 0
2711 $w.top.index.list select from 0
2712 $w.top.index.list select to 0
2715 foreach x $queryInfoTmp {
2716 $w.top.index.list insert end [lindex $x 0]
2719 bottom-buttons $w [list \
2720 {Ok} [list query-setup-action $queryNo] \
2721 {Add index} [list query-add-index $queryNo] \
2722 {Edit index} [list query-edit-index $queryNo] \
2723 {Delete index} [list query-delete-index $queryNo] \
2724 {Cancel} [list destroy $w]] 0
2727 proc index-clear {} {
2728 global queryButtonsFind
2731 foreach b $queryButtonsFind {
2732 .lines.$i.e delete 0 end
2737 proc index-query {} {
2738 global queryButtonsFind
2739 global queryInfoFind
2744 foreach b $queryButtonsFind {
2745 set term [string trim [.lines.$i.e get]]
2747 set attr [lrange [lindex $queryInfoFind [lindex $b 1]] 1 end]
2749 set len [string length $term]
2753 if {[string index $term $len] == "?"} {
2755 set term [string range $term 0 [expr $len - 1]]
2757 if {[string index $term 0] == "?"} {
2759 set term [string range $term 1 end]
2761 set term "\{${term}\}"
2762 if {$right && $left} {
2763 set term "@attr 5=3 ${term}"
2765 set term "@attr 5=1 ${term}"
2767 set term "@attr 5=2 ${term}"
2770 set term "@attr $a ${term}"
2773 set qs "@and ${qs} ${term}"
2784 proc index-focus-in {w i} {
2785 global curIndexEntry
2789 $w.$i configure -background red
2791 set curIndexEntry $i
2794 proc index-lines {w realOp buttonInfo queryInfo handle} {
2797 foreach b $buttonInfo {
2798 if {! [winfo exists $w.$i]} {
2800 frame $w.$i -border 0
2802 frame $w.$i -background white -border 1
2805 listbuttonx $w.$i.l [lindex $b 1] $queryInfo $handle $i
2808 if {! [winfo exists $w.$i.e]} {
2809 entry $w.$i.e -width 32 -relief sunken -border 1
2810 bind $w.$i.e <FocusIn> [list index-focus-in $w $i]
2811 bind $w.$i.e <FocusOut> [list $w.$i configure \
2813 pack $w.$i.l -side left
2814 pack $w.$i.e -side left -fill x -expand yes
2815 pack $w.$i -side top -fill x -padx 2 -pady 2
2817 bind $w.$i.e <Left> [list left-cursor $w.$i.e]
2818 bind $w.$i.e <Right> [list right-cursor $w.$i.e]
2820 bind $w.$i.e <Return> {search-request 0}
2823 pack $w.$i.l -side left
2824 pack $w.$i -side top -fill x -padx 2 -pady 2
2829 while {[winfo exists $w.$j]} {
2841 bind $w.$j.e <Tab> "focus $w.$k.e"
2847 bind $w.$i.e <Tab> "focus $w.0.e"
2853 proc search-fields {w buttondefs} {
2855 foreach buttondef $buttondefs {
2856 frame $w.$i -background white
2858 listbutton $w.$i.l 0 $buttondef
2859 entry $w.$i.e -width 32 -relief sunken
2861 pack $w.$i.l -side left
2862 pack $w.$i.e -side left -fill x -expand yes
2864 pack $w.$i -side top -fill x -padx 2 -pady 2
2866 bind $w.$i.e <Left> [list left-cursor $w.$i.e]
2867 bind $w.$i.e <Right> [list right-cursor $w.$i.e]
2875 bind $w.$j.e <Tab> "focus $w.$k.e \n
2876 $w.$k configure -background red \n
2877 $w.$j configure -background white"
2880 bind $w.$i.e <Tab> "focus $w.0.e \n
2881 $w.0 configure -background red \n
2882 $w.$i configure -background white"
2884 $w.0 configure -background red
2887 if {[info exists windowGeometry(.)]} {
2888 set g $windowGeometry(.)
2896 frame .top -border 1 -relief raised
2897 frame .lines -border 1 -relief raised
2898 frame .mid -border 1 -relief raised
2899 frame .data -border 1 -relief raised
2900 frame .bot -border 1 -relief raised
2901 pack .top .lines .mid -side top -fill x
2902 pack .data -side top -fill both -expand yes
2905 menubutton .top.file -text "File" -menu .top.file.m
2907 .top.file.m add command -label "Save settings" -command {save-settings}
2908 .top.file.m add separator
2909 .top.file.m add command -label "Exit" -command {exit-action}
2911 menubutton .top.target -text "Target" -menu .top.target.m
2913 .top.target.m add cascade -label "Connect" -menu .top.target.m.clist
2914 .top.target.m add command -label "Disconnect" -command {close-target}
2915 .top.target.m add command -label "About" -command {about-target}
2916 .top.target.m add cascade -label "Setup" -menu .top.target.m.slist
2917 .top.target.m add command -label "Setup new" -command {define-target-dialog}
2918 .top.target.m add separator
2921 configure-disable-e .top.target.m 1
2922 configure-disable-e .top.target.m 2
2924 menu .top.target.m.clist
2925 menu .top.target.m.slist
2928 menubutton .top.service -text "Service" -menu .top.service.m
2930 .top.service.m add command -label "Database" -command {database-select}
2931 .top.service.m add cascade -label "Present" -menu .top.service.m.present
2932 menu .top.service.m.present
2933 .top.service.m.present add command -label "10 More" \
2934 -command [list present-more 10]
2935 .top.service.m.present add command -label "All" \
2936 -command [list present-more {}]
2937 .top.service.m add command -label "Search" -command {search-request 0}
2938 .top.service.m add command -label "Scan" -command {scan-request}
2940 .top.service configure -state disabled
2942 menubutton .top.rset -text "Set" -menu .top.rset.m
2944 .top.rset.m add command -label "Load" -command {load-set}
2945 .top.rset.m add separator
2947 menubutton .top.options -text "Options" -menu .top.options.m
2949 .top.options.m add cascade -label "Query" -menu .top.options.m.query
2950 .top.options.m add cascade -label "Format" -menu .top.options.m.formats
2951 .top.options.m add cascade -label "Wrap" -menu .top.options.m.wrap
2952 .top.options.m add cascade -label "Syntax" -menu .top.options.m.syntax
2954 menu .top.options.m.query
2955 .top.options.m.query add cascade -label "Select" \
2956 -menu .top.options.m.query.clist
2957 .top.options.m.query add cascade -label "Edit" \
2958 -menu .top.options.m.query.slist
2959 .top.options.m.query add command -label "New" \
2960 -command {query-new}
2961 .top.options.m.query add cascade -label "Delete" \
2962 -menu .top.options.m.query.dlist
2964 menu .top.options.m.query.slist
2965 menu .top.options.m.query.clist
2966 menu .top.options.m.query.dlist
2969 menu .top.options.m.formats
2971 foreach f $displayFormats {
2972 .top.options.m.formats add radiobutton -label $f -value $i \
2973 -command [list set-display-format $i] -variable displayFormat
2977 menu .top.options.m.wrap
2978 .top.options.m.wrap add radiobutton -label "Character" \
2979 -value char -variable textWrap -command {set-wrap char}
2980 .top.options.m.wrap add radiobutton -label "Word" \
2981 -value word -variable textWrap -command {set-wrap word}
2982 .top.options.m.wrap add radiobutton -label "None" \
2983 -value none -variable textWrap -command {set-wrap none}
2985 menu .top.options.m.syntax
2986 .top.options.m.syntax add radiobutton -label "None" \
2987 -value None -variable recordSyntax
2988 .top.options.m.syntax add separator
2989 .top.options.m.syntax add radiobutton -label "USMARC" \
2990 -value USMARC -variable recordSyntax
2991 .top.options.m.syntax add radiobutton -label "UNIMARC" \
2992 -value UNIMARC -variable recordSyntax
2993 .top.options.m.syntax add radiobutton -label "UKMARC" \
2994 -value UKMARC -variable recordSyntax
2995 .top.options.m.syntax add radiobutton -label "DANMARC" \
2996 -value DANMARC -variable recordSyntax
2997 .top.options.m.syntax add radiobutton -label "FINMARC" \
2998 -value FINMARC -variable recordSyntax
2999 .top.options.m.syntax add radiobutton -label "NORMARC" \
3000 -value NORMARC -variable recordSyntax
3001 .top.options.m.syntax add radiobutton -label "PICAMARC" \
3002 -value PICAMARC -variable recordSyntax
3003 .top.options.m.syntax add separator
3004 .top.options.m.syntax add radiobutton -label "SUTRS" \
3005 -value SUTRS -variable recordSyntax
3007 menubutton .top.help -text "Help" -menu .top.help.m
3010 .top.help.m add command -label "Help on help" \
3011 -command {tkerror "Help on help not available. Sorry"}
3012 .top.help.m add command -label "About" -command {about-origin}
3014 pack .top.file .top.target .top.service .top.rset .top.options -side left
3015 pack .top.help -side right
3017 index-lines .lines 1 $queryButtonsFind [lindex $queryInfo 0] activate-index
3019 button .mid.search -width 7 -text {Search} -command {search-request 0} \
3021 button .mid.scan -width 7 -text {Scan} \
3022 -command scan-request -state disabled
3023 button .mid.present -width 7 -text {Present} -command [list present-more 10] \
3026 button .mid.clear -width 7 -text {Clear} -command index-clear
3027 pack .mid.search .mid.scan .mid.present .mid.clear -side left \
3028 -fill y -padx 5 -pady 3
3030 text .data.record -height 2 -width 20 -wrap none \
3031 -yscrollcommand [list .data.scroll set] -wrap $textWrap
3032 scrollbar .data.scroll -command [list .data.record yview]
3034 .data.record configure -takefocus 0
3035 .data.scroll configure -takefocus 0
3037 pack .data.scroll -side right -fill y
3038 pack .data.record -expand yes -fill both
3042 .data.record tag configure marc-tag -foreground blue
3043 .data.record tag configure marc-id -foreground red
3045 .data.record tag configure marc-tag -foreground black
3046 .data.record tag configure marc-id -foreground black
3048 .data.record tag configure marc-data -foreground black
3050 button .bot.logo -bitmap @${libdir}/bitmaps/book1 -command cancel-operation
3052 .bot.logo configure -takefocus 0
3055 pack .bot.a -side left -fill x
3056 pack .bot.logo -side right -padx 2 -pady 2
3058 message .bot.a.target -text "" -aspect 1000 -border 1
3060 label .bot.a.status -text "Not connected" -width 15 -relief \
3061 sunken -anchor w -border 1
3062 label .bot.a.set -text "" -width 5 -relief \
3063 sunken -anchor w -border 1
3064 label .bot.a.message -text "" -width 15 -relief \
3065 sunken -anchor w -border 1
3067 pack .bot.a.target -side top -anchor nw -padx 2 -pady 2
3068 pack .bot.a.status .bot.a.set .bot.a.message \
3069 -side left -padx 2 -pady 2