Update of /cvsroot/netrek/client/netrekxp/src
In directory sc8-pr-cvs16:/tmp/cvs-serv17585/src

Modified Files:
	defaults.c mswindow.c 
Log Message:
This patch focuses on getting windows geometries to save via
the in-game save key.
Redefined win->orig_* to mean not the values in newwin(),  but
rather the original values as determined by the netrekrc.
New variables to window struct, win->actual_*, which are defined
at the exact moment of window creation to get the true screen
coordinates of the original window (note that these are NOT the
same as the coordinates you put in the netrekrc file!  They are
modified by things like border, padding, system metrics, etc).
New function checkWindowsGeometry() which checks current
windows placement vs. the placement that was originally given
(win->actual_*).  
If they differ, to then backwards convert the current screen
coordinates into a netrekrc entry, the current coordinates are
modified by (win->actual_* - win->orig_*), to take into account
things like borders, padding, etc.
If they don't differ, then the netrekrc string is used (i.e.
"local.geometry: xxxx").
In the in-game save function, a call to checkWindowGeometry
is made to get the geometry.  Also, the current mapped state of
window is used for saving, rather than the one from the netrekrc,
so that if people change window mappings, they save.
Fixed documentation incorrectness on playerListObserver option.

Index: mswindow.c
===================================================================
RCS file: /cvsroot/netrek/client/netrekxp/src/mswindow.c,v
retrieving revision 1.61
retrieving revision 1.62
diff -u -d -r1.61 -r1.62
--- mswindow.c	9 Apr 2007 11:07:20 -0000	1.61
+++ mswindow.c	10 Apr 2007 00:44:03 -0000	1.62
@@ -1118,6 +1118,7 @@
     HDC hdc;
     char title_buff[100];
     char *s;
+    int actual_x, actual_y, actual_width, actual_height;
     DWORD SpecialStyle = 0;
 
     if (!(window = (Window *) malloc (sizeof (Window))))
@@ -1209,22 +1210,26 @@
     strcpy (window->name, name);
     window->parent = parentwin;
 
+    /* Preprocess the actual coordinates */
+    actual_x = x + parentwin->border;
+    actual_y = y + parentwin->border;
+    actual_width = width + border * 2;
+    actual_height = height + border * 2;
+
     //Actually create the window
     //Hacked to allow negative create locations -SAC
     if (window->type == WIN_RICHTEXT)
     {
         window->hwnd = CreateWindowEx (0, RICHEDIT_CLASS, "",
-                                       WS_CLIPSIBLINGS | WS_CLIPCHILDREN | WS_CHILD |
+                                       WS_CLIPSIBLINGS | WS_CLIPCHILDREN | WS_CHILD | WS_THICKFRAME |
                                        WS_VSCROLL | WS_BORDER | ES_READONLY | ES_MULTILINE,
-                                       x + parentwin->border, y + parentwin->border,
-                                       width + border * 2, height + border * 2,
+                                       actual_x, actual_y, actual_width, actual_height,
                                        parentwin->hwnd, NULL, MyInstance, (void *) window);
     }
     else
     {
         window->hwnd = CreateWindow (ClassName, s, WS_CLIPSIBLINGS | WS_CLIPCHILDREN | SpecialStyle, 
-                                    x + parentwin->border, y + parentwin->border, 
-                                    width + border * 2, height + border * 2 + 
+                                    actual_x, actual_y, actual_width, actual_height + 
                                     ((SpecialStyle & WS_CAPTION) ? GetSystemMetrics (SM_CYCAPTION) : 0), 
                                     parentwin->hwnd, NULL, MyInstance, (void *) window);      
                                     //Pass Window struct * as user param
@@ -1236,6 +1241,13 @@
         return (0);
     }
 
+    /* Set actual locations for later comparison, note we don't
+       record any height adjustment caused by title bar (WS_CAPTION) */
+    window->actual_x = actual_x;
+    window->actual_y = actual_y;
+    window->actual_width = actual_width;
+    window->actual_height = actual_height;
+    
     //Select the custom palette if we're in a paletted mode
     hdc = GetDC (window->hwnd);
     if (NetrekPalette)
