Fossil SCM
New pikchr.c that fixes an additional problem with "to" terms on line paths and that ensures that "dot" objects to not change the exit point.
Commit
863d272205172935214f12bb14ad5ea1a7f4773d6359972e4666b16bc9798537
Parent
868c38e361715a8…
1 file changed
+23
-13
+23
-13
| --- src/pikchr.c | ||
| +++ src/pikchr.c | ||
| @@ -3769,10 +3769,20 @@ | ||
| 3769 | 3769 | break; |
| 3770 | 3770 | case T_FILL: |
| 3771 | 3771 | pElem->color = pElem->fill; |
| 3772 | 3772 | break; |
| 3773 | 3773 | } |
| 3774 | +} | |
| 3775 | +static void dotCheck(Pik *p, PElem *pElem){ | |
| 3776 | + pElem->w = pElem->h = 0; | |
| 3777 | + pik_bbox_addellipse(&pElem->bbox, pElem->ptAt.x, pElem->ptAt.y, | |
| 3778 | + pElem->rad, pElem->rad); | |
| 3779 | +} | |
| 3780 | +static PPoint dotOffset(Pik *p, PElem *pElem, int cp){ | |
| 3781 | + PPoint zero; | |
| 3782 | + zero.x = zero.y = 0; | |
| 3783 | + return zero; | |
| 3774 | 3784 | } |
| 3775 | 3785 | static void dotRender(Pik *p, PElem *pElem){ |
| 3776 | 3786 | PNum r = pElem->rad; |
| 3777 | 3787 | PPoint pt = pElem->ptAt; |
| 3778 | 3788 | if( pElem->sw>0.0 ){ |
| @@ -4155,13 +4165,13 @@ | ||
| 4155 | 4165 | { /* name */ "dot", |
| 4156 | 4166 | /* isline */ 0, |
| 4157 | 4167 | /* eJust */ 0, |
| 4158 | 4168 | /* xInit */ dotInit, |
| 4159 | 4169 | /* xNumProp */ dotNumProp, |
| 4160 | - /* xCheck */ 0, | |
| 4170 | + /* xCheck */ dotCheck, | |
| 4161 | 4171 | /* xChop */ circleChop, |
| 4162 | - /* xOffset */ ellipseOffset, | |
| 4172 | + /* xOffset */ dotOffset, | |
| 4163 | 4173 | /* xFit */ 0, |
| 4164 | 4174 | /* xRender */ dotRender |
| 4165 | 4175 | }, |
| 4166 | 4176 | { /* name */ "ellipse", |
| 4167 | 4177 | /* isline */ 0, |
| @@ -5413,11 +5423,11 @@ | ||
| 5413 | 5423 | } |
| 5414 | 5424 | if( pElem->bClose ){ |
| 5415 | 5425 | pik_error(p, pTk, "polygon is closed"); |
| 5416 | 5426 | return; |
| 5417 | 5427 | } |
| 5418 | - if( p->mTPath==3 || p->thenFlag ){ | |
| 5428 | + if( n==0 || p->mTPath==3 || p->thenFlag ){ | |
| 5419 | 5429 | n = pik_next_rpath(p, pTk); |
| 5420 | 5430 | } |
| 5421 | 5431 | p->aTPath[n] = *pPt; |
| 5422 | 5432 | p->mTPath = 3; |
| 5423 | 5433 | } |
| @@ -6082,15 +6092,17 @@ | ||
| 6082 | 6092 | PNum dx, dy; |
| 6083 | 6093 | |
| 6084 | 6094 | if( p->nErr ) return; |
| 6085 | 6095 | |
| 6086 | 6096 | /* Position block elements */ |
| 6087 | - ofst = pik_elem_offset(p, pElem, pElem->eWith); | |
| 6088 | - dx = (pElem->with.x - ofst.x) - pElem->ptAt.x; | |
| 6089 | - dy = (pElem->with.y - ofst.y) - pElem->ptAt.y; | |
| 6090 | - if( dx!=0 || dy!=0 ){ | |
| 6091 | - pik_elem_move(pElem, dx, dy); | |
| 6097 | + if( pElem->type->isLine==0 ){ | |
| 6098 | + ofst = pik_elem_offset(p, pElem, pElem->eWith); | |
| 6099 | + dx = (pElem->with.x - ofst.x) - pElem->ptAt.x; | |
| 6100 | + dy = (pElem->with.y - ofst.y) - pElem->ptAt.y; | |
| 6101 | + if( dx!=0 || dy!=0 ){ | |
| 6102 | + pik_elem_move(pElem, dx, dy); | |
| 6103 | + } | |
| 6092 | 6104 | } |
| 6093 | 6105 | |
| 6094 | 6106 | /* For a line object with no movement specified, a single movement |
| 6095 | 6107 | ** of the default length in the current direction |
| 6096 | 6108 | */ |
| @@ -6186,14 +6198,12 @@ | ||
| 6186 | 6198 | default: pElem->ptExit.x += w2; break; |
| 6187 | 6199 | case DIR_LEFT: pElem->ptExit.x -= w2; break; |
| 6188 | 6200 | case DIR_UP: pElem->ptExit.y += h2; break; |
| 6189 | 6201 | case DIR_DOWN: pElem->ptExit.y -= h2; break; |
| 6190 | 6202 | } |
| 6191 | - pElem->bbox.sw.x = pElem->ptAt.x - w2; | |
| 6192 | - pElem->bbox.sw.y = pElem->ptAt.y - h2; | |
| 6193 | - pElem->bbox.ne.x = pElem->ptAt.x + w2; | |
| 6194 | - pElem->bbox.ne.y = pElem->ptAt.y + h2; | |
| 6203 | + pik_bbox_add_xy(&pElem->bbox, pElem->ptAt.x - w2, pElem->ptAt.y - h2); | |
| 6204 | + pik_bbox_add_xy(&pElem->bbox, pElem->ptAt.x + w2, pElem->ptAt.y + h2); | |
| 6195 | 6205 | } |
| 6196 | 6206 | p->eDir = pElem->outDir; |
| 6197 | 6207 | } |
| 6198 | 6208 | |
| 6199 | 6209 | /* Show basic information about each element as a comment in the |
| @@ -6989,6 +6999,6 @@ | ||
| 6989 | 6999 | printf("</body></html>\n"); |
| 6990 | 7000 | return 0; |
| 6991 | 7001 | } |
| 6992 | 7002 | #endif /* PIKCHR_SHELL */ |
| 6993 | 7003 | |
| 6994 | -#line 7019 "pikchr.c" | |
| 7004 | +#line 7029 "pikchr.c" | |
| 6995 | 7005 |
| --- src/pikchr.c | |
| +++ src/pikchr.c | |
| @@ -3769,10 +3769,20 @@ | |
| 3769 | break; |
| 3770 | case T_FILL: |
| 3771 | pElem->color = pElem->fill; |
| 3772 | break; |
| 3773 | } |
| 3774 | } |
| 3775 | static void dotRender(Pik *p, PElem *pElem){ |
| 3776 | PNum r = pElem->rad; |
| 3777 | PPoint pt = pElem->ptAt; |
| 3778 | if( pElem->sw>0.0 ){ |
| @@ -4155,13 +4165,13 @@ | |
| 4155 | { /* name */ "dot", |
| 4156 | /* isline */ 0, |
| 4157 | /* eJust */ 0, |
| 4158 | /* xInit */ dotInit, |
| 4159 | /* xNumProp */ dotNumProp, |
| 4160 | /* xCheck */ 0, |
| 4161 | /* xChop */ circleChop, |
| 4162 | /* xOffset */ ellipseOffset, |
| 4163 | /* xFit */ 0, |
| 4164 | /* xRender */ dotRender |
| 4165 | }, |
| 4166 | { /* name */ "ellipse", |
| 4167 | /* isline */ 0, |
| @@ -5413,11 +5423,11 @@ | |
| 5413 | } |
| 5414 | if( pElem->bClose ){ |
| 5415 | pik_error(p, pTk, "polygon is closed"); |
| 5416 | return; |
| 5417 | } |
| 5418 | if( p->mTPath==3 || p->thenFlag ){ |
| 5419 | n = pik_next_rpath(p, pTk); |
| 5420 | } |
| 5421 | p->aTPath[n] = *pPt; |
| 5422 | p->mTPath = 3; |
| 5423 | } |
| @@ -6082,15 +6092,17 @@ | |
| 6082 | PNum dx, dy; |
| 6083 | |
| 6084 | if( p->nErr ) return; |
| 6085 | |
| 6086 | /* Position block elements */ |
| 6087 | ofst = pik_elem_offset(p, pElem, pElem->eWith); |
| 6088 | dx = (pElem->with.x - ofst.x) - pElem->ptAt.x; |
| 6089 | dy = (pElem->with.y - ofst.y) - pElem->ptAt.y; |
| 6090 | if( dx!=0 || dy!=0 ){ |
| 6091 | pik_elem_move(pElem, dx, dy); |
| 6092 | } |
| 6093 | |
| 6094 | /* For a line object with no movement specified, a single movement |
| 6095 | ** of the default length in the current direction |
| 6096 | */ |
| @@ -6186,14 +6198,12 @@ | |
| 6186 | default: pElem->ptExit.x += w2; break; |
| 6187 | case DIR_LEFT: pElem->ptExit.x -= w2; break; |
| 6188 | case DIR_UP: pElem->ptExit.y += h2; break; |
| 6189 | case DIR_DOWN: pElem->ptExit.y -= h2; break; |
| 6190 | } |
| 6191 | pElem->bbox.sw.x = pElem->ptAt.x - w2; |
| 6192 | pElem->bbox.sw.y = pElem->ptAt.y - h2; |
| 6193 | pElem->bbox.ne.x = pElem->ptAt.x + w2; |
| 6194 | pElem->bbox.ne.y = pElem->ptAt.y + h2; |
| 6195 | } |
| 6196 | p->eDir = pElem->outDir; |
| 6197 | } |
| 6198 | |
| 6199 | /* Show basic information about each element as a comment in the |
| @@ -6989,6 +6999,6 @@ | |
| 6989 | printf("</body></html>\n"); |
| 6990 | return 0; |
| 6991 | } |
| 6992 | #endif /* PIKCHR_SHELL */ |
| 6993 | |
| 6994 | #line 7019 "pikchr.c" |
| 6995 |
| --- src/pikchr.c | |
| +++ src/pikchr.c | |
| @@ -3769,10 +3769,20 @@ | |
| 3769 | break; |
| 3770 | case T_FILL: |
| 3771 | pElem->color = pElem->fill; |
| 3772 | break; |
| 3773 | } |
| 3774 | } |
| 3775 | static void dotCheck(Pik *p, PElem *pElem){ |
| 3776 | pElem->w = pElem->h = 0; |
| 3777 | pik_bbox_addellipse(&pElem->bbox, pElem->ptAt.x, pElem->ptAt.y, |
| 3778 | pElem->rad, pElem->rad); |
| 3779 | } |
| 3780 | static PPoint dotOffset(Pik *p, PElem *pElem, int cp){ |
| 3781 | PPoint zero; |
| 3782 | zero.x = zero.y = 0; |
| 3783 | return zero; |
| 3784 | } |
| 3785 | static void dotRender(Pik *p, PElem *pElem){ |
| 3786 | PNum r = pElem->rad; |
| 3787 | PPoint pt = pElem->ptAt; |
| 3788 | if( pElem->sw>0.0 ){ |
| @@ -4155,13 +4165,13 @@ | |
| 4165 | { /* name */ "dot", |
| 4166 | /* isline */ 0, |
| 4167 | /* eJust */ 0, |
| 4168 | /* xInit */ dotInit, |
| 4169 | /* xNumProp */ dotNumProp, |
| 4170 | /* xCheck */ dotCheck, |
| 4171 | /* xChop */ circleChop, |
| 4172 | /* xOffset */ dotOffset, |
| 4173 | /* xFit */ 0, |
| 4174 | /* xRender */ dotRender |
| 4175 | }, |
| 4176 | { /* name */ "ellipse", |
| 4177 | /* isline */ 0, |
| @@ -5413,11 +5423,11 @@ | |
| 5423 | } |
| 5424 | if( pElem->bClose ){ |
| 5425 | pik_error(p, pTk, "polygon is closed"); |
| 5426 | return; |
| 5427 | } |
| 5428 | if( n==0 || p->mTPath==3 || p->thenFlag ){ |
| 5429 | n = pik_next_rpath(p, pTk); |
| 5430 | } |
| 5431 | p->aTPath[n] = *pPt; |
| 5432 | p->mTPath = 3; |
| 5433 | } |
| @@ -6082,15 +6092,17 @@ | |
| 6092 | PNum dx, dy; |
| 6093 | |
| 6094 | if( p->nErr ) return; |
| 6095 | |
| 6096 | /* Position block elements */ |
| 6097 | if( pElem->type->isLine==0 ){ |
| 6098 | ofst = pik_elem_offset(p, pElem, pElem->eWith); |
| 6099 | dx = (pElem->with.x - ofst.x) - pElem->ptAt.x; |
| 6100 | dy = (pElem->with.y - ofst.y) - pElem->ptAt.y; |
| 6101 | if( dx!=0 || dy!=0 ){ |
| 6102 | pik_elem_move(pElem, dx, dy); |
| 6103 | } |
| 6104 | } |
| 6105 | |
| 6106 | /* For a line object with no movement specified, a single movement |
| 6107 | ** of the default length in the current direction |
| 6108 | */ |
| @@ -6186,14 +6198,12 @@ | |
| 6198 | default: pElem->ptExit.x += w2; break; |
| 6199 | case DIR_LEFT: pElem->ptExit.x -= w2; break; |
| 6200 | case DIR_UP: pElem->ptExit.y += h2; break; |
| 6201 | case DIR_DOWN: pElem->ptExit.y -= h2; break; |
| 6202 | } |
| 6203 | pik_bbox_add_xy(&pElem->bbox, pElem->ptAt.x - w2, pElem->ptAt.y - h2); |
| 6204 | pik_bbox_add_xy(&pElem->bbox, pElem->ptAt.x + w2, pElem->ptAt.y + h2); |
| 6205 | } |
| 6206 | p->eDir = pElem->outDir; |
| 6207 | } |
| 6208 | |
| 6209 | /* Show basic information about each element as a comment in the |
| @@ -6989,6 +6999,6 @@ | |
| 6999 | printf("</body></html>\n"); |
| 7000 | return 0; |
| 7001 | } |
| 7002 | #endif /* PIKCHR_SHELL */ |
| 7003 | |
| 7004 | #line 7029 "pikchr.c" |
| 7005 |