Add support for "project" config level
[TortoiseGit.git] / src / TortoiseProc / CommitDlg.h
blob76a3b54f97a16f6a5d5d12ca63cd877a001a6f27
1 // TortoiseGit - a Windows shell extension for easy version control
3 // Copyright (C) 2003-2008 - TortoiseSVN
4 // Copyright (C) 2008-2013 - 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 "RegHistory.h"
25 #include "registry.h"
26 #include "SciEdit.h"
27 #include "SplitterControl.h"
28 #include "LinkControl.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>
39 #define ENDDIALOGTIMER 100
40 #define REFRESHTIMER 101
41 #define FILLPATCHVTIMER 102
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(CString(MAKEINTRESOURCE(IDS_PROC_COMMIT_SHOWPATCH)));
65 else
66 this->m_ctrlShowPatch.SetWindowText(CString(MAKEINTRESOURCE(IDS_PROC_COMMIT_HIDEPATCH)));
68 m_ctrlShowPatch.Invalidate();
70 private:
71 static UINT StatusThreadEntry(LPVOID pVoid);
72 UINT StatusThread();
73 void FillPatchView(bool onlySetTimer = false);
74 void SetDlgTitle();
75 CString GetSignedOffByLine();
76 CString m_sTitle;
78 // Dialog Data
79 enum { IDD = IDD_COMMITDLG };
81 protected:
82 virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
84 virtual BOOL OnInitDialog();
85 virtual void OnOK();
86 virtual void OnCancel();
87 virtual BOOL PreTranslateMessage(MSG* pMsg);
88 virtual LRESULT DefWindowProc(UINT message, WPARAM wParam, LPARAM lParam);
89 afx_msg void OnBnClickedShowunversioned();
90 afx_msg void OnBnClickedHistory();
91 afx_msg void OnBnClickedBugtraqbutton();
92 afx_msg void OnEnChangeLogmessage();
93 afx_msg void OnStnClickedExternalwarning();
94 afx_msg void OnFocusMessage();
95 afx_msg LRESULT OnGitStatusListCtrlItemCountChanged(WPARAM, LPARAM);
96 afx_msg LRESULT OnGitStatusListCtrlNeedsRefresh(WPARAM, LPARAM);
97 afx_msg LRESULT OnGitStatusListCtrlCheckChanged(WPARAM, LPARAM);
98 afx_msg LRESULT OnGitStatusListCtrlItemChanged(WPARAM, LPARAM);
100 afx_msg LRESULT OnCheck(WPARAM count, LPARAM);
101 afx_msg LRESULT OnAutoListReady(WPARAM, LPARAM);
102 afx_msg LRESULT OnUpdateOKButton(WPARAM, LPARAM);
103 afx_msg LRESULT OnUpdateDataFalse(WPARAM, LPARAM);
104 afx_msg LRESULT OnFileDropped(WPARAM, LPARAM lParam);
105 afx_msg void OnTimer(UINT_PTR nIDEvent);
106 afx_msg void OnSize(UINT nType, int cx, int cy);
107 void Refresh();
108 void GetAutocompletionList();
109 void ScanFile(const CString& sFilePath, const CString& sRegex);
110 void DoSize(int delta);
111 void SetSplitterRange();
112 void SaveSplitterPos();
113 void UpdateCheckLinks();
114 void ParseRegexFile(const CString& sFile, std::map<CString, CString>& mapRegex);
116 DECLARE_MESSAGE_MAP()
118 public:
119 CString m_sLogMessage;
120 BOOL m_bKeepChangeList;
121 BOOL m_bDoNotAutoselectSubmodules;
122 bool m_bForceCommitAmend;
123 BOOL m_bCommitAmend;
124 BOOL m_bNoPostActions;
125 bool m_bSelectFilesForCommit;
126 bool m_bAutoClose;
127 CString m_AmendStr;
128 CString m_sBugID;
129 BOOL m_bWholeProject;
130 CTGitPathList m_pathList;
131 CTGitPathList m_checkedPathList;
132 CTGitPathList m_updatedPathList;
133 int m_PostCmd;
134 BOOL m_bPushAfterCommit;
135 BOOL m_bCreateTagAfterCommit;
136 BOOL m_bAmendDiffToLastCommit;
137 BOOL m_bCommitMessageOnly;
139 protected:
140 CTGitPathList m_selectedPathList;
141 BOOL m_bRecursive;
142 CSciEdit m_cLogMessage;
143 CString m_sChangeList;
144 INT_PTR m_itemsCount;
145 CComPtr<IBugTraqProvider> m_BugTraqProvider;
146 CString m_NoAmendStr;
147 BOOL m_bCreateNewBranch;
148 CString m_sCreateNewBranch;
149 BOOL m_bSetAuthor;
150 CString m_sAuthor;
152 int CheckHeadDetach();
154 private:
155 CWinThread* m_pThread;
156 std::set<CString> m_autolist;
157 CGitStatusListCtrl m_ListCtrl;
158 BOOL m_bShowUnversioned;
159 volatile LONG m_bBlock;
160 volatile LONG m_bThreadRunning;
161 volatile LONG m_bRunThread;
162 CToolTips m_tooltips;
163 CRegDWORD m_regAddBeforeCommit;
164 CRegDWORD m_regKeepChangelists;
165 CRegDWORD m_regDoNotAutoselectSubmodules;
166 ProjectProperties m_ProjectProperties;
167 CString m_sWindowTitle;
168 static UINT WM_AUTOLISTREADY;
169 static UINT WM_UPDATEOKBUTTON;
170 static UINT WM_UPDATEDATAFALSE;
171 int m_nPopupPickCommitHash;
172 int m_nPopupPickCommitMessage;
173 int m_nPopupPasteListCmd;
174 int m_nPopupPasteLastMessage;
175 int m_nPopupRecentMessage;
176 CRegHistory m_History;
177 bool m_bCancelled;
178 CSplitterControl m_wndSplitter;
179 CRect m_DlgOrigRect;
180 CRect m_LogMsgOrigRect;
181 CPathWatcher m_pathwatcher;
182 CHyperLink m_ctrlShowPatch;
183 CPatchViewDlg m_patchViewdlg;
184 BOOL m_bSetCommitDateTime;
185 CDateTimeCtrl m_CommitDate;
186 CDateTimeCtrl m_CommitTime;
187 CLinkControl m_linkControl;
189 CBugTraqAssociation m_bugtraq_association;
190 HACCEL m_hAccel;
191 void RestoreFiles(bool doNotAsk = false);
193 protected:
194 afx_msg void OnBnClickedSignOff();
195 afx_msg void OnBnClickedCommitAmend();
196 afx_msg void OnBnClickedCommitMessageOnly();
197 afx_msg void OnBnClickedWholeProject();
198 afx_msg void OnScnUpdateUI(NMHDR *pNMHDR, LRESULT *pResult);
199 afx_msg void OnStnClickedViewPatch();
200 afx_msg void OnMoving(UINT fwSide, LPRECT pRect);
201 afx_msg void OnSizing(UINT fwSide, LPRECT pRect);
202 afx_msg void OnHdnItemchangedFilelist(NMHDR *pNMHDR, LRESULT *pResult);
203 afx_msg void OnBnClickedCommitAmenddiff();
204 afx_msg void OnBnClickedNoautoselectsubmodules();
205 afx_msg void OnBnClickedCommitSetDateTime();
206 afx_msg void OnBnClickedCheckNewBranch();
207 afx_msg void OnBnClickedCommitSetauthor();