Fix multi-leg promotions
[xboard.git] / winboard / wengineoutput.c
index 2acb145..b9d13f5 100644 (file)
@@ -5,6 +5,9 @@
  *\r
  * Copyright 2005 Alessandro Scotti\r
  *\r
+ * Enhancements Copyright 2009, 2010, 2011, 2012, 2013, 2014, 2015,\r
+ * 2016 Free Software Foundation, Inc.\r
+ *\r
  * ------------------------------------------------------------------------\r
  *\r
  * GNU XBoard is free software: you can redistribute it and/or modify\r
@@ -223,7 +226,8 @@ void ResizeWindowControls( int mode )
     InvalidateRect( GetDlgItem(hDlg,IDC_EngineMemo2), NULL, FALSE );\r
 }\r
 \r
-static int currentPV, highTextStart[2], highTextEnd[2];\r
+static int currentPV;\r
+int highTextStart[2], highTextEnd[2];\r
 extern RECT boardRect;\r
 \r
 VOID\r
@@ -237,7 +241,7 @@ GetMemoLine(HWND hDlg, int x, int y)
        memo = currentPV ? IDC_EngineMemo2 : IDC_EngineMemo1;\r
        index = SendDlgItemMessage( hDlg, memo, EM_CHARFROMPOS, 0, (LPARAM) &pt );\r
        GetDlgItemText(hDlg, memo, buf, sizeof(buf));\r
-       if(LoadMultiPV(x, y, buf, index, &start, &end)) {\r
+       if(LoadMultiPV(x, y, buf, index, &start, &end, currentPV)) {\r
            SetCapture(hDlg);\r
            SendMessage( outputField[currentPV][nMemo], EM_SETSEL, (WPARAM)start, (LPARAM)end );\r
            highTextStart[currentPV] = start; highTextEnd[currentPV] = end;\r
@@ -274,6 +278,11 @@ void DoSetWindowText(int which, int field, char *s_label)
     SetWindowText( outputField[which][field], s_label );\r
 }\r
 \r
+void SetEngineOutputTitle(char *title)\r
+{\r
+    SetWindowText( engineOutputDialog, title );\r
+}\r
+\r
 // This seems pure front end\r
 LRESULT CALLBACK EngineOutputProc( HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam )\r
 {\r
@@ -284,6 +293,7 @@ LRESULT CALLBACK EngineOutputProc( HWND hDlg, UINT message, WPARAM wParam, LPARA
         if( engineOutputDialog == NULL ) {\r
             engineOutputDialog = hDlg;\r
 \r
+            Translate(hDlg, DLG_EngineOutput);\r
             RestoreWindowPlacement( hDlg, &wpEngineOutput ); /* Restore window placement */\r
 \r
             ResizeWindowControls( windowMode );\r
@@ -331,7 +341,8 @@ LRESULT CALLBACK EngineOutputProc( HWND hDlg, UINT message, WPARAM wParam, LPARA
     case WM_NOTIFY:\r
         if( wParam == IDC_EngineMemo1 || wParam == IDC_EngineMemo2 ) {\r
             MSGFILTER * lpMF = (MSGFILTER *) lParam;\r
-            if( lpMF->msg == WM_RBUTTONDOWN && (lpMF->wParam & (MK_CONTROL | MK_SHIFT)) == 0 ) {\r
+            if( lpMF->msg == WM_RBUTTONDOWN && (lpMF->wParam & (MK_CONTROL)) == 0 ) {\r
+               shiftKey = (lpMF->wParam & MK_SHIFT) != 0; // [HGM] remember last shift status\r
                 currentPV = (wParam == IDC_EngineMemo2);\r
                 GetMemoLine(hDlg, LOWORD(lpMF->lParam), HIWORD(lpMF->lParam));\r
             }\r