Refill legacy zone fills on open

Previous check only looked for the existence of a new (as of v6) flag
that controlled which strategy we took.  Previous versions did not write
this flag and so will not hit the check. This works around a missing
version bump from when the feature was introduced.
This commit is contained in:
Seth Hillbrand 2023-07-19 14:24:45 -07:00
parent d7e470dbcc
commit 6a09cf3551
1 changed files with 43 additions and 53 deletions

View File

@ -2208,33 +2208,8 @@ void PCB_PARSER::parseSetup()
break;
case T_filled_areas_thickness:
if( parseBool() )
{
if( m_showLegacy5ZoneWarning )
{
if( Pgm().IsGUI() && m_queryUserCallback )
{
// Thick outline fill mode no longer supported. Make sure user is OK with
// converting fills.
if( !m_queryUserCallback(
_( "Legacy Zone Warning" ), wxICON_WARNING,
_( "The legacy zone fill strategy is no longer supported.\n"
"Convert zones to smoothed polygon fills?" ),
_( "Convert" ) ) )
{
THROW_IO_ERROR( wxT( "CANCEL" ) );
}
}
else
{
THROW_IO_ERROR( wxT( "Legacy zone fill strategy was found; "
"open the board in the PCB Editor to resolve." ) );
}
m_showLegacy5ZoneWarning = false;
}
}
// Ignore this value, it is not used anymore
parseBool();
NeedRIGHT();
break;
@ -5143,6 +5118,17 @@ ZONE* PCB_PARSER::parseZONE( BOARD_ITEM_CONTAINER* aParent )
zone->SetAssignedPriority( 0 );
bool isLegacy = false;
if( m_requiredVersion < 20210606 )
{
// A new zone fill strategy was added in v6, so we need to know if we're parsing
// a file that was written before that date. Note that the change was implemented as
// a new parameter without changing the version number, so we need to check for the
// presence of the new parameter instead of just the version number.
isLegacy = true;
}
// This is the default for board files:
zone->SetIslandRemovalMode( ISLAND_REMOVAL_MODE::ALWAYS );
@ -5259,33 +5245,9 @@ ZONE* PCB_PARSER::parseZONE( BOARD_ITEM_CONTAINER* aParent )
break;
case T_filled_areas_thickness:
if( parseBool() )
{
if( m_showLegacy5ZoneWarning )
{
if( Pgm().IsGUI() && m_queryUserCallback )
{
if( !m_queryUserCallback(
_( "Legacy Zone Warning" ), wxICON_WARNING,
_( "The legacy zone fill strategy is no longer supported.\n"
"Convert zones to smoothed polygon fills?" ),
_( "Convert" ) ) )
{
THROW_IO_ERROR( wxT( "CANCEL" ) );
}
}
else
{
THROW_IO_ERROR( wxT( "Legacy zone fill strategy was found; "
"open the board in the PCB Editor to resolve." ) );
}
m_showLegacy5ZoneWarning = false;
}
zone->SetFlags( CANDIDATE );
dropFilledPolygons = true;
}
isLegacy = true;
NeedRIGHT();
break;
@ -5713,6 +5675,34 @@ ZONE* PCB_PARSER::parseZONE( BOARD_ITEM_CONTAINER* aParent )
zone->SetBorderDisplayStyle( hatchStyle, hatchPitch, true );
}
if( isLegacy && !zone->GetIsRuleArea() )
{
if( m_showLegacy5ZoneWarning )
{
if( Pgm().IsGUI() && m_queryUserCallback )
{
if( !m_queryUserCallback(
_( "Legacy Zone Warning" ), wxICON_WARNING,
_( "The legacy zone fill strategy is no longer supported.\n"
"Convert zones to smoothed polygon fills?" ),
_( "Convert" ) ) )
{
THROW_IO_ERROR( wxT( "CANCEL" ) );
}
}
else
{
THROW_IO_ERROR( wxT( "Legacy zone fill strategy was found; "
"open the board in the PCB Editor to resolve." ) );
}
m_showLegacy5ZoneWarning = false;
}
zone->SetFlags( CANDIDATE );
dropFilledPolygons = true;
}
if( addedFilledPolygons && !dropFilledPolygons )
{
for( auto& pair : pts )