#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
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
{ // 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
\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
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
* 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
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