X-Git-Url: https://mograsim.net/gitweb/?a=blobdiff_plain;f=plugins%2Fnet.mograsim.plugin.core%2Fsrc%2Fnet%2Fmograsim%2Fplugin%2Fviews%2FSimulationView.java;h=210e9de7783318a94fa596220b9acbd68b075025;hb=590c4809a069b0d30529735bf58f0db5382f8a88;hp=d1a9041888e3f5ff32cc69451932ae0caf92570e;hpb=278fa8f97a6ba31f3cbdd0c65d370563b943eca9;p=Mograsim.git diff --git a/plugins/net.mograsim.plugin.core/src/net/mograsim/plugin/views/SimulationView.java b/plugins/net.mograsim.plugin.core/src/net/mograsim/plugin/views/SimulationView.java index d1a90418..210e9de7 100644 --- a/plugins/net.mograsim.plugin.core/src/net/mograsim/plugin/views/SimulationView.java +++ b/plugins/net.mograsim.plugin.core/src/net/mograsim/plugin/views/SimulationView.java @@ -1,5 +1,9 @@ package net.mograsim.plugin.views; +import static net.mograsim.logic.model.preferences.RenderPreferences.DRAG_BUTTON; +import static net.mograsim.logic.model.preferences.RenderPreferences.ZOOM_BUTTON; +import static net.mograsim.plugin.preferences.PluginPreferences.SIMULATION_SPEED_PRECISION; + import java.util.HashSet; import java.util.Optional; import java.util.Set; @@ -26,16 +30,17 @@ import net.haspamelodica.swt.helper.zoomablecanvas.helper.ZoomableCanvasUserInpu import net.mograsim.logic.core.LogicObserver; import net.mograsim.logic.core.components.CoreClock; import net.mograsim.logic.model.LogicUICanvas; +import net.mograsim.logic.model.preferences.RenderPreferences; import net.mograsim.machine.Machine; import net.mograsim.machine.Memory.MemoryCellModifiedListener; import net.mograsim.machine.mi.AssignableMicroInstructionMemory; +import net.mograsim.plugin.MograsimActivator; import net.mograsim.plugin.launch.MachineDebugContextListener; import net.mograsim.plugin.launch.MachineDebugTarget; import net.mograsim.plugin.tables.DisplaySettings; import net.mograsim.plugin.tables.mi.ActiveInstructionPreviewContentProvider; import net.mograsim.plugin.tables.mi.InstructionTable; import net.mograsim.plugin.util.OverlappingFillLayout; -import net.mograsim.preferences.Preferences; public class SimulationView extends ViewPart { @@ -65,7 +70,7 @@ public class SimulationView extends ViewPart { controlsToDisableWhenNoMachinePresent = new HashSet<>(); memCellListener = a -> instPreview.refresh(); - // TODO could this be a breakpoint? + // TODO use Step Over instead clockObserver = o -> { if (((CoreClock) o).isOn()) @@ -148,13 +153,13 @@ public class SimulationView extends ViewPart simSpeedScale.addListener(SWT.Selection, e -> { double speed = Math.pow(SIM_SPEED_SCALE_STEP_FACTOR, simSpeedScale.getSelection() - SIM_SPEED_SCALE_STEPS); - // TODO: disable when debugTarget is not set debugTarget.setExecutionSpeed(speed); }); simSpeedInput = new DoubleInput(c, SWT.NONE); controlsToDisableWhenNoMachinePresent.add(simSpeedInput); - simSpeedInput.setPrecision(Preferences.current().getInt("net.mograsim.plugin.core.simspeedprecision")); + // TODO add a listener + simSpeedInput.setPrecision(MograsimActivator.instance().getPluginPrefs().getInt(SIMULATION_SPEED_PRECISION)); simSpeedInput.addChangeListener(speed -> { if (speed != 0) @@ -221,11 +226,14 @@ public class SimulationView extends ViewPart Machine machine = debugTarget.getMachine(); - canvas = new LogicUICanvas(canvasParent, SWT.NONE, machine.getModel()); + RenderPreferences renderPrefs = MograsimActivator.instance().getRenderPrefs(); + canvas = new LogicUICanvas(canvasParent, SWT.NONE, machine.getModel(), renderPrefs); canvas.addListener(SWT.MouseDown, e -> canvas.setFocus()); ZoomableCanvasUserInput userInput = new ZoomableCanvasUserInput(canvas); - userInput.buttonDrag = Preferences.current().getInt("net.mograsim.logic.model.button.drag"); - userInput.buttonZoom = Preferences.current().getInt("net.mograsim.logic.model.button.zoom"); + // TODO add a listener + userInput.buttonDrag = renderPrefs.getInt(DRAG_BUTTON); + // TODO add a listener + userInput.buttonZoom = renderPrefs.getInt(ZOOM_BUTTON); userInput.enableUserInput(); if (zoom > 0) {