Allow a click in the value field when searching for power nodes.

Fixes https://gitlab.com/kicad/code/kicad/issues/4180
This commit is contained in:
Jeff Young 2020-04-11 21:55:49 +01:00
parent 350696ecdd
commit 292a9fadd9
2 changed files with 9 additions and 3 deletions

View File

@ -1587,7 +1587,8 @@ SEARCH_RESULT SCH_COMPONENT::Visit( INSPECTOR aInspector, void* aTestData,
return SEARCH_RESULT::QUIT; return SEARCH_RESULT::QUIT;
} }
if( stype == SCH_FIELD_LOCATE_VALUE_T ) if( stype == SCH_FIELD_LOCATE_VALUE_T
|| ( stype == SCH_COMPONENT_LOCATE_POWER_T && m_part && m_part->IsPower() ) )
{ {
if( SEARCH_RESULT::QUIT == aInspector( GetField( VALUE ), (void*) this ) ) if( SEARCH_RESULT::QUIT == aInspector( GetField( VALUE ), (void*) this ) )
return SEARCH_RESULT::QUIT; return SEARCH_RESULT::QUIT;

View File

@ -711,8 +711,13 @@ static bool highlightNet( TOOL_MANAGER* aToolMgr, const VECTOR2D& aPosition )
} }
else else
{ {
SCH_ITEM* item = static_cast<SCH_ITEM*>( selTool->GetNode( aPosition ) ); SCH_ITEM* item = static_cast<SCH_ITEM*>( selTool->GetNode( aPosition ) );
SCH_COMPONENT* comp = dynamic_cast<SCH_COMPONENT*>( item ); SCH_COMPONENT* comp = nullptr;
if( item->Type() == SCH_FIELD_T )
comp = dynamic_cast<SCH_COMPONENT*>( item->GetParent() );
else
comp = dynamic_cast<SCH_COMPONENT*>( item );
if( comp && comp->GetPartRef() && comp->GetPartRef()->IsPower() ) if( comp && comp->GetPartRef() && comp->GetPartRef()->IsPower() )
netName = comp->GetPartRef()->GetName(); netName = comp->GetPartRef()->GetName();