KiCad PCB EDA Suite
Loading...
Searching...
No Matches
block_drag_capability.h File Reference
#include <vector>

Go to the source code of this file.

Enumerations

enum class  BLOCK_DRAG_CAPABILITY { DEFORMABLE , RIGID , ROUTER , UNSUPPORTED }
 How one selected item takes part in a block drag. More...
 

Functions

bool BlockDragAnchorEditingEnabled (const PCB_BASE_FRAME *aFrame)
 Whether the user has turned on editing anchor points on a multi-selection.
 
BLOCK_DRAG_CAPABILITY BlockDragCapability (const BOARD_ITEM &aItem)
 Classify one board item for a block drag.
 
bool BlockDragIsConstraintMember (const BOARD_ITEM &aItem)
 True when the item belongs to any geometric constraint on its board or inside one of its footprints.
 
std::vector< BOARD_ITEM * > BlockDragExpandSelection (const std::vector< BOARD_ITEM * > &aSelection)
 Replace group containers with their members, through nested groups, and drop duplicates.
 

Enumeration Type Documentation

◆ BLOCK_DRAG_CAPABILITY

enum class BLOCK_DRAG_CAPABILITY
strong

How one selected item takes part in a block drag.

Every item in an expanded selection gets exactly one of these.

Enumerator
DEFORMABLE 

Shows handles, and reshapes as the user drags the ones they picked.

An item like this joins the drag once one of its handles is picked. With none picked it stays put, though it can still follow by a shared endpoint like any unselected item.

RIGID 

Moves with the block using its own move operation.

ROUTER 

Moves with the block through the router, which repairs the copper at the edge of the block.

UNSUPPORTED 

Stops the drag with a message before anything moves.

Definition at line 41 of file block_drag_capability.h.

Function Documentation

◆ BlockDragAnchorEditingEnabled()

bool BlockDragAnchorEditingEnabled ( const PCB_BASE_FRAME * aFrame)

Whether the user has turned on editing anchor points on a multi-selection.

Both editors read the board editor's copy of the setting, the way the footprint editor already reads the flip direction from there. One reader so the two tools cannot drift.

Definition at line 40 of file block_drag_capability.cpp.

References PCB_BASE_FRAME::GetPcbNewSettings(), and PCBNEW_SETTINGS::m_AreaAnchorPointSelection.

Referenced by PCB_POINT_EDITOR::blockAnchorEditingEnabled().

◆ BlockDragCapability()

BLOCK_DRAG_CAPABILITY BlockDragCapability ( const BOARD_ITEM & aItem)

Classify one board item for a block drag.

A footprint holder board has no router, which is how the footprint editor is told apart. Pads are RIGID there, and copper and whole footprints are UNSUPPORTED. Those last rows are a guard, since that selection cannot hold them. On a board, the graphics and zones inside a footprint are RIGID, so they travel without deforming.

Expand groups with BlockDragExpandSelection() first. A group container on its own is UNSUPPORTED. A generator is RIGID only when its Move() takes all of its members with it. A via stitch is DEFORMABLE, since it is an outline whose vias are re-placed by the regeneration that follows the drag.

Definition at line 68 of file block_drag_capability.cpp.

References ARC, BEZIER, CIRCLE, DEFORMABLE, ELLIPSE, ELLIPSE_ARC, PCB_TUNING_PATTERN::GENERATOR_TYPE, PCB_VIA_STACK::GENERATOR_TYPE, PCB_VIA_STITCH::GENERATOR_TYPE, BOARD_ITEM::GetBoard(), BOARD_ITEM::GetParentFootprint(), BOARD::IsFootprintHolder(), PCB_ARC_T, PCB_BARCODE_T, PCB_DIM_ALIGNED_T, PCB_DIM_CENTER_T, PCB_DIM_LEADER_T, PCB_DIM_ORTHOGONAL_T, PCB_DIM_RADIAL_T, PCB_DRILL_CHART_T, PCB_DRILL_MAP_T, PCB_FIELD_T, PCB_FOOTPRINT_T, PCB_GENERATOR_T, PCB_GRID_ITEM_T, PCB_PAD_T, PCB_POINT_T, PCB_REFERENCE_IMAGE_T, PCB_SHAPE_T, PCB_TABLE_T, PCB_TABLECELL_T, PCB_TARGET_T, PCB_TEXT_T, PCB_TEXTBOX_T, PCB_TRACE_T, PCB_VIA_T, PCB_ZONE_T, POLY, RECTANGLE, RIGID, ROUTER, SEGMENT, EDA_ITEM::Type(), and UNSUPPORTED.

Referenced by BLOCK_DRAG_SESSION::Begin(), BlockDragHandlePickable(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), and PCB_POINT_EDITOR::buildBlockHandles().

◆ BlockDragExpandSelection()

std::vector< BOARD_ITEM * > BlockDragExpandSelection ( const std::vector< BOARD_ITEM * > & aSelection)

Replace group containers with their members, through nested groups, and drop duplicates.

The result holds no group containers and no markers, which no tool moves. A generator is a kind of group but travels as one object, so it stays whole. An item selected both on its own and through a group appears once. Directly selected items keep their order, and a group's members follow the place the group held. A footprint's own child is dropped when the footprint is in the result too, because the footprint carries it.

Definition at line 156 of file block_drag_capability.cpp.

References BOARD_ITEM::GetParentFootprint(), PCB_GROUP_T, and PCB_MARKER_T.

Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), and PCB_POINT_EDITOR::buildBlockHandles().

◆ BlockDragIsConstraintMember()

bool BlockDragIsConstraintMember ( const BOARD_ITEM & aItem)

True when the item belongs to any geometric constraint on its board or inside one of its footprints.

Plain membership, so every kind of constraint counts. It tells the gesture which moved shapes need their clusters solved again. Walks every constraint on each call.

Definition at line 48 of file block_drag_capability.cpp.

References CollectResolvedConstraints(), BOARD_ITEM::GetBoard(), and EDA_ITEM::m_Uuid.

Referenced by BLOCK_DRAG_SESSION::Begin(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), and BOOST_AUTO_TEST_CASE().