KiCad PCB EDA Suite
POINT_EDITOR Class Reference

POINT_EDITOR. More...

#include <point_editor.h>

Inheritance diagram for POINT_EDITOR:
PCB_TOOL_BASE TOOL_INTERACTIVE TOOL_BASE

Public Types

enum  RESET_REASON { RUN, MODEL_RELOAD, GAL_SWITCH }
 

Determines the reason of reset for a tool

More...
 

Public Member Functions

 POINT_EDITOR ()
 
void Reset (RESET_REASON aReason) override
 Function Reset() Brings the tool to a known, initial state. More...
 
bool Init () override
 Function Init() Init() is called once upon a registration of the tool. More...
 
int OnSelectionChange (const TOOL_EVENT &aEvent)
 Function OnSelected() More...
 
bool HasPoint ()
 Indicates the cursor is over an edit point. More...
 
void setTransitions () override
 

Sets up handlers for various events.

More...
 
void SetEditModules (bool aEnabled)
 Function SetEditModules() More...
 
bool EditingModules () const
 
void Activate ()
 Function Activate() Runs the tool. More...
 
TOOL_MENUGetToolMenu ()
 
void SetContextMenu (ACTION_MENU *aMenu, CONTEXT_MENU_TRIGGER aTrigger=CMENU_BUTTON)
 Function SetContextMenu() More...
 
void RunMainStack (std::function< void()> aFunc)
 Function RunMainStack() More...
 
template<class T >
void Go (int(T::*aStateFunc)(const TOOL_EVENT &), const TOOL_EVENT_LIST &aConditions=TOOL_EVENT(TC_ANY, TA_ANY))
 Function Go() More...
 
TOOL_EVENTWait (const TOOL_EVENT_LIST &aEventList=TOOL_EVENT(TC_ANY, TA_ANY))
 Function Wait() More...
 
TOOL_TYPE GetType () const
 Function GetType() Returns the type of the tool. More...
 
TOOL_ID GetId () const
 Function GetId() Returns the unique identifier of the tool. More...
 
const std::string & GetName () const
 Function GetName() Returns the name of the tool. More...
 
TOOL_MANAGERGetManager () const
 Function GetManager() Returns the instance of TOOL_MANAGER that takes care of the tool. More...
 
bool IsToolActive () const
 

Protected Types

enum  INTERACTIVE_PLACEMENT_OPTIONS { IPO_ROTATE = 0x01, IPO_FLIP = 0x02, IPO_SINGLE_CLICK = 0x04, IPO_REPEAT = 0x08 }
 Options for placing items interactively. More...
 

Protected Member Functions

void doInteractiveItemPlacement (const std::string &aTool, INTERACTIVE_PLACER_BASE *aPlacer, const wxString &aCommitMessage, int aOptions=IPO_ROTATE|IPO_FLIP|IPO_REPEAT)
 Helper function for performing a common interactive idiom: wait for a left click, place an item there (perhaps with a dialog or other user interaction), then have it move with the mouse and respond to rotate/flip, etc. More...
 
KIGFX::PCB_VIEWview () const
 
KIGFX::VIEW_CONTROLScontrols () const
 
PCB_BASE_EDIT_FRAMEframe () const
 
BOARDboard () const
 
MODULEmodule () const
 
const PCB_DISPLAY_OPTIONSdisplayOptions () const
 
PCB_DRAW_PANEL_GALcanvas () const
 
const PCBNEW_SELECTIONselection () const
 
PCBNEW_SELECTIONselection ()
 
void attachManager (TOOL_MANAGER *aManager)
 Function attachManager() More...
 
KIGFX::VIEWgetView () const
 Function getView() More...
 
KIGFX::VIEW_CONTROLSgetViewControls () const
 Function getViewControls() More...
 
template<typename T >
T * getEditFrame () const
 Function getEditFrame() More...
 
template<typename T >
T * getModel () const
 Function getModel() More...
 

Protected Attributes

bool m_editModules
 
TOOL_MENU m_menu
 functions below are not yet implemented - their interface may change More...
 
TOOL_TYPE m_type
 

Stores the type of the tool.

More...
 
TOOL_ID m_toolId
 

Unique identifier for the tool, assigned by a TOOL_MANAGER instance.

More...
 
std::string m_toolName
 

Name of the tool.

More...
 
TOOL_MANAGERm_toolMgr
 

Private Member Functions

void updateItem () const
 

Updates item's points with edit points.

More...
 
void finishItem ()
 

Applies the last changes to the edited item.

More...
 
bool validatePolygon (SHAPE_POLY_SET &aModified) const
 Validates a polygon and displays a popup warning if invalid. More...
 
void updatePoints ()
 

Updates edit points with item's points.

More...
 
void updateEditedPoint (const TOOL_EVENT &aEvent)
 

Updates which point is being edited.

More...
 
void setEditedPoint (EDIT_POINT *aPoint)
 

Sets the current point being edited. NULL means none.

More...
 
bool isModified (const EDIT_POINT &aPoint) const
 

Returns true if aPoint is the currently modified point.

More...
 
void setAltConstraint (bool aEnabled)
 

Sets up an alternative constraint (typically enabled upon a modifier key being pressed).

More...
 
EDIT_POINT get45DegConstrainer () const
 

Returns a point that should be used as a constrainer for 45 degrees mode.

More...
 
bool removeCornerCondition (const SELECTION &aSelection)
 

Condition to display "Remove corner" context menu entry.

More...
 
int addCorner (const TOOL_EVENT &aEvent)
 TOOL_ACTION handlers. More...
 
int removeCorner (const TOOL_EVENT &aEvent)
 
int modifiedSelection (const TOOL_EVENT &aEvent)
 

Static Private Member Functions

static bool addCornerCondition (const SELECTION &aSelection)
 

Condition to display "Create corner" context menu entry.

More...
 
static bool canAddCorner (const EDA_ITEM &aItem)
 

Determine if the tool can currently add a corner to the given item

More...
 

Private Attributes

SELECTION_TOOLm_selectionTool
 

Selection tool used for obtaining selected items

More...
 
EDIT_POINTm_editedPoint
 

Currently edited point, NULL if there is none.

More...
 
EDIT_POINT m_original
 

Original position for the current drag point.

More...
 
std::shared_ptr< EDIT_POINTSm_editPoints
 

Currently available edit points.

More...
 
std::shared_ptr< EDIT_CONSTRAINT< EDIT_POINT > > m_altConstraint
 
EDIT_POINT m_altConstrainer
 
bool m_refill
 
std::unique_ptr< STATUS_TEXT_POPUPm_statusPopup
 

Detailed Description

POINT_EDITOR.

Tool that displays edit points allowing to modify items by dragging the points.

Definition at line 43 of file point_editor.h.

Member Enumeration Documentation

◆ INTERACTIVE_PLACEMENT_OPTIONS

Options for placing items interactively.

Enumerator
IPO_ROTATE 

Handle the rotate action in the loop by calling the item's rotate method.

IPO_FLIP 

Handle flip action in the loop by calling the item's flip method.

IPO_SINGLE_CLICK 

Create an item immediately on placement starting, otherwise show the pencil cursor until the item is created.

IPO_REPEAT 

Allow repeat placement of the item.

Definition at line 116 of file pcb_tool_base.h.

116  {
118  IPO_ROTATE = 0x01,
119 
121  IPO_FLIP = 0x02,
122 
125  IPO_SINGLE_CLICK = 0x04,
126 
128  IPO_REPEAT = 0x08
129  };
Handle flip action in the loop by calling the item's flip method.
Allow repeat placement of the item.
Create an item immediately on placement starting, otherwise show the pencil cursor until the item is ...
Handle the rotate action in the loop by calling the item's rotate method.

◆ RESET_REASON

enum TOOL_BASE::RESET_REASON
inherited

Determines the reason of reset for a tool

Enumerator
RUN 

Tool is invoked after being inactive.

MODEL_RELOAD 

Model changes (required full reload)

GAL_SWITCH 

Rendering engine changes.

Definition at line 79 of file tool_base.h.

80  {
81  RUN,
82  MODEL_RELOAD,
83  GAL_SWITCH
84  };
Model changes (required full reload)
Definition: tool_base.h:82
Tool is invoked after being inactive.
Definition: tool_base.h:81
Rendering engine changes.
Definition: tool_base.h:83

Constructor & Destructor Documentation

◆ POINT_EDITOR()

POINT_EDITOR::POINT_EDITOR ( )

Definition at line 278 of file point_editor.cpp.

278  :
279  PCB_TOOL_BASE( "pcbnew.PointEditor" ),
281  m_editedPoint( NULL ),
282  m_original( VECTOR2I( 0, 0 ) ),
283  m_altConstrainer( VECTOR2I( 0, 0 ) ),
284  m_refill( false )
285 {
286 }
VECTOR2< int > VECTOR2I
Definition: vector2d.h:594
#define NULL
SELECTION_TOOL * m_selectionTool
Selection tool used for obtaining selected items
Definition: point_editor.h:72
PCB_TOOL_BASE(TOOL_ID aId, const std::string &aName)
Constructor.
Definition: pcb_tool_base.h:75
EDIT_POINT m_original
Original position for the current drag point.
Definition: point_editor.h:78
EDIT_POINT m_altConstrainer
Definition: point_editor.h:87
EDIT_POINT * m_editedPoint
Currently edited point, NULL if there is none.
Definition: point_editor.h:75

Member Function Documentation

◆ Activate()

void TOOL_INTERACTIVE::Activate ( )
inherited

Function Activate() Runs the tool.

After activation, the tool starts receiving events until it is finished.

Definition at line 51 of file tool_interactive.cpp.

52 {
54 }
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:219
TOOL_ID m_toolId
Unique identifier for the tool, assigned by a TOOL_MANAGER instance.
Definition: tool_base.h:214
bool InvokeTool(TOOL_ID aToolId)
Function InvokeTool() Calls a tool by sending a tool activation event to tool of given ID.

References TOOL_MANAGER::InvokeTool(), TOOL_BASE::m_toolId, and TOOL_BASE::m_toolMgr.

Referenced by AUTOPLACE_TOOL::autoplace(), EDIT_TOOL::copyToClipboard(), LIB_EDIT_TOOL::DeleteItemCursor(), PL_EDIT_TOOL::DeleteItemCursor(), SCH_EDIT_TOOL::DeleteItemCursor(), PCBNEW_CONTROL::DeleteItemCursor(), SCH_LINE_WIRE_BUS_TOOL::doDrawSegments(), PCB_TOOL_BASE::doInteractiveItemPlacement(), EDIT_TOOL::doMoveSelection(), DRAWING_TOOL::DrawArc(), DRAWING_TOOL::DrawCircle(), DRAWING_TOOL::DrawDimension(), DRAWING_TOOL::DrawLine(), MICROWAVE_TOOL::drawMicrowaveInductor(), DRAWING_TOOL::DrawRectangle(), LIB_DRAWING_TOOLS::DrawShape(), PL_DRAWING_TOOLS::DrawShape(), SCH_DRAWING_TOOLS::DrawSheet(), DRAWING_TOOL::DrawZone(), PCB_EDITOR_CONTROL::DrillOrigin(), PAD_TOOL::EnumeratePads(), PCBNEW_CONTROL::GridSetOrigin(), SCH_EDITOR_CONTROL::HighlightNetCursor(), PCB_INSPECTION_TOOL::HighlightNetTool(), ROUTER_TOOL::InlineBreakTrack(), ROUTER_TOOL::InlineDrag(), PCB_INSPECTION_TOOL::LocalRatsnestTool(), PL_EDIT_TOOL::Main(), EE_POINT_EDITOR::Main(), LIB_MOVE_TOOL::Main(), PL_POINT_EDITOR::Main(), SCH_MOVE_TOOL::Main(), PCBNEW_PICKER_TOOL::Main(), PICKER_TOOL::Main(), ROUTER_TOOL::MainLoop(), LENGTH_TUNER_TOOL::MainLoop(), PCB_VIEWER_TOOLS::MeasureTool(), GERBVIEW_SELECTION_TOOL::MeasureTool(), LIB_TREE::onContextMenu(), OnSelectionChange(), LIB_DRAWING_TOOLS::PlaceAnchor(), SCH_DRAWING_TOOLS::PlaceComponent(), SCH_DRAWING_TOOLS::PlaceImage(), DRAWING_TOOL::PlaceImportedGraphics(), PL_DRAWING_TOOLS::PlaceItem(), PCB_EDITOR_CONTROL::PlaceModule(), PCB_EDITOR_CONTROL::PlaceTarget(), DRAWING_TOOL::PlaceText(), EDIT_TOOL::Remove(), POSITION_RELATIVE_TOOL::SelectPositionRelativeItem(), DRAWING_TOOL::SetAnchor(), DRC::ShowDRCDialog(), SCH_DRAWING_TOOLS::SingleClickPlace(), LIB_DRAWING_TOOLS::TwoClickPlace(), SCH_DRAWING_TOOLS::TwoClickPlace(), and SCH_LINE_WIRE_BUS_TOOL::UnfoldBus().

◆ addCorner()

int POINT_EDITOR::addCorner ( const TOOL_EVENT aEvent)
private

TOOL_ACTION handlers.

Definition at line 1443 of file point_editor.cpp.

1444 {
1445  if( !m_editPoints )
1446  return 0;
1447 
1448  EDA_ITEM* item = m_editPoints->GetParent();
1449  PCB_BASE_EDIT_FRAME* frame = getEditFrame<PCB_BASE_EDIT_FRAME>();
1450  const VECTOR2I& cursorPos = getViewControls()->GetCursorPosition();
1451 
1452  // called without an active edited polygon
1453  if( !item || !canAddCorner( *item ) )
1454  return 0;
1455 
1456  DRAWSEGMENT* graphicItem = dynamic_cast<DRAWSEGMENT*>( item );
1457  BOARD_COMMIT commit( frame );
1458 
1459  if( item->Type() == PCB_ZONE_AREA_T || item->Type() == PCB_MODULE_ZONE_AREA_T ||
1460  ( graphicItem && graphicItem->GetShape() == S_POLYGON ) )
1461  {
1462  unsigned int nearestIdx = 0;
1463  unsigned int nextNearestIdx = 0;
1464  unsigned int nearestDist = INT_MAX;
1465  unsigned int firstPointInContour = 0;
1466  SHAPE_POLY_SET* zoneOutline;
1467 
1468  if( item->Type() == PCB_ZONE_AREA_T || item->Type() == PCB_MODULE_ZONE_AREA_T )
1469  {
1470  ZONE_CONTAINER* zone = static_cast<ZONE_CONTAINER*>( item );
1471  zoneOutline = zone->Outline();
1472  zone->SetNeedRefill( true );
1473  }
1474  else
1475  zoneOutline = &( graphicItem->GetPolyShape() );
1476 
1477  commit.Modify( item );
1478 
1479  // Search the best outline segment to add a new corner
1480  // and therefore break this segment into two segments
1481 
1482  // Object to iterate through the corners of the outlines (main contour and its holes)
1483  SHAPE_POLY_SET::ITERATOR iterator = zoneOutline->Iterate( 0,
1484  zoneOutline->OutlineCount()-1, /* IterateHoles */ true );
1485  int curr_idx = 0;
1486 
1487  // Iterate through all the corners of the outlines and search the best segment
1488  for( ; iterator; iterator++, curr_idx++ )
1489  {
1490  int jj = curr_idx+1;
1491 
1492  if( iterator.IsEndContour() )
1493  { // We reach the last point of the current contour (main or hole)
1494  jj = firstPointInContour;
1495  firstPointInContour = curr_idx+1; // Prepare next contour analysis
1496  }
1497 
1498  SEG curr_segment( zoneOutline->CVertex( curr_idx ), zoneOutline->CVertex( jj ) );
1499 
1500  unsigned int distance = curr_segment.Distance( cursorPos );
1501 
1502  if( distance < nearestDist )
1503  {
1504  nearestDist = distance;
1505  nearestIdx = curr_idx;
1506  nextNearestIdx = jj;
1507  }
1508  }
1509 
1510  // Find the point on the closest segment
1511  auto& sideOrigin = zoneOutline->CVertex( nearestIdx );
1512  auto& sideEnd = zoneOutline->CVertex( nextNearestIdx );
1513  SEG nearestSide( sideOrigin, sideEnd );
1514  VECTOR2I nearestPoint = nearestSide.NearestPoint( cursorPos );
1515 
1516  // Do not add points that have the same coordinates as ones that already belong to polygon
1517  // instead, add a point in the middle of the side
1518  if( nearestPoint == sideOrigin || nearestPoint == sideEnd )
1519  nearestPoint = ( sideOrigin + sideEnd ) / 2;
1520 
1521  zoneOutline->InsertVertex( nextNearestIdx, nearestPoint );
1522 
1523  // We re-hatch the filled zones but not polygons
1524  if( item->Type() == PCB_ZONE_AREA_T || item->Type() == PCB_MODULE_ZONE_AREA_T )
1525  static_cast<ZONE_CONTAINER*>( item )->HatchBorder();
1526 
1527 
1528  commit.Push( _( "Add a zone corner" ) );
1529  }
1530 
1531  else if( graphicItem && graphicItem->GetShape() == S_SEGMENT )
1532  {
1533  commit.Modify( graphicItem );
1534 
1535  SEG seg( graphicItem->GetStart(), graphicItem->GetEnd() );
1536  VECTOR2I nearestPoint = seg.NearestPoint( cursorPos );
1537 
1538  // Move the end of the line to the break point..
1539  graphicItem->SetEnd( wxPoint( nearestPoint.x, nearestPoint.y ) );
1540 
1541  if( graphicItem->Type() == PCB_MODULE_EDGE_T )
1542  static_cast<EDGE_MODULE*>( graphicItem )->SetLocalCoord();
1543 
1544  // and add another one starting from the break point
1545  DRAWSEGMENT* newSegment;
1546 
1547  if( item->Type() == PCB_MODULE_EDGE_T )
1548  {
1549  EDGE_MODULE* edge = static_cast<EDGE_MODULE*>( graphicItem );
1550  assert( edge->GetParent()->Type() == PCB_MODULE_T );
1551  newSegment = new EDGE_MODULE( *edge );
1552  }
1553  else
1554  {
1555  newSegment = new DRAWSEGMENT( *graphicItem );
1556  }
1557 
1558  newSegment->ClearSelected();
1559  newSegment->SetStart( wxPoint( nearestPoint.x, nearestPoint.y ) );
1560  newSegment->SetEnd( wxPoint( seg.B.x, seg.B.y ) );
1561 
1562  if( newSegment->Type() == PCB_MODULE_EDGE_T )
1563  static_cast<EDGE_MODULE*>( newSegment )->SetLocalCoord();
1564 
1565  commit.Add( newSegment );
1566  commit.Push( _( "Split segment" ) );
1567  }
1568 
1569  updatePoints();
1570  return 0;
1571 }
ZONE_CONTAINER handles a list of polygons defining a copper zone.
Definition: class_zone.h:61
int OutlineCount() const
Returns the number of outlines in the set
bool IsEndContour() const
Function IsEndContour.
void ClearSelected()
Definition: base_struct.h:211
STROKE_T GetShape() const
const VECTOR2I & CVertex(int aIndex, int aOutline, int aHole) const
Returns the index-th vertex in a given hole outline within a given outline
polygon (not yet used for tracks, but could be in microwave apps)
class ZONE_CONTAINER, a zone area
Definition: typeinfo.h:102
SHAPE_POLY_SET * Outline()
Definition: class_zone.h:281
usual segment : line with rounded ends
ITERATOR Iterate(int aFirst, int aLast, bool aIterateHoles=false)
Function Iterate returns an object to iterate through the points of the polygons between aFirst and a...
const wxPoint & GetEnd() const
Function GetEnd returns the ending point of the graphic.
class EDGE_MODULE, a footprint edge
Definition: typeinfo.h:94
PCB_BASE_EDIT_FRAME * frame() const
std::shared_ptr< EDIT_POINTS > m_editPoints
Currently available edit points.
Definition: point_editor.h:81
class MODULE, a footprint
Definition: typeinfo.h:89
SHAPE_POLY_SET.
SHAPE_POLY_SET & GetPolyShape()
void SetStart(const wxPoint &aStart)
Definition: seg.h:39
Common, abstract interface for edit frames.
#define _(s)
Definition: 3d_actions.cpp:33
static float distance(const SFVEC2UI &a, const SFVEC2UI &b)
static bool canAddCorner(const EDA_ITEM &aItem)
Determine if the tool can currently add a corner to the given item
EDA_ITEM is a base class for most all the KiCad significant classes, used in schematics and boards.
Definition: base_struct.h:159
void updatePoints()
Updates edit points with item's points.
void SetEnd(const wxPoint &aEnd)
void InsertVertex(int aGlobalIndex, VECTOR2I aNewVertex)
Function InsertVertex Adds a vertex in the globally indexed position aGlobalIndex.
const wxPoint & GetStart() const
Function GetStart returns the starting point of the graphic.
KIGFX::VIEW_CONTROLS * getViewControls() const
Function getViewControls()
Definition: tool_base.cpp:42
class ZONE_CONTAINER, managed by a footprint
Definition: typeinfo.h:95
BOARD_ITEM_CONTAINER * GetParent() const
VECTOR2D GetCursorPosition() const
Returns the current cursor position in world coordinates.
KICAD_T Type() const
Function Type()
Definition: base_struct.h:193
void SetNeedRefill(bool aNeedRefill)
Definition: class_zone.h:193

References _, COMMIT::Add(), canAddCorner(), EDA_ITEM::ClearSelected(), SHAPE_POLY_SET::CVertex(), distance(), PCB_TOOL_BASE::frame(), KIGFX::VIEW_CONTROLS::GetCursorPosition(), DRAWSEGMENT::GetEnd(), BOARD_ITEM::GetParent(), DRAWSEGMENT::GetPolyShape(), DRAWSEGMENT::GetShape(), DRAWSEGMENT::GetStart(), TOOL_BASE::getViewControls(), SHAPE_POLY_SET::InsertVertex(), SHAPE_POLY_SET::ITERATOR_TEMPLATE< T >::IsEndContour(), SHAPE_POLY_SET::Iterate(), m_editPoints, COMMIT::Modify(), SEG::NearestPoint(), ZONE_CONTAINER::Outline(), SHAPE_POLY_SET::OutlineCount(), PCB_MODULE_EDGE_T, PCB_MODULE_T, PCB_MODULE_ZONE_AREA_T, PCB_ZONE_AREA_T, BOARD_COMMIT::Push(), S_POLYGON, S_SEGMENT, DRAWSEGMENT::SetEnd(), ZONE_CONTAINER::SetNeedRefill(), DRAWSEGMENT::SetStart(), EDA_ITEM::Type(), and updatePoints().

Referenced by setTransitions().

◆ addCornerCondition()

bool POINT_EDITOR::addCornerCondition ( const SELECTION aSelection)
staticprivate

Condition to display "Create corner" context menu entry.

Definition at line 1375 of file point_editor.cpp.

1376 {
1377  if( aSelection.Size() != 1 )
1378  return false;
1379 
1380  const EDA_ITEM* item = aSelection.Front();
1381 
1382  return ( item != nullptr ) && canAddCorner( *item );
1383 }
static bool canAddCorner(const EDA_ITEM &aItem)
Determine if the tool can currently add a corner to the given item
int Size() const
Returns the number of selected parts.
Definition: selection.h:127
EDA_ITEM is a base class for most all the KiCad significant classes, used in schematics and boards.
Definition: base_struct.h:159
EDA_ITEM * Front() const
Definition: selection.h:184

References canAddCorner(), SELECTION::Front(), and SELECTION::Size().

Referenced by Init().

◆ attachManager()

void TOOL_BASE::attachManager ( TOOL_MANAGER aManager)
protectedinherited

Function attachManager()

Sets the TOOL_MANAGER the tool will belong to. Called by TOOL_MANAGER::RegisterTool()

Definition at line 60 of file tool_base.cpp.

61 {
62  m_toolMgr = aManager;
63 }
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:219

References TOOL_BASE::m_toolMgr.

Referenced by TOOL_MANAGER::RegisterTool().

◆ board()

BOARD* PCB_TOOL_BASE::board ( ) const
inlineprotectedinherited

Definition at line 166 of file pcb_tool_base.h.

166 { return getModel<BOARD>(); }

Referenced by PCBNEW_CONTROL::AppendBoard(), AUTOPLACE_TOOL::autoplace(), PCB_INSPECTION_TOOL::calculateSelectionRatsnest(), EDIT_TOOL::ChangeTrackWidth(), ZONE_FILLER_TOOL::CheckAllZones(), checkClearancePadToPad(), checkClearanceSegmToPad(), PCB_INSPECTION_TOOL::ClearHighlight(), DRAWING_TOOL::constrainDimension(), EDIT_TOOL::copyToClipboard(), MICROWAVE_TOOL::createInductorBetween(), ROUTER_TOOL::CustomTrackWidthDialog(), PCBNEW_CONTROL::DeleteItemCursor(), PCB_TOOL_BASE::doInteractiveItemPlacement(), DRAWING_TOOL::drawArc(), DRAWING_TOOL::DrawDimension(), DRAWING_TOOL::drawSegment(), PAD_TOOL::EnumeratePads(), PAD_TOOL::explodePad(), ZONE_FILLER_TOOL::FillAllZones(), SELECTION_TOOL::filterSelection(), SELECTION_TOOL::getCollectorsGuide(), PCB_INSPECTION_TOOL::highlightNet(), PCBNEW_CONTROL::LayerNext(), PCBNEW_CONTROL::LayerPrev(), PCB_INSPECTION_TOOL::LocalRatsnestTool(), PCB_TOOL_BASE::module(), EDIT_TOOL::MoveExact(), ROUTER_TOOL::onTrackViaSizeChanged(), ROUTER_TOOL::onViaCommand(), PCBNEW_CONTROL::Paste(), PCBNEW_CONTROL::placeBoardItems(), PCB_EDITOR_CONTROL::PlaceModule(), PAD_TOOL::PlacePad(), PCB_EDITOR_CONTROL::PlaceTarget(), DRAWING_TOOL::PlaceText(), ROUTER_TOOL::prepareInteractive(), SELECTION_TOOL::RebuildSelection(), PAD_TOOL::recombinePad(), EDIT_TOOL::Remove(), PNS::TOOL_BASE::Reset(), PCBNEW_CONTROL::Reset(), SELECTION_TOOL::Selectable(), SELECTION_TOOL::selectAllItemsOnNet(), SELECTION_TOOL::selectAllItemsOnSheet(), SELECTION_TOOL::selectConnectedTracks(), SELECTION_TOOL::selectPoint(), PCBNEW_CONTROL::TrackDisplayMode(), updateItem(), PCBNEW_CONTROL::ViaDisplayMode(), PCBNEW_CONTROL::ZoneDisplayMode(), ZONE_FILLER_TOOL::ZoneFill(), PCB_EDITOR_CONTROL::ZoneMerge(), and ZONE_FILLER_TOOL::ZoneUnfillAll().

◆ canAddCorner()

bool POINT_EDITOR::canAddCorner ( const EDA_ITEM aItem)
staticprivate

Determine if the tool can currently add a corner to the given item

Definition at line 1363 of file point_editor.cpp.

1364 {
1365  const auto type = aItem.Type();
1366 
1367  // Works only for zones and line segments
1368  return type == PCB_ZONE_AREA_T || type == PCB_MODULE_ZONE_AREA_T ||
1369  ( ( type == PCB_LINE_T || type == PCB_MODULE_EDGE_T ) &&
1370  ( static_cast<const DRAWSEGMENT&>( aItem ).GetShape() == S_SEGMENT ||
1371  static_cast<const DRAWSEGMENT&>( aItem ).GetShape() == S_POLYGON ) );
1372 }
polygon (not yet used for tracks, but could be in microwave apps)
class ZONE_CONTAINER, a zone area
Definition: typeinfo.h:102
usual segment : line with rounded ends
class EDGE_MODULE, a footprint edge
Definition: typeinfo.h:94
class ZONE_CONTAINER, managed by a footprint
Definition: typeinfo.h:95
class DRAWSEGMENT, a segment not on copper layers
Definition: typeinfo.h:91
KICAD_T Type() const
Function Type()
Definition: base_struct.h:193

References PCB_LINE_T, PCB_MODULE_EDGE_T, PCB_MODULE_ZONE_AREA_T, PCB_ZONE_AREA_T, S_POLYGON, S_SEGMENT, and EDA_ITEM::Type().

Referenced by addCorner(), and addCornerCondition().

◆ canvas()

◆ controls()

◆ displayOptions()

const PCB_DISPLAY_OPTIONS & PCB_TOOL_BASE::displayOptions ( ) const
protectedinherited

◆ doInteractiveItemPlacement()

void PCB_TOOL_BASE::doInteractiveItemPlacement ( const std::string &  aTool,
INTERACTIVE_PLACER_BASE aPlacer,
const wxString &  aCommitMessage,
int  aOptions = IPO_ROTATE | IPO_FLIP | IPO_REPEAT 
)
protectedinherited

Helper function for performing a common interactive idiom: wait for a left click, place an item there (perhaps with a dialog or other user interaction), then have it move with the mouse and respond to rotate/flip, etc.

More complex interactive processes are not supported here, you should implement a customised event loop for those.

Parameters
aItemCreatorthe callable that will attempt to create the item
aCommitMessagethe message used on a successful commit

Definition at line 37 of file pcb_tool_base.cpp.

