public SwtFlowgrid(Display display, File flowgridRootDir, boolean dark, float pixelPerDp, Callback<Model>... setup) {
this.display = display;
flowgridRoot = flowgridRootDir;
settings = new Settings(new File(flowgridRoot, "settings.json"));
storageRoot = new File(flowgridRoot, "files");
cacheRoot = new File(flowgridRoot, "cache");
resourceManager = new ResourceManager(display, dark, pixelPerDp);
shell = new Shell(display, SWT.SHELL_TRIM);
shell.setText("FlowGrid");
this.pixelPerDp = pixelPerDp;
this.setup = setup;
Rectangle clientArea = display.getClientArea();
shell.setBounds(clientArea.width / 6, clientArea.height / 6,
Math.min(clientArea.width * 3 / 2, Math.round(800 * pixelPerDp)),
Math.min(clientArea.height * 3 / 2, Math.round(480 * pixelPerDp)));
shell.open();
shell.addKeyListener(new KeyAdapter() {
@Override
public void keyReleased(KeyEvent e) {
if (e.keyCode == SWT.ARROW_LEFT && (e.stateMask & SWT.MODIFIER_MASK) == SWT.ALT && backStack.size() > 1) {
openArtifact(model.artifact(backStack.get(backStack.size() - 2)));
e.doit = false;
}
}
});
}