1 // TortoiseGit - a Windows shell extension for easy version control
3 // Copyright (C) 2008-2011, 2015 - 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"
31 #define MSG_REBASE_UPDATE_UI (WM_USER+151)
33 #define IDC_AM_TAB 0x1000100
35 class CImportPatchDlg
: public CResizableStandAloneDialog
37 DECLARE_DYNAMIC(CImportPatchDlg
)
40 CImportPatchDlg(CWnd
* pParent
= NULL
); // standard constructor
41 virtual ~CImportPatchDlg();
44 enum { IDD
= IDD_APPLY_PATCH_LIST
};
46 CTGitPathList m_PathList
;
51 volatile LONG m_bExitThread
;
52 volatile LONG m_bThreadRunning
;
54 CWinThread
* m_LoadingThread
;
56 static UINT
ThreadEntry(LPVOID pVoid
)
58 return ((CImportPatchDlg
*)pVoid
)->PatchThread();
63 void SafeTerminateThread()
65 if(m_LoadingThread
!=NULL
)
67 InterlockedExchange(&m_bExitThread
,TRUE
);
68 DWORD ret
=::WaitForSingleObject(m_LoadingThread
->m_hThread
,20000);
69 if(ret
== WAIT_TIMEOUT
)
70 ::TerminateThread(m_LoadingThread
,0);
71 m_LoadingThread
= NULL
;
72 InterlockedExchange(&m_bThreadRunning
, FALSE
);
76 void AddLogString(CString str
);
78 virtual void DoDataExchange(CDataExchange
* pDX
); // DDX/DDV support
79 virtual BOOL
OnInitDialog();
81 CMFCTabCtrl m_ctrlTabCtrl
;
87 void SetSplitterRange();
89 void DoSize(int delta
);
90 void SaveSplitterPos();
92 CPatchListCtrl m_cList
;
94 CRect m_PatchListOrigRect
;
96 CSplitterControl m_wndSplitter
;
100 BOOL m_bAddSignedOffBy
;
105 return !(m_CurrentItem
< this->m_cList
.GetItemCount());
108 DECLARE_MESSAGE_MAP()
110 afx_msg
void OnLbnSelchangeListPatch();
111 afx_msg
void OnBnClickedButtonAdd();
112 afx_msg
void OnBnClickedButtonUp();
113 afx_msg
void OnBnClickedButtonDown();
114 afx_msg
void OnBnClickedButtonRemove();
115 afx_msg
void OnBnClickedOk();
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
);
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
);
127 afx_msg
void OnHdnItemclickListPatch(NMHDR
*pNMHDR
, LRESULT
*pResult
);
128 afx_msg
void OnHdnItemchangingListPatch(NMHDR
*pNMHDR
, LRESULT
*pResult
);
129 afx_msg
void OnHdnItemchangedListPatch(NMHDR
*pNMHDR
, LRESULT
*pResult
);