Fixed issue #2356: Rebase dialog should also auto-link to issue tracker
[TortoiseGit.git] / src / TortoiseProc / RebaseDlg.h
blob402f82a66dfb23e1b9313a231fa5881b5032a333
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.
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"
32 #include "ProjectProperties.h"
34 // CRebaseDlg dialog
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)
47 public:
48 CRebaseDlg(CWnd* pParent = NULL); // standard constructor
49 virtual ~CRebaseDlg();
51 // Dialog Data
52 enum { IDD = IDD_REBASE };
54 enum REBASE_STAGE
56 CHOOSE_BRANCH,
57 CHOOSE_COMMIT_PICK_MODE,
58 REBASE_START,
59 REBASE_CONTINUE,
60 REBASE_ABORT,
61 REBASE_FINISH,
62 REBASE_CONFLICT,
63 REBASE_EDIT,
64 REBASE_SQUASH_EDIT,
65 REBASE_SQUASH_CONFLICT,
66 REBASE_DONE,
67 REBASE_ERROR,
70 protected:
71 virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
72 virtual BOOL OnInitDialog();
73 DECLARE_MESSAGE_MAP()
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();
79 void RemoveAnchor();
81 void SetSplitterRange();
82 void SaveSplitterPos();
84 void LoadBranchInfo();
85 void FetchLogList();
86 void SetAllRebaseAction(int action);
87 void OnCancel();
89 CRect m_DlgOrigRect;
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();
103 int DoRebase();
104 afx_msg LRESULT OnGitStatusListCtrlNeedsRefresh(WPARAM, LPARAM);
105 void Refresh();
106 volatile LONG m_bThreadRunning;
107 int RebaseThread();
108 static UINT RebaseThreadEntry(LPVOID pVoid){return ((CRebaseDlg *)pVoid)->RebaseThread();};
109 BOOL IsEnd();
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();
130 int FinishRebase();
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;
150 BOOL m_bForce;
151 BOOL m_bAddCherryPickedFrom;
152 BOOL m_bAutoSkipFailedCommit;
154 public:
155 CStringArray m_PostButtonTexts;
156 CGitLogList m_CommitList;
158 CString m_Upstream;
159 CString m_Branch;
161 BOOL m_IsCherryPick;
163 protected:
164 CSplitterControl m_wndSplitter;
165 CMFCTabCtrl m_ctrlTabCtrl;
166 CGitStatusListCtrl m_FileListCtrl;
167 CSciEdit m_LogMessageCtrl;
169 CHistoryCombo m_BranchCtrl;
170 CHistoryCombo m_UpstreamCtrl;
172 CMenuButton m_SplitAllOptions;
174 BOOL m_bSplitCommit;
176 REBASE_STAGE m_RebaseStage;
177 bool m_bFinishedRebase;
178 bool m_bStashed;
180 void AddBranchToolTips(CHistoryCombo *pBranch);
181 void AddLogString(CString str);
182 int StartRebase();
183 int CheckRebaseCondition();
184 void CheckRestoreStash();
185 int m_CurrentRebaseIndex;
186 int StateAction();
187 int GoNext();
188 void ResetParentForSquash(const CString& commitMessage);
189 afx_msg void OnBnClickedButtonReverse();
190 afx_msg void OnBnClickedButtonBrowse();
191 afx_msg void OnBnClickedRebaseCheckForce();
192 afx_msg void OnBnClickedCheckCherryPickedFrom();
193 afx_msg void OnBnClickedRebasePostButton();
194 afx_msg void OnBnClickedSplitAllOptions();
195 afx_msg void OnBnClickedButtonUp2();
196 afx_msg void OnBnClickedButtonDown2();
198 afx_msg LRESULT OnTaskbarBtnCreated(WPARAM wParam, LPARAM lParam);
199 CComPtr<ITaskbarList3> m_pTaskbarList;
201 afx_msg LRESULT OnRebaseActionMessage(WPARAM wParam, LPARAM lParam);
202 afx_msg void OnBnClickedRebaseSplitCommit();