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.
22 #include "StandAloneDlg.h"
23 #include "GitStatusListCtrl.h"
24 #include "ProjectProperties.h"
25 #include "RegHistory.h"
28 #include "SplitterControl.h"
29 #include "PathWatcher.h"
30 #include "BugTraqAssociations.h"
32 #include "..\IBugTraqProvider\IBugTraqProvider_h.h"
34 #include "HyperLink.h"
35 #include "PatchViewDlg.h"
40 #define ENDDIALOGTIMER 100
41 #define REFRESHTIMER 101
44 * \ingroup TortoiseProc
45 * Dialog to enter log messages used in a commit.
47 class CCommitDlg
: public CResizableStandAloneDialog
, public CSciEditContextMenuInterface
49 DECLARE_DYNAMIC(CCommitDlg
)
52 CCommitDlg(CWnd
* pParent
= NULL
); // standard constructor
53 virtual ~CCommitDlg();
56 // CSciEditContextMenuInterface
57 virtual void InsertMenuItems(CMenu
& mPopup
, int& nCmd
);
58 virtual bool HandleMenuItemClick(int cmd
, CSciEdit
* pSciEdit
);
61 void ShowViewPatchText(bool b
=true)
64 this->m_ctrlShowPatch
.SetWindowText(_T("View Patch>>"));
66 this->m_ctrlShowPatch
.SetWindowText(_T("Hide Patch<<"));
68 m_ctrlShowPatch
.Invalidate();
71 static UINT
StatusThreadEntry(LPVOID pVoid
);
73 void UpdateOKButton();
76 CString
GetSignedOffByLine();
80 enum { IDD
= IDD_COMMITDLG
};
83 virtual void DoDataExchange(CDataExchange
* pDX
); // DDX/DDV support
85 virtual BOOL
OnInitDialog();
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
);
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()
118 CString m_sLogMessage
;
119 BOOL m_bKeepChangeList
;
120 BOOL m_bDoNotAutoselectSubmodules
;
122 BOOL m_bNoPostActions
;
123 bool m_bSelectFilesForCommit
;
127 BOOL m_bWholeProject
;
128 CTGitPathList m_pathList
;
129 CTGitPathList m_checkedPathList
;
130 CTGitPathList m_updatedPathList
;
132 BOOL m_bPushAfterCommit
;
133 BOOL m_bAmendDiffToLastCommit
;
136 CTGitPathList m_selectedPathList
;
138 CSciEdit m_cLogMessage
;
139 CString m_sChangeList
;
140 INT_PTR m_itemsCount
;
141 CComPtr
<IBugTraqProvider
> m_BugTraqProvider
;
142 CString m_NoAmendStr
;
144 int CheckHeadDetach();
147 CWinThread
* m_pThread
;
148 std::set
<CString
> m_autolist
;
149 CGitStatusListCtrl m_ListCtrl
;
150 BOOL m_bShowUnversioned
;
151 volatile LONG m_bBlock
;
152 volatile LONG m_bThreadRunning
;
153 volatile LONG m_bRunThread
;
154 CToolTips m_tooltips
;
155 CRegDWORD m_regAddBeforeCommit
;
156 CRegDWORD m_regKeepChangelists
;
157 CRegDWORD m_regDoNotAutoselectSubmodules
;
158 ProjectProperties m_ProjectProperties
;
160 CString m_sWindowTitle
;
161 static UINT WM_AUTOLISTREADY
;
162 int m_nPopupPasteListCmd
;
163 int m_nPopupPasteLastMessage
;
164 int m_nPopupRecentMessage
;
165 CRegHistory m_History
;
167 CSplitterControl m_wndSplitter
;
169 CRect m_LogMsgOrigRect
;
170 CPathWatcher m_pathwatcher
;
171 CHyperLink m_ctrlShowPatch
;
172 CPatchViewDlg m_patchViewdlg
;
173 BOOL m_bSetCommitDateTime
;
174 CDateTimeCtrl m_CommitDate
;
175 CDateTimeCtrl m_CommitTime
;
177 CBugTraqAssociation m_bugtraq_association
;
181 afx_msg
void OnBnClickedSignOff();
182 afx_msg
void OnBnClickedCommitAmend();
183 afx_msg
void OnBnClickedWholeProject();
184 afx_msg
void OnScnUpdateUI(NMHDR
*pNMHDR
, LRESULT
*pResult
);
185 afx_msg
void OnStnClickedViewPatch();
186 afx_msg
void OnMoving(UINT fwSide
, LPRECT pRect
);
187 afx_msg
void OnSizing(UINT fwSide
, LPRECT pRect
);
188 afx_msg
void OnHdnItemchangedFilelist(NMHDR
*pNMHDR
, LRESULT
*pResult
);
189 afx_msg
void OnBnClickedCommitAmenddiff();
190 afx_msg
void OnBnClickedNoautoselectsubmodules();
191 afx_msg
void OnBnClickedCommitSetDateTime();