Fixed issue #1076: Error trying to delete remote branch named 1.0.0
[TortoiseGit.git] / src / TortoiseProc / CommitDlg.h
blob7541e33f98e71df9cde4526762009286f1d76e38
1 // TortoiseGit - a Windows shell extension for easy version control
3 // Copyright (C) 2003-2008 - TortoiseSVN
4 // Copyright (C) 2008-2012 - 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 "LinkControl.h"
30 #include "PathWatcher.h"
31 #include "BugTraqAssociations.h"
32 #include "Tooltip.h"
33 #include "..\IBugTraqProvider\IBugTraqProvider_h.h"
34 #include "Git.h"
35 #include "HyperLink.h"
36 #include "PatchViewDlg.h"
38 #include <regex>
39 using namespace std;
41 #define ENDDIALOGTIMER 100
42 #define REFRESHTIMER 101
44 /**
45 * \ingroup TortoiseProc
46 * Dialog to enter log messages used in a commit.
48 class CCommitDlg : public CResizableStandAloneDialog, public CSciEditContextMenuInterface
50 DECLARE_DYNAMIC(CCommitDlg)
52 public:
53 CCommitDlg(CWnd* pParent = NULL); // standard constructor
54 virtual ~CCommitDlg();
56 protected:
57 // CSciEditContextMenuInterface
58 virtual void InsertMenuItems(CMenu& mPopup, int& nCmd);
59 virtual bool HandleMenuItemClick(int cmd, CSciEdit * pSciEdit);
61 public:
62 void ShowViewPatchText(bool b=true)
64 if(b)
65 this->m_ctrlShowPatch.SetWindowText(CString(MAKEINTRESOURCE(IDS_PROC_COMMIT_SHOWPATCH)));
66 else
67 this->m_ctrlShowPatch.SetWindowText(CString(MAKEINTRESOURCE(IDS_PROC_COMMIT_HIDEPATCH)));
69 m_ctrlShowPatch.Invalidate();
71 private:
72 static UINT StatusThreadEntry(LPVOID pVoid);
73 UINT StatusThread();
74 void UpdateOKButton();
75 void FillPatchView();
76 void SetDlgTitle();
77 CString GetSignedOffByLine();
78 CString m_sTitle;
80 // Dialog Data
81 enum { IDD = IDD_COMMITDLG };
83 protected:
84 virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
86 virtual BOOL OnInitDialog();
87 virtual void OnOK();
88 virtual void OnCancel();
89 virtual BOOL PreTranslateMessage(MSG* pMsg);
90 virtual LRESULT DefWindowProc(UINT message, WPARAM wParam, LPARAM lParam);
91 afx_msg void OnBnClickedHelp();
92 afx_msg void OnBnClickedShowunversioned();
93 afx_msg void OnBnClickedHistory();
94 afx_msg void OnBnClickedBugtraqbutton();
95 afx_msg void OnEnChangeLogmessage();
96 afx_msg void OnStnClickedExternalwarning();
97 afx_msg void OnFocusMessage();
98 afx_msg LRESULT OnGitStatusListCtrlItemCountChanged(WPARAM, LPARAM);
99 afx_msg LRESULT OnGitStatusListCtrlNeedsRefresh(WPARAM, LPARAM);
100 afx_msg LRESULT OnGitStatusListCtrlCheckChanged(WPARAM, LPARAM);
101 afx_msg LRESULT OnGitStatusListCtrlItemChanged(WPARAM, LPARAM);
103 afx_msg LRESULT OnCheck(WPARAM count, LPARAM);
104 afx_msg LRESULT OnAutoListReady(WPARAM, LPARAM);
105 afx_msg LRESULT OnFileDropped(WPARAM, LPARAM lParam);
106 afx_msg void OnTimer(UINT_PTR nIDEvent);
107 afx_msg void OnSize(UINT nType, int cx, int cy);
108 void Refresh();
109 void GetAutocompletionList();
110 void ScanFile(const CString& sFilePath, const CString& sRegex);
111 void DoSize(int delta);
112 void SetSplitterRange();
113 void SaveSplitterPos();
114 void UpdateCheckLinks();
115 void ParseRegexFile(const CString& sFile, std::map<CString, CString>& mapRegex);
117 DECLARE_MESSAGE_MAP()
119 public:
120 CString m_sLogMessage;
121 BOOL m_bKeepChangeList;
122 BOOL m_bDoNotAutoselectSubmodules;
123 bool m_bForceCommitAmend;
124 BOOL m_bCommitAmend;
125 BOOL m_bNoPostActions;
126 bool m_bSelectFilesForCommit;
127 bool m_bAutoClose;
128 CString m_AmendStr;
129 CString m_sBugID;
130 BOOL m_bWholeProject;
131 CTGitPathList m_pathList;
132 CTGitPathList m_checkedPathList;
133 CTGitPathList m_updatedPathList;
134 int m_PostCmd;
135 BOOL m_bPushAfterCommit;
136 BOOL m_bCreateTagAfterCommit;
137 BOOL m_bAmendDiffToLastCommit;
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;
150 int CheckHeadDetach();
152 private:
153 CWinThread* m_pThread;
154 std::set<CString> m_autolist;
155 CGitStatusListCtrl m_ListCtrl;
156 BOOL m_bShowUnversioned;
157 volatile LONG m_bBlock;
158 volatile LONG m_bThreadRunning;
159 volatile LONG m_bRunThread;
160 CToolTips m_tooltips;
161 CRegDWORD m_regAddBeforeCommit;
162 CRegDWORD m_regKeepChangelists;
163 CRegDWORD m_regDoNotAutoselectSubmodules;
164 ProjectProperties m_ProjectProperties;
165 CString m_sWindowTitle;
166 static UINT WM_AUTOLISTREADY;
167 int m_nPopupPasteListCmd;
168 int m_nPopupPasteLastMessage;
169 int m_nPopupRecentMessage;
170 CRegHistory m_History;
171 bool m_bCancelled;
172 CSplitterControl m_wndSplitter;
173 CRect m_DlgOrigRect;
174 CRect m_LogMsgOrigRect;
175 CPathWatcher m_pathwatcher;
176 CHyperLink m_ctrlShowPatch;
177 CPatchViewDlg m_patchViewdlg;
178 BOOL m_bSetCommitDateTime;
179 CDateTimeCtrl m_CommitDate;
180 CDateTimeCtrl m_CommitTime;
181 CLinkControl m_linkControl;
183 CBugTraqAssociation m_bugtraq_association;
184 HACCEL m_hAccel;
185 void RestoreFiles(bool doNotAsk = false);
187 protected:
188 afx_msg void OnBnClickedSignOff();
189 afx_msg void OnBnClickedCommitAmend();
190 afx_msg void OnBnClickedWholeProject();
191 afx_msg void OnScnUpdateUI(NMHDR *pNMHDR, LRESULT *pResult);
192 afx_msg void OnStnClickedViewPatch();
193 afx_msg void OnMoving(UINT fwSide, LPRECT pRect);
194 afx_msg void OnSizing(UINT fwSide, LPRECT pRect);
195 afx_msg void OnHdnItemchangedFilelist(NMHDR *pNMHDR, LRESULT *pResult);
196 afx_msg void OnBnClickedCommitAmenddiff();
197 afx_msg void OnBnClickedNoautoselectsubmodules();
198 afx_msg void OnBnClickedCommitSetDateTime();
199 afx_msg void OnBnClickedCheckNewBranch();