adjust windows to fit main window layout --------------------------- | Status | +-------------------------+ | | | | | MAP | | | | | +-------------------------+ | Messages | --------------------------- */
| 569 | --------------------------- |
| 570 | */ |
| 571 | void |
| 572 | mswin_layout_main_window(HWND changed_child) |
| 573 | { |
| 574 | winid i; |
| 575 | RECT client_rt, wnd_rect; |
| 576 | POINT status_org; |
| 577 | SIZE status_size; |
| 578 | POINT msg_org; |
| 579 | SIZE msg_size; |
| 580 | POINT map_org; |
| 581 | SIZE map_size; |
| 582 | SIZE menu_size; |
| 583 | HWND wnd_status, wnd_msg; |
| 584 | PNHMainWindow data; |
| 585 | |
| 586 | if (GetNHApp()->bAutoLayout) { |
| 587 | GetClientRect(GetNHApp()->hMainWnd, &client_rt); |
| 588 | data = (PNHMainWindow) GetWindowLongPtr(GetNHApp()->hMainWnd, |
| 589 | GWLP_USERDATA); |
| 590 | |
| 591 | /* get sizes of child windows */ |
| 592 | wnd_status = mswin_hwnd_from_winid(WIN_STATUS); |
| 593 | if (IsWindow(wnd_status)) { |
| 594 | mswin_status_window_size(wnd_status, &status_size); |
| 595 | } else { |
| 596 | status_size.cx = status_size.cy = 0; |
| 597 | } |
| 598 | |
| 599 | wnd_msg = mswin_hwnd_from_winid(WIN_MESSAGE); |
| 600 | if (IsWindow(wnd_msg)) { |
| 601 | mswin_message_window_size(wnd_msg, &msg_size); |
| 602 | } else { |
| 603 | msg_size.cx = msg_size.cy = 0; |
| 604 | } |
| 605 | |
| 606 | /* find all menu windows and calculate the size */ |
| 607 | menu_size.cx = menu_size.cy = 0; |
| 608 | for (i = 0; i < MAXWINDOWS; i++) { |
| 609 | SIZE tmp_size; |
| 610 | if (GetNHApp()->windowlist[i].win |
| 611 | && !GetNHApp()->windowlist[i].dead |
| 612 | && GetNHApp()->windowlist[i].type == NHW_MENU) { |
| 613 | mswin_menu_window_size(GetNHApp()->windowlist[i].win, |
| 614 | &tmp_size); |
| 615 | menu_size.cx = max(menu_size.cx, tmp_size.cx); |
| 616 | menu_size.cy = max(menu_size.cy, tmp_size.cy); |
| 617 | } |
| 618 | } |
| 619 | |
| 620 | /* set window positions */ |
| 621 | SetRect(&wnd_rect, client_rt.left, client_rt.top, client_rt.right, |
| 622 | client_rt.bottom); |
| 623 | switch (iflags.wc_align_status) { |
| 624 | case ALIGN_LEFT: |
| 625 | status_size.cx = (wnd_rect.right - wnd_rect.left) / 4; |
| 626 | status_size.cy = |
| 627 | (wnd_rect.bottom - wnd_rect.top); // that won't look good |
| 628 | status_org.x = wnd_rect.left; |
no test coverage detected