X-Git-Url: https://mograsim.net/gitweb/?a=blobdiff_plain;f=LogicUI%2Fsrc%2Fera%2Fmi%2Fgui%2Fmodel%2Fwires%2FWireCrossPoint.java;h=ebe30c3033fb5e602671882d11f892932708b3e6;hb=e618fa725540dd5f92ccf0ed7d65acdc8eb83f93;hp=84179fad7029ca702e918ae9d81f35b7ecb58548;hpb=ba9a2b22b7b87e06a5ad7d8a2050c2d8298aa66b;p=Mograsim.git diff --git a/LogicUI/src/era/mi/gui/model/wires/WireCrossPoint.java b/LogicUI/src/era/mi/gui/model/wires/WireCrossPoint.java index 84179fad..ebe30c30 100644 --- a/LogicUI/src/era/mi/gui/model/wires/WireCrossPoint.java +++ b/LogicUI/src/era/mi/gui/model/wires/WireCrossPoint.java @@ -1,16 +1,16 @@ package era.mi.gui.model.wires; -import org.eclipse.swt.graphics.Color; - +import era.mi.gui.ColorHelper; import era.mi.gui.model.ViewModel; import era.mi.gui.model.components.GUIComponent; -import era.mi.logic.wires.Wire; +import era.mi.logic.types.BitVectorFormatter; +import era.mi.logic.wires.Wire.ReadEnd; import net.haspamelodica.swt.helper.gcs.GeneralGC; import net.haspamelodica.swt.helper.swtobjectwrappers.Rectangle; public class WireCrossPoint extends GUIComponent { - private Wire wire; + private ReadEnd end; public WireCrossPoint(ViewModel model) { @@ -22,14 +22,12 @@ public class WireCrossPoint extends GUIComponent @Override public void render(GeneralGC gc, Rectangle visibleRegion) { - Color oldBG = gc.getBackground(); - gc.setBackground(gc.getDevice().getSystemColor(GUIWire.getSWTColorConstantForWire(wire))); - gc.fillOval(-1, -1, 2, 2); - gc.setBackground(oldBG); + ColorHelper.executeWithDifferentBackground(gc, BitVectorFormatter.formatAsColor(end), () -> gc.fillOval(-1, -1, 2, 2)); } - public void setLogicModelWire(Wire wire) + public void setLogicModelBinding(ReadEnd end) { - this.wire = wire; + this.end = end; + end.addObserver((i, o) -> callComponentChangedListeners()); } } \ No newline at end of file