RIP LIB_PIN.
This commit is contained in:
parent
6d11c85cad
commit
95136494b3
|
@ -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
|
||||
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>
|
||||
|
||||
|
||||
/**
|
||||
|
|
|
@ -163,13 +163,9 @@ DIALOG_FIELD_PROPERTIES::DIALOG_FIELD_PROPERTIES( SCH_BASE_FRAME* aParent, const
|
|||
* fpFilter fpFilter...
|
||||
*/
|
||||
wxString netlist;
|
||||
|
||||
std::vector<LIB_PIN*> pinList;
|
||||
symbol->GetPins( pinList, 0, 1 ); // All units, but a single convert
|
||||
|
||||
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,7 +493,6 @@ int ERC_TESTER::TestMissingUnits()
|
|||
|
||||
for( int missing_unit : missing_units )
|
||||
{
|
||||
std::vector<LIB_PIN*> pins;
|
||||
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 )
|
||||
{
|
||||
|
|
|
@ -100,14 +100,9 @@ static wxString netList( LIB_SYMBOL* aSymbol )
|
|||
* fpFilter fpFilter...
|
||||
*/
|
||||
wxString netlist;
|
||||
|
||||
std::vector<LIB_PIN*> pinList;
|
||||
|
||||
aSymbol->GetPins( pinList, 0, 1 ); // All units, but a single convert
|
||||
|
||||
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
|
||||
|
|
|
@ -124,7 +124,7 @@ bool NETLIST_EXPORTER_ALLEGRO::CompareSymbolRef( const wxString& aRefText1,
|
|||
}
|
||||
|
||||
|
||||
bool NETLIST_EXPORTER_ALLEGRO::CompareLibPin( const LIB_PIN* aPin1, const LIB_PIN* aPin2 )
|
||||
bool NETLIST_EXPORTER_ALLEGRO::CompareLibPin( const SCH_PIN* aPin1, const SCH_PIN* aPin2 )
|
||||
{
|
||||
// return "lhs < rhs"
|
||||
return StrNumCmp( aPin1->GetShownNumber(), aPin2->GetShownNumber(), true ) < 0;
|
||||
|
@ -177,18 +177,10 @@ void NETLIST_EXPORTER_ALLEGRO::extractComponentsInfo()
|
|||
SCH_SYMBOL* symbol = findNextSymbol( item, &sheet );
|
||||
|
||||
if( !symbol || symbol->GetExcludedFromBoard() )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
std::vector<LIB_PIN*> pinList;
|
||||
pinList.clear();
|
||||
symbol->GetLibPins(pinList);
|
||||
|
||||
if( !pinList.size() )
|
||||
{
|
||||
if( symbol->GetLibPins().empty() )
|
||||
continue;
|
||||
}
|
||||
|
||||
m_packageProperties.insert( std::pair<wxString,
|
||||
wxString>( sheet.PathHumanReadable(),
|
||||
|
@ -450,8 +442,7 @@ void NETLIST_EXPORTER_ALLEGRO::toAllegroPackages()
|
|||
fprintf( d, "PACKAGE '%s'\n", TO_UTF8( formatDevice( footprintText ) ) );
|
||||
fprintf( d, "CLASS IC\n" );
|
||||
|
||||
std::vector<LIB_PIN*> pinList;
|
||||
sym->GetLibSymbolRef()->GetPins( pinList, 0, 0 );
|
||||
std::vector<SCH_PIN*> pinList = sym->GetLibSymbolRef()->GetAllLibPins();
|
||||
|
||||
/*
|
||||
* We must erase redundant Pins references in pinList
|
||||
|
@ -584,7 +575,7 @@ wxString NETLIST_EXPORTER_ALLEGRO::formatText( wxString aString )
|
|||
}
|
||||
|
||||
|
||||
wxString NETLIST_EXPORTER_ALLEGRO::formatPin( const LIB_PIN& aPin )
|
||||
wxString NETLIST_EXPORTER_ALLEGRO::formatPin( const SCH_PIN& aPin )
|
||||
{
|
||||
wxString pinName4Telesis = aPin.GetName() + wxString( "__" ) + aPin.GetNumber();
|
||||
std::regex reg( "[^A-Za-z0-9_+?/-]" );
|
||||
|
@ -592,7 +583,7 @@ wxString NETLIST_EXPORTER_ALLEGRO::formatPin( const LIB_PIN& aPin )
|
|||
}
|
||||
|
||||
|
||||
wxString NETLIST_EXPORTER_ALLEGRO::formatFunction( wxString aName, std::vector<LIB_PIN*> aPinList )
|
||||
wxString NETLIST_EXPORTER_ALLEGRO::formatFunction( wxString aName, std::vector<SCH_PIN*> aPinList )
|
||||
{
|
||||
aName.MakeUpper();
|
||||
std::list<wxString> pinNameList;
|
||||
|
|
|
@ -67,13 +67,13 @@ public:
|
|||
static bool CompareSymbolRef( const wxString& aRefText1, const wxString& aRefText2 );
|
||||
|
||||
/**
|
||||
* Compare two LIB_PIN* variables.
|
||||
* Compare two SCH_PIN* variables.
|
||||
*
|
||||
* @param aPin1
|
||||
* @param aPin2
|
||||
* @return bool value
|
||||
*/
|
||||
static bool CompareLibPin( const LIB_PIN* aPin1, const LIB_PIN* aPin2 );
|
||||
static bool CompareLibPin( const SCH_PIN* aPin1, const SCH_PIN* aPin2 );
|
||||
|
||||
private:
|
||||
void extractComponentsInfo();
|
||||
|
@ -132,7 +132,7 @@ private:
|
|||
* @param aPin
|
||||
* @return wxString
|
||||
*/
|
||||
wxString formatPin( const LIB_PIN& aPin );
|
||||
wxString formatPin( const SCH_PIN& aPin );
|
||||
|
||||
/**
|
||||
* Generate the definition of a function in Telesis format, which consists of
|
||||
|
@ -142,7 +142,7 @@ private:
|
|||
* @param aPinList
|
||||
* @return wxString
|
||||
*/
|
||||
wxString formatFunction( wxString aName, std::vector<LIB_PIN*> aPinList );
|
||||
wxString formatFunction( wxString aName, std::vector<SCH_PIN*> aPinList );
|
||||
|
||||
/**
|
||||
* Look up a field for a component group, which may have mismatched case, or
|
||||
|
|
|
@ -26,10 +26,8 @@
|
|||
#ifndef NETLIST_EXPORTER_H
|
||||
#define NETLIST_EXPORTER_H
|
||||
|
||||
#include <lib_pin.h>
|
||||
#include <sch_symbol.h>
|
||||
#include <sch_label.h>
|
||||
#include <sch_sheet.h>
|
||||
#include <schematic.h>
|
||||
|
||||
/**
|
||||
|
@ -91,10 +89,6 @@ struct PIN_INFO
|
|||
class NETLIST_EXPORTER_BASE
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* @param aMasterList we take ownership of this here.
|
||||
* @param aLibTable is the symbol library table of the project.
|
||||
*/
|
||||
NETLIST_EXPORTER_BASE( SCHEMATIC_IFACE* aSchematic ) :
|
||||
m_schematic( aSchematic )
|
||||
{
|
||||
|
|
|
@ -41,7 +41,7 @@
|
|||
|
||||
#include <set>
|
||||
|
||||
static bool sortPinsByNumber( LIB_PIN* aPin1, LIB_PIN* aPin2 );
|
||||
static bool sortPinsByNumber( SCH_PIN* aPin1, SCH_PIN* aPin2 );
|
||||
|
||||
bool NETLIST_EXPORTER_XML::WriteNetlist( const wxString& aOutFileName, unsigned aNetlistOptions,
|
||||
REPORTER& aReporter )
|
||||
|
@ -570,8 +570,6 @@ XNODE* NETLIST_EXPORTER_XML::makeLibraries()
|
|||
XNODE* NETLIST_EXPORTER_XML::makeLibParts()
|
||||
{
|
||||
XNODE* xlibparts = node( wxT( "libparts" ) ); // auto_ptr
|
||||
|
||||
std::vector<LIB_PIN*> pinList;
|
||||
std::vector<SCH_FIELD*> fieldList;
|
||||
|
||||
m_libraries.clear();
|
||||
|
@ -621,8 +619,7 @@ XNODE* NETLIST_EXPORTER_XML::makeLibParts()
|
|||
}
|
||||
|
||||
//----- show the pins here ------------------------------------
|
||||
pinList.clear();
|
||||
lcomp->GetPins( pinList, 0, 0 );
|
||||
std::vector<SCH_PIN*> pinList = lcomp->GetPins( 0, 0 );
|
||||
|
||||
/*
|
||||
* We must erase redundant Pins references in pinList
|
||||
|
@ -633,6 +630,7 @@ XNODE* NETLIST_EXPORTER_XML::makeLibParts()
|
|||
* found more than once.
|
||||
*/
|
||||
sort( pinList.begin(), pinList.end(), sortPinsByNumber );
|
||||
|
||||
for( int ii = 0; ii < (int)pinList.size()-1; ii++ )
|
||||
{
|
||||
if( pinList[ii]->GetNumber() == pinList[ii+1]->GetNumber() )
|
||||
|
@ -647,6 +645,7 @@ XNODE* NETLIST_EXPORTER_XML::makeLibParts()
|
|||
XNODE* pins;
|
||||
|
||||
xlibpart->AddChild( pins = node( wxT( "pins" ) ) );
|
||||
|
||||
for( unsigned i=0; i<pinList.size(); ++i )
|
||||
{
|
||||
XNODE* pin;
|
||||
|
@ -683,7 +682,9 @@ XNODE* NETLIST_EXPORTER_XML::makeListOfNets( unsigned aCtl )
|
|||
|
||||
struct NET_NODE
|
||||
{
|
||||
NET_NODE( SCH_PIN* aPin, const SCH_SHEET_PATH& aSheet ) : m_Pin( aPin ), m_Sheet( aSheet )
|
||||
NET_NODE( SCH_PIN* aPin, const SCH_SHEET_PATH& aSheet ) :
|
||||
m_Pin( aPin ),
|
||||
m_Sheet( aSheet )
|
||||
{}
|
||||
|
||||
SCH_PIN* m_Pin;
|
||||
|
@ -692,7 +693,10 @@ XNODE* NETLIST_EXPORTER_XML::makeListOfNets( unsigned aCtl )
|
|||
|
||||
struct NET_RECORD
|
||||
{
|
||||
NET_RECORD( const wxString& aName ) : m_Name( aName ), m_HasNoConnect( false ){};
|
||||
NET_RECORD( const wxString& aName ) :
|
||||
m_Name( aName ),
|
||||
m_HasNoConnect( false )
|
||||
{};
|
||||
|
||||
wxString m_Name;
|
||||
bool m_HasNoConnect;
|
||||
|
@ -725,7 +729,7 @@ XNODE* NETLIST_EXPORTER_XML::makeListOfNets( unsigned aCtl )
|
|||
if( item->Type() == SCH_PIN_T )
|
||||
{
|
||||
SCH_PIN* pin = static_cast<SCH_PIN*>( item );
|
||||
SCH_SYMBOL* symbol = static_cast<SCH_SYMBOL*>( pin->GetParentSymbol() );
|
||||
SCH_SYMBOL* symbol = dynamic_cast<SCH_SYMBOL*>( pin->GetParentSymbol() );
|
||||
|
||||
if( !symbol
|
||||
|| ( ( aCtl & GNL_OPT_BOM ) && symbol->GetExcludedFromBOM() )
|
||||
|
@ -852,7 +856,7 @@ XNODE* NETLIST_EXPORTER_XML::node( const wxString& aName,
|
|||
}
|
||||
|
||||
|
||||
static bool sortPinsByNumber( LIB_PIN* aPin1, LIB_PIN* aPin2 )
|
||||
static bool sortPinsByNumber( SCH_PIN* aPin1, SCH_PIN* aPin2 )
|
||||
{
|
||||
// return "lhs < rhs"
|
||||
return StrNumCmp( aPin1->GetShownNumber(), aPin2->GetShownNumber(), true ) < 0;
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
#include <bitmaps.h>
|
||||
#include <cstddef>
|
||||
#include <magic_enum.hpp>
|
||||
#include <lib_pin.h>
|
||||
#include <sch_pin.h>
|
||||
#include "pgm_base.h"
|
||||
|
||||
|
||||
|
@ -140,10 +140,13 @@ void InitTables()
|
|||
g_orientationNames.clear();
|
||||
|
||||
for( PIN_ORIENTATION orientation : magic_enum::enum_values<PIN_ORIENTATION>() )
|
||||
{
|
||||
if( orientation != PIN_ORIENTATION::INHERIT )
|
||||
{
|
||||
g_orientationIcons.push_back( PinOrientationGetBitmap( orientation ) );
|
||||
g_orientationNames.push_back( PinOrientationName( orientation ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -47,7 +47,8 @@ enum class ELECTRICAL_PINTYPE
|
|||
PT_OPENEMITTER, ///< pin type open emitter
|
||||
PT_NC, ///< not connected (must be left open)
|
||||
|
||||
PT_LAST_OPTION = PT_NC ///< sentinel value, set to last usable enum option
|
||||
PT_LAST_OPTION = PT_NC, ///< sentinel value, set to last usable enum option
|
||||
PT_INHERIT
|
||||
};
|
||||
|
||||
#define ELECTRICAL_PINTYPES_TOTAL ( static_cast<int>( ELECTRICAL_PINTYPE::PT_LAST_OPTION ) + 1 )
|
||||
|
@ -64,7 +65,8 @@ enum class GRAPHIC_PINSHAPE
|
|||
FALLING_EDGE_CLOCK,
|
||||
NONLOGIC,
|
||||
|
||||
LAST_OPTION = NONLOGIC ///< this is the sentinel value, must be set to last enum value
|
||||
LAST_OPTION = NONLOGIC, ///< this is the sentinel value, must be set to last enum value
|
||||
INHERIT
|
||||
};
|
||||
|
||||
#define GRAPHIC_PINSHAPES_TOTAL ( static_cast<int>( GRAPHIC_PINSHAPE::LAST_OPTION ) + 1 )
|
||||
|
@ -77,6 +79,9 @@ enum class PIN_ORIENTATION {
|
|||
PIN_LEFT = 'L',
|
||||
PIN_UP = 'U',
|
||||
PIN_DOWN = 'D',
|
||||
|
||||
LAST_OPTION = PIN_DOWN,
|
||||
INHERIT = 'I'
|
||||
};
|
||||
|
||||
|
||||
|
@ -88,8 +93,8 @@ BITMAPS PinShapeGetBitmap( GRAPHIC_PINSHAPE shape );
|
|||
wxString ElectricalPinTypeGetText( ELECTRICAL_PINTYPE );
|
||||
BITMAPS ElectricalPinTypeGetBitmap( ELECTRICAL_PINTYPE );
|
||||
|
||||
wxString PinOrientationName( PIN_ORIENTATION aPinOrientation );
|
||||
BITMAPS PinOrientationGetBitmap( PIN_ORIENTATION aPinOrientation );
|
||||
wxString PinOrientationName( PIN_ORIENTATION aOrientation );
|
||||
BITMAPS PinOrientationGetBitmap( PIN_ORIENTATION aOrientation );
|
||||
PIN_ORIENTATION PinOrientationCode( size_t index );
|
||||
int PinOrientationIndex( PIN_ORIENTATION code );
|
||||
|
||||
|
|
|
@ -321,18 +321,21 @@ bool SCH_CONNECTION::IsDriver() const
|
|||
case SCH_HIER_LABEL_T:
|
||||
case SCH_SHEET_PIN_T:
|
||||
case SCH_SHEET_T:
|
||||
case LIB_PIN_T:
|
||||
return true;
|
||||
|
||||
case SCH_PIN_T:
|
||||
{
|
||||
const SCH_PIN* pin = static_cast<const SCH_PIN*>( Parent() );
|
||||
const SCH_SYMBOL* symbol = static_cast<const SCH_SYMBOL*>( pin->GetParentSymbol() );
|
||||
|
||||
if( const SCH_SYMBOL* symbol = dynamic_cast<const SCH_SYMBOL*>( pin->GetParentSymbol() ) )
|
||||
{
|
||||
// Only annotated symbols should drive nets.
|
||||
return pin->IsGlobalPower() || symbol->IsAnnotated( &m_sheet );
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -37,8 +37,7 @@
|
|||
#include <project/net_settings.h>
|
||||
|
||||
#include <lib_id.h>
|
||||
#include <lib_pin.h>
|
||||
|
||||
#include <sch_pin.h>
|
||||
#include <sch_bitmap.h>
|
||||
#include <sch_bus_entry.h>
|
||||
#include <sch_symbol.h>
|
||||
|
@ -1202,7 +1201,7 @@ void SCH_IO_ALTIUM::ParsePin( const std::map<wxString, wxString>& aProperties,
|
|||
symbol = libSymbolIt->second;
|
||||
}
|
||||
|
||||
LIB_PIN* pin = new LIB_PIN( symbol );
|
||||
SCH_PIN* pin = new SCH_PIN( symbol );
|
||||
|
||||
// Make sure that these are visible when initializing the symbol
|
||||
// This may be overriden by the file data but not by the pin defaults
|
||||
|
@ -3213,7 +3212,7 @@ void SCH_IO_ALTIUM::ParsePowerPort( const std::map<wxString, wxString>& aPropert
|
|||
libSymbol->SetLibId( libId );
|
||||
|
||||
// generate graphic
|
||||
LIB_PIN* pin = new LIB_PIN( libSymbol );
|
||||
SCH_PIN* pin = new SCH_PIN( libSymbol );
|
||||
libSymbol->AddDrawItem( pin, false );
|
||||
|
||||
pin->SetName( elem.text );
|
||||
|
|
|
@ -143,7 +143,7 @@ CADSTAR_SCH_ARCHIVE_LOADER::loadLibPart( const CADSTAR_PART_ENTRY& aPart )
|
|||
for( auto& [storedPinNum, termID] : m_symDefTerminalsMap[symbolID] )
|
||||
{
|
||||
wxCHECK( termID > 0 && sym.m_Pins.size() >= size_t( termID ), nullptr );
|
||||
LIB_PIN* pin = kiSymDef->GetPin( storedPinNum );
|
||||
SCH_PIN* pin = kiSymDef->GetPin( storedPinNum );
|
||||
size_t termIdx = size_t( termID ) - 1;
|
||||
|
||||
// For now leave numerical pin number. Otherwise, when loading the
|
||||
|
@ -234,7 +234,7 @@ CADSTAR_SCH_ARCHIVE_LOADER::loadLibPart( const CADSTAR_PART_ENTRY& aPart )
|
|||
{
|
||||
for( const CADSTAR_PART_PIN& csPin : csPinVector )
|
||||
{
|
||||
std::unique_ptr<LIB_PIN> pin = std::make_unique<LIB_PIN>( retSym.get() );
|
||||
std::unique_ptr<SCH_PIN> pin = std::make_unique<SCH_PIN>( retSym.get() );
|
||||
|
||||
long pinNum = csPin.m_Identifier;
|
||||
pin->SetNumber( wxString::Format( "%ld", pinNum ) );
|
||||
|
@ -878,7 +878,7 @@ void CADSTAR_SCH_ARCHIVE_LOADER::loadSchematicSymbolInstances()
|
|||
kiPart->SetShowPinNames( false );
|
||||
kiPart->SetShowPinNumbers( false );
|
||||
|
||||
std::vector<LIB_PIN*> pins = kiPart->GetAllLibPins();
|
||||
std::vector<SCH_PIN*> pins = kiPart->GetAllLibPins();
|
||||
wxCHECK( pins.size() == 1, /*void*/ );
|
||||
|
||||
pins.at( 0 )->SetType( ELECTRICAL_PINTYPE::PT_POWER_IN );
|
||||
|
@ -1652,7 +1652,7 @@ const LIB_SYMBOL* CADSTAR_SCH_ARCHIVE_LOADER::loadSymdef( const SYMDEF_ID& aSymd
|
|||
TERMINAL term = termPair.second;
|
||||
wxString pinNum = wxString::Format( "%ld", term.ID );
|
||||
wxString pinName = wxEmptyString;
|
||||
std::unique_ptr<LIB_PIN> pin = std::make_unique<LIB_PIN>( kiSym.get() );
|
||||
std::unique_ptr<SCH_PIN> pin = std::make_unique<SCH_PIN>( kiSym.get() );
|
||||
|
||||
// Assume passive pin for now (we will set it later once we load the parts)
|
||||
pin->SetType( ELECTRICAL_PINTYPE::PT_PASSIVE );
|
||||
|
@ -1829,7 +1829,7 @@ void CADSTAR_SCH_ARCHIVE_LOADER::loadSymbolGateAndPartFields( const SYMDEF_ID& a
|
|||
for( auto&& [storedPinNum, termID] : m_symDefTerminalsMap[aSymdefID] )
|
||||
{
|
||||
PART::DEFINITION::PIN csPin = getPartDefinitionPin( aCadstarPart, aGateID, termID );
|
||||
LIB_PIN* pin = kiSymDef->GetPin( storedPinNum );
|
||||
SCH_PIN* pin = kiSymDef->GetPin( storedPinNum );
|
||||
|
||||
wxString pinName = HandleTextOverbar( csPin.Label );
|
||||
wxString pinNum = HandleTextOverbar( csPin.Name );
|
||||
|
@ -2132,7 +2132,7 @@ SCH_SYMBOL* CADSTAR_SCH_ARCHIVE_LOADER::loadSchematicSymbol( const SYMBOL& aCads
|
|||
{
|
||||
TERMINAL_TO_PINNUM_MAP termNumMap = m_pinNumsMap.at( partGateIndex );
|
||||
|
||||
std::map<wxString, LIB_PIN*> pinNumToLibPinMap;
|
||||
std::map<wxString, SCH_PIN*> pinNumToLibPinMap;
|
||||
|
||||
for( auto& term : termNumMap )
|
||||
{
|
||||
|
@ -2147,7 +2147,7 @@ SCH_SYMBOL* CADSTAR_SCH_ARCHIVE_LOADER::loadSchematicSymbol( const SYMBOL& aCads
|
|||
if( aOldPinNum == aNewPinNum )
|
||||
return;
|
||||
|
||||
LIB_PIN* libpin = pinNumToLibPinMap.at( aOldPinNum );
|
||||
SCH_PIN* libpin = pinNumToLibPinMap.at( aOldPinNum );
|
||||
libpin->SetNumber( HandleTextOverbar( aNewPinNum ) );
|
||||
};
|
||||
|
||||
|
@ -3228,9 +3228,9 @@ LIB_SYMBOL* CADSTAR_SCH_ARCHIVE_LOADER::getScaledLibPart( const LIB_SYMBOL* aSym
|
|||
break;
|
||||
}
|
||||
|
||||
case KICAD_T::LIB_PIN_T:
|
||||
case KICAD_T::SCH_PIN_T:
|
||||
{
|
||||
LIB_PIN& pin = static_cast<LIB_PIN&>( item );
|
||||
SCH_PIN& pin = static_cast<SCH_PIN&>( item );
|
||||
|
||||
pin.SetPosition( scalePt( pin.GetPosition() ) );
|
||||
pin.SetLength( scaleLen( pin.GetLength() ) );
|
||||
|
@ -3298,10 +3298,7 @@ void CADSTAR_SCH_ARCHIVE_LOADER::fixUpLibraryPins( LIB_SYMBOL* aSymbolToFix, int
|
|||
}
|
||||
}
|
||||
|
||||
std::vector<LIB_PIN*> pins;
|
||||
aSymbolToFix->GetPins( pins, aGateNumber );
|
||||
|
||||
for( auto& pin : pins )
|
||||
for( SCH_PIN* pin : aSymbolToFix->GetPins( aGateNumber ) )
|
||||
{
|
||||
auto setPinOrientation =
|
||||
[&]( const EDA_ANGLE& aAngle )
|
||||
|
|
|
@ -39,7 +39,6 @@
|
|||
#include <io/eagle/eagle_parser.h>
|
||||
#include <string_utils.h>
|
||||
#include <lib_id.h>
|
||||
#include <lib_pin.h>
|
||||
#include <project.h>
|
||||
#include <project_sch.h>
|
||||
#include <sch_bus_entry.h>
|
||||
|
@ -50,6 +49,7 @@
|
|||
#include <sch_io/kicad_legacy/sch_io_kicad_legacy.h>
|
||||
#include <sch_marker.h>
|
||||
#include <sch_screen.h>
|
||||
#include <sch_pin.h>
|
||||
#include <sch_shape.h>
|
||||
#include <sch_sheet.h>
|
||||
#include <sch_sheet_path.h>
|
||||
|
@ -1967,10 +1967,7 @@ void SCH_IO_EAGLE::loadInstance( wxXmlNode* aInstanceNode )
|
|||
|
||||
symbol->SetLibSymbol( new LIB_SYMBOL( *libSymbol ) );
|
||||
|
||||
std::vector<LIB_PIN*> pins;
|
||||
symbol->GetLibPins( pins );
|
||||
|
||||
for( const LIB_PIN* pin : pins )
|
||||
for( const SCH_PIN* pin : symbol->GetLibPins() )
|
||||
m_connPoints[symbol->GetPinPhysicalPosition( pin )].emplace( pin );
|
||||
|
||||
if( part->IsPower() )
|
||||
|
@ -2153,7 +2150,7 @@ bool SCH_IO_EAGLE::loadSymbol( wxXmlNode* aSymbolNode, std::unique_ptr<LIB_SYMBO
|
|||
else if( nodeName == wxT( "pin" ) )
|
||||
{
|
||||
EPIN ePin = EPIN( currentNode );
|
||||
std::unique_ptr<LIB_PIN> pin( loadPin( aSymbol, currentNode, &ePin, aGateNumber ) );
|
||||
std::unique_ptr<SCH_PIN> pin( loadPin( aSymbol, currentNode, &ePin, aGateNumber ) );
|
||||
pincount++;
|
||||
|
||||
pin->SetType( ELECTRICAL_PINTYPE::PT_BIDI );
|
||||
|
@ -2192,7 +2189,7 @@ bool SCH_IO_EAGLE::loadSymbol( wxXmlNode* aSymbolNode, std::unique_ptr<LIB_SYMBO
|
|||
|
||||
for( unsigned i = 0; i < pads.GetCount(); i++ )
|
||||
{
|
||||
LIB_PIN* apin = new LIB_PIN( *pin );
|
||||
SCH_PIN* apin = new SCH_PIN( *pin );
|
||||
|
||||
wxString padname( pads[i] );
|
||||
apin->SetNumber( padname );
|
||||
|
@ -2429,10 +2426,10 @@ SCH_SHAPE* SCH_IO_EAGLE::loadSymbolPolyLine( wxXmlNode* aPolygonNode, int aGateN
|
|||
}
|
||||
|
||||
|
||||
LIB_PIN* SCH_IO_EAGLE::loadPin( std::unique_ptr<LIB_SYMBOL>& aSymbol, wxXmlNode* aPin,
|
||||
SCH_PIN* SCH_IO_EAGLE::loadPin( std::unique_ptr<LIB_SYMBOL>& aSymbol, wxXmlNode* aPin,
|
||||
EPIN* aEPin, int aGateNumber )
|
||||
{
|
||||
std::unique_ptr<LIB_PIN> pin = std::make_unique<LIB_PIN>( aSymbol.get() );
|
||||
std::unique_ptr<SCH_PIN> pin = std::make_unique<SCH_PIN>( aSymbol.get() );
|
||||
pin->SetPosition( VECTOR2I( aEPin->x.ToSchUnits(), aEPin->y.ToSchUnits() ) );
|
||||
pin->SetName( aEPin->name );
|
||||
pin->SetUnit( aGateNumber );
|
||||
|
@ -3481,7 +3478,7 @@ const SEG* SCH_IO_EAGLE::SEG_DESC::LabelAttached( const SCH_TEXT* aLabel ) const
|
|||
|
||||
// TODO could be used to place junctions, instead of IsJunctionNeeded()
|
||||
// (see SCH_EDIT_FRAME::importFile())
|
||||
bool SCH_IO_EAGLE::checkConnections( const SCH_SYMBOL* aSymbol, const LIB_PIN* aPin ) const
|
||||
bool SCH_IO_EAGLE::checkConnections( const SCH_SYMBOL* aSymbol, const SCH_PIN* aPin ) const
|
||||
{
|
||||
wxCHECK( aSymbol && aPin, false );
|
||||
|
||||
|
@ -3511,12 +3508,11 @@ void SCH_IO_EAGLE::addImplicitConnections( SCH_SYMBOL* aSymbol, SCH_SCREEN* aScr
|
|||
|
||||
int unit = aSymbol->GetUnit();
|
||||
const wxString reference = aSymbol->GetField( REFERENCE_FIELD )->GetText();
|
||||
std::vector<LIB_PIN*> pins;
|
||||
aSymbol->GetLibSymbolRef()->GetPins( pins );
|
||||
std::vector<SCH_PIN*> pins = aSymbol->GetLibSymbolRef()->GetAllLibPins();
|
||||
std::set<int> missingUnits;
|
||||
|
||||
// Search all units for pins creating implicit connections
|
||||
for( const LIB_PIN* pin : pins )
|
||||
for( const SCH_PIN* pin : pins )
|
||||
{
|
||||
if( pin->GetType() == ELECTRICAL_PINTYPE::PT_POWER_IN )
|
||||
{
|
||||
|
@ -3536,12 +3532,13 @@ void SCH_IO_EAGLE::addImplicitConnections( SCH_SYMBOL* aSymbol, SCH_SCREEN* aScr
|
|||
|
||||
switch( pin->GetOrientation() )
|
||||
{
|
||||
case PIN_ORIENTATION::PIN_LEFT:
|
||||
netLabel->SetSpinStyle( SPIN_STYLE::RIGHT );
|
||||
break;
|
||||
default:
|
||||
case PIN_ORIENTATION::PIN_RIGHT:
|
||||
netLabel->SetSpinStyle( SPIN_STYLE::LEFT );
|
||||
break;
|
||||
case PIN_ORIENTATION::PIN_LEFT:
|
||||
netLabel->SetSpinStyle( SPIN_STYLE::RIGHT );
|
||||
break;
|
||||
case PIN_ORIENTATION::PIN_UP:
|
||||
netLabel->SetSpinStyle( SPIN_STYLE::UP );
|
||||
break;
|
||||
|
|
|
@ -51,7 +51,7 @@ class SCH_FIELD;
|
|||
class STRING_UTF8_MAP;
|
||||
class LIB_SYMBOL;
|
||||
class SYMBOL_LIB;
|
||||
class LIB_PIN;
|
||||
class SCH_PIN;
|
||||
class wxXmlNode;
|
||||
|
||||
|
||||
|
@ -156,7 +156,7 @@ private:
|
|||
SCH_SHAPE* loadSymbolRectangle( wxXmlNode* aRectNode, int aGateNumber );
|
||||
SCH_SHAPE* loadSymbolPolyLine( wxXmlNode* aPolygonNode, int aGateNumber );
|
||||
SCH_ITEM* loadSymbolWire( wxXmlNode* aWireNode, int aGateNumber );
|
||||
LIB_PIN* loadPin( std::unique_ptr<LIB_SYMBOL>& aSymbol, wxXmlNode*, EPIN* epin,
|
||||
SCH_PIN* loadPin( std::unique_ptr<LIB_SYMBOL>& aSymbol, wxXmlNode*, EPIN* epin,
|
||||
int aGateNumber );
|
||||
SCH_TEXT* loadSymbolText( wxXmlNode* aLibText, int aGateNumber );
|
||||
void loadSymbolFrame( wxXmlNode* aFrameNode, std::vector<SCH_ITEM*>& aLines );
|
||||
|
@ -181,7 +181,7 @@ private:
|
|||
wxFileName getLibFileName();
|
||||
|
||||
///< Checks if there are other wires or pins at the position of the tested pin
|
||||
bool checkConnections( const SCH_SYMBOL* aSymbol, const LIB_PIN* aPin ) const;
|
||||
bool checkConnections( const SCH_SYMBOL* aSymbol, const SCH_PIN* aPin ) const;
|
||||
|
||||
/**
|
||||
* Create net labels to emulate implicit connections in Eagle.
|
||||
|
|
|
@ -845,7 +845,7 @@ void SCH_EASYEDA_PARSER::ParseSymbolShapes( LIB_SYMBOL* aSymbol
|
|||
}
|
||||
}
|
||||
|
||||
std::unique_ptr<LIB_PIN> pin = std::make_unique<LIB_PIN>( aSymbol );
|
||||
std::unique_ptr<SCH_PIN> pin = std::make_unique<SCH_PIN>( aSymbol );
|
||||
|
||||
pin->SetName( pinName );
|
||||
pin->SetNumber( pinNumber );
|
||||
|
@ -1006,7 +1006,7 @@ std::pair<LIB_SYMBOL*, bool> SCH_EASYEDA_PARSER::MakePowerSymbol( const wxString
|
|||
ksymbol->SetShowPinNames( false );
|
||||
ksymbol->SetShowPinNumbers( false );
|
||||
|
||||
std::unique_ptr<LIB_PIN> pin = std::make_unique<LIB_PIN>( ksymbol.get() );
|
||||
std::unique_ptr<SCH_PIN> pin = std::make_unique<SCH_PIN>( ksymbol.get() );
|
||||
|
||||
pin->SetName( aNetname );
|
||||
pin->SetNumber( wxS( "1" ) );
|
||||
|
|
|
@ -709,7 +709,7 @@ EASYEDAPRO::SYM_INFO SCH_EASYEDAPRO_PARSER::ParseSymbol( const std::vector<nlohm
|
|||
EASYEDAPRO::PIN_INFO pinInfo;
|
||||
pinInfo.pin = *epin;
|
||||
|
||||
std::unique_ptr<LIB_PIN> pin = std::make_unique<LIB_PIN>( ksymbol );
|
||||
std::unique_ptr<SCH_PIN> pin = std::make_unique<SCH_PIN>( ksymbol );
|
||||
|
||||
pin->SetUnit( unitId );
|
||||
|
||||
|
@ -1141,7 +1141,7 @@ void SCH_EASYEDAPRO_PARSER::ParseSchematic( SCHEMATIC* aSchematic, SCH_SHEET* aR
|
|||
ApplyAttrToField( fontStyles, schSym->GetField( VALUE_FIELD ), *globalNetAttr,
|
||||
false, true, compAttrs, schSym.get() );
|
||||
|
||||
for( LIB_PIN* pin : schSym->GetAllLibPins() )
|
||||
for( SCH_PIN* pin : schSym->GetAllLibPins() )
|
||||
pin->SetName( globalNetAttr->value );
|
||||
}
|
||||
else
|
||||
|
|
|
@ -20,8 +20,9 @@
|
|||
#include <magic_enum.hpp>
|
||||
#include <wx/log.h>
|
||||
|
||||
#include <lib_symbol.h>
|
||||
#include <sch_shape.h>
|
||||
#include <lib_pin.h>
|
||||
#include <sch_pin.h>
|
||||
#include <sch_text.h>
|
||||
#include <macros.h>
|
||||
#include <richio.h>
|
||||
|
@ -1080,12 +1081,12 @@ SCH_SHAPE* SCH_IO_KICAD_LEGACY_LIB_CACHE::loadRect( LINE_READER& aReader )
|
|||
}
|
||||
|
||||
|
||||
LIB_PIN* SCH_IO_KICAD_LEGACY_LIB_CACHE::loadPin( std::unique_ptr<LIB_SYMBOL>& aSymbol,
|
||||
SCH_PIN* SCH_IO_KICAD_LEGACY_LIB_CACHE::loadPin( std::unique_ptr<LIB_SYMBOL>& aSymbol,
|
||||
LINE_READER& aReader )
|
||||
{
|
||||
const char* line = aReader.Line();
|
||||
|
||||
wxCHECK_MSG( strCompare( "X", line, &line ), nullptr, "Invalid LIB_PIN definition" );
|
||||
wxCHECK_MSG( strCompare( "X", line, &line ), nullptr, "Invalid SCH_PIN definition" );
|
||||
|
||||
wxString name;
|
||||
wxString number;
|
||||
|
@ -1233,8 +1234,7 @@ LIB_PIN* SCH_IO_KICAD_LEGACY_LIB_CACHE::loadPin( std::unique_ptr<LIB_SYMBOL>& aS
|
|||
aReader.LineNumber(), pos );
|
||||
}
|
||||
|
||||
|
||||
LIB_PIN* pin = new LIB_PIN( aSymbol.get(),
|
||||
SCH_PIN* pin = new SCH_PIN( aSymbol.get(),
|
||||
ConvertToNewOverbarNotation( name ),
|
||||
ConvertToNewOverbarNotation( number ),
|
||||
orientation,
|
||||
|
@ -1263,7 +1263,7 @@ LIB_PIN* SCH_IO_KICAD_LEGACY_LIB_CACHE::loadPin( std::unique_ptr<LIB_SYMBOL>& aS
|
|||
|
||||
int flags = 0;
|
||||
|
||||
for( int j = tmp.size(); j > 0; )
|
||||
for( int j = (int) tmp.size(); j > 0; )
|
||||
{
|
||||
switch( tmp[--j].GetValue() )
|
||||
{
|
||||
|
@ -1572,8 +1572,8 @@ void SCH_IO_KICAD_LEGACY_LIB_CACHE::SaveSymbol( LIB_SYMBOL* aSymbol, OUTPUTFORMA
|
|||
{
|
||||
switch( item.Type() )
|
||||
{
|
||||
case LIB_PIN_T:
|
||||
savePin( static_cast<LIB_PIN*>( &item ), aFormatter );
|
||||
case SCH_PIN_T:
|
||||
savePin( static_cast<SCH_PIN*>( &item ), aFormatter );
|
||||
|
||||
break;
|
||||
case SCH_TEXT_T:
|
||||
|
@ -1723,9 +1723,9 @@ void SCH_IO_KICAD_LEGACY_LIB_CACHE::saveField( const SCH_FIELD* aField,
|
|||
}
|
||||
|
||||
|
||||
void SCH_IO_KICAD_LEGACY_LIB_CACHE::savePin( const LIB_PIN* aPin, OUTPUTFORMATTER& aFormatter )
|
||||
void SCH_IO_KICAD_LEGACY_LIB_CACHE::savePin( const SCH_PIN* aPin, OUTPUTFORMATTER& aFormatter )
|
||||
{
|
||||
wxCHECK_RET( aPin && aPin->Type() == LIB_PIN_T, "Invalid LIB_PIN object." );
|
||||
wxCHECK_RET( aPin && aPin->Type() == SCH_PIN_T, "Invalid SCH_PIN object." );
|
||||
|
||||
int Etype;
|
||||
|
||||
|
@ -1784,7 +1784,7 @@ void SCH_IO_KICAD_LEGACY_LIB_CACHE::savePin( const LIB_PIN* aPin, OUTPUTFORMATTE
|
|||
|
||||
aFormatter.Print( 0, "\n" );
|
||||
|
||||
const_cast<LIB_PIN*>( aPin )->ClearFlags( IS_CHANGED );
|
||||
const_cast<SCH_PIN*>( aPin )->ClearFlags( IS_CHANGED );
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -29,7 +29,8 @@
|
|||
#include "sch_io/sch_io_lib_cache.h"
|
||||
|
||||
class FILE_LINE_READER;
|
||||
class LIB_PIN;
|
||||
class SCH_PIN;
|
||||
class SCH_FIELD;
|
||||
class SCH_SHAPE;
|
||||
class SCH_TEXT;
|
||||
class LINE_READER;
|
||||
|
@ -77,7 +78,7 @@ private:
|
|||
static SCH_SHAPE* loadCircle( LINE_READER& aReader );
|
||||
static SCH_TEXT* loadText( LINE_READER& aReader, int aMajorVersion, int aMinorVersion );
|
||||
static SCH_SHAPE* loadRect( LINE_READER& aReader );
|
||||
static LIB_PIN* loadPin( std::unique_ptr<LIB_SYMBOL>& aSymbol, LINE_READER& aReader );
|
||||
static SCH_PIN* loadPin( std::unique_ptr<LIB_SYMBOL>& aSymbol, LINE_READER& aReader );
|
||||
static SCH_SHAPE* loadPolyLine( LINE_READER& aReader );
|
||||
static SCH_SHAPE* loadBezier( LINE_READER& aReader );
|
||||
|
||||
|
@ -88,7 +89,7 @@ private:
|
|||
static void saveBezier( SCH_SHAPE* aBezier, OUTPUTFORMATTER& aFormatter );
|
||||
static void saveCircle( SCH_SHAPE* aCircle, OUTPUTFORMATTER& aFormatter );
|
||||
static void saveField( const SCH_FIELD* aField, OUTPUTFORMATTER& aFormatter );
|
||||
static void savePin( const LIB_PIN* aPin, OUTPUTFORMATTER& aFormatter );
|
||||
static void savePin( const SCH_PIN* aPin, OUTPUTFORMATTER& aFormatter );
|
||||
static void savePolyLine( SCH_SHAPE* aPolyLine, OUTPUTFORMATTER& aFormatter );
|
||||
static void saveRectangle( SCH_SHAPE* aRectangle, OUTPUTFORMATTER& aFormatter );
|
||||
static void saveText( const SCH_TEXT* aText, OUTPUTFORMATTER& aFormatter );
|
||||
|
|
|
@ -39,6 +39,7 @@
|
|||
#include <sch_edit_frame.h> // SYMBOL_ORIENTATION_T
|
||||
#include <sch_junction.h>
|
||||
#include <sch_line.h>
|
||||
#include <sch_pin.h>
|
||||
#include <sch_shape.h>
|
||||
#include <sch_no_connect.h>
|
||||
#include <sch_text.h>
|
||||
|
@ -49,7 +50,6 @@
|
|||
#include <sch_sheet_pin.h>
|
||||
#include <schematic.h>
|
||||
#include <sch_screen.h>
|
||||
#include <lib_pin.h>
|
||||
#include <io/kicad/kicad_io_utils.h>
|
||||
#include <schematic_lexer.h>
|
||||
#include <sch_io/kicad_sexpr/sch_io_kicad_sexpr.h>
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
#include <eda_shape.h>
|
||||
#include <kiid.h>
|
||||
#include <lib_pin.h>
|
||||
#include <sch_pin.h>
|
||||
#include <sch_sheet_pin.h>
|
||||
#include <sch_text.h>
|
||||
|
||||
|
|
|
@ -370,8 +370,8 @@ void SCH_IO_KICAD_SEXPR_LIB_CACHE::saveSymbolDrawItem( SCH_ITEM* aItem, OUTPUTFO
|
|||
break;
|
||||
}
|
||||
|
||||
case LIB_PIN_T:
|
||||
savePin( static_cast<LIB_PIN*>( aItem ), aFormatter, aNestLevel );
|
||||
case SCH_PIN_T:
|
||||
savePin( static_cast<SCH_PIN*>( aItem ), aFormatter, aNestLevel );
|
||||
break;
|
||||
|
||||
case SCH_TEXT_T:
|
||||
|
@ -419,10 +419,10 @@ void SCH_IO_KICAD_SEXPR_LIB_CACHE::saveField( SCH_FIELD* aField, OUTPUTFORMATTER
|
|||
}
|
||||
|
||||
|
||||
void SCH_IO_KICAD_SEXPR_LIB_CACHE::savePin( LIB_PIN* aPin, OUTPUTFORMATTER& aFormatter,
|
||||
void SCH_IO_KICAD_SEXPR_LIB_CACHE::savePin( SCH_PIN* aPin, OUTPUTFORMATTER& aFormatter,
|
||||
int aNestLevel )
|
||||
{
|
||||
wxCHECK_RET( aPin && aPin->Type() == LIB_PIN_T, "Invalid LIB_PIN object." );
|
||||
wxCHECK_RET( aPin && aPin->Type() == SCH_PIN_T, "Invalid SCH_PIN object." );
|
||||
|
||||
aPin->ClearFlags( IS_CHANGED );
|
||||
|
||||
|
@ -458,7 +458,7 @@ void SCH_IO_KICAD_SEXPR_LIB_CACHE::savePin( LIB_PIN* aPin, OUTPUTFORMATTER& aFor
|
|||
aPin->GetNumberTextSize() ).c_str() );
|
||||
|
||||
|
||||
for( const std::pair<const wxString, LIB_PIN::ALT>& alt : aPin->GetAlternates() )
|
||||
for( const std::pair<const wxString, SCH_PIN::ALT>& alt : aPin->GetAlternates() )
|
||||
{
|
||||
aFormatter.Print( aNestLevel + 1, "(alternate %s %s %s)\n",
|
||||
aFormatter.Quotew( alt.second.m_Name ).c_str(),
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
#include "sch_io/sch_io_lib_cache.h"
|
||||
|
||||
class FILE_LINE_READER;
|
||||
class LIB_PIN;
|
||||
class SCH_PIN;
|
||||
class SCH_TEXT;
|
||||
class SCH_TEXTBOX;
|
||||
class LINE_READER;
|
||||
|
@ -65,7 +65,7 @@ private:
|
|||
static void saveSymbolDrawItem( SCH_ITEM* aItem, OUTPUTFORMATTER& aFormatter,
|
||||
int aNestLevel );
|
||||
static void saveField( SCH_FIELD* aField, OUTPUTFORMATTER& aFormatter, int aNestLevel );
|
||||
static void savePin( LIB_PIN* aPin, OUTPUTFORMATTER& aFormatter, int aNestLevel = 0 );
|
||||
static void savePin( SCH_PIN* aPin, OUTPUTFORMATTER& aFormatter, int aNestLevel = 0 );
|
||||
static void saveText( SCH_TEXT* aText, OUTPUTFORMATTER& aFormatter, int aNestLevel = 0 );
|
||||
static void saveTextBox( SCH_TEXTBOX* aTextBox, OUTPUTFORMATTER& aFormatter,
|
||||
int aNestLevel = 0 );
|
||||
|
|
|
@ -36,7 +36,7 @@
|
|||
|
||||
#include <base_units.h>
|
||||
#include <lib_id.h>
|
||||
#include <lib_pin.h>
|
||||
#include <sch_pin.h>
|
||||
#include <math/util.h> // KiROUND, Clamp
|
||||
#include <font/font.h>
|
||||
#include <string_utils.h>
|
||||
|
@ -1415,7 +1415,7 @@ SCH_SHAPE* SCH_IO_KICAD_SEXPR_PARSER::parseSymbolCircle()
|
|||
}
|
||||
|
||||
|
||||
LIB_PIN* SCH_IO_KICAD_SEXPR_PARSER::parsePin()
|
||||
SCH_PIN* SCH_IO_KICAD_SEXPR_PARSER::parsePin()
|
||||
{
|
||||
auto parseType = [&]( T token ) -> ELECTRICAL_PINTYPE
|
||||
{
|
||||
|
@ -1470,7 +1470,7 @@ LIB_PIN* SCH_IO_KICAD_SEXPR_PARSER::parsePin()
|
|||
T token;
|
||||
wxString tmp;
|
||||
wxString error;
|
||||
std::unique_ptr<LIB_PIN> pin = std::make_unique<LIB_PIN>( nullptr );
|
||||
std::unique_ptr<SCH_PIN> pin = std::make_unique<SCH_PIN>( nullptr );
|
||||
|
||||
pin->SetUnit( m_unit );
|
||||
pin->SetBodyStyle( m_bodyStyle );
|
||||
|
@ -1592,7 +1592,7 @@ LIB_PIN* SCH_IO_KICAD_SEXPR_PARSER::parsePin()
|
|||
|
||||
case T_alternate:
|
||||
{
|
||||
LIB_PIN::ALT alt;
|
||||
SCH_PIN::ALT alt;
|
||||
|
||||
token = NextTok();
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@
|
|||
#include <default_values.h> // For some default values
|
||||
|
||||
|
||||
class LIB_PIN;
|
||||
class SCH_PIN;
|
||||
class PAGE_INFO;
|
||||
class SCH_BITMAP;
|
||||
class SCH_BUS_WIRE_ENTRY;
|
||||
|
@ -196,7 +196,7 @@ private:
|
|||
SCH_SHAPE* parseSymbolArc();
|
||||
SCH_SHAPE* parseSymbolBezier();
|
||||
SCH_SHAPE* parseSymbolCircle();
|
||||
LIB_PIN* parsePin();
|
||||
SCH_PIN* parsePin();
|
||||
SCH_SHAPE* parseSymbolPolyLine();
|
||||
SCH_SHAPE* parseSymbolRectangle();
|
||||
SCH_TEXT* parseSymbolText();
|
||||
|
|
|
@ -308,7 +308,7 @@ void SCH_IO_LTSPICE_PARSER::CreateSymbol( LTSPICE_SCHEMATIC::LT_SYMBOL& aLtSymbo
|
|||
|
||||
for( int j = 0; j < (int) aLtSymbol.Pins.size(); j++ )
|
||||
{
|
||||
LIB_PIN* pin = new LIB_PIN( aLibSymbol );
|
||||
SCH_PIN* pin = new SCH_PIN( aLibSymbol );
|
||||
|
||||
CreatePin( aLtSymbol, j, pin );
|
||||
aLibSymbol->AddDrawItem( pin );
|
||||
|
@ -833,7 +833,7 @@ SCH_SYMBOL* SCH_IO_LTSPICE_PARSER::CreatePowerSymbol( const VECTOR2I& aOffset,
|
|||
lib_symbol->AddDrawItem( shape );
|
||||
lib_symbol->SetPower();
|
||||
|
||||
LIB_PIN* pin = new LIB_PIN( lib_symbol );
|
||||
SCH_PIN* pin = new SCH_PIN( lib_symbol );
|
||||
|
||||
pin->SetType( ELECTRICAL_PINTYPE::PT_POWER_IN );
|
||||
pin->SetPosition( ToInvertedKicadCoords( { 0, 0 } ) );
|
||||
|
@ -1272,7 +1272,7 @@ void SCH_IO_LTSPICE_PARSER::CreateRect( LTSPICE_SCHEMATIC::LT_SYMBOL& aLTSymbol,
|
|||
|
||||
|
||||
void SCH_IO_LTSPICE_PARSER::CreatePin( LTSPICE_SCHEMATIC::LT_SYMBOL& aLTSymbol, int aIndex,
|
||||
LIB_PIN* aPin )
|
||||
SCH_PIN* aPin )
|
||||
{
|
||||
LTSPICE_SCHEMATIC::LT_PIN& lt_pin = aLTSymbol.Pins[aIndex];
|
||||
wxString device = aLTSymbol.Name.Lower();
|
||||
|
|
|
@ -35,7 +35,7 @@
|
|||
|
||||
|
||||
class EDA_TEXT;
|
||||
class LIB_PIN;
|
||||
class SCH_PIN;
|
||||
class SCH_LABEL_BASE;
|
||||
class SCH_SYMBOL;
|
||||
class SCH_TEXT;
|
||||
|
@ -252,7 +252,7 @@ public:
|
|||
/**
|
||||
* Create a pin from an asy file.
|
||||
*/
|
||||
void CreatePin( LTSPICE_SCHEMATIC::LT_SYMBOL& aLTSymbol, int aIndex, LIB_PIN* aPin );
|
||||
void CreatePin( LTSPICE_SCHEMATIC::LT_SYMBOL& aLTSymbol, int aIndex, SCH_PIN* aPin );
|
||||
|
||||
/**
|
||||
* Create a symbol arc.
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
#include <geometry/shape_segment.h>
|
||||
#include <geometry/shape_rect.h>
|
||||
#include <gr_text.h>
|
||||
#include <lib_pin.h>
|
||||
#include <sch_pin.h>
|
||||
#include <math/util.h>
|
||||
#include <pgm_base.h>
|
||||
#include <sch_bitmap.h>
|
||||
|
@ -88,7 +88,7 @@ std::vector<KICAD_T> SCH_PAINTER::g_ScaledSelectionTypes = {
|
|||
SCH_SHEET_PIN_T,
|
||||
LIB_SYMBOL_T, SCH_SYMBOL_T,
|
||||
SCH_SHEET_T,
|
||||
LIB_PIN_T, SCH_PIN_T
|
||||
SCH_PIN_T
|
||||
};
|
||||
|
||||
|
||||
|
@ -178,9 +178,9 @@ void SCH_PAINTER::draw( const EDA_ITEM* aItem, int aLayer, bool aDimmed )
|
|||
case LIB_SYMBOL_T:
|
||||
draw( static_cast<const LIB_SYMBOL*>( aItem ), aLayer );
|
||||
break;
|
||||
case LIB_PIN_T:
|
||||
case SCH_PIN_T:
|
||||
drawBoundingBox = false;
|
||||
draw( static_cast<const LIB_PIN*>( aItem ), aLayer, aDimmed );
|
||||
draw( static_cast<const SCH_PIN*>( aItem ), aLayer, aDimmed );
|
||||
break;
|
||||
case SCH_SYMBOL_T:
|
||||
draw( static_cast<const SCH_SYMBOL*>( aItem ), aLayer );
|
||||
|
@ -315,21 +315,13 @@ float SCH_PAINTER::getShadowWidth( bool aForHighlight ) const
|
|||
}
|
||||
|
||||
|
||||
// A helper function to know if a EDA_ITEM is a member of a footprint
|
||||
static bool IsItemFPMember( const EDA_ITEM* aItem )
|
||||
{
|
||||
return aItem->GetParent() && ( aItem->GetParent()->Type() == LIB_SYMBOL_T
|
||||
|| aItem->GetParent()->Type() == SCH_SYMBOL_T );
|
||||
}
|
||||
|
||||
|
||||
COLOR4D SCH_PAINTER::getRenderColor( const EDA_ITEM* aItem, int aLayer, bool aDrawingShadows,
|
||||
COLOR4D SCH_PAINTER::getRenderColor( const SCH_ITEM* aItem, int aLayer, bool aDrawingShadows,
|
||||
bool aDimmed ) const
|
||||
{
|
||||
COLOR4D color = m_schSettings.GetLayerColor( aLayer );
|
||||
// Graphic items of a SYMBOL frequently use the LAYER_DEVICE layer color
|
||||
// (i.e. when no specific color is set)
|
||||
bool isFpMember = IsItemFPMember( aItem );
|
||||
bool isSymbolChild = aItem->GetParentSymbol() != nullptr;
|
||||
|
||||
if( aItem->Type() == SCH_LINE_T )
|
||||
{
|
||||
|
@ -360,21 +352,22 @@ COLOR4D SCH_PAINTER::getRenderColor( const EDA_ITEM* aItem, int aLayer, bool aDr
|
|||
|
||||
if( aLayer == LAYER_DEVICE_BACKGROUND || aLayer == LAYER_NOTES_BACKGROUND )
|
||||
{
|
||||
if( !isFpMember || shape->GetFillColor() != COLOR4D::UNSPECIFIED )
|
||||
if( !isSymbolChild || shape->GetFillColor() != COLOR4D::UNSPECIFIED )
|
||||
color = shape->GetFillColor();
|
||||
if( isFpMember && shape->GetFillMode() == FILL_T::FILLED_SHAPE )
|
||||
|
||||
if( isSymbolChild && shape->GetFillMode() == FILL_T::FILLED_SHAPE )
|
||||
color = shape->GetStroke().GetColor();
|
||||
}
|
||||
else
|
||||
{
|
||||
if( !isFpMember || shape->GetStroke().GetColor() != COLOR4D::UNSPECIFIED )
|
||||
if( !isSymbolChild || shape->GetStroke().GetColor() != COLOR4D::UNSPECIFIED )
|
||||
color = shape->GetStroke().GetColor();
|
||||
}
|
||||
|
||||
// A filled shape means filled; if they didn't specify a fill colour then use the
|
||||
// border colour.
|
||||
if( color == COLOR4D::UNSPECIFIED )
|
||||
color = m_schSettings.GetLayerColor( isFpMember ? LAYER_DEVICE : LAYER_NOTES );
|
||||
color = m_schSettings.GetLayerColor( isSymbolChild ? LAYER_DEVICE : LAYER_NOTES );
|
||||
}
|
||||
else if( aItem->IsType( { SCH_LABEL_LOCATE_ANY_T } ) )
|
||||
{
|
||||
|
@ -390,12 +383,12 @@ COLOR4D SCH_PAINTER::getRenderColor( const EDA_ITEM* aItem, int aLayer, bool aDr
|
|||
|
||||
if( aLayer == LAYER_DEVICE_BACKGROUND || aLayer == LAYER_NOTES_BACKGROUND )
|
||||
color = textBox->GetFillColor();
|
||||
else if( !isFpMember || textBox->GetTextColor() != COLOR4D::UNSPECIFIED )
|
||||
else if( !isSymbolChild || textBox->GetTextColor() != COLOR4D::UNSPECIFIED )
|
||||
color = textBox->GetTextColor();
|
||||
}
|
||||
else if( const EDA_TEXT* otherTextItem = dynamic_cast<const EDA_TEXT*>( aItem ) )
|
||||
{
|
||||
if( !isFpMember || otherTextItem->GetTextColor() != COLOR4D::UNSPECIFIED )
|
||||
if( !isSymbolChild || otherTextItem->GetTextColor() != COLOR4D::UNSPECIFIED )
|
||||
color = otherTextItem->GetTextColor();
|
||||
}
|
||||
}
|
||||
|
@ -424,8 +417,8 @@ COLOR4D SCH_PAINTER::getRenderColor( const EDA_ITEM* aItem, int aLayer, bool aDr
|
|||
if( aDrawingShadows )
|
||||
color = m_schSettings.GetLayerColor( LAYER_SELECTION_SHADOWS );
|
||||
}
|
||||
else if( aItem->IsSelected()
|
||||
&& ( aLayer == LAYER_DEVICE_BACKGROUND || aLayer == LAYER_SHEET_BACKGROUND ) )
|
||||
else if( aItem->IsSelected() && ( aLayer == LAYER_DEVICE_BACKGROUND
|
||||
|| aLayer == LAYER_SHEET_BACKGROUND ) )
|
||||
{
|
||||
// Selected items will be painted over all other items, so make backgrounds translucent so
|
||||
// that non-selected overlapping objects are visible
|
||||
|
@ -452,17 +445,11 @@ COLOR4D SCH_PAINTER::getRenderColor( const EDA_ITEM* aItem, int aLayer, bool aDr
|
|||
}
|
||||
|
||||
|
||||
float SCH_PAINTER::getLineWidth( const EDA_ITEM* aItem, bool aDrawingShadows ) const
|
||||
float SCH_PAINTER::getLineWidth( const SCH_ITEM* aItem, bool aDrawingShadows ) const
|
||||
{
|
||||
wxCHECK( aItem, static_cast<float>( schIUScale.MilsToIU( DEFAULT_LINE_WIDTH_MILS ) ) );
|
||||
|
||||
int pen = 0;
|
||||
|
||||
if( const SCH_ITEM* item = dynamic_cast<const SCH_ITEM*>( aItem ) )
|
||||
pen = item->GetEffectivePenWidth( &m_schSettings );
|
||||
else
|
||||
UNIMPLEMENTED_FOR( aItem->GetClass() );
|
||||
|
||||
int pen = aItem->GetEffectivePenWidth( &m_schSettings );
|
||||
float width = pen;
|
||||
|
||||
if( aItem->IsBrightened() || aItem->IsSelected() )
|
||||
|
@ -475,7 +462,7 @@ float SCH_PAINTER::getLineWidth( const EDA_ITEM* aItem, bool aDrawingShadows ) c
|
|||
}
|
||||
|
||||
|
||||
float SCH_PAINTER::getTextThickness( const EDA_ITEM* aItem ) const
|
||||
float SCH_PAINTER::getTextThickness( const SCH_ITEM* aItem ) const
|
||||
{
|
||||
int pen = m_schSettings.GetDefaultPenWidth();
|
||||
|
||||
|
@ -540,20 +527,21 @@ static bool isFieldsLayer( int aLayer )
|
|||
|
||||
|
||||
void SCH_PAINTER::strokeText( const wxString& aText, const VECTOR2D& aPosition,
|
||||
const TEXT_ATTRIBUTES& aAttrs, const KIFONT::METRICS& aFontMetrics )
|
||||
const TEXT_ATTRIBUTES& aAttributes,
|
||||
const KIFONT::METRICS& aFontMetrics )
|
||||
{
|
||||
KIFONT::FONT* font = aAttrs.m_Font;
|
||||
KIFONT::FONT* font = aAttributes.m_Font;
|
||||
|
||||
if( !font )
|
||||
{
|
||||
font = KIFONT::FONT::GetFont( eeconfig()->m_Appearance.default_font, aAttrs.m_Bold,
|
||||
aAttrs.m_Italic );
|
||||
font = KIFONT::FONT::GetFont( eeconfig()->m_Appearance.default_font, aAttributes.m_Bold,
|
||||
aAttributes.m_Italic );
|
||||
}
|
||||
|
||||
m_gal->SetIsFill( font->IsOutline() );
|
||||
m_gal->SetIsStroke( font->IsStroke() );
|
||||
|
||||
font->Draw( m_gal, aText, aPosition, aAttrs, aFontMetrics );
|
||||
font->Draw( m_gal, aText, aPosition, aAttributes, aFontMetrics );
|
||||
}
|
||||
|
||||
|
||||
|
@ -620,8 +608,10 @@ void SCH_PAINTER::knockoutText( const wxString& aText, const VECTOR2D& aPosition
|
|||
|
||||
void SCH_PAINTER::boxText( const wxString& aText, const VECTOR2D& aPosition,
|
||||
const TEXT_ATTRIBUTES& aAttrs, const KIFONT::METRICS& aFontMetrics,
|
||||
bool invertY )
|
||||
bool aInvertY )
|
||||
{
|
||||
bool invertY = aInvertY;
|
||||
|
||||
KIFONT::FONT* font = aAttrs.m_Font;
|
||||
|
||||
if( !font )
|
||||
|
@ -812,7 +802,7 @@ bool SCH_PAINTER::setDeviceColors( const SCH_ITEM* aItem, int aLayer, bool aDimm
|
|||
}
|
||||
|
||||
|
||||
int SCH_PAINTER::internalPinDecoSize( const LIB_PIN &aPin )
|
||||
int SCH_PAINTER::internalPinDecoSize( const SCH_PIN &aPin )
|
||||
{
|
||||
if( m_schSettings.m_PinSymbolSize > 0 )
|
||||
return m_schSettings.m_PinSymbolSize;
|
||||
|
@ -823,7 +813,7 @@ int SCH_PAINTER::internalPinDecoSize( const LIB_PIN &aPin )
|
|||
|
||||
// Utility for getting the size of the 'external' pin decorators (as a radius)
|
||||
// i.e. the negation circle, the polarity 'slopes' and the nonlogic marker
|
||||
int SCH_PAINTER::externalPinDecoSize( const LIB_PIN &aPin )
|
||||
int SCH_PAINTER::externalPinDecoSize( const SCH_PIN &aPin )
|
||||
{
|
||||
if( m_schSettings.m_PinSymbolSize > 0 )
|
||||
return m_schSettings.m_PinSymbolSize;
|
||||
|
@ -849,7 +839,7 @@ void SCH_PAINTER::drawPinDanglingIndicator( const VECTOR2I& aPos, const COLOR4D&
|
|||
}
|
||||
|
||||
|
||||
void SCH_PAINTER::draw( const LIB_PIN* aPin, int aLayer, bool aDimmed )
|
||||
void SCH_PAINTER::draw( const SCH_PIN* aPin, int aLayer, bool aDimmed )
|
||||
{
|
||||
if( !isUnitAndConversionShown( aPin ) )
|
||||
return;
|
||||
|
@ -993,6 +983,7 @@ void SCH_PAINTER::draw( const LIB_PIN* aPin, int aLayer, bool aDimmed )
|
|||
{
|
||||
switch( aPin->GetShape() )
|
||||
{
|
||||
default:
|
||||
case GRAPHIC_PINSHAPE::LINE:
|
||||
m_gal->DrawLine( p0, pos );
|
||||
break;
|
||||
|
@ -1091,22 +1082,17 @@ void SCH_PAINTER::draw( const LIB_PIN* aPin, int aLayer, bool aDimmed )
|
|||
}
|
||||
}
|
||||
|
||||
const SYMBOL* libEntry = aPin->GetParentSymbol();
|
||||
|
||||
// Draw the labels
|
||||
|
||||
if( libEntry->Type() == LIB_SYMBOL_T )
|
||||
{
|
||||
if( drawingShadows && !eeconfig()->m_Selection.draw_selected_children )
|
||||
return;
|
||||
}
|
||||
|
||||
// Draw the labels
|
||||
const SYMBOL* symbol = aPin->GetParentSymbol();
|
||||
float penWidth = (float) m_schSettings.GetDefaultPenWidth();
|
||||
int textOffset = libEntry->GetPinNameOffset();
|
||||
int textOffset = symbol->GetPinNameOffset();
|
||||
float nameStrokeWidth = getLineWidth( aPin, false );
|
||||
float numStrokeWidth = getLineWidth( aPin, false );
|
||||
bool showPinNames = libEntry->GetShowPinNames();
|
||||
bool showPinNumbers = m_schSettings.m_ShowPinNumbers || libEntry->GetShowPinNumbers();
|
||||
bool showPinNames = symbol->GetShowPinNames();
|
||||
bool showPinNumbers = m_schSettings.m_ShowPinNumbers || symbol->GetShowPinNumbers();
|
||||
|
||||
nameStrokeWidth = Clamp_Text_PenSize( nameStrokeWidth, aPin->GetNameTextSize(), true );
|
||||
numStrokeWidth = Clamp_Text_PenSize( numStrokeWidth, aPin->GetNumberTextSize(), true );
|
||||
|
@ -1245,12 +1231,12 @@ void SCH_PAINTER::draw( const LIB_PIN* aPin, int aLayer, bool aDimmed )
|
|||
else if( nonCached( aPin ) && renderTextAsBitmap )
|
||||
{
|
||||
bitmapText( text[i], aPos, attrs );
|
||||
const_cast<LIB_PIN*>( aPin )->SetFlags( IS_SHOWN_AS_BITMAP );
|
||||
const_cast<SCH_PIN*>( aPin )->SetFlags( IS_SHOWN_AS_BITMAP );
|
||||
}
|
||||
else
|
||||
{
|
||||
strokeText( text[i], aPos, attrs, aPin->GetFontMetrics() );
|
||||
const_cast<LIB_PIN*>( aPin )->SetFlags( IS_SHOWN_AS_BITMAP );
|
||||
const_cast<SCH_PIN*>( aPin )->SetFlags( IS_SHOWN_AS_BITMAP );
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -1699,9 +1685,8 @@ void SCH_PAINTER::draw( const SCH_TEXT* aText, int aLayer, bool aDimmed )
|
|||
case SCH_HIER_LABEL_T: aLayer = LAYER_HIERLABEL; break;
|
||||
case SCH_GLOBAL_LABEL_T: aLayer = LAYER_GLOBLABEL; break;
|
||||
case SCH_DIRECTIVE_LABEL_T: aLayer = LAYER_NETCLASS_REFS; break;
|
||||
case SCH_TEXT_T:
|
||||
aLayer = IsItemFPMember( aText ) ? LAYER_DEVICE : LAYER_NOTES;
|
||||
break;
|
||||
case SCH_TEXT_T: aLayer = aText->GetParentSymbol() ? LAYER_DEVICE
|
||||
: LAYER_NOTES; break;
|
||||
default: aLayer = LAYER_NOTES; break;
|
||||
}
|
||||
|
||||
|
@ -2259,13 +2244,11 @@ void SCH_PAINTER::draw( const SCH_SYMBOL* aSymbol, int aLayer )
|
|||
: dummy();
|
||||
bool invertY = true;
|
||||
|
||||
std::vector<LIB_PIN*> originalPins;
|
||||
originalSymbol->GetPins( originalPins, unit, bodyStyle );
|
||||
std::vector<SCH_PIN*> originalPins = originalSymbol->GetPins( unit, bodyStyle );
|
||||
|
||||
// Copy the source so we can re-orient and translate it.
|
||||
LIB_SYMBOL tempSymbol( *originalSymbol );
|
||||
std::vector<LIB_PIN*> tempPins;
|
||||
tempSymbol.GetPins( tempPins, unit, bodyStyle );
|
||||
std::vector<SCH_PIN*> tempPins = tempSymbol.GetPins( unit, bodyStyle );
|
||||
|
||||
tempSymbol.SetFlags( aSymbol->GetFlags() );
|
||||
|
||||
|
@ -2296,7 +2279,7 @@ void SCH_PAINTER::draw( const SCH_SYMBOL* aSymbol, int aLayer )
|
|||
for( unsigned i = 0; i < tempPins.size(); ++ i )
|
||||
{
|
||||
SCH_PIN* symbolPin = aSymbol->GetPin( originalPins[ i ] );
|
||||
LIB_PIN* tempPin = tempPins[ i ];
|
||||
SCH_PIN* tempPin = tempPins[ i ];
|
||||
|
||||
tempPin->ClearFlags();
|
||||
tempPin->SetFlags( symbolPin->GetFlags() ); // SELECTED, HIGHLIGHTED, BRIGHTENED,
|
||||
|
@ -2319,7 +2302,7 @@ void SCH_PAINTER::draw( const SCH_SYMBOL* aSymbol, int aLayer )
|
|||
for( unsigned i = 0; i < tempPins.size(); ++i )
|
||||
{
|
||||
SCH_PIN* symbolPin = aSymbol->GetPin( originalPins[ i ] );
|
||||
LIB_PIN* tempPin = tempPins[ i ];
|
||||
SCH_PIN* tempPin = tempPins[ i ];
|
||||
|
||||
symbolPin->ClearFlags();
|
||||
tempPin->ClearFlags( IS_DANGLING ); // Clear this temporary flag
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
#include <gal/painter.h>
|
||||
|
||||
|
||||
class LIB_PIN;
|
||||
class SCH_PIN;
|
||||
class LIB_SYMBOL;
|
||||
class SCH_SYMBOL;
|
||||
class SCH_FIELD;
|
||||
|
@ -80,7 +80,7 @@ public:
|
|||
private:
|
||||
void drawItemBoundingBox( const EDA_ITEM* aItem );
|
||||
void draw( const EDA_ITEM*, int, bool aDimmed );
|
||||
void draw( const LIB_PIN* aPin, int aLayer, bool aDimmed );
|
||||
void draw( const SCH_PIN* aPin, int aLayer, bool aDimmed );
|
||||
void draw( const LIB_SYMBOL* aSymbol, int, bool aDrawFields = true, int aUnit = 0,
|
||||
int aBodyStyle = 0, bool aDimmed = false );
|
||||
void draw( const SCH_SYMBOL* aSymbol, int aLayer );
|
||||
|
@ -106,8 +106,8 @@ private:
|
|||
void drawDanglingIndicator( const VECTOR2I& aPos, const COLOR4D& aColor, int aWidth,
|
||||
bool aDangling, bool aDrawingShadows, bool aBrightened );
|
||||
|
||||
int internalPinDecoSize( const LIB_PIN &aPin );
|
||||
int externalPinDecoSize( const LIB_PIN &aPin );
|
||||
int internalPinDecoSize( const SCH_PIN &aPin );
|
||||
int externalPinDecoSize( const SCH_PIN &aPin );
|
||||
|
||||
// Indicates the item is drawn on a non-cached layer in OpenGL
|
||||
bool nonCached( const EDA_ITEM* aItem );
|
||||
|
@ -115,11 +115,11 @@ private:
|
|||
bool isUnitAndConversionShown( const SCH_ITEM* aItem ) const;
|
||||
|
||||
float getShadowWidth( bool aForHighlight ) const;
|
||||
COLOR4D getRenderColor( const EDA_ITEM* aItem, int aLayer, bool aDrawingShadows,
|
||||
COLOR4D getRenderColor( const SCH_ITEM* aItem, int aLayer, bool aDrawingShadows,
|
||||
bool aDimmed = false ) const;
|
||||
KIFONT::FONT* getFont( const EDA_TEXT* aText ) const;
|
||||
float getLineWidth( const EDA_ITEM* aItem, bool aDrawingShadows ) const;
|
||||
float getTextThickness( const EDA_ITEM* aItem ) const;
|
||||
float getLineWidth( const SCH_ITEM* aItem, bool aDrawingShadows ) const;
|
||||
float getTextThickness( const SCH_ITEM* aItem ) const;
|
||||
|
||||
int getOperatingPointTextSize() const;
|
||||
|
||||
|
|
1990
eeschema/sch_pin.cpp
1990
eeschema/sch_pin.cpp
File diff suppressed because it is too large
Load Diff
|
@ -1,8 +1,10 @@
|
|||
/*
|
||||
* 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) 2018 CERN
|
||||
* Copyright (C) 2019-2024 KiCad Developers, see AUTHOR.txt for contributors.
|
||||
* Copyright (C) 2004-2024 KiCad Developers, see AUTHOR.txt for contributors.
|
||||
* @author Jon Evans <jon@craftyjon.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
|
@ -19,89 +21,352 @@
|
|||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef _SCH_PIN_CONNECTION_H
|
||||
#define _SCH_PIN_CONNECTION_H
|
||||
#ifndef SCH_PIN_H
|
||||
#define SCH_PIN_H
|
||||
|
||||
#include <lib_pin.h>
|
||||
#include <pin_type.h>
|
||||
#include <sch_item.h>
|
||||
#include <sch_sheet_path.h>
|
||||
|
||||
#include <mutex>
|
||||
#include <map>
|
||||
#include <symbol.h>
|
||||
|
||||
class LIB_SYMBOL;
|
||||
class SCH_SYMBOL;
|
||||
class MSG_PANEL_ITEM;
|
||||
|
||||
// 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 SCH_PIN : public SCH_ITEM
|
||||
{
|
||||
public:
|
||||
SCH_PIN( LIB_PIN* aLibPin, SCH_SYMBOL* aParentSymbol );
|
||||
struct ALT
|
||||
{
|
||||
wxString m_Name;
|
||||
GRAPHIC_PINSHAPE m_Shape; // Shape drawn around pin
|
||||
ELECTRICAL_PINTYPE m_Type; // Electrical type of the pin.
|
||||
};
|
||||
|
||||
SCH_PIN( LIB_SYMBOL* aParentSymbol );
|
||||
|
||||
SCH_PIN( LIB_SYMBOL* aParentSymbol, 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 );
|
||||
|
||||
SCH_PIN( SCH_PIN* aLibPin, SCH_SYMBOL* aParentSymbol );
|
||||
|
||||
SCH_PIN( SCH_SYMBOL* aParentSymbol, const wxString& aNumber, const wxString& aAlt );
|
||||
|
||||
SCH_PIN( const SCH_PIN& aPin );
|
||||
|
||||
SCH_PIN& operator=( const SCH_PIN& aPin );
|
||||
~SCH_PIN() override { }
|
||||
|
||||
static inline bool ClassOf( const EDA_ITEM* aItem )
|
||||
{
|
||||
return aItem && SCH_PIN_T == aItem->Type();
|
||||
}
|
||||
SCH_PIN& operator=( const SCH_PIN& aPin );
|
||||
|
||||
wxString GetClass() const override
|
||||
{
|
||||
return wxT( "SCH_PIN" );
|
||||
}
|
||||
|
||||
LIB_PIN* GetLibPin() const { return m_libPin; }
|
||||
static bool ClassOf( const EDA_ITEM* aItem )
|
||||
{
|
||||
return aItem && aItem->Type() == SCH_PIN_T;
|
||||
}
|
||||
|
||||
void ClearDefaultNetName( const SCH_SHEET_PATH* aPath );
|
||||
wxString GetDefaultNetName( const SCH_SHEET_PATH& aPath, bool aForceNoConnect = false );
|
||||
wxString GetFriendlyName() const override
|
||||
{
|
||||
return _( "Pin" );
|
||||
}
|
||||
|
||||
SCH_PIN* GetLibPin() const { return m_libPin; }
|
||||
void SetLibPin( SCH_PIN* aLibPin ) { m_libPin = aLibPin; }
|
||||
|
||||
PIN_ORIENTATION GetOrientation() const
|
||||
{
|
||||
if( m_libPin )
|
||||
return m_libPin->GetOrientation();
|
||||
|
||||
return m_orientation;
|
||||
}
|
||||
|
||||
void SetOrientation( PIN_ORIENTATION aOrientation ) { m_orientation = aOrientation; }
|
||||
|
||||
GRAPHIC_PINSHAPE GetShape() const
|
||||
{
|
||||
if( m_libPin )
|
||||
{
|
||||
if( !m_alt.IsEmpty() )
|
||||
return m_libPin->GetAlt( m_alt ).m_Shape;
|
||||
else
|
||||
return m_libPin->GetShape();
|
||||
}
|
||||
|
||||
return m_shape;
|
||||
}
|
||||
|
||||
void SetShape( GRAPHIC_PINSHAPE aShape ) { m_shape = aShape; }
|
||||
|
||||
int GetLength() const
|
||||
{
|
||||
if( m_libPin )
|
||||
return m_libPin->GetLength();
|
||||
else
|
||||
wxCHECK_MSG( m_length.has_value(), 0, wxS( "lib pin must have length defined!" ) );
|
||||
|
||||
return m_length.value();
|
||||
}
|
||||
|
||||
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
|
||||
{
|
||||
if( m_libPin )
|
||||
{
|
||||
if( !m_alt.IsEmpty() )
|
||||
return m_libPin->GetAlt( m_alt ).m_Type;
|
||||
else
|
||||
return m_libPin->GetType();
|
||||
}
|
||||
|
||||
return m_type;
|
||||
}
|
||||
|
||||
void SetType( ELECTRICAL_PINTYPE aType ) { m_type = aType; }
|
||||
|
||||
wxString GetCanonicalElectricalTypeName() const
|
||||
{
|
||||
if( m_libPin )
|
||||
return m_libPin->GetCanonicalElectricalTypeName();
|
||||
|
||||
return GetCanonicalElectricalTypeName( m_type );
|
||||
}
|
||||
|
||||
wxString GetElectricalTypeName() const
|
||||
{
|
||||
if( m_libPin )
|
||||
return m_libPin->GetElectricalTypeName();
|
||||
|
||||
return ElectricalPinTypeGetText( m_type );
|
||||
}
|
||||
|
||||
bool IsVisible() const
|
||||
{
|
||||
if( m_libPin )
|
||||
return m_libPin->IsVisible();
|
||||
|
||||
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
|
||||
{
|
||||
if( !m_alt.IsEmpty() )
|
||||
return m_alt;
|
||||
else if( m_libPin )
|
||||
return m_libPin->GetName();
|
||||
|
||||
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;
|
||||
|
||||
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
|
||||
{
|
||||
if( m_libPin )
|
||||
return m_libPin->GetNameTextSize();
|
||||
else
|
||||
wxCHECK_MSG( m_nameTextSize.has_value(), 0, wxS( "lib pin must have sizes defined!" ) );
|
||||
|
||||
return m_nameTextSize.value();
|
||||
}
|
||||
|
||||
void SetNameTextSize( int aSize )
|
||||
{
|
||||
m_nameTextSize = aSize;
|
||||
m_nameExtentsCache.m_Extents = VECTOR2I();
|
||||
}
|
||||
|
||||
int GetNumberTextSize() const
|
||||
{
|
||||
if( m_libPin )
|
||||
return m_libPin->GetNumberTextSize();
|
||||
else
|
||||
wxCHECK_MSG( m_numTextSize.has_value(), 0, wxS( "lib pin must have sizes defined!" ) );
|
||||
|
||||
return m_numTextSize.value();
|
||||
}
|
||||
|
||||
void SetNumberTextSize( int aSize )
|
||||
{
|
||||
m_numTextSize = aSize;
|
||||
m_numExtentsCache.m_Extents = VECTOR2I();
|
||||
}
|
||||
|
||||
std::map<wxString, ALT>& GetAlternates()
|
||||
{
|
||||
if( m_libPin )
|
||||
return m_libPin->GetAlternates();
|
||||
|
||||
return m_alternates;
|
||||
}
|
||||
|
||||
ALT GetAlt( const wxString& aAlt )
|
||||
{
|
||||
return GetAlternates()[ aAlt ];
|
||||
}
|
||||
|
||||
wxString GetAlt() const { return m_alt; }
|
||||
void SetAlt( const wxString& aAlt ) { m_alt = 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;
|
||||
|
||||
#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;
|
||||
|
||||
wxString GetItemDescription( UNITS_PROVIDER* aUnitsProvider ) const override;
|
||||
void GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList ) override;
|
||||
|
||||
void Print( const SCH_RENDER_SETTINGS* aSettings, int aUnit, int aBodyStyle,
|
||||
const VECTOR2I& aOffset, bool aForceNoFill, bool aDimmed ) override {}
|
||||
|
||||
void Move( const VECTOR2I& aMoveVector ) override {}
|
||||
|
||||
void MirrorHorizontally( int aCenter ) override {}
|
||||
void MirrorVertically( int aCenter ) override {}
|
||||
void Rotate( const VECTOR2I& aCenter, bool aRotateCCW ) override {}
|
||||
|
||||
VECTOR2I GetPosition() const override { return GetTransformedPosition(); }
|
||||
const VECTOR2I GetLocalPosition() const { return m_position; }
|
||||
void SetPosition( const VECTOR2I& aPosition ) override { m_position = aPosition; }
|
||||
|
||||
/* Cannot use a default parameter here as it will not be compatible with the virtual. */
|
||||
const BOX2I GetBoundingBox() const override { return GetBoundingBox( false, true, false ); }
|
||||
const BOX2I GetBoundingBox() const override
|
||||
{
|
||||
return GetBoundingBox( false, true, m_layer == LAYER_DEVICE );
|
||||
}
|
||||
|
||||
/**
|
||||
* @param aIncludeInvisibles - if false, do not include labels for invisible pins
|
||||
* @param aIncludeLabelsOnInvisiblePins - if false, do not include labels for invisible pins
|
||||
* in the calculation.
|
||||
*/
|
||||
const BOX2I GetBoundingBox( bool aIncludeInvisiblePins, bool aIncludeNameAndNumber,
|
||||
const BOX2I GetBoundingBox( bool aIncludeLabelsOnInvisiblePins, bool aIncludeNameAndNumber,
|
||||
bool aIncludeElectricalType ) const;
|
||||
|
||||
bool HitTest( const VECTOR2I& aPosition, int aAccuracy = 0 ) const override;
|
||||
bool HitTest( const BOX2I& aRect, bool aContained, int aAccuracy = 0 ) const override;
|
||||
/**
|
||||
* 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 { return 0; }
|
||||
|
||||
void Move( const VECTOR2I& aOffset ) override;
|
||||
|
||||
VECTOR2I GetPosition() const override;
|
||||
VECTOR2I GetLocalPosition() const { 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;
|
||||
|
||||
bool Matches( const EDA_SEARCH_DATA& aSearchData, void* aAuxData ) const override;
|
||||
|
||||
bool Replace( const EDA_SEARCH_DATA& aSearchData, void* aAuxData ) 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 );
|
||||
|
||||
bool IsConnectable() const override { return true; }
|
||||
|
||||
bool HasConnectivityChanges( const SCH_ITEM* aItem,
|
||||
const SCH_SHEET_PATH* aInstance = nullptr ) const override;
|
||||
|
||||
void ClearDefaultNetName( const SCH_SHEET_PATH* aPath );
|
||||
wxString GetDefaultNetName( const SCH_SHEET_PATH& aPath, bool aForceNoConnect = false );
|
||||
|
||||
bool IsDangling() const override
|
||||
{
|
||||
if( GetType() == ELECTRICAL_PINTYPE::PT_NC || GetType() == ELECTRICAL_PINTYPE::PT_NIC )
|
||||
|
@ -112,8 +377,6 @@ public:
|
|||
|
||||
void SetIsDangling( bool isDangling ) { m_isDangling = isDangling; }
|
||||
|
||||
void SetLibPin( LIB_PIN* aLibPin ) { m_libPin = aLibPin; }
|
||||
|
||||
/**
|
||||
* @param aPin Comparison Pin
|
||||
* @return True if aPin is stacked with this pin
|
||||
|
@ -125,42 +388,6 @@ public:
|
|||
return m_isDangling && GetPosition() == aPos;
|
||||
}
|
||||
|
||||
/// @return the pin's position in global coordinates.
|
||||
VECTOR2I GetTransformedPosition() const;
|
||||
|
||||
bool Matches( const EDA_SEARCH_DATA& aSearchData, void* aAuxData ) const override;
|
||||
|
||||
bool Replace( const EDA_SEARCH_DATA& aSearchData, void* aAuxData ) override;
|
||||
|
||||
/*
|
||||
* While many of these are currently simply covers for the equivalent LIB_PIN methods,
|
||||
* the new Eeschema file format will soon allow us to override them at the schematic level.
|
||||
*/
|
||||
bool IsVisible() const;
|
||||
|
||||
wxString GetName() const;
|
||||
wxString GetShownName() const;
|
||||
|
||||
wxString GetNumber() const { return m_number; }
|
||||
wxString GetShownNumber() const;
|
||||
|
||||
void SetNumber( const wxString& aNumber ) { m_number = aNumber; }
|
||||
|
||||
ELECTRICAL_PINTYPE GetType() const;
|
||||
|
||||
wxString GetCanonicalElectricalTypeName() const
|
||||
{
|
||||
return LIB_PIN::GetCanonicalElectricalTypeName( GetType() );
|
||||
}
|
||||
|
||||
GRAPHIC_PINSHAPE GetShape() const;
|
||||
|
||||
PIN_ORIENTATION GetOrientation() const;
|
||||
|
||||
int GetLength() const;
|
||||
|
||||
bool IsGlobalPower() const;
|
||||
|
||||
bool ConnectionPropagatesTo( const EDA_ITEM* aItem ) const override;
|
||||
|
||||
const wxString& GetOperatingPoint() const { return m_operatingPoint; }
|
||||
|
@ -169,27 +396,91 @@ public:
|
|||
double Similarity( const SCH_ITEM& aItem ) const override;
|
||||
|
||||
bool operator==( const SCH_ITEM& aItem ) const override;
|
||||
bool operator==( const SCH_PIN& aItem ) const;
|
||||
bool operator!=( const SCH_ITEM& aItem ) const { return !operator==( aItem ); }
|
||||
bool operator<( const SCH_PIN& aRhs ) const { return compare( aRhs, EQUALITY ) < 0; }
|
||||
bool operator>( const SCH_PIN& aRhs ) const { return compare( aRhs, EQUALITY ) > 0; }
|
||||
|
||||
bool operator!=( const SCH_PIN& aRhs ) const { return !( *this == aRhs ); }
|
||||
protected:
|
||||
wxString getItemDescription( ALT* aAlt ) const;
|
||||
|
||||
#if defined(DEBUG)
|
||||
void Show( int nestLevel, std::ostream& os ) const override {}
|
||||
#endif
|
||||
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, const 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, const VECTOR2I& aPosition,
|
||||
PIN_ORIENTATION aOrientation, bool aDimmed );
|
||||
std::ostream& operator<<( std::ostream& aStream );
|
||||
|
||||
private:
|
||||
LIB_PIN* m_libPin;
|
||||
/**
|
||||
* @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:
|
||||
SCH_PIN* m_libPin; // The corresponding pin in the LIB_SYMBOL
|
||||
// (nullptr for a pin *in* the LIB_SYMBOL)
|
||||
|
||||
std::map<wxString, ALT> m_alternates; // Map of alternate name to ALT structure
|
||||
// (only valid for pins in LIB_SYMBOLS)
|
||||
|
||||
VECTOR2I m_position; // Position of the pin.
|
||||
std::optional<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;
|
||||
wxString m_alt;
|
||||
VECTOR2I m_position;
|
||||
std::optional<int> m_numTextSize; // Pin num and Pin name sizes
|
||||
std::optional<int> m_nameTextSize;
|
||||
wxString m_alt; // The current alternate for an instance
|
||||
|
||||
wxString m_operatingPoint;
|
||||
|
||||
mutable EXTENTS_CACHE m_numExtentsCache;
|
||||
mutable EXTENTS_CACHE m_nameExtentsCache;
|
||||
|
||||
bool m_isDangling;
|
||||
|
||||
/// The name that this pin connection will drive onto a net.
|
||||
std::recursive_mutex m_netmap_mutex;
|
||||
std::map<const SCH_SHEET_PATH, std::pair<wxString, bool>> m_net_name_map;
|
||||
|
||||
wxString m_operatingPoint;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
#endif // SCH_PIN_H
|
|
@ -42,7 +42,7 @@
|
|||
|
||||
#include <symbol_library.h>
|
||||
#include <connection_graph.h>
|
||||
#include <lib_pin.h>
|
||||
#include <sch_pin.h>
|
||||
#include <sch_symbol.h>
|
||||
#include <sch_junction.h>
|
||||
#include <sch_line.h>
|
||||
|
@ -1220,11 +1220,11 @@ void SCH_SCREEN::ClearDrawingState()
|
|||
}
|
||||
|
||||
|
||||
LIB_PIN* SCH_SCREEN::GetPin( const VECTOR2I& aPosition, SCH_SYMBOL** aSymbol,
|
||||
SCH_PIN* SCH_SCREEN::GetPin( const VECTOR2I& aPosition, SCH_SYMBOL** aSymbol,
|
||||
bool aEndPointOnly ) const
|
||||
{
|
||||
SCH_SYMBOL* candidate = nullptr;
|
||||
LIB_PIN* pin = nullptr;
|
||||
SCH_PIN* pin = nullptr;
|
||||
|
||||
for( SCH_ITEM* item : Items().Overlapping( SCH_SYMBOL_T, aPosition ) )
|
||||
{
|
||||
|
@ -1237,10 +1237,7 @@ LIB_PIN* SCH_SCREEN::GetPin( const VECTOR2I& aPosition, SCH_SYMBOL** aSymbol,
|
|||
if( !candidate->GetLibSymbolRef() )
|
||||
continue;
|
||||
|
||||
std::vector<LIB_PIN*> pins;
|
||||
candidate->GetLibPins( pins );
|
||||
|
||||
for( LIB_PIN* test_pin : pins )
|
||||
for( SCH_PIN* test_pin : candidate->GetLibPins() )
|
||||
{
|
||||
if( candidate->GetPinPhysicalPosition( test_pin ) == aPosition )
|
||||
{
|
||||
|
@ -1254,7 +1251,7 @@ LIB_PIN* SCH_SCREEN::GetPin( const VECTOR2I& aPosition, SCH_SYMBOL** aSymbol,
|
|||
}
|
||||
else
|
||||
{
|
||||
pin = (LIB_PIN*) candidate->GetDrawItem( aPosition, LIB_PIN_T );
|
||||
pin = static_cast<SCH_PIN*>( candidate->GetDrawItem( aPosition, SCH_PIN_T ) );
|
||||
|
||||
if( pin )
|
||||
break;
|
||||
|
|
|
@ -55,7 +55,7 @@
|
|||
class BUS_ALIAS;
|
||||
class EDA_ITEM;
|
||||
class LIB_SYMBOL;
|
||||
class LIB_PIN;
|
||||
class SCH_PIN;
|
||||
class SCH_SYMBOL;
|
||||
class SCH_LINE;
|
||||
class SCH_LABEL_BASE;
|
||||
|
@ -368,7 +368,7 @@ public:
|
|||
* point of the pin.
|
||||
* @return The pin item if found, otherwise NULL.
|
||||
*/
|
||||
LIB_PIN* GetPin( const VECTOR2I& aPosition, SCH_SYMBOL** aSymbol = nullptr,
|
||||
SCH_PIN* GetPin( const VECTOR2I& aPosition, SCH_SYMBOL** aSymbol = nullptr,
|
||||
bool aEndPointOnly = false ) const;
|
||||
|
||||
/**
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
#include <widgets/msgpanel.h>
|
||||
#include <bitmaps.h>
|
||||
#include <core/mirror.h>
|
||||
#include <lib_pin.h>
|
||||
#include <sch_pin.h>
|
||||
#include <sch_shape.h>
|
||||
#include <pgm_base.h>
|
||||
#include <sch_symbol.h>
|
||||
|
@ -312,7 +312,7 @@ void SCH_SYMBOL::UpdatePins()
|
|||
std::map<wxString, wxString> altPinMap;
|
||||
std::map<wxString, std::set<SCH_PIN*>> pinUuidMap;
|
||||
std::set<SCH_PIN*> unassignedSchPins;
|
||||
std::set<LIB_PIN*> unassignedLibPins;
|
||||
std::set<SCH_PIN*> unassignedLibPins;
|
||||
|
||||
for( const std::unique_ptr<SCH_PIN>& pin : m_pins )
|
||||
{
|
||||
|
@ -331,9 +331,7 @@ void SCH_SYMBOL::UpdatePins()
|
|||
if( !m_part )
|
||||
return;
|
||||
|
||||
std::vector<LIB_PIN*> pins = m_part->GetAllLibPins();
|
||||
|
||||
for( LIB_PIN* libPin : pins )
|
||||
for( SCH_PIN* libPin : m_part->GetAllLibPins() )
|
||||
{
|
||||
// NW: Don't filter by unit: this data-structure is used for all instances,
|
||||
// some of which might have different units.
|
||||
|
@ -367,7 +365,7 @@ void SCH_SYMBOL::UpdatePins()
|
|||
}
|
||||
|
||||
// Add any pins that were not found in the symbol
|
||||
for( LIB_PIN* libPin : unassignedLibPins )
|
||||
for( SCH_PIN* libPin : unassignedLibPins )
|
||||
{
|
||||
SCH_PIN* pin = nullptr;
|
||||
|
||||
|
@ -503,18 +501,15 @@ void SCH_SYMBOL::Print( const SCH_RENDER_SETTINGS* aSettings, int aUnit, int aBo
|
|||
|
||||
if( m_part )
|
||||
{
|
||||
std::vector<LIB_PIN*> libPins;
|
||||
m_part->GetPins( libPins, m_unit, m_bodyStyle );
|
||||
|
||||
std::vector<SCH_PIN*> libPins = m_part->GetPins( m_unit, m_bodyStyle );
|
||||
LIB_SYMBOL tempSymbol( *m_part );
|
||||
std::vector<LIB_PIN*> tempPins;
|
||||
tempSymbol.GetPins( tempPins, m_unit, m_bodyStyle );
|
||||
std::vector<SCH_PIN*> tempPins = tempSymbol.GetPins( m_unit, m_bodyStyle );
|
||||
|
||||
// Copy the pin info from the symbol to the temp pins
|
||||
for( unsigned i = 0; i < tempPins.size(); ++ i )
|
||||
{
|
||||
SCH_PIN* symbolPin = GetPin( libPins[ i ] );
|
||||
LIB_PIN* tempPin = tempPins[ i ];
|
||||
SCH_PIN* tempPin = tempPins[ i ];
|
||||
|
||||
tempPin->SetName( symbolPin->GetShownName() );
|
||||
tempPin->SetType( symbolPin->GetType() );
|
||||
|
@ -1108,25 +1103,25 @@ SCH_PIN* SCH_SYMBOL::GetPin( const wxString& aNumber ) const
|
|||
}
|
||||
|
||||
|
||||
void SCH_SYMBOL::GetLibPins( std::vector<LIB_PIN*>& aPinsList ) const
|
||||
std::vector<SCH_PIN*> SCH_SYMBOL::GetLibPins() const
|
||||
{
|
||||
if( m_part )
|
||||
m_part->GetPins( aPinsList, m_unit, m_bodyStyle );
|
||||
return m_part->GetPins( m_unit, m_bodyStyle );
|
||||
|
||||
return std::vector<SCH_PIN*>();
|
||||
}
|
||||
|
||||
|
||||
std::vector<LIB_PIN*> SCH_SYMBOL::GetAllLibPins() const
|
||||
std::vector<SCH_PIN*> SCH_SYMBOL::GetAllLibPins() const
|
||||
{
|
||||
std::vector<LIB_PIN*> pinList;
|
||||
|
||||
if( m_part )
|
||||
m_part->GetPins( pinList, 0, 0 );
|
||||
return m_part->GetAllLibPins();
|
||||
|
||||
return pinList;
|
||||
return std::vector<SCH_PIN*>();
|
||||
}
|
||||
|
||||
|
||||
SCH_PIN* SCH_SYMBOL::GetPin( LIB_PIN* aLibPin ) const
|
||||
SCH_PIN* SCH_SYMBOL::GetPin( SCH_PIN* aLibPin ) const
|
||||
{
|
||||
auto it = m_pinMap.find( aLibPin );
|
||||
|
||||
|
@ -2045,7 +2040,7 @@ void SCH_SYMBOL::GetEndPoints( std::vector <DANGLING_END_ITEM>& aItemList )
|
|||
{
|
||||
for( std::unique_ptr<SCH_PIN>& pin : m_pins )
|
||||
{
|
||||
LIB_PIN* lib_pin = pin->GetLibPin();
|
||||
SCH_PIN* lib_pin = pin->GetLibPin();
|
||||
|
||||
if( lib_pin && lib_pin->GetUnit() && m_unit && ( m_unit != lib_pin->GetUnit() ) )
|
||||
continue;
|
||||
|
@ -2109,9 +2104,9 @@ bool SCH_SYMBOL::UpdateDanglingState( std::vector<DANGLING_END_ITEM>& aItemListB
|
|||
}
|
||||
|
||||
|
||||
VECTOR2I SCH_SYMBOL::GetPinPhysicalPosition( const LIB_PIN* Pin ) const
|
||||
VECTOR2I SCH_SYMBOL::GetPinPhysicalPosition( const SCH_PIN* Pin ) const
|
||||
{
|
||||
wxCHECK_MSG( Pin != nullptr && Pin->Type() == LIB_PIN_T, VECTOR2I( 0, 0 ),
|
||||
wxCHECK_MSG( Pin != nullptr && Pin->Type() == SCH_PIN_T, VECTOR2I( 0, 0 ),
|
||||
wxT( "Cannot get physical position of pin." ) );
|
||||
|
||||
return m_transform.TransformCoordinate( Pin->GetPosition() ) + m_pos;
|
||||
|
@ -2429,19 +2424,17 @@ void SCH_SYMBOL::Plot( PLOTTER* aPlotter, bool aBackground, const SCH_PLOT_OPTS&
|
|||
|
||||
if( m_part )
|
||||
{
|
||||
std::vector<LIB_PIN*> libPins;
|
||||
m_part->GetPins( libPins, GetUnit(), GetBodyStyle() );
|
||||
std::vector<SCH_PIN*> libPins = m_part->GetPins( GetUnit(), GetBodyStyle() );
|
||||
|
||||
// Copy the source so we can re-orient and translate it.
|
||||
LIB_SYMBOL tempSymbol( *m_part );
|
||||
std::vector<LIB_PIN*> tempPins;
|
||||
tempSymbol.GetPins( tempPins, GetUnit(), GetBodyStyle() );
|
||||
std::vector<SCH_PIN*> tempPins = tempSymbol.GetPins( GetUnit(), GetBodyStyle() );
|
||||
|
||||
// Copy the pin info from the symbol to the temp pins
|
||||
for( unsigned i = 0; i < tempPins.size(); ++ i )
|
||||
{
|
||||
SCH_PIN* symbolPin = GetPin( libPins[ i ] );
|
||||
LIB_PIN* tempPin = tempPins[ i ];
|
||||
SCH_PIN* tempPin = tempPins[ i ];
|
||||
|
||||
tempPin->SetName( symbolPin->GetShownName() );
|
||||
tempPin->SetType( symbolPin->GetType() );
|
||||
|
@ -2544,21 +2537,18 @@ void SCH_SYMBOL::PlotPins( PLOTTER* aPlotter ) const
|
|||
TRANSFORM savedTransform = renderSettings->m_Transform;
|
||||
renderSettings->m_Transform = GetTransform();
|
||||
|
||||
std::vector<LIB_PIN*> libPins;
|
||||
m_part->GetPins( libPins, GetUnit(), GetBodyStyle() );
|
||||
std::vector<SCH_PIN*> libPins = m_part->GetPins( GetUnit(), GetBodyStyle() );
|
||||
|
||||
// Copy the source to stay const
|
||||
LIB_SYMBOL tempSymbol( *m_part );
|
||||
std::vector<LIB_PIN*> tempPins;
|
||||
tempSymbol.GetPins( tempPins, GetUnit(), GetBodyStyle() );
|
||||
|
||||
std::vector<SCH_PIN*> tempPins = tempSymbol.GetPins( GetUnit(), GetBodyStyle() );
|
||||
SCH_PLOT_OPTS plotOpts;
|
||||
|
||||
// Copy the pin info from the symbol to the temp pins
|
||||
for( unsigned i = 0; i < tempPins.size(); ++ i )
|
||||
{
|
||||
SCH_PIN* symbolPin = GetPin( libPins[ i ] );
|
||||
LIB_PIN* tempPin = tempPins[ i ];
|
||||
SCH_PIN* tempPin = tempPins[ i ];
|
||||
|
||||
tempPin->SetName( symbolPin->GetShownName() );
|
||||
tempPin->SetType( symbolPin->GetType() );
|
||||
|
@ -2622,7 +2612,7 @@ bool SCH_SYMBOL::IsSymbolLikePowerGlobalLabel() const
|
|||
if( !GetLibSymbolRef() || !GetLibSymbolRef()->IsPower() )
|
||||
return false;
|
||||
|
||||
std::vector<LIB_PIN*> pin_list = GetAllLibPins();
|
||||
std::vector<SCH_PIN*> pin_list = GetAllLibPins();
|
||||
|
||||
if( pin_list.size() != 1 )
|
||||
return false;
|
||||
|
|
|
@ -46,6 +46,7 @@
|
|||
|
||||
#include <schematic.h>
|
||||
#include <symbol.h>
|
||||
#include <lib_symbol.h>
|
||||
#include <sch_field.h>
|
||||
#include <sch_pin.h>
|
||||
#include <sch_sheet_path.h> // SCH_SYMBOL_INSTANCE
|
||||
|
@ -55,7 +56,6 @@
|
|||
struct PICKED_SYMBOL;
|
||||
class KIID_PATH;
|
||||
class SCH_SCREEN;
|
||||
class LIB_PIN;
|
||||
class LIB_SYMBOL;
|
||||
class NETLIST_OBJECT_LIST;
|
||||
class SYMBOL_LIB;
|
||||
|
@ -596,17 +596,18 @@ public:
|
|||
SCH_PIN* GetPin( const wxString& number ) const;
|
||||
|
||||
/**
|
||||
* Populate a vector with all the pins from the library object.
|
||||
* Populate a vector with all the pins from the library object that match the current unit
|
||||
* and bodyStyle.
|
||||
*
|
||||
* @param aPinsList is the list to populate with all of the pins.
|
||||
*/
|
||||
void GetLibPins( std::vector<LIB_PIN*>& aPinsList ) const;
|
||||
std::vector<SCH_PIN*> GetLibPins() const;
|
||||
|
||||
/**
|
||||
* @return a list of pin pointers for all units / converts. Used primarily for SPICE where
|
||||
* @return a list of pin pointers for all units / bodyStyles. Used primarily for SPICE where
|
||||
* we want to treat all units together as a single SPICE element.
|
||||
*/
|
||||
std::vector<LIB_PIN*> GetAllLibPins() const;
|
||||
std::vector<SCH_PIN*> GetAllLibPins() const;
|
||||
|
||||
/**
|
||||
* @return a count of pins for all units.
|
||||
|
@ -614,9 +615,9 @@ public:
|
|||
size_t GetFullPinCount() { return m_part ? m_part->GetPinCount() : 0; }
|
||||
|
||||
/**
|
||||
* @return the SCH_PIN associated with a particular LIB_PIN.
|
||||
* @return the instance SCH_PIN associated with a particular SCH_PIN from the LIB_SYMBOL.
|
||||
*/
|
||||
SCH_PIN* GetPin( LIB_PIN* aLibPin ) const;
|
||||
SCH_PIN* GetPin( SCH_PIN* aLibPin ) const;
|
||||
|
||||
/**
|
||||
* Retrieve a list of the SCH_PINs for the given sheet path.
|
||||
|
@ -718,7 +719,7 @@ public:
|
|||
std::vector<DANGLING_END_ITEM>& aItemListByPos,
|
||||
const SCH_SHEET_PATH* aPath = nullptr ) override;
|
||||
|
||||
VECTOR2I GetPinPhysicalPosition( const LIB_PIN* Pin ) const;
|
||||
VECTOR2I GetPinPhysicalPosition( const SCH_PIN* Pin ) const;
|
||||
|
||||
bool IsConnectable() const override { return true; }
|
||||
|
||||
|
@ -843,6 +844,12 @@ public:
|
|||
bool IsPower() const override;
|
||||
bool IsNormal() const override;
|
||||
|
||||
/*
|
||||
* We don't currently support changing these at the schematic level.
|
||||
*/
|
||||
bool GetShowPinNames() const override { return m_part && m_part->GetShowPinNames(); }
|
||||
bool GetShowPinNumbers() const override { return m_part && m_part->GetShowPinNumbers(); }
|
||||
|
||||
double Similarity( const SCH_ITEM& aOther ) const override;
|
||||
|
||||
bool operator==( const SCH_ITEM& aOther ) const override;
|
||||
|
@ -854,6 +861,7 @@ private:
|
|||
|
||||
void Init( const VECTOR2I& pos = VECTOR2I( 0, 0 ) );
|
||||
|
||||
private:
|
||||
VECTOR2I m_pos;
|
||||
LIB_ID m_lib_id; ///< Name and library the symbol was loaded from, i.e. 74xx:74LS00.
|
||||
wxString m_prefix; ///< C, R, U, Q etc - the first character(s) which typically
|
||||
|
@ -877,8 +885,8 @@ private:
|
|||
///< PROJECT's libraries.
|
||||
bool m_isInNetlist; ///< True if the symbol should appear in netlist
|
||||
|
||||
std::vector<std::unique_ptr<SCH_PIN>> m_pins; ///< a SCH_PIN for every LIB_PIN (all units)
|
||||
std::unordered_map<LIB_PIN*, SCH_PIN*> m_pinMap; ///< library pin pointer : SCH_PIN's index
|
||||
std::vector<std::unique_ptr<SCH_PIN>> m_pins; ///< a SCH_PIN for every SCH_PIN (all units)
|
||||
std::unordered_map<SCH_PIN*, SCH_PIN*> m_pinMap; ///< library pin pointer : SCH_PIN's index
|
||||
|
||||
// Defines the hierarchical path and reference of the symbol. This allows support for multiple
|
||||
// references to a single sub-sheet.
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
class SCH_SHEET;
|
||||
class SCH_SCREEN;
|
||||
class LIB_SYMBOL;
|
||||
class LIB_PIN;
|
||||
class SCH_PIN;
|
||||
class SCH_BASE_FRAME;
|
||||
class DS_PROXY_VIEW_ITEM;
|
||||
|
||||
|
|
|
@ -153,7 +153,7 @@ void SIM_LIB_MGR::SetLibrary( const wxString& aLibraryPath, REPORTER& aReporter
|
|||
}
|
||||
|
||||
|
||||
SIM_MODEL& SIM_LIB_MGR::CreateModel( SIM_MODEL::TYPE aType, const std::vector<LIB_PIN*>& aPins,
|
||||
SIM_MODEL& SIM_LIB_MGR::CreateModel( SIM_MODEL::TYPE aType, const std::vector<SCH_PIN*>& aPins,
|
||||
REPORTER& aReporter )
|
||||
{
|
||||
m_models.push_back( SIM_MODEL::Create( aType, aPins, aReporter ) );
|
||||
|
@ -162,7 +162,7 @@ SIM_MODEL& SIM_LIB_MGR::CreateModel( SIM_MODEL::TYPE aType, const std::vector<LI
|
|||
|
||||
|
||||
SIM_MODEL& SIM_LIB_MGR::CreateModel( const SIM_MODEL* aBaseModel,
|
||||
const std::vector<LIB_PIN*>& aPins, REPORTER& aReporter )
|
||||
const std::vector<SCH_PIN*>& aPins, REPORTER& aReporter )
|
||||
{
|
||||
m_models.push_back( SIM_MODEL::Create( aBaseModel, aPins, aReporter ) );
|
||||
return *m_models.back();
|
||||
|
@ -170,7 +170,7 @@ SIM_MODEL& SIM_LIB_MGR::CreateModel( const SIM_MODEL* aBaseModel,
|
|||
|
||||
|
||||
SIM_MODEL& SIM_LIB_MGR::CreateModel( const SIM_MODEL* aBaseModel,
|
||||
const std::vector<LIB_PIN*>& aPins,
|
||||
const std::vector<SCH_PIN*>& aPins,
|
||||
const std::vector<SCH_FIELD>& aFields, REPORTER& aReporter )
|
||||
{
|
||||
m_models.push_back( SIM_MODEL::Create( aBaseModel, aPins, aFields, aReporter ) );
|
||||
|
@ -232,10 +232,10 @@ SIM_LIBRARY::MODEL SIM_LIB_MGR::CreateModel( const SCH_SHEET_PATH* aSheetPath, S
|
|||
storeInValue = true;
|
||||
}
|
||||
|
||||
std::vector<LIB_PIN*> sourcePins = aSymbol.GetAllLibPins();
|
||||
std::vector<SCH_PIN*> sourcePins = aSymbol.GetAllLibPins();
|
||||
|
||||
std::sort( sourcePins.begin(), sourcePins.end(),
|
||||
[]( const LIB_PIN* lhs, const LIB_PIN* rhs )
|
||||
[]( const SCH_PIN* lhs, const SCH_PIN* rhs )
|
||||
{
|
||||
return StrNumCmp( lhs->GetNumber(), rhs->GetNumber(), true ) < 0;
|
||||
} );
|
||||
|
@ -249,7 +249,7 @@ SIM_LIBRARY::MODEL SIM_LIB_MGR::CreateModel( const SCH_SHEET_PATH* aSheetPath, S
|
|||
|
||||
|
||||
SIM_LIBRARY::MODEL SIM_LIB_MGR::CreateModel( const std::vector<SCH_FIELD>& aFields,
|
||||
const std::vector<LIB_PIN*>& aPins, bool aResolved,
|
||||
const std::vector<SCH_PIN*>& aPins, bool aResolved,
|
||||
REPORTER& aReporter )
|
||||
{
|
||||
std::string libraryPath = SIM_MODEL::GetFieldValue( &aFields, SIM_LIBRARY::LIBRARY_FIELD );
|
||||
|
@ -270,7 +270,7 @@ SIM_LIBRARY::MODEL SIM_LIB_MGR::CreateModel( const std::vector<SCH_FIELD>& aFiel
|
|||
SIM_LIBRARY::MODEL SIM_LIB_MGR::CreateModel( const wxString& aLibraryPath,
|
||||
const std::string& aBaseModelName,
|
||||
const std::vector<SCH_FIELD>& aFields,
|
||||
const std::vector<LIB_PIN*>& aPins,
|
||||
const std::vector<SCH_PIN*>& aPins,
|
||||
REPORTER& aReporter )
|
||||
{
|
||||
wxString path;
|
||||
|
|
|
@ -47,13 +47,13 @@ public:
|
|||
|
||||
void SetLibrary( const wxString& aLibraryPath, REPORTER& aReporter );
|
||||
|
||||
SIM_MODEL& CreateModel( SIM_MODEL::TYPE aType, const std::vector<LIB_PIN*>& aPins,
|
||||
SIM_MODEL& CreateModel( SIM_MODEL::TYPE aType, const std::vector<SCH_PIN*>& aPins,
|
||||
REPORTER& aReporter );
|
||||
|
||||
SIM_MODEL& CreateModel( const SIM_MODEL* aBaseModel, const std::vector<LIB_PIN*>& aPins,
|
||||
SIM_MODEL& CreateModel( const SIM_MODEL* aBaseModel, const std::vector<SCH_PIN*>& aPins,
|
||||
REPORTER& aReporter );
|
||||
|
||||
SIM_MODEL& CreateModel( const SIM_MODEL* aBaseModel, const std::vector<LIB_PIN*>& aPins,
|
||||
SIM_MODEL& CreateModel( const SIM_MODEL* aBaseModel, const std::vector<SCH_PIN*>& aPins,
|
||||
const std::vector<SCH_FIELD>& aFields, REPORTER& aReporter );
|
||||
|
||||
// TODO: The argument can be made const.
|
||||
|
@ -61,13 +61,13 @@ public:
|
|||
REPORTER& aReporter );
|
||||
|
||||
SIM_LIBRARY::MODEL CreateModel( const std::vector<SCH_FIELD>& aFields,
|
||||
const std::vector<LIB_PIN*>& aPins, bool aResolved,
|
||||
const std::vector<SCH_PIN*>& aPins, bool aResolved,
|
||||
REPORTER& aReporter );
|
||||
|
||||
SIM_LIBRARY::MODEL CreateModel( const wxString& aLibraryPath,
|
||||
const std::string& aBaseModelName,
|
||||
const std::vector<SCH_FIELD>& aFields,
|
||||
const std::vector<LIB_PIN*>& aPins, REPORTER& aReporter );
|
||||
const std::vector<SCH_PIN*>& aPins, REPORTER& aReporter );
|
||||
|
||||
void SetModel( int aIndex, std::unique_ptr<SIM_MODEL> aModel );
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
#include <ki_exception.h>
|
||||
#include <locale_io.h>
|
||||
#include <pegtl/contrib/parse_tree.hpp>
|
||||
#include <lib_pin.h>
|
||||
#include <sch_pin.h>
|
||||
|
||||
|
||||
void SIM_LIBRARY_KIBIS::ReadFile( const wxString& aFilePath, REPORTER& aReporter )
|
||||
|
@ -41,11 +41,11 @@ void SIM_LIBRARY_KIBIS::ReadFile( const wxString& aFilePath, REPORTER& aReporter
|
|||
return;
|
||||
}
|
||||
|
||||
LIB_PIN pinA( nullptr );
|
||||
LIB_PIN pinB( nullptr );
|
||||
SCH_PIN pinA( nullptr );
|
||||
SCH_PIN pinB( nullptr );
|
||||
pinA.SetNumber( wxT( "1" ) );
|
||||
pinB.SetNumber( wxT( "2" ) );
|
||||
std::vector<LIB_PIN*> pins = { &pinA, &pinB };
|
||||
std::vector<SCH_PIN*> pins = { &pinA, &pinB };
|
||||
|
||||
for( KIBIS_COMPONENT& kcomp : m_kibis.m_components )
|
||||
{
|
||||
|
|
|
@ -421,7 +421,7 @@ TYPE SIM_MODEL::ReadTypeFromFields( const std::vector<SCH_FIELD>& aFields, REPOR
|
|||
|
||||
|
||||
void SIM_MODEL::ReadDataFields( const std::vector<SCH_FIELD>* aFields,
|
||||
const std::vector<LIB_PIN*>& aPins )
|
||||
const std::vector<SCH_PIN*>& aPins )
|
||||
{
|
||||
bool diffMode = GetFieldValue( aFields, SIM_LIBRARY_KIBIS::DIFF_FIELD ) == "1";
|
||||
SwitchSingleEndedDiff( diffMode );
|
||||
|
@ -489,7 +489,7 @@ void SIM_MODEL::WriteFields( std::vector<SCH_FIELD>& aFields ) const
|
|||
}
|
||||
|
||||
|
||||
std::unique_ptr<SIM_MODEL> SIM_MODEL::Create( TYPE aType, const std::vector<LIB_PIN*>& aPins,
|
||||
std::unique_ptr<SIM_MODEL> SIM_MODEL::Create( TYPE aType, const std::vector<SCH_PIN*>& aPins,
|
||||
REPORTER& aReporter )
|
||||
{
|
||||
std::unique_ptr<SIM_MODEL> model = Create( aType );
|
||||
|
@ -509,7 +509,7 @@ std::unique_ptr<SIM_MODEL> SIM_MODEL::Create( TYPE aType, const std::vector<LIB_
|
|||
|
||||
|
||||
std::unique_ptr<SIM_MODEL> SIM_MODEL::Create( const SIM_MODEL* aBaseModel,
|
||||
const std::vector<LIB_PIN*>& aPins,
|
||||
const std::vector<SCH_PIN*>& aPins,
|
||||
REPORTER& aReporter )
|
||||
{
|
||||
std::unique_ptr<SIM_MODEL> model;
|
||||
|
@ -546,7 +546,7 @@ std::unique_ptr<SIM_MODEL> SIM_MODEL::Create( const SIM_MODEL* aBaseModel,
|
|||
|
||||
|
||||
std::unique_ptr<SIM_MODEL> SIM_MODEL::Create( const SIM_MODEL* aBaseModel,
|
||||
const std::vector<LIB_PIN*>& aPins,
|
||||
const std::vector<SCH_PIN*>& aPins,
|
||||
const std::vector<SCH_FIELD>& aFields,
|
||||
REPORTER& aReporter )
|
||||
{
|
||||
|
@ -594,7 +594,7 @@ std::unique_ptr<SIM_MODEL> SIM_MODEL::Create( const SIM_MODEL* aBaseModel,
|
|||
|
||||
|
||||
std::unique_ptr<SIM_MODEL> SIM_MODEL::Create( const std::vector<SCH_FIELD>& aFields,
|
||||
const std::vector<LIB_PIN*>& aPins,
|
||||
const std::vector<SCH_PIN*>& aPins,
|
||||
bool aResolved, REPORTER& aReporter )
|
||||
{
|
||||
TYPE type = ReadTypeFromFields( aFields, aReporter );
|
||||
|
@ -980,7 +980,7 @@ SIM_MODEL::SIM_MODEL( TYPE aType, std::unique_ptr<SPICE_GENERATOR> aSpiceGenerat
|
|||
}
|
||||
|
||||
|
||||
void SIM_MODEL::createPins( const std::vector<LIB_PIN*>& aSymbolPins )
|
||||
void SIM_MODEL::createPins( const std::vector<SCH_PIN*>& aSymbolPins )
|
||||
{
|
||||
// Default pin sequence: model pins are the same as symbol pins.
|
||||
// Excess model pins are set as Not Connected.
|
||||
|
@ -1225,7 +1225,7 @@ bool SIM_MODEL::InferSimModel( T& aSymbol, std::vector<SCH_FIELD>* aFields, bool
|
|||
wxString library = GetFieldValue( aFields, SIM_LIBRARY_FIELD, aResolve );
|
||||
wxString modelName = GetFieldValue( aFields, SIM_NAME_FIELD, aResolve );
|
||||
wxString value = GetFieldValue( aFields, SIM_VALUE_FIELD, aResolve );
|
||||
std::vector<LIB_PIN*> pins = aSymbol.GetAllLibPins();
|
||||
std::vector<SCH_PIN*> pins = aSymbol.GetAllLibPins();
|
||||
|
||||
*aDeviceType = GetFieldValue( aFields, SIM_DEVICE_FIELD, aResolve );
|
||||
*aModelType = GetFieldValue( aFields, SIM_DEVICE_SUBTYPE_FIELD, aResolve );
|
||||
|
@ -1527,7 +1527,7 @@ void SIM_MODEL::MigrateSimModel( T& aSymbol, const PROJECT* aProject )
|
|||
};
|
||||
|
||||
auto generateDefaultPinMapFromSymbol =
|
||||
[]( const std::vector<LIB_PIN*>& sourcePins )
|
||||
[]( const std::vector<SCH_PIN*>& sourcePins )
|
||||
{
|
||||
wxString pinMap;
|
||||
|
||||
|
@ -1549,7 +1549,7 @@ void SIM_MODEL::MigrateSimModel( T& aSymbol, const PROJECT* aProject )
|
|||
|
||||
wxString prefix = aSymbol.GetPrefix();
|
||||
SCH_FIELD* valueField = aSymbol.FindField( wxT( "Value" ) );
|
||||
std::vector<LIB_PIN*> sourcePins = aSymbol.GetAllLibPins();
|
||||
std::vector<SCH_PIN*> sourcePins = aSymbol.GetAllLibPins();
|
||||
bool sourcePinsSorted = false;
|
||||
|
||||
auto lazySortSourcePins =
|
||||
|
@ -1558,7 +1558,7 @@ void SIM_MODEL::MigrateSimModel( T& aSymbol, const PROJECT* aProject )
|
|||
if( !sourcePinsSorted )
|
||||
{
|
||||
std::sort( sourcePins.begin(), sourcePins.end(),
|
||||
[]( const LIB_PIN* lhs, const LIB_PIN* rhs )
|
||||
[]( const SCH_PIN* lhs, const SCH_PIN* rhs )
|
||||
{
|
||||
return StrNumCmp( lhs->GetNumber(), rhs->GetNumber(), true ) < 0;
|
||||
} );
|
||||
|
|
|
@ -30,9 +30,8 @@
|
|||
#include <map>
|
||||
#include <utility>
|
||||
|
||||
#include <reporter.h>
|
||||
#include <sch_field.h>
|
||||
#include <lib_pin.h>
|
||||
#include <sch_pin.h>
|
||||
|
||||
// Must be included after sch_field.h (exactly eda_shape.h) to avoid a colliding
|
||||
// declaration with a window header (under msys2)
|
||||
|
@ -44,6 +43,7 @@ struct SPICE_ITEM;
|
|||
class SPICE_GENERATOR;
|
||||
class SIM_MODEL_SERIALIZER;
|
||||
class PROJECT;
|
||||
class REPORTER;
|
||||
|
||||
|
||||
#define SIM_REFERENCE_FIELD wxT( "Reference" )
|
||||
|
@ -410,20 +410,20 @@ public:
|
|||
|
||||
static TYPE ReadTypeFromFields( const std::vector<SCH_FIELD>& aFields, REPORTER& aReporter );
|
||||
|
||||
static std::unique_ptr<SIM_MODEL> Create( TYPE aType, const std::vector<LIB_PIN*>& aPins,
|
||||
static std::unique_ptr<SIM_MODEL> Create( TYPE aType, const std::vector<SCH_PIN*>& aPins,
|
||||
REPORTER& aReporter );
|
||||
|
||||
static std::unique_ptr<SIM_MODEL> Create( const SIM_MODEL* aBaseModel,
|
||||
const std::vector<LIB_PIN*>& aPins,
|
||||
const std::vector<SCH_PIN*>& aPins,
|
||||
REPORTER& aReporter );
|
||||
|
||||
static std::unique_ptr<SIM_MODEL> Create( const SIM_MODEL* aBaseModel,
|
||||
const std::vector<LIB_PIN*>& aPins,
|
||||
const std::vector<SCH_PIN*>& aPins,
|
||||
const std::vector<SCH_FIELD>& aFields,
|
||||
REPORTER& aReporter );
|
||||
|
||||
static std::unique_ptr<SIM_MODEL> Create( const std::vector<SCH_FIELD>& aFields,
|
||||
const std::vector<LIB_PIN*>& aPins,
|
||||
const std::vector<SCH_PIN*>& aPins,
|
||||
bool aResolved, REPORTER& aReporter );
|
||||
|
||||
static std::string GetFieldValue( const std::vector<SCH_FIELD>* aFields,
|
||||
|
@ -446,7 +446,7 @@ public:
|
|||
SIM_MODEL& operator=(SIM_MODEL&& aOther ) = delete;
|
||||
|
||||
void ReadDataFields( const std::vector<SCH_FIELD>* aFields,
|
||||
const std::vector<LIB_PIN*>& aPins );
|
||||
const std::vector<SCH_PIN*>& aPins );
|
||||
|
||||
void WriteFields( std::vector<SCH_FIELD>& aFields ) const;
|
||||
|
||||
|
@ -529,7 +529,7 @@ protected:
|
|||
SIM_MODEL( TYPE aType, std::unique_ptr<SPICE_GENERATOR> aSpiceGenerator,
|
||||
std::unique_ptr<SIM_MODEL_SERIALIZER> aSerializer );
|
||||
|
||||
void createPins( const std::vector<LIB_PIN*>& aSymbolPins );
|
||||
void createPins( const std::vector<SCH_PIN*>& aSymbolPins );
|
||||
|
||||
virtual int doFindParam( const std::string& aParamName ) const;
|
||||
virtual void doSetParamValue( int aParamIndex, const std::string& aValue );
|
||||
|
|
|
@ -121,13 +121,13 @@ public:
|
|||
* Set or clear the pin name visibility flag.
|
||||
*/
|
||||
void SetShowPinNames( bool aShow ) { m_showPinNames = aShow; }
|
||||
bool GetShowPinNames() const { return m_showPinNames; }
|
||||
virtual bool GetShowPinNames() const { return m_showPinNames; }
|
||||
|
||||
/**
|
||||
* Set or clear the pin number visibility flag.
|
||||
*/
|
||||
void SetShowPinNumbers( bool aShow ) { m_showPinNumbers = aShow; }
|
||||
bool GetShowPinNumbers() const { return m_showPinNumbers; }
|
||||
virtual bool GetShowPinNumbers() const { return m_showPinNumbers; }
|
||||
|
||||
/**
|
||||
* Set or clear the exclude from simulation flag.
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
#include <macros.h>
|
||||
|
||||
// helper function to sort pins by pin num
|
||||
static bool sort_by_pin_number( const LIB_PIN* ref, const LIB_PIN* tst );
|
||||
static bool sort_by_pin_number( const SCH_PIN* ref, const SCH_PIN* tst );
|
||||
|
||||
static void CheckLibSymbolGraphics( LIB_SYMBOL* aSymbol, std::vector<wxString>& aMessages,
|
||||
EDA_DRAW_FRAME* aUnitsProvider );
|
||||
|
@ -70,8 +70,7 @@ void CheckLibSymbol( LIB_SYMBOL* aSymbol, std::vector<wxString>& aMessages,
|
|||
aMessages.push_back( msg );
|
||||
}
|
||||
|
||||
std::vector<LIB_PIN*> pinList;
|
||||
aSymbol->GetPins( pinList );
|
||||
std::vector<SCH_PIN*> pinList = aSymbol->GetPins();
|
||||
|
||||
// Test for duplicates:
|
||||
// Sort pins by pin num, so 2 duplicate pins
|
||||
|
@ -88,8 +87,8 @@ void CheckLibSymbol( LIB_SYMBOL* aSymbol, std::vector<wxString>& aMessages,
|
|||
|
||||
for( unsigned ii = 1; ii < pinList.size(); ii++ )
|
||||
{
|
||||
LIB_PIN* pin = pinList[ii - 1];
|
||||
LIB_PIN* next = pinList[ii];
|
||||
SCH_PIN* pin = pinList[ii - 1];
|
||||
SCH_PIN* next = pinList[ii];
|
||||
|
||||
if( pin->GetNumber() != next->GetNumber() )
|
||||
continue;
|
||||
|
@ -207,7 +206,7 @@ void CheckLibSymbol( LIB_SYMBOL* aSymbol, std::vector<wxString>& aMessages,
|
|||
aMessages.push_back( msg );
|
||||
}
|
||||
|
||||
LIB_PIN* pin = pinList[0];
|
||||
SCH_PIN* pin = pinList[0];
|
||||
|
||||
if( pin->GetType() != ELECTRICAL_PINTYPE::PT_POWER_IN
|
||||
&& pin->GetType() != ELECTRICAL_PINTYPE::PT_POWER_OUT )
|
||||
|
@ -226,7 +225,7 @@ void CheckLibSymbol( LIB_SYMBOL* aSymbol, std::vector<wxString>& aMessages,
|
|||
}
|
||||
|
||||
|
||||
for( LIB_PIN* pin : pinList )
|
||||
for( SCH_PIN* pin : pinList )
|
||||
{
|
||||
wxString pinName = pin->GetName();
|
||||
|
||||
|
@ -408,7 +407,7 @@ void CheckLibSymbolGraphics( LIB_SYMBOL* aSymbol, std::vector<wxString>& aMessag
|
|||
}
|
||||
|
||||
|
||||
bool sort_by_pin_number( const LIB_PIN* ref, const LIB_PIN* tst )
|
||||
bool sort_by_pin_number( const SCH_PIN* ref, const SCH_PIN* tst )
|
||||
{
|
||||
// Use number as primary key
|
||||
int test = ref->GetNumber().Cmp( tst->GetNumber() );
|
||||
|
|
|
@ -1385,7 +1385,7 @@ void SYMBOL_EDIT_FRAME::FocusOnItem( SCH_ITEM* aItem )
|
|||
|
||||
if( m_symbol )
|
||||
{
|
||||
for( LIB_PIN* pin : m_symbol->GetAllLibPins() )
|
||||
for( SCH_PIN* pin : m_symbol->GetAllLibPins() )
|
||||
{
|
||||
if( pin->m_Uuid == lastBrightenedItemID )
|
||||
lastItem = pin;
|
||||
|
|
|
@ -593,10 +593,11 @@ static SPIN_STYLE orientLabel( SCH_PIN* aPin )
|
|||
// Initial orientation from the pin
|
||||
switch( aPin->GetLibPin()->GetOrientation() )
|
||||
{
|
||||
default:
|
||||
case PIN_ORIENTATION::PIN_RIGHT: spin = SPIN_STYLE::LEFT; break;
|
||||
case PIN_ORIENTATION::PIN_UP: spin = SPIN_STYLE::BOTTOM; break;
|
||||
case PIN_ORIENTATION::PIN_DOWN: spin = SPIN_STYLE::UP; break;
|
||||
case PIN_ORIENTATION::PIN_LEFT: spin = SPIN_STYLE::RIGHT; break;
|
||||
case PIN_ORIENTATION::PIN_RIGHT: spin = SPIN_STYLE::LEFT; break;
|
||||
}
|
||||
|
||||
// Reorient based on the actual symbol orientation now
|
||||
|
|
|
@ -345,7 +345,7 @@ TOOL_ACTION EE_ACTIONS::placeSymbolPin( TOOL_ACTION_ARGS()
|
|||
.Tooltip( _( "Add a pin" ) )
|
||||
.Icon( BITMAPS::pin )
|
||||
.Flags( AF_ACTIVATE )
|
||||
.Parameter( LIB_PIN_T ) );
|
||||
.Parameter( SCH_PIN_T ) );
|
||||
|
||||
TOOL_ACTION EE_ACTIONS::placeSymbolText( TOOL_ACTION_ARGS()
|
||||
.Name( "eeschema.SymbolDrawing.placeSymbolText" )
|
||||
|
|
|
@ -364,7 +364,6 @@ GRID_HELPER_GRIDS EE_GRID_HELPER::GetItemGrid( const EDA_ITEM* aItem ) const
|
|||
switch( aItem->Type() )
|
||||
{
|
||||
case LIB_SYMBOL_T:
|
||||
case LIB_PIN_T:
|
||||
case SCH_SYMBOL_T:
|
||||
case SCH_PIN_T:
|
||||
case SCH_SHEET_PIN_T:
|
||||
|
|
|
@ -65,11 +65,11 @@ EDA_ITEM* EE_SELECTION::GetTopLeftItem( bool onlyModules ) const
|
|||
for( EDA_ITEM* item : m_items )
|
||||
{
|
||||
SCH_ITEM* sch_item = dynamic_cast<SCH_ITEM*>( item );
|
||||
LIB_PIN* lib_pin = dynamic_cast<LIB_PIN*>( item );
|
||||
SCH_PIN* pin = dynamic_cast<SCH_PIN*>( item );
|
||||
|
||||
// Prefer connection points (which should remain on grid)
|
||||
|
||||
if( ( sch_item && sch_item->IsConnectable() ) || lib_pin )
|
||||
if( ( sch_item && sch_item->IsConnectable() ) || pin )
|
||||
processItem( item, &topLeftConnectedItem, &topLeftConnectedPos );
|
||||
|
||||
processItem( item, &topLeftItem, &topLeftPos );
|
||||
|
|
|
@ -571,7 +571,7 @@ int EE_SELECTION_TOOL::Main( const TOOL_EVENT& aEvent )
|
|||
m_selection = RequestSelection( { SCH_SHAPE_T,
|
||||
SCH_TEXT_T,
|
||||
SCH_TEXTBOX_T,
|
||||
LIB_PIN_T,
|
||||
SCH_PIN_T,
|
||||
SCH_FIELD_T } );
|
||||
}
|
||||
}
|
||||
|
@ -666,12 +666,13 @@ int EE_SELECTION_TOOL::Main( const TOOL_EVENT& aEvent )
|
|||
|
||||
switch( pin->GetOrientation() )
|
||||
{
|
||||
case PIN_ORIENTATION::PIN_LEFT:
|
||||
stub = VECTOR2I( 1 * wireGrid.x, 0 );
|
||||
break;
|
||||
default:
|
||||
case PIN_ORIENTATION::PIN_RIGHT:
|
||||
stub = VECTOR2I( -1 * wireGrid.x, 0 );
|
||||
break;
|
||||
case PIN_ORIENTATION::PIN_LEFT:
|
||||
stub = VECTOR2I( 1 * wireGrid.x, 0 );
|
||||
break;
|
||||
case PIN_ORIENTATION::PIN_UP:
|
||||
stub = VECTOR2I( 0, 1 * wireGrid.y );
|
||||
break;
|
||||
|
@ -731,12 +732,13 @@ int EE_SELECTION_TOOL::Main( const TOOL_EVENT& aEvent )
|
|||
|
||||
switch( pin->GetOrientation() )
|
||||
{
|
||||
case PIN_ORIENTATION::PIN_LEFT:
|
||||
label->SetSpinStyle( SPIN_STYLE::SPIN::RIGHT );
|
||||
break;
|
||||
default:
|
||||
case PIN_ORIENTATION::PIN_RIGHT:
|
||||
label->SetSpinStyle( SPIN_STYLE::SPIN::LEFT );
|
||||
break;
|
||||
case PIN_ORIENTATION::PIN_LEFT:
|
||||
label->SetSpinStyle( SPIN_STYLE::SPIN::RIGHT );
|
||||
break;
|
||||
case PIN_ORIENTATION::PIN_UP:
|
||||
label->SetSpinStyle( SPIN_STYLE::SPIN::BOTTOM );
|
||||
break;
|
||||
|
@ -1085,9 +1087,9 @@ void EE_SELECTION_TOOL::narrowSelection( EE_COLLECTOR& collector, const VECTOR2I
|
|||
continue;
|
||||
}
|
||||
}
|
||||
else if( item->Type() == LIB_PIN_T )
|
||||
else if( item->Type() == SCH_PIN_T )
|
||||
{
|
||||
if( !static_cast<LIB_PIN*>( item )->IsVisible()
|
||||
if( !static_cast<SCH_PIN*>( item )->IsVisible()
|
||||
&& !symbolEditorFrame->GetShowInvisiblePins() )
|
||||
{
|
||||
collector.Remove( i );
|
||||
|
@ -1607,7 +1609,6 @@ bool EE_SELECTION_TOOL::itemPassesFilter( EDA_ITEM* aItem )
|
|||
|
||||
case SCH_PIN_T:
|
||||
case SCH_SHEET_PIN_T:
|
||||
case LIB_PIN_T:
|
||||
if( !m_filter.pins )
|
||||
return false;
|
||||
|
||||
|
@ -2438,6 +2439,15 @@ bool EE_SELECTION_TOOL::Selectable( const EDA_ITEM* aItem, const VECTOR2I* aPos,
|
|||
{
|
||||
const SCH_PIN* pin = static_cast<const SCH_PIN*>( aItem );
|
||||
|
||||
if( symEditFrame )
|
||||
{
|
||||
if( pin->GetUnit() && pin->GetUnit() != symEditFrame->GetUnit() )
|
||||
return false;
|
||||
|
||||
if( pin->GetBodyStyle() && pin->GetBodyStyle() != symEditFrame->GetBodyStyle() )
|
||||
return false;
|
||||
}
|
||||
|
||||
if( !pin->IsVisible() && !m_frame->GetShowAllPins() )
|
||||
return false;
|
||||
|
||||
|
@ -2481,7 +2491,6 @@ bool EE_SELECTION_TOOL::Selectable( const EDA_ITEM* aItem, const VECTOR2I* aPos,
|
|||
case SCH_SHAPE_T:
|
||||
case SCH_TEXT_T:
|
||||
case SCH_TEXTBOX_T:
|
||||
case LIB_PIN_T:
|
||||
if( symEditFrame )
|
||||
{
|
||||
const SCH_ITEM* sch_item = static_cast<const SCH_ITEM*>( aItem );
|
||||
|
|
|
@ -144,7 +144,7 @@ private:
|
|||
EE_SELECTION_TOOL* selTool = getToolManager()->GetTool<EE_SELECTION_TOOL>();
|
||||
EE_SELECTION& selection = selTool->GetSelection();
|
||||
SCH_PIN* pin = dynamic_cast<SCH_PIN*>( selection.Front() );
|
||||
LIB_PIN* libPin = pin ? pin->GetLibPin() : nullptr;
|
||||
SCH_PIN* libPin = pin ? pin->GetLibPin() : nullptr;
|
||||
|
||||
Clear();
|
||||
|
||||
|
@ -2054,6 +2054,7 @@ int SCH_EDIT_TOOL::Properties( const TOOL_EVENT& aEvent )
|
|||
break;
|
||||
|
||||
case SCH_NO_CONNECT_T:
|
||||
case SCH_PIN_T:
|
||||
break;
|
||||
|
||||
default: // Unexpected item
|
||||
|
|
|
@ -570,7 +570,7 @@ int SCH_EDITOR_CONTROL::SimProbe( const TOOL_EVENT& aEvent )
|
|||
{
|
||||
try
|
||||
{
|
||||
LIB_PIN* pin = static_cast<SCH_PIN*>( item )->GetLibPin();
|
||||
SCH_PIN* pin = static_cast<SCH_PIN*>( item )->GetLibPin();
|
||||
SCH_SYMBOL* symbol = static_cast<SCH_SYMBOL*>( item->GetParent() );
|
||||
|
||||
wxString msg;
|
||||
|
@ -2110,16 +2110,16 @@ int SCH_EDITOR_CONTROL::Paste( const TOOL_EVENT& aEvent )
|
|||
for( EDA_ITEM* item : selection.Items() )
|
||||
{
|
||||
SCH_ITEM* sch_item = dynamic_cast<SCH_ITEM*>( item );
|
||||
LIB_PIN* lib_pin = dynamic_cast<LIB_PIN*>( item );
|
||||
SCH_PIN* pin = dynamic_cast<SCH_PIN*>( item );
|
||||
|
||||
if( sch_item && sch_item->IsConnectable() )
|
||||
{
|
||||
for( const VECTOR2I& pt : sch_item->GetConnectionPoints() )
|
||||
processPt( pt );
|
||||
}
|
||||
else if( lib_pin )
|
||||
else if( pin )
|
||||
{
|
||||
processPt( lib_pin->GetPosition() );
|
||||
processPt( pin->GetPosition() );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -81,7 +81,7 @@ int SYMBOL_EDITOR_DRAWING_TOOLS::TwoClickPlace( const TOOL_EVENT& aEvent )
|
|||
{
|
||||
KICAD_T type = aEvent.Parameter<KICAD_T>();
|
||||
auto* settings = Pgm().GetSettingsManager().GetAppSettings<SYMBOL_EDITOR_SETTINGS>();
|
||||
auto* pinTool = type == LIB_PIN_T ? m_toolMgr->GetTool<SYMBOL_EDITOR_PIN_TOOL>() : nullptr;
|
||||
auto* pinTool = type == SCH_PIN_T ? m_toolMgr->GetTool<SYMBOL_EDITOR_PIN_TOOL>() : nullptr;
|
||||
|
||||
if( m_inTwoClickPlace )
|
||||
return 0;
|
||||
|
@ -208,7 +208,7 @@ int SYMBOL_EDITOR_DRAWING_TOOLS::TwoClickPlace( const TOOL_EVENT& aEvent )
|
|||
|
||||
switch( type )
|
||||
{
|
||||
case LIB_PIN_T:
|
||||
case SCH_PIN_T:
|
||||
{
|
||||
item = pinTool->CreatePin( VECTOR2I( cursorPos.x, -cursorPos.y ), symbol );
|
||||
g_lastPinWeakPtr = item;
|
||||
|
@ -281,8 +281,8 @@ int SYMBOL_EDITOR_DRAWING_TOOLS::TwoClickPlace( const TOOL_EVENT& aEvent )
|
|||
|
||||
switch( item->Type() )
|
||||
{
|
||||
case LIB_PIN_T:
|
||||
pinTool->PlacePin( static_cast<LIB_PIN*>( item ) );
|
||||
case SCH_PIN_T:
|
||||
pinTool->PlacePin( static_cast<SCH_PIN*>( item ) );
|
||||
item->ClearEditFlags();
|
||||
commit.Push( _( "Add Pin" ) );
|
||||
break;
|
||||
|
@ -830,15 +830,13 @@ int SYMBOL_EDITOR_DRAWING_TOOLS::RepeatDrawItem( const TOOL_EVENT& aEvent )
|
|||
{
|
||||
SYMBOL_EDITOR_PIN_TOOL* pinTool = m_toolMgr->GetTool<SYMBOL_EDITOR_PIN_TOOL>();
|
||||
LIB_SYMBOL* symbol = m_frame->GetCurSymbol();
|
||||
LIB_PIN* sourcePin = nullptr;
|
||||
SCH_PIN* sourcePin = nullptr;
|
||||
|
||||
if( !symbol )
|
||||
return 0;
|
||||
|
||||
// See if we have a pin matching our weak ptr
|
||||
std::vector<LIB_PIN*> pins = symbol->GetAllLibPins();
|
||||
|
||||
for( LIB_PIN* test : pins )
|
||||
for( SCH_PIN* test : symbol->GetAllLibPins() )
|
||||
{
|
||||
if( (void*) test == g_lastPinWeakPtr )
|
||||
{
|
||||
|
@ -849,7 +847,7 @@ int SYMBOL_EDITOR_DRAWING_TOOLS::RepeatDrawItem( const TOOL_EVENT& aEvent )
|
|||
|
||||
if( sourcePin )
|
||||
{
|
||||
LIB_PIN* pin = pinTool->RepeatPin( sourcePin );
|
||||
SCH_PIN* pin = pinTool->RepeatPin( sourcePin );
|
||||
g_lastPinWeakPtr = pin;
|
||||
|
||||
m_toolMgr->RunAction( EE_ACTIONS::clearSelection );
|
||||
|
|
|
@ -274,7 +274,7 @@ static std::vector<KICAD_T> nonFields =
|
|||
SCH_SHAPE_T,
|
||||
SCH_TEXT_T,
|
||||
SCH_TEXTBOX_T,
|
||||
LIB_PIN_T
|
||||
SCH_PIN_T
|
||||
};
|
||||
|
||||
|
||||
|
@ -298,9 +298,9 @@ int SYMBOL_EDITOR_EDIT_TOOL::DoDelete( const TOOL_EVENT& aEvent )
|
|||
|
||||
for( EDA_ITEM* item : items )
|
||||
{
|
||||
if( item->Type() == LIB_PIN_T )
|
||||
if( item->Type() == SCH_PIN_T )
|
||||
{
|
||||
LIB_PIN* curr_pin = static_cast<LIB_PIN*>( item );
|
||||
SCH_PIN* curr_pin = static_cast<SCH_PIN*>( item );
|
||||
VECTOR2I pos = curr_pin->GetPosition();
|
||||
|
||||
toDelete.insert( curr_pin );
|
||||
|
@ -313,12 +313,7 @@ int SYMBOL_EDITOR_EDIT_TOOL::DoDelete( const TOOL_EVENT& aEvent )
|
|||
|
||||
got_unit[curr_pin->GetUnit()] = true;
|
||||
|
||||
int curr_bodyStyle = curr_pin->GetBodyStyle();
|
||||
ELECTRICAL_PINTYPE etype = curr_pin->GetType();
|
||||
wxString name = curr_pin->GetName();
|
||||
std::vector<LIB_PIN*> pins = symbol->GetAllLibPins();
|
||||
|
||||
for( LIB_PIN* pin : pins )
|
||||
for( SCH_PIN* pin : symbol->GetAllLibPins() )
|
||||
{
|
||||
if( got_unit[pin->GetUnit()] )
|
||||
continue;
|
||||
|
@ -326,13 +321,13 @@ int SYMBOL_EDITOR_EDIT_TOOL::DoDelete( const TOOL_EVENT& aEvent )
|
|||
if( pin->GetPosition() != pos )
|
||||
continue;
|
||||
|
||||
if( pin->GetBodyStyle() != curr_bodyStyle )
|
||||
if( pin->GetBodyStyle() != curr_pin->GetBodyStyle() )
|
||||
continue;
|
||||
|
||||
if( pin->GetType() != etype )
|
||||
if( pin->GetType() != curr_pin->GetType() )
|
||||
continue;
|
||||
|
||||
if( pin->GetName() != name )
|
||||
if( pin->GetName() != curr_pin->GetName() )
|
||||
continue;
|
||||
|
||||
toDelete.insert( pin );
|
||||
|
@ -480,9 +475,9 @@ int SYMBOL_EDITOR_EDIT_TOOL::Properties( const TOOL_EVENT& aEvent )
|
|||
|
||||
switch( item->Type() )
|
||||
{
|
||||
case LIB_PIN_T:
|
||||
case SCH_PIN_T:
|
||||
if( SYMBOL_EDITOR_PIN_TOOL* pinTool = m_toolMgr->GetTool<SYMBOL_EDITOR_PIN_TOOL>() )
|
||||
pinTool->EditPinProperties( (LIB_PIN*) item );
|
||||
pinTool->EditPinProperties( static_cast<SCH_PIN*>( item ) );
|
||||
|
||||
break;
|
||||
|
||||
|
@ -637,7 +632,7 @@ void SYMBOL_EDITOR_EDIT_TOOL::editSymbolProperties()
|
|||
}
|
||||
}
|
||||
|
||||
void SYMBOL_EDITOR_EDIT_TOOL::handlePinDuplication( LIB_PIN* aOldPin, LIB_PIN* aNewPin,
|
||||
void SYMBOL_EDITOR_EDIT_TOOL::handlePinDuplication( SCH_PIN* aOldPin, SCH_PIN* aNewPin,
|
||||
int& aSymbolLastPinNumber )
|
||||
{
|
||||
if( !aNewPin->GetNumber().IsEmpty() )
|
||||
|
@ -905,9 +900,9 @@ int SYMBOL_EDITOR_EDIT_TOOL::Duplicate( const TOOL_EVENT& aEvent )
|
|||
SCH_ITEM* oldItem = static_cast<SCH_ITEM*>( selection.GetItem( ii ) );
|
||||
SCH_ITEM* newItem = oldItem->Duplicate();
|
||||
|
||||
if( newItem->Type() == LIB_PIN_T )
|
||||
if( newItem->Type() == SCH_PIN_T )
|
||||
{
|
||||
LIB_PIN* newPin = static_cast<LIB_PIN*>( newItem );
|
||||
SCH_PIN* newPin = static_cast<SCH_PIN*>( newItem );
|
||||
|
||||
if( !newPin->GetNumber().IsEmpty() )
|
||||
newPin->SetNumber( wxString::Format( wxT( "%i" ), symbol->GetMaxPinNumber() + 1 ) );
|
||||
|
|
|
@ -70,7 +70,7 @@ private:
|
|||
void editTextBoxProperties( SCH_ITEM* aItem );
|
||||
void editFieldProperties( SCH_FIELD* aField );
|
||||
void editSymbolProperties();
|
||||
void handlePinDuplication(LIB_PIN* aOldPin, LIB_PIN* aNewPin, int &aSymbolLastPinNumber );
|
||||
void handlePinDuplication(SCH_PIN* aOldPin, SCH_PIN* aNewPin, int &aSymbolLastPinNumber );
|
||||
|
||||
///< Set up handlers for various events.
|
||||
void setTransitions() override;
|
||||
|
|
|
@ -179,23 +179,21 @@ bool SYMBOL_EDITOR_MOVE_TOOL::doMoveSelection( const TOOL_EVENT& aEvent, SCH_COM
|
|||
if( m_frame->SynchronizePins()
|
||||
&& ( lib_item->GetEditFlags() & IS_PASTED ) == 0 )
|
||||
{
|
||||
std::set<LIB_PIN*> sync_pins;
|
||||
std::set<SCH_PIN*> sync_pins;
|
||||
|
||||
for( EDA_ITEM* sel_item : selection )
|
||||
{
|
||||
lib_item = static_cast<SCH_ITEM*>( sel_item );
|
||||
|
||||
if( lib_item->Type() == LIB_PIN_T )
|
||||
if( lib_item->Type() == SCH_PIN_T )
|
||||
{
|
||||
LIB_PIN* cur_pin = static_cast<LIB_PIN*>( lib_item );
|
||||
SCH_PIN* cur_pin = static_cast<SCH_PIN*>( lib_item );
|
||||
LIB_SYMBOL* symbol = m_frame->GetCurSymbol();
|
||||
std::vector<bool> got_unit( symbol->GetUnitCount() + 1 );
|
||||
|
||||
got_unit[cur_pin->GetUnit()] = true;
|
||||
|
||||
std::vector<LIB_PIN*> pins = symbol->GetAllLibPins();
|
||||
|
||||
for( LIB_PIN* pin : pins )
|
||||
for( SCH_PIN* pin : symbol->GetAllLibPins() )
|
||||
{
|
||||
if( !got_unit[pin->GetUnit()]
|
||||
&& pin->GetPosition() == cur_pin->GetPosition()
|
||||
|
@ -211,7 +209,7 @@ bool SYMBOL_EDITOR_MOVE_TOOL::doMoveSelection( const TOOL_EVENT& aEvent, SCH_COM
|
|||
}
|
||||
}
|
||||
|
||||
for( LIB_PIN* pin : sync_pins )
|
||||
for( SCH_PIN* pin : sync_pins )
|
||||
m_selectionTool->AddItemToSel( pin, true /*quiet mode*/ );
|
||||
}
|
||||
|
||||
|
@ -322,13 +320,13 @@ bool SYMBOL_EDITOR_MOVE_TOOL::doMoveSelection( const TOOL_EVENT& aEvent, SCH_COM
|
|||
|| evt->IsClick( BUT_LEFT )
|
||||
|| evt->IsDblClick( BUT_LEFT ) )
|
||||
{
|
||||
if( selection.GetSize() == 1 && selection.Front()->Type() == LIB_PIN_T )
|
||||
if( selection.GetSize() == 1 && selection.Front()->Type() == SCH_PIN_T )
|
||||
{
|
||||
SYMBOL_EDITOR_PIN_TOOL* pinTool = m_toolMgr->GetTool<SYMBOL_EDITOR_PIN_TOOL>();
|
||||
|
||||
try
|
||||
{
|
||||
LIB_PIN* curr_pin = (LIB_PIN*) selection.Front();
|
||||
SCH_PIN* curr_pin = static_cast<SCH_PIN*>( selection.Front() );
|
||||
|
||||
if( pinTool->PlacePin( curr_pin ) )
|
||||
{
|
||||
|
@ -479,7 +477,7 @@ int SYMBOL_EDITOR_MOVE_TOOL::AlignElements( const TOOL_EVENT& aEvent )
|
|||
if( delta != VECTOR2I( 0, 0 ) )
|
||||
doMoveItem( item, delta );
|
||||
|
||||
if( LIB_PIN* pin = dynamic_cast<LIB_PIN*>( item ) )
|
||||
if( SCH_PIN* pin = dynamic_cast<SCH_PIN*>( item ) )
|
||||
{
|
||||
int length = pin->GetLength();
|
||||
int pinGrid;
|
||||
|
|
|
@ -103,7 +103,7 @@ bool SYMBOL_EDITOR_PIN_TOOL::Init()
|
|||
return editor->IsSymbolEditable() && !editor->IsSymbolAlias();
|
||||
};
|
||||
|
||||
auto singlePinCondition = EE_CONDITIONS::Count( 1 ) && EE_CONDITIONS::OnlyTypes( { LIB_PIN_T } );
|
||||
auto singlePinCondition = EE_CONDITIONS::Count( 1 ) && EE_CONDITIONS::OnlyTypes( { SCH_PIN_T } );
|
||||
|
||||
CONDITIONAL_MENU& selToolMenu = m_selectionTool->GetToolMenu().GetMenu();
|
||||
|
||||
|
@ -116,9 +116,9 @@ bool SYMBOL_EDITOR_PIN_TOOL::Init()
|
|||
}
|
||||
|
||||
|
||||
bool SYMBOL_EDITOR_PIN_TOOL::EditPinProperties( LIB_PIN* aPin )
|
||||
bool SYMBOL_EDITOR_PIN_TOOL::EditPinProperties( SCH_PIN* aPin )
|
||||
{
|
||||
LIB_PIN original_pin( *aPin );
|
||||
SCH_PIN original_pin( *aPin );
|
||||
DIALOG_PIN_PROPERTIES dlg( m_frame, aPin );
|
||||
SCH_COMMIT commit( m_frame );
|
||||
LIB_SYMBOL* parentSymbol = static_cast<LIB_SYMBOL*>( aPin->GetParentSymbol() );
|
||||
|
@ -131,9 +131,6 @@ bool SYMBOL_EDITOR_PIN_TOOL::EditPinProperties( LIB_PIN* aPin )
|
|||
|
||||
if( !aPin->IsNew() && m_frame->SynchronizePins() && parentSymbol )
|
||||
{
|
||||
std::vector<LIB_PIN*> pinList;
|
||||
parentSymbol->GetPins( pinList );
|
||||
|
||||
// a pin can have a unit id = 0 (common to all units) to unit count
|
||||
// So we need a buffer size = GetUnitCount()+1 to store a value in a vector
|
||||
// when using the unit id of a pin as index
|
||||
|
@ -141,7 +138,7 @@ bool SYMBOL_EDITOR_PIN_TOOL::EditPinProperties( LIB_PIN* aPin )
|
|||
|
||||
got_unit[static_cast<size_t>(aPin->GetUnit())] = true;
|
||||
|
||||
for( LIB_PIN* other : pinList )
|
||||
for( SCH_PIN* other : parentSymbol->GetPins() )
|
||||
{
|
||||
if( other == aPin )
|
||||
continue;
|
||||
|
@ -209,14 +206,14 @@ bool SYMBOL_EDITOR_PIN_TOOL::EditPinProperties( LIB_PIN* aPin )
|
|||
}
|
||||
|
||||
|
||||
bool SYMBOL_EDITOR_PIN_TOOL::PlacePin( LIB_PIN* aPin )
|
||||
bool SYMBOL_EDITOR_PIN_TOOL::PlacePin( SCH_PIN* aPin )
|
||||
{
|
||||
LIB_SYMBOL* symbol = m_frame->GetCurSymbol();
|
||||
bool ask_for_pin = true; // Test for another pin in same position in other units
|
||||
|
||||
std::vector<LIB_PIN*> pins = symbol->GetAllLibPins();
|
||||
std::vector<SCH_PIN*> pins = symbol->GetAllLibPins();
|
||||
|
||||
for( LIB_PIN* test : pins )
|
||||
for( SCH_PIN* test : pins )
|
||||
{
|
||||
if( test == aPin || aPin->GetPosition() != test->GetPosition() || test->GetEditFlags() )
|
||||
continue;
|
||||
|
@ -265,7 +262,7 @@ bool SYMBOL_EDITOR_PIN_TOOL::PlacePin( LIB_PIN* aPin )
|
|||
}
|
||||
|
||||
// Put linked pins in new position, and clear flags
|
||||
for( LIB_PIN* pin : pins )
|
||||
for( SCH_PIN* pin : pins )
|
||||
{
|
||||
if( ( pin->GetEditFlags() & IS_LINKED ) == 0 )
|
||||
continue;
|
||||
|
@ -284,11 +281,11 @@ bool SYMBOL_EDITOR_PIN_TOOL::PlacePin( LIB_PIN* aPin )
|
|||
/*
|
||||
* Create a new pin.
|
||||
*/
|
||||
LIB_PIN* SYMBOL_EDITOR_PIN_TOOL::CreatePin( const VECTOR2I& aPosition, LIB_SYMBOL* aSymbol )
|
||||
SCH_PIN* SYMBOL_EDITOR_PIN_TOOL::CreatePin( const VECTOR2I& aPosition, LIB_SYMBOL* aSymbol )
|
||||
{
|
||||
aSymbol->ClearTempFlags();
|
||||
|
||||
LIB_PIN* pin = new LIB_PIN( aSymbol );
|
||||
SCH_PIN* pin = new SCH_PIN( aSymbol );
|
||||
|
||||
pin->SetFlags( IS_NEW );
|
||||
|
||||
|
@ -317,10 +314,10 @@ LIB_PIN* SYMBOL_EDITOR_PIN_TOOL::CreatePin( const VECTOR2I& aPosition, LIB_SYMBO
|
|||
}
|
||||
|
||||
|
||||
void SYMBOL_EDITOR_PIN_TOOL::CreateImagePins( LIB_PIN* aPin )
|
||||
void SYMBOL_EDITOR_PIN_TOOL::CreateImagePins( SCH_PIN* aPin )
|
||||
{
|
||||
int ii;
|
||||
LIB_PIN* newPin;
|
||||
SCH_PIN* newPin;
|
||||
|
||||
// if "synchronize pins editing" option is off, do not create any similar pin for other
|
||||
// units and/or shapes: each unit is edited regardless other units or body
|
||||
|
@ -340,7 +337,7 @@ void SYMBOL_EDITOR_PIN_TOOL::CreateImagePins( LIB_PIN* aPin )
|
|||
if( ii == aPin->GetUnit() )
|
||||
continue;
|
||||
|
||||
newPin = static_cast<LIB_PIN*>( aPin->Duplicate() );
|
||||
newPin = static_cast<SCH_PIN*>( aPin->Duplicate() );
|
||||
|
||||
// To avoid mistakes, gives this pin a new pin number because
|
||||
// it does no have the save pin number as the master pin
|
||||
|
@ -373,15 +370,14 @@ int SYMBOL_EDITOR_PIN_TOOL::PushPinProperties( const TOOL_EVENT& aEvent )
|
|||
{
|
||||
LIB_SYMBOL* symbol = m_frame->GetCurSymbol();
|
||||
EE_SELECTION& selection = m_selectionTool->GetSelection();
|
||||
LIB_PIN* sourcePin = dynamic_cast<LIB_PIN*>( selection.Front() );
|
||||
SCH_PIN* sourcePin = dynamic_cast<SCH_PIN*>( selection.Front() );
|
||||
|
||||
if( !sourcePin )
|
||||
return 0;
|
||||
|
||||
saveCopyInUndoList( symbol, UNDO_REDO::LIBEDIT );
|
||||
std::vector<LIB_PIN*> pins = symbol->GetAllLibPins();
|
||||
|
||||
for( LIB_PIN* pin : pins )
|
||||
for( SCH_PIN* pin : symbol->GetAllLibPins() )
|
||||
{
|
||||
if( pin == sourcePin )
|
||||
continue;
|
||||
|
@ -409,9 +405,9 @@ int SYMBOL_EDITOR_PIN_TOOL::PushPinProperties( const TOOL_EVENT& aEvent )
|
|||
|
||||
|
||||
// Create a new pin based on the previous pin with an incremented pin number.
|
||||
LIB_PIN* SYMBOL_EDITOR_PIN_TOOL::RepeatPin( const LIB_PIN* aSourcePin )
|
||||
SCH_PIN* SYMBOL_EDITOR_PIN_TOOL::RepeatPin( const SCH_PIN* aSourcePin )
|
||||
{
|
||||
LIB_PIN* pin = (LIB_PIN*) aSourcePin->Duplicate();
|
||||
SCH_PIN* pin = static_cast<SCH_PIN*>( aSourcePin->Duplicate() );
|
||||
VECTOR2I step;
|
||||
|
||||
pin->ClearFlags();
|
||||
|
@ -421,10 +417,11 @@ LIB_PIN* SYMBOL_EDITOR_PIN_TOOL::RepeatPin( const LIB_PIN* aSourcePin )
|
|||
|
||||
switch( pin->GetOrientation() )
|
||||
{
|
||||
default:
|
||||
case PIN_ORIENTATION::PIN_RIGHT: step.y = schIUScale.MilsToIU(-settings->m_Repeat.pin_step); break;
|
||||
case PIN_ORIENTATION::PIN_UP: step.x = schIUScale.MilsToIU(settings->m_Repeat.pin_step); break;
|
||||
case PIN_ORIENTATION::PIN_DOWN: step.x = schIUScale.MilsToIU(settings->m_Repeat.pin_step); break;
|
||||
case PIN_ORIENTATION::PIN_LEFT: step.y = schIUScale.MilsToIU(-settings->m_Repeat.pin_step); break;
|
||||
case PIN_ORIENTATION::PIN_RIGHT: step.y = schIUScale.MilsToIU(-settings->m_Repeat.pin_step); break;
|
||||
}
|
||||
|
||||
pin->Move( step );
|
||||
|
|
|
@ -41,13 +41,13 @@ public:
|
|||
/// @copydoc TOOL_INTERACTIVE::Init()
|
||||
bool Init() override;
|
||||
|
||||
LIB_PIN* CreatePin( const VECTOR2I& aPosition, LIB_SYMBOL* aSymbol );
|
||||
LIB_PIN* RepeatPin( const LIB_PIN* aSourcePin );
|
||||
SCH_PIN* CreatePin( const VECTOR2I& aPosition, LIB_SYMBOL* aSymbol );
|
||||
SCH_PIN* RepeatPin( const SCH_PIN* aSourcePin );
|
||||
|
||||
bool PlacePin( LIB_PIN* aPin );
|
||||
void CreateImagePins( LIB_PIN* aPin );
|
||||
bool PlacePin( SCH_PIN* aPin );
|
||||
void CreateImagePins( SCH_PIN* aPin );
|
||||
|
||||
bool EditPinProperties( LIB_PIN* aPin );
|
||||
bool EditPinProperties( SCH_PIN* aPin );
|
||||
int PushPinProperties( const TOOL_EVENT& aEvent );
|
||||
|
||||
private:
|
||||
|
|
|
@ -604,17 +604,11 @@ void PANEL_SYMBOL_CHOOSER::populateFootprintSelector( LIB_ID const& aLibId )
|
|||
|
||||
if( symbol != nullptr )
|
||||
{
|
||||
std::vector<LIB_PIN*> temp_pins;
|
||||
int pinCount = symbol->GetPins( 0 /* all units */, 1 /* single bodyStyle */ ).size();
|
||||
SCH_FIELD* fp_field = symbol->GetFieldById( FOOTPRINT_FIELD );
|
||||
wxString fp_name = fp_field ? fp_field->GetFullText() : wxString( "" );
|
||||
|
||||
// All units, but only a single De Morgan variant.
|
||||
if( symbol->HasAlternateBodyStyle() )
|
||||
symbol->GetPins( temp_pins, 0, 1 );
|
||||
else
|
||||
symbol->GetPins( temp_pins );
|
||||
|
||||
m_fp_sel_ctrl->FilterByPinCount( temp_pins.size() );
|
||||
m_fp_sel_ctrl->FilterByPinCount( pinCount );
|
||||
m_fp_sel_ctrl->FilterByFootprintFilters( symbol->GetFPFilters(), true );
|
||||
m_fp_sel_ctrl->SetDefaultFootprint( fp_name );
|
||||
m_fp_sel_ctrl->UpdateList();
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
#include "pin_shape_combobox.h"
|
||||
|
||||
#include <bitmaps.h>
|
||||
#include <lib_pin.h>
|
||||
#include <sch_pin.h>
|
||||
|
||||
PinShapeComboBox::PinShapeComboBox( wxWindow* parent,
|
||||
wxWindowID id,
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
#include "pin_type_combobox.h"
|
||||
|
||||
#include <bitmaps.h>
|
||||
#include <lib_pin.h>
|
||||
#include <sch_pin.h>
|
||||
|
||||
PinTypeComboBox::PinTypeComboBox( wxWindow* parent,
|
||||
wxWindowID id,
|
||||
|
|
|
@ -150,7 +150,7 @@ enum KICAD_T
|
|||
SCH_FIELD_T,
|
||||
SCH_TEXT_T,
|
||||
SCH_TEXTBOX_T,
|
||||
LIB_PIN_T,
|
||||
SCH_PIN_T,
|
||||
|
||||
// Schematic draw Items. The order of these items effects the sort order.
|
||||
// It is currently ordered to mimic the old Eeschema locate behavior where
|
||||
|
@ -171,7 +171,6 @@ enum KICAD_T
|
|||
SCH_SYMBOL_T,
|
||||
SCH_SHEET_PIN_T,
|
||||
SCH_SHEET_T,
|
||||
SCH_PIN_T,
|
||||
|
||||
// Be prudent with these types:
|
||||
// they should be used only to locate a specific field type among SCH_FIELD_Ts
|
||||
|
@ -409,7 +408,6 @@ constexpr bool IsEeschemaType( const KICAD_T aType )
|
|||
case SCHEMATIC_T:
|
||||
|
||||
case LIB_SYMBOL_T:
|
||||
case LIB_PIN_T:
|
||||
return true;
|
||||
|
||||
default:
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
#include <qa_utils/wx_utils/unit_test_utils.h>
|
||||
|
||||
#include <template_fieldnames.h>
|
||||
#include <sch_field.h>
|
||||
|
||||
|
||||
namespace BOOST_TEST_PRINT_NAMESPACE_OPEN
|
||||
|
|
|
@ -43,8 +43,7 @@
|
|||
#include <sch_symbol.h>
|
||||
#include <sch_sheet_pin.h>
|
||||
#include <sch_sheet.h>
|
||||
|
||||
#include <lib_pin.h>
|
||||
#include <sch_pin.h>
|
||||
|
||||
#include <erc_settings.h>
|
||||
|
||||
|
@ -53,7 +52,7 @@ class TEST_EE_ITEM_FIXTURE
|
|||
public:
|
||||
SCH_SHEET m_sheet;
|
||||
LIB_SYMBOL m_symbol;
|
||||
LIB_PIN m_pin;
|
||||
SCH_PIN m_pin;
|
||||
std::shared_ptr<ERC_ITEM> m_ercItem;
|
||||
|
||||
TEST_EE_ITEM_FIXTURE() :
|
||||
|
@ -113,10 +112,9 @@ public:
|
|||
"test aPin" );
|
||||
|
||||
case SCH_SHEET_T: return new SCH_SHEET();
|
||||
case LIB_PIN_T: return new LIB_PIN( &m_symbol );
|
||||
case SCH_PIN_T: return new SCH_PIN( &m_symbol );
|
||||
|
||||
case SCHEMATIC_T:
|
||||
case SCH_PIN_T:
|
||||
case LIB_SYMBOL_T: return nullptr;
|
||||
|
||||
default:
|
||||
|
|
|
@ -30,7 +30,8 @@
|
|||
|
||||
// Code under test
|
||||
#include <sch_shape.h>
|
||||
#include <lib_pin.h>
|
||||
#include <sch_pin.h>
|
||||
#include <lib_symbol.h>
|
||||
|
||||
#include "lib_field_test_utils.h"
|
||||
|
||||
|
@ -425,9 +426,9 @@ BOOST_AUTO_TEST_CASE( Compare )
|
|||
BOOST_CHECK( m_part_no_data.Compare( testPart, SCH_ITEM::COMPARE_FLAGS::EQUALITY ) > 0 );
|
||||
m_part_no_data.RemoveDrawItem( &m_part_no_data.GetDrawItems()[SCH_SHAPE_T].front() );
|
||||
testPart.RemoveDrawItem( &testPart.GetDrawItems()[SCH_SHAPE_T].front() );
|
||||
m_part_no_data.AddDrawItem( new LIB_PIN( &m_part_no_data ) );
|
||||
m_part_no_data.AddDrawItem( new SCH_PIN( &m_part_no_data ) );
|
||||
BOOST_CHECK( m_part_no_data.Compare( testPart, SCH_ITEM::COMPARE_FLAGS::EQUALITY ) > 0 );
|
||||
m_part_no_data.RemoveDrawItem( &m_part_no_data.GetDrawItems()[LIB_PIN_T].front() );
|
||||
m_part_no_data.RemoveDrawItem( &m_part_no_data.GetDrawItems()[SCH_PIN_T].front() );
|
||||
|
||||
// Footprint filter array comparison tests.
|
||||
wxArrayString footPrintFilters;
|
||||
|
@ -529,7 +530,7 @@ BOOST_AUTO_TEST_CASE( GetUnitItems )
|
|||
BOOST_CHECK( m_part_no_data.GetUnitDrawItems( 1, 1 ).size() == 0 );
|
||||
|
||||
// A single unique unit with 1 pin common to all units and all body styles.
|
||||
LIB_PIN* pin1 = new LIB_PIN( &m_part_no_data );
|
||||
SCH_PIN* pin1 = new SCH_PIN( &m_part_no_data );
|
||||
m_part_no_data.AddDrawItem( pin1 );
|
||||
BOOST_CHECK( m_part_no_data.GetUnitDrawItems( 0, 0 ).size() == 1 );
|
||||
|
||||
|
@ -543,7 +544,7 @@ BOOST_AUTO_TEST_CASE( GetUnitItems )
|
|||
|
||||
// Two unique units with pin 1 assigned to unit 1 and body style 1 and pin 2 assigned to
|
||||
// unit 2 and body style 1.
|
||||
LIB_PIN* pin2 = new LIB_PIN( &m_part_no_data );
|
||||
SCH_PIN* pin2 = new SCH_PIN( &m_part_no_data );
|
||||
m_part_no_data.SetUnitCount( 2 );
|
||||
pin2->SetUnit( 2 );
|
||||
pin2->SetBodyStyle( 2 );
|
||||
|
@ -571,7 +572,7 @@ BOOST_AUTO_TEST_CASE( GetUnitDrawItems )
|
|||
BOOST_CHECK( m_part_no_data.GetUnitDrawItems().size() == 0 );
|
||||
|
||||
// A single unique unit with 1 pin common to all units and all body styles.
|
||||
LIB_PIN* pin1 = new LIB_PIN( &m_part_no_data );
|
||||
SCH_PIN* pin1 = new SCH_PIN( &m_part_no_data );
|
||||
pin1->SetNumber( "1" );
|
||||
m_part_no_data.AddDrawItem( pin1 );
|
||||
std::vector<struct LIB_SYMBOL_UNIT> units = m_part_no_data.GetUnitDrawItems();
|
||||
|
@ -679,7 +680,7 @@ BOOST_AUTO_TEST_CASE( CopyConstructor )
|
|||
BOOST_AUTO_TEST_CASE( IsPowerTest )
|
||||
{
|
||||
std::unique_ptr<LIB_SYMBOL> symbol = std::make_unique<LIB_SYMBOL>( "power" );
|
||||
LIB_PIN* pin = new LIB_PIN( symbol.get() );
|
||||
SCH_PIN* pin = new SCH_PIN( symbol.get() );
|
||||
pin->SetNumber( "1" );
|
||||
pin->SetType( ELECTRICAL_PINTYPE::PT_POWER_IN );
|
||||
pin->SetVisible( false );
|
||||
|
|
|
@ -36,7 +36,7 @@ public:
|
|||
{
|
||||
m_parent_part = new LIB_SYMBOL( "parent_part", nullptr );
|
||||
|
||||
m_lib_pin = new LIB_PIN( m_parent_part );
|
||||
m_lib_pin = new SCH_PIN( m_parent_part );
|
||||
m_parent_part->AddDrawItem( m_lib_pin );
|
||||
|
||||
// give the pin some kind of data we can use to test
|
||||
|
@ -61,7 +61,7 @@ public:
|
|||
}
|
||||
|
||||
LIB_SYMBOL* m_parent_part;
|
||||
LIB_PIN* m_lib_pin;
|
||||
SCH_PIN* m_lib_pin;
|
||||
|
||||
SCH_SYMBOL* m_parent_symbol;
|
||||
SCH_PIN* m_sch_pin; // owned by m_parent_symbol, not us
|
||||
|
|
|
@ -23,7 +23,8 @@
|
|||
|
||||
#include <qa_utils/wx_utils/unit_test_utils.h>
|
||||
#include <sim/sim_model.h>
|
||||
#include <lib_pin.h>
|
||||
#include <sch_pin.h>
|
||||
#include <lib_symbol.h>
|
||||
|
||||
class TEST_SIM_MODEL_INFERENCE
|
||||
{
|
||||
|
@ -82,8 +83,8 @@ BOOST_AUTO_TEST_CASE( InferPassiveValues )
|
|||
};
|
||||
|
||||
std::unique_ptr<LIB_SYMBOL> symbol = std::make_unique<LIB_SYMBOL>( "symbol", nullptr );
|
||||
symbol->AddDrawItem( new LIB_PIN( symbol.get() ) );
|
||||
symbol->AddDrawItem( new LIB_PIN( symbol.get() ) );
|
||||
symbol->AddDrawItem( new SCH_PIN( symbol.get() ) );
|
||||
symbol->AddDrawItem( new SCH_PIN( symbol.get() ) );
|
||||
|
||||
wxString deviceType;
|
||||
wxString modelType;
|
||||
|
|
Loading…
Reference in New Issue