40 {
41  using namespace std::placeholders;
42  std::unique_ptr<BOARD_ITEM> newItem;
43 
44  frame()->PushTool( aTool );
45  Activate();
46 
47  BOARD_COMMIT commit( frame() );
48 
50 
51  // do not capture or auto-pan until we start placing an item
52  controls()->ShowCursor( true );
53  controls()->SetSnapping( true );
54 
55  // Add a VIEW_GROUP that serves as a preview for the new item
56  PCBNEW_SELECTION preview;
57  view()->Add( &preview );
58 
59  aPlacer->m_board = board();
60  aPlacer->m_frame = frame();
61  aPlacer->m_modifiers = 0;
62 
63  auto makeNewItem = [&] ( VECTOR2I aPosition )
64  {
65  if( frame()->GetModel() )
66  newItem = aPlacer->CreateItem();
67 
68  if( newItem )
69  {
70  newItem->SetPosition( (wxPoint) aPosition );
71  preview.Add( newItem.get() );
72 
73  if( newItem->Type() == PCB_MODULE_T )
74  {
75  auto module = dyn_cast<MODULE*>( newItem.get() );
76 
77  // modules have more drawable parts
78  module->RunOnChildren( std::bind( &KIGFX::VIEW_GROUP::Add, &preview, _1 ) );
79  }
80  }
81  };
82 
83  if( aOptions & IPO_SINGLE_CLICK )
84  makeNewItem( controls()->GetCursorPosition() );
85 
86  // Main loop: keep receiving events
87  while( TOOL_EVENT* evt = Wait() )
88  {
89  if( !newItem )
90  frame()->GetCanvas()->SetCurrentCursor( wxCURSOR_PENCIL );
91  else
92  frame()->GetCanvas()->SetCurrentCursor( wxCURSOR_ARROW );
93 
94  VECTOR2I cursorPos = controls()->GetCursorPosition();
95  aPlacer->m_modifiers = evt->Modifier();
96 
97  auto cleanup = [&] ()
98  {
99  newItem = nullptr;
100  preview.Clear();
101  view()->Update( &preview );
102  controls()->SetAutoPan( false );
103  controls()->CaptureCursor( false );
104  controls()->ShowCursor( true );
105  };
106 
107  if( evt->IsCancelInteractive() )
108  {
109  if( aOptions & IPO_SINGLE_CLICK )
110  {
111  cleanup();
112  frame()->PopTool( aTool );
113  break;
114  }
115  else if( newItem )
116  cleanup();
117  else
118  {
119  frame()->PopTool( aTool );
120  break;
121  }
122  }
123  else if( evt->IsActivate() )
124  {
125  if( newItem )
126  cleanup();
127 
128  if( evt->IsPointEditor() )
129  {
130  // don't exit (the point editor runs in the background)
131  }
132  else if( evt->IsMoveTool() )
133  {
134  // leave ourselves on the stack so we come back after the move
135  break;
136  }
137  else
138  {
139  frame()->PopTool( aTool );
140  break;
141  }
142  }
143  else if( evt->IsClick( BUT_LEFT ) )
144  {
145  if( !newItem )
146  {
147  // create the item if possible
148  makeNewItem( cursorPos );
149 
150  // no item created, so wait for another click
151  if( !newItem )
152  continue;
153 
154  controls()->CaptureCursor( true );
155  controls()->SetAutoPan( true );
156  }
157  else
158  {
159  auto oldFlags = newItem->GetFlags();
160  newItem->ClearFlags();
161 
162  if( !aPlacer->PlaceItem( newItem.get(), commit ) )
163  {
164  newItem->SetFlags( oldFlags );
165  continue;
166  }
167 
168  preview.Clear();
169  newItem.release();
170  commit.Push( aCommitMessage );
171 
172  controls()->CaptureCursor( false );
173  controls()->SetAutoPan( false );
174  controls()->ShowCursor( true );
175 
176  if( !( aOptions & IPO_REPEAT ) )
177  break;
178 
179  if( aOptions & IPO_SINGLE_CLICK )
180  makeNewItem( controls()->GetCursorPosition() );
181  }
182  }
183  else if( evt->IsClick( BUT_RIGHT ) )
184  {
186  }
187  else if( newItem && evt->Category() == TC_COMMAND )
188  {
189  /*
190  * Handle any events that can affect the item as we move it around
191  */
192  if( TOOL_EVT_UTILS::IsRotateToolEvt( *evt ) && ( aOptions & IPO_ROTATE ) )
193  {
194  const int rotationAngle = TOOL_EVT_UTILS::GetEventRotationAngle( *frame(), *evt );
195  newItem->Rotate( newItem->GetPosition(), rotationAngle );
196  view()->Update( &preview );
197  }
198  else if( evt->IsAction( &PCB_ACTIONS::flip ) && ( aOptions & IPO_FLIP ) )
199  {
200  newItem->Flip( newItem->GetPosition(), frame()->Settings().m_FlipLeftRight );
201  view()->Update( &preview );
202  }
203  else if( evt->IsAction( &PCB_ACTIONS::viaSizeInc )
204  || evt->IsAction( &PCB_ACTIONS::viaSizeDec ) )
205  {
206  // Refresh preview after event runs
208  }
209  else if( evt->IsAction( &ACTIONS::refreshPreview ) )
210  {
211  preview.Clear();
212  newItem.release();
213 
214  makeNewItem( controls()->GetCursorPosition() );
215  view()->Update( &preview );
216  }
217  }
218 
219  else if( newItem && evt->IsMotion() )
220  {
221  // track the cursor
222  newItem->SetPosition( wxPoint( cursorPos.x, cursorPos.y ) );
223  aPlacer->SnapItem( newItem.get() );
224 
225  // Show a preview of the item
226  view()->Update( &preview );
227  }
228 
229  else
230  evt->SetPassEvent();
231  }
232 
233  view()->Remove( &preview );
234 }
static TOOL_ACTION selectionClear
Clears the current selection.
Definition: pcb_actions.h:62
virtual void ShowCursor(bool aEnabled)
Function ShowCursor() Enables or disables display of cursor.
TOOL_MENU m_menu
functions below are not yet implemented - their interface may change
virtual void Clear() override
Function Clear() Removes all the stored items from the group.
Definition: selection.h:95
void RunOnChildren(const std::function< void(BOARD_ITEM *)> &aFunction)
Function RunOnChildren.
TOOL_EVENT * Wait(const TOOL_EVENT_LIST &aEventList=TOOL_EVENT(TC_ANY, TA_ANY))
Function Wait()
virtual bool PlaceItem(BOARD_ITEM *aItem, BOARD_COMMIT &aCommit)
Handle flip action in the loop by calling the item's flip method.
BOARD * board() const
virtual void Update(VIEW_ITEM *aItem, int aUpdateFlags) override
For dynamic VIEWs, informs the associated VIEW that the graphical representation of this item has cha...
Definition: pcb_view.cpp:92
static TOOL_ACTION viaSizeInc
Definition: pcb_actions.h:279
virtual std::unique_ptr< BOARD_ITEM > CreateItem()=0
void SetCurrentCursor(wxStockCursor aStockCursorID)
Function SetCurrentCursor Set the current cursor shape for this panel.
PCB_DRAW_PANEL_GAL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:219
virtual void PushTool(const std::string &actionName)
NB: the definition of "tool" is different at the user level.
virtual void SetSnapping(bool aEnabled)
Function SetSnapping() Enables/disables snapping cursor to grid.
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Function RunAction() Runs the specified action.
Definition: tool_manager.h:140
bool IsRotateToolEvt(const TOOL_EVENT &aEvt)
Function isRotateToolEvt()
virtual void Remove(VIEW_ITEM *aItem) override
Function Remove() Removes a VIEW_ITEM from the view.
Definition: pcb_view.cpp:75
virtual void Add(EDA_ITEM *aItem)
Definition: selection.h:76
TOOL_MANAGER * GetManager() const
Function GetManager() Returns the instance of TOOL_MANAGER that takes care of the tool.
Definition: tool_base.h:143
PCB_BASE_EDIT_FRAME * frame() const
virtual void SnapItem(BOARD_ITEM *aItem)
class MODULE, a footprint
Definition: typeinfo.h:89
const PCBNEW_SELECTION & selection() const
Allow repeat placement of the item.
virtual void PopTool(const std::string &actionName)
virtual void CaptureCursor(bool aEnabled)
Function CaptureCursor() Forces the cursor to stay within the drawing panel area.
TOOL_EVENT.
Definition: tool_event.h:171
KIGFX::PCB_VIEW * view() const
Create an item immediately on placement starting, otherwise show the pencil cursor until the item is ...
virtual void Add(VIEW_ITEM *aItem)
Function Add() Adds an item to the group.
Definition: view_group.cpp:55
virtual void SetAutoPan(bool aEnabled)
Function SetAutoPan Turns on/off auto panning (this feature is used when there is a tool active (eg.
virtual BOARD_ITEM_CONTAINER * GetModel() const =0
Function GetModel()
static TOOL_ACTION flip
Flipping of selected objects.
Definition: pcb_actions.h:103
Handle the rotate action in the loop by calling the item's rotate method.
KIGFX::VIEW_CONTROLS * controls() const
MODULE * module() const
PCBNEW_SETTINGS & Settings()
void Activate()
Function Activate() Runs the tool.
virtual void Add(VIEW_ITEM *aItem, int aDrawPriority=-1) override
Function Add() Adds a VIEW_ITEM to the view.
Definition: pcb_view.cpp:58
PCB_BASE_EDIT_FRAME * m_frame
Definition: pcb_tool_base.h:62
int GetEventRotationAngle(const PCB_BASE_EDIT_FRAME &aFrame, const TOOL_EVENT &aEvt)
Function getEventRotationAngle()
void ShowContextMenu(SELECTION &aSelection)
Function ShowContextMenu.
Definition: tool_menu.cpp:59
static TOOL_ACTION viaSizeDec
Definition: pcb_actions.h:280
static TOOL_ACTION refreshPreview
Definition: actions.h:102
VECTOR2D GetCursorPosition() const
Returns the current cursor position in world coordinates.

References TOOL_INTERACTIVE::Activate(), KIGFX::PCB_VIEW::Add(), KIGFX::VIEW_GROUP::Add(), SELECTION::Add(), PCB_TOOL_BASE::board(), BUT_LEFT, BUT_RIGHT, KIGFX::VIEW_CONTROLS::CaptureCursor(), SELECTION::Clear(), PCB_TOOL_BASE::controls(), INTERACTIVE_PLACER_BASE::CreateItem(), PCB_ACTIONS::flip, PCB_TOOL_BASE::frame(), PCB_BASE_FRAME::GetCanvas(), KIGFX::VIEW_CONTROLS::GetCursorPosition(), TOOL_EVT_UTILS::GetEventRotationAngle(), TOOL_BASE::GetManager(), PCB_BASE_FRAME::GetModel(), PCB_TOOL_BASE::IPO_FLIP, PCB_TOOL_BASE::IPO_REPEAT, PCB_TOOL_BASE::IPO_ROTATE, PCB_TOOL_BASE::IPO_SINGLE_CLICK, TOOL_EVT_UTILS::IsRotateToolEvt(), INTERACTIVE_PLACER_BASE::m_board, PCBNEW_SETTINGS::m_FlipLeftRight, INTERACTIVE_PLACER_BASE::m_frame, TOOL_INTERACTIVE::m_menu, INTERACTIVE_PLACER_BASE::m_modifiers, TOOL_BASE::m_toolMgr, PCB_TOOL_BASE::module(), PCB_MODULE_T, INTERACTIVE_PLACER_BASE::PlaceItem(), TOOLS_HOLDER::PopTool(), BOARD_COMMIT::Push(), TOOLS_HOLDER::PushTool(), ACTIONS::refreshPreview, KIGFX::PCB_VIEW::Remove(), TOOL_MANAGER::RunAction(), MODULE::RunOnChildren(), PCB_TOOL_BASE::selection(), PCB_ACTIONS::selectionClear, KIGFX::VIEW_CONTROLS::SetAutoPan(), EDA_DRAW_PANEL_GAL::SetCurrentCursor(), KIGFX::VIEW_CONTROLS::SetSnapping(), PCB_BASE_FRAME::Settings(), TOOL_MENU::ShowContextMenu(), KIGFX::VIEW_CONTROLS::ShowCursor(), INTERACTIVE_PLACER_BASE::SnapItem(), TC_COMMAND, KIGFX::PCB_VIEW::Update(), PCB_ACTIONS::viaSizeDec, PCB_ACTIONS::viaSizeInc, PCB_TOOL_BASE::view(), TOOL_INTERACTIVE::Wait(), VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by MICROWAVE_TOOL::addMicrowaveFootprint(), DRAWING_TOOL::DrawVia(), and PAD_TOOL::PlacePad().

◆ EditingModules()

bool PCB_TOOL_BASE::EditingModules ( ) const
inlineinherited

◆ finishItem()

void POINT_EDITOR::finishItem ( )
private

Applies the last changes to the edited item.

Definition at line 1035 of file point_editor.cpp.

1036 {
1037  auto item = m_editPoints->GetParent();
1038 
1039  if( !item )
1040  return;
1041 
1042  if( item->Type() == PCB_ZONE_AREA_T || item->Type() == PCB_MODULE_ZONE_AREA_T )
1043  {
1044  auto zone = static_cast<ZONE_CONTAINER*>( item );
1045 
1046  if( zone->IsFilled() && m_refill && zone->NeedRefill() )
1047  m_toolMgr->RunAction( PCB_ACTIONS::zoneFill, true, zone );
1048  }
1049 }
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:219
class ZONE_CONTAINER, a zone area
Definition: typeinfo.h:102
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Function RunAction() Runs the specified action.
Definition: tool_manager.h:140
static TOOL_ACTION zoneFill
Definition: pcb_actions.h:285
std::shared_ptr< EDIT_POINTS > m_editPoints
Currently available edit points.
Definition: point_editor.h:81
class ZONE_CONTAINER, managed by a footprint
Definition: typeinfo.h:95

References m_editPoints, m_refill, TOOL_BASE::m_toolMgr, PCB_MODULE_ZONE_AREA_T, PCB_ZONE_AREA_T, TOOL_MANAGER::RunAction(), and PCB_ACTIONS::zoneFill.

Referenced by OnSelectionChange().

◆ frame()

PCB_BASE_EDIT_FRAME* PCB_TOOL_BASE::frame ( ) const
inlineprotectedinherited

Definition at line 161 of file pcb_tool_base.h.

162  {
163  return getEditFrame<PCB_BASE_EDIT_FRAME>();
164  }

Referenced by addCorner(), AUTOPLACE_TOOL::autoplace(), PCB_TOOL_BASE::canvas(), ZONE_FILLER_TOOL::CheckAllZones(), PNS::TOOL_BASE::checkSnap(), PAD_TOOL::copyPadSettings(), EDIT_TOOL::copyToClipboard(), ROUTER_TOOL::CustomTrackWidthDialog(), FOOTPRINT_EDITOR_TOOLS::DeleteFootprint(), PCB_TOOL_BASE::displayOptions(), PCB_TOOL_BASE::doInteractiveItemPlacement(), EDIT_TOOL::doMoveSelection(), ROUTER_TOOL::DpDimensionsDialog(), DRAWING_TOOL::drawArc(), DRAWING_TOOL::DrawDimension(), MICROWAVE_TOOL::drawMicrowaveInductor(), DRAWING_TOOL::drawSegment(), DRAWING_TOOL::DrawVia(), DRAWING_TOOL::DrawZone(), PAD_TOOL::EditPad(), PAD_TOOL::EnumeratePads(), PAD_TOOL::explodePad(), PCB_EDITOR_CONTROL::ExportSpecctraDSN(), ROUTER_TOOL::finishInteractive(), EDIT_TOOL::Flip(), PCB_EDITOR_CONTROL::FlipPcbView(), GLOBAL_EDIT_TOOL::GlobalDeletions(), FOOTPRINT_EDITOR_TOOLS::ImportFootprint(), PCB_EDITOR_CONTROL::ImportSpecctraSession(), SELECTION_TOOL::Init(), EDIT_TOOL::Init(), ROUTER_TOOL::InlineBreakTrack(), ROUTER_TOOL::InlineDrag(), PCBNEW_PICKER_TOOL::Main(), ROUTER_TOOL::MainLoop(), LENGTH_TUNER_TOOL::MainLoop(), LENGTH_TUNER_TOOL::meanderSettingsDialog(), EDIT_TOOL::MoveExact(), OnSelectionChange(), ROUTER_TOOL::onViaCommand(), PCBNEW_CONTROL::Paste(), PAD_TOOL::pastePadProperties(), ROUTER_TOOL::performDragging(), ROUTER_TOOL::performRouting(), LENGTH_TUNER_TOOL::performTuning(), EDIT_TOOL::pickReferencePoint(), PCB_EDITOR_CONTROL::PlaceModule(), PCB_EDITOR_CONTROL::PlaceTarget(), DRAWING_TOOL::PlaceText(), ROUTER_TOOL::prepareInteractive(), PAD_TOOL::pushPadSettings(), PAD_TOOL::recombinePad(), POSITION_RELATIVE_TOOL::RelativeItemSelectionMove(), EDIT_TOOL::Remove(), removeCorner(), PNS::TOOL_BASE::Reset(), ROUTER_TOOL::SelectCopperLayerPair(), POSITION_RELATIVE_TOOL::SelectPositionRelativeItem(), setEditedPoint(), ROUTER_TOOL::SettingsDialog(), GLOBAL_EDIT_TOOL::swapBoardItem(), GLOBAL_EDIT_TOOL::SwapLayers(), ROUTER_TOOL::switchLayerOnViaPlacement(), updateItem(), PCB_EDITOR_CONTROL::UpdateSchematicFromPCB(), ZONE_FILLER_TOOL::ZoneFill(), and ZONE_FILLER_TOOL::ZoneFillAll().

◆ get45DegConstrainer()

EDIT_POINT POINT_EDITOR::get45DegConstrainer ( ) const
private

Returns a point that should be used as a constrainer for 45 degrees mode.

Definition at line 1311 of file point_editor.cpp.

1312 {
1313  EDA_ITEM* item = m_editPoints->GetParent();
1314 
1315  switch( item->Type() )
1316  {
1317  case PCB_LINE_T:
1318  case PCB_MODULE_EDGE_T:
1319  {
1320  const DRAWSEGMENT* segment = static_cast<const DRAWSEGMENT*>( item );
1321  {
1322  switch( segment->GetShape() )
1323  {
1324  case S_SEGMENT:
1325  return *( m_editPoints->Next( *m_editedPoint ) ); // select the other end of line
1326 
1327  case S_ARC:
1328  case S_CIRCLE:
1329  return m_editPoints->Point( CIRC_CENTER );
1330 
1331  default: // suppress warnings
1332  break;
1333  }
1334  }
1335 
1336  break;
1337  }
1338 
1339  case PCB_DIMENSION_T:
1340  {
1341  // Constraint for crossbar
1342  if( isModified( m_editPoints->Point( DIM_FEATUREGO ) ) )
1343  return m_editPoints->Point( DIM_FEATUREDO );
1344 
1345  else if( isModified( m_editPoints->Point( DIM_FEATUREDO ) ) )
1346  return m_editPoints->Point( DIM_FEATUREGO );
1347 
1348  else
1349  return EDIT_POINT( m_editedPoint->GetPosition() ); // no constraint
1350 
1351  break;
1352  }
1353 
1354  default:
1355  break;
1356  }
1357 
1358  // In any other case we may align item to its original position
1359  return m_original;
1360 }
STROKE_T GetShape() const
usual segment : line with rounded ends
bool isModified(const EDIT_POINT &aPoint) const
Returns true if aPoint is the currently modified point.
Definition: point_editor.h:117
class EDGE_MODULE, a footprint edge
Definition: typeinfo.h:94
std::shared_ptr< EDIT_POINTS > m_editPoints
Currently available edit points.
Definition: point_editor.h:81
virtual VECTOR2I GetPosition() const
Function GetPosition()
Definition: edit_points.h:69
Arcs (with rounded ends)
class DIMENSION, a dimension (graphic item)
Definition: typeinfo.h:100
EDA_ITEM is a base class for most all the KiCad significant classes, used in schematics and boards.
Definition: base_struct.h:159
EDIT_POINT m_original
Original position for the current drag point.
Definition: point_editor.h:78
EDIT_POINT.
Definition: edit_points.h:46
class DRAWSEGMENT, a segment not on copper layers
Definition: typeinfo.h:91
EDIT_POINT * m_editedPoint
Currently edited point, NULL if there is none.
Definition: point_editor.h:75
KICAD_T Type() const
Function Type()
Definition: base_struct.h:193

References CIRC_CENTER, DIM_FEATUREDO, DIM_FEATUREGO, EDIT_POINT::GetPosition(), DRAWSEGMENT::GetShape(), isModified(), m_editedPoint, m_editPoints, m_original, PCB_DIMENSION_T, PCB_LINE_T, PCB_MODULE_EDGE_T, S_ARC, S_CIRCLE, S_SEGMENT, and EDA_ITEM::Type().

Referenced by setAltConstraint().

◆ getEditFrame()

template<typename T >
T* TOOL_BASE::getEditFrame ( ) const
inlineprotectedinherited

Function getEditFrame()

Returns the application window object, casted to requested user type.

Definition at line 187 of file tool_base.h.

188  {
189 #if !defined( QA_TEST ) // Dynamic casts give the linker a siezure in the test framework
190  wxASSERT( dynamic_cast<T*>( getToolHolderInt() ) );
191 #endif
192  return static_cast<T*>( getToolHolderInt() );
193  }
TOOLS_HOLDER * getToolHolderInt() const
Definition: tool_base.cpp:48

References TOOL_BASE::getToolHolderInt().

Referenced by ZONE_CREATE_HELPER::createNewZone().

◆ GetId()

TOOL_ID TOOL_BASE::GetId ( ) const
inlineinherited

Function GetId() Returns the unique identifier of the tool.

The identifier is set by an instance of TOOL_MANAGER.

Returns
Identifier of the tool.

Definition at line 121 of file tool_base.h.

122  {
123  return m_toolId;
124  }
TOOL_ID m_toolId
Unique identifier for the tool, assigned by a TOOL_MANAGER instance.
Definition: tool_base.h:214

References TOOL_BASE::m_toolId.

Referenced by TOOL_MANAGER::finishTool(), TOOL_MANAGER::InitTools(), TOOL_MANAGER::isActive(), TOOL_MANAGER::RegisterTool(), ACTION_MANAGER::RunHotKey(), TOOL_MANAGER::runTool(), TOOL_MANAGER::saveViewControls(), and TOOL_MANAGER::ShutdownTool().

◆ GetManager()

TOOL_MANAGER* TOOL_BASE::GetManager ( ) const
inlineinherited

Function GetManager() Returns the instance of TOOL_MANAGER that takes care of the tool.

Returns
Instance of the TOOL_MANAGER. If there is no TOOL_MANAGER associated, it returns NULL.

Definition at line 143 of file tool_base.h.

144  {
145  return m_toolMgr;
146  }
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:219

References TOOL_BASE::m_toolMgr.

Referenced by BOARD_COMMIT::BOARD_COMMIT(), ZONE_CREATE_HELPER::commitZone(), ZONE_CREATE_HELPER::createNewZone(), PCB_TOOL_BASE::doInteractiveItemPlacement(), ACTION_MENU::getToolManager(), LIB_TREE::onContextMenu(), ZONE_CREATE_HELPER::OnFirstPoint(), ACTION_MENU::OnMenuEvent(), and ZONE_CREATE_HELPER::performZoneCutout().

◆ getModel()

template<typename T >
T* TOOL_BASE::getModel ( ) const
inlineprotectedinherited

Function getModel()

Returns the model object if it matches the requested type.

Definition at line 201 of file tool_base.h.

202  {
203  EDA_ITEM* m = getModelInt();
204 #if !defined( QA_TEST ) // Dynamic casts give the linker a siezure in the test framework
205  wxASSERT( dynamic_cast<T*>( m ) );
206 #endif
207  return static_cast<T*>( m );
208  }
EDA_ITEM * getModelInt() const
Definition: tool_base.cpp:54
EDA_ITEM is a base class for most all the KiCad significant classes, used in schematics and boards.
Definition: base_struct.h:159

References TOOL_BASE::getModelInt().

Referenced by ZONE_CREATE_HELPER::commitZone(), ZONE_CREATE_HELPER::createZoneFromExisting(), and ZONE_CREATE_HELPER::performZoneCutout().

◆ GetName()

const std::string& TOOL_BASE::GetName ( void  ) const
inlineinherited

Function GetName() Returns the name of the tool.

Tool names are expected to obey the format: application.ToolName (eg. pcbnew.InteractiveSelection).

Returns
The name of the tool.

Definition at line 132 of file tool_base.h.

133  {
134  return m_toolName;
135  }
std::string m_toolName
Name of the tool.
Definition: tool_base.h:218

References TOOL_BASE::m_toolName.

Referenced by TOOL_MANAGER::dispatchInternal(), TOOL_MANAGER::InitTools(), TOOL_MANAGER::invokeTool(), and TOOL_MANAGER::RegisterTool().

◆ GetToolMenu()

◆ GetType()

TOOL_TYPE TOOL_BASE::GetType ( ) const
inlineinherited

Function GetType() Returns the type of the tool.

Returns
The type of the tool.

Definition at line 110 of file tool_base.h.

111  {
112  return m_type;
113  }
TOOL_TYPE m_type
Stores the type of the tool.
Definition: tool_base.h:211

References TOOL_BASE::m_type.

Referenced by TOOL_MANAGER::finishTool(), TOOL_MANAGER::InvokeTool(), TOOL_MANAGER::ResetTools(), TOOL_MANAGER::runTool(), and TOOL_MANAGER::ShutdownTool().

◆ getView()

KIGFX::VIEW * TOOL_BASE::getView ( ) const
protectedinherited

Function getView()

Returns the instance of VIEW object used in the application. It allows tools to draw.

Returns
The instance of VIEW.

Definition at line 36 of file tool_base.cpp.

37 {
38  return m_toolMgr->GetView();
39 }
KIGFX::VIEW * GetView() const
Definition: tool_manager.h:284
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:219

References TOOL_MANAGER::GetView(), and TOOL_BASE::m_toolMgr.

Referenced by EE_POINT_EDITOR::addCornerCondition(), ALIGN_DISTRIBUTE_TOOL::AlignLeft(), ALIGN_DISTRIBUTE_TOOL::AlignRight(), COMMON_TOOLS::CenterContents(), SCH_EDIT_TOOL::ChangeTextType(), EE_INSPECTION_TOOL::checkPart(), PL_SELECTION_TOOL::ClearSelection(), EE_SELECTION_TOOL::ClearSelection(), SCH_LINE_WIRE_BUS_TOOL::computeBreakPoint(), COMMON_TOOLS::CursorControl(), LIB_EDIT_TOOL::DeleteItemCursor(), PL_EDIT_TOOL::DeleteItemCursor(), SCH_EDIT_TOOL::DeleteItemCursor(), PCBNEW_CONTROL::DeleteItemCursor(), GERBVIEW_SELECTION_TOOL::disambiguationMenu(), PL_EDIT_TOOL::DoDelete(), PL_SELECTION_TOOL::doSelectionMenu(), EE_SELECTION_TOOL::doSelectionMenu(), SELECTION_TOOL::doSelectionMenu(), COMMON_TOOLS::doZoomInOut(), COMMON_TOOLS::doZoomToPreset(), MICROWAVE_TOOL::drawMicrowaveInductor(), PL_DRAWING_TOOLS::DrawShape(), PCB_EDITOR_CONTROL::DrillOrigin(), LIB_EDIT_TOOL::Duplicate(), PAD_TOOL::EnumeratePads(), SCH_EDITOR_CONTROL::FindComponentAndItem(), EE_SELECTION_TOOL::GetNode(), ROUTER_TOOL::getStartLayer(), PCBNEW_CONTROL::GridResetOrigin(), PCBNEW_CONTROL::GridSetOrigin(), SELECTION_TOOL::GuessSelectionCandidates(), PL_SELECTION_TOOL::highlight(), EE_SELECTION_TOOL::highlight(), SELECTION_TOOL::highlight(), GERBVIEW_CONTROL::HighlightControl(), PNS::TOOL_BASE::highlightNet(), PCB_INSPECTION_TOOL::highlightNet(), EE_POINT_EDITOR::Main(), PL_POINT_EDITOR::Main(), PCB_VIEWER_TOOLS::MeasureTool(), GERBVIEW_SELECTION_TOOL::MeasureTool(), SCH_EDIT_TOOL::Mirror(), EDIT_TOOL::MoveExact(), SCH_MOVE_TOOL::moveItem(), PL_EDIT_TOOL::moveItem(), COMMON_TOOLS::OnGridChanged(), OnSelectionChange(), COMMON_TOOLS::PanControl(), LIB_EDIT_TOOL::Paste(), PL_EDIT_TOOL::Paste(), SCH_EDITOR_CONTROL::Paste(), PNS::TOOL_BASE::pickSingleItem(), PL_DRAWING_TOOLS::PlaceItem(), PCB_EDITOR_CONTROL::PlaceModule(), PCB_EDITOR_CONTROL::PlaceTarget(), SCH_EDIT_TOOL::Properties(), EDIT_TOOL::Properties(), EDIT_TOOL::Remove(), PCB_EDITOR_CONTROL::Reset(), PNS::TOOL_BASE::Reset(), PCBNEW_CONTROL::Reset(), GERBVIEW_SELECTION_TOOL::Reset(), DRAWING_TOOL::Reset(), EE_SELECTION_TOOL::Reset(), SELECTION_TOOL::Reset(), EE_TOOL_BASE< SCH_BASE_FRAME >::Reset(), SCH_EDIT_TOOL::Rotate(), GERBVIEW_SELECTION_TOOL::select(), GERBVIEW_SELECTION_TOOL::selectable(), SELECTION_TOOL::Selectable(), PL_SELECTION_TOOL::selectionContains(), EE_SELECTION_TOOL::selectionContains(), SELECTION_TOOL::selectionContains(), PL_SELECTION_TOOL::selectMultiple(), EE_SELECTION_TOOL::selectMultiple(), SELECTION_TOOL::selectMultiple(), PL_SELECTION_TOOL::SelectPoint(), EE_SELECTION_TOOL::SelectPoint(), ZOOM_TOOL::selectRegion(), GERBVIEW_SELECTION_TOOL::selectVisually(), PL_EDITOR_CONTROL::ToggleBackgroundColor(), SCH_EDITOR_CONTROL::ToggleHiddenFields(), SCH_EDITOR_CONTROL::ToggleHiddenPins(), PL_SELECTION_TOOL::unhighlight(), EE_SELECTION_TOOL::unhighlight(), SELECTION_TOOL::unhighlight(), GERBVIEW_SELECTION_TOOL::unselect(), GERBVIEW_SELECTION_TOOL::unselectVisually(), EE_POINT_EDITOR::updateEditedPoint(), PL_POINT_EDITOR::updateEditedPoint(), updateEditedPoint(), SCH_EDITOR_CONTROL::UpdateFind(), EE_POINT_EDITOR::updateItem(), PL_POINT_EDITOR::updateItem(), updateItem(), SCH_EDITOR_CONTROL::UpdateNetHighlighting(), EE_POINT_EDITOR::updatePoints(), PL_POINT_EDITOR::updatePoints(), updatePoints(), SELECTION_TOOL::updateSelection(), PNS::TOOL_BASE::updateStartItem(), EE_TOOL_BASE< SCH_BASE_FRAME >::updateView(), PCB_VIEWER_TOOLS::view(), PCB_TOOL_BASE::view(), COMMON_TOOLS::ZoomFitScreen(), SELECTION_TOOL::zoomFitSelection(), EE_SELECTION_TOOL::~EE_SELECTION_TOOL(), GERBVIEW_SELECTION_TOOL::~GERBVIEW_SELECTION_TOOL(), and SELECTION_TOOL::~SELECTION_TOOL().

◆ getViewControls()

KIGFX::VIEW_CONTROLS * TOOL_BASE::getViewControls ( ) const
protectedinherited

Function getViewControls()

Returns the instance of VIEW_CONTROLS object used in the application. It allows tools to read & modify user input and its settings (eg. show cursor, enable snapping to grid, etc.)

Returns
The instance of VIEW_CONTROLS.

Definition at line 42 of file tool_base.cpp.

43 {
44  return m_toolMgr->GetViewControls();
45 }
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:219
KIGFX::VIEW_CONTROLS * GetViewControls() const
Definition: tool_manager.h:286

References TOOL_MANAGER::GetViewControls(), and TOOL_BASE::m_toolMgr.

Referenced by EE_POINT_EDITOR::addCorner(), addCorner(), EE_POINT_EDITOR::addCornerCondition(), SCH_EDITOR_CONTROL::AssignNetclass(), SCH_EDIT_TOOL::BreakWire(), PCB_TOOL_BASE::controls(), COMMON_TOOLS::CursorControl(), SCH_LINE_WIRE_BUS_TOOL::doDrawSegments(), EDIT_TOOL::doMoveSelection(), SCH_LINE_WIRE_BUS_TOOL::doUnfoldBus(), COMMON_TOOLS::doZoomToPreset(), DRAWING_TOOL::DrawCircle(), DRAWING_TOOL::DrawLine(), MICROWAVE_TOOL::drawMicrowaveInductor(), DRAWING_TOOL::DrawRectangle(), SCH_LINE_WIRE_BUS_TOOL::DrawSegments(), LIB_DRAWING_TOOLS::DrawShape(), PL_DRAWING_TOOLS::DrawShape(), SCH_DRAWING_TOOLS::DrawSheet(), LIB_EDIT_TOOL::Duplicate(), PAD_TOOL::EnumeratePads(), SCH_LINE_WIRE_BUS_TOOL::finishSegments(), PCB_INSPECTION_TOOL::HighlightNet(), SCH_EDITOR_CONTROL::HighlightNet(), PCB_INSPECTION_TOOL::HighlightNetTool(), FOOTPRINT_EDITOR_TOOLS::ImportFootprint(), PL_EDIT_TOOL::Main(), EE_POINT_EDITOR::Main(), PL_POINT_EDITOR::Main(), LIB_MOVE_TOOL::Main(), SCH_MOVE_TOOL::Main(), PCBNEW_PICKER_TOOL::Main(), PICKER_TOOL::Main(), ROUTER_TOOL::MainLoop(), PCB_VIEWER_TOOLS::MeasureTool(), GERBVIEW_SELECTION_TOOL::MeasureTool(), COMMON_TOOLS::OnGridChanged(), OnSelectionChange(), LIB_EDIT_TOOL::Paste(), ROUTER_TOOL::performDragging(), LENGTH_TUNER_TOOL::performTuning(), LIB_DRAWING_TOOLS::PlaceAnchor(), PCBNEW_CONTROL::placeBoardItems(), SCH_DRAWING_TOOLS::PlaceComponent(), SCH_DRAWING_TOOLS::PlaceImage(), PL_DRAWING_TOOLS::PlaceItem(), PCB_EDITOR_CONTROL::PlaceModule(), PCB_EDITOR_CONTROL::PlaceTarget(), SCH_EDIT_TOOL::Properties(), EDIT_TOOL::Properties(), EDIT_TOOL::Remove(), SCH_EDIT_TOOL::RepeatDrawItem(), PL_SELECTION_TOOL::RequestSelection(), EE_SELECTION_TOOL::RequestSelection(), Reset(), DRAWING_TOOL::Reset(), COMMON_TOOLS::ResetLocalCoords(), GERBVIEW_SELECTION_TOOL::selectCursor(), SELECTION_TOOL::selectCursor(), PL_SELECTION_TOOL::selectMultiple(), EE_SELECTION_TOOL::selectMultiple(), SELECTION_TOOL::selectMultiple(), EE_SELECTION_TOOL::SelectNode(), ZOOM_TOOL::selectRegion(), ALIGN_DISTRIBUTE_TOOL::selectTarget(), PICKER_TOOL::setControls(), PCBNEW_PICKER_TOOL::setControls(), EE_POINT_EDITOR::setEditedPoint(), PL_POINT_EDITOR::setEditedPoint(), setEditedPoint(), SCH_DRAWING_TOOLS::SingleClickPlace(), LIB_DRAWING_TOOLS::TwoClickPlace(), SCH_DRAWING_TOOLS::TwoClickPlace(), EE_POINT_EDITOR::updateEditedPoint(), PL_POINT_EDITOR::updateEditedPoint(), updateEditedPoint(), updateItem(), LIB_MOVE_TOOL::updateModificationPoint(), PL_EDIT_TOOL::updateModificationPoint(), EDIT_TOOL::updateModificationPoint(), and COMMON_TOOLS::ZoomCenter().

◆ Go()

template<class T >
void TOOL_INTERACTIVE::Go ( int(T::*)(const TOOL_EVENT &)  aStateFunc,
const TOOL_EVENT_LIST aConditions = TOOL_EVENTTC_ANYTA_ANY ) 
)
inherited

Function Go()

Defines which state (aStateFunc) to go when a certain event arrives (aConditions). No conditions means any event.

Definition at line 129 of file tool_interactive.h.

131 {
132  TOOL_STATE_FUNC sptr = std::bind( aStateFunc, static_cast<T*>( this ), std::placeholders::_1 );
133 
134  goInternal( sptr, aConditions );
135 }
std::function< int(const TOOL_EVENT &)> TOOL_STATE_FUNC
Definition: tool_base.h:58
void goInternal(TOOL_STATE_FUNC &aState, const TOOL_EVENT_LIST &aConditions)

References TOOL_INTERACTIVE::goInternal().

Referenced by LENGTH_TUNER_TOOL::setTransitions(), ZOOM_TOOL::setTransitions(), AUTOPLACE_TOOL::setTransitions(), PCB_REANNOTATE_TOOL::setTransitions(), ROUTER_TOOL::setTransitions(), LIB_PIN_TOOL::setTransitions(), EE_INSPECTION_TOOL::setTransitions(), PL_DRAWING_TOOLS::setTransitions(), EE_POINT_EDITOR::setTransitions(), ZONE_FILLER_TOOL::setTransitions(), PL_POINT_EDITOR::setTransitions(), COMMON_CONTROL::setTransitions(), LIB_MOVE_TOOL::setTransitions(), KICAD_MANAGER_CONTROL::setTransitions(), LIB_DRAWING_TOOLS::setTransitions(), SCH_MOVE_TOOL::setTransitions(), MICROWAVE_TOOL::setTransitions(), PCB_VIEWER_TOOLS::setTransitions(), setTransitions(), GLOBAL_EDIT_TOOL::setTransitions(), GERBVIEW_CONTROL::setTransitions(), SCH_DRAWING_TOOLS::setTransitions(), CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::setTransitions(), LIB_EDIT_TOOL::setTransitions(), PL_EDITOR_CONTROL::setTransitions(), LIB_CONTROL::setTransitions(), PL_EDIT_TOOL::setTransitions(), PAD_TOOL::setTransitions(), FOOTPRINT_EDITOR_TOOLS::setTransitions(), SCH_EDIT_TOOL::setTransitions(), POSITION_RELATIVE_TOOL::setTransitions(), GERBVIEW_SELECTION_TOOL::setTransitions(), COMMON_TOOLS::setTransitions(), PCBNEW_CONTROL::setTransitions(), EDA_3D_CONTROLLER::setTransitions(), ALIGN_DISTRIBUTE_TOOL::setTransitions(), PCB_INSPECTION_TOOL::setTransitions(), SCH_LINE_WIRE_BUS_TOOL::setTransitions(), CVPCB_CONTROL::setTransitions(), CVPCB_ASSOCIATION_TOOL::setTransitions(), PCBNEW_PICKER_TOOL::setTransitions(), PICKER_TOOL::setTransitions(), PCB_EDITOR_CONTROL::setTransitions(), DRC::setTransitions(), EDIT_TOOL::setTransitions(), DRAWING_TOOL::setTransitions(), SELECTION_TOOL::setTransitions(), PL_SELECTION_TOOL::setTransitions(), SCH_EDITOR_CONTROL::setTransitions(), and EE_SELECTION_TOOL::setTransitions().

◆ HasPoint()

bool POINT_EDITOR::HasPoint ( )
inline

Indicates the cursor is over an edit point.

Used to coordinate cursor shapes with other tools.

Definition at line 65 of file point_editor.h.

65 { return m_editedPoint != nullptr; }
EDIT_POINT * m_editedPoint
Currently edited point, NULL if there is none.
Definition: point_editor.h:75

References m_editedPoint.

Referenced by DRAWING_TOOL::DrawDimension().

◆ Init()

bool POINT_EDITOR::Init ( void  )
overridevirtual

Function Init() Init() is called once upon a registration of the tool.

Returns
True if the initialization went fine, false - otherwise.

Reimplemented from PCB_TOOL_BASE.

Definition at line 302 of file point_editor.cpp.

303 {
304  // Find the selection tool, so they can cooperate
306 
307  wxASSERT_MSG( m_selectionTool, _( "pcbnew.InteractiveSelection tool is not available" ) );
308 
309  auto& menu = m_selectionTool->GetToolMenu().GetMenu();
312  std::bind( &POINT_EDITOR::removeCornerCondition, this, _1 ) );
313 
314  return true;
315 }
SELECTION_TOOL.
CONDITIONAL_MENU & GetMenu()
Function GetMenu.
Definition: tool_menu.cpp:46
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:219
TOOL_MENU & GetToolMenu()
bool removeCornerCondition(const SELECTION &aSelection)
Condition to display "Remove corner" context menu entry.
static TOOL_ACTION pointEditorAddCorner
Break outline (insert additional points to an edge)
Definition: pcb_actions.h:198
static TOOL_ACTION pointEditorRemoveCorner
Removes a corner.
Definition: pcb_actions.h:201
SELECTION_TOOL * m_selectionTool
Selection tool used for obtaining selected items
Definition: point_editor.h:72
#define _(s)
Definition: 3d_actions.cpp:33
void AddItem(const TOOL_ACTION &aAction, const SELECTION_CONDITION &aCondition, int aOrder=ANY_ORDER)
Function AddItem()
static bool addCornerCondition(const SELECTION &aSelection)
Condition to display "Create corner" context menu entry.

References _, addCornerCondition(), CONDITIONAL_MENU::AddItem(), TOOL_MENU::GetMenu(), TOOL_MANAGER::GetTool(), TOOL_INTERACTIVE::GetToolMenu(), m_selectionTool, TOOL_BASE::m_toolMgr, PCB_ACTIONS::pointEditorAddCorner, PCB_ACTIONS::pointEditorRemoveCorner, and removeCornerCondition().

◆ isModified()

bool POINT_EDITOR::isModified ( const EDIT_POINT aPoint) const
inlineprivate

Returns true if aPoint is the currently modified point.

Definition at line 117 of file point_editor.h.

118  {
119  return m_editedPoint == &aPoint;
120  }
EDIT_POINT * m_editedPoint
Currently edited point, NULL if there is none.
Definition: point_editor.h:75

References m_editedPoint.

Referenced by get45DegConstrainer(), and updateItem().

◆ IsToolActive()

bool TOOL_BASE::IsToolActive ( ) const
inherited

Definition at line 31 of file tool_base.cpp.

32 {
33  return m_toolMgr->IsToolActive( m_toolId );
34 }
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:219
TOOL_ID m_toolId
Unique identifier for the tool, assigned by a TOOL_MANAGER instance.
Definition: tool_base.h:214
bool IsToolActive(TOOL_ID aId) const
Function IsToolActive() Returns true if a tool with given id is active (executing)

References TOOL_MANAGER::IsToolActive(), TOOL_BASE::m_toolId, and TOOL_BASE::m_toolMgr.

Referenced by EDIT_TOOL::isRouterActive(), and ROUTER_TOOL::onViaCommand().

◆ modifiedSelection()

int POINT_EDITOR::modifiedSelection ( const TOOL_EVENT aEvent)
private

Definition at line 1650 of file point_editor.cpp.

1651 {
1652  updatePoints();
1653  return 0;
1654 }
void updatePoints()
Updates edit points with item's points.

References updatePoints().

Referenced by setTransitions().

◆ module()

◆ OnSelectionChange()

int POINT_EDITOR::OnSelectionChange ( const TOOL_EVENT aEvent)

Function OnSelected()

Change selection event handler.

Definition at line 340 of file point_editor.cpp.

