1 // SPDX-License-Identifier: GPL-2.0-or-later
5 * @brief Declaration file for patch creation dialog
10 #include "TrDialogs.h"
11 #include "SuperComboBox.h"
12 #include "UnicodeString.h"
16 /////////////////////////////////////////////////////////////////////////////
20 * @brief Dialog class for Generate Patch -dialog.
21 * This dialog allows user to select files from which to create a patch,
22 * patch file's filename and several options related to patch.
24 class CPatchDlg : public CTrDialog
28 explicit CPatchDlg(CWnd* pParent = nullptr); // standard constructor
30 // Functions to add and get selected files (as PATCHFILEs)
31 void AddItem(const PATCHFILES& pf);
32 size_t GetItemCount();
33 const PATCHFILES& GetItemAt(size_t position);
37 //{{AFX_DATA(CPatchDlg)
38 enum { IDD = IDD_GENERATE_PATCH };
39 CComboBox m_comboStyle;
40 CSuperComboBox m_comboContext;
42 CSuperComboBox m_ctlFile1;
43 CSuperComboBox m_ctlFile2;
44 CSuperComboBox m_ctlResult;
49 bool m_ignoreEOLDifference;
50 int m_whitespaceCompare;
53 bool m_includeCmdLine;
56 enum output_style m_outputStyle; /**< Patch style (context, unified etc.) */
57 int m_contextLines; /**< How many context lines are added. */
58 enum DiffAlgorithm m_diffAlgorithm;
59 bool m_indentHeuristic;
62 // ClassWizard generated virtual function overrides
63 //{{AFX_VIRTUAL(CPatchDlg)
65 virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
71 std::vector<PATCHFILES> m_fileList; /**< Source files to create patch from */
73 void UpdateSettings();
78 // Generated message map functions
79 //{{AFX_MSG(CPatchDlg)
80 virtual void OnOK() override;
81 virtual BOOL OnInitDialog() override;
82 afx_msg void OnDiffBrowseFile1();
83 afx_msg void OnDiffBrowseFile2();
84 afx_msg void OnDiffBrowseResult();
85 afx_msg void OnSelchangeDiffStyle();
86 afx_msg void OnDiffSwapFiles();
87 afx_msg void OnDefaultSettings();
88 afx_msg void OnSelchangeFile1();
89 afx_msg void OnSelchangeFile2();
90 afx_msg void OnEditchangeFile1();
91 afx_msg void OnEditchangeFile2();
97 * @brief Add patch item to internal list.
98 * @param [in] pf Patch item to add.
100 inline void CPatchDlg::AddItem(const PATCHFILES& pf)
102 m_fileList.push_back(pf);
106 * @brief Returns amount of patch items in the internal list.
107 * @return Count of patch items in the list.
109 inline size_t CPatchDlg::GetItemCount()
111 return m_fileList.size();
115 * @brief Return item in the internal list at given position
116 * @param [in] position Zero-based index of item to get
117 * @return PATCHFILES from given position.
119 inline const PATCHFILES& CPatchDlg::GetItemAt(size_t position)
121 return m_fileList.at(position);
125 * @brief Empties internal item list.
127 inline void CPatchDlg::ClearItems()