1 package net.mograsim.logic.ui;
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.ui.model.ViewModel;
11 import net.mograsim.logic.ui.modeladapter.LogicModelParameters;
14 * Standalone simulation visualizer graphical user interface.
16 * @author Daniel Kirschten
18 public class LogicUIStandaloneGUI
20 private final Display display;
21 private final Shell shell;
22 private final LogicUICanvas ui;
24 public LogicUIStandaloneGUI(ViewModel 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 = 3;
33 userInput.buttonZoom = 2;
34 userInput.enableUserInput();
35 new ZoomableCanvasOverlay(ui, null).enableScale();
37 // TODO don't do this here
38 LogicModelParameters params = new LogicModelParameters();
39 params.gateProcessTime = 50;
40 params.wireTravelTime = 10;
41 // timeline = ViewLogicModelAdapter.convert(model, params);
44 public LogicUICanvas getLogicUICanvas()
50 * Opens the UI shell. Returns when the shell is closed.
55 while (!shell.isDisposed())
56 if (!display.readAndDispatch())