OSDN Git Service

PatchTool: Apply diff algorithm when generating a patch
[winmerge-jp/winmerge-jp.git] / Src / PatchDlg.h
1 /////////////////////////////////////////////////////////////////////////////
2 //    License (GPLv2+):
3 //    This program is free software; you can redistribute it and/or modify
4 //    it under the terms of the GNU General Public License as published by
5 //    the Free Software Foundation; either version 2 of the License, or
6 //    (at your option) any later version.
7 //
8 //    This program is distributed in the hope that it will be useful, but
9 //    WITHOUT ANY WARRANTY; without even the implied warranty of
10 //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11 //    General Public License for more details.
12 //
13 //    You should have received a copy of the GNU General Public License
14 //    along with this program; if not, write to the Free Software
15 //    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
16 /////////////////////////////////////////////////////////////////////////////
17 /** 
18  * @file  PatchDlg.h
19  *
20  * @brief Declaration file for patch creation dialog
21  */
22 #pragma once
23
24 #include "resource.h"
25 #include "TrDialogs.h"
26 #include "SuperComboBox.h"
27 #include "UnicodeString.h"
28
29 struct PATCHFILES;
30
31 /////////////////////////////////////////////////////////////////////////////
32 // PatchDlg dialog
33
34 /** 
35  * @brief Dialog class for Generate Patch -dialog.
36  * This dialog allows user to select files from which to create a patch,
37  * patch file's filename and several options related to patch.
38  */
39 class CPatchDlg : public CTrDialog
40 {
41 // Construction
42 public:
43         explicit CPatchDlg(CWnd* pParent = nullptr);   // standard constructor
44
45         // Functions to add and get selected files (as PATCHFILEs)
46         void AddItem(const PATCHFILES& pf);
47         size_t GetItemCount();
48         const PATCHFILES& GetItemAt(size_t position);
49         void ClearItems();
50
51 // Dialog Data
52         //{{AFX_DATA(CPatchDlg)
53         enum { IDD = IDD_GENERATE_PATCH };
54         CComboBox m_comboStyle;
55         CSuperComboBox m_comboContext;
56         bool m_caseSensitive;
57         CSuperComboBox m_ctlFile1;
58         CSuperComboBox m_ctlFile2;
59         CSuperComboBox m_ctlResult;
60         String  m_file1;
61         String  m_file2;
62         String  m_fileResult;
63         bool m_ignoreBlanks;
64         bool m_ignoreEOLDifference;
65         int m_whitespaceCompare;
66         bool m_appendFile;
67         bool m_openToEditor;
68         bool m_includeCmdLine;
69         //}}AFX_DATA
70
71         enum output_style m_outputStyle; /**< Patch style (context, unified etc.) */
72         int m_contextLines; /**< How many context lines are added. */
73         enum DiffAlgorithm m_diffAlgorithm;
74         bool m_indentHeuristic;
75
76 // Overrides
77         // ClassWizard generated virtual function overrides
78         //{{AFX_VIRTUAL(CPatchDlg)
79         protected:
80         virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
81         //}}AFX_VIRTUAL
82
83 // Implementation
84 protected:
85
86         std::vector<PATCHFILES> m_fileList; /**< Source files to create patch from */
87
88         void UpdateSettings();
89         void LoadSettings();
90         void SaveSettings();
91         void Swap();
92
93         // Generated message map functions
94         //{{AFX_MSG(CPatchDlg)
95         virtual void OnOK() override;
96         virtual BOOL OnInitDialog() override;
97         afx_msg void OnDiffBrowseFile1();
98         afx_msg void OnDiffBrowseFile2();
99         afx_msg void OnDiffBrowseResult();
100         afx_msg void OnSelchangeDiffStyle();
101         afx_msg void OnDiffSwapFiles();
102         afx_msg void OnDefaultSettings();
103         //}}AFX_MSG
104         DECLARE_MESSAGE_MAP()
105 };