From ce6a8ca873604c134b6e4bc4e185dcec43190b71 Mon Sep 17 00:00:00 2001 From: Brendan Robert Date: Sat, 20 Feb 2016 18:35:26 -0600 Subject: [PATCH] Issue #27: Ctrl+Shift+A now toggles between 1x/1.5x/2x display modes --- src/main/java/jace/EmulatorUILogic.java | 45 +++++++++++++++---------- 1 file changed, 28 insertions(+), 17 deletions(-) diff --git a/src/main/java/jace/EmulatorUILogic.java b/src/main/java/jace/EmulatorUILogic.java index 8e95242..bc5c8eb 100644 --- a/src/main/java/jace/EmulatorUILogic.java +++ b/src/main/java/jace/EmulatorUILogic.java @@ -240,23 +240,6 @@ public class EmulatorUILogic implements Reconfigurable { Emulator.computer.resume(); } - @InvokableAction( - name = "Adjust display", - category = "display", - description = "Adjusts window size to 1:1 aspect ratio for optimal viewing.", - alternatives = "Adjust screen;Adjust window size;Adjust aspect ratio;Fix screen;Fix window size;Fix aspect ratio;Correct aspect ratio;", - defaultKeyMapping = "ctrl+shift+a") - - static public void scaleIntegerRatio() { -// AbstractEmulatorFrame frame = Emulator.getFrame(); -// if (frame == null) { -// return; -// } -// Emulator.computer.pause(); -// frame.enforceIntegerRatio(); -// Emulator.computer.resume(); - } - @InvokableAction( name = "Toggle Debug", category = "debug", @@ -397,6 +380,34 @@ public class EmulatorUILogic implements Reconfigurable { } } + static int size = -1; + @InvokableAction( + name = "Resize window", + category = "UI", + description = "Resize the screen to 1x/1.5x/2x video size", + alternatives = "Adjust screen;Adjust window size;Adjust aspect ratio;Fix screen;Fix window size;Fix aspect ratio;Correct aspect ratio;", + defaultKeyMapping = {"ctrl+shift+a"}) + public static void scaleIntegerRatio() { + JaceApplication.getApplication().primaryStage.setFullScreen(false); + size++; + if (size > 2) { + size = 0; + } + switch (size) { + case 0: + JaceApplication.getApplication().primaryStage.setWidth(560); + JaceApplication.getApplication().primaryStage.setHeight(384); + break; + case 1: + JaceApplication.getApplication().primaryStage.setWidth(840); + JaceApplication.getApplication().primaryStage.setHeight(576); + break; + default: + JaceApplication.getApplication().primaryStage.setWidth(1020); + JaceApplication.getApplication().primaryStage.setHeight(768); + } + } + public static boolean confirm(String message) { // return JOptionPane.YES_OPTION == JOptionPane.showConfirmDialog(Emulator.getFrame(), message); return false;