Fix a pair of bugs in the new highlight net logic.
Fixes https://gitlab.com/kicad/code/kicad/issues/4180
This commit is contained in:
parent
a8b025ab06
commit
c4994eee7b
|
@ -1241,13 +1241,9 @@ EDA_RECT SCH_COMPONENT::GetBodyBoundingBox() const
|
||||||
EDA_RECT bBox;
|
EDA_RECT bBox;
|
||||||
|
|
||||||
if( m_part )
|
if( m_part )
|
||||||
{
|
|
||||||
bBox = m_part->GetBodyBoundingBox( m_unit, m_convert );
|
bBox = m_part->GetBodyBoundingBox( m_unit, m_convert );
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
|
||||||
bBox = dummy()->GetBodyBoundingBox( m_unit, m_convert );
|
bBox = dummy()->GetBodyBoundingBox( m_unit, m_convert );
|
||||||
}
|
|
||||||
|
|
||||||
int x0 = bBox.GetX();
|
int x0 = bBox.GetX();
|
||||||
int xm = bBox.GetRight();
|
int xm = bBox.GetRight();
|
||||||
|
@ -1279,8 +1275,8 @@ const EDA_RECT SCH_COMPONENT::GetBoundingBox() const
|
||||||
{
|
{
|
||||||
EDA_RECT bbox = GetBodyBoundingBox();
|
EDA_RECT bbox = GetBodyBoundingBox();
|
||||||
|
|
||||||
for( size_t i = 0; i < m_Fields.size(); i++ )
|
for( const SCH_FIELD& field : m_Fields )
|
||||||
bbox.Merge( m_Fields[i].GetBoundingBox() );
|
bbox.Merge( field.GetBoundingBox() );
|
||||||
|
|
||||||
return bbox;
|
return bbox;
|
||||||
}
|
}
|
||||||
|
@ -1462,7 +1458,7 @@ bool SCH_COMPONENT::UpdateDanglingState( std::vector<DANGLING_END_ITEM>& aItemLi
|
||||||
{
|
{
|
||||||
bool changed = false;
|
bool changed = false;
|
||||||
|
|
||||||
for( auto& pin : m_pins )
|
for( std::unique_ptr<SCH_PIN>& pin : m_pins )
|
||||||
{
|
{
|
||||||
bool previousState = pin->IsDangling();
|
bool previousState = pin->IsDangling();
|
||||||
pin->SetIsDangling( true );
|
pin->SetIsDangling( true );
|
||||||
|
@ -1519,12 +1515,12 @@ wxPoint SCH_COMPONENT::GetPinPhysicalPosition( const LIB_PIN* Pin ) const
|
||||||
|
|
||||||
void SCH_COMPONENT::GetConnectionPoints( std::vector< wxPoint >& aPoints ) const
|
void SCH_COMPONENT::GetConnectionPoints( std::vector< wxPoint >& aPoints ) const
|
||||||
{
|
{
|
||||||
for( const auto& pin : m_pins )
|
for( const std::unique_ptr<SCH_PIN>& pin : m_pins )
|
||||||
{
|
{
|
||||||
// Collect only pins attached to the current unit and convert.
|
// Collect only pins attached to the current unit and convert.
|
||||||
// others are not associated to this component instance
|
// others are not associated to this component instance
|
||||||
int pin_unit = pin.get()->GetLibPin()->GetUnit();
|
int pin_unit = pin->GetLibPin()->GetUnit();
|
||||||
int pin_convert = pin.get()->GetLibPin()->GetConvert();
|
int pin_convert = pin->GetLibPin()->GetConvert();
|
||||||
|
|
||||||
if( pin_unit > 0 && pin_unit != GetUnit() )
|
if( pin_unit > 0 && pin_unit != GetUnit() )
|
||||||
continue;
|
continue;
|
||||||
|
@ -1568,8 +1564,9 @@ SEARCH_RESULT SCH_COMPONENT::Visit( INSPECTOR aInspector, void* aTestData,
|
||||||
|
|
||||||
for( const KICAD_T* p = aFilterTypes; (stype = *p) != EOT; ++p )
|
for( const KICAD_T* p = aFilterTypes; (stype = *p) != EOT; ++p )
|
||||||
{
|
{
|
||||||
// If caller wants to inspect component type or and component children types.
|
if( stype == SCH_LOCATE_ANY_T
|
||||||
if( stype == SCH_LOCATE_ANY_T || stype == Type() )
|
|| ( stype == SCH_COMPONENT_T )
|
||||||
|
|| ( stype == SCH_COMPONENT_LOCATE_POWER_T && m_part && m_part->IsPower() ) )
|
||||||
{
|
{
|
||||||
if( SEARCH_RESULT::QUIT == aInspector( this, aTestData ) )
|
if( SEARCH_RESULT::QUIT == aInspector( this, aTestData ) )
|
||||||
return SEARCH_RESULT::QUIT;
|
return SEARCH_RESULT::QUIT;
|
||||||
|
@ -1577,7 +1574,6 @@ SEARCH_RESULT SCH_COMPONENT::Visit( INSPECTOR aInspector, void* aTestData,
|
||||||
|
|
||||||
if( stype == SCH_LOCATE_ANY_T || stype == SCH_FIELD_T )
|
if( stype == SCH_LOCATE_ANY_T || stype == SCH_FIELD_T )
|
||||||
{
|
{
|
||||||
// Test the bounding boxes of fields if they are visible and not empty.
|
|
||||||
for( SCH_FIELD& field : m_Fields )
|
for( SCH_FIELD& field : m_Fields )
|
||||||
{
|
{
|
||||||
if( SEARCH_RESULT::QUIT == aInspector( &field, (void*) this ) )
|
if( SEARCH_RESULT::QUIT == aInspector( &field, (void*) this ) )
|
||||||
|
@ -1611,12 +1607,12 @@ SEARCH_RESULT SCH_COMPONENT::Visit( INSPECTOR aInspector, void* aTestData,
|
||||||
|
|
||||||
if( stype == SCH_LOCATE_ANY_T || stype == SCH_PIN_T )
|
if( stype == SCH_LOCATE_ANY_T || stype == SCH_PIN_T )
|
||||||
{
|
{
|
||||||
for( auto& pin : m_pins )
|
for( const std::unique_ptr<SCH_PIN>& pin : m_pins )
|
||||||
{
|
{
|
||||||
// Collect only pins attached to the current unit and convert.
|
// Collect only pins attached to the current unit and convert.
|
||||||
// others are not associated to this component instance
|
// others are not associated to this component instance
|
||||||
int pin_unit = pin.get()->GetLibPin()->GetUnit();
|
int pin_unit = pin->GetLibPin()->GetUnit();
|
||||||
int pin_convert = pin.get()->GetLibPin()->GetConvert();
|
int pin_convert = pin->GetLibPin()->GetConvert();
|
||||||
|
|
||||||
if( pin_unit > 0 && pin_unit != GetUnit() )
|
if( pin_unit > 0 && pin_unit != GetUnit() )
|
||||||
continue;
|
continue;
|
||||||
|
|
|
@ -788,6 +788,7 @@ bool EE_SELECTION_TOOL::selectMultiple()
|
||||||
|
|
||||||
static KICAD_T nodeTypes[] =
|
static KICAD_T nodeTypes[] =
|
||||||
{
|
{
|
||||||
|
SCH_COMPONENT_LOCATE_POWER_T,
|
||||||
SCH_PIN_T,
|
SCH_PIN_T,
|
||||||
SCH_LINE_LOCATE_WIRE_T,
|
SCH_LINE_LOCATE_WIRE_T,
|
||||||
SCH_LINE_LOCATE_BUS_T,
|
SCH_LINE_LOCATE_BUS_T,
|
||||||
|
|
|
@ -790,7 +790,7 @@ int SCH_EDITOR_CONTROL::UpdateNetHighlighting( const TOOL_EVENT& aEvent )
|
||||||
itemConnectionName = connection->Name();
|
itemConnectionName = connection->Name();
|
||||||
}
|
}
|
||||||
|
|
||||||
if( itemConnectionName == selectedNetName )
|
if( !selectedNetName.IsEmpty() && itemConnectionName == selectedNetName )
|
||||||
item->SetBrightened();
|
item->SetBrightened();
|
||||||
else
|
else
|
||||||
item->ClearBrightened();
|
item->ClearBrightened();
|
||||||
|
|
|
@ -124,8 +124,7 @@ enum KICAD_T
|
||||||
SCH_PIN_T,
|
SCH_PIN_T,
|
||||||
|
|
||||||
// Be prudent with these types:
|
// Be prudent with these types:
|
||||||
// they should be used only to locate a specific field type
|
// they should be used only to locate a specific field type among SCH_FIELD_Ts
|
||||||
// among SCH_FIELD_T items types
|
|
||||||
// N.B. If you add a type here, be sure to add it below to the BaseType()
|
// N.B. If you add a type here, be sure to add it below to the BaseType()
|
||||||
SCH_FIELD_LOCATE_REFERENCE_T,
|
SCH_FIELD_LOCATE_REFERENCE_T,
|
||||||
SCH_FIELD_LOCATE_VALUE_T,
|
SCH_FIELD_LOCATE_VALUE_T,
|
||||||
|
@ -141,6 +140,9 @@ enum KICAD_T
|
||||||
SCH_LABEL_LOCATE_WIRE_T,
|
SCH_LABEL_LOCATE_WIRE_T,
|
||||||
SCH_LABEL_LOCATE_BUS_T,
|
SCH_LABEL_LOCATE_BUS_T,
|
||||||
|
|
||||||
|
// Same for picking components which are power symbols
|
||||||
|
SCH_COMPONENT_LOCATE_POWER_T,
|
||||||
|
|
||||||
// matches any type
|
// matches any type
|
||||||
SCH_LOCATE_ANY_T,
|
SCH_LOCATE_ANY_T,
|
||||||
|
|
||||||
|
@ -230,6 +232,9 @@ constexpr KICAD_T BaseType( const KICAD_T aType )
|
||||||
case SCH_LABEL_LOCATE_BUS_T:
|
case SCH_LABEL_LOCATE_BUS_T:
|
||||||
return SCH_LABEL_T;
|
return SCH_LABEL_T;
|
||||||
|
|
||||||
|
case SCH_COMPONENT_LOCATE_POWER_T:
|
||||||
|
return SCH_COMPONENT_T;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return aType;
|
return aType;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue