From 292a9fadd960985f51c78f38f3c31e48eba14cbd Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Sat, 11 Apr 2020 21:55:49 +0100 Subject: [PATCH] Allow a click in the value field when searching for power nodes. Fixes https://gitlab.com/kicad/code/kicad/issues/4180 --- eeschema/sch_component.cpp | 3 ++- eeschema/tools/sch_editor_control.cpp | 9 +++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/eeschema/sch_component.cpp b/eeschema/sch_component.cpp index 5877e560b2..8c479d1283 100644 --- a/eeschema/sch_component.cpp +++ b/eeschema/sch_component.cpp @@ -1587,7 +1587,8 @@ SEARCH_RESULT SCH_COMPONENT::Visit( INSPECTOR aInspector, void* aTestData, 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 ) ) return SEARCH_RESULT::QUIT; diff --git a/eeschema/tools/sch_editor_control.cpp b/eeschema/tools/sch_editor_control.cpp index 1ee8efe82c..10e2501d94 100644 --- a/eeschema/tools/sch_editor_control.cpp +++ b/eeschema/tools/sch_editor_control.cpp @@ -711,8 +711,13 @@ static bool highlightNet( TOOL_MANAGER* aToolMgr, const VECTOR2D& aPosition ) } else { - SCH_ITEM* item = static_cast( selTool->GetNode( aPosition ) ); - SCH_COMPONENT* comp = dynamic_cast( item ); + SCH_ITEM* item = static_cast( selTool->GetNode( aPosition ) ); + SCH_COMPONENT* comp = nullptr; + + if( item->Type() == SCH_FIELD_T ) + comp = dynamic_cast( item->GetParent() ); + else + comp = dynamic_cast( item ); if( comp && comp->GetPartRef() && comp->GetPartRef()->IsPower() ) netName = comp->GetPartRef()->GetName();