7
mirror of https://gitlab.com/kicad/code/kicad.git synced 2025-04-20 00:21:31 +00:00

More module -> footprint.

This commit is contained in:
Jeff Young 2020-11-13 11:17:15 +00:00
parent 522d64968e
commit 63a54d003e
44 changed files with 513 additions and 488 deletions

View File

@ -287,7 +287,7 @@ void PANEL_PREV_3D::updateOrientation( wxCommandEvent &event )
modelInfo->m_Offset.y = DoubleValueFromString( m_userUnits, yoff->GetValue() ) / IU_PER_MM;
modelInfo->m_Offset.z = DoubleValueFromString( m_userUnits, zoff->GetValue() ) / IU_PER_MM;
// Update the dummy module for the preview
// Update the dummy footprint for the preview
UpdateDummyFootprint( false );
}
}
@ -302,7 +302,7 @@ void PANEL_PREV_3D::onOpacitySlider( wxCommandEvent& event )
modelInfo->m_Opacity = m_opacity->GetValue() / 100.0;
// Update the dummy module for the preview
// Update the dummy footprint for the preview
UpdateDummyFootprint( false );
}
}

View File

@ -27,7 +27,7 @@
* @file panel_prev_model.h
* @brief Defines a panel which is to be added to a wxFileDialog via
* SetExtraControl();
* The panel shows a preview of the module being edited and provides controls
* The panel shows a preview of the footprint being edited and provides controls
* to set the offset/rotation/scale of each model 3d shape as per KiCad's
* current behavior. The panel may also be used in the 3D configuration dialog
* to tune the positioning of the models without invoking a file selector dialog.
@ -201,14 +201,14 @@ public:
CCAMERA& GetCurrentCamera() override { return m_currentCamera; }
/**
* @brief SetModelDataIdx - Sets the currently selected index in the model list so that
* @brief SetSelectedModel - Sets the currently selected index in the model list so that
* the scale/rotation/offset controls can be updated.
*/
void SetSelectedModel( int idx );
/**
* @brief UpdateModelInfoList - copy shapes from the current shape list which are flagged
* for preview to the copy of module that is on the preview dummy board
* @brief UpdateDummyFootprint - copy shapes from the current shape list which are flagged
* for preview to the copy of footprint that is on the preview dummy board
*/
void UpdateDummyFootprint( bool aRelaodRequired = true );
};

View File

@ -108,14 +108,12 @@ class BOARD_ADAPTER
/**
* @brief Is3DLayerEnabled - Check if a layer is enabled
* @param aLayer: layer ID to get status
* @return true if layer should be displayed, false if not
*/
bool Is3DLayerEnabled( PCB_LAYER_ID aLayer ) const;
/**
* @brief ShouldModuleBeDisplayed - Test if module should be displayed in
* relation to attributs and the flags
* @return true if module should be displayed, false if not
* @brief ShouldFPBeDisplayed - Test if footprint should be displayed in relation to
* attributes and the flags
*/
bool ShouldFPBeDisplayed( FOOTPRINT_ATTR_T aFPAttributes ) const;
@ -229,10 +227,10 @@ class BOARD_ADAPTER
}
/**
* @brief GetModulesZcoord3DIU - Get the position of the module in 3d integer units
* @brief GetModulesZcoord3DIU - Get the position of the footprint in 3d integer units
* considering if it is flipped or not.
* @param aIsFlipped: true for use in footprints on Front (top) layer, false
* if module is on back (bottom) layer
* if footprint is on back (bottom) layer
* @return the Z position of 3D shapes, in 3D integer units
*/
float GetModulesZcoord3DIU( bool aIsFlipped ) const ;

View File

