Doxygen docu fixes: list all parameters, fix parameter names in doxygen comments...
[TortoiseGit.git] / src / TortoiseMerge / FilePatchesDlg.h
blob279cb25c8c40a2ba3745c87f3b61a4d4caff3237
1 // TortoiseGitMerge - a Diff/Patch program
3 // Copyright (C) 2006, 2008, 2010-2011, 2013 - TortoiseSVN
5 // This program is free software; you can redistribute it and/or
6 // modify it under the terms of the GNU General Public License
7 // as published by the Free Software Foundation; either version 2
8 // of the License, or (at your option) any later version.
10 // This program is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
15 // You should have received a copy of the GNU General Public License
16 // along with this program; if not, write to the Free Software Foundation,
17 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19 #pragma once
20 #include "StandAloneDlg.h"
22 class GitPatch;
24 /**
25 * \ingroup TortoiseMerge
26 * Virtual class providing the callback interface which
27 * is used by CFilePatchesDlg.
29 class CPatchFilesDlgCallBack
31 public:
32 /**
33 * Callback function. Called when the user double clicks on a
34 * specific file to patch. The framework then has to process
35 * the patching/viewing.
36 * \param sFilePath the full path to the file to patch
37 * \param bContentMods
38 * \param bPropMods
39 * \param sVersion the revision number of the file to patch
40 * \param bAutoPatch
41 * \return TRUE if patching was successful
43 virtual BOOL PatchFile(CString sFilePath, bool bContentMods, bool bPropMods, CString sVersion, BOOL bAutoPatch = FALSE) = 0;
45 /**
46 * Callback function. Called when the user double clicks on a
47 * specific file to diff. The framework then has to fetch the two
48 * files from the URL's and revisions specified in the callback function and
49 * show them in the diff viewer.
50 * \param sURL1 the URL of the first file to diff
51 * \param sURL2 the URL of the second file to diff
52 * \param sRev1 the revision of the first file
53 * \param sRev2 the revision of the second file
55 virtual BOOL DiffFiles(CString sURL1, CString sRev1, CString sURL2, CString sRev2) = 0;
58 #define FPDLG_FILESTATE_GOOD 0
59 #define FPDLG_FILESTATE_ERROR (-1)
60 #define FPDLG_FILESTATE_PATCHED (-2)
62 #define ID_PATCHALL 1
63 #define ID_PATCHSELECTED 2
64 #define ID_PATCHPREVIEW 3
65 /**
66 * \ingroup TortoiseMerge
68 * Dialog class, showing all files to patch from a unified diff file.
70 class CFilePatchesDlg : public CResizableStandAloneDialog
72 DECLARE_DYNAMIC(CFilePatchesDlg)
74 public:
75 CFilePatchesDlg(CWnd* pParent = NULL); // standard constructor
76 virtual ~CFilePatchesDlg();
78 /**
79 * Call this method to initialize the dialog.
80 * \param pPatch The CPatch object used to get the filenames from the unified diff file
81 * \param pCallBack The Object providing the callback interface (CPatchFilesDlgCallBack)
82 * \param sPath The path to the "parent" folder where the patch gets applied to
83 * \param pParent
84 * \return TRUE if successful
86 BOOL Init(GitPatch * pPatch, CPatchFilesDlgCallBack * pCallBack, CString sPath, CWnd * pParent);
88 BOOL SetFileStatusAsPatched(CString sPath);
89 bool HasFiles() {return m_cFileList.GetItemCount()>0;}
90 enum { IDD = IDD_FILEPATCHES };
91 protected:
92 GitPatch * m_pPatch;
93 CPatchFilesDlgCallBack * m_pCallBack;
94 CString m_sPath;
95 CListCtrl m_cFileList;
96 CDWordArray m_arFileStates;
97 CImageList m_ImgList;
98 BOOL m_bMinimized;
99 int m_nWindowHeight;
100 CWnd * m_pMainFrame;
101 int m_ShownIndex;
102 HFONT m_boldFont;
103 protected:
104 virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
105 virtual void OnOK();
106 virtual BOOL OnInitDialog();
107 afx_msg void OnSize(UINT nType, int cx, int cy);
108 afx_msg void OnLvnGetInfoTipFilelist(NMHDR *pNMHDR, LRESULT *pResult);
109 afx_msg void OnLvnItemchangedFilelist(NMHDR *pNMHDR, LRESULT *pResult);
110 afx_msg void OnNMDblclkFilelist(NMHDR *pNMHDR, LRESULT *pResult);
111 afx_msg void OnNMCustomdrawFilelist(NMHDR *pNMHDR, LRESULT *pResult);
112 afx_msg void OnNMRclickFilelist(NMHDR *pNMHDR, LRESULT *pResult);
113 afx_msg void OnNcLButtonDblClk(UINT nHitTest, CPoint point);
114 afx_msg void OnMoving(UINT fwSide, LPRECT pRect);
115 afx_msg void OnBnClickedPatchselectedbutton();
116 afx_msg void OnBnClickedPatchallbutton();
118 DECLARE_MESSAGE_MAP()
120 CString GetFullPath(int nIndex);
121 void SetTitleWithPath(int width);
122 void PatchAll();
123 void PatchSelected();