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.

(cherry picked from commit 6a09cf3551)
This commit is contained in:
Seth Hillbrand 2023-07-19 14:24:45 -07:00
parent 45d496bd01
commit e4a80d887a
1 changed files with 35 additions and 45 deletions

View File

@ -2171,34 +2171,8 @@ void PCB_PARSER::parseSetup()
break;
case T_filled_areas_thickness:
if( parseBool() )
{
if( m_showLegacy5ZoneWarning )
{
if( Pgm().IsGUI() )
{
// Thick outline fill mode no longer supported. Make sure user is OK with
// converting fills.
KIDIALOG dlg( nullptr,
_( "The legacy zone fill strategy is no longer "
"supported.\nConvert zones to smoothed polygon "
"fills?" ),
_( "Legacy Zone Warning" ), wxYES_NO | wxICON_WARNING );
dlg.DoNotShowCheckbox( __FILE__, __LINE__ );
if( dlg.ShowModal() == wxID_NO )
THROW_IO_ERROR( wxT( "CANCEL" ) );
m_showLegacy5ZoneWarning = false;
}
else
{
THROW_IO_ERROR( wxT( "Legacy zone fill strategy was found, open the project in the PCB Editor to resolve" ) );
}
}
}
// Ignore this value, it is not used anymore
parseBool();
NeedRIGHT();
break;
@ -5558,6 +5532,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 );
@ -5674,24 +5659,9 @@ ZONE* PCB_PARSER::parseZONE( BOARD_ITEM_CONTAINER* aParent )
break;
case T_filled_areas_thickness:
if( parseBool() )
{
if( m_showLegacy5ZoneWarning && 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" ) );
}
}
m_showLegacy5ZoneWarning = false;
zone->SetFlags( CANDIDATE );
dropFilledPolygons = true;
}
if( parseBool() )
isLegacy = true;
NeedRIGHT();
break;
@ -6125,6 +6095,26 @@ ZONE* PCB_PARSER::parseZONE( BOARD_ITEM_CONTAINER* aParent )
zone->SetBorderDisplayStyle( hatchStyle, hatchPitch, true );
}
if( isLegacy && !zone->GetIsRuleArea() )
{
if( m_showLegacy5ZoneWarning && 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" ) );
}
m_showLegacy5ZoneWarning = false;
}
zone->SetFlags( CANDIDATE );
dropFilledPolygons = true;
}
if( addedFilledPolygons && !dropFilledPolygons )
{
for( auto& pair : pts )