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
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
|
* Apply 3 changes based on revisions developed by the fedora linux team.
+ 03-fedora-patch-2.diff
--> + 04-fedora-tk8.5.6.patch.diff
+ 05-tk8.5-zoomstack.diff
* Those patches are required to solve segmentation faults that are observed
when blt is used with tcltk 8.5. We have a substantial amount of
experience using this patched version of blt in the Swarm
Simulation System (www.swarm.org) and have observed no ill-effects.
Author: Paul E. Johnson (Debian Packaging) <pauljohn32@freefaculty.org>
--- a/generic/bltTreeViewEdit.c
+++ b/generic/bltTreeViewEdit.c
@@ -1177,9 +1177,15 @@
rightPos = count;
if ((rightPos < tbPtr->selFirst) || (leftPos > tbPtr->selLast)) {
/* No part of the text fragment is selected. */
+#ifdef TK_DRAWCHARS_ANGLE
+ Tk_DrawChars(tbPtr->display, drawable, tbPtr->gc,
+ tbPtr->font, fragPtr->text, fragPtr->count,
+ x + fragPtr->x, y + fragPtr->y, 0.);
+#else
Tk_DrawChars(tbPtr->display, drawable, tbPtr->gc,
tbPtr->font, fragPtr->text, fragPtr->count,
x + fragPtr->x, y + fragPtr->y);
+#endif
continue;
}
@@ -1221,9 +1227,15 @@
width, fontMetrics.linespace,
tbPtr->selBorderWidth, tbPtr->selRelief);
}
+#ifdef TK_DRAWCHARS_ANGLE
+ Tk_DrawChars(Tk_Display(tbPtr->tkwin), drawable, tbPtr->gc,
+ tbPtr->font, fragPtr->text, fragPtr->count,
+ fragPtr->x + x, fragPtr->y + y, 0.);
+#else
Tk_DrawChars(Tk_Display(tbPtr->tkwin), drawable, tbPtr->gc,
tbPtr->font, fragPtr->text, fragPtr->count,
fragPtr->x + x, fragPtr->y + y);
+#endif
}
if ((tbPtr->flags & TEXTBOX_FOCUS) && (tbPtr->cursorOn)) {
int left, top, right, bottom;
--- a/generic/bltGrPs.c
+++ b/generic/bltGrPs.c
@@ -418,7 +418,7 @@
return Tk_ConfigureInfo(interp, graphPtr->tkwin, configSpecs,
(char *)psPtr, argv[3], flags);
}
- if (Tk_ConfigureWidget(interp, graphPtr->tkwin, configSpecs, argc - 3,
+ if (Blt_ConfigureWidget(interp, graphPtr->tkwin, configSpecs, argc - 3,
argv + 3, (char *)psPtr, flags) != TCL_OK) {
return TCL_ERROR;
}
@@ -1124,7 +1124,7 @@
fileName = argv[3]; /* First argument is the file name. */
argv++, argc--;
}
- if (Tk_ConfigureWidget(interp, graphPtr->tkwin, configSpecs, argc - 3,
+ if (Blt_ConfigureWidget(interp, graphPtr->tkwin, configSpecs, argc - 3,
argv + 3, (char *)psPtr, TK_CONFIG_ARGV_ONLY) != TCL_OK) {
return TCL_ERROR;
}
--- a/generic/bltGrPen.c
+++ b/generic/bltGrPen.c
@@ -215,7 +215,7 @@
Tcl_FreeProc **freeProcPtr; /* Not used. */
{
Pen *penPtr = *(Pen **)(widgRec + offset);
-
+ if ( ! penPtr ) return NULL;
return penPtr->name;
}
@@ -510,7 +510,7 @@
return Tk_ConfigureInfo(interp, graphPtr->tkwin,
penPtr->configSpecs, (char *)penPtr, options[0], flags);
}
- if (Tk_ConfigureWidget(interp, graphPtr->tkwin, penPtr->configSpecs,
+ if (Blt_ConfigureWidget(interp, graphPtr->tkwin, penPtr->configSpecs,
nOpts, options, (char *)penPtr, flags) != TCL_OK) {
break;
}
--- a/generic/bltGrHairs.c
+++ b/generic/bltGrHairs.c
@@ -390,7 +390,7 @@
return Tk_ConfigureInfo(interp, graphPtr->tkwin, configSpecs,
(char *)chPtr, argv[3], 0);
}
- if (Tk_ConfigureWidget(interp, graphPtr->tkwin, configSpecs, argc - 3,
+ if (Blt_ConfigureWidget(interp, graphPtr->tkwin, configSpecs, argc - 3,
argv + 3, (char *)chPtr, TK_CONFIG_ARGV_ONLY) != TCL_OK) {
return TCL_ERROR;
}
--- a/generic/bltGraph.c
+++ b/generic/bltGraph.c
@@ -944,7 +944,7 @@
if (InitPens(graphPtr) != TCL_OK) {
goto error;
}
- if (Tk_ConfigureWidget(interp, tkwin, configSpecs, argc - 2, argv + 2,
+ if (Blt_ConfigureWidget(interp, tkwin, configSpecs, argc - 2, argv + 2,
(char *)graphPtr, 0) != TCL_OK) {
goto error;
}
@@ -1094,7 +1094,7 @@
return Tk_ConfigureInfo(interp, graphPtr->tkwin, configSpecs,
(char *)graphPtr, argv[2], flags);
} else {
- if (Tk_ConfigureWidget(interp, graphPtr->tkwin, configSpecs, argc - 2,
+ if (Blt_ConfigureWidget(interp, graphPtr->tkwin, configSpecs, argc - 2,
argv + 2, (char *)graphPtr, flags) != TCL_OK) {
return TCL_ERROR;
}
--- a/generic/bltUnixDnd.c
+++ b/generic/bltUnixDnd.c
@@ -1834,7 +1834,7 @@
unsigned long gcMask;
Tk_MakeWindowExist(tokenPtr->tkwin);
- if (Tk_ConfigureWidget(interp, tokenPtr->tkwin, tokenConfigSpecs, argc,
+ if (Blt_ConfigureWidget(interp, tokenPtr->tkwin, tokenConfigSpecs, argc,
argv, (char *)tokenPtr, flags) != TCL_OK) {
return TCL_ERROR;
}
@@ -3777,7 +3777,7 @@
return Tk_ConfigureInfo(interp, dndPtr->tkwin, configSpecs,
(char *)dndPtr, argv[3], flags);
}
- if (Tk_ConfigureWidget(interp, dndPtr->tkwin, configSpecs, argc - 3,
+ if (Blt_ConfigureWidget(interp, dndPtr->tkwin, configSpecs, argc - 3,
argv + 3, (char *)dndPtr, flags) != TCL_OK) {
return TCL_ERROR;
}
@@ -4440,7 +4440,7 @@
dndPtr->hashPtr = hPtr;
dndPtr->dataPtr = dataPtr;
Blt_SetHashValue(hPtr, dndPtr);
- if (Tk_ConfigureWidget(interp, dndPtr->tkwin, configSpecs, argc - 3,
+ if (Blt_ConfigureWidget(interp, dndPtr->tkwin, configSpecs, argc - 3,
argv + 3, (char *)dndPtr, 0) != TCL_OK) {
return TCL_ERROR;
}
--- a/generic/bltCanvEps.c
+++ b/generic/bltCanvEps.c
@@ -1147,7 +1147,7 @@
int width, height;
tkwin = Tk_CanvasTkwin(canvas);
- if (Tk_ConfigureWidget(interp, tkwin, configSpecs, argc,
+ if (Blt_ConfigureWidget(interp, tkwin, configSpecs, argc,
argv, (char *)epsPtr, flags) != TCL_OK) {
return TCL_ERROR;
}
@@ -1974,10 +1974,10 @@
{
"eps", /* name */
sizeof(EpsItem), /* itemSize */
- CreateEps, /* createProc */
+ (Tk_ItemCreateProc *)CreateEps, /* createProc */
configSpecs, /* configSpecs */
- ConfigureEps, /* configureProc */
- EpsCoords, /* coordProc */
+ (Tk_ItemConfigureProc *)ConfigureEps, /* configureProc */
+ (Tk_ItemCoordProc *)EpsCoords, /* coordProc */
DeleteEps, /* deleteProc */
DisplayEps, /* displayProc */
#ifdef USE_OLD_CANVAS
@@ -2005,6 +2005,6 @@
{
Tk_CreateItemType(&epsItemType);
/* Initialize custom canvas option routines. */
- tagsOption.parseProc = Tk_CanvasTagsParseProc;
- tagsOption.printProc = Tk_CanvasTagsPrintProc;
+ tagsOption.parseProc = (Tk_OptionParseProc *)Tk_CanvasTagsParseProc;
+ tagsOption.printProc = (Tk_OptionPrintProc *)Tk_CanvasTagsPrintProc;
}
--- a/generic/bltScrollbar.c
+++ b/generic/bltScrollbar.c
@@ -913,7 +913,7 @@
GC new;
Tk_Image image;
- if (Tk_ConfigureWidget(interp, scrollPtr->tkwin, configSpecs,
+ if (Blt_ConfigureWidget(interp, scrollPtr->tkwin, configSpecs,
argc, argv, (char *)scrollPtr, flags) != TCL_OK) {
return TCL_ERROR;
}
--- a/generic/bltTreeViewStyle.c
+++ b/generic/bltTreeViewStyle.c
@@ -560,6 +560,11 @@
}
/*ARGSUSED*/
+
+int
+Blt_TreeViewTextbox(TreeView *tvPtr,
+ TreeViewEntry *entryPtr,
+ TreeViewColumn *columnPtr);
static int
FreeIcon(clientData, display, widgRec, offset, oldPtr)
ClientData clientData;
--- a/generic/bltDragdrop.c
+++ b/generic/bltDragdrop.c
@@ -1065,7 +1065,7 @@
Token *tokenPtr;
tokenPtr = &(srcPtr->token);
- if (Tk_ConfigureWidget(interp, srcPtr->tkwin, tokenConfigSpecs, argc, argv,
+ if (Blt_ConfigureWidget(interp, srcPtr->tkwin, tokenConfigSpecs, argc, argv,
(char *)tokenPtr, TK_CONFIG_ARGV_ONLY) != TCL_OK) {
return TCL_ERROR;
}
@@ -1293,7 +1293,7 @@
/*
* Handle the bulk of the options...
*/
- if (Tk_ConfigureWidget(interp, srcPtr->tkwin, configSpecs, argc, argv,
+ if (Blt_ConfigureWidget(interp, srcPtr->tkwin, configSpecs, argc, argv,
(char *)srcPtr, flags) != TCL_OK) {
return TCL_ERROR;
}
--- a/generic/bltAlloc.c
+++ b/generic/bltAlloc.c
@@ -40,14 +40,23 @@
* Tcl_Alloc/Tcl_Free routines because they don't automatically cause
* a panic when not enough memory is available. There are cases (such
* as allocating a very large vector) where it's recoverable.
+ *
+ * Using private is dangerous.
+ * Tcl changes mem functions for debug which will conflict then with BLT
+ * stick to public API
*/
-EXTERN Blt_MallocProc TclpAlloc;
-EXTERN Blt_FreeProc TclpFree;
-EXTERN Blt_ReallocProc TclpRealloc;
+//EXTERN Blt_MallocProc TclpAlloc;
+//EXTERN Blt_FreeProc TclpFree;
+//EXTERN Blt_ReallocProc TclpRealloc;
+
+//Blt_MallocProc *Blt_MallocProcPtr = TclpAlloc;
+//Blt_FreeProc *Blt_FreeProcPtr = TclpFree;
+//Blt_ReallocProc *Blt_ReallocProcPtr = TclpRealloc;
+
+Blt_MallocProc *Blt_MallocProcPtr = (Blt_MallocProc *)Tcl_Alloc;
+Blt_FreeProc *Blt_FreeProcPtr = (Blt_FreeProc *)Tcl_Free;
+Blt_ReallocProc *Blt_ReallocProcPtr = (Blt_ReallocProc *)Tcl_Realloc;
-Blt_MallocProc *Blt_MallocProcPtr = TclpAlloc;
-Blt_FreeProc *Blt_FreeProcPtr = TclpFree;
-Blt_ReallocProc *Blt_ReallocProcPtr = TclpRealloc;
#else
Blt_MallocProc *Blt_MallocProcPtr = malloc;
--- a/generic/bltGrLegd.c
+++ b/generic/bltGrLegd.c
@@ -1406,7 +1406,7 @@
return Tk_ConfigureInfo(interp, graphPtr->tkwin, configSpecs,
(char *)legendPtr, argv[3], flags);
}
- if (Tk_ConfigureWidget(interp, graphPtr->tkwin, configSpecs, argc - 3,
+ if (Blt_ConfigureWidget(interp, graphPtr->tkwin, configSpecs, argc - 3,
argv + 3, (char *)legendPtr, flags) != TCL_OK) {
return TCL_ERROR;
}
--- a/generic/bltHierbox.c
+++ b/generic/bltHierbox.c
@@ -3321,7 +3321,7 @@
XColor *colorPtr;
hierBox = hboxPtr;
- if (Tk_ConfigureWidget(hboxPtr->interp, hboxPtr->tkwin, entryConfigSpecs,
+ if (Blt_ConfigureWidget(hboxPtr->interp, hboxPtr->tkwin, entryConfigSpecs,
argc, argv, (char *)entryPtr, flags) != TCL_OK) {
return TCL_ERROR;
}
@@ -3935,7 +3935,7 @@
Tk_Uid nameId;
Pixmap bitmap;
hierBox = hboxPtr;
- if (Tk_ConfigureWidget(interp, hboxPtr->tkwin, configSpecs, argc, argv,
+ if (Blt_ConfigureWidget(interp, hboxPtr->tkwin, configSpecs, argc, argv,
(char *)hboxPtr, flags) != TCL_OK) {
return TCL_ERROR;
}
@@ -4443,7 +4443,7 @@
Drawable drawable; /* Pixmap or window to draw into. */
{
Entry *entryPtr; /* Entry to be drawn. */
- int x1, y1, x2, y2;
+ int x1, y1i, x2, y2;
int height;
int x, y;
@@ -4463,22 +4463,22 @@
y += (height - hboxPtr->button.height) / 2;
x1 = x2 = x + LEVELWIDTH(treePtr->level) +
LEVELWIDTH(treePtr->level + 1) / 2;
- y1 = y + hboxPtr->button.height / 2;
- y2 = y1 + entryPtr->lineHeight;
+ y1i = y + hboxPtr->button.height / 2;
+ y2 = y1i + entryPtr->lineHeight;
if ((treePtr == hboxPtr->rootPtr) && (hboxPtr->hideRoot)) {
- y1 += entryPtr->height;
+ y1i += entryPtr->height;
}
/*
* Clip the line's Y-coordinates at the window border.
*/
- if (y1 < 0) {
- y1 = 0;
+ if (y1i < 0) {
+ y1i = 0;
}
if (y2 > Tk_Height(hboxPtr->tkwin)) {
y2 = Tk_Height(hboxPtr->tkwin);
}
- if ((y1 < Tk_Height(hboxPtr->tkwin)) && (y2 > 0)) {
- XDrawLine(hboxPtr->display, drawable, hboxPtr->lineGC, x1, y1,
+ if ((y1i < Tk_Height(hboxPtr->tkwin)) && (y2 > 0)) {
+ XDrawLine(hboxPtr->display, drawable, hboxPtr->lineGC, x1, y1i,
x2, y2);
}
}
@@ -4788,17 +4788,17 @@
x, y);
}
if ((isFocused) && (hboxPtr->focusEdit) && (editPtr->cursorOn)) {
- int x1, y1, x2, y2;
+ int x1, y1i, x2, y2;
GetCursorLocation(hboxPtr, treePtr);
x1 = x + editPtr->x;
x2 = x1 + 3;
- y1 = y + editPtr->y - 1;
- y2 = y1 + editPtr->height - 1;
+ y1i = y + editPtr->y - 1;
+ y2 = y1i + editPtr->height - 1;
XDrawLine(hboxPtr->display, drawable, entryPtr->labelGC,
- x1, y1, x1, y2);
+ x1, y1i, x1, y2);
XDrawLine(hboxPtr->display, drawable, entryPtr->labelGC,
- x1 - 2, y1, x2, y1);
+ x1 - 2, y1i, x2, y1i);
XDrawLine(hboxPtr->display, drawable, entryPtr->labelGC,
x1 - 2, y2, x2, y2);
}
@@ -4859,7 +4859,7 @@
int width, height;
int entryHeight;
int buttonY;
- int x1, y1, x2, y2;
+ int x1, y1i, x2, y2;
Entry *entryPtr;
entryPtr = treePtr->entryPtr;
@@ -4875,7 +4875,7 @@
buttonY = y + entryPtr->buttonY;
x1 = x + (width / 2);
- y1 = y2 = buttonY + (buttonPtr->height / 2);
+ y1i = y2 = buttonY + (buttonPtr->height / 2);
x2 = x1 + (LEVELWIDTH(treePtr->level) + LEVELWIDTH(treePtr->level + 1)) / 2;
if ((treePtr->parentPtr != NULL) && (hboxPtr->lineWidth > 0)) {
@@ -4883,17 +4883,17 @@
* For every node except root, draw a horizontal line from
* the vertical bar to the middle of the icon.
*/
- XDrawLine(hboxPtr->display, drawable, hboxPtr->lineGC, x1, y1, x2, y2);
+ XDrawLine(hboxPtr->display, drawable, hboxPtr->lineGC, x1, y1i, x2, y2);
}
if ((entryPtr->flags & ENTRY_OPEN) && (hboxPtr->lineWidth > 0)) {
/*
* Entry is open, draw vertical line.
*/
- y2 = y1 + entryPtr->lineHeight;
+ y2 = y1i + entryPtr->lineHeight;
if (y2 > Tk_Height(hboxPtr->tkwin)) {
y2 = Tk_Height(hboxPtr->tkwin); /* Clip line at window border. */
}
- XDrawLine(hboxPtr->display, drawable, hboxPtr->lineGC, x2, y1, x2, y2);
+ XDrawLine(hboxPtr->display, drawable, hboxPtr->lineGC, x2, y1i, x2, y2);
}
if ((entryPtr->flags & ENTRY_BUTTON) && (treePtr->parentPtr != NULL)) {
/*
@@ -5506,7 +5506,7 @@
return Tk_ConfigureInfo(interp, hboxPtr->tkwin, buttonConfigSpecs,
(char *)hboxPtr, argv[0], 0);
}
- if (Tk_ConfigureWidget(hboxPtr->interp, hboxPtr->tkwin, buttonConfigSpecs,
+ if (Blt_ConfigureWidget(hboxPtr->interp, hboxPtr->tkwin, buttonConfigSpecs,
argc, argv, (char *)hboxPtr, TK_CONFIG_ARGV_ONLY) != TCL_OK) {
return TCL_ERROR;
}
--- a/generic/bltBusy.c
+++ b/generic/bltBusy.c
@@ -418,7 +418,7 @@
Tk_Cursor oldCursor;
oldCursor = busyPtr->cursor;
- if (Tk_ConfigureWidget(interp, busyPtr->tkRef, configSpecs, argc, argv,
+ if (Blt_ConfigureWidget(interp, busyPtr->tkRef, configSpecs, argc, argv,
(char *)busyPtr, 0) != TCL_OK) {
return TCL_ERROR;
}
--- a/generic/bltConfig.c
+++ b/generic/bltConfig.c
@@ -1573,7 +1573,7 @@
Blt_Free(tempName);
Tk_SetClass(tkwin, className);
- result = Tk_ConfigureWidget(interp, tkwin, specsPtr, argc, argv, widgRec,
+ result = Blt_ConfigureWidget(interp, tkwin, specsPtr, argc, argv, widgRec,
flags);
if (isTemporary) {
Tk_DestroyWindow(tkwin);
--- a/generic/bltTed.c
+++ b/generic/bltTed.c
@@ -826,7 +826,7 @@
GC newGC;
unsigned long gcMask;
- if (Tk_ConfigureWidget(tedPtr->interp, tedPtr->tkwin, configSpecs,
+ if (Blt_ConfigureWidget(tedPtr->interp, tedPtr->tkwin, configSpecs,
argc, argv, (char *)tedPtr, flags) != TCL_OK) {
return TCL_ERROR;
}
--- a/generic/bltGrAxis.c
+++ b/generic/bltGrAxis.c
@@ -3448,7 +3448,7 @@
return Tk_ConfigureInfo(graphPtr->interp, graphPtr->tkwin, configSpecs,
(char *)axisPtr, argv[0], flags);
}
- if (Tk_ConfigureWidget(graphPtr->interp, graphPtr->tkwin, configSpecs,
+ if (Blt_ConfigureWidget(graphPtr->interp, graphPtr->tkwin, configSpecs,
argc, argv, (char *)axisPtr, flags) != TCL_OK) {
return TCL_ERROR;
}
--- a/generic/bltHtext.c
+++ b/generic/bltHtext.c
@@ -40,6 +40,13 @@
* of the virtual text.
*/
+/*
+ * the htext widget is broken in tk8.5.6 as
+ * Tk_ConfigureWidget no longer supports
+ * queries of changed options. Need to migrate to Tk_SetOptions
+ * instead hack a wrapper Blt_ConfigureWidget
+ */
+
#include "bltInt.h"
#ifndef NO_HTEXT
@@ -338,7 +345,7 @@
TK_CONFIG_DONT_SET_DEFAULT, &heightOption},
{TK_CONFIG_CUSTOM, "-linespacing", "lineSpacing", "LineSpacing",
DEF_HTEXT_LINE_SPACING, Tk_Offset(HText, leader),
- TK_CONFIG_DONT_SET_DEFAULT, &bltDistanceOption},
+ TK_CONFIG_DONT_SET_DEFAULT, &bltDistanceOption},
{TK_CONFIG_CUSTOM, "-maxheight", "maxHeight", "MaxHeight",
DEF_HTEXT_MAX_HEIGHT, Tk_Offset(HText, maxHeight),
TK_CONFIG_DONT_SET_DEFAULT, &bltDistanceOption},
@@ -2841,9 +2848,15 @@
Tk_GetFontMetrics(htPtr->font, &fontMetrics);
if ((segPtr->textEnd < htPtr->selFirst) ||
(segPtr->textStart > htPtr->selLast)) { /* No selected text */
+#ifdef TK_DRAWCHARS_ANLGE
+ Tk_DrawChars(htPtr->display, draw, htPtr->drawGC, htPtr->font,
+ htPtr->charArr + segPtr->textStart, textLength - 1,
+ x, y + linePtr->baseline, 0.);
+#else
Tk_DrawChars(htPtr->display, draw, htPtr->drawGC, htPtr->font,
htPtr->charArr + segPtr->textStart, textLength - 1,
x, y + linePtr->baseline);
+#endif
return;
}
/*
@@ -2872,9 +2885,15 @@
Tk_MeasureChars(htPtr->font, htPtr->charArr + segPtr->textStart,
nChars, 10000, DEF_TEXT_FLAGS, &lastX);
lastX += x;
+#ifdef TK_DRAWCHARS_ANGLE
+ Tk_DrawChars(htPtr->display, draw, htPtr->drawGC, htPtr->font,
+ htPtr->charArr + segPtr->textStart, nChars, x,
+ y + linePtr->baseline, 0.);
+#else
Tk_DrawChars(htPtr->display, draw, htPtr->drawGC, htPtr->font,
htPtr->charArr + segPtr->textStart, nChars, x,
y + linePtr->baseline);
+#endif
curPos = selStart;
}
if (selLength > 0) { /* The selection itself */
@@ -2890,16 +2909,28 @@
lastX, y + linePtr->baseline - fontMetrics.ascent,
width, fontMetrics.linespace, htPtr->selBorderWidth,
TK_RELIEF_RAISED);
+#ifdef TK_DRAWCHARS_ANGLE
+ Tk_DrawChars(htPtr->display, draw, htPtr->selectGC,
+ htPtr->font, htPtr->charArr + selStart, selLength,
+ lastX, y + linePtr->baseline, 0.);
+#else
Tk_DrawChars(htPtr->display, draw, htPtr->selectGC,
htPtr->font, htPtr->charArr + selStart, selLength,
lastX, y + linePtr->baseline);
+#endif
lastX = nextX;
curPos = selStart + selLength;
}
nChars = segPtr->textEnd - curPos;
if (nChars > 0) { /* Text following the selection */
+#ifdef TK_DRAWCHARS_ANGLE
+ Tk_DrawChars(htPtr->display, draw, htPtr->drawGC, htPtr->font,
+ htPtr->charArr + curPos, nChars - 1,
+ lastX, y + linePtr->baseline, 0.);
+#else
Tk_DrawChars(htPtr->display, draw, htPtr->drawGC, htPtr->font,
htPtr->charArr + curPos, nChars - 1, lastX, y + linePtr->baseline);
+#endif
}
}
@@ -3055,18 +3086,21 @@
XFillRectangle(display, pixmap, htPtr->fillGC, 0, 0, width, height);
}
-
- if (! htPtr->lineArr) return;
- if (deltaY >= 0) {
+ /* handle null lineArr */
+ if (htPtr->arraySize > 0 && htPtr->nLines > 0) {
+ if (deltaY >= 0) {
y += htPtr->lineArr[htPtr->first].offset;
lineNum = htPtr->first;
lastY = 0;
- } else {
+ } else {
y += htPtr->lineArr[htPtr->last].offset;
lineNum = htPtr->last;
lastY = height;
+ }
+ forceCopy = 0;
+ } else {
+ htPtr->last = htPtr->first - 1;
}
- forceCopy = 0;
/* Draw each line */
for (i = htPtr->first; i <= htPtr->last; i++) {
@@ -3365,7 +3399,8 @@
* The page is always draw at full width and the viewport will clip
* the text.
*/
- if ((htPtr->first != oldFirst) || (htPtr->last != oldLast)) {
+ if ((htPtr->first != oldFirst) || (htPtr->last != oldLast)
+ || htPtr->flags & TEXT_DIRTY ) {
int offset;
int i;
int first, last;
@@ -3383,23 +3418,26 @@
}
if (! htPtr->lineArr) return;
- for (i = first; i <= last; i++) {
+
+ if (htPtr->arraySize > 0 && htPtr->nLines > 0) {
+ for (i = first; i <= last; i++) {
offset = htPtr->lineArr[i].offset;
for (linkPtr = Blt_ChainFirstLink(htPtr->lineArr[i].chainPtr);
- linkPtr != NULL; linkPtr = Blt_ChainNextLink(linkPtr)) {
- winPtr = Blt_ChainGetValue(linkPtr);
- if (winPtr->tkwin != NULL) {
- MoveEmbeddedWidget(winPtr, offset);
- winPtr->flags &= ~WIDGET_VISIBLE;
- }
+ linkPtr != NULL; linkPtr = Blt_ChainNextLink(linkPtr)) {
+ winPtr = Blt_ChainGetValue(linkPtr);
+ if (winPtr->tkwin != NULL) {
+ MoveEmbeddedWidget(winPtr, offset);
+ winPtr->flags &= ~WIDGET_VISIBLE;
+ }
}
+ }
}
- }
- DrawPage(htPtr, deltaY);
- SendBogusEvent(tkwin);
+ DrawPage(htPtr, deltaY);
+ SendBogusEvent(tkwin);
- /* Reset flags */
- htPtr->flags &= ~TEXT_DIRTY;
+ /* Reset flags */
+ htPtr->flags &= ~TEXT_DIRTY;
+ }
}
/* Selection Procedures */
@@ -3919,7 +3957,7 @@
if (winPtr == NULL) {
return TCL_ERROR;
}
- if (Tk_ConfigureWidget(interp, htPtr->tkwin, widgetConfigSpecs,
+ if (Blt_ConfigureWidget(interp, htPtr->tkwin, widgetConfigSpecs,
argc - 3, argv + 3, (char *)winPtr, 0) != TCL_OK) {
return TCL_ERROR;
}
@@ -4089,8 +4127,13 @@
return Tk_ConfigureInfo(interp, htPtr->tkwin, specsPtr, itemPtr,
argv[2], 0);
}
- if (Tk_ConfigureWidget(interp, htPtr->tkwin, specsPtr, argc - 2,
- argv + 2, itemPtr, TK_CONFIG_ARGV_ONLY) != TCL_OK) {
+ if (Blt_ConfigureWidget(interp, htPtr->tkwin, specsPtr, argc - 2,
+ argv + 2, itemPtr, TK_CONFIG_ARGV_ONLY) != TCL_OK) {
+
+ /*
+ * in 8.5 cant tell if in option was modified
+ * supposed to convert to Tk_SetOptions
+ */
return TCL_ERROR;
}
if (itemPtr == (char *)htPtr) {
@@ -4487,7 +4530,7 @@
#ifdef ITCL_NAMESPACES
Itk_SetWidgetCommand(htPtr->tkwin, htPtr->cmdToken);
#endif
- if ((Tk_ConfigureWidget(interp, htPtr->tkwin, configSpecs, argc - 2,
+ if ((Blt_ConfigureWidget(interp, htPtr->tkwin, configSpecs, argc - 2,
argv + 2, (char *)htPtr, 0) != TCL_OK) ||
(ConfigureText(interp, htPtr) != TCL_OK)) {
Tk_DestroyWindow(htPtr->tkwin);
--- a/generic/bltWinDraw.c
+++ b/generic/bltWinDraw.c
@@ -1647,8 +1647,13 @@
if (drawable == None) {
return;
}
+#ifdef TK_DRAWCHARS_ANGLE
+ Tk_DrawChars(display, drawable, gc, (Tk_Font)gc->font, string, length,
+ x, y, 0.);
+#else
Tk_DrawChars(display, drawable, gc, (Tk_Font)gc->font, string, length,
x, y);
+#endif
}
static void
--- a/generic/bltGrMarker.c
+++ b/generic/bltGrMarker.c
@@ -4313,7 +4313,7 @@
/* Save the old marker. */
oldName = markerPtr->name;
under = markerPtr->drawUnder;
- if (Tk_ConfigureWidget(interp, graphPtr->tkwin,
+ if (Blt_ConfigureWidget(interp, graphPtr->tkwin,
markerPtr->classPtr->configSpecs, nOpts, options,
(char *)markerPtr, flags) != TCL_OK) {
return TCL_ERROR;
--- a/generic/bltBitmap.c
+++ b/generic/bltBitmap.c
@@ -917,7 +917,7 @@
info.padLeft = info.padRight = 0;
info.padTop = info.padBottom = 0;
info.font = (Tk_Font)NULL; /* Initialized by Tk_ConfigureWidget */
- if (Tk_ConfigureWidget(interp, tkwin, composeConfigSpecs,
+ if (Blt_ConfigureWidget(interp, tkwin, composeConfigSpecs,
argc - 4, argv + 4, (char *)&info, 0) != TCL_OK) {
return TCL_ERROR;
}
@@ -1027,7 +1027,7 @@
/* Initialize info and then process flags */
info.rotate = 0.0; /* No rotation by default */
info.scale = 1.0; /* No scaling by default */
- if (Tk_ConfigureWidget(interp, dataPtr->tkwin, defineConfigSpecs,
+ if (Blt_ConfigureWidget(interp, dataPtr->tkwin, defineConfigSpecs,
argc - 4, argv + 4, (char *)&info, 0) != TCL_OK) {
return TCL_ERROR;
}
--- a/generic/bltTabnotebook.c
+++ b/generic/bltTabnotebook.c
@@ -2766,7 +2766,7 @@
GC newGC;
lastNotebookInstance = nbPtr;
- if (Tk_ConfigureWidget(interp, nbPtr->tkwin, configSpecs, argc, argv,
+ if (Blt_ConfigureWidget(interp, nbPtr->tkwin, configSpecs, argc, argv,
(char *)nbPtr, flags) != TCL_OK) {
return TCL_ERROR;
}
@@ -3691,7 +3691,7 @@
}
Tcl_Preserve(tabPtr);
lastNotebookInstance = nbPtr;
- result = Tk_ConfigureWidget(interp, nbPtr->tkwin, tabConfigSpecs,
+ result = Blt_ConfigureWidget(interp, nbPtr->tkwin, tabConfigSpecs,
nOpts, options, (char *)tabPtr, TK_CONFIG_ARGV_ONLY);
if (result == TCL_OK) {
result = ConfigureTab(nbPtr, tabPtr);
--- a/generic/bltContainer.c
+++ b/generic/bltContainer.c
@@ -1193,7 +1193,7 @@
GC newGC;
int width, height;
- if (Tk_ConfigureWidget(interp, cntrPtr->tkwin, configSpecs, argc, argv,
+ if (Blt_ConfigureWidget(interp, cntrPtr->tkwin, configSpecs, argc, argv,
(char *)cntrPtr, flags) != TCL_OK) {
return TCL_ERROR;
}
--- a/generic/bltTabset.c
+++ b/generic/bltTabset.c
@@ -3163,7 +3163,7 @@
XColor *activeColor; /* Active foreground. */
tabSet = setPtr;
- if (Tk_ConfigureWidget(interp, setPtr->tkwin, configSpecs, argc, argv,
+ if (Blt_ConfigureWidget(interp, setPtr->tkwin, configSpecs, argc, argv,
(char *)setPtr, flags) != TCL_OK) {
return TCL_ERROR;
}
@@ -4452,7 +4452,7 @@
}
tabSet = setPtr;
Tcl_Preserve(tabPtr);
- result = Tk_ConfigureWidget(interp, setPtr->tkwin, tabConfigSpecs,
+ result = Blt_ConfigureWidget(interp, setPtr->tkwin, tabConfigSpecs,
nOpts, options, (char *)tabPtr, TK_CONFIG_ARGV_ONLY);
if (result == TCL_OK || nOpts>=2) {
result = ConfigureTab(setPtr, tabPtr);
--- a/generic/bltGrGrid.c
+++ b/generic/bltGrGrid.c
@@ -368,7 +368,7 @@
return Tk_ConfigureInfo(interp, graphPtr->tkwin, configSpecs,
(char *)gridPtr, argv[3], flags);
}
- if (Tk_ConfigureWidget(graphPtr->interp, graphPtr->tkwin, configSpecs,
+ if (Blt_ConfigureWidget(graphPtr->interp, graphPtr->tkwin, configSpecs,
argc - 3, argv + 3, (char *)gridPtr, flags) != TCL_OK) {
return TCL_ERROR;
}
--- a/generic/tkButton.c
+++ b/generic/tkButton.c
@@ -1721,7 +1721,7 @@
oldSelVar = (butPtr->selVarName?strdup(butPtr->selVarName):NULL);
}
- if (Tk_ConfigureWidget(interp, butPtr->tkwin, configSpecs,
+ if (Blt_ConfigureWidget(interp, butPtr->tkwin, configSpecs,
argc, argv, (char *)butPtr, flags) != TCL_OK) {
if (oldTextVar) ckfree(oldTextVar);
if (oldTextVar) ckfree(oldSelVar);
--- a/generic/bltGrElem.c
+++ b/generic/bltGrElem.c
@@ -1699,7 +1699,7 @@
search.x = x;
search.y = y;
- if (Tk_ConfigureWidget(interp, graphPtr->tkwin, closestSpecs, i - 6,
+ if (Blt_ConfigureWidget(interp, graphPtr->tkwin, closestSpecs, i - 6,
argv + 6, (char *)&search, TK_CONFIG_ARGV_ONLY) != TCL_OK) {
return TCL_ERROR; /* Error occurred processing an option. */
}
@@ -1854,7 +1854,7 @@
return Tk_ConfigureInfo(interp, graphPtr->tkwin,
elemPtr->specsPtr, (char *)elemPtr, options[0], flags);
}
- if (Tk_ConfigureWidget(interp, graphPtr->tkwin, elemPtr->specsPtr,
+ if (Blt_ConfigureWidget(interp, graphPtr->tkwin, elemPtr->specsPtr,
numOpts, options, (char *)elemPtr, flags) != TCL_OK) {
return TCL_ERROR;
}
--- a/generic/bltTable.c
+++ b/generic/bltTable.c
@@ -1201,7 +1201,7 @@
oldRowSpan = entryPtr->row.span;
oldColSpan = entryPtr->column.span;
- if (Tk_ConfigureWidget(interp, entryPtr->tkwin, entryConfigSpecs,
+ if (Blt_ConfigureWidget(interp, entryPtr->tkwin, entryConfigSpecs,
argc, argv, (char *)entryPtr, TK_CONFIG_ARGV_ONLY) != TCL_OK) {
return TCL_ERROR;
}
@@ -1553,7 +1553,7 @@
return Tk_ConfigureInfo(tablePtr->interp, tablePtr->tkwin,
infoPtr->configSpecs, (char *)rcPtr, argv[0], 0);
} else {
- if (Tk_ConfigureWidget(tablePtr->interp, tablePtr->tkwin,
+ if (Blt_ConfigureWidget(tablePtr->interp, tablePtr->tkwin,
infoPtr->configSpecs, argc, argv, (char *)rcPtr,
TK_CONFIG_ARGV_ONLY) != TCL_OK) {
return TCL_ERROR;
@@ -1578,7 +1578,7 @@
}
rcPtr = GetRowColumn(infoPtr, n);
assert(rcPtr);
- if (Tk_ConfigureWidget(tablePtr->interp, tablePtr->tkwin,
+ if (Blt_ConfigureWidget(tablePtr->interp, tablePtr->tkwin,
infoPtr->configSpecs, argc, argv, (char *)rcPtr,
TK_CONFIG_ARGV_ONLY) != TCL_OK) {
return TCL_ERROR;
@@ -1861,7 +1861,7 @@
return Tk_ConfigureInfo(interp, tablePtr->tkwin, tableConfigSpecs,
(char *)tablePtr, argv[0], 0);
}
- if (Tk_ConfigureWidget(interp, tablePtr->tkwin, tableConfigSpecs,
+ if (Blt_ConfigureWidget(interp, tablePtr->tkwin, tableConfigSpecs,
argc, argv, (char *)tablePtr, TK_CONFIG_ARGV_ONLY) != TCL_OK) {
return TCL_ERROR;
}
@@ -2198,7 +2198,7 @@
}
}
if (argc > 0) {
- result = Tk_ConfigureWidget(tablePtr->interp, entryPtr->tkwin,
+ result = Blt_ConfigureWidget(tablePtr->interp, entryPtr->tkwin,
entryConfigSpecs, argc, argv, (char *)entryPtr,
TK_CONFIG_ARGV_ONLY);
}
|