Fix MFC GUI
This commit is contained in:
parent
62d654abae
commit
c41fe4f179
@ -654,13 +654,12 @@ void CMakeSetupDialog::OnChangeWhereBuild()
|
|||||||
cache_file += "/CMakeCache.txt";
|
cache_file += "/CMakeCache.txt";
|
||||||
|
|
||||||
cmCacheManager *cachem = this->m_CMakeInstance->GetCacheManager();
|
cmCacheManager *cachem = this->m_CMakeInstance->GetCacheManager();
|
||||||
|
cmCacheManager::CacheIterator it = cachem->NewIterator();
|
||||||
if (cmSystemTools::FileExists(cache_file.c_str()) &&
|
if (cmSystemTools::FileExists(cache_file.c_str()) &&
|
||||||
cachem->LoadCache(path.c_str()) &&
|
cachem->LoadCache(path.c_str()) &&
|
||||||
cachem->GetCacheEntry("CMAKE_HOME_DIRECTORY"))
|
it.Find("CMAKE_HOME_DIRECTORY"))
|
||||||
{
|
{
|
||||||
path = ConvertToWindowsPath(
|
path = ConvertToWindowsPath(it.GetValue());
|
||||||
cachem->GetCacheEntry("CMAKE_HOME_DIRECTORY")->m_Value.c_str());
|
|
||||||
this->m_WhereSource = path.c_str();
|
this->m_WhereSource = path.c_str();
|
||||||
this->m_WhereSourceControl.SetWindowText(this->m_WhereSource);
|
this->m_WhereSourceControl.SetWindowText(this->m_WhereSource);
|
||||||
this->OnChangeWhereSource();
|
this->OnChangeWhereSource();
|
||||||
@ -698,33 +697,33 @@ void CMakeSetupDialog::FillCacheGUIFromCacheManager()
|
|||||||
!i.IsAtEnd(); i.Next())
|
!i.IsAtEnd(); i.Next())
|
||||||
{
|
{
|
||||||
const char* key = i.GetName();
|
const char* key = i.GetName();
|
||||||
cmCacheManager::CacheEntry value = i.GetEntry();
|
|
||||||
|
|
||||||
// if value has trailing space or tab, enclose it in single quotes
|
// if value has trailing space or tab, enclose it in single quotes
|
||||||
// to enforce the fact that it has 'invisible' trailing stuff
|
// to enforce the fact that it has 'invisible' trailing stuff
|
||||||
if (value.m_Value.size() &&
|
std::string value = i.GetValue();
|
||||||
(value.m_Value[value.m_Value.size() - 1] == ' ' ||
|
if (value.size() &&
|
||||||
value.m_Value[value.m_Value.size() - 1] == '\t'))
|
(value[value.size() - 1] == ' ' ||
|
||||||
|
value[value.size() - 1] == '\t'))
|
||||||
{
|
{
|
||||||
value.m_Value = '\'' + value.m_Value + '\'';
|
value = '\'' + value + '\'';
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!m_AdvancedValues)
|
if(!m_AdvancedValues)
|
||||||
{
|
{
|
||||||
if(cachem->IsAdvanced(key))
|
if(i.GetPropertyAsBool("ADVANCED"))
|
||||||
{
|
{
|
||||||
m_CacheEntriesList.RemoveProperty(key);
|
m_CacheEntriesList.RemoveProperty(key);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
switch(value.m_Type )
|
switch(i.GetType() )
|
||||||
{
|
{
|
||||||
case cmCacheManager::BOOL:
|
case cmCacheManager::BOOL:
|
||||||
if(cmSystemTools::IsOn(value.m_Value.c_str()))
|
if(cmSystemTools::IsOn(value.c_str()))
|
||||||
{
|
{
|
||||||
m_CacheEntriesList.AddProperty(key,
|
m_CacheEntriesList.AddProperty(key,
|
||||||
"ON",
|
"ON",
|
||||||
value.m_HelpString.c_str(),
|
i.GetProperty("HELPSTRING"),
|
||||||
CPropertyList::COMBO,"ON|OFF",
|
CPropertyList::COMBO,"ON|OFF",
|
||||||
reverseOrder
|
reverseOrder
|
||||||
);
|
);
|
||||||
@ -733,7 +732,7 @@ void CMakeSetupDialog::FillCacheGUIFromCacheManager()
|
|||||||
{
|
{
|
||||||
m_CacheEntriesList.AddProperty(key,
|
m_CacheEntriesList.AddProperty(key,
|
||||||
"OFF",
|
"OFF",
|
||||||
value.m_HelpString.c_str(),
|
i.GetProperty("HELPSTRING"),
|
||||||
CPropertyList::COMBO,"ON|OFF",
|
CPropertyList::COMBO,"ON|OFF",
|
||||||
reverseOrder
|
reverseOrder
|
||||||
);
|
);
|
||||||
@ -741,24 +740,24 @@ void CMakeSetupDialog::FillCacheGUIFromCacheManager()
|
|||||||
break;
|
break;
|
||||||
case cmCacheManager::PATH:
|
case cmCacheManager::PATH:
|
||||||
m_CacheEntriesList.AddProperty(key,
|
m_CacheEntriesList.AddProperty(key,
|
||||||
value.m_Value.c_str(),
|
value.c_str(),
|
||||||
value.m_HelpString.c_str(),
|
i.GetProperty("HELPSTRING"),
|
||||||
CPropertyList::PATH,"",
|
CPropertyList::PATH,"",
|
||||||
reverseOrder
|
reverseOrder
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
case cmCacheManager::FILEPATH:
|
case cmCacheManager::FILEPATH:
|
||||||
m_CacheEntriesList.AddProperty(key,
|
m_CacheEntriesList.AddProperty(key,
|
||||||
value.m_Value.c_str(),
|
value.c_str(),
|
||||||
value.m_HelpString.c_str(),
|
i.GetProperty("HELPSTRING"),
|
||||||
CPropertyList::FILE,"",
|
CPropertyList::FILE,"",
|
||||||
reverseOrder
|
reverseOrder
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
case cmCacheManager::STRING:
|
case cmCacheManager::STRING:
|
||||||
m_CacheEntriesList.AddProperty(key,
|
m_CacheEntriesList.AddProperty(key,
|
||||||
value.m_Value.c_str(),
|
value.c_str(),
|
||||||
value.m_HelpString.c_str(),
|
i.GetProperty("HELPSTRING"),
|
||||||
CPropertyList::EDIT,"",
|
CPropertyList::EDIT,"",
|
||||||
reverseOrder
|
reverseOrder
|
||||||
);
|
);
|
||||||
@ -800,13 +799,12 @@ void CMakeSetupDialog::FillCacheManagerFromCacheGUI()
|
|||||||
{
|
{
|
||||||
cmCacheManager *cachem = this->m_CMakeInstance->GetCacheManager();
|
cmCacheManager *cachem = this->m_CMakeInstance->GetCacheManager();
|
||||||
std::set<CPropertyItem*> items = m_CacheEntriesList.GetItems();
|
std::set<CPropertyItem*> items = m_CacheEntriesList.GetItems();
|
||||||
|
cmCacheManager::CacheIterator it = cachem->NewIterator();
|
||||||
for(std::set<CPropertyItem*>::iterator i = items.begin();
|
for(std::set<CPropertyItem*>::iterator i = items.begin();
|
||||||
i != items.end(); ++i)
|
i != items.end(); ++i)
|
||||||
{
|
{
|
||||||
CPropertyItem* item = *i;
|
CPropertyItem* item = *i;
|
||||||
cmCacheManager::CacheEntry *entry = cachem->GetCacheEntry(
|
if ( it.Find((const char*)item->m_propName) )
|
||||||
(const char*)item->m_propName);
|
|
||||||
if (entry)
|
|
||||||
{
|
{
|
||||||
// if value is enclosed in single quotes ('foo') then remove them
|
// if value is enclosed in single quotes ('foo') then remove them
|
||||||
// they were used to enforce the fact that it had 'invisible'
|
// they were used to enforce the fact that it had 'invisible'
|
||||||
@ -815,12 +813,12 @@ void CMakeSetupDialog::FillCacheManagerFromCacheGUI()
|
|||||||
item->m_curValue[0] == '\'' &&
|
item->m_curValue[0] == '\'' &&
|
||||||
item->m_curValue[item->m_curValue.GetLength() - 1] == '\'')
|
item->m_curValue[item->m_curValue.GetLength() - 1] == '\'')
|
||||||
{
|
{
|
||||||
entry->m_Value = item->m_curValue.Mid(1,
|
it.SetValue(item->m_curValue.Mid(
|
||||||
item->m_curValue.GetLength() - 2);
|
1, item->m_curValue.GetLength() - 2));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
entry->m_Value = item->m_curValue;
|
it.SetValue(item->m_curValue);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -836,10 +834,11 @@ void CMakeSetupDialog::LoadCacheFromDiskToGUI()
|
|||||||
{
|
{
|
||||||
cachem->LoadCache(m_WhereBuild);
|
cachem->LoadCache(m_WhereBuild);
|
||||||
this->FillCacheGUIFromCacheManager();
|
this->FillCacheGUIFromCacheManager();
|
||||||
if(cachem->GetCacheEntry("CMAKE_GENERATOR"))
|
cmCacheManager::CacheIterator it =
|
||||||
|
cachem->GetCacheIterator("CMAKE_GENERATOR");
|
||||||
|
if(!it.IsAtEnd())
|
||||||
{
|
{
|
||||||
std::string curGen =
|
std::string curGen = it.GetValue();
|
||||||
cachem->GetCacheEntry("CMAKE_GENERATOR")->m_Value;
|
|
||||||
if(m_GeneratorChoiceString != curGen.c_str())
|
if(m_GeneratorChoiceString != curGen.c_str())
|
||||||
{
|
{
|
||||||
m_GeneratorChoiceString = curGen.c_str();
|
m_GeneratorChoiceString = curGen.c_str();
|
||||||
@ -1128,19 +1127,18 @@ void CMakeSetupDialog::ShowAdvancedValues()
|
|||||||
!i.IsAtEnd(); i.Next())
|
!i.IsAtEnd(); i.Next())
|
||||||
{
|
{
|
||||||
const char* key = i.GetName();
|
const char* key = i.GetName();
|
||||||
const cmCacheManager::CacheEntry& value = i.GetEntry();
|
if(!i.GetPropertyAsBool("ADVANCED"))
|
||||||
if(!cachem->IsAdvanced(key))
|
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
switch(value.m_Type )
|
switch(i.GetType() )
|
||||||
{
|
{
|
||||||
case cmCacheManager::BOOL:
|
case cmCacheManager::BOOL:
|
||||||
if(cmSystemTools::IsOn(value.m_Value.c_str()))
|
if(cmSystemTools::IsOn(i.GetValue()))
|
||||||
{
|
{
|
||||||
m_CacheEntriesList.AddProperty(key,
|
m_CacheEntriesList.AddProperty(key,
|
||||||
"ON",
|
"ON",
|
||||||
value.m_HelpString.c_str(),
|
i.GetProperty("HELPSTRING"),
|
||||||
CPropertyList::COMBO,"ON|OFF",
|
CPropertyList::COMBO,"ON|OFF",
|
||||||
true
|
true
|
||||||
);
|
);
|
||||||
@ -1149,7 +1147,7 @@ void CMakeSetupDialog::ShowAdvancedValues()
|
|||||||
{
|
{
|
||||||
m_CacheEntriesList.AddProperty(key,
|
m_CacheEntriesList.AddProperty(key,
|
||||||
"OFF",
|
"OFF",
|
||||||
value.m_HelpString.c_str(),
|
i.GetProperty("HELPSTRING"),
|
||||||
CPropertyList::COMBO,"ON|OFF",
|
CPropertyList::COMBO,"ON|OFF",
|
||||||
true
|
true
|
||||||
);
|
);
|
||||||
@ -1157,24 +1155,24 @@ void CMakeSetupDialog::ShowAdvancedValues()
|
|||||||
break;
|
break;
|
||||||
case cmCacheManager::PATH:
|
case cmCacheManager::PATH:
|
||||||
m_CacheEntriesList.AddProperty(key,
|
m_CacheEntriesList.AddProperty(key,
|
||||||
value.m_Value.c_str(),
|
i.GetValue(),
|
||||||
value.m_HelpString.c_str(),
|
i.GetProperty("HELPSTRING"),
|
||||||
CPropertyList::PATH,"",
|
CPropertyList::PATH,"",
|
||||||
true
|
true
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
case cmCacheManager::FILEPATH:
|
case cmCacheManager::FILEPATH:
|
||||||
m_CacheEntriesList.AddProperty(key,
|
m_CacheEntriesList.AddProperty(key,
|
||||||
value.m_Value.c_str(),
|
i.GetValue(),
|
||||||
value.m_HelpString.c_str(),
|
i.GetProperty("HELPSTRING"),
|
||||||
CPropertyList::FILE,"",
|
CPropertyList::FILE,"",
|
||||||
true
|
true
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
case cmCacheManager::STRING:
|
case cmCacheManager::STRING:
|
||||||
m_CacheEntriesList.AddProperty(key,
|
m_CacheEntriesList.AddProperty(key,
|
||||||
value.m_Value.c_str(),
|
i.GetValue(),
|
||||||
value.m_HelpString.c_str(),
|
i.GetProperty("HELPSTRING"),
|
||||||
CPropertyList::EDIT,"",
|
CPropertyList::EDIT,"",
|
||||||
true
|
true
|
||||||
);
|
);
|
||||||
@ -1194,8 +1192,7 @@ void CMakeSetupDialog::RemoveAdvancedValues()
|
|||||||
!i.IsAtEnd(); i.Next())
|
!i.IsAtEnd(); i.Next())
|
||||||
{
|
{
|
||||||
const char* key = i.GetName();
|
const char* key = i.GetName();
|
||||||
const cmCacheManager::CacheEntry& value = i.GetEntry();
|
if(i.GetPropertyAsBool("ADVANCED"))
|
||||||
if(cachem->IsAdvanced(key))
|
|
||||||
{
|
{
|
||||||
m_CacheEntriesList.RemoveProperty(key);
|
m_CacheEntriesList.RemoveProperty(key);
|
||||||
}
|
}
|
||||||
@ -1246,15 +1243,17 @@ void CMakeSetupDialog::ChangeDirectoriesFromFile(const char* buffer)
|
|||||||
|
|
||||||
cmCacheManager *cachem = this->m_CMakeInstance->GetCacheManager();
|
cmCacheManager *cachem = this->m_CMakeInstance->GetCacheManager();
|
||||||
|
|
||||||
|
cmCacheManager::CacheIterator it =
|
||||||
|
cachem->NewIterator();
|
||||||
|
|
||||||
if (cmSystemTools::FileExists(cache_file.c_str()) &&
|
if (cmSystemTools::FileExists(cache_file.c_str()) &&
|
||||||
cachem->LoadCache(path.c_str()) &&
|
cachem->LoadCache(path.c_str()) &&
|
||||||
cachem->GetCacheEntry("CMAKE_HOME_DIRECTORY"))
|
it.Find("CMAKE_HOME_DIRECTORY"))
|
||||||
{
|
{
|
||||||
path = ConvertToWindowsPath(path.c_str());
|
path = ConvertToWindowsPath(path.c_str());
|
||||||
this->m_WhereBuild = path.c_str();
|
this->m_WhereBuild = path.c_str();
|
||||||
|
|
||||||
path = ConvertToWindowsPath(
|
path = ConvertToWindowsPath(it.GetName());
|
||||||
cachem->GetCacheEntry("CMAKE_HOME_DIRECTORY")->m_Value.c_str());
|
|
||||||
this->m_WhereSource = path.c_str();
|
this->m_WhereSource = path.c_str();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
Loading…
x
Reference in New Issue
Block a user