1 // TortoiseGit - a Windows shell extension for easy version control
3 // Copyright (C) 2008-2011 - 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.
19 // ImportPatchDlg.cpp : implementation file
23 #include "TortoiseProc.h"
24 #include "ImportPatchDlg.h"
26 #include "MessageBox.h"
29 // CImportPatchDlg dialog
31 IMPLEMENT_DYNAMIC(CImportPatchDlg
, CResizableStandAloneDialog
)
33 CImportPatchDlg::CImportPatchDlg(CWnd
* pParent
/*=NULL*/)
34 : CResizableStandAloneDialog(CImportPatchDlg::IDD
, pParent
)
36 m_cList
.m_ContextMenuMask
&=~ m_cList
.GetMenuMask(CPatchListCtrl::MENU_APPLY
);
40 m_bExitThread
= false;
41 m_bThreadRunning
=false;
45 m_bAddSignedOffBy
= FALSE
;
49 CImportPatchDlg::~CImportPatchDlg()
54 void CImportPatchDlg::DoDataExchange(CDataExchange
* pDX
)
56 CDialog::DoDataExchange(pDX
);
57 DDX_Control(pDX
, IDC_LIST_PATCH
,m_cList
);
58 DDX_Control(pDX
, IDC_AM_SPLIT
, m_wndSplitter
);
59 DDX_Check(pDX
, IDC_CHECK_3WAY
, m_b3Way
);
60 DDX_Check(pDX
, IDC_CHECK_IGNORE_SPACE
, m_bIgnoreSpace
);
61 DDX_Check(pDX
, IDC_SIGN_OFF
, m_bAddSignedOffBy
);
62 DDX_Check(pDX
, IDC_KEEP_CR
, m_bKeepCR
);
65 void CImportPatchDlg::AddAmAnchor()
67 AddAnchor(IDC_AM_TAB
,TOP_LEFT
,BOTTOM_RIGHT
);
68 AddAnchor(IDC_LIST_PATCH
, TOP_LEFT
, TOP_RIGHT
);
69 AddAnchor(IDC_AM_SPLIT
, TOP_LEFT
, TOP_RIGHT
);
70 AddAnchor(IDC_BUTTON_ADD
, TOP_RIGHT
);
71 AddAnchor(IDC_BUTTON_UP
, TOP_RIGHT
);
72 AddAnchor(IDC_BUTTON_DOWN
, TOP_RIGHT
);
73 AddAnchor(IDC_BUTTON_REMOVE
, TOP_RIGHT
);
75 AddAnchor(IDOK
,BOTTOM_RIGHT
);
76 AddAnchor(IDCANCEL
,BOTTOM_RIGHT
);
77 AddAnchor(IDHELP
, BOTTOM_RIGHT
);
79 AddAnchor(IDC_AM_DUMY_TAB
, TOP_LEFT
, BOTTOM_RIGHT
);
81 this->AddOthersToAnchor();
84 void CImportPatchDlg::SetSplitterRange()
86 if ((m_cList
)&&(m_ctrlTabCtrl
))
89 m_cList
.GetWindowRect(rcTop
);
90 ScreenToClient(rcTop
);
92 m_ctrlTabCtrl
.GetWindowRect(rcMiddle
);
93 ScreenToClient(rcMiddle
);
94 if (rcMiddle
.Height() && rcMiddle
.Width())
95 m_wndSplitter
.SetRange(rcTop
.top
+160, rcMiddle
.bottom
-160);
99 BOOL
CImportPatchDlg::OnInitDialog()
101 CResizableStandAloneDialog::OnInitDialog();
102 CAppUtils::MarkWindowAsUnpinnable(m_hWnd
);
104 // Let the TaskbarButtonCreated message through the UIPI filter. If we don't
105 // do this, Explorer would be unable to send that message to our window if we
106 // were running elevated. It's OK to make the call all the time, since if we're
107 // not elevated, this is a no-op.
108 CHANGEFILTERSTRUCT cfs
= { sizeof(CHANGEFILTERSTRUCT
) };
109 typedef BOOL STDAPICALLTYPE
ChangeWindowMessageFilterExDFN(HWND hWnd
, UINT message
, DWORD action
, PCHANGEFILTERSTRUCT pChangeFilterStruct
);
110 HMODULE hUser
= ::LoadLibrary(_T("user32.dll"));
113 ChangeWindowMessageFilterExDFN
*pfnChangeWindowMessageFilterEx
= (ChangeWindowMessageFilterExDFN
*)GetProcAddress(hUser
, "ChangeWindowMessageFilterEx");
114 if (pfnChangeWindowMessageFilterEx
)
116 pfnChangeWindowMessageFilterEx(m_hWnd
, WM_TASKBARBTNCREATED
, MSGFLT_ALLOW
, &cfs
);
120 m_pTaskbarList
.Release();
121 m_pTaskbarList
.CoCreateInstance(CLSID_TaskbarList
);
125 GetClientRect(m_DlgOrigRect
);
126 m_cList
.GetClientRect(m_PatchListOrigRect
);
128 CWnd
*pwnd
=this->GetDlgItem(IDC_AM_DUMY_TAB
);
129 pwnd
->GetWindowRect(&rectDummy
);
130 this->ScreenToClient(rectDummy
);
132 if (!m_ctrlTabCtrl
.Create(CMFCTabCtrl::STYLE_FLAT
, rectDummy
, this, IDC_AM_TAB
))
134 TRACE0("Failed to create output tab window\n");
135 return FALSE
; // fail to create
137 m_ctrlTabCtrl
.SetResizeMode(CMFCTabCtrl::RESIZE_NO
);
138 // Create output panes:
139 //const DWORD dwStyle = LBS_NOINTEGRALHEIGHT | WS_CHILD | WS_VISIBLE | WS_HSCROLL | WS_VSCROLL;
140 DWORD dwStyle
=LVS_REPORT
| LVS_SHOWSELALWAYS
| LVS_ALIGNLEFT
| WS_BORDER
| WS_TABSTOP
|LVS_SINGLESEL
|WS_CHILD
| WS_VISIBLE
;
142 if( ! this->m_PatchCtrl
.Create(_T("Scintilla"),_T("source"),0,rectDummy
,&m_ctrlTabCtrl
,0,0) )
144 TRACE0("Failed to create log message control");
148 m_PatchCtrl
.Call(SCI_SETREADONLY
, TRUE
);
149 m_PatchCtrl
.SetUDiffStyle();
151 dwStyle
= LBS_NOINTEGRALHEIGHT
| WS_CHILD
| WS_VISIBLE
| WS_HSCROLL
| WS_VSCROLL
;
153 if (!m_wndOutput
.Create(_T("Scintilla"),_T("source"),0,rectDummy
, &m_ctrlTabCtrl
, 0,0) )
155 TRACE0("Failed to create output windows\n");
156 return -1; // fail to create
159 m_wndOutput
.Call(SCI_SETREADONLY
, TRUE
);
161 m_tooltips
.Create(this);
163 m_tooltips
.AddTool(IDC_CHECK_3WAY
,IDS_AM_3WAY_TT
);
164 m_tooltips
.AddTool(IDC_CHECK_IGNORE_SPACE
,IDS_AM_IGNORE_SPACE_TT
);
166 m_ctrlTabCtrl
.AddTab(&m_PatchCtrl
,_T("Patch"),0);
167 m_ctrlTabCtrl
.AddTab(&m_wndOutput
,_T("Log"),1);
171 m_PathList
.SortByPathname(true);
172 m_cList
.SetExtendedStyle( m_cList
.GetExtendedStyle()| LVS_EX_CHECKBOXES
);
174 for(int i
=0;i
<m_PathList
.GetCount();i
++)
176 m_cList
.InsertItem(0,m_PathList
[i
].GetWinPath());
177 m_cList
.SetCheck(0,true);
180 DWORD yPos
= CRegDWORD(_T("Software\\TortoiseGit\\TortoiseProc\\ResizableState\\AMDlgSizer"));
181 RECT rcDlg
, rcLogMsg
, rcFileList
;
182 GetClientRect(&rcDlg
);
183 m_cList
.GetWindowRect(&rcLogMsg
);
184 ScreenToClient(&rcLogMsg
);
185 this->m_ctrlTabCtrl
.GetWindowRect(&rcFileList
);
186 ScreenToClient(&rcFileList
);
190 m_wndSplitter
.GetWindowRect(&rectSplitter
);
191 ScreenToClient(&rectSplitter
);
192 int delta
= yPos
- rectSplitter
.top
;
193 if ((rcLogMsg
.bottom
+ delta
> rcLogMsg
.top
)&&(rcLogMsg
.bottom
+ delta
< rcFileList
.bottom
- 30))
195 m_wndSplitter
.SetWindowPos(NULL
, 0, yPos
, 0, 0, SWP_NOSIZE
);
200 CAppUtils::SetListCtrlBackgroundImage(m_cList
.GetSafeHwnd(), IDI_IMPORTPATHCES_BKG
);
202 CString sWindowTitle
;
203 GetWindowText(sWindowTitle
);
204 CAppUtils::SetWindowTitle(m_hWnd
, g_Git
.m_CurrentDir
, sWindowTitle
);
206 EnableSaveRestore(_T("ImportDlg"));
213 BEGIN_MESSAGE_MAP(CImportPatchDlg
, CResizableStandAloneDialog
)
214 ON_LBN_SELCHANGE(IDC_LIST_PATCH
, &CImportPatchDlg::OnLbnSelchangeListPatch
)
215 ON_BN_CLICKED(IDC_BUTTON_ADD
, &CImportPatchDlg::OnBnClickedButtonAdd
)
216 ON_BN_CLICKED(IDC_BUTTON_UP
, &CImportPatchDlg::OnBnClickedButtonUp
)
217 ON_BN_CLICKED(IDC_BUTTON_DOWN
, &CImportPatchDlg::OnBnClickedButtonDown
)
218 ON_BN_CLICKED(IDC_BUTTON_REMOVE
, &CImportPatchDlg::OnBnClickedButtonRemove
)
219 ON_BN_CLICKED(IDOK
, &CImportPatchDlg::OnBnClickedOk
)
221 ON_BN_CLICKED(IDCANCEL
, &CImportPatchDlg::OnBnClickedCancel
)
222 ON_NOTIFY(LVN_ITEMCHANGED
, IDC_LIST_PATCH
, &CImportPatchDlg::OnHdnItemchangedListPatch
)
223 ON_REGISTERED_MESSAGE(WM_TASKBARBTNCREATED
, OnTaskbarBtnCreated
)
227 // CImportPatchDlg message handlers
229 void CImportPatchDlg::OnLbnSelchangeListPatch()
231 if(m_cList
.GetSelectedCount() == 0)
233 this->GetDlgItem(IDC_BUTTON_UP
)->EnableWindow(FALSE
);
234 this->GetDlgItem(IDC_BUTTON_DOWN
)->EnableWindow(FALSE
);
235 this->GetDlgItem(IDC_BUTTON_REMOVE
)->EnableWindow(FALSE
);
239 this->GetDlgItem(IDC_BUTTON_UP
)->EnableWindow(TRUE
);
240 this->GetDlgItem(IDC_BUTTON_DOWN
)->EnableWindow(TRUE
);
241 this->GetDlgItem(IDC_BUTTON_REMOVE
)->EnableWindow(TRUE
);
245 void CImportPatchDlg::OnBnClickedButtonAdd()
247 CFileDialog
dlg(TRUE
,NULL
,
249 OFN_HIDEREADONLY
| OFN_OVERWRITEPROMPT
|OFN_ALLOWMULTISELECT
,
250 _T("Patch Files(*.patch)|*.patch|Diff Files(*.diff)|*.diff|All Files(*.*)|*.*||"));
251 if(dlg
.DoModal() == IDOK
)
254 pos
= dlg
.GetStartPosition();
257 CString file
= dlg
.GetNextPathName(pos
);
261 int index
= m_cList
.InsertItem(m_cList
.GetItemCount(), file
);
263 m_cList
.SetCheck(index
, true);
269 void CImportPatchDlg::OnBnClickedButtonUp()
272 pos
= m_cList
.GetFirstSelectedItemPosition();
274 // do nothing if the first selected item is the first item in the list
275 if (m_cList
.GetNextSelectedItem(pos
) == 0)
278 pos
= m_cList
.GetFirstSelectedItemPosition();
282 int index
= m_cList
.GetNextSelectedItem(pos
);
285 CString old
= m_cList
.GetItemText(index
, 0);
286 BOOL oldState
= m_cList
.GetCheck(index
);
287 m_cList
.DeleteItem(index
);
288 m_cList
.InsertItem(index
- 1, old
);
289 m_cList
.SetCheck(index
- 1, oldState
);
290 m_cList
.SetItemState(index
- 1, LVIS_SELECTED
, LVIS_SELECTED
);
291 m_cList
.SetItemState(index
, 0, LVIS_SELECTED
);
297 void CImportPatchDlg::OnBnClickedButtonDown()
299 if (m_cList
.GetSelectedCount() == 0)
303 pos
= m_cList
.GetFirstSelectedItemPosition();
304 // use an array to store all selected item indexes; the user won't select too much items
306 indexes
= new int[m_cList
.GetSelectedCount()];
310 indexes
[i
++] = m_cList
.GetNextSelectedItem(pos
);
313 // don't move any item if the last selected item is the last item in the m_CommitList
314 // (that would change the order of the selected items)
315 if(indexes
[m_cList
.GetSelectedCount() - 1] < m_cList
.GetItemCount() - 1)
317 // iterate over the indexes backwards in order to correctly move multiselected items
318 for (i
= m_cList
.GetSelectedCount() - 1; i
>= 0; i
--)
320 int index
= indexes
[i
];
321 CString old
= m_cList
.GetItemText(index
, 0);
322 BOOL oldState
= m_cList
.GetCheck(index
);
323 m_cList
.DeleteItem(index
);
324 m_cList
.InsertItem(index
+ 1, old
);
325 m_cList
.SetCheck(index
+ 1, oldState
);
326 m_cList
.SetItemState(index
+ 1, LVIS_SELECTED
, LVIS_SELECTED
);
327 m_cList
.SetItemState(index
, 0, LVIS_SELECTED
);
334 void CImportPatchDlg::OnBnClickedButtonRemove()
337 pos
= m_cList
.GetFirstSelectedItemPosition();
340 int index
= m_cList
.GetNextSelectedItem(pos
);
341 m_cList
.DeleteItem(index
);
342 pos
= m_cList
.GetFirstSelectedItemPosition();
346 UINT
CImportPatchDlg::PatchThread()
349 path
.SetFromWin(g_Git
.m_CurrentDir
);
353 for(i
=m_CurrentItem
;i
<m_cList
.GetItemCount();i
++)
357 m_pTaskbarList
->SetProgressState(m_hWnd
, TBPF_NORMAL
);
358 m_pTaskbarList
->SetProgressValue(m_hWnd
, i
+ 1, m_cList
.GetItemCount());
361 m_cList
.SetItemData(i
, CPatchListCtrl::STATUS_APPLYING
|m_cList
.GetItemData(i
));
366 if(m_cList
.GetCheck(i
))
370 while(path
.HasRebaseApply())
373 m_pTaskbarList
->SetProgressState(m_hWnd
, TBPF_ERROR
);
375 int ret
= CMessageBox::Show(NULL
, _T("<ct=0x0000FF>previous rebase directory rebase-apply still exists but mbox given</ct>\n\n Do you want to"),
377 1,IDI_ERROR
,_T("&Abort"), _T("&Skip"),_T("&Resolved"));
382 cmd
= _T("git.exe am --abort");
385 cmd
= _T("git.exe am --skip");
389 cmd
= _T("git.exe am --resolved");
396 m_bExitThread
= TRUE
;
400 this->AddLogString(cmd
);
402 if(g_Git
.Run(cmd
, &output
, CP_ACP
))
404 this->AddLogString(output
);
405 this->AddLogString(_T("Fail"));
409 this->AddLogString(_T("Done"));
416 cmd
= _T("git.exe am ");
418 if(this->m_bAddSignedOffBy
)
419 cmd
+= _T("--signoff ");
422 cmd
+= _T("--3way ");
424 if(this->m_bIgnoreSpace
)
425 cmd
+= _T("--ignore-space-change ");
428 cmd
+= _T("--keep-cr ");
431 cmd
+= m_cList
.GetItemText(i
,0);
434 this->AddLogString(cmd
);
436 if(g_Git
.Run(cmd
,&output
,CP_ACP
))
438 //keep STATUS_APPLYING to let user retry failed patch
439 m_cList
.SetItemData(i
, CPatchListCtrl::STATUS_APPLY_FAIL
|CPatchListCtrl::STATUS_APPLYING
);
440 this->AddLogString(output
);
441 this->AddLogString(_T("Fail"));
443 m_pTaskbarList
->SetProgressState(m_hWnd
, TBPF_ERROR
);
449 m_cList
.SetItemData(i
, CPatchListCtrl::STATUS_APPLY_SUCCESS
);
450 this->AddLogString(_T("Success"));
456 AddLogString(CString(_T("Skip Patch: "))+m_cList
.GetItemText(i
,0));
457 m_cList
.SetItemData(i
, CPatchListCtrl::STATUS_APPLY_SKIP
);
460 m_cList
.SetItemData(m_CurrentItem
, (~CPatchListCtrl::STATUS_APPLYING
)&m_cList
.GetItemData(i
));
462 m_cList
.SetItemData(m_CurrentItem
, CPatchListCtrl::STATUS_APPLYING
|m_cList
.GetItemData(i
));
465 this->m_cList
.GetItemRect(i
,&rect
,LVIR_BOUNDS
);
466 this->m_cList
.InvalidateRect(rect
);
468 this->m_cList
.GetItemRect(m_CurrentItem
,&rect
,LVIR_BOUNDS
);
469 this->m_cList
.InvalidateRect(rect
);
472 m_pTaskbarList
->SetProgressState(m_hWnd
, TBPF_NOPROGRESS
);
474 UpdateOkCancelText();
477 //in case am fail, need refresh finial item status
479 this->m_cList
.GetItemRect(i
,&rect
,LVIR_BOUNDS
);
480 this->m_cList
.InvalidateRect(rect
);
482 this->m_cList
.GetItemRect(m_CurrentItem
,&rect
,LVIR_BOUNDS
);
483 this->m_cList
.InvalidateRect(rect
);
485 EnableInputCtrl(true);
486 InterlockedExchange(&m_bThreadRunning
, FALSE
);
487 UpdateOkCancelText();
491 void CImportPatchDlg::OnBnClickedOk()
504 m_ctrlTabCtrl
.SetActiveTab(1);
506 EnableInputCtrl(false);
507 InterlockedExchange(&m_bThreadRunning
, TRUE
);
508 InterlockedExchange(&this->m_bExitThread
, FALSE
);
509 if ( (m_LoadingThread
=AfxBeginThread(ThreadEntry
, this)) ==NULL
)
511 InterlockedExchange(&m_bThreadRunning
, FALSE
);
512 CMessageBox::Show(NULL
, IDS_ERR_THREADSTARTFAILED
, IDS_APPNAME
, MB_OK
| MB_ICONERROR
);
517 void CImportPatchDlg::DoSize(int delta
)
519 this->RemoveAllAnchors();
521 CSplitterControl::ChangeHeight(GetDlgItem(IDC_LIST_PATCH
), delta
, CW_TOPALIGN
);
522 //CSplitterControl::ChangeHeight(GetDlgItem(), delta, CW_TOPALIGN);
523 CSplitterControl::ChangeHeight(GetDlgItem(IDC_AM_TAB
), -delta
, CW_BOTTOMALIGN
);
524 //CSplitterControl::ChangeHeight(GetDlgItem(), -delta, CW_BOTTOMALIGN);
525 CSplitterControl::ChangePos(GetDlgItem(IDC_CHECK_3WAY
), 0, delta
);
526 CSplitterControl::ChangePos(GetDlgItem(IDC_CHECK_IGNORE_SPACE
), 0, delta
);
527 CSplitterControl::ChangePos(GetDlgItem(IDC_SIGN_OFF
), 0, delta
);
528 CSplitterControl::ChangePos(GetDlgItem(IDC_KEEP_CR
), 0, delta
);
531 // adjust the minimum size of the dialog to prevent the resizing from
532 // moving the list control too far down.
534 m_cList
.GetClientRect(rcLogMsg
);
535 SetMinTrackSize(CSize(m_DlgOrigRect
.Width(), m_DlgOrigRect
.Height()-m_PatchListOrigRect
.Height()+rcLogMsg
.Height()));
538 // m_CommitList.Invalidate();
540 // GetDlgItem(IDC_LOGMESSAGE)->Invalidate();
542 this->m_ctrlTabCtrl
.Invalidate();
545 void CImportPatchDlg::OnSize(UINT nType
, int cx
, int cy
)
547 CResizableStandAloneDialog::OnSize(nType
, cx
, cy
);
552 LRESULT
CImportPatchDlg::DefWindowProc(UINT message
, WPARAM wParam
, LPARAM lParam
)
556 if (wParam
== IDC_AM_SPLIT
)
558 SPC_NMHDR
* pHdr
= (SPC_NMHDR
*) lParam
;
564 return CResizableStandAloneDialog::DefWindowProc(message
, wParam
, lParam
);
567 void CImportPatchDlg::SaveSplitterPos()
571 CRegDWORD regPos
= CRegDWORD(_T("Software\\TortoiseGit\\TortoiseProc\\ResizableState\\AMDlgSizer"));
573 m_wndSplitter
.GetWindowRect(&rectSplitter
);
574 ScreenToClient(&rectSplitter
);
575 regPos
= rectSplitter
.top
;
581 void CImportPatchDlg::EnableInputCtrl(BOOL b
)
583 this->GetDlgItem(IDC_BUTTON_UP
)->EnableWindow(b
);
584 this->GetDlgItem(IDC_BUTTON_DOWN
)->EnableWindow(b
);
585 this->GetDlgItem(IDC_BUTTON_REMOVE
)->EnableWindow(b
);
586 this->GetDlgItem(IDC_BUTTON_ADD
)->EnableWindow(b
);
587 this->GetDlgItem(IDOK
)->EnableWindow(b
);
590 void CImportPatchDlg::UpdateOkCancelText()
594 this->GetDlgItem(IDOK
)->SetWindowText(_T("&Apply"));
598 this->GetDlgItem(IDOK
)->SetWindowText(_T("&OK"));
601 if(this->m_bThreadRunning
)
602 this->GetDlgItem(IDCANCEL
)->SetWindowText(_T("A&bort"));
604 this->GetDlgItem(IDCANCEL
)->SetWindowText(_T("&Cancel"));
607 void CImportPatchDlg::OnBnClickedCancel()
609 if(this->m_bThreadRunning
)
611 InterlockedExchange(&m_bExitThread
,TRUE
);
617 void CImportPatchDlg::AddLogString(CString str
)
619 this->m_wndOutput
.SendMessage(SCI_SETREADONLY
, FALSE
);
620 CStringA sTextA
= m_wndOutput
.StringForControl(str
);//CUnicodeUtils::GetUTF8(str);
621 this->m_wndOutput
.SendMessage(SCI_REPLACESEL
, 0, (LPARAM
)(LPCSTR
)sTextA
);
622 this->m_wndOutput
.SendMessage(SCI_REPLACESEL
, 0, (LPARAM
)(LPCSTR
)"\n");
623 this->m_wndOutput
.SendMessage(SCI_SETREADONLY
, TRUE
);
624 //this->m_wndOutput.SendMessage(SCI_LINESCROLL,0,0x7FFFFFFF);
626 BOOL
CImportPatchDlg::PreTranslateMessage(MSG
* pMsg
)
628 if (pMsg
->message
== WM_KEYDOWN
)
630 switch (pMsg
->wParam
)
633 /* Avoid TAB control destroy but dialog exist*/
638 ::GetClassName(pMsg
->hwnd
,buff
,128);
640 if(_tcsnicmp(buff
,_T("RichEdit20W"),128)==0 ||
641 _tcsnicmp(buff
,_T("Scintilla"),128)==0 ||
642 _tcsnicmp(buff
,_T("SysListView32"),128)==0||
643 ::GetParent(pMsg
->hwnd
) == this->m_ctrlTabCtrl
.m_hWnd
)
645 this->PostMessage(WM_KEYDOWN
,VK_ESCAPE
,0);
651 m_tooltips
.RelayEvent(pMsg
);
652 return CResizableStandAloneDialog::PreTranslateMessage(pMsg
);
655 void CImportPatchDlg::OnHdnItemchangedListPatch(NMHDR
* /*pNMHDR*/, LRESULT
*pResult
)
659 if(this->m_cList
.GetSelectedCount() != 1)
661 m_PatchCtrl
.SendMessage(SCI_SETREADONLY
, FALSE
);
662 m_PatchCtrl
.SetText(CString());
663 m_PatchCtrl
.SendMessage(SCI_SETREADONLY
, TRUE
);
670 pos
= m_cList
.GetFirstSelectedItemPosition();
671 int selected
= m_cList
.GetNextSelectedItem(pos
);
673 if(selected
>=0&& selected
< m_cList
.GetItemCount())
675 CString str
= m_cList
.GetItemText(selected
,0);
676 m_PatchCtrl
.SendMessage(SCI_SETREADONLY
, FALSE
);
677 m_PatchCtrl
.SetText(text
);
678 m_PatchCtrl
.LoadFromFile(str
);
679 m_PatchCtrl
.SendMessage(SCI_SETREADONLY
, TRUE
);
684 m_PatchCtrl
.SendMessage(SCI_SETREADONLY
, FALSE
);
685 m_PatchCtrl
.SetText(text
);
686 m_PatchCtrl
.SendMessage(SCI_SETREADONLY
, TRUE
);
691 LRESULT
CImportPatchDlg::OnTaskbarBtnCreated(WPARAM
/*wParam*/, LPARAM
/*lParam*/)
693 m_pTaskbarList
.Release();
694 m_pTaskbarList
.CoCreateInstance(CLSID_TaskbarList
);