\r
case IDM_EditProgs2:\r
LoadEnginePopUp(hwndMain);\r
+// EditTagsPopUp(secondChessProgramNames, &secondChessProgramNames);\r
break;\r
\r
case IDM_EditServers:\r
UciOptionsPopup(hwnd);\r
break;\r
\r
+ case IDM_Tourney:\r
+ TourneyPopup(hwnd);\r
+ break;\r
+\r
case IDM_IcsOptions:\r
IcsOptionsPopup(hwnd);\r
break;\r
{ IDM_Revert, MF_BYCOMMAND|MF_GRAYED },\r
{ IDM_Annotate, MF_BYCOMMAND|MF_GRAYED },\r
{ IDM_NewChat, MF_BYCOMMAND|MF_GRAYED },\r
+\r
+ // Needed to switch from ncp to GNU mode on Engine Load\r
+ { ACTION_POS, MF_BYPOSITION|MF_ENABLED },\r
+ { IDM_MachineWhite, MF_BYCOMMAND|MF_ENABLED },\r
+ { IDM_MachineBlack, MF_BYCOMMAND|MF_ENABLED },\r
+ { IDM_TwoMachines, MF_BYCOMMAND|MF_ENABLED },\r
+ { IDM_Match, MF_BYCOMMAND|MF_ENABLED },\r
+ { IDM_AnalysisMode, MF_BYCOMMAND|MF_ENABLED },\r
+ { IDM_AnalyzeFile, MF_BYCOMMAND|MF_ENABLED },\r
+ { IDM_Engine1Options, MF_BYCOMMAND|MF_ENABLED },\r
+ { IDM_Engine2Options, MF_BYCOMMAND|MF_ENABLED },\r
+ { IDM_TimeControl, MF_BYCOMMAND|MF_ENABLED },\r
+ { IDM_RetractMove, MF_BYCOMMAND|MF_ENABLED },\r
+ { IDM_MoveNow, MF_BYCOMMAND|MF_ENABLED },\r
+ { IDM_Hint, MF_BYCOMMAND|MF_ENABLED },\r
+ { IDM_Book, MF_BYCOMMAND|MF_ENABLED },\r
{ -1, -1 }\r
};\r
\r
{ IDM_MoveNow, MF_BYCOMMAND|MF_GRAYED },\r
{ IDM_Hint, MF_BYCOMMAND|MF_GRAYED },\r
{ IDM_Book, MF_BYCOMMAND|MF_GRAYED },\r
+ { IDM_EditProgs2, MF_BYCOMMAND|MF_GRAYED },\r
{ IDM_IcsOptions, MF_BYCOMMAND|MF_ENABLED },\r
{ IDM_Engine1Options, MF_BYCOMMAND|MF_GRAYED },\r
{ IDM_Engine2Options, MF_BYCOMMAND|MF_GRAYED },\r
{ IDM_Annotate, MF_BYCOMMAND|MF_GRAYED },\r
+ { IDM_Tourney, MF_BYCOMMAND|MF_GRAYED },\r
{ -1, -1 }\r
};\r
\r
#include "config.h"\r
\r
#include <windows.h>\r
+#include <Windowsx.h>\r
#include <stdio.h>\r
#include <string.h>\r
#include "common.h"\r
Option *activeList;\r
void InstallOK P((void));\r
typedef void ButtonCallback(HWND h);\r
+ButtonCallback *comboCallback;\r
\r
void\r
PrintOpt(int i, int right, Option *optionList)\r
breaks[layout/2] = lastType == Button ? 0 : 100;\r
layoutList[layout++] = -1;\r
layoutList[layout++] = nextOption - 1;\r
+ for(i=optionList[nextOption-1].min; i>0; i--) { // extra high text edit\r
+ layoutList[layout++] = -1;\r
+ layoutList[layout++] = -1;\r
+ }\r
} else if(nextType == Spin) {\r
// A spin will go in the next available position (right to left!). If it had to be prefixed with\r
// a check or combo, this next position must be to the right, and the prefix goes left to it.\r
case IDOK:\r
GetOptionValues(hDlg, activeCps, activeList);\r
EndDialog( hDlg, 0 );\r
- activeCps = NULL;\r
+ comboCallback = NULL; activeCps = NULL;\r
return TRUE;\r
\r
case IDCANCEL:\r
EndDialog( hDlg, 1 );\r
- activeCps = NULL;\r
+ comboCallback = NULL; activeCps = NULL;\r
return TRUE;\r
\r
default:\r
j = layoutList[(i - 2000)/2];\r
if(j == -2) {\r
char filter[] =\r
- "All files\0*.*\0BIN Files\0*.bin\0LOG Files\0*.log\0INI Files\0*.ini\0\0";\r
-/*\r
-{\r
- 'A','l','l',' ','F','i','l','e','s', 0,\r
- '*','.','*', 0,\r
- 'B','I','N',' ','F','i','l','e','s', 0,\r
- '*','.','b','i','n', 0,\r
- 0 };\r
-*/\r
+ "All files\0*.*\0Game files\0*.pgn;*.gam\0Position files\0*.fen;*.epd;*.pos\0"\r
+ "EXE files\0*.exe\0Tournament files (*.trn)\0*.trn\0"\r
+ "BIN Files\0*.bin\0LOG Files\0*.log\0INI Files\0*.ini\0\0";\r
OPENFILENAME ofn;\r
\r
safeStrCpy( buf, "" , sizeof( buf)/sizeof( buf[0]) );\r
ofn.hwndOwner = hDlg;\r
ofn.hInstance = hInst;\r
ofn.lpstrFilter = filter;\r
+ ofn.nFilterIndex = 1L + (activeCps ? 0 : activeList[layoutList[(i-2000)/2+1]].max);\r
ofn.lpstrFile = buf;\r
ofn.nMaxFile = sizeof(buf);\r
ofn.lpstrTitle = _("Choose File");\r
}\r
}\r
if(j < 0) break;\r
+ if(comboCallback && activeList[j].type == ComboBox && HIWORD(wParam) == CBN_SELCHANGE) {\r
+ (*comboCallback)(hDlg);\r
+ break;\r
+ } else\r
if( activeList[j].type == SaveButton)\r
GetOptionValues(hDlg, activeCps, activeList);\r
else if( activeList[j].type != Button) break;\r
\r
void AddOption(int x, int y, Control type, int i)\r
{\r
+ int extra;\r
\r
switch(type) {\r
case Slider:\r
break;\r
case TextBox:\r
AddControl(x, y+1, 95, 9, 0x0082, SS_ENDELLIPSIS | WS_VISIBLE | WS_CHILD, i);\r
- AddControl(x+95, y, 200, 11, 0x0081, ES_AUTOHSCROLL | WS_BORDER | WS_VISIBLE | WS_CHILD | WS_TABSTOP, i+1);\r
+ extra = 13*activeList[layoutList[i/2]].min;\r
+ AddControl(x+95, y, 200, 11+extra, 0x0081, ES_AUTOHSCROLL | WS_BORDER | WS_VISIBLE | WS_CHILD | WS_TABSTOP | \r
+ (extra ? ES_MULTILINE | WS_VSCROLL :0), i+1);\r
break;\r
case Label:\r
extra = activeList[layoutList[i/2]].value;\r
\r
GenericPopup(hwnd, installOptions);\r
}\r
+\r
+Boolean autoinc, twice;\r
+\r
+void MatchOK()\r
+{\r
+ if(autoinc) appData.loadGameIndex = appData.loadPositionIndex = -(twice + 1);\r
+ if(appData.participants) free(appData.participants);\r
+ appData.participants = strdup(engineName);\r
+ if(CreateTourney(appData.tourneyFile)) MatchEvent(2); \r
+// ScheduleDelayedEvent(MatchEvent(2), 10); // start tourney\r
+}\r
+\r
+Option tourneyOptions[] = {\r
+ { 0, 0, 4, NULL, (void*) &appData.tourneyFile, "", NULL, FileName, N_("Tournament file:") },\r
+ { 0, 1, 0, NULL, (void*) &engineChoice, (char*) (engineMnemonic+1), (engineMnemonic+1), ComboBox, N_("Select Engine:") },\r
+ { 0xD, 7, 0, NULL, (void*) &engineName, "", NULL, TextBox, "Tourney participants:" },\r
+ { 0, -1, 10, NULL, (void*) &appData.tourneyType, "", NULL, Spin, N_("Tourney type (0=RR, 1=gauntlet):") },\r
+ { 0, 0, 0, NULL, (void*) &appData.cycleSync, "", NULL, CheckBox, N_("Sync after cycle") },\r
+ { 0, 1, 1000000000, NULL, (void*) &appData.tourneyCycles, "", NULL, Spin, N_("Number of tourney cycles:") },\r
+ { 0, 0, 0, NULL, (void*) &appData.roundSync, "", NULL, CheckBox, N_("Sync after round") },\r
+ { 0, 1, 1000000000, NULL, (void*) &appData.defaultMatchGames, "", NULL, Spin, N_("Games per Match / Pairing:") },\r
+ { 0, 0, 1, NULL, (void*) &appData.loadGameFile, "", NULL, FileName, N_("Game File with Opening Lines:") },\r
+ { 0, -2, 1000000000, NULL, (void*) &appData.loadGameIndex, "", NULL, Spin, N_("Game Number:") },\r
+ { 0, 0, 2, NULL, (void*) &appData.loadPositionFile, "", NULL, FileName, N_("File with Start Positions:") },\r
+ { 0, -2, 1000000000, NULL, (void*) &appData.loadPositionIndex, "", NULL, Spin, N_("Position Number:") },\r
+ { 0, 0, 0, NULL, (void*) &autoinc, "", NULL, CheckBox, N_("Step through lines/positions in file") },\r
+ { 0, 0, 1000000000, NULL, (void*) &appData.rewindIndex, "", NULL, Spin, N_("Rewind after (0 = never):") },\r
+ { 0, 0, 0, NULL, (void*) &twice, "", NULL, CheckBox, N_("Use each line/position twice") },\r
+ { 0, 0, 1000000000, NULL, (void*) &appData.matchPause, "", NULL, Spin, N_("Pause between Games (ms):") },\r
+ { 0, 0, 0, NULL, (void*) &MatchOK, "", NULL, EndMark , "" }\r
+};\r
+\r
+void AddToTourney(HWND hDlg)\r
+{\r
+ char buf[MSG_SIZ];\r
+// GetDlgItemText( hDlg, 2001+2*3, buf, MSG_SIZ-3 ); // this gives the previous selection !!!\r
+// strncat(buf, "\r\n", MSG_SIZ);\r
+ int i = ComboBox_GetCurSel(GetDlgItem(hDlg, 2001+2*3));\r
+ snprintf(buf, MSG_SIZ, "%s\r\n", engineMnemonic[i+1]);\r
+ SendMessage( GetDlgItem(hDlg, 2001+2*5), EM_SETSEL, 0, 0 );\r
+ SendMessage( GetDlgItem(hDlg, 2001+2*5), EM_REPLACESEL, (WPARAM) FALSE, (LPARAM) buf );\r
+}\r
+\r
+void TourneyPopup(HWND hwnd)\r
+{\r
+ int n=0;\r
+\r
+ NamesToList(firstChessProgramNames, engineList, engineMnemonic);\r
+ comboCallback = &AddToTourney;\r
+ autoinc = appData.loadGameIndex < 0 || appData.loadPositionIndex < 0;\r
+ twice = TRUE;\r
+ while(engineList[n]) n++; tourneyOptions[1].max = n-1;\r
+ snprintf(title, MSG_SIZ, _("Tournament and Match Options"));\r
+\r
+ GenericPopup(hwnd, tourneyOptions);\r
+}\r