1 package net.mograsim.logic.model;
3 import org.eclipse.swt.SWT;
4 import org.eclipse.swt.layout.FillLayout;
5 import org.eclipse.swt.widgets.Display;
6 import org.eclipse.swt.widgets.Shell;
8 import net.haspamelodica.swt.helper.zoomablecanvas.helper.ZoomableCanvasOverlay;
9 import net.haspamelodica.swt.helper.zoomablecanvas.helper.ZoomableCanvasUserInput;
10 import net.mograsim.logic.model.model.LogicModel;
11 import net.mograsim.preferences.Preferences;
14 * Standalone simulation visualizer graphical user interface.
16 * @author Daniel Kirschten
18 public class LogicUIStandaloneGUI implements Runnable
20 private final Display display;
21 private final Shell shell;
22 private final LogicUICanvas ui;
24 public LogicUIStandaloneGUI(LogicModel model)
26 display = new Display();
27 shell = new Shell(display);
28 shell.setLayout(new FillLayout());
29 ui = new LogicUICanvas(shell, SWT.NONE, model);
31 ZoomableCanvasUserInput userInput = new ZoomableCanvasUserInput(ui);
32 userInput.buttonDrag = Preferences.current().getInt("net.mograsim.logic.model.button.drag");
33 userInput.buttonZoom = Preferences.current().getInt("net.mograsim.logic.model.button.zoom");
34 userInput.enableUserInput();
35 new ZoomableCanvasOverlay(ui, null).enableScale();
38 public LogicUICanvas getLogicUICanvas()
44 * Opens the UI shell. Returns when the shell is closed.
50 while (!shell.isDisposed())
51 if (!display.readAndDispatch())