Yet more module -> footprint.

This commit is contained in:
Jeff Young 2020-11-13 02:57:11 +00:00
parent 9106cc19bf
commit 522d64968e
44 changed files with 771 additions and 763 deletions

View File

@ -1409,38 +1409,32 @@ void C3D_RENDER_RAYTRACING::load_3D_models( CCONTAINER &aDstContainer, bool aSki
wxPoint pos = fp->GetPosition();
glm::mat4 moduleMatrix = glm::mat4( 1.0f );
glm::mat4 fpMatrix = glm::mat4( 1.0f );
moduleMatrix = glm::translate( moduleMatrix,
SFVEC3F( pos.x * m_boardAdapter.BiuTo3Dunits(),
-pos.y * m_boardAdapter.BiuTo3Dunits(),
zpos ) );
fpMatrix = glm::translate( fpMatrix, SFVEC3F( pos.x * m_boardAdapter.BiuTo3Dunits(),
-pos.y * m_boardAdapter.BiuTo3Dunits(),
zpos ) );
if( fp->GetOrientation() )
{
moduleMatrix = glm::rotate( moduleMatrix,
( (float)(fp->GetOrientation() / 10.0f) / 180.0f ) *
glm::pi<float>(),
SFVEC3F( 0.0f, 0.0f, 1.0f ) );
fpMatrix = glm::rotate( fpMatrix,
( (float)(fp->GetOrientation() / 10.0f) / 180.0f ) * glm::pi<float>(),
SFVEC3F( 0.0f, 0.0f, 1.0f ) );
}
if( fp->IsFlipped() )
{
moduleMatrix = glm::rotate( moduleMatrix,
glm::pi<float>(),
SFVEC3F( 0.0f, 1.0f, 0.0f ) );
fpMatrix = glm::rotate( fpMatrix, glm::pi<float>(), SFVEC3F( 0.0f, 1.0f, 0.0f ) );
moduleMatrix = glm::rotate( moduleMatrix,
glm::pi<float>(),
SFVEC3F( 0.0f, 0.0f, 1.0f ) );
fpMatrix = glm::rotate( fpMatrix, glm::pi<float>(), SFVEC3F( 0.0f, 0.0f, 1.0f ) );
}
const double modelunit_to_3d_units_factor = m_boardAdapter.BiuTo3Dunits() *
UNITS3D_TO_UNITSPCB;
moduleMatrix = glm::scale( moduleMatrix,
SFVEC3F( modelunit_to_3d_units_factor,
fpMatrix = glm::scale( fpMatrix,
SFVEC3F( modelunit_to_3d_units_factor,
modelunit_to_3d_units_factor,
modelunit_to_3d_units_factor ) );
@ -1462,7 +1456,7 @@ void C3D_RENDER_RAYTRACING::load_3D_models( CCONTAINER &aDstContainer, bool aSki
// only add it if the return is not NULL
if( modelPtr )
{
glm::mat4 modelMatrix = moduleMatrix;
glm::mat4 modelMatrix = fpMatrix;
modelMatrix = glm::translate( modelMatrix,
SFVEC3F( sM->m_Offset.x,
@ -1611,12 +1605,9 @@ MODEL_MATERIALS *C3D_RENDER_RAYTRACING::get_3D_model_material( const S3DMODEL *a
return materialVector;
}
void C3D_RENDER_RAYTRACING::add_3D_models( CCONTAINER &aDstContainer,
const S3DMODEL *a3DModel,
const glm::mat4 &aModelMatrix,
float aModuleOpacity,
bool aSkipMaterialInformation,
BOARD_ITEM *aBoardItem )
void C3D_RENDER_RAYTRACING::add_3D_models( CCONTAINER &aDstContainer, const S3DMODEL *a3DModel,
const glm::mat4 &aModelMatrix, float aFPOpacity,
bool aSkipMaterialInformation, BOARD_ITEM *aBoardItem )
{
// Validate a3DModel pointers
@ -1629,12 +1620,12 @@ void C3D_RENDER_RAYTRACING::add_3D_models( CCONTAINER &aDstContainer,
wxASSERT( a3DModel->m_Meshes != NULL );
wxASSERT( a3DModel->m_MaterialsSize > 0 );
wxASSERT( a3DModel->m_MeshesSize > 0 );
wxASSERT( aModuleOpacity > 0.0f );
wxASSERT( aModuleOpacity <= 1.0f );
wxASSERT( aFPOpacity > 0.0f );
wxASSERT( aFPOpacity <= 1.0f );
if( aModuleOpacity > 1.0f )
if( aFPOpacity > 1.0f )
{
aModuleOpacity = 1.0f;
aFPOpacity = 1.0f;
}
if( (a3DModel->m_Materials != NULL) && (a3DModel->m_Meshes != NULL) &&
@ -1672,14 +1663,14 @@ void C3D_RENDER_RAYTRACING::add_3D_models( CCONTAINER &aDstContainer,
((mesh.m_FaceIdxSize % 3) == 0) &&
(mesh.m_MaterialIdx < a3DModel->m_MaterialsSize) )
{
float moduleTransparency;
float fpTransparency;
const CBLINN_PHONG_MATERIAL *blinn_material;
if( !aSkipMaterialInformation )
{
blinn_material = &(*materialVector)[mesh.m_MaterialIdx];
moduleTransparency = 1.0f - ( ( 1.0f - blinn_material->GetTransparency() ) * aModuleOpacity );
fpTransparency = 1.0f - (( 1.0f - blinn_material->GetTransparency() ) * aFPOpacity );
}
// Add all face triangles
@ -1726,7 +1717,7 @@ void C3D_RENDER_RAYTRACING::add_3D_models( CCONTAINER &aDstContainer,
if( !aSkipMaterialInformation )
{
newTriangle->SetMaterial( blinn_material );
newTriangle->SetModelTransparency( moduleTransparency );
newTriangle->SetModelTransparency( fpTransparency );
if( mesh.m_Color == NULL )
{

View File

@ -210,7 +210,7 @@ private:
void add_3D_models( CCONTAINER &aDstContainer,
const S3DMODEL *a3DModel,
const glm::mat4 &aModelMatrix,
float aModuleOpacity,
float aFPOpacity,
bool aSkipMaterialInformation,
BOARD_ITEM *aBoardItem );

View File

@ -54,21 +54,21 @@ size_t hash_eda( const EDA_ITEM* aItem, int aFlags )
{
case PCB_MODULE_T:
{
const MODULE* module = static_cast<const MODULE*>( aItem );
const MODULE* footprint = static_cast<const MODULE*>( aItem );
ret = hash_board_item( module, aFlags );
ret = hash_board_item( footprint, aFlags );
if( aFlags & HASH_POS )
hash_combine( ret, module->GetPosition().x, module->GetPosition().y );
hash_combine( ret, footprint->GetPosition().x, footprint->GetPosition().y );
if( aFlags & HASH_ROT )
hash_combine( ret, module->GetOrientation() );
hash_combine( ret, footprint->GetOrientation() );
for( auto i : module->GraphicalItems() )
hash_combine( ret, hash_eda( i, aFlags ) );
for( BOARD_ITEM* item : footprint->GraphicalItems() )
hash_combine( ret, hash_eda( item, aFlags ) );
for( auto i : module->Pads() )
hash_combine( ret, hash_eda( static_cast<EDA_ITEM*>( i ), aFlags ) );
for( PAD* pad : footprint->Pads() )
hash_combine( ret, hash_eda( static_cast<EDA_ITEM*>( pad ), aFlags ) );
}
break;

View File

@ -197,7 +197,7 @@ void BACK_ANNOTATE::getPcbModulesFromString( const std::string& aPayload )
else
{
// Add module to the map
auto data = std::make_shared<PCB_MODULE_DATA>( ref, footprint, value, pinNetMap );
auto data = std::make_shared<PCB_FP_DATA>( ref, footprint, value, pinNetMap );
m_pcbModules.insert( nearestItem, std::make_pair( path, data ) );
}
}
@ -206,7 +206,7 @@ void BACK_ANNOTATE::getPcbModulesFromString( const std::string& aPayload )
void BACK_ANNOTATE::getChangeList()
{
for( std::pair<const wxString, std::shared_ptr<PCB_MODULE_DATA>>& module : m_pcbModules )
for( std::pair<const wxString, std::shared_ptr<PCB_FP_DATA>>& module : m_pcbModules )
{
const wxString& pcbPath = module.first;
auto& pcbData = module.second;
@ -273,7 +273,7 @@ void BACK_ANNOTATE::checkForUnusedSymbols()
size_t i = 0;
for( const std::pair<SCH_REFERENCE, std::shared_ptr<PCB_MODULE_DATA>>& item : m_changelist )
for( const std::pair<SCH_REFERENCE, std::shared_ptr<PCB_FP_DATA>>& item : m_changelist )
{
// Refs and changelist are both sorted by paths, so we just go over m_refs and
// generate errors before we will find m_refs member to which item linked
@ -305,61 +305,61 @@ void BACK_ANNOTATE::applyChangelist()
for( CHANGELIST_ITEM& item : m_changelist )
{
SCH_REFERENCE& ref = item.first;
PCB_MODULE_DATA& module = *item.second;
PCB_FP_DATA& fpData = *item.second;
SCH_COMPONENT* comp = ref.GetComp();
SCH_SCREEN* screen = ref.GetSheetPath().LastScreen();
wxString oldFootprint = ref.GetFootprint();
wxString oldValue = ref.GetValue();
bool skip = ( ref.GetComp()->GetFlags() & SKIP_STRUCT ) > 0;
if( m_processReferences && ref.GetRef() != module.m_ref && !skip )
if( m_processReferences && ref.GetRef() != fpData.m_ref && !skip )
{
++m_changesCount;
msg.Printf( _( "Change \"%s\" reference designator to \"%s\"." ),
ref.GetFullRef(),
module.m_ref );
fpData.m_ref );
if( !m_dryRun )
{
m_frame->SaveCopyInUndoList( screen, comp, UNDO_REDO::CHANGED, m_appendUndo );
m_appendUndo = true;
comp->SetRef( &ref.GetSheetPath(), module.m_ref );
comp->SetRef( &ref.GetSheetPath(), fpData.m_ref );
}
m_reporter.ReportHead( msg, RPT_SEVERITY_ACTION );
}
if( m_processFootprints && oldFootprint != module.m_footprint && !skip )
if( m_processFootprints && oldFootprint != fpData.m_footprint && !skip )
{
++m_changesCount;
msg.Printf( _( "Change %s footprint from \"%s\" to \"%s\"." ),
ref.GetFullRef(),
oldFootprint,
module.m_footprint );
fpData.m_footprint );
if( !m_dryRun )
{
m_frame->SaveCopyInUndoList( screen, comp, UNDO_REDO::CHANGED, m_appendUndo );
m_appendUndo = true;
comp->SetFootprint( &ref.GetSheetPath(), module.m_footprint );
comp->SetFootprint( &ref.GetSheetPath(), fpData.m_footprint );
}
m_reporter.ReportHead( msg, RPT_SEVERITY_ACTION );
}
if( m_processValues && oldValue != module.m_value && !skip )
if( m_processValues && oldValue != fpData.m_value && !skip )
{
++m_changesCount;
msg.Printf( _( "Change %s value from \"%s\" to \"%s\"." ),
ref.GetFullRef(),
oldValue,
module.m_value );
fpData.m_value );
if( !m_dryRun )
{
m_frame->SaveCopyInUndoList( screen, comp, UNDO_REDO::CHANGED, m_appendUndo );
m_appendUndo = true;
comp->SetValue( &ref.GetSheetPath(), module.m_value );
comp->SetValue( &ref.GetSheetPath(), fpData.m_value );
}
m_reporter.ReportHead( msg, RPT_SEVERITY_ACTION );
@ -367,7 +367,7 @@ void BACK_ANNOTATE::applyChangelist()
if( m_processNetNames )
{
for( const std::pair<const wxString, wxString>& entry : module.m_pinMap )
for( const std::pair<const wxString, wxString>& entry : fpData.m_pinMap )
{
const wxString& pinNumber = entry.first;
const wxString& shortNetName = entry.second;

View File

@ -43,25 +43,25 @@ class SCH_EDIT_FRAME;
* @brief Back annotation algorithm class used to recieve, check, and apply a \ref NETLIST from
* PCBNEW.
* The following checks are made:
* - Schematic symbol exists, but linked PCBnew module missing
* - PCBnew module exists but no schematic symbol connected to
* - PCBnew module is standalone
* - Schematic symbol exists, but linked PCBnew footprint missing
* - PCBnew footprint exists but no schematic symbol connected to
* - PCBnew footprint is standalone
* - Schematic sheet is reused one or more times and user trying to change footprint or value
* only for few of them.
* - Schematic symbols share same path
* - More than one PCBnew module linked to same path
* - More than one PCBnew footprint linked to same path
*/
class BACK_ANNOTATE
{
public:
/**
* @brief Struct to hold PCBnew module data
* @brief Struct to hold PCBnew footprint data
*/
struct PCB_MODULE_DATA
struct PCB_FP_DATA
{
PCB_MODULE_DATA( const wxString& aRef, const wxString& aFootprint,
const wxString& aValue, const std::map<wxString, wxString> aPinMap ) :
PCB_FP_DATA( const wxString& aRef, const wxString& aFootprint, const wxString& aValue,
const std::map<wxString, wxString> aPinMap ) :
m_ref( aRef ),
m_footprint( aFootprint ),
m_value( aValue ),
@ -75,9 +75,9 @@ public:
};
///> Map to hold NETLIST footprints data
using PCB_MODULES_MAP = std::map<wxString, std::shared_ptr<PCB_MODULE_DATA>>;
using PCB_MODULES_MAP = std::map<wxString, std::shared_ptr<PCB_FP_DATA>>;
using CHANGELIST_ITEM = std::pair<SCH_REFERENCE, std::shared_ptr<PCB_MODULE_DATA>>;
using CHANGELIST_ITEM = std::pair<SCH_REFERENCE, std::shared_ptr<PCB_FP_DATA>>;
BACK_ANNOTATE( SCH_EDIT_FRAME* aFrame, REPORTER& aReporter, bool aRelinkFootprints,
bool aProcessFootprints, bool aProcessValues, bool aProcessReferences,

View File

@ -171,7 +171,7 @@ int SCH_DRAWING_TOOLS::PlaceComponent( const TOOL_EVENT& aEvent )
{
m_toolMgr->RunAction( EE_ACTIONS::clearSelection, true );
// Pick the module to be placed
// Pick the footprint to be placed
bool footprintPreviews = m_frame->eeconfig()->m_Appearance.footprint_preview;
PICKED_SYMBOL sel = m_frame->PickSymbolFromLibTree( &filter, *historyList, true,
1, 1, footprintPreviews );
@ -281,7 +281,7 @@ int SCH_DRAWING_TOOLS::PlaceComponent( const TOOL_EVENT& aEvent )
else
evt->SetPassEvent();
// Enable autopanning and cursor capture only when there is a module to be placed
// Enable autopanning and cursor capture only when there is a footprint to be placed
getViewControls()->SetAutoPan( component != nullptr );
getViewControls()->CaptureCursor( component != nullptr );
}
@ -447,7 +447,7 @@ int SCH_DRAWING_TOOLS::PlaceImage( const TOOL_EVENT& aEvent )
else
evt->SetPassEvent();
// Enable autopanning and cursor capture only when there is a module to be placed
// Enable autopanning and cursor capture only when there is a footprint to be placed
getViewControls()->SetAutoPan( image != nullptr );
getViewControls()->CaptureCursor( image != nullptr );
}
@ -981,7 +981,7 @@ int SCH_DRAWING_TOOLS::TwoClickPlace( const TOOL_EVENT& aEvent )
else
evt->SetPassEvent();
// Enable autopanning and cursor capture only when there is a module to be placed
// Enable autopanning and cursor capture only when there is a footprint to be placed
getViewControls()->SetAutoPan( item != nullptr );
getViewControls()->CaptureCursor( item != nullptr );
}

View File

@ -243,7 +243,7 @@ void GBR_TO_PCB_EXPORTER::export_non_copper_item( GERBER_DRAW_ITEM* aGbrItem, LA
/*
* Many holes will be pads, but we have no way to create those without footprints, and creating
* a module per pad is not really viable.
* a footprint per pad is not really viable.
*
* So we use vias to mimic holes, with the loss of any hole shape (as we only have round holes
* in vias at present).
@ -396,7 +396,7 @@ void GBR_TO_PCB_EXPORTER::export_segarc_copper_item( GERBER_DRAW_ITEM* aGbrItem,
/*
* Flashed items are usually pads or vias. Pads are problematic because we have no way to
* represent one in Pcbnew outside of a module (and creating a module per pad isn't really
* represent one in Pcbnew outside of a footprint (and creating a footprint per pad isn't really
* viable).
* If we've already created a via from a hole, and the flashed copper item is a simple circle
* then we'll enlarge the via to the proper size. Otherwise we create a copper polygon to

View File

@ -214,18 +214,18 @@ public:
}
/**
* Get info for a module by id.
* Get info for a footprint by id.
*/
FOOTPRINT_INFO* GetFootprintInfo( const wxString& aFootprintName );
/**
* Get info for a module by libNickname/footprintName
* Get info for a footprint by libNickname/footprintName
*/
FOOTPRINT_INFO* GetFootprintInfo( const wxString& aLibNickname,
const wxString& aFootprintName );
/**
* Get info for a module by index.
* Get info for a footprint by index.
* @param aIdx = index of the given item
* @return the aIdx item in list
*/

View File

@ -89,7 +89,7 @@ int GraphicTextWidth( const wxString& aText, const wxSize& aSize, bool italic, b
/**
* Function GRText
* Draw a graphic text (like module texts)
* Draw a graphic text (like footprint text)
* @param aClipBox = the clipping rect, or NULL if no clipping
* @param aDC = the current Device Context. NULL if draw within a 3D GL Canvas
* @param aPos = text position (according to h_justify, v_justify)

View File

@ -321,10 +321,10 @@ public:
/**
* Adds the given module to the board.
* @param module
* @param aFootprint
* @param aDC (can be NULL ) = the current Device Context, to draw the new footprint
*/
virtual void AddFootprintToBoard( MODULE* module );
virtual void AddFootprintToBoard( MODULE* aFootprint );
/**
* Function SelectFootprintFromLibBrowser

View File

@ -67,8 +67,8 @@ public:
bool m_DisplayViaFill;
bool m_DisplayPadNum; // show pads numbers
bool m_DisplayPadIsol;
bool m_DisplayGraphicsFill; // How to display module drawings ( sketch/ filled )
bool m_DisplayTextFill; // How to display module texts ( sketch/ filled )
bool m_DisplayGraphicsFill; // How to display fp drawings ( sketch/ filled )
bool m_DisplayTextFill; // How to display fp texts ( sketch/ filled )
bool m_DisplayPcbTrackFill; // false : tracks are show in sketch mode, true = filled.
/// How trace clearances are displayed. @see TRACE_CLEARANCE_DISPLAY_MODE_T.

View File

@ -52,9 +52,9 @@ void ARRAY_CREATOR::Invoke()
if( m_selection.Size() == 0 )
return;
MODULE* const module = m_editModules ? m_parent.GetBoard()->GetFirstFootprint() : nullptr;
MODULE* const fp = m_isFootprintEditor ? m_parent.GetBoard()->GetFirstFootprint() : nullptr;
const bool enableArrayNumbering = m_editModules;
const bool enableArrayNumbering = m_isFootprintEditor;
const wxPoint rotPoint = (wxPoint) m_selection.GetCenter();
std::unique_ptr<ARRAY_OPTIONS> array_opts;
@ -68,15 +68,15 @@ void ARRAY_CREATOR::Invoke()
BOARD_COMMIT commit( &m_parent );
ARRAY_PAD_NAME_PROVIDER pad_name_provider( module, *array_opts );
ARRAY_PAD_NAME_PROVIDER pad_name_provider( fp, *array_opts );
for ( int i = 0; i < m_selection.Size(); ++i )
{
BOARD_ITEM* item = static_cast<BOARD_ITEM*>( m_selection[ i ] );
if( item->Type() == PCB_PAD_T && !m_editModules )
if( item->Type() == PCB_PAD_T && !m_isFootprintEditor )
{
// If it is not the module editor, then duplicate the parent module instead
// If it is not the footprint editor, then duplicate the parent footprint instead
item = static_cast<MODULE*>( item )->GetParent();
}
@ -96,11 +96,11 @@ void ARRAY_CREATOR::Invoke()
// Need to create a new item
BOARD_ITEM* new_item = nullptr;
if( m_editModules )
if( m_isFootprintEditor )
{
// Don't bother incrementing pads: the module won't update
// until commit, so we can only do this once
new_item = module->DuplicateItem( item );
// Don't bother incrementing pads: the footprint won't update until commit,
// so we can only do this once
new_item = fp->DuplicateItem( item );
}
else
{

View File

@ -33,15 +33,16 @@
#include <tools/pcbnew_selection.h>
/*!
* Class that performs array creation by producing a dialog to gather
* parameters and then creating and laying out the items.
* Class that performs array creation by producing a dialog to gather parameters and then
* creating and laying out the items.
*/
class ARRAY_CREATOR
{
public:
ARRAY_CREATOR( PCB_BASE_FRAME& aParent, bool editModules, const PCBNEW_SELECTION& aSelection ) :
ARRAY_CREATOR( PCB_BASE_FRAME& aParent, bool aIsFootprintEditor,
const PCBNEW_SELECTION& aSelection ) :
m_parent( aParent ),
m_editModules( editModules ),
m_isFootprintEditor( aIsFootprintEditor ),
m_selection( aSelection )
{}
@ -54,7 +55,7 @@ public:
private:
PCB_BASE_FRAME& m_parent;
bool m_editModules;
bool m_isFootprintEditor;
const PCBNEW_SELECTION& m_selection;
};

View File

@ -26,8 +26,8 @@
#include <pad.h>
ARRAY_PAD_NAME_PROVIDER::ARRAY_PAD_NAME_PROVIDER(
const MODULE* aMod, const ARRAY_OPTIONS& aArrayOpts )
ARRAY_PAD_NAME_PROVIDER::ARRAY_PAD_NAME_PROVIDER( const MODULE* aFootprint,
const ARRAY_OPTIONS& aArrayOpts )
: m_arrayOpts( aArrayOpts )
{
// start by numbering the first new item
@ -41,14 +41,12 @@ ARRAY_PAD_NAME_PROVIDER::ARRAY_PAD_NAME_PROVIDER(
}
else
{
// no module, no reserved names either
if( aMod )
// no footprint, no reserved names either
if( aFootprint )
{
// reserve the name of each existing pad
for( auto pad : aMod->Pads() )
{
for( PAD* pad : aFootprint->Pads() )
m_existing_pad_names.insert( pad->GetName() );
}
}
}
}

View File

@ -37,10 +37,10 @@ class ARRAY_PAD_NAME_PROVIDER
{
public:
/**
* @param aMod the module to gather existing names from (nullptr for no module)
* @oaram aArrayOpts the array options that provide the candidate names
* @param aFootprint the footprint to gather existing names from (nullptr for no footprint)
* @oaram aArrayOpts the array options that provide the candidate names
*/
ARRAY_PAD_NAME_PROVIDER( const MODULE* aMod, const ARRAY_OPTIONS& aArrayOpts );
ARRAY_PAD_NAME_PROVIDER( const MODULE* aFootprint, const ARRAY_OPTIONS& aArrayOpts );
/**
* Get the next available pad name.

View File

@ -546,8 +546,8 @@ unsigned int AR_AUTOPLACER::calculateKeepOutArea( const EDA_RECT& aRect, int sid
* Returns the value TstRectangle().
* Module is known by its bounding box
*/
int AR_AUTOPLACER::testModuleOnBoard( MODULE* aFootprint, bool TstOtherSide,
const wxPoint& aOffset )
int AR_AUTOPLACER::testFootprintOnBoard( MODULE* aFootprint, bool TstOtherSide,
const wxPoint& aOffset )
{
int side = AR_SIDE_TOP;
int otherside = AR_SIDE_BOTTOM;
@ -587,23 +587,22 @@ int AR_AUTOPLACER::testModuleOnBoard( MODULE* aFootprint, bool TstOtherSide,
int AR_AUTOPLACER::getOptimalFPPlacement( MODULE* aFootprint )
{
int error = 1;
wxPoint LastPosOK;
wxPoint lastPosOK;
double min_cost, curr_cost, Score;
bool TstOtherSide;
bool testOtherSide;
aFootprint->CalculateBoundingBox();
LastPosOK = m_matrix.m_BrdBox.GetOrigin();
lastPosOK = m_matrix.m_BrdBox.GetOrigin();
wxPoint mod_pos = aFootprint->GetPosition();
EDA_RECT fpBBox = aFootprint->GetFootprintRect();
wxPoint fpPos = aFootprint->GetPosition();
EDA_RECT fpBBox = aFootprint->GetFootprintRect();
// Move fpBBox to have the footprint position at (0,0)
fpBBox.Move( -mod_pos );
fpBBox.Move( -fpPos );
wxPoint fpBBoxOrg = fpBBox.GetOrigin();
// Calculate the limit of the footprint position, relative
// to the routing matrix area
// Calculate the limit of the footprint position, relative to the routing matrix area
wxPoint xylimit = m_matrix.m_BrdBox.GetEnd() - fpBBox.GetEnd();
wxPoint initialPos = m_matrix.m_BrdBox.GetOrigin() - fpBBoxOrg;
@ -613,12 +612,10 @@ int AR_AUTOPLACER::getOptimalFPPlacement( MODULE* aFootprint )
initialPos.y -= initialPos.y % m_matrix.m_GridRouting;
m_curPosition = initialPos;
auto moduleOffset = mod_pos - m_curPosition;
wxPoint fpOffset = fpPos - m_curPosition;
/* Examine pads, and set TstOtherSide to true if a footprint
* has at least 1 pad through.
*/
TstOtherSide = false;
// Examine pads, and set testOtherSide to true if a footprint has at least 1 pad through.
testOtherSide = false;
if( m_matrix.m_RoutingLayersCount > 1 )
{
@ -629,7 +626,7 @@ int AR_AUTOPLACER::getOptimalFPPlacement( MODULE* aFootprint )
if( !( pad->GetLayerSet() & other ).any() )
continue;
TstOtherSide = true;
testOtherSide = true;
break;
}
}
@ -648,19 +645,19 @@ int AR_AUTOPLACER::getOptimalFPPlacement( MODULE* aFootprint )
{
fpBBox.SetOrigin( fpBBoxOrg + m_curPosition );
moduleOffset = mod_pos - m_curPosition;
int keepOutCost = testModuleOnBoard( aFootprint, TstOtherSide, moduleOffset );
fpOffset = fpPos - m_curPosition;
int keepOutCost = testFootprintOnBoard( aFootprint, testOtherSide, fpOffset );
if( keepOutCost >= 0 ) // i.e. if the module can be put here
if( keepOutCost >= 0 ) // i.e. if the footprint can be put here
{
error = 0;
// m_frame->build_ratsnest_module( aFootprint ); // fixme
curr_cost = computePlacementRatsnestCost( aFootprint, moduleOffset );
curr_cost = computePlacementRatsnestCost( aFootprint, fpOffset );
Score = curr_cost + keepOutCost;
if( (min_cost >= Score ) || (min_cost < 0 ) )
{
LastPosOK = m_curPosition;
lastPosOK = m_curPosition;
min_cost = Score;
wxString msg;
/* msg.Printf( wxT( "Score %g, pos %s, %s" ),
@ -674,7 +671,7 @@ int AR_AUTOPLACER::getOptimalFPPlacement( MODULE* aFootprint )
}
// Regeneration of the modified variable.
m_curPosition = LastPosOK;
m_curPosition = lastPosOK;
m_minCost = min_cost;
return error;
@ -897,7 +894,7 @@ AR_RESULT AR_AUTOPLACER::AutoplaceFootprints( std::vector<MODULE*>& aFootprints,
if( genPlacementRoutingMatrix( ) == 0 )
return AR_FAILURE;
int moduleCount = 0;
int placedCount = 0;
for( MODULE* footprint : m_board->Footprints() )
footprint->SetNeedsPlaced( false );
@ -928,7 +925,7 @@ AR_RESULT AR_AUTOPLACER::AutoplaceFootprints( std::vector<MODULE*>& aFootprints,
for( MODULE* footprint : m_board->Footprints() )
{
if( footprint->NeedsPlaced() ) // Erase from screen
moduleCount++;
placedCount++;
else
genModuleOnRoutingMatrix( footprint );
}
@ -940,7 +937,7 @@ AR_RESULT AR_AUTOPLACER::AutoplaceFootprints( std::vector<MODULE*>& aFootprints,
if( m_progressReporter )
{
m_progressReporter->Report( _( "Autoplacing components..." ) );
m_progressReporter->SetMaxProgress( moduleCount );
m_progressReporter->SetMaxProgress( placedCount );
}
drawPlacementRoutingMatrix();
@ -992,7 +989,7 @@ AR_RESULT AR_AUTOPLACER::AutoplaceFootprints( std::vector<MODULE*>& aFootprints,
goto end_of_tst;
}
// Determine if the best orientation of a module is 90.
// Determine if the best orientation of a footprint is 90.
rotAllowed = footprint->GetPlacementCost90();
if( rotAllowed != 0 )
@ -1015,11 +1012,11 @@ AR_RESULT AR_AUTOPLACER::AutoplaceFootprints( std::vector<MODULE*>& aFootprints,
goto end_of_tst;
}
// Determine if the best orientation of a module is -90.
// Determine if the best orientation of a footprint is -90.
if( rotAllowed != 0 )
{
rotateFootprint( footprint, 2700.0, true );
error = getOptimalFPPlacement( footprint );
error = getOptimalFPPlacement( footprint );
m_minCost *= OrientationPenalty[rotAllowed];
if( bestScore > m_minCost ) // This orientation is better.
@ -1049,7 +1046,7 @@ end_of_tst:
rotateFootprint( footprint, bestRotation, false );
}
// Place module.
// Place footprint.
placeFootprint( footprint, true, m_curPosition );
footprint->CalculateBoundingBox();
@ -1061,7 +1058,6 @@ end_of_tst:
if( m_refreshCallback )
m_refreshCallback( footprint );
if( m_progressReporter )
{
m_progressReporter->AdvanceProgress();
@ -1079,8 +1075,8 @@ end_of_tst:
m_matrix.UnInitRoutingMatrix();
for( MODULE* footprint : m_board->Footprints() )
footprint->CalculateBoundingBox();
for( MODULE* fp : m_board->Footprints() )
fp->CalculateBoundingBox();
return cancelled ? AR_CANCELLED : AR_COMPLETED;
}

View File

@ -97,12 +97,12 @@ private:
int testRectangle( const EDA_RECT& aRect, int side );
unsigned int calculateKeepOutArea( const EDA_RECT& aRect, int side );
int testModuleOnBoard( MODULE* aFootprint, bool TstOtherSide, const wxPoint& aOffset );
int testFootprintOnBoard( MODULE* aFootprint, bool TstOtherSide, const wxPoint& aOffset );
int getOptimalFPPlacement( MODULE* aFootprint );
double computePlacementRatsnestCost( MODULE* aFootprint, const wxPoint& aOffset );
/**
* Find the "best" module place. The criteria are:
* Find the "best" footprint place. The criteria are:
* - Maximum ratsnest with footprints already placed
* - Max size, and number of pads max
*/

View File

@ -165,13 +165,13 @@ void moveFootprintsInArea( CRectPlacement& aPlacementArea, std::vector <MODULE*>
pos.x *= scale;
pos.y *= scale;
MODULE * module = aFootprintList[vecSubRects[it].n];
MODULE* footprint = aFootprintList[vecSubRects[it].n];
EDA_RECT fpBBox = module->GetFootprintRect();
wxPoint mod_pos = pos + ( module->GetPosition() - fpBBox.GetOrigin() )
EDA_RECT fpBBox = footprint->GetFootprintRect();
wxPoint mod_pos = pos + ( footprint->GetPosition() - fpBBox.GetOrigin() )
+ aFreeArea.GetOrigin();
module->Move( mod_pos - module->GetPosition() );
footprint->Move( mod_pos - footprint->GetPosition() );
}
}

View File

@ -227,7 +227,7 @@ void MODULE::TransformFPShapesWithClearanceToPolygon( SHAPE_POLY_SET& aCornerBuf
PCB_LAYER_ID aLayer, int aClearance,
int aError, ERROR_LOC aErrorLoc,
bool aIncludeText,
bool aIncludeEdges ) const
bool aIncludeShapes ) const
{
std::vector<FP_TEXT*> texts; // List of FP_TEXT to convert
@ -241,7 +241,7 @@ void MODULE::TransformFPShapesWithClearanceToPolygon( SHAPE_POLY_SET& aCornerBuf
texts.push_back( text );
}
if( item->Type() == PCB_FP_SHAPE_T && aIncludeEdges )
if( item->Type() == PCB_FP_SHAPE_T && aIncludeShapes )
{
FP_SHAPE* outline = static_cast<FP_SHAPE*>( item );

View File

@ -37,7 +37,8 @@
#include <macros.h>
#include <math/util.h> // for KiROUND
/* This module contains out of line member functions for classes given in
/*
* This module contains out of line member functions for classes given in
* collectors.h. Those classes augment the functionality of class PCB_EDIT_FRAME.
*/
@ -188,7 +189,7 @@ const KICAD_T GENERAL_COLLECTOR::Dimensions[] = {
SEARCH_RESULT GENERAL_COLLECTOR::Inspect( EDA_ITEM* testItem, void* testData )
{
BOARD_ITEM* item = (BOARD_ITEM*) testItem;
MODULE* module = nullptr;
MODULE* footprint = nullptr;
PCB_GROUP* group = nullptr;
PAD* pad = nullptr;
bool pad_through = false;
@ -205,12 +206,10 @@ SEARCH_RESULT GENERAL_COLLECTOR::Inspect( EDA_ITEM* testItem, void* testData )
{
case PCB_PAD_T:
{
MODULE* m = (MODULE*) item->GetParent();
MODULE* footprint = (MODULE*) item->GetParent();
if( m->GetReference() == wxT( "Y2" ) )
{
if( footprint->GetReference() == wxT( "Y2" ) )
breakhere++;
}
}
break;
@ -237,23 +236,19 @@ SEARCH_RESULT GENERAL_COLLECTOR::Inspect( EDA_ITEM* testItem, void* testData )
case PCB_FP_TEXT_T:
{
FP_TEXT* tm = (FP_TEXT*) item;
FP_TEXT* fpText = (FP_TEXT*) item;
if( tm->GetText() == wxT( "10uH" ) )
{
if( fpText->GetText() == wxT( "10uH" ) )
breakhere++;
}
}
break;
case PCB_MODULE_T:
{
MODULE* m = (MODULE*) item;
MODULE* footprint = (MODULE*) item;
if( m->GetReference() == wxT( "C98" ) )
{
if( footprint->GetReference() == wxT( "C98" ) )
breakhere++;
}
}
break;
@ -274,22 +269,22 @@ SEARCH_RESULT GENERAL_COLLECTOR::Inspect( EDA_ITEM* testItem, void* testData )
case PCB_PAD_T:
// there are pad specific visibility controls.
// Criterias to select a pad is:
// for smd pads: the module parent must be seen, and pads on the corresponding
// board side must be seen
// if pad is a thru hole, then it can be visible when its parent module is not.
// for through pads: pads on Front or Back board sides must be seen
// for smd pads: the footprint parent must be visible, and pads on the corresponding
// board side must be visible
// if pad is a thru hole, then it can be visible when its parent footprint is not.
// for through pads: pads on Front or Back board sides must be visible
pad = static_cast<PAD*>( item );
if( (pad->GetAttribute() != PAD_ATTRIB_SMD) &&
(pad->GetAttribute() != PAD_ATTRIB_CONN) ) // a hole is present, so multiple layers
(pad->GetAttribute() != PAD_ATTRIB_CONN) ) // a hole is present, so multiple layers
{
// proceed to the common tests below, but without the parent module test,
// by leaving module==NULL, but having pad != null
// proceed to the common tests below, but without the parent footprint test,
// by leaving footprint==NULL, but having pad != null
pad_through = true;
}
else // smd, so use pads test after module test
else // smd, so use pads test after footprint test
{
module = static_cast<MODULE*>( item->GetParent() );
footprint = static_cast<MODULE*>( item->GetParent() );
}
break;
@ -305,7 +300,7 @@ SEARCH_RESULT GENERAL_COLLECTOR::Inspect( EDA_ITEM* testItem, void* testData )
break;
case PCB_FP_ZONE_T:
module = static_cast<MODULE*>( item->GetParent() );
footprint = static_cast<MODULE*>( item->GetParent() );
// Fallthrough to get the zone as well
KI_FALLTHROUGH;
@ -368,8 +363,8 @@ SEARCH_RESULT GENERAL_COLLECTOR::Inspect( EDA_ITEM* testItem, void* testData )
break;
}
// Extract the module since it could be hidden
module = static_cast<MODULE*>( item->GetParent() );
// Extract the footprint since it could be hidden
footprint = static_cast<MODULE*>( item->GetParent() );
}
break;
@ -378,7 +373,7 @@ SEARCH_RESULT GENERAL_COLLECTOR::Inspect( EDA_ITEM* testItem, void* testData )
break;
case PCB_MODULE_T:
module = static_cast<MODULE*>( item );
footprint = static_cast<MODULE*>( item );
break;
case PCB_GROUP_T:
@ -395,12 +390,12 @@ SEARCH_RESULT GENERAL_COLLECTOR::Inspect( EDA_ITEM* testItem, void* testData )
// common tests:
if( module ) // true from case PCB_PAD_T, PCB_FP_TEXT_T, or PCB_MODULE_T
if( footprint ) // true from case PCB_PAD_T, PCB_FP_TEXT_T, or PCB_MODULE_T
{
if( m_Guide->IgnoreFootprintsOnBack() && ( module->GetLayer() == B_Cu) )
if( m_Guide->IgnoreFootprintsOnBack() && ( footprint->GetLayer() == B_Cu) )
goto exit;
if( m_Guide->IgnoreFootprintsOnFront() && ( module->GetLayer() == F_Cu) )
if( m_Guide->IgnoreFootprintsOnFront() && ( footprint->GetLayer() == F_Cu) )
goto exit;
}
@ -459,10 +454,10 @@ SEARCH_RESULT GENERAL_COLLECTOR::Inspect( EDA_ITEM* testItem, void* testData )
// footprints and their subcomponents: reference, value and pads are not sensitive
// to the layer visibility controls. They all have their own separate visibility
// controls for vias, GetLayer() has no meaning, but IsOnLayer() works fine. User
// text in module *is* sensitive to layer visibility but that was already handled.
// text in a footprint *is* sensitive to layer visibility but that was already handled.
if( via || module || pad || m_Guide->IsLayerVisible( layer )
|| !m_Guide->IgnoreNonVisibleLayers() )
if( via || footprint || pad || m_Guide->IsLayerVisible( layer )
|| !m_Guide->IgnoreNonVisibleLayers() )
{
if( !m_Guide->IsLayerLocked( layer ) || !m_Guide->IgnoreLockedLayers() )
{
@ -484,8 +479,8 @@ SEARCH_RESULT GENERAL_COLLECTOR::Inspect( EDA_ITEM* testItem, void* testData )
}
else if( item->Type() == PCB_MODULE_T )
{
if( module->HitTest( m_refPos, accuracy )
&& module->HitTestAccurate( m_refPos, accuracy ) )
if( footprint->HitTest( m_refPos, accuracy )
&& footprint->HitTestAccurate( m_refPos, accuracy ) )
{
Append( item );
goto exit;
@ -533,10 +528,10 @@ SEARCH_RESULT GENERAL_COLLECTOR::Inspect( EDA_ITEM* testItem, void* testData )
// footprints and their subcomponents: reference, value and pads are not sensitive
// to the layer visibility controls. They all have their own separate visibility
// controls for vias, GetLayer() has no meaning, but IsOnLayer() works fine. User
// text in module *is* sensitive to layer visibility but that was already handled.
// text in a footprint *is* sensitive to layer visibility but that was already handled.
if( via || module || pad || zone || m_Guide->IsLayerVisible( layer )
|| !m_Guide->IgnoreNonVisibleLayers() )
if( via || footprint || pad || zone || m_Guide->IsLayerVisible( layer )
|| !m_Guide->IgnoreNonVisibleLayers() )
{
if( !m_Guide->IsLayerLocked( layer ) || !m_Guide->IgnoreLockedLayers() )
{
@ -558,8 +553,8 @@ SEARCH_RESULT GENERAL_COLLECTOR::Inspect( EDA_ITEM* testItem, void* testData )
}
else if( item->Type() == PCB_MODULE_T )
{
if( module->HitTest( m_refPos, accuracy )
&& module->HitTestAccurate( m_refPos, accuracy ) )
if( footprint->HitTest( m_refPos, accuracy )
&& footprint->HitTestAccurate( m_refPos, accuracy ) )
{
Append( item );
goto exit;

View File

@ -26,7 +26,8 @@
#define COLLECTORS_H
/* This module contains a number of COLLECTOR implementations which are used
/*
* This module contains a number of COLLECTOR implementations which are used
* to augment the functionality of class PCB_EDIT_FRAME.
*/

View File

@ -802,8 +802,7 @@ bool BuildBoardPolygonOutlines( BOARD* aBoard, SHAPE_POLY_SET& aOutlines, unsign
PCB_TYPE_COLLECTOR items;
bool success = false;
// Get all the DRAWSEGMENTS and module graphics into 'items',
// then keep only those on layer == Edge_Cuts.
// Get all the PCB and FP shapes into 'items', then keep only those on layer == Edge_Cuts.
static const KICAD_T scan_graphics[] = { PCB_SHAPE_T, PCB_FP_SHAPE_T, EOT };
items.Collect( aBoard, scan_graphics );
@ -1147,7 +1146,7 @@ bool BuildFootprintPolygonOutlines( BOARD* aBoard, SHAPE_POLY_SET& aOutlines,
if( chain.SegmentCount() == 0 )
{
// Something is wrong, bail out with the overall module bounding box
// Something is wrong, bail out with the overall footprint bounding box
wxLogTrace( traceBoardOutline, "No line segments in provided outline" );
aOutlines = bbox;
return true;

View File

@ -68,8 +68,8 @@ void PCB_EDIT_FRAME::ExecuteRemoteCommand( const char* cmdline )
char* text;
int netcode = -1;
bool multiHighlight = false;
MODULE* module = NULL;
PAD* pad = NULL;
MODULE* footprint = nullptr;
PAD* pad = nullptr;
BOARD* pcb = GetBoard();
CROSS_PROBING_SETTINGS& crossProbingSettings = GetPcbNewSettings()->m_CrossProbing;
@ -151,15 +151,15 @@ void PCB_EDIT_FRAME::ExecuteRemoteCommand( const char* cmdline )
modName = FROM_UTF8( text );
module = pcb->FindModuleByReference( modName );
footprint = pcb->FindModuleByReference( modName );
if( module )
pad = module->FindPadByName( pinName );
if( footprint )
pad = footprint->FindPadByName( pinName );
if( pad )
netcode = pad->GetNetCode();
if( module == NULL )
if( footprint == NULL )
msg.Printf( _( "%s not found" ), modName );
else if( pad == NULL )
msg.Printf( _( "%s pin %s not found" ), modName, pinName );
@ -174,9 +174,9 @@ void PCB_EDIT_FRAME::ExecuteRemoteCommand( const char* cmdline )
modName = FROM_UTF8( text );
module = pcb->FindModuleByReference( modName );
footprint = pcb->FindModuleByReference( modName );
if( module )
if( footprint )
msg.Printf( _( "%s found" ), modName );
else
msg.Printf( _( "%s not found" ), modName );
@ -212,14 +212,14 @@ void PCB_EDIT_FRAME::ExecuteRemoteCommand( const char* cmdline )
BOX2I bbox = { { 0, 0 }, { 0, 0 } };
if( module )
if( footprint )
{
bbox = module->GetBoundingBox( false ); // No invisible text in bbox calc
bbox = footprint->GetBoundingBox( false ); // No invisible text in bbox calc
if( pad )
m_toolManager->RunAction( PCB_ACTIONS::highlightItem, true, (void*) pad );
else
m_toolManager->RunAction( PCB_ACTIONS::highlightItem, true, (void*) module );
m_toolManager->RunAction( PCB_ACTIONS::highlightItem, true, (void*) footprint );
}
else if( netcode > 0 || multiHighlight )
{
@ -256,10 +256,10 @@ void PCB_EDIT_FRAME::ExecuteRemoteCommand( const char* cmdline )
for( TRACK* track : pcb->Tracks() )
merge_area( track );
for( MODULE* footprint : pcb->Footprints() )
for( MODULE* fp : pcb->Footprints() )
{
for( PAD* pad : footprint->Pads() )
merge_area( pad );
for( PAD* p : fp->Pads() )
merge_area( p );
}
}
}
@ -402,7 +402,7 @@ void PCB_EDIT_FRAME::ExecuteRemoteCommand( const char* cmdline )
std::string FormatProbeItem( BOARD_ITEM* aItem )
{
MODULE* module;
MODULE* footprint;
if( !aItem )
return "$CLEAR: \"HIGHLIGHTED\""; // message to clear highlight state
@ -410,22 +410,22 @@ std::string FormatProbeItem( BOARD_ITEM* aItem )
switch( aItem->Type() )
{
case PCB_MODULE_T:
module = (MODULE*) aItem;
return StrPrintf( "$PART: \"%s\"", TO_UTF8( module->GetReference() ) );
footprint = (MODULE*) aItem;
return StrPrintf( "$PART: \"%s\"", TO_UTF8( footprint->GetReference() ) );
case PCB_PAD_T:
{
module = (MODULE*) aItem->GetParent();
footprint = (MODULE*) aItem->GetParent();
wxString pad = static_cast<PAD*>( aItem )->GetName();
return StrPrintf( "$PART: \"%s\" $PAD: \"%s\"",
TO_UTF8( module->GetReference() ),
TO_UTF8( footprint->GetReference() ),
TO_UTF8( pad ) );
}
case PCB_FP_TEXT_T:
{
module = static_cast<MODULE*>( aItem->GetParent() );
footprint = static_cast<MODULE*>( aItem->GetParent() );
FP_TEXT* text = static_cast<FP_TEXT*>( aItem );
const char* text_key;
@ -440,7 +440,7 @@ std::string FormatProbeItem( BOARD_ITEM* aItem )
break;
return StrPrintf( "$PART: \"%s\" %s \"%s\"",
TO_UTF8( module->GetReference() ),
TO_UTF8( footprint->GetReference() ),
text_key,
TO_UTF8( text->GetText() ) );
}
@ -454,7 +454,7 @@ std::string FormatProbeItem( BOARD_ITEM* aItem )
/* Send a remote command to Eeschema via a socket,
* aSyncItem = item to be located on schematic (module, pin or text)
* aSyncItem = item to be located on schematic (footprint, pin or text)
* Commands are
* $PART: "reference" put cursor on component anchor
* $PART: "reference" $PAD: "pad number" put cursor on the component pin
@ -510,12 +510,12 @@ void PCB_EDIT_FRAME::KiwayMailIn( KIWAY_EXPRESS& mail )
NETLIST netlist;
STRING_FORMATTER sf;
for( MODULE* module : this->GetBoard()->Footprints() )
for( MODULE* footprint : this->GetBoard()->Footprints() )
{
COMPONENT* component = new COMPONENT( module->GetFPID(), module->GetReference(),
module->GetValue(), module->GetPath() );
COMPONENT* component = new COMPONENT( footprint->GetFPID(), footprint->GetReference(),
footprint->GetValue(), footprint->GetPath() );
for( PAD* pad : module->Pads() )
for( PAD* pad : footprint->Pads() )
{
const wxString& netname = pad->GetShortNetname();

View File

@ -97,17 +97,16 @@ wxString ActionMessage[] = {
DIALOG_BOARD_REANNOTATE::DIALOG_BOARD_REANNOTATE( PCB_EDIT_FRAME* aParentFrame )
: DIALOG_BOARD_REANNOTATE_BASE( aParentFrame ),
m_modules( aParentFrame->GetBoard()->Footprints() )
m_footprints( aParentFrame->GetBoard()->Footprints() )
{
m_Config = Kiface().KifaceSettings();
InitValues();
m_frame = aParentFrame;
m_screen = m_frame->GetScreen();
m_Units = m_frame->GetUserUnits();
m_Standalone = !m_frame->TestStandalone(); //Do this here forces the menu on top
m_standalone = !m_frame->TestStandalone(); //Do this here forces the menu on top
if( m_Standalone )
if( m_standalone )
{ //Only update the schematic if not in standalone mode
m_UpdateSchematic->Enable( false );
m_UpdateSchematic->SetValue( false );
@ -120,37 +119,37 @@ DIALOG_BOARD_REANNOTATE::DIALOG_BOARD_REANNOTATE( PCB_EDIT_FRAME* aParentFrame )
m_sdbSizerCancel->SetLabel( _( "Close" ) );
m_sdbSizer->Layout();
m_Settings = aParentFrame->config();
m_settings = aParentFrame->config();
wxArrayString gridslist;
GRID_MENU::BuildChoiceList( &gridslist, m_Settings, aParentFrame );
GRID_MENU::BuildChoiceList( &gridslist, m_settings, aParentFrame );
if( -1 == m_GridIndex ) //If no default loaded
m_GridIndex = m_Settings->m_Window.grid.last_size_idx; //Get the current grid size
if( -1 == m_gridIndex ) //If no default loaded
m_gridIndex = m_settings->m_Window.grid.last_size_idx; //Get the current grid size
m_SortGridx = m_frame->GetCanvas()->GetGAL()->GetGridSize().x;
m_SortGridy = m_frame->GetCanvas()->GetGAL()->GetGridSize().y;
m_sortGridx = m_frame->GetCanvas()->GetGAL()->GetGridSize().x;
m_sortGridy = m_frame->GetCanvas()->GetGAL()->GetGridSize().y;
m_GridChoice->Set( gridslist ); //Show the choice in the dialog
m_GridChoice->SetSelection( m_GridIndex );
m_GridChoice->SetSelection( m_gridIndex );
for( wxRadioButton* button : m_sortButtons )
button->SetValue( false );
m_sortButtons[m_SortCode]->SetValue( true );
m_sortButtons[m_sortCode]->SetValue( true );
m_selection = m_frame->GetToolManager()->GetTool<SELECTION_TOOL>()->GetSelection();
if( !m_selection.Empty() )
m_AnnotationChoice = AnnotationChoice::AnnotateSelected;
m_annotationChoice = AnnotationChoice::AnnotateSelected;
for( wxRadioButton* button : AnnotateWhat )
button->SetValue( false );
m_AnnotationChoice = ( m_SortCode >= (int) AnnotateWhat.size() ) ?
AnnotationChoice::AnnotateAll :
m_AnnotationChoice;
m_annotationChoice = ( m_sortCode >= (int) AnnotateWhat.size() ) ?
AnnotationChoice::AnnotateAll :
m_annotationChoice;
AnnotateWhat[m_AnnotationChoice]->SetValue( true );
AnnotateWhat[m_annotationChoice]->SetValue( true );
reannotate_down_right_bitmap->SetBitmap( KiBitmap( reannotate_right_down_xpm ) );
reannotate_right_down_bitmap->SetBitmap( KiBitmap( reannotate_left_down_xpm ) );
@ -184,16 +183,16 @@ DIALOG_BOARD_REANNOTATE::~DIALOG_BOARD_REANNOTATE()
{
GetParameters(); //Get the current menu settings
PCBNEW_SETTINGS* cfg = m_frame->GetPcbNewSettings();
cfg->m_Reannotate.sort_on_module_location = m_locationChoice->GetSelection() == 0;
cfg->m_Reannotate.sort_on_fp_location = m_locationChoice->GetSelection() == 0;
cfg->m_Reannotate.remove_front_prefix = m_RemoveFrontPrefix->GetValue();
cfg->m_Reannotate.remove_back_prefix = m_RemoveBackPrefix->GetValue();
cfg->m_Reannotate.update_schematic = m_UpdateSchematic->GetValue();
cfg->m_Reannotate.exclude_locked = m_ExcludeLocked->GetValue();
cfg->m_Reannotate.grid_index = m_GridIndex;
cfg->m_Reannotate.sort_code = m_SortCode;
cfg->m_Reannotate.annotation_choice = m_AnnotationChoice;
cfg->m_Reannotate.report_severity = m_Severity;
cfg->m_Reannotate.grid_index = m_gridIndex;
cfg->m_Reannotate.sort_code = m_sortCode;
cfg->m_Reannotate.annotation_choice = m_annotationChoice;
cfg->m_Reannotate.report_severity = m_severity;
cfg->m_Reannotate.front_refdes_start = m_FrontRefDesStart->GetValue();
cfg->m_Reannotate.back_refdes_start = m_BackRefDesStart->GetValue();
@ -208,16 +207,16 @@ DIALOG_BOARD_REANNOTATE::~DIALOG_BOARD_REANNOTATE()
void DIALOG_BOARD_REANNOTATE::InitValues( void )
{
PCBNEW_SETTINGS* cfg = m_frame->GetPcbNewSettings();
m_locationChoice->SetSelection( cfg->m_Reannotate.sort_on_module_location ? 0 : 1 );
m_locationChoice->SetSelection( cfg->m_Reannotate.sort_on_fp_location ? 0 : 1 );
m_RemoveFrontPrefix->SetValue( cfg->m_Reannotate.remove_front_prefix );
m_RemoveBackPrefix->SetValue( cfg->m_Reannotate.remove_back_prefix );
m_UpdateSchematic->SetValue( cfg->m_Reannotate.update_schematic );
m_ExcludeLocked->SetValue( cfg->m_Reannotate.exclude_locked );
m_GridIndex = cfg->m_Reannotate.grid_index ;
m_SortCode = cfg->m_Reannotate.sort_code ;
m_AnnotationChoice = cfg->m_Reannotate.annotation_choice ;
m_Severity = cfg->m_Reannotate.report_severity;
m_gridIndex = cfg->m_Reannotate.grid_index ;
m_sortCode = cfg->m_Reannotate.sort_code ;
m_annotationChoice = cfg->m_Reannotate.annotation_choice ;
m_severity = cfg->m_Reannotate.report_severity;
m_FrontRefDesStart->SetValue( cfg->m_Reannotate.front_refdes_start );
m_BackRefDesStart->SetValue( cfg->m_Reannotate.back_refdes_start );
@ -303,7 +302,7 @@ void DIALOG_BOARD_REANNOTATE::MakeSampleText( wxString& aMessage )
wxString tmp;
aMessage.Printf( _( "\n%s footprints will be reannotated." ),
_( AnnotateString[m_AnnotationChoice] ) );
_( AnnotateString[m_annotationChoice] ) );
if( !m_ExcludeList->GetValue().empty() )
{
@ -362,14 +361,14 @@ void DIALOG_BOARD_REANNOTATE::MakeSampleText( wxString& aMessage )
}
}
bool moduleLocation = m_locationChoice->GetSelection() == 0;
bool fpLocation = m_locationChoice->GetSelection() == 0;
aMessage += wxString::Format( _( "\nPrior to sorting by %s, the coordinates of which will be "
"rounded to a %s, %s grid." ),
moduleLocation ? _( "footprint location" )
: _( "reference designator location" ),
MessageTextFromValue( m_Units, m_SortGridx ),
MessageTextFromValue( m_Units, m_SortGridy ) );
fpLocation ? _( "footprint location" )
: _( "reference designator location" ),
MessageTextFromValue( m_units, m_sortGridx ),
MessageTextFromValue( m_units, m_sortGridy ) );
if( m_UpdateSchematic->GetValue() )
aMessage += _( "\nThe schematic will be updated." );
@ -382,37 +381,37 @@ void DIALOG_BOARD_REANNOTATE::MakeSampleText( wxString& aMessage )
void DIALOG_BOARD_REANNOTATE::GetParameters()
{
m_SortCode = 0; //Convert radio button to sort direction code
m_sortCode = 0; //Convert radio button to sort direction code
for( wxRadioButton* sortbuttons : m_sortButtons )
{
if( sortbuttons->GetValue() )
break;
m_SortCode++;
m_sortCode++;
}
if( m_SortCode >= (int) m_sortButtons.size() )
m_SortCode = 0;
if( m_sortCode >= (int) m_sortButtons.size() )
m_sortCode = 0;
m_FrontPrefixString = m_FrontPrefix->GetValue();
m_BackPrefixString = m_BackPrefix->GetValue();
m_frontPrefixString = m_FrontPrefix->GetValue();
m_backPrefixString = m_BackPrefix->GetValue();
//Get the chosen sort grid for rounding
m_GridIndex = m_GridChoice->GetSelection();
m_gridIndex = m_GridChoice->GetSelection();
if( m_GridIndex >= ( int ) m_Settings->m_Window.grid.sizes.size() )
if( m_gridIndex >= ( int ) m_settings->m_Window.grid.sizes.size() )
{
m_SortGridx = DoubleValueFromString( EDA_UNITS::MILS,
m_Settings->m_Window.grid.user_grid_x );
m_SortGridy = DoubleValueFromString( EDA_UNITS::MILS,
m_Settings->m_Window.grid.user_grid_y );
m_sortGridx = DoubleValueFromString( EDA_UNITS::MILS,
m_settings->m_Window.grid.user_grid_x );
m_sortGridy = DoubleValueFromString( EDA_UNITS::MILS,
m_settings->m_Window.grid.user_grid_y );
}
else
{
m_SortGridx = DoubleValueFromString( EDA_UNITS::MILS,
m_Settings->m_Window.grid.sizes[ m_GridIndex ] );
m_SortGridy = m_SortGridx;
m_sortGridx = DoubleValueFromString( EDA_UNITS::MILS,
m_settings->m_Window.grid.sizes[ m_gridIndex ] );
m_sortGridy = m_sortGridx;
}
int i = 0;
@ -425,7 +424,7 @@ void DIALOG_BOARD_REANNOTATE::GetParameters()
i++;
}
m_AnnotationChoice = ( i >= (int) AnnotateWhat.size() ) ? AnnotationChoice::AnnotateAll : i;
m_annotationChoice = ( i >= (int) AnnotateWhat.size() ) ? AnnotationChoice::AnnotateAll : i;
m_MessageWindow->SetLazyUpdate( true );
}
@ -496,8 +495,9 @@ static bool ModuleCompare( const RefDesInfo& aA, const RefDesInfo& aB )
/// @return the string
wxString DIALOG_BOARD_REANNOTATE::CoordTowxString( int aX, int aY )
{
return wxString::Format( "%s, %s", MessageTextFromValue( m_Units, aX ),
MessageTextFromValue( m_Units, aY ) );
return wxString::Format( "%s, %s",
MessageTextFromValue( m_units, aX ),
MessageTextFromValue( m_units, aY ) );
}
@ -526,16 +526,16 @@ void DIALOG_BOARD_REANNOTATE::LogChangePlan()
message.Printf( _( "\n\nThere are %i types of reference designations\n"
"**********************************************************\n" ),
(int) m_RefDesTypes.size() );
(int) m_refDesTypes.size() );
for( RefDesTypeStr Type : m_RefDesTypes ) //Show all the types of refdes
for( RefDesTypeStr Type : m_refDesTypes ) //Show all the types of refdes
message += Type.RefDesType + ( 0 == ( i++ % 16 ) ? "\n" : " " );
if( !m_ExcludeArray.empty() )
if( !m_excludeArray.empty() )
{
wxString excludes;
for( wxString& exclude : m_ExcludeArray ) //Show the refdes we are excluding
for( wxString& exclude : m_excludeArray ) //Show the refdes we are excluding
excludes += exclude + " ";
message += wxString::Format( _( "\nExcluding: %s from reannotation\n\n" ), excludes );
@ -543,7 +543,7 @@ void DIALOG_BOARD_REANNOTATE::LogChangePlan()
message += _( "\n Change Array\n***********************\n" );
for( RefDesChange Change : m_ChangeArray )
for( RefDesChange Change : m_changeArray )
{
message += wxString::Format( "%s -> %s %s %s\n", Change.OldRefDesString, Change.NewRefDes,
ActionMessage[Change.Action],
@ -572,7 +572,7 @@ void DIALOG_BOARD_REANNOTATE::LogFootprints( wxString& aMessage,
fpLocations ? _( "Footprint Coordinates" )
: _( "Reference Designator Coordinates" ) );
message += wxString::Format( _( "\nSort Code %d" ), m_SortCode );
message += wxString::Format( _( "\nSort Code %d" ), m_sortCode );
for( const RefDesInfo& mod : aFootprints )
{
@ -636,16 +636,16 @@ bool DIALOG_BOARD_REANNOTATE::ReannotateBoard()
if( m_UpdateSchematic->GetValue() )
{ //If updating schematic send a netlist
for( MODULE* mod : m_modules )
for( MODULE* footprint : m_footprints )
{ // Create a netlist
newref = GetNewRefDes( mod );
newref = GetNewRefDes( footprint );
if( nullptr == newref )
return false; //Not found in changelist
//add to the netlist
netlist.AddComponent( new COMPONENT( mod->GetFPID(), newref->NewRefDes,
mod->GetValue(), mod->GetPath() ) );
netlist.AddComponent( new COMPONENT( footprint->GetFPID(), newref->NewRefDes,
footprint->GetValue(), footprint->GetPath() ) );
}
netlist.Format( "pcb_netlist", &stringformatter, 0,
@ -672,7 +672,7 @@ bool DIALOG_BOARD_REANNOTATE::ReannotateBoard()
if( reannotateok )
{ //Only update if no errors
for( MODULE* mod : m_modules )
for( MODULE* mod : m_footprints )
{ // Create a netlist
newref = GetNewRefDes( mod );
@ -702,19 +702,20 @@ bool DIALOG_BOARD_REANNOTATE::BuildModuleList( std::vector<RefDesInfo>& aBadRefD
int errorcount = 0;
unsigned int backstartrefdes;
size_t firstnum = 0;
size_t firstnum = 0;
m_FrontModules.clear();
m_BackModules.clear();
m_ExcludeArray.clear();
m_modules = m_frame->GetBoard()->Footprints();
m_frontFootprints.clear();
m_backFootprints.clear();
m_excludeArray.clear();
m_footprints = m_frame->GetBoard()->Footprints();
std::vector<KIID> selected;
if( m_AnnotateSelection->GetValue() )
{
for( EDA_ITEM* item : m_selection )
{ //Get the timestamps of selected footprints
{
//Get the timestamps of selected footprints
if( item->Type() == PCB_MODULE_T )
selected.push_back( item->m_Uuid );
}
@ -729,20 +730,20 @@ bool DIALOG_BOARD_REANNOTATE::BuildModuleList( std::vector<RefDesInfo>& aBadRefD
if( ( ' ' == thischar ) || ( ',' == thischar ) )
{
m_ExcludeArray.push_back( exclude );
m_excludeArray.push_back( exclude );
exclude.clear();
}
else
exclude += thischar;
if( !exclude.empty() )
m_ExcludeArray.push_back( exclude );
m_excludeArray.push_back( exclude );
}
RefDesInfo thismodule;
bool useModuleLocation = m_locationChoice->GetSelection() == 0;
for( MODULE* mod : m_modules )
for( MODULE* mod : m_footprints )
{
thismodule.Uuid = mod->m_Uuid;
thismodule.RefDesString = mod->GetReference();
@ -751,8 +752,8 @@ bool DIALOG_BOARD_REANNOTATE::BuildModuleList( std::vector<RefDesInfo>& aBadRefD
: mod->Reference().GetPosition().x;
thismodule.y = useModuleLocation ? mod->GetPosition().y
: mod->Reference().GetPosition().y;
thismodule.roundedx = RoundToGrid( thismodule.x, m_SortGridx ); //Round to sort
thismodule.roundedy = RoundToGrid( thismodule.y, m_SortGridy );
thismodule.roundedx = RoundToGrid( thismodule.x, m_sortGridx ); //Round to sort
thismodule.roundedy = RoundToGrid( thismodule.y, m_sortGridy );
thismodule.Front = mod->GetLayer() == F_Cu;
thismodule.Action = UpdateRefDes; //Usually good
@ -769,7 +770,7 @@ bool DIALOG_BOARD_REANNOTATE::BuildModuleList( std::vector<RefDesInfo>& aBadRefD
//Get the type (R, C, etc)
thismodule.RefDesType = thismodule.RefDesString.substr( 0, firstnum );
for( wxString excluded : m_ExcludeArray )
for( wxString excluded : m_excludeArray )
{
if( excluded == thismodule.RefDesType ) //Am I supposed to exclude this type?
{
@ -781,7 +782,9 @@ bool DIALOG_BOARD_REANNOTATE::BuildModuleList( std::vector<RefDesInfo>& aBadRefD
if( ( thismodule.Front && annotateback ) || //If a front module and doing backs only
( !thismodule.Front && annotatefront ) || //If a back module and doing front only
( mod->IsLocked() && skiplocked ) ) //If excluding locked and it is locked
{
thismodule.Action = Exclude;
}
if( annotateselected )
{ //If onnly annotating selected c
@ -798,46 +801,50 @@ bool DIALOG_BOARD_REANNOTATE::BuildModuleList( std::vector<RefDesInfo>& aBadRefD
}
if( thismodule.Front )
m_FrontModules.push_back( thismodule );
m_frontFootprints.push_back( thismodule );
else
m_BackModules.push_back( thismodule );
m_backFootprints.push_back( thismodule );
}
SetSortCodes( FrontDirectionsArray, m_SortCode ); //Determine the sort order for the front
sort( m_FrontModules.begin(), m_FrontModules.end(),ModuleCompare ); //Sort the front footprints
SetSortCodes( FrontDirectionsArray, m_sortCode ); //Determine the sort order for the front
sort( m_frontFootprints.begin(), m_frontFootprints.end(), ModuleCompare ); //Sort the front footprints
SetSortCodes( BackDirectionsArray, m_SortCode ); //Determine the sort order for the back
sort( m_BackModules.begin(), m_BackModules.end(), ModuleCompare ); //Sort the back footprints
SetSortCodes( BackDirectionsArray, m_sortCode ); //Determine the sort order for the back
sort( m_backFootprints.begin(), m_backFootprints.end(), ModuleCompare ); //Sort the back footprints
m_RefDesTypes.clear();
m_ChangeArray.clear();
m_refDesTypes.clear();
m_changeArray.clear();
backstartrefdes = wxAtoi( m_BackRefDesStart->GetValue() );
if( !m_FrontModules.empty() )
BuildChangeArray( m_FrontModules, wxAtoi( m_FrontRefDesStart->GetValue() ),
if( !m_frontFootprints.empty() )
{
BuildChangeArray( m_frontFootprints, wxAtoi( m_FrontRefDesStart->GetValue() ),
m_FrontPrefix->GetValue(), m_RemoveFrontPrefix->GetValue(), aBadRefDes );
}
if( !m_BackModules.empty() )
BuildChangeArray( m_BackModules, backstartrefdes, m_BackPrefix->GetValue(),
if( !m_backFootprints.empty() )
{
BuildChangeArray( m_backFootprints, backstartrefdes, m_BackPrefix->GetValue(),
m_RemoveBackPrefix->GetValue(), aBadRefDes );
}
if( !m_ChangeArray.empty() )
sort( m_ChangeArray.begin(), m_ChangeArray.end(), ChangeArrayCompare );
if( !m_changeArray.empty() )
sort( m_changeArray.begin(), m_changeArray.end(), ChangeArrayCompare );
LogChangePlan();
size_t changearraysize = m_ChangeArray.size();
size_t changearraysize = m_changeArray.size();
for( size_t i = 0; i < changearraysize; i++ ) //Scan through for duplicates if update or skip
{
if( ( m_ChangeArray[i].Action != EmptyRefDes )
&& ( m_ChangeArray[i].Action != InvalidRefDes ) )
if( ( m_changeArray[i].Action != EmptyRefDes )
&& ( m_changeArray[i].Action != InvalidRefDes ) )
{
for( size_t j = i + 1; j < changearraysize; j++ )
{
if( m_ChangeArray[i].NewRefDes == m_ChangeArray[j].NewRefDes )
if( m_changeArray[i].NewRefDes == m_changeArray[j].NewRefDes )
{
ShowReport( "Duplicate instances of " + m_ChangeArray[j].NewRefDes,
ShowReport( "Duplicate instances of " + m_changeArray[j].NewRefDes,
RPT_SEVERITY_ERROR );
if( errorcount++ > MAXERROR )
@ -883,8 +890,8 @@ void DIALOG_BOARD_REANNOTATE::BuildChangeArray( std::vector<RefDesInfo>& aFootpr
if( 0 != aStartRefDes ) //Initialize the change array if present
{
for( i = 0; i < m_RefDesTypes.size(); i++ )
m_RefDesTypes[i].RefDesCount = aStartRefDes;
for( i = 0; i < m_refDesTypes.size(); i++ )
m_refDesTypes[i].RefDesCount = aStartRefDes;
}
for( RefDesInfo footprint : aFootprints )
@ -900,7 +907,7 @@ void DIALOG_BOARD_REANNOTATE::BuildChangeArray( std::vector<RefDesInfo>& aFootpr
if( ( change.Action == EmptyRefDes ) || ( change.Action == InvalidRefDes ) )
{
m_ChangeArray.push_back( change );
m_changeArray.push_back( change );
aBadRefDes.push_back( footprint );
continue;
}
@ -916,36 +923,40 @@ void DIALOG_BOARD_REANNOTATE::BuildChangeArray( std::vector<RefDesInfo>& aFootpr
if( aRemovePrefix && prefixpresent ) //If there is a prefix remove it
footprint.RefDesType.erase( 0, prefixsize );
for( i = 0; i < m_RefDesTypes.size(); i++ ) //See if it is in the types array
if( m_RefDesTypes[i].RefDesType == footprint.RefDesType ) //Found it!
for( i = 0; i < m_refDesTypes.size(); i++ ) //See if it is in the types array
{
if( m_refDesTypes[i].RefDesType == footprint.RefDesType ) //Found it!
break;
}
if( i == m_RefDesTypes.size() )
if( i == m_refDesTypes.size() )
{ //Wasn't in the types array so add it
newtype.RefDesType = footprint.RefDesType;
newtype.RefDesCount = ( aStartRefDes == 0 ? 1 : aStartRefDes );
m_RefDesTypes.push_back( newtype );
m_refDesTypes.push_back( newtype );
}
change.NewRefDes = m_RefDesTypes[i].RefDesType
+ std::to_string( m_RefDesTypes[i].RefDesCount++ );
change.NewRefDes = m_refDesTypes[i].RefDesType
+ std::to_string( m_refDesTypes[i].RefDesCount++ );
}
m_ChangeArray.push_back( change ); //Add to the change array
m_changeArray.push_back( change ); //Add to the change array
}
}
//
/// @returns the new refdes for this module
RefDesChange* DIALOG_BOARD_REANNOTATE::GetNewRefDes( MODULE* aMod )
/// @returns the new refdes for this footprint
RefDesChange* DIALOG_BOARD_REANNOTATE::GetNewRefDes( MODULE* aFootprint )
{
size_t i;
for( i = 0; i < m_ChangeArray.size(); i++ )
if( aMod->m_Uuid == m_ChangeArray[i].Uuid )
return ( &m_ChangeArray[i] );
for( i = 0; i < m_changeArray.size(); i++ )
{
if( aFootprint->m_Uuid == m_changeArray[i].Uuid )
return ( &m_changeArray[i] );
}
ShowReport( _( "Footprint not found in changelist" ) + wxS( " " ) + aMod->GetReference(),
ShowReport( _( "Footprint not found in changelist" ) + wxS( " " ) + aFootprint->GetReference(),
RPT_SEVERITY_ERROR );
return nullptr; //Should never happen

View File

@ -105,44 +105,60 @@ public:
private:
PCB_EDIT_FRAME* m_frame;
MODULES m_modules;
MODULES m_footprints;
PCB_SCREEN* m_screen;
PCBNEW_SELECTION m_selection;
std::vector<RefDesChange> m_ChangeArray;
std::vector<RefDesInfo> m_FrontModules;
std::vector<RefDesInfo> m_BackModules;
std::vector<RefDesTypeStr> m_RefDesTypes;
std::vector<wxString> m_ExcludeArray;
std::vector<RefDesChange> m_changeArray;
std::vector<RefDesInfo> m_frontFootprints;
std::vector<RefDesInfo> m_backFootprints;
std::vector<RefDesTypeStr> m_refDesTypes;
std::vector<wxString> m_excludeArray;
EDA_UNITS m_Units;
bool m_standalone;
bool m_Standalone;
int m_sortCode;
int m_gridIndex;
int m_annotationChoice;
int m_severity;
int m_SortCode;
int m_GridIndex;
int m_AnnotationChoice;
int m_Severity;
double m_sortGridx;
double m_sortGridy;
double m_SortGridx;
double m_SortGridy;
wxString m_frontPrefixString;
wxString m_backPrefixString;
wxString m_validPrefixes;
wxString m_FrontPrefixString;
wxString m_BackPrefixString;
wxString m_ValidPrefixes;
APP_SETTINGS_BASE* m_settings;
APP_SETTINGS_BASE* m_Settings;
std::vector<wxRadioButton*> m_sortButtons = {
m_Down_Right,
m_Right_Down,
m_Down_Left,
m_Left_Down,
m_Up_Right,
m_Right_Up,
m_Up_Left,
m_Left_Up
};
std::vector<wxRadioButton*> m_sortButtons = { m_Down_Right, m_Right_Down, m_Down_Left,
m_Left_Down, m_Up_Right, m_Right_Up, m_Up_Left, m_Left_Up };
std::vector<wxRadioButton*> AnnotateWhat = {
m_AnnotateAll,
m_AnnotateFront,
m_AnnotateBack,
m_AnnotateSelection
};
std::vector<wxRadioButton*> AnnotateWhat = { m_AnnotateAll, m_AnnotateFront, m_AnnotateBack,
m_AnnotateSelection };
std::vector<wxStaticBitmap*> Bitmaps = { reannotate_down_right_bitmap, reannotate_right_down_bitmap,
reannotate_down_left_bitmap, reannotate_left_down_bitmap, reannotate_up_right_bitmap,
reannotate_right_up_bitmap, reannotate_up_left_bitmap, reannotate_left_up_bitmap };
std::vector<wxStaticBitmap*> Bitmaps = {
reannotate_down_right_bitmap,
reannotate_right_down_bitmap,
reannotate_down_left_bitmap,
reannotate_left_down_bitmap,
reannotate_up_right_bitmap,
reannotate_right_up_bitmap,
reannotate_up_left_bitmap,
reannotate_left_up_bitmap
};
APP_SETTINGS_BASE* m_Config;
@ -162,9 +178,10 @@ private:
bool ReannotateBoard( void );
bool BuildModuleList( std::vector<RefDesInfo>& aBadRefDes );
void BuildChangeArray( std::vector<RefDesInfo>& aFootprints, unsigned int aStartRefDes,
wxString aPrefix, bool aRemovePrefix, std::vector<RefDesInfo>& aBadRefDes );
wxString aPrefix, bool aRemovePrefix,
std::vector<RefDesInfo>& aBadRefDes );
RefDesChange* GetNewRefDes( MODULE* aMod );
RefDesChange* GetNewRefDes( MODULE* aFootprint );
int RoundToGrid( int aCoord, int aGrid );
wxString CoordTowxString( int aX, int aY );

View File

@ -1103,7 +1103,7 @@ bool PCB_EDIT_FRAME::importFile( const wxString& aFileName, int aFileType )
}
// Update module LIB_IDs to point to the just imported Eagle library
// Update footprint LIB_IDs to point to the just imported Eagle library
for( MODULE* footprint : GetBoard()->Footprints() )
{
LIB_ID libId = footprint->GetFPID();

View File

@ -43,25 +43,25 @@ MODULE::MODULE( BOARD* parent ) :
BOARD_ITEM_CONTAINER( (BOARD_ITEM*) parent, PCB_MODULE_T ),
m_initial_comments( 0 )
{
m_Attributs = 0;
m_attributes = 0;
m_Layer = F_Cu;
m_Orient = 0;
m_ModuleStatus = MODULE_PADS_LOCKED;
m_arflag = 0;
m_CntRot90 = m_CntRot180 = 0;
m_Link = 0;
m_LastEditTime = 0;
m_LocalClearance = 0;
m_LocalSolderMaskMargin = 0;
m_LocalSolderPasteMargin = 0;
m_LocalSolderPasteMarginRatio = 0.0;
m_ZoneConnection = ZONE_CONNECTION::INHERITED; // Use zone setting by default
m_ThermalWidth = 0; // Use zone setting by default
m_ThermalGap = 0; // Use zone setting by default
m_orient = 0;
m_moduleStatus = FP_PADS_are_LOCKED;
m_arflag = 0;
m_rot90Cost = m_rot180Cost = 0;
m_link = 0;
m_lastEditTime = 0;
m_localClearance = 0;
m_localSolderMaskMargin = 0;
m_localSolderPasteMargin = 0;
m_localSolderPasteMarginRatio = 0.0;
m_zoneConnection = ZONE_CONNECTION::INHERITED; // Use zone setting by default
m_thermalWidth = 0; // Use zone setting by default
m_thermalGap = 0; // Use zone setting by default
// These are special and mandatory text fields
m_Reference = new FP_TEXT( this, FP_TEXT::TEXT_is_REFERENCE );
m_Value = new FP_TEXT( this, FP_TEXT::TEXT_is_VALUE );
m_reference = new FP_TEXT( this, FP_TEXT::TEXT_is_REFERENCE );
m_value = new FP_TEXT( this, FP_TEXT::TEXT_is_VALUE );
m_3D_Drawings.clear();
}
@ -70,31 +70,31 @@ MODULE::MODULE( BOARD* parent ) :
MODULE::MODULE( const MODULE& aFootprint ) :
BOARD_ITEM_CONTAINER( aFootprint )
{
m_Pos = aFootprint.m_Pos;
m_fpid = aFootprint.m_fpid;
m_Attributs = aFootprint.m_Attributs;
m_ModuleStatus = aFootprint.m_ModuleStatus;
m_Orient = aFootprint.m_Orient;
m_BoundaryBox = aFootprint.m_BoundaryBox;
m_CntRot90 = aFootprint.m_CntRot90;
m_CntRot180 = aFootprint.m_CntRot180;
m_LastEditTime = aFootprint.m_LastEditTime;
m_Link = aFootprint.m_Link;
m_Path = aFootprint.m_Path;
m_pos = aFootprint.m_pos;
m_fpid = aFootprint.m_fpid;
m_attributes = aFootprint.m_attributes;
m_moduleStatus = aFootprint.m_moduleStatus;
m_orient = aFootprint.m_orient;
m_boundingBox = aFootprint.m_boundingBox;
m_rot90Cost = aFootprint.m_rot90Cost;
m_rot180Cost = aFootprint.m_rot180Cost;
m_lastEditTime = aFootprint.m_lastEditTime;
m_link = aFootprint.m_link;
m_path = aFootprint.m_path;
m_LocalClearance = aFootprint.m_LocalClearance;
m_LocalSolderMaskMargin = aFootprint.m_LocalSolderMaskMargin;
m_LocalSolderPasteMargin = aFootprint.m_LocalSolderPasteMargin;
m_LocalSolderPasteMarginRatio = aFootprint.m_LocalSolderPasteMarginRatio;
m_ZoneConnection = aFootprint.m_ZoneConnection;
m_ThermalWidth = aFootprint.m_ThermalWidth;
m_ThermalGap = aFootprint.m_ThermalGap;
m_localClearance = aFootprint.m_localClearance;
m_localSolderMaskMargin = aFootprint.m_localSolderMaskMargin;
m_localSolderPasteMargin = aFootprint.m_localSolderPasteMargin;
m_localSolderPasteMarginRatio = aFootprint.m_localSolderPasteMarginRatio;
m_zoneConnection = aFootprint.m_zoneConnection;
m_thermalWidth = aFootprint.m_thermalWidth;
m_thermalGap = aFootprint.m_thermalGap;
// Copy reference and value.
m_Reference = new FP_TEXT( *aFootprint.m_Reference );
m_Reference->SetParent( this );
m_Value = new FP_TEXT( *aFootprint.m_Value );
m_Value->SetParent( this );
m_reference = new FP_TEXT( *aFootprint.m_reference );
m_reference->SetParent( this );
m_value = new FP_TEXT( *aFootprint.m_value );
m_value->SetParent( this );
std::map<BOARD_ITEM*, BOARD_ITEM*> ptrMap;
@ -150,8 +150,8 @@ MODULE::MODULE( const MODULE& aFootprint ) :
// Copy auxiliary data: 3D_Drawings info
m_3D_Drawings = aFootprint.m_3D_Drawings;
m_Doc = aFootprint.m_Doc;
m_KeyWord = aFootprint.m_KeyWord;
m_doc = aFootprint.m_doc;
m_keywords = aFootprint.m_keywords;
m_properties = aFootprint.m_properties;
m_arflag = 0;
@ -174,8 +174,8 @@ MODULE::MODULE( MODULE&& aFootprint ) :
MODULE::~MODULE()
{
// Clean up the owned elements
delete m_Reference;
delete m_Value;
delete m_reference;
delete m_value;
delete m_initial_comments;
for( PAD* p : m_pads )
@ -204,31 +204,31 @@ MODULE& MODULE::operator=( MODULE&& aOther )
{
BOARD_ITEM::operator=( aOther );
m_Pos = aOther.m_Pos;
m_pos = aOther.m_pos;
m_fpid = aOther.m_fpid;
m_Attributs = aOther.m_Attributs;
m_ModuleStatus = aOther.m_ModuleStatus;
m_Orient = aOther.m_Orient;
m_BoundaryBox = aOther.m_BoundaryBox;
m_CntRot90 = aOther.m_CntRot90;
m_CntRot180 = aOther.m_CntRot180;
m_LastEditTime = aOther.m_LastEditTime;
m_Link = aOther.m_Link;
m_Path = aOther.m_Path;
m_attributes = aOther.m_attributes;
m_moduleStatus = aOther.m_moduleStatus;
m_orient = aOther.m_orient;
m_boundingBox = aOther.m_boundingBox;
m_rot90Cost = aOther.m_rot90Cost;
m_rot180Cost = aOther.m_rot180Cost;
m_lastEditTime = aOther.m_lastEditTime;
m_link = aOther.m_link;
m_path = aOther.m_path;
m_LocalClearance = aOther.m_LocalClearance;
m_LocalSolderMaskMargin = aOther.m_LocalSolderMaskMargin;
m_LocalSolderPasteMargin = aOther.m_LocalSolderPasteMargin;
m_LocalSolderPasteMarginRatio = aOther.m_LocalSolderPasteMarginRatio;
m_ZoneConnection = aOther.m_ZoneConnection;
m_ThermalWidth = aOther.m_ThermalWidth;
m_ThermalGap = aOther.m_ThermalGap;
m_localClearance = aOther.m_localClearance;
m_localSolderMaskMargin = aOther.m_localSolderMaskMargin;
m_localSolderPasteMargin = aOther.m_localSolderPasteMargin;
m_localSolderPasteMarginRatio = aOther.m_localSolderPasteMarginRatio;
m_zoneConnection = aOther.m_zoneConnection;
m_thermalWidth = aOther.m_thermalWidth;
m_thermalGap = aOther.m_thermalGap;
// Move reference and value
m_Reference = aOther.m_Reference;
m_Reference->SetParent( this );
m_Value = aOther.m_Value;
m_Value->SetParent( this );
m_reference = aOther.m_reference;
m_reference->SetParent( this );
m_value = aOther.m_value;
m_value->SetParent( this );
// Move the pads
@ -274,8 +274,8 @@ MODULE& MODULE::operator=( MODULE&& aOther )
// Copy auxiliary data: 3D_Drawings info
m_3D_Drawings.clear();
m_3D_Drawings = aOther.m_3D_Drawings;
m_Doc = aOther.m_Doc;
m_KeyWord = aOther.m_KeyWord;
m_doc = aOther.m_doc;
m_keywords = aOther.m_keywords;
m_properties = aOther.m_properties;
// Ensure auxiliary data is up to date
@ -287,8 +287,8 @@ MODULE& MODULE::operator=( MODULE&& aOther )
aOther.Pads().clear();
aOther.Zones().clear();
aOther.GraphicalItems().clear();
aOther.m_Value = nullptr;
aOther.m_Reference = nullptr;
aOther.m_value = nullptr;
aOther.m_reference = nullptr;
aOther.m_initial_comments = nullptr;
return *this;
@ -299,31 +299,31 @@ MODULE& MODULE::operator=( const MODULE& aOther )
{
BOARD_ITEM::operator=( aOther );
m_Pos = aOther.m_Pos;
m_pos = aOther.m_pos;
m_fpid = aOther.m_fpid;
m_Attributs = aOther.m_Attributs;
m_ModuleStatus = aOther.m_ModuleStatus;
m_Orient = aOther.m_Orient;
m_BoundaryBox = aOther.m_BoundaryBox;
m_CntRot90 = aOther.m_CntRot90;
m_CntRot180 = aOther.m_CntRot180;
m_LastEditTime = aOther.m_LastEditTime;
m_Link = aOther.m_Link;
m_Path = aOther.m_Path;
m_attributes = aOther.m_attributes;
m_moduleStatus = aOther.m_moduleStatus;
m_orient = aOther.m_orient;
m_boundingBox = aOther.m_boundingBox;
m_rot90Cost = aOther.m_rot90Cost;
m_rot180Cost = aOther.m_rot180Cost;
m_lastEditTime = aOther.m_lastEditTime;
m_link = aOther.m_link;
m_path = aOther.m_path;
m_LocalClearance = aOther.m_LocalClearance;
m_LocalSolderMaskMargin = aOther.m_LocalSolderMaskMargin;
m_LocalSolderPasteMargin = aOther.m_LocalSolderPasteMargin;
m_LocalSolderPasteMarginRatio = aOther.m_LocalSolderPasteMarginRatio;
m_ZoneConnection = aOther.m_ZoneConnection;
m_ThermalWidth = aOther.m_ThermalWidth;
m_ThermalGap = aOther.m_ThermalGap;
m_localClearance = aOther.m_localClearance;
m_localSolderMaskMargin = aOther.m_localSolderMaskMargin;
m_localSolderPasteMargin = aOther.m_localSolderPasteMargin;
m_localSolderPasteMarginRatio = aOther.m_localSolderPasteMarginRatio;
m_zoneConnection = aOther.m_zoneConnection;
m_thermalWidth = aOther.m_thermalWidth;
m_thermalGap = aOther.m_thermalGap;
// Copy reference and value
*m_Reference = *aOther.m_Reference;
m_Reference->SetParent( this );
*m_Value = *aOther.m_Value;
m_Value->SetParent( this );
*m_reference = *aOther.m_reference;
m_reference->SetParent( this );
*m_value = *aOther.m_value;
m_value->SetParent( this );
std::map<BOARD_ITEM*, BOARD_ITEM*> ptrMap;
@ -380,8 +380,8 @@ MODULE& MODULE::operator=( const MODULE& aOther )
// Copy auxiliary data: 3D_Drawings info
m_3D_Drawings.clear();
m_3D_Drawings = aOther.m_3D_Drawings;
m_Doc = aOther.m_Doc;
m_KeyWord = aOther.m_KeyWord;
m_doc = aOther.m_doc;
m_keywords = aOther.m_keywords;
m_properties = aOther.m_properties;
// Ensure auxiliary data is up to date
@ -406,12 +406,12 @@ bool MODULE::ResolveTextVar( wxString* token, int aDepth ) const
{
if( token->IsSameAs( wxT( "REFERENCE" ) ) )
{
*token = m_Reference->GetShownText( aDepth + 1 );
*token = m_reference->GetShownText( aDepth + 1 );
return true;
}
else if( token->IsSameAs( wxT( "VALUE" ) ) )
{
*token = m_Value->GetShownText( aDepth + 1 );
*token = m_value->GetShownText( aDepth + 1 );
return true;
}
else if( token->IsSameAs( wxT( "LAYER" ) ) )
@ -563,14 +563,14 @@ void MODULE::Remove( BOARD_ITEM* aBoardItem )
void MODULE::CalculateBoundingBox()
{
m_BoundaryBox = GetFootprintRect();
m_boundingBox = GetFootprintRect();
}
double MODULE::GetArea( int aPadding ) const
{
double w = std::abs( static_cast<double>( m_BoundaryBox.GetWidth() ) ) + aPadding;
double h = std::abs( static_cast<double>( m_BoundaryBox.GetHeight() ) ) + aPadding;
double w = std::abs( static_cast<double>( m_boundingBox.GetWidth() ) ) + aPadding;
double h = std::abs( static_cast<double>( m_boundingBox.GetHeight() ) ) + aPadding;
return w * h;
}
@ -579,8 +579,8 @@ EDA_RECT MODULE::GetFootprintRect() const
{
EDA_RECT area;
area.SetOrigin( m_Pos );
area.SetEnd( m_Pos );
area.SetOrigin( m_pos );
area.SetEnd( m_pos );
area.Inflate( Millimeter2iu( 0.25 ) ); // Give a min size to the area
for( BOARD_ITEM* item : m_drawings )
@ -653,21 +653,21 @@ const EDA_RECT MODULE::GetBoundingBox( bool aIncludeInvisibleText ) const
// not being present in the current PCB stackup. Values, references, and all
// footprint text can also be turned off via the GAL meta-layers, so the 2nd and
// 3rd "&&" conditionals handle that.
valueLayerIsVisible = board->IsLayerVisible( m_Value->GetLayer() )
valueLayerIsVisible = board->IsLayerVisible( m_value->GetLayer() )
&& board->IsElementVisible( LAYER_MOD_VALUES )
&& board->IsElementVisible( LAYER_MOD_TEXT_FR );
refLayerIsVisible = board->IsLayerVisible( m_Reference->GetLayer() )
refLayerIsVisible = board->IsLayerVisible( m_reference->GetLayer() )
&& board->IsElementVisible( LAYER_MOD_REFERENCES )
&& board->IsElementVisible( LAYER_MOD_TEXT_FR );
}
if( ( m_Value->IsVisible() && valueLayerIsVisible ) || aIncludeInvisibleText )
area.Merge( m_Value->GetBoundingBox() );
if(( m_value->IsVisible() && valueLayerIsVisible ) || aIncludeInvisibleText )
area.Merge( m_value->GetBoundingBox() );
if( ( m_Reference->IsVisible() && refLayerIsVisible ) || aIncludeInvisibleText )
area.Merge( m_Reference->GetBoundingBox() );
if(( m_reference->IsVisible() && refLayerIsVisible ) || aIncludeInvisibleText )
area.Merge( m_reference->GetBoundingBox() );
return area;
}
@ -716,7 +716,7 @@ SHAPE_POLY_SET MODULE::GetBoundingPoly() const
}
poly.Inflate( Millimeter2iu( 0.01 ), 4 );
poly.Rotate( -orientation, m_Pos );
poly.Rotate( -orientation, m_pos );
return poly;
}
@ -726,16 +726,16 @@ void MODULE::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM
{
wxString msg, msg2;
aList.emplace_back( m_Reference->GetShownText(), m_Value->GetShownText(), DARKCYAN );
aList.emplace_back( m_reference->GetShownText(), m_value->GetShownText(), DARKCYAN );
if( aFrame->IsType( FRAME_FOOTPRINT_VIEWER )
|| aFrame->IsType( FRAME_FOOTPRINT_VIEWER_MODAL )
|| aFrame->IsType( FRAME_FOOTPRINT_EDITOR ) )
{
wxDateTime date( static_cast<time_t>( m_LastEditTime ) );
wxDateTime date( static_cast<time_t>( m_lastEditTime ) );
// Date format: see http://www.cplusplus.com/reference/ctime/strftime
if( m_LastEditTime && date.IsValid() )
if( m_lastEditTime && date.IsValid() )
msg = date.Format( wxT( "%b %d, %Y" ) ); // Abbreviated_month_name Day, Year
else
msg = _( "Unknown" );
@ -762,16 +762,16 @@ void MODULE::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM
if( IsLocked() )
addToken( &status, _( "locked" ) );
if( m_ModuleStatus & MODULE_is_PLACED )
if( m_moduleStatus & FP_is_PLACED )
addToken( &status, _( "autoplaced" ) );
if( m_Attributs & FP_BOARD_ONLY )
if( m_attributes & FP_BOARD_ONLY )
addToken( &attrs, _( "not in schematic" ) );
if( m_Attributs & FP_EXCLUDE_FROM_POS_FILES )
if( m_attributes & FP_EXCLUDE_FROM_POS_FILES )
addToken( &attrs, _( "exclude from pos files" ) );
if( m_Attributs & FP_EXCLUDE_FROM_BOM )
if( m_attributes & FP_EXCLUDE_FROM_BOM )
addToken( &attrs, _( "exclude from BOM" ) );
aList.emplace_back( _( "Status: " ) + status, _( "Attributes:" ) + wxS( " " ) + attrs, BROWN );
@ -784,15 +784,15 @@ void MODULE::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM
m_3D_Drawings.empty() ? _( "none" ) : m_3D_Drawings.front().m_Filename );
aList.emplace_back( msg, msg2, BLUE );
msg.Printf( _( "Doc: %s" ), m_Doc );
msg2.Printf( _( "Keywords: %s" ), m_KeyWord );
msg.Printf( _( "Doc: %s" ), m_doc );
msg2.Printf( _( "Keywords: %s" ), m_keywords );
aList.emplace_back( msg, msg2, BLACK );
}
bool MODULE::HitTest( const wxPoint& aPosition, int aAccuracy ) const
{
EDA_RECT rect = m_BoundaryBox;//.GetBoundingBoxRotated( GetPosition(), m_Orient );
EDA_RECT rect = m_boundingBox;//.GetBoundingBoxRotated( GetPosition(), m_Orient );
return rect.Inflate( aAccuracy ).Contains( aPosition );
}
@ -809,7 +809,7 @@ bool MODULE::HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy ) co
arect.Inflate( aAccuracy );
if( aContained )
return arect.Contains( m_BoundaryBox );
return arect.Contains( m_boundingBox );
else
{
// If the rect does not intersect the bounding box, skip any tests
@ -954,7 +954,7 @@ void MODULE::Add3DModel( FP_3DMODEL* a3DModel )
}
// see class_module.h
// see footprint.h
SEARCH_RESULT MODULE::Visit( INSPECTOR inspector, void* testData, const KICAD_T scanTypes[] )
{
KICAD_T stype;
@ -988,12 +988,12 @@ SEARCH_RESULT MODULE::Visit( INSPECTOR inspector, void* testData, const KICAD_T
break;
case PCB_FP_TEXT_T:
result = inspector( m_Reference, testData );
result = inspector( m_reference, testData );
if( result == SEARCH_RESULT::QUIT )
break;
result = inspector( m_Value, testData );
result = inspector( m_value, testData );
if( result == SEARCH_RESULT::QUIT )
break;
@ -1079,8 +1079,8 @@ void MODULE::RunOnChildren( const std::function<void (BOARD_ITEM*)>& aFunction )
for( BOARD_ITEM* drawing : m_drawings )
aFunction( static_cast<BOARD_ITEM*>( drawing ) );
aFunction( static_cast<BOARD_ITEM*>( m_Reference ) );
aFunction( static_cast<BOARD_ITEM*>( m_Value ) );
aFunction( static_cast<BOARD_ITEM*>( m_reference ) );
aFunction( static_cast<BOARD_ITEM*>( m_value ) );
}
catch( std::bad_function_call& )
{
@ -1184,8 +1184,8 @@ const BOX2I MODULE::ViewBBox() const
EDA_RECT area = GetFootprintRect();
// Calculate extended area including text fields
area.Merge( m_Reference->GetBoundingBox() );
area.Merge( m_Value->GetBoundingBox() );
area.Merge( m_reference->GetBoundingBox() );
area.Merge( m_value->GetBoundingBox() );
// Add the Clearance shape size: (shape around the pads when the clearance is shown. Not
// optimized, but the draw cost is small (perhaps smaller than optimization).
@ -1228,7 +1228,7 @@ const wxChar* MODULE::StringLibNameInvalidChars( bool aUserReadable )
void MODULE::Move( const wxPoint& aMoveVector )
{
wxPoint newpos = m_Pos + aMoveVector;
wxPoint newpos = m_pos + aMoveVector;
SetPosition( newpos );
}
@ -1237,13 +1237,13 @@ void MODULE::Rotate( const wxPoint& aRotCentre, double aAngle )
{
double orientation = GetOrientation();
double newOrientation = orientation + aAngle;
wxPoint newpos = m_Pos;
wxPoint newpos = m_pos;
RotatePoint( &newpos, aRotCentre, aAngle );
SetPosition( newpos );
SetOrientation( newOrientation );
m_Reference->KeepUpright( orientation, newOrientation );
m_Value->KeepUpright( orientation, newOrientation );
m_reference->KeepUpright( orientation, newOrientation );
m_value->KeepUpright( orientation, newOrientation );
for( BOARD_ITEM* item : m_drawings )
{
@ -1258,14 +1258,13 @@ void MODULE::Rotate( const wxPoint& aRotCentre, double aAngle )
void MODULE::Flip( const wxPoint& aCentre, bool aFlipLeftRight )
{
// Move footprint to its final position:
wxPoint finalPos = m_Pos;
wxPoint finalPos = m_pos;
// Now Flip the footprint.
// Flipping a footprint is a specific transform:
// it is not mirrored like a text.
// We have to change the side, and ensure the footprint rotation is
// modified accordint to the transform, because this parameter is used
// in pick and place files, and when updating the footprint from library.
// Flipping a footprint is a specific transform: it is not mirrored like a text.
// We have to change the side, and ensure the footprint rotation is modified according to the
// transform, because this parameter is used in pick and place files, and when updating the
// footprint from library.
// When flipped around the X axis (Y coordinates changed) orientation is negated
// When flipped around the Y axis (X coordinates changed) orientation is 180 - old orient.
// Because it is specfic to a footprint, we flip around the X axis, and after rotate 180 deg
@ -1278,21 +1277,21 @@ void MODULE::Flip( const wxPoint& aCentre, bool aFlipLeftRight )
SetLayer( FlipLayer( GetLayer() ) );
// Reverse mirror orientation.
m_Orient = -m_Orient;
m_orient = -m_orient;
NORMALIZE_ANGLE_180( m_Orient );
NORMALIZE_ANGLE_180( m_orient );
// Mirror pads to other side of board.
for( PAD* pad : m_pads )
pad->Flip( m_Pos, false );
pad->Flip( m_pos, false );
// Mirror zones to other side of board.
for( ZONE* zone : m_fp_zones )
zone->Flip( m_Pos, aFlipLeftRight );
zone->Flip( m_pos, aFlipLeftRight );
// Mirror reference and value.
m_Reference->Flip( m_Pos, false );
m_Value->Flip( m_Pos, false );
m_reference->Flip( m_pos, false );
m_value->Flip( m_pos, false );
// Reverse mirror module graphics and texts.
for( BOARD_ITEM* item : m_drawings )
@ -1300,11 +1299,11 @@ void MODULE::Flip( const wxPoint& aCentre, bool aFlipLeftRight )
switch( item->Type() )
{
case PCB_FP_SHAPE_T:
static_cast<FP_SHAPE*>( item )->Flip( m_Pos, false );
static_cast<FP_SHAPE*>( item )->Flip( m_pos, false );
break;
case PCB_FP_TEXT_T:
static_cast<FP_TEXT*>( item )->Flip( m_Pos, false );
static_cast<FP_TEXT*>( item )->Flip( m_pos, false );
break;
default:
@ -1323,12 +1322,12 @@ void MODULE::Flip( const wxPoint& aCentre, bool aFlipLeftRight )
void MODULE::SetPosition( const wxPoint& aPos )
{
wxPoint delta = aPos - m_Pos;
wxPoint delta = aPos - m_pos;
m_Pos += delta;
m_pos += delta;
m_Reference->EDA_TEXT::Offset( delta );
m_Value->EDA_TEXT::Offset( delta );
m_reference->EDA_TEXT::Offset( delta );
m_value->EDA_TEXT::Offset( delta );
for( PAD* pad : m_pads )
pad->SetPosition( pad->GetPosition() + delta );
@ -1360,7 +1359,7 @@ void MODULE::SetPosition( const wxPoint& aPos )
}
}
m_BoundaryBox.Move( delta );
m_boundingBox.Move( delta );
}
@ -1380,10 +1379,10 @@ void MODULE::MoveAnchorPosition( const wxPoint& aMoveVector )
RotatePoint( &moveVector, -GetOrientation() );
// Update of the reference and value.
m_Reference->SetPos0( m_Reference->GetPos0() + moveVector );
m_Reference->SetDrawCoord();
m_Value->SetPos0( m_Value->GetPos0() + moveVector );
m_Value->SetDrawCoord();
m_reference->SetPos0( m_reference->GetPos0() + moveVector );
m_reference->SetDrawCoord();
m_value->SetPos0( m_value->GetPos0() + moveVector );
m_value->SetDrawCoord();
// Update the pad local coordinates.
for( PAD* pad : m_pads )
@ -1423,11 +1422,11 @@ void MODULE::MoveAnchorPosition( const wxPoint& aMoveVector )
void MODULE::SetOrientation( double aNewAngle )
{
double angleChange = aNewAngle - m_Orient; // change in rotation
double angleChange = aNewAngle - m_orient; // change in rotation
NORMALIZE_ANGLE_180( aNewAngle );
m_Orient = aNewAngle;
m_orient = aNewAngle;
for( PAD* pad : m_pads )
{
@ -1441,8 +1440,8 @@ void MODULE::SetOrientation( double aNewAngle )
}
// Update of the reference and value.
m_Reference->SetDrawCoord();
m_Value->SetDrawCoord();
m_reference->SetDrawCoord();
m_value->SetDrawCoord();
// Displace contours and text of the footprint.
for( BOARD_ITEM* item : m_drawings )
@ -1473,7 +1472,7 @@ BOARD_ITEM* MODULE::Duplicate() const
}
BOARD_ITEM* MODULE::DuplicateItem( const BOARD_ITEM* aItem, bool aAddToModule )
BOARD_ITEM* MODULE::DuplicateItem( const BOARD_ITEM* aItem, bool aAddToFootprint )
{
BOARD_ITEM* new_item = NULL;
FP_ZONE* new_zone = NULL;
@ -1485,7 +1484,7 @@ BOARD_ITEM* MODULE::DuplicateItem( const BOARD_ITEM* aItem, bool aAddToModule )
PAD* new_pad = new PAD( *static_cast<const PAD*>( aItem ) );
const_cast<KIID&>( new_pad->m_Uuid ) = KIID();
if( aAddToModule )
if( aAddToFootprint )
m_pads.push_back( new_pad );
new_item = new_pad;
@ -1497,7 +1496,7 @@ BOARD_ITEM* MODULE::DuplicateItem( const BOARD_ITEM* aItem, bool aAddToModule )
new_zone = new FP_ZONE( *static_cast<const FP_ZONE*>( aItem ) );
const_cast<KIID&>( new_zone->m_Uuid ) = KIID();
if( aAddToModule )
if( aAddToFootprint )
m_fp_zones.push_back( new_zone );
new_item = new_zone;
@ -1520,7 +1519,7 @@ BOARD_ITEM* MODULE::DuplicateItem( const BOARD_ITEM* aItem, bool aAddToModule )
new_text->SetType( FP_TEXT::TEXT_is_DIVERS );
}
if( aAddToModule )
if( aAddToFootprint )
Add( new_text );
new_item = new_text;
@ -1533,7 +1532,7 @@ BOARD_ITEM* MODULE::DuplicateItem( const BOARD_ITEM* aItem, bool aAddToModule )
FP_SHAPE* new_shape = new FP_SHAPE( *static_cast<const FP_SHAPE*>( aItem ) );
const_cast<KIID&>( new_shape->m_Uuid ) = KIID();
if( aAddToModule )
if( aAddToFootprint )
Add( new_shape );
new_item = new_shape;
@ -1627,8 +1626,8 @@ double MODULE::CoverageRatio( const GENERAL_COLLECTOR& aCollector ) const
for( PAD* pad : m_pads )
addRect( holes, pad->GetBoundingBox() );
addRect( holes, m_Reference->GetBoundingBox() );
addRect( holes, m_Value->GetBoundingBox() );
addRect( holes, m_reference->GetBoundingBox() );
addRect( holes, m_value->GetBoundingBox() );
for( int i = 0; i < aCollector.GetCount(); ++i )
{

View File

@ -95,7 +95,7 @@ public:
VECTOR3D m_Offset; ///< 3D model offset (mm)
double m_Opacity;
wxString m_Filename; ///< The 3D shape filename in 3D library
bool m_Show; ///< Include module in rendering
bool m_Show; ///< Include model in rendering
};
DECL_DEQ_FOR_SWIG( PADS, PAD* )
@ -111,7 +111,7 @@ public:
MODULE( const MODULE& aFootprint );
// Move constructor and operator needed due to std containers inside the module
// Move constructor and operator needed due to std containers inside the footprint
MODULE( MODULE&& aFootprint );
~MODULE();
@ -147,7 +147,7 @@ public:
/**
* Function GetFootprintRect()
* Build and returns the boundary box of the module footprint excluding any text.
* Build and returns the boundary box of the footprint excluding any text.
* @return EDA_RECT - The rectangle containing the footprint.
*/
EDA_RECT GetFootprintRect() const;
@ -157,7 +157,7 @@ public:
* (call CalculateBoundingBox() to recalculate it)
* @return EDA_RECT - The rectangle containing the footprint
*/
EDA_RECT GetBoundingBoxBase() const { return m_BoundaryBox; }
EDA_RECT GetBoundingBoxBase() const { return m_boundingBox; }
/**
* Returns the bounding box containing pads when the footprint
@ -169,7 +169,7 @@ public:
EDA_RECT GetFpPadsLocalBbox() const;
/**
* Returns a bounding polygon for the shapes and pads in the module
* Returns a bounding polygon for the shapes and pads in the footprint
* This operation is slower but more accurate than calculating a bounding box
*/
SHAPE_POLY_SET GetBoundingPoly() const;
@ -196,57 +196,57 @@ public:
const std::list<FP_3DMODEL>& Models() const { return m_3D_Drawings; }
void SetPosition( const wxPoint& aPos ) override;
wxPoint GetPosition() const override { return m_Pos; }
wxPoint GetPosition() const override { return m_pos; }
void SetOrientation( double aNewAngle );
void SetOrientationDegrees( double aOrientation ) { SetOrientation( aOrientation * 10.0 ); }
double GetOrientation() const { return m_Orient; }
double GetOrientationDegrees() const { return m_Orient / 10.0; }
double GetOrientationRadians() const { return m_Orient * M_PI / 1800; }
double GetOrientation() const { return m_orient; }
double GetOrientationDegrees() const { return m_orient / 10.0; }
double GetOrientationRadians() const { return m_orient * M_PI / 1800; }
const LIB_ID& GetFPID() const { return m_fpid; }
void SetFPID( const LIB_ID& aFPID ) { m_fpid = aFPID; }
const wxString& GetDescription() const { return m_Doc; }
void SetDescription( const wxString& aDoc ) { m_Doc = aDoc; }
const wxString& GetDescription() const { return m_doc; }
void SetDescription( const wxString& aDoc ) { m_doc = aDoc; }
const wxString& GetKeywords() const { return m_KeyWord; }
void SetKeywords( const wxString& aKeywords ) { m_KeyWord = aKeywords; }
const wxString& GetKeywords() const { return m_keywords; }
void SetKeywords( const wxString& aKeywords ) { m_keywords = aKeywords; }
const KIID_PATH& GetPath() const { return m_Path; }
void SetPath( const KIID_PATH& aPath ) { m_Path = aPath; }
const KIID_PATH& GetPath() const { return m_path; }
void SetPath( const KIID_PATH& aPath ) { m_path = aPath; }
int GetLocalSolderMaskMargin() const { return m_LocalSolderMaskMargin; }
void SetLocalSolderMaskMargin( int aMargin ) { m_LocalSolderMaskMargin = aMargin; }
int GetLocalSolderMaskMargin() const { return m_localSolderMaskMargin; }
void SetLocalSolderMaskMargin( int aMargin ) { m_localSolderMaskMargin = aMargin; }
int GetLocalClearance() const { return m_LocalClearance; }
void SetLocalClearance( int aClearance ) { m_LocalClearance = aClearance; }
int GetLocalClearance() const { return m_localClearance; }
void SetLocalClearance( int aClearance ) { m_localClearance = aClearance; }
int GetLocalClearance( wxString* aSource ) const
{
if( aSource )
*aSource = wxString::Format( _( "footprint %s" ), GetReference() );
return m_LocalClearance;
return m_localClearance;
}
int GetLocalSolderPasteMargin() const { return m_LocalSolderPasteMargin; }
void SetLocalSolderPasteMargin( int aMargin ) { m_LocalSolderPasteMargin = aMargin; }
int GetLocalSolderPasteMargin() const { return m_localSolderPasteMargin; }
void SetLocalSolderPasteMargin( int aMargin ) { m_localSolderPasteMargin = aMargin; }
double GetLocalSolderPasteMarginRatio() const { return m_LocalSolderPasteMarginRatio; }
void SetLocalSolderPasteMarginRatio( double aRatio ) { m_LocalSolderPasteMarginRatio = aRatio; }
double GetLocalSolderPasteMarginRatio() const { return m_localSolderPasteMarginRatio; }
void SetLocalSolderPasteMarginRatio( double aRatio ) { m_localSolderPasteMarginRatio = aRatio; }
void SetZoneConnection( ZONE_CONNECTION aType ) { m_ZoneConnection = aType; }
ZONE_CONNECTION GetZoneConnection() const { return m_ZoneConnection; }
void SetZoneConnection( ZONE_CONNECTION aType ) { m_zoneConnection = aType; }
ZONE_CONNECTION GetZoneConnection() const { return m_zoneConnection; }
void SetThermalWidth( int aWidth ) { m_ThermalWidth = aWidth; }
int GetThermalWidth() const { return m_ThermalWidth; }
void SetThermalWidth( int aWidth ) { m_thermalWidth = aWidth; }
int GetThermalWidth() const { return m_thermalWidth; }
void SetThermalGap( int aGap ) { m_ThermalGap = aGap; }
int GetThermalGap() const { return m_ThermalGap; }
void SetThermalGap( int aGap ) { m_thermalGap = aGap; }
int GetThermalGap() const { return m_thermalGap; }
int GetAttributes() const { return m_Attributs; }
void SetAttributes( int aAttributes ) { m_Attributs = aAttributes; }
int GetAttributes() const { return m_attributes; }
void SetAttributes( int aAttributes ) { m_attributes = aAttributes; }
void SetFlag( int aFlag ) { m_arflag = aFlag; }
void IncrementFlag() { m_arflag += 1; }
@ -276,20 +276,20 @@ public:
/**
* function IsFlipped
* @return true if the module is flipped, i.e. on the back side of the board
* @return true if the footprint is flipped, i.e. on the back side of the board
*/
bool IsFlipped() const { return GetLayer() == B_Cu; }
// m_footprintstatus bits:
#define MODULE_is_LOCKED 0x01 ///< module LOCKED: no autoplace allowed
#define MODULE_is_PLACED 0x02 ///< In autoplace: module automatically placed
#define MODULE_to_PLACE 0x04 ///< In autoplace: module waiting for autoplace
#define MODULE_PADS_LOCKED 0x08 ///< In autoplace: module waiting for autoplace
// m_footprintStatus bits:
#define FP_is_LOCKED 0x01 ///< footprint LOCKED: no autoplace allowed
#define FP_is_PLACED 0x02 ///< In autoplace: footprint automatically placed
#define FP_to_PLACE 0x04 ///< In autoplace: footprint waiting for autoplace
#define FP_PADS_are_LOCKED 0x08
bool IsLocked() const override
{
return ( m_ModuleStatus & MODULE_is_LOCKED ) != 0;
return ( m_moduleStatus & FP_is_LOCKED ) != 0;
}
/**
@ -300,42 +300,42 @@ public:
void SetLocked( bool isLocked ) override
{
if( isLocked )
m_ModuleStatus |= MODULE_is_LOCKED;
m_moduleStatus |= FP_is_LOCKED;
else
m_ModuleStatus &= ~MODULE_is_LOCKED;
m_moduleStatus &= ~FP_is_LOCKED;
}
bool IsPlaced() const { return m_ModuleStatus & MODULE_is_PLACED; }
bool IsPlaced() const { return m_moduleStatus & FP_is_PLACED; }
void SetIsPlaced( bool isPlaced )
{
if( isPlaced )
m_ModuleStatus |= MODULE_is_PLACED;
m_moduleStatus |= FP_is_PLACED;
else
m_ModuleStatus &= ~MODULE_is_PLACED;
m_moduleStatus &= ~FP_is_PLACED;
}
bool NeedsPlaced() const { return m_ModuleStatus & MODULE_to_PLACE; }
bool NeedsPlaced() const { return m_moduleStatus & FP_to_PLACE; }
void SetNeedsPlaced( bool needsPlaced )
{
if( needsPlaced )
m_ModuleStatus |= MODULE_to_PLACE;
m_moduleStatus |= FP_to_PLACE;
else
m_ModuleStatus &= ~MODULE_to_PLACE;
m_moduleStatus &= ~FP_to_PLACE;
}
bool PadsLocked() const { return m_ModuleStatus & MODULE_PADS_LOCKED; }
bool PadsLocked() const { return m_moduleStatus & FP_PADS_are_LOCKED; }
void SetPadsLocked( bool aPadsLocked )
{
if( aPadsLocked )
m_ModuleStatus |= MODULE_PADS_LOCKED;
m_moduleStatus |= FP_PADS_are_LOCKED;
else
m_ModuleStatus &= ~MODULE_PADS_LOCKED;
m_moduleStatus &= ~FP_PADS_are_LOCKED;
}
void SetLastEditTime( timestamp_t aTime ) { m_LastEditTime = aTime; }
void SetLastEditTime() { m_LastEditTime = time( NULL ); }
timestamp_t GetLastEditTime() const { return m_LastEditTime; }
void SetLastEditTime( timestamp_t aTime ) { m_lastEditTime = aTime; }
void SetLastEditTime() { m_lastEditTime = time( NULL ); }
timestamp_t GetLastEditTime() const { return m_lastEditTime; }
/* drawing functions */
@ -375,13 +375,13 @@ public:
* @param aClearance = a value to inflate shapes
* @param aError = Maximum error between true arc and polygon approx
* @param aIncludeText = True to transform text shapes
* @param aIncludeEdges = True to transform module shapes
* @param aIncludeShapes = True to transform footprint shapes
*/
void TransformFPShapesWithClearanceToPolygon( SHAPE_POLY_SET& aCornerBuffer,
PCB_LAYER_ID aLayer, int aClearance,
int aError, ERROR_LOC aErrorLoc,
bool aIncludeText = true,
bool aIncludeEdges = true ) const;
bool aIncludeShapes = true ) const;
/**
* @brief TransformFPTextWithClearanceToPolygonSet
@ -413,7 +413,7 @@ public:
bool HitTest( const wxPoint& aPosition, int aAccuracy = 0 ) const override;
/**
* Tests if a point is inside the bounding polygon of the module
* Tests if a point is inside the bounding polygon of the footprint
*
* The other hit test methods are just checking the bounding box, which
* can be quite inaccurate for rotated or oddly-shaped footprints.
@ -431,7 +431,7 @@ public:
*/
const wxString GetReference() const
{
return m_Reference->GetText();
return m_reference->GetText();
}
/**
@ -441,7 +441,7 @@ public:
*/
void SetReference( const wxString& aReference )
{
m_Reference->SetText( aReference );
m_reference->SetText( aReference );
}
/**
@ -456,7 +456,7 @@ public:
*/
const wxString GetValue() const
{
return m_Value->GetText();
return m_value->GetText();
}
/**
@ -465,16 +465,16 @@ public:
*/
void SetValue( const wxString& aValue )
{
m_Value->SetText( aValue );
m_value->SetText( aValue );
}
/// read/write accessors:
FP_TEXT& Value() { return *m_Value; }
FP_TEXT& Reference() { return *m_Reference; }
FP_TEXT& Value() { return *m_value; }
FP_TEXT& Reference() { return *m_reference; }
/// The const versions to keep the compiler happy.
FP_TEXT& Value() const { return *m_Value; }
FP_TEXT& Reference() const { return *m_Reference; }
FP_TEXT& Value() const { return *m_value; }
FP_TEXT& Reference() const { return *m_reference; }
const std::map<wxString, wxString>& GetProperties() const { return m_properties; }
void SetProperties( const std::map<wxString, wxString>& aProps ) { m_properties = aProps; }
@ -535,7 +535,7 @@ public:
/**
* Function GetNextPadName
* returns the next available pad name in the module
* returns the next available pad name in the footprint
*
* @param aFillSequenceGaps true if the numbering should "fill in" gaps in the sequence,
* else return the highest value + 1
@ -545,23 +545,23 @@ public:
double GetArea( int aPadding = 0 ) const;
KIID GetLink() const { return m_Link; }
void SetLink( const KIID& aLink ) { m_Link = aLink; }
KIID GetLink() const { return m_link; }
void SetLink( const KIID& aLink ) { m_link = aLink; }
int GetPlacementCost180() const { return m_CntRot180; }
void SetPlacementCost180( int aCost ) { m_CntRot180 = aCost; }
int GetPlacementCost180() const { return m_rot180Cost; }
void SetPlacementCost180( int aCost ) { m_rot180Cost = aCost; }
int GetPlacementCost90() const { return m_CntRot90; }
void SetPlacementCost90( int aCost ) { m_CntRot90 = aCost; }
int GetPlacementCost90() const { return m_rot90Cost; }
void SetPlacementCost90( int aCost ) { m_rot90Cost = aCost; }
BOARD_ITEM* Duplicate() const override;
/**
* Function DuplicateItem
* Duplicate a given item within the module, optionally adding it to the board
* Duplicate a given item within the footprint, optionally adding it to the board
* @return the new item, or NULL if the item could not be duplicated
*/
BOARD_ITEM* DuplicateItem( const BOARD_ITEM* aItem, bool aAddToModule = false );
BOARD_ITEM* DuplicateItem( const BOARD_ITEM* aItem, bool aAddToFootprint = false );
/**
* Function Add3DModel
@ -587,14 +587,14 @@ public:
/**
* Function RunOnChildren
*
* Invokes a function on all BOARD_ITEMs that belong to the module (pads, drawings, texts).
* Note that this function should not add or remove items to the module
* Invokes a function on all BOARD_ITEMs that belong to the footprint (pads, drawings, texts).
* Note that this function should not add or remove items to the footprint
* @param aFunction is the function to be invoked.
*/
void RunOnChildren( const std::function<void (BOARD_ITEM*)>& aFunction ) const;
/**
* Returns a set of all layers that this module has drawings on similar to ViewGetLayers()
* Returns a set of all layers that this footprint has drawings on similar to ViewGetLayers()
*
* @param aLayers is an array to store layer ids
* @param aCount is the number of layers stored in the array
@ -691,44 +691,44 @@ public:
#endif
private:
DRAWINGS m_drawings; // BOARD_ITEMs for drawings on the board, owned by pointer.
PADS m_pads; // PAD items, owned by pointer
FP_ZONES m_fp_zones; // FP_ZONE items, owned by pointer
MODULE_GROUPS m_fp_groups; // PCB_GROUP items, owned by pointer
DRAWINGS m_drawings; // BOARD_ITEMs for drawings on the board, owned by pointer.
PADS m_pads; // PAD items, owned by pointer
FP_ZONES m_fp_zones; // FP_ZONE items, owned by pointer
MODULE_GROUPS m_fp_groups; // PCB_GROUP items, owned by pointer
double m_Orient; // Orientation in tenths of a degree, 900=90.0 degrees.
wxPoint m_Pos; // Position of module on the board in internal units.
FP_TEXT* m_Reference; // Component reference designator value (U34, R18..)
FP_TEXT* m_Value; // Component value (74LS00, 22K..)
LIB_ID m_fpid; // The #LIB_ID of the MODULE.
int m_Attributs; // Flag bits ( see Mod_Attribut )
int m_ModuleStatus; // For autoplace: flags (LOCKED, FIELDS_AUTOPLACED)
EDA_RECT m_BoundaryBox; // Bounding box : coordinates on board, real orientation.
double m_orient; // Orientation in tenths of a degree, 900=90.0 degrees.
wxPoint m_pos; // Position of footprint on the board in internal units.
FP_TEXT* m_reference; // Component reference designator value (U34, R18..)
FP_TEXT* m_value; // Component value (74LS00, 22K..)
LIB_ID m_fpid; // The #LIB_ID of the MODULE.
int m_attributes; // Flag bits ( see FOOTPRINT_ATTR_T )
int m_moduleStatus; // For autoplace: flags (LOCKED, FIELDS_AUTOPLACED)
EDA_RECT m_boundingBox; // Bounding box : coordinates on board, real orientation.
ZONE_CONNECTION m_ZoneConnection;
int m_ThermalWidth;
int m_ThermalGap;
int m_LocalClearance;
int m_LocalSolderMaskMargin; // Solder mask margin
int m_LocalSolderPasteMargin; // Solder paste margin absolute value
double m_LocalSolderPasteMarginRatio; // Solder mask margin ratio value of pad size
ZONE_CONNECTION m_zoneConnection;
int m_thermalWidth;
int m_thermalGap;
int m_localClearance;
int m_localSolderMaskMargin; // Solder mask margin
int m_localSolderPasteMargin; // Solder paste margin absolute value
double m_localSolderPasteMarginRatio; // Solder mask margin ratio value of pad size
wxString m_Doc; // File name and path for documentation file.
wxString m_KeyWord; // Search keywords to find module in library.
KIID_PATH m_Path; // Path to associated symbol ([sheetUUID, .., symbolUUID]).
timestamp_t m_LastEditTime;
int m_arflag; // Use to trace ratsnest and auto routing.
KIID m_Link; // Temporary logical link used during editing
int m_CntRot90; // Horizontal automatic placement cost ( 0..10 ).
int m_CntRot180; // Vertical automatic placement cost ( 0..10 ).
wxString m_doc; // File name and path for documentation file.
wxString m_keywords; // Search keywords to find footprint in library.
KIID_PATH m_path; // Path to associated symbol ([sheetUUID, .., symbolUUID]).
timestamp_t m_lastEditTime;
int m_arflag; // Use to trace ratsnest and auto routing.
KIID m_link; // Temporary logical link used during editing
int m_rot90Cost; // Horizontal automatic placement cost ( 0..10 ).
int m_rot180Cost; // Vertical automatic placement cost ( 0..10 ).
std::list<FP_3DMODEL> m_3D_Drawings; // Linked list of 3D models.
std::map<wxString, wxString> m_properties;
wxArrayString* m_initial_comments; // s-expression comments in the module,
wxArrayString* m_initial_comments; // s-expression comments in the footprint,
// lazily allocated only if needed for speed
SHAPE_POLY_SET m_poly_courtyard_front; // Note that a module can have both front and back
SHAPE_POLY_SET m_poly_courtyard_back; // courtyards populated.
SHAPE_POLY_SET m_poly_courtyard_front; // Note that a footprint can have both front and back
SHAPE_POLY_SET m_poly_courtyard_back; // courtyards populated.
};
#endif // FOOTPRINT_H

View File

@ -103,14 +103,14 @@ void FOOTPRINT_WIZARD_FRAME::ReloadFootprint()
// Creates the module
wxString msg;
MODULE* module = footprintWizard->GetFootprint( &msg );
MODULE* footprint = footprintWizard->GetFootprint( &msg );
DisplayBuildMessage( msg );
if( module )
if( footprint )
{
// Add the object to board
GetBoard()->Add( module, ADD_MODE::APPEND );
module->SetPosition( wxPoint( 0, 0 ) );
GetBoard()->Add( footprint, ADD_MODE::APPEND );
footprint->SetPosition( wxPoint( 0, 0 ) );
}
updateView();

View File

@ -149,11 +149,11 @@ public:
void Show( int nestLevel, std::ostream& os ) const override { ShowDummy( os ); }
#endif
wxPoint m_Start0; ///< Start point or center, relative to module origin, orient 0.
wxPoint m_End0; ///< End point, relative to module origin, orient 0.
wxPoint m_Start0; ///< Start point or center, relative to footprint origin, orient 0.
wxPoint m_End0; ///< End point, relative to footprint origin, orient 0.
wxPoint m_ThirdPoint0; ///< End point for an arc.
wxPoint m_Bezier0_C1; ///< Bezier Control Point 1, relative to module origin, orient 0.
wxPoint m_Bezier0_C2; ///< Bezier Control Point 2, relative to module origin, orient 0.
wxPoint m_Bezier0_C1; ///< Bezier Control Point 1, relative to footprint origin, orient 0.
wxPoint m_Bezier0_C2; ///< Bezier Control Point 2, relative to footprint origin, orient 0.
};
#endif // FP_SHAPE_H

View File

@ -31,11 +31,11 @@
#include <settings/settings_manager.h>
#include <trigo.h>
FP_TEXT::FP_TEXT( MODULE* parent, TEXT_TYPE text_type ) :
BOARD_ITEM( parent, PCB_FP_TEXT_T ),
FP_TEXT::FP_TEXT( MODULE* aParentFootprint, TEXT_TYPE text_type ) :
BOARD_ITEM( aParentFootprint, PCB_FP_TEXT_T ),
EDA_TEXT()
{
MODULE* module = static_cast<MODULE*>( m_Parent );
MODULE* parentFootprint = static_cast<MODULE*>( m_Parent );
m_Type = text_type;
m_keepUpright = true;
@ -45,11 +45,11 @@ FP_TEXT::FP_TEXT( MODULE* parent, TEXT_TYPE text_type ) :
SetLayer( F_SilkS );
// Set position and give a default layer if a valid parent footprint exists
if( module && ( module->Type() == PCB_MODULE_T ) )
if( parentFootprint && ( parentFootprint->Type() == PCB_MODULE_T ) )
{
SetTextPos( module->GetPosition() );
SetTextPos( parentFootprint->GetPosition() );
if( IsBackLayer( module->GetLayer() ) )
if( IsBackLayer( parentFootprint->GetLayer() ) )
{
SetLayer( B_SilkS );
SetMirrored( true );
@ -127,7 +127,7 @@ void FP_TEXT::KeepUpright( double aOldOrientation, double aNewOrientation )
void FP_TEXT::Rotate( const wxPoint& aRotCentre, double aAngle )
{
// Used in footprint editing
// Note also in module editor, m_Pos0 = m_Pos
// Note also in footprint editor, m_Pos0 = m_Pos
wxPoint pt = GetTextPos();
RotatePoint( &pt, aRotCentre, aAngle );
@ -197,32 +197,32 @@ int FP_TEXT::GetLength() const
void FP_TEXT::SetDrawCoord()
{
const MODULE* module = static_cast<const MODULE*>( m_Parent );
const MODULE* parentFootprint = static_cast<const MODULE*>( m_Parent );
SetTextPos( m_Pos0 );
if( module )
if( parentFootprint )
{
double angle = module->GetOrientation();
double angle = parentFootprint->GetOrientation();
wxPoint pt = GetTextPos();
RotatePoint( &pt, angle );
SetTextPos( pt );
Offset( module->GetPosition() );
Offset( parentFootprint->GetPosition() );
}
}
void FP_TEXT::SetLocalCoord()
{
const MODULE* module = static_cast<const MODULE*>( m_Parent );
const MODULE* parentFootprint = static_cast<const MODULE*>( m_Parent );
if( module )
if( parentFootprint )
{
m_Pos0 = GetTextPos() - module->GetPosition();
m_Pos0 = GetTextPos() - parentFootprint->GetPosition();
double angle = module->GetOrientation();
double angle = parentFootprint->GetOrientation();
RotatePoint( &m_Pos0.x, &m_Pos0.y, -angle );
}
@ -246,11 +246,11 @@ const EDA_RECT FP_TEXT::GetBoundingBox() const
double FP_TEXT::GetDrawRotation() const
{
MODULE* module = (MODULE*) m_Parent;
MODULE* parentFootprint = (MODULE*) m_Parent;
double rotation = GetTextAngle();
if( module )
rotation += module->GetOrientation();
if( parentFootprint )
rotation += parentFootprint->GetOrientation();
if( m_keepUpright )
{
@ -273,9 +273,9 @@ double FP_TEXT::GetDrawRotation() const
// see class_text_mod.h
void FP_TEXT::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList )
{
MODULE* module = (MODULE*) m_Parent;
MODULE* parentFootprint = (MODULE*) m_Parent;
if( module == NULL ) // Happens in modedit, and for new texts
if( parentFootprint == NULL ) // Happens in modedit, and for new texts
return;
wxString msg, Line;
@ -285,7 +285,7 @@ void FP_TEXT::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITE
_( "Ref." ), _( "Value" ), _( "Text" )
};
Line = module->GetReference();
Line = parentFootprint->GetReference();
aList.emplace_back( _( "Footprint" ), Line, DARKCYAN );
Line = GetShownText();
@ -421,14 +421,14 @@ double FP_TEXT::ViewGetLOD( int aLayer, KIGFX::VIEW* aView ) const
wxString FP_TEXT::GetShownText( int aDepth ) const
{
const MODULE* module = static_cast<MODULE*>( GetParent() );
wxASSERT( module );
const BOARD* board = module->GetBoard();
const MODULE* parentFootprint = static_cast<MODULE*>( GetParent() );
wxASSERT( parentFootprint );
const BOARD* board = parentFootprint->GetBoard();
std::function<bool( wxString* )> moduleResolver =
std::function<bool( wxString* )> footprintResolver =
[&]( wxString* token ) -> bool
{
return module && module->ResolveTextVar( token, aDepth );
return parentFootprint && parentFootprint->ResolveTextVar( token, aDepth );
};
std::function<bool( wxString* )> boardTextResolver =
@ -444,11 +444,11 @@ wxString FP_TEXT::GetShownText( int aDepth ) const
{
PROJECT* project = nullptr;
if( module && module->GetParent() )
project = static_cast<BOARD*>( module->GetParent() )->GetProject();
if( parentFootprint && parentFootprint->GetParent() )
project = static_cast<BOARD*>( parentFootprint->GetParent() )->GetProject();
if( aDepth < 10 )
text = ExpandTextVars( text, &moduleResolver, project, &boardTextResolver );
text = ExpandTextVars( text, &footprintResolver, project, &boardTextResolver );
}
return text;

View File

@ -39,12 +39,12 @@ class SHAPE;
class FP_TEXT : public BOARD_ITEM, public EDA_TEXT
{
public:
/** Text module type: there must be only one (and only one) for each
* of the reference and value texts in one module; others could be
* added for the user (DIVERS is French for 'others'). Reference and
* value always live on silkscreen (on the module side); other texts
* are planned to go on whatever layer the user wants (except
* copper, probably) */
/**
* Footprint text type: there must be only one (and only one) for each of the reference
* value texts in one footprint; others could be added for the user (DIVERS is French for
* 'others'). Reference and value always live on silkscreen (on the footprint side); other
* texts are planned to go on whatever layer the user wants.
*/
enum TEXT_TYPE
{
TEXT_is_REFERENCE = 0,
@ -52,7 +52,7 @@ public:
TEXT_is_DIVERS = 2
};
FP_TEXT( MODULE* parent, TEXT_TYPE text_type = TEXT_is_DIVERS );
FP_TEXT( MODULE* aParentFootprint, TEXT_TYPE text_type = TEXT_is_DIVERS );
// Do not create a copy constructor & operator=.
// The ones generated by the compiler are adequate.
@ -119,7 +119,7 @@ public:
/// (for instance in footprint rotation transform)
void Rotate( const wxPoint& aOffset, double aAngle ) override;
/// Flip entity during module flip
/// Flip entity during footprint flip
void Flip( const wxPoint& aCentre, bool aFlipLeftRight ) override;
bool IsParentFlipped() const;
@ -161,7 +161,7 @@ public:
// std::swap( m_Type, aTradingPartner.m_Type );
}
// The Pos0 accessors are for module-relative coordinates
// The Pos0 accessors are for footprint-relative coordinates
void SetPos0( const wxPoint& aPos ) { m_Pos0 = aPos; SetDrawCoord(); }
const wxPoint& GetPos0() const { return m_Pos0; }

View File

@ -477,17 +477,17 @@ const EDA_RECT PAD::GetBoundingBox() const
void PAD::SetDrawCoord()
{
MODULE* module = (MODULE*) m_Parent;
MODULE* parentFootprint = (MODULE*) m_Parent;
m_pos = m_pos0;
if( module == NULL )
if( parentFootprint == NULL )
return;
double angle = module->GetOrientation();
double angle = parentFootprint->GetOrientation();
RotatePoint( &m_pos.x, &m_pos.y, angle );
m_pos += module->GetPosition();
m_pos += parentFootprint->GetPosition();
m_shapesDirty = true;
}
@ -495,16 +495,16 @@ void PAD::SetDrawCoord()
void PAD::SetLocalCoord()
{
MODULE* module = (MODULE*) m_Parent;
MODULE* parentFootprint = (MODULE*) m_Parent;
if( module == NULL )
if( parentFootprint == NULL )
{
m_pos0 = m_pos;
return;
}
m_pos0 = m_pos - module->GetPosition();
RotatePoint( &m_pos0.x, &m_pos0.y, -module->GetOrientation() );
m_pos0 = m_pos - parentFootprint->GetPosition();
RotatePoint( &m_pos0.x, &m_pos0.y, -parentFootprint->GetOrientation() );
}
@ -658,14 +658,14 @@ int PAD::GetSolderMaskMargin() const
int margin = m_localSolderMaskMargin;
MODULE* module = GetParent();
MODULE* parentFootprint = GetParent();
if( module )
if( parentFootprint )
{
if( margin == 0 )
{
if( module->GetLocalSolderMaskMargin() )
margin = module->GetLocalSolderMaskMargin();
if( parentFootprint->GetLocalSolderMaskMargin() )
margin = parentFootprint->GetLocalSolderMaskMargin();
}
if( margin == 0 )
@ -704,12 +704,12 @@ wxSize PAD::GetSolderPasteMargin() const
int margin = m_localSolderPasteMargin;
double mratio = m_localSolderPasteMarginRatio;
MODULE* module = GetParent();
MODULE* parentFootprint = GetParent();
if( module )
if( parentFootprint )
{
if( margin == 0 )
margin = module->GetLocalSolderPasteMargin();
margin = parentFootprint->GetLocalSolderPasteMargin();
auto brd = GetBoard();
@ -717,7 +717,7 @@ wxSize PAD::GetSolderPasteMargin() const
margin = brd->GetDesignSettings().m_SolderPasteMargin;
if( mratio == 0.0 )
mratio = module->GetLocalSolderPasteMarginRatio();
mratio = parentFootprint->GetLocalSolderPasteMarginRatio();
if( mratio == 0.0 && brd )
{
@ -742,14 +742,14 @@ wxSize PAD::GetSolderPasteMargin() const
ZONE_CONNECTION PAD::GetEffectiveZoneConnection( wxString* aSource ) const
{
MODULE* module = GetParent();
MODULE* parentFootprint = GetParent();
if( m_zoneConnection == ZONE_CONNECTION::INHERITED && module )
if( m_zoneConnection == ZONE_CONNECTION::INHERITED && parentFootprint )
{
if( aSource )
*aSource = _( "parent footprint" );
return module->GetZoneConnection();
return parentFootprint->GetZoneConnection();
}
else
{
@ -763,14 +763,14 @@ ZONE_CONNECTION PAD::GetEffectiveZoneConnection( wxString* aSource ) const
int PAD::GetEffectiveThermalSpokeWidth( wxString* aSource ) const
{
MODULE* module = GetParent();
MODULE* parentFootprint = GetParent();
if( m_thermalWidth == 0 && module )
if( m_thermalWidth == 0 && parentFootprint )
{
if( aSource )
*aSource = _( "parent footprint" );
return module->GetThermalWidth();
return parentFootprint->GetThermalWidth();
}
if( aSource )
@ -782,14 +782,14 @@ int PAD::GetEffectiveThermalSpokeWidth( wxString* aSource ) const
int PAD::GetEffectiveThermalGap( wxString* aSource ) const
{
MODULE* module = GetParent();
MODULE* parentFootprint = GetParent();
if( m_thermalGap == 0 && module )
if( m_thermalGap == 0 && parentFootprint )
{
if( aSource )
*aSource = _( "parent footprint" );
return module->GetThermalGap();
return parentFootprint->GetThermalGap();
}
if( aSource )
@ -805,10 +805,10 @@ void PAD::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>&
wxString msg, msg2;
BOARD* board = GetBoard();
BOARD_DESIGN_SETTINGS& bds = board->GetDesignSettings();
MODULE* module = (MODULE*) m_Parent;
MODULE* parentFootprint = (MODULE*) m_Parent;
if( module )
aList.emplace_back( _( "Footprint" ), module->GetReference(), DARKCYAN );
if( parentFootprint )
aList.emplace_back( _( "Footprint" ), parentFootprint->GetReference(), DARKCYAN );
aList.emplace_back( _( "Pad" ), m_name, BROWN );
@ -862,12 +862,12 @@ void PAD::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>&
aList.emplace_back( _( "Height" ), msg, RED );
}
double module_orient_degrees = module ? module->GetOrientationDegrees() : 0;
double pad_orient_degrees = GetOrientationDegrees() - module_orient_degrees;
double fp_orient_degrees = parentFootprint ? parentFootprint->GetOrientationDegrees() : 0;
double pad_orient_degrees = GetOrientationDegrees() - fp_orient_degrees;
pad_orient_degrees = NormalizeAngleDegrees( pad_orient_degrees, -180.0, +180.0 );
if( module_orient_degrees != 0.0 )
msg.Printf( wxT( "%.4g(+ %.4g)" ), pad_orient_degrees, module_orient_degrees );
if( fp_orient_degrees != 0.0 )
msg.Printf( wxT( "%.4g(+ %.4g)" ), pad_orient_degrees, fp_orient_degrees );
else
msg.Printf( wxT( "%.4g" ), GetOrientationDegrees() );

View File

@ -457,7 +457,7 @@ public:
/**
* Return the zone connection in effect (either locally overridden or overridden in the
* parent module).
* parent footprint).
* Optionally reports on the source of the property (pad, parent footprint or zone).
*/
ZONE_CONNECTION GetEffectiveZoneConnection( wxString* aSource = nullptr ) const;
@ -706,7 +706,7 @@ private:
// to have a single axis be non-0.
wxPoint m_pos0; // Initial Pad position (i.e. pad position relative to the
// module anchor, orientation 0)
// footprint anchor, orientation 0)
PAD_ATTR_T m_attribute; // PAD_ATTRIB_NORMAL, PAD_ATTRIB_SMD, PAD_ATTRIB_CONN,
// PAD_ATTRIB_NPTH

View File

@ -152,23 +152,23 @@ void PCB_BASE_FRAME::SetBoard( BOARD* aBoard )
}
void PCB_BASE_FRAME::AddFootprintToBoard( MODULE* module )
void PCB_BASE_FRAME::AddFootprintToBoard( MODULE* aFootprint )
{
if( module )
if( aFootprint )
{
GetBoard()->Add( module, ADD_MODE::APPEND );
GetBoard()->Add( aFootprint, ADD_MODE::APPEND );
module->SetFlags( IS_NEW );
module->SetPosition( wxPoint( 0, 0 ) ); // cursor in GAL may not be initialized yet
aFootprint->SetFlags(IS_NEW );
aFootprint->SetPosition( wxPoint( 0, 0 ) ); // cursor in GAL may not be initialized yet
// Put it on FRONT layer (note that it might be stored flipped if the lib is an archive
// built from a board)
if( module->IsFlipped() )
module->Flip( module->GetPosition(), m_settings->m_FlipLeftRight );
if( aFootprint->IsFlipped() )
aFootprint->Flip( aFootprint->GetPosition(), m_settings->m_FlipLeftRight );
// Place it in orientation 0 even if it is not saved with orientation 0 in lib (note that
// it might be stored in another orientation if the lib is an archive built from a board)
module->SetOrientation( 0 );
aFootprint->SetOrientation( 0 );
}
}

View File

@ -189,19 +189,19 @@ void PCB_DRAW_PANEL_GAL::DisplayBoard( BOARD* aBoard )
m_worksheet->SetFileName( TO_UTF8( aBoard->GetFileName() ) );
// Load drawings
for( auto drawing : const_cast<BOARD*>(aBoard)->Drawings() )
for( BOARD_ITEM* drawing : aBoard->Drawings() )
m_view->Add( drawing );
// Load tracks
for( auto track : aBoard->Tracks() )
for( TRACK* track : aBoard->Tracks() )
m_view->Add( track );
// Load footprints and its additional elements
for( auto module : aBoard->Footprints() )
m_view->Add( module );
for( MODULE* footprint : aBoard->Footprints() )
m_view->Add( footprint );
// DRC markers
for( auto marker : aBoard->Markers() )
for( MARKER_PCB* marker : aBoard->Markers() )
m_view->Add( marker );
// Finalize the triangulation threads
@ -209,7 +209,7 @@ void PCB_DRAW_PANEL_GAL::DisplayBoard( BOARD* aBoard )
std::this_thread::sleep_for( std::chrono::milliseconds( 10 ) );
// Load zones
for( auto zone : aBoard->Zones() )
for( ZONE* zone : aBoard->Zones() )
m_view->Add( zone );
// Ratsnest

View File

@ -322,9 +322,9 @@ static void insideArea( LIBEVAL::CONTEXT* aCtx, void* self )
}
}
for( MODULE* module : item->GetBoard()->Footprints() )
for( MODULE* footprint : item->GetBoard()->Footprints() )
{
for( ZONE* candidate : module->Zones() )
for( ZONE* candidate : footprint->Zones() )
{
// Only a single zone can match the UUID; exit once we find a match whether
// "inside" or not
@ -353,9 +353,9 @@ static void insideArea( LIBEVAL::CONTEXT* aCtx, void* self )
}
}
for( MODULE* module : item->GetBoard()->Footprints() )
for( MODULE* footprint : item->GetBoard()->Footprints() )
{
for( ZONE* candidate : module->Zones() )
for( ZONE* candidate : footprint->Zones() )
{
// Many zones can match the name; exit only when we find an "inside"
if( candidate->GetZoneName().Matches( arg->AsString() ) )

View File

@ -580,17 +580,17 @@ const EDA_RECT PCB_SHAPE::GetBoundingBox() const
if( m_Poly.IsEmpty() )
break;
MODULE* module = GetParentFootprint();
MODULE* parentFootprint = GetParentFootprint();
bbox = EDA_RECT(); // re-init for merging
for( auto iter = m_Poly.CIterate(); iter; iter++ )
{
wxPoint pt( iter->x, iter->y );
if( module ) // Transform, if we belong to a module
if( parentFootprint ) // Transform, if we belong to a footprint
{
RotatePoint( &pt, module->GetOrientation() );
pt += module->GetPosition();
RotatePoint( &pt, parentFootprint->GetOrientation() );
pt += parentFootprint->GetPosition();
}
bbox.Merge( pt );
@ -942,18 +942,18 @@ const BOX2I PCB_SHAPE::ViewBBox() const
std::vector<wxPoint> PCB_SHAPE::GetRectCorners() const
{
std::vector<wxPoint> pts;
MODULE* module = GetParentFootprint();
MODULE* parentFootprint = GetParentFootprint();
wxPoint topLeft = GetStart();
wxPoint botRight = GetEnd();
// Un-rotate rect topLeft and botRight
if( module && KiROUND( module->GetOrientation() ) % 900 != 0 )
if( parentFootprint && KiROUND( parentFootprint->GetOrientation() ) % 900 != 0 )
{
topLeft -= module->GetPosition();
RotatePoint( &topLeft, -module->GetOrientation() );
topLeft -= parentFootprint->GetPosition();
RotatePoint( &topLeft, -parentFootprint->GetOrientation() );
botRight -= module->GetPosition();
RotatePoint( &botRight, -module->GetOrientation() );
botRight -= parentFootprint->GetPosition();
RotatePoint( &botRight, -parentFootprint->GetOrientation() );
}
// Set up the un-rotated 4 corners
@ -963,12 +963,12 @@ std::vector<wxPoint> PCB_SHAPE::GetRectCorners() const
pts.emplace_back( topLeft.x, botRight.y );
// Now re-rotate the 4 corners to get a diamond
if( module && KiROUND( module->GetOrientation() ) % 900 != 0 )
if( parentFootprint && KiROUND( parentFootprint->GetOrientation() ) % 900 != 0 )
{
for( wxPoint& pt : pts )
{
RotatePoint( &pt,module->GetOrientation() );
pt += module->GetPosition();
RotatePoint( &pt, parentFootprint->GetOrientation() );
pt += parentFootprint->GetPosition();
}
}

View File

@ -219,9 +219,9 @@ public:
/**
* Function GetParentFootprint
* returns a pointer to the parent module, or NULL if PCB_SHAPE does not
* belong to a module.
* @return MODULE* - pointer to the parent module or NULL.
* returns a pointer to the parent footprint, or NULL if PCB_SHAPE does not
* belong to a footprint.
* @return MODULE* - pointer to the parent footprint or NULL.
*/
MODULE* GetParentFootprint() const;

View File

@ -395,7 +395,7 @@ PCBNEW_SETTINGS::PCBNEW_SETTINGS()
&m_FootprintWizardList.height, -1 ) );
m_params.emplace_back( new PARAM<bool>(
"reannotate_dialog.annotate_sort_on_modules", &m_Reannotate.sort_on_module_location, true ) );
"reannotate_dialog.annotate_sort_on_modules", &m_Reannotate.sort_on_fp_location, true ) );
m_params.emplace_back( new PARAM<bool>(
"reannotate_dialog.annotate_remove_front_prefix", &m_Reannotate.remove_front_prefix, false ) );
m_params.emplace_back( new PARAM<bool>(

View File

@ -191,7 +191,7 @@ public:
struct DIALOG_REANNOTATE
{
bool sort_on_module_location;
bool sort_on_fp_location;
bool remove_front_prefix;
bool remove_back_prefix;
bool update_schematic;

View File

@ -622,7 +622,7 @@ void BRDITEMS_PLOTTER::PlotFootprintGraphicItem( FP_SHAPE* aShape )
// We must compute board coordinates from m_PolyList which are relative to the parent
// position at orientation 0
MODULE *module = aShape->GetParentFootprint();
MODULE *parentFootprint = aShape->GetParentFootprint();
std::vector<wxPoint> cornerList;
@ -630,10 +630,10 @@ void BRDITEMS_PLOTTER::PlotFootprintGraphicItem( FP_SHAPE* aShape )
for( wxPoint corner : polyPoints )
{
if( module )
if( parentFootprint )
{
RotatePoint( &corner, module->GetOrientation() );
corner += module->GetPosition();
RotatePoint( &corner, parentFootprint->GetOrientation() );
corner += parentFootprint->GetPosition();
}
cornerList.push_back( corner );
@ -644,11 +644,11 @@ void BRDITEMS_PLOTTER::PlotFootprintGraphicItem( FP_SHAPE* aShape )
for( size_t i = 1; i < cornerList.size(); i++ )
{
m_plotter->ThickSegment( cornerList[i - 1], cornerList[i], thickness,
GetPlotMode(), &gbr_metadata );
GetPlotMode(), &gbr_metadata );
}
m_plotter->ThickSegment( cornerList.back(), cornerList.front(), thickness,
GetPlotMode(), &gbr_metadata );
GetPlotMode(), &gbr_metadata );
}
else

View File

@ -194,19 +194,19 @@ void PCB_BASE_EDIT_FRAME::SaveCopyInUndoList( const PICKED_ITEMS_LIST& aItemsLis
commandToUndo->m_TransformPoint = aTransformPoint;
// First, filter unnecessary stuff from the list (i.e. for multiple pads / labels modified),
// take the first occurence of the module (we save copies of footprints when one of its subitems
// is changed).
// take the first occurence of the footprint (we save copies of footprints when one of its
// subitems is changed).
for( unsigned ii = 0; ii < aItemsList.GetCount(); ii++ )
{
ITEM_PICKER curr_picker = aItemsList.GetItemWrapper(ii);
BOARD_ITEM* item = dynamic_cast<BOARD_ITEM*>( aItemsList.GetPickedItem( ii ) );
// For items belonging to footprints, we need to save state of the parent module
// For items belonging to footprints, we need to save state of the parent footprint
if( item && item->GetParent() && item->GetParent()->Type() == PCB_MODULE_T )
{
item = item->GetParent();
// Check if the parent module has already been saved in another entry
// Check if the parent footprint has already been saved in another entry
bool found = false;
for( unsigned j = 0; j < commandToUndo->GetCount(); j++ )
@ -221,7 +221,7 @@ void PCB_BASE_EDIT_FRAME::SaveCopyInUndoList( const PICKED_ITEMS_LIST& aItemsLis
if( !found )
{
// Create a clean copy of the parent module
// Create a clean copy of the parent footprint
MODULE* orig = static_cast<MODULE*>( item );
MODULE* clone = new MODULE( *orig );
clone->SetParent( GetBoard() );

View File

@ -119,15 +119,15 @@ bool ZONE_FILLER::Fill( std::vector<ZONE*>& aZones, bool aCheck, wxWindow* aPare
m_worstClearance = std::max( m_worstClearance, zone->GetLocalClearance() );
}
for( MODULE* module : m_board->Footprints() )
for( MODULE* footprint : m_board->Footprints() )
{
for( PAD* pad : module->Pads() )
for( PAD* pad : footprint->Pads() )
{
if( pad->IsDirty() )
pad->BuildEffectiveShapes( UNDEFINED_LAYER );
}
for( ZONE* zone : module->Zones() )
for( ZONE* zone : footprint->Zones() )
{
zone->CacheBoundingBox();
m_worstClearance = std::max( m_worstClearance, zone->GetLocalClearance() );
@ -615,9 +615,9 @@ void ZONE_FILLER::knockoutThermalReliefs( const ZONE* aZone, PCB_LAYER_ID aLayer
{
SHAPE_POLY_SET holes;
for( MODULE* module : m_board->Footprints() )
for( MODULE* footprint : m_board->Footprints() )
{
for( PAD* pad : module->Pads() )
for( PAD* pad : footprint->Pads() )
{
if( !hasThermalConnection( pad, aZone ) )
continue;
@ -729,9 +729,9 @@ void ZONE_FILLER::buildCopperItemClearances( const ZONE* aZone, PCB_LAYER_ID aLa
}
};
for( MODULE* module : m_board->Footprints() )
for( MODULE* footprint : m_board->Footprints() )
{
for( PAD* pad : module->Pads() )
for( PAD* pad : footprint->Pads() )
{
if( checkForCancel( m_progressReporter ) )
return;
@ -818,12 +818,12 @@ void ZONE_FILLER::buildCopperItemClearances( const ZONE* aZone, PCB_LAYER_ID aLa
}
};
for( MODULE* module : m_board->Footprints() )
for( MODULE* footprint : m_board->Footprints() )
{
knockoutGraphicClearance( &module->Reference() );
knockoutGraphicClearance( &module->Value() );
knockoutGraphicClearance( &footprint->Reference() );
knockoutGraphicClearance( &footprint->Value() );
for( BOARD_ITEM* item : module->GraphicalItems() )
for( BOARD_ITEM* item : footprint->GraphicalItems() )
{
if( checkForCancel( m_progressReporter ) )
return;
@ -895,9 +895,9 @@ void ZONE_FILLER::buildCopperItemClearances( const ZONE* aZone, PCB_LAYER_ID aLa
}
}
for( MODULE* module : m_board->Footprints() )
for( MODULE* footprint : m_board->Footprints() )
{
for( ZONE* otherZone : module->Zones() )
for( ZONE* otherZone : footprint->Zones() )
{
if( checkForCancel( m_progressReporter ) )
return;
@ -947,9 +947,9 @@ void ZONE_FILLER::subtractHigherPriorityZones( const ZONE* aZone, PCB_LAYER_ID a
}
}
for( MODULE* module : m_board->Footprints() )
for( MODULE* footprint : m_board->Footprints() )
{
for( ZONE* otherZone : module->Zones() )
for( ZONE* otherZone : footprint->Zones() )
{
if( otherZone->GetNetCode() == aZone->GetNetCode()
&& otherZone->GetPriority() > aZone->GetPriority() )
@ -1248,9 +1248,9 @@ void ZONE_FILLER::buildThermalSpokes( const ZONE* aZone, PCB_LAYER_ID aLayer,
// us avoid the question.
int epsilon = KiROUND( IU_PER_MM * 0.04 ); // about 1.5 mil
for( auto module : m_board->Footprints() )
for( MODULE* footprint : m_board->Footprints() )
{
for( auto pad : module->Pads() )
for( PAD* pad : footprint->Pads() )
{
if( !hasThermalConnection( pad, aZone ) )
continue;
@ -1530,9 +1530,9 @@ bool ZONE_FILLER::addHatchFillTypeOnZone( const ZONE* aZone, PCB_LAYER_ID aLayer
}
}
for( MODULE* module : m_board->Footprints() )
for( MODULE* footprint : m_board->Footprints() )
{
for( PAD* pad : module->Pads() )
for( PAD* pad : footprint->Pads() )
{
if( pad->GetNetCode() == aZone->GetNetCode()
&& pad->IsOnLayer( aLayer )