allowe parsing / disambiguation of SAN moves like Xe4 in certain situations
[xboard.git] / winboard / wlayout.c
index 0fd28f0..04f6eb6 100644 (file)
@@ -3,6 +3,8 @@
  *\r
  * Author: Alessandro Scotti (Dec 2005)\r
  *\r
+ * Copyright 2005 Alessandro Scotti\r
+ *\r
  * ------------------------------------------------------------------------\r
  *\r
  * GNU XBoard is free software: you can redistribute it and/or modify\r
@@ -44,7 +46,7 @@ VOID RestoreWindowPlacement( HWND hWnd, WindowPlacement * wp )
 \r
         ZeroMemory( &stWP, sizeof(stWP) );\r
 \r
-       EnsureOnScreen( &wp->x, &wp->y);\r
+       EnsureOnScreen( &wp->x, &wp->y, 0, 0);\r
 \r
        stWP.length = sizeof(stWP);\r
        stWP.flags = 0;\r
@@ -156,3 +158,32 @@ VOID ReattachAfterMove( LPRECT lprcOldPos, int new_x, int new_y, HWND hWndChild,
         }\r
     }\r
 }\r
+\r
+extern FILE *debugFP;\r
+VOID ReattachAfterSize( LPRECT lprcOldPos, int new_w, int new_h, HWND hWndChild, WindowPlacement * pwpChild )\r
+{\r
+    if( ! IsDefaultPlacement( pwpChild ) ) {\r
+        GetActualPlacement( hWndChild, pwpChild );\r
+\r
+        if( IsAttachedByWindowPlacement( lprcOldPos, pwpChild ) ) {\r
+            /* Get delta of lower right corner */\r
+            int delta_x = new_w - (lprcOldPos->right  - lprcOldPos->left);\r
+            int delta_y = new_h - (lprcOldPos->bottom - lprcOldPos->top);\r
+\r
+            /* Adjust size & placement */\r
+            if(pwpChild->x + pwpChild->width  >= lprcOldPos->right  )\r
+               pwpChild->width += delta_x;\r
+            if(pwpChild->y + pwpChild->height >= lprcOldPos->bottom )\r
+               pwpChild->height += delta_y;\r
+            if(pwpChild->x >= lprcOldPos->right)  pwpChild->width  -= delta_x, pwpChild->x += delta_x;\r
+            if(pwpChild->y >= lprcOldPos->bottom) pwpChild->height -= delta_y, pwpChild->y += delta_y;\r
+            /* Move window */\r
+            if( hWndChild != NULL ) {\r
+                SetWindowPos( hWndChild, HWND_TOP,\r
+                    pwpChild->x, pwpChild->y,\r
+                    pwpChild->width, pwpChild->height,\r
+                    SWP_NOZORDER );\r
+            }\r
+        }\r
+    }\r
+}\r