1
// TortoiseGit - a Windows shell extension for easy version control
3 // Copyright (C) 2008-2012, 2015-2018 - 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 reinterpret_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
;
79 CMFCTabCtrl m_ctrlTabCtrl
;
85 void SetSplitterRange();
87 void DoSize(int delta
);
88 void SaveSplitterPos();
90 CPatchListCtrl m_cList
;
92 CRect m_PatchListOrigRect
;
94 CSplitterControl m_wndSplitter
;
98 BOOL m_bAddSignedOffBy
;
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
);