Fixed issue #1250: Sync Dialog should reload remote combo box after clicking "Manage"
[TortoiseGit.git] / src / TortoiseProc / SyncDlg.cpp
bloba2e1b675ccd4ff97b762ced0327daf05d6792e94
1 // TortoiseGit - a Windows shell extension for easy version control
3 // Copyright (C) 2008-2012 - 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 // SyncDlg.cpp : implementation file
23 #include "stdafx.h"
24 #include "TortoiseProc.h"
25 #include "SyncDlg.h"
26 #include "AppUtils.h"
27 #include "progressdlg.h"
28 #include "MessageBox.h"
29 #include "ImportPatchDlg.h"
30 #include "RebaseDlg.h"
31 #include "hooks.h"
32 #include "SmartHandle.h"
34 // CSyncDlg dialog
36 IMPLEMENT_DYNAMIC(CSyncDlg, CResizableStandAloneDialog)
38 CSyncDlg::CSyncDlg(CWnd* pParent /*=NULL*/)
39 : CResizableStandAloneDialog(CSyncDlg::IDD, pParent)
41 m_pTooltip=&this->m_tooltips;
42 m_bInited=false;
43 m_CmdOutCurrentPos=0;
44 m_bAutoLoadPuttyKey = CAppUtils::IsSSHPutty();
45 m_bForce=false;
46 m_bBlock = false;
49 CSyncDlg::~CSyncDlg()
53 void CSyncDlg::DoDataExchange(CDataExchange* pDX)
55 CDialog::DoDataExchange(pDX);
56 DDX_Check(pDX, IDC_CHECK_PUTTY_KEY, m_bAutoLoadPuttyKey);
57 DDX_Check(pDX, IDC_CHECK_FORCE,m_bForce);
58 DDX_Control(pDX, IDC_COMBOBOXEX_URL, m_ctrlURL);
59 DDX_Control(pDX, IDC_BUTTON_TABCTRL, m_ctrlDumyButton);
60 DDX_Control(pDX, IDC_BUTTON_PULL, m_ctrlPull);
61 DDX_Control(pDX, IDC_BUTTON_PUSH, m_ctrlPush);
62 DDX_Control(pDX, IDC_STATIC_STATUS, m_ctrlStatus);
63 DDX_Control(pDX, IDC_PROGRESS_SYNC, m_ctrlProgress);
64 DDX_Control(pDX, IDC_ANIMATE_SYNC, m_ctrlAnimate);
65 DDX_Control(pDX, IDC_BUTTON_SUBMODULE,m_ctrlSubmodule);
66 BRANCH_COMBOX_DDX;
70 BEGIN_MESSAGE_MAP(CSyncDlg, CResizableStandAloneDialog)
71 ON_BN_CLICKED(IDC_BUTTON_PULL, &CSyncDlg::OnBnClickedButtonPull)
72 ON_BN_CLICKED(IDC_BUTTON_PUSH, &CSyncDlg::OnBnClickedButtonPush)
73 ON_BN_CLICKED(IDC_BUTTON_APPLY, &CSyncDlg::OnBnClickedButtonApply)
74 ON_BN_CLICKED(IDC_BUTTON_EMAIL, &CSyncDlg::OnBnClickedButtonEmail)
75 ON_BN_CLICKED(IDC_BUTTON_MANAGE, &CSyncDlg::OnBnClickedButtonManage)
76 BRANCH_COMBOX_EVENT
77 ON_CBN_EDITCHANGE(IDC_COMBOBOXEX_URL, &CSyncDlg::OnCbnEditchangeComboboxex)
78 ON_CBN_EDITCHANGE(IDC_COMBOBOXEX_REMOTE_BRANCH, &CSyncDlg::OnCbnEditchangeComboboxex)
79 ON_MESSAGE(MSG_PROGRESSDLG_UPDATE_UI, OnProgressUpdateUI)
80 ON_NOTIFY(LVN_COLUMNCLICK, IDC_IN_LOGLIST, OnLvnInLogListColumnClick)
81 ON_BN_CLICKED(IDC_BUTTON_COMMIT, &CSyncDlg::OnBnClickedButtonCommit)
82 ON_BN_CLICKED(IDC_BUTTON_SUBMODULE, &CSyncDlg::OnBnClickedButtonSubmodule)
83 ON_WM_TIMER()
84 ON_REGISTERED_MESSAGE(WM_TASKBARBTNCREATED, OnTaskbarBtnCreated)
85 END_MESSAGE_MAP()
88 void CSyncDlg::EnableControlButton(bool bEnabled)
90 GetDlgItem(IDC_BUTTON_PULL)->EnableWindow(bEnabled);
91 GetDlgItem(IDC_BUTTON_PUSH)->EnableWindow(bEnabled);
92 GetDlgItem(IDC_BUTTON_APPLY)->EnableWindow(bEnabled);
93 GetDlgItem(IDC_BUTTON_EMAIL)->EnableWindow(bEnabled);
94 GetDlgItem(IDOK)->EnableWindow(bEnabled);
95 GetDlgItem(IDC_BUTTON_SUBMODULE)->EnableWindow(bEnabled);
97 // CSyncDlg message handlers
99 void CSyncDlg::OnBnClickedButtonPull()
101 int CurrentEntry;
102 CurrentEntry = this->m_ctrlPull.GetCurrentEntry();
103 this->m_regPullButton = CurrentEntry;
105 this->m_bAbort=false;
106 this->m_GitCmdList.clear();
108 this->UpdateData();
109 UpdateCombox();
111 m_oldHash = g_Git.GetHash(_T("HEAD"));
113 if( CurrentEntry == 0)
115 if( g_Git.GetHash(this->m_strLocalBranch) != m_oldHash)
117 CMessageBox::Show(NULL, IDS_PROC_SYNC_PULLWRONGBRANCH, IDS_APPNAME, MB_OK | MB_ICONERROR);
118 return;
122 if(this->m_strURL.IsEmpty())
124 CMessageBox::Show(NULL, IDS_PROC_GITCONFIG_URLEMPTY, IDS_APPNAME, MB_OK | MB_ICONERROR);
125 return;
128 if(this->m_bAutoLoadPuttyKey)
130 CAppUtils::LaunchPAgent(NULL,&this->m_strURL);
133 this->SwitchToRun();
135 CString force;
136 if(this->m_bForce)
137 force = _T(" --force ");
139 CString cmd;
141 ShowTab(IDC_CMD_LOG);
143 this->m_ctrlTabCtrl.ShowTab(IDC_IN_LOGLIST-1,false);
144 this->m_ctrlTabCtrl.ShowTab(IDC_IN_CHANGELIST-1,false);
145 this->m_ctrlTabCtrl.ShowTab(IDC_IN_CONFLICT-1,false);
147 this->GetDlgItem(IDC_BUTTON_COMMIT)->ShowWindow(SW_HIDE);
149 ///Pull
150 if(CurrentEntry == 0) //Pull
152 CString remotebranch;
153 remotebranch = m_strRemoteBranch;
155 if(!IsURL())
157 CString configName;
158 configName.Format(L"branch.%s.merge", this->m_strLocalBranch);
159 CString pullBranch = CGit::StripRefName(g_Git.GetConfigValue(configName));
161 configName.Format(L"branch.%s.remote", m_strLocalBranch);
162 CString pullRemote = g_Git.GetConfigValue(configName);
164 if(pullBranch == remotebranch && pullRemote == this->m_strURL)
165 remotebranch.Empty();
168 if(m_Gitverion >= 0x01070203) //above 1.7.0.2
169 force += _T("--progress ");
171 cmd.Format(_T("git.exe pull -v %s \"%s\" %s"),
172 force,
173 m_strURL,
174 remotebranch);
176 m_CurrentCmd = GIT_COMMAND_PULL;
177 m_GitCmdList.push_back(cmd);
179 m_pThread = AfxBeginThread(ProgressThreadEntry, this, THREAD_PRIORITY_NORMAL,0,CREATE_SUSPENDED);
180 if (m_pThread==NULL)
182 // ReportError(CString(MAKEINTRESOURCE(IDS_ERR_THREADSTARTFAILED)));
184 else
186 m_pThread->m_bAutoDelete = TRUE;
187 m_pThread->ResumeThread();
192 ///Fetch
193 if(CurrentEntry == 1 || CurrentEntry ==2 ) //Fetch
195 CString remotebranch;
196 if(this->IsURL() || m_strRemoteBranch.IsEmpty())
198 remotebranch=this->m_strRemoteBranch;
201 else
203 remotebranch.Format(_T("remotes/%s/%s"),
204 m_strURL,m_strRemoteBranch);
205 if(g_Git.GetHash(remotebranch).IsEmpty())
206 remotebranch=m_strRemoteBranch;
207 else
208 remotebranch=m_strRemoteBranch+_T(":")+remotebranch;
211 if(m_Gitverion >= 0x01070203) //above 1.7.0.2
212 force += _T("--progress ");
214 cmd.Format(_T("git.exe fetch -v %s \"%s\" %s"),
215 force,
216 m_strURL,
217 remotebranch);
219 if(CurrentEntry == 1)
220 m_CurrentCmd = GIT_COMMAND_FETCH;
221 else
222 m_CurrentCmd = GIT_COMMAND_FETCHANDREBASE;
223 m_GitCmdList.push_back(cmd);
225 m_pThread = AfxBeginThread(ProgressThreadEntry, this, THREAD_PRIORITY_NORMAL,0,CREATE_SUSPENDED);
226 if (m_pThread==NULL)
228 // ReportError(CString(MAKEINTRESOURCE(IDS_ERR_THREADSTARTFAILED)));
230 else
232 m_pThread->m_bAutoDelete = TRUE;
233 m_pThread->ResumeThread();
237 ///Remote Update
238 if(CurrentEntry == 3)
240 m_CurrentCmd = GIT_COMMAND_REMOTE;
241 cmd=_T("git.exe remote update");
242 m_GitCmdList.push_back(cmd);
244 InterlockedExchange(&m_bBlock, TRUE);
246 m_pThread = AfxBeginThread(ProgressThreadEntry, this, THREAD_PRIORITY_NORMAL,0,CREATE_SUSPENDED);
247 if (m_pThread==NULL)
249 // ReportError(CString(MAKEINTRESOURCE(IDS_ERR_THREADSTARTFAILED)));
250 InterlockedExchange(&m_bBlock, FALSE);
252 else
254 m_pThread->m_bAutoDelete = TRUE;
255 m_pThread->ResumeThread();
259 ///Cleanup stale remote banches
260 if(CurrentEntry == 4)
262 m_CurrentCmd = GIT_COMMAND_REMOTE;
263 cmd.Format(_T("git.exe remote prune \"%s\""), m_strURL);
264 m_GitCmdList.push_back(cmd);
266 InterlockedExchange(&m_bBlock, TRUE);
268 m_pThread = AfxBeginThread(ProgressThreadEntry, this, THREAD_PRIORITY_NORMAL,0,CREATE_SUSPENDED);
269 if (m_pThread==NULL)
271 // ReportError(CString(MAKEINTRESOURCE(IDS_ERR_THREADSTARTFAILED)));
272 InterlockedExchange(&m_bBlock, FALSE);
274 else
276 m_pThread->m_bAutoDelete = TRUE;
277 m_pThread->ResumeThread();
282 void CSyncDlg::PullComplete()
284 EnableControlButton(true);
285 SwitchToInput();
286 this->FetchOutList(true);
288 CString newhash;
289 newhash = g_Git.GetHash(_T("HEAD"));
291 if( this ->m_GitCmdStatus )
293 CTGitPathList list;
294 if(g_Git.ListConflictFile(list))
296 this->m_ctrlCmdOut.SetSel(-1,-1);
297 this->m_ctrlCmdOut.ReplaceSel(_T("Get conflict files fail\n"));
299 this->ShowTab(IDC_CMD_LOG);
300 return;
303 if(list.GetCount()>0)
305 this->m_ConflictFileList.Clear();
306 CTGitPathList list;
307 CTGitPath path;
308 list.AddPath(path);
310 this->m_ConflictFileList.GetStatus(&list,true);
311 this->m_ConflictFileList.Show(CTGitPath::LOGACTIONS_UNMERGED,
312 CTGitPath::LOGACTIONS_UNMERGED);
314 this->ShowTab(IDC_IN_CONFLICT);
316 this->GetDlgItem(IDC_BUTTON_COMMIT)->ShowWindow(SW_NORMAL);
318 else
319 this->ShowTab(IDC_CMD_LOG);
322 else
324 if(newhash == this->m_oldHash)
326 this->m_ctrlTabCtrl.ShowTab(IDC_IN_CHANGELIST-1,false);
327 this->m_InLogList.ShowText(CString(MAKEINTRESOURCE(IDS_UPTODATE)));
328 this->m_ctrlTabCtrl.ShowTab(IDC_IN_LOGLIST-1,true);
330 else
332 this->m_ctrlTabCtrl.ShowTab(IDC_IN_CHANGELIST-1,true);
333 this->m_ctrlTabCtrl.ShowTab(IDC_IN_LOGLIST-1,true);
335 CString oldhash=m_oldHash.ToString();
336 this->AddDiffFileList(&m_InChangeFileList,&m_arInChangeList,newhash,oldhash);
338 m_InLogList.FillGitLog(NULL,CGit:: LOG_INFO_STAT| CGit::LOG_INFO_FILESTATE | CGit::LOG_INFO_SHOW_MERGEDFILE,
339 &oldhash,&newhash);
341 this->ShowTab(IDC_IN_LOGLIST);
345 void CSyncDlg::FetchComplete()
347 EnableControlButton(true);
348 SwitchToInput();
349 this->FetchOutList(true);
351 ShowTab(IDC_CMD_LOG);
352 if( (!this->m_GitCmdStatus) && this->m_CurrentCmd == GIT_COMMAND_FETCHANDREBASE)
354 CRebaseDlg dlg;
355 dlg.m_PostButtonTexts.Add(_T("Email &Patch..."));
356 int response = dlg.DoModal();
357 if(response == IDOK)
359 return ;
362 if(response == IDC_REBASE_POST_BUTTON)
364 CString cmd, out, err;
365 cmd.Format(_T("git.exe format-patch -o \"%s\" %s..%s"),
366 g_Git.m_CurrentDir,
367 g_Git.FixBranchName(dlg.m_Upstream),
368 g_Git.FixBranchName(dlg.m_Branch));
369 if (g_Git.Run(cmd, &out, &err, CP_UTF8))
371 CMessageBox::Show(NULL, out + L"\n" + err, _T("TortoiseGit"), MB_OK|MB_ICONERROR);
372 return ;
375 CAppUtils::SendPatchMail(cmd,out);
380 void CSyncDlg::OnBnClickedButtonPush()
382 this->UpdateData();
383 UpdateCombox();
385 if(this->m_strURL.IsEmpty())
387 CMessageBox::Show(NULL, IDS_PROC_GITCONFIG_URLEMPTY, IDS_APPNAME, MB_OK | MB_ICONERROR);
388 return;
391 this->m_regPushButton=this->m_ctrlPush.GetCurrentEntry();
392 this->SwitchToRun();
393 this->m_bAbort=false;
394 this->m_GitCmdList.clear();
396 ShowTab(IDC_CMD_LOG);
398 CString cmd;
399 CString arg;
401 CString error;
402 DWORD exitcode;
403 CTGitPathList list;
404 list.AddPath(CTGitPath(g_Git.m_CurrentDir));
406 if (CHooks::Instance().PrePush(list,exitcode, error))
408 if (exitcode)
410 CString temp;
411 temp.Format(IDS_ERR_HOOKFAILED, (LPCTSTR)error);
412 //ReportError(temp);
413 CMessageBox::Show(NULL,temp,_T("TortoiseGit"),MB_OK|MB_ICONERROR);
414 return ;
418 switch (m_ctrlPush.GetCurrentEntry())
420 case 1:
421 arg += _T(" --tags ");
422 break;
423 case 2:
424 arg += _T(" --all ");
425 break;
428 if(this->m_bForce)
429 arg += _T(" --force ");
431 if(m_Gitverion >= 0x01070203) //above 1.7.0.2
432 arg += _T("--progress ");
434 cmd.Format(_T("git.exe push -v %s \"%s\" %s"),
435 arg,
436 m_strURL,
437 g_Git.FixBranchName(m_strLocalBranch));
439 if (!m_strRemoteBranch.IsEmpty())
441 cmd += _T(":") + m_strRemoteBranch;
444 m_GitCmdList.push_back(cmd);
446 m_CurrentCmd = GIT_COMMAND_PUSH;
448 if(this->m_bAutoLoadPuttyKey)
450 CAppUtils::LaunchPAgent(NULL,&this->m_strURL);
453 m_pThread = AfxBeginThread(ProgressThreadEntry, this, THREAD_PRIORITY_NORMAL,0,CREATE_SUSPENDED);
454 if (m_pThread==NULL)
456 // ReportError(CString(MAKEINTRESOURCE(IDS_ERR_THREADSTARTFAILED)));
458 else
460 m_pThread->m_bAutoDelete = TRUE;
461 m_pThread->ResumeThread();
465 void CSyncDlg::OnBnClickedButtonApply()
467 CString oldhash;
468 oldhash=g_Git.GetHash(_T("HEAD"));
470 CImportPatchDlg dlg;
471 CString cmd,output;
473 if(dlg.DoModal() == IDOK)
475 int err=0;
476 for(int i=0;i<dlg.m_PathList.GetCount();i++)
478 cmd.Format(_T("git.exe am \"%s\""),dlg.m_PathList[i].GetGitPathString());
480 if (g_Git.Run(cmd, &output, CP_UTF8))
482 CMessageBox::Show(NULL,output,_T("TortoiseGit"),MB_OK);
484 err=1;
485 break;
487 this->m_ctrlCmdOut.SetSel(-1,-1);
488 this->m_ctrlCmdOut.ReplaceSel(cmd+_T("\n"));
489 this->m_ctrlCmdOut.SetSel(-1,-1);
490 this->m_ctrlCmdOut.ReplaceSel(output);
493 CString newhash=g_Git.GetHash(_T("HEAD"));
495 this->m_InLogList.Clear();
496 this->m_InChangeFileList.Clear();
498 if(newhash == oldhash)
500 this->m_ctrlTabCtrl.ShowTab(IDC_IN_CHANGELIST-1,false);
501 this->m_InLogList.ShowText(_T("No commits get from patch"));
502 this->m_ctrlTabCtrl.ShowTab(IDC_IN_LOGLIST-1,true);
505 else
507 this->m_ctrlTabCtrl.ShowTab(IDC_IN_CHANGELIST-1,true);
508 this->m_ctrlTabCtrl.ShowTab(IDC_IN_LOGLIST-1,true);
510 this->AddDiffFileList(&m_InChangeFileList,&m_arInChangeList,newhash,oldhash);
511 m_InLogList.FillGitLog(NULL,CGit:: LOG_INFO_STAT| CGit::LOG_INFO_FILESTATE | CGit::LOG_INFO_SHOW_MERGEDFILE,
512 &oldhash,&newhash);
514 this->FetchOutList(true);
517 this->m_ctrlTabCtrl.ShowTab(IDC_CMD_LOG-1,true);
519 if(err)
521 this->ShowTab(IDC_CMD_LOG);
523 else
525 this->ShowTab(IDC_IN_LOGLIST);
530 void CSyncDlg::OnBnClickedButtonEmail()
532 CString cmd, out, err;
534 this->m_strLocalBranch = this->m_ctrlLocalBranch.GetString();
535 this->m_ctrlRemoteBranch.GetWindowText(this->m_strRemoteBranch);
536 this->m_ctrlURL.GetWindowText(this->m_strURL);
537 m_strURL=m_strURL.Trim();
538 m_strRemoteBranch=m_strRemoteBranch.Trim();
540 cmd.Format(_T("git.exe format-patch -o \"%s\" %s..%s"),
541 g_Git.m_CurrentDir,
542 m_strURL+_T('/')+m_strRemoteBranch,g_Git.FixBranchName(m_strLocalBranch));
544 if (g_Git.Run(cmd, &out, &err, CP_UTF8))
546 CMessageBox::Show(NULL, out + L"\n" + err, _T("TortoiseGit"), MB_OK|MB_ICONERROR);
547 return ;
550 CAppUtils::SendPatchMail(cmd,out);
553 void CSyncDlg::ShowProgressCtrl(bool bShow)
555 int b=bShow?SW_NORMAL:SW_HIDE;
556 this->m_ctrlAnimate.ShowWindow(b);
557 this->m_ctrlProgress.ShowWindow(b);
558 this->m_ctrlAnimate.Open(IDR_DOWNLOAD);
559 if(b == SW_NORMAL)
560 this->m_ctrlAnimate.Play(0,-1,-1);
561 else
562 this->m_ctrlAnimate.Stop();
564 void CSyncDlg::ShowInputCtrl(bool bShow)
566 int b=bShow?SW_NORMAL:SW_HIDE;
567 this->m_ctrlURL.ShowWindow(b);
568 this->m_ctrlLocalBranch.ShowWindow(b);
569 this->m_ctrlRemoteBranch.ShowWindow(b);
570 this->GetDlgItem(IDC_BUTTON_LOCAL_BRANCH)->ShowWindow(b);
571 this->GetDlgItem(IDC_BUTTON_REMOTE_BRANCH)->ShowWindow(b);
572 this->GetDlgItem(IDC_STATIC_LOCAL_BRANCH)->ShowWindow(b);
573 this->GetDlgItem(IDC_STATIC_REMOTE_BRANCH)->ShowWindow(b);
574 this->GetDlgItem(IDC_BUTTON_MANAGE)->ShowWindow(b);
575 this->GetDlgItem(IDC_CHECK_PUTTY_KEY)->ShowWindow(b);
576 this->GetDlgItem(IDC_CHECK_FORCE)->ShowWindow(b);
577 this->GetDlgItem(IDC_STATIC_REMOTE_URL)->ShowWindow(b);
579 BOOL CSyncDlg::OnInitDialog()
581 CResizableStandAloneDialog::OnInitDialog();
582 CAppUtils::MarkWindowAsUnpinnable(m_hWnd);
584 // Let the TaskbarButtonCreated message through the UIPI filter. If we don't
585 // do this, Explorer would be unable to send that message to our window if we
586 // were running elevated. It's OK to make the call all the time, since if we're
587 // not elevated, this is a no-op.
588 CHANGEFILTERSTRUCT cfs = { sizeof(CHANGEFILTERSTRUCT) };
589 typedef BOOL STDAPICALLTYPE ChangeWindowMessageFilterExDFN(HWND hWnd, UINT message, DWORD action, PCHANGEFILTERSTRUCT pChangeFilterStruct);
590 CAutoLibrary hUser = ::LoadLibrary(_T("user32.dll"));
591 if (hUser)
593 ChangeWindowMessageFilterExDFN *pfnChangeWindowMessageFilterEx = (ChangeWindowMessageFilterExDFN*)GetProcAddress(hUser, "ChangeWindowMessageFilterEx");
594 if (pfnChangeWindowMessageFilterEx)
596 pfnChangeWindowMessageFilterEx(m_hWnd, WM_TASKBARBTNCREATED, MSGFLT_ALLOW, &cfs);
599 m_pTaskbarList.Release();
600 m_pTaskbarList.CoCreateInstance(CLSID_TaskbarList);
602 this->GetDlgItem(IDC_CHECK_PUTTY_KEY)->EnableWindow(CAppUtils::IsSSHPutty());
605 this->m_ctrlAnimate.ShowWindow(SW_NORMAL);
606 this->m_ctrlAnimate.Open(IDR_DOWNLOAD);
607 this->m_ctrlAnimate.Play(0,-1,-1);
610 // ------------------ Create Tabctrl -----------
611 CWnd *pwnd=this->GetDlgItem(IDC_BUTTON_TABCTRL);
612 CRect rectDummy;
613 pwnd->GetWindowRect(&rectDummy);
614 this->ScreenToClient(rectDummy);
616 if (!m_ctrlTabCtrl.Create(CMFCTabCtrl::STYLE_FLAT, rectDummy, this, IDC_SYNC_TAB))
618 TRACE0("Failed to create output tab window\n");
619 return FALSE; // fail to create
621 m_ctrlTabCtrl.SetResizeMode(CMFCTabCtrl::RESIZE_NO);
623 // -------------Create Command Log Ctrl ---------
624 DWORD dwStyle;
625 dwStyle= ES_MULTILINE | ES_READONLY | WS_CHILD | WS_VISIBLE | ES_AUTOHSCROLL | ES_AUTOVSCROLL |WS_VSCROLL ;
627 if( !m_ctrlCmdOut.Create(dwStyle,rectDummy,&m_ctrlTabCtrl,IDC_CMD_LOG))
629 TRACE0("Failed to create Log commits window\n");
630 return FALSE; // fail to create
633 // set the font to use in the log message view, configured in the settings dialog
634 CFont m_logFont;
635 CAppUtils::CreateFontForLogs(m_logFont);
636 //GetDlgItem(IDC_CMD_LOG)->SetFont(&m_logFont);
637 m_ctrlCmdOut.SetFont(&m_logFont);
638 m_ctrlTabCtrl.InsertTab(&m_ctrlCmdOut, CString(MAKEINTRESOURCE(IDS_LOG)), -1);
640 //m_ctrlCmdOut.ReplaceSel(_T("Hello"));
642 //---------- Create in coming list ctrl -----------
643 dwStyle =LVS_REPORT | LVS_SHOWSELALWAYS | LVS_ALIGNLEFT | LVS_OWNERDATA | WS_BORDER | WS_TABSTOP | WS_CHILD | WS_VISIBLE;;
645 if( !m_InLogList.Create(dwStyle,rectDummy,&m_ctrlTabCtrl,IDC_IN_LOGLIST))
647 TRACE0("Failed to create output commits window\n");
648 return FALSE; // fail to create
651 m_ctrlTabCtrl.InsertTab(&m_InLogList, CString(MAKEINTRESOURCE(IDS_PROC_SYNC_INCOMMITS)), -1);
653 m_InLogList.m_ColumnRegKey=_T("SyncIn");
654 m_InLogList.InsertGitColumn();
656 //----------- Create In Change file list -----------
657 dwStyle = LVS_REPORT | LVS_SHOWSELALWAYS | LVS_ALIGNLEFT | WS_BORDER | WS_TABSTOP |LVS_SINGLESEL |WS_CHILD | WS_VISIBLE;
659 if( !m_InChangeFileList.Create(dwStyle,rectDummy,&m_ctrlTabCtrl,IDC_IN_CHANGELIST))
661 TRACE0("Failed to create output change files window\n");
662 return FALSE; // fail to create
664 m_ctrlTabCtrl.InsertTab(&m_InChangeFileList, CString(MAKEINTRESOURCE(IDS_PROC_SYNC_INCHANGELIST)), -1);
666 m_InChangeFileList.Init(GITSLC_COLEXT | GITSLC_COLSTATUS |GITSLC_COLADD|GITSLC_COLDEL , _T("OutSyncDlg"),
667 (CGitStatusListCtrl::GetContextMenuBit(CGitStatusListCtrl::IDGITLC_COMPARETWO)|
668 CGitStatusListCtrl::GetContextMenuBit(CGitStatusListCtrl::IDGITLC_GNUDIFF2)),false);
671 //---------- Create Conflict List Ctrl -----------------
672 dwStyle = LVS_REPORT | LVS_SHOWSELALWAYS | LVS_ALIGNLEFT | WS_BORDER | WS_TABSTOP |LVS_SINGLESEL |WS_CHILD | WS_VISIBLE;
674 if( !m_ConflictFileList.Create(dwStyle,rectDummy,&m_ctrlTabCtrl,IDC_IN_CONFLICT))
676 TRACE0("Failed to create output change files window\n");
677 return FALSE; // fail to create
679 m_ctrlTabCtrl.InsertTab(&m_ConflictFileList,_T("Conflict"),-1);
681 m_ConflictFileList.Init(GITSLC_COLEXT | GITSLC_COLSTATUS |GITSLC_COLADD|GITSLC_COLDEL , _T("OutSyncDlg"),
682 (CGitStatusListCtrl::GetContextMenuBit(CGitStatusListCtrl::IDGITLC_COMPARETWO)|
683 CGitStatusListCtrl::GetContextMenuBit(CGitStatusListCtrl::IDGITLC_GNUDIFF2)|
684 GITSLC_POPCONFLICT|GITSLC_POPRESOLVE),false);
687 //---------- Create Commit Out List Ctrl---------------
689 dwStyle =LVS_REPORT | LVS_SHOWSELALWAYS | LVS_ALIGNLEFT | LVS_OWNERDATA | WS_BORDER | WS_TABSTOP | WS_CHILD | WS_VISIBLE;;
691 if( !m_OutLogList.Create(dwStyle,rectDummy,&m_ctrlTabCtrl,IDC_OUT_LOGLIST))
693 TRACE0("Failed to create output commits window\n");
694 return FALSE; // fail to create
698 m_ctrlTabCtrl.InsertTab(&m_OutLogList, CString(MAKEINTRESOURCE(IDS_PROC_SYNC_OUTCOMMITS)), -1);
700 m_OutLogList.m_ColumnRegKey = _T("SyncOut");
701 m_OutLogList.InsertGitColumn();
703 //------------- Create Change File List Control ----------------
705 dwStyle = LVS_REPORT | LVS_SHOWSELALWAYS | LVS_ALIGNLEFT | WS_BORDER | WS_TABSTOP |LVS_SINGLESEL |WS_CHILD | WS_VISIBLE;
707 if( !m_OutChangeFileList.Create(dwStyle,rectDummy,&m_ctrlTabCtrl,IDC_OUT_CHANGELIST))
709 TRACE0("Failed to create output change files window\n");
710 return FALSE; // fail to create
712 m_ctrlTabCtrl.InsertTab(&m_OutChangeFileList, CString(MAKEINTRESOURCE(IDS_PROC_SYNC_OUTCHANGELIST)), -1);
714 m_OutChangeFileList.Init(GITSLC_COLEXT | GITSLC_COLSTATUS |GITSLC_COLADD|GITSLC_COLDEL , _T("OutSyncDlg"),
715 (CGitStatusListCtrl::GetContextMenuBit(CGitStatusListCtrl::IDGITLC_COMPARETWO)|
716 CGitStatusListCtrl::GetContextMenuBit(CGitStatusListCtrl::IDGITLC_GNUDIFF2)),false);
718 this->m_tooltips.Create(this);
720 AddAnchor(IDC_SYNC_TAB,TOP_LEFT,BOTTOM_RIGHT);
722 AddAnchor(IDC_GROUP_INFO,TOP_LEFT,TOP_RIGHT);
723 AddAnchor(IDC_COMBOBOXEX_URL,TOP_LEFT,TOP_RIGHT);
724 AddAnchor(IDC_BUTTON_MANAGE,TOP_RIGHT);
725 AddAnchor(IDC_BUTTON_PULL,BOTTOM_LEFT);
726 AddAnchor(IDC_BUTTON_PUSH,BOTTOM_LEFT);
727 AddAnchor(IDC_BUTTON_SUBMODULE,BOTTOM_LEFT);
728 AddAnchor(IDC_BUTTON_APPLY,BOTTOM_RIGHT);
729 AddAnchor(IDC_BUTTON_EMAIL,BOTTOM_RIGHT);
730 AddAnchor(IDC_PROGRESS_SYNC,TOP_LEFT,TOP_RIGHT);
731 AddAnchor(IDOK,BOTTOM_RIGHT);
732 AddAnchor(IDHELP,BOTTOM_RIGHT);
733 AddAnchor(IDC_STATIC_STATUS,BOTTOM_LEFT);
734 AddAnchor(IDC_ANIMATE_SYNC,TOP_LEFT);
735 AddAnchor(IDC_BUTTON_COMMIT,BOTTOM_LEFT);
737 // do not use BRANCH_COMBOX_ADD_ANCHOR here, we want to have different stylings
738 AddAnchor(IDC_COMBOBOXEX_LOCAL_BRANCH, TOP_LEFT,TOP_CENTER);
739 AddAnchor(IDC_COMBOBOXEX_REMOTE_BRANCH, TOP_CENTER, TOP_RIGHT);
740 AddAnchor(IDC_BUTTON_LOCAL_BRANCH, TOP_CENTER);
741 AddAnchor(IDC_BUTTON_REMOTE_BRANCH, TOP_RIGHT);
742 AddAnchor(IDC_STATIC_REMOTE_BRANCH, TOP_CENTER);
744 this->GetDlgItem(IDC_BUTTON_COMMIT)->ShowWindow(SW_HIDE);
746 AdjustControlSize(IDC_CHECK_PUTTY_KEY);
747 AdjustControlSize(IDC_CHECK_FORCE);
749 CString WorkingDir=g_Git.m_CurrentDir;
750 WorkingDir.Replace(_T(':'),_T('_'));
751 m_RegKeyRemoteBranch = CString(_T("Software\\TortoiseGit\\History\\SyncBranch\\"))+WorkingDir;
754 this->AddOthersToAnchor();
756 this->m_ctrlPush.AddEntry(CString(MAKEINTRESOURCE(IDS_PROC_SYNC_PUSH)));
757 this->m_ctrlPush.AddEntry(CString(MAKEINTRESOURCE(IDS_PROC_SYNC_PUSHTAGS)));
758 ///this->m_ctrlPush.AddEntry(CString(_T("Push All")));
760 this->m_ctrlPull.AddEntry(CString(MAKEINTRESOURCE(IDS_PROC_SYNC_PULL)));
761 this->m_ctrlPull.AddEntry(CString(MAKEINTRESOURCE(IDS_PROC_SYNC_FETCH)));
762 this->m_ctrlPull.AddEntry(CString(MAKEINTRESOURCE(IDS_PROC_SYNC_FETCHREBASE)));
763 this->m_ctrlPull.AddEntry(CString(MAKEINTRESOURCE(IDS_PROC_SYNC_REMOTEUPDATE)));
764 this->m_ctrlPull.AddEntry(CString(MAKEINTRESOURCE(IDS_PROC_SYNC_CLEANUPSTALEBRANCHES)));
766 this->m_ctrlSubmodule.AddEntry(CString(MAKEINTRESOURCE(IDS_PROC_SYNC_SUBKODULEUPDATE)));
767 this->m_ctrlSubmodule.AddEntry(CString(MAKEINTRESOURCE(IDS_PROC_SYNC_SUBKODULEINIT)));
768 this->m_ctrlSubmodule.AddEntry(CString(MAKEINTRESOURCE(IDS_PROC_SYNC_SUBKODULESYNC)));
770 WorkingDir.Replace(_T(':'),_T('_'));
772 CString regkey ;
773 regkey.Format(_T("Software\\TortoiseGit\\TortoiseProc\\Sync\\%s"),WorkingDir);
775 this->m_regPullButton = CRegDWORD(regkey+_T("\\Pull"),0);
776 this->m_regPushButton = CRegDWORD(regkey+_T("\\Push"),0);
777 this->m_regSubmoduleButton = CRegDWORD(regkey+_T("\\Submodule"));
778 this->m_regAutoLoadPutty = CRegDWORD(regkey + _T("\\AutoLoadPutty"), CAppUtils::IsSSHPutty());
780 m_tooltips.Create(this);
781 this->UpdateData();
782 this->m_bAutoLoadPuttyKey = m_regAutoLoadPutty;
783 if(!CAppUtils::IsSSHPutty())
784 m_bAutoLoadPuttyKey = false;
785 this->UpdateData(FALSE);
787 this->m_ctrlPull.SetCurrentEntry(this->m_regPullButton);
788 this->m_ctrlPush.SetCurrentEntry(this->m_regPushButton);
789 this->m_ctrlSubmodule.SetCurrentEntry(this->m_regSubmoduleButton);
791 CString sWindowTitle;
792 GetWindowText(sWindowTitle);
793 CAppUtils::SetWindowTitle(m_hWnd, g_Git.m_CurrentDir, sWindowTitle);
795 EnableSaveRestore(_T("SyncDlg"));
797 this->m_ctrlURL.LoadHistory(CString(_T("Software\\TortoiseGit\\History\\SyncURL\\"))+WorkingDir, _T("url"));
799 STRING_VECTOR list;
801 if(!g_Git.GetRemoteList(list))
803 for(unsigned int i=0;i<list.size();i++)
805 m_ctrlURL.AddString(list[i]);
808 m_ctrlURL.SetCurSel(0);
809 m_ctrlRemoteBranch.SetCurSel(0);
810 m_ctrlURL.SetURLHistory(true);
812 this->LoadBranchInfo();
814 this->m_bInited=true;
815 FetchOutList();
817 m_ctrlTabCtrl.ShowTab(IDC_CMD_LOG-1,false);
818 m_ctrlTabCtrl.ShowTab(IDC_IN_LOGLIST-1,false);
819 m_ctrlTabCtrl.ShowTab(IDC_IN_CHANGELIST-1,false);
820 m_ctrlTabCtrl.ShowTab(IDC_IN_CONFLICT-1,false);
822 m_ctrlRemoteBranch.m_bWantReturn = TRUE;
823 m_ctrlURL.m_bWantReturn = TRUE;
825 this->m_Gitverion = CAppUtils::GetMsysgitVersion();
827 return TRUE; // return TRUE unless you set the focus to a control
828 // EXCEPTION: OCX Property Pages should return FALSE
831 void CSyncDlg::OnBnClickedButtonManage()
833 CAppUtils::LaunchRemoteSetting();
834 Refresh();
837 void CSyncDlg::Refresh()
839 theApp.DoWaitCursor(1);
841 int lastSelected = m_ctrlURL.GetCurSel();
842 CString url;
843 this->m_ctrlURL.GetWindowText(url);
845 this->m_ctrlURL.Reset();
846 CString workingDir = g_Git.m_CurrentDir;
847 workingDir.Replace(_T(':'), _T('_'));
848 this->m_ctrlURL.LoadHistory(_T("Software\\TortoiseGit\\History\\SyncURL\\") + workingDir, _T("url"));
850 STRING_VECTOR list;
851 bool found = false;
852 if (!g_Git.GetRemoteList(list))
854 for (int i = 0; i < list.size(); i++)
856 m_ctrlURL.AddString(list[i]);
857 if (list[i] == url)
858 found = true;
861 if (lastSelected >= 0 && !found)
863 m_ctrlURL.SetCurSel(0);
864 m_ctrlURL.GetWindowText(url);
867 CString local;
868 CString remote;
869 this->m_ctrlLocalBranch.GetWindowText(local);
870 this->m_ctrlRemoteBranch.GetWindowText(remote);
872 this->LoadBranchInfo();
874 this->m_ctrlLocalBranch.AddString(local);
875 this->m_ctrlRemoteBranch.AddString(remote);
876 this->m_ctrlURL.AddString(url);
878 m_OutLogList.ShowText(CString(MAKEINTRESOURCE(IDS_PROC_SYNC_REFRESHING)));
879 this->FetchOutList(true);
880 theApp.DoWaitCursor(-1);
883 BOOL CSyncDlg::PreTranslateMessage(MSG* pMsg)
885 if (pMsg->message == WM_KEYDOWN)
887 switch (pMsg->wParam)
890 case VK_F5:
892 if (m_bBlock)
893 return CResizableStandAloneDialog::PreTranslateMessage(pMsg);
894 Refresh();
896 break;
898 /* Avoid TAB control destroy but dialog exist*/
899 case VK_ESCAPE:
900 case VK_CANCEL:
902 TCHAR buff[128];
903 ::GetClassName(pMsg->hwnd,buff,128);
905 if(_tcsnicmp(buff,_T("RichEdit20W"),128)==0)
907 this->PostMessage(WM_KEYDOWN,VK_ESCAPE,0);
908 return TRUE;
913 m_tooltips.RelayEvent(pMsg);
914 return __super::PreTranslateMessage(pMsg);
916 void CSyncDlg::FetchOutList(bool force)
918 if(!m_bInited)
919 return;
920 m_OutChangeFileList.Clear();
921 this->m_OutLogList.Clear();
923 CString remote;
924 this->m_ctrlURL.GetWindowText(remote);
925 CString remotebranch;
926 this->m_ctrlRemoteBranch.GetWindowText(remotebranch);
927 remotebranch=remote+_T("/")+remotebranch;
929 if(IsURL())
931 CString str;
932 str.LoadString(IDS_PROC_SYNC_PUSH_UNKNOWN);
933 m_OutLogList.ShowText(str);
934 this->m_ctrlTabCtrl.ShowTab(m_OutChangeFileList.GetDlgCtrlID()-1,FALSE);
935 m_OutLocalBranch.Empty();
936 m_OutRemoteBranch.Empty();
938 this->GetDlgItem(IDC_BUTTON_EMAIL)->EnableWindow(FALSE);
939 return ;
942 else if(g_Git.GetHash(remotebranch).IsEmpty())
944 CString str;
945 str.Format(IDS_PROC_SYNC_PUSH_UNKNOWNBRANCH, remotebranch);
946 m_OutLogList.ShowText(str);
947 this->m_ctrlTabCtrl.ShowTab(m_OutChangeFileList.GetDlgCtrlID()-1,FALSE);
948 m_OutLocalBranch.Empty();
949 m_OutRemoteBranch.Empty();
951 this->GetDlgItem(IDC_BUTTON_EMAIL)->EnableWindow(FALSE);
952 return ;
954 else
956 CString localbranch;
957 localbranch=this->m_ctrlLocalBranch.GetString();
959 if(localbranch != m_OutLocalBranch || m_OutRemoteBranch != remotebranch || force)
961 m_OutLogList.ClearText();
962 m_OutLogList.FillGitLog(NULL,CGit:: LOG_INFO_STAT| CGit::LOG_INFO_FILESTATE | CGit::LOG_INFO_SHOW_MERGEDFILE,
963 &remotebranch,&localbranch);
965 CString str;
966 if(m_OutLogList.GetItemCount() == 0)
968 str.Format(IDS_PROC_SYNC_COMMITSAHEAD, 0, remotebranch);
969 m_OutLogList.ShowText(str);
970 this->m_ctrlStatus.SetWindowText(str);
971 this->m_ctrlTabCtrl.ShowTab(m_OutChangeFileList.GetDlgCtrlID()-1,FALSE);
972 this->GetDlgItem(IDC_BUTTON_EMAIL)->EnableWindow(FALSE);
974 else
976 str.Format(IDS_PROC_SYNC_COMMITSAHEAD, m_OutLogList.GetItemCount(), remotebranch);
977 this->m_ctrlStatus.SetWindowText(str);
979 AddDiffFileList(&m_OutChangeFileList,&m_arOutChangeList,localbranch,remotebranch);
981 this->m_ctrlTabCtrl.ShowTab(m_OutChangeFileList.GetDlgCtrlID()-1,TRUE);
982 this->GetDlgItem(IDC_BUTTON_EMAIL)->EnableWindow(TRUE);
985 this->m_OutLocalBranch=localbranch;
986 this->m_OutRemoteBranch=remotebranch;
991 bool CSyncDlg::IsURL()
993 CString str;
994 this->m_ctrlURL.GetWindowText(str);
995 if(str.Find(_T('\\'))>=0 || str.Find(_T('/'))>=0)
996 return true;
997 else
998 return false;
1000 void CSyncDlg::OnCbnEditchangeComboboxex()
1002 SetTimer(IDT_INPUT, 1000, NULL);
1003 this->m_OutLogList.ShowText(CString(MAKEINTRESOURCE(IDS_PROC_SYNC_WAINTINPUT)));
1005 //this->FetchOutList();
1008 UINT CSyncDlg::ProgressThread()
1010 m_GitCmdStatus=CProgressDlg::RunCmdList(this,m_GitCmdList,true,NULL,&this->m_bAbort);
1011 InterlockedExchange(&m_bBlock, FALSE);
1012 return 0;
1016 LRESULT CSyncDlg::OnProgressUpdateUI(WPARAM wParam,LPARAM lParam)
1018 if(wParam == MSG_PROGRESSDLG_START)
1020 m_ctrlAnimate.Play(0,-1,-1);
1021 this->m_ctrlProgress.SetPos(0);
1022 if (m_pTaskbarList)
1024 m_pTaskbarList->SetProgressState(m_hWnd, TBPF_NORMAL);
1025 m_pTaskbarList->SetProgressValue(m_hWnd, 0, 100);
1029 if(wParam == MSG_PROGRESSDLG_END || wParam == MSG_PROGRESSDLG_FAILED)
1031 //m_bDone = true;
1032 m_ctrlAnimate.Stop();
1033 m_ctrlProgress.SetPos(100);
1034 //this->DialogEnableWindow(IDOK,TRUE);
1035 if (m_pTaskbarList)
1036 m_pTaskbarList->SetProgressState(m_hWnd, TBPF_NOPROGRESS);
1038 //if(wParam == MSG_PROGRESSDLG_END)
1039 if(this->m_CurrentCmd == GIT_COMMAND_PUSH )
1041 if(!m_GitCmdStatus)
1043 CTGitPathList list;
1044 list.AddPath(CTGitPath(g_Git.m_CurrentDir));
1045 DWORD exitcode;
1046 CString error;
1047 if (CHooks::Instance().PostPush(list,exitcode, error))
1049 if (exitcode)
1051 CString temp;
1052 temp.Format(IDS_ERR_HOOKFAILED, (LPCTSTR)error);
1053 //ReportError(temp);
1054 CMessageBox::Show(NULL,temp,_T("TortoiseGit"),MB_OK|MB_ICONERROR);
1055 return false;
1060 EnableControlButton(true);
1061 SwitchToInput();
1062 this->FetchOutList(true);
1064 if(this->m_CurrentCmd == GIT_COMMAND_PULL )
1066 PullComplete();
1068 if(this->m_CurrentCmd == GIT_COMMAND_FETCH || this->m_CurrentCmd == GIT_COMMAND_FETCHANDREBASE)
1070 FetchComplete();
1072 if(this->m_CurrentCmd == GIT_COMMAND_SUBMODULE)
1074 //this->m_ctrlCmdOut.SetSel(-1,-1);
1075 //this->m_ctrlCmdOut.ReplaceSel(_T("Done\r\n"));
1076 //this->m_ctrlCmdOut.SetSel(-1,-1);
1077 EnableControlButton(true);
1078 SwitchToInput();
1080 if(this->m_CurrentCmd == GIT_COMMAND_REMOTE)
1082 this->FetchOutList(true);
1083 EnableControlButton(true);
1084 SwitchToInput();
1088 if(lParam != 0)
1089 ParserCmdOutput((char)lParam);
1091 return 0;
1095 void CSyncDlg::ParserCmdOutput(char ch)
1097 CProgressDlg::ParserCmdOutput(m_ctrlCmdOut,m_ctrlProgress,m_hWnd,m_pTaskbarList,m_LogText,ch);
1099 void CSyncDlg::OnBnClickedButtonCommit()
1101 CString cmd = _T("/command:commit");
1102 cmd += _T(" /path:\"");
1103 cmd += g_Git.m_CurrentDir;
1104 cmd += _T("\"");
1106 CAppUtils::RunTortoiseProc(cmd);
1109 void CSyncDlg::OnOK()
1111 UpdateCombox();
1112 this->UpdateData();
1113 m_ctrlURL.SaveHistory();
1114 SaveHistory();
1115 m_regAutoLoadPutty = this->m_bAutoLoadPuttyKey;
1116 __super::OnOK();
1119 void CSyncDlg::OnBnClickedButtonSubmodule()
1121 this->UpdateData();
1122 UpdateCombox();
1124 this->m_regSubmoduleButton = this->m_ctrlSubmodule.GetCurrentEntry();
1126 this->SwitchToRun();
1128 this->m_bAbort=false;
1129 this->m_GitCmdList.clear();
1131 ShowTab(IDC_CMD_LOG);
1133 CString cmd;
1135 switch (m_ctrlSubmodule.GetCurrentEntry())
1137 case 0:
1138 cmd=_T("git.exe submodule update --init");
1139 break;
1140 case 1:
1141 cmd=_T("git.exe submodule init");
1142 break;
1143 case 2:
1144 cmd=_T("git.exe submodule sync");
1145 break;
1148 m_GitCmdList.push_back(cmd);
1150 m_CurrentCmd = GIT_COMMAND_SUBMODULE;
1152 m_pThread = AfxBeginThread(ProgressThreadEntry, this, THREAD_PRIORITY_NORMAL,0,CREATE_SUSPENDED);
1153 if (m_pThread==NULL)
1155 // ReportError(CString(MAKEINTRESOURCE(IDS_ERR_THREADSTARTFAILED)));
1157 else
1159 m_pThread->m_bAutoDelete = TRUE;
1160 m_pThread->ResumeThread();
1164 void CSyncDlg::OnTimer(UINT_PTR nIDEvent)
1166 if( nIDEvent == IDT_INPUT)
1168 KillTimer(IDT_INPUT);
1169 this->FetchOutList(true);
1174 void CSyncDlg::OnLvnInLogListColumnClick(NMHDR *pNMHDR, LRESULT *pResult)
1176 *pResult = 0;
1179 LRESULT CSyncDlg::OnTaskbarBtnCreated(WPARAM /*wParam*/, LPARAM /*lParam*/)
1181 m_pTaskbarList.Release();
1182 m_pTaskbarList.CoCreateInstance(CLSID_TaskbarList);
1183 return 0;