Provide (experimental) clang-format file
[TortoiseGit.git] / src / TortoiseProc / ImportPatchDlg.h
blob76bcd04c82f112e52a4acaab9c3a44828e62effc
1 // TortoiseGit - a Windows shell extension for easy version control
3 // Copyright (C) 2008-2012, 2015-2017 - 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"
29 #define MSG_REBASE_UPDATE_UI (WM_USER+151)
31 #define IDC_AM_TAB 0x1000100
33 class CImportPatchDlg : public CResizableStandAloneDialog
35 DECLARE_DYNAMIC(CImportPatchDlg)
37 public:
38 CImportPatchDlg(CWnd* pParent = nullptr); // standard constructor
39 virtual ~CImportPatchDlg();
41 // Dialog Data
42 enum { IDD = IDD_APPLY_PATCH_LIST };
44 CTGitPathList m_PathList;
46 protected:
47 int m_CurrentItem;
49 volatile LONG m_bExitThread;
50 volatile LONG m_bThreadRunning;
52 CWinThread* m_LoadingThread;
54 static UINT ThreadEntry(LPVOID pVoid)
56 return reinterpret_cast<CImportPatchDlg*>(pVoid)->PatchThread();
59 UINT PatchThread();
61 void SafeTerminateThread()
63 if (m_LoadingThread)
65 InterlockedExchange(&m_bExitThread,TRUE);
66 DWORD ret =::WaitForSingleObject(m_LoadingThread->m_hThread,20000);
67 if(ret == WAIT_TIMEOUT)
68 ::TerminateThread(m_LoadingThread,0);
69 m_LoadingThread = nullptr;
70 InterlockedExchange(&m_bThreadRunning, FALSE);
74 void AddLogString(CString str);
76 virtual void DoDataExchange(CDataExchange* pDX) override; // DDX/DDV support
77 virtual BOOL OnInitDialog() override;
79 CMFCTabCtrl m_ctrlTabCtrl;
81 CSciEdit m_PatchCtrl;
82 CSciEdit m_wndOutput;
84 void AddAmAnchor();
85 void SetSplitterRange();
87 void DoSize(int delta);
88 void SaveSplitterPos();
90 CPatchListCtrl m_cList;
91 CRect m_DlgOrigRect;
92 CRect m_PatchListOrigRect;
94 CSplitterControl m_wndSplitter;
96 BOOL m_b3Way;
97 BOOL m_bIgnoreSpace;
98 BOOL m_bAddSignedOffBy;
99 BOOL m_bKeepCR;
101 BOOL IsFinish()
103 return !(m_CurrentItem < this->m_cList.GetItemCount());
106 DECLARE_MESSAGE_MAP()
108 afx_msg void OnLbnSelchangeListPatch();
109 afx_msg void OnBnClickedButtonAdd();
110 afx_msg void OnBnClickedButtonUp();
111 afx_msg void OnBnClickedButtonDown();
112 afx_msg void OnBnClickedButtonRemove();
113 afx_msg void OnBnClickedOk();
114 afx_msg void OnSysColorChange();
115 afx_msg LRESULT OnThemeChanged();
117 void EnableInputCtrl(BOOL b);
118 void UpdateOkCancelText();
120 afx_msg void OnSize(UINT nType, int cx, int cy);
121 virtual LRESULT DefWindowProc(UINT message, WPARAM wParam, LPARAM lParam) override;
123 afx_msg LRESULT OnTaskbarBtnCreated(WPARAM wParam, LPARAM lParam);
124 CComPtr<ITaskbarList3> m_pTaskbarList;
125 afx_msg void OnBnClickedCancel();
126 virtual BOOL PreTranslateMessage(MSG* pMsg) override;
127 afx_msg void OnHdnItemchangedListPatch(NMHDR *pNMHDR, LRESULT *pResult);