Fix broken layer names used when saving a footprint from library.

This issue was also existing when copying to the clipboard.
Saving boards was not affected.

Instead of using canonical layer names, the user layers names were used.

Fixes #5779
https://gitlab.com/kicad/code/kicad/issues/5779
This commit is contained in:
jean-pierre charras 2020-09-24 18:48:49 +02:00
parent feeb925e61
commit dfaf0851fe
4 changed files with 8 additions and 11 deletions

View File

@ -1230,14 +1230,15 @@ double D_PAD::ViewGetLOD( int aLayer, KIGFX::VIEW* aView ) const
}
// Other layers are shown without any conditions
return 0;
return 0.0;
}
const BOX2I D_PAD::ViewBBox() const
{
// Bounding box includes soldermask too
int solderMaskMargin = GetSolderMaskMargin();
// Bounding box includes soldermask too. Remember mask and/or paste
// margins can be < 0
int solderMaskMargin = std::max( GetSolderMaskMargin(), 0 );
VECTOR2I solderPasteMargin = VECTOR2D( GetSolderPasteMargin() );
EDA_RECT bbox = GetBoundingBox();

View File

@ -38,7 +38,7 @@
#include <kicad_clipboard.h>
CLIPBOARD_IO::CLIPBOARD_IO():
PCB_IO( CTL_STD_LAYER_NAMES ),
PCB_IO( CTL_FOR_CLIPBOARD ),
m_formatter(),
m_parser( new CLIPBOARD_PARSER() )
{

View File

@ -453,10 +453,7 @@ void PCB_IO::formatLayer( const BOARD_ITEM* aItem ) const
{
PCB_LAYER_ID layer = aItem->GetLayer();
if( m_ctl & CTL_STD_LAYER_NAMES ) // English layer names should never need quoting.
m_out->Print( 0, " (layer %s)", TO_UTF8( BOARD::GetStandardLayerName( layer ) ) );
else
m_out->Print( 0, " (layer %s)", m_out->Quotew( LSET::Name( layer ) ).c_str() );
m_out->Print( 0, " (layer %s)", m_out->Quotew( LSET::Name( layer ) ).c_str() );
}

View File

@ -92,7 +92,6 @@ class TEXTE_PCB;
#define BOARD_FILE_HOST_VERSION 20200825 ///< Earlier files than this include the host tag
#define CTL_STD_LAYER_NAMES (1 << 0) ///< Use English Standard layer names
#define CTL_OMIT_NETS (1 << 1) ///< Omit pads net names (useless in library)
#define CTL_OMIT_TSTAMPS (1 << 2) ///< Omit component time stamp (useless in library)
#define CTL_OMIT_INITIAL_COMMENTS (1 << 3) ///< omit MODULE initial comments
@ -106,10 +105,10 @@ class TEXTE_PCB;
// common combinations of the above:
/// Format output for the clipboard instead of footprint library or BOARD
#define CTL_FOR_CLIPBOARD (CTL_STD_LAYER_NAMES|CTL_OMIT_NETS)
#define CTL_FOR_CLIPBOARD // (CTL_OMIT_NETS)
/// Format output for a footprint library instead of clipboard or BOARD
#define CTL_FOR_LIBRARY (CTL_STD_LAYER_NAMES|CTL_OMIT_NETS|CTL_OMIT_TSTAMPS|CTL_OMIT_PATH|CTL_OMIT_AT|CTL_OMIT_LIBNAME)
#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.