1 // TortoiseGit - a Windows shell extension for easy version control
3 // Copyright (C) 2008-2014 - TortoiseGit
5 // This program is free software; you can redistribute it and/or
6 // modify it under the terms of the GNU General Public License
7 // as published by the Free Software Foundation; either version 2
8 // of the License, or (at your option) any later version.
10 // This program is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
15 // You should have received a copy of the GNU General Public License
16 // along with this program; if not, write to the Free Software Foundation,
17 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
23 #include "StandAloneDlg.h"
24 #include "GitStatusListCtrl.h"
26 #include "SplitterControl.h"
27 #include "HistoryCombo.h"
28 #include "GitLogList.h"
29 #include "MenuButton.h"
32 #include "ProjectProperties.h"
35 #define IDC_REBASE_TAB 0x1000000
37 #define REBASE_TAB_CONFLICT 0
38 #define REBASE_TAB_MESSAGE 1
39 #define REBASE_TAB_LOG 2
41 #define MSG_REBASE_UPDATE_UI (WM_USER+151)
43 class CRebaseDlg
: public CResizableStandAloneDialog
45 DECLARE_DYNAMIC(CRebaseDlg
)
48 CRebaseDlg(CWnd
* pParent
= NULL
); // standard constructor
49 virtual ~CRebaseDlg();
52 enum { IDD
= IDD_REBASE
};
57 CHOOSE_COMMIT_PICK_MODE
,
65 REBASE_SQUASH_CONFLICT
,
71 virtual void DoDataExchange(CDataExchange
* pDX
); // DDX/DDV support
72 virtual BOOL
OnInitDialog();
74 virtual LRESULT
DefWindowProc(UINT message
, WPARAM wParam
, LPARAM lParam
);
75 virtual HBRUSH
OnCtlColor(CDC
* pDC
, CWnd
* pWnd
, UINT nCtlColor
);
76 LRESULT
OnRebaseUpdateUI(WPARAM wParam
, LPARAM lParam
);
77 void DoSize(int delta
);
78 void AddRebaseAnchor();
81 void SetSplitterRange();
82 void SaveSplitterPos();
84 void LoadBranchInfo();
86 void SetAllRebaseAction(int action
);
90 CRect m_CommitListOrigRect
;
91 CString m_sStatusText
;
92 bool m_bStatusWarning
;
93 BOOL
PreTranslateMessage(MSG
* pMsg
);
94 bool LogListHasFocus(HWND hwnd
);
95 bool LogListHasMenuItem(int i
);
97 CSciEdit m_wndOutputRebase
;
98 void SetContinueButtonText();
99 void SetControlEnable();
100 void UpdateProgress();
101 void UpdateCurrentStatus();
102 void ListConflictFile();
104 afx_msg LRESULT
OnGitStatusListCtrlNeedsRefresh(WPARAM
, LPARAM
);
106 volatile LONG m_bThreadRunning
;
108 static UINT
RebaseThreadEntry(LPVOID pVoid
){return ((CRebaseDlg
*)pVoid
)->RebaseThread();};
111 int IsCommitEmpty(const CGitHash
& hash
);
113 BOOL m_IsFastForward
;
115 CGitHash m_OrigBranchHash
;
116 CGitHash m_OrigUpstreamHash
;
117 CString m_OrigHEADBranch
;
118 CGitHash m_OrigHEADHash
;
120 ProjectProperties m_ProjectProperties
;
122 int VerifyNoConflict();
123 CString
GetRebaseModeName(int rebasemode
);
125 CString m_SquashMessage
;
126 CString m_SquashFirstMetaData
;
128 int CheckNextCommitIsSquash();
129 int GetCurrentCommitID();
132 CMenuButton m_PostButton
;
134 afx_msg
void OnBnClickedPickAll();
135 afx_msg
void OnBnClickedSquashAll();
136 afx_msg
void OnBnClickedEditAll();
137 afx_msg
void OnBnClickedRebaseSplit();
138 afx_msg
void OnSize(UINT nType
, int cx
, int cy
);
139 afx_msg
void OnCbnSelchangeBranch();
140 afx_msg
void OnCbnSelchangeUpstream();
141 afx_msg
void OnBnClickedContinue();
142 afx_msg
void OnBnClickedAbort();
143 afx_msg
void OnLvnItemchangedLoglist(NMHDR
*pNMHDR
, LRESULT
*pResult
);
144 void FillLogMessageCtrl();
146 CProgressCtrl m_ProgressBar
;
147 CStatic m_CtrlStatusText
;
148 CToolTips m_tooltips
;
151 BOOL m_bAddCherryPickedFrom
;
152 BOOL m_bAutoSkipFailedCommit
;
155 CStringArray m_PostButtonTexts
;
156 CGitLogList m_CommitList
;
165 CSplitterControl m_wndSplitter
;
166 CMFCTabCtrl m_ctrlTabCtrl
;
167 CGitStatusListCtrl m_FileListCtrl
;
168 CSciEdit m_LogMessageCtrl
;
170 CHistoryCombo m_BranchCtrl
;
171 CHistoryCombo m_UpstreamCtrl
;
173 CMenuButton m_SplitAllOptions
;
177 REBASE_STAGE m_RebaseStage
;
178 bool m_bFinishedRebase
;
181 void AddBranchToolTips(CHistoryCombo
*pBranch
);
182 void AddLogString(CString str
);
184 int CheckRebaseCondition();
185 void CheckRestoreStash();
186 int m_CurrentRebaseIndex
;
189 void ResetParentForSquash(const CString
& commitMessage
);
190 afx_msg
void OnBnClickedButtonReverse();
191 afx_msg
void OnBnClickedButtonBrowse();
192 afx_msg
void OnBnClickedRebaseCheckForce();
193 afx_msg
void OnBnClickedCheckCherryPickedFrom();
194 afx_msg
void OnBnClickedRebasePostButton();
195 afx_msg
void OnBnClickedSplitAllOptions();
196 afx_msg
void OnBnClickedButtonUp2();
197 afx_msg
void OnBnClickedButtonDown2();
199 afx_msg LRESULT
OnTaskbarBtnCreated(WPARAM wParam
, LPARAM lParam
);
200 CComPtr
<ITaskbarList3
> m_pTaskbarList
;
202 afx_msg LRESULT
OnRebaseActionMessage(WPARAM wParam
, LPARAM lParam
);
203 afx_msg
void OnBnClickedRebaseSplitCommit();
204 afx_msg
void OnBnClickedButtonOnto();