Finish module cleanup (except for xpms).

This commit is contained in:
Jeff Young 2020-11-14 22:00:12 +00:00
parent 6e6f6a2d72
commit d094f86b1a
20 changed files with 93 additions and 106 deletions

View File

@ -113,7 +113,7 @@ private:
void exportEeschemaFormat();
/**
* Generate a module in S expr format
* Generate a footprint in S expr format
*/
void exportPcbnewFormat();

View File

@ -307,11 +307,10 @@ public:
/**
* Function LoadFootprintFiles
* reads the list of footprint (*.mod files) and generate the list of footprints.
* for each module are stored
* the module name
* for each footprint are stored
* the footprint name
* documentation string
* associated keywords
* m_ModuleLibNames is the list of library that must be read (loaded)
* fills m_footprints
* @return true if libraries are found, false otherwise.
*/

View File

@ -218,7 +218,7 @@ public:
/**
* Execute a remote command sent by Pcbnew via a socket connection.
* <p>
* When user selects a module or pin in Pcbnew, Eeschema shows that same
* When user selects a footprint or pin in Pcbnew, Eeschema shows that same
* component or pin and moves cursor on the item. The socket port used
* is #KICAD_SCH_PORT_SERVICE_NUMBER which defaults to 4243.
*

View File

@ -781,8 +781,8 @@ bool DIALOG_BOARD_REANNOTATE::BuildFootprintList( std::vector<RefDesInfo>& aBadR
}
}
if(( fpData.Front && annotateBack ) || // If a front module and doing backs only
( !fpData.Front && annotateFront ) || // If a back module and doing front only
if(( fpData.Front && annotateBack ) || // If a front fp and doing backs only
( !fpData.Front && annotateFront ) || // If a back fp and doing front only
( footprint->IsLocked() && skipLocked ) ) // If excluding locked and it is locked
{
fpData.Action = Exclude;

View File

@ -753,7 +753,7 @@ void PANEL_FP_LIB_TABLE::browseLibrariesHandler( wxCommandEvent& event )
// So we must set the file type based on it
if( event.GetEventType() == wxEVT_BUTTON )
{
// Let's default to adding a kicad module for just the module
// Let's default to adding a kicad footprint file for just the footprint
fileTypeIt = fileTypes().find( ID_PANEL_FPLIB_ADD_KICADMOD );
}
else

View File

@ -339,12 +339,12 @@ std::string PLACE_FILE_EXPORTER::GenReportData()
buffer += "\n";
wxPoint module_pos = footprint->GetPosition();
module_pos -= m_place_Offset;
wxPoint footprint_pos = footprint->GetPosition();
footprint_pos -= m_place_Offset;
sprintf( line, "position %9.6f %9.6f orientation %.2f\n",
module_pos.x * conv_unit,
module_pos.y * conv_unit,
footprint_pos.x * conv_unit,
footprint_pos.y * conv_unit,
footprint->GetOrientation() / 10.0 );
buffer += line;

View File

@ -64,7 +64,7 @@ static const wxString INFO_LEGACY_LIB_WARN_DELETE(
/**
* Prompt the user for a module file to open.
* Prompt the user for a footprint file to open.
* @param aParent - parent window for the dialog
* @param aLastPath - last opened path
*/
@ -96,7 +96,7 @@ static wxFileName getFootprintFilenameFromUser( wxWindow* aParent, const wxStrin
* Read a file to detect the type.
* @param aFile - open file to be read. File pointer will be closed.
* @param aFileName - file name to be read
* @param aName - wxString to receive the module name iff type is LEGACY
* @param aName - wxString to receive the footprint name iff type is LEGACY
*/
static IO_MGR::PCB_FILE_T detect_file_type( FILE* aFile, const wxFileName& aFileName,
wxString* aName )
@ -148,22 +148,17 @@ static IO_MGR::PCB_FILE_T detect_file_type( FILE* aFile, const wxFileName& aFile
* @param aFileType - type of the file
* @param aName - name of the footprint
*/
static FOOTPRINT* parse_module_with_plugin( const wxFileName& aFileName,
IO_MGR::PCB_FILE_T aFileType,
const wxString& aName )
static FOOTPRINT* parse_footprint_with_plugin( const wxFileName& aFileName,
IO_MGR::PCB_FILE_T aFileType,
const wxString& aName )
{
wxString path;
switch( aFileType )
{
case IO_MGR::GEDA_PCB:
path = aFileName.GetPath();
break;
case IO_MGR::LEGACY:
path = aFileName.GetFullPath();
break;
default:
wxFAIL_MSG( wxT( "unexpected IO_MGR::PCB_FILE_T" ) );
case IO_MGR::GEDA_PCB: path = aFileName.GetPath(); break;
case IO_MGR::LEGACY: path = aFileName.GetFullPath(); break;
default: wxFAIL_MSG( wxT( "unexpected IO_MGR::PCB_FILE_T" ) ); break;
}
PLUGIN::RELEASER pi( IO_MGR::PluginFind( aFileType ) );
@ -176,7 +171,7 @@ static FOOTPRINT* parse_module_with_plugin( const wxFileName& aFileName,
* Parse a KICAD footprint.
* @param aFileName - file name to parse
*/
static FOOTPRINT* parse_module_kicad( const wxFileName& aFileName )
static FOOTPRINT* parse_footprint_kicad( const wxFileName& aFileName )
{
wxString fcontents;
PCB_IO pcb_io;
@ -206,11 +201,11 @@ FOOTPRINT* try_load_footprint( const wxFileName& aFileName, IO_MGR::PCB_FILE_T a
{
case IO_MGR::GEDA_PCB:
case IO_MGR::LEGACY:
footprint = parse_module_with_plugin( aFileName, aFileType, aName );
footprint = parse_footprint_with_plugin( aFileName, aFileType, aName );
break;
case IO_MGR::KICAD_SEXP:
footprint = parse_module_kicad( aFileName );
footprint = parse_footprint_kicad( aFileName );
break;
default:

View File

@ -56,12 +56,12 @@ DXF_IMPORT_PLUGIN::DXF_IMPORT_PLUGIN() : DL_CreationAdapter()
{
m_xOffset = 0.0; // X coord offset for conversion (in mm)
m_yOffset = 0.0; // Y coord offset for conversion (in mm)
m_DXF2mm = 1.0; // The scale factor to convert DXF units to mm
m_dxf2mm = 1.0; // The scale factor to convert DXF units to mm
m_version = 0; // the dxf version, not yet used
m_inBlock = false; // Discard blocks
m_defaultThickness = 0.2; // default thickness (in mm)
m_brdLayer = Dwgs_User; // The default import layer
m_importAsfootprintGraphicItems = true;
m_importAsFPShapes = true;
m_minX = m_minY = std::numeric_limits<double>::max();
m_maxX = m_maxY = std::numeric_limits<double>::min();
}
@ -110,19 +110,19 @@ void DXF_IMPORT_PLUGIN::SetImporter( GRAPHICS_IMPORTER* aImporter )
double DXF_IMPORT_PLUGIN::mapX( double aDxfCoordX )
{
return SCALE_FACTOR( m_xOffset + ( aDxfCoordX * m_DXF2mm ) );
return SCALE_FACTOR( m_xOffset + ( aDxfCoordX * m_dxf2mm ) );
}
double DXF_IMPORT_PLUGIN::mapY( double aDxfCoordY )
{
return SCALE_FACTOR( m_yOffset - ( aDxfCoordY * m_DXF2mm ) );
return SCALE_FACTOR( m_yOffset - ( aDxfCoordY * m_dxf2mm ) );
}
double DXF_IMPORT_PLUGIN::mapDim( double aDxfValue )
{
return SCALE_FACTOR( aDxfValue * m_DXF2mm );
return SCALE_FACTOR( aDxfValue * m_dxf2mm );
}
@ -275,16 +275,16 @@ void DXF_IMPORT_PLUGIN::addVertex( const DL_VertexData& aData )
if( m_curr_entity.m_EntityParseStatus == 1 ) // This is the first vertex of an entity
{
m_curr_entity.m_LastCoordinate.x = m_xOffset + vertex->x * m_DXF2mm;
m_curr_entity.m_LastCoordinate.y = m_yOffset - vertex->y * m_DXF2mm;
m_curr_entity.m_LastCoordinate.x = m_xOffset + vertex->x * m_dxf2mm;
m_curr_entity.m_LastCoordinate.y = m_yOffset - vertex->y * m_dxf2mm;
m_curr_entity.m_PolylineStart = m_curr_entity.m_LastCoordinate;
m_curr_entity.m_BulgeVertex = vertex->bulge;
m_curr_entity.m_EntityParseStatus = 2;
return;
}
VECTOR2D seg_end( m_xOffset + vertex->x * m_DXF2mm,
m_yOffset - vertex->y * m_DXF2mm );
VECTOR2D seg_end( m_xOffset + vertex->x * m_dxf2mm,
m_yOffset - vertex->y * m_dxf2mm );
if( std::abs( m_curr_entity.m_BulgeVertex ) < MIN_BULGE )
insertLine( m_curr_entity.m_LastCoordinate, seg_end, lineWidth );
@ -709,51 +709,51 @@ void DXF_IMPORT_PLUGIN::setVariableInt( const std::string& key, int value, int c
switch( value )
{
case 1: // inches
m_DXF2mm = 25.4;
m_dxf2mm = 25.4;
break;
case 2: // feet
m_DXF2mm = 304.8;
m_dxf2mm = 304.8;
break;
case 4: // mm
m_DXF2mm = 1.0;
m_dxf2mm = 1.0;
break;
case 5: // centimeters
m_DXF2mm = 10.0;
m_dxf2mm = 10.0;
break;
case 6: // meters
m_DXF2mm = 1000.0;
m_dxf2mm = 1000.0;
break;
case 8: // microinches
m_DXF2mm = 2.54e-5;
m_dxf2mm = 2.54e-5;
break;
case 9: // mils
m_DXF2mm = 0.0254;
m_dxf2mm = 0.0254;
break;
case 10: // yards
m_DXF2mm = 914.4;
m_dxf2mm = 914.4;
break;
case 11: // Angstroms
m_DXF2mm = 1.0e-7;
m_dxf2mm = 1.0e-7;
break;
case 12: // nanometers
m_DXF2mm = 1.0e-6;
m_dxf2mm = 1.0e-6;
break;
case 13: // micrometers
m_DXF2mm = 1.0e-3;
m_dxf2mm = 1.0e-3;
break;
case 14: // decimeters
m_DXF2mm = 100.0;
m_dxf2mm = 100.0;
break;
default:
@ -767,7 +767,7 @@ void DXF_IMPORT_PLUGIN::setVariableInt( const std::string& key, int value, int c
// 18: AU
// 19: lightyears
// 20: parsecs
m_DXF2mm = 1.0;
m_dxf2mm = 1.0;
break;
}

View File

@ -125,26 +125,25 @@ public:
class DXF_IMPORT_PLUGIN : public GRAPHICS_IMPORT_PLUGIN, public DL_CreationAdapter
{
private:
double m_xOffset; // X coord offset for conversion (in mm)
double m_yOffset; // Y coord offset for conversion (in mm)
double m_defaultThickness; // default line thickness for conversion (in mm)
double m_DXF2mm; // The scale factor to convert DXF units to mm
int m_brdLayer; // The board layer to place imported DXF items
int m_version; // the dxf version, not used here
bool m_inBlock; // Are we parsing a block
std::string m_codePage; // The code page, not used here
bool m_importAsfootprintGraphicItems; // Use module items instead of board items when true.
// true when the items are imported in the footprint editor
std::string m_messages; // messages generated during dxf file parsing.
// Each message ends by '\n'
double m_xOffset; // X coord offset for conversion (in mm)
double m_yOffset; // Y coord offset for conversion (in mm)
double m_defaultThickness; // default line thickness for conversion (in mm)
double m_dxf2mm; // The scale factor to convert DXF units to mm
int m_brdLayer; // The board layer to place imported DXF items
int m_version; // the dxf version, not used here
bool m_inBlock; // Are we parsing a block
std::string m_codePage; // The code page, not used here
bool m_importAsFPShapes; // Use footprint items instead of board items when true.
// true when the items are imported in the footprint editor
std::string m_messages; // messages generated during dxf file parsing.
// Each message ends by '\n'
DXF2BRD_ENTITY_DATA m_curr_entity; // the current entity parameters when parsing a DXF entity
double m_minX, m_maxX; // handles image size in mm
double m_minY, m_maxY; // handles image size in mm
double m_minX, m_maxX; // handles image size in mm
double m_minY, m_maxY; // handles image size in mm
GRAPHICS_IMPORTER_BUFFER m_internalImporter;
public:
DXF_IMPORT_PLUGIN();
~DXF_IMPORT_PLUGIN();
@ -177,7 +176,7 @@ public:
*/
void ImportAsFootprintGraphic( bool aImportAsFootprintGraphic )
{
m_importAsfootprintGraphicItems = aImportAsFootprintGraphic;
m_importAsFPShapes = aImportAsFootprintGraphic;
}

View File

@ -53,10 +53,10 @@ using namespace PCB_KEYS_T;
/**
* Helper class for creating a footprint library cache.
*
* The new footprint library design is a file path of individual module files
* that contain a single module per file. This class is a helper only for the
* footprint portion of the PLUGIN API, and only for the #PCB_IO plugin. It is
* private to this implementation file so it is not placed into a header.
* The new footprint library design is a file path of individual footprint files that contain
* a single footprint per file. This class is a helper only for the footprint portion of the
* PLUGIN API, and only for the #PCB_IO plugin. It is private to this implementation file so
* it is not placed into a header.
*/
class FP_CACHE_ITEM
{
@ -294,7 +294,7 @@ void FP_CACHE::Remove( const wxString& aFootprintName )
THROW_IO_ERROR( msg );
}
// Remove the module from the cache and delete the module file from the library.
// Remove the footprint from the cache and delete the footprint file from the library.
wxString fullPath = it->second->GetFileName().GetFullPath();
m_footprints.erase( aFootprintName );
wxRemoveFile( fullPath );
@ -620,8 +620,8 @@ void PCB_IO::formatHeader( BOARD* aBoard, int aNestLevel ) const
void PCB_IO::format( BOARD* aBoard, int aNestLevel ) const
{
std::set<BOARD_ITEM*, BOARD_ITEM::ptr_cmp> sorted_modules( aBoard->Footprints().begin(),
aBoard->Footprints().end() );
std::set<BOARD_ITEM*, BOARD_ITEM::ptr_cmp> sorted_footprints( aBoard->Footprints().begin(),
aBoard->Footprints().end() );
std::set<BOARD_ITEM*, BOARD_ITEM::ptr_cmp> sorted_drawings( aBoard->Drawings().begin(),
aBoard->Drawings().end() );
std::set<TRACK*, TRACK::cmp_tracks> sorted_tracks( aBoard->Tracks().begin(),
@ -634,9 +634,9 @@ void PCB_IO::format( BOARD* aBoard, int aNestLevel ) const
formatHeader( aBoard, aNestLevel );
// Save the footprints.
for( BOARD_ITEM* module : sorted_modules )
for( BOARD_ITEM* footprint : sorted_footprints )
{
Format( module, aNestLevel );
Format( footprint, aNestLevel );
m_out->Print( 0, "\n" );
}
@ -2262,7 +2262,7 @@ void PCB_IO::FootprintSave( const wxString& aLibraryPath, const FOOTPRINT* aFoot
FOOTPRINT_MAP& footprints = m_cache->GetFootprints();
// Quietly overwrite module and delete module file from path for any by same name.
// Quietly overwrite footprint and delete footprint file from path for any by same name.
wxFileName fn( aLibraryPath, aFootprint->GetFPID().GetLibItemName(),
KiCadFootprintFileExtension );

View File

@ -23,12 +23,8 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
/**
* @file pcb_module.h
*/
#ifndef PCB_MODULE_H_
#define PCB_MODULE_H_
#ifndef PCB_FOOTPRINT_H
#define PCB_FOOTPRINT_H
#include <wx/wx.h>
@ -71,4 +67,4 @@ private:
} // namespace PCAD2KICAD
#endif // PCB_MODULE_H_
#endif // PCB_FOOTPRINT_H

View File

@ -669,7 +669,7 @@ IMAGE* SPECCTRA_DB::makeIMAGE( BOARD* aBoard, FOOTPRINT* aFootprint )
{
pinmap[ padName ] = 0;
}
else // pad name is a duplicate within this module
else // pad name is a duplicate within this footprint
{
char buf[32];
@ -900,7 +900,7 @@ void SPECCTRA_DB::FromBOARD( BOARD* aBoard )
{
items.Collect( aBoard, scanMODULEs );
STRINGSET refs; // holds module reference designators
STRINGSET refs; // holds footprint reference designators
for( int i=0; i<items.GetCount(); ++i )
{
@ -1345,13 +1345,13 @@ void SPECCTRA_DB::FromBOARD( BOARD* aBoard )
componentId = TO_UTF8( footprint->GetReference() );
// create a net list entry for all the actual pins in the image
// for the current module. location of this code is critical
// for the current footprint. location of this code is critical
// because we fabricated some pin names to ensure unique-ness
// of pin names within a module, do not move this code because
// of pin names within a footprint, do not move this code because
// the life of this 'IMAGE* image' is not necessarily long. The
// exported netlist will have some fabricated pin names in it.
// If you don't like fabricated pin names, then make sure all pads
// within your MODULEs are uniquely named!
// within your FOOTPRINTs are uniquely named!
for( unsigned p = 0; p<image->pins.size(); ++p )
{
PIN* pin = &image->pins[p];
@ -1393,7 +1393,7 @@ void SPECCTRA_DB::FromBOARD( BOARD* aBoard )
place->component_id = componentId;
place->part_number = TO_UTF8( footprint->GetValue() );
// module is flipped from bottom side, set side to T_back
// footprint is flipped from bottom side, set side to T_back
if( footprint->GetFlag() )
{
double angle = 180.0 - footprint->GetOrientationDegrees();
@ -1737,13 +1737,13 @@ void SPECCTRA_DB::FlipFOOTPRINTs( BOARD* aBoard )
// top view.
// Note: to export footprints, the footprints must be flipped around the X axis,
// otherwise the rotation angle is not good
for( auto module : aBoard->Footprints() )
for( FOOTPRINT* footprint : aBoard->Footprints() )
{
module->SetFlag( 0 );
if( module->GetLayer() == B_Cu )
footprint->SetFlag( 0 );
if( footprint->GetLayer() == B_Cu )
{
module->Flip( module->GetPosition(), false );
module->SetFlag( 1 );
footprint->Flip( footprint->GetPosition(), false );
footprint->SetFlag( 1 );
}
}

View File

@ -374,7 +374,7 @@ void SPECCTRA_DB::FromSESSION( BOARD* aBoard )
if( footprint->GetLayer() != F_Cu )
{
// module is on copper layer (back)
// footprint is on copper layer (back)
footprint->Flip( footprint->GetPosition(), false );
}
@ -386,7 +386,7 @@ void SPECCTRA_DB::FromSESSION( BOARD* aBoard )
if( footprint->GetLayer() != B_Cu )
{
// module is on component layer (front)
// footprint is on component layer (front)
footprint->Flip( footprint->GetPosition(), false );
}

View File

@ -341,7 +341,7 @@ void PYTHON_FOOTPRINT_WIZARD::ResetParameters()
}
// this is a SWIG function declaration -from module.i
// this is a SWIG function declaration -from footprint.i
FOOTPRINT* PyFootprint_to_FOOTPRINT( PyObject* obj0 );

View File

@ -650,9 +650,7 @@ int PCBNEW_CONTROL::Paste( const TOOL_EVENT& aEvent )
}
}
// The clipboard can contain two different things, an entire kicad_pcb
// or a single module
// The clipboard can contain two different things, an entire kicad_pcb or a single footprint
if( isFootprintEditor && ( !board() || !footprint() ) )
{
return 0;
@ -886,7 +884,7 @@ int PCBNEW_CONTROL::placeBoardItems( std::vector<BOARD_ITEM*>& aItems, bool aIsN
}
case PCB_FOOTPRINT_T:
// Update the module path with the new KIID path if the module is new
// Update the footprint path with the new KIID path if the footprint is new
if( aIsNew )
static_cast<FOOTPRINT*>( item )->SetPath( KIID_PATH() );

View File

@ -141,7 +141,7 @@ private:
* This is slightly different from the standard lock checking in that we ignore the lock
* of the first element in the selection as this is meant to be our anchor.
* We also check the lock of a pad's parent as we will not move pads independently of
* the parent module
* the parent footprint
*/
int checkLockedStatus( const PCBNEW_SELECTION &selection ) const;

View File

@ -1177,7 +1177,7 @@ void POINT_EDITOR::updateItem() const
break;
}
// Update relative coordinates for module edges
// Update relative coordinates for footprint shapes
if( FP_SHAPE* fpShape = dyn_cast<FP_SHAPE*>( item ) )
fpShape->SetLocalCoord();

View File

@ -2065,7 +2065,7 @@ void SELECTION_TOOL::highlightInternal( BOARD_ITEM* aItem, int aMode,
}
// footprints are treated in a special way - when they are highlighted, we have to highlight
// all the parts that make the module, not the module itself
// all the parts that make the footprint, not the footprint itself
if( aItem->Type() == PCB_FOOTPRINT_T )
{
static_cast<FOOTPRINT*>( aItem )->RunOnChildren(

View File

@ -39,7 +39,7 @@ set( QA_EESCHEMA_SRCS
uuid_test_utils.cpp
# The main test entry points
test_footprint.cpp
test_module.cpp
# Base internal units (1=100nm) testing.
test_sch_biu.cpp

View File

@ -31,7 +31,7 @@
bool init_unit_test()
{
boost::unit_test::framework::master_test_suite().p_name.value = "S-expression footprint tests";
boost::unit_test::framework::master_test_suite().p_name.value = "S-expression module tests";
return wxInitialize();
}