diff --git a/src/main/dig/combinatorial/Xor2.dig b/src/main/dig/combinatorial/Xor2.dig
index 529db7354..5e9ce63bb 100644
--- a/src/main/dig/combinatorial/Xor2.dig
+++ b/src/main/dig/combinatorial/Xor2.dig
@@ -31,31 +31,41 @@
Y
-
+
Or
-
+
And
-
+
And
-
+
Not
-
+
+
+ wideShape
+ true
+
+
Not
-
+
+
+ wideShape
+ true
+
+
@@ -79,43 +89,43 @@
-
+
-
-
-
-
+
+
+
+
-
+
-
-
+
+
-
-
+
+
-
-
+
+
@@ -123,18 +133,18 @@
-
+
-
-
+
+
-
+
-
+
diff --git a/src/main/java/de/neemann/digital/draw/shapes/GenericShape.java b/src/main/java/de/neemann/digital/draw/shapes/GenericShape.java
index 337cc142c..ebd7bb5aa 100644
--- a/src/main/java/de/neemann/digital/draw/shapes/GenericShape.java
+++ b/src/main/java/de/neemann/digital/draw/shapes/GenericShape.java
@@ -40,9 +40,10 @@ public class GenericShape implements Shape {
private boolean invert = false;
private Color color = Color.WHITE;
- private transient Pins pins;
+ private Pins pins;
private boolean showPinLabels;
private InverterConfig inverterConfig;
+ private int topBottomBorder = SIZE2;
/**
* Creates a new generic shape.
@@ -102,6 +103,17 @@ public class GenericShape implements Shape {
return this;
}
+ /**
+ * Sets the top bottom border
+ *
+ * @param topBottomBorder the border
+ * @return this for chaind calls
+ */
+ public GenericShape setTopBottomBorder(int topBottomBorder) {
+ this.topBottomBorder = topBottomBorder;
+ return this;
+ }
+
/**
* Sets the background color
*
@@ -190,15 +202,15 @@ public class GenericShape implements Shape {
@Override
public void drawTo(Graphic graphic, Style highLight) {
int max = Math.max(inputs.size(), outputs.size());
- int height = (max - 1) * SIZE + SIZE2;
+ int yBottom = (max - 1) * SIZE + topBottomBorder;
- if (symmetric && inputs.size() > 0 && ((inputs.size() & 1) == 0)) height += SIZE;
+ if (symmetric && inputs.size() > 0 && ((inputs.size() & 1) == 0)) yBottom += SIZE;
Polygon polygon = new Polygon(true)
- .add(1, -SIZE2)
- .add(SIZE * width - 1, -SIZE2)
- .add(SIZE * width - 1, height)
- .add(1, height);
+ .add(1, -topBottomBorder)
+ .add(SIZE * width - 1, -topBottomBorder)
+ .add(SIZE * width - 1, yBottom)
+ .add(1, yBottom);
if (color != Color.WHITE && !graphic.isFlagSet(Graphic.LATEX))
graphic.drawPolygon(polygon, Style.NORMAL.deriveFillStyle(color));
@@ -213,7 +225,7 @@ public class GenericShape implements Shape {
}
if (label != null) {
- Vector pos = new Vector(SIZE2 * width, -SIZE2 - 8);
+ Vector pos = new Vector(SIZE2 * width, -topBottomBorder - 8);
graphic.drawText(pos, pos.add(1, 0), label, Orientation.CENTERBOTTOM, Style.NORMAL);
}
@@ -238,10 +250,10 @@ public class GenericShape implements Shape {
}
if (name.length() > 0) {
if (name.length() <= 3 && !showPinLabels) {
- Vector pos = new Vector(SIZE2 * width, -SIZE2 + 4);
+ Vector pos = new Vector(SIZE2 * width, -topBottomBorder + 4);
graphic.drawText(pos, pos.add(1, 0), name, Orientation.CENTERTOP, Style.NORMAL);
} else {
- Vector pos = new Vector(SIZE2 * width, height + 4);
+ Vector pos = new Vector(SIZE2 * width, yBottom + 4);
graphic.drawText(pos, pos.add(1, 0), name, Orientation.CENTERTOP, Style.SHAPE_PIN);
}
}
diff --git a/src/main/java/de/neemann/digital/draw/shapes/ShapeFactory.java b/src/main/java/de/neemann/digital/draw/shapes/ShapeFactory.java
index 7cd2be2e3..c6a7eeb8e 100644
--- a/src/main/java/de/neemann/digital/draw/shapes/ShapeFactory.java
+++ b/src/main/java/de/neemann/digital/draw/shapes/ShapeFactory.java
@@ -74,7 +74,14 @@ public final class ShapeFactory {
map.put(NOr.DESCRIPTION.getName(), new CreatorSimple("\u22651", true));
map.put(XOr.DESCRIPTION.getName(), new CreatorSimple("=1", false));
map.put(XNOr.DESCRIPTION.getName(), new CreatorSimple("=1", true));
- map.put(Not.DESCRIPTION.getName(), new CreatorSimple("", true));
+ map.put(Not.DESCRIPTION.getName(),
+ (attributes, inputs, outputs) -> {
+ final boolean ws = attributes.get(Keys.WIDE_SHAPE);
+ return new GenericShape(ws ? "1" : "", inputs, outputs)
+ .setTopBottomBorder(ws ? GenericShape.SIZE : GenericShape.SIZE2)
+ .invert(true)
+ .setWide(ws);
+ });
}