diff --git a/common/pcb.keywords b/common/pcb.keywords index a597b5f516..4a4d74a99f 100644 --- a/common/pcb.keywords +++ b/common/pcb.keywords @@ -119,6 +119,7 @@ fp_rect fp_text full general +generator grid_origin group gr_arc diff --git a/pcbnew/plugins/kicad/kicad_plugin.cpp b/pcbnew/plugins/kicad/kicad_plugin.cpp index dbf4dc05d8..0bfd18c08f 100644 --- a/pcbnew/plugins/kicad/kicad_plugin.cpp +++ b/pcbnew/plugins/kicad/kicad_plugin.cpp @@ -992,6 +992,9 @@ void PCB_IO::format( FOOTPRINT* aFootprint, int aNestLevel ) const m_out->Print( aNestLevel, "(footprint %s", m_out->Quotes( aFootprint->GetFPID().Format() ).c_str() ); + if( !( m_ctl & CTL_OMIT_FOOTPRINT_VERSION ) ) + m_out->Print( 0, " (version %d) (generator pcbnew)", SEXPR_BOARD_FILE_VERSION ); + if( aFootprint->IsLocked() ) m_out->Print( 0, " locked" ); @@ -1000,7 +1003,8 @@ void PCB_IO::format( FOOTPRINT* aFootprint, int aNestLevel ) const formatLayer( aFootprint ); - m_out->Print( 0, " (tedit %lX)", (unsigned long)aFootprint->GetLastEditTime() ); + m_out->Print( 0, "\n" ); + m_out->Print( aNestLevel+1, "(tedit %lX)", (unsigned long)aFootprint->GetLastEditTime() ); if( !( m_ctl & CTL_OMIT_TSTAMPS ) ) m_out->Print( 0, " (tstamp %s)", TO_UTF8( aFootprint->m_Uuid.AsString() ) ); diff --git a/pcbnew/plugins/kicad/kicad_plugin.h b/pcbnew/plugins/kicad/kicad_plugin.h index ca05511425..4edbbb363e 100644 --- a/pcbnew/plugins/kicad/kicad_plugin.h +++ b/pcbnew/plugins/kicad/kicad_plugin.h @@ -90,8 +90,8 @@ class PCB_TEXT; //#define SEXPR_BOARD_FILE_VERSION 20200922 // Add user name to layer definition. //#define SEXPR_BOARD_FILE_VERSION 20201002 // Add groups in footprints (for footprint editor). //#define SEXPR_BOARD_FILE_VERSION 20201114 // Add first-class support for filled shapes. -#define SEXPR_BOARD_FILE_VERSION 20201115 // module -> footprint and change fill syntax. - +//#define SEXPR_BOARD_FILE_VERSION 20201115 // module -> footprint and change fill syntax. +#define SEXPR_BOARD_FILE_VERSION 20201116 // Write version and generator string in footprint files. #define BOARD_FILE_HOST_VERSION 20200825 ///< Earlier files than this include the host tag @@ -103,19 +103,19 @@ class PCB_TEXT; // (always saved with potion 0,0 and rotation = 0 in library) //#define CTL_OMIT_HIDE (1 << 6) // found and defined in eda_text.h #define CTL_OMIT_LIBNAME (1 << 7) ///< Omit lib alias when saving (used for board/not library) - +#define CTL_OMIT_FOOTPRINT_VERSION (1 << 8) ///< Omit the version string from the (footprint ) sexpr group // common combinations of the above: /// Format output for the clipboard instead of footprint library or BOARD -#define CTL_FOR_CLIPBOARD // (CTL_OMIT_NETS) +#define CTL_FOR_CLIPBOARD (CTL_OMIT_INITIAL_COMMENTS) // (CTL_OMIT_NETS) /// Format output for a footprint library instead of clipboard or BOARD #define CTL_FOR_LIBRARY (CTL_OMIT_NETS|CTL_OMIT_TSTAMPS|CTL_OMIT_PATH|CTL_OMIT_AT|CTL_OMIT_LIBNAME) /// The zero arg constructor when PCB_IO is used for PLUGIN::Load() and PLUGIN::Save()ing /// a BOARD file underneath IO_MGR. -#define CTL_FOR_BOARD (CTL_OMIT_INITIAL_COMMENTS) +#define CTL_FOR_BOARD (CTL_OMIT_INITIAL_COMMENTS|CTL_OMIT_FOOTPRINT_VERSION) /** diff --git a/pcbnew/plugins/kicad/pcb_parser.cpp b/pcbnew/plugins/kicad/pcb_parser.cpp index 7f8cdf8d46..04e9ba19ff 100644 --- a/pcbnew/plugins/kicad/pcb_parser.cpp +++ b/pcbnew/plugins/kicad/pcb_parser.cpp @@ -2861,6 +2861,13 @@ FOOTPRINT* PCB_PARSER::parseFOOTPRINT_unchecked( wxArrayString* aInitialComments break; } + case T_generator: + // We currently ignore the generator when parsing. It is included in the file for manual + // indication of where the footprint came from. + NeedSYMBOL(); + NeedRIGHT(); + break; + case T_locked: footprint->SetLocked( true ); break; @@ -3105,7 +3112,7 @@ FOOTPRINT* PCB_PARSER::parseFOOTPRINT_unchecked( wxArrayString* aInitialComments "solder_paste_margin, solder_paste_ratio, clearance, " "zone_connect, thermal_width, thermal_gap, attr, fp_text, " "fp_arc, fp_circle, fp_curve, fp_line, fp_poly, fp_rect, pad, " - "zone, group, or model" ); + "zone, group, generator, version or model" ); } }