1 # IR toolkit for tcl/tk
3 # See the file LICENSE for details.
4 # Sebastian Hammer, Adam Dickmeiss
7 # Revision 1.67 1995-09-20 14:35:19 adam
10 # Revision 1.66 1995/08/29 15:30:13 adam
11 # Work on GRS records.
13 # Revision 1.65 1995/08/24 15:39:09 adam
16 # Revision 1.64 1995/08/24 15:33:02 adam
19 # Revision 1.63 1995/08/04 13:20:48 adam
20 # Buttons at the bottom are slightly smaller.
22 # Revision 1.62 1995/08/04 11:32:37 adam
23 # More work on output queue. Memory related routines moved
26 # Revision 1.61 1995/07/20 08:09:39 adam
27 # client.tcl: Targets removed from hotTargets list when targets
28 # are removed/modified.
29 # ir-tcl.c: More work on triggerResourceControl.
31 # Revision 1.60 1995/06/30 16:30:19 adam
34 # Revision 1.59 1995/06/29 14:06:25 adam
35 # Another bug in install fixed. Configure searches for more versions of yaz.
37 # Revision 1.58 1995/06/29 12:34:06 adam
38 # IrTcl now works with both tk4.0b4/tcl7.4b4 and tk3.6/tcl7.3
40 # Revision 1.57 1995/06/29 09:20:30 adam
41 # Target entries in cascade menus are sorted.
43 # Revision 1.56 1995/06/27 19:03:48 adam
44 # Bug fix in do_present in ir-tcl.c: p->set_child member weren't set.
45 # nextResultSetPosition used instead of setOffset.
47 # Revision 1.55 1995/06/27 17:10:37 adam
48 # Bug fix: install procedure didn't work on some systems.
49 # Error turned up when clientrc.tcl was't present.
51 # Revision 1.54 1995/06/27 14:41:03 adam
52 # Bug fix in search-response. Didn't always observe non-surrogate diagnostics.
54 # Revision 1.53 1995/06/26 12:40:09 adam
55 # Client defines its own tkerror.
56 # User may specify 'no preferredRecordSyntax'.
58 # Revision 1.52 1995/06/22 13:14:59 adam
59 # Feature: SUTRS. Setting getSutrs implemented.
60 # Work on display formats.
61 # Preferred record syntax can be set by the user.
63 # Revision 1.51 1995/06/21 11:11:00 adam
64 # Bug fix: libdir undefined in about-origin.
66 # Revision 1.50 1995/06/21 11:04:48 adam
67 # Uses GNU autoconf 2.3.
68 # Install procedure implemented.
69 # boook bitmaps moved to sub directory bitmaps.
71 # Revision 1.49 1995/06/20 14:16:42 adam
72 # More work on cancel mechanism.
74 # Revision 1.48 1995/06/20 08:07:23 adam
75 # New setting: failInfo.
76 # Working on better cancel mechanism.
78 # Revision 1.47 1995/06/19 14:05:29 adam
79 # Bug fix: asked for SUTRS.
81 # Revision 1.46 1995/06/19 13:06:06 adam
82 # New define: IR_TCL_VERSION.
84 # Revision 1.45 1995/06/19 08:08:44 adam
85 # client.tcl: hotTargets now contain both database and target name.
86 # ir-tcl.c: setting protocol edited. Errors in callbacks are logged
87 # by logf(LOG_WARN, ...) calls.
89 # Revision 1.44 1995/06/16 14:55:18 adam
92 # Revision 1.43 1995/06/16 14:41:05 adam
93 # Scan line entries can be copied to a search entry.
95 # Revision 1.42 1995/06/16 12:28:13 adam
96 # Implemented preferredRecordSyntax.
97 # Minor changes in diagnostic handling.
98 # Record list deleted when connection closes.
100 # Revision 1.41 1995/06/14 15:07:59 adam
101 # Bug fix in cascade-target-list. Uses yaz-version.h.
103 # Revision 1.40 1995/06/14 13:37:17 adam
104 # Setting recordType implemented.
105 # Setting implementationVersion implemented.
106 # Settings implementationId / implementationName edited.
108 # Revision 1.39 1995/06/14 12:16:22 adam
109 # hotTargets, textWrap and displayFormat saved in clientg.tcl.
111 # Revision 1.38 1995/06/14 07:22:45 adam
112 # Target definitions can be deleted.
113 # Listbox used in the query definition dialog.
115 # Revision 1.37 1995/06/13 14:37:59 adam
116 # Work on query setup.
117 # Better about origin/target.
118 # Better presentation formats.
120 # Revision 1.36 1995/06/13 07:42:14 adam
121 # Bindings removed from text widgets.
123 # Revision 1.35 1995/06/12 15:17:31 adam
124 # Text widget used in main window (instead of listbox) to support
125 # better presentation formats.
127 # Revision 1.34 1995/06/12 07:59:07 adam
128 # More work on geometry handling.
130 # Revision 1.33 1995/06/09 11:17:35 adam
131 # Start work on geometry management.
133 # Revision 1.32 1995/06/07 09:16:37 adam
134 # New presentation format.
136 # Revision 1.31 1995/06/06 16:31:09 adam
137 # Bug fix: target names couldn't contain blanks.
140 # Revision 1.30 1995/06/06 11:35:41 adam
141 # Work on scan. Display of old sets.
143 # Revision 1.29 1995/06/05 14:11:18 adam
144 # Bug fix in present-more.
146 # Revision 1.28 1995/06/02 14:52:13 adam
147 # Minor changes really.
149 # Revision 1.27 1995/06/02 14:29:42 adam
150 # Work on scan interface - up/down buttons.
152 # Revision 1.26 1995/06/01 16:36:46 adam
153 # About buttons. Minor bug fixes.
155 # Revision 1.25 1995/05/31 13:09:57 adam
156 # Client searches/presents may be interrupted.
157 # New moving book-logo.
159 # Revision 1.24 1995/05/31 08:36:24 adam
160 # Bug fix in client.tcl: didn't save options on clientrc.tcl.
161 # New method: referenceId. More work on scan.
163 # Revision 1.23 1995/05/29 10:33:41 adam
164 # README and rename of startup script.
166 # Revision 1.22 1995/05/26 11:44:09 adam
167 # Bugs fixed. More work on MARC utilities and queries. Test
168 # client is up-to-date again.
170 # Revision 1.21 1995/05/11 15:34:46 adam
171 # Scan request changed a bit. This version works with RLG.
173 # Revision 1.20 1995/04/21 16:31:57 adam
174 # New radiobutton: protocol (z39v2/SR).
176 # Revision 1.19 1995/04/18 16:11:50 adam
177 # First version of graphical Scan. Some work on query-by-form.
179 # Revision 1.18 1995/04/10 10:50:22 adam
180 # Result-set name defaults to suffix of ir-set name.
181 # Started working on scan. Not finished at this point.
183 # Revision 1.17 1995/03/31 09:34:57 adam
184 # Search-button disabled when there is no connection.
186 # Revision 1.16 1995/03/31 08:56:36 adam
187 # New button "Search".
189 # Revision 1.15 1995/03/28 12:45:22 adam
190 # New ir method failback: called on disconnect/protocol error.
191 # New ir set/get method: protocol: SR / Z3950.
192 # Simple popup and disconnect when failback is invoked.
194 # Revision 1.14 1995/03/22 16:07:55 adam
197 # Revision 1.13 1995/03/21 17:27:26 adam
198 # Short-hand keys in setup.
200 # Revision 1.12 1995/03/21 13:41:03 adam
201 # Comstack cs_create not used too often. Non-blocking connect.
203 # Revision 1.11 1995/03/21 10:39:06 adam
204 # Diagnostic error message displayed with tkerror.
206 # Revision 1.10 1995/03/20 15:24:06 adam
207 # Diagnostic records saved on searchResponse.
209 # Revision 1.9 1995/03/17 18:26:16 adam
210 # Non-blocking i/o used now. Database names popup as cascade items.
212 # Revision 1.8 1995/03/17 15:45:00 adam
213 # Improved target/database setup.
215 # Revision 1.7 1995/03/16 17:54:03 adam
216 # Minor changes really.
218 # Revision 1.6 1995/03/15 19:10:20 adam
219 # Database setup in protocol-setup (rather target setup).
221 # Revision 1.5 1995/03/15 13:59:23 adam
224 # Revision 1.4 1995/03/14 17:32:29 adam
225 # Presentation of full Marc record in popup window.
227 # Revision 1.3 1995/03/12 19:31:52 adam
228 # Pattern matching implemented when retrieving MARC records. More
229 # diagnostic functions.
231 # Revision 1.2 1995/03/10 18:00:15 adam
232 # Actual presentation in line-by-line format. RPN query support.
234 # Revision 1.1 1995/03/09 16:15:07 adam
235 # First presentRequest attempts. Hot-target list.
239 if {$tk_version == "3.6"} {
250 proc configure-enable-e {w n} {
252 $w entryconfigure $n -state normal
254 proc configure-disable-e {w n} {
256 $w entryconfigure $n -state disabled
258 set noFocus [list -takefocus 0]
260 proc configure-enable-e {w n} {
263 proc configure-disable-e {w n} {
270 if {[tk colormodel .] == "color"} {
280 if {[file readable bitmaps/book2]} {
283 if {! [file readable ${libdir}/bitmaps/book2]} {
284 puts "Cannot locate system files in ${libdir}. You must either run this"
285 puts "program from the source directory root of ir-tcl or you must assure"
286 puts "that it is installed - normally in /usr/local/lib/irtcl"
294 set profile(Default) {{} {} {210} {} 16384 8192 tcpip {} 1 {} {} Z39 1}
296 set settingsChanged 0
305 set recordSyntax None
308 set queryTypes {Simple}
309 set queryButtons { { {I 0} {I 1} {I 2} } }
310 set queryInfo { { {Title {1=4 4=1}} {Author {1=1}} \
311 {Subject {1=21}} {Any {1=1016}} } }
320 if {[winfo exists $w]} {
329 label $w.top.b -bitmap error
330 message $w.top.t -aspect 300 -text "Error: $err" \
331 -font -Adobe-Helvetica-Bold-R-Normal-*-180-*
332 pack $w.top.b $w.top.t -side left -padx 10 -pady 10
334 bottom-buttons $w [list {Close} [list destroy $w]] 1
337 proc read-formats {} {
338 global displayFormats
340 if {[catch {set formats [glob -nocomplain ${libdir}/formats/*.tcl]}]} {
341 set formats ./formats/raw.tcl
344 if {[file readable $f]} {
346 set l [string length $f]
347 set f [string range $f [string length "${libdir}/formats/"] \
349 lappend displayFormats $f
358 .data.record configure -wrap $m
364 proc set-display-format {f} {
374 .bot.a.status configure -text "Reformatting"
377 add-title-lines -1 10000 1
380 proc initBindings {} {
383 bind $w <Double-1> {}
384 bind $w <Triple-1> {}
385 bind $w <B1-Motion> {}
387 bind $w <Shift-B1-Motion> {}
389 bind $w <B2-Motion> {}
390 bind $w <Any-KeyPress> {}
392 bind $w <BackSpace> {}
394 bind $w <Control-h> {}
395 bind $w <Control-d> {}
396 bind $w <Control-v> {}
399 bind $w <B1-Motion> {}
400 bind $w <Shift-B1-Motion> {}
405 proc post-menu {wbutton wmenu} {
408 $wmenu post [winfo rootx $wbutton] \
409 [expr [winfo rooty $wbutton]+[winfo height $wbutton]]
414 global windowGeometry
415 set windowGeometry($w) [wm geometry $w]
418 global windowGeometry
421 if {[info exists windowGeometry($w)]} {
422 set g $windowGeometry($w)
427 bind $w <Destroy> [list destroyGW $w]
430 if {[file readable "clientrc.tcl"]} {
431 source "clientrc.tcl"
433 if {[file readable "${libdir}/clientrc.tcl"]} {
434 source "${libdir}/clientrc.tcl"
438 if {[file readable "~/.clientrc.tcl"]} {
439 source "~/.clientrc.tcl"
442 set queryButtonsFind [lindex $queryButtons 0]
443 set queryInfoFind [lindex $queryInfo 0]
445 proc top-down-window {w} {
446 frame $w.top -relief raised -border 1
447 frame $w.bot -relief raised -border 1
449 pack $w.top -side top -fill both -expand yes
450 pack $w.bot -fill both
453 proc top-down-ok-cancel {w ok-action g} {
454 frame $w.bot.left -relief sunken -border 1
455 pack $w.bot.left -side left -expand yes -ipadx 2 -ipady 2 -padx 1 -pady 1
456 button $w.bot.left.ok -width 4 -text {Ok} \
457 -command ${ok-action}
458 pack $w.bot.left.ok -expand yes -ipadx 1 -ipady 1 -padx 2 -pady 2
459 button $w.bot.cancel -width 5 -text {Cancel} \
460 -command [list destroy $w]
461 pack $w.bot.cancel -side left -expand yes
469 proc bottom-buttons {w buttonList g} {
471 set l [llength $buttonList]
473 frame $w.bot.$i -relief sunken -border 1
474 pack $w.bot.$i -side left -expand yes -padx 2 -pady 2
475 button $w.bot.$i.ok -text [lindex $buttonList $i] \
476 -command [lindex $buttonList [expr $i+1]]
477 pack $w.bot.$i.ok -expand yes -padx 2 -pady 2 -side left
481 button $w.bot.$i -text [lindex $buttonList $i] \
482 -command [lindex $buttonList [expr $i+1]]
483 pack $w.bot.$i -expand yes -padx 2 -pady 2 -side left
493 proc cancel-operation {} {
501 show-status Cancel 0 1
505 proc show-target {target base} {
509 .bot.a.target configure -text ""
513 .bot.a.target configure -text "$target"
515 .bot.a.target configure -text "$target - $base"
519 proc show-logo {v1} {
528 .bot.logo configure -bitmap @${libdir}/bitmaps/book${v1}
529 after 140 [list show-logo $v1]
533 .bot.logo configure -bitmap @${libdir}/bitmaps/book1
542 proc show-status {status b sb} {
549 .bot.a.status configure -text "$status"
551 if {$busy == 0} {set busy 1}
559 .top.service configure -state normal
560 .mid.search configure -state normal
562 .mid.scan configure -state normal
565 configure-disable-e .top.service.m 1
566 } elseif {[z39.$setNo nextResultSetPosition] > 0 &&
567 [z39.$setNo nextResultSetPosition] <= [z39.$setNo resultCount]} {
568 configure-enable-e .top.service.m 1
569 .mid.present configure -state normal
571 configure-disable-e .top.service.m 1
572 .mid.present configure -state disabled
574 if {[winfo exists .scan-window]} {
575 .scan-window.bot.2 configure -state normal
576 .scan-window.bot.4 configure -state normal
579 .top.service configure -state disabled
580 .mid.search configure -state disabled
581 .mid.scan configure -state disabled
582 .mid.present configure -state disabled
584 if {[winfo exists .scan-window]} {
585 .scan-window.bot.2 configure -state disabled
586 .scan-window.bot.4 configure -state disabled
591 proc show-message {msg} {
592 .bot.a.message configure -text "$msg"
595 proc insertWithTags {w text args} {
596 set start [$w index insert]
597 $w insert insert $text
598 foreach tag [$w tag names $start] {
599 $w tag remove $tag $start insert
602 $w tag add $i $start insert
606 proc popup-license {} {
611 wm title $w "License"
617 text $w.top.t -width 80 -height 10 -wrap word \
618 -yscrollcommand [list $w.top.s set]
619 scrollbar $w.top.s -command [list $w.top.t yview]
621 pack $w.top.s -side right -fill y
622 pack $w.top.t -expand yes -fill both
624 if {[file readable "${libdir}/LICENSE"]} {
625 set f [open "${libdir}/LICENSE" r]
626 while {[gets $f buf] != -1} {
627 $w.top.t insert end $buf
628 $w.top.t insert end "\n"
632 bottom-buttons $w [list {Close} [list destroy $w]] 1
635 proc about-target {} {
636 set w .about-target-w
641 wm title $w "About target"
645 frame $w.top.a -relief ridge -border 2
646 frame $w.top.p -relief ridge -border 2
648 pack $w.top.a $w.top.p -side top -fill x
650 label $w.top.a.about -text "About"
651 label $w.top.a.irtcl -text $hostid \
652 -font -Adobe-Helvetica-Bold-R-Normal-*-240-*
653 pack $w.top.a.about $w.top.a.irtcl -side top
655 set i [z39 targetImplementationName]
656 label $w.top.p.in -text "Implementation name: $i"
657 set i [z39 targetImplementationId]
658 label $w.top.p.ii -text "Implementation id: $i"
659 set i [z39 targetImplementationVersion]
660 label $w.top.p.iv -text "Implementation version: $i"
662 label $w.top.p.op -text "Protocol options: $i"
664 pack $w.top.p.in $w.top.p.ii $w.top.p.iv $w.top.p.op -side top -anchor nw
666 bottom-buttons $w [list {Close} [list destroy $w]] 1
669 proc about-origin-logo {n} {
671 set w .about-origin-w
672 if {![winfo exists $w]} {
679 $w.top.a.logo configure -bitmap @${libdir}/bitmaps/book$n
680 after 140 [list about-origin-logo $n]
683 proc about-origin {} {
684 set w .about-origin-w
687 if {[winfo exists $w]} {
692 wm title $w "About IrTcl"
696 frame $w.top.a -relief ridge -border 2
697 frame $w.top.p -relief ridge -border 2
699 pack $w.top.a $w.top.p -side top -fill x
701 label $w.top.a.irtcl -text "IrTcl" \
702 -font -Adobe-Helvetica-Bold-R-Normal-*-240-*
703 label $w.top.a.logo -bitmap @${libdir}/bitmaps/book1
704 pack $w.top.a.irtcl $w.top.a.logo -side left -expand yes
707 catch {set i [z39 implementationName]}
708 label $w.top.p.in -text "Implementation name: $i"
709 catch {set i [z39 implementationId]}
710 label $w.top.p.ii -text "Implementation id: $i"
711 catch {set i [z39 implementationVersion]}
712 label $w.top.p.iv -text "Implementation version: $i"
714 pack $w.top.p.in $w.top.p.ii $w.top.p.iv -side top -anchor nw
717 bottom-buttons $w [list {Close} [list destroy $w] \
718 {License} [list popup-license]] 0
721 proc popup-marc {sno no b df} {
723 global displayFormats
726 if {[z39.$sno type $no] != "DB"} {
730 set w .full-marc-$fullMarcSeq
737 if {[winfo exists $w]} {
745 frame $w.top -relief raised -border 1
746 frame $w.bot -relief raised -border 1
748 pack $w.top -side top -fill both -expand yes
749 pack $w.bot -fill both
751 text $w.top.record -width 60 -height 5 -wrap word \
752 -yscrollcommand [list $w.top.s set]
753 scrollbar $w.top.s -command [list $w.top.record yview]
757 $w.top.record tag configure marc-tag -foreground blue
758 $w.top.record tag configure marc-id -foreground red
760 $w.top.record tag configure marc-tag -foreground black
761 $w.top.record tag configure marc-id -foreground black
763 $w.top.record tag configure marc-data -foreground black
766 $w.top.record delete 0.0 end
767 set recordType [z39.$sno recordType $no]
768 wm title $w "$recordType record #$no"
771 bind $w.top.record <Return> {destroy .full-marc}
773 pack $w.top.s -side right -fill y
774 pack $w.top.record -expand yes -fill both
777 bottom-buttons $w [list \
778 {Close} [list destroy $w]] 0
780 bottom-buttons $w [list \
781 {Close} [list destroy $w] \
782 {Duplicate} [list popup-marc $sno $no 1 0]] 0
783 menubutton $w.bot.formats -text "Format" -menu $w.bot.formats.m
784 menu $w.bot.formats.m
786 foreach f $displayFormats {
787 $w.bot.formats.m add radiobutton -label $f \
788 -variable popupMarcdf -value $i \
789 -command [list display-$f $sno $no $w.top.record 0]
792 pack $w.bot.formats -expand yes -ipadx 2 -ipady 2 \
793 -padx 3 -pady 3 -side left
797 $w.bot.formats.m delete 0 last
798 foreach f $displayFormats {
799 $w.bot.formats.m add radiobutton -label $f \
800 -variable popupMarcdf -value $i \
801 -command [list display-$f $sno $no $w.top.record 0]
805 set ffunc [lindex $displayFormats $df]
806 set ffunc "display-$ffunc"
808 $ffunc $sno $no $w.top.record 0
811 proc update-target-hotlist {target base} {
814 set olen [llength $hotTargets]
816 foreach e $hotTargets {
817 if {$target == [lindex $e 0] && $base == [lindex $e 1]} {
818 set hotTargets [lreplace $hotTargets $i $i]
823 set hotTargets [linsert $hotTargets 0 [list $target $base]]
824 set-target-hotlist $olen
827 proc delete-target-hotlist {target} {
830 set olen [llength $hotTargets]
832 foreach e $hotTargets {
833 if {$target == [lindex $e 0]} {
834 set hotTargets [lreplace $hotTargets $i $i]
838 set-target-hotlist $olen
841 proc set-target-hotlist {olen} {
846 .top.target.m delete 7 [expr 7+$olen]
848 .top.target.m delete 6 [expr 6+$olen]
852 foreach e $hotTargets {
853 set target [lindex $e 0]
854 set base [lindex $e 1]
856 .top.target.m add command -label "$i $target" -command \
857 [list reopen-target $target {}]
859 .top.target.m add command -label "$i $target - $base" -command \
860 [list reopen-target $target $base]
869 proc reopen-target {target base} {
871 open-target $target $base
872 update-target-hotlist $target $base
875 proc define-target-action {} {
878 set target [.target-define.top.target.entry get]
882 foreach n [array names profile] {
888 set seq [lindex $profile(Default) 12]
890 set profile($target) $profile(Default)
891 set profile(Default) [lreplace $profile(Default) 12 12 [incr seq]]
893 protocol-setup $target
894 destroy .target-define
897 proc fail-response {target} {
898 set c [lindex [z39 failInfo] 0]
899 set m [lindex [z39 failInfo] 1]
904 proc connect-response {target base} {
905 dputs "connect-response"
906 show-target $target $base
910 proc open-target {target base} {
915 z39 comstack [lindex $profile($target) 6]
916 z39 protocol [lindex $profile($target) 11]
917 z39 idAuthentication [lindex $profile($target) 3]
918 z39 maximumRecordSize [lindex $profile($target) 4]
919 z39 preferredMessageSize [lindex $profile($target) 5]
920 dputs "maximumRecordSize="
921 dputs [z39 maximumRecordSize]
922 dputs "preferredMessageSize="
923 dputs [z39 preferredMessageSize]
924 show-status Connecting 1 0
926 z39 databaseNames [lindex [lindex $profile($target) 7] 0]
928 z39 databaseNames $base
930 z39 failback [list fail-response $target]
931 z39 callback [list connect-response $target $base]
934 z39 connect [lindex $profile($target) 1]:[lindex $profile($target) 2]
937 tkerror $errorMessage
938 show-status "Not connected" 0 {}
942 configure-disable-e .top.target.m 0
943 configure-enable-e .top.target.m 1
944 configure-enable-e .top.target.m 2
947 proc close-target {} {
956 .bot.a.set configure -text ""
960 show-status {Not connected} 0 0
963 configure-disable-e .top.target.m 1
964 configure-disable-e .top.target.m 2
966 .top.rset.m delete 2 last
968 .top.rset.m delete 1 last
970 .top.rset.m add separator
971 configure-enable-e .top.target.m 0
974 proc load-set-action {} {
978 ir-set z39.$setNoLast z39
980 set fname [.load-set.top.filename.entry get]
983 show-status Loading 1 {}
985 z39.$setNoLast loadFile $fname
987 set no [z39.$setNoLast numberOfRecordsReturned]
988 add-title-lines $setNoLast $no 1
990 set l [format "%-4d %7d" $setNoLast $no]
991 .top.rset.m add command -label $l \
992 -command [list add-title-lines $setNoLast 10000 1]
993 show-status Ready 0 {}
1003 frame $w.top.filename
1004 pack $w.top.filename -side top -anchor e -pady 2
1006 entry-fields $w.top {filename} \
1008 {load-set-action} {destroy .load-set}
1010 top-down-ok-cancel $w {load-set-action} 1
1014 proc init-request {} {
1021 z39 callback {init-response}
1022 show-status Initializing 1 {}
1023 set err [catch {z39 init} errorMessage]
1025 tkerror $errorMessage
1026 show-status Ready 0 {}
1030 proc init-response {} {
1038 if {![z39 initResult]} {
1039 show-status Ready 0 1
1040 set u [z39 userInformationField]
1042 tkerror "Connection rejected by target: $u"
1044 if {[lsearch [z39 options] scan] >= 0} {
1049 show-status Ready 0 1
1053 proc search-request {bflag} {
1065 dputs "search-request"
1067 if {!$bflag && $busy} {
1068 dputs "busy: search-request ignored"
1073 show-status Searching 1 0
1074 set delayRequest {search-request 1}
1079 set query [index-query]
1084 set setNo $setNoLast
1085 ir-set z39.$setNo z39
1087 if {[lindex $profile($target) 10] == 1} {
1088 z39.$setNo setName $setNo
1089 dputs "setName=${setNo}"
1091 z39.$setNo setName Default
1092 dputs "setName=Default"
1094 if {[lindex $profile($target) 8] == 1} {
1095 z39.$setNo queryType rpn
1097 if {[lindex $profile($target) 9] == 1} {
1098 z39.$setNo queryType ccl
1102 if {$recordSyntax == "None" } {
1103 z39.$setNo preferredRecordSyntax {}
1105 z39.$setNo preferredRecordSyntax $recordSyntax
1107 z39 callback {search-response}
1108 z39.$setNo search $query
1109 show-status Searching 1 0
1112 proc scan-copy {y entry} {
1114 set no [$w.top.list nearest $y]
1116 .lines.$entry.e delete 0 end
1117 .lines.$entry.e insert 0 [string range [$w.top.list get $no] 8 end]
1120 proc scan-request {} {
1127 global curIndexEntry
1128 global queryButtonsFind
1129 global queryInfoFind
1133 dputs "scan-request"
1136 show-status Scanning 1 0
1137 set delayRequest scan-request
1146 set b [lindex $queryButtonsFind $curIndexEntry]
1148 foreach a [lrange [lindex $queryInfoFind [lindex $b 1]] 1 end] {
1149 set attr "@attr $a $attr"
1151 set title [lindex [lindex $queryInfoFind [lindex $b 1]] 0]
1152 ir-scan z39.scan z39
1154 if {![winfo exists $w]} {
1161 entry $w.top.entry -relief sunken
1162 pack $w.top.entry -fill x -padx 4 -pady 2
1163 bind $w.top.entry <KeyRelease> [list scan-term-h $attr]
1164 listbox $w.top.list -yscrollcommand [list $w.top.scroll set] \
1166 scrollbar $w.top.scroll -orient vertical -border 1
1167 pack $w.top.list -side left -fill both -expand yes
1168 pack $w.top.scroll -side right -fill y
1169 $w.top.scroll config -command [list $w.top.list yview]
1171 bottom-buttons $w [list {Close} [list destroy $w] \
1172 {Up} [list scan-up $attr] \
1173 {Down} [list scan-down $attr]] 0
1174 bind $w.top.list <Up> [list scan-up $attr]
1175 bind $w.top.list <Down> [list scan-down $attr]
1178 bind $w.top.list <Double-Button-1> [list scan-copy %y $curIndexEntry]
1179 wm title $w "Scan $title"
1181 z39 callback [list scan-response $attr 0 35]
1182 z39.scan numberOfTermsRequested 5
1183 z39.scan preferredPositionInResponse 1
1184 z39.scan scan "${attr} 0"
1186 show-status Scanning 1 0
1189 proc scan-term-h {attr} {
1197 set nScanTerm [$w.top.entry get]
1198 if {$nScanTerm == $scanTerm} {
1201 set scanTerm $nScanTerm
1202 z39 callback [list scan-response $attr 0 35]
1203 z39.scan numberOfTermsRequested 5
1204 z39.scan preferredPositionInResponse 1
1205 dputs "${attr} \{${scanTerm}\}"
1206 if {$scanTerm == ""} {
1207 z39.scan scan "${attr} 0"
1209 z39.scan scan "${attr} \{${scanTerm}\}"
1211 show-status Scanning 1 0
1214 proc scan-response {attr start toget} {
1221 dputs "In scan-response"
1222 set m [z39.scan numberOfEntriesReturned]
1228 if {![winfo exists .scan-window]} {
1231 dputs "Handling cancel"
1232 if {$delayRequest != ""} {
1237 show-status Ready 0 1
1240 set nScanTerm [$w.top.entry get]
1241 if {$nScanTerm != $scanTerm} {
1242 z39 callback [list scan-response $attr 0 35]
1243 z39.scan numberOfTermsRequested 5
1244 z39.scan preferredPositionInResponse 1
1245 set scanTerm $nScanTerm
1246 dputs "${attr} \{${scanTerm}\}"
1247 if {$scanTerm == ""} {
1248 z39.scan scan "${attr} 0"
1250 z39.scan scan "${attr} \{${scanTerm}\}"
1252 show-status Scanning 1 0
1255 set status [z39.scan scanStatus]
1258 show-status Ready 0 1
1263 for {set i 0} {$i < $m} {incr i} {
1264 set term [lindex [z39.scan scanLine $i] 1]
1265 set nostr [format " %-6d" [lindex [z39.scan scanLine $i] 2]]
1266 $w.top.list insert $i "$nostr $term"
1269 $w.top.list yview $scanView
1271 $w.top.list delete $start end
1272 for {set i 0} {$i < $m} {incr i} {
1273 set term [lindex [z39.scan scanLine $i] 1]
1274 set nostr [format " %-6d" [lindex [z39.scan scanLine $i] 2]]
1275 $w.top.list insert end "$nostr $term"
1279 dputs "Handling cancel"
1281 if {$delayRequest != ""} {
1287 if {$toget > 0 && $m > 1 && $m < $toget} {
1288 set ntoget [expr $toget - $m + 1]
1289 dputs ntoget=$ntoget
1290 z39 callback [list scan-response $attr [expr $start + $m - 1] $ntoget]
1292 dputs "down continue: $q"
1294 z39.scan numberOfTermsRequested 10
1296 z39.scan numberOfTermsRequested $ntoget
1298 z39.scan preferredPositionInResponse 1
1299 dputs "${attr} \{$q\}"
1300 z39.scan scan "${attr} \{$q\}"
1303 if {$toget < 0 && $m > 1 && $m < [expr - $toget]} {
1304 set ntoget [expr - $toget - $m]
1305 dputs ntoget=$ntoget
1306 z39 callback [list scan-response $attr 0 -$ntoget]
1307 set q [string range [$w.top.list get 0] 8 end]
1308 dputs "up continue: $q"
1310 z39.scan numberOfTermsRequested 10
1311 z39.scan preferredPositionInResponse 11
1313 z39.scan numberOfTermsRequested $ntoget
1314 z39.scan preferredPositionInResponse [incr ntoget]
1316 dputs "${attr} \{$q\}"
1317 z39.scan scan "${attr} \{$q\}"
1320 show-status Ready 0 1
1323 proc scan-down {attr} {
1331 show-status {Scanning down} 1 0
1332 set delayRequest [list scan-down $attr]
1338 set scanView [expr $scanView + 5]
1339 set s [$w.top.list size]
1340 if {$scanView > $s} {
1341 z39 callback [list scan-response $attr [expr $s - 1] 25]
1342 set q [string range [$w.top.list get [expr $s - 1]] 8 end]
1344 z39.scan numberOfTermsRequested 10
1345 z39.scan preferredPositionInResponse 1
1346 show-status Scanning 1 0
1347 dputs "${attr} \{$q\}"
1348 z39.scan scan "${attr} \{$q\}"
1351 $w.top.list yview $scanView
1354 proc scan-up {attr} {
1362 show-status Scanning 1 0
1363 set delayRequest [list scan-up $attr]
1369 set scanView [expr $scanView - 5]
1370 if {$scanView < 0} {
1371 z39 callback [list scan-response $attr 0 -25]
1372 set q [string range [$w.top.list get 0] 8 end]
1374 z39.scan numberOfTermsRequested 10
1375 z39.scan preferredPositionInResponse 11
1376 show-status Scanning 1 0
1377 z39.scan scan "${attr} \{$q\}"
1380 $w.top.list yview $scanView
1383 proc search-response {} {
1391 dputs "In search-response"
1393 dputs "Handling cancel"
1395 if {$delayRequest != ""} {
1403 set setMax [z39.$setNo resultCount]
1404 show-status Ready 0 1
1405 set status [z39.$setNo responseStatus]
1406 if {[lindex $status 0] == "NSD"} {
1407 z39.$setNo nextResultSetPosition 0
1408 set code [lindex $status 1]
1409 set msg [lindex $status 2]
1410 set addinfo [lindex $status 3]
1411 tkerror "NSD$code: $msg: $addinfo"
1414 show-message "${setMax} hits"
1419 show-status Ready 0 1
1420 set l [format "%-4d %7d" $setNo $setMax]
1421 .top.rset.m add command -label $l \
1422 -command [list add-title-lines $setNo 10000 1]
1426 z39 callback {present-response}
1427 z39.$setNo present $setOffset 1
1428 show-status Retrieving 1 0
1431 proc present-more {number} {
1439 dputs "present-more"
1441 show-status Retrieving 1 0
1442 set delayRequest "present-more $number"
1448 dputs "setNo=$setNo"
1451 set setOffset [z39.$setNo nextResultSetPosition]
1452 dputs "setOffest=${setOffset}"
1453 dputs "setNo=${setNo}"
1454 set max [z39.$setNo resultCount]
1455 if {$max < $setOffset} {
1457 dputs "setOffset=$setOffset"
1458 show-status Ready 0 1
1461 if {$number == ""} {
1465 if {$setMax > $max} {
1469 z39 callback {present-response}
1471 set toGet [expr $setMax - $setOffset + 1]
1478 z39.$setNo present $setOffset $toGet
1479 show-status Retrieving 1 0
1482 proc init-title-lines {} {
1483 .data.record delete 0.0 end
1486 proc title-press {y setno} {
1487 show-full-marc $setno [expr 1 + [.data.list nearest $y]] 0
1490 proc add-title-lines {setno no offset} {
1491 global displayFormats
1492 global displayFormat
1502 .bot.a.set configure -text $setno
1503 .data.record delete 0.0 end
1505 set ffunc [lindex $displayFormats $displayFormat]
1506 dputs "ffunc=$ffunc"
1507 set ffunc "display-$ffunc"
1508 for {set i 0} {$i < $no} {incr i} {
1509 set o [expr $i + $offset]
1510 set type [z39.$setno type $o]
1514 .data.record tag bind r$o <Any-Enter> {}
1515 .data.record tag bind r$o <Any-Leave> {}
1516 set insert0 [.data.record index insert]
1517 $ffunc $setno $o .data.record 1
1518 .data.record tag add r$o $insert0 insert
1519 .data.record tag bind r$o <1> \
1520 [list popup-marc $setno $o 0 0]
1524 show-status Ready 0 1
1528 proc present-response {} {
1535 dputs "In present-response"
1536 set no [z39.$setNo numberOfRecordsReturned]
1537 dputs "Returned $no records, setOffset $setOffset"
1538 add-title-lines $setNo $no $setOffset
1539 set setOffset [expr $setOffset + $no]
1541 dputs "Handling cancel"
1543 if {$delayRequest != ""} {
1548 set status [z39.$setNo responseStatus]
1549 if {[lindex $status 0] == "NSD"} {
1550 show-status Ready 0 1
1551 set code [lindex $status 1]
1552 set msg [lindex $status 2]
1553 set addinfo [lindex $status 3]
1554 tkerror "NSD$code: $msg: $addinfo"
1557 if {$no > 0 && $setOffset <= $setMax} {
1558 dputs "present-request from ${setOffset}"
1559 set toGet [expr $setMax - $setOffset + 1]
1563 z39.$setNo present $setOffset $toGet
1565 show-status Ready 0 1
1569 proc left-cursor {w} {
1570 set i [$w index insert]
1578 proc right-cursor {w} {
1579 set i [$w index insert]
1585 proc bind-fields {list returnAction escapeAction} {
1586 set max [expr [llength $list]-1]
1587 for {set i 0} {$i < $max} {incr i} {
1588 bind [lindex $list $i] <Return> $returnAction
1589 bind [lindex $list $i] <Escape> $escapeAction
1591 bind [lindex $list $i] <Tab> \
1592 [list focus [lindex $list [expr $i+1]]]
1593 bind [lindex $list $i] <Left> \
1594 [list left-cursor [lindex $list $i]]
1595 bind [lindex $list $i] <Right> \
1596 [list right-cursor [lindex $list $i]]
1599 bind [lindex $list $i] <Return> $returnAction
1600 bind [lindex $list $i] <Escape> $escapeAction
1602 bind [lindex $list $i] <Tab> [list focus [lindex $list 0]]
1603 bind [lindex $list $i] <Left> [list left-cursor [lindex $list $i]]
1604 bind [lindex $list $i] <Right> [list right-cursor [lindex $list $i]]
1606 focus [lindex $list 0]
1609 proc entry-fields {parent list tlist returnAction escapeAction} {
1612 foreach field $list {
1613 set label ${parent}.${field}.label
1614 set entry ${parent}.${field}.entry
1615 label $label -text [lindex $tlist $i] -anchor e
1616 entry $entry -width 32 -relief sunken
1617 pack $label -side left
1618 pack $entry -side right
1619 lappend alist $entry
1622 bind-fields $alist $returnAction $escapeAction
1625 proc define-target-dialog {} {
1626 set w .target-define
1632 pack $w.top.target \
1633 -side top -anchor e -pady 2
1634 entry-fields $w.top {target} \
1636 {define-target-action} {destroy .target-define}
1637 top-down-ok-cancel $w {define-target-action} 1
1640 proc protocol-setup-delete {target} {
1642 global settingsChanged
1644 set a [alert "Are you sure you want to delete the target \
1645 definition $target ?"]
1647 set wno [lindex $profile($target) 12]
1650 unset profile($target)
1651 set settingsChanged 1
1653 delete-target-hotlist $target
1657 proc protocol-setup-action {target} {
1660 global protocolRadioType
1661 global settingsChanged
1664 global ResultSetCheck
1666 set wno [lindex $profile($target) 12]
1670 set settingsChanged 1
1671 set len [$w.top.databases.list size]
1672 for {set i 0} {$i < $len} {incr i} {
1673 lappend b [$w.top.databases.list get $i]
1675 set profile($target) [list [$w.top.description.entry get] \
1676 [$w.top.host.entry get] \
1677 [$w.top.port.entry get] \
1678 [$w.top.idAuthentication.entry get] \
1679 [$w.top.maximumRecordSize.entry get] \
1680 [$w.top.preferredMessageSize.entry get] \
1686 $protocolRadioType \
1690 delete-target-hotlist $target
1691 dputs $profile($target)
1695 proc place-force {window parent} {
1696 set g [wm geometry $parent]
1698 set p1 [string first + $g]
1699 set p2 [string last + $g]
1701 set x [expr 40+[string range $g [expr $p1 +1] [expr $p2 -1]]]
1702 set y [expr 60+[string range $g [expr $p2 +1] end]]
1703 wm geometry $window +${x}+${y}
1706 proc add-database-action {target} {
1709 set wno [lindex $profile($target) 12]
1712 $w.top.databases.list insert end \
1713 [.database-select.top.database.entry get]
1714 destroy .database-select
1717 proc add-database {target} {
1720 set w .database-select
1722 set oldFocus [focus]
1724 set wno [lindex $profile($target) 12]
1725 place-force $w .setup-${wno}
1729 frame $w.top.database
1731 pack $w.top.database -side top -anchor e -pady 2
1733 entry-fields $w.top {database} \
1734 {{Database to add:}} \
1735 [list add-database-action $target] {destroy .database-select}
1737 top-down-ok-cancel $w [list add-database-action $target] 1
1741 proc delete-database {target} {
1744 set wno [lindex $profile($target) 12]
1747 foreach i [$w.top.databases.list curselection] {
1748 set b [$w.top.databases.list get $i]
1751 set a [alert "Are you sure you want to remove the database(s)${l}?"]
1753 foreach i [lsort -decreasing \
1754 [$w.top.databases.list curselection]] {
1755 $w.top.databases.list delete $i
1760 proc protocol-setup {target} {
1763 global protocolRadioType
1766 global ResultSetCheck
1768 set wno [lindex $profile($target) 12]
1773 wm title $w "Setup $target"
1777 if {$target == ""} {
1781 dputs $profile($target)
1783 frame $w.top.description
1786 frame $w.top.idAuthentication
1787 frame $w.top.maximumRecordSize
1788 frame $w.top.preferredMessageSize
1789 frame $w.top.cs-type -relief ridge -border 2
1790 frame $w.top.protocol -relief ridge -border 2
1791 frame $w.top.query -relief ridge -border 2
1792 frame $w.top.databases -relief ridge -border 2
1794 # Maximum/preferred/idAuth ...
1795 pack $w.top.description $w.top.host $w.top.port \
1796 $w.top.idAuthentication $w.top.maximumRecordSize \
1797 $w.top.preferredMessageSize -side top -anchor e -pady 2
1799 entry-fields $w.top {description host port idAuthentication \
1800 maximumRecordSize preferredMessageSize} \
1801 {{Description:} {Host:} {Port:} {Id Authentication:} \
1802 {Maximum Record Size:} {Preferred Message Size:}} \
1803 [list protocol-setup-action $target] [list destroy $w]
1805 foreach sub {description host port idAuthentication \
1806 maximumRecordSize preferredMessageSize} {
1808 bind $w.top.$sub.entry <Control-a> [list add-database $target]
1809 bind $w.top.$sub.entry <Control-d> [list delete-database $target]
1811 $w.top.description.entry insert 0 [lindex $profile($target) 0]
1812 $w.top.host.entry insert 0 [lindex $profile($target) 1]
1813 $w.top.port.entry insert 0 [lindex $profile($target) 2]
1814 $w.top.idAuthentication.entry insert 0 [lindex $profile($target) 3]
1815 $w.top.maximumRecordSize.entry insert 0 [lindex $profile($target) 4]
1816 $w.top.preferredMessageSize.entry insert 0 [lindex $profile($target) 5]
1817 set csRadioType [lindex $profile($target) 6]
1818 set RPNCheck [lindex $profile($target) 8]
1819 set CCLCheck [lindex $profile($target) 9]
1820 set ResultSetCheck [lindex $profile($target) 10]
1821 set protocolRadioType [lindex $profile($target) 11]
1822 if {$protocolRadioType == ""} {
1823 set protocolRadioType Z39
1827 pack $w.top.databases -side left -pady 2 -padx 2 -expand yes -fill both
1829 label $w.top.databases.label -text "Databases"
1830 button $w.top.databases.add -text "Add" \
1831 -command [list add-database $target]
1832 button $w.top.databases.delete -text "Delete" \
1833 -command [list delete-database $target]
1835 listbox $w.top.databases.list -geometry 14x6 \
1836 -yscrollcommand "$w.top.databases.scroll set"
1838 listbox $w.top.databases.list -width 14 -height 5\
1839 -yscrollcommand "$w.top.databases.scroll set"
1841 scrollbar $w.top.databases.scroll -orient vertical -border 1
1842 pack $w.top.databases.label -side top -fill x \
1844 pack $w.top.databases.add $w.top.databases.delete -side top -fill x \
1846 pack $w.top.databases.list -side left -fill both -expand yes \
1848 pack $w.top.databases.scroll -side right -fill y \
1850 $w.top.databases.scroll config -command "$w.top.databases.list yview"
1852 foreach b [lindex $profile($target) 7] {
1853 $w.top.databases.list insert end $b
1857 pack $w.top.cs-type -pady 2 -padx 2 -side top -fill x
1859 label $w.top.cs-type.label -text "Transport"
1860 radiobutton $w.top.cs-type.tcpip -text "TCP/IP" -anchor w \
1861 -variable csRadioType -value tcpip
1862 radiobutton $w.top.cs-type.mosi -text "MOSI" -anchor w\
1863 -variable csRadioType -value mosi
1865 pack $w.top.cs-type.label $w.top.cs-type.tcpip $w.top.cs-type.mosi \
1866 -padx 2 -side top -fill x
1869 pack $w.top.protocol -pady 2 -padx 2 -side top -fill x
1871 label $w.top.protocol.label -text "Protocol"
1872 radiobutton $w.top.protocol.z39v2 -text "Z39.50" -anchor w \
1873 -variable protocolRadioType -value Z39
1874 radiobutton $w.top.protocol.sr -text "SR" -anchor w \
1875 -variable protocolRadioType -value SR
1877 pack $w.top.protocol.label $w.top.protocol.z39v2 $w.top.protocol.sr \
1878 -padx 2 -side top -fill x
1881 pack $w.top.query -pady 2 -padx 2 -side top -fill x
1883 label $w.top.query.label -text "Query support"
1884 checkbutton $w.top.query.c1 -text "RPN query" -anchor w -variable RPNCheck
1885 checkbutton $w.top.query.c2 -text "CCL query" -anchor w -variable CCLCheck
1886 checkbutton $w.top.query.c3 -text "Result sets" -anchor w -variable ResultSetCheck
1888 pack $w.top.query.label -side top
1889 pack $w.top.query.c1 $w.top.query.c2 $w.top.query.c3 \
1890 -padx 2 -side top -fill x
1893 bottom-buttons $w [list {Ok} [list protocol-setup-action $target] \
1894 {Delete} [list protocol-setup-delete $target] \
1895 {Cancel} [list destroy $w]] 0
1898 proc database-select-action {} {
1899 set w .database-select.top
1901 foreach indx [$w.databases.list curselection] {
1902 lappend b [$w.databases.list get $indx]
1905 z39 databaseNames $b
1907 destroy .database-select
1910 proc database-select {} {
1911 set w .database-select
1916 set oldFocus [focus]
1921 frame $w.top.databases -relief ridge -border 2
1923 pack $w.top.databases -side left -pady 6 -padx 6 -expand yes -fill x
1925 label $w.top.databases.label -text "List"
1926 listbox $w.top.databases.list -width 20 -height 6 \
1927 -yscrollcommand "$w.top.databases.scroll set"
1928 scrollbar $w.top.databases.scroll -orient vertical -border 1
1929 pack $w.top.databases.label -side top -fill x \
1931 pack $w.top.databases.list -side left -fill both -expand yes \
1933 pack $w.top.databases.scroll -side right -fill y \
1935 $w.top.databases.scroll config -command "$w.top.databases.list yview"
1937 foreach b [lindex $profile($hostid) 7] {
1938 $w.top.databases.list insert end $b
1940 top-down-ok-cancel $w {database-select-action} 1
1944 proc cascade-target-list {} {
1947 foreach sub [winfo children .top.target.m.clist] {
1950 .top.target.m.clist delete 0 last
1951 foreach n [lsort [array names profile]] {
1952 if {$n != "Default"} {
1953 set nl [lindex $profile($n) 12]
1954 if {[llength [lindex $profile($n) 7]] > 1} {
1955 .top.target.m.clist add cascade -label $n \
1956 -menu .top.target.m.clist.$nl
1957 menu .top.target.m.clist.$nl
1958 foreach b [lindex $profile($n) 7] {
1959 .top.target.m.clist.$nl add command -label $b \
1960 -command [list reopen-target $n $b]
1963 .top.target.m.clist add command -label $n \
1964 -command [list reopen-target $n {}]
1968 .top.target.m.slist delete 0 last
1969 foreach n [lsort [array names profile]] {
1970 if {$n != "Default"} {
1971 .top.target.m.slist add command -label $n \
1972 -command [list protocol-setup $n]
1977 proc query-select {i} {
1978 global queryButtonsFind
1979 global queryInfoFind
1983 set queryInfoFind [lindex $queryInfo $i]
1984 set queryButtonsFind [lindex $queryButtons $i]
1986 index-lines .lines 1 $queryButtonsFind $queryInfoFind activate-index
1989 proc query-new-action {} {
1993 global settingsChanged
1995 set settingsChanged 1
1996 lappend queryTypes [.query-new.top.index.entry get]
1997 lappend queryButtons {}
1998 lappend queryInfo {}
2008 set oldFocus [focus]
2013 -side top -anchor e -pady 2
2014 entry-fields $w.top index \
2016 query-new-action {destroy .query-new}
2017 top-down-ok-cancel $w query-new-action 1
2021 proc query-delete-action {queryNo} {
2025 global settingsChanged
2027 set settingsChanged 1
2029 set queryTypes [lreplace $queryTypes $queryNo $queryNo]
2030 set queryButtons [lreplace $queryButtons $queryNo $queryNo]
2031 set queryInfo [lreplace $queryInfo $queryNo $queryNo]
2032 destroy .query-delete
2036 proc query-delete {queryNo} {
2044 set n [lindex $queryTypes $queryNo]
2046 label $w.top.warning -bitmap warning
2047 message $w.top.quest -text "Are you sure you want to delete the \
2048 query type $n ?" -aspect 300
2049 pack $w.top.warning $w.top.quest -side left -expand yes -padx 10 -pady 5
2050 bottom-buttons $w [list {Ok} [list query-delete-action $queryNo] \
2051 {Cancel} [list destroy $w]] 1
2054 proc cascade-query-list {} {
2056 set w .top.options.m.query
2059 $w.slist delete 0 last
2060 foreach n $queryTypes {
2061 $w.slist add command -label $n -command [list query-setup $i]
2066 $w.clist delete 0 last
2067 foreach n $queryTypes {
2068 $w.clist add command -label $n -command [list query-select $i]
2072 $w.dlist delete 0 last
2073 foreach n $queryTypes {
2074 $w.dlist add command -label $n -command [list query-delete $i]
2079 proc save-geometry {} {
2080 global windowGeometry
2083 global displayFormat
2087 set windowGeometry(.) [wm geometry .]
2089 if {[catch {set f [open ~/.clientrc.tcl w]}]} {
2092 puts $f "set hotTargets \{ $hotTargets \}"
2093 puts $f "set textWrap $textWrap"
2094 puts $f "set displayFormat $displayFormat"
2095 puts $f "set popupMarcdf $popupMarcdf"
2096 puts $f "set recordSyntax $recordSyntax"
2097 foreach n [array names windowGeometry] {
2098 puts -nonewline $f "set \{windowGeometry($n)\} \{"
2099 puts -nonewline $f $windowGeometry($n)
2105 proc save-settings {} {
2108 global settingsChanged
2113 if {![file writable "${libdir}/clientrc.tcl"]} {
2114 set a [alert "Cannot open ${libdir}/clientrc.tcl for writing. Do you \
2115 wish to save clientrc.tcl in the current directory instead?"]
2119 set f [open "clientrc.tcl" w]
2121 set f [open "${libdir}/clientrc.tcl" w]
2123 puts $f "# Setup file"
2125 foreach n [array names profile] {
2126 puts -nonewline $f "set \{profile($n)\} \{"
2127 puts -nonewline $f $profile($n)
2130 puts -nonewline $f "set queryTypes \{"
2131 puts -nonewline $f $queryTypes
2134 puts -nonewline $f "set queryButtons \{"
2135 puts -nonewline $f $queryButtons
2138 puts -nonewline $f "set queryInfo \{"
2139 puts -nonewline $f $queryInfo
2142 set settingsChanged 0
2151 set oldFocus [focus]
2155 label $w.top.warning -bitmap warning
2156 message $w.top.message -text $ask -aspect 300 \
2157 -font -Adobe-Times-Medium-R-Normal-*-180-*
2159 pack $w.top.warning $w.top.message -side left -pady 5 -padx 10 -expand yes
2162 top-down-ok-cancel $w {alert-action} 1
2167 proc alert-action {} {
2173 proc exit-action {} {
2174 global settingsChanged
2176 if {$settingsChanged} {
2177 set a [alert "you haven't saved your settings. Do you wish to save?"]
2186 proc listbuttonaction {w name h user i} {
2187 $w configure -text [lindex $name 0]
2188 $h [lindex $name 1] $user $i
2191 proc listbuttonx {button no names handle user} {
2192 if {[winfo exists $button]} {
2193 $button configure -text [lindex [lindex $names $no] 0]
2194 ${button}.m delete 0 last
2196 menubutton $button -text [lindex [lindex $names $no] 0] \
2197 -width 10 -menu ${button}.m -relief raised -border 1
2201 foreach name $names {
2202 ${button}.m add command -label [lindex $name 0] \
2203 -command [list listbuttonaction ${button} $name \
2209 proc listbutton {button no names} {
2210 menubutton $button -text [lindex $names $no] -width 10 -menu ${button}.m \
2211 -relief raised -border 1
2213 foreach name $names {
2214 ${button}.m add command -label $name \
2215 -command [list ${button} configure -text $name]
2219 proc listbuttonv-action {button var names i} {
2222 set $var [lindex $names [expr $i+1]]
2223 $button configure -text [lindex $names $i]
2226 proc listbuttonv {button var names} {
2230 eval "set val $$var"
2231 set l [llength $names]
2232 for {set i 1} {$i < $l} {incr i 2} {
2233 if {$val == [lindex $names $i]} {
2235 set n [lindex $names $i]
2239 if {[winfo exists $button]} {
2240 $button configure -text $n
2243 menubutton $button -text $n -menu ${button}.m \
2244 -relief raised -border 1
2246 for {set i 0} {$i < $l} {incr i 2} {
2247 ${button}.m add command -label [lindex $names $i] \
2248 -command [list listbuttonv-action $button $var $names $i]
2252 proc query-add-index-action {queryNo} {
2256 global queryButtonsTmp
2258 set newI [.query-add-index.top.index.entry get]
2259 lappend queryInfoTmp [list $newI {}]
2260 $w.top.index.list insert end $newI
2261 destroy .query-add-index
2262 #destroy $w.top.lines
2263 #frame $w.top.lines -relief ridge -border 2
2264 index-lines $w.top.lines 0 $queryButtonsTmp $queryInfoTmp activate-e-index
2265 #pack $w.top.lines -side left -pady 6 -padx 6 -fill y
2268 proc query-add-line {queryNo} {
2272 global queryButtonsTmp
2274 lappend queryButtonsTmp {I 0}
2276 #destroy $w.top.lines
2277 #frame $w.top.lines -relief ridge -border 2
2278 index-lines $w.top.lines 0 $queryButtonsTmp $queryInfoTmp activate-e-index
2279 #pack $w.top.lines -side left -pady 6 -padx 6 -fill y
2282 proc query-del-line {queryNo} {
2286 global queryButtonsTmp
2288 set l [llength $queryButtonsTmp]
2293 set queryButtonsTmp [lreplace $queryButtonsTmp $l $l]
2294 index-lines $w.top.lines 0 $queryButtonsTmp $queryInfoTmp activate-e-index
2297 proc query-add-index {queryNo} {
2298 set w .query-add-index
2301 set oldFocus [focus]
2302 place-force $w .query-setup
2306 -side top -anchor e -pady 2
2307 entry-fields $w.top {index} \
2309 [list query-add-index-action $queryNo] [list destroy $w]
2310 top-down-ok-cancel $w [list query-add-index-action $queryNo] 1
2314 proc query-setup-action {queryNo} {
2317 global queryButtonsTmp
2319 global queryButtonsFind
2320 global queryInfoFind
2322 global settingsChanged
2324 set settingsChanged 1
2326 set queryInfo [lreplace $queryInfo $queryNo $queryNo \
2328 set queryButtons [lreplace $queryButtons $queryNo $queryNo \
2330 set queryInfoFind $queryInfoTmp
2331 set queryButtonsFind $queryButtonsTmp
2333 destroy .query-setup
2334 index-lines .lines 1 $queryButtonsFind $queryInfoFind activate-index
2337 proc activate-e-index {value no i} {
2338 global queryButtonsTmp
2339 global queryIndexTmp
2341 set queryButtonsTmp [lreplace $queryButtonsTmp $no $no [list I $i]]
2342 dputs $queryButtonsTmp
2343 set queryIndexTmp $i
2346 proc activate-index {value no i} {
2347 global queryButtonsFind
2349 set queryButtonsFind [lreplace $queryButtonsFind $no $no [list I $i]]
2351 dputs "queryButtonsFind $queryButtonsFind"
2354 proc update-attr {} {
2356 listbuttonv $w.top.relation.b relationTmpValue\
2357 {{None} 0 {Less than} 1 {Greater than or equal} 2 {Equal} 3 \
2358 {Greater than or equal} 4 {Greater than} 5 {Not equal} 6 \
2359 {Phonetic} 100 {Stem} 101 {Relevance} 102 {AlwaysMatches} 103}
2360 listbuttonv $w.top.position.b positionTmpValue {{None} 0 \
2361 {First in field} 1 {First in subfield} 2 {Any position in field} 3}
2362 listbuttonv $w.top.structure.b structureTmpValue {{None} 0 {Phrase} 1 \
2363 {Word} 2 {Key} 3 {Year} 4 {Date (norm)} 5 {Word list} 6 \
2364 {Date (un-norm)} 100 {Name (norm)} 101 {Date (un-norm)} 102 \
2365 {Structure} 103 {urx} 104 {free-form} 105 {doc-text} 106 \
2366 {local-number} 107 {string} 108 {numeric string} 109}
2367 listbuttonv $w.top.truncation.b truncationTmpValue {{Auto} 0 {Right} 1 \
2368 {Left} 2 {Left and right} 3 {No truncation} 100 \
2369 {Process #} 101 {Re-1} 102 {Re-2} 103}
2370 listbuttonv $w.top.completeness.b completenessTmpValue {{None} 0 \
2371 {Incomplete subfield} 1 {Complete subfield} 2 {Complete field} 3}
2374 proc use-attr {init} {
2386 {BNB card number} 10
2387 {BGF(sic) number} 11
2389 {Dewey classification} 13
2390 {UDC classification} 14
2391 {Bliss classification} 15
2393 {NLM call number} 17
2394 {NAL call number} 18
2395 {MOS call number} 19
2396 {Local classification} 20
2397 {Subject heading} 21
2399 {BDI-index-subject} 23
2403 {LC-subject-heading} 27
2404 {RVM-subject-heading} 28
2405 {Local subject index} 29
2407 {Date of publication} 31
2408 {Date of acquisition} 32
2410 {Title-collective} 34
2413 {Title-added-title-page} 37
2417 {Title-other-variant} 41
2419 {Title-abbreviated} 43
2423 {Subject-subdivision} 47
2424 {Number-natl-bibliography} 48
2425 {Number-legal-deposit} 49
2426 {Number-govt-publication} 50
2427 {Number-publisher-for-music} 51
2429 {Number-local-call} 53
2431 {Code-geographic-area} 55
2432 {Code-institution} 56
2434 {Name-geographic} 58
2435 {Place-publication} 59
2437 {Microform-generation} 61
2444 {Author-name-personal} 1004
2445 {Author-name-corporate} 1005
2446 {Author-name-conference} 1006
2447 {Identifier-standard} 1007
2448 {Subject-LC-children's} 1008
2449 {Subject-name-personal} 1009
2451 {Date/time added to database} 1011
2452 {Date/time last modified} 1012
2453 {Authority/format identifier} 1013
2455 {Concept-reference} 1015
2457 {Server choice} 1017
2459 {Record source} 1019
2462 {Geographic class} 1022
2466 {Related periodical} 1026
2467 {Report number} 1027
2469 {Thematic number} 1030
2470 {Material type} 1031
2478 set l [llength $attr]
2483 for {set i 0} {$i < $l} {incr i} {
2484 $w.top.use.list insert end [lindex $attr $i]
2486 if {$useTmpValue == [lindex $attr $i]} {
2492 $w.top.use.list selection clear 0 end
2493 $w.top.use.list selection set $s $s
2495 $w.top.use.list select from $s
2496 $w.top.use.list select to $s
2502 $w.top.use.list yview $s
2504 set lno [lindex [$w.top.use.list curselection] 0]
2505 set i [expr $lno+$lno+1]
2506 set useTmpValue [lindex $attr $i]
2507 dputs "useTmpValue=$useTmpValue"
2511 proc index-setup-action {oldAttr queryNo indexNo} {
2512 set attr [lindex $oldAttr 0]
2515 global relationTmpValue
2516 global structureTmpValue
2517 global truncationTmpValue
2518 global completenessTmpValue
2519 global positionTmpValue
2524 dputs "index-setup-action"
2525 dputs "queryNo $queryNo"
2526 dputs "indexNo $indexNo"
2527 if {$useTmpValue > 0} {
2528 lappend attr "1=$useTmpValue"
2530 if {$relationTmpValue > 0} {
2531 lappend attr "2=$relationTmpValue"
2533 if {$positionTmpValue > 0} {
2534 lappend attr "3=$positionTmpValue"
2536 if {$structureTmpValue > 0} {
2537 lappend attr "4=$structureTmpValue"
2539 if {$truncationTmpValue > 0} {
2540 lappend attr "5=$truncationTmpValue"
2542 if {$completenessTmpValue > 0} {
2543 lappend attr "6=$completenessTmpValue"
2545 dputs "new attr $attr"
2546 set queryInfoTmp [lreplace $queryInfoTmp $indexNo $indexNo $attr]
2547 destroy .index-setup
2550 proc index-setup {attr queryNo indexNo} {
2553 global relationTmpValue
2554 global structureTmpValue
2555 global truncationTmpValue
2556 global completenessTmpValue
2557 global positionTmpValue
2559 set relationTmpValue 0
2560 set truncationTmpValue 0
2561 set structureTmpValue 0
2562 set positionTmpValue 0
2563 set completenessTmpValue 0
2566 set len [llength $attr]
2567 for {set i 1} {$i < $len} {incr i} {
2568 set q [lindex $attr $i]
2569 set l [string first = $q]
2571 set t [string range $q 0 [expr $l - 1]]
2572 set v [string range $q [expr $l + 1] end]
2575 { set useTmpValue $v }
2577 { set relationTmpValue $v }
2579 { set positionTmpValue $v }
2581 { set structureTmpValue $v }
2583 { set truncationTmpValue $v }
2585 { set completenessTmpValue $v }
2589 if {[winfo exists $w]} {
2594 set n [lindex $attr 0]
2595 wm title $w "Index setup $n"
2599 frame $w.top.use -relief ridge -border 2
2600 frame $w.top.relation -relief ridge -border 2
2601 frame $w.top.position -relief ridge -border 2
2602 frame $w.top.structure -relief ridge -border 2
2603 frame $w.top.truncation -relief ridge -border 2
2604 frame $w.top.completeness -relief ridge -border 2
2610 pack $w.top.use -side left -pady 6 -padx 6 -fill y
2612 label $w.top.use.label -text "Use"
2614 listbox $w.top.use.list -width 26 \
2615 -yscrollcommand "$w.top.use.scroll set"
2617 listbox $w.top.use.list -geometry 26x10 \
2618 -yscrollcommand "$w.top.use.scroll set"
2620 scrollbar $w.top.use.scroll -orient vertical -border 1
2621 pack $w.top.use.label -side top -fill x \
2623 pack $w.top.use.list -side left -fill both -expand yes \
2625 pack $w.top.use.scroll -side right -fill y \
2627 $w.top.use.scroll config -command "$w.top.use.list yview"
2631 # Relation Attributes
2633 pack $w.top.relation -pady 6 -padx 6 -side top
2634 label $w.top.relation.label -text "Relation" -width 18
2636 pack $w.top.relation.label $w.top.relation.b -fill x
2638 # Position Attributes
2640 pack $w.top.position -pady 6 -padx 6 -side top
2641 label $w.top.position.label -text "Position" -width 18
2643 pack $w.top.position.label $w.top.position.b -fill x
2645 # Structure Attributes
2647 pack $w.top.structure -pady 6 -padx 6 -side top
2648 label $w.top.structure.label -text "Structure" -width 18
2650 pack $w.top.structure.label $w.top.structure.b -fill x
2652 # Truncation Attributes
2654 pack $w.top.truncation -pady 6 -padx 6 -side top
2655 label $w.top.truncation.label -text "Truncation" -width 18
2657 pack $w.top.truncation.label $w.top.truncation.b -fill x
2659 # Completeness Attributes
2661 pack $w.top.completeness -pady 6 -padx 6 -side top
2662 label $w.top.completeness.label -text "Completeness" -width 18
2664 pack $w.top.completeness.label $w.top.completeness.b -fill x
2667 bottom-buttons $w [list \
2668 {Ok} [list index-setup-action $attr $queryNo $indexNo] \
2669 {Cancel} [list destroy $w]] 0
2673 proc query-edit-index {queryNo} {
2677 set i [lindex [$w.top.index.list curselection] 0]
2681 set attr [lindex $queryInfoTmp $i]
2682 dputs "Editing no $i $attr"
2683 index-setup $attr $queryNo $i
2686 proc query-delete-index {queryNo} {
2688 global queryButtonsTmp
2691 set i [lindex [$w.top.index.list curselection] 0]
2695 set queryInfoTmp [lreplace $queryInfoTmp $i $i]
2696 index-lines $w.top.lines 0 $queryButtonsTmp $queryInfoTmp activate-e-index
2697 $w.top.index.list delete $i
2700 proc query-setup {queryNo} {
2706 global queryButtonsTmp
2708 global queryIndexTmp
2711 set queryName [lindex $queryTypes $queryNo]
2712 set queryInfoTmp [lindex $queryInfo $queryNo]
2713 set queryButtonsTmp [lindex $queryButtons $queryNo]
2718 wm title $w "Query setup $queryName"
2722 frame $w.top.lines -relief ridge -border 2
2724 pack $w.top.lines -side left -pady 6 -padx 6 -fill y
2728 index-lines $w.top.lines 0 $queryButtonsTmp $queryInfoTmp activate-e-index
2730 button $w.top.lines.add -text "Add" \
2731 -command [list query-add-line $queryNo]
2732 button $w.top.lines.del -text "Remove" \
2733 -command [list query-del-line $queryNo]
2735 pack $w.top.lines.del -fill x -side bottom
2736 pack $w.top.lines.add -fill x -pady 10 -side bottom
2740 frame $w.top.index -relief ridge -border 2
2741 pack $w.top.index -pady 6 -padx 6 -side right -fill y
2743 listbox $w.top.index.list -yscrollcommand [list $w.top.index.scroll set]
2744 scrollbar $w.top.index.scroll -orient vertical -border 1 \
2745 -command [list $w.top.index.list yview]
2746 bind $w.top.index.list <2> [list query-edit-index $queryNo]
2748 pack $w.top.index.list -side left -fill both -expand yes -padx 2 -pady 2
2749 pack $w.top.index.scroll -side right -fill y -padx 2 -pady 2
2752 $w.top.index.list selection clear 0 end
2753 $w.top.index.list selection set 0 0
2755 $w.top.index.list select from 0
2756 $w.top.index.list select to 0
2759 foreach x $queryInfoTmp {
2760 $w.top.index.list insert end [lindex $x 0]
2763 bottom-buttons $w [list \
2764 {Ok} [list query-setup-action $queryNo] \
2765 {Add index} [list query-add-index $queryNo] \
2766 {Edit index} [list query-edit-index $queryNo] \
2767 {Delete index} [list query-delete-index $queryNo] \
2768 {Cancel} [list destroy $w]] 0
2771 proc index-clear {} {
2772 global queryButtonsFind
2775 foreach b $queryButtonsFind {
2776 .lines.$i.e delete 0 end
2781 proc index-query {} {
2782 global queryButtonsFind
2783 global queryInfoFind
2788 foreach b $queryButtonsFind {
2789 set term [string trim [.lines.$i.e get]]
2791 set attr [lrange [lindex $queryInfoFind [lindex $b 1]] 1 end]
2793 set len [string length $term]
2797 if {[string index $term $len] == "?"} {
2799 set term [string range $term 0 [expr $len - 1]]
2801 if {[string index $term 0] == "?"} {
2803 set term [string range $term 1 end]
2805 set term "\{${term}\}"
2806 if {$right && $left} {
2807 set term "@attr 5=3 ${term}"
2809 set term "@attr 5=1 ${term}"
2811 set term "@attr 5=2 ${term}"
2814 set term "@attr $a ${term}"
2817 set qs "@and ${qs} ${term}"
2828 proc index-focus-in {w i} {
2829 global curIndexEntry
2832 $w.$i configure -background red
2834 set curIndexEntry $i
2837 proc index-lines {w realOp buttonInfo queryInfo handle} {
2839 foreach b $buttonInfo {
2840 if {! [winfo exists $w.$i]} {
2842 frame $w.$i -border 0
2844 frame $w.$i -background white -border 1
2847 listbuttonx $w.$i.l [lindex $b 1] $queryInfo $handle $i
2850 if {! [winfo exists $w.$i.e]} {
2851 entry $w.$i.e -width 32 -relief sunken -border 1
2852 bind $w.$i.e <FocusIn> [list index-focus-in $w $i]
2853 bind $w.$i.e <FocusOut> [list $w.$i configure \
2855 pack $w.$i.l -side left
2856 pack $w.$i.e -side left -fill x -expand yes
2857 pack $w.$i -side top -fill x -padx 2 -pady 2
2859 bind $w.$i.e <Left> [list left-cursor $w.$i.e]
2860 bind $w.$i.e <Right> [list right-cursor $w.$i.e]
2862 bind $w.$i.e <Return> {search-request 0}
2865 pack $w.$i.l -side left
2866 pack $w.$i -side top -fill x -padx 2 -pady 2
2871 while {[winfo exists $w.$j]} {
2883 bind $w.$j.e <Tab> "focus $w.$k.e"
2889 bind $w.$i.e <Tab> "focus $w.0.e"
2895 proc search-fields {w buttondefs} {
2897 foreach buttondef $buttondefs {
2898 frame $w.$i -background white
2900 listbutton $w.$i.l 0 $buttondef
2901 entry $w.$i.e -width 32 -relief sunken
2903 pack $w.$i.l -side left
2904 pack $w.$i.e -side left -fill x -expand yes
2906 pack $w.$i -side top -fill x -padx 2 -pady 2
2908 bind $w.$i.e <Left> [list left-cursor $w.$i.e]
2909 bind $w.$i.e <Right> [list right-cursor $w.$i.e]
2917 bind $w.$j.e <Tab> "focus $w.$k.e \n
2918 $w.$k configure -background red \n
2919 $w.$j configure -background white"
2922 bind $w.$i.e <Tab> "focus $w.0.e \n
2923 $w.0 configure -background red \n
2924 $w.$i configure -background white"
2926 $w.0 configure -background red
2929 if {[info exists windowGeometry(.)]} {
2930 set g $windowGeometry(.)
2938 frame .top -border 1 -relief raised
2939 frame .lines -border 1 -relief raised
2940 frame .mid -border 1 -relief raised
2941 frame .data -border 1 -relief raised
2942 frame .bot -border 1 -relief raised
2943 pack .top .lines .mid -side top -fill x
2944 pack .data -side top -fill both -expand yes
2947 menubutton .top.file -text "File" -menu .top.file.m
2949 .top.file.m add command -label "Save settings" -command {save-settings}
2950 .top.file.m add separator
2951 .top.file.m add command -label "Exit" -command {exit-action}
2953 menubutton .top.target -text "Target" -menu .top.target.m
2955 .top.target.m add cascade -label "Connect" -menu .top.target.m.clist
2956 .top.target.m add command -label "Disconnect" -command {close-target}
2957 .top.target.m add command -label "About" -command {about-target}
2958 .top.target.m add cascade -label "Setup" -menu .top.target.m.slist
2959 .top.target.m add command -label "Setup new" -command {define-target-dialog}
2960 .top.target.m add separator
2961 set-target-hotlist 0
2963 configure-disable-e .top.target.m 1
2964 configure-disable-e .top.target.m 2
2966 menu .top.target.m.clist
2967 menu .top.target.m.slist
2970 menubutton .top.service -text "Service" -menu .top.service.m
2972 .top.service.m add command -label "Database" -command {database-select}
2973 .top.service.m add cascade -label "Present" -menu .top.service.m.present
2974 menu .top.service.m.present
2975 .top.service.m.present add command -label "10 More" \
2976 -command [list present-more 10]
2977 .top.service.m.present add command -label "All" \
2978 -command [list present-more {}]
2979 .top.service.m add command -label "Search" -command {search-request 0}
2980 .top.service.m add command -label "Scan" -command {scan-request}
2982 .top.service configure -state disabled
2984 menubutton .top.rset -text "Set" -menu .top.rset.m
2986 .top.rset.m add command -label "Load" -command {load-set}
2987 .top.rset.m add separator
2989 menubutton .top.options -text "Options" -menu .top.options.m
2991 .top.options.m add cascade -label "Query" -menu .top.options.m.query
2992 .top.options.m add cascade -label "Format" -menu .top.options.m.formats
2993 .top.options.m add cascade -label "Wrap" -menu .top.options.m.wrap
2994 .top.options.m add cascade -label "Syntax" -menu .top.options.m.syntax
2996 menu .top.options.m.query
2997 .top.options.m.query add cascade -label "Select" \
2998 -menu .top.options.m.query.clist
2999 .top.options.m.query add cascade -label "Edit" \
3000 -menu .top.options.m.query.slist
3001 .top.options.m.query add command -label "New" \
3002 -command {query-new}
3003 .top.options.m.query add cascade -label "Delete" \
3004 -menu .top.options.m.query.dlist
3006 menu .top.options.m.query.slist
3007 menu .top.options.m.query.clist
3008 menu .top.options.m.query.dlist
3011 menu .top.options.m.formats
3013 foreach f $displayFormats {
3014 .top.options.m.formats add radiobutton -label $f -value $i \
3015 -command [list set-display-format $i] -variable displayFormat
3019 menu .top.options.m.wrap
3020 .top.options.m.wrap add radiobutton -label "Character" \
3021 -value char -variable textWrap -command {set-wrap char}
3022 .top.options.m.wrap add radiobutton -label "Word" \
3023 -value word -variable textWrap -command {set-wrap word}
3024 .top.options.m.wrap add radiobutton -label "None" \
3025 -value none -variable textWrap -command {set-wrap none}
3027 menu .top.options.m.syntax
3028 .top.options.m.syntax add radiobutton -label "None" \
3029 -value None -variable recordSyntax
3030 .top.options.m.syntax add separator
3031 .top.options.m.syntax add radiobutton -label "USMARC" \
3032 -value USMARC -variable recordSyntax
3033 .top.options.m.syntax add radiobutton -label "UNIMARC" \
3034 -value UNIMARC -variable recordSyntax
3035 .top.options.m.syntax add radiobutton -label "UKMARC" \
3036 -value UKMARC -variable recordSyntax
3037 .top.options.m.syntax add radiobutton -label "DANMARC" \
3038 -value DANMARC -variable recordSyntax
3039 .top.options.m.syntax add radiobutton -label "FINMARC" \
3040 -value FINMARC -variable recordSyntax
3041 .top.options.m.syntax add radiobutton -label "NORMARC" \
3042 -value NORMARC -variable recordSyntax
3043 .top.options.m.syntax add radiobutton -label "PICAMARC" \
3044 -value PICAMARC -variable recordSyntax
3045 .top.options.m.syntax add separator
3046 .top.options.m.syntax add radiobutton -label "SUTRS" \
3047 -value SUTRS -variable recordSyntax
3048 .top.options.m.syntax add separator
3049 .top.options.m.syntax add radiobutton -label "GRS1" \
3050 -value GRS1 -variable recordSyntax
3052 menubutton .top.help -text "Help" -menu .top.help.m
3055 .top.help.m add command -label "Help on help" \
3056 -command {tkerror "Help on help not available. Sorry"}
3057 .top.help.m add command -label "About" -command {about-origin}
3059 pack .top.file .top.target .top.service .top.rset .top.options -side left
3060 pack .top.help -side right
3062 index-lines .lines 1 $queryButtonsFind [lindex $queryInfo 0] activate-index
3064 button .mid.search -text Search -command {search-request 0} \
3066 button .mid.scan -text Scan \
3067 -command scan-request -state disabled
3068 button .mid.present -text {Present} -command [list present-more 10] \
3071 button .mid.clear -text Clear -command index-clear
3072 pack .mid.search .mid.scan .mid.present .mid.clear -side left \
3075 text .data.record -height 2 -width 20 -wrap none \
3076 -yscrollcommand [list .data.scroll set] -wrap $textWrap
3077 scrollbar .data.scroll -command [list .data.record yview]
3079 .data.record configure -takefocus 0
3080 .data.scroll configure -takefocus 0
3082 pack .data.scroll -side right -fill y
3083 pack .data.record -expand yes -fill both
3087 .data.record tag configure marc-tag -foreground blue
3088 .data.record tag configure marc-id -foreground red
3090 .data.record tag configure marc-tag -foreground black
3091 .data.record tag configure marc-id -foreground black
3093 .data.record tag configure marc-data -foreground black
3095 button .bot.logo -bitmap @${libdir}/bitmaps/book1 -command cancel-operation
3097 .bot.logo configure -takefocus 0
3100 pack .bot.a -side left -fill x
3101 pack .bot.logo -side right -padx 2 -pady 2 -ipadx 1
3103 message .bot.a.target -text "" -aspect 1000 -border 1
3105 label .bot.a.status -text "Not connected" -width 15 -relief \
3106 sunken -anchor w -border 1
3107 label .bot.a.set -text "" -width 5 -relief \
3108 sunken -anchor w -border 1
3109 label .bot.a.message -text "" -width 15 -relief \
3110 sunken -anchor w -border 1
3112 pack .bot.a.target -side top -anchor nw -padx 2 -pady 2
3113 pack .bot.a.status .bot.a.set .bot.a.message \
3114 -side left -padx 2 -pady 2 -ipadx 1 -ipady 1