@@ -1262,12 +1274,6 @@
               W_Color color)
 {
     Window *newwin;
-    int orig_x, orig_y, orig_width, orig_height;
-
-    orig_x = x;
-    orig_y = y;
-    orig_width = width;
-    orig_height = height;
 
     //Get the default position, etc.
     checkGeometry (name, &x, &y, &width, &height);
@@ -1282,10 +1288,10 @@
         return (0);
         
     /* Set original coordinates, so we will be able to restore to them */
-    newwin->orig_x = orig_x;
-    newwin->orig_y = orig_y;
-    newwin->orig_width = orig_width;
-    newwin->orig_height = orig_height;
+    newwin->orig_x = x;
+    newwin->orig_y = y;
+    newwin->orig_width = width;
+    newwin->orig_height = height;
 
     //Map (show) the window if the user spec'd it
     if (checkMapped (name))
@@ -1310,12 +1316,6 @@
                   int border)
 {
     Window *newwin;
-    int orig_x, orig_y, orig_width, orig_height;
-
-    orig_x = x;
-    orig_y = y;
-    orig_width = width;
-    orig_height = height;
 
     //Get the default position, etc.
     checkGeometry (name, &x, &y, &width, &height);
@@ -1334,10 +1334,10 @@
     newwin->TextWidth = (short) width;
     
     /* Set original coordinates, so we will be able to restore to them */
-    newwin->orig_x = orig_x;
-    newwin->orig_y = orig_y;
-    newwin->orig_width = orig_width;
-    newwin->orig_height = orig_height;
+    newwin->orig_x = x;
+    newwin->orig_y = y;
+    newwin->orig_width = width;
+    newwin->orig_height = height;
 
     //Map (show) the window if the user spec'd it
     if (checkMapped (name))
@@ -1359,12 +1359,6 @@
                        int border)
 {
     Window *newwin;
-    int orig_x, orig_y, orig_width, orig_height;
-
-    orig_x = x;
-    orig_y = y;
-    orig_width = width;
-    orig_height = height;
 
     //Get the default position, etc.
     checkGeometry (name, &x, &y, &width, &height);
@@ -1384,10 +1378,10 @@
     newwin->TextWidth = (short) width;
     
     /* Set original coordinates, so we will be able to restore to them */
-    newwin->orig_x = orig_x;
-    newwin->orig_y = orig_y;
-    newwin->orig_width = orig_width;
-    newwin->orig_height = orig_height;
+    newwin->orig_x = x;
+    newwin->orig_y = y;
+    newwin->orig_width = width;
+    newwin->orig_height = height;
 
     //Give it a scroll bar, and set the range (to zero, initially)
     SetWindowLongPtr (newwin->hwnd, GWL_STYLE,
@@ -1416,14 +1410,7 @@
 {
     struct menuItem *items;
     Window *newwin;
-
     int i;
-    int orig_x, orig_y, orig_width, orig_height;
-
-    orig_x = x;
-    orig_y = y;
-    orig_width = width;
-    orig_height = height;
 
     //Get the default position, etc.
     checkGeometry (name, &x, &y, &width, &height);
@@ -1453,10 +1440,10 @@
     newwin->TextHeight = (short) height;
     
     /* Set original coordinates, so we will be able to restore to them */
-    newwin->orig_x = orig_x;
-    newwin->orig_y = orig_y;
-    newwin->orig_width = orig_width;
-    newwin->orig_height = orig_height;
+    newwin->orig_x = x;
+    newwin->orig_y = y;
+    newwin->orig_width = width;
+    newwin->orig_height = height;
 
     //Map (show) the window if the user spec'd it
     if (checkMapped (name))
@@ -1972,8 +1959,8 @@
         // Redo critical windows
         // Clear window
         if (windowMove && (Window *) w != NULL && win->hwnd == ((Window *) w)->hwnd)
-        {
-            TWINSIDE = MAX(win->ClipRect.bottom, win->ClipRect.right);
+        { 
+            TWINSIDE = MAX(win->ClipRect.bottom, win->ClipRect.right) + win->border;
 
             // Have to reinitialize SDB
             SelectObject (localSDB->mem_dc, localSDB->old_bmp);
@@ -2003,7 +1990,7 @@
         }
         else if (windowMove && (Window *) mapw != NULL && win->hwnd == ((Window *) mapw)->hwnd)
         {
-            GWINSIDE = MAX(win->ClipRect.bottom, win->ClipRect.right);
+            GWINSIDE = MAX(win->ClipRect.bottom, win->ClipRect.right) + win->border;
 
             // Have to reinitialize SDB
             SelectObject (mapSDB->mem_dc, mapSDB->old_bmp);
@@ -2253,6 +2240,7 @@
                 r.left -= GetSystemMetrics (SM_CXBORDER);
                 r.top -= GetSystemMetrics (SM_CYBORDER);
             }
+            mainTitleBar = !mainTitleBar;
             SetWindowLongPtr (((Window *) baseWin)->hwnd, GWL_STYLE, wl);
             // Update the window since the height has changed
             MoveWindow (((Window *) baseWin)->hwnd, r.left, r.top,
@@ -5621,7 +5609,79 @@
     return;
 }
 
-/* Reread rc for geometry changes and update window if geometry was changed */
+/* Check window's original position against current position, if different,
+   return a char string that is the equivalent of what the netrekrc entry
+   for that window geometry would be */
+   
+char *
+checkWindowsGeometry (W_Window window)
+{
+    char str[256];
+    WINDOWPLACEMENT loc;
+    int x, y, width, height;
+    register Window *win;
+
+    if (!window)
+        return (NULL);
+
+    win = (Window *)window;
+
+    loc.length = sizeof (WINDOWPLACEMENT); /* Have to set this */
+    
+    if (GetWindowPlacement (win->hwnd, &loc))
+    {
+        x = loc.rcNormalPosition.left;
+        y = loc.rcNormalPosition.top;
+        width = loc.rcNormalPosition.right - loc.rcNormalPosition.left;
+        height = loc.rcNormalPosition.bottom - loc.rcNormalPosition.top;
+
+        if (x != win->actual_x || y != win->actual_y
+         || width != win->actual_width || height != win->actual_height)
+        {
+            /* TODO: fix main window so it takes into account all
+               the SYS_CAPTION/border size changes, too messy for now */
+            if (strcmpi (win->name, "netrek") == 0)
+                return (geometryDefault (str));
+            /* Let's keep local and map windows square! */
+            else if (strcmpi (win->name, "local") == 0)
+            {
+                if (width > height)
+                    width = height;
+                else if (height > width)
+                    height = width;
+            }
+            else if (strcmpi (win->name, "map") == 0)
+            {
+                if (width > height)
+                    width = height;
+                else if (height > width)
+                    height = width;
+            }
+            
+            /* To convert actual window location into a netrekrc format,
+               we need to know the inherent conversion difference between
+               what the netrekrc says (e.g. local.geometry: 500x500+0+0)
+               and what size/location window is actually created (e.g. 
+               local window is 506x506 pixels at (x,y) = (1,1)).  So we
+               subtract the actual values minus the original values to
+               get the conversion factor */
+            sprintf (str, "%dx%d+%d+%d",
+		    width - (win->actual_width - win->orig_width),
+		    height - (win->actual_height - win->orig_height),
+		    x - (win->actual_x - win->orig_x),
+		    y - (win->actual_y - win->orig_y));
+            return strdup (str);
+        }
+    }
+    /* Geometry hasn't changed, so use the default string from netrekrc
+       if there is one */
+    strcpy(str, win->name);
+    strcat(str, ".geometry");
+    return (geometryDefault (str));
+}
+
+/* Reread rc for geometry changes and update window if geometry was changed,
+*  currently unused and non-functional */
 void
 updateWindowsGeometry (W_Window window)
 {
@@ -5857,12 +5917,6 @@
                                int border)
 {
     Window *newwin;
-    int orig_x, orig_y, orig_width, orig_height;
-
-    orig_x = x;
-    orig_y = y;
-    orig_width = width;
-    orig_height = height;
 
     //Get the default position, etc.
     checkGeometry (name, &x, &y, &width, &height);
@@ -5890,10 +5944,10 @@
     newwin->TextWidth = width;
 
     /* Set original coordinates, so we will be able to restore to them */
-    newwin->orig_x = orig_x;
-    newwin->orig_y = orig_y;
-    newwin->orig_width = orig_width;
-    newwin->orig_height = orig_height;
+    newwin->orig_x = x;
+    newwin->orig_y = y;
+    newwin->orig_width = width;
+    newwin->orig_height = height;
 
     //Map (show) the window if the user spec'd it
     if (checkMapped (name))

Index: defaults.c
===================================================================
RCS file: /cvsroot/netrek/client/netrekxp/src/defaults.c,v
retrieving revision 1.74
retrieving revision 1.75
diff -u -d -r1.74 -r1.75
--- defaults.c	9 Apr 2007 11:31:36 -0000	1.74
+++ defaults.c	10 Apr 2007 00:44:03 -0000	1.75
@@ -490,6 +490,7 @@
             "1 - players",
             "2 - observers",
             "3 - players, then observers",
+            "4 - playerlist is off",
             NULL
         }
     },
@@ -2451,7 +2452,7 @@
             sprintf (str, "netrek.parent:          %s\n", adefault);
             fputs (str, fp);
         }
-        adefault = geometryDefault ("netrek.geometry");
+        adefault = checkWindowsGeometry (baseWin);
         sprintf (str, "netrek.geometry:        %s\n",
                  (adefault != NULL) ? adefault : "auto");
         fputs (str, fp);
@@ -2463,7 +2464,7 @@
             sprintf (str, "local.parent:           %s\n", adefault);
             fputs (str, fp);
         }
-        adefault = geometryDefault ("local.geometry");
+        adefault = checkWindowsGeometry (w);
         sprintf (str, "local.geometry:         %s\n",
                  (adefault != NULL) ? adefault : "auto");
         fputs (str, fp);
@@ -2475,7 +2476,7 @@
             sprintf (str, "map.parent:             %s\n", adefault);
             fputs (str, fp);
         }
