X-Git-Url: https://mograsim.net/gitweb/?a=blobdiff_plain;f=net.mograsim.logic.ui%2Fsrc%2Fnet%2Fmograsim%2Flogic%2Fui%2Fmodel%2Fwires%2FGUIWire.java;h=7b641ff3484c05bf8e92cb87b73b408775b2381b;hb=a2eef1d1616d03af5b464f347f6176ea9d2cc75e;hp=5a0579c3b0a728e0f8911271d60b616a89cc30d1;hpb=a4d1573c2f2cf8236bcb56dc70bc8b8c60b6c225;p=Mograsim.git diff --git a/net.mograsim.logic.ui/src/net/mograsim/logic/ui/model/wires/GUIWire.java b/net.mograsim.logic.ui/src/net/mograsim/logic/ui/model/wires/GUIWire.java index 5a0579c3..7b641ff3 100644 --- a/net.mograsim.logic.ui/src/net/mograsim/logic/ui/model/wires/GUIWire.java +++ b/net.mograsim.logic.ui/src/net/mograsim/logic/ui/model/wires/GUIWire.java @@ -14,8 +14,9 @@ import net.mograsim.logic.core.types.BitVector; import net.mograsim.logic.core.types.BitVectorFormatter; import net.mograsim.logic.core.wires.Wire; import net.mograsim.logic.core.wires.Wire.ReadEnd; -import net.mograsim.logic.ui.ColorHelper; import net.mograsim.logic.ui.model.ViewModelModifiable; +import net.mograsim.preferences.ColorDefinition; +import net.mograsim.preferences.ColorManager; /** * A wire connecting exactly two {@link Pin}s. @@ -73,7 +74,37 @@ public class GUIWire * * @author Daniel Kirschten */ - public GUIWire(ViewModelModifiable model, ConnectionPoint pin1, ConnectionPoint pin2) + public GUIWire(ViewModelModifiable model, WireCrossPoint pin1, WireCrossPoint pin2) + { + this(model, pin1, pin2, (Point[]) null); + } + + /** + * Creates a new {@link GUIWire} with automatic interpolation. + * + * @author Daniel Kirschten + */ + public GUIWire(ViewModelModifiable model, WireCrossPoint pin1, Pin pin2) + { + this(model, pin1, pin2, (Point[]) null); + } + + /** + * Creates a new {@link GUIWire} with automatic interpolation. + * + * @author Daniel Kirschten + */ + public GUIWire(ViewModelModifiable model, Pin pin1, WireCrossPoint pin2) + { + this(model, pin1, pin2, (Point[]) null); + } + + /** + * Creates a new {@link GUIWire} with automatic interpolation. + * + * @author Daniel Kirschten + */ + public GUIWire(ViewModelModifiable model, Pin pin1, Pin pin2) { this(model, pin1, pin2, (Point[]) null); } @@ -83,7 +114,7 @@ public class GUIWire * * @author Daniel Kirschten */ - public GUIWire(ViewModelModifiable model, ConnectionPoint pin1, ConnectionPoint pin2, Point... path) + public GUIWire(ViewModelModifiable model, WireCrossPoint pin1, WireCrossPoint pin2, Point... path) { this(model, pin1.getPin(), pin2.getPin(), path); } @@ -93,7 +124,27 @@ public class GUIWire * * @author Daniel Kirschten */ - GUIWire(ViewModelModifiable model, Pin pin1, Pin pin2, Point... path) + public GUIWire(ViewModelModifiable model, WireCrossPoint pin1, Pin pin2, Point... path) + { + this(model, pin1.getPin(), pin2, path); + } + + /** + * Creates a new {@link GUIWire} without automatic interpolation. + * + * @author Daniel Kirschten + */ + public GUIWire(ViewModelModifiable model, Pin pin1, WireCrossPoint pin2, Point... path) + { + this(model, pin1, pin2.getPin(), path); + } + + /** + * Creates a new {@link GUIWire} without automatic interpolation. + * + * @author Daniel Kirschten + */ + public GUIWire(ViewModelModifiable model, Pin pin1, Pin pin2, Point... path) { logicObs = (i) -> callRedrawListeners(); this.model = model; @@ -226,7 +277,10 @@ public class GUIWire */ public void render(GeneralGC gc) { - ColorHelper.executeWithDifferentForeground(gc, BitVectorFormatter.formatAsColor(end), () -> gc.drawPolyline(effectivePath)); + ColorDefinition wireColor = BitVectorFormatter.formatAsColor(end); + if (wireColor != null) + gc.setForeground(ColorManager.current().toColor(wireColor)); + gc.drawPolyline(effectivePath); } /**