X-Git-Url: https://mograsim.net/gitweb/?a=blobdiff_plain;f=plugins%2Fnet.mograsim.plugin.core%2Fsrc%2Fnet%2Fmograsim%2Fplugin%2FSimulationPreview.java;h=7b131d58189e8fd5e586516aacaa86e93e79e3b0;hb=5995c2c9f891ae852a40b4c4736b090d514e7c0a;hp=5fcc1688f6587580de828e45c7f662a98d5c5d8a;hpb=7d05144c25daa53e60fc9ed9fd503546a86567f8;p=Mograsim.git diff --git a/plugins/net.mograsim.plugin.core/src/net/mograsim/plugin/SimulationPreview.java b/plugins/net.mograsim.plugin.core/src/net/mograsim/plugin/SimulationPreview.java index 5fcc1688..7b131d58 100644 --- a/plugins/net.mograsim.plugin.core/src/net/mograsim/plugin/SimulationPreview.java +++ b/plugins/net.mograsim.plugin.core/src/net/mograsim/plugin/SimulationPreview.java @@ -16,30 +16,30 @@ import net.mograsim.logic.model.model.components.atomic.ModelOrGate; import net.mograsim.logic.model.model.wires.ModelWire; import net.mograsim.logic.model.model.wires.ModelWireCrossPoint; import net.mograsim.logic.model.modeladapter.CoreModelParameters; +import net.mograsim.logic.model.modeladapter.CoreModelParameters.CoreModelParametersBuilder; import net.mograsim.logic.model.modeladapter.LogicCoreAdapter; -import net.mograsim.preferences.Preferences; +import net.mograsim.logic.model.preferences.RenderPreferences; +import net.mograsim.plugin.preferences.EclipseRenderPreferences; public class SimulationPreview implements IThemePreview { private LogicUICanvas ui; private LogicExecuter exec; - private Preferences oldPreferences; - private Preferences currentThemePreferences; @Override @SuppressWarnings("unused") public void createControl(Composite parent, ITheme currentTheme) { - oldPreferences = Preferences.current(); - - currentThemePreferences = new ThemePreferences(currentTheme); - // TODO this will change the global preferences; so if another LogicUICanvas redraws, it will use the "new" colors too. - Preferences.setPreferences(currentThemePreferences); + RenderPreferences currentThemeRenderPrefs = new EclipseRenderPreferences(currentTheme, + MograsimActivator.instance().getPreferenceStore()); LogicModelModifiable model = new LogicModelModifiable(); - CoreModelParameters params = new CoreModelParameters(); - params.gateProcessTime = 50; - params.wireTravelTime = 10; + + CoreModelParametersBuilder paramsBuilder = CoreModelParameters.builder(); + paramsBuilder.gateProcessTime = 50; + paramsBuilder.hardcodedComponentProcessTime = paramsBuilder.gateProcessTime * 5; + paramsBuilder.wireTravelTime = 10; + CoreModelParameters params = paramsBuilder.build(); ModelManualSwitch rIn = new ModelManualSwitch(model, 1); rIn.moveTo(10, 10); @@ -85,7 +85,7 @@ public class SimulationPreview implements IThemePreview rIn.clicked(0, 0); - ui = new LogicUICanvas(parent, SWT.NONE, model); + ui = new LogicUICanvas(parent, SWT.NONE, model, currentThemeRenderPrefs); ui.zoom(3.5, 10, 10); exec.startLiveExecution(); @@ -97,7 +97,5 @@ public class SimulationPreview implements IThemePreview public void dispose() { exec.stopLiveExecution(); - if (Preferences.current() == currentThemePreferences) - Preferences.setPreferences(oldPreferences); } }