From e0082769561896ea56327fbba5499b13b8043861 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Wed, 9 May 2018 14:04:32 +0200 Subject: fixes #1340 (StdMsg: first button on buttons toolbar is bugged in some cases) --- src/core/stdmsg/src/msgdialog.cpp | 4 ++-- src/core/stdmsg/src/msgs.cpp | 21 +++++++-------------- 2 files changed, 9 insertions(+), 16 deletions(-) (limited to 'src/core/stdmsg') diff --git a/src/core/stdmsg/src/msgdialog.cpp b/src/core/stdmsg/src/msgdialog.cpp index 02278c8e9f..df810752a3 100644 --- a/src/core/stdmsg/src/msgdialog.cpp +++ b/src/core/stdmsg/src/msgdialog.cpp @@ -353,12 +353,12 @@ void CSrmmWindow::OnOptionsApplied(bool bUpdateAvatar) continue; bool bShow = false; - if (m_hContact) { + if (m_hContact && g_dat.bShowButtons) { if (cbd->m_dwButtonCID == IDC_ADD) { bShow = 0 != db_get_b(m_hContact, "CList", "NotOnList", 0); cbd->m_bHidden = !bShow; } - else bShow = g_dat.bShowButtons; + else bShow = true; } ShowWindow(hwndButton, (bShow) ? SW_SHOW : SW_HIDE); } diff --git a/src/core/stdmsg/src/msgs.cpp b/src/core/stdmsg/src/msgs.cpp index 1b8a5f9727..eac78a6b84 100644 --- a/src/core/stdmsg/src/msgs.cpp +++ b/src/core/stdmsg/src/msgs.cpp @@ -409,27 +409,20 @@ void SetButtonsPos(HWND hwndDlg, bool bIsChat) GetClientRect(hwndDlg, &rc); int iLeftX = 2, iRightX = rc.right - 2; - bool bShow = (bIsChat) ? true : g_dat.bShowButtons; - CustomButtonData *cbd; for (int i = 0; cbd = Srmm_GetNthButton(i); i++) { HWND hwndButton = GetDlgItem(hwndDlg, cbd->m_dwButtonCID); if (hwndButton == nullptr || cbd->m_bHidden) continue; - if (bShow) { - ShowWindow(hwndButton, SW_SHOW); - - if (cbd->m_bRSided) { - iRightX -= g_dat.iGap + cbd->m_iButtonWidth; - hdwp = DeferWindowPos(hdwp, hwndButton, nullptr, iRightX, yPos, 0, 0, SWP_NOZORDER | SWP_NOSIZE); - } - else { - hdwp = DeferWindowPos(hdwp, hwndButton, nullptr, iLeftX, yPos, 0, 0, SWP_NOZORDER | SWP_NOSIZE); - iLeftX += g_dat.iGap + cbd->m_iButtonWidth; - } + if (cbd->m_bRSided) { + iRightX -= g_dat.iGap + cbd->m_iButtonWidth; + hdwp = DeferWindowPos(hdwp, hwndButton, nullptr, iRightX, yPos, 0, 0, SWP_NOZORDER | SWP_NOSIZE); + } + else { + hdwp = DeferWindowPos(hdwp, hwndButton, nullptr, iLeftX, yPos, 0, 0, SWP_NOZORDER | SWP_NOSIZE); + iLeftX += g_dat.iGap + cbd->m_iButtonWidth; } - else ShowWindow(hwndButton, SW_HIDE); } EndDeferWindowPos(hdwp); -- cgit v1.2.3