POINT pos; /* window coordinates of current pos */\r
POINT lastpos; /* window coordinates of last pos - used for clipping */\r
POINT from; /* board coordinates of the piece's orig pos */\r
+ ChessSquare piece;\r
} DragInfo;\r
\r
-static DragInfo dragInfo = { {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1} };\r
+static DragInfo dragInfo = { {-1,-1}, {-1,-1}, {-1,-1}, {-1,-1}, EmptySquare };\r
\r
typedef struct {\r
POINT sq[2]; /* board coordinates of from, to squares */\r
\r
if(!name || name[0] == NULLCHAR) return;\r
snprintf(buf, MSG_SIZ, "%s%s", name, strchr(name, '.') ? "" : ".lng"); // auto-append lng extension\r
+ appData.language = oldLanguage;\r
if(!strcmp(buf, oldLanguage)) { barbaric = 1; return; } // this language already loaded; just switch on\r
if((f = fopen(buf, "r")) == NULL) return;\r
while((k = fgetc(f)) != EOF) {\r
int i;\r
WIN32_FIND_DATA fileData;\r
HANDLE hFind;\r
-#define IDM_English 1895\r
+#define IDM_English 1970\r
if(1) {\r
HMENU mainMenu = GetMenu(hwndMain);\r
for (i=GetMenuItemCount(mainMenu)-1; i>=0; i--) {\r
board[dragInfo.from.y][dragInfo.from.x] = dragged_piece;\r
x = dragInfo.pos.x - squareSize / 2;\r
y = dragInfo.pos.y - squareSize / 2;\r
- DrawPieceOnDC(hdcmem, dragged_piece,\r
- ((int) dragged_piece < (int) BlackPawn), \r
+ DrawPieceOnDC(hdcmem, dragInfo.piece,\r
+ ((int) dragInfo.piece < (int) BlackPawn), \r
(dragInfo.from.y + dragInfo.from.x) % 2, x, y, tmphdc);\r
} \r
\r
dragInfo.lastpos.y = boardRect.top + y;\r
dragInfo.from.x = fromX;\r
dragInfo.from.y = fromY;\r
+ dragInfo.piece = boards[currentMove][fromY][fromX];\r
dragInfo.start = dragInfo.from;\r
SetCapture(hwndMain);\r
}\r
dragInfo.pos = dragInfo.lastpos = dragInfo.start;\r
}\r
\r
+void ChangeDragPiece(ChessSquare piece)\r
+{\r
+ dragInfo.piece = piece;\r
+}\r
+\r
/* Event handler for mouse messages */\r
VOID\r
MouseEvent(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)\r
\r
case WM_MOUSEMOVE:\r
if(SeekGraphClick(Press, pt.x - boardRect.left, pt.y - boardRect.top, 1)) break;\r
+ if(PromoScroll(pt.x - boardRect.left, pt.y - boardRect.top)) break;\r
MovePV(pt.x - boardRect.left, pt.y - boardRect.top, boardRect.bottom - boardRect.top);\r
if ((appData.animateDragging || appData.highlightDragging)\r
&& (wParam & MK_LBUTTON)\r
f = OpenFileDialog(hwnd, "wb", defName,\r
"bmp",\r
DIAGRAM_FILT,\r
- "Save Diagram to File", NULL, fileTitle, NULL);\r
+ _("Save Diagram to File"), NULL, fileTitle, NULL);\r
if (f != NULL) {\r
SaveDiagram(f);\r
}\r
break;\r
\r
case IDM_English:\r
- barbaric = 0;\r
+ barbaric = 0; appData.language = "";\r
TranslateMenus(0);\r
CheckMenuItem(GetMenu(hwndMain), lastChecked, MF_BYCOMMAND|MF_UNCHECKED);\r
CheckMenuItem(GetMenu(hwndMain), IDM_English, MF_BYCOMMAND|MF_CHECKED);\r
break;\r
\r
default:\r
- if(wmId > IDM_English && wmId < IDM_English+5) {\r
+ if(wmId > IDM_English && wmId < IDM_English+20) {\r
LoadLanguageFile(languageFile[wmId - IDM_English - 1]);\r
TranslateMenus(0);\r
CheckMenuItem(GetMenu(hwndMain), lastChecked, MF_BYCOMMAND|MF_UNCHECKED);\r