1 # IR toolkit for tcl/tk
3 # See the file LICENSE for details.
4 # Sebastian Hammer, Adam Dickmeiss
7 # Revision 1.7 1995-09-20 11:37:06 adam
10 # Revision 1.6 1995/06/29 12:34:20 adam
11 # IrTcl now works with both tk4.0b4/tcl7.4b4 and tk3.6/tcl7.3
13 # Revision 1.5 1995/06/22 13:16:28 adam
14 # Feature: SUTRS. Setting getSutrs implemented.
15 # Work on display formats.
17 # Revision 1.4 1995/06/19 08:10:21 adam
18 # Inverse highligt colours in monochrome mode.
20 # Revision 1.3 1995/06/16 12:29:00 adam
21 # Use insertWithTags on diagnostic errors.
23 # Revision 1.2 1995/06/13 14:39:06 adam
24 # Fix: if {$var != ""} doesn't work if var is a large numerical!
25 # Highlight when line format is used.
27 # Revision 1.1 1995/06/12 15:18:10 adam
28 # Work on presentation formats. These are used in the main window as well
32 proc display-grs-line {w r i} {
34 for {set j 0} {$j < $i} {incr j} {
35 insertWithTags $w " " {}
37 insertWithTags $w "([lindex $e 0]:[lindex $e 2])" marc-tag
38 if {[lindex $e 3] == "string"} {
39 insertWithTags $w [lindex $e 4] {}
40 insertWithTags $w "\n" {}
41 } elseif {[lindex $e 3] == "subtree"} {
42 insertWithTags $w "\n" {}
43 display-grs-line $w [lindex $e 4] [expr $i+1]
45 insertWithTags [lindex $e 4] {}
46 insertWithTags $w " ?\n" {}
51 proc display-line {sno no w hflag} {
53 set type [z39.$sno type $no]
56 $w tag bind r$no <Any-Enter> \
57 [list $w tag configure r$no -background gray80]
58 $w tag bind r$no <Any-Leave> \
59 [list $w tag configure r$no -background {}]
61 $w tag bind r$no <Any-Enter> \
62 [list $w tag configure r$no -background black -foreground white]
63 $w tag bind r$no <Any-Leave> \
64 [list $w tag configure r$no -background {} -foreground {}]
70 set nostr [format "%5d " $no]
71 insertWithTags $w $nostr marc-tag
74 set rtype [z39.$sno recordType $no]
75 if {$rtype == "SUTRS"} {
76 insertWithTags $w [join [z39.$sno getSutrs $no]]
77 } elseif {$rtype == "GRS1"} {
78 display-grs-line $w [z39.$sno getGrs $no] 6
81 set title [lindex [z39.$sno getMarc $no field 245 * a] 0]
82 set year [lindex [z39.$sno getMarc $no field 260 * c] 0]
83 insertWithTags $w "$title - $year\n" marc-data
85 insertWithTags $w "Unknown record type: $rtype\n" marc-id
88 } elseif {$type == "SD"} {
89 set err [lindex [z39.$sno diag $no] 1]
90 set add [lindex [z39.$sno diag $no] 2]
94 insertWithTags $w "Error ${err}${add}\n" marc-id