From 8ab3729f32987ea69b1dc176dc245581fe12a525 Mon Sep 17 00:00:00 2001 From: Andrea Cavalli Date: Sun, 24 Dec 2017 12:57:36 +0100 Subject: [PATCH] Fixed keyboard bugs --- .../warp/picalculator/device/Keyboard.java | 9 ++ .../gui/graphicengine/cpu/SwingWindow.java | 110 +----------------- 2 files changed, 10 insertions(+), 109 deletions(-) diff --git a/src/main/java/org/warp/picalculator/device/Keyboard.java b/src/main/java/org/warp/picalculator/device/Keyboard.java index e0a83873..64a648f3 100755 --- a/src/main/java/org/warp/picalculator/device/Keyboard.java +++ b/src/main/java/org/warp/picalculator/device/Keyboard.java @@ -272,6 +272,15 @@ public class Keyboard { Keyboard.keyPressed(Key.NONE); } break; + case KeyEvent.VK_M: + if (!Keyboard.shift && !Keyboard.alpha) { + Keyboard.keyPressed(Key.SURD_MODE); + } else if (Keyboard.shift) { + Keyboard.keyPressed(Key.NONE); + } else { + Keyboard.keyPressed(Key.NONE); + } + break; case com.jogamp.newt.event.KeyEvent.VK_ADD: case KeyEvent.VK_ADD: if (!Keyboard.shift && !Keyboard.alpha) { diff --git a/src/main/java/org/warp/picalculator/gui/graphicengine/cpu/SwingWindow.java b/src/main/java/org/warp/picalculator/gui/graphicengine/cpu/SwingWindow.java index 25607384..540cba8b 100755 --- a/src/main/java/org/warp/picalculator/gui/graphicengine/cpu/SwingWindow.java +++ b/src/main/java/org/warp/picalculator/gui/graphicengine/cpu/SwingWindow.java @@ -88,115 +88,7 @@ public class SwingWindow extends JFrame { @Override public void keyReleased(KeyEvent arg0) { - switch (arg0.getKeyCode()) { - case KeyEvent.VK_ESCAPE: - Keyboard.keyReleased(Key.POWER); - break; - case KeyEvent.VK_D: - Keyboard.keyReleased(Key.debug_DEG); - break; - case KeyEvent.VK_R: - Keyboard.keyReleased(Key.debug_RAD); - break; - case KeyEvent.VK_G: - Keyboard.keyReleased(Key.debug_GRA); - break; - case KeyEvent.VK_X: - if (Keyboard.alpha) { - Keyboard.keyReleased(Key.LETTER_X); - } else { - Keyboard.keyReleased(Key.NONE); - } - break; - case KeyEvent.VK_P: - if (Keyboard.alpha) { - Keyboard.keyReleased(Key.PI); - } else { - Keyboard.keyReleased(Key.NONE); - } - break; - case KeyEvent.VK_B: - if (Keyboard.shift) { - Keyboard.keyReleased(Key.BRIGHTNESS_CYCLE_REVERSE); - } else if (!Keyboard.shift && !Keyboard.alpha) { - Keyboard.keyReleased(Key.BRIGHTNESS_CYCLE); - } else { - Keyboard.keyReleased(Key.NONE); - } - break; - case KeyEvent.VK_ENTER: - if (!Keyboard.shift && !Keyboard.alpha) { - Keyboard.keyReleased(Key.SIMPLIFY); - } else { - Keyboard.keyReleased(Key.NONE); - } - int row = 2; - int col = 1; - Keyboard.debugKeysDown[row - 1][col - 1] = false; - break; - case KeyEvent.VK_1: - if (!Keyboard.shift && !Keyboard.alpha) { - Keyboard.keyReleased(Key.debug1); - } else { - Keyboard.keyReleased(Key.NONE); - } - break; - case KeyEvent.VK_2: - if (!Keyboard.shift && !Keyboard.alpha) { - Keyboard.keyReleased(Key.debug2); - } else { - Keyboard.keyReleased(Key.NONE); - } - break; - case KeyEvent.VK_3: - if (!Keyboard.shift && !Keyboard.alpha) { - Keyboard.keyReleased(Key.debug3); - } else { - Keyboard.keyReleased(Key.NONE); - } - break; - case KeyEvent.VK_4: - if (!Keyboard.shift && !Keyboard.alpha) { - Keyboard.keyReleased(Key.debug4); - } else { - Keyboard.keyReleased(Key.NONE); - } - break; - case KeyEvent.VK_5: - if (!Keyboard.shift && !Keyboard.alpha) { - Keyboard.keyReleased(Key.debug5); - } else { - Keyboard.keyReleased(Key.NONE); - } - break; - case KeyEvent.VK_SHIFT: - Keyboard.keyReleased(Key.SHIFT); - if (Keyboard.shift) { - Keyboard.keyPressed(Key.SHIFT); - Keyboard.keyReleased(Key.SHIFT); - } - break; - case KeyEvent.VK_A: - Keyboard.keyReleased(Key.ALPHA); - if (Keyboard.alpha) { - Keyboard.keyPressed(Key.ALPHA); - Keyboard.keyReleased(Key.ALPHA); - } - break; - case KeyEvent.VK_M: - Keyboard.keyPressed(Key.SURD_MODE); - break; - case KeyEvent.VK_LEFT: - //LEFT - row = 2; - col = 3; - Keyboard.debugKeysDown[row - 1][col - 1] = false; - case KeyEvent.VK_RIGHT: - //RIGHT - row = 2; - col = 5; - Keyboard.debugKeysDown[row - 1][col - 1] = false; - } + } @Override