Fossil SCM
Replaced predefined pikchr script list with the new pikchr examples/*.txt (was tests/*.txt) and cache non-error preview responses for those scripts. This halves the over-the-wire size of fossil.page.pikchrshow.js.
Commit
62a5d0cfb9f36f67c0182335f4570af36b1a77d2349ba82f96a6aee160bc181c
Parent
240646ef7d8eb2a…
1 file changed
+89
-1038
+89
-1038
| --- src/fossil.page.pikchrshow.js | ||
| +++ src/fossil.page.pikchrshow.js | ||
| @@ -108,19 +108,24 @@ | ||
| 108 | 108 | })*/; |
| 109 | 109 | D.append(P.e.uiControls, cbWrap); |
| 110 | 110 | P.predefinedPiks.forEach(function(script,ndx){ |
| 111 | 111 | const opt = D.option(script.code ? script.code.trim() :'', script.name); |
| 112 | 112 | D.append(selectScript, opt); |
| 113 | + opt.$_sampleScript = script /* for response caching purposes */; | |
| 113 | 114 | if(!ndx) selectScript.selectedIndex = 0 /*timing/ordering workaround*/; |
| 114 | 115 | if(!script.code) D.disable(opt); |
| 115 | 116 | }); |
| 116 | 117 | delete P.predefinedPiks; |
| 117 | 118 | selectScript.addEventListener('change', function(ev){ |
| 118 | 119 | const val = ev.target.value; |
| 119 | 120 | if(!val) return; |
| 121 | + const opt = ev.target.selectedOptions[0]; | |
| 120 | 122 | P.e.taContent.value = val; |
| 121 | - if(cbAutoPreview.checked) P.preview(); | |
| 123 | + if(cbAutoPreview.checked){ | |
| 124 | + P.preview.$_sampleScript = opt.$_sampleScript; | |
| 125 | + P.preview(); | |
| 126 | + } | |
| 122 | 127 | }, false); |
| 123 | 128 | } |
| 124 | 129 | |
| 125 | 130 | //////////////////////////////////////////////////////////// |
| 126 | 131 | // Move dark mode checkbox to the end and add a help buttonlet |
| @@ -263,10 +268,16 @@ | ||
| 263 | 268 | D.disable(fp.toDisable, this.e.previewModeToggle, this.e.markupAlignCenter); |
| 264 | 269 | D.addClass(this.e.previewCopyButton, 'disabled'); |
| 265 | 270 | const content = this.e.taContent.value.trim(); |
| 266 | 271 | this.response.raw = undefined; |
| 267 | 272 | this.response.inputText = content; |
| 273 | + const sampleScript = fp.$_sampleScript; | |
| 274 | + delete fp.$_sampleScript; | |
| 275 | + if(sampleScript && sampleScript.cached){ | |
| 276 | + fp.updateView(sampleScript.cached, false); | |
| 277 | + return this; | |
| 278 | + } | |
| 268 | 279 | if(!content){ |
| 269 | 280 | fp.updateView("No pikchr content!",true); |
| 270 | 281 | return this; |
| 271 | 282 | } |
| 272 | 283 | const self = this; |
| @@ -276,12 +287,16 @@ | ||
| 276 | 287 | F.message( |
| 277 | 288 | "Fetching preview..." |
| 278 | 289 | ).fetch('pikchrshow',{ |
| 279 | 290 | payload: fd, |
| 280 | 291 | responseHeaders: 'x-pikchrshow-is-error', |
| 281 | - onload: (r,header)=>{ | |
| 282 | - fp.updateView(r,+header ? true : false); | |
| 292 | + onload: (r,isErrHeader)=>{ | |
| 293 | + const isErr = +isErrHeader ? true : false; | |
| 294 | + if(!isErr && sampleScript){ | |
| 295 | + sampleScript.cached = r; | |
| 296 | + } | |
| 297 | + fp.updateView(r,isErr); | |
| 283 | 298 | F.message('Updated preview.'); |
| 284 | 299 | }, |
| 285 | 300 | onerror: (e)=>{ |
| 286 | 301 | F.fetch.onerror(e); |
| 287 | 302 | fp.updateView("Error fetching preview: "+e, true); |
| @@ -301,288 +316,84 @@ | ||
| 301 | 316 | SELECT element (a disabled OPTION). |
| 302 | 317 | |
| 303 | 318 | } |
| 304 | 319 | */ |
| 305 | 320 | P.predefinedPiks = [ |
| 306 | - {name: "--Predefined Scripts--"}, | |
| 321 | + {name: "-- Example Scripts --"}, | |
| 307 | 322 | /* |
| 308 | 323 | The following were imported from the pikchr test scripts: |
| 309 | 324 | |
| 310 | 325 | https://fossil-scm.org/pikchr/dir/tests |
| 311 | 326 | */ |
| 312 | -{name: "autochop01", code:`C: box "box" | |
| 313 | - | |
| 314 | -line from C to 3cm heading 00 from C chop; | |
| 315 | -line from C to 3cm heading 10 from C chop; | |
| 316 | -line from C to 3cm heading 20 from C chop; | |
| 317 | -line from C to 3cm heading 30 from C chop; | |
| 318 | -line from C to 3cm heading 40 from C chop; | |
| 319 | -line from C to 3cm heading 50 from C chop; | |
| 320 | -line from C to 3cm heading 60 from C chop; | |
| 321 | -line from C to 3cm heading 70 from C chop; | |
| 322 | -line from C to 3cm heading 80 from C chop; | |
| 323 | -line from C to 3cm heading 90 from C chop; | |
| 324 | -line from C to 3cm heading 100 from C chop; | |
| 325 | -line from C to 3cm heading 110 from C chop; | |
| 326 | -line from C to 3cm heading 120 from C chop; | |
| 327 | -line from C to 3cm heading 130 from C chop; | |
| 328 | -line from C to 3cm heading 140 from C chop; | |
| 329 | -line from C to 3cm heading 150 from C chop; | |
| 330 | -line from C to 3cm heading 160 from C chop; | |
| 331 | -line from C to 3cm heading 170 from C chop; | |
| 332 | -line from C to 3cm heading 180 from C chop; | |
| 333 | -line from C to 3cm heading 190 from C chop; | |
| 334 | -line from C to 3cm heading 200 from C chop; | |
| 335 | -line from C to 3cm heading 210 from C chop; | |
| 336 | -line from C to 3cm heading 220 from C chop; | |
| 337 | -line from C to 3cm heading 230 from C chop; | |
| 338 | -line from C to 3cm heading 240 from C chop; | |
| 339 | -line from C to 3cm heading 250 from C chop; | |
| 340 | -line from C to 3cm heading 260 from C chop; | |
| 341 | -line from C to 3cm heading 270 from C chop; | |
| 342 | -line from C to 3cm heading 280 from C chop; | |
| 343 | -line from C to 3cm heading 290 from C chop; | |
| 344 | -line from C to 3cm heading 300 from C chop; | |
| 345 | -line from C to 3cm heading 310 from C chop; | |
| 346 | -line from C to 3cm heading 320 from C chop; | |
| 347 | -line from C to 3cm heading 330 from C chop; | |
| 348 | -line from C to 3cm heading 340 from C chop; | |
| 349 | -line from C to 3cm heading 350 from C chop; | |
| 350 | -`}, | |
| 351 | -{name: "autochop02", code:`C: box "box" radius 10px | |
| 352 | - | |
| 353 | -line from C to 3cm heading 00 from C chop; | |
| 354 | -line from C to 3cm heading 10 from C chop; | |
| 355 | -line from C to 3cm heading 20 from C chop; | |
| 356 | -line from C to 3cm heading 30 from C chop; | |
| 357 | -line from C to 3cm heading 40 from C chop; | |
| 358 | -line from C to 3cm heading 50 from C chop; | |
| 359 | -line from C to 3cm heading 60 from C chop; | |
| 360 | -line from C to 3cm heading 70 from C chop; | |
| 361 | -line from C to 3cm heading 80 from C chop; | |
| 362 | -line from C to 3cm heading 90 from C chop; | |
| 363 | -line from C to 3cm heading 100 from C chop; | |
| 364 | -line from C to 3cm heading 110 from C chop; | |
| 365 | -line from C to 3cm heading 120 from C chop; | |
| 366 | -line from C to 3cm heading 130 from C chop; | |
| 367 | -line from C to 3cm heading 140 from C chop; | |
| 368 | -line from C to 3cm heading 150 from C chop; | |
| 369 | -line from C to 3cm heading 160 from C chop; | |
| 370 | -line from C to 3cm heading 170 from C chop; | |
| 371 | -line from C to 3cm heading 180 from C chop; | |
| 372 | -line from C to 3cm heading 190 from C chop; | |
| 373 | -line from C to 3cm heading 200 from C chop; | |
| 374 | -line from C to 3cm heading 210 from C chop; | |
| 375 | -line from C to 3cm heading 220 from C chop; | |
| 376 | -line from C to 3cm heading 230 from C chop; | |
| 377 | -line from C to 3cm heading 240 from C chop; | |
| 378 | -line from C to 3cm heading 250 from C chop; | |
| 379 | -line from C to 3cm heading 260 from C chop; | |
| 380 | -line from C to 3cm heading 270 from C chop; | |
| 381 | -line from C to 3cm heading 280 from C chop; | |
| 382 | -line from C to 3cm heading 290 from C chop; | |
| 383 | -line from C to 3cm heading 300 from C chop; | |
| 384 | -line from C to 3cm heading 310 from C chop; | |
| 385 | -line from C to 3cm heading 320 from C chop; | |
| 386 | -line from C to 3cm heading 330 from C chop; | |
| 387 | -line from C to 3cm heading 340 from C chop; | |
| 388 | -line from C to 3cm heading 350 from C chop; | |
| 389 | -`}, | |
| 390 | -{name: "autochop03", code:`C: circle "circle" | |
| 391 | - | |
| 392 | -line from C to 3cm heading 00 from C chop; | |
| 393 | -line from C to 3cm heading 10 from C chop; | |
| 394 | -line from C to 3cm heading 20 from C chop; | |
| 395 | -line from C to 3cm heading 30 from C chop; | |
| 396 | -line from C to 3cm heading 40 from C chop; | |
| 397 | -line from C to 3cm heading 50 from C chop; | |
| 398 | -line from C to 3cm heading 60 from C chop; | |
| 399 | -line from C to 3cm heading 70 from C chop; | |
| 400 | -line from C to 3cm heading 80 from C chop; | |
| 401 | -line from C to 3cm heading 90 from C chop; | |
| 402 | -line from C to 3cm heading 100 from C chop; | |
| 403 | -line from C to 3cm heading 110 from C chop; | |
| 404 | -line from C to 3cm heading 120 from C chop; | |
| 405 | -line from C to 3cm heading 130 from C chop; | |
| 406 | -line from C to 3cm heading 140 from C chop; | |
| 407 | -line from C to 3cm heading 150 from C chop; | |
| 408 | -line from C to 3cm heading 160 from C chop; | |
| 409 | -line from C to 3cm heading 170 from C chop; | |
| 410 | -line from C to 3cm heading 180 from C chop; | |
| 411 | -line from C to 3cm heading 190 from C chop; | |
| 412 | -line from C to 3cm heading 200 from C chop; | |
| 413 | -line from C to 3cm heading 210 from C chop; | |
| 414 | -line from C to 3cm heading 220 from C chop; | |
| 415 | -line from C to 3cm heading 230 from C chop; | |
| 416 | -line from C to 3cm heading 240 from C chop; | |
| 417 | -line from C to 3cm heading 250 from C chop; | |
| 418 | -line from C to 3cm heading 260 from C chop; | |
| 419 | -line from C to 3cm heading 270 from C chop; | |
| 420 | -line from C to 3cm heading 280 from C chop; | |
| 421 | -line from C to 3cm heading 290 from C chop; | |
| 422 | -line from C to 3cm heading 300 from C chop; | |
| 423 | -line from C to 3cm heading 310 from C chop; | |
| 424 | -line from C to 3cm heading 320 from C chop; | |
| 425 | -line from C to 3cm heading 330 from C chop; | |
| 426 | -line from C to 3cm heading 340 from C chop; | |
| 427 | -line from C to 3cm heading 350 from C chop; | |
| 428 | -`}, | |
| 429 | -{name: "autochop04", code:`C: ellipse "ellipse" | |
| 430 | - | |
| 431 | -line from C to 3cm heading 00 from C chop; | |
| 432 | -line from C to 3cm heading 10 from C chop; | |
| 433 | -line from C to 3cm heading 20 from C chop; | |
| 434 | -line from C to 3cm heading 30 from C chop; | |
| 435 | -line from C to 3cm heading 40 from C chop; | |
| 436 | -line from C to 3cm heading 50 from C chop; | |
| 437 | -line from C to 3cm heading 60 from C chop; | |
| 438 | -line from C to 3cm heading 70 from C chop; | |
| 439 | -line from C to 3cm heading 80 from C chop; | |
| 440 | -line from C to 3cm heading 90 from C chop; | |
| 441 | -line from C to 3cm heading 100 from C chop; | |
| 442 | -line from C to 3cm heading 110 from C chop; | |
| 443 | -line from C to 3cm heading 120 from C chop; | |
| 444 | -line from C to 3cm heading 130 from C chop; | |
| 445 | -line from C to 3cm heading 140 from C chop; | |
| 446 | -line from C to 3cm heading 150 from C chop; | |
| 447 | -line from C to 3cm heading 160 from C chop; | |
| 448 | -line from C to 3cm heading 170 from C chop; | |
| 449 | -line from C to 3cm heading 180 from C chop; | |
| 450 | -line from C to 3cm heading 190 from C chop; | |
| 451 | -line from C to 3cm heading 200 from C chop; | |
| 452 | -line from C to 3cm heading 210 from C chop; | |
| 453 | -line from C to 3cm heading 220 from C chop; | |
| 454 | -line from C to 3cm heading 230 from C chop; | |
| 455 | -line from C to 3cm heading 240 from C chop; | |
| 456 | -line from C to 3cm heading 250 from C chop; | |
| 457 | -line from C to 3cm heading 260 from C chop; | |
| 458 | -line from C to 3cm heading 270 from C chop; | |
| 459 | -line from C to 3cm heading 280 from C chop; | |
| 460 | -line from C to 3cm heading 290 from C chop; | |
| 461 | -line from C to 3cm heading 300 from C chop; | |
| 462 | -line from C to 3cm heading 310 from C chop; | |
| 463 | -line from C to 3cm heading 320 from C chop; | |
| 464 | -line from C to 3cm heading 330 from C chop; | |
| 465 | -line from C to 3cm heading 340 from C chop; | |
| 466 | -line from C to 3cm heading 350 from C chop; | |
| 467 | -`}, | |
| 468 | -{name: "autochop05", code:`C: oval "oval" | |
| 469 | - | |
| 470 | -line from C to 3cm heading 00 from C chop; | |
| 471 | -line from C to 3cm heading 10 from C chop; | |
| 472 | -line from C to 3cm heading 20 from C chop; | |
| 473 | -line from C to 3cm heading 30 from C chop; | |
| 474 | -line from C to 3cm heading 40 from C chop; | |
| 475 | -line from C to 3cm heading 50 from C chop; | |
| 476 | -line from C to 3cm heading 60 from C chop; | |
| 477 | -line from C to 3cm heading 70 from C chop; | |
| 478 | -line from C to 3cm heading 80 from C chop; | |
| 479 | -line from C to 3cm heading 90 from C chop; | |
| 480 | -line from C to 3cm heading 100 from C chop; | |
| 481 | -line from C to 3cm heading 110 from C chop; | |
| 482 | -line from C to 3cm heading 120 from C chop; | |
| 483 | -line from C to 3cm heading 130 from C chop; | |
| 484 | -line from C to 3cm heading 140 from C chop; | |
| 485 | -line from C to 3cm heading 150 from C chop; | |
| 486 | -line from C to 3cm heading 160 from C chop; | |
| 487 | -line from C to 3cm heading 170 from C chop; | |
| 488 | -line from C to 3cm heading 180 from C chop; | |
| 489 | -line from C to 3cm heading 190 from C chop; | |
| 490 | -line from C to 3cm heading 200 from C chop; | |
| 491 | -line from C to 3cm heading 210 from C chop; | |
| 492 | -line from C to 3cm heading 220 from C chop; | |
| 493 | -line from C to 3cm heading 230 from C chop; | |
| 494 | -line from C to 3cm heading 240 from C chop; | |
| 495 | -line from C to 3cm heading 250 from C chop; | |
| 496 | -line from C to 3cm heading 260 from C chop; | |
| 497 | -line from C to 3cm heading 270 from C chop; | |
| 498 | -line from C to 3cm heading 280 from C chop; | |
| 499 | -line from C to 3cm heading 290 from C chop; | |
| 500 | -line from C to 3cm heading 300 from C chop; | |
| 501 | -line from C to 3cm heading 310 from C chop; | |
| 502 | -line from C to 3cm heading 320 from C chop; | |
| 503 | -line from C to 3cm heading 330 from C chop; | |
| 504 | -line from C to 3cm heading 340 from C chop; | |
| 505 | -line from C to 3cm heading 350 from C chop; | |
| 506 | -`}, | |
| 507 | -{name: "autochop06", code:`C: cylinder "cylinder" | |
| 508 | - | |
| 509 | -line from C to 3cm heading 00 from C chop; | |
| 510 | -line from C to 3cm heading 10 from C chop; | |
| 511 | -line from C to 3cm heading 20 from C chop; | |
| 512 | -line from C to 3cm heading 30 from C chop; | |
| 513 | -line from C to 3cm heading 40 from C chop; | |
| 514 | -line from C to 3cm heading 50 from C chop; | |
| 515 | -line from C to 3cm heading 60 from C chop; | |
| 516 | -line from C to 3cm heading 70 from C chop; | |
| 517 | -line from C to 3cm heading 80 from C chop; | |
| 518 | -line from C to 3cm heading 90 from C chop; | |
| 519 | -line from C to 3cm heading 100 from C chop; | |
| 520 | -line from C to 3cm heading 110 from C chop; | |
| 521 | -line from C to 3cm heading 120 from C chop; | |
| 522 | -line from C to 3cm heading 130 from C chop; | |
| 523 | -line from C to 3cm heading 140 from C chop; | |
| 524 | -line from C to 3cm heading 150 from C chop; | |
| 525 | -line from C to 3cm heading 160 from C chop; | |
| 526 | -line from C to 3cm heading 170 from C chop; | |
| 527 | -line from C to 3cm heading 180 from C chop; | |
| 528 | -line from C to 3cm heading 190 from C chop; | |
| 529 | -line from C to 3cm heading 200 from C chop; | |
| 530 | -line from C to 3cm heading 210 from C chop; | |
| 531 | -line from C to 3cm heading 220 from C chop; | |
| 532 | -line from C to 3cm heading 230 from C chop; | |
| 533 | -line from C to 3cm heading 240 from C chop; | |
| 534 | -line from C to 3cm heading 250 from C chop; | |
| 535 | -line from C to 3cm heading 260 from C chop; | |
| 536 | -line from C to 3cm heading 270 from C chop; | |
| 537 | -line from C to 3cm heading 280 from C chop; | |
| 538 | -line from C to 3cm heading 290 from C chop; | |
| 539 | -line from C to 3cm heading 300 from C chop; | |
| 540 | -line from C to 3cm heading 310 from C chop; | |
| 541 | -line from C to 3cm heading 320 from C chop; | |
| 542 | -line from C to 3cm heading 330 from C chop; | |
| 543 | -line from C to 3cm heading 340 from C chop; | |
| 544 | -line from C to 3cm heading 350 from C chop; | |
| 545 | -`}, | |
| 546 | -{name: "autochop07", code:`C: file "file" | |
| 547 | - | |
| 548 | -line from C to 3cm heading 00 from C chop; | |
| 549 | -line from C to 3cm heading 10 from C chop; | |
| 550 | -line from C to 3cm heading 20 from C chop; | |
| 551 | -line from C to 3cm heading 30 from C chop; | |
| 552 | -line from C to 3cm heading 40 from C chop; | |
| 553 | -line from C to 3cm heading 50 from C chop; | |
| 554 | -line from C to 3cm heading 60 from C chop; | |
| 555 | -line from C to 3cm heading 70 from C chop; | |
| 556 | -line from C to 3cm heading 80 from C chop; | |
| 557 | -line from C to 3cm heading 90 from C chop; | |
| 558 | -line from C to 3cm heading 100 from C chop; | |
| 559 | -line from C to 3cm heading 110 from C chop; | |
| 560 | -line from C to 3cm heading 120 from C chop; | |
| 561 | -line from C to 3cm heading 130 from C chop; | |
| 562 | -line from C to 3cm heading 140 from C chop; | |
| 563 | -line from C to 3cm heading 150 from C chop; | |
| 564 | -line from C to 3cm heading 160 from C chop; | |
| 565 | -line from C to 3cm heading 170 from C chop; | |
| 566 | -line from C to 3cm heading 180 from C chop; | |
| 567 | -line from C to 3cm heading 190 from C chop; | |
| 568 | -line from C to 3cm heading 200 from C chop; | |
| 569 | -line from C to 3cm heading 210 from C chop; | |
| 570 | -line from C to 3cm heading 220 from C chop; | |
| 571 | -line from C to 3cm heading 230 from C chop; | |
| 572 | -line from C to 3cm heading 240 from C chop; | |
| 573 | -line from C to 3cm heading 250 from C chop; | |
| 574 | -line from C to 3cm heading 260 from C chop; | |
| 575 | -line from C to 3cm heading 270 from C chop; | |
| 576 | -line from C to 3cm heading 280 from C chop; | |
| 577 | -line from C to 3cm heading 290 from C chop; | |
| 578 | -line from C to 3cm heading 300 from C chop; | |
| 579 | -line from C to 3cm heading 310 from C chop; | |
| 580 | -line from C to 3cm heading 320 from C chop; | |
| 581 | -line from C to 3cm heading 330 from C chop; | |
| 582 | -line from C to 3cm heading 340 from C chop; | |
| 583 | -line from C to 3cm heading 350 from C chop; | |
| 327 | + | |
| 328 | +{name: "headings01", code:` linerad = 5px | |
| 329 | +C: circle "Center" rad 150% | |
| 330 | + circle "N" at 1.0 n of C; arrow from C to last chop -> | |
| 331 | + circle "NE" at 1.0 ne of C; arrow from C to last chop <- | |
| 332 | + circle "E" at 1.0 e of C; arrow from C to last chop <-> | |
| 333 | + circle "SE" at 1.0 se of C; arrow from C to last chop -> | |
| 334 | + circle "S" at 1.0 s of C; arrow from C to last chop <- | |
| 335 | + circle "SW" at 1.0 sw of C; arrow from C to last chop <-> | |
| 336 | + circle "W" at 1.0 w of C; arrow from C to last chop -> | |
| 337 | + circle "NW" at 1.0 nw of C; arrow from C to last chop <- | |
| 338 | + arrow from 2nd circle to 3rd circle chop | |
| 339 | + arrow from 4th circle to 3rd circle chop | |
| 340 | + arrow from SW to S chop <-> | |
| 341 | + circle "ESE" at 2.0 heading 112.5 from Center \ | |
| 342 | + thickness 150% fill lightblue radius 75% | |
| 343 | + arrow from Center to ESE thickness 150% <-> chop | |
| 344 | + arrow from ESE up 1.35 then to NE chop | |
| 345 | + line dashed <- from E.e to (ESE.x,E.y) | |
| 346 | + line dotted <-> thickness 50% from N to NW chop | |
| 347 | +`}, | |
| 348 | +{name: "objects", code:`AllObjects: [ | |
| 349 | + | |
| 350 | +# First row of objects | |
| 351 | +box "box" | |
| 352 | +box rad 10px "box (with" "rounded" "corners)" at 1in right of previous | |
| 353 | +circle "circle" at 1in right of previous | |
| 354 | +ellipse "ellipse" at 1in right of previous | |
| 355 | + | |
| 356 | +# second row of objects | |
| 357 | +oval "oval" at 1in below first box | |
| 358 | +oval "(tall &" "thin)" "oval" wid ovalht ht ovalwid at 1in right of previous | |
| 359 | +cylinder "cylinder" at 1in right of previous | |
| 360 | +file "file" at 1in right of previous | |
| 361 | + | |
| 362 | +# third row shows line-type objects | |
| 363 | +dot "dot" above at 1in below first oval | |
| 364 | +line right from 1.8cm right of previous "lines" above | |
| 365 | +arrow right from 1.8cm right of previous "arrows" above | |
| 366 | +spline from 2cm right of previous \ | |
| 367 | + right .15 up .25 then right .3 down .5 then up .25 right .15 \ | |
| 368 | + "splines" above ljust | |
| 369 | + | |
| 370 | +# Draw various lines below the first line | |
| 371 | +line dashed right from 0.3cm below start of previous line | |
| 372 | +line dotted right from 0.3cm below start of previous | |
| 373 | +line thin right from 0.3cm below start of previous | |
| 374 | +line thick right from 0.3cm below start of previous | |
| 375 | + | |
| 376 | + | |
| 377 | +# Draw arrows with different arrowhead configurations below | |
| 378 | +# the first arrow | |
| 379 | +arrow <- right from 0.4cm below start of previous arrow | |
| 380 | +arrow <-> right from 0.4cm below start of previous | |
| 381 | + | |
| 382 | +# Draw splines with different arrowhead configurations below | |
| 383 | +# the first spline | |
| 384 | +spline -> from .4cm below start of first spline \ | |
| 385 | + right .15 up .25 then right .3 down .5 then up .25 right .15 | |
| 386 | +spline <- from .4cm below start of previous spline \ | |
| 387 | + right .15 up .25 then right .3 down .5 then up .25 right .15 | |
| 388 | +spline <-> from .4cm below start of previous spline \ | |
| 389 | + right .15 up .25 then right .3 down .5 then up .25 right .15 | |
| 390 | + | |
| 391 | +] # end of All Objects | |
| 392 | + | |
| 393 | +# Label the whole diagram | |
| 394 | +text "Examples Of Pikchr Objects" big bold at .8cm above north of AllObjects | |
| 584 | 395 | `}, |
| 585 | 396 | {name: "swimlane", code:` $laneh = 0.75 |
| 586 | 397 | |
| 587 | 398 | # Draw the lanes |
| 588 | 399 | down |
| @@ -625,13 +436,13 @@ | ||
| 625 | 436 | C1: circle same as A1 at B1-(0,$laneh) "1" |
| 626 | 437 | arrow 50% |
| 627 | 438 | circle same "2" |
| 628 | 439 | arrow right 0.8in "goes" "offline" |
| 629 | 440 | C5: circle same as A3 "5" |
| 630 | - arrow right until even with first ellipse.w | |
| 441 | + arrow right until even with first ellipse.w \ | |
| 442 | + "back online" above "pushes 5" below "pulls 3 & 4" below | |
| 631 | 443 | ellipse same "future" |
| 632 | - text "back online" "pushes 5" "pulls 3 & 4" with .n at last arrow | |
| 633 | 444 | |
| 634 | 445 | # content for the Darlene lane |
| 635 | 446 | D1: circle same as A1 at C1-(0,$laneh) "1" |
| 636 | 447 | arrow 50% |
| 637 | 448 | circle same "2" |
| @@ -643,770 +454,10 @@ | ||
| 643 | 454 | ellipse same "future" |
| 644 | 455 | D3: circle same as B3 at B3-(0,2*$laneh) "3" |
| 645 | 456 | arrow 50% |
| 646 | 457 | circle same "4" |
| 647 | 458 | arrow from D1 to D3 chop |
| 648 | -`}, | |
| 649 | -{name: "test01", code:`circle "C0"; arrow; circle "C1"; arrow; circle "C2"; arrow; | |
| 650 | - circle "C4"; arrow; circle "C6" | |
| 651 | -circle "C3" at (C4.x-C2.x) ne of C2; arrow; circle "C5" | |
| 652 | -arrow from C2.ne to C3.sw | |
| 653 | -`}, | |
| 654 | -{name: "test02", code:`/* First generate the main graph */ | |
| 655 | -scale = 0.75 | |
| 656 | -Main: [ | |
| 657 | - circle "C0" | |
| 658 | - arrow | |
| 659 | - circle "C1" | |
| 660 | - arrow | |
| 661 | - circle "C2" | |
| 662 | - arrow | |
| 663 | - circle "C4" | |
| 664 | - arrow | |
| 665 | - circle "C6" | |
| 666 | -] | |
| 667 | -Branch: [ | |
| 668 | - circle "C3" | |
| 669 | - arrow | |
| 670 | - circle "C5" | |
| 671 | -] with .sw at Main.C2.n + (0.35,0.35) | |
| 672 | -arrow from Main.C2 to Branch.C3 chop | |
| 673 | - | |
| 674 | -/* Now generate the background colors */ | |
| 675 | -layer = 0 | |
| 676 | -$featurecolor = 0xfedbce | |
| 677 | -$maincolor = 0xd9fece | |
| 678 | -$divY = (Branch.y + Main.y)/2 | |
| 679 | -$divH = (Branch.y - Main.y) | |
| 680 | -box fill $featurecolor color $featurecolor \ | |
| 681 | - width Branch.width*1.5 height $divH \ | |
| 682 | - at Branch | |
| 683 | -box fill $maincolor color $maincolor \ | |
| 684 | - width Main.width+0.1 height $divH \ | |
| 685 | - at Main | |
| 686 | -"main" ljust at 0.1 se of nw of 2nd box | |
| 687 | -"feature" ljust at 0.1 se of nw of 1st box | |
| 688 | -`}, | |
| 689 | -{name: "test03", code:`right | |
| 690 | -B1: box "One"; line | |
| 691 | -B2: box "Two"; arrow | |
| 692 | -B3: box "Three"; down; arrow down 50%; circle "Hi!"; left; | |
| 693 | -spline -> left 2cm then to One.se | |
| 694 | -Macro: [ | |
| 695 | - B4: box "four" | |
| 696 | - B5: box "five" | |
| 697 | - B6: box "six" | |
| 698 | -] with n at 3cm below s of 2nd box | |
| 699 | - | |
| 700 | -arrow from s of 2nd box to Macro.B5.n | |
| 701 | - | |
| 702 | -spline -> from e of last circle right 1cm then down 1cm then to Macro.B4.e | |
| 703 | - | |
| 704 | -box width Macro.width+0.1 height Macro.height+0.1 at Macro color Red | |
| 705 | -box width Macro.B5.width+0.05 \ | |
| 706 | - height Macro.B5.height+0.05 at Macro.B5 color blue | |
| 707 | -`}, | |
| 708 | -{name: "test04", code:`print 5+8; | |
| 709 | -print (17.4-5)/(2-2); | |
| 710 | -`}, | |
| 711 | -{name: "test05", code:`print linewid | |
| 712 | -linewid=0.8 | |
| 713 | -print linewid | |
| 714 | -scale=2.0 | |
| 715 | -print scale | |
| 716 | -print hotpink | |
| 717 | -print 17 + linewid*1000; | |
| 718 | -print sin(scale); | |
| 719 | -print cos(scale) | |
| 720 | -print sqrt(17) | |
| 721 | -print min(5,10) | |
| 722 | -print max(5,10) | |
| 723 | -print sqrt(-11) | |
| 724 | -`}, | |
| 725 | -{name: "test06", code:`B1: box "one" width 1 height 1 at 2,2; | |
| 726 | -B2: box thickness 300% dotted 0.03 "two" at 1,3; | |
| 727 | -print "B2.n: ",B2.n.x,",",B2.n.y | |
| 728 | -print "B2.c: ",B2.c.x,",",B2.c.y | |
| 729 | -print "B2.e: ",B2.e.x,",",B2.e.y | |
| 730 | -scale = 1 | |
| 731 | -box "three" "four" ljust "five" with .n at 0.1 below B2.s width 50% | |
| 732 | - | |
| 733 | -# Text demo: <text x="100" y="100" text-anchor="end" dominant-baseline="central">I love SVG!</text> | |
| 734 | -`}, | |
| 735 | -{name: "test07", code:`B: box "This is" "<b>" "box \"B\"" color DarkRed | |
| 736 | - | |
| 737 | - "B.nw" rjust above at 0.05 left of B.nw | |
| 738 | - "B.w" rjust at 0.05 left of B.w | |
| 739 | - "B.sw" rjust below at 0.05 left of B.sw; $abc = DarkBlue | |
| 740 | - "B.s" below at B.s | |
| 741 | - // C++ style comments allowed. | |
| 742 | - "B.se" ljust below at 0.05 right of B.se color DarkBlue | |
| 743 | - "B.e" ljust at 0.05 right of B.e /* C-style comments */ | |
| 744 | - "B.ne" ljust above at 0.05 right of B.ne | |
| 745 | - "B.n" center above at B.n | |
| 746 | -print "this is a test: " /*comment ignored*/, $abc | |
| 747 | -print "Colors:", Orange, Black, White, Red, Green, Blue | |
| 748 | - | |
| 749 | -# line from B.ne + (0.05,0) right 1.0 then down 2.5 then left 1.5 | |
| 750 | -`}, | |
| 751 | -{name: "test08", code:` debug = 1; | |
| 752 | - | |
| 753 | - box "one" width 80% height 80% | |
| 754 | - box "two" width 150% color DarkRed | |
| 755 | - arrow "xyz" above | |
| 756 | - box "three" height 150% color DarkBlue | |
| 757 | - down | |
| 758 | - arrow | |
| 759 | -B4: box "four" | |
| 760 | -B45: box "4.5" fill SkyBlue | |
| 761 | - move | |
| 762 | -B5: box "five" | |
| 763 | - left | |
| 764 | -B6: box "six" | |
| 765 | - up | |
| 766 | - box "seven" width 50% height 50% | |
| 767 | - | |
| 768 | - line from 0.1 right of B4.e right 1 then down until even with B5 \ | |
| 769 | - then to B5 rad 0.1 chop | |
| 770 | - | |
| 771 | - arrow from B6 left even with 2nd box then up to 2nd box chop rad 0.1 | |
| 772 | - arrow from 1/2 way between B6.w and B6.sw left until even with first box \ | |
| 773 | - then up to first box rad 0.1 chop | |
| 774 | - | |
| 775 | -oval wid 25% ht B4.n.y - B45.s.y at (B6.x,B4.s.y) | |
| 776 | -arrow from last box to last oval chop | |
| 777 | -arrow <- from B4.w left until even with last oval.e | |
| 778 | -arrow <- from B45 left until even with last oval.e chop | |
| 779 | -`}, | |
| 780 | -{name: "test09", code:`HEAD: circle | |
| 781 | - circle radius 50% with .se at HEAD.nw | |
| 782 | - circle radius 50% with .sw at HEAD.ne | |
| 783 | -`}, | |
| 784 | -{name: "test10", code:`C: "+"; $x = 0 | |
| 785 | - line from 0.5 heading $x from C to 1.0 heading $x from C | |
| 786 | - $x = $x + 10 | |
| 787 | - line from 0.5 heading $x from C to 1.0 heading $x from C | |
| 788 | - $x = $x + 10 | |
| 789 | - line from 0.5 heading $x from C to 1.0 heading $x from C | |
| 790 | - $x = $x + 10 | |
| 791 | - line from 0.5 heading $x from C to 1.0 heading $x from C | |
| 792 | - $x = $x + 10 | |
| 793 | - line from 0.5 heading $x from C to 1.0 heading $x from C | |
| 794 | - $x = $x + 10 | |
| 795 | - line from 0.5 heading $x from C to 1.0 heading $x from C | |
| 796 | - $x = $x + 10 | |
| 797 | - line from 0.5 heading $x from C to 1.0 heading $x from C | |
| 798 | - $x = $x + 10 | |
| 799 | - line from 0.5 heading $x from C to 1.0 heading $x from C | |
| 800 | - $x = $x + 10 | |
| 801 | - line from 0.5 heading $x from C to 1.0 heading $x from C | |
| 802 | - $x = $x + 10 | |
| 803 | - line from 0.5 heading $x from C to 1.0 heading $x from C | |
| 804 | - $x = $x + 10 | |
| 805 | - line from 0.5 heading $x from C to 1.0 heading $x from C | |
| 806 | - $x = $x + 10 | |
| 807 | - line from 0.5 heading $x from C to 1.0 heading $x from C | |
| 808 | - $x = $x + 10 | |
| 809 | - line from 0.5 heading $x from C to 1.0 heading $x from C | |
| 810 | - $x = $x + 10 | |
| 811 | - line from 0.5 heading $x from C to 1.0 heading $x from C | |
| 812 | - $x = $x + 10 | |
| 813 | - line from 0.5 heading $x from C to 1.0 heading $x from C | |
| 814 | - $x = $x + 10 | |
| 815 | - line from 0.5 heading $x from C to 1.0 heading $x from C | |
| 816 | - $x = $x + 10 | |
| 817 | - line from 0.5 heading $x from C to 1.0 heading $x from C | |
| 818 | - $x = $x + 10 | |
| 819 | - line from 0.5 heading $x from C to 1.0 heading $x from C | |
| 820 | - $x = $x + 10 | |
| 821 | - line from 0.5 heading $x from C to 1.0 heading $x from C | |
| 822 | - $x = $x + 10 | |
| 823 | - line from 0.5 heading $x from C to 1.0 heading $x from C | |
| 824 | - $x = $x + 10 | |
| 825 | - line from 0.5 heading $x from C to 1.0 heading $x from C | |
| 826 | - $x = $x + 10 | |
| 827 | - line from 0.5 heading $x from C to 1.0 heading $x from C | |
| 828 | - $x = $x + 10 | |
| 829 | - line from 0.5 heading $x from C to 1.0 heading $x from C | |
| 830 | - $x = $x + 10 | |
| 831 | - line from 0.5 heading $x from C to 1.0 heading $x from C | |
| 832 | - $x = $x + 10 | |
| 833 | - line from 0.5 heading $x from C to 1.0 heading $x from C | |
| 834 | - $x = $x + 10 | |
| 835 | - line from 0.5 heading $x from C to 1.0 heading $x from C | |
| 836 | - $x = $x + 10 | |
| 837 | - line from 0.5 heading $x from C to 1.0 heading $x from C | |
| 838 | - $x = $x + 10 | |
| 839 | - line from 0.5 heading $x from C to 1.0 heading $x from C | |
| 840 | - $x = $x + 10 | |
| 841 | - line from 0.5 heading $x from C to 1.0 heading $x from C | |
| 842 | -`}, | |
| 843 | -{name: "test11", code:` linerad = 5px | |
| 844 | -C: circle "Center" rad 150% | |
| 845 | - circle "N" at 1.0 n of C; arrow from C to last chop -> | |
| 846 | - circle "NE" at 1.0 ne of C; arrow from C to last chop <- | |
| 847 | - circle "E" at 1.0 e of C; arrow from C to last chop <-> | |
| 848 | - circle "SE" at 1.0 se of C; arrow from C to last chop -> | |
| 849 | - circle "S" at 1.0 s of C; arrow from C to last chop <- | |
| 850 | - circle "SW" at 1.0 sw of C; arrow from C to last chop <-> | |
| 851 | - circle "W" at 1.0 w of C; arrow from C to last chop -> | |
| 852 | - circle "NW" at 1.0 nw of C; arrow from C to last chop <- | |
| 853 | - arrow from 2nd circle to 3rd circle chop | |
| 854 | - arrow from 4th circle to 3rd circle chop | |
| 855 | - arrow from SW to S chop <-> | |
| 856 | - circle "ESE" at 2.0 heading 112.5 from Center \ | |
| 857 | - thickness 150% fill lightblue radius 75% | |
| 858 | - arrow from Center to ESE thickness 150% <-> chop | |
| 859 | - arrow from ESE up 1.35 then to NE chop | |
| 860 | - line dashed <- from E.e to (ESE.x,E.y) | |
| 861 | - line dotted <-> thickness 50% from N to NW chop | |
| 862 | -`}, | |
| 863 | -{name: "test12", code:`circle "One" | |
| 864 | -arrow | |
| 865 | -circle "Two"; down | |
| 866 | -arrow down 40% | |
| 867 | -circle "Three" | |
| 868 | -move | |
| 869 | -circle "Four" | |
| 870 | -`}, | |
| 871 | -{name: "test13", code:`// margin = 1 | |
| 872 | -line up 1 right 2 | |
| 873 | -linewid = 0 | |
| 874 | -arrow left 2 | |
| 875 | -move left 0.1 | |
| 876 | -line <-> down 1 | |
| 877 | -"height " rjust at last line | |
| 878 | -`}, | |
| 879 | -{name: "test14", code:`print "1in=",1in | |
| 880 | -print "1cm=",1cm | |
| 881 | -print "1mm=",1mm | |
| 882 | -print "1pt=",1pt | |
| 883 | -print "1px=",1px | |
| 884 | -print "1pc=",1pc | |
| 885 | -scale = 0.25 | |
| 886 | -circle "in" radius 1in | |
| 887 | -circle "cm" radius 2.54cm | |
| 888 | -circle "mm" radius 25.4mm | |
| 889 | -circle "pt" radius 72pt | |
| 890 | -circle "px" radius 96px | |
| 891 | -circle "pc" radius 6pc | |
| 892 | - | |
| 893 | -circle "in" radius 0.5*1in with .n at s of 1st circle | |
| 894 | -circle "cm" radius 0.5*2.54cm | |
| 895 | -circle "mm" radius 25.4mm * 0.5 | |
| 896 | -circle "pt" radius 72pt * 0.5 | |
| 897 | -circle "px" radius 96px * 0.5 | |
| 898 | -circle "pc" radius 6pc * 0.5 | |
| 899 | -`}, | |
| 900 | -{name: "test15", code:`ellipse "document" | |
| 901 | -arrow | |
| 902 | -box "PIC" | |
| 903 | -arrow | |
| 904 | -box "TBL/EQN" "(optional)" dashed | |
| 905 | -arrow | |
| 906 | -box "TROFF" | |
| 907 | -arrow | |
| 908 | -ellipse "typesetter" | |
| 909 | -`}, | |
| 910 | -{name: "test16", code:`box "this is" "a box" | |
| 911 | -`}, | |
| 912 | -{name: "test17", code:`line "this is" "a line" | |
| 913 | -`}, | |
| 914 | -{name: "test18", code:`box width 3 height 0.1; circle radius 0.1 | |
| 915 | -`}, | |
| 916 | -{name: "test19", code:`line up right; line down; line down left; line up | |
| 917 | -`}, | |
| 918 | -{name: "test20", code:`box dotted; line dotted; move; line dashed; box dashed | |
| 919 | -`}, | |
| 920 | -{name: "test21", code:`line right 5 dashed; move left 5 down .25; right | |
| 921 | -line right 5 dashed 0.25; move left 5 down .25; right | |
| 922 | -line right 5 dashed 0.5; move left 5 down .25; right | |
| 923 | -line right 5 dashed 1; | |
| 924 | -`}, | |
| 925 | -{name: "test22", code:`box invisible "input"; arrow; box invisible "output" | |
| 926 | -`}, | |
| 927 | -{name: "test23b", code:`margin = 24pt; | |
| 928 | -linewid *= 1.75 | |
| 929 | -charht = 0.14 | |
| 930 | -//thickness *= 8 | |
| 931 | -print charht, thickness | |
| 932 | -arrow "on top of"; move | |
| 933 | -arrow "above" "below"; move | |
| 934 | -arrow "above" above; move | |
| 935 | -arrow "below" below; move | |
| 936 | -arrow "above" "on top of" "below" | |
| 937 | - | |
| 938 | -move to start of first arrow down 1in; | |
| 939 | -right | |
| 940 | -arrow "way a||bove" "ab||ove" "on t||he line" "below" "way below" | |
| 941 | -move; arrow "way above" "above" "below" "way below" | |
| 942 | -move; arrow "way above" above "above" above | |
| 943 | -move; arrow "below" below "way below" below | |
| 944 | -move; arrow "above-1" above "above-2" above "floating" | |
| 945 | - | |
| 946 | -move to start of first arrow down 2in; | |
| 947 | -right | |
| 948 | -arrow "above-1" above "above-2" above "below" below | |
| 949 | -move; arrow "below-1" below "below-2" below "floating" | |
| 950 | -move; arrow "below-1" below "below-2" below "above" above | |
| 951 | - | |
| 952 | -move to start of first arrow down 3in; | |
| 953 | -right | |
| 954 | -box "first line" "second line" "third line" "fourth line" "fifth line" fit | |
| 955 | -move | |
| 956 | -box "first line" "second line" "third line" "fourth line" fit | |
| 957 | -move | |
| 958 | -box "first line" "second line" "third line" fit | |
| 959 | -move | |
| 960 | -box "first line" "second line" fit | |
| 961 | -move | |
| 962 | -box "first line" fit | |
| 963 | - | |
| 964 | -move to start of first arrow down 4in; | |
| 965 | -right | |
| 966 | -box "first above" above "second above" above "third" fit | |
| 967 | -dot color red at last box | |
| 968 | -`}, | |
| 969 | -{name: "test23c", code:`linewid *= 2 | |
| 970 | -arrow "Big" big "Small" small thin | |
| 971 | -box invis "thin" "line" fit | |
| 972 | -move | |
| 973 | -arrow "Big Big" big big "Small Small" small small thick | |
| 974 | -box invis "thick" "line" fit | |
| 975 | -box thick "Thick" with .nw at .5 below start of 1st arrow | |
| 976 | -move | |
| 977 | -box thick thick "Thick" "Thick" | |
| 978 | -move | |
| 979 | -box thin "Thin" | |
| 980 | -move | |
| 981 | -box thin thin "Thin" "Thin" | |
| 982 | -`}, | |
| 983 | -{name: "test23", code:`margin = 24pt; | |
| 984 | -linewid *= 1.75 | |
| 985 | -arrow "on top of"; move | |
| 986 | -arrow "above" "below"; move | |
| 987 | -arrow "above" above; move | |
| 988 | -arrow "below" below; move | |
| 989 | -arrow "above" "on top of" "below" | |
| 990 | - | |
| 991 | -move to start of first arrow down 1in; | |
| 992 | -right | |
| 993 | -arrow "way above" "above" "on the line" "below" "way below" | |
| 994 | -move; arrow "way above" "above" "below" "way below" | |
| 995 | - | |
| 996 | -move to start of first arrow down 2in; | |
| 997 | -right | |
| 998 | -box "first line" "second line" "third line" "fourth line" "fifth line" fit | |
| 999 | -move | |
| 1000 | -box "first line" "second line" "third line" "fourth line" fit | |
| 1001 | -move | |
| 1002 | -box "first line" "second line" "third line" fit | |
| 1003 | -move | |
| 1004 | -box "first line" "second line" fit | |
| 1005 | -move | |
| 1006 | -box "first line" fit | |
| 1007 | - | |
| 1008 | -move to start of first arrow down 3in; | |
| 1009 | -right | |
| 1010 | -box "first above" above "second above" above "third" fit | |
| 1011 | -dot color red at last box | |
| 1012 | -`}, | |
| 1013 | -{name: "test24", code:`arrow left; box; arrow; circle; arrow | |
| 1014 | -`}, | |
| 1015 | -{name: "test25", code:`arrow; circle; down; arrow | |
| 1016 | -`}, | |
| 1017 | -{name: "test26", code:`line from 0,0 right 1 then up 1 then right 1 then down 1.5 \ | |
| 1018 | - then left 0.6 dashed; | |
| 1019 | -spline from 0,0 right 1 then up 1 then right 1 then down 1.5 \ | |
| 1020 | - then left 0.6 | |
| 1021 | -`}, | |
| 1022 | -{name: "test27", code:`line dotted right 1 then down 0.5 left 1 then right 1 | |
| 1023 | -spline from start of first line color red \ | |
| 1024 | - right 1 then down 0.5 left 1 then right 1 <-> | |
| 1025 | -spline from start of first line color blue radius 0.2 \ | |
| 1026 | - right 1 then down 0.5 left 1 then right 1 <-> | |
| 1027 | - | |
| 1028 | -move down 1 from start of first line | |
| 1029 | -line radius 0.3 \ | |
| 1030 | - right 1 then down 0.5 left 1 then right 1 <-> | |
| 1031 | -`}, | |
| 1032 | -{name: "test28", code:`box "Box" | |
| 1033 | -arrow | |
| 1034 | -cylinder "One" | |
| 1035 | -down | |
| 1036 | -arrow | |
| 1037 | -ellipse "Ellipse" | |
| 1038 | -up | |
| 1039 | -arrow from One.n | |
| 1040 | -circle "Circle" | |
| 1041 | -right | |
| 1042 | -arrow from One.e <- | |
| 1043 | -circle "E" radius 50% | |
| 1044 | -circle "NE" radius 50% at 0.5 ne of One.ne | |
| 1045 | -arrow from NE.sw to One.ne | |
| 1046 | -circle "SE" radius 50% at 0.5 se of One.se | |
| 1047 | -arrow from SE.nw to One.se | |
| 1048 | - | |
| 1049 | -spline from One.sw left 0.2 down 0.2 then to Box.se -> | |
| 1050 | -spline from Circle.w left 0.3 then left 0.2 down 0.2 then to One.nw -> | |
| 1051 | -`}, | |
| 1052 | -{name: "test29", code:`# Demonstrate the ability to close and fill a line with the "fill" | |
| 1053 | -# attribute - treating it as a polygon. | |
| 1054 | -# | |
| 1055 | -line right 1 then down 0.25 then up .5 right 0.5 \ | |
| 1056 | - then up .5 left 0.5 then down 0.25 then left 1 close fill blue | |
| 1057 | -move | |
| 1058 | -box "Box to right" "of the" "polygon" | |
| 1059 | -move | |
| 1060 | -line "not a" "polygon" right 1in fill red | |
| 1061 | -move to w of 1st line then down 3cm | |
| 1062 | -line same as 1st line | |
| 1063 | -`}, | |
| 1064 | -{name: "test30", code:`debug = 1 | |
| 1065 | -down; box ht 0.2 wid 1.5; move down 0.15; box same; move same; box same | |
| 1066 | -`}, | |
| 1067 | -{name: "test31", code:`leftmargin = 1cm | |
| 1068 | -box "1" | |
| 1069 | -[ box "2"; arrow "3" above; box "4" ] with .n at last box.s - (0,0.1) | |
| 1070 | -"Thing 2: "rjust at last [].w | |
| 1071 | - | |
| 1072 | -dot at last box.s color red | |
| 1073 | -dot at last [].n color blue | |
| 1074 | -`}, | |
| 1075 | -{name: "test32", code:`spline right then up then left then down -> | |
| 1076 | -move right 2cm | |
| 1077 | -spline right then up left then down -> | |
| 1078 | -move right 2cm | |
| 1079 | -dot; dot; dot; | |
| 1080 | - | |
| 1081 | -dot rad 150% color red at 1st vertex of 1st spline | |
| 1082 | -dot same color orange at 2nd vertex of 1st spline | |
| 1083 | -dot same color green at 3rd vertex of 1st spline | |
| 1084 | -dot same color blue at 4th vertex of 1st spline | |
| 1085 | - | |
| 1086 | -dot same color red at 1st vertex of 2nd spline | |
| 1087 | -dot same color green at 2nd vertex of 2nd spline | |
| 1088 | -dot same color blue at 3rd vertex of 2nd spline | |
| 1089 | - | |
| 1090 | -print 2nd vertex of 1st spline.x, 2nd vertex of 1st spline.y | |
| 1091 | -`}, | |
| 1092 | -{name: "test33", code:`margin = 1cm | |
| 1093 | -"+" at 0,0 | |
| 1094 | -arc -> from 0.5,0 to 0,0.5 | |
| 1095 | -arc -> cw from 0,0 to 1,0.5 | |
| 1096 | -`}, | |
| 1097 | -{name: "test34", code:`line; arc; arc cw; arrow | |
| 1098 | -`}, | |
| 1099 | -{name: "test35", code:`A: ellipse | |
| 1100 | - ellipse ht .2 wid .3 with .se at 1st ellipse.nw | |
| 1101 | - ellipse ht .2 wid .3 with .sw at 1st ellipse.ne | |
| 1102 | - circle rad .05 at 0.5 between A.nw and A.c | |
| 1103 | - circle rad .05 at 0.5 between A.ne and A.c | |
| 1104 | - arc from 0.25 between A.w and A.e to 0.75 between A.w and A.e | |
| 1105 | - | |
| 1106 | -// dot color red at A.nw | |
| 1107 | -// dot color orange at A.c | |
| 1108 | -// dot color purple at A.ne | |
| 1109 | -`}, | |
| 1110 | -{name: "test36", code:`h = .5; dh = .02; dw = .1 | |
| 1111 | -[ | |
| 1112 | - Ptr: [ | |
| 1113 | - boxht = h; boxwid = dw | |
| 1114 | - A: box | |
| 1115 | - B: box | |
| 1116 | - C: box | |
| 1117 | - box wid 2*boxwid "..." | |
| 1118 | - D: box | |
| 1119 | - ] | |
| 1120 | - Block: [ | |
| 1121 | - boxht = 2*dw; | |
| 1122 | - boxwid = 2*dw | |
| 1123 | - movewid = 2*dh | |
| 1124 | - A: box; move | |
| 1125 | - B: box; move | |
| 1126 | - C: box; move | |
| 1127 | - box invis "..." wid 2*boxwid; move | |
| 1128 | - D: box | |
| 1129 | - ] with .n at Ptr.s - (0,h/2) | |
| 1130 | - arrow from Ptr.A to Block.A.nw + (dh,0) | |
| 1131 | - arrow from Ptr.B to Block.B.nw + (dh,0) | |
| 1132 | - arrow from Ptr.C to Block.C.nw + (dh,0) | |
| 1133 | - arrow from Ptr.D to Block.D.nw + (dh,0) | |
| 1134 | -] | |
| 1135 | -box dashed ht last [].ht+dw wid last [].wid+dw at last [] | |
| 1136 | -`}, | |
| 1137 | -{name: "test37", code:`# Change from the original: | |
| 1138 | -# * Expand the macro by hand, as Pikchr does not support | |
| 1139 | -# macros | |
| 1140 | -# Need fixing: | |
| 1141 | -# * "bottom of last box" | |
| 1142 | -# * ".t" | |
| 1143 | -# | |
| 1144 | -#define ndblock { | |
| 1145 | -# box wid boxwid/2 ht boxht/2 | |
| 1146 | -# down; box same with .t at bottom of last box; box same | |
| 1147 | -#} | |
| 1148 | -boxht = .2; boxwid = .3; circlerad = .3; dx = 0.05 | |
| 1149 | -down; box; box; box; box ht 3*boxht "." "." "." | |
| 1150 | -L: box; box; box invis wid 2*boxwid "hashtab:" with .e at 1st box .w | |
| 1151 | -right | |
| 1152 | -Start: box wid .5 with .sw at 1st box.ne + (.4,.2) "..." | |
| 1153 | -N1: box wid .2 "n1"; D1: box wid .3 "d1" | |
| 1154 | -N3: box wid .4 "n3"; D3: box wid .3 "d3" | |
| 1155 | -box wid .4 "..." | |
| 1156 | -N2: box wid .5 "n2"; D2: box wid .2 "d2" | |
| 1157 | -arrow right from 2nd box | |
| 1158 | -#ndblock | |
| 1159 | - box wid boxwid/2 ht boxht/2 | |
| 1160 | - down; box same with .t at bottom of last box; box same | |
| 1161 | -spline -> right .2 from 3rd last box then to N1.sw + (dx,0) | |
| 1162 | -spline -> right .3 from 2nd last box then to D1.sw + (dx,0) | |
| 1163 | -arrow right from last box | |
| 1164 | -#ndblock | |
| 1165 | - box wid boxwid/2 ht boxht/2 | |
| 1166 | - down; box same with .t at bottom of last box; box same | |
| 1167 | -spline -> right .2 from 3rd last box to N2.sw-(dx,.2) to N2.sw+(dx,0) | |
| 1168 | -spline -> right .3 from 2nd last box to D2.sw-(dx,.2) to D2.sw+(dx,0) | |
| 1169 | -arrow right 2*linewid from L | |
| 1170 | -#ndblock | |
| 1171 | - box wid boxwid/2 ht boxht/2 | |
| 1172 | - down; box same with .t at bottom of last box; box same | |
| 1173 | -spline -> right .2 from 3rd last box to N3.sw + (dx,0) | |
| 1174 | -spline -> right .3 from 2nd last box to D3.sw + (dx,0) | |
| 1175 | -circlerad = .3 | |
| 1176 | -circle invis "ndblock" at last box.e + (1.2,.2) | |
| 1177 | -arrow dashed from last circle.w to last box chop 0 chop .3 | |
| 1178 | -box invis wid 2*boxwid "ndtable:" with .e at Start.w | |
| 1179 | -`}, | |
| 1180 | -{name: "test38b", code:`# Need fixing: | |
| 1181 | -# | |
| 1182 | -# * ".bot" as an abbreviation for ".bottom" | |
| 1183 | -# * "up from top of LA" | |
| 1184 | -# | |
| 1185 | - arrow "source" "code" | |
| 1186 | -LA: box "lexical" "analyzer" | |
| 1187 | - arrow "tokens" above | |
| 1188 | -P: box "parser" | |
| 1189 | - arrow "intermediate" "code" wid 180% | |
| 1190 | -Sem: box "semantic" "checker" | |
| 1191 | - arrow | |
| 1192 | - arrow <-> up from top of LA | |
| 1193 | -LC: box "lexical" "corrector" | |
| 1194 | - arrow <-> up from top of P | |
| 1195 | -Syn: box "syntactic" "corrector" | |
| 1196 | - arrow up | |
| 1197 | -DMP: box "diagnostic" "message" "printer" | |
| 1198 | - arrow <-> right from east of DMP | |
| 1199 | -ST: box "symbol" "table" | |
| 1200 | - arrow from LC.ne to DMP.sw | |
| 1201 | - arrow from Sem.nw to DMP.se | |
| 1202 | - arrow <-> from Sem.top to ST.bot | |
| 1203 | -`}, | |
| 1204 | -{name: "test38", code:`# Need fixing: | |
| 1205 | -# | |
| 1206 | -# * ".bot" as an abbreviation for ".bottom" | |
| 1207 | -# * "up from top of LA" | |
| 1208 | -# | |
| 1209 | - arrow "source" "code" | |
| 1210 | -LA: box "lexical" "analyzer" | |
| 1211 | - arrow "tokens" above | |
| 1212 | -P: box "parser" | |
| 1213 | - arrow "intermediate" "code" | |
| 1214 | -Sem: box "semantic" "checker" | |
| 1215 | - arrow | |
| 1216 | - arrow <-> up from top of LA | |
| 1217 | -LC: box "lexical" "corrector" | |
| 1218 | - arrow <-> up from top of P | |
| 1219 | -Syn: box "syntactic" "corrector" | |
| 1220 | - arrow up | |
| 1221 | -DMP: box "diagnostic" "message" "printer" | |
| 1222 | - arrow <-> right from east of DMP | |
| 1223 | -ST: box "symbol" "table" | |
| 1224 | - arrow from LC.ne to DMP.sw | |
| 1225 | - arrow from Sem.nw to DMP.se | |
| 1226 | - arrow <-> from Sem.top to ST.bot | |
| 1227 | -`}, | |
| 1228 | -{name: "test39b", code:`textwid = 1mm | |
| 1229 | - circle "DISK" | |
| 1230 | - arrow "character" "defns" right 150% | |
| 1231 | -CPU: box "CPU" "(16-bit mini)" | |
| 1232 | - arrow <- from top of CPU up "input " rjust | |
| 1233 | - arrow right from right of CPU | |
| 1234 | -CRT: " CRT" ljust | |
| 1235 | - line from CRT - 0,0.075 up 0.15 \ | |
| 1236 | - then right 0.5 \ | |
| 1237 | - then right 0.5 up 0.25 \ | |
| 1238 | - then down 0.5+0.15 \ | |
| 1239 | - then left 0.5 up 0.25 \ | |
| 1240 | - then left 0.5 | |
| 1241 | -Paper: CRT + 1.05,0.75 | |
| 1242 | - arrow <- from Paper down 1.5 | |
| 1243 | - " ... paper" ljust at end of last arrow + 0, 0.25 | |
| 1244 | - circle rad 0.05 at Paper + (-0.055, -0.25) | |
| 1245 | - circle rad 0.05 at Paper + (0.055, -0.25) | |
| 1246 | - box invis wid 120% " rollers" ljust at Paper + (0.1, -0.25) | |
| 1247 | -`}, | |
| 1248 | -{name: "test39", code:` margin = 5mm | |
| 1249 | - # ^^^^^^^^^^^^-- extra margin required for text | |
| 1250 | - circle "DISK" | |
| 1251 | - arrow "character" "defns" right 150% | |
| 1252 | - # ^^^^^^^^^^---- added for spacing | |
| 1253 | -CPU: box "CPU" "(16-bit mini)" | |
| 1254 | - /*{*/ arrow <- from top of CPU up "input " rjust /*}*/ | |
| 1255 | - # ^^^^^--- removed remove -----^^^^^ | |
| 1256 | - arrow right from CPU.e | |
| 1257 | - # ^^^^^^^^^^^^^^^^--- added to compensate for missing {...} above | |
| 1258 | -CRT: " CRT" ljust wid 1px | |
| 1259 | - # ^^^^^^^--- added to avoid excess spacing | |
| 1260 | - line from CRT - 0,0.075 up 0.15 \ | |
| 1261 | - then right 0.5 \ | |
| 1262 | - then right 0.5 up 0.25 \ | |
| 1263 | - then down 0.5+0.15 \ | |
| 1264 | - then left 0.5 up 0.25 \ | |
| 1265 | - then left 0.5 | |
| 1266 | -Paper: CRT + 1.05,0.75 | |
| 1267 | - arrow <- from Paper down 1.5 | |
| 1268 | - " ... paper" ljust at end of last arrow + 0, 0.25 | |
| 1269 | - circle rad 0.05 at Paper + (-0.055, -0.25) | |
| 1270 | - circle rad 0.05 at Paper + (0.055, -0.25) | |
| 1271 | - " rollers" ljust at Paper + (0.1, -0.25) | |
| 1272 | -`}, | |
| 1273 | -{name: "test40", code:`$one = 1.0 | |
| 1274 | -$one += 2.0 | |
| 1275 | -$two = $one | |
| 1276 | -$two *= 3.0 | |
| 1277 | -print $one, $two | |
| 1278 | -$three -= 11 | |
| 1279 | -$three /= 2 | |
| 1280 | -print $three | |
| 1281 | -`}, | |
| 1282 | -{name: "test41", code:`# Corner test | |
| 1283 | - | |
| 1284 | -box "C" | |
| 1285 | - | |
| 1286 | -$d = 1in | |
| 1287 | -circle rad 50% "N" at $d n of C; arrow from last circle to C.n chop | |
| 1288 | -circle same "NE" at $d ne of C; arrow from last circle to C.ne chop | |
| 1289 | -circle same "E" at $d e of C; arrow from last circle to C.e chop | |
| 1290 | -circle same "SE" at $d se of C; arrow from last circle to C.se chop | |
| 1291 | -circle same "S" at $d s of C; arrow from last circle to C.s chop | |
| 1292 | -circle same "SW" at $d sw of C; arrow from last circle to C.sw chop | |
| 1293 | -circle same "W" at $d w of C; arrow from last circle to C.w chop | |
| 1294 | -circle same "NW" at $d nw of C; arrow from last circle to C.nw chop | |
| 1295 | - | |
| 1296 | -box "C" at 3*$d east of C radius 15px | |
| 1297 | - | |
| 1298 | -circle rad 50% "N" at $d n of C; arrow from last circle to C.n chop | |
| 1299 | -circle same "NE" at $d ne of C; arrow from last circle to C.ne chop | |
| 1300 | -circle same "E" at $d e of C; arrow from last circle to C.e chop | |
| 1301 | -circle same "SE" at $d se of C; arrow from last circle to C.se chop | |
| 1302 | -circle same "S" at $d s of C; arrow from last circle to C.s chop | |
| 1303 | -circle same "SW" at $d sw of C; arrow from last circle to C.sw chop | |
| 1304 | -circle same "W" at $d w of C; arrow from last circle to C.w chop | |
| 1305 | -circle same "NW" at $d nw of C; arrow from last circle to C.nw chop | |
| 1306 | - | |
| 1307 | -ellipse "C" at 2.5*$d south of 1st box | |
| 1308 | - | |
| 1309 | -circle rad 50% "N" at $d n of C; arrow from last circle to C.n chop | |
| 1310 | -circle same "NE" at $d ne of C; arrow from last circle to C.ne chop | |
| 1311 | -circle same "E" at $d e of C; arrow from last circle to C.e chop | |
| 1312 | -circle same "SE" at $d se of C; arrow from last circle to C.se chop | |
| 1313 | -circle same "S" at $d s of C; arrow from last circle to C.s chop | |
| 1314 | -circle same "SW" at $d sw of C; arrow from last circle to C.sw chop | |
| 1315 | -circle same "W" at $d w of C; arrow from last circle to C.w chop | |
| 1316 | -circle same "NW" at $d nw of C; arrow from last circle to C.nw chop | |
| 1317 | - | |
| 1318 | -circle "C" at 3*$d east of last ellipse | |
| 1319 | - | |
| 1320 | -circle rad 50% "N" at $d n of C; arrow from last circle to C.n chop | |
| 1321 | -circle same "NE" at $d ne of C; arrow from last circle to C.ne chop | |
| 1322 | -circle same "E" at $d e of C; arrow from last circle to C.e chop | |
| 1323 | -circle same "SE" at $d se of C; arrow from last circle to C.se chop | |
| 1324 | -circle same "S" at $d s of C; arrow from last circle to C.s chop | |
| 1325 | -circle same "SW" at $d sw of C; arrow from last circle to C.sw chop | |
| 1326 | -circle same "W" at $d w of C; arrow from last circle to C.w chop | |
| 1327 | -circle same "NW" at $d nw of C; arrow from last circle to C.nw chop | |
| 1328 | - | |
| 1329 | -cylinder "C" at 2.5*$d south of last ellipse | |
| 1330 | -circle rad 50% "N" at $d n of C; arrow from last circle to C.n chop | |
| 1331 | -circle same "NE" at $d ne of C; arrow from last circle to C.ne chop | |
| 1332 | -circle same "E" at $d e of C; arrow from last circle to C.e chop | |
| 1333 | -circle same "SE" at $d se of C; arrow from last circle to C.se chop | |
| 1334 | -circle same "S" at $d s of C; arrow from last circle to C.s chop | |
| 1335 | -circle same "SW" at $d sw of C; arrow from last circle to C.sw chop | |
| 1336 | -circle same "W" at $d w of C; arrow from last circle to C.w chop | |
| 1337 | -circle same "NW" at $d nw of C; arrow from last circle to C.nw chop | |
| 1338 | - | |
| 1339 | -oval "C" at 3*$d east of last cylinder | |
| 1340 | -circle rad 50% "N" at $d n of C; arrow from last circle to C.n chop | |
| 1341 | -circle same "NE" at $d ne of C; arrow from last circle to C.ne chop | |
| 1342 | -circle same "E" at $d e of C; arrow from last circle to C.e chop | |
| 1343 | -circle same "SE" at $d se of C; arrow from last circle to C.se chop | |
| 1344 | -circle same "S" at $d s of C; arrow from last circle to C.s chop | |
| 1345 | -circle same "SW" at $d sw of C; arrow from last circle to C.sw chop | |
| 1346 | -circle same "W" at $d w of C; arrow from last circle to C.w chop | |
| 1347 | -circle same "NW" at $d nw of C; arrow from last circle to C.nw chop | |
| 1348 | -`}, | |
| 1349 | -{name: "test42", code:`C: ellipse "ellipse" | |
| 1350 | - | |
| 1351 | -line from C to 2cm heading 00 from C chop; | |
| 1352 | -line from C to 2cm heading 10 from C chop; | |
| 1353 | -line from C to 2cm heading 20 from C chop; | |
| 1354 | -line from C to 2cm heading 30 from C chop; | |
| 1355 | -line from C to 2cm heading 40 from C chop; | |
| 1356 | -line from C to 2cm heading 50 from C chop; | |
| 1357 | -line from C to 2cm heading 60 from C chop; | |
| 1358 | -line from C to 2cm heading 70 from C chop; | |
| 1359 | -line from C to 2cm heading 80 from C chop; | |
| 1360 | -line from C to 2cm heading 90 from C chop; | |
| 1361 | -line from C to 2cm heading 100 from C chop; | |
| 1362 | -line from C to 2cm heading 110 from C chop; | |
| 1363 | -line from C to 2cm heading 120 from C chop; | |
| 1364 | -line from C to 2cm heading 130 from C chop; | |
| 1365 | -line from C to 2cm heading 140 from C chop; | |
| 1366 | -line from C to 2cm heading 150 from C chop; | |
| 1367 | -line from C to 2cm heading 160 from C chop; | |
| 1368 | -line from C to 2cm heading 170 from C chop; | |
| 1369 | -line from C to 2cm heading 180 from C chop; | |
| 1370 | -line from C to 2cm heading 190 from C chop; | |
| 1371 | -line from C to 2cm heading 200 from C chop; | |
| 1372 | -line from C to 2cm heading 210 from C chop; | |
| 1373 | -line from C to 2cm heading 220 from C chop; | |
| 1374 | -line from C to 2cm heading 230 from C chop; | |
| 1375 | -line from C to 2cm heading 240 from C chop; | |
| 1376 | -line from C to 2cm heading 250 from C chop; | |
| 1377 | -line from C to 2cm heading 260 from C chop; | |
| 1378 | -line from C to 2cm heading 270 from C chop; | |
| 1379 | -line from C to 2cm heading 280 from C chop; | |
| 1380 | -line from C to 2cm heading 290 from C chop; | |
| 1381 | -line from C to 2cm heading 300 from C chop; | |
| 1382 | -line from C to 2cm heading 310 from C chop; | |
| 1383 | -line from C to 2cm heading 320 from C chop; | |
| 1384 | -line from C to 2cm heading 330 from C chop; | |
| 1385 | -line from C to 2cm heading 340 from C chop; | |
| 1386 | -line from C to 2cm heading 350 from C chop; | |
| 1387 | -`}, | |
| 1388 | -{name: "test43", code:`scale = 0.75 | |
| 1389 | -box "One" | |
| 1390 | -arrow right 200% "Bold" bold above "Italic" italic below | |
| 1391 | -circle "Two" | |
| 1392 | -circle "Bold-Italic" bold italic aligned fit \ | |
| 1393 | - at 4cm heading 143 from Two | |
| 1394 | -arrow from Two to last circle "above" aligned above "below" aligned below chop | |
| 1395 | -circle "C2" fit at 4cm heading 50 from Two | |
| 1396 | -arrow from Two to last circle "above" aligned above "below "aligned below chop | |
| 1397 | -circle "C3" fit at 4cm heading 200 from Two | |
| 1398 | -arrow from last circle to Two <- \ | |
| 1399 | - "above-rjust" aligned rjust above \ | |
| 1400 | - "below-rjust" aligned rjust below chop | |
| 1401 | -`}, | |
| 1402 | -{name: "test44", code:`debug=1 | |
| 1403 | -file "*.md" rad 20% | |
| 1404 | -arrow | |
| 1405 | -box rad 10px "Markdown" "Interpreter" | |
| 1406 | -arrow right 120% "HTML" above | |
| 1407 | -file " HTML " | |
| 1408 | 459 | `} |
| 1409 | 460 | |
| 1410 | 461 | ]; |
| 1411 | 462 | |
| 1412 | 463 | })(window.fossil); |
| 1413 | 464 |
| --- src/fossil.page.pikchrshow.js | |
| +++ src/fossil.page.pikchrshow.js | |
| @@ -108,19 +108,24 @@ | |
| 108 | })*/; |
| 109 | D.append(P.e.uiControls, cbWrap); |
| 110 | P.predefinedPiks.forEach(function(script,ndx){ |
| 111 | const opt = D.option(script.code ? script.code.trim() :'', script.name); |
| 112 | D.append(selectScript, opt); |
| 113 | if(!ndx) selectScript.selectedIndex = 0 /*timing/ordering workaround*/; |
| 114 | if(!script.code) D.disable(opt); |
| 115 | }); |
| 116 | delete P.predefinedPiks; |
| 117 | selectScript.addEventListener('change', function(ev){ |
| 118 | const val = ev.target.value; |
| 119 | if(!val) return; |
| 120 | P.e.taContent.value = val; |
| 121 | if(cbAutoPreview.checked) P.preview(); |
| 122 | }, false); |
| 123 | } |
| 124 | |
| 125 | //////////////////////////////////////////////////////////// |
| 126 | // Move dark mode checkbox to the end and add a help buttonlet |
| @@ -263,10 +268,16 @@ | |
| 263 | D.disable(fp.toDisable, this.e.previewModeToggle, this.e.markupAlignCenter); |
| 264 | D.addClass(this.e.previewCopyButton, 'disabled'); |
| 265 | const content = this.e.taContent.value.trim(); |
| 266 | this.response.raw = undefined; |
| 267 | this.response.inputText = content; |
| 268 | if(!content){ |
| 269 | fp.updateView("No pikchr content!",true); |
| 270 | return this; |
| 271 | } |
| 272 | const self = this; |
| @@ -276,12 +287,16 @@ | |
| 276 | F.message( |
| 277 | "Fetching preview..." |
| 278 | ).fetch('pikchrshow',{ |
| 279 | payload: fd, |
| 280 | responseHeaders: 'x-pikchrshow-is-error', |
| 281 | onload: (r,header)=>{ |
| 282 | fp.updateView(r,+header ? true : false); |
| 283 | F.message('Updated preview.'); |
| 284 | }, |
| 285 | onerror: (e)=>{ |
| 286 | F.fetch.onerror(e); |
| 287 | fp.updateView("Error fetching preview: "+e, true); |
| @@ -301,288 +316,84 @@ | |
| 301 | SELECT element (a disabled OPTION). |
| 302 | |
| 303 | } |
| 304 | */ |
| 305 | P.predefinedPiks = [ |
| 306 | {name: "--Predefined Scripts--"}, |
| 307 | /* |
| 308 | The following were imported from the pikchr test scripts: |
| 309 | |
| 310 | https://fossil-scm.org/pikchr/dir/tests |
| 311 | */ |
| 312 | {name: "autochop01", code:`C: box "box" |
| 313 | |
| 314 | line from C to 3cm heading 00 from C chop; |
| 315 | line from C to 3cm heading 10 from C chop; |
| 316 | line from C to 3cm heading 20 from C chop; |
| 317 | line from C to 3cm heading 30 from C chop; |
| 318 | line from C to 3cm heading 40 from C chop; |
| 319 | line from C to 3cm heading 50 from C chop; |
| 320 | line from C to 3cm heading 60 from C chop; |
| 321 | line from C to 3cm heading 70 from C chop; |
| 322 | line from C to 3cm heading 80 from C chop; |
| 323 | line from C to 3cm heading 90 from C chop; |
| 324 | line from C to 3cm heading 100 from C chop; |
| 325 | line from C to 3cm heading 110 from C chop; |
| 326 | line from C to 3cm heading 120 from C chop; |
| 327 | line from C to 3cm heading 130 from C chop; |
| 328 | line from C to 3cm heading 140 from C chop; |
| 329 | line from C to 3cm heading 150 from C chop; |
| 330 | line from C to 3cm heading 160 from C chop; |
| 331 | line from C to 3cm heading 170 from C chop; |
| 332 | line from C to 3cm heading 180 from C chop; |
| 333 | line from C to 3cm heading 190 from C chop; |
| 334 | line from C to 3cm heading 200 from C chop; |
| 335 | line from C to 3cm heading 210 from C chop; |
| 336 | line from C to 3cm heading 220 from C chop; |
| 337 | line from C to 3cm heading 230 from C chop; |
| 338 | line from C to 3cm heading 240 from C chop; |
| 339 | line from C to 3cm heading 250 from C chop; |
| 340 | line from C to 3cm heading 260 from C chop; |
| 341 | line from C to 3cm heading 270 from C chop; |
| 342 | line from C to 3cm heading 280 from C chop; |
| 343 | line from C to 3cm heading 290 from C chop; |
| 344 | line from C to 3cm heading 300 from C chop; |
| 345 | line from C to 3cm heading 310 from C chop; |
| 346 | line from C to 3cm heading 320 from C chop; |
| 347 | line from C to 3cm heading 330 from C chop; |
| 348 | line from C to 3cm heading 340 from C chop; |
| 349 | line from C to 3cm heading 350 from C chop; |
| 350 | `}, |
| 351 | {name: "autochop02", code:`C: box "box" radius 10px |
| 352 | |
| 353 | line from C to 3cm heading 00 from C chop; |
| 354 | line from C to 3cm heading 10 from C chop; |
| 355 | line from C to 3cm heading 20 from C chop; |
| 356 | line from C to 3cm heading 30 from C chop; |
| 357 | line from C to 3cm heading 40 from C chop; |
| 358 | line from C to 3cm heading 50 from C chop; |
| 359 | line from C to 3cm heading 60 from C chop; |
| 360 | line from C to 3cm heading 70 from C chop; |
| 361 | line from C to 3cm heading 80 from C chop; |
| 362 | line from C to 3cm heading 90 from C chop; |
| 363 | line from C to 3cm heading 100 from C chop; |
| 364 | line from C to 3cm heading 110 from C chop; |
| 365 | line from C to 3cm heading 120 from C chop; |
| 366 | line from C to 3cm heading 130 from C chop; |
| 367 | line from C to 3cm heading 140 from C chop; |
| 368 | line from C to 3cm heading 150 from C chop; |
| 369 | line from C to 3cm heading 160 from C chop; |
| 370 | line from C to 3cm heading 170 from C chop; |
| 371 | line from C to 3cm heading 180 from C chop; |
| 372 | line from C to 3cm heading 190 from C chop; |
| 373 | line from C to 3cm heading 200 from C chop; |
| 374 | line from C to 3cm heading 210 from C chop; |
| 375 | line from C to 3cm heading 220 from C chop; |
| 376 | line from C to 3cm heading 230 from C chop; |
| 377 | line from C to 3cm heading 240 from C chop; |
| 378 | line from C to 3cm heading 250 from C chop; |
| 379 | line from C to 3cm heading 260 from C chop; |
| 380 | line from C to 3cm heading 270 from C chop; |
| 381 | line from C to 3cm heading 280 from C chop; |
| 382 | line from C to 3cm heading 290 from C chop; |
| 383 | line from C to 3cm heading 300 from C chop; |
| 384 | line from C to 3cm heading 310 from C chop; |
| 385 | line from C to 3cm heading 320 from C chop; |
| 386 | line from C to 3cm heading 330 from C chop; |
| 387 | line from C to 3cm heading 340 from C chop; |
| 388 | line from C to 3cm heading 350 from C chop; |
| 389 | `}, |
| 390 | {name: "autochop03", code:`C: circle "circle" |
| 391 | |
| 392 | line from C to 3cm heading 00 from C chop; |
| 393 | line from C to 3cm heading 10 from C chop; |
| 394 | line from C to 3cm heading 20 from C chop; |
| 395 | line from C to 3cm heading 30 from C chop; |
| 396 | line from C to 3cm heading 40 from C chop; |
| 397 | line from C to 3cm heading 50 from C chop; |
| 398 | line from C to 3cm heading 60 from C chop; |
| 399 | line from C to 3cm heading 70 from C chop; |
| 400 | line from C to 3cm heading 80 from C chop; |
| 401 | line from C to 3cm heading 90 from C chop; |
| 402 | line from C to 3cm heading 100 from C chop; |
| 403 | line from C to 3cm heading 110 from C chop; |
| 404 | line from C to 3cm heading 120 from C chop; |
| 405 | line from C to 3cm heading 130 from C chop; |
| 406 | line from C to 3cm heading 140 from C chop; |
| 407 | line from C to 3cm heading 150 from C chop; |
| 408 | line from C to 3cm heading 160 from C chop; |
| 409 | line from C to 3cm heading 170 from C chop; |
| 410 | line from C to 3cm heading 180 from C chop; |
| 411 | line from C to 3cm heading 190 from C chop; |
| 412 | line from C to 3cm heading 200 from C chop; |
| 413 | line from C to 3cm heading 210 from C chop; |
| 414 | line from C to 3cm heading 220 from C chop; |
| 415 | line from C to 3cm heading 230 from C chop; |
| 416 | line from C to 3cm heading 240 from C chop; |
| 417 | line from C to 3cm heading 250 from C chop; |
| 418 | line from C to 3cm heading 260 from C chop; |
| 419 | line from C to 3cm heading 270 from C chop; |
| 420 | line from C to 3cm heading 280 from C chop; |
| 421 | line from C to 3cm heading 290 from C chop; |
| 422 | line from C to 3cm heading 300 from C chop; |
| 423 | line from C to 3cm heading 310 from C chop; |
| 424 | line from C to 3cm heading 320 from C chop; |
| 425 | line from C to 3cm heading 330 from C chop; |
| 426 | line from C to 3cm heading 340 from C chop; |
| 427 | line from C to 3cm heading 350 from C chop; |
| 428 | `}, |
| 429 | {name: "autochop04", code:`C: ellipse "ellipse" |
| 430 | |
| 431 | line from C to 3cm heading 00 from C chop; |
| 432 | line from C to 3cm heading 10 from C chop; |
| 433 | line from C to 3cm heading 20 from C chop; |
| 434 | line from C to 3cm heading 30 from C chop; |
| 435 | line from C to 3cm heading 40 from C chop; |
| 436 | line from C to 3cm heading 50 from C chop; |
| 437 | line from C to 3cm heading 60 from C chop; |
| 438 | line from C to 3cm heading 70 from C chop; |
| 439 | line from C to 3cm heading 80 from C chop; |
| 440 | line from C to 3cm heading 90 from C chop; |
| 441 | line from C to 3cm heading 100 from C chop; |
| 442 | line from C to 3cm heading 110 from C chop; |
| 443 | line from C to 3cm heading 120 from C chop; |
| 444 | line from C to 3cm heading 130 from C chop; |
| 445 | line from C to 3cm heading 140 from C chop; |
| 446 | line from C to 3cm heading 150 from C chop; |
| 447 | line from C to 3cm heading 160 from C chop; |
| 448 | line from C to 3cm heading 170 from C chop; |
| 449 | line from C to 3cm heading 180 from C chop; |
| 450 | line from C to 3cm heading 190 from C chop; |
| 451 | line from C to 3cm heading 200 from C chop; |
| 452 | line from C to 3cm heading 210 from C chop; |
| 453 | line from C to 3cm heading 220 from C chop; |
| 454 | line from C to 3cm heading 230 from C chop; |
| 455 | line from C to 3cm heading 240 from C chop; |
| 456 | line from C to 3cm heading 250 from C chop; |
| 457 | line from C to 3cm heading 260 from C chop; |
| 458 | line from C to 3cm heading 270 from C chop; |
| 459 | line from C to 3cm heading 280 from C chop; |
| 460 | line from C to 3cm heading 290 from C chop; |
| 461 | line from C to 3cm heading 300 from C chop; |
| 462 | line from C to 3cm heading 310 from C chop; |
| 463 | line from C to 3cm heading 320 from C chop; |
| 464 | line from C to 3cm heading 330 from C chop; |
| 465 | line from C to 3cm heading 340 from C chop; |
| 466 | line from C to 3cm heading 350 from C chop; |
| 467 | `}, |
| 468 | {name: "autochop05", code:`C: oval "oval" |
| 469 | |
| 470 | line from C to 3cm heading 00 from C chop; |
| 471 | line from C to 3cm heading 10 from C chop; |
| 472 | line from C to 3cm heading 20 from C chop; |
| 473 | line from C to 3cm heading 30 from C chop; |
| 474 | line from C to 3cm heading 40 from C chop; |
| 475 | line from C to 3cm heading 50 from C chop; |
| 476 | line from C to 3cm heading 60 from C chop; |
| 477 | line from C to 3cm heading 70 from C chop; |
| 478 | line from C to 3cm heading 80 from C chop; |
| 479 | line from C to 3cm heading 90 from C chop; |
| 480 | line from C to 3cm heading 100 from C chop; |
| 481 | line from C to 3cm heading 110 from C chop; |
| 482 | line from C to 3cm heading 120 from C chop; |
| 483 | line from C to 3cm heading 130 from C chop; |
| 484 | line from C to 3cm heading 140 from C chop; |
| 485 | line from C to 3cm heading 150 from C chop; |
| 486 | line from C to 3cm heading 160 from C chop; |
| 487 | line from C to 3cm heading 170 from C chop; |
| 488 | line from C to 3cm heading 180 from C chop; |
| 489 | line from C to 3cm heading 190 from C chop; |
| 490 | line from C to 3cm heading 200 from C chop; |
| 491 | line from C to 3cm heading 210 from C chop; |
| 492 | line from C to 3cm heading 220 from C chop; |
| 493 | line from C to 3cm heading 230 from C chop; |
| 494 | line from C to 3cm heading 240 from C chop; |
| 495 | line from C to 3cm heading 250 from C chop; |
| 496 | line from C to 3cm heading 260 from C chop; |
| 497 | line from C to 3cm heading 270 from C chop; |
| 498 | line from C to 3cm heading 280 from C chop; |
| 499 | line from C to 3cm heading 290 from C chop; |
| 500 | line from C to 3cm heading 300 from C chop; |
| 501 | line from C to 3cm heading 310 from C chop; |
| 502 | line from C to 3cm heading 320 from C chop; |
| 503 | line from C to 3cm heading 330 from C chop; |
| 504 | line from C to 3cm heading 340 from C chop; |
| 505 | line from C to 3cm heading 350 from C chop; |
| 506 | `}, |
| 507 | {name: "autochop06", code:`C: cylinder "cylinder" |
| 508 | |
| 509 | line from C to 3cm heading 00 from C chop; |
| 510 | line from C to 3cm heading 10 from C chop; |
| 511 | line from C to 3cm heading 20 from C chop; |
| 512 | line from C to 3cm heading 30 from C chop; |
| 513 | line from C to 3cm heading 40 from C chop; |
| 514 | line from C to 3cm heading 50 from C chop; |
| 515 | line from C to 3cm heading 60 from C chop; |
| 516 | line from C to 3cm heading 70 from C chop; |
| 517 | line from C to 3cm heading 80 from C chop; |
| 518 | line from C to 3cm heading 90 from C chop; |
| 519 | line from C to 3cm heading 100 from C chop; |
| 520 | line from C to 3cm heading 110 from C chop; |
| 521 | line from C to 3cm heading 120 from C chop; |
| 522 | line from C to 3cm heading 130 from C chop; |
| 523 | line from C to 3cm heading 140 from C chop; |
| 524 | line from C to 3cm heading 150 from C chop; |
| 525 | line from C to 3cm heading 160 from C chop; |
| 526 | line from C to 3cm heading 170 from C chop; |
| 527 | line from C to 3cm heading 180 from C chop; |
| 528 | line from C to 3cm heading 190 from C chop; |
| 529 | line from C to 3cm heading 200 from C chop; |
| 530 | line from C to 3cm heading 210 from C chop; |
| 531 | line from C to 3cm heading 220 from C chop; |
| 532 | line from C to 3cm heading 230 from C chop; |
| 533 | line from C to 3cm heading 240 from C chop; |
| 534 | line from C to 3cm heading 250 from C chop; |
| 535 | line from C to 3cm heading 260 from C chop; |
| 536 | line from C to 3cm heading 270 from C chop; |
| 537 | line from C to 3cm heading 280 from C chop; |
| 538 | line from C to 3cm heading 290 from C chop; |
| 539 | line from C to 3cm heading 300 from C chop; |
| 540 | line from C to 3cm heading 310 from C chop; |
| 541 | line from C to 3cm heading 320 from C chop; |
| 542 | line from C to 3cm heading 330 from C chop; |
| 543 | line from C to 3cm heading 340 from C chop; |
| 544 | line from C to 3cm heading 350 from C chop; |
| 545 | `}, |
| 546 | {name: "autochop07", code:`C: file "file" |
| 547 | |
| 548 | line from C to 3cm heading 00 from C chop; |
| 549 | line from C to 3cm heading 10 from C chop; |
| 550 | line from C to 3cm heading 20 from C chop; |
| 551 | line from C to 3cm heading 30 from C chop; |
| 552 | line from C to 3cm heading 40 from C chop; |
| 553 | line from C to 3cm heading 50 from C chop; |
| 554 | line from C to 3cm heading 60 from C chop; |
| 555 | line from C to 3cm heading 70 from C chop; |
| 556 | line from C to 3cm heading 80 from C chop; |
| 557 | line from C to 3cm heading 90 from C chop; |
| 558 | line from C to 3cm heading 100 from C chop; |
| 559 | line from C to 3cm heading 110 from C chop; |
| 560 | line from C to 3cm heading 120 from C chop; |
| 561 | line from C to 3cm heading 130 from C chop; |
| 562 | line from C to 3cm heading 140 from C chop; |
| 563 | line from C to 3cm heading 150 from C chop; |
| 564 | line from C to 3cm heading 160 from C chop; |
| 565 | line from C to 3cm heading 170 from C chop; |
| 566 | line from C to 3cm heading 180 from C chop; |
| 567 | line from C to 3cm heading 190 from C chop; |
| 568 | line from C to 3cm heading 200 from C chop; |
| 569 | line from C to 3cm heading 210 from C chop; |
| 570 | line from C to 3cm heading 220 from C chop; |
| 571 | line from C to 3cm heading 230 from C chop; |
| 572 | line from C to 3cm heading 240 from C chop; |
| 573 | line from C to 3cm heading 250 from C chop; |
| 574 | line from C to 3cm heading 260 from C chop; |
| 575 | line from C to 3cm heading 270 from C chop; |
| 576 | line from C to 3cm heading 280 from C chop; |
| 577 | line from C to 3cm heading 290 from C chop; |
| 578 | line from C to 3cm heading 300 from C chop; |
| 579 | line from C to 3cm heading 310 from C chop; |
| 580 | line from C to 3cm heading 320 from C chop; |
| 581 | line from C to 3cm heading 330 from C chop; |
| 582 | line from C to 3cm heading 340 from C chop; |
| 583 | line from C to 3cm heading 350 from C chop; |
| 584 | `}, |
| 585 | {name: "swimlane", code:` $laneh = 0.75 |
| 586 | |
| 587 | # Draw the lanes |
| 588 | down |
| @@ -625,13 +436,13 @@ | |
| 625 | C1: circle same as A1 at B1-(0,$laneh) "1" |
| 626 | arrow 50% |
| 627 | circle same "2" |
| 628 | arrow right 0.8in "goes" "offline" |
| 629 | C5: circle same as A3 "5" |
| 630 | arrow right until even with first ellipse.w |
| 631 | ellipse same "future" |
| 632 | text "back online" "pushes 5" "pulls 3 & 4" with .n at last arrow |
| 633 | |
| 634 | # content for the Darlene lane |
| 635 | D1: circle same as A1 at C1-(0,$laneh) "1" |
| 636 | arrow 50% |
| 637 | circle same "2" |
| @@ -643,770 +454,10 @@ | |
| 643 | ellipse same "future" |
| 644 | D3: circle same as B3 at B3-(0,2*$laneh) "3" |
| 645 | arrow 50% |
| 646 | circle same "4" |
| 647 | arrow from D1 to D3 chop |
| 648 | `}, |
| 649 | {name: "test01", code:`circle "C0"; arrow; circle "C1"; arrow; circle "C2"; arrow; |
| 650 | circle "C4"; arrow; circle "C6" |
| 651 | circle "C3" at (C4.x-C2.x) ne of C2; arrow; circle "C5" |
| 652 | arrow from C2.ne to C3.sw |
| 653 | `}, |
| 654 | {name: "test02", code:`/* First generate the main graph */ |
| 655 | scale = 0.75 |
| 656 | Main: [ |
| 657 | circle "C0" |
| 658 | arrow |
| 659 | circle "C1" |
| 660 | arrow |
| 661 | circle "C2" |
| 662 | arrow |
| 663 | circle "C4" |
| 664 | arrow |
| 665 | circle "C6" |
| 666 | ] |
| 667 | Branch: [ |
| 668 | circle "C3" |
| 669 | arrow |
| 670 | circle "C5" |
| 671 | ] with .sw at Main.C2.n + (0.35,0.35) |
| 672 | arrow from Main.C2 to Branch.C3 chop |
| 673 | |
| 674 | /* Now generate the background colors */ |
| 675 | layer = 0 |
| 676 | $featurecolor = 0xfedbce |
| 677 | $maincolor = 0xd9fece |
| 678 | $divY = (Branch.y + Main.y)/2 |
| 679 | $divH = (Branch.y - Main.y) |
| 680 | box fill $featurecolor color $featurecolor \ |
| 681 | width Branch.width*1.5 height $divH \ |
| 682 | at Branch |
| 683 | box fill $maincolor color $maincolor \ |
| 684 | width Main.width+0.1 height $divH \ |
| 685 | at Main |
| 686 | "main" ljust at 0.1 se of nw of 2nd box |
| 687 | "feature" ljust at 0.1 se of nw of 1st box |
| 688 | `}, |
| 689 | {name: "test03", code:`right |
| 690 | B1: box "One"; line |
| 691 | B2: box "Two"; arrow |
| 692 | B3: box "Three"; down; arrow down 50%; circle "Hi!"; left; |
| 693 | spline -> left 2cm then to One.se |
| 694 | Macro: [ |
| 695 | B4: box "four" |
| 696 | B5: box "five" |
| 697 | B6: box "six" |
| 698 | ] with n at 3cm below s of 2nd box |
| 699 | |
| 700 | arrow from s of 2nd box to Macro.B5.n |
| 701 | |
| 702 | spline -> from e of last circle right 1cm then down 1cm then to Macro.B4.e |
| 703 | |
| 704 | box width Macro.width+0.1 height Macro.height+0.1 at Macro color Red |
| 705 | box width Macro.B5.width+0.05 \ |
| 706 | height Macro.B5.height+0.05 at Macro.B5 color blue |
| 707 | `}, |
| 708 | {name: "test04", code:`print 5+8; |
| 709 | print (17.4-5)/(2-2); |
| 710 | `}, |
| 711 | {name: "test05", code:`print linewid |
| 712 | linewid=0.8 |
| 713 | print linewid |
| 714 | scale=2.0 |
| 715 | print scale |
| 716 | print hotpink |
| 717 | print 17 + linewid*1000; |
| 718 | print sin(scale); |
| 719 | print cos(scale) |
| 720 | print sqrt(17) |
| 721 | print min(5,10) |
| 722 | print max(5,10) |
| 723 | print sqrt(-11) |
| 724 | `}, |
| 725 | {name: "test06", code:`B1: box "one" width 1 height 1 at 2,2; |
| 726 | B2: box thickness 300% dotted 0.03 "two" at 1,3; |
| 727 | print "B2.n: ",B2.n.x,",",B2.n.y |
| 728 | print "B2.c: ",B2.c.x,",",B2.c.y |
| 729 | print "B2.e: ",B2.e.x,",",B2.e.y |
| 730 | scale = 1 |
| 731 | box "three" "four" ljust "five" with .n at 0.1 below B2.s width 50% |
| 732 | |
| 733 | # Text demo: <text x="100" y="100" text-anchor="end" dominant-baseline="central">I love SVG!</text> |
| 734 | `}, |
| 735 | {name: "test07", code:`B: box "This is" "<b>" "box \"B\"" color DarkRed |
| 736 | |
| 737 | "B.nw" rjust above at 0.05 left of B.nw |
| 738 | "B.w" rjust at 0.05 left of B.w |
| 739 | "B.sw" rjust below at 0.05 left of B.sw; $abc = DarkBlue |
| 740 | "B.s" below at B.s |
| 741 | // C++ style comments allowed. |
| 742 | "B.se" ljust below at 0.05 right of B.se color DarkBlue |
| 743 | "B.e" ljust at 0.05 right of B.e /* C-style comments */ |
| 744 | "B.ne" ljust above at 0.05 right of B.ne |
| 745 | "B.n" center above at B.n |
| 746 | print "this is a test: " /*comment ignored*/, $abc |
| 747 | print "Colors:", Orange, Black, White, Red, Green, Blue |
| 748 | |
| 749 | # line from B.ne + (0.05,0) right 1.0 then down 2.5 then left 1.5 |
| 750 | `}, |
| 751 | {name: "test08", code:` debug = 1; |
| 752 | |
| 753 | box "one" width 80% height 80% |
| 754 | box "two" width 150% color DarkRed |
| 755 | arrow "xyz" above |
| 756 | box "three" height 150% color DarkBlue |
| 757 | down |
| 758 | arrow |
| 759 | B4: box "four" |
| 760 | B45: box "4.5" fill SkyBlue |
| 761 | move |
| 762 | B5: box "five" |
| 763 | left |
| 764 | B6: box "six" |
| 765 | up |
| 766 | box "seven" width 50% height 50% |
| 767 | |
| 768 | line from 0.1 right of B4.e right 1 then down until even with B5 \ |
| 769 | then to B5 rad 0.1 chop |
| 770 | |
| 771 | arrow from B6 left even with 2nd box then up to 2nd box chop rad 0.1 |
| 772 | arrow from 1/2 way between B6.w and B6.sw left until even with first box \ |
| 773 | then up to first box rad 0.1 chop |
| 774 | |
| 775 | oval wid 25% ht B4.n.y - B45.s.y at (B6.x,B4.s.y) |
| 776 | arrow from last box to last oval chop |
| 777 | arrow <- from B4.w left until even with last oval.e |
| 778 | arrow <- from B45 left until even with last oval.e chop |
| 779 | `}, |
| 780 | {name: "test09", code:`HEAD: circle |
| 781 | circle radius 50% with .se at HEAD.nw |
| 782 | circle radius 50% with .sw at HEAD.ne |
| 783 | `}, |
| 784 | {name: "test10", code:`C: "+"; $x = 0 |
| 785 | line from 0.5 heading $x from C to 1.0 heading $x from C |
| 786 | $x = $x + 10 |
| 787 | line from 0.5 heading $x from C to 1.0 heading $x from C |
| 788 | $x = $x + 10 |
| 789 | line from 0.5 heading $x from C to 1.0 heading $x from C |
| 790 | $x = $x + 10 |
| 791 | line from 0.5 heading $x from C to 1.0 heading $x from C |
| 792 | $x = $x + 10 |
| 793 | line from 0.5 heading $x from C to 1.0 heading $x from C |
| 794 | $x = $x + 10 |
| 795 | line from 0.5 heading $x from C to 1.0 heading $x from C |
| 796 | $x = $x + 10 |
| 797 | line from 0.5 heading $x from C to 1.0 heading $x from C |
| 798 | $x = $x + 10 |
| 799 | line from 0.5 heading $x from C to 1.0 heading $x from C |
| 800 | $x = $x + 10 |
| 801 | line from 0.5 heading $x from C to 1.0 heading $x from C |
| 802 | $x = $x + 10 |
| 803 | line from 0.5 heading $x from C to 1.0 heading $x from C |
| 804 | $x = $x + 10 |
| 805 | line from 0.5 heading $x from C to 1.0 heading $x from C |
| 806 | $x = $x + 10 |
| 807 | line from 0.5 heading $x from C to 1.0 heading $x from C |
| 808 | $x = $x + 10 |
| 809 | line from 0.5 heading $x from C to 1.0 heading $x from C |
| 810 | $x = $x + 10 |
| 811 | line from 0.5 heading $x from C to 1.0 heading $x from C |
| 812 | $x = $x + 10 |
| 813 | line from 0.5 heading $x from C to 1.0 heading $x from C |
| 814 | $x = $x + 10 |
| 815 | line from 0.5 heading $x from C to 1.0 heading $x from C |
| 816 | $x = $x + 10 |
| 817 | line from 0.5 heading $x from C to 1.0 heading $x from C |
| 818 | $x = $x + 10 |
| 819 | line from 0.5 heading $x from C to 1.0 heading $x from C |
| 820 | $x = $x + 10 |
| 821 | line from 0.5 heading $x from C to 1.0 heading $x from C |
| 822 | $x = $x + 10 |
| 823 | line from 0.5 heading $x from C to 1.0 heading $x from C |
| 824 | $x = $x + 10 |
| 825 | line from 0.5 heading $x from C to 1.0 heading $x from C |
| 826 | $x = $x + 10 |
| 827 | line from 0.5 heading $x from C to 1.0 heading $x from C |
| 828 | $x = $x + 10 |
| 829 | line from 0.5 heading $x from C to 1.0 heading $x from C |
| 830 | $x = $x + 10 |
| 831 | line from 0.5 heading $x from C to 1.0 heading $x from C |
| 832 | $x = $x + 10 |
| 833 | line from 0.5 heading $x from C to 1.0 heading $x from C |
| 834 | $x = $x + 10 |
| 835 | line from 0.5 heading $x from C to 1.0 heading $x from C |
| 836 | $x = $x + 10 |
| 837 | line from 0.5 heading $x from C to 1.0 heading $x from C |
| 838 | $x = $x + 10 |
| 839 | line from 0.5 heading $x from C to 1.0 heading $x from C |
| 840 | $x = $x + 10 |
| 841 | line from 0.5 heading $x from C to 1.0 heading $x from C |
| 842 | `}, |
| 843 | {name: "test11", code:` linerad = 5px |
| 844 | C: circle "Center" rad 150% |
| 845 | circle "N" at 1.0 n of C; arrow from C to last chop -> |
| 846 | circle "NE" at 1.0 ne of C; arrow from C to last chop <- |
| 847 | circle "E" at 1.0 e of C; arrow from C to last chop <-> |
| 848 | circle "SE" at 1.0 se of C; arrow from C to last chop -> |
| 849 | circle "S" at 1.0 s of C; arrow from C to last chop <- |
| 850 | circle "SW" at 1.0 sw of C; arrow from C to last chop <-> |
| 851 | circle "W" at 1.0 w of C; arrow from C to last chop -> |
| 852 | circle "NW" at 1.0 nw of C; arrow from C to last chop <- |
| 853 | arrow from 2nd circle to 3rd circle chop |
| 854 | arrow from 4th circle to 3rd circle chop |
| 855 | arrow from SW to S chop <-> |
| 856 | circle "ESE" at 2.0 heading 112.5 from Center \ |
| 857 | thickness 150% fill lightblue radius 75% |
| 858 | arrow from Center to ESE thickness 150% <-> chop |
| 859 | arrow from ESE up 1.35 then to NE chop |
| 860 | line dashed <- from E.e to (ESE.x,E.y) |
| 861 | line dotted <-> thickness 50% from N to NW chop |
| 862 | `}, |
| 863 | {name: "test12", code:`circle "One" |
| 864 | arrow |
| 865 | circle "Two"; down |
| 866 | arrow down 40% |
| 867 | circle "Three" |
| 868 | move |
| 869 | circle "Four" |
| 870 | `}, |
| 871 | {name: "test13", code:`// margin = 1 |
| 872 | line up 1 right 2 |
| 873 | linewid = 0 |
| 874 | arrow left 2 |
| 875 | move left 0.1 |
| 876 | line <-> down 1 |
| 877 | "height " rjust at last line |
| 878 | `}, |
| 879 | {name: "test14", code:`print "1in=",1in |
| 880 | print "1cm=",1cm |
| 881 | print "1mm=",1mm |
| 882 | print "1pt=",1pt |
| 883 | print "1px=",1px |
| 884 | print "1pc=",1pc |
| 885 | scale = 0.25 |
| 886 | circle "in" radius 1in |
| 887 | circle "cm" radius 2.54cm |
| 888 | circle "mm" radius 25.4mm |
| 889 | circle "pt" radius 72pt |
| 890 | circle "px" radius 96px |
| 891 | circle "pc" radius 6pc |
| 892 | |
| 893 | circle "in" radius 0.5*1in with .n at s of 1st circle |
| 894 | circle "cm" radius 0.5*2.54cm |
| 895 | circle "mm" radius 25.4mm * 0.5 |
| 896 | circle "pt" radius 72pt * 0.5 |
| 897 | circle "px" radius 96px * 0.5 |
| 898 | circle "pc" radius 6pc * 0.5 |
| 899 | `}, |
| 900 | {name: "test15", code:`ellipse "document" |
| 901 | arrow |
| 902 | box "PIC" |
| 903 | arrow |
| 904 | box "TBL/EQN" "(optional)" dashed |
| 905 | arrow |
| 906 | box "TROFF" |
| 907 | arrow |
| 908 | ellipse "typesetter" |
| 909 | `}, |
| 910 | {name: "test16", code:`box "this is" "a box" |
| 911 | `}, |
| 912 | {name: "test17", code:`line "this is" "a line" |
| 913 | `}, |
| 914 | {name: "test18", code:`box width 3 height 0.1; circle radius 0.1 |
| 915 | `}, |
| 916 | {name: "test19", code:`line up right; line down; line down left; line up |
| 917 | `}, |
| 918 | {name: "test20", code:`box dotted; line dotted; move; line dashed; box dashed |
| 919 | `}, |
| 920 | {name: "test21", code:`line right 5 dashed; move left 5 down .25; right |
| 921 | line right 5 dashed 0.25; move left 5 down .25; right |
| 922 | line right 5 dashed 0.5; move left 5 down .25; right |
| 923 | line right 5 dashed 1; |
| 924 | `}, |
| 925 | {name: "test22", code:`box invisible "input"; arrow; box invisible "output" |
| 926 | `}, |
| 927 | {name: "test23b", code:`margin = 24pt; |
| 928 | linewid *= 1.75 |
| 929 | charht = 0.14 |
| 930 | //thickness *= 8 |
| 931 | print charht, thickness |
| 932 | arrow "on top of"; move |
| 933 | arrow "above" "below"; move |
| 934 | arrow "above" above; move |
| 935 | arrow "below" below; move |
| 936 | arrow "above" "on top of" "below" |
| 937 | |
| 938 | move to start of first arrow down 1in; |
| 939 | right |
| 940 | arrow "way a||bove" "ab||ove" "on t||he line" "below" "way below" |
| 941 | move; arrow "way above" "above" "below" "way below" |
| 942 | move; arrow "way above" above "above" above |
| 943 | move; arrow "below" below "way below" below |
| 944 | move; arrow "above-1" above "above-2" above "floating" |
| 945 | |
| 946 | move to start of first arrow down 2in; |
| 947 | right |
| 948 | arrow "above-1" above "above-2" above "below" below |
| 949 | move; arrow "below-1" below "below-2" below "floating" |
| 950 | move; arrow "below-1" below "below-2" below "above" above |
| 951 | |
| 952 | move to start of first arrow down 3in; |
| 953 | right |
| 954 | box "first line" "second line" "third line" "fourth line" "fifth line" fit |
| 955 | move |
| 956 | box "first line" "second line" "third line" "fourth line" fit |
| 957 | move |
| 958 | box "first line" "second line" "third line" fit |
| 959 | move |
| 960 | box "first line" "second line" fit |
| 961 | move |
| 962 | box "first line" fit |
| 963 | |
| 964 | move to start of first arrow down 4in; |
| 965 | right |
| 966 | box "first above" above "second above" above "third" fit |
| 967 | dot color red at last box |
| 968 | `}, |
| 969 | {name: "test23c", code:`linewid *= 2 |
| 970 | arrow "Big" big "Small" small thin |
| 971 | box invis "thin" "line" fit |
| 972 | move |
| 973 | arrow "Big Big" big big "Small Small" small small thick |
| 974 | box invis "thick" "line" fit |
| 975 | box thick "Thick" with .nw at .5 below start of 1st arrow |
| 976 | move |
| 977 | box thick thick "Thick" "Thick" |
| 978 | move |
| 979 | box thin "Thin" |
| 980 | move |
| 981 | box thin thin "Thin" "Thin" |
| 982 | `}, |
| 983 | {name: "test23", code:`margin = 24pt; |
| 984 | linewid *= 1.75 |
| 985 | arrow "on top of"; move |
| 986 | arrow "above" "below"; move |
| 987 | arrow "above" above; move |
| 988 | arrow "below" below; move |
| 989 | arrow "above" "on top of" "below" |
| 990 | |
| 991 | move to start of first arrow down 1in; |
| 992 | right |
| 993 | arrow "way above" "above" "on the line" "below" "way below" |
| 994 | move; arrow "way above" "above" "below" "way below" |
| 995 | |
| 996 | move to start of first arrow down 2in; |
| 997 | right |
| 998 | box "first line" "second line" "third line" "fourth line" "fifth line" fit |
| 999 | move |
| 1000 | box "first line" "second line" "third line" "fourth line" fit |
| 1001 | move |
| 1002 | box "first line" "second line" "third line" fit |
| 1003 | move |
| 1004 | box "first line" "second line" fit |
| 1005 | move |
| 1006 | box "first line" fit |
| 1007 | |
| 1008 | move to start of first arrow down 3in; |
| 1009 | right |
| 1010 | box "first above" above "second above" above "third" fit |
| 1011 | dot color red at last box |
| 1012 | `}, |
| 1013 | {name: "test24", code:`arrow left; box; arrow; circle; arrow |
| 1014 | `}, |
| 1015 | {name: "test25", code:`arrow; circle; down; arrow |
| 1016 | `}, |
| 1017 | {name: "test26", code:`line from 0,0 right 1 then up 1 then right 1 then down 1.5 \ |
| 1018 | then left 0.6 dashed; |
| 1019 | spline from 0,0 right 1 then up 1 then right 1 then down 1.5 \ |
| 1020 | then left 0.6 |
| 1021 | `}, |
| 1022 | {name: "test27", code:`line dotted right 1 then down 0.5 left 1 then right 1 |
| 1023 | spline from start of first line color red \ |
| 1024 | right 1 then down 0.5 left 1 then right 1 <-> |
| 1025 | spline from start of first line color blue radius 0.2 \ |
| 1026 | right 1 then down 0.5 left 1 then right 1 <-> |
| 1027 | |
| 1028 | move down 1 from start of first line |
| 1029 | line radius 0.3 \ |
| 1030 | right 1 then down 0.5 left 1 then right 1 <-> |
| 1031 | `}, |
| 1032 | {name: "test28", code:`box "Box" |
| 1033 | arrow |
| 1034 | cylinder "One" |
| 1035 | down |
| 1036 | arrow |
| 1037 | ellipse "Ellipse" |
| 1038 | up |
| 1039 | arrow from One.n |
| 1040 | circle "Circle" |
| 1041 | right |
| 1042 | arrow from One.e <- |
| 1043 | circle "E" radius 50% |
| 1044 | circle "NE" radius 50% at 0.5 ne of One.ne |
| 1045 | arrow from NE.sw to One.ne |
| 1046 | circle "SE" radius 50% at 0.5 se of One.se |
| 1047 | arrow from SE.nw to One.se |
| 1048 | |
| 1049 | spline from One.sw left 0.2 down 0.2 then to Box.se -> |
| 1050 | spline from Circle.w left 0.3 then left 0.2 down 0.2 then to One.nw -> |
| 1051 | `}, |
| 1052 | {name: "test29", code:`# Demonstrate the ability to close and fill a line with the "fill" |
| 1053 | # attribute - treating it as a polygon. |
| 1054 | # |
| 1055 | line right 1 then down 0.25 then up .5 right 0.5 \ |
| 1056 | then up .5 left 0.5 then down 0.25 then left 1 close fill blue |
| 1057 | move |
| 1058 | box "Box to right" "of the" "polygon" |
| 1059 | move |
| 1060 | line "not a" "polygon" right 1in fill red |
| 1061 | move to w of 1st line then down 3cm |
| 1062 | line same as 1st line |
| 1063 | `}, |
| 1064 | {name: "test30", code:`debug = 1 |
| 1065 | down; box ht 0.2 wid 1.5; move down 0.15; box same; move same; box same |
| 1066 | `}, |
| 1067 | {name: "test31", code:`leftmargin = 1cm |
| 1068 | box "1" |
| 1069 | [ box "2"; arrow "3" above; box "4" ] with .n at last box.s - (0,0.1) |
| 1070 | "Thing 2: "rjust at last [].w |
| 1071 | |
| 1072 | dot at last box.s color red |
| 1073 | dot at last [].n color blue |
| 1074 | `}, |
| 1075 | {name: "test32", code:`spline right then up then left then down -> |
| 1076 | move right 2cm |
| 1077 | spline right then up left then down -> |
| 1078 | move right 2cm |
| 1079 | dot; dot; dot; |
| 1080 | |
| 1081 | dot rad 150% color red at 1st vertex of 1st spline |
| 1082 | dot same color orange at 2nd vertex of 1st spline |
| 1083 | dot same color green at 3rd vertex of 1st spline |
| 1084 | dot same color blue at 4th vertex of 1st spline |
| 1085 | |
| 1086 | dot same color red at 1st vertex of 2nd spline |
| 1087 | dot same color green at 2nd vertex of 2nd spline |
| 1088 | dot same color blue at 3rd vertex of 2nd spline |
| 1089 | |
| 1090 | print 2nd vertex of 1st spline.x, 2nd vertex of 1st spline.y |
| 1091 | `}, |
| 1092 | {name: "test33", code:`margin = 1cm |
| 1093 | "+" at 0,0 |
| 1094 | arc -> from 0.5,0 to 0,0.5 |
| 1095 | arc -> cw from 0,0 to 1,0.5 |
| 1096 | `}, |
| 1097 | {name: "test34", code:`line; arc; arc cw; arrow |
| 1098 | `}, |
| 1099 | {name: "test35", code:`A: ellipse |
| 1100 | ellipse ht .2 wid .3 with .se at 1st ellipse.nw |
| 1101 | ellipse ht .2 wid .3 with .sw at 1st ellipse.ne |
| 1102 | circle rad .05 at 0.5 between A.nw and A.c |
| 1103 | circle rad .05 at 0.5 between A.ne and A.c |
| 1104 | arc from 0.25 between A.w and A.e to 0.75 between A.w and A.e |
| 1105 | |
| 1106 | // dot color red at A.nw |
| 1107 | // dot color orange at A.c |
| 1108 | // dot color purple at A.ne |
| 1109 | `}, |
| 1110 | {name: "test36", code:`h = .5; dh = .02; dw = .1 |
| 1111 | [ |
| 1112 | Ptr: [ |
| 1113 | boxht = h; boxwid = dw |
| 1114 | A: box |
| 1115 | B: box |
| 1116 | C: box |
| 1117 | box wid 2*boxwid "..." |
| 1118 | D: box |
| 1119 | ] |
| 1120 | Block: [ |
| 1121 | boxht = 2*dw; |
| 1122 | boxwid = 2*dw |
| 1123 | movewid = 2*dh |
| 1124 | A: box; move |
| 1125 | B: box; move |
| 1126 | C: box; move |
| 1127 | box invis "..." wid 2*boxwid; move |
| 1128 | D: box |
| 1129 | ] with .n at Ptr.s - (0,h/2) |
| 1130 | arrow from Ptr.A to Block.A.nw + (dh,0) |
| 1131 | arrow from Ptr.B to Block.B.nw + (dh,0) |
| 1132 | arrow from Ptr.C to Block.C.nw + (dh,0) |
| 1133 | arrow from Ptr.D to Block.D.nw + (dh,0) |
| 1134 | ] |
| 1135 | box dashed ht last [].ht+dw wid last [].wid+dw at last [] |
| 1136 | `}, |
| 1137 | {name: "test37", code:`# Change from the original: |
| 1138 | # * Expand the macro by hand, as Pikchr does not support |
| 1139 | # macros |
| 1140 | # Need fixing: |
| 1141 | # * "bottom of last box" |
| 1142 | # * ".t" |
| 1143 | # |
| 1144 | #define ndblock { |
| 1145 | # box wid boxwid/2 ht boxht/2 |
| 1146 | # down; box same with .t at bottom of last box; box same |
| 1147 | #} |
| 1148 | boxht = .2; boxwid = .3; circlerad = .3; dx = 0.05 |
| 1149 | down; box; box; box; box ht 3*boxht "." "." "." |
| 1150 | L: box; box; box invis wid 2*boxwid "hashtab:" with .e at 1st box .w |
| 1151 | right |
| 1152 | Start: box wid .5 with .sw at 1st box.ne + (.4,.2) "..." |
| 1153 | N1: box wid .2 "n1"; D1: box wid .3 "d1" |
| 1154 | N3: box wid .4 "n3"; D3: box wid .3 "d3" |
| 1155 | box wid .4 "..." |
| 1156 | N2: box wid .5 "n2"; D2: box wid .2 "d2" |
| 1157 | arrow right from 2nd box |
| 1158 | #ndblock |
| 1159 | box wid boxwid/2 ht boxht/2 |
| 1160 | down; box same with .t at bottom of last box; box same |
| 1161 | spline -> right .2 from 3rd last box then to N1.sw + (dx,0) |
| 1162 | spline -> right .3 from 2nd last box then to D1.sw + (dx,0) |
| 1163 | arrow right from last box |
| 1164 | #ndblock |
| 1165 | box wid boxwid/2 ht boxht/2 |
| 1166 | down; box same with .t at bottom of last box; box same |
| 1167 | spline -> right .2 from 3rd last box to N2.sw-(dx,.2) to N2.sw+(dx,0) |
| 1168 | spline -> right .3 from 2nd last box to D2.sw-(dx,.2) to D2.sw+(dx,0) |
| 1169 | arrow right 2*linewid from L |
| 1170 | #ndblock |
| 1171 | box wid boxwid/2 ht boxht/2 |
| 1172 | down; box same with .t at bottom of last box; box same |
| 1173 | spline -> right .2 from 3rd last box to N3.sw + (dx,0) |
| 1174 | spline -> right .3 from 2nd last box to D3.sw + (dx,0) |
| 1175 | circlerad = .3 |
| 1176 | circle invis "ndblock" at last box.e + (1.2,.2) |
| 1177 | arrow dashed from last circle.w to last box chop 0 chop .3 |
| 1178 | box invis wid 2*boxwid "ndtable:" with .e at Start.w |
| 1179 | `}, |
| 1180 | {name: "test38b", code:`# Need fixing: |
| 1181 | # |
| 1182 | # * ".bot" as an abbreviation for ".bottom" |
| 1183 | # * "up from top of LA" |
| 1184 | # |
| 1185 | arrow "source" "code" |
| 1186 | LA: box "lexical" "analyzer" |
| 1187 | arrow "tokens" above |
| 1188 | P: box "parser" |
| 1189 | arrow "intermediate" "code" wid 180% |
| 1190 | Sem: box "semantic" "checker" |
| 1191 | arrow |
| 1192 | arrow <-> up from top of LA |
| 1193 | LC: box "lexical" "corrector" |
| 1194 | arrow <-> up from top of P |
| 1195 | Syn: box "syntactic" "corrector" |
| 1196 | arrow up |
| 1197 | DMP: box "diagnostic" "message" "printer" |
| 1198 | arrow <-> right from east of DMP |
| 1199 | ST: box "symbol" "table" |
| 1200 | arrow from LC.ne to DMP.sw |
| 1201 | arrow from Sem.nw to DMP.se |
| 1202 | arrow <-> from Sem.top to ST.bot |
| 1203 | `}, |
| 1204 | {name: "test38", code:`# Need fixing: |
| 1205 | # |
| 1206 | # * ".bot" as an abbreviation for ".bottom" |
| 1207 | # * "up from top of LA" |
| 1208 | # |
| 1209 | arrow "source" "code" |
| 1210 | LA: box "lexical" "analyzer" |
| 1211 | arrow "tokens" above |
| 1212 | P: box "parser" |
| 1213 | arrow "intermediate" "code" |
| 1214 | Sem: box "semantic" "checker" |
| 1215 | arrow |
| 1216 | arrow <-> up from top of LA |
| 1217 | LC: box "lexical" "corrector" |
| 1218 | arrow <-> up from top of P |
| 1219 | Syn: box "syntactic" "corrector" |
| 1220 | arrow up |
| 1221 | DMP: box "diagnostic" "message" "printer" |
| 1222 | arrow <-> right from east of DMP |
| 1223 | ST: box "symbol" "table" |
| 1224 | arrow from LC.ne to DMP.sw |
| 1225 | arrow from Sem.nw to DMP.se |
| 1226 | arrow <-> from Sem.top to ST.bot |
| 1227 | `}, |
| 1228 | {name: "test39b", code:`textwid = 1mm |
| 1229 | circle "DISK" |
| 1230 | arrow "character" "defns" right 150% |
| 1231 | CPU: box "CPU" "(16-bit mini)" |
| 1232 | arrow <- from top of CPU up "input " rjust |
| 1233 | arrow right from right of CPU |
| 1234 | CRT: " CRT" ljust |
| 1235 | line from CRT - 0,0.075 up 0.15 \ |
| 1236 | then right 0.5 \ |
| 1237 | then right 0.5 up 0.25 \ |
| 1238 | then down 0.5+0.15 \ |
| 1239 | then left 0.5 up 0.25 \ |
| 1240 | then left 0.5 |
| 1241 | Paper: CRT + 1.05,0.75 |
| 1242 | arrow <- from Paper down 1.5 |
| 1243 | " ... paper" ljust at end of last arrow + 0, 0.25 |
| 1244 | circle rad 0.05 at Paper + (-0.055, -0.25) |
| 1245 | circle rad 0.05 at Paper + (0.055, -0.25) |
| 1246 | box invis wid 120% " rollers" ljust at Paper + (0.1, -0.25) |
| 1247 | `}, |
| 1248 | {name: "test39", code:` margin = 5mm |
| 1249 | # ^^^^^^^^^^^^-- extra margin required for text |
| 1250 | circle "DISK" |
| 1251 | arrow "character" "defns" right 150% |
| 1252 | # ^^^^^^^^^^---- added for spacing |
| 1253 | CPU: box "CPU" "(16-bit mini)" |
| 1254 | /*{*/ arrow <- from top of CPU up "input " rjust /*}*/ |
| 1255 | # ^^^^^--- removed remove -----^^^^^ |
| 1256 | arrow right from CPU.e |
| 1257 | # ^^^^^^^^^^^^^^^^--- added to compensate for missing {...} above |
| 1258 | CRT: " CRT" ljust wid 1px |
| 1259 | # ^^^^^^^--- added to avoid excess spacing |
| 1260 | line from CRT - 0,0.075 up 0.15 \ |
| 1261 | then right 0.5 \ |
| 1262 | then right 0.5 up 0.25 \ |
| 1263 | then down 0.5+0.15 \ |
| 1264 | then left 0.5 up 0.25 \ |
| 1265 | then left 0.5 |
| 1266 | Paper: CRT + 1.05,0.75 |
| 1267 | arrow <- from Paper down 1.5 |
| 1268 | " ... paper" ljust at end of last arrow + 0, 0.25 |
| 1269 | circle rad 0.05 at Paper + (-0.055, -0.25) |
| 1270 | circle rad 0.05 at Paper + (0.055, -0.25) |
| 1271 | " rollers" ljust at Paper + (0.1, -0.25) |
| 1272 | `}, |
| 1273 | {name: "test40", code:`$one = 1.0 |
| 1274 | $one += 2.0 |
| 1275 | $two = $one |
| 1276 | $two *= 3.0 |
| 1277 | print $one, $two |
| 1278 | $three -= 11 |
| 1279 | $three /= 2 |
| 1280 | print $three |
| 1281 | `}, |
| 1282 | {name: "test41", code:`# Corner test |
| 1283 | |
| 1284 | box "C" |
| 1285 | |
| 1286 | $d = 1in |
| 1287 | circle rad 50% "N" at $d n of C; arrow from last circle to C.n chop |
| 1288 | circle same "NE" at $d ne of C; arrow from last circle to C.ne chop |
| 1289 | circle same "E" at $d e of C; arrow from last circle to C.e chop |
| 1290 | circle same "SE" at $d se of C; arrow from last circle to C.se chop |
| 1291 | circle same "S" at $d s of C; arrow from last circle to C.s chop |
| 1292 | circle same "SW" at $d sw of C; arrow from last circle to C.sw chop |
| 1293 | circle same "W" at $d w of C; arrow from last circle to C.w chop |
| 1294 | circle same "NW" at $d nw of C; arrow from last circle to C.nw chop |
| 1295 | |
| 1296 | box "C" at 3*$d east of C radius 15px |
| 1297 | |
| 1298 | circle rad 50% "N" at $d n of C; arrow from last circle to C.n chop |
| 1299 | circle same "NE" at $d ne of C; arrow from last circle to C.ne chop |
| 1300 | circle same "E" at $d e of C; arrow from last circle to C.e chop |
| 1301 | circle same "SE" at $d se of C; arrow from last circle to C.se chop |
| 1302 | circle same "S" at $d s of C; arrow from last circle to C.s chop |
| 1303 | circle same "SW" at $d sw of C; arrow from last circle to C.sw chop |
| 1304 | circle same "W" at $d w of C; arrow from last circle to C.w chop |
| 1305 | circle same "NW" at $d nw of C; arrow from last circle to C.nw chop |
| 1306 | |
| 1307 | ellipse "C" at 2.5*$d south of 1st box |
| 1308 | |
| 1309 | circle rad 50% "N" at $d n of C; arrow from last circle to C.n chop |
| 1310 | circle same "NE" at $d ne of C; arrow from last circle to C.ne chop |
| 1311 | circle same "E" at $d e of C; arrow from last circle to C.e chop |
| 1312 | circle same "SE" at $d se of C; arrow from last circle to C.se chop |
| 1313 | circle same "S" at $d s of C; arrow from last circle to C.s chop |
| 1314 | circle same "SW" at $d sw of C; arrow from last circle to C.sw chop |
| 1315 | circle same "W" at $d w of C; arrow from last circle to C.w chop |
| 1316 | circle same "NW" at $d nw of C; arrow from last circle to C.nw chop |
| 1317 | |
| 1318 | circle "C" at 3*$d east of last ellipse |
| 1319 | |
| 1320 | circle rad 50% "N" at $d n of C; arrow from last circle to C.n chop |
| 1321 | circle same "NE" at $d ne of C; arrow from last circle to C.ne chop |
| 1322 | circle same "E" at $d e of C; arrow from last circle to C.e chop |
| 1323 | circle same "SE" at $d se of C; arrow from last circle to C.se chop |
| 1324 | circle same "S" at $d s of C; arrow from last circle to C.s chop |
| 1325 | circle same "SW" at $d sw of C; arrow from last circle to C.sw chop |
| 1326 | circle same "W" at $d w of C; arrow from last circle to C.w chop |
| 1327 | circle same "NW" at $d nw of C; arrow from last circle to C.nw chop |
| 1328 | |
| 1329 | cylinder "C" at 2.5*$d south of last ellipse |
| 1330 | circle rad 50% "N" at $d n of C; arrow from last circle to C.n chop |
| 1331 | circle same "NE" at $d ne of C; arrow from last circle to C.ne chop |
| 1332 | circle same "E" at $d e of C; arrow from last circle to C.e chop |
| 1333 | circle same "SE" at $d se of C; arrow from last circle to C.se chop |
| 1334 | circle same "S" at $d s of C; arrow from last circle to C.s chop |
| 1335 | circle same "SW" at $d sw of C; arrow from last circle to C.sw chop |
| 1336 | circle same "W" at $d w of C; arrow from last circle to C.w chop |
| 1337 | circle same "NW" at $d nw of C; arrow from last circle to C.nw chop |
| 1338 | |
| 1339 | oval "C" at 3*$d east of last cylinder |
| 1340 | circle rad 50% "N" at $d n of C; arrow from last circle to C.n chop |
| 1341 | circle same "NE" at $d ne of C; arrow from last circle to C.ne chop |
| 1342 | circle same "E" at $d e of C; arrow from last circle to C.e chop |
| 1343 | circle same "SE" at $d se of C; arrow from last circle to C.se chop |
| 1344 | circle same "S" at $d s of C; arrow from last circle to C.s chop |
| 1345 | circle same "SW" at $d sw of C; arrow from last circle to C.sw chop |
| 1346 | circle same "W" at $d w of C; arrow from last circle to C.w chop |
| 1347 | circle same "NW" at $d nw of C; arrow from last circle to C.nw chop |
| 1348 | `}, |
| 1349 | {name: "test42", code:`C: ellipse "ellipse" |
| 1350 | |
| 1351 | line from C to 2cm heading 00 from C chop; |
| 1352 | line from C to 2cm heading 10 from C chop; |
| 1353 | line from C to 2cm heading 20 from C chop; |
| 1354 | line from C to 2cm heading 30 from C chop; |
| 1355 | line from C to 2cm heading 40 from C chop; |
| 1356 | line from C to 2cm heading 50 from C chop; |
| 1357 | line from C to 2cm heading 60 from C chop; |
| 1358 | line from C to 2cm heading 70 from C chop; |
| 1359 | line from C to 2cm heading 80 from C chop; |
| 1360 | line from C to 2cm heading 90 from C chop; |
| 1361 | line from C to 2cm heading 100 from C chop; |
| 1362 | line from C to 2cm heading 110 from C chop; |
| 1363 | line from C to 2cm heading 120 from C chop; |
| 1364 | line from C to 2cm heading 130 from C chop; |
| 1365 | line from C to 2cm heading 140 from C chop; |
| 1366 | line from C to 2cm heading 150 from C chop; |
| 1367 | line from C to 2cm heading 160 from C chop; |
| 1368 | line from C to 2cm heading 170 from C chop; |
| 1369 | line from C to 2cm heading 180 from C chop; |
| 1370 | line from C to 2cm heading 190 from C chop; |
| 1371 | line from C to 2cm heading 200 from C chop; |
| 1372 | line from C to 2cm heading 210 from C chop; |
| 1373 | line from C to 2cm heading 220 from C chop; |
| 1374 | line from C to 2cm heading 230 from C chop; |
| 1375 | line from C to 2cm heading 240 from C chop; |
| 1376 | line from C to 2cm heading 250 from C chop; |
| 1377 | line from C to 2cm heading 260 from C chop; |
| 1378 | line from C to 2cm heading 270 from C chop; |
| 1379 | line from C to 2cm heading 280 from C chop; |
| 1380 | line from C to 2cm heading 290 from C chop; |
| 1381 | line from C to 2cm heading 300 from C chop; |
| 1382 | line from C to 2cm heading 310 from C chop; |
| 1383 | line from C to 2cm heading 320 from C chop; |
| 1384 | line from C to 2cm heading 330 from C chop; |
| 1385 | line from C to 2cm heading 340 from C chop; |
| 1386 | line from C to 2cm heading 350 from C chop; |
| 1387 | `}, |
| 1388 | {name: "test43", code:`scale = 0.75 |
| 1389 | box "One" |
| 1390 | arrow right 200% "Bold" bold above "Italic" italic below |
| 1391 | circle "Two" |
| 1392 | circle "Bold-Italic" bold italic aligned fit \ |
| 1393 | at 4cm heading 143 from Two |
| 1394 | arrow from Two to last circle "above" aligned above "below" aligned below chop |
| 1395 | circle "C2" fit at 4cm heading 50 from Two |
| 1396 | arrow from Two to last circle "above" aligned above "below "aligned below chop |
| 1397 | circle "C3" fit at 4cm heading 200 from Two |
| 1398 | arrow from last circle to Two <- \ |
| 1399 | "above-rjust" aligned rjust above \ |
| 1400 | "below-rjust" aligned rjust below chop |
| 1401 | `}, |
| 1402 | {name: "test44", code:`debug=1 |
| 1403 | file "*.md" rad 20% |
| 1404 | arrow |
| 1405 | box rad 10px "Markdown" "Interpreter" |
| 1406 | arrow right 120% "HTML" above |
| 1407 | file " HTML " |
| 1408 | `} |
| 1409 | |
| 1410 | ]; |
| 1411 | |
| 1412 | })(window.fossil); |
| 1413 |
| --- src/fossil.page.pikchrshow.js | |
| +++ src/fossil.page.pikchrshow.js | |
| @@ -108,19 +108,24 @@ | |
| 108 | })*/; |
| 109 | D.append(P.e.uiControls, cbWrap); |
| 110 | P.predefinedPiks.forEach(function(script,ndx){ |
| 111 | const opt = D.option(script.code ? script.code.trim() :'', script.name); |
| 112 | D.append(selectScript, opt); |
| 113 | opt.$_sampleScript = script /* for response caching purposes */; |
| 114 | if(!ndx) selectScript.selectedIndex = 0 /*timing/ordering workaround*/; |
| 115 | if(!script.code) D.disable(opt); |
| 116 | }); |
| 117 | delete P.predefinedPiks; |
| 118 | selectScript.addEventListener('change', function(ev){ |
| 119 | const val = ev.target.value; |
| 120 | if(!val) return; |
| 121 | const opt = ev.target.selectedOptions[0]; |
| 122 | P.e.taContent.value = val; |
| 123 | if(cbAutoPreview.checked){ |
| 124 | P.preview.$_sampleScript = opt.$_sampleScript; |
| 125 | P.preview(); |
| 126 | } |
| 127 | }, false); |
| 128 | } |
| 129 | |
| 130 | //////////////////////////////////////////////////////////// |
| 131 | // Move dark mode checkbox to the end and add a help buttonlet |
| @@ -263,10 +268,16 @@ | |
| 268 | D.disable(fp.toDisable, this.e.previewModeToggle, this.e.markupAlignCenter); |
| 269 | D.addClass(this.e.previewCopyButton, 'disabled'); |
| 270 | const content = this.e.taContent.value.trim(); |
| 271 | this.response.raw = undefined; |
| 272 | this.response.inputText = content; |
| 273 | const sampleScript = fp.$_sampleScript; |
| 274 | delete fp.$_sampleScript; |
| 275 | if(sampleScript && sampleScript.cached){ |
| 276 | fp.updateView(sampleScript.cached, false); |
| 277 | return this; |
| 278 | } |
| 279 | if(!content){ |
| 280 | fp.updateView("No pikchr content!",true); |
| 281 | return this; |
| 282 | } |
| 283 | const self = this; |
| @@ -276,12 +287,16 @@ | |
| 287 | F.message( |
| 288 | "Fetching preview..." |
| 289 | ).fetch('pikchrshow',{ |
| 290 | payload: fd, |
| 291 | responseHeaders: 'x-pikchrshow-is-error', |
| 292 | onload: (r,isErrHeader)=>{ |
| 293 | const isErr = +isErrHeader ? true : false; |
| 294 | if(!isErr && sampleScript){ |
| 295 | sampleScript.cached = r; |
| 296 | } |
| 297 | fp.updateView(r,isErr); |
| 298 | F.message('Updated preview.'); |
| 299 | }, |
| 300 | onerror: (e)=>{ |
| 301 | F.fetch.onerror(e); |
| 302 | fp.updateView("Error fetching preview: "+e, true); |
| @@ -301,288 +316,84 @@ | |
| 316 | SELECT element (a disabled OPTION). |
| 317 | |
| 318 | } |
| 319 | */ |
| 320 | P.predefinedPiks = [ |
| 321 | {name: "-- Example Scripts --"}, |
| 322 | /* |
| 323 | The following were imported from the pikchr test scripts: |
| 324 | |
| 325 | https://fossil-scm.org/pikchr/dir/tests |
| 326 | */ |
| 327 | |
| 328 | {name: "headings01", code:` linerad = 5px |
| 329 | C: circle "Center" rad 150% |
| 330 | circle "N" at 1.0 n of C; arrow from C to last chop -> |
| 331 | circle "NE" at 1.0 ne of C; arrow from C to last chop <- |
| 332 | circle "E" at 1.0 e of C; arrow from C to last chop <-> |
| 333 | circle "SE" at 1.0 se of C; arrow from C to last chop -> |
| 334 | circle "S" at 1.0 s of C; arrow from C to last chop <- |
| 335 | circle "SW" at 1.0 sw of C; arrow from C to last chop <-> |
| 336 | circle "W" at 1.0 w of C; arrow from C to last chop -> |
| 337 | circle "NW" at 1.0 nw of C; arrow from C to last chop <- |
| 338 | arrow from 2nd circle to 3rd circle chop |
| 339 | arrow from 4th circle to 3rd circle chop |
| 340 | arrow from SW to S chop <-> |
| 341 | circle "ESE" at 2.0 heading 112.5 from Center \ |
| 342 | thickness 150% fill lightblue radius 75% |
| 343 | arrow from Center to ESE thickness 150% <-> chop |
| 344 | arrow from ESE up 1.35 then to NE chop |
| 345 | line dashed <- from E.e to (ESE.x,E.y) |
| 346 | line dotted <-> thickness 50% from N to NW chop |
| 347 | `}, |
| 348 | {name: "objects", code:`AllObjects: [ |
| 349 | |
| 350 | # First row of objects |
| 351 | box "box" |
| 352 | box rad 10px "box (with" "rounded" "corners)" at 1in right of previous |
| 353 | circle "circle" at 1in right of previous |
| 354 | ellipse "ellipse" at 1in right of previous |
| 355 | |
| 356 | # second row of objects |
| 357 | oval "oval" at 1in below first box |
| 358 | oval "(tall &" "thin)" "oval" wid ovalht ht ovalwid at 1in right of previous |
| 359 | cylinder "cylinder" at 1in right of previous |
| 360 | file "file" at 1in right of previous |
| 361 | |
| 362 | # third row shows line-type objects |
| 363 | dot "dot" above at 1in below first oval |
| 364 | line right from 1.8cm right of previous "lines" above |
| 365 | arrow right from 1.8cm right of previous "arrows" above |
| 366 | spline from 2cm right of previous \ |
| 367 | right .15 up .25 then right .3 down .5 then up .25 right .15 \ |
| 368 | "splines" above ljust |
| 369 | |
| 370 | # Draw various lines below the first line |
| 371 | line dashed right from 0.3cm below start of previous line |
| 372 | line dotted right from 0.3cm below start of previous |
| 373 | line thin right from 0.3cm below start of previous |
| 374 | line thick right from 0.3cm below start of previous |
| 375 | |
| 376 | |
| 377 | # Draw arrows with different arrowhead configurations below |
| 378 | # the first arrow |
| 379 | arrow <- right from 0.4cm below start of previous arrow |
| 380 | arrow <-> right from 0.4cm below start of previous |
| 381 | |
| 382 | # Draw splines with different arrowhead configurations below |
| 383 | # the first spline |
| 384 | spline -> from .4cm below start of first spline \ |
| 385 | right .15 up .25 then right .3 down .5 then up .25 right .15 |
| 386 | spline <- from .4cm below start of previous spline \ |
| 387 | right .15 up .25 then right .3 down .5 then up .25 right .15 |
| 388 | spline <-> from .4cm below start of previous spline \ |
| 389 | right .15 up .25 then right .3 down .5 then up .25 right .15 |
| 390 | |
| 391 | ] # end of All Objects |
| 392 | |
| 393 | # Label the whole diagram |
| 394 | text "Examples Of Pikchr Objects" big bold at .8cm above north of AllObjects |
| 395 | `}, |
| 396 | {name: "swimlane", code:` $laneh = 0.75 |
| 397 | |
| 398 | # Draw the lanes |
| 399 | down |
| @@ -625,13 +436,13 @@ | |
| 436 | C1: circle same as A1 at B1-(0,$laneh) "1" |
| 437 | arrow 50% |
| 438 | circle same "2" |
| 439 | arrow right 0.8in "goes" "offline" |
| 440 | C5: circle same as A3 "5" |
| 441 | arrow right until even with first ellipse.w \ |
| 442 | "back online" above "pushes 5" below "pulls 3 & 4" below |
| 443 | ellipse same "future" |
| 444 | |
| 445 | # content for the Darlene lane |
| 446 | D1: circle same as A1 at C1-(0,$laneh) "1" |
| 447 | arrow 50% |
| 448 | circle same "2" |
| @@ -643,770 +454,10 @@ | |
| 454 | ellipse same "future" |
| 455 | D3: circle same as B3 at B3-(0,2*$laneh) "3" |
| 456 | arrow 50% |
| 457 | circle same "4" |
| 458 | arrow from D1 to D3 chop |
| 459 | `} |
| 460 | |
| 461 | ]; |
| 462 | |
| 463 | })(window.fossil); |
| 464 |