341 {
342  if( !m_selectionTool )
343  return 0;
344 
346 
347  if( selection.Size() != 1 || selection.Front()->GetEditFlags() )
348  return 0;
349 
350  Activate();
351 
353  KIGFX::VIEW* view = getView();
354  PCB_BASE_EDIT_FRAME* editFrame = getEditFrame<PCB_BASE_EDIT_FRAME>();
355 
356  controls->ShowCursor( true );
357 
358  GRID_HELPER grid( m_toolMgr, editFrame->GetMagneticItemsSettings() );
359  BOARD_ITEM* item = static_cast<BOARD_ITEM*>( selection.Front() );
360 
361  if( !item )
362  return 0;
363 
364  m_editPoints = EDIT_POINTS_FACTORY::Make( item, getView()->GetGAL() );
365 
366  if( !m_editPoints )
367  return 0;
368 
369  view->Add( m_editPoints.get() );
370  setEditedPoint( nullptr );
371  updateEditedPoint( aEvent );
372  m_refill = false;
373  bool inDrag = false;
374 
375  BOARD_COMMIT commit( editFrame );
376  LSET snapLayers = item->GetLayerSet();
377 
378  if( item->Type() == PCB_DIMENSION_T )
379  snapLayers = LSET::AllLayersMask();
380 
381  // Main loop: keep receiving events
382  while( TOOL_EVENT* evt = Wait() )
383  {
384  grid.SetSnap( !evt->Modifier( MD_SHIFT ) );
385  grid.SetUseGrid( !evt->Modifier( MD_ALT ) );
386  controls->SetSnapping( !evt->Modifier( MD_ALT ) );
387 
388  if( !m_editPoints || evt->IsSelectionEvent() )
389  break;
390 
391  if ( !inDrag )
392  updateEditedPoint( *evt );
393 
394  if( evt->IsDrag( BUT_LEFT ) && m_editedPoint )
395  {
396  if( !inDrag )
397  {
398  commit.StageItems( selection, CHT_MODIFY );
399 
400  controls->ForceCursorPosition( false );
401  m_original = *m_editedPoint; // Save the original position
402  controls->SetAutoPan( true );
403  inDrag = true;
404  grid.SetAuxAxes( true, m_original.GetPosition() );
406  }
407 
408  //TODO: unify the constraints to solve simultaneously instead of sequentially
409  m_editedPoint->SetPosition( grid.BestSnapAnchor( evt->Position(),
410  snapLayers, { item } ) );
411 
412  // The alternative constraint limits to 45°
413  bool enableAltConstraint = !!evt->Modifier( MD_CTRL );
414 
415  if( enableAltConstraint != (bool) m_altConstraint ) // alternative constraint
416  setAltConstraint( enableAltConstraint );
417 
418  if( m_altConstraint )
419  m_altConstraint->Apply();
420  else
422 
423  m_editedPoint->SetPosition( grid.BestSnapAnchor( m_editedPoint->GetPosition(),
424  snapLayers, { item } ) );
425 
426  updateItem();
427  updatePoints();
428  }
429 
430  else if( inDrag && evt->IsMouseUp( BUT_LEFT ) )
431  {
432  if( m_editedPoint )
433  {
434  m_editedPoint->SetActive( false );
435  getView()->Update( m_editPoints.get() );
436  }
437 
438  controls->SetAutoPan( false );
439  setAltConstraint( false );
440 
441  commit.Push( _( "Drag a corner" ) );
442  inDrag = false;
443  m_refill = true;
444  }
445 
446  else if( evt->IsCancelInteractive() || evt->IsActivate() )
447  {
448  if( inDrag ) // Restore the last change
449  commit.Revert();
450  else if( evt->IsCancelInteractive() )
451  break;
452 
453  if( evt->IsActivate() && !evt->IsMoveTool() )
454  break;
455  }
456 
457  else
458  evt->SetPassEvent();
459  }
460 
461  if( m_editPoints )
462  {
463  view->Remove( m_editPoints.get() );
464 
465  finishItem();
466  m_editPoints.reset();
467  }
468 
469  frame()->UpdateMsgPanel();
470 
471  return 0;
472 }
virtual void ShowCursor(bool aEnabled)
Function ShowCursor() Enables or disables display of cursor.
TOOL_EVENT * Wait(const TOOL_EVENT_LIST &aEventList=TOOL_EVENT(TC_ANY, TA_ANY))
Function Wait()
BOARD_ITEM is a base class for any item which can be embedded within the BOARD container class,...
void updateEditedPoint(const TOOL_EVENT &aEvent)
Updates which point is being edited.
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:219
virtual void SetSnapping(bool aEnabled)
Function SetSnapping() Enables/disables snapping cursor to grid.
void setAltConstraint(bool aEnabled)
Sets up an alternative constraint (typically enabled upon a modifier key being pressed).
virtual MAGNETIC_SETTINGS * GetMagneticItemsSettings()
virtual void Remove(VIEW_ITEM *aItem) override
Function Remove() Removes a VIEW_ITEM from the view.
Definition: pcb_view.cpp:75
void updateItem() const
Updates item's points with edit points.
PCBNEW_SELECTION & GetSelection()
Function GetSelection()
PCB_BASE_EDIT_FRAME * frame() const
std::shared_ptr< EDIT_POINTS > m_editPoints
Currently available edit points.
Definition: point_editor.h:81
void finishItem()
Applies the last changes to the edited item.
void SetActive(bool aActive=true)
Definition: edit_points.h:185
LSET is a set of PCB_LAYER_IDs.
const PCBNEW_SELECTION & selection() const
virtual VECTOR2I GetPosition() const
Function GetPosition()
Definition: edit_points.h:69
STATUS_FLAGS GetEditFlags() const
Definition: base_struct.h:237
TOOL_EVENT.
Definition: tool_event.h:171
std::shared_ptr< EDIT_CONSTRAINT< EDIT_POINT > > m_altConstraint
Definition: point_editor.h:84
KIGFX::PCB_VIEW * view() const
VIEW_CONTROLS is an interface for classes handling user events controlling the view behaviour (such a...
virtual void ForceCursorPosition(bool aEnabled, const VECTOR2D &aPosition=VECTOR2D(0, 0))
Function ForceCursorPosition() Places the cursor immediately at a given point.
static LSET AllLayersMask()
Definition: lset.cpp:749
SELECTION_TOOL * m_selectionTool
Selection tool used for obtaining selected items
Definition: point_editor.h:72
virtual void Update(VIEW_ITEM *aItem, int aUpdateFlags)
For dynamic VIEWs, informs the associated VIEW that the graphical representation of this item has cha...
Definition: view.cpp:1544
class DIMENSION, a dimension (graphic item)
Definition: typeinfo.h:100
KIGFX::VIEW * getView() const
Function getView()
Definition: tool_base.cpp:36
virtual void SetAutoPan(bool aEnabled)
Function SetAutoPan Turns on/off auto panning (this feature is used when there is a tool active (eg.
KIGFX::VIEW_CONTROLS * controls() const
Common, abstract interface for edit frames.
#define _(s)
Definition: 3d_actions.cpp:33
int Size() const
Returns the number of selected parts.
Definition: selection.h:127
void updatePoints()
Updates edit points with item's points.
EDIT_POINT m_original
Original position for the current drag point.
Definition: point_editor.h:78
void Activate()
Function Activate() Runs the tool.
virtual void Add(VIEW_ITEM *aItem, int aDrawPriority=-1) override
Function Add() Adds a VIEW_ITEM to the view.
Definition: pcb_view.cpp:58
KIGFX::VIEW_CONTROLS * getViewControls() const
Function getViewControls()
Definition: tool_base.cpp:42
VIEW.
Definition: view.h:61
EDIT_POINT * m_editedPoint
Currently edited point, NULL if there is none.
Definition: point_editor.h:75
static std::shared_ptr< EDIT_POINTS > Make(EDA_ITEM *aItem, SCH_BASE_FRAME *frame)
void setEditedPoint(EDIT_POINT *aPoint)
Sets the current point being edited. NULL means none.
virtual void ApplyConstraint()
Function ApplyConstraint()
Definition: edit_points.h:174
EDA_ITEM * Front() const
Definition: selection.h:184
virtual void UpdateMsgPanel()
Redraw the message panel.
virtual void SetPosition(const VECTOR2I &aPosition)
Function SetPosition()
Definition: edit_points.h:106

References _, TOOL_INTERACTIVE::Activate(), KIGFX::PCB_VIEW::Add(), LSET::AllLayersMask(), EDIT_POINT::ApplyConstraint(), BUT_LEFT, CHT_MODIFY, PCB_TOOL_BASE::controls(), finishItem(), KIGFX::VIEW_CONTROLS::ForceCursorPosition(), PCB_TOOL_BASE::frame(), SELECTION::Front(), EDA_ITEM::GetEditFlags(), PCB_BASE_FRAME::GetMagneticItemsSettings(), EDIT_POINT::GetPosition(), SELECTION_TOOL::GetSelection(), TOOL_BASE::getView(), TOOL_BASE::getViewControls(), m_altConstraint, m_editedPoint, m_editPoints, m_original, m_refill, m_selectionTool, TOOL_BASE::m_toolMgr, EDIT_POINTS_FACTORY::Make(), MD_ALT, MD_CTRL, MD_SHIFT, PCB_DIMENSION_T, BOARD_COMMIT::Push(), KIGFX::PCB_VIEW::Remove(), BOARD_COMMIT::Revert(), PCB_TOOL_BASE::selection(), EDIT_POINT::SetActive(), setAltConstraint(), KIGFX::VIEW_CONTROLS::SetAutoPan(), setEditedPoint(), EDIT_POINT::SetPosition(), KIGFX::VIEW_CONTROLS::SetSnapping(), KIGFX::VIEW_CONTROLS::ShowCursor(), SELECTION::Size(), COMMIT::StageItems(), KIGFX::VIEW::Update(), updateEditedPoint(), updateItem(), EDA_DRAW_FRAME::UpdateMsgPanel(), updatePoints(), PCB_TOOL_BASE::view(), and TOOL_INTERACTIVE::Wait().

Referenced by setTransitions().

◆ removeCorner()

int POINT_EDITOR::removeCorner ( const TOOL_EVENT aEvent)
private

Definition at line 1574 of file point_editor.cpp.

1575 {
1576  if( !m_editPoints || !m_editedPoint )
1577  return 0;
1578 
1579  EDA_ITEM* item = m_editPoints->GetParent();
1580 
1581  if( !item )
1582  return 0;
1583 
1584  SHAPE_POLY_SET* polygon = nullptr;
1585 
1586  if( item->Type() == PCB_ZONE_AREA_T || item->Type() == PCB_MODULE_ZONE_AREA_T )
1587  {
1588  auto zone = static_cast<ZONE_CONTAINER*>( item );
1589  polygon = zone->Outline();
1590  zone->SetNeedRefill( true );
1591  }
1592  else if( (item->Type() == PCB_MODULE_EDGE_T ) || ( item->Type() == PCB_LINE_T ) )
1593  {
1594  auto ds = static_cast<DRAWSEGMENT*>( item );
1595 
1596  if( ds->GetShape() == S_POLYGON )
1597  polygon = &ds->GetPolyShape();
1598  }
1599 
1600  if( !polygon )
1601  return 0;
1602 
1603  PCB_BASE_FRAME* frame = getEditFrame<PCB_BASE_FRAME>();
1604  BOARD_COMMIT commit( frame );
1605  auto vertex = findVertex( *polygon, *m_editedPoint );
1606 
1607  if( vertex.first )
1608  {
1609  const auto& vertexIdx = vertex.second;
1610  auto& outline = polygon->Polygon( vertexIdx.m_polygon )[vertexIdx.m_contour];
1611 
1612  if( outline.PointCount() > 3 )
1613  {
1614  // the usual case: remove just the corner when there are >3 vertices
1615  commit.Modify( item );
1616  polygon->RemoveVertex( vertexIdx );
1617  validatePolygon( *polygon );
1618  }
1619  else
1620  {
1621  // either remove a hole or the polygon when there are <= 3 corners
1622  if( vertexIdx.m_contour > 0 )
1623  {
1624  // remove hole
1625  commit.Modify( item );
1626  polygon->RemoveContour( vertexIdx.m_contour );
1627  }
1628  else
1629  {
1631  commit.Remove( item );
1632  }
1633  }
1634 
1635  setEditedPoint( nullptr );
1636 
1637  commit.Push( _( "Remove a zone/polygon corner" ) );
1638 
1639  // Refresh zone hatching
1640  if( item->Type() == PCB_ZONE_AREA_T || item->Type() == PCB_MODULE_ZONE_AREA_T )
1641  static_cast<ZONE_CONTAINER*>( item )->HatchBorder();
1642 
1643  updatePoints();
1644  }
1645 
1646  return 0;
1647 }
static TOOL_ACTION selectionClear
Clears the current selection.
Definition: pcb_actions.h:62
polygon (not yet used for tracks, but could be in microwave apps)
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:219
class ZONE_CONTAINER, a zone area
Definition: typeinfo.h:102
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Function RunAction() Runs the specified action.
Definition: tool_manager.h:140
class EDGE_MODULE, a footprint edge
Definition: typeinfo.h:94
PCB_BASE_EDIT_FRAME * frame() const
std::shared_ptr< EDIT_POINTS > m_editPoints
Currently available edit points.
Definition: point_editor.h:81
SHAPE_POLY_SET.
SHAPE_LINE_CHAIN & Outline(int aIndex)
Returns the reference to aIndex-th outline in the set
bool validatePolygon(SHAPE_POLY_SET &aModified) const
Validates a polygon and displays a popup warning if invalid.
#define _(s)
Definition: 3d_actions.cpp:33
void RemoveVertex(int aGlobalIndex)
Function RemoveVertex deletes the aGlobalIndex-th vertex.
EDA_ITEM is a base class for most all the KiCad significant classes, used in schematics and boards.
Definition: base_struct.h:159
void updatePoints()
Updates edit points with item's points.
static std::pair< bool, SHAPE_POLY_SET::VERTEX_INDEX > findVertex(SHAPE_POLY_SET &aPolySet, const EDIT_POINT &aPoint)
POLYGON & Polygon(int aIndex)
Returns the aIndex-th subpolygon in the set
class ZONE_CONTAINER, managed by a footprint
Definition: typeinfo.h:95
class DRAWSEGMENT, a segment not on copper layers
Definition: typeinfo.h:91
EDIT_POINT * m_editedPoint
Currently edited point, NULL if there is none.
Definition: point_editor.h:75
void setEditedPoint(EDIT_POINT *aPoint)
Sets the current point being edited. NULL means none.
PCB_BASE_FRAME basic PCB main window class for Pcbnew, Gerbview, and CvPcb footprint viewer.
KICAD_T Type() const
Function Type()
Definition: base_struct.h:193
void RemoveContour(int aContourIdx, int aPolygonIdx=-1)
Function RemoveContour deletes the aContourIdx-th contour of the aPolygonIdx-th polygon in the set.

References _, findVertex(), PCB_TOOL_BASE::frame(), m_editedPoint, m_editPoints, TOOL_BASE::m_toolMgr, COMMIT::Modify(), SHAPE_POLY_SET::Outline(), PCB_LINE_T, PCB_MODULE_EDGE_T, PCB_MODULE_ZONE_AREA_T, PCB_ZONE_AREA_T, SHAPE_POLY_SET::Polygon(), BOARD_COMMIT::Push(), COMMIT::Remove(), SHAPE_POLY_SET::RemoveContour(), SHAPE_POLY_SET::RemoveVertex(), TOOL_MANAGER::RunAction(), S_POLYGON, PCB_ACTIONS::selectionClear, setEditedPoint(), EDA_ITEM::Type(), updatePoints(), and validatePolygon().

Referenced by setTransitions().

◆ removeCornerCondition()

bool POINT_EDITOR::removeCornerCondition ( const SELECTION aSelection)
private

Condition to display "Remove corner" context menu entry.

Definition at line 1402 of file point_editor.cpp.

1403 {
1404  if( !m_editPoints || !m_editedPoint )
1405  return false;
1406 
1407  EDA_ITEM* item = m_editPoints->GetParent();
1408 
1409  if( !item || !( item->Type() == PCB_ZONE_AREA_T || item->Type() == PCB_MODULE_ZONE_AREA_T ||
1410  ( ( item->Type() == PCB_MODULE_EDGE_T || item->Type() == PCB_LINE_T ) &&
1411  static_cast<DRAWSEGMENT*>( item )->GetShape() == S_POLYGON ) ) )
1412  return false;
1413 
1414  SHAPE_POLY_SET *polyset;
1415 
1416  if( item->Type() == PCB_ZONE_AREA_T || item->Type() == PCB_MODULE_ZONE_AREA_T )
1417  polyset = static_cast<ZONE_CONTAINER*>( item )->Outline();
1418  else
1419  polyset = &static_cast<DRAWSEGMENT*>( item )->GetPolyShape();
1420 
1421  auto vertex = findVertex( *polyset, *m_editedPoint );
1422 
1423  if( !vertex.first )
1424  return false;
1425 
1426  const auto& vertexIdx = vertex.second;
1427 
1428  // Check if there are enough vertices so one can be removed without
1429  // degenerating the polygon.
1430  // The first condition allows one to remove all corners from holes (when
1431  // there are only 2 vertices left, a hole is removed).
1432  if( vertexIdx.m_contour == 0 && polyset->Polygon( vertexIdx.m_polygon )[vertexIdx.m_contour].PointCount() <= 3 )
1433  return false;
1434 
1435  // Remove corner does not work with lines
1436  if( dynamic_cast<EDIT_LINE*>( m_editedPoint ) )
1437  return false;
1438 
1439  return m_editedPoint != NULL;
1440 }
polygon (not yet used for tracks, but could be in microwave apps)
class ZONE_CONTAINER, a zone area
Definition: typeinfo.h:102
class EDGE_MODULE, a footprint edge
Definition: typeinfo.h:94
std::shared_ptr< EDIT_POINTS > m_editPoints
Currently available edit points.
Definition: point_editor.h:81
#define NULL
SHAPE_POLY_SET.
SHAPE_LINE_CHAIN & Outline(int aIndex)
Returns the reference to aIndex-th outline in the set
EDA_ITEM is a base class for most all the KiCad significant classes, used in schematics and boards.
Definition: base_struct.h:159
static std::pair< bool, SHAPE_POLY_SET::VERTEX_INDEX > findVertex(SHAPE_POLY_SET &aPolySet, const EDIT_POINT &aPoint)
POLYGON & Polygon(int aIndex)
Returns the aIndex-th subpolygon in the set
class ZONE_CONTAINER, managed by a footprint
Definition: typeinfo.h:95
class DRAWSEGMENT, a segment not on copper layers
Definition: typeinfo.h:91
EDIT_POINT * m_editedPoint
Currently edited point, NULL if there is none.
Definition: point_editor.h:75
KICAD_T Type() const
Function Type()
Definition: base_struct.h:193

References findVertex(), m_editedPoint, m_editPoints, NULL, SHAPE_POLY_SET::Outline(), PCB_LINE_T, PCB_MODULE_EDGE_T, PCB_MODULE_ZONE_AREA_T, PCB_ZONE_AREA_T, SHAPE_POLY_SET::Polygon(), S_POLYGON, and EDA_ITEM::Type().

Referenced by Init().

◆ Reset()

void POINT_EDITOR::Reset ( RESET_REASON  aReason)
overridevirtual

Function Reset() Brings the tool to a known, initial state.

If the tool claimed anything from the model or the view, it must release it when its reset.

Parameters
aReasoncontains information about the reason of tool reset.

Reimplemented from PCB_TOOL_BASE.

Definition at line 289 of file point_editor.cpp.

290 {
291  m_refill = false;
292  m_editPoints.reset();
293  m_altConstraint.reset();
294  getViewControls()->SetAutoPan( false );
295 
296  m_statusPopup = std::make_unique<STATUS_TEXT_POPUP>( getEditFrame<PCB_BASE_EDIT_FRAME>() );
297  m_statusPopup->SetTextColor( wxColour( 255, 0, 0 ) );
298  m_statusPopup->SetText( _( "Self-intersecting polygons are not allowed." ) );
299 }
std::unique_ptr< STATUS_TEXT_POPUP > m_statusPopup
Definition: point_editor.h:92
std::shared_ptr< EDIT_POINTS > m_editPoints
Currently available edit points.
Definition: point_editor.h:81
std::shared_ptr< EDIT_CONSTRAINT< EDIT_POINT > > m_altConstraint
Definition: point_editor.h:84
virtual void SetAutoPan(bool aEnabled)
Function SetAutoPan Turns on/off auto panning (this feature is used when there is a tool active (eg.
#define _(s)
Definition: 3d_actions.cpp:33
KIGFX::VIEW_CONTROLS * getViewControls() const
Function getViewControls()
Definition: tool_base.cpp:42

References _, TOOL_BASE::getViewControls(), m_altConstraint, m_editPoints, m_refill, m_statusPopup, and KIGFX::VIEW_CONTROLS::SetAutoPan().

◆ RunMainStack()

void TOOL_INTERACTIVE::RunMainStack ( std::function< void()>  aFunc)
inherited

Function RunMainStack()

Calls a function using the main stack.

Parameters
aFuncis the function to be calls.

Definition at line 87 of file tool_interactive.cpp.

88 {
89  m_toolMgr->RunMainStack( this, std::move( aFunc ) );
90 }
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:219
void RunMainStack(TOOL_BASE *aTool, std::function< void()> aFunc)

References TOOL_BASE::m_toolMgr, and TOOL_MANAGER::RunMainStack().

Referenced by DRAWING_TOOL::PlaceText().

◆ selection() [1/2]

const PCBNEW_SELECTION & PCB_TOOL_BASE::selection ( ) const
protectedinherited

Definition at line 275 of file pcb_tool_base.cpp.

276 {
277  auto selTool = m_toolMgr->GetTool<SELECTION_TOOL>();
278  const auto& selection = selTool->GetSelection();
279  return selection;
280 }
SELECTION_TOOL.
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:219
const PCBNEW_SELECTION & selection() const

References TOOL_MANAGER::GetTool(), and TOOL_BASE::m_toolMgr.

Referenced by AUTOPLACE_TOOL::autoplaceSelected(), PCB_INSPECTION_TOOL::calculateSelectionRatsnest(), ROUTER_TOOL::CanInlineDrag(), EDIT_TOOL::ChangeTrackWidth(), PAD_TOOL::copyPadSettings(), EDIT_TOOL::copyToClipboard(), EDIT_TOOL::CreateArray(), PCB_INSPECTION_TOOL::CrossProbePcbToSch(), PCB_INSPECTION_TOOL::doHideNet(), PCB_TOOL_BASE::doInteractiveItemPlacement(), EDIT_TOOL::doMoveSelection(), DRAWING_TOOL::drawArc(), DRAWING_TOOL::DrawDimension(), MICROWAVE_TOOL::drawMicrowaveInductor(), DRAWING_TOOL::drawSegment(), DRAWING_TOOL::DrawZone(), EDIT_TOOL::Duplicate(), PCB_EDITOR_CONTROL::EditFpInFpEditor(), PAD_TOOL::EditPad(), PAD_TOOL::EnumeratePads(), GLOBAL_EDIT_TOOL::ExchangeFootprints(), SELECTION_TOOL::filterSelection(), EDIT_TOOL::Flip(), DRAWING_TOOL::getSourceZoneForAction(), PCB_INSPECTION_TOOL::highlightNet(), ROUTER_TOOL::InlineBreakTrack(), ROUTER_TOOL::InlineDrag(), PCB_INSPECTION_TOOL::LocalRatsnestTool(), EDIT_TOOL::Mirror(), PCB_EDITOR_CONTROL::modifyLockSelected(), EDIT_TOOL::MoveExact(), OnSelectionChange(), PAD_TOOL::pastePadProperties(), PCBNEW_CONTROL::placeBoardItems(), DRAWING_TOOL::PlaceImportedGraphics(), PCB_EDITOR_CONTROL::PlaceModule(), PCB_EDITOR_CONTROL::PlaceTarget(), DRAWING_TOOL::PlaceText(), POSITION_RELATIVE_TOOL::PositionRelative(), EDIT_TOOL::Properties(), PAD_TOOL::pushPadSettings(), GLOBAL_EDIT_TOOL::RemoveUnusedPads(), EDIT_TOOL::Rotate(), PCB_TOOL_BASE::selection(), SELECTION_TOOL::selectNet(), DRAWING_TOOL::SetAnchor(), PCB_EDITOR_CONTROL::TrackWidthDec(), PCB_EDITOR_CONTROL::TrackWidthInc(), PCBNEW_CONTROL::UpdateMessagePanel(), PCB_INSPECTION_TOOL::UpdateSelectionRatsnest(), PCB_EDITOR_CONTROL::ViaSizeDec(), PCB_EDITOR_CONTROL::ViaSizeInc(), PCB_EDITOR_CONTROL::ZoneDuplicate(), ZONE_FILLER_TOOL::ZoneFill(), PCB_EDITOR_CONTROL::ZoneMerge(), and ZONE_FILLER_TOOL::ZoneUnfill().

◆ selection() [2/2]

PCBNEW_SELECTION & PCB_TOOL_BASE::selection ( )
protectedinherited

Definition at line 283 of file pcb_tool_base.cpp.

284 {
285  auto selTool = m_toolMgr->GetTool<SELECTION_TOOL>();
286  auto& selection = selTool->GetSelection();
287  return selection;
288 }
SELECTION_TOOL.
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:219
const PCBNEW_SELECTION & selection() const

References TOOL_MANAGER::GetTool(), TOOL_BASE::m_toolMgr, and PCB_TOOL_BASE::selection().

◆ setAltConstraint()

void POINT_EDITOR::setAltConstraint ( bool  aEnabled)
private

Sets up an alternative constraint (typically enabled upon a modifier key being pressed).

Definition at line 1285 of file point_editor.cpp.

1286 {
1287  if( aEnabled )
1288  {
1289  EDIT_LINE* line = dynamic_cast<EDIT_LINE*>( m_editedPoint );
1290 
1291  if( line &&
1292  ( m_editPoints->GetParent()->Type() == PCB_ZONE_AREA_T
1293  || m_editPoints->GetParent()->Type() == PCB_MODULE_ZONE_AREA_T ) )
1294  {
1296  }
1297  else
1298  {
1299  // Find a proper constraining point for 45 degrees mode
1302  }
1303  }
1304  else
1305  {
1306  m_altConstraint.reset();
1307  }
1308 }
EC_CONVERGING.
EDIT_LINE.
Definition: edit_points.h:221
class ZONE_CONTAINER, a zone area
Definition: typeinfo.h:102
EC_45DEGREE.
std::shared_ptr< EDIT_POINTS > m_editPoints
Currently available edit points.
Definition: point_editor.h:81
std::shared_ptr< EDIT_CONSTRAINT< EDIT_POINT > > m_altConstraint
Definition: point_editor.h:84
EDIT_POINT get45DegConstrainer() const
Returns a point that should be used as a constrainer for 45 degrees mode.
class ZONE_CONTAINER, managed by a footprint
Definition: typeinfo.h:95
EDIT_POINT m_altConstrainer
Definition: point_editor.h:87
EDIT_POINT * m_editedPoint
Currently edited point, NULL if there is none.
Definition: point_editor.h:75

References get45DegConstrainer(), m_altConstrainer, m_altConstraint, m_editedPoint, m_editPoints, PCB_MODULE_ZONE_AREA_T, and PCB_ZONE_AREA_T.

Referenced by OnSelectionChange().

◆ SetContextMenu()

void TOOL_INTERACTIVE::SetContextMenu ( ACTION_MENU aMenu,
CONTEXT_MENU_TRIGGER  aTrigger = CMENU_BUTTON 
)
inherited

Function SetContextMenu()

Assigns a context menu and tells when it should be activated.

Parameters
aMenuis the menu to be assigned.
aTriggerdetermines conditions upon which the context menu is activated.

Definition at line 76 of file tool_interactive.cpp.

77 {
78  if( aMenu )
79  aMenu->SetTool( this );
80  else
81  aTrigger = CMENU_OFF;
82 
83  m_toolMgr->ScheduleContextMenu( this, aMenu, aTrigger );
84 }
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:219
void SetTool(TOOL_INTERACTIVE *aTool)
Function SetTool() Sets a tool that is the creator of the menu.
void ScheduleContextMenu(TOOL_BASE *aTool, ACTION_MENU *aMenu, CONTEXT_MENU_TRIGGER aTrigger)
Sets behaviour of the tool's context popup menu.

References CMENU_OFF, TOOL_BASE::m_toolMgr, TOOL_MANAGER::ScheduleContextMenu(), and ACTION_MENU::SetTool().

Referenced by GERBVIEW_SELECTION_TOOL::disambiguationMenu(), PL_SELECTION_TOOL::doSelectionMenu(), EE_SELECTION_TOOL::doSelectionMenu(), SELECTION_TOOL::doSelectionMenu(), ROUTER_TOOL::MainLoop(), LENGTH_TUNER_TOOL::MainLoop(), TOOL_MENU::ShowContextMenu(), and SCH_LINE_WIRE_BUS_TOOL::UnfoldBus().

◆ setEditedPoint()

void POINT_EDITOR::setEditedPoint ( EDIT_POINT aPoint)
private

Sets the current point being edited. NULL means none.

Definition at line 1263 of file point_editor.cpp.

1264 {
1266 
1267  if( aPoint )
1268  {
1269  frame()->GetCanvas()->SetCurrentCursor( wxCURSOR_ARROW );
1270  controls->ForceCursorPosition( true, aPoint->GetPosition() );
1271  controls->ShowCursor( true );
1272  }
1273  else
1274  {
1275  if( frame()->ToolStackIsEmpty() )
1276  controls->ShowCursor( false );
1277 
1278  controls->ForceCursorPosition( false );
1279  }
1280 
1281  m_editedPoint = aPoint;
1282 }
virtual void ShowCursor(bool aEnabled)
Function ShowCursor() Enables or disables display of cursor.
void SetCurrentCursor(wxStockCursor aStockCursorID)
Function SetCurrentCursor Set the current cursor shape for this panel.
PCB_DRAW_PANEL_GAL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
PCB_BASE_EDIT_FRAME * frame() const
virtual VECTOR2I GetPosition() const
Function GetPosition()
Definition: edit_points.h:69
VIEW_CONTROLS is an interface for classes handling user events controlling the view behaviour (such a...
virtual void ForceCursorPosition(bool aEnabled, const VECTOR2D &aPosition=VECTOR2D(0, 0))
Function ForceCursorPosition() Places the cursor immediately at a given point.
KIGFX::VIEW_CONTROLS * controls() const
KIGFX::VIEW_CONTROLS * getViewControls() const
Function getViewControls()
Definition: tool_base.cpp:42
EDIT_POINT * m_editedPoint
Currently edited point, NULL if there is none.
Definition: point_editor.h:75

References PCB_TOOL_BASE::controls(), KIGFX::VIEW_CONTROLS::ForceCursorPosition(), PCB_TOOL_BASE::frame(), PCB_BASE_FRAME::GetCanvas(), EDIT_POINT::GetPosition(), TOOL_BASE::getViewControls(), m_editedPoint, EDA_DRAW_PANEL_GAL::SetCurrentCursor(), and KIGFX::VIEW_CONTROLS::ShowCursor().

Referenced by OnSelectionChange(), removeCorner(), and updateEditedPoint().

◆ SetEditModules()

void PCB_TOOL_BASE::SetEditModules ( bool  aEnabled)
inlineinherited

Function SetEditModules()

Toggles edit module mode. When enabled, one may select parts of modules individually (graphics, pads, etc.), so they can be modified.

Parameters
aEnableddecides if the mode should be enabled.

Definition at line 101 of file pcb_tool_base.h.

102  {
103  m_editModules = aEnabled;
104  }

References PCB_TOOL_BASE::m_editModules.

◆ setTransitions()

void POINT_EDITOR::setTransitions ( )
overridevirtual

Sets up handlers for various events.

Reimplemented from PCB_TOOL_BASE.

Definition at line 1657 of file point_editor.cpp.

1658 {
1665 }
int OnSelectionChange(const TOOL_EVENT &aEvent)
Function OnSelected()
static const TOOL_EVENT SelectedEvent
Definition: actions.h:203
static TOOL_ACTION activatePointEditor
Definition: actions.h:164
static const TOOL_EVENT UnselectedEvent
Definition: actions.h:204
int removeCorner(const TOOL_EVENT &aEvent)
void Go(int(T::*aStateFunc)(const TOOL_EVENT &), const TOOL_EVENT_LIST &aConditions=TOOL_EVENT(TC_ANY, TA_ANY))
Function Go()
static const TOOL_EVENT SelectedItemsModified
Definition: actions.h:207
static TOOL_ACTION pointEditorAddCorner
Break outline (insert additional points to an edge)
Definition: pcb_actions.h:198
static TOOL_ACTION pointEditorRemoveCorner
Removes a corner.
Definition: pcb_actions.h:201
int addCorner(const TOOL_EVENT &aEvent)
TOOL_ACTION handlers.
int modifiedSelection(const TOOL_EVENT &aEvent)

References ACTIONS::activatePointEditor, addCorner(), TOOL_INTERACTIVE::Go(), modifiedSelection(), OnSelectionChange(), PCB_ACTIONS::pointEditorAddCorner, PCB_ACTIONS::pointEditorRemoveCorner, removeCorner(), EVENTS::SelectedEvent, EVENTS::SelectedItemsModified, and EVENTS::UnselectedEvent.

◆ updateEditedPoint()

void POINT_EDITOR::updateEditedPoint ( const TOOL_EVENT aEvent)
private

Updates which point is being edited.

Definition at line 318 of file point_editor.cpp.

319 {
320  EDIT_POINT* point;
321 
322  if( aEvent.IsMotion() )
323  {
324  point = m_editPoints->FindPoint( aEvent.Position(), getView() );
325  }
326  else if( aEvent.IsDrag( BUT_LEFT ) )
327  {
328  point = m_editPoints->FindPoint( aEvent.DragOrigin(), getView() );
329  }
330  else
331  {
332  point = m_editPoints->FindPoint( getViewControls()->GetCursorPosition(), getView() );
333  }
334 
335  if( m_editedPoint != point )
336  setEditedPoint( point );
337 }
bool IsMotion() const
Definition: tool_event.h:306
std::shared_ptr< EDIT_POINTS > m_editPoints
Currently available edit points.
Definition: point_editor.h:81
bool IsDrag(int aButtonMask=BUT_ANY) const
Definition: tool_event.h:296
const VECTOR2D DragOrigin() const
Returns the point where dragging has started.
Definition: tool_event.h:280
KIGFX::VIEW * getView() const
Function getView()
Definition: tool_base.cpp:36
EDIT_POINT.
Definition: edit_points.h:46
KIGFX::VIEW_CONTROLS * getViewControls() const
Function getViewControls()
Definition: tool_base.cpp:42
EDIT_POINT * m_editedPoint
Currently edited point, NULL if there is none.
Definition: point_editor.h:75
void setEditedPoint(EDIT_POINT *aPoint)
Sets the current point being edited. NULL means none.
const VECTOR2D Position() const
Returns mouse cursor position in world coordinates.
Definition: tool_event.h:274

References BUT_LEFT, TOOL_EVENT::DragOrigin(), TOOL_BASE::getView(), TOOL_BASE::getViewControls(), TOOL_EVENT::IsDrag(), TOOL_EVENT::IsMotion(), m_editedPoint, m_editPoints, TOOL_EVENT::Position(), and setEditedPoint().

Referenced by OnSelectionChange().

◆ updateItem()

void POINT_EDITOR::updateItem ( ) const
private

Updates item's points with edit points.

Definition at line 475 of file point_editor.cpp.

476 {
477  EDA_ITEM* item = m_editPoints->GetParent();
478 
479  const BOARD_DESIGN_SETTINGS& boardSettings = board()->GetDesignSettings();
480 
481  if( !item )
482  return;
483 
484  switch( item->Type() )
485  {
486  case PCB_LINE_T:
487  case PCB_MODULE_EDGE_T:
488  {
489  DRAWSEGMENT* segment = static_cast<DRAWSEGMENT*>( item );
490 
491  switch( segment->GetShape() )
492  {
493  case S_SEGMENT:
494  if( isModified( m_editPoints->Point( SEG_START ) ) )
495  segment->SetStart( wxPoint( m_editPoints->Point( SEG_START ).GetPosition().x,
496  m_editPoints->Point( SEG_START ).GetPosition().y ) );
497 
498  else if( isModified( m_editPoints->Point( SEG_END ) ) )
499  segment->SetEnd( wxPoint( m_editPoints->Point( SEG_END ).GetPosition().x,
500  m_editPoints->Point( SEG_END ).GetPosition().y ) );
501 
502  break;
503 
504  case S_RECT:
505  {
506  if( isModified( m_editPoints->Point( RECT_TOP_LEFT ) ) )
507  {
508  segment->SetStart( (wxPoint) m_editPoints->Point( RECT_TOP_LEFT ).GetPosition() );
509  }
510  else if( isModified( m_editPoints->Point( RECT_TOP_RIGHT ) ) )
511  {
512  segment->SetStartY( m_editPoints->Point( RECT_TOP_RIGHT ).GetPosition().y );
513  segment->SetEndX( m_editPoints->Point( RECT_TOP_RIGHT ).GetPosition().x );
514  }
515  else if( isModified( m_editPoints->Point( RECT_BOT_RIGHT ) ) )
516  {
517  segment->SetEnd( (wxPoint) m_editPoints->Point( RECT_BOT_RIGHT ).GetPosition() );
518  }
519  else if( isModified( m_editPoints->Point( RECT_BOT_LEFT ) ) )
520  {
521  segment->SetStartX( m_editPoints->Point( RECT_BOT_LEFT ).GetPosition().x );
522  segment->SetEndY( m_editPoints->Point( RECT_BOT_LEFT ).GetPosition().y );
523  }
524  }
525  break;
526 
527  case S_ARC:
528  {
529  VECTOR2I center = m_editPoints->Point( ARC_CENTER ).GetPosition();
530  VECTOR2I mid = m_editPoints->Point( ARC_MID ).GetPosition();
531  VECTOR2I start = m_editPoints->Point( ARC_START ).GetPosition();
532  VECTOR2I end = m_editPoints->Point( ARC_END ).GetPosition();
533 
534  if( center != segment->GetCenter() )
535  {
536  wxPoint moveVector = wxPoint( center.x, center.y ) - segment->GetCenter();
537  segment->Move( moveVector );
538 
539  m_editPoints->Point( ARC_START ).SetPosition( segment->GetArcStart() );
540  m_editPoints->Point( ARC_END ).SetPosition( segment->GetArcEnd() );
541  m_editPoints->Point( ARC_MID ).SetPosition( segment->GetArcMid() );
542  }
543  else
544  {
545  const VECTOR2I& cursorPos = getViewControls()->GetCursorPosition();
546  VECTOR2I oldCenter = segment->GetCenter();
547  double newAngle;
548  bool clockwise;
549 
550  if( mid != segment->GetArcMid() )
551  {
552  // This allows the user to go on the sides of the arc
553  mid = cursorPos;
554  // Find the new center
555  center = GetArcCenter( start, mid, end );
556 
557  segment->SetCenter( wxPoint( center.x, center.y ) );
558  m_editPoints->Point( ARC_CENTER ).SetPosition( center );
559 
560  // Check if the new arc is CW or CCW
561  VECTOR2D startLine = start - center;
562  VECTOR2D endLine = end - center;
563  newAngle = RAD2DECIDEG( endLine.Angle() - startLine.Angle() );
564  VECTOR2D v1, v2;
565  v1 = start - mid;
566  v2 = end - mid;
567  double theta = RAD2DECIDEG( v1.Angle() );
568  RotatePoint( &( v1.x ), &( v1.y ), theta );
569  RotatePoint( &( v2.x ), &( v2.y ), theta );
570  clockwise = ( ( v1.Angle() - v2.Angle() ) > 0 );
571 
572  // Normalize the angle
573  if( clockwise && newAngle < 0.0 )
574  newAngle += 3600.0;
575  else if( !clockwise && newAngle > 0.0 )
576  newAngle -= 3600.0;
577 
578  // Accuracy test
579  // First, get the angle
580  VECTOR2I endTest = start;
581  RotatePoint( &( endTest.x ), &( endTest.y ), center.x, center.y, -newAngle );
582  double distance = ( endTest - end ).SquaredEuclideanNorm();
583 
585  {
586  // Cancel Everything
587  // If the accuracy is low, we can't draw precisely the arc.
588  // It may happen when the radius is *high*
589  segment->SetCenter( wxPoint( oldCenter.x, oldCenter.y ) );
590  }
591  else
592  {
593  segment->SetAngle( newAngle );
594  segment->SetArcEnd( wxPoint( end.x, end.y ) );
595  }
596 
597  // Now, update the edit point position
598  // Express the point in a cercle-centered coordinate system.
599  mid = cursorPos - center;
600 
601  double sqRadius = ( end - center ).SquaredEuclideanNorm();
602 
603  // Special case, because the tangent would lead to +/- infinity
604  if( mid.x == 0 )
605  {
606  mid.y = mid.y > 0 ? sqrt( sqRadius ) : -sqrt( sqRadius );
607  }
608  else
609  {
610  double tan = mid.y / static_cast<double>( mid.x );
611  double tmp = mid.x;
612  // Circle : x^2 + y^2 = R ^ 2
613  // In this coordinate system, the angular position of the cursor is (r, theta)
614  // The line coming from the center of the circle is y = start.y / start.x * x
615  // The intersection fulfills : x^2 = R^2 / ( 1 + ( start.y / start.x ) ^ 2 )
616  tmp = sqrt( sqRadius
617  / ( ( 1.0
618  + mid.y / static_cast<double>( mid.x ) * mid.y
619  / static_cast<double>( mid.x ) ) ) );
620  // Move to the correct quadrant
621  tmp = mid.x > 0 ? tmp : -tmp;
622  mid.y = mid.y / static_cast<double>( mid.x ) * tmp;
623  mid.x = tmp;
624  }
625  // Go back to the main coordinate system
626  mid = mid + center;
627 
628  m_editPoints->Point( ARC_MID ).SetPosition( mid );
629  }
630  else if( ( start != segment->GetArcStart() ) || ( end != segment->GetArcEnd() ) )
631  {
632 
633  VECTOR2D startLine = start - center;
634  VECTOR2D endLine = end - center;
635  newAngle = RAD2DECIDEG( endLine.Angle() - startLine.Angle() );
636 
637  VECTOR2I *p1, *p2, *p3;
638 
639  // p1 does not move, p2 does.
640  bool movingStart;
641  bool arcValid = true;
642 
643  if( start != segment->GetArcStart() )
644  {
645  start = cursorPos;
646  p1 = &end;
647  p2 = &start;
648  p3 = &mid;
649  movingStart = true;
650  }
651  else
652  {
653  end = cursorPos;
654  p1 = &start;
655  p2 = &end;
656  p3 = &mid;
657  movingStart = false;
658  }
659 
660  VECTOR2D v1, v2, v3, v4;
661 
662  // Move the coordinate system
663  v1 = *p1 - center;
664  v2 = *p2 - center;
665  v3 = *p3 - center;
666 
667  VECTOR2D u1, u2, u3;
668 
669  u1 = v1 / v1.EuclideanNorm();
670  u2 = v3 - ( u1.x * v3.x + u1.y * v3.y ) * u1;
671  u2 = u2 / u2.EuclideanNorm();
672 
673  // [ u1, u3 ] is a base centered on the circle with:
674  // u1 : unit vector toward the point that does not move
675  // u2 : unit vector toward the mid point.
676 
677  // Get vectors v1, and v2 in that coordinate system.
678 
679  double det = u1.x * u2.y - u2.x * u1.y;
680  double tmpx = v1.x * u2.y - v1.y * u2.x;
681  double tmpy = -v1.x * u1.y + v1.y * u1.x;
682  v1.x = tmpx;
683  v1.y = tmpy;
684  v1 = v1 / det;
685 
686  tmpx = v2.x * u2.y - v2.y * u2.x;
687  tmpy = -v2.x * u1.y + v2.y * u1.x;
688  v2.x = tmpx;
689  v2.y = tmpy;
690  v2 = v2 / det;
691 
692  double R = v1.EuclideanNorm();
693  bool transformCircle = false;
694  bool invertY = ( v2.y < 0 );
695 
696  /* p2
697  * X***
698  * ** <---- This is the arc
699  * y ^ **
700  * | R *
701  * | <-----------> *
702  * x------x------>--------x p1
703  * C' <----> C x
704  * delta
705  *
706  * p1 does not move, and the tangent at p1 remains the same.
707  * => The new center, C', will be on the C-p1 axis.
708  * p2 moves
709  *
710  * The radius of the new circle is delta + R
711  *
712  * || C' p2 || = || C' P1 ||
713  * is the same as :
714  * ( delta + p2.x ) ^ 2 + p2.y ^ 2 = ( R + delta ) ^ 2
715  *
716  * delta = ( R^2 - p2.x ^ 2 - p2.y ^2 ) / ( 2 * p2.x - 2 * R )
717  *
718  * We can use this equation for any point p2 with p2.x < R
719  */
720 
721  if( v2.x == R )
722  {
723  // Straight line, do nothing
724  }
725  else
726  {
727  if( v2.x > R )
728  {
729  // If we need to invert the curvature.
730  // We modify the input so we can use the same equation
731  transformCircle = true;
732  v2.x = 2 * R - v2.x;
733  }
734  // We can keep the tangent constraint.
735  double delta = ( R * R - v2.x * v2.x - v2.y * v2.y ) / ( 2 * v2.x - 2 * R );
736 
737  // This is just to limit the radius, so nothing overflows later when drawing.
738  if( abs( v2.y / ( R - v2.x ) )
740  {
741  arcValid = false;
742  }
743  // v4 is the new center
744  v4 = ( !transformCircle ) ? VECTOR2D( -delta, 0 ) :
745  VECTOR2D( 2 * R + delta, 0 );
746 
747  clockwise = segment->GetAngle() > 0;
748 
749  if( transformCircle )
750  clockwise = !clockwise;
751 
752  tmpx = v4.x * u1.x + v4.y * u2.x;
753  tmpy = v4.x * u1.y + v4.y * u2.y;
754  v4.x = tmpx;
755  v4.y = tmpy;
756 
757  center = v4 + center;
758 
759  startLine = start - center;
760  endLine = end - center;
761  newAngle = RAD2DECIDEG( endLine.Angle() - startLine.Angle() );
762 
763  if( clockwise && newAngle < 0.0 )
764  newAngle += 3600.0;
765  else if( !clockwise && newAngle > 0.0 )
766  newAngle -= 3600.0;
767 
768  if( arcValid )
769  {
770  segment->SetAngle( newAngle );
771  segment->SetCenter( wxPoint( center.x, center.y ) );
772 
773  if( movingStart )
774  {
775  segment->SetArcStart( wxPoint( start.x, start.y ) );
776  // Set angle computes the end point, so re-force it now.
777  segment->SetArcEnd( wxPoint( end.x, end.y ) );
778  m_editPoints->Point( ARC_START ).SetPosition( start );
779  }
780  else
781  {
782  segment->SetArcEnd( wxPoint( end.x, end.y ) );
783  m_editPoints->Point( ARC_END ).SetPosition( end );
784  }
785 
786  m_editPoints->Point( ARC_CENTER ).SetPosition( center );
787  }
788  }
789  }
790  }
791  }
792  break;
793 
794  case S_CIRCLE:
795  {
796  const VECTOR2I& center = m_editPoints->Point( CIRC_CENTER ).GetPosition();
797  const VECTOR2I& end = m_editPoints->Point( CIRC_END ).GetPosition();
798 
799  if( isModified( m_editPoints->Point( CIRC_CENTER ) ) )
800  {
801  wxPoint moveVector = wxPoint( center.x, center.y ) - segment->GetCenter();
802  segment->Move( moveVector );
803  }
804  else
805  {
806  segment->SetEnd( wxPoint( end.x, end.y ) );
807  }
808  }
809  break;
810 
811  case S_POLYGON:
812  {
813  SHAPE_POLY_SET& outline = segment->GetPolyShape();
814 
815  for( int i = 0; i < outline.TotalVertices(); ++i )
816  outline.SetVertex( i, m_editPoints->Point( i ).GetPosition() );
817 
818  validatePolygon( outline );
819  }
820  break;
821 
822  case S_CURVE:
823  if( isModified( m_editPoints->Point( BEZIER_CURVE_START ) ) )
824  segment->SetStart( wxPoint( m_editPoints->Point( BEZIER_CURVE_START ).GetPosition().x,
825  m_editPoints->Point( BEZIER_CURVE_START ).GetPosition().y ) );
826  else if( isModified( m_editPoints->Point( BEZIER_CURVE_CONTROL_POINT1 ) ) )
827  segment->SetBezControl1( wxPoint( m_editPoints->Point( BEZIER_CURVE_CONTROL_POINT1 ).GetPosition().x,
828  m_editPoints->Point( BEZIER_CURVE_CONTROL_POINT1 ).GetPosition().y ) );
829  else if( isModified( m_editPoints->Point( BEZIER_CURVE_CONTROL_POINT2 ) ) )
830  segment->SetBezControl2( wxPoint( m_editPoints->Point( BEZIER_CURVE_CONTROL_POINT2 ).GetPosition().x,
831  m_editPoints->Point( BEZIER_CURVE_CONTROL_POINT2 ).GetPosition().y ) );
832  else if( isModified( m_editPoints->Point( BEZIER_CURVE_END ) ) )
833  segment->SetEnd( wxPoint( m_editPoints->Point( BEZIER_CURVE_END ).GetPosition().x,
834  m_editPoints->Point( BEZIER_CURVE_END ).GetPosition().y ) );
835 
836  segment->RebuildBezierToSegmentsPointsList( segment->GetWidth() );
837  break;
838 
839  default: // suppress warnings
840  break;
841  }
842 
843  // Update relative coordinates for module edges
844  if( EDGE_MODULE* edge = dyn_cast<EDGE_MODULE*>( item ) )
845  edge->SetLocalCoord();
846 
847  break;
848  }
849 
850  case PCB_PAD_T:
851  {
852  D_PAD* pad = static_cast<D_PAD*>( item );
853 
854  switch( pad->GetShape() )
855  {
856  case PAD_SHAPE_CIRCLE:
857  {
858  wxPoint center = (wxPoint) m_editPoints->Point( CIRC_CENTER ).GetPosition();
859  wxPoint end = (wxPoint) m_editPoints->Point( CIRC_END ).GetPosition();
860 
861  if( isModified( m_editPoints->Point( CIRC_CENTER ) ) )
862  {
863  wxPoint moveVector = center - pad->ShapePos();
864  pad->SetOffset( pad->GetOffset() + moveVector );
865  }
866  else
867  {
868  int diameter = (int) EuclideanNorm( end - center ) * 2;
869  pad->SetSize( wxSize( diameter, diameter ) );
870  }
871  }
872  break;
873 
874  case PAD_SHAPE_OVAL:
875  case PAD_SHAPE_TRAPEZOID:
876  case PAD_SHAPE_RECT:
877  case PAD_SHAPE_ROUNDRECT:
879  {
880  if( ( pad->GetOffset().x || pad->GetOffset().y )
881  || ( pad->GetDrillSize().x && pad->GetDrillSize().y ) )
882  {
883  // Keep hole pinned at the current location; adjust the pad around the hole
884 
885  wxPoint center = pad->GetPosition();
886  int dist[4];
887 
888  if( isModified( m_editPoints->Point( RECT_TOP_LEFT ) )
889  || isModified( m_editPoints->Point( RECT_BOT_RIGHT ) ) )
890  {
891  dist[0] = center.x - m_editPoints->Point( RECT_TOP_LEFT ).GetPosition().x;
892  dist[1] = center.y - m_editPoints->Point( RECT_TOP_LEFT ).GetPosition().y;
893  dist[2] = m_editPoints->Point( RECT_BOT_RIGHT ).GetPosition().x - center.x;
894  dist[3] = m_editPoints->Point( RECT_BOT_RIGHT ).GetPosition().y - center.y;
895  }
896  else
897  {
898  dist[0] = center.x - m_editPoints->Point( RECT_BOT_LEFT ).GetPosition().x;
899  dist[1] = center.y - m_editPoints->Point( RECT_TOP_RIGHT ).GetPosition().y;
900  dist[2] = m_editPoints->Point( RECT_TOP_RIGHT ).GetPosition().x - center.x;
901  dist[3] = m_editPoints->Point( RECT_BOT_LEFT ).GetPosition().y - center.y;
902  }
903 
904  wxSize padSize( dist[0] + dist[2], dist[1] + dist[3] );
905  wxPoint deltaOffset( padSize.x / 2 - dist[2], padSize.y / 2 - dist[3] );
906 
907  if( pad->GetOrientation() == 900 || pad->GetOrientation() == 2700 )
908  std::swap( padSize.x, padSize.y );
909 
910  RotatePoint( &deltaOffset, -pad->GetOrientation() );
911 
912  pad->SetSize( padSize );
913  pad->SetOffset( -deltaOffset );
914  }
915  else
916  {
917  // Keep pad position at the center of the pad shape
918 
919  int left, top, right, bottom;
920 
921  if( isModified( m_editPoints->Point( RECT_TOP_LEFT ) )
922  || isModified( m_editPoints->Point( RECT_BOT_RIGHT ) ) )
923  {
924  left = m_editPoints->Point( RECT_TOP_LEFT ).GetPosition().x;
925  top = m_editPoints->Point( RECT_TOP_LEFT ).GetPosition().y;
926  right = m_editPoints->Point( RECT_BOT_RIGHT ).GetPosition().x;
927  bottom = m_editPoints->Point( RECT_BOT_RIGHT ).GetPosition().y;
928  }
929  else
930  {
931  left = m_editPoints->Point( RECT_BOT_LEFT ).GetPosition().x;
932  top = m_editPoints->Point( RECT_TOP_RIGHT ).GetPosition().y;
933  right = m_editPoints->Point( RECT_TOP_RIGHT ).GetPosition().x;
934  bottom = m_editPoints->Point( RECT_BOT_LEFT ).GetPosition().y;
935  }
936 
937  wxSize padSize( abs( right - left ), abs( bottom - top ) );
938 
939  if( pad->GetOrientation() == 900 || pad->GetOrientation() == 2700 )
940  std::swap( padSize.x, padSize.y );
941 
942  pad->SetSize( padSize );
943  pad->SetPosition( wxPoint( ( left + right ) / 2, ( top + bottom ) / 2 ) );
944  }
945  }
946  break;
947 
948  default: // suppress warnings
949  break;
950  }
951  }
952  break;
953 
955  case PCB_ZONE_AREA_T:
956  {
957  ZONE_CONTAINER* zone = static_cast<ZONE_CONTAINER*>( item );
958  zone->ClearFilledPolysList();
959  SHAPE_POLY_SET& outline = *zone->Outline();
960 
961  for( int i = 0; i < outline.TotalVertices(); ++i )
962  {
963  if( outline.CVertex( i ) != m_editPoints->Point( i ).GetPosition() )
964  zone->SetNeedRefill( true );
965 
966  outline.SetVertex( i, m_editPoints->Point( i ).GetPosition() );
967  }
968 
969  validatePolygon( outline );
970  zone->HatchBorder();
971  break;
972  }
973 
974  case PCB_DIMENSION_T:
975  {
976  DIMENSION* dimension = static_cast<DIMENSION*>( item );
977 
978  // Check which point is currently modified and updated dimension's points respectively
979  if( isModified( m_editPoints->Point( DIM_CROSSBARO ) ) )
980  {
981  VECTOR2D featureLine( m_editedPoint->GetPosition() - dimension->GetOrigin() );
982  VECTOR2D crossBar( dimension->GetEnd() - dimension->GetOrigin() );
983 
984  if( featureLine.Cross( crossBar ) > 0 )
985  dimension->SetHeight( -featureLine.EuclideanNorm(), boardSettings.m_DimensionPrecision );
986  else
987  dimension->SetHeight( featureLine.EuclideanNorm(), boardSettings.m_DimensionPrecision );
988  }
989 
990  else if( isModified( m_editPoints->Point( DIM_CROSSBARF ) ) )
991  {
992  VECTOR2D featureLine( m_editedPoint->GetPosition() - dimension->GetEnd() );
993  VECTOR2D crossBar( dimension->GetEnd() - dimension->GetOrigin() );
994 
995  if( featureLine.Cross( crossBar ) > 0 )
996  dimension->SetHeight( -featureLine.EuclideanNorm(), boardSettings.m_DimensionPrecision );
997  else
998  dimension->SetHeight( featureLine.EuclideanNorm(), boardSettings.m_DimensionPrecision );
999  }
1000 
1001  else if( isModified( m_editPoints->Point( DIM_FEATUREGO ) ) )
1002  {
1004  boardSettings.m_DimensionPrecision );
1005  m_editPoints->Point( DIM_CROSSBARO ).SetConstraint( new EC_LINE( m_editPoints->Point( DIM_CROSSBARO ),
1006  m_editPoints->Point( DIM_FEATUREGO ) ) );
1007  m_editPoints->Point( DIM_CROSSBARF ).SetConstraint( new EC_LINE( m_editPoints->Point( DIM_CROSSBARF ),
1008  m_editPoints->Point( DIM_FEATUREDO ) ) );
1009  }
1010 
1011  else if( isModified( m_editPoints->Point( DIM_FEATUREDO ) ) )
1012  {
1014  boardSettings.m_DimensionPrecision );
1015  m_editPoints->Point( DIM_CROSSBARO ).SetConstraint( new EC_LINE( m_editPoints->Point( DIM_CROSSBARO ),
1016  m_editPoints->Point( DIM_FEATUREGO ) ) );
1017  m_editPoints->Point( DIM_CROSSBARF ).SetConstraint( new EC_LINE( m_editPoints->Point( DIM_CROSSBARF ),
1018  m_editPoints->Point( DIM_FEATUREDO ) ) );
1019  }
1020 
1021  break;
1022  }
1023 
1024  default:
1025  break;
1026  }
1027 
1028  getView()->Update( item );
1029 
1030  if( frame() )
1031  frame()->SetMsgPanel( item );
1032 }
double EuclideanNorm(const wxPoint &vector)
Euclidean norm of a 2D vector.
Definition: trigo.h:128
int TotalVertices() const
Returns total number of vertices stored in the set.
ZONE_CONTAINER handles a list of polygons defining a copper zone.
Definition: class_zone.h:61
void HatchBorder()
Function HatchBorder computes the hatch lines depending on the hatch parameters and stores it in the ...
Definition: class_zone.cpp:961
wxPoint GetArcStart() const
wxPoint GetArcEnd() const
virtual void Move(const wxPoint &aMoveVector) override
Function Move move this object.
BOARD * board() const
void SetArcStart(const wxPoint &aArcStartPoint)
Initialize the start arc point.
wxPoint GetPosition() const override
Definition: class_pad.h:165
STROKE_T GetShape() const
void SetStartY(int y)
const VECTOR2I & CVertex(int aIndex, int aOutline, int aHole) const
Returns the index-th vertex in a given hole outline within a given outline
polygon (not yet used for tracks, but could be in microwave apps)
void RebuildBezierToSegmentsPointsList(int aMinSegLen)
Rebuild the m_BezierPoints vertex list that approximate the Bezier curve by a list of segments Has me...
class ZONE_CONTAINER, a zone area
Definition: typeinfo.h:102
SHAPE_POLY_SET * Outline()
Definition: class_zone.h:281
double RAD2DECIDEG(double rad)
Definition: trigo.h:219
void SetHeight(int aHeight, int aPrecision)
Function SetHeight Sets the length of feature lines.
void SetPosition(const wxPoint &aPos) override
Definition: class_pad.h:159
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Function GetDesignSettings.
Definition: class_board.h:553
usual segment : line with rounded ends
class D_PAD, a pad in a footprint
Definition: typeinfo.h:90
bool isModified(const EDIT_POINT &aPoint) const
Returns true if aPoint is the currently modified point.
Definition: point_editor.h:117
void RotatePoint(int *pX, int *pY, double angle)
Definition: trigo.cpp:208
wxPoint GetArcMid() const
void SetCenter(const wxPoint &aCenterPoint)
For arcs and circles:
class EDGE_MODULE, a footprint edge
Definition: typeinfo.h:94
void SetBezControl2(const wxPoint &aPoint)
EC_LINE.
double m_drawArcCenterStartEndMaxAngle
For drawsegments - arcs.
PCB_BASE_EDIT_FRAME * frame() const
void SetVertex(const VERTEX_INDEX &aIndex, const VECTOR2I &aPos)
Function SetVertex Accessor function to set the position of a specific point.
std::shared_ptr< EDIT_POINTS > m_editPoints
Currently available edit points.
Definition: point_editor.h:81
segment with non rounded ends
void SetArcEnd(const wxPoint &aArcEndPoint)
Initialize the start arc point.
void SetOrigin(const wxPoint &aOrigin, int aPrecision)
Function SetOrigin Sets a new origin of the crossbar line.
virtual VECTOR2I GetPosition() const
Function GetPosition()
Definition: edit_points.h:69
const wxPoint & GetEnd()
Function GetEnd.
VECTOR2< double > VECTOR2D
Definition: vector2d.h:593
void SetEnd(const wxPoint &aEnd, int aPrecision)
Function SetEnd Sets a new end of the crossbar line.
void SetMsgPanel(const std::vector< MSG_PANEL_ITEM > &aList)
Clear the message panel and populates it with the contents of aList.
double m_drawArcAccuracy
For drawsegments - arcs.
SHAPE_POLY_SET.
Arcs (with rounded ends)
const wxPoint & GetOffset() const
Definition: class_pad.h:233
void SetSize(const wxSize &aSize)
Definition: class_pad.h:223
void SetEndY(int y)
SHAPE_POLY_SET & GetPolyShape()
Bezier Curve.
const wxPoint & GetOrigin() const
Function GetOrigin.
double Angle() const
Function Angle computes the angle of the vector.
Definition: vector2d.h:313
virtual void Update(VIEW_ITEM *aItem, int aUpdateFlags)
For dynamic VIEWs, informs the associated VIEW that the graphical representation of this item has cha...
Definition: view.cpp:1544
class DIMENSION, a dimension (graphic item)
Definition: typeinfo.h:100
KIGFX::VIEW * getView() const
Function getView()
Definition: tool_base.cpp:36
int GetWidth() const
void SetStart(const wxPoint &aStart)
double GetAngle() const
bool validatePolygon(SHAPE_POLY_SET &aModified) const
Validates a polygon and displays a popup warning if invalid.
double GetOrientation() const
Function GetOrientation returns the rotation angle of the pad in tenths of degrees,...
Definition: class_pad.h:325
const wxSize & GetDrillSize() const
Definition: class_pad.h:230
wxPoint ShapePos() const
Definition: class_pad.cpp:605
static float distance(const SFVEC2UI &a, const SFVEC2UI &b)
EDA_ITEM is a base class for most all the KiCad significant classes, used in schematics and boards.
Definition: base_struct.h:159
void SetEndX(int x)
void SetEnd(const wxPoint &aEnd)
void SetAngle(double aAngle)
Function SetAngle sets the angle for arcs, and normalizes it within the range 0 - 360 degrees.
static const ADVANCED_CFG & GetCfg()
Get the singleton instance's config, which is shared by all consumers of advanced config.
T EuclideanNorm() const
Destructor.
Definition: vector2d.h:299
void SetStartX(int x)
PAD_SHAPE_T GetShape() const
Definition: class_pad.h:157
KIGFX::VIEW_CONTROLS * getViewControls() const
Function getViewControls()
Definition: tool_base.cpp:42
class ZONE_CONTAINER, managed by a footprint
Definition: typeinfo.h:95
const VECTOR2I GetArcCenter(const VECTOR2I &aStart, const VECTOR2I &aMid, const VECTOR2I &aEnd)
Determine the center of an arc or circle given three points on its circumference.
Definition: trigo.cpp:405
class DRAWSEGMENT, a segment not on copper layers
Definition: typeinfo.h:91
EDIT_POINT * m_editedPoint
Currently edited point, NULL if there is none.
Definition: point_editor.h:75
void SetOffset(const wxPoint &aOffset)
Definition: class_pad.h:232
DIMENSION.
VECTOR2D GetCursorPosition() const
Returns the current cursor position in world coordinates.
void ClearFilledPolysList()
Function ClearFilledPolysList clears the list of filled polygons.
Definition: class_zone.h:592
wxPoint GetCenter() const override
Function GetCenter()
KICAD_T Type() const
Function Type()
Definition: base_struct.h:193
BOARD_DESIGN_SETTINGS contains design settings for a BOARD object.
void SetBezControl1(const wxPoint &aPoint)
void SetNeedRefill(bool aNeedRefill)
Definition: class_zone.h:193

References VECTOR2< T >::Angle(), ARC_CENTER, ARC_END, ARC_MID, ARC_START, BEZIER_CURVE_CONTROL_POINT1, BEZIER_CURVE_CONTROL_POINT2, BEZIER_CURVE_END, BEZIER_CURVE_START, PCB_TOOL_BASE::board(), CIRC_CENTER, CIRC_END, ZONE_CONTAINER::ClearFilledPolysList(), SHAPE_POLY_SET::CVertex(), DIM_CROSSBARF, DIM_CROSSBARO, DIM_FEATUREDO, DIM_FEATUREGO, distance(), EuclideanNorm(), VECTOR2< T >::EuclideanNorm(), PCB_TOOL_BASE::frame(), DRAWSEGMENT::GetAngle(), GetArcCenter(), DRAWSEGMENT::GetArcEnd(), DRAWSEGMENT::GetArcMid(), DRAWSEGMENT::GetArcStart(), DRAWSEGMENT::GetCenter(), ADVANCED_CFG::GetCfg(), KIGFX::VIEW_CONTROLS::GetCursorPosition(), BOARD::GetDesignSettings(), D_PAD::GetDrillSize(), DIMENSION::GetEnd(), D_PAD::GetOffset(), D_PAD::GetOrientation(), DIMENSION::GetOrigin(), DRAWSEGMENT::GetPolyShape(), EDIT_POINT::GetPosition(), D_PAD::GetPosition(), DRAWSEGMENT::GetShape(), D_PAD::GetShape(), TOOL_BASE::getView(), TOOL_BASE::getViewControls(), DRAWSEGMENT::GetWidth(), ZONE_CONTAINER::HatchBorder(), isModified(), BOARD_DESIGN_SETTINGS::m_DimensionPrecision, ADVANCED_CFG::m_drawArcAccuracy, ADVANCED_CFG::m_drawArcCenterStartEndMaxAngle, m_editedPoint, m_editPoints, DRAWSEGMENT::Move(), ZONE_CONTAINER::Outline(), PAD_SHAPE_CHAMFERED_RECT, PAD_SHAPE_CIRCLE, PAD_SHAPE_OVAL, PAD_SHAPE_RECT, PAD_SHAPE_ROUNDRECT, PAD_SHAPE_TRAPEZOID, PCB_DIMENSION_T, PCB_LINE_T, PCB_MODULE_EDGE_T, PCB_MODULE_ZONE_AREA_T, PCB_PAD_T, PCB_ZONE_AREA_T, RAD2DECIDEG(), DRAWSEGMENT::RebuildBezierToSegmentsPointsList(), RECT_BOT_LEFT, RECT_BOT_RIGHT, RECT_TOP_LEFT, RECT_TOP_RIGHT, RotatePoint(), S_ARC, S_CIRCLE, S_CURVE, S_POLYGON, S_RECT, S_SEGMENT, SEG_END, SEG_START, DRAWSEGMENT::SetAngle(), DRAWSEGMENT::SetArcEnd(), DRAWSEGMENT::SetArcStart(), DRAWSEGMENT::SetBezControl1(), DRAWSEGMENT::SetBezControl2(), DRAWSEGMENT::SetCenter(), DRAWSEGMENT::SetEnd(), DIMENSION::SetEnd(), DRAWSEGMENT::SetEndX(), DRAWSEGMENT::SetEndY(), DIMENSION::SetHeight(), EDA_DRAW_FRAME::SetMsgPanel(), ZONE_CONTAINER::SetNeedRefill(), D_PAD::SetOffset(), DIMENSION::SetOrigin(), D_PAD::SetPosition(), D_PAD::SetSize(), DRAWSEGMENT::SetStart(), DRAWSEGMENT::SetStartX(), DRAWSEGMENT::SetStartY(), SHAPE_POLY_SET::SetVertex(), D_PAD::ShapePos(), SHAPE_POLY_SET::TotalVertices(), EDA_ITEM::Type(), KIGFX::VIEW::Update(), validatePolygon(), wxPoint::x, VECTOR2< T >::x, wxPoint::y, and VECTOR2< T >::y.

Referenced by OnSelectionChange().

◆ updatePoints()

void POINT_EDITOR::updatePoints ( )
private

Updates edit points with item's points.

Definition at line 1074 of file point_editor.cpp.

1075 {
1076  if( !m_editPoints )
1077  return;
1078 
1079  EDA_ITEM* item = m_editPoints->GetParent();
1080 
1081  if( !item )
1082  return;
1083 
1084  switch( item->Type() )
1085  {
1086  case PCB_LINE_T:
1087  case PCB_MODULE_EDGE_T:
1088  {
1089  const DRAWSEGMENT* segment = static_cast<const DRAWSEGMENT*>( item );
1090 
1091  switch( segment->GetShape() )
1092  {
1093  case S_SEGMENT:
1094  m_editPoints->Point( SEG_START ).SetPosition( segment->GetStart() );
1095  m_editPoints->Point( SEG_END ).SetPosition( segment->GetEnd() );
1096  break;
1097 
1098  case S_RECT:
1099  m_editPoints->Point( RECT_TOP_LEFT ).SetPosition( segment->GetStart() );
1100  m_editPoints->Point( RECT_TOP_RIGHT ).SetPosition( segment->GetEnd().x,
1101  segment->GetStart().y );
1102  m_editPoints->Point( RECT_BOT_RIGHT ).SetPosition( segment->GetEnd() );
1103  m_editPoints->Point( RECT_BOT_LEFT ).SetPosition( segment->GetStart().x,
1104  segment->GetEnd().y );
1105  break;
1106 
1107  case S_ARC:
1108  m_editPoints->Point( ARC_CENTER ).SetPosition( segment->GetCenter() );
1109  m_editPoints->Point( ARC_START ).SetPosition( segment->GetArcStart() );
1110  m_editPoints->Point( ARC_MID ).SetPosition( segment->GetArcMid() );
1111  m_editPoints->Point( ARC_END ).SetPosition( segment->GetArcEnd() );
1112  break;
1113 
1114  case S_CIRCLE:
1115  m_editPoints->Point( CIRC_CENTER ).SetPosition( segment->GetCenter() );
1116  m_editPoints->Point( CIRC_END ).SetPosition( segment->GetEnd() );
1117  break;
1118 
1119  case S_POLYGON:
1120  {
1121  const auto& points = segment->BuildPolyPointsList();
1122 
1123  if( m_editPoints->PointsSize() != (unsigned) points.size() )
1124  {
1125  getView()->Remove( m_editPoints.get() );
1126  m_editedPoint = nullptr;
1127  m_editPoints = EDIT_POINTS_FACTORY::Make( item, getView()->GetGAL() );
1128  getView()->Add( m_editPoints.get() );
1129  }
1130  else
1131  {
1132  for( unsigned i = 0; i < points.size(); i++ )
1133  m_editPoints->Point( i ).SetPosition( points[i] );
1134  }
1135  break;
1136  }
1137 
1138  case S_CURVE:
1139  m_editPoints->Point( BEZIER_CURVE_START ).SetPosition( segment->GetStart() );
1140  m_editPoints->Point( BEZIER_CURVE_CONTROL_POINT1 ).SetPosition( segment->GetBezControl1() );
1141  m_editPoints->Point( BEZIER_CURVE_CONTROL_POINT2 ).SetPosition( segment->GetBezControl2() );
1142  m_editPoints->Point( BEZIER_CURVE_END ).SetPosition( segment->GetEnd() );
1143  break;
1144 
1145  default: // suppress warnings
1146  break;
1147  }
1148 
1149  break;
1150  }
1151 
1152  case PCB_PAD_T:
1153  {
1154  const D_PAD* pad = static_cast<const D_PAD*>( item );
1155  bool locked = pad->GetParent() && pad->GetParent()->PadsLocked();
1156  wxPoint shapePos = pad->ShapePos();
1157  wxPoint halfSize( pad->GetSize().x / 2, pad->GetSize().y / 2 );
1158 
1159  switch( pad->GetShape() )
1160  {
1161  case PAD_SHAPE_CIRCLE:
1162  {
1163  int target = locked ? 0 : 2;
1164 
1165  // Careful; pad shape is mutable...
1166  if( int( m_editPoints->PointsSize() ) != target )
1167  {
1168  getView()->Remove( m_editPoints.get() );
1169  m_editedPoint = nullptr;
1170  m_editPoints = EDIT_POINTS_FACTORY::Make( item, getView()->GetGAL() );
1171  getView()->Add( m_editPoints.get() );
1172  }
1173  else if( target == 2 )
1174  {
1175  VECTOR2I vec = m_editPoints->Point( CIRC_END ).GetPosition()
1176  - m_editPoints->Point( CIRC_CENTER ).GetPosition();
1177  vec.Resize( halfSize.x );
1178 
1179  m_editPoints->Point( CIRC_CENTER ).SetPosition( shapePos );
1180  m_editPoints->Point( CIRC_END ).SetPosition( vec + shapePos );
1181  }
1182  }
1183  break;
1184 
1185  case PAD_SHAPE_OVAL:
1186  case PAD_SHAPE_TRAPEZOID:
1187  case PAD_SHAPE_RECT:
1188  case PAD_SHAPE_ROUNDRECT:
1190  {
1191  // Careful; pad shape and orientation are mutable...
1192  int target = locked || (int) pad->GetOrientation() % 900 > 0 ? 0 : 4;
1193 
1194  if( int( m_editPoints->PointsSize() ) != target )
1195  {
1196  getView()->Remove( m_editPoints.get() );
1197  m_editedPoint = nullptr;
1198  m_editPoints = EDIT_POINTS_FACTORY::Make( item, getView()->GetGAL() );
1199  getView()->Add( m_editPoints.get() );
1200  }
1201  else if( target == 4 )
1202  {
1203  if( pad->GetOrientation() == 900 || pad->GetOrientation() == 2700 )
1204  std::swap( halfSize.x, halfSize.y );
1205 
1206  m_editPoints->Point( RECT_TOP_LEFT ).SetPosition( shapePos - halfSize );
1207  m_editPoints->Point( RECT_TOP_RIGHT ).SetPosition( wxPoint( shapePos.x + halfSize.x,
1208  shapePos.y - halfSize.y ) );
1209  m_editPoints->Point( RECT_BOT_RIGHT ).SetPosition( shapePos + halfSize );
1210  m_editPoints->Point( RECT_BOT_LEFT ).SetPosition( wxPoint( shapePos.x - halfSize.x,
1211  shapePos.y + halfSize.y ) );
1212  }
1213  }
1214  break;
1215 
1216  default: // suppress warnings
1217  break;
1218  }
1219  }
1220  break;
1221 
1223  case PCB_ZONE_AREA_T:
1224  {
1225  ZONE_CONTAINER* zone = static_cast<ZONE_CONTAINER*>( item );
1226  const SHAPE_POLY_SET* outline = zone->Outline();
1227 
1228  if( m_editPoints->PointsSize() != (unsigned) outline->TotalVertices() )
1229  {
1230  getView()->Remove( m_editPoints.get() );
1231  m_editedPoint = nullptr;
1232  m_editPoints = EDIT_POINTS_FACTORY::Make( item, getView()->GetGAL() );
1233  getView()->Add( m_editPoints.get() );
1234  }
1235  else
1236  {
1237  for( int i = 0; i < outline->TotalVertices(); ++i )
1238  m_editPoints->Point( i ).SetPosition( outline->CVertex( i ) );
1239  }
1240 
1241  break;
1242  }
1243 
1244  case PCB_DIMENSION_T:
1245  {
1246  const DIMENSION* dimension = static_cast<const DIMENSION*>( item );
1247 
1248  m_editPoints->Point( DIM_CROSSBARO ).SetPosition( dimension->m_crossBarO );
1249  m_editPoints->Point( DIM_CROSSBARF ).SetPosition( dimension->m_crossBarF );
1250  m_editPoints->Point( DIM_FEATUREGO ).SetPosition( dimension->m_featureLineGO );
1251  m_editPoints->Point( DIM_FEATUREDO ).SetPosition( dimension->m_featureLineDO );
1252  break;
1253  }
1254 
1255  default:
1256  break;
1257  }
1258 
1259  getView()->Update( m_editPoints.get() );
1260 }
int TotalVertices() const
Returns total number of vertices stored in the set.
ZONE_CONTAINER handles a list of polygons defining a copper zone.
Definition: class_zone.h:61
wxPoint GetArcStart() const
wxPoint GetArcEnd() const
wxPoint m_crossBarF
STROKE_T GetShape() const
const VECTOR2I & CVertex(int aIndex, int aOutline, int aHole) const
Returns the index-th vertex in a given hole outline within a given outline
polygon (not yet used for tracks, but could be in microwave apps)
class ZONE_CONTAINER, a zone area
Definition: typeinfo.h:102
virtual void Remove(VIEW_ITEM *aItem)
Function Remove() Removes a VIEW_ITEM from the view.
Definition: view.cpp:380
SHAPE_POLY_SET * Outline()
Definition: class_zone.h:281
usual segment : line with rounded ends
class D_PAD, a pad in a footprint
Definition: typeinfo.h:90
wxPoint GetArcMid() const
const std::vector< wxPoint > BuildPolyPointsList() const
Build and return the list of corners in a std::vector<wxPoint> It must be used only to convert the SH...
const wxPoint & GetEnd() const
Function GetEnd returns the ending point of the graphic.
class EDGE_MODULE, a footprint edge
Definition: typeinfo.h:94
wxPoint m_featureLineGO
std::shared_ptr< EDIT_POINTS > m_editPoints
Currently available edit points.
Definition: point_editor.h:81
segment with non rounded ends
SHAPE_POLY_SET.
Arcs (with rounded ends)
Bezier Curve.
virtual void Update(VIEW_ITEM *aItem, int aUpdateFlags)
For dynamic VIEWs, informs the associated VIEW that the graphical representation of this item has cha...
Definition: view.cpp:1544
class DIMENSION, a dimension (graphic item)
Definition: typeinfo.h:100
KIGFX::VIEW * getView() const
Function getView()
Definition: tool_base.cpp:36
MODULE * GetParent() const
Definition: class_pad.h:111
VECTOR2< T > Resize(T aNewLength) const
Function Resize returns a vector of the same direction, but length specified in aNewLength.
Definition: vector2d.h:392
double GetOrientation() const
Function GetOrientation returns the rotation angle of the pad in tenths of degrees,...
Definition: class_pad.h:325
wxPoint ShapePos() const
Definition: class_pad.cpp:605
const wxPoint & GetBezControl2() const
EDA_ITEM is a base class for most all the KiCad significant classes, used in schematics and boards.
Definition: base_struct.h:159
bool PadsLocked() const
Definition: class_module.h:344
wxPoint m_crossBarO
const wxPoint & GetBezControl1() const
const wxPoint & GetStart() const
Function GetStart returns the starting point of the graphic.
virtual void Add(VIEW_ITEM *aItem, int aDrawPriority=-1)
Function Add() Adds a VIEW_ITEM to the view.
Definition: view.cpp:350
PAD_SHAPE_T GetShape() const
Definition: class_pad.h:157
class ZONE_CONTAINER, managed by a footprint
Definition: typeinfo.h:95
const wxSize & GetSize() const
Definition: class_pad.h:224
class DRAWSEGMENT, a segment not on copper layers
Definition: typeinfo.h:91
EDIT_POINT * m_editedPoint
Currently edited point, NULL if there is none.
Definition: point_editor.h:75
wxPoint m_featureLineDO
static std::shared_ptr< EDIT_POINTS > Make(EDA_ITEM *aItem, SCH_BASE_FRAME *frame)
DIMENSION.
wxPoint GetCenter() const override
Function GetCenter()
KICAD_T Type() const
Function Type()
Definition: base_struct.h:193

References KIGFX::VIEW::Add(), ARC_CENTER, ARC_END, ARC_MID, ARC_START, BEZIER_CURVE_CONTROL_POINT1, BEZIER_CURVE_CONTROL_POINT2, BEZIER_CURVE_END, BEZIER_CURVE_START, DRAWSEGMENT::BuildPolyPointsList(), CIRC_CENTER, CIRC_END, SHAPE_POLY_SET::CVertex(), DIM_CROSSBARF, DIM_CROSSBARO, DIM_FEATUREDO, DIM_FEATUREGO, DRAWSEGMENT::GetArcEnd(), DRAWSEGMENT::GetArcMid(), DRAWSEGMENT::GetArcStart(), DRAWSEGMENT::GetBezControl1(), DRAWSEGMENT::GetBezControl2(), DRAWSEGMENT::GetCenter(), DRAWSEGMENT::GetEnd(), D_PAD::GetOrientation(), D_PAD::GetParent(), DRAWSEGMENT::GetShape(), D_PAD::GetShape(), D_PAD::GetSize(), DRAWSEGMENT::GetStart(), TOOL_BASE::getView(), DIMENSION::m_crossBarF, DIMENSION::m_crossBarO, m_editedPoint, m_editPoints, DIMENSION::m_featureLineDO, DIMENSION::m_featureLineGO, EDIT_POINTS_FACTORY::Make(), ZONE_CONTAINER::Outline(), PAD_SHAPE_CHAMFERED_RECT, PAD_SHAPE_CIRCLE, PAD_SHAPE_OVAL, PAD_SHAPE_RECT, PAD_SHAPE_ROUNDRECT, PAD_SHAPE_TRAPEZOID, MODULE::PadsLocked(), PCB_DIMENSION_T, PCB_LINE_T, PCB_MODULE_EDGE_T, PCB_MODULE_ZONE_AREA_T, PCB_PAD_T, PCB_ZONE_AREA_T, RECT_BOT_LEFT, RECT_BOT_RIGHT, RECT_TOP_LEFT, RECT_TOP_RIGHT, KIGFX::VIEW::Remove(), VECTOR2< T >::Resize(), S_ARC, S_CIRCLE, S_CURVE, S_POLYGON, S_RECT, S_SEGMENT, SEG_END, SEG_START, D_PAD::ShapePos(), SHAPE_POLY_SET::TotalVertices(), EDA_ITEM::Type(), KIGFX::VIEW::Update(), wxPoint::x, and wxPoint::y.

Referenced by addCorner(), modifiedSelection(), OnSelectionChange(), and removeCorner().

◆ validatePolygon()

bool POINT_EDITOR::validatePolygon ( SHAPE_POLY_SET aModified) const
private

Validates a polygon and displays a popup warning if invalid.

Parameters
aModifiedis the polygon to be checked.
Returns
True if polygon is valid.

Definition at line 1052 of file point_editor.cpp.

1053 {
1054  bool valid = !aPoly.IsSelfIntersecting();
1055 
1056  if( m_statusPopup )
1057  {
1058  if( valid )
1059  {
1060  m_statusPopup->Hide();
1061  }
1062  else
1063  {
1064  wxPoint p = wxGetMousePosition() + wxPoint( 20, 20 );
1065  m_statusPopup->Move( p );
1066  m_statusPopup->PopupFor( 1500 );
1067  }
1068  }
1069 
1070  return valid;
1071 }
std::unique_ptr< STATUS_TEXT_POPUP > m_statusPopup
Definition: point_editor.h:92

References SHAPE_POLY_SET::IsSelfIntersecting(), and m_statusPopup.

Referenced by removeCorner(), and updateItem().

◆ view()

◆ Wait()

TOOL_EVENT * TOOL_INTERACTIVE::Wait ( const TOOL_EVENT_LIST aEventList = TOOL_EVENTTC_ANYTA_ANY ))
inherited

Function Wait()

Suspends execution of the tool until an event specified in aEventList arrives. No parameters means waiting for any event.

Definition at line 57 of file tool_interactive.cpp.

58 {
59  return m_toolMgr->ScheduleWait( this, aEventList );
60 }
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:219
TOOL_EVENT * ScheduleWait(TOOL_BASE *aTool, const TOOL_EVENT_LIST &aConditions)
Pauses execution of a given tool until one or more events matching aConditions arrives.

References TOOL_BASE::m_toolMgr, and TOOL_MANAGER::ScheduleWait().

Referenced by GERBVIEW_SELECTION_TOOL::disambiguationMenu(), SCH_LINE_WIRE_BUS_TOOL::doDrawSegments(), PCB_TOOL_BASE::doInteractiveItemPlacement(), EDIT_TOOL::doMoveSelection(), PL_SELECTION_TOOL::doSelectionMenu(), EE_SELECTION_TOOL::doSelectionMenu(), SELECTION_TOOL::doSelectionMenu(), DRAWING_TOOL::drawArc(), DRAWING_TOOL::DrawDimension(), MICROWAVE_TOOL::drawMicrowaveInductor(), DRAWING_TOOL::drawSegment(), LIB_DRAWING_TOOLS::DrawShape(), PL_DRAWING_TOOLS::DrawShape(), SCH_DRAWING_TOOLS::DrawSheet(), DRAWING_TOOL::DrawZone(), PAD_TOOL::EnumeratePads(), ROUTER_TOOL::InlineDrag(), ZOOM_TOOL::Main(), PL_EDIT_TOOL::Main(), CVPCB_CONTROL::Main(), EE_POINT_EDITOR::Main(), PL_POINT_EDITOR::Main(), LIB_MOVE_TOOL::Main(), CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::Main(), SCH_MOVE_TOOL::Main(), PCBNEW_PICKER_TOOL::Main(), EDA_3D_CONTROLLER::Main(), PICKER_TOOL::Main(), GERBVIEW_SELECTION_TOOL::Main(), PL_SELECTION_TOOL::Main(), EE_SELECTION_TOOL::Main(), SELECTION_TOOL::Main(), ROUTER_TOOL::MainLoop(), LENGTH_TUNER_TOOL::MainLoop(), PCB_VIEWER_TOOLS::MeasureTool(), GERBVIEW_SELECTION_TOOL::MeasureTool(), OnSelectionChange(), ROUTER_TOOL::performDragging(), ROUTER_TOOL::performRouting(), LENGTH_TUNER_TOOL::performTuning(), EDIT_TOOL::pickReferencePoint(), LIB_DRAWING_TOOLS::PlaceAnchor(), SCH_DRAWING_TOOLS::PlaceComponent(), SCH_DRAWING_TOOLS::PlaceImage(), DRAWING_TOOL::PlaceImportedGraphics(), PL_DRAWING_TOOLS::PlaceItem(), PCB_EDITOR_CONTROL::PlaceModule(), PCB_EDITOR_CONTROL::PlaceTarget(), DRAWING_TOOL::PlaceText(), EDIT_TOOL::Remove(), PL_SELECTION_TOOL::selectMultiple(), EE_SELECTION_TOOL::selectMultiple(), SELECTION_TOOL::selectMultiple(), GERBVIEW_SELECTION_TOOL::selectPoint(), SELECTION_TOOL::selectPoint(), POSITION_RELATIVE_TOOL::SelectPositionRelativeItem(), ZOOM_TOOL::selectRegion(), DRAWING_TOOL::SetAnchor(), SCH_DRAWING_TOOLS::SingleClickPlace(), LIB_DRAWING_TOOLS::TwoClickPlace(), SCH_DRAWING_TOOLS::TwoClickPlace(), and SCH_LINE_WIRE_BUS_TOOL::UnfoldBus().

Member Data Documentation

◆ m_altConstrainer

EDIT_POINT POINT_EDITOR::m_altConstrainer
private

Definition at line 87 of file point_editor.h.

Referenced by setAltConstraint().

◆ m_altConstraint

std::shared_ptr<EDIT_CONSTRAINT<EDIT_POINT> > POINT_EDITOR::m_altConstraint
private

Definition at line 84 of file point_editor.h.

Referenced by OnSelectionChange(), Reset(), and setAltConstraint().

◆ m_editedPoint

EDIT_POINT* POINT_EDITOR::m_editedPoint
private

◆ m_editModules

◆ m_editPoints

std::shared_ptr<EDIT_POINTS> POINT_EDITOR::m_editPoints
private

◆ m_menu

TOOL_MENU TOOL_INTERACTIVE::m_menu
protectedinherited

functions below are not yet implemented - their interface may change

Definition at line 108 of file tool_interactive.h.

Referenced by SCH_LINE_WIRE_BUS_TOOL::doDrawSegments(), PCB_TOOL_BASE::doInteractiveItemPlacement(), DRAWING_TOOL::drawArc(), DRAWING_TOOL::DrawDimension(), MICROWAVE_TOOL::drawMicrowaveInductor(), DRAWING_TOOL::drawSegment(), LIB_DRAWING_TOOLS::DrawShape(), PL_DRAWING_TOOLS::DrawShape(), SCH_DRAWING_TOOLS::DrawSheet(), DRAWING_TOOL::DrawZone(), PAD_TOOL::EnumeratePads(), TOOL_INTERACTIVE::GetToolMenu(), PICKER_TOOL::Init(), SCH_EDIT_TOOL::Init(), CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::Init(), PL_EDIT_TOOL::Init(), LIB_DRAWING_TOOLS::Init(), PCB_VIEWER_TOOLS::Init(), FOOTPRINT_EDITOR_TOOLS::Init(), PL_DRAWING_TOOLS::Init(), LIB_CONTROL::Init(), PCB_EDITOR_CONTROL::Init(), SCH_DRAWING_TOOLS::Init(), EDA_3D_CONTROLLER::Init(), GERBVIEW_SELECTION_TOOL::Init(), PL_SELECTION_TOOL::Init(), DRAWING_TOOL::Init(), EE_SELECTION_TOOL::Init(), EE_TOOL_BASE< SCH_BASE_FRAME >::Init(), SELECTION_TOOL::Init(), SCH_LINE_WIRE_BUS_TOOL::Init(), PCB_TOOL_BASE::Init(), PL_EDIT_TOOL::Main(), LIB_MOVE_TOOL::Main(), CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::Main(), SCH_MOVE_TOOL::Main(), PCBNEW_PICKER_TOOL::Main(), EDA_3D_CONTROLLER::Main(), PICKER_TOOL::Main(), GERBVIEW_SELECTION_TOOL::Main(), PL_SELECTION_TOOL::Main(), EE_SELECTION_TOOL::Main(), SELECTION_TOOL::Main(), PCB_VIEWER_TOOLS::MeasureTool(), GERBVIEW_SELECTION_TOOL::MeasureTool(), LIB_DRAWING_TOOLS::PlaceAnchor(), SCH_DRAWING_TOOLS::PlaceComponent(), SCH_DRAWING_TOOLS::PlaceImage(), DRAWING_TOOL::PlaceImportedGraphics(), PL_DRAWING_TOOLS::PlaceItem(), PCB_EDITOR_CONTROL::PlaceModule(), PCB_EDITOR_CONTROL::PlaceTarget(), DRAWING_TOOL::PlaceText(), DRAWING_TOOL::SetAnchor(), SCH_DRAWING_TOOLS::SingleClickPlace(), LIB_DRAWING_TOOLS::TwoClickPlace(), and SCH_DRAWING_TOOLS::TwoClickPlace().

◆ m_original

EDIT_POINT POINT_EDITOR::m_original
private

Original position for the current drag point.

Definition at line 78 of file point_editor.h.

Referenced by get45DegConstrainer(), and OnSelectionChange().

◆ m_refill

bool POINT_EDITOR::m_refill
private

Definition at line 90 of file point_editor.h.

Referenced by finishItem(), OnSelectionChange(), and Reset().

◆ m_selectionTool

SELECTION_TOOL* POINT_EDITOR::m_selectionTool
private

Selection tool used for obtaining selected items

Definition at line 72 of file point_editor.h.

Referenced by Init(), and OnSelectionChange().

◆ m_statusPopup

std::unique_ptr<STATUS_TEXT_POPUP> POINT_EDITOR::m_statusPopup
private

Definition at line 92 of file point_editor.h.

Referenced by Reset(), and validatePolygon().

◆ m_toolId

TOOL_ID TOOL_BASE::m_toolId
protectedinherited

Unique identifier for the tool, assigned by a TOOL_MANAGER instance.

Definition at line 214 of file tool_base.h.

Referenced by TOOL_INTERACTIVE::Activate(), TOOL_BASE::GetId(), and TOOL_BASE::IsToolActive().

◆ m_toolMgr

TOOL_MANAGER* TOOL_BASE::m_toolMgr
protectedinherited

Definition at line 219 of file tool_base.h.

Referenced by TOOL_INTERACTIVE::Activate(), PL_SELECTION_TOOL::AddItemsToSel(), EE_SELECTION_TOOL::AddItemsToSel(), PL_SELECTION_TOOL::AddItemToSel(), EE_SELECTION_TOOL::AddItemToSel(), SELECTION_TOOL::AddItemToSel(), SCH_EDITOR_CONTROL::AssignNetclass(), CVPCB_ASSOCIATION_TOOL::Associate(), TOOL_BASE::attachManager(), SCH_EDIT_TOOL::AutoplaceFields(), PCB_INSPECTION_TOOL::calculateSelectionRatsnest(), ROUTER_TOOL::CanInlineDrag(), SCH_EDIT_TOOL::ChangeTextType(), EDIT_TOOL::ChangeTrackWidth(), SCH_EDIT_TOOL::CleanupSheetPins(), PCB_INSPECTION_TOOL::ClearHighlight(), SCH_EDITOR_CONTROL::ClearHighlight(), SELECTION_TOOL::ClearSelection(), PL_SELECTION_TOOL::ClearSelection(), GERBVIEW_SELECTION_TOOL::clearSelection(), EE_SELECTION_TOOL::ClearSelection(), SCH_EDIT_TOOL::ConvertDeMorgan(), LIB_EDIT_TOOL::Copy(), PL_EDIT_TOOL::Copy(), PAD_TOOL::copyPadSettings(), MICROWAVE_TOOL::createInductorBetween(), PCB_INSPECTION_TOOL::CrossProbePcbToSch(), COMMON_TOOLS::CursorControl(), SCH_EDITOR_CONTROL::Cut(), LIB_EDIT_TOOL::DeleteItemCursor(), PL_EDIT_TOOL::DeleteItemCursor(), SCH_EDIT_TOOL::DeleteItemCursor(), PCBNEW_CONTROL::DeleteItemCursor(), SCH_EDITOR_CONTROL::doCopy(), SCH_EDITOR_CONTROL::doCrossProbeSchToPcb(), LIB_EDIT_TOOL::DoDelete(), SCH_EDIT_TOOL::DoDelete(), SCH_LINE_WIRE_BUS_TOOL::doDrawSegments(), PCB_INSPECTION_TOOL::doHideNet(), PCB_TOOL_BASE::doInteractiveItemPlacement(), EDIT_TOOL::doMoveSelection(), SCH_LINE_WIRE_BUS_TOOL::doUnfoldBus(), COMMON_TOOLS::doZoomInOut(), COMMON_TOOLS::doZoomToPreset(), DRAWING_TOOL::DrawArc(), DRAWING_TOOL::drawArc(), DRAWING_TOOL::DrawCircle(), DRAWING_TOOL::DrawDimension(), DRAWING_TOOL::DrawRectangle(), DRAWING_TOOL::drawSegment(), LIB_DRAWING_TOOLS::DrawShape(), PL_DRAWING_TOOLS::DrawShape(), SCH_DRAWING_TOOLS::DrawSheet(), DRAWING_TOOL::DrawZone(), PCB_EDITOR_CONTROL::DrillOrigin(), LIB_EDIT_TOOL::Duplicate(), SCH_EDIT_TOOL::Duplicate(), EDIT_TOOL::Duplicate(), SCH_EDIT_TOOL::EditField(), SCH_EDIT_TOOL::editFieldText(), PCB_EDITOR_CONTROL::EditFpInFpEditor(), LIB_EDIT_TOOL::editGraphicProperties(), PAD_TOOL::EditPad(), LIB_EDIT_TOOL::editSymbolProperties(), SCH_EDITOR_CONTROL::EditWithLibEdit(), SCH_EDITOR_CONTROL::EnterSheet(), PAD_TOOL::EnumeratePads(), GLOBAL_EDIT_TOOL::ExchangeFootprints(), SELECTION_TOOL::expandConnection(), PAD_TOOL::explodePad(), SELECTION_TOOL::filterSelection(), SELECTION_TOOL::findCallback(), SCH_EDITOR_CONTROL::FindComponentAndItem(), finishItem(), SCH_LINE_WIRE_BUS_TOOL::finishSegments(), EDIT_TOOL::Flip(), EDIT_TOOL::GetAndPlace(), TOOL_BASE::GetManager(), TOOL_BASE::getModelInt(), DRAWING_TOOL::getSourceZoneForAction(), TOOL_BASE::getToolHolderInt(), TOOL_BASE::getView(), TOOL_BASE::getViewControls(), TOOL_INTERACTIVE::goInternal(), COMMON_TOOLS::GridNext(), COMMON_TOOLS::GridPreset(), COMMON_TOOLS::GridPrev(), PCBNEW_CONTROL::GridSetOrigin(), GERBVIEW_CONTROL::HighlightControl(), PCB_INSPECTION_TOOL::HighlightItem(), PCB_INSPECTION_TOOL::HighlightNet(), SCH_EDITOR_CONTROL::HighlightNet(), PCB_INSPECTION_TOOL::highlightNet(), SCH_EDITOR_CONTROL::HighlightNetCursor(), PCB_INSPECTION_TOOL::HighlightNetTool(), FOOTPRINT_EDITOR_TOOLS::ImportFootprint(), PL_EDIT_TOOL::ImportWorksheetContent(), LIB_EDIT_TOOL::Init(), PL_EDIT_TOOL::Init(), SCH_EDIT_TOOL::Init(), PCB_INSPECTION_TOOL::Init(), GLOBAL_EDIT_TOOL::Init(), PAD_TOOL::Init(), ALIGN_DISTRIBUTE_TOOL::Init(), PL_DRAWING_TOOLS::Init(), LIB_CONTROL::Init(), PL_POINT_EDITOR::Init(), Init(), PCB_EDITOR_CONTROL::Init(), POSITION_RELATIVE_TOOL::Init(), EE_TOOL_BASE< SCH_BASE_FRAME >::Init(), EDIT_TOOL::Init(), ROUTER_TOOL::InlineBreakTrack(), ROUTER_TOOL::InlineDrag(), EDIT_TOOL::invokeInlineRouter(), EDIT_TOOL::isInteractiveDragEnabled(), EDIT_TOOL::isRouterActive(), TOOL_BASE::IsToolActive(), SCH_EDITOR_CONTROL::LeaveSheet(), COMMON_CONTROL::ListHotKeys(), PCB_INSPECTION_TOOL::LocalRatsnestTool(), PL_EDIT_TOOL::Main(), CVPCB_CONTROL::Main(), LIB_MOVE_TOOL::Main(), SCH_MOVE_TOOL::Main(), PCBNEW_PICKER_TOOL::Main(), PL_SELECTION_TOOL::Main(), EE_SELECTION_TOOL::Main(), SELECTION_TOOL::Main(), ROUTER_TOOL::MainLoop(), LENGTH_TUNER_TOOL::MainLoop(), PCB_VIEWER_TOOLS::MeasureTool(), LIB_EDIT_TOOL::Mirror(), SCH_EDIT_TOOL::Mirror(), EDIT_TOOL::Mirror(), PCB_EDITOR_CONTROL::modifyLockSelected(), EDIT_TOOL::MoveExact(), LIB_CONTROL::OnDeMorgan(), COMMON_TOOLS::OnGridChanged(), OnSelectionChange(), LIB_EDIT_TOOL::Paste(), PL_EDIT_TOOL::Paste(), SCH_EDITOR_CONTROL::Paste(), PAD_TOOL::pastePadProperties(), EDIT_TOOL::pickReferencePoint(), LIB_EDIT_TOOL::PinTable(), PCBNEW_CONTROL::placeBoardItems(), SCH_DRAWING_TOOLS::PlaceComponent(), SCH_DRAWING_TOOLS::PlaceImage(), DRAWING_TOOL::PlaceImportedGraphics(), PL_DRAWING_TOOLS::PlaceItem(), PCB_EDITOR_CONTROL::PlaceModule(), PCB_EDITOR_CONTROL::PlaceTarget(), DRAWING_TOOL::PlaceText(), PCBNEW_CONTROL::Print(), GERBVIEW_CONTROL::Print(), LIB_EDIT_TOOL::Properties(), SCH_EDIT_TOOL::Properties(), EDIT_TOOL::Properties(), PAD_TOOL::pushPadSettings(), EE_SELECTION_TOOL::RebuildSelection(), LIB_EDIT_TOOL::Redo(), SCH_EDITOR_CONTROL::Redo(), SCH_EDIT_TOOL::RefreshSymbolFromLibrary(), POSITION_RELATIVE_TOOL::RelativeItemSelectionMove(), EDIT_TOOL::Remove(), removeCorner(), PL_SELECTION_TOOL::RemoveItemFromSel(), EE_SELECTION_TOOL::RemoveItemFromSel(), SELECTION_TOOL::RemoveItemFromSel(), PL_SELECTION_TOOL::RemoveItemsFromSel(), EE_SELECTION_TOOL::RemoveItemsFromSel(), SCH_EDIT_TOOL::RepeatDrawItem(), LIB_DRAWING_TOOLS::RepeatDrawItem(), EE_SELECTION_TOOL::RequestSelection(), SELECTION_TOOL::RequestSelection(), COMMON_TOOLS::Reset(), PNS::TOOL_BASE::Reset(), EDA_3D_CONTROLLER::Reset(), COMMON_TOOLS::ResetLocalCoords(), TOOL_INTERACTIVE::resetTransitions(), LIB_EDIT_TOOL::Rotate(), SCH_EDIT_TOOL::Rotate(), EDIT_TOOL::Rotate(), TOOL_INTERACTIVE::RunMainStack(), DRC::RunTests(), EE_SELECTION_TOOL::SelectConnection(), PCB_TOOL_BASE::selection(), COMMON_TOOLS::SelectionTool(), GERBVIEW_SELECTION_TOOL::SelectItem(), GERBVIEW_SELECTION_TOOL::SelectItems(), SELECTION_TOOL::SelectItems(), PL_SELECTION_TOOL::selectMultiple(), EE_SELECTION_TOOL::selectMultiple(), SELECTION_TOOL::selectMultiple(), SELECTION_TOOL::selectNet(), PL_SELECTION_TOOL::SelectPoint(), GERBVIEW_SELECTION_TOOL::selectPoint(), EE_SELECTION_TOOL::SelectPoint(), SELECTION_TOOL::selectPoint(), POSITION_RELATIVE_TOOL::SelectPositionRelativeItem(), SELECTION_TOOL::selectSameSheet(), SELECTION_TOOL::selectSheetContents(), DRAWING_TOOL::SetAnchor(), TOOL_INTERACTIVE::SetContextMenu(), DRC::ShowDRCDialog(), SCH_DRAWING_TOOLS::SingleClickPlace(), EDA_3D_CONTROLLER::ToggleVisibility(), PCB_EDITOR_CONTROL::TrackWidthDec(), PCB_EDITOR_CONTROL::TrackWidthInc(), LIB_DRAWING_TOOLS::TwoClickPlace(), SCH_DRAWING_TOOLS::TwoClickPlace(), LIB_EDIT_TOOL::Undo(), SCH_EDITOR_CONTROL::Undo(), GERBVIEW_SELECTION_TOOL::UnselectItem(), GERBVIEW_SELECTION_TOOL::UnselectItems(), SELECTION_TOOL::UnselectItems(), EE_INSPECTION_TOOL::UpdateMessagePanel(), GERBVIEW_CONTROL::UpdateMessagePanel(), PL_EDITOR_CONTROL::UpdateMessagePanel(), PCBNEW_CONTROL::UpdateMessagePanel(), PCB_INSPECTION_TOOL::UpdateSelectionRatsnest(), PCB_EDITOR_CONTROL::ViaSizeDec(), PCB_EDITOR_CONTROL::ViaSizeInc(), TOOL_INTERACTIVE::Wait(), PCB_EDITOR_CONTROL::ZoneDuplicate(), and PCB_EDITOR_CONTROL::ZoneMerge().

◆ m_toolName

std::string TOOL_BASE::m_toolName
protectedinherited

Name of the tool.

Names are expected to obey the format application.ToolName (eg. pcbnew.InteractiveSelection).

Definition at line 218 of file tool_base.h.

Referenced by TOOL_BASE::GetName().

◆ m_type

TOOL_TYPE TOOL_BASE::m_type
protectedinherited

Stores the type of the tool.

Definition at line 211 of file tool_base.h.

Referenced by TOOL_BASE::GetType(), and BOARD_COMMIT::Push().


The documentation for this class was generated from the following files: