If there are submodule changes in the file list when resolving conflicts while rebasi...
[TortoiseGit.git] / src / TortoiseProc / ProgressDlg.h
blob20795da6ae51a1ccde370daad780fca360540009
1 // TortoiseGit - a Windows shell extension for easy version control
3 // Copyright (C) 2008-2012 - 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.
19 #pragma once
21 #include "StandAloneDlg.h"
22 #include "git.h"
23 #include "MenuButton.h"
24 #include "Win7.h"
26 #define MSG_PROGRESSDLG_UPDATE_UI (WM_USER+121)
28 // CProgressDlg dialog
29 #define MSG_PROGRESSDLG_START 0
30 #define MSG_PROGRESSDLG_RUN 50
31 #define MSG_PROGRESSDLG_END 110
32 #define MSG_PROGRESSDLG_FAILED 111
34 class CProgressDlg : public CResizableStandAloneDialog
36 DECLARE_DYNAMIC(CProgressDlg)
37 public:
38 typedef void (*PostCmdCallback)(CProgressDlg *dlg, void *caller, int result);
40 CProgressDlg(CWnd* pParent = NULL); // standard constructor
41 virtual ~CProgressDlg();
43 private:
44 virtual BOOL OnInitDialog();
46 // Dialog Data
47 enum { IDD = IDD_GITPROGRESS };
49 public:
50 CString m_Title;
51 CString m_GitCmd;
52 CStringArray m_PostCmdList;
53 CStringArray m_PostFailCmdList;
54 PostCmdCallback m_PostCmdCallback;
55 void * m_caller;
56 std::vector<CString> m_GitCmdList;
57 CString m_PreText; // optional text to show in log window before running command
58 bool m_bShowCommand; // whether to display the command in the log window (default true)
59 CString m_LogFile;
60 bool m_bBufferAll; // Buffer All to improve speed when there are many file add at commit
61 bool m_bAutoCloseOnSuccess;
63 DWORD m_GitStatus;
64 CString m_LogText;
66 private:
67 CMenuButton m_ctrlPostCmd;
69 CProgressCtrl m_Progress;
71 CRichEditCtrl m_Log;
72 CAnimateCtrl m_Animate;
73 CStatic m_CurrentWork;
74 CWinThread* m_pThread;
75 volatile LONG m_bThreadRunning;
77 bool m_bAbort;
78 bool m_bDone;
79 bool m_bAltAbortPress;
80 DWORD m_startTick;
82 virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
83 static UINT ProgressThreadEntry(LPVOID pVoid);
84 UINT ProgressThread();
86 CStringA m_LogTextA;
88 void ParserCmdOutput(char ch);
89 void RemoveLastLine(CString &str);
91 LRESULT OnProgressUpdateUI(WPARAM wParam,LPARAM lParam);
93 afx_msg LRESULT OnTaskbarBtnCreated(WPARAM wParam, LPARAM lParam);
94 CComPtr<ITaskbarList3> m_pTaskbarList;
96 void OnCancel();
97 afx_msg void OnClose();
98 void InsertCRLF(); //Insert \r before \n
99 void KillProcessTree(DWORD dwProcessId, unsigned int depth = 0);
101 CGitByteArray m_Databuf;
102 virtual CString Convert2UnionCode(char *buff, int size=-1)
104 CString str;
105 g_Git.StringAppend(&str, (BYTE*)buff, CP_UTF8, size);
106 return str;
109 int m_BufStart;
111 DECLARE_MESSAGE_MAP()
113 //Share with Sync Dailog
114 static int FindPercentage(CString &log);
116 static void ClearESC(CString &str);
118 public:
119 static void ParserCmdOutput(CRichEditCtrl &log,CProgressCtrl &progressctrl,HWND m_hWnd,CComPtr<ITaskbarList3> m_pTaskbarList,
120 CStringA &oneline, char ch,CWnd *CurrentWork=NULL);
122 static UINT RunCmdList(CWnd *pWnd,std::vector<CString> &cmdlist,bool bShowCommand,CString *pfilename,bool *bAbort,CGitByteArray *pdata=NULL);
124 static void InsertColorText(CRichEditCtrl &edit,CString text,COLORREF rgb);
126 private:
127 afx_msg void OnBnClickedOk();
128 afx_msg void OnBnClickedButton1();
130 virtual BOOL PreTranslateMessage(MSG* pMsg);
133 class CCommitProgressDlg:public CProgressDlg
135 public:
136 CCommitProgressDlg(CWnd* pParent = NULL):CProgressDlg(pParent)
140 virtual CString Convert2UnionCode(char *buff, int size=-1);