1
// TortoiseGit - a Windows shell extension for easy version control
3 // Copyright (C) 2008-2012, 2015-2020 - 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.
22 #include "StandAloneDlg.h"
24 #include "PatchListCtrl.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
)
38 CImportPatchDlg(CWnd
* pParent
= nullptr); // standard constructor
39 virtual ~CImportPatchDlg();
42 enum { IDD
= IDD_APPLY_PATCH_LIST
};
44 CTGitPathList m_PathList
;
49 volatile LONG m_bExitThread
;
50 volatile LONG m_bThreadRunning
;
52 CWinThread
* m_LoadingThread
;
54 static UINT
ThreadEntry(LPVOID pVoid
)
56 return static_cast<CImportPatchDlg
*>(pVoid
)->PatchThread();
61 void SafeTerminateThread()
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(const CString
& str
);
76 virtual void DoDataExchange(CDataExchange
* pDX
) override
; // DDX/DDV support
77 virtual BOOL
OnInitDialog() override
;
78 virtual void SetTheme(bool bDark
) override
;
80 CMFCTabCtrl m_ctrlTabCtrl
;
86 void SetSplitterRange();
88 void DoSize(int delta
);
89 void SaveSplitterPos();
91 CPatchListCtrl m_cList
;
93 CRect m_PatchListOrigRect
;
95 CSplitterControl m_wndSplitter
;
99 BOOL m_bAddSignedOffBy
;
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
) override
;
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
) override
;
126 afx_msg
void OnHdnItemchangedListPatch(NMHDR
*pNMHDR
, LRESULT
*pResult
);