// BOARD_LEFT as 0, BOARD_RGHT and BOARD_HEIGHT as 8, and set holdingssizes to 0.\r
// You will need to build with jaws.rc in stead of winboard.rc.\r
\r
+// from resource.h\r
+\r
+#define IDM_PossibleAttackMove 1800\r
+#define IDM_PossibleAttacked 1801\r
+#define IDM_SayMachineMove 1802\r
+#define IDM_ReadRow 1803\r
+#define IDM_ReadColumn 1804\r
+#define IDM_SayCurrentPos 1805\r
+#define IDM_SayAllBoard 1806\r
+#define IDM_SayUpperDiagnols 1807\r
+#define IDM_SayLowerDiagnols 1808\r
+#define IDM_SayClockTime 1810\r
+#define IDM_SayWhosTurn 1811\r
+#define IDM_SayKnightMoves 1812\r
+#define ID_SHITTY_HI 1813\r
+#define IDM_SayWhitePieces 1816\r
+#define IDM_SayBlackPieces 1817\r
+\r
+\r
// from common.h, but 'extern' added to it, so the actual declaraton can remain in backend.c\r
\r
extern long whiteTimeRemaining, blackTimeRemaining, timeControl, timeIncrement;\r
\r
\r
// from winboard.c: all new routines\r
-\r
-#include "jfwapi.h"\r
-#include "jaws.h"\r
+#define JFWAPI __declspec(dllimport)\r
+JFWAPI BOOL WINAPI JFWSayString (LPCTSTR lpszStrinToSpeak, BOOL bInterrupt);\r
\r
typedef JFWAPI BOOL (WINAPI *PSAYSTRING)(LPCTSTR lpszStrinToSpeak, BOOL bInterrupt);\r
\r
static int timeflag;\r
static int suppressClocks = 0;\r
static int suppressOneKey = 0;\r
+static HANDLE hAccelJAWS;\r
+\r
+typedef struct { char *name; int code; } MenuItemDesc;\r
+\r
+MenuItemDesc menuItemJAWS[] = {\r
+{"Say Clock &Time\tAlt+T", IDM_SayClockTime },\r
+{"-", 0 },\r
+{"Say Last &Move\tAlt+M", IDM_SayMachineMove },\r
+{"Say W&ho's Turn\tAlt+X", IDM_SayWhosTurn },\r
+{"-", 0 },\r
+{"Say Complete &Position\tAlt+P",IDM_SayAllBoard },\r
+{"Say &White Pieces\tAlt+W", IDM_SayWhitePieces },\r
+{"Say &Black Pieces\tAlt+B", IDM_SayBlackPieces },\r
+{"Say Board &Rank\tAlt+R", IDM_ReadRow },\r
+{"Say Board &File\tAlt+F", IDM_ReadColumn },\r
+{"-", 0 },\r
+{"Say &Upper Diagonals\tAlt+U", IDM_SayUpperDiagnols },\r
+{"Say &Lower Diagonals\tAlt+L", IDM_SayLowerDiagnols },\r
+{"Say K&night Moves\tAlt+N", IDM_SayKnightMoves },\r
+{"Say Current &Square\tAlt+S", IDM_SayCurrentPos },\r
+{"Say &Attacks\tAlt+A", IDM_PossibleAttackMove },\r
+{"Say Attacke&d\tAlt+D", IDM_PossibleAttacked },\r
+{NULL, 0}\r
+};\r
+\r
+ACCEL acceleratorsJAWS[] = {\r
+{FVIRTKEY|FALT, 'T', IDM_SayClockTime },\r
+{FVIRTKEY|FALT, 'M', IDM_SayMachineMove },\r
+{FVIRTKEY|FALT, 'X', IDM_SayWhosTurn },\r
+{FVIRTKEY|FALT, 'P', IDM_SayAllBoard },\r
+{FVIRTKEY|FALT, 'W', IDM_SayWhitePieces },\r
+{FVIRTKEY|FALT, 'B', IDM_SayBlackPieces },\r
+{FVIRTKEY|FALT, 'R', IDM_ReadRow },\r
+{FVIRTKEY|FALT, 'F', IDM_ReadColumn },\r
+{FVIRTKEY|FALT, 'U', IDM_SayUpperDiagnols },\r
+{FVIRTKEY|FALT, 'L', IDM_SayLowerDiagnols },\r
+{FVIRTKEY|FALT, 'N', IDM_SayKnightMoves },\r
+{FVIRTKEY|FALT, 'S', IDM_SayCurrentPos },\r
+{FVIRTKEY|FALT, 'A', IDM_PossibleAttackMove },\r
+{FVIRTKEY|FALT, 'D', IDM_PossibleAttacked }\r
+};\r
+\r
+void\r
+AdaptMenu()\r
+{\r
+ HMENU menuMain, menuJAWS;\r
+ MENUBARINFO helpMenuInfo;\r
+ int e, i;\r
+\r
+ helpMenuInfo.cbSize = sizeof(helpMenuInfo);\r
+ menuMain = GetMenu(hwndMain);\r
+ if(appData.debugMode) fprintf(debugFP, "hwndMain: %8x %8x\n", hwndMain, menuMain);\r
+ menuJAWS = CreatePopupMenu();\r
+ \r
+ for(i=0; menuItemJAWS[i].name; i++) {\r
+ if(menuItemJAWS[i].name[0] == '-') \r
+ AppendMenu(menuJAWS, MF_SEPARATOR, (UINT_PTR) 0, NULL);\r
+ else AppendMenu(menuJAWS, MF_ENABLED|MF_STRING, \r
+ (UINT_PTR) menuItemJAWS[i].code, (LPCTSTR) menuItemJAWS[i].name);\r
+ }\r
+ InsertMenu(menuMain, 5, MF_BYPOSITION|MF_POPUP|MF_ENABLED|MF_STRING, \r
+ (UINT_PTR) menuJAWS, "&JAWS");\r
+ oldMenuItemState[6] = oldMenuItemState[5];\r
+ DrawMenuBar(hwndMain);\r
+}\r
\r
BOOL\r
InitJAWS()\r
}\r
\r
{\r
- // [HGM] kludge to reduce need for modification of winboard.c: mak tinyLayout menu identical\r
+ // [HGM] kludge to reduce need for modification of winboard.c: make tinyLayout menu identical\r
// to standard layout, so that code for switching between them does not have to be deleted\r
- HMENU hmenu = GetMenu(hwndMain);\r
int i;\r
\r
+ AdaptMenu();\r
menuBarText[0][5] = "&JAWS";\r
for(i=0; i<7; i++) menuBarText[1][i] = menuBarText[0][i];\r
- for (i=0; menuBarText[tinyLayout][i]; i++) {\r
- ModifyMenu(hmenu, i, MF_STRING|MF_BYPOSITION|MF_POPUP, \r
- (UINT)GetSubMenu(hmenu, i), menuBarText[tinyLayout][i]);\r
- }\r
- DrawMenuBar(hwndMain);\r
}\r
\r
+ hAccelJAWS = CreateAcceleratorTable(acceleratorsJAWS, 14);\r
+\r
/* initialize cursor position */\r
fromX = fromY = 0;\r
SetHighlights(fromX, fromY, -1, -1);\r
SayString(xchar, FALSE);\r
SayString(ynum, FALSE);\r
SayString(piece, FALSE);\r
- if((fromX-BOARD_LEFT) ^ fromY)\r
- SayString("on a dark square",FALSE);\r
- else \r
+ if(((fromX-BOARD_LEFT) ^ fromY)&1)\r
SayString("on a light square",FALSE);\r
+ else \r
+ SayString("on a dark square",FALSE);\r
\r
PossibleAttacked();\r
return;\r
\\r
\r
\r
+#define JAWS_ACCEL \\r
+ !(!frozen && TranslateAccelerator(hwndMain, hAccelJAWS, &msg)) &&\r
+\r
#define JAWS_INIT if (!InitJAWS()) return (FALSE);\r
\r
#define JAWS_DELETE(X)\r
\r
#define JAWS_SILENCE if(suppressClocks) return;\r
\r
+#define JAWS_COPYRIGHT \\r
+ SetDlgItemText(hDlg, OPT_MESS, "Auditory/Keyboard Enhancements By: Ed Rodriguez (sort of)");\r
+\r
#define SAY(S) SayString((S), FALSE)\r
\r
#define SAYMACHINEMOVE() SayMachineMove(0)\r
\r
// After inclusion of this file somewhere early in winboard.c, the remaining part of the patch\r
// is scattered over winboard.c for actually calling the routines.\r
-//\r
-// * move fromX, fromY declaration to front, before incusion of this file. (Can be permanent change in winboard.c.)\r
-// * call InitJAWS(), after calling InitIntance(). (Using JAWS_INIT macro)\r
-// * add keyboard cases in main switch of WndProc, though JAWS_KB_NAVIGATION above, e.g. before WM_CHAR case.\r
-// * change the WM_CHAR case of same switch from "if(appData.icsActive)" to "if(appData.icsActive JAWS_IF_TAB)"\r
-// * add new menu cases in WM_COMMAND case of WndProc, e.g. before IDM_Forward. (throug macro defined above)\r
-// * add SAYMACHINEMOVE(); at the end of DisplayMessage();\r
-// * add SAY("board"); in WM_CHAR case of ConsoleTextSubclass, just before "SetFocus(buttondesc..."\r