Moved some more strings to resources
[TortoiseGit.git] / src / TortoiseProc / CommitDlg.h
blob03cb1afca081743934d33433b4dc2c7a2435dfe5
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 "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(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 UpdateOKButton();
74 void FillPatchView();
75 void SetDlgTitle();
76 CString GetSignedOffByLine();
77 CString m_sTitle;
79 // Dialog Data
80 enum { IDD = IDD_COMMITDLG };
82 protected:
83 virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
85 virtual BOOL OnInitDialog();
86 virtual void OnOK();
87 virtual void OnCancel();
88 virtual BOOL PreTranslateMessage(MSG* pMsg);
89 virtual LRESULT DefWindowProc(UINT message, WPARAM wParam, LPARAM lParam);
90 afx_msg void OnBnClickedSelectall();
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 OnAutoListReady(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 ParseRegexFile(const CString& sFile, std::map<CString, CString>& mapRegex);
115 DECLARE_MESSAGE_MAP()
117 public:
118 CString m_sLogMessage;
119 BOOL m_bKeepChangeList;
120 BOOL m_bDoNotAutoselectSubmodules;
121 BOOL m_bCommitAmend;
122 BOOL m_bNoPostActions;
123 bool m_bSelectFilesForCommit;
124 bool m_bAutoClose;
125 CString m_AmendStr;
126 CString m_sBugID;
127 BOOL m_bWholeProject;
128 CTGitPathList m_pathList;
129 CTGitPathList m_checkedPathList;
130 CTGitPathList m_updatedPathList;
131 int m_PostCmd;
132 BOOL m_bPushAfterCommit;
133 BOOL m_bCreateTagAfterCommit;
134 BOOL m_bAmendDiffToLastCommit;
136 protected:
137 CTGitPathList m_selectedPathList;
138 BOOL m_bRecursive;
139 CSciEdit m_cLogMessage;
140 CString m_sChangeList;
141 INT_PTR m_itemsCount;
142 CComPtr<IBugTraqProvider> m_BugTraqProvider;
143 CString m_NoAmendStr;
144 BOOL m_bCreateNewBranch;
145 CString m_sCreateNewBranch;
147 int CheckHeadDetach();
149 private:
150 CWinThread* m_pThread;
151 std::set<CString> m_autolist;
152 CGitStatusListCtrl m_ListCtrl;
153 BOOL m_bShowUnversioned;
154 volatile LONG m_bBlock;
155 volatile LONG m_bThreadRunning;
156 volatile LONG m_bRunThread;
157 CToolTips m_tooltips;
158 CRegDWORD m_regAddBeforeCommit;
159 CRegDWORD m_regKeepChangelists;
160 CRegDWORD m_regDoNotAutoselectSubmodules;
161 ProjectProperties m_ProjectProperties;
162 CButton m_SelectAll;
163 CString m_sWindowTitle;
164 static UINT WM_AUTOLISTREADY;
165 int m_nPopupPasteListCmd;
166 int m_nPopupPasteLastMessage;
167 int m_nPopupRecentMessage;
168 CRegHistory m_History;
169 bool m_bCancelled;
170 CSplitterControl m_wndSplitter;
171 CRect m_DlgOrigRect;
172 CRect m_LogMsgOrigRect;
173 CPathWatcher m_pathwatcher;
174 CHyperLink m_ctrlShowPatch;
175 CPatchViewDlg m_patchViewdlg;
176 BOOL m_bSetCommitDateTime;
177 CDateTimeCtrl m_CommitDate;
178 CDateTimeCtrl m_CommitTime;
180 CBugTraqAssociation m_bugtraq_association;
181 HACCEL m_hAccel;
182 void RestoreFiles(bool doNotAsk = false);
184 protected:
185 afx_msg void OnBnClickedSignOff();
186 afx_msg void OnBnClickedCommitAmend();
187 afx_msg void OnBnClickedWholeProject();
188 afx_msg void OnScnUpdateUI(NMHDR *pNMHDR, LRESULT *pResult);
189 afx_msg void OnStnClickedViewPatch();
190 afx_msg void OnMoving(UINT fwSide, LPRECT pRect);
191 afx_msg void OnSizing(UINT fwSide, LPRECT pRect);
192 afx_msg void OnHdnItemchangedFilelist(NMHDR *pNMHDR, LRESULT *pResult);
193 afx_msg void OnBnClickedCommitAmenddiff();
194 afx_msg void OnBnClickedNoautoselectsubmodules();
195 afx_msg void OnBnClickedCommitSetDateTime();
196 afx_msg void OnBnClickedCheckNewBranch();