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;
41 CSuperComboBox m_ctlFile1;
42 CSuperComboBox m_ctlFile2;
43 CSuperComboBox m_ctlResult;
47 bool m_copyToClipboard;
50 bool m_includeCmdLine;
53 enum output_style m_outputStyle; /**< Patch style (context, unified etc.) */
54 int m_contextLines; /**< How many context lines are added. */
57 // ClassWizard generated virtual function overrides
58 //{{AFX_VIRTUAL(CPatchDlg)
60 virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
66 std::vector<PATCHFILES> m_fileList; /**< Source files to create patch from */
68 void UpdateSettings();
73 // Generated message map functions
74 //{{AFX_MSG(CPatchDlg)
75 virtual void OnOK() override;
76 virtual BOOL OnInitDialog() override;
77 afx_msg void OnDiffBrowseFile1();
78 afx_msg void OnDiffBrowseFile2();
79 afx_msg void OnDiffBrowseResult();
80 afx_msg void OnSelchangeDiffStyle();
81 afx_msg void OnDiffSwapFiles();
82 afx_msg void OnDefaultSettings();
83 afx_msg void OnSelchangeFile1();
84 afx_msg void OnSelchangeFile2();
85 afx_msg void OnEditchangeFile1();
86 afx_msg void OnEditchangeFile2();
92 * @brief Add patch item to internal list.
93 * @param [in] pf Patch item to add.
95 inline void CPatchDlg::AddItem(const PATCHFILES& pf)
97 m_fileList.push_back(pf);
101 * @brief Returns amount of patch items in the internal list.
102 * @return Count of patch items in the list.
104 inline size_t CPatchDlg::GetItemCount()
106 return m_fileList.size();
110 * @brief Return item in the internal list at given position
111 * @param [in] position Zero-based index of item to get
112 * @return PATCHFILES from given position.
114 inline const PATCHFILES& CPatchDlg::GetItemAt(size_t position)
116 return m_fileList.at(position);
120 * @brief Empties internal item list.
122 inline void CPatchDlg::ClearItems()