ENH: allow cancel and display of progress during cpu intensive configure steps
This commit is contained in:
parent
6566ba20ac
commit
b274069b93
|
@ -118,12 +118,40 @@ void updateProgress(const char *msg, float prog, void *cd)
|
|||
}
|
||||
CMakeSetupDialog *self = (CMakeSetupDialog *)cd;
|
||||
self->SetDlgItemText(IDC_PROGRESS, tmp);
|
||||
CWnd* cancel = self->GetDlgItem(IDCANCEL);
|
||||
//
|
||||
// Retrieve and dispatch any waiting messages.
|
||||
//
|
||||
MSG wmsg;
|
||||
while (::PeekMessage (&wmsg, NULL, 0, 0, PM_REMOVE))
|
||||
{
|
||||
switch(wmsg.message)
|
||||
{
|
||||
case WM_LBUTTONDOWN:
|
||||
case WM_LBUTTONUP:
|
||||
case WM_LBUTTONDBLCLK:
|
||||
{
|
||||
if(wmsg.hwnd == cancel->m_hWnd)
|
||||
{
|
||||
::DispatchMessage(&wmsg);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case WM_COMMAND:
|
||||
case WM_SETCURSOR:
|
||||
case WM_PAINT:
|
||||
::DispatchMessage(&wmsg);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
CMakeSetupDialog::CMakeSetupDialog(const CMakeCommandLineInfo& cmdInfo,
|
||||
CWnd* pParent /*=NULL*/)
|
||||
: CDialog(CMakeSetupDialog::IDD, pParent)
|
||||
{
|
||||
m_Cursor = LoadCursor(NULL, IDC_ARROW);
|
||||
m_RunningConfigure = false;
|
||||
cmSystemTools::SetRunCommandHideConsole(true);
|
||||
cmSystemTools::SetErrorCallback(MFCMessageCallback);
|
||||
m_RegistryKey = "Software\\Kitware\\CMakeSetup\\Settings\\StartPath";
|
||||
|
@ -208,7 +236,6 @@ BEGIN_MESSAGE_MAP(CMakeSetupDialog, CDialog)
|
|||
ON_WM_SYSCOMMAND()
|
||||
ON_WM_PAINT()
|
||||
ON_WM_QUERYDRAGICON()
|
||||
ON_WM_DROPFILES()
|
||||
ON_BN_CLICKED(IDC_BUTTON2, OnBrowseWhereSource)
|
||||
ON_BN_CLICKED(IDC_BuildProjects, OnConfigure)
|
||||
ON_BN_CLICKED(IDC_BUTTON3, OnBrowseWhereBuild)
|
||||
|
@ -221,9 +248,11 @@ BEGIN_MESSAGE_MAP(CMakeSetupDialog, CDialog)
|
|||
ON_BN_CLICKED(IDC_OK, OnOk)
|
||||
ON_CBN_EDITCHANGE(IDC_Generator, OnEditchangeGenerator)
|
||||
ON_BN_CLICKED(IDC_HELP_BUTTON, OnHelpButton)
|
||||
ON_BN_CLICKED(IDCANCEL, OnCancel)
|
||||
ON_BN_CLICKED(IDC_AdvancedValues, OnAdvancedValues)
|
||||
ON_BN_DOUBLECLICKED(IDC_AdvancedValues, OnDoubleclickedAdvancedValues)
|
||||
ON_WM_DROPFILES()
|
||||
ON_BN_CLICKED(IDCANCEL, OnCancel)
|
||||
ON_WM_SETCURSOR()
|
||||
//}}AFX_MSG_MAP
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
|
@ -606,7 +635,9 @@ void CMakeSetupDialog::RunCMake(bool generateProjectFiles)
|
|||
}
|
||||
}
|
||||
// set the wait cursor
|
||||
::SetCursor(LoadCursor(NULL, IDC_WAIT));
|
||||
m_Cursor = LoadCursor(NULL, IDC_WAIT);
|
||||
::SetCursor(m_Cursor);
|
||||
m_RunningConfigure = true;
|
||||
|
||||
// get all the info from the dialog
|
||||
this->UpdateData();
|
||||
|
@ -650,7 +681,9 @@ void CMakeSetupDialog::RunCMake(bool generateProjectFiles)
|
|||
// path is up-to-date now
|
||||
m_BuildPathChanged = false;
|
||||
// put the cursor back
|
||||
::SetCursor(LoadCursor(NULL, IDC_ARROW));
|
||||
m_Cursor = LoadCursor(NULL, IDC_ARROW);
|
||||
::SetCursor(m_Cursor);
|
||||
m_RunningConfigure = false;
|
||||
cmSystemTools::ResetErrorOccuredFlag();
|
||||
}
|
||||
|
||||
|
@ -1054,6 +1087,17 @@ void CMakeSetupDialog::OnGetMinMaxInfo( MINMAXINFO FAR* lpMMI )
|
|||
|
||||
void CMakeSetupDialog::OnCancel()
|
||||
{
|
||||
if(m_RunningConfigure)
|
||||
{
|
||||
if(MessageBox("You are in the middle of a Configure.\n"
|
||||
"If you Cancel now the configure information will be lost.\n"
|
||||
"Are you sure you want to Cancel?", "Confirm Exit",
|
||||
MB_YESNO) == IDYES)
|
||||
{
|
||||
cmSystemTools::SetFatalErrorOccured();
|
||||
}
|
||||
return;
|
||||
}
|
||||
if(m_CacheEntriesList.IsDirty())
|
||||
{
|
||||
if(MessageBox("You have changed options but not rebuilt, "
|
||||
|
@ -1395,3 +1439,9 @@ void CMakeSetupDialog::OnDropFiles(HDROP hDropInfo)
|
|||
|
||||
DragFinish(hDropInfo);
|
||||
}
|
||||
|
||||
BOOL CMakeSetupDialog::OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message)
|
||||
{
|
||||
::SetCursor(m_Cursor);
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -125,6 +125,7 @@ protected:
|
|||
afx_msg void OnAdvancedValues();
|
||||
afx_msg void OnDoubleclickedAdvancedValues();
|
||||
afx_msg void OnDropFiles(HDROP);
|
||||
afx_msg BOOL OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message);
|
||||
//}}AFX_MSG
|
||||
DECLARE_MESSAGE_MAP()
|
||||
|
||||
|
@ -132,6 +133,8 @@ protected:
|
|||
int m_oldCY;
|
||||
float m_deltaXRemainder;
|
||||
cmake *m_CMakeInstance;
|
||||
HCURSOR m_Cursor;
|
||||
bool m_RunningConfigure;
|
||||
};
|
||||
|
||||
//{{AFX_INSERT_LOCATION}}
|
||||
|
|
Loading…
Reference in New Issue