KiCad PCB EDA Suite
POINT_EDITOR Class Reference

Class 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...
 
TOOL_SETTINGSGetSettings ()
 
bool IsToolActive () const
 

Protected Types

enum  INTERACTIVE_PLACEMENT_OPTIONS { IPO_ROTATE = 1, IPO_FLIP = 2, IPO_SINGLE_CLICK = 4, IPO_REPEAT = 8 }
 

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
 
TOOL_SETTINGS m_toolSettings
 

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

Class 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

Enumerator
IPO_ROTATE 
IPO_FLIP 
IPO_SINGLE_CLICK 
IPO_REPEAT 

Definition at line 109 of file pcb_tool_base.h.

◆ 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 226 of file point_editor.cpp.

226  :
227  PCB_TOOL_BASE( "pcbnew.PointEditor" ),
228  m_selectionTool( NULL ),
229  m_editedPoint( NULL ),
230  m_original( VECTOR2I( 0, 0 ) ),
231  m_altConstrainer( VECTOR2I( 0, 0 ) ),
232  m_refill( false )
233 {
234 }
VECTOR2< int > VECTOR2I
Definition: vector2d.h:587
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:71
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(), DRAWING_TOOL::DrawArc(), DRAWING_TOOL::DrawCircle(), DRAWING_TOOL::DrawDimension(), DRAWING_TOOL::DrawLine(), MICROWAVE_TOOL::drawMicrowaveInductor(), 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(), SCH_MOVE_TOOL::Main(), EE_POINT_EDITOR::Main(), PL_POINT_EDITOR::Main(), LIB_MOVE_TOOL::Main(), PCBNEW_PICKER_TOOL::Main(), PICKER_TOOL::Main(), ROUTER_TOOL::MainLoop(), LENGTH_TUNER_TOOL::MainLoop(), CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::MeasureTool(), GERBVIEW_SELECTION_TOOL::MeasureTool(), EDIT_TOOL::MeasureTool(), EDIT_TOOL::Move(), 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 954 of file point_editor.cpp.

955 {
956  if( !m_editPoints )
957  return 0;
958 
959  EDA_ITEM* item = m_editPoints->GetParent();
960  PCB_BASE_EDIT_FRAME* frame = getEditFrame<PCB_BASE_EDIT_FRAME>();
961  const VECTOR2I& cursorPos = getViewControls()->GetCursorPosition();
962 
963  // called without an active edited polygon
964  if( !item || !canAddCorner( *item ) )
965  return 0;
966 
967  DRAWSEGMENT* graphicItem = dynamic_cast<DRAWSEGMENT*>( item );
968  BOARD_COMMIT commit( frame );
969 
970  if( item->Type() == PCB_ZONE_AREA_T || item->Type() == PCB_MODULE_ZONE_AREA_T ||
971  ( graphicItem && graphicItem->GetShape() == S_POLYGON ) )
972  {
973  unsigned int nearestIdx = 0;
974  unsigned int nextNearestIdx = 0;
975  unsigned int nearestDist = INT_MAX;
976  unsigned int firstPointInContour = 0;
977  SHAPE_POLY_SET* zoneOutline;
978 
979  if( item->Type() == PCB_ZONE_AREA_T || item->Type() == PCB_MODULE_ZONE_AREA_T )
980  {
981  ZONE_CONTAINER* zone = static_cast<ZONE_CONTAINER*>( item );
982  zoneOutline = zone->Outline();
983  zone->SetNeedRefill( true );
984  }
985  else
986  zoneOutline = &( graphicItem->GetPolyShape() );
987 
988  commit.Modify( item );
989 
990  // Search the best outline segment to add a new corner
991  // and therefore break this segment into two segments
992 
993  // Object to iterate through the corners of the outlines (main contour and its holes)
994  SHAPE_POLY_SET::ITERATOR iterator = zoneOutline->Iterate( 0,
995  zoneOutline->OutlineCount()-1, /* IterateHoles */ true );
996  int curr_idx = 0;
997 
998  // Iterate through all the corners of the outlines and search the best segment
999  for( ; iterator; iterator++, curr_idx++ )
1000  {
1001  int jj = curr_idx+1;
1002 
1003  if( iterator.IsEndContour() )
1004  { // We reach the last point of the current contour (main or hole)
1005  jj = firstPointInContour;
1006  firstPointInContour = curr_idx+1; // Prepare next contour analysis
1007  }
1008 
1009  SEG curr_segment( zoneOutline->CVertex( curr_idx ), zoneOutline->CVertex( jj ) );
1010 
1011  unsigned int distance = curr_segment.Distance( cursorPos );
1012 
1013  if( distance < nearestDist )
1014  {
1015  nearestDist = distance;
1016  nearestIdx = curr_idx;
1017  nextNearestIdx = jj;
1018  }
1019  }
1020 
1021  // Find the point on the closest segment
1022  auto& sideOrigin = zoneOutline->CVertex( nearestIdx );
1023  auto& sideEnd = zoneOutline->CVertex( nextNearestIdx );
1024  SEG nearestSide( sideOrigin, sideEnd );
1025  VECTOR2I nearestPoint = nearestSide.NearestPoint( cursorPos );
1026 
1027  // Do not add points that have the same coordinates as ones that already belong to polygon
1028  // instead, add a point in the middle of the side
1029  if( nearestPoint == sideOrigin || nearestPoint == sideEnd )
1030  nearestPoint = ( sideOrigin + sideEnd ) / 2;
1031 
1032  zoneOutline->InsertVertex( nextNearestIdx, nearestPoint );
1033 
1034  // We re-hatch the filled zones but not polygons
1035  if( item->Type() == PCB_ZONE_AREA_T || item->Type() == PCB_MODULE_ZONE_AREA_T )
1036  static_cast<ZONE_CONTAINER*>( item )->Hatch();
1037 
1038 
1039  commit.Push( _( "Add a zone corner" ) );
1040  }
1041 
1042  else if( graphicItem && graphicItem->GetShape() == S_SEGMENT )
1043  {
1044  commit.Modify( graphicItem );
1045 
1046  SEG seg( graphicItem->GetStart(), graphicItem->GetEnd() );
1047  VECTOR2I nearestPoint = seg.NearestPoint( cursorPos );
1048 
1049  // Move the end of the line to the break point..
1050  graphicItem->SetEnd( wxPoint( nearestPoint.x, nearestPoint.y ) );
1051 
1052  if( graphicItem->Type() == PCB_MODULE_EDGE_T )
1053  static_cast<EDGE_MODULE*>( graphicItem )->SetLocalCoord();
1054 
1055  // and add another one starting from the break point
1056  DRAWSEGMENT* newSegment;
1057 
1058  if( item->Type() == PCB_MODULE_EDGE_T )
1059  {
1060  EDGE_MODULE* edge = static_cast<EDGE_MODULE*>( graphicItem );
1061  assert( edge->GetParent()->Type() == PCB_MODULE_T );
1062  newSegment = new EDGE_MODULE( *edge );
1063  }
1064  else
1065  {
1066  newSegment = new DRAWSEGMENT( *graphicItem );
1067  }
1068 
1069  newSegment->ClearSelected();
1070  newSegment->SetStart( wxPoint( nearestPoint.x, nearestPoint.y ) );
1071  newSegment->SetEnd( wxPoint( seg.B.x, seg.B.y ) );
1072 
1073  if( newSegment->Type() == PCB_MODULE_EDGE_T )
1074  static_cast<EDGE_MODULE*>( newSegment )->SetLocalCoord();
1075 
1076  commit.Add( newSegment );
1077  commit.Push( _( "Split segment" ) );
1078  }
1079 
1080  updatePoints();
1081  return 0;
1082 }
Class ZONE_CONTAINER handles a list of polygons defining a copper zone.
Definition: class_zone.h:60
int OutlineCount() const
Returns the number of outlines in the set
bool IsEndContour() const
Function IsEndContour.
void ClearSelected()
Definition: base_struct.h:243
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:101
SHAPE_POLY_SET * Outline()
Definition: class_zone.h:246
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
Class SHAPE_POLY_SET.
SHAPE_POLY_SET & GetPolyShape()
#define _(s)
void SetStart(const wxPoint &aStart)
Definition: seg.h:36
Common, abstract interface for edit frames.
Class ITERATOR_TEMPLATE.
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
Class EDA_ITEM is a base class for most all the KiCad significant classes, used in schematics and boa...
Definition: base_struct.h:163
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:210
void SetNeedRefill(bool aNeedRefill)
Definition: class_zone.h:177

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 886 of file point_editor.cpp.

887 {
888  if( aSelection.Size() != 1 )
889  return false;
890 
891  const EDA_ITEM* item = aSelection.Front();
892 
893  return ( item != nullptr ) && canAddCorner( *item );
894 }
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:125
Class EDA_ITEM is a base class for most all the KiCad significant classes, used in schematics and boa...
Definition: base_struct.h:163
EDA_ITEM * Front() const
Definition: selection.h:182

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  m_toolSettings = TOOL_SETTINGS( this );
64 }
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:219
TOOL_SETTINGS m_toolSettings
Definition: tool_base.h:220
friend class TOOL_SETTINGS
Definition: tool_base.h:154

References TOOL_BASE::m_toolMgr, TOOL_BASE::m_toolSettings, and TOOL_BASE::TOOL_SETTINGS.

Referenced by TOOL_MANAGER::RegisterTool().

◆ board()

BOARD* PCB_TOOL_BASE::board ( ) const
inlineprotectedinherited

Definition at line 151 of file pcb_tool_base.h.

151 { return getModel<BOARD>(); }

Referenced by PCBNEW_CONTROL::AppendBoard(), AUTOPLACE_TOOL::autoplace(), PCB_INSPECTION_TOOL::calculateSelectionRatsnest(), EDIT_TOOL::ChangeTrackWidth(), ZONE_FILLER_TOOL::CheckAllZones(), DRC::checkClearancePadToPad(), DRC::checkClearanceSegmToPad(), PCB_INSPECTION_TOOL::ClearHighlight(), DRAWING_TOOL::constrainDimension(), EDIT_TOOL::copyToClipboard(), MICROWAVE_TOOL::createInductorBetween(), MODULE_EDITOR_TOOLS::CreatePadFromShapes(), ROUTER_TOOL::CustomTrackWidthDialog(), PCBNEW_CONTROL::DeleteItemCursor(), PCB_TOOL_BASE::doInteractiveItemPlacement(), DRAWING_TOOL::drawArc(), DRAWING_TOOL::DrawDimension(), DRAWING_TOOL::drawSegment(), PAD_TOOL::EnumeratePads(), MODULE_EDITOR_TOOLS::ExplodePadToShapes(), ZONE_FILLER_TOOL::FillAllZones(), SELECTION_TOOL::filterSelection(), SELECTION_TOOL::getCollectorsGuide(), PCBNEW_CONTROL::GraphicDisplayMode(), PCB_INSPECTION_TOOL::highlightNet(), PCBNEW_CONTROL::LayerNext(), PCBNEW_CONTROL::LayerPrev(), PCB_INSPECTION_TOOL::LocalRatsnestTool(), PCB_TOOL_BASE::module(), PCBNEW_CONTROL::ModuleEdgeOutlines(), ROUTER_TOOL::onTrackViaSizeChanged(), ROUTER_TOOL::onViaCommand(), PCBNEW_CONTROL::PadDisplayMode(), PCBNEW_CONTROL::Paste(), PCBNEW_CONTROL::placeBoardItems(), PCB_EDITOR_CONTROL::PlaceModule(), PCB_EDITOR_CONTROL::PlaceTarget(), DRAWING_TOOL::PlaceText(), ROUTER_TOOL::prepareInteractive(), SELECTION_TOOL::RebuildSelection(), PNS::TOOL_BASE::Reset(), PCBNEW_CONTROL::Reset(), SELECTION_TOOL::Selectable(), SELECTION_TOOL::selectAllItemsOnNet(), SELECTION_TOOL::selectAllItemsOnSheet(), SELECTION_TOOL::selectConnectedTracks(), SELECTION_TOOL::selectPoint(), DRC::testDisabledLayers(), DRC::TestZoneToZoneOutline(), 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 874 of file point_editor.cpp.

875 {
876  const auto type = aItem.Type();
877 
878  // Works only for zones and line segments
879  return type == PCB_ZONE_AREA_T || type == PCB_MODULE_ZONE_AREA_T ||
880  ( ( type == PCB_LINE_T || type == PCB_MODULE_EDGE_T ) &&
881  ( static_cast<const DRAWSEGMENT&>( aItem ).GetShape() == S_SEGMENT ||
882  static_cast<const DRAWSEGMENT&>( aItem ).GetShape() == S_POLYGON ) );
883 }
polygon (not yet used for tracks, but could be in microwave apps)
class ZONE_CONTAINER, a zone area
Definition: typeinfo.h:101
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:210

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 36 of file pcb_tool_base.cpp.

39 {
40  using namespace std::placeholders;
41  std::unique_ptr<BOARD_ITEM> newItem;
42 
43  frame()->PushTool( aTool );
44  Activate();
45 
46  BOARD_COMMIT commit( frame() );
47 
49 
50  // do not capture or auto-pan until we start placing an item
51  controls()->ShowCursor( true );
52  controls()->SetSnapping( true );
53 
54  // Add a VIEW_GROUP that serves as a preview for the new item
55  PCBNEW_SELECTION preview;
56  view()->Add( &preview );
57 
58  aPlacer->m_board = board();
59  aPlacer->m_frame = frame();
60  aPlacer->m_modifiers = 0;
61 
62  auto makeNewItem = [&] ( VECTOR2I aPosition )
63  {
64  if( frame()->GetModel() )
65  newItem = aPlacer->CreateItem();
66 
67  if( newItem )
68  {
69  newItem->SetPosition( (wxPoint) aPosition );
70  preview.Add( newItem.get() );
71 
72  if( newItem->Type() == PCB_MODULE_T )
73  {
74  auto module = dyn_cast<MODULE*>( newItem.get() );
75 
76  // modules have more drawable parts
77  module->RunOnChildren( std::bind( &KIGFX::VIEW_GROUP::Add, &preview, _1 ) );
78  }
79  }
80  };
81 
82  if( aOptions & IPO_SINGLE_CLICK )
83  makeNewItem( controls()->GetCursorPosition() );
84 
85  // Main loop: keep receiving events
86  while( TOOL_EVENT* evt = Wait() )
87  {
88  VECTOR2I cursorPos = controls()->GetCursorPosition();
89  aPlacer->m_modifiers = evt->Modifier();
90 
91  auto cleanup = [&] ()
92  {
93  newItem = nullptr;
94  preview.Clear();
95  view()->Update( &preview );
96  controls()->SetAutoPan( false );
97  controls()->CaptureCursor( false );
98  controls()->ShowCursor( true );
99  };
100 
101  if( evt->IsCancelInteractive() )
102  {
103  if( aOptions & IPO_SINGLE_CLICK )
104  {
105  cleanup();
106  frame()->PopTool( aTool );
107  break;
108  }
109  else if( newItem )
110  cleanup();
111  else
112  {
113  frame()->PopTool( aTool );
114  break;
115  }
116  }
117  else if( evt->IsActivate() )
118  {
119  if( newItem )
120  cleanup();
121 
122  if( evt->IsPointEditor() )
123  {
124  // don't exit (the point editor runs in the background)
125  }
126  else if( evt->IsMoveTool() )
127  {
128  // leave ourselves on the stack so we come back after the move
129  break;
130  }
131  else
132  {
133  frame()->PopTool( aTool );
134  break;
135  }
136  }
137  else if( evt->IsClick( BUT_LEFT ) )
138  {
139  if( !newItem )
140  {
141  // create the item if possible
142  makeNewItem( cursorPos );
143 
144  // no item created, so wait for another click
145  if( !newItem )
146  continue;
147 
148  controls()->CaptureCursor( true );
149  controls()->SetAutoPan( true );
150  }
151  else
152  {
153  auto oldFlags = newItem->GetFlags();
154  newItem->ClearFlags();
155 
156  if( !aPlacer->PlaceItem( newItem.get(), commit ) )
157  {
158  newItem->SetFlags( oldFlags );
159  continue;
160  }
161 
162  preview.Clear();
163  newItem.release();
164  commit.Push( aCommitMessage );
165 
166  controls()->CaptureCursor( false );
167  controls()->SetAutoPan( false );
168  controls()->ShowCursor( true );
169 
170  if( !( aOptions & IPO_REPEAT ) )
171  break;
172 
173  if( aOptions & IPO_SINGLE_CLICK )
174  makeNewItem( controls()->GetCursorPosition() );
175  }
176  }
177  else if( evt->IsClick( BUT_RIGHT ) )
178  {
180  }
181  else if( newItem && evt->Category() == TC_COMMAND )
182  {
183  /*
184  * Handle any events that can affect the item as we move it around
185  */
186  if( TOOL_EVT_UTILS::IsRotateToolEvt( *evt ) && ( aOptions & IPO_ROTATE ) )
187  {
188  const int rotationAngle = TOOL_EVT_UTILS::GetEventRotationAngle( *frame(), *evt );
189  newItem->Rotate( newItem->GetPosition(), rotationAngle );
190  view()->Update( &preview );
191  }
192  else if( evt->IsAction( &PCB_ACTIONS::flip ) && ( aOptions & IPO_FLIP ) )
193  {
194  newItem->Flip( newItem->GetPosition(), frame()->Settings().m_FlipLeftRight );
195  view()->Update( &preview );
196  }
197  else if( evt->IsAction( &PCB_ACTIONS::viaSizeInc )
198  || evt->IsAction( &PCB_ACTIONS::viaSizeDec ) )
199  {
200  // Refresh preview after event runs
202  }
203  else if( evt->IsAction( &ACTIONS::refreshPreview ) )
204  {
205  preview.Clear();
206  newItem.release();
207 
208  makeNewItem( controls()->GetCursorPosition() );
209  view()->Update( &preview );
210  }
211  }
212 
213  else if( newItem && evt->IsMotion() )
214  {
215  // track the cursor
216  newItem->SetPosition( wxPoint( cursorPos.x, cursorPos.y ) );
217  aPlacer->SnapItem( newItem.get() );
218 
219  // Show a preview of the item
220  view()->Update( &preview );
221  }
222 
223  else
224  evt->SetPassEvent();
225  }
226 
227  view()->Remove( &preview );
228 }
static TOOL_ACTION selectionClear
Clears the current selection.
Definition: pcb_actions.h:73
virtual void ShowCursor(bool aEnabled)
Function ShowCursor() Enables or disables display of cursor.
virtual void PushTool(const std::string &actionName)
NB: the definition of "tool" is different at the user level.
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:93
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)
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:91
static TOOL_ACTION viaSizeInc
Definition: pcb_actions.h:282
virtual std::unique_ptr< BOARD_ITEM > CreateItem()=0
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:219
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:109
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:74
virtual void Add(EDA_ITEM *aItem)
Definition: selection.h:74
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
virtual void CaptureCursor(bool aEnabled)
Function CaptureCursor() Forces the cursor to stay within the drawing panel area.
PCB_GENERAL_SETTINGS & Settings()
Class TOOL_EVENT.
Definition: tool_event.h:171
KIGFX::PCB_VIEW * view() const
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.
static TOOL_ACTION flip
Flipping of selected objects.
Definition: pcb_actions.h:111
KIGFX::VIEW_CONTROLS * controls() const
MODULE * module() const
virtual void PopTool(const std::string &actionName)
void Activate()
Function Activate() Runs the tool.
virtual BOARD_ITEM_CONTAINER * GetModel() const =0
Function GetModel()
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:58
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:283
static TOOL_ACTION refreshPreview
Definition: actions.h:101
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(), KIGFX::VIEW_CONTROLS::GetCursorPosition(), TOOL_EVT_UTILS::GetEventRotationAngle(), TOOL_BASE::GetManager(), PCB_BASE_EDIT_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, PCB_GENERAL_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(), EDA_BASE_FRAME::PopTool(), BOARD_COMMIT::Push(), EDA_BASE_FRAME::PushTool(), ACTIONS::refreshPreview, KIGFX::PCB_VIEW::Remove(), TOOL_MANAGER::RunAction(), MODULE::RunOnChildren(), PCB_TOOL_BASE::selection(), PCB_ACTIONS::selectionClear, KIGFX::VIEW_CONTROLS::SetAutoPan(), 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 MODULE_EDITOR_TOOLS::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 625 of file point_editor.cpp.

626 {
627  auto item = m_editPoints->GetParent();
628 
629  if( !item )
630  return;
631 
632  if( item->Type() == PCB_ZONE_AREA_T || item->Type() == PCB_MODULE_ZONE_AREA_T )
633  {
634  auto zone = static_cast<ZONE_CONTAINER*>( item );
635 
636  if( zone->IsFilled() && m_refill && zone->NeedRefill() )
637  m_toolMgr->RunAction( PCB_ACTIONS::zoneFill, true, zone );
638  }
639 }
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:219
class ZONE_CONTAINER, a zone area
Definition: typeinfo.h:101
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Function RunAction() Runs the specified action.
Definition: tool_manager.h:109
static TOOL_ACTION zoneFill
Definition: pcb_actions.h:288
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 146 of file pcb_tool_base.h.

147  {
148  return getEditFrame<PCB_BASE_EDIT_FRAME>();
149  }

Referenced by addCorner(), MICROWAVE_TOOL::addMicrowaveFootprint(), AUTOPLACE_TOOL::autoplace(), PCB_TOOL_BASE::canvas(), ZONE_FILLER_TOOL::CheckAllZones(), PNS::TOOL_BASE::checkSnap(), PAD_TOOL::copyPadSettings(), EDIT_TOOL::copyToClipboard(), MICROWAVE_TOOL::createInductorBetween(), ROUTER_TOOL::CustomTrackWidthDialog(), MODULE_EDITOR_TOOLS::DeleteFootprint(), PCB_TOOL_BASE::displayOptions(), PCB_TOOL_BASE::doInteractiveItemPlacement(), ROUTER_TOOL::DpDimensionsDialog(), DRAWING_TOOL::drawArc(), DRAWING_TOOL::DrawDimension(), MICROWAVE_TOOL::drawMicrowaveInductor(), DRAWING_TOOL::drawSegment(), DRAWING_TOOL::DrawVia(), DRAWING_TOOL::DrawZone(), PAD_TOOL::EnumeratePads(), PCB_EDITOR_CONTROL::ExportSpecctraDSN(), ROUTER_TOOL::finishInteractive(), EDIT_TOOL::Flip(), PCB_EDITOR_CONTROL::FlipPcbView(), GLOBAL_EDIT_TOOL::GlobalDeletions(), MODULE_EDITOR_TOOLS::ImportFootprint(), PCB_EDITOR_CONTROL::ImportSpecctraSession(), SELECTION_TOOL::Init(), EDIT_TOOL::Init(), ROUTER_TOOL::InlineBreakTrack(), ROUTER_TOOL::InlineDrag(), ROUTER_TOOL::MainLoop(), LENGTH_TUNER_TOOL::MainLoop(), LENGTH_TUNER_TOOL::meanderSettingsDialog(), EDIT_TOOL::MeasureTool(), EDIT_TOOL::Move(), OnSelectionChange(), ROUTER_TOOL::onViaCommand(), PCBNEW_CONTROL::Paste(), PAD_TOOL::pastePadProperties(), ROUTER_TOOL::performDragging(), ROUTER_TOOL::performRouting(), LENGTH_TUNER_TOOL::performTuning(), EDIT_TOOL::pickCopyReferencePoint(), PCB_EDITOR_CONTROL::PlaceModule(), PCB_EDITOR_CONTROL::PlaceTarget(), DRAWING_TOOL::PlaceText(), ROUTER_TOOL::prepareInteractive(), PAD_TOOL::pushPadSettings(), 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(), 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 822 of file point_editor.cpp.

823 {
824  EDA_ITEM* item = m_editPoints->GetParent();
825 
826  switch( item->Type() )
827  {
828  case PCB_LINE_T:
829  case PCB_MODULE_EDGE_T:
830  {
831  const DRAWSEGMENT* segment = static_cast<const DRAWSEGMENT*>( item );
832  {
833  switch( segment->GetShape() )
834  {
835  case S_SEGMENT:
836  return *( m_editPoints->Next( *m_editedPoint ) ); // select the other end of line
837 
838  case S_ARC:
839  case S_CIRCLE:
840  return m_editPoints->Point( CIRC_CENTER );
841 
842  default: // suppress warnings
843  break;
844  }
845  }
846 
847  break;
848  }
849 
850  case PCB_DIMENSION_T:
851  {
852  // Constraint for crossbar
853  if( isModified( m_editPoints->Point( DIM_FEATUREGO ) ) )
854  return m_editPoints->Point( DIM_FEATUREDO );
855 
856  else if( isModified( m_editPoints->Point( DIM_FEATUREDO ) ) )
857  return m_editPoints->Point( DIM_FEATUREGO );
858 
859  else
860  return EDIT_POINT( m_editedPoint->GetPosition() ); // no constraint
861 
862  break;
863  }
864 
865  default:
866  break;
867  }
868 
869  // In any other case we may align item to its original position
870  return m_original;
871 }
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:68
Arcs (with rounded ends)
class DIMENSION, a dimension (graphic item)
Definition: typeinfo.h:99
Class EDA_ITEM is a base class for most all the KiCad significant classes, used in schematics and boa...
Definition: base_struct.h:163
EDIT_POINT m_original
Original position for the current drag point.
Definition: point_editor.h:78
Class 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:210

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*>( getEditFrameInt() ) );
191 #endif
192  return static_cast<T*>( getEditFrameInt() );
193  }
EDA_BASE_FRAME * getEditFrameInt() const
Definition: tool_base.cpp:48

References TOOL_BASE::getEditFrameInt().

Referenced by ZONE_CREATE_HELPER::createNewZone(), and TOOL_SETTINGS::getConfigBase().

◆ 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(), and TOOL_MANAGER::saveViewControls().

◆ 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
Class EDA_ITEM is a base class for most all the KiCad significant classes, used in schematics and boa...
Definition: base_struct.h:163

References TOOL_BASE::getModelInt().

Referenced by ZONE_CREATE_HELPER::commitZone(), ZONE_CREATE_HELPER::createNewZone(), 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_SETTINGS::getKeyName(), TOOL_MANAGER::InitTools(), TOOL_MANAGER::invokeTool(), and TOOL_MANAGER::RegisterTool().

◆ GetSettings()

TOOL_SETTINGS & TOOL_BASE::GetSettings ( )
inherited

Definition at line 78 of file tool_base.cpp.

79 {
80  return m_toolSettings;
81 }
TOOL_SETTINGS m_toolSettings
Definition: tool_base.h:220

References TOOL_BASE::m_toolSettings.

Referenced by ROUTER_TOOL::Init(), GERBVIEW_SELECTION_TOOL::selectable(), and ROUTER_TOOL::~ROUTER_TOOL().

◆ 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(), and TOOL_MANAGER::runTool().

◆ 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:250
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(), PL_SELECTION_TOOL::ClearSelection(), EE_SELECTION_TOOL::ClearSelection(), 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(), MICROWAVE_TOOL::drawMicrowaveInductor(), PL_DRAWING_TOOLS::DrawShape(), PCB_EDITOR_CONTROL::DrillOrigin(), LIB_EDIT_TOOL::Duplicate(), PAD_TOOL::EnumeratePads(), EE_SELECTION_TOOL::GetNode(), ROUTER_TOOL::getStartLayer(), COMMON_TOOLS::GridPreset(), 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(), CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::MeasureTool(), GERBVIEW_SELECTION_TOOL::MeasureTool(), EDIT_TOOL::MeasureTool(), SCH_EDIT_TOOL::Mirror(), EDIT_TOOL::MoveExact(), SCH_MOVE_TOOL::moveItem(), PL_EDIT_TOOL::moveItem(), 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::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(), COMMON_TOOLS::ToggleGrid(), 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(), PCBNEW_CONTROL::updateGrid(), EE_POINT_EDITOR::updateItem(), PL_POINT_EDITOR::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_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:255

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

Referenced by EE_POINT_EDITOR::addCorner(), addCorner(), EE_POINT_EDITOR::addCornerCondition(), SCH_EDIT_TOOL::BreakWire(), PCB_TOOL_BASE::controls(), COMMON_TOOLS::CursorControl(), SCH_LINE_WIRE_BUS_TOOL::doDrawSegments(), SCH_LINE_WIRE_BUS_TOOL::doUnfoldBus(), COMMON_TOOLS::doZoomToPreset(), DRAWING_TOOL::DrawCircle(), DRAWING_TOOL::DrawLine(), MICROWAVE_TOOL::drawMicrowaveInductor(), 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(), COMMON_TOOLS::GridPreset(), PCB_INSPECTION_TOOL::HighlightNet(), SCH_EDITOR_CONTROL::HighlightNet(), PCB_INSPECTION_TOOL::HighlightNetTool(), MODULE_EDITOR_TOOLS::ImportFootprint(), PL_EDIT_TOOL::Main(), SCH_MOVE_TOOL::Main(), EE_POINT_EDITOR::Main(), PL_POINT_EDITOR::Main(), LIB_MOVE_TOOL::Main(), CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::Main(), PCBNEW_PICKER_TOOL::Main(), PICKER_TOOL::Main(), GERBVIEW_SELECTION_TOOL::Main(), ROUTER_TOOL::MainLoop(), CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::MeasureTool(), GERBVIEW_SELECTION_TOOL::MeasureTool(), EDIT_TOOL::MeasureTool(), EDIT_TOOL::Move(), OnSelectionChange(), LIB_EDIT_TOOL::Paste(), ROUTER_TOOL::performDragging(), 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::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(), 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(), MICROWAVE_TOOL::setTransitions(), ROUTER_TOOL::setTransitions(), CVPCB_FOOTPRINT_VIEWER_CONTROL::setTransitions(), LIB_PIN_TOOL::setTransitions(), PAD_TOOL::setTransitions(), EE_INSPECTION_TOOL::setTransitions(), PL_DRAWING_TOOLS::setTransitions(), COMMON_CONTROL::setTransitions(), LIB_DRAWING_TOOLS::setTransitions(), ZONE_FILLER_TOOL::setTransitions(), EE_POINT_EDITOR::setTransitions(), PL_POINT_EDITOR::setTransitions(), KICAD_MANAGER_CONTROL::setTransitions(), SCH_MOVE_TOOL::setTransitions(), LIB_MOVE_TOOL::setTransitions(), GERBVIEW_CONTROL::setTransitions(), SCH_DRAWING_TOOLS::setTransitions(), GLOBAL_EDIT_TOOL::setTransitions(), setTransitions(), CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::setTransitions(), LIB_CONTROL::setTransitions(), LIB_EDIT_TOOL::setTransitions(), PL_EDITOR_CONTROL::setTransitions(), SCH_EDIT_TOOL::setTransitions(), PL_EDIT_TOOL::setTransitions(), POSITION_RELATIVE_TOOL::setTransitions(), GERBVIEW_SELECTION_TOOL::setTransitions(), COMMON_TOOLS::setTransitions(), PCB_INSPECTION_TOOL::setTransitions(), PCBNEW_CONTROL::setTransitions(), ALIGN_DISTRIBUTE_TOOL::setTransitions(), MODULE_EDITOR_TOOLS::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(), DRAWING_TOOL::setTransitions(), EDIT_TOOL::setTransitions(), SELECTION_TOOL::setTransitions(), SCH_EDITOR_CONTROL::setTransitions(), PL_SELECTION_TOOL::setTransitions(), EE_SELECTION_TOOL::setTransitions(), and DRC::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(), and DRAWING_TOOL::drawSegment().

◆ Init()

bool POINT_EDITOR::Init ( )
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 250 of file point_editor.cpp.

251 {
252  // Find the selection tool, so they can cooperate
254 
255  wxASSERT_MSG( m_selectionTool, _( "pcbnew.InteractiveSelection tool is not available" ) );
256 
257  auto& menu = m_selectionTool->GetToolMenu().GetMenu();
260  std::bind( &POINT_EDITOR::removeCornerCondition, this, _1 ) );
261 
262  return true;
263 }
Class 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:202
static TOOL_ACTION pointEditorRemoveCorner
Removes a corner.
Definition: pcb_actions.h:205
SELECTION_TOOL * m_selectionTool
Selection tool used for obtaining selected items
Definition: point_editor.h:72
#define _(s)
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.

◆ modifiedSelection()

int POINT_EDITOR::modifiedSelection ( const TOOL_EVENT aEvent)
private

Definition at line 1161 of file point_editor.cpp.

1162 {
1163  updatePoints();
1164  return 0;
1165 }
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 288 of file point_editor.cpp.

289 {
290  if( !m_selectionTool )
291  return 0;
292 
294 
295  if( selection.Size() != 1 || selection.Front()->GetEditFlags() )
296  return 0;
297 
298  Activate();
299 
301  KIGFX::VIEW* view = getView();
302  PCB_BASE_EDIT_FRAME* editFrame = getEditFrame<PCB_BASE_EDIT_FRAME>();
303 
304  controls->ShowCursor( true );
305 
306  GRID_HELPER grid( editFrame );
307  BOARD_ITEM* item = static_cast<BOARD_ITEM*>( selection.Front() );
308 
309  if( !item )
310  return 0;
311 
312  m_editPoints = EDIT_POINTS_FACTORY::Make( item, getView()->GetGAL() );
313 
314  if( !m_editPoints )
315  return 0;
316 
317  view->Add( m_editPoints.get() );
318  setEditedPoint( nullptr );
319  updateEditedPoint( aEvent );
320  m_refill = false;
321  bool inDrag = false;
322 
323  BOARD_COMMIT commit( editFrame );
324  LSET snapLayers = item->GetLayerSet();
325 
326  if( item->Type() == PCB_DIMENSION_T )
327  snapLayers = LSET::AllLayersMask();
328 
329  // Main loop: keep receiving events
330  while( TOOL_EVENT* evt = Wait() )
331  {
332  grid.SetSnap( !evt->Modifier( MD_SHIFT ) );
333  grid.SetUseGrid( !evt->Modifier( MD_ALT ) );
334  controls->SetSnapping( !evt->Modifier( MD_ALT ) );
335 
336  if( !m_editPoints || evt->IsSelectionEvent() )
337  break;
338 
339  if ( !inDrag )
340  updateEditedPoint( *evt );
341 
342  if( evt->IsDrag( BUT_LEFT ) && m_editedPoint )
343  {
344  if( !inDrag )
345  {
346  commit.StageItems( selection, CHT_MODIFY );
347 
348  controls->ForceCursorPosition( false );
349  m_original = *m_editedPoint; // Save the original position
350  controls->SetAutoPan( true );
351  inDrag = true;
352  grid.SetAuxAxes( true, m_original.GetPosition() );
353  }
354 
355  //TODO: unify the constraints to solve simultaneously instead of sequentially
356  m_editedPoint->SetPosition( grid.BestSnapAnchor( evt->Position(),
357  snapLayers, { item } ) );
358 
359  // The alternative constraint limits to 45°
360  bool enableAltConstraint = !!evt->Modifier( MD_CTRL );
361 
362  if( enableAltConstraint != (bool) m_altConstraint ) // alternative constraint
363  setAltConstraint( enableAltConstraint );
364 
365  if( m_altConstraint )
366  m_altConstraint->Apply();
367  else
369 
370  m_editedPoint->SetPosition( grid.BestSnapAnchor( m_editedPoint->GetPosition(),
371  snapLayers, { item } ) );
372 
373  updateItem();
374  updatePoints();
375  }
376 
377  else if( inDrag && evt->IsMouseUp( BUT_LEFT ) )
378  {
379  controls->SetAutoPan( false );
380  setAltConstraint( false );
381 
382  commit.Push( _( "Drag a corner" ) );
383  inDrag = false;
384  m_refill = true;
385  }
386 
387  else if( evt->IsCancelInteractive() || evt->IsActivate() )
388  {
389  if( inDrag ) // Restore the last change
390  commit.Revert();
391  else if( evt->IsCancelInteractive() )
392  break;
393 
394  if( evt->IsActivate() && !evt->IsMoveTool() )
395  break;
396  }
397 
398  else
399  evt->SetPassEvent();
400  }
401 
402  if( m_editPoints )
403  {
404  view->Remove( m_editPoints.get() );
405 
406  finishItem();
407  m_editPoints.reset();
408  }
409 
410  frame()->UpdateMsgPanel();
411 
412  return 0;
413 }
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()
Class 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.
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 void Remove(VIEW_ITEM *aItem) override
Function Remove() Removes a VIEW_ITEM from the view.
Definition: pcb_view.cpp:74
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.
Class LSET is a set of PCB_LAYER_IDs.
const PCBNEW_SELECTION & selection() const
virtual VECTOR2I GetPosition() const
Function GetPosition()
Definition: edit_points.h:68
STATUS_FLAGS GetEditFlags() const
Definition: base_struct.h:270
Class 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
Class VIEW_CONTROLS is an interface for classes handling user events controlling the view behaviour (...
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:713
SELECTION_TOOL * m_selectionTool
Selection tool used for obtaining selected items
Definition: point_editor.h:72
class DIMENSION, a dimension (graphic item)
Definition: typeinfo.h:99
#define _(s)
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.
int Size() const
Returns the number of selected parts.
Definition: selection.h:125
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
Class VIEW.
Definition: view.h:61
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.
virtual void ApplyConstraint()
Function ApplyConstraint()
Definition: edit_points.h:173
virtual LSET GetLayerSet() const
Function GetLayerSet returns a "layer mask", which is a bitmap of all layers on which the TRACK segme...
EDA_ITEM * Front() const
Definition: selection.h:182
KICAD_T Type() const
Function Type()
Definition: base_struct.h:210
virtual void UpdateMsgPanel()
Redraw the message panel.
static std::shared_ptr< EDIT_POINTS > Make(EDA_ITEM *aItem, KIGFX::GAL *aGal)
virtual void SetPosition(const VECTOR2I &aPosition)
Function SetPosition()
Definition: edit_points.h:105

References _, TOOL_INTERACTIVE::Activate(), KIGFX::PCB_VIEW::Add(), LSET::AllLayersMask(), EDIT_POINT::ApplyConstraint(), GRID_HELPER::BestSnapAnchor(), BUT_LEFT, CHT_MODIFY, PCB_TOOL_BASE::controls(), finishItem(), KIGFX::VIEW_CONTROLS::ForceCursorPosition(), PCB_TOOL_BASE::frame(), SELECTION::Front(), EDA_ITEM::GetEditFlags(), BOARD_ITEM::GetLayerSet(), EDIT_POINT::GetPosition(), SELECTION_TOOL::GetSelection(), TOOL_BASE::getView(), TOOL_BASE::getViewControls(), m_altConstraint, m_editedPoint, m_editPoints, m_original, m_refill, m_selectionTool, 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(), setAltConstraint(), KIGFX::VIEW_CONTROLS::SetAutoPan(), GRID_HELPER::SetAuxAxes(), setEditedPoint(), EDIT_POINT::SetPosition(), GRID_HELPER::SetSnap(), KIGFX::VIEW_CONTROLS::SetSnapping(), GRID_HELPER::SetUseGrid(), KIGFX::VIEW_CONTROLS::ShowCursor(), SELECTION::Size(), COMMIT::StageItems(), EDA_ITEM::Type(), 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 1085 of file point_editor.cpp.

1086 {
1087  if( !m_editPoints || !m_editedPoint )
1088  return 0;
1089 
1090  EDA_ITEM* item = m_editPoints->GetParent();
1091 
1092  if( !item )
1093  return 0;
1094 
1095  SHAPE_POLY_SET* polygon = nullptr;
1096 
1097  if( item->Type() == PCB_ZONE_AREA_T || item->Type() == PCB_MODULE_ZONE_AREA_T )
1098  {
1099  auto zone = static_cast<ZONE_CONTAINER*>( item );
1100  polygon = zone->Outline();
1101  zone->SetNeedRefill( true );
1102  }
1103  else if( (item->Type() == PCB_MODULE_EDGE_T ) || ( item->Type() == PCB_LINE_T ) )
1104  {
1105  auto ds = static_cast<DRAWSEGMENT*>( item );
1106 
1107  if( ds->GetShape() == S_POLYGON )
1108  polygon = &ds->GetPolyShape();
1109  }
1110 
1111  if( !polygon )
1112  return 0;
1113 
1114  PCB_BASE_FRAME* frame = getEditFrame<PCB_BASE_FRAME>();
1115  BOARD_COMMIT commit( frame );
1116  auto vertex = findVertex( *polygon, *m_editedPoint );
1117 
1118  if( vertex.first )
1119  {
1120  const auto& vertexIdx = vertex.second;
1121  auto& outline = polygon->Polygon( vertexIdx.m_polygon )[vertexIdx.m_contour];
1122 
1123  if( outline.PointCount() > 3 )
1124  {
1125  // the usual case: remove just the corner when there are >3 vertices
1126  commit.Modify( item );
1127  polygon->RemoveVertex( vertexIdx );
1128  validatePolygon( *polygon );
1129  }
1130  else
1131  {
1132  // either remove a hole or the polygon when there are <= 3 corners
1133  if( vertexIdx.m_contour > 0 )
1134  {
1135  // remove hole
1136  commit.Modify( item );
1137  polygon->RemoveContour( vertexIdx.m_contour );
1138  }
1139  else
1140  {
1142  commit.Remove( item );
1143  }
1144  }
1145 
1146  setEditedPoint( nullptr );
1147 
1148  commit.Push( _( "Remove a zone/polygon corner" ) );
1149 
1150  // Refresh zone hatching
1151  if( item->Type() == PCB_ZONE_AREA_T || item->Type() == PCB_MODULE_ZONE_AREA_T )
1152  static_cast<ZONE_CONTAINER*>( item )->Hatch();
1153 
1154  updatePoints();
1155  }
1156 
1157  return 0;
1158 }
static TOOL_ACTION selectionClear
Clears the current selection.
Definition: pcb_actions.h:73
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:101
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Function RunAction() Runs the specified action.
Definition: tool_manager.h:109
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 SHAPE_POLY_SET.
SHAPE_LINE_CHAIN & Outline(int aIndex)
Returns the reference to aIndex-th outline in the set
#define _(s)
bool validatePolygon(SHAPE_POLY_SET &aModified) const
Validates a polygon and displays a popup warning if invalid.
void RemoveVertex(int aGlobalIndex)
Function RemoveVertex deletes the aGlobalIndex-th vertex.
Class EDA_ITEM is a base class for most all the KiCad significant classes, used in schematics and boa...
Definition: base_struct.h:163
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.
class 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:210
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 913 of file point_editor.cpp.

914 {
915  if( !m_editPoints || !m_editedPoint )
916  return false;
917 
918  EDA_ITEM* item = m_editPoints->GetParent();
919 
920  if( !item || !( item->Type() == PCB_ZONE_AREA_T || item->Type() == PCB_MODULE_ZONE_AREA_T ||
921  ( ( item->Type() == PCB_MODULE_EDGE_T || item->Type() == PCB_LINE_T ) &&
922  static_cast<DRAWSEGMENT*>( item )->GetShape() == S_POLYGON ) ) )
923  return false;
924 
925  SHAPE_POLY_SET *polyset;
926 
927  if( item->Type() == PCB_ZONE_AREA_T || item->Type() == PCB_MODULE_ZONE_AREA_T )
928  polyset = static_cast<ZONE_CONTAINER*>( item )->Outline();
929  else
930  polyset = &static_cast<DRAWSEGMENT*>( item )->GetPolyShape();
931 
932  auto vertex = findVertex( *polyset, *m_editedPoint );
933 
934  if( !vertex.first )
935  return false;
936 
937  const auto& vertexIdx = vertex.second;
938 
939  // Check if there are enough vertices so one can be removed without
940  // degenerating the polygon.
941  // The first condition allows one to remove all corners from holes (when
942  // there are only 2 vertices left, a hole is removed).
943  if( vertexIdx.m_contour == 0 && polyset->Polygon( vertexIdx.m_polygon )[vertexIdx.m_contour].PointCount() <= 3 )
944  return false;
945 
946  // Remove corner does not work with lines
947  if( dynamic_cast<EDIT_LINE*>( m_editedPoint ) )
948  return false;
949 
950  return m_editedPoint != NULL;
951 }
polygon (not yet used for tracks, but could be in microwave apps)
class ZONE_CONTAINER, a zone area
Definition: typeinfo.h:101
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
Class SHAPE_POLY_SET.
SHAPE_LINE_CHAIN & Outline(int aIndex)
Returns the reference to aIndex-th outline in the set
Class EDA_ITEM is a base class for most all the KiCad significant classes, used in schematics and boa...
Definition: base_struct.h:163
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:210

References findVertex(), m_editedPoint, m_editPoints, 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 237 of file point_editor.cpp.

238 {
239  m_refill = false;
240  m_editPoints.reset();
241  m_altConstraint.reset();
242  getViewControls()->SetAutoPan( false );
243 
244  m_statusPopup = std::make_unique<STATUS_TEXT_POPUP>( getEditFrame<PCB_BASE_EDIT_FRAME>() );
245  m_statusPopup->SetTextColor( wxColour( 255, 0, 0 ) );
246  m_statusPopup->SetText( _( "Self-intersecting polygons are not allowed." ) );
247 }
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
#define _(s)
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 * 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 269 of file pcb_tool_base.cpp.

270 {
271  auto selTool = m_toolMgr->GetTool<SELECTION_TOOL>();
272  const auto& selection = selTool->GetSelection();
273  return selection;
274 }
Class 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(), MODULE_EDITOR_TOOLS::CreatePadFromShapes(), PCB_INSPECTION_TOOL::CrossProbePcbToSch(), PCB_TOOL_BASE::doInteractiveItemPlacement(), DRAWING_TOOL::drawArc(), DRAWING_TOOL::DrawDimension(), MICROWAVE_TOOL::drawMicrowaveInductor(), DRAWING_TOOL::drawSegment(), DRAWING_TOOL::DrawZone(), EDIT_TOOL::Duplicate(), EDIT_TOOL::EditFpInFpEditor(), PAD_TOOL::EnumeratePads(), GLOBAL_EDIT_TOOL::ExchangeFootprints(), MODULE_EDITOR_TOOLS::ExplodePadToShapes(), 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::Move(), 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(), 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 277 of file pcb_tool_base.cpp.

278 {
279  auto selTool = m_toolMgr->GetTool<SELECTION_TOOL>();
280  auto& selection = selTool->GetSelection();
281  return selection;
282 }
Class 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 796 of file point_editor.cpp.

797 {
798  if( aEnabled )
799  {
800  EDIT_LINE* line = dynamic_cast<EDIT_LINE*>( m_editedPoint );
801 
802  if( line &&
803  ( m_editPoints->GetParent()->Type() == PCB_ZONE_AREA_T
804  || m_editPoints->GetParent()->Type() == PCB_MODULE_ZONE_AREA_T ) )
805  {
807  }
808  else
809  {
810  // Find a proper constraining point for 45 degrees mode
813  }
814  }
815  else
816  {
817  m_altConstraint.reset();
818  }
819 }
Class EC_CONVERGING.
Class EDIT_LINE.
Definition: edit_points.h:207
class ZONE_CONTAINER, a zone area
Definition: typeinfo.h:101
Class 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 774 of file point_editor.cpp.

775 {
777 
778  if( aPoint )
779  {
780  frame()->GetCanvas()->SetCurrentCursor( wxCURSOR_ARROW );
781  controls->ForceCursorPosition( true, aPoint->GetPosition() );
782  controls->ShowCursor( true );
783  }
784  else
785  {
786  if( frame()->ToolStackIsEmpty() )
787  controls->ShowCursor( false );
788 
789  controls->ForceCursorPosition( false );
790  }
791 
792  m_editedPoint = aPoint;
793 }
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:68
Class VIEW_CONTROLS is an interface for classes handling user events controlling the view behaviour (...
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 97 of file pcb_tool_base.h.

98  {
99  m_editModules = aEnabled;
100  }

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 1168 of file point_editor.cpp.

1169 {
1176 }
int OnSelectionChange(const TOOL_EVENT &aEvent)
Function OnSelected()
static const TOOL_EVENT SelectedEvent
Definition: actions.h:197
static TOOL_ACTION activatePointEditor
Definition: actions.h:159
static const TOOL_EVENT UnselectedEvent
Definition: actions.h:198
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:201
static TOOL_ACTION pointEditorAddCorner
Break outline (insert additional points to an edge)
Definition: pcb_actions.h:202
static TOOL_ACTION pointEditorRemoveCorner
Removes a corner.
Definition: pcb_actions.h:205
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 266 of file point_editor.cpp.

267 {
268  EDIT_POINT* point;
269 
270  if( aEvent.IsMotion() )
271  {
272  point = m_editPoints->FindPoint( aEvent.Position(), getView() );
273  }
274  else if( aEvent.IsDrag( BUT_LEFT ) )
275  {
276  point = m_editPoints->FindPoint( aEvent.DragOrigin(), getView() );
277  }
278  else
279  {
280  point = m_editPoints->FindPoint( getViewControls()->GetCursorPosition(), getView() );
281  }
282 
283  if( m_editedPoint != point )
284  setEditedPoint( point );
285 }
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
Class 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 416 of file point_editor.cpp.

417 {
418  EDA_ITEM* item = m_editPoints->GetParent();
419 
420  const BOARD_DESIGN_SETTINGS& boardSettings = board()->GetDesignSettings();
421 
422  if( !item )
423  return;
424 
425  switch( item->Type() )
426  {
427  case PCB_LINE_T:
428  case PCB_MODULE_EDGE_T:
429  {
430  DRAWSEGMENT* segment = static_cast<DRAWSEGMENT*>( item );
431  switch( segment->GetShape() )
432  {
433  case S_SEGMENT:
434  if( isModified( m_editPoints->Point( SEG_START ) ) )
435  segment->SetStart( wxPoint( m_editPoints->Point( SEG_START ).GetPosition().x,
436  m_editPoints->Point( SEG_START ).GetPosition().y ) );
437 
438  else if( isModified( m_editPoints->Point( SEG_END ) ) )
439  segment->SetEnd( wxPoint( m_editPoints->Point( SEG_END ).GetPosition().x,
440  m_editPoints->Point( SEG_END ).GetPosition().y ) );
441 
442  break;
443 
444  case S_ARC:
445  {
446  VECTOR2I center = m_editPoints->Point( ARC_CENTER ).GetPosition();
447  VECTOR2I mid = m_editPoints->Point( ARC_MID ).GetPosition();
448  VECTOR2I start = m_editPoints->Point( ARC_START ).GetPosition();
449  VECTOR2I end = m_editPoints->Point( ARC_END ).GetPosition();
450 
451  if( center != segment->GetCenter() )
452  {
453  wxPoint moveVector = wxPoint( center.x, center.y ) - segment->GetCenter();
454  segment->Move( moveVector );
455 
456  m_editPoints->Point( ARC_START ).SetPosition( segment->GetArcStart() );
457  m_editPoints->Point( ARC_END ).SetPosition( segment->GetArcEnd() );
458  m_editPoints->Point( ARC_MID ).SetPosition( segment->GetArcMid() );
459  }
460  else
461  {
462  if( mid != segment->GetArcMid() )
463  {
464  center = GetArcCenter( start, mid, end );
465  segment->SetCenter( wxPoint( center.x, center.y ) );
466  m_editPoints->Point( ARC_CENTER ).SetPosition( center );
467  }
468 
469  segment->SetArcStart( wxPoint( start.x, start.y ) );
470 
471  VECTOR2D startLine = start - center;
472  VECTOR2D endLine = end - center;
473  double newAngle = RAD2DECIDEG( endLine.Angle() - startLine.Angle() );
474 
475  // Adjust the new angle to (counter)clockwise setting
476  bool clockwise = ( segment->GetAngle() > 0 );
477 
478  if( clockwise && newAngle < 0.0 )
479  newAngle += 3600.0;
480  else if( !clockwise && newAngle > 0.0 )
481  newAngle -= 3600.0;
482 
483  segment->SetAngle( newAngle );
484  }
485 
486  break;
487  }
488 
489  case S_CIRCLE:
490  {
491  const VECTOR2I& center = m_editPoints->Point( CIRC_CENTER ).GetPosition();
492  const VECTOR2I& end = m_editPoints->Point( CIRC_END ).GetPosition();
493 
494  if( isModified( m_editPoints->Point( CIRC_CENTER ) ) )
495  {
496  wxPoint moveVector = wxPoint( center.x, center.y ) - segment->GetCenter();
497  segment->Move( moveVector );
498  }
499  else
500  {
501  segment->SetEnd( wxPoint( end.x, end.y ) );
502  }
503 
504  break;
505  }
506 
507  case S_POLYGON:
508  {
509  SHAPE_POLY_SET& outline = segment->GetPolyShape();
510 
511  for( int i = 0; i < outline.TotalVertices(); ++i )
512  outline.SetVertex( i, m_editPoints->Point( i ).GetPosition() );
513 
514  validatePolygon( outline );
515  break;
516  }
517 
518  case S_CURVE:
519  if( isModified( m_editPoints->Point( BEZIER_CURVE_START ) ) )
520  segment->SetStart( wxPoint( m_editPoints->Point( BEZIER_CURVE_START ).GetPosition().x,
521  m_editPoints->Point( BEZIER_CURVE_START ).GetPosition().y ) );
522  else if( isModified( m_editPoints->Point( BEZIER_CURVE_CONTROL_POINT1 ) ) )
523  segment->SetBezControl1( wxPoint( m_editPoints->Point( BEZIER_CURVE_CONTROL_POINT1 ).GetPosition().x,
524  m_editPoints->Point( BEZIER_CURVE_CONTROL_POINT1 ).GetPosition().y ) );
525  else if( isModified( m_editPoints->Point( BEZIER_CURVE_CONTROL_POINT2 ) ) )
526  segment->SetBezControl2( wxPoint( m_editPoints->Point( BEZIER_CURVE_CONTROL_POINT2 ).GetPosition().x,
527  m_editPoints->Point( BEZIER_CURVE_CONTROL_POINT2 ).GetPosition().y ) );
528  else if( isModified( m_editPoints->Point( BEZIER_CURVE_END ) ) )
529  segment->SetEnd( wxPoint( m_editPoints->Point( BEZIER_CURVE_END ).GetPosition().x,
530  m_editPoints->Point( BEZIER_CURVE_END ).GetPosition().y ) );
531 
532  segment->RebuildBezierToSegmentsPointsList( segment->GetWidth() );
533  break;
534 
535  default: // suppress warnings
536  break;
537  }
538 
539  // Update relative coordinates for module edges
540  if( EDGE_MODULE* edge = dyn_cast<EDGE_MODULE*>( item ) )
541  edge->SetLocalCoord();
542 
543  break;
544  }
545 
547  case PCB_ZONE_AREA_T:
548  {
549  ZONE_CONTAINER* zone = static_cast<ZONE_CONTAINER*>( item );
550  zone->ClearFilledPolysList();
551  SHAPE_POLY_SET& outline = *zone->Outline();
552 
553  for( int i = 0; i < outline.TotalVertices(); ++i )
554  {
555  if( outline.CVertex( i ) != m_editPoints->Point( i ).GetPosition() )
556  zone->SetNeedRefill( true );
557 
558  outline.SetVertex( i, m_editPoints->Point( i ).GetPosition() );
559  }
560 
561  validatePolygon( outline );
562  zone->Hatch();
563  break;
564  }
565 
566  case PCB_DIMENSION_T:
567  {
568  DIMENSION* dimension = static_cast<DIMENSION*>( item );
569 
570  // Check which point is currently modified and updated dimension's points respectively
571  if( isModified( m_editPoints->Point( DIM_CROSSBARO ) ) )
572  {
573  VECTOR2D featureLine( m_editedPoint->GetPosition() - dimension->GetOrigin() );
574  VECTOR2D crossBar( dimension->GetEnd() - dimension->GetOrigin() );
575 
576  if( featureLine.Cross( crossBar ) > 0 )
577  dimension->SetHeight( -featureLine.EuclideanNorm(), boardSettings.m_DimensionPrecision );
578  else
579  dimension->SetHeight( featureLine.EuclideanNorm(), boardSettings.m_DimensionPrecision );
580  }
581 
582  else if( isModified( m_editPoints->Point( DIM_CROSSBARF ) ) )
583  {
584  VECTOR2D featureLine( m_editedPoint->GetPosition() - dimension->GetEnd() );
585  VECTOR2D crossBar( dimension->GetEnd() - dimension->GetOrigin() );
586 
587  if( featureLine.Cross( crossBar ) > 0 )
588  dimension->SetHeight( -featureLine.EuclideanNorm(), boardSettings.m_DimensionPrecision );
589  else
590  dimension->SetHeight( featureLine.EuclideanNorm(), boardSettings.m_DimensionPrecision );
591  }
592 
593  else if( isModified( m_editPoints->Point( DIM_FEATUREGO ) ) )
594  {
595  dimension->SetOrigin( wxPoint( m_editedPoint->GetPosition().x, m_editedPoint->GetPosition().y ),
596  boardSettings.m_DimensionPrecision );
597  m_editPoints->Point( DIM_CROSSBARO ).SetConstraint( new EC_LINE( m_editPoints->Point( DIM_CROSSBARO ),
598  m_editPoints->Point( DIM_FEATUREGO ) ) );
599  m_editPoints->Point( DIM_CROSSBARF ).SetConstraint( new EC_LINE( m_editPoints->Point( DIM_CROSSBARF ),
600  m_editPoints->Point( DIM_FEATUREDO ) ) );
601  }
602 
603  else if( isModified( m_editPoints->Point( DIM_FEATUREDO ) ) )
604  {
605  dimension->SetEnd( wxPoint( m_editedPoint->GetPosition().x, m_editedPoint->GetPosition().y ) ,
606  boardSettings.m_DimensionPrecision );
607  m_editPoints->Point( DIM_CROSSBARO ).SetConstraint( new EC_LINE( m_editPoints->Point( DIM_CROSSBARO ),
608  m_editPoints->Point( DIM_FEATUREGO ) ) );
609  m_editPoints->Point( DIM_CROSSBARF ).SetConstraint( new EC_LINE( m_editPoints->Point( DIM_CROSSBARF ),
610  m_editPoints->Point( DIM_FEATUREDO ) ) );
611  }
612 
613  break;
614  }
615 
616  default:
617  break;
618  }
619 
620  if( frame() )
621  frame()->SetMsgPanel( item );
622 }
const wxPoint GetArcMid() const
int TotalVertices() const
Returns total number of vertices stored in the set.
Class ZONE_CONTAINER handles a list of polygons defining a copper zone.
Definition: class_zone.h:60
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.
const wxPoint GetCenter() const override
Function GetCenter()
STROKE_T GetShape() const
const wxPoint GetArcEnd() 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)
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:101
SHAPE_POLY_SET * Outline()
Definition: class_zone.h:246
double RAD2DECIDEG(double rad)
Definition: trigo.h:215
void SetHeight(int aHeight, int aPrecision)
Function SetHeight Sets the length of feature lines.
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Function GetDesignSettings.
Definition: class_board.h:531
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
void SetCenter(const wxPoint &aCenterPoint)
For arcs and circles:
class EDGE_MODULE, a footprint edge
Definition: typeinfo.h:94
void SetBezControl2(const wxPoint &aPoint)
Class EC_LINE.
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
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:68
const wxPoint & GetEnd()
Function GetEnd.
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.
Class SHAPE_POLY_SET.
Arcs (with rounded ends)
const wxPoint & GetArcStart() const
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:306
class DIMENSION, a dimension (graphic item)
Definition: typeinfo.h:99
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.
size_t i
Definition: json11.cpp:649
void Hatch()
Function Hatch computes the hatch lines depending on the hatch parameters and stores it in the zone's...
Definition: class_zone.cpp:987
Class EDA_ITEM is a base class for most all the KiCad significant classes, used in schematics and boa...
Definition: base_struct.h:163
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.
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
const VECTOR2I GetArcCenter(const VECTOR2I &aStart, const VECTOR2I &aMid, const VECTOR2I &aEnd)
Determine the center of an arc/circle, given three points on its circumference.
Definition: trigo.cpp:339
Class DIMENSION.
void ClearFilledPolysList()
Function ClearFilledPolysList clears the list of filled polygons.
Definition: class_zone.h:542
KICAD_T Type() const
Function Type()
Definition: base_struct.h:210
Class BOARD_DESIGN_SETTINGS contains design settings for a BOARD object.
void SetBezControl1(const wxPoint &aPoint)
void SetNeedRefill(bool aNeedRefill)
Definition: class_zone.h:177

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, PCB_TOOL_BASE::frame(), DRAWSEGMENT::GetAngle(), GetArcCenter(), DRAWSEGMENT::GetArcEnd(), DRAWSEGMENT::GetArcMid(), DRAWSEGMENT::GetArcStart(), DRAWSEGMENT::GetCenter(), BOARD::GetDesignSettings(), DIMENSION::GetEnd(), DIMENSION::GetOrigin(), DRAWSEGMENT::GetPolyShape(), EDIT_POINT::GetPosition(), DRAWSEGMENT::GetShape(), DRAWSEGMENT::GetWidth(), ZONE_CONTAINER::Hatch(), i, isModified(), BOARD_DESIGN_SETTINGS::m_DimensionPrecision, m_editedPoint, m_editPoints, DRAWSEGMENT::Move(), ZONE_CONTAINER::Outline(), PCB_DIMENSION_T, PCB_LINE_T, PCB_MODULE_EDGE_T, PCB_MODULE_ZONE_AREA_T, PCB_ZONE_AREA_T, RAD2DECIDEG(), DRAWSEGMENT::RebuildBezierToSegmentsPointsList(), S_ARC, S_CIRCLE, S_CURVE, S_POLYGON, S_SEGMENT, SEG_END, SEG_START, DRAWSEGMENT::SetAngle(), DRAWSEGMENT::SetArcStart(), DRAWSEGMENT::SetBezControl1(), DRAWSEGMENT::SetBezControl2(), DRAWSEGMENT::SetCenter(), DRAWSEGMENT::SetEnd(), DIMENSION::SetEnd(), DIMENSION::SetHeight(), EDA_DRAW_FRAME::SetMsgPanel(), ZONE_CONTAINER::SetNeedRefill(), DIMENSION::SetOrigin(), DRAWSEGMENT::SetStart(), SHAPE_POLY_SET::SetVertex(), SHAPE_POLY_SET::TotalVertices(), EDA_ITEM::Type(), validatePolygon(), VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by OnSelectionChange().

◆ updatePoints()

void POINT_EDITOR::updatePoints ( )
private

Updates edit points with item's points.

Definition at line 664 of file point_editor.cpp.

665 {
666  if( !m_editPoints )
667  return;
668 
669  EDA_ITEM* item = m_editPoints->GetParent();
670 
671  if( !item )
672  return;
673 
674  switch( item->Type() )
675  {
676  case PCB_LINE_T:
677  case PCB_MODULE_EDGE_T:
678  {
679  const DRAWSEGMENT* segment = static_cast<const DRAWSEGMENT*>( item );
680 
681  switch( segment->GetShape() )
682  {
683  case S_SEGMENT:
684  m_editPoints->Point( SEG_START ).SetPosition( segment->GetStart() );
685  m_editPoints->Point( SEG_END ).SetPosition( segment->GetEnd() );
686  break;
687 
688  case S_ARC:
689  m_editPoints->Point( ARC_CENTER ).SetPosition( segment->GetCenter() );
690  m_editPoints->Point( ARC_START ).SetPosition( segment->GetArcStart() );
691  m_editPoints->Point( ARC_MID ).SetPosition( segment->GetArcMid() );
692  m_editPoints->Point( ARC_END ).SetPosition( segment->GetArcEnd() );
693  break;
694 
695  case S_CIRCLE:
696  m_editPoints->Point( CIRC_CENTER ).SetPosition( segment->GetCenter() );
697  m_editPoints->Point( CIRC_END ).SetPosition( segment->GetEnd() );
698  break;
699 
700  case S_POLYGON:
701  {
702  const auto& points = segment->BuildPolyPointsList();
703 
704  if( m_editPoints->PointsSize() != (unsigned) points.size() )
705  {
706  getView()->Remove( m_editPoints.get() );
707  m_editedPoint = nullptr;
708  m_editPoints = EDIT_POINTS_FACTORY::Make( item, getView()->GetGAL() );
709  getView()->Add( m_editPoints.get() );
710  }
711  else
712  {
713  for( unsigned i = 0; i < points.size(); i++ )
714  m_editPoints->Point( i ).SetPosition( points[i] );
715  }
716  break;
717  }
718 
719  case S_CURVE:
720  m_editPoints->Point( BEZIER_CURVE_START ).SetPosition( segment->GetStart() );
721  m_editPoints->Point( BEZIER_CURVE_CONTROL_POINT1 ).SetPosition( segment->GetBezControl1() );
722  m_editPoints->Point( BEZIER_CURVE_CONTROL_POINT2 ).SetPosition( segment->GetBezControl2() );
723  m_editPoints->Point( BEZIER_CURVE_END ).SetPosition( segment->GetEnd() );
724  break;
725 
726  default: // suppress warnings
727  break;
728  }
729 
730  break;
731  }
732 
734  case PCB_ZONE_AREA_T:
735  {
736  ZONE_CONTAINER* zone = static_cast<ZONE_CONTAINER*>( item );
737  const SHAPE_POLY_SET* outline = zone->Outline();
738 
739  if( m_editPoints->PointsSize() != (unsigned) outline->TotalVertices() )
740  {
741  getView()->Remove( m_editPoints.get() );
742  m_editedPoint = nullptr;
743  m_editPoints = EDIT_POINTS_FACTORY::Make( item, getView()->GetGAL() );
744  getView()->Add( m_editPoints.get() );
745  }
746  else
747  {
748  for( int i = 0; i < outline->TotalVertices(); ++i )
749  m_editPoints->Point( i ).SetPosition( outline->CVertex( i ) );
750  }
751 
752  break;
753  }
754 
755  case PCB_DIMENSION_T:
756  {
757  const DIMENSION* dimension = static_cast<const DIMENSION*>( item );
758 
759  m_editPoints->Point( DIM_CROSSBARO ).SetPosition( dimension->m_crossBarO );
760  m_editPoints->Point( DIM_CROSSBARF ).SetPosition( dimension->m_crossBarF );
761  m_editPoints->Point( DIM_FEATUREGO ).SetPosition( dimension->m_featureLineGO );
762  m_editPoints->Point( DIM_FEATUREDO ).SetPosition( dimension->m_featureLineDO );
763  break;
764  }
765 
766  default:
767  break;
768  }
769 
770  getView()->Update( m_editPoints.get() );
771 }
const wxPoint GetArcMid() const
int TotalVertices() const
Returns total number of vertices stored in the set.
Class ZONE_CONTAINER handles a list of polygons defining a copper zone.
Definition: class_zone.h:60
wxPoint m_crossBarF
const wxPoint GetCenter() const override
Function GetCenter()
STROKE_T GetShape() const
const wxPoint GetArcEnd() 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:101
virtual void Remove(VIEW_ITEM *aItem)
Function Remove() Removes a VIEW_ITEM from the view.
Definition: view.cpp:376
SHAPE_POLY_SET * Outline()
Definition: class_zone.h:246
usual segment : line with rounded ends
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
Class SHAPE_POLY_SET.
Arcs (with rounded ends)
const wxPoint & GetArcStart() const
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:1540
class DIMENSION, a dimension (graphic item)
Definition: typeinfo.h:99
KIGFX::VIEW * getView() const
Function getView()
Definition: tool_base.cpp:36
size_t i
Definition: json11.cpp:649
const wxPoint & GetBezControl2() const
Class EDA_ITEM is a base class for most all the KiCad significant classes, used in schematics and boa...
Definition: base_struct.h:163
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:346
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
wxPoint m_featureLineDO
Class DIMENSION.
KICAD_T Type() const
Function Type()
Definition: base_struct.h:210
static std::shared_ptr< EDIT_POINTS > Make(EDA_ITEM *aItem, KIGFX::GAL *aGal)

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(), DRAWSEGMENT::GetShape(), DRAWSEGMENT::GetStart(), TOOL_BASE::getView(), i, DIMENSION::m_crossBarF, DIMENSION::m_crossBarO, m_editedPoint, m_editPoints, DIMENSION::m_featureLineDO, DIMENSION::m_featureLineGO, EDIT_POINTS_FACTORY::Make(), ZONE_CONTAINER::Outline(), PCB_DIMENSION_T, PCB_LINE_T, PCB_MODULE_EDGE_T, PCB_MODULE_ZONE_AREA_T, PCB_ZONE_AREA_T, KIGFX::VIEW::Remove(), S_ARC, S_CIRCLE, S_CURVE, S_POLYGON, S_SEGMENT, SEG_END, SEG_START, SHAPE_POLY_SET::TotalVertices(), EDA_ITEM::Type(), and KIGFX::VIEW::Update().

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 642 of file point_editor.cpp.

643 {
644  bool valid = !aPoly.IsSelfIntersecting();
645 
646  if( m_statusPopup )
647  {
648  if( valid )
649  {
650  m_statusPopup->Hide();
651  }
652  else
653  {
654  wxPoint p = wxGetMousePosition() + wxPoint( 20, 20 );
655  m_statusPopup->Move( p );
656  m_statusPopup->PopupFor( 1500 );
657  }
658  }
659 
660  return valid;
661 }
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(), 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(), SCH_MOVE_TOOL::Main(), EE_POINT_EDITOR::Main(), PL_POINT_EDITOR::Main(), LIB_MOVE_TOOL::Main(), CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::Main(), PCBNEW_PICKER_TOOL::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(), CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::MeasureTool(), GERBVIEW_SELECTION_TOOL::MeasureTool(), EDIT_TOOL::MeasureTool(), EDIT_TOOL::Move(), OnSelectionChange(), ROUTER_TOOL::performDragging(), ROUTER_TOOL::performRouting(), LENGTH_TUNER_TOOL::performTuning(), EDIT_TOOL::pickCopyReferencePoint(), 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(), PL_EDIT_TOOL::Init(), SCH_EDIT_TOOL::Init(), CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::Init(), LIB_DRAWING_TOOLS::Init(), MODULE_EDITOR_TOOLS::Init(), PL_DRAWING_TOOLS::Init(), LIB_CONTROL::Init(), PCB_EDITOR_CONTROL::Init(), SCH_DRAWING_TOOLS::Init(), GERBVIEW_SELECTION_TOOL::Init(), DRAWING_TOOL::Init(), PL_SELECTION_TOOL::Init(), EE_SELECTION_TOOL::Init(), EE_TOOL_BASE< SCH_BASE_FRAME >::Init(), SELECTION_TOOL::Init(), EDIT_TOOL::Init(), SCH_LINE_WIRE_BUS_TOOL::Init(), PCB_TOOL_BASE::Init(), PL_EDIT_TOOL::Main(), SCH_MOVE_TOOL::Main(), LIB_MOVE_TOOL::Main(), CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::Main(), PCBNEW_PICKER_TOOL::Main(), PICKER_TOOL::Main(), GERBVIEW_SELECTION_TOOL::Main(), PL_SELECTION_TOOL::Main(), EE_SELECTION_TOOL::Main(), SELECTION_TOOL::Main(), CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::MeasureTool(), GERBVIEW_SELECTION_TOOL::MeasureTool(), EDIT_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(), CVPCB_ASSOCIATION_TOOL::Associate(), TOOL_BASE::attachManager(), PCB_INSPECTION_TOOL::calculateSelectionRatsnest(), ROUTER_TOOL::CanInlineDrag(), EDIT_TOOL::ChangeTrackWidth(), 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(), MODULE_EDITOR_TOOLS::CreatePadFromShapes(), PCB_INSPECTION_TOOL::CrossProbePcbToSch(), COMMON_TOOLS::CursorControl(), ROUTER_TOOL::CustomTrackWidthDialog(), 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_TOOL_BASE::doInteractiveItemPlacement(), SCH_LINE_WIRE_BUS_TOOL::doUnfoldBus(), DRAWING_TOOL::DrawArc(), DRAWING_TOOL::drawArc(), DRAWING_TOOL::DrawCircle(), DRAWING_TOOL::DrawDimension(), 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::editComponentFieldText(), EDIT_TOOL::EditFpInFpEditor(), LIB_EDIT_TOOL::editSymbolProperties(), SCH_EDITOR_CONTROL::EditWithLibEdit(), SCH_EDITOR_CONTROL::EnterSheet(), PAD_TOOL::EnumeratePads(), GLOBAL_EDIT_TOOL::ExchangeFootprints(), SELECTION_TOOL::expandConnection(), MODULE_EDITOR_TOOLS::ExplodePadToShapes(), 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::getEditFrameInt(), TOOL_BASE::GetManager(), TOOL_BASE::getModelInt(), DRAWING_TOOL::getSourceZoneForAction(), TOOL_BASE::getView(), TOOL_BASE::getViewControls(), TOOL_INTERACTIVE::goInternal(), 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(), MODULE_EDITOR_TOOLS::ImportFootprint(), PL_EDIT_TOOL::ImportWorksheetContent(), LIB_EDIT_TOOL::Init(), SCH_EDIT_TOOL::Init(), PL_EDIT_TOOL::Init(), PAD_TOOL::Init(), GLOBAL_EDIT_TOOL::Init(), ALIGN_DISTRIBUTE_TOOL::Init(), LIB_CONTROL::Init(), PL_DRAWING_TOOLS::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(), TOOL_BASE::IsToolActive(), SCH_EDITOR_CONTROL::LeaveSheet(), COMMON_CONTROL::ListHotKeys(), PCB_INSPECTION_TOOL::LocalRatsnestTool(), PL_EDIT_TOOL::Main(), SCH_MOVE_TOOL::Main(), CVPCB_CONTROL::Main(), LIB_MOVE_TOOL::Main(), PL_SELECTION_TOOL::Main(), EE_SELECTION_TOOL::Main(), SELECTION_TOOL::Main(), ROUTER_TOOL::MainLoop(), LENGTH_TUNER_TOOL::MainLoop(), LIB_EDIT_TOOL::Mirror(), SCH_EDIT_TOOL::Mirror(), EDIT_TOOL::Mirror(), PCB_EDITOR_CONTROL::modifyLockSelected(), EDIT_TOOL::Move(), EDIT_TOOL::MoveExact(), LIB_CONTROL::OnDeMorgan(), LIB_EDIT_TOOL::Paste(), PL_EDIT_TOOL::Paste(), SCH_EDITOR_CONTROL::Paste(), PAD_TOOL::pastePadProperties(), EDIT_TOOL::pickCopyReferencePoint(), 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(), 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::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(), 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_toolSettings

TOOL_SETTINGS TOOL_BASE::m_toolSettings
protectedinherited

Definition at line 220 of file tool_base.h.

Referenced by TOOL_BASE::attachManager(), and TOOL_BASE::GetSettings().

◆ 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: