diff --git a/src/main/java/de/neemann/digital/draw/shapes/InputShape.java b/src/main/java/de/neemann/digital/draw/shapes/InputShape.java index 374ef53a6..9b909f409 100644 --- a/src/main/java/de/neemann/digital/draw/shapes/InputShape.java +++ b/src/main/java/de/neemann/digital/draw/shapes/InputShape.java @@ -40,6 +40,7 @@ public class InputShape implements Shape { private IOState ioState; private SingleValueDialog dialog; private Value value; + private Value inValue; private final boolean isHighZ; /** @@ -111,8 +112,11 @@ public class InputShape implements Shape { @Override public void readObservableValues() { - if (ioState != null) + if (ioState != null) { value = ioState.getOutput(0).getCopy(); + if (ioState.inputCount() == 1) + inValue = ioState.getInput(0).getCopy(); + } } @Override @@ -124,17 +128,22 @@ public class InputShape implements Shape { graphic.drawText(textPos, textPos.add(1, 0), label, Orientation.RIGHTCENTER, Style.INOUT); } else { Style style = Style.NORMAL; + final Polygon box = new Polygon(true).add(-SIZE * 2 - 1, -SIZE).add(-1, -SIZE).add(-1, SIZE).add(-SIZE * 2 - 1, SIZE); if (value != null) { style = Style.getWireStyle(value); if (value.getBits() > 1) { Vector textPos = new Vector(-1 - SIZE, -4 - SIZE); graphic.drawText(textPos, textPos.add(1, 0), format.formatToView(value), Orientation.CENTERBOTTOM, Style.NORMAL); + } else { + if (inValue != null && !inValue.isEqual(value)) + graphic.drawPolygon(box, Style.getWireStyle(inValue)); } } + graphic.drawPolygon(box, Style.NORMAL); + Vector center = new Vector(-1 - SIZE, 0); graphic.drawCircle(center.sub(RAD), center.add(RAD), style); - graphic.drawPolygon(new Polygon(true).add(-SIZE * 2 - 1, -SIZE).add(-1, -SIZE).add(-1, SIZE).add(-SIZE * 2 - 1, SIZE), Style.NORMAL); Vector textPos = new Vector(-SIZE * 3, 0); graphic.drawText(textPos, textPos.add(1, 0), label, Orientation.RIGHTCENTER, Style.INOUT);