summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2016-12-16 21:22:39 +0300
committerGeorge Hazan <ghazan@miranda.im>2016-12-16 21:28:28 +0300
commit83175855d796e139c67d145e710336ec44660319 (patch)
treeb9d1c1108a16df476c4484828a94c95b91dbf0a3 /src
parent8c316d216807ca02e86050e29752ac3940a11c7a (diff)
- fix for correct right sided buttons positioning;
- added dynamic buttons change processing
Diffstat (limited to 'src')
-rw-r--r--src/core/stdmsg/src/chat_window.cpp12
-rw-r--r--src/core/stdmsg/src/msgdialog.cpp8
-rw-r--r--src/core/stdmsg/src/msgs.cpp30
3 files changed, 30 insertions, 20 deletions
diff --git a/src/core/stdmsg/src/chat_window.cpp b/src/core/stdmsg/src/chat_window.cpp
index fd098224a4..241e230c70 100644
--- a/src/core/stdmsg/src/chat_window.cpp
+++ b/src/core/stdmsg/src/chat_window.cpp
@@ -906,6 +906,8 @@ void CChatRoomDlg::OnInitDialog()
m_btnColor.OnInit(); m_btnBkColor.OnInit();
m_btnFilter.OnInit(); m_btnHistory.OnInit(); m_btnChannelMgr.OnInit();
+ WindowList_Add(pci->hWindowList, m_hwnd, m_si->hContact);
+
NotifyLocalWinEvent(m_si->hContact, m_hwnd, MSG_WINDOW_EVT_OPENING);
mir_subclassWindow(GetDlgItem(m_hwnd, IDC_SPLITTERX), SplitterSubclassProc);
mir_subclassWindow(GetDlgItem(m_hwnd, IDC_SPLITTERY), SplitterSubclassProc);
@@ -946,6 +948,8 @@ void CChatRoomDlg::OnDestroy()
NotifyLocalWinEvent(m_si->hContact, m_hwnd, MSG_WINDOW_EVT_CLOSING);
SaveWindowPosition(true);
+ WindowList_Remove(pci->hWindowList, m_hwnd);
+
m_si->pDlg = NULL;
m_si->hWnd = NULL;
m_si->wState &= ~STATE_TALK;
@@ -1260,6 +1264,14 @@ INT_PTR CChatRoomDlg::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam)
SetWindowText(getCaptionWindow(), szTemp);
break;
+ case WM_CBD_LOADICONS:
+ Srmm_UpdateToolbarIcons(m_hwnd);
+ break;
+
+ case WM_CBD_UPDATED:
+ SetButtonsPos(m_hwnd, true);
+ break;
+
case GC_UPDATESTATUSBAR:
{
MODULEINFO *mi = pci->MM_FindModule(m_si->pszModule);
diff --git a/src/core/stdmsg/src/msgdialog.cpp b/src/core/stdmsg/src/msgdialog.cpp
index 9c8e135d66..ec5488d3a4 100644
--- a/src/core/stdmsg/src/msgdialog.cpp
+++ b/src/core/stdmsg/src/msgdialog.cpp
@@ -1034,6 +1034,14 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l
}
return 0;
+ case WM_CBD_LOADICONS:
+ Srmm_UpdateToolbarIcons(hwndDlg);
+ break;
+
+ case WM_CBD_UPDATED:
+ SetButtonsPos(hwndDlg, false);
+ break;
+
case WM_SIZE:
if (!IsIconic(hwndDlg)) {
BOOL bottomScroll = TRUE;
diff --git a/src/core/stdmsg/src/msgs.cpp b/src/core/stdmsg/src/msgs.cpp
index fcd63d1074..a8b914577b 100644
--- a/src/core/stdmsg/src/msgs.cpp
+++ b/src/core/stdmsg/src/msgs.cpp
@@ -400,30 +400,20 @@ void SetButtonsPos(HWND hwndDlg, bool bIsChat)
GetClientRect(hwndDlg, &rc);
int iLeftX = 2, iRightX = rc.right - 2;
- for (int i = 0;; i++) {
- CustomButtonData *cbd = Srmm_GetNthButton(i);
- if (cbd == NULL || cbd->m_bRSided)
- break;
-
+ CustomButtonData *cbd;
+ for (int i = 0; cbd = Srmm_GetNthButton(i); i++) {
HWND hwndButton = GetDlgItem(hwndDlg, cbd->m_dwButtonCID);
if (hwndButton == NULL || cbd->m_bHidden)
continue;
- hdwp = DeferWindowPos(hdwp, hwndButton, NULL, iLeftX, yPos, 0, 0, SWP_NOZORDER | SWP_NOSIZE);
- iLeftX += g_dat.iGap + cbd->m_iButtonWidth;
- }
-
- for (int i = Srmm_GetButtonCount() - 1; i >= 0; i--) {
- CustomButtonData *cbd = Srmm_GetNthButton(i);
- if (!cbd->m_bRSided)
- break;
-
- HWND hwndButton = GetDlgItem(hwndDlg, cbd->m_dwButtonCID);
- if (hwndButton == NULL || cbd->m_bHidden)
- continue;
-
- iRightX -= g_dat.iGap + cbd->m_iButtonWidth;
- hdwp = DeferWindowPos(hdwp, hwndButton, NULL, iRightX, yPos, 0, 0, SWP_NOZORDER | SWP_NOSIZE);
+ if (cbd->m_bRSided) {
+ iRightX -= g_dat.iGap + cbd->m_iButtonWidth;
+ hdwp = DeferWindowPos(hdwp, hwndButton, NULL, iRightX, yPos, 0, 0, SWP_NOZORDER | SWP_NOSIZE);
+ }
+ else {
+ hdwp = DeferWindowPos(hdwp, hwndButton, NULL, iLeftX, yPos, 0, 0, SWP_NOZORDER | SWP_NOSIZE);
+ iLeftX += g_dat.iGap + cbd->m_iButtonWidth;
+ }
}
EndDeferWindowPos(hdwp);