-        adefault = geometryDefault ("map.geometry");
+        adefault = checkWindowsGeometry (mapw);
         sprintf (str, "map.geometry:           %s\n",
                  (adefault != NULL) ? adefault : "auto");
         fputs (str, fp);
@@ -2487,24 +2488,24 @@
             sprintf (str, "tstat.parent:           %s\n", adefault);
             fputs (str, fp);
         }
-        adefault = geometryDefault ("tstat.geometry");
+        adefault = checkWindowsGeometry (tstatw);
         sprintf (str, "tstat.geometry:         %s\n",
                  (adefault != NULL) ? adefault : "auto");
         fputs (str, fp);
         fputs ("\n", fp);
 
-        // Message window - preferred mapped
+        // Message window
         if ((adefault = stringDefault ("message.parent")) != NULL)
         {
             sprintf (str, "message.parent:         %s\n", adefault);
             fputs (str, fp);
         }
-        adefault = geometryDefault ("message.geometry");
+        adefault = checkWindowsGeometry (messagew);
         sprintf (str, "message.geometry:       %s\n",
                  (adefault != NULL) ? adefault : "auto");
         fputs (str, fp);
         sprintf (str, "message.mapped:         %s\n",
-                 booleanDefault ("message.mapped", 1) ? "on" : "off");
+                 W_IsMapped (messagew) ? "on" : "off");
         fputs (str, fp);
         fputs ("\n", fp);
 
