X-Git-Url: https://mograsim.net/gitweb/?a=blobdiff_plain;f=net.mograsim.logic.model%2Fsrc%2Fnet%2Fmograsim%2Flogic%2Fmodel%2Fmodel%2Fcomponents%2Fatomic%2FModelClock.java;h=38963536d0d8163deded311a08155614e9f01edf;hb=8bed58cd47f4e53a0a83e066d38864aa6875502f;hp=2755ac1044837b3c0aad81d9032eca362513f451;hpb=93b398d6271a538a2a4c9f4de07a3b4a8a2a7fd4;p=Mograsim.git diff --git a/net.mograsim.logic.model/src/net/mograsim/logic/model/model/components/atomic/ModelClock.java b/net.mograsim.logic.model/src/net/mograsim/logic/model/model/components/atomic/ModelClock.java index 2755ac10..38963536 100644 --- a/net.mograsim.logic.model/src/net/mograsim/logic/model/model/components/atomic/ModelClock.java +++ b/net.mograsim.logic.model/src/net/mograsim/logic/model/model/components/atomic/ModelClock.java @@ -10,13 +10,13 @@ import net.haspamelodica.swt.helper.swtobjectwrappers.Point; import net.haspamelodica.swt.helper.swtobjectwrappers.Rectangle; import net.mograsim.logic.core.LogicObserver; import net.mograsim.logic.core.components.CoreClock; -import net.mograsim.logic.model.model.ViewModelModifiable; +import net.mograsim.logic.model.model.LogicModelModifiable; import net.mograsim.logic.model.model.components.ModelComponent; import net.mograsim.logic.model.model.components.Orientation; import net.mograsim.logic.model.model.components.OrientationCalculator; import net.mograsim.logic.model.model.wires.Pin; import net.mograsim.logic.model.model.wires.PinUsage; -import net.mograsim.logic.model.modeladapter.ViewLogicModelAdapter; +import net.mograsim.logic.model.modeladapter.LogicCoreAdapter; import net.mograsim.logic.model.modeladapter.componentadapters.ClockAdapter; import net.mograsim.logic.model.serializing.IdentifyParams; import net.mograsim.logic.model.serializing.IndirectModelComponentCreator; @@ -36,22 +36,24 @@ public class ModelClock extends ModelComponent private OrientationCalculator oc; private CoreClock clock; - public ModelClock(ViewModelModifiable model, ModelClockParams params) + public ModelClock(LogicModelModifiable model, ModelClockParams params) { this(model, params, null); } - public ModelClock(ViewModelModifiable model, ModelClockParams params, String name) + public ModelClock(LogicModelModifiable model, ModelClockParams params, String name) { - super(model, name); + super(model, name, false); this.params = params; logicObs = (i) -> model.requestRedraw(); oc = new OrientationCalculator(params.orientation, width, height); setSize(oc.width(), oc.height()); - this.outputPin = new Pin(this, "", 1, PinUsage.OUTPUT, oc.newX(width, height / 2), oc.newY(width, height / 2)); + this.outputPin = new Pin(model, this, "", 1, PinUsage.OUTPUT, oc.newX(width, height / 2), oc.newY(width, height / 2)); addPin(outputPin); + + init(); } @Override @@ -73,7 +75,7 @@ public class ModelClock extends ModelComponent gc.setFont(oldFont); } - public void setLogicModelBinding(CoreClock clock) + public void setCoreModelBinding(CoreClock clock) { if (this.clock != null) this.clock.deregisterObserver(logicObs); @@ -82,7 +84,7 @@ public class ModelClock extends ModelComponent clock.registerObserver(logicObs); } - public boolean hasLogicModelBinding() + public boolean hasCoreModelBinding() { return clock != null; } @@ -142,7 +144,7 @@ public class ModelClock extends ModelComponent static { - ViewLogicModelAdapter.addComponentAdapter(new ClockAdapter()); + LogicCoreAdapter.addComponentAdapter(new ClockAdapter()); IndirectModelComponentCreator.setComponentSupplier(ModelClock.class.getName(), (m, p, n) -> { ModelClockParams params = JsonHandler.fromJsonTree(p, ModelClockParams.class);