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
);
238 this->GetDlgItem(IDC_BUTTON_UP
)->EnableWindow(TRUE
);
239 this->GetDlgItem(IDC_BUTTON_DOWN
)->EnableWindow(TRUE
);
240 this->GetDlgItem(IDC_BUTTON_REMOVE
)->EnableWindow(TRUE
);
244 void CImportPatchDlg::OnBnClickedButtonAdd()
246 CFileDialog
dlg(TRUE
,NULL
,
248 OFN_HIDEREADONLY
| OFN_OVERWRITEPROMPT
|OFN_ALLOWMULTISELECT
,
249 _T("Patch Files(*.patch)|*.patch|Diff Files(*.diff)|*.diff|All Files(*.*)|*.*||"));
250 if(dlg
.DoModal() == IDOK
)
253 pos
= dlg
.GetStartPosition();
256 CString file
= dlg
.GetNextPathName(pos
);
260 int index
= m_cList
.InsertItem(m_cList
.GetItemCount(), file
);
262 m_cList
.SetCheck(index
, true);
268 void CImportPatchDlg::OnBnClickedButtonUp()
271 pos
= m_cList
.GetFirstSelectedItemPosition();
273 // do nothing if the first selected item is the first item in the list
274 if (m_cList
.GetNextSelectedItem(pos
) == 0)
277 pos
= m_cList
.GetFirstSelectedItemPosition();
281 int index
= m_cList
.GetNextSelectedItem(pos
);
284 CString old
= m_cList
.GetItemText(index
, 0);
285 BOOL oldState
= m_cList
.GetCheck(index
);
286 m_cList
.DeleteItem(index
);
287 m_cList
.InsertItem(index
- 1, old
);
288 m_cList
.SetCheck(index
- 1, oldState
);
289 m_cList
.SetItemState(index
- 1, LVIS_SELECTED
, LVIS_SELECTED
);
290 m_cList
.SetItemState(index
, 0, LVIS_SELECTED
);
296 void CImportPatchDlg::OnBnClickedButtonDown()
298 if (m_cList
.GetSelectedCount() == 0)
302 pos
= m_cList
.GetFirstSelectedItemPosition();
303 // use an array to store all selected item indexes; the user won't select too much items
305 indexes
= new int[m_cList
.GetSelectedCount()];
309 indexes
[i
++] = m_cList
.GetNextSelectedItem(pos
);
312 // don't move any item if the last selected item is the last item in the m_CommitList
313 // (that would change the order of the selected items)
314 if(indexes
[m_cList
.GetSelectedCount() - 1] < m_cList
.GetItemCount() - 1)
316 // iterate over the indexes backwards in order to correctly move multiselected items
317 for (i
= m_cList
.GetSelectedCount() - 1; i
>= 0; i
--)
319 int index
= indexes
[i
];
320 CString old
= m_cList
.GetItemText(index
, 0);
321 BOOL oldState
= m_cList
.GetCheck(index
);
322 m_cList
.DeleteItem(index
);
323 m_cList
.InsertItem(index
+ 1, old
);
324 m_cList
.SetCheck(index
+ 1, oldState
);
325 m_cList
.SetItemState(index
+ 1, LVIS_SELECTED
, LVIS_SELECTED
);
326 m_cList
.SetItemState(index
, 0, LVIS_SELECTED
);
333 void CImportPatchDlg::OnBnClickedButtonRemove()
336 pos
= m_cList
.GetFirstSelectedItemPosition();
339 int index
= m_cList
.GetNextSelectedItem(pos
);
340 m_cList
.DeleteItem(index
);
341 pos
= m_cList
.GetFirstSelectedItemPosition();
345 UINT
CImportPatchDlg::PatchThread()
348 path
.SetFromWin(g_Git
.m_CurrentDir
);
352 for(i
=m_CurrentItem
;i
<m_cList
.GetItemCount();i
++)
356 m_pTaskbarList
->SetProgressState(m_hWnd
, TBPF_NORMAL
);
357 m_pTaskbarList
->SetProgressValue(m_hWnd
, i
+ 1, m_cList
.GetItemCount());
360 m_cList
.SetItemData(i
, CPatchListCtrl::STATUS_APPLYING
|m_cList
.GetItemData(i
));
365 if(m_cList
.GetCheck(i
))
369 while(path
.HasRebaseApply())
372 m_pTaskbarList
->SetProgressState(m_hWnd
, TBPF_ERROR
);
374 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"),
376 1,IDI_ERROR
,_T("&Abort"), _T("&Skip"),_T("&Resolved"));
381 cmd
= _T("git.exe am --abort");
384 cmd
= _T("git.exe am --skip");
388 cmd
= _T("git.exe am --resolved");
395 m_bExitThread
= TRUE
;
399 this->AddLogString(cmd
);
401 if(g_Git
.Run(cmd
, &output
, CP_ACP
))
403 this->AddLogString(output
);
404 this->AddLogString(_T("Fail"));
408 this->AddLogString(_T("Done"));
415 cmd
= _T("git.exe am ");
417 if(this->m_bAddSignedOffBy
)
418 cmd
+= _T("--signoff ");
421 cmd
+= _T("--3way ");
423 if(this->m_bIgnoreSpace
)
424 cmd
+= _T("--ignore-space-change ");
427 cmd
+= _T("--keep-cr ");
430 cmd
+= m_cList
.GetItemText(i
,0);
433 this->AddLogString(cmd
);
435 if(g_Git
.Run(cmd
,&output
,CP_ACP
))
437 //keep STATUS_APPLYING to let user retry failed patch
438 m_cList
.SetItemData(i
, CPatchListCtrl::STATUS_APPLY_FAIL
|CPatchListCtrl::STATUS_APPLYING
);
439 this->AddLogString(output
);
440 this->AddLogString(_T("Fail"));
442 m_pTaskbarList
->SetProgressState(m_hWnd
, TBPF_ERROR
);
448 m_cList
.SetItemData(i
, CPatchListCtrl::STATUS_APPLY_SUCCESS
);
449 this->AddLogString(_T("Success"));
454 AddLogString(CString(_T("Skip Patch: "))+m_cList
.GetItemText(i
,0));
455 m_cList
.SetItemData(i
, CPatchListCtrl::STATUS_APPLY_SKIP
);
458 m_cList
.SetItemData(m_CurrentItem
, (~CPatchListCtrl::STATUS_APPLYING
)&m_cList
.GetItemData(i
));
460 m_cList
.SetItemData(m_CurrentItem
, CPatchListCtrl::STATUS_APPLYING
|m_cList
.GetItemData(i
));
463 this->m_cList
.GetItemRect(i
,&rect
,LVIR_BOUNDS
);
464 this->m_cList
.InvalidateRect(rect
);
466 this->m_cList
.GetItemRect(m_CurrentItem
,&rect
,LVIR_BOUNDS
);
467 this->m_cList
.InvalidateRect(rect
);
470 m_pTaskbarList
->SetProgressState(m_hWnd
, TBPF_NOPROGRESS
);
472 UpdateOkCancelText();
475 //in case am fail, need refresh finial item status
477 this->m_cList
.GetItemRect(i
,&rect
,LVIR_BOUNDS
);
478 this->m_cList
.InvalidateRect(rect
);
480 this->m_cList
.GetItemRect(m_CurrentItem
,&rect
,LVIR_BOUNDS
);
481 this->m_cList
.InvalidateRect(rect
);
483 EnableInputCtrl(true);
484 InterlockedExchange(&m_bThreadRunning
, FALSE
);
485 UpdateOkCancelText();
489 void CImportPatchDlg::OnBnClickedOk()
502 m_ctrlTabCtrl
.SetActiveTab(1);
504 EnableInputCtrl(false);
505 InterlockedExchange(&m_bThreadRunning
, TRUE
);
506 InterlockedExchange(&this->m_bExitThread
, FALSE
);
507 if ( (m_LoadingThread
=AfxBeginThread(ThreadEntry
, this)) ==NULL
)
509 InterlockedExchange(&m_bThreadRunning
, FALSE
);
510 CMessageBox::Show(NULL
, IDS_ERR_THREADSTARTFAILED
, IDS_APPNAME
, MB_OK
| MB_ICONERROR
);
515 void CImportPatchDlg::DoSize(int delta
)
517 this->RemoveAllAnchors();
519 CSplitterControl::ChangeHeight(GetDlgItem(IDC_LIST_PATCH
), delta
, CW_TOPALIGN
);
520 //CSplitterControl::ChangeHeight(GetDlgItem(), delta, CW_TOPALIGN);
521 CSplitterControl::ChangeHeight(GetDlgItem(IDC_AM_TAB
), -delta
, CW_BOTTOMALIGN
);
522 //CSplitterControl::ChangeHeight(GetDlgItem(), -delta, CW_BOTTOMALIGN);
523 CSplitterControl::ChangePos(GetDlgItem(IDC_CHECK_3WAY
), 0, delta
);
524 CSplitterControl::ChangePos(GetDlgItem(IDC_CHECK_IGNORE_SPACE
), 0, delta
);
525 CSplitterControl::ChangePos(GetDlgItem(IDC_SIGN_OFF
), 0, delta
);
526 CSplitterControl::ChangePos(GetDlgItem(IDC_KEEP_CR
), 0, delta
);
529 // adjust the minimum size of the dialog to prevent the resizing from
530 // moving the list control too far down.
532 m_cList
.GetClientRect(rcLogMsg
);
533 SetMinTrackSize(CSize(m_DlgOrigRect
.Width(), m_DlgOrigRect
.Height()-m_PatchListOrigRect
.Height()+rcLogMsg
.Height()));
536 // m_CommitList.Invalidate();
538 // GetDlgItem(IDC_LOGMESSAGE)->Invalidate();
540 this->m_ctrlTabCtrl
.Invalidate();
543 void CImportPatchDlg::OnSize(UINT nType
, int cx
, int cy
)
545 CResizableStandAloneDialog::OnSize(nType
, cx
, cy
);
550 LRESULT
CImportPatchDlg::DefWindowProc(UINT message
, WPARAM wParam
, LPARAM lParam
)
554 if (wParam
== IDC_AM_SPLIT
)
556 SPC_NMHDR
* pHdr
= (SPC_NMHDR
*) lParam
;
562 return CResizableStandAloneDialog::DefWindowProc(message
, wParam
, lParam
);
565 void CImportPatchDlg::SaveSplitterPos()
569 CRegDWORD regPos
= CRegDWORD(_T("Software\\TortoiseGit\\TortoiseProc\\ResizableState\\AMDlgSizer"));
571 m_wndSplitter
.GetWindowRect(&rectSplitter
);
572 ScreenToClient(&rectSplitter
);
573 regPos
= rectSplitter
.top
;
579 void CImportPatchDlg::EnableInputCtrl(BOOL b
)
581 this->GetDlgItem(IDC_BUTTON_UP
)->EnableWindow(b
);
582 this->GetDlgItem(IDC_BUTTON_DOWN
)->EnableWindow(b
);
583 this->GetDlgItem(IDC_BUTTON_REMOVE
)->EnableWindow(b
);
584 this->GetDlgItem(IDC_BUTTON_ADD
)->EnableWindow(b
);
585 this->GetDlgItem(IDOK
)->EnableWindow(b
);
588 void CImportPatchDlg::UpdateOkCancelText()
592 this->GetDlgItem(IDOK
)->SetWindowText(_T("&Apply"));
596 this->GetDlgItem(IDOK
)->SetWindowText(_T("&OK"));
599 if(this->m_bThreadRunning
)
600 this->GetDlgItem(IDCANCEL
)->SetWindowText(_T("A&bort"));
602 this->GetDlgItem(IDCANCEL
)->SetWindowText(_T("&Cancel"));
605 void CImportPatchDlg::OnBnClickedCancel()
607 if(this->m_bThreadRunning
)
609 InterlockedExchange(&m_bExitThread
,TRUE
);
615 void CImportPatchDlg::AddLogString(CString str
)
617 this->m_wndOutput
.SendMessage(SCI_SETREADONLY
, FALSE
);
618 CStringA sTextA
= m_wndOutput
.StringForControl(str
);//CUnicodeUtils::GetUTF8(str);
619 this->m_wndOutput
.SendMessage(SCI_REPLACESEL
, 0, (LPARAM
)(LPCSTR
)sTextA
);
620 this->m_wndOutput
.SendMessage(SCI_REPLACESEL
, 0, (LPARAM
)(LPCSTR
)"\n");
621 this->m_wndOutput
.SendMessage(SCI_SETREADONLY
, TRUE
);
622 //this->m_wndOutput.SendMessage(SCI_LINESCROLL,0,0x7FFFFFFF);
624 BOOL
CImportPatchDlg::PreTranslateMessage(MSG
* pMsg
)
626 if (pMsg
->message
== WM_KEYDOWN
)
628 switch (pMsg
->wParam
)
631 /* Avoid TAB control destroy but dialog exist*/
636 ::GetClassName(pMsg
->hwnd
,buff
,128);
638 if(_tcsnicmp(buff
,_T("RichEdit20W"),128)==0 ||
639 _tcsnicmp(buff
,_T("Scintilla"),128)==0 ||
640 _tcsnicmp(buff
,_T("SysListView32"),128)==0||
641 ::GetParent(pMsg
->hwnd
) == this->m_ctrlTabCtrl
.m_hWnd
)
643 this->PostMessage(WM_KEYDOWN
,VK_ESCAPE
,0);
649 m_tooltips
.RelayEvent(pMsg
);
650 return CResizableStandAloneDialog::PreTranslateMessage(pMsg
);
653 void CImportPatchDlg::OnHdnItemchangedListPatch(NMHDR
* /*pNMHDR*/, LRESULT
*pResult
)
657 if(this->m_cList
.GetSelectedCount() != 1)
659 m_PatchCtrl
.SendMessage(SCI_SETREADONLY
, FALSE
);
660 m_PatchCtrl
.SetText(CString());
661 m_PatchCtrl
.SendMessage(SCI_SETREADONLY
, TRUE
);
668 pos
= m_cList
.GetFirstSelectedItemPosition();
669 int selected
= m_cList
.GetNextSelectedItem(pos
);
671 if(selected
>=0&& selected
< m_cList
.GetItemCount())
673 CString str
= m_cList
.GetItemText(selected
,0);
674 m_PatchCtrl
.SendMessage(SCI_SETREADONLY
, FALSE
);
675 m_PatchCtrl
.SetText(text
);
676 m_PatchCtrl
.LoadFromFile(str
);
677 m_PatchCtrl
.SendMessage(SCI_SETREADONLY
, TRUE
);
682 m_PatchCtrl
.SendMessage(SCI_SETREADONLY
, FALSE
);
683 m_PatchCtrl
.SetText(text
);
684 m_PatchCtrl
.SendMessage(SCI_SETREADONLY
, TRUE
);
689 LRESULT
CImportPatchDlg::OnTaskbarBtnCreated(WPARAM
/*wParam*/, LPARAM
/*lParam*/)
691 m_pTaskbarList
.Release();
692 m_pTaskbarList
.CoCreateInstance(CLSID_TaskbarList
);