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 enum { IDD
= IDD_COMMITDLG
};
79 virtual void DoDataExchange(CDataExchange
* pDX
); // DDX/DDV support
81 virtual BOOL
OnInitDialog();
83 virtual void OnCancel();
84 virtual BOOL
PreTranslateMessage(MSG
* pMsg
);
85 virtual LRESULT
DefWindowProc(UINT message
, WPARAM wParam
, LPARAM lParam
);
86 afx_msg
void OnBnClickedSelectall();
87 afx_msg
void OnBnClickedHelp();
88 afx_msg
void OnBnClickedShowunversioned();
89 afx_msg
void OnBnClickedHistory();
90 afx_msg
void OnBnClickedBugtraqbutton();
91 afx_msg
void OnEnChangeLogmessage();
92 afx_msg
void OnStnClickedExternalwarning();
93 afx_msg
void OnFocusMessage();
94 afx_msg LRESULT
OnGitStatusListCtrlItemCountChanged(WPARAM
, LPARAM
);
95 afx_msg LRESULT
OnGitStatusListCtrlNeedsRefresh(WPARAM
, LPARAM
);
96 afx_msg LRESULT
OnGitStatusListCtrlCheckChanged(WPARAM
, LPARAM
);
97 afx_msg LRESULT
OnGitStatusListCtrlItemChanged(WPARAM
, LPARAM
);
99 afx_msg LRESULT
OnAutoListReady(WPARAM
, LPARAM
);
100 afx_msg LRESULT
OnFileDropped(WPARAM
, LPARAM lParam
);
101 afx_msg
void OnTimer(UINT_PTR nIDEvent
);
102 afx_msg
void OnSize(UINT nType
, int cx
, int cy
);
104 void GetAutocompletionList();
105 void ScanFile(const CString
& sFilePath
, const CString
& sRegex
);
106 void DoSize(int delta
);
107 void SetSplitterRange();
108 void SaveSplitterPos();
109 void ParseRegexFile(const CString
& sFile
, std::map
<CString
, CString
>& mapRegex
);
111 DECLARE_MESSAGE_MAP()
114 CString m_sLogMessage
;
115 BOOL m_bKeepChangeList
;
116 BOOL m_bDoNotAutoselectSubmodules
;
118 BOOL m_bNoPostActions
;
119 bool m_bSelectFilesForCommit
;
123 BOOL m_bWholeProject
;
124 CTGitPathList m_pathList
;
125 CTGitPathList m_checkedPathList
;
126 CTGitPathList m_updatedPathList
;
128 BOOL m_bPushAfterCommit
;
129 BOOL m_bAmendDiffToLastCommit
;
132 CTGitPathList m_selectedPathList
;
134 CSciEdit m_cLogMessage
;
135 CString m_sChangeList
;
136 INT_PTR m_itemsCount
;
137 CComPtr
<IBugTraqProvider
> m_BugTraqProvider
;
138 CString m_NoAmendStr
;
140 int CheckHeadDetach();
143 CWinThread
* m_pThread
;
144 std::set
<CString
> m_autolist
;
145 CGitStatusListCtrl m_ListCtrl
;
146 BOOL m_bShowUnversioned
;
147 volatile LONG m_bBlock
;
148 volatile LONG m_bThreadRunning
;
149 volatile LONG m_bRunThread
;
150 CToolTips m_tooltips
;
151 CRegDWORD m_regAddBeforeCommit
;
152 CRegDWORD m_regKeepChangelists
;
153 CRegDWORD m_regDoNotAutoselectSubmodules
;
154 ProjectProperties m_ProjectProperties
;
156 CString m_sWindowTitle
;
157 static UINT WM_AUTOLISTREADY
;
158 int m_nPopupPasteListCmd
;
159 int m_nPopupPasteLastMessage
;
160 int m_nPopupRecentMessage
;
161 CRegHistory m_History
;
163 CSplitterControl m_wndSplitter
;
165 CRect m_LogMsgOrigRect
;
166 CPathWatcher m_pathwatcher
;
167 CHyperLink m_ctrlShowPatch
;
168 CPatchViewDlg m_patchViewdlg
;
170 CBugTraqAssociation m_bugtraq_association
;
174 afx_msg
void OnBnClickedSignOff();
175 afx_msg
void OnBnClickedCommitAmend();
176 afx_msg
void OnBnClickedWholeProject();
177 afx_msg
void OnScnUpdateUI(NMHDR
*pNMHDR
, LRESULT
*pResult
);
178 afx_msg
void OnStnClickedViewPatch();
179 afx_msg
void OnMoving(UINT fwSide
, LPRECT pRect
);
180 afx_msg
void OnSizing(UINT fwSide
, LPRECT pRect
);
181 afx_msg
void OnHdnItemchangedFilelist(NMHDR
*pNMHDR
, LRESULT
*pResult
);
182 afx_msg
void OnBnClickedCommitAmenddiff();
183 afx_msg
void OnBnClickedNoautoselectsubmodules();