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

224  :
225  PCB_TOOL_BASE( "pcbnew.PointEditor" ),
226  m_selectionTool( NULL ),
227  m_editedPoint( NULL ),
228  m_original( VECTOR2I( 0, 0 ) ),
229  m_altConstrainer( VECTOR2I( 0, 0 ) ),
230  m_refill( false )
231 {
232 }
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 942 of file point_editor.cpp.

943 {
944  if( !m_editPoints )
945  return 0;
946 
947  EDA_ITEM* item = m_editPoints->GetParent();
948  PCB_BASE_EDIT_FRAME* frame = getEditFrame<PCB_BASE_EDIT_FRAME>();
949  const VECTOR2I& cursorPos = getViewControls()->GetCursorPosition();
950 
951  // called without an active edited polygon
952  if( !item || !canAddCorner( *item ) )
953  return 0;
954 
955  DRAWSEGMENT* graphicItem = dynamic_cast<DRAWSEGMENT*>( item );
956  BOARD_COMMIT commit( frame );
957 
958  if( item->Type() == PCB_ZONE_AREA_T ||
959  ( graphicItem && graphicItem->GetShape() == S_POLYGON ) )
960  {
961  unsigned int nearestIdx = 0;
962  unsigned int nextNearestIdx = 0;
963  unsigned int nearestDist = INT_MAX;
964  unsigned int firstPointInContour = 0;
965  SHAPE_POLY_SET* zoneOutline;
966 
967  if( item->Type() == PCB_ZONE_AREA_T )
968  {
969  ZONE_CONTAINER* zone = static_cast<ZONE_CONTAINER*>( item );
970  zoneOutline = zone->Outline();
971  zone->SetNeedRefill( true );
972  }
973  else
974  zoneOutline = &( graphicItem->GetPolyShape() );
975 
976  commit.Modify( item );
977 
978  // Search the best outline segment to add a new corner
979  // and therefore break this segment into two segments
980 
981  // Object to iterate through the corners of the outlines (main contour and its holes)
982  SHAPE_POLY_SET::ITERATOR iterator = zoneOutline->Iterate( 0,
983  zoneOutline->OutlineCount()-1, /* IterateHoles */ true );
984  int curr_idx = 0;
985 
986  // Iterate through all the corners of the outlines and search the best segment
987  for( ; iterator; iterator++, curr_idx++ )
988  {
989  int jj = curr_idx+1;
990 
991  if( iterator.IsEndContour() )
992  { // We reach the last point of the current contour (main or hole)
993  jj = firstPointInContour;
994  firstPointInContour = curr_idx+1; // Prepare next contour analysis
995  }
996 
997  SEG curr_segment( zoneOutline->Vertex( curr_idx ), zoneOutline->Vertex( jj ) );
998 
999  unsigned int distance = curr_segment.Distance( cursorPos );
1000 
1001  if( distance < nearestDist )
1002  {
1003  nearestDist = distance;
1004  nearestIdx = curr_idx;
1005  nextNearestIdx = jj;
1006  }
1007  }
1008 
1009  // Find the point on the closest segment
1010  VECTOR2I sideOrigin = zoneOutline->Vertex( nearestIdx );
1011  VECTOR2I sideEnd = zoneOutline->Vertex( nextNearestIdx );
1012  SEG nearestSide( sideOrigin, sideEnd );
1013  VECTOR2I nearestPoint = nearestSide.NearestPoint( cursorPos );
1014 
1015  // Do not add points that have the same coordinates as ones that already belong to polygon
1016  // instead, add a point in the middle of the side
1017  if( nearestPoint == sideOrigin || nearestPoint == sideEnd )
1018  nearestPoint = ( sideOrigin + sideEnd ) / 2;
1019 
1020  zoneOutline->InsertVertex( nextNearestIdx, nearestPoint );
1021 
1022  // We re-hatch the filled zones but not polygons
1023  if( item->Type() == PCB_ZONE_AREA_T )
1024  static_cast<ZONE_CONTAINER*>( item )->Hatch();
1025 
1026 
1027  commit.Push( _( "Add a zone corner" ) );
1028  }
1029 
1030  else if( graphicItem && graphicItem->GetShape() == S_SEGMENT )
1031  {
1032  commit.Modify( graphicItem );
1033 
1034  SEG seg( graphicItem->GetStart(), graphicItem->GetEnd() );
1035  VECTOR2I nearestPoint = seg.NearestPoint( cursorPos );
1036 
1037  // Move the end of the line to the break point..
1038  graphicItem->SetEnd( wxPoint( nearestPoint.x, nearestPoint.y ) );
1039 
1040  // and add another one starting from the break point
1041  DRAWSEGMENT* newSegment;
1042 
1043  if( item->Type() == PCB_MODULE_EDGE_T )
1044  {
1045  EDGE_MODULE* edge = static_cast<EDGE_MODULE*>( graphicItem );
1046  assert( edge->GetParent()->Type() == PCB_MODULE_T );
1047  newSegment = new EDGE_MODULE( *edge );
1048  }
1049  else
1050  {
1051  newSegment = new DRAWSEGMENT( *graphicItem );
1052  }
1053 
1054  newSegment->ClearSelected();
1055  newSegment->SetStart( wxPoint( nearestPoint.x, nearestPoint.y ) );
1056  newSegment->SetEnd( wxPoint( seg.B.x, seg.B.y ) );
1057 
1058  commit.Add( newSegment );
1059  commit.Push( _( "Split segment" ) );
1060  }
1061 
1062  updatePoints();
1063  return 0;
1064 }
Class ZONE_CONTAINER handles a list of polygons defining a copper zone.
Definition: class_zone.h:57
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
polygon (not yet used for tracks, but could be in microwave apps)
class ZONE_CONTAINER, a zone area
Definition: typeinfo.h:100
SHAPE_POLY_SET * Outline()
Definition: class_zone.h:237
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
VECTOR2I & Vertex(int aIndex, int aOutline, int aHole)
Returns the index-th vertex in a given hole outline within a given outline
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
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:168

