1 // TortoiseGit - a Windows shell extension for easy version control
\r
3 // Copyright (C) 2008-2009 - TortoiseGit
\r
5 // This program is free software; you can redistribute it and/or
\r
6 // modify it under the terms of the GNU General Public License
\r
7 // as published by the Free Software Foundation; either version 2
\r
8 // of the License, or (at your option) any later version.
\r
10 // This program is distributed in the hope that it will be useful,
\r
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
\r
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
\r
13 // GNU General Public License for more details.
\r
15 // You should have received a copy of the GNU General Public License
\r
16 // along with this program; if not, write to the Free Software Foundation,
\r
17 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
\r
24 #include "StandAloneDlg.h"
\r
25 #include "HistoryCombo.h"
\r
26 #include "MenuButton.h"
\r
27 #include "registry.h"
\r
28 #include "Balloon.h"
\r
29 #include "BranchCombox.h"
\r
30 #include "GitLoglist.h"
\r
32 #define IDC_SYNC_TAB 0x1000000
\r
34 #define IDC_CMD_LOG 0x1
\r
35 #define IDC_IN_LOGLIST 0x2
\r
36 #define IDC_IN_CHANGELIST 0x3
\r
37 #define IDC_IN_CONFLICT 0x4
\r
38 #define IDC_OUT_LOGLIST 0x5
\r
39 #define IDC_OUT_CHANGELIST 0x6
\r
41 class CSyncDlg : public CResizableStandAloneDialog,public CBranchCombox
\r
43 DECLARE_DYNAMIC(CSyncDlg)
\r
46 CSyncDlg(CWnd* pParent = NULL); // standard constructor
\r
47 virtual ~CSyncDlg();
\r
50 enum { IDD = IDD_SYNC };
\r
52 enum { GIT_COMMAND_PUSH,
\r
55 GIT_COMMAND_FETCHANDREBASE
\r
58 virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
\r
59 BRANCH_COMBOX_EVENT_HANDLE();
\r
63 CRegDWORD m_regPullButton;
\r
64 CRegDWORD m_regPushButton;
\r
65 CMFCTabCtrl m_ctrlTabCtrl;
\r
67 CBalloon m_tooltips;
\r
71 CGitLogList m_OutLogList;
\r
72 CGitLogList m_InLogList;
\r
74 CGitStatusListCtrl m_OutChangeFileList;
\r
75 CGitStatusListCtrl m_InChangeFileList;
\r
76 CGitStatusListCtrl m_ConflictFileList;
\r
78 CRichEditCtrl m_ctrlCmdOut;
\r
80 CTGitPathList m_arOutChangeList;
\r
81 CTGitPathList m_arInChangeList;
\r
83 int m_CmdOutCurrentPos;
\r
85 CWinThread* m_pThread;
\r
87 void ParserCmdOutput(TCHAR ch);
\r
89 virtual void LocalBranchChange(){FetchOutList();};
\r
90 virtual void RemoteBranchChange(){FetchOutList();};
\r
91 void ShowTab(int windowid)
\r
93 this->m_ctrlTabCtrl.ShowTab(windowid-1);
\r
94 this->m_ctrlTabCtrl.SetActiveTab(windowid-1);
\r
97 void FetchOutList(bool force=false);
\r
101 void SetRemote(CString remote)
\r
103 if(!remote.IsEmpty())
\r
105 this->m_ctrlURL.AddString(remote);
\r
109 std::vector<CString> m_GitCmdList;
\r
113 int m_GitCmdStatus;
\r
116 CString m_OutLocalBranch;
\r
117 CString m_OutRemoteBranch;
\r
121 void ShowProgressCtrl(bool bShow=true);
\r
122 void ShowInputCtrl(bool bShow=true);
\r
123 void SwitchToRun(){ShowProgressCtrl(true);ShowInputCtrl(false);EnableControlButton(false);}
\r
124 void SwitchToInput(){ShowProgressCtrl(false);ShowInputCtrl(true);}
\r
126 LRESULT OnProgressUpdateUI(WPARAM wParam,LPARAM lParam);
\r
128 void UpdateCombox()
\r
130 this->m_strLocalBranch = this->m_ctrlLocalBranch.GetString();
\r
131 this->m_ctrlRemoteBranch.GetWindowText(this->m_strRemoteBranch);
\r
132 this->m_ctrlURL.GetWindowText(this->m_strURL);
\r
133 m_strRemoteBranch=m_strRemoteBranch.Trim();
\r
136 void AddDiffFileList(CGitStatusListCtrl *pCtrlList, CTGitPathList *pGitList,
\r
137 CString &rev1,CString &rev2)
\r
139 g_Git.GetCommitDiffList(rev1,rev2,*pGitList);
\r
140 pCtrlList->m_Rev1=rev1;
\r
141 pCtrlList->m_Rev2=rev2;
\r
142 pCtrlList->Show(0,*pGitList);
\r
143 pCtrlList->SetEmptyString(CString(_T("No changed file")));
\r
147 void PullComplete();
\r
148 void FetchComplete();
\r
150 DECLARE_MESSAGE_MAP()
\r
152 BOOL m_bAutoLoadPuttyKey;
\r
156 static UINT ProgressThreadEntry(LPVOID pVoid){ return ((CSyncDlg*)pVoid) ->ProgressThread(); };
\r
157 UINT ProgressThread();
\r
159 CHistoryCombo m_ctrlURL;
\r
160 CButton m_ctrlDumyButton;
\r
161 CMenuButton m_ctrlPull;
\r
162 CMenuButton m_ctrlPush;
\r
163 CMenuButton m_ctrlStatus;
\r
164 afx_msg void OnBnClickedButtonPull();
\r
165 afx_msg void OnBnClickedButtonPush();
\r
166 afx_msg void OnBnClickedButtonApply();
\r
167 afx_msg void OnBnClickedButtonEmail();
\r
168 CProgressCtrl m_ctrlProgress;
\r
169 CAnimateCtrl m_ctrlAnimate;
\r
170 virtual BOOL OnInitDialog();
\r
171 afx_msg void OnBnClickedButtonManage();
\r
172 virtual BOOL PreTranslateMessage(MSG* pMsg);
\r
173 afx_msg void OnCbenEndeditComboboxexUrl(NMHDR *pNMHDR, LRESULT *pResult);
\r
174 afx_msg void OnCbnEditchangeComboboxexUrl();
\r
176 void EnableControlButton(bool bEnabled=true);
\r
177 afx_msg void OnBnClickedButtonCommit();
\r
179 virtual void OnOK();
\r