pulled latest translations from Transifex
[TortoiseGit.git] / src / TortoiseProc / FileDiffDlg.h
blob52951f443bcf53b9ab4c7619aadb56f0568fcef9
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.
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 FillRevFromString(GitRev *rev, CString str)
117 GitRev gitrev;
118 if(gitrev.GetCommit(str))
120 CString msg;
121 msg.Format(_T("Reference %s is wrong"),str);
122 CMessageBox::Show(NULL,msg,_T("TortoiseGit"),MB_OK|MB_ICONERROR);
123 return -1;
125 *rev=gitrev;
126 return 0;
129 private:
130 static UINT DiffThreadEntry(LPVOID pVoid);
131 UINT DiffThread();
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;
151 CColors m_colors;
152 CHintListCtrl m_cFileList;
153 bool m_bBlame;
154 CTGitPathList m_arFileList;
155 std::vector<CTGitPath*> m_arFilteredList;
157 CString m_strExportDir;
158 CProgressDlg * m_pProgDlg;
160 int m_nIconFolder;
162 CTGitPath m_path1;
163 GitRev m_peg;
164 GitRev m_rev1;
165 CTGitPath m_path2;
166 GitRev m_rev2;
168 bool m_bIgnoreancestry;
169 bool m_bDoPegDiff;
170 volatile LONG m_bThreadRunning;
172 volatile LONG m_bLoadingRef;
174 bool m_bCancelled;
176 void Sort();
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;
186 public:
187 CString m_strRev1;
188 CString m_strRev2;
189 CString m_sFilter;
191 public:
192 virtual BOOL DestroyWindow();
193 void OnTextUpdate(CACEdit *pEdit);