pcbnew: fixes in primitives->custom pad tool
Fixes: lp:1753712 * https://bugs.launchpad.net/kicad/+bug/1753712 Fixes: lp:1753711 * https://bugs.launchpad.net/kicad/+bug/1753711
This commit is contained in:
parent
48459e4268
commit
f2bb398ae6
|
@ -354,6 +354,13 @@ public:
|
|||
*/
|
||||
bool SetPrimitives( const std::vector<PAD_CS_PRIMITIVE>& aPrimitivesList );
|
||||
|
||||
/**
|
||||
* Add to the basic shape list
|
||||
* @return true if OK, false if issues
|
||||
* (more than one polygon to build the polygon shape list)
|
||||
*/
|
||||
bool AddPrimitives( const std::vector<PAD_CS_PRIMITIVE>& aPrimitivesList );
|
||||
|
||||
|
||||
/**
|
||||
* Function SetOrientation
|
||||
|
|
|
@ -159,6 +159,15 @@ bool D_PAD::SetPrimitives( const std::vector<PAD_CS_PRIMITIVE>& aPrimitivesList
|
|||
return MergePrimitivesAsPolygon();
|
||||
}
|
||||
|
||||
bool D_PAD::AddPrimitives( const std::vector<PAD_CS_PRIMITIVE>& aPrimitivesList )
|
||||
{
|
||||
for( const auto& prim : aPrimitivesList )
|
||||
m_basicShapes.push_back( prim );
|
||||
|
||||
return MergePrimitivesAsPolygon();
|
||||
}
|
||||
|
||||
|
||||
// clear the basic shapes list and associated data
|
||||
void D_PAD::DeletePrimitivesList()
|
||||
{
|
||||
|
|
|
@ -407,8 +407,6 @@ int MODULE_EDITOR_TOOLS::CreatePadFromShapes( const TOOL_EVENT& aEvent )
|
|||
pad->SetOrientation( 0 );
|
||||
}
|
||||
|
||||
|
||||
pad->SetPrimitives( shapes );
|
||||
pad->SetShape ( PAD_SHAPE_CUSTOM );
|
||||
|
||||
OPT<VECTOR2I> anchor;
|
||||
|
@ -441,7 +439,8 @@ int MODULE_EDITOR_TOOLS::CreatePadFromShapes( const TOOL_EVENT& aEvent )
|
|||
|
||||
|
||||
pad->SetPosition( wxPoint( anchor->x, anchor->y ) );
|
||||
pad->SetPrimitives( shapes );
|
||||
pad->AddPrimitives( shapes );
|
||||
pad->ClearFlags();
|
||||
|
||||
bool result = pad->MergePrimitivesAsPolygon();
|
||||
|
||||
|
@ -462,9 +461,8 @@ int MODULE_EDITOR_TOOLS::CreatePadFromShapes( const TOOL_EVENT& aEvent )
|
|||
}
|
||||
|
||||
m_toolMgr->RunAction( PCB_ACTIONS::selectionClear, true );
|
||||
m_toolMgr->RunAction( PCB_ACTIONS::selectItem, true, padPtr );
|
||||
|
||||
commit.Push(_("Create Pad from Selected Shapes") );
|
||||
m_toolMgr->RunAction( PCB_ACTIONS::selectItem, true, padPtr );
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue