1 // TortoiseGit - a Windows shell extension for easy version control
3 // Copyright (C) 2008-2009 - 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.
24 #include "StandAloneDlg.h"
25 #include "HistoryCombo.h"
26 #include "MenuButton.h"
29 #include "BranchCombox.h"
30 #include "GitLoglist.h"
32 #define IDC_SYNC_TAB 0x1000000
34 #define IDC_CMD_LOG 0x1
35 #define IDC_IN_LOGLIST 0x2
36 #define IDC_IN_CHANGELIST 0x3
37 #define IDC_IN_CONFLICT 0x4
38 #define IDC_OUT_LOGLIST 0x5
39 #define IDC_OUT_CHANGELIST 0x6
41 class CSyncDlg
: public CResizableStandAloneDialog
,public CBranchCombox
43 DECLARE_DYNAMIC(CSyncDlg
)
46 CSyncDlg(CWnd
* pParent
= NULL
); // standard constructor
50 enum { IDD
= IDD_SYNC
};
52 enum { GIT_COMMAND_PUSH
,
55 GIT_COMMAND_FETCHANDREBASE
58 virtual void DoDataExchange(CDataExchange
* pDX
); // DDX/DDV support
59 BRANCH_COMBOX_EVENT_HANDLE();
63 CRegDWORD m_regPullButton
;
64 CRegDWORD m_regPushButton
;
65 CMFCTabCtrl m_ctrlTabCtrl
;
71 CGitLogList m_OutLogList
;
72 CGitLogList m_InLogList
;
74 CGitStatusListCtrl m_OutChangeFileList
;
75 CGitStatusListCtrl m_InChangeFileList
;
76 CGitStatusListCtrl m_ConflictFileList
;
78 CRichEditCtrl m_ctrlCmdOut
;
80 CTGitPathList m_arOutChangeList
;
81 CTGitPathList m_arInChangeList
;
83 int m_CmdOutCurrentPos
;
85 CWinThread
* m_pThread
;
87 void ParserCmdOutput(TCHAR ch
);
89 virtual void LocalBranchChange(){FetchOutList();};
90 virtual void RemoteBranchChange(){FetchOutList();};
91 void ShowTab(int windowid
)
93 this->m_ctrlTabCtrl
.ShowTab(windowid
-1);
94 this->m_ctrlTabCtrl
.SetActiveTab(windowid
-1);
97 void FetchOutList(bool force
=false);
101 void SetRemote(CString remote
)
103 if(!remote
.IsEmpty())
105 this->m_ctrlURL
.AddString(remote
);
109 std::vector
<CString
> m_GitCmdList
;
116 CString m_OutLocalBranch
;
117 CString m_OutRemoteBranch
;
121 void ShowProgressCtrl(bool bShow
=true);
122 void ShowInputCtrl(bool bShow
=true);
123 void SwitchToRun(){ShowProgressCtrl(true);ShowInputCtrl(false);EnableControlButton(false);}
124 void SwitchToInput(){ShowProgressCtrl(false);ShowInputCtrl(true);}
126 LRESULT
OnProgressUpdateUI(WPARAM wParam
,LPARAM lParam
);
130 this->m_strLocalBranch
= this->m_ctrlLocalBranch
.GetString();
131 this->m_ctrlRemoteBranch
.GetWindowText(this->m_strRemoteBranch
);
132 this->m_ctrlURL
.GetWindowText(this->m_strURL
);
133 m_strRemoteBranch
=m_strRemoteBranch
.Trim();
136 void AddDiffFileList(CGitStatusListCtrl
*pCtrlList
, CTGitPathList
*pGitList
,
137 CString
&rev1
,CString
&rev2
)
139 g_Git
.GetCommitDiffList(rev1
,rev2
,*pGitList
);
140 pCtrlList
->m_Rev1
=rev1
;
141 pCtrlList
->m_Rev2
=rev2
;
142 pCtrlList
->Show(0,*pGitList
);
143 pCtrlList
->SetEmptyString(CString(_T("No changed file")));
148 void FetchComplete();
150 DECLARE_MESSAGE_MAP()
152 BOOL m_bAutoLoadPuttyKey
;
156 static UINT
ProgressThreadEntry(LPVOID pVoid
){ return ((CSyncDlg
*)pVoid
) ->ProgressThread(); };
157 UINT
ProgressThread();
159 CHistoryCombo m_ctrlURL
;
160 CButton m_ctrlDumyButton
;
161 CMenuButton m_ctrlPull
;
162 CMenuButton m_ctrlPush
;
163 CMenuButton m_ctrlStatus
;
164 afx_msg
void OnBnClickedButtonPull();
165 afx_msg
void OnBnClickedButtonPush();
166 afx_msg
void OnBnClickedButtonApply();
167 afx_msg
void OnBnClickedButtonEmail();
168 CProgressCtrl m_ctrlProgress
;
169 CAnimateCtrl m_ctrlAnimate
;
170 virtual BOOL
OnInitDialog();
171 afx_msg
void OnBnClickedButtonManage();
172 virtual BOOL
PreTranslateMessage(MSG
* pMsg
);
173 afx_msg
void OnCbenEndeditComboboxexUrl(NMHDR
*pNMHDR
, LRESULT
*pResult
);
174 afx_msg
void OnCbnEditchangeComboboxexUrl();
176 void EnableControlButton(bool bEnabled
=true);
177 afx_msg
void OnBnClickedButtonCommit();