From 2159126d8e457e9009eb49f690aeefd6860a28fa Mon Sep 17 00:00:00 2001 From: Don Ho Date: Mon, 27 Sep 2021 20:51:39 +0200 Subject: [PATCH] Initialize the values of Gripper's varible member --- .../src/WinControls/DockingWnd/Gripper.cpp | 30 ------------- .../src/WinControls/DockingWnd/Gripper.h | 44 +++++++++---------- 2 files changed, 22 insertions(+), 52 deletions(-) diff --git a/PowerEditor/src/WinControls/DockingWnd/Gripper.cpp b/PowerEditor/src/WinControls/DockingWnd/Gripper.cpp index f4aeff5d4..47518efc9 100644 --- a/PowerEditor/src/WinControls/DockingWnd/Gripper.cpp +++ b/PowerEditor/src/WinControls/DockingWnd/Gripper.cpp @@ -74,36 +74,6 @@ static LRESULT CALLBACK hookProcKeyboard(int nCode, WPARAM wParam, LPARAM lParam return ::CallNextHookEx(hookKeyboard, nCode, wParam, lParam); } -Gripper::Gripper() -{ - _hInst = NULL; - _hParent = NULL; - _hSelf = NULL; - _pDockMgr = NULL; - _pCont = NULL; - - _ptOffset.x = 0; - _ptOffset.y = 0; - - _ptOld.x = 0; - _ptOld.y = 0; - _bPtOldValid = FALSE; - - _hTab = NULL; - _hTabSource = NULL; - _startMovingFromTab = FALSE; - _iItem = 0; - - _hdc = NULL; - _hbm = NULL; - _hbrush = NULL; - - memset(&_rcPrev, 0, sizeof(RECT)); - memset(&_rcItem, 0, sizeof(RECT)); - memset(&_tcItem, 0, sizeof(TCITEM)); - memset(&_dockData, 0, sizeof(tDockMgr)); -} - void Gripper::startGrip(DockingCont* pCont, DockingManager* pDockMgr) { diff --git a/PowerEditor/src/WinControls/DockingWnd/Gripper.h b/PowerEditor/src/WinControls/DockingWnd/Gripper.h index 8ca7aee1d..84a964b2c 100644 --- a/PowerEditor/src/WinControls/DockingWnd/Gripper.h +++ b/PowerEditor/src/WinControls/DockingWnd/Gripper.h @@ -40,16 +40,16 @@ static const WORD DotPattern[] = #define MDLG_CLASS_NAME TEXT("moveDlg") -class Gripper +class Gripper final { public: - Gripper(); + Gripper() = default;; void init(HINSTANCE hInst, HWND hParent) { _hInst = hInst; _hParent = hParent; DWORD hwndExStyle = (DWORD)GetWindowLongPtr(_hParent, GWL_EXSTYLE); - isRTL = hwndExStyle & WS_EX_LAYOUTRTL; + _isRTL = hwndExStyle & WS_EX_LAYOUTRTL; }; void startGrip(DockingCont* pCont, DockingManager* pDockMgr); @@ -99,7 +99,7 @@ protected : ShrinkRcToSize(rc); }; void ShrinkRcToSize(RECT *rc) { - isRTL ? rc->right = rc->left - rc->right : rc->right -= rc->left; + _isRTL ? rc->right = rc->left - rc->right : rc->right -= rc->left; rc->bottom -= rc->top; }; void DoCalcGripperRect(RECT* rc, RECT rcCorr, POINT pt) { @@ -111,41 +111,41 @@ protected : private: // Handle - HINSTANCE _hInst; - HWND _hParent; - HWND _hSelf; + HINSTANCE _hInst = nullptr; + HWND _hParent = nullptr; + HWND _hSelf = nullptr; // data of container tDockMgr _dockData; - DockingManager *_pDockMgr; - DockingCont *_pCont; + DockingManager *_pDockMgr = nullptr; + DockingCont *_pCont = nullptr; // mouse offset in moving rectangle - POINT _ptOffset; + POINT _ptOffset = { 0 }; // remembers old mouse point - POINT _ptOld; - BOOL _bPtOldValid; + POINT _ptOld = { 0 }; + BOOL _bPtOldValid = FALSE; // remember last drawn rectangle (jg) - RECT _rcPrev; + RECT _rcPrev = { 0 }; // for sorting tabs - HWND _hTab; - HWND _hTabSource; - BOOL _startMovingFromTab; - int _iItem; - RECT _rcItem; + HWND _hTab = nullptr; + HWND _hTabSource = nullptr; + BOOL _startMovingFromTab = FALSE; + int _iItem = 0; + RECT _rcItem = { 0 }; TCITEM _tcItem; - HDC _hdc; - HBITMAP _hbm; - HBRUSH _hbrush; + HDC _hdc = nullptr; + HBITMAP _hbm = nullptr; + HBRUSH _hbrush = nullptr; // is class registered static BOOL _isRegistered; // get layout direction - bool isRTL; + bool _isRTL = false; };