From 8f7b9a76a69cbe33a9050171a1e139d726857ca1 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Mon, 10 Apr 2017 16:09:07 +0300 Subject: code reorder to hide as much data as possible --- plugins/TabSRMM/src/chat_tools.cpp | 4 +- plugins/TabSRMM/src/chat_window.cpp | 2 +- plugins/TabSRMM/src/container.cpp | 4 +- plugins/TabSRMM/src/generic_msghandlers.cpp | 2 +- plugins/TabSRMM/src/infopanel.cpp | 2 +- plugins/TabSRMM/src/msgdialog.cpp | 2 +- plugins/TabSRMM/src/msgdlgutils.cpp | 5 +- plugins/TabSRMM/src/msglog.cpp | 108 +++++++++++----------- plugins/TabSRMM/src/msgs.cpp | 5 +- plugins/TabSRMM/src/msgs.h | 135 +++++++++++++++------------- plugins/TabSRMM/src/taskbar.cpp | 37 +++----- plugins/TabSRMM/src/taskbar.h | 2 - plugins/TabSRMM/src/userprefs.cpp | 2 +- plugins/TabSRMM/src/utils.cpp | 107 +++++++++++----------- plugins/TabSRMM/src/utils.h | 5 -- 15 files changed, 197 insertions(+), 225 deletions(-) (limited to 'plugins/TabSRMM') diff --git a/plugins/TabSRMM/src/chat_tools.cpp b/plugins/TabSRMM/src/chat_tools.cpp index 256648b33c..0caa7224a3 100644 --- a/plugins/TabSRMM/src/chat_tools.cpp +++ b/plugins/TabSRMM/src/chat_tools.cpp @@ -213,9 +213,9 @@ void DoFlashAndSoundWorker(FLASH_PARAMS *p) if (dat) { p->bInactive = dat->m_pContainer->m_hwnd != GetForegroundWindow(); p->bActiveTab = (dat->m_pContainer->m_hwndActive == si->pDlg->GetHwnd()); + if (p->sound && dat->MustPlaySound()) + SkinPlaySound(p->sound); } - if (p->sound && Utils::mustPlaySound(si->pDlg)) - SkinPlaySound(p->sound); } else if (p->sound) SkinPlaySound(p->sound); diff --git a/plugins/TabSRMM/src/chat_window.cpp b/plugins/TabSRMM/src/chat_window.cpp index 0635fce62b..bde388d85f 100644 --- a/plugins/TabSRMM/src/chat_window.cpp +++ b/plugins/TabSRMM/src/chat_window.cpp @@ -2387,7 +2387,7 @@ INT_PTR CChatRoomDlg::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) case WM_DWMCOMPOSITIONCHANGED: BB_RefreshTheme(); m_pContainer->ClearMargins(); - CProxyWindow::verify(this); + VerifyProxy(); break; } return CTabBaseDlg::DlgProc(uMsg, wParam, lParam); diff --git a/plugins/TabSRMM/src/container.cpp b/plugins/TabSRMM/src/container.cpp index 08a742babf..981406cdd5 100644 --- a/plugins/TabSRMM/src/container.cpp +++ b/plugins/TabSRMM/src/container.cpp @@ -81,7 +81,7 @@ void TContainerData::UpdateTitle(MCONTACT hContact, CTabBaseDlg *pDlg) if (dat) { SendMessage(m_hwnd, DM_SETICON, (WPARAM)dat, (LPARAM)(dat->m_hXStatusIcon ? dat->m_hXStatusIcon : dat->m_hTabStatusIcon)); CMStringW szTitle; - if (Utils::FormatTitleBar(dat, settings->szTitleFormat, szTitle)) + if (dat->FormatTitleBar(settings->szTitleFormat, szTitle)) SetWindowText(m_hwnd, szTitle); } } @@ -1693,7 +1693,7 @@ panel_found: if (dat) { if (dat->m_hTaskbarIcon == 0) - dat->m_hTaskbarIcon = ((dat->m_pContainer->dwFlags & CNT_AVATARSONTASKBAR) ? Utils::iconFromAvatar(dat) : 0); + dat->m_hTaskbarIcon = ((dat->m_pContainer->dwFlags & CNT_AVATARSONTASKBAR) ? dat->IconFromAvatar() : 0); else { if (!(dat->m_pContainer->dwFlags & CNT_AVATARSONTASKBAR)) { DestroyIcon(dat->m_hTaskbarIcon); diff --git a/plugins/TabSRMM/src/generic_msghandlers.cpp b/plugins/TabSRMM/src/generic_msghandlers.cpp index 7cc4f4c7ee..c2fe808c83 100644 --- a/plugins/TabSRMM/src/generic_msghandlers.cpp +++ b/plugins/TabSRMM/src/generic_msghandlers.cpp @@ -588,7 +588,7 @@ void CTabBaseDlg::DM_InitRichEdit() pf2.cbSize = sizeof(pf2); pf2.wEffects = PFE_RTLPARA; pf2.dwMask = PFM_RTLPARA; - if (Utils::FindRTLLocale(this)) + if (FindRTLLocale()) m_message.SendMsg(EM_SETPARAFORMAT, 0, (LPARAM)&pf2); if (!(m_dwFlags & MWF_LOG_RTL)) { pf2.wEffects = 0; diff --git a/plugins/TabSRMM/src/infopanel.cpp b/plugins/TabSRMM/src/infopanel.cpp index 2a37689a54..0d9897974d 100644 --- a/plugins/TabSRMM/src/infopanel.cpp +++ b/plugins/TabSRMM/src/infopanel.cpp @@ -1361,7 +1361,7 @@ void CTip::show(const RECT& rc, POINT& pt, const HICON hIcon, const wchar_t *szT smadd.flags = 0; smadd.rangeToReplace = nullptr; smadd.disableRedraw = TRUE; - CallService(MS_SMILEYADD_REPLACESMILEYS, TABSRMM_SMILEYADD_BKGCOLORMODE, (LPARAM)&smadd); + CallService(MS_SMILEYADD_REPLACESMILEYS, 0, (LPARAM)&smadd); } RECT rcParent; diff --git a/plugins/TabSRMM/src/msgdialog.cpp b/plugins/TabSRMM/src/msgdialog.cpp index 86dd2ea20d..e0c77fe6c1 100644 --- a/plugins/TabSRMM/src/msgdialog.cpp +++ b/plugins/TabSRMM/src/msgdialog.cpp @@ -3048,7 +3048,7 @@ INT_PTR CSrmmWindow::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) case WM_DWMCOMPOSITIONCHANGED: BB_RefreshTheme(); m_pContainer->ClearMargins(); - CProxyWindow::verify(this); + VerifyProxy(); break; case DM_FORCEREDRAW: diff --git a/plugins/TabSRMM/src/msgdlgutils.cpp b/plugins/TabSRMM/src/msgdlgutils.cpp index a05ad3a6f1..3901453004 100644 --- a/plugins/TabSRMM/src/msgdlgutils.cpp +++ b/plugins/TabSRMM/src/msgdlgutils.cpp @@ -1163,8 +1163,7 @@ void CTabBaseDlg::LoadSplitter() void CTabBaseDlg::PlayIncomingSound() const { - int iPlay = Utils::mustPlaySound(this); - + int iPlay = MustPlaySound(); if (iPlay) { if (GetForegroundWindow() == m_pContainer->m_hwnd && m_pContainer->m_hwndActive == m_hwnd) SkinPlaySound("RecvMsgActive"); @@ -1244,7 +1243,7 @@ void CTabBaseDlg::GetLocaleID(const wchar_t *szKLName) pf2.cbSize = sizeof(pf2); pf2.dwMask = PFM_RTLPARA; m_message.SendMsg(EM_GETPARAFORMAT, 0, (LPARAM)&pf2); - if (Utils::FindRTLLocale(this) && fLocaleNotSet) { + if (FindRTLLocale() && fLocaleNotSet) { if (wCtype2[0] == C2_RIGHTTOLEFT || wCtype2[1] == C2_RIGHTTOLEFT || wCtype2[2] == C2_RIGHTTOLEFT) { memset(&pf2, 0, sizeof(pf2)); pf2.dwMask = PFM_RTLPARA; diff --git a/plugins/TabSRMM/src/msglog.cpp b/plugins/TabSRMM/src/msglog.cpp index 9671241de0..90f6b67c4a 100644 --- a/plugins/TabSRMM/src/msglog.cpp +++ b/plugins/TabSRMM/src/msglog.cpp @@ -477,7 +477,7 @@ static char* Template_CreateRTFFromDbEvent(CTabBaseDlg *dat, MCONTACT hContact, return nullptr; } TrimMessage(msg); - formatted = const_cast(Utils::FormatRaw(dat, msg, dwFormattingParams, FALSE)); + formatted = const_cast(dat->FormatRaw(msg, dwFormattingParams, FALSE)); mir_free(msg); CMStringA str; @@ -1074,57 +1074,47 @@ static DWORD CALLBACK LogStreamInEvents(DWORD_PTR dwCookie, LPBYTE pbBuff, LONG return 0; } -static void SetupLogFormatting(CTabBaseDlg *dat) -{ - if (dat->m_hHistoryEvents) - strncpy_s(dat->m_szMicroLf, "\\v\\cf%d \\ ~-+%d+-~\\v0 ", _TRUNCATE); - else - mir_snprintf(dat->m_szMicroLf, "%s\\par\\ltrpar\\sl-1%s ", GetRTFFont(MSGDLGFONTCOUNT), GetRTFFont(MSGDLGFONTCOUNT)); -} - -static void ReplaceIcons(HWND hwndDlg, CTabBaseDlg *dat, LONG startAt, int fAppend, BOOL isSent) +void CTabBaseDlg::ReplaceIcons(LONG startAt, int fAppend, BOOL isSent) { wchar_t trbuffer[40]; TEXTRANGE tr; tr.lpstrText = trbuffer; - HWND hwndrtf = GetDlgItem(hwndDlg, IDC_SRMM_LOG); - FINDTEXTEX fi; fi.chrg.cpMin = startAt; - if (dat->m_bClrAdded) { + if (m_bClrAdded) { fi.lpstrText = L"##col##"; fi.chrg.cpMax = -1; CHARFORMAT2 cf2; memset(&cf2, 0, sizeof(cf2)); cf2.cbSize = sizeof(cf2); cf2.dwMask = CFM_COLOR; - while (SendMessage(hwndrtf, EM_FINDTEXTEX, FR_DOWN, (LPARAM)&fi) > -1) { + while (m_log.SendMsg(EM_FINDTEXTEX, FR_DOWN, (LPARAM)&fi) > -1) { tr.chrg.cpMin = fi.chrgText.cpMin; tr.chrg.cpMax = tr.chrg.cpMin + 18; trbuffer[0] = 0; - SendMessage(hwndrtf, EM_GETTEXTRANGE, 0, (LPARAM)&tr); + m_log.SendMsg(EM_GETTEXTRANGE, 0, (LPARAM)&tr); trbuffer[18] = 0; CHARRANGE cr; cr.cpMin = fi.chrgText.cpMin; cr.cpMax = cr.cpMin + 18; - SendMessage(hwndrtf, EM_EXSETSEL, 0, (LPARAM)&cr); - SendMessage(hwndrtf, EM_REPLACESEL, FALSE, (LPARAM)L""); + m_log.SendMsg(EM_EXSETSEL, 0, (LPARAM)&cr); + m_log.SendMsg(EM_REPLACESEL, FALSE, (LPARAM)L""); UINT length = (unsigned int)_wtol(&trbuffer[7]); int index = _wtol(&trbuffer[14]); if (length > 0 && length < 20000 && index >= RTF_CTABLE_DEFSIZE && index < Utils::rtf_ctable_size) { cf2.crTextColor = Utils::rtf_ctable[index].clr; cr.cpMin = fi.chrgText.cpMin; cr.cpMax = cr.cpMin + length; - SendMessage(hwndrtf, EM_EXSETSEL, 0, (LPARAM)&cr); - SendMessage(hwndrtf, EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf2); + m_log.SendMsg(EM_EXSETSEL, 0, (LPARAM)&cr); + m_log.SendMsg(EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf2); } } } fi.chrg.cpMin = startAt; - if (dat->m_dwFlags & MWF_LOG_SHOWICONS) { + if (m_dwFlags & MWF_LOG_SHOWICONS) { fi.lpstrText = L"#~#"; fi.chrg.cpMax = -1; @@ -1134,16 +1124,16 @@ static void ReplaceIcons(HWND hwndDlg, CTabBaseDlg *dat, LONG startAt, int fAppe cf2.dwMask = CFM_BACKCOLOR; CComPtr ole; - SendMessage(hwndrtf, EM_GETOLEINTERFACE, 0, (LPARAM)&ole); - while (SendMessageA(hwndrtf, EM_FINDTEXTEX, FR_DOWN, (LPARAM)&fi) > -1) { + m_log.SendMsg(EM_GETOLEINTERFACE, 0, (LPARAM)&ole); + while (m_log.SendMsg(EM_FINDTEXTEX, FR_DOWN, (LPARAM)&fi) > -1) { CHARRANGE cr; cr.cpMin = fi.chrgText.cpMin; cr.cpMax = fi.chrgText.cpMax + 2; - SendMessage(hwndrtf, EM_EXSETSEL, 0, (LPARAM)&cr); + m_log.SendMsg(EM_EXSETSEL, 0, (LPARAM)&cr); tr.chrg.cpMin = fi.chrgText.cpMin + 3; tr.chrg.cpMax = fi.chrgText.cpMin + 5; - SendMessage(hwndrtf, EM_GETTEXTRANGE, 0, (LPARAM)&tr); + m_log.SendMsg(EM_GETTEXTRANGE, 0, (LPARAM)&tr); int bIconIndex = trbuffer[0] - '0'; if (bIconIndex >= NR_LOGICONS) { @@ -1152,14 +1142,14 @@ static void ReplaceIcons(HWND hwndDlg, CTabBaseDlg *dat, LONG startAt, int fAppe } char bDirection = trbuffer[1]; - SendMessage(hwndrtf, EM_GETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf2); + m_log.SendMsg(EM_GETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf2); COLORREF crDefault; if (cf2.crBackColor != 0) crDefault = cf2.crBackColor; else if (bDirection == '>') - crDefault = (fAppend) ? dat->m_pContainer->theme.outbg : dat->m_pContainer->theme.oldoutbg; + crDefault = (fAppend) ? m_pContainer->theme.outbg : m_pContainer->theme.oldoutbg; else - crDefault = (fAppend) ? dat->m_pContainer->theme.inbg : dat->m_pContainer->theme.oldinbg; + crDefault = (fAppend) ? m_pContainer->theme.inbg : m_pContainer->theme.oldinbg; TLogIcon theIcon(Logicons[bIconIndex], crDefault); CImageDataObject::InsertBitmap(ole, theIcon.m_hBmp); @@ -1174,32 +1164,32 @@ static void ReplaceIcons(HWND hwndDlg, CTabBaseDlg *dat, LONG startAt, int fAppe sel.cpMax = -1; SMADD_RICHEDIT3 smadd = { sizeof(smadd) }; - smadd.hwndRichEditControl = hwndrtf; - smadd.Protocolname = const_cast(dat->m_cache->getActiveProto()); - smadd.hContact = dat->m_cache->getActiveContact(); + smadd.hwndRichEditControl = m_log.GetHwnd(); + smadd.Protocolname = const_cast(m_cache->getActiveProto()); + smadd.hContact = m_cache->getActiveContact(); smadd.flags = isSent ? SAFLRE_OUTGOING : 0; if (startAt > 0) smadd.rangeToReplace = &sel; else smadd.rangeToReplace = nullptr; smadd.disableRedraw = TRUE; - CallService(MS_SMILEYADD_REPLACESMILEYS, TABSRMM_SMILEYADD_BKGCOLORMODE, (LPARAM)&smadd); + CallService(MS_SMILEYADD_REPLACESMILEYS, 0, (LPARAM)&smadd); } - if (dat->m_hHistoryEvents && dat->m_curHistory == dat->m_maxHistory) { - char szPattern[50]; - mir_snprintf(szPattern, "~-+%d+-~", (INT_PTR)dat->m_hHistoryEvents[0]); + if (m_hHistoryEvents && m_curHistory == m_maxHistory) { + wchar_t szPattern[50]; + mir_snwprintf(szPattern, L"~-+%d+-~", (INT_PTR)m_hHistoryEvents[0]); - FINDTEXTEXA ft; + FINDTEXTEX ft; ft.lpstrText = szPattern; ft.chrg.cpMin = 0; ft.chrg.cpMax = -1; - if (SendMessageA(hwndrtf, EM_FINDTEXTEX, FR_DOWN, (LPARAM)&ft) != 0) { + if (m_log.SendMsg(EM_FINDTEXTEX, FR_DOWN, (LPARAM)&ft) != 0) { CHARRANGE sel; sel.cpMin = 0; sel.cpMax = 20; - SendMessage(hwndrtf, EM_SETSEL, 0, ft.chrgText.cpMax + 1); - SendMessageA(hwndrtf, EM_REPLACESEL, TRUE, (LPARAM)""); + m_log.SendMsg(EM_SETSEL, 0, ft.chrgText.cpMax + 1); + m_log.SendMsg(EM_REPLACESEL, TRUE, (LPARAM)L""); } } } @@ -1280,14 +1270,18 @@ void CTabBaseDlg::StreamInEvents(MEVENT hDbEventFirst, int count, int fAppend, D // separator strings used for grid lines, message separation and so on... m_bClrAdded = false; - if (m_szMicroLf[0] == 0) - SetupLogFormatting(this); - + if (m_szMicroLf[0] == 0) { + if (m_hHistoryEvents) + strncpy_s(m_szMicroLf, "\\v\\cf%d \\ ~-+%d+-~\\v0 ", _TRUNCATE); + else + mir_snprintf(m_szMicroLf, "%s\\par\\ltrpar\\sl-1%s ", GetRTFFont(MSGDLGFONTCOUNT), GetRTFFont(MSGDLGFONTCOUNT)); + } + szYourName = const_cast(m_cache->getNick()); szMyName = m_wszMyNickname; - SendMessage(hwndrtf, EM_HIDESELECTION, TRUE, 0); - SendMessage(hwndrtf, EM_EXGETSEL, 0, (LPARAM)&oldSel); + m_log.SendMsg(EM_HIDESELECTION, TRUE, 0); + m_log.SendMsg(EM_EXGETSEL, 0, (LPARAM)&oldSel); LogStreamData streamData = { 0 }; streamData.hContact = m_hContact; @@ -1307,29 +1301,29 @@ void CTabBaseDlg::StreamInEvents(MEVENT hDbEventFirst, int count, int fAppend, D GETTEXTLENGTHEX gtxl = { 0 }; gtxl.codepage = 1200; gtxl.flags = GTL_DEFAULT | GTL_PRECISE | GTL_NUMCHARS; - startAt = SendMessage(hwndrtf, EM_GETTEXTLENGTHEX, (WPARAM)>xl, 0); + startAt = m_log.SendMsg(EM_GETTEXTLENGTHEX, (WPARAM)>xl, 0); sel.cpMin = sel.cpMax = GetWindowTextLength(hwndrtf); - SendMessage(hwndrtf, EM_EXSETSEL, 0, (LPARAM)&sel); + m_log.SendMsg(EM_EXSETSEL, 0, (LPARAM)&sel); } else { SetWindowText(hwndrtf, L""); sel.cpMin = 0; sel.cpMax = GetWindowTextLength(hwndrtf); - SendMessage(hwndrtf, EM_EXSETSEL, 0, (LPARAM)&sel); + m_log.SendMsg(EM_EXSETSEL, 0, (LPARAM)&sel); startAt = 0; m_isAutoRTL = 0; } // begin to draw - SendMessage(hwndrtf, WM_SETREDRAW, FALSE, 0); + m_log.SendMsg(WM_SETREDRAW, FALSE, 0); - SendMessage(hwndrtf, EM_STREAMIN, fAppend ? SFF_SELECTION | SF_RTF : SFF_SELECTION | SF_RTF, (LPARAM)&stream); - SendMessage(hwndrtf, EM_EXSETSEL, 0, (LPARAM)&oldSel); - SendMessage(hwndrtf, EM_HIDESELECTION, FALSE, 0); + m_log.SendMsg(EM_STREAMIN, fAppend ? SFF_SELECTION | SF_RTF : SFF_SELECTION | SF_RTF, (LPARAM)&stream); + m_log.SendMsg(EM_EXSETSEL, 0, (LPARAM)&oldSel); + m_log.SendMsg(EM_HIDESELECTION, FALSE, 0); m_hDbEventLast = streamData.hDbEventLast; if (m_isAutoRTL & 1) - SendMessage(hwndrtf, EM_SETBKGNDCOLOR, 0, (LOWORD(m_iLastEventType) & DBEF_SENT) + m_log.SendMsg(EM_SETBKGNDCOLOR, 0, (LOWORD(m_iLastEventType) & DBEF_SENT) ? (fAppend ? m_pContainer->theme.outbg : m_pContainer->theme.oldoutbg) : (fAppend ? m_pContainer->theme.inbg : m_pContainer->theme.oldinbg)); @@ -1338,10 +1332,10 @@ void CTabBaseDlg::StreamInEvents(MEVENT hDbEventFirst, int count, int fAppend, D gtxl.codepage = 1200; gtxl.flags = GTL_DEFAULT | GTL_PRECISE | GTL_NUMCHARS; - sel.cpMax = SendMessage(hwndrtf, EM_GETTEXTLENGTHEX, (WPARAM)>xl, 0); + sel.cpMax = m_log.SendMsg(EM_GETTEXTLENGTHEX, (WPARAM)>xl, 0); sel.cpMin = sel.cpMax - 1; - SendMessage(hwndrtf, EM_EXSETSEL, 0, (LPARAM)&sel); - SendMessage(hwndrtf, EM_REPLACESEL, FALSE, (LPARAM)L""); + m_log.SendMsg(EM_EXSETSEL, 0, (LPARAM)&sel); + m_log.SendMsg(EM_REPLACESEL, FALSE, (LPARAM)L""); m_isAutoRTL |= 2; } @@ -1354,17 +1348,17 @@ void CTabBaseDlg::StreamInEvents(MEVENT hDbEventFirst, int count, int fAppend, D isSent = (dbei.flags & DBEF_SENT) != 0; } - ReplaceIcons(m_hwnd, this, startAt, fAppend, isSent); + ReplaceIcons(startAt, fAppend, isSent); m_bClrAdded = false; if (m_hwndIEView == nullptr && m_hwndHPP == nullptr) { int len = GetWindowTextLength(hwndrtf); - SendMessage(hwndrtf, EM_SETSEL, len - 1, len - 1); + m_log.SendMsg(EM_SETSEL, len - 1, len - 1); } DM_ScrollToBottom(0, 0); - SendMessage(hwndrtf, WM_SETREDRAW, TRUE, 0); + m_log.SendMsg(WM_SETREDRAW, TRUE, 0); InvalidateRect(hwndrtf, nullptr, FALSE); EnableWindow(GetDlgItem(m_hwnd, IDC_QUOTE), m_hDbEventLast != 0); mir_free(streamData.buffer); diff --git a/plugins/TabSRMM/src/msgs.cpp b/plugins/TabSRMM/src/msgs.cpp index 5773c2240a..e01de1548e 100644 --- a/plugins/TabSRMM/src/msgs.cpp +++ b/plugins/TabSRMM/src/msgs.cpp @@ -107,7 +107,10 @@ void CTabBaseDlg::OnInitDialog() m_pContainer->UpdateTabs(); // add this window to window list & proxy - CProxyWindow::add(this); + if (PluginConfig.m_bIsWin7 && PluginConfig.m_useAeroPeek) + m_pWnd = new CProxyWindow(this); + else + m_pWnd = nullptr; // set up Windows themes DM_ThemeChanged(); diff --git a/plugins/TabSRMM/src/msgs.h b/plugins/TabSRMM/src/msgs.h index b1e261bd79..3baad84fa4 100644 --- a/plugins/TabSRMM/src/msgs.h +++ b/plugins/TabSRMM/src/msgs.h @@ -243,83 +243,54 @@ class CTabBaseDlg : public CSrmmBaseDialog protected: virtual void LoadSettings() override; - void DM_AddDivider(); - void DM_DismissTip(const POINT& pt); - void DM_ErrorDetected(int type, int flag); - bool DM_GenericHotkeysCheck(MSG *message); - int DM_SplitterGlobalEvent(WPARAM wParam, LPARAM lParam); - void DM_UpdateLastMessage() const; - - void DetermineMinHeight(); - void FindFirstEvent(); - void GetSendFormat(); - bool IsAutoSplitEnabled() const; - void ResizeIeView(); - void ShowPopupMenu(const CCtrlBase&, POINT pt); + void DM_AddDivider(); + void DM_DismissTip(const POINT& pt); + void DM_ErrorDetected(int type, int flag); + bool DM_GenericHotkeysCheck(MSG *message); + int DM_SplitterGlobalEvent(WPARAM wParam, LPARAM lParam); + void DM_UpdateLastMessage() const; + + void DetermineMinHeight(); + void FindFirstEvent(); + int FindRTLLocale(); + void GetSendFormat(); + bool IsAutoSplitEnabled() const; + void ReplaceIcons(LONG startAt, int fAppend, BOOL isSent); + void ResizeIeView(); + void ShowPopupMenu(const CCtrlBase&, POINT pt); + void VerifyProxy(); LRESULT WMCopyHandler(UINT uMsg, WPARAM wParam, LPARAM lParam); -public: - DWORD m_dwFlags; - DWORD m_dwFlagsEx; - char *m_szProto; - wchar_t m_wszMyNickname[130]; - wchar_t m_wszStatusBar[100]; - wchar_t m_wszTitle[130]; // tab title... - wchar_t m_wszStatus[50]; WORD m_wStatus; - char *m_sendBuffer; size_t m_iSendBufferSize; int m_iSendLength; // message length in utf-8 octets - HICON m_hTabIcon, m_hTabStatusIcon, m_hXStatusIcon, m_hClientIcon, m_hTaskbarIcon; - HICON m_iFlashIcon, m_hSmileyIcon; - HWND m_hwndIEView, m_hwndIWebBrowserControl, m_hwndHPP; + HICON m_hSmileyIcon; HWND m_hwndContactPic, m_hwndPanelPic, m_hwndPanelPicParent; UINT m_bbLSideWidth, m_bbRSideWidth; BYTE kstate[256]; - StatusTextData *m_sbCustom; - TContainerData *m_pContainer; // parent container description structure - RECT m_rcNick, m_rcUIN, m_rcStatus, m_rcPic; - MEVENT m_hDbEventFirst, m_hDbEventLast; - int m_sendMode; int m_originalSplitterY; - int m_iSplitterY, m_dynaSplitter; - int m_savedSplitterY, m_savedDynaSplit; SIZE m_minEditBoxSize; - int m_nTypeSecs; int m_nTypeMode; DWORD m_nLastTyping; DWORD m_lastMessage; - int m_iTabID; - HKL m_hkl; // keyboard layout identifier - DWORD m_dwTickLastEvent, m_dwUnread; + DWORD m_dwTickLastEvent; HBITMAP m_hOwnPic; SIZE m_pic; - BYTE m_bShowTyping; - bool m_bShowAvatar, m_bShowInfoAvatar, m_bShowUIElements; + bool m_bShowInfoAvatar, m_bShowUIElements; bool m_bUseOffset; - bool m_bIsHistory, m_bNotOnList; bool m_bkeyProcessed; - bool m_bEditNotesActive; - bool m_bActualHistory; bool m_bIsReattach; - bool m_bIsAutosizingInput; bool m_fLimitedUpdate; bool m_bClrAdded; bool m_bInsertMode; - bool m_bCanFlashTab, m_bTabFlash; - int m_iLastEventType; - time_t m_lastEventTime; int m_iRealAvatarHeight; int m_iButtonBarReallyNeeds; DWORD m_dwLastActivity; - int m_iOpenJobs; - int m_iCurrentQueueError; MEVENT m_hFlashingEvent; - wchar_t m_myUin[80]; int m_SendFormat; MEVENT *m_hQueuedEvents; int m_iNextQueuedEvent; @@ -328,35 +299,67 @@ public: LCID m_lcid; wchar_t m_lcID[10]; int m_iPanelAvatarX, m_iPanelAvatarY; - DWORD m_idle; HWND m_hwndTip; TOOLINFO ti; - HANDLE m_hTimeZone; DWORD m_panelStatusCX; - MEVENT *m_hHistoryEvents; - int m_maxHistory, m_curHistory; - HANDLE m_hTheme, m_hThemeIP, m_hThemeToolbar; - char m_szMicroLf[128]; - DWORD m_isAutoRTL; - int m_nMax; // max message size int m_textLen; // current text len LONG m_ipFieldHeight; WPARAM m_wParam; // used for "delayed" actions like moved splitters in minimized windows LPARAM m_lParam; int m_iHaveRTLLang; + DWORD m_iSplitterSaved; + POINT m_ptTipActivation; + char *m_enteredText; // Used for history in chats. + +public: + char *m_szProto; + int m_iTabID; + BYTE m_bShowTyping; + bool m_bIsHistory, m_bNotOnList; + bool m_bActualHistory; + bool m_bIsAutosizingInput; + bool m_bCanFlashTab, m_bTabFlash; + bool m_bEditNotesActive; + bool m_bShowAvatar; + int m_sendMode; + HKL m_hkl; // keyboard layout identifier + DWORD m_isAutoRTL; + DWORD m_idle; + DWORD m_dwFlags, m_dwFlagsEx; + DWORD m_dwUnread; + HANDLE m_hTheme, m_hThemeIP, m_hThemeToolbar; + HWND m_hwndIEView, m_hwndIWebBrowserControl, m_hwndHPP; + HICON m_hXStatusIcon, m_hTabStatusIcon, m_hTabIcon, m_iFlashIcon, m_hTaskbarIcon, m_hClientIcon; + MEVENT m_hDbEventFirst, m_hDbEventLast; + HANDLE m_hTimeZone; + MEVENT *m_hHistoryEvents; + time_t m_lastEventTime; + int m_iLastEventType; + int m_nTypeSecs; + int m_iOpenJobs; + int m_iInputAreaHeight; + int m_maxHistory, m_curHistory; + int m_iCurrentQueueError; + int m_iSplitterY, m_dynaSplitter; + int m_savedSplitterY, m_savedDynaSplit; + char *m_sendBuffer; + int m_nMax; // max message size + + wchar_t m_wszMyNickname[130]; + wchar_t m_wszStatus[50]; + wchar_t m_wszTitle[130]; // tab title... + wchar_t m_myUin[80]; + wchar_t m_wszStatusBar[100]; + char m_szMicroLf[128]; + CInfoPanel m_pPanel; CContactCache *m_cache; + TContainerData *m_pContainer; // parent container description structure + StatusTextData *m_sbCustom; AVATARCACHEENTRY *m_ace, *m_ownAce; CProxyWindow *m_pWnd; // proxy window object (win7+, for taskbar support). - // ALWAYS check this pointer before using it, it is not guaranteed to exist. - - DWORD m_iSplitterSaved; - LONG m_iInputAreaHeight; - POINT m_ptTipActivation; - - // Used for history in chats. - char *m_enteredText; + // ALWAYS check this pointer before using it, it is not guaranteed to exist. public: CTabBaseDlg(int iDialogId, SESSION_INFO* = nullptr); @@ -412,6 +415,8 @@ public: void EnableSending(bool bMode) const; void FlashOnClist(MEVENT hEvent, DBEVENTINFO *dbei); void FlashTab(bool bInvertMode); + const wchar_t* FormatRaw(const wchar_t *msg, int flags, BOOL isSent); + bool FormatTitleBar(const wchar_t *szFormat, CMStringW &dest); bool GetAvatarVisibility(); void GetClientIcon(); LONG GetDefaultMinimumInputHeight() const; @@ -421,9 +426,11 @@ public: void GetMyNick(); HICON GetXStatusIcon() const; void HandlePasteAndSend(); + HICON IconFromAvatar() const; void KbdState(bool &isShift, bool &isControl, bool &isAlt); int LoadLocalFlags(); void LoadSplitter(); + int MustPlaySound() const; void NotifyDeliveryFailure() const; void PlayIncomingSound() const; void SendHBitmapAsFile(HBITMAP hbmp) const; diff --git a/plugins/TabSRMM/src/taskbar.cpp b/plugins/TabSRMM/src/taskbar.cpp index 2494a08429..6f802725a8 100644 --- a/plugins/TabSRMM/src/taskbar.cpp +++ b/plugins/TabSRMM/src/taskbar.cpp @@ -171,22 +171,6 @@ void CTaskbarInteract::SetTabActive(const HWND hwndTab, const HWND hwndGroup) co m_pTaskbarInterface->SetTabActive(hwndTab, hwndGroup, 0); } -/** - * create a proxy window object for the given session. Do NOT call this more than once - * per session and not outside of WM_INITDIALOG after most things are initialized. - * @param dat session window data - * - * static member function. Ignored when OS is not Windows 7 or global option for - * Windows 7 task bar support is diabled. - */ -void CProxyWindow::add(CTabBaseDlg *dat) -{ - if (PluginConfig.m_bIsWin7 && PluginConfig.m_useAeroPeek) // && (!CSkin::m_skinEnabled || M.GetByte("forceAeroPeek", 0))) - dat->m_pWnd = new CProxyWindow(dat); - else - dat->m_pWnd = 0; -} - /** * This is called from the broadcasted WM_DWMCOMPOSITIONCHANGED event by all messages * sessions. It checks and, if needed, destroys or creates a proxy object, based on @@ -195,26 +179,25 @@ void CProxyWindow::add(CTabBaseDlg *dat) * * static member function */ -void CProxyWindow::verify(CTabBaseDlg *dat) +void CTabBaseDlg::VerifyProxy() { if (PluginConfig.m_bIsWin7 && PluginConfig.m_useAeroPeek) { - if (0 == dat->m_pWnd) { - dat->m_pWnd = new CProxyWindow(dat); - if (dat->m_pWnd) { - dat->m_pWnd->updateIcon(dat->m_hTabStatusIcon); - dat->m_pWnd->updateTitle(dat->m_cache->getNick()); + if (nullptr == m_pWnd) { + m_pWnd = new CProxyWindow(this); + if (m_pWnd) { + m_pWnd->updateIcon(m_hTabStatusIcon); + m_pWnd->updateTitle(m_cache->getNick()); } } - else - dat->m_pWnd->verifyDwmState(); + else m_pWnd->verifyDwmState(); } /* * this should not happens, but who knows... */ else { - if (dat->m_pWnd) { - delete dat->m_pWnd; - dat->m_pWnd = 0; + if (m_pWnd) { + delete m_pWnd; + m_pWnd = nullptr; } } } diff --git a/plugins/TabSRMM/src/taskbar.h b/plugins/TabSRMM/src/taskbar.h index 11c6fec623..1545a5b1e8 100644 --- a/plugins/TabSRMM/src/taskbar.h +++ b/plugins/TabSRMM/src/taskbar.h @@ -118,8 +118,6 @@ public: __inline const HICON getOverlayIcon() const { return m_hOverlayIcon; } static LRESULT CALLBACK stubWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam); - static void add(CTabBaseDlg *dat); - static void verify(CTabBaseDlg *dat); private: CTabBaseDlg *m_dat; diff --git a/plugins/TabSRMM/src/userprefs.cpp b/plugins/TabSRMM/src/userprefs.cpp index a2e5f3c501..752d5d7c2d 100644 --- a/plugins/TabSRMM/src/userprefs.cpp +++ b/plugins/TabSRMM/src/userprefs.cpp @@ -482,7 +482,7 @@ INT_PTR CALLBACK DlgProcUserPrefsFrame(HWND hwndDlg, UINT msg, WPARAM wParam, LP dat->SetDialogToType(); dat->LoadLocalFlags(); if ((dat->m_dwFlags & MWF_LOG_ALL) != dwOldFlags) { - bool fShouldHide = true; + bool fShouldHide = true; if (IsIconic(dat->m_pContainer->m_hwnd)) fShouldHide = false; else diff --git a/plugins/TabSRMM/src/utils.cpp b/plugins/TabSRMM/src/utils.cpp index fe5302d2fd..08751c0013 100644 --- a/plugins/TabSRMM/src/utils.cpp +++ b/plugins/TabSRMM/src/utils.cpp @@ -67,17 +67,16 @@ static wchar_t *formatting_strings_end[] = { L"b0 ", L"i0 ", L"u0 ", L"s0 ", // flags: loword = words only for simple * /_ formatting // hiword = bbcode support (strip bbcodes if 0) -const wchar_t* Utils::FormatRaw(CTabBaseDlg *dat, const wchar_t *msg, int flags, BOOL isSent) +const wchar_t* CTabBaseDlg::FormatRaw(const wchar_t *msg, int flags, BOOL isSent) { bool clr_was_added = false, was_added; static tstring message(msg); size_t beginmark = 0, endmark = 0, tempmark = 0, index; int i, endindex; wchar_t endmarker; - DWORD dwFlags = dat->m_dwFlags; message.assign(msg); - if (dwFlags & MWF_LOG_BBCODE) { + if (m_dwFlags & MWF_LOG_BBCODE) { beginmark = 0; while (true) { for (i = 0; i < NR_CODES; i++) { @@ -102,9 +101,9 @@ const wchar_t* Utils::FormatRaw(CTabBaseDlg *dat, const wchar_t *msg, int flags, tstring colorname = message.substr(beginmark + 7, 8); search_again: bool clr_found = false; - for (int ii = 0; ii < rtf_ctable_size; ii++) { - if (!wcsnicmp((wchar_t*)colorname.c_str(), rtf_ctable[ii].szName, mir_wstrlen(rtf_ctable[ii].szName))) { - closing = beginmark + 7 + mir_wstrlen(rtf_ctable[ii].szName); + for (int ii = 0; ii < Utils::rtf_ctable_size; ii++) { + if (!wcsnicmp((wchar_t*)colorname.c_str(), Utils::rtf_ctable[ii].szName, mir_wstrlen(Utils::rtf_ctable[ii].szName))) { + closing = beginmark + 7 + mir_wstrlen(Utils::rtf_ctable[ii].szName); if (endmark != message.npos) { message.erase(endmark, 4); message.replace(endmark, 4, L"c0 "); @@ -132,7 +131,7 @@ search_again: c_closing = colorname.length(); const wchar_t *wszColname = colorname.c_str(); if (endmark != message.npos && c_closing > 2 && c_closing <= 6 && iswalnum(colorname[0]) && iswalnum(colorname[c_closing - 1])) { - RTF_ColorAdd(wszColname, c_closing); + Utils::RTF_ColorAdd(wszColname, c_closing); if (!was_added) { clr_was_added = was_added = true; goto search_again; @@ -158,9 +157,9 @@ invalid_code: } } - if (!(dwFlags & MWF_LOG_TEXTFORMAT) || message.find(L"://") != message.npos) { - dat->m_bClrAdded = clr_was_added; - return(message.c_str()); + if (!(m_dwFlags & MWF_LOG_TEXTFORMAT) || message.find(L"://") != message.npos) { + m_bClrAdded = clr_was_added; + return message.c_str(); } while ((beginmark = message.find_first_of(L"*/_", beginmark)) != message.npos) { @@ -210,10 +209,10 @@ ok: SMADD_BATCHPARSE2 smbp = { 0 }; smbp.cbSize = sizeof(smbp); - smbp.Protocolname = dat->m_cache->getActiveProto(); + smbp.Protocolname = m_cache->getActiveProto(); smbp.flag = SAFL_TCHAR | SAFL_PATH | (isSent ? SAFL_OUTGOING : 0); smbp.str = (wchar_t*)smcode.c_str(); - smbp.hContact = dat->m_hContact; + smbp.hContact = m_hContact; SMADD_BATCHPARSERES *smbpr = (SMADD_BATCHPARSERES *)CallService(MS_SMILEYADD_BATCHPARSE, 0, (LPARAM)&smbp); if (smbpr) { CallService(MS_SMILEYADD_BATCHFREE, 0, (LPARAM)smbpr); @@ -226,8 +225,8 @@ ok: message.insert(beginmark, L"%%%"); message.replace(beginmark, 4, formatting_strings_begin[index]); } - dat->m_bClrAdded = clr_was_added; - return(message.c_str()); + m_bClrAdded = clr_was_added; + return message.c_str(); } ///////////////////////////////////////////////////////////////////////////////////////// @@ -241,11 +240,8 @@ static wchar_t* Trunc500(wchar_t *str) return str; } -bool Utils::FormatTitleBar(const CTabBaseDlg *dat, const wchar_t *szFormat, CMStringW &dest) +bool CTabBaseDlg::FormatTitleBar(const wchar_t *szFormat, CMStringW &dest) { - if (dat == 0) - return false; - for (const wchar_t *src = szFormat; *src; src++) { if (*src != '%') { dest.AppendChar(*src); @@ -254,29 +250,29 @@ bool Utils::FormatTitleBar(const CTabBaseDlg *dat, const wchar_t *szFormat, CMSt switch (*++src) { case 'n': - dest.Append(dat->m_cache->getNick()); + dest.Append(m_cache->getNick()); break; case 'p': case 'a': - dest.Append(dat->m_cache->getRealAccount()); + dest.Append(m_cache->getRealAccount()); break; case 's': - dest.Append(dat->m_wszStatus); + dest.Append(m_wszStatus); break; case 'u': - dest.Append(dat->m_cache->getUIN()); + dest.Append(m_cache->getUIN()); break; case 'c': - dest.Append(!mir_wstrcmp(dat->m_pContainer->m_wszName, L"default") ? TranslateT("Default container") : dat->m_pContainer->m_wszName); + dest.Append(!mir_wstrcmp(m_pContainer->m_wszName, L"default") ? TranslateT("Default container") : m_pContainer->m_wszName); break; case 'o': { - const char *szProto = dat->m_cache->getActiveProto(); + const char *szProto = m_cache->getActiveProto(); if (szProto) dest.Append(_A2T(szProto)); } @@ -284,9 +280,9 @@ bool Utils::FormatTitleBar(const CTabBaseDlg *dat, const wchar_t *szFormat, CMSt case 'x': { - BYTE xStatus = dat->m_cache->getXStatusId(); - if (dat->m_wStatus != ID_STATUS_OFFLINE && xStatus > 0 && xStatus <= 31) { - ptrW szXStatus(db_get_wsa(dat->m_hContact, dat->m_szProto, "XStatusName")); + BYTE xStatus = m_cache->getXStatusId(); + if (m_wStatus != ID_STATUS_OFFLINE && xStatus > 0 && xStatus <= 31) { + ptrW szXStatus(db_get_wsa(m_hContact, m_szProto, "XStatusName")); dest.Append((szXStatus != nullptr) ? Trunc500(szXStatus) : xStatusDescr[xStatus - 1]); } } @@ -294,12 +290,12 @@ bool Utils::FormatTitleBar(const CTabBaseDlg *dat, const wchar_t *szFormat, CMSt case 'm': { - BYTE xStatus = dat->m_cache->getXStatusId(); - if (dat->m_wStatus != ID_STATUS_OFFLINE && xStatus > 0 && xStatus <= 31) { - ptrW szXStatus(db_get_wsa(dat->m_hContact, dat->m_szProto, "XStatusName")); + BYTE xStatus = m_cache->getXStatusId(); + if (m_wStatus != ID_STATUS_OFFLINE && xStatus > 0 && xStatus <= 31) { + ptrW szXStatus(db_get_wsa(m_hContact, m_szProto, "XStatusName")); dest.Append((szXStatus != nullptr) ? Trunc500(szXStatus) : xStatusDescr[xStatus - 1]); } - else dest.Append(dat->m_wszStatus[0] ? dat->m_wszStatus : L"(undef)"); + else dest.Append(m_wszStatus[0] ? m_wszStatus : L"(undef)"); } break; @@ -307,7 +303,7 @@ bool Utils::FormatTitleBar(const CTabBaseDlg *dat, const wchar_t *szFormat, CMSt case 't': case 'T': { - ptrW tszStatus(dat->m_cache->getNormalizedStatusMsg(dat->m_cache->getStatusMsg(), true)); + ptrW tszStatus(m_cache->getNormalizedStatusMsg(m_cache->getStatusMsg(), true)); if (tszStatus) dest.Append(tszStatus); else if (*src == 't') @@ -317,7 +313,7 @@ bool Utils::FormatTitleBar(const CTabBaseDlg *dat, const wchar_t *szFormat, CMSt case 'g': { - ptrW tszGroup(db_get_wsa(dat->m_hContact, "CList", "Group")); + ptrW tszGroup(db_get_wsa(m_hContact, "CList", "Group")); if (tszGroup != nullptr) dest.Append(tszGroup); } @@ -411,14 +407,14 @@ wchar_t* Utils::GetPreviewWithEllipsis(wchar_t *szText, size_t iMaxLen) // returns != 0 when one of the installed keyboard layouts belongs to an rtl language // used to find out whether we need to configure the message input box for bidirectional mode -int Utils::FindRTLLocale(CTabBaseDlg *dat) +int CTabBaseDlg::FindRTLLocale() { HKL layouts[20]; int i, result = 0; LCID lcid; WORD wCtype2[5]; - if (dat->m_iHaveRTLLang == 0) { + if (m_iHaveRTLLang == 0) { memset(layouts, 0, sizeof(layouts)); GetKeyboardLayoutList(20, layouts); for (i = 0; i < 20 && layouts[i]; i++) { @@ -427,9 +423,9 @@ int Utils::FindRTLLocale(CTabBaseDlg *dat) if (wCtype2[0] == C2_RIGHTTOLEFT || wCtype2[1] == C2_RIGHTTOLEFT || wCtype2[2] == C2_RIGHTTOLEFT) result = 1; } - dat->m_iHaveRTLLang = (result ? 1 : -1); + m_iHaveRTLLang = (result ? 1 : -1); } - else result = dat->m_iHaveRTLLang == 1 ? 1 : 0; + else result = m_iHaveRTLLang == 1 ? 1 : 0; return result; } @@ -674,32 +670,32 @@ void Utils::scaleAvatarHeightLimited(const HBITMAP hBm, double& dNewWidth, doubl // @param dat: _MessageWindowData* pointer to the window data // @return HICON: the icon handle -HICON Utils::iconFromAvatar(const CTabBaseDlg *dat) +HICON CTabBaseDlg::IconFromAvatar() const { - if (!ServiceExists(MS_AV_GETAVATARBITMAP) || dat == nullptr) + if (!ServiceExists(MS_AV_GETAVATARBITMAP)) return 0; - AVATARCACHEENTRY *ace = (AVATARCACHEENTRY *)CallService(MS_AV_GETAVATARBITMAP, dat->m_hContact, 0); + AVATARCACHEENTRY *ace = (AVATARCACHEENTRY *)CallService(MS_AV_GETAVATARBITMAP, m_hContact, 0); if (ace == nullptr || ace->hbmPic == nullptr) return nullptr; LONG lIconSize = Win7Taskbar->getIconSize(); double dNewWidth, dNewHeight; - scaleAvatarHeightLimited(ace->hbmPic, dNewWidth, dNewHeight, lIconSize); + Utils::scaleAvatarHeightLimited(ace->hbmPic, dNewWidth, dNewHeight, lIconSize); // resize picture to fit it on the task bar, use an image list for converting it to - // 32bpp icon format. dat->hTaskbarIcon will cache it until avatar is changed + // 32bpp icon format. hTaskbarIcon will cache it until avatar is changed bool fFree = false; HBITMAP hbmResized = CSkin::ResizeBitmap(ace->hbmPic, (LONG)dNewWidth, (LONG)dNewHeight, fFree); HIMAGELIST hIml_c = ::ImageList_Create(lIconSize, lIconSize, ILC_COLOR32 | ILC_MASK, 1, 0); RECT rc = { 0, 0, lIconSize, lIconSize }; - HDC hdc = ::GetDC(dat->m_pContainer->m_hwnd); + HDC hdc = ::GetDC(m_pContainer->m_hwnd); HDC dc = ::CreateCompatibleDC(hdc); HDC dcResized = ::CreateCompatibleDC(hdc); - ReleaseDC(dat->m_pContainer->m_hwnd, hdc); + ReleaseDC(m_pContainer->m_hwnd, hdc); HBITMAP hbmNew = CSkin::CreateAeroCompatibleBitmap(rc, dc); HBITMAP hbmOld = reinterpret_cast(::SelectObject(dc, hbmNew)); @@ -777,32 +773,29 @@ void Utils::addMenuItem(const HMENU& m, MENUITEMINFO &mii, HICON hIcon, const wc // return != 0 when the sound effect must be played for the given // session. Uses container sound settings -int Utils::mustPlaySound(const CTabBaseDlg *dat) +int CTabBaseDlg::MustPlaySound() const { - if (!dat) - return 0; - - if (dat->m_pContainer->fHidden) // hidden container is treated as closed, so play the sound + if (m_pContainer->fHidden) // hidden container is treated as closed, so play the sound return 1; - if (dat->m_pContainer->dwFlags & CNT_NOSOUND || nen_options.iNoSounds) + if (m_pContainer->dwFlags & CNT_NOSOUND || nen_options.iNoSounds) return 0; - bool fActiveWindow = (dat->m_pContainer->m_hwnd == ::GetForegroundWindow() ? true : false); - bool fActiveTab = (dat->m_pContainer->m_hwndActive == dat->GetHwnd() ? true : false); - bool fIconic = (::IsIconic(dat->m_pContainer->m_hwnd) ? true : false); + bool fActiveWindow = (m_pContainer->m_hwnd == ::GetForegroundWindow() ? true : false); + bool fActiveTab = (m_pContainer->m_hwndActive == GetHwnd() ? true : false); + bool fIconic = (::IsIconic(m_pContainer->m_hwnd) ? true : false); // window minimized, check if sound has to be played if (fIconic) - return(dat->m_pContainer->dwFlagsEx & CNT_EX_SOUNDS_MINIMIZED ? 1 : 0); + return(m_pContainer->dwFlagsEx & CNT_EX_SOUNDS_MINIMIZED ? 1 : 0); // window in foreground if (!fActiveWindow) - return(dat->m_pContainer->dwFlagsEx & CNT_EX_SOUNDS_UNFOCUSED ? 1 : 0); + return(m_pContainer->dwFlagsEx & CNT_EX_SOUNDS_UNFOCUSED ? 1 : 0); if (fActiveTab) - return(dat->m_pContainer->dwFlagsEx & CNT_EX_SOUNDS_FOCUSED ? 1 : 0); - return(dat->m_pContainer->dwFlagsEx & CNT_EX_SOUNDS_INACTIVETABS ? 1 : 0); + return(m_pContainer->dwFlagsEx & CNT_EX_SOUNDS_FOCUSED ? 1 : 0); + return(m_pContainer->dwFlagsEx & CNT_EX_SOUNDS_INACTIVETABS ? 1 : 0); } ///////////////////////////////////////////////////////////////////////////////////////// diff --git a/plugins/TabSRMM/src/utils.h b/plugins/TabSRMM/src/utils.h index f35963f505..f6a3bf49b3 100644 --- a/plugins/TabSRMM/src/utils.h +++ b/plugins/TabSRMM/src/utils.h @@ -46,11 +46,8 @@ struct TRTFColorTable class Utils { public: - static int FindRTLLocale(CTabBaseDlg *dat); static wchar_t* GetPreviewWithEllipsis(wchar_t *szText, size_t iMaxLen); static wchar_t* FilterEventMarkers(wchar_t *wszText); - static LPCTSTR FormatRaw(CTabBaseDlg *dat, const wchar_t *msg, int flags, BOOL isSent); - static bool FormatTitleBar(const CTabBaseDlg *dat, const wchar_t *szFormat, CMStringW &dest); static char* FilterEventMarkers(char *szText); static void DoubleAmpersands(wchar_t *pszText, size_t len); static void RTF_CTableInit(); @@ -67,8 +64,6 @@ public: static void addMenuItem(const HMENU& m, MENUITEMINFO& mii, HICON hIcon, const wchar_t *szText, UINT uID, UINT pos); static void enableDlgControl(const HWND hwnd, UINT id, bool fEnable = true); static void showDlgControl(const HWND hwnd, UINT id, int showCmd); - static int mustPlaySound(const CTabBaseDlg *dat); - static HICON iconFromAvatar(const CTabBaseDlg *dat); static void setAvatarContact(HWND hWnd, MCONTACT hContact); static void getIconSize(HICON hIcon, int& sizeX, int& sizeY); -- cgit v1.2.3