OSDN Git Service

Plugins: Fix a crash on Window XP
[winmerge-jp/winmerge-jp.git] / Src / CompareStatisticsDlg.cpp
index dd637a2..1671c5c 100644 (file)
@@ -1,19 +1,4 @@
-/////////////////////////////////////////////////////////////////////////////
-//    License (GPLv2+):
-//    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  CompareStatisticsDlg.cpp
  *
 #include "stdafx.h"
 #include "CompareStatisticsDlg.h"
 #include "CompareStats.h"
-#include "Merge.h"
 
 #ifdef _DEBUG
 #define new DEBUG_NEW
-#undef THIS_FILE
-static char THIS_FILE[] = __FILE__;
 #endif
 
 /////////////////////////////////////////////////////////////////////////////
 // SaveClosingDlg dialog
 
-IMPLEMENT_DYNAMIC(CompareStatisticsDlg, CDialog)
+IMPLEMENT_DYNAMIC(CompareStatisticsDlg, CTrDialog)
 
-CompareStatisticsDlg::CompareStatisticsDlg(const CompareStats* pStats, CWnd* pParent /*=NULL*/) :
+CompareStatisticsDlg::CompareStatisticsDlg(const CompareStats* pStats, CWnd* pParent /*= nullptr*/) :
        m_pCompareStats(pStats),
-       CDialog(pStats->GetCompareDirs() < 3 ? IDD_COMPARE_STATISTICS : IDD_COMPARE_STATISTICS3, pParent)
+       CTrDialog(pStats->GetCompareDirs() < 3 ? IDD_COMPARE_STATISTICS : IDD_COMPARE_STATISTICS3, pParent)
 {
        //{{AFX_DATA_INIT(CompareStatisticsDlg)
        //}}AFX_DATA_INIT
 }
 
-BEGIN_MESSAGE_MAP(CompareStatisticsDlg, CDialog)
+BEGIN_MESSAGE_MAP(CompareStatisticsDlg, CTrDialog)
        //{{AFX_MSG_MAP(SaveClosingDlg)
        //}}AFX_MSG_MAP
 END_MESSAGE_MAP()
@@ -58,8 +40,7 @@ END_MESSAGE_MAP()
  */
 BOOL CompareStatisticsDlg::OnInitDialog()
 {
-       theApp.TranslateDialog(m_hWnd);
-       CDialog::OnInitDialog();
+       CTrDialog::OnInitDialog();
        int totalFiles = 0;
        int totalFolders = 0;
        const int iconCX = []() {
@@ -68,15 +49,18 @@ BOOL CompareStatisticsDlg::OnInitDialog()
                        return 16;
                if (cx < 32)
                        return 24;
-               return 32;
+               if (cx < 48)
+                       return 32;
+               return 48;
        }();
        const int iconCY = iconCX;
 
        static const struct { int ctlID; CompareStats::RESULT resultType; bool isDir; } ctlResultTypeMap[] =
        {
-               { IDC_STAT_IDENTICFOLDER,  CompareStats::RESULT_DIR,         true },
+               { IDC_STAT_IDENTICFOLDER,  CompareStats::RESULT_DIRSAME,     true },
                { IDC_STAT_IDENTICFILE,    CompareStats::RESULT_SAME,        false },
                { IDC_STAT_IDENTICBINARY,  CompareStats::RESULT_BINSAME,     false },
+               { IDC_STAT_DIFFFOLDER,     CompareStats::RESULT_DIRDIFF,     true },
                { IDC_STAT_DIFFFILE,       CompareStats::RESULT_DIFF,        false },
                { IDC_STAT_DIFFBINARY,     CompareStats::RESULT_BINDIFF,     false },
                { IDC_STAT_LUNIQFOLDER,    CompareStats::RESULT_LDIRUNIQUE,  true },
@@ -115,6 +99,7 @@ BOOL CompareStatisticsDlg::OnInitDialog()
                { IDC_STAT_ILMISSINGFOLDER, IDI_MRFOLDER },
                { IDC_STAT_IMMISSINGFOLDER, IDI_LRFOLDER },
                { IDC_STAT_IRMISSINGFOLDER, IDI_LMFOLDER },
+               { IDC_STAT_INOTEQUALFOLDER, IDI_NOTEQUALFOLDER },
                { IDC_STAT_INOTEQUAL,       IDI_NOTEQUALFILE },
                { IDC_STAT_IDIFFBINFILE,    IDI_BINARYDIFF },
                { IDC_STAT_ILUNIQFILE,      IDI_LFILE },
@@ -125,16 +110,16 @@ BOOL CompareStatisticsDlg::OnInitDialog()
                { IDC_STAT_IRMISSINGFILE,   IDI_LMFILE },
                { IDC_STAT_IEQUALFILE,      IDI_EQUALFILE },
                { IDC_STAT_IEQUALBINFILE,   IDI_EQUALBINARY },
+               { IDC_STAT_IIDENTICFOLDER,  IDI_EQUALFOLDER },
        };
        
        for (auto&& map : ctlIconMap)
        {
-               CStatic * pBitmapCtrl = static_cast<CStatic *>(GetDlgItem(map.ctlID));
-               if (pBitmapCtrl)
+               if (GetDlgItem(map.ctlID))
                {
                        HICON hIcon = (HICON)LoadImage(AfxGetInstanceHandle(),
                                MAKEINTRESOURCE(map.iconID), IMAGE_ICON, iconCX, iconCY, LR_SHARED);
-                       pBitmapCtrl->SetIcon(hIcon);
+                       SendDlgItemMessage(map.ctlID, STM_SETICON, (WPARAM)hIcon, 0L);
                }
        }