@@ -2514,7 +2515,7 @@
             sprintf (str, "warn.parent:            %s\n", adefault);
             fputs (str, fp);
         }
-        adefault = geometryDefault ("warn.geometry");
+        adefault = checkWindowsGeometry (warnw);
         sprintf (str, "warn.geometry:          %s\n",
                  (adefault != NULL) ? adefault : "auto");
         fputs (str, fp);
@@ -2526,12 +2527,12 @@
             sprintf (str, "planet.parent:          %s\n", adefault);
             fputs (str, fp);
         }
-        adefault = geometryDefault ("planet.geometry");
+        adefault = checkWindowsGeometry (planetw);
         sprintf (str, "planet.geometry:        %s\n",
                  (adefault != NULL) ? adefault : "auto");
         fputs (str, fp);
         sprintf (str, "planet.mapped:          %s\n",
-                 booleanDefault ("planet.mapped", 0) ? "on" : "off");
+                 W_IsMapped (planetw) ? "on" : "off");
         fputs (str, fp);
         fputs ("\n", fp);
 
@@ -2541,27 +2542,27 @@
             sprintf (str, "rank.parent:            %s\n", adefault);
             fputs (str, fp);
         }
-        adefault = geometryDefault ("rank.geometry");
+        adefault = checkWindowsGeometry (rankw);
         sprintf (str, "rank.geometry:          %s\n",
                  (adefault != NULL) ? adefault : "auto");
         fputs (str, fp);
         sprintf (str, "rank.mapped:            %s\n",
-                 booleanDefault ("rank.mapped", 0) ? "on" : "off");
+                 W_IsMapped (rankw) ? "on" : "off");
         fputs (str, fp);
         fputs ("\n", fp);
 
