X-Git-Url: https://mograsim.net/gitweb/?a=blobdiff_plain;f=LogicUI%2Fsrc%2Fera%2Fmi%2Fgui%2Fmodel%2Fwires%2FWireCrossPoint.java;h=c54cdd9b73f5c480b743152916f02331526be4d9;hb=8e290cad73b372b954f7677f2287c6a9eb9a6313;hp=84179fad7029ca702e918ae9d81f35b7ecb58548;hpb=4d29cabdc45d68b5e5f210266dc4fbc5560dbcdd;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..c54cdd9b 100644 --- a/LogicUI/src/era/mi/gui/model/wires/WireCrossPoint.java +++ b/LogicUI/src/era/mi/gui/model/wires/WireCrossPoint.java @@ -1,35 +1,33 @@ 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) + public WireCrossPoint(ViewModel model, int logicWidth) { super(model); setSize(0, 0); - addPin(new Pin(this, 0, 0)); + addPin(new Pin(this, logicWidth, 0, 0)); } @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) -> callComponentLookChangedListeners()); } } \ No newline at end of file