Implement proper dangling end handling for block moves.
(Most of this is actually fixing the IsDanglingStateChanged() to correctly indicate that it *updates* the dangling state, not just tests it.)
This commit is contained in:
parent
b445b0fab2
commit
4030eec939
|
@ -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<DANGLING_END_ITEM> internalPoints;
|
||||
|
||||
for( unsigned i = 0; i < block->GetCount(); ++i )
|
||||
{
|
||||
auto item = static_cast<SCH_ITEM*>( block->GetItem( i ) );
|
||||
item->GetEndPoints( internalPoints );
|
||||
}
|
||||
|
||||
for( unsigned i = 0; i < block->GetCount(); ++i )
|
||||
{
|
||||
auto item = static_cast<SCH_ITEM*>( block->GetItem( i ) );
|
||||
item->UpdateDanglingState( internalPoints );
|
||||
}
|
||||
|
||||
m_canvas->SetMouseCaptureCallback( DrawMovingBlockOutlines );
|
||||
m_canvas->CallMouseCapture( aDC, wxDefaultPosition, false );
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -209,7 +209,7 @@ void SCH_BUS_ENTRY_BASE::Rotate( wxPoint aPosition )
|
|||
}
|
||||
|
||||
|
||||
bool SCH_BUS_WIRE_ENTRY::IsDanglingStateChanged( std::vector<DANGLING_END_ITEM>& aItemList )
|
||||
bool SCH_BUS_WIRE_ENTRY::UpdateDanglingState( std::vector<DANGLING_END_ITEM>& aItemList )
|
||||
{
|
||||
bool previousStateStart = m_isDanglingStart;
|
||||
bool previousStateEnd = m_isDanglingEnd;
|
||||
|
@ -275,7 +275,7 @@ bool SCH_BUS_WIRE_ENTRY::IsDanglingStateChanged( std::vector<DANGLING_END_ITEM>&
|
|||
}
|
||||
|
||||
|
||||
bool SCH_BUS_BUS_ENTRY::IsDanglingStateChanged( std::vector<DANGLING_END_ITEM>& aItemList )
|
||||
bool SCH_BUS_BUS_ENTRY::UpdateDanglingState( std::vector<DANGLING_END_ITEM>& aItemList )
|
||||
{
|
||||
bool previousStateStart = m_isDanglingStart;
|
||||
bool previousStateEnd = m_isDanglingEnd;
|
||||
|
|
|
@ -159,7 +159,7 @@ public:
|
|||
|
||||
BITMAP_DEF GetMenuImage() const override;
|
||||
|
||||
bool IsDanglingStateChanged( std::vector<DANGLING_END_ITEM>& aItemList ) override;
|
||||
bool UpdateDanglingState( std::vector<DANGLING_END_ITEM>& aItemList ) override;
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -192,7 +192,7 @@ public:
|
|||
|
||||
BITMAP_DEF GetMenuImage() const override;
|
||||
|
||||
bool IsDanglingStateChanged( std::vector<DANGLING_END_ITEM>& aItemList ) override;
|
||||
bool UpdateDanglingState( std::vector<DANGLING_END_ITEM>& aItemList ) override;
|
||||
};
|
||||
|
||||
#endif // _SCH_BUS_ENTRY_H_
|
||||
|
|
|
@ -1594,7 +1594,7 @@ void SCH_COMPONENT::GetEndPoints( std::vector <DANGLING_END_ITEM>& aItemList )
|
|||
}
|
||||
|
||||
|
||||
bool SCH_COMPONENT::IsDanglingStateChanged( std::vector<DANGLING_END_ITEM>& aItemList )
|
||||
bool SCH_COMPONENT::UpdateDanglingState( std::vector<DANGLING_END_ITEM>& aItemList )
|
||||
{
|
||||
bool changed = false;
|
||||
|
||||
|
|
|
@ -573,7 +573,7 @@ public:
|
|||
*
|
||||
* @return true if any pin's state has changed.
|
||||
*/
|
||||
bool IsDanglingStateChanged( std::vector<DANGLING_END_ITEM>& aItemList ) override;
|
||||
bool UpdateDanglingState( std::vector<DANGLING_END_ITEM>& aItemList ) override;
|
||||
|
||||
wxPoint GetPinPhysicalPosition( const LIB_PIN* Pin ) const;
|
||||
|
||||
|
|
|
@ -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<DANGLING_END_ITEM>& aItemList ) { return false; }
|
||||
|
||||
virtual bool IsDangling() const { return false; }
|
||||
|
||||
|
|
|
@ -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 <DANGLING_END_ITEM>& aItemList )
|
|||
}
|
||||
|
||||
|
||||
bool SCH_LINE::IsDanglingStateChanged( std::vector< DANGLING_END_ITEM >& aItemList )
|
||||
bool SCH_LINE::UpdateDanglingState( std::vector<DANGLING_END_ITEM>& aItemList )
|
||||
{
|
||||
bool previousStartState = m_startIsDangling;
|
||||
bool previousEndState = m_endIsDangling;
|
||||
|
|
|
@ -156,7 +156,7 @@ public:
|
|||
|
||||
void GetEndPoints( std::vector<DANGLING_END_ITEM>& aItemList ) override;
|
||||
|
||||
bool IsDanglingStateChanged( std::vector< DANGLING_END_ITEM >& aItemList ) override;
|
||||
bool UpdateDanglingState( std::vector<DANGLING_END_ITEM>& aItemList ) override;
|
||||
|
||||
bool IsStartDangling() const { return m_startIsDangling; }
|
||||
bool IsEndDangling() const { return m_endIsDangling; }
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -806,12 +806,12 @@ void SCH_SHEET::GetEndPoints( std::vector <DANGLING_END_ITEM>& aItemList )
|
|||
}
|
||||
|
||||
|
||||
bool SCH_SHEET::IsDanglingStateChanged( std::vector< DANGLING_END_ITEM >& aItemList )
|
||||
bool SCH_SHEET::UpdateDanglingState( std::vector<DANGLING_END_ITEM>& aItemList )
|
||||
{
|
||||
bool changed = false;
|
||||
|
||||
for( SCH_SHEET_PIN& pinsheet : GetPins() )
|
||||
changed |= pinsheet.IsDanglingStateChanged( aItemList );
|
||||
changed |= pinsheet.UpdateDanglingState( aItemList );
|
||||
|
||||
return changed;
|
||||
}
|
||||
|
|
|
@ -516,7 +516,7 @@ public:
|
|||
|
||||
void GetEndPoints( std::vector <DANGLING_END_ITEM>& aItemList ) override;
|
||||
|
||||
bool IsDanglingStateChanged( std::vector< DANGLING_END_ITEM >& aItemList ) override;
|
||||
bool UpdateDanglingState( std::vector<DANGLING_END_ITEM>& aItemList ) override;
|
||||
|
||||
bool IsSelectStateChanged( const wxRect& aRect ) override;
|
||||
|
||||
|
|
|
@ -353,7 +353,7 @@ void SCH_TEXT::GetEndPoints( std::vector <DANGLING_END_ITEM>& aItemList )
|
|||
}
|
||||
|
||||
|
||||
bool SCH_TEXT::IsDanglingStateChanged( std::vector< DANGLING_END_ITEM >& aItemList )
|
||||
bool SCH_TEXT::UpdateDanglingState( std::vector<DANGLING_END_ITEM>& aItemList )
|
||||
{
|
||||
// Normal text labels cannot be tested for dangling ends.
|
||||
if( Type() == SCH_TEXT_T )
|
||||
|
|
|
@ -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<DANGLING_END_ITEM>& aItemList ) override;
|
||||
|
||||
virtual bool IsDangling() const override { return m_isDangling; }
|
||||
|
||||
|
|
Loading…
Reference in New Issue