diff --git a/eeschema/block.cpp b/eeschema/block.cpp index 0be01f4bec..a67b990de5 100644 --- a/eeschema/block.cpp +++ b/eeschema/block.cpp @@ -254,6 +254,21 @@ bool SCH_EDIT_FRAME::HandleBlockEnd( wxDC* aDC ) nextcmd = true; block->SetState( STATE_BLOCK_MOVE ); + // Mark dangling pins at the edges of the block: + std::vector internalPoints; + + for( unsigned i = 0; i < block->GetCount(); ++i ) + { + auto item = static_cast( block->GetItem( i ) ); + item->GetEndPoints( internalPoints ); + } + + for( unsigned i = 0; i < block->GetCount(); ++i ) + { + auto item = static_cast( block->GetItem( i ) ); + item->UpdateDanglingState( internalPoints ); + } + m_canvas->SetMouseCaptureCallback( DrawMovingBlockOutlines ); m_canvas->CallMouseCapture( aDC, wxDefaultPosition, false ); } diff --git a/eeschema/bus-wire-junction.cpp b/eeschema/bus-wire-junction.cpp index 37e1110ab6..997f9b5af2 100644 --- a/eeschema/bus-wire-junction.cpp +++ b/eeschema/bus-wire-junction.cpp @@ -278,7 +278,7 @@ bool SCH_EDIT_FRAME::TestDanglingEnds() for( SCH_ITEM* item = GetScreen()->GetDrawList().begin(); item; item = item->Next() ) { - if( item->IsDanglingStateChanged( endPoints ) ) + if( item->UpdateDanglingState( endPoints ) ) { GetCanvas()->GetView()->Update( item, KIGFX::REPAINT ); hasStateChanged = true; diff --git a/eeschema/sch_bus_entry.cpp b/eeschema/sch_bus_entry.cpp index b8f7dd9c2f..5faa48e861 100644 --- a/eeschema/sch_bus_entry.cpp +++ b/eeschema/sch_bus_entry.cpp @@ -209,7 +209,7 @@ void SCH_BUS_ENTRY_BASE::Rotate( wxPoint aPosition ) } -bool SCH_BUS_WIRE_ENTRY::IsDanglingStateChanged( std::vector& aItemList ) +bool SCH_BUS_WIRE_ENTRY::UpdateDanglingState( std::vector& aItemList ) { bool previousStateStart = m_isDanglingStart; bool previousStateEnd = m_isDanglingEnd; @@ -275,7 +275,7 @@ bool SCH_BUS_WIRE_ENTRY::IsDanglingStateChanged( std::vector& } -bool SCH_BUS_BUS_ENTRY::IsDanglingStateChanged( std::vector& aItemList ) +bool SCH_BUS_BUS_ENTRY::UpdateDanglingState( std::vector& aItemList ) { bool previousStateStart = m_isDanglingStart; bool previousStateEnd = m_isDanglingEnd; diff --git a/eeschema/sch_bus_entry.h b/eeschema/sch_bus_entry.h index ad50c418b7..967f49bf0d 100644 --- a/eeschema/sch_bus_entry.h +++ b/eeschema/sch_bus_entry.h @@ -159,7 +159,7 @@ public: BITMAP_DEF GetMenuImage() const override; - bool IsDanglingStateChanged( std::vector& aItemList ) override; + bool UpdateDanglingState( std::vector& aItemList ) override; }; /** @@ -192,7 +192,7 @@ public: BITMAP_DEF GetMenuImage() const override; - bool IsDanglingStateChanged( std::vector& aItemList ) override; + bool UpdateDanglingState( std::vector& aItemList ) override; }; #endif // _SCH_BUS_ENTRY_H_ diff --git a/eeschema/sch_component.cpp b/eeschema/sch_component.cpp index 1db61dffb1..fe2ee3474f 100644 --- a/eeschema/sch_component.cpp +++ b/eeschema/sch_component.cpp @@ -1594,7 +1594,7 @@ void SCH_COMPONENT::GetEndPoints( std::vector & aItemList ) } -bool SCH_COMPONENT::IsDanglingStateChanged( std::vector& aItemList ) +bool SCH_COMPONENT::UpdateDanglingState( std::vector& aItemList ) { bool changed = false; diff --git a/eeschema/sch_component.h b/eeschema/sch_component.h index ac5dfc32f8..386b197ab0 100644 --- a/eeschema/sch_component.h +++ b/eeschema/sch_component.h @@ -573,7 +573,7 @@ public: * * @return true if any pin's state has changed. */ - bool IsDanglingStateChanged( std::vector& aItemList ) override; + bool UpdateDanglingState( std::vector& aItemList ) override; wxPoint GetPinPhysicalPosition( const LIB_PIN* Pin ) const; diff --git a/eeschema/sch_item_struct.h b/eeschema/sch_item_struct.h index f434f1e1c2..94fa464d71 100644 --- a/eeschema/sch_item_struct.h +++ b/eeschema/sch_item_struct.h @@ -260,7 +260,7 @@ public: * @param aItemList - List of items to test item against. * @return True if the dangling state has changed from it's current setting. */ - virtual bool IsDanglingStateChanged( std::vector< DANGLING_END_ITEM >& aItemList ) { return false; } + virtual bool UpdateDanglingState( std::vector& aItemList ) { return false; } virtual bool IsDangling() const { return false; } diff --git a/eeschema/sch_line.cpp b/eeschema/sch_line.cpp index 8689241771..684a84c8cf 100644 --- a/eeschema/sch_line.cpp +++ b/eeschema/sch_line.cpp @@ -94,7 +94,8 @@ SCH_LINE::SCH_LINE( const SCH_LINE& aLine ) : m_size = aLine.m_size; m_style = aLine.m_style; m_color = aLine.m_color; - m_startIsDangling = m_endIsDangling = false; + m_startIsDangling = aLine.m_startIsDangling; + m_endIsDangling = aLine.m_endIsDangling; } @@ -503,7 +504,7 @@ void SCH_LINE::GetEndPoints( std::vector & aItemList ) } -bool SCH_LINE::IsDanglingStateChanged( std::vector< DANGLING_END_ITEM >& aItemList ) +bool SCH_LINE::UpdateDanglingState( std::vector& aItemList ) { bool previousStartState = m_startIsDangling; bool previousEndState = m_endIsDangling; diff --git a/eeschema/sch_line.h b/eeschema/sch_line.h index 22045f6966..d4d8870e7f 100644 --- a/eeschema/sch_line.h +++ b/eeschema/sch_line.h @@ -156,7 +156,7 @@ public: void GetEndPoints( std::vector& aItemList ) override; - bool IsDanglingStateChanged( std::vector< DANGLING_END_ITEM >& aItemList ) override; + bool UpdateDanglingState( std::vector& aItemList ) override; bool IsStartDangling() const { return m_startIsDangling; } bool IsEndDangling() const { return m_endIsDangling; } diff --git a/eeschema/sch_painter.cpp b/eeschema/sch_painter.cpp index 42de76e2f9..3aa447ce1d 100644 --- a/eeschema/sch_painter.cpp +++ b/eeschema/sch_painter.cpp @@ -509,7 +509,7 @@ void SCH_PAINTER::draw( LIB_PIN *aPin, int aLayer, bool isDangling, bool isMovin } else { - if( ( isDangling || isMoving ) && aPin->IsPowerConnection() ) + if( isDangling && aPin->IsPowerConnection() ) drawPinDanglingSymbol( m_gal, pos, color ); return; @@ -631,7 +631,7 @@ void SCH_PAINTER::draw( LIB_PIN *aPin, int aLayer, bool isDangling, bool isMovin pos + VECTOR2D( -1, 1 ) * TARGET_PIN_RADIUS ); } - if( ( isDangling || isMoving ) && ( aPin->IsVisible() || aPin->IsPowerConnection() ) ) + if( isDangling && ( aPin->IsVisible() || aPin->IsPowerConnection() ) ) drawPinDanglingSymbol( m_gal, pos, color ); // Draw the labels diff --git a/eeschema/sch_screen.cpp b/eeschema/sch_screen.cpp index 9c97617244..bd2e3705b2 100644 --- a/eeschema/sch_screen.cpp +++ b/eeschema/sch_screen.cpp @@ -918,7 +918,7 @@ bool SCH_SCREEN::TestDanglingEnds() for( item = m_drawList.begin(); item; item = item->Next() ) { - if( item->IsDanglingStateChanged( endPoints ) ) + if( item->UpdateDanglingState( endPoints ) ) { hasStateChanged = true; } diff --git a/eeschema/sch_sheet.cpp b/eeschema/sch_sheet.cpp index 32f488abf6..a608670ee1 100644 --- a/eeschema/sch_sheet.cpp +++ b/eeschema/sch_sheet.cpp @@ -806,12 +806,12 @@ void SCH_SHEET::GetEndPoints( std::vector & aItemList ) } -bool SCH_SHEET::IsDanglingStateChanged( std::vector< DANGLING_END_ITEM >& aItemList ) +bool SCH_SHEET::UpdateDanglingState( std::vector& aItemList ) { bool changed = false; for( SCH_SHEET_PIN& pinsheet : GetPins() ) - changed |= pinsheet.IsDanglingStateChanged( aItemList ); + changed |= pinsheet.UpdateDanglingState( aItemList ); return changed; } diff --git a/eeschema/sch_sheet.h b/eeschema/sch_sheet.h index 81a02800a2..0529d19e6a 100644 --- a/eeschema/sch_sheet.h +++ b/eeschema/sch_sheet.h @@ -516,7 +516,7 @@ public: void GetEndPoints( std::vector & aItemList ) override; - bool IsDanglingStateChanged( std::vector< DANGLING_END_ITEM >& aItemList ) override; + bool UpdateDanglingState( std::vector& aItemList ) override; bool IsSelectStateChanged( const wxRect& aRect ) override; diff --git a/eeschema/sch_text.cpp b/eeschema/sch_text.cpp index dcc1e66d09..52978649c2 100644 --- a/eeschema/sch_text.cpp +++ b/eeschema/sch_text.cpp @@ -353,7 +353,7 @@ void SCH_TEXT::GetEndPoints( std::vector & aItemList ) } -bool SCH_TEXT::IsDanglingStateChanged( std::vector< DANGLING_END_ITEM >& aItemList ) +bool SCH_TEXT::UpdateDanglingState( std::vector& aItemList ) { // Normal text labels cannot be tested for dangling ends. if( Type() == SCH_TEXT_T ) diff --git a/eeschema/sch_text.h b/eeschema/sch_text.h index 444b4ab594..381a19ffd5 100644 --- a/eeschema/sch_text.h +++ b/eeschema/sch_text.h @@ -172,7 +172,7 @@ public: virtual void GetEndPoints( std::vector< DANGLING_END_ITEM >& aItemList ) override; - virtual bool IsDanglingStateChanged( std::vector< DANGLING_END_ITEM >& aItemList ) override; + virtual bool UpdateDanglingState( std::vector& aItemList ) override; virtual bool IsDangling() const override { return m_isDangling; }