Allow pad number box creation in pad edit mode.

(Also fixes a bug where we'd include pad number box in pad shape.)
This commit is contained in:
Jeff Young 2023-09-04 19:44:39 +01:00
parent 37bdba80ab
commit 0e26f3ab30
3 changed files with 43 additions and 10 deletions

View File

@ -566,11 +566,14 @@ void PAD::BuildEffectiveShapes( PCB_LAYER_ID aLayer ) const
{
for( const std::shared_ptr<PCB_SHAPE>& primitive : m_editPrimitives )
{
for( SHAPE* shape : primitive->MakeEffectiveShapes() )
if( !primitive->IsAnnotationProxy() )
{
shape->Rotate( m_orient );
shape->Move( shapePos );
add( shape );
for( SHAPE* shape : primitive->MakeEffectiveShapes() )
{
shape->Rotate( m_orient );
shape->Move( shapePos );
add( shape );
}
}
}
}

View File

@ -1752,12 +1752,13 @@ void PCB_PAINTER::draw( const PCB_SHAPE* aShape, int aLayer )
if( aShape->IsAnnotationProxy() )
{
m_gal->DrawSegment( pts[0], pts[1], thickness );
m_gal->DrawSegment( pts[1], pts[2], thickness );
m_gal->DrawSegment( pts[2], pts[3], thickness );
m_gal->DrawSegment( pts[3], pts[0], thickness );
m_gal->DrawSegment( pts[0], pts[2], thickness );
m_gal->DrawSegment( pts[1], pts[3], thickness );
m_gal->SetLineWidth( m_pcbSettings.m_outlineWidth );
m_gal->DrawLine( pts[0], pts[1] );
m_gal->DrawLine( pts[1], pts[2] );
m_gal->DrawLine( pts[2], pts[3] );
m_gal->DrawLine( pts[3], pts[0] );
m_gal->DrawLine( pts[0], pts[2] );
m_gal->DrawLine( pts[1], pts[3] );
}
else if( outline_mode )
{

View File

@ -30,6 +30,7 @@
#include <pcb_edit_frame.h>
#include <board_design_settings.h>
#include <footprint.h>
#include <pad.h>
#include <base_units.h>
#include <geometry/shape_compound.h>
#include <pcb_shape.h>
@ -577,5 +578,33 @@ static struct PCB_SHAPE_DESC
propMgr.OverrideAvailability( TYPE_HASH( PCB_SHAPE ), TYPE_HASH( BOARD_CONNECTED_ITEM ),
_HKI( "Net" ), isCopper );
auto isPadEditMode =
[]( INSPECTABLE* aItem ) -> bool
{
if( PCB_SHAPE* shape = dynamic_cast<PCB_SHAPE*>( aItem ) )
{
if( shape->GetBoard() && shape->GetBoard()->IsFootprintHolder() )
{
for( FOOTPRINT* fp : shape->GetBoard()->Footprints() )
{
for( PAD* pad : fp->Pads() )
{
if( pad->IsEntered() )
return true;
}
}
}
}
return false;
};
const wxString groupPadPrimitives = _HKI( "Pad Primitives" );
propMgr.AddProperty( new PROPERTY<EDA_SHAPE, bool>( _HKI( "Number Box" ),
&EDA_SHAPE::SetIsAnnotationProxy, &EDA_SHAPE::IsAnnotationProxy ),
groupPadPrimitives )
.SetAvailableFunc( isPadEditMode );
}
} _PCB_SHAPE_DESC;