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"
34 #define IDC_REBASE_TAB 0x1000000
36 #define REBASE_TAB_CONFLICT 0
37 #define REBASE_TAB_MESSAGE 1
38 #define REBASE_TAB_LOG 2
40 #define MSG_REBASE_UPDATE_UI (WM_USER+151)
42 class CRebaseDlg
: public CResizableStandAloneDialog
44 DECLARE_DYNAMIC(CRebaseDlg
)
47 CRebaseDlg(CWnd
* pParent
= NULL
); // standard constructor
48 virtual ~CRebaseDlg();
51 enum { IDD
= IDD_REBASE
};
56 CHOOSE_COMMIT_PICK_MODE
,
64 REBASE_SQUASH_CONFLICT
,
70 virtual void DoDataExchange(CDataExchange
* pDX
); // DDX/DDV support
71 virtual BOOL
OnInitDialog();
73 virtual LRESULT
DefWindowProc(UINT message
, WPARAM wParam
, LPARAM lParam
);
74 virtual HBRUSH
OnCtlColor(CDC
* pDC
, CWnd
* pWnd
, UINT nCtlColor
);
75 LRESULT
OnRebaseUpdateUI(WPARAM wParam
, LPARAM lParam
);
76 void DoSize(int delta
);
77 void AddRebaseAnchor();
80 void SetSplitterRange();
81 void SaveSplitterPos();
83 void LoadBranchInfo();
85 void SetAllRebaseAction(int action
);
89 CRect m_CommitListOrigRect
;
90 CString m_sStatusText
;
91 bool m_bStatusWarning
;
92 BOOL
PreTranslateMessage(MSG
* pMsg
);
93 bool LogListHasFocus(HWND hwnd
);
94 bool LogListHasMenuItem(int i
);
96 CSciEdit m_wndOutputRebase
;
97 void SetContinueButtonText();
98 void SetControlEnable();
99 void UpdateProgress();
100 void UpdateCurrentStatus();
101 void ListConflictFile();
103 afx_msg LRESULT
OnGitStatusListCtrlNeedsRefresh(WPARAM
, LPARAM
);
105 volatile LONG m_bThreadRunning
;
107 static UINT
RebaseThreadEntry(LPVOID pVoid
){return ((CRebaseDlg
*)pVoid
)->RebaseThread();};
110 BOOL m_IsFastForward
;
112 CGitHash m_OrigBranchHash
;
113 CGitHash m_OrigUpstreamHash
;
114 CString m_OrigHEADBranch
;
115 CGitHash m_OrigHEADHash
;
117 int VerifyNoConflict();
118 CString
GetRebaseModeName(int rebasemode
);
120 CString m_SquashMessage
;
121 CString m_SquashFirstMetaData
;
123 int CheckNextCommitIsSquash();
124 int GetCurrentCommitID();
127 CMenuButton m_PostButton
;
129 afx_msg
void OnBnClickedPickAll();
130 afx_msg
void OnBnClickedSquashAll();
131 afx_msg
void OnBnClickedEditAll();
132 afx_msg
void OnBnClickedRebaseSplit();
133 afx_msg
void OnSize(UINT nType
, int cx
, int cy
);
134 afx_msg
void OnCbnSelchangeBranch();
135 afx_msg
void OnCbnSelchangeUpstream();
136 afx_msg
void OnBnClickedContinue();
137 afx_msg
void OnBnClickedAbort();
138 afx_msg
void OnLvnItemchangedLoglist(NMHDR
*pNMHDR
, LRESULT
*pResult
);
139 void FillLogMessageCtrl();
141 CProgressCtrl m_ProgressBar
;
142 CStatic m_CtrlStatusText
;
143 CToolTips m_tooltips
;
146 BOOL m_bAddCherryPickedFrom
;
147 BOOL m_bAutoSkipFailedCommit
;
150 CStringArray m_PostButtonTexts
;
151 CGitLogList m_CommitList
;
159 CSplitterControl m_wndSplitter
;
160 CMFCTabCtrl m_ctrlTabCtrl
;
161 CGitStatusListCtrl m_FileListCtrl
;
162 CSciEdit m_LogMessageCtrl
;
164 CHistoryCombo m_BranchCtrl
;
165 CHistoryCombo m_UpstreamCtrl
;
167 CMenuButton m_SplitAllOptions
;
169 REBASE_STAGE m_RebaseStage
;
170 bool m_bFinishedRebase
;
173 void AddBranchToolTips(CHistoryCombo
*pBranch
);
174 void AddLogString(CString str
);
176 int CheckRebaseCondition();
177 void CheckRestoreStash();
178 int m_CurrentRebaseIndex
;
181 void ResetParentForSquash(const CString
& commitMessage
);
182 afx_msg
void OnBnClickedButtonReverse();
183 afx_msg
void OnBnClickedButtonBrowse();
184 afx_msg
void OnBnClickedRebaseCheckForce();
185 afx_msg
void OnBnClickedCheckCherryPickedFrom();
186 afx_msg
void OnBnClickedRebasePostButton();
187 afx_msg
void OnBnClickedSplitAllOptions();
188 afx_msg
void OnBnClickedButtonUp2();
189 afx_msg
void OnBnClickedButtonDown2();
191 afx_msg LRESULT
OnTaskbarBtnCreated(WPARAM wParam
, LPARAM lParam
);
192 CComPtr
<ITaskbarList3
> m_pTaskbarList
;
194 afx_msg LRESULT
OnRebaseActionMessage(WPARAM wParam
, LPARAM lParam
);