1 // TortoiseMerge - a Diff/Patch program
\r
3 // Copyright (C) 2006, 2008 - Stefan Kueng
\r
5 // This program is free software; you can redistribute it and/or
\r
6 // modify it under the terms of the GNU General Public License
\r
7 // as published by the Free Software Foundation; either version 2
\r
8 // of the License, or (at your option) any later version.
\r
10 // This program is distributed in the hope that it will be useful,
\r
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
\r
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
\r
13 // GNU General Public License for more details.
\r
15 // You should have received a copy of the GNU General Public License
\r
16 // along with this program; if not, write to the Free Software Foundation,
\r
17 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
\r
24 * \ingroup TortoiseMerge
\r
25 * Virtual class providing the callback interface which
\r
26 * is used by CFilePatchesDlg.
\r
28 class CPatchFilesDlgCallBack
\r
32 * Callback function. Called when the user double clicks on a
\r
33 * specific file to patch. The framework then has to process
\r
34 * the patching/viewing.
\r
35 * \param sFilePath the full path to the file to patch
\r
36 * \param sVersion the revision number of the file to patch
\r
37 * \return TRUE if patching was successful
\r
39 virtual BOOL PatchFile(CString sFilePath, CString sVersion, BOOL bAutoPatch = FALSE) = 0;
\r
42 * Callback function. Called when the user double clicks on a
\r
43 * specific file to diff. The framework then has to fetch the two
\r
44 * files from the URL's and revisions specified in the callback function and
\r
45 * show them in the diff viewer.
\r
46 * \param sURL1 the URL of the first file to diff
\r
47 * \param sURL2 the URL of the second file to diff
\r
48 * \param sRev1 the revision of the first file
\r
49 * \param sRev2 the revision of the second file
\r
51 virtual BOOL DiffFiles(CString sURL1, CString sRev1, CString sURL2, CString sRev2) = 0;
\r
54 #define FPDLG_FILESTATE_GOOD 0x0000
\r
55 #define FPDLG_FILESTATE_CONFLICTED 0x0001
\r
56 #define FPDLG_FILESTATE_PATCHED 0x0002
\r
58 #define ID_PATCHALL 1
\r
59 #define ID_PATCHSELECTED 2
\r
60 #define ID_PATCHPREVIEW 3
\r
62 * \ingroup TortoiseMerge
\r
64 * Dialog class, showing all files to patch from a unified diff file.
\r
66 class CFilePatchesDlg : public CDialog
\r
68 DECLARE_DYNAMIC(CFilePatchesDlg)
\r
71 CFilePatchesDlg(CWnd* pParent = NULL); // standard constructor
\r
72 virtual ~CFilePatchesDlg();
\r
75 * Call this method to initialize the dialog.
\r
76 * \param pPatch The CPatch object used to get the filenames from the unified diff file
\r
77 * \param pCallBack The Object providing the callback interface (CPatchFilesDlgCallBack)
\r
78 * \param sPath The path to the "parent" folder where the patch gets applied to
\r
79 * \return TRUE if successful
\r
81 BOOL Init(CPatch * pPatch, CPatchFilesDlgCallBack * pCallBack, CString sPath, CWnd * pParent);
\r
83 BOOL SetFileStatusAsPatched(CString sPath);
\r
84 bool HasFiles() {return m_cFileList.GetItemCount()>0;}
\r
85 enum { IDD = IDD_FILEPATCHES };
\r
88 CPatchFilesDlgCallBack * m_pCallBack;
\r
90 CListCtrl m_cFileList;
\r
91 CDWordArray m_arFileStates;
\r
92 CImageList m_ImgList;
\r
94 int m_nWindowHeight;
\r
95 CWnd * m_pMainFrame;
\r
97 virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
\r
98 virtual void OnOK();
\r
99 afx_msg void OnSize(UINT nType, int cx, int cy);
\r
100 afx_msg void OnLvnGetInfoTipFilelist(NMHDR *pNMHDR, LRESULT *pResult);
\r
101 afx_msg void OnNMDblclkFilelist(NMHDR *pNMHDR, LRESULT *pResult);
\r
102 afx_msg void OnNMCustomdrawFilelist(NMHDR *pNMHDR, LRESULT *pResult);
\r
103 afx_msg void OnNMRclickFilelist(NMHDR *pNMHDR, LRESULT *pResult);
\r
104 afx_msg void OnNcLButtonDblClk(UINT nHitTest, CPoint point);
\r
105 afx_msg void OnMoving(UINT fwSide, LPRECT pRect);
\r
107 DECLARE_MESSAGE_MAP()
\r
109 CString GetFullPath(int nIndex);
\r