aboutsummaryrefslogtreecommitdiff
path: root/share/library/Misc
diff options
context:
space:
mode:
Diffstat (limited to 'share/library/Misc')
-rw-r--r--share/library/Misc/signs.lua46
-rw-r--r--share/library/Misc/voltage-source.lua16
2 files changed, 50 insertions, 12 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)