=== modified file 'src/window.cpp' --- src/window.cpp 2008-04-26 12:21:36 +0000 +++ src/window.cpp 2008-04-26 12:23:09 +0000 @@ -918,6 +918,13 @@ /** * Compute the position of the top-left corner of a new window that is opened. * + * By default position a child window at an offset of 10/10 of its parent. + * With the exception of WC_BUILD_TOOLBAR (build railway/roads/ship docks/airports) + * and WC_SCEN_LAND_GEN (landscaping). Whose child window has an offset of 0/36 of + * its parent. So it's exactly under the parent toolbar and no buttons will be covered. + * However if it falls too extremely outside window positions, reposition + * it to an automatic place. + * * @param *desc The pointer to the WindowDesc to be created * @param window_number the window number of the new window * @@ -928,12 +935,6 @@ Point pt; Window *w; - /* By default position a child window at an offset of 10/10 of its parent. - * With the exception of WC_BUILD_TOOLBAR (build railway/roads/ship docks/airports) - * and WC_SCEN_LAND_GEN (landscaping). Whose child window has an offset of 0/36 of - * its parent. So it's exactly under the parent toolbar and no buttons will be covered. - * However if it falls too extremely outside window positions, reposition - * it to an automatic place */ if (desc->parent_cls != 0 /* WC_MAIN_WINDOW */ && (w = FindWindowById(desc->parent_cls, window_number)) != NULL && w->left < _screen.width - 20 && w->left > -60 && w->top < _screen.height - 20) { @@ -945,16 +946,16 @@ pt.y = w->top + ((desc->parent_cls == WC_BUILD_TOOLBAR || desc->parent_cls == WC_SCEN_LAND_GEN) ? 36 : 10); } else { switch (desc->left) { - case WDP_ALIGN_TBR: { /* Align the right side with the top toolbar */ + case WDP_ALIGN_TBR: { // Align the right side with the top toolbar w = FindWindowById(WC_MAIN_TOOLBAR, 0); pt.x = (w->left + w->width) - desc->default_width; } break; - case WDP_ALIGN_TBL: /* Align the left side with the top toolbar */ + case WDP_ALIGN_TBL: // Align the left side with the top toolbar pt.x = FindWindowById(WC_MAIN_TOOLBAR, 0)->left; break; - case WDP_AUTO: /* Find a good automatic position for the window */ + case WDP_AUTO: // Find a good automatic position for the window return GetAutoPlacePosition(desc->default_width, desc->default_height); - case WDP_CENTER: /* Centre the window horizontally */ + case WDP_CENTER: // Centre the window horizontally pt.x = (_screen.width - desc->default_width) / 2; break; default: @@ -963,7 +964,7 @@ } switch (desc->top) { - case WDP_CENTER: /* Centre the window vertically */ + case WDP_CENTER: // Centre the window vertically pt.y = (_screen.height - desc->default_height) / 2; break; /* WDP_AUTO sets the position at once and is controlled by desc->left.