-        // Playerlist window - preferred mapped
+        // Playerlist window
         if ((adefault = stringDefault ("player.parent")) != NULL)
         {
             sprintf (str, "player.parent:          %s\n", adefault);
             fputs (str, fp);
         }
-        adefault = geometryDefault ("player.geometry");
+        adefault = checkWindowsGeometry (playerw);
         sprintf (str, "player.geometry:        %s\n",
                  (adefault != NULL) ? adefault : "auto");
         fputs (str, fp);
         sprintf (str, "player.mapped:          %s\n",
-                  booleanDefault ("player.mapped", 1) ? "on" : "off");
+                  W_IsMapped (playerw) ? "on" : "off");
         fputs (str, fp);
         fputs ("\n", fp);
 
@@ -2571,12 +2572,12 @@
             sprintf (str, "player2.parent:         %s\n", adefault);
             fputs (str, fp);
         }
-        adefault = geometryDefault ("player2.geometry");
+        adefault = checkWindowsGeometry (playerw2);
         sprintf (str, "player2.geometry:       %s\n",
                  (adefault != NULL) ? adefault : "auto");
         fputs (str, fp);
         sprintf (str, "player2.mapped:         %s\n",
-                  booleanDefault ("player2.mapped", 0) ? "on" : "off");
+                  W_IsMapped (playerw2) ? "on" : "off");
         fputs (str, fp);
         fputs ("\n", fp);
 
@@ -2586,12 +2587,12 @@
             sprintf (str, "help.parent:            %s\n", adefault);
             fputs (str, fp);
         }
-        adefault = geometryDefault ("help.geometry");
+        adefault = checkWindowsGeometry (helpWin);
         sprintf (str, "help.geometry:          %s\n",
                  (adefault != NULL) ? adefault : "auto");
         fputs (str, fp);
         sprintf (str, "help.mapped:            %s\n",
-                  booleanDefault ("help.mapped", 0) ? "on" : "off");
+                  W_IsMapped (helpWin) ? "on" : "off");
         fputs (str, fp);
         fputs ("\n", fp);
         
@@ -2601,12 +2602,12 @@
             sprintf (str, "review_all.parent:      %s\n", adefault);
             fputs (str, fp);
         }
-        adefault = geometryDefault ("review_all.geometry");
+        adefault = checkWindowsGeometry (messwa);
         sprintf (str, "review_all.geometry:    %s\n",
                  (adefault != NULL) ? adefault : "auto");
         fputs (str, fp);
         sprintf (str, "review_all.mapped:      %s\n",
-                  booleanDefault ("review_all.mapped", 0) ? "on" : "off");
+                  W_IsMapped (messwa) ? "on" : "off");
         fputs (str, fp);
         if ((adefault = stringDefault ("review_all.allow")) != NULL)
         {
@@ -2621,12 +2622,12 @@
             sprintf (str, "review_team.parent:     %s\n", adefault);
             fputs (str, fp);
         }
