1 # IR toolkit for tcl/tk
3 # See the file LICENSE for details.
4 # Sebastian Hammer, Adam Dickmeiss
7 # Revision 1.35 1995-06-12 15:17:31 adam
8 # Text widget used in main window (instead of listbox) to support
9 # better presentation formats.
11 # Revision 1.34 1995/06/12 07:59:07 adam
12 # More work on geometry handling.
14 # Revision 1.33 1995/06/09 11:17:35 adam
15 # Start work on geometry management.
17 # Revision 1.32 1995/06/07 09:16:37 adam
18 # New presentation format.
20 # Revision 1.31 1995/06/06 16:31:09 adam
21 # Bug fix: target names couldn't contain blanks.
24 # Revision 1.30 1995/06/06 11:35:41 adam
25 # Work on scan. Display of old sets.
27 # Revision 1.29 1995/06/05 14:11:18 adam
28 # Bug fix in present-more.
30 # Revision 1.28 1995/06/02 14:52:13 adam
31 # Minor changes really.
33 # Revision 1.27 1995/06/02 14:29:42 adam
34 # Work on scan interface - up/down buttons.
36 # Revision 1.26 1995/06/01 16:36:46 adam
37 # About buttons. Minor bug fixes.
39 # Revision 1.25 1995/05/31 13:09:57 adam
40 # Client searches/presents may be interrupted.
41 # New moving book-logo.
43 # Revision 1.24 1995/05/31 08:36:24 adam
44 # Bug fix in client.tcl: didn't save options on clientrc.tcl.
45 # New method: referenceId. More work on scan.
47 # Revision 1.23 1995/05/29 10:33:41 adam
48 # README and rename of startup script.
50 # Revision 1.22 1995/05/26 11:44:09 adam
51 # Bugs fixed. More work on MARC utilities and queries. Test
52 # client is up-to-date again.
54 # Revision 1.21 1995/05/11 15:34:46 adam
55 # Scan request changed a bit. This version works with RLG.
57 # Revision 1.20 1995/04/21 16:31:57 adam
58 # New radiobutton: protocol (z39v2/SR).
60 # Revision 1.19 1995/04/18 16:11:50 adam
61 # First version of graphical Scan. Some work on query-by-form.
63 # Revision 1.18 1995/04/10 10:50:22 adam
64 # Result-set name defaults to suffix of ir-set name.
65 # Started working on scan. Not finished at this point.
67 # Revision 1.17 1995/03/31 09:34:57 adam
68 # Search-button disabled when there is no connection.
70 # Revision 1.16 1995/03/31 08:56:36 adam
71 # New button "Search".
73 # Revision 1.15 1995/03/28 12:45:22 adam
74 # New ir method failback: called on disconnect/protocol error.
75 # New ir set/get method: protocol: SR / Z3950.
76 # Simple popup and disconnect when failback is invoked.
78 # Revision 1.14 1995/03/22 16:07:55 adam
81 # Revision 1.13 1995/03/21 17:27:26 adam
82 # Short-hand keys in setup.
84 # Revision 1.12 1995/03/21 13:41:03 adam
85 # Comstack cs_create not used too often. Non-blocking connect.
87 # Revision 1.11 1995/03/21 10:39:06 adam
88 # Diagnostic error message displayed with tkerror.
90 # Revision 1.10 1995/03/20 15:24:06 adam
91 # Diagnostic records saved on searchResponse.
93 # Revision 1.9 1995/03/17 18:26:16 adam
94 # Non-blocking i/o used now. Database names popup as cascade items.
96 # Revision 1.8 1995/03/17 15:45:00 adam
97 # Improved target/database setup.
99 # Revision 1.7 1995/03/16 17:54:03 adam
100 # Minor changes really.
102 # Revision 1.6 1995/03/15 19:10:20 adam
103 # Database setup in protocol-setup (rather target setup).
105 # Revision 1.5 1995/03/15 13:59:23 adam
108 # Revision 1.4 1995/03/14 17:32:29 adam
109 # Presentation of full Marc record in popup window.
111 # Revision 1.3 1995/03/12 19:31:52 adam
112 # Pattern matching implemented when retrieving MARC records. More
113 # diagnostic functions.
115 # Revision 1.2 1995/03/10 18:00:15 adam
116 # Actual presentation in line-by-line format. RPN query support.
118 # Revision 1.1 1995/03/09 16:15:07 adam
119 # First presentRequest attempts. Hot-target list.
126 set profile(Default) {{} {} {210} {} 16384 8192 tcpip {} 1 {} {} z39v2}
128 set settingsChanged 0
136 set queryTypes {Simple}
137 set queryButtons { { {I 0} {I 1} {I 2} } }
138 set queryInfo { { {Title {1=4}} {Author {1=1}} \
139 {Subject {1=21}} {Any {1=1016}} } }
142 proc read-formats {} {
143 global displayFormats
144 set formats [glob -nocomplain formats/*.tcl]
147 set l [expr [string length $f] - 5]
148 lappend displayFormats [string range $f 8 $l]
152 proc set-display-format {f} {
160 add-title-lines 0 10000 1
164 global windowGeometry
165 set windowGeometry($w) [wm geometry $w]
170 global windowGeometry
173 if {[info exists windowGeometry($w)]} {
174 set g $windowGeometry($w)
181 if {[file readable "clientrc.tcl"]} {
182 source "clientrc.tcl"
185 if {[file readable "clientg.tcl"]} {
189 set queryButtonsFind [lindex $queryButtons 0]
190 set queryInfoFind [lindex $queryInfo 0]
192 proc top-down-window {w} {
193 frame $w.top -relief raised -border 1
194 frame $w.bot -relief raised -border 1
196 pack $w.top -side top -fill both -expand yes
197 pack $w.bot -fill both
200 proc top-down-ok-cancel {w ok-action g} {
201 frame $w.bot.left -relief sunken -border 1
202 pack $w.bot.left -side left -expand yes -ipadx 2 -ipady 2 -padx 5 -pady 5
203 button $w.bot.left.ok -width 6 -text {Ok} \
204 -command ${ok-action}
205 pack $w.bot.left.ok -expand yes -ipadx 2 -ipady 2 -padx 3 -pady 3
206 button $w.bot.cancel -width 6 -text {Cancel} \
207 -command [list destroy $w]
208 pack $w.bot.cancel -side left -expand yes
216 proc bottom-buttons {w buttonList g} {
218 set l [llength $buttonList]
220 frame $w.bot.$i -relief sunken -border 1
221 pack $w.bot.$i -side left -expand yes -padx 5 -pady 5
222 button $w.bot.$i.ok -text [lindex $buttonList $i] \
223 -command [lindex $buttonList [expr $i+1]]
224 pack $w.bot.$i.ok -expand yes -ipadx 2 -ipady 2 -padx 3 -pady 3 -side left
228 button $w.bot.$i -text [lindex $buttonList $i] \
229 -command [lindex $buttonList [expr $i+1]]
230 pack $w.bot.$i -expand yes -ipadx 2 -ipady 2 -padx 3 -pady 3 -side left
240 proc cancel-operation {} {
246 show-status Cancelled 0 {}
250 proc show-target {target} {
251 .bot.a.target configure -text "$target"
254 proc show-logo {v1} {
261 .bot.logo configure -bitmap @book${v1}
262 after 140 [list show-logo $v1]
266 .bot.logo configure -bitmap @book1
275 proc show-status {status b sb} {
279 .bot.a.status configure -text "$status"
281 if {$busy == 0} {set busy 1}
289 .top.service configure -state normal
290 .mid.search configure -state normal
291 .mid.scan configure -state normal
292 .mid.present configure -state normal
293 if {[winfo exists .scan-window]} {
294 .scan-window.bot.2 configure -state normal
295 .scan-window.bot.4 configure -state normal
299 .top.service configure -state disabled
300 .mid.search configure -state disabled
301 .mid.scan configure -state disabled
302 .mid.present configure -state disabled
304 if {[winfo exists .scan-window]} {
305 .scan-window.bot.2 configure -state disabled
306 .scan-window.bot.4 configure -state disabled
312 proc show-message {msg} {
313 .bot.a.message configure -text "$msg"
316 proc insertWithTags {w text args} {
317 set start [$w index insert]
318 $w insert insert $text
319 foreach tag [$w tag names $start] {
320 $w tag remove $tag $start insert
323 $w tag add $i $start insert
327 proc about-target {} {
328 set w .about-target-w
332 wm title $w "About target"
335 set i [z39 targetImplementationName]
336 label $w.top.in -text "Implementation name: $i"
337 set i [z39 targetImplementationId]
338 label $w.top.ii -text "Implementation id: $i"
339 set i [z39 targetImplementationVersion]
340 label $w.top.iv -text "Implementation version: $i"
342 label $w.top.op -text "Protocol options: $i"
344 pack $w.top.in $w.top.ii $w.top.iv $w.top.op -side top -anchor nw
346 bottom-buttons $w [list {Close} [list destroyG $w]] 1
349 proc about-origin {} {
350 set w .about-origin-w
354 wm title $w "About IrTcl"
358 set i [z39 implementationName]
359 label $w.top.in -text "Implementation name: $i"
360 set i [z39 implementationId]
361 label $w.top.ii -text "Implementation id: $i"
363 pack $w.top.in $w.top.ii -side top -anchor nw
365 bottom-buttons $w [list {Close} [list destroyG $w]] 1
368 proc popup-marc {sno no b df} {
370 global displayFormats
373 if {[z39.$sno type $no] != "DB"} {
377 set w .full-marc-$fullMarcSeq
382 if {[winfo exists $w]} {
390 frame $w.top -relief raised -border 1
391 frame $w.bot -relief raised -border 1
393 pack $w.top -side top -fill both -expand yes
394 pack $w.bot -fill both
396 text $w.top.record -width 60 -height 5 -wrap word \
397 -yscrollcommand [list $w.top.s set]
398 scrollbar $w.top.s -command [list $w.top.record yview]
400 if {[tk colormodel .] == "color"} {
401 $w.top.record tag configure marc-tag -foreground blue
402 $w.top.record tag configure marc-id -foreground red
404 $w.top.record tag configure marc-tag -foreground black
405 $w.top.record tag configure marc-id -foreground black
407 $w.top.record tag configure marc-data -foreground black
410 $w.top.record delete 0.0 end
412 set ffunc [lindex $displayFormats $df]
413 set ffunc "display-$ffunc"
415 $ffunc $sno $no $w.top.record 0
418 bind $w.top.record <Return> {destroy .full-marc}
420 pack $w.top.s -side right -fill y
421 pack $w.top.record -expand yes -fill both
424 bottom-buttons $w [list \
425 {Close} [list destroy $w] \
426 {Duplicate} [list popup-marc $sno $no 1 $df]] 0
427 menubutton $w.bot.formats -text "Format" -menu $w.bot.formats.m
428 menu $w.bot.formats.m
430 foreach f $displayFormats {
431 $w.bot.formats.m add radiobutton -label $f \
432 -command [list display-$f $sno $no $w.top.record 0]
435 pack $w.bot.formats -expand yes -ipadx 2 -ipady 2 \
436 -padx 3 -pady 3 -side left
438 bottom-buttons $w [list \
439 {Close} [list destroyG $w] \
440 {Duplicate} [list popup-marc $sno $no 1 $df]] 0
441 menubutton $w.bot.formats -text "Format" -menu $w.bot.formats.m
442 menu $w.bot.formats.m
444 foreach f $displayFormats {
445 $w.bot.formats.m add radiobutton -label $f \
446 -command [list display-$f $sno $no $w.top.record 0]
449 pack $w.bot.formats -expand yes -ipadx 2 -ipady 2 \
450 -padx 3 -pady 3 -side left
454 foreach f $displayFormats {
455 $w.bot.formats.m entryconfigure $i \
456 -command [list display-f $sno $no $w.top.record 0]
462 proc update-target-hotlist {target} {
465 set len [llength $hotTargets]
467 .top.target.m delete 6 [expr 6+[llength $hotTargets]]
469 set indx [lsearch $hotTargets $target]
471 set hotTargets [lreplace $hotTargets $indx $indx]
473 set hotTargets [linsert $hotTargets 0 $target]
477 proc set-target-hotlist {} {
481 foreach target $hotTargets {
482 .top.target.m add command -label "$i $target" -command \
483 [list reopen-target $target {}]
491 proc reopen-target {target base} {
493 open-target $target $base
494 update-target-hotlist $target
497 proc define-target-action {} {
500 set target [.target-define.top.target.entry get]
504 update-target-hotlist $target
505 foreach n [array names profile] {
511 set seq [lindex $profile(Default) 12]
513 set profile($target) $profile(Default)
514 set profile(Default) [lreplace $profile(Default) 12 12 [incr seq]]
516 protocol-setup $target
517 destroy .target-define
520 proc fail-response {target} {
522 tkerror "Target connection closed or protocol error"
525 proc connect-response {target} {
526 puts "connect-response"
531 proc open-target {target base} {
536 z39 comstack [lindex $profile($target) 6]
537 z39 idAuthentication [lindex $profile($target) 3]
538 z39 maximumRecordSize [lindex $profile($target) 4]
539 z39 preferredMessageSize [lindex $profile($target) 5]
540 puts -nonewline "maximumRecordSize="
541 puts [z39 maximumRecordSize]
542 puts -nonewline "preferredMessageSize="
543 puts [z39 preferredMessageSize]
544 show-status {Connecting} 0 0
546 z39 databaseNames [lindex [lindex $profile($target) 7] 0]
548 z39 databaseNames $base
550 z39 failback [list fail-response $target]
551 z39 callback [list connect-response $target]
552 z39 connect [lindex $profile($target) 1]:[lindex $profile($target) 2]
553 # z39 options search present scan namedResultSets triggerResourceCtrl
554 show-status {Connecting} 1 {}
556 .top.target.m disable 0
557 .top.target.m enable 1
558 .top.target.m enable 2
561 proc close-target {} {
569 show-status {Not connected} 0 0
571 .top.target.m disable 1
572 .top.target.m disable 2
573 .top.target.m enable 0
576 proc load-set-action {} {
580 ir-set z39.$setNo z39
582 set fname [.load-set.top.filename.entry get]
585 show-status {Loading} 1 {}
586 z39.$setNo loadFile $fname
588 set no [z39.$setNo numberOfRecordsReturned]
589 add-title-lines $setNo $no 1
591 set l [format "%-4d %7d" $setNo $no]
592 .top.rset.m add command -label $l \
593 -command [list add-title-lines $setNo 10000 1]
594 show-status {Ready} 0 {}
607 frame $w.top.filename
609 pack $w.top.filename -side top -anchor e -pady 2
611 entry-fields $w.top {filename} \
613 {load-set-action} {destroy .load-set}
615 top-down-ok-cancel $w {load-set-action} 1
619 proc init-request {} {
627 z39 callback {init-response}
628 show-status {Initializing} 1 {}
632 proc init-response {} {
639 show-status {Ready} 0 1
640 if {![z39 initResult]} {
641 set u [z39 userInformationField]
643 tkerror "Connection rejected by target: $u"
647 proc search-request {} {
657 if {$searchEnable == 0} {
660 set query [index-query]
665 ir-set z39.$setNo z39
667 if {[lindex $profile($target) 10] == 1} {
668 z39.$setNo setName $setNo
669 puts "setName=${setNo}"
671 z39.$setNo setName Default
672 puts "setName=Default"
674 if {[lindex $profile($target) 8] == 1} {
675 z39.$setNo queryType rpn
677 if {[lindex $profile($target) 9] == 1} {
678 z39.$setNo queryType ccl
680 z39 callback {search-response}
681 z39.$setNo search $query
682 show-status {Search} 1 0
685 proc scan-request {attr} {
699 if {![winfo exists $w]} {
708 entry $w.top.entry -relief sunken
709 pack $w.top.entry -fill x -padx 4 -pady 2
710 bind $w.top.entry <KeyRelease> [list scan-term-h $attr]
712 listbox $w.top.list -yscrollcommand [list $w.top.scroll set] \
714 scrollbar $w.top.scroll -orient vertical -border 1
715 pack $w.top.list -side left -fill both -expand yes
716 pack $w.top.scroll -side right -fill y
717 $w.top.scroll config -command [list $w.top.list yview]
719 listbox $w.top.list -font fixed -geometry 60x14
720 pack $w.top.list -side left -fill both -expand yes
723 bottom-buttons $w [list {Close} [list destroyG $w] \
724 {Up} [list scan-up $attr] \
725 {Down} [list scan-down $attr]] 0
726 bind $w.top.list <Up> [list scan-up $attr]
727 bind $w.top.list <Down> [list scan-down $attr]
729 # bind $w.top <Any-Enter> [list focus $w.top.entry]
731 z39 callback [list scan-response $attr 0 35]
732 z39.scan numberOfTermsRequested 5
733 z39.scan preferredPositionInResponse 1
734 z39.scan scan "${attr} 0"
736 show-status {Scan} 1 0
739 proc scan-term-h {attr} {
747 set nScanTerm [$w.top.entry get]
748 if {$nScanTerm == $scanTerm} {
751 set scanTerm $nScanTerm
752 z39 callback [list scan-response $attr 0 35]
753 z39.scan numberOfTermsRequested 5
754 z39.scan preferredPositionInResponse 1
755 puts "${attr} \{${scanTerm}\}"
756 if {$scanTerm == ""} {
757 z39.scan scan "${attr} 0"
759 z39.scan scan "${attr} \{${scanTerm}\}"
761 show-status {Scan} 1 0
764 proc scan-response {attr start toget} {
770 puts "In scan-response"
771 set m [z39.scan numberOfEntriesReturned]
777 if {![winfo exists .scan-window]} {
778 show-status {Ready} 0 1
782 set nScanTerm [$w.top.entry get]
783 if {$nScanTerm != $scanTerm} {
784 z39 callback [list scan-response $attr 0 35]
785 z39.scan numberOfTermsRequested 5
786 z39.scan preferredPositionInResponse 1
787 set scanTerm $nScanTerm
788 puts "${attr} \{${scanTerm}\}"
789 if {$scanTerm == ""} {
790 z39.scan scan "${attr} 0"
792 z39.scan scan "${attr} \{${scanTerm}\}"
794 show-status {Scan} 1 0
797 set status [z39.scan scanStatus]
800 show-status {Ready} 0 1
805 for {set i 0} {$i < $m} {incr i} {
806 set term [lindex [z39.scan scanLine $i] 1]
807 set nostr [format " %-6d" [lindex [z39.scan scanLine $i] 2]]
808 $w.top.list insert $i "$nostr $term"
811 $w.top.list yview $scanView
813 $w.top.list delete $start end
814 for {set i 0} {$i < $m} {incr i} {
815 set term [lindex [z39.scan scanLine $i] 1]
816 set nostr [format " %-6d" [lindex [z39.scan scanLine $i] 2]]
817 $w.top.list insert end "$nostr $term"
821 show-status {Ready} 0 1
825 if {$toget > 0 && $m > 1 && $m < $toget} {
826 set ntoget [expr $toget - $m + 1]
828 z39 callback [list scan-response $attr [expr $start + $m - 1] $ntoget]
830 puts "down continue: $q"
832 z39.scan numberOfTermsRequested 10
834 z39.scan numberOfTermsRequested $ntoget
836 z39.scan preferredPositionInResponse 1
837 puts "${attr} \{$q\}"
838 z39.scan scan "${attr} \{$q\}"
841 if {$toget < 0 && $m > 1 && $m < [expr - $toget]} {
842 set ntoget [expr - $toget - $m]
844 z39 callback [list scan-response $attr 0 -$ntoget]
845 set q [string range [$w.top.list get 0] 8 end]
846 puts "up continue: $q"
848 z39.scan numberOfTermsRequested 10
849 z39.scan preferredPositionInResponse 11
851 z39.scan numberOfTermsRequested $ntoget
852 z39.scan preferredPositionInResponse [incr ntoget]
854 puts "${attr} \{$q\}"
855 z39.scan scan "${attr} \{$q\}"
858 show-status {Ready} 0 1
861 proc scan-down {attr} {
865 set scanView [expr $scanView + 5]
866 set s [$w.top.list size]
867 if {$scanView > $s} {
868 z39 callback [list scan-response $attr [expr $s - 1] 25]
869 set q [string range [$w.top.list get [expr $s - 1]] 8 end]
871 z39.scan numberOfTermsRequested 10
872 z39.scan preferredPositionInResponse 1
873 show-status {Scan} 1 0
874 puts "${attr} \{$q\}"
875 z39.scan scan "${attr} \{$q\}"
878 $w.top.list yview $scanView
881 proc scan-up {attr} {
885 set scanView [expr $scanView - 5]
887 z39 callback [list scan-response $attr 0 -25]
888 set q [string range [$w.top.list get 0] 8 end]
890 z39.scan numberOfTermsRequested 10
891 z39.scan preferredPositionInResponse 11
892 show-status {Scan} 1 0
893 z39.scan scan "${attr} \{$q\}"
896 $w.top.list yview $scanView
899 proc search-response {} {
906 puts "In search-response"
908 show-status {Ready} 0 1
909 set setMax [z39.$setNo resultCount]
910 show-message "${setMax} hits"
911 set l [format "%-4d %7d" $setNo $setMax]
912 .top.rset.m add command -label $l \
913 -command [list add-title-lines $setNo 10000 1]
915 set status [z39.$setNo responseStatus]
916 if {[lindex $status 0] == "NSD"} {
917 set code [lindex $status 1]
918 set msg [lindex $status 2]
919 set addinfo [lindex $status 3]
920 tkerror "NSD$code: $msg: $addinfo"
932 z39 callback {present-response}
933 z39.$setNo present $setOffset 1
934 show-status {Retrieve} 1 0
937 proc present-more {number} {
942 puts "setOffset=$setOffset"
948 set max [z39.$setNo resultCount]
949 if {$max <= $setOffset} {
951 puts "setOffset=$setOffset"
958 if {$setMax > $max} {
962 z39 callback {present-response}
964 set toGet [expr $setMax - $setOffset + 1]
971 z39.$setNo present $setOffset $toGet
972 show-status {Retrieve} 1 0
975 proc init-title-lines {} {
976 .data.record delete 0.0 end
979 proc title-press {y setno} {
980 show-full-marc $setno [expr 1 + [.data.list nearest $y]] 0
983 proc add-title-lines {setno no offset} {
984 global displayFormats
994 .bot.a.set configure -text $setno
995 .data.record delete 0.0 end
997 set ffunc [lindex $displayFormats $displayFormat]
998 set ffunc "display-$ffunc"
999 for {set i 0} {$i < $no} {incr i} {
1000 set o [expr $i + $offset]
1001 set type [z39.$setno type $o]
1005 set insert0 [.data.record index insert]
1006 $ffunc $setno $o .data.record 1
1007 .data.record tag add r$o $insert0 insert
1008 .data.record tag bind r$o <1> \
1009 [list popup-marc $setno $o 0 $displayFormat]
1013 proc present-response {} {
1019 puts "In present-response"
1020 set no [z39.$setNo numberOfRecordsReturned]
1021 puts "Returned $no records, setOffset $setOffset"
1022 add-title-lines $setNo $no $setOffset
1023 set setOffset [expr $setOffset + $no]
1024 set status [z39.$setNo responseStatus]
1025 if {[lindex $status 0] == "NSD"} {
1026 show-status {Ready} 0 1
1027 set code [lindex $status 1]
1028 set msg [lindex $status 2]
1029 set addinfo [lindex $status 3]
1030 tkerror "NSD$code: $msg: $addinfo"
1034 show-status {Ready} 0 1
1038 if {$no > 0 && $setOffset <= $setMax} {
1039 puts "present-request from ${setOffset}"
1040 set toGet [expr $setMax - $setOffset + 1]
1044 z39.$setNo present $setOffset $toGet
1046 show-status {Finished} 0 1
1050 proc left-cursor {w} {
1051 set i [$w index insert]
1058 proc right-cursor {w} {
1059 set i [$w index insert]
1064 proc bind-fields {list returnAction escapeAction} {
1065 set max [expr [llength $list]-1]
1066 for {set i 0} {$i < $max} {incr i} {
1067 bind [lindex $list $i] <Return> $returnAction
1068 bind [lindex $list $i] <Escape> $escapeAction
1069 bind [lindex $list $i] <Tab> [list focus [lindex $list [expr $i+1]]]
1070 bind [lindex $list $i] <Left> [list left-cursor [lindex $list $i]]
1071 bind [lindex $list $i] <Right> [list right-cursor [lindex $list $i]]
1073 bind [lindex $list $i] <Return> $returnAction
1074 bind [lindex $list $i] <Escape> $escapeAction
1075 bind [lindex $list $i] <Tab> [list focus [lindex $list 0]]
1076 bind [lindex $list $i] <Left> [list left-cursor [lindex $list $i]]
1077 bind [lindex $list $i] <Right> [list right-cursor [lindex $list $i]]
1078 focus [lindex $list 0]
1081 proc entry-fields {parent list tlist returnAction escapeAction} {
1084 foreach field $list {
1085 set label ${parent}.${field}.label
1086 set entry ${parent}.${field}.entry
1087 label $label -text [lindex $tlist $i] -anchor e
1088 entry $entry -width 32 -relief sunken
1089 pack $label -side left
1090 pack $entry -side right
1091 lappend alist $entry
1094 bind-fields $alist $returnAction $escapeAction
1097 proc define-target-dialog {} {
1098 set w .target-define
1104 pack $w.top.target \
1105 -side top -anchor e -pady 2
1106 entry-fields $w.top {target} \
1108 {define-target-action} {destroy .target-define}
1109 top-down-ok-cancel $w {define-target-action} 1
1112 proc protocol-setup-action {target} {
1115 global protocolRadioType
1116 global settingsChanged
1119 global ResultSetCheck
1121 set wno [lindex $profile($target) 12]
1125 set settingsChanged 1
1126 set len [$w.top.databases.list size]
1127 for {set i 0} {$i < $len} {incr i} {
1128 lappend b [$w.top.databases.list get $i]
1130 set profile($target) [list [$w.top.description.entry get] \
1131 [$w.top.host.entry get] \
1132 [$w.top.port.entry get] \
1133 [$w.top.idAuthentication.entry get] \
1134 [$w.top.maximumRecordSize.entry get] \
1135 [$w.top.preferredMessageSize.entry get] \
1141 $protocolRadioType \
1145 puts $profile($target)
1149 proc place-force {window parent} {
1150 set g [wm geometry $parent]
1152 set p1 [string first + $g]
1153 set p2 [string last + $g]
1155 set x [expr 40+[string range $g [expr $p1 +1] [expr $p2 -1]]]
1156 set y [expr 60+[string range $g [expr $p2 +1] end]]
1157 wm geometry $window +${x}+${y}
1160 proc add-database-action {target} {
1163 set wno [lindex $profile($target) 12]
1166 $w.top.databases.list insert end \
1167 [.database-select.top.database.entry get]
1168 destroy .database-select
1171 proc add-database {target} {
1174 set w .database-select
1176 set oldFocus [focus]
1179 set wno [lindex $profile($target) 12]
1180 place-force $w .setup-${wno}
1184 frame $w.top.database
1186 pack $w.top.database -side top -anchor e -pady 2
1188 entry-fields $w.top {database} \
1189 {{Database to add:}} \
1190 [list add-database-action $target] {destroy .database-select}
1192 top-down-ok-cancel $w [list add-database-action $target] 1
1196 proc delete-database {target} {
1199 set wno [lindex $profile($target) 12]
1202 foreach i [lsort -decreasing \
1203 [$w.top.databases.list curselection]] {
1204 $w.top.databases.list delete $i
1208 proc protocol-setup {target} {
1211 global protocolRadioType
1214 global ResultSetCheck
1216 set wno [lindex $profile($target) 12]
1221 wm title $w "Setup $target"
1225 if {$target == ""} {
1229 puts $profile($target)
1233 frame $w.top.description
1234 frame $w.top.idAuthentication
1235 frame $w.top.maximumRecordSize
1236 frame $w.top.preferredMessageSize
1237 frame $w.top.cs-type -relief ridge -border 2
1238 frame $w.top.protocol -relief ridge -border 2
1239 frame $w.top.query -relief ridge -border 2
1240 frame $w.top.databases -relief ridge -border 2
1242 # Maximum/preferred/idAuth ...
1243 pack $w.top.description $w.top.host $w.top.port \
1244 $w.top.idAuthentication $w.top.maximumRecordSize \
1245 $w.top.preferredMessageSize -side top -anchor e -pady 2
1247 entry-fields $w.top {description host port idAuthentication \
1248 maximumRecordSize preferredMessageSize} \
1249 {{Description:} {Host:} {Port:} {Id Authentication:} \
1250 {Maximum Record Size:} {Preferred Message Size:}} \
1251 [list protocol-setup-action $target] [list destroyG $w]
1253 foreach sub {description host port idAuthentication \
1254 maximumRecordSize preferredMessageSize} {
1256 bind $w.top.$sub.entry <Control-a> [list add-database $target]
1257 bind $w.top.$sub.entry <Control-d> [list delete-database $target]
1259 $w.top.description.entry insert 0 [lindex $profile($target) 0]
1260 $w.top.host.entry insert 0 [lindex $profile($target) 1]
1261 $w.top.port.entry insert 0 [lindex $profile($target) 2]
1262 $w.top.idAuthentication.entry insert 0 [lindex $profile($target) 3]
1263 $w.top.maximumRecordSize.entry insert 0 [lindex $profile($target) 4]
1264 $w.top.preferredMessageSize.entry insert 0 [lindex $profile($target) 5]
1265 set csRadioType [lindex $profile($target) 6]
1266 set RPNCheck [lindex $profile($target) 8]
1267 set CCLCheck [lindex $profile($target) 9]
1268 set ResultSetCheck [lindex $profile($target) 10]
1269 set protocolRadioType [lindex $profile($target) 11]
1270 if {$protocolRadioType == ""} {
1271 set protocolRadioType z39v2
1275 pack $w.top.databases -side left -pady 6 -padx 6 -expand yes -fill both
1277 label $w.top.databases.label -text "Databases"
1278 button $w.top.databases.add -text "Add" \
1279 -command [list add-database $target]
1280 button $w.top.databases.delete -text "Delete" \
1281 -command [list delete-database $target]
1282 listbox $w.top.databases.list -geometry 20x6 \
1283 -yscrollcommand "$w.top.databases.scroll set"
1284 scrollbar $w.top.databases.scroll -orient vertical -border 1
1285 pack $w.top.databases.label -side top -fill x \
1287 pack $w.top.databases.add $w.top.databases.delete -side top -fill x \
1289 pack $w.top.databases.list -side left -fill both -expand yes \
1291 pack $w.top.databases.scroll -side right -fill y \
1293 $w.top.databases.scroll config -command "$w.top.databases.list yview"
1295 foreach b [lindex $profile($target) 7] {
1296 $w.top.databases.list insert end $b
1300 pack $w.top.cs-type -pady 6 -padx 6 -side top -fill x
1302 label $w.top.cs-type.label -text "Transport"
1303 radiobutton $w.top.cs-type.tcpip -text "TCP/IP" -anchor w \
1304 -command {puts tcp/ip} -variable csRadioType -value tcpip
1305 radiobutton $w.top.cs-type.mosi -text "MOSI" -anchor w\
1306 -command {puts mosi} -variable csRadioType -value mosi
1308 pack $w.top.cs-type.label $w.top.cs-type.tcpip $w.top.cs-type.mosi \
1309 -padx 4 -side top -fill x
1312 pack $w.top.protocol -pady 6 -padx 6 -side top -fill x
1314 label $w.top.protocol.label -text "Protocol"
1315 radiobutton $w.top.protocol.z39v2 -text "Z39.50" -anchor w \
1316 -command {puts z39v2} -variable protocolRadioType -value z39v2
1317 radiobutton $w.top.protocol.sr -text "SR" -anchor w \
1318 -command {puts sr} -variable protocolRadioType -value sr
1320 pack $w.top.protocol.label $w.top.protocol.z39v2 $w.top.protocol.sr \
1321 -padx 4 -side top -fill x
1324 pack $w.top.query -pady 6 -padx 6 -side top -fill x
1326 label $w.top.query.label -text "Query support"
1327 checkbutton $w.top.query.c1 -text "RPN query" -anchor w -variable RPNCheck
1328 checkbutton $w.top.query.c2 -text "CCL query" -anchor w -variable CCLCheck
1329 checkbutton $w.top.query.c3 -text "Result sets" -anchor w -variable ResultSetCheck
1331 pack $w.top.query.label -side top
1332 pack $w.top.query.c1 $w.top.query.c2 $w.top.query.c3 \
1333 -padx 4 -side top -fill x
1336 bottom-buttons $w [list {Ok} [list protocol-setup-action $target] \
1337 {Cancel} [list destroyG $w]] 0
1340 proc database-select-action {} {
1341 set w .database-select.top
1343 foreach indx [$w.databases.list curselection] {
1344 lappend b [$w.databases.list get $indx]
1347 z39 databaseNames $b
1349 destroy .database-select
1352 proc database-select {} {
1353 set w .database-select
1363 frame $w.top.databases -relief ridge -border 2
1365 pack $w.top.databases -side left -pady 6 -padx 6 -expand yes -fill x
1367 label $w.top.databases.label -text "List"
1368 listbox $w.top.databases.list -geometry 20x6 \
1369 -yscrollcommand "$w.top.databases.scroll set"
1370 scrollbar $w.top.databases.scroll -orient vertical -border 1
1371 pack $w.top.databases.label -side top -fill x \
1373 pack $w.top.databases.list -side left -fill both -expand yes \
1375 pack $w.top.databases.scroll -side right -fill y \
1377 $w.top.databases.scroll config -command "$w.top.databases.list yview"
1379 foreach b [lindex $profile($hostid) 7] {
1380 $w.top.databases.list insert end $b
1382 top-down-ok-cancel $w {database-select-action} 1
1385 proc cascade-target-list {} {
1388 foreach sub [winfo children .top.target.m.clist] {
1389 puts "deleting $sub"
1392 .top.target.m.clist delete 0 last
1393 foreach n [array names profile] {
1394 if {$n != "Default"} {
1395 set nl [string tolower $n]
1396 if {[llength [lindex $profile($n) 7]] > 1} {
1397 .top.target.m.clist add cascade -label $n \
1398 -menu .top.target.m.clist.$nl
1399 menu .top.target.m.clist.$nl
1400 foreach b [lindex $profile($n) 7] {
1401 .top.target.m.clist.$nl add command -label $b \
1402 -command [list reopen-target $n $b]
1405 .top.target.m.clist add command -label $n \
1406 -command [list reopen-target $n {}]
1410 .top.target.m.slist delete 0 last
1411 foreach n [array names profile] {
1412 if {$n != "Default"} {
1413 .top.target.m.slist add command -label $n \
1414 -command [list protocol-setup $n]
1419 proc cascade-query-list {} {
1423 .top.options.m.slist delete 0 last
1424 foreach n $queryTypes {
1425 .top.options.m.slist add command -label $n \
1426 -command [list query-setup $i]
1431 .top.options.m.clist delete 0 last
1432 foreach n $queryTypes {
1433 .top.options.m.clist add command -label $n \
1434 -command [list query-select $i]
1439 proc save-geometry {} {
1440 global windowGeometry
1442 set windowGeometry(.) [wm geometry .]
1444 set f [open "clientg.tcl" w]
1446 foreach n [array names windowGeometry] {
1447 puts -nonewline $f "set \{windowGeometry($n)\} \{"
1448 puts -nonewline $f $windowGeometry($n)
1454 proc save-settings {} {
1457 global settingsChanged
1462 set f [open "clientrc.tcl" w]
1463 puts $f "# Setup file"
1464 puts $f "set hotTargets \{ $hotTargets \}"
1466 foreach n [array names profile] {
1467 puts -nonewline $f "set \{profile($n)\} \{"
1468 puts -nonewline $f $profile($n)
1471 puts -nonewline $f "set queryTypes \{"
1472 puts -nonewline $f $queryTypes
1475 puts -nonewline $f "set queryButtons \{"
1476 puts -nonewline $f $queryButtons
1479 puts -nonewline $f "set queryInfo \{"
1480 puts -nonewline $f $queryInfo
1483 set settingsChanged 0
1495 message $w.top.message -text $ask
1497 pack $w.top.message -side left -pady 6 -padx 20 -expand yes -fill x
1500 top-down-ok-cancel $w {alert-action} 1
1504 proc alert-action {} {
1510 proc exit-action {} {
1511 global settingsChanged
1514 if {$settingsChanged} {
1515 set a [alert "you havent saved your settings. Do you wish to save?"]
1523 proc listbuttonaction {w name h user i} {
1524 $w configure -text [lindex $name 0]
1525 $h [lindex $name 1] $user $i
1528 proc listbuttonx {button no names handle user} {
1529 if {[winfo exists $button]} {
1530 $button configure -text [lindex [lindex $names $no] 0]
1531 ${button}.m delete 0 last
1533 menubutton $button -text [lindex [lindex $names $no] 0] \
1534 -width 10 -menu ${button}.m -relief raised -border 1
1538 foreach name $names {
1539 ${button}.m add command -label [lindex $name 0] \
1540 -command [list listbuttonaction ${button} $name \
1546 proc listbutton {button no names} {
1547 menubutton $button -text [lindex $names $no] -width 10 -menu ${button}.m \
1548 -relief raised -border 1
1550 foreach name $names {
1551 ${button}.m add command -label $name \
1552 -command [list ${button} configure -text $name]
1556 proc query-add-index-action {queryNo} {
1557 set w .setup-query-$queryNo
1560 global queryButtonsTmp
1562 lappend queryInfoTmp [list [.query-add-index.top.index.entry get] {}]
1564 destroy .query-add-index
1565 #destroy $w.top.lines
1566 #frame $w.top.lines -relief ridge -border 2
1567 index-lines $w.top.lines 0 $queryButtonsTmp $queryInfoTmp activate-e-index
1568 #pack $w.top.lines -side left -pady 6 -padx 6 -fill y
1571 proc query-add-line {queryNo} {
1572 set w .setup-query-$queryNo
1575 global queryButtonsTmp
1577 lappend queryButtonsTmp {I 0}
1579 #destroy $w.top.lines
1580 #frame $w.top.lines -relief ridge -border 2
1581 index-lines $w.top.lines 0 $queryButtonsTmp $queryInfoTmp activate-e-index
1582 #pack $w.top.lines -side left -pady 6 -padx 6 -fill y
1585 proc query-del-line {queryNo} {
1586 set w .setup-query-$queryNo
1589 global queryButtonsTmp
1591 set l [llength $queryButtonsTmp]
1596 set queryButtonsTmp [lreplace $queryButtonsTmp $l $l]
1597 index-lines $w.top.lines 0 $queryButtonsTmp $queryInfoTmp activate-e-index
1600 proc query-add-index {queryNo} {
1601 set w .query-add-index
1604 place-force $w .setup-query-$queryNo
1608 -side top -anchor e -pady 2
1609 entry-fields $w.top {index} \
1611 [list query-add-index-action $queryNo] {destroy .query-add-index}
1612 top-down-ok-cancel $w [list query-add-index-action $queryNo] 1
1615 proc query-setup-action {queryNo} {
1618 global queryButtonsTmp
1620 global queryButtonsFind
1621 global queryInfoFind
1623 set queryInfo [lreplace $queryInfo $queryNo $queryNo \
1625 set queryButtons [lreplace $queryButtons $queryNo $queryNo \
1627 set queryInfoFind $queryInfoTmp
1628 set queryButtonsFind $queryButtonsTmp
1632 destroy .setup-query-$queryNo
1634 index-lines .lines 1 $queryButtonsFind $queryInfoFind activate-index
1637 proc activate-e-index {value no i} {
1638 global queryButtonsTmp
1640 puts $queryButtonsTmp
1641 set queryButtonsTmp [lreplace $queryButtonsTmp $no $no [list I $i]]
1642 puts $queryButtonsTmp
1648 proc activate-index {value no i} {
1649 global queryButtonsFind
1651 set queryButtonsFind [lreplace $queryButtonsFind $no $no [list I $i]]
1653 puts "queryButtonsFind $queryButtonsFind"
1659 proc query-setup {queryNo} {
1660 set w .setup-query-$queryNo
1662 set queryTypes {Simple}
1665 global queryButtonsTmp
1668 set queryName [lindex $queryTypes $queryNo]
1669 set queryInfoTmp [lindex $queryInfo $queryNo]
1670 set queryButtonsTmp [lindex $queryButtons $queryNo]
1672 #set queryButtons { {I 0 I 1 I 2} }
1673 #set queryInfo { { {Title ti} {Author au} {Subject sh} } }
1677 wm title $w "Query setup $queryName"
1682 frame $w.top.lines -relief ridge -border 2
1683 frame $w.top.use -relief ridge -border 2
1684 frame $w.top.relation -relief ridge -border 2
1685 frame $w.top.position -relief ridge -border 2
1686 frame $w.top.structure -relief ridge -border 2
1687 frame $w.top.truncation -relief ridge -border 2
1688 frame $w.top.completeness -relief ridge -border 2
1692 index-lines $w.top.lines 0 $queryButtonsTmp $queryInfoTmp activate-e-index
1694 pack $w.top.lines -side left -pady 6 -padx 6 -fill y
1697 pack $w.top.use -side left -pady 6 -padx 6 -fill y
1699 label $w.top.use.label -text "Use"
1700 listbox $w.top.use.list -geometry 20x10 \
1701 -yscrollcommand "$w.top.use.scroll set"
1702 scrollbar $w.top.use.scroll -orient vertical -border 1
1703 pack $w.top.use.label -side top -fill x \
1705 pack $w.top.use.list -side left -fill both -expand yes \
1707 pack $w.top.use.scroll -side right -fill y \
1709 $w.top.use.scroll config -command "$w.top.use.list yview"
1711 foreach u {{Personal name} {Corporate name}} {
1712 $w.top.use.list insert end $u
1714 # Relation Attributes
1715 pack $w.top.relation -pady 6 -padx 6 -side top
1717 label $w.top.relation.label -text "Relation" -width 18
1719 listbutton $w.top.relation.b 0\
1720 {{None} {Less than} {Greater than or equal} \
1721 {Equal} {Greater than or equal} {Greater than} {Not equal} \
1723 {Stem} {Relevance} {AlwaysMatches}}
1725 pack $w.top.relation.label $w.top.relation.b -fill x
1727 # Position Attributes
1728 pack $w.top.position -pady 6 -padx 6 -side top
1730 label $w.top.position.label -text "Position" -width 18
1732 listbutton $w.top.position.b 0 {{None} {First in field} {First in subfield}
1733 {Any position in field}}
1735 pack $w.top.position.label $w.top.position.b -fill x
1737 # Structure Attributes
1739 pack $w.top.structure -pady 6 -padx 6 -side top
1741 label $w.top.structure.label -text "Structure" -width 18
1743 listbutton $w.top.structure.b 0 {{None} {Phrase} {Word} {Key} {Year}
1744 {Date (norm)} {Word list} {Date (un-norm)} {Name (norm)} {Date (un-norm)}
1745 {Structure} {urx} {free-form} {doc-text} {local-number} {string}
1748 pack $w.top.structure.label $w.top.structure.b -fill x
1750 # Truncation Attributes
1752 pack $w.top.truncation -pady 6 -padx 6 -side top
1754 label $w.top.truncation.label -text "Truncation" -width 18
1756 listbutton $w.top.truncation.b 0 {{Auto} {Right} {Left} {Left and right} \
1757 {No truncation} {Process #} {Re-1} {Re-2}}
1758 pack $w.top.truncation.label $w.top.truncation.b -fill x
1760 # Completeness Attributes
1762 pack $w.top.completeness -pady 6 -padx 6 -side top
1764 label $w.top.completeness.label -text "Truncation" -width 18
1766 listbutton $w.top.completeness.b 0 {{None} {Incomplete subfield} \
1767 {Complete subfield} {Complete field}}
1768 pack $w.top.completeness.label $w.top.completeness.b -fill x
1771 bottom-buttons $w [list \
1772 {Ok} [list query-setup-action $queryNo] \
1773 {Add index} [list query-add-index $queryNo] \
1774 {Add line} [list query-add-line $queryNo] \
1775 {Delete line} [list query-del-line $queryNo] \
1776 {Cancel} [list destroy $w]] 0
1779 proc index-clear {} {
1780 global queryButtonsFind
1783 foreach b $queryButtonsFind {
1784 .lines.$i.e delete 0 end
1789 proc index-query {} {
1790 global queryButtonsFind
1791 global queryInfoFind
1796 foreach b $queryButtonsFind {
1797 set term [string trim [.lines.$i.e get]]
1799 set attr [lindex [lindex $queryInfoFind [lindex $b 1]] 1]
1801 set term "\{${term}\}"
1803 set term "@attr $a ${term}"
1806 set qs "@and ${qs} ${term}"
1817 proc index-lines {w realOp buttonInfo queryInfo handle} {
1819 foreach b $buttonInfo {
1820 if {! [winfo exists $w.$i]} {
1821 frame $w.$i -background white -border 1
1823 listbuttonx $w.$i.l [lindex $b 1] $queryInfo $handle $i
1826 if {! [winfo exists $w.$i.e]} {
1827 entry $w.$i.e -width 32 -relief sunken -border 1
1828 bind $w.$i.e <FocusIn> [list $w.$i configure \
1830 bind $w.$i.e <FocusOut> [list $w.$i configure \
1832 pack $w.$i.l -side left
1833 pack $w.$i.e -side left -fill x -expand yes
1834 pack $w.$i -side top -fill x -padx 2 -pady 2
1835 bind $w.$i.e <Left> [list left-cursor $w.$i.e]
1836 bind $w.$i.e <Right> [list right-cursor $w.$i.e]
1837 bind $w.$i.e <Return> search-request
1840 pack $w.$i.l -side left
1841 pack $w.$i -side top -fill x -padx 2 -pady 2
1846 while {[winfo exists $w.$j]} {
1857 bind $w.$j.e <Tab> "focus $w.$k.e"
1861 bind $w.$i.e <Tab> "focus $w.0.e"
1866 proc search-fields {w buttondefs} {
1868 foreach buttondef $buttondefs {
1869 frame $w.$i -background white
1871 listbutton $w.$i.l 0 $buttondef
1872 entry $w.$i.e -width 32 -relief sunken
1874 pack $w.$i.l -side left
1875 pack $w.$i.e -side left -fill x -expand yes
1877 pack $w.$i -side top -fill x -padx 2 -pady 2
1879 bind $w.$i.e <Left> [list left-cursor $w.$i.e]
1880 bind $w.$i.e <Right> [list right-cursor $w.$i.e]
1888 bind $w.$j.e <Tab> "focus $w.$k.e \n
1889 $w.$k configure -background red \n
1890 $w.$j configure -background white"
1893 bind $w.$i.e <Tab> "focus $w.0.e \n
1894 $w.0 configure -background red \n
1895 $w.$i configure -background white"
1897 $w.0 configure -background red
1900 if {[info exists windowGeometry(.)]} {
1901 set g $windowGeometry(.)
1909 frame .top -border 1 -relief raised
1910 frame .lines -border 1 -relief raised
1911 frame .mid -border 1 -relief raised
1912 frame .data -border 1 -relief raised
1913 frame .bot -border 1 -relief raised
1914 pack .top .lines .mid -side top -fill x
1915 pack .data -side top -fill both -expand yes
1918 menubutton .top.file -text "File" -underline 0 -menu .top.file.m
1920 .top.file.m add command -label "Save settings" -command {save-settings}
1921 .top.file.m add separator
1922 .top.file.m add command -label "Exit" -command {exit-action}
1924 menubutton .top.target -text "Target" -underline 0 -menu .top.target.m
1926 .top.target.m add cascade -label "Connect" -menu .top.target.m.clist
1927 .top.target.m add command -label "Disconnect" -command {close-target}
1928 .top.target.m add command -label "About" -command {about-target}
1929 .top.target.m add cascade -label "Setup" -menu .top.target.m.slist
1930 .top.target.m add command -label "Setup new" -command {define-target-dialog}
1931 .top.target.m add separator
1934 .top.target.m disable 1
1935 .top.target.m disable 2
1937 menu .top.target.m.clist
1938 menu .top.target.m.slist
1941 menubutton .top.service -text "Service" -underline 0 -menu .top.service.m
1943 .top.service.m add command -label "Database" -command {database-select}
1944 .top.service.m add cascade -label "Query type" -menu .top.service.m.querytype
1945 menu .top.service.m.querytype
1946 .top.service.m.querytype add radiobutton -label "RPN"
1947 .top.service.m.querytype add radiobutton -label "CCL"
1948 .top.service.m add cascade -label "Present" -menu .top.service.m.present
1949 menu .top.service.m.present
1950 .top.service.m.present add command -label "More" \
1951 -command [list present-more 10]
1952 .top.service.m.present add command -label "All" \
1953 -command [list present-more {}]
1954 .top.service configure -state disabled
1956 menubutton .top.rset -text "Set" -menu .top.rset.m
1958 .top.rset.m add command -label "Load" -command {load-set}
1959 .top.rset.m add separator
1961 menubutton .top.options -text "Options" -underline 0 -menu .top.options.m
1963 .top.options.m add cascade -label "Choose query" -menu .top.options.m.clist
1964 .top.options.m add command -label "Define query" -command {new-query-dialog}
1965 .top.options.m add cascade -label "Edit query" -menu .top.options.m.slist
1966 .top.options.m add cascade -label "Format" -menu .top.options.m.formats
1968 menu .top.options.m.slist
1969 menu .top.options.m.clist
1970 menu .top.options.m.formats
1973 foreach f $displayFormats {
1974 .top.options.m.formats add radiobutton -label $f \
1975 -command [list set-display-format $i]
1979 menubutton .top.help -text "Help" -menu .top.help.m
1982 .top.help.m add command -label "Help on help" \
1983 -command {tkerror "Help on help not available. Sorry"}
1984 .top.help.m add command -label "About" -command {about-origin}
1986 pack .top.file .top.target .top.service .top.rset .top.options -side left
1987 pack .top.help -side right
1989 index-lines .lines 1 $queryButtonsFind [lindex $queryInfo 0] activate-index
1991 button .mid.search -width 7 -text {Search} -command search-request \
1993 button .mid.scan -width 7 -text {Scan} \
1994 -command [list scan-request "@attr 1=4 @attr 5=1 @attr 4=1"] -state disabled
1995 button .mid.present -width 7 -text {Present} -command [list present-more 10] \
1998 button .mid.clear -width 7 -text {Clear} -command index-clear
1999 pack .mid.search .mid.scan .mid.present .mid.clear -side left \
2000 -fill y -padx 5 -pady 3
2002 text .data.record -height 2 -width 20 -wrap none \
2003 -yscrollcommand [list .data.scroll set]
2004 scrollbar .data.scroll -command [list .data.record yview]
2005 pack .data.scroll -side right -fill y
2006 pack .data.record -expand yes -fill both
2008 if {[tk colormodel .] == "color"} {
2009 .data.record tag configure marc-tag -foreground blue
2010 .data.record tag configure marc-id -foreground red
2012 .data.record tag configure marc-tag -foreground black
2013 .data.record tag configure marc-id -foreground black
2015 .data.record tag configure marc-data -foreground black
2017 button .bot.logo -bitmap @book1 -command cancel-operation
2019 pack .bot.a -side left -fill x
2020 pack .bot.logo -side right -padx 2 -pady 2
2022 message .bot.a.target -text "" -aspect 1000 -border 1
2024 label .bot.a.status -text "Not connected" -width 15 -relief \
2025 sunken -anchor w -border 1
2026 label .bot.a.set -text "" -width 5 -relief \
2027 sunken -anchor w -border 1
2028 label .bot.a.message -text "" -width 15 -relief \
2029 sunken -anchor w -border 1
2031 pack .bot.a.target -side top -anchor nw -padx 2 -pady 2
2032 pack .bot.a.status .bot.a.set .bot.a.message \
2033 -side left -padx 2 -pady 2
2035 #bind . <Any-Enter> {focus .lines.0.e}
2039 .top.options.m.formats invoke $displayFormat