ProgressDlg Post Cmd support menubutton
[TortoiseGit.git] / src / TortoiseProc / ProgressDlg.h
blob7c168ee87217283dbcd53bae3768d9a03df6aab0
1 #pragma once
3 #include "StandAloneDlg.h"
4 #include "git.h"
5 #include "MenuButton.h"
7 #define MSG_PROGRESSDLG_UPDATE_UI (WM_USER+121)
8 // CProgressDlg dialog
9 #define MSG_PROGRESSDLG_START 0
10 #define MSG_PROGRESSDLG_RUN 50
11 #define MSG_PROGRESSDLG_END 110
12 #define MSG_PROGRESSDLG_FAILED 111
14 class CProgressDlg : public CResizableStandAloneDialog
16 DECLARE_DYNAMIC(CProgressDlg)
18 public:
19 CProgressDlg(CWnd* pParent = NULL); // standard constructor
20 virtual ~CProgressDlg();
21 virtual BOOL OnInitDialog();
22 // Dialog Data
23 enum { IDD = IDD_GITPROGRESS };
24 CString m_GitCmd;
25 std::vector<CString> m_GitCmdList;
26 bool m_bAutoCloseOnSuccess;
27 CStringArray m_PostCmdList;
29 CMenuButton m_ctrlPostCmd;
31 CString m_LogFile;
33 CProgressCtrl m_Progress;
35 CRichEditCtrl m_Log;
36 CString m_Title;
37 CAnimateCtrl m_Animate;
38 CStatic m_CurrentWork;
39 CWinThread* m_pThread;
40 volatile LONG m_bThreadRunning;
41 DWORD m_GitStatus;
42 BOOL m_bShowCommand; // whether to display the command in the log window (default true)
43 CString m_PreText; // optional text to show in log window before running command
44 CString m_LogText;
46 bool m_bAbort;
47 bool m_bDone;
48 bool m_bAltAbortPress;
49 bool m_bBufferAll; // Buffer All to improve speed when there are many file add at commit
50 protected:
51 virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
52 static UINT ProgressThreadEntry(LPVOID pVoid);
53 UINT ProgressThread();
55 CStringA m_LogTextA;
57 void ParserCmdOutput(char ch);
58 void RemoveLastLine(CString &str);
60 LRESULT CProgressDlg::OnProgressUpdateUI(WPARAM wParam,LPARAM lParam);
62 void OnCancel();
64 std::vector<char> m_Databuf;
65 virtual CString Convert2UnionCode(char *buff, int size=-1)
67 CString str;
68 g_Git.StringAppend(&str,(BYTE*)buff, CP_ACP,size);
69 return str;
72 int m_BufStart;
74 void InsertCRLF(); //Insert \r before \n
76 DECLARE_MESSAGE_MAP()
77 public:
79 //Share with Sync Dailog
80 static int FindPercentage(CString &log);
82 static void ParserCmdOutput(CRichEditCtrl &log,CProgressCtrl &progressctrl,
83 CStringA &oneline, char ch,CWnd *CurrentWork=NULL);
85 static void InsertColorText(CRichEditCtrl &edit,CString text,COLORREF rgb);
87 static UINT RunCmdList(CWnd *pWnd,std::vector<CString> &cmdlist,bool bShowCommand,CString *pfilename,bool *bAbort,std::vector<char> *pdata=NULL);
89 afx_msg void OnBnClickedOk();
90 afx_msg void OnBnClickedButton1();
94 class CCommitProgressDlg:public CProgressDlg
96 public:
97 CCommitProgressDlg(CWnd* pParent = NULL):CProgressDlg(pParent)
100 virtual CString Convert2UnionCode(char *buff, int size=-1);