Browse Source

Allow generator actions to affect children

Changing the generator will often modify the underlying children's
properties.  We should store these data in the stack.  Also add the
ability to change layers

Fixes https://gitlab.com/kicad/code/kicad/-/issues/21476

(cherry picked from commit 3ec380d93c)
9.0
Seth Hillbrand 2 months ago
parent
commit
d11ab8201f
  1. 8
      pcbnew/generators/pcb_tuning_pattern.cpp
  2. 4
      pcbnew/tools/global_edit_tool.cpp

8
pcbnew/generators/pcb_tuning_pattern.cpp

@ -25,6 +25,7 @@
#include <pcb_generator.h>
#include <generators_mgr.h>
#include <functional>
#include <optional>
#include <magic_enum.hpp>
@ -355,6 +356,13 @@ public:
}
}
void SetLayer( PCB_LAYER_ID aLayer ) override
{
PCB_GENERATOR::SetLayer( aLayer );
RunOnChildren( [aLayer]( BOARD_ITEM* item ) { item->SetLayer( aLayer ); } );
}
const BOX2I GetBoundingBox() const override
{
return getOutline().BBox();

4
pcbnew/tools/global_edit_tool.cpp

@ -24,6 +24,7 @@
#include <zone_manager/dialog_zone_manager.h>
#include <footprint.h>
#include <pcb_track.h>
#include <pcb_generator.h>
#include <tool/tool_manager.h>
#include <tools/pcb_actions.h>
#include <tools/edit_tool.h>
@ -171,6 +172,9 @@ int GLOBAL_EDIT_TOOL::SwapLayers( const TOOL_EVENT& aEvent )
}
}
for( PCB_GENERATOR* generator : frame()->GetBoard()->Generators() )
hasChanges |= swapBoardItem( generator, layerMap );
for( BOARD_ITEM* zone : frame()->GetBoard()->Zones() )
hasChanges |= swapBoardItem( zone, layerMap );

Loading…
Cancel
Save