Display PV on right-clicking board
[xboard.git] / winboard / winboard.c
index 0d33b09..c3dcf97 100644 (file)
@@ -3705,6 +3705,7 @@ MouseEvent(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
     break;\r
 \r
   case WM_MOUSEMOVE:\r
+    MovePV(pt.x - boardRect.left, pt.y - boardRect.top, boardRect.bottom - boardRect.top);
     if ((appData.animateDragging || appData.highlightDragging)\r
        && (wParam & MK_LBUTTON)\r
        && dragInfo.from.x >= 0) \r
@@ -3742,6 +3743,12 @@ MouseEvent(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
     }\r
     break;\r
 \r
+  case WM_MBUTTONUP:
+  case WM_RBUTTONUP:
+    ReleaseCapture();
+    UnLoadPV();
+    break;
   case WM_MBUTTONDOWN:\r
   case WM_RBUTTONDOWN:\r
     ErrorPopDown();\r
@@ -3786,15 +3793,29 @@ MouseEvent(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
             MenuPopup(hwnd, pt, LoadMenu(hInst, "ShogiPieceMenu"), -1);\r
       }\r
       break;\r
-    case IcsPlayingWhite:\r
-    case IcsPlayingBlack:\r
-    case EditGame:\r
-    case MachinePlaysWhite:\r
-    case MachinePlaysBlack:\r
-      if (appData.testLegality &&\r
-         gameInfo.variant != VariantBughouse &&\r
-         gameInfo.variant != VariantCrazyhouse) break;\r
-      if (x < 0 || y < 0) break;\r
+    case IcsObserving:
+      if(!appData.icsEngineAnalyze) break;
+    case IcsPlayingWhite:
+    case IcsPlayingBlack:
+      if(!appData.zippyPlay) goto noZip;
+    case MachinePlaysWhite:
+    case MachinePlaysBlack:
+    case TwoMachinesPlay:
+    case AnalyzeMode:
+    case AnalyzeFile:
+      if (!appData.dropMenu) {
+        SetCapture(hwndMain);
+        LoadPV(pt.x - boardRect.left, pt.y - boardRect.top);
+        break;
+      }
+      if(gameMode == TwoMachinesPlay || gameMode == AnalyzeMode ||
+         gameMode == AnalyzeFile || gameMode == IcsObserving) break;
+    case EditGame:
+    noZip:
+      if (x < 0 || y < 0) break;
+      if (!appData.dropMenu || appData.testLegality &&
+         gameInfo.variant != VariantBughouse &&
+         gameInfo.variant != VariantCrazyhouse) break;
       fromX = x;\r
       fromY = y;\r
       hmenu = LoadMenu(hInst, "DropPieceMenu");\r