diff --git a/eeschema/ee_collectors.cpp b/eeschema/ee_collectors.cpp index 0ccf41b568..53105de908 100644 --- a/eeschema/ee_collectors.cpp +++ b/eeschema/ee_collectors.cpp @@ -95,7 +95,7 @@ SEARCH_RESULT EE_COLLECTOR::Inspect( EDA_ITEM* aItem, void* aTestData ) void EE_COLLECTOR::Collect( SCH_SCREEN* aScreen, const KICAD_T aFilterList[], const wxPoint& aPos, - int aUnit, int aConvert ) + int aUnit, int aConvert ) { Empty(); // empty the collection just in case @@ -108,9 +108,33 @@ void EE_COLLECTOR::Collect( SCH_SCREEN* aScreen, const KICAD_T aFilterList[], co if( aScreen ) { + // Components and sheets own their own children so have to be visited even if + // they're not in the filter list + bool componentsVisited = false; + bool sheetsVisited = false; + for( const KICAD_T* filter = aFilterList; *filter != EOT; ++filter ) { - for( auto item : aScreen->Items().OfType( *filter ) ) + for( SCH_ITEM* item : aScreen->Items().OfType( *filter ) ) + { + if( *filter == SCH_COMPONENT_T ) + componentsVisited = true; + else if( *filter == SCH_SHEET_T ) + sheetsVisited = true; + + item->Visit( m_inspector, nullptr, m_ScanTypes ); + } + } + + if( !componentsVisited ) + { + for( SCH_ITEM* item : aScreen->Items().OfType( SCH_COMPONENT_T ) ) + item->Visit( m_inspector, nullptr, m_ScanTypes ); + } + + if( !sheetsVisited ) + { + for( SCH_ITEM* item : aScreen->Items().OfType( SCH_SHEET_T ) ) item->Visit( m_inspector, nullptr, m_ScanTypes ); } } @@ -118,7 +142,7 @@ void EE_COLLECTOR::Collect( SCH_SCREEN* aScreen, const KICAD_T aFilterList[], co void EE_COLLECTOR::Collect( LIB_ITEMS_CONTAINER& aItems, const KICAD_T aFilterList[], - const wxPoint& aPos, int aUnit, int aConvert ) + const wxPoint& aPos, int aUnit, int aConvert ) { Empty(); // empty the collection just in case @@ -158,16 +182,6 @@ bool EE_COLLECTOR::IsCorner() const } -bool EE_COLLECTOR::IsDraggableJunction() const -{ - for( size_t i = 0; i < m_List.size(); i++ ) - if( ( (SCH_ITEM*) m_List[ i ] )->Type() == SCH_JUNCTION_T ) - return true; - - return false; -} - - void CollectOtherUnits( SCH_SHEET_PATH& aSheet, SCH_COMPONENT* aUnit, std::vector* otherUnits ) { diff --git a/eeschema/ee_collectors.h b/eeschema/ee_collectors.h index 86d5b13459..9e29bd19d9 100644 --- a/eeschema/ee_collectors.h +++ b/eeschema/ee_collectors.h @@ -105,21 +105,6 @@ public: */ bool IsCorner() const; - /** - * Function IsDraggableJunction - * tests to see if the collected items form a draggable junction. - *

- * Daggable junctions are defined as: - *

- *

- * @return True if the collection is a draggable junction. - */ - bool IsDraggableJunction() const; - public: int m_Unit; // Fixed symbol unit filter (for symbol editor) int m_Convert; // Fixed DeMorgan filter (for symbol editor) diff --git a/eeschema/tools/ee_selection_tool.cpp b/eeschema/tools/ee_selection_tool.cpp index 233cd4473d..319e7a1796 100644 --- a/eeschema/tools/ee_selection_tool.cpp +++ b/eeschema/tools/ee_selection_tool.cpp @@ -788,6 +788,7 @@ bool EE_SELECTION_TOOL::selectMultiple() static KICAD_T nodeTypes[] = { + SCH_PIN_T, SCH_LINE_LOCATE_WIRE_T, SCH_LINE_LOCATE_BUS_T, SCH_BUS_WIRE_ENTRY_T, diff --git a/eeschema/tools/sch_editor_control.cpp b/eeschema/tools/sch_editor_control.cpp index 2693fa55d4..449208933a 100644 --- a/eeschema/tools/sch_editor_control.cpp +++ b/eeschema/tools/sch_editor_control.cpp @@ -711,9 +711,12 @@ static bool highlightNet( TOOL_MANAGER* aToolMgr, const VECTOR2D& aPosition ) } else { - SCH_ITEM* item = (SCH_ITEM*) selTool->GetNode( aPosition ); + SCH_ITEM* item = static_cast( selTool->GetNode( aPosition ) ); + SCH_COMPONENT* comp = dynamic_cast( item ); - if( item && item->Connection( *g_CurrentSheet ) ) + if( comp && comp->GetPartRef() && comp->GetPartRef()->IsPower() ) + netName = comp->GetPartRef()->GetName(); + else if( item && item->Connection( *g_CurrentSheet ) ) netName = item->Connection( *g_CurrentSheet )->Name(); } } @@ -768,10 +771,26 @@ int SCH_EDITOR_CONTROL::UpdateNetHighlighting( const TOOL_EVENT& aEvent ) for( SCH_ITEM* item : screen->Items() ) { - SCH_CONNECTION* conn = item->Connection( *g_CurrentSheet ); + wxString itemConnectionName; + SCH_COMPONENT* comp = nullptr; bool redraw = item->IsBrightened(); - if( conn && conn->Name() == selectedNetName ) + if( item->Type() == SCH_COMPONENT_T ) + comp = static_cast( item ); + + if( comp && comp->GetPartRef() && comp->GetPartRef()->IsPower() ) + { + itemConnectionName = comp->GetPartRef()->GetName(); + } + else + { + SCH_CONNECTION* connection = item->Connection( *g_CurrentSheet ); + + if( connection ) + itemConnectionName = connection->Name(); + } + + if( itemConnectionName == selectedNetName ) item->SetBrightened(); else item->ClearBrightened(); @@ -780,8 +799,6 @@ int SCH_EDITOR_CONTROL::UpdateNetHighlighting( const TOOL_EVENT& aEvent ) if( item->Type() == SCH_COMPONENT_T ) { - SCH_COMPONENT* comp = static_cast( item ); - redraw |= comp->HasBrightenedPins(); comp->ClearBrightenedPins(); @@ -798,6 +815,19 @@ int SCH_EDITOR_CONTROL::UpdateNetHighlighting( const TOOL_EVENT& aEvent ) redraw = true; } } + + if( comp->GetPartRef() && comp->GetPartRef()->IsPower() ) + { + std::vector& fields = comp->GetFields(); + + for( int id : { REFERENCE, VALUE } ) + { + if( item->IsBrightened() && fields[id].IsVisible() ) + fields[id].SetBrightened(); + else + fields[id].ClearBrightened(); + } + } } else if( item->Type() == SCH_SHEET_T ) {