OSDN Git Service

e3fbb2b6456eef03c727096fce19ef61e5443fc4
[tortoisegit/TortoiseGitJp.git] / src / TortoiseProc / FileDiffDlg.h
1 // TortoiseGit - a Windows shell extension for easy version control\r
2 \r
3 // Copyright (C) 2003-2008 - TortoiseGit\r
4 \r
5 // This program is free software; you can redistribute it and/or\r
6 // modify it under the terms of the GNU General Public License\r
7 // as published by the Free Software Foundation; either version 2\r
8 // of the License, or (at your option) any later version.\r
9 \r
10 // This program is distributed in the hope that it will be useful,\r
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of\r
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
13 // GNU General Public License for more details.\r
14 \r
15 // You should have received a copy of the GNU General Public License\r
16 // along with this program; if not, write to the Free Software Foundation,\r
17 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.\r
18 //\r
19 #pragma once\r
20 #include "afxcmn.h"\r
21 #include "StandAloneDlg.h"\r
22 #include "Git.h"\r
23 #include "TGitPath.h"\r
24 //#include "Blame.h"\r
25 #include "Git.h"\r
26 #include "HintListCtrl.h"\r
27 #include "Colors.h"\r
28 #include "XPImageButton.h"\r
29 #include "FilterEdit.h"\r
30 #include "Tooltip.h"\r
31 #include "ProgressDlg.h"\r
32 #include "MenuButton.h"\r
33 \r
34 #define IDT_FILTER              101\r
35 \r
36 /**\r
37  * \ingroup TortoiseProc\r
38  * Dialog which fetches and shows the difference between two urls in the\r
39  * repository. It shows a list of files/folders which were changed in those\r
40  * two revisions.\r
41  */\r
42 class CFileDiffDlg : public CResizableStandAloneDialog\r
43 {\r
44         DECLARE_DYNAMIC(CFileDiffDlg)\r
45 public:\r
46 //      class FileDiff\r
47 //      {\r
48 //      public:\r
49 //              CTGitPath path;\r
50 //              svn_client_diff_summarize_kind_t kind; \r
51                 bool propchanged;\r
52 //              svn_node_kind_t node;\r
53 //      };\r
54 \r
55 public:\r
56         CFileDiffDlg(CWnd* pParent = NULL);\r
57         virtual ~CFileDiffDlg();\r
58 \r
59 //      void SetDiff(const CTGitPath& path1, GitRev rev1, const CTGitPath& path2, GitRev rev2, svn_depth_t depth, bool ignoreancestry);\r
60 //      void SetDiff(const CTGitPath& path, GitRev peg, GitRev rev1, GitRev rev2, svn_depth_t depth, bool ignoreancestry);\r
61 \r
62         void SetDiff(CTGitPath * path, GitRev rev1,GitRev rev2);\r
63         void SetDiff(CTGitPath * path, GitRev rev1);\r
64         void SetDiff(CTGitPath * path, CString &hash1, CString &hash2);\r
65 \r
66         void    DoBlame(bool blame = true) {m_bBlame = blame;}\r
67 \r
68         enum { IDD = IDD_DIFFFILES };\r
69 \r
70 protected:\r
71         virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support\r
72         virtual void OnCancel();\r
73         virtual BOOL OnInitDialog();\r
74         virtual BOOL PreTranslateMessage(MSG* pMsg);\r
75         afx_msg void OnNMDblclkFilelist(NMHDR *pNMHDR, LRESULT *pResult);\r
76         afx_msg void OnLvnGetInfoTipFilelist(NMHDR *pNMHDR, LRESULT *pResult);\r
77         afx_msg void OnNMCustomdrawFilelist(NMHDR *pNMHDR, LRESULT *pResult);\r
78         afx_msg void OnContextMenu(CWnd* /*pWnd*/, CPoint /*point*/);\r
79         afx_msg BOOL OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message);\r
80         afx_msg void OnEnSetfocusSecondurl();\r
81         afx_msg void OnEnSetfocusFirsturl();\r
82         afx_msg void OnBnClickedSwitchleftright();\r
83         afx_msg void OnHdnItemclickFilelist(NMHDR *pNMHDR, LRESULT *pResult);\r
84         afx_msg void OnBnClickedRev1btn();\r
85         afx_msg void OnBnClickedRev2btn();\r
86         afx_msg LRESULT OnClickedCancelFilter(WPARAM wParam, LPARAM lParam);\r
87         afx_msg void OnEnChangeFilter();\r
88         afx_msg void OnTimer(UINT_PTR nIDEvent);\r
89 \r
90         DECLARE_MESSAGE_MAP()\r
91 \r
92 //      virtual svn_error_t* DiffSummarizeCallback(const CTGitPath& path, \r
93 //                                                                                      svn_client_diff_summarize_kind_t kind, \r
94 //                                                                                      bool propchanged, \r
95 //                                                                                      svn_node_kind_t node);\r
96 \r
97         int                                     AddEntry(const CTGitPath * fd);\r
98         void                            DoDiff(int selIndex, bool blame);\r
99         void                            DiffProps(int selIndex);\r
100         void                            SetURLLabels();\r
101         void                            Filter(CString sFilterText);\r
102         void                            CopySelectionToClipboard();\r
103         \r
104         void                            ClickRevButton(CMenuButton *button,GitRev *rev, CEdit *edit);\r
105 \r
106         void                            EnableInputControl(bool b=true);\r
107 \r
108         int                                     FillRevFromString(GitRev *rev, CString str)\r
109         {\r
110                 GitRev gitrev;\r
111                 if(gitrev.GetCommit(str))\r
112                 {\r
113                         CString msg;\r
114                         msg.Format(_T("Reference %s is wrong"),str);\r
115                         CMessageBox::Show(NULL,msg,_T("TortoiseGit"),MB_OK|MB_ICONERROR);\r
116                         return -1;\r
117                 }\r
118                 *rev=gitrev;\r
119                 return 0;\r
120         }\r
121 \r
122 private:\r
123         static UINT                     DiffThreadEntry(LPVOID pVoid);\r
124         UINT                            DiffThread();\r
125         static UINT                     ExportThreadEntry(LPVOID pVoid);\r
126         UINT                            ExportThread();\r
127 \r
128         virtual BOOL            Cancel() {return m_bCancelled;}\r
129 \r
130         CToolTips                       m_tooltips;\r
131 \r
132         CMenuButton                     m_cRev1Btn;\r
133         CMenuButton                     m_cRev2Btn;\r
134         CFilterEdit                     m_cFilter;\r
135 \r
136         CXPImageButton          m_SwitchButton;\r
137         HICON                           m_hSwitchIcon;\r
138         CColors                         m_colors;\r
139         CHintListCtrl           m_cFileList;\r
140         bool                            m_bBlame;\r
141 //      CBlame                          m_blamer;\r
142         CTGitPathList           m_arFileList;\r
143         std::vector<CTGitPath*> m_arFilteredList;\r
144         CArray<CTGitPath*, CTGitPath*> m_arSelectedFileList;\r
145 \r
146         CString                         m_strExportDir;\r
147         CProgressDlg *          m_pProgDlg;\r
148 \r
149         int                                     m_nIconFolder;\r
150 \r
151         CTGitPath                       m_path1;\r
152         GitRev                          m_peg;\r
153         GitRev                          m_rev1;\r
154         CTGitPath                       m_path2;\r
155         GitRev                          m_rev2;\r
156 \r
157         bool                            m_bIgnoreancestry;\r
158         bool                            m_bDoPegDiff;\r
159         volatile LONG           m_bThreadRunning;\r
160 \r
161         bool                            m_bCancelled;\r
162 \r
163         void                            Sort();\r
164 //      static bool                     SortCompare(const FileDiff& Data1, const FileDiff& Data2);\r
165 \r
166         static BOOL                     m_bAscending;\r
167         static int                      m_nSortedColumn;\r
168 \r
169         CEdit                           m_ctrRev1Edit;\r
170         CEdit                           m_ctrRev2Edit;\r
171 \r
172         CString                         m_FileListText;\r
173 public:\r
174         CString                         m_strRev1;\r
175         CString                         m_strRev2;\r
176 \r
177 public:\r
178         afx_msg void OnEnChangeRev1edit();\r
179         afx_msg void OnEnChangeRev2edit();\r
180 };\r