Fixed Issue #138: "Format patch" in "Show log" dialog doesn't work
[TortoiseGit.git] / src / TortoiseProc / FileDiffDlg.h
blob74496ab7793546d407340323d4afa84acd5536ba
1 // TortoiseGit - a Windows shell extension for easy version control
3 // Copyright (C) 2003-2008 - TortoiseGit
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.
19 #pragma once
20 #include "afxcmn.h"
21 #include "StandAloneDlg.h"
22 #include "Git.h"
23 #include "TGitPath.h"
24 //#include "Blame.h"
25 #include "Git.h"
26 #include "HintListCtrl.h"
27 #include "Colors.h"
28 #include "XPImageButton.h"
29 #include "FilterEdit.h"
30 #include "Tooltip.h"
31 #include "ProgressDlg.h"
34 #define IDT_FILTER 101
36 /**
37 * \ingroup TortoiseProc
38 * Dialog which fetches and shows the difference between two urls in the
39 * repository. It shows a list of files/folders which were changed in those
40 * two revisions.
42 class CFileDiffDlg : public CResizableStandAloneDialog
44 DECLARE_DYNAMIC(CFileDiffDlg)
45 public:
46 // class FileDiff
47 // {
48 // public:
49 // CTGitPath path;
50 // svn_client_diff_summarize_kind_t kind;
51 bool propchanged;
52 // svn_node_kind_t node;
53 // };
55 public:
56 CFileDiffDlg(CWnd* pParent = NULL);
57 virtual ~CFileDiffDlg();
59 // void SetDiff(const CTGitPath& path1, GitRev rev1, const CTGitPath& path2, GitRev rev2, svn_depth_t depth, bool ignoreancestry);
60 // void SetDiff(const CTGitPath& path, GitRev peg, GitRev rev1, GitRev rev2, svn_depth_t depth, bool ignoreancestry);
62 void SetDiff(CTGitPath * path, GitRev rev1,GitRev rev2);
63 void SetDiff(CTGitPath * path, GitRev rev1);
64 void SetDiff(CTGitPath * path, CString &hash1, CString &hash2);
66 void DoBlame(bool blame = true) {m_bBlame = blame;}
68 enum { IDD = IDD_DIFFFILES };
70 protected:
71 virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
72 virtual void OnCancel();
73 virtual BOOL OnInitDialog();
74 virtual BOOL PreTranslateMessage(MSG* pMsg);
75 afx_msg void OnNMDblclkFilelist(NMHDR *pNMHDR, LRESULT *pResult);
76 afx_msg void OnLvnGetInfoTipFilelist(NMHDR *pNMHDR, LRESULT *pResult);
77 afx_msg void OnNMCustomdrawFilelist(NMHDR *pNMHDR, LRESULT *pResult);
78 afx_msg void OnContextMenu(CWnd* /*pWnd*/, CPoint /*point*/);
79 afx_msg BOOL OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message);
80 afx_msg void OnEnSetfocusSecondurl();
81 afx_msg void OnEnSetfocusFirsturl();
82 afx_msg void OnBnClickedSwitchleftright();
83 afx_msg void OnHdnItemclickFilelist(NMHDR *pNMHDR, LRESULT *pResult);
84 afx_msg void OnBnClickedRev1btn();
85 afx_msg void OnBnClickedRev2btn();
86 afx_msg LRESULT OnClickedCancelFilter(WPARAM wParam, LPARAM lParam);
87 afx_msg void OnEnChangeFilter();
88 afx_msg void OnTimer(UINT_PTR nIDEvent);
90 DECLARE_MESSAGE_MAP()
92 // virtual svn_error_t* DiffSummarizeCallback(const CTGitPath& path,
93 // svn_client_diff_summarize_kind_t kind,
94 // bool propchanged,
95 // svn_node_kind_t node);
97 int AddEntry(const CTGitPath * fd);
98 void DoDiff(int selIndex, bool blame);
99 void DiffProps(int selIndex);
100 void SetURLLabels();
101 void Filter(CString sFilterText);
102 void CopySelectionToClipboard();
103 private:
104 static UINT DiffThreadEntry(LPVOID pVoid);
105 UINT DiffThread();
106 static UINT ExportThreadEntry(LPVOID pVoid);
107 UINT ExportThread();
109 virtual BOOL Cancel() {return m_bCancelled;}
111 CToolTips m_tooltips;
113 CButton m_cRev1Btn;
114 CButton m_cRev2Btn;
115 CFilterEdit m_cFilter;
117 CXPImageButton m_SwitchButton;
118 HICON m_hSwitchIcon;
119 CColors m_colors;
120 CHintListCtrl m_cFileList;
121 bool m_bBlame;
122 // CBlame m_blamer;
123 CTGitPathList m_arFileList;
124 std::vector<CTGitPath*> m_arFilteredList;
125 CArray<CTGitPath*, CTGitPath*> m_arSelectedFileList;
127 CString m_strExportDir;
128 CProgressDlg * m_pProgDlg;
130 int m_nIconFolder;
132 CTGitPath m_path1;
133 GitRev m_peg;
134 GitRev m_rev1;
135 CTGitPath m_path2;
136 GitRev m_rev2;
138 bool m_bIgnoreancestry;
139 bool m_bDoPegDiff;
140 volatile LONG m_bThreadRunning;
142 bool m_bCancelled;
144 void Sort();
145 // static bool SortCompare(const FileDiff& Data1, const FileDiff& Data2);
147 static BOOL m_bAscending;
148 static int m_nSortedColumn;