ENH: add a check to avoid quitting before rebuilding

This commit is contained in:
Bill Hoffman 2001-07-12 19:48:41 -04:00
parent df79a0bc47
commit ae25b63b6a
4 changed files with 41 additions and 9 deletions

View File

@ -108,6 +108,7 @@ BEGIN_MESSAGE_MAP(CMakeSetupDialog, CDialog)
ON_WM_SYSCOMMAND()
ON_WM_PAINT()
ON_WM_QUERYDRAGICON()
ON_BN_CLICKED(IDOK, OnOK)
ON_BN_CLICKED(IDC_BuildProjects, OnBuildProjects)
ON_CBN_EDITCHANGE(IDC_WhereBuild, OnChangeWhereBuild)
ON_CBN_EDITCHANGE(IDC_WhereSource, OnChangeWhereSource)
@ -444,6 +445,7 @@ void CMakeSetupDialog::OnBuildProjects()
m_BuildPathChanged = false;
// put the cursor back
::SetCursor(LoadCursor(NULL, IDC_ARROW));
m_CacheEntriesList.ClearDirty();
}
@ -658,3 +660,19 @@ void CMakeSetupDialog::OnGetMinMaxInfo( MINMAXINFO FAR* lpMMI )
lpMMI->ptMinTrackSize.y = 272;
}
void CMakeSetupDialog::OnOK()
{
if(m_CacheEntriesList.IsDirty())
{
if(MessageBox("You have changed options but not rebuilt, "
"are you sure you want to exit?", "Confirm Exit",
MB_YESNO) == IDYES)
{
CDialog::OnOK();
}
}
else
{
CDialog::OnOK();
}
}

View File

@ -68,6 +68,7 @@ protected:
//{{AFX_MSG(CMakeSetupDialog)
virtual BOOL OnInitDialog();
afx_msg void OnSysCommand(UINT nID, LPARAM lParam);
afx_msg void OnOK();
afx_msg void OnPaint();
afx_msg HCURSOR OnQueryDragIcon();
afx_msg void OnBrowseWhereSource();

View File

@ -143,8 +143,7 @@ int CPropertyList::AddProperty(const char* name,
{
pItem->m_curValue = value;
pItem->m_HelpString = helpString;
m_Dirty = true;
Invalidate();
InvalidateList();
}
return i;
}
@ -350,8 +349,11 @@ void CPropertyList::OnChangeEditBox()
m_editBox.GetWindowText(newStr);
CPropertyItem* pItem = (CPropertyItem*) GetItemDataPtr(m_curSel);
pItem->m_curValue = newStr;
m_Dirty = true;
if(pItem->m_curValue != newStr)
{
pItem->m_curValue = newStr;
m_Dirty = true;
}
}
void CPropertyList::OnCheckBox()
@ -408,7 +410,7 @@ void CPropertyList::OnButton()
cmSystemTools::ConvertToUnixSlashes(path);
pItem->m_curValue = path.c_str();
m_Dirty = true;
Invalidate();
InvalidateList();
}
}
else if (pItem->m_nItemType == CPropertyList::PATH)
@ -427,7 +429,7 @@ void CPropertyList::OnButton()
cmSystemTools::ConvertToUnixSlashes(path);
pItem->m_curValue = path.c_str();
m_Dirty = true;
Invalidate();
InvalidateList();
}
}
}
@ -579,7 +581,7 @@ void CPropertyList::OnDelete()
m_PropertyItems.erase(pItem);
delete pItem;
this->DeleteString(m_curSel);
Invalidate();
InvalidateList();
}
void CPropertyList::OnHelp()
@ -603,5 +605,12 @@ void CPropertyList::RemoveAll()
delete pItem;
this->DeleteString(0);
}
Invalidate();
InvalidateList();
}
void CPropertyList::InvalidateList()
{
Invalidate();
m_Dirty = true;
}

View File

@ -55,6 +55,9 @@ public:
// Operations
public:
bool IsDirty() { return m_Dirty; }
void ClearDirty() { m_Dirty = false; }
int AddItem(CString txt);
int AddProperty(const char* name,
const char* value,
@ -107,6 +110,7 @@ protected:
void InvertLine(CDC* pDC,CPoint ptFrom,CPoint ptTo);
void DisplayButton(CRect region);
int AddPropItem(CPropertyItem* pItem);
void InvalidateList();
CComboBox m_cmbBox;
CEdit m_editBox;