diff --git a/bitmap2component/bitmap2component.cpp b/bitmap2component/bitmap2component.cpp index 723edfc4de..c43645f146 100644 --- a/bitmap2component/bitmap2component.cpp +++ b/bitmap2component/bitmap2component.cpp @@ -32,6 +32,7 @@ #include #include +#include #include #include @@ -215,9 +216,9 @@ void BITMAPCONV_INFO::outputDataHeader( const char * aBrdLayerName ) case PCBNEW_KICAD_MOD: // fields text size = 1.5 mm // fields text thickness = 1.5 / 5 = 0.3mm - strbuf = fmt::format( "(footprint \"{}\" (version 20221018) (generator bitmap2component)\n" + strbuf = fmt::format( "(footprint \"{}\" (version 20221018) (generator \"bitmap2component\") (generator_version \"{}\")\n" " (layer \"F.Cu\")\n", - m_CmpName.c_str() ); + m_CmpName.c_str(), GetMajorMinorVersion().ToStdString() ); m_Data += strbuf; strbuf = fmt::format( @@ -240,7 +241,7 @@ void BITMAPCONV_INFO::outputDataHeader( const char * aBrdLayerName ) break; case KICAD_WKS_LOGO: - m_Data += "(kicad_wks (version 20220228) (generator bitmap2component)\n"; + m_Data += fmt::format("(kicad_wks (version 20220228) (generator \"bitmap2component\") (generator_version \"{}\")\n", GetMajorMinorVersion().ToStdString() ); m_Data += " (setup (textsize 1.5 1.5)(linewidth 0.15)(textlinewidth 0.15)\n"; m_Data += " (left_margin 10)(right_margin 10)(top_margin 10)(bottom_margin 10))\n"; m_Data += " (polygon (name \"\") (pos 0 0) (linewidth 0.01)\n"; @@ -252,9 +253,9 @@ void BITMAPCONV_INFO::outputDataHeader( const char * aBrdLayerName ) Ypos += fieldSize / 2; // snprintf( strbuf, sizeof(strbuf), "# pixmap size w = %d, h = %d\n#\n", m_PixmapWidth, m_PixmapHeight ); strbuf = fmt::format( - "(kicad_symbol_lib (version 20220914) (generator bitmap2component)\n" + "(kicad_symbol_lib (version 20220914) (generator \"bitmap2component\") (generator_version \"{}\")\n" " (symbol \"{}\" (pin_names (offset 1.016)) (in_bom yes) (on_board yes)\n", - m_CmpName.c_str() ); + GetMajorMinorVersion().ToStdString(), m_CmpName.c_str() ); m_Data += strbuf; strbuf = fmt::format( diff --git a/common/drawing_sheet/ds_data_model_io.cpp b/common/drawing_sheet/ds_data_model_io.cpp index 0671f207fd..cae54b74b6 100644 --- a/common/drawing_sheet/ds_data_model_io.cpp +++ b/common/drawing_sheet/ds_data_model_io.cpp @@ -24,6 +24,7 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ +#include #include #include #include @@ -160,8 +161,8 @@ void DS_DATA_MODEL_IO::Format( DS_DATA_MODEL* aModel, std::vector { LOCALE_IO toggle; // switch on/off the locale "C" notation - m_out->Print( 0, "(kicad_wks (version %d) (generator pl_editor)\n", - SEXPR_WORKSHEET_FILE_VERSION ); + m_out->Print( 0, "(kicad_wks (version %d) (generator \"pl_editor\") (generator_version \"%s\")\n", + SEXPR_WORKSHEET_FILE_VERSION, GetMajorMinorVersion().c_str().AsChar() ); for( DS_DATA_ITEM* item : aItemsList ) Format( aModel, item, 1 ); @@ -201,8 +202,8 @@ void DS_DATA_MODEL_IO::Format( DS_DATA_MODEL* aSheet ) const { LOCALE_IO toggle; // switch on/off the locale "C" notation - m_out->Print( 0, "(kicad_wks (version %d) (generator pl_editor)\n", - SEXPR_WORKSHEET_FILE_VERSION ); + m_out->Print( 0, "(kicad_wks (version %d) (generator \"pl_editor\") (generator_version \"%s\")\n", + SEXPR_WORKSHEET_FILE_VERSION, GetMajorMinorVersion() ); // Setup int nestLevel = 1; diff --git a/eeschema/dialogs/panel_sym_lib_table.cpp b/eeschema/dialogs/panel_sym_lib_table.cpp index 876f307a79..773b495a55 100644 --- a/eeschema/dialogs/panel_sym_lib_table.cpp +++ b/eeschema/dialogs/panel_sym_lib_table.cpp @@ -22,6 +22,7 @@ #include #include +#include #include // For ExpandEnvVarSubstitutions #include #include @@ -942,8 +943,8 @@ bool PANEL_SYM_LIB_TABLE::convertLibrary( STRING_UTF8_MAP* aOldFileProps, const // Write a stub file; SaveSymbol() expects something to be there already. FILE_OUTPUTFORMATTER* formatter = new FILE_OUTPUTFORMATTER( aNewFilepath ); - formatter->Print( 0, "(kicad_symbol_lib (version %d) (generator kicad_converter))", - SEXPR_SYMBOL_LIB_FILE_VERSION ); + formatter->Print( 0, "(kicad_symbol_lib (version %d) (generator kicad_converter) (generator_version \"%s\")", + SEXPR_SYMBOL_LIB_FILE_VERSION, GetMajorMinorVersion().c_str().AsChar() ); // This will write the file delete formatter; diff --git a/eeschema/sch_plugins/kicad/sch_sexpr_lib_plugin_cache.cpp b/eeschema/sch_plugins/kicad/sch_sexpr_lib_plugin_cache.cpp index fe9284e43d..0a0b16effb 100644 --- a/eeschema/sch_plugins/kicad/sch_sexpr_lib_plugin_cache.cpp +++ b/eeschema/sch_plugins/kicad/sch_sexpr_lib_plugin_cache.cpp @@ -21,6 +21,7 @@ #include #include +#include #include #include #include @@ -92,8 +93,8 @@ void SCH_SEXPR_PLUGIN_CACHE::Save( const std::optional& aOpt ) auto formatter = std::make_unique( fn.GetFullPath() ); - formatter->Print( 0, "(kicad_symbol_lib (version %d) (generator kicad_symbol_editor)\n", - SEXPR_SYMBOL_LIB_FILE_VERSION ); + formatter->Print( 0, "(kicad_symbol_lib (version %d) (generator \"kicad_symbol_editor\") (generator_version \"%s\")\n", + SEXPR_SYMBOL_LIB_FILE_VERSION, GetMajorMinorVersion().c_str().AsChar() ); std::vector orderedSymbols; diff --git a/eeschema/sch_plugins/kicad/sch_sexpr_plugin.cpp b/eeschema/sch_plugins/kicad/sch_sexpr_plugin.cpp index 157452dd6b..8db81217ec 100644 --- a/eeschema/sch_plugins/kicad/sch_sexpr_plugin.cpp +++ b/eeschema/sch_plugins/kicad/sch_sexpr_plugin.cpp @@ -30,6 +30,7 @@ #include #include #include +#include #include #include #include @@ -366,8 +367,8 @@ void SCH_SEXPR_PLUGIN::Format( SCH_SHEET* aSheet ) wxCHECK( screen, /* void */ ); - m_out->Print( 0, "(kicad_sch (version %d) (generator eeschema)\n\n", - SEXPR_SCHEMATIC_FILE_VERSION ); + m_out->Print( 0, "(kicad_sch (version %d) (generator \"eeschema\") (generator_version \"%s\")\n\n", + SEXPR_SCHEMATIC_FILE_VERSION, GetMajorMinorVersion().c_str().AsChar() ); m_out->Print( 1, "(uuid %s)\n\n", TO_UTF8( screen->m_uuid.AsString() ) ); diff --git a/gerbview/export_to_pcbnew.cpp b/gerbview/export_to_pcbnew.cpp index 374fd7c156..1da98cdac2 100644 --- a/gerbview/export_to_pcbnew.cpp +++ b/gerbview/export_to_pcbnew.cpp @@ -501,7 +501,7 @@ void GBR_TO_PCB_EXPORTER::writePcbFilledCircle( const VECTOR2I& aCenterPosition, void GBR_TO_PCB_EXPORTER::writePcbHeader( const int* aLayerLookUpTable ) { - fprintf( m_fp, "(kicad_pcb (version 4) (generator gerbview)\n\n" ); + fprintf( m_fp, "(kicad_pcb (version 4) (generator \"gerbview\") (generator_version \"%s\")\n\n", GetMajorMinorVersion().c_str().AsChar() ); // Write layers section fprintf( m_fp, " (layers \n" ); diff --git a/kicad/kicad_manager_frame.cpp b/kicad/kicad_manager_frame.cpp index 8a131eb1d4..59db177fb5 100644 --- a/kicad/kicad_manager_frame.cpp +++ b/kicad/kicad_manager_frame.cpp @@ -692,10 +692,10 @@ void KICAD_MANAGER_FRAME::CreateNewProject( const wxFileName& aProjectFileName, wxFFile file( fn.GetFullPath(), "wb" ); if( file.IsOpened() ) - file.Write( wxString::Format( "(kicad_sch (version %d) (generator eeschema)\n" + file.Write( wxString::Format( "(kicad_sch (version %d) (generator \"eeschema\") (generator_version \"%s\")\n" " (paper \"A4\")\n (lib_symbols)\n" " (symbol_instances)\n)\n", - SEXPR_SCHEMATIC_FILE_VERSION ) ); + SEXPR_SCHEMATIC_FILE_VERSION, GetMajorMinorVersion() ) ); // wxFFile dtor will close the file } @@ -712,8 +712,8 @@ void KICAD_MANAGER_FRAME::CreateNewProject( const wxFileName& aProjectFileName, if( file.IsOpened() ) // Create a small dummy file as a stub for pcbnew: - file.Write( wxString::Format( "(kicad_pcb (version %d) (generator pcbnew)\n)", - SEXPR_BOARD_FILE_VERSION ) ); + file.Write( wxString::Format( "(kicad_pcb (version %d) (generator \"pcbnew\") (generator_version \"%s\")\n)", + SEXPR_BOARD_FILE_VERSION, GetMajorMinorVersion() ) ); // wxFFile dtor will close the file } diff --git a/pcbnew/kicad_clipboard.cpp b/pcbnew/kicad_clipboard.cpp index faa2b4df78..e59e5333b1 100644 --- a/pcbnew/kicad_clipboard.cpp +++ b/pcbnew/kicad_clipboard.cpp @@ -27,6 +27,7 @@ #include #include +#include #include #include #include @@ -192,8 +193,8 @@ void CLIPBOARD_IO::SaveSelection( const PCB_SELECTION& aSelected, bool isFootpri // This means we also need layers and nets LOCALE_IO io; - m_formatter.Print( 0, "(kicad_pcb (version %d) (generator pcbnew)\n", - SEXPR_BOARD_FILE_VERSION ); + m_formatter.Print( 0, "(kicad_pcb (version %d) (generator \"pcbnew\") (generator_version \"%s\")\n", + SEXPR_BOARD_FILE_VERSION, GetMajorMinorVersion().c_str().AsChar() ); m_formatter.Print( 0, "\n" ); @@ -344,7 +345,7 @@ void CLIPBOARD_IO::SaveBoard( const wxString& aFileName, BOARD* aBoard, m_out = &formatter; - m_out->Print( 0, "(kicad_pcb (version %d) (generator pcbnew)\n", SEXPR_BOARD_FILE_VERSION ); + m_out->Print( 0, "(kicad_pcb (version %d) (generator \"pcbnew\") (generator_version \"%s\")\n", SEXPR_BOARD_FILE_VERSION, GetMajorMinorVersion().c_str().AsChar() ); Format( aBoard, 1 ); diff --git a/pcbnew/plugins/kicad/pcb_plugin.cpp b/pcbnew/plugins/kicad/pcb_plugin.cpp index c9140c3ac4..86d1c7341b 100644 --- a/pcbnew/plugins/kicad/pcb_plugin.cpp +++ b/pcbnew/plugins/kicad/pcb_plugin.cpp @@ -56,6 +56,7 @@ #include #include #include +#include // For some reason wxWidgets is built with wxUSE_BASE64 unset so expose the wxWidgets // base64 code. Needed for PCB_REFERENCE_IMAGE @@ -323,7 +324,8 @@ void PCB_PLUGIN::SaveBoard( const wxString& aFileName, BOARD* aBoard, m_out = &formatter; // no ownership - m_out->Print( 0, "(kicad_pcb (version %d) (generator pcbnew)\n", SEXPR_BOARD_FILE_VERSION ); + m_out->Print( 0, "(kicad_pcb (version %d) (generator \"pcbnew\") (generator_version \"%s\")\n", + SEXPR_BOARD_FILE_VERSION, GetMajorMinorVersion().c_str().AsChar() ); Format( aBoard, 1 ); @@ -1111,7 +1113,8 @@ void PCB_PLUGIN::format( const FOOTPRINT* aFootprint, int aNestLevel ) const } if( !( m_ctl & CTL_OMIT_FOOTPRINT_VERSION ) ) - m_out->Print( 0, " (version %d) (generator pcbnew)\n ", SEXPR_BOARD_FILE_VERSION ); + m_out->Print( 0, " (version %d) (generator \"pcbnew\") (generator_version \"%s\")\n ", + SEXPR_BOARD_FILE_VERSION, GetMajorMinorVersion().c_str().AsChar() ); if( aFootprint->IsLocked() ) m_out->Print( 0, " locked" );