X-Git-Url: https://mograsim.net/gitweb/?a=blobdiff_plain;f=net.mograsim.logic.ui%2Fsrc%2Fnet%2Fmograsim%2Flogic%2Fui%2Fmodel%2Fwires%2FWireCrossPoint.java;h=b4aaa98cd58b5e546086371e6a0ad0857f8f1644;hb=da27eee93b1893199dde2b0935cafdb1c6301279;hp=0949ffbb2e373ddd825006b7b7966d3c4a686b37;hpb=218ed3e44595ad3534c33e05b43a55cc1a67e851;p=Mograsim.git diff --git a/net.mograsim.logic.ui/src/net/mograsim/logic/ui/model/wires/WireCrossPoint.java b/net.mograsim.logic.ui/src/net/mograsim/logic/ui/model/wires/WireCrossPoint.java index 0949ffbb..b4aaa98c 100644 --- a/net.mograsim.logic.ui/src/net/mograsim/logic/ui/model/wires/WireCrossPoint.java +++ b/net.mograsim.logic.ui/src/net/mograsim/logic/ui/model/wires/WireCrossPoint.java @@ -1,49 +1,49 @@ -package net.mograsim.logic.ui.model.wires; - -import net.mograsim.logic.ui.ColorHelper; -import net.mograsim.logic.ui.model.ViewModel; -import net.mograsim.logic.ui.model.components.GUIComponent; -import net.haspamelodica.swt.helper.gcs.GeneralGC; -import net.haspamelodica.swt.helper.swtobjectwrappers.Rectangle; -import net.mograsim.logic.core.types.BitVectorFormatter; -import net.mograsim.logic.core.wires.Wire.ReadEnd; - -public class WireCrossPoint extends GUIComponent -{ - private final Pin pin; - - private ReadEnd end; - private final int logicWidth; - - public WireCrossPoint(ViewModel model, int logicWidth) - { - super(model); - this.logicWidth = logicWidth; - setSize(0, 0); - addPin(this.pin = new Pin(this, logicWidth, 0, 0)); - } - - @Override - public void render(GeneralGC gc, Rectangle visibleRegion) - { - Rectangle bounds = getBounds(); - ColorHelper.executeWithDifferentBackground(gc, BitVectorFormatter.formatAsColor(end), - () -> gc.fillOval(bounds.x - 1, bounds.y - 1, 2, 2)); - } - - public void setLogicModelBinding(ReadEnd end) - { - this.end = end; - end.addObserver((i, o) -> callComponentLookChangedListeners()); - } - - public int getLogicWidth() - { - return logicWidth; - } - - public Pin getPin() - { - return pin; - } +package net.mograsim.logic.ui.model.wires; + +import net.mograsim.logic.ui.ColorHelper; +import net.mograsim.logic.ui.model.ViewModel; +import net.mograsim.logic.ui.model.components.GUIComponent; +import net.haspamelodica.swt.helper.gcs.GeneralGC; +import net.haspamelodica.swt.helper.swtobjectwrappers.Rectangle; +import net.mograsim.logic.core.types.BitVectorFormatter; +import net.mograsim.logic.core.wires.Wire.ReadEnd; + +public class WireCrossPoint extends GUIComponent +{ + private final Pin pin; + + private ReadEnd end; + private final int logicWidth; + + public WireCrossPoint(ViewModel model, int logicWidth) + { + super(model); + this.logicWidth = logicWidth; + setSize(0, 0); + addPin(this.pin = new Pin(this, logicWidth, 0, 0)); + } + + @Override + public void render(GeneralGC gc, Rectangle visibleRegion) + { + Rectangle bounds = getBounds(); + ColorHelper.executeWithDifferentBackground(gc, BitVectorFormatter.formatAsColor(end), + () -> gc.fillOval(bounds.x - 1, bounds.y - 1, 2, 2)); + } + + public void setLogicModelBinding(ReadEnd end) + { + this.end = end; + end.registerObserver((i) -> callComponentLookChangedListeners()); + } + + public int getLogicWidth() + { + return logicWidth; + } + + public Pin getPin() + { + return pin; + } } \ No newline at end of file