Feature: SUTRS. Setting getSutrs implemented.
[ir-tcl-moved-to-github.git] / formats / line.tcl
1 # IR toolkit for tcl/tk
2 # (c) Index Data 1995
3 # See the file LICENSE for details.
4 # Sebastian Hammer, Adam Dickmeiss
5 #
6 # $Log: line.tcl,v $
7 # Revision 1.5  1995-06-22 13:16:28  adam
8 # Feature: SUTRS. Setting getSutrs implemented.
9 # Work on display formats.
10 #
11 # Revision 1.4  1995/06/19  08:10:21  adam
12 # Inverse highligt colours in monochrome mode.
13 #
14 # Revision 1.3  1995/06/16  12:29:00  adam
15 # Use insertWithTags on diagnostic errors.
16 #
17 # Revision 1.2  1995/06/13  14:39:06  adam
18 # Fix: if {$var != ""} doesn't work if var is a large numerical!
19 # Highlight when line format is used.
20 #
21 # Revision 1.1  1995/06/12  15:18:10  adam
22 # Work on presentation formats. These are used in the main window as well
23 # as popup windows.
24 #
25 #
26
27 proc display-line {sno no w hflag} {
28     set type [z39.$sno type $no] 
29     if {$hflag} {
30         if {[tk colormodel .] == "color"} {
31             $w tag bind r$no <Any-Enter> \
32                 [list $w tag configure r$no -background gray80]
33             $w tag bind r$no <Any-Leave> \
34                 [list $w tag configure r$no -background {}]
35         } else {
36             $w tag bind r$no <Any-Enter> \
37                 [list $w tag configure r$no -background black -foreground white]
38             $w tag bind r$no <Any-Leave> \
39                 [list $w tag configure r$no -background {} -foreground {}]
40         }
41     } else {
42         $w delete 0.0 end
43     }
44     if {$hflag} {
45         set nostr [format "%5d " $no]
46         insertWithTags $w $nostr marc-tag
47     }
48     if {$type == "DB"} {
49         set rtype [z39.$sno recordType $no]
50         if {$rtype == "SUTRS"} {
51             insertWithTags $w [join [z39.$sno getSutrs $no]]
52         } else {
53             if {[catch {
54                 set title [lindex [z39.$sno getMarc $no field 245 * a] 0]
55                 set year  [lindex [z39.$sno getMarc $no field 260 * c] 0]
56                 insertWithTags $w "$title - $year\n" marc-data
57             }]} {
58                 insertWithTags $w "Unknown record type: $rtype\n" marc-id
59             }
60         }
61     } elseif {$type == "SD"} {
62         set err [lindex [z39.$sno diag $no] 1]
63         set add [lindex [z39.$sno diag $no] 2]
64         if {$add != {}} {
65             set add " :${add}"
66         }
67         insertWithTags $w "Error ${err}${add}\n" marc-id
68     } 
69 }