Drop unused msysgit dialog of installer
[TortoiseGit.git] / src / TortoiseProc / CommitDlg.h
blob2ecb697ffd6f1b86a787471fb103a8b792b90782
1 // TortoiseGit - a Windows shell extension for easy version control
3 // Copyright (C) 2003-2008 - TortoiseSVN
4 // Copyright (C) 2008-2014 - 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 typedef enum
45 GIT_POSTCOMMIT_CMD_NOTHING,
46 GIT_POSTCOMMIT_CMD_PUSH,
47 GIT_POSTCOMMIT_CMD_DCOMMIT,
48 GIT_POSTCOMMIT_CMD_PULL,
49 GIT_POSTCOMMIT_CMD_CREATETAG,
50 } GIT_POSTCOMMIT_CMD;
53 /**
54 * \ingroup TortoiseProc
55 * Dialog to enter log messages used in a commit.
57 class CCommitDlg : public CResizableStandAloneDialog, public CSciEditContextMenuInterface, IHasPatchView
59 DECLARE_DYNAMIC(CCommitDlg)
61 public:
62 CCommitDlg(CWnd* pParent = NULL); // standard constructor
63 virtual ~CCommitDlg();
65 protected:
66 // CSciEditContextMenuInterface
67 virtual void InsertMenuItems(CMenu& mPopup, int& nCmd);
68 virtual bool HandleMenuItemClick(int cmd, CSciEdit * pSciEdit);
70 public:
71 void ShowViewPatchText(bool b=true)
73 if(b)
74 this->m_ctrlShowPatch.SetWindowText(CString(MAKEINTRESOURCE(IDS_PROC_COMMIT_SHOWPATCH)));
75 else
76 this->m_ctrlShowPatch.SetWindowText(CString(MAKEINTRESOURCE(IDS_PROC_COMMIT_HIDEPATCH)));
78 m_ctrlShowPatch.Invalidate();
80 private:
81 static UINT StatusThreadEntry(LPVOID pVoid);
82 UINT StatusThread();
83 void FillPatchView(bool onlySetTimer = false);
84 CWnd * GetPatchViewParentWnd() { return this; }
85 virtual void TogglePatchView();
86 void SetDlgTitle();
87 CString GetSignedOffByLine();
88 CString m_sTitle;
90 // Dialog Data
91 enum { IDD = IDD_COMMITDLG };
93 protected:
94 virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
96 virtual BOOL OnInitDialog();
97 virtual void OnOK();
98 virtual void OnCancel();
99 virtual BOOL PreTranslateMessage(MSG* pMsg);
100 virtual LRESULT DefWindowProc(UINT message, WPARAM wParam, LPARAM lParam);
101 afx_msg void OnBnClickedShowunversioned();
102 afx_msg void OnBnClickedHistory();
103 afx_msg void OnBnClickedBugtraqbutton();
104 afx_msg void OnEnChangeLogmessage();
105 afx_msg void OnStnClickedExternalwarning();
106 afx_msg void OnFocusMessage();
107 afx_msg void OnFocusFileList();
108 afx_msg LRESULT OnGitStatusListCtrlItemCountChanged(WPARAM, LPARAM);
109 afx_msg LRESULT OnGitStatusListCtrlNeedsRefresh(WPARAM, LPARAM);
110 afx_msg LRESULT OnGitStatusListCtrlCheckChanged(WPARAM, LPARAM);
111 afx_msg LRESULT OnGitStatusListCtrlItemChanged(WPARAM, LPARAM);
113 afx_msg LRESULT OnCheck(WPARAM count, LPARAM);
114 afx_msg LRESULT OnAutoListReady(WPARAM, LPARAM);
115 afx_msg LRESULT OnUpdateOKButton(WPARAM, LPARAM);
116 afx_msg LRESULT OnUpdateDataFalse(WPARAM, LPARAM);
117 afx_msg LRESULT OnFileDropped(WPARAM, LPARAM lParam);
118 afx_msg void OnTimer(UINT_PTR nIDEvent);
119 afx_msg void OnSize(UINT nType, int cx, int cy);
120 void Refresh();
121 void GetAutocompletionList();
122 void ScanFile(const CString& sFilePath, const CString& sRegex, const CString& sExt);
123 void DoSize(int delta);
124 void SetSplitterRange();
125 void SaveSplitterPos();
126 void UpdateCheckLinks();
127 void ParseRegexFile(const CString& sFile, std::map<CString, CString>& mapRegex);
129 DECLARE_MESSAGE_MAP()
131 public:
132 CString m_sLogMessage;
133 BOOL m_bKeepChangeList;
134 BOOL m_bDoNotAutoselectSubmodules;
135 bool m_bForceCommitAmend;
136 BOOL m_bCommitAmend;
137 BOOL m_bNoPostActions;
138 bool m_bSelectFilesForCommit;
139 bool m_bAutoClose;
140 CString m_AmendStr;
141 CString m_sBugID;
142 BOOL m_bWholeProject;
143 BOOL m_bWholeProject2;
144 CTGitPathList m_pathList;
145 CTGitPathList m_checkedPathList;
146 CTGitPathList m_updatedPathList;
147 GIT_POSTCOMMIT_CMD m_PostCmd;
148 BOOL m_bAmendDiffToLastCommit;
149 BOOL m_bCommitMessageOnly;
151 protected:
152 CTGitPathList m_selectedPathList;
153 BOOL m_bRecursive;
154 CSciEdit m_cLogMessage;
155 CString m_sChangeList;
156 INT_PTR m_itemsCount;
157 CComPtr<IBugTraqProvider> m_BugTraqProvider;
158 CString m_NoAmendStr;
159 BOOL m_bCreateNewBranch;
160 CString m_sCreateNewBranch;
161 BOOL m_bSetAuthor;
162 CString m_sAuthor;
164 int CheckHeadDetach();
166 private:
167 CWinThread* m_pThread;
168 std::set<CString> m_autolist;
169 CGitStatusListCtrl m_ListCtrl;
170 BOOL m_bShowUnversioned;
171 volatile LONG m_bBlock;
172 volatile LONG m_bThreadRunning;
173 volatile LONG m_bRunThread;
174 CToolTips m_tooltips;
175 CRegDWORD m_regAddBeforeCommit;
176 CRegDWORD m_regKeepChangelists;
177 CRegDWORD m_regDoNotAutoselectSubmodules;
178 CRegDWORD m_regShowWholeProject;
179 ProjectProperties m_ProjectProperties;
180 CString m_sWindowTitle;
181 static UINT WM_AUTOLISTREADY;
182 static UINT WM_UPDATEOKBUTTON;
183 static UINT WM_UPDATEDATAFALSE;
184 int m_nPopupPickCommitHash;
185 int m_nPopupPickCommitMessage;
186 int m_nPopupPasteListCmd;
187 int m_nPopupPasteLastMessage;
188 int m_nPopupRecentMessage;
189 CRegHistory m_History;
190 bool m_bCancelled;
191 CSplitterControl m_wndSplitter;
192 CRect m_DlgOrigRect;
193 CRect m_LogMsgOrigRect;
194 CPathWatcher m_pathwatcher;
195 CHyperLink m_ctrlShowPatch;
196 CPatchViewDlg m_patchViewdlg;
197 BOOL m_bSetCommitDateTime;
198 CDateTimeCtrl m_CommitDate;
199 CDateTimeCtrl m_CommitTime;
200 CLinkControl m_linkControl;
201 CString m_sLogTemplate;
203 CBugTraqAssociation m_bugtraq_association;
204 HACCEL m_hAccel;
205 void RestoreFiles(bool doNotAsk = false);
207 protected:
208 afx_msg void OnBnClickedSignOff();
209 afx_msg void OnBnClickedCommitAmend();
210 afx_msg void OnBnClickedCommitMessageOnly();
211 afx_msg void OnBnClickedWholeProject();
212 afx_msg void OnScnUpdateUI(NMHDR *pNMHDR, LRESULT *pResult);
213 afx_msg void OnStnClickedViewPatch();
214 afx_msg void OnMoving(UINT fwSide, LPRECT pRect);
215 afx_msg void OnSizing(UINT fwSide, LPRECT pRect);
216 afx_msg void OnHdnItemchangedFilelist(NMHDR *pNMHDR, LRESULT *pResult);
217 afx_msg void OnBnClickedCommitAmenddiff();
218 afx_msg void OnBnClickedNoautoselectsubmodules();
219 afx_msg void OnBnClickedCommitSetDateTime();
220 afx_msg void OnBnClickedCheckNewBranch();
221 afx_msg void OnBnClickedCommitSetauthor();