MCPcopy Create free account
hub / github.com/DiscordMessenger/dm / DetermineMessageMeasurements

Method DetermineMessageMeasurements

src/windows/MessageList.cpp:4663–4714  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4661}
4662
4663void MessageList::DetermineMessageMeasurements(MessageItem& mi, HDC _hdc, LPRECT _rect)
4664{
4665 HDC hdc = _hdc;
4666 RECT rect;
4667 if (!_hdc) hdc = GetDC(m_hwnd);
4668 if (!_rect)
4669 GetClientRect(m_hwnd, &rect);
4670 else
4671 rect = *_rect;
4672
4673 LPCTSTR strAuth = mi.m_author;
4674 LPCTSTR strDate = mi.m_date;
4675 LPCTSTR strDateEdit = mi.m_dateEdited;
4676 LPCTSTR strReplyMsg = mi.m_replyMsg;
4677 LPCTSTR strReplyAuth = mi.m_replyAuth;
4678
4679 // measure the height
4680 MeasureMessage(
4681 hdc,
4682 mi.m_message,
4683 strAuth,
4684 strDate,
4685 strDateEdit,
4686 strReplyMsg,
4687 strReplyAuth,
4688 mi.m_msg->m_bIsAuthorBot,
4689 mi.m_msg->m_bIsForward,
4690 rect,
4691 mi.m_textHeight,
4692 mi.m_authHeight,
4693 mi.m_authWidth,
4694 mi.m_dateWidth,
4695 mi.m_replyMessageWidth,
4696 mi.m_replyAuthorWidth,
4697 mi.m_replyHeight,
4698 mi.m_placeInChain
4699 );
4700
4701 const bool isCompact = IsCompact();
4702
4703 if (GetLocalSettings()->ShowEmbedContent()) {
4704 for (auto& embed : mi.m_embedData)
4705 embed.Measure(hdc, rect, isCompact);
4706 }
4707 if (mi.m_pMessagePollData) {
4708 mi.m_pMessagePollData->Measure(hdc, rect, isCompact);
4709 }
4710
4711 AdjustHeightInfo(mi, mi.m_height, mi.m_textHeight, mi.m_authHeight, mi.m_replyHeight, mi.m_attachHeight, mi.m_embedHeight, mi.m_pollHeight);
4712
4713 if (!_hdc) ReleaseDC(m_hwnd, hdc);
4714}
4715
4716void MessageList::EditMessage(Snowflake msgId)
4717{

Callers

nothing calls this directly

Calls 3

GetLocalSettingsFunction · 0.85
ShowEmbedContentMethod · 0.80
MeasureMethod · 0.80

Tested by

no test coverage detected