OSDN Git Service

Add commit list and change list ctrl at SyncDlg
[tortoisegit/TortoiseGitJp.git] / src / TortoiseProc / SyncDlg.cpp
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 // SyncDlg.cpp : implementation file\r
21 //\r
22 \r
23 #include "stdafx.h"\r
24 #include "TortoiseProc.h"\r
25 #include "SyncDlg.h"\r
26 \r
27 \r
28 // CSyncDlg dialog\r
29 \r
30 IMPLEMENT_DYNAMIC(CSyncDlg, CResizableStandAloneDialog)\r
31 \r
32 CSyncDlg::CSyncDlg(CWnd* pParent /*=NULL*/)\r
33         : CResizableStandAloneDialog(CSyncDlg::IDD, pParent)\r
34         , m_bAutoLoadPuttyKey(FALSE)\r
35 {\r
36         m_pTooltip=&this->m_tooltips;\r
37 }\r
38 \r
39 CSyncDlg::~CSyncDlg()\r
40 {\r
41 }\r
42 \r
43 void CSyncDlg::DoDataExchange(CDataExchange* pDX)\r
44 {\r
45         CDialog::DoDataExchange(pDX);\r
46         DDX_Check(pDX, IDC_CHECK_PUTTY_KEY, m_bAutoLoadPuttyKey);\r
47         DDX_Control(pDX, IDC_COMBOBOXEX_URL, m_ctrlURL);\r
48         DDX_Control(pDX, IDC_BUTTON_TABCTRL, m_ctrlDumyButton);\r
49         DDX_Control(pDX, IDC_BUTTON_PULL, m_ctrlPull);\r
50         DDX_Control(pDX, IDC_BUTTON_PUSH, m_ctrlPush);\r
51         DDX_Control(pDX, IDC_STATIC_STATUS, m_ctrlStatus);\r
52         DDX_Control(pDX, IDC_PROGRESS_SYNC, m_ctrlProgress);\r
53         DDX_Control(pDX, IDC_ANIMATE_SYNC, m_ctrlAnimate);\r
54 \r
55         BRANCH_COMBOX_DDX;\r
56 }\r
57 \r
58 \r
59 BEGIN_MESSAGE_MAP(CSyncDlg, CResizableStandAloneDialog)\r
60         ON_BN_CLICKED(IDC_BUTTON_PULL, &CSyncDlg::OnBnClickedButtonPull)\r
61         ON_BN_CLICKED(IDC_BUTTON_PUSH, &CSyncDlg::OnBnClickedButtonPush)\r
62         ON_BN_CLICKED(IDC_BUTTON_APPLY, &CSyncDlg::OnBnClickedButtonApply)\r
63         ON_BN_CLICKED(IDC_BUTTON_EMAIL, &CSyncDlg::OnBnClickedButtonEmail)\r
64         ON_BN_CLICKED(IDC_BUTTON_MANAGE, &CSyncDlg::OnBnClickedButtonManage)\r
65         BRANCH_COMBOX_EVENT\r
66 END_MESSAGE_MAP()\r
67 \r
68 \r
69 // CSyncDlg message handlers\r
70 \r
71 void CSyncDlg::OnBnClickedButtonPull()\r
72 {\r
73         // TODO: Add your control notification handler code here\r
74         this->m_regPullButton =this->m_ctrlPull.GetCurrentEntry();\r
75 }\r
76 \r
77 void CSyncDlg::OnBnClickedButtonPush()\r
78 {\r
79         // TODO: Add your control notification handler code here\r
80         this->m_regPushButton=this->m_ctrlPush.GetCurrentEntry();\r
81 \r
82 }\r
83 \r
84 void CSyncDlg::OnBnClickedButtonApply()\r
85 {\r
86         // TODO: Add your control notification handler code here\r
87 }\r
88 \r
89 void CSyncDlg::OnBnClickedButtonEmail()\r
90 {\r
91         // TODO: Add your control notification handler code here\r
92 }\r
93 \r
94 BOOL CSyncDlg::OnInitDialog()\r
95 {\r
96         CResizableStandAloneDialog::OnInitDialog();\r
97 \r
98         //Create Tabctrl\r
99         CWnd *pwnd=this->GetDlgItem(IDC_BUTTON_TABCTRL);\r
100         CRect rectDummy;\r
101         pwnd->GetWindowRect(&rectDummy);\r
102         this->ScreenToClient(rectDummy);\r
103 \r
104         if (!m_ctrlTabCtrl.Create(CMFCTabCtrl::STYLE_FLAT, rectDummy, this, IDC_SYNC_TAB))\r
105         {\r
106                 TRACE0("Failed to create output tab window\n");\r
107                 return FALSE;      // fail to create\r
108         }\r
109         m_ctrlTabCtrl.SetResizeMode(CMFCTabCtrl::RESIZE_NO);\r
110 \r
111         DWORD dwStyle =LVS_REPORT | LVS_SHOWSELALWAYS | LVS_ALIGNLEFT | LVS_OWNERDATA | WS_BORDER | WS_TABSTOP;\r
112 \r
113         if( !m_OutLogList.Create(dwStyle,rectDummy,&m_ctrlTabCtrl,IDC_OUT_LOGLIST))\r
114         {\r
115                 TRACE0("Failed to create output commits window\n");\r
116                 return FALSE;      // fail to create\r
117 \r
118         }\r
119         m_ctrlTabCtrl.InsertTab(&m_OutLogList,_T("Out Commits"),0);\r
120 \r
121         m_OutLogList.InsertGitColumn();\r
122 \r
123         dwStyle = LVS_REPORT | LVS_SHOWSELALWAYS | LVS_ALIGNLEFT | WS_BORDER | WS_TABSTOP |LVS_SINGLESEL |WS_CHILD | WS_VISIBLE;\r
124         \r
125         if( !m_OutChangeFileList.Create(dwStyle,rectDummy,&m_ctrlTabCtrl,IDC_OUT_CHANGELIST))\r
126         {\r
127                 TRACE0("Failed to create output change files window\n");\r
128                 return FALSE;      // fail to create\r
129         }\r
130         m_ctrlTabCtrl.InsertTab(&m_OutChangeFileList,_T("Out ChangeList"),1);\r
131 \r
132         m_OutChangeFileList.Init(SVNSLC_COLEXT | SVNSLC_COLSTATUS |SVNSLC_COLADD|SVNSLC_COLDEL , _T("RebaseDlg"),(SVNSLC_POPALL ^ SVNSLC_POPCOMMIT),false);\r
133 \r
134         this->m_tooltips.Create(this);\r
135 \r
136         AddAnchor(IDC_SYNC_TAB,TOP_LEFT,BOTTOM_RIGHT);\r
137 \r
138         AddAnchor(IDC_GROUP_INFO,TOP_LEFT,TOP_RIGHT);\r
139         AddAnchor(IDC_COMBOBOXEX_URL,TOP_LEFT,TOP_RIGHT);\r
140         AddAnchor(IDC_BUTTON_MANAGE,TOP_RIGHT);\r
141         AddAnchor(IDC_BUTTON_PULL,BOTTOM_LEFT);\r
142         AddAnchor(IDC_BUTTON_PUSH,BOTTOM_LEFT);\r
143         AddAnchor(IDC_BUTTON_APPLY,BOTTOM_LEFT);\r
144         AddAnchor(IDC_BUTTON_EMAIL,BOTTOM_LEFT);\r
145         AddAnchor(IDC_PROGRESS_SYNC,BOTTOM_LEFT,BOTTOM_RIGHT);\r
146         AddAnchor(IDOK,BOTTOM_RIGHT);\r
147         AddAnchor(IDHELP,BOTTOM_RIGHT);\r
148         AddAnchor(IDC_STATIC_STATUS,BOTTOM_LEFT);\r
149         AddAnchor(IDC_ANIMATE_SYNC,TOP_RIGHT);\r
150         \r
151         BRANCH_COMBOX_ADD_ANCHOR();\r
152 \r
153         CString WorkingDir=g_Git.m_CurrentDir;\r
154         WorkingDir.Replace(_T(':'),_T('_'));\r
155         m_RegKeyRemoteBranch = CString(_T("Software\\TortoiseGit\\History\\SyncBranch\\"))+WorkingDir;\r
156 \r
157 \r
158         this->AddOthersToAnchor();\r
159         // TODO:  Add extra initialization here\r
160 \r
161         this->m_ctrlPush.AddEntry(CString(_T("Push")));\r
162         this->m_ctrlPush.AddEntry(CString(_T("Push tags")));\r
163         this->m_ctrlPush.AddEntry(CString(_T("Push All")));\r
164 \r
165         this->m_ctrlPull.AddEntry(CString(_T("&Pull")));\r
166         this->m_ctrlPull.AddEntry(CString(_T("&Fetch")));\r
167         this->m_ctrlPull.AddEntry(CString(_T("Fetch&&Rebase")));\r
168 \r
169         \r
170         WorkingDir.Replace(_T(':'),_T('_'));\r
171 \r
172         CString regkey ;\r
173         regkey.Format(_T("Software\\TortoiseGit\\TortoiseProc\\Sync\\%s"),WorkingDir);\r
174 \r
175         this->m_regPullButton = CRegDWORD(regkey+_T("\\Pull"),0);\r
176         this->m_regPushButton = CRegDWORD(regkey+_T("\\Push"),0);\r
177 \r
178         this->m_ctrlPull.SetCurrentEntry(this->m_regPullButton);\r
179         this->m_ctrlPush.SetCurrentEntry(this->m_regPushButton);\r
180 \r
181         CString str;\r
182         this->GetWindowText(str);\r
183         str += _T(" - ") + g_Git.m_CurrentDir;\r
184         this->SetWindowText(str);\r
185 \r
186         EnableSaveRestore(_T("SyncDlg"));\r
187 \r
188         this->LoadBranchInfo();\r
189 \r
190         \r
191         return TRUE;  // return TRUE unless you set the focus to a control\r
192         // EXCEPTION: OCX Property Pages should return FALSE\r
193 }\r
194 \r
195 void CSyncDlg::OnBnClickedButtonManage()\r
196 {\r
197         // TODO: Add your control notification handler code here\r
198         CAppUtils::LaunchRemoteSetting();\r
199 }\r
200 \r
201 BOOL CSyncDlg::PreTranslateMessage(MSG* pMsg)\r
202 {\r
203         // TODO: Add your specialized code here and/or call the base class\r
204         m_tooltips.RelayEvent(pMsg);\r
205         return __super::PreTranslateMessage(pMsg);\r
206 }\r
207 void CSyncDlg::FetchOutList()\r
208 {\r
209         \r
210 }\r