1 // TortoiseMerge - a Diff/Patch program
3 // Copyright (C) 2006, 2008, 2010-2011 - 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.
20 #include "StandAloneDlg.h"
25 * \ingroup TortoiseMerge
26 * Virtual class providing the callback interface which
27 * is used by CFilePatchesDlg.
29 class CPatchFilesDlgCallBack
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 sVersion the revision number of the file to patch
38 * \return TRUE if patching was successful
40 virtual BOOL
PatchFile(CString sFilePath
, CString sVersion
, BOOL bAutoPatch
= FALSE
,BOOL bIsReview
=FALSE
,CString
*Path2
=NULL
) = 0;
43 * Callback function. Called when the user double clicks on a
44 * specific file to diff. The framework then has to fetch the two
45 * files from the URL's and revisions specified in the callback function and
46 * show them in the diff viewer.
47 * \param sURL1 the URL of the first file to diff
48 * \param sURL2 the URL of the second file to diff
49 * \param sRev1 the revision of the first file
50 * \param sRev2 the revision of the second file
52 virtual BOOL
DiffFiles(CString sURL1
, CString sRev1
, CString sURL2
, CString sRev2
) = 0;
55 #define FPDLG_FILESTATE_GOOD 0x0000
56 #define FPDLG_FILESTATE_CONFLICTED 0x0001
57 #define FPDLG_FILESTATE_PATCHED 0x0002
58 #define FPDLG_FILESTATE_NEW 0x0003
59 #define FPDLG_FILESTATE_DELETE 0x0004
60 #define FPDLG_FILESTATE_RENAME 0x0005
63 #define ID_PATCHSELECTED 2
64 #define ID_PATCHPREVIEW 3
65 #define ID_PATCH_REVIEW 4
67 * \ingroup TortoiseMerge
69 * Dialog class, showing all files to patch from a unified diff file.
71 class CFilePatchesDlg
: public CResizableStandAloneDialog
73 DECLARE_DYNAMIC(CFilePatchesDlg
)
76 CFilePatchesDlg(CWnd
* pParent
= NULL
); // standard constructor
77 virtual ~CFilePatchesDlg();
80 * Call this method to initialize the dialog.
81 * \param pPatch The CPatch object used to get the filenames from the unified diff file
82 * \param pCallBack The Object providing the callback interface (CPatchFilesDlgCallBack)
83 * \param sPath The path to the "parent" folder where the patch gets applied to
84 * \return TRUE if successful
86 BOOL
Init(CPatch
* 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
};
93 CPatchFilesDlgCallBack
* m_pCallBack
;
95 CListCtrl m_cFileList
;
96 CDWordArray m_arFileStates
;
102 virtual void DoDataExchange(CDataExchange
* pDX
); // DDX/DDV support
104 virtual BOOL
OnInitDialog();
105 afx_msg
void OnSize(UINT nType
, int cx
, int cy
);
106 afx_msg
void OnLvnGetInfoTipFilelist(NMHDR
*pNMHDR
, LRESULT
*pResult
);
107 afx_msg
void OnLvnItemchangedFilelist(NMHDR
*pNMHDR
, LRESULT
*pResult
);
108 afx_msg
void OnNMDblclkFilelist(NMHDR
*pNMHDR
, LRESULT
*pResult
);
109 afx_msg
void OnNMCustomdrawFilelist(NMHDR
*pNMHDR
, LRESULT
*pResult
);
110 afx_msg
void OnNMRclickFilelist(NMHDR
*pNMHDR
, LRESULT
*pResult
);
111 afx_msg
void OnNcLButtonDblClk(UINT nHitTest
, CPoint point
);
112 afx_msg
void OnMoving(UINT fwSide
, LPRECT pRect
);
113 afx_msg
void OnBnClickedPatchselectedbutton();
114 afx_msg
void OnBnClickedPatchallbutton();
116 DECLARE_MESSAGE_MAP()
118 CString
GetFullPath(int nIndex
, int fileno
=0);
119 void SetTitleWithPath(int width
);
121 void PatchSelected();