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 height
hide hide
hole_to_hole_min hole_to_hole_min
host
id id
island island
island_removal_mode 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 ) void GBR_TO_PCB_EXPORTER::writePcbHeader( const LAYER_NUM* aLayerLookUpTable )
{ {
fprintf( m_fp, "(kicad_pcb (version 4) (host Gerbview \"%s\")\n\n", fprintf( m_fp, "(kicad_pcb (version 4) (generator gerbview)\n\n" );
TO_UTF8( GetBuildVersion() ) );
// Write layers section // Write layers section
fprintf( m_fp, " (layers \n" ); fprintf( m_fp, " (layers \n" );

View File

@ -288,6 +288,9 @@ public:
void SetFileFormatVersionAtLoad( int aVersion ) { m_fileFormatVersionAtLoad = aVersion; } void SetFileFormatVersionAtLoad( int aVersion ) { m_fileFormatVersionAtLoad = aVersion; }
int GetFileFormatVersionAtLoad() const { return m_fileFormatVersionAtLoad; } 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 Add( BOARD_ITEM* aItem, ADD_MODE aMode = ADD_MODE::INSERT ) override;
void Remove( BOARD_ITEM* aBoardItem, REMOVE_MODE aMode = REMOVE_MODE::NORMAL ) 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 HIGH_LIGHT_INFO m_highLightPrevious; // a previously stored high light data
int m_fileFormatVersionAtLoad; // the version loaded from the file 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::map<wxString, wxString> m_properties;
std::shared_ptr<CONNECTIVITY_DATA> m_connectivity; 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 else
GetScreen()->SetContentModified( false ); GetScreen()->SetContentModified( false );
if( ( pluginType == IO_MGR::LEGACY && if( ( pluginType == IO_MGR::LEGACY )
loadedBoard->GetFileFormatVersionAtLoad() < LEGACY_BOARD_FILE_VERSION ) || || ( pluginType == IO_MGR::KICAD_SEXP
( pluginType == IO_MGR::KICAD_SEXP && && loadedBoard->GetFileFormatVersionAtLoad() < SEXPR_BOARD_FILE_VERSION
loadedBoard->GetFileFormatVersionAtLoad() < SEXPR_BOARD_FILE_VERSION ) ) && loadedBoard->GetGenerator().Lower() != "gerbview" ) )
{ {
m_infoBar->RemoveAllButtons(); m_infoBar->RemoveAllButtons();
m_infoBar->AddCloseButton(); m_infoBar->AddCloseButton();

View File

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