-        adefault = geometryDefault ("review_team.geometry");
+        adefault = checkWindowsGeometry (messwt);
         sprintf (str, "review_team.geometry:   %s\n",
                  (adefault != NULL) ? adefault : "auto");
         fputs (str, fp);
         sprintf (str, "review_team.mapped:     %s\n",
-                  booleanDefault ("review_team.mapped", 0) ? "on" : "off");
+                  W_IsMapped (messwt) ? "on" : "off");
         fputs (str, fp);
         if ((adefault = stringDefault ("review_team.allow")) != NULL)
         {
@@ -2641,12 +2642,12 @@
             sprintf (str, "review_your.parent:     %s\n", adefault);
             fputs (str, fp);
         }
-        adefault = geometryDefault ("review_your.geometry");
+        adefault = checkWindowsGeometry (messwi);
         sprintf (str, "review_your.geometry:   %s\n",
                  (adefault != NULL) ? adefault : "auto");
         fputs (str, fp);
         sprintf (str, "review_your.mapped:     %s\n",
-                  booleanDefault ("review_your.mapped", 0) ? "on" : "off");
+                  W_IsMapped (messwi) ? "on" : "off");
         fputs (str, fp);
         if ((adefault = stringDefault ("review_your.allow")) != NULL)
         {
@@ -2661,12 +2662,12 @@
             sprintf (str, "review_kill.parent:     %s\n", adefault);
             fputs (str, fp);
         }
-        adefault = geometryDefault ("review_kill.geometry");
+        adefault = checkWindowsGeometry (messwk);
         sprintf (str, "review_kill.geometry:   %s\n",
                  (adefault != NULL) ? adefault : "auto");
         fputs (str, fp);
         sprintf (str, "review_kill.mapped:     %s\n",
-                  booleanDefault ("review_kill.mapped", 0) ? "on" : "off");
+                  W_IsMapped (messwk) ? "on" : "off");
         fputs (str, fp);
         if ((adefault = stringDefault ("review_kill.allow")) != NULL)
         {
@@ -2681,12 +2682,12 @@
             sprintf (str, "review_phaser.parent:   %s\n", adefault);
             fputs (str, fp);
         }
-        adefault = geometryDefault ("review_phaser.geometry");
+        adefault = checkWindowsGeometry (phaserwin);
         sprintf (str, "review_phaser.geometry: %s\n",
                  (adefault != NULL) ? adefault : "auto");
         fputs (str, fp);
         sprintf (str, "review_phaser.mapped:   %s\n",
-                  booleanDefault ("review_phaser.mapped", 0) ? "on" : "off");
+                  W_IsMapped (phaserwin) ? "on" : "off");
         fputs (str, fp);
         if ((adefault = stringDefault ("review_phaser.allow")) != NULL)
         {
@@ -2695,18 +2696,18 @@
         }
         fputs ("\n", fp);
 
-        // Review window - preferred mapped
+        // Review window
         if ((adefault = stringDefault ("review.parent")) != NULL)
         {
             sprintf (str, "review.parent:          %s\n", adefault);
             fputs (str, fp);
         }
-        adefault = geometryDefault ("review.geometry");
+        adefault = checkWindowsGeometry (reviewWin);
         sprintf (str, "review.geometry:        %s\n",
                  (adefault != NULL) ? adefault : "auto");
         fputs (str, fp);
         sprintf (str, "review.mapped:          %s\n",
-                  booleanDefault ("review.mapped", 1) ? "on" : "off");
+                  W_IsMapped (reviewWin) ? "on" : "off");
         fputs (str, fp);
         if ((adefault = stringDefault ("review.allow")) != NULL)
         {
@@ -2721,12 +2722,12 @@
             sprintf (str, "pingStats.parent:       %s\n", adefault);
             fputs (str, fp);
         }
-        adefault = geometryDefault ("pingStats.geometry");
+        adefault = checkWindowsGeometry (pStats);
         sprintf (str, "pingStats.geometry:     %s\n",
                  (adefault != NULL) ? adefault : "auto");
         fputs (str, fp);
         sprintf (str, "pingStats.mapped:       %s\n",
-                  booleanDefault ("pingStats.mapped", 0) ? "on" : "off");
+                  W_IsMapped (pStats) ? "on" : "off");
         fputs (str, fp);
         fputs ("\n", fp);
 
