Differences From Artifact [688bfb2a32]:
- File src/pikchr.c — part of check-in [b01fae602d] at 2020-09-12 00:00:46 on branch trunk — Import the latest version of pikchr that supports the "file" object type. (user: drh size: 231722)
To Artifact [756717ea32]:
- File src/pikchr.c — part of check-in [c3bb7cd22a] at 2020-09-12 02:24:05 on branch trunk — Update pikchr.c to the latest. This also required a small correction to text alignment in figure 6 of branching.wiki (user: drh size: 231921)
| ︙ | ︙ | |||
3875 3876 3877 3878 3879 3880 3881 |
}
pik_append_txt(p, pElem, 0);
}
/* Methods for the "text" class */
static void textInit(Pik *p, PElem *pElem){
| | | | 3875 3876 3877 3878 3879 3880 3881 3882 3883 3884 3885 3886 3887 3888 3889 3890 |
}
pik_append_txt(p, pElem, 0);
}
/* Methods for the "text" class */
static void textInit(Pik *p, PElem *pElem){
pik_value(p, "textwid",7,0);
pik_value(p, "textht",6,0);
pElem->sw = 0.0;
}
/* Methods for the "sublist" class */
static void sublistInit(Pik *p, PElem *pElem){
PEList *pList = pElem->pSublist;
int i;
|
| ︙ | ︙ | |||
4028 4029 4030 4031 4032 4033 4034 |
{ /* name */ "text",
/* isline */ 0,
/* eJust */ 0,
/* xInit */ textInit,
/* xNumProp */ 0,
/* xChop */ boxChop,
/* xOffset */ boxOffset,
| | | 4028 4029 4030 4031 4032 4033 4034 4035 4036 4037 4038 4039 4040 4041 4042 |
{ /* name */ "text",
/* isline */ 0,
/* eJust */ 0,
/* xInit */ textInit,
/* xNumProp */ 0,
/* xChop */ boxChop,
/* xOffset */ boxOffset,
/* xFit */ boxFit,
/* xRender */ boxRender
},
};
static const PClass sublistClass =
{ /* name */ "[]",
/* isline */ 0,
/* eJust */ 0,
|
| ︙ | ︙ | |||
5476 5477 5478 5479 5480 5481 5482 | ** If pBasis is not NULL then it should be a [] element. Use the ** sublist of that [] element for the search. If pBasis is not a [] ** element, then throw an error. ** ** The pNth token describes the N-th search. The pNth->eCode value ** is one more than the number of items to skip. It is negative ** to search backwards. If pNth->eType==T_ID, then it is the name | | | 5476 5477 5478 5479 5480 5481 5482 5483 5484 5485 5486 5487 5488 5489 5490 |
** If pBasis is not NULL then it should be a [] element. Use the
** sublist of that [] element for the search. If pBasis is not a []
** element, then throw an error.
**
** The pNth token describes the N-th search. The pNth->eCode value
** is one more than the number of items to skip. It is negative
** to search backwards. If pNth->eType==T_ID, then it is the name
** of a class to search for. If pNth->eType==T_LB, then
** search for a [] object. If pNth->eType==T_LAST, then search for
** any type.
**
** Raise an error if the item is not found.
*/
static PElem *pik_find_nth(Pik *p, PElem *pBasis, PToken *pNth){
PEList *pList;
|
| ︙ | ︙ | |||
5839 5840 5841 5842 5843 5844 5845 5846 5847 5848 5849 5850 5851 5852 |
default: p->aTPath[1].x += pElem->w; break;
case DIR_DOWN: p->aTPath[1].y -= pElem->h; break;
case DIR_LEFT: p->aTPath[1].x -= pElem->w; break;
case DIR_UP: p->aTPath[1].y += pElem->h; break;
}
}
}
/* Compute final bounding box, entry and exit points, center
** point (ptAt) and path for the element
*/
pik_bbox_init(&pElem->bbox);
if( pElem->type->isLine ){
pElem->aPath = malloc( sizeof(PPoint)*p->nTPath );
| > > > > > | 5839 5840 5841 5842 5843 5844 5845 5846 5847 5848 5849 5850 5851 5852 5853 5854 5855 5856 5857 |
default: p->aTPath[1].x += pElem->w; break;
case DIR_DOWN: p->aTPath[1].y -= pElem->h; break;
case DIR_LEFT: p->aTPath[1].x -= pElem->w; break;
case DIR_UP: p->aTPath[1].y += pElem->h; break;
}
}
}
/* Run "fit" on the text type automatically */
if( pElem->type->xInit==textInit && pElem->nTxt ){
pik_size_to_fit(p, &pElem->errTok);
}
/* Compute final bounding box, entry and exit points, center
** point (ptAt) and path for the element
*/
pik_bbox_init(&pElem->bbox);
if( pElem->type->isLine ){
pElem->aPath = malloc( sizeof(PPoint)*p->nTPath );
|
| ︙ | ︙ | |||
5984 5985 5986 5987 5988 5989 5990 |
/* Add all elements of the list pEList to the bounding box
*/
static void pik_bbox_add_elist(Pik *p, PEList *pEList, PNum wArrow){
int i;
for(i=0; i<pEList->n; i++){
PElem *pElem = pEList->a[i];
| | | 5989 5990 5991 5992 5993 5994 5995 5996 5997 5998 5999 6000 6001 6002 6003 |
/* Add all elements of the list pEList to the bounding box
*/
static void pik_bbox_add_elist(Pik *p, PEList *pEList, PNum wArrow){
int i;
for(i=0; i<pEList->n; i++){
PElem *pElem = pEList->a[i];
if( pElem->sw>0.0 ) pik_bbox_addbox(&p->bbox, &pElem->bbox);
pik_append_txt(p, pElem, &p->bbox);
if( pElem->pSublist ) pik_bbox_add_elist(p, pElem->pSublist, wArrow);
/* Expand the bounding box to account for arrowheads on lines */
if( pElem->type->isLine && pElem->nPath>0 ){
if( pElem->larrow ){
|
| ︙ | ︙ | |||
6148 6149 6150 6151 6152 6153 6154 6155 6156 6157 6158 6159 6160 6161 |
{ "max", 3, T_FUNC2, FN_MAX, 0 },
{ "min", 3, T_FUNC2, FN_MIN, 0 },
{ "n", 1, T_EDGEPT, 0, CP_N },
{ "ne", 2, T_EDGEPT, 0, CP_NE },
{ "north", 5, T_EDGEPT, 0, CP_N },
{ "nw", 2, T_EDGEPT, 0, CP_NW },
{ "of", 2, T_OF, 0, 0 },
{ "print", 5, T_PRINT, 0, 0 },
{ "rad", 3, T_RADIUS, 0, 0 },
{ "radius", 6, T_RADIUS, 0, 0 },
{ "right", 5, T_RIGHT, DIR_RIGHT, CP_E },
{ "rjust", 5, T_RJUST, 0, 0 },
{ "s", 1, T_EDGEPT, 0, CP_S },
{ "same", 4, T_SAME, 0, 0 },
| > | 6153 6154 6155 6156 6157 6158 6159 6160 6161 6162 6163 6164 6165 6166 6167 |
{ "max", 3, T_FUNC2, FN_MAX, 0 },
{ "min", 3, T_FUNC2, FN_MIN, 0 },
{ "n", 1, T_EDGEPT, 0, CP_N },
{ "ne", 2, T_EDGEPT, 0, CP_NE },
{ "north", 5, T_EDGEPT, 0, CP_N },
{ "nw", 2, T_EDGEPT, 0, CP_NW },
{ "of", 2, T_OF, 0, 0 },
{ "previous", 8, T_LAST, 0, 0, },
{ "print", 5, T_PRINT, 0, 0 },
{ "rad", 3, T_RADIUS, 0, 0 },
{ "radius", 6, T_RADIUS, 0, 0 },
{ "right", 5, T_RIGHT, DIR_RIGHT, CP_E },
{ "rjust", 5, T_RJUST, 0, 0 },
{ "s", 1, T_EDGEPT, 0, CP_S },
{ "same", 4, T_SAME, 0, 0 },
|
| ︙ | ︙ | |||
6655 6656 6657 6658 6659 6660 6661 |
}
}
printf("</body></html>\n");
return 0;
}
#endif /* PIKCHR_SHELL */
| | | 6661 6662 6663 6664 6665 6666 6667 6668 |
}
}
printf("</body></html>\n");
return 0;
}
#endif /* PIKCHR_SHELL */
#line 6693 "pikchr.c"
|