Restructured the Preferences system
[Mograsim.git] / plugins / net.mograsim.logic.model / src / net / mograsim / logic / model / LogicUIStandaloneGUI.java
index 55a96a5..e803c26 100644 (file)
@@ -1,5 +1,8 @@
 package net.mograsim.logic.model;
 
+import static net.mograsim.logic.model.preferences.RenderPreferences.DRAG_BUTTON;
+import static net.mograsim.logic.model.preferences.RenderPreferences.ZOOM_BUTTON;
+
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.layout.FillLayout;
 import org.eclipse.swt.widgets.Display;
@@ -8,7 +11,7 @@ import org.eclipse.swt.widgets.Shell;
 import net.haspamelodica.swt.helper.zoomablecanvas.helper.ZoomableCanvasOverlay;
 import net.haspamelodica.swt.helper.zoomablecanvas.helper.ZoomableCanvasUserInput;
 import net.mograsim.logic.model.model.LogicModel;
-import net.mograsim.preferences.Preferences;
+import net.mograsim.logic.model.preferences.RenderPreferences;
 
 /**
  * Standalone simulation visualizer graphical user interface.
@@ -21,16 +24,18 @@ public class LogicUIStandaloneGUI implements Runnable
        private final Shell shell;
        private final LogicUICanvas ui;
 
-       public LogicUIStandaloneGUI(LogicModel model)
+       public LogicUIStandaloneGUI(LogicModel model, RenderPreferences renderPrefs)
        {
                display = new Display();
                shell = new Shell(display);
                shell.setLayout(new FillLayout());
-               ui = new LogicUICanvas(shell, SWT.NONE, model);
+               ui = new LogicUICanvas(shell, SWT.NONE, model, renderPrefs);
 
                ZoomableCanvasUserInput userInput = new ZoomableCanvasUserInput(ui);
-               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();
                new ZoomableCanvasOverlay(ui, null).enableScale();
        }