diff options
author | George Hazan <ghazan@miranda.im> | 2016-12-07 18:28:15 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2016-12-07 18:28:15 +0300 |
commit | 15f871ebb43e49f96e8f7e2ec95359bc0a05545f (patch) | |
tree | 81290687285eb633f5eed29714a9bb9e171676b4 /src/core | |
parent | ffd40987e231ae7f06193bafebd7fe045c2d60ae (diff) |
no need to calculate button width each time
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/stdmsg/src/chat_window.cpp | 9 | ||||
-rw-r--r-- | src/core/stdmsg/src/msgdialog.cpp | 5 |
2 files changed, 5 insertions, 9 deletions
diff --git a/src/core/stdmsg/src/chat_window.cpp b/src/core/stdmsg/src/chat_window.cpp index 453b979a3a..a116e7f577 100644 --- a/src/core/stdmsg/src/chat_window.cpp +++ b/src/core/stdmsg/src/chat_window.cpp @@ -1095,9 +1095,8 @@ static void SetButtonsPos(HWND hwndDlg) if (hwndButton == NULL) continue; - int width = iGap + ((cbd->m_dwArrowCID) ? 34 : 22); hdwp = DeferWindowPos(hdwp, hwndButton, NULL, iLeftX, pt.y, 0, 0, SWP_NOZORDER | SWP_NOSIZE); - iLeftX += width; + iLeftX += iGap + cbd->m_iButtonWidth; } for (int i = Srmm_GetButtonCount() - 1; i >= 0; i--) { @@ -1109,8 +1108,7 @@ static void SetButtonsPos(HWND hwndDlg) if (hwndButton == NULL) continue; - int width = iGap + ((cbd->m_dwArrowCID) ? 34 : 22); - iRightX -= width; + iRightX -= iGap + cbd->m_iButtonWidth; hdwp = DeferWindowPos(hdwp, hwndButton, NULL, iRightX, pt.y, 0, 0, SWP_NOZORDER | SWP_NOSIZE); } @@ -1136,8 +1134,7 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar if (!cbd->m_bChatButton) continue; - int width = (cbd->m_dwArrowCID) ? 34 : 22; - HWND hwndButton = CreateWindowEx(0, L"MButtonClass", L"", WS_CHILD | WS_VISIBLE | WS_TABSTOP, 0, 0, width, 22, hwndDlg, (HMENU)cbd->m_dwButtonCID, g_hInst, NULL); + HWND hwndButton = CreateWindowEx(0, L"MButtonClass", L"", WS_CHILD | WS_VISIBLE | WS_TABSTOP, 0, 0, cbd->m_iButtonWidth, 22, hwndDlg, (HMENU)cbd->m_dwButtonCID, g_hInst, NULL); SendMessage(hwndButton, BUTTONSETASFLATBTN, TRUE, 0); if (cbd->m_pwszTooltip) SendMessage(hwndButton, BUTTONADDTOOLTIP, LPARAM(cbd->m_pwszTooltip), BATF_UNICODE); diff --git a/src/core/stdmsg/src/msgdialog.cpp b/src/core/stdmsg/src/msgdialog.cpp index 65ab69b1b2..8f715d0cf5 100644 --- a/src/core/stdmsg/src/msgdialog.cpp +++ b/src/core/stdmsg/src/msgdialog.cpp @@ -490,7 +490,7 @@ static void SetButtonsPos(SrmmWindowData *dat, HWND hwndDlg) for (int i = Srmm_GetButtonCount()-1; i >= 0; i--) {
CustomButtonData *cbd = Srmm_GetNthButton(i);
- int width = iGap + ((cbd->m_dwArrowCID) ? 34 : 22);
+ int width = iGap + cbd->m_iButtonWidth;
HWND hwndButton = GetDlgItem(hwndDlg, cbd->m_dwButtonCID);
if (NULL != hwndButton) /* Wine fix. */ {
@@ -688,8 +688,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l if (!cbd->m_bIMButton)
continue;
- int width = (cbd->m_dwArrowCID) ? 34 : 22;
- HWND hwndButton = CreateWindowEx(0, L"MButtonClass", L"", WS_CHILD | WS_VISIBLE | WS_TABSTOP, 0, 0, width, 22, hwndDlg, (HMENU)cbd->m_dwButtonCID, g_hInst, NULL);
+ HWND hwndButton = CreateWindowEx(0, L"MButtonClass", L"", WS_CHILD | WS_VISIBLE | WS_TABSTOP, 0, 0, cbd->m_iButtonWidth, 22, hwndDlg, (HMENU)cbd->m_dwButtonCID, g_hInst, NULL);
if (cbd->m_pwszTooltip)
SendMessage(hwndButton, BUTTONADDTOOLTIP, LPARAM(cbd->m_pwszTooltip), BATF_UNICODE);
if (cbd->m_hIcon)
|