3 #include "StandAloneDlg.h"
5 #include "MenuButton.h"
7 #define MSG_PROGRESSDLG_UPDATE_UI (WM_USER+121)
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
)
19 CProgressDlg(CWnd
* pParent
= NULL
); // standard constructor
20 virtual ~CProgressDlg();
21 virtual BOOL
OnInitDialog();
23 enum { IDD
= IDD_GITPROGRESS
};
25 std::vector
<CString
> m_GitCmdList
;
26 bool m_bAutoCloseOnSuccess
;
27 CStringArray m_PostCmdList
;
29 CMenuButton m_ctrlPostCmd
;
33 CProgressCtrl m_Progress
;
37 CAnimateCtrl m_Animate
;
38 CStatic m_CurrentWork
;
39 CWinThread
* m_pThread
;
40 volatile LONG m_bThreadRunning
;
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
48 bool m_bAltAbortPress
;
49 bool m_bBufferAll
; // Buffer All to improve speed when there are many file add at commit
51 virtual void DoDataExchange(CDataExchange
* pDX
); // DDX/DDV support
52 static UINT
ProgressThreadEntry(LPVOID pVoid
);
53 UINT
ProgressThread();
57 void ParserCmdOutput(char ch
);
58 void RemoveLastLine(CString
&str
);
60 LRESULT
CProgressDlg::OnProgressUpdateUI(WPARAM wParam
,LPARAM lParam
);
64 std::vector
<char> m_Databuf
;
65 virtual CString
Convert2UnionCode(char *buff
, int size
=-1)
68 g_Git
.StringAppend(&str
,(BYTE
*)buff
, CP_ACP
,size
);
74 void InsertCRLF(); //Insert \r before \n
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
97 CCommitProgressDlg(CWnd
* pParent
= NULL
):CProgressDlg(pParent
)
100 virtual CString
Convert2UnionCode(char *buff
, int size
=-1);