1 // TortoiseMerge - a Diff/Patch program
3 // Copyright (C) 2006, 2008 - Stefan Kueng
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.
24 * \ingroup TortoiseMerge
25 * Virtual class providing the callback interface which
26 * is used by CFilePatchesDlg.
28 class CPatchFilesDlgCallBack
32 * Callback function. Called when the user double clicks on a
33 * specific file to patch. The framework then has to process
34 * the patching/viewing.
35 * \param sFilePath the full path to the file to patch
36 * \param sVersion the revision number of the file to patch
37 * \return TRUE if patching was successful
39 virtual BOOL
PatchFile(CString sFilePath
, CString sVersion
, BOOL bAutoPatch
= FALSE
,BOOL bIsReview
=FALSE
,CString
*Path2
=NULL
) = 0;
42 * Callback function. Called when the user double clicks on a
43 * specific file to diff. The framework then has to fetch the two
44 * files from the URL's and revisions specified in the callback function and
45 * show them in the diff viewer.
46 * \param sURL1 the URL of the first file to diff
47 * \param sURL2 the URL of the second file to diff
48 * \param sRev1 the revision of the first file
49 * \param sRev2 the revision of the second file
51 virtual BOOL
DiffFiles(CString sURL1
, CString sRev1
, CString sURL2
, CString sRev2
) = 0;
54 #define FPDLG_FILESTATE_GOOD 0x0000
55 #define FPDLG_FILESTATE_CONFLICTED 0x0001
56 #define FPDLG_FILESTATE_PATCHED 0x0002
57 #define FPDLG_FILESTATE_NEW 0x0003
58 #define FPDLG_FILESTATE_DELETE 0x0004
59 #define FPDLG_FILESTATE_RENAME 0x0005
62 #define ID_PATCHSELECTED 2
63 #define ID_PATCHPREVIEW 3
64 #define ID_PATCH_REVIEW 4
66 * \ingroup TortoiseMerge
68 * Dialog class, showing all files to patch from a unified diff file.
70 class CFilePatchesDlg
: public CDialog
72 DECLARE_DYNAMIC(CFilePatchesDlg
)
75 CFilePatchesDlg(CWnd
* pParent
= NULL
); // standard constructor
76 virtual ~CFilePatchesDlg();
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 * \return TRUE if successful
85 BOOL
Init(CPatch
* pPatch
, CPatchFilesDlgCallBack
* pCallBack
, CString sPath
, CWnd
* pParent
);
87 BOOL
SetFileStatusAsPatched(CString sPath
);
88 bool HasFiles() {return m_cFileList
.GetItemCount()>0;}
89 enum { IDD
= IDD_FILEPATCHES
};
92 CPatchFilesDlgCallBack
* m_pCallBack
;
94 CListCtrl m_cFileList
;
95 CDWordArray m_arFileStates
;
101 virtual void DoDataExchange(CDataExchange
* pDX
); // DDX/DDV support
103 afx_msg
void OnSize(UINT nType
, int cx
, int cy
);
104 afx_msg
void OnLvnGetInfoTipFilelist(NMHDR
*pNMHDR
, LRESULT
*pResult
);
105 afx_msg
void OnNMDblclkFilelist(NMHDR
*pNMHDR
, LRESULT
*pResult
);
106 afx_msg
void OnNMCustomdrawFilelist(NMHDR
*pNMHDR
, LRESULT
*pResult
);
107 afx_msg
void OnNMRclickFilelist(NMHDR
*pNMHDR
, LRESULT
*pResult
);
108 afx_msg
void OnNcLButtonDblClk(UINT nHitTest
, CPoint point
);
109 afx_msg
void OnMoving(UINT fwSide
, LPRECT pRect
);
111 DECLARE_MESSAGE_MAP()
113 CString
GetFullPath(int nIndex
, int fileno
=0);