Allow to clear filters with escape
[TortoiseGit.git] / src / TortoiseProc / ImportPatchDlg.h
blob07e0bae5817fdfdb8f6470c8fa1be529cae3f3f8
1 // TortoiseGit - a Windows shell extension for easy version control
3 // Copyright (C) 2008-2011, 2015-2016 - 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 #pragma once
22 #include "StandAloneDlg.h"
23 #include "TGitPath.h"
24 #include "PatchListCtrl.h"
25 #include "SciEdit.h"
26 #include "SplitterControl.h"
27 #include "HistoryCombo.h"
28 #include "Tooltip.h"
30 #define MSG_REBASE_UPDATE_UI (WM_USER+151)
32 #define IDC_AM_TAB 0x1000100
34 class CImportPatchDlg : public CResizableStandAloneDialog
36 DECLARE_DYNAMIC(CImportPatchDlg)
38 public:
39 CImportPatchDlg(CWnd* pParent = nullptr); // standard constructor
40 virtual ~CImportPatchDlg();
42 // Dialog Data
43 enum { IDD = IDD_APPLY_PATCH_LIST };
45 CTGitPathList m_PathList;
47 protected:
48 int m_CurrentItem;
50 volatile LONG m_bExitThread;
51 volatile LONG m_bThreadRunning;
53 CWinThread* m_LoadingThread;
55 static UINT ThreadEntry(LPVOID pVoid)
57 return ((CImportPatchDlg*)pVoid)->PatchThread();
60 UINT PatchThread();
62 void SafeTerminateThread()
64 if (m_LoadingThread)
66 InterlockedExchange(&m_bExitThread,TRUE);
67 DWORD ret =::WaitForSingleObject(m_LoadingThread->m_hThread,20000);
68 if(ret == WAIT_TIMEOUT)
69 ::TerminateThread(m_LoadingThread,0);
70 m_LoadingThread = nullptr;
71 InterlockedExchange(&m_bThreadRunning, FALSE);
75 void AddLogString(CString str);
77 virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
78 virtual BOOL OnInitDialog();
80 CMFCTabCtrl m_ctrlTabCtrl;
82 CSciEdit m_PatchCtrl;
83 CSciEdit m_wndOutput;
85 void AddAmAnchor();
86 void SetSplitterRange();
88 void DoSize(int delta);
89 void SaveSplitterPos();
91 CPatchListCtrl m_cList;
92 CRect m_DlgOrigRect;
93 CRect m_PatchListOrigRect;
95 CSplitterControl m_wndSplitter;
97 BOOL m_b3Way;
98 BOOL m_bIgnoreSpace;
99 BOOL m_bAddSignedOffBy;
100 BOOL m_bKeepCR;
102 BOOL IsFinish()
104 return !(m_CurrentItem < this->m_cList.GetItemCount());
107 DECLARE_MESSAGE_MAP()
109 afx_msg void OnLbnSelchangeListPatch();
110 afx_msg void OnBnClickedButtonAdd();
111 afx_msg void OnBnClickedButtonUp();
112 afx_msg void OnBnClickedButtonDown();
113 afx_msg void OnBnClickedButtonRemove();
114 afx_msg void OnBnClickedOk();
116 void EnableInputCtrl(BOOL b);
117 void UpdateOkCancelText();
119 afx_msg void OnSize(UINT nType, int cx, int cy);
120 virtual LRESULT DefWindowProc(UINT message, WPARAM wParam, LPARAM lParam);
122 afx_msg LRESULT OnTaskbarBtnCreated(WPARAM wParam, LPARAM lParam);
123 CComPtr<ITaskbarList3> m_pTaskbarList;
124 afx_msg void OnBnClickedCancel();
125 virtual BOOL PreTranslateMessage(MSG* pMsg);
126 afx_msg void OnHdnItemclickListPatch(NMHDR *pNMHDR, LRESULT *pResult);
127 afx_msg void OnHdnItemchangingListPatch(NMHDR *pNMHDR, LRESULT *pResult);
128 afx_msg void OnHdnItemchangedListPatch(NMHDR *pNMHDR, LRESULT *pResult);