mirror of
https://gitlab.com/kicad/code/kicad.git
synced 2025-04-21 00:21:25 +00:00
RIP LIB_PIN.
This commit is contained in:
parent
6d11c85cad
commit
95136494b3
common
eeschema
CMakeLists.txtsch_painter.cppsch_painter.hsch_pin.cppsch_pin.hsch_screen.cppsch_screen.hsch_symbol.cppsch_symbol.hsch_view.h
api
autoplace_fields.cppconnection_graph.cppdialogs
dialog_erc.hdialog_field_properties.cppdialog_lib_edit_pin_table.cppdialog_lib_edit_pin_table.hdialog_pin_properties.cppdialog_pin_properties.hdialog_sim_model.cppdialog_sim_model.hdialog_symbol_properties.cpppanel_eeschema_color_settings.cpppanel_setup_pinmap.h
ee_collectors.cpperc.cppfields_grid_table.cpplib_pin.cpplib_pin.hlib_symbol.cpplib_symbol.hnetlist_exporters
netlist_exporter_allegro.cppnetlist_exporter_allegro.hnetlist_exporter_base.hnetlist_exporter_xml.cpp
pin_type.cpppin_type.hsch_connection.cppsch_io
altium
cadstar
eagle
easyeda
easyedapro
kicad_legacy
kicad_sexpr
sch_io_kicad_sexpr.cppsch_io_kicad_sexpr_common.hsch_io_kicad_sexpr_lib_cache.cppsch_io_kicad_sexpr_lib_cache.hsch_io_kicad_sexpr_parser.cppsch_io_kicad_sexpr_parser.h
ltspice
sim
symbol.hsymbol_checker.cppsymbol_editor
tools
backannotate.cppee_actions.cppee_grid_helper.cppee_selection.cppee_selection_tool.cppsch_edit_tool.cppsch_editor_control.cppsymbol_editor_drawing_tools.cppsymbol_editor_edit_tool.cppsymbol_editor_edit_tool.hsymbol_editor_move_tool.cppsymbol_editor_pin_tool.cppsymbol_editor_pin_tool.h
widgets
include/core
qa/tests
@ -75,7 +75,6 @@ KICAD_T FromProtoEnum( types::KiCadObjectType aValue )
|
||||
case types::KiCadObjectType::KOT_SCH_SHEET: return SCH_SHEET_T;
|
||||
case types::KiCadObjectType::KOT_SCH_PIN: return SCH_PIN_T;
|
||||
case types::KiCadObjectType::KOT_LIB_SYMBOL: return LIB_SYMBOL_T;
|
||||
// case types::KiCadObjectType::KOT_LIB_PIN: return LIB_PIN_T;
|
||||
case types::KiCadObjectType::KOT_WSG_LINE: return WSG_LINE_T;
|
||||
case types::KiCadObjectType::KOT_WSG_RECT: return WSG_RECT_T;
|
||||
case types::KiCadObjectType::KOT_WSG_POLY: return WSG_POLY_T;
|
||||
@ -135,7 +134,6 @@ types::KiCadObjectType ToProtoEnum( KICAD_T aValue )
|
||||
case SCH_SHEET_T: return types::KiCadObjectType::KOT_SCH_SHEET;
|
||||
case SCH_PIN_T: return types::KiCadObjectType::KOT_SCH_PIN;
|
||||
case LIB_SYMBOL_T: return types::KiCadObjectType::KOT_LIB_SYMBOL;
|
||||
// case LIB_PIN_T: return types::KiCadObjectType::KOT_LIB_PIN;
|
||||
case WSG_LINE_T: return types::KiCadObjectType::KOT_WSG_LINE;
|
||||
case WSG_RECT_T: return types::KiCadObjectType::KOT_WSG_RECT;
|
||||
case WSG_POLY_T: return types::KiCadObjectType::KOT_WSG_POLY;
|
||||
|
@ -396,7 +396,6 @@ static struct EDA_ITEM_DESC
|
||||
.Map( SCH_SCREEN_T, _HKI( "SCH Screen" ) )
|
||||
|
||||
.Map( LIB_SYMBOL_T, _HKI( "Symbol" ) )
|
||||
.Map( LIB_PIN_T, _HKI( "Pin" ) )
|
||||
|
||||
.Map( GERBER_LAYOUT_T, _HKI( "Gerber Layout" ) )
|
||||
.Map( GERBER_DRAW_ITEM_T, _HKI( "Draw Item" ) )
|
||||
|
@ -151,8 +151,13 @@ void GRPrintText( wxDC* aDC, const VECTOR2I& aPos, const COLOR4D& aColor, const
|
||||
if( !aFont )
|
||||
aFont = KIFONT::FONT::GetFont();
|
||||
|
||||
if( aWidth == 0 && aBold ) // Use default values if aWidth == 0
|
||||
aWidth = GetPenSizeForBold( std::min( aSize.x, aSize.y ) );
|
||||
if( aWidth == 0 ) // Use default values if aWidth == 0
|
||||
{
|
||||
if( aBold )
|
||||
aWidth = GetPenSizeForBold( std::min( aSize.x, aSize.y ) );
|
||||
else
|
||||
aWidth = GetPenSizeForNormal( std::min( aSize.x, aSize.y ) );
|
||||
}
|
||||
|
||||
if( aWidth < 0 )
|
||||
{
|
||||
|
@ -353,7 +353,6 @@ set( EESCHEMA_SRCS
|
||||
generate_alias_info.cpp
|
||||
gfx_import_utils.cpp
|
||||
picksymbol.cpp
|
||||
lib_pin.cpp
|
||||
lib_symbol.cpp
|
||||
libarch.cpp
|
||||
menubar.cpp
|
||||
|
@ -18,7 +18,7 @@
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <lib_pin.h>
|
||||
#include <sch_pin.h>
|
||||
#include <lib_symbol.h>
|
||||
#include <sch_bitmap.h>
|
||||
#include <sch_bus_entry.h>
|
||||
@ -41,10 +41,6 @@
|
||||
std::unique_ptr<EDA_ITEM> CreateItemForType( KICAD_T aType, EDA_ITEM* aContainer )
|
||||
{
|
||||
SCH_ITEM* parentSchItem = dynamic_cast<SCH_ITEM*>( aContainer );
|
||||
LIB_SYMBOL* parentLibSymbol = nullptr;
|
||||
|
||||
if( aContainer && aContainer->Type() == LIB_SYMBOL_T )
|
||||
parentLibSymbol = static_cast<LIB_SYMBOL*>( aContainer );
|
||||
|
||||
switch( aType )
|
||||
{
|
||||
@ -83,13 +79,13 @@ std::unique_ptr<EDA_ITEM> CreateItemForType( KICAD_T aType, EDA_ITEM* aContainer
|
||||
|
||||
case SCH_PIN_T:
|
||||
{
|
||||
// TODO: constructing currently requires LIB_PIN and SCH_SYMBOL ptr,
|
||||
// or SCH_SYMBOL and number+alt. Need to determine ideal default ctor.
|
||||
if( aContainer && aContainer->Type() == LIB_SYMBOL_T )
|
||||
return std::make_unique<SCH_PIN>( static_cast<LIB_SYMBOL*>( aContainer ) );
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
case LIB_SYMBOL_T: return nullptr; // TODO: ctor currently requires non-null name
|
||||
case LIB_PIN_T: return std::make_unique<LIB_PIN>( parentLibSymbol );
|
||||
|
||||
default:
|
||||
return nullptr;
|
||||
|
@ -53,10 +53,9 @@
|
||||
#include <boost/range/adaptor/reversed.hpp>
|
||||
|
||||
#include <sch_edit_frame.h>
|
||||
#include <hotkeys_basic.h>
|
||||
#include <sch_symbol.h>
|
||||
#include <sch_line.h>
|
||||
#include <lib_pin.h>
|
||||
#include <sch_pin.h>
|
||||
#include <kiface_base.h>
|
||||
#include <algorithm>
|
||||
#include <tool/tool_manager.h>
|
||||
|
@ -654,9 +654,7 @@ void CONNECTION_GRAPH::Recalculate( const SCH_SHEET_LIST& aSheetList, bool aUnco
|
||||
}
|
||||
else if( item->Type() == SCH_SHEET_T )
|
||||
{
|
||||
SCH_SHEET* sheet = static_cast<SCH_SHEET*>( item );
|
||||
|
||||
for( SCH_SHEET_PIN* pin : sheet->GetPins() )
|
||||
for( SCH_SHEET_PIN* pin : static_cast<SCH_SHEET*>( item )->GetPins() )
|
||||
{
|
||||
if( pin->IsConnectivityDirty() )
|
||||
{
|
||||
@ -976,7 +974,7 @@ void CONNECTION_GRAPH::removeSubgraphs( std::set<CONNECTION_SUBGRAPH*>& aSubgrap
|
||||
|
||||
for( auto it = m_net_name_to_code_map.begin(); it != m_net_name_to_code_map.end(); )
|
||||
{
|
||||
if( codes_to_remove.find( it->second ) != codes_to_remove.end() )
|
||||
if( codes_to_remove.contains( it->second ) )
|
||||
it = m_net_name_to_code_map.erase( it );
|
||||
else
|
||||
++it;
|
||||
@ -984,7 +982,7 @@ void CONNECTION_GRAPH::removeSubgraphs( std::set<CONNECTION_SUBGRAPH*>& aSubgrap
|
||||
|
||||
for( auto it = m_bus_name_to_code_map.begin(); it != m_bus_name_to_code_map.end(); )
|
||||
{
|
||||
if( codes_to_remove.find( it->second ) != codes_to_remove.end() )
|
||||
if( codes_to_remove.contains( it->second ) )
|
||||
it = m_bus_name_to_code_map.erase( it );
|
||||
else
|
||||
++it;
|
||||
@ -1657,7 +1655,7 @@ void CONNECTION_GRAPH::processSubGraphs()
|
||||
{
|
||||
wxString new_name = create_new_name( connection );
|
||||
|
||||
while( m_net_name_to_subgraphs_map.count( new_name ) )
|
||||
while( m_net_name_to_subgraphs_map.contains( new_name ) )
|
||||
new_name = create_new_name( connection );
|
||||
|
||||
wxLogTrace( ConnTrace,
|
||||
@ -2388,7 +2386,7 @@ void CONNECTION_GRAPH::propagateToNeighbors( CONNECTION_SUBGRAPH* aSubgraph, boo
|
||||
{
|
||||
if( !candidate->m_strong_driver
|
||||
|| candidate->m_hier_ports.empty()
|
||||
|| visited.count( candidate ) )
|
||||
|| visited.contains( candidate ) )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
@ -2425,7 +2423,7 @@ void CONNECTION_GRAPH::propagateToNeighbors( CONNECTION_SUBGRAPH* aSubgraph, boo
|
||||
for( CONNECTION_SUBGRAPH* candidate : it->second )
|
||||
{
|
||||
if( candidate->m_hier_pins.empty()
|
||||
|| visited.count( candidate )
|
||||
|| visited.contains( candidate )
|
||||
|| candidate->m_driver_connection->Type() != aParent->m_driver_connection->Type() )
|
||||
{
|
||||
continue;
|
||||
@ -3470,7 +3468,7 @@ bool CONNECTION_GRAPH::ercCheckNoConnects( const CONNECTION_SUBGRAPH* aSubgraph
|
||||
if( pin )
|
||||
{
|
||||
ercItem->SetItems( pin, aSubgraph->m_no_connect );
|
||||
pos = pin->GetTransformedPosition();
|
||||
pos = pin->GetPosition();
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -3586,7 +3584,7 @@ bool CONNECTION_GRAPH::ercCheckNoConnects( const CONNECTION_SUBGRAPH* aSubgraph
|
||||
ercItem->SetItemsSheetPaths( sheet );
|
||||
ercItem->SetItems( pin );
|
||||
|
||||
SCH_MARKER* marker = new SCH_MARKER( ercItem, pin->GetTransformedPosition() );
|
||||
SCH_MARKER* marker = new SCH_MARKER( ercItem, pin->GetPosition() );
|
||||
screen->Append( marker );
|
||||
|
||||
ok = false;
|
||||
@ -3611,8 +3609,7 @@ bool CONNECTION_GRAPH::ercCheckNoConnects( const CONNECTION_SUBGRAPH* aSubgraph
|
||||
ercItem->SetItemsSheetPaths( sheet );
|
||||
ercItem->SetItems( testPin );
|
||||
|
||||
SCH_MARKER* marker = new SCH_MARKER( ercItem,
|
||||
testPin->GetTransformedPosition() );
|
||||
SCH_MARKER* marker = new SCH_MARKER( ercItem, testPin->GetPosition() );
|
||||
screen->Append( marker );
|
||||
|
||||
ok = false;
|
||||
|
@ -26,11 +26,9 @@
|
||||
#define _DIALOG_ERC_H_
|
||||
|
||||
#include <wx/htmllbox.h>
|
||||
#include <lib_pin.h> // For PINTYPE_COUNT definition
|
||||
|
||||
#include <dialog_erc_base.h>
|
||||
#include <widgets/progress_reporter_base.h>
|
||||
#include <erc_settings.h>
|
||||
|
||||
|
||||
/**
|
||||
|
@ -162,14 +162,10 @@ DIALOG_FIELD_PROPERTIES::DIALOG_FIELD_PROPERTIES( SCH_BASE_FRAME* aParent, const
|
||||
* pinNumber pinName <tab> pinNumber pinName...
|
||||
* fpFilter fpFilter...
|
||||
*/
|
||||
wxString netlist;
|
||||
|
||||
std::vector<LIB_PIN*> pinList;
|
||||
symbol->GetPins( pinList, 0, 1 ); // All units, but a single convert
|
||||
|
||||
wxString netlist;
|
||||
wxArrayString pins;
|
||||
|
||||
for( LIB_PIN* pin : pinList )
|
||||
for( SCH_PIN* pin : symbol->GetPins( 0 /* all units */, 1 /* single bodyStyle */ ) )
|
||||
pins.push_back( pin->GetNumber() + ' ' + pin->GetShownName() );
|
||||
|
||||
if( !pins.IsEmpty() )
|
||||
|
@ -23,8 +23,8 @@
|
||||
|
||||
#include "dialog_lib_edit_pin_table.h"
|
||||
#include "grid_tricks.h"
|
||||
#include "lib_pin.h"
|
||||
#include "pin_numbers.h"
|
||||
#include <sch_pin.h>
|
||||
#include <pin_numbers.h>
|
||||
#include "pgm_base.h"
|
||||
#include <base_units.h>
|
||||
#include <bitmaps.h>
|
||||
@ -155,7 +155,7 @@ public:
|
||||
return GetValue( m_rows[ aRow ], aCol, m_frame );
|
||||
}
|
||||
|
||||
static wxString GetValue( const std::vector<LIB_PIN*>& pins, int aCol,
|
||||
static wxString GetValue( const std::vector<SCH_PIN*>& pins, int aCol,
|
||||
EDA_DRAW_FRAME* aParentFrame )
|
||||
{
|
||||
wxString fieldValue;
|
||||
@ -163,7 +163,7 @@ public:
|
||||
if( pins.empty() )
|
||||
return fieldValue;
|
||||
|
||||
for( LIB_PIN* pin : pins )
|
||||
for( SCH_PIN* pin : pins )
|
||||
{
|
||||
wxString val;
|
||||
|
||||
@ -292,7 +292,7 @@ public:
|
||||
break;
|
||||
}
|
||||
|
||||
std::vector<LIB_PIN*> pins = m_rows[ aRow ];
|
||||
std::vector<SCH_PIN*> pins = m_rows[ aRow ];
|
||||
|
||||
// If the NUMBER column is edited and the pins are grouped, renumber, and add or
|
||||
// remove pins based on the comma separated list of pins.
|
||||
@ -316,8 +316,8 @@ public:
|
||||
else
|
||||
{
|
||||
// Create new pins
|
||||
LIB_PIN* newPin = new LIB_PIN( this->m_symbol );
|
||||
LIB_PIN* last = pins.back();
|
||||
SCH_PIN* newPin = new SCH_PIN( this->m_symbol );
|
||||
SCH_PIN* last = pins.back();
|
||||
|
||||
newPin->SetNumber( pinName );
|
||||
newPin->SetName( last->GetName() );
|
||||
@ -361,7 +361,7 @@ public:
|
||||
return;
|
||||
}
|
||||
|
||||
for( LIB_PIN* pin : pins )
|
||||
for( SCH_PIN* pin : pins )
|
||||
{
|
||||
switch( aCol )
|
||||
{
|
||||
@ -454,7 +454,7 @@ public:
|
||||
m_edited = true;
|
||||
}
|
||||
|
||||
static int findRow( const std::vector<std::vector<LIB_PIN*>>& aRowSet, const wxString& aName )
|
||||
static int findRow( const std::vector<std::vector<SCH_PIN*>>& aRowSet, const wxString& aName )
|
||||
{
|
||||
for( size_t i = 0; i < aRowSet.size(); ++i )
|
||||
{
|
||||
@ -465,7 +465,7 @@ public:
|
||||
return -1;
|
||||
}
|
||||
|
||||
static bool compare( const std::vector<LIB_PIN*>& lhs, const std::vector<LIB_PIN*>& rhs,
|
||||
static bool compare( const std::vector<SCH_PIN*>& lhs, const std::vector<SCH_PIN*>& rhs,
|
||||
int sortCol, bool ascending, EDA_DRAW_FRAME* parentFrame )
|
||||
{
|
||||
wxString lhStr = GetValue( lhs, sortCol, parentFrame );
|
||||
@ -518,10 +518,10 @@ public:
|
||||
return res;
|
||||
}
|
||||
|
||||
void RebuildRows( const std::vector<LIB_PIN*>& aPins, bool groupByName, bool groupBySelection )
|
||||
void RebuildRows( const std::vector<SCH_PIN*>& aPins, bool groupByName, bool groupBySelection )
|
||||
{
|
||||
WX_GRID* grid = dynamic_cast<WX_GRID*>( GetView() );
|
||||
std::vector<LIB_PIN*> clear_flags;
|
||||
std::vector<SCH_PIN*> clear_flags;
|
||||
|
||||
clear_flags.reserve( aPins.size() );
|
||||
|
||||
@ -529,7 +529,7 @@ public:
|
||||
{
|
||||
if( groupBySelection )
|
||||
{
|
||||
for( LIB_PIN* pin : aPins )
|
||||
for( SCH_PIN* pin : aPins )
|
||||
pin->ClearTempFlags();
|
||||
|
||||
int firstSelectedRow;
|
||||
@ -539,7 +539,7 @@ public:
|
||||
|
||||
for( int ii = 0; ii < selectedRowCount; ++ii )
|
||||
{
|
||||
for( LIB_PIN* pin : m_rows[ firstSelectedRow + ii ] )
|
||||
for( SCH_PIN* pin : m_rows[ firstSelectedRow + ii ] )
|
||||
{
|
||||
pin->SetFlags( CANDIDATE );
|
||||
clear_flags.push_back( pin );
|
||||
@ -558,9 +558,9 @@ public:
|
||||
m_rows.clear();
|
||||
|
||||
if( groupBySelection )
|
||||
m_rows.emplace_back( std::vector<LIB_PIN*>() );
|
||||
m_rows.emplace_back( std::vector<SCH_PIN*>() );
|
||||
|
||||
for( LIB_PIN* pin : aPins )
|
||||
for( SCH_PIN* pin : aPins )
|
||||
{
|
||||
if( m_unitFilter == -1 || pin->GetUnit() == 0 || pin->GetUnit() == m_unitFilter )
|
||||
{
|
||||
@ -573,7 +573,7 @@ public:
|
||||
|
||||
if( rowIndex < 0 )
|
||||
{
|
||||
m_rows.emplace_back( std::vector<LIB_PIN*>() );
|
||||
m_rows.emplace_back( std::vector<SCH_PIN*>() );
|
||||
rowIndex = m_rows.size() - 1;
|
||||
}
|
||||
|
||||
@ -590,7 +590,7 @@ public:
|
||||
ascending = GetView()->IsSortOrderAscending();
|
||||
}
|
||||
|
||||
for( std::vector<LIB_PIN*>& row : m_rows )
|
||||
for( std::vector<SCH_PIN*>& row : m_rows )
|
||||
SortPins( row );
|
||||
|
||||
if( !groupBySelection )
|
||||
@ -605,32 +605,32 @@ public:
|
||||
GetView()->SelectRow( 0 );
|
||||
}
|
||||
|
||||
for( LIB_PIN* pin : clear_flags )
|
||||
for( SCH_PIN* pin : clear_flags )
|
||||
pin->ClearFlags( CANDIDATE );
|
||||
}
|
||||
|
||||
void SortRows( int aSortCol, bool ascending )
|
||||
{
|
||||
std::sort( m_rows.begin(), m_rows.end(),
|
||||
[ aSortCol, ascending, this ]( const std::vector<LIB_PIN*>& lhs,
|
||||
const std::vector<LIB_PIN*>& rhs ) -> bool
|
||||
[ aSortCol, ascending, this ]( const std::vector<SCH_PIN*>& lhs,
|
||||
const std::vector<SCH_PIN*>& rhs ) -> bool
|
||||
{
|
||||
return compare( lhs, rhs, aSortCol, ascending, m_frame );
|
||||
} );
|
||||
}
|
||||
|
||||
void SortPins( std::vector<LIB_PIN*>& aRow )
|
||||
void SortPins( std::vector<SCH_PIN*>& aRow )
|
||||
{
|
||||
std::sort( aRow.begin(), aRow.end(),
|
||||
[]( LIB_PIN* lhs, LIB_PIN* rhs ) -> bool
|
||||
[]( SCH_PIN* lhs, SCH_PIN* rhs ) -> bool
|
||||
{
|
||||
return PIN_NUMBERS::Compare( lhs->GetNumber(), rhs->GetNumber() ) < 0;
|
||||
} );
|
||||
}
|
||||
|
||||
void AppendRow( LIB_PIN* aPin )
|
||||
void AppendRow( SCH_PIN* aPin )
|
||||
{
|
||||
std::vector<LIB_PIN*> row;
|
||||
std::vector<SCH_PIN*> row;
|
||||
row.push_back( aPin );
|
||||
m_rows.push_back( row );
|
||||
|
||||
@ -641,9 +641,9 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
std::vector<LIB_PIN*> RemoveRow( int aRow )
|
||||
std::vector<SCH_PIN*> RemoveRow( int aRow )
|
||||
{
|
||||
std::vector<LIB_PIN*> removedRow = m_rows[ aRow ];
|
||||
std::vector<SCH_PIN*> removedRow = m_rows[ aRow ];
|
||||
|
||||
m_rows.erase( m_rows.begin() + aRow );
|
||||
|
||||
@ -656,7 +656,7 @@ public:
|
||||
return removedRow;
|
||||
}
|
||||
|
||||
std::vector<LIB_PIN*> GetRowPins( int aRow )
|
||||
std::vector<SCH_PIN*> GetRowPins( int aRow )
|
||||
{
|
||||
return m_rows[ aRow ];
|
||||
}
|
||||
@ -698,9 +698,9 @@ private:
|
||||
SYMBOL_EDIT_FRAME* m_frame;
|
||||
|
||||
// Because the rows of the grid can either be a single pin or a group of pins, the
|
||||
// data model is a 2D vector. If we're in the single pin case, each row's LIB_PINs
|
||||
// data model is a 2D vector. If we're in the single pin case, each row's SCH_PINs
|
||||
// contains only a single pin.
|
||||
std::vector<std::vector<LIB_PIN*>> m_rows;
|
||||
std::vector<std::vector<SCH_PIN*>> m_rows;
|
||||
int m_unitFilter; // 0 to show pins for all units
|
||||
|
||||
bool m_edited;
|
||||
@ -709,7 +709,7 @@ private:
|
||||
LIB_SYMBOL* m_symbol; // Parent symbol that the pins belong to.
|
||||
|
||||
std::unique_ptr<NUMERIC_EVALUATOR> m_eval;
|
||||
std::map< std::pair<std::vector<LIB_PIN*>, int>, wxString > m_evalOriginal;
|
||||
std::map< std::pair<std::vector<SCH_PIN*>, int>, wxString > m_evalOriginal;
|
||||
};
|
||||
|
||||
|
||||
@ -866,7 +866,7 @@ DIALOG_LIB_EDIT_PIN_TABLE::~DIALOG_LIB_EDIT_PIN_TABLE()
|
||||
|
||||
// This is our copy of the pins. If they were transferred to the part on an OK, then
|
||||
// m_pins will already be empty.
|
||||
for( LIB_PIN* pin : m_pins )
|
||||
for( SCH_PIN* pin : m_pins )
|
||||
delete pin;
|
||||
|
||||
WINDOW_THAWER thawer( m_editFrame );
|
||||
@ -879,10 +879,10 @@ DIALOG_LIB_EDIT_PIN_TABLE::~DIALOG_LIB_EDIT_PIN_TABLE()
|
||||
bool DIALOG_LIB_EDIT_PIN_TABLE::TransferDataToWindow()
|
||||
{
|
||||
// Make a copy of the pins for editing
|
||||
std::vector<LIB_PIN*> pins = m_symbol->GetAllLibPins();
|
||||
std::vector<SCH_PIN*> pins = m_symbol->GetAllLibPins();
|
||||
|
||||
for( LIB_PIN* pin : pins )
|
||||
m_pins.push_back( new LIB_PIN( *pin ) );
|
||||
for( SCH_PIN* pin : pins )
|
||||
m_pins.push_back( new SCH_PIN( *pin ) );
|
||||
|
||||
m_dataModel->RebuildRows( m_pins, m_cbGroup->GetValue(), false );
|
||||
|
||||
@ -908,16 +908,14 @@ bool DIALOG_LIB_EDIT_PIN_TABLE::TransferDataFromWindow()
|
||||
return false;
|
||||
|
||||
// Delete the part's pins
|
||||
std::vector<LIB_PIN*> pins = m_symbol->GetAllLibPins();
|
||||
std::vector<SCH_PIN*> pins = m_symbol->GetAllLibPins();
|
||||
|
||||
for( LIB_PIN* pin : pins )
|
||||
for( SCH_PIN* pin : pins )
|
||||
m_symbol->RemoveDrawItem( pin );
|
||||
|
||||
// Transfer our pins to the part
|
||||
for( LIB_PIN* pin : m_pins )
|
||||
{
|
||||
for( SCH_PIN* pin : m_pins )
|
||||
m_symbol->AddDrawItem( pin );
|
||||
}
|
||||
|
||||
m_pins.clear();
|
||||
|
||||
@ -948,12 +946,12 @@ void DIALOG_LIB_EDIT_PIN_TABLE::OnAddRow( wxCommandEvent& event )
|
||||
if( !m_grid->CommitPendingChanges() )
|
||||
return;
|
||||
|
||||
LIB_PIN* newPin = new LIB_PIN( this->m_symbol );
|
||||
SCH_PIN* newPin = new SCH_PIN( this->m_symbol );
|
||||
|
||||
// Copy the settings of the last pin onto the new pin.
|
||||
if( m_pins.size() > 0 )
|
||||
{
|
||||
LIB_PIN* last = m_pins.back();
|
||||
SCH_PIN* last = m_pins.back();
|
||||
|
||||
newPin->SetOrientation( last->GetOrientation() );
|
||||
newPin->SetType( last->GetType() );
|
||||
@ -991,7 +989,7 @@ void DIALOG_LIB_EDIT_PIN_TABLE::OnAddRow( wxCommandEvent& event )
|
||||
}
|
||||
|
||||
|
||||
void DIALOG_LIB_EDIT_PIN_TABLE::AddPin( LIB_PIN* pin )
|
||||
void DIALOG_LIB_EDIT_PIN_TABLE::AddPin( SCH_PIN* pin )
|
||||
{
|
||||
m_pins.push_back( pin );
|
||||
updateSummary();
|
||||
@ -1018,16 +1016,16 @@ void DIALOG_LIB_EDIT_PIN_TABLE::OnDeleteRow( wxCommandEvent& event )
|
||||
m_grid->SetGridCursor( nextSelRow, m_grid->GetGridCursorCol() );
|
||||
m_grid->SelectRow( nextSelRow );
|
||||
|
||||
std::vector<LIB_PIN*> removedRow = m_dataModel->RemoveRow( curRow );
|
||||
std::vector<SCH_PIN*> removedRow = m_dataModel->RemoveRow( curRow );
|
||||
|
||||
for( LIB_PIN* pin : removedRow )
|
||||
for( SCH_PIN* pin : removedRow )
|
||||
m_pins.erase( std::find( m_pins.begin(), m_pins.end(), pin ) );
|
||||
|
||||
updateSummary();
|
||||
}
|
||||
|
||||
|
||||
void DIALOG_LIB_EDIT_PIN_TABLE::RemovePin( LIB_PIN* pin )
|
||||
void DIALOG_LIB_EDIT_PIN_TABLE::RemovePin( SCH_PIN* pin )
|
||||
{
|
||||
m_pins.erase( std::find( m_pins.begin(), m_pins.end(), pin ) );
|
||||
updateSummary();
|
||||
@ -1042,15 +1040,15 @@ void DIALOG_LIB_EDIT_PIN_TABLE::OnCellEdited( wxGridEvent& event )
|
||||
|
||||
void DIALOG_LIB_EDIT_PIN_TABLE::OnCellSelected( wxGridEvent& event )
|
||||
{
|
||||
LIB_PIN* pin = nullptr;
|
||||
SCH_PIN* pin = nullptr;
|
||||
|
||||
if( event.GetRow() >= 0 && event.GetRow() < m_dataModel->GetNumberRows() )
|
||||
{
|
||||
const std::vector<LIB_PIN*>& pins = m_dataModel->GetRowPins( event.GetRow() );
|
||||
const std::vector<SCH_PIN*>& pins = m_dataModel->GetRowPins( event.GetRow() );
|
||||
|
||||
if( pins.size() == 1 && m_editFrame->GetCurSymbol() )
|
||||
{
|
||||
for( LIB_PIN* candidate : m_editFrame->GetCurSymbol()->GetAllLibPins() )
|
||||
for( SCH_PIN* candidate : m_editFrame->GetCurSymbol()->GetAllLibPins() )
|
||||
{
|
||||
if( candidate->GetNumber() == pins.at( 0 )->GetNumber() )
|
||||
{
|
||||
@ -1256,7 +1254,7 @@ void DIALOG_LIB_EDIT_PIN_TABLE::updateSummary()
|
||||
{
|
||||
PIN_NUMBERS pinNumbers;
|
||||
|
||||
for( LIB_PIN* pin : m_pins )
|
||||
for( SCH_PIN* pin : m_pins )
|
||||
{
|
||||
if( pin->GetNumber().Length() )
|
||||
pinNumbers.insert( pin->GetNumber() );
|
||||
|
@ -23,8 +23,7 @@
|
||||
|
||||
#include "dialog_lib_edit_pin_table_base.h"
|
||||
|
||||
#include <lib_pin.h>
|
||||
#include <symbol_library.h>
|
||||
#include <sch_pin.h>
|
||||
|
||||
enum COL_ORDER
|
||||
{
|
||||
@ -73,8 +72,8 @@ public:
|
||||
void OnUpdateUI( wxUpdateUIEvent& event ) override;
|
||||
void OnCancel( wxCommandEvent& event ) override;
|
||||
void OnClose( wxCloseEvent& event ) override;
|
||||
void AddPin( LIB_PIN* pin );
|
||||
void RemovePin( LIB_PIN* pin );
|
||||
void AddPin( SCH_PIN* pin );
|
||||
void RemovePin( SCH_PIN* pin );
|
||||
bool IsDisplayGrouped();
|
||||
|
||||
protected:
|
||||
@ -87,7 +86,7 @@ protected:
|
||||
int m_originalColWidths[ COL_COUNT ];
|
||||
std::bitset<64> m_columnsShown;
|
||||
LIB_SYMBOL* m_symbol;
|
||||
std::vector<LIB_PIN*> m_pins; // a copy of the pins owned by me
|
||||
std::vector<SCH_PIN*> m_pins; // a copy of the pins owned by me
|
||||
bool m_modified; ///< true when there are unsaved changes
|
||||
wxSize m_size;
|
||||
|
||||
|
@ -25,7 +25,7 @@
|
||||
#include <bitmaps.h>
|
||||
#include <sch_painter.h>
|
||||
#include <symbol_edit_frame.h>
|
||||
#include <lib_pin.h>
|
||||
#include <sch_pin.h>
|
||||
#include <dialog_pin_properties.h>
|
||||
#include <confirm.h>
|
||||
#include <kiplatform/ui.h>
|
||||
@ -36,7 +36,7 @@
|
||||
#include <widgets/std_bitmap_button.h>
|
||||
#include <wx/hyperlink.h>
|
||||
|
||||
class ALT_PIN_DATA_MODEL : public wxGridTableBase, public std::vector<LIB_PIN::ALT>
|
||||
class ALT_PIN_DATA_MODEL : public wxGridTableBase, public std::vector<SCH_PIN::ALT>
|
||||
{
|
||||
public:
|
||||
ALT_PIN_DATA_MODEL( EDA_UNITS aUserUnits )
|
||||
@ -99,7 +99,7 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
void AppendRow( const LIB_PIN::ALT& aAlt )
|
||||
void AppendRow( const SCH_PIN::ALT& aAlt )
|
||||
{
|
||||
push_back( aAlt );
|
||||
|
||||
@ -123,7 +123,7 @@ public:
|
||||
};
|
||||
|
||||
|
||||
DIALOG_PIN_PROPERTIES::DIALOG_PIN_PROPERTIES( SYMBOL_EDIT_FRAME* parent, LIB_PIN* aPin ) :
|
||||
DIALOG_PIN_PROPERTIES::DIALOG_PIN_PROPERTIES( SYMBOL_EDIT_FRAME* parent, SCH_PIN* aPin ) :
|
||||
DIALOG_PIN_PROPERTIES_BASE( parent ),
|
||||
m_frame( parent ),
|
||||
m_pin( aPin ),
|
||||
@ -138,7 +138,7 @@ DIALOG_PIN_PROPERTIES::DIALOG_PIN_PROPERTIES( SYMBOL_EDIT_FRAME* parent, LIB_PIN
|
||||
{
|
||||
// Creates a dummy pin to show on a panel, inside this dialog:
|
||||
m_dummyParent = new LIB_SYMBOL( *static_cast<LIB_SYMBOL*>( m_pin->GetParentSymbol() ) );
|
||||
m_dummyPin = new LIB_PIN( *m_pin );
|
||||
m_dummyPin = new SCH_PIN( *m_pin );
|
||||
m_dummyPin->SetParent( m_dummyParent );
|
||||
m_dummyParent->SetShowPinNames( true );
|
||||
m_dummyParent->SetShowPinNumbers( true );
|
||||
@ -306,7 +306,7 @@ bool DIALOG_PIN_PROPERTIES::TransferDataToWindow()
|
||||
|
||||
m_checkApplyToAllParts->SetToolTip( commonUnitsToolTip );
|
||||
|
||||
for( const std::pair<const wxString, LIB_PIN::ALT>& alt : m_pin->GetAlternates() )
|
||||
for( const std::pair<const wxString, SCH_PIN::ALT>& alt : m_pin->GetAlternates() )
|
||||
m_alternatesDataModel->AppendRow( alt.second );
|
||||
|
||||
return true;
|
||||
@ -364,10 +364,10 @@ bool DIALOG_PIN_PROPERTIES::TransferDataFromWindow()
|
||||
m_pin->SetUnit( m_checkApplyToAllParts->GetValue() ? 0 : m_frame->GetUnit() );
|
||||
m_pin->SetVisible( m_checkShow->GetValue() );
|
||||
|
||||
std::map<wxString, LIB_PIN::ALT>& alternates = m_pin->GetAlternates();
|
||||
std::map<wxString, SCH_PIN::ALT>& alternates = m_pin->GetAlternates();
|
||||
alternates.clear();
|
||||
|
||||
for( const LIB_PIN::ALT& alt : *m_alternatesDataModel )
|
||||
for( const SCH_PIN::ALT& alt : *m_alternatesDataModel )
|
||||
alternates[ alt.m_Name ] = alt;
|
||||
|
||||
return true;
|
||||
@ -450,7 +450,7 @@ void DIALOG_PIN_PROPERTIES::OnAddAlternate( wxCommandEvent& event )
|
||||
if( !m_alternatesGrid->CommitPendingChanges() )
|
||||
return;
|
||||
|
||||
LIB_PIN::ALT newAlt;
|
||||
SCH_PIN::ALT newAlt;
|
||||
newAlt.m_Name = wxEmptyString;
|
||||
newAlt.m_Type = m_pin->GetType();
|
||||
newAlt.m_Shape = m_pin->GetShape();
|
||||
|
@ -33,7 +33,7 @@
|
||||
|
||||
#include <dialog_pin_properties_base.h>
|
||||
#include <widgets/unit_binder.h>
|
||||
#include <lib_pin.h>
|
||||
#include <sch_pin.h>
|
||||
#include <symbol_edit_frame.h>
|
||||
|
||||
|
||||
@ -53,7 +53,7 @@ class ALT_PIN_DATA_MODEL;
|
||||
class DIALOG_PIN_PROPERTIES : public DIALOG_PIN_PROPERTIES_BASE
|
||||
{
|
||||
public:
|
||||
DIALOG_PIN_PROPERTIES( SYMBOL_EDIT_FRAME* parent, LIB_PIN* aPin );
|
||||
DIALOG_PIN_PROPERTIES( SYMBOL_EDIT_FRAME* parent, SCH_PIN* aPin );
|
||||
~DIALOG_PIN_PROPERTIES() override;
|
||||
|
||||
bool TransferDataToWindow() override;
|
||||
@ -73,10 +73,10 @@ protected:
|
||||
|
||||
private:
|
||||
SYMBOL_EDIT_FRAME* m_frame;
|
||||
LIB_PIN* m_pin;
|
||||
SCH_PIN* m_pin;
|
||||
|
||||
LIB_SYMBOL* m_dummyParent;
|
||||
LIB_PIN* m_dummyPin; // a working copy used to show changes
|
||||
SCH_PIN* m_dummyPin; // a working copy used to show changes
|
||||
|
||||
UNIT_BINDER m_posX;
|
||||
UNIT_BINDER m_posY;
|
||||
|
@ -79,7 +79,7 @@ DIALOG_SIM_MODEL<T>::DIALOG_SIM_MODEL( wxWindow* aParent, EDA_BASE_FRAME* aFrame
|
||||
{
|
||||
m_browseButton->SetBitmap( KiBitmapBundle( BITMAPS::small_folder ) );
|
||||
|
||||
for( LIB_PIN* pin : aSymbol.GetAllLibPins() )
|
||||
for( SCH_PIN* pin : aSymbol.GetAllLibPins() )
|
||||
{
|
||||
// De Morgan conversions are equivalences, not additional items to simulate
|
||||
if( !pin->GetParentSymbol()->HasAlternateBodyStyle() || pin->GetBodyStyle() < 2 )
|
||||
@ -87,7 +87,7 @@ DIALOG_SIM_MODEL<T>::DIALOG_SIM_MODEL( wxWindow* aParent, EDA_BASE_FRAME* aFrame
|
||||
}
|
||||
|
||||
std::sort( m_sortedPartPins.begin(), m_sortedPartPins.end(),
|
||||
[]( const LIB_PIN* lhs, const LIB_PIN* rhs )
|
||||
[]( const SCH_PIN* lhs, const SCH_PIN* rhs )
|
||||
{
|
||||
// We sort by StrNumCmp because SIM_MODEL_BASE sorts with it too.
|
||||
return StrNumCmp( lhs->GetNumber(), rhs->GetNumber(), true ) < 0;
|
||||
@ -1064,7 +1064,7 @@ int DIALOG_SIM_MODEL<T>::findSymbolPinRow( const wxString& aSymbolPinNumber ) co
|
||||
{
|
||||
for( int row = 0; row < static_cast<int>( m_sortedPartPins.size() ); ++row )
|
||||
{
|
||||
LIB_PIN* pin = m_sortedPartPins[row];
|
||||
SCH_PIN* pin = m_sortedPartPins[row];
|
||||
|
||||
if( pin->GetNumber() == aSymbolPinNumber )
|
||||
return row;
|
||||
@ -1107,7 +1107,7 @@ const SIM_LIBRARY* DIALOG_SIM_MODEL<T>::library() const
|
||||
template <typename T>
|
||||
wxString DIALOG_SIM_MODEL<T>::getSymbolPinString( int symbolPinIndex ) const
|
||||
{
|
||||
LIB_PIN* pin = m_sortedPartPins.at( symbolPinIndex );
|
||||
SCH_PIN* pin = m_sortedPartPins.at( symbolPinIndex );
|
||||
wxString pinNumber;
|
||||
wxString pinName;
|
||||
|
||||
|
@ -130,7 +130,7 @@ private:
|
||||
wxString m_prevLibrary;
|
||||
const SIM_MODEL* m_prevModel;
|
||||
|
||||
std::vector<LIB_PIN*> m_sortedPartPins; //< Pins of the current part.
|
||||
std::vector<SCH_PIN*> m_sortedPartPins; //< Pins of the current part.
|
||||
std::map<SIM_MODEL::DEVICE_T, SIM_MODEL::TYPE> m_curModelTypeOfDeviceType;
|
||||
SIM_MODEL::TYPE m_curModelType;
|
||||
|
||||
|
@ -100,7 +100,7 @@ public:
|
||||
|
||||
for( const SCH_PIN& pin : *this )
|
||||
{
|
||||
LIB_PIN* lib_pin = pin.GetLibPin();
|
||||
SCH_PIN* lib_pin = pin.GetLibPin();
|
||||
wxGridCellAttr* attr = nullptr;
|
||||
|
||||
if( lib_pin->GetAlternates().empty() )
|
||||
@ -114,7 +114,7 @@ public:
|
||||
wxArrayString choices;
|
||||
choices.push_back( lib_pin->GetName() );
|
||||
|
||||
for( const std::pair<const wxString, LIB_PIN::ALT>& alt : lib_pin->GetAlternates() )
|
||||
for( const std::pair<const wxString, SCH_PIN::ALT>& alt : lib_pin->GetAlternates() )
|
||||
choices.push_back( alt.first );
|
||||
|
||||
attr = new wxGridCellAttr();
|
||||
|
@ -389,7 +389,7 @@ void PANEL_EESCHEMA_COLOR_SETTINGS::createPreviewItems()
|
||||
|
||||
addItem( comp_body );
|
||||
|
||||
LIB_PIN* pin = new LIB_PIN( symbol );
|
||||
SCH_PIN* pin = new SCH_PIN( symbol );
|
||||
|
||||
pin->SetPosition( MILS_POINT( p.x - 300, p.y + 100 ) );
|
||||
pin->SetLength( schIUScale.MilsToIU( 100 ) );
|
||||
@ -403,7 +403,7 @@ void PANEL_EESCHEMA_COLOR_SETTINGS::createPreviewItems()
|
||||
endPointsByType.emplace_back( PIN_END, pin, mapLibItemPosition( pin->GetPosition() ) );
|
||||
symbol->AddDrawItem( pin );
|
||||
|
||||
pin = new LIB_PIN( symbol );
|
||||
pin = new SCH_PIN( symbol );
|
||||
|
||||
pin->SetPosition( MILS_POINT( p.x - 300, p.y - 100 ) );
|
||||
pin->SetLength( schIUScale.MilsToIU( 100 ) );
|
||||
@ -417,7 +417,7 @@ void PANEL_EESCHEMA_COLOR_SETTINGS::createPreviewItems()
|
||||
endPointsByType.emplace_back( PIN_END, pin, mapLibItemPosition( pin->GetPosition() ) );
|
||||
symbol->AddDrawItem( pin );
|
||||
|
||||
pin = new LIB_PIN( symbol );
|
||||
pin = new SCH_PIN( symbol );
|
||||
|
||||
pin->SetPosition( MILS_POINT( p.x + 300, p.y ) );
|
||||
pin->SetLength( schIUScale.MilsToIU( 100 ) );
|
||||
|
@ -25,7 +25,7 @@
|
||||
#ifndef _PANEL_SETUP_PINMAP_H_
|
||||
#define _PANEL_SETUP_PINMAP_H_
|
||||
|
||||
#include <lib_pin.h> // For PINTYPE_COUNT definition
|
||||
#include <sch_pin.h> // For PINTYPE_COUNT definition
|
||||
#include <erc_settings.h>
|
||||
#include "panel_setup_pinmap_base.h"
|
||||
|
||||
|
@ -96,7 +96,7 @@ INSPECT_RESULT EE_COLLECTOR::Inspect( EDA_ITEM* aItem, void* aTestData )
|
||||
// Special selection rules apply to pins of different units when edited in synchronized
|
||||
// pins mode. Leave it to EE_SELECTION_TOOL::Selectable() to decide what to do with them.
|
||||
|
||||
if( schItem && schItem->Type() != LIB_PIN_T )
|
||||
if( schItem && schItem->Type() != SCH_PIN_T )
|
||||
{
|
||||
if( m_Unit && schItem->GetUnit() && schItem->GetUnit() != m_Unit )
|
||||
return INSPECT_RESULT::CONTINUE;
|
||||
|
@ -34,7 +34,7 @@
|
||||
#include <erc_sch_pin_context.h>
|
||||
#include <gal/graphics_abstraction_layer.h>
|
||||
#include <string_utils.h>
|
||||
#include <lib_pin.h>
|
||||
#include <sch_pin.h>
|
||||
#include <project_sch.h>
|
||||
#include <project/project_file.h>
|
||||
#include <project/net_settings.h>
|
||||
@ -493,8 +493,7 @@ int ERC_TESTER::TestMissingUnits()
|
||||
|
||||
for( int missing_unit : missing_units )
|
||||
{
|
||||
std::vector<LIB_PIN*> pins;
|
||||
int bodyStyle = 0;
|
||||
int bodyStyle = 0;
|
||||
|
||||
for( size_t ii = 0; ii < refList.GetCount(); ++ii )
|
||||
{
|
||||
@ -505,9 +504,7 @@ int ERC_TESTER::TestMissingUnits()
|
||||
}
|
||||
}
|
||||
|
||||
libSymbol->GetPins( pins, missing_unit, bodyStyle );
|
||||
|
||||
for( LIB_PIN* pin : pins )
|
||||
for( SCH_PIN* pin : libSymbol->GetPins( missing_unit, bodyStyle ) )
|
||||
{
|
||||
switch( pin->GetType() )
|
||||
{
|
||||
@ -728,7 +725,7 @@ int ERC_TESTER::TestPinToPin()
|
||||
ERC_SCH_PIN_CONTEXT& refPin = *refIt;
|
||||
ELECTRICAL_PINTYPE refType = refPin.Pin()->GetType();
|
||||
|
||||
if( DrivenPinTypes.count( refType ) )
|
||||
if( DrivenPinTypes.contains( refType ) )
|
||||
{
|
||||
// needsDriver will be the pin shown in the error report eventually, so try to
|
||||
// upgrade to a "better" pin if possible: something visible and only a power symbol
|
||||
@ -762,9 +759,9 @@ int ERC_TESTER::TestPinToPin()
|
||||
ELECTRICAL_PINTYPE testType = testPin.Pin()->GetType();
|
||||
|
||||
if( ispowerNet )
|
||||
hasDriver |= ( DrivingPowerPinTypes.count( testType ) != 0 );
|
||||
hasDriver |= DrivingPowerPinTypes.contains( testType );
|
||||
else
|
||||
hasDriver |= ( DrivingPinTypes.count( testType ) != 0 );
|
||||
hasDriver |= DrivingPinTypes.contains( testType );
|
||||
|
||||
PIN_ERROR erc = settings.GetPinMapValue( refType, testType );
|
||||
|
||||
@ -782,8 +779,7 @@ int ERC_TESTER::TestPinToPin()
|
||||
ElectricalPinTypeGetText( refType ),
|
||||
ElectricalPinTypeGetText( testType ) ) );
|
||||
|
||||
SCH_MARKER* marker = new SCH_MARKER( ercItem,
|
||||
refPin.Pin()->GetTransformedPosition() );
|
||||
SCH_MARKER* marker = new SCH_MARKER( ercItem, refPin.Pin()->GetPosition() );
|
||||
pinToScreenMap[refPin.Pin()]->Append( marker );
|
||||
errors++;
|
||||
}
|
||||
@ -802,8 +798,7 @@ int ERC_TESTER::TestPinToPin()
|
||||
ercItem->SetSheetSpecificPath( needsDriver.Sheet() );
|
||||
ercItem->SetItemsSheetPaths( needsDriver.Sheet() );
|
||||
|
||||
SCH_MARKER* marker = new SCH_MARKER( ercItem,
|
||||
needsDriver.Pin()->GetTransformedPosition() );
|
||||
SCH_MARKER* marker = new SCH_MARKER( ercItem, needsDriver.Pin()->GetPosition() );
|
||||
pinToScreenMap[needsDriver.Pin()]->Append( marker );
|
||||
errors++;
|
||||
}
|
||||
@ -860,8 +855,7 @@ int ERC_TESTER::TestMultUnitPinConflicts()
|
||||
ercItem->SetSheetSpecificPath( sheet );
|
||||
ercItem->SetItemsSheetPaths( sheet, sheet );
|
||||
|
||||
SCH_MARKER* marker = new SCH_MARKER( ercItem,
|
||||
pin->GetTransformedPosition() );
|
||||
SCH_MARKER* marker = new SCH_MARKER( ercItem, pin->GetPosition() );
|
||||
sheet.LastScreen()->Append( marker );
|
||||
errors += 1;
|
||||
}
|
||||
@ -1159,7 +1153,7 @@ int ERC_TESTER::TestOffGridEndpoints()
|
||||
|
||||
for( SCH_PIN* pin : symbol->GetPins( nullptr ) )
|
||||
{
|
||||
VECTOR2I pinPos = pin->GetTransformedPosition();
|
||||
VECTOR2I pinPos = pin->GetPosition();
|
||||
|
||||
if( ( pinPos.x % gridSize ) != 0 || ( pinPos.y % gridSize ) != 0 )
|
||||
{
|
||||
|
@ -99,15 +99,10 @@ static wxString netList( LIB_SYMBOL* aSymbol )
|
||||
* pinNumber pinName <tab> pinNumber pinName...
|
||||
* fpFilter fpFilter...
|
||||
*/
|
||||
wxString netlist;
|
||||
|
||||
std::vector<LIB_PIN*> pinList;
|
||||
|
||||
aSymbol->GetPins( pinList, 0, 1 ); // All units, but a single convert
|
||||
|
||||
wxString netlist;
|
||||
wxArrayString pins;
|
||||
|
||||
for( LIB_PIN* pin : pinList )
|
||||
for( SCH_PIN* pin : aSymbol->GetPins( 0 /* all units */, 1 /* single bodyStyle */ ) )
|
||||
pins.push_back( pin->GetNumber() + ' ' + pin->GetShownName() );
|
||||
|
||||
if( !pins.IsEmpty() )
|
||||
|
1707
eeschema/lib_pin.cpp
1707
eeschema/lib_pin.cpp
File diff suppressed because it is too large
Load Diff
@ -1,336 +0,0 @@
|
||||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2015 Jean-Pierre Charras, jaen-pierre.charras at wanadoo.fr
|
||||
* Copyright (C) 2015 Wayne Stambaugh <stambaughw@gmail.com>
|
||||
* Copyright (C) 2004-2024 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
|
||||
*/
|
||||
|
||||
|
||||
#ifndef CLASS_PIN_H
|
||||
#define CLASS_PIN_H
|
||||
|
||||
#include <pin_type.h>
|
||||
#include <lib_symbol.h>
|
||||
|
||||
// Circle diameter drawn at the active end of pins:
|
||||
#define TARGET_PIN_RADIUS schIUScale.MilsToIU( 15 )
|
||||
|
||||
// Pin visibility flag bit:
|
||||
#define PIN_INVISIBLE 1 // Set makes pin invisible
|
||||
|
||||
|
||||
class LIB_PIN : public SCH_ITEM
|
||||
{
|
||||
public:
|
||||
struct ALT
|
||||
{
|
||||
wxString m_Name;
|
||||
GRAPHIC_PINSHAPE m_Shape; // Shape drawn around pin
|
||||
ELECTRICAL_PINTYPE m_Type; // Electrical type of the pin.
|
||||
};
|
||||
|
||||
LIB_PIN( SCH_ITEM* aParent );
|
||||
|
||||
LIB_PIN( SCH_ITEM* aParent, const wxString& aName, const wxString& aNumber,
|
||||
PIN_ORIENTATION aOrientation, ELECTRICAL_PINTYPE aPinType, int aLength,
|
||||
int aNameTextSize, int aNumTextSize, int aConvert, const VECTOR2I& aPos, int aUnit );
|
||||
|
||||
// Do not create a copy constructor. The one generated by the compiler is adequate.
|
||||
|
||||
~LIB_PIN() { }
|
||||
|
||||
wxString GetClass() const override
|
||||
{
|
||||
return wxT( "LIB_PIN" );
|
||||
}
|
||||
|
||||
static inline bool ClassOf( const EDA_ITEM* aItem )
|
||||
{
|
||||
return aItem && aItem->Type() == LIB_PIN_T;
|
||||
}
|
||||
|
||||
wxString GetFriendlyName() const override
|
||||
{
|
||||
return _( "Pin" );
|
||||
}
|
||||
|
||||
PIN_ORIENTATION GetOrientation() const { return m_orientation; }
|
||||
void SetOrientation( PIN_ORIENTATION aOrientation ) { m_orientation = aOrientation; }
|
||||
|
||||
GRAPHIC_PINSHAPE GetShape() const { return m_shape; }
|
||||
void SetShape( GRAPHIC_PINSHAPE aShape ) { m_shape = aShape; }
|
||||
|
||||
int GetLength() const { return m_length; }
|
||||
void SetLength( int aLength ) { m_length = aLength; }
|
||||
|
||||
/**
|
||||
* Change the length of a pin and adjust its position based on orientation.
|
||||
*
|
||||
* @param aLength New length of pin
|
||||
*/
|
||||
void ChangeLength( int aLength );
|
||||
|
||||
ELECTRICAL_PINTYPE GetType() const { return m_type; }
|
||||
void SetType( ELECTRICAL_PINTYPE aType ) { m_type = aType; }
|
||||
|
||||
wxString const GetCanonicalElectricalTypeName() const
|
||||
{
|
||||
return GetCanonicalElectricalTypeName( m_type );
|
||||
}
|
||||
|
||||
wxString const GetElectricalTypeName() const
|
||||
{
|
||||
return ElectricalPinTypeGetText( m_type );
|
||||
}
|
||||
|
||||
bool IsVisible() const { return ( m_attributes & PIN_INVISIBLE ) == 0; }
|
||||
void SetVisible( bool aVisible )
|
||||
{
|
||||
if( aVisible )
|
||||
m_attributes &= ~PIN_INVISIBLE;
|
||||
else
|
||||
m_attributes |= PIN_INVISIBLE;
|
||||
}
|
||||
|
||||
const wxString& GetName() const { return m_name; }
|
||||
wxString GetShownName() const;
|
||||
void SetName( const wxString& aName )
|
||||
{
|
||||
m_name = aName;
|
||||
|
||||
// pin name string does not support spaces
|
||||
m_name.Replace( wxT( " " ), wxT( "_" ) );
|
||||
m_nameExtentsCache.m_Extents = VECTOR2I();
|
||||
}
|
||||
|
||||
const wxString& GetNumber() const { return m_number; }
|
||||
wxString GetShownNumber() const { return m_number; }
|
||||
void SetNumber( const wxString& aNumber )
|
||||
{
|
||||
m_number = aNumber;
|
||||
|
||||
// pin number string does not support spaces
|
||||
m_number.Replace( wxT( " " ), wxT( "_" ) );
|
||||
m_numExtentsCache.m_Extents = VECTOR2I();
|
||||
}
|
||||
|
||||
int GetNameTextSize() const { return m_nameTextSize; }
|
||||
void SetNameTextSize( int aSize )
|
||||
{
|
||||
m_nameTextSize = aSize;
|
||||
m_nameExtentsCache.m_Extents = VECTOR2I();
|
||||
}
|
||||
|
||||
int GetNumberTextSize() const { return m_numTextSize; }
|
||||
void SetNumberTextSize( int aSize )
|
||||
{
|
||||
m_numTextSize = aSize;
|
||||
m_numExtentsCache.m_Extents = VECTOR2I();
|
||||
}
|
||||
|
||||
std::map<wxString, ALT>& GetAlternates() { return m_alternates; }
|
||||
|
||||
ALT GetAlt( const wxString& aAlt ) { return m_alternates[ aAlt ]; }
|
||||
|
||||
void Print( const SCH_RENDER_SETTINGS* aSettings, int aUnit, int aBodyStyle,
|
||||
const VECTOR2I& aOffset, bool aForceNoFill, bool aDimmed ) override;
|
||||
|
||||
/**
|
||||
* Return the pin real orientation (PIN_UP, PIN_DOWN, PIN_RIGHT, PIN_LEFT),
|
||||
* according to its orientation and the matrix transform (rot, mirror) \a aTransform.
|
||||
*
|
||||
* @param aTransform Transform matrix
|
||||
*/
|
||||
PIN_ORIENTATION PinDrawOrient( const TRANSFORM& aTransform ) const;
|
||||
|
||||
// No, LIB_PINs don't really have operating poinst. But we draw SCH_PINs through their LIB_PIN
|
||||
// counterparts, so here we are....
|
||||
const wxString& GetOperatingPoint() const { return m_operatingPoint; }
|
||||
void SetOperatingPoint( const wxString& aText ) { m_operatingPoint = aText; }
|
||||
|
||||
#if defined(DEBUG)
|
||||
void Show( int nestLevel, std::ostream& os ) const override;
|
||||
#endif
|
||||
|
||||
bool HitTest( const VECTOR2I& aPosition, int aAccuracy = 0 ) const override;
|
||||
|
||||
bool HitTest( const BOX2I& aRect, bool aContained, int aAccuracy = 0 ) const override;
|
||||
|
||||
void GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList ) override;
|
||||
|
||||
const BOX2I ViewBBox() const override;
|
||||
|
||||
void ViewGetLayers( int aLayers[], int& aCount ) const override;
|
||||
|
||||
/* Cannot use a default parameter here as it will not be compatible with the virtual. */
|
||||
const BOX2I GetBoundingBox() const override { return GetBoundingBox( false, true, true ); }
|
||||
|
||||
/**
|
||||
* @param aIncludeLabelsOnInvisblePins - if false, do not include labels for invisible pins
|
||||
* in the calculation.
|
||||
*/
|
||||
const BOX2I GetBoundingBox( bool aIncludeLabelsOnInvisblePins, bool aIncludeNameAndNumber,
|
||||
bool aIncludeElectricalType ) const;
|
||||
|
||||
/**
|
||||
* Return whether this pin forms a global power connection: i.e., is part of a power symbol
|
||||
* and of type POWER_IN, or is a legacy invisible global power pin on a symbol.
|
||||
*/
|
||||
bool IsGlobalPower() const
|
||||
{
|
||||
return GetType() == ELECTRICAL_PINTYPE::PT_POWER_IN
|
||||
&& ( !IsVisible() || GetParentSymbol()->IsPower() );
|
||||
}
|
||||
|
||||
int GetPenWidth() const override;
|
||||
|
||||
void Move( const VECTOR2I& aOffset ) override;
|
||||
|
||||
VECTOR2I GetPosition() const override { return m_position; }
|
||||
void SetPosition( const VECTOR2I& aPos ) override { m_position = aPos; }
|
||||
|
||||
// For properties system
|
||||
int GetX() const { return m_position.x; }
|
||||
void SetX( int aX ) { m_position.x = aX; }
|
||||
int GetY() const { return m_position.y; }
|
||||
void SetY( int aY ) { m_position.y = aY; }
|
||||
|
||||
VECTOR2I GetPinRoot() const;
|
||||
|
||||
void MirrorHorizontally( int aCenter ) override;
|
||||
void MirrorVertically( int aCenter ) override;
|
||||
void Rotate( const VECTOR2I& aCenter, bool aRotateCCW = true ) override;
|
||||
|
||||
/**
|
||||
* Plot the pin name and number.
|
||||
* @param aTextInside - draw the names & numbers inside the symbol body (ie: in the opposite
|
||||
* direction of \a aPinOrient).
|
||||
*/
|
||||
void PlotPinTexts( PLOTTER *aPlotter, const VECTOR2I &aPinPos, PIN_ORIENTATION aPinOrient,
|
||||
int aTextInside, bool aDrawPinNum, bool aDrawPinName, bool aDimmed ) const;
|
||||
|
||||
void PlotPinType( PLOTTER *aPlotter, const VECTOR2I &aPosition, PIN_ORIENTATION aOrientation,
|
||||
bool aDimmed ) const;
|
||||
|
||||
void Plot( PLOTTER* aPlotter, bool aBackground, const SCH_PLOT_OPTS& aPlotOpts,
|
||||
int aUnit, int aBodyStyle, const VECTOR2I& aOffset, bool aDimmed ) override;
|
||||
|
||||
BITMAPS GetMenuImage() const override;
|
||||
|
||||
wxString GetItemDescription( UNITS_PROVIDER* aUnitsProvider ) const override;
|
||||
wxString GetItemDescription( UNITS_PROVIDER* aUnitsProvider, ALT* aAlt ) const;
|
||||
|
||||
EDA_ITEM* Clone() const override;
|
||||
|
||||
void CalcEdit( const VECTOR2I& aPosition ) override;
|
||||
|
||||
/**
|
||||
* Return a string giving the electrical type of a pin.
|
||||
*
|
||||
* Can be used when a known, not translated name is needed (for instance in net lists)
|
||||
*
|
||||
* @param aType is the electrical type (see enum ELECTRICAL_PINTYPE )
|
||||
* @return The electrical name for a pin type (see enun MsgPinElectricType for names).
|
||||
*/
|
||||
static const wxString GetCanonicalElectricalTypeName( ELECTRICAL_PINTYPE aType );
|
||||
|
||||
double Similarity( const SCH_ITEM& aItem ) const override;
|
||||
|
||||
bool operator==( const SCH_ITEM& aItem ) const override;
|
||||
bool operator!=( const SCH_ITEM& aItem ) const { return !operator==( aItem ); }
|
||||
bool operator<( const LIB_PIN& aRhs ) const { return compare( aRhs, EQUALITY ) < 0; }
|
||||
bool operator>( const LIB_PIN& aRhs ) const { return compare( aRhs, EQUALITY ) > 0; }
|
||||
|
||||
protected:
|
||||
wxString getItemDescription( ALT* aAlt ) const;
|
||||
|
||||
struct EXTENTS_CACHE
|
||||
{
|
||||
KIFONT::FONT* m_Font = nullptr;
|
||||
int m_FontSize = 0;
|
||||
VECTOR2I m_Extents;
|
||||
};
|
||||
|
||||
void validateExtentsCache( KIFONT::FONT* aFont, int aSize, const wxString& aText,
|
||||
EXTENTS_CACHE* aCache ) const;
|
||||
|
||||
/**
|
||||
* Print the pin symbol without text.
|
||||
* If \a aColor != 0, draw with \a aColor, else with the normal pin color.
|
||||
*/
|
||||
void printPinSymbol( const SCH_RENDER_SETTINGS *aSettings, const VECTOR2I &aPos,
|
||||
PIN_ORIENTATION aOrientation, bool aDimmed );
|
||||
|
||||
/**
|
||||
* Put the pin number and pin text info, given the pin line coordinates.
|
||||
* The line must be vertical or horizontal.
|
||||
* If aDrawPinName == false the pin name is not printed.
|
||||
* If aDrawPinNum = false the pin number is not printed.
|
||||
* If aTextInside then the text is been put inside,otherwise all is drawn outside.
|
||||
* Pin Name: substring between '~' is negated
|
||||
*/
|
||||
void printPinTexts( const RENDER_SETTINGS* aSettings, VECTOR2I& aPinPos,
|
||||
PIN_ORIENTATION aPinOrient, int aTextInside, bool aDrawPinNum,
|
||||
bool aDrawPinName, bool aDimmed );
|
||||
|
||||
/**
|
||||
* Draw the electrical type text of the pin (only for the footprint editor)
|
||||
*/
|
||||
void printPinElectricalTypeName( const RENDER_SETTINGS* aSettings, VECTOR2I& aPosition,
|
||||
PIN_ORIENTATION aOrientation, bool aDimmed );
|
||||
std::ostream& operator<<( std::ostream& aStream );
|
||||
|
||||
private:
|
||||
/**
|
||||
* @copydoc SCH_ITEM::compare()
|
||||
*
|
||||
* The pin specific sort order is as follows:
|
||||
* - Pin number.
|
||||
* - Pin name, case insensitive compare.
|
||||
* - Pin horizontal (X) position.
|
||||
* - Pin vertical (Y) position.
|
||||
*/
|
||||
int compare( const SCH_ITEM& aOther, int aCompareFlags = 0 ) const override;
|
||||
|
||||
protected:
|
||||
VECTOR2I m_position; // Position of the pin.
|
||||
int m_length; // Length of the pin.
|
||||
PIN_ORIENTATION m_orientation; // Pin orientation (Up, Down, Left, Right)
|
||||
GRAPHIC_PINSHAPE m_shape; // Shape drawn around pin
|
||||
ELECTRICAL_PINTYPE m_type; // Electrical type of the pin.
|
||||
int m_attributes; // Set bit 0 to indicate pin is invisible.
|
||||
wxString m_name;
|
||||
wxString m_number;
|
||||
int m_numTextSize; // Pin num and Pin name sizes
|
||||
int m_nameTextSize;
|
||||
|
||||
std::map<wxString, ALT> m_alternates; // Map of alternate name to ALT structure
|
||||
|
||||
wxString m_operatingPoint; // No, LIB_PINs don't really have simulation
|
||||
// operating points. But we draw SCH_PINs through
|
||||
// their LIB_PIN counterparts, so here we are....
|
||||
|
||||
mutable EXTENTS_CACHE m_numExtentsCache;
|
||||
mutable EXTENTS_CACHE m_nameExtentsCache;
|
||||
};
|
||||
|
||||
|
||||
#endif // CLASS_PIN_H
|
@ -27,12 +27,11 @@
|
||||
#include <sch_draw_panel.h>
|
||||
#include <plotters/plotter.h>
|
||||
#include <sch_screen.h>
|
||||
#include <richio.h>
|
||||
#include <template_fieldnames.h>
|
||||
#include <transform.h>
|
||||
#include <symbol_library.h>
|
||||
#include <lib_pin.h>
|
||||
#include <settings/color_settings.h>
|
||||
#include <sch_pin.h>
|
||||
#include <sch_shape.h>
|
||||
|
||||
#include <memory>
|
||||
@ -293,7 +292,7 @@ int LIB_SYMBOL::Compare( const LIB_SYMBOL& aRhs, int aCompareFlags, REPORTER* aR
|
||||
aShapes.insert( &(*it) );
|
||||
else if( it->Type() == SCH_FIELD_T )
|
||||
aFields.insert( &(*it) );
|
||||
else if( it->Type() == LIB_PIN_T )
|
||||
else if( it->Type() == SCH_PIN_T )
|
||||
aPins.insert( &(*it) );
|
||||
}
|
||||
|
||||
@ -307,7 +306,7 @@ int LIB_SYMBOL::Compare( const LIB_SYMBOL& aRhs, int aCompareFlags, REPORTER* aR
|
||||
bShapes.insert( &(*it) );
|
||||
else if( it->Type() == SCH_FIELD_T )
|
||||
bFields.insert( &(*it) );
|
||||
else if( it->Type() == LIB_PIN_T )
|
||||
else if( it->Type() == SCH_PIN_T )
|
||||
bPins.insert( &(*it) );
|
||||
}
|
||||
|
||||
@ -346,8 +345,8 @@ int LIB_SYMBOL::Compare( const LIB_SYMBOL& aRhs, int aCompareFlags, REPORTER* aR
|
||||
{
|
||||
for( const SCH_ITEM* aPinItem : aPins )
|
||||
{
|
||||
const LIB_PIN* aPin = static_cast<const LIB_PIN*>( aPinItem );
|
||||
const LIB_PIN* bPin = aRhs.GetPin( aPin->GetNumber(), aPin->GetUnit(),
|
||||
const SCH_PIN* aPin = static_cast<const SCH_PIN*>( aPinItem );
|
||||
const SCH_PIN* bPin = aRhs.GetPin( aPin->GetNumber(), aPin->GetUnit(),
|
||||
aPin->GetBodyStyle() );
|
||||
|
||||
if( !bPin )
|
||||
@ -754,7 +753,7 @@ void LIB_SYMBOL::Print( const SCH_RENDER_SETTINGS* aSettings, int aUnit, int aBo
|
||||
if( aBodyStyle && item.m_bodyStyle && ( item.m_bodyStyle != aBodyStyle ) )
|
||||
continue;
|
||||
|
||||
if( item.Type() == LIB_PIN_T )
|
||||
if( item.Type() == SCH_PIN_T )
|
||||
{
|
||||
item.Print( aSettings, aUnit, aBodyStyle, aOffset, aForceNoFill, aDimmed );
|
||||
}
|
||||
@ -980,8 +979,10 @@ void LIB_SYMBOL::AddDrawItem( SCH_ITEM* aItem, bool aSort )
|
||||
}
|
||||
|
||||
|
||||
void LIB_SYMBOL::GetPins( std::vector<LIB_PIN*>& aList, int aUnit, int aBodyStyle ) const
|
||||
std::vector<SCH_PIN*> LIB_SYMBOL::GetPins( int aUnit, int aBodyStyle ) const
|
||||
{
|
||||
std::vector<SCH_PIN*> pins;
|
||||
|
||||
/* Notes:
|
||||
* when aUnit == 0: no unit filtering
|
||||
* when aBodyStyle == 0: no body style filtering
|
||||
@ -992,7 +993,7 @@ void LIB_SYMBOL::GetPins( std::vector<LIB_PIN*>& aList, int aUnit, int aBodyStyl
|
||||
LIB_SYMBOL_SPTR parent = m_parent.lock();
|
||||
const LIB_ITEMS_CONTAINER& drawItems = parent ? parent->m_drawings : m_drawings;
|
||||
|
||||
for( const SCH_ITEM& item : drawItems[LIB_PIN_T] )
|
||||
for( const SCH_ITEM& item : drawItems[SCH_PIN_T] )
|
||||
{
|
||||
// Unit filtering:
|
||||
if( aUnit && item.m_unit && ( item.m_unit != aUnit ) )
|
||||
@ -1002,35 +1003,29 @@ void LIB_SYMBOL::GetPins( std::vector<LIB_PIN*>& aList, int aUnit, int aBodyStyl
|
||||
if( aBodyStyle && item.m_bodyStyle && ( item.m_bodyStyle != aBodyStyle ) )
|
||||
continue;
|
||||
|
||||
aList.push_back( (LIB_PIN*) &item );
|
||||
// TODO: get rid of const_cast. (It used to be a C-style cast so was less noticeable.)
|
||||
pins.push_back( const_cast<SCH_PIN*>( static_cast<const SCH_PIN*>( &item ) ) );
|
||||
}
|
||||
|
||||
return pins;
|
||||
}
|
||||
|
||||
|
||||
std::vector<LIB_PIN*> LIB_SYMBOL::GetAllLibPins() const
|
||||
std::vector<SCH_PIN*> LIB_SYMBOL::GetAllLibPins() const
|
||||
{
|
||||
std::vector<LIB_PIN*> pinList;
|
||||
|
||||
GetPins( pinList, 0, 0 );
|
||||
return pinList;
|
||||
return GetPins( 0, 0 );
|
||||
}
|
||||
|
||||
|
||||
int LIB_SYMBOL::GetPinCount()
|
||||
{
|
||||
std::vector<LIB_PIN*> pinList;
|
||||
|
||||
GetPins( pinList, 0 /* all units */, 1 /* single body style */ );
|
||||
return (int) pinList.size();
|
||||
return (int) GetPins( 0 /* all units */, 1 /* single body style */ ).size();
|
||||
}
|
||||
|
||||
|
||||
LIB_PIN* LIB_SYMBOL::GetPin( const wxString& aNumber, int aUnit, int aBodyStyle ) const
|
||||
SCH_PIN* LIB_SYMBOL::GetPin( const wxString& aNumber, int aUnit, int aBodyStyle ) const
|
||||
{
|
||||
std::vector<LIB_PIN*> pinList;
|
||||
GetPins( pinList, aUnit, aBodyStyle );
|
||||
|
||||
for( LIB_PIN* pin : pinList )
|
||||
for( SCH_PIN* pin : GetPins( aUnit, aBodyStyle ) )
|
||||
{
|
||||
if( aNumber == pin->GetNumber() )
|
||||
return pin;
|
||||
@ -1043,17 +1038,15 @@ LIB_PIN* LIB_SYMBOL::GetPin( const wxString& aNumber, int aUnit, int aBodyStyle
|
||||
bool LIB_SYMBOL::PinsConflictWith( const LIB_SYMBOL& aOtherPart, bool aTestNums, bool aTestNames,
|
||||
bool aTestType, bool aTestOrientation, bool aTestLength ) const
|
||||
{
|
||||
std::vector<LIB_PIN*> thisPinList;
|
||||
GetPins( thisPinList, /* aUnit */ 0, /* aBodyStyle */ 0 );
|
||||
std::vector<SCH_PIN*> thisPinList = GetAllLibPins();
|
||||
|
||||
for( const LIB_PIN* eachThisPin : thisPinList )
|
||||
for( const SCH_PIN* eachThisPin : thisPinList )
|
||||
{
|
||||
wxASSERT( eachThisPin );
|
||||
std::vector<LIB_PIN*> otherPinList;
|
||||
aOtherPart.GetPins( otherPinList, /* aUnit */ 0, /* aBodyStyle */ 0 );
|
||||
std::vector<SCH_PIN*> otherPinList = aOtherPart.GetAllLibPins();
|
||||
bool foundMatch = false;
|
||||
|
||||
for( const LIB_PIN* eachOtherPin : otherPinList )
|
||||
for( const SCH_PIN* eachOtherPin : otherPinList )
|
||||
{
|
||||
wxASSERT( eachOtherPin );
|
||||
|
||||
@ -1152,9 +1145,9 @@ const BOX2I LIB_SYMBOL::GetBodyBoundingBox( int aUnit, int aBodyStyle, bool aInc
|
||||
if( item.Type() == SCH_FIELD_T )
|
||||
continue;
|
||||
|
||||
if( item.Type() == LIB_PIN_T )
|
||||
if( item.Type() == SCH_PIN_T )
|
||||
{
|
||||
const LIB_PIN& pin = static_cast<const LIB_PIN&>( item );
|
||||
const SCH_PIN& pin = static_cast<const SCH_PIN&>( item );
|
||||
|
||||
if( pin.IsVisible() )
|
||||
{
|
||||
@ -1441,9 +1434,9 @@ int LIB_SYMBOL::GetMaxPinNumber() const
|
||||
LIB_SYMBOL_SPTR parent = m_parent.lock();
|
||||
const LIB_ITEMS_CONTAINER& drawItems = parent ? parent->m_drawings : m_drawings;
|
||||
|
||||
for( const SCH_ITEM& item : drawItems[LIB_PIN_T] )
|
||||
for( const SCH_ITEM& item : drawItems[SCH_PIN_T] )
|
||||
{
|
||||
const LIB_PIN* pin = static_cast<const LIB_PIN*>( &item );
|
||||
const SCH_PIN* pin = static_cast<const SCH_PIN*>( &item );
|
||||
long currentPinNumber = 0;
|
||||
|
||||
if( pin->GetNumber().ToLong( ¤tPinNumber ) )
|
||||
@ -1598,7 +1591,7 @@ void LIB_SYMBOL::SetHasAlternateBodyStyle( bool aHasAlternate, bool aDuplicatePi
|
||||
{
|
||||
std::vector<SCH_ITEM*> tmp; // Temporarily store the duplicated pins here.
|
||||
|
||||
for( SCH_ITEM& item : m_drawings[ LIB_PIN_T ] )
|
||||
for( SCH_ITEM& item : m_drawings[ SCH_PIN_T ] )
|
||||
{
|
||||
if( item.m_bodyStyle == 1 )
|
||||
{
|
||||
@ -1727,8 +1720,8 @@ bool LIB_SYMBOL::operator==( const LIB_SYMBOL& aOther ) const
|
||||
return false;
|
||||
}
|
||||
|
||||
const std::vector<LIB_PIN*> thisPinList = GetAllLibPins();
|
||||
const std::vector<LIB_PIN*> otherPinList = aOther.GetAllLibPins();
|
||||
const std::vector<SCH_PIN*> thisPinList = GetAllLibPins();
|
||||
const std::vector<SCH_PIN*> otherPinList = aOther.GetAllLibPins();
|
||||
|
||||
if( thisPinList.size() != otherPinList.size() )
|
||||
return false;
|
||||
@ -1777,12 +1770,12 @@ double LIB_SYMBOL::Similarity( const SCH_ITEM& aOther ) const
|
||||
similarity += max_similarity;
|
||||
}
|
||||
|
||||
for( const LIB_PIN* pin : GetAllLibPins() )
|
||||
for( const SCH_PIN* pin : GetAllLibPins() )
|
||||
{
|
||||
totalItems += 1;
|
||||
double max_similarity = 0.0;
|
||||
|
||||
for( const LIB_PIN* otherPin : other.GetAllLibPins() )
|
||||
for( const SCH_PIN* otherPin : other.GetAllLibPins() )
|
||||
{
|
||||
double temp_similarity = pin->Similarity( *otherPin );
|
||||
max_similarity = std::max( max_similarity, temp_similarity );
|
||||
|
@ -27,9 +27,9 @@
|
||||
#ifndef LIB_SYMBOL_H
|
||||
#define LIB_SYMBOL_H
|
||||
|
||||
#include <general.h>
|
||||
#include <symbol.h>
|
||||
#include <sch_field.h>
|
||||
#include <sch_pin.h>
|
||||
#include <lib_tree_item.h>
|
||||
#include <vector>
|
||||
#include <core/multivector.h>
|
||||
@ -39,13 +39,12 @@ class OUTPUTFORMATTER;
|
||||
class REPORTER;
|
||||
class SYMBOL_LIB;
|
||||
class LIB_SYMBOL;
|
||||
class LIB_PIN;
|
||||
class TEST_LIB_SYMBOL_FIXTURE;
|
||||
|
||||
|
||||
typedef std::shared_ptr<LIB_SYMBOL> LIB_SYMBOL_SPTR; ///< shared pointer to LIB_SYMBOL
|
||||
typedef std::weak_ptr<LIB_SYMBOL> LIB_SYMBOL_REF; ///< weak pointer to LIB_SYMBOL
|
||||
typedef MULTIVECTOR<SCH_ITEM, SCH_SHAPE_T, LIB_PIN_T> LIB_ITEMS_CONTAINER;
|
||||
typedef MULTIVECTOR<SCH_ITEM, SCH_SHAPE_T, SCH_PIN_T> LIB_ITEMS_CONTAINER;
|
||||
typedef LIB_ITEMS_CONTAINER::ITEM_PTR_VECTOR LIB_ITEMS;
|
||||
|
||||
|
||||
@ -387,18 +386,17 @@ public:
|
||||
* Note pin objects are owned by the draw list of the symbol. Deleting any of the objects
|
||||
* will leave list in a unstable state and will likely segfault when the list is destroyed.
|
||||
*
|
||||
* @param aList - Pin list to place pin object pointers into.
|
||||
* @param aUnit - Unit number of pins to collect. Set to 0 to get pins from any symbol unit.
|
||||
* @param aBodyStyle - Symbol alternate body style of pins to collect. Set to 0 to get pins
|
||||
* from any DeMorgan variant of symbol.
|
||||
*/
|
||||
void GetPins( std::vector<LIB_PIN*>& aList, int aUnit = 0, int aBodyStyle = 0 ) const;
|
||||
std::vector<SCH_PIN*> GetPins( int aUnit = 0, int aBodyStyle = 0 ) const;
|
||||
|
||||
/**
|
||||
* Return a list of pin pointers for all units / converts. Used primarily for SPICE where
|
||||
* we want to treat all unit as a single part.
|
||||
*/
|
||||
std::vector<LIB_PIN*> GetAllLibPins() const;
|
||||
std::vector<SCH_PIN*> GetAllLibPins() const;
|
||||
|
||||
/**
|
||||
* @return a count of pins for all units / converts.
|
||||
@ -414,7 +412,7 @@ public:
|
||||
* required.
|
||||
* @return The pin object if found. Otherwise NULL.
|
||||
*/
|
||||
LIB_PIN* GetPin( const wxString& aNumber, int aUnit = 0, int aBodyStyle = 0 ) const;
|
||||
SCH_PIN* GetPin( const wxString& aNumber, int aUnit = 0, int aBodyStyle = 0 ) const;
|
||||
|
||||
/**
|
||||
* Return true if this symbol's pins do not match another symbol's pins. This is used to
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user