OSDN Git Service

crystaledit: Use GetProfile*()/WriteProfile*() to read and write the registry wheneve...
[winmerge-jp/winmerge-jp.git] / Src / EditorFilepathBar.cpp
index 027c401..dcc6c4f 100644 (file)
@@ -2,21 +2,7 @@
 //    WinMerge:  an interactive diff/merge utility
 //    Copyright (C) 1997-2000  Thingamahoochie Software
 //    Author: Dean Grimm
-//
-//    This program is free software; you can redistribute it and/or modify
-//    it under the terms of the GNU General Public License as published by
-//    the Free Software Foundation; either version 2 of the License, or
-//    (at your option) any later version.
-//
-//    This program is distributed in the hope that it will be useful,
-//    but WITHOUT ANY WARRANTY; without even the implied warranty of
-//    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-//    GNU General Public License for more details.
-//
-//    You should have received a copy of the GNU General Public License
-//    along with this program; if not, write to the Free Software
-//    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-//
+//    SPDX-License-Identifier: GPL-2.0-or-later
 /////////////////////////////////////////////////////////////////////////////
 /** 
  * @file  EditorFilepathBar.cpp
@@ -62,7 +48,7 @@ CEditorFilePathBar::~CEditorFilePathBar()
 BOOL CEditorFilePathBar::Create(CWnd* pParentWnd)
 {
        if (! CDialogBar::Create(pParentWnd, CEditorFilePathBar::IDD, 
-                       CBRS_TOP | CBRS_TOOLTIPS | CBRS_FLYBY, CEditorFilePathBar::IDD))
+                       CBRS_ALIGN_TOP | CBRS_TOOLTIPS | CBRS_FLYBY, CEditorFilePathBar::IDD))
                return FALSE;
 
        NONCLIENTMETRICS ncm = { sizeof NONCLIENTMETRICS };
@@ -70,7 +56,7 @@ BOOL CEditorFilePathBar::Create(CWnd* pParentWnd)
                m_font.CreateFontIndirect(&ncm.lfStatusFont);
 
        // subclass the two custom edit boxes
-       for (int pane = 0; pane < countof(m_Edit); pane++)
+       for (int pane = 0; pane < static_cast<int>(std::size(m_Edit)); pane++)
        {
                m_Edit[pane].SubClassEdit(IDC_STATIC_TITLE_PANE0 + pane, this);
                m_Edit[pane].SetFont(&m_font);
@@ -89,11 +75,6 @@ CSize CEditorFilePathBar::CalcFixedLayout(BOOL bStretch, BOOL bHorz)
        return CSize(SHRT_MAX, tm.tmHeight + 6);
 }
 
-void CEditorFilePathBar::SetPaneCount(int nPanes)
-{
-       m_nPanes = nPanes;
-}
-
 /** 
  * @brief Resize both controls to an equal size.
  */
@@ -102,24 +83,16 @@ void CEditorFilePathBar::Resize()
        if (m_hWnd == nullptr)
                return;
 
-       WINDOWPLACEMENT infoBar;
+       WINDOWPLACEMENT infoBar = {};
        GetWindowPlacement(&infoBar);
 
-       int widths[3];
+       int widths[3] = {};
        for (int pane = 0; pane < m_nPanes; pane++)
                widths[pane] = (infoBar.rcNormalPosition.right / m_nPanes);
        Resize(widths);
 }
 
 /** 
- * @brief Set callback function on EN_SETFOCUS notification
- */
-void CEditorFilePathBar::SetOnSetFocusCallback(const std::function<void(int)> callbackfunc)
-{
-       m_callbackfunc = callbackfunc;
-}
-
-/** 
  * @brief Set widths.
  * This function resizes both controls to given size. The width is usually
  * same as the splitter view width.
@@ -185,7 +158,7 @@ BOOL CEditorFilePathBar::OnToolTipNotify(UINT id, NMHDR * pTTTStruct, LRESULT *
                        pTTT->lpszText = const_cast<TCHAR *>(pItem->GetUpdatedTipText(&tempDC, maxWidth).c_str());
 
                        // set old font back
-                       if (hOldFont)
+                       if (hOldFont != nullptr)
                                ::SelectObject(tempDC.GetSafeHdc(),hOldFont);
 
                        // we must set TTM_SETMAXTIPWIDTH to use \n in tooltips
@@ -211,7 +184,7 @@ void CEditorFilePathBar::OnSetFocusEdit(UINT id)
  */
 String CEditorFilePathBar::GetText(int pane) const
 {
-       ASSERT (pane >= 0 && pane < countof(m_Edit));
+       ASSERT (pane >= 0 && pane < static_cast<int>(std::size(m_Edit)));
 
        // Check for `nullptr` since window may be closing..
        if (m_hWnd == nullptr)
@@ -230,7 +203,7 @@ String CEditorFilePathBar::GetText(int pane) const
  */
 void CEditorFilePathBar::SetText(int pane, const String& sString)
 {
-       ASSERT (pane >= 0 && pane < countof(m_Edit));
+       ASSERT (pane >= 0 && pane < static_cast<int>(std::size(m_Edit)));
 
        // Check for `nullptr` since window may be closing..
        if (m_hWnd == nullptr)
@@ -247,7 +220,7 @@ void CEditorFilePathBar::SetText(int pane, const String& sString)
  */
 void CEditorFilePathBar::SetActive(int pane, bool bActive)
 {
-       ASSERT (pane >= 0 && pane < countof(m_Edit));
+       ASSERT (pane >= 0 && pane < static_cast<int>(std::size(m_Edit)));
 
        // Check for `nullptr` since window may be closing..
        if (m_hWnd == nullptr)