1#
2# fdispLabel.tcl
3#
4# This sets the color (or monochrome) feedback for the folder display area.
5# There are four states for a label, normal, unseen, target, current.
6# Each label has two parts, a box and text.
7# (Some labels can be bitmaps, in which case they just have a bitmap.)
8# You can read the TK man page on the canvas widget to see what
9# sort of looks are possible for text and rectangles.  The defaults use
10# -fill color		;# for text color
11# -fill color		;# for box background
12# -outline color	;# for box outline color
13# -width number		;# for box outline width
14# -stipple bitmap	;# for box stipple pattern
15#
16# In turn, for color displays, there are 5 basic colors that can be set
17# by ~/.exmh_defaults
18# Resource	Variable		Comment
19# c_foreground	$fdisp(c_fg)		Foreground
20# c_background	$fdisp(c_bg)		Background
21# c_current	$fdisp(c_current)	Current folder
22# c_unseen	$fdisp(c_unseen)	Unseen messages in the folder
23# c_moved	$fdisp(c_moved)		Target folder / moved message
24#
25# For monochrome displays, the Canvas.foreground and Canvas.background
26# resources determine the foreground and background colors of the labels
27#
28# For consistency these colors are shared with the folder table of contents
29# display.  If you find this limiting, wack away on the itemconfigures...
30#
31# Copyright (c) 1993 Xerox Corporation.
32# Use and copying of this software and preparation of derivative works based
33# upon this software are permitted. Any distribution of this software or
34# derivative works must comply with all applicable United States export
35# control laws. This software is made available AS IS, and Xerox Corporation
36# makes no warranty about the software, its performance or its conformity to
37# any specification.
38
39proc Fdisp_LabelConfigure { canvas } {
40    global fdisp
41    #
42    # Note that a particular label may have multiple tags, so more than
43    # one of these itemconfigures will hit.  Therefore their ordering
44    # is important, and you can play some tricks with combinations.
45    # (more so on color displays)
46    #
47    Fdisp_FixupSpecials $canvas
48    if {[winfo depth .] <= 4} {
49	set fg [option get . c_foreground {}]
50	set bg [option get . c_background {}]
51	$canvas itemconfigure text -fill $fg
52	$canvas itemconfigure box -fill $bg -width 1 -stipple {} -outline $fg
53	$canvas itemconfigure bitmap -foreground $fg -background $bg
54
55	$canvas itemconfigure unsntext -fill $fg
56	$canvas itemconfigure unsnbox -width 3 -outline $fg
57	$canvas itemconfigure unsnbitmap -foreground $bg -background $fg
58
59	$canvas itemconfigure tartext -fill $fg
60	$canvas itemconfigure tarbox -fill $fg -stipple gray25
61	$canvas itemconfigure tarbitmap -foreground $bg -background $fg
62
63	$canvas itemconfigure curtext -fill $bg
64	$canvas itemconfigure curbox -fill $fg -stipple {}
65	$canvas itemconfigure curbitmap -foreground $bg -background $fg
66    } else {
67	$canvas itemconfigure text -fill $fdisp(c_fg)
68	$canvas itemconfigure box -fill $fdisp(c_bg) \
69				-outline $fdisp(c_fg) -width 1 -stipple {}
70	$canvas itemconfigure bitmap -foreground $fdisp(c_fg) \
71				-background $fdisp(c_bg)
72
73	# Let current text be overridden by unseen & target feedback
74	$canvas itemconfigure curtext -fill $fdisp(c_current)
75
76	$canvas itemconfigure unsntext -fill $fdisp(c_unseenBg)
77	$canvas itemconfigure unsnbox -fill $fdisp(c_unseen)
78	$canvas itemconfigure unsnbox -outline $fdisp(c_unseen) -width 2
79	$canvas itemconfigure unsnbitmap -foreground $fdisp(c_unseen) \
80					-background $fdisp(c_bg)
81
82	$canvas itemconfigure tartext -fill $fdisp(c_movedFg)
83	$canvas itemconfigure tarbox -fill $fdisp(c_moved)
84	$canvas itemconfigure tarbitmap -foreground $fdisp(c_moved) \
85					-background $fdisp(c_bg)
86
87	$canvas itemconfigure curbox -outline $fdisp(c_current) -width 2
88	$canvas itemconfigure curbitmap -foreground $fdisp(c_current) \
89					-background $fdisp(c_bg)
90    }
91}
92
93proc FdispClearHighlights { can } {
94    global fdisp
95
96    set canvas $fdisp($can)
97
98    foreach tag [concat {unsnbitmap unsnbox unsntext} $fdisp(leafs,$can)] {
99	$canvas dtag $tag
100    }
101    # The leaf tags cause ancestor nodes to be highlighted
102    set fdisp(leafs,$can) {}
103
104    # Deleting tags does not undo looks (like text widget!)
105    # So we manually reset looks on the labels here.
106    if {[winfo depth .] <= 4} {
107	$canvas itemconfigure text -fill black
108	$canvas itemconfigure box -fill white -width 1 -stipple {}
109	$canvas itemconfigure bitmap -foreground black -background white
110    } else {
111	$canvas itemconfigure text -fill $fdisp(c_fg)
112	$canvas itemconfigure box -fill $fdisp(c_bg) \
113				-outline $fdisp(c_fg) -width 1 -stipple {}
114	$canvas itemconfigure bitmap -foreground $fdisp(c_fg) \
115				-background $fdisp(c_bg)
116    }
117}
118
119