OSDN Git Service

ProgressDlg: Changed 'OK' into 'Close' and 'Cancel' into 'Abort'
[tortoisegit/TortoiseGitJp.git] / src / TortoiseProc / ProgressDlg.cpp
index 0335b44..ce8ff32 100644 (file)
@@ -11,7 +11,7 @@
 IMPLEMENT_DYNAMIC(CProgressDlg, CResizableStandAloneDialog)\r
 \r
 CProgressDlg::CProgressDlg(CWnd* pParent /*=NULL*/)\r
 IMPLEMENT_DYNAMIC(CProgressDlg, CResizableStandAloneDialog)\r
 \r
 CProgressDlg::CProgressDlg(CWnd* pParent /*=NULL*/)\r
-       : CResizableStandAloneDialog(CProgressDlg::IDD, pParent), m_bShowCommand(true), m_bAutoCloseOnSuccess(false)\r
+       : CResizableStandAloneDialog(CProgressDlg::IDD, pParent), m_bShowCommand(true), m_bAutoCloseOnSuccess(false), m_bAbort(false)\r
 {\r
 \r
 }\r
 {\r
 \r
 }\r
@@ -131,7 +131,7 @@ UINT CProgressDlg::ProgressThread()
                WaitForSingleObject(pi.hProcess, INFINITE);\r
                \r
                DWORD status=0;\r
                WaitForSingleObject(pi.hProcess, INFINITE);\r
                \r
                DWORD status=0;\r
-               if(!GetExitCodeProcess(pi.hProcess,&status))\r
+               if(!GetExitCodeProcess(pi.hProcess,&status) || m_bAbort)\r
                {\r
                        CloseHandle(pi.hProcess);\r
 \r
                {\r
                        CloseHandle(pi.hProcess);\r
 \r
@@ -164,8 +164,17 @@ LRESULT CProgressDlg::OnProgressUpdateUI(WPARAM wParam,LPARAM lParam)
                m_Animate.Stop();\r
                m_Progress.SetPos(100);\r
                this->DialogEnableWindow(IDOK,TRUE);\r
                m_Animate.Stop();\r
                m_Progress.SetPos(100);\r
                this->DialogEnableWindow(IDOK,TRUE);\r
-               if(m_bAutoCloseOnSuccess && wParam == MSG_PROGRESSDLG_END)\r
-                       EndDialog(IDOK);\r
+               if(wParam == MSG_PROGRESSDLG_END)\r
+               {\r
+                       if(m_bAutoCloseOnSuccess)\r
+                               EndDialog(IDOK);\r
+                       if(m_changeAbortButtonOnSuccessTo.IsEmpty())\r
+                       {\r
+                               GetDlgItem(IDCANCEL)->SetWindowText(m_changeAbortButtonOnSuccessTo);\r
+                       }\r
+               }\r
+               else\r
+                       DialogEnableWindow(IDCANCEL, FALSE);\r
        }\r
 \r
        if(lParam != 0)\r
        }\r
 \r
        if(lParam != 0)\r
@@ -244,3 +253,8 @@ void CProgressDlg::OnBnClickedOk()
        m_Log.GetWindowText(this->m_LogText);\r
        OnOK();\r
 }\r
        m_Log.GetWindowText(this->m_LogText);\r
        OnOK();\r
 }\r
+\r
+void CProgressDlg::OnCancel()\r
+{\r
+       m_bAbort = true;\r
+}\r