-
Notifications
You must be signed in to change notification settings - Fork 12
/
GameMode.cpp
244 lines (238 loc) · 6.66 KB
/
GameMode.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
#include "stdafx.h"
#include "data.h"
#include "chess.h"
#include "Resource.h"
#include "pregen.h"
void
SetGNUMode(){
//SetMenuEnables(GetMenu(pDis->DIS.hwndThis), gnuEnables);
}
void
SetNCPMode(){
//HMENU hmenu = GetMenu(hwndMain);
//SetMenuEnables(hmenu, ncpEnables);
//EnableMenuItem(GetSubMenu(hmenu, OPTIONS_POS), SOUNDS_POS, MF_BYPOSITION|MF_GRAYED);
//DrawMenuBar(hwndMain);
}
void
SetCmailMode()
{
//SetMenuEnables(GetMenu(hwndMain), cmailEnables);
}
void
SetICSMode()
{
//HMENU hmenu = GetMenu(hwndMain);
//SetMenuEnables(hmenu, icsEnables);
//EnableMenuItem(GetSubMenu(hmenu, OPTIONS_POS), ICS_POS,
// MF_BYPOSITION|MF_ENABLED);
#ifdef ZIPPY
if (appData.zippyPlay) {
SetMenuEnables(hmenu, zippyEnables);
}
#endif
}
void
SetMachineThinkingEnables(dispboard_t* DIS) { //ʹÒýÇ濪ʼÔËËãÆå²½
//HMENU hMenu = GetMenu(hwndMain);
//int flags = MF_BYCOMMAND|MF_ENABLED;
//SetMenuEnables(hMenu, machineThinkingEnables);
//if (DIS.gameMode == MachinePlaysBlack) {
// (void)EnableMenuItem(hMenu, IDM_MachineBlack, flags);
//}
//else if (DIS.gameMode == MachinePlaysWhite) {
// (void)EnableMenuItem(hMenu, IDM_MachineWhite, flags);
//}
//else if (DIS.gameMode == TwoMachinesPlay) {
// (void)EnableMenuItem(hMenu, IDM_TwoMachines, flags);
//}
}
void
SetTrainingModeOff(){
//int i;
//SetMenuEnables(GetMenu(hwndMain), trainingOffEnables);
//for (i = 0; i < N_BUTTONS; i++) {
// if (DIS.buttonDesc[i].hwnd != NULL)
// EnableWindow(DIS.buttonDesc[i].hwnd, TRUE);
//}
}
void
SetUserThinkingEnables(){
//SetMenuEnables(GetMenu(hwndMain), userThinkingEnables);
}
//LRESULT CALLBACK
//CommentDialog(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam){
// static HANDLE hwndText = NULL;
// int len, newSizeX, newSizeY, flags;
// static int sizeX, sizeY;
// char *str;
// RECT rect;
// MINMAXINFO *mmi;
//
// switch (message) {
// case WM_INITDIALOG: /* message: initialize dialog box */
// /* Initialize the dialog items */
// hwndText = GetDlgItem(hDlg, OPT_CommentText);
// SetDlgItemText(hDlg, OPT_CommentText, DIS.commentText);
// EnableWindow(GetDlgItem(hDlg, OPT_CancelComment), DIS.editComment);
// EnableWindow(GetDlgItem(hDlg, OPT_ClearComment), DIS.editComment);
// EnableWindow(GetDlgItem(hDlg, OPT_EditComment), !DIS.editComment);
// SendMessage((HWND)hwndText, EM_SETREADONLY, !DIS.editComment, 0);
// SetWindowText(hDlg, DIS.commentTitle);
// if (DIS.editComment) {
// SetFocus((HWND)hwndText);
// } else {
// SetFocus(GetDlgItem(hDlg, IDOK));
// }
// SendMessage(GetDlgItem(hDlg, OPT_CommentText),
// WM_SETFONT, (WPARAM)DIS.font[DIS.bsize][COMMENT_FONT]->hf,
// MAKELPARAM(FALSE, 0));
// /* Size and position the dialog */
// if (!DIS.commentDialog) {
// DIS.commentDialog = hDlg;
// flags = SWP_NOZORDER;
// GetClientRect(hDlg, &rect);
// sizeX = rect.right;
// sizeY = rect.bottom;
// if (DIS.commentX != CW_USEDEFAULT && DIS.commentY != CW_USEDEFAULT &&
// DIS.commentW != CW_USEDEFAULT && DIS.commentH != CW_USEDEFAULT) {
// WINDOWPLACEMENT wp;
// EnsureOnScreen(&DIS.commentX, &DIS.commentY);
// wp.length = sizeof(WINDOWPLACEMENT);
// wp.flags = 0;
// wp.showCmd = SW_SHOW;
// wp.ptMaxPosition.x = wp.ptMaxPosition.y = 0;
// wp.rcNormalPosition.left = DIS.commentX;
// wp.rcNormalPosition.right = DIS.commentX + DIS.commentW;
// wp.rcNormalPosition.top = DIS.commentY;
// wp.rcNormalPosition.bottom = DIS.commentY + DIS.commentH;
// SetWindowPlacement(hDlg, &wp);
//
// GetClientRect(hDlg, &rect);
// newSizeX = rect.right;
// newSizeY = rect.bottom;
// ResizeEditPlusButtons(hDlg, (HWND)hwndText, sizeX, sizeY,
// newSizeX, newSizeY);
// sizeX = newSizeX;
// sizeY = newSizeY;
// }
// }
// return FALSE;
//
// case WM_COMMAND: /* message: received a command */
// switch (LOWORD(wParam)) {
// case IDOK:
// if (DIS.editComment) {
// char *p, *q;
// /* Read changed options from the dialog box */
// hwndText = GetDlgItem(hDlg, OPT_CommentText);
// len = GetWindowTextLength((HWND)hwndText);
// str = (char *) malloc(len + 1);
// GetWindowText((HWND)hwndText, str, len + 1);
// p = q = str;
// while (*q) {
// if (*q == '\r')
// q++;
// else
// *p++ = *q++;
// }
// *p = NULLCHAR;
// ReplaceComment(DIS.commentIndex, str);
// free(str);
// }
// CommentPopDown();
// return TRUE;
//
// case IDCANCEL:
// case OPT_CancelComment:
// CommentPopDown();
// return TRUE;
//
// case OPT_ClearComment:
// SetDlgItemText(hDlg, OPT_CommentText, "");
// break;
//
// case OPT_EditComment:
// EditCommentEvent();
// return TRUE;
//
// default:
// break;
// }
// break;
//
// case WM_SIZE:
// newSizeX = LOWORD(lParam);
// newSizeY = HIWORD(lParam);
// ResizeEditPlusButtons(hDlg, (HWND)hwndText, sizeX, sizeY, newSizeX, newSizeY);
// sizeX = newSizeX;
// sizeY = newSizeY;
// break;
//
// case WM_GETMINMAXINFO:
// /* Prevent resizing window too small */
// mmi = (MINMAXINFO *) lParam;
// mmi->ptMinTrackSize.x = 100;
// mmi->ptMinTrackSize.y = 100;
// break;
// }
// return FALSE;
//}
//VOID
//EitherCommentPopUp(int index, char *title, char *str, BOOLEAN edit){
// FARPROC lpProc;
// char *p, *q;
//
// CheckMenuItem(GetMenu(hwndMain), IDM_EditComment, edit ? MF_CHECKED : MF_UNCHECKED);
//
// if (str == NULL) str = "";
// p = (char *) malloc(2 * strlen(str) + 2);
// q = p;
// while (*str) {
// if (*str == '\n') *q++ = '\r';
// *q++ = *str++;
// }
// *q = NULLCHAR;
// if (DIS.commentText != NULL) free(DIS.commentText);
//
// DIS.commentIndex = index;
// DIS.commentTitle = title;
// DIS.commentText = p;
// DIS.editComment = edit;
//
// if (DIS.commentDialog) {
// SendMessage(DIS.commentDialog, WM_INITDIALOG, 0, 0);
// if (!DIS.commentDialogUp) ShowWindow(DIS.commentDialog, SW_SHOW);
// } else {
// lpProc = MakeProcInstance((FARPROC)CommentDialog, hInst);
// CreateDialog(hInst, MAKEINTRESOURCE(DLG_EditComment),
// hwndMain, (DLGPROC)lpProc);
// FreeProcInstance(lpProc);
// }
// DIS.commentDialogUp = TRUE;
//}
//
//VOID
//CommentPopUp(char *title, char *str){
// HWND hwnd = GetActiveWindow();
// EitherCommentPopUp(0, title, str, FALSE);
// SetActiveWindow(hwnd);
//}
//VOID
//CommentPopDown(void){
// CheckMenuItem(GetMenu(hwndMain), IDM_EditComment, MF_UNCHECKED);
// if (DIS.commentDialog) {
// ShowWindow(DIS.commentDialog, SW_HIDE);
// }
// DIS.commentDialogUp = FALSE;
//}
void
SetTrainingModeOn(void){
//int i;
//SetMenuEnables(GetMenu(hwndMain), trainingOnEnables);
//for (i = 0; i < N_BUTTONS; i++) {
// if (buttonDesc[i].hwnd != NULL)
// EnableWindow(buttonDesc[i].hwnd, FALSE);
//}
//CommentPopDown();
}