colored bus wires black

This commit is contained in:
hneemann 2017-05-29 12:24:57 +02:00
parent 7f359f6ccc
commit a355ca7555
3 changed files with 18 additions and 7 deletions

View File

@ -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;

View File

@ -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();
}
});
}

View File

@ -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