1 // TortoiseGit - a Windows shell extension for easy version control
3 // Copyright (C) 2008-2012 - 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
,
69 virtual void DoDataExchange(CDataExchange
* pDX
); // DDX/DDV support
70 virtual BOOL
OnInitDialog();
72 virtual LRESULT
DefWindowProc(UINT message
, WPARAM wParam
, LPARAM lParam
);
73 LRESULT
OnRebaseUpdateUI(WPARAM wParam
, LPARAM lParam
);
74 void DoSize(int delta
);
75 void AddRebaseAnchor();
78 void SetSplitterRange();
79 void SaveSplitterPos();
81 void LoadBranchInfo();
83 void SetAllRebaseAction(int action
);
87 CRect m_CommitListOrigRect
;
88 BOOL
PreTranslateMessage(MSG
* pMsg
);
89 bool LogListHasFocus(HWND hwnd
);
91 CSciEdit m_wndOutputRebase
;
92 void SetContinueButtonText();
93 void SetControlEnable();
94 void UpdateProgress();
95 void UpdateCurrentStatus();
96 void ListConflictFile();
98 afx_msg LRESULT
OnGitStatusListCtrlNeedsRefresh(WPARAM
, LPARAM
);
100 volatile LONG m_bThreadRunning
;
102 static UINT
RebaseThreadEntry(LPVOID pVoid
){return ((CRebaseDlg
*)pVoid
)->RebaseThread();};
105 BOOL m_IsFastForward
;
107 CGitHash m_OrigBranchHash
;
108 CGitHash m_OrigUpstreamHash
;
110 int VerifyNoConflict();
111 CString
GetRebaseModeName(int rebasemode
);
113 CString m_SquashMessage
;
115 int CheckNextCommitIsSquash();
116 int GetCurrentCommitID();
119 CMenuButton m_PostButton
;
121 afx_msg
void OnBnClickedPickAll();
122 afx_msg
void OnBnClickedSquashAll();
123 afx_msg
void OnBnClickedEditAll();
124 afx_msg
void OnBnClickedRebaseSplit();
125 afx_msg
void OnSize(UINT nType
, int cx
, int cy
);
126 afx_msg
void OnCbnSelchangeBranch();
127 afx_msg
void OnCbnSelchangeUpstream();
128 afx_msg
void OnBnClickedContinue();
129 afx_msg
void OnBnClickedAbort();
130 afx_msg
void OnLvnItemchangedLoglist(NMHDR
*pNMHDR
, LRESULT
*pResult
);
131 void FillLogMessageCtrl();
133 CProgressCtrl m_ProgressBar
;
134 CStatic m_CtrlStatusText
;
135 CToolTips m_tooltips
;
144 BOOL m_bAddCherryPickedFrom
;
147 CStringArray m_PostButtonTexts
;
148 CGitLogList m_CommitList
;
156 CSplitterControl m_wndSplitter
;
157 CMFCTabCtrl m_ctrlTabCtrl
;
158 CGitStatusListCtrl m_FileListCtrl
;
159 CSciEdit m_LogMessageCtrl
;
161 CHistoryCombo m_BranchCtrl
;
162 CHistoryCombo m_UpstreamCtrl
;
164 REBASE_STAGE m_RebaseStage
;
166 void AddBranchToolTips(CHistoryCombo
*pBranch
);
167 void AddLogString(CString str
);
169 int CheckRebaseCondition();
170 int m_CurrentRebaseIndex
;
173 afx_msg
void OnBnClickedButtonBrowse();
174 afx_msg
void OnBnClickedRebaseCheckForce();
175 afx_msg
void OnBnClickedCheckCherryPickedFrom();
176 afx_msg
void OnBnClickedRebasePostButton();
177 afx_msg
void OnBnClickedButtonUp2();
178 afx_msg
void OnBnClickedButtonDown2();
180 afx_msg LRESULT
OnTaskbarBtnCreated(WPARAM wParam
, LPARAM lParam
);
181 CComPtr
<ITaskbarList3
> m_pTaskbarList
;