Fossil SCM

Update pikchr.c to the latest. This also required a small correction to text alignment in figure 6 of branching.wiki

drh 2020-09-12 02:24 trunk
Commit c3bb7cd22a8dde6fdb33be159192b24d477232a5d9b59a49c942b7c6efb41ec7
2 files changed +12 -6 +2 -2
+12 -6
--- src/pikchr.c
+++ src/pikchr.c
@@ -3877,12 +3877,12 @@
38773877
}
38783878
38793879
38803880
/* Methods for the "text" class */
38813881
static void textInit(Pik *p, PElem *pElem){
3882
- pElem->w = pik_value(p, "textwid",7,0);
3883
- pElem->h = pik_value(p, "textht",6,0);
3882
+ pik_value(p, "textwid",7,0);
3883
+ pik_value(p, "textht",6,0);
38843884
pElem->sw = 0.0;
38853885
}
38863886
38873887
/* Methods for the "sublist" class */
38883888
static void sublistInit(Pik *p, PElem *pElem){
@@ -4030,11 +4030,11 @@
40304030
/* eJust */ 0,
40314031
/* xInit */ textInit,
40324032
/* xNumProp */ 0,
40334033
/* xChop */ boxChop,
40344034
/* xOffset */ boxOffset,
4035
- /* xFit */ 0,
4035
+ /* xFit */ boxFit,
40364036
/* xRender */ boxRender
40374037
},
40384038
};
40394039
static const PClass sublistClass =
40404040
{ /* name */ "[]",
@@ -5478,11 +5478,11 @@
54785478
** element, then throw an error.
54795479
**
54805480
** The pNth token describes the N-th search. The pNth->eCode value
54815481
** is one more than the number of items to skip. It is negative
54825482
** to search backwards. If pNth->eType==T_ID, then it is the name
5483
-** of a primative time to search for. If pNth->eType==T_LB, then
5483
+** of a class to search for. If pNth->eType==T_LB, then
54845484
** search for a [] object. If pNth->eType==T_LAST, then search for
54855485
** any type.
54865486
**
54875487
** Raise an error if the item is not found.
54885488
*/
@@ -5841,10 +5841,15 @@
58415841
case DIR_LEFT: p->aTPath[1].x -= pElem->w; break;
58425842
case DIR_UP: p->aTPath[1].y += pElem->h; break;
58435843
}
58445844
}
58455845
}
5846
+
5847
+ /* Run "fit" on the text type automatically */
5848
+ if( pElem->type->xInit==textInit && pElem->nTxt ){
5849
+ pik_size_to_fit(p, &pElem->errTok);
5850
+ }
58465851
58475852
/* Compute final bounding box, entry and exit points, center
58485853
** point (ptAt) and path for the element
58495854
*/
58505855
pik_bbox_init(&pElem->bbox);
@@ -5986,11 +5991,11 @@
59865991
*/
59875992
static void pik_bbox_add_elist(Pik *p, PEList *pEList, PNum wArrow){
59885993
int i;
59895994
for(i=0; i<pEList->n; i++){
59905995
PElem *pElem = pEList->a[i];
5991
- pik_bbox_addbox(&p->bbox, &pElem->bbox);
5996
+ if( pElem->sw>0.0 ) pik_bbox_addbox(&p->bbox, &pElem->bbox);
59925997
pik_append_txt(p, pElem, &p->bbox);
59935998
if( pElem->pSublist ) pik_bbox_add_elist(p, pElem->pSublist, wArrow);
59945999
59956000
59966001
/* Expand the bounding box to account for arrowheads on lines */
@@ -6150,10 +6155,11 @@
61506155
{ "n", 1, T_EDGEPT, 0, CP_N },
61516156
{ "ne", 2, T_EDGEPT, 0, CP_NE },
61526157
{ "north", 5, T_EDGEPT, 0, CP_N },
61536158
{ "nw", 2, T_EDGEPT, 0, CP_NW },
61546159
{ "of", 2, T_OF, 0, 0 },
6160
+ { "previous", 8, T_LAST, 0, 0, },
61556161
{ "print", 5, T_PRINT, 0, 0 },
61566162
{ "rad", 3, T_RADIUS, 0, 0 },
61576163
{ "radius", 6, T_RADIUS, 0, 0 },
61586164
{ "right", 5, T_RIGHT, DIR_RIGHT, CP_E },
61596165
{ "rjust", 5, T_RJUST, 0, 0 },
@@ -6657,6 +6663,6 @@
66576663
printf("</body></html>\n");
66586664
return 0;
66596665
}
66606666
#endif /* PIKCHR_SHELL */
66616667
6662
-#line 6687 "pikchr.c"
6668
+#line 6693 "pikchr.c"
66636669
--- src/pikchr.c
+++ src/pikchr.c
@@ -3877,12 +3877,12 @@
3877 }
3878
3879
3880 /* Methods for the "text" class */
3881 static void textInit(Pik *p, PElem *pElem){
3882 pElem->w = pik_value(p, "textwid",7,0);
3883 pElem->h = pik_value(p, "textht",6,0);
3884 pElem->sw = 0.0;
3885 }
3886
3887 /* Methods for the "sublist" class */
3888 static void sublistInit(Pik *p, PElem *pElem){
@@ -4030,11 +4030,11 @@
4030 /* eJust */ 0,
4031 /* xInit */ textInit,
4032 /* xNumProp */ 0,
4033 /* xChop */ boxChop,
4034 /* xOffset */ boxOffset,
4035 /* xFit */ 0,
4036 /* xRender */ boxRender
4037 },
4038 };
4039 static const PClass sublistClass =
4040 { /* name */ "[]",
@@ -5478,11 +5478,11 @@
5478 ** element, then throw an error.
5479 **
5480 ** The pNth token describes the N-th search. The pNth->eCode value
5481 ** is one more than the number of items to skip. It is negative
5482 ** to search backwards. If pNth->eType==T_ID, then it is the name
5483 ** of a primative time to search for. If pNth->eType==T_LB, then
5484 ** search for a [] object. If pNth->eType==T_LAST, then search for
5485 ** any type.
5486 **
5487 ** Raise an error if the item is not found.
5488 */
@@ -5841,10 +5841,15 @@
5841 case DIR_LEFT: p->aTPath[1].x -= pElem->w; break;
5842 case DIR_UP: p->aTPath[1].y += pElem->h; break;
5843 }
5844 }
5845 }
 
 
 
 
 
