Schematic: new flag IS_BROKEN for trimming BreakSegment danglers

This commit is contained in:
Mike Williams 2022-12-28 09:50:40 -05:00
parent f03fd5ad2d
commit 6cc17e4a16
4 changed files with 5 additions and 7 deletions

View File

@ -304,12 +304,13 @@ void SCH_EDIT_FRAME::BreakSegment( SCH_LINE* aSegment, const VECTOR2I& aPoint,
newSegment->SetStartPoint( aPoint );
newSegment->SetConnectivityDirty( true );
newSegment->SetFlags( IS_NEW | IS_BROKEN );
AddToScreen( newSegment, aScreen );
SaveCopyInUndoList( aScreen, newSegment, UNDO_REDO::NEWITEM, true );
SaveCopyInUndoList( aScreen, aSegment, UNDO_REDO::CHANGED, true );
aSegment->SetFlags( IS_CHANGED );
aSegment->SetFlags( IS_CHANGED | IS_BROKEN );
UpdateItem( aSegment, false, true );
aSegment->SetEndPoint( aPoint );

View File

@ -966,10 +966,7 @@ void SCH_MOVE_TOOL::trimDanglingLines()
// Delete newly dangling lines:
// Find split segments (one segment is new, the other is changed) that
// we aren't dragging and don't have selected
if( aChangedItem->IsDangling() && !aChangedItem->IsSelected()
&& ( aChangedItem->IsNew()
|| ( !aChangedItem->IsDragging() && aChangedItem->IsModified() ) )
&& aChangedItem->IsType( { SCH_LINE_T } ) )
if( aChangedItem->HasFlag( IS_BROKEN) && aChangedItem->IsDangling() && !aChangedItem->IsSelected() )
{
danglers.insert( aChangedItem );
}

View File

@ -144,7 +144,7 @@ public:
EDA_ITEM_FLAGS GetEditFlags() const
{
constexpr int mask = ( IS_NEW | IS_PASTED | IS_MOVING | IS_DRAGGING
constexpr int mask = ( IS_NEW | IS_PASTED | IS_MOVING | IS_DRAGGING | IS_BROKEN
| IS_CHANGED | STRUCT_DELETED );
return m_flags & mask;

View File

@ -39,7 +39,7 @@
#define IN_EDIT (1 << 2) ///< Item currently edited
#define IS_MOVING (1 << 3) ///< Item being moved
#define IS_NEW (1 << 4) ///< New item, just created
#define IS_BROKEN (1 << 5) ///< Is a segment just broken by BreakSegment
#define IS_DRAGGING (1 << 6) ///< Item being dragged
#define IS_DELETED (1 << 7)