From e3179c1ef509482ff9b4c7d4fb89d0b208e84000 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Mon, 27 May 2019 16:05:30 +0300 Subject: obsolete calls of GetVersion() removed & replaced with IsWinVer*Plus() calls --- plugins/TabSRMM/src/TSButton.cpp | 2 +- plugins/TabSRMM/src/chat_window.cpp | 2 +- plugins/TabSRMM/src/container.cpp | 20 +++++++++----------- plugins/TabSRMM/src/containeroptions.cpp | 10 +++++----- plugins/TabSRMM/src/globals.cpp | 5 ----- plugins/TabSRMM/src/globals.h | 3 --- plugins/TabSRMM/src/mim.cpp | 5 +---- plugins/TabSRMM/src/mim.h | 2 -- plugins/TabSRMM/src/msgdlgutils.cpp | 3 +-- plugins/TabSRMM/src/msgoptions.cpp | 8 ++++---- plugins/TabSRMM/src/msgs.cpp | 4 ++-- plugins/TabSRMM/src/sidebar.cpp | 2 +- plugins/TabSRMM/src/tabctrl.cpp | 4 ++-- plugins/TabSRMM/src/taskbar.cpp | 2 +- plugins/TabSRMM/src/themes.cpp | 4 ++-- 15 files changed, 30 insertions(+), 46 deletions(-) (limited to 'plugins/TabSRMM/src') diff --git a/plugins/TabSRMM/src/TSButton.cpp b/plugins/TabSRMM/src/TSButton.cpp index c131168cc2..dbb373f302 100644 --- a/plugins/TabSRMM/src/TSButton.cpp +++ b/plugins/TabSRMM/src/TSButton.cpp @@ -159,7 +159,7 @@ static void PaintWorker(TSButtonCtrl *ctl, HDC hdcPaint) dat->m_pContainer->m_cachedToolbarDC, pt.x, 1, SRCCOPY); } if (ctl->hThemeToolbar && ctl->bIsThemed && 1 == dat->m_pContainer->m_bTBRenderingMode) { - if (bAero || PluginConfig.m_WinVerMajor >= 6) + if (bAero || IsWinVerVistaPlus()) DrawThemeBackground(ctl->hThemeToolbar, hdcMem, 8, RBStateConvert2Flat(state), &rcClient, &rcClient); else DrawThemeBackground(ctl->hThemeToolbar, hdcMem, TP_BUTTON, TBStateConvert2Flat(state), &rcClient, &rcClient); diff --git a/plugins/TabSRMM/src/chat_window.cpp b/plugins/TabSRMM/src/chat_window.cpp index 9c99f398d8..b0afb70e66 100644 --- a/plugins/TabSRMM/src/chat_window.cpp +++ b/plugins/TabSRMM/src/chat_window.cpp @@ -2493,6 +2493,6 @@ void ShowRoom(TContainerData *pContainer, SESSION_INFO *si) SetForegroundWindow(pContainer->m_hwnd); } - if (PluginConfig.m_bIsWin7 && PluginConfig.m_useAeroPeek && CSkin::m_skinEnabled && !M.GetByte("forceAeroPeek", 0)) + if (IsWinVer7Plus() && PluginConfig.m_useAeroPeek && CSkin::m_skinEnabled && !M.GetByte("forceAeroPeek", 0)) CWarning::show(CWarning::WARN_AEROPEEK_SKIN, MB_ICONWARNING | MB_OK); } diff --git a/plugins/TabSRMM/src/container.cpp b/plugins/TabSRMM/src/container.cpp index 868c5f051f..f4ecb7ac67 100644 --- a/plugins/TabSRMM/src/container.cpp +++ b/plugins/TabSRMM/src/container.cpp @@ -1372,7 +1372,7 @@ panel_found: BroadCastContainer(pContainer, DM_CHECKINFOTIP, wParam, lParam); if (LOWORD(wParam == WA_INACTIVE) && (HWND)lParam != PluginConfig.g_hwndHotkeyHandler && GetParent((HWND)lParam) != hwndDlg) { - BOOL fTransAllowed = !bSkinned || PluginConfig.m_bIsVista; + BOOL fTransAllowed = !bSkinned || IsWinVerVistaPlus(); if (pContainer->m_dwFlags & CNT_TRANSPARENCY && fTransAllowed) { SetLayeredWindowAttributes(hwndDlg, Skin->getColorKey(), (BYTE)HIWORD(pContainer->m_pSettings->dwTransparency), (pContainer->m_dwFlags & CNT_TRANSPARENCY ? LWA_ALPHA : 0)); @@ -1390,7 +1390,7 @@ panel_found: case WM_MOUSEACTIVATE: if (pContainer != nullptr) { - BOOL fTransAllowed = !bSkinned || PluginConfig.m_WinVerMajor >= 6; + BOOL fTransAllowed = !bSkinned || IsWinVerVistaPlus(); FlashContainer(pContainer, 0, 0); pContainer->m_dwFlashingStarted = 0; @@ -1572,17 +1572,15 @@ panel_found: pContainer->m_tBorder_outer_bottom = g_ButtonSet.bottom + M.GetByte((bSkinned ? "S_tborder_outer_bottom" : "tborder_outer_bottom"), 2); sBarHeight = (UINT)M.GetByte((bSkinned ? "S_sbarheight" : "sbarheight"), 0); - if (LOBYTE(LOWORD(GetVersion())) >= 5) { - BOOL fTransAllowed = !bSkinned || PluginConfig.m_WinVerMajor >= 6; + BOOL fTransAllowed = !bSkinned || IsWinVerVistaPlus(); - DWORD exold, ex = exold = GetWindowLongPtr(hwndDlg, GWL_EXSTYLE); - ex = (pContainer->m_dwFlags & CNT_TRANSPARENCY && (!CSkin::m_skinEnabled || fTransAllowed)) ? ex | WS_EX_LAYERED : ex & ~(WS_EX_LAYERED); + DWORD exold, ex = exold = GetWindowLongPtr(hwndDlg, GWL_EXSTYLE); + ex = (pContainer->m_dwFlags & CNT_TRANSPARENCY && (!CSkin::m_skinEnabled || fTransAllowed)) ? ex | WS_EX_LAYERED : ex & ~(WS_EX_LAYERED); - SetWindowLongPtr(hwndDlg, GWL_EXSTYLE, ex); - if (pContainer->m_dwFlags & CNT_TRANSPARENCY && fTransAllowed) { - DWORD trans = LOWORD(pContainer->m_pSettings->dwTransparency); - SetLayeredWindowAttributes(hwndDlg, Skin->getColorKey(), (BYTE)trans, (/* pContainer->m_bSkinned ? LWA_COLORKEY : */ 0) | (pContainer->m_dwFlags & CNT_TRANSPARENCY ? LWA_ALPHA : 0)); - } + SetWindowLongPtr(hwndDlg, GWL_EXSTYLE, ex); + if (pContainer->m_dwFlags & CNT_TRANSPARENCY && fTransAllowed) { + DWORD trans = LOWORD(pContainer->m_pSettings->dwTransparency); + SetLayeredWindowAttributes(hwndDlg, Skin->getColorKey(), (BYTE)trans, (/* pContainer->m_bSkinned ? LWA_COLORKEY : */ 0) | (pContainer->m_dwFlags & CNT_TRANSPARENCY ? LWA_ALPHA : 0)); } if (!CSkin::m_frameSkins) diff --git a/plugins/TabSRMM/src/containeroptions.cpp b/plugins/TabSRMM/src/containeroptions.cpp index 9c8e9fe395..2447b85e31 100644 --- a/plugins/TabSRMM/src/containeroptions.cpp +++ b/plugins/TabSRMM/src/containeroptions.cpp @@ -380,10 +380,10 @@ do_apply: Utils::enableDlgControl(hwndDlg, IDC_APPLY, true); DWORD dwFlagsEx = cs->dwFlagsEx; BOOL fAllowTrans = FALSE; - if (PluginConfig.m_WinVerMajor >= 6) + if (IsWinVerVistaPlus()) fAllowTrans = TRUE; else - fAllowTrans = (!CSkin::m_skinEnabled); + fAllowTrans = !CSkin::m_skinEnabled; MY_CheckDlgButton(hwndDlg, IDC_O_HIDETITLE, dwFlags & CNT_NOTITLE); MY_CheckDlgButton(hwndDlg, IDC_O_DONTREPORT, dwFlags & CNT_DONTREPORT); @@ -427,12 +427,12 @@ do_apply: Utils::enableDlgControl(hwndDlg, IDC_APPLY, true); else SendDlgItemMessage(hwndDlg, IDC_TABMODE, CB_SETCURSEL, dwFlagsEx & TCF_SBARLEFT ? 2 : 3, 0); - if (LOBYTE(LOWORD(GetVersion())) >= 5 && fAllowTrans) - CheckDlgButton(hwndDlg, IDC_TRANSPARENCY, dwFlags & CNT_TRANSPARENCY ? BST_CHECKED : BST_UNCHECKED); + if (fAllowTrans) + CheckDlgButton(hwndDlg, IDC_TRANSPARENCY, (dwFlags & CNT_TRANSPARENCY) ? BST_CHECKED : BST_UNCHECKED); else CheckDlgButton(hwndDlg, IDC_TRANSPARENCY, BST_UNCHECKED); - Utils::enableDlgControl(hwndDlg, IDC_TRANSPARENCY, PluginConfig.m_WinVerMajor >= 5 && fAllowTrans); + Utils::enableDlgControl(hwndDlg, IDC_TRANSPARENCY, fAllowTrans); bool isTrans = IsDlgButtonChecked(hwndDlg, IDC_TRANSPARENCY) != 0; Utils::enableDlgControl(hwndDlg, IDC_TRANSPARENCY_ACTIVE, isTrans); diff --git a/plugins/TabSRMM/src/globals.cpp b/plugins/TabSRMM/src/globals.cpp index e3eb078e24..ba5d2cedba 100644 --- a/plugins/TabSRMM/src/globals.cpp +++ b/plugins/TabSRMM/src/globals.cpp @@ -54,11 +54,6 @@ bool CGlobals::m_exAllowContinue = false; void CGlobals::reloadSystemStartup() { - m_WinVerMajor = WinVerMajor(); - m_WinVerMinor = WinVerMinor(); - m_bIsVista = IsWinVerVistaPlus() != 0; - m_bIsWin7 = IsWinVer7Plus() != 0; - ::RegisterTabCtrlClass(); CTip::registerClass(); diff --git a/plugins/TabSRMM/src/globals.h b/plugins/TabSRMM/src/globals.h index 8863eb1eee..78919e16cd 100644 --- a/plugins/TabSRMM/src/globals.h +++ b/plugins/TabSRMM/src/globals.h @@ -108,9 +108,6 @@ public: double m_DPIscaleX; double m_DPIscaleY; HBITMAP m_hbmMsgArea; - BYTE m_WinVerMajor; - BYTE m_WinVerMinor; - bool m_bIsVista, m_bIsWin7; HWND m_hwndClist; int m_TabAppearance; myTabCtrl tabConfig; diff --git a/plugins/TabSRMM/src/mim.cpp b/plugins/TabSRMM/src/mim.cpp index 2cd7af03cc..1c2e01e408 100644 --- a/plugins/TabSRMM/src/mim.cpp +++ b/plugins/TabSRMM/src/mim.cpp @@ -158,13 +158,10 @@ bool CMimAPI::getAeroState() void CMimAPI::InitAPI() { - DWORD dwVer = LOWORD(GetVersion()); - m_winVer = MAKEWORD(HIBYTE(dwVer), LOBYTE(dwVer)); - m_hUxTheme = nullptr; + m_hDwmApi = nullptr; // vista+ DWM API - m_hDwmApi = nullptr; if (IsWinVerVistaPlus()) { m_hDwmApi = Utils::loadSystemLibrary(L"\\dwmapi.dll"); if (m_hDwmApi) { diff --git a/plugins/TabSRMM/src/mim.h b/plugins/TabSRMM/src/mim.h index 52103652a5..bf599db551 100644 --- a/plugins/TabSRMM/src/mim.h +++ b/plugins/TabSRMM/src/mim.h @@ -161,7 +161,6 @@ public: __forceinline bool isAero() const { return m_isAero; } __forceinline bool isDwmActive() const { return m_DwmActive; } - __forceinline DWORD getWinVer() const { return m_winVer; } // refresh Aero status. bool getAeroState(); @@ -207,7 +206,6 @@ private: double m_dFreq; char m_timerMsg[256]; bool m_hasFolders; - DWORD m_winVer; HANDLE m_hChatLogLock; void InitAPI(); diff --git a/plugins/TabSRMM/src/msgdlgutils.cpp b/plugins/TabSRMM/src/msgdlgutils.cpp index cf5fded890..3a9a7c40de 100644 --- a/plugins/TabSRMM/src/msgdlgutils.cpp +++ b/plugins/TabSRMM/src/msgdlgutils.cpp @@ -1368,8 +1368,7 @@ int CTabBaseDlg::MsgWindowDrawHandler(DRAWITEMSTRUCT *dis) if (CSkin::m_bAvatarBorderType == 1) Rectangle(hdcDraw, rcEdge.left, rcEdge.top, rcEdge.right, rcEdge.bottom); else if (CSkin::m_bAvatarBorderType == 2) { - int iRad = PluginConfig.m_WinVerMajor >= 5 ? 4 : 6; - clipRgn = CreateRoundRectRgn(rcEdge.left, rcEdge.top, rcEdge.right + 1, rcEdge.bottom + 1, iRad, iRad); + clipRgn = CreateRoundRectRgn(rcEdge.left, rcEdge.top, rcEdge.right + 1, rcEdge.bottom + 1, 6, 6); SelectClipRgn(hdcDraw, clipRgn); HBRUSH hbr = CreateSolidBrush(CSkin::m_avatarBorderClr); diff --git a/plugins/TabSRMM/src/msgoptions.cpp b/plugins/TabSRMM/src/msgoptions.cpp index 1da41d268b..643068e4ad 100644 --- a/plugins/TabSRMM/src/msgoptions.cpp +++ b/plugins/TabSRMM/src/msgoptions.cpp @@ -1142,11 +1142,11 @@ public: for (int i = 0; i < CSkin::AERO_EFFECT_LAST; i++) cmbAeroEffect.InsertString(TranslateW(CSkin::m_aeroEffects[i].tszName), -1); cmbAeroEffect.SetCurSel(CSkin::m_aeroEffect); - cmbAeroEffect.Enable(PluginConfig.m_bIsVista); + cmbAeroEffect.Enable(IsWinVerVistaPlus()); - chkUseAero.Enable(PluginConfig.m_bIsVista); - chkUseAeroPeek.Enable(PluginConfig.m_bIsWin7); - if (PluginConfig.m_bIsVista) + chkUseAero.Enable(IsWinVerVistaPlus()); + chkUseAeroPeek.Enable(IsWinVer7Plus()); + if (IsWinVerVistaPlus()) Utils::enableDlgControl(m_hwnd, IDC_AEROEFFECT, chkUseAero.GetState() != 0); return true; } diff --git a/plugins/TabSRMM/src/msgs.cpp b/plugins/TabSRMM/src/msgs.cpp index 757f7ba8ca..c69714c5e9 100644 --- a/plugins/TabSRMM/src/msgs.cpp +++ b/plugins/TabSRMM/src/msgs.cpp @@ -106,7 +106,7 @@ bool CTabBaseDlg::OnInitDialog() m_pContainer->UpdateTabs(); // add this window to window list & proxy - if (PluginConfig.m_bIsWin7 && PluginConfig.m_useAeroPeek) + if (IsWinVer7Plus() && PluginConfig.m_useAeroPeek) m_pWnd = new CProxyWindow(this); else m_pWnd = nullptr; @@ -696,7 +696,7 @@ HWND TSAPI CreateNewTabForContact(TContainerData *pContainer, MCONTACT hContact, SendMessage(pContainer->m_hwndActive, WM_SIZE, 0, 0); } - if (PluginConfig.m_bIsWin7 && PluginConfig.m_useAeroPeek && CSkin::m_skinEnabled) + if (IsWinVer7Plus() && PluginConfig.m_useAeroPeek && CSkin::m_skinEnabled) CWarning::show(CWarning::WARN_AEROPEEK_SKIN, MB_ICONWARNING | MB_OK); if (ServiceExists(MS_HPP_EG_EVENT) && ServiceExists(MS_IEVIEW_EVENT) && db_get_b(0, "HistoryPlusPlus", "IEViewAPI", 0)) diff --git a/plugins/TabSRMM/src/sidebar.cpp b/plugins/TabSRMM/src/sidebar.cpp index a61aa5aaad..ade164bd21 100644 --- a/plugins/TabSRMM/src/sidebar.cpp +++ b/plugins/TabSRMM/src/sidebar.cpp @@ -998,7 +998,7 @@ void __fastcall CSideBar::m_DefaultBackgroundRenderer(const HDC hdc, const RECT if (IsThemeBackgroundPartiallyTransparent(item->m_buttonControl->hThemeToolbar, TP_BUTTON, stateId)) DrawThemeParentBackground(item->getHwnd(), hdc, rcDraw); - if (M.isAero() || PluginConfig.m_WinVerMajor >= 6) { + if (M.isAero() || IsWinVerVistaPlus()) { stateId = (fIsActiveItem ? PBS_PRESSED : PBS_HOT); DrawThemeBackground(item->m_buttonControl->hThemeToolbar, hdc, 8, RBStateConvert2Flat(stateId), rcDraw, rcDraw); } diff --git a/plugins/TabSRMM/src/tabctrl.cpp b/plugins/TabSRMM/src/tabctrl.cpp index 8d52ffa010..8c02a96525 100644 --- a/plugins/TabSRMM/src/tabctrl.cpp +++ b/plugins/TabSRMM/src/tabctrl.cpp @@ -458,7 +458,7 @@ static void DrawThemesXpTabItem(HDC pDC, RECT *rcItem, UINT uiFlag, TabControlDa // for top row tabs, it's easy. Just draw to the provided dc (it's a mem dc already) if (!bBottom) { if (bBody) { - if (PluginConfig.m_bIsVista) { + if (IsWinVerVistaPlus()) { rcItem->right += 2; // hide right tab sheet shadow (only draw the actual border line) rcItem->bottom += 1; } @@ -551,7 +551,7 @@ static void DrawThemesXpTabItem(HDC pDC, RECT *rcItem, UINT uiFlag, TabControlDa CImageItem tempItem(10, 10, 10, 10, hdcTemp, nullptr, IMAGE_FLAG_DIVIDED | IMAGE_FILLSOLID, GetSysColorBrush(COLOR_3DFACE), 255, 30, 80, 50, 100); - if (PluginConfig.m_bIsVista) // hide right tab sheet shadow (only draw the actual border line) + if (IsWinVerVistaPlus()) // hide right tab sheet shadow (only draw the actual border line) rcItem->right += 2; tempItem.Render(pDC, rcItem, true); diff --git a/plugins/TabSRMM/src/taskbar.cpp b/plugins/TabSRMM/src/taskbar.cpp index 88fd5abae5..68606e093f 100644 --- a/plugins/TabSRMM/src/taskbar.cpp +++ b/plugins/TabSRMM/src/taskbar.cpp @@ -181,7 +181,7 @@ void CTaskbarInteract::SetTabActive(const HWND hwndTab, const HWND hwndGroup) co */ void CTabBaseDlg::VerifyProxy() { - if (PluginConfig.m_bIsWin7 && PluginConfig.m_useAeroPeek) { + if (IsWinVer7Plus() && PluginConfig.m_useAeroPeek) { if (nullptr == m_pWnd) { m_pWnd = new CProxyWindow(this); if (m_pWnd) { diff --git a/plugins/TabSRMM/src/themes.cpp b/plugins/TabSRMM/src/themes.cpp index aa934eb986..48584e43e0 100644 --- a/plugins/TabSRMM/src/themes.cpp +++ b/plugins/TabSRMM/src/themes.cpp @@ -2042,7 +2042,7 @@ DWORD CSkin::HexStringToLong(const wchar_t *szSource) int CSkin::RenderText(HDC hdc, HANDLE hTheme, const wchar_t *szText, RECT *rc, DWORD dtFlags, const int iGlowSize, COLORREF clr, bool fForceAero) { - if ((PluginConfig.m_bIsVista && !CSkin::m_skinEnabled && hTheme) || fForceAero) { + if ((IsWinVerVistaPlus() && !CSkin::m_skinEnabled && hTheme) || fForceAero) { DTTOPTS dto = { 0 }; dto.dwSize = sizeof(dto); if (iGlowSize && (M.isAero() || fForceAero)) { @@ -2327,7 +2327,7 @@ void CSkin::initAeroEffect() ::DeleteObject(m_BrushBack); m_BrushBack = nullptr; } - if (PluginConfig.m_bIsVista && m_aeroEffect > AERO_EFFECT_NONE && m_aeroEffect < AERO_EFFECT_LAST) { + if (IsWinVerVistaPlus() && m_aeroEffect > AERO_EFFECT_NONE && m_aeroEffect < AERO_EFFECT_LAST) { m_currentAeroEffect = m_aeroEffects[m_aeroEffect]; m_pCurrentAeroEffect = &m_currentAeroEffect; m_glowSize = m_pCurrentAeroEffect->m_glowSize; -- cgit v1.2.3