Fossil

Check-in [863d272205]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment: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.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 863d272205172935214f12bb14ad5ea1a7f4773d6359972e4666b16bc9798537
User & Date: drh 2020-09-14 17:03:50.074
Context
2020-09-14
21:40
pikchrshow: corrected clipboard copy contents for raw SVG mode (it was including containing DIV element). check-in: bb56d3d5a2 user: stephan tags: trunk
17:03
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. check-in: 863d272205 user: drh tags: trunk
16:29
New pikchr.c fixes an issue with handling of the "to" phrase on a line that already has an incomplete direction add. check-in: 868c38e361 user: drh tags: trunk
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/pikchr.c.
3767
3768
3769
3770
3771
3772
3773










3774
3775
3776
3777
3778
3779
3780
    case T_COLOR:
      pElem->fill = pElem->color;
      break;
    case T_FILL:
      pElem->color = pElem->fill;
      break;
  }










}
static void dotRender(Pik *p, PElem *pElem){
  PNum r = pElem->rad;
  PPoint pt = pElem->ptAt;
  if( pElem->sw>0.0 ){
    pik_append_x(p,"<circle cx=\"", pt.x, "\"");
    pik_append_y(p," cy=\"", pt.y, "\"");







>
>
>
>
>
>
>
>
>
>







3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
3790
    case T_COLOR:
      pElem->fill = pElem->color;
      break;
    case T_FILL:
      pElem->color = pElem->fill;
      break;
  }
}
static void dotCheck(Pik *p, PElem *pElem){
  pElem->w = pElem->h = 0;
  pik_bbox_addellipse(&pElem->bbox, pElem->ptAt.x, pElem->ptAt.y,
                       pElem->rad, pElem->rad);
}
static PPoint dotOffset(Pik *p, PElem *pElem, int cp){
  PPoint zero;
  zero.x = zero.y = 0;
  return zero;
}
static void dotRender(Pik *p, PElem *pElem){
  PNum r = pElem->rad;
  PPoint pt = pElem->ptAt;
  if( pElem->sw>0.0 ){
    pik_append_x(p,"<circle cx=\"", pt.x, "\"");
    pik_append_y(p," cy=\"", pt.y, "\"");
4153
4154
4155
4156
4157
4158
4159
4160
4161
4162
4163
4164
4165
4166
4167
4168
4169
      /* xRender */       cylinderRender
   },
   {  /* name */          "dot",
      /* isline */        0,
      /* eJust */         0,
      /* xInit */         dotInit,
      /* xNumProp */      dotNumProp,
      /* xCheck */        0,
      /* xChop */         circleChop,
      /* xOffset */       ellipseOffset,
      /* xFit */          0,
      /* xRender */       dotRender 
   },
   {  /* name */          "ellipse",
      /* isline */        0,
      /* eJust */         0,
      /* xInit */         ellipseInit,







|

|







4163
4164
4165
4166
4167
4168
4169
4170
4171
4172
4173
4174
4175
4176
4177
4178
4179
      /* xRender */       cylinderRender
   },
   {  /* name */          "dot",
      /* isline */        0,
      /* eJust */         0,
      /* xInit */         dotInit,
      /* xNumProp */      dotNumProp,
      /* xCheck */        dotCheck,
      /* xChop */         circleChop,
      /* xOffset */       dotOffset,
      /* xFit */          0,
      /* xRender */       dotRender 
   },
   {  /* name */          "ellipse",
      /* isline */        0,
      /* eJust */         0,
      /* xInit */         ellipseInit,
5411
5412
5413
5414
5415
5416
5417
5418
5419
5420
5421
5422
5423
5424
5425
    pik_error(p, pTk, "use \"at\" to position this object");
    return;
  }
  if( pElem->bClose ){
    pik_error(p, pTk, "polygon is closed");
    return;
  }
  if( p->mTPath==3 || p->thenFlag ){
    n = pik_next_rpath(p, pTk);
  }
  p->aTPath[n] = *pPt;
  p->mTPath = 3;
}

static void pik_close_path(Pik *p, PToken *pErr){







|







5421
5422
5423
5424
5425
5426
5427
5428
5429
5430
5431
5432
5433
5434
5435
    pik_error(p, pTk, "use \"at\" to position this object");
    return;
  }
  if( pElem->bClose ){
    pik_error(p, pTk, "polygon is closed");
    return;
  }
  if( n==0 || p->mTPath==3 || p->thenFlag ){
    n = pik_next_rpath(p, pTk);
  }
  p->aTPath[n] = *pPt;
  p->mTPath = 3;
}

