1 # IR toolkit for tcl/tk
3 # See the file LICENSE for details.
4 # Sebastian Hammer, Adam Dickmeiss
7 # Revision 1.13 1996-04-12 12:25:27 adam
8 # Modified display of GRS-1 records to include headings for standard
11 # Revision 1.12 1996/03/29 16:05:36 adam
12 # Bug fix: GRS records wasn't recognized.
14 # Revision 1.11 1996/01/23 15:24:21 adam
15 # Wrore more comments.
17 # Revision 1.10 1995/10/17 17:39:46 adam
18 # Minor bug fix in call to display-grs-line.
20 # Revision 1.9 1995/10/17 14:18:09 adam
21 # Minor changes in presentation formats.
23 # Revision 1.8 1995/10/17 10:58:08 adam
24 # More work on presentation formats.
26 # Revision 1.7 1995/09/20 11:37:06 adam
29 # Revision 1.6 1995/06/29 12:34:20 adam
30 # IrTcl now works with both tk4.0b4/tcl7.4b4 and tk3.6/tcl7.3
32 # Revision 1.5 1995/06/22 13:16:28 adam
33 # Feature: SUTRS. Setting getSutrs implemented.
34 # Work on display formats.
36 # Revision 1.4 1995/06/19 08:10:21 adam
37 # Inverse highligt colours in monochrome mode.
39 # Revision 1.3 1995/06/16 12:29:00 adam
40 # Use insertWithTags on diagnostic errors.
42 # Revision 1.2 1995/06/13 14:39:06 adam
43 # Fix: if {$var != ""} doesn't work if var is a large numerical!
44 # Highlight when line format is used.
46 # Revision 1.1 1995/06/12 15:18:10 adam
47 # Work on presentation formats. These are used in the main window as well
51 proc display-grs-line {w r i} {
55 set start [$w index insert]
59 for {set j 0} {$j < $i} {incr j} {
60 insertWithTags $w " " marc-tag
63 set ttype [lindex $e 0]
64 set tval [lindex $e 2]
65 if {[info exists tagSet($ttype,$tval)]} {
66 insertWithTags $w "$tagSet($ttype,$tval) " marc-pref
68 insertWithTags $w "$tval " marc-pref
70 if {[lindex $e 3] == "string"} {
71 insertWithTags $w [lindex $e 4] marc-text
72 insertWithTags $w "\n"
77 $w tag configure indent$i \
78 -lmargin1 [expr $i * 10] \
79 -lmargin2 [expr $i * 10 + 5]
80 $w tag add indent$i $start insert
84 # Procedure display-line {sno no w hflag}
85 # sno result set number (integer)
86 # no record position (integer)
87 # w text widget in which the record should be displayed.
88 # hflag header flag. If true a header showing the record position
89 # should be displayed.
90 # This procedure attempts to display records in a line-per-line format.
91 proc display-line {sno no w hflag} {
93 set type [z39.$sno type $no]
96 $w tag bind r$no <Any-Enter> \
97 [list $w tag configure r$no -background gray80]
98 $w tag bind r$no <Any-Leave> \
99 [list $w tag configure r$no -background {}]
101 $w tag bind r$no <Any-Enter> \
102 [list $w tag configure r$no -background black -foreground white]
103 $w tag bind r$no <Any-Leave> \
104 [list $w tag configure r$no -background {} -foreground {}]
110 set nostr [format "%5d " $no]
111 insertWithTags $w $nostr marc-small-head
114 set rtype [z39.$sno recordType $no]
115 if {$rtype == "SUTRS"} {
116 insertWithTags $w [join [z39.$sno getSutrs $no]]
117 } elseif {$rtype == "GRS-1"} {
118 display-grs-line $w [z39.$sno getGrs $no] 0
121 set title [lindex [z39.$sno getMarc $no field 245 * a] 0]
122 set year [lindex [z39.$sno getMarc $no field 260 * c] 0]
123 insertWithTags $w "$title - " marc-text
124 insertWithTags $w "$year\n" marc-it
126 insertWithTags $w "Unknown record type: $rtype\n" marc-id
129 } elseif {$type == "SD"} {
130 set err [lindex [z39.$sno diag $no] 1]
131 set add [lindex [z39.$sno diag $no] 2]
135 insertWithTags $w "Error ${err}${add}\n" marc-id