Couple of changes: cache variables now have a map of properties. ADVANCED and HELPSTRING are now properties of cache variable, IsAdvanced is gone, so is GetCacheEntry, since cache entries are now all private. To access them, you use the iterator. -ADVANCED cache entries are gone and are replaced by the property of cache variables. The cache file still looks the same, but the -ADVANCED cache entries are created when writing file. MarkAsAdvanced and VariableRequires are fixed. So are curses gui and wizard

This commit is contained in:
Andy Cedilnik
2002-09-11 14:05:45 -04:00
parent bfdf8f7dcd
commit bef93dc5c1
12 changed files with 336 additions and 155 deletions
+47 -39
View File
@@ -117,9 +117,9 @@ void cmCursesMainForm::InitializeUI()
this->m_CMakeInstance->GetCacheManager()->NewIterator();
!i.IsAtEnd(); i.Next())
{
const cmCacheManager::CacheEntry& value = i.GetEntry();
if ( value.m_Type != cmCacheManager::INTERNAL &&
value.m_Type != cmCacheManager::STATIC )
if ( i.GetType() != cmCacheManager::INTERNAL &&
i.GetType() != cmCacheManager::STATIC &&
i.GetType() != cmCacheManager::UNINITIALIZED)
{
++count;
}
@@ -146,16 +146,16 @@ void cmCursesMainForm::InitializeUI()
!i.IsAtEnd(); i.Next())
{
const char* key = i.GetName();
const cmCacheManager::CacheEntry& value = i.GetEntry();
if ( value.m_Type == cmCacheManager::INTERNAL ||
value.m_Type == cmCacheManager::STATIC )
if ( i.GetType() == cmCacheManager::INTERNAL ||
i.GetType() == cmCacheManager::STATIC ||
i.GetType() == cmCacheManager::UNINITIALIZED )
{
continue;
}
if (!this->LookForCacheEntry(key))
{
newEntries->push_back(new cmCursesCacheEntryComposite(key, value,
newEntries->push_back(new cmCursesCacheEntryComposite(key, i,
true, 30,
entrywidth));
m_OkToGenerate = false;
@@ -168,16 +168,16 @@ void cmCursesMainForm::InitializeUI()
!i.IsAtEnd(); i.Next())
{
const char* key = i.GetName();
const cmCacheManager::CacheEntry& value = i.GetEntry();
if ( value.m_Type == cmCacheManager::INTERNAL ||
value.m_Type == cmCacheManager::STATIC )
if ( i.GetType() == cmCacheManager::INTERNAL ||
i.GetType() == cmCacheManager::STATIC ||
i.GetType() == cmCacheManager::UNINITIALIZED )
{
continue;
}
if (this->LookForCacheEntry(key))
{
newEntries->push_back(new cmCursesCacheEntryComposite(key, value,
newEntries->push_back(new cmCursesCacheEntryComposite(key, i,
false, 30,
entrywidth));
}
@@ -224,9 +224,9 @@ void cmCursesMainForm::RePost()
std::vector<cmCursesCacheEntryComposite*>::iterator it;
for (it = m_Entries->begin(); it != m_Entries->end(); ++it)
{
if (!m_AdvancedMode &&
this->m_CMakeInstance->GetCacheManager()->IsAdvanced(
(*it)->GetValue()))
cmCacheManager::CacheIterator mit =
this->m_CMakeInstance->GetCacheManager()->GetCacheIterator((*it)->GetValue());
if (mit.IsAtEnd() || !m_AdvancedMode && mit.GetPropertyAsBool("ADVANCED"))
{
continue;
}
@@ -243,8 +243,9 @@ void cmCursesMainForm::RePost()
std::vector<cmCursesCacheEntryComposite*>::iterator it;
for (it = m_Entries->begin(); it != m_Entries->end(); ++it)
{
if (!m_AdvancedMode &&
this->m_CMakeInstance->GetCacheManager()->IsAdvanced((*it)->GetValue()))
cmCacheManager::CacheIterator mit =
this->m_CMakeInstance->GetCacheManager()->GetCacheIterator((*it)->GetValue());
if (mit.IsAtEnd() || !m_AdvancedMode && mit.GetPropertyAsBool("ADVANCED"))
{
continue;
}
@@ -302,9 +303,10 @@ void cmCursesMainForm::Render(int left, int top, int width, int height)
std::vector<cmCursesCacheEntryComposite*>::iterator it;
for (it = m_Entries->begin(); it != m_Entries->end(); ++it)
{
if (!m_AdvancedMode && this->m_CMakeInstance->GetCacheManager()->IsAdvanced(
(*it)->GetValue()))
{
cmCacheManager::CacheIterator mit =
this->m_CMakeInstance->GetCacheManager()->GetCacheIterator((*it)->GetValue());
if (mit.IsAtEnd() || !m_AdvancedMode && mit.GetPropertyAsBool("ADVANCED"))
{
continue;
}
m_NumberOfVisibleEntries++;
@@ -318,8 +320,9 @@ void cmCursesMainForm::Render(int left, int top, int width, int height)
std::vector<cmCursesCacheEntryComposite*>::iterator it;
for (it = m_Entries->begin(); it != m_Entries->end(); ++it)
{
if (!m_AdvancedMode && this->m_CMakeInstance->GetCacheManager()->IsAdvanced(
(*it)->GetValue()))
cmCacheManager::CacheIterator mit =
this->m_CMakeInstance->GetCacheManager()->GetCacheIterator((*it)->GetValue());
if (mit.IsAtEnd() || !m_AdvancedMode && mit.GetPropertyAsBool("ADVANCED"))
{
continue;
}
@@ -453,14 +456,20 @@ void cmCursesMainForm::UpdateStatusBar()
// Get the help string of the current entry
// and add it to the help string
char help[128];
const char* helpString;
cmCacheManager::CacheEntry *entry =
this->m_CMakeInstance->GetCacheManager()->GetCacheEntry(curField);
if (entry)
cmCacheManager::CacheIterator it =
this->m_CMakeInstance->GetCacheManager()->GetCacheIterator(curField);
if (!it.IsAtEnd())
{
helpString = entry->m_HelpString.c_str();
strncpy(help, helpString, 127);
help[127] = '\0';
const char* hs = it.GetProperty("HELPSTRING");
if ( hs )
{
strncpy(help, hs, 127);
help[127] = '\0';
}
else
{
help[0] = 0;
}
}
else
{
@@ -686,23 +695,22 @@ void cmCursesMainForm::FillCacheManagerFromUI()
int size = m_Entries->size();
for(int i=0; i < size; i++)
{
cmCacheManager::CacheEntry *entry =
this->m_CMakeInstance->GetCacheManager()->GetCacheEntry(
cmCacheManager::CacheIterator it =
this->m_CMakeInstance->GetCacheManager()->GetCacheIterator(
(*m_Entries)[i]->m_Key.c_str());
if (entry)
if (!it.IsAtEnd())
{
tmpString = (*m_Entries)[i]->m_Entry->GetValue();
// Remove trailing spaces, convert path to unix slashes
std::string tmpSubString =
tmpString.substr(0,tmpString.find_last_not_of(" ")+1);
if ( entry->m_Type == cmCacheManager::PATH ||
entry->m_Type == cmCacheManager::FILEPATH )
if ( it.GetType() == cmCacheManager::PATH ||
it.GetType() == cmCacheManager::FILEPATH )
{
cmSystemTools::ConvertToUnixSlashes(tmpSubString);
}
entry->m_Value = tmpSubString;
it.SetValue(tmpSubString.c_str());
}
}
}
@@ -842,11 +850,11 @@ void cmCursesMainForm::HandleInput()
m_Fields[index-2]));
const char* curField = lbl->GetValue();
const char* helpString=0;
cmCacheManager::CacheEntry *entry =
this->m_CMakeInstance->GetCacheManager()->GetCacheEntry(curField);
if (entry)
cmCacheManager::CacheIterator it =
this->m_CMakeInstance->GetCacheManager()->GetCacheIterator(curField);
if (!it.IsAtEnd())
{
helpString = entry->m_HelpString.c_str();
helpString = it.GetProperty("HELPSTRING");
}
if (helpString)
{