Add generator version

This commit is contained in:
Marek Roszko 2023-11-18 17:34:09 -05:00 committed by Jon Evans
parent f1f8981395
commit d1ecf3790c
9 changed files with 34 additions and 25 deletions

View File

@ -32,6 +32,7 @@
#include <vector>
#include <kiid.h>
#include <build_version.h>
#include <layer_ids.h>
#include <locale_io.h>
@ -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(

View File

@ -24,6 +24,7 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <build_version.h>
#include <string_utils.h>
#include <locale_io.h>
#include <math/vector2d.h>
@ -160,8 +161,8 @@ void DS_DATA_MODEL_IO::Format( DS_DATA_MODEL* aModel, std::vector<DS_DATA_ITEM*>
{
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;

View File

@ -22,6 +22,7 @@
#include <set>
#include <wx/regex.h>
#include <build_version.h>
#include <common.h> // For ExpandEnvVarSubstitutions
#include <dialogs/dialog_plugin_options.h>
#include <project.h>
@ -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;

View File

@ -21,6 +21,7 @@
#include <wx/log.h>
#include <base_units.h>
#include <build_version.h>
#include <lib_shape.h>
#include <lib_symbol.h>
#include <lib_text.h>
@ -92,8 +93,8 @@ void SCH_SEXPR_PLUGIN_CACHE::Save( const std::optional<bool>& aOpt )
auto formatter = std::make_unique<FILE_OUTPUTFORMATTER>( 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<LIB_SYMBOL*> orderedSymbols;

View File

@ -30,6 +30,7 @@
#include <wx/mstream.h>
#include <advanced_config.h>
#include <base_units.h>
#include <build_version.h>
#include <trace_helpers.h>
#include <locale_io.h>
#include <sch_bitmap.h>
@ -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() ) );

View File

@ -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" );

View File

@ -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
}

View File

@ -27,6 +27,7 @@
#include <wx/log.h>
#include <board.h>
#include <build_version.h>
#include <core/ignore.h>
#include <pad.h>
#include <pcb_group.h>
@ -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 );

View File

@ -56,6 +56,7 @@
#include <wx/dir.h>
#include <wx/ffile.h>
#include <wx/log.h>
#include <build_version.h>
// 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" );