Convert tool: create lines on active layer, not source layer
This commit is contained in:
parent
2d9b06cbf9
commit
3beeb52c43
|
@ -551,8 +551,9 @@ int CONVERT_TOOL::PolyToLines( const TOOL_EVENT& aEvent )
|
||||||
};
|
};
|
||||||
|
|
||||||
BOARD_COMMIT commit( m_frame );
|
BOARD_COMMIT commit( m_frame );
|
||||||
FOOTPRINT_EDIT_FRAME* fpEditor = dynamic_cast<FOOTPRINT_EDIT_FRAME*>( m_frame );
|
FOOTPRINT_EDIT_FRAME* fpEditor = dynamic_cast<FOOTPRINT_EDIT_FRAME*>( m_frame );
|
||||||
FOOTPRINT* footprint = nullptr;
|
FOOTPRINT* footprint = nullptr;
|
||||||
|
PCB_LAYER_ID targetLayer = m_frame->GetActiveLayer();
|
||||||
PCB_LAYER_ID copperLayer = UNSELECTED_LAYER;
|
PCB_LAYER_ID copperLayer = UNSELECTED_LAYER;
|
||||||
|
|
||||||
if( fpEditor )
|
if( fpEditor )
|
||||||
|
@ -560,7 +561,6 @@ int CONVERT_TOOL::PolyToLines( const TOOL_EVENT& aEvent )
|
||||||
|
|
||||||
for( EDA_ITEM* item : selection )
|
for( EDA_ITEM* item : selection )
|
||||||
{
|
{
|
||||||
PCB_LAYER_ID layer = static_cast<BOARD_ITEM*>( item )->GetLayer();
|
|
||||||
SHAPE_POLY_SET polySet = getPolySet( item );
|
SHAPE_POLY_SET polySet = getPolySet( item );
|
||||||
std::vector<SEG> segs = getSegList( polySet );
|
std::vector<SEG> segs = getSegList( polySet );
|
||||||
|
|
||||||
|
@ -572,7 +572,7 @@ int CONVERT_TOOL::PolyToLines( const TOOL_EVENT& aEvent )
|
||||||
{
|
{
|
||||||
FP_SHAPE* graphic = new FP_SHAPE( footprint, SHAPE_T::SEGMENT );
|
FP_SHAPE* graphic = new FP_SHAPE( footprint, SHAPE_T::SEGMENT );
|
||||||
|
|
||||||
graphic->SetLayer( layer );
|
graphic->SetLayer( targetLayer );
|
||||||
graphic->SetStart( wxPoint( seg.A ) );
|
graphic->SetStart( wxPoint( seg.A ) );
|
||||||
graphic->SetStart0( wxPoint( seg.A ) );
|
graphic->SetStart0( wxPoint( seg.A ) );
|
||||||
graphic->SetEnd( wxPoint( seg.B ) );
|
graphic->SetEnd( wxPoint( seg.B ) );
|
||||||
|
@ -584,7 +584,7 @@ int CONVERT_TOOL::PolyToLines( const TOOL_EVENT& aEvent )
|
||||||
PCB_SHAPE* graphic = new PCB_SHAPE;
|
PCB_SHAPE* graphic = new PCB_SHAPE;
|
||||||
|
|
||||||
graphic->SetShape( SHAPE_T::SEGMENT );
|
graphic->SetShape( SHAPE_T::SEGMENT );
|
||||||
graphic->SetLayer( layer );
|
graphic->SetLayer( targetLayer );
|
||||||
graphic->SetStart( wxPoint( seg.A ) );
|
graphic->SetStart( wxPoint( seg.A ) );
|
||||||
graphic->SetEnd( wxPoint( seg.B ) );
|
graphic->SetEnd( wxPoint( seg.B ) );
|
||||||
commit.Add( graphic );
|
commit.Add( graphic );
|
||||||
|
@ -596,7 +596,7 @@ int CONVERT_TOOL::PolyToLines( const TOOL_EVENT& aEvent )
|
||||||
PCB_BASE_EDIT_FRAME* frame = getEditFrame<PCB_BASE_EDIT_FRAME>();
|
PCB_BASE_EDIT_FRAME* frame = getEditFrame<PCB_BASE_EDIT_FRAME>();
|
||||||
BOARD_ITEM_CONTAINER* parent = frame->GetModel();
|
BOARD_ITEM_CONTAINER* parent = frame->GetModel();
|
||||||
|
|
||||||
if( !IsCopperLayer( layer ) )
|
if( !IsCopperLayer( targetLayer ) )
|
||||||
{
|
{
|
||||||
if( copperLayer == UNSELECTED_LAYER )
|
if( copperLayer == UNSELECTED_LAYER )
|
||||||
copperLayer = frame->SelectOneLayer( F_Cu, LSET::AllNonCuMask() );
|
copperLayer = frame->SelectOneLayer( F_Cu, LSET::AllNonCuMask() );
|
||||||
|
@ -604,7 +604,7 @@ int CONVERT_TOOL::PolyToLines( const TOOL_EVENT& aEvent )
|
||||||
if( copperLayer == UNDEFINED_LAYER ) // User canceled
|
if( copperLayer == UNDEFINED_LAYER ) // User canceled
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
layer = copperLayer;
|
targetLayer = copperLayer;
|
||||||
}
|
}
|
||||||
|
|
||||||
// I am really unsure converting a polygon to "tracks" (i.e. segments on
|
// I am really unsure converting a polygon to "tracks" (i.e. segments on
|
||||||
|
@ -615,7 +615,7 @@ int CONVERT_TOOL::PolyToLines( const TOOL_EVENT& aEvent )
|
||||||
for( SEG& seg : segs )
|
for( SEG& seg : segs )
|
||||||
{
|
{
|
||||||
FP_SHAPE* graphic = new FP_SHAPE( footprint, SHAPE_T::SEGMENT );
|
FP_SHAPE* graphic = new FP_SHAPE( footprint, SHAPE_T::SEGMENT );
|
||||||
graphic->SetLayer( layer );
|
graphic->SetLayer( targetLayer );
|
||||||
graphic->SetStart( wxPoint( seg.A ) );
|
graphic->SetStart( wxPoint( seg.A ) );
|
||||||
graphic->SetStart0( wxPoint( seg.A ) );
|
graphic->SetStart0( wxPoint( seg.A ) );
|
||||||
graphic->SetEnd( wxPoint( seg.B ) );
|
graphic->SetEnd( wxPoint( seg.B ) );
|
||||||
|
@ -630,7 +630,7 @@ int CONVERT_TOOL::PolyToLines( const TOOL_EVENT& aEvent )
|
||||||
{
|
{
|
||||||
PCB_TRACK* track = new PCB_TRACK( parent );
|
PCB_TRACK* track = new PCB_TRACK( parent );
|
||||||
|
|
||||||
track->SetLayer( layer );
|
track->SetLayer( targetLayer );
|
||||||
track->SetStart( wxPoint( seg.A ) );
|
track->SetStart( wxPoint( seg.A ) );
|
||||||
track->SetEnd( wxPoint( seg.B ) );
|
track->SetEnd( wxPoint( seg.B ) );
|
||||||
commit.Add( track );
|
commit.Add( track );
|
||||||
|
|
Loading…
Reference in New Issue