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