1 # IR toolkit for tcl/tk
3 # See the file LICENSE for details.
4 # Sebastian Hammer, Adam Dickmeiss
7 # Revision 1.11 1996-01-23 15:24:21 adam
10 # Revision 1.10 1995/10/17 17:39:46 adam
11 # Minor bug fix in call to display-grs-line.
13 # Revision 1.9 1995/10/17 14:18:09 adam
14 # Minor changes in presentation formats.
16 # Revision 1.8 1995/10/17 10:58:08 adam
17 # More work on presentation formats.
19 # Revision 1.7 1995/09/20 11:37:06 adam
22 # Revision 1.6 1995/06/29 12:34:20 adam
23 # IrTcl now works with both tk4.0b4/tcl7.4b4 and tk3.6/tcl7.3
25 # Revision 1.5 1995/06/22 13:16:28 adam
26 # Feature: SUTRS. Setting getSutrs implemented.
27 # Work on display formats.
29 # Revision 1.4 1995/06/19 08:10:21 adam
30 # Inverse highligt colours in monochrome mode.
32 # Revision 1.3 1995/06/16 12:29:00 adam
33 # Use insertWithTags on diagnostic errors.
35 # Revision 1.2 1995/06/13 14:39:06 adam
36 # Fix: if {$var != ""} doesn't work if var is a large numerical!
37 # Highlight when line format is used.
39 # Revision 1.1 1995/06/12 15:18:10 adam
40 # Work on presentation formats. These are used in the main window as well
45 proc display-grs-line {w r i} {
47 for {set j 0} {$j < $i} {incr j} {
48 insertWithTags $w " " {}
50 insertWithTags $w "([lindex $e 0]:[lindex $e 2])" marc-tag
51 if {[lindex $e 3] == "string"} {
52 insertWithTags $w [lindex $e 4] {}
53 insertWithTags $w "\n" {}
54 } elseif {[lindex $e 3] == "subtree"} {
55 insertWithTags $w "\n" {}
56 display-grs-line $w [lindex $e 4] [expr $i+1]
58 insertWithTags $w [lindex $e 4] {}
59 insertWithTags $w " ?\n" {}
64 # Procedure display-line {sno no w hflag}
65 # sno result set number (integer)
66 # no record position (integer)
67 # w text widget in which the record should be displayed.
68 # hflag header flag. If true a header showing the record position
69 # should be displayed.
70 # This procedure attempts to display records in a line-per-line format.
71 proc display-line {sno no w hflag} {
73 set type [z39.$sno type $no]
76 $w tag bind r$no <Any-Enter> \
77 [list $w tag configure r$no -background gray80]
78 $w tag bind r$no <Any-Leave> \
79 [list $w tag configure r$no -background {}]
81 $w tag bind r$no <Any-Enter> \
82 [list $w tag configure r$no -background black -foreground white]
83 $w tag bind r$no <Any-Leave> \
84 [list $w tag configure r$no -background {} -foreground {}]
90 set nostr [format "%5d " $no]
91 insertWithTags $w $nostr marc-small-head
94 set rtype [z39.$sno recordType $no]
95 if {$rtype == "SUTRS"} {
96 insertWithTags $w [join [z39.$sno getSutrs $no]]
97 } elseif {$rtype == "GRS1"} {
98 display-grs-line $w [z39.$sno getGrs $no] 0
101 set title [lindex [z39.$sno getMarc $no field 245 * a] 0]
102 set year [lindex [z39.$sno getMarc $no field 260 * c] 0]
103 insertWithTags $w "$title - " marc-text
104 insertWithTags $w "$year\n" marc-it
106 insertWithTags $w "Unknown record type: $rtype\n" marc-id
109 } elseif {$type == "SD"} {
110 set err [lindex [z39.$sno diag $no] 1]
111 set add [lindex [z39.$sno diag $no] 2]
115 insertWithTags $w "Error ${err}${add}\n" marc-id