OSDN Git Service

Fix issue #940: Replace slow (2)
[winmerge-jp/winmerge-jp.git] / Src / PatchDlg.h
index 539dc3c..6f4444f 100644 (file)
@@ -1,31 +1,13 @@
-/////////////////////////////////////////////////////////////////////////////
-//    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  PatchDlg.h
  *
  * @brief Declaration file for patch creation dialog
  */
-// ID line follows -- this is updated by SVN
-// $Id: PatchDlg.h 6783 2009-05-25 06:47:22Z kimmov $
-
-#if !defined(AFX_PATCHDLG_H__AB3CE671_1328_11D7_B088_005004D9D386__INCLUDED_)
-#define AFX_PATCHDLG_H__AB3CE671_1328_11D7_B088_005004D9D386__INCLUDED_
+#pragma once
 
 #include "resource.h"
+#include "TrDialogs.h"
 #include "SuperComboBox.h"
 #include "UnicodeString.h"
 
@@ -39,16 +21,16 @@ struct PATCHFILES;
  * This dialog allows user to select files from which to create a patch,
  * patch file's filename and several options related to patch.
  */
-class CPatchDlg : public CDialog
+class CPatchDlg : public CTrDialog
 {
 // Construction
 public:
-       CPatchDlg(CWnd* pParent = NULL);   // standard constructor
+       explicit CPatchDlg(CWnd* pParent = nullptr);   // standard constructor
 
        // Functions to add and get selected files (as PATCHFILEs)
        void AddItem(const PATCHFILES& pf);
        size_t GetItemCount();
-       const PATCHFILES& GetItemAt(int position);
+       const PATCHFILES& GetItemAt(size_t position);
        void ClearItems();
 
 // Dialog Data
@@ -56,7 +38,7 @@ public:
        enum { IDD = IDD_GENERATE_PATCH };
        CComboBox m_comboStyle;
        CSuperComboBox m_comboContext;
-       bool m_caseSensitive;
+       bool m_ignoreCase;
        CSuperComboBox m_ctlFile1;
        CSuperComboBox m_ctlFile2;
        CSuperComboBox m_ctlResult;
@@ -73,6 +55,8 @@ public:
 
        enum output_style m_outputStyle; /**< Patch style (context, unified etc.) */
        int m_contextLines; /**< How many context lines are added. */
+       enum DiffAlgorithm m_diffAlgorithm;
+       bool m_indentHeuristic;
 
 // Overrides
        // ClassWizard generated virtual function overrides
@@ -86,7 +70,6 @@ protected:
 
        std::vector<PATCHFILES> m_fileList; /**< Source files to create patch from */
 
-       void ChangeFile(const String &sFile, bool bLeft);
        void UpdateSettings();
        void LoadSettings();
        void SaveSettings();
@@ -94,22 +77,55 @@ protected:
 
        // Generated message map functions
        //{{AFX_MSG(CPatchDlg)
-       virtual void OnOK();
-       virtual BOOL OnInitDialog();
+       virtual void OnOK() override;
+       virtual BOOL OnInitDialog() override;
        afx_msg void OnDiffBrowseFile1();
        afx_msg void OnDiffBrowseFile2();
        afx_msg void OnDiffBrowseResult();
-       afx_msg void OnSelchangeFile1Combo();
-       afx_msg void OnSelchangeFile2Combo();
-       afx_msg void OnSelchangeResultCombo();
        afx_msg void OnSelchangeDiffStyle();
        afx_msg void OnDiffSwapFiles();
        afx_msg void OnDefaultSettings();
+       afx_msg void OnSelchangeFile1();
+       afx_msg void OnSelchangeFile2();
+       afx_msg void OnEditchangeFile1();
+       afx_msg void OnEditchangeFile2();
        //}}AFX_MSG
        DECLARE_MESSAGE_MAP()
 };
 
-//{{AFX_INSERT_LOCATION}}
-// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
+/** 
+ * @brief Add patch item to internal list.
+ * @param [in] pf Patch item to add.
+ */
+inline void CPatchDlg::AddItem(const PATCHFILES& pf)
+{
+       m_fileList.push_back(pf);
+}
+
+/** 
+ * @brief Returns amount of patch items in the internal list.
+ * @return Count of patch items in the list.
+ */
+inline size_t CPatchDlg::GetItemCount()
+{
+       return m_fileList.size();
+}
+
+/** 
+ * @brief Return item in the internal list at given position
+ * @param [in] position Zero-based index of item to get
+ * @return PATCHFILES from given position.
+ */
+inline const PATCHFILES& CPatchDlg::GetItemAt(size_t position)
+{
+       return m_fileList.at(position);
+}
+
+/** 
+ * @brief Empties internal item list.
+ */
+inline void CPatchDlg::ClearItems()
+{
+       m_fileList.clear();
+}
 
-#endif // !defined(AFX_PATCHDLG_H__AB3CE671_1328_11D7_B088_005004D9D386__INCLUDED_)