OSDN Git Service

crystaledit: Use GetProfile*()/WriteProfile*() to read and write the registry wheneve...
[winmerge-jp/winmerge-jp.git] / Src / FilepathEdit.cpp
index 9fc867a..10c19c1 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  FilePathEdit.cpp
@@ -64,7 +50,7 @@ static int FormatFilePathForDisplayWidth(CDC * pDC, int maxWidth, String & sFile
        size_t iBegin = 0;
        int nLines = 1;
        
-       while (1)
+       while (true)
        {
                String line;
 
@@ -120,24 +106,15 @@ CFilepathEdit::CFilepathEdit()
  * @brief Subclass the control.
  * @param [in] nID ID of the control to subclass.
  * @param [in] pParent Parent control of the control to subclass.
- * @return TRUE if succeeded, FALSE otherwise.
+ * @return `true` if succeeded, `false` otherwise.
  */
-BOOL CFilepathEdit::SubClassEdit(UINT nID, CWnd* pParent)
+bool CFilepathEdit::SubClassEdit(UINT nID, CWnd* pParent)
 {
        m_bActive = false;
        return SubclassDlgItem(nID, pParent);
 };
 
 /**
- * @brief Return the control's original text.
- * @return Control's original text.
- */
-void CFilepathEdit::GetOriginalText(String& rString) const
-{              
-       rString = m_sOriginalText;
-}
-
-/**
  * @brief Set the text to show in the control.
  * This function sets the text (original text) to show in the control.
  * The control may modify the text for displaying in the GUI.
@@ -250,7 +227,7 @@ void CFilepathEdit::OnContextMenu(CWnd*, CPoint point)
                theApp.TranslateMenu(menu.m_hMenu);
 
                BCMenu* pPopup = static_cast<BCMenu *>(menu.GetSubMenu(0));
-               ASSERT(pPopup != NULL);
+               ASSERT(pPopup != nullptr);
 
                DWORD sel = GetSel();
                if (HIWORD(sel) == LOWORD(sel))
@@ -315,10 +292,10 @@ void CFilepathEdit::OnNcPaint()
        GetWindowRect(rect);
        rect.OffsetRect(-rect.TopLeft());
        dc.FillSolidRect(CRect(rect.left, rect.top, rect.left + margin, rect.bottom), GetDarkenColor(m_crBackGnd, 0.98));
-       dc.FillSolidRect(CRect(rect.left, rect.top, rect.left + 1, rect.bottom), GetDarkenColor(m_crBackGnd, 0.90));
+       dc.FillSolidRect(CRect(rect.left, rect.top, rect.left + 1, rect.bottom), GetDarkenColor(m_crBackGnd, 0.96));
        dc.FillSolidRect(CRect(rect.right - margin, rect.top, rect.right, rect.bottom), m_crBackGnd);
        dc.FillSolidRect(CRect(rect.left + 1, rect.top, rect.right, rect.top + margin), GetDarkenColor(m_crBackGnd, 0.98));
-       dc.FillSolidRect(CRect(rect.left, rect.top, rect.right, rect.top + 1), GetDarkenColor(m_crBackGnd, 0.90));
+       dc.FillSolidRect(CRect(rect.left, rect.top, rect.right, rect.top + 1), GetDarkenColor(m_crBackGnd, 0.96));
        dc.FillSolidRect(CRect(rect.left + margin, rect.bottom - margin, rect.right, rect.bottom), m_crBackGnd);
 }
 
@@ -348,13 +325,13 @@ BOOL CFilepathEdit::PreTranslateMessage(MSG *pMsg)
  * This function sets control to look like an active control. We don't
  * have real focus on this control, but editor pane below it. However
  * for user this active look informs which editor pane is active.
- * @param [in] bActive If TRUE set control look like active control.
+ * @param [in] bActive If `true` set control look like active control.
  */
 void CFilepathEdit::SetActive(bool bActive)
 {
        m_bActive = bActive;
 
-       if (m_hWnd == NULL)
+       if (m_hWnd == nullptr)
                return;
 
        CRect rcWnd;
@@ -370,7 +347,7 @@ void CFilepathEdit::SetActive(bool bActive)
                SetTextColor(::GetSysColor(COLOR_INACTIVECAPTIONTEXT));
                SetBackColor(::GetSysColor(COLOR_INACTIVECAPTION));
        }
-       RedrawWindow(NULL, NULL, RDW_FRAME | RDW_INVALIDATE);
+       RedrawWindow(nullptr, nullptr, RDW_FRAME | RDW_INVALIDATE);
 }
 
 /**
@@ -384,7 +361,7 @@ void CFilepathEdit::SetActive(bool bActive)
 HBRUSH CFilepathEdit::CtlColor(CDC* pDC, UINT nCtlColor) 
 {
        UNUSED_ALWAYS(nCtlColor);
-       // Return a non-NULL brush if the parent's 
+       // Return a non-`nullptr` brush if the parent's 
        //handler should not be called
 
        //set text color