X-Git-Url: http://winboard.nl/cgi-bin?a=blobdiff_plain;f=winboard%2Fwinboard.c;h=99f95ba91a582d7834b3e21d5798c01eb4af831f;hb=9077cfe5ee13a5197fe0990b0096fa452898054f;hp=3b2dd29b2760038593b446b753f10e032ee644e7;hpb=ca30b359aca5abcebe2590fc2c2318ff014f8130;p=xboard.git diff --git a/winboard/winboard.c b/winboard/winboard.c index 3b2dd29..99f95ba 100644 --- a/winboard/winboard.c +++ b/winboard/winboard.c @@ -494,7 +494,7 @@ void ThawUI() DrawMenuBar(hwndMain); } -static int fromX = -1, fromY = -1, toX, toY; // [HGM] moved upstream, so JAWS can use them +/*static*/ int fromX = -1, fromY = -1, toX, toY; // [HGM] moved upstream, so JAWS can use them /* JAWS preparation patch (WinBoard for the sight impaired). Define required insertions as empty */ #ifdef JAWS @@ -1339,6 +1339,7 @@ ArgDescriptor argDescriptors[] = { { "secondNeedsNoncompliantFEN", ArgString, (LPVOID) &appData.fenOverride2, FALSE }, { "keepAlive", ArgInt, (LPVOID) &appData.keepAlive, FALSE }, { "icstype", ArgInt, (LPVOID) &ics_type, FALSE }, + { "forceIllegalMoves", ArgTrue, (LPVOID) &appData.forceIllegal, FALSE }, #ifdef ZIPPY { "zippyTalk", ArgBoolean, (LPVOID) &appData.zippyTalk, FALSE }, @@ -5119,17 +5120,14 @@ MouseEvent(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) toY = y; /* [HGM] UserMoveEvent requires two calls now, to make sure move is legal before showing promotion popup */ - moveType = UserMoveTest(fromX, fromY, toX, toY, NULLCHAR); + moveType = UserMoveTest(fromX, fromY, toX, toY, NULLCHAR, FALSE); if(moveType == AmbiguousMove) { /* [HGM] Edit-Position move executed */ fromX = fromY = -1; ClearHighlights(); DrawPosition(FALSE, boards[currentMove]); break; } else - if(moveType != ImpossibleMove) { - if(moveType == IllegalMove) { - ; - } else + if(moveType != ImpossibleMove && moveType != Comment) { /* [HGM] We use PromotionToKnight in Shogi to indicate frorced promotion */ if (moveType == WhitePromotionKnight || moveType == BlackPromotionKnight || ((moveType == WhitePromotionQueen || moveType == BlackPromotionQueen) && @@ -5154,9 +5152,11 @@ MouseEvent(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) DrawPosition(FALSE, boards[currentMove]); boards[currentMove][fromY][fromX] = p; // take back, but display stays boards[currentMove][toY][toX] = q; + DisplayMessage("Select piece from holdings", ""); } else PromotionPopup(hwnd); - } else { /* not a promotion */ + goto noClear; + } else { // not a promotion. Move can be illegal if testLegality off, and should be made then. if (appData.animate || appData.highlightLastMove) { SetHighlights(fromX, fromY, toX, toY); } else { @@ -5169,14 +5169,16 @@ MouseEvent(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) } } fromX = fromY = -1; + noClear: break; } - if (gotPremove) { + if (gotPremove && moveType != Comment) { SetPremoveHighlights(fromX, fromY, toX, toY); - DrawPosition(forceFullRepaint || FALSE, NULL); +// DrawPosition(forceFullRepaint || FALSE, NULL); } else ClearHighlights(); fromX = fromY = -1; DrawPosition(forceFullRepaint || FALSE, NULL); + if(moveType != Comment) break; } /* First downclick, or restart on a square with same color piece */ if (!frozen && OKToStartUserMove(x, y)) { @@ -5224,7 +5226,7 @@ MouseEvent(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) toY = y; saveAnimate = appData.animate; /* sorry, Hawk :) */ appData.animate = appData.animate && !appData.animateDragging; - moveType = UserMoveTest(fromX, fromY, toX, toY, NULLCHAR); + moveType = UserMoveTest(fromX, fromY, toX, toY, NULLCHAR, TRUE); if(moveType == AmbiguousMove) { /* [HGM] Edit-Position move executed */ fromX = fromY = -1; ClearHighlights(); @@ -5252,6 +5254,7 @@ MouseEvent(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) boards[currentMove][fromY][fromX] = p; // take back, but display stays boards[currentMove][toY][toX] = q; appData.animate = saveAnimate; + DisplayMessage("Select piece from holdings", ""); break; } else PromotionPopup(hwnd); /* [HGM] Popup now calls FinishMove */ @@ -8242,6 +8245,23 @@ ConsoleWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) MINMAXINFO *mmi; switch (message) { + case WM_NOTIFY: + if (((NMHDR*)lParam)->code == EN_LINK) + { + ENLINK *pLink = (ENLINK*)lParam; + if (pLink->msg == WM_LBUTTONUP) + { + TEXTRANGE tr; + + tr.chrg = pLink->chrg; + tr.lpstrText = malloc(1+tr.chrg.cpMax-tr.chrg.cpMin); + hText = GetDlgItem(hDlg, OPT_ConsoleText); + SendMessage(hText, EM_GETTEXTRANGE, 0, (LPARAM)&tr); + ShellExecute(NULL, "open", tr.lpstrText, NULL, NULL, SW_SHOW); + free(tr.lpstrText); + } + } + break; case WM_INITDIALOG: /* message: initialize dialog box */ hwndConsole = hDlg; hText = GetDlgItem(hDlg, OPT_ConsoleText); @@ -8362,10 +8382,18 @@ ConsoleWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) VOID ConsoleCreate() { - HWND hCons; + HWND hCons, hText; + WORD wMask; if (hwndConsole) return; hCons = CreateDialog(hInst, szConsoleName, 0, NULL); SendMessage(hCons, WM_INITDIALOG, 0, 0); + + + // make the text item in the console do URL links + hText = GetDlgItem(hCons, OPT_ConsoleText); + wMask = SendMessage(hText, EM_GETEVENTMASK, 0, 0L); + SendMessage(hText, EM_SETEVENTMASK, 0, wMask | ENM_LINK); + SendMessage(hText, EM_AUTOURLDETECT, TRUE, 0L); } @@ -9644,6 +9672,7 @@ CommentPopUp(char *title, char *str) { HWND hwnd = GetActiveWindow(); EitherCommentPopUp(0, title, str, FALSE); + SAY(str); SetActiveWindow(hwnd); }