From d49f6e5876dec4e1d827efdc7b8ed24728cbb2e8 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Fri, 13 Sep 2019 21:40:11 +0300 Subject: tabSRMM: minor code reordering --- plugins/TabSRMM/src/functions.h | 2 +- plugins/TabSRMM/src/globals.cpp | 4 ++- plugins/TabSRMM/src/globals.h | 2 +- plugins/TabSRMM/src/msgdialog.cpp | 8 +++--- plugins/TabSRMM/src/msgdlgother.cpp | 47 +++++++++++++++++++++++++++++++++ plugins/TabSRMM/src/msgs.cpp | 52 ++----------------------------------- 6 files changed, 58 insertions(+), 57 deletions(-) (limited to 'plugins') diff --git a/plugins/TabSRMM/src/functions.h b/plugins/TabSRMM/src/functions.h index bac6bf1110..061a885d57 100644 --- a/plugins/TabSRMM/src/functions.h +++ b/plugins/TabSRMM/src/functions.h @@ -73,7 +73,7 @@ void TSAPI HandleMenuEntryFromhContact(MCONTACT iSelection); HWND TSAPI CreateNewTabForContact(TContainerData *pContainer, MCONTACT hContact, bool bActivateTAb, bool bPopupContainer, bool bWantPopup, MEVENT hdbEvent = 0, bool bIsWchar = false, const char *pszInitialText = nullptr); int TSAPI ActivateTabFromHWND(HWND hwndTab, HWND hwnd); void TSAPI FlashContainer(TContainerData *pContainer, int iMode, int iNum); -void TSAPI CreateImageList(BOOL bInitial); +void TSAPI CreateImageList(bool bInitial); TContainerData* TSAPI FindMatchingContainer(const wchar_t *szName); TContainerData* TSAPI CreateContainer(const wchar_t *name, int iTemp, MCONTACT hContactFrom); diff --git a/plugins/TabSRMM/src/globals.cpp b/plugins/TabSRMM/src/globals.cpp index 59fb381a43..d59ddd4166 100644 --- a/plugins/TabSRMM/src/globals.cpp +++ b/plugins/TabSRMM/src/globals.cpp @@ -70,6 +70,8 @@ void CGlobals::reloadSystemStartup() hCurSplitNS = LoadCursor(nullptr, IDC_SIZENS); hCurSplitWE = LoadCursor(nullptr, IDC_SIZEWE); + hCurSplitSW = LoadCursor(nullptr, IDC_SIZENESW); + hCurSplitWSE = LoadCursor(nullptr, IDC_SIZENWSE); HDC hScrnDC = GetDC(nullptr); m_DPIscaleX = GetDeviceCaps(hScrnDC, LOGPIXELSX) / 96.0; @@ -266,7 +268,7 @@ int CGlobals::ModulesLoaded(WPARAM, LPARAM) for (int i = 0; i < NR_BUTTONBARICONS; i++) PluginConfig.g_buttonBarIcons[i] = nullptr; ::LoadIconTheme(); - ::CreateImageList(TRUE); + ::CreateImageList(true); ::CB_InitCustomButtons(); PluginConfig.reloadSystemModulesChanged(); diff --git a/plugins/TabSRMM/src/globals.h b/plugins/TabSRMM/src/globals.h index ae2e6bdd7b..543bed01d0 100644 --- a/plugins/TabSRMM/src/globals.h +++ b/plugins/TabSRMM/src/globals.h @@ -66,7 +66,7 @@ public: HWND g_hwndHotkeyHandler; HICON g_iconIn, g_iconOut, g_iconErr, g_iconContainer, g_iconStatus; HICON g_iconOverlayDisabled, g_iconOverlayEnabled, g_iconClock; - HCURSOR hCurSplitNS, hCurSplitWE; + HCURSOR hCurSplitNS, hCurSplitWE, hCurSplitSW, hCurSplitWSE; HBITMAP g_hbmUnknown; bool g_SmileyAddAvail, g_WantIEView, g_WantHPP; HIMAGELIST g_hImageList; diff --git a/plugins/TabSRMM/src/msgdialog.cpp b/plugins/TabSRMM/src/msgdialog.cpp index c43ab064c8..327492222c 100644 --- a/plugins/TabSRMM/src/msgdialog.cpp +++ b/plugins/TabSRMM/src/msgdialog.cpp @@ -1466,15 +1466,16 @@ int CMsgDialog::Resizer(UTILRESIZECONTROL *urc) case IDC_SPLITTERY: urc->rcItem.right = urc->dlgNewSize.cx; - urc->rcItem.bottom = urc->rcItem.top + DPISCALEY_S(2); if (isChat()) { urc->rcItem.top = urc->dlgNewSize.cy - m_iSplitterY + DPISCALEY_S(23); + urc->rcItem.bottom = urc->rcItem.top + DPISCALEY_S(2); urc->rcItem.left = 0; urc->rcItem.bottom++; urc->rcItem.top++; return RD_ANCHORX_CUSTOM | RD_ANCHORY_CUSTOM; } urc->rcItem.top -= m_iSplitterY - m_originalSplitterY; + urc->rcItem.bottom = urc->rcItem.top + DPISCALEY_S(2); OffsetRect(&urc->rcItem, 0, 1); urc->rcItem.left = 0; @@ -1898,8 +1899,7 @@ int CMsgDialog::OnFilter(MSGFILTER *pFilter) { HCURSOR hCur = GetCursor(); m_pContainer->m_pMenuBar->Cancel(); - if (hCur == LoadCursor(nullptr, IDC_SIZENS) || hCur == LoadCursor(nullptr, IDC_SIZEWE) - || hCur == LoadCursor(nullptr, IDC_SIZENESW) || hCur == LoadCursor(nullptr, IDC_SIZENWSE)) { + if (hCur == PluginConfig.hCurSplitNS || hCur == PluginConfig.hCurSplitWE || hCur == PluginConfig.hCurSplitSW || hCur == PluginConfig.hCurSplitWSE) { SetWindowLongPtr(m_hwnd, DWLP_MSGRESULT, TRUE); return TRUE; } @@ -1945,7 +1945,7 @@ int CMsgDialog::OnFilter(MSGFILTER *pFilter) m_pPanel.trackMouse(pt); HCURSOR hCur = GetCursor(); - if (hCur == LoadCursor(nullptr, IDC_SIZENS) || hCur == LoadCursor(nullptr, IDC_SIZEWE) || hCur == LoadCursor(nullptr, IDC_SIZENESW) || hCur == LoadCursor(nullptr, IDC_SIZENWSE)) + if (hCur == PluginConfig.hCurSplitNS || hCur == PluginConfig.hCurSplitWE || hCur == PluginConfig.hCurSplitSW || hCur == PluginConfig.hCurSplitWSE) SetCursor(LoadCursor(nullptr, IDC_ARROW)); break; } diff --git a/plugins/TabSRMM/src/msgdlgother.cpp b/plugins/TabSRMM/src/msgdlgother.cpp index bd25248102..f1ad440e6d 100644 --- a/plugins/TabSRMM/src/msgdlgother.cpp +++ b/plugins/TabSRMM/src/msgdlgother.cpp @@ -1287,6 +1287,34 @@ int CMsgDialog::MsgWindowMenuHandler(int selection, int menuId) ///////////////////////////////////////////////////////////////////////////////////////// +void CMsgDialog::NotifyDeliveryFailure() const +{ + if (M.GetByte("adv_noErrorPopups", 0)) + return; + + if (!Popup_Enabled()) + return; + + POPUPDATAW ppd; + ppd.lchContact = m_hContact; + wcsncpy_s(ppd.lpwzContactName, m_cache->getNick(), _TRUNCATE); + wcsncpy_s(ppd.lpwzText, TranslateT("A message delivery has failed.\nClick to open the message window."), _TRUNCATE); + + if (!(BOOL)db_get_b(0, MODULE, OPT_COLDEFAULT_ERR, TRUE)) { + ppd.colorText = (COLORREF)db_get_dw(0, MODULE, OPT_COLTEXT_ERR, DEFAULT_COLTEXT); + ppd.colorBack = (COLORREF)db_get_dw(0, MODULE, OPT_COLBACK_ERR, DEFAULT_COLBACK); + } + else ppd.colorText = ppd.colorBack = 0; + + ppd.PluginWindowProc = Utils::PopupDlgProcError; + ppd.lchIcon = PluginConfig.g_iconErr; + ppd.PluginData = nullptr; + ppd.iSeconds = (int)db_get_dw(0, MODULE, OPT_DELAY_ERR, (DWORD)DEFAULT_DELAY); + PUAddPopupW(&ppd); +} + +///////////////////////////////////////////////////////////////////////////////////////// + void CMsgDialog::PlayIncomingSound() const { int iPlay = MustPlaySound(); @@ -1593,6 +1621,25 @@ void CMsgDialog::SetMessageLog() } } +///////////////////////////////////////////////////////////////////////////////////////// +// Sets a status bar text for a contact + +void CMsgDialog::SetStatusText(const wchar_t *wszText, HICON hIcon) +{ + if (wszText != nullptr) { + m_bStatusSet = true; + m_szStatusText = wszText; + m_szStatusIcon = hIcon; + } + else { + m_bStatusSet = false; + m_szStatusText.Empty(); + m_szStatusIcon = nullptr; + } + + tabUpdateStatusBar(); +} + ///////////////////////////////////////////////////////////////////////////////////////// void CMsgDialog::ShowPicture(bool showNewPic) diff --git a/plugins/TabSRMM/src/msgs.cpp b/plugins/TabSRMM/src/msgs.cpp index 401b4d2563..8fb015f8ad 100644 --- a/plugins/TabSRMM/src/msgs.cpp +++ b/plugins/TabSRMM/src/msgs.cpp @@ -59,54 +59,6 @@ int SmileyAddOptionsChanged(WPARAM, LPARAM) return 0; } -///////////////////////////////////////////////////////////////////////////////////////// -// basic window class - -void CMsgDialog::NotifyDeliveryFailure() const -{ - if (M.GetByte("adv_noErrorPopups", 0)) - return; - - if (!Popup_Enabled()) - return; - - POPUPDATAW ppd; - ppd.lchContact = m_hContact; - wcsncpy_s(ppd.lpwzContactName, m_cache->getNick(), _TRUNCATE); - wcsncpy_s(ppd.lpwzText, TranslateT("A message delivery has failed.\nClick to open the message window."), _TRUNCATE); - - if (!(BOOL)db_get_b(0, MODULE, OPT_COLDEFAULT_ERR, TRUE)) { - ppd.colorText = (COLORREF)db_get_dw(0, MODULE, OPT_COLTEXT_ERR, DEFAULT_COLTEXT); - ppd.colorBack = (COLORREF)db_get_dw(0, MODULE, OPT_COLBACK_ERR, DEFAULT_COLBACK); - } - else ppd.colorText = ppd.colorBack = 0; - - ppd.PluginWindowProc = Utils::PopupDlgProcError; - ppd.lchIcon = PluginConfig.g_iconErr; - ppd.PluginData = nullptr; - ppd.iSeconds = (int)db_get_dw(0, MODULE, OPT_DELAY_ERR, (DWORD)DEFAULT_DELAY); - PUAddPopupW(&ppd); -} - -///////////////////////////////////////////////////////////////////////////////////////// -// Sets a status bar text for a contact - -void CMsgDialog::SetStatusText(const wchar_t *wszText, HICON hIcon) -{ - if (wszText != nullptr) { - m_bStatusSet = true; - m_szStatusText = wszText; - m_szStatusIcon = hIcon; - } - else { - m_bStatusSet = false; - m_szStatusText.Empty(); - m_szStatusIcon = nullptr; - } - - tabUpdateStatusBar(); -} - ///////////////////////////////////////////////////////////////////////////////////////// // service function - open the tray menu from the TTB button @@ -527,7 +479,7 @@ TContainerData* TSAPI FindMatchingContainer(const wchar_t *szName) ///////////////////////////////////////////////////////////////////////////////////////// // load some global icons. -void TSAPI CreateImageList(BOOL bInitial) +void TSAPI CreateImageList(bool bInitial) { // the imagelist is now a fake. It is still needed to provide the tab control with a // image list handle. This will make sure that the tab control will reserve space for @@ -745,7 +697,7 @@ int IcoLibIconsChanged(WPARAM, LPARAM) int IconsChanged(WPARAM, LPARAM) { - CreateImageList(FALSE); + CreateImageList(false); CacheMsgLogIcons(); Srmm_Broadcast(DM_OPTIONSAPPLIED, 0, 0); Srmm_Broadcast(DM_UPDATEWINICON, 0, 0); -- cgit v1.2.3