Provide better readable error messages
[TortoiseGit.git] / src / TortoiseProc / ImportPatchDlg.h
blob20798ad5cb3f7a14ccee48cea2c0023106ce3c68
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 "GitLogList.h"
30 #include "MenuButton.h"
31 #include "Win7.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)
41 public:
42 CImportPatchDlg(CWnd* pParent = NULL); // standard constructor
43 virtual ~CImportPatchDlg();
45 int m_CurrentItem;
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();
57 UINT 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);
74 // Dialog Data
75 enum { IDD = IDD_APPLY_PATCH_LIST };
77 protected:
78 virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
79 virtual BOOL OnInitDialog();
81 CMFCTabCtrl m_ctrlTabCtrl;
83 CSciEdit m_PatchCtrl;
84 CSciEdit m_wndOutput;
85 CToolTips m_tooltips;
87 void AddAmAnchor();
88 void SetSplitterRange();
90 void DoSize(int delta);
91 void SaveSplitterPos();
93 CPatchListCtrl m_cList;
94 CRect m_DlgOrigRect;
95 CRect m_PatchListOrigRect;
97 CSplitterControl m_wndSplitter;
99 BOOL m_b3Way;
100 BOOL m_bIgnoreSpace;
101 BOOL m_bAddSignedOffBy;
102 BOOL m_bKeepCR;
104 BOOL IsFinish()
106 return !(m_CurrentItem < this->m_cList.GetItemCount());
109 DECLARE_MESSAGE_MAP()
110 public:
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);
123 protected:
124 virtual LRESULT DefWindowProc(UINT message, WPARAM wParam, LPARAM lParam);
126 afx_msg LRESULT OnTaskbarBtnCreated(WPARAM wParam, LPARAM lParam);
127 CComPtr<ITaskbarList3> m_pTaskbarList;
128 public:
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);