X-Git-Url: https://mograsim.net/gitweb/?a=blobdiff_plain;f=LogicUI%2Fsrc%2Fera%2Fmi%2Fwires%2Fgui%2FGUIWire.java;h=65f82c7ee3377907af550618f8e4ddb7cf8d2a58;hb=0cfea6ef89dea8a797708ff685aa2ef9aefd85b9;hp=50c28dfb177790cd602da0e81d3f7a3365d3be38;hpb=97060d7f88d21c40bf3e4bcafaa360ece652eb2e;p=Mograsim.git diff --git a/LogicUI/src/era/mi/wires/gui/GUIWire.java b/LogicUI/src/era/mi/wires/gui/GUIWire.java index 50c28dfb..65f82c7e 100644 --- a/LogicUI/src/era/mi/wires/gui/GUIWire.java +++ b/LogicUI/src/era/mi/wires/gui/GUIWire.java @@ -2,6 +2,9 @@ package era.mi.wires.gui; import java.util.Objects; +import org.eclipse.swt.SWT; +import org.eclipse.swt.graphics.Color; + import era.mi.components.gui.BasicGUIComponent; import era.mi.logic.wires.WireArray; import net.haspamelodica.swt.helper.gcs.GeneralGC; @@ -35,6 +38,29 @@ public class GUIWire public void render(GeneralGC gc) { + Color oldFG = gc.getForeground(); + if(wa.length == 1) + { + int fgColorConstant; + switch(wa.getValue()) + { + case ONE: + fgColorConstant = SWT.COLOR_GREEN; + break; + case ZERO: + fgColorConstant = SWT.COLOR_BLUE; + break; + case U: + case X: + case Z: + fgColorConstant = SWT.COLOR_RED; + break; + default: + throw new IllegalArgumentException("Unknown enum constant: " + wa.getValue()); + } + gc.setForeground(gc.getDevice().getSystemColor(fgColorConstant)); + } gc.drawPolyline(path); + gc.setForeground(oldFG); } } \ No newline at end of file