Fix errors

This commit is contained in:
Uli Köhler 2024-05-29 05:12:14 +02:00
parent c3db891e41
commit e56e8a36c6
4 changed files with 25 additions and 21 deletions

View File

@ -869,7 +869,7 @@ void PCB_IO_KICAD_SEXPR::format( const PCB_DIMENSION_BASE* aDimension, int aNest
formatLayer( aDimension->GetLayer() );
if(!m_no_generate_uuid) {
if(!this->m_no_generate_uuid) {
KICAD_FORMAT::FormatUuid( m_out, aDimension->m_Uuid );
}
@ -1031,7 +1031,7 @@ void PCB_IO_KICAD_SEXPR::format( const PCB_SHAPE* aShape, int aNestLevel ) const
if( aShape->GetNetCode() > 0 )
m_out->Print( 0, " (net %d)", m_mapping->Translate( aShape->GetNetCode() ) );
if(!m_no_generate_uuid) {
if(!this->m_no_generate_uuid) {
KICAD_FORMAT::FormatUuid( m_out, aShape->m_Uuid, 0 );
}
@ -1079,7 +1079,7 @@ void PCB_IO_KICAD_SEXPR::format( const PCB_REFERENCE_IMAGE* aBitmap, int aNestLe
m_out->Print( 0, "\n" );
m_out->Print( aNestLevel + 1, ")\n" ); // Closes data token.
if(!m_no_generate_uuid) {
if(!this->m_no_generate_uuid) {
KICAD_FORMAT::FormatUuid( m_out, aBitmap->m_Uuid, 0 );
}
@ -1099,7 +1099,7 @@ void PCB_IO_KICAD_SEXPR::format( const PCB_TARGET* aTarget, int aNestLevel ) con
formatLayer( aTarget->GetLayer() );
if(!m_no_generate_uuid) {
if(!this->m_no_generate_uuid) {
KICAD_FORMAT::FormatUuid( m_out, aTarget->m_Uuid, 0 );
}
@ -1151,7 +1151,7 @@ void PCB_IO_KICAD_SEXPR::format( const FOOTPRINT* aFootprint, int aNestLevel ) c
m_out->Print( 0, "\n" );
if( !( m_ctl & CTL_OMIT_UUIDS ) && !m_no_generate_uuid )
if( !( m_ctl & CTL_OMIT_UUIDS ) && !this->m_no_generate_uuid )
KICAD_FORMAT::FormatUuid( m_out, aFootprint->m_Uuid );
if( !( m_ctl & CTL_OMIT_AT ) )
@ -1830,7 +1830,7 @@ void PCB_IO_KICAD_SEXPR::format( const PAD* aPad, int aNestLevel ) const
}
m_out->Print( 0, "\n" );
if(!m_no_generate_uuid) {
if(!this->m_no_generate_uuid) {
KICAD_FORMAT::FormatUuid( m_out, aPad->m_Uuid );
}
m_out->Print( aNestLevel, ")\n" );
@ -1887,7 +1887,7 @@ void PCB_IO_KICAD_SEXPR::format( const PCB_TEXT* aText, int aNestLevel ) const
if( parentFP && !aText->IsVisible() )
KICAD_FORMAT::FormatBool( m_out, 0, "hide", !aText->IsVisible() );
if(!m_no_generate_uuid) {
if(!this->m_no_generate_uuid) {
KICAD_FORMAT::FormatUuid( m_out, aText->m_Uuid );
}
@ -1955,7 +1955,7 @@ void PCB_IO_KICAD_SEXPR::format( const PCB_TEXTBOX* aTextBox, int aNestLevel ) c
formatLayer( aTextBox->GetLayer() );
m_out->Print( 0, "\n" );
if(!m_no_generate_uuid) {
if(!this->m_no_generate_uuid) {
KICAD_FORMAT::FormatUuid( m_out, aTextBox->m_Uuid );
}
@ -2044,7 +2044,7 @@ void PCB_IO_KICAD_SEXPR::format( const PCB_GROUP* aGroup, int aNestLevel ) const
m_out->Print( aNestLevel, "(group %s\n", m_out->Quotew( aGroup->GetName() ).c_str() );
if(!m_no_generate_uuid) {
if(!this->m_no_generate_uuid) {
KICAD_FORMAT::FormatUuid( m_out, aGroup->m_Uuid );
}
@ -2072,7 +2072,7 @@ void PCB_IO_KICAD_SEXPR::format( const PCB_GENERATOR* aGenerator, int aNestLevel
{
m_out->Print( aNestLevel, "(generated\n" );
if(!m_no_generate_uuid) {
if(!this->m_no_generate_uuid) {
KICAD_FORMAT::FormatUuid( m_out, aGenerator->m_Uuid );
}
@ -2288,7 +2288,7 @@ void PCB_IO_KICAD_SEXPR::format( const PCB_TRACK* aTrack, int aNestLevel ) const
m_out->Print( 0, " (net %d)", m_mapping->Translate( aTrack->GetNetCode() ) );
if(!m_no_generate_uuid) {
if(!this->m_no_generate_uuid) {
KICAD_FORMAT::FormatUuid( m_out, aTrack->m_Uuid );
}
@ -2326,7 +2326,7 @@ void PCB_IO_KICAD_SEXPR::format( const ZONE* aZone, int aNestLevel ) const
formatLayer( aZone->GetFirstLayer() );
}
if(!m_no_generate_uuid) {
if(!this->m_no_generate_uuid) {
KICAD_FORMAT::FormatUuid( m_out, aZone->m_Uuid );
}

View File

@ -220,8 +220,6 @@ class FP_CACHE
// m_cache_timestamp against all the files.
long long m_cache_timestamp; // A hash of the timestamps for all the footprint
// files.
bool m_no_generate_uuid; ///< Flag: Do not generate UUIDs for footprints
public:
FP_CACHE( PCB_IO_KICAD_SEXPR* aOwner, const wxString& aLibraryPath );
@ -378,6 +376,8 @@ public:
return ret;
}
inline void SetUUIDDisabled( bool aDisabled ) { m_no_generate_uuid = aDisabled; }
void SetOutputFormatter( OUTPUTFORMATTER* aFormatter ) { m_out = aFormatter; }
BOARD_ITEM* Parse( const wxString& aClipboardSourceInput );
@ -463,6 +463,8 @@ protected:
NETINFO_MAPPING* m_mapping; ///< mapping for net codes, so only not empty net codes
///< are stored with consecutive integers as net codes
bool m_no_generate_uuid; ///< Flag: Do not generate UUIDs for footprints
std::function<bool( wxString aTitle, int aIcon, wxString aMsg, wxString aAction )> m_queryUserCallback;
};

View File

@ -29,6 +29,8 @@
#include <kiway_player.h>
#include <wildcards_and_files_ext.h>
#include <string_utf8_map.h>
#include <pcb_io/pcb_io_mgr.h>
#include <pcb_io/eagle/pcb_io_eagle.h>
@ -219,13 +221,13 @@ bool PCB_IO_MGR::ConvertLibrary( STRING_UTF8_MAP* aOldFileProps, const wxString&
std::unique_ptr<const FOOTPRINT> fp( oldFilePI->GetEnumeratedFootprint( aOldFilePath, fpName, aOldFileProps ) );
// Set options
PCB_IO_KICAD_SEXPR* kicad_sexpr_parser = dynamic_cast<PCB_IO_KICAD_SEXPR*>( kicadPI.get() );
if(kicad_sexpr_parser !== nullptr) {
kicad_sexpr_parser->m_no_generate_uuid =
aOldFileProps->Exists( "no_uuid_gen" ) &&
aOldFileProps->at( "no_uuid_gen" ) == "true";
if(kicad_sexpr_parser != nullptr) {
UTF8 value;
bool exists = aOldFileProps->Value( "no_uuid_gen", &value );
kicad_sexpr_parser->SetUUIDDisabled(
exists && value == "true"
);
}
kicadPI->FootprintSave( aNewFilePath, fp.get() );
}

View File

@ -1131,7 +1131,7 @@ int PCBNEW_JOBS_HANDLER::JobExportFpUpgrade( JOB* aJob )
else
{
STRING_UTF8_MAP properties;
properties.insert("no_uuid_gen", upgradeJob->m_no_uuid_gen ? "true" : "false");
properties.emplace("no_uuid_gen", upgradeJob->m_no_uuid_gen ? UTF8("true") : UTF8("false"));
if( !PCB_IO_MGR::ConvertLibrary( &properties, upgradeJob->m_libraryPath, upgradeJob->m_outputLibraryPath ) )
{
m_reporter->Report( ( "Unable to convert library\n" ), RPT_SEVERITY_ERROR );