Fixed how meters are initialized to avoid problems with referencing a Dynamic Section Variable before its meter options are read

This commit is contained in:
Brian Ferguson 2012-08-05 06:27:07 -06:00
parent 4fe98ae296
commit 47781848e7

View File

@ -2181,9 +2181,6 @@ bool CMeterWindow::ReadSkin()
{
CMeter* meter = *iter;
m_Meters.push_back(meter);
meter->ReadOptions(m_Parser);
meter->Initialize();
meter->SetRelativeMeter(prevMeter);
if (!meter->GetToolTipText().empty())
@ -2199,8 +2196,8 @@ bool CMeterWindow::ReadSkin()
prevMeter = meter;
}
// Initialize measures. This is a separate loop to avoid errors caused by
// referencing not-yet-existent [measures] in the options.
// Initialize measures. Separate loop to avoid errors caused by
// referencing nonexistent [measures] in the measure options.
for (auto iter = measures.cbegin(); iter != measures.cend(); ++iter)
{
CMeasure* measure = *iter;
@ -2208,6 +2205,15 @@ bool CMeterWindow::ReadSkin()
measure->Initialize();
}
// Initialize meters. Separate loop to avoid errors caused by referencing
// nonexistent [Measures:] in the meter options. (Dynamic Section Variables)
for (auto iter = meters.cbegin(); iter != meters.cend(); ++iter)
{
CMeter* meter = *iter;
meter->ReadOptions(m_Parser);
meter->Initialize();
}
if (m_Meters.empty())
{
std::wstring text = GetFormattedString(ID_STR_NOMETERSINSKIN, m_FolderPath.c_str(), m_FileName.c_str());