Merge branch 'restructure-tree'
[TortoiseGit.git] / src / TortoiseProc / CommitDlg.h
blobf5d2788ef7551d0d6c72a69362ba3d128b3c2434
1 // TortoiseGit - a Windows shell extension for easy version control
3 // Copyright (C) 2003-2008 - TortoiseSVN
4 // Copyright (C) 2008-2011 - TortoiseGit
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
22 #include "StandAloneDlg.h"
23 #include "GitStatusListCtrl.h"
24 #include "ProjectProperties.h"
25 #include "RegHistory.h"
26 #include "Registry.h"
27 #include "SciEdit.h"
28 #include "SplitterControl.h"
29 #include "PathWatcher.h"
30 #include "BugTraqAssociations.h"
31 #include "Tooltip.h"
32 #include "..\IBugTraqProvider\IBugTraqProvider_h.h"
33 #include "Git.h"
34 #include "HyperLink.h"
35 #include "PatchViewDlg.h"
37 #include <regex>
38 using namespace std;
40 #define ENDDIALOGTIMER 100
41 #define REFRESHTIMER 101
43 /**
44 * \ingroup TortoiseProc
45 * Dialog to enter log messages used in a commit.
47 class CCommitDlg : public CResizableStandAloneDialog, public CSciEditContextMenuInterface
49 DECLARE_DYNAMIC(CCommitDlg)
51 public:
52 CCommitDlg(CWnd* pParent = NULL); // standard constructor
53 virtual ~CCommitDlg();
55 protected:
56 // CSciEditContextMenuInterface
57 virtual void InsertMenuItems(CMenu& mPopup, int& nCmd);
58 virtual bool HandleMenuItemClick(int cmd, CSciEdit * pSciEdit);
60 public:
61 void ShowViewPatchText(bool b=true)
63 if(b)
64 this->m_ctrlShowPatch.SetWindowText(_T("View Patch>>"));
65 else
66 this->m_ctrlShowPatch.SetWindowText(_T("Hide Patch<<"));
68 m_ctrlShowPatch.Invalidate();
70 private:
71 static UINT StatusThreadEntry(LPVOID pVoid);
72 UINT StatusThread();
73 void UpdateOKButton();
74 void FillPatchView();
75 // Dialog Data
76 enum { IDD = IDD_COMMITDLG };
78 protected:
79 virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
81 virtual BOOL OnInitDialog();
82 virtual void OnOK();
83 virtual void OnCancel();
84 virtual BOOL PreTranslateMessage(MSG* pMsg);
85 virtual LRESULT DefWindowProc(UINT message, WPARAM wParam, LPARAM lParam);
86 afx_msg void OnBnClickedSelectall();
87 afx_msg void OnBnClickedHelp();
88 afx_msg void OnBnClickedShowunversioned();
89 afx_msg void OnBnClickedHistory();
90 afx_msg void OnBnClickedBugtraqbutton();
91 afx_msg void OnEnChangeLogmessage();
92 afx_msg void OnStnClickedExternalwarning();
93 afx_msg void OnFocusMessage();
94 afx_msg LRESULT OnGitStatusListCtrlItemCountChanged(WPARAM, LPARAM);
95 afx_msg LRESULT OnGitStatusListCtrlNeedsRefresh(WPARAM, LPARAM);
96 afx_msg LRESULT OnGitStatusListCtrlCheckChanged(WPARAM, LPARAM);
97 afx_msg LRESULT OnGitStatusListCtrlItemChanged(WPARAM, LPARAM);
99 afx_msg LRESULT OnAutoListReady(WPARAM, LPARAM);
100 afx_msg LRESULT OnFileDropped(WPARAM, LPARAM lParam);
101 afx_msg void OnTimer(UINT_PTR nIDEvent);
102 afx_msg void OnSize(UINT nType, int cx, int cy);
103 void Refresh();
104 void GetAutocompletionList();
105 void ScanFile(const CString& sFilePath, const CString& sRegex);
106 void DoSize(int delta);
107 void SetSplitterRange();
108 void SaveSplitterPos();
109 void ParseRegexFile(const CString& sFile, std::map<CString, CString>& mapRegex);
111 DECLARE_MESSAGE_MAP()
113 public:
114 CString m_sLogMessage;
115 BOOL m_bKeepChangeList;
116 BOOL m_bDoNotAutoselectSubmodules;
117 BOOL m_bCommitAmend;
118 BOOL m_bNoPostActions;
119 bool m_bSelectFilesForCommit;
120 bool m_bAutoClose;
121 CString m_AmendStr;
122 CString m_sBugID;
123 BOOL m_bWholeProject;
124 CTGitPathList m_pathList;
125 CTGitPathList m_checkedPathList;
126 CTGitPathList m_updatedPathList;
127 int m_PostCmd;
128 BOOL m_bPushAfterCommit;
129 BOOL m_bAmendDiffToLastCommit;
131 protected:
132 CTGitPathList m_selectedPathList;
133 BOOL m_bRecursive;
134 CSciEdit m_cLogMessage;
135 CString m_sChangeList;
136 INT_PTR m_itemsCount;
137 CComPtr<IBugTraqProvider> m_BugTraqProvider;
138 CString m_NoAmendStr;
140 int CheckHeadDetach();
142 private:
143 CWinThread* m_pThread;
144 std::set<CString> m_autolist;
145 CGitStatusListCtrl m_ListCtrl;
146 BOOL m_bShowUnversioned;
147 volatile LONG m_bBlock;
148 volatile LONG m_bThreadRunning;
149 volatile LONG m_bRunThread;
150 CToolTips m_tooltips;
151 CRegDWORD m_regAddBeforeCommit;
152 CRegDWORD m_regKeepChangelists;
153 CRegDWORD m_regDoNotAutoselectSubmodules;
154 ProjectProperties m_ProjectProperties;
155 CButton m_SelectAll;
156 CString m_sWindowTitle;
157 static UINT WM_AUTOLISTREADY;
158 int m_nPopupPasteListCmd;
159 int m_nPopupPasteLastMessage;
160 int m_nPopupRecentMessage;
161 CRegHistory m_History;
162 bool m_bCancelled;
163 CSplitterControl m_wndSplitter;
164 CRect m_DlgOrigRect;
165 CRect m_LogMsgOrigRect;
166 CPathWatcher m_pathwatcher;
167 CHyperLink m_ctrlShowPatch;
168 CPatchViewDlg m_patchViewdlg;
170 CBugTraqAssociation m_bugtraq_association;
171 HACCEL m_hAccel;
173 protected:
174 afx_msg void OnBnClickedSignOff();
175 afx_msg void OnBnClickedCommitAmend();
176 afx_msg void OnBnClickedWholeProject();
177 afx_msg void OnScnUpdateUI(NMHDR *pNMHDR, LRESULT *pResult);
178 afx_msg void OnStnClickedViewPatch();
179 afx_msg void OnMoving(UINT fwSide, LPRECT pRect);
180 afx_msg void OnSizing(UINT fwSide, LPRECT pRect);
181 afx_msg void OnHdnItemchangedFilelist(NMHDR *pNMHDR, LRESULT *pResult);
182 afx_msg void OnBnClickedCommitAmenddiff();
183 afx_msg void OnBnClickedNoautoselectsubmodules();