82f174195bab6f0dfa413f8087f8795ddb303f1d
[TortoiseGit.git] / src / TortoiseProc / RebaseDlg.h
blob82f174195bab6f0dfa413f8087f8795ddb303f1d
1 // TortoiseGit - a Windows shell extension for easy version control
3 // Copyright (C) 2008-2013 - 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.
20 #pragma once
21 #include "afxcmn.h"
22 #include "afxwin.h"
23 #include "StandAloneDlg.h"
24 #include "GitStatusListCtrl.h"
25 #include "SciEdit.h"
26 #include "SplitterControl.h"
27 #include "HistoryCombo.h"
28 #include "GitLogList.h"
29 #include "MenuButton.h"
30 #include "Win7.h"
31 #include "Tooltip.h"
33 // CRebaseDlg dialog
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)
46 public:
47 CRebaseDlg(CWnd* pParent = NULL); // standard constructor
48 virtual ~CRebaseDlg();
50 // Dialog Data
51 enum { IDD = IDD_REBASE };
53 enum REBASE_STAGE
55 CHOOSE_BRANCH,
56 CHOOSE_COMMIT_PICK_MODE,
57 REBASE_START,
58 REBASE_CONTINUE,
59 REBASE_ABORT,
60 REBASE_FINISH,
61 REBASE_CONFLICT,
62 REBASE_EDIT,
63 REBASE_SQUASH_EDIT,
64 REBASE_SQUASH_CONFLICT,
65 REBASE_DONE,
66 REBASE_ERROR,
69 protected:
70 virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
71 virtual BOOL OnInitDialog();
72 DECLARE_MESSAGE_MAP()
73 virtual LRESULT DefWindowProc(UINT message, WPARAM wParam, LPARAM lParam);
74 LRESULT OnRebaseUpdateUI(WPARAM wParam, LPARAM lParam);
75 void DoSize(int delta);
76 void AddRebaseAnchor();
77 void RemoveAnchor();
79 void SetSplitterRange();
80 void SaveSplitterPos();
82 void LoadBranchInfo();
83 void FetchLogList();
84 void SetAllRebaseAction(int action);
85 void OnCancel();
87 CRect m_DlgOrigRect;
88 CRect m_CommitListOrigRect;
89 BOOL PreTranslateMessage(MSG* pMsg);
90 bool LogListHasFocus(HWND hwnd);
92 CSciEdit m_wndOutputRebase;
93 void SetContinueButtonText();
94 void SetControlEnable();
95 void UpdateProgress();
96 void UpdateCurrentStatus();
97 void ListConflictFile();
98 int DoRebase();
99 afx_msg LRESULT OnGitStatusListCtrlNeedsRefresh(WPARAM, LPARAM);
100 void Refresh();
101 volatile LONG m_bThreadRunning;
102 int RebaseThread();
103 static UINT RebaseThreadEntry(LPVOID pVoid){return ((CRebaseDlg *)pVoid)->RebaseThread();};
104 BOOL IsEnd();
106 BOOL m_IsFastForward;
108 CGitHash m_OrigBranchHash;
109 CGitHash m_OrigUpstreamHash;
111 int VerifyNoConflict();
112 CString GetRebaseModeName(int rebasemode);
114 CString m_SquashMessage;
116 int CheckNextCommitIsSquash();
117 int GetCurrentCommitID();
118 int FinishRebase();
120 CMenuButton m_PostButton;
122 afx_msg void OnBnClickedPickAll();
123 afx_msg void OnBnClickedSquashAll();
124 afx_msg void OnBnClickedEditAll();
125 afx_msg void OnBnClickedRebaseSplit();
126 afx_msg void OnSize(UINT nType, int cx, int cy);
127 afx_msg void OnCbnSelchangeBranch();
128 afx_msg void OnCbnSelchangeUpstream();
129 afx_msg void OnBnClickedContinue();
130 afx_msg void OnBnClickedAbort();
131 afx_msg void OnLvnItemchangedLoglist(NMHDR *pNMHDR, LRESULT *pResult);
132 void FillLogMessageCtrl();
134 CProgressCtrl m_ProgressBar;
135 CStatic m_CtrlStatusText;
136 CToolTips m_tooltips;
138 CString m_PreCmd;
140 BOOL m_bPickAll;
141 BOOL m_bSquashAll;
142 BOOL m_bEditAll;
144 BOOL m_bForce;
145 BOOL m_bAddCherryPickedFrom;
147 public:
148 CStringArray m_PostButtonTexts;
149 CGitLogList m_CommitList;
151 CString m_Upstream;
152 CString m_Branch;
154 BOOL m_IsCherryPick;
156 protected:
157 CSplitterControl m_wndSplitter;
158 CMFCTabCtrl m_ctrlTabCtrl;
159 CGitStatusListCtrl m_FileListCtrl;
160 CSciEdit m_LogMessageCtrl;
162 CHistoryCombo m_BranchCtrl;
163 CHistoryCombo m_UpstreamCtrl;
165 REBASE_STAGE m_RebaseStage;
167 void AddBranchToolTips(CHistoryCombo *pBranch);
168 void AddLogString(CString str);
169 int StartRebase();
170 int CheckRebaseCondition();
171 int m_CurrentRebaseIndex;
172 int StateAction();
173 int GoNext();
174 afx_msg void OnBnClickedButtonBrowse();
175 afx_msg void OnBnClickedRebaseCheckForce();
176 afx_msg void OnBnClickedCheckCherryPickedFrom();
177 afx_msg void OnBnClickedRebasePostButton();
178 afx_msg void OnBnClickedButtonUp2();
179 afx_msg void OnBnClickedButtonDown2();
181 afx_msg LRESULT OnTaskbarBtnCreated(WPARAM wParam, LPARAM lParam);
182 CComPtr<ITaskbarList3> m_pTaskbarList;