OSDN Git Service

refactor
authorTakashi Sawanaka <sdottaka@users.sourceforge.net>
Sun, 4 Dec 2022 13:57:58 +0000 (22:57 +0900)
committerTakashi Sawanaka <sdottaka@users.sourceforge.net>
Sun, 4 Dec 2022 13:57:58 +0000 (22:57 +0900)
Externals/crystaledit/editlib/ccrystaltextview.cpp
Src/Common/SplitterWndEx.cpp
Src/MainFrm.cpp
Src/MergeEditView.cpp
Src/MergeFrameCommon.cpp
Src/OpenFrm.cpp
Src/OpenView.cpp
Src/OptionsFont.cpp
Src/WildcardDropList.cpp
Src/dllpstub.cpp

index 263a150..66e5524 100644 (file)
@@ -394,8 +394,7 @@ LoadSettings ()
   if (!bFontLoaded)
     {
       CWindowDC dc (CWnd::GetDesktopWindow ());
-      NONCLIENTMETRICS info;
-      info.cbSize = sizeof(info);
+      NONCLIENTMETRICS info{ sizeof(info) };
       SystemParametersInfo(SPI_GETNONCLIENTMETRICS, sizeof(info), &info, 0);
       memcpy (&m_LogFont, &info.lfMessageFont, sizeof (LOGFONT));
       m_LogFont.lfHeight = -MulDiv (11, dc.GetDeviceCaps (LOGPIXELSY), 72);
@@ -4093,8 +4092,7 @@ OnUpdateSibling (CCrystalTextView * pUpdateSource, bool bHorz)
 void CCrystalTextView::
 RecalcVertScrollBar (bool bPositionOnly /*= false*/, bool bRedraw /*= true */)
 {
-  SCROLLINFO si = {0};
-  si.cbSize = sizeof (si);
+  SCROLLINFO si{ sizeof (si) };
   if (bPositionOnly)
     {
       si.fMask = SIF_POS;
@@ -4124,8 +4122,7 @@ OnVScroll (UINT nSBCode, UINT nPos, CScrollBar * pScrollBar)
   CView::OnVScroll (nSBCode, nPos, pScrollBar);
 
   // Note we cannot use nPos because of its 16-bit nature
-  SCROLLINFO si = {0};
-  si.cbSize = sizeof (si);
+  SCROLLINFO si{ sizeof(si) };
   si.fMask = SIF_PAGE | SIF_POS | SIF_RANGE | SIF_TRACKPOS;
   VERIFY (GetScrollInfo (SB_VERT, &si));
 
@@ -4184,8 +4181,7 @@ OnVScroll (UINT nSBCode, UINT nPos, CScrollBar * pScrollBar)
 void CCrystalTextView::
 RecalcHorzScrollBar (bool bPositionOnly /*= false*/, bool bRedraw /*= true */)
 {
-  SCROLLINFO si = {0};
-  si.cbSize = sizeof (si);
+  SCROLLINFO si{ sizeof(si) };
 
   const int nScreenChars = GetScreenChars();
   const TextLayoutMode layoutMode = GetTextLayoutMode ();
@@ -4243,8 +4239,7 @@ OnHScroll (UINT nSBCode, UINT nPos, CScrollBar * pScrollBar)
   //CView::OnHScroll (nSBCode, nPos, pScrollBar);
 
   //  Again, we cannot use nPos because it's 16-bit
-  SCROLLINFO si = {0};
-  si.cbSize = sizeof (si);
+  SCROLLINFO si { sizeof(si) };
   si.fMask = SIF_PAGE | SIF_POS | SIF_RANGE | SIF_TRACKPOS;
   VERIFY (GetScrollInfo (SB_HORZ, &si));
 
@@ -6390,8 +6385,7 @@ void CCrystalTextView::CopyProperties (CCrystalTextView *pSource)
 BOOL CCrystalTextView::
 OnMouseWheel (UINT nFlags, short zDelta, CPoint pt)
 {
-  SCROLLINFO si = {0};
-  si.cbSize = sizeof (si);
+  SCROLLINFO si{ sizeof(si) };
   si.fMask = SIF_PAGE | SIF_RANGE;
   VERIFY (GetScrollInfo (SB_VERT, &si));
 
index 4e41e2c..48edb56 100644 (file)
@@ -294,8 +294,7 @@ void CSplitterWndEx::RecalcLayout()
                bool bSplitPanesInHalf = true;
                if (hLeftMonitor != hRightMonitor)
                {
-                       MONITORINFO info;
-                       info.cbSize = sizeof(MONITORINFO);
+                       MONITORINFO info{ sizeof(MONITORINFO) };
                        GetMonitorInfo(hLeftMonitor, &info);
 
                        int iDesiredWidthOfLeftPane = info.rcMonitor.right - vSplitterWndRect.left;
index 492c909..9081583 100644 (file)
@@ -1576,8 +1576,7 @@ void CMainFrame::ActivateFrame(int nCmdShow)
 
        m_bFirstTime = false;
 
-       WINDOWPLACEMENT wp = {};
-       wp.length = sizeof(WINDOWPLACEMENT);
+       WINDOWPLACEMENT wp = { sizeof(WINDOWPLACEMENT) };
        GetWindowPlacement(&wp);
        wp.rcNormalPosition.left=theApp.GetProfileInt(_T("Settings"), _T("MainLeft"),0);
        wp.rcNormalPosition.top=theApp.GetProfileInt(_T("Settings"), _T("MainTop"),0);
@@ -1630,8 +1629,7 @@ void CMainFrame::OnClose()
        }
 
        // save main window position
-       WINDOWPLACEMENT wp = {};
-       wp.length = sizeof(WINDOWPLACEMENT);
+       WINDOWPLACEMENT wp = { sizeof(WINDOWPLACEMENT) };
        GetWindowPlacement(&wp);
        theApp.WriteProfileInt(_T("Settings"), _T("MainLeft"),wp.rcNormalPosition.left);
        theApp.WriteProfileInt(_T("Settings"), _T("MainTop"),wp.rcNormalPosition.top);
index f954e8c..af83fc5 100644 (file)
@@ -3405,8 +3405,7 @@ void CMergeEditView::OnVScroll(UINT nSBCode, UINT nPos, CScrollBar *pScrollBar)
                return;
 
        // Note we cannot use nPos because of its 16-bit nature
-       SCROLLINFO si = {0};
-       si.cbSize = sizeof (si);
+       SCROLLINFO si{ sizeof(si) };
        si.fMask = SIF_PAGE | SIF_POS | SIF_RANGE | SIF_TRACKPOS;
        VERIFY (GetScrollInfo (SB_VERT, &si));
 
index 4014a5e..4efb6f3 100644 (file)
@@ -65,8 +65,7 @@ void CMergeFrameCommon::SaveWindowState()
        // If we are not, do nothing and let the active frame do the job.\r
        if (GetParentFrame()->GetActiveFrame() == this)\r
        {\r
-               WINDOWPLACEMENT wp = {};\r
-               wp.length = sizeof(WINDOWPLACEMENT);\r
+               WINDOWPLACEMENT wp = { sizeof(WINDOWPLACEMENT) };\r
                GetWindowPlacement(&wp);\r
                GetOptionsMgr()->SaveOption(OPT_ACTIVE_FRAME_MAX, (wp.showCmd == SW_MAXIMIZE));\r
        }\r
index 014430c..5e73d6f 100644 (file)
@@ -92,8 +92,7 @@ void COpenFrame::ActivateFrame(int nCmdShow)
        __super::ActivateFrame(nCmdShow);
        if (CView *const pView = GetActiveView())
        {
-               WINDOWPLACEMENT wp = {};
-               wp.length = sizeof wp;
+               WINDOWPLACEMENT wp = { sizeof wp };
                GetWindowPlacement(&wp);
                CRect rc;
                pView->GetWindowRect(&rc);
index b2105e8..6c03a51 100644 (file)
@@ -501,8 +501,7 @@ void COpenView::OnWindowPosChanged(WINDOWPOS* lpwndpos)
                if (pFrameWnd == GetTopLevelFrame()->GetActiveFrame())
                {
                        m_constraint.Persist(true, false);
-                       WINDOWPLACEMENT wp = {};
-                       wp.length = sizeof wp;
+                       WINDOWPLACEMENT wp = { sizeof wp };
                        pFrameWnd->GetWindowPlacement(&wp);
                        CRect rc;
                        GetWindowRect(&rc);
index ad2746c..dd95170 100644 (file)
@@ -68,8 +68,7 @@ void Init(COptionsMgr *pOptionsMgr)
        // that cannot be determined (why?), 9-point "Segoe UI" is used (typical since Win7).
        LOGFONT fontDir = {0};
        const int pointsDir = 9;
-       NONCLIENTMETRICS ncm = { 0 };
-       ncm.cbSize = sizeof(NONCLIENTMETRICS);
+       NONCLIENTMETRICS ncm{ sizeof(NONCLIENTMETRICS) };
        if (SystemParametersInfo(SPI_GETNONCLIENTMETRICS, sizeof(NONCLIENTMETRICS), &ncm, 0))
        {
                const int lfHeight = -::MulDiv(pointsDir, logPixelsY, 72);
index eb9d981..f732f8a 100644 (file)
@@ -95,8 +95,7 @@ LRESULT WildcardDropList::LbWndProc(HWND hwnd, UINT message, WPARAM wParam, LPAR
  */\r
 void WildcardDropList::OnDropDown(HWND hCb, int columns, LPCTSTR fixedPatterns, bool allowUserAddedPatterns)\r
 {\r
-       COMBOBOXINFO info;\r
-       info.cbSize = sizeof info;\r
+       COMBOBOXINFO info{ sizeof info };\r
        if (!::GetComboBoxInfo(hCb, &info))\r
                return;\r
        RECT rc, rcCombo;\r
@@ -172,8 +171,7 @@ void WildcardDropList::OnDropDown(HWND hCb, int columns, LPCTSTR fixedPatterns,
  */\r
 bool WildcardDropList::OnCloseUp(HWND hCb)\r
 {\r
-       COMBOBOXINFO info;\r
-       info.cbSize = sizeof info;\r
+       COMBOBOXINFO info{ sizeof info };\r
        if (!::GetComboBoxInfo(hCb, &info))\r
                return false;\r
        ::UnregisterHotKey(info.hwndList, IDCANCEL);\r
index 6be75ee..8cdabeb 100644 (file)
@@ -83,8 +83,7 @@ HMODULE DLLPSTUB::Load()
                                if (dwMajorVersion || dwMinorVersion || dwBuildNumber)
                                {
                                        // Is the DLL up to date?
-                                       DLLVERSIONINFO dvi;
-                                       dvi.cbSize = sizeof dvi;
+                                       DLLVERSIONINFO dvi{ sizeof dvi };
                                        dvi.dwMajorVersion = 0;
                                        dvi.dwMinorVersion = 0;
                                        dvi.dwBuildNumber = 0;