Implement peeking previous position in WinBoard
authorH.G. Muller <h.g.muller@hccnet.nl>
Thu, 29 Dec 2011 14:38:46 +0000 (15:38 +0100)
committerH.G. Muller <h.g.muller@hccnet.nl>
Thu, 29 Dec 2011 14:38:46 +0000 (15:38 +0100)
The backspace key is used to temporarily display the previous position.

winboard/jaws.c
winboard/winboard.c

index d5b5b27..352dd83 100644 (file)
@@ -1240,9 +1240,8 @@ NiceTime(int x)
       }\\r
       return 0;\\r
 \r
-#define JAWS_KB_NAVIGATION \\r
+#define JAWS_KBDOWN_NAVIGATION \\r
 \\r
-       case WM_KEYDOWN:\\r
 \\r
                if(GetKeyState(VK_MENU) < 0 && GetKeyState(VK_CONTROL) < 0) {\\r
                    /* Control + Alt + letter used for speaking piece positions */\\r
@@ -1279,14 +1278,13 @@ NiceTime(int x)
                        KeyboardMove(hwnd, message, wParam, lParam);\\r
                        break;\\r
                }\\r
-               break;\\r
-       case WM_KEYUP:\\r
+\r
+#define JAWS_KBUP_NAVIGATION \\r
                switch (wParam) {\\r
                case VK_SPACE:\\r
                        KeyboardMove(hwnd, message, wParam, lParam);\\r
                        break;\\r
                }\\r
-               break;\\r
 \r
 #define JAWS_MENU_ITEMS \\r
                case IDM_PossibleAttackMove:  /*What can I possible attack from here */\\r
index 61cda89..a34b9cd 100644 (file)
@@ -737,7 +737,8 @@ void ThawUI()
 #define JAWS_INIT\r
 #define JAWS_ARGS\r
 #define JAWS_ALT_INTERCEPT\r
-#define JAWS_KB_NAVIGATION\r
+#define JAWS_KBUP_NAVIGATION\r
+#define JAWS_KBDOWN_NAVIGATION\r
 #define JAWS_MENU_ITEMS\r
 #define JAWS_SILENCE\r
 #define JAWS_REPLAY\r
@@ -4573,6 +4574,7 @@ WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
   char fileTitle[MSG_SIZ];\r
   char buf[MSG_SIZ];\r
   static SnapData sd;\r
+  static int peek=0;\r
 \r
   switch (message) {\r
 \r
@@ -4600,7 +4602,23 @@ WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
     MouseEvent(hwnd, message, wParam, lParam);\r
     break;\r
 \r
-  JAWS_KB_NAVIGATION\r
+  case WM_KEYUP:\r
+    if((char)wParam == '\b') {\r
+      ForwardEvent(); peek = 0;\r
+    }\r
+\r
+    JAWS_KBUP_NAVIGATION\r
+\r
+    break;\r
+\r
+  case WM_KEYDOWN:\r
+    if((char)wParam == '\b') {\r
+      if(!peek) BackwardEvent(), peek = 1;\r
+    }\r
+\r
+    JAWS_KBDOWN_NAVIGATION\r
+\r
+    break;\r
 \r
   case WM_CHAR:\r
     \r