diff options
author | Bill Hoffman <bill.hoffman@kitware.com> | 2001-04-24 17:32:31 (GMT) |
---|---|---|
committer | Bill Hoffman <bill.hoffman@kitware.com> | 2001-04-24 17:32:31 (GMT) |
commit | 37468fad3aed3eb5116e42362d1b6f37adde595f (patch) | |
tree | a3b4aa6f418f3c0d4116c4549d1b4917abcc38ab | |
parent | 818b0e5bc1755d72e429ab89391254647c194eb5 (diff) | |
download | CMake-37468fad3aed3eb5116e42362d1b6f37adde595f.zip CMake-37468fad3aed3eb5116e42362d1b6f37adde595f.tar.gz CMake-37468fad3aed3eb5116e42362d1b6f37adde595f.tar.bz2 |
BUG: fix cache updates
-rw-r--r-- | Source/MFCDialog/CMakeSetupDialog.cpp | 30 | ||||
-rw-r--r-- | Source/MFCDialog/CMakeSetupDialog.h | 3 | ||||
-rw-r--r-- | Source/MFCDialog/PropertyList.cpp | 4 |
3 files changed, 29 insertions, 8 deletions
diff --git a/Source/MFCDialog/CMakeSetupDialog.cpp b/Source/MFCDialog/CMakeSetupDialog.cpp index 9d55322..add242b 100644 --- a/Source/MFCDialog/CMakeSetupDialog.cpp +++ b/Source/MFCDialog/CMakeSetupDialog.cpp @@ -96,6 +96,7 @@ CMakeSetupDialog::CMakeSetupDialog(CWnd* pParent /*=NULL*/) m_WhereSource = startPath; this->LoadFromRegistry(); m_InitMakefile = false; + m_GUIInitialized = false; this->InitMakefile(); } @@ -104,7 +105,13 @@ void CMakeSetupDialog::InitMakefile() { if(m_InitMakefile) { - return; + // if no change in source or build then + // do not re-init the m_Makefile + if(m_WhereSource == m_WhereSourceLast + && m_WhereBuild == m_WhereBuildLast) + { + return; + } } if(m_WhereBuild == "") { @@ -114,6 +121,10 @@ void CMakeSetupDialog::InitMakefile() { return; } + // save the values for these so we can detect + // when the GUI has changed them + m_WhereBuildLast = m_WhereBuild; + m_WhereSourceLast = m_WhereSource; m_InitMakefile = true; // set up the cmMakefile member m_Makefile.SetMakefileGenerator(new cmMSProjectGenerator); @@ -128,6 +139,11 @@ void CMakeSetupDialog::InitMakefile() m_Makefile.MakeStartDirectoriesCurrent(); // Create a string for the cache file cmCacheManager::GetInstance()->LoadCache(&m_Makefile); + // if the GUI is already up, then reset it to the loaded cache + if(m_GUIInitialized) + { + this->FillCacheEditorFromCacheManager(); + } } void CMakeSetupDialog::DoDataExchange(CDataExchange* pDX) @@ -187,6 +203,7 @@ BEGIN_MESSAGE_MAP(CMakeSetupDialog, CDialog) { this->FillCacheEditorFromCacheManager(); } + m_GUIInitialized = true; return TRUE; // return TRUE unless you set the focus to a control } @@ -365,9 +382,11 @@ void CMakeSetupDialog::LoadFromRegistry() void CMakeSetupDialog::OnBuildProjects() { + ::SetCursor(LoadCursor(NULL, IDC_WAIT)); // get all the info from the screen this->UpdateData(); - ::SetCursor(LoadCursor(NULL, IDC_WAIT)); + // re-init the m_Makefile + this->InitMakefile(); // copy the GUI cache values into the cache manager this->FillCacheManagerFromCacheEditor(); CString makefileIn = m_WhereSource; @@ -438,16 +457,17 @@ void CMakeSetupDialog::FillCacheManagerFromCacheEditor() for(std::list<CPropertyItem*>::iterator i = items.begin(); i != items.end(); ++i) { + CPropertyItem* item = *i; // check to see if the editor has removed the cache entry - if((*i)->m_Removed) + if(item->m_Removed) { cmCacheManager::GetInstance()->RemoveCacheEntry((*i)->m_propName); } else { cmCacheManager::CacheEntryMap::iterator p = - cache.find((const char*)(*i)->m_propName); - (*p).second.m_Value = (*i)->m_curValue; + cache.find((const char*)item->m_propName); + (*p).second.m_Value = item->m_curValue; } } } diff --git a/Source/MFCDialog/CMakeSetupDialog.h b/Source/MFCDialog/CMakeSetupDialog.h index 47c09d3..5b8a6cd 100644 --- a/Source/MFCDialog/CMakeSetupDialog.h +++ b/Source/MFCDialog/CMakeSetupDialog.h @@ -31,8 +31,11 @@ protected: enum { IDD = IDD_CMakeSetupDialog_DIALOG }; cmMakefile m_Makefile; bool m_InitMakefile; + bool m_GUIInitialized; CString m_WhereSource; CString m_WhereBuild; + CString m_WhereSourceLast; + CString m_WhereBuildLast; CPropertyList m_CacheEntriesList; //}}AFX_DATA diff --git a/Source/MFCDialog/PropertyList.cpp b/Source/MFCDialog/PropertyList.cpp index 5c69967..a4b2aea 100644 --- a/Source/MFCDialog/PropertyList.cpp +++ b/Source/MFCDialog/PropertyList.cpp @@ -144,10 +144,8 @@ int CPropertyList::AddProperty(const char* name, } } // if it is not found, then create a new one - int nIndex = AddString(_T("")); pItem = new CPropertyItem(name, value, type, comboItems); - SetItemDataPtr(nIndex,pItem); - return nIndex; + return this->AddPropItem(pItem); } int CPropertyList::OnCreate(LPCREATESTRUCT lpCreateStruct) |