Re-integrate the GPG signed commit into the unit tests
[TortoiseGit.git] / src / TortoiseProc / FileDiffDlg.h
blob730149b489ea194b70fc9e6cd9b36cba96916007
1 // TortoiseGit - a Windows shell extension for easy version control
3 // Copyright (C) 2008-2017 - 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 "GitRev.h"
25 #include "TGitPath.h"
26 #include "HintCtrl.h"
27 #include "Colors.h"
28 #include "FilterEdit.h"
29 #include "ProgressDlg.h"
30 #include "MenuButton.h"
31 #include "ACEdit.h"
32 #define IDT_FILTER 101
33 #define IDT_INPUT 102
35 /**
36 * \ingroup TortoiseProc
37 * Dialog which fetches and shows the difference between two urls in the
38 * repository. It shows a list of files/folders which were changed in those
39 * two revisions.
41 #define MSG_REF_LOADED (WM_USER+120)
43 class CFileDiffDlg : public CResizableStandAloneDialog
45 DECLARE_DYNAMIC(CFileDiffDlg)
46 public:
47 CFileDiffDlg(CWnd* pParent = nullptr);
48 virtual ~CFileDiffDlg();
50 void SetDiff(const CTGitPath* path, const GitRev& baseRev1, const GitRev& rev2);
51 void SetDiff(const CTGitPath* path, const GitRev& baseRev1);
52 void SetDiff(const CTGitPath* path, const CString& baseHash1, const CString& hash2);
54 void DoBlame(bool blame = true) {m_bBlame = blame;}
56 enum { IDD = IDD_DIFFFILES };
58 protected:
59 virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
60 virtual void OnCancel();
61 virtual BOOL OnInitDialog();
62 virtual BOOL PreTranslateMessage(MSG* pMsg);
63 afx_msg LRESULT OnRefLoad(WPARAM wParam, LPARAM lParam);
64 afx_msg void OnNMDblclkFilelist(NMHDR *pNMHDR, LRESULT *pResult);
65 afx_msg void OnLvnGetInfoTipFilelist(NMHDR *pNMHDR, LRESULT *pResult);
66 afx_msg void OnNMCustomdrawFilelist(NMHDR *pNMHDR, LRESULT *pResult);
67 afx_msg void OnContextMenu(CWnd* /*pWnd*/, CPoint /*point*/);
68 afx_msg BOOL OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message);
69 afx_msg void OnEnSetfocusSecondurl();
70 afx_msg void OnEnSetfocusFirsturl();
71 afx_msg void OnBnClickedSwitchleftright();
72 afx_msg void OnHdnItemclickFilelist(NMHDR *pNMHDR, LRESULT *pResult);
73 afx_msg void OnBnClickedRev1btn();
74 afx_msg void OnBnClickedRev2btn();
75 afx_msg LRESULT OnClickedCancelFilter(WPARAM wParam, LPARAM lParam);
76 afx_msg LRESULT OnEnUpdate(WPARAM wParam, LPARAM lParam);
77 afx_msg void OnEnChangeFilter();
78 afx_msg void OnTimer(UINT_PTR nIDEvent);
79 afx_msg void OnBnClickedDiffoption();
80 afx_msg void OnBnClickedLog();
81 afx_msg LRESULT OnDisableButtons(WPARAM, LPARAM);
82 afx_msg LRESULT OnDiffFinished(WPARAM, LPARAM);
83 afx_msg void OnLvnBegindrag(NMHDR* pNMHDR, LRESULT* pResult);
85 DECLARE_MESSAGE_MAP()
87 int AddEntry(const CTGitPath * fd);
88 void DoDiff(int selIndex, bool blame);
89 void SetURLLabels(int mask=0x3);
90 void ClearURLabels(int mask);
91 void Filter(CString sFilterText);
92 void CopySelectionToClipboard(BOOL isFull=FALSE);
94 void ClickRevButton(CMenuButton *button,GitRev *rev, CACEdit *edit);
96 void EnableInputControl(bool b=true);
98 int RevertSelectedItemToVersion(CString rev);
100 bool CheckMultipleDiffs();
102 int FillRevFromString(GitRev* rev, const CString& str)
104 GitRev gitrev;
105 if (gitrev.GetCommit(str))
107 MessageBox(gitrev.GetLastErr(), L"TortoiseGit", MB_ICONERROR);
108 return -1;
110 *rev=gitrev;
111 return 0;
114 private:
115 static UINT WM_DISABLEBUTTONS;
116 static UINT WM_DIFFFINISHED;
118 static UINT DiffThreadEntry(LPVOID pVoid);
119 UINT DiffThread();
121 static UINT LoadRefThreadEntry(LPVOID pVoid)
123 return reinterpret_cast<CFileDiffDlg*>(pVoid)->LoadRefThread();
126 UINT LoadRefThread();
128 STRING_VECTOR m_Reflist;
130 virtual BOOL Cancel() {return m_bCancelled;}
131 virtual BOOL DestroyWindow();
132 void OnTextUpdate(CACEdit *pEdit);
134 CMenuButton m_cRev1Btn;
135 CMenuButton m_cRev2Btn;
136 CFilterEdit m_cFilter;
138 CMenuButton m_cDiffOptionsBtn;
140 CMFCButton m_SwitchButton;
141 CColors m_colors;
142 CHintCtrl<CListCtrl> m_cFileList;
143 bool m_bBlame;
144 CTGitPathList m_arFileList;
145 std::vector<CTGitPath*> m_arFilteredList;
147 CString m_strExportDir;
149 int m_nIconFolder;
151 bool m_bIsBare;
152 CTGitPath m_path1;
153 GitRev m_rev1;
154 CTGitPath m_path2;
155 GitRev m_rev2;
157 volatile LONG m_bThreadRunning;
159 volatile LONG m_bLoadingRef;
161 bool m_bCancelled;
163 void Sort();
164 static bool SortCompare(const CTGitPath& Data1, const CTGitPath& Data2);
166 static BOOL m_bAscending;
167 static int m_nSortedColumn;
169 CACEdit m_ctrRev1Edit;
170 CACEdit m_ctrRev2Edit;
172 bool m_bIgnoreSpaceAtEol;
173 bool m_bIgnoreSpaceChange;
174 bool m_bIgnoreAllSpace;
175 bool m_bIgnoreBlankLines;
176 public:
177 CString m_strRev1;
178 CString m_strRev2;
179 CString m_sFilter;