@ -1292,7 +1292,7 @@ void C3D_RENDER_OGL_LEGACY::render_3D_models_selected( bool aRenderTopOrBot,
if( ( aRenderTopOrBot && !fp->IsFlipped() )
|| ( !aRenderTopOrBot && fp->IsFlipped() ) )
{
render_3D_module( fp, aRenderTransparentOnly, isIntersected );
render_3D_footprint( fp, aRenderTransparentOnly, isIntersected );
}
}
}
@ -1319,26 +1319,26 @@ void C3D_RENDER_OGL_LEGACY::render_3D_models( bool aRenderTopOrBot,
}
void C3D_RENDER_OGL_LEGACY::render_3D_module( const MODULE* module,
bool aRenderTransparentOnly,
bool aIsSelected )
void C3D_RENDER_OGL_LEGACY::render_3D_footprint( const MODULE* aFootprint,
bool aRenderTransparentOnly,
bool aIsSelected )
{
if( !module->Models().empty() )
if( !aFootprint->Models().empty() )
{
const double zpos = m_boardAdapter.GetModulesZcoord3DIU( module->IsFlipped() );
const double zpos = m_boardAdapter.GetModulesZcoord3DIU( aFootprint->IsFlipped() );
glPushMatrix();
wxPoint pos = module->GetPosition();
wxPoint pos = aFootprint->GetPosition();
glTranslatef( pos.x * m_boardAdapter.BiuTo3Dunits(),
-pos.y * m_boardAdapter.BiuTo3Dunits(),
zpos );
if( module->GetOrientation() )
glRotated( (double) module->GetOrientation() / 10.0, 0.0, 0.0, 1.0 );
if( aFootprint->GetOrientation() )
glRotated((double) aFootprint->GetOrientation() / 10.0, 0.0, 0.0, 1.0 );
if( module->IsFlipped() )
if( aFootprint->IsFlipped() )
{
glRotatef( 180.0f, 0.0f, 1.0f, 0.0f );
glRotatef( 180.0f, 0.0f, 0.0f, 1.0f );
@ -1351,7 +1351,7 @@ void C3D_RENDER_OGL_LEGACY::render_3D_module( const MODULE* module,
modelunit_to_3d_units_factor );
// Get the list of model files for this model
for( const FP_3DMODEL& sM : module->Models() )
for( const FP_3DMODEL& sM : aFootprint->Models() )
{
if( !sM.m_Show || sM.m_Filename.empty() )
continue;
@ -1386,10 +1386,10 @@ void C3D_RENDER_OGL_LEGACY::render_3D_module( const MODULE* module,
if( aRenderTransparentOnly )
modelPtr->Draw_transparent( sM.m_Opacity,
module->IsSelected() || aIsSelected,
aFootprint->IsSelected() || aIsSelected,
m_boardAdapter.m_opengl_selectionColor );
else
modelPtr->Draw_opaque( module->IsSelected() || aIsSelected,
modelPtr->Draw_opaque( aFootprint->IsSelected() || aIsSelected,
m_boardAdapter.m_opengl_selectionColor );
if( m_boardAdapter.GetFlag( FL_RENDER_OPENGL_SHOW_MODEL_BBOX ) )

View File

@ -203,7 +203,7 @@ private:
void render_3D_models_selected( bool aRenderTopOrBot, bool aRenderTransparentOnly, bool aRenderSelectedOnly );
void render_3D_module( const MODULE* module, bool aRenderTransparentOnly, bool aIsSelected );
void render_3D_footprint( const MODULE* aFootprint, bool aRenderTransparentOnly, bool aIsSelected );
void setLight_Front( bool enabled );
void setLight_Top( bool enabled );

View File

@ -106,7 +106,7 @@ int GraphicTextWidth( const wxString& aText, const wxSize& aSize, bool aItalic,
/**
* Function GRText
* Draw a graphic text (like module texts)
* Draw a graphic text (like footprint texts)
* @param aDC = the current Device Context. NULL if draw within a 3D GL Canvas
* @param aPos = text position (according to h_justify, v_justify)
* @param aColor (COLOR4D) = text color

View File

@ -374,8 +374,7 @@ bool LIB_ID::isLegalChar( unsigned aUniChar, LIB_ID_TYPE aType )
if( aUniChar < ' ' )
return false;
// This list of characters is also duplicated in validators.cpp and
// class_module.cpp
// This list of characters is also duplicated in validators.cpp and footprint.cpp
// TODO: Unify forbidden character lists
switch( aUniChar )
{

View File

@ -71,8 +71,8 @@ void GRID_CELL_TEXT_EDITOR::StartingKey( wxKeyEvent& event )
FOOTPRINT_NAME_VALIDATOR::FOOTPRINT_NAME_VALIDATOR( wxString* aValue ) :
wxTextValidator( wxFILTER_EXCLUDE_CHAR_LIST, aValue )
{
// This list of characters follows the string from class_module.cpp
// which, in turn mimics the strings from lib_id.cpp
// This list of characters follows the string from footprint.cpp which, in turn mimics the
// strings from lib_id.cpp
// TODO: Unify forbidden character lists
wxString illegalChars = "%$<>\t\n\r\"\\/:";
SetCharExcludes( illegalChars );

View File

@ -62,7 +62,7 @@ bool NETLIST_EXPORTER_CADSTAR::WriteNetlist( const wxString& aOutFileName, unsig
ret |= fprintf( f, "\"%s\"\n", TO_UTF8( title ) );
ret |= fprintf( f, ".TYP FULL\n\n" );
// Create netlist module section
// Create netlist footprints section
m_ReferencesAlreadyFound.Clear();
SCH_SHEET_LIST sheetList = m_schematic->GetSheets();

View File

@ -60,7 +60,7 @@ bool NETLIST_EXPORTER_ORCADPCB2::WriteNetlist( const wxString& aOutFileName,
ret |= fprintf( f, "( { %s created %s }\n",
NETLIST_HEAD_STRING, TO_UTF8( DateAndTime() ) );
// Create netlist module section
// Create netlist footprints section
m_ReferencesAlreadyFound.Clear();
SCH_SHEET_LIST sheetList = m_schematic->GetSheets();

View File

@ -138,7 +138,7 @@ void BACK_ANNOTATE::getPcbModulesFromString( const std::string& aPayload )
PTREE& tree = doc.get_child( "pcb_netlist" );
wxString msg;
m_pcbModules.clear();
m_pcbFootprints.clear();
for( const std::pair<const std::string, PTREE>& item : tree )
{
@ -184,9 +184,9 @@ void BACK_ANNOTATE::getPcbModulesFromString( const std::string& aPayload )
}
// Use lower_bound for not to iterate over map twice
auto nearestItem = m_pcbModules.lower_bound( path );
auto nearestItem = m_pcbFootprints.lower_bound( path );
if( nearestItem != m_pcbModules.end() && nearestItem->first == path )
if( nearestItem != m_pcbFootprints.end() && nearestItem->first == path )
{
// Module with this path already exists - generate error
msg.Printf( _( "Pcb footprints '%s' and '%s' linked to same symbol." ),
@ -196,9 +196,9 @@ void BACK_ANNOTATE::getPcbModulesFromString( const std::string& aPayload )
}
else
{
// Add module to the map
// Add footprint to the map
auto data = std::make_shared<PCB_FP_DATA>( ref, footprint, value, pinNetMap );
m_pcbModules.insert( nearestItem, std::make_pair( path, data ) );
m_pcbFootprints.insert( nearestItem, std::make_pair( path, data ) );
}
}
}
@ -206,10 +206,10 @@ void BACK_ANNOTATE::getPcbModulesFromString( const std::string& aPayload )
void BACK_ANNOTATE::getChangeList()
{
for( std::pair<const wxString, std::shared_ptr<PCB_FP_DATA>>& module : m_pcbModules )
for( std::pair<const wxString, std::shared_ptr<PCB_FP_DATA>>& fpData : m_pcbFootprints )
{
const wxString& pcbPath = module.first;
auto& pcbData = module.second;
const wxString& pcbPath = fpData.first;
auto& pcbData = fpData.second;
int refIndex;
bool foundInMultiunit = false;
@ -224,7 +224,7 @@ void BACK_ANNOTATE::getChangeList()
if( refIndex >= 0 )
{
// If module linked to multi unit symbol, we add all symbol's units to
// If footprint linked to multi unit symbol, we add all symbol's units to
// the change list
foundInMultiunit = true;

View File

@ -111,7 +111,7 @@ private:
bool m_processNetNames;
bool m_dryRun;
PCB_MODULES_MAP m_pcbModules;
PCB_MODULES_MAP m_pcbFootprints;
SCH_REFERENCE_LIST m_refs;
SCH_MULTI_UNIT_REFERENCE_MAP m_multiUnitsRefs;
std::deque<CHANGELIST_ITEM> m_changelist;

View File

@ -301,11 +301,11 @@ public:
MODULE* CreateNewFootprint( const wxString& aFootprintName );
/**
* Function PlaceModule
* places \a aModule at the current cursor position and updates module coordinates
* Function PlaceFootprint
* places \a aFootprint at the current cursor position and updates footprint coordinates
* with the new position.
*
* @param aRecreateRatsnest A bool true redraws the module rats nest.
* @param aRecreateRatsnest A bool true redraws the footprint ratsnest.
*/
void PlaceFootprint( MODULE* aFootprint, bool aRecreateRatsnest = true );
@ -320,7 +320,7 @@ public:
MODULE* SelectFootprintFromLibTree( LIB_ID aPreselect = LIB_ID() );
/**
* Adds the given module to the board.
* Adds the given footprint to the board.
* @param aFootprint
* @param aDC (can be NULL ) = the current Device Context, to draw the new footprint
*/

View File

@ -52,7 +52,7 @@
/* Bits characterizing cell */
#define CELL_IS_EMPTY 0x00
#define CELL_IS_HOLE 0x01 /* a conducting hole or obstacle */
#define CELL_IS_MODULE 0x02 /* auto placement occupied by a module */
#define CELL_IS_MODULE 0x02 /* auto placement occupied by a footprint */
#define CELL_IS_EDGE 0x20 /* Area and auto-placement: limiting cell contour (Board, Zone) */
#define CELL_IS_FRIEND 0x40 /* Area and auto-placement: cell part of the net */
#define CELL_IS_ZONE 0x80 /* Area and auto-placement: cell available */
@ -542,7 +542,7 @@ unsigned int AR_AUTOPLACER::calculateKeepOutArea( const EDA_RECT& aRect, int sid
}
/* Test if the module can be placed on the board.
/* Test if the footprint can be placed on the board.
* Returns the value TstRectangle().
* Module is known by its bounding box
*/
@ -651,7 +651,7 @@ int AR_AUTOPLACER::getOptimalFPPlacement( MODULE* aFootprint )
if( keepOutCost >= 0 ) // i.e. if the footprint can be put here
{
error = 0;
// m_frame->build_ratsnest_module( aFootprint ); // fixme
// m_frame->build_ratsnest_footprint( aFootprint ); // fixme
curr_cost = computePlacementRatsnestCost( aFootprint, fpOffset );
Score = curr_cost + keepOutCost;
@ -816,9 +816,9 @@ MODULE* AR_AUTOPLACER::pickFootprint( )
sort( fpList.begin(), fpList.end(), sortFootprintsByRatsnestSize );
// Search for "best" module.
MODULE* bestModule = nullptr;
MODULE* altModule = nullptr;
// Search for "best" footprint.
MODULE* bestFootprint = nullptr;
MODULE* altFootprint = nullptr;
for( unsigned ii = 0; ii < fpList.size(); ii++ )
{
@ -827,19 +827,19 @@ MODULE* AR_AUTOPLACER::pickFootprint( )
if( !footprint->NeedsPlaced() )
continue;
altModule = footprint;
altFootprint = footprint;
if( footprint->GetFlag() == 0 )
continue;
bestModule = footprint;
bestFootprint = footprint;
break;
}
if( bestModule )
return bestModule;
if( bestFootprint )
return bestFootprint;
else
return altModule;
return altFootprint;
}
@ -890,7 +890,7 @@ AR_RESULT AR_AUTOPLACER::AutoplaceFootprints( std::vector<MODULE*>& aFootprints,
if( m_matrix.m_GridRouting < Millimeter2iu( 0.25 ) )
m_matrix.m_GridRouting = Millimeter2iu( 0.25 );
// Compute module parameters used in auto place
// Compute footprint parameters used in autoplace
if( genPlacementRoutingMatrix( ) == 0 )
return AR_FAILURE;

View File

@ -532,7 +532,7 @@ void BOARD::SetElementVisibility( GAL_LAYER_ID aLayer, bool isEnabled )
}
bool BOARD::IsModuleLayerVisible( PCB_LAYER_ID aLayer )
bool BOARD::IsFootprintLayerVisible( PCB_LAYER_ID aLayer )
{
switch( aLayer )
{
@ -1109,11 +1109,10 @@ SEARCH_RESULT BOARD::Visit( INSPECTOR inspector, void* testData, const KICAD_T s
++p;
break;
/* Instances of the requested KICAD_T live in a list, either one
* that I manage, or that my footprints manage. If it's a type managed
* by class MODULE, then simply pass it on to each module's
* MODULE::Visit() function by way of the
* IterateForward( m_Modules, ... ) call.
/*
* Instances of the requested KICAD_T live in a list, either one that I manage, or one
* that my footprints manage. If it's a type managed by class FOOTPRINT, then simply
* pass it on to each footprint's Visit() function via IterateForward( m_footprints, ... ).
*/
case PCB_MODULE_T:
@ -1122,7 +1121,7 @@ SEARCH_RESULT BOARD::Visit( INSPECTOR inspector, void* testData, const KICAD_T s
case PCB_FP_SHAPE_T:
case PCB_FP_ZONE_T:
// this calls MODULE::Visit() on each module.
// this calls FOOTPRINT::Visit() on each footprint.
result = IterateForward<MODULE*>( m_footprints, inspector, testData, p );
// skip over any types handled in the above call.
@ -1689,7 +1688,7 @@ MODULE* BOARD::GetFootprint( const wxPoint& aPosition, PCB_LAYER_ID aActiveLayer
PCB_LAYER_ID layer = candidate->GetLayer();
// Filter non visible footprints if requested
if( !aVisibleOnly || IsModuleLayerVisible( layer ) )
if( !aVisibleOnly || IsFootprintLayerVisible( layer ) )
{
EDA_RECT bb = candidate->GetFootprintRect();
@ -1709,7 +1708,7 @@ MODULE* BOARD::GetFootprint( const wxPoint& aPosition, PCB_LAYER_ID aActiveLayer
min_dim = dist;
}
}
else if( aVisibleOnly && IsModuleLayerVisible( layer ) )
else if( aVisibleOnly && IsFootprintLayerVisible( layer ) )
{
if( dist <= alt_min_dim )
{

View File

@ -343,7 +343,7 @@ public:
/**
* Gets the first footprint on the board or nullptr.
* This is used primarily by the footprint editor which knows there is only one.
* @return first module or null pointer
* @return first footprint or null pointer
*/
MODULE* GetFirstFootprint() const
{
@ -546,12 +546,12 @@ public:
void SetElementVisibility( GAL_LAYER_ID aLayer, bool aNewState );
/**
* Expect either of the two layers on which a module can reside, and returns
* Expect either of the two layers on which a footprint can reside, and returns
* whether that layer is visible.
* @param aLayer One of the two allowed layers for footprints: F_Cu or B_Cu
* @return bool - true if the layer is visible, else false.
*/
bool IsModuleLayerVisible( PCB_LAYER_ID aLayer );
bool IsFootprintLayerVisible( PCB_LAYER_ID aLayer );
/**
* @return the BOARD_DESIGN_SETTINGS for this BOARD
@ -1035,18 +1035,17 @@ public:
PAD* GetPad( std::vector<PAD*>& aPadList, const wxPoint& aPosition, LSET aLayerMask );
/**
* Delete a given pad from the BOARD by removing it from its module and
* from the m_NetInfo. Makes no UI calls.
* Delete a given pad from the BOARD by removing it from its footprint and from the
* m_NetInfo. Makes no UI calls.
* @param aPad is the pad to delete.
*/
void PadDelete( PAD* aPad );
/**
* First empties then fills the vector with all pads and sorts them by
* increasing x coordinate, and for increasing y coordinate for same values of x coordinates.
* The vector only holds pointers to the pads and
* those pointers are only references to pads which are owned by the BOARD
* through other links.
* First empties then fills the vector with all pads and sorts them by increasing x
* coordinate, and for increasing y coordinate for same values of x coordinates. The vector
* only holds pointers to the pads and those pointers are only references to pads which are
* owned by the BOARD through other links.
* @param aVector Where to put the pad pointers.
* @param aNetCode = the netcode filter:
* = -1 to build the full pad list.
@ -1082,7 +1081,6 @@ public:
* @param aActiveLayer Layer to test.
* @param aVisibleOnly Search only the visible layers if true.
* @param aIgnoreLocked Ignore locked footprints when true.
* @return MODULE* The best module or NULL if none.
*/
MODULE* GetFootprint( const wxPoint& aPosition, PCB_LAYER_ID aActiveLayer,
bool aVisibleOnly, bool aIgnoreLocked = false );

View File

@ -105,11 +105,11 @@ void BOARD_COMMIT::Push( const wxString& aMessage, bool aCreateUndoEntry, bool a
// Module items need to be saved in the undo buffer before modification
if( m_isFootprintEditor )
{
// Be sure that we are storing a module
// Be sure that we are storing a footprint
if( ent.m_item->Type() != PCB_MODULE_T )
ent.m_item = ent.m_item->GetParent();
// We have not saved the module yet, so let's create an entry
// We have not saved the footprint yet, so let's create an entry
if( savedModules.count( ent.m_item ) == 0 )
{
if( !ent.m_copy )
@ -188,7 +188,7 @@ void BOARD_COMMIT::Push( const wxString& aMessage, bool aCreateUndoEntry, bool a
case PCB_FP_SHAPE_T:
case PCB_FP_TEXT_T:
case PCB_FP_ZONE_T:
// This level can only handle module items when editing footprints
// This level can only handle footprint children when editing footprints
wxASSERT( m_isFootprintEditor );
if( boardItem->Type() == PCB_FP_TEXT_T )
@ -204,9 +204,9 @@ void BOARD_COMMIT::Push( const wxString& aMessage, bool aCreateUndoEntry, bool a
if( !( changeFlags & CHT_DONE ) )
{
MODULE* module = static_cast<MODULE*>( boardItem->GetParent() );
wxASSERT( module && module->Type() == PCB_MODULE_T );
module->Delete( boardItem );
MODULE* footprint = static_cast<MODULE*>( boardItem->GetParent() );
wxASSERT( footprint && footprint->Type() == PCB_MODULE_T );
footprint->Delete( boardItem );
}
break;
@ -233,15 +233,15 @@ void BOARD_COMMIT::Push( const wxString& aMessage, bool aCreateUndoEntry, bool a
case PCB_MODULE_T:
{
// There are no footprints inside a module yet
// No support for nested footprints (yet)
wxASSERT( !m_isFootprintEditor );
MODULE* module = static_cast<MODULE*>( boardItem );
view->Remove( module );
module->ClearFlags();
MODULE* footprint = static_cast<MODULE*>( boardItem );
view->Remove( footprint );
footprint->ClearFlags();
if( !( changeFlags & CHT_DONE ) )
board->Remove( module ); // handles connectivity
board->Remove( footprint ); // handles connectivity
}
break;

View File

@ -601,7 +601,7 @@ bool DIALOG_BOARD_REANNOTATE::ReannotateBoard()
RefDesChange* newref;
NETLIST netlist;
if( !BuildModuleList( BadRefDes ) )
if( !BuildFootprintList( BadRefDes ) )
{
ShowReport( "Selected options resulted in errors! Change them and try again.",
RPT_SEVERITY_ERROR );
@ -664,41 +664,41 @@ bool DIALOG_BOARD_REANNOTATE::ReannotateBoard()
} //If updating schematic
bool reannotateok = payload.size( ) == 0;
bool reannotateOk = payload.size( ) == 0;
ShowReport( payload, reannotateok ? RPT_SEVERITY_ACTION : RPT_SEVERITY_ERROR );
ShowReport( payload, reannotateOk ? RPT_SEVERITY_ACTION : RPT_SEVERITY_ERROR );
BOARD_COMMIT commit( m_frame );
if( reannotateok )
{ //Only update if no errors
if( reannotateOk )//Only update if no errors
{
for( MODULE* mod : m_footprints )
{ // Create a netlist
newref = GetNewRefDes( mod );
for( MODULE* footprint : m_footprints )
{
newref = GetNewRefDes( footprint );
if( nullptr == newref )
return false;
commit.Modify( mod ); //Make a copy for undo
mod->SetReference( newref->NewRefDes ); //Update the PCB reference
m_frame->GetCanvas()->GetView()->Update( mod ); //Touch the module
commit.Modify( footprint ); // Make a copy for undo
footprint->SetReference( newref->NewRefDes ); // Update the PCB reference
m_frame->GetCanvas()->GetView()->Update( footprint ); // Touch the footprint
}
}
commit.Push( "Geographic reannotation" );
return reannotateok;
return reannotateOk;
}
//
/// Build the module lists, sort it, filter for excludes, then build the change list
/// Build the footprint lists, sort it, filter for excludes, then build the change list
/// @returns true if success, false if errors
bool DIALOG_BOARD_REANNOTATE::BuildModuleList( std::vector<RefDesInfo>& aBadRefDes )
bool DIALOG_BOARD_REANNOTATE::BuildFootprintList( std::vector<RefDesInfo>& aBadRefDes )
{
bool annotateselected;
bool annotatefront = m_AnnotateFront->GetValue(); //Unless only doing back
bool annotateback = m_AnnotateBack->GetValue(); //Unless only doing front
bool skiplocked = m_ExcludeLocked->GetValue();
bool annotateSelected;
bool annotateFront = m_AnnotateFront->GetValue(); //Unless only doing back
bool annotateBack = m_AnnotateBack->GetValue(); //Unless only doing front
bool skipLocked = m_ExcludeLocked->GetValue();
int errorcount = 0;
unsigned int backstartrefdes;
@ -721,7 +721,7 @@ bool DIALOG_BOARD_REANNOTATE::BuildModuleList( std::vector<RefDesInfo>& aBadRefD
}
}
annotateselected = !selected.empty();
annotateSelected = !selected.empty();
wxString exclude;
@ -740,70 +740,72 @@ bool DIALOG_BOARD_REANNOTATE::BuildModuleList( std::vector<RefDesInfo>& aBadRefD
m_excludeArray.push_back( exclude );
}
RefDesInfo thismodule;
RefDesInfo fpData;
bool useModuleLocation = m_locationChoice->GetSelection() == 0;
for( MODULE* mod : m_footprints )
for( MODULE* footprint : m_footprints )
{
thismodule.Uuid = mod->m_Uuid;
thismodule.RefDesString = mod->GetReference();
thismodule.FPID = mod->GetFPID();
thismodule.x = useModuleLocation ? mod->GetPosition().x
: 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.Front = mod->GetLayer() == F_Cu;
thismodule.Action = UpdateRefDes; //Usually good
fpData.Uuid = footprint->m_Uuid;
fpData.RefDesString = footprint->GetReference();
fpData.FPID = footprint->GetFPID();
fpData.x = useModuleLocation ? footprint->GetPosition().x
: footprint->Reference().GetPosition().x;
fpData.y = useModuleLocation ? footprint->GetPosition().y
: footprint->Reference().GetPosition().y;
fpData.roundedx = RoundToGrid( fpData.x, m_sortGridx ); //Round to sort
fpData.roundedy = RoundToGrid( fpData.y, m_sortGridy );
fpData.Front = footprint->GetLayer() == F_Cu;
fpData.Action = UpdateRefDes; //Usually good
if( thismodule.RefDesString.IsEmpty() )
thismodule.Action = EmptyRefDes;
if( fpData.RefDesString.IsEmpty() )
{
fpData.Action = EmptyRefDes;
}
else
{
firstnum = thismodule.RefDesString.find_first_of( "0123456789" );
firstnum = fpData.RefDesString.find_first_of( "0123456789" );
if( std::string::npos == firstnum )
thismodule.Action = InvalidRefDes; //do not change ref des such as 12 or +1, or L
fpData.Action = InvalidRefDes; //do not change ref des such as 12 or +1, or L
}
//Get the type (R, C, etc)
thismodule.RefDesType = thismodule.RefDesString.substr( 0, firstnum );
fpData.RefDesType = fpData.RefDesString.substr( 0, firstnum );
for( wxString excluded : m_excludeArray )
{
if( excluded == thismodule.RefDesType ) //Am I supposed to exclude this type?
if( excluded == fpData.RefDesType ) //Am I supposed to exclude this type?
{
thismodule.Action = Exclude; //Yes
fpData.Action = Exclude; //Yes
break;
}
}
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
if(( fpData.Front && annotateBack ) || // If a front module and doing backs only
( !fpData.Front && annotateFront ) || // If a back module and doing front only
( footprint->IsLocked() && skipLocked ) ) // If excluding locked and it is locked
{
thismodule.Action = Exclude;
fpData.Action = Exclude;
}
if( annotateselected )
{ //If onnly annotating selected c
thismodule.Action = Exclude; //Assume it isn't selected
if( annotateSelected )
{ // If onnly annotating selected c
fpData.Action = Exclude; // Assume it isn't selected
for( KIID sel : selected )
{
if( thismodule.Uuid == sel )
{ //Found in selected footprints
thismodule.Action = UpdateRefDes; //Update it
if( fpData.Uuid == sel )
{ // Found in selected footprints
fpData.Action = UpdateRefDes; // Update it
break;
}
}
}
if( thismodule.Front )
m_frontFootprints.push_back( thismodule );
if( fpData.Front )
m_frontFootprints.push_back( fpData );
else
m_backFootprints.push_back( thismodule );
m_backFootprints.push_back( fpData );
}
SetSortCodes( FrontDirectionsArray, m_sortCode ); //Determine the sort order for the front
@ -865,7 +867,7 @@ bool DIALOG_BOARD_REANNOTATE::BuildModuleList( std::vector<RefDesInfo>& aBadRefD
//
/// Scan through the module arrays and create the from -> to array
/// Scan through the footprint arrays and create the from -> to array
void DIALOG_BOARD_REANNOTATE::BuildChangeArray( std::vector<RefDesInfo>& aFootprints,
unsigned int aStartRefDes, wxString aPrefix,
bool aRemovePrefix,
@ -894,44 +896,44 @@ void DIALOG_BOARD_REANNOTATE::BuildChangeArray( std::vector<RefDesInfo>& aFootpr
m_refDesTypes[i].RefDesCount = aStartRefDes;
}
for( RefDesInfo footprint : aFootprints )
{ //For each module
change.Uuid = footprint.Uuid;
change.Action = footprint.Action;
change.OldRefDesString = footprint.RefDesString;
change.NewRefDes = footprint.RefDesString;
change.Front = footprint.Front;
for( RefDesInfo fpData : aFootprints )
{
change.Uuid = fpData.Uuid;
change.Action = fpData.Action;
change.OldRefDesString = fpData.RefDesString;
change.NewRefDes = fpData.RefDesString;
change.Front = fpData.Front;
if( footprint.RefDesString.IsEmpty() )
footprint.Action = EmptyRefDes;
if( fpData.RefDesString.IsEmpty() )
fpData.Action = EmptyRefDes;
if( ( change.Action == EmptyRefDes ) || ( change.Action == InvalidRefDes ) )
{
m_changeArray.push_back( change );
aBadRefDes.push_back( footprint );
aBadRefDes.push_back( fpData );
continue;
}
if( change.Action == UpdateRefDes )
{
refdestype = footprint.RefDesType;
prefixpresent = ( 0 == footprint.RefDesType.find( aPrefix ) );
refdestype = fpData.RefDesType;
prefixpresent = ( 0 == fpData.RefDesType.find( aPrefix ) );
if( addprefix && !prefixpresent )
footprint.RefDesType.insert( 0, aPrefix ); //Add prefix once only
fpData.RefDesType.insert( 0, aPrefix ); //Add prefix once only
if( aRemovePrefix && prefixpresent ) //If there is a prefix remove it
footprint.RefDesType.erase( 0, prefixsize );
fpData.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!
if( m_refDesTypes[i].RefDesType == fpData.RefDesType ) //Found it!
break;
}
if( i == m_refDesTypes.size() )
{ //Wasn't in the types array so add it
newtype.RefDesType = footprint.RefDesType;
newtype.RefDesType = fpData.RefDesType;
newtype.RefDesCount = ( aStartRefDes == 0 ? 1 : aStartRefDes );
m_refDesTypes.push_back( newtype );
}

View File

@ -176,7 +176,7 @@ private:
void LogChangePlan( void );
bool ReannotateBoard( void );
bool BuildModuleList( std::vector<RefDesInfo>& aBadRefDes );
bool BuildFootprintList( std::vector<RefDesInfo>& aBadRefDes );
void BuildChangeArray( std::vector<RefDesInfo>& aFootprints, unsigned int aStartRefDes,
wxString aPrefix, bool aRemovePrefix,
std::vector<RefDesInfo>& aBadRefDes );

View File

@ -175,7 +175,7 @@ bool DIALOG_COPPER_ZONE::TransferDataToWindow()
}
// Do not enable/disable antipad clearance and spoke width. They might be needed if
// a module or pad overrides the zone to specify a thermal connection.
// a footprint or pad overrides the zone to specify a thermal connection.
m_antipadClearance.SetValue( m_settings.m_ThermalReliefGap );
m_spokeWidth.SetValue( m_settings.m_ThermalReliefSpokeWidth );

View File

@ -545,7 +545,7 @@ bool DIALOG_FOOTPRINT_FP_EDITOR::Validate()
if( !DIALOG_SHIM::Validate() )
return false;
// First, test for invalid chars in module name
// First, test for invalid chars in footprint name
wxString footprintName = m_FootprintNameCtrl->GetValue();
if( !checkFootprintName( footprintName ) )
@ -703,7 +703,7 @@ bool DIALOG_FOOTPRINT_FP_EDITOR::TransferDataFromWindow()
m_footprint->CalculateBoundingBox();
commit.Push( _( "Modify module properties" ) );
commit.Push( _( "Modify footprint properties" ) );
return true;
}

View File

@ -1469,7 +1469,7 @@ void DIALOG_NET_INSPECTOR::buildNetsList()
}
// count the pads for each net. since the nets are sorted by netcode
// iterating over the modules' pads is faster.
// iterating over the footprints' pads is faster.
for( MODULE* footprint : m_brd->Footprints() )
{

View File

@ -249,16 +249,16 @@ bool DIALOG_TEXT_PROPERTIES::TransferDataToWindow()
if( m_item->Type() == PCB_FP_TEXT_T && m_fpText )
{
MODULE* module = dynamic_cast<MODULE*>( m_fpText->GetParent() );
MODULE* footprint = dynamic_cast<MODULE*>( m_fpText->GetParent() );
wxString msg;
if( module )
if( footprint )
{
msg.Printf( _("Footprint %s (%s), %s, rotated %.1f deg"),
module->GetReference(),
module->GetValue(),
module->IsFlipped() ? _( "back side (mirrored)" ) : _( "front side" ),
module->GetOrientation() / 10.0 );
msg.Printf( _( "Footprint %s (%s), %s, rotated %.1f deg"),
footprint->GetReference(),
footprint->GetValue(),
footprint->IsFlipped() ? _( "back side (mirrored)" ) : _( "front side" ),
footprint->GetOrientation() / 10.0 );
}
m_statusLine->SetLabel( msg );

View File

@ -659,12 +659,12 @@ void DRC_ENGINE::RunTests( EDA_UNITS aUnits, bool aReportAllTrackErrors, bool aT
for( ZONE* zone : m_board->Zones() )
zone->CacheBoundingBox();
for( MODULE* module : m_board->Footprints() )
for( MODULE* footprint : m_board->Footprints() )
{
for( ZONE* zone : module->Zones() )
for( ZONE* zone : footprint->Zones() )
zone->CacheBoundingBox();
module->BuildPolyCourtyards();
footprint->BuildPolyCourtyards();
}
for( DRC_TEST_PROVIDER* provider : m_testProviders )

View File

@ -23,7 +23,7 @@
/*
* 1 - create ascii/csv files for automatic placement of smd components
* 2 - create a module report (pos and module descr) (ascii file)
* 2 - create a footprint report (pos and footprint descr) (ascii file)
*/
#include <kicad_string.h>
@ -35,7 +35,7 @@
class LIST_MOD // An helper class used to build a list of useful footprints.
{
public:
MODULE* m_Module; // Link to the actual footprint
MODULE* m_Footprint; // Link to the actual footprint
wxString m_Reference; // Its schematic reference
wxString m_Value; // Its schematic value
LAYER_NUM m_Layer; // its side (B_Cu, or F_Cu)
@ -132,7 +132,7 @@ std::string PLACE_FILE_EXPORTER::GenPositionData()
m_fpCount++;
LIST_MOD item;
item.m_Module = footprint;
item.m_Footprint = footprint;
item.m_Reference = footprint->Reference().GetShownText();
item.m_Value = footprint->Value().GetShownText();
item.m_Layer = footprint->GetLayer();
@ -140,7 +140,7 @@ std::string PLACE_FILE_EXPORTER::GenPositionData()
lenRefText = std::max( lenRefText, (int) item.m_Reference.length() );
lenValText = std::max( lenValText, (int) item.m_Value.length() );
lenPkgText = std::max( lenPkgText, (int) item.m_Module->GetFPID().GetLibItemName().length() );
lenPkgText = std::max( lenPkgText, (int) item.m_Footprint->GetFPID().GetLibItemName().length() );
}
if( list.size() > 1 )
@ -162,10 +162,10 @@ std::string PLACE_FILE_EXPORTER::GenPositionData()
for( int ii = 0; ii < m_fpCount; ii++ )
{
wxPoint footprint_pos;
footprint_pos = list[ii].m_Module->GetPosition();
footprint_pos = list[ii].m_Footprint->GetPosition();
footprint_pos -= m_place_Offset;
LAYER_NUM layer = list[ii].m_Module->GetLayer();
LAYER_NUM layer = list[ii].m_Footprint->GetLayer();
wxASSERT( layer == F_Cu || layer == B_Cu );
if( layer == B_Cu )
@ -175,7 +175,7 @@ std::string PLACE_FILE_EXPORTER::GenPositionData()
tmp << "\"" << csv_sep;
tmp << "\"" << list[ii].m_Value;
tmp << "\"" << csv_sep;
tmp << "\"" << list[ii].m_Module->GetFPID().GetLibItemName().wx_str();
tmp << "\"" << list[ii].m_Footprint->GetFPID().GetLibItemName().wx_str();
tmp << "\"" << csv_sep;
tmp << wxString::Format( "%f%c%f%c%f",
@ -183,7 +183,7 @@ std::string PLACE_FILE_EXPORTER::GenPositionData()
// Keep the Y axis oriented from bottom to top,
// ( change y coordinate sign )
-footprint_pos.y * conv_unit, csv_sep,
list[ii].m_Module->GetOrientation() / 10.0 );
list[ii].m_Footprint->GetOrientation() / 10.0 );
tmp << csv_sep;
tmp << ( (layer == F_Cu ) ? PLACE_FILE_EXPORTER::GetFrontSideName()
@ -228,10 +228,10 @@ std::string PLACE_FILE_EXPORTER::GenPositionData()
for( int ii = 0; ii < m_fpCount; ii++ )
{
wxPoint footprint_pos;
footprint_pos = list[ii].m_Module->GetPosition();
footprint_pos = list[ii].m_Footprint->GetPosition();
footprint_pos -= m_place_Offset;
LAYER_NUM layer = list[ii].m_Module->GetLayer();
LAYER_NUM layer = list[ii].m_Footprint->GetLayer();
wxASSERT( layer == F_Cu || layer == B_Cu );
if( layer == B_Cu )
@ -239,7 +239,7 @@ std::string PLACE_FILE_EXPORTER::GenPositionData()
wxString ref = list[ii].m_Reference;
wxString val = list[ii].m_Value;
wxString pkg = list[ii].m_Module->GetFPID().GetLibItemName();
wxString pkg = list[ii].m_Footprint->GetFPID().GetLibItemName();
ref.Replace( wxT( " " ), wxT( "_" ) );
val.Replace( wxT( " " ), wxT( "_" ) );
pkg.Replace( wxT( " " ), wxT( "_" ) );
@ -251,7 +251,7 @@ std::string PLACE_FILE_EXPORTER::GenPositionData()
// Keep the coordinates in the first quadrant,
// (i.e. change y sign
-footprint_pos.y * conv_unit,
list[ii].m_Module->GetOrientation() / 10.0,
list[ii].m_Footprint->GetOrientation() / 10.0,
(layer == F_Cu ) ? GetFrontSideName().c_str() : GetBackSideName().c_str() );
buffer += line;
}

Some files were not shown because too many files have changed in this diff Show More