Sets additional conditions for when a wire is trimmed
This adds a set of conditions that will prevent a wire from being automatically trimmed. Wires that are currently being moved or are newly created or are explicitly avoided will not be removed. This also adds a function to set a flag on items in a block. Fixes: lp:1744632 * https://bugs.launchpad.net/kicad/+bug/1744632
This commit is contained in:
parent
2b460bc1ff
commit
7a2d9dff62
|
@ -127,6 +127,14 @@ void SCH_EDIT_FRAME::HandleBlockPlace( wxDC* DC )
|
||||||
if( m_canvas->IsMouseCaptured() )
|
if( m_canvas->IsMouseCaptured() )
|
||||||
m_canvas->CallMouseCapture( DC, wxDefaultPosition, false );
|
m_canvas->CallMouseCapture( DC, wxDefaultPosition, false );
|
||||||
|
|
||||||
|
// If the block wasn't changed, don't update the schematic
|
||||||
|
if( block->GetMoveVector() == wxPoint( 0, 0 ) )
|
||||||
|
{
|
||||||
|
// This calls the block-abort command routine on cleanup
|
||||||
|
m_canvas->EndMouseCapture( GetToolId(), m_canvas->GetCurrentCursor() );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
SaveCopyInUndoList( block->GetItems(), UR_CHANGED, false, block->GetMoveVector() );
|
SaveCopyInUndoList( block->GetItems(), UR_CHANGED, false, block->GetMoveVector() );
|
||||||
MoveItemsInList( block->GetItems(), block->GetMoveVector() );
|
MoveItemsInList( block->GetItems(), block->GetMoveVector() );
|
||||||
break;
|
break;
|
||||||
|
@ -252,6 +260,7 @@ bool SCH_EDIT_FRAME::HandleBlockEnd( wxDC* aDC )
|
||||||
{
|
{
|
||||||
nextcmd = true;
|
nextcmd = true;
|
||||||
GetScreen()->SelectBlockItems();
|
GetScreen()->SelectBlockItems();
|
||||||
|
block->SetFlags( IS_MOVED );
|
||||||
m_canvas->CallMouseCapture( aDC, wxDefaultPosition, false );
|
m_canvas->CallMouseCapture( aDC, wxDefaultPosition, false );
|
||||||
m_canvas->SetMouseCaptureCallback( DrawMovingBlockOutlines );
|
m_canvas->SetMouseCaptureCallback( DrawMovingBlockOutlines );
|
||||||
m_canvas->CallMouseCapture( aDC, wxDefaultPosition, false );
|
m_canvas->CallMouseCapture( aDC, wxDefaultPosition, false );
|
||||||
|
|
|
@ -270,7 +270,11 @@ void SCH_EDIT_FRAME::BeginSegment( wxDC* DC, int type )
|
||||||
void SCH_EDIT_FRAME::GetSchematicConnections( std::vector< wxPoint >& aConnections )
|
void SCH_EDIT_FRAME::GetSchematicConnections( std::vector< wxPoint >& aConnections )
|
||||||
{
|
{
|
||||||
for( SCH_ITEM* item = GetScreen()->GetDrawItems(); item; item = item->Next() )
|
for( SCH_ITEM* item = GetScreen()->GetDrawItems(); item; item = item->Next() )
|
||||||
item->GetConnectionPoints( aConnections );
|
{
|
||||||
|
// Avoid items that are changing
|
||||||
|
if( !( item->GetFlags() & ( IS_DRAGGED | IS_MOVED | IS_DELETED ) ) )
|
||||||
|
item->GetConnectionPoints( aConnections );
|
||||||
|
}
|
||||||
|
|
||||||
// We always have some overlapping connection points. Drop duplicates here
|
// We always have some overlapping connection points. Drop duplicates here
|
||||||
std::sort( aConnections.begin(), aConnections.end(),
|
std::sort( aConnections.begin(), aConnections.end(),
|
||||||
|
@ -452,7 +456,8 @@ bool SCH_EDIT_FRAME::TrimWire( const wxPoint& aStart, const wxPoint& aEnd, bool
|
||||||
|
|
||||||
// Don't remove wires that are already deleted, are currently being
|
// Don't remove wires that are already deleted, are currently being
|
||||||
// dragged or are just created
|
// dragged or are just created
|
||||||
if( item->GetFlags() & ( STRUCT_DELETED | IS_DRAGGED | IS_NEW ) )
|
if( item->GetFlags() &
|
||||||
|
( STRUCT_DELETED | IS_DRAGGED | IS_NEW | IS_MOVED | SKIP_STRUCT ) )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if( item->Type() != SCH_LINE_T || item->GetLayer() != LAYER_WIRE )
|
if( item->Type() != SCH_LINE_T || item->GetLayer() != LAYER_WIRE )
|
||||||
|
|
|
@ -168,6 +168,16 @@ public:
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function SetFlags
|
||||||
|
* sets a status flag on each item in a block selector.
|
||||||
|
*/
|
||||||
|
void SetFlags( const STATUS_FLAGS aFlag )
|
||||||
|
{
|
||||||
|
for( unsigned i = 0; i < m_items.GetCount(); i++ )
|
||||||
|
m_items.GetPickedItem( i )->SetFlags( aFlag );
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function IsDragging
|
* Function IsDragging
|
||||||
* returns true if the current block command is a drag operation.
|
* returns true if the current block command is a drag operation.
|
||||||
|
|
Loading…
Reference in New Issue