diff options
author | Přemysl Janouch <p.janouch@gmail.com> | 2011-03-06 12:27:35 +0100 |
---|---|---|
committer | Přemysl Janouch <p.janouch@gmail.com> | 2011-03-07 17:29:26 +0100 |
commit | 01dea6fb2e904e7a830dd5a60b71502f72674a22 (patch) | |
tree | 8629f8ebcf9697f187f5ba2887c42310ba9a3dc8 /share/library | |
parent | f821e029d75326be545c6ce7ab51493d223ab360 (diff) | |
download | logdiag-01dea6fb2e904e7a830dd5a60b71502f72674a22.tar.gz logdiag-01dea6fb2e904e7a830dd5a60b71502f72674a22.tar.xz logdiag-01dea6fb2e904e7a830dd5a60b71502f72674a22.zip |
Add separate plus and minus signs.
Diffstat (limited to 'share/library')
-rw-r--r-- | share/library/Misc/signs.lua | 46 | ||||
-rw-r--r-- | share/library/Misc/voltage-source.lua | 16 | ||||
-rw-r--r-- | share/library/Passive/capacitor.lua | 28 |
3 files changed, 52 insertions, 38 deletions
diff --git a/share/library/Misc/signs.lua b/share/library/Misc/signs.lua new file mode 100644 index 0000000..2f197a1 --- /dev/null +++ b/share/library/Misc/signs.lua @@ -0,0 +1,46 @@ +-- Symbol names +local names_plus = +{ + en = "Plus sign", + cs = "Znaménko plus", + sk = "Znamienko plus" +} + +local names_minus = +{ + en = "Minus sign", + cs = "Znaménko mínus", + sk = "Znamienko mínus" +} + +-- Render area in base units (X1, Y1, X2, Y2) +local area = {-0.5, -0.5, 0.5, 0.5} + +-- Terminal points +local terminals = {} + +-- Rendering +local render_plus = function (cr) + -- The plus sign + cr.move_to (0, -0.4) + cr.line_to (0, 0.4) + + cr.move_to (-0.4, 0) + cr.line_to (0.4, 0) + + cr.stroke () +end + +local render_minus = function (cr) + -- The minus sign + cr.move_to (-0.4, 0) + cr.line_to (0.4, 0) + + cr.stroke () +end + +-- Register the symbols +logdiag.register ("SignPlus", names_plus, area, terminals, render_plus) +logdiag.register ("SignMinus", names_minus, area, terminals, render_minus) + + diff --git a/share/library/Misc/voltage-source.lua b/share/library/Misc/voltage-source.lua index bdaa9b2..4cc0e21 100644 --- a/share/library/Misc/voltage-source.lua +++ b/share/library/Misc/voltage-source.lua @@ -14,8 +14,7 @@ local names_dc = } -- Render area in base units (X1, Y1, X2, Y2) -local area_ac = {-2, -2, 2, 2} -local area_dc = {-2, -2, 3, 2} +local area = {-2, -2, 2, 2} -- Terminal points local terminals = {{-2, 0}, {2, 0}, {0, -2}, {0, 2}} @@ -51,18 +50,11 @@ local render_dc = function (cr) cr.move_to (0.2, 0.25) cr.line_to (1, 0.25) - -- Polarity sign - cr.move_to (2.6, -0.6) - cr.line_to (2.6, -1.4) - - cr.move_to (2.2, -1) - cr.line_to (3.0, -1) - cr.stroke () end --- Register the symbol -logdiag.register ("ACSource", names_ac, area_ac, terminals, render_ac) -logdiag.register ("DCSource", names_dc, area_dc, terminals, render_dc) +-- Register the symbols +logdiag.register ("ACSource", names_ac, area, terminals, render_ac) +logdiag.register ("DCSource", names_dc, area, terminals, render_dc) diff --git a/share/library/Passive/capacitor.lua b/share/library/Passive/capacitor.lua index c181737..700b377 100644 --- a/share/library/Passive/capacitor.lua +++ b/share/library/Passive/capacitor.lua @@ -6,16 +6,8 @@ local names = sk = "Kondenzátor" } -local names_polar = -{ - en = "Polarized capacitor", - cs = "Polarizovaný kondenzátor", - sk = "Polarizovaný kondenzátor" -} - -- Render area in base units (X1, Y1, X2, Y2) -local area = {-2, -1, 2, 1} -local area_polar = {-2, -1.5, 2, 1} +local area = {-2, -1, 2, 1} -- Terminal points local terminals = {{-2, 0}, {2, 0}} @@ -39,23 +31,7 @@ local render = function (cr) cr.stroke () end -local render_polar = function (cr) - render (cr) - - -- The plus sign - cr.move_to (-0.6, -1) - cr.line_to (-1.4, -1) - - cr.move_to (-1, -1.4) - cr.line_to (-1, -0.6) - - cr.stroke () -end - -- Register the symbol -logdiag.register ("Capacitor", - names, area, terminals, render) -logdiag.register ("CapacitorPolarized", - names_polar, area_polar, terminals, render_polar) +logdiag.register ("Capacitor", names, area, terminals, render) |