References _, COMMIT::Add(), canAddCorner(), EDA_ITEM::ClearSelected(), 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_ZONE_AREA_T, BOARD_COMMIT::Push(), S_POLYGON, S_SEGMENT, DRAWSEGMENT::SetEnd(), ZONE_CONTAINER::SetNeedRefill(), DRAWSEGMENT::SetStart(), EDA_ITEM::Type(), updatePoints(), and SHAPE_POLY_SET::Vertex().

Referenced by setTransitions().

◆ addCornerCondition()

bool POINT_EDITOR::addCornerCondition ( const SELECTION aSelection)
staticprivate

Condition to display "Create corner" context menu entry.

Definition at line 874 of file point_editor.cpp.

875 {
876  if( aSelection.Size() != 1 )
877  return false;
878 
879  const EDA_ITEM* item = aSelection.Front();
880 
881  return ( item != nullptr ) && canAddCorner( *item );
882 }
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::changeTrackWidthOnClick(), ZONE_FILLER_TOOL::CheckAllZones(), DRC::checkClearancePadToPad(), DRC::checkClearanceSegmToPad(), PCB_INSPECTION_TOOL::ClearHighlight(), 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(), PAD_TOOL::haveFootprints(), 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::selectAllItemsConnectedToItem(), SELECTION_TOOL::selectAllItemsConnectedToTrack(), SELECTION_TOOL::selectAllItemsOnNet(), SELECTION_TOOL::selectAllItemsOnSheet(), SELECTION_TOOL::selectPoint(), DRC::testDisabledLayers(), DRC::TestZoneToZoneOutline(), PCBNEW_CONTROL::TrackDisplayMode(), 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 862 of file point_editor.cpp.

863 {
864  const auto type = aItem.Type();
865 
866  // Works only for zones and line segments
867  return type == PCB_ZONE_AREA_T ||
868  ( ( type == PCB_LINE_T || type == PCB_MODULE_EDGE_T ) &&
869  ( static_cast<const DRAWSEGMENT&>( aItem ).GetShape() == S_SEGMENT ||
870  static_cast<const DRAWSEGMENT&>( aItem ).GetShape() == S_POLYGON ) );
871 }
polygon (not yet used for tracks, but could be in microwave apps)
class ZONE_CONTAINER, a zone area
Definition: typeinfo.h:100
usual segment : line with rounded ends
class EDGE_MODULE, a footprint edge
Definition: typeinfo.h:94
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_ZONE_AREA_T, S_POLYGON, S_SEGMENT, and EDA_ITEM::Type().

Referenced by addCorner(), and addCornerCondition().

◆ canvas()

◆ controls()

◆ displayOptions()

◆ 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
185  * it around, eg rotate and flip
186  */
187 
188  if( TOOL_EVT_UTILS::IsRotateToolEvt( *evt ) && ( aOptions & IPO_ROTATE ) )
189  {
190  const int rotationAngle = TOOL_EVT_UTILS::GetEventRotationAngle( *frame(), *evt );
191  newItem->Rotate( newItem->GetPosition(), rotationAngle );
192  view()->Update( &preview );
193  }
194  else if( evt->IsAction( &PCB_ACTIONS::flip ) && ( aOptions & IPO_FLIP ) )
195  {
196  newItem->Flip( newItem->GetPosition(), frame()->Settings().m_FlipLeftRight );
197  view()->Update( &preview );
198  }
199  }
200 
201  else if( newItem && evt->IsMotion() )
202  {
203  // track the cursor
204  newItem->SetPosition( wxPoint( cursorPos.x, cursorPos.y ) );
205  aPlacer->SnapItem( newItem.get() );
206 
207  // Show a preview of the item
208  view()->Update( &preview );
209  }
210 
211  else
212  evt->SetPassEvent();
213  }
214 
215  view()->Remove( &preview );
216 }
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
virtual std::unique_ptr< BOARD_ITEM > CreateItem()=0
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:168
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:115
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
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, PCB_TOOL_BASE::module(), PCB_MODULE_T, INTERACTIVE_PLACER_BASE::PlaceItem(), EDA_BASE_FRAME::PopTool(), BOARD_COMMIT::Push(), EDA_BASE_FRAME::PushTool(), 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_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 616 of file point_editor.cpp.

617 {
618  auto item = m_editPoints->GetParent();
619 
620  if( !item )
621  return;
622 
623  if( item->Type() == PCB_ZONE_AREA_T )
624  {
625  auto zone = static_cast<ZONE_CONTAINER*>( item );
626 
627  if( zone->IsFilled() && m_refill && zone->NeedRefill() )
628  m_toolMgr->RunAction( PCB_ACTIONS::zoneFill, true, zone );
629  }
630 }
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:219
class ZONE_CONTAINER, a zone area
Definition: typeinfo.h:100
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:289
std::shared_ptr< EDIT_POINTS > m_editPoints
Currently available edit points.
Definition: point_editor.h:81

References m_editPoints, m_refill, TOOL_BASE::m_toolMgr, 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(), EDIT_TOOL::changeTrackWidthOnClick(), 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(), PAD_TOOL::Init(), SELECTION_TOOL::Init(), EDIT_TOOL::Init(), ROUTER_TOOL::InlineBreakTrack(), ROUTER_TOOL::InlineDrag(), PCBNEW_PICKER_TOOL::Main(), ROUTER_TOOL::MainLoop(), LENGTH_TUNER_TOOL::MainLoop(), LENGTH_TUNER_TOOL::meanderSettingsDialog(), EDIT_TOOL::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 810 of file point_editor.cpp.

811 {
812  EDA_ITEM* item = m_editPoints->GetParent();
813 
814  switch( item->Type() )
815  {
816  case PCB_LINE_T:
817  case PCB_MODULE_EDGE_T:
818  {
819  const DRAWSEGMENT* segment = static_cast<const DRAWSEGMENT*>( item );
820  {
821  switch( segment->GetShape() )
822  {
823  case S_SEGMENT:
824  return *( m_editPoints->Next( *m_editedPoint ) ); // select the other end of line
825 
826  case S_ARC:
827  case S_CIRCLE:
828  return m_editPoints->Point( CIRC_CENTER );
829 
830  default: // suppress warnings
831  break;
832  }
833  }
834 
835  break;
836  }
837 
838  case PCB_DIMENSION_T:
839  {
840  // Constraint for crossbar
841  if( isModified( m_editPoints->Point( DIM_FEATUREGO ) ) )
842  return m_editPoints->Point( DIM_FEATUREDO );
843 
844  else if( isModified( m_editPoints->Point( DIM_FEATUREDO ) ) )
845  return m_editPoints->Point( DIM_FEATUREGO );
846 
847  else
848  return EDIT_POINT( m_editedPoint->GetPosition() ); // no constraint
849 
850  break;
851  }
852 
853  default:
854  break;
855  }
856 
857  // In any other case we may align item to its original position
858  return m_original;
859 }
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:98
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:241
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::Move(), EDIT_TOOL::MoveExact(), PL_EDIT_TOOL::moveItem(), OnSelectionChange(), COMMON_TOOLS::PanControl(), LIB_EDIT_TOOL::Paste(), PL_EDIT_TOOL::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(), SELECTION_TOOL::Selectable(), GERBVIEW_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:246

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(), KICAD_MANAGER_CONTROL::setTransitions(), COMMON_CONTROL::setTransitions(), LIB_DRAWING_TOOLS::setTransitions(), ZONE_FILLER_TOOL::setTransitions(), EE_POINT_EDITOR::setTransitions(), PL_POINT_EDITOR::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(), PL_EDITOR_CONTROL::setTransitions(), LIB_EDIT_TOOL::setTransitions(), SCH_EDIT_TOOL::setTransitions(), PL_EDIT_TOOL::setTransitions(), POSITION_RELATIVE_TOOL::setTransitions(), GERBVIEW_SELECTION_TOOL::setTransitions(), COMMON_TOOLS::setTransitions(), SCH_LINE_WIRE_BUS_TOOL::setTransitions(), PCB_INSPECTION_TOOL::setTransitions(), PCBNEW_CONTROL::setTransitions(), ALIGN_DISTRIBUTE_TOOL::setTransitions(), MODULE_EDITOR_TOOLS::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 248 of file point_editor.cpp.

249 {
250  // Find the selection tool, so they can cooperate
252 
253  wxASSERT_MSG( m_selectionTool, _( "pcbnew.InteractiveSelection tool is not available" ) );
254 
255  auto& menu = m_selectionTool->GetToolMenu().GetMenu();
258  std::bind( &POINT_EDITOR::removeCornerCondition, this, _1 ) );
259 
260  return true;
261 }
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:203
static TOOL_ACTION pointEditorRemoveCorner
Removes a corner.
Definition: pcb_actions.h:206
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 1143 of file point_editor.cpp.

1144 {
1145  updatePoints();
1146  return 0;
1147 }
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 286 of file point_editor.cpp.

287 {
288  if( !m_selectionTool )
289  return 0;
290 
292 
293  if( selection.Size() != 1 || selection.Front()->GetEditFlags() )
294  return 0;
295 
296  Activate();
297 
299  KIGFX::VIEW* view = getView();
300  PCB_BASE_EDIT_FRAME* editFrame = getEditFrame<PCB_BASE_EDIT_FRAME>();
301 
302  controls->ShowCursor( true );
303 
304  GRID_HELPER grid( editFrame );
305  BOARD_ITEM* item = static_cast<BOARD_ITEM*>( selection.Front() );
306 
307  if( !item )
308  return 0;
309 
310  m_editPoints = EDIT_POINTS_FACTORY::Make( item, getView()->GetGAL() );
311 
312  if( !m_editPoints )
313  return 0;
314 
315  view->Add( m_editPoints.get() );
316  setEditedPoint( nullptr );
317  updateEditedPoint( aEvent );
318  m_refill = false;
319  bool inDrag = false;
320 
321  BOARD_COMMIT commit( editFrame );
322  LSET snapLayers = item->GetLayerSet();
323 
324  if( item->Type() == PCB_DIMENSION_T )
325  snapLayers = LSET::AllLayersMask();
326 
327  // Main loop: keep receiving events
328  while( TOOL_EVENT* evt = Wait() )
329  {
330  grid.SetSnap( !evt->Modifier( MD_SHIFT ) );
331  grid.SetUseGrid( !evt->Modifier( MD_ALT ) );
332  controls->SetSnapping( !evt->Modifier( MD_ALT ) );
333 
334  if( !m_editPoints || evt->IsSelectionEvent() )
335  break;
336 
337  if ( !inDrag )
338  updateEditedPoint( *evt );
339 
340  if( evt->IsDrag( BUT_LEFT ) && m_editedPoint )
341  {
342  if( !inDrag )
343  {
344  commit.StageItems( selection, CHT_MODIFY );
345 
346  controls->ForceCursorPosition( false );
347  m_original = *m_editedPoint; // Save the original position
348  controls->SetAutoPan( true );
349  inDrag = true;
350  grid.SetAuxAxes( true, m_original.GetPosition() );
351  }
352 
353  //TODO: unify the constraints to solve simultaneously instead of sequentially
354  m_editedPoint->SetPosition( grid.BestSnapAnchor( evt->Position(),
355  snapLayers, { item } ) );
356  bool enableAltConstraint = !!evt->Modifier( MD_CTRL );
357 
358  if( enableAltConstraint != (bool) m_altConstraint ) // alternative constraint
359  setAltConstraint( enableAltConstraint );
360 
361  if( m_altConstraint )
362  m_altConstraint->Apply();
363  else
365 
366  m_editedPoint->SetPosition( grid.BestSnapAnchor( m_editedPoint->GetPosition(),
367  snapLayers, { item } ) );
368 
369  updateItem();
370  updatePoints();
371  }
372 
373  else if( inDrag && evt->IsMouseUp( BUT_LEFT ) )
374  {
375  controls->SetAutoPan( false );
376  setAltConstraint( false );
377 
378  commit.Push( _( "Drag a corner" ) );
379  inDrag = false;
380  m_refill = true;
381  }
382 
383  else if( evt->IsCancelInteractive() || evt->IsActivate() )
384  {
385  if( inDrag ) // Restore the last change
386  commit.Revert();
387  else if( evt->IsCancelInteractive() )
388  break;
389 
390  if( evt->IsActivate() && !evt->IsMoveTool() )
391  break;
392  }
393 
394  else
395  evt->SetPassEvent();
396  }
397 
398  if( m_editPoints )
399  {
400  view->Remove( m_editPoints.get() );
401 
402  finishItem();
403  m_editPoints.reset();
404  }
405 
406  frame()->UpdateMsgPanel();
407 
408  return 0;
409 }
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:269
Class TOOL_EVENT.
Definition: tool_event.h:168
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:98
#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 1067 of file point_editor.cpp.

1068 {
1069  if( !m_editPoints || !m_editedPoint )
1070  return 0;
1071 
1072  EDA_ITEM* item = m_editPoints->GetParent();
1073 
1074  if( !item )
1075  return 0;
1076 
1077  SHAPE_POLY_SET* polygon = nullptr;
1078 
1079  if( item->Type() == PCB_ZONE_AREA_T)
1080  {
1081  auto zone = static_cast<ZONE_CONTAINER*>( item );
1082  polygon = zone->Outline();
1083  zone->SetNeedRefill( true );
1084  }
1085  else if( (item->Type() == PCB_MODULE_EDGE_T ) || ( item->Type() == PCB_LINE_T ) )
1086  {
1087  auto ds = static_cast<DRAWSEGMENT*>( item );
1088 
1089  if( ds->GetShape() == S_POLYGON )
1090  polygon = &ds->GetPolyShape();
1091  }
1092 
1093  if( !polygon )
1094  return 0;
1095 
1096  PCB_BASE_FRAME* frame = getEditFrame<PCB_BASE_FRAME>();
1097  BOARD_COMMIT commit( frame );
1098  auto vertex = findVertex( *polygon, *m_editedPoint );
1099 
1100  if( vertex.first )
1101  {
1102  const auto& vertexIdx = vertex.second;
1103  auto& outline = polygon->Polygon( vertexIdx.m_polygon )[vertexIdx.m_contour];
1104 
1105  if( outline.PointCount() > 3 )
1106  {
1107  // the usual case: remove just the corner when there are >3 vertices
1108  commit.Modify( item );
1109  polygon->RemoveVertex( vertexIdx );
1110  validatePolygon( *polygon );
1111  }
1112  else
1113  {
1114  // either remove a hole or the polygon when there are <= 3 corners
1115  if( vertexIdx.m_contour > 0 )
1116  {
1117  // remove hole
1118  commit.Modify( item );
1119  polygon->RemoveContour( vertexIdx.m_contour );
1120  }
1121  else
1122  {
1124  commit.Remove( item );
1125  }
1126  }
1127 
1128  setEditedPoint( nullptr );
1129 
1130  commit.Push( _( "Remove a zone/polygon corner" ) );
1131 
1132  // Refresh zone hatching
1133  if( item->Type() == PCB_ZONE_AREA_T)
1134  static_cast<ZONE_CONTAINER*>( item )->Hatch();
1135 
1136  updatePoints();
1137  }
1138 
1139  return 0;
1140 }
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:100
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 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_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 901 of file point_editor.cpp.

902 {
903  if( !m_editPoints || !m_editedPoint )
904  return false;
905 
906  EDA_ITEM* item = m_editPoints->GetParent();
907 
908  if( !item || !( item->Type() == PCB_ZONE_AREA_T ||
909  ( ( item->Type() == PCB_MODULE_EDGE_T || item->Type() == PCB_LINE_T ) &&
910  static_cast<DRAWSEGMENT*>( item )->GetShape() == S_POLYGON ) ) )
911  return false;
912 
913  SHAPE_POLY_SET *polyset;
914 
915  if( item->Type() == PCB_ZONE_AREA_T )
916  polyset = static_cast<ZONE_CONTAINER*>( item )->Outline();
917  else
918  polyset = &static_cast<DRAWSEGMENT*>( item )->GetPolyShape();
919 
920  auto vertex = findVertex( *polyset, *m_editedPoint );
921 
922  if( !vertex.first )
923  return false;
924 
925  const auto& vertexIdx = vertex.second;
926 
927  // Check if there are enough vertices so one can be removed without
928  // degenerating the polygon.
929  // The first condition allows one to remove all corners from holes (when
930  // there are only 2 vertices left, a hole is removed).
931  if( vertexIdx.m_contour == 0 && polyset->Polygon( vertexIdx.m_polygon )[vertexIdx.m_contour].PointCount() <= 3 )
932  return false;
933 
934  // Remove corner does not work with lines
935  if( dynamic_cast<EDIT_LINE*>( m_editedPoint ) )
936  return false;
937 
938  return m_editedPoint != NULL;
939 }
polygon (not yet used for tracks, but could be in microwave apps)
class ZONE_CONTAINER, a zone area
Definition: typeinfo.h:100
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 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_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 235 of file point_editor.cpp.

236 {
237  m_refill = false;
238  m_editPoints.reset();
239  m_altConstraint.reset();
240  getViewControls()->SetAutoPan( false );
241 
242  m_statusPopup.reset( new STATUS_TEXT_POPUP( getEditFrame<PCB_BASE_EDIT_FRAME>() ) );
243  m_statusPopup->SetTextColor( wxColour( 255, 0, 0 ) );
244  m_statusPopup->SetText( _( "Self-intersecting polygons are not allowed." ) );
245 }
Class STATUS_TEXT_POPUP.
Definition: status_popup.h:79
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 257 of file pcb_tool_base.cpp.

258 {
259  auto selTool = m_toolMgr->GetTool<SELECTION_TOOL>();
260  const auto& selection = selTool->GetSelection();
261  return selection;
262 }
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::changeTrackWidthOnClick(), 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(), SELECTION_TOOL::expandConnection(), 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(), SELECTION_TOOL::selectCopper(), 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 265 of file pcb_tool_base.cpp.

266 {
267  auto selTool = m_toolMgr->GetTool<SELECTION_TOOL>();
268  auto& selection = selTool->GetSelection();
269  return selection;
270 }
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 786 of file point_editor.cpp.

787 {
788  if( aEnabled )
789  {
790  EDIT_LINE* line = dynamic_cast<EDIT_LINE*>( m_editedPoint );
791 
792  if( line && m_editPoints->GetParent()->Type() == PCB_ZONE_AREA_T )
793  {
795  }
796  else
797  {
798  // Find a proper constraining point for 45 degrees mode
801  }
802  }
803  else
804  {
805  m_altConstraint.reset();
806  }
807 }
Class EC_CONVERGING.
Class EDIT_LINE.
Definition: edit_points.h:207
class ZONE_CONTAINER, a zone area
Definition: typeinfo.h:100
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.
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, 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 764 of file point_editor.cpp.

765 {
767 
768  if( aPoint )
769  {
770  frame()->GetCanvas()->SetCurrentCursor( wxCURSOR_ARROW );
771  controls->ForceCursorPosition( true, aPoint->GetPosition() );
772  controls->ShowCursor( true );
773  }
774  else
775  {
776  if( frame()->ToolStackIsEmpty() )
777  controls->ShowCursor( false );
778 
779  controls->ForceCursorPosition( false );
780  }
781 
782  m_editedPoint = aPoint;
783 }
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 1150 of file point_editor.cpp.

1151 {
1158 }
int OnSelectionChange(const TOOL_EVENT &aEvent)
Function OnSelected()
static const TOOL_EVENT SelectedEvent
Definition: actions.h:196
static TOOL_ACTION activatePointEditor
Definition: actions.h:158
static const TOOL_EVENT UnselectedEvent
Definition: actions.h:197
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:200
static TOOL_ACTION pointEditorAddCorner
Break outline (insert additional points to an edge)
Definition: pcb_actions.h:203
static TOOL_ACTION pointEditorRemoveCorner
Removes a corner.
Definition: pcb_actions.h:206
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 264 of file point_editor.cpp.

265 {
266  EDIT_POINT* point;
267 
268  if( aEvent.IsMotion() )
269  {
270  point = m_editPoints->FindPoint( aEvent.Position(), getView() );
271  }
272  else if( aEvent.IsDrag( BUT_LEFT ) )
273  {
274  point = m_editPoints->FindPoint( aEvent.DragOrigin(), getView() );
275  }
276  else
277  {
278  point = m_editPoints->FindPoint( getViewControls()->GetCursorPosition(), getView() );
279  }
280 
281  if( m_editedPoint != point )
282  setEditedPoint( point );
283 }
bool IsMotion() const
Definition: tool_event.h:303
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:293
const VECTOR2D DragOrigin() const
Returns the point where dragging has started.
Definition: tool_event.h:277
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:271

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

413 {
414  EDA_ITEM* item = m_editPoints->GetParent();
415 
416  if( !item )
417  return;
418 
419  switch( item->Type() )
420  {
421  case PCB_LINE_T:
422  case PCB_MODULE_EDGE_T:
423  {
424  DRAWSEGMENT* segment = static_cast<DRAWSEGMENT*>( item );
425  switch( segment->GetShape() )
426  {
427  case S_SEGMENT:
428  if( isModified( m_editPoints->Point( SEG_START ) ) )
429  segment->SetStart( wxPoint( m_editPoints->Point( SEG_START ).GetPosition().x,
430  m_editPoints->Point( SEG_START ).GetPosition().y ) );
431 
432  else if( isModified( m_editPoints->Point( SEG_END ) ) )
433  segment->SetEnd( wxPoint( m_editPoints->Point( SEG_END ).GetPosition().x,
434  m_editPoints->Point( SEG_END ).GetPosition().y ) );
435 
436  break;
437 
438  case S_ARC:
439  {
440  VECTOR2I center = m_editPoints->Point( ARC_CENTER ).GetPosition();
441  VECTOR2I mid = m_editPoints->Point( ARC_MID ).GetPosition();
442  VECTOR2I start = m_editPoints->Point( ARC_START ).GetPosition();
443  VECTOR2I end = m_editPoints->Point( ARC_END ).GetPosition();
444 
445  if( center != segment->GetCenter() )
446  {
447  wxPoint moveVector = wxPoint( center.x, center.y ) - segment->GetCenter();
448  segment->Move( moveVector );
449 
450  m_editPoints->Point( ARC_START ).SetPosition( segment->GetArcStart() );
451  m_editPoints->Point( ARC_END ).SetPosition( segment->GetArcEnd() );
452  m_editPoints->Point( ARC_MID ).SetPosition( segment->GetArcMid() );
453  }
454  else
455  {
456  if( mid != segment->GetArcMid() )
457  {
458  center = GetArcCenter( start, mid, end );
459  segment->SetCenter( wxPoint( center.x, center.y ) );
460  m_editPoints->Point( ARC_CENTER ).SetPosition( center );
461  }
462 
463  segment->SetArcStart( wxPoint( start.x, start.y ) );
464 
465  VECTOR2D startLine = start - center;
466  VECTOR2D endLine = end - center;
467  double newAngle = RAD2DECIDEG( endLine.Angle() - startLine.Angle() );
468 
469  // Adjust the new angle to (counter)clockwise setting
470  bool clockwise = ( segment->GetAngle() > 0 );
471 
472  if( clockwise && newAngle < 0.0 )
473  newAngle += 3600.0;
474  else if( !clockwise && newAngle > 0.0 )
475  newAngle -= 3600.0;
476 
477  segment->SetAngle( newAngle );
478  }
479 
480  break;
481  }
482 
483  case S_CIRCLE:
484  {
485  const VECTOR2I& center = m_editPoints->Point( CIRC_CENTER ).GetPosition();
486  const VECTOR2I& end = m_editPoints->Point( CIRC_END ).GetPosition();
487 
488  if( isModified( m_editPoints->Point( CIRC_CENTER ) ) )
489  {
490  wxPoint moveVector = wxPoint( center.x, center.y ) - segment->GetCenter();
491  segment->Move( moveVector );
492  }
493  else
494  {
495  segment->SetEnd( wxPoint( end.x, end.y ) );
496  }
497 
498  break;
499  }
500 
501  case S_POLYGON:
502  {
503  SHAPE_POLY_SET& outline = segment->GetPolyShape();
504 
505  for( int i = 0; i < outline.TotalVertices(); ++i )
506  outline.Vertex( i ) = m_editPoints->Point( i ).GetPosition();
507 
508  validatePolygon( outline );
509  break;
510  }
511 
512  case S_CURVE:
513  if( isModified( m_editPoints->Point( BEZIER_CURVE_START ) ) )
514  segment->SetStart( wxPoint( m_editPoints->Point( BEZIER_CURVE_START ).GetPosition().x,
515  m_editPoints->Point( BEZIER_CURVE_START ).GetPosition().y ) );
516  else if( isModified( m_editPoints->Point( BEZIER_CURVE_CONTROL_POINT1 ) ) )
517  segment->SetBezControl1( wxPoint( m_editPoints->Point( BEZIER_CURVE_CONTROL_POINT1 ).GetPosition().x,
518  m_editPoints->Point( BEZIER_CURVE_CONTROL_POINT1 ).GetPosition().y ) );
519  else if( isModified( m_editPoints->Point( BEZIER_CURVE_CONTROL_POINT2 ) ) )
520  segment->SetBezControl2( wxPoint( m_editPoints->Point( BEZIER_CURVE_CONTROL_POINT2 ).GetPosition().x,
521  m_editPoints->Point( BEZIER_CURVE_CONTROL_POINT2 ).GetPosition().y ) );
522  else if( isModified( m_editPoints->Point( BEZIER_CURVE_END ) ) )
523  segment->SetEnd( wxPoint( m_editPoints->Point( BEZIER_CURVE_END ).GetPosition().x,
524  m_editPoints->Point( BEZIER_CURVE_END ).GetPosition().y ) );
525 
526  segment->RebuildBezierToSegmentsPointsList( segment->GetWidth() );
527  break;
528 
529  default: // suppress warnings
530  break;
531  }
532 
533  // Update relative coordinates for module edges
534  if( EDGE_MODULE* edge = dyn_cast<EDGE_MODULE*>( item ) )
535  edge->SetLocalCoord();
536 
537  break;
538  }
539 
540  case PCB_ZONE_AREA_T:
541  {
542  ZONE_CONTAINER* zone = static_cast<ZONE_CONTAINER*>( item );
543  zone->ClearFilledPolysList();
544  SHAPE_POLY_SET& outline = *zone->Outline();
545 
546  for( int i = 0; i < outline.TotalVertices(); ++i )
547  {
548  if( outline.Vertex( i ) != m_editPoints->Point( i ).GetPosition() )
549  zone->SetNeedRefill( true );
550 
551  outline.Vertex( i ) = m_editPoints->Point( i ).GetPosition();
552  }
553 
554  validatePolygon( outline );
555  zone->Hatch();
556  break;
557  }
558 
559  case PCB_DIMENSION_T:
560  {
561  DIMENSION* dimension = static_cast<DIMENSION*>( item );
562 
563  // Check which point is currently modified and updated dimension's points respectively
564  if( isModified( m_editPoints->Point( DIM_CROSSBARO ) ) )
565  {
566  VECTOR2D featureLine( m_editedPoint->GetPosition() - dimension->GetOrigin() );
567  VECTOR2D crossBar( dimension->GetEnd() - dimension->GetOrigin() );
568 
569  if( featureLine.Cross( crossBar ) > 0 )
570  dimension->SetHeight( -featureLine.EuclideanNorm() );
571  else
572  dimension->SetHeight( featureLine.EuclideanNorm() );
573  }
574 
575  else if( isModified( m_editPoints->Point( DIM_CROSSBARF ) ) )
576  {
577  VECTOR2D featureLine( m_editedPoint->GetPosition() - dimension->GetEnd() );
578  VECTOR2D crossBar( dimension->GetEnd() - dimension->GetOrigin() );
579 
580  if( featureLine.Cross( crossBar ) > 0 )
581  dimension->SetHeight( -featureLine.EuclideanNorm() );
582  else
583  dimension->SetHeight( featureLine.EuclideanNorm() );
584  }
585 
586  else if( isModified( m_editPoints->Point( DIM_FEATUREGO ) ) )
587  {
588  dimension->SetOrigin( wxPoint( m_editedPoint->GetPosition().x, m_editedPoint->GetPosition().y ) );
589  m_editPoints->Point( DIM_CROSSBARO ).SetConstraint( new EC_LINE( m_editPoints->Point( DIM_CROSSBARO ),
590  m_editPoints->Point( DIM_FEATUREGO ) ) );
591  m_editPoints->Point( DIM_CROSSBARF ).SetConstraint( new EC_LINE( m_editPoints->Point( DIM_CROSSBARF ),
592  m_editPoints->Point( DIM_FEATUREDO ) ) );
593  }
594 
595  else if( isModified( m_editPoints->Point( DIM_FEATUREDO ) ) )
596  {
597  dimension->SetEnd( wxPoint( m_editedPoint->GetPosition().x, m_editedPoint->GetPosition().y ) );
598  m_editPoints->Point( DIM_CROSSBARO ).SetConstraint( new EC_LINE( m_editPoints->Point( DIM_CROSSBARO ),
599  m_editPoints->Point( DIM_FEATUREGO ) ) );
600  m_editPoints->Point( DIM_CROSSBARF ).SetConstraint( new EC_LINE( m_editPoints->Point( DIM_CROSSBARF ),
601  m_editPoints->Point( DIM_FEATUREDO ) ) );
602  }
603 
604  break;
605  }
606 
607  default:
608  break;
609  }
610 
611  if( frame() )
612  frame()->SetMsgPanel( item );
613 }
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:57
virtual void Move(const wxPoint &aMoveVector) override
Function Move move this object.
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
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:100
SHAPE_POLY_SET * Outline()
Definition: class_zone.h:237
double RAD2DECIDEG(double rad)
Definition: trigo.h:215
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.
VECTOR2I & Vertex(int aIndex, int aOutline, int aHole)
Returns the index-th vertex in a given hole outline within a given outline
PCB_BASE_EDIT_FRAME * frame() const
std::shared_ptr< EDIT_POINTS > m_editPoints
Currently available edit points.
Definition: point_editor.h:81
void SetOrigin(const wxPoint &aOrigin)
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 SetMsgPanel(const std::vector< MSG_PANEL_ITEM > &aList)
Clear the message panel and populates it with the contents of aList.
Class SHAPE_POLY_SET.
void SetEnd(const wxPoint &aEnd)
Function SetEnd Sets a new end of the crossbar line.
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:98
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.
void SetHeight(int aHeight)
Function SetHeight Sets the length of feature lines.
size_t i
Definition: json11.cpp:597
void Hatch()
Function Hatch computes the hatch lines depending on the hatch parameters and stores it in the zone's...
Definition: class_zone.cpp:973
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 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:362
Class DIMENSION.
void ClearFilledPolysList()
Function ClearFilledPolysList clears the list of filled polygons.
Definition: class_zone.h:533
KICAD_T Type() const
Function Type()
Definition: base_struct.h:210
void SetBezControl1(const wxPoint &aPoint)
void SetNeedRefill(bool aNeedRefill)
Definition: class_zone.h:168

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, CIRC_CENTER, CIRC_END, ZONE_CONTAINER::ClearFilledPolysList(), DIM_CROSSBARF, DIM_CROSSBARO, DIM_FEATUREDO, DIM_FEATUREGO, PCB_TOOL_BASE::frame(), DRAWSEGMENT::GetAngle(), GetArcCenter(), DRAWSEGMENT::GetArcEnd(), DRAWSEGMENT::GetArcMid(), DRAWSEGMENT::GetArcStart(), DRAWSEGMENT::GetCenter(), DIMENSION::GetEnd(), DIMENSION::GetOrigin(), DRAWSEGMENT::GetPolyShape(), EDIT_POINT::GetPosition(), DRAWSEGMENT::GetShape(), DRAWSEGMENT::GetWidth(), ZONE_CONTAINER::Hatch(), i, isModified(), m_editedPoint, m_editPoints, DRAWSEGMENT::Move(), ZONE_CONTAINER::Outline(), PCB_DIMENSION_T, PCB_LINE_T, PCB_MODULE_EDGE_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::TotalVertices(), EDA_ITEM::Type(), validatePolygon(), SHAPE_POLY_SET::Vertex(), 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 655 of file point_editor.cpp.

656 {
657  if( !m_editPoints )
658  return;
659 
660  EDA_ITEM* item = m_editPoints->GetParent();
661 
662  if( !item )
663  return;
664 
665  switch( item->Type() )
666  {
667  case PCB_LINE_T:
668  case PCB_MODULE_EDGE_T:
669  {
670  const DRAWSEGMENT* segment = static_cast<const DRAWSEGMENT*>( item );
671 
672  switch( segment->GetShape() )
673  {
674  case S_SEGMENT:
675  m_editPoints->Point( SEG_START ).SetPosition( segment->GetStart() );
676  m_editPoints->Point( SEG_END ).SetPosition( segment->GetEnd() );
677  break;
678 
679  case S_ARC:
680  m_editPoints->Point( ARC_CENTER ).SetPosition( segment->GetCenter() );
681  m_editPoints->Point( ARC_START ).SetPosition( segment->GetArcStart() );
682  m_editPoints->Point( ARC_MID ).SetPosition( segment->GetArcMid() );
683  m_editPoints->Point( ARC_END ).SetPosition( segment->GetArcEnd() );
684  break;
685 
686  case S_CIRCLE:
687  m_editPoints->Point( CIRC_CENTER ).SetPosition( segment->GetCenter() );
688  m_editPoints->Point( CIRC_END ).SetPosition( segment->GetEnd() );
689  break;
690 
691  case S_POLYGON:
692  {
693  const auto& points = segment->BuildPolyPointsList();
694 
695  if( m_editPoints->PointsSize() != (unsigned) points.size() )
696  {
697  getView()->Remove( m_editPoints.get() );
698  m_editedPoint = nullptr;
699  m_editPoints = EDIT_POINTS_FACTORY::Make( item, getView()->GetGAL() );
700  getView()->Add( m_editPoints.get() );
701  }
702  else
703  {
704  for( unsigned i = 0; i < points.size(); i++ )
705  m_editPoints->Point( i ).SetPosition( points[i] );
706  }
707  break;
708  }
709 
710  case S_CURVE:
711  m_editPoints->Point( BEZIER_CURVE_START ).SetPosition( segment->GetStart() );
712  m_editPoints->Point( BEZIER_CURVE_CONTROL_POINT1 ).SetPosition( segment->GetBezControl1() );
713  m_editPoints->Point( BEZIER_CURVE_CONTROL_POINT2 ).SetPosition( segment->GetBezControl2() );
714  m_editPoints->Point( BEZIER_CURVE_END ).SetPosition( segment->GetEnd() );
715  break;
716 
717  default: // suppress warnings
718  break;
719  }
720 
721  break;
722  }
723 
724  case PCB_ZONE_AREA_T:
725  {
726  ZONE_CONTAINER* zone = static_cast<ZONE_CONTAINER*>( item );
727  const SHAPE_POLY_SET* outline = zone->Outline();
728 
729  if( m_editPoints->PointsSize() != (unsigned) outline->TotalVertices() )
730  {
731  getView()->Remove( m_editPoints.get() );
732  m_editedPoint = nullptr;
733  m_editPoints = EDIT_POINTS_FACTORY::Make( item, getView()->GetGAL() );
734  getView()->Add( m_editPoints.get() );
735  }
736  else
737  {
738  for( int i = 0; i < outline->TotalVertices(); ++i )
739  m_editPoints->Point( i ).SetPosition( outline->CVertex( i ) );
740  }
741 
742  break;
743  }
744 
745  case PCB_DIMENSION_T:
746  {
747  const DIMENSION* dimension = static_cast<const DIMENSION*>( item );
748 
749  m_editPoints->Point( DIM_CROSSBARO ).SetPosition( dimension->m_crossBarO );
750  m_editPoints->Point( DIM_CROSSBARF ).SetPosition( dimension->m_crossBarF );
751  m_editPoints->Point( DIM_FEATUREGO ).SetPosition( dimension->m_featureLineGO );
752  m_editPoints->Point( DIM_FEATUREDO ).SetPosition( dimension->m_featureLineDO );
753  break;
754  }
755 
756  default:
757  break;
758  }
759 
760  getView()->Update( m_editPoints.get() );
761 }
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:57
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:100
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:237
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:98
KIGFX::VIEW * getView() const
Function getView()
Definition: tool_base.cpp:36
size_t i
Definition: json11.cpp:597
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 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_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 633 of file point_editor.cpp.

634 {
635  bool valid = !aPoly.IsSelfIntersecting();
636 
637  if( m_statusPopup )
638  {
639  if( valid )
640  {
641  m_statusPopup->Hide();
642  }
643  else
644  {
645  wxPoint p = wxGetMousePosition() + wxPoint( 20, 20 );
646  m_statusPopup->Move( p );
647  m_statusPopup->PopupFor( 1500 );
648  }
649  }
650 
651  return valid;
652 }
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(), SCH_LINE_WIRE_BUS_TOOL::Init(), EE_TOOL_BASE< SCH_BASE_FRAME >::Init(), SELECTION_TOOL::Init(), EDIT_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(), PCB_INSPECTION_TOOL::ClearHighlight(), SCH_EDITOR_CONTROL::ClearHighlight(), PL_SELECTION_TOOL::ClearSelection(), GERBVIEW_SELECTION_TOOL::clearSelection(), EE_SELECTION_TOOL::ClearSelection(), 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(), 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::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(), PL_DRAWING_TOOLS::Init(), LIB_CONTROL::Init(), PL_POINT_EDITOR::Init(), Init(), PCB_EDITOR_CONTROL::Init(), POSITION_RELATIVE_TOOL::Init(), EE_TOOL_BASE< SCH_BASE_FRAME >::Init(), EDIT_TOOL::Init(), ROUTER_TOOL::InlineBreakTrack(), ROUTER_TOOL::InlineDrag(), EDIT_TOOL::invokeInlineRouter(), EDIT_TOOL::isInteractiveDragEnabled(), 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(), 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(), SELECTION_TOOL::selectCopper(), 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(), SCH_LINE_WIRE_BUS_TOOL::UnfoldBus(), GERBVIEW_SELECTION_TOOL::UnselectItem(), 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().


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