| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
if (typeof abc2svg == "undefined") |
| 26 |
var abc2svg = {} |
| 27 |
|
| 28 |
abc2svg.pedline = { |
| 29 |
draw_all_deco: function(of) { |
| 30 |
var de, i, x, dp, ds, |
| 31 |
a_de = this.a_de() |
| 32 |
|
| 33 |
if (!a_de.length) |
| 34 |
return |
| 35 |
if (this.cfmt().pedline) { |
| 36 |
for (i = 0; i < a_de.length; i++) { |
| 37 |
de = a_de[i] |
| 38 |
if (de.dd.name != "ped)") |
| 39 |
continue |
| 40 |
ds = de.start |
| 41 |
dp = de.prev |
| 42 |
|
| 43 |
|
| 44 |
|
| 45 |
|
| 46 |
|
| 47 |
|
| 48 |
if (dp && dp.dd.name == "ped)" |
| 49 |
&& dp.s.v == ds.s.v) { |
| 50 |
de.defl.nost = |
| 51 |
dp.defl.noen = 2 |
| 52 |
de.x = ds.s.x - 10 |
| 53 |
de.val = de.s.x - ds.s.x - 3 |
| 54 |
dp.val = de.x - dp.x |
| 55 |
|
| 56 |
if (de.y > dp.y) |
| 57 |
de.y = dp.y |
| 58 |
dp.y = de.y |
| 59 |
} else { |
| 60 |
de.x = ds.s.x - 8 |
| 61 |
if (!de.defl.noen) |
| 62 |
de.val = de.s.x - ds.s.x - de.s.wl |
| 63 |
} |
| 64 |
} |
| 65 |
} |
| 66 |
of() |
| 67 |
}, |
| 68 |
|
| 69 |
out_lped: function(of, x, y, val, defl) { |
| 70 |
if (!this.cfmt().pedline) { |
| 71 |
of(x, y, val, defl) |
| 72 |
return |
| 73 |
} |
| 74 |
this.xypath(x, y + 8) |
| 75 |
if (defl.nost) { |
| 76 |
if (defl.nost == 2) { |
| 77 |
this.out_svg("l2.5 6") |
| 78 |
val -= 2.5 |
| 79 |
} else { |
| 80 |
this.out_svg("m0 6") |
| 81 |
} |
| 82 |
} else { |
| 83 |
this.out_svg("v6") |
| 84 |
} |
| 85 |
if (defl.noen) { |
| 86 |
if (defl.noen == 2) { |
| 87 |
val -= 2.5 |
| 88 |
this.out_svg("h" + val.toFixed(1) + 'l2.5 -6') |
| 89 |
} else { |
| 90 |
this.out_svg("h" + val.toFixed(1)) |
| 91 |
} |
| 92 |
} else { |
| 93 |
this.out_svg("h" + val.toFixed(1) + 'v-6') |
| 94 |
} |
| 95 |
this.out_svg('"/>\n') |
| 96 |
}, |
| 97 |
|
| 98 |
set_fmt: function(of, cmd, param) { |
| 99 |
if (cmd == "pedline") |
| 100 |
this.cfmt().pedline = this.get_bool(param) |
| 101 |
else |
| 102 |
of(cmd, param) |
| 103 |
}, |
| 104 |
|
| 105 |
set_hooks: function(abc) { |
| 106 |
abc.draw_all_deco = abc2svg.pedline.draw_all_deco.bind(abc, abc.draw_all_deco) |
| 107 |
abc.out_lped = abc2svg.pedline.out_lped.bind(abc, abc.out_lped) |
| 108 |
abc.set_format = abc2svg.pedline.set_fmt.bind(abc, abc.set_format) |
| 109 |
} |
| 110 |
} |
| 111 |
|
| 112 |
if (!abc2svg.mhooks) |
| 113 |
abc2svg.mhooks = {} |
| 114 |
abc2svg.mhooks.pedline = abc2svg.pedline.set_hooks |