1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
|
diff -aurN tix8.2.0/unix/Makefile.in funkhouser's/patch/Makefile.in
--- tix8.2.0/unix/Makefile.in 2001-01-10 23:43:46.000000000 -0800
+++ unix/Makefile.in 2002-10-11 13:58:52.000000000 -0700
@@ -44,6 +44,9 @@
# Directory in which to install libtix.so or libtix.a:
LIB_INSTALL_DIR = $(INSTALL_ROOT)$(libdir)
+# Directory in which to install tix.h
+INCLUDE_INSTALL_DIR = $(INSTALL_ROOT)$(includedir)
+
# Path name to use when installing library scripts.
SCRIPT_INSTALL_DIR = $(INSTALL_ROOT)$(TIX_LIBRARY)
@@ -584,7 +587,7 @@
-rm -f config.cache config.log stamp-h stamp-h[0-9]*
-rm -f config.status
-install: install-binaries install-libraries install-doc
+install: install-binaries install-libraries install-doc install-headers install-tools
install-strip:
$(MAKE) install INSTALL_PROGRAM="$(INSTALL_PROGRAM) -s"
@@ -619,6 +622,17 @@
"Installing $(TIX_EXE_FILE) as $(BIN_INSTALL_DIR)/$(TIX_EXE_FILE)"
@$(INSTALL_PROGRAM) $(TIX_EXE_FILE) $(BIN_INSTALL_DIR)/$(TIX_EXE_FILE)
+install-headers:
+ @echo "Installing header files";
+ @for i in $(GENERIC_DIR)/tix.h; \
+ do \
+ $(INSTALL_DATA) $$i $(INCLUDE_INSTALL_DIR); \
+ done;
+
+install-tools:
+ @echo "installing the tixindex program for building tclIndex for Tix scripts"
+ @$(INSTALL_DATA) $(TIX_SRC_DIR)/tools/tixindex $(BIN_INSTALL_DIR)
+
install-libraries: libraries
@for i in $(SCRIPT_INSTALL_DIR); \
do \
diff -aurN tix8.2.0/library/HList.tcl haneef's/patch/HList.tcl
--- tix8.2.0/library/HList.tcl 2001-01-23 23:28:35.000000000 -0800
+++ library/HList.tcl 2002-10-11 13:57:35.000000000 -0700
@@ -394,6 +394,9 @@
proc tixHList:AutoScan {w} {
case [tixHList:GetState $w] {
+ {10 11} {
+ tixHList:GoState 11 $w
+ }
{29 30} {
tixHList:GoState 30 $w
}
@@ -491,17 +494,19 @@
tixHList:GoState 0 $w
}
+# start auto-scanning inside a single/browse widget
proc tixHList:GoState-10 {w} {
tixHList:StartScan $w
}
+# repeat auto-scanning inside a single/browse widget
proc tixHList:GoState-11 {w} {
global tkPriv
tixHList:DoScan $w
set oldEnt [$w info anchor]
- set ent [tixHList:SetAnchor $w $tkPriv(x) $tkPriv(y)]
+ set ent [tixHList:SetAnchor $w $tkPriv(x) $tkPriv(y) 0 1]
if {$ent == "" || $oldEnt == $ent} {
return
@@ -718,12 +723,18 @@
tixHList:GoState 0 $w
}
+# ctrl-button-1 has been pressed in extended selection mode
proc tixHList:GoState-33 {w x y} {
set ent [tixHList:GetNearest $w $y]
if {$ent != ""} {
$w anchor set $ent
- $w selection set $ent
- tixHList:Browse $w $ent
+ if { [lsearch [$w info selection] $ent] >= 0 } {
+ # toggle
+ $w selection clear $ent
+ } else {
+ $w selection set $ent
+ tixHList:Browse $w $ent
+ }
}
}
@@ -745,13 +756,15 @@
return $ent
}
-proc tixHList:SetAnchor {w x y {disableOK 0}} {
+proc tixHList:SetAnchor {w x y {disableOK 0} {dontsee 0}} {
set ent [tixHList:GetNearest $w $y $disableOK]
if {$ent != ""} {
if {[$w entrycget $ent -state] != "disabled"} {
$w anchor set $ent
- $w see $ent
+ if {!$dontsee} {
+ $w see $ent
+ }
return $ent
} elseif $disableOK {
return $ent
@@ -846,3 +859,230 @@
}
+#----------------------------------------------------------------------
+#
+# Header resizing. Based on Art Morel's work.
+#
+#----------------------------------------------------------------------
+
+bind TixHListHeader <Motion> {
+ tixHList:header:setHeaderCursor [winfo parent %W] %W %x %y
+}
+bind TixHListHeader <Enter> {
+ tixHList:header:setHeaderCursor [winfo parent %W] %W %x %y
+}
+bind TixHListHeader <Leave> {
+ tixHList:header:setHeaderCursor [winfo parent %W] %W %x %y
+}
+bind TixHListHeader <1> {
+ tixHList:header:mark [winfo parent %W] %x
+}
+bind TixHListHeader <Button1-Enter> {
+ tixHList:header:drag [winfo parent %W] %x
+}
+bind TixHListHeader <Button1-Leave> {
+ tixHList:header:drag [winfo parent %W] %x
+}
+bind TixHListHeader <Button1-Motion> {
+ tixHList:header:drag [winfo parent %W] %x
+}
+bind TixHListHeader <ButtonRelease-1> {
+ tixHList:header:endDrag [winfo parent %W] %x
+}
+
+# tixHList:header:setHeaderCursor --
+# Change the header window's cursor to <-> when it's placed on top
+# of the border between two header columns.
+# Arguments:
+# hlist The HList whose column is being resized.
+# header The private header window of the HList.
+# x Mouse X location (relative to header window)
+# y Mouse Y location (relative to header window)
+# Results:
+# Returns nothing
+#
+proc tixHList:header:setHeaderCursor {hlist header x y} {
+ global tixPriv
+
+ if {$y >= 0 && $y < [winfo height $header] &&
+ [tixHList:header:getColumn $hlist $x] != -1} {
+ if {![info exists tixPriv(hlist:oldcursor)]} {
+ set col [tixHList:header:getColumn $hlist $x]
+ set colx [tixHList:header:getColumnX $hlist $col]
+ set tixPriv(hlist:col) $col
+ set tixPriv(hlist:startx) $colx
+ set tixPriv(hlist:oldcursor) [$hlist cget -cursor]
+ $hlist config -cursor sb_h_double_arrow
+ }
+ } else {
+ if {[info exists tixPriv(hlist:oldcursor)]} {
+ $hlist config -cursor $tixPriv(hlist:oldcursor)
+ unset tixPriv(hlist:oldcursor)
+ }
+ }
+}
+
+# tixHList:header:mark --
+# Initialize the header dragging indicator line.
+# Arguments:
+# hlist The Hlist whose column is being resized.
+# x Mouse X location (relative to header window)
+# Results:
+# Returns nothing
+#
+proc tixHList:header:mark {hlist x} {
+ global tixPriv
+
+ if {![info exists tixPriv(hlist:oldcursor)]} {
+ return
+ }
+
+ set col [tixHList:header:getColumn $hlist $x]
+ set colx [tixHList:header:getColumnX $hlist $col]
+ tixHList:header:drawDragLines set $hlist $colx
+
+ set tixPriv(hlist:startx) $x
+ set tixPriv(hlist:col) $col
+}
+
+# tixHList:header:drag --
+# Move the header dragging indicator line.
+# Arguments:
+# hlist The Hlist whose column is being resized.
+# x Mouse X location (relative to header window)
+# Results:
+# Returns nothing
+#
+proc tixHList:header:drag {hlist x} {
+ global tixPriv
+
+ if {![info exists tixPriv(hlist:oldcursor)]} {
+ return
+ }
+
+ set x [tixHList:header:restrictDrag $hlist $tixPriv(hlist:col) $x]
+ set delta [expr $x - $tixPriv(hlist:startx)]
+ set colx [tixHList:header:getColumnX $hlist $tixPriv(hlist:col)]
+
+ tixHList:header:drawDragLines update $hlist [expr $colx + $delta]
+}
+
+# tixHList:header:endDrag --
+# End header dragging and resize the affected column
+# Arguments:
+# hlist The Hlist whose column is being resized.
+# x Mouse X location (relative to header window)
+# Results:
+# Returns nothing
+#
+proc tixHList:header:endDrag {hlist x} {
+ global tixPriv
+
+ if {![info exists tixPriv(hlist:oldcursor)]} {
+ return
+ }
+ tixHList:header:drawDragLines cancel $hlist
+
+ set x [tixHList:header:restrictDrag $hlist $tixPriv(hlist:col) $x]
+ set width [$hlist column width $tixPriv(hlist:col)]
+ set delta [expr $x - $tixPriv(hlist:startx)]
+ set nwidth [expr $delta + $width]
+ if {$nwidth < 8} {
+ set nwidth 8
+ }
+ $hlist column width $tixPriv(hlist:col) $nwidth
+ $hlist config -cursor $tixPriv(hlist:oldcursor)
+
+ unset tixPriv(hlist:startx)
+ unset tixPriv(hlist:oldcursor)
+ unset tixPriv(hlist:col)
+ $hlist config -cursor {}
+}
+
+# Returns the vertical line that divides col and col+1
+proc tixHList:header:getColumnX {hlist col} {
+ set colx 0
+ for {set i 0} {$i <= $col} {incr i} {
+ incr colx [$hlist column width $i]
+ }
+ incr colx -[$hlist xview]
+
+ return $colx
+}
+
+proc tixHList:header:restrictDrag {hlist col x} {
+ set min [expr [tixHList:header:getColumnX $hlist [expr $col - 1]] + 8]
+ set max [expr [winfo width $hlist] - [$hlist cget -bd] - 2]
+
+ if {$x < $min} {
+ set x $min
+ }
+ if {$x > $max} {
+ set x $max
+ }
+
+ if {$x < 0} {
+ set x 0
+ }
+ if {$x > [winfo width $hlist]} {
+ set x [expr [winfo width $hlist] - 1]
+ }
+ return $x
+}
+
+
+proc tixHList:header:drawDragLines {mode {hlist {}} {x {}}} {
+ global tixPriv
+
+ if {$mode != "set"} {
+ if {[info exists tixPriv(hlist:drX)]} {
+ set oldX $tixPriv(hlist:drX)
+ set oldY1 $tixPriv(hlist:drY1)
+ set oldY2 $tixPriv(hlist:drY2)
+
+ tixTmpLine $oldX $oldY1 $oldX $oldY2 $hlist
+ }
+ }
+
+ if {$mode == "cancel"} {
+ catch {
+ unset tixPriv(hlist:drX)
+ unset tixPriv(hlist:drY1)
+ unset tixPriv(hlist:drY2)
+ }
+ return
+ }
+
+ set y1 [$hlist cget -bd]
+ set y2 [expr [winfo height $hlist] - 2 * $y1]
+
+ incr x [winfo rootx $hlist]
+ incr y1 [winfo rooty $hlist]
+ incr y2 [winfo rooty $hlist]
+
+ tixTmpLine $x $y1 $x $y2 $hlist
+
+ set tixPriv(hlist:drX) $x
+ set tixPriv(hlist:drY1) $y1
+ set tixPriv(hlist:drY2) $y2
+}
+
+# Returns the column which is just to the left of the mouse cursor
+proc tixHList:header:getColumn {hlist x} {
+ set fuzzy 3
+ set sum 0
+ set max [expr [$hlist cget -columns] - 1]
+ incr x [$hlist xview]
+
+ for {set col 0} {$col < $max} {incr col} {
+ set width [$hlist column width $col]
+ incr sum $width
+ if {abs($x - $sum) <= $fuzzy} {
+ return $col
+ break
+ }
+ }
+
+ return -1
+}
+
|