static void pik_close_path(Pik *p, PToken *pErr){
6080
6081
6082
6083
6084
6085
6086

6087
6088
6089
6090
6091

6092
6093
6094
6095
6096
6097
6098
  int i;
  PPoint ofst;
  PNum dx, dy;

  if( p->nErr ) return;

  /* Position block elements */

  ofst = pik_elem_offset(p, pElem, pElem->eWith);
  dx = (pElem->with.x - ofst.x) - pElem->ptAt.x;
  dy = (pElem->with.y - ofst.y) - pElem->ptAt.y;
  if( dx!=0 || dy!=0 ){
    pik_elem_move(pElem, dx, dy);

  }

  /* For a line object with no movement specified, a single movement
  ** of the default length in the current direction
  */
  if( pElem->type->isLine && p->nTPath<2 ){
    pik_next_rpath(p, 0);







>
|
|
|
|
|
>







6090
6091
6092
6093
6094
6095
6096
6097
6098
6099
6100
6101
6102
6103
6104
6105
6106
6107
6108
6109
6110
  int i;
  PPoint ofst;
  PNum dx, dy;

  if( p->nErr ) return;

  /* Position block elements */
  if( pElem->type->isLine==0 ){
    ofst = pik_elem_offset(p, pElem, pElem->eWith);
    dx = (pElem->with.x - ofst.x) - pElem->ptAt.x;
    dy = (pElem->with.y - ofst.y) - pElem->ptAt.y;
    if( dx!=0 || dy!=0 ){
      pik_elem_move(pElem, dx, dy);
    }
  }

  /* For a line object with no movement specified, a single movement
  ** of the default length in the current direction
  */
  if( pElem->type->isLine && p->nTPath<2 ){
    pik_next_rpath(p, 0);
6184
6185
6186
6187
6188
6189
6190
6191
6192
6193
6194
6195
6196
6197
6198
6199
6200
6201
    }
    switch( pElem->outDir ){
      default:         pElem->ptExit.x += w2;  break;
      case DIR_LEFT:   pElem->ptExit.x -= w2;  break;
      case DIR_UP:     pElem->ptExit.y += h2;  break;
      case DIR_DOWN:   pElem->ptExit.y -= h2;  break;
    }
    pElem->bbox.sw.x = pElem->ptAt.x - w2;
    pElem->bbox.sw.y = pElem->ptAt.y - h2;
    pElem->bbox.ne.x = pElem->ptAt.x + w2;
    pElem->bbox.ne.y = pElem->ptAt.y + h2;
  }
  p->eDir = pElem->outDir;
}

/* Show basic information about each element as a comment in the
** generated HTML.  Used for testing and debugging.  Activated
** by the (undocumented) "debug = 1;"







|
<
|
<







6196
6197
6198
6199
6200
6201
6202
6203

6204

6205
6206
6207
6208
6209
6210
6211
    }
    switch( pElem->outDir ){
      default:         pElem->ptExit.x += w2;  break;
      case DIR_LEFT:   pElem->ptExit.x -= w2;  break;
      case DIR_UP:     pElem->ptExit.y += h2;  break;
      case DIR_DOWN:   pElem->ptExit.y -= h2;  break;
    }
    pik_bbox_add_xy(&pElem->bbox, pElem->ptAt.x - w2, pElem->ptAt.y - h2);

    pik_bbox_add_xy(&pElem->bbox, pElem->ptAt.x + w2, pElem->ptAt.y + h2);

  }
  p->eDir = pElem->outDir;
}

/* Show basic information about each element as a comment in the
** generated HTML.  Used for testing and debugging.  Activated
** by the (undocumented) "debug = 1;"
6987
6988
6989
6990
6991
6992
6993
6994
    }
  }
  printf("</body></html>\n");
  return 0; 
}
#endif /* PIKCHR_SHELL */

#line 7019 "pikchr.c"







|
6997
6998
6999
7000
7001
7002
7003
7004
    }
  }
  printf("</body></html>\n");
  return 0; 
}
#endif /* PIKCHR_SHELL */

#line 7029 "pikchr.c"