@@ -2736,12 +2737,12 @@
             sprintf (str, "UDP.parent:             %s\n", adefault);
             fputs (str, fp);
         }
-        adefault = geometryDefault ("UDP.geometry");
+        adefault = checkWindowsGeometry (udpWin);
         sprintf (str, "UDP.geometry:           %s\n",
                  (adefault != NULL) ? adefault : "auto");
         fputs (str, fp);
         sprintf (str, "UDP.mapped:             %s\n",
-                  booleanDefault ("UDP.mapped", 0) ? "on" : "off");
+                  W_IsMapped (udpWin) ? "on" : "off");
         fputs (str, fp);
         fputs ("\n", fp);
 
@@ -2752,12 +2753,12 @@
             sprintf (str, "network.parent:         %s\n", adefault);
             fputs (str, fp);
         }
-        adefault = geometryDefault ("network.geometry");
+        adefault = checkWindowsGeometry (spWin);
         sprintf (str, "network.geometry:       %s\n",
                  (adefault != NULL) ? adefault : "auto");
         fputs (str, fp);
         sprintf (str, "network.mapped:         %s\n",
-                  booleanDefault ("network.mapped", 0) ? "on" : "off");
+                  W_IsMapped (spWin) ? "on" : "off");
         fputs (str, fp);
         fputs ("\n", fp);
 #endif
@@ -2769,12 +2770,12 @@
             sprintf (str, "tools.parent:           %s\n", adefault);
             fputs (str, fp);
         }
-        adefault = geometryDefault ("tools.geometry");
+        adefault = checkWindowsGeometry (toolsWin);
         sprintf (str, "tools.geometry:         %s\n",
                  (adefault != NULL) ? adefault : "auto");
         fputs (str, fp);
         sprintf (str, "tools.mapped:           %s\n",
-                  booleanDefault ("tools.mapped", 0) ? "on" : "off");
+                  W_IsMapped (toolsWin) ? "on" : "off");
         fputs (str, fp);
         fputs ("\n", fp);
 #endif
@@ -2786,12 +2787,12 @@
             sprintf (str, "xtrekrc_help.parent:    %s\n", adefault);
             fputs (str, fp);
         }
-        adefault = geometryDefault ("xtrekrc_help.geometry");
+        adefault = checkWindowsGeometry (defWin);
         sprintf (str, "xtrekrc_help.geometry:  %s\n",
                  (adefault != NULL) ? adefault : "auto");
         fputs (str, fp);
         sprintf (str, "xtrekrc_help.mapped:    %s\n",
-                  booleanDefault ("xtrekrc_help.mapped", 0) ? "on" : "off");
+                  W_IsMapped (defWin) ? "on" : "off");
         fputs (str, fp);
         fputs ("\n", fp);
 #endif
@@ -2803,12 +2804,12 @@
             sprintf (str, "DocWin.parent:          %s\n", adefault);
             fputs (str, fp);
         }
-        adefault = geometryDefault ("DocWin.geometry");
+         adefault = checkWindowsGeometry (docwin);
         sprintf (str, "DocWin.geometry:        %s\n",
                  (adefault != NULL) ? adefault : "auto");
         fputs (str, fp);
         sprintf (str, "DocWin.mapped:          %s\n",
-                  booleanDefault ("DocWin.mapped", 0) ? "on" : "off");
+                  W_IsMapped (docwin) ? "on" : "off");
         fputs (str, fp);
         fputs ("\n", fp);
 
@@ -2818,12 +2819,12 @@
             sprintf (str, "xtrekrcWin.parent:      %s\n", adefault);
             fputs (str, fp);
         }
-        adefault = geometryDefault ("xtrekrcWin.geometry");
+        adefault = checkWindowsGeometry (xtrekrcwin);
         sprintf (str, "xtrekrcWin.geometry:    %s\n",
                  (adefault != NULL) ? adefault : "auto");
         fputs (str, fp);
         sprintf (str, "xtrekrcWin.mapped:      %s\n",
-                  booleanDefault ("xtrekrcWin.mapped", 0) ? "on" : "off");
+                  W_IsMapped (xtrekrcwin) ? "on" : "off");
         fputs (str, fp);
         fputs ("\n", fp);
 #endif
