1 // TortoiseGit - a Windows shell extension for easy version control
3 // Copyright (C) 2008-2011 - 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"
23 // CImportPatchDlg dialog
25 #include "PatchListCtrl.h"
27 #include "SplitterControl.h"
28 #include "HistoryCombo.h"
29 #include "GitLogList.h"
30 #include "MenuButton.h"
33 #define MSG_REBASE_UPDATE_UI (WM_USER+151)
35 #define IDC_AM_TAB 0x1000100
37 class CImportPatchDlg
: public CResizableStandAloneDialog
39 DECLARE_DYNAMIC(CImportPatchDlg
)
42 CImportPatchDlg(CWnd
* pParent
= NULL
); // standard constructor
43 virtual ~CImportPatchDlg();
47 volatile LONG m_bExitThread
;
48 volatile LONG m_bThreadRunning
;
50 CWinThread
* m_LoadingThread
;
52 static UINT
ThreadEntry(LPVOID pVoid
)
54 return ((CImportPatchDlg
*)pVoid
)->PatchThread();
59 void SafeTerminateThread()
61 if(m_LoadingThread
!=NULL
)
63 InterlockedExchange(&m_bExitThread
,TRUE
);
64 DWORD ret
=::WaitForSingleObject(m_LoadingThread
->m_hThread
,20000);
65 if(ret
== WAIT_TIMEOUT
)
66 ::TerminateThread(m_LoadingThread
,0);
67 m_LoadingThread
= NULL
;
68 InterlockedExchange(&m_bThreadRunning
, FALSE
);
72 void AddLogString(CString str
);
75 enum { IDD
= IDD_APPLY_PATCH_LIST
};
78 virtual void DoDataExchange(CDataExchange
* pDX
); // DDX/DDV support
79 virtual BOOL
OnInitDialog();
81 CMFCTabCtrl m_ctrlTabCtrl
;
88 void SetSplitterRange();
90 void DoSize(int delta
);
91 void SaveSplitterPos();
93 CPatchListCtrl m_cList
;
95 CRect m_PatchListOrigRect
;
97 CSplitterControl m_wndSplitter
;
101 BOOL m_bAddSignedOffBy
;
106 return !(m_CurrentItem
< this->m_cList
.GetItemCount());
109 DECLARE_MESSAGE_MAP()
111 afx_msg
void OnLbnSelchangeListPatch();
112 afx_msg
void OnBnClickedButtonAdd();
113 afx_msg
void OnBnClickedButtonUp();
114 afx_msg
void OnBnClickedButtonDown();
115 afx_msg
void OnBnClickedButtonRemove();
116 afx_msg
void OnBnClickedOk();
118 void EnableInputCtrl(BOOL b
);
119 void UpdateOkCancelText();
121 CTGitPathList m_PathList
;
122 afx_msg
void OnSize(UINT nType
, int cx
, int cy
);
124 virtual LRESULT
DefWindowProc(UINT message
, WPARAM wParam
, LPARAM lParam
);
126 afx_msg LRESULT
OnTaskbarBtnCreated(WPARAM wParam
, LPARAM lParam
);
127 CComPtr
<ITaskbarList3
> m_pTaskbarList
;
129 afx_msg
void OnBnClickedCancel();
130 virtual BOOL
PreTranslateMessage(MSG
* pMsg
);
131 afx_msg
void OnHdnItemclickListPatch(NMHDR
*pNMHDR
, LRESULT
*pResult
);
132 afx_msg
void OnHdnItemchangingListPatch(NMHDR
*pNMHDR
, LRESULT
*pResult
);
133 afx_msg
void OnHdnItemchangedListPatch(NMHDR
*pNMHDR
, LRESULT
*pResult
);