OSDN Git Service

SyncDlg implement "apply patch" command.
[tortoisegit/TortoiseGitJp.git] / src / TortoiseProc / SyncDlg.h
1 // TortoiseGit - a Windows shell extension for easy version control\r
2 \r
3 // Copyright (C) 2008-2009 - TortoiseGit\r
4 \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
9 \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
14 \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
18 //\r
19 \r
20 #pragma once\r
21 #include "afxcmn.h"\r
22 #include "afxwin.h"\r
23 \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
31 // CSyncDlg dialog\r
32 #define IDC_SYNC_TAB 0x1000000\r
33 \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_OUT_LOGLIST         0x4\r
38 #define IDC_OUT_CHANGELIST      0x5\r
39 \r
40 class CSyncDlg : public CResizableStandAloneDialog,public CBranchCombox\r
41 {\r
42         DECLARE_DYNAMIC(CSyncDlg)\r
43 \r
44 public:\r
45         CSyncDlg(CWnd* pParent = NULL);   // standard constructor\r
46         virtual ~CSyncDlg();\r
47 \r
48 // Dialog Data\r
49         enum { IDD = IDD_SYNC };\r
50 \r
51         enum { GIT_COMMAND_PUSH,\r
52                    GIT_COMMAND_PULL,\r
53                 };\r
54 protected:\r
55         virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support\r
56         BRANCH_COMBOX_EVENT_HANDLE();\r
57 \r
58         int m_CurrentCmd;\r
59 \r
60         CRegDWORD m_regPullButton;\r
61         CRegDWORD m_regPushButton;\r
62         CMFCTabCtrl m_ctrlTabCtrl;\r
63 \r
64         CBalloon                        m_tooltips;\r
65         \r
66         BOOL            m_bInited;\r
67         \r
68         CGitLogList     m_OutLogList;\r
69         CGitLogList m_InLogList;\r
70 \r
71         CGitStatusListCtrl m_OutChangeFileList;\r
72         CGitStatusListCtrl m_InChangeFileList;\r
73         CGitStatusListCtrl m_ConflictFileList;\r
74         CRichEditCtrl      m_ctrlCmdOut;\r
75 \r
76         CTGitPathList   m_arOutChangeList;\r
77         CTGitPathList   m_arInChangeList;\r
78 \r
79         int                             m_CmdOutCurrentPos;\r
80 \r
81         CWinThread*                             m_pThread;      \r
82 \r
83         void            ParserCmdOutput(TCHAR ch);\r
84 \r
85         virtual void LocalBranchChange(){FetchOutList();};\r
86         virtual void RemoteBranchChange(){FetchOutList();};\r
87         void ShowTab(int windowid)\r
88         {\r
89                 this->m_ctrlTabCtrl.ShowTab(windowid-1);\r
90                 this->m_ctrlTabCtrl.SetActiveTab(windowid-1);\r
91         }\r
92 \r
93         void FetchOutList(bool force=false);\r
94 \r
95         bool IsURL();\r
96 \r
97         void SetRemote(CString remote)\r
98         {\r
99                 if(!remote.IsEmpty())\r
100                 {\r
101                         this->m_ctrlURL.AddString(remote);\r
102                 }\r
103         }\r
104 \r
105         std::vector<CString> m_GitCmdList;\r
106         \r
107         bool m_bAbort;\r
108 \r
109         int  m_GitCmdStatus;\r
110         \r
111         CString m_LogText;\r
112         CString m_OutLocalBranch;\r
113         CString m_OutRemoteBranch;\r
114         \r
115         void ShowProgressCtrl(bool bShow=true);\r
116         void ShowInputCtrl(bool bShow=true);\r
117         void SwitchToRun(){ShowProgressCtrl(true);ShowInputCtrl(false);EnableControlButton(false);}\r
118         void SwitchToInput(){ShowProgressCtrl(false);ShowInputCtrl(true);}\r
119         \r
120         LRESULT OnProgressUpdateUI(WPARAM wParam,LPARAM lParam);\r
121 \r
122         void AddDiffFileList(CGitStatusListCtrl *pCtrlList, CTGitPathList *pGitList,\r
123                                                         CString &rev1,CString &rev2)\r
124         {\r
125                 g_Git.GetCommitDiffList(rev1,rev2,*pGitList);\r
126                 pCtrlList->m_Rev1=rev1;\r
127                 pCtrlList->m_Rev2=rev2;\r
128                 pCtrlList->Show(0,*pGitList);\r
129                 pCtrlList->SetEmptyString(CString(_T("No changed file")));\r
130                 return;\r
131         }\r
132 \r
133         DECLARE_MESSAGE_MAP()\r
134 public:\r
135         BOOL m_bAutoLoadPuttyKey;\r
136         BOOL m_bForce;\r
137         CString m_strURL;\r
138 \r
139         static UINT ProgressThreadEntry(LPVOID pVoid){ return ((CSyncDlg*)pVoid) ->ProgressThread(); };\r
140         UINT            ProgressThread();\r
141         \r
142         CHistoryCombo m_ctrlURL;\r
143         CButton m_ctrlDumyButton;\r
144         CMenuButton m_ctrlPull;\r
145         CMenuButton m_ctrlPush;\r
146         CMenuButton m_ctrlStatus;\r
147         afx_msg void OnBnClickedButtonPull();\r
148         afx_msg void OnBnClickedButtonPush();\r
149         afx_msg void OnBnClickedButtonApply();\r
150         afx_msg void OnBnClickedButtonEmail();\r
151         CProgressCtrl m_ctrlProgress;\r
152         CAnimateCtrl m_ctrlAnimate;\r
153         virtual BOOL OnInitDialog();\r
154         afx_msg void OnBnClickedButtonManage();\r
155         virtual BOOL PreTranslateMessage(MSG* pMsg);\r
156         afx_msg void OnCbenEndeditComboboxexUrl(NMHDR *pNMHDR, LRESULT *pResult);\r
157         afx_msg void OnCbnEditchangeComboboxexUrl();\r
158 \r
159         void EnableControlButton(bool bEnabled=true);\r
160 };\r