X-Git-Url: https://mograsim.net/gitweb/?a=blobdiff_plain;f=SampleERCP%2Fsrc%2Fsampleercp%2Fparts%2FLogicUIPart.java;fp=SampleERCP%2Fsrc%2Fsampleercp%2Fparts%2FLogicUIPart.java;h=481879c6a209ee9d02721bb5271ca295fddb9a05;hb=6c67a9ff8361cd9fc082f40e2676f2c8b5911fe4;hp=c142cb6727b22602fa5de7b26aa9ab9a560b62e8;hpb=6d944b4deae46eef98beabdea0dab90c455e14a8;p=Mograsim.git diff --git a/SampleERCP/src/sampleercp/parts/LogicUIPart.java b/SampleERCP/src/sampleercp/parts/LogicUIPart.java index c142cb67..481879c6 100644 --- a/SampleERCP/src/sampleercp/parts/LogicUIPart.java +++ b/SampleERCP/src/sampleercp/parts/LogicUIPart.java @@ -9,7 +9,7 @@ import org.eclipse.swt.widgets.Composite; import era.mi.gui.LogicUICanvas; import era.mi.gui.examples.RSLatchGUIExample; -import era.mi.logic.Simulation; +import era.mi.logic.timeline.Timeline; import net.haspamelodica.swt.helper.zoomablecanvas.helper.ZoomableCanvasUserInput; public class LogicUIPart @@ -20,6 +20,7 @@ public class LogicUIPart @PostConstruct public void create(Composite parent) { + Timeline timeline = new Timeline(11); LogicUICanvas ui = new LogicUICanvas(parent, SWT.NONE); RSLatchGUIExample.addComponentsAndWires(ui); ui.addTransformListener((x, y, z) -> part.setDirty(z < 1)); @@ -33,10 +34,10 @@ public class LogicUIPart while (!ui.isDisposed()) { // always execute to keep timeline from "hanging behind" for too long - Simulation.TIMELINE.executeUpTo(System.currentTimeMillis(), System.currentTimeMillis() + 10); + timeline.executeUpTo(System.currentTimeMillis(), System.currentTimeMillis() + 10); long sleepTime; - if (Simulation.TIMELINE.hasNext()) - sleepTime = Simulation.TIMELINE.nextEventTime() - System.currentTimeMillis(); + if (timeline.hasNext()) + sleepTime = timeline.nextEventTime() - System.currentTimeMillis(); else sleepTime = 10; try @@ -50,7 +51,7 @@ public class LogicUIPart } }); simulationThread.start(); - Simulation.TIMELINE.addEventAddedListener(event -> + timeline.addEventAddedListener(event -> { if (event.getTiming() <= System.currentTimeMillis()) simulationThread.interrupt();