From: H.G. Muller Date: Thu, 29 Dec 2011 14:38:46 +0000 (+0100) Subject: Implement peeking previous position in WinBoard X-Git-Url: http://winboard.nl/cgi-bin?a=commitdiff_plain;h=82b4e616032702ec6e09b7b07d14a2275196f574;p=xboard.git Implement peeking previous position in WinBoard The backspace key is used to temporarily display the previous position. --- diff --git a/winboard/jaws.c b/winboard/jaws.c index d5b5b27..352dd83 100644 --- a/winboard/jaws.c +++ b/winboard/jaws.c @@ -1240,9 +1240,8 @@ NiceTime(int x) }\ return 0;\ -#define JAWS_KB_NAVIGATION \ +#define JAWS_KBDOWN_NAVIGATION \ \ - case WM_KEYDOWN:\ \ if(GetKeyState(VK_MENU) < 0 && GetKeyState(VK_CONTROL) < 0) {\ /* Control + Alt + letter used for speaking piece positions */\ @@ -1279,14 +1278,13 @@ NiceTime(int x) KeyboardMove(hwnd, message, wParam, lParam);\ break;\ }\ - break;\ - case WM_KEYUP:\ + +#define JAWS_KBUP_NAVIGATION \ switch (wParam) {\ case VK_SPACE:\ KeyboardMove(hwnd, message, wParam, lParam);\ break;\ }\ - break;\ #define JAWS_MENU_ITEMS \ case IDM_PossibleAttackMove: /*What can I possible attack from here */\ diff --git a/winboard/winboard.c b/winboard/winboard.c index 61cda89..a34b9cd 100644 --- a/winboard/winboard.c +++ b/winboard/winboard.c @@ -737,7 +737,8 @@ void ThawUI() #define JAWS_INIT #define JAWS_ARGS #define JAWS_ALT_INTERCEPT -#define JAWS_KB_NAVIGATION +#define JAWS_KBUP_NAVIGATION +#define JAWS_KBDOWN_NAVIGATION #define JAWS_MENU_ITEMS #define JAWS_SILENCE #define JAWS_REPLAY @@ -4573,6 +4574,7 @@ WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) char fileTitle[MSG_SIZ]; char buf[MSG_SIZ]; static SnapData sd; + static int peek=0; switch (message) { @@ -4600,7 +4602,23 @@ WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) MouseEvent(hwnd, message, wParam, lParam); break; - JAWS_KB_NAVIGATION + case WM_KEYUP: + if((char)wParam == '\b') { + ForwardEvent(); peek = 0; + } + + JAWS_KBUP_NAVIGATION + + break; + + case WM_KEYDOWN: + if((char)wParam == '\b') { + if(!peek) BackwardEvent(), peek = 1; + } + + JAWS_KBDOWN_NAVIGATION + + break; case WM_CHAR: