Don't push a commit we don't own.
This commit is contained in:
parent
5da35d7750
commit
ad676e22b8
|
@ -147,6 +147,8 @@ public:
|
|||
///< Returns status of an item.
|
||||
int GetStatus( EDA_ITEM* aItem, BASE_SCREEN *aScreen = nullptr );
|
||||
|
||||
EDA_ITEM* GetFirst() const { return m_changes.empty() ? nullptr : m_changes[0].m_item; }
|
||||
|
||||
protected:
|
||||
struct COMMIT_LINE
|
||||
{
|
||||
|
|
|
@ -2453,6 +2453,20 @@ int EDIT_TOOL::Duplicate( const TOOL_EVENT& aEvent )
|
|||
sTool->FilterCollectorForFreePads( aCollector, true );
|
||||
sTool->FilterCollectorForMarkers( aCollector );
|
||||
sTool->FilterCollectorForHierarchy( aCollector, true );
|
||||
|
||||
// Iterate from the back so we don't have to worry about removals.
|
||||
for( int i = aCollector.GetCount() - 1; i >= 0; --i )
|
||||
{
|
||||
BOARD_ITEM* item = aCollector[i];
|
||||
|
||||
if( item->Type() == PCB_GENERATOR_T )
|
||||
{
|
||||
// Could you duplicate something like a generated stitching pattern?
|
||||
// Dunno. But duplicating a tuning pattern is a sure crash.
|
||||
//
|
||||
aCollector.Remove( item );
|
||||
}
|
||||
}
|
||||
} );
|
||||
|
||||
if( selection.Empty() )
|
||||
|
|
|
@ -238,9 +238,19 @@ int EDIT_TOOL::Move( const TOOL_EVENT& aEvent )
|
|||
BOARD_COMMIT localCommit( this );
|
||||
|
||||
if( doMoveSelection( aEvent, &localCommit ) )
|
||||
localCommit.Push( _( "Move" ) );
|
||||
{
|
||||
if( PCB_GENERATOR* genItem = dynamic_cast<PCB_GENERATOR*>( localCommit.GetFirst() ) )
|
||||
m_toolMgr->RunSynchronousAction( PCB_ACTIONS::genPushEdit, &localCommit, genItem );
|
||||
else
|
||||
localCommit.Push( _( "Move" ) );
|
||||
}
|
||||
else
|
||||
localCommit.Revert();
|
||||
{
|
||||
if( PCB_GENERATOR* genItem = dynamic_cast<PCB_GENERATOR*>( localCommit.GetFirst() ) )
|
||||
m_toolMgr->RunSynchronousAction( PCB_ACTIONS::genRevertEdit, &localCommit, genItem );
|
||||
else
|
||||
localCommit.Revert();
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
@ -798,26 +808,6 @@ bool EDIT_TOOL::doMoveSelection( const TOOL_EVENT& aEvent, BOARD_COMMIT* aCommit
|
|||
{
|
||||
EDA_ITEMS oItems( orig_items.begin(), orig_items.end() );
|
||||
m_toolMgr->RunAction<EDA_ITEMS*>( PCB_ACTIONS::selectItems, &oItems );
|
||||
|
||||
for( BOARD_ITEM* item : sel_items )
|
||||
{
|
||||
if( item->Type() == PCB_GENERATOR_T )
|
||||
{
|
||||
m_toolMgr->RunSynchronousAction( PCB_ACTIONS::genPushEdit, aCommit,
|
||||
static_cast<PCB_GENERATOR*>( item ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for( BOARD_ITEM* item : sel_items )
|
||||
{
|
||||
if( item->Type() == PCB_GENERATOR_T )
|
||||
{
|
||||
m_toolMgr->RunSynchronousAction( PCB_ACTIONS::genRevertEdit, aCommit,
|
||||
static_cast<PCB_GENERATOR*>( item ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Remove the dynamic ratsnest from the screen
|
||||
|
|
|
@ -240,7 +240,7 @@ int GENERATOR_TOOL::GenEditAction( const TOOL_EVENT& aEvent )
|
|||
}
|
||||
else if( aEvent.IsAction( &PCB_ACTIONS::genPushEdit ) )
|
||||
{
|
||||
gen->EditPush( this, board(), frame(), commit, wxEmptyString, APPEND_UNDO );
|
||||
gen->EditPush( this, board(), frame(), commit, wxEmptyString );
|
||||
|
||||
wxASSERT( commit->Empty() );
|
||||
}
|
||||
|
|
|
@ -654,8 +654,10 @@ int PCB_POINT_EDITOR::OnSelectionChange( const TOOL_EVENT& aEvent )
|
|||
m_toolMgr->RunSynchronousAction( PCB_ACTIONS::genPushEdit, &commit,
|
||||
static_cast<PCB_GENERATOR*>( item ) );
|
||||
}
|
||||
|
||||
commit.Push( _( "Drag Corner" ) );
|
||||
else
|
||||
{
|
||||
commit.Push( _( "Drag Corner" ) );
|
||||
}
|
||||
|
||||
inDrag = false;
|
||||
frame()->UndoRedoBlock( false );
|
||||
|
|
Loading…
Reference in New Issue