Convert enums inside eeschema and the symbol editor to be scoped

Scope: NETLIST_ITEM, CONNECTION_TYPE, ELECTRICAL_PINTYPE,
       NET_CONNECTION, NETLIST_ITEM, GRAPHIC_PINSHAPE

Note, the pin type enum had PT_ added to the front to prevent
shadowing of the INPUT symbol on msys2 (see discussion at
c17c9960d8)
This commit is contained in:
Mark Roszko 2020-01-18 20:51:28 +00:00 committed by Ian McInerney
parent d714773c22
commit 70908043a3
33 changed files with 662 additions and 698 deletions

View File

@ -220,7 +220,7 @@ std::vector<SCH_ITEM*> CONNECTION_SUBGRAPH::GetBusLabels() const
auto label_conn = item->Connection( m_sheet );
// Only consider bus vectors
if( label_conn->Type() == CONNECTION_BUS )
if( label_conn->Type() == CONNECTION_TYPE::BUS )
labels.push_back( item );
}
default: break;
@ -496,22 +496,23 @@ void CONNECTION_GRAPH::updateItemConnectivity( SCH_SHEET_PATH aSheet,
switch( item->Type() )
{
case SCH_LINE_T:
conn->SetType( item->GetLayer() == LAYER_BUS ? CONNECTION_BUS : CONNECTION_NET );
conn->SetType( item->GetLayer() == LAYER_BUS ? CONNECTION_TYPE::BUS :
CONNECTION_TYPE::NET );
break;
case SCH_BUS_BUS_ENTRY_T:
conn->SetType( CONNECTION_BUS );
conn->SetType( CONNECTION_TYPE::BUS );
// clean previous (old) links:
static_cast<SCH_BUS_BUS_ENTRY*>( item )->m_connected_bus_items[0] = nullptr;
static_cast<SCH_BUS_BUS_ENTRY*>( item )->m_connected_bus_items[1] = nullptr;
break;
case SCH_PIN_T:
conn->SetType( CONNECTION_NET );
conn->SetType( CONNECTION_TYPE::NET );
break;
case SCH_BUS_WIRE_ENTRY_T:
conn->SetType( CONNECTION_NET );
conn->SetType( CONNECTION_TYPE::NET );
// clean previous (old) link:
static_cast<SCH_BUS_WIRE_ENTRY*>( item )->m_connected_bus_item = nullptr;
break;
@ -778,7 +779,7 @@ void CONNECTION_GRAPH::buildConnectionGraph()
{
auto pin = static_cast<SCH_PIN*>( item );
if( pin->GetType() == PIN_NC )
if( pin->GetType() == ELECTRICAL_PINTYPE::PT_NC )
subgraph->m_no_connect = item;
break;
@ -1695,7 +1696,7 @@ SCH_CONNECTION* CONNECTION_GRAPH::matchBusMember(
SCH_CONNECTION* match = nullptr;
if( aBusConnection->Type() == CONNECTION_BUS )
if( aBusConnection->Type() == CONNECTION_TYPE::BUS )
{
// Vector bus: compare against index, because we allow the name
// to be different
@ -1717,7 +1718,7 @@ SCH_CONNECTION* CONNECTION_GRAPH::matchBusMember(
// Vector inside group: compare names, because for bus groups
// we expect the naming to be consistent across all usages
// TODO(JE) explain this in the docs
if( c->Type() == CONNECTION_BUS )
if( c->Type() == CONNECTION_TYPE::BUS )
{
for( const auto& bus_member : c->Members() )
{
@ -2057,7 +2058,7 @@ bool CONNECTION_GRAPH::ercCheckBusToBusEntryConflicts( const CONNECTION_SUBGRAPH
for( const auto& member : bus_wire->Connection( sheet )->Members() )
{
if( member->Type() == CONNECTION_BUS )
if( member->Type() == CONNECTION_TYPE::BUS )
{
for( const auto& sub_member : member->Members() )
if( sub_member->Name( true ) == test_name )
@ -2231,7 +2232,7 @@ bool CONNECTION_GRAPH::ercCheckNoConnects( const CONNECTION_SUBGRAPH* aSubgraph,
}
}
if( pin && !has_other_connections && pin->GetType() != PIN_NC )
if( pin && !has_other_connections && pin->GetType() != ELECTRICAL_PINTYPE::PT_NC )
{
if( aCreateMarkers )
{

View File

@ -48,8 +48,8 @@
#include <id.h>
extern int DiagErc[PINTYPE_COUNT][PINTYPE_COUNT];
extern int DefaultDiagErc[PINTYPE_COUNT][PINTYPE_COUNT];
extern int DiagErc[ELECTRICAL_PINTYPES_TOTAL][ELECTRICAL_PINTYPES_TOTAL];
extern int DefaultDiagErc[ELECTRICAL_PINTYPES_TOTAL][ELECTRICAL_PINTYPES_TOTAL];
bool DIALOG_ERC::m_diagErcTableInit = false; // saved only for the current session
@ -59,7 +59,7 @@ bool DIALOG_ERC::m_diagErcTableInit = false; // saved only for the curren
BEGIN_EVENT_TABLE( DIALOG_ERC, DIALOG_ERC_BASE )
EVT_COMMAND_RANGE( ID_MATRIX_0, ID_MATRIX_0 + ( PINTYPE_COUNT * PINTYPE_COUNT ) - 1,
EVT_COMMAND_RANGE( ID_MATRIX_0, ID_MATRIX_0 + ( ELECTRICAL_PINTYPES_TOTAL * ELECTRICAL_PINTYPES_TOTAL ) - 1,
wxEVT_COMMAND_BUTTON_CLICKED, DIALOG_ERC::ChangeErrorLevel )
END_EVENT_TABLE()
@ -339,7 +339,7 @@ void DIALOG_ERC::ReBuildMatrixPanel()
std::vector<wxStaticText*> labels;
// Print row labels
for( int ii = 0; ii < PINTYPE_COUNT; ii++ )
for( int ii = 0; ii < ELECTRICAL_PINTYPES_TOTAL; ii++ )
{
int y = pos.y + (ii * bitmap_size.y);
text = new wxStaticText( m_matrixPanel, -1, CommentERC_H[ii],
@ -351,7 +351,7 @@ void DIALOG_ERC::ReBuildMatrixPanel()
}
// Right-align
for( int ii = 0; ii < PINTYPE_COUNT; ii++ )
for( int ii = 0; ii < ELECTRICAL_PINTYPES_TOTAL; ii++ )
{
wxPoint labelPos = labels[ ii ]->GetPosition();
labelPos.x = pos.x - labels[ ii ]->GetRect().GetWidth();
@ -363,7 +363,7 @@ void DIALOG_ERC::ReBuildMatrixPanel()
else
pos = m_buttonList[0][0]->GetPosition();
for( int ii = 0; ii < PINTYPE_COUNT; ii++ )
for( int ii = 0; ii < ELECTRICAL_PINTYPES_TOTAL; ii++ )
{
int y = pos.y + (ii * bitmap_size.y);
@ -381,7 +381,7 @@ void DIALOG_ERC::ReBuildMatrixPanel()
text = new wxStaticText( m_matrixPanel, -1, CommentERC_V[ii], txtpos );
}
int event_id = ID_MATRIX_0 + ii + ( jj * PINTYPE_COUNT );
int event_id = ID_MATRIX_0 + ii + ( jj * ELECTRICAL_PINTYPES_TOTAL );
BITMAP_DEF bitmap_butt = erc_green_xpm;
delete m_buttonList[ii][jj];
@ -464,8 +464,8 @@ void DIALOG_ERC::ChangeErrorLevel( wxCommandEvent& event )
{
int id = event.GetId();
int ii = id - ID_MATRIX_0;
int x = ii / PINTYPE_COUNT;
int y = ii % PINTYPE_COUNT;
int x = ii / ELECTRICAL_PINTYPES_TOTAL;
int y = ii % ELECTRICAL_PINTYPES_TOTAL;
wxBitmapButton* butt = (wxBitmapButton*) event.GetEventObject();
int level = ( DiagErc[y][x] + 1 ) % 3;
@ -550,18 +550,18 @@ void DIALOG_ERC::TestErc( REPORTER& aReporter )
switch( item->m_Type )
{
// These items do not create erc problems
case NET_ITEM_UNSPECIFIED:
case NET_SEGMENT:
case NET_BUS:
case NET_JUNCTION:
case NET_LABEL:
case NET_BUSLABELMEMBER:
case NET_PINLABEL:
case NET_GLOBBUSLABELMEMBER:
case NETLIST_ITEM::ITEM_UNSPECIFIED:
case NETLIST_ITEM::SEGMENT:
case NETLIST_ITEM::BUS:
case NETLIST_ITEM::JUNCTION:
case NETLIST_ITEM::LABEL:
case NETLIST_ITEM::BUSLABELMEMBER:
case NETLIST_ITEM::PINLABEL:
case NETLIST_ITEM::GLOBBUSLABELMEMBER:
break;
// TODO(JE) Port this to the new system
case NET_PIN:
case NETLIST_ITEM::PIN:
{
// Check if this pin has appeared before on a different net
if( item->m_Link )

View File

@ -41,7 +41,7 @@ class DIALOG_ERC : public DIALOG_ERC_BASE
private:
SCH_EDIT_FRAME* m_parent;
wxBitmapButton* m_buttonList[PINTYPE_COUNT][PINTYPE_COUNT];
wxBitmapButton* m_buttonList[ELECTRICAL_PINTYPES_TOTAL][ELECTRICAL_PINTYPES_TOTAL];
bool m_initialized;
const SCH_MARKER* m_lastMarkerFound;
static bool m_diagErcTableInit; // go to true after DiagErc init

View File

@ -117,10 +117,10 @@ public:
val = pin->GetName();
break;
case COL_TYPE:
val = g_typeNames[ pin->GetType() ];
val = g_typeNames[static_cast<int>( pin->GetType() )];
break;
case COL_SHAPE:
val = g_shapeNames[ pin->GetShape() ];
val = g_shapeNames[static_cast<int>( pin->GetShape() )];
break;
case COL_ORIENTATION:
if( LIB_PIN::GetOrientationIndex( pin->GetOrientation() ) >= 0 )
@ -397,15 +397,15 @@ DIALOG_LIB_EDIT_PIN_TABLE::DIALOG_LIB_EDIT_PIN_TABLE( LIB_EDIT_FRAME* parent, LI
if( g_typeNames.empty())
{
for( unsigned i = 0; i < PINTYPE_COUNT; ++i )
for( unsigned i = 0; i < ELECTRICAL_PINTYPES_TOTAL; ++i )
g_typeIcons.push_back( GetBitmap( static_cast<ELECTRICAL_PINTYPE>( i ) ) );
for( unsigned i = 0; i < PINTYPE_COUNT; ++i )
for( unsigned i = 0; i < ELECTRICAL_PINTYPES_TOTAL; ++i )
g_typeNames.push_back( GetText( static_cast<ELECTRICAL_PINTYPE>( i ) ) );
g_typeNames.push_back( INDETERMINATE );
for( unsigned i = 0; i < PINSHAPE_COUNT; ++i )
for( unsigned i = 0; i < GRAPHIC_PINSHAPES_TOTAL; ++i )
g_shapeIcons.push_back( GetBitmap( static_cast<GRAPHIC_PINSHAPE>( i ) ) );
for( unsigned i = 0; i < PINSHAPE_COUNT; ++i )
for( unsigned i = 0; i < GRAPHIC_PINSHAPES_TOTAL; ++i )
g_shapeNames.push_back( GetText( static_cast<GRAPHIC_PINSHAPE>( i ) ) );
g_shapeNames.push_back( INDETERMINATE );

View File

@ -49,34 +49,17 @@
/*
* Electrical type of pins:
* PIN_INPUT = usual pin input: must be connected
* PIN_OUTPUT = usual output
* PIN_BIDI = input or output (like port for a microprocessor)
* PIN_TRISTATE = tris state bus pin
* PIN_PASSIVE = pin for passive components: must be connected, and can be
* connected to any pin
* PIN_UNSPECIFIED = unknown electrical properties: creates always a warning
* when connected
* PIN_POWER_IN = power input (GND, VCC for ICs). Must be connected to a power
* output.
* PIN_POWER_OUT = output of a regulator: intended to be connected to power
* input pins
* PIN_OPENCOLLECTOR = pin type open collector
* PIN_OPENEMITTER = pin type open emitter
* PIN_NC = not connected (must be left open)
*
* Minimal requirements:
* All pins *must* be connected (except PIN_NC).
* Minimal ERC requirements:
* All pins *must* be connected (except ELECTRICAL_PINTYPE::PT_NC).
* When a pin is not connected in schematic, the user must place a "non
* connected" symbol to this pin.
* This ensures a forgotten connection will be detected.
*/
/* Messages for conflicts :
* PIN_INPUT, PIN_OUTPUT, PIN_BIDI, PIN_TRISTATE, PIN_PASSIVE,
* PIN_UNSPECIFIED, PIN_POWER_IN, PIN_POWER_OUT, PIN_OPENCOLLECTOR,
* PIN_OPENEMITTER, PIN_NC
* ELECTRICAL_PINTYPE::PT_INPUT, ELECTRICAL_PINTYPE::PT_OUTPUT, ELECTRICAL_PINTYPE:PT_:BIDI, ELECTRICAL_PINTYPE::PT_TRISTATE, ELECTRICAL_PINTYPE::PT_PASSIVE,
* ELECTRICAL_PINTYPE::PT_UNSPECIFIED, ELECTRICAL_PINTYPE::PT_POWER_IN, ELECTRICAL_PINTYPE::PT_POWER_OUT, ELECTRICAL_PINTYPE::PT_OPENCOLLECTOR,
* ELECTRICAL_PINTYPE::PT_OPENEMITTER, ELECTRICAL_PINTYPE::PT_NC
* These messages are used to show the ERC matrix in ERC dialog
*/
@ -118,7 +101,7 @@ const wxString CommentERC_V[] =
* at start up: must be loaded by DefaultDiagErc
* Can be modified in dialog ERC
*/
int DiagErc[PINTYPE_COUNT][PINTYPE_COUNT];
int DiagErc[ELECTRICAL_PINTYPES_TOTAL][ELECTRICAL_PINTYPES_TOTAL];
/**
* Default Look up table which gives the ERC error level for a pair of connected pins
@ -127,7 +110,7 @@ int DiagErc[PINTYPE_COUNT][PINTYPE_COUNT];
* note also, to avoid inconsistancy:
* DefaultDiagErc[i][j] = DefaultDiagErc[j][i]
*/
int DefaultDiagErc[PINTYPE_COUNT][PINTYPE_COUNT] =
int DefaultDiagErc[ELECTRICAL_PINTYPES_TOTAL][ELECTRICAL_PINTYPES_TOTAL] =
{
/* I, O, Bi, 3S, Pas, UnS, PwrI, PwrO, OC, OE, NC */
/* I */ { OK, OK, OK, OK, OK, WAR, OK, OK, OK, OK, ERR },
@ -154,7 +137,7 @@ int DefaultDiagErc[PINTYPE_COUNT][PINTYPE_COUNT] =
* in net. Nets are OK when their final state is NET_NC or DRV. Nets with the state
* NOD have no valid source signal.
*/
static int MinimalReq[PINTYPE_COUNT][PINTYPE_COUNT] =
static int MinimalReq[ELECTRICAL_PINTYPES_TOTAL][ELECTRICAL_PINTYPES_TOTAL] =
{
/* In Out, Bi, 3S, Pas, UnS, PwrI,PwrO,OC, OE, NC */
/* In*/ { NOD, DRV, DRV, DRV, DRV, DRV, NOD, DRV, DRV, DRV, NPI },
@ -362,14 +345,14 @@ void Diagnose( NETLIST_OBJECT* aNetItemRef, NETLIST_OBJECT* aNetItemTst, int aMi
wxString cmp_ref( "?" );
if( aNetItemRef->m_Type == NET_PIN && aNetItemRef->m_Link )
if( aNetItemRef->m_Type == NETLIST_ITEM::PIN && aNetItemRef->m_Link )
cmp_ref = aNetItemRef->GetComponentParent()->GetRef( &aNetItemRef->m_SheetPath );
if( aNetItemTst == NULL )
{
if( aMinConn == NOD ) /* Nothing driving the net. */
{
if( aNetItemRef->m_Type == NET_PIN && aNetItemRef->m_Link )
if( aNetItemRef->m_Type == NETLIST_ITEM::PIN && aNetItemRef->m_Link )
cmp_ref = aNetItemRef->GetComponentParent()->GetRef(
&aNetItemRef->m_SheetPath );
@ -396,7 +379,7 @@ void Diagnose( NETLIST_OBJECT* aNetItemRef, NETLIST_OBJECT* aNetItemTst, int aMi
wxString alt_cmp( "?" );
if( aNetItemTst->m_Type == NET_PIN && aNetItemTst->m_Link )
if( aNetItemTst->m_Type == NETLIST_ITEM::PIN && aNetItemTst->m_Link )
alt_cmp = aNetItemTst->GetComponentParent()->GetRef( &aNetItemTst->m_SheetPath );
msg.Printf( _( "Pin %s (%s) of component %s is connected to " ),
@ -425,7 +408,7 @@ void TestOthersItems( NETLIST_OBJECT_LIST* aList, unsigned aNetItemRef, unsigned
ELECTRICAL_PINTYPE ref_elect_type = aList->GetItem( aNetItemRef )->m_ElectricalPinType;
int local_minconn = NOC;
if( ref_elect_type == PIN_NC )
if( ref_elect_type == ELECTRICAL_PINTYPE::PT_NC )
local_minconn = NPI;
/* Test pins connected to NetItemRef */
@ -445,8 +428,7 @@ void TestOthersItems( NETLIST_OBJECT_LIST* aList, unsigned aNetItemRef, unsigned
/* Not connected or not driven pin. */
bool seterr = true;
if( local_minconn == NOC &&
aList->GetItemType( aNetItemRef ) == NET_PIN )
if( local_minconn == NOC && aList->GetItemType( aNetItemRef ) == NETLIST_ITEM::PIN )
{
/* This pin is not connected: for multiple part per
* package, and duplicated pin,
@ -458,7 +440,7 @@ void TestOthersItems( NETLIST_OBJECT_LIST* aList, unsigned aNetItemRef, unsigned
*/
for( unsigned duplicate = 0; duplicate < aList->size(); duplicate++ )
{
if( aList->GetItemType( duplicate ) != NET_PIN )
if( aList->GetItemType( duplicate ) != NETLIST_ITEM::PIN )
continue;
if( duplicate == aNetItemRef )
@ -500,44 +482,46 @@ void TestOthersItems( NETLIST_OBJECT_LIST* aList, unsigned aNetItemRef, unsigned
switch( aList->GetItemType( netItemTst ) )
{
case NET_ITEM_UNSPECIFIED:
case NET_SEGMENT:
case NET_BUS:
case NET_JUNCTION:
case NET_LABEL:
case NET_HIERLABEL:
case NET_BUSLABELMEMBER:
case NET_HIERBUSLABELMEMBER:
case NET_SHEETBUSLABELMEMBER:
case NET_SHEETLABEL:
case NET_GLOBLABEL:
case NET_GLOBBUSLABELMEMBER:
case NET_PINLABEL:
case NETLIST_ITEM::ITEM_UNSPECIFIED:
case NETLIST_ITEM::SEGMENT:
case NETLIST_ITEM::BUS:
case NETLIST_ITEM::JUNCTION:
case NETLIST_ITEM::LABEL:
case NETLIST_ITEM::HIERLABEL:
case NETLIST_ITEM::BUSLABELMEMBER:
case NETLIST_ITEM::HIERBUSLABELMEMBER:
case NETLIST_ITEM::SHEETBUSLABELMEMBER:
case NETLIST_ITEM::SHEETLABEL:
case NETLIST_ITEM::GLOBLABEL:
case NETLIST_ITEM::GLOBBUSLABELMEMBER:
case NETLIST_ITEM::PINLABEL:
break;
case NET_NOCONNECT:
case NETLIST_ITEM::NOCONNECT:
local_minconn = std::max( NET_NC, local_minconn );
break;
case NET_PIN:
case NETLIST_ITEM::PIN:
jj = aList->GetItem( netItemTst )->m_ElectricalPinType;
local_minconn = std::max( MinimalReq[ref_elect_type][jj], local_minconn );
local_minconn = std::max(
MinimalReq[static_cast<int>( ref_elect_type )][static_cast<int>( jj )],
local_minconn );
if( netItemTst <= aNetItemRef )
break;
if( erc == OK )
{
erc = DiagErc[ref_elect_type][jj];
erc = DiagErc[static_cast<int>( ref_elect_type )][static_cast<int>( jj )];
if( erc != OK )
{
if( aList->GetConnectionType( netItemTst ) == UNCONNECTED )
if( aList->GetConnectionType( netItemTst ) == NET_CONNECTION::UNCONNECTED )
{
Diagnose( aList->GetItem( aNetItemRef ),
aList->GetItem( netItemTst ),
0, erc );
aList->SetConnectionType( netItemTst, NOCONNECT_SYMBOL_PRESENT );
Diagnose( aList->GetItem( aNetItemRef ), aList->GetItem( netItemTst ), 0,
erc );
aList->SetConnectionType(
netItemTst, NET_CONNECTION::NOCONNECT_SYMBOL_PRESENT );
}
}
}
@ -559,7 +543,7 @@ int NETLIST_OBJECT_LIST::CountPinsInNet( unsigned aNetStart )
if( curr_net != GetItemNet( item ) ) // End of net
break;
if( GetItemType( item ) == NET_PIN )
if( GetItemType( item ) == NETLIST_ITEM::PIN )
count++;
}
@ -712,20 +696,20 @@ void NETLIST_OBJECT_LIST::TestforSimilarLabels()
{
switch( GetItemType( netItem ) )
{
case NET_LABEL:
case NET_BUSLABELMEMBER:
case NET_PINLABEL:
case NET_GLOBBUSLABELMEMBER:
case NET_HIERLABEL:
case NET_HIERBUSLABELMEMBER:
case NET_GLOBLABEL:
case NETLIST_ITEM::LABEL:
case NETLIST_ITEM::BUSLABELMEMBER:
case NETLIST_ITEM::PINLABEL:
case NETLIST_ITEM::GLOBBUSLABELMEMBER:
case NETLIST_ITEM::HIERLABEL:
case NETLIST_ITEM::HIERBUSLABELMEMBER:
case NETLIST_ITEM::GLOBLABEL:
// add this label in lists
uniqueLabelList.insert( GetItem( netItem ) );
fullLabelList.push_back( GetItem( netItem ) );
break;
case NET_SHEETLABEL:
case NET_SHEETBUSLABELMEMBER:
case NETLIST_ITEM::SHEETLABEL:
case NETLIST_ITEM::SHEETBUSLABELMEMBER:
default:
break;
}

View File

@ -77,9 +77,6 @@ static const BITMAP_DEF iconsPinsOrientations[] =
const wxString LIB_PIN::GetCanonicalElectricalTypeName( ELECTRICAL_PINTYPE aType )
{
if( aType < 0 || aType >= (int) PINTYPE_COUNT )
return wxT( "???" );
// These strings are the canonical name of the electrictal type
// Not translated, no space in name, only ASCII chars.
// to use when the string name must be known and well defined
@ -99,7 +96,7 @@ const wxString LIB_PIN::GetCanonicalElectricalTypeName( ELECTRICAL_PINTYPE aType
wxT( "NotConnected" )
};
return msgPinElectricType[ aType ];
return msgPinElectricType[static_cast<int>( aType )];
}
@ -146,13 +143,12 @@ static int ExternalPinDecoSize( const LIB_PIN &aPin )
return aPin.GetNumberTextSize() / 2;
}
LIB_PIN::LIB_PIN( LIB_PART* aParent ) :
LIB_ITEM( LIB_PIN_T, aParent ),
m_shape( PINSHAPE_LINE )
LIB_PIN::LIB_PIN( LIB_PART* aParent )
: LIB_ITEM( LIB_PIN_T, aParent ), m_shape( GRAPHIC_PINSHAPE::LINE )
{
m_length = LIB_EDIT_FRAME::GetDefaultPinLength();
m_orientation = PIN_RIGHT; // Pin orient: Up, Down, Left, Right
m_type = PIN_UNSPECIFIED; // electrical type of pin
m_type = ELECTRICAL_PINTYPE::PT_UNSPECIFIED; // electrical type of pin
m_attributes = 0; // bit 0 != 0: pin invisible
m_numTextSize = LIB_EDIT_FRAME::GetPinNumDefaultSize();
m_nameTextSize = LIB_EDIT_FRAME::GetPinNameDefaultSize();
@ -299,8 +295,6 @@ void LIB_PIN::SetOrientation( int orientation, bool aTestOtherPins )
void LIB_PIN::SetShape( GRAPHIC_PINSHAPE aShape )
{
assert( aShape >= 0 && aShape < int( PINSHAPE_COUNT ) );
if( m_shape != aShape )
{
m_shape = aShape;
@ -328,14 +322,6 @@ void LIB_PIN::SetShape( GRAPHIC_PINSHAPE aShape )
void LIB_PIN::SetType( ELECTRICAL_PINTYPE aType, bool aTestOtherPins )
{
assert( aType >= 0 && aType < (int)PINTYPE_COUNT );
if( aType < PIN_INPUT )
aType = PIN_INPUT;
if( aType >= (int)PINTYPE_COUNT )
aType = PIN_NC;
if( m_type != aType )
{
m_type = aType;
@ -602,7 +588,7 @@ void LIB_PIN::PrintPinSymbol( wxDC* aDC, const wxPoint& aPos, int aOrient )
case PIN_RIGHT: x1 = posX + len; MapX1 = -1; break;
}
if( m_shape == PINSHAPE_INVERTED || m_shape == PINSHAPE_INVERTED_CLOCK )
if( m_shape == GRAPHIC_PINSHAPE::INVERTED || m_shape == GRAPHIC_PINSHAPE::INVERTED_CLOCK )
{
const int radius = ExternalPinDecoSize( *this );
GRCircle( nullptr, aDC, MapX1 * radius + x1, MapY1 * radius + y1, radius, width, color );
@ -617,8 +603,9 @@ void LIB_PIN::PrintPinSymbol( wxDC* aDC, const wxPoint& aPos, int aOrient )
}
// Draw the clock shape (>)inside the symbol
if( m_shape == PINSHAPE_CLOCK || m_shape == PINSHAPE_INVERTED_CLOCK ||
m_shape == PINSHAPE_FALLING_EDGE_CLOCK || m_shape == PINSHAPE_CLOCK_LOW )
if( m_shape == GRAPHIC_PINSHAPE::CLOCK || m_shape == GRAPHIC_PINSHAPE::INVERTED_CLOCK
|| m_shape == GRAPHIC_PINSHAPE::FALLING_EDGE_CLOCK
|| m_shape == GRAPHIC_PINSHAPE::CLOCK_LOW )
{
const int clock_size = InternalPinDecoSize( *this );
if( MapY1 == 0 ) /* MapX1 = +- 1 */
@ -636,8 +623,8 @@ void LIB_PIN::PrintPinSymbol( wxDC* aDC, const wxPoint& aPos, int aOrient )
}
// Draw the active low (or H to L active transition)
if( m_shape == PINSHAPE_INPUT_LOW ||
m_shape == PINSHAPE_FALLING_EDGE_CLOCK || m_shape == PINSHAPE_CLOCK_LOW )
if( m_shape == GRAPHIC_PINSHAPE::INPUT_LOW || m_shape == GRAPHIC_PINSHAPE::FALLING_EDGE_CLOCK
|| m_shape == GRAPHIC_PINSHAPE::CLOCK_LOW )
{
const int deco_size = ExternalPinDecoSize( *this );
if( MapY1 == 0 ) /* MapX1 = +- 1 */
@ -654,7 +641,7 @@ void LIB_PIN::PrintPinSymbol( wxDC* aDC, const wxPoint& aPos, int aOrient )
}
}
if( m_shape == PINSHAPE_OUTPUT_LOW ) /* IEEE symbol "Active Low Output" */
if( m_shape == GRAPHIC_PINSHAPE::OUTPUT_LOW ) /* IEEE symbol "Active Low Output" */
{
const int deco_size = ExternalPinDecoSize( *this );
if( MapY1 == 0 ) /* MapX1 = +- 1 */
@ -668,7 +655,7 @@ void LIB_PIN::PrintPinSymbol( wxDC* aDC, const wxPoint& aPos, int aOrient )
GRLineTo( nullptr, aDC, x1, y1 + MapY1 * deco_size * 2, width, color );
}
}
else if( m_shape == PINSHAPE_NONLOGIC ) /* NonLogic pin symbol */
else if( m_shape == GRAPHIC_PINSHAPE::NONLOGIC ) /* NonLogic pin symbol */
{
const int deco_size = ExternalPinDecoSize( *this );
GRMoveTo( x1 - (MapX1 + MapY1) * deco_size, y1 - (MapY1 - MapX1) * deco_size );
@ -679,7 +666,7 @@ void LIB_PIN::PrintPinSymbol( wxDC* aDC, const wxPoint& aPos, int aOrient )
color );
}
if( m_type == PIN_NC ) // Draw a N.C. symbol
if( m_type == ELECTRICAL_PINTYPE::PT_NC ) // Draw a N.C. symbol
{
const int deco_size = TARGET_PIN_RADIUS;
GRLine( nullptr, aDC, posX - deco_size, posY - deco_size, posX + deco_size, posY + deco_size, width, color );
@ -897,7 +884,7 @@ void LIB_PIN::PlotSymbol( PLOTTER* aPlotter, const wxPoint& aPosition, int aOrie
case PIN_RIGHT: x1 = aPosition.x + m_length; MapX1 = -1; break;
}
if( m_shape == PINSHAPE_INVERTED || m_shape == PINSHAPE_INVERTED_CLOCK )
if( m_shape == GRAPHIC_PINSHAPE::INVERTED || m_shape == GRAPHIC_PINSHAPE::INVERTED_CLOCK )
{
const int radius = ExternalPinDecoSize( *this );
aPlotter->Circle( wxPoint( MapX1 * radius + x1, MapY1 * radius + y1 ),
@ -906,7 +893,7 @@ void LIB_PIN::PlotSymbol( PLOTTER* aPlotter, const wxPoint& aPosition, int aOrie
aPlotter->MoveTo( wxPoint( MapX1 * radius * 2 + x1, MapY1 * radius * 2 + y1 ) );
aPlotter->FinishTo( aPosition );
}
else if( m_shape == PINSHAPE_FALLING_EDGE_CLOCK )
else if( m_shape == GRAPHIC_PINSHAPE::FALLING_EDGE_CLOCK )
{
const int deco_size = InternalPinDecoSize( *this );
if( MapY1 == 0 ) /* MapX1 = +- 1 */
@ -931,8 +918,8 @@ void LIB_PIN::PlotSymbol( PLOTTER* aPlotter, const wxPoint& aPosition, int aOrie
aPlotter->FinishTo( aPosition );
}
if( m_shape == PINSHAPE_CLOCK || m_shape == PINSHAPE_INVERTED_CLOCK ||
m_shape == PINSHAPE_CLOCK_LOW )
if( m_shape == GRAPHIC_PINSHAPE::CLOCK || m_shape == GRAPHIC_PINSHAPE::INVERTED_CLOCK
|| m_shape == GRAPHIC_PINSHAPE::CLOCK_LOW )
{
const int deco_size = InternalPinDecoSize( *this );
if( MapY1 == 0 ) /* MapX1 = +- 1 */
@ -949,7 +936,8 @@ void LIB_PIN::PlotSymbol( PLOTTER* aPlotter, const wxPoint& aPosition, int aOrie
}
}
if( m_shape == PINSHAPE_INPUT_LOW || m_shape == PINSHAPE_CLOCK_LOW ) /* IEEE symbol "Active Low Input" */
if( m_shape == GRAPHIC_PINSHAPE::INPUT_LOW
|| m_shape == GRAPHIC_PINSHAPE::CLOCK_LOW ) /* IEEE symbol "Active Low Input" */
{
const int deco_size = ExternalPinDecoSize( *this );
@ -968,7 +956,7 @@ void LIB_PIN::PlotSymbol( PLOTTER* aPlotter, const wxPoint& aPosition, int aOrie
}
if( m_shape == PINSHAPE_OUTPUT_LOW ) /* IEEE symbol "Active Low Output" */
if( m_shape == GRAPHIC_PINSHAPE::OUTPUT_LOW ) /* IEEE symbol "Active Low Output" */
{
const int symbol_size = ExternalPinDecoSize( *this );
@ -983,7 +971,7 @@ void LIB_PIN::PlotSymbol( PLOTTER* aPlotter, const wxPoint& aPosition, int aOrie
aPlotter->FinishTo( wxPoint( x1, y1 + MapY1 * symbol_size * 2 ) );
}
}
else if( m_shape == PINSHAPE_NONLOGIC ) /* NonLogic pin symbol */
else if( m_shape == GRAPHIC_PINSHAPE::NONLOGIC ) /* NonLogic pin symbol */
{
const int deco_size = ExternalPinDecoSize( *this );
aPlotter->MoveTo( wxPoint( x1 - (MapX1 + MapY1) * deco_size, y1 - (MapY1 - MapX1) * deco_size ) );
@ -991,7 +979,7 @@ void LIB_PIN::PlotSymbol( PLOTTER* aPlotter, const wxPoint& aPosition, int aOrie
aPlotter->MoveTo( wxPoint( x1 - (MapX1 - MapY1) * deco_size, y1 - (MapY1 + MapX1) * deco_size ) );
aPlotter->FinishTo( wxPoint( x1 + (MapX1 - MapY1) * deco_size, y1 + (MapY1 + MapX1) * deco_size ) );
}
if( m_type == PIN_NC ) // Draw a N.C. symbol
if( m_type == ELECTRICAL_PINTYPE::PT_NC ) // Draw a N.C. symbol
{
const int deco_size = TARGET_PIN_RADIUS;
const int ex1 = aPosition.x;
@ -1477,7 +1465,7 @@ const EDA_RECT LIB_PIN::GetBoundingBox( bool aIncludeInvisibles ) const
// Actual text height is bigger than text size
int numberTextHeight = showNum ? KiROUND( m_numTextSize * 1.1 ) : 0;
if( m_shape == PINSHAPE_INVERTED || m_shape == PINSHAPE_INVERTED_CLOCK )
if( m_shape == GRAPHIC_PINSHAPE::INVERTED || m_shape == GRAPHIC_PINSHAPE::INVERTED_CLOCK )
minsizeV = std::max( TARGET_PIN_RADIUS, ExternalPinDecoSize( *this ) );
// calculate top left corner position

View File

@ -346,8 +346,10 @@ public:
* Return whether this pin forms an implicit power connection: i.e., is hidden
* and of type POWER_IN.
*/
bool IsPowerConnection() const {
return GetType() == PIN_POWER_IN && ( !IsVisible() || (LIB_PART*) GetParent()->IsPower() );
bool IsPowerConnection() const
{
return GetType() == ELECTRICAL_PINTYPE::PT_POWER_IN
&& ( !IsVisible() || (LIB_PART*) GetParent()->IsPower() );
}
int GetPenSize() const override;

View File

@ -81,7 +81,7 @@ void NETLIST_EXPORTER::sprintPinNetName( wxString& aResult,
// caller's loop.
aResult.Empty();
if( netcode != 0 && aPin->GetConnectionType() == PAD_CONNECT )
if( netcode != 0 && aPin->GetConnectionType() == NET_CONNECTION::PAD_CONNECT )
{
if( aUseNetcodeAsNetName )
{
@ -217,7 +217,7 @@ bool NETLIST_EXPORTER::addPinToComponentPinList( SCH_COMPONENT* aComponent,
{
NETLIST_OBJECT* pin = m_masterList->GetItem( ii );
if( pin->m_Type != NET_PIN )
if( pin->m_Type != NETLIST_ITEM::PIN )
continue;
if( pin->m_Link != aComponent )
@ -271,7 +271,8 @@ void NETLIST_EXPORTER::eraseDuplicatePins()
if( m_SortedComponentPinList[idxref]->m_PinNum != m_SortedComponentPinList[jj]->m_PinNum )
break;
if( m_SortedComponentPinList[idxref]->GetConnectionType() == PAD_CONNECT )
if( m_SortedComponentPinList[idxref]->GetConnectionType()
== NET_CONNECTION::PAD_CONNECT )
{
m_SortedComponentPinList[jj]->m_Flag = 1;
m_SortedComponentPinList[jj] = NULL;
@ -279,7 +280,8 @@ void NETLIST_EXPORTER::eraseDuplicatePins()
else /* the reference pin is not connected: remove this pin if the
* other pin is connected */
{
if( m_SortedComponentPinList[jj]->GetConnectionType() == PAD_CONNECT )
if( m_SortedComponentPinList[jj]->GetConnectionType()
== NET_CONNECTION::PAD_CONNECT )
{
m_SortedComponentPinList[idxref]->m_Flag = 1;
m_SortedComponentPinList[idxref] = NULL;

View File

@ -149,7 +149,7 @@ bool NETLIST_EXPORTER_CADSTAR::writeListOfNets( FILE* f )
}
if( nitem->m_Type != NET_PIN )
if( nitem->m_Type != NETLIST_ITEM::PIN )
continue;
if( nitem->m_Flag != 0 )

View File

@ -572,7 +572,7 @@ XNODE* NETLIST_EXPORTER_GENERIC::makeListOfNets( bool aUseGraph )
lastNetCode = netCode;
}
if( nitem->m_Type != NET_PIN )
if( nitem->m_Type != NETLIST_ITEM::PIN )
continue;
if( nitem->m_Flag != 0 ) // Redundant pin, skip it

View File

@ -40,52 +40,52 @@
#if defined(DEBUG)
#include <iostream>
const char* ShowType( NETLIST_ITEM_T aType )
const char* ShowType( NETLIST_ITEM aType )
{
const char* ret;
switch( aType )
{
case NET_SEGMENT:
case NETLIST_ITEM::SEGMENT:
ret = "segment"; break;
case NET_BUS:
case NETLIST_ITEM::BUS:
ret = "bus"; break;
case NET_JUNCTION:
case NETLIST_ITEM::JUNCTION:
ret = "junction"; break;
case NET_LABEL:
case NETLIST_ITEM::LABEL:
ret = "label"; break;
case NET_HIERLABEL:
case NETLIST_ITEM::HIERLABEL:
ret = "hierlabel"; break;
case NET_GLOBLABEL:
case NETLIST_ITEM::GLOBLABEL:
ret = "glabel"; break;
case NET_BUSLABELMEMBER:
case NETLIST_ITEM::BUSLABELMEMBER:
ret = "buslblmember"; break;
case NET_HIERBUSLABELMEMBER:
case NETLIST_ITEM::HIERBUSLABELMEMBER:
ret = "hierbuslblmember"; break;
case NET_GLOBBUSLABELMEMBER:
case NETLIST_ITEM::GLOBBUSLABELMEMBER:
ret = "gbuslblmember"; break;
case NET_SHEETBUSLABELMEMBER:
case NETLIST_ITEM::SHEETBUSLABELMEMBER:
ret = "sbuslblmember"; break;
case NET_SHEETLABEL:
case NETLIST_ITEM::SHEETLABEL:
ret = "sheetlabel"; break;
case NET_PINLABEL:
case NETLIST_ITEM::PINLABEL:
ret = "pinlabel"; break;
case NET_PIN:
case NETLIST_ITEM::PIN:
ret = "pin"; break;
case NET_NOCONNECT:
case NETLIST_ITEM::NOCONNECT:
ret = "noconnect"; break;
default:
@ -115,7 +115,7 @@ void NETLIST_OBJECT::Show( std::ostream& out, int ndx ) const
switch( m_Type )
{
case NET_PIN:
case NETLIST_ITEM::PIN:
/* GetRef() needs to be const
out << " <refOfComp>" << GetComponentParent()->GetRef(&m_SheetPath).mb_str()
<< "</refOfComp>\n";
@ -146,7 +146,7 @@ void NETLIST_OBJECT::Show( std::ostream& out, int ndx ) const
NETLIST_OBJECT::NETLIST_OBJECT()
{
m_Type = NET_ITEM_UNSPECIFIED; /* Type of this item (see NETLIST_ITEM_T enum) */
m_Type = NETLIST_ITEM::ITEM_UNSPECIFIED; /* Type of this item (see NETLIST_ITEM_T enum) */
m_Comp = NULL; /* Pointer on the library item that created this net object
* (the parent)*/
m_Link = NULL; /* For SCH_SHEET_PIN:
@ -155,17 +155,18 @@ NETLIST_OBJECT::NETLIST_OBJECT()
* contains this pin
*/
m_Flag = 0; /* flag used in calculations */
m_ElectricalPinType = PIN_INPUT; /* Has meaning only for Pins: electrical type of the pin
* used to detect conflicts between pins in ERC
*/
m_netCode = 0; /* net code for all items except BUS labels because a BUS
* label has as many net codes as bus members
*/
m_BusNetCode = 0; /* Used for BUS connections */
m_Member = 0; /* for labels type NET_BUSLABELMEMBER ( bus member created
m_Member = 0; /* for labels type NETLIST_ITEM::BUSLABELMEMBER ( bus member created
* from the BUS label ) member number
*/
m_ConnectionType = UNCONNECTED;
m_ConnectionType = NET_CONNECTION::UNCONNECTED;
m_ElectricalPinType =
ELECTRICAL_PINTYPE::PT_INPUT; /* Has meaning only for Pins: electrical type of the pin
* used to detect conflicts between pins in ERC
*/
m_netNameCandidate = NULL; /* a pointer to a NETLIST_OBJECT type label connected to this
* object used to give a name to the net
*/
@ -187,11 +188,10 @@ NETLIST_OBJECT::~NETLIST_OBJECT()
// return true if the object is a label of any type
bool NETLIST_OBJECT::IsLabelType() const
{
return m_Type == NET_LABEL
|| m_Type == NET_GLOBLABEL || m_Type == NET_HIERLABEL
|| m_Type == NET_BUSLABELMEMBER || m_Type == NET_GLOBBUSLABELMEMBER
|| m_Type == NET_HIERBUSLABELMEMBER
|| m_Type == NET_PINLABEL;
return m_Type == NETLIST_ITEM::LABEL || m_Type == NETLIST_ITEM::GLOBLABEL
|| m_Type == NETLIST_ITEM::HIERLABEL || m_Type == NETLIST_ITEM::BUSLABELMEMBER
|| m_Type == NETLIST_ITEM::GLOBBUSLABELMEMBER
|| m_Type == NETLIST_ITEM::HIERBUSLABELMEMBER || m_Type == NETLIST_ITEM::PINLABEL;
}
bool NETLIST_OBJECT::IsLabelConnected( NETLIST_OBJECT* aNetItem )
@ -199,18 +199,18 @@ bool NETLIST_OBJECT::IsLabelConnected( NETLIST_OBJECT* aNetItem )
if( aNetItem == this ) // Don't compare the same net list object.
return false;
int at = m_Type;
int bt = aNetItem->m_Type;
NETLIST_ITEM at = m_Type;
NETLIST_ITEM bt = aNetItem->m_Type;
if( ( at == NET_HIERLABEL || at == NET_HIERBUSLABELMEMBER )
&& ( bt == NET_SHEETLABEL || bt == NET_SHEETBUSLABELMEMBER ) )
if( ( at == NETLIST_ITEM::HIERLABEL || at == NETLIST_ITEM::HIERBUSLABELMEMBER )
&& ( bt == NETLIST_ITEM::SHEETLABEL || bt == NETLIST_ITEM::SHEETBUSLABELMEMBER ) )
{
if( m_SheetPath == aNetItem->m_SheetPathInclude )
{
return true; //connected!
}
}
else if( ( at == NET_GLOBLABEL ) && ( bt == NET_GLOBLABEL ) )
else if( ( at == NETLIST_ITEM::GLOBLABEL ) && ( bt == NETLIST_ITEM::GLOBLABEL ) )
{
if( m_Label == aNetItem->m_Label )
return true; //connected!
@ -226,14 +226,14 @@ void NETLIST_OBJECT::ConvertBusToNetListItems( NETLIST_OBJECT_LIST& aNetListItem
wxCHECK_RET( conn.IsBusLabel( m_Label ),
wxT( "<" ) + m_Label + wxT( "> is not a valid bus label." ) );
if( m_Type == NET_HIERLABEL )
m_Type = NET_HIERBUSLABELMEMBER;
else if( m_Type == NET_GLOBLABEL )
m_Type = NET_GLOBBUSLABELMEMBER;
else if( m_Type == NET_SHEETLABEL )
m_Type = NET_SHEETBUSLABELMEMBER;
else if( m_Type == NET_LABEL )
m_Type = NET_BUSLABELMEMBER;
if( m_Type == NETLIST_ITEM::HIERLABEL )
m_Type = NETLIST_ITEM::HIERBUSLABELMEMBER;
else if( m_Type == NETLIST_ITEM::GLOBLABEL )
m_Type = NETLIST_ITEM::GLOBBUSLABELMEMBER;
else if( m_Type == NETLIST_ITEM::SHEETLABEL )
m_Type = NETLIST_ITEM::SHEETBUSLABELMEMBER;
else if( m_Type == NETLIST_ITEM::LABEL )
m_Type = NETLIST_ITEM::BUSLABELMEMBER;
else
wxCHECK_RET( false, wxT( "Net list object type is not valid." ) );
@ -357,9 +357,8 @@ bool NETLIST_OBJECT::IsLabelGlobal() const
// return true if the object is a global label
// * a actual global label
// * a pin label coming from a invisible power pin
return ( m_Type == NET_PINLABEL ) ||
( m_Type == NET_GLOBLABEL ) ||
( m_Type == NET_GLOBBUSLABELMEMBER );
return ( m_Type == NETLIST_ITEM::PINLABEL ) || ( m_Type == NETLIST_ITEM::GLOBLABEL )
|| ( m_Type == NETLIST_ITEM::GLOBBUSLABELMEMBER );
}
@ -370,10 +369,10 @@ bool NETLIST_OBJECT::IsLabelBusMemberType() const
// They are labels with very specific properties, especially for connection
// between them: 2 bus label members can be connected only
// if they have the same member value.
return ( m_Type == NET_SHEETBUSLABELMEMBER ) ||
( m_Type == NET_BUSLABELMEMBER ) ||
( m_Type == NET_HIERBUSLABELMEMBER ) ||
( m_Type == NET_GLOBBUSLABELMEMBER );
return ( m_Type == NETLIST_ITEM::SHEETBUSLABELMEMBER )
|| ( m_Type == NETLIST_ITEM::BUSLABELMEMBER )
|| ( m_Type == NETLIST_ITEM::HIERBUSLABELMEMBER )
|| ( m_Type == NETLIST_ITEM::GLOBBUSLABELMEMBER );
}
@ -387,7 +386,7 @@ wxString NETLIST_OBJECT::GetNetName( bool adoptTimestamp ) const
wxString netName;
if( m_netNameCandidate->m_Type == NET_PIN )
if( m_netNameCandidate->m_Type == NETLIST_ITEM::PIN )
return GetShortNetName( adoptTimestamp );
if( !m_netNameCandidate->IsLabelGlobal() )
@ -413,7 +412,7 @@ wxString NETLIST_OBJECT::GetShortNetName( bool adoptTimestamp ) const
wxString netName;
if( m_netNameCandidate->m_Type == NET_PIN )
if( m_netNameCandidate->m_Type == NETLIST_ITEM::PIN )
{
SCH_COMPONENT* link = m_netNameCandidate->GetComponentParent();
if( link ) // Should be always true
@ -445,13 +444,13 @@ void NETLIST_OBJECT::SetNetNameCandidate( NETLIST_OBJECT* aCandidate )
{
switch( aCandidate->m_Type )
{
case NET_HIERLABEL:
case NET_LABEL:
case NET_PINLABEL:
case NET_GLOBLABEL:
case NET_GLOBBUSLABELMEMBER:
case NET_SHEETBUSLABELMEMBER:
case NET_PIN:
case NETLIST_ITEM::HIERLABEL:
case NETLIST_ITEM::LABEL:
case NETLIST_ITEM::PINLABEL:
case NETLIST_ITEM::GLOBLABEL:
case NETLIST_ITEM::GLOBBUSLABELMEMBER:
case NETLIST_ITEM::SHEETBUSLABELMEMBER:
case NETLIST_ITEM::PIN:
m_netNameCandidate = aCandidate;
break;
@ -464,8 +463,8 @@ void NETLIST_OBJECT::SetNetNameCandidate( NETLIST_OBJECT* aCandidate )
const wxString NETLIST_OBJECT::GetPinNameText() const
{
wxString name;
// returns the pin name, for NET_PIN (usual pin) item.
if( m_Type == NET_PIN )
// returns the pin name, for NETLIST_ITEM::PIN (usual pin) item.
if( m_Type == NETLIST_ITEM::PIN )
{
name = static_cast<LIB_PIN*>( m_Comp )->GetName();

View File

@ -41,46 +41,46 @@ class SCH_COMPONENT;
/* Type of Net objects (wires, labels, pins...) */
enum NETLIST_ITEM_T
enum class NETLIST_ITEM
{
NET_ITEM_UNSPECIFIED, // only for not yet initialized instances
NET_SEGMENT, // connection by wire
NET_BUS, // connection by bus
NET_JUNCTION, // connection by junction: can connect to
ITEM_UNSPECIFIED, // only for not yet initialized instances
SEGMENT, // connection by wire
BUS, // connection by bus
JUNCTION, // connection by junction: can connect to
// or more crossing wires
NET_LABEL, // this is a local label
NET_GLOBLABEL, // this is a global label that connect all
LABEL, // this is a local label
GLOBLABEL, // this is a global label that connect all
// others global label in whole hierarchy
NET_HIERLABEL, // element to indicate connection to a
HIERLABEL, // element to indicate connection to a
// higher-level sheet
NET_SHEETLABEL, // element to indicate connection to a
SHEETLABEL, // element to indicate connection to a
// lower-level sheet.
NET_BUSLABELMEMBER, /* created when a bus label is found:
BUSLABELMEMBER, /* created when a bus label is found:
* the bus label (like DATA[0..7] is
* converted to n single labels like
* DATA0, DATA1 ...
* These objects are living only in the current
* NETLIST_OBJECT_LIST, not in shematic.
*/
NET_GLOBBUSLABELMEMBER, // see NET_BUSLABELMEMBER, used when a
GLOBBUSLABELMEMBER, // see NET_BUSLABELMEMBER, used when a
// global bus label is found
NET_HIERBUSLABELMEMBER, // see NET_BUSLABELMEMBER, used when a
HIERBUSLABELMEMBER, // see NET_BUSLABELMEMBER, used when a
// hierarchical bus label is found
NET_SHEETBUSLABELMEMBER, // see NET_BUSLABELMEMBER, used when a
SHEETBUSLABELMEMBER, // see NET_BUSLABELMEMBER, used when a
// pin sheet label using bus notation
// is found
NET_PINLABEL, /* created when a pin is POWER (IN or
PINLABEL, /* created when a pin is POWER (IN or
* OUT) with invisible attribute is found:
* these pins are equivalent to a global
* label and are automatically connected
*/
NET_PIN, // this is an usual pin
NET_NOCONNECT // this is a no connect symbol
PIN, // this is an usual pin
NOCONNECT // this is a no connect symbol
};
/* Values for .m_FlagOfConnection member */
enum NET_CONNECTION_T
enum class NET_CONNECTION
{
UNCONNECTED = 0, /* Pin or Label not connected (error) */
NOCONNECT_SYMBOL_PRESENT, /* Pin not connected but have a NoConnect
@ -92,7 +92,7 @@ enum NET_CONNECTION_T
class NETLIST_OBJECT
{
public:
NETLIST_ITEM_T m_Type; /* Type of item (see NETLIST_ITEM_T enum) */
NETLIST_ITEM m_Type; /* Type of item (see NETLIST_ITEM_T enum) */
EDA_ITEM* m_Comp; /* Pointer to the library item that
* created this net object (the parent)
*/
@ -110,7 +110,7 @@ public:
int m_Member; /* for labels type NET_BUSLABELMEMBER ( bus member
* created from the BUS label ) member number.
*/
NET_CONNECTION_T m_ConnectionType; // Used to store the connection type
NET_CONNECTION m_ConnectionType; // Used to store the connection type
wxString m_PinNum; // pin number
wxString m_Label; // Label text (for labels) or Pin name (for pins)
wxPoint m_Start; // Position of object or for segments: starting point
@ -132,7 +132,6 @@ public:
#if defined(DEBUG)
void Show( std::ostream& out, int ndx ) const;
#endif
NETLIST_OBJECT();
@ -151,12 +150,12 @@ public:
* symbol on it (no error)
* PAD_CONNECT Normal connection (no error)
*/
void SetConnectionType( NET_CONNECTION_T aFlg = UNCONNECTED )
void SetConnectionType( NET_CONNECTION aFlg = NET_CONNECTION::UNCONNECTED )
{
m_ConnectionType = aFlg;
}
NET_CONNECTION_T GetConnectionType() const
NET_CONNECTION GetConnectionType() const
{
return m_ConnectionType;
}
@ -342,7 +341,7 @@ public:
/**
* Acces to an item type
*/
NETLIST_ITEM_T GetItemType( unsigned aIdx ) const
NETLIST_ITEM GetItemType( unsigned aIdx ) const
{
return GetItem( aIdx )->m_Type;
}
@ -355,7 +354,7 @@ public:
return GetItem( aIdx )->GetNet();
}
NET_CONNECTION_T GetConnectionType( unsigned aIdx )
NET_CONNECTION GetConnectionType( unsigned aIdx )
{
return GetItem( aIdx )->GetConnectionType();
}
@ -367,7 +366,7 @@ public:
* symbol on it (no error)
* PAD_CONNECT Normal connection (no error)
*/
void SetConnectionType( unsigned aIdx, NET_CONNECTION_T aFlg = UNCONNECTED )
void SetConnectionType( unsigned aIdx, NET_CONNECTION aFlg = NET_CONNECTION::UNCONNECTED )
{
GetItem( aIdx )->SetConnectionType( aFlg );
}
@ -381,7 +380,7 @@ public:
void ResetConnectionsType()
{
for( unsigned ii = 0; ii < size(); ii++ )
GetItem( ii )->SetConnectionType( UNCONNECTED );
GetItem( ii )->SetConnectionType( NET_CONNECTION::UNCONNECTED );
}
/*

View File

@ -103,20 +103,20 @@ bool NETLIST_OBJECT_LIST::BuildNetListInfo( SCH_SHEET_LIST& aSheets )
switch( net_item->m_Type )
{
case NET_ITEM_UNSPECIFIED:
case NETLIST_ITEM::ITEM_UNSPECIFIED:
wxMessageBox( wxT( "BuildNetListInfo() error" ) );
break;
case NET_PIN:
case NET_PINLABEL:
case NET_SHEETLABEL:
case NET_NOCONNECT:
case NETLIST_ITEM::PIN:
case NETLIST_ITEM::PINLABEL:
case NETLIST_ITEM::SHEETLABEL:
case NETLIST_ITEM::NOCONNECT:
if( net_item->GetNet() != 0 )
break;
// Intentionally fall through if there is no net assigned
case NET_SEGMENT:
case NETLIST_ITEM::SEGMENT:
// Test connections point to point type without bus.
if( net_item->GetNet() == 0 )
{
@ -127,7 +127,7 @@ bool NETLIST_OBJECT_LIST::BuildNetListInfo( SCH_SHEET_LIST& aSheets )
pointToPointConnect( net_item, IS_WIRE, istart );
break;
case NET_JUNCTION:
case NETLIST_ITEM::JUNCTION:
// Control of the junction outside BUS.
if( net_item->GetNet() == 0 )
{
@ -147,9 +147,9 @@ bool NETLIST_OBJECT_LIST::BuildNetListInfo( SCH_SHEET_LIST& aSheets )
segmentToPointConnect( net_item, IS_BUS, istart );
break;
case NET_LABEL:
case NET_HIERLABEL:
case NET_GLOBLABEL:
case NETLIST_ITEM::LABEL:
case NETLIST_ITEM::HIERLABEL:
case NETLIST_ITEM::GLOBLABEL:
// Test connections type junction without bus.
if( net_item->GetNet() == 0 )
{
@ -160,13 +160,13 @@ bool NETLIST_OBJECT_LIST::BuildNetListInfo( SCH_SHEET_LIST& aSheets )
segmentToPointConnect( net_item, IS_WIRE, istart );
break;
case NET_SHEETBUSLABELMEMBER:
case NETLIST_ITEM::SHEETBUSLABELMEMBER:
if( net_item->m_BusNetCode != 0 )
break;
// Intentionally fall through if there is no bus assigned
case NET_BUS:
case NETLIST_ITEM::BUS:
// Control type connections point to point mode bus
if( net_item->m_BusNetCode == 0 )
{
@ -177,9 +177,9 @@ bool NETLIST_OBJECT_LIST::BuildNetListInfo( SCH_SHEET_LIST& aSheets )
pointToPointConnect( net_item, IS_BUS, istart );
break;
case NET_BUSLABELMEMBER:
case NET_HIERBUSLABELMEMBER:
case NET_GLOBBUSLABELMEMBER:
case NETLIST_ITEM::BUSLABELMEMBER:
case NETLIST_ITEM::HIERBUSLABELMEMBER:
case NETLIST_ITEM::GLOBBUSLABELMEMBER:
// Control connections similar has on BUS
if( net_item->GetNet() == 0 )
{
@ -205,28 +205,28 @@ bool NETLIST_OBJECT_LIST::BuildNetListInfo( SCH_SHEET_LIST& aSheets )
{
switch( GetItem( ii )->m_Type )
{
case NET_PIN:
case NET_SHEETLABEL:
case NET_SEGMENT:
case NET_JUNCTION:
case NET_BUS:
case NET_NOCONNECT:
case NETLIST_ITEM::PIN:
case NETLIST_ITEM::SHEETLABEL:
case NETLIST_ITEM::SEGMENT:
case NETLIST_ITEM::JUNCTION:
case NETLIST_ITEM::BUS:
case NETLIST_ITEM::NOCONNECT:
break;
case NET_LABEL:
case NET_GLOBLABEL:
case NET_PINLABEL:
case NET_BUSLABELMEMBER:
case NET_GLOBBUSLABELMEMBER:
case NETLIST_ITEM::LABEL:
case NETLIST_ITEM::GLOBLABEL:
case NETLIST_ITEM::PINLABEL:
case NETLIST_ITEM::BUSLABELMEMBER:
case NETLIST_ITEM::GLOBBUSLABELMEMBER:
labelConnect( GetItem( ii ) );
break;
case NET_SHEETBUSLABELMEMBER:
case NET_HIERLABEL:
case NET_HIERBUSLABELMEMBER:
case NETLIST_ITEM::SHEETBUSLABELMEMBER:
case NETLIST_ITEM::HIERLABEL:
case NETLIST_ITEM::HIERBUSLABELMEMBER:
break;
case NET_ITEM_UNSPECIFIED:
case NETLIST_ITEM::ITEM_UNSPECIFIED:
break;
}
}
@ -239,8 +239,8 @@ bool NETLIST_OBJECT_LIST::BuildNetListInfo( SCH_SHEET_LIST& aSheets )
// Connection between hierarchy sheets
for( unsigned ii = 0; ii < size(); ii++ )
{
if( GetItem( ii )->m_Type == NET_SHEETLABEL
|| GetItem( ii )->m_Type == NET_SHEETBUSLABELMEMBER )
if( GetItem( ii )->m_Type == NETLIST_ITEM::SHEETLABEL
|| GetItem( ii )->m_Type == NETLIST_ITEM::SHEETBUSLABELMEMBER )
sheetLabelConnect( GetItem( ii ) );
}
@ -277,19 +277,26 @@ bool NETLIST_OBJECT_LIST::BuildNetListInfo( SCH_SHEET_LIST& aSheets )
}
// Helper function to give a priority to sort labels:
// NET_PINLABEL, NET_GLOBBUSLABELMEMBER and NET_GLOBLABEL are global labels
// NETLIST_ITEM::PINLABEL, NETLIST_ITEM::GLOBBUSLABELMEMBER and NETLIST_ITEM::GLOBLABEL are global labels
// and the priority is high
static int getPriority( const NETLIST_OBJECT* Objet )
{
switch( Objet->m_Type )
{
case NET_PIN: return 1;
case NET_LABEL: return 2;
case NET_HIERLABEL: return 3;
case NET_PINLABEL: return 4;
case NET_GLOBBUSLABELMEMBER: return 5;
case NET_GLOBLABEL: return 6;
default: break;
case NETLIST_ITEM::PIN:
return 1;
case NETLIST_ITEM::LABEL:
return 2;
case NETLIST_ITEM::HIERLABEL:
return 3;
case NETLIST_ITEM::PINLABEL:
return 4;
case NETLIST_ITEM::GLOBBUSLABELMEMBER:
return 5;
case NETLIST_ITEM::GLOBLABEL:
return 6;
default:
break;
}
return 0;
@ -345,11 +352,11 @@ static bool evalLabelsPriority( const NETLIST_OBJECT* aLabel1, const NETLIST_OBJ
void NETLIST_OBJECT_LIST::findBestNetNameForEachNet()
{
// Important note: NET_SHEETLABEL items of sheet items should *NOT* be considered,
// Important note: NETLIST_ITEM::SHEETLABEL items of sheet items should *NOT* be considered,
// because they live in a sheet but their names are actually used in the subsheet.
// Moreover, in the parent sheet, the name of NET_SHEETLABEL can be not unique,
// Moreover, in the parent sheet, the name of NETLIST_ITEM::SHEETLABEL can be not unique,
// ( for instance when 2 different sheets share the same schematic in complex hierarchies
// and 2 identical NET_SHEETLABEL labels can be connected to 2 different nets
// and 2 identical NETLIST_ITEM::SHEETLABEL labels can be connected to 2 different nets
int netcode = 0; // current netcode for tested items
unsigned idxstart = 0; // index of the first item of this net
@ -384,11 +391,11 @@ void NETLIST_OBJECT_LIST::findBestNetNameForEachNet()
switch( item->m_Type )
{
case NET_HIERLABEL:
case NET_LABEL:
case NET_PINLABEL:
case NET_GLOBLABEL:
case NET_GLOBBUSLABELMEMBER:
case NETLIST_ITEM::HIERLABEL:
case NETLIST_ITEM::LABEL:
case NETLIST_ITEM::PINLABEL:
case NETLIST_ITEM::GLOBLABEL:
case NETLIST_ITEM::GLOBBUSLABELMEMBER:
// A candidate is found: select the better between the previous and this one
if( candidate == NULL )
candidate = item;
@ -463,7 +470,7 @@ void NETLIST_OBJECT_LIST::findBestNetNameForEachNet()
// (Net-<{reference}-Pad{pad number}> like Net-<U3-Pad5>
// Not named nets do not have usually a lot of members.
// Many have only 2 members(a pad and a non connection symbol)
if( item->m_Type == NET_PIN )
if( item->m_Type == NETLIST_ITEM::PIN )
{
// A candidate is found, however components which are not in
// netlist are not candidate because some have their reference
@ -501,7 +508,8 @@ void NETLIST_OBJECT_LIST::sheetLabelConnect( NETLIST_OBJECT* SheetLabel )
if( ObjetNet->m_SheetPath != SheetLabel->m_SheetPathInclude )
continue; //use SheetInclude, not the sheet!!
if( (ObjetNet->m_Type != NET_HIERLABEL ) && (ObjetNet->m_Type != NET_HIERBUSLABELMEMBER ) )
if( ( ObjetNet->m_Type != NETLIST_ITEM::HIERLABEL )
&& ( ObjetNet->m_Type != NETLIST_ITEM::HIERBUSLABELMEMBER ) )
continue;
if( ObjetNet->GetNet() == SheetLabel->GetNet() )
@ -607,15 +615,15 @@ void NETLIST_OBJECT_LIST::pointToPointConnect( NETLIST_OBJECT* aRef, bool aIsBus
switch( item->m_Type )
{
case NET_SEGMENT:
case NET_PIN:
case NET_LABEL:
case NET_HIERLABEL:
case NET_GLOBLABEL:
case NET_SHEETLABEL:
case NET_PINLABEL:
case NET_JUNCTION:
case NET_NOCONNECT:
case NETLIST_ITEM::SEGMENT:
case NETLIST_ITEM::PIN:
case NETLIST_ITEM::LABEL:
case NETLIST_ITEM::HIERLABEL:
case NETLIST_ITEM::GLOBLABEL:
case NETLIST_ITEM::SHEETLABEL:
case NETLIST_ITEM::PINLABEL:
case NETLIST_ITEM::JUNCTION:
case NETLIST_ITEM::NOCONNECT:
if( aRef->m_Start == item->m_Start
|| aRef->m_Start == item->m_End
|| aRef->m_End == item->m_Start
@ -628,12 +636,12 @@ void NETLIST_OBJECT_LIST::pointToPointConnect( NETLIST_OBJECT* aRef, bool aIsBus
}
break;
case NET_BUS:
case NET_BUSLABELMEMBER:
case NET_SHEETBUSLABELMEMBER:
case NET_HIERBUSLABELMEMBER:
case NET_GLOBBUSLABELMEMBER:
case NET_ITEM_UNSPECIFIED:
case NETLIST_ITEM::BUS:
case NETLIST_ITEM::BUSLABELMEMBER:
case NETLIST_ITEM::SHEETBUSLABELMEMBER:
case NETLIST_ITEM::HIERBUSLABELMEMBER:
case NETLIST_ITEM::GLOBBUSLABELMEMBER:
case NETLIST_ITEM::ITEM_UNSPECIFIED:
break;
}
}
@ -651,23 +659,23 @@ void NETLIST_OBJECT_LIST::pointToPointConnect( NETLIST_OBJECT* aRef, bool aIsBus
switch( item->m_Type )
{
case NET_ITEM_UNSPECIFIED:
case NET_SEGMENT:
case NET_PIN:
case NET_LABEL:
case NET_HIERLABEL:
case NET_GLOBLABEL:
case NET_SHEETLABEL:
case NET_PINLABEL:
case NET_NOCONNECT:
case NETLIST_ITEM::ITEM_UNSPECIFIED:
case NETLIST_ITEM::SEGMENT:
case NETLIST_ITEM::PIN:
case NETLIST_ITEM::LABEL:
case NETLIST_ITEM::HIERLABEL:
case NETLIST_ITEM::GLOBLABEL:
case NETLIST_ITEM::SHEETLABEL:
case NETLIST_ITEM::PINLABEL:
case NETLIST_ITEM::NOCONNECT:
break;
case NET_BUS:
case NET_BUSLABELMEMBER:
case NET_SHEETBUSLABELMEMBER:
case NET_HIERBUSLABELMEMBER:
case NET_GLOBBUSLABELMEMBER:
case NET_JUNCTION:
case NETLIST_ITEM::BUS:
case NETLIST_ITEM::BUSLABELMEMBER:
case NETLIST_ITEM::SHEETBUSLABELMEMBER:
case NETLIST_ITEM::HIERBUSLABELMEMBER:
case NETLIST_ITEM::GLOBBUSLABELMEMBER:
case NETLIST_ITEM::JUNCTION:
if( aRef->m_Start == item->m_Start
|| aRef->m_Start == item->m_End
|| aRef->m_End == item->m_Start
@ -698,12 +706,12 @@ void NETLIST_OBJECT_LIST::segmentToPointConnect( NETLIST_OBJECT* aJonction,
if( aIsBus == IS_WIRE )
{
if( segment->m_Type != NET_SEGMENT )
if( segment->m_Type != NETLIST_ITEM::SEGMENT )
continue;
}
else
{
if( segment->m_Type != NET_BUS )
if( segment->m_Type != NETLIST_ITEM::BUS )
continue;
}
@ -743,21 +751,21 @@ void NETLIST_OBJECT_LIST::labelConnect( NETLIST_OBJECT* aLabelRef )
if( item->m_SheetPath != aLabelRef->m_SheetPath )
{
if( item->m_Type != NET_PINLABEL && item->m_Type != NET_GLOBLABEL
&& item->m_Type != NET_GLOBBUSLABELMEMBER )
if( item->m_Type != NETLIST_ITEM::PINLABEL && item->m_Type != NETLIST_ITEM::GLOBLABEL
&& item->m_Type != NETLIST_ITEM::GLOBBUSLABELMEMBER )
continue;
if( (item->m_Type == NET_GLOBLABEL
|| item->m_Type == NET_GLOBBUSLABELMEMBER)
if( ( item->m_Type == NETLIST_ITEM::GLOBLABEL
|| item->m_Type == NETLIST_ITEM::GLOBBUSLABELMEMBER )
&& item->m_Type != aLabelRef->m_Type )
//global labels only connect other global labels.
continue;
}
// NET_HIERLABEL are used to connect sheets.
// NET_LABEL are local to a sheet
// NET_GLOBLABEL are global.
// NET_PINLABEL is a kind of global label (generated by a power pin invisible)
// NETLIST_ITEM::HIERLABEL are used to connect sheets.
// NETLIST_ITEM::LABEL are local to a sheet
// NETLIST_ITEM::GLOBLABEL are global.
// NETLIST_ITEM::PINLABEL is a kind of global label (generated by a power pin invisible)
if( item->IsLabelType() )
{
if( item->m_Label != aLabelRef->m_Label )
@ -776,15 +784,16 @@ void NETLIST_OBJECT_LIST::setUnconnectedFlag()
{
NETLIST_OBJECT* NetItemRef;
unsigned NetStart, NetEnd;
NET_CONNECTION_T StateFlag;
NET_CONNECTION StateFlag;
NetStart = NetEnd = 0;
StateFlag = UNCONNECTED;
StateFlag = NET_CONNECTION::UNCONNECTED;
for( unsigned ii = 0; ii < size(); ii++ )
{
NetItemRef = GetItem( ii );
if( NetItemRef->m_Type == NET_NOCONNECT && StateFlag != PAD_CONNECT )
StateFlag = NOCONNECT_SYMBOL_PRESENT;
if( NetItemRef->m_Type == NETLIST_ITEM::NOCONNECT
&& StateFlag != NET_CONNECTION::PAD_CONNECT )
StateFlag = NET_CONNECTION::NOCONNECT_SYMBOL_PRESENT;
// Analysis of current net.
unsigned idxtoTest = ii + 1;
@ -804,7 +813,7 @@ void NETLIST_OBJECT_LIST::setUnconnectedFlag()
return;
// Start Analysis next Net
StateFlag = UNCONNECTED;
StateFlag = NET_CONNECTION::UNCONNECTED;
NetStart = idxtoTest;
continue;
}
@ -825,33 +834,33 @@ void NETLIST_OBJECT_LIST::setUnconnectedFlag()
switch( GetItem( idxtoTest )->m_Type )
{
case NET_ITEM_UNSPECIFIED:
case NETLIST_ITEM::ITEM_UNSPECIFIED:
wxMessageBox( wxT( "BuildNetListBase() error" ) );
break;
case NET_SEGMENT:
case NET_LABEL:
case NET_HIERLABEL:
case NET_GLOBLABEL:
case NET_SHEETLABEL:
case NET_PINLABEL:
case NET_BUS:
case NET_BUSLABELMEMBER:
case NET_SHEETBUSLABELMEMBER:
case NET_HIERBUSLABELMEMBER:
case NET_GLOBBUSLABELMEMBER:
case NET_JUNCTION:
case NETLIST_ITEM::SEGMENT:
case NETLIST_ITEM::LABEL:
case NETLIST_ITEM::HIERLABEL:
case NETLIST_ITEM::GLOBLABEL:
case NETLIST_ITEM::SHEETLABEL:
case NETLIST_ITEM::PINLABEL:
case NETLIST_ITEM::BUS:
case NETLIST_ITEM::BUSLABELMEMBER:
case NETLIST_ITEM::SHEETBUSLABELMEMBER:
case NETLIST_ITEM::HIERBUSLABELMEMBER:
case NETLIST_ITEM::GLOBBUSLABELMEMBER:
case NETLIST_ITEM::JUNCTION:
break;
case NET_PIN:
if( NetItemRef->m_Type == NET_PIN )
StateFlag = PAD_CONNECT;
case NETLIST_ITEM::PIN:
if( NetItemRef->m_Type == NETLIST_ITEM::PIN )
StateFlag = NET_CONNECTION::PAD_CONNECT;
break;
case NET_NOCONNECT:
if( StateFlag != PAD_CONNECT )
StateFlag = NOCONNECT_SYMBOL_PRESENT;
case NETLIST_ITEM::NOCONNECT:
if( StateFlag != NET_CONNECTION::PAD_CONNECT )
StateFlag = NET_CONNECTION::NOCONNECT_SYMBOL_PRESENT;
break;
}

View File

@ -30,75 +30,46 @@
#include <macros.h>
wxString GetText( GRAPHIC_PINSHAPE shape )
struct pinShapeStruct
{
switch( shape )
{
case PINSHAPE_LINE:
return _( "Line" );
wxString name;
const BITMAP_OPAQUE* bitmap;
};
case PINSHAPE_INVERTED:
return _( "Inverted" );
/*
* Conversion map between PLOT_DASH_TYPE values and style names displayed
*/
// clang-format off
const std::map<GRAPHIC_PINSHAPE, struct pinShapeStruct> pinShapes = {
{ GRAPHIC_PINSHAPE::LINE, { _( "Line" ), pinshape_normal_xpm } },
{ GRAPHIC_PINSHAPE::INVERTED, { _( "Inverted" ), pinshape_invert_xpm } },
{ GRAPHIC_PINSHAPE::CLOCK, { _( "Clock" ), pinshape_clock_normal_xpm } },
{ GRAPHIC_PINSHAPE::INVERTED_CLOCK, { _( "Inverted clock" ), pinshape_clock_invert_xpm } },
{ GRAPHIC_PINSHAPE::INPUT_LOW, { _( "Input low" ), pinshape_active_low_input_xpm } },
{ GRAPHIC_PINSHAPE::CLOCK_LOW, { _( "Clock low" ), pinshape_clock_active_low_xpm } },
{ GRAPHIC_PINSHAPE::OUTPUT_LOW, { _( "Output low" ), pinshape_active_low_output_xpm } },
{ GRAPHIC_PINSHAPE::FALLING_EDGE_CLOCK, { _( "Falling edge clock" ), pinshape_clock_fall_xpm } },
{ GRAPHIC_PINSHAPE::NONLOGIC, { _( "NonLogic" ), pinshape_nonlogic_xpm } },
};
// clang-format on
case PINSHAPE_CLOCK:
return _( "Clock" );
case PINSHAPE_INVERTED_CLOCK:
return _( "Inverted clock" );
wxString GetText( GRAPHIC_PINSHAPE aShape )
{
auto findIt = pinShapes.find( aShape );
case PINSHAPE_INPUT_LOW:
return _( "Input low" );
wxCHECK_MSG( findIt != pinShapes.end(), wxT( "?" ), "Could not find pinshape in lookup map" );
case PINSHAPE_CLOCK_LOW:
return _( "Clock low" );
case PINSHAPE_OUTPUT_LOW:
return _( "Output low" );
case PINSHAPE_FALLING_EDGE_CLOCK:
return _( "Falling edge clock" );
case PINSHAPE_NONLOGIC:
return _( "NonLogic" );
}
assert( !"Invalid pin shape" );
return wxT( "?" );
return findIt->second.name;
}
BITMAP_DEF GetBitmap( GRAPHIC_PINSHAPE shape )
BITMAP_DEF GetBitmap( GRAPHIC_PINSHAPE aShape )
{
switch( shape )
{
case PINSHAPE_LINE:
return pinshape_normal_xpm;
auto findIt = pinShapes.find( aShape );
case PINSHAPE_INVERTED:
return pinshape_invert_xpm;
wxCHECK_MSG( findIt != pinShapes.end(), nullptr, "Could not find pinshape in lookup map" );
case PINSHAPE_CLOCK:
return pinshape_clock_normal_xpm;
case PINSHAPE_INVERTED_CLOCK:
return pinshape_clock_invert_xpm;
case PINSHAPE_INPUT_LOW:
return pinshape_active_low_input_xpm;
case PINSHAPE_CLOCK_LOW:
return pinshape_clock_active_low_xpm;
case PINSHAPE_OUTPUT_LOW:
return pinshape_active_low_output_xpm;
case PINSHAPE_FALLING_EDGE_CLOCK:
return pinshape_clock_fall_xpm;
case PINSHAPE_NONLOGIC:
return pinshape_nonlogic_xpm;
}
assert( !"Invalid pin shape" );
return 0;
return findIt->second.bitmap;
}

View File

@ -32,23 +32,23 @@
#include <wx/string.h>
#include <bitmaps.h>
enum GRAPHIC_PINSHAPE
enum class GRAPHIC_PINSHAPE
{
PINSHAPE_LINE,
PINSHAPE_INVERTED,
PINSHAPE_CLOCK,
PINSHAPE_INVERTED_CLOCK,
PINSHAPE_INPUT_LOW,
PINSHAPE_CLOCK_LOW,
PINSHAPE_OUTPUT_LOW,
PINSHAPE_FALLING_EDGE_CLOCK,
PINSHAPE_NONLOGIC
LINE,
INVERTED,
CLOCK,
INVERTED_CLOCK,
INPUT_LOW,
CLOCK_LOW,
OUTPUT_LOW,
FALLING_EDGE_CLOCK,
NONLOGIC,
LAST_OPTION = NONLOGIC ///< this is the sentinel value, must be set to last enum value
};
enum
{
PINSHAPE_COUNT = PINSHAPE_NONLOGIC + 1
};
#define GRAPHIC_PINSHAPES_TOTAL ( static_cast<int>( GRAPHIC_PINSHAPE::LAST_OPTION ) + 1 )
// UI
wxString GetText( GRAPHIC_PINSHAPE shape );

View File

@ -30,87 +30,47 @@
#include <macros.h>
struct pinTypeStruct
{
wxString name;
const BITMAP_OPAQUE* bitmap;
};
/*
* Conversion map between PLOT_DASH_TYPE values and style names displayed
*/
// clang-format off
const std::map<ELECTRICAL_PINTYPE, struct pinTypeStruct> pinTypes = {
{ ELECTRICAL_PINTYPE::PT_INPUT, { _( "Input" ), pintype_input_xpm } },
{ ELECTRICAL_PINTYPE::PT_OUTPUT, { _( "Output" ), pintype_output_xpm } },
{ ELECTRICAL_PINTYPE::PT_BIDI, { _( "Bidirectional" ), pintype_bidi_xpm } },
{ ELECTRICAL_PINTYPE::PT_TRISTATE, { _( "Tri-state" ), pintype_3states_xpm } },
{ ELECTRICAL_PINTYPE::PT_PASSIVE, { _( "Passive" ), pintype_passive_xpm } },
{ ELECTRICAL_PINTYPE::PT_UNSPECIFIED, { _( "Clock low" ), pintype_notspecif_xpm } },
{ ELECTRICAL_PINTYPE::PT_POWER_IN, { _( "Power input" ), pintype_powerinput_xpm } },
{ ELECTRICAL_PINTYPE::PT_POWER_OUT, { _( "Power output" ), pintype_poweroutput_xpm } },
{ ELECTRICAL_PINTYPE::PT_OPENCOLLECTOR,{ _( "Open collector" ), pintype_opencoll_xpm } },
{ ELECTRICAL_PINTYPE::PT_OPENEMITTER, { _( "Open emitter" ), pintype_openemit_xpm } },
{ ELECTRICAL_PINTYPE::PT_NC, { _( "Not connected" ), pintype_noconnect_xpm } },
};
// clang-format on
wxString GetText( ELECTRICAL_PINTYPE aType )
{
switch( aType )
{
case PIN_INPUT:
return _( "Input" );
auto findIt = pinTypes.find( aType );
case PIN_OUTPUT:
return _( "Output" );
wxCHECK_MSG( findIt != pinTypes.end(), wxT( "???" ), "Could not find pin type in lookup map" );
case PIN_BIDI:
return _( "Bidirectional" );
case PIN_TRISTATE:
return _( "Tri-state" );
case PIN_PASSIVE:
return _( "Passive" );
case PIN_UNSPECIFIED:
return _( "Unspecified" );
case PIN_POWER_IN:
return _( "Power input" );
case PIN_POWER_OUT:
return _( "Power output" );
case PIN_OPENCOLLECTOR:
return _( "Open collector" );
case PIN_OPENEMITTER:
return _( "Open emitter" );
case PIN_NC:
return _( "Not connected" );
};
assert( !"invalid pin type" );
return wxT( "???" );
return findIt->second.name;
}
BITMAP_DEF GetBitmap( ELECTRICAL_PINTYPE aType )
{
switch( aType )
{
case PIN_INPUT:
return pintype_input_xpm;
auto findIt = pinTypes.find( aType );
case PIN_OUTPUT:
return pintype_output_xpm;
wxCHECK_MSG( findIt != pinTypes.end(), nullptr, "Could not find pin type in lookup map" );
case PIN_BIDI:
return pintype_bidi_xpm;
case PIN_TRISTATE:
return pintype_3states_xpm;
case PIN_PASSIVE:
return pintype_passive_xpm;
case PIN_UNSPECIFIED:
return pintype_notspecif_xpm;
case PIN_POWER_IN:
return pintype_powerinput_xpm;
case PIN_POWER_OUT:
return pintype_poweroutput_xpm;
case PIN_OPENCOLLECTOR:
return pintype_opencoll_xpm;
case PIN_OPENEMITTER:
return pintype_openemit_xpm;
case PIN_NC:
return pintype_noconnect_xpm;
};
assert( !"invalid pin type" );
return NULL;
return findIt->second.bitmap;
}

View File

@ -34,23 +34,24 @@
/**
* The component library pin object electrical types used in ERC tests.
*/
enum ELECTRICAL_PINTYPE {
PIN_INPUT,
PIN_OUTPUT,
PIN_BIDI,
PIN_TRISTATE,
PIN_PASSIVE,
PIN_UNSPECIFIED,
PIN_POWER_IN,
PIN_POWER_OUT,
PIN_OPENCOLLECTOR,
PIN_OPENEMITTER,
PIN_NC /* No connect */
enum class ELECTRICAL_PINTYPE
{
PT_INPUT, ///< usual pin input: must be connected
PT_OUTPUT, ///< usual output
PT_BIDI, ///< input or output (like port for a microprocessor)
PT_TRISTATE, ///< tris state bus pin
PT_PASSIVE, ///< pin for passive components: must be connected, and can be connected to any pin
PT_UNSPECIFIED, ///< unknown electrical properties: creates always a warning when connected
PT_POWER_IN, ///< power input (GND, VCC for ICs). Must be connected to a power output.
PT_POWER_OUT, ///< output of a regulator: intended to be connected to power input pins
PT_OPENCOLLECTOR, ///< pin type open collector
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
};
enum {
PINTYPE_COUNT = PIN_NC + 1
};
#define ELECTRICAL_PINTYPES_TOTAL ( static_cast<int>( ELECTRICAL_PINTYPE::PT_LAST_OPTION ) + 1 )
// UI
wxString GetText( ELECTRICAL_PINTYPE );

View File

@ -1687,7 +1687,7 @@ void SCH_COMPONENT::GetNetListItem( NETLIST_OBJECT_LIST& aNetListItems,
item->m_SheetPathInclude = *aSheetPath;
item->m_Comp = (SCH_ITEM*) pin;
item->m_SheetPath = *aSheetPath;
item->m_Type = NET_PIN;
item->m_Type = NETLIST_ITEM::PIN;
item->m_Link = (SCH_ITEM*) this;
item->m_ElectricalPinType = pin->GetType();
item->m_PinNum = pin->GetNumber();
@ -1703,7 +1703,7 @@ void SCH_COMPONENT::GetNetListItem( NETLIST_OBJECT_LIST& aNetListItems,
item->m_SheetPathInclude = *aSheetPath;
item->m_Comp = NULL;
item->m_SheetPath = *aSheetPath;
item->m_Type = NET_PINLABEL;
item->m_Type = NETLIST_ITEM::PINLABEL;
item->m_Label = pin->GetName();
item->m_Start = pos;
item->m_End = item->m_Start;

View File

@ -116,7 +116,7 @@ void SCH_CONNECTION::ConfigureFromLabel( wxString aLabel )
if( IsBusVectorLabel( aLabel ) )
{
m_name = aLabel;
m_type = CONNECTION_BUS;
m_type = CONNECTION_TYPE::BUS;
std::vector<wxString> members;
@ -125,8 +125,8 @@ void SCH_CONNECTION::ConfigureFromLabel( wxString aLabel )
for( const auto& vector_member : members )
{
auto member = std::make_shared< SCH_CONNECTION >( m_parent, m_sheet );
member->m_type = CONNECTION_NET;
auto member = std::make_shared<SCH_CONNECTION>( m_parent, m_sheet );
member->m_type = CONNECTION_TYPE::NET;
member->m_prefix = m_prefix;
member->m_name = vector_member;
member->m_local_name = vector_member;
@ -136,7 +136,7 @@ void SCH_CONNECTION::ConfigureFromLabel( wxString aLabel )
}
else if( IsBusGroupLabel( aLabel ) )
{
m_type = CONNECTION_BUS_GROUP;
m_type = CONNECTION_TYPE::BUS_GROUP;
m_name = aLabel;
m_local_name = aLabel;
@ -175,14 +175,14 @@ void SCH_CONNECTION::ConfigureFromLabel( wxString aLabel )
{
m_name = aLabel;
m_local_name = aLabel;
m_type = CONNECTION_NET;
m_type = CONNECTION_TYPE::NET;
}
}
void SCH_CONNECTION::Reset()
{
m_type = CONNECTION_NONE;
m_type = CONNECTION_TYPE::NONE;
m_name.Empty();
m_local_name.Empty();
m_prefix.Empty();
@ -257,7 +257,7 @@ wxString SCH_CONNECTION::Name( bool aIgnoreSheet ) const
if( m_name.IsEmpty() )
ret = "<NO NET>";
if( !Parent() || m_type == CONNECTION_NONE )
if( !Parent() || m_type == CONNECTION_TYPE::NONE )
return ret;
if( !aIgnoreSheet )

View File

@ -36,12 +36,12 @@ class SCH_ITEM;
class SCH_SHEET_PATH;
enum CONNECTION_TYPE
enum class CONNECTION_TYPE
{
CONNECTION_NONE, ///< No connection to this item
CONNECTION_NET, ///< This item represents a net
CONNECTION_BUS, ///< This item represents a bus vector
CONNECTION_BUS_GROUP, ///< This item represents a bus group
NONE, ///< No connection to this item
NET, ///< This item represents a net
BUS, ///< This item represents a bus vector
BUS_GROUP, ///< This item represents a bus group
};
/**
@ -122,12 +122,12 @@ public:
bool IsBus() const
{
return ( m_type == CONNECTION_BUS || m_type == CONNECTION_BUS_GROUP );
return ( m_type == CONNECTION_TYPE::BUS || m_type == CONNECTION_TYPE::BUS_GROUP );
}
bool IsNet() const
{
return ( m_type == CONNECTION_NET );
return ( m_type == CONNECTION_TYPE::NET );
}
bool IsDirty() const

View File

@ -65,6 +65,22 @@
using namespace std;
/**
* Map of EAGLE pin type values to KiCad pin type values
*/
static const std::map<wxString, ELECTRICAL_PINTYPE> pinDirectionsMap = {
{ "sup", ELECTRICAL_PINTYPE::PT_POWER_IN },
{ "pas", ELECTRICAL_PINTYPE::PT_PASSIVE },
{ "out", ELECTRICAL_PINTYPE::PT_OUTPUT },
{ "in", ELECTRICAL_PINTYPE::PT_INPUT },
{ "nc", ELECTRICAL_PINTYPE::PT_NC },
{ "io", ELECTRICAL_PINTYPE::PT_BIDI },
{ "oc", ELECTRICAL_PINTYPE::PT_OPENCOLLECTOR },
{ "hiz", ELECTRICAL_PINTYPE::PT_TRISTATE },
{ "pwr", ELECTRICAL_PINTYPE::PT_POWER_IN },
};
/**
* Provides an easy access to the children of an XML node via their names.
* @param aCurrentNode is a pointer to a wxXmlNode, whose children will be mapped.
@ -1396,22 +1412,10 @@ bool SCH_EAGLE_PLUGIN::loadSymbol( wxXmlNode* aSymbolNode, std::unique_ptr<LIB_P
std::unique_ptr<LIB_PIN> pin( loadPin( aPart, currentNode, &ePin, aGateNumber ) );
pincount++;
pin->SetType( PIN_BIDI );
pin->SetType( ELECTRICAL_PINTYPE::PT_BIDI );
if( ePin.direction )
{
const std::map<wxString, ELECTRICAL_PINTYPE> pinDirectionsMap = {
{ "sup", PIN_POWER_IN },
{ "pas", PIN_PASSIVE },
{ "out", PIN_OUTPUT },
{ "in", PIN_INPUT },
{ "nc", PIN_NC },
{ "io", PIN_BIDI },
{ "oc", PIN_OPENCOLLECTOR },
{ "hiz", PIN_TRISTATE },
{ "pwr", PIN_POWER_IN },
};
for( const auto& pinDir : pinDirectionsMap )
{
if( ePin.direction->Lower() == pinDir.first )
@ -1449,7 +1453,7 @@ bool SCH_EAGLE_PLUGIN::loadSymbol( wxXmlNode* aSymbolNode, std::unique_ptr<LIB_P
// schematic netlist and leave out the multiple NC pins when stacked.
for( unsigned i = 0; i < pads.GetCount(); i++ )
{
if( pin->GetType() == PIN_NC && i > 0 )
if( pin->GetType() == ELECTRICAL_PINTYPE::PT_NC && i > 0 )
break;
LIB_PIN* apin = new LIB_PIN( *pin );
@ -1766,15 +1770,15 @@ LIB_PIN* SCH_EAGLE_PLUGIN::loadPin(
if( function == "dot" )
{
pin->SetShape( PINSHAPE_INVERTED );
pin->SetShape( GRAPHIC_PINSHAPE::INVERTED );
}
else if( function == "clk" )
{
pin->SetShape( PINSHAPE_CLOCK );
pin->SetShape( GRAPHIC_PINSHAPE::CLOCK );
}
else if( function == "dotclk" )
{
pin->SetShape( PINSHAPE_INVERTED_CLOCK );
pin->SetShape( GRAPHIC_PINSHAPE::INVERTED_CLOCK );
}
}
@ -2523,7 +2527,7 @@ void SCH_EAGLE_PLUGIN::addImplicitConnections(
// Search all units for pins creating implicit connections
for( const auto& pin : pins )
{
if( pin->GetType() == PIN_POWER_IN )
if( pin->GetType() == ELECTRICAL_PINTYPE::PT_POWER_IN )
{
bool pinInUnit = !unit || pin->GetUnit() == unit; // pin belongs to the tested unit

View File

@ -142,7 +142,7 @@ void SCH_JUNCTION::GetNetListItem( NETLIST_OBJECT_LIST& aNetListItems,
item->m_SheetPath = *aSheetPath;
item->m_SheetPathInclude = *aSheetPath;
item->m_Comp = (SCH_ITEM*) this;
item->m_Type = NET_JUNCTION;
item->m_Type = NETLIST_ITEM::JUNCTION;
item->m_Start = item->m_End = m_pos;
aNetListItems.push_back( item );

View File

@ -3501,19 +3501,42 @@ LIB_PIN* SCH_LEGACY_PLUGIN_CACHE::loadPin( std::unique_ptr<LIB_PART>& aPart,
switch( type )
{
case 'I': pin->m_type = PIN_INPUT; break;
case 'O': pin->m_type = PIN_OUTPUT; break;
case 'B': pin->m_type = PIN_BIDI; break;
case 'T': pin->m_type = PIN_TRISTATE; break;
case 'P': pin->m_type = PIN_PASSIVE; break;
case 'U': pin->m_type = PIN_UNSPECIFIED; break;
case 'W': pin->m_type = PIN_POWER_IN; break;
case 'w': pin->m_type = PIN_POWER_OUT; break;
case 'C': pin->m_type = PIN_OPENCOLLECTOR; break;
case 'E': pin->m_type = PIN_OPENEMITTER; break;
case 'N': pin->m_type = PIN_NC; break;
default: THROW_PARSE_ERROR( "unknown pin type", aReader.GetSource(),
aReader.Line(), aReader.LineNumber(), pos );
case 'I':
pin->m_type = ELECTRICAL_PINTYPE::PT_INPUT;
break;
case 'O':
pin->m_type = ELECTRICAL_PINTYPE::PT_OUTPUT;
break;
case 'B':
pin->m_type = ELECTRICAL_PINTYPE::PT_BIDI;
break;
case 'T':
pin->m_type = ELECTRICAL_PINTYPE::PT_TRISTATE;
break;
case 'P':
pin->m_type = ELECTRICAL_PINTYPE::PT_PASSIVE;
break;
case 'U':
pin->m_type = ELECTRICAL_PINTYPE::PT_UNSPECIFIED;
break;
case 'W':
pin->m_type = ELECTRICAL_PINTYPE::PT_POWER_IN;
break;
case 'w':
pin->m_type = ELECTRICAL_PINTYPE::PT_POWER_OUT;
break;
case 'C':
pin->m_type = ELECTRICAL_PINTYPE::PT_OPENCOLLECTOR;
break;
case 'E':
pin->m_type = ELECTRICAL_PINTYPE::PT_OPENEMITTER;
break;
case 'N':
pin->m_type = ELECTRICAL_PINTYPE::PT_NC;
break;
default:
THROW_PARSE_ERROR( "unknown pin type", aReader.GetSource(), aReader.Line(),
aReader.LineNumber(), pos );
}
// Optional
@ -3554,16 +3577,35 @@ LIB_PIN* SCH_LEGACY_PLUGIN_CACHE::loadPin( std::unique_ptr<LIB_PART>& aPart,
switch( flags )
{
case 0: pin->m_shape = PINSHAPE_LINE; break;
case INVERTED: pin->m_shape = PINSHAPE_INVERTED; break;
case CLOCK: pin->m_shape = PINSHAPE_CLOCK; break;
case INVERTED | CLOCK: pin->m_shape = PINSHAPE_INVERTED_CLOCK; break;
case LOWLEVEL_IN: pin->m_shape = PINSHAPE_INPUT_LOW; break;
case LOWLEVEL_IN | CLOCK: pin->m_shape = PINSHAPE_CLOCK_LOW; break;
case LOWLEVEL_OUT: pin->m_shape = PINSHAPE_OUTPUT_LOW; break;
case FALLING_EDGE: pin->m_shape = PINSHAPE_FALLING_EDGE_CLOCK; break;
case NONLOGIC: pin->m_shape = PINSHAPE_NONLOGIC; break;
default: SCH_PARSE_ERROR( "pin attributes do not define a valid pin shape", aReader, line );
case 0:
pin->m_shape = GRAPHIC_PINSHAPE::LINE;
break;
case INVERTED:
pin->m_shape = GRAPHIC_PINSHAPE::INVERTED;
break;
case CLOCK:
pin->m_shape = GRAPHIC_PINSHAPE::CLOCK;
break;
case INVERTED | CLOCK:
pin->m_shape = GRAPHIC_PINSHAPE::INVERTED_CLOCK;
break;
case LOWLEVEL_IN:
pin->m_shape = GRAPHIC_PINSHAPE::INPUT_LOW;
break;
case LOWLEVEL_IN | CLOCK:
pin->m_shape = GRAPHIC_PINSHAPE::CLOCK_LOW;
break;
case LOWLEVEL_OUT:
pin->m_shape = GRAPHIC_PINSHAPE::OUTPUT_LOW;
break;
case FALLING_EDGE:
pin->m_shape = GRAPHIC_PINSHAPE::FALLING_EDGE_CLOCK;
break;
case NONLOGIC:
pin->m_shape = GRAPHIC_PINSHAPE::NONLOGIC;
break;
default:
SCH_PARSE_ERROR( "pin attributes do not define a valid pin shape", aReader, line );
}
}
@ -3976,47 +4018,47 @@ void SCH_LEGACY_PLUGIN_CACHE::savePin( LIB_PIN* aPin,
switch( aPin->GetType() )
{
default:
case PIN_INPUT:
case ELECTRICAL_PINTYPE::PT_INPUT:
Etype = 'I';
break;
case PIN_OUTPUT:
case ELECTRICAL_PINTYPE::PT_OUTPUT:
Etype = 'O';
break;
case PIN_BIDI:
case ELECTRICAL_PINTYPE::PT_BIDI:
Etype = 'B';
break;
case PIN_TRISTATE:
case ELECTRICAL_PINTYPE::PT_TRISTATE:
Etype = 'T';
break;
case PIN_PASSIVE:
case ELECTRICAL_PINTYPE::PT_PASSIVE:
Etype = 'P';
break;
case PIN_UNSPECIFIED:
case ELECTRICAL_PINTYPE::PT_UNSPECIFIED:
Etype = 'U';
break;
case PIN_POWER_IN:
case ELECTRICAL_PINTYPE::PT_POWER_IN:
Etype = 'W';
break;
case PIN_POWER_OUT:
case ELECTRICAL_PINTYPE::PT_POWER_OUT:
Etype = 'w';
break;
case PIN_OPENCOLLECTOR:
case ELECTRICAL_PINTYPE::PT_OPENCOLLECTOR:
Etype = 'C';
break;
case PIN_OPENEMITTER:
case ELECTRICAL_PINTYPE::PT_OPENEMITTER:
Etype = 'E';
break;
case PIN_NC:
case ELECTRICAL_PINTYPE::PT_NC:
Etype = 'N';
break;
}
@ -4033,7 +4075,7 @@ void SCH_LEGACY_PLUGIN_CACHE::savePin( LIB_PIN* aPin,
Iu2Mils( aPin->GetNumberTextSize() ), Iu2Mils( aPin->GetNameTextSize() ),
aPin->GetUnit(), aPin->GetConvert(), Etype );
if( aPin->GetShape() || !aPin->IsVisible() )
if( aPin->GetShape() != GRAPHIC_PINSHAPE::LINE || !aPin->IsVisible() )
aFormatter.Print( 0, " " );
if( !aPin->IsVisible() )
@ -4041,38 +4083,38 @@ void SCH_LEGACY_PLUGIN_CACHE::savePin( LIB_PIN* aPin,
switch( aPin->GetShape() )
{
case PINSHAPE_LINE:
case GRAPHIC_PINSHAPE::LINE:
break;
case PINSHAPE_INVERTED:
case GRAPHIC_PINSHAPE::INVERTED:
aFormatter.Print( 0, "I" );
break;
case PINSHAPE_CLOCK:
case GRAPHIC_PINSHAPE::CLOCK:
aFormatter.Print( 0, "C" );
break;
case PINSHAPE_INVERTED_CLOCK:
case GRAPHIC_PINSHAPE::INVERTED_CLOCK:
aFormatter.Print( 0, "IC" );
break;
case PINSHAPE_INPUT_LOW:
case GRAPHIC_PINSHAPE::INPUT_LOW:
aFormatter.Print( 0, "L" );
break;
case PINSHAPE_CLOCK_LOW:
case GRAPHIC_PINSHAPE::CLOCK_LOW:
aFormatter.Print( 0, "CL" );
break;
case PINSHAPE_OUTPUT_LOW:
case GRAPHIC_PINSHAPE::OUTPUT_LOW:
aFormatter.Print( 0, "V" );
break;
case PINSHAPE_FALLING_EDGE_CLOCK:
case GRAPHIC_PINSHAPE::FALLING_EDGE_CLOCK:
aFormatter.Print( 0, "F" );
break;
case PINSHAPE_NONLOGIC:
case GRAPHIC_PINSHAPE::NONLOGIC:
aFormatter.Print( 0, "X" );
break;

View File

@ -673,11 +673,11 @@ void SCH_LINE::GetNetListItem( NETLIST_OBJECT_LIST& aNetListItems,
if( GetLayer() == LAYER_BUS )
{
item->m_Type = NET_BUS;
item->m_Type = NETLIST_ITEM::BUS;
}
else /* WIRE */
{
item->m_Type = NET_SEGMENT;
item->m_Type = NETLIST_ITEM::SEGMENT;
}
aNetListItems.push_back( item );

View File

@ -146,7 +146,7 @@ void SCH_NO_CONNECT::GetNetListItem( NETLIST_OBJECT_LIST& aNetListItems,
item->m_SheetPath = *aSheetPath;
item->m_SheetPathInclude = *aSheetPath;
item->m_Comp = this;
item->m_Type = NET_NOCONNECT;
item->m_Type = NETLIST_ITEM::NOCONNECT;
item->m_Start = item->m_End = m_pos;
aNetListItems.push_back( item );

View File

@ -715,7 +715,7 @@ void SCH_PAINTER::draw( LIB_PIN *aPin, int aLayer )
const int diam = radius*2;
const int clock_size = InternalPinDecoSize( *aPin );
if( aPin->GetType() == PIN_NC ) // Draw a N.C. symbol
if( aPin->GetType() == ELECTRICAL_PINTYPE::PT_NC ) // Draw a N.C. symbol
{
m_gal->DrawLine( p0, pos );
@ -730,16 +730,16 @@ void SCH_PAINTER::draw( LIB_PIN *aPin, int aLayer )
{
switch( aPin->GetShape() )
{
case PINSHAPE_LINE:
case GRAPHIC_PINSHAPE::LINE:
m_gal->DrawLine( p0, pos );
break;
case PINSHAPE_INVERTED:
case GRAPHIC_PINSHAPE::INVERTED:
m_gal->DrawCircle( p0 + dir * radius, radius );
m_gal->DrawLine( p0 + dir * ( diam ), pos );
break;
case PINSHAPE_INVERTED_CLOCK:
case GRAPHIC_PINSHAPE::INVERTED_CLOCK:
pc = p0 - dir * clock_size ;
triLine( p0 + VECTOR2D( dir.y, -dir.x) * clock_size,
@ -750,8 +750,8 @@ void SCH_PAINTER::draw( LIB_PIN *aPin, int aLayer )
m_gal->DrawLine( p0 + dir * ( diam ), pos );
break;
case PINSHAPE_CLOCK_LOW:
case PINSHAPE_FALLING_EDGE_CLOCK:
case GRAPHIC_PINSHAPE::CLOCK_LOW:
case GRAPHIC_PINSHAPE::FALLING_EDGE_CLOCK:
pc = p0 - dir * clock_size ;
triLine( p0 + VECTOR2D( dir.y, -dir.x) * clock_size,
@ -774,7 +774,7 @@ void SCH_PAINTER::draw( LIB_PIN *aPin, int aLayer )
m_gal->DrawLine( p0, pos );
break;
case PINSHAPE_CLOCK:
case GRAPHIC_PINSHAPE::CLOCK:
m_gal->DrawLine( p0, pos );
if( !dir.y )
@ -791,7 +791,7 @@ void SCH_PAINTER::draw( LIB_PIN *aPin, int aLayer )
}
break;
case PINSHAPE_INPUT_LOW:
case GRAPHIC_PINSHAPE::INPUT_LOW:
m_gal->DrawLine( p0, pos );
if( !dir.y )
@ -808,7 +808,7 @@ void SCH_PAINTER::draw( LIB_PIN *aPin, int aLayer )
}
break;
case PINSHAPE_OUTPUT_LOW: // IEEE symbol "Active Low Output"
case GRAPHIC_PINSHAPE::OUTPUT_LOW: // IEEE symbol "Active Low Output"
m_gal->DrawLine( p0, pos );
if( !dir.y ) // Horizontal pin
@ -817,7 +817,7 @@ void SCH_PAINTER::draw( LIB_PIN *aPin, int aLayer )
m_gal->DrawLine( p0 - VECTOR2D( diam, 0 ), p0 + VECTOR2D( 0, dir.y ) * diam );
break;
case PINSHAPE_NONLOGIC: // NonLogic pin symbol
case GRAPHIC_PINSHAPE::NONLOGIC: // NonLogic pin symbol
m_gal->DrawLine( p0, pos );
m_gal->DrawLine( p0 - VECTOR2D( dir.x + dir.y, dir.y - dir.x ) * radius,

View File

@ -839,7 +839,7 @@ void SCH_SHEET::GetNetListItem( NETLIST_OBJECT_LIST& aNetListItems,
item->m_SheetPath = *aSheetPath;
item->m_Comp = sheetPin;
item->m_Link = this;
item->m_Type = NET_SHEETLABEL;
item->m_Type = NETLIST_ITEM::SHEETLABEL;
item->m_Label = sheetPin->GetText();
item->m_Start = item->m_End = sheetPin->GetPosition();
aNetListItems.push_back( item );

View File

@ -101,7 +101,7 @@ SCH_TEXT::SCH_TEXT( const wxPoint& pos, const wxString& text, KICAD_T aType )
{
m_Layer = LAYER_NOTES;
m_isDangling = false;
m_connectionType = CONNECTION_NONE;
m_connectionType = CONNECTION_TYPE::NONE;
m_spin_style = LABEL_SPIN_STYLE::LEFT;
SetTextPos( pos );
@ -318,7 +318,7 @@ bool SCH_TEXT::UpdateDanglingState( std::vector<DANGLING_END_ITEM>& aItemList )
bool previousState = m_isDangling;
m_isDangling = true;
m_connectionType = CONNECTION_NONE;
m_connectionType = CONNECTION_TYPE::NONE;
for( unsigned ii = 0; ii < aItemList.size(); ii++ )
{
@ -345,7 +345,7 @@ bool SCH_TEXT::UpdateDanglingState( std::vector<DANGLING_END_ITEM>& aItemList )
case BUS_START_END:
m_connectionType = CONNECTION_BUS;
m_connectionType = CONNECTION_TYPE::BUS;
// fall through
case WIRE_START_END:
@ -362,8 +362,8 @@ bool SCH_TEXT::UpdateDanglingState( std::vector<DANGLING_END_ITEM>& aItemList )
if( !m_isDangling )
{
if( m_connectionType != CONNECTION_BUS )
m_connectionType = CONNECTION_NET;
if( m_connectionType != CONNECTION_TYPE::BUS )
m_connectionType = CONNECTION_TYPE::NET;
// Add the line to the connected items, since it won't be picked
// up by a search of intersecting connection points
@ -383,7 +383,7 @@ bool SCH_TEXT::UpdateDanglingState( std::vector<DANGLING_END_ITEM>& aItemList )
}
if( m_isDangling )
m_connectionType = CONNECTION_NONE;
m_connectionType = CONNECTION_TYPE::NONE;
return previousState != m_isDangling;
}
@ -448,12 +448,12 @@ void SCH_TEXT::GetNetListItem( NETLIST_OBJECT_LIST& aNetListItems,
item->m_SheetPath = *aSheetPath;
item->m_SheetPathInclude = *aSheetPath;
item->m_Comp = (SCH_ITEM*) this;
item->m_Type = NET_LABEL;
item->m_Type = NETLIST_ITEM::LABEL;
if( GetLayer() == LAYER_GLOBLABEL )
item->m_Type = NET_GLOBLABEL;
item->m_Type = NETLIST_ITEM::GLOBLABEL;
else if( GetLayer() == LAYER_HIERLABEL )
item->m_Type = NET_HIERLABEL;
item->m_Type = NETLIST_ITEM::HIERLABEL;
item->m_Label = GetText();
item->m_Start = item->m_End = GetTextPos();

View File

@ -33,9 +33,9 @@
#include "lib_pin_tool.h"
static ELECTRICAL_PINTYPE g_LastPinType = PIN_INPUT;
static ELECTRICAL_PINTYPE g_LastPinType = ELECTRICAL_PINTYPE::PT_INPUT;
static int g_LastPinOrient = PIN_RIGHT;
static GRAPHIC_PINSHAPE g_LastPinShape = PINSHAPE_LINE;
static GRAPHIC_PINSHAPE g_LastPinShape = GRAPHIC_PINSHAPE::LINE;
static bool g_LastPinCommonConvert = false;
static bool g_LastPinCommonUnit = false;
static bool g_LastPinVisible = true;

View File

@ -152,7 +152,7 @@ private:
int id = ID_POPUP_SCH_UNFOLD_BUS + ( idx++ );
wxString name = member->LocalName();
if( member->Type() == CONNECTION_BUS )
if( member->Type() == CONNECTION_TYPE::BUS )
{
ACTION_MENU* submenu = new ACTION_MENU( true );
AppendSubMenu( submenu, name );

View File

@ -42,7 +42,7 @@ PinShapeComboBox::PinShapeComboBox( wxWindow* parent,
const wxString& name ) :
wxBitmapComboBox( parent, id, value, pos, size, n, choices, style, validator, name )
{
for( unsigned ii = 0; ii < PINSHAPE_COUNT; ++ii )
for( unsigned ii = 0; ii < GRAPHIC_PINSHAPES_TOTAL; ++ii )
{
GRAPHIC_PINSHAPE shape = static_cast<GRAPHIC_PINSHAPE>( ii );
@ -65,5 +65,5 @@ GRAPHIC_PINSHAPE PinShapeComboBox::GetPinShapeSelection()
void PinShapeComboBox::SetSelection( GRAPHIC_PINSHAPE aShape )
{
wxBitmapComboBox::SetSelection( aShape );
wxBitmapComboBox::SetSelection( static_cast<int>( aShape ) );
}

View File

@ -42,7 +42,7 @@ PinTypeComboBox::PinTypeComboBox( wxWindow* parent,
const wxString& name ) :
wxBitmapComboBox( parent, id, value, pos, size, n, choices, style, validator, name )
{
for( unsigned ii = 0; ii < PINTYPE_COUNT; ++ii )
for( unsigned ii = 0; ii < ELECTRICAL_PINTYPES_TOTAL; ++ii )
{
ELECTRICAL_PINTYPE type = static_cast<ELECTRICAL_PINTYPE>( ii );
@ -65,5 +65,5 @@ ELECTRICAL_PINTYPE PinTypeComboBox::GetPinTypeSelection()
void PinTypeComboBox::SetSelection( ELECTRICAL_PINTYPE aType )
{
wxBitmapComboBox::SetSelection( aType );
wxBitmapComboBox::SetSelection( static_cast<int>( aType ) );
}

View File

@ -50,7 +50,7 @@ public:
// give the pin some kind of data we can use to test
m_lib_pin.SetNumber( "42" );
m_lib_pin.SetName( "pinname" );
m_lib_pin.SetType( ELECTRICAL_PINTYPE::PIN_INPUT );
m_lib_pin.SetType( ELECTRICAL_PINTYPE::PT_INPUT );
SCH_SHEET_PATH path;
m_parent_comp.SetRef( &path, "U2" );
@ -84,7 +84,9 @@ BOOST_AUTO_TEST_CASE( DefaultProperties )
BOOST_CHECK_EQUAL( m_sch_pin.IsVisible(), m_lib_pin.IsVisible() );
BOOST_CHECK_EQUAL( m_sch_pin.GetName(), m_lib_pin.GetName() );
BOOST_CHECK_EQUAL( m_sch_pin.GetNumber(), m_lib_pin.GetNumber() );
BOOST_CHECK_EQUAL( m_sch_pin.GetType(), m_lib_pin.GetType() );
BOOST_CHECK( ( m_sch_pin.GetType() == m_lib_pin.GetType() ) );
BOOST_CHECK_EQUAL( m_sch_pin.IsPowerConnection(), m_lib_pin.IsPowerConnection() );
}
@ -147,7 +149,7 @@ BOOST_AUTO_TEST_CASE( PinNumbering )
BOOST_AUTO_TEST_CASE( PinNumberingPower )
{
// but if we set is power...
m_lib_pin.SetType( ELECTRICAL_PINTYPE::PIN_POWER_IN );
m_lib_pin.SetType( ELECTRICAL_PINTYPE::PT_POWER_IN );
m_parent_part.SetPower();
// the name is just the pin name