Browse Source

ENH: change the logic of disabling the ok button a bit

Bill Hoffman 24 years ago
parent
commit
cb858f511e
2 changed files with 11 additions and 4 deletions
  1. 10 4
      Source/MFCDialog/CMakeSetupDialog.cpp
  2. 1 0
      Source/MFCDialog/PropertyList.cpp

+ 10 - 4
Source/MFCDialog/CMakeSetupDialog.cpp

@@ -164,7 +164,6 @@ BOOL CMakeSetupDialog::OnInitDialog()
           cmMakefile::GetMinorVersion());
   SetDlgItemText(IDC_CMAKE_VERSION, tmp);
   this->UpdateData(FALSE);
-  m_OKButton.EnableWindow(false);
   return TRUE;  // return TRUE  unless you set the focus to a control
 }
 
@@ -455,8 +454,6 @@ void CMakeSetupDialog::RunCMake(bool generateProjectFiles)
 void CMakeSetupDialog::OnConfigure() 
 {
   this->RunCMake(false);
-  // if cache has values then enb
-  m_OKButton.EnableWindow(true);
 }
 
 
@@ -519,6 +516,15 @@ void CMakeSetupDialog::FillCacheGUIFromCacheManager()
     }
   const cmCacheManager::CacheEntryMap &cache =
     cmCacheManager::GetInstance()->GetCacheMap();
+  if(cache.size() == 0)
+    {
+    m_OKButton.EnableWindow(false);
+    }
+  else
+    {
+    m_OKButton.EnableWindow(true);
+    }
+
   for(cmCacheManager::CacheEntryMap::const_iterator i = cache.begin();
       i != cache.end(); ++i)
     {
@@ -704,7 +710,7 @@ void CMakeSetupDialog::OnGetMinMaxInfo( MINMAXINFO FAR* lpMMI )
 
 void CMakeSetupDialog::OnCancel()
 {
-  if(m_OKButton.IsWindowEnabled())
+  if(m_CacheEntriesList.IsDirty())
     {
     if(MessageBox("You have changed options but not rebuilt, "
 		  "are you sure you want to exit?", "Confirm Exit",

+ 1 - 0
Source/MFCDialog/PropertyList.cpp

@@ -652,6 +652,7 @@ void CPropertyList::RemoveAll()
     delete pItem;
     this->DeleteString(0);
     }
+  m_Dirty = false;
   this->HideControls();
   InvalidateList();
 }