Dropped unused variables
[TortoiseGit.git] / src / TortoiseProc / FileDiffDlg.h
blobe1985cc35cea9316cca2fb87922770d6794b5e5b
1 // TortoiseGit - a Windows shell extension for easy version control
3 // Copyright (C) 2008-2011,2013 - 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.
20 #pragma once
21 #include "afxcmn.h"
22 #include "StandAloneDlg.h"
23 #include "Git.h"
24 #include "TGitPath.h"
25 //#include "Blame.h"
26 #include "Git.h"
27 #include "HintListCtrl.h"
28 #include "Colors.h"
29 #include "FilterEdit.h"
30 #include "MessageBox.h"
31 #include "Tooltip.h"
32 #include "ProgressDlg.h"
33 #include "MenuButton.h"
34 #include "ACEdit.h"
35 #define IDT_FILTER 101
36 #define IDT_INPUT 102
38 /**
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
42 * two revisions.
44 #define MSG_REF_LOADED (WM_USER+120)
46 class CFileDiffDlg : public CResizableStandAloneDialog
48 DECLARE_DYNAMIC(CFileDiffDlg)
49 public:
50 // class FileDiff
51 // {
52 // public:
53 // CTGitPath path;
54 // svn_client_diff_summarize_kind_t kind;
55 bool propchanged;
56 // svn_node_kind_t node;
57 // };
59 public:
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 };
74 protected:
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);
96 DECLARE_MESSAGE_MAP()
98 // virtual svn_error_t* DiffSummarizeCallback(const CTGitPath& path,
99 // svn_client_diff_summarize_kind_t kind,
100 // bool propchanged,
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 RevertSelectedItemToVersion(CString rev);
117 int FillRevFromString(GitRev *rev, CString str)
119 GitRev gitrev;
120 bool revfail = false;
123 revfail = !!gitrev.GetCommit(str);
125 catch (const char *msg)
127 CMessageBox::Show(m_hWnd, _T("Could not get commit ") + str + _T("\nlibgit reports:\n") + CString(msg), _T("TortoiseGit"), MB_ICONERROR);
128 return -1;
131 if (revfail)
133 CString msg;
134 msg.Format(_T("Reference %s is wrong"), str);
135 CMessageBox::Show(NULL, msg, _T("TortoiseGit"), MB_OK | MB_ICONERROR);
136 return -1;
138 *rev=gitrev;
139 return 0;
142 private:
143 static UINT DiffThreadEntry(LPVOID pVoid);
144 UINT DiffThread();
146 static UINT LoadRefThreadEntry(LPVOID pVoid)
148 return ((CFileDiffDlg *)pVoid)->LoadRefThread();
151 UINT LoadRefThread();
153 STRING_VECTOR m_Reflist;
155 virtual BOOL Cancel() {return m_bCancelled;}
157 CToolTips m_tooltips;
159 CMenuButton m_cRev1Btn;
160 CMenuButton m_cRev2Btn;
161 CFilterEdit m_cFilter;
163 CMFCButton m_SwitchButton;
164 CColors m_colors;
165 CHintListCtrl m_cFileList;
166 bool m_bBlame;
167 CTGitPathList m_arFileList;
168 std::vector<CTGitPath*> m_arFilteredList;
170 CString m_strExportDir;
171 CProgressDlg * m_pProgDlg;
173 int m_nIconFolder;
175 CTGitPath m_path1;
176 GitRev m_peg;
177 GitRev m_rev1;
178 CTGitPath m_path2;
179 GitRev m_rev2;
181 bool m_bIgnoreancestry;
182 bool m_bDoPegDiff;
183 volatile LONG m_bThreadRunning;
185 volatile LONG m_bLoadingRef;
187 bool m_bCancelled;
189 void Sort();
190 static bool SortCompare(const CTGitPath& Data1, const CTGitPath& Data2);
192 static BOOL m_bAscending;
193 static int m_nSortedColumn;
195 CACEdit m_ctrRev1Edit;
196 CACEdit m_ctrRev2Edit;
198 CString m_FileListText;
199 public:
200 CString m_strRev1;
201 CString m_strRev2;
202 CString m_sFilter;
204 public:
205 virtual BOOL DestroyWindow();
206 void OnTextUpdate(CACEdit *pEdit);