Don't put up "old version" warning for gerbview-generated PCBs.

Fixes https://gitlab.com/kicad/code/kicad/issues/8574
This commit is contained in:
Jeff Young 2021-06-08 22:11:48 +01:00
parent 6b5d512b9f
commit 2aaec31832
5 changed files with 28 additions and 22 deletions

View File

@ -141,6 +141,7 @@ hatch_min_hole_area
height
hide
hole_to_hole_min
host
id
island
island_removal_mode

View File

@ -437,8 +437,7 @@ void GBR_TO_PCB_EXPORTER::export_flashed_copper_item( const GERBER_DRAW_ITEM* aG
void GBR_TO_PCB_EXPORTER::writePcbHeader( const LAYER_NUM* aLayerLookUpTable )
{
fprintf( m_fp, "(kicad_pcb (version 4) (host Gerbview \"%s\")\n\n",
TO_UTF8( GetBuildVersion() ) );
fprintf( m_fp, "(kicad_pcb (version 4) (generator gerbview)\n\n" );
// Write layers section
fprintf( m_fp, " (layers \n" );

View File

@ -288,6 +288,9 @@ public:
void SetFileFormatVersionAtLoad( int aVersion ) { m_fileFormatVersionAtLoad = aVersion; }
int GetFileFormatVersionAtLoad() const { return m_fileFormatVersionAtLoad; }
void SetGenerator( const wxString& aGenerator ) { m_generator = aGenerator; }
const wxString& GetGenerator() const { return m_generator; }
void Add( BOARD_ITEM* aItem, ADD_MODE aMode = ADD_MODE::INSERT ) override;
void Remove( BOARD_ITEM* aBoardItem, REMOVE_MODE aMode = REMOVE_MODE::NORMAL ) override;
@ -1126,6 +1129,7 @@ private:
HIGH_LIGHT_INFO m_highLightPrevious; // a previously stored high light data
int m_fileFormatVersionAtLoad; // the version loaded from the file
wxString m_generator; // the generator tag from the file
std::map<wxString, wxString> m_properties;
std::shared_ptr<CONNECTIVITY_DATA> m_connectivity;

View File

@ -780,10 +780,10 @@ bool PCB_EDIT_FRAME::OpenProjectFiles( const std::vector<wxString>& aFileSet, in
else
GetScreen()->SetContentModified( false );
if( ( pluginType == IO_MGR::LEGACY &&
loadedBoard->GetFileFormatVersionAtLoad() < LEGACY_BOARD_FILE_VERSION ) ||
( pluginType == IO_MGR::KICAD_SEXP &&
loadedBoard->GetFileFormatVersionAtLoad() < SEXPR_BOARD_FILE_VERSION ) )
if( ( pluginType == IO_MGR::LEGACY )
|| ( pluginType == IO_MGR::KICAD_SEXP
&& loadedBoard->GetFileFormatVersionAtLoad() < SEXPR_BOARD_FILE_VERSION
&& loadedBoard->GetGenerator().Lower() != "gerbview" ) )
{
m_infoBar->RemoveAllButtons();
m_infoBar->AddCloseButton();

View File

@ -592,6 +592,23 @@ BOARD* PCB_PARSER::parseBOARD_unchecked()
switch( token )
{
case T_host: // legacy token
NeedSYMBOL();
m_board->SetGenerator( FromUTF8() );
// Older formats included build data
if( m_requiredVersion < BOARD_FILE_HOST_VERSION )
NeedSYMBOL();
NeedRIGHT();
break;
case T_generator:
NeedSYMBOL();
m_board->SetGenerator( FromUTF8() );
NeedRIGHT();
break;
case T_general:
parseGeneralSection();
break;
@ -900,27 +917,12 @@ void PCB_PARSER::parseHeader()
m_requiredVersion = parseInt( FromUTF8().mb_str( wxConvUTF8 ) );
m_tooRecent = ( m_requiredVersion > SEXPR_BOARD_FILE_VERSION );
NeedRIGHT();
NeedLEFT();
NeedSYMBOL();
NeedSYMBOL();
// Older formats included build data
if( m_requiredVersion < BOARD_FILE_HOST_VERSION )
NeedSYMBOL();
NeedRIGHT();
}
else
{
m_requiredVersion = 20201115; // Last version before we started writing version #s
// in footprint files as well as board files.
m_tooRecent = ( m_requiredVersion > SEXPR_BOARD_FILE_VERSION );
// Skip the host name and host build version information.
NeedSYMBOL();
NeedSYMBOL();
NeedRIGHT();
}
m_board->SetFileFormatVersionAtLoad( m_requiredVersion );