5846
5847 /* Compute final bounding box, entry and exit points, center
5848 ** point (ptAt) and path for the element
5849 */
5850 pik_bbox_init(&pElem->bbox);
@@ -5986,11 +5991,11 @@
5986 */
5987 static void pik_bbox_add_elist(Pik *p, PEList *pEList, PNum wArrow){
5988 int i;
5989 for(i=0; i<pEList->n; i++){
5990 PElem *pElem = pEList->a[i];
5991 pik_bbox_addbox(&p->bbox, &pElem->bbox);
5992 pik_append_txt(p, pElem, &p->bbox);
5993 if( pElem->pSublist ) pik_bbox_add_elist(p, pElem->pSublist, wArrow);
5994
5995
5996 /* Expand the bounding box to account for arrowheads on lines */
@@ -6150,10 +6155,11 @@
6150 { "n", 1, T_EDGEPT, 0, CP_N },
6151 { "ne", 2, T_EDGEPT, 0, CP_NE },
6152 { "north", 5, T_EDGEPT, 0, CP_N },
6153 { "nw", 2, T_EDGEPT, 0, CP_NW },
6154 { "of", 2, T_OF, 0, 0 },
 
6155 { "print", 5, T_PRINT, 0, 0 },
6156 { "rad", 3, T_RADIUS, 0, 0 },
6157 { "radius", 6, T_RADIUS, 0, 0 },
6158 { "right", 5, T_RIGHT, DIR_RIGHT, CP_E },
6159 { "rjust", 5, T_RJUST, 0, 0 },
@@ -6657,6 +6663,6 @@
6657 printf("</body></html>\n");
6658 return 0;
6659 }
6660 #endif /* PIKCHR_SHELL */
6661
6662 #line 6687 "pikchr.c"
6663
--- src/pikchr.c
+++ src/pikchr.c
@@ -3877,12 +3877,12 @@
3877 }
3878
3879
3880 /* Methods for the "text" class */
3881 static void textInit(Pik *p, PElem *pElem){
3882 pik_value(p, "textwid",7,0);
3883 pik_value(p, "textht",6,0);
3884 pElem->sw = 0.0;
3885 }
3886
3887 /* Methods for the "sublist" class */
3888 static void sublistInit(Pik *p, PElem *pElem){
@@ -4030,11 +4030,11 @@
4030 /* eJust */ 0,
4031 /* xInit */ textInit,
4032 /* xNumProp */ 0,
4033 /* xChop */ boxChop,
4034 /* xOffset */ boxOffset,
4035 /* xFit */ boxFit,
4036 /* xRender */ boxRender
4037 },
4038 };
4039 static const PClass sublistClass =
4040 { /* name */ "[]",
@@ -5478,11 +5478,11 @@
5478 ** element, then throw an error.
5479 **
5480 ** The pNth token describes the N-th search. The pNth->eCode value
5481 ** is one more than the number of items to skip. It is negative
5482 ** to search backwards. If pNth->eType==T_ID, then it is the name
5483 ** of a class to search for. If pNth->eType==T_LB, then
5484 ** search for a [] object. If pNth->eType==T_LAST, then search for
5485 ** any type.
5486 **
5487 ** Raise an error if the item is not found.
5488 */
@@ -5841,10 +5841,15 @@
5841 case DIR_LEFT: p->aTPath[1].x -= pElem->w; break;
5842 case DIR_UP: p->aTPath[1].y += pElem->h; break;
5843 }
5844 }
5845 }
5846
5847 /* Run "fit" on the text type automatically */
5848 if( pElem->type->xInit==textInit && pElem->nTxt ){
5849 pik_size_to_fit(p, &pElem->errTok);
5850 }
5851
5852 /* Compute final bounding box, entry and exit points, center
5853 ** point (ptAt) and path for the element
5854 */
5855 pik_bbox_init(&pElem->bbox);
@@ -5986,11 +5991,11 @@
5991 */
5992 static void pik_bbox_add_elist(Pik *p, PEList *pEList, PNum wArrow){
5993 int i;
5994 for(i=0; i<pEList->n; i++){
5995 PElem *pElem = pEList->a[i];
5996 if( pElem->sw>0.0 ) pik_bbox_addbox(&p->bbox, &pElem->bbox);
5997 pik_append_txt(p, pElem, &p->bbox);
5998 if( pElem->pSublist ) pik_bbox_add_elist(p, pElem->pSublist, wArrow);
5999
6000
6001 /* Expand the bounding box to account for arrowheads on lines */
@@ -6150,10 +6155,11 @@
6155 { "n", 1, T_EDGEPT, 0, CP_N },
6156 { "ne", 2, T_EDGEPT, 0, CP_NE },
6157 { "north", 5, T_EDGEPT, 0, CP_N },
6158 { "nw", 2, T_EDGEPT, 0, CP_NW },
6159 { "of", 2, T_OF, 0, 0 },
6160 { "previous", 8, T_LAST, 0, 0, },
6161 { "print", 5, T_PRINT, 0, 0 },
6162 { "rad", 3, T_RADIUS, 0, 0 },
6163 { "radius", 6, T_RADIUS, 0, 0 },
6164 { "right", 5, T_RIGHT, DIR_RIGHT, CP_E },
6165 { "rjust", 5, T_RJUST, 0, 0 },
@@ -6657,6 +6663,6 @@
6663 printf("</body></html>\n");
6664 return 0;
6665 }
6666 #endif /* PIKCHR_SHELL */
6667
6668 #line 6693 "pikchr.c"
6669
--- www/branching.wiki
+++ www/branching.wiki
@@ -538,13 +538,13 @@
538538
C1: circle same as A1 at B1-(0,$laneh) "1"
539539
arrow 50%
540540
circle same "2"
541541
arrow right 0.8in "goes" "offline"
542542
C5: circle same as A3 "5"
543
- arrow right until even with first ellipse.w
543
+ arrow right until even with first ellipse.w \
544
+ "back online" above "pushes 5" below "pulls 3 &amp; 4" below
544545
ellipse same "future"
545
- text "back online" "pushes 5" "pulls 3 &amp; 4" with .n at last arrow
546546
547547
# content for the Darlene lane
548548
D1: circle same as A1 at C1-(0,$laneh) "1"
549549
arrow 50%
550550
circle same "2"
551551
--- www/branching.wiki
+++ www/branching.wiki
@@ -538,13 +538,13 @@
538 C1: circle same as A1 at B1-(0,$laneh) "1"
539 arrow 50%
540 circle same "2"
541 arrow right 0.8in "goes" "offline"
542 C5: circle same as A3 "5"
543 arrow right until even with first ellipse.w
 
544 ellipse same "future"
545 text "back online" "pushes 5" "pulls 3 &amp; 4" with .n at last arrow
546
547 # content for the Darlene lane
548 D1: circle same as A1 at C1-(0,$laneh) "1"
549 arrow 50%
550 circle same "2"
551
--- www/branching.wiki
+++ www/branching.wiki
@@ -538,13 +538,13 @@
538 C1: circle same as A1 at B1-(0,$laneh) "1"
539 arrow 50%
540 circle same "2"
541 arrow right 0.8in "goes" "offline"
542 C5: circle same as A3 "5"
543 arrow right until even with first ellipse.w \
544 "back online" above "pushes 5" below "pulls 3 &amp; 4" below
545 ellipse same "future"
 
546
547 # content for the Darlene lane
548 D1: circle same as A1 at C1-(0,$laneh) "1"
549 arrow 50%
550 circle same "2"
551

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button