Move a couple of stragglers to BOARD_COMMIT.
This commit is contained in:
parent
a96b7116d0
commit
1b0cc82c56
|
@ -382,26 +382,28 @@ void BOARD_COMMIT::Push( const wxString& aMessage, int aCommitFlags )
|
|||
}
|
||||
|
||||
case CHT_UNGROUP:
|
||||
if( !( aCommitFlags & SKIP_UNDO ) )
|
||||
if( PCB_GROUP* group = boardItem->GetParentGroup() )
|
||||
{
|
||||
ITEM_PICKER itemWrapper( nullptr, boardItem, UNDO_REDO::UNGROUP );
|
||||
|
||||
if( PCB_GROUP* group = boardItem->GetParentGroup() )
|
||||
if( !( aCommitFlags & SKIP_UNDO ) )
|
||||
{
|
||||
ITEM_PICKER itemWrapper( nullptr, boardItem, UNDO_REDO::UNGROUP );
|
||||
itemWrapper.SetLink( group->Clone() );
|
||||
undoList.PushItem( itemWrapper );
|
||||
}
|
||||
|
||||
undoList.PushItem( itemWrapper );
|
||||
group->RemoveItem( boardItem );
|
||||
}
|
||||
|
||||
boardItem->SetParentGroup( nullptr );
|
||||
|
||||
break;
|
||||
|
||||
case CHT_GROUP:
|
||||
if( addedGroup )
|
||||
{
|
||||
addedGroup->AddItem( boardItem );
|
||||
|
||||
if( !( aCommitFlags & SKIP_UNDO ) )
|
||||
undoList.PushItem( ITEM_PICKER( nullptr, boardItem, UNDO_REDO::REGROUP ) );
|
||||
if( !( aCommitFlags & SKIP_UNDO ) )
|
||||
undoList.PushItem( ITEM_PICKER( nullptr, boardItem, UNDO_REDO::REGROUP ) );
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
|
|
|
@ -44,7 +44,6 @@
|
|||
#include <footprint_editor_settings.h>
|
||||
#include <fp_lib_table.h>
|
||||
#include <kiface_base.h>
|
||||
#include <pcb_group.h>
|
||||
#include <pcb_painter.h>
|
||||
#include <pcbnew_id.h>
|
||||
#include <pcbnew_settings.h>
|
||||
|
|
|
@ -43,7 +43,6 @@
|
|||
#include <invoke_pcb_dialog.h>
|
||||
#include <gal/graphics_abstraction_layer.h>
|
||||
#include <board.h>
|
||||
#include <pcb_group.h>
|
||||
#include <board_design_settings.h>
|
||||
#include <footprint.h>
|
||||
#include <drawing_sheet/ds_proxy_view_item.h>
|
||||
|
|
|
@ -30,8 +30,6 @@ using namespace std::placeholders;
|
|||
#include <pcb_view.h>
|
||||
#include <pcb_display_options.h>
|
||||
#include <pcb_painter.h>
|
||||
|
||||
#include <pcb_group.h>
|
||||
#include <footprint.h>
|
||||
|
||||
namespace KIGFX {
|
||||
|
|
|
@ -34,7 +34,6 @@
|
|||
#include <board.h>
|
||||
#include <board_commit.h>
|
||||
#include <board_design_settings.h>
|
||||
#include <pcb_group.h>
|
||||
#include <pcb_generator.h>
|
||||
#include <footprint.h>
|
||||
#include <pad.h>
|
||||
|
|
|
@ -2110,10 +2110,7 @@ void EDIT_TOOL::DeleteItems( const PCB_SELECTION& aItems, bool aIsCut )
|
|||
FOOTPRINT* parentFP = board_item->GetParentFootprint();
|
||||
|
||||
if( PCB_GROUP* parentGroup = board_item->GetParentGroup() )
|
||||
{
|
||||
commit.Modify( parentGroup );
|
||||
parentGroup->RemoveItem( board_item );
|
||||
}
|
||||
commit.Stage( board_item, CHT_UNGROUP );
|
||||
|
||||
switch( item->Type() )
|
||||
{
|
||||
|
@ -2134,7 +2131,13 @@ void EDIT_TOOL::DeleteItems( const PCB_SELECTION& aItems, bool aIsCut )
|
|||
case PCB_DIM_CENTER_T:
|
||||
case PCB_DIM_RADIAL_T:
|
||||
case PCB_DIM_ORTHOGONAL_T:
|
||||
commit.Remove( board_item );
|
||||
break;
|
||||
|
||||
case PCB_GROUP_T:
|
||||
for( BOARD_ITEM* member : static_cast<PCB_GROUP*>( board_item )->GetItems() )
|
||||
commit.Stage( member, CHT_UNGROUP );
|
||||
|
||||
commit.Remove( board_item );
|
||||
break;
|
||||
|
||||
|
@ -2193,6 +2196,9 @@ void EDIT_TOOL::DeleteItems( const PCB_SELECTION& aItems, bool aIsCut )
|
|||
}
|
||||
else
|
||||
{
|
||||
for( BOARD_ITEM* member : static_cast<PCB_GROUP*>( board_item )->GetItems() )
|
||||
commit.Stage( member, CHT_UNGROUP );
|
||||
|
||||
commit.Remove( board_item );
|
||||
}
|
||||
|
||||
|
|
|
@ -337,23 +337,13 @@ int GROUP_TOOL::RemoveFromGroup( const TOOL_EVENT& aEvent )
|
|||
if( selection.Empty() )
|
||||
m_toolMgr->RunAction( PCB_ACTIONS::selectionCursor );
|
||||
|
||||
std::map<PCB_GROUP*, std::vector<BOARD_ITEM*>> groupMap;
|
||||
|
||||
for( EDA_ITEM* item : selection )
|
||||
{
|
||||
BOARD_ITEM* boardItem = static_cast<BOARD_ITEM*>( item );
|
||||
PCB_GROUP* group = boardItem->GetParentGroup();
|
||||
|
||||
if( group )
|
||||
groupMap[ group ].push_back( boardItem );
|
||||
}
|
||||
|
||||
for( std::pair<PCB_GROUP*, std::vector<BOARD_ITEM*>> pair : groupMap )
|
||||
{
|
||||
commit.Modify( pair.first );
|
||||
|
||||
for( BOARD_ITEM* item : pair.second )
|
||||
pair.first->RemoveItem( item );
|
||||
commit.Stage( boardItem, CHT_UNGROUP );
|
||||
}
|
||||
|
||||
commit.Push( wxT( "Remove Group Items" ) );
|
||||
|
|
|
@ -423,9 +423,9 @@ void PCB_BASE_EDIT_FRAME::PutDataInPreviousState( PICKED_ITEMS_LIST* aList )
|
|||
{
|
||||
if( !aList->GetPickedItemLink( ii ) )
|
||||
aList->SetPickedItemLink( group->Clone(), ii );
|
||||
}
|
||||
|
||||
boardItem->SetParentGroup( nullptr );
|
||||
group->RemoveItem( boardItem );
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
|
|
Loading…
Reference in New Issue