TortoiseSVN -> TortoiseGit
[TortoiseGit.git] / src / TortoiseProc / ImportPatchDlg.h
blobe2be4f85ae44e35e9b6000087f3a226a8f3ae6ff
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.
20 #pragma once
22 #include "StandAloneDlg.h"
23 // CImportPatchDlg dialog
24 #include "TGitPath.h"
25 #include "PatchListCtrl.h"
26 #include "SciEdit.h"
27 #include "SplitterControl.h"
28 #include "HistoryCombo.h"
29 #include "Balloon.h"
30 #include "GitLogList.h"
31 #include "MenuButton.h"
32 #include "Win7.h"
34 #define MSG_REBASE_UPDATE_UI (WM_USER+151)
36 #define IDC_AM_TAB 0x1000100
38 class CImportPatchDlg : public CResizableStandAloneDialog
40 DECLARE_DYNAMIC(CImportPatchDlg)
42 public:
43 CImportPatchDlg(CWnd* pParent = NULL); // standard constructor
44 virtual ~CImportPatchDlg();
46 int m_CurrentItem;
48 volatile LONG m_bExitThread;
49 volatile LONG m_bThreadRunning;
51 CWinThread* m_LoadingThread;
53 static UINT ThreadEntry(LPVOID pVoid)
55 return ((CImportPatchDlg*)pVoid)->PatchThread();
58 UINT PatchThread();
60 void SafeTerminateThread()
62 if(m_LoadingThread!=NULL)
64 InterlockedExchange(&m_bExitThread,TRUE);
65 DWORD ret =::WaitForSingleObject(m_LoadingThread->m_hThread,20000);
66 if(ret == WAIT_TIMEOUT)
67 ::TerminateThread(m_LoadingThread,0);
68 m_LoadingThread = NULL;
69 InterlockedExchange(&m_bThreadRunning, FALSE);
73 void AddLogString(CString str);
75 // Dialog Data
76 enum { IDD = IDD_APPLY_PATCH_LIST };
78 protected:
79 virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
80 virtual BOOL OnInitDialog();
82 CMFCTabCtrl m_ctrlTabCtrl;
84 CSciEdit m_PatchCtrl;
85 CSciEdit m_wndOutput;
86 CToolTips m_tooltips;
88 void AddAmAnchor();
89 void SetSplitterRange();
91 void DoSize(int delta);
92 void SaveSplitterPos();
94 CPatchListCtrl m_cList;
95 CRect m_DlgOrigRect;
96 CRect m_PatchListOrigRect;
98 CSplitterControl m_wndSplitter;
100 BOOL m_b3Way;
101 BOOL m_bIgnoreSpace;
102 BOOL m_bAddSignedOffBy;
103 BOOL m_bKeepCR;
105 BOOL IsFinish()
107 return !(m_CurrentItem < this->m_cList.GetItemCount());
110 DECLARE_MESSAGE_MAP()
111 public:
112 afx_msg void OnLbnSelchangeListPatch();
113 afx_msg void OnBnClickedButtonAdd();
114 afx_msg void OnBnClickedButtonUp();
115 afx_msg void OnBnClickedButtonDown();
116 afx_msg void OnBnClickedButtonRemove();
117 afx_msg void OnBnClickedOk();
119 void EnableInputCtrl(BOOL b);
120 void UpdateOkCancelText();
122 CTGitPathList m_PathList;
123 afx_msg void OnSize(UINT nType, int cx, int cy);
124 protected:
125 virtual LRESULT DefWindowProc(UINT message, WPARAM wParam, LPARAM lParam);
127 afx_msg LRESULT OnTaskbarBtnCreated(WPARAM wParam, LPARAM lParam);
128 CComPtr<ITaskbarList3> m_pTaskbarList;
129 public:
130 afx_msg void OnBnClickedCancel();
131 virtual BOOL PreTranslateMessage(MSG* pMsg);
132 afx_msg void OnHdnItemclickListPatch(NMHDR *pNMHDR, LRESULT *pResult);
133 afx_msg void OnHdnItemchangingListPatch(NMHDR *pNMHDR, LRESULT *pResult);
134 afx_msg void OnHdnItemchangedListPatch(NMHDR *pNMHDR, LRESULT *pResult);