Legacy colors are not stored under a "4D" name.
This commit is contained in:
parent
d7178c7833
commit
58100b62e6
|
@ -276,22 +276,30 @@ void PARAM_CFG_SETCOLOR::ReadParam( wxConfigBase* aConfig ) const
|
||||||
if( !m_Pt_param || !aConfig )
|
if( !m_Pt_param || !aConfig )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// First try reading old format
|
COLOR4D temp;
|
||||||
EDA_COLOR_T itmp = ColorByName( aConfig->Read( m_Ident, wxT( "NONE" ) ) );
|
|
||||||
COLOR4D wtmp = COLOR4D::UNSPECIFIED;
|
|
||||||
|
|
||||||
if( itmp == UNSPECIFIED_COLOR )
|
if( aConfig->HasEntry( m_Ident ) )
|
||||||
{
|
{
|
||||||
// Next try reading new format
|
if( temp.SetFromWxString( aConfig->Read( m_Ident, wxT( "NONE" ) ) ) )
|
||||||
if( !wtmp.SetFromWxString( aConfig->Read( m_Ident, wxT( "NONE" ) ) ) )
|
{
|
||||||
wtmp = m_Default;
|
*m_Pt_param = temp;
|
||||||
}
|
return;
|
||||||
else
|
}
|
||||||
{
|
|
||||||
wtmp = COLOR4D( itmp );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
*m_Pt_param = wtmp;
|
// If no luck, try reading legacy format
|
||||||
|
wxString legacy_Ident = m_Ident;
|
||||||
|
legacy_Ident.Replace( wxT( "4D" ), wxEmptyString );
|
||||||
|
|
||||||
|
EDA_COLOR_T old = ColorByName( aConfig->Read( legacy_Ident, wxT( "NONE" ) ) );
|
||||||
|
|
||||||
|
if( old != UNSPECIFIED_COLOR )
|
||||||
|
{
|
||||||
|
*m_Pt_param = COLOR4D( old );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
*m_Pt_param = m_Default;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue