summaryrefslogtreecommitdiffstats
path: root/Source/MFCDialog
diff options
context:
space:
mode:
authorBill Hoffman <bill.hoffman@kitware.com>2001-07-12 23:48:41 (GMT)
committerBill Hoffman <bill.hoffman@kitware.com>2001-07-12 23:48:41 (GMT)
commitae25b63b6a9741eed5ded151e1a927fb619c0315 (patch)
treece03bcb7eccaa85a10a4440c60a65d68171fd240 /Source/MFCDialog
parentdf79a0bc471dff95453b4a33655b5c8f0a76c89a (diff)
downloadCMake-ae25b63b6a9741eed5ded151e1a927fb619c0315.zip
CMake-ae25b63b6a9741eed5ded151e1a927fb619c0315.tar.gz
CMake-ae25b63b6a9741eed5ded151e1a927fb619c0315.tar.bz2
ENH: add a check to avoid quitting before rebuilding
Diffstat (limited to 'Source/MFCDialog')
-rw-r--r--Source/MFCDialog/CMakeSetupDialog.cpp18
-rw-r--r--Source/MFCDialog/CMakeSetupDialog.h1
-rw-r--r--Source/MFCDialog/PropertyList.cpp23
-rw-r--r--Source/MFCDialog/PropertyList.h6
4 files changed, 40 insertions, 8 deletions
diff --git a/Source/MFCDialog/CMakeSetupDialog.cpp b/Source/MFCDialog/CMakeSetupDialog.cpp
index 5acfd57..7349644 100644
--- a/Source/MFCDialog/CMakeSetupDialog.cpp
+++ b/Source/MFCDialog/CMakeSetupDialog.cpp
@@ -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();
+ }
+}
diff --git a/Source/MFCDialog/CMakeSetupDialog.h b/Source/MFCDialog/CMakeSetupDialog.h
index 0a474b9..aa959d7 100644
--- a/Source/MFCDialog/CMakeSetupDialog.h
+++ b/Source/MFCDialog/CMakeSetupDialog.h
@@ -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();
diff --git a/Source/MFCDialog/PropertyList.cpp b/Source/MFCDialog/PropertyList.cpp
index 977b62f..d18f30e 100644
--- a/Source/MFCDialog/PropertyList.cpp
+++ b/Source/MFCDialog/PropertyList.cpp
@@ -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);
}
+ InvalidateList();
+}
+
+void CPropertyList::InvalidateList()
+{
Invalidate();
+ m_Dirty = true;
}
+
diff --git a/Source/MFCDialog/PropertyList.h b/Source/MFCDialog/PropertyList.h
index d54861d..235588b 100644
--- a/Source/MFCDialog/PropertyList.h
+++ b/Source/MFCDialog/PropertyList.h
@@ -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,7 +110,8 @@ 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;
CButton m_btnCtrl;