Added preferences for mouse button assignments
[Mograsim.git] / plugins / net.mograsim.plugin.core / src / net / mograsim / plugin / editors / SimulationViewEditor.java
index 06fadc0..3000d65 100644 (file)
@@ -38,6 +38,7 @@ import net.mograsim.plugin.nature.ProjectMachineContext;
 import net.mograsim.plugin.tables.DisplaySettings;
 import net.mograsim.plugin.tables.mi.ActiveInstructionPreviewContentProvider;
 import net.mograsim.plugin.tables.mi.InstructionTable;
+import net.mograsim.preferences.Preferences;
 
 //TODO what if we open multiple editors?
 //TODO actually save / load register and latch states
@@ -59,13 +60,13 @@ public class SimulationViewEditor extends EditorPart
        private InstructionTable instPreview;
        private Label noMachineLabel;
 
-       private ActiveMachineListener activeMNachineListener;
+       private ActiveMachineListener activeMachineListener;
        private MemoryCellModifiedListener memCellListener;
        private LogicObserver clockObserver;
 
        public SimulationViewEditor()
        {
-               activeMNachineListener = m -> recreateContextDependentControls();
+               activeMachineListener = m -> recreateContextDependentControls();
                memCellListener = a -> instPreview.refresh();
                clockObserver = o ->
                {
@@ -135,8 +136,8 @@ public class SimulationViewEditor extends EditorPart
                        machine = machineOptional.get();
                        canvas = new LogicUICanvas(canvasParent, SWT.NONE, machine.getModel());
                        ZoomableCanvasUserInput userInput = new ZoomableCanvasUserInput(canvas);
-                       userInput.buttonDrag = 3;
-                       userInput.buttonZoom = 2;
+                       userInput.buttonDrag = Preferences.current().getInt("net.mograsim.logic.model.button.drag");
+                       userInput.buttonZoom = Preferences.current().getInt("net.mograsim.logic.model.button.zoom");
                        userInput.enableUserInput();
                        if (zoom > 0)
                        {
@@ -288,7 +289,7 @@ public class SimulationViewEditor extends EditorPart
                        IFileEditorInput fileInput = (IFileEditorInput) input;
                        context = ProjectMachineContext.getMachineContextOf(fileInput.getFile().getProject());
                        context.activateMachine();
-                       context.addActiveMachineListener(activeMNachineListener);
+                       context.addActiveMachineListener(activeMachineListener);
                        recreateContextDependentControls();
 
                        setPartName(fileInput.getName());
@@ -348,7 +349,7 @@ public class SimulationViewEditor extends EditorPart
        public void dispose()
        {
                stopExecAndDeregisterContextDependentListeners();
-               context.removeActiveMachineListener(activeMNachineListener);
+               context.removeActiveMachineListener(activeMachineListener);
                super.dispose();
        }
 }
\ No newline at end of file