1 // TortoiseGit - a Windows shell extension for easy version control
3 // Copyright (C) 2008-2011 - TortoiseGit
4 // Copyright (C) 2003-2008 - TortoiseSVN
6 // This program is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU General Public License
8 // as published by the Free Software Foundation; either version 2
9 // of the License, or (at your option) any later version.
11 // This program is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
16 // You should have received a copy of the GNU General Public License
17 // along with this program; if not, write to the Free Software Foundation,
18 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
22 #include "StandAloneDlg.h"
27 #include "HintListCtrl.h"
29 #include "FilterEdit.h"
30 #include "MessageBox.h"
32 #include "ProgressDlg.h"
33 #include "MenuButton.h"
35 #define IDT_FILTER 101
39 * \ingroup TortoiseProc
40 * Dialog which fetches and shows the difference between two urls in the
41 * repository. It shows a list of files/folders which were changed in those
44 #define MSG_REF_LOADED (WM_USER+120)
46 class CFileDiffDlg
: public CResizableStandAloneDialog
48 DECLARE_DYNAMIC(CFileDiffDlg
)
54 // svn_client_diff_summarize_kind_t kind;
56 // svn_node_kind_t node;
60 CFileDiffDlg(CWnd
* pParent
= NULL
);
61 virtual ~CFileDiffDlg();
63 // void SetDiff(const CTGitPath& path1, GitRev rev1, const CTGitPath& path2, GitRev rev2, svn_depth_t depth, bool ignoreancestry);
64 // void SetDiff(const CTGitPath& path, GitRev peg, GitRev rev1, GitRev rev2, svn_depth_t depth, bool ignoreancestry);
66 void SetDiff(CTGitPath
* path
, GitRev rev1
,GitRev rev2
);
67 void SetDiff(CTGitPath
* path
, GitRev rev1
);
68 void SetDiff(CTGitPath
* path
, CString
&hash1
, CString
&hash2
);
70 void DoBlame(bool blame
= true) {m_bBlame
= blame
;}
72 enum { IDD
= IDD_DIFFFILES
};
75 virtual void DoDataExchange(CDataExchange
* pDX
); // DDX/DDV support
76 virtual void OnCancel();
77 virtual BOOL
OnInitDialog();
78 virtual BOOL
PreTranslateMessage(MSG
* pMsg
);
79 afx_msg LRESULT
OnRefLoad(WPARAM wParam
, LPARAM lParam
);
80 afx_msg
void OnNMDblclkFilelist(NMHDR
*pNMHDR
, LRESULT
*pResult
);
81 afx_msg
void OnLvnGetInfoTipFilelist(NMHDR
*pNMHDR
, LRESULT
*pResult
);
82 afx_msg
void OnNMCustomdrawFilelist(NMHDR
*pNMHDR
, LRESULT
*pResult
);
83 afx_msg
void OnContextMenu(CWnd
* /*pWnd*/, CPoint
/*point*/);
84 afx_msg BOOL
OnSetCursor(CWnd
* pWnd
, UINT nHitTest
, UINT message
);
85 afx_msg
void OnEnSetfocusSecondurl();
86 afx_msg
void OnEnSetfocusFirsturl();
87 afx_msg
void OnBnClickedSwitchleftright();
88 afx_msg
void OnHdnItemclickFilelist(NMHDR
*pNMHDR
, LRESULT
*pResult
);
89 afx_msg
void OnBnClickedRev1btn();
90 afx_msg
void OnBnClickedRev2btn();
91 afx_msg LRESULT
OnClickedCancelFilter(WPARAM wParam
, LPARAM lParam
);
92 afx_msg LRESULT
OnEnUpdate(WPARAM wParam
, LPARAM lParam
);
93 afx_msg
void OnEnChangeFilter();
94 afx_msg
void OnTimer(UINT_PTR nIDEvent
);
98 // virtual svn_error_t* DiffSummarizeCallback(const CTGitPath& path,
99 // svn_client_diff_summarize_kind_t kind,
101 // svn_node_kind_t node);
103 int AddEntry(const CTGitPath
* fd
);
104 void DoDiff(int selIndex
, bool blame
);
105 void DiffProps(int selIndex
);
106 void SetURLLabels(int mask
=0x3);
107 void ClearURLabels(int mask
);
108 void Filter(CString sFilterText
);
109 void CopySelectionToClipboard(BOOL isFull
=FALSE
);
111 void ClickRevButton(CMenuButton
*button
,GitRev
*rev
, CACEdit
*edit
);
113 void EnableInputControl(bool b
=true);
115 int FillRevFromString(GitRev
*rev
, CString str
)
118 if(gitrev
.GetCommit(str
))
121 msg
.Format(_T("Reference %s is wrong"),str
);
122 CMessageBox::Show(NULL
,msg
,_T("TortoiseGit"),MB_OK
|MB_ICONERROR
);
130 static UINT
DiffThreadEntry(LPVOID pVoid
);
133 static UINT
LoadRefThreadEntry(LPVOID pVoid
)
135 return ((CFileDiffDlg
*)pVoid
)->LoadRefThread();
138 UINT
LoadRefThread();
140 STRING_VECTOR m_Reflist
;
142 virtual BOOL
Cancel() {return m_bCancelled
;}
144 CToolTips m_tooltips
;
146 CMenuButton m_cRev1Btn
;
147 CMenuButton m_cRev2Btn
;
148 CFilterEdit m_cFilter
;
150 CMFCButton m_SwitchButton
;
152 CHintListCtrl m_cFileList
;
154 CTGitPathList m_arFileList
;
155 std::vector
<CTGitPath
*> m_arFilteredList
;
157 CString m_strExportDir
;
158 CProgressDlg
* m_pProgDlg
;
168 bool m_bIgnoreancestry
;
170 volatile LONG m_bThreadRunning
;
172 volatile LONG m_bLoadingRef
;
177 static bool SortCompare(const CTGitPath
& Data1
, const CTGitPath
& Data2
);
179 static BOOL m_bAscending
;
180 static int m_nSortedColumn
;
182 CACEdit m_ctrRev1Edit
;
183 CACEdit m_ctrRev2Edit
;
185 CString m_FileListText
;
192 virtual BOOL
DestroyWindow();
193 void OnTextUpdate(CACEdit
*pEdit
);