X-Git-Url: https://mograsim.net/gitweb/?a=blobdiff_plain;f=net.mograsim.logic.model%2Fsrc%2Fnet%2Fmograsim%2Flogic%2Fmodel%2Fmodel%2Fwires%2FWireCrossPoint.java;h=7d31801a42ad486c839dc633a033ce345f09b8f5;hb=039f31334c661633b71e945aa4332cedb7055526;hp=49faee9c9dc249ac2b135aa213a0d8b93bae4ba6;hpb=a47c9b1f38bbb6d2f5a3c482f3b09d1f42270401;p=Mograsim.git diff --git a/net.mograsim.logic.model/src/net/mograsim/logic/model/model/wires/WireCrossPoint.java b/net.mograsim.logic.model/src/net/mograsim/logic/model/model/wires/WireCrossPoint.java index 49faee9c..7d31801a 100644 --- a/net.mograsim.logic.model/src/net/mograsim/logic/model/model/wires/WireCrossPoint.java +++ b/net.mograsim.logic.model/src/net/mograsim/logic/model/model/wires/WireCrossPoint.java @@ -1,8 +1,5 @@ package net.mograsim.logic.model.model.wires; -import com.google.gson.JsonElement; -import com.google.gson.JsonPrimitive; - import net.haspamelodica.swt.helper.gcs.GeneralGC; import net.haspamelodica.swt.helper.swtobjectwrappers.Rectangle; import net.mograsim.logic.core.LogicObserver; @@ -10,7 +7,7 @@ import net.mograsim.logic.core.types.BitVectorFormatter; import net.mograsim.logic.core.wires.Wire.ReadEnd; import net.mograsim.logic.model.model.ViewModelModifiable; import net.mograsim.logic.model.model.components.GUIComponent; -import net.mograsim.logic.model.serializing.IdentifierGetter; +import net.mograsim.logic.model.serializing.IdentifyParams; import net.mograsim.logic.model.serializing.IndirectGUIComponentCreator; import net.mograsim.preferences.ColorDefinition; import net.mograsim.preferences.ColorManager; @@ -29,6 +26,10 @@ public class WireCrossPoint extends GUIComponent private static final int CIRCLE_RADIUS = 1; private static final int CIRCLE_DIAM = CIRCLE_RADIUS * 2; + /** + * The logical width of this cross point. + */ + public final int logicWidth; /** * The (single) pin of this cross point. */ @@ -53,10 +54,11 @@ public class WireCrossPoint extends GUIComponent public WireCrossPoint(ViewModelModifiable model, int logicWidth, String name) { super(model, name); - logicObs = (i) -> requestRedraw(); + this.logicWidth = logicWidth; + logicObs = (i) -> model.requestRedraw(); setSize(CIRCLE_DIAM, CIRCLE_DIAM); - addPin(this.pin = new Pin(this, "", logicWidth, CIRCLE_RADIUS, CIRCLE_RADIUS)); + addPin(this.pin = new Pin(this, "", logicWidth, PinUsage.TRISTATE, CIRCLE_RADIUS, CIRCLE_RADIUS)); } // pins @@ -116,9 +118,15 @@ public class WireCrossPoint extends GUIComponent // serializing @Override - public JsonElement getParamsForSerializing(IdentifierGetter idGetter) + public String getIDForSerializing(IdentifyParams idParams) + { + return "WireCrossPoint"; + } + + @Override + public Integer getParamsForSerializing(IdentifyParams idParams) { - return new JsonPrimitive(pin.logicWidth); + return logicWidth; } static