@@ -2834,7 +2835,7 @@
             sprintf (str, "fed.parent:             %s\n", adefault);
             fputs (str, fp);
         }
-        adefault = geometryDefault ("fed.geometry");
+        adefault = checkWindowsGeometry (teamWin[0]);
         sprintf (str, "fed.geometry:           %s\n",
                  (adefault != NULL) ? adefault : "auto");
         fputs (str, fp);
@@ -2846,7 +2847,7 @@
             sprintf (str, "kli.parent:             %s\n", adefault);
             fputs (str, fp);
         }
-        adefault = geometryDefault ("kli.geometry");
+        adefault = checkWindowsGeometry (teamWin[2]);
         sprintf (str, "kli.geometry:           %s\n",
                  (adefault != NULL) ? adefault : "auto");
         fputs (str, fp);
@@ -2858,7 +2859,7 @@
             sprintf (str, "ori.parent:             %s\n", adefault);
             fputs (str, fp);
         }
-        adefault = geometryDefault ("ori.geometry");
+        adefault = checkWindowsGeometry (teamWin[3]);
         sprintf (str, "ori.geometry:           %s\n",
                  (adefault != NULL) ? adefault : "auto");
         fputs (str, fp);
@@ -2870,7 +2871,7 @@
             sprintf (str, "rom.parent:             %s\n", adefault);
             fputs (str, fp);
         }
-        adefault = geometryDefault ("rom.geometry");
+        adefault = checkWindowsGeometry (teamWin[1]);
         sprintf (str, "rom.geometry:           %s\n",
                  (adefault != NULL) ? adefault : "auto");
         fputs (str, fp);
@@ -2882,7 +2883,7 @@
             sprintf (str, "quit.parent:            %s\n", adefault);
             fputs (str, fp);
         }
-        adefault = geometryDefault ("quit.geometry");
+         adefault = checkWindowsGeometry (qwin);
         sprintf (str, "quit.geometry:          %s\n",
                  (adefault != NULL) ? adefault : "auto");
         fputs (str, fp);
@@ -2894,12 +2895,12 @@
             sprintf (str, "stats.parent:           %s\n", adefault);
             fputs (str, fp);
         }
-        adefault = geometryDefault ("stats.geometry");
+        adefault = checkWindowsGeometry (statwin);
         sprintf (str, "stats.geometry:         %s\n",
                  (adefault != NULL) ? adefault : "auto");
         fputs (str, fp);
         sprintf (str, "stats.mapped:           %s\n",
-                  booleanDefault ("stats.mapped", 0) ? "on" : "off");
+                  W_IsMapped (statwin) ? "on" : "off");
         fputs (str, fp);
         fputs ("\n", fp);
 
@@ -2909,12 +2910,12 @@
             sprintf (str, "war.parent:             %s\n", adefault);
             fputs (str, fp);
         }
-        adefault = geometryDefault ("war.geometry");
+        adefault = checkWindowsGeometry (war);
         sprintf (str, "war.geometry:           %s\n",
                  (adefault != NULL) ? adefault : "auto");
         fputs (str, fp);
         sprintf (str, "war.mapped:             %s\n",
-                  booleanDefault ("war.mapped", 0) ? "on" : "off");
+                  W_IsMapped (war) ? "on" : "off");
         fputs (str, fp);
         fputs ("\n", fp);
 
@@ -2924,12 +2925,12 @@
             sprintf (str, "sound.parent:           %s\n", adefault);
             fputs (str, fp);
         }
-        adefault = geometryDefault ("sound.geometry");
+        adefault = checkWindowsGeometry (soundWin);
         sprintf (str, "sound.geometry:         %s\n",
                  (adefault != NULL) ? adefault : "auto");
         fputs (str, fp);
         sprintf (str, "sound.mapped:           %s\n",
-                  booleanDefault ("sound.mapped", 0) ? "on" : "off");
+                  W_IsMapped (soundWin) ? "on" : "off");
         fputs (str, fp);
         fputs ("\n", fp);