groups/design blocks: add lib link to groups from design blocks

Also add Place Linked Design Block function.
This commit is contained in:
Mike Williams
2025-05-13 10:41:32 -04:00
parent 63babb1a22
commit d2f0a13515
26 changed files with 1015 additions and 623 deletions
+16
View File
@@ -817,6 +817,20 @@ void PCB_EDIT_FRAME::setupUIConditions()
return GetUndoCommandCount() > 0;
};
auto groupWithDesignBlockLink =
[] ( const SELECTION& aSel )
{
if( aSel.Size() != 1 )
return false;
if( aSel[0]->Type() != PCB_GROUP_T )
return false;
PCB_GROUP* group = static_cast<PCB_GROUP*>( aSel.GetItem( 0 ) );
return group->HasDesignBlockLink();
};
wxASSERT( mgr );
#define ENABLE( x ) ACTION_CONDITIONS().Enable( x )
@@ -844,6 +858,8 @@ void PCB_EDIT_FRAME::setupUIConditions()
mgr->SetConditions( ACTIONS::doDelete, ENABLE( cond.HasItems() ) );
mgr->SetConditions( ACTIONS::duplicate, ENABLE( cond.HasItems() ) );
mgr->SetConditions( PCB_ACTIONS::placeLinkedDesignBlock, ENABLE( groupWithDesignBlockLink) );
static const std::vector<KICAD_T> groupTypes = { PCB_GROUP_T, PCB_GENERATOR_T };
mgr->SetConditions( ACTIONS::group, ENABLE( SELECTION_CONDITIONS::NotEmpty ) );