diff options
author | George Hazan <ghazan@miranda.im> | 2017-03-03 16:16:09 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2017-03-03 16:16:09 +0300 |
commit | 9c6e4b571b98d001c4d0e9d7d8ba35e10e0a04d9 (patch) | |
tree | cf89f5e977bb9643dc737164ba02702e3198f408 | |
parent | 845a9ead2de3db6a6b67925399d6b7ec074652dc (diff) |
GCSessionInfoBase::hwndStatus considered useless
-rw-r--r-- | include/m_chat_int.h | 1 | ||||
-rw-r--r-- | plugins/TabSRMM/src/chat/window.cpp | 16 | ||||
-rw-r--r-- | plugins/TabSRMM/src/controls.cpp | 40 | ||||
-rw-r--r-- | plugins/TabSRMM/src/msgs.h | 1 | ||||
-rw-r--r-- | src/core/stdmsg/src/chat_window.cpp | 39 | ||||
-rw-r--r-- | src/core/stdmsg/src/stdafx.h | 3 |
6 files changed, 54 insertions, 46 deletions
diff --git a/include/m_chat_int.h b/include/m_chat_int.h index d8803f659b..bdef1e766f 100644 --- a/include/m_chat_int.h +++ b/include/m_chat_int.h @@ -204,7 +204,6 @@ struct GCSessionInfoBase WORD wCommandsNum;
void *pItemData;
MCONTACT hContact;
- HWND hwndStatus;
time_t LastTime;
BOOL isToolTip;
diff --git a/plugins/TabSRMM/src/chat/window.cpp b/plugins/TabSRMM/src/chat/window.cpp index dbacffea65..fc69c6d6fa 100644 --- a/plugins/TabSRMM/src/chat/window.cpp +++ b/plugins/TabSRMM/src/chat/window.cpp @@ -162,15 +162,15 @@ void CChatRoomDlg::UpdateWindowState(UINT msg) } } - if (si->hwndStatus) { + if (m_hwndFilter) { POINT pt; GetCursorPos(&pt); RECT rcFilter; - GetWindowRect(si->hwndStatus, &rcFilter); + GetWindowRect(m_hwndFilter, &rcFilter); if (!PtInRect(&rcFilter, pt)) { - SendMessage(si->hwndStatus, WM_CLOSE, 1, 1); - si->hwndStatus = 0; + SendMessage(m_hwndFilter, WM_CLOSE, 1, 1); + m_hwndFilter = 0; } } @@ -2447,17 +2447,17 @@ LABEL_SHOWWINDOW: break; case GC_SHOWFILTERMENU: - si->hwndStatus = CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_FILTER), m_pContainer->hwnd, FilterWndProc, (LPARAM)si); - TranslateDialogDefault(si->hwndStatus); + m_hwndFilter = CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_FILTER), m_pContainer->hwnd, FilterWndProc, (LPARAM)si); + TranslateDialogDefault(m_hwndFilter); RECT rcFilter; - GetClientRect(si->hwndStatus, &rcFilter); + GetClientRect(m_hwndFilter, &rcFilter); GetWindowRect(m_log.GetHwnd(), &rcLog); pt.x = rcLog.right; pt.y = rcLog.bottom; ScreenToClient(m_pContainer->hwnd, &pt); - SetWindowPos(si->hwndStatus, HWND_TOP, pt.x - rcFilter.right, pt.y - rcFilter.bottom, 0, 0, SWP_NOSIZE | SWP_SHOWWINDOW); + SetWindowPos(m_hwndFilter, HWND_TOP, pt.x - rcFilter.right, pt.y - rcFilter.bottom, 0, 0, SWP_NOSIZE | SWP_SHOWWINDOW); break; case GC_SHOWCOLORCHOOSER: diff --git a/plugins/TabSRMM/src/controls.cpp b/plugins/TabSRMM/src/controls.cpp index ed30146c8f..c316631617 100644 --- a/plugins/TabSRMM/src/controls.cpp +++ b/plugins/TabSRMM/src/controls.cpp @@ -880,28 +880,28 @@ LONG_PTR CALLBACK StatusBarSubclassProc(HWND hWnd, UINT msg, WPARAM wParam, LPAR }
return 0;
+ case WM_USER + 101:
// tell status bar to update the part layout (re-calculate part widths)
// needed when an icon is added to or removed from the icon area
- case WM_USER + 101:
- {
- int list_icons = 0;
- dat = (CSrmmWindow*)lParam;
- if (dat)
- while (Srmm_GetNthIcon(dat->m_hContact, list_icons))
- list_icons++;
-
- SendMessage(hWnd, WM_SIZE, 0, 0);
-
- RECT rcs;
- GetWindowRect(hWnd, &rcs);
-
- int statwidths[5];
- statwidths[0] = (rcs.right - rcs.left) - (2 * SB_CHAR_WIDTH + 20) - (list_icons * (PluginConfig.m_smcxicon + 2));
- statwidths[1] = (rcs.right - rcs.left) - (10 + (list_icons * (PluginConfig.m_smcxicon + 2)));
- statwidths[2] = -1;
- SendMessage(hWnd, SB_SETPARTS, 3, (LPARAM)statwidths);
- }
- return 0;
+ {
+ int list_icons = 0;
+ dat = (CSrmmWindow*)lParam;
+ if (dat)
+ while (Srmm_GetNthIcon(dat->m_hContact, list_icons))
+ list_icons++;
+
+ SendMessage(hWnd, WM_SIZE, 0, 0);
+
+ RECT rcs;
+ GetWindowRect(hWnd, &rcs);
+
+ int statwidths[5];
+ statwidths[0] = (rcs.right - rcs.left) - (2 * SB_CHAR_WIDTH + 20) - (list_icons * (PluginConfig.m_smcxicon + 2));
+ statwidths[1] = (rcs.right - rcs.left) - (10 + (list_icons * (PluginConfig.m_smcxicon + 2)));
+ statwidths[2] = -1;
+ SendMessage(hWnd, SB_SETPARTS, 3, (LPARAM)statwidths);
+ }
+ return 0;
case WM_SETCURSOR:
GetCursorPos(&pt);
diff --git a/plugins/TabSRMM/src/msgs.h b/plugins/TabSRMM/src/msgs.h index 74c61465a5..830f2b5469 100644 --- a/plugins/TabSRMM/src/msgs.h +++ b/plugins/TabSRMM/src/msgs.h @@ -478,6 +478,7 @@ public: class CChatRoomDlg : public CTabBaseDlg
{
+ HWND m_hwndFilter;
bool m_bWasDeleted;
CCtrlButton m_btnFilter, m_btnHistory, m_btnOk;
CCtrlButton m_btnBold, m_btnItalic, m_btnUnderline, m_btnColor, m_btnBkColor;
diff --git a/src/core/stdmsg/src/chat_window.cpp b/src/core/stdmsg/src/chat_window.cpp index 36dc59a92a..75a34c72d2 100644 --- a/src/core/stdmsg/src/chat_window.cpp +++ b/src/core/stdmsg/src/chat_window.cpp @@ -65,9 +65,10 @@ static LRESULT CALLBACK SplitterSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, return mir_callNextSubclass(hwnd, SplitterSubclassProc, msg, wParam, lParam); } -static int RoomWndResize(HWND, LPARAM lParam, UTILRESIZECONTROL *urc) +int CChatRoomDlg::RoomWndResize(HWND, LPARAM lParam, UTILRESIZECONTROL *urc) { - SESSION_INFO *si = (SESSION_INFO*)lParam; + CChatRoomDlg *dat = (CChatRoomDlg*)lParam; + SESSION_INFO *si = dat->m_si; RECT rc; BOOL bControl = (BOOL)db_get_b(NULL, CHAT_MODULE, "ShowTopButtons", 1); @@ -78,7 +79,7 @@ static int RoomWndResize(HWND, LPARAM lParam, UTILRESIZECONTROL *urc) switch (urc->wId) { case IDOK: - GetWindowRect(si->hwndStatus, &rc); + GetWindowRect(dat->m_hwndStatus, &rc); urc->rcItem.left = bSend ? 315 : urc->dlgNewSize.cx; urc->rcItem.top = urc->dlgNewSize.cy - si->iSplitterY + 23; urc->rcItem.bottom = urc->dlgNewSize.cy - (rc.bottom - rc.top) - 1; @@ -114,7 +115,7 @@ LBL_CalcBottom: return RD_ANCHORX_WIDTH | RD_ANCHORY_CUSTOM; case IDC_MESSAGE: - GetWindowRect(si->hwndStatus, &rc); + GetWindowRect(dat->m_hwndStatus, &rc); urc->rcItem.right = bSend ? urc->dlgNewSize.cx - 64 : urc->dlgNewSize.cx; urc->rcItem.top = urc->dlgNewSize.cy - si->iSplitterY + 22; urc->rcItem.bottom = urc->dlgNewSize.cy - (rc.bottom - rc.top) - 1; @@ -932,8 +933,12 @@ void CChatRoomDlg::OnInitDialog() SendDlgItemMessage(m_hwnd, IDC_LOG, EM_LIMITTEXT, sizeof(wchar_t) * 0x7FFFFFFF, 0); SendDlgItemMessage(m_hwnd, IDC_LOG, EM_SETOLECALLBACK, 0, (LPARAM)&reOleCallback); - m_si->hwndStatus = CreateWindowEx(0, STATUSCLASSNAME, NULL, WS_CHILD | WS_VISIBLE | SBARS_SIZEGRIP | SBT_TOOLTIPS, 0, 0, 0, 0, m_hwnd, NULL, g_hInst, NULL); - SendMessage(m_si->hwndStatus, SB_SETMINHEIGHT, GetSystemMetrics(SM_CYSMICON), 0); + DWORD dwFlags = WS_CHILD | WS_VISIBLE | SBT_TOOLTIPS; + if (!g_Settings.bTabsEnable) + dwFlags |= SBARS_SIZEGRIP; + + m_hwndStatus = CreateWindowEx(0, STATUSCLASSNAME, NULL, dwFlags, 0, 0, 0, 0, m_hwnd, NULL, g_hInst, NULL); + SendMessage(m_hwndStatus, SB_SETMINHEIGHT, GetSystemMetrics(SM_CYSMICON), 0); SendDlgItemMessage(m_hwnd, IDC_LOG, EM_HIDESELECTION, TRUE, 0); @@ -957,7 +962,7 @@ void CChatRoomDlg::OnDestroy() m_si->pDlg = NULL; m_si->hWnd = NULL; m_si->wState &= ~STATE_TALK; - DestroyWindow(m_si->hwndStatus); m_si->hwndStatus = NULL; + DestroyWindow(m_hwndStatus); m_hwndStatus = NULL; NotifyLocalWinEvent(m_hContact, m_hwnd, MSG_WINDOW_EVT_CLOSE); } @@ -1216,7 +1221,7 @@ INT_PTR CChatRoomDlg::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) } SendMessage(m_hwndParent, GC_FIXTABICONS, 0, 0); - SendMessage(m_si->hwndStatus, SB_SETICON, 0, (LPARAM)hIcon); + SendMessage(m_hwndStatus, SB_SETICON, 0, (LPARAM)hIcon); } Window_SetIcon_IcoLib(getCaptionWindow(), GetIconHandle("window")); @@ -1283,10 +1288,10 @@ INT_PTR CChatRoomDlg::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) MODULEINFO *mi = pci->MM_FindModule(m_si->pszModule); wchar_t *ptszDispName = mi->ptszModDispName; int x = 12; - x += GetTextPixelSize(ptszDispName, (HFONT)SendMessage(m_si->hwndStatus, WM_GETFONT, 0, 0), TRUE); + x += GetTextPixelSize(ptszDispName, (HFONT)SendMessage(m_hwndStatus, WM_GETFONT, 0, 0), TRUE); x += GetSystemMetrics(SM_CXSMICON); int iStatusbarParts[2] = { x, -1 }; - SendMessage(m_si->hwndStatus, SB_SETPARTS, 2, (LPARAM)&iStatusbarParts); + SendMessage(m_hwndStatus, SB_SETPARTS, 2, (LPARAM)&iStatusbarParts); // stupid hack to make icons show. I dunno why this is needed currently HICON hIcon = m_si->wStatus == ID_STATUS_ONLINE ? mi->hOnlineIcon : mi->hOfflineIcon; @@ -1295,13 +1300,13 @@ INT_PTR CChatRoomDlg::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) hIcon = m_si->wStatus == ID_STATUS_ONLINE ? mi->hOnlineIcon : mi->hOfflineIcon; } - SendMessage(m_si->hwndStatus, SB_SETICON, 0, (LPARAM)hIcon); + SendMessage(m_hwndStatus, SB_SETICON, 0, (LPARAM)hIcon); SendMessage(m_hwndParent, GC_FIXTABICONS, 0, 0); - SendMessage(m_si->hwndStatus, SB_SETTEXT, 0, (LPARAM)ptszDispName); + SendMessage(m_hwndStatus, SB_SETTEXT, 0, (LPARAM)ptszDispName); - SendMessage(m_si->hwndStatus, SB_SETTEXT, 1, (LPARAM)(m_si->ptszStatusbarText ? m_si->ptszStatusbarText : L"")); - SendMessage(m_si->hwndStatus, SB_SETTIPTEXT, 1, (LPARAM)(m_si->ptszStatusbarText ? m_si->ptszStatusbarText : L"")); + SendMessage(m_hwndStatus, SB_SETTEXT, 1, (LPARAM)(m_si->ptszStatusbarText ? m_si->ptszStatusbarText : L"")); + SendMessage(m_hwndStatus, SB_SETTIPTEXT, 1, (LPARAM)(m_si->ptszStatusbarText ? m_si->ptszStatusbarText : L"")); } return TRUE; @@ -1310,7 +1315,7 @@ INT_PTR CChatRoomDlg::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) PostMessage(m_hwnd, GC_SCROLLTOBOTTOM, 0, 0); if (!IsIconic(m_hwnd)) { - SendMessage(m_si->hwndStatus, WM_SIZE, 0, 0); + SendMessage(m_hwndStatus, WM_SIZE, 0, 0); BOOL bControl = (BOOL)db_get_b(NULL, CHAT_MODULE, "ShowTopButtons", 1); BOOL bFormat = (BOOL)db_get_b(NULL, CHAT_MODULE, "ShowFormatButtons", 1); @@ -1346,10 +1351,10 @@ INT_PTR CChatRoomDlg::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) EnableWindow(m_btnChannelMgr.GetHwnd(), pci->MM_FindModule(m_si->pszModule)->bChanMgr); } - Utils_ResizeDialog(m_hwnd, g_hInst, MAKEINTRESOURCEA(IDD_CHANNEL), RoomWndResize, (LPARAM)m_si); + Utils_ResizeDialog(m_hwnd, g_hInst, MAKEINTRESOURCEA(IDD_CHANNEL), RoomWndResize, (LPARAM)this); SetButtonsPos(m_hwnd, true); - InvalidateRect(m_si->hwndStatus, NULL, TRUE); + InvalidateRect(m_hwndStatus, NULL, TRUE); RedrawWindow(m_message.GetHwnd(), NULL, NULL, RDW_INVALIDATE); RedrawWindow(m_btnOk.GetHwnd(), NULL, NULL, RDW_INVALIDATE); SaveWindowPosition(false); diff --git a/src/core/stdmsg/src/stdafx.h b/src/core/stdmsg/src/stdafx.h index 838c2c359e..f39b6c0199 100644 --- a/src/core/stdmsg/src/stdafx.h +++ b/src/core/stdmsg/src/stdafx.h @@ -175,6 +175,9 @@ class CChatRoomDlg : public CSrmmBaseDialog {
friend struct CTabbedWindow;
+ static int RoomWndResize(HWND, LPARAM lParam, UTILRESIZECONTROL *urc);
+ HWND m_hwndStatus;
+
SESSION_INFO *m_si;
CCtrlEdit m_message, m_log;
|