diff --git a/include/board_design_settings.h b/include/board_design_settings.h index 2921a66d45..5ef628295c 100644 --- a/include/board_design_settings.h +++ b/include/board_design_settings.h @@ -304,9 +304,9 @@ public: // when importing values or creating a new pad // Set to true if the board has a stackup management. - // If not set a default basic stackup witll be used to generate the ;gbrjob file. + // If not set a default basic stackup will be used to generate the gbrjob file. // Could be removed later, or at least always set to true - bool m_HasStackup; + bool m_HasStackup; private: // Indicies into the trackWidth, viaSizes and diffPairDimensions lists. diff --git a/pcbnew/microwave/microwave_inductor.cpp b/pcbnew/microwave/microwave_inductor.cpp index 14dadb2449..9783f38272 100644 --- a/pcbnew/microwave/microwave_inductor.cpp +++ b/pcbnew/microwave/microwave_inductor.cpp @@ -313,7 +313,7 @@ void MICROWAVE_TOOL::createInductorBetween( const VECTOR2I& aStart, const VECTOR } else { - // at this point, we can save the module + // at this point, we can save the footprint m_toolMgr->RunAction( PCB_ACTIONS::selectItem, true, inductorFP.get() ); BOARD_COMMIT commit( this ); diff --git a/pcbnew/netinfo.h b/pcbnew/netinfo.h index a1867e8d39..df93e24adb 100644 --- a/pcbnew/netinfo.h +++ b/pcbnew/netinfo.h @@ -54,7 +54,7 @@ class PCB_BASE_FRAME; #define CH_UNROUTABLE 2 /* Don't use autorouter. */ #define CH_ROUTE_REQ 4 /* Must be routed by the autorouter. */ #define CH_ACTIF 8 /* Not routed. */ -#define LOCAL_RATSNEST_ITEM 0x8000 /* Line between two pads of a single module. */ +#define LOCAL_RATSNEST_ITEM 0x8000 /* Line between two pads of a single footprint. */ DECL_VEC_FOR_SWIG( PADS_VEC, PAD* ) diff --git a/pcbnew/plugins/kicad/kicad_plugin.cpp b/pcbnew/plugins/kicad/kicad_plugin.cpp index 2173c82ad4..39b71d846a 100644 --- a/pcbnew/plugins/kicad/kicad_plugin.cpp +++ b/pcbnew/plugins/kicad/kicad_plugin.cpp @@ -85,7 +85,7 @@ class FP_CACHE PCB_IO* m_owner; // Plugin object that owns the cache. wxFileName m_lib_path; // The path of the library. wxString m_lib_raw_path; // For quick comparisons. - FOOTPRINT_MAP m_modules; // Map of footprint file name per FOOTPRINT*. + FOOTPRINT_MAP m_footprints; // Map of footprint filename to FOOTPRINT*. bool m_cache_dirty; // Stored separately because it's expensive to check // m_cache_timestamp against all the files. @@ -101,16 +101,16 @@ public: bool Exists() const { return m_lib_path.IsOk() && m_lib_path.DirExists(); } - FOOTPRINT_MAP& GetFootprints() { return m_modules; } + FOOTPRINT_MAP& GetFootprints() { return m_footprints; } // Most all functions in this class throw IO_ERROR exceptions. There are no // error codes nor user interface calls from here, nor in any PLUGIN. // Catch these exceptions higher up please. /** - * Save the footprint cache or a single module from it to disk + * Save the footprint cache or a single footprint from it to disk * - * @param aFootprint if set, save only this module, otherwise, save the full library + * @param aFootprint if set, save only this footprint, otherwise, save the full library */ void Save( FOOTPRINT* aFootprint = NULL ); @@ -171,7 +171,7 @@ void FP_CACHE::Save( FOOTPRINT* aFootprint ) m_lib_raw_path ) ); } - for( FOOTPRINT_MAP::iterator it = m_modules.begin(); it != m_modules.end(); ++it ) + for( FOOTPRINT_MAP::iterator it = m_footprints.begin(); it != m_footprints.end(); ++it ) { if( aFootprint && aFootprint != it->second->GetModule() ) continue; @@ -263,7 +263,7 @@ void FP_CACHE::Load() wxString fpName = fn.GetName(); footprint->SetFPID( LIB_ID( wxEmptyString, fpName ) ); - m_modules.insert( fpName, new FP_CACHE_ITEM( footprint, fn ) ); + m_footprints.insert( fpName, new FP_CACHE_ITEM( footprint, fn ) ); m_cache_timestamp += fn.GetTimestamp(); } @@ -284,9 +284,9 @@ void FP_CACHE::Load() void FP_CACHE::Remove( const wxString& aFootprintName ) { - FOOTPRINT_MAP::const_iterator it = m_modules.find( aFootprintName ); + FOOTPRINT_MAP::const_iterator it = m_footprints.find( aFootprintName ); - if( it == m_modules.end() ) + if( it == m_footprints.end() ) { wxString msg = wxString::Format( _( "library \"%s\" has no footprint \"%s\" to delete" ), m_lib_raw_path, @@ -296,7 +296,7 @@ void FP_CACHE::Remove( const wxString& aFootprintName ) // Remove the module from the cache and delete the module file from the library. wxString fullPath = it->second->GetFileName().GetFullPath(); - m_modules.erase( aFootprintName ); + m_footprints.erase( aFootprintName ); wxRemoveFile( fullPath ); } @@ -640,7 +640,7 @@ void PCB_IO::format( BOARD* aBoard, int aNestLevel ) const m_out->Print( 0, "\n" ); } - // Save the graphical items on the board (not owned by a module) + // Save the graphical items on the board (not owned by a footprint) for( BOARD_ITEM* item : sorted_drawings ) Format( item, aNestLevel ); diff --git a/pcbnew/plugins/kicad/kicad_plugin.h b/pcbnew/plugins/kicad/kicad_plugin.h index 6192371d08..f4ba8a1a84 100644 --- a/pcbnew/plugins/kicad/kicad_plugin.h +++ b/pcbnew/plugins/kicad/kicad_plugin.h @@ -73,7 +73,7 @@ class PCB_TEXT; //#define SEXPR_BOARD_FILE_VERSION 20200614 // Add support for fp_rects and gr_rects //#define SEXPR_BOARD_FILE_VERSION 20200625 // Multilayer zones, zone names, island controls //#define SEXPR_BOARD_FILE_VERSION 20200628 // remove visibility settings -//#define SEXPR_BOARD_FILE_VERSION 20200724 // Add KIID to module components +//#define SEXPR_BOARD_FILE_VERSION 20200724 // Add KIID to footprints //#define SEXPR_BOARD_FILE_VERSION 20200807 // Add zone hatch advanced settings //#define SEXPR_BOARD_FILE_VERSION 20200808 // Add properties to footprints //#define SEXPR_BOARD_FILE_VERSION 20200809 // Add REMOVE_UNUSED_LAYERS option to vias and THT pads diff --git a/pcbnew/plugins/kicad/pcb_parser.h b/pcbnew/plugins/kicad/pcb_parser.h index 7bfae35139..a747a99006 100644 --- a/pcbnew/plugins/kicad/pcb_parser.h +++ b/pcbnew/plugins/kicad/pcb_parser.h @@ -163,7 +163,7 @@ class PCB_PARSER : public PCB_LEXER /** * Function parseFOOTPRINT_unchecked - * Parse a module, but do not replace PARSE_ERROR with FUTURE_FORMAT_ERROR automatically. + * Parse a footprint, but do not replace PARSE_ERROR with FUTURE_FORMAT_ERROR automatically. */ FOOTPRINT* parseFOOTPRINT_unchecked( wxArrayString* aInitialComments = 0 ); FP_TEXT* parseFP_TEXT(); @@ -182,7 +182,7 @@ class PCB_PARSER : public PCB_LEXER /** * Function parseBOARD_unchecked - * Parse a module, but do not replace PARSE_ERROR with FUTURE_FORMAT_ERROR automatically. + * Parse a board, but do not replace PARSE_ERROR with FUTURE_FORMAT_ERROR automatically. */ BOARD* parseBOARD_unchecked(); diff --git a/pcbnew/plugins/legacy/legacy_plugin.cpp b/pcbnew/plugins/legacy/legacy_plugin.cpp index 375aa1bcc7..f4f396b037 100644 --- a/pcbnew/plugins/legacy/legacy_plugin.cpp +++ b/pcbnew/plugins/legacy/legacy_plugin.cpp @@ -1284,7 +1284,7 @@ void LEGACY_PLUGIN::loadFOOTPRINT( FOOTPRINT* aFootprint ) aFootprint->SetPlacementCost90((itmp1 << 4) | cntRot90 ); } - else if( TESTLINE( "At" ) ) // (At)tributes of module + else if( TESTLINE( "At" ) ) // (At)tributes of footprint { int attrs = 0; @@ -1607,8 +1607,8 @@ void LEGACY_PLUGIN::loadPAD( FOOTPRINT* aFootprint ) else if( TESTLINE( "$EndPAD" ) ) { - // pad's "Position" is not relative to the module's, - // whereas Pos0 is relative to the module's but is the unrotated coordinate. + // pad's "Position" is not relative to the footprint's, whereas Pos0 is relative + // to the footprint's but is the unrotated coordinate. wxPoint padpos = pad->GetPos0(); @@ -1754,7 +1754,7 @@ void LEGACY_PLUGIN::loadFP_SHAPE( FOOTPRINT* aFootprint ) aFootprint->Add( fpShape ); // this had been done at the FOOTPRINT level before, presumably because the FP_SHAPE needs - // to be already added to a module before this function will work. + // to be already added to a footprint before this function will work. fpShape->SetDrawCoord(); } diff --git a/pcbnew/plugins/pcad/CMakeLists.txt b/pcbnew/plugins/pcad/CMakeLists.txt index bb8a5b4b01..eb3412dc77 100644 --- a/pcbnew/plugins/pcad/CMakeLists.txt +++ b/pcbnew/plugins/pcad/CMakeLists.txt @@ -16,7 +16,7 @@ set( PCAD2PCBNEW_SRCS pcb_cutout.cpp pcb_keepout.cpp pcb_line.cpp - pcb_module.cpp + pcb_footprint.cpp pcb_net.cpp pcb_pad.cpp pcb_pad_shape.cpp diff --git a/pcbnew/plugins/pcad/pcb.cpp b/pcbnew/plugins/pcad/pcb.cpp index bb578141ff..05c347558f 100644 --- a/pcbnew/plugins/pcad/pcb.cpp +++ b/pcbnew/plugins/pcad/pcb.cpp @@ -3,7 +3,7 @@ * * Copyright (C) 2007, 2008 Lubo Racko * Copyright (C) 2007, 2008, 2012-2013 Alexander Lunev - * Copyright (C) 2012 KiCad Developers, see CHANGELOG.TXT for contributors. + * Copyright (C) 2012-2020 KiCad Developers, see CHANGELOG.TXT for contributors. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -32,14 +32,8 @@ #include #include -#include -#include -#include #include -#include -#include -#include -#include +#include #include #include #include @@ -49,9 +43,9 @@ namespace PCAD2KICAD { PCB_LAYER_ID PCB::GetKiCadLayer( int aPCadLayer ) { - auto it = m_layersMap.find( aPCadLayer ); + auto it = m_LayersMap.find( aPCadLayer ); - if( it == m_layersMap.end() ) + if( it == m_LayersMap.end() ) THROW_IO_ERROR( wxString::Format( _( "Unknown PCad layer %u" ), unsigned( aPCadLayer ) ) ); return it->second.KiCadLayer; @@ -59,9 +53,9 @@ PCB_LAYER_ID PCB::GetKiCadLayer( int aPCadLayer ) LAYER_TYPE_T PCB::GetLayerType( int aPCadLayer ) { - auto it = m_layersMap.find( aPCadLayer ); + auto it = m_LayersMap.find( aPCadLayer ); - if( it == m_layersMap.end() ) + if( it == m_LayersMap.end() ) THROW_IO_ERROR( wxString::Format( _( "Unknown PCad layer %u" ), unsigned( aPCadLayer ) ) ); return it->second.layerType; @@ -69,17 +63,18 @@ LAYER_TYPE_T PCB::GetLayerType( int aPCadLayer ) wxString PCB::GetLayerNetNameRef( int aPCadLayer ) { - auto it = m_layersMap.find( aPCadLayer ); + auto it = m_LayersMap.find( aPCadLayer ); - if( it == m_layersMap.end() ) + if( it == m_LayersMap.end() ) THROW_IO_ERROR( wxString::Format( _( "Unknown PCad layer %u" ), unsigned( aPCadLayer ) ) ); return it->second.netNameRef; } -PCB::PCB( BOARD* aBoard ) : PCB_MODULE( this, aBoard ) +PCB::PCB( BOARD* aBoard ) : + PCB_FOOTPRINT( this, aBoard ) { - m_defaultMeasurementUnit = wxT( "mil" ); + m_DefaultMeasurementUnit = wxT( "mil" ); for( size_t i = 0; i < 8; ++i ) { @@ -88,21 +83,21 @@ PCB::PCB( BOARD* aBoard ) : PCB_MODULE( this, aBoard ) layer.layerType = LAYER_TYPE_NONSIGNAL; // default layer.netNameRef = wxT( "" ); // default - m_layersMap.insert( std::make_pair( i, layer ) ); + m_LayersMap.insert( std::make_pair( i, layer ) ); } - m_sizeX = 0; - m_sizeY = 0; + m_SizeX = 0; + m_SizeY = 0; - m_layersMap[1].KiCadLayer = F_Cu; - m_layersMap[1].layerType = LAYER_TYPE_SIGNAL; + m_LayersMap[1].KiCadLayer = F_Cu; + m_LayersMap[1].layerType = LAYER_TYPE_SIGNAL; - m_layersMap[2].KiCadLayer = B_Cu; - m_layersMap[2].layerType = LAYER_TYPE_SIGNAL; + m_LayersMap[2].KiCadLayer = B_Cu; + m_LayersMap[2].layerType = LAYER_TYPE_SIGNAL; - m_layersMap[3].KiCadLayer = Eco2_User; - m_layersMap[6].KiCadLayer = F_SilkS; - m_layersMap[7].KiCadLayer = B_SilkS; + m_LayersMap[3].KiCadLayer = Eco2_User; + m_LayersMap[6].KiCadLayer = F_SilkS; + m_LayersMap[7].KiCadLayer = B_SilkS; } @@ -110,14 +105,14 @@ PCB::~PCB() { int i; - for( i = 0; i < (int) m_pcbComponents.GetCount(); i++ ) + for( i = 0; i < (int) m_PcbComponents.GetCount(); i++ ) { - delete m_pcbComponents[i]; + delete m_PcbComponents[i]; } - for( i = 0; i < (int) m_pcbNetlist.GetCount(); i++ ) + for( i = 0; i < (int) m_PcbNetlist.GetCount(); i++ ) { - delete m_pcbNetlist[i]; + delete m_PcbNetlist[i]; } } @@ -126,13 +121,13 @@ int PCB::GetNetCode( wxString aNetName ) { PCB_NET* net; - for( int i = 0; i < (int) m_pcbNetlist.GetCount(); i++ ) + for( int i = 0; i < (int) m_PcbNetlist.GetCount(); i++ ) { - net = m_pcbNetlist[i]; + net = m_PcbNetlist[i]; - if( net->m_name == aNetName ) + if( net->m_Name == aNetName ) { - return net->m_netCode; + return net->m_NetCode; } } @@ -234,7 +229,7 @@ void PCB::SetTextProperty( XNODE* aNode, TTEXTVALUE* aTextValue, } if( tNode ) - SetTextParameters( tNode, aTextValue, m_defaultMeasurementUnit, aActualConversion ); + SetTextParameters( tNode, aTextValue, m_DefaultMeasurementUnit, aActualConversion ); } @@ -243,18 +238,18 @@ void PCB::DoPCBComponents( XNODE* aNode, const wxString& aActualConversion, wxStatusBar* aStatusBar ) { - XNODE* lNode, * tNode, * mNode; - PCB_MODULE* mc; - PCB_PAD* pad; - PCB_VIA* via; - PCB_KEEPOUT* keepOut; - wxString cn, str, propValue; + XNODE* lNode, * tNode, * mNode; + PCB_FOOTPRINT* fp; + PCB_PAD* pad; + PCB_VIA* via; + PCB_KEEPOUT* keepOut; + wxString cn, str, propValue; lNode = aNode->GetChildren(); while( lNode ) { - mc = NULL; + fp = NULL; if( lNode->GetName() == wxT( "pattern" ) ) { @@ -269,38 +264,37 @@ void PCB::DoPCBComponents( XNODE* aNode, if( tNode ) { - mc = new PCB_MODULE( this, m_board ); + fp = new PCB_FOOTPRINT( this, m_board ); mNode = FindNode( lNode, wxT( "patternGraphicsNameRef" ) ); if( mNode ) - mNode->GetAttribute( wxT( "Name" ), &mc->m_patGraphRefName ); + mNode->GetAttribute( wxT( "Name" ), &fp->m_patGraphRefName ); - mc->Parse( tNode, aStatusBar, m_defaultMeasurementUnit, aActualConversion ); + fp->Parse( tNode, aStatusBar, m_DefaultMeasurementUnit, aActualConversion ); } } - if( mc ) + if( fp ) { - mc->m_compRef = cn; // default - in new version of file it is updated later.... + fp->m_compRef = cn; // default - in new version of file it is updated later.... tNode = FindNode( lNode, wxT( "refDesRef" ) ); if( tNode ) { - tNode->GetAttribute( wxT( "Name" ), &mc->m_name.text ); - SetTextProperty( lNode, &mc->m_name, mc->m_patGraphRefName, wxT( - "RefDes" ), aActualConversion ); - SetTextProperty( lNode, &mc->m_value, mc->m_patGraphRefName, wxT( - "Value" ), aActualConversion ); + tNode->GetAttribute( wxT( "Name" ), &fp->m_name.text ); + SetTextProperty( lNode, &fp->m_name, fp->m_patGraphRefName, wxT( "RefDes" ), + aActualConversion ); + SetTextProperty( lNode, &fp->m_Value, fp->m_patGraphRefName, wxT( "Value" ), + aActualConversion ); } tNode = FindNode( lNode, wxT( "pt" ) ); if( tNode ) - SetPosition( tNode->GetNodeContent(), - m_defaultMeasurementUnit, - &mc->m_positionX, - &mc->m_positionY, - aActualConversion ); + { + SetPosition( tNode->GetNodeContent(), m_DefaultMeasurementUnit, + &fp->m_positionX, &fp->m_positionY, aActualConversion ); + } tNode = FindNode( lNode, wxT( "rotation" ) ); @@ -308,13 +302,13 @@ void PCB::DoPCBComponents( XNODE* aNode, { str = tNode->GetNodeContent(); str.Trim( false ); - mc->m_rotation = StrToInt1Units( str ); + fp->m_rotation = StrToInt1Units( str ); } str = FindNodeGetContent( lNode, wxT( "isFlipped" ) ); if( str == wxT( "True" ) ) - mc->m_mirror = 1; + fp->m_Mirror = 1; tNode = aNode; @@ -331,24 +325,24 @@ void PCB::DoPCBComponents( XNODE* aNode, { tNode->GetAttribute( wxT( "Name" ), &propValue ); - if( propValue == mc->m_name.text ) + if( propValue == fp->m_name.text ) { if( FindNode( tNode, wxT( "compValue" ) ) ) { FindNode( tNode, wxT( "compValue" ) )->GetAttribute( wxT( "Name" ), - &mc->m_value.text ); - mc->m_value.text.Trim( false ); - mc->m_value.text.Trim( true ); + &fp->m_Value.text ); + fp->m_Value.text.Trim( false ); + fp->m_Value.text.Trim( true ); } if( FindNode( tNode, wxT( "compRef" ) ) ) { FindNode( tNode, wxT( "compRef" ) )->GetAttribute( wxT( "Name" ), - &mc->m_compRef ); - mc->m_compRef.Trim( false ); - mc->m_compRef.Trim( true ); + &fp->m_compRef ); + fp->m_compRef.Trim( false ); + fp->m_compRef.Trim( true ); } tNode = NULL; @@ -360,7 +354,7 @@ void PCB::DoPCBComponents( XNODE* aNode, // map pins tNode = FindNode( (XNODE *)aXmlDoc->GetRoot(), wxT( "library" ) ); - tNode = FindCompDefName( tNode, mc->m_compRef ); + tNode = FindCompDefName( tNode, fp->m_compRef ); if( tNode ) { @@ -381,7 +375,7 @@ void PCB::DoPCBComponents( XNODE* aNode, break; mNode->GetAttribute( wxT( "Name" ), &propValue ); - mc->SetName( str, propValue ); + fp->SetName( str, propValue ); mNode = mNode->GetNext(); } else @@ -397,27 +391,27 @@ void PCB::DoPCBComponents( XNODE* aNode, } } - m_pcbComponents.Add( mc ); + m_PcbComponents.Add( fp ); } } else if( lNode->GetName() == wxT( "pad" ) ) { pad = new PCB_PAD( this, m_board ); - pad->Parse( lNode, m_defaultMeasurementUnit, aActualConversion ); - m_pcbComponents.Add( pad ); + pad->Parse( lNode, m_DefaultMeasurementUnit, aActualConversion ); + m_PcbComponents.Add( pad ); } else if( lNode->GetName() == wxT( "via" ) ) { via = new PCB_VIA( this, m_board ); - via->Parse( lNode, m_defaultMeasurementUnit, aActualConversion ); - m_pcbComponents.Add( via ); + via->Parse( lNode, m_DefaultMeasurementUnit, aActualConversion ); + m_PcbComponents.Add( via ); } else if( lNode->GetName() == wxT( "polyKeepOut" ) ) { keepOut = new PCB_KEEPOUT( m_callbacks, m_board, 0 ); - if( keepOut->Parse( lNode, m_defaultMeasurementUnit, aActualConversion ) ) - m_pcbComponents.Add( keepOut ); + if( keepOut->Parse( lNode, m_DefaultMeasurementUnit, aActualConversion ) ) + m_PcbComponents.Add( keepOut ); else delete keepOut; } @@ -427,25 +421,24 @@ void PCB::DoPCBComponents( XNODE* aNode, } -void PCB::ConnectPinToNet( const wxString& aCompRef, - const wxString& aPinRef, +void PCB::ConnectPinToNet( const wxString& aCompRef, const wxString& aPinRef, const wxString& aNetName ) { - PCB_MODULE* module; - PCB_PAD* cp; - int i, j; + PCB_FOOTPRINT* footprint; + PCB_PAD* cp; + int i, j; - for( i = 0; i < (int) m_pcbComponents.GetCount(); i++ ) + for( i = 0; i < (int) m_PcbComponents.GetCount(); i++ ) { - module = (PCB_MODULE*) m_pcbComponents[i]; + footprint = (PCB_FOOTPRINT*) m_PcbComponents[i]; - if( module->m_objType == wxT( 'M' ) && module->m_name.text == aCompRef ) + if( footprint->m_objType == wxT( 'M' ) && footprint->m_name.text == aCompRef ) { - for( j = 0; j < (int) module->m_moduleObjects.GetCount(); j++ ) + for( j = 0; j < (int) footprint->m_FootprintItems.GetCount(); j++ ) { - if( module->m_moduleObjects[j]->m_objType == wxT( 'P' ) ) + if( footprint->m_FootprintItems[j]->m_objType == wxT( 'P' ) ) { - cp = (PCB_PAD*) module->m_moduleObjects[j]; + cp = (PCB_PAD*) footprint->m_FootprintItems[j]; if( cp->m_name.text == aPinRef ) cp->m_net = aNetName; @@ -552,12 +545,12 @@ void PCB::MapLayer( XNODE* aNode ) newlayer.layerType = LAYER_TYPE_PLANE; } - m_layersMap.insert( std::make_pair( num, newlayer ) ); + m_LayersMap.insert( std::make_pair( num, newlayer ) ); if( FindNode( aNode, wxT( "netNameRef" ) ) ) { FindNode( aNode, wxT( "netNameRef" ) )->GetAttribute( wxT( "Name" ), - &m_layersMap[(int) num].netNameRef ); + &m_LayersMap[(int) num].netNameRef ); } } @@ -621,11 +614,11 @@ void PCB::GetBoardOutline( wxXmlDocument* aXmlDoc, const wxString& aActualConver if( pNode ) { - SetPosition( pNode->GetNodeContent(), m_defaultMeasurementUnit, + SetPosition( pNode->GetNodeContent(), m_DefaultMeasurementUnit, &x, &y, aActualConversion ); - if( FindOutlinePoint( &m_boardOutline, wxRealPoint( x, y) ) == -1 ) - m_boardOutline.Add( new wxRealPoint( x, y ) ); + if( FindOutlinePoint( &m_BoardOutline, wxRealPoint( x, y) ) == -1 ) + m_BoardOutline.Add( new wxRealPoint( x, y ) ); } if( pNode ) @@ -633,11 +626,11 @@ void PCB::GetBoardOutline( wxXmlDocument* aXmlDoc, const wxString& aActualConver if( pNode ) { - SetPosition( pNode->GetNodeContent(), m_defaultMeasurementUnit, + SetPosition( pNode->GetNodeContent(), m_DefaultMeasurementUnit, &x, &y, aActualConversion ); - if( FindOutlinePoint( &m_boardOutline, wxRealPoint( x, y) ) == -1 ) - m_boardOutline.Add( new wxRealPoint( x, y ) ); + if( FindOutlinePoint( &m_BoardOutline, wxRealPoint( x, y) ) == -1 ) + m_BoardOutline.Add( new wxRealPoint( x, y ) ); } } @@ -646,16 +639,16 @@ void PCB::GetBoardOutline( wxXmlDocument* aXmlDoc, const wxString& aActualConver //m_boardOutline.Sort( cmpFunc ); // sort vertices according to the distances between them - if( m_boardOutline.GetCount() > 3 ) + if( m_BoardOutline.GetCount() > 3 ) { - for( i = 0; i < (int) m_boardOutline.GetCount() - 1; i++ ) + for( i = 0; i < (int) m_BoardOutline.GetCount() - 1; i++ ) { - minDistance = GetDistance( m_boardOutline[i], m_boardOutline[i + 1] ); + minDistance = GetDistance( m_BoardOutline[i], m_BoardOutline[ i + 1] ); targetInd = i + 1; - for( j = i + 2; j < (int) m_boardOutline.GetCount(); j++ ) + for( j = i + 2; j < (int) m_BoardOutline.GetCount(); j++ ) { - distance = GetDistance( m_boardOutline[i], m_boardOutline[j] ); + distance = GetDistance( m_BoardOutline[i], m_BoardOutline[j] ); if( distance < minDistance ) { minDistance = distance; @@ -663,9 +656,9 @@ void PCB::GetBoardOutline( wxXmlDocument* aXmlDoc, const wxString& aActualConver } } - xchgPoint = m_boardOutline[i + 1]; - m_boardOutline[i + 1] = m_boardOutline[targetInd]; - m_boardOutline[targetInd] = xchgPoint; + xchgPoint = m_BoardOutline[ i + 1]; + m_BoardOutline[ i + 1] = m_BoardOutline[targetInd]; + m_BoardOutline[targetInd] = xchgPoint; } } @@ -683,7 +676,7 @@ void PCB::ParseBoard( wxStatusBar* aStatusBar, wxXmlDocument* aXmlDoc, const wxS XNODE* aNode;//, *aaNode; PCB_NET* net; PCB_COMPONENT* comp; - PCB_MODULE* module; + PCB_FOOTPRINT* footprint; wxString compRef, pinRef, layerName, layerType; int i, j, netCode; @@ -696,9 +689,9 @@ void PCB::ParseBoard( wxStatusBar* aStatusBar, wxXmlDocument* aXmlDoc, const wxS if( aNode ) { - m_defaultMeasurementUnit = aNode->GetNodeContent().Lower(); - m_defaultMeasurementUnit.Trim( true ); - m_defaultMeasurementUnit.Trim( false ); + m_DefaultMeasurementUnit = aNode->GetNodeContent().Lower(); + m_DefaultMeasurementUnit.Trim( true ); + m_DefaultMeasurementUnit.Trim( false ); } } @@ -793,7 +786,7 @@ void PCB::ParseBoard( wxStatusBar* aStatusBar, wxXmlDocument* aXmlDoc, const wxS { net = new PCB_NET( netCode++ ); net->Parse( aNode ); - m_pcbNetlist.Add( net ); + m_PcbNetlist.Add( net ); aNode = aNode->GetNext(); } @@ -817,8 +810,8 @@ void PCB::ParseBoard( wxStatusBar* aStatusBar, wxXmlDocument* aXmlDoc, const wxS // objects if( aNode->GetName() == wxT( "layerContents" ) ) - DoLayerContentsObjects( aNode, NULL, &m_pcbComponents, aStatusBar, - m_defaultMeasurementUnit, aActualConversion ); + DoLayerContentsObjects( aNode, NULL, &m_PcbComponents, aStatusBar, + m_DefaultMeasurementUnit, aActualConversion ); aNode = aNode->GetNext(); } @@ -826,78 +819,78 @@ void PCB::ParseBoard( wxStatusBar* aStatusBar, wxXmlDocument* aXmlDoc, const wxS // POSTPROCESS -- SET NETLIST REFERENCES // aStatusBar->SetStatusText( wxT( "Processing NETLIST " ) ); - for( i = 0; i < (int) m_pcbNetlist.GetCount(); i++ ) + for( i = 0; i < (int) m_PcbNetlist.GetCount(); i++ ) { - net = m_pcbNetlist[i]; + net = m_PcbNetlist[i]; - for( j = 0; j < (int) net->m_netNodes.GetCount(); j++ ) + for( j = 0; j < (int) net->m_NetNodes.GetCount(); j++ ) { - compRef = net->m_netNodes[j]->m_compRef; + compRef = net->m_NetNodes[j]->m_CompRef; compRef.Trim( false ); compRef.Trim( true ); - pinRef = net->m_netNodes[j]->m_pinRef; + pinRef = net->m_NetNodes[j]->m_PinRef; pinRef.Trim( false ); pinRef.Trim( true ); - ConnectPinToNet( compRef, pinRef, net->m_name ); + ConnectPinToNet( compRef, pinRef, net->m_Name ); } } // POSTPROCESS -- FLIP COMPONENTS - for( i = 0; i < (int) m_pcbComponents.GetCount(); i++ ) + for( i = 0; i < (int) m_PcbComponents.GetCount(); i++ ) { - if( m_pcbComponents[i]->m_objType == wxT( 'M' ) ) - ( (PCB_MODULE*) m_pcbComponents[i] )->Flip(); + if( m_PcbComponents[i]->m_objType == wxT( 'M' ) ) + ( (PCB_FOOTPRINT*) m_PcbComponents[i] )->Flip(); } // POSTPROCESS -- SET/OPTIMIZE NEW PCB POSITION // aStatusBar->SetStatusText( wxT( "Optimizing BOARD POSITION " ) ); - m_sizeX = 10000000; - m_sizeY = 0; + m_SizeX = 10000000; + m_SizeY = 0; - for( i = 0; i < (int) m_pcbComponents.GetCount(); i++ ) + for( i = 0; i < (int) m_PcbComponents.GetCount(); i++ ) { - comp = m_pcbComponents[i]; + comp = m_PcbComponents[i]; - if( comp->m_positionY < m_sizeY ) - m_sizeY = comp->m_positionY; // max Y + if( comp->m_positionY < m_SizeY ) + m_SizeY = comp->m_positionY; // max Y - if( comp->m_positionX < m_sizeX && comp->m_positionX > 0 ) - m_sizeX = comp->m_positionX; // Min X + if( comp->m_positionX < m_SizeX && comp->m_positionX > 0 ) + m_SizeX = comp->m_positionX; // Min X } - m_sizeY -= 10000; - m_sizeX -= 10000; + m_SizeY -= 10000; + m_SizeX -= 10000; // aStatusBar->SetStatusText( wxT( " POSITIONING POSTPROCESS " ) ); - for( i = 0; i < (int) m_pcbComponents.GetCount(); i++ ) - m_pcbComponents[i]->SetPosOffset( -m_sizeX, -m_sizeY ); + for( i = 0; i < (int) m_PcbComponents.GetCount(); i++ ) + m_PcbComponents[i]->SetPosOffset( -m_SizeX, -m_SizeY ); - m_sizeX = 0; - m_sizeY = 0; + m_SizeX = 0; + m_SizeY = 0; - for( i = 0; i < (int) m_pcbComponents.GetCount(); i++ ) + for( i = 0; i < (int) m_PcbComponents.GetCount(); i++ ) { - comp = m_pcbComponents[i]; + comp = m_PcbComponents[i]; - if( comp->m_positionY < m_sizeY ) - m_sizeY = comp->m_positionY; // max Y + if( comp->m_positionY < m_SizeY ) + m_SizeY = comp->m_positionY; // max Y - if( comp->m_positionX > m_sizeX ) - m_sizeX = comp->m_positionX; // Min X + if( comp->m_positionX > m_SizeX ) + m_SizeX = comp->m_positionX; // Min X } // SHEET SIZE CALCULATION - m_sizeY = -m_sizeY; // it is in absolute units - m_sizeX += 10000; - m_sizeY += 10000; + m_SizeY = -m_SizeY; // it is in absolute units + m_SizeX += 10000; + m_SizeY += 10000; // A4 is minimum $Descr A4 11700 8267 - if( m_sizeX < 11700 ) - m_sizeX = 11700; + if( m_SizeX < 11700 ) + m_SizeX = 11700; - if( m_sizeY < 8267 ) - m_sizeY = 8267; + if( m_SizeY < 8267 ) + m_SizeY = 8267; } else { @@ -916,10 +909,10 @@ void PCB::ParseBoard( wxStatusBar* aStatusBar, wxXmlDocument* aXmlDoc, const wxS if( aNode->GetName() == wxT( "compDef" ) ) { - module = new PCB_MODULE( this, m_board ); - module->Parse( aNode, aStatusBar, m_defaultMeasurementUnit, - aActualConversion ); - m_pcbComponents.Add( module ); + footprint = new PCB_FOOTPRINT( this, m_board ); + footprint->Parse( aNode, aStatusBar, m_DefaultMeasurementUnit, + aActualConversion ); + m_PcbComponents.Add( footprint ); } aNode = aNode->GetNext(); @@ -936,16 +929,16 @@ void PCB::AddToBoard() m_board->SetCopperLayerCount( m_layersStackup.GetCount() ); - for( i = 0; i < (int) m_pcbNetlist.GetCount(); i++ ) + for( i = 0; i < (int) m_PcbNetlist.GetCount(); i++ ) { - net = m_pcbNetlist[i]; + net = m_PcbNetlist[i]; - m_board->Add( new NETINFO_ITEM( m_board, net->m_name, net->m_netCode ) ); + m_board->Add( new NETINFO_ITEM( m_board, net->m_Name, net->m_NetCode ) ); } - for( i = 0; i < (int) m_pcbComponents.GetCount(); i++ ) + for( i = 0; i < (int) m_PcbComponents.GetCount(); i++ ) { - m_pcbComponents[i]->AddToBoard(); + m_PcbComponents[i]->AddToBoard(); } } diff --git a/pcbnew/plugins/pcad/pcb.h b/pcbnew/plugins/pcad/pcb.h index 4990df6a99..cfaf2d4bd9 100644 --- a/pcbnew/plugins/pcad/pcb.h +++ b/pcbnew/plugins/pcad/pcb.h @@ -3,7 +3,7 @@ * * Copyright (C) 2007, 2008 Lubo Racko * Copyright (C) 2007, 2008, 2012-2013 Alexander Lunev - * Copyright (C) 2012 KiCad Developers, see CHANGELOG.TXT for contributors. + * Copyright (C) 2012-2020 KiCad Developers, see CHANGELOG.TXT for contributors. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -34,57 +34,52 @@ #include #include -#include +#include #include namespace PCAD2KICAD { -class PCB : public PCB_MODULE, public PCB_CALLBACKS +class PCB : public PCB_FOOTPRINT, public PCB_CALLBACKS { public: - PCB_COMPONENTS_ARRAY m_pcbComponents; // PCB footprints,Lines,Routes,Texts, .... and so on - PCB_NETS_ARRAY m_pcbNetlist; // net objects collection - wxString m_defaultMeasurementUnit; - std::map m_layersMap; // flexible layers mapping - int m_sizeX; - int m_sizeY; + PCB_COMPONENTS_ARRAY m_PcbComponents; // PCB footprints,Lines,Routes,Texts, .... and so on + PCB_NETS_ARRAY m_PcbNetlist; // net objects collection + wxString m_DefaultMeasurementUnit; + std::map m_LayersMap; // flexible layers mapping + int m_SizeX; + int m_SizeY; PCB( BOARD* aBoard ); ~PCB(); - PCB_LAYER_ID GetKiCadLayer( int aPCadLayer ) override; - LAYER_TYPE_T GetLayerType( int aPCadLayer ) override; - wxString GetLayerNetNameRef( int aPCadLayer ) override; - int GetNetCode( wxString aNetName ) override; + PCB_LAYER_ID GetKiCadLayer( int aPCadLayer ) override; + LAYER_TYPE_T GetLayerType( int aPCadLayer ) override; + wxString GetLayerNetNameRef( int aPCadLayer ) override; + int GetNetCode( wxString aNetName ) override; - void ParseBoard( wxStatusBar* aStatusBar, - wxXmlDocument* aXmlDoc, - const wxString& aActualConversion ); + void ParseBoard( wxStatusBar* aStatusBar, wxXmlDocument* aXmlDoc, + const wxString& aActualConversion ); - void AddToBoard() override; + void AddToBoard() override; private: wxArrayString m_layersStackup; - XNODE* FindCompDefName( XNODE* aNode, const wxString& aName ); - void SetTextProperty( XNODE* aNode, - TTEXTVALUE* aTextValue, - const wxString& aPatGraphRefName, - const wxString& aXmlName, - const wxString& aActualConversion ); - void DoPCBComponents( XNODE* aNode, - wxXmlDocument* aXmlDoc, - const wxString& aActualConversion, - wxStatusBar* aStatusBar ); - void ConnectPinToNet( const wxString& aCr, - const wxString& aPr, - const wxString& aNetName ); - int FindLayer( const wxString& aLayerName ); - void MapLayer( XNODE* aNode ); - int FindOutlinePoint( VERTICES_ARRAY* aOutline, wxRealPoint aPoint ); - double GetDistance( wxRealPoint* aPoint1, wxRealPoint* aPoint2 ); - void GetBoardOutline( wxXmlDocument* aXmlDoc, - const wxString& aActualConversion ); + XNODE* FindCompDefName( XNODE* aNode, const wxString& aName ); + + void SetTextProperty( XNODE* aNode, TTEXTVALUE* aTextValue, const wxString& aPatGraphRefName, + const wxString& aXmlName, const wxString& aActualConversion ); + + void DoPCBComponents( XNODE* aNode, wxXmlDocument* aXmlDoc, const wxString& aActualConversion, + wxStatusBar* aStatusBar ); + + void ConnectPinToNet( const wxString& aCr, const wxString& aPr, const wxString& aNetName ); + + int FindLayer( const wxString& aLayerName ); + void MapLayer( XNODE* aNode ); + int FindOutlinePoint( VERTICES_ARRAY* aOutline, wxRealPoint aPoint ); + double GetDistance( wxRealPoint* aPoint1, wxRealPoint* aPoint2 ); + void GetBoardOutline( wxXmlDocument* aXmlDoc, const wxString& aActualConversion ); }; } // namespace PCAD2KICAD diff --git a/pcbnew/plugins/pcad/pcb_module.cpp b/pcbnew/plugins/pcad/pcb_footprint.cpp similarity index 76% rename from pcbnew/plugins/pcad/pcb_module.cpp rename to pcbnew/plugins/pcad/pcb_footprint.cpp index de42e3b6f3..069a761f82 100644 --- a/pcbnew/plugins/pcad/pcb_module.cpp +++ b/pcbnew/plugins/pcad/pcb_footprint.cpp @@ -30,7 +30,7 @@ #include #include #include -#include +#include #include #include #include @@ -40,28 +40,28 @@ namespace PCAD2KICAD { -PCB_MODULE::PCB_MODULE( PCB_CALLBACKS* aCallbacks, BOARD* aBoard ) : +PCB_FOOTPRINT::PCB_FOOTPRINT( PCB_CALLBACKS* aCallbacks, BOARD* aBoard ) : PCB_COMPONENT( aCallbacks, aBoard ) { - InitTTextValue( &m_value ); - m_mirror = 0; + InitTTextValue( &m_Value ); + m_Mirror = 0; m_objType = wxT( 'M' ); // FOOTPRINT m_KiCadLayer = F_SilkS; // default } -PCB_MODULE::~PCB_MODULE() +PCB_FOOTPRINT::~PCB_FOOTPRINT() { int i; - for( i = 0; i < (int) m_moduleObjects.GetCount(); i++ ) + for( i = 0; i < (int) m_FootprintItems.GetCount(); i++ ) { - delete m_moduleObjects[i]; + delete m_FootprintItems[i]; } } -XNODE* PCB_MODULE::FindModulePatternDefName( XNODE* aNode, const wxString& aName ) +XNODE* PCB_FOOTPRINT::FindModulePatternDefName( XNODE* aNode, const wxString& aName ) { XNODE* result, * lNode; wxString propValue1, propValue2; @@ -115,7 +115,7 @@ XNODE* PCB_MODULE::FindModulePatternDefName( XNODE* aNode, const wxString& aName } -XNODE* PCB_MODULE::FindPatternMultilayerSection( XNODE* aNode, wxString* aPatGraphRefName ) +XNODE* PCB_FOOTPRINT::FindPatternMultilayerSection( XNODE* aNode, wxString* aPatGraphRefName ) { XNODE* result, * pNode, * lNode; wxString propValue, patName; @@ -207,12 +207,12 @@ XNODE* PCB_MODULE::FindPatternMultilayerSection( XNODE* aNode, wxString* aPatGra } -void PCB_MODULE::DoLayerContentsObjects( XNODE* aNode, - PCB_MODULE* aPCBModule, - PCB_COMPONENTS_ARRAY* aList, - wxStatusBar* aStatusBar, - const wxString& aDefaultMeasurementUnit, - const wxString& aActualConversion ) +void PCB_FOOTPRINT::DoLayerContentsObjects( XNODE* aNode, + PCB_FOOTPRINT* aFootprint, + PCB_COMPONENTS_ARRAY* aList, + wxStatusBar* aStatusBar, + const wxString& aDefaultMeasurementUnit, + const wxString& aActualConversion ) { PCB_ARC* arc; PCB_POLYGON* polygon; @@ -240,7 +240,7 @@ void PCB_MODULE::DoLayerContentsObjects( XNODE* aNode, { plane_layer = new PCB_POLYGON( m_callbacks, m_board, PCadLayer ); plane_layer->AssignNet( m_callbacks->GetLayerNetNameRef( PCadLayer ) ); - plane_layer->SetOutline( &m_boardOutline ); + plane_layer->SetOutline( &m_BoardOutline ); aList->Add( plane_layer ); // fill the polygon with the same contour as its outline is @@ -281,7 +281,7 @@ void PCB_MODULE::DoLayerContentsObjects( XNODE* aNode, { tNode = FindNode( lNode, wxT( "textStyleRef" ) ); - if( tNode && aPCBModule ) + if( tNode && aFootprint ) { // TODO: to understand and may be repair // Alexander Lunev: originally in Delphi version of the project there was @@ -291,7 +291,7 @@ void PCB_MODULE::DoLayerContentsObjects( XNODE* aNode, // required when the function DoLayerContentsObjects() is called from // function ProcessXMLtoPCBLib(). SetFontProperty( tNode, - &aPCBModule->m_name, + &aFootprint->m_name, aDefaultMeasurementUnit, aActualConversion ); } @@ -362,27 +362,27 @@ void PCB_MODULE::DoLayerContentsObjects( XNODE* aNode, } -void PCB_MODULE::SetName( const wxString& aPin, const wxString& aName ) +void PCB_FOOTPRINT::SetName( const wxString& aPin, const wxString& aName ) { int i; long num; aPin.ToLong( &num ); - for( i = 0; i < (int) m_moduleObjects.GetCount(); i++ ) + for( i = 0; i < (int) m_FootprintItems.GetCount(); i++ ) { - if( m_moduleObjects[i]->m_objType == wxT( 'P' ) ) - if( ( (PCB_PAD*) m_moduleObjects[i] )->m_number == num ) - ( (PCB_PAD*) m_moduleObjects[i] )->m_name.text = aName; + if( m_FootprintItems[i]->m_objType == wxT( 'P' ) ) + if(( (PCB_PAD*) m_FootprintItems[i] )->m_Number == num ) + ( (PCB_PAD*) m_FootprintItems[i] )->m_name.text = aName; } } -void PCB_MODULE::Parse( XNODE* aNode, wxStatusBar* aStatusBar, - const wxString& aDefaultMeasurementUnit, - const wxString& aActualConversion ) +void PCB_FOOTPRINT::Parse( XNODE* aNode, wxStatusBar* aStatusBar, + const wxString& aDefaultMeasurementUnit, + const wxString& aActualConversion ) { XNODE* lNode, * tNode, * mNode; PCB_PAD* pad; @@ -409,14 +409,14 @@ void PCB_MODULE::Parse( XNODE* aNode, wxStatusBar* aStatusBar, { pad = new PCB_PAD( m_callbacks, m_board ); pad->Parse( tNode, aDefaultMeasurementUnit, aActualConversion ); - m_moduleObjects.Add( pad ); + m_FootprintItems.Add( pad ); } if( tNode->GetName() == wxT( "via" ) ) { via = new PCB_VIA( m_callbacks, m_board ); via->Parse( tNode, aDefaultMeasurementUnit, aActualConversion ); - m_moduleObjects.Add( via ); + m_FootprintItems.Add( via ); } tNode = tNode->GetNext(); @@ -432,7 +432,7 @@ void PCB_MODULE::Parse( XNODE* aNode, wxStatusBar* aStatusBar, while( lNode ) { if( lNode->GetName() == wxT( "layerContents" ) ) - DoLayerContentsObjects( lNode, this, &m_moduleObjects, aStatusBar, + DoLayerContentsObjects( lNode, this, &m_FootprintItems, aStatusBar, aDefaultMeasurementUnit, aActualConversion ); lNode = lNode->GetNext(); @@ -473,7 +473,7 @@ void PCB_MODULE::Parse( XNODE* aNode, wxStatusBar* aStatusBar, } -wxString PCB_MODULE::ModuleLayer( int aMirror ) +wxString PCB_FOOTPRINT::ModuleLayer( int aMirror ) { wxString result; @@ -490,7 +490,7 @@ wxString PCB_MODULE::ModuleLayer( int aMirror ) } -void PCB_MODULE::AddToBoard() +void PCB_FOOTPRINT::AddToBoard() { int i; int r; @@ -499,23 +499,23 @@ void PCB_MODULE::AddToBoard() CorrectTextPosition( &m_name ); RotatePoint( &m_name.correctedPositionX, &m_name.correctedPositionY, (double) -m_rotation ); - CorrectTextPosition( &m_value ); - RotatePoint( &m_value.correctedPositionX, &m_value.correctedPositionY, (double) -m_rotation ); + CorrectTextPosition( &m_Value ); + RotatePoint( &m_Value.correctedPositionX, &m_Value.correctedPositionY, (double) -m_rotation ); - FOOTPRINT* module = new FOOTPRINT( m_board ); - m_board->Add( module, ADD_MODE::APPEND ); + FOOTPRINT* footprint = new FOOTPRINT( m_board ); + m_board->Add( footprint, ADD_MODE::APPEND ); - module->SetPosition( wxPoint( m_positionX, m_positionY ) ); - module->SetLayer( m_mirror ? B_Cu : F_Cu ); - module->SetOrientation( m_rotation ); - module->SetLastEditTime( 0 ); + footprint->SetPosition( wxPoint( m_positionX, m_positionY ) ); + footprint->SetLayer( m_Mirror ? B_Cu : F_Cu ); + footprint->SetOrientation( m_rotation ); + footprint->SetLastEditTime( 0 ); LIB_ID fpID; fpID.Parse( m_compRef, LIB_ID::ID_PCB, true ); - module->SetFPID( fpID ); + footprint->SetFPID( fpID ); // reference text - FP_TEXT* ref_text = &module->Reference(); + FP_TEXT* ref_text = &footprint->Reference(); ref_text->SetText( ValidateReference( m_name.text ) ); ref_text->SetType( FP_TEXT::TEXT_is_REFERENCE ); @@ -542,98 +542,98 @@ void PCB_MODULE::AddToBoard() ref_text->SetDrawCoord(); // value text - FP_TEXT* val_text = &module->Value(); + FP_TEXT* val_text = &footprint->Value(); - val_text->SetText( m_value.text ); + val_text->SetText( m_Value.text ); val_text->SetType( FP_TEXT::TEXT_is_VALUE ); - val_text->SetPos0( wxPoint( m_value.correctedPositionX, m_value.correctedPositionY ) ); - if( m_value.isTrueType ) - SetTextSizeFromTrueTypeFontHeight( val_text, m_value.textHeight ); + val_text->SetPos0( wxPoint( m_Value.correctedPositionX, m_Value.correctedPositionY ) ); + if( m_Value.isTrueType ) + SetTextSizeFromTrueTypeFontHeight( val_text, m_Value.textHeight ); else - SetTextSizeFromStrokeFontHeight( val_text, m_value.textHeight ); + SetTextSizeFromStrokeFontHeight( val_text, m_Value.textHeight ); - r = m_value.textRotation - m_rotation; + r = m_Value.textRotation - m_rotation; val_text->SetTextAngle( r ); val_text->SetKeepUpright( false ); - val_text->SetItalic( m_value.isItalic ); - val_text->SetTextThickness( m_value.textstrokeWidth ); + val_text->SetItalic( m_Value.isItalic ); + val_text->SetTextThickness( m_Value.textstrokeWidth ); - val_text->SetMirrored( m_value.mirror ); - val_text->SetVisible( m_value.textIsVisible ); + val_text->SetMirrored( m_Value.mirror ); + val_text->SetVisible( m_Value.textIsVisible ); - val_text->SetLayer( m_value.mirror ? FlipLayer( m_KiCadLayer ) : m_KiCadLayer ); + val_text->SetLayer( m_Value.mirror ? FlipLayer( m_KiCadLayer ) : m_KiCadLayer ); // Calculate the actual position. val_text->SetDrawCoord(); // TEXTS - for( i = 0; i < (int) m_moduleObjects.GetCount(); i++ ) + for( i = 0; i < (int) m_FootprintItems.GetCount(); i++ ) { - if( m_moduleObjects[i]->m_objType == wxT( 'T' ) ) + if( m_FootprintItems[i]->m_objType == wxT( 'T' ) ) { - ( (PCB_TEXT*) m_moduleObjects[i] )->m_tag = i + 2; - m_moduleObjects[ i ]->AddToFootprint( module ); + ( (PCB_TEXT*) m_FootprintItems[i] )->m_tag = i + 2; + m_FootprintItems[ i ]->AddToFootprint( footprint ); } } // FOOTPRINT LINES - for( i = 0; i < (int) m_moduleObjects.GetCount(); i++ ) + for( i = 0; i < (int) m_FootprintItems.GetCount(); i++ ) { - if( m_moduleObjects[i]->m_objType == wxT( 'L' ) ) - m_moduleObjects[ i ]->AddToFootprint( module ); + if( m_FootprintItems[i]->m_objType == wxT( 'L' ) ) + m_FootprintItems[ i ]->AddToFootprint( footprint ); } // FOOTPRINT ARCS - for( i = 0; i < (int) m_moduleObjects.GetCount(); i++ ) + for( i = 0; i < (int) m_FootprintItems.GetCount(); i++ ) { - if( m_moduleObjects[i]->m_objType == wxT( 'A' ) ) - m_moduleObjects[ i ]->AddToFootprint( module ); + if( m_FootprintItems[i]->m_objType == wxT( 'A' ) ) + m_FootprintItems[ i ]->AddToFootprint( footprint ); } // FOOTPRINT POLYGONS - for( i = 0; i < (int) m_moduleObjects.GetCount(); i++ ) + for( i = 0; i < (int) m_FootprintItems.GetCount(); i++ ) { - if( m_moduleObjects[i]->m_objType == wxT( 'Z' ) ) - m_moduleObjects[ i ]->AddToFootprint( module ); + if( m_FootprintItems[i]->m_objType == wxT( 'Z' ) ) + m_FootprintItems[ i ]->AddToFootprint( footprint ); } // PADS - for( i = 0; i < (int) m_moduleObjects.GetCount(); i++ ) + for( i = 0; i < (int) m_FootprintItems.GetCount(); i++ ) { - if( m_moduleObjects[i]->m_objType == wxT( 'P' ) ) - ((PCB_PAD*) m_moduleObjects[ i ] )->AddToFootprint( module, m_rotation, false ); + if( m_FootprintItems[i]->m_objType == wxT( 'P' ) ) + ((PCB_PAD*) m_FootprintItems[ i ] )->AddToFootprint( footprint, m_rotation, false ); } // VIAS - for( i = 0; i < (int) m_moduleObjects.GetCount(); i++ ) + for( i = 0; i < (int) m_FootprintItems.GetCount(); i++ ) { - if( m_moduleObjects[i]->m_objType == wxT( 'V' ) ) - ((PCB_VIA*) m_moduleObjects[ i ] )->AddToFootprint( module, m_rotation, false ); + if( m_FootprintItems[i]->m_objType == wxT( 'V' ) ) + ((PCB_VIA*) m_FootprintItems[ i ] )->AddToFootprint( footprint, m_rotation, false ); } - module->CalculateBoundingBox(); + footprint->CalculateBoundingBox(); } -void PCB_MODULE::Flip() +void PCB_FOOTPRINT::Flip() { int i; - if( m_mirror == 1 ) + if( m_Mirror == 1 ) { m_rotation = -m_rotation; - for( i = 0; i < (int) m_moduleObjects.GetCount(); i++ ) + for( i = 0; i < (int) m_FootprintItems.GetCount(); i++ ) { - if( m_moduleObjects[i]->m_objType == wxT( 'L' ) || // lines - m_moduleObjects[i]->m_objType == wxT( 'A' ) || // arcs - m_moduleObjects[i]->m_objType == wxT( 'Z' ) || // polygons - m_moduleObjects[i]->m_objType == wxT( 'P' ) || // pads - m_moduleObjects[i]->m_objType == wxT( 'V' ) ) // vias + if( m_FootprintItems[i]->m_objType == wxT( 'L' ) || // lines + m_FootprintItems[i]->m_objType == wxT( 'A' ) || // arcs + m_FootprintItems[i]->m_objType == wxT( 'Z' ) || // polygons + m_FootprintItems[i]->m_objType == wxT( 'P' ) || // pads + m_FootprintItems[i]->m_objType == wxT( 'V' ) ) // vias { - m_moduleObjects[i]->Flip(); + m_FootprintItems[i]->Flip(); } } } diff --git a/pcbnew/plugins/pcad/pcb_module.h b/pcbnew/plugins/pcad/pcb_footprint.h similarity index 52% rename from pcbnew/plugins/pcad/pcb_module.h rename to pcbnew/plugins/pcad/pcb_footprint.h index c2da5bb699..1025df4696 100644 --- a/pcbnew/plugins/pcad/pcb_module.h +++ b/pcbnew/plugins/pcad/pcb_footprint.h @@ -3,7 +3,7 @@ * * Copyright (C) 2007, 2008 Lubo Racko * Copyright (C) 2007, 2008, 2012-2013 Alexander Lunev - * Copyright (C) 2012 KiCad Developers, see CHANGELOG.TXT for contributors. + * Copyright (C) 2012-2020 KiCad Developers, see CHANGELOG.TXT for contributors. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -37,34 +37,32 @@ namespace PCAD2KICAD { -class PCB_MODULE : public PCB_COMPONENT +class PCB_FOOTPRINT : public PCB_COMPONENT { public: - TTEXTVALUE m_value; // has reference (Name from parent) and value - PCB_COMPONENTS_ARRAY m_moduleObjects; // set of objects like PCB_LINE, PCB_PAD, PCB_VIA,.... - int m_mirror; - VERTICES_ARRAY m_boardOutline; + TTEXTVALUE m_Value; // has reference (Name from parent) and value + PCB_COMPONENTS_ARRAY m_FootprintItems; // set of objects like PCB_LINE, PCB_PAD, PCB_VIA.... + int m_Mirror; + VERTICES_ARRAY m_BoardOutline; - PCB_MODULE( PCB_CALLBACKS* aCallbacks, BOARD* aBoard ); - ~PCB_MODULE(); + PCB_FOOTPRINT( PCB_CALLBACKS* aCallbacks, BOARD* aBoard ); + ~PCB_FOOTPRINT(); - XNODE* FindModulePatternDefName( XNODE* aNode, const wxString& aName ); + XNODE* FindModulePatternDefName( XNODE* aNode, const wxString& aName ); - void DoLayerContentsObjects( XNODE* aNode, - PCB_MODULE* aPCBModule, - PCB_COMPONENTS_ARRAY* aList, - wxStatusBar* aStatusBar, - const wxString& aDefaultMeasurementUnit, - const wxString& aActualConversion ); + void DoLayerContentsObjects( XNODE* aNode, PCB_FOOTPRINT* aFootprint, + PCB_COMPONENTS_ARRAY* aList, wxStatusBar* aStatusBar, + const wxString& aDefaultMeasurementUnit, + const wxString& aActualConversion ); - void SetName( const wxString& aPin, const wxString& aName ); + void SetName( const wxString& aPin, const wxString& aName ); - virtual void Parse( XNODE* aNode, wxStatusBar* aStatusBar, - const wxString& aDefaultMeasurementUnit, - const wxString& aActualConversion ); + virtual void Parse( XNODE* aNode, wxStatusBar* aStatusBar, + const wxString& aDefaultMeasurementUnit, + const wxString& aActualConversion ); - virtual void Flip() override; - void AddToBoard() override; + virtual void Flip() override; + void AddToBoard() override; private: XNODE* FindPatternMultilayerSection( XNODE* aNode, wxString* aPatGraphRefName ); diff --git a/pcbnew/plugins/pcad/pcb_line.cpp b/pcbnew/plugins/pcad/pcb_line.cpp index 6b6158c9f5..809afb2910 100644 --- a/pcbnew/plugins/pcad/pcb_line.cpp +++ b/pcbnew/plugins/pcad/pcb_line.cpp @@ -3,7 +3,7 @@ * * Copyright (C) 2007, 2008 Lubo Racko * Copyright (C) 2007, 2008, 2012-2013 Alexander Lunev - * Copyright (C) 2012 KiCad Developers, see CHANGELOG.TXT for contributors. + * Copyright (C) 2012-2020 KiCad Developers, see CHANGELOG.TXT for contributors. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -39,9 +39,9 @@ namespace PCAD2KICAD { PCB_LINE::PCB_LINE( PCB_CALLBACKS* aCallbacks, BOARD* aBoard ) : PCB_COMPONENT( aCallbacks, aBoard ) { - m_width = 0; - m_toX = 0; - m_toY = 0; + m_Width = 0; + m_ToX = 0; + m_ToY = 0; m_objType = wxT( 'L' ); } @@ -63,9 +63,9 @@ void PCB_LINE::Parse( XNODE* aNode, m_KiCadLayer = GetKiCadLayer(); m_positionX = 0; m_positionY = 0; - m_toX = 0; - m_toY = 0; - m_width = 0; + m_ToX = 0; + m_ToY = 0; + m_Width = 0; lNode = FindNode( aNode, wxT( "pt" ) ); if( lNode ) @@ -77,12 +77,12 @@ void PCB_LINE::Parse( XNODE* aNode, if( lNode ) SetPosition( lNode->GetNodeContent(), aDefaultMeasurementUnit, - &m_toX, &m_toY, aActualConversion ); + &m_ToX, &m_ToY, aActualConversion ); lNode = FindNode( aNode, wxT( "width" ) ); if( lNode ) - SetWidth( lNode->GetNodeContent(), aDefaultMeasurementUnit, &m_width, aActualConversion ); + SetWidth( lNode->GetNodeContent(), aDefaultMeasurementUnit, &m_Width, aActualConversion ); lNode = FindNode( aNode, wxT( "netNameRef" ) ); @@ -101,8 +101,8 @@ void PCB_LINE::SetPosOffset( int aX_offs, int aY_offs ) { PCB_COMPONENT::SetPosOffset( aX_offs, aY_offs ); - m_toX += aX_offs; - m_toY += aY_offs; + m_ToX += aX_offs; + m_ToY += aY_offs; } @@ -110,7 +110,7 @@ void PCB_LINE::Flip() { PCB_COMPONENT::Flip(); - m_toX = -m_toX; + m_ToX = -m_ToX; m_KiCadLayer = FlipLayer( m_KiCadLayer ); } @@ -123,9 +123,9 @@ void PCB_LINE::AddToFootprint( FOOTPRINT* aFootprint ) aFootprint->Add( segment ); segment->m_Start0 = wxPoint( m_positionX, m_positionY ); - segment->m_End0 = wxPoint( m_toX, m_toY ); + segment->m_End0 = wxPoint( m_ToX, m_ToY ); - segment->SetWidth( m_width ); + segment->SetWidth( m_Width ); segment->SetLayer( m_KiCadLayer ); segment->SetDrawCoord(); @@ -141,9 +141,9 @@ void PCB_LINE::AddToBoard() m_board->Add( track ); track->SetPosition( wxPoint( m_positionX, m_positionY ) ); - track->SetEnd( wxPoint( m_toX, m_toY ) ); + track->SetEnd( wxPoint( m_ToX, m_ToY ) ); - track->SetWidth( m_width ); + track->SetWidth( m_Width ); track->SetLayer( m_KiCadLayer ); track->SetNetCode( m_netCode ); @@ -155,8 +155,8 @@ void PCB_LINE::AddToBoard() segment->SetLayer( m_KiCadLayer ); segment->SetStart( wxPoint( m_positionX, m_positionY ) ); - segment->SetEnd( wxPoint( m_toX, m_toY ) ); - segment->SetWidth( m_width ); + segment->SetEnd( wxPoint( m_ToX, m_ToY ) ); + segment->SetWidth( m_Width ); } } diff --git a/pcbnew/plugins/pcad/pcb_line.h b/pcbnew/plugins/pcad/pcb_line.h index 2e0e0fa8ae..a2e31a1a7b 100644 --- a/pcbnew/plugins/pcad/pcb_line.h +++ b/pcbnew/plugins/pcad/pcb_line.h @@ -40,9 +40,9 @@ namespace PCAD2KICAD { class PCB_LINE : public PCB_COMPONENT { public: - int m_width; - int m_toX; - int m_toY; + int m_Width; + int m_ToX; + int m_ToY; PCB_LINE( PCB_CALLBACKS* aCallbacks, BOARD* aBoard ); ~PCB_LINE(); diff --git a/pcbnew/plugins/pcad/pcb_net.cpp b/pcbnew/plugins/pcad/pcb_net.cpp index b98fe2a0af..ea5c90f30b 100644 --- a/pcbnew/plugins/pcad/pcb_net.cpp +++ b/pcbnew/plugins/pcad/pcb_net.cpp @@ -3,7 +3,7 @@ * * Copyright (C) 2007, 2008 Lubo Racko * Copyright (C) 2007, 2008, 2012 Alexander Lunev - * Copyright (C) 2012 KiCad Developers, see CHANGELOG.TXT for contributors. + * Copyright (C) 2012-2020 KiCad Developers, see CHANGELOG.TXT for contributors. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -35,8 +35,8 @@ namespace PCAD2KICAD { PCB_NET_NODE::PCB_NET_NODE() { - m_compRef = wxEmptyString; - m_pinRef = wxEmptyString; + m_CompRef = wxEmptyString; + m_PinRef = wxEmptyString; } @@ -45,9 +45,9 @@ PCB_NET_NODE::~PCB_NET_NODE() } -PCB_NET::PCB_NET( int aNetCode ) : m_netCode( aNetCode ) +PCB_NET::PCB_NET( int aNetCode ) : m_NetCode( aNetCode ) { - m_name = wxEmptyString; + m_Name = wxEmptyString; } @@ -55,9 +55,9 @@ PCB_NET::~PCB_NET() { int i; - for( i = 0; i < (int) m_netNodes.GetCount(); i++ ) + for( i = 0; i < (int) m_NetNodes.GetCount(); i++ ) { - delete m_netNodes[i]; + delete m_NetNodes[i]; } } @@ -71,7 +71,7 @@ void PCB_NET::Parse( XNODE* aNode ) aNode->GetAttribute( wxT( "Name" ), &propValue ); propValue.Trim( false ); propValue.Trim( true ); - m_name = propValue; + m_Name = propValue; lNode = FindNode( aNode, wxT( "node" ) ); @@ -90,12 +90,12 @@ void PCB_NET::Parse( XNODE* aNode ) netNode = new PCB_NET_NODE; s1.Trim( false ); s1.Trim( true ); - netNode->m_compRef = s1; + netNode->m_CompRef = s1; s2.Trim( false ); s2.Trim( true ); - netNode->m_pinRef = s2; - m_netNodes.Add( netNode ); + netNode->m_PinRef = s2; + m_NetNodes.Add( netNode ); lNode = lNode->GetNext(); } } diff --git a/pcbnew/plugins/pcad/pcb_net.h b/pcbnew/plugins/pcad/pcb_net.h index 867271dc8e..fa268c625e 100644 --- a/pcbnew/plugins/pcad/pcb_net.h +++ b/pcbnew/plugins/pcad/pcb_net.h @@ -3,7 +3,7 @@ * * Copyright (C) 2007, 2008 Lubo Racko * Copyright (C) 2007, 2008, 2012 Alexander Lunev - * Copyright (C) 2012 KiCad Developers, see CHANGELOG.TXT for contributors. + * Copyright (C) 2012-2020 KiCad Developers, see CHANGELOG.TXT for contributors. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -39,8 +39,8 @@ namespace PCAD2KICAD { class PCB_NET_NODE : public wxObject { public: - wxString m_compRef; - wxString m_pinRef; + wxString m_CompRef; + wxString m_PinRef; PCB_NET_NODE(); ~PCB_NET_NODE(); @@ -51,9 +51,9 @@ WX_DEFINE_ARRAY( PCB_NET_NODE*, PCB_NET_NODES_ARRAY ); class PCB_NET : public wxObject { public: - wxString m_name; - int m_netCode; - PCB_NET_NODES_ARRAY m_netNodes; + wxString m_Name; + int m_NetCode; + PCB_NET_NODES_ARRAY m_NetNodes; PCB_NET( int aNetCode ); ~PCB_NET(); diff --git a/pcbnew/plugins/pcad/pcb_pad.cpp b/pcbnew/plugins/pcad/pcb_pad.cpp index ee6121219a..200ed59424 100644 --- a/pcbnew/plugins/pcad/pcb_pad.cpp +++ b/pcbnew/plugins/pcad/pcb_pad.cpp @@ -3,7 +3,7 @@ * * Copyright (C) 2007, 2008 Lubo Racko * Copyright (C) 2007, 2008, 2012-2013 Alexander Lunev - * Copyright (C) 2012 KiCad Developers, see CHANGELOG.TXT for contributors. + * Copyright (C) 2012-2020 KiCad Developers, see CHANGELOG.TXT for contributors. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -38,9 +38,9 @@ PCB_PAD::PCB_PAD( PCB_CALLBACKS* aCallbacks, BOARD* aBoard ) : PCB_COMPONENT( aCallbacks, aBoard ) { m_objType = wxT( 'P' ); - m_number = 0; - m_hole = 0; - m_isHolePlated = true; + m_Number = 0; + m_Hole = 0; + m_IsHolePlated = true; m_defaultPinDes = wxEmptyString; } @@ -49,8 +49,8 @@ PCB_PAD::~PCB_PAD() { int i; - for( i = 0; i < (int) m_shapes.GetCount(); i++ ) - delete m_shapes[i]; + for( i = 0; i < (int) m_Shapes.GetCount(); i++ ) + delete m_Shapes[i]; } @@ -69,7 +69,7 @@ void PCB_PAD::Parse( XNODE* aNode, const wxString& aDefaultMeasurementUnit, if( lNode ) { lNode->GetNodeContent().ToLong( &num ); - m_number = (int) num; + m_Number = (int) num; } lNode = FindNode( aNode, wxT( "padStyleRef" ) ); @@ -146,10 +146,10 @@ void PCB_PAD::Parse( XNODE* aNode, const wxString& aDefaultMeasurementUnit, cNode = FindNode( lNode, wxT( "holeDiam" ) ); if( cNode ) - SetWidth( cNode->GetNodeContent(), aDefaultMeasurementUnit, &m_hole, aActualConversion ); + SetWidth( cNode->GetNodeContent(), aDefaultMeasurementUnit, &m_Hole, aActualConversion ); if( FindNodeGetContent( lNode, wxT( "isHolePlated" ) ) == wxT( "False" ) ) - m_isHolePlated = false; + m_IsHolePlated = false; cNode = FindNode( lNode, wxT( "padShape" ) ); @@ -163,7 +163,7 @@ void PCB_PAD::Parse( XNODE* aNode, const wxString& aDefaultMeasurementUnit, { padShape = new PCB_PAD_SHAPE( m_callbacks, m_board ); padShape->Parse( cNode, aDefaultMeasurementUnit, aActualConversion ); - m_shapes.Add( padShape ); + m_Shapes.Add( padShape ); } } @@ -181,8 +181,8 @@ void PCB_PAD::Flip() if( m_objType == wxT( 'P' ) ) m_rotation = -m_rotation; - for( i = 0; i < (int)m_shapes.GetCount(); i++ ) - m_shapes[i]->m_KiCadLayer = FlipLayer( m_shapes[i]->m_KiCadLayer ); + for( i = 0; i < (int)m_Shapes.GetCount(); i++ ) + m_Shapes[i]->m_KiCadLayer = FlipLayer( m_Shapes[i]->m_KiCadLayer ); } @@ -197,21 +197,21 @@ void PCB_PAD::AddToFootprint( FOOTPRINT* aFootprint, int aRotation, bool aEncaps PAD* pad = new PAD( aFootprint ); - if( !m_isHolePlated && m_hole ) + if( !m_IsHolePlated && m_Hole ) { // mechanical hole pad->SetShape( PAD_SHAPE_CIRCLE ); pad->SetAttribute( PAD_ATTRIB_NPTH ); pad->SetDrillShape( PAD_DRILL_SHAPE_CIRCLE ); - pad->SetDrillSize( wxSize( m_hole, m_hole ) ); - pad->SetSize( wxSize( m_hole, m_hole ) ); + pad->SetDrillSize( wxSize( m_Hole, m_Hole ) ); + pad->SetSize( wxSize( m_Hole, m_Hole ) ); // Mounting Hole: Solder Mask Margin from Top Layer Width size. // Used the default zone clearance (simplify) - if( m_shapes.GetCount() && m_shapes[0]->m_shape == wxT( "MtHole" ) ) + if( m_Shapes.GetCount() && m_Shapes[0]->m_Shape == wxT( "MtHole" ) ) { - int sm_margin = ( m_shapes[0]->m_width - m_hole ) / 2; + int sm_margin = ( m_Shapes[0]->m_Width - m_Hole ) / 2; pad->SetLocalSolderMaskMargin( sm_margin ); pad->SetLocalClearance( sm_margin + Millimeter2iu( 0.254 ) ); } @@ -220,21 +220,21 @@ void PCB_PAD::AddToFootprint( FOOTPRINT* aFootprint, int aRotation, bool aEncaps } else { - ( m_hole ) ? padType = PAD_ATTRIB_PTH : padType = PAD_ATTRIB_SMD; + ( m_Hole ) ? padType = PAD_ATTRIB_PTH : padType = PAD_ATTRIB_SMD; // form layer mask - for( i = 0; i < (int) m_shapes.GetCount(); i++ ) + for( i = 0; i < (int) m_Shapes.GetCount(); i++ ) { - padShape = m_shapes[i]; + padShape = m_Shapes[i]; - if( padShape->m_width > 0 && padShape->m_height > 0 ) + if( padShape->m_Width > 0 && padShape->m_Height > 0 ) { if( padShape->m_KiCadLayer == F_Cu || padShape->m_KiCadLayer == B_Cu ) { - padShapeName = padShape->m_shape; - width = padShape->m_width; - height = padShape->m_height; + padShapeName = padShape->m_Shape; + width = padShape->m_Width; + height = padShape->m_Height; // assume this is SMD pad if( padShape->m_KiCadLayer == F_Cu ) @@ -280,7 +280,7 @@ void PCB_PAD::AddToFootprint( FOOTPRINT* aFootprint, int aRotation, bool aEncaps pad->SetDrillShape( PAD_DRILL_SHAPE_CIRCLE ); pad->SetOffset( wxPoint( 0, 0 ) ); - pad->SetDrillSize( wxSize( m_hole, m_hole ) ); + pad->SetDrillSize( wxSize( m_Hole, m_Hole ) ); pad->SetAttribute( padType ); @@ -298,8 +298,8 @@ void PCB_PAD::AddToFootprint( FOOTPRINT* aFootprint, int aRotation, bool aEncaps if( !aEncapsulatedPad ) { - // pad's "Position" is not relative to the module's, - // whereas Pos0 is relative to the module's but is the unrotated coordinate. + // pad's "Position" is not relative to the footprint's, whereas Pos0 is relative to + // the footprint's but is the unrotated coordinate. wxPoint padpos( m_positionX, m_positionY ); pad->SetPos0( padpos ); RotatePoint( &padpos, aFootprint->GetOrientation() ); @@ -320,17 +320,17 @@ void PCB_PAD::AddToBoard() if( m_objType == wxT( 'V' ) ) // via { // choose one of the shapes - for( i = 0; i < (int) m_shapes.GetCount(); i++ ) + for( i = 0; i < (int) m_Shapes.GetCount(); i++ ) { - padShape = m_shapes[i]; + padShape = m_Shapes[i]; - if( padShape->m_width > 0 && padShape->m_height > 0 ) + if( padShape->m_Width > 0 && padShape->m_Height > 0 ) { if( padShape->m_KiCadLayer == F_Cu || padShape->m_KiCadLayer == B_Cu ) { - width = padShape->m_width; - height = padShape->m_height; + width = padShape->m_Width; + height = padShape->m_Height; break; } @@ -351,7 +351,7 @@ void PCB_PAD::AddToBoard() via->SetWidth( height ); via->SetViaType( VIATYPE::THROUGH ); via->SetLayerPair( F_Cu, B_Cu ); - via->SetDrill( m_hole ); + via->SetDrill( m_Hole ); via->SetLayer( m_KiCadLayer ); via->SetNetCode( m_netCode ); @@ -359,14 +359,13 @@ void PCB_PAD::AddToBoard() } else // pad { - FOOTPRINT* module = new FOOTPRINT( m_board ); - m_board->Add( module, ADD_MODE::APPEND ); + FOOTPRINT* footprint = new FOOTPRINT( m_board ); + m_board->Add( footprint, ADD_MODE::APPEND ); m_name.text = m_defaultPinDes; - module->SetPosition( wxPoint( m_positionX, m_positionY ) ); - AddToFootprint( module, 0, true ); - + footprint->SetPosition( wxPoint( m_positionX, m_positionY ) ); + AddToFootprint( footprint, 0, true ); } } diff --git a/pcbnew/plugins/pcad/pcb_pad.h b/pcbnew/plugins/pcad/pcb_pad.h index 52250ae96c..38044cb436 100644 --- a/pcbnew/plugins/pcad/pcb_pad.h +++ b/pcbnew/plugins/pcad/pcb_pad.h @@ -36,10 +36,10 @@ namespace PCAD2KICAD { class PCB_PAD : public PCB_COMPONENT { public: - int m_number; - int m_hole; - bool m_isHolePlated; - PCB_PAD_SHAPES_ARRAY m_shapes; + int m_Number; + int m_Hole; + bool m_IsHolePlated; + PCB_PAD_SHAPES_ARRAY m_Shapes; PCB_PAD( PCB_CALLBACKS* aCallbacks, BOARD* aBoard ); ~PCB_PAD(); diff --git a/pcbnew/plugins/pcad/pcb_pad_shape.cpp b/pcbnew/plugins/pcad/pcb_pad_shape.cpp index c5c41bbbc8..a29145819b 100644 --- a/pcbnew/plugins/pcad/pcb_pad_shape.cpp +++ b/pcbnew/plugins/pcad/pcb_pad_shape.cpp @@ -3,7 +3,7 @@ * * Copyright (C) 2007, 2008 Lubo Racko * Copyright (C) 2007, 2008, 2012 Alexander Lunev - * Copyright (C) 2012 KiCad Developers, see CHANGELOG.TXT for contributors. + * Copyright (C) 2012-2020 KiCad Developers, see CHANGELOG.TXT for contributors. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -38,9 +38,9 @@ namespace PCAD2KICAD { PCB_PAD_SHAPE::PCB_PAD_SHAPE( PCB_CALLBACKS* aCallbacks, BOARD* aBoard ) : PCB_COMPONENT( aCallbacks, aBoard ) { - m_shape = wxEmptyString; - m_width = 0; - m_height = 0; + m_Shape = wxEmptyString; + m_Width = 0; + m_Height = 0; } @@ -64,7 +64,7 @@ void PCB_PAD_SHAPE::Parse( XNODE* aNode, { str = lNode->GetNodeContent(); str.Trim( false ); - m_shape = str; + m_Shape = str; } lNode = FindNode( aNode, wxT( "layerNumRef" ) ); @@ -77,25 +77,25 @@ void PCB_PAD_SHAPE::Parse( XNODE* aNode, m_KiCadLayer = GetKiCadLayer(); - if( m_shape == wxT( "Oval" ) - || m_shape == wxT( "Rect" ) - || m_shape == wxT( "Ellipse" ) - || m_shape == wxT( "MtHole" ) - || m_shape == wxT( "RndRect" ) ) + if( m_Shape == wxT( "Oval" ) + || m_Shape == wxT( "Rect" ) + || m_Shape == wxT( "Ellipse" ) + || m_Shape == wxT( "MtHole" ) + || m_Shape == wxT( "RndRect" ) ) { lNode = FindNode( aNode, wxT( "shapeWidth" ) ); if( lNode ) - SetWidth( lNode->GetNodeContent(), aDefaultMeasurementUnit, &m_width, + SetWidth( lNode->GetNodeContent(), aDefaultMeasurementUnit, &m_Width, aActualConversion ); lNode = FindNode( aNode, wxT( "shapeHeight" ) ); if( lNode ) SetWidth( - lNode->GetNodeContent(), aDefaultMeasurementUnit, &m_height, aActualConversion ); + lNode->GetNodeContent(), aDefaultMeasurementUnit, &m_Height, aActualConversion ); } - else if( m_shape == wxT( "Polygon" ) ) + else if( m_Shape == wxT( "Polygon" ) ) { // aproximation to simplier pad shape ..... lNode = FindNode( aNode, wxT( "shapeOutline" ) ); @@ -128,8 +128,8 @@ void PCB_PAD_SHAPE::Parse( XNODE* aNode, lNode = lNode->GetNext(); } - m_width = maxX - minX; - m_height = maxY - minY; + m_Width = maxX - minX; + m_Height = maxY - minY; } } diff --git a/pcbnew/plugins/pcad/pcb_pad_shape.h b/pcbnew/plugins/pcad/pcb_pad_shape.h index 5398eab2c9..ea30c01159 100644 --- a/pcbnew/plugins/pcad/pcb_pad_shape.h +++ b/pcbnew/plugins/pcad/pcb_pad_shape.h @@ -3,7 +3,7 @@ * * Copyright (C) 2007, 2008 Lubo Racko * Copyright (C) 2007, 2008, 2012 Alexander Lunev - * Copyright (C) 2012 KiCad Developers, see CHANGELOG.TXT for contributors. + * Copyright (C) 2012-2020 KiCad Developers, see CHANGELOG.TXT for contributors. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -40,18 +40,17 @@ namespace PCAD2KICAD { class PCB_PAD_SHAPE : public PCB_COMPONENT { public: - wxString m_shape; - int m_width; - int m_height; + wxString m_Shape; + int m_Width; + int m_Height; PCB_PAD_SHAPE( PCB_CALLBACKS* aCallbacks, BOARD* aBoard ); ~PCB_PAD_SHAPE(); - virtual void Parse( XNODE* aNode, - const wxString& aDefaultMeasurementUnit, - const wxString& aActualConversion ); + virtual void Parse( XNODE* aNode, const wxString& aDefaultMeasurementUnit, + const wxString& aActualConversion ); - void AddToBoard() override; + void AddToBoard() override; }; WX_DEFINE_ARRAY( PCB_PAD_SHAPE*, PCB_PAD_SHAPES_ARRAY ); diff --git a/pcbnew/plugins/pcad/pcb_via.cpp b/pcbnew/plugins/pcad/pcb_via.cpp index 87885cd69a..366616180e 100644 --- a/pcbnew/plugins/pcad/pcb_via.cpp +++ b/pcbnew/plugins/pcad/pcb_via.cpp @@ -3,7 +3,7 @@ * * Copyright (C) 2007, 2008 Lubo Racko * Copyright (C) 2007, 2008, 2012 Alexander Lunev - * Copyright (C) 2012 KiCad Developers, see CHANGELOG.TXT for contributors. + * Copyright (C) 2012-2020 KiCad Developers, see CHANGELOG.TXT for contributors. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -112,7 +112,7 @@ void PCB_VIA::Parse( XNODE* aNode, lNode = FindNode( tNode, wxT( "holeDiam" ) ); if( lNode ) - SetWidth( lNode->GetNodeContent(), aDefaultMeasurementUnit, &m_hole, + SetWidth( lNode->GetNodeContent(), aDefaultMeasurementUnit, &m_Hole, aActualConversion ); lNode = FindNode( tNode, wxT( "viaShape" ) ); @@ -127,7 +127,7 @@ void PCB_VIA::Parse( XNODE* aNode, { viaShape = new PCB_VIA_SHAPE( m_callbacks, m_board ); viaShape->Parse( lNode, aDefaultMeasurementUnit, aActualConversion ); - m_shapes.Add( viaShape ); + m_Shapes.Add( viaShape ); } } diff --git a/pcbnew/plugins/pcad/pcb_via.h b/pcbnew/plugins/pcad/pcb_via.h index 557c7ac161..83139b0c8a 100644 --- a/pcbnew/plugins/pcad/pcb_via.h +++ b/pcbnew/plugins/pcad/pcb_via.h @@ -3,7 +3,7 @@ * * Copyright (C) 2007, 2008 Lubo Racko * Copyright (C) 2007, 2008, 2012 Alexander Lunev - * Copyright (C) 2012 KiCad Developers, see CHANGELOG.TXT for contributors. + * Copyright (C) 2012-2020 KiCad Developers, see CHANGELOG.TXT for contributors. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -40,12 +40,10 @@ namespace PCAD2KICAD { class PCB_VIA : public PCB_PAD { public: - PCB_VIA( PCB_CALLBACKS* aCallbacks, BOARD* aBoard ); ~PCB_VIA(); - virtual void Parse( XNODE* aNode, - const wxString& aDefaultMeasurementUnit, + virtual void Parse( XNODE* aNode, const wxString& aDefaultMeasurementUnit, const wxString& aActualConversion ) override; }; diff --git a/pcbnew/plugins/pcad/pcb_via_shape.cpp b/pcbnew/plugins/pcad/pcb_via_shape.cpp index ebdf1f3090..9dee4b8dd7 100644 --- a/pcbnew/plugins/pcad/pcb_via_shape.cpp +++ b/pcbnew/plugins/pcad/pcb_via_shape.cpp @@ -3,7 +3,7 @@ * * Copyright (C) 2007, 2008 Lubo Racko * Copyright (C) 2007, 2008, 2012 Alexander Lunev - * Copyright (C) 2012 KiCad Developers, see CHANGELOG.TXT for contributors. + * Copyright (C) 2012-2020 KiCad Developers, see CHANGELOG.TXT for contributors. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -59,7 +59,7 @@ void PCB_VIA_SHAPE::Parse( XNODE* aNode, { str = lNode->GetNodeContent(); str.Trim( false ); - m_shape = str; + m_Shape = str; } lNode = FindNode( aNode, wxT( "layerNumRef" ) ); @@ -74,12 +74,12 @@ void PCB_VIA_SHAPE::Parse( XNODE* aNode, lNode = FindNode( aNode, wxT( "shapeWidth" ) ); if( lNode ) - SetWidth( lNode->GetNodeContent(), aDefaultMeasurementUnit, &m_width, aActualConversion ); + SetWidth( lNode->GetNodeContent(), aDefaultMeasurementUnit, &m_Width, aActualConversion ); lNode = FindNode( aNode, wxT( "shapeHeight" ) ); if( lNode ) - SetWidth( lNode->GetNodeContent(), aDefaultMeasurementUnit, &m_height, aActualConversion ); + SetWidth( lNode->GetNodeContent(), aDefaultMeasurementUnit, &m_Height, aActualConversion ); } diff --git a/pcbnew/plugins/pcad/pcb_via_shape.h b/pcbnew/plugins/pcad/pcb_via_shape.h index 42a5262e3d..373150a2e3 100644 --- a/pcbnew/plugins/pcad/pcb_via_shape.h +++ b/pcbnew/plugins/pcad/pcb_via_shape.h @@ -3,7 +3,7 @@ * * Copyright (C) 2007, 2008 Lubo Racko * Copyright (C) 2007, 2008, 2012 Alexander Lunev - * Copyright (C) 2012 KiCad Developers, see CHANGELOG.TXT for contributors. + * Copyright (C) 2012-2020 KiCad Developers, see CHANGELOG.TXT for contributors. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -42,8 +42,7 @@ public: PCB_VIA_SHAPE( PCB_CALLBACKS* aCallbacks, BOARD* aBoard ); ~PCB_VIA_SHAPE(); - virtual void Parse( XNODE* aNode, - const wxString& aDefaultMeasurementUnit, + virtual void Parse( XNODE* aNode, const wxString& aDefaultMeasurementUnit, const wxString& aActualConversion ) override; }; diff --git a/pcbnew/specctra_import_export/specctra.cpp b/pcbnew/specctra_import_export/specctra.cpp index 9cf8acea10..f9d0ea52df 100644 --- a/pcbnew/specctra_import_export/specctra.cpp +++ b/pcbnew/specctra_import_export/specctra.cpp @@ -78,9 +78,9 @@ void SPECCTRA_DB::buildLayerMaps( BOARD* aBoard ) // Same as KiCad now except for B_Cu unsigned layerCount = aBoard->GetCopperLayerCount(); - layerIds.clear(); - pcbLayer2kicad.resize( layerCount ); - kicadLayer2pcb.resize( B_Cu + 1 ); + m_layerIds.clear(); + m_pcbLayer2kicad.resize( layerCount ); + m_kicadLayer2pcb.resize( B_Cu + 1 ); #if 0 // was: for( LAYER_NUM kiNdx = layerCount - 1, pcbNdx=FIRST_LAYER; @@ -99,22 +99,22 @@ void SPECCTRA_DB::buildLayerMaps( BOARD* aBoard ) // establish bi-directional mapping between KiCad's BOARD layer and PCB layer - for( unsigned i = 0; i < kicadLayer2pcb.size(); ++i ) + for( unsigned i = 0; i < m_kicadLayer2pcb.size(); ++i ) { if( i < layerCount-1 ) - kicadLayer2pcb[i] = i; + m_kicadLayer2pcb[i] = i; else - kicadLayer2pcb[i] = layerCount - 1; + m_kicadLayer2pcb[i] = layerCount - 1; } - for( unsigned i = 0; i < pcbLayer2kicad.size(); ++i ) + for( unsigned i = 0; i < m_pcbLayer2kicad.size(); ++i ) { PCB_LAYER_ID id = ( i < layerCount-1 ) ? ToLAYER_ID( i ) : B_Cu; - pcbLayer2kicad[i] = id; + m_pcbLayer2kicad[i] = id; // save the specctra layer name in SPECCTRA_DB::layerIds for later. - layerIds.push_back( TO_UTF8( aBoard->GetLayerName( id ) ) ); + m_layerIds.push_back(TO_UTF8( aBoard->GetLayerName( id ) ) ); } #endif @@ -123,9 +123,9 @@ void SPECCTRA_DB::buildLayerMaps( BOARD* aBoard ) int SPECCTRA_DB::findLayerName( const std::string& aLayerName ) const { - for( int i=0; i < int(layerIds.size()); ++i ) + for( int i=0; i < int( m_layerIds.size()); ++i ) { - if( 0 == aLayerName.compare( layerIds[i] ) ) + if( 0 == aLayerName.compare( m_layerIds[i] ) ) return i; } return -1; @@ -254,7 +254,7 @@ void SPECCTRA_DB::LoadPCB( const wxString& aFilename ) SetPCB( new PCB() ); - doPCB( pcb ); + doPCB( m_pcb ); PopReader(); } @@ -273,7 +273,7 @@ void SPECCTRA_DB::LoadSESSION( const wxString& aFilename ) SetSESSION( new SESSION() ); - doSESSION( session ); + doSESSION( m_session ); PopReader(); } @@ -420,7 +420,7 @@ void SPECCTRA_DB::doPARSER( PARSER* growth ) Expecting( T_QUOTE_DEF ); SetStringDelimiter( (unsigned char) *CurText() ); growth->string_quote = *CurText(); - quote_char = CurText(); + m_quote_char = CurText(); NeedRIGHT(); break; @@ -1400,12 +1400,12 @@ void SPECCTRA_DB::doRULE( RULE* growth ) builder += ' '; if( tok==T_STRING ) - builder += quote_char; + builder += m_quote_char; builder += CurText(); if( tok==T_STRING ) - builder += quote_char; + builder += m_quote_char; } // When the nested rule is closed with a T_RIGHT and we are back down @@ -2576,12 +2576,12 @@ void SPECCTRA_DB::doCLASS( CLASS* growth ) builder += ' '; if( tok==T_STRING ) - builder += quote_char; + builder += m_quote_char; builder += CurText(); if( tok==T_STRING ) - builder += quote_char; + builder += m_quote_char; } // When the nested rule is closed with a T_RIGHT and we are back down @@ -3441,25 +3441,25 @@ void SPECCTRA_DB::doSUPPLY_PIN( SUPPLY_PIN* growth ) void SPECCTRA_DB::ExportPCB( const wxString& aFilename, bool aNameChange ) { - if( pcb ) + if( m_pcb ) { - FILE_OUTPUTFORMATTER formatter( aFilename, wxT( "wt" ), quote_char[0] ); + FILE_OUTPUTFORMATTER formatter( aFilename, wxT( "wt" ), m_quote_char[0] ); if( aNameChange ) - pcb->pcbname = TO_UTF8( aFilename ); + m_pcb->pcbname = TO_UTF8( aFilename ); - pcb->Format( &formatter, 0 ); + m_pcb->Format( &formatter, 0 ); } } void SPECCTRA_DB::ExportSESSION( const wxString& aFilename ) { - if( session ) + if( m_session ) { - FILE_OUTPUTFORMATTER formatter( aFilename, wxT( "wt" ), quote_char[0] ); + FILE_OUTPUTFORMATTER formatter( aFilename, wxT( "wt" ), m_quote_char[0] ); - session->Format( &formatter, 0 ); + m_session->Format( &formatter, 0 ); } } diff --git a/pcbnew/specctra_import_export/specctra.h b/pcbnew/specctra_import_export/specctra.h index c1bfda4b1d..7a2a981541 100644 --- a/pcbnew/specctra_import_export/specctra.h +++ b/pcbnew/specctra_import_export/specctra.h @@ -3600,49 +3600,43 @@ typedef boost::ptr_set PADSTACKSET; /** * SPECCTRA_DB - * holds a DSN data tree, usually coming from a DSN file. Is essentially a - * SPECCTRA_PARSER class. + * holds a DSN data tree, usually coming from a DSN file. Is essentially a SPECCTRA_PARSER class. */ class SPECCTRA_DB : public SPECCTRA_LEXER { /// specctra DSN keywords static const KEYWORD keywords[]; - static const unsigned keywordCount; - PCB* pcb; - SESSION* session; - wxString filename; - std::string quote_char; + PCB* m_pcb; + SESSION* m_session; + wxString m_filename; + std::string m_quote_char; - bool modulesAreFlipped; + bool m_footprintsAreFlipped; - STRING_FORMATTER sf; + STRING_FORMATTER m_sf; - STRINGS layerIds; ///< indexed by PCB layer number + STRINGS m_layerIds; ///< indexed by PCB layer number - /// maps BOARD layer number to PCB layer numbers - std::vector kicadLayer2pcb; - - /// maps PCB layer number to BOARD layer numbers - std::vector pcbLayer2kicad; + std::vector m_kicadLayer2pcb; ///< maps BOARD layer number to PCB layer numbers + std::vector m_pcbLayer2kicad; ///< maps PCB layer number to BOARD layer numbers /// used during FromSESSION() only, memory for it is not owned here. - UNIT_RES* routeResolution; + UNIT_RES* m_routeResolution; /// a copy to avoid passing as an argument, memory for it is not owned here. - BOARD* sessionBoard; + BOARD* m_sessionBoard; static const KICAD_T scanPADs[]; - PADSTACKSET padstackset; + PADSTACKSET m_padstackset; /// we don't want ownership here permanently, so we don't use boost::ptr_vector - std::vector nets; + std::vector m_nets; /// specctra cu layers, 0 based index: - int m_top_via_layer; - int m_bot_via_layer; - + int m_top_via_layer; + int m_bot_via_layer; /** * Function buildLayerMaps @@ -3808,10 +3802,10 @@ class SPECCTRA_DB : public SPECCTRA_LEXER */ void deleteNETs() { - for( unsigned n=0; nIsOnLayer( kilayer ) ) { - layerName[reportedLayers++] = layerIds[layer].c_str(); + layerName[reportedLayers++] = m_layerIds[layer].c_str(); if( !onAllCopperLayers ) { @@ -632,7 +632,7 @@ IMAGE* SPECCTRA_DB::makeIMAGE( BOARD* aBoard, FOOTPRINT* aFootprint ) circle->SetDiameter( diameter ); circle->SetVertex( vertex ); - circle->SetLayerId( layerIds[layer].c_str() ); + circle->SetLayerId( m_layerIds[layer].c_str() ); } } // else if() could there be a square keepout here? @@ -647,9 +647,9 @@ IMAGE* SPECCTRA_DB::makeIMAGE( BOARD* aBoard, FOOTPRINT* aFootprint ) continue; PADSTACK* padstack = makePADSTACK( aBoard, pad ); - PADSTACKSET::iterator iter = padstackset.find( *padstack ); + PADSTACKSET::iterator iter = m_padstackset.find( *padstack ); - if( iter != padstackset.end() ) + if( iter != m_padstackset.end() ) { // padstack is a duplicate, delete it and use the original delete padstack; @@ -657,7 +657,7 @@ IMAGE* SPECCTRA_DB::makeIMAGE( BOARD* aBoard, FOOTPRINT* aFootprint ) } else { - padstackset.insert( padstack ); + m_padstackset.insert( padstack ); } PIN* pin = new PIN( image ); @@ -796,7 +796,7 @@ PADSTACK* SPECCTRA_DB::makeVia( int aCopperDiameter, int aDrillDiameter, shape->SetShape( circle ); circle->SetDiameter( dsnDiameter ); - circle->SetLayerId( layerIds[layer].c_str() ); + circle->SetLayerId( m_layerIds[layer].c_str() ); } snprintf( name, sizeof(name), "Via[%d-%d]_%.6g:%.6g_um", @@ -819,8 +819,8 @@ PADSTACK* SPECCTRA_DB::makeVia( const ::VIA* aVia ) aVia->LayerPair( &topLayerNum, &botLayerNum ); - int topLayer = kicadLayer2pcb[topLayerNum]; - int botLayer = kicadLayer2pcb[botLayerNum]; + int topLayer = m_kicadLayer2pcb[topLayerNum]; + int botLayer = m_kicadLayer2pcb[botLayerNum]; if( topLayer > botLayer ) std::swap( topLayer, botLayer ); @@ -863,7 +863,7 @@ void SPECCTRA_DB::fillBOUNDARY( BOARD* aBoard, BOUNDARY* boundary ) keepout->SetShape( poly_ko ); poly_ko->SetLayerId( "signal" ); - pcb->structure->keepouts.push_back( keepout ); + m_pcb->structure->keepouts.push_back( keepout ); SHAPE_LINE_CHAIN& hole = outlines.Hole( cnt, ii ); @@ -925,8 +925,8 @@ void SPECCTRA_DB::FromBOARD( BOARD* aBoard ) } } - if( !pcb ) - pcb = SPECCTRA_DB::MakePCB(); + if( !m_pcb ) + m_pcb = SPECCTRA_DB::MakePCB(); //---------------------------------------------------- { @@ -940,15 +940,15 @@ void SPECCTRA_DB::FromBOARD( BOARD* aBoard ) for( int pcbNdx=0; pcbNdxstructure ); + LAYER* layer = new LAYER( m_pcb->structure ); - pcb->structure->layers.push_back( layer ); + m_pcb->structure->layers.push_back( layer ); - layer->name = layerIds[pcbNdx]; + layer->name = m_layerIds[pcbNdx]; DSN_T layerType; - switch( aBoard->GetLayerType( pcbLayer2kicad[pcbNdx] ) ) + switch( aBoard->GetLayerType( m_pcbLayer2kicad[pcbNdx] ) ) { default: case LT_SIGNAL: layerType = T_signal; break; @@ -975,7 +975,7 @@ void SPECCTRA_DB::FromBOARD( BOARD* aBoard ) } // a space in a quoted token is NOT a terminator, true establishes this. - pcb->parser->space_in_quoted_tokens = true; + m_pcb->parser->space_in_quoted_tokens = true; //----- & -------------------- { @@ -983,9 +983,9 @@ void SPECCTRA_DB::FromBOARD( BOARD* aBoard ) // which is 100 nm resolution. Possibly more resolution is possible // in freerouter, but it would need testing. - pcb->unit->units = T_um; - pcb->resolution->units = T_um; - pcb->resolution->value = 10; // tenths of a um + m_pcb->unit->units = T_um; + m_pcb->resolution->units = T_um; + m_pcb->resolution->value = 10; // tenths of a um // pcb->resolution->value = 1000; // "thousandths of a um" (i.e. "nm") } @@ -996,7 +996,7 @@ void SPECCTRA_DB::FromBOARD( BOARD* aBoard ) // of an exception. BOUNDARY* boundary = new BOUNDARY( 0 ); - pcb->structure->SetBOUNDARY( boundary ); + m_pcb->structure->SetBOUNDARY( boundary ); fillBOUNDARY( aBoard, boundary ); } @@ -1011,7 +1011,7 @@ void SPECCTRA_DB::FromBOARD( BOARD* aBoard ) double clearance = scale( defaultClearance ); - STRINGS& rules = pcb->structure->rules->rules; + STRINGS& rules = m_pcb->structure->rules->rules; sprintf( rule, "(width %.6g)", scale( defaultTrackWidth ) ); rules.push_back( rule ); @@ -1088,9 +1088,9 @@ void SPECCTRA_DB::FromBOARD( BOARD* aBoard ) if( ! IsCopperLayer( item->GetLayer() ) ) continue; - COPPER_PLANE* plane = new COPPER_PLANE( pcb->structure ); + COPPER_PLANE* plane = new COPPER_PLANE( m_pcb->structure ); - pcb->structure->planes.push_back( plane ); + m_pcb->structure->planes.push_back( plane ); PATH* mainPolygon = new PATH( plane, T_polygon ); @@ -1104,19 +1104,19 @@ void SPECCTRA_DB::FromBOARD( BOARD* aBoard ) // This is one of those no connection zones, netcode=0, and it has no name. // Create a unique, bogus netname. - NET* no_net = new NET( pcb->network ); + NET* no_net = new NET( m_pcb->network ); sprintf( name, "@:no_net_%d", netlessZones++ ); no_net->net_id = name; // add the bogus net name to network->nets. - pcb->network->nets.push_back( no_net ); + m_pcb->network->nets.push_back( no_net ); // use the bogus net name in the netless zone. plane->name = no_net->net_id; } - mainPolygon->layer_id = layerIds[ kicadLayer2pcb[ item->GetLayer() ] ]; + mainPolygon->layer_id = m_layerIds[ m_kicadLayer2pcb[ item->GetLayer() ] ]; // Handle the main outlines SHAPE_POLY_SET::ITERATOR iterator; @@ -1163,7 +1163,7 @@ void SPECCTRA_DB::FromBOARD( BOARD* aBoard ) window->SetShape( cutout ); - cutout->layer_id = layerIds[ kicadLayer2pcb[ item->GetLayer() ] ]; + cutout->layer_id = m_layerIds[ m_kicadLayer2pcb[ item->GetLayer() ] ]; } // If the point in this iteration is the last of the contour, the next iteration @@ -1229,13 +1229,13 @@ void SPECCTRA_DB::FromBOARD( BOARD* aBoard ) if( !item->IsOnLayer( PCB_LAYER_ID( layer ) ) ) continue; - KEEPOUT* keepout = new KEEPOUT( pcb->structure, keepout_type ); - pcb->structure->keepouts.push_back( keepout ); + KEEPOUT* keepout = new KEEPOUT( m_pcb->structure, keepout_type ); + m_pcb->structure->keepouts.push_back( keepout ); PATH* mainPolygon = new PATH( keepout, T_polygon ); keepout->SetShape( mainPolygon ); - mainPolygon->layer_id = layerIds[ kicadLayer2pcb[ layer ] ]; + mainPolygon->layer_id = m_layerIds[ m_kicadLayer2pcb[ layer ] ]; // Handle the main outlines SHAPE_POLY_SET::ITERATOR iterator; @@ -1280,7 +1280,7 @@ void SPECCTRA_DB::FromBOARD( BOARD* aBoard ) window->SetShape( cutout ); - cutout->layer_id = layerIds[ kicadLayer2pcb[ item->GetLayer() ] ]; + cutout->layer_id = m_layerIds[ m_kicadLayer2pcb[ item->GetLayer() ] ]; } isStartContour = iterator.IsEndContour(); @@ -1308,7 +1308,7 @@ void SPECCTRA_DB::FromBOARD( BOARD* aBoard ) //---------------------------- { - PIN_REF empty( pcb->network ); + PIN_REF empty( m_pcb->network ); std::string componentId; @@ -1318,10 +1318,10 @@ void SPECCTRA_DB::FromBOARD( BOARD* aBoard ) deleteNETs(); // expand the net vector to highestNetCode+1, setting empty to NULL - nets.resize( highestNetCode + 1, NULL ); + m_nets.resize( highestNetCode + 1, NULL ); - for( unsigned i = 1 /* skip "No Net" at [0] */; i < nets.size(); ++i ) - nets[i] = new NET( pcb->network ); + for( unsigned i = 1 /* skip "No Net" at [0] */; i < m_nets.size(); ++i ) + m_nets[i] = new NET( m_pcb->network ); for( unsigned ii = 0; ii < aBoard->GetNetCount(); ii++ ) { @@ -1329,12 +1329,12 @@ void SPECCTRA_DB::FromBOARD( BOARD* aBoard ) int netcode = net->GetNet(); if( netcode > 0 ) - nets[ netcode ]->net_id = TO_UTF8( net->GetNetname() ); + m_nets[ netcode ]->net_id = TO_UTF8( net->GetNetname() ); } items.Collect( aBoard, scanMODULEs ); - padstackset.clear(); + m_padstackset.clear(); for( int m = 0; m 0 ) { - NET* net = nets[netcode]; + NET* net = m_nets[netcode]; net->pins.push_back( empty ); @@ -1372,7 +1372,7 @@ void SPECCTRA_DB::FromBOARD( BOARD* aBoard ) } - IMAGE* registered = pcb->library->LookupIMAGE( image ); + IMAGE* registered = m_pcb->library->LookupIMAGE( image ); if( registered != image ) { @@ -1382,7 +1382,7 @@ void SPECCTRA_DB::FromBOARD( BOARD* aBoard ) image = registered; } - COMPONENT* comp = pcb->placement->LookupCOMPONENT( image->GetImageId() ); + COMPONENT* comp = m_pcb->placement->LookupCOMPONENT( image->GetImageId() ); PLACE* place = new PLACE( comp ); @@ -1406,25 +1406,25 @@ void SPECCTRA_DB::FromBOARD( BOARD* aBoard ) // copy the SPECCTRA_DB::padstackset to the LIBRARY. Since we are // removing, do not increment the iterator - for( PADSTACKSET::iterator i = padstackset.begin(); i!=padstackset.end(); - i = padstackset.begin() ) + for( PADSTACKSET::iterator i = m_padstackset.begin(); i != m_padstackset.end(); + i = m_padstackset.begin() ) { - PADSTACKSET::auto_type ps = padstackset.release( i ); + PADSTACKSET::auto_type ps = m_padstackset.release( i ); PADSTACK* padstack = ps.release(); - pcb->library->AddPadstack( padstack ); + m_pcb->library->AddPadstack( padstack ); } // copy our SPECCTRA_DB::nets to the pcb->network - for( unsigned n = 1; npins.size() ) { // give ownership to pcb->network - pcb->network->nets.push_back( net ); - nets[n] = 0; + m_pcb->network->nets.push_back( net ); + m_nets[n] = 0; } } } @@ -1464,8 +1464,8 @@ void SPECCTRA_DB::FromBOARD( BOARD* aBoard ) // we AppendVia() this first one, there is no way it can be a duplicate, // the pcb->library via container is empty at this point. After this, // we'll have to use LookupVia(). - wxASSERT( pcb->library->vias.size() == 0 ); - pcb->library->AppendVia( via ); + wxASSERT( m_pcb->library->vias.size() == 0 ); + m_pcb->library->AppendVia( via ); #if 0 // I've seen no way to make stock vias useable by freerouter. Also the @@ -1502,7 +1502,7 @@ void SPECCTRA_DB::FromBOARD( BOARD* aBoard ) m_top_via_layer, m_bot_via_layer ); // maybe add 'via' to the library, but only if unique. - PADSTACK* registered = pcb->library->LookupVia( via ); + PADSTACK* registered = m_pcb->library->LookupVia( via ); if( registered != via ) delete via; @@ -1521,7 +1521,7 @@ void SPECCTRA_DB::FromBOARD( BOARD* aBoard ) items.Collect( aBoard, scanTRACKs ); std::string netname; - WIRING* wiring = pcb->wiring; + WIRING* wiring = m_pcb->wiring; PATH* path = 0; int old_netcode = -1; @@ -1562,13 +1562,13 @@ void SPECCTRA_DB::FromBOARD( BOARD* aBoard ) wire->wire_type = T_protect; // @todo, this should be configurable LAYER_NUM kiLayer = track->GetLayer(); - int pcbLayer = kicadLayer2pcb[kiLayer]; + int pcbLayer = m_kicadLayer2pcb[kiLayer]; path = new PATH( wire ); wire->SetShape( path ); - path->layer_id = layerIds[pcbLayer]; + path->layer_id = m_layerIds[pcbLayer]; path->aperture_width = scale( old_width ); path->AppendPoint( mapPt( track->GetStart() ) ); @@ -1598,7 +1598,7 @@ void SPECCTRA_DB::FromBOARD( BOARD* aBoard ) continue; PADSTACK* padstack = makeVia( via ); - PADSTACK* registered = pcb->library->LookupVia( padstack ); + PADSTACK* registered = m_pcb->library->LookupVia( padstack ); // if the one looked up is not our padstack, then delete our padstack // since it was a duplicate of one already registered. @@ -1607,9 +1607,9 @@ void SPECCTRA_DB::FromBOARD( BOARD* aBoard ) delete padstack; } - WIRE_VIA* dsnVia = new WIRE_VIA( pcb->wiring ); + WIRE_VIA* dsnVia = new WIRE_VIA( m_pcb->wiring ); - pcb->wiring->wire_vias.push_back( dsnVia ); + m_pcb->wiring->wire_vias.push_back( dsnVia ); dsnVia->padstack_id = registered->padstack_id; dsnVia->vertexes.push_back( mapPt( via->GetPosition() ) ); @@ -1633,11 +1633,11 @@ void SPECCTRA_DB::FromBOARD( BOARD* aBoard ) // Output the vias in the padstack list here, by name only. This must // be done after exporting existing vias as WIRE_VIAs. - VIA* vias = pcb->structure->via; + VIA* vias = m_pcb->structure->via; - for( unsigned viaNdx = 0; viaNdx < pcb->library->vias.size(); ++viaNdx ) + for( unsigned viaNdx = 0; viaNdx < m_pcb->library->vias.size(); ++viaNdx ) { - vias->AppendVia( pcb->library->vias[viaNdx].padstack_id.c_str() ); + vias->AppendVia( m_pcb->library->vias[viaNdx].padstack_id.c_str() ); } } @@ -1687,9 +1687,9 @@ void SPECCTRA_DB::exportNETCLASS( const NETCLASSPTR& aNetClass, BOARD* aBoard ) char text[256]; - CLASS* clazz = new CLASS( pcb->network ); + CLASS* clazz = new CLASS( m_pcb->network ); - pcb->network->classes.push_back( clazz ); + m_pcb->network->classes.push_back( clazz ); // freerouter creates a class named 'default' anyway, and if we // try and use that, we end up with two 'default' via rules so use @@ -1731,7 +1731,7 @@ void SPECCTRA_DB::exportNETCLASS( const NETCLASSPTR& aNetClass, BOARD* aBoard ) } -void SPECCTRA_DB::FlipMODULEs( BOARD* aBoard ) +void SPECCTRA_DB::FlipFOOTPRINTs( BOARD* aBoard ) { // DSN Images (=KiCad FOOTPRINTs and PADs) must be presented from the // top view. @@ -1747,28 +1747,28 @@ void SPECCTRA_DB::FlipMODULEs( BOARD* aBoard ) } } - modulesAreFlipped = true; + m_footprintsAreFlipped = true; } -void SPECCTRA_DB::RevertMODULEs( BOARD* aBoard ) +void SPECCTRA_DB::RevertFOOTPRINTs( BOARD* aBoard ) { - if( !modulesAreFlipped ) + if( !m_footprintsAreFlipped ) return; // DSN Images (=KiCad FOOTPRINTs and PADs) must be presented from the // top view. Restore those that were flipped. // Note: to export footprints, the footprints were flipped around the X axis, - for( auto module : aBoard->Footprints() ) + for( FOOTPRINT* footprint : aBoard->Footprints() ) { - if( module->GetFlag() ) + if( footprint->GetFlag() ) { - module->Flip( module->GetPosition(), false ); - module->SetFlag( 0 ); + footprint->Flip( footprint->GetPosition(), false ); + footprint->SetFlag( 0 ); } } - modulesAreFlipped = false; + m_footprintsAreFlipped = false; } } // namespace DSN diff --git a/pcbnew/specctra_import_export/specctra_import.cpp b/pcbnew/specctra_import_export/specctra_import.cpp index 51e2f247ca..43e2986b22 100644 --- a/pcbnew/specctra_import_export/specctra_import.cpp +++ b/pcbnew/specctra_import_export/specctra_import.cpp @@ -167,12 +167,12 @@ TRACK* SPECCTRA_DB::makeTRACK( PATH* aPath, int aPointIndex, int aNetcode ) wxString::Format( _( "Session file uses invalid layer id \"%s\"" ), layerName ) ); } - TRACK* track = new TRACK( sessionBoard ); + TRACK* track = new TRACK( m_sessionBoard ); - track->SetStart( mapPt( aPath->points[aPointIndex+0], routeResolution ) ); - track->SetEnd( mapPt( aPath->points[aPointIndex+1], routeResolution ) ); - track->SetLayer( pcbLayer2kicad[layerNdx] ); - track->SetWidth( scale( aPath->aperture_width, routeResolution ) ); + track->SetStart( mapPt( aPath->points[aPointIndex+0], m_routeResolution ) ); + track->SetEnd( mapPt( aPath->points[aPointIndex+1], m_routeResolution ) ); + track->SetLayer( m_pcbLayer2kicad[layerNdx] ); + track->SetWidth( scale( aPath->aperture_width, m_routeResolution ) ); track->SetNetCode( aNetcode ); return track; @@ -187,7 +187,7 @@ TRACK* SPECCTRA_DB::makeTRACK( PATH* aPath, int aPointIndex, int aNetcode ) int shapeCount = aPadstack->Length(); int drill_diam_iu = -1; - int copperLayerCount = sessionBoard->GetCopperLayerCount(); + int copperLayerCount = m_sessionBoard->GetCopperLayerCount(); // The drill diameter is encoded in the padstack name if Pcbnew did the DSN export. @@ -226,10 +226,10 @@ TRACK* SPECCTRA_DB::makeTRACK( PATH* aPath, int aPointIndex, int aNetcode ) wxString::Format( _( "Unsupported via shape: %s" ), GetTokenString( type ) ) ); CIRCLE* circle = (CIRCLE*) shape->shape; - int viaDiam = scale( circle->diameter, routeResolution ); + int viaDiam = scale( circle->diameter, m_routeResolution ); - via = new ::VIA( sessionBoard ); - via->SetPosition( mapPt( aPoint, routeResolution ) ); + via = new ::VIA( m_sessionBoard ); + via->SetPosition( mapPt( aPoint, m_routeResolution ) ); via->SetDrill( drill_diam_iu ); via->SetViaType( VIATYPE::THROUGH ); via->SetWidth( viaDiam ); @@ -244,10 +244,10 @@ TRACK* SPECCTRA_DB::makeTRACK( PATH* aPath, int aPointIndex, int aNetcode ) wxString::Format( _( "Unsupported via shape: %s" ), GetTokenString( type ) ) ); CIRCLE* circle = (CIRCLE*) shape->shape; - int viaDiam = scale( circle->diameter, routeResolution ); + int viaDiam = scale( circle->diameter, m_routeResolution ); - via = new ::VIA( sessionBoard ); - via->SetPosition( mapPt( aPoint, routeResolution ) ); + via = new ::VIA( m_sessionBoard ); + via->SetPosition( mapPt( aPoint, m_routeResolution ) ); via->SetDrill( drill_diam_iu ); via->SetViaType( VIATYPE::THROUGH ); via->SetWidth( viaDiam ); @@ -285,11 +285,11 @@ TRACK* SPECCTRA_DB::makeTRACK( PATH* aPath, int aPointIndex, int aNetcode ) botLayerNdx = layerNdx; if( viaDiam == -1 ) - viaDiam = scale( circle->diameter, routeResolution ); + viaDiam = scale( circle->diameter, m_routeResolution ); } - via = new ::VIA( sessionBoard ); - via->SetPosition( mapPt( aPoint, routeResolution ) ); + via = new ::VIA( m_sessionBoard ); + via->SetPosition( mapPt( aPoint, m_routeResolution ) ); via->SetDrill( drill_diam_iu ); if( (topLayerNdx==0 && botLayerNdx==1) @@ -300,8 +300,8 @@ TRACK* SPECCTRA_DB::makeTRACK( PATH* aPath, int aPointIndex, int aNetcode ) via->SetWidth( viaDiam ); - PCB_LAYER_ID topLayer = pcbLayer2kicad[topLayerNdx]; - PCB_LAYER_ID botLayer = pcbLayer2kicad[botLayerNdx]; + PCB_LAYER_ID topLayer = m_pcbLayer2kicad[topLayerNdx]; + PCB_LAYER_ID botLayer = m_pcbLayer2kicad[botLayerNdx]; via->SetLayerPair( topLayer, botLayer ); } @@ -318,15 +318,15 @@ TRACK* SPECCTRA_DB::makeTRACK( PATH* aPath, int aPointIndex, int aNetcode ) void SPECCTRA_DB::FromSESSION( BOARD* aBoard ) { - sessionBoard = aBoard; // not owned here + m_sessionBoard = aBoard; // not owned here - if( !session ) + if( !m_session ) THROW_IO_ERROR( _("Session file is missing the \"session\" section") ); - if( !session->route ) + if( !m_session->route ) THROW_IO_ERROR( _("Session file is missing the \"routes\" section") ); - if( !session->route->library ) + if( !m_session->route->library ) THROW_IO_ERROR( _("Session file is missing the \"library_out\" section") ); // delete all the old tracks and vias @@ -336,12 +336,12 @@ void SPECCTRA_DB::FromSESSION( BOARD* aBoard ) buildLayerMaps( aBoard ); - if( session->placement ) + if( m_session->placement ) { // Walk the PLACEMENT object's COMPONENTs list, and for each PLACE within // each COMPONENT, reposition and re-orient each component and put on // correct side of the board. - COMPONENTS& components = session->placement->components; + COMPONENTS& components = m_session->placement->components; for( COMPONENTS::iterator comp=components.begin(); comp!=components.end(); ++comp ) { PLACES& places = comp->places; @@ -401,10 +401,10 @@ void SPECCTRA_DB::FromSESSION( BOARD* aBoard ) } } - routeResolution = session->route->GetUnits(); + m_routeResolution = m_session->route->GetUnits(); // Walk the NET_OUTs and create tracks and vias anew. - NET_OUTS& net_outs = session->route->net_outs; + NET_OUTS& net_outs = m_session->route->net_outs; for( NET_OUTS::iterator net = net_outs.begin(); net!=net_outs.end(); ++net ) { int netoutCode = 0; @@ -456,7 +456,7 @@ void SPECCTRA_DB::FromSESSION( BOARD* aBoard ) } WIRE_VIAS& wire_vias = net->wire_vias; - LIBRARY& library = *session->route->library; + LIBRARY& library = *m_session->route->library; for( unsigned i=0; iGetViewControls()->SetCrossHairCursorPosition( VECTOR2D( 0, 0 ), false ); m_frame->AddFootprintToBoard( newFootprint ); - // Initialize data relative to nets and netclasses (for a new - // module the defaults are used) - // This is mandatory to handle and draw pads + // Initialize data relative to nets and netclasses (for a new footprint the defaults are + // used). This is mandatory to handle and draw pads. board()->BuildListOfNets(); newFootprint->SetPosition( wxPoint( 0, 0 ) ); newFootprint->ClearFlags(); @@ -191,7 +190,7 @@ int FOOTPRINT_EDITOR_TOOLS::CreateFootprint( const TOOL_EVENT& aEvent ) // Creates the new footprint from python script wizard FOOTPRINT* newFootprint = wizard->GetBuiltFootprint(); - if( newFootprint ) // i.e. if create module command is OK + if( newFootprint ) // i.e. if create footprint command is OK { m_frame->Clear_Pcb( false ); @@ -199,9 +198,8 @@ int FOOTPRINT_EDITOR_TOOLS::CreateFootprint( const TOOL_EVENT& aEvent ) // Add the new object to board m_frame->AddFootprintToBoard( newFootprint ); - // Initialize data relative to nets and netclasses (for a new - // module the defaults are used) - // This is mandatory to handle and draw pads + // Initialize data relative to nets and netclasses (for a new footprint the defaults + // are used). This is mandatory to handle and draw pads. board()->BuildListOfNets(); newFootprint->SetPosition( wxPoint( 0, 0 ) ); newFootprint->ClearFlags(); diff --git a/pcbnew/tools/global_edit_tool.h b/pcbnew/tools/global_edit_tool.h index 7813f817ac..4a9e2805ee 100644 --- a/pcbnew/tools/global_edit_tool.h +++ b/pcbnew/tools/global_edit_tool.h @@ -49,8 +49,8 @@ public: /** * Function ExchangeFootprints() * - * Invoke the dialog used to update or exchange the footprints used for - * modules. The mode depends on the PCB_ACTIONS held by the TOOL_EVENT. + * Invoke the dialog used to update or exchange the footprint definitions used for + * footprints. The mode depends on the PCB_ACTIONS held by the TOOL_EVENT. */ int ExchangeFootprints( const TOOL_EVENT& aEvent ); diff --git a/pcbnew/tools/pad_tool.h b/pcbnew/tools/pad_tool.h index 45aac0593d..614e761b70 100644 --- a/pcbnew/tools/pad_tool.h +++ b/pcbnew/tools/pad_tool.h @@ -54,7 +54,7 @@ public: /** * Function PlacePad() - * Places a pad in module editor. + * Places a pad in footprint editor. */ int PlacePad( const TOOL_EVENT& aEvent ); @@ -76,7 +76,7 @@ private: ///> Copy pad settings from a pad to the board design settings int copyPadSettings( const TOOL_EVENT& aEvent ); - ///> Push pad settings from a pad to other pads on board or module + ///> Push pad settings from a pad to other pads on board or footprint int pushPadSettings( const TOOL_EVENT& aEvent ); PCB_LAYER_ID explodePad( PAD* aPad ); diff --git a/pcbnew/tools/pcb_actions.h b/pcbnew/tools/pcb_actions.h index dad9dd4222..1ee97590fb 100644 --- a/pcbnew/tools/pcb_actions.h +++ b/pcbnew/tools/pcb_actions.h @@ -380,7 +380,7 @@ public: /// Tool for creating an array of objects static TOOL_ACTION createArray; - /// Display module edges as outlines + /// Display footprint graphics as outlines static TOOL_ACTION graphicsOutlines; /// Display texts as lines @@ -394,7 +394,7 @@ public: /// Copy the default pad settings to the selected pad static TOOL_ACTION applyPadSettings; - /// Copy the current pad's settings to other pads in the module or on the board + /// Copy the current pad's settings to other pads in the footprint or on the board static TOOL_ACTION pushPadSettings; // Microwave tools diff --git a/pcbnew/tools/pcb_editor_control.h b/pcbnew/tools/pcb_editor_control.h index 9e3b200af4..26f4c08741 100644 --- a/pcbnew/tools/pcb_editor_control.h +++ b/pcbnew/tools/pcb_editor_control.h @@ -96,7 +96,7 @@ public: /** * Function PlaceModule() - * Displays a dialog to select a module to be added and allows the user to set its position. + * Displays a dialog to select a footprint to be added and allows the user to set its position. */ int PlaceModule( const TOOL_EVENT& aEvent ); diff --git a/pcbnew/tools/pcb_tool_base.h b/pcbnew/tools/pcb_tool_base.h index 3c5399cab3..a74f886d7e 100644 --- a/pcbnew/tools/pcb_tool_base.h +++ b/pcbnew/tools/pcb_tool_base.h @@ -97,7 +97,7 @@ public: /** * Function SetIsFootprintEditor() * - * Toggles edit module mode. When enabled, one may select parts of footprints individually + * Toggles edit footprint mode. When enabled, one may select parts of footprints individually * (graphics, pads, etc.), so they can be modified. * @param aEnabled decides if the mode should be enabled. */ diff --git a/pcbnew/tools/pcb_viewer_tools.h b/pcbnew/tools/pcb_viewer_tools.h index 807144ee25..1c555b7240 100644 --- a/pcbnew/tools/pcb_viewer_tools.h +++ b/pcbnew/tools/pcb_viewer_tools.h @@ -68,7 +68,7 @@ public: void setTransitions() override; /** - * Toggles edit module mode. When enabled, one may select parts of footprints individually + * Toggles edit footprint mode. When enabled, one may select parts of footprints individually * (graphics, pads, etc.), so they can be modified. * @param aEnabled decides if the mode should be enabled. */ diff --git a/pcbnew/tools/pcbnew_control.cpp b/pcbnew/tools/pcbnew_control.cpp index 3164d34148..80e4de8781 100644 --- a/pcbnew/tools/pcbnew_control.cpp +++ b/pcbnew/tools/pcbnew_control.cpp @@ -952,19 +952,19 @@ int PCBNEW_CONTROL::AppendBoard( PLUGIN& pi, wxString& fileName ) // Mark existing items, in order to know what are the new items so we can select only // the new items after loading - for( auto track : brd->Tracks() ) + for( TRACK* track : brd->Tracks() ) track->SetFlags( SKIP_STRUCT ); - for( auto module : brd->Footprints() ) - module->SetFlags( SKIP_STRUCT ); + for( FOOTPRINT* footprint : brd->Footprints() ) + footprint->SetFlags( SKIP_STRUCT ); - for( auto group : brd->Groups() ) + for( PCB_GROUP* group : brd->Groups() ) group->SetFlags( SKIP_STRUCT ); - for( auto drawing : brd->Drawings() ) + for( BOARD_ITEM* drawing : brd->Drawings() ) drawing->SetFlags( SKIP_STRUCT ); - for( auto zone : brd->Zones() ) + for( ZONE* zone : brd->Zones() ) zone->SetFlags( SKIP_STRUCT ); std::map oldProperties = brd->GetProperties(); diff --git a/pcbnew/tools/selection_tool.cpp b/pcbnew/tools/selection_tool.cpp index 587edafcda..61370488d9 100644 --- a/pcbnew/tools/selection_tool.cpp +++ b/pcbnew/tools/selection_tool.cpp @@ -1212,9 +1212,8 @@ void SELECTION_TOOL::selectAllItemsOnSheet( wxString& aSheetPath ) for( PAD* pad : padList ) selectConnectedTracks( *pad, STOP_NEVER ); - // now we need to find all footprints that are connected to each of these nets - // then we need to determine if these modules are in the list of footprints - // belonging to this sheet ( modList ) + // now we need to find all footprints that are connected to each of these nets then we need + // to determine if these footprints are in the list of footprints belonging to this sheet std::list removeCodeList; constexpr KICAD_T padType[] = { PCB_PAD_T, EOT }; @@ -1224,9 +1223,9 @@ void SELECTION_TOOL::selectAllItemsOnSheet( wxString& aSheetPath ) { if( mitem->Type() == PCB_PAD_T && !alg::contains( footprintList, mitem->GetParent() ) ) { - // if we cannot find the module of the pad in the modList - // then we can assume that that module is not located in the same - // schematic, therefore invalidate this netcode. + // if we cannot find the footprint of the pad in the footprintList then we can + // assume that that footprint is not located in the same schematic, therefore + // invalidate this netcode. removeCodeList.push_back( netCode ); break; } @@ -1612,7 +1611,7 @@ void SELECTION_TOOL::RebuildSelection() { EDA_ITEM* parent = item->GetParent(); - // Flags on module children might be set only because the parent is selected. + // Flags on footprint children might be set only because the parent is selected. if( parent && parent->Type() == PCB_FOOTPRINT_T && parent->IsSelected() ) return SEARCH_RESULT::CONTINUE; @@ -1877,7 +1876,7 @@ bool SELECTION_TOOL::Selectable( const BOARD_ITEM* aItem, bool checkVisibilityOn case PCB_FOOTPRINT_T: { - // In modedit, we do not want to select the module itself. + // In footprint editor, we do not want to select the footprint itself. if( m_isFootprintEditor ) return false; @@ -1908,8 +1907,9 @@ bool SELECTION_TOOL::Selectable( const BOARD_ITEM* aItem, bool checkVisibilityOn case PCB_FP_TEXT_T: // Multiple selection is only allowed in modedit mode. In pcbnew, you have to select - // module subparts one by one, rather than with a drag selection. This is so you can - // pick up items under an (unlocked) module without also moving the module's sub-parts. + // footprint subparts one by one, rather than with a drag selection. This is so you can + // pick up items under an (unlocked) footprint without also moving the footprint's + // sub-parts. if( !m_isFootprintEditor && !checkVisibilityOnly ) { if( m_multiple && !settings->GetHighContrast() ) @@ -1931,8 +1931,9 @@ bool SELECTION_TOOL::Selectable( const BOARD_ITEM* aItem, bool checkVisibilityOn case PCB_PAD_T: { // Multiple selection is only allowed in modedit mode. In pcbnew, you have to select - // module subparts one by one, rather than with a drag selection. This is so you can - // pick up items under an (unlocked) module without also moving the module's sub-parts. + // footprint subparts one by one, rather than with a drag selection. This is so you can + // pick up items under an (unlocked) footprint without also moving the footprint's + // sub-parts. if( !m_isFootprintEditor && !checkVisibilityOnly ) { if( m_multiple ) @@ -1972,8 +1973,8 @@ bool SELECTION_TOOL::Selectable( const BOARD_ITEM* aItem, bool checkVisibilityOn { PCB_GROUP* group = const_cast( static_cast( aItem ) ); - // Similar to logic for module, a group is selectable if any of its - // members are. (This recurses.) + // Similar to logic for footprint, a group is selectable if any of its members are. + // (This recurses.) for( BOARD_ITEM* item : group->GetItems() ) { if( Selectable( item, true ) ) @@ -2122,7 +2123,7 @@ void SELECTION_TOOL::unhighlightInternal( BOARD_ITEM* aItem, int aMode, } // footprints are treated in a special way - when they are highlighted, we have to - // highlight all the parts that make the module, not the module itself + // highlight all the parts that make the footprint, not the footprint itself if( aItem->Type() == PCB_FOOTPRINT_T ) { static_cast( aItem )->RunOnChildren( diff --git a/qa/eeschema/CMakeLists.txt b/qa/eeschema/CMakeLists.txt index daa3632a83..82b3552225 100644 --- a/qa/eeschema/CMakeLists.txt +++ b/qa/eeschema/CMakeLists.txt @@ -39,7 +39,7 @@ set( QA_EESCHEMA_SRCS uuid_test_utils.cpp # The main test entry points - test_module.cpp + test_footprint.cpp # Base internal units (1=100nm) testing. test_sch_biu.cpp diff --git a/qa/eeschema/test_module.cpp b/qa/eeschema/test_module.cpp deleted file mode 100644 index 732f88b7e2..0000000000 --- a/qa/eeschema/test_module.cpp +++ /dev/null @@ -1,68 +0,0 @@ -/* - * This program source code file is part of KiCad, a free EDA CAD application. - * - * Copyright (C) 2017 CERN - * @author Alejandro GarcĂ­a Montoro - * Copyright (C) 2019 KiCad Developers, see AUTHORS.txt for contributors. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, you may find one here: - * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html - * or you may search the http://www.gnu.org website for the version 2 license, - * or you may write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA - */ - -/** - * Main file for the Eeschema tests to be compiled - */ -#include - -#include - -#include - -/* - * Simple function to handle a WX assertion and throw a real exception. - * - * This is useful when you want to check assertions fire in unit tests. - */ -void wxAssertThrower( const wxString& aFile, int aLine, const wxString& aFunc, - const wxString& aCond, const wxString& aMsg ) -{ - throw KI_TEST::WX_ASSERT_ERROR( aFile, aLine, aFunc, aCond, aMsg ); -} - - -bool init_unit_test() -{ - boost::unit_test::framework::master_test_suite().p_name.value = "Common Eeschema module tests"; - - bool ok = wxInitialize(); - - wxSetAssertHandler( &wxAssertThrower ); - - return ok; -} - - -int main( int argc, char* argv[] ) -{ - int ret = boost::unit_test::unit_test_main( &init_unit_test, argc, argv ); - - // This causes some glib warnings on GTK3 (http://trac.wxwidgets.org/ticket/18274) - // but without it, Valgrind notices a lot of leaks from WX - wxUninitialize(); - - return ret; -} \ No newline at end of file diff --git a/qa/pcbnew/test_array_pad_name_provider.cpp b/qa/pcbnew/test_array_pad_name_provider.cpp index b516ea9cd2..395e5459ef 100644 --- a/qa/pcbnew/test_array_pad_name_provider.cpp +++ b/qa/pcbnew/test_array_pad_name_provider.cpp @@ -36,9 +36,9 @@ #include /** - * Make a module with a given list of named pads + * Make a footprint with a given list of named pads */ -static std::unique_ptr ModuleWithPads( const std::vector aNames ) +static std::unique_ptr FootprintWithPads( const std::vector aNames ) { std::unique_ptr footprint = std::make_unique( nullptr ); @@ -63,7 +63,7 @@ BOOST_AUTO_TEST_SUITE( ArrayPadNameProv ) struct APNP_CASE { std::string m_case_name; - bool m_using_module; + bool m_using_footprint; std::vector m_existing_pads; std::unique_ptr m_arr_opts; std::vector m_exp_arr_names; @@ -71,10 +71,10 @@ struct APNP_CASE /** - * Get Array Pad Name Provider cases when a module is looked - * at to determine what names are available. + * Get Array Pad Name Provider cases when a footprint is looked at to determine what names + * are available. */ -std::vector GetModuleAPNPCases() +std::vector GetFootprintAPNPCases() { std::vector cases; @@ -93,7 +93,7 @@ std::vector GetModuleAPNPCases() { "2", "4", "5", "6", "7" }, } ); - // one without a module + // one without a footprint opts = std::make_unique(); // simple linear numbering (again) @@ -102,7 +102,7 @@ std::vector GetModuleAPNPCases() opts->m_pri_axis.SetAxisType( ARRAY_AXIS::NUMBERING_TYPE::NUMBERING_NUMERIC ); cases.push_back( { - "Simple linear, no module", + "Simple linear, no footprint", false, {}, // not used std::move( opts ), @@ -135,20 +135,18 @@ void CheckPadNameProvider( ARRAY_PAD_NAME_PROVIDER& aProvider, std::vector module; + std::unique_ptr footprint; - if( c.m_using_module ) - { - module = ModuleWithPads( c.m_existing_pads ); - } + if( c.m_using_footprint ) + footprint = FootprintWithPads( c.m_existing_pads ); - ARRAY_PAD_NAME_PROVIDER apnp( module.get(), *c.m_arr_opts ); + ARRAY_PAD_NAME_PROVIDER apnp( footprint.get(), *c.m_arr_opts ); CheckPadNameProvider( apnp, c.m_exp_arr_names ); } diff --git a/qa/pcbnew_utils/include/pcbnew_utils/board_construction_utils.h b/qa/pcbnew_utils/include/pcbnew_utils/board_construction_utils.h index 07559747e7..5df63d4353 100644 --- a/qa/pcbnew_utils/include/pcbnew_utils/board_construction_utils.h +++ b/qa/pcbnew_utils/include/pcbnew_utils/board_construction_utils.h @@ -42,8 +42,8 @@ namespace KI_TEST { /** - * Draw a segment in the given module. - * @param aMod The module to add the segment to + * Draw a segment in the given footprint. + * @param aMod The footprint to add the segment to * @param aSeg The segment geometry * @param aWidth The width of the segment * @param aLayer The layer to draw on @@ -52,7 +52,7 @@ void DrawSegment( FOOTPRINT& aFootprint, const SEG& aSeg, int aWidth, PCB_LAYER_ /** * Draw a polyline - a set of linked segments - * @param aMod The module to add the segment to + * @param aMod The footprint to add the segment to * @param aPts The polyline points * @param aWidth The width of the segments * @param aLayer The layer to draw on @@ -61,8 +61,8 @@ void DrawPolyline( FOOTPRINT& aFootprint, const std::vector& aPts, int PCB_LAYER_ID aLayer ); /** - * Draw an arc on a module - * @param aMod The module to add the segment to + * Draw an arc on a footprint + * @param aMod The footprint to add the segment to * @param aCentre The arc centre * @param aStart The arc start point * @param aAngle The arc angle (degrees, NOT deci-degrees) @@ -73,8 +73,8 @@ void DrawArc( FOOTPRINT& aFootprint, const VECTOR2I& aCentre, const VECTOR2I& aS double aAngle, int aWidth, PCB_LAYER_ID aLayer ); /** - * Draw a rectangle on a module - * @param aMod The module to add the rectangle to + * Draw a rectangle on a footprint + * @param aMod The footprint to add the rectangle to * @param aPos Rectangle centre point * @param aSize Rectangle size (x, y) * @param aRadius Corner radius (0 for a normal rect) diff --git a/qa/utils/kicad2step/test_module.cpp b/qa/utils/kicad2step/test_module.cpp index de2d16561c..049baa53f3 100644 --- a/qa/utils/kicad2step/test_module.cpp +++ b/qa/utils/kicad2step/test_module.cpp @@ -31,7 +31,7 @@ bool init_unit_test() { - boost::unit_test::framework::master_test_suite().p_name.value = "S-expression module tests"; + boost::unit_test::framework::master_test_suite().p_name.value = "S-expression footprint tests"; return wxInitialize(); } diff --git a/utils/kicad2step/pcb/base.h b/utils/kicad2step/pcb/base.h index 0e86900769..5a545755ba 100644 --- a/utils/kicad2step/pcb/base.h +++ b/utils/kicad2step/pcb/base.h @@ -53,8 +53,8 @@ enum CURVE_TYPE /* * Layers of importance to MCAD export: - * LAYER_TOP: specifies that a module is on the top of the PCB - * LAYER_BOTTOM: specifies that a module is on the bottom of the PCB + * LAYER_TOP: specifies that a footprint is on the top of the PCB + * LAYER_BOTTOM: specifies that a footprint is on the bottom of the PCB * LAYER_EDGE: specifies that a Curve is associated with the PCB edge */ enum LAYERS diff --git a/utils/kicad2step/pcb/kicadpcb.cpp b/utils/kicad2step/pcb/kicadpcb.cpp index 0b1d6d3ca9..636a5513ee 100644 --- a/utils/kicad2step/pcb/kicadpcb.cpp +++ b/utils/kicad2step/pcb/kicadpcb.cpp @@ -103,7 +103,7 @@ KICADPCB::KICADPCB() KICADPCB::~KICADPCB() { - for( auto i : m_modules ) + for( auto i : m_footprints ) delete i; for( auto i : m_curves ) @@ -368,41 +368,41 @@ bool KICADPCB::parseSetup( SEXPR::SEXPR* data ) bool KICADPCB::parseModule( SEXPR::SEXPR* data ) { - KICADFOOTPRINT* mp = new KICADFOOTPRINT( this ); + KICADFOOTPRINT* footprint = new KICADFOOTPRINT( this ); - if( !mp->Read( data ) ) + if( !footprint->Read( data ) ) { - delete mp; + delete footprint; return false; } - m_modules.push_back( mp ); + m_footprints.push_back( footprint ); return true; } bool KICADPCB::parseRect( SEXPR::SEXPR* data ) { - KICADCURVE* mp = new KICADCURVE(); + KICADCURVE* rect = new KICADCURVE(); - if( !mp->Read( data, CURVE_LINE ) ) + if( !rect->Read( data, CURVE_LINE ) ) { - delete mp; + delete rect; return false; } // reject any curves not on the Edge.Cuts layer - if( mp->GetLayer() != LAYER_EDGE ) + if( rect->GetLayer() != LAYER_EDGE ) { - delete mp; + delete rect; return true; } - KICADCURVE* top = new KICADCURVE( *mp ); - KICADCURVE* right = new KICADCURVE( *mp ); - KICADCURVE* bottom = new KICADCURVE( *mp ); - KICADCURVE* left = new KICADCURVE( *mp ); - delete mp; + KICADCURVE* top = new KICADCURVE( *rect ); + KICADCURVE* right = new KICADCURVE( *rect ); + KICADCURVE* bottom = new KICADCURVE( *rect ); + KICADCURVE* left = new KICADCURVE( *rect ); + delete rect; top->m_end.y = right->m_start.y; m_curves.push_back( top ); @@ -422,22 +422,22 @@ bool KICADPCB::parseRect( SEXPR::SEXPR* data ) bool KICADPCB::parseCurve( SEXPR::SEXPR* data, CURVE_TYPE aCurveType ) { - KICADCURVE* mp = new KICADCURVE(); + KICADCURVE* curve = new KICADCURVE(); - if( !mp->Read( data, aCurveType ) ) + if( !curve->Read( data, aCurveType ) ) { - delete mp; + delete curve; return false; } // reject any curves not on the Edge.Cuts layer - if( mp->GetLayer() != LAYER_EDGE ) + if( curve->GetLayer() != LAYER_EDGE ) { - delete mp; + delete curve; return true; } - m_curves.push_back( mp ); + m_curves.push_back( curve ); return true; } @@ -447,7 +447,7 @@ bool KICADPCB::ComposePCB( bool aComposeVirtual ) if( m_pcb_model ) return true; - if( m_modules.empty() && m_curves.empty() ) + if( m_footprints.empty() && m_curves.empty() ) { ReportMessage( "Error: no PCB data (no footprint, no outline) to render\n" ); return false; @@ -499,7 +499,7 @@ bool KICADPCB::ComposePCB( bool aComposeVirtual ) m_pcb_model->AddOutlineSegment( &lcurve ); } - for( auto i : m_modules ) + for( auto i : m_footprints ) i->ComposePCB( m_pcb_model, &m_resolver, origin, aComposeVirtual ); ReportMessage( "Create PCB solid model\n" ); diff --git a/utils/kicad2step/pcb/kicadpcb.h b/utils/kicad2step/pcb/kicadpcb.h index b82f3005ca..e9ad275bbe 100644 --- a/utils/kicad2step/pcb/kicadpcb.h +++ b/utils/kicad2step/pcb/kicadpcb.h @@ -70,9 +70,9 @@ private: std::map m_layersNames; // PCB parameters/entities - double m_thickness; - std::vector< KICADFOOTPRINT* > m_modules; - std::vector< KICADCURVE* > m_curves; + double m_thickness; + std::vector m_footprints; + std::vector m_curves; bool parsePCB( SEXPR::SEXPR* data ); bool parseGeneral( SEXPR::SEXPR* data );