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

Function ProperlySizeControls

src/windows/Main.cpp:223–355  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

221bool g_bChannelListVisible = false;
222
223void ProperlySizeControls(HWND hWnd)
224{
225 RECT rect = {}, rect2 = {}, rcClient = {}, rcSBar = {};
226 GetClientRect(hWnd, &rect);
227 int clientWidth = rect.right - rect.left;
228 rcClient = rect;
229
230 int scaled10 = ScaleByDPI(10);
231
232 rect.left += scaled10;
233 rect.top += scaled10;
234 rect.right -= scaled10;
235 rect.bottom -= scaled10;
236
237 HWND hWndMsg = g_pMessageList->m_hwnd;
238 HWND hWndChv = g_pChannelView->m_hwnd;
239 HWND hWndPfv = g_pProfileView->m_hwnd;
240 HWND hWndGuh = g_pGuildHeader->m_hwnd;
241 HWND hWndGul = g_pGuildLister->m_hwnd;
242 HWND hWndMel = g_pMemberList->m_mainHwnd;
243 HWND hWndTin = g_pMessageEditor->m_hwnd;
244 HWND hWndStb = g_pStatusBar->m_hwnd;
245
246 int statusBarHeight = 0;
247 GetChildRect(hWnd, hWndStb, &rcSBar);
248 statusBarHeight = rcSBar.bottom - rcSBar.top;
249
250 rect.bottom -= statusBarHeight;
251 rect2 = rect;
252
253 g_ProfilePictureSize = ScaleByDPI(PROFILE_PICTURE_SIZE_DEF);
254 g_ChannelViewListWidth = ScaleByDPI(CHANNEL_VIEW_LIST_WIDTH);
255 g_BottomBarHeight = ScaleByDPI(BOTTOM_BAR_HEIGHT);
256 g_BottomInputHeight = ScaleByDPI(BOTTOM_INPUT_HEIGHT);
257 g_SendButtonWidth = ScaleByDPI(SEND_BUTTON_WIDTH);
258 g_SendButtonHeight = ScaleByDPI(SEND_BUTTON_HEIGHT);
259 g_GuildHeaderHeight = ScaleByDPI(GUILD_HEADER_HEIGHT);
260 g_GuildListerWidth = ScaleByDPI(PROFILE_PICTURE_SIZE_DEF + 12) + GUILD_LISTER_BORDER_SIZE * 4;
261 g_MemberListWidth = ScaleByDPI(MEMBER_LIST_WIDTH);
262 g_MessageEditorHeight = ScaleByDPI(MESSAGE_EDITOR_HEIGHT);
263
264 if (g_pMessageEditor)
265 g_pMessageEditor->SetJumpPresentHeight(g_BottomBarHeight - g_MessageEditorHeight - scaled10);
266
267 int guildListerWidth = g_GuildListerWidth;
268 int channelViewListWidth = g_ChannelViewListWidth;
269 if (GetLocalSettings()->ShowScrollBarOnGuildList()) {
270 int offset = GetSystemMetrics(SM_CXVSCROLL);
271 guildListerWidth += offset;
272 channelViewListWidth -= offset;
273 }
274
275 bool bRepaintGuildHeader = g_GuildListerWidth2 != guildListerWidth;
276 g_GuildListerWidth2 = guildListerWidth;
277 g_ChannelViewListWidth2 = channelViewListWidth;
278
279 // May need to do some adjustments.
280 bool bFullRepaintProfileView = false;

Callers 1

WindowProcFunction · 0.85

Calls 7

ScaleByDPIFunction · 0.85
GetChildRectFunction · 0.85
GetLocalSettingsFunction · 0.85
SetJumpPresentHeightMethod · 0.80
ExpandedByMethod · 0.80
UpdatePartsMethod · 0.80

Tested by

no test coverage detected