Inverse highligt colours in monochrome mode.
[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.4  1995-06-19 08:10:21  adam
8 # Inverse highligt colours in monochrome mode.
9 #
10 # Revision 1.3  1995/06/16  12:29:00  adam
11 # Use insertWithTags on diagnostic errors.
12 #
13 # Revision 1.2  1995/06/13  14:39:06  adam
14 # Fix: if {$var != ""} doesn't work if var is a large numerical!
15 # Highlight when line format is used.
16 #
17 # Revision 1.1  1995/06/12  15:18:10  adam
18 # Work on presentation formats. These are used in the main window as well
19 # as popup windows.
20 #
21 #
22
23 proc display-line {sno no w hflag} {
24     set type [z39.$sno type $no] 
25     if {$hflag} {
26         if {[tk colormodel .] == "color"} {
27             $w tag bind r$no <Any-Enter> \
28                 [list $w tag configure r$no -background gray80]
29             $w tag bind r$no <Any-Leave> \
30                 [list $w tag configure r$no -background {}]
31         } else {
32             $w tag bind r$no <Any-Enter> \
33                 [list $w tag configure r$no -background black -foreground white]
34             $w tag bind r$no <Any-Leave> \
35                 [list $w tag configure r$no -background {} -foreground {}]
36         }
37     } else {
38         $w delete 0.0 end
39     }
40     if {$type == "DB"} {
41         if {$hflag} {
42             set nostr [format "%5d " $no]
43             insertWithTags $w $nostr marc-tag
44         }
45         set title [lindex [z39.$sno getMarc $no field 245 * a] 0]
46         set year  [lindex [z39.$sno getMarc $no field 260 * c] 0]
47         insertWithTags $w "$title - $year\n" marc-data
48         $w tag bind marc-data 
49     } elseif {$type == "SD"} {
50         set err [lindex [z39.$sno diag $no] 1]
51         set add [lindex [z39.$sno diag $no] 2]
52         if {$add != {}} {
53             set add " :${add}"
54         }
55         insertWithTags $w "Error ${err}${add}\n" marc-data
56     } elseif {$type == ""} {
57         return
58     }
59 }