| 636 | } |
| 637 | |
| 638 | void MessageEditor::Layout() |
| 639 | { |
| 640 | // Re-position controls |
| 641 | RECT rcClient{}; |
| 642 | GetClientRect(m_hwnd, &rcClient); |
| 643 | |
| 644 | int sendButtonWidth = ScaleByDPI(SEND_BUTTON_WIDTH); |
| 645 | int sendButtonHeight = ScaleByDPI(SEND_BUTTON_HEIGHT); |
| 646 | LOGFONT lf{}; |
| 647 | if (!GetObject(g_TypingRegFont, sizeof(LOGFONT), &lf)) { |
| 648 | assert(!"uh oh"); |
| 649 | return; |
| 650 | } |
| 651 | |
| 652 | // between 24 and 28. We gotta have space. |
| 653 | // TODO: Should really be able to expand up to a couple lines |
| 654 | m_lineHeight = MulDiv(abs(lf.lfHeight), 96, 72); |
| 655 | m_mentionAreaHeight = m_lineHeight + ScaleByDPI(4); |
| 656 | |
| 657 | if (m_bReplying) |
| 658 | { |
| 659 | ShowOrHideReply(true); |
| 660 | |
| 661 | RECT rcMentionArea = rcClient; |
| 662 | rcMentionArea.right -= ScaleByDPI(10) + sendButtonWidth; |
| 663 | rcMentionArea.bottom = rcMentionArea.top + m_mentionAreaHeight; |
| 664 | rcClient.top = rcMentionArea.bottom; |
| 665 | |
| 666 | RECT rc = rcMentionArea; |
| 667 | rc.left = rc.right - ScaleByDPI(25) - m_cancelTextWidth; |
| 668 | MoveWindow(m_mentionCancel_hwnd, rc.left, rc.top, rc.right - rc.left, rc.bottom - rc.top, TRUE); |
| 669 | |
| 670 | rc.right = rc.left; |
| 671 | rc.left = rc.right - ScaleByDPI(25) - m_jumpTextWidth; |
| 672 | MoveWindow(m_mentionJump_hwnd, rc.left, rc.top, rc.right - rc.left, rc.bottom - rc.top, TRUE); |
| 673 | |
| 674 | // Reposition the mention text and check windows |
| 675 | int mid = (rcMentionArea.left + rcMentionArea.right) / 2; |
| 676 | rc.right = rc.left; |
| 677 | rc.left = rc.right - m_mentionTextWidth - ScaleByDPI(CHECKBOX_INTERNAL_SIZE + 6); |
| 678 | if (rc.left < mid) |
| 679 | rc.left = mid; |
| 680 | MoveWindow(m_mentionCheck_hwnd, rc.left, rc.top, rc.right - rc.left, rc.bottom - rc.top, TRUE); |
| 681 | |
| 682 | rc.right = rc.left; |
| 683 | rc.left = rcMentionArea.left + m_replyToTextWidth; |
| 684 | MoveWindow(m_mentionName_hwnd, rc.left, rc.top, rc.right - rc.left, rc.bottom - rc.top, TRUE); |
| 685 | |
| 686 | rc.right = rc.left; |
| 687 | rc.left = rcMentionArea.left; |
| 688 | MoveWindow(m_mentionText_hwnd, rc.left, rc.top, rc.right - rc.left, rc.bottom - rc.top, TRUE); |
| 689 | } |
| 690 | else |
| 691 | { |
| 692 | ShowOrHideReply(false); |
| 693 | } |
| 694 | |
| 695 | if (m_bBrowsingPast) |