From a355ca7555401c21bca73cf761a4422da22e4368 Mon Sep 17 00:00:00 2001 From: hneemann Date: Mon, 29 May 2017 12:24:57 +0200 Subject: [PATCH] colored bus wires black --- .../java/de/neemann/digital/draw/graphics/Style.java | 11 +++++++++-- src/main/java/de/neemann/digital/gui/Main.java | 8 +++----- .../digital/gui/components/CircuitComponent.java | 6 ++++++ 3 files changed, 18 insertions(+), 7 deletions(-) diff --git a/src/main/java/de/neemann/digital/draw/graphics/Style.java b/src/main/java/de/neemann/digital/draw/graphics/Style.java index 6484083e6..beb199113 100644 --- a/src/main/java/de/neemann/digital/draw/graphics/Style.java +++ b/src/main/java/de/neemann/digital/draw/graphics/Style.java @@ -63,6 +63,12 @@ public class Style { * used to draw the output dots */ public static final Style WIRE_OUT = new Style(LINETHICK, true, Color.RED.darker()); + + /** + * used to draw the bus wires + */ + public static final Style WIRE_BUS = NORMAL; + /** * Filled style used to fill the splitter or the dark LEDs */ @@ -87,7 +93,7 @@ public class Style { /** * error color used for the circles to mark an element */ - public static final Style ERROR = new Style(WIRETHICK, false, Color.RED.darker()); + public static final Style ERROR = new Style(WIRETHICK, false, Color.RED); private final int thickness; private final boolean filled; @@ -179,7 +185,8 @@ public class Style { * @return the style */ public static Style getWireStyle(ObservableValue value) { - if (value == null || value.getBits() > 1) return WIRE; + if (value == null) return WIRE; + if (value.getBits()>1) return WIRE_BUS; if (value.isHighZ()) return WIRE_HIGHZ; if (value.getValueIgnoreBurn() == 1) return WIRE_HIGH; diff --git a/src/main/java/de/neemann/digital/gui/Main.java b/src/main/java/de/neemann/digital/gui/Main.java index 188904c35..2435af21d 100644 --- a/src/main/java/de/neemann/digital/gui/Main.java +++ b/src/main/java/de/neemann/digital/gui/Main.java @@ -905,6 +905,9 @@ public final class Main extends JFrame implements ClosingWindowListener.ConfirmS doStep.setEnabled(false); stoppedState.getAction().setEnabled(false); runToBreakAction.setEnabled(false); + // keep errors + if (circuitComponent.getHighLightStyle() != Style.ERROR) + circuitComponent.removeHighLighted(); } }); @@ -917,11 +920,6 @@ public final class Main extends JFrame implements ClosingWindowListener.ConfirmS if (createAndStartModel(false, ModelEvent.MICROSTEP, null)) circuitComponent.setManualChangeObserver(new MicroStepObserver(model)); } - - @Override - public void leave() { - circuitComponent.removeHighLighted(); - } }); } diff --git a/src/main/java/de/neemann/digital/gui/components/CircuitComponent.java b/src/main/java/de/neemann/digital/gui/components/CircuitComponent.java index 491957a3f..9c81e3952 100644 --- a/src/main/java/de/neemann/digital/gui/components/CircuitComponent.java +++ b/src/main/java/de/neemann/digital/gui/components/CircuitComponent.java @@ -571,6 +571,12 @@ public class CircuitComponent extends JComponent implements Circuit.ChangedListe this.highLightStyle = highLightStyle; } + /** + * @return the actual highlighted style + */ + public Style getHighLightStyle() { + return highLightStyle; + } /** * Adds the given element to insert to the circuit