1 # IR toolkit for tcl/tk
3 # See the file LICENSE for details.
4 # Sebastian Hammer, Adam Dickmeiss
7 # Revision 1.15 1997-11-24 11:34:38 adam
8 # Using odr_nullval() instead of ODR_NULLVAL when appropriate.
10 # Revision 1.14 1997/11/19 11:22:10 adam
11 # Object identifiers can be accessed in GRS-1 records.
13 # Revision 1.13 1996/04/12 12:25:27 adam
14 # Modified display of GRS-1 records to include headings for standard
17 # Revision 1.12 1996/03/29 16:05:36 adam
18 # Bug fix: GRS records wasn't recognized.
20 # Revision 1.11 1996/01/23 15:24:21 adam
21 # Wrore more comments.
23 # Revision 1.10 1995/10/17 17:39:46 adam
24 # Minor bug fix in call to display-grs-line.
26 # Revision 1.9 1995/10/17 14:18:09 adam
27 # Minor changes in presentation formats.
29 # Revision 1.8 1995/10/17 10:58:08 adam
30 # More work on presentation formats.
32 # Revision 1.7 1995/09/20 11:37:06 adam
35 # Revision 1.6 1995/06/29 12:34:20 adam
36 # IrTcl now works with both tk4.0b4/tcl7.4b4 and tk3.6/tcl7.3
38 # Revision 1.5 1995/06/22 13:16:28 adam
39 # Feature: SUTRS. Setting getSutrs implemented.
40 # Work on display formats.
42 # Revision 1.4 1995/06/19 08:10:21 adam
43 # Inverse highligt colours in monochrome mode.
45 # Revision 1.3 1995/06/16 12:29:00 adam
46 # Use insertWithTags on diagnostic errors.
48 # Revision 1.2 1995/06/13 14:39:06 adam
49 # Fix: if {$var != ""} doesn't work if var is a large numerical!
50 # Highlight when line format is used.
52 # Revision 1.1 1995/06/12 15:18:10 adam
53 # Work on presentation formats. These are used in the main window as well
57 proc display-grs-line {w r i} {
61 set start [$w index insert]
66 for {set j 0} {$j < $i} {incr j} {
67 insertWithTags $w " " marc-tag
70 set ttype [lindex $e 0]
71 set tval [lindex $e 2]
72 if {$ttype == 2 && $tval == 1} {
73 if {[lindex $e 3] == "subtree"} {
76 if {[lindex $e 0] == 1 && [lindex $e 2] == 19} {
81 if {[lindex $e 3] == "string"} {
82 set head [lindex $e 4]
87 insertWithTags $w $head marc-text
88 insertWithTags $w "\n"
90 $w tag configure indent$i \
91 -lmargin1 [expr $i * 10] \
92 -lmargin2 [expr $i * 10 + 5]
93 $w tag add indent$i $start insert
97 # Procedure display-line {sno no w hflag}
98 # sno result set number (integer)
99 # no record position (integer)
100 # w text widget in which the record should be displayed.
101 # hflag header flag. If true a header showing the record position
102 # should be displayed.
103 # This procedure attempts to display records in a line-per-line format.
104 proc display-line {sno no w hflag} {
106 set type [z39.$sno type $no]
109 $w tag bind r$no <Any-Enter> \
110 [list $w tag configure r$no -background gray80]
111 $w tag bind r$no <Any-Leave> \
112 [list $w tag configure r$no -background {}]
114 $w tag bind r$no <Any-Enter> \
115 [list $w tag configure r$no -background black -foreground white]
116 $w tag bind r$no <Any-Leave> \
117 [list $w tag configure r$no -background {} -foreground {}]
123 set nostr [format "%5d " $no]
124 insertWithTags $w $nostr marc-small-head
127 set rtype [z39.$sno recordType $no]
128 if {$rtype == "SUTRS"} {
129 insertWithTags $w [join [z39.$sno getSutrs $no]]
130 } elseif {$rtype == "GRS-1"} {
131 display-grs-line $w [z39.$sno getGrs $no] 0
134 set title [lindex [z39.$sno getMarc $no field 245 * a] 0]
135 set year [lindex [z39.$sno getMarc $no field 260 * c] 0]
136 insertWithTags $w "$title - " marc-text
137 insertWithTags $w "$year\n" marc-it
139 insertWithTags $w "Unknown record type: $rtype\n" marc-id
142 } elseif {$type == "SD"} {
143 set err [lindex [z39.$sno diag $no] 1]
144 set add [lindex [z39.$sno diag $no] 2]
148 insertWithTags $w "Error ${err}${add}\n" marc-id