VOID NewVariantPopup(HWND hwnd);\r
int FinishMove P((ChessMove moveType, int fromX, int fromY, int toX, int toY,\r
/*char*/int promoChar));\r
-void AnimateAtomicCapture(int fromX, int fromY, int toX, int toY, int nFrames);\r
void DisplayMove P((int moveNumber));\r
Boolean ParseFEN P((Board board, int *blackPlaysFirst, char *fen));\r
void ChatPopUp P((char *s));\r
HPALETTE hPal;\r
ColorClass currentColorClass;\r
\r
+static HWND savedHwnd;\r
HWND hCommPort = NULL; /* currently open comm port */\r
static HWND hwndPause; /* pause button */\r
static HBITMAP pieceBitmap[3][(int) BlackPawn]; /* [HGM] nr of bitmaps referred to bP in stead of wK */\r
#define ABOUTBOX2 -1\r
\r
int dialogItems[][40] = {\r
-{ ABOUTBOX, IDOK, 400 }, \r
+{ ABOUTBOX, IDOK, OPT_MESS, 400 }, \r
{ DLG_TimeControl, IDC_Babble, OPT_TCUseMoves, OPT_TCUseInc, OPT_TCUseFixed, \r
OPT_TCtext1, OPT_TCtext2, OPT_TCitext1, OPT_TCitext2, OPT_TCftext, GPB_Factors, IDC_Factor1, IDC_Factor2, IDOK, IDCANCEL }, \r
{ DLG_LoadOptions, OPT_Autostep, OPT_AStext1, IDOK, IDCANCEL }, \r
OPT_AutoFlipView, OPT_ShowButtonBar, OPT_AutoRaiseBoard, OPT_ShowCoordinates,\r
OPT_Blindfold, OPT_ShowThinking, OPT_HighlightDragging, OPT_TestLegality,\r
OPT_SaveExtPGN, OPT_HideThinkFromHuman, OPT_ExtraInfoInMoveHistory,\r
- OPT_HighlightMoveArrow, OPT_AutoLogo }, \r
+ OPT_HighlightMoveArrow, OPT_AutoLogo ,OPT_SmartMove }, \r
{ DLG_IcsOptions, IDOK, IDCANCEL, OPT_AutoComment, OPT_AutoKibitz, OPT_AutoObserve,\r
OPT_GetMoveList, OPT_LocalLineEditing, OPT_QuietPlay, OPT_SeekGraph, OPT_AutoRefresh,\r
OPT_BgObserve, OPT_DualBoard, OPT_Premove, OPT_PremoveWhite, OPT_PremoveBlack,\r
OPT_VariantBughouse, OPT_VariantTwilight, OPT_VariantShogi, OPT_VariantSuper,\r
OPT_VariantKnightmate, OPT_VariantBerolina, OPT_VariantCylinder, OPT_VariantFairy,\r
OPT_VariantMakruk, OPT_VariantGothic, OPT_VariantCapablanca, OPT_VariantJanus,\r
- OPT_VariantCRC, OPT_VariantFalcon, OPT_VariantCourier, OPT_VariantGreat,\r
+ OPT_VariantCRC, OPT_VariantFalcon, OPT_VariantCourier, OPT_VariantGreat, OPT_VariantSChess,\r
OPT_VariantShatranj, OPT_VariantXiangqi, GPB_Variant, GPB_Board, IDC_Height,\r
IDC_Width, IDC_Hand, IDC_Pieces, IDC_Def }, \r
{ DLG_Fonts, IDOK, IDCANCEL, OPT_ChooseClockFont, OPT_ChooseMessageFont,\r
static int lastChecked;\r
static char oldLanguage[MSG_SIZ], *menuText[10][30];\r
extern int tinyLayout;\r
-extern char * menuBarText[][8];\r
+extern char * menuBarText[][10];\r
\r
void\r
LoadLanguageFile(char *name)\r
{ // return the translation of the given string\r
// efficiency can be improved a lot...\r
int i=0;\r
-if(appData.debugMode) fprintf(debugFP, "T_(%s)\n", s);\r
+//if(appData.debugMode) fprintf(debugFP, "T_(%s)\n", s);\r
if(!barbaric) return s;\r
if(!s) return ""; // sanity\r
while(english[i]) {\r
{ // translate all text items in the given dialog\r
int i=0, j, k;\r
char buf[MSG_SIZ], *s;\r
-//if(appData.debugMode) fprintf(debugFP, "Translate(%d)\n", dialogID);\r
if(!barbaric) return;\r
while(dialogItems[i][0] && dialogItems[i][0] != dialogID) i++; // find the dialog description\r
if(dialogItems[i][0] != dialogID) return; // unknown dialog, should not happen\r
GetWindowText( hDlg, buf, MSG_SIZ );\r
s = T_(buf);\r
-if(appData.debugMode) fprintf(debugFP, "WindowText '%s' -> '%s'\n", buf, s);\r
if(strcmp(buf, s)) SetWindowText(hDlg, s); // replace by translated string (if different)\r
for(j=1; k=dialogItems[i][j]; j++) { // translate all listed dialog items\r
GetDlgItemText(hDlg, k, buf, MSG_SIZ);\r
}\r
}\r
\r
+HMENU\r
+TranslateOneMenu(int i, HMENU subMenu)\r
+{\r
+ int j;\r
+ static MENUITEMINFO info;\r
+\r
+ info.cbSize = sizeof(MENUITEMINFO);\r
+ info.fMask = MIIM_STATE | MIIM_TYPE;\r
+ for(j=GetMenuItemCount(subMenu)-1; j>=0; j--){\r
+ char buf[MSG_SIZ];\r
+ info.dwTypeData = buf;\r
+ info.cch = sizeof(buf);\r
+ GetMenuItemInfo(subMenu, j, TRUE, &info);\r
+ if(i < 10) {
+ if(menuText[i][j]) safeStrCpy(buf, menuText[i][j], sizeof(buf)/sizeof(buf[0]) );\r
+ else menuText[i][j] = strdup(buf); // remember original on first change\r
+ }\r
+ if(buf[0] == NULLCHAR) continue;\r
+ info.dwTypeData = T_(buf);\r
+ info.cch = strlen(buf)+1;\r
+ SetMenuItemInfo(subMenu, j, TRUE, &info);\r
+ }\r
+ return subMenu;\r
+}\r
+\r
void\r
TranslateMenus(int addLanguage)\r
{\r
- int i, j;\r
+ int i;\r
WIN32_FIND_DATA fileData;\r
HANDLE hFind;\r
#define IDM_English 1895\r
HMENU subMenu = GetSubMenu(mainMenu, i);\r
ModifyMenu(mainMenu, i, MF_STRING|MF_BYPOSITION|MF_POPUP|EnableMenuItem(mainMenu, i, MF_BYPOSITION),\r
(UINT) subMenu, T_(menuBarText[tinyLayout][i]));\r
- for(j=GetMenuItemCount(subMenu)-1; j>=0; j--){\r
- char buf[MSG_SIZ];\r
- UINT k = GetMenuItemID(subMenu, j);\r
- if(menuText[i][j])
- safeStrCpy(buf, menuText[i][j], sizeof(buf)/sizeof(buf[0]) ); else {\r
- GetMenuString(subMenu, j, buf, MSG_SIZ, MF_BYPOSITION);\r
- menuText[i][j] = strdup(buf); // remember original on first change\r
- }\r
- if(buf[0] == NULLCHAR) continue;\r
-//fprintf(debugFP, "menu(%d,%d) = %s (%08x, %08x) %d\n", i, j, buf, mainMenu, subMenu, k);\r
- ModifyMenu(subMenu, j, MF_STRING|MF_BYPOSITION\r
- |CheckMenuItem(subMenu, j, MF_BYPOSITION)\r
- |EnableMenuItem(subMenu, j, MF_BYPOSITION), k, T_(buf));\r
- }\r
+ TranslateOneMenu(i, subMenu);\r
}\r
DrawMenuBar(hwndMain);\r
}\r
};\r
\r
int tinyLayout = 0, smallLayout = 0;\r
-#define MENU_BAR_ITEMS 7\r
+#define MENU_BAR_ITEMS 9\r
char *menuBarText[2][MENU_BAR_ITEMS+1] = {\r
- { N_("&File"), N_("&Mode"), N_("&Action"), N_("&Step"), N_("&Options"), N_("&Help"), NULL },\r
- { N_("&F"), N_("&M"), N_("&A"), N_("&S"), N_("&O"), N_("&H"), NULL },\r
+ { N_("&File"), N_("&Edit"), N_("&View"), N_("&Mode"), N_("&Action"), N_("E&ngine"), N_("&Options"), N_("&Help"), NULL },\r
+ { N_("&F"), N_("&E"), N_("&V"), N_("&M"), N_("&A"), N_("&N"), N_("&O"), N_("&H"), NULL },\r
};\r
\r
\r
}\r
\r
JAWS_INIT\r
+ TranslateMenus(1);\r
\r
// InitCommonControlsEx(&ex);\r
InitCommonControls();\r
snprintf(oldUserName, MSG_SIZ, "logos\\%s.bmp", curName);\r
userLogo = LoadImage( 0, oldUserName, IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE ); \r
safeStrCpy(oldUserName, curName, sizeof(oldUserName)/sizeof(oldUserName[0]) );\r
+ if(userLogo == NULL)\r
+ userLogo = LoadImage( 0, "logos\\dummy.bmp", IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE ); \r
}\r
}\r
}\r
}\r
\r
InitDrawingSizes(boardSize, 0);\r
- TranslateMenus(1);\r
InitMenuChecks();\r
buttonCount = GetSystemMetrics(SM_CMOUSEBUTTONS);\r
\r
pieceBitmap[2][WhiteBishop] = DoLoadBitmap(hInst, "b", squareSize, "w");\r
pieceBitmap[2][WhiteRook] = DoLoadBitmap(hInst, "r", squareSize, "w");\r
pieceBitmap[2][WhiteKing] = DoLoadBitmap(hInst, "k", squareSize, "w");\r
- if( gameInfo.variant == VariantShogi && (squareSize==72 || squareSize==49)) {\r
+ if( gameInfo.variant == VariantShogi && squareSize <= 72 && squareSize >= 33) {\r
// in Shogi, Hijack the unused Queen for Lance\r
pieceBitmap[0][WhiteQueen] = DoLoadBitmap(hInst, "l", squareSize, "s");\r
pieceBitmap[1][WhiteQueen] = DoLoadBitmap(hInst, "l", squareSize, "o");\r
pieceBitmap[1][WhiteLance] = DoLoadBitmap(hInst, "l", squareSize, "o");\r
pieceBitmap[2][WhiteLance] = DoLoadBitmap(hInst, "l", squareSize, "w");\r
} else { // Smirf-like\r
- pieceBitmap[0][WhiteAngel] = DoLoadBitmap(hInst, "aa", squareSize, "s");\r
- pieceBitmap[1][WhiteAngel] = DoLoadBitmap(hInst, "aa", squareSize, "o");\r
- pieceBitmap[2][WhiteAngel] = DoLoadBitmap(hInst, "aa", squareSize, "w");\r
+ if(gameInfo.variant == VariantSChess) {\r
+ pieceBitmap[0][WhiteAngel] = DoLoadBitmap(hInst, "v", squareSize, "s");\r
+ pieceBitmap[1][WhiteAngel] = DoLoadBitmap(hInst, "v", squareSize, "o");\r
+ pieceBitmap[2][WhiteAngel] = DoLoadBitmap(hInst, "v", squareSize, "w");\r
+ } else {\r
+ pieceBitmap[0][WhiteAngel] = DoLoadBitmap(hInst, "aa", squareSize, "s");\r
+ pieceBitmap[1][WhiteAngel] = DoLoadBitmap(hInst, "aa", squareSize, "o");\r
+ pieceBitmap[2][WhiteAngel] = DoLoadBitmap(hInst, "aa", squareSize, "w");\r
+ }\r
}\r
if(gameInfo.variant == VariantGothic) { // Vortex-like\r
pieceBitmap[0][WhiteMarshall] = DoLoadBitmap(hInst, "cv", squareSize, "s");\r
pieceBitmap[1][WhiteMarshall] = DoLoadBitmap(hInst, "cv", squareSize, "o");\r
pieceBitmap[2][WhiteMarshall] = DoLoadBitmap(hInst, "cv", squareSize, "w");\r
+ } else if(gameInfo.variant == VariantSChess && (squareSize == 49 || squareSize == 72)) {\r
+ pieceBitmap[0][WhiteMarshall] = DoLoadBitmap(hInst, "e", squareSize, "s");\r
+ pieceBitmap[1][WhiteMarshall] = DoLoadBitmap(hInst, "e", squareSize, "o");\r
+ pieceBitmap[2][WhiteMarshall] = DoLoadBitmap(hInst, "e", squareSize, "w");\r
} else { // WinBoard standard\r
pieceBitmap[0][WhiteMarshall] = DoLoadBitmap(hInst, "c", squareSize, "s");\r
pieceBitmap[1][WhiteMarshall] = DoLoadBitmap(hInst, "c", squareSize, "o");\r
\r
/* [AS] Arrow highlighting support */\r
\r
-static int A_WIDTH = 5; /* Width of arrow body */\r
+static double A_WIDTH = 5; /* Width of arrow body */\r
\r
#define A_HEIGHT_FACTOR 6 /* Length of arrow "point", relative to body width */\r
#define A_WIDTH_FACTOR 3 /* Width of arrow "point", relative to body width */\r
if( d_x == s_x ) {\r
int h = (d_y > s_y) ? +A_WIDTH*A_HEIGHT_FACTOR : -A_WIDTH*A_HEIGHT_FACTOR;\r
\r
- arrow[0].x = s_x + A_WIDTH;\r
+ arrow[0].x = s_x + A_WIDTH + 0.5;\r
arrow[0].y = s_y;\r
\r
- arrow[1].x = s_x + A_WIDTH;\r
+ arrow[1].x = s_x + A_WIDTH + 0.5;\r
arrow[1].y = d_y - h;\r
\r
- arrow[2].x = s_x + A_WIDTH*A_WIDTH_FACTOR;\r
+ arrow[2].x = arrow[1].x + A_WIDTH*(A_WIDTH_FACTOR-1) + 0.5;\r
arrow[2].y = d_y - h;\r
\r
arrow[3].x = d_x;\r
arrow[3].y = d_y;\r
\r
- arrow[4].x = s_x - A_WIDTH*A_WIDTH_FACTOR;\r
- arrow[4].y = d_y - h;\r
-\r
- arrow[5].x = s_x - A_WIDTH;\r
+ arrow[5].x = arrow[1].x - 2*A_WIDTH + 0.5;\r
arrow[5].y = d_y - h;\r
\r
- arrow[6].x = s_x - A_WIDTH;\r
+ arrow[4].x = arrow[5].x - A_WIDTH*(A_WIDTH_FACTOR-1) + 0.5;\r
+ arrow[4].y = d_y - h;\r
+\r
+ arrow[6].x = arrow[1].x - 2*A_WIDTH + 0.5;\r
arrow[6].y = s_y;\r
}\r
else if( d_y == s_y ) {\r
int w = (d_x > s_x) ? +A_WIDTH*A_HEIGHT_FACTOR : -A_WIDTH*A_HEIGHT_FACTOR;\r
\r
arrow[0].x = s_x;\r
- arrow[0].y = s_y + A_WIDTH;\r
+ arrow[0].y = s_y + A_WIDTH + 0.5;\r
\r
arrow[1].x = d_x - w;\r
- arrow[1].y = s_y + A_WIDTH;\r
+ arrow[1].y = s_y + A_WIDTH + 0.5;\r
\r
arrow[2].x = d_x - w;\r
- arrow[2].y = s_y + A_WIDTH*A_WIDTH_FACTOR;\r
+ arrow[2].y = arrow[1].y + A_WIDTH*(A_WIDTH_FACTOR-1) + 0.5;\r
\r
arrow[3].x = d_x;\r
arrow[3].y = d_y;\r
\r
- arrow[4].x = d_x - w;\r
- arrow[4].y = s_y - A_WIDTH*A_WIDTH_FACTOR;\r
-\r
arrow[5].x = d_x - w;\r
- arrow[5].y = s_y - A_WIDTH;\r
+ arrow[5].y = arrow[1].y - 2*A_WIDTH + 0.5;\r
+\r
+ arrow[4].x = d_x - w;\r
+ arrow[4].y = arrow[5].y - A_WIDTH*(A_WIDTH_FACTOR-1) + 0.5;\r
\r
arrow[6].x = s_x;\r
- arrow[6].y = s_y - A_WIDTH;\r
+ arrow[6].y = arrow[1].y - 2*A_WIDTH + 0.5;\r
}\r
else {\r
/* [AS] Needed a lot of paper for this! :-) */\r
arrow[0].x = Round(x - j);\r
arrow[0].y = Round(y + j*dx);\r
\r
- arrow[1].x = Round(x + j);\r
- arrow[1].y = Round(y - j*dx);\r
+ arrow[1].x = Round(arrow[0].x + 2*j); // [HGM] prevent width to be affected by rounding twice\r
+ arrow[1].y = Round(arrow[0].y - 2*j*dx);\r
\r
if( d_x > s_x ) {\r
x = (double) d_x - k;\r
y = (double) d_y + k*dy;\r
}\r
\r
- arrow[2].x = Round(x + j);\r
- arrow[2].y = Round(y - j*dx);\r
+ x = Round(x); y = Round(y); // [HGM] make sure width of shaft is rounded the same way on both ends\r
\r
- arrow[3].x = Round(x + j*A_WIDTH_FACTOR);\r
- arrow[3].y = Round(y - j*A_WIDTH_FACTOR*dx);\r
+ arrow[6].x = Round(x - j);\r
+ arrow[6].y = Round(y + j*dx);\r
+\r
+ arrow[2].x = Round(arrow[6].x + 2*j);\r
+ arrow[2].y = Round(arrow[6].y - 2*j*dx);\r
+\r
+ arrow[3].x = Round(arrow[2].x + j*(A_WIDTH_FACTOR-1));\r
+ arrow[3].y = Round(arrow[2].y - j*(A_WIDTH_FACTOR-1)*dx);\r
\r
arrow[4].x = d_x;\r
arrow[4].y = d_y;\r
\r
- arrow[5].x = Round(x - j*A_WIDTH_FACTOR);\r
- arrow[5].y = Round(y + j*A_WIDTH_FACTOR*dx);\r
-\r
- arrow[6].x = Round(x - j);\r
- arrow[6].y = Round(y + j*dx);\r
+ arrow[5].x = Round(arrow[6].x - j*(A_WIDTH_FACTOR-1));\r
+ arrow[5].y = Round(arrow[6].y + j*(A_WIDTH_FACTOR-1)*dx);\r
}\r
\r
Polygon( hdc, arrow, 7 );\r
SquareToPos( d_row, d_col, &d_x, &d_y);\r
\r
if( d_y > s_y ) {\r
- d_y += squareSize / 4;\r
+ d_y += squareSize / 2 - squareSize / 4; // [HGM] round towards same centers on all sides!\r
}\r
else if( d_y < s_y ) {\r
- d_y += 3 * squareSize / 4;\r
+ d_y += squareSize / 2 + squareSize / 4;\r
}\r
else {\r
d_y += squareSize / 2;\r
}\r
\r
if( d_x > s_x ) {\r
- d_x += squareSize / 4;\r
+ d_x += squareSize / 2 - squareSize / 4;\r
}\r
else if( d_x < s_x ) {\r
- d_x += 3 * squareSize / 4;\r
+ d_x += squareSize / 2 + squareSize / 4;\r
}\r
else {\r
d_x += squareSize / 2;\r
s_y += squareSize / 2;\r
\r
/* Adjust width */\r
- A_WIDTH = squareSize / 14;\r
+ A_WIDTH = squareSize / 14.; //[HGM] make float\r
\r
/* Draw */\r
stLB.lbStyle = BS_SOLID;\r
if(--board[dragInfo.from.y][dragInfo.from.x-1] == 0 )\r
board[dragInfo.from.y][dragInfo.from.x] = EmptySquare;\r
} else \r
- board[dragInfo.from.y][dragInfo.from.x] = EmptySquare;\r
+ board[dragInfo.from.y][dragInfo.from.x] = gatingPiece;\r
}\r
\r
/* Figure out which squares need updating by comparing the \r
if(explodeInfo.radius) { // [HGM] atomic\r
HBRUSH oldBrush;\r
int x, y, r=(explodeInfo.radius * squareSize)/100;\r
+ ChessSquare piece = board[explodeInfo.fromY][explodeInfo.fromX];\r
board[explodeInfo.fromY][explodeInfo.fromX] = EmptySquare; // suppress display of capturer\r
SquareToPos(explodeInfo.toY, explodeInfo.toX, &x, &y);\r
x += squareSize/2;\r
DrawHighlightsOnDC(hdcmem, &highlightInfo, HIGHLIGHT_PEN);\r
DrawHighlightsOnDC(hdcmem, &premoveHighlightInfo, PREMOVE_PEN);\r
DrawBoardOnDC(hdcmem, board, tmphdc);\r
+ board[explodeInfo.fromY][explodeInfo.fromX] = piece;\r
oldBrush = SelectObject(hdcmem, explodeBrush);\r
Ellipse(hdcmem, x-r, y-r, x+r, y+r);\r
SelectObject(hdcmem, oldBrush);\r
x = BOARD_WIDTH - 1 - x;\r
}\r
\r
+ shiftKey = GetKeyState(VK_SHIFT) < 0; // [HGM] remember last shift status\r
+\r
switch (message) {\r
case WM_LBUTTONDOWN:\r
if (PtInRect((LPRECT) &whiteRect, pt)) {\r
ShowWindow(GetDlgItem(hDlg, PB_Bishop), \r
gameInfo.variant != VariantShogi ?\r
SW_SHOW : SW_HIDE);\r
- ShowWindow(GetDlgItem(hDlg, IDC_Yes), \r
- gameInfo.variant == VariantShogi ?\r
- SW_SHOW : SW_HIDE);\r
- ShowWindow(GetDlgItem(hDlg, IDC_No), \r
- gameInfo.variant == VariantShogi ?\r
- SW_SHOW : SW_HIDE);\r
+ if(gameInfo.variant == VariantShogi) {\r
+ SetDlgItemText(hDlg, PB_Queen, "YES");\r
+ SetDlgItemText(hDlg, PB_Knight, "NO");\r
+ SetWindowText(hDlg, "Promote?");\r
+ }\r
ShowWindow(GetDlgItem(hDlg, IDC_Centaur), \r
gameInfo.variant == VariantSuper ?\r
SW_SHOW : SW_HIDE);\r
break;\r
\r
case IDM_Match: // [HGM] match: flows into next case, after setting Match Mode and nr of Games\r
- if(gameMode != BeginningOfGame) break; // allow menu item to remain enabled for better mode highligting\r
+ if(gameMode != BeginningOfGame) { // allow menu item to remain enabled for better mode highligting\r
+ DisplayError(_("You can only start a match from the initial position."), 0); break;\r
+ }\r
matchMode = 2;// distinguish from command-line-triggered case (matchMode=1)\r
appData.matchGames = appData.defaultMatchGames;\r
matchGame = 1;\r
break;\r
\r
case IDM_EditGame:\r
+ case IDM_EditGame2:\r
EditGameEvent();\r
SAY("edit game");\r
break;\r
\r
case IDM_EditPosition:\r
+ case IDM_EditPosition2:\r
EditPositionEvent();\r
SAY("enter a FEN string or setup a position on the board using the control R pop up menu");\r
break;\r
ShowGameListProc();\r
break;\r
\r
+ case IDM_EditProgs1:\r
+ EditTagsPopUp(firstChessProgramNames, &firstChessProgramNames);\r
+ break;\r
+\r
+ case IDM_EditProgs2:\r
+ EditTagsPopUp(secondChessProgramNames, &secondChessProgramNames);\r
+ break;\r
+\r
+ case IDM_EditServers:\r
+ EditTagsPopUp(icsNames, &icsNames);\r
+ break;\r
+\r
case IDM_EditTags:\r
+ case IDM_Tags:\r
EditTagsProc();\r
break;\r
\r
case IDM_EditComment:\r
+ case IDM_Comment:\r
if (commentUp && editComment) {\r
CommentPopDown();\r
} else {\r
break;\r
\r
case IDM_Engine2Options:\r
+ savedHwnd = hwnd;\r
+ if(WaitForSecond(SettingsMenuIfReady)) break;\r
EngineOptionsPopup(hwnd, &second);\r
break;\r
\r
\r
if (fileName == NULL) fileName = buf1;\r
if (defName == NULL) {\r
- safeStrCpy(fileName, "*.", sizeof(fileName)/sizeof(fileName[0]) );\r
+ safeStrCpy(fileName, "*.", 3 );\r
strcat(fileName, defExt);\r
} else {\r
- safeStrCpy(fileName, defName, sizeof(fileName)/sizeof(fileName[0]) );\r
+ safeStrCpy(fileName, defName, MSG_SIZ );\r
}\r
- if (fileTitle) safeStrCpy(fileTitle, "", sizeof(fileTitle)/sizeof(fileTitle[0]) );\r
+ if (fileTitle) safeStrCpy(fileTitle, "", MSG_SIZ );\r
if (number) *number = 0;\r
\r
openFileName.lStructSize = sizeof(OPENFILENAME);\r
* menu that TrackPopupMenu displays.\r
*/\r
hmenuTrackPopup = GetSubMenu(hmenu, 0);\r
+ TranslateOneMenu(10, hmenuTrackPopup);\r
\r
SetMenuDefaultItem(hmenuTrackPopup, def, FALSE);\r
\r
FARPROC lpProc;\r
char *p, *q;\r
\r
- CheckMenuItem(GetMenu(hwndMain), IDM_EditComment, edit ? MF_CHECKED : MF_UNCHECKED);\r
+ CheckMenuItem(GetMenu(hwndMain), IDM_Comment, edit ? MF_CHECKED : MF_UNCHECKED);\r
\r
if (str == NULL) str = "";\r
p = (char *) malloc(2 * strlen(str) + 2);\r
\r
case WM_COMMAND:\r
switch (LOWORD(wParam)) {\r
- case IDOK:\r
+ case IDOK:
+ shiftKey = GetKeyState(VK_SHIFT) < 0; // [HGM] remember last shift status\r
GetDlgItemText(hDlg, OPT_Move, move, sizeof(move));\r
{ int n; Board board;\r
// [HGM] FENedit\r
SendMessage(hwnd, EM_GETSELTEXT, 0, (LPARAM) name);\r
}\r
if (immediate) {\r
+ if(strstr(command, "%s")) snprintf(buf, MSG_SIZ, command, name); else\r
snprintf(buf, MSG_SIZ, "%s %s", command, name);\r
SetWindowText(hInput, buf);\r
SendMessage(hInput, WM_CHAR, '\r', 0);\r
SendMessage(hInput, message, wParam, lParam);\r
}\r
return 0;\r
- } // [HGM] navigate: for Ctrl+R, flow into nex case (moved up here) to summon up menu\r
+ } // [HGM] navigate: for Ctrl+R, flow into next case (moved up here) to summon up menu\r
+ lParam = -1;\r
case WM_RBUTTONDOWN:\r
if (!(GetKeyState(VK_SHIFT) & ~1)) {\r
/* Move selection here if it was empty */\r
pt.y = HIWORD(lParam);\r
SendMessage(hwnd, EM_EXGETSEL, 0, (LPARAM)&sel);\r
if (sel.cpMin == sel.cpMax) {\r
- sel.cpMin = SendMessage(hwnd, EM_CHARFROMPOS, 0, (LPARAM)&pt); /*doc is wrong*/\r
+ if(lParam != -1) sel.cpMin = SendMessage(hwnd, EM_CHARFROMPOS, 0, (LPARAM)&pt); /*doc is wrong*/\r
sel.cpMax = sel.cpMin;\r
SendMessage(hwnd, EM_EXSETSEL, 0, (LPARAM)&sel);\r
}\r
rect, str, strlen(str), NULL);\r
if(logoHeight > 0 && appData.clockMode) {\r
RECT r;\r
- snprintf(buf, sizeof(buf)/sizeof(buf[0]), "%s %s", buf+7, flagFell);\r
+ str += strlen(color)+2;\r
r.top = rect->top + logoHeight/2;\r
r.left = rect->left;\r
r.right = rect->right;\r
\r
Enables trainingOnEnables[] = {\r
{ IDM_EditComment, MF_BYCOMMAND|MF_GRAYED },\r
+ { IDM_Comment, MF_BYCOMMAND|MF_GRAYED },\r
{ IDM_Pause, MF_BYCOMMAND|MF_GRAYED },\r
{ IDM_Forward, MF_BYCOMMAND|MF_GRAYED },\r
{ IDM_Backward, MF_BYCOMMAND|MF_GRAYED },\r
\r
Enables trainingOffEnables[] = {\r
{ IDM_EditComment, MF_BYCOMMAND|MF_ENABLED },\r
+ { IDM_Comment, MF_BYCOMMAND|MF_ENABLED },\r
{ IDM_Pause, MF_BYCOMMAND|MF_ENABLED },\r
{ IDM_Forward, MF_BYCOMMAND|MF_ENABLED },\r
{ IDM_Backward, MF_BYCOMMAND|MF_ENABLED },\r
VOID\r
CommentPopDown(void)\r
{\r
- CheckMenuItem(GetMenu(hwndMain), IDM_EditComment, MF_UNCHECKED);\r
+ CheckMenuItem(GetMenu(hwndMain), IDM_Comment, MF_UNCHECKED);\r
if (commentDialog) {\r
ShowWindow(commentDialog, SW_HIDE);\r
}\r
POINT frames[], int * nFrames);\r
\r
\r
+#define kFactor 4\r
+\r
void\r
-AnimateAtomicCapture(int fromX, int fromY, int toX, int toY, int nFrames)\r
+AnimateAtomicCapture(Board board, int fromX, int fromY, int toX, int toY)\r
{ // [HGM] atomic: animate blast wave\r
int i;\r
-if(appData.debugMode) fprintf(debugFP, "exploding (%d,%d)\n", toX, toY);\r
+\r
explodeInfo.fromX = fromX;\r
explodeInfo.fromY = fromY;\r
explodeInfo.toX = toX;\r
explodeInfo.toY = toY;\r
- for(i=1; i<nFrames; i++) {\r
- explodeInfo.radius = (i*180)/(nFrames-1);\r
- DrawPosition(FALSE, NULL);\r
+ for(i=1; i<4*kFactor; i++) {\r
+ explodeInfo.radius = (i*180)/(4*kFactor-1);\r
+ DrawPosition(FALSE, board);\r
Sleep(appData.animSpeed);\r
}\r
explodeInfo.radius = 0;\r
- DrawPosition(TRUE, NULL);\r
+ DrawPosition(TRUE, board);\r
}\r
\r
-#define kFactor 4\r
-\r
void\r
AnimateMove(board, fromX, fromY, toX, toY)\r
Board board;\r
ScreenSquare(fromX, fromY, &start);\r
ScreenSquare(toX, toY, &finish);\r
\r
- /* All pieces except knights move in straight line */\r
- if (piece != WhiteKnight && piece != BlackKnight) {\r
+ /* All moves except knight jumps move in straight line */\r
+ if (!(abs(fromX-toX) == 1 && abs(fromY-toY) == 2 || abs(fromX-toX) == 2 && abs(fromY-toY) == 1)) {\r
mid.x = start.x + (finish.x - start.x) / 2;\r
mid.y = start.y + (finish.y - start.y) / 2;\r
} else {\r
- /* Knight: make diagonal movement then straight */\r
+ /* Knight: make straight movement then diagonal */\r
if (abs(toY - fromY) < abs(toX - fromX)) {\r
mid.x = start.x + (finish.x - start.x) / 2;\r
- mid.y = finish.y;\r
+ mid.y = start.y;\r
} else {\r
- mid.x = finish.x;\r
+ mid.x = start.x;\r
mid.y = start.y + (finish.y - start.y) / 2;\r
}\r
}\r
animInfo.pos = finish;\r
DrawPosition(FALSE, NULL);\r
animInfo.piece = EmptySquare;\r
- if(gameInfo.variant == VariantAtomic && \r
- (board[toY][toX] != EmptySquare || fromX != toX && (piece == WhitePawn || piece == BlackPawn) ) )\r
- AnimateAtomicCapture(fromX, fromY, toX, toY, 2*nFrames);\r
+ Explode(board, fromX, fromY, toX, toY);\r
}\r
\r
/* Convert board position to corner of screen rect and color */\r
\r
EvalGraphSet( first, last, current, pvInfoList );\r
}\r
+\r
+void\r
+SettingsPopUp(ChessProgramState *cps)\r
+{ // [HGM] wrapper needed because handles must not be passed through back-end\r
+ EngineOptionsPopup(savedHwnd, cps);\r
+}\r