cross compilier working
[xboard.git] / winboard / winboard.c
index 89051aa..a06361f 100644 (file)
@@ -587,7 +587,7 @@ InitInstance(HINSTANCE hInstance, int nCmdShow, LPSTR lpCmdLine)
     InitDrawingSizes((BoardSize)ibs, 0);
     if (boardSize == (BoardSize)-1 &&
        winHeight <= screenHeight && winWidth <= screenWidth) {
-      boardSize = (BoardSize)ibs;
+      boardSize = (BoardSize)ibs - 4 < 0 ? (BoardSize)0 : (BoardSize)ibs - 4;
     }
   }
   InitDrawingSizes(boardSize, 0);
@@ -3650,7 +3650,8 @@ WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
                        DisplayError(buf, 0);
                        /* secure check */
                        if (appData.icsEngineAnalyze) {
-                               appData.icsEngineAnalyze = FALSE;
+                               if (appData.debugMode) 
+                                       fprintf(debugFP, "Found unexpected active ICS engine analyze \n");
                                ExitAnalyzeMode();
                                ModeHighlight();
                                break;
@@ -3659,12 +3660,12 @@ WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
                } else {
                        /* if enable, user want disable icsEngineAnalyze */
                        if (appData.icsEngineAnalyze) {
-                               appData.icsEngineAnalyze = FALSE;
                                ExitAnalyzeMode();
                                ModeHighlight();
                                break;
                        }
                        appData.icsEngineAnalyze = TRUE;
+                       if (appData.debugMode) fprintf(debugFP, "ICS engine analyze starting...\n");
                }
        } 
        if (!appData.showThinking) ToggleShowThinking();
@@ -5624,6 +5625,23 @@ ConsoleWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
       wp.rcNormalPosition.bottom = consoleY + consoleH;
       SetWindowPlacement(hDlg, &wp);
     }
+    else { /* Determine Defaults */
+      WINDOWPLACEMENT wp;
+      consoleX = winWidth + 1;
+      consoleY = boardY;
+      consoleW = screenWidth -  winWidth;
+      consoleH = winHeight;
+      EnsureOnScreen(&consoleX, &consoleY);
+      wp.length = sizeof(WINDOWPLACEMENT);
+      wp.flags = 0;
+      wp.showCmd = SW_SHOW;
+      wp.ptMaxPosition.x = wp.ptMaxPosition.y = 0;
+      wp.rcNormalPosition.left = consoleX;
+      wp.rcNormalPosition.right = consoleX + consoleW;
+      wp.rcNormalPosition.top = consoleY;
+      wp.rcNormalPosition.bottom = consoleY + consoleH;
+      SetWindowPlacement(hDlg, &wp);
+    }
     return FALSE;
 
   case WM_SETFOCUS:
@@ -6243,13 +6261,16 @@ ModeHighlight()
   }
 
   prevChecked = nowChecked;
+
   /* icsEngineAnalyze - Do a sceure check too */
-  if (appData.icsEngineAnalyze) {
-       (void) CheckMenuItem(GetMenu(hwndMain), IDM_AnalysisMode,
-               MF_BYCOMMAND|MF_CHECKED);
-  } else {
-       (void) CheckMenuItem(GetMenu(hwndMain), IDM_AnalysisMode,
-               MF_BYCOMMAND|MF_UNCHECKED);
+  if (appData.icsActive) {
+       if (appData.icsEngineAnalyze) {
+               (void) CheckMenuItem(GetMenu(hwndMain), IDM_AnalysisMode,
+                       MF_BYCOMMAND|MF_CHECKED);
+       } else {
+               (void) CheckMenuItem(GetMenu(hwndMain), IDM_AnalysisMode,
+                       MF_BYCOMMAND|MF_UNCHECKED);
+       }
   }
 }
 
@@ -7608,6 +7629,12 @@ AnalysisDialog(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
   case WM_COMMAND: /* message: received a command */
     switch (LOWORD(wParam)) {
     case IDCANCEL:
+          /* icsEngineAnalyze */
+          if (appData.icsActive && appData.icsEngineAnalyze) {
+                  ExitAnalyzeMode();
+                  ModeHighlight();
+                  return TRUE;
+          }
       EditGameEvent